@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,279 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Running a saved workflow, as a service every host can call in-process.
|
|
3
|
+
*
|
|
4
|
+
* This is what `POST /api/workflows/:id/run|debug` does minus Request/Response
|
|
5
|
+
* parsing: find the workflow, refuse a graph whose model selections cannot be
|
|
6
|
+
* honoured, create the job row, run it, finalize the row, and shape the payload
|
|
7
|
+
* — plain `/run` or the debug report. The interactive path parks escalations in
|
|
8
|
+
* the {@link debugSessions} registry and hands back the session event.
|
|
9
|
+
*
|
|
10
|
+
* The websocket package keeps the Fastify routes and calls this; the agent
|
|
11
|
+
* tools call it directly, so `run_workflow` no longer needs a server listening
|
|
12
|
+
* on localhost to run a workflow.
|
|
13
|
+
*/
|
|
14
|
+
import { WorkflowRunner } from "@nodetool-ai/kernel";
|
|
15
|
+
import { type NodeRegistry } from "@nodetool-ai/node-sdk";
|
|
16
|
+
import type { NodeExecutor, ProcessingContext, StorageAdapter, Workspace } from "@nodetool-ai/runtime";
|
|
17
|
+
import type { RawGraphInput } from "../types.js";
|
|
18
|
+
import { type RunModelCatalogs } from "../preflight.js";
|
|
19
|
+
import type { ExecutionSummary } from "../debug/types.js";
|
|
20
|
+
import { DebugSession, type DebugSessionEvent } from "./debug-sessions.js";
|
|
21
|
+
export { modelSelectionErrors, unconfiguredProviderErrors, formatPreflightDetail, ExecutionPreflightError } from "../preflight.js";
|
|
22
|
+
export type { CredentialResolver, ExecutionPreflightIssue, RunModelCatalogs } from "../preflight.js";
|
|
23
|
+
type WorkflowRunResult = Awaited<ReturnType<WorkflowRunner["run"]>>;
|
|
24
|
+
/**
|
|
25
|
+
* What the host brings to a run: the node registry, and — for a host that also
|
|
26
|
+
* owns a Python worker — how to resolve a Python node and how to wake the
|
|
27
|
+
* bridge. A host with neither (the agent tools, a test) supplies just the
|
|
28
|
+
* registry and gets registry-only resolution.
|
|
29
|
+
*/
|
|
30
|
+
export interface WorkflowRunEnvironment {
|
|
31
|
+
registry: NodeRegistry;
|
|
32
|
+
resolveExecutor?: (node: {
|
|
33
|
+
id: string;
|
|
34
|
+
type: string;
|
|
35
|
+
[key: string]: unknown;
|
|
36
|
+
}) => NodeExecutor;
|
|
37
|
+
ensurePythonBridge?: () => Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Attach host-provided model interfaces (asset persistence, message
|
|
40
|
+
* storage, …) to the run's ProcessingContext before execution. Without it
|
|
41
|
+
* nodes that persist artifacts — every image Output — fail their run.
|
|
42
|
+
*/
|
|
43
|
+
configureContext?: (context: ProcessingContext) => void;
|
|
44
|
+
/**
|
|
45
|
+
* The store `asset://<id>` inputs resolve through, and the temp store for
|
|
46
|
+
* runtime-materialized refs. A host that brings neither runs with a context
|
|
47
|
+
* that can write assets but not read them.
|
|
48
|
+
*/
|
|
49
|
+
assetStorage?: StorageAdapter | null;
|
|
50
|
+
storage?: StorageAdapter | null;
|
|
51
|
+
}
|
|
52
|
+
export interface RunWorkflowOptions {
|
|
53
|
+
/**
|
|
54
|
+
* The saved workflow to run. With {@link RunWorkflowOptions.graph} nothing
|
|
55
|
+
* is looked up and this is only the label the job row and the cost ledger
|
|
56
|
+
* carry, so a run that belongs to no workflow passes `""`.
|
|
57
|
+
*/
|
|
58
|
+
workflowId: string;
|
|
59
|
+
userId: string;
|
|
60
|
+
/**
|
|
61
|
+
* Run this graph instead of the one stored on `workflowId`.
|
|
62
|
+
*
|
|
63
|
+
* A caller that assembles a graph on the fly — `render_timeline` builds a
|
|
64
|
+
* `nodetool.timeline.RenderTimeline` graph (D12,
|
|
65
|
+
* docs/plans/motion-graphics.md) — gets the job row, the logs, the progress
|
|
66
|
+
* messages and cancel without first saving a workflow nobody asked for.
|
|
67
|
+
*/
|
|
68
|
+
graph?: RawGraphInput;
|
|
69
|
+
/**
|
|
70
|
+
* Name for the job row. A graph run has no workflow to name it, so without
|
|
71
|
+
* this the job lists as an unlabelled row.
|
|
72
|
+
*/
|
|
73
|
+
jobName?: string;
|
|
74
|
+
/**
|
|
75
|
+
* The run environment, or a lazy resolver for it. Pass the resolver form
|
|
76
|
+
* when constructing the environment is expensive (registry bootstrap,
|
|
77
|
+
* Python bridge): it is awaited only after the cheap not-found and
|
|
78
|
+
* model-selection checks have passed.
|
|
79
|
+
*/
|
|
80
|
+
environment: WorkflowRunEnvironment | (() => Promise<WorkflowRunEnvironment>);
|
|
81
|
+
params?: Record<string, unknown>;
|
|
82
|
+
/** Return the full debug report (summary + verdict) instead of the run row. */
|
|
83
|
+
debug?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Detach the run: the call returns as soon as the job row exists, and the
|
|
86
|
+
* run finishes on its own, writing its status and outputs onto the job.
|
|
87
|
+
* The caller polls `get_job` (or `nodetool.jobs.wait`) for the result.
|
|
88
|
+
*/
|
|
89
|
+
background?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Bubble node failures up to the caller instead of resolving them here: the
|
|
92
|
+
* call returns as soon as a node invocation escalates and the run stays
|
|
93
|
+
* parked until a verdict arrives via {@link submitEscalationVerdict}.
|
|
94
|
+
*/
|
|
95
|
+
interactive?: boolean;
|
|
96
|
+
maxDecisions?: number;
|
|
97
|
+
maxRetriesPerNode?: number;
|
|
98
|
+
decisionTimeoutMs?: number;
|
|
99
|
+
/**
|
|
100
|
+
* Injected so a host that mocks workspace resolution (the websocket tests
|
|
101
|
+
* do) keeps controlling it. Defaults to the workspace stored on the workflow.
|
|
102
|
+
*/
|
|
103
|
+
resolveWorkspace?: (workflowId: string | null, userId: string) => Promise<Workspace | null>;
|
|
104
|
+
catalogs?: RunModelCatalogs;
|
|
105
|
+
/**
|
|
106
|
+
* The project this run belongs to, when the caller knows one. Neither a
|
|
107
|
+
* workflow row nor a job row carries a project today, so nothing here can
|
|
108
|
+
* derive it — a caller that has the context (a project's agent thread, a
|
|
109
|
+
* document's run) passes it, and every other caller leaves the ledger rows
|
|
110
|
+
* with a null project rather than defaulting them into the loose bucket.
|
|
111
|
+
*/
|
|
112
|
+
projectId?: string | null;
|
|
113
|
+
/** The project document this run is producing, when the caller names one. */
|
|
114
|
+
documentId?: string | null;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* A run's answer. `error` is a refusal the caller turns into its own transport
|
|
118
|
+
* error (an HTTP status, a tool error object); anything genuinely exceptional
|
|
119
|
+
* still throws.
|
|
120
|
+
*/
|
|
121
|
+
export type RunWorkflowOutcome = {
|
|
122
|
+
kind: "payload";
|
|
123
|
+
payload: Record<string, unknown>;
|
|
124
|
+
} | {
|
|
125
|
+
kind: "error";
|
|
126
|
+
status: number;
|
|
127
|
+
detail: string;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Server-side ceilings for the interactive bounds a caller may ask for. A
|
|
131
|
+
* number nobody would type by hand — a decision timeout of a day, ten thousand
|
|
132
|
+
* decisions — is clamped rather than honored.
|
|
133
|
+
*/
|
|
134
|
+
export declare const MAX_INTERACTIVE_DECISIONS = 100;
|
|
135
|
+
export declare const MAX_INTERACTIVE_RETRIES_PER_NODE = 20;
|
|
136
|
+
export declare const MAX_INTERACTIVE_DECISION_TIMEOUT_MS: number;
|
|
137
|
+
/**
|
|
138
|
+
* An interactive-run bound: an integer in `[min, max]`, or undefined.
|
|
139
|
+
* Out-of-range highs clamp to `max`; anything that is not a sane integer (NaN,
|
|
140
|
+
* Infinity, negatives, fractions) is undefined so the caller gets the default
|
|
141
|
+
* instead of a bound that fails every decision instantly.
|
|
142
|
+
*/
|
|
143
|
+
export declare function boundedRunOption(value: number | undefined, min: number, max: number): number | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* How much serialized output a job row will carry. Outputs are normally
|
|
146
|
+
* asset refs and short strings; a run that emits a megabyte of text should
|
|
147
|
+
* not turn every `get_job` into that megabyte, so past this the row records
|
|
148
|
+
* the handle names instead and the caller reads the values from the assets.
|
|
149
|
+
*/
|
|
150
|
+
export declare const MAX_PERSISTED_OUTPUT_BYTES = 256000;
|
|
151
|
+
/**
|
|
152
|
+
* Drop inline bytes from an asset ref that already says where its bytes live.
|
|
153
|
+
*
|
|
154
|
+
* A media output travels as `{type, data: "<base64>", asset_id, uri}` — the
|
|
155
|
+
* bytes and the handle, both. The job row wants only the handle: it is read
|
|
156
|
+
* back by `get_job`, which hands it to an agent. Carrying the base64 pushed
|
|
157
|
+
* every real media run past {@link MAX_PERSISTED_OUTPUT_BYTES}, so the row
|
|
158
|
+
* recorded the omission marker instead of the asset the run produced, and a
|
|
159
|
+
* caller that ran a render in the background could not find its video.
|
|
160
|
+
*
|
|
161
|
+
* A ref with no `asset_id` and no `uri` keeps its `data`: dropping that loses
|
|
162
|
+
* the only copy.
|
|
163
|
+
*/
|
|
164
|
+
export declare function withoutInlineAssetBytes(outputs: Record<string, unknown>): Record<string, unknown>;
|
|
165
|
+
/** What the row holds instead of an outputs bag it cannot carry. */
|
|
166
|
+
export interface OmittedOutputs {
|
|
167
|
+
omitted: true;
|
|
168
|
+
reason: string;
|
|
169
|
+
handles: string[];
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The outputs to store on the job row, or a marker naming the handles when
|
|
173
|
+
* they are too big to keep. Pure so the size rule is pinned by a test.
|
|
174
|
+
*/
|
|
175
|
+
export declare function persistableOutputs(outputs: Record<string, unknown>): Record<string, unknown> | OmittedOutputs;
|
|
176
|
+
/** How many log entries a job row keeps — the tail, which explains a failure. */
|
|
177
|
+
export declare const MAX_PERSISTED_LOG_ENTRIES = 200;
|
|
178
|
+
/** One persisted log line, in the shape `get_job_logs` hands back. */
|
|
179
|
+
export interface PersistedJobLog extends Record<string, unknown> {
|
|
180
|
+
severity: string;
|
|
181
|
+
node_id: string | null;
|
|
182
|
+
node_name: string | null;
|
|
183
|
+
content: string;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* The run's log tail plus one line per node that failed.
|
|
187
|
+
*
|
|
188
|
+
* `job.logs` had no writer at all: every `get_job_logs` call answered
|
|
189
|
+
* `total_logs: 0`, and `debug_workflow` reported an empty `logs` array, so the
|
|
190
|
+
* one tool an agent reaches for after a background run went wrong could not
|
|
191
|
+
* tell it anything. The messages are already folded for the debug payload;
|
|
192
|
+
* this keeps the part that survives the run.
|
|
193
|
+
*/
|
|
194
|
+
export declare function persistableLogs(summary: ExecutionSummary): PersistedJobLog[];
|
|
195
|
+
export declare function buildWorkflowRunPayload(jobId: string, workflowId: string, result: WorkflowRunResult, debug: boolean, extras: {
|
|
196
|
+
background: boolean;
|
|
197
|
+
}): {
|
|
198
|
+
job_id: string;
|
|
199
|
+
workflow_id: string;
|
|
200
|
+
status: "cancelled" | "completed" | "failed";
|
|
201
|
+
outputs: Record<string, unknown[]>;
|
|
202
|
+
error: string | null;
|
|
203
|
+
summary: ExecutionSummary;
|
|
204
|
+
verdict: import("../debug/types.js").RunVerdict | {
|
|
205
|
+
ok: boolean;
|
|
206
|
+
issues: string[];
|
|
207
|
+
headline: string;
|
|
208
|
+
warnings: string[];
|
|
209
|
+
};
|
|
210
|
+
message_count?: undefined;
|
|
211
|
+
background?: undefined;
|
|
212
|
+
} | {
|
|
213
|
+
summary?: undefined;
|
|
214
|
+
verdict?: undefined;
|
|
215
|
+
job_id: string;
|
|
216
|
+
workflow_id: string;
|
|
217
|
+
status: "cancelled" | "completed" | "failed";
|
|
218
|
+
outputs: Record<string, unknown[]>;
|
|
219
|
+
error: string | null;
|
|
220
|
+
message_count: number;
|
|
221
|
+
background: boolean;
|
|
222
|
+
};
|
|
223
|
+
/** One escalated/running/done payload shape for every interactive response. */
|
|
224
|
+
export declare function debugSessionEventPayload(session: DebugSession, event: DebugSessionEvent): {
|
|
225
|
+
session_id: string;
|
|
226
|
+
escalation_id?: undefined;
|
|
227
|
+
escalation?: undefined;
|
|
228
|
+
resolve?: undefined;
|
|
229
|
+
status?: undefined;
|
|
230
|
+
job_id?: undefined;
|
|
231
|
+
workflow_id?: undefined;
|
|
232
|
+
} | {
|
|
233
|
+
status: string;
|
|
234
|
+
session_id: string;
|
|
235
|
+
job_id: string;
|
|
236
|
+
workflow_id: string | null;
|
|
237
|
+
escalation_id: string;
|
|
238
|
+
escalation: {
|
|
239
|
+
nodeId: string;
|
|
240
|
+
nodeType: string;
|
|
241
|
+
correlationLineage: string[];
|
|
242
|
+
invocationKey: string;
|
|
243
|
+
allowedActions: ("end_stream" | "fail" | "retry" | "skip" | "substitute")[];
|
|
244
|
+
detail: string;
|
|
245
|
+
failureSignature?: string | undefined;
|
|
246
|
+
candidateOutput?: unknown;
|
|
247
|
+
inputs: Record<string, unknown>;
|
|
248
|
+
declaredOutputs: Record<string, string>;
|
|
249
|
+
attempt: number;
|
|
250
|
+
spentCostUsd: number;
|
|
251
|
+
createdAssets: boolean;
|
|
252
|
+
retrySafe: boolean;
|
|
253
|
+
emitted: boolean;
|
|
254
|
+
};
|
|
255
|
+
resolve: string;
|
|
256
|
+
} | {
|
|
257
|
+
escalation_id?: undefined;
|
|
258
|
+
escalation?: undefined;
|
|
259
|
+
resolve?: undefined;
|
|
260
|
+
status: string;
|
|
261
|
+
session_id: string;
|
|
262
|
+
job_id: string;
|
|
263
|
+
workflow_id: string | null;
|
|
264
|
+
};
|
|
265
|
+
/**
|
|
266
|
+
* Run a saved workflow end to end. Everything the HTTP route did except read
|
|
267
|
+
* the request and write the response.
|
|
268
|
+
*/
|
|
269
|
+
export declare function runWorkflow(options: RunWorkflowOptions): Promise<RunWorkflowOutcome>;
|
|
270
|
+
/** Read a session's current state without waiting. */
|
|
271
|
+
export declare function peekDebugSession(sessionId: string, userId: string): RunWorkflowOutcome;
|
|
272
|
+
/**
|
|
273
|
+
* Answer the escalation a run is parked on, then wait for whatever comes next
|
|
274
|
+
* — the following escalation, or the run's final report.
|
|
275
|
+
*/
|
|
276
|
+
export declare function submitEscalationVerdict(sessionId: string, userId: string, escalationId: string, verdict: Parameters<DebugSession["submitVerdict"]>[1]): Promise<RunWorkflowOutcome>;
|
|
277
|
+
/** Cancel a session's run and return its final report. */
|
|
278
|
+
export declare function cancelDebugSession(sessionId: string, userId: string): Promise<RunWorkflowOutcome>;
|
|
279
|
+
//# sourceMappingURL=workflow-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-run.d.ts","sourceRoot":"","sources":["../../src/service/workflow-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAiB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEpE,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,SAAS,EACV,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAM1D,OAAO,EAEL,YAAY,EAIZ,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAe7B,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB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