Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

theprogrammablemind

Package Overview
Dependencies
Maintainers
0
Versions
563
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

theprogrammablemind - npm Package Compare versions

Comparing version 8.0.0-beta.41 to 8.0.0-beta.42

2

package.json

@@ -67,4 +67,4 @@ {

},
"version": "8.0.0-beta.41",
"version": "8.0.0-beta.42",
"license": "UNLICENSED"
}

@@ -52,27 +52,27 @@ const { args: contextArgs, normalizeGenerator, normalizeSemantic } = require('./helpers')

async matches (baseArgs, context, options = {}) {
const hierarchy = baseArgs.hierarchy
const config = baseArgs.config
const objects = baseArgs.getObjects(this.uuid)
// const ask = baseArgs.getAsk(this.uuid)
// return this.matcher(Object.assign({}, argsBase, {args: contextArgs(context, hierarchy), objects: objects, global: objects, context: context, hierarchy: hierarchy, api: this.getAPI(config)})
const callId = baseArgs.calls.current()
const moreArgs = {
uuid: this.uuid,
args: contextArgs(context, hierarchy),
objects,
global: objects,
context: context,
// hierarchy: hierarchy,
callId,
api: this.getAPI(config),
apis: this.getAPIs(config)
fixUpArgs (args, context) {
args.uuid = this.uuid
args.callId = args.calls.current()
const objects = args.getObjects(this.uuid)
args.objects = objects
args.global = objects
const config = args.config
args.api = this.getAPI(config)
args.apis = this.getAPIs(config)
args.args = contextArgs(context, args.hierarchy)
args.context = context
let n = (id) => id
if (config && 'nsToString' in config) {
n = (id) => config.nsToString(id)
}
const args = Object.assign({}, baseArgs, moreArgs, (baseArgs.getUUIDScoped || (() => { return {} }))(this.uuid))
args.n = n
args.uuid = this.uuid
debugger
Object.assign(args, (args.getUUIDScoped || (() => { return {} }))(this.uuid))
}
async matches (args, context, options = {}) {
this.fixUpArgs(args, context)
const matches = await this.matcher(args)
if (matches && (options.debug || {}).match ||
callId == this.callId) {
if (matches && (options.debug || {}).match || args.callId == this.callId) {
debugger // next line is the matcher

@@ -84,41 +84,15 @@ await this.matcher(args)

async apply (baseArgs, context, s, log, options = {}) {
const { hierarchy, config, response } = baseArgs
const objects = baseArgs.getObjects(this.uuid)
async apply (args, context, s, options = {}) {
const { config } = args
if (config && config.debugLoops) {
console.log('apply', this.toLabel())
}
if (baseArgs.calls && config && baseArgs.calls.stack.length > config.maxDepth) {
if (args.calls && config && args.calls.stack.length > config.maxDepth) {
throw new Error(`Max depth of ${config.maxDepth} for calls has been exceeded. maxDepth can be set on the config object. To see the calls run with the --dl or set the debugLoops property on the config`)
}
// const ask = baseArgs.getAsk(this.uuid)
if (!log) {
console.trace()
throw new Error('log is a required argument')
}
const contextPrime = Object.assign({}, context)
let n = (id) => id
if (config && 'nsToString' in config) {
n = (id) => config.nsToString(id)
}
const callId = baseArgs.calls.current()
const moreArgs = {
uuid: this.uuid,
callId,
args: contextArgs(context, hierarchy),
objects,
log,
global: objects,
n,
context: contextPrime,
uuid: this.uuid,
// config,
response,
api: this.getAPI(config),
apis: this.getAPIs(config)
}
const args = Object.assign({}, baseArgs, moreArgs, (baseArgs.getUUIDScoped || (() => { return {} }))(this.uuid))
if ((options.debug || {}).apply ||
callId == this.callId) {
this.fixUpArgs(args, contextPrime)
if ((options.debug || {}).apply || args.callId == this.callId) {
debugger

@@ -186,2 +160,3 @@ }

}
args = { ...args }
const config = args.config

@@ -194,2 +169,4 @@ let contextPrime = Object.assign({}, context)

let seenQuestion = false
const deferred = []
args.log = (message) => { this.logs.push(message) }
for (const isemantic in this.semantics) {

@@ -209,5 +186,13 @@ const semantic = this.semantics[isemantic]

this.calls[counter] += 1
const log = (message) => { this.logs.push(message) }
try {
contextPrime = await semantic.apply(args, context, s, log, options)
let deferWasCalled = false
const defer = (listener) => {
deferred.push({ semantic, listener })
deferWasCalled = true
}
args.defer = defer
contextPrime = await semantic.apply(args, context, s, options)
if (deferWasCalled) {
continue
}
if (!contextPrime.controlKeepMotivation && semantic.oneShot) {

@@ -217,6 +202,9 @@ // semantic.tied_ids.forEach((tied_id) => args.config.removeSemantic(tied_id))

}
for (const { listener } of deferred) {
listener(args)
}
} catch (e) {
contextPrime = null
let errorMessage
e.retryCall = () => semantic.apply(args, context, s, log, options)
e.retryCall = () => semantic.apply(args, context, s, options)
const help = 'The error has a retryCall property that will recall the function that failed.'

@@ -289,2 +277,9 @@ if (e.stack && e.message) {

lines.setElement(1, 2, JSON.stringify(contextPrime, null, 2))
for (const { semantic } of deferred) {
lines.setElement(0, 1, 'DEFERRED')
lines.setElement(0, 2, semantic.toLabel())
lines.newRow()
lines.setElement(0, 2, semantic.toString())
lines.newRow()
}
this.logs.push(lines.toString())

@@ -291,0 +286,0 @@ }

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc