@nodetool-ai/execution 0.8.1
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/README.md +129 -0
- package/dist/.nodetool-build-stamp +1 -0
- package/dist/app-debug/app-spec.d.ts +94 -0
- package/dist/app-debug/app-spec.d.ts.map +1 -0
- package/dist/app-debug/app-spec.js +710 -0
- package/dist/app-debug/app-spec.js.map +1 -0
- package/dist/app-debug/application-target.d.ts +53 -0
- package/dist/app-debug/application-target.d.ts.map +1 -0
- package/dist/app-debug/application-target.js +126 -0
- package/dist/app-debug/application-target.js.map +1 -0
- package/dist/app-debug/bundle-target.d.ts +21 -0
- package/dist/app-debug/bundle-target.d.ts.map +1 -0
- package/dist/app-debug/bundle-target.js +51 -0
- package/dist/app-debug/bundle-target.js.map +1 -0
- package/dist/app-debug/graph-shape.d.ts +14 -0
- package/dist/app-debug/graph-shape.d.ts.map +1 -0
- package/dist/app-debug/graph-shape.js +23 -0
- package/dist/app-debug/graph-shape.js.map +1 -0
- package/dist/app-debug/index.d.ts +26 -0
- package/dist/app-debug/index.d.ts.map +1 -0
- package/dist/app-debug/index.js +19 -0
- package/dist/app-debug/index.js.map +1 -0
- package/dist/app-debug/markdown.d.ts +6 -0
- package/dist/app-debug/markdown.d.ts.map +1 -0
- package/dist/app-debug/markdown.js +133 -0
- package/dist/app-debug/markdown.js.map +1 -0
- package/dist/app-debug/runtime.d.ts +267 -0
- package/dist/app-debug/runtime.d.ts.map +1 -0
- package/dist/app-debug/runtime.js +633 -0
- package/dist/app-debug/runtime.js.map +1 -0
- package/dist/app-debug/script-operation.d.ts +58 -0
- package/dist/app-debug/script-operation.d.ts.map +1 -0
- package/dist/app-debug/script-operation.js +44 -0
- package/dist/app-debug/script-operation.js.map +1 -0
- package/dist/app-debug/simulate.d.ts +85 -0
- package/dist/app-debug/simulate.d.ts.map +1 -0
- package/dist/app-debug/simulate.js +991 -0
- package/dist/app-debug/simulate.js.map +1 -0
- package/dist/app-debug/summarize.d.ts +64 -0
- package/dist/app-debug/summarize.d.ts.map +1 -0
- package/dist/app-debug/summarize.js +65 -0
- package/dist/app-debug/summarize.js.map +1 -0
- package/dist/app-debug/types.d.ts +343 -0
- package/dist/app-debug/types.d.ts.map +1 -0
- package/dist/app-debug/types.js +2 -0
- package/dist/app-debug/types.js.map +1 -0
- package/dist/cost-ledger.d.ts +147 -0
- package/dist/cost-ledger.d.ts.map +1 -0
- package/dist/cost-ledger.js +288 -0
- package/dist/cost-ledger.js.map +1 -0
- package/dist/debug/collector.d.ts +28 -0
- package/dist/debug/collector.d.ts.map +1 -0
- package/dist/debug/collector.js +284 -0
- package/dist/debug/collector.js.map +1 -0
- package/dist/debug/index.d.ts +15 -0
- package/dist/debug/index.d.ts.map +1 -0
- package/dist/debug/index.js +16 -0
- package/dist/debug/index.js.map +1 -0
- package/dist/debug/types.d.ts +179 -0
- package/dist/debug/types.d.ts.map +1 -0
- package/dist/debug/types.js +11 -0
- package/dist/debug/types.js.map +1 -0
- package/dist/debug/verdict.d.ts +27 -0
- package/dist/debug/verdict.d.ts.map +1 -0
- package/dist/debug/verdict.js +51 -0
- package/dist/debug/verdict.js.map +1 -0
- package/dist/executor-resolver.d.ts +13 -0
- package/dist/executor-resolver.d.ts.map +1 -0
- package/dist/executor-resolver.js +13 -0
- package/dist/executor-resolver.js.map +1 -0
- package/dist/fal-output-decoder.d.ts +36 -0
- package/dist/fal-output-decoder.d.ts.map +1 -0
- package/dist/fal-output-decoder.js +129 -0
- package/dist/fal-output-decoder.js.map +1 -0
- package/dist/generation-lifecycle.d.ts +54 -0
- package/dist/generation-lifecycle.d.ts.map +1 -0
- package/dist/generation-lifecycle.js +431 -0
- package/dist/generation-lifecycle.js.map +1 -0
- package/dist/generation-recovery-worker.d.ts +100 -0
- package/dist/generation-recovery-worker.d.ts.map +1 -0
- package/dist/generation-recovery-worker.js +995 -0
- package/dist/generation-recovery-worker.js.map +1 -0
- package/dist/generation-tracker.d.ts +83 -0
- package/dist/generation-tracker.d.ts.map +1 -0
- package/dist/generation-tracker.js +436 -0
- package/dist/generation-tracker.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/js-script-debug/index.d.ts +13 -0
- package/dist/js-script-debug/index.d.ts.map +1 -0
- package/dist/js-script-debug/index.js +12 -0
- package/dist/js-script-debug/index.js.map +1 -0
- package/dist/js-script-debug/markdown.d.ts +6 -0
- package/dist/js-script-debug/markdown.d.ts.map +1 -0
- package/dist/js-script-debug/markdown.js +62 -0
- package/dist/js-script-debug/markdown.js.map +1 -0
- package/dist/js-script-debug/outputs.d.ts +20 -0
- package/dist/js-script-debug/outputs.d.ts.map +1 -0
- package/dist/js-script-debug/outputs.js +30 -0
- package/dist/js-script-debug/outputs.js.map +1 -0
- package/dist/js-script-debug/report.d.ts +15 -0
- package/dist/js-script-debug/report.d.ts.map +1 -0
- package/dist/js-script-debug/report.js +90 -0
- package/dist/js-script-debug/report.js.map +1 -0
- package/dist/js-script-debug/types.d.ts +63 -0
- package/dist/js-script-debug/types.d.ts.map +1 -0
- package/dist/js-script-debug/types.js +10 -0
- package/dist/js-script-debug/types.js.map +1 -0
- package/dist/js-script-debug/validate.d.ts +38 -0
- package/dist/js-script-debug/validate.d.ts.map +1 -0
- package/dist/js-script-debug/validate.js +137 -0
- package/dist/js-script-debug/validate.js.map +1 -0
- package/dist/message-stream.d.ts +33 -0
- package/dist/message-stream.d.ts.map +1 -0
- package/dist/message-stream.js +58 -0
- package/dist/message-stream.js.map +1 -0
- package/dist/normalize-graph.d.ts +13 -0
- package/dist/normalize-graph.d.ts.map +1 -0
- package/dist/normalize-graph.js +63 -0
- package/dist/normalize-graph.js.map +1 -0
- package/dist/output-names.d.ts +13 -0
- package/dist/output-names.d.ts.map +1 -0
- package/dist/output-names.js +13 -0
- package/dist/output-names.js.map +1 -0
- package/dist/predicates.d.ts +6 -0
- package/dist/predicates.d.ts.map +1 -0
- package/dist/predicates.js +6 -0
- package/dist/predicates.js.map +1 -0
- package/dist/preflight.d.ts +87 -0
- package/dist/preflight.d.ts.map +1 -0
- package/dist/preflight.js +139 -0
- package/dist/preflight.js.map +1 -0
- package/dist/provider-secret-key.d.ts +3 -0
- package/dist/provider-secret-key.d.ts.map +1 -0
- package/dist/provider-secret-key.js +7 -0
- package/dist/provider-secret-key.js.map +1 -0
- package/dist/service/app-debug-service.d.ts +78 -0
- package/dist/service/app-debug-service.d.ts.map +1 -0
- package/dist/service/app-debug-service.js +201 -0
- package/dist/service/app-debug-service.js.map +1 -0
- package/dist/service/app-run-server.d.ts +28 -0
- package/dist/service/app-run-server.d.ts.map +1 -0
- package/dist/service/app-run-server.js +104 -0
- package/dist/service/app-run-server.js.map +1 -0
- package/dist/service/debug-sessions.d.ts +158 -0
- package/dist/service/debug-sessions.d.ts.map +1 -0
- package/dist/service/debug-sessions.js +358 -0
- package/dist/service/debug-sessions.js.map +1 -0
- package/dist/service/index.d.ts +22 -0
- package/dist/service/index.d.ts.map +1 -0
- package/dist/service/index.js +17 -0
- package/dist/service/index.js.map +1 -0
- package/dist/service/job-progress.d.ts +40 -0
- package/dist/service/job-progress.d.ts.map +1 -0
- package/dist/service/job-progress.js +53 -0
- package/dist/service/job-progress.js.map +1 -0
- package/dist/service/workflow-run.d.ts +279 -0
- package/dist/service/workflow-run.d.ts.map +1 -0
- package/dist/service/workflow-run.js +598 -0
- package/dist/service/workflow-run.js.map +1 -0
- package/dist/service/workflow-workspace.d.ts +89 -0
- package/dist/service/workflow-workspace.d.ts.map +1 -0
- package/dist/service/workflow-workspace.js +160 -0
- package/dist/service/workflow-workspace.js.map +1 -0
- package/dist/session.d.ts +62 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +353 -0
- package/dist/session.js.map +1 -0
- package/dist/sketch-debug/index.d.ts +11 -0
- package/dist/sketch-debug/index.d.ts.map +1 -0
- package/dist/sketch-debug/index.js +10 -0
- package/dist/sketch-debug/index.js.map +1 -0
- package/dist/sketch-debug/markdown.d.ts +6 -0
- package/dist/sketch-debug/markdown.d.ts.map +1 -0
- package/dist/sketch-debug/markdown.js +93 -0
- package/dist/sketch-debug/markdown.js.map +1 -0
- package/dist/sketch-debug/report.d.ts +15 -0
- package/dist/sketch-debug/report.d.ts.map +1 -0
- package/dist/sketch-debug/report.js +98 -0
- package/dist/sketch-debug/report.js.map +1 -0
- package/dist/sketch-debug/types.d.ts +62 -0
- package/dist/sketch-debug/types.d.ts.map +1 -0
- package/dist/sketch-debug/types.js +10 -0
- package/dist/sketch-debug/types.js.map +1 -0
- package/dist/sketch-debug/validate.d.ts +14 -0
- package/dist/sketch-debug/validate.d.ts.map +1 -0
- package/dist/sketch-debug/validate.js +478 -0
- package/dist/sketch-debug/validate.js.map +1 -0
- package/dist/supervisor.d.ts +45 -0
- package/dist/supervisor.d.ts.map +1 -0
- package/dist/supervisor.js +97 -0
- package/dist/supervisor.js.map +1 -0
- package/dist/timeline-debug/index.d.ts +11 -0
- package/dist/timeline-debug/index.d.ts.map +1 -0
- package/dist/timeline-debug/index.js +10 -0
- package/dist/timeline-debug/index.js.map +1 -0
- package/dist/timeline-debug/legibility.d.ts +23 -0
- package/dist/timeline-debug/legibility.d.ts.map +1 -0
- package/dist/timeline-debug/legibility.js +240 -0
- package/dist/timeline-debug/legibility.js.map +1 -0
- package/dist/timeline-debug/markdown.d.ts +6 -0
- package/dist/timeline-debug/markdown.d.ts.map +1 -0
- package/dist/timeline-debug/markdown.js +103 -0
- package/dist/timeline-debug/markdown.js.map +1 -0
- package/dist/timeline-debug/motion.d.ts +20 -0
- package/dist/timeline-debug/motion.d.ts.map +1 -0
- package/dist/timeline-debug/motion.js +362 -0
- package/dist/timeline-debug/motion.js.map +1 -0
- package/dist/timeline-debug/report.d.ts +16 -0
- package/dist/timeline-debug/report.d.ts.map +1 -0
- package/dist/timeline-debug/report.js +100 -0
- package/dist/timeline-debug/report.js.map +1 -0
- package/dist/timeline-debug/showcase.d.ts +7 -0
- package/dist/timeline-debug/showcase.d.ts.map +1 -0
- package/dist/timeline-debug/showcase.js +347 -0
- package/dist/timeline-debug/showcase.js.map +1 -0
- package/dist/timeline-debug/types.d.ts +64 -0
- package/dist/timeline-debug/types.d.ts.map +1 -0
- package/dist/timeline-debug/types.js +10 -0
- package/dist/timeline-debug/types.js.map +1 -0
- package/dist/timeline-debug/validate.d.ts +24 -0
- package/dist/timeline-debug/validate.d.ts.map +1 -0
- package/dist/timeline-debug/validate.js +1432 -0
- package/dist/timeline-debug/validate.js.map +1 -0
- package/dist/types.d.ts +211 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +103 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Script operations for the app simulator.
|
|
3
|
+
*
|
|
4
|
+
* The contract itself — the synthesized message stream and the port surface
|
|
5
|
+
* that stands in for a graph — lives in `@nodetool-ai/app-runtime`
|
|
6
|
+
* (`script-run.ts`), because the browser runs script operations too and cannot
|
|
7
|
+
* depend on this package. What is left here is the part that needs a parser:
|
|
8
|
+
* binding the pinned Zod document and deciding, from the body, whether the
|
|
9
|
+
* mapped values are staged as streams.
|
|
10
|
+
*/
|
|
11
|
+
import { type ScriptRunResult } from "@nodetool-ai/app-runtime";
|
|
12
|
+
import { type JsScriptDocument } from "@nodetool-ai/protocol/api-schemas/js-scripts.js";
|
|
13
|
+
import type { AppIO } from "./types.js";
|
|
14
|
+
/** What one script run returned — the shape `POST /api/js-scripts/:id/run` answers with. */
|
|
15
|
+
export type JsScriptRunResult = ScriptRunResult;
|
|
16
|
+
/** Run one pinned script's document with the given inputs. */
|
|
17
|
+
export type JsScriptOperationRunner = (input: {
|
|
18
|
+
scriptId: string;
|
|
19
|
+
scriptVersion: number;
|
|
20
|
+
name: string;
|
|
21
|
+
document: JsScriptDocument;
|
|
22
|
+
inputs: Record<string, unknown>;
|
|
23
|
+
/** Items staged per handle for a body that reads `stream`. */
|
|
24
|
+
inputStreams?: Record<string, unknown[]>;
|
|
25
|
+
timeoutMs?: number;
|
|
26
|
+
}) => Promise<JsScriptRunResult>;
|
|
27
|
+
/** How one invocation's mapped values reach the body. */
|
|
28
|
+
interface JsScriptInvocation {
|
|
29
|
+
inputs: Record<string, unknown>;
|
|
30
|
+
inputStreams?: Record<string, unknown[]>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Split an operation's mapped values the way the body reads them — staged as
|
|
34
|
+
* one-item streams when the body reads `stream`, untouched otherwise.
|
|
35
|
+
*/
|
|
36
|
+
export declare function scriptOperationInvocation(document: JsScriptDocument, inputs: Record<string, unknown>): JsScriptInvocation;
|
|
37
|
+
/** Resolve a pinned script target to its document. */
|
|
38
|
+
export type JsScriptOperationLoader = (scriptId: string, scriptVersion: number) => Promise<{
|
|
39
|
+
name: string;
|
|
40
|
+
document: JsScriptDocument;
|
|
41
|
+
} | null>;
|
|
42
|
+
/**
|
|
43
|
+
* Parse a document carried loosely (a bundle's structural shape) into the
|
|
44
|
+
* pinned contract, or null when it is not one. A bundle is untrusted input.
|
|
45
|
+
*/
|
|
46
|
+
export declare function parseCarriedScriptDocument(value: unknown): JsScriptDocument | null;
|
|
47
|
+
/**
|
|
48
|
+
* A script's bindable surface. Port names stand in for node ids: a script
|
|
49
|
+
* declares no nodes, and its port names are what every mapping already keys on.
|
|
50
|
+
*/
|
|
51
|
+
export declare function scriptAppIO(document: JsScriptDocument): AppIO;
|
|
52
|
+
/**
|
|
53
|
+
* The message stream a script run would have produced: its emits in order,
|
|
54
|
+
* then its final outputs, then the job's terminal status.
|
|
55
|
+
*/
|
|
56
|
+
export declare function jsScriptRunMessages(result: JsScriptRunResult): Array<Record<string, unknown>>;
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=script-operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script-operation.d.ts","sourceRoot":"","sources":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;AAElE;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,GACb,gBAAgB,GAAG,IAAI,CAGzB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,gBAAgB,GAAG,KAAK,CAG7D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,iBAAiB,GACxB,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAEhC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Script operations for the app simulator.
|
|
3
|
+
*
|
|
4
|
+
* The contract itself — the synthesized message stream and the port surface
|
|
5
|
+
* that stands in for a graph — lives in `@nodetool-ai/app-runtime`
|
|
6
|
+
* (`script-run.ts`), because the browser runs script operations too and cannot
|
|
7
|
+
* depend on this package. What is left here is the part that needs a parser:
|
|
8
|
+
* binding the pinned Zod document and deciding, from the body, whether the
|
|
9
|
+
* mapped values are staged as streams.
|
|
10
|
+
*/
|
|
11
|
+
import { scriptInvocationInput, scriptPortIO, scriptRunMessages } from "@nodetool-ai/app-runtime";
|
|
12
|
+
import { jsScriptDocument } from "@nodetool-ai/protocol/api-schemas/js-scripts.js";
|
|
13
|
+
import { usesStreamInputContract } from "@nodetool-ai/node-sdk/code-body";
|
|
14
|
+
/**
|
|
15
|
+
* Split an operation's mapped values the way the body reads them — staged as
|
|
16
|
+
* one-item streams when the body reads `stream`, untouched otherwise.
|
|
17
|
+
*/
|
|
18
|
+
export function scriptOperationInvocation(document, inputs) {
|
|
19
|
+
return scriptInvocationInput(inputs, usesStreamInputContract(document.code));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Parse a document carried loosely (a bundle's structural shape) into the
|
|
23
|
+
* pinned contract, or null when it is not one. A bundle is untrusted input.
|
|
24
|
+
*/
|
|
25
|
+
export function parseCarriedScriptDocument(value) {
|
|
26
|
+
const parsed = jsScriptDocument.safeParse(value);
|
|
27
|
+
return parsed.success ? parsed.data : null;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A script's bindable surface. Port names stand in for node ids: a script
|
|
31
|
+
* declares no nodes, and its port names are what every mapping already keys on.
|
|
32
|
+
*/
|
|
33
|
+
export function scriptAppIO(document) {
|
|
34
|
+
const io = scriptPortIO(document);
|
|
35
|
+
return { ...io, variables: [] };
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The message stream a script run would have produced: its emits in order,
|
|
39
|
+
* then its final outputs, then the job's terminal status.
|
|
40
|
+
*/
|
|
41
|
+
export function jsScriptRunMessages(result) {
|
|
42
|
+
return scriptRunMessages(result);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=script-operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script-operation.js","sourceRoot":"","sources":["../../src/app-debug/script-operation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,qBAAqB,EACrB,YAAY,EACZ,iBAAiB,EAElB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,gBAAgB,EAEjB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAwB1E;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAA0B,EAC1B,MAA+B;IAE/B,OAAO,qBAAqB,CAAC,MAAM,EAAE,uBAAuB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/E,CAAC;AAQD;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,MAAM,MAAM,GAAG,gBAAgB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACjD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,QAA0B;IACpD,MAAM,EAAE,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IAClC,OAAO,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;AAClC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAyB;IAEzB,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The app simulator: runs a resolved mini app headlessly.
|
|
3
|
+
*
|
|
4
|
+
* Parses the app document into a widget spec and a set of operations,
|
|
5
|
+
* statically validates the wiring, then simulates the app the way the web and
|
|
6
|
+
* mobile runtimes do: seed input and variable defaults, apply params, attach
|
|
7
|
+
* the resource collections the script seeds, execute the interaction script
|
|
8
|
+
* (each `run` action is a full workflow run on the injected server runner,
|
|
9
|
+
* subject to the operation's policy and timeout), fold the message stream into
|
|
10
|
+
* the app's reactive values, and re-evaluate every widget's conditions — a step
|
|
11
|
+
* no user could perform, because the widget is hidden or disabled, fails.
|
|
12
|
+
*
|
|
13
|
+
* Nothing here touches a database or a filesystem. The host resolves the target
|
|
14
|
+
* (`ResolvedAppTarget`), supplies the workflow runner, and writes whatever
|
|
15
|
+
* bundle it wants; the returned `AppDebugReport` is the whole result.
|
|
16
|
+
*/
|
|
17
|
+
import type { ProcessingMessage } from "@nodetool-ai/protocol";
|
|
18
|
+
import type { DebugGraph, ServerRunReport } from "../debug/types.js";
|
|
19
|
+
import { type InputSlot } from "@nodetool-ai/app-runtime";
|
|
20
|
+
import { type JsScriptOperationLoader, type JsScriptOperationRunner } from "./script-operation.js";
|
|
21
|
+
import type { AppDebugOptions, AppDebugReport, AppSpec, InteractionStep, ResolvedAppTarget } from "./types.js";
|
|
22
|
+
/** What the simulator hands a host's workflow runner. */
|
|
23
|
+
export interface AppServerRunInput {
|
|
24
|
+
graph: DebugGraph;
|
|
25
|
+
workflowId: string | null;
|
|
26
|
+
params: Record<string, unknown>;
|
|
27
|
+
timeoutMs?: number;
|
|
28
|
+
}
|
|
29
|
+
/** What it needs back: the run's report and the raw stream to fold. */
|
|
30
|
+
export interface AppServerRunOutcome {
|
|
31
|
+
report: ServerRunReport;
|
|
32
|
+
rawMessages: ProcessingMessage[];
|
|
33
|
+
}
|
|
34
|
+
export interface AppSimulationDeps {
|
|
35
|
+
/** Load a workflow by DB id — an operation may name one the target lacks. */
|
|
36
|
+
loadFromDb: (id: string) => Promise<{
|
|
37
|
+
graph: DebugGraph;
|
|
38
|
+
app_doc?: unknown;
|
|
39
|
+
} | null>;
|
|
40
|
+
/** Execute one operation's workflow. */
|
|
41
|
+
runOnServer: (input: AppServerRunInput) => Promise<AppServerRunOutcome>;
|
|
42
|
+
/**
|
|
43
|
+
* Resolve a pinned script version a script operation targets and the target
|
|
44
|
+
* itself does not carry. Absent on a host with no script store, where such an
|
|
45
|
+
* operation reports as unresolvable instead of running something else.
|
|
46
|
+
*/
|
|
47
|
+
loadScript?: JsScriptOperationLoader;
|
|
48
|
+
/**
|
|
49
|
+
* Execute one script operation. Absent on a host that cannot run a sandbox
|
|
50
|
+
* body, with the same consequence.
|
|
51
|
+
*/
|
|
52
|
+
runScript?: JsScriptOperationRunner;
|
|
53
|
+
/** Progress/log sink. */
|
|
54
|
+
onLog?: (line: string) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Persist one run's raw message stream, returning the path to record on the
|
|
57
|
+
* run report. Hosts that write no bundle omit it.
|
|
58
|
+
*/
|
|
59
|
+
onRunMessages?: (runIndex: number, messages: ProcessingMessage[]) => Promise<string | null>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The app's natural run trigger, mirroring what a user would do first: click
|
|
63
|
+
* the first `click`→`run` widget (a Run button), else touch the first
|
|
64
|
+
* `change`→`run` write widget.
|
|
65
|
+
*/
|
|
66
|
+
export declare function defaultInteractions(spec: AppSpec): InteractionStep[];
|
|
67
|
+
/**
|
|
68
|
+
* Overlay the live values of node-property bindings onto the graph, the way the
|
|
69
|
+
* web runtime does before every run (`collectNodePropertyOverlays` →
|
|
70
|
+
* `withNodeProperties` in `web/src/components/appbuilder/nodeBinding.ts`).
|
|
71
|
+
*
|
|
72
|
+
* A widget bound `op:main/prop:node7#strength` writes an input slot keyed by
|
|
73
|
+
* node and property, which no input node reads — the value only reaches the run
|
|
74
|
+
* as a property of the node it names. The web helpers take ReactFlow nodes, so
|
|
75
|
+
* the mapping is repeated here against the kernel shape (`node.properties`);
|
|
76
|
+
* `parseInputStateKey` — the shared inverse of the state key — is what both
|
|
77
|
+
* sides actually agree on.
|
|
78
|
+
*
|
|
79
|
+
* Only the running operation's slots apply: two operations can bind the same
|
|
80
|
+
* node id in different workflows, so an unscoped merge would let one
|
|
81
|
+
* operation's slider drive the other's run.
|
|
82
|
+
*/
|
|
83
|
+
export declare function withNodePropertyOverlays(graph: DebugGraph, inputs: Record<string, InputSlot>, operationId: string): DebugGraph;
|
|
84
|
+
export declare function simulateApp(resolved: ResolvedAppTarget, options: AppDebugOptions, deps: AppSimulationDeps): Promise<AppDebugReport>;
|
|
85
|
+
//# sourceMappingURL=simulate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulate.d.ts","sourceRoot":"","sources":["../../src/app-debug/simulate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EACV,UAAU,EAEV,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAQL,KAAK,SAAS,EAGf,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAIL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC7B,MAAM,uBAAuB,CAAC;AAgB/B,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EAEd,OAAO,EAGP,eAAe,EACf,iBAAiB,EAElB,MAAM,YAAY,CAAC;AAUpB,yDAA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