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.
- package/dist/lib/ir/prettyPrint.js +2 -1
- package/dist/lib/parsers/parsers.d.ts +1 -1
- package/dist/lib/parsers/parsers.js +1 -1
- package/dist/lib/templates/backends/agency/template.d.ts +1 -1
- package/dist/lib/templates/backends/agency/template.js +0 -1
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/package.json +1 -1
- package/stdlib/array.js +172 -172
- package/stdlib/index.js +211 -211
|
@@ -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 =
|
|
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 =
|
|
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\";\
|
|
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) => {
|
package/dist/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.0.
|
|
1
|
+
export declare const VERSION = "0.0.96";
|
package/dist/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.0.
|
|
1
|
+
export const VERSION = "0.0.96";
|
package/package.json
CHANGED
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
72
|
-
export
|
|
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
|
|
78
|
-
export
|
|
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
|
|
84
|
-
export
|
|
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
|
|
90
|
-
export
|
|
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
|
|
96
|
-
export
|
|
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
|
|
102
|
-
export
|
|
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
|
|
108
|
-
export
|
|
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
|
|
114
|
-
export
|
|
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
|
|
120
|
-
export
|
|
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
|
|
126
|
-
export
|
|
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
|
|
132
|
-
export
|
|
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
|
|
138
|
-
export
|
|
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
|
|
144
|
-
|
|
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
|
-
|
|
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
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
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
|
-
|
|
1755
|
+
var __funcStartTime = performance.now();
|
|
1756
1756
|
await callHook({
|
|
1757
1757
|
callbacks: __ctx.callbacks,
|
|
1758
1758
|
name: "onFunctionStart",
|