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

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 (65) hide show
  1. package/dist/browser/DesignerIcon-ckcKnxxJ.js +2267 -0
  2. package/dist/browser/createResourceDialog-2pESP2wA.js +111 -0
  3. package/dist/browser/{dist-meg_oHVR.js → dist-BZ5PTFAs.js} +335 -335
  4. package/dist/browser/dist-Bmb2mZvW.js +795 -0
  5. package/dist/browser/{dist-Cc0y2Pli.js → dist-Ce71Szg7.js} +622 -622
  6. package/dist/browser/dist-DSe6KRsr.js +1224 -0
  7. package/dist/browser/{dist-Dg_VXC8f.js → dist-DY4qlXTK.js} +134 -134
  8. package/dist/browser/{esm-yhVU_KbQ.js → esm-BPZ0P6x4.js} +59 -59
  9. package/dist/browser/flow-authoring-node.d.ts +11 -4
  10. package/dist/browser/flow-authoring.d.ts +1 -1
  11. package/dist/browser/flow-authoring.js +5032 -275
  12. package/dist/browser/flow-change-schema.d.ts +6 -0
  13. package/dist/browser/flow-change.d.ts +21 -8
  14. package/dist/browser/flow-change.js +5048 -155
  15. package/dist/browser/{flowChanges-B2ttnaj9.js → flowChanges-CHPdBmZb.js} +4433 -3786
  16. package/dist/browser/{flowRunInputEditorStore-DDidwd8h.js → flowRunInputEditorStore-NPGePkvP.js} +679 -689
  17. package/dist/browser/flowWorkspace-BLGcgnHj.js +158418 -0
  18. package/dist/browser/{getPseudoElementBounds-5LArT6Xc.js → getPseudoElementBounds-Dfqo78k7.js} +691 -687
  19. package/dist/browser/host-conformance.d.ts +7 -0
  20. package/dist/browser/host-conformance.js +33 -0
  21. package/dist/browser/{languages-DgJehE1g.js → languages-i3Xmpt6S.js} +6 -15
  22. package/dist/browser/licenses.md +82 -0
  23. package/dist/browser/{markdownContent-DUfLdnUt.js → markdownContent-BawLYUjh.js} +23 -23
  24. package/dist/browser/select-Dn3vpjGC.js +6872 -0
  25. package/dist/browser/theme.css +34 -34
  26. package/dist/browser/{typeScriptSession-_TgJ_7Oq.js → typeScriptSession-BoV-FDl3.js} +257 -257
  27. package/dist/browser/waitNotificationInputs-BFbQUOyp.js +29 -0
  28. package/dist/browser/workbench-contract.d.ts +8 -2
  29. package/dist/browser/workbench.css +1 -1
  30. package/dist/browser/workbench.js +1277 -1021
  31. package/dist/browser/workbenchSelect-DzF8oik9.js +435 -0
  32. package/dist/common/control-api-conformance.d.ts +6 -0
  33. package/dist/common/control-api-conformance.js +300 -85
  34. package/dist/common/control-api.d.ts +37 -10
  35. package/dist/common/control-api.js +5199 -437
  36. package/dist/common/control-requests.d.ts +68 -0
  37. package/dist/common/control-requests.js +4913 -0
  38. package/dist/common/engine-contract.d.ts +1 -1
  39. package/dist/common/flow-encoding.d.ts +3 -1
  40. package/dist/common/flow-encoding.js +4761 -63
  41. package/dist/common/flow-graph.d.ts +6 -0
  42. package/dist/common/flow-json.d.ts +2 -0
  43. package/dist/common/flow-modules.d.ts +20 -0
  44. package/dist/common/flow-schema.d.ts +8 -0
  45. package/dist/common/flow-semantics.d.ts +6 -5
  46. package/dist/common/flow-semantics.js +14641 -9800
  47. package/dist/common/integration-trigger.d.ts +1 -0
  48. package/dist/common/mcp-conformance.d.ts +2 -0
  49. package/dist/common/mcp.d.ts +545 -0
  50. package/dist/common/mcp.js +4964 -0
  51. package/dist/common/run-events.d.ts +2 -2
  52. package/dist/common/run-events.js +8 -15
  53. package/dist/common/runtime-contract.d.ts +9 -1
  54. package/dist/common/runtime-contract.js +137 -27
  55. package/dist/common/scheduler.d.ts +11 -33
  56. package/dist/common/scheduler.js +7241 -428
  57. package/dist/index.d.ts +5 -5
  58. package/package.json +13 -1
  59. package/dist/browser/DesignerIcon-DjgOMYI5.js +0 -2065
  60. package/dist/browser/createResourceDialog-DNBueSYZ.js +0 -505
  61. package/dist/browser/dist-BMRLCebL.js +0 -1893
  62. package/dist/browser/flowWorkspace-Dr8-Hut9.js +0 -45541
  63. package/dist/browser/icons-KIOgjHpD.js +0 -730
  64. package/dist/browser/waitNotificationInputs-BPulOxYt.js +0 -26
  65. package/dist/browser/workbenchSelect-CbXrdwxW.js +0 -1375
