@oomol-lab/open-flow 0.1.0-beta.77 → 0.1.0-beta.79
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.
- package/README.md +2 -0
- package/dist/browser/{ContentIcon-VZQO8VZU.js → ContentIcon-CMn0c-kl.js} +93 -3
- package/dist/browser/{FlowCanvas-BNGDMaWr.js → FlowCanvas-BQGBcfoL.js} +1675 -591
- package/dist/browser/{createResourceDialog-BmtakfVg.js → createResourceDialog-DkovGogv.js} +3 -3
- package/dist/browser/{dialog-BcFBfRB1.js → dialog-CFFuRM8s.js} +37 -86
- package/dist/browser/{exportSvg-CG8hEUNk.js → exportSvg-CYwyYiuH.js} +2 -2
- package/dist/browser/{flowChanges-BGo_4Ypo.js → flowChanges-CN2R-m1M.js} +1258 -422
- package/dist/browser/{flowWorkspace-BFHGev7s.js → flowWorkspace-CXVL1FNv.js} +634 -628
- package/dist/browser/licenses.md +1 -1
- package/dist/browser/preview.css +512 -462
- package/dist/browser/preview.js +8183 -6384
- package/dist/browser/{tooltip-BAWSUexx.js → tooltip-BDcVTNpu.js} +65 -2
- package/dist/browser/{typeScriptSession-CRoezJPN.js → typeScriptSession-CoEIptNC.js} +1 -1
- package/dist/browser/ui.css +5 -24
- package/dist/browser/workbench.css +512 -462
- package/dist/browser/workbench.d.ts +2 -3
- package/dist/browser/workbench.js +65 -690
- package/dist/browser/{workbenchSelect-CjK-xdm3.js → workbenchSelect-CkOS95gX.js} +2 -2
- package/dist/command/index.js +31 -31
- package/dist/common/authoring.d.ts +3 -3
- package/dist/common/authoringExamples.d.ts +3 -3
- package/dist/common/authoringSchema.d.ts +14 -22
- package/dist/common/control-api-conformance.js +91 -25
- package/dist/common/control-api.d.ts +8 -3
- package/dist/common/control-api.js +51 -25
- package/dist/common/control-requests.d.ts +9 -3
- package/dist/common/control-requests.js +54 -42
- package/dist/common/flow-authoring.js +32 -19
- package/dist/common/flow-change.d.ts +1 -1
- package/dist/common/flow-change.js +32 -19
- package/dist/common/flow-encoding.js +31 -18
- package/dist/common/flow-semantics.js +41 -26
- package/dist/common/flow-state.d.ts +49 -43
- package/dist/common/flow-state.js +95 -110
- package/dist/common/mcp.d.ts +35 -4
- package/dist/common/mcp.js +51 -26
- package/dist/common/run-events.js +19 -9
- package/dist/common/runtime-contract.d.ts +4 -1
- package/dist/common/runtime-contract.js +66 -17
- package/dist/common/runtime-nodejs-compat.js +11 -12
- package/dist/common/scheduler.d.ts +2 -1
- package/dist/common/scheduler.js +82 -55
- package/dist/common/state-conformance.d.ts +3 -3
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/control/common/api.ts +36 -7
- package/src/control/common/authoring.ts +6 -5
- package/src/control/common/authoringExamples.ts +6 -5
- package/src/control/common/authoringSchema.ts +7 -7
- package/src/control/common/conformance.ts +31 -0
- package/src/control/common/mcp.ts +7 -2
- package/src/control/common/requests.ts +10 -1
- package/src/execution/common/events.ts +22 -10
- package/src/execution/common/node-execution.ts +1 -1
- package/src/execution/common/scheduler.ts +28 -14
- package/src/flow/common/change.ts +1 -1
- package/src/flow/common/changeSchema.ts +4 -4
- package/src/flow/common/errorHandling.ts +1 -1
- package/src/flow/common/semantics.ts +12 -6
- package/src/runtime/common/nodejsGuest.generated.json +11 -12
- package/src/runtime/common/runtime.ts +45 -12
- package/src/state/common/conformance.ts +32 -21
- package/src/state/common/state.ts +85 -80
- package/src/types/index.ts +1 -0
|
@@ -120,11 +120,18 @@ function createState(invoke) {
|
|
|
120
120
|
if (!Array.isArray(ids) || !Array.from(ids).every((id) => typeof id === "string" || typeof id === "number" && Number.isFinite(id))) throw invalid("Identities must be strings or finite numbers.");
|
|
121
121
|
return ids;
|
|
122
122
|
};
|
|
123
|
+
async function get(key) {
|
|
124
|
+
if (Array.isArray(key)) {
|
|
125
|
+
if (key.length === 0 || key.length > 16) throw invalid("State reads require 1 to 16 keys.");
|
|
126
|
+
const keys = Array.from(key, keyOf);
|
|
127
|
+
if (new Set(keys).size !== keys.length) throw invalid("State keys must be distinct.");
|
|
128
|
+
return (await invoke("state.get", { key: keys })).body.values;
|
|
129
|
+
}
|
|
130
|
+
return (await invoke("state.get", { key: keyOf(key) })).body.value;
|
|
131
|
+
}
|
|
123
132
|
return {
|
|
124
133
|
state: Object.freeze({
|
|
125
|
-
|
|
126
|
-
return (await invoke("state.get", { key: keyOf(key) })).body.value;
|
|
127
|
-
},
|
|
134
|
+
get,
|
|
128
135
|
async set(key, value) {
|
|
129
136
|
await invoke("state.set", {
|
|
130
137
|
key: keyOf(key),
|
|
@@ -454,6 +461,46 @@ async function rejects(operation, pattern, message) {
|
|
|
454
461
|
throw new Error(`${message}: operation unexpectedly succeeded.`);
|
|
455
462
|
}
|
|
456
463
|
var runtimeConformanceCases = [
|
|
464
|
+
{
|
|
465
|
+
name: "reads multiple State keys in one Host call while preserving input order",
|
|
466
|
+
async verify(harness) {
|
|
467
|
+
const calls = [];
|
|
468
|
+
equal(await harness.invoke({
|
|
469
|
+
input: null,
|
|
470
|
+
invocationId: "state-batch-read",
|
|
471
|
+
capability: async ({ kind, payload }) => {
|
|
472
|
+
calls.push({
|
|
473
|
+
kind,
|
|
474
|
+
payload
|
|
475
|
+
});
|
|
476
|
+
return {
|
|
477
|
+
status: 200,
|
|
478
|
+
body: { values: [
|
|
479
|
+
0,
|
|
480
|
+
null,
|
|
481
|
+
false,
|
|
482
|
+
""
|
|
483
|
+
] }
|
|
484
|
+
};
|
|
485
|
+
},
|
|
486
|
+
program: program(harness, `export default async (_, context) => context.state.get(['zero', 'missing', 'false', 'empty'])`)
|
|
487
|
+
}), [
|
|
488
|
+
0,
|
|
489
|
+
null,
|
|
490
|
+
false,
|
|
491
|
+
""
|
|
492
|
+
], "State batch values");
|
|
493
|
+
equal(calls, [{
|
|
494
|
+
kind: "state.get",
|
|
495
|
+
payload: { key: [
|
|
496
|
+
"zero",
|
|
497
|
+
"missing",
|
|
498
|
+
"false",
|
|
499
|
+
"empty"
|
|
500
|
+
] }
|
|
501
|
+
}], "State batch dispatch");
|
|
502
|
+
}
|
|
503
|
+
},
|
|
457
504
|
{
|
|
458
505
|
name: "cancels detached State work when its Task finishes",
|
|
459
506
|
async verify(harness) {
|
|
@@ -498,12 +545,20 @@ var runtimeConformanceCases = [
|
|
|
498
545
|
const invalid = [undefined, NaN, Infinity, new Date(), { x: undefined }, cyclic, [undefined], { x: () => 1 }];
|
|
499
546
|
const errors = [];
|
|
500
547
|
for (const value of invalid) { try { await context.state.set('key', value); errors.push('accepted'); } catch (e) { errors.push(e.code); } }
|
|
501
|
-
for (const call of [
|
|
548
|
+
for (const call of [
|
|
549
|
+
() => context.state.get(''), () => context.state.get('x'.repeat(257)),
|
|
550
|
+
() => context.state.get([]), () => context.state.get(['x', 'x']),
|
|
551
|
+
() => context.state.get(Array.from({length: 17}, (_, index) => String(index))),
|
|
552
|
+
() => context.state.get(['']), () => context.state.get(['汉'.repeat(86)]),
|
|
553
|
+
() => context.state.get(new Array(1)), () => context.state.get(null), () => context.state.get(),
|
|
554
|
+
() => context.state.insert('x', null), () => context.dedupe.insert([NaN]),
|
|
555
|
+
() => context.dedupe.has([null]), () => context.dedupe.insert(new Array(1))
|
|
556
|
+
]) {
|
|
502
557
|
try { await call(); errors.push('accepted'); } catch (e) { errors.push(e.code); }
|
|
503
558
|
}
|
|
504
559
|
return errors;
|
|
505
560
|
}`)
|
|
506
|
-
}), Array.from({ length:
|
|
561
|
+
}), Array.from({ length: 22 }, () => "capability.invalid"), "State boundary validation");
|
|
507
562
|
equal(calls, 0, "State invalid dispatch");
|
|
508
563
|
}
|
|
509
564
|
},
|
|
@@ -1036,19 +1091,13 @@ function createBase64() {
|
|
|
1036
1091
|
const padding = text.endsWith("==") ? 2 : text.endsWith("=") ? 1 : 0;
|
|
1037
1092
|
const bytes = new Uint8Array(text.length / 4 * 3 - padding);
|
|
1038
1093
|
for (let index = 0, offset = 0; index < text.length; index += 4) {
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
1,
|
|
1042
|
-
2,
|
|
1043
|
-
3
|
|
1044
|
-
].map((position) => {
|
|
1094
|
+
let value = 0;
|
|
1095
|
+
for (let position = 0; position < 4; position++) {
|
|
1045
1096
|
const code = text.charCodeAt(index + position);
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
});
|
|
1051
|
-
const value = digits[0] << 18 | digits[1] << 12 | digits[2] << 6 | digits[3];
|
|
1097
|
+
const digit = code == 61 && index + position >= text.length - padding ? 0 : code < 128 ? values[code] : 255;
|
|
1098
|
+
if (digit == 255) throw new TypeError("Base64 content is invalid.");
|
|
1099
|
+
value = value << 6 | digit;
|
|
1100
|
+
}
|
|
1052
1101
|
if (offset < bytes.length) bytes[offset++] = value >> 16;
|
|
1053
1102
|
if (offset < bytes.length) bytes[offset++] = value >> 8 & 255;
|
|
1054
1103
|
if (offset < bytes.length) bytes[offset++] = value & 255;
|