@pixerate/editor 0.164.0 → 0.165.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/agent/index.cjs +54 -39
- package/dist/agent/index.js +24 -9
- package/dist/animation/index.cjs +6 -5
- package/dist/animation/index.js +5 -4
- package/dist/animation-editor/index.cjs +65 -64
- package/dist/animation-editor/index.js +8 -7
- package/dist/bridge/cli.cjs +3 -3
- package/dist/bridge/cli.js +2 -2
- package/dist/bridge/index.cjs +3 -3
- package/dist/bridge/index.js +2 -2
- package/dist/canvas/index.cjs +89 -87
- package/dist/canvas/index.js +11 -9
- package/dist/chart/controller.d.cts +31 -2
- package/dist/chart/controller.d.ts +31 -2
- package/dist/chart/index.cjs +504 -132
- package/dist/chart/index.d.cts +2 -0
- package/dist/chart/index.d.ts +2 -0
- package/dist/chart/index.js +386 -14
- package/dist/chart/layout-families.d.cts +7 -0
- package/dist/chart/layout-families.d.ts +7 -0
- package/dist/chart/links.d.cts +34 -0
- package/dist/chart/links.d.ts +34 -0
- package/dist/chart/mermaid.d.cts +9 -6
- package/dist/chart/mermaid.d.ts +9 -6
- package/dist/chart/schemas.d.cts +3 -0
- package/dist/chart/schemas.d.ts +3 -0
- package/dist/chart/spec.d.cts +3 -2
- package/dist/chart/spec.d.ts +3 -2
- package/dist/chart/style.d.cts +33 -0
- package/dist/chart/style.d.ts +33 -0
- package/dist/chart/types.d.cts +24 -2
- package/dist/chart/types.d.ts +24 -2
- package/dist/{chunk-TALQONZ5.js → chunk-2J5VLJHC.js} +3 -3
- package/dist/{chunk-3NEZJCBY.js → chunk-2ZRN43IN.js} +340 -201
- package/dist/{chunk-ZVNAMTFO.cjs → chunk-3FSUJIXN.cjs} +18 -174
- package/dist/{chunk-RQCMSEM5.cjs → chunk-4QUUHTGJ.cjs} +2 -2
- package/dist/{chunk-CIPIESX4.cjs → chunk-4ZC5QJE2.cjs} +3 -3
- package/dist/{chunk-S6X2QRVU.cjs → chunk-5UEFBM2M.cjs} +1 -138
- package/dist/{chunk-YSAGBIRW.cjs → chunk-64VWWR5U.cjs} +16 -16
- package/dist/{chunk-QYZGBVNC.js → chunk-7272D3K2.js} +10 -8
- package/dist/{chunk-462WGGXX.cjs → chunk-AMX23CSN.cjs} +27 -16
- package/dist/{chunk-3VLOOO3G.js → chunk-BDIM6NVW.js} +1 -1
- package/dist/{chunk-POR54B55.js → chunk-CRFSQWKQ.js} +4 -1
- package/dist/{chunk-GZ2FM3ZB.js → chunk-DKNEQX7T.js} +6 -162
- package/dist/{chunk-JCXMJUQO.cjs → chunk-EGZM52EO.cjs} +3 -3
- package/dist/{chunk-ES3UEVUT.cjs → chunk-EUIDTZNQ.cjs} +112 -110
- package/dist/{chunk-H3OEM3Q2.js → chunk-F6R67I3A.js} +1 -1
- package/dist/{chunk-5FNGLV2D.js → chunk-FEU2XVQH.js} +15 -3
- package/dist/{chunk-SZA42R4N.js → chunk-FRBRLKNQ.js} +154 -16
- package/dist/chunk-HIDFL5LQ.js +484 -0
- package/dist/{chunk-MKTDELCD.js → chunk-I5MRJW7B.js} +1 -1
- package/dist/{chunk-SDHZG5TF.js → chunk-ILP77UD6.js} +160 -2
- package/dist/{chunk-GKNEJ6EN.cjs → chunk-IMRXC7OA.cjs} +241 -103
- package/dist/chunk-KGRZMHZB.js +204 -0
- package/dist/{chunk-SET6KJOP.js → chunk-LPIKXPBM.js} +1 -1
- package/dist/{chunk-BQWGN5WH.js → chunk-M2TPMYJE.js} +1 -1
- package/dist/{chunk-GTELFJRE.cjs → chunk-M5GLQQWG.cjs} +2 -2
- package/dist/{chunk-4VU4CP7R.js → chunk-MHLU6GRJ.js} +1 -138
- package/dist/{chunk-D54JHQK2.cjs → chunk-MKXK6E4O.cjs} +51 -51
- package/dist/{chunk-DAPQGA55.js → chunk-N7NBGT2Y.js} +2 -2
- package/dist/chunk-O6OGNDND.js +164 -0
- package/dist/{chunk-22KLZZGH.cjs → chunk-ODFCS7HF.cjs} +8 -8
- package/dist/{chunk-PA3IMPPS.cjs → chunk-OVYQAYGH.cjs} +81 -81
- package/dist/{chunk-YXOW456B.js → chunk-PPEDZ5WR.js} +1 -1
- package/dist/{chunk-YGG7WDWT.cjs → chunk-Q25WAFTD.cjs} +21 -18
- package/dist/{chunk-SBQVEBSU.cjs → chunk-QO2T6KA5.cjs} +165 -67
- package/dist/{chunk-24M7VD6M.cjs → chunk-S4EIAIEW.cjs} +7 -7
- package/dist/{chunk-M4MIZPQI.cjs → chunk-SJ2CPTQC.cjs} +189 -15
- package/dist/chunk-TFF2GTGN.cjs +153 -0
- package/dist/chunk-TTCJPX4U.cjs +204 -0
- package/dist/{chunk-NZD2MZJC.cjs → chunk-TVQW26AV.cjs} +35 -23
- package/dist/{chunk-R3P2M7HU.cjs → chunk-UVXTOZ2B.cjs} +346 -207
- package/dist/{chunk-WI7QJA7A.cjs → chunk-UXETV2NC.cjs} +161 -3
- package/dist/{chunk-Z4P2RBMJ.js → chunk-V5GSY3NC.js} +101 -3
- package/dist/{chunk-QY4KUDMY.js → chunk-VRXXAXUT.js} +2 -2
- package/dist/chunk-VU6WQSMB.cjs +164 -0
- package/dist/{chunk-OXERWBKE.js → chunk-X5W645RI.js} +3 -3
- package/dist/{chunk-NHLYK3AX.js → chunk-XBQX76CT.js} +182 -8
- package/dist/{chunk-5AARIS3R.cjs → chunk-XCDGM7TD.cjs} +37 -37
- package/dist/{chunk-EVXQNQND.js → chunk-XZB3TJ6K.js} +16 -5
- package/dist/chunk-YBAPT7NL.js +153 -0
- package/dist/chunk-Z2UQYMPS.cjs +484 -0
- package/dist/color/index.cjs +5 -3
- package/dist/color/index.js +12 -10
- package/dist/diagram/index.cjs +55 -243
- package/dist/diagram/index.js +12 -200
- package/dist/export/index.cjs +7 -6
- package/dist/export/index.js +6 -5
- package/dist/extensions/index.cjs +12 -9
- package/dist/extensions/index.js +11 -8
- package/dist/gradient/index.cjs +29 -27
- package/dist/gradient/index.js +6 -4
- package/dist/image-editor/index.cjs +644 -643
- package/dist/image-editor/index.js +7 -6
- package/dist/index.cjs +21 -18
- package/dist/index.js +14 -11
- package/dist/paint-editor/index.cjs +19 -18
- package/dist/paint-editor/index.js +7 -6
- package/dist/parameters/index.cjs +2 -2
- package/dist/parameters/index.js +1 -1
- package/dist/persistence/assetWrites.d.cts +22 -0
- package/dist/persistence/assetWrites.d.ts +22 -0
- package/dist/persistence/assets.d.cts +71 -0
- package/dist/persistence/assets.d.ts +71 -0
- package/dist/persistence/documentStore.d.cts +17 -1
- package/dist/persistence/documentStore.d.ts +17 -1
- package/dist/persistence/documentTools.d.cts +5 -1
- package/dist/persistence/documentTools.d.ts +5 -1
- package/dist/persistence/editorAutosave.d.cts +7 -0
- package/dist/persistence/editorAutosave.d.ts +7 -0
- package/dist/persistence/index.cjs +141 -21
- package/dist/persistence/index.js +130 -10
- package/dist/persistence/storage.d.cts +13 -1
- package/dist/persistence/storage.d.ts +13 -1
- package/dist/spreadsheet/index.cjs +3 -3
- package/dist/spreadsheet/index.js +2 -2
- package/dist/tokens/index.cjs +11 -3
- package/dist/tokens/index.d.cts +1 -0
- package/dist/tokens/index.d.ts +1 -0
- package/dist/tokens/index.js +10 -2
- package/dist/tokens/style.d.cts +36 -0
- package/dist/tokens/style.d.ts +36 -0
- package/dist/tools/index.cjs +15 -3
- package/dist/tools/index.d.cts +2 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.js +14 -2
- package/dist/tools/style-tools.d.cts +19 -0
- package/dist/tools/style-tools.d.ts +19 -0
- package/dist/tools/style.d.cts +212 -0
- package/dist/tools/style.d.ts +212 -0
- package/dist/tools/view.d.cts +6 -0
- package/dist/tools/view.d.ts +6 -0
- package/dist/typography/index.cjs +8 -6
- package/dist/typography/index.js +5 -3
- package/dist/vector/index.cjs +953 -952
- package/dist/vector/index.js +7 -6
- package/dist/video-editor/index.cjs +8 -7
- package/dist/video-editor/index.js +6 -5
- package/package.json +1 -1
- package/dist/chunk-ERAGQL2N.cjs +0 -68
- package/dist/chunk-KMU6QJB7.js +0 -68
package/dist/vector/index.js
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
reverseMorphContour,
|
|
39
39
|
subpathToMorphContour,
|
|
40
40
|
turnMorphContour
|
|
41
|
-
} from "../chunk-
|
|
41
|
+
} from "../chunk-VRXXAXUT.js";
|
|
42
42
|
import {
|
|
43
43
|
DEFAULT_VECTOR_FONT,
|
|
44
44
|
IDENTITY_MATRIX,
|
|
@@ -507,7 +507,7 @@ import {
|
|
|
507
507
|
withVectorStrokes,
|
|
508
508
|
withVectorTargetPaint,
|
|
509
509
|
zigzagPaths
|
|
510
|
-
} from "../chunk-
|
|
510
|
+
} from "../chunk-LPIKXPBM.js";
|
|
511
511
|
import "../chunk-YXKLVD56.js";
|
|
512
512
|
import {
|
|
513
513
|
createProvenance
|
|
@@ -560,18 +560,19 @@ import "../chunk-SIFAIGB3.js";
|
|
|
560
560
|
import "../chunk-VDGBHYC7.js";
|
|
561
561
|
import {
|
|
562
562
|
defineEditorDocument
|
|
563
|
-
} from "../chunk-
|
|
563
|
+
} from "../chunk-XBQX76CT.js";
|
|
564
564
|
import "../chunk-HF5QZS7Z.js";
|
|
565
565
|
import {
|
|
566
566
|
HistoryManager
|
|
567
567
|
} from "../chunk-RNSANXPT.js";
|
|
568
568
|
import "../chunk-5UJHB3BW.js";
|
|
569
|
-
import "../chunk-
|
|
569
|
+
import "../chunk-M2TPMYJE.js";
|
|
570
570
|
import {
|
|
571
571
|
hexToRgba
|
|
572
572
|
} from "../chunk-2WPNAGHI.js";
|
|
573
|
-
import "../chunk-
|
|
574
|
-
import "../chunk-
|
|
573
|
+
import "../chunk-7272D3K2.js";
|
|
574
|
+
import "../chunk-YBAPT7NL.js";
|
|
575
|
+
import "../chunk-MHLU6GRJ.js";
|
|
575
576
|
import "../chunk-6ONMQ6WF.js";
|
|
576
577
|
|
|
577
578
|
// src/vector/trace.ts
|
|
@@ -161,22 +161,23 @@ var _chunkRUZQMYXHcjs = require('../chunk-RUZQMYXH.cjs');
|
|
|
161
161
|
require('../chunk-WOFXZ3XU.cjs');
|
|
162
162
|
|
|
163
163
|
|
|
164
|
-
var
|
|
164
|
+
var _chunkSJ2CPTQCcjs = require('../chunk-SJ2CPTQC.cjs');
|
|
165
165
|
require('../chunk-2BSBFBOA.cjs');
|
|
166
166
|
|
|
167
167
|
|
|
168
168
|
var _chunkFJ2MSI43cjs = require('../chunk-FJ2MSI43.cjs');
|
|
169
169
|
|
|
170
170
|
|
|
171
|
-
var
|
|
171
|
+
var _chunkM5GLQQWGcjs = require('../chunk-M5GLQQWG.cjs');
|
|
172
172
|
|
|
173
173
|
|
|
174
174
|
|
|
175
175
|
var _chunkDWJJI6RTcjs = require('../chunk-DWJJI6RT.cjs');
|
|
176
|
-
require('../chunk-
|
|
176
|
+
require('../chunk-4ZC5QJE2.cjs');
|
|
177
177
|
require('../chunk-A6QWKBJP.cjs');
|
|
178
|
-
require('../chunk-
|
|
179
|
-
require('../chunk-
|
|
178
|
+
require('../chunk-EUIDTZNQ.cjs');
|
|
179
|
+
require('../chunk-TFF2GTGN.cjs');
|
|
180
|
+
require('../chunk-5UEFBM2M.cjs');
|
|
180
181
|
require('../chunk-IPJ3TEYR.cjs');
|
|
181
182
|
|
|
182
183
|
// src/video-editor/parse.ts
|
|
@@ -3357,7 +3358,7 @@ var VideoEditorController = (_class7 = class _VideoEditorController {
|
|
|
3357
3358
|
this.readOnly = _nullishCoalesce(options.readOnly, () => ( false));
|
|
3358
3359
|
this.previewScale = checkPreviewScale(_nullishCoalesce(options.previewScale, () => ( "auto")));
|
|
3359
3360
|
this.onChange = options.onChange;
|
|
3360
|
-
this.player = new (0,
|
|
3361
|
+
this.player = new (0, _chunkM5GLQQWGcjs.AnimationPlayer)({ clock: options.clock, duration: () => _chunk3OSXHLITcjs.videoProjectDuration.call(void 0, this.project), loop: "none" });
|
|
3361
3362
|
this.state = this.computeState();
|
|
3362
3363
|
this.connect();
|
|
3363
3364
|
}
|
|
@@ -6152,7 +6153,7 @@ var videoAuthorableEffects = (clip) => _nullishCoalesce(clip.effects, () => ( []
|
|
|
6152
6153
|
|
|
6153
6154
|
// src/video-editor/editorDocument.ts
|
|
6154
6155
|
function createVideoEditorDocument(controller) {
|
|
6155
|
-
return
|
|
6156
|
+
return _chunkSJ2CPTQCcjs.defineEditorDocument.call(void 0, {
|
|
6156
6157
|
kind: "video",
|
|
6157
6158
|
get: () => controller.getProject(),
|
|
6158
6159
|
load: (document2, { history }) => {
|
|
@@ -161,22 +161,23 @@ import {
|
|
|
161
161
|
import "../chunk-V2ZCJRDM.js";
|
|
162
162
|
import {
|
|
163
163
|
defineEditorDocument
|
|
164
|
-
} from "../chunk-
|
|
164
|
+
} from "../chunk-XBQX76CT.js";
|
|
165
165
|
import "../chunk-HF5QZS7Z.js";
|
|
166
166
|
import {
|
|
167
167
|
HistoryManager
|
|
168
168
|
} from "../chunk-RNSANXPT.js";
|
|
169
169
|
import {
|
|
170
170
|
AnimationPlayer
|
|
171
|
-
} from "../chunk-
|
|
171
|
+
} from "../chunk-F6R67I3A.js";
|
|
172
172
|
import {
|
|
173
173
|
CUBIC_BEZIER_PRESETS,
|
|
174
174
|
evaluateEasing
|
|
175
175
|
} from "../chunk-5UJHB3BW.js";
|
|
176
|
-
import "../chunk-
|
|
176
|
+
import "../chunk-M2TPMYJE.js";
|
|
177
177
|
import "../chunk-2WPNAGHI.js";
|
|
178
|
-
import "../chunk-
|
|
179
|
-
import "../chunk-
|
|
178
|
+
import "../chunk-7272D3K2.js";
|
|
179
|
+
import "../chunk-YBAPT7NL.js";
|
|
180
|
+
import "../chunk-MHLU6GRJ.js";
|
|
180
181
|
import "../chunk-6ONMQ6WF.js";
|
|
181
182
|
|
|
182
183
|
// src/video-editor/parse.ts
|
package/package.json
CHANGED
package/dist/chunk-ERAGQL2N.cjs
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
-
|
|
3
|
-
var _chunkGMWNBSBScjs = require('./chunk-GMWNBSBS.cjs');
|
|
4
|
-
|
|
5
|
-
// src/tools/script.ts
|
|
6
|
-
function toolResultValue(result) {
|
|
7
|
-
if (result.structuredContent) return result.structuredContent;
|
|
8
|
-
const text = result.content.find((b) => b.type === "text");
|
|
9
|
-
if (!_optionalChain([text, 'optionalAccess', _ => _.text])) return void 0;
|
|
10
|
-
try {
|
|
11
|
-
return JSON.parse(text.text);
|
|
12
|
-
} catch (e) {
|
|
13
|
-
return text.text;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function toolResultError(result) {
|
|
17
|
-
const text = result.content.find((b) => b.type === "text");
|
|
18
|
-
return _nullishCoalesce(_optionalChain([text, 'optionalAccess', _2 => _2.text]), () => ( "The tool failed."));
|
|
19
|
-
}
|
|
20
|
-
var realWait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
21
|
-
async function runToolScript(source, script, options = {}) {
|
|
22
|
-
const control = _nullishCoalesce(options.control, () => ( { speed: 1, stopped: false }));
|
|
23
|
-
const wait = _nullishCoalesce(options.wait, () => ( realWait));
|
|
24
|
-
const pause = (ms) => Number.isFinite(control.speed) ? wait(ms / Math.max(0.1, control.speed)) : Promise.resolve();
|
|
25
|
-
const emit = _nullishCoalesce(options.onEvent, () => ( (() => {
|
|
26
|
-
})));
|
|
27
|
-
const ctx = { results: {}, last: void 0 };
|
|
28
|
-
const finish = (ok) => {
|
|
29
|
-
if (control.stopped) _optionalChain([options, 'access', _3 => _3.playback, 'optionalAccess', _4 => _4.stop, 'call', _5 => _5()]);
|
|
30
|
-
emit({ type: "done", ok, stopped: control.stopped });
|
|
31
|
-
return { ok, ctx };
|
|
32
|
-
};
|
|
33
|
-
for (let i = 0; i < script.steps.length; i++) {
|
|
34
|
-
if (control.stopped) return finish(false);
|
|
35
|
-
const step = script.steps[i];
|
|
36
|
-
if (step.say) {
|
|
37
|
-
emit({ type: "say", step: i, text: step.say });
|
|
38
|
-
_optionalChain([options, 'access', _6 => _6.playback, 'optionalAccess', _7 => _7.say, 'call', _8 => _8(step.say, options.actor ? { actor: options.actor } : {})]);
|
|
39
|
-
await pause(_chunkGMWNBSBScjs.readingTime.call(void 0, step.say));
|
|
40
|
-
}
|
|
41
|
-
if (!step.tool) continue;
|
|
42
|
-
if (control.stopped) return finish(false);
|
|
43
|
-
let args;
|
|
44
|
-
try {
|
|
45
|
-
args = typeof step.args === "function" ? step.args(ctx) : _nullishCoalesce(step.args, () => ( {}));
|
|
46
|
-
} catch (error) {
|
|
47
|
-
emit({ type: "error", step: i, message: error instanceof Error ? error.message : String(error) });
|
|
48
|
-
return finish(false);
|
|
49
|
-
}
|
|
50
|
-
emit({ type: "call", step: i, tool: step.tool, args });
|
|
51
|
-
const result = await source.callTool(step.tool, args, options.actor ? { actor: options.actor } : {});
|
|
52
|
-
emit({ type: "result", step: i, tool: step.tool, result });
|
|
53
|
-
if (result.isError) {
|
|
54
|
-
emit({ type: "error", step: i, message: toolResultError(result) });
|
|
55
|
-
return finish(false);
|
|
56
|
-
}
|
|
57
|
-
ctx.last = toolResultValue(result);
|
|
58
|
-
if (step.as) ctx.results[step.as] = ctx.last;
|
|
59
|
-
await pause(350);
|
|
60
|
-
}
|
|
61
|
-
return finish(true);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
exports.toolResultValue = toolResultValue; exports.toolResultError = toolResultError; exports.runToolScript = runToolScript;
|
package/dist/chunk-KMU6QJB7.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
readingTime
|
|
3
|
-
} from "./chunk-6DXDUVSL.js";
|
|
4
|
-
|
|
5
|
-
// src/tools/script.ts
|
|
6
|
-
function toolResultValue(result) {
|
|
7
|
-
if (result.structuredContent) return result.structuredContent;
|
|
8
|
-
const text = result.content.find((b) => b.type === "text");
|
|
9
|
-
if (!text?.text) return void 0;
|
|
10
|
-
try {
|
|
11
|
-
return JSON.parse(text.text);
|
|
12
|
-
} catch {
|
|
13
|
-
return text.text;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function toolResultError(result) {
|
|
17
|
-
const text = result.content.find((b) => b.type === "text");
|
|
18
|
-
return text?.text ?? "The tool failed.";
|
|
19
|
-
}
|
|
20
|
-
var realWait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
21
|
-
async function runToolScript(source, script, options = {}) {
|
|
22
|
-
const control = options.control ?? { speed: 1, stopped: false };
|
|
23
|
-
const wait = options.wait ?? realWait;
|
|
24
|
-
const pause = (ms) => Number.isFinite(control.speed) ? wait(ms / Math.max(0.1, control.speed)) : Promise.resolve();
|
|
25
|
-
const emit = options.onEvent ?? (() => {
|
|
26
|
-
});
|
|
27
|
-
const ctx = { results: {}, last: void 0 };
|
|
28
|
-
const finish = (ok) => {
|
|
29
|
-
if (control.stopped) options.playback?.stop();
|
|
30
|
-
emit({ type: "done", ok, stopped: control.stopped });
|
|
31
|
-
return { ok, ctx };
|
|
32
|
-
};
|
|
33
|
-
for (let i = 0; i < script.steps.length; i++) {
|
|
34
|
-
if (control.stopped) return finish(false);
|
|
35
|
-
const step = script.steps[i];
|
|
36
|
-
if (step.say) {
|
|
37
|
-
emit({ type: "say", step: i, text: step.say });
|
|
38
|
-
options.playback?.say(step.say, options.actor ? { actor: options.actor } : {});
|
|
39
|
-
await pause(readingTime(step.say));
|
|
40
|
-
}
|
|
41
|
-
if (!step.tool) continue;
|
|
42
|
-
if (control.stopped) return finish(false);
|
|
43
|
-
let args;
|
|
44
|
-
try {
|
|
45
|
-
args = typeof step.args === "function" ? step.args(ctx) : step.args ?? {};
|
|
46
|
-
} catch (error) {
|
|
47
|
-
emit({ type: "error", step: i, message: error instanceof Error ? error.message : String(error) });
|
|
48
|
-
return finish(false);
|
|
49
|
-
}
|
|
50
|
-
emit({ type: "call", step: i, tool: step.tool, args });
|
|
51
|
-
const result = await source.callTool(step.tool, args, options.actor ? { actor: options.actor } : {});
|
|
52
|
-
emit({ type: "result", step: i, tool: step.tool, result });
|
|
53
|
-
if (result.isError) {
|
|
54
|
-
emit({ type: "error", step: i, message: toolResultError(result) });
|
|
55
|
-
return finish(false);
|
|
56
|
-
}
|
|
57
|
-
ctx.last = toolResultValue(result);
|
|
58
|
-
if (step.as) ctx.results[step.as] = ctx.last;
|
|
59
|
-
await pause(350);
|
|
60
|
-
}
|
|
61
|
-
return finish(true);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export {
|
|
65
|
-
toolResultValue,
|
|
66
|
-
toolResultError,
|
|
67
|
-
runToolScript
|
|
68
|
-
};
|