agency-lang 0.0.46 → 0.0.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- export declare const template = "\ngraph.node(\"{{{name}}}\", async (state): Promise<any> => {\n const __messages: Message[] = state.messages || [];\n const __graph = state.__metadata?.graph || graph;\n const statelogClient = state.__metadata?.statelogClient || __statelogClient;\n \n // if `state.__metadata?.__stateStack` is set, that means we are resuming execution\n // at this node after an interrupt. In that case, this is the line that restores the state.\n if (state.__metadata?.__stateStack) {\n __stateStack = structuredClone(state.__metadata.__stateStack);\n \n // clear the state stack from metadata so it doesn't propagate to other nodes.\n state.__metadata.__stateStack = undefined;\n }\n\n // either creates a new stack for this node,\n // or restores the stack if we're resuming after an interrupt,\n // depending on the mode of the state stack (serialize or deserialize).\n const __stack = __stateStack.getNewState();\n \n // We're going to modify __stack.step to keep track of what line we're on,\n // but first we save this value. This will help us figure out if we should execute\n // from the start of this node or from a specific line.\n const __step = __stack.step;\n\n const __self: Record<string, any> = __stack.locals;\n\n // If we're resuming after an interrupt, these will be set.\n // There should be a cleaner way to handle this,\n // instead of littering this scope with these variables\n const __interruptResponse: InterruptResponseType | undefined = state.__metadata?.interruptResponse;\n const __toolCall: Record<string, any>|undefined = __stateStack.other?.toolCall;\n\n // TODO pretty sure this isn't needed, check and remove\n if (state.__metadata?.state?.global) {\n __global = state.__metadata.state.global;\n }\n\n {{#hasParam}}\n \n const __params = {{{paramNames}}};\n \n // Any arguments that were passed into this node,\n // save them onto the stack, unless we are restoring the stack after an interrupt,\n // in which case leave as is\n if (state.data !== \"<from-stack>\") {\n (state.data).forEach((item, index) => {\n __stack.args[__params[index]] = item;\n });\n }\n {{/hasParam}}\n {{{body}}}\n \n // this is just here to have a default return value from a node if the user doesn't specify one\n return { ...state, data: undefined };\n});\n";
1
+ export declare const template = "\ngraph.node(\"{{{name}}}\", async (state): Promise<any> => {\n const __messages: Message[] = state.messages || [];\n const __graph = state.__metadata?.graph || graph;\n const statelogClient = state.__metadata?.statelogClient || __statelogClient;\n \n // if `state.__metadata?.__stateStack` is set, that means we are resuming execution\n // at this node after an interrupt. In that case, this is the line that restores the state.\n if (state.__metadata?.__stateStack) {\n __stateStack = state.__metadata.__stateStack;\n \n // clear the state stack from metadata so it doesn't propagate to other nodes.\n state.__metadata.__stateStack = undefined;\n }\n\n // either creates a new stack for this node,\n // or restores the stack if we're resuming after an interrupt,\n // depending on the mode of the state stack (serialize or deserialize).\n const __stack = __stateStack.getNewState();\n \n // We're going to modify __stack.step to keep track of what line we're on,\n // but first we save this value. This will help us figure out if we should execute\n // from the start of this node or from a specific line.\n const __step = __stack.step;\n\n const __self: Record<string, any> = __stack.locals;\n\n // If we're resuming after an interrupt, these will be set.\n // There should be a cleaner way to handle this,\n // instead of littering this scope with these variables\n const __interruptResponse: InterruptResponseType | undefined = state.__metadata?.interruptResponse;\n const __toolCall: Record<string, any>|undefined = __stateStack.other?.toolCall;\n\n // TODO pretty sure this isn't needed, check and remove\n if (state.__metadata?.state?.global) {\n __global = state.__metadata.state.global;\n }\n\n {{#hasParam}}\n \n const __params = {{{paramNames}}};\n \n // Any arguments that were passed into this node,\n // save them onto the stack, unless we are restoring the stack after an interrupt,\n // in which case leave as is\n if (state.data !== \"<from-stack>\") {\n (state.data).forEach((item, index) => {\n __stack.args[__params[index]] = item;\n });\n }\n {{/hasParam}}\n {{{body}}}\n \n // this is just here to have a default return value from a node if the user doesn't specify one\n return { ...state, data: undefined };\n});\n";
2
2
  export type TemplateType = {
3
3
  name: string | boolean | number;
4
4
  hasParam: boolean;
@@ -11,7 +11,7 @@ graph.node("{{{name}}}", async (state): Promise<any> => {
11
11
  // if \`state.__metadata?.__stateStack\` is set, that means we are resuming execution
12
12
  // at this node after an interrupt. In that case, this is the line that restores the state.
13
13
  if (state.__metadata?.__stateStack) {
14
- __stateStack = structuredClone(state.__metadata.__stateStack);
14
+ __stateStack = state.__metadata.__stateStack;
15
15
 
16
16
  // clear the state stack from metadata so it doesn't propagate to other nodes.
17
17
  state.__metadata.__stateStack = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agency-lang",
3
- "version": "0.0.46",
3
+ "version": "0.0.47",
4
4
  "description": "The Agency language",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {