@oomol-lab/open-flow 0.1.0-beta.2 → 0.1.0-beta.20

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 (93) hide show
  1. package/dist/browser/{_virtual_open-flow-twemoji-DJwKsM_w.js → _virtual_open-flow-twemoji-CpHJOEsk.js} +4028 -2
  2. package/dist/browser/carbon-Cn-DTyjG.js +54 -0
  3. package/dist/browser/createResourceDialog-DlrAMxmo.js +110 -0
  4. package/dist/browser/dist-B_T-OpQp.js +4 -0
  5. package/dist/browser/{dist-DWADUsVB.js → dist-By46o5UV.js} +47 -47
  6. package/dist/browser/{dist-CPuF50D9.js → dist-D1VYgicl.js} +426 -305
  7. package/dist/browser/dist-DSe6KRsr.js +1224 -0
  8. package/dist/browser/dist-DYjIVIZC.js +795 -0
  9. package/dist/browser/{dist-3Mj8q8Pr.js → dist-DmuE3M0R.js} +53 -54
  10. package/dist/browser/{dist-BN4ZCyOB.js → dist-DpDLsYtO.js} +14 -15
  11. package/dist/browser/{dist-CJpzJrLM.js → dist-DwvhuMxw.js} +894 -895
  12. package/dist/browser/dist-DxahK_I8.js +2688 -0
  13. package/dist/browser/{dist-C46JByB-.js → dist-Dz6Nglsd.js} +61 -61
  14. package/dist/browser/{dist-DUzA0Ukh.js → dist-TJfrvoIQ.js} +141 -142
  15. package/dist/browser/{esm-B_PbUobB.js → esm-B7A42FzW.js} +68 -59
  16. package/dist/browser/flow-authoring-module.d.ts +2 -2
  17. package/dist/browser/flow-authoring-node.d.ts +20 -6
  18. package/dist/browser/flow-authoring.d.ts +1 -1
  19. package/dist/browser/flow-authoring.js +5405 -286
  20. package/dist/browser/flow-change-schema.d.ts +6 -0
  21. package/dist/browser/flow-change.d.ts +173 -14
  22. package/dist/browser/flow-change.js +5271 -114
  23. package/dist/browser/flow-notifications.d.ts +5 -0
  24. package/dist/browser/flowChanges-jX3KYcb0.js +11020 -0
  25. package/dist/browser/{flowRunInputEditorStore-BeyUSWpO.js → flowRunInputEditorStore-BBqQIOCR.js} +1020 -4104
  26. package/dist/browser/flowWorkspace-BIYwslVl.js +148497 -0
  27. package/dist/browser/host-conformance.d.ts +7 -0
  28. package/dist/browser/host-conformance.js +33 -0
  29. package/dist/browser/{diagnostics-giPSzyMo.js → i18n-CVBh0Ni1.js} +3390 -5715
  30. package/dist/browser/inputValues-BWfRHJWC.js +43 -0
  31. package/dist/browser/{languages-DgJehE1g.js → languages-C0zQ4GSo.js} +5 -25
  32. package/dist/browser/licenses.md +149 -700
  33. package/dist/browser/main-BDnNHhkU.js +50 -0
  34. package/dist/browser/{markdownContent-DdlIRN3_.js → markdownContent-BBgH9ZIV.js} +41 -41
  35. package/dist/browser/theme.css +461 -34
  36. package/dist/browser/{typeScriptSession-mPCiA9sV.js → typeScriptSession-DnAmJCzu.js} +70 -71
  37. package/dist/browser/ui-input.d.ts +3 -0
  38. package/dist/browser/ui-label.d.ts +3 -0
  39. package/dist/browser/ui-textarea.d.ts +3 -0
  40. package/dist/browser/ui.css +2 -0
  41. package/dist/browser/ui.css.d.ts +1 -0
  42. package/dist/browser/ui.d.ts +12 -0
  43. package/dist/browser/ui.js +2598 -0
  44. package/dist/browser/useValueChanged-BY05Usw-.js +2944 -0
  45. package/dist/browser/workbench-contract.d.ts +8 -2
  46. package/dist/browser/workbench.css +1 -1
  47. package/dist/browser/workbench.d.ts +1 -0
  48. package/dist/browser/workbench.js +2043 -1327
  49. package/dist/browser/workbenchSelect-CwP6rphY.js +11666 -0
  50. package/dist/common/control-api-conformance.d.ts +7 -0
  51. package/dist/common/control-api-conformance.js +5568 -166
  52. package/dist/common/control-api-errors.d.ts +9 -0
  53. package/dist/common/control-api.d.ts +309 -38
  54. package/dist/common/control-api.js +5817 -576
  55. package/dist/common/control-requests.d.ts +68 -0
  56. package/dist/common/control-requests.js +4950 -0
  57. package/dist/common/engine-contract.d.ts +3 -1
  58. package/dist/common/flow-agent.d.ts +10 -0
  59. package/dist/common/flow-encoding.d.ts +5 -2
  60. package/dist/common/flow-encoding.js +4820 -66
  61. package/dist/common/flow-graph.d.ts +6 -0
  62. package/dist/common/flow-json.d.ts +2 -0
  63. package/dist/common/flow-modules.d.ts +20 -0
  64. package/dist/common/flow-notifications.d.ts +5 -0
  65. package/dist/common/flow-schema.d.ts +8 -0
  66. package/dist/common/flow-semantics.d.ts +10 -6
  67. package/dist/common/flow-semantics.js +9982 -1701
  68. package/dist/common/integration-trigger.d.ts +24 -1
  69. package/dist/common/integration-trigger.js +188 -52
  70. package/dist/common/mcp-conformance.d.ts +2 -0
  71. package/dist/common/mcp.d.ts +765 -0
  72. package/dist/common/mcp.js +6477 -0
  73. package/dist/common/provider-triggers.js +5996 -993
  74. package/dist/common/run-events.d.ts +2 -2
  75. package/dist/common/run-events.js +12 -17
  76. package/dist/common/run-lifecycle.d.ts +21 -2
  77. package/dist/common/run-lifecycle.js +83 -2
  78. package/dist/common/run-results.d.ts +57 -0
  79. package/dist/common/runtime-contract.d.ts +36 -3
  80. package/dist/common/runtime-contract.js +227 -19
  81. package/dist/common/scheduler.d.ts +77 -18
  82. package/dist/common/scheduler.js +8259 -248
  83. package/dist/index.d.ts +6 -5
  84. package/package.json +21 -1
  85. package/dist/browser/carbon-DMCVsjHo.js +0 -53
  86. package/dist/browser/createResourceDialog-BkZns-oZ.js +0 -504
  87. package/dist/browser/dist-BMqL-qR5.js +0 -1894
  88. package/dist/browser/dist-BpopSHwP.js +0 -1543
  89. package/dist/browser/dist-CUSrALSX.js +0 -1620
  90. package/dist/browser/flowWorkspace-DAMLVMcF.js +0 -47584
  91. package/dist/browser/getPseudoElementBounds-ESJExRFX.js +0 -7642
  92. package/dist/browser/main-DmjVyuWr.js +0 -76
  93. package/dist/browser/workbenchSelect-B2s1HV-Y.js +0 -1374
