@oomol-lab/open-flow 0.1.0-beta.1 → 0.1.0-beta.10

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 (54) hide show
  1. package/dist/browser/DesignerIcon-DjgOMYI5.js +2065 -0
  2. package/dist/browser/{createResourceDialog-DXQz0thK.js → createResourceDialog-DNBueSYZ.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-CP0883sY.js +4 -0
  6. package/dist/browser/{dist-CJpzJrLM.js → dist-Cc0y2Pli.js} +811 -812
  7. package/dist/browser/{dist-DUzA0Ukh.js → dist-Dg_VXC8f.js} +134 -135
  8. package/dist/browser/{dist-3Mj8q8Pr.js → dist-DmuE3M0R.js} +53 -54
  9. package/dist/browser/{dist-BN4ZCyOB.js → dist-DpDLsYtO.js} +14 -15
  10. package/dist/browser/dist-DxahK_I8.js +2688 -0
  11. package/dist/browser/{dist-CPuF50D9.js → dist-meg_oHVR.js} +335 -335
  12. package/dist/browser/{esm-DGQbgYoJ.js → esm-yhVU_KbQ.js} +5 -6
  13. package/dist/browser/flow-authoring-module.d.ts +2 -2
  14. package/dist/browser/flow-authoring-node.d.ts +6 -3
  15. package/dist/browser/flow-authoring.d.ts +1 -1
  16. package/dist/browser/flow-authoring.js +509 -209
  17. package/dist/browser/flow-change.d.ts +113 -9
  18. package/dist/browser/flow-change.js +323 -96
  19. package/dist/browser/flow-notifications.d.ts +5 -0
  20. package/dist/browser/flowChanges-B2ttnaj9.js +12265 -0
  21. package/dist/browser/{flowRunInputEditorStore-BeyUSWpO.js → flowRunInputEditorStore-DDidwd8h.js} +728 -719
  22. package/dist/browser/{flowWorkspace-DwyxAOBH.js → flowWorkspace-Dr8-Hut9.js} +40821 -42895
  23. package/dist/browser/{getPseudoElementBounds-ESJExRFX.js → getPseudoElementBounds-5LArT6Xc.js} +1827 -2322
  24. package/dist/browser/icons-KIOgjHpD.js +730 -0
  25. package/dist/browser/{markdownContent-DdlIRN3_.js → markdownContent-DUfLdnUt.js} +1 -1
  26. package/dist/browser/{typeScriptSession-mPCiA9sV.js → typeScriptSession-_TgJ_7Oq.js} +256 -257
  27. package/dist/browser/waitNotificationInputs-BPulOxYt.js +26 -0
  28. package/dist/browser/workbench.css +1 -1
  29. package/dist/browser/workbench.d.ts +3 -1
  30. package/dist/browser/workbench.js +1136 -1038
  31. package/dist/browser/{workbenchSelect-B2s1HV-Y.js → workbenchSelect-CbXrdwxW.js} +479 -478
  32. package/dist/common/control-api-conformance.d.ts +1 -0
  33. package/dist/common/control-api-conformance.js +126 -47
  34. package/dist/common/control-api-errors.d.ts +12 -0
  35. package/dist/common/control-api.d.ts +60 -15
  36. package/dist/common/control-api.js +225 -101
  37. package/dist/common/flow-encoding.js +24 -8
  38. package/dist/common/flow-notifications.d.ts +5 -0
  39. package/dist/common/flow-semantics.d.ts +1 -0
  40. package/dist/common/flow-semantics.js +3464 -1113
  41. package/dist/common/integration-trigger.d.ts +1 -0
  42. package/dist/common/provider-triggers.js +4 -1
  43. package/dist/common/run-events.js +2 -1
  44. package/dist/common/run-lifecycle.d.ts +17 -2
  45. package/dist/common/run-lifecycle.js +53 -2
  46. package/dist/common/runtime-contract.d.ts +1 -1
  47. package/dist/common/runtime-contract.js +27 -0
  48. package/dist/common/scheduler.d.ts +65 -4
  49. package/dist/common/scheduler.js +420 -146
  50. package/dist/index.d.ts +2 -1
  51. package/package.json +1 -1
  52. package/dist/browser/diagnostics-BGoGFvHA.js +0 -9237
  53. package/dist/browser/dist-BpopSHwP.js +0 -1543
  54. package/dist/browser/dist-CUSrALSX.js +0 -1620
@@ -48,6 +48,7 @@ export interface IntegrationReconcileContext {
48
48
  readonly config: Readonly<Record<string, JsonValue>>;
49
49
  readonly connector: ConnectorProxy;
50
50
  readonly endpointUrl: string;
51
+ readonly idempotencyKey: string;
51
52
  readonly now: Date;
52
53
  readonly signal?: AbortSignal;
53
54
  readonly state?: IntegrationStateContext;
@@ -3923,7 +3923,10 @@ var ci = 300, H = "/v1/webhook_endpoints", li = { "Content-Type": "application/x
3923
3923
  let t = await U(e, "endpoint create", {
3924
3924
  body: fi(e.endpointUrl, n),
3925
3925
  endpoint: H,
3926
- headers: li,
3926
+ headers: {
3927
+ ...li,
3928
+ "Idempotency-Key": e.idempotencyKey
3929
+ },
3927
3930
  method: "POST"
3928
3931
  });
3929
3932
  W(t, "endpoint create");
@@ -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) {
@@ -44,7 +44,7 @@ export interface RuntimeInvocation {
44
44
  }
45
45
  export interface RuntimeHarness {
46
46
  readonly engineDigest: string;
47
- invoke(invocation: RuntimeInvocation): Promise<JsonValue>;
47
+ invoke(invocation: RuntimeInvocation): Promise<JsonValue | undefined>;
48
48
  }
49
49
  export interface RuntimeConformanceCase {
50
50
  readonly name: string;
@@ -129,6 +129,33 @@ var c = [
129
129
  }], "Capability request");
130
130
  }
131
131
  },
132
+ {
133
+ name: "submits Task outputs and accepts a void result",
134
+ async verify(e) {
135
+ let t = [];
136
+ o(await e.invoke({
137
+ capability: async (e) => (t.push(e), {
138
+ body: null,
139
+ status: 200
140
+ }),
141
+ input: null,
142
+ invocationId: "task-outputs",
143
+ program: a(e, "export default async (_input, context) => {\n await context.outputs({ first: 1 })\n await context.outputs({ second: 2 })\n}")
144
+ }), void 0, "Void Task result"), o(t.map(({ invocationId: e, kind: t, payload: n }) => ({
145
+ invocationId: e,
146
+ kind: t,
147
+ payload: n
148
+ })), [{
149
+ invocationId: "task-outputs",
150
+ kind: "outputs",
151
+ payload: { first: 1 }
152
+ }, {
153
+ invocationId: "task-outputs",
154
+ kind: "outputs",
155
+ payload: { second: 2 }
156
+ }], "Task outputs request");
157
+ }
158
+ },
132
159
  {
133
160
  name: "cancels a pending Capability and the user invocation",
134
161
  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;
@@ -91,10 +147,15 @@ export interface FlowRunOptions {
91
147
  readonly emit?: (event: SchedulerEvent) => Effect.Effect<void, Error>;
92
148
  readonly flowId: string;
93
149
  readonly inputs?: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
94
- readonly invokeTask: (invocation: TaskInvocation) => Effect.Effect<unknown, Error>;
150
+ readonly invokeTask: (invocation: TaskInvocation, outputs: (value: unknown) => Effect.Effect<void, Error>) => 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 {};