agency-lang 0.0.94 → 0.0.96

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.
@@ -59,7 +59,8 @@ export function printTs(node, indent = 0) {
59
59
  }
60
60
  }
61
61
  case "varDecl": {
62
- let s = `${node.declKind} ${node.name}`;
62
+ //let s = `${node.declKind} ${node.name}`;
63
+ let s = `var ${node.name}`;
63
64
  if (node.typeAnnotation)
64
65
  s += `: ${node.typeAnnotation}`;
65
66
  if (node.initializer)
@@ -28,7 +28,7 @@ export declare const comma: Parser<(string[] | ",")[]>;
28
28
  export declare const plusSign: Parser<("+" | string[])[]>;
29
29
  export declare const commaWithNewline: Parser<(string[] | ",")[]>;
30
30
  export declare const varNameChar: Parser<string>;
31
- export declare const AGENCY_TEMPLATE_OFFSET = 3;
31
+ export declare const AGENCY_TEMPLATE_OFFSET = 2;
32
32
  /**
33
33
  * Wraps a parser to add a `loc` field from tarsec's withSpan.
34
34
  * Converts Span { start: Position, end: Position } to SourceLocation { line, col, start, end }.
@@ -23,7 +23,7 @@ export const varNameChar = oneOf("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRST
23
23
  However, because every agency code gets rendered in a template that imports some standard functions,
24
24
  the line numbers would be off if we didn't account for the template lines.
25
25
  */
26
- export const AGENCY_TEMPLATE_OFFSET = 3;
26
+ export const AGENCY_TEMPLATE_OFFSET = 2;
27
27
  /**
28
28
  * Wraps a parser to add a `loc` field from tarsec's withSpan.
29
29
  * Converts Span { start: Position, end: Position } to SourceLocation { line, col, start, end }.
@@ -1,4 +1,4 @@
1
- export declare const template = "import { print, printJSON, input, sleep, round, fetch, fetchJSON, read, write, readImage, notify, range, mostCommon, keys, values, entries } from \"std::index\";\nimport { map, filter, exclude, find, findIndex, reduce, flatMap, every, some, count, sortBy, unique, groupBy } from \"std::array\";\n\n{{{body:string}}}";
1
+ export declare const template = "import { print, printJSON, input, sleep, round, fetch, fetchJSON, read, write, readImage, notify, range, mostCommon, keys, values, entries } from \"std::index\";\n\n{{{body:string}}}";
2
2
  export type TemplateType = {
3
3
  body: string;
4
4
  };
@@ -3,7 +3,6 @@
3
3
  // Any manual changes will be lost.
4
4
  import { apply } from "typestache";
5
5
  export const template = `import { print, printJSON, input, sleep, round, fetch, fetchJSON, read, write, readImage, notify, range, mostCommon, keys, values, entries } from "std::index";
6
- import { map, filter, exclude, find, findIndex, reduce, flatMap, every, some, count, sortBy, unique, groupBy } from "std::array";
7
6
 
8
7
  {{{body:string}}}`;
9
8
  const render = (args) => {
@@ -1 +1 @@
1
- export declare const VERSION = "0.0.94";
1
+ export declare const VERSION = "0.0.96";
@@ -1 +1 @@
1
- export const VERSION = "0.0.94";
1
+ export const VERSION = "0.0.96";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agency-lang",
3
- "version": "0.0.94",
3
+ "version": "0.0.96",
4
4
  "description": "The Agency language",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
package/stdlib/array.js CHANGED
@@ -11,7 +11,7 @@ const __filename = fileURLToPath(import.meta.url);
11
11
  const __dirname = path.dirname(__filename);
12
12
  const __cwd = __process.cwd();
13
13
  const getDirname = () => __dirname;
14
- const __globalCtx = new RuntimeContext({
14
+ var __globalCtx = new RuntimeContext({
15
15
  statelogConfig: {
16
16
  host: "https://statelog.adit.io",
17
17
  apiKey: __process.env["STATELOG_API_KEY"] || "",
@@ -36,7 +36,7 @@ const __globalCtx = new RuntimeContext({
36
36
  traceDir: "traces"
37
37
  }
38
38
  });
39
- const graph = __globalCtx.graph;
39
+ var graph = __globalCtx.graph;
40
40
  // Path-dependent builtin wrappers
41
41
  export function readSkill({ filepath }) {
42
42
  return _readSkillRaw({ filepath, dirname: __dirname });
@@ -63,85 +63,85 @@ export const __getCheckpoints = () => __globalCtx.checkpoints;
63
63
  async function __initializeGlobals(__ctx) {
64
64
  __ctx.globals.markInitialized("stdlib/array.agency");
65
65
  }
66
- export const __mapTool = {
66
+ export var __mapTool = {
67
67
  name: "map",
68
68
  description: `Map a function over an array, returning a new array of results.`,
69
69
  schema: z.object({ "arr": z.array(z.any()), "func": z.string(), })
70
70
  };
71
- export const __mapToolParams = ["arr", "func"];
72
- export const __filterTool = {
71
+ export var __mapToolParams = ["arr", "func"];
72
+ export var __filterTool = {
73
73
  name: "filter",
74
74
  description: `Return a new array containing only the elements for which the function returns true.`,
75
75
  schema: z.object({ "arr": z.array(z.any()), "func": z.string(), })
76
76
  };
77
- export const __filterToolParams = ["arr", "func"];
78
- export const __excludeTool = {
77
+ export var __filterToolParams = ["arr", "func"];
78
+ export var __excludeTool = {
79
79
  name: "exclude",
80
80
  description: `Return a new array excluding elements for which the function returns true. Inverse of filter.`,
81
81
  schema: z.object({ "arr": z.array(z.any()), "func": z.string(), })
82
82
  };
83
- export const __excludeToolParams = ["arr", "func"];
84
- export const __findTool = {
83
+ export var __excludeToolParams = ["arr", "func"];
84
+ export var __findTool = {
85
85
  name: "find",
86
86
  description: `Return the first element for which the function returns true, or null if none match.`,
87
87
  schema: z.object({ "arr": z.array(z.any()), "func": z.string(), })
88
88
  };
89
- export const __findToolParams = ["arr", "func"];
90
- export const __findIndexTool = {
89
+ export var __findToolParams = ["arr", "func"];
90
+ export var __findIndexTool = {
91
91
  name: "findIndex",
92
92
  description: `Return the index of the first element for which the function returns true, or -1 if none match.`,
93
93
  schema: z.object({ "arr": z.array(z.any()), "func": z.string(), })
94
94
  };
95
- export const __findIndexToolParams = ["arr", "func"];
96
- export const __reduceTool = {
95
+ export var __findIndexToolParams = ["arr", "func"];
96
+ export var __reduceTool = {
97
97
  name: "reduce",
98
98
  description: `Reduce an array to a single value by applying a function to an accumulator and each element.`,
99
99
  schema: z.object({ "arr": z.array(z.any()), "initial": z.any(), "func": z.string(), })
100
100
  };
101
- export const __reduceToolParams = ["arr", "initial", "func"];
102
- export const __flatMapTool = {
101
+ export var __reduceToolParams = ["arr", "initial", "func"];
102
+ export var __flatMapTool = {
103
103
  name: "flatMap",
104
104
  description: `Map a function over an array and flatten the results by one level.`,
105
105
  schema: z.object({ "arr": z.array(z.any()), "func": z.string(), })
106
106
  };
107
- export const __flatMapToolParams = ["arr", "func"];
108
- export const __everyTool = {
107
+ export var __flatMapToolParams = ["arr", "func"];
108
+ export var __everyTool = {
109
109
  name: "every",
110
110
  description: `Return true if the function returns true for every element in the array.`,
111
111
  schema: z.object({ "arr": z.array(z.any()), "func": z.string(), })
112
112
  };
113
- export const __everyToolParams = ["arr", "func"];
114
- export const __someTool = {
113
+ export var __everyToolParams = ["arr", "func"];
114
+ export var __someTool = {
115
115
  name: "some",
116
116
  description: `Return true if the function returns true for at least one element in the array.`,
117
117
  schema: z.object({ "arr": z.array(z.any()), "func": z.string(), })
118
118
  };
119
- export const __someToolParams = ["arr", "func"];
120
- export const __countTool = {
119
+ export var __someToolParams = ["arr", "func"];
120
+ export var __countTool = {
121
121
  name: "count",
122
122
  description: `Count the number of elements in the array for which the function returns true.`,
123
123
  schema: z.object({ "arr": z.array(z.any()), "func": z.string(), })
124
124
  };
125
- export const __countToolParams = ["arr", "func"];
126
- export const __sortByTool = {
125
+ export var __countToolParams = ["arr", "func"];
126
+ export var __sortByTool = {
127
127
  name: "sortBy",
128
128
  description: `Return a new array sorted by the values returned by the function, in ascending order.`,
129
129
  schema: z.object({ "arr": z.array(z.any()), "func": z.string(), })
130
130
  };
131
- export const __sortByToolParams = ["arr", "func"];
132
- export const __uniqueTool = {
131
+ export var __sortByToolParams = ["arr", "func"];
132
+ export var __uniqueTool = {
133
133
  name: "unique",
134
134
  description: `Return a new array with duplicate elements removed, using the function to determine the identity of each element.`,
135
135
  schema: z.object({ "arr": z.array(z.any()), "func": z.string(), })
136
136
  };
137
- export const __uniqueToolParams = ["arr", "func"];
138
- export const __groupByTool = {
137
+ export var __uniqueToolParams = ["arr", "func"];
138
+ export var __groupByTool = {
139
139
  name: "groupBy",
140
140
  description: `Group elements of an array by the value returned by the function. Returns an object where keys are group names and values are arrays of elements.`,
141
141
  schema: z.object({ "arr": z.array(z.any()), "func": z.string(), })
142
142
  };
143
- export const __groupByToolParams = ["arr", "func"];
144
- const __toolRegistry = {
143
+ export var __groupByToolParams = ["arr", "func"];
144
+ var __toolRegistry = {
145
145
  map: {
146
146
  definition: __mapTool,
147
147
  handler: {
@@ -414,23 +414,23 @@ const __toolRegistry = {
414
414
  }
415
415
  };
416
416
  export async function map(arr, func, __state = undefined) {
417
- const __setupData = setupFunction({
417
+ var __setupData = setupFunction({
418
418
  state: __state
419
419
  });
420
420
  // __state will be undefined if this function is being called as a tool by an llm
421
- const __stack = __setupData.stack;
422
- const __step = __setupData.step;
423
- const __self = __setupData.self;
424
- const __threads = __setupData.threads;
425
- const __ctx = __state?.ctx || __globalCtx;
426
- const statelogClient = __ctx.statelogClient;
427
- const __graph = __ctx.graph;
428
- let __forked;
429
- let __functionCompleted = false;
421
+ var __stack = __setupData.stack;
422
+ var __step = __setupData.step;
423
+ var __self = __setupData.self;
424
+ var __threads = __setupData.threads;
425
+ var __ctx = __state?.ctx || __globalCtx;
426
+ var statelogClient = __ctx.statelogClient;
427
+ var __graph = __ctx.graph;
428
+ var __forked;
429
+ var __functionCompleted = false;
430
430
  if (!__ctx.globals.isInitialized("stdlib/array.agency")) {
431
431
  await __initializeGlobals(__ctx);
432
432
  }
433
- let __funcStartTime = performance.now();
433
+ var __funcStartTime = performance.now();
434
434
  await callHook({
435
435
  callbacks: __ctx.callbacks,
436
436
  name: "onFunctionStart",
@@ -513,23 +513,23 @@ export async function map(arr, func, __state = undefined) {
513
513
  }
514
514
  }
515
515
  export async function filter(arr, func, __state = undefined) {
516
- const __setupData = setupFunction({
516
+ var __setupData = setupFunction({
517
517
  state: __state
518
518
  });
519
519
  // __state will be undefined if this function is being called as a tool by an llm
520
- const __stack = __setupData.stack;
521
- const __step = __setupData.step;
522
- const __self = __setupData.self;
523
- const __threads = __setupData.threads;
524
- const __ctx = __state?.ctx || __globalCtx;
525
- const statelogClient = __ctx.statelogClient;
526
- const __graph = __ctx.graph;
527
- let __forked;
528
- let __functionCompleted = false;
520
+ var __stack = __setupData.stack;
521
+ var __step = __setupData.step;
522
+ var __self = __setupData.self;
523
+ var __threads = __setupData.threads;
524
+ var __ctx = __state?.ctx || __globalCtx;
525
+ var statelogClient = __ctx.statelogClient;
526
+ var __graph = __ctx.graph;
527
+ var __forked;
528
+ var __functionCompleted = false;
529
529
  if (!__ctx.globals.isInitialized("stdlib/array.agency")) {
530
530
  await __initializeGlobals(__ctx);
531
531
  }
532
- let __funcStartTime = performance.now();
532
+ var __funcStartTime = performance.now();
533
533
  await callHook({
534
534
  callbacks: __ctx.callbacks,
535
535
  name: "onFunctionStart",
@@ -619,23 +619,23 @@ export async function filter(arr, func, __state = undefined) {
619
619
  }
620
620
  }
621
621
  export async function exclude(arr, func, __state = undefined) {
622
- const __setupData = setupFunction({
622
+ var __setupData = setupFunction({
623
623
  state: __state
624
624
  });
625
625
  // __state will be undefined if this function is being called as a tool by an llm
626
- const __stack = __setupData.stack;
627
- const __step = __setupData.step;
628
- const __self = __setupData.self;
629
- const __threads = __setupData.threads;
630
- const __ctx = __state?.ctx || __globalCtx;
631
- const statelogClient = __ctx.statelogClient;
632
- const __graph = __ctx.graph;
633
- let __forked;
634
- let __functionCompleted = false;
626
+ var __stack = __setupData.stack;
627
+ var __step = __setupData.step;
628
+ var __self = __setupData.self;
629
+ var __threads = __setupData.threads;
630
+ var __ctx = __state?.ctx || __globalCtx;
631
+ var statelogClient = __ctx.statelogClient;
632
+ var __graph = __ctx.graph;
633
+ var __forked;
634
+ var __functionCompleted = false;
635
635
  if (!__ctx.globals.isInitialized("stdlib/array.agency")) {
636
636
  await __initializeGlobals(__ctx);
637
637
  }
638
- let __funcStartTime = performance.now();
638
+ var __funcStartTime = performance.now();
639
639
  await callHook({
640
640
  callbacks: __ctx.callbacks,
641
641
  name: "onFunctionStart",
@@ -725,23 +725,23 @@ export async function exclude(arr, func, __state = undefined) {
725
725
  }
726
726
  }
727
727
  export async function find(arr, func, __state = undefined) {
728
- const __setupData = setupFunction({
728
+ var __setupData = setupFunction({
729
729
  state: __state
730
730
  });
731
731
  // __state will be undefined if this function is being called as a tool by an llm
732
- const __stack = __setupData.stack;
733
- const __step = __setupData.step;
734
- const __self = __setupData.self;
735
- const __threads = __setupData.threads;
736
- const __ctx = __state?.ctx || __globalCtx;
737
- const statelogClient = __ctx.statelogClient;
738
- const __graph = __ctx.graph;
739
- let __forked;
740
- let __functionCompleted = false;
732
+ var __stack = __setupData.stack;
733
+ var __step = __setupData.step;
734
+ var __self = __setupData.self;
735
+ var __threads = __setupData.threads;
736
+ var __ctx = __state?.ctx || __globalCtx;
737
+ var statelogClient = __ctx.statelogClient;
738
+ var __graph = __ctx.graph;
739
+ var __forked;
740
+ var __functionCompleted = false;
741
741
  if (!__ctx.globals.isInitialized("stdlib/array.agency")) {
742
742
  await __initializeGlobals(__ctx);
743
743
  }
744
- let __funcStartTime = performance.now();
744
+ var __funcStartTime = performance.now();
745
745
  await callHook({
746
746
  callbacks: __ctx.callbacks,
747
747
  name: "onFunctionStart",
@@ -830,23 +830,23 @@ export async function find(arr, func, __state = undefined) {
830
830
  }
831
831
  }
832
832
  export async function findIndex(arr, func, __state = undefined) {
833
- const __setupData = setupFunction({
833
+ var __setupData = setupFunction({
834
834
  state: __state
835
835
  });
836
836
  // __state will be undefined if this function is being called as a tool by an llm
837
- const __stack = __setupData.stack;
838
- const __step = __setupData.step;
839
- const __self = __setupData.self;
840
- const __threads = __setupData.threads;
841
- const __ctx = __state?.ctx || __globalCtx;
842
- const statelogClient = __ctx.statelogClient;
843
- const __graph = __ctx.graph;
844
- let __forked;
845
- let __functionCompleted = false;
837
+ var __stack = __setupData.stack;
838
+ var __step = __setupData.step;
839
+ var __self = __setupData.self;
840
+ var __threads = __setupData.threads;
841
+ var __ctx = __state?.ctx || __globalCtx;
842
+ var statelogClient = __ctx.statelogClient;
843
+ var __graph = __ctx.graph;
844
+ var __forked;
845
+ var __functionCompleted = false;
846
846
  if (!__ctx.globals.isInitialized("stdlib/array.agency")) {
847
847
  await __initializeGlobals(__ctx);
848
848
  }
849
- let __funcStartTime = performance.now();
849
+ var __funcStartTime = performance.now();
850
850
  await callHook({
851
851
  callbacks: __ctx.callbacks,
852
852
  name: "onFunctionStart",
@@ -935,23 +935,23 @@ export async function findIndex(arr, func, __state = undefined) {
935
935
  }
936
936
  }
937
937
  export async function reduce(arr, initial, func, __state = undefined) {
938
- const __setupData = setupFunction({
938
+ var __setupData = setupFunction({
939
939
  state: __state
940
940
  });
941
941
  // __state will be undefined if this function is being called as a tool by an llm
942
- const __stack = __setupData.stack;
943
- const __step = __setupData.step;
944
- const __self = __setupData.self;
945
- const __threads = __setupData.threads;
946
- const __ctx = __state?.ctx || __globalCtx;
947
- const statelogClient = __ctx.statelogClient;
948
- const __graph = __ctx.graph;
949
- let __forked;
950
- let __functionCompleted = false;
942
+ var __stack = __setupData.stack;
943
+ var __step = __setupData.step;
944
+ var __self = __setupData.self;
945
+ var __threads = __setupData.threads;
946
+ var __ctx = __state?.ctx || __globalCtx;
947
+ var statelogClient = __ctx.statelogClient;
948
+ var __graph = __ctx.graph;
949
+ var __forked;
950
+ var __functionCompleted = false;
951
951
  if (!__ctx.globals.isInitialized("stdlib/array.agency")) {
952
952
  await __initializeGlobals(__ctx);
953
953
  }
954
- let __funcStartTime = performance.now();
954
+ var __funcStartTime = performance.now();
955
955
  await callHook({
956
956
  callbacks: __ctx.callbacks,
957
957
  name: "onFunctionStart",
@@ -1045,23 +1045,23 @@ export async function reduce(arr, initial, func, __state = undefined) {
1045
1045
  }
1046
1046
  }
1047
1047
  export async function flatMap(arr, func, __state = undefined) {
1048
- const __setupData = setupFunction({
1048
+ var __setupData = setupFunction({
1049
1049
  state: __state
1050
1050
  });
1051
1051
  // __state will be undefined if this function is being called as a tool by an llm
1052
- const __stack = __setupData.stack;
1053
- const __step = __setupData.step;
1054
- const __self = __setupData.self;
1055
- const __threads = __setupData.threads;
1056
- const __ctx = __state?.ctx || __globalCtx;
1057
- const statelogClient = __ctx.statelogClient;
1058
- const __graph = __ctx.graph;
1059
- let __forked;
1060
- let __functionCompleted = false;
1052
+ var __stack = __setupData.stack;
1053
+ var __step = __setupData.step;
1054
+ var __self = __setupData.self;
1055
+ var __threads = __setupData.threads;
1056
+ var __ctx = __state?.ctx || __globalCtx;
1057
+ var statelogClient = __ctx.statelogClient;
1058
+ var __graph = __ctx.graph;
1059
+ var __forked;
1060
+ var __functionCompleted = false;
1061
1061
  if (!__ctx.globals.isInitialized("stdlib/array.agency")) {
1062
1062
  await __initializeGlobals(__ctx);
1063
1063
  }
1064
- let __funcStartTime = performance.now();
1064
+ var __funcStartTime = performance.now();
1065
1065
  await callHook({
1066
1066
  callbacks: __ctx.callbacks,
1067
1067
  name: "onFunctionStart",
@@ -1154,23 +1154,23 @@ export async function flatMap(arr, func, __state = undefined) {
1154
1154
  }
1155
1155
  }
1156
1156
  export async function every(arr, func, __state = undefined) {
1157
- const __setupData = setupFunction({
1157
+ var __setupData = setupFunction({
1158
1158
  state: __state
1159
1159
  });
1160
1160
  // __state will be undefined if this function is being called as a tool by an llm
1161
- const __stack = __setupData.stack;
1162
- const __step = __setupData.step;
1163
- const __self = __setupData.self;
1164
- const __threads = __setupData.threads;
1165
- const __ctx = __state?.ctx || __globalCtx;
1166
- const statelogClient = __ctx.statelogClient;
1167
- const __graph = __ctx.graph;
1168
- let __forked;
1169
- let __functionCompleted = false;
1161
+ var __stack = __setupData.stack;
1162
+ var __step = __setupData.step;
1163
+ var __self = __setupData.self;
1164
+ var __threads = __setupData.threads;
1165
+ var __ctx = __state?.ctx || __globalCtx;
1166
+ var statelogClient = __ctx.statelogClient;
1167
+ var __graph = __ctx.graph;
1168
+ var __forked;
1169
+ var __functionCompleted = false;
1170
1170
  if (!__ctx.globals.isInitialized("stdlib/array.agency")) {
1171
1171
  await __initializeGlobals(__ctx);
1172
1172
  }
1173
- let __funcStartTime = performance.now();
1173
+ var __funcStartTime = performance.now();
1174
1174
  await callHook({
1175
1175
  callbacks: __ctx.callbacks,
1176
1176
  name: "onFunctionStart",
@@ -1259,23 +1259,23 @@ export async function every(arr, func, __state = undefined) {
1259
1259
  }
1260
1260
  }
1261
1261
  export async function some(arr, func, __state = undefined) {
1262
- const __setupData = setupFunction({
1262
+ var __setupData = setupFunction({
1263
1263
  state: __state
1264
1264
  });
1265
1265
  // __state will be undefined if this function is being called as a tool by an llm
1266
- const __stack = __setupData.stack;
1267
- const __step = __setupData.step;
1268
- const __self = __setupData.self;
1269
- const __threads = __setupData.threads;
1270
- const __ctx = __state?.ctx || __globalCtx;
1271
- const statelogClient = __ctx.statelogClient;
1272
- const __graph = __ctx.graph;
1273
- let __forked;
1274
- let __functionCompleted = false;
1266
+ var __stack = __setupData.stack;
1267
+ var __step = __setupData.step;
1268
+ var __self = __setupData.self;
1269
+ var __threads = __setupData.threads;
1270
+ var __ctx = __state?.ctx || __globalCtx;
1271
+ var statelogClient = __ctx.statelogClient;
1272
+ var __graph = __ctx.graph;
1273
+ var __forked;
1274
+ var __functionCompleted = false;
1275
1275
  if (!__ctx.globals.isInitialized("stdlib/array.agency")) {
1276
1276
  await __initializeGlobals(__ctx);
1277
1277
  }
1278
- let __funcStartTime = performance.now();
1278
+ var __funcStartTime = performance.now();
1279
1279
  await callHook({
1280
1280
  callbacks: __ctx.callbacks,
1281
1281
  name: "onFunctionStart",
@@ -1364,23 +1364,23 @@ export async function some(arr, func, __state = undefined) {
1364
1364
  }
1365
1365
  }
1366
1366
  export async function count(arr, func, __state = undefined) {
1367
- const __setupData = setupFunction({
1367
+ var __setupData = setupFunction({
1368
1368
  state: __state
1369
1369
  });
1370
1370
  // __state will be undefined if this function is being called as a tool by an llm
1371
- const __stack = __setupData.stack;
1372
- const __step = __setupData.step;
1373
- const __self = __setupData.self;
1374
- const __threads = __setupData.threads;
1375
- const __ctx = __state?.ctx || __globalCtx;
1376
- const statelogClient = __ctx.statelogClient;
1377
- const __graph = __ctx.graph;
1378
- let __forked;
1379
- let __functionCompleted = false;
1371
+ var __stack = __setupData.stack;
1372
+ var __step = __setupData.step;
1373
+ var __self = __setupData.self;
1374
+ var __threads = __setupData.threads;
1375
+ var __ctx = __state?.ctx || __globalCtx;
1376
+ var statelogClient = __ctx.statelogClient;
1377
+ var __graph = __ctx.graph;
1378
+ var __forked;
1379
+ var __functionCompleted = false;
1380
1380
  if (!__ctx.globals.isInitialized("stdlib/array.agency")) {
1381
1381
  await __initializeGlobals(__ctx);
1382
1382
  }
1383
- let __funcStartTime = performance.now();
1383
+ var __funcStartTime = performance.now();
1384
1384
  await callHook({
1385
1385
  callbacks: __ctx.callbacks,
1386
1386
  name: "onFunctionStart",
@@ -1470,23 +1470,23 @@ export async function count(arr, func, __state = undefined) {
1470
1470
  }
1471
1471
  }
1472
1472
  export async function sortBy(arr, func, __state = undefined) {
1473
- const __setupData = setupFunction({
1473
+ var __setupData = setupFunction({
1474
1474
  state: __state
1475
1475
  });
1476
1476
  // __state will be undefined if this function is being called as a tool by an llm
1477
- const __stack = __setupData.stack;
1478
- const __step = __setupData.step;
1479
- const __self = __setupData.self;
1480
- const __threads = __setupData.threads;
1481
- const __ctx = __state?.ctx || __globalCtx;
1482
- const statelogClient = __ctx.statelogClient;
1483
- const __graph = __ctx.graph;
1484
- let __forked;
1485
- let __functionCompleted = false;
1477
+ var __stack = __setupData.stack;
1478
+ var __step = __setupData.step;
1479
+ var __self = __setupData.self;
1480
+ var __threads = __setupData.threads;
1481
+ var __ctx = __state?.ctx || __globalCtx;
1482
+ var statelogClient = __ctx.statelogClient;
1483
+ var __graph = __ctx.graph;
1484
+ var __forked;
1485
+ var __functionCompleted = false;
1486
1486
  if (!__ctx.globals.isInitialized("stdlib/array.agency")) {
1487
1487
  await __initializeGlobals(__ctx);
1488
1488
  }
1489
- let __funcStartTime = performance.now();
1489
+ var __funcStartTime = performance.now();
1490
1490
  await callHook({
1491
1491
  callbacks: __ctx.callbacks,
1492
1492
  name: "onFunctionStart",
@@ -1601,23 +1601,23 @@ export async function sortBy(arr, func, __state = undefined) {
1601
1601
  }
1602
1602
  }
1603
1603
  export async function unique(arr, func, __state = undefined) {
1604
- const __setupData = setupFunction({
1604
+ var __setupData = setupFunction({
1605
1605
  state: __state
1606
1606
  });
1607
1607
  // __state will be undefined if this function is being called as a tool by an llm
1608
- const __stack = __setupData.stack;
1609
- const __step = __setupData.step;
1610
- const __self = __setupData.self;
1611
- const __threads = __setupData.threads;
1612
- const __ctx = __state?.ctx || __globalCtx;
1613
- const statelogClient = __ctx.statelogClient;
1614
- const __graph = __ctx.graph;
1615
- let __forked;
1616
- let __functionCompleted = false;
1608
+ var __stack = __setupData.stack;
1609
+ var __step = __setupData.step;
1610
+ var __self = __setupData.self;
1611
+ var __threads = __setupData.threads;
1612
+ var __ctx = __state?.ctx || __globalCtx;
1613
+ var statelogClient = __ctx.statelogClient;
1614
+ var __graph = __ctx.graph;
1615
+ var __forked;
1616
+ var __functionCompleted = false;
1617
1617
  if (!__ctx.globals.isInitialized("stdlib/array.agency")) {
1618
1618
  await __initializeGlobals(__ctx);
1619
1619
  }
1620
- let __funcStartTime = performance.now();
1620
+ var __funcStartTime = performance.now();
1621
1621
  await callHook({
1622
1622
  callbacks: __ctx.callbacks,
1623
1623
  name: "onFunctionStart",
@@ -1736,23 +1736,23 @@ export async function unique(arr, func, __state = undefined) {
1736
1736
  }
1737
1737
  }
1738
1738
  export async function groupBy(arr, func, __state = undefined) {
1739
- const __setupData = setupFunction({
1739
+ var __setupData = setupFunction({
1740
1740
  state: __state
1741
1741
  });
1742
1742
  // __state will be undefined if this function is being called as a tool by an llm
1743
- const __stack = __setupData.stack;
1744
- const __step = __setupData.step;
1745
- const __self = __setupData.self;
1746
- const __threads = __setupData.threads;
1747
- const __ctx = __state?.ctx || __globalCtx;
1748
- const statelogClient = __ctx.statelogClient;
1749
- const __graph = __ctx.graph;
1750
- let __forked;
1751
- let __functionCompleted = false;
1743
+ var __stack = __setupData.stack;
1744
+ var __step = __setupData.step;
1745
+ var __self = __setupData.self;
1746
+ var __threads = __setupData.threads;
1747
+ var __ctx = __state?.ctx || __globalCtx;
1748
+ var statelogClient = __ctx.statelogClient;
1749
+ var __graph = __ctx.graph;
1750
+ var __forked;
1751
+ var __functionCompleted = false;
1752
1752
  if (!__ctx.globals.isInitialized("stdlib/array.agency")) {
1753
1753
  await __initializeGlobals(__ctx);
1754
1754
  }
1755
- let __funcStartTime = performance.now();
1755
+ var __funcStartTime = performance.now();
1756
1756
  await callHook({
1757
1757
  callbacks: __ctx.callbacks,
1758
1758
  name: "onFunctionStart",