llmz 0.0.85 → 0.1.0
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/{chunk-EADBCAE7.js → chunk-2O3UTPVH.js} +2 -2
- package/dist/{chunk-KY27DGTG.cjs → chunk-7LMIOS6H.cjs} +14 -14
- package/dist/{chunk-ZVSO527D.cjs → chunk-BBX2LDZE.cjs} +25 -25
- package/dist/{chunk-EC2I4U4G.cjs → chunk-D6PU5YAS.cjs} +6 -6
- package/dist/{chunk-NFZXJRXS.cjs → chunk-FPLSJF4S.cjs} +5 -2
- package/dist/{chunk-YTFNFSDT.js → chunk-IRCB4FRM.js} +2 -2
- package/dist/{chunk-GEN6TAXY.js → chunk-L74UZONX.js} +16 -8
- package/dist/{chunk-2XSXXGXJ.js → chunk-NK2NCYSY.js} +4 -4
- package/dist/{chunk-N3XPJTPE.cjs → chunk-PQGZQQA6.cjs} +18 -18
- package/dist/{chunk-PASYUKW4.js → chunk-TOGYDN6U.js} +1 -1
- package/dist/{chunk-H3PZFBJL.cjs → chunk-WODK7Y4J.cjs} +10 -10
- package/dist/{chunk-TRWUQSEK.js → chunk-XVVYNOTX.js} +1 -1
- package/dist/{chunk-ZHHB3FT4.js → chunk-YX27XM67.js} +4 -1
- package/dist/{chunk-GFSUTNRM.cjs → chunk-ZPHRTTQX.cjs} +17 -9
- package/dist/{dual-modes-5NJMZJTA.js → dual-modes-HEXPFVUE.js} +3 -3
- package/dist/{dual-modes-WA5TPGJR.cjs → dual-modes-LLIWZCHC.cjs} +4 -4
- package/dist/{execute-I53OOORH.cjs → execute-2BVFYTJT.cjs} +30 -30
- package/dist/{execute-2T75URIX.js → execute-EZXXBWB6.js} +7 -7
- package/dist/exit-LUJY7JIG.cjs +8 -0
- package/dist/{exit-7NHSUR3V.js → exit-VJATJTQI.js} +2 -2
- package/dist/index.cjs +33 -33
- package/dist/index.js +16 -16
- package/dist/{tool-HXXQMDA3.js → tool-DNHVW3KC.js} +3 -3
- package/dist/{tool-4OPM7QRM.cjs → tool-GJ6ZXWS2.cjs} +4 -4
- package/dist/{truncator-ZQYBTVCJ.js → truncator-3U2QUUJJ.js} +2 -2
- package/dist/truncator-3ZN7W6NB.cjs +10 -0
- package/dist/{typings-YD2WAQ4A.js → typings-3YV3RDMP.js} +2 -2
- package/dist/{typings-QW4427V7.cjs → typings-ZTFPPA5W.cjs} +3 -3
- package/dist/utils-GLZVMRWO.cjs +39 -0
- package/dist/{utils-RKUVYFTJ.js → utils-ZEZ66X6Q.js} +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +2 -2
- package/dist/exit-V3ORIN65.cjs +0 -8
- package/dist/truncator-ZN7X6OMF.cjs +0 -10
- package/dist/utils-NQSM5FBL.cjs +0 -39
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk7LMIOS6Hcjs = require('./chunk-7LMIOS6H.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkFPLSJF4Scjs = require('./chunk-FPLSJF4S.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -195,7 +195,7 @@ var Tool = (_class = class _Tool {
|
|
|
195
195
|
*/
|
|
196
196
|
rename(name) {
|
|
197
197
|
const before = this.name;
|
|
198
|
-
if (!
|
|
198
|
+
if (!_chunkFPLSJF4Scjs.isValidIdentifier.call(void 0, name)) {
|
|
199
199
|
throw new Error(
|
|
200
200
|
`Invalid name for tool ${name}. A tool name must start with a letter and contain only letters, numbers, and underscores. It must be 1-50 characters long.`
|
|
201
201
|
);
|
|
@@ -371,7 +371,7 @@ var Tool = (_class = class _Tool {
|
|
|
371
371
|
* ```
|
|
372
372
|
*/
|
|
373
373
|
constructor(props) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);
|
|
374
|
-
if (!
|
|
374
|
+
if (!_chunkFPLSJF4Scjs.isValidIdentifier.call(void 0, props.name)) {
|
|
375
375
|
throw new Error(
|
|
376
376
|
`Invalid name for tool ${props.name}. A tool name must start with a letter and contain only letters, numbers, and underscores. It must be 1-50 characters long.`
|
|
377
377
|
);
|
|
@@ -396,17 +396,17 @@ var Tool = (_class = class _Tool {
|
|
|
396
396
|
`Invalid aliases for tool ${props.name}. Expected an array, but got type "${typeof props.aliases}"`
|
|
397
397
|
);
|
|
398
398
|
}
|
|
399
|
-
if (props.aliases && props.aliases.some((alias) => !
|
|
399
|
+
if (props.aliases && props.aliases.some((alias) => !_chunkFPLSJF4Scjs.isValidIdentifier.call(void 0, alias))) {
|
|
400
400
|
throw new Error(`Invalid aliases for tool ${props.name}. Expected an array of valid identifiers.`);
|
|
401
401
|
}
|
|
402
402
|
if (typeof props.input !== "undefined") {
|
|
403
|
-
if (
|
|
403
|
+
if (_chunkFPLSJF4Scjs.isZuiSchema.call(void 0, props.input)) {
|
|
404
404
|
try {
|
|
405
405
|
this.input = _zui.transforms.toJSONSchema(props.input);
|
|
406
406
|
} catch (e6) {
|
|
407
407
|
this.input = _zui.transforms.toJSONSchemaLegacy(props.input);
|
|
408
408
|
}
|
|
409
|
-
} else if (
|
|
409
|
+
} else if (_chunkFPLSJF4Scjs.isJsonSchema.call(void 0, props.input)) {
|
|
410
410
|
this.input = props.input;
|
|
411
411
|
} else {
|
|
412
412
|
throw new Error(
|
|
@@ -415,13 +415,13 @@ var Tool = (_class = class _Tool {
|
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
417
|
if (typeof props.output !== "undefined") {
|
|
418
|
-
if (
|
|
418
|
+
if (_chunkFPLSJF4Scjs.isZuiSchema.call(void 0, props.output)) {
|
|
419
419
|
try {
|
|
420
420
|
this.output = _zui.transforms.toJSONSchema(props.output);
|
|
421
421
|
} catch (e7) {
|
|
422
422
|
this.output = _zui.transforms.toJSONSchemaLegacy(props.output);
|
|
423
423
|
}
|
|
424
|
-
} else if (
|
|
424
|
+
} else if (_chunkFPLSJF4Scjs.isJsonSchema.call(void 0, props.output)) {
|
|
425
425
|
this.output = props.output;
|
|
426
426
|
} else {
|
|
427
427
|
throw new Error(
|
|
@@ -548,7 +548,7 @@ var Tool = (_class = class _Tool {
|
|
|
548
548
|
input = convertObjectToZuiLiterals(this._staticInputValues);
|
|
549
549
|
}
|
|
550
550
|
const fnType = _zui.z.function(input, _zui.z.promise(output)).title(this.name).describe(_nullishCoalesce(this.description, () => ( "")));
|
|
551
|
-
return
|
|
551
|
+
return _chunk7LMIOS6Hcjs.getTypings.call(void 0, fnType, {
|
|
552
552
|
declaration: true
|
|
553
553
|
});
|
|
554
554
|
}
|
|
@@ -7,13 +7,16 @@ import {
|
|
|
7
7
|
} from "./chunk-34GJUS6U.js";
|
|
8
8
|
|
|
9
9
|
// src/utils.ts
|
|
10
|
-
import { getWasmTokenizer } from "@bpinternal/thicktoken
|
|
10
|
+
import { getWasmTokenizer } from "@bpinternal/thicktoken";
|
|
11
11
|
import { z, transforms } from "@bpinternal/zui";
|
|
12
12
|
var tokenizer = null;
|
|
13
13
|
var init = async () => {
|
|
14
14
|
if (tokenizer) {
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
+
while (typeof getWasmTokenizer !== "function") {
|
|
18
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
19
|
+
}
|
|
17
20
|
tokenizer = await getWasmTokenizer();
|
|
18
21
|
};
|
|
19
22
|
var getTokenizer = () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkFPLSJF4Scjs = require('./chunk-FPLSJF4S.cjs');
|
|
4
4
|
|
|
5
5
|
// src/truncator.ts
|
|
6
6
|
var DEFAULT_REMOVE_CHUNK = 250;
|
|
@@ -24,8 +24,8 @@ function truncateWrappedContent({
|
|
|
24
24
|
tokenLimit,
|
|
25
25
|
throwOnFailure = true
|
|
26
26
|
}) {
|
|
27
|
-
var _a, _b, _c
|
|
28
|
-
const tokenizer =
|
|
27
|
+
var _a, _b, _c;
|
|
28
|
+
const tokenizer = _chunkFPLSJF4Scjs.getTokenizer.call(void 0, );
|
|
29
29
|
const parts = [];
|
|
30
30
|
for (const msg of messages) {
|
|
31
31
|
const current = [];
|
|
@@ -86,12 +86,20 @@ function truncateWrappedContent({
|
|
|
86
86
|
toRemove = biggest.tokens - (_nullishCoalesce(((_b = biggest.attributes) == null ? void 0 : _b.minTokens), () => ( 0)));
|
|
87
87
|
}
|
|
88
88
|
const preserve = _nullishCoalesce(((_c = biggest.attributes) == null ? void 0 : _c.preserve), () => ( DEFAULT_TRUNCATE_OPTIONS.preserve));
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
const split = tokenizer.splitAndSlice(biggest.content);
|
|
90
|
+
if (preserve === "bottom") {
|
|
91
|
+
biggest.content = split.slice(toRemove).join("");
|
|
92
|
+
} else if (preserve === "top") {
|
|
93
|
+
biggest.content = split.slice(0, -toRemove).join("");
|
|
94
|
+
} else {
|
|
95
|
+
const anchor = Math.ceil(split.length / 2);
|
|
96
|
+
const radius = Math.ceil(toRemove / 2);
|
|
97
|
+
const left = anchor - radius;
|
|
98
|
+
const right = anchor + radius;
|
|
99
|
+
biggest.content = split.slice(0, left).join("") + split.slice(right).join("");
|
|
100
|
+
}
|
|
101
|
+
biggest.tokens -= toRemove;
|
|
102
|
+
currentCount -= toRemove;
|
|
95
103
|
}
|
|
96
104
|
return messages.map((msg, i) => {
|
|
97
105
|
const p = parts[i];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DualModePrompt
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2O3UTPVH.js";
|
|
4
4
|
import "./chunk-YEAWWJSJ.js";
|
|
5
5
|
import "./chunk-3T5IU7OU.js";
|
|
6
6
|
import "./chunk-XTEHT2TK.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-L74UZONX.js";
|
|
8
|
+
import "./chunk-YX27XM67.js";
|
|
9
9
|
import "./chunk-34GJUS6U.js";
|
|
10
10
|
export {
|
|
11
11
|
DualModePrompt
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkBBX2LDZEcjs = require('./chunk-BBX2LDZE.cjs');
|
|
4
4
|
require('./chunk-KIN7Y247.cjs');
|
|
5
5
|
require('./chunk-CQ3UJW76.cjs');
|
|
6
6
|
require('./chunk-5ZF6NTYI.cjs');
|
|
7
|
-
require('./chunk-
|
|
8
|
-
require('./chunk-
|
|
7
|
+
require('./chunk-ZPHRTTQX.cjs');
|
|
8
|
+
require('./chunk-FPLSJF4S.cjs');
|
|
9
9
|
require('./chunk-HC2QZTVT.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.DualModePrompt =
|
|
12
|
+
exports.DualModePrompt = _chunkBBX2LDZEcjs.DualModePrompt;
|
|
@@ -8,10 +8,10 @@ var _chunkJXD2KJVBcjs = require('./chunk-JXD2KJVB.cjs');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
12
|
-
require('./chunk-
|
|
13
|
-
require('./chunk-
|
|
14
|
-
require('./chunk-
|
|
11
|
+
var _chunkPQGZQQA6cjs = require('./chunk-PQGZQQA6.cjs');
|
|
12
|
+
require('./chunk-BBX2LDZE.cjs');
|
|
13
|
+
require('./chunk-WODK7Y4J.cjs');
|
|
14
|
+
require('./chunk-7LMIOS6H.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -25,17 +25,17 @@ var _chunkPK72FAKDcjs = require('./chunk-PK72FAKD.cjs');
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
var _chunkKIN7Y247cjs = require('./chunk-KIN7Y247.cjs');
|
|
28
|
-
require('./chunk-
|
|
28
|
+
require('./chunk-D6PU5YAS.cjs');
|
|
29
29
|
require('./chunk-CQ3UJW76.cjs');
|
|
30
30
|
require('./chunk-5ZF6NTYI.cjs');
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
var
|
|
33
|
+
var _chunkZPHRTTQXcjs = require('./chunk-ZPHRTTQX.cjs');
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var _chunkFPLSJF4Scjs = require('./chunk-FPLSJF4S.cjs');
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
@@ -93,11 +93,11 @@ var generateCode = async ({ iteration, ctx, cognitive, controller }) => {
|
|
|
93
93
|
const traces = iteration.traces;
|
|
94
94
|
const modelRef = Array.isArray(iteration.model) ? iteration.model[0] : iteration.model;
|
|
95
95
|
const model = await cognitive.getModelDetails(modelRef).catch((thrown) => {
|
|
96
|
-
throw new (0, _chunkPK72FAKDcjs.CognitiveError)(`Failed to fetch model details for model "${modelRef}": ${
|
|
96
|
+
throw new (0, _chunkPK72FAKDcjs.CognitiveError)(`Failed to fetch model details for model "${modelRef}": ${_chunkFPLSJF4Scjs.getErrorMessage.call(void 0, thrown)}`);
|
|
97
97
|
});
|
|
98
98
|
const modelLimit = Math.max(model.input.maxTokens, 8e3);
|
|
99
99
|
const responseLengthBuffer = getModelOutputLimit(modelLimit);
|
|
100
|
-
const messages =
|
|
100
|
+
const messages = _chunkZPHRTTQXcjs.truncateWrappedContent.call(void 0, {
|
|
101
101
|
messages: iteration.messages,
|
|
102
102
|
tokenLimit: modelLimit - responseLengthBuffer,
|
|
103
103
|
throwOnFailure: true
|
|
@@ -119,7 +119,7 @@ var generateCode = async ({ iteration, ctx, cognitive, controller }) => {
|
|
|
119
119
|
messages: messages.filter((x) => x.role !== "system"),
|
|
120
120
|
stopSequences: ctx.version.getStopTokens()
|
|
121
121
|
}).catch((thrown) => {
|
|
122
|
-
throw new (0, _chunkPK72FAKDcjs.CognitiveError)(`LLM generation failed: ${
|
|
122
|
+
throw new (0, _chunkPK72FAKDcjs.CognitiveError)(`LLM generation failed: ${_chunkFPLSJF4Scjs.getErrorMessage.call(void 0, thrown)}`);
|
|
123
123
|
});
|
|
124
124
|
const out = typeof ((_c = (_b = output.output.choices) == null ? void 0 : _b[0]) == null ? void 0 : _c.content) === "string" ? output.output.choices[0].content : null;
|
|
125
125
|
if (!out) {
|
|
@@ -243,7 +243,7 @@ var interpretVMResult = async ({
|
|
|
243
243
|
});
|
|
244
244
|
return;
|
|
245
245
|
}
|
|
246
|
-
const parsedExit =
|
|
246
|
+
const parsedExit = _chunkPQGZQQA6cjs.parseExit.call(void 0, returnValue, iteration.exits);
|
|
247
247
|
if (!parsedExit.success) {
|
|
248
248
|
iteration.end({
|
|
249
249
|
type: "exit_error",
|
|
@@ -267,7 +267,7 @@ var interpretVMResult = async ({
|
|
|
267
267
|
type: "exit_error",
|
|
268
268
|
exit_error: {
|
|
269
269
|
exit: returnExit.name,
|
|
270
|
-
message: `Error executing exit ${returnExit.name}: ${
|
|
270
|
+
message: `Error executing exit ${returnExit.name}: ${_chunkFPLSJF4Scjs.getErrorMessage.call(void 0, err)}`,
|
|
271
271
|
return_value: returnValue
|
|
272
272
|
}
|
|
273
273
|
});
|
|
@@ -449,7 +449,7 @@ var buildVMContext = ({
|
|
|
449
449
|
onAfterTool
|
|
450
450
|
}) => {
|
|
451
451
|
const traces = iteration.traces;
|
|
452
|
-
const vmContext = { ...
|
|
452
|
+
const vmContext = { ..._chunkFPLSJF4Scjs.stripInvalidIdentifiers.call(void 0, iteration.variables) };
|
|
453
453
|
for (const obj of iteration.objects) {
|
|
454
454
|
const internalValues = {};
|
|
455
455
|
const instance = {};
|
|
@@ -473,7 +473,7 @@ var buildVMContext = ({
|
|
|
473
473
|
const parsed = schema.safeParse(value2);
|
|
474
474
|
if (!parsed.success) {
|
|
475
475
|
throw new (0, _chunkPK72FAKDcjs.AssignmentError)(
|
|
476
|
-
`Invalid value for Object property ${obj.name}.${name}: ${
|
|
476
|
+
`Invalid value for Object property ${obj.name}.${name}: ${_chunkFPLSJF4Scjs.getErrorMessage.call(void 0, parsed.error)}`
|
|
477
477
|
);
|
|
478
478
|
}
|
|
479
479
|
internalValues[name] = parsed.data;
|
|
@@ -524,7 +524,7 @@ var buildVMContext = ({
|
|
|
524
524
|
// src/runtime/execute.ts
|
|
525
525
|
var executeContext = async (props) => {
|
|
526
526
|
var _a, _b;
|
|
527
|
-
await
|
|
527
|
+
await _chunkFPLSJF4Scjs.init.call(void 0, );
|
|
528
528
|
const result = await executeContextInternal(props);
|
|
529
529
|
try {
|
|
530
530
|
(_b = (_a = result.context.chat) == null ? void 0 : _a.onExecutionDone) == null ? void 0 : _b.call(_a, result);
|
|
@@ -538,7 +538,7 @@ var executeContextInternal = async (props) => {
|
|
|
538
538
|
const { onIterationStart, onIterationEnd, onTrace, onExit, onBeforeExecution, onAfterTool, onBeforeTool } = props;
|
|
539
539
|
const client = _nullishCoalesce(props.client, () => ( new (0, _client.Client)()));
|
|
540
540
|
const cognitive = _cognitive.Cognitive.isCognitiveClient(client) ? client : _cognitive.CognitiveBeta.isBetaClient(client) ? _cognitive.cognitiveFromBeta.call(void 0, client) : new (0, _cognitive.Cognitive)({ client, __experimental_beta: true });
|
|
541
|
-
const ctx = new (0,
|
|
541
|
+
const ctx = new (0, _chunkPQGZQQA6cjs.Context)({
|
|
542
542
|
chat: props.chat,
|
|
543
543
|
instructions: props.instructions,
|
|
544
544
|
objects: props.objects,
|
|
@@ -554,7 +554,7 @@ var executeContextInternal = async (props) => {
|
|
|
554
554
|
try {
|
|
555
555
|
while (true) {
|
|
556
556
|
if (ctx.iterations.length >= ctx.loop) {
|
|
557
|
-
return new (0,
|
|
557
|
+
return new (0, _chunkPQGZQQA6cjs.ErrorExecutionResult)(ctx, new (0, _chunkPK72FAKDcjs.LoopExceededError)());
|
|
558
558
|
}
|
|
559
559
|
const iteration = await ctx.nextIteration();
|
|
560
560
|
const unsubscribeTrace = iteration.traces.onPush((traces) => {
|
|
@@ -585,7 +585,7 @@ var executeContextInternal = async (props) => {
|
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
587
|
});
|
|
588
|
-
return new (0,
|
|
588
|
+
return new (0, _chunkPQGZQQA6cjs.ErrorExecutionResult)(ctx, _nullishCoalesce(controller.signal.reason, () => ( "The operation was aborted")));
|
|
589
589
|
}
|
|
590
590
|
const iterationResult = await executeIterationWithErrorHandling({
|
|
591
591
|
iteration,
|
|
@@ -614,7 +614,7 @@ var executeContextInternal = async (props) => {
|
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
616
|
} catch (error) {
|
|
617
|
-
return new (0,
|
|
617
|
+
return new (0, _chunkPQGZQQA6cjs.ErrorExecutionResult)(ctx, _nullishCoalesce(error, () => ( "Unknown error")));
|
|
618
618
|
}
|
|
619
619
|
};
|
|
620
620
|
var executeIterationStartHook = async ({
|
|
@@ -644,7 +644,7 @@ var executeIterationStartHook = async ({
|
|
|
644
644
|
} : {
|
|
645
645
|
type: "execution_error",
|
|
646
646
|
execution_error: {
|
|
647
|
-
message: `Error in onIterationStart hook: ${
|
|
647
|
+
message: `Error in onIterationStart hook: ${_chunkFPLSJF4Scjs.getErrorMessage.call(void 0, err)}`,
|
|
648
648
|
stack: _chunkKIN7Y247cjs.cleanStackTrace.call(void 0,
|
|
649
649
|
err instanceof Error ? _nullishCoalesce(err.stack, () => ( "No stack trace available")) : "No stack trace available"
|
|
650
650
|
)
|
|
@@ -687,7 +687,7 @@ var executeIterationWithErrorHandling = async ({
|
|
|
687
687
|
status: iteration.status.type === "pending" ? {
|
|
688
688
|
type: "execution_error",
|
|
689
689
|
execution_error: {
|
|
690
|
-
message: "An unexpected error occurred: " +
|
|
690
|
+
message: "An unexpected error occurred: " + _chunkFPLSJF4Scjs.getErrorMessage.call(void 0, err),
|
|
691
691
|
stack: _chunkKIN7Y247cjs.cleanStackTrace.call(void 0,
|
|
692
692
|
err instanceof Error ? _nullishCoalesce(err.stack, () => ( "No stack trace available")) : "No stack trace available"
|
|
693
693
|
)
|
|
@@ -699,7 +699,7 @@ var executeIterationWithErrorHandling = async ({
|
|
|
699
699
|
if (!controller.signal.aborted) {
|
|
700
700
|
return {
|
|
701
701
|
type: "return",
|
|
702
|
-
result: new (0,
|
|
702
|
+
result: new (0, _chunkPQGZQQA6cjs.ErrorExecutionResult)(ctx, err)
|
|
703
703
|
};
|
|
704
704
|
}
|
|
705
705
|
await finalizeIteration({
|
|
@@ -715,7 +715,7 @@ var executeIterationWithErrorHandling = async ({
|
|
|
715
715
|
});
|
|
716
716
|
return {
|
|
717
717
|
type: "return",
|
|
718
|
-
result: new (0,
|
|
718
|
+
result: new (0, _chunkPQGZQQA6cjs.ErrorExecutionResult)(ctx, _nullishCoalesce(controller.signal.reason, () => ( "The operation was aborted")))
|
|
719
719
|
};
|
|
720
720
|
}
|
|
721
721
|
};
|
|
@@ -727,7 +727,7 @@ var transformIterationResult = ({
|
|
|
727
727
|
const exitName = iteration.status.exit_success.exit_name;
|
|
728
728
|
return {
|
|
729
729
|
type: "return",
|
|
730
|
-
result: new (0,
|
|
730
|
+
result: new (0, _chunkPQGZQQA6cjs.SuccessExecutionResult)(ctx, {
|
|
731
731
|
exit: iteration.exits.find((x) => x.name === exitName),
|
|
732
732
|
result: iteration.status.exit_success.return_value
|
|
733
733
|
})
|
|
@@ -736,17 +736,17 @@ var transformIterationResult = ({
|
|
|
736
736
|
if (iteration.status.type === "callback_requested") {
|
|
737
737
|
return {
|
|
738
738
|
type: "return",
|
|
739
|
-
result: new (0,
|
|
739
|
+
result: new (0, _chunkPQGZQQA6cjs.PartialExecutionResult)(
|
|
740
740
|
ctx,
|
|
741
741
|
iteration.status.callback_requested.signal,
|
|
742
|
-
|
|
742
|
+
_chunkPQGZQQA6cjs.Snapshot.fromSignal(iteration.status.callback_requested.signal)
|
|
743
743
|
)
|
|
744
744
|
};
|
|
745
745
|
}
|
|
746
746
|
if (iteration.status.type === "aborted") {
|
|
747
747
|
return {
|
|
748
748
|
type: "return",
|
|
749
|
-
result: new (0,
|
|
749
|
+
result: new (0, _chunkPQGZQQA6cjs.ErrorExecutionResult)(ctx, _nullishCoalesce(iteration.error, () => ( "The operation was aborted")))
|
|
750
750
|
};
|
|
751
751
|
}
|
|
752
752
|
if (iteration.status.type === "thinking_requested" || iteration.status.type === "exit_error" || iteration.status.type === "execution_error" || iteration.status.type === "invalid_code_error") {
|
|
@@ -754,7 +754,7 @@ var transformIterationResult = ({
|
|
|
754
754
|
}
|
|
755
755
|
return {
|
|
756
756
|
type: "return",
|
|
757
|
-
result: new (0,
|
|
757
|
+
result: new (0, _chunkPQGZQQA6cjs.ErrorExecutionResult)(ctx, _nullishCoalesce(iteration.error, () => ( `Unknown error. Status: ${iteration.status.type}`)))
|
|
758
758
|
};
|
|
759
759
|
};
|
|
760
760
|
var executeIteration = async ({
|
|
@@ -788,7 +788,7 @@ var executeIteration = async ({
|
|
|
788
788
|
iteration.end({
|
|
789
789
|
type: "execution_error",
|
|
790
790
|
execution_error: {
|
|
791
|
-
message: `Error in onBeforeExecution hook: ${
|
|
791
|
+
message: `Error in onBeforeExecution hook: ${_chunkFPLSJF4Scjs.getErrorMessage.call(void 0, err)}`,
|
|
792
792
|
stack: _chunkKIN7Y247cjs.cleanStackTrace.call(void 0,
|
|
793
793
|
err instanceof Error ? _nullishCoalesce(err.stack, () => ( "No stack trace available")) : "No stack trace available"
|
|
794
794
|
)
|
|
@@ -823,7 +823,7 @@ var executeIteration = async ({
|
|
|
823
823
|
).catch((err) => {
|
|
824
824
|
return {
|
|
825
825
|
success: false,
|
|
826
|
-
error: err instanceof Error ? err : new Error(
|
|
826
|
+
error: err instanceof Error ? err : new Error(_chunkFPLSJF4Scjs.getErrorMessage.call(void 0, err)),
|
|
827
827
|
lines_executed: [],
|
|
828
828
|
traces: [],
|
|
829
829
|
variables: {}
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
Snapshot,
|
|
9
9
|
SuccessExecutionResult,
|
|
10
10
|
parseExit
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-NK2NCYSY.js";
|
|
12
|
+
import "./chunk-2O3UTPVH.js";
|
|
13
|
+
import "./chunk-IRCB4FRM.js";
|
|
14
|
+
import "./chunk-TOGYDN6U.js";
|
|
15
15
|
import {
|
|
16
16
|
AssignmentError,
|
|
17
17
|
CodeExecutionError,
|
|
@@ -25,17 +25,17 @@ import {
|
|
|
25
25
|
import {
|
|
26
26
|
cleanStackTrace
|
|
27
27
|
} from "./chunk-YEAWWJSJ.js";
|
|
28
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-XVVYNOTX.js";
|
|
29
29
|
import "./chunk-3T5IU7OU.js";
|
|
30
30
|
import "./chunk-XTEHT2TK.js";
|
|
31
31
|
import {
|
|
32
32
|
truncateWrappedContent
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-L74UZONX.js";
|
|
34
34
|
import {
|
|
35
35
|
getErrorMessage,
|
|
36
36
|
init,
|
|
37
37
|
stripInvalidIdentifiers
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-YX27XM67.js";
|
|
39
39
|
import {
|
|
40
40
|
clamp_default,
|
|
41
41
|
isEqual_default,
|