@oomol-lab/open-flow 0.1.0-beta.3 → 0.1.0-beta.5

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.
Files changed (47) hide show
  1. package/dist/browser/DesignerIcon-XKBRy_0Q.js +2066 -0
  2. package/dist/browser/{createResourceDialog-BkZns-oZ.js → createResourceDialog-Cf7QpXp6.js} +161 -160
  3. package/dist/browser/{dist-BMqL-qR5.js → dist-BMRLCebL.js} +291 -292
  4. package/dist/browser/{dist-DWADUsVB.js → dist-By46o5UV.js} +47 -47
  5. package/dist/browser/{dist-CJpzJrLM.js → dist-Cc0y2Pli.js} +811 -812
  6. package/dist/browser/{dist-DUzA0Ukh.js → dist-Dg_VXC8f.js} +134 -135
  7. package/dist/browser/{dist-3Mj8q8Pr.js → dist-DmuE3M0R.js} +53 -54
  8. package/dist/browser/{dist-BN4ZCyOB.js → dist-DpDLsYtO.js} +14 -15
  9. package/dist/browser/dist-DxahK_I8.js +2688 -0
  10. package/dist/browser/{dist-CPuF50D9.js → dist-meg_oHVR.js} +335 -335
  11. package/dist/browser/{esm-C2UUqIUP.js → esm-xWDFFpGd.js} +5 -6
  12. package/dist/browser/flow-authoring-module.d.ts +2 -2
  13. package/dist/browser/flow-authoring-node.d.ts +5 -2
  14. package/dist/browser/flow-authoring.d.ts +1 -1
  15. package/dist/browser/flow-authoring.js +489 -209
  16. package/dist/browser/flow-change.d.ts +110 -9
  17. package/dist/browser/flow-change.js +319 -96
  18. package/dist/browser/flow-notifications.d.ts +5 -0
  19. package/dist/browser/{diagnostics-SDCyFuxm.js → flowChanges-CeMiiZIO.js} +4234 -3825
  20. package/dist/browser/{flowRunInputEditorStore-CwvOiIiU.js → flowRunInputEditorStore-DDidwd8h.js} +10 -2
  21. package/dist/browser/{flowWorkspace-BZ_eiQNR.js → flowWorkspace-VnS8nLMT.js} +35268 -35081
  22. package/dist/browser/{getPseudoElementBounds-ESJExRFX.js → getPseudoElementBounds-5LArT6Xc.js} +1827 -2322
  23. package/dist/browser/icons-CRxvozBE.js +726 -0
  24. package/dist/browser/{typeScriptSession-mPCiA9sV.js → typeScriptSession-Bj2HDFRd.js} +256 -257
  25. package/dist/browser/waitNotificationInputs-ClCAEIAM.js +26 -0
  26. package/dist/browser/workbench.css +1 -1
  27. package/dist/browser/workbench.d.ts +1 -0
  28. package/dist/browser/workbench.js +851 -840
  29. package/dist/browser/{workbenchSelect-B2s1HV-Y.js → workbenchSelect-Cf1zlVm9.js} +479 -478
  30. package/dist/common/control-api-conformance.d.ts +1 -0
  31. package/dist/common/control-api-conformance.js +80 -19
  32. package/dist/common/control-api-errors.d.ts +4 -0
  33. package/dist/common/control-api.d.ts +26 -14
  34. package/dist/common/control-api.js +138 -89
  35. package/dist/common/flow-encoding.js +20 -8
  36. package/dist/common/flow-notifications.d.ts +5 -0
  37. package/dist/common/flow-semantics.d.ts +1 -0
  38. package/dist/common/flow-semantics.js +467 -381
  39. package/dist/common/run-events.js +2 -1
  40. package/dist/common/run-lifecycle.d.ts +17 -2
  41. package/dist/common/run-lifecycle.js +53 -2
  42. package/dist/common/scheduler.d.ts +64 -3
  43. package/dist/common/scheduler.js +417 -142
  44. package/dist/index.d.ts +1 -0
  45. package/package.json +1 -1
  46. package/dist/browser/dist-BpopSHwP.js +0 -1543
  47. package/dist/browser/dist-CUSrALSX.js +0 -1620
