@oomol-lab/open-flow 0.1.0-beta.16 → 0.1.0-beta.17

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 (30) hide show
  1. package/dist/browser/{createResourceDialog-DRUIXBbz.js → createResourceDialog-DOWv3Zj0.js} +2 -2
  2. package/dist/browser/flow-authoring.js +1464 -1463
  3. package/dist/browser/flow-change.js +1 -0
  4. package/dist/browser/{flowChanges-iuoam3Bx.js → flowChanges-BDLNaCWZ.js} +1743 -1482
  5. package/dist/browser/{flowWorkspace-B0UAQ-s7.js → flowWorkspace-BtNfkYuG.js} +32422 -29399
  6. package/dist/browser/{i18n-JtW9O5x3.js → i18n-CNu41MKH.js} +153 -13
  7. package/dist/browser/{inputValues-DICmJoN-.js → inputValues-CQlPBtdF.js} +2 -2
  8. package/dist/browser/licenses.md +48 -0
  9. package/dist/browser/{markdownContent-tWc7bRAs.js → markdownContent-BBgH9ZIV.js} +13 -13
  10. package/dist/browser/theme.css +9 -9
  11. package/dist/browser/ui.css +1 -1
  12. package/dist/browser/ui.d.ts +9 -0
  13. package/dist/browser/ui.js +1219 -1022
  14. package/dist/browser/{useValueChanged-DSookOEC.js → useValueChanged-DUuqLWPg.js} +3 -3
  15. package/dist/browser/workbench.css +1 -1
  16. package/dist/browser/workbench.js +931 -629
  17. package/dist/browser/{workbenchSelect-DgxXqCAa.js → workbenchSelect-Bb3cewZj.js} +4 -3
  18. package/dist/common/control-api-conformance.js +389 -394
  19. package/dist/common/control-api-errors.d.ts +5 -0
  20. package/dist/common/control-api.d.ts +1 -6
  21. package/dist/common/control-api.js +1019 -1003
  22. package/dist/common/control-requests.js +1 -0
  23. package/dist/common/engine-contract.d.ts +2 -0
  24. package/dist/common/flow-encoding.js +1 -0
  25. package/dist/common/flow-semantics.js +2802 -2767
  26. package/dist/common/mcp.js +409 -391
  27. package/dist/common/runtime-contract.d.ts +2 -1
  28. package/dist/common/runtime-contract.js +99 -28
  29. package/dist/common/scheduler.js +1254 -1253
  30. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import type { CodeModule, ConnectorCapability, JsonValue } from '../browser/flow-change.js';
2
- export { currentEngineContract, findEngineContract, type EngineContract } from './engine-contract.js';
2
+ export { currentEngineContract, nodejsEngineContract, findEngineContract, type EngineContract } from './engine-contract.js';
3
3
  export type RuntimeModule = Pick<CodeModule, 'imports' | 'source'>;
4
+ export declare const nodejsRuntimeConformanceCases: readonly RuntimeConformanceCase[];
4
5
  export interface RuntimeProgram {
5
6
  readonly engineContract: string;
6
7
  readonly engineDigest: string;
@@ -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/v2", 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/v2" ? 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,7 +128,7 @@ async function s(e, t, n) {
57
128
  }
58
129
  throw Error(`${n}: operation unexpectedly succeeded.`);
59
130
  }