@@ -19,19 +19,90 @@ 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 = "open-flow-engine/v2/nodejs-compat-v1", i = {
23
23
  platformExports: /* @__PURE__ */ new Set(["engineContract", "identity"]),
24
24
  platformModule: "open-flow:platform",
25
25
  platformSource: `export const engineContract = ${JSON.stringify(n)}
26
26
  export function identity(value) { return value }
27
27
  `
28
+ }, a = {
29
+ ...i,
30
+ builtinModules: new Set([
31
+ "assert",
32
+ "assert/strict",
33
+ "buffer",
34
+ "console",
35
+ "constants",
36
+ "crypto",
37
+ "events",
38
+ "fs",
39
+ "fs/promises",
40
+ "os",
41
+ "path",
42
+ "path/posix",
43
+ "process",
44
+ "punycode",
45
+ "querystring",
46
+ "stream",
47
+ "stream/promises",
48
+ "stream/web",
49
+ "string_decoder",
50
+ "timers",
51
+ "timers/promises",
52
+ "url",
53
+ "util",
54
+ "zlib"
55
+ ].flatMap((e) => [e, `node:${e}`])),
56
+ platformSource: `export const engineContract = ${JSON.stringify(r)}
57
+ export function identity(value) { return value }
58
+ `
28
59
  };
