@oomol-lab/open-flow 0.1.0-beta.71 → 0.1.0-beta.73
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/browser/{flowChanges-9Ir2rdLx.js → flowChanges-CgSnSqqP.js} +1007 -997
- package/dist/browser/{flowWorkspace-LvZ6HuMM.js → flowWorkspace-Bf7H-r0t.js} +1 -1
- package/dist/browser/preview.js +1007 -997
- package/dist/browser/workbench.js +2 -2
- package/dist/command/index.js +1 -1
- package/dist/common/control-api.js +31 -20
- package/dist/common/scheduler-checkpoint.d.ts +42 -0
- package/dist/common/scheduler-dependencies.d.ts +80 -0
- package/dist/common/scheduler-node-execution.d.ts +75 -0
- package/dist/common/scheduler.d.ts +5 -58
- package/dist/common/scheduler.js +575 -471
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { a as derive, i as compute, l as val } from "./dist-bO8nvHFH.js";
|
|
|
3
3
|
import { c as useLang, l as useTranslate, o as I18nProvider, u as useVal } from "./dist-BFmpkX4P.js";
|
|
4
4
|
import { br as cn, i as TooltipTrigger, n as TooltipContent, t as Tooltip, vr as Button } from "./tooltip-wZJRB9oP.js";
|
|
5
5
|
import { C as resourceNameIssue, It as Input, M as mapConditionSources, N as nodeInputMappings, T as upgradeRevisionContent, _ as applyFlowChanges, a as DialogFooter, d as Field, g as FlowChangeError, gt as dequal$1, h as FieldLabel, i as DialogDescription, l as Icon, m as FieldGroup, o as DialogHeader, p as FieldError, r as DialogContent, s as DialogTitle, t as Dialog, u as Spinner, v as isTriggerNode, w as upgradeManualTrigger } from "./dialog-CUy_fwx9.js";
|
|
6
|
-
import { $ as designerGraph, $t as errorNotice, At as setInputSources, Bt as Empty, C as updateWebhook, Ct as setFlowViewport, Dt as resetInputValues, Et as repairNodeNames, Fn as jsonValue, Ft as IdTooltip, G as combineSources, Gt as EmptyTitle, H as addNodeIntent, Ht as EmptyDescription, In as record, It as followWorkbenchLink, J as CacheResource, Kt as Badge, Ln as string, Lt as InputGroup, Mt as updateStartInputDefs, Nt as updateTriggerSchedule, Ot as setCodeActions, Pn as invalidResponse, Pt as WorkflowExportMenuItem, Q as connectorActionPorts, Rn as ApiError, Rt as InputGroupAddon, S as updateValue, St as setComment, Tt as setNodePositions, U as deriveAddNodeOptions, Ut as EmptyHeader, Vt as EmptyContent, Wt as EmptyMedia, X as resourceData, Xt as createI18n, Z as resourceValue, _ as updateResolution, _n as parseWorkflowFile, _t as canvasPresentationChange, a as nameCreatedNodes, b as updateTaskPorts, bt as removeComments, c as setInputVariable, ct as flowResourceReferences, d as updateCondition, dn as sampleErrorOutputs, dt as diagnosticItems, en as WorkbenchClient, f as updateNodeDescription, fn as triggerOutputDefinitions, g as updateOutputPorts, gn as encodeWorkflowFile, gt as connectionCatalog, h as updateNodeSettings, hn as connectorActionMetadata, ht as actionWithConnections, i as deleteSelection, in as decodeTriggerCatalog, it as RunStore, jn as workflowCandidate, jt as setServiceConnections, kt as setConnectorConnection, l as setTriggerConnection, lt as Latest, m as updateNodeName, mn as connection, nn as allConnectorConnectionsQuery, o as selectWebhookResponse, p as updateNodeIcon, q as scopedValue, qt as EventSourcesPage, r as applyFlowChanges$1, rt as providerIcon, s as setInputValue, st as revisionView, t as addNode, tn as randomId, u as setTriggerEventSource, un as normalizeTriggerOutputs, ut as deriveInspectorDiagnostics, v as updateTask, vn as workflowFileName, vt as commentIds, wt as setNodeContentHidden, x as updateTriggerConfig, xt as restoreCanvasPresentation, y as updateTaskAdditionalInputs, yn as workflowNameFromFile, yt as flowPresentation, zn as controlErrorCode, zt as InputGroupInput } from "./flowChanges-
|
|
6
|
+
import { $ as designerGraph, $t as errorNotice, At as setInputSources, Bt as Empty, C as updateWebhook, Ct as setFlowViewport, Dt as resetInputValues, Et as repairNodeNames, Fn as jsonValue, Ft as IdTooltip, G as combineSources, Gt as EmptyTitle, H as addNodeIntent, Ht as EmptyDescription, In as record, It as followWorkbenchLink, J as CacheResource, Kt as Badge, Ln as string, Lt as InputGroup, Mt as updateStartInputDefs, Nt as updateTriggerSchedule, Ot as setCodeActions, Pn as invalidResponse, Pt as WorkflowExportMenuItem, Q as connectorActionPorts, Rn as ApiError, Rt as InputGroupAddon, S as updateValue, St as setComment, Tt as setNodePositions, U as deriveAddNodeOptions, Ut as EmptyHeader, Vt as EmptyContent, Wt as EmptyMedia, X as resourceData, Xt as createI18n, Z as resourceValue, _ as updateResolution, _n as parseWorkflowFile, _t as canvasPresentationChange, a as nameCreatedNodes, b as updateTaskPorts, bt as removeComments, c as setInputVariable, ct as flowResourceReferences, d as updateCondition, dn as sampleErrorOutputs, dt as diagnosticItems, en as WorkbenchClient, f as updateNodeDescription, fn as triggerOutputDefinitions, g as updateOutputPorts, gn as encodeWorkflowFile, gt as connectionCatalog, h as updateNodeSettings, hn as connectorActionMetadata, ht as actionWithConnections, i as deleteSelection, in as decodeTriggerCatalog, it as RunStore, jn as workflowCandidate, jt as setServiceConnections, kt as setConnectorConnection, l as setTriggerConnection, lt as Latest, m as updateNodeName, mn as connection, nn as allConnectorConnectionsQuery, o as selectWebhookResponse, p as updateNodeIcon, q as scopedValue, qt as EventSourcesPage, r as applyFlowChanges$1, rt as providerIcon, s as setInputValue, st as revisionView, t as addNode, tn as randomId, u as setTriggerEventSource, un as normalizeTriggerOutputs, ut as deriveInspectorDiagnostics, v as updateTask, vn as workflowFileName, vt as commentIds, wt as setNodeContentHidden, x as updateTriggerConfig, xt as restoreCanvasPresentation, y as updateTaskAdditionalInputs, yn as workflowNameFromFile, yt as flowPresentation, zn as controlErrorCode, zt as InputGroupInput } from "./flowChanges-CgSnSqqP.js";
|
|
7
7
|
import { a as uiLanguages, i as uiLanguageNames, n as isUiLanguage, r as resolveUiLanguage, t as importedWorkflowName } from "./languages-gYzoQqCi.js";
|
|
8
8
|
import { Suspense, forwardRef, lazy, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
9
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -7420,7 +7420,7 @@ var WorkbenchStore = class {
|
|
|
7420
7420
|
};
|
|
7421
7421
|
//#endregion
|
|
7422
7422
|
//#region src/workbench/browser/runtime/openFlowWorkbench.tsx
|
|
7423
|
-
var FlowWorkspace = lazy(() => import("./flowWorkspace-
|
|
7423
|
+
var FlowWorkspace = lazy(() => import("./flowWorkspace-Bf7H-r0t.js"));
|
|
7424
7424
|
function OpenFlowSessionGate({ action, description, error, onSubmit, onTokenChange, pending = false, title, token, tokenLabel }) {
|
|
7425
7425
|
const hasToken = token != null && tokenLabel != null && onTokenChange != null;
|
|
7426
7426
|
const tokenValue = token ?? "";
|
package/dist/command/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var Gb=Object.defineProperty;var Hb=(e)=>e;function Qb(e,n){this[e]=Hb.bind(null,n)}var no=(e,n)=>{for(var t in n)Gb(e,t,{get:n[t],enumerable:!0,configurable:!0,set:Qb.bind(n,t)})};var Iu="0.1.0-beta.
|
|
2
|
+
var Gb=Object.defineProperty;var Hb=(e)=>e;function Qb(e,n){this[e]=Hb.bind(null,n)}var no=(e,n)=>{for(var t in n)Gb(e,t,{get:n[t],enumerable:!0,configurable:!0,set:Qb.bind(n,t)})};var Iu="0.1.0-beta.73";var rs=["en","zh-CN","zh-TW","ja","ko","ru","fr"],Cu="en";var ts=new Map(rs.map((e)=>[e.toLowerCase(),e])),Xb=new Set(["hk","mo","tw"]);function Ou(e){return typeof e=="string"&&ts.get(e.toLowerCase())==e}function to(e,n="en"){for(let t of e){let r=t==null?void 0:ew(t);if(r!=null)return r}return n}function ew(e){let n=e.trim().toLowerCase();if(n.length==0)return;let t=ts.get(n);if(t!=null)return t;let r=n.split("-");if(r[0]=="zh"){if(r.includes("hant"))return"zh-TW";if(r.includes("hans"))return"zh-CN";return r.some((o)=>Xb.has(o))?"zh-TW":"zh-CN"}return ts.get(r[0])}function Eu(e){return{en:"Imported workflow","zh-CN":"\u5BFC\u5165\u7684\u5DE5\u4F5C\u6D41","zh-TW":"\u532F\u5165\u7684\u5DE5\u4F5C\u6D41",ja:"\u30A4\u30F3\u30DD\u30FC\u30C8\u3057\u305F\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC",ko:"\uAC00\uC838\uC628 \uC6CC\uD06C\uD50C\uB85C",fr:"Workflow import\xE9",ru:"\u0418\u043C\u043F\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u043F\u0440\u043E\u0446\u0435\u0441\u0441"}[e]}import{spawn as IC}from"child_process";import{readFile as CC}from"fs/promises";import{setTimeout as OC}from"timers/promises";var ro="open-flow-engine/v7";var nw={waitAutoContinue:!0,webhookResponses:!0,platformExports:new Set(["engineContract","identity"]),platformModule:"open-flow:platform",platformSource:`export const engineContract = ${JSON.stringify("open-flow-engine/v7")}
|
|
3
3
|
export function identity(value) { return value }
|
|
4
4
|
`},AC={...nw,builtinModules:new Set(["assert","assert/strict","buffer","console","constants","crypto","events","fs","fs/promises","os","path","path/posix","process","punycode","querystring","stream","stream/promises","stream/web","string_decoder","timers","timers/promises","url","util","zlib"].flatMap((e)=>[e,`node:${e}`])),platformSource:`export const engineContract = ${JSON.stringify("open-flow-engine/v7/nodejs-compat-v1")}
|
|
5
5
|
export function identity(value) { return value }
|
|
@@ -11520,11 +11520,16 @@ function readResult(value, query = {}) {
|
|
|
11520
11520
|
offset,
|
|
11521
11521
|
value: selected
|
|
11522
11522
|
};
|
|
11523
|
-
if (offset == 0 && (query.limit == null || description.length == null || description.length <= limit) && bytes(whole) <= maxBytes) return whole;
|
|
11523
|
+
if (offset == 0 && (query.limit == null || description.length == null || description.length <= limit) && (typeof selected != "string" || selected.length <= maxBytes) && bytes(whole) <= maxBytes) return whole;
|
|
11524
11524
|
const root = description;
|
|
11525
11525
|
if (typeof selected == "string") {
|
|
11526
11526
|
let length = 0;
|
|
11527
|
-
|
|
11527
|
+
let start = 0;
|
|
11528
|
+
for (let index = 0; index < selected.length; length++) {
|
|
11529
|
+
if (length == offset) start = index;
|
|
11530
|
+
const point = selected.codePointAt(index);
|
|
11531
|
+
index += point > 65535 ? 2 : 1;
|
|
11532
|
+
}
|
|
11528
11533
|
if (offset >= length) throw new Error("Result offset is out of range.");
|
|
11529
11534
|
const budget = maxBytes - bytes({
|
|
11530
11535
|
...root,
|
|
@@ -11534,17 +11539,23 @@ function readResult(value, query = {}) {
|
|
|
11534
11539
|
nextOffset: length
|
|
11535
11540
|
});
|
|
11536
11541
|
let used = 0;
|
|
11537
|
-
let
|
|
11542
|
+
let cursor = start;
|
|
11538
11543
|
let end = offset;
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
|
|
11542
|
-
|
|
11544
|
+
while (cursor < selected.length) {
|
|
11545
|
+
const point = selected.codePointAt(cursor);
|
|
11546
|
+
let size;
|
|
11547
|
+
if (point == 34 || point == 92 || point == 8 || point == 9 || point == 10 || point == 12 || point == 13) size = 2;
|
|
11548
|
+
else if (point < 32 || point >= 55296 && point <= 57343) size = 6;
|
|
11549
|
+
else if (point < 128) size = 1;
|
|
11550
|
+
else if (point < 2048) size = 2;
|
|
11551
|
+
else if (point <= 65535) size = 3;
|
|
11552
|
+
else size = 4;
|
|
11543
11553
|
if (used + size > budget) break;
|
|
11544
|
-
|
|
11554
|
+
cursor += point > 65535 ? 2 : 1;
|
|
11545
11555
|
used += size;
|
|
11546
11556
|
end++;
|
|
11547
11557
|
}
|
|
11558
|
+
const text = selected.slice(start, cursor);
|
|
11548
11559
|
if (end == offset) throw new Error("Result byte budget cannot fit a string character and page metadata.");
|
|
11549
11560
|
return {
|
|
11550
11561
|
...root,
|
|
@@ -11559,6 +11570,13 @@ function readResult(value, query = {}) {
|
|
|
11559
11570
|
const keys = Object.keys(selected);
|
|
11560
11571
|
if (offset >= keys.length) throw new Error("Result offset is out of range.");
|
|
11561
11572
|
const entries = [];
|
|
11573
|
+
const overhead = bytes({
|
|
11574
|
+
...root,
|
|
11575
|
+
offset,
|
|
11576
|
+
entries: [],
|
|
11577
|
+
nextOffset: keys.length
|
|
11578
|
+
});
|
|
11579
|
+
let used = overhead;
|
|
11562
11580
|
for (const key of keys.slice(offset, offset + limit)) {
|
|
11563
11581
|
const path = `${pointer}/${key.replace(/~/g, "~0").replace(/\//g, "~1")}`;
|
|
11564
11582
|
const item = Array.isArray(selected) ? selected[Number(key)] : selected[key];
|
|
@@ -11568,19 +11586,12 @@ function readResult(value, query = {}) {
|
|
|
11568
11586
|
complete: true,
|
|
11569
11587
|
value: item
|
|
11570
11588
|
};
|
|
11571
|
-
const
|
|
11572
|
-
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
-
nextOffset: keys.length
|
|
11576
|
-
}) <= maxBytes ? full : metadata;
|
|
11577
|
-
if (bytes({
|
|
11578
|
-
...root,
|
|
11579
|
-
offset,
|
|
11580
|
-
entries: [...entries, next],
|
|
11581
|
-
nextOffset: keys.length
|
|
11582
|
-
}) > maxBytes) break;
|
|
11589
|
+
const fullBytes = bytes(full);
|
|
11590
|
+
const next = overhead + fullBytes <= maxBytes ? full : metadata;
|
|
11591
|
+
const size = (next === full ? fullBytes : bytes(metadata)) + (entries.length == 0 ? 0 : 1);
|
|
11592
|
+
if (used + size > maxBytes) break;
|
|
11583
11593
|
entries.push(next);
|
|
11594
|
+
used += size;
|
|
11584
11595
|
}
|
|
11585
11596
|
if (entries.length == 0) throw new Error("Result property name exceeds the preview limit. Download the full result.");
|
|
11586
11597
|
const end = offset + entries.length;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Graph, JsonValue } from '../browser/flow-change.js';
|
|
2
|
+
import type { DependenciesCheckpoint } from './scheduler-dependencies.js';
|
|
3
|
+
import type { ExecutableNode } from './scheduler-node-execution.js';
|
|
4
|
+
import type { AgentCheckpoint } from './runtime-contract.js';
|
|
5
|
+
export interface PendingWait {
|
|
6
|
+
readonly jobId: string;
|
|
7
|
+
readonly nodeId: string;
|
|
8
|
+
readonly value: JsonValue;
|
|
9
|
+
readonly waitId: string;
|
|
10
|
+
readonly pending?: JsonValue;
|
|
11
|
+
}
|
|
12
|
+
export interface PendingWorkflowCall {
|
|
13
|
+
readonly jobId: string;
|
|
14
|
+
readonly nodeId: string;
|
|
15
|
+
readonly childRunId: string;
|
|
16
|
+
readonly input: Readonly<Record<string, JsonValue>>;
|
|
17
|
+
}
|
|
18
|
+
export interface FlowRunCheckpoint {
|
|
19
|
+
readonly calls?: readonly PendingWorkflowCall[];
|
|
20
|
+
readonly bindingValues: Readonly<Record<string, string>>;
|
|
21
|
+
readonly inputs: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
|
|
22
|
+
readonly results: Readonly<Record<string, {
|
|
23
|
+
readonly handled?: true;
|
|
24
|
+
readonly jobId: string;
|
|
25
|
+
readonly outputs: Readonly<Record<string, JsonValue>>;
|
|
26
|
+
readonly systemOutputs?: Readonly<Record<string, JsonValue>>;
|
|
27
|
+
}>>;
|
|
28
|
+
readonly counts: Readonly<Record<string, Readonly<Record<string, number>>>>;
|
|
29
|
+
readonly dependencies: DependenciesCheckpoint;
|
|
30
|
+
readonly version: 6;
|
|
31
|
+
readonly waits: readonly PendingWait[];
|
|
32
|
+
readonly agents: Readonly<Record<string, {
|
|
33
|
+
readonly invocationId: string;
|
|
34
|
+
readonly input: Readonly<Record<string, JsonValue>>;
|
|
35
|
+
readonly remainingMs?: number;
|
|
36
|
+
readonly checkpoint: AgentCheckpoint;
|
|
37
|
+
}>>;
|
|
38
|
+
}
|
|
39
|
+
export declare function decodeFlowRunCheckpoint(input: unknown): FlowRunCheckpoint;
|
|
40
|
+
export declare function validateCheckpoint(target: {
|
|
41
|
+
readonly graph: Graph;
|
|
42
|
+
}, checkpoint: FlowRunCheckpoint, resolveInputs: (nodeId: string, node: ExecutableNode) => Readonly<Record<string, JsonValue>>): void;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { Graph, JsonValue } from '../browser/flow-change.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export interface DependenciesCheckpoint {
|
|
4
|
+
nextId: number;
|
|
5
|
+
iterations: Record<string, number>;
|
|
6
|
+
nodes: Record<string, DependencyState>;
|
|
7
|
+
}
|
|
8
|
+
interface DependencyState {
|
|
9
|
+
id: number;
|
|
10
|
+
status: 'pending' | 'running' | 'completed' | 'skipped';
|
|
11
|
+
input: Record<string, {
|
|
12
|
+
readonly execution: number;
|
|
13
|
+
readonly outputs: Readonly<Record<string, JsonValue>>;
|
|
14
|
+
readonly systemOutputs?: Readonly<Record<string, JsonValue>>;
|
|
15
|
+
}>;
|
|
16
|
+
systemOutputs?: Readonly<Record<string, JsonValue>>;
|
|
17
|
+
output?: Readonly<Record<string, JsonValue>>;
|
|
18
|
+
previous: string[];
|
|
19
|
+
released: string[];
|
|
20
|
+
jobId?: string;
|
|
21
|
+
seeded: boolean;
|
|
22
|
+
}
|
|
23
|
+
type InputSnapshot = DependenciesCheckpoint['nodes'][string]['input'];
|
|
24
|
+
export declare function dependencyValues(input: InputSnapshot): Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
|
|
25
|
+
export declare const dependenciesSchema: z.ZodObject<{
|
|
26
|
+
nextId: z.ZodNumber;
|
|
27
|
+
iterations: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
28
|
+
nodes: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
29
|
+
id: z.ZodNumber;
|
|
30
|
+
status: z.ZodEnum<{
|
|
31
|
+
completed: "completed";
|
|
32
|
+
pending: "pending";
|
|
33
|
+
running: "running";
|
|
34
|
+
skipped: "skipped";
|
|
35
|
+
}>;
|
|
36
|
+
input: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
37
|
+
execution: z.ZodNumber;
|
|
38
|
+
outputs: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
39
|
+
systemOutputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
40
|
+
}, z.core.$strict>>;
|
|
41
|
+
output: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
42
|
+
systemOutputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
43
|
+
previous: z.ZodArray<z.ZodString>;
|
|
44
|
+
released: z.ZodArray<z.ZodString>;
|
|
45
|
+
jobId: z.ZodOptional<z.ZodString>;
|
|
46
|
+
seeded: z.ZodBoolean;
|
|
47
|
+
}, z.core.$strict>>;
|
|
48
|
+
}, z.core.$strict>;
|
|
49
|
+
/** Dependency completion belongs to an invocation, never to a Run-wide latest-result table. */
|
|
50
|
+
export declare class Dependencies {
|
|
51
|
+
readonly state: DependenciesCheckpoint;
|
|
52
|
+
private readonly forward;
|
|
53
|
+
private readonly loops;
|
|
54
|
+
private readonly innerLoopsFirst;
|
|
55
|
+
private readonly outgoing;
|
|
56
|
+
private readonly incoming;
|
|
57
|
+
private readonly candidates;
|
|
58
|
+
private readonly frames;
|
|
59
|
+
private readonly graph;
|
|
60
|
+
constructor(graph: Graph, saved?: DependenciesCheckpoint);
|
|
61
|
+
private fresh;
|
|
62
|
+
private validate;
|
|
63
|
+
start(nodeId: string, outputs: Readonly<Record<string, JsonValue>>): void;
|
|
64
|
+
private edge;
|
|
65
|
+
private edgeResult;
|
|
66
|
+
input(nodeId: string, sourceId: string): InputSnapshot[string] | undefined;
|
|
67
|
+
private snapshot;
|
|
68
|
+
private collectInputs;
|
|
69
|
+
private loopSettled;
|
|
70
|
+
private blockedByLoop;
|
|
71
|
+
private continuationPending;
|
|
72
|
+
private selectedIncoming;
|
|
73
|
+
private readyAcyclic;
|
|
74
|
+
/** Resolve skips and iteration boundaries before admitting another invocation. */
|
|
75
|
+
ready(): string[];
|
|
76
|
+
begin(nodeId: string, jobId: string): void;
|
|
77
|
+
release(nodeId: string, outputs: Readonly<Record<string, JsonValue>>, handles: readonly string[], complete: boolean, systemOutputs?: Readonly<Record<string, JsonValue>>): void;
|
|
78
|
+
get incomplete(): boolean;
|
|
79
|
+
}
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { AgentConfig } from './flow-agent.js';
|
|
2
|
+
import type { Graph, GraphNode, JsonValue, TriggerNode } from '../browser/flow-change.js';
|
|
3
|
+
import type { WebhookResponseSnapshot } from './webhook-response.js';
|
|
4
|
+
import type { FlowRunCheckpoint } from './scheduler-checkpoint.js';
|
|
5
|
+
import type { Dependencies } from './scheduler-dependencies.js';
|
|
6
|
+
import type { AgentCheckpoint } from './runtime-contract.js';
|
|
7
|
+
import type { FlowRunOptions, SchedulerEvent, SchedulerFailure } from './scheduler.js';
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
interface NodeExecutionContext {
|
|
11
|
+
readonly createId: FlowRunOptions['createId'];
|
|
12
|
+
readonly emit: (event: SchedulerEvent) => Effect.Effect<void, Error>;
|
|
13
|
+
readonly invokeTask: FlowRunOptions['invokeTask'];
|
|
14
|
+
readonly projectFailure: FlowRunOptions['projectFailure'];
|
|
15
|
+
}
|
|
16
|
+
export declare class PortValidationError extends Error {
|
|
17
|
+
}
|
|
18
|
+
export type ExecutableNode = Exclude<GraphNode, TriggerNode>;
|
|
19
|
+
export declare function usesPending(graph: Graph, nodeId: string): boolean;
|
|
20
|
+
export declare class NodeValidationError extends PortValidationError {
|
|
21
|
+
readonly code: 'node.input-invalid' | 'node.output-invalid' | 'webhook.response-status-invalid' | 'webhook.response-headers-invalid';
|
|
22
|
+
constructor(code: NodeValidationError['code'], error: unknown);
|
|
23
|
+
}
|
|
24
|
+
export declare function nodeFailure(error: unknown, project: FlowRunOptions['projectFailure']): SchedulerFailure;
|
|
25
|
+
export declare function nodeTitle(node: GraphNode): string | undefined;
|
|
26
|
+
export declare function jsonValue(value: unknown, description: string, depth?: number): JsonValue;
|
|
27
|
+
export declare const agentCheckpointSchema: z.ZodObject<{
|
|
28
|
+
state: z.ZodJSONSchema;
|
|
29
|
+
callId: z.ZodString;
|
|
30
|
+
toolId: z.ZodString;
|
|
31
|
+
input: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
32
|
+
rounds: z.ZodNumber;
|
|
33
|
+
version: z.ZodLiteral<1>;
|
|
34
|
+
}, z.core.$strict>;
|
|
35
|
+
export declare function jsonEqual(left: JsonValue, right: JsonValue): boolean;
|
|
36
|
+
export declare function outputRecord(value: unknown, nodeId: string): Readonly<Record<string, JsonValue>>;
|
|
37
|
+
export declare function agentConfig(node: ExecutableNode): AgentConfig | undefined;
|
|
38
|
+
export declare function agentNotice(node: ExecutableNode, values: Readonly<Record<string, JsonValue>>): {
|
|
39
|
+
messageHandle: string;
|
|
40
|
+
input: {
|
|
41
|
+
[k: string]: JsonValue;
|
|
42
|
+
};
|
|
43
|
+
} | undefined;
|
|
44
|
+
export declare function agentApproval(config: AgentConfig, checkpoint: AgentCheckpoint, inputs: Readonly<Record<string, JsonValue>>): JsonValue;
|
|
45
|
+
export declare function validateOutputs(nodeId: string, node: ExecutableNode, value: unknown): Readonly<Record<string, JsonValue>>;
|
|
46
|
+
export type NodeResult = {
|
|
47
|
+
readonly kind: 'calling';
|
|
48
|
+
readonly childRunId: string;
|
|
49
|
+
readonly input: Readonly<Record<string, JsonValue>>;
|
|
50
|
+
} | {
|
|
51
|
+
readonly kind: 'completed';
|
|
52
|
+
readonly releasedHandles?: readonly string[];
|
|
53
|
+
readonly outputs: Readonly<Record<string, JsonValue>>;
|
|
54
|
+
readonly response?: WebhookResponseSnapshot;
|
|
55
|
+
} | {
|
|
56
|
+
readonly kind: 'suspended';
|
|
57
|
+
readonly value: JsonValue;
|
|
58
|
+
readonly agent: FlowRunCheckpoint['agents'][string];
|
|
59
|
+
};
|
|
60
|
+
export declare function resolveNodeInputs(nodeId: string, node: ExecutableNode, dependencies: Pick<Dependencies, 'input'>, bindingValues: Readonly<Record<string, string>>, launchInputs?: Readonly<Record<string, JsonValue>>): Readonly<Record<string, JsonValue>>;
|
|
61
|
+
export declare function executeNode(context: NodeExecutionContext, input: {
|
|
62
|
+
readonly nodeId: string;
|
|
63
|
+
readonly node: ExecutableNode;
|
|
64
|
+
readonly jobId: string;
|
|
65
|
+
readonly nodeInputs: Readonly<Record<string, JsonValue>>;
|
|
66
|
+
readonly flowId: string;
|
|
67
|
+
readonly runId: string;
|
|
68
|
+
readonly graph: Graph;
|
|
69
|
+
readonly dependencies: Pick<Dependencies, 'input'>;
|
|
70
|
+
readonly previousIds: readonly string[];
|
|
71
|
+
readonly saved?: FlowRunCheckpoint['agents'][string];
|
|
72
|
+
readonly workflowRunId?: string;
|
|
73
|
+
readonly resolution?: 'approve' | 'reject';
|
|
74
|
+
}): Effect.Effect<NodeResult, Error>;
|
|
75
|
+
export {};
|
|
@@ -2,8 +2,13 @@ import type { ConnectorCapability, JsonValue, WaitAction, WaitAutoContinue } fro
|
|
|
2
2
|
import type { PreparedFlow } from './flow-semantics.js';
|
|
3
3
|
import type { WebhookResponseSnapshot } from './webhook-response.js';
|
|
4
4
|
import type { PreviousNode } from '../index.js';
|
|
5
|
+
import type { FlowRunCheckpoint } from './scheduler-checkpoint.js';
|
|
5
6
|
import type { AgentCheckpoint } from './runtime-contract.js';
|
|
6
7
|
import * as Effect from 'effect/Effect';
|
|
8
|
+
export type { DependenciesCheckpoint } from './scheduler-dependencies.js';
|
|
9
|
+
export type { FlowRunCheckpoint, PendingWait, PendingWorkflowCall } from './scheduler-checkpoint.js';
|
|
10
|
+
export { decodeFlowRunCheckpoint } from './scheduler-checkpoint.js';
|
|
11
|
+
export { PortValidationError } from './scheduler-node-execution.js';
|
|
7
12
|
export declare const withWaitNotificationMessage: (value: JsonValue) => JsonValue;
|
|
8
13
|
export declare const normalizeWaitComment: (value?: string | null) => string | null;
|
|
9
14
|
export declare const waitAutoContinueAt: (config: WaitAutoContinue, waitingSince: number) => number;
|
|
@@ -12,8 +17,6 @@ export interface WaitResolution {
|
|
|
12
17
|
readonly resolvedAt: string;
|
|
13
18
|
readonly comment: string | null;
|
|
14
19
|
}
|
|
15
|
-
export declare class PortValidationError extends Error {
|
|
16
|
-
}
|
|
17
20
|
export type SchedulerEvent = {
|
|
18
21
|
readonly flowId: string;
|
|
19
22
|
readonly parentJobId?: string;
|
|
@@ -81,13 +84,6 @@ export interface FlowRunResult {
|
|
|
81
84
|
readonly outputs: Readonly<Record<string, JsonValue>>;
|
|
82
85
|
}[];
|
|
83
86
|
}
|
|
84
|
-
export interface PendingWait {
|
|
85
|
-
readonly jobId: string;
|
|
86
|
-
readonly nodeId: string;
|
|
87
|
-
readonly value: JsonValue;
|
|
88
|
-
readonly waitId: string;
|
|
89
|
-
readonly pending?: JsonValue;
|
|
90
|
-
}
|
|
91
87
|
export interface WaitRequest {
|
|
92
88
|
readonly autoContinue?: WaitAutoContinue;
|
|
93
89
|
readonly jobId: string;
|
|
@@ -115,53 +111,6 @@ export interface WaitHost {
|
|
|
115
111
|
readonly resolutions: (waitIds: readonly string[], block: boolean) => Effect.Effect<Readonly<Record<string, WaitResolution>>, Error>;
|
|
116
112
|
}
|
|
117
113
|
export declare const waitRetentionMs = 120000;
|
|
118
|
-
export interface DependenciesCheckpoint {
|
|
119
|
-
nextId: number;
|
|
120
|
-
iterations: Record<string, number>;
|
|
121
|
-
nodes: Record<string, DependencyState>;
|
|
122
|
-
}
|
|
123
|
-
interface DependencyState {
|
|
124
|
-
id: number;
|
|
125
|
-
status: 'pending' | 'running' | 'completed' | 'skipped';
|
|
126
|
-
input: Record<string, {
|
|
127
|
-
readonly execution: number;
|
|
128
|
-
readonly outputs: Readonly<Record<string, JsonValue>>;
|
|
129
|
-
readonly systemOutputs?: Readonly<Record<string, JsonValue>>;
|
|
130
|
-
}>;
|
|
131
|
-
systemOutputs?: Readonly<Record<string, JsonValue>>;
|
|
132
|
-
output?: Readonly<Record<string, JsonValue>>;
|
|
133
|
-
previous: string[];
|
|
134
|
-
released: string[];
|
|
135
|
-
jobId?: string;
|
|
136
|
-
seeded: boolean;
|
|
137
|
-
}
|
|
138
|
-
export interface PendingWorkflowCall {
|
|
139
|
-
readonly jobId: string;
|
|
140
|
-
readonly nodeId: string;
|
|
141
|
-
readonly childRunId: string;
|
|
142
|
-
readonly input: Readonly<Record<string, JsonValue>>;
|
|
143
|
-
}
|
|
144
|
-
export interface FlowRunCheckpoint {
|
|
145
|
-
readonly calls?: readonly PendingWorkflowCall[];
|
|
146
|
-
readonly bindingValues: Readonly<Record<string, string>>;
|
|
147
|
-
readonly inputs: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
|
|
148
|
-
readonly results: Readonly<Record<string, {
|
|
149
|
-
readonly handled?: true;
|
|
150
|
-
readonly jobId: string;
|
|
151
|
-
readonly outputs: Readonly<Record<string, JsonValue>>;
|
|
152
|
-
readonly systemOutputs?: Readonly<Record<string, JsonValue>>;
|
|
153
|
-
}>>;
|
|
154
|
-
readonly counts: Readonly<Record<string, Readonly<Record<string, number>>>>;
|
|
155
|
-
readonly dependencies: DependenciesCheckpoint;
|
|
156
|
-
readonly version: 6;
|
|
157
|
-
readonly waits: readonly PendingWait[];
|
|
158
|
-
readonly agents: Readonly<Record<string, {
|
|
159
|
-
readonly invocationId: string;
|
|
160
|
-
readonly input: Readonly<Record<string, JsonValue>>;
|
|
161
|
-
readonly remainingMs?: number;
|
|
162
|
-
readonly checkpoint: AgentCheckpoint;
|
|
163
|
-
}>>;
|
|
164
|
-
}
|
|
165
114
|
export type FlowRunOutcome = FlowRunResult | {
|
|
166
115
|
readonly checkpoint: FlowRunCheckpoint;
|
|
167
116
|
readonly kind: 'waiting';
|
|
@@ -223,6 +172,4 @@ export type RunLaunch = {
|
|
|
223
172
|
readonly inputs?: never;
|
|
224
173
|
readonly trigger?: never;
|
|
225
174
|
};
|
|
226
|
-
export declare function decodeFlowRunCheckpoint(input: unknown): FlowRunCheckpoint;
|
|
227
175
|
export declare function runFlow(prepared: PreparedFlow, options: FlowRunOptions): Effect.Effect<FlowRunOutcome, Error>;
|
|
228
|
-
export {};
|