60
- var c = [
131
+ var d = [
61
132
  {
62
133
  name: "preserves Action error codes and fixed per-call Connection selection",
63
134
  async verify(e) {
@@ -69,10 +140,10 @@ var c = [
69
140
  alias: "office"
70
141
  }, { connectionId: "home" }]
71
142
  }];
72
- o(await e.invoke({
143
+ l(await e.invoke({
73
144
  capabilities: t,
74
145
  capability: async ({ payload: e }) => {
75
- let n = u(t, e);
146
+ let n = p(t, e);
76
147
  if (n.input.fail) throw Object.assign(/* @__PURE__ */ Error("Provider unavailable."), { code: "connector.unavailable" });
77
148
  return {
78
149
  body: n.connectionId ?? null,
@@ -81,7 +152,7 @@ var c = [
81
152
  },
82
153
  input: null,
83
154
  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 }")
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 }")
85
156
  }), [
86
157
  "work",
87
158
  "home",
@@ -93,7 +164,7 @@ var c = [
93
164
  name: "shares Action entries and assigns independent concurrent call identities",
94
165
  async verify(e) {
95
166
  let t = [];
96
- o(await e.invoke({
167
+ l(await e.invoke({
97
168
  capabilities: [{
98
169
  kind: "connector",
99
170
  action: "example.echo",
@@ -105,7 +176,7 @@ var c = [
105
176
  }),
106
177
  input: null,
107
178
  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 }")
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 }")
109
180
  }), {
110
181
  same: !0,
111
182
  values: [
@@ -116,7 +187,7 @@ var c = [
116
187
  action: "example.echo",
117
188
  input: { value: e }
118
189
  }))
119
- }, "Action results"), o(new Set(t.map((e) => e.callId)).size, 3, "Independent Action identities"), o(t.map((e) => e.invocationId), [
190
+ }, "Action results"), l(new Set(t.map((e) => e.callId)).size, 3, "Independent Action identities"), l(t.map((e) => e.invocationId), [
120
191
  "action-calls",
121
192
  "action-calls",
122
193
  "action-calls"
@@ -126,13 +197,13 @@ var c = [
126
197
  {
127
198
  name: "loads the fixed ESM closure and platform module",
128
199
  async verify(e) {
129
- o(await e.invoke({
200
+ l(await e.invoke({
130
201
  capability: async () => {
131
202
  throw Error("Capability must not be called.");
132
203
  },
133
204
  input: { value: 6 },
134
205
  invocationId: "module-closure",
135
- 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: {
136
207
  imports: [],
137
208
  source: "export const double = (value) => value * 2"
138
209
  } })
@@ -145,14 +216,14 @@ var c = [
145
216
  {
146
217
  name: "rejects modules outside the fixed closure",
147
218
  async verify(e) {
148
- await s(e.invoke({
219
+ await u(e.invoke({
149
220
  capability: async () => ({
150
221
  body: null,
151
222
  status: 200
152
223
  }),
153
224
  input: null,
154
225
  invocationId: "closed-linker",
155
- 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')")
156
227
  }), /invalid|unsupported|cannot import|not part of/i, "Closed linker");
157
228
  }
158
229
  },
@@ -160,7 +231,7 @@ var c = [
160
231
  name: "copies asynchronous Capability requests and responses",
161
232
  async verify(e) {
162
233
  let t = [];
163
- o(await e.invoke({
234
+ l(await e.invoke({
164
235
  capability: async (e) => (t.push(e), {
165
236
  body: {
166
237
  accepted: !0,
@@ -170,7 +241,7 @@ var c = [
170
241
  }),
171
242
  input: { issue: 42 },
172
243
  invocationId: "async-capability",
173
- program: a(e, "export default async (input, capability) => capability.artifact.put({ action: 'read', input })")
244
+ program: c(e, "export default async (input, capability) => capability.artifact.put({ action: 'read', input })")
174
245
  }), {
175
246
  body: {
176
247
  accepted: !0,
@@ -180,7 +251,7 @@ var c = [
180
251
  }
181
252
  },
182
253
  status: 200
183
- }, "Capability result"), o(t.map(({ invocationId: e, kind: t, payload: n }) => ({
254
+ }, "Capability result"), l(t.map(({ invocationId: e, kind: t, payload: n }) => ({
184
255
  invocationId: e,
185
256
  kind: t,
186
257
  payload: n
@@ -197,13 +268,13 @@ var c = [
197
268
  {
198
269
  name: "returns final outputs without exposing intermediate output capability",
199
270
  async verify(e) {
200
- o(await e.invoke({
271
+ l(await e.invoke({
201
272
  capability: async () => {
202
273
  throw Error("Capability must not be called.");
203
274
  },
204
275
  input: null,
205
276
  invocationId: "final-outputs",
206
- program: a(e, "export default (_input, context) => ({ available: typeof context.outputs, value: 1 })")
277
+ program: c(e, "export default (_input, context) => ({ available: typeof context.outputs, value: 1 })")
207
278
  }), {
208
279
  available: "undefined",
209
280
  value: 1
@@ -215,7 +286,7 @@ var c = [
215
286
  async verify(e) {
216
287
  let t = new AbortController(), n = !1, r, i = new Promise((e) => {
217
288
  r = e;
218
- }), c = e.invoke({
289
+ }), a = e.invoke({
219
290
  capabilities: [{
220
291
  kind: "connector",
221
292
  action: "example.wait",
@@ -226,14 +297,14 @@ var c = [
226
297
  }, { once: !0 }))),
227
298
  input: null,
228
299
  invocationId: "canceled-capability",
229
- program: a(e, "export default async (_input, context) => context.actions.example.wait({})"),
300
+ program: c(e, "export default async (_input, context) => context.actions.example.wait({})"),
230
301
  signal: t.signal
231
302
  });
232
- 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");
233
304
  }
234
305
  }
235
306
  ];
236
- function l(e, t) {
307
+ function f(e, t) {
237
308
  let n = (e, t) => {
238
309
  if (!(e === null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e))) {
239
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" });
@@ -255,7 +326,7 @@ function l(e, t) {
255
326
  for (let e of i.values()) Object.freeze(e);
256
327
  return Object.freeze(r);
257
328
  }
258
- function u(e, t) {
329
+ function p(e, t) {
259
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" });
260
331
  if (typeof t != "object" || !t || Array.isArray(t)) throw n;
261
332
  let i = t;
@@ -285,4 +356,4 @@ function u(e, t) {
285
356
  };
286
357
  }
287
358
  //#endregion
288
- export { l as createActions, n as currentEngineContract, i as findEngineContract, u as resolveAction, 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 };