@@ -1,9 +1,9 @@
1
1
  export type ProjectedRunEvent = {
2
- readonly kind: 'node.output';
2
+ readonly kind: 'node.completed';
3
3
  readonly payload: Readonly<Record<string, unknown>>;
4
4
  readonly value: unknown;
5
5
  } | {
6
- readonly kind: 'node.artifact' | 'node.completed' | 'node.failed' | 'node.log' | 'node.progress' | 'node.started' | 'run.progress' | 'run.started';
6
+ readonly kind: 'node.artifact' | 'node.failed' | 'node.log' | 'node.progress' | 'node.started' | 'run.progress' | 'run.started';
7
7
  readonly payload: Readonly<Record<string, unknown>>;
8
8
  };
9
9
  export declare function createEventProjector(platformRunId: string, nodeFailureCodes: ReadonlySet<string>): (event: unknown) => Promise<ProjectedRunEvent | undefined>;
@@ -110,21 +110,18 @@ function f(e, t) {
110
110
  o(g);
111
111
  return;
112
112
  }
113
- if (_ == "node.started" || _ == "node.output" || _ == "node.progress" || _ == "node.artifact" || _ == "node.log" || _ == "node.completed" || _ == "node.failed") {
114
- let n = s(g, f, e), o = await n.executionId, m = {
113
+ if (_ == "node.started" || _ == "node.progress" || _ == "node.artifact" || _ == "node.log" || _ == "node.completed" || _ == "node.failed") {
114
+ let r = s(g, f, e), o = await r.executionId, m = {
115
115
  executionId: o,
116
- flowId: n.flowId,
117
- nodeId: n.nodeId,
118
- scopeId: await c("scope", e, n.rawRunId)
116
+ flowId: r.flowId,
117
+ nodeId: r.nodeId,
118
+ scopeId: await c("scope", e, r.rawRunId)
119
119
  };
120
120
  switch (_) {
121
- case "node.output": return {
121
+ case "node.completed": return {
122
122
  kind: _,
123
- payload: {
124
- ...m,
125
- handle: r(g.handle, "Runtime node.output handle")
126
- },
127
- value: g.value
123
+ payload: m,
124
+ value: n(g.outputs, "Runtime node.completed outputs")
128
125
  };
129
126
  case "node.started": {
130
127
  let e = a(g.nodeKind), t = i(g.nodeTitle, "Runtime node.started nodeTitle"), n = i(g.operation, "Runtime node.started operation");
@@ -170,10 +167,6 @@ function f(e, t) {
170
167
  message: l(g.message)
171
168
  }
172
169
  };
173
- case "node.completed": return {
174
- kind: _,
175
- payload: m
176
- };
177
170
  case "node.failed": return {
178
171
  kind: _,
179
172
  payload: {
@@ -1,4 +1,4 @@
1
- import type { CodeModule, JsonValue } from '../browser/flow-change.js';
1
+ import type { CodeModule, ConnectorCapability, JsonValue } from '../browser/flow-change.js';
2
2
  export { currentEngineContract, findEngineContract, type EngineContract } from './engine-contract.js';
3
3
  export type RuntimeModule = Pick<CodeModule, 'imports' | 'source'>;
4
4
  export interface RuntimeProgram {
@@ -8,6 +8,7 @@ export interface RuntimeProgram {
8
8
  readonly modules: Readonly<Record<string, RuntimeModule>>;
9
9
  }
10
10
  export interface RuntimeCapabilityCall {
11
+ readonly callId: string;
11
12
  readonly invocationId: string;
12
13
  readonly kind: string;
13
14
  readonly payload: JsonValue;
@@ -36,6 +37,7 @@ export type LlmTaskResult = {
36
37
  };
37
38
  export type InvokeLlmTask = (invocation: LlmTaskInvocation) => Promise<LlmTaskResult>;
38
39
  export interface RuntimeInvocation {
40
+ readonly capabilities?: readonly ConnectorCapability[];
39
41
  readonly capability: (call: RuntimeCapabilityCall) => Promise<RuntimeCapabilityResponse>;
40
42
  readonly input: JsonValue;
41
43
  readonly invocationId: string;
@@ -51,3 +53,9 @@ export interface RuntimeConformanceCase {
51
53
  verify(harness: RuntimeHarness): Promise<void>;
52
54
  }
53
55
  export declare const runtimeConformanceCases: readonly RuntimeConformanceCase[];
56
+ export declare function createActions(declarations: readonly ConnectorCapability[], invoke: (payload: JsonValue) => Promise<RuntimeCapabilityResponse>): Readonly<Record<string, unknown>>;
57
+ export declare function resolveAction(declarations: readonly ConnectorCapability[], payload: unknown): {
58
+ readonly action: string;
59
+ readonly connectionId?: string;
60
+ readonly input: Readonly<Record<string, JsonValue>>;
61
+ };
@@ -19,7 +19,7 @@ function t(n, r) {
19
19
  }
20
20
  //#endregion
21
21
  //#region src/execution/common/engineContract.ts
22
- var n = "open-flow-engine/v1", r = {
22
+ var n = "open-flow-engine/v2", r = {
23
23
  platformExports: /* @__PURE__ */ new Set(["engineContract", "identity"]),
24
24
  platformModule: "open-flow:platform",
25
25
  platformSource: `export const engineContract = ${JSON.stringify(n)}
@@ -27,7 +27,7 @@ export function identity(value) { return value }
27
27
  `
28
28
  };
29
29
  function i(e) {
30
- return e == "open-flow-engine/v1" ? r : void 0;
30
+ return e == "open-flow-engine/v2" ? r : void 0;
31
31
  }
32
32
  //#endregion
33
33
  //#region src/execution/common/runtime.ts
@@ -58,6 +58,71 @@ async function s(e, t, n) {
58
58
  throw Error(`${n}: operation unexpectedly succeeded.`);
59
59
  }
60
60
  var c = [
61
+ {
62
+ name: "preserves Action error codes and fixed per-call Connection selection",
63
+ async verify(e) {
64
+ let t = [{
65
+ kind: "connector",
66
+ action: "example.echo",
67
+ connections: [{
68
+ connectionId: "work",
69
+ alias: "office"
70
+ }, { connectionId: "home" }]
71
+ }];
72
+ o(await e.invoke({
73
+ capabilities: t,
74
+ capability: async ({ payload: e }) => {
75
+ let n = u(t, e);
76
+ if (n.input.fail) throw Object.assign(/* @__PURE__ */ Error("Provider unavailable."), { code: "connector.unavailable" });
77
+ return {
78
+ body: n.connectionId ?? null,
79
+ status: 200
80
+ };
81
+ },
82
+ input: null,
83
+ invocationId: "action-accounts",
84
+ program: a(e, "export default async (_, context) => {\n const values = await Promise.all([\n context.actions.example.echo({}, { connectionAlias: 'office' }),\n context.actions['example.echo']({}, { connectionId: 'home' }),\n ])\n try { await context.actions.example.echo({ fail: true }, { connectionId: 'work' }) }\n catch (error) { values.push(error.code) }\n return values\n }")
85
+ }), [
86
+ "work",
87
+ "home",
88
+ "connector.unavailable"
89
+ ], "Action selection and recovery");
90
+ }
91
+ },
92
+ {
93
+ name: "shares Action entries and assigns independent concurrent call identities",
94
+ async verify(e) {
95
+ let t = [];
96
+ o(await e.invoke({
97
+ capabilities: [{
98
+ kind: "connector",
99
+ action: "example.echo",
100
+ connections: []
101
+ }],
102
+ capability: async (e) => (t.push(e), {
103
+ body: e.payload,
104
+ status: 200
105
+ }),
106
+ input: null,
107
+ invocationId: "action-calls",
108
+ program: a(e, "export default async (_input, context) => {\n const call = context.actions.example.echo\n return { same: call === context.actions['example.echo'], values: await Promise.all([call({ value: 1 }), call({ value: 2 }), call({ value: 3 })]) }\n }")
109
+ }), {
110
+ same: !0,
111
+ values: [
112
+ 1,
113
+ 2,
114
+ 3
115
+ ].map((e) => ({
116
+ action: "example.echo",
117
+ input: { value: e }
118
+ }))
119
+ }, "Action results"), o(new Set(t.map((e) => e.callId)).size, 3, "Independent Action identities"), o(t.map((e) => e.invocationId), [
120
+ "action-calls",
121
+ "action-calls",
122
+ "action-calls"
123
+ ], "Task identity");
124
+ }
125
+ },
61
126
  {
62
127
  name: "loads the fixed ESM closure and platform module",
63
128
  async verify(e) {
@@ -105,7 +170,7 @@ var c = [
105
170
  }),
106
171
  input: { issue: 42 },
107
172
  invocationId: "async-capability",
108
- program: a(e, "export default async (input, capability) => capability.connector({ action: 'read', input })")
173
+ program: a(e, "export default async (input, capability) => capability.artifact.put({ action: 'read', input })")
109
174
  }), {
110
175
  body: {
111
176
  accepted: !0,
@@ -121,7 +186,7 @@ var c = [
121
186
  payload: n
122
187
  })), [{
123
188
  invocationId: "async-capability",
124
- kind: "connector",
189
+ kind: "artifact.put",
125
190
  payload: {
126
191
  action: "read",
127
192
  input: { issue: 42 }
@@ -130,30 +195,19 @@ var c = [
130
195
  }
131
196
  },
132
197
  {
133
- name: "submits Task outputs and accepts a void result",
198
+ name: "returns final outputs without exposing intermediate output capability",
134
199
  async verify(e) {
135
- let t = [];
136
200
  o(await e.invoke({
137
- capability: async (e) => (t.push(e), {
138
- body: null,
139
- status: 200
140
- }),
201
+ capability: async () => {
202
+ throw Error("Capability must not be called.");
203
+ },
141
204
  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");
205
+ invocationId: "final-outputs",
206
+ program: a(e, "export default (_input, context) => ({ available: typeof context.outputs, value: 1 })")
207
+ }), {
208
+ available: "undefined",
209
+ value: 1
210
+ }, "Final Task outputs");
157
211
  }
158
212
  },
159
213
  {
@@ -162,17 +216,73 @@ var c = [
162
216
  let t = new AbortController(), n = !1, r, i = new Promise((e) => {
163
217
  r = e;
164
218
  }), c = e.invoke({
219
+ capabilities: [{
220
+ kind: "connector",
221
+ action: "example.wait",
222
+ connections: []
223
+ }],
165
224
  capability: async ({ signal: e }) => (r(), await new Promise((t, r) => e.addEventListener("abort", () => {
166
225
  n = !0, r(e.reason);
167
226
  }, { once: !0 }))),
168
227
  input: null,
169
228
  invocationId: "canceled-capability",
170
- program: a(e, "export default async (_input, capability) => capability.connector({ action: 'wait' })"),
229
+ program: a(e, "export default async (_input, context) => context.actions.example.wait({})"),
171
230
  signal: t.signal
172
231
  });
173
232
  await i, t.abort(/* @__PURE__ */ Error("Invocation canceled.")), await s(c, /cancel|abort|disposed/i, "Canceled invocation"), o(n, !0, "Capability cancellation");
174
233
  }
175
234
  }
176
235
  ];
236
+ function l(e, t) {
237
+ let n = (e, t) => {
238
+ if (!(e === null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e))) {
239
+ if (typeof e != "object" || t.has(e) || !Array.isArray(e) && Object.getPrototypeOf(e) !== Object.prototype && Object.getPrototypeOf(e) !== null || Object.getOwnPropertySymbols(e).length > 0) throw Object.assign(/* @__PURE__ */ Error("Action parameters must contain only JSON values."), { code: "capability.invalid" });
240
+ t.add(e);
241
+ for (let r of Array.isArray(e) ? e : Object.values(e)) n(r, t);
242
+ t.delete(e);
243
+ }
244
+ }, r = Object.create(null), i = /* @__PURE__ */ new Map();
245
+ for (let a of e) {
246
+ let e = a.action.indexOf("."), o = a.action.slice(0, e), s = a.action.slice(e + 1), c = i.get(o);
247
+ c ?? (c = Object.create(null), i.set(o, c), r[o] = c);
248
+ let l = async (e = {}, r) => (n(e, /* @__PURE__ */ new Set()), r !== void 0 && n(r, /* @__PURE__ */ new Set()), (await t({
249
+ action: a.action,
250
+ input: e,
251
+ ...r === void 0 ? {} : { options: r }
252
+ })).body);
253
+ r[a.action] = l, c[s] = l;
254
+ }
255
+ for (let e of i.values()) Object.freeze(e);
256
+ return Object.freeze(r);
257
+ }
258
+ function u(e, t) {
259
+ let n = Object.assign(/* @__PURE__ */ Error("The Action request is invalid."), { code: "capability.invalid" }), r = Object.assign(/* @__PURE__ */ Error("The Action or Connection is not declared for this Task."), { code: "capability.denied" });
260
+ if (typeof t != "object" || !t || Array.isArray(t)) throw n;
261
+ let i = t;
262
+ if (Object.keys(i).some((e) => ![
263
+ "action",
264
+ "input",
265
+ "options"
266
+ ].includes(e)) || typeof i.action != "string" || i.input == null || typeof i.input != "object" || Array.isArray(i.input)) throw n;
267
+ let a = e.find((e) => e.action == i.action);
268
+ if (a == null) throw r;
269
+ let o = a.connectionId;
270
+ if (Object.hasOwn(i, "options")) {
271
+ if (i.options == null || typeof i.options != "object" || Array.isArray(i.options)) throw n;
272
+ let e = i.options, t = Object.keys(e);
273
+ if (t.length != 1) throw n;
274
+ if (typeof e.connectionId == "string" && e.connectionId.length > 0 && t[0] == "connectionId") o = e.connectionId;
275
+ else if (typeof e.connectionAlias == "string" && e.connectionAlias.length > 0 && t[0] == "connectionAlias") {
276
+ if (o = a.connections.find((t) => t.alias == e.connectionAlias)?.connectionId, o == null) throw r;
277
+ } else throw n;
278
+ }
279
+ if (o != null && !a.connections.some((e) => e.connectionId == o)) throw r;
280
+ if (o == null && a.connections.length > 0) throw Object.assign(/* @__PURE__ */ Error("Choose a Connector Connection for this Action."), { code: "connector.connection-required" });
281
+ return {
282
+ action: i.action,
283
+ input: i.input,
284
+ ...o == null ? {} : { connectionId: o }
285
+ };
286
+ }
177
287
  //#endregion
178
- export { n as currentEngineContract, i as findEngineContract, c as runtimeConformanceCases };
288
+ export { l as createActions, n as currentEngineContract, i as findEngineContract, u as resolveAction, c as runtimeConformanceCases };
@@ -21,16 +21,10 @@ export type SchedulerEvent = {
21
21
  readonly nodeTitle?: string;
22
22
  readonly runId: string;
23
23
  readonly type: 'node.started';
24
- } | {
25
- readonly handle: string;
26
- readonly jobId: string;
27
- readonly nodeId: string;
28
- readonly runId: string;
29
- readonly type: 'node.output';
30
- readonly value: JsonValue;
31
24
  } | {
32
25
  readonly jobId: string;
33
26
  readonly nodeId: string;
27
+ readonly outputs: Readonly<Record<string, JsonValue>>;
34
28
  readonly runId: string;
35
29
  readonly type: 'node.completed';
36
30
  } | {
@@ -59,39 +53,24 @@ export type SchedulerEvent = {
59
53
  export interface FlowRunResult {
60
54
  readonly kind: 'node-results';
61
55
  readonly nodes: readonly {
62
- readonly jobs: readonly {
63
- readonly jobId: string;
64
- readonly outputs: Readonly<Record<string, JsonValue>>;
65
- }[];
66
56
  readonly nodeId: string;
57
+ readonly status: 'completed';
58
+ readonly jobId: string;
59
+ readonly outputs: Readonly<Record<string, JsonValue>>;
67
60
  }[];
68
61
  }
69
62
  export interface FlowRunCheckpoint {
70
63
  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;
64
+ readonly inputs: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
65
+ readonly results: Readonly<Record<string, {
66
+ readonly jobId: string;
67
+ readonly outputs: Readonly<Record<string, JsonValue>>;
78
68
  }>>;
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
- }[];
69
+ readonly skipped: readonly string[];
90
70
  readonly version: 1;
91
71
  readonly wait: {
92
72
  readonly jobId: string;
93
73
  readonly nodeId: string;
94
- readonly order: number;
95
74
  readonly value: JsonValue;
96
75
  readonly waitId: string;
97
76
  };
@@ -108,7 +87,6 @@ export type FlowRunOutcome = FlowRunResult | {
108
87
  readonly actions: readonly ['continue'] | readonly ['approve', 'reject'];
109
88
  readonly jobId: string;
110
89
  readonly nodeId: string;
111
- readonly order: number;
112
90
  readonly waitId: string;
113
91
  };
114
92
  };
@@ -147,7 +125,7 @@ export interface FlowRunOptions {
147
125
  readonly emit?: (event: SchedulerEvent) => Effect.Effect<void, Error>;
148
126
  readonly flowId: string;
149
127
  readonly inputs?: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
150
- readonly invokeTask: (invocation: TaskInvocation, outputs: (value: unknown) => Effect.Effect<void, Error>) => Effect.Effect<unknown, Error>;
128
+ readonly invokeTask: (invocation: TaskInvocation) => Effect.Effect<unknown, Error>;
151
129
  readonly projectFailure?: (error: unknown) => SchedulerFailure;
152
130
  readonly resume?: {
153
131
  readonly action: WaitAction;
@@ -156,6 +134,6 @@ export interface FlowRunOptions {
156
134
  readonly runId: string;
157
135
  readonly trigger?: TriggerSeed;
158
136
  }
159
- export declare function decodeFlowRunCheckpoint(value: unknown): FlowRunCheckpoint;
137
+ export declare function decodeFlowRunCheckpoint(input: unknown): FlowRunCheckpoint;
160
138
  export declare function runFlow(prepared: PreparedFlow, options: FlowRunOptions): Effect.Effect<FlowRunOutcome, Error>;
161
139
  export {};