@@ -5,7 +5,8 @@ var e = new TextEncoder(), t = /* @__PURE__ */ new Set([
5
5
  "javascript",
6
6
  "llm",
7
7
  "subflow",
8
- "value"
8
+ "value",
9
+ "wait"
9
10
  ]);
10
11
  function n(e, t) {
11
12
  if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError(`${t} must be an object.`);
@@ -1,11 +1,15 @@
1
1
  export declare const runTerminalStatuses: readonly ['canceled', 'completed', 'failed', 'indeterminate'];
2
- export declare const runStatuses: readonly ["canceled", "completed", "failed", "indeterminate", "queued", "running", "starting"];
2
+ export declare const runStatuses: readonly ["canceled", "completed", "failed", "indeterminate", "queued", "running", "starting", "waiting"];
3
3
  export type RunStatus = (typeof runStatuses)[number];
4
4
  export type RunTerminalStatus = (typeof runTerminalStatuses)[number];
5
5
  export type RunOperation = {
6
6
  readonly kind: 'claim';
7
7
  } | {
8
8
  readonly kind: 'start';
9
+ } | {
10
+ readonly kind: 'wait';
11
+ } | {
12
+ readonly kind: 'resolve';
9
13
  } | {
10
14
  readonly kind: 'commit';
11
15
  readonly status: RunTerminalStatus;
@@ -16,6 +20,9 @@ export type RunTransition = {
16
20
  } | {
17
21
  readonly kind: 'running';
18
22
  readonly status: 'running';
23
+ } | {
24
+ readonly kind: 'waiting';
25
+ readonly status: 'waiting';
19
26
  } | {
20
27
  readonly kind: 'terminal';
21
28
  readonly status: RunTerminalStatus;
@@ -28,12 +35,18 @@ export type RunTransition = {
28
35
  } | {
29
36
  readonly kind: 'committed';
30
37
  readonly status: RunTerminalStatus;
38
+ } | {
39
+ readonly kind: 'waited';
40
+ readonly status: 'waiting';
41
+ } | {
42
+ readonly kind: 'resolved';
43
+ readonly status: 'queued';
31
44
  } | {
32
45
  readonly kind: 'stale';
33
46
  readonly status: RunStatus;
34
47
  };
35
48
  export type RunClaim = Extract<RunTransition, {
36
- readonly kind: 'ready' | 'running' | 'terminal';
49
+ readonly kind: 'ready' | 'running' | 'terminal' | 'waiting';
37
50
  }>;
38
51
  export type RunStart = Extract<RunTransition, {
39
52
  readonly kind: 'already-started' | 'started' | 'stale';
@@ -60,7 +73,9 @@ export interface RunLifecycleHarness {
60
73
  claim(runId: string): Promise<RunClaim>;
61
74
  commit(runId: string, status: RunTerminalStatus): Promise<boolean>;
62
75
  observe(runId: string): Promise<RunObservation>;
76
+ resolve(runId: string): Promise<boolean>;
63
77
  start(runId: string): Promise<RunStart>;
78
+ wait(runId: string): Promise<boolean>;
64
79
  }
65
80
  export interface RunLifecycleConformanceCase {
66
81
  readonly name: string;
@@ -28,7 +28,8 @@ var n = [
28
28
  ...n,
29
29
  "queued",
30
30
  "running",
31
- "starting"
31
+ "starting",
32
+ "waiting"
32
33
  ];
33
34
  function i(e) {
34
35
  return e == "canceled" || e == "completed" || e == "failed" || e == "indeterminate";
@@ -45,6 +46,10 @@ function a(e, t) {
45
46
  kind: "running",
46
47
  status: e
47
48
  };
49
+ case "waiting": return {
50
+ kind: "waiting",
51
+ status: e
52
+ };
48
53
  case "canceled":
49
54
  case "completed":
50
55
  case "failed":
@@ -63,6 +68,7 @@ function a(e, t) {
63
68
  status: e
64
69
  };
65
70
  case "queued":
71
+ case "waiting":
66
72
  case "canceled":
67
73
  case "completed":
68
74
  case "failed":
@@ -71,10 +77,24 @@ function a(e, t) {
71
77
  status: e
72
78
  };
73
79
  }
80
+ case "wait": return e == "running" ? {
81
+ kind: "waited",
82
+ status: "waiting"
83
+ } : {
84
+ kind: "stale",
85
+ status: e
86
+ };
87
+ case "resolve": return e == "waiting" ? {
88
+ kind: "resolved",
89
+ status: "queued"
90
+ } : {
91
+ kind: "stale",
92
+ status: e
93
+ };
74
94
  case "commit": return i(e) ? {
75
95
  kind: "stale",
76
96
  status: e
77
- } : t.status == "canceled" || e == "running" ? {
97
+ } : t.status == "canceled" || e == "running" || t.status == "failed" && e == "waiting" ? {
78
98
  kind: "committed",
79
99
  status: t.status
80
100
  } : {
@@ -95,6 +115,37 @@ async function s(e, t = "request", n = "request-a") {
95
115
  return r.runId;
96
116
  }
97
117
  var c = [
118
+ {
119
+ name: "pauses and resumes the same Run through the ordinary start barrier",
120
+ async verify(e) {
121
+ let t = await s(e), n = await e.claim(t);
122
+ if (n.kind != "ready") throw Error("Initial Run claim was not ready.");
123
+ o(await e.start(t), a(n.status, { kind: "start" }), "Initial start"), o(await e.wait(t), !0, "Wait commit"), o(await e.observe(t), {
124
+ status: "waiting",
125
+ terminalEvents: []
126
+ }, "Waiting Run observation"), o(await e.claim(t), a("waiting", { kind: "claim" }), "Claim while waiting"), o(await e.resolve(t), !0, "Wait resolution"), o(await e.resolve(t), !1, "Repeated Wait resolution");
127
+ let r = await e.claim(t);
128
+ if (r.kind != "ready") throw Error("Resolved Run claim was not ready.");
129
+ o(await e.start(t), a(r.status, { kind: "start" }), "Resume start"), o(await e.commit(t, "completed"), !0, "Completion after resume"), o(await e.observe(t), {
130
+ status: "completed",
131
+ terminalEvents: ["completed"]
132
+ }, "Resumed Run observation");
133
+ }
134
+ },
135
+ {
136
+ name: "allows cancellation and expiry failure while waiting",
137
+ async verify(e) {
138
+ let t = await s(e, "cancel-wait");
139
+ if ((await e.claim(t)).kind != "ready") throw Error("Canceled Run claim was not ready.");
140
+ await e.start(t), o(await e.wait(t), !0, "Canceled Run Wait commit"), o(await e.commit(t, "canceled"), !0, "Waiting cancellation"), o(await e.resolve(t), !1, "Resolution after cancellation");
141
+ let n = await s(e, "expire-wait");
142
+ if ((await e.claim(n)).kind != "ready") throw Error("Expired Run claim was not ready.");
143
+ await e.start(n), o(await e.wait(n), !0, "Expired Run Wait commit"), o(await e.commit(n, "failed"), !0, "Waiting expiry failure"), o(await e.observe(n), {
144
+ status: "failed",
145
+ terminalEvents: ["failed"]
146
+ }, "Expired Run observation");
147
+ }
148
+ },
98
149
  {
99
150
  name: "replays idempotent acceptance and rejects a conflicting request",
100
151
  async verify(e) {
@@ -1,4 +1,4 @@
1
- import type { ConnectorCapability, JsonValue } from '../browser/flow-change.js';
1
+ import type { ConnectorCapability, JsonValue, WaitAction } from '../browser/flow-change.js';
2
2
  import type { PreparedFlow } from './flow-semantics.js';
3
3
  import * as Effect from 'effect/Effect';
4
4
  export type SchedulerEvent = {
@@ -17,7 +17,7 @@ export type SchedulerEvent = {
17
17
  readonly inputs: Readonly<Record<string, JsonValue>>;
18
18
  readonly jobId: string;
19
19
  readonly nodeId: string;
20
- readonly nodeKind: 'condition' | 'connector' | 'javascript' | 'llm' | 'subflow' | 'value';
20
+ readonly nodeKind: 'condition' | 'connector' | 'javascript' | 'llm' | 'subflow' | 'value' | 'wait';
21
21
  readonly nodeTitle?: string;
22
22
  readonly runId: string;
23
23
  readonly type: 'node.started';
@@ -40,6 +40,13 @@ export type SchedulerEvent = {
40
40
  readonly nodeId: string;
41
41
  readonly runId: string;
42
42
  readonly type: 'node.failed';
43
+ } | {
44
+ readonly jobId: string;
45
+ readonly level: 'debug' | 'error' | 'info' | 'warn';
46
+ readonly message: string;
47
+ readonly nodeId: string;
48
+ readonly runId: string;
49
+ readonly type: 'node.log';
43
50
  } | {
44
51
  readonly result: FlowRunResult | SubflowRunResult;
45
52
  readonly runId: string;
@@ -59,12 +66,61 @@ export interface FlowRunResult {
59
66
  readonly nodeId: string;
60
67
  }[];
61
68
  }
69
+ export interface FlowRunCheckpoint {
70
+ readonly bindingValues: Readonly<Record<string, string>>;
71
+ readonly buffers: Readonly<Record<string, {
72
+ readonly slots: Readonly<Record<string, {
73
+ readonly provided: boolean;
74
+ readonly queue: readonly JsonValue[];
75
+ readonly value: JsonValue;
76
+ }>>;
77
+ readonly staticTaken: boolean;
78
+ }>>;
79
+ readonly completedNodes: readonly string[];
80
+ readonly nextJobs: Readonly<Record<string, number>>;
81
+ readonly outputs: Readonly<Record<string, JsonValue>>;
82
+ readonly results: readonly {
83
+ readonly jobs: readonly {
84
+ readonly jobId: string;
85
+ readonly order: number;
86
+ readonly outputs: Readonly<Record<string, JsonValue>>;
87
+ }[];
88
+ readonly nodeId: string;
89
+ }[];
90
+ readonly version: 1;
91
+ readonly wait: {
92
+ readonly jobId: string;
93
+ readonly nodeId: string;
94
+ readonly order: number;
95
+ readonly value: JsonValue;
96
+ readonly waitId: string;
97
+ };
98
+ }
99
+ export type FlowRunOutcome = FlowRunResult | {
100
+ readonly checkpoint: FlowRunCheckpoint;
101
+ readonly kind: 'waiting';
102
+ readonly notification?: {
103
+ readonly input: Readonly<Record<string, JsonValue>>;
104
+ readonly messageHandle: string;
105
+ readonly taskId: string;
106
+ };
107
+ readonly wait: {
108
+ readonly actions: readonly ['continue'] | readonly ['approve', 'reject'];
109
+ readonly jobId: string;
110
+ readonly nodeId: string;
111
+ readonly order: number;
112
+ readonly waitId: string;
113
+ };
114
+ };
62
115
  export interface SubflowRunResult {
63
116
  readonly kind: 'function-outputs';
64
117
  readonly outputs: Readonly<Record<string, JsonValue>>;
65
118
  readonly target: 'subflow';
66
119
  }
67
120
  interface TaskInvocationBase {
121
+ readonly additionalInputs: Readonly<Record<string, JsonValue>>;
122
+ readonly blockId: string;
123
+ readonly flowId: string;
68
124
  readonly input: Readonly<Record<string, JsonValue>>;
69
125
  readonly invocationId: string;
70
126
  readonly jobId: string;
@@ -93,8 +149,13 @@ export interface FlowRunOptions {
93
149
  readonly inputs?: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
94
150
  readonly invokeTask: (invocation: TaskInvocation) => Effect.Effect<unknown, Error>;
95
151
  readonly projectFailure?: (error: unknown) => SchedulerFailure;
152
+ readonly resume?: {
153
+ readonly action: WaitAction;
154
+ readonly checkpoint: unknown;
155
+ };
96
156
  readonly runId: string;
97
157
  readonly trigger?: TriggerSeed;
98
158
  }
99
- export declare function runFlow(prepared: PreparedFlow, options: FlowRunOptions): Effect.Effect<FlowRunResult, Error>;
159
+ export declare function decodeFlowRunCheckpoint(value: unknown): FlowRunCheckpoint;
160
+ export declare function runFlow(prepared: PreparedFlow, options: FlowRunOptions): Effect.Effect<FlowRunOutcome, Error>;
100
161
  export {};