agency-lang 0.0.94 → 0.0.95
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/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)
|
package/dist/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.0.
|
|
1
|
+
export declare const VERSION = "0.0.95";
|
package/dist/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.0.
|
|
1
|
+
export const VERSION = "0.0.95";
|
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",
|
package/stdlib/index.js
CHANGED
|
@@ -10,7 +10,7 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
10
10
|
const __dirname = path.dirname(__filename);
|
|
11
11
|
const __cwd = __process.cwd();
|
|
12
12
|
const getDirname = () => __dirname;
|
|
13
|
-
|
|
13
|
+
var __globalCtx = new RuntimeContext({
|
|
14
14
|
statelogConfig: {
|
|
15
15
|
host: "https://statelog.adit.io",
|
|
16
16
|
apiKey: __process.env["STATELOG_API_KEY"] || "",
|
|
@@ -35,7 +35,7 @@ const __globalCtx = new RuntimeContext({
|
|
|
35
35
|
traceDir: "traces"
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
-
|
|
38
|
+
var graph = __globalCtx.graph;
|
|
39
39
|
// Path-dependent builtin wrappers
|
|
40
40
|
export function readSkill({ filepath }) {
|
|
41
41
|
return _readSkillRaw({ filepath, dirname: __dirname });
|
|
@@ -62,103 +62,103 @@ export const __getCheckpoints = () => __globalCtx.checkpoints;
|
|
|
62
62
|
async function __initializeGlobals(__ctx) {
|
|
63
63
|
__ctx.globals.markInitialized("stdlib/index.agency");
|
|
64
64
|
}
|
|
65
|
-
export
|
|
65
|
+
export var __printTool = {
|
|
66
66
|
name: "print",
|
|
67
67
|
description: `A tool for printing a message to the console.`,
|
|
68
68
|
schema: z.object({ "messages": z.string(), })
|
|
69
69
|
};
|
|
70
|
-
export
|
|
71
|
-
export
|
|
70
|
+
export var __printToolParams = ["messages"];
|
|
71
|
+
export var __printJSONTool = {
|
|
72
72
|
name: "printJSON",
|
|
73
73
|
description: `A tool for printing an object as formatted JSON to the console.`,
|
|
74
74
|
schema: z.object({ "obj": z.string(), })
|
|
75
75
|
};
|
|
76
|
-
export
|
|
77
|
-
export
|
|
76
|
+
export var __printJSONToolParams = ["obj"];
|
|
77
|
+
export var __inputTool = {
|
|
78
78
|
name: "input",
|
|
79
79
|
description: `A tool for prompting the user for input and returning their response.`,
|
|
80
80
|
schema: z.object({ "prompt": z.string(), })
|
|
81
81
|
};
|
|
82
|
-
export
|
|
83
|
-
export
|
|
82
|
+
export var __inputToolParams = ["prompt"];
|
|
83
|
+
export var __sleepTool = {
|
|
84
84
|
name: "sleep",
|
|
85
85
|
description: `A tool for pausing execution for a specified number of seconds.`,
|
|
86
86
|
schema: z.object({ "seconds": z.number(), })
|
|
87
87
|
};
|
|
88
|
-
export
|
|
89
|
-
export
|
|
88
|
+
export var __sleepToolParams = ["seconds"];
|
|
89
|
+
export var __roundTool = {
|
|
90
90
|
name: "round",
|
|
91
91
|
description: `A tool for rounding a number to a specified number of decimal places.`,
|
|
92
92
|
schema: z.object({ "num": z.number(), "precision": z.number(), })
|
|
93
93
|
};
|
|
94
|
-
export
|
|
95
|
-
export
|
|
94
|
+
export var __roundToolParams = ["num", "precision"];
|
|
95
|
+
export var __fetchTool = {
|
|
96
96
|
name: "fetch",
|
|
97
97
|
description: `A tool for fetching a URL and returning the response as text.`,
|
|
98
98
|
schema: z.object({ "url": z.string(), })
|
|
99
99
|
};
|
|
100
|
-
export
|
|
101
|
-
export
|
|
100
|
+
export var __fetchToolParams = ["url"];
|
|
101
|
+
export var __fetchJSONTool = {
|
|
102
102
|
name: "fetchJSON",
|
|
103
103
|
description: `A tool for fetching a URL and returning the response as parsed JSON.`,
|
|
104
104
|
schema: z.object({ "url": z.string(), })
|
|
105
105
|
};
|
|
106
|
-
export
|
|
107
|
-
export
|
|
106
|
+
export var __fetchJSONToolParams = ["url"];
|
|
107
|
+
export var __readTool = {
|
|
108
108
|
name: "read",
|
|
109
109
|
description: `A tool for reading the contents of a file and returning it as a string.`,
|
|
110
110
|
schema: z.object({ "filename": z.string(), })
|
|
111
111
|
};
|
|
112
|
-
export
|
|
113
|
-
export
|
|
112
|
+
export var __readToolParams = ["filename"];
|
|
113
|
+
export var __writeTool = {
|
|
114
114
|
name: "write",
|
|
115
115
|
description: `A tool for writing content to a file.`,
|
|
116
116
|
schema: z.object({ "filename": z.string(), "content": z.string(), })
|
|
117
117
|
};
|
|
118
|
-
export
|
|
119
|
-
export
|
|
118
|
+
export var __writeToolParams = ["filename", "content"];
|
|
119
|
+
export var __readImageTool = {
|
|
120
120
|
name: "readImage",
|
|
121
121
|
description: `A tool for reading an image file and returning its contents as a Base64-encoded string.`,
|
|
122
122
|
schema: z.object({ "filename": z.string(), })
|
|
123
123
|
};
|
|
124
|
-
export
|
|
125
|
-
export
|
|
124
|
+
export var __readImageToolParams = ["filename"];
|
|
125
|
+
export var __notifyTool = {
|
|
126
126
|
name: "notify",
|
|
127
127
|
description: `A tool for showing a native OS notification with a title and message. Returns true if the notification was sent.`,
|
|
128
128
|
schema: z.object({ "title": z.string(), "message": z.string(), })
|
|
129
129
|
};
|
|
130
|
-
export
|
|
131
|
-
export
|
|
130
|
+
export var __notifyToolParams = ["title", "message"];
|
|
131
|
+
export var __rangeTool = {
|
|
132
132
|
name: "range",
|
|
133
133
|
description: `Generate an array of numbers. With one argument, generates from 0 to start-1. With two arguments, generates from start to end-1.`,
|
|
134
134
|
schema: z.object({ "start": z.number(), "end": z.number().nullable().describe("Default: -1"), })
|
|
135
135
|
};
|
|
136
|
-
export
|
|
137
|
-
export
|
|
136
|
+
export var __rangeToolParams = ["start", "end"];
|
|
137
|
+
export var __mostCommonTool = {
|
|
138
138
|
name: "mostCommon",
|
|
139
139
|
description: `Return the most common element in an array. Uses JSON serialization for comparison.`,
|
|
140
140
|
schema: z.object({ "items": z.array(z.any()), })
|
|
141
141
|
};
|
|
142
|
-
export
|
|
143
|
-
export
|
|
142
|
+
export var __mostCommonToolParams = ["items"];
|
|
143
|
+
export var __keysTool = {
|
|
144
144
|
name: "keys",
|
|
145
145
|
description: `Return an array of an object's own enumerable property names.`,
|
|
146
146
|
schema: z.object({ "obj": z.any(), })
|
|
147
147
|
};
|
|
148
|
-
export
|
|
149
|
-
export
|
|
148
|
+
export var __keysToolParams = ["obj"];
|
|
149
|
+
export var __valuesTool = {
|
|
150
150
|
name: "values",
|
|
151
151
|
description: `Return an array of an object's own enumerable property values.`,
|
|
152
152
|
schema: z.object({ "obj": z.any(), })
|
|
153
153
|
};
|
|
154
|
-
export
|
|
155
|
-
export
|
|
154
|
+
export var __valuesToolParams = ["obj"];
|
|
155
|
+
export var __entriesTool = {
|
|
156
156
|
name: "entries",
|
|
157
157
|
description: `Return an array of an object's own enumerable entries, each as { key, value }.`,
|
|
158
158
|
schema: z.object({ "obj": z.any(), })
|
|
159
159
|
};
|
|
160
|
-
export
|
|
161
|
-
|
|
160
|
+
export var __entriesToolParams = ["obj"];
|
|
161
|
+
var __toolRegistry = {
|
|
162
162
|
print: {
|
|
163
163
|
definition: __printTool,
|
|
164
164
|
handler: {
|
|
@@ -314,23 +314,23 @@ const __toolRegistry = {
|
|
|
314
314
|
}
|
|
315
315
|
};
|
|
316
316
|
export async function print(messages, __state = undefined) {
|
|
317
|
-
|
|
317
|
+
var __setupData = setupFunction({
|
|
318
318
|
state: __state
|
|
319
319
|
});
|
|
320
320
|
// __state will be undefined if this function is being called as a tool by an llm
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
321
|
+
var __stack = __setupData.stack;
|
|
322
|
+
var __step = __setupData.step;
|
|
323
|
+
var __self = __setupData.self;
|
|
324
|
+
var __threads = __setupData.threads;
|
|
325
|
+
var __ctx = __state?.ctx || __globalCtx;
|
|
326
|
+
var statelogClient = __ctx.statelogClient;
|
|
327
|
+
var __graph = __ctx.graph;
|
|
328
|
+
var __forked;
|
|
329
|
+
var __functionCompleted = false;
|
|
330
330
|
if (!__ctx.globals.isInitialized("stdlib/index.agency")) {
|
|
331
331
|
await __initializeGlobals(__ctx);
|
|
332
332
|
}
|
|
333
|
-
|
|
333
|
+
var __funcStartTime = performance.now();
|
|
334
334
|
await callHook({
|
|
335
335
|
callbacks: __ctx.callbacks,
|
|
336
336
|
name: "onFunctionStart",
|
|
@@ -397,23 +397,23 @@ export async function print(messages, __state = undefined) {
|
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
399
|
export async function printJSON(obj, __state = undefined) {
|
|
400
|
-
|
|
400
|
+
var __setupData = setupFunction({
|
|
401
401
|
state: __state
|
|
402
402
|
});
|
|
403
403
|
// __state will be undefined if this function is being called as a tool by an llm
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
404
|
+
var __stack = __setupData.stack;
|
|
405
|
+
var __step = __setupData.step;
|
|
406
|
+
var __self = __setupData.self;
|
|
407
|
+
var __threads = __setupData.threads;
|
|
408
|
+
var __ctx = __state?.ctx || __globalCtx;
|
|
409
|
+
var statelogClient = __ctx.statelogClient;
|
|
410
|
+
var __graph = __ctx.graph;
|
|
411
|
+
var __forked;
|
|
412
|
+
var __functionCompleted = false;
|
|
413
413
|
if (!__ctx.globals.isInitialized("stdlib/index.agency")) {
|
|
414
414
|
await __initializeGlobals(__ctx);
|
|
415
415
|
}
|
|
416
|
-
|
|
416
|
+
var __funcStartTime = performance.now();
|
|
417
417
|
await callHook({
|
|
418
418
|
callbacks: __ctx.callbacks,
|
|
419
419
|
name: "onFunctionStart",
|
|
@@ -480,23 +480,23 @@ export async function printJSON(obj, __state = undefined) {
|
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
export async function input(prompt, __state = undefined) {
|
|
483
|
-
|
|
483
|
+
var __setupData = setupFunction({
|
|
484
484
|
state: __state
|
|
485
485
|
});
|
|
486
486
|
// __state will be undefined if this function is being called as a tool by an llm
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
487
|
+
var __stack = __setupData.stack;
|
|
488
|
+
var __step = __setupData.step;
|
|
489
|
+
var __self = __setupData.self;
|
|
490
|
+
var __threads = __setupData.threads;
|
|
491
|
+
var __ctx = __state?.ctx || __globalCtx;
|
|
492
|
+
var statelogClient = __ctx.statelogClient;
|
|
493
|
+
var __graph = __ctx.graph;
|
|
494
|
+
var __forked;
|
|
495
|
+
var __functionCompleted = false;
|
|
496
496
|
if (!__ctx.globals.isInitialized("stdlib/index.agency")) {
|
|
497
497
|
await __initializeGlobals(__ctx);
|
|
498
498
|
}
|
|
499
|
-
|
|
499
|
+
var __funcStartTime = performance.now();
|
|
500
500
|
await callHook({
|
|
501
501
|
callbacks: __ctx.callbacks,
|
|
502
502
|
name: "onFunctionStart",
|
|
@@ -565,23 +565,23 @@ export async function input(prompt, __state = undefined) {
|
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
567
|
export async function sleep(seconds, __state = undefined) {
|
|
568
|
-
|
|
568
|
+
var __setupData = setupFunction({
|
|
569
569
|
state: __state
|
|
570
570
|
});
|
|
571
571
|
// __state will be undefined if this function is being called as a tool by an llm
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
572
|
+
var __stack = __setupData.stack;
|
|
573
|
+
var __step = __setupData.step;
|
|
574
|
+
var __self = __setupData.self;
|
|
575
|
+
var __threads = __setupData.threads;
|
|
576
|
+
var __ctx = __state?.ctx || __globalCtx;
|
|
577
|
+
var statelogClient = __ctx.statelogClient;
|
|
578
|
+
var __graph = __ctx.graph;
|
|
579
|
+
var __forked;
|
|
580
|
+
var __functionCompleted = false;
|
|
581
581
|
if (!__ctx.globals.isInitialized("stdlib/index.agency")) {
|
|
582
582
|
await __initializeGlobals(__ctx);
|
|
583
583
|
}
|
|
584
|
-
|
|
584
|
+
var __funcStartTime = performance.now();
|
|
585
585
|
await callHook({
|
|
586
586
|
callbacks: __ctx.callbacks,
|
|
587
587
|
name: "onFunctionStart",
|
|
@@ -648,23 +648,23 @@ export async function sleep(seconds, __state = undefined) {
|
|
|
648
648
|
}
|
|
649
649
|
}
|
|
650
650
|
export async function round(num, precision, __state = undefined) {
|
|
651
|
-
|
|
651
|
+
var __setupData = setupFunction({
|
|
652
652
|
state: __state
|
|
653
653
|
});
|
|
654
654
|
// __state will be undefined if this function is being called as a tool by an llm
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
655
|
+
var __stack = __setupData.stack;
|
|
656
|
+
var __step = __setupData.step;
|
|
657
|
+
var __self = __setupData.self;
|
|
658
|
+
var __threads = __setupData.threads;
|
|
659
|
+
var __ctx = __state?.ctx || __globalCtx;
|
|
660
|
+
var statelogClient = __ctx.statelogClient;
|
|
661
|
+
var __graph = __ctx.graph;
|
|
662
|
+
var __forked;
|
|
663
|
+
var __functionCompleted = false;
|
|
664
664
|
if (!__ctx.globals.isInitialized("stdlib/index.agency")) {
|
|
665
665
|
await __initializeGlobals(__ctx);
|
|
666
666
|
}
|
|
667
|
-
|
|
667
|
+
var __funcStartTime = performance.now();
|
|
668
668
|
await callHook({
|
|
669
669
|
callbacks: __ctx.callbacks,
|
|
670
670
|
name: "onFunctionStart",
|
|
@@ -739,23 +739,23 @@ export async function round(num, precision, __state = undefined) {
|
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
741
|
export async function fetch(url, __state = undefined) {
|
|
742
|
-
|
|
742
|
+
var __setupData = setupFunction({
|
|
743
743
|
state: __state
|
|
744
744
|
});
|
|
745
745
|
// __state will be undefined if this function is being called as a tool by an llm
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
746
|
+
var __stack = __setupData.stack;
|
|
747
|
+
var __step = __setupData.step;
|
|
748
|
+
var __self = __setupData.self;
|
|
749
|
+
var __threads = __setupData.threads;
|
|
750
|
+
var __ctx = __state?.ctx || __globalCtx;
|
|
751
|
+
var statelogClient = __ctx.statelogClient;
|
|
752
|
+
var __graph = __ctx.graph;
|
|
753
|
+
var __forked;
|
|
754
|
+
var __functionCompleted = false;
|
|
755
755
|
if (!__ctx.globals.isInitialized("stdlib/index.agency")) {
|
|
756
756
|
await __initializeGlobals(__ctx);
|
|
757
757
|
}
|
|
758
|
-
|
|
758
|
+
var __funcStartTime = performance.now();
|
|
759
759
|
await callHook({
|
|
760
760
|
callbacks: __ctx.callbacks,
|
|
761
761
|
name: "onFunctionStart",
|
|
@@ -871,23 +871,23 @@ export async function fetch(url, __state = undefined) {
|
|
|
871
871
|
}
|
|
872
872
|
}
|
|
873
873
|
export async function fetchJSON(url, __state = undefined) {
|
|
874
|
-
|
|
874
|
+
var __setupData = setupFunction({
|
|
875
875
|
state: __state
|
|
876
876
|
});
|
|
877
877
|
// __state will be undefined if this function is being called as a tool by an llm
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
878
|
+
var __stack = __setupData.stack;
|
|
879
|
+
var __step = __setupData.step;
|
|
880
|
+
var __self = __setupData.self;
|
|
881
|
+
var __threads = __setupData.threads;
|
|
882
|
+
var __ctx = __state?.ctx || __globalCtx;
|
|
883
|
+
var statelogClient = __ctx.statelogClient;
|
|
884
|
+
var __graph = __ctx.graph;
|
|
885
|
+
var __forked;
|
|
886
|
+
var __functionCompleted = false;
|
|
887
887
|
if (!__ctx.globals.isInitialized("stdlib/index.agency")) {
|
|
888
888
|
await __initializeGlobals(__ctx);
|
|
889
889
|
}
|
|
890
|
-
|
|
890
|
+
var __funcStartTime = performance.now();
|
|
891
891
|
await callHook({
|
|
892
892
|
callbacks: __ctx.callbacks,
|
|
893
893
|
name: "onFunctionStart",
|
|
@@ -1003,23 +1003,23 @@ export async function fetchJSON(url, __state = undefined) {
|
|
|
1003
1003
|
}
|
|
1004
1004
|
}
|
|
1005
1005
|
export async function read(filename, __state = undefined) {
|
|
1006
|
-
|
|
1006
|
+
var __setupData = setupFunction({
|
|
1007
1007
|
state: __state
|
|
1008
1008
|
});
|
|
1009
1009
|
// __state will be undefined if this function is being called as a tool by an llm
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1010
|
+
var __stack = __setupData.stack;
|
|
1011
|
+
var __step = __setupData.step;
|
|
1012
|
+
var __self = __setupData.self;
|
|
1013
|
+
var __threads = __setupData.threads;
|
|
1014
|
+
var __ctx = __state?.ctx || __globalCtx;
|
|
1015
|
+
var statelogClient = __ctx.statelogClient;
|
|
1016
|
+
var __graph = __ctx.graph;
|
|
1017
|
+
var __forked;
|
|
1018
|
+
var __functionCompleted = false;
|
|
1019
1019
|
if (!__ctx.globals.isInitialized("stdlib/index.agency")) {
|
|
1020
1020
|
await __initializeGlobals(__ctx);
|
|
1021
1021
|
}
|
|
1022
|
-
|
|
1022
|
+
var __funcStartTime = performance.now();
|
|
1023
1023
|
await callHook({
|
|
1024
1024
|
callbacks: __ctx.callbacks,
|
|
1025
1025
|
name: "onFunctionStart",
|
|
@@ -1135,23 +1135,23 @@ export async function read(filename, __state = undefined) {
|
|
|
1135
1135
|
}
|
|
1136
1136
|
}
|
|
1137
1137
|
export async function write(filename, content, __state = undefined) {
|
|
1138
|
-
|
|
1138
|
+
var __setupData = setupFunction({
|
|
1139
1139
|
state: __state
|
|
1140
1140
|
});
|
|
1141
1141
|
// __state will be undefined if this function is being called as a tool by an llm
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1142
|
+
var __stack = __setupData.stack;
|
|
1143
|
+
var __step = __setupData.step;
|
|
1144
|
+
var __self = __setupData.self;
|
|
1145
|
+
var __threads = __setupData.threads;
|
|
1146
|
+
var __ctx = __state?.ctx || __globalCtx;
|
|
1147
|
+
var statelogClient = __ctx.statelogClient;
|
|
1148
|
+
var __graph = __ctx.graph;
|
|
1149
|
+
var __forked;
|
|
1150
|
+
var __functionCompleted = false;
|
|
1151
1151
|
if (!__ctx.globals.isInitialized("stdlib/index.agency")) {
|
|
1152
1152
|
await __initializeGlobals(__ctx);
|
|
1153
1153
|
}
|
|
1154
|
-
|
|
1154
|
+
var __funcStartTime = performance.now();
|
|
1155
1155
|
await callHook({
|
|
1156
1156
|
callbacks: __ctx.callbacks,
|
|
1157
1157
|
name: "onFunctionStart",
|
|
@@ -1272,23 +1272,23 @@ export async function write(filename, content, __state = undefined) {
|
|
|
1272
1272
|
}
|
|
1273
1273
|
}
|
|
1274
1274
|
export async function readImage(filename, __state = undefined) {
|
|
1275
|
-
|
|
1275
|
+
var __setupData = setupFunction({
|
|
1276
1276
|
state: __state
|
|
1277
1277
|
});
|
|
1278
1278
|
// __state will be undefined if this function is being called as a tool by an llm
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1279
|
+
var __stack = __setupData.stack;
|
|
1280
|
+
var __step = __setupData.step;
|
|
1281
|
+
var __self = __setupData.self;
|
|
1282
|
+
var __threads = __setupData.threads;
|
|
1283
|
+
var __ctx = __state?.ctx || __globalCtx;
|
|
1284
|
+
var statelogClient = __ctx.statelogClient;
|
|
1285
|
+
var __graph = __ctx.graph;
|
|
1286
|
+
var __forked;
|
|
1287
|
+
var __functionCompleted = false;
|
|
1288
1288
|
if (!__ctx.globals.isInitialized("stdlib/index.agency")) {
|
|
1289
1289
|
await __initializeGlobals(__ctx);
|
|
1290
1290
|
}
|
|
1291
|
-
|
|
1291
|
+
var __funcStartTime = performance.now();
|
|
1292
1292
|
await callHook({
|
|
1293
1293
|
callbacks: __ctx.callbacks,
|
|
1294
1294
|
name: "onFunctionStart",
|
|
@@ -1404,23 +1404,23 @@ export async function readImage(filename, __state = undefined) {
|
|
|
1404
1404
|
}
|
|
1405
1405
|
}
|
|
1406
1406
|
export async function notify(title, message, __state = undefined) {
|
|
1407
|
-
|
|
1407
|
+
var __setupData = setupFunction({
|
|
1408
1408
|
state: __state
|
|
1409
1409
|
});
|
|
1410
1410
|
// __state will be undefined if this function is being called as a tool by an llm
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1411
|
+
var __stack = __setupData.stack;
|
|
1412
|
+
var __step = __setupData.step;
|
|
1413
|
+
var __self = __setupData.self;
|
|
1414
|
+
var __threads = __setupData.threads;
|
|
1415
|
+
var __ctx = __state?.ctx || __globalCtx;
|
|
1416
|
+
var statelogClient = __ctx.statelogClient;
|
|
1417
|
+
var __graph = __ctx.graph;
|
|
1418
|
+
var __forked;
|
|
1419
|
+
var __functionCompleted = false;
|
|
1420
1420
|
if (!__ctx.globals.isInitialized("stdlib/index.agency")) {
|
|
1421
1421
|
await __initializeGlobals(__ctx);
|
|
1422
1422
|
}
|
|
1423
|
-
|
|
1423
|
+
var __funcStartTime = performance.now();
|
|
1424
1424
|
await callHook({
|
|
1425
1425
|
callbacks: __ctx.callbacks,
|
|
1426
1426
|
name: "onFunctionStart",
|
|
@@ -1543,23 +1543,23 @@ export async function notify(title, message, __state = undefined) {
|
|
|
1543
1543
|
}
|
|
1544
1544
|
}
|
|
1545
1545
|
export async function range(start, end = null, __state = undefined) {
|
|
1546
|
-
|
|
1546
|
+
var __setupData = setupFunction({
|
|
1547
1547
|
state: __state
|
|
1548
1548
|
});
|
|
1549
1549
|
// __state will be undefined if this function is being called as a tool by an llm
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1550
|
+
var __stack = __setupData.stack;
|
|
1551
|
+
var __step = __setupData.step;
|
|
1552
|
+
var __self = __setupData.self;
|
|
1553
|
+
var __threads = __setupData.threads;
|
|
1554
|
+
var __ctx = __state?.ctx || __globalCtx;
|
|
1555
|
+
var statelogClient = __ctx.statelogClient;
|
|
1556
|
+
var __graph = __ctx.graph;
|
|
1557
|
+
var __forked;
|
|
1558
|
+
var __functionCompleted = false;
|
|
1559
1559
|
if (!__ctx.globals.isInitialized("stdlib/index.agency")) {
|
|
1560
1560
|
await __initializeGlobals(__ctx);
|
|
1561
1561
|
}
|
|
1562
|
-
|
|
1562
|
+
var __funcStartTime = performance.now();
|
|
1563
1563
|
await callHook({
|
|
1564
1564
|
callbacks: __ctx.callbacks,
|
|
1565
1565
|
name: "onFunctionStart",
|
|
@@ -1646,23 +1646,23 @@ export async function range(start, end = null, __state = undefined) {
|
|
|
1646
1646
|
}
|
|
1647
1647
|
}
|
|
1648
1648
|
export async function mostCommon(items, __state = undefined) {
|
|
1649
|
-
|
|
1649
|
+
var __setupData = setupFunction({
|
|
1650
1650
|
state: __state
|
|
1651
1651
|
});
|
|
1652
1652
|
// __state will be undefined if this function is being called as a tool by an llm
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1653
|
+
var __stack = __setupData.stack;
|
|
1654
|
+
var __step = __setupData.step;
|
|
1655
|
+
var __self = __setupData.self;
|
|
1656
|
+
var __threads = __setupData.threads;
|
|
1657
|
+
var __ctx = __state?.ctx || __globalCtx;
|
|
1658
|
+
var statelogClient = __ctx.statelogClient;
|
|
1659
|
+
var __graph = __ctx.graph;
|
|
1660
|
+
var __forked;
|
|
1661
|
+
var __functionCompleted = false;
|
|
1662
1662
|
if (!__ctx.globals.isInitialized("stdlib/index.agency")) {
|
|
1663
1663
|
await __initializeGlobals(__ctx);
|
|
1664
1664
|
}
|
|
1665
|
-
|
|
1665
|
+
var __funcStartTime = performance.now();
|
|
1666
1666
|
await callHook({
|
|
1667
1667
|
callbacks: __ctx.callbacks,
|
|
1668
1668
|
name: "onFunctionStart",
|
|
@@ -1731,23 +1731,23 @@ export async function mostCommon(items, __state = undefined) {
|
|
|
1731
1731
|
}
|
|
1732
1732
|
}
|
|
1733
1733
|
export async function keys(obj, __state = undefined) {
|
|
1734
|
-
|
|
1734
|
+
var __setupData = setupFunction({
|
|
1735
1735
|
state: __state
|
|
1736
1736
|
});
|
|
1737
1737
|
// __state will be undefined if this function is being called as a tool by an llm
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1738
|
+
var __stack = __setupData.stack;
|
|
1739
|
+
var __step = __setupData.step;
|
|
1740
|
+
var __self = __setupData.self;
|
|
1741
|
+
var __threads = __setupData.threads;
|
|
1742
|
+
var __ctx = __state?.ctx || __globalCtx;
|
|
1743
|
+
var statelogClient = __ctx.statelogClient;
|
|
1744
|
+
var __graph = __ctx.graph;
|
|
1745
|
+
var __forked;
|
|
1746
|
+
var __functionCompleted = false;
|
|
1747
1747
|
if (!__ctx.globals.isInitialized("stdlib/index.agency")) {
|
|
1748
1748
|
await __initializeGlobals(__ctx);
|
|
1749
1749
|
}
|
|
1750
|
-
|
|
1750
|
+
var __funcStartTime = performance.now();
|
|
1751
1751
|
await callHook({
|
|
1752
1752
|
callbacks: __ctx.callbacks,
|
|
1753
1753
|
name: "onFunctionStart",
|
|
@@ -1816,23 +1816,23 @@ export async function keys(obj, __state = undefined) {
|
|
|
1816
1816
|
}
|
|
1817
1817
|
}
|
|
1818
1818
|
export async function values(obj, __state = undefined) {
|
|
1819
|
-
|
|
1819
|
+
var __setupData = setupFunction({
|
|
1820
1820
|
state: __state
|
|
1821
1821
|
});
|
|
1822
1822
|
// __state will be undefined if this function is being called as a tool by an llm
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1823
|
+
var __stack = __setupData.stack;
|
|
1824
|
+
var __step = __setupData.step;
|
|
1825
|
+
var __self = __setupData.self;
|
|
1826
|
+
var __threads = __setupData.threads;
|
|
1827
|
+
var __ctx = __state?.ctx || __globalCtx;
|
|
1828
|
+
var statelogClient = __ctx.statelogClient;
|
|
1829
|
+
var __graph = __ctx.graph;
|
|
1830
|
+
var __forked;
|
|
1831
|
+
var __functionCompleted = false;
|
|
1832
1832
|
if (!__ctx.globals.isInitialized("stdlib/index.agency")) {
|
|
1833
1833
|
await __initializeGlobals(__ctx);
|
|
1834
1834
|
}
|
|
1835
|
-
|
|
1835
|
+
var __funcStartTime = performance.now();
|
|
1836
1836
|
await callHook({
|
|
1837
1837
|
callbacks: __ctx.callbacks,
|
|
1838
1838
|
name: "onFunctionStart",
|
|
@@ -1901,23 +1901,23 @@ export async function values(obj, __state = undefined) {
|
|
|
1901
1901
|
}
|
|
1902
1902
|
}
|
|
1903
1903
|
export async function entries(obj, __state = undefined) {
|
|
1904
|
-
|
|
1904
|
+
var __setupData = setupFunction({
|
|
1905
1905
|
state: __state
|
|
1906
1906
|
});
|
|
1907
1907
|
// __state will be undefined if this function is being called as a tool by an llm
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1908
|
+
var __stack = __setupData.stack;
|
|
1909
|
+
var __step = __setupData.step;
|
|
1910
|
+
var __self = __setupData.self;
|
|
1911
|
+
var __threads = __setupData.threads;
|
|
1912
|
+
var __ctx = __state?.ctx || __globalCtx;
|
|
1913
|
+
var statelogClient = __ctx.statelogClient;
|
|
1914
|
+
var __graph = __ctx.graph;
|
|
1915
|
+
var __forked;
|
|
1916
|
+
var __functionCompleted = false;
|
|
1917
1917
|
if (!__ctx.globals.isInitialized("stdlib/index.agency")) {
|
|
1918
1918
|
await __initializeGlobals(__ctx);
|
|
1919
1919
|
}
|
|
1920
|
-
|
|
1920
|
+
var __funcStartTime = performance.now();
|
|
1921
1921
|
await callHook({
|
|
1922
1922
|
callbacks: __ctx.callbacks,
|
|
1923
1923
|
name: "onFunctionStart",
|