29
- function i(e) {
30
- return e == "open-flow-engine/v1" ? r : void 0;
60
+ function o(e) {
61
+ if (e == "open-flow-engine/v2") return i;
62
+ if (e == "open-flow-engine/v2/nodejs-compat-v1") return a;
31
63
  }
32
64
  //#endregion
33
65
  //#region src/execution/common/runtime.ts
34
- function a(e, t, r = {}) {
66
+ var s = [{
67
+ name: "supports Node builtin imports and asynchronous virtual file operations",
68
+ async verify(e) {
69
+ l(await e.invoke({
70
+ capability: async () => ({
71
+ body: null,
72
+ status: 403
73
+ }),
74
+ input: null,
75
+ invocationId: "nodejs-files",
76
+ program: {
77
+ ...c(e, "import assert from 'node:assert/strict';\nimport { Buffer } from 'node:buffer'; import path from 'node:path'; import fs from 'node:fs/promises';\nexport default async () => {\n const file = path.join('/tmp', 'conformance.txt');\n await fs.writeFile(file, Buffer.from('你好'));\n const text = await fs.readFile(file, 'utf8');\n assert.equal(text, '你好');\n await fs.unlink(file);\n return { text, bytes: Buffer.byteLength(text) };\n}"),
78
+ engineContract: r
79
+ }
80
+ }), {
81
+ text: "你好",
82
+ bytes: 6
83
+ }, "Node virtual files");
84
+ }
85
+ }, {
86
+ name: "preserves abort reasons and cancels Promise timers",
87
+ async verify(e) {
88
+ l(await e.invoke({
89
+ capability: async () => ({
90
+ body: null,
91
+ status: 403
92
+ }),
93
+ input: null,
94
+ invocationId: "nodejs-abort",
95
+ program: {
96
+ ...c(e, "import { setTimeout } from 'node:timers/promises';\nexport default async () => {\n const controller = new AbortController(); const reason = { message: 'stop' };\n const combined = AbortSignal.any([controller.signal]);\n const pending = setTimeout(60000, 'late', { signal: combined });\n controller.abort(reason); controller.abort('ignored');\n let thrown; try { combined.throwIfAborted(); } catch (error) { thrown = error; }\n try { await pending; return false; } catch (error) {\n return { sameReason: combined.reason === reason && thrown === reason, name: error.name };\n }\n}"),
97
+ engineContract: r
98
+ }
99
+ }), {
100
+ sameReason: !0,
101
+ name: "AbortError"
102
+ }, "Node cancellation");
103
+ }
104
+ }];
105
+ function c(e, t, r = {}) {
35
106
  return {
36
107
  engineContract: n,
37
108
  engineDigest: e.engineDigest,
@@ -45,10 +116,10 @@ function a(e, t, r = {}) {
45
116
  }
46
117
  };
47
118
  }
48
- function o(e, n, r) {
119
+ function l(e, n, r) {
49
120
  if (!t(e, n)) throw Error(`${r}: expected ${JSON.stringify(n)}, received ${JSON.stringify(e)}.`);
50
121
  }
51
- async function s(e, t, n) {
122
+ async function u(e, t, n) {
52
123
  try {
53
124
  await e;
54
125
  } catch (e) {
@@ -57,17 +128,82 @@ async function s(e, t, n) {
57
128
  }
58
129
  throw Error(`${n}: operation unexpectedly succeeded.`);
59
130
  }
60
- var c = [
131
+ var d = [
132
+ {
133
+ name: "preserves Action error codes and fixed per-call Connection selection",
134
+ async verify(e) {
135
+ let t = [{
136
+ kind: "connector",
137
+ action: "example.echo",
138
+ connections: [{
139
+ connectionId: "work",
140
+ alias: "office"
141
+ }, { connectionId: "home" }]
142
+ }];
143
+ l(await e.invoke({
144
+ capabilities: t,
145
+ capability: async ({ payload: e }) => {
146
+ let n = p(t, e);
147
+ if (n.input.fail) throw Object.assign(/* @__PURE__ */ Error("Provider unavailable."), { code: "connector.unavailable" });
148
+ return {
149
+ body: n.connectionId ?? null,
150
+ status: 200
151
+ };
152
+ },
153
+ input: null,
154
+ invocationId: "action-accounts",
155
+ program: c(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 }")
156
+ }), [
157
+ "work",
158
+ "home",
159
+ "connector.unavailable"
160
+ ], "Action selection and recovery");
161
+ }
162
+ },
163
+ {
164
+ name: "shares Action entries and assigns independent concurrent call identities",
165
+ async verify(e) {
166
+ let t = [];
167
+ l(await e.invoke({
168
+ capabilities: [{
169
+ kind: "connector",
170
+ action: "example.echo",
171
+ connections: []
172
+ }],
173
+ capability: async (e) => (t.push(e), {
174
+ body: e.payload,
175
+ status: 200
176
+ }),
177
+ input: null,
178
+ invocationId: "action-calls",
179
+ program: c(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 }")
180
+ }), {
181
+ same: !0,
182
+ values: [
183
+ 1,
184
+ 2,
185
+ 3
186
+ ].map((e) => ({
187
+ action: "example.echo",
188
+ input: { value: e }
189
+ }))
190
+ }, "Action results"), l(new Set(t.map((e) => e.callId)).size, 3, "Independent Action identities"), l(t.map((e) => e.invocationId), [
191
+ "action-calls",
192
+ "action-calls",
193
+ "action-calls"
194
+ ], "Task identity");
195
+ }
196
+ },
61
197
  {
62
198
  name: "loads the fixed ESM closure and platform module",
63
199
  async verify(e) {
64
- o(await e.invoke({
200
+ l(await e.invoke({
65
201
  capability: async () => {
66
202
  throw Error("Capability must not be called.");
67
203
  },
68
204
  input: { value: 6 },
69
205
  invocationId: "module-closure",
70
- program: a(e, "import { double } from './helper.mjs'\nimport { engineContract, identity } from 'open-flow:platform'\nexport default (input) => ({ engineContract, value: identity(double(input.value)) })", { helper: {
206
+ program: c(e, "import { double } from './helper.mjs'\nimport { engineContract, identity } from 'open-flow:platform'\nexport default (input) => ({ engineContract, value: identity(double(input.value)) })", { helper: {
71
207
  imports: [],
72
208
  source: "export const double = (value) => value * 2"
73
209
  } })
@@ -80,14 +216,14 @@ var c = [
80
216
  {
81
217
  name: "rejects modules outside the fixed closure",
82
218
  async verify(e) {
83
- await s(e.invoke({
219
+ await u(e.invoke({
84
220
  capability: async () => ({
85
221
  body: null,
86
222
  status: 200
87
223
  }),
88
224
  input: null,
89
225
  invocationId: "closed-linker",
90
- program: a(e, "import fs from 'node:fs'\nexport default () => fs.readFileSync('/etc/passwd', 'utf8')")
226
+ program: c(e, "import fs from 'node:fs'\nexport default () => fs.readFileSync('/etc/passwd', 'utf8')")
91
227
  }), /invalid|unsupported|cannot import|not part of/i, "Closed linker");
92
228
  }
93
229
  },
@@ -95,7 +231,7 @@ var c = [
95
231
  name: "copies asynchronous Capability requests and responses",
96
232
  async verify(e) {
97
233
  let t = [];
98
- o(await e.invoke({
234
+ l(await e.invoke({
99
235
  capability: async (e) => (t.push(e), {
100
236
  body: {
101
237
  accepted: !0,
@@ -105,7 +241,7 @@ var c = [
105
241
  }),
106
242
  input: { issue: 42 },
107
243
  invocationId: "async-capability",
108
- program: a(e, "export default async (input, capability) => capability.connector({ action: 'read', input })")
244
+ program: c(e, "export default async (input, capability) => capability.artifact.put({ action: 'read', input })")
109
245
  }), {
110
246
  body: {
111
247
  accepted: !0,
@@ -115,13 +251,13 @@ var c = [
115
251
  }
116
252
  },
117
253
  status: 200
118
- }, "Capability result"), o(t.map(({ invocationId: e, kind: t, payload: n }) => ({
254
+ }, "Capability result"), l(t.map(({ invocationId: e, kind: t, payload: n }) => ({
119
255
  invocationId: e,
120
256
  kind: t,
121
257
  payload: n
122
258
  })), [{
123
259
  invocationId: "async-capability",
124
- kind: "connector",
260
+ kind: "artifact.put",
125
261
  payload: {
126
262
  action: "read",
127
263
  input: { issue: 42 }
@@ -129,23 +265,95 @@ var c = [
129
265
  }], "Capability request");
130
266
  }
131
267
  },
268
+ {
269
+ name: "returns final outputs without exposing intermediate output capability",
270
+ async verify(e) {
271
+ l(await e.invoke({
272
+ capability: async () => {
273
+ throw Error("Capability must not be called.");
274
+ },
275
+ input: null,
276
+ invocationId: "final-outputs",
277
+ program: c(e, "export default (_input, context) => ({ available: typeof context.outputs, value: 1 })")
278
+ }), {
279
+ available: "undefined",
280
+ value: 1
281
+ }, "Final Task outputs");
282
+ }
283
+ },
132
284
  {
133
285
  name: "cancels a pending Capability and the user invocation",
134
286
  async verify(e) {
135
287
  let t = new AbortController(), n = !1, r, i = new Promise((e) => {
136
288
  r = e;
137
- }), c = e.invoke({
289
+ }), a = e.invoke({
290
+ capabilities: [{
291
+ kind: "connector",
292
+ action: "example.wait",
293
+ connections: []
294
+ }],
138
295
  capability: async ({ signal: e }) => (r(), await new Promise((t, r) => e.addEventListener("abort", () => {
139
296
  n = !0, r(e.reason);
140
297
  }, { once: !0 }))),
141
298
  input: null,
142
299
  invocationId: "canceled-capability",
143
- program: a(e, "export default async (_input, capability) => capability.connector({ action: 'wait' })"),
300
+ program: c(e, "export default async (_input, context) => context.actions.example.wait({})"),
144
301
  signal: t.signal
145
302
  });
146
- await i, t.abort(/* @__PURE__ */ Error("Invocation canceled.")), await s(c, /cancel|abort|disposed/i, "Canceled invocation"), o(n, !0, "Capability cancellation");
303
+ await i, t.abort(/* @__PURE__ */ Error("Invocation canceled.")), await u(a, /cancel|abort|disposed/i, "Canceled invocation"), l(n, !0, "Capability cancellation");
147
304
  }
148
305
  }
149
306
  ];
307
+ function f(e, t) {
308
+ let n = (e, t) => {
309
+ if (!(e === null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e))) {
310
+ 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" });
311
+ t.add(e);
312
+ for (let r of Array.isArray(e) ? e : Object.values(e)) n(r, t);
313
+ t.delete(e);
314
+ }
315
+ }, r = Object.create(null), i = /* @__PURE__ */ new Map();
316
+ for (let a of e) {
317
+ let e = a.action.indexOf("."), o = a.action.slice(0, e), s = a.action.slice(e + 1), c = i.get(o);
318
+ c ?? (c = Object.create(null), i.set(o, c), r[o] = c);
319
+ let l = async (e = {}, r) => (n(e, /* @__PURE__ */ new Set()), r !== void 0 && n(r, /* @__PURE__ */ new Set()), (await t({
320
+ action: a.action,
321
+ input: e,
322
+ ...r === void 0 ? {} : { options: r }
323
+ })).body);
324
+ r[a.action] = l, c[s] = l;
325
+ }
326
+ for (let e of i.values()) Object.freeze(e);
327
+ return Object.freeze(r);
328
+ }
329
+ function p(e, t) {
330
+ 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" });
331
+ if (typeof t != "object" || !t || Array.isArray(t)) throw n;
332
+ let i = t;
333
+ if (Object.keys(i).some((e) => ![
334
+ "action",
335
+ "input",
336
+ "options"
337
+ ].includes(e)) || typeof i.action != "string" || i.input == null || typeof i.input != "object" || Array.isArray(i.input)) throw n;
338
+ let a = e.find((e) => e.action == i.action);
339
+ if (a == null) throw r;
340
+ let o = a.connectionId;
341
+ if (Object.hasOwn(i, "options")) {
342
+ if (i.options == null || typeof i.options != "object" || Array.isArray(i.options)) throw n;
343
+ let e = i.options, t = Object.keys(e);
344
+ if (t.length != 1) throw n;
345
+ if (typeof e.connectionId == "string" && e.connectionId.length > 0 && t[0] == "connectionId") o = e.connectionId;
346
+ else if (typeof e.connectionAlias == "string" && e.connectionAlias.length > 0 && t[0] == "connectionAlias") {
347
+ if (o = a.connections.find((t) => t.alias == e.connectionAlias)?.connectionId, o == null) throw r;
348
+ } else throw n;
349
+ }
350
+ if (o != null && !a.connections.some((e) => e.connectionId == o)) throw r;
351
+ if (o == null && a.connections.length > 0) throw Object.assign(/* @__PURE__ */ Error("Choose a Connector Connection for this Action."), { code: "connector.connection-required" });
352
+ return {
353
+ action: i.action,
354
+ input: i.input,
355
+ ...o == null ? {} : { connectionId: o }
356
+ };
357
+ }
150
358
  //#endregion
151
- export { n as currentEngineContract, i as findEngineContract, c as runtimeConformanceCases };
359
+ export { f as createActions, n as currentEngineContract, o as findEngineContract, r as nodejsEngineContract, s as nodejsRuntimeConformanceCases, p as resolveAction, d as runtimeConformanceCases };
@@ -1,5 +1,6 @@
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
+ import type { AgentCheckpoint } from './runtime-contract.js';
3
4
  import * as Effect from 'effect/Effect';
4
5
  export type SchedulerEvent = {
5
6
  readonly flowId: string;
@@ -17,29 +18,30 @@ export type SchedulerEvent = {
17
18
  readonly inputs: Readonly<Record<string, JsonValue>>;
18
19
  readonly jobId: string;
19
20
  readonly nodeId: string;
20
- readonly nodeKind: 'condition' | 'connector' | 'javascript' | 'llm' | 'subflow' | 'value';
21
+ readonly nodeKind: 'agent' | 'condition' | 'connector' | 'javascript' | 'llm' | 'subflow' | 'value' | 'wait';
21
22
  readonly nodeTitle?: string;
22
23
  readonly runId: string;
23
24
  readonly type: 'node.started';
24
25
  } | {
25
- readonly handle: string;
26
26
  readonly jobId: string;
27
27
  readonly nodeId: string;
28
+ readonly outputs: Readonly<Record<string, JsonValue>>;
28
29
  readonly runId: string;
29
- readonly type: 'node.output';
30
- readonly value: JsonValue;
30
+ readonly type: 'node.completed';
31
31
  } | {
32
+ readonly code: string;
32
33
  readonly jobId: string;
34
+ readonly message: string;
33
35
  readonly nodeId: string;
34
36
  readonly runId: string;
35
- readonly type: 'node.completed';
37
+ readonly type: 'node.failed';
36
38
  } | {
37
- readonly code: string;
38
39
  readonly jobId: string;
40
+ readonly level: 'debug' | 'error' | 'info' | 'warn';
39
41
  readonly message: string;
40
42
  readonly nodeId: string;
41
43
  readonly runId: string;
42
- readonly type: 'node.failed';
44
+ readonly type: 'node.log';
43
45
  } | {
44
46
  readonly result: FlowRunResult | SubflowRunResult;
45
47
  readonly runId: string;
@@ -52,19 +54,64 @@ export type SchedulerEvent = {
52
54
  export interface FlowRunResult {
53
55
  readonly kind: 'node-results';
54
56
  readonly nodes: readonly {
55
- readonly jobs: readonly {
56
- readonly jobId: string;
57
- readonly outputs: Readonly<Record<string, JsonValue>>;
58
- }[];
59
57
  readonly nodeId: string;
58
+ readonly status: 'completed';
59
+ readonly jobId: string;
60
+ readonly outputs: Readonly<Record<string, JsonValue>>;
60
61
  }[];
61
62
  }
63
+ export interface FlowRunCheckpoint {
64
+ readonly bindingValues: Readonly<Record<string, string>>;
65
+ readonly inputs: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
66
+ readonly results: Readonly<Record<string, {
67
+ readonly jobId: string;
68
+ readonly outputs: Readonly<Record<string, JsonValue>>;
69
+ }>>;
70
+ readonly skipped: readonly string[];
71
+ readonly version: 2;
72
+ readonly queue: readonly FlowRunCheckpoint['wait'][];
73
+ readonly agents: Readonly<Record<string, {
74
+ readonly invocationId: string;
75
+ readonly input: Readonly<Record<string, JsonValue>>;
76
+ readonly remainingMs?: number;
77
+ readonly checkpoint: AgentCheckpoint;
78
+ }>>;
79
+ readonly wait: {
80
+ readonly jobId: string;
81
+ readonly nodeId: string;
82
+ readonly value: JsonValue;
83
+ readonly waitId: string;
84
+ };
85
+ }
86
+ export type FlowRunOutcome = FlowRunResult | {
87
+ readonly checkpoint: FlowRunCheckpoint;
88
+ readonly kind: 'waiting';
89
+ readonly notification?: {
90
+ readonly input: Readonly<Record<string, JsonValue>>;
91
+ readonly messageHandle: string;
92
+ readonly taskId: string;
93
+ };
94
+ readonly wait: {
95
+ readonly actions: readonly ['continue'] | readonly ['approve', 'reject'];
96
+ readonly prompt: string;
97
+ readonly jobId: string;
98
+ readonly nodeId: string;
99
+ readonly waitId: string;
100
+ };
101
+ };
62
102
  export interface SubflowRunResult {
63
103
  readonly kind: 'function-outputs';
64
104
  readonly outputs: Readonly<Record<string, JsonValue>>;
65
105
  readonly target: 'subflow';
66
106
  }
67
107
  interface TaskInvocationBase {
108
+ readonly agent?: {
109
+ readonly action: 'approve' | 'reject';
110
+ readonly checkpoint: AgentCheckpoint;
111
+ };
112
+ readonly additionalInputs: Readonly<Record<string, JsonValue>>;
113
+ readonly blockId: string;
114
+ readonly flowId: string;
68
115
  readonly input: Readonly<Record<string, JsonValue>>;
69
116
  readonly invocationId: string;
70
117
  readonly jobId: string;
@@ -85,16 +132,28 @@ export interface SchedulerFailure {
85
132
  readonly code: string;
86
133
  readonly message: string;
87
134
  }
88
- export interface FlowRunOptions {
89
- readonly bindingValues?: Readonly<Record<string, string>>;
135
+ export type FlowRunOptions = {
90
136
  readonly createId: () => string;
91
137
  readonly emit?: (event: SchedulerEvent) => Effect.Effect<void, Error>;
92
138
  readonly flowId: string;
93
- readonly inputs?: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
94
139
  readonly invokeTask: (invocation: TaskInvocation) => Effect.Effect<unknown, Error>;
95
140
  readonly projectFailure?: (error: unknown) => SchedulerFailure;
96
141
  readonly runId: string;
97
- readonly trigger?: TriggerSeed;
98
- }
99
- export declare function runFlow(prepared: PreparedFlow, options: FlowRunOptions): Effect.Effect<FlowRunResult, Error>;
142
+ } & RunLaunch;
143
+ export type RunLaunch = {
144
+ readonly bindingValues?: Readonly<Record<string, string>>;
145
+ readonly inputs?: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
146
+ readonly trigger: TriggerSeed;
147
+ readonly resume?: never;
148
+ } | {
149
+ readonly resume: {
150
+ readonly action: WaitAction;
151
+ readonly checkpoint: unknown;
152
+ };
153
+ readonly bindingValues?: never;
154
+ readonly inputs?: never;
155
+ readonly trigger?: never;
156
+ };
157
+ export declare function decodeFlowRunCheckpoint(input: unknown): FlowRunCheckpoint;
158
+ export declare function runFlow(prepared: PreparedFlow, options: FlowRunOptions): Effect.Effect<FlowRunOutcome, Error>;
100
159
  export {};