@oomol-lab/open-flow 0.1.0-beta.4 → 0.1.0-beta.40
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/dist/browser/{_virtual_open-flow-twemoji-DJwKsM_w.js → _virtual_open-flow-twemoji-CpHJOEsk.js} +4028 -2
- package/dist/browser/carbon-Cn-DTyjG.js +54 -0
- package/dist/browser/codeDiagnostics-BtH_YuXu.js +44 -0
- package/dist/browser/createResourceDialog-BOrW62JW.js +110 -0
- package/dist/browser/{dist-DWADUsVB.js → dist-By46o5UV.js} +47 -47
- package/dist/browser/dist-Cdna4VV_.js +795 -0
- package/dist/browser/dist-CoszrK7m.js +4 -0
- package/dist/browser/{dist-CPuF50D9.js → dist-D1VYgicl.js} +426 -305
- package/dist/browser/{dist-CeSZ2xSM.js → dist-DINmJ4Gr.js} +171 -112
- package/dist/browser/dist-DSe6KRsr.js +1224 -0
- package/dist/browser/{dist-3Mj8q8Pr.js → dist-DmuE3M0R.js} +53 -54
- package/dist/browser/{dist-BN4ZCyOB.js → dist-DpDLsYtO.js} +14 -15
- package/dist/browser/{dist-CJpzJrLM.js → dist-DwvhuMxw.js} +894 -895
- package/dist/browser/dist-DxahK_I8.js +2688 -0
- package/dist/browser/{dist-C46JByB-.js → dist-Dz6Nglsd.js} +61 -61
- package/dist/browser/{dist-DUzA0Ukh.js → dist-TJfrvoIQ.js} +141 -142
- package/dist/browser/editorComponent-0skblWYk.js +16795 -0
- package/dist/browser/{esm-C9jQK70n.js → esm-B7A42FzW.js} +68 -59
- package/dist/browser/event-sources.d.ts +30 -0
- package/dist/browser/flow-authoring-module.d.ts +2 -2
- package/dist/browser/flow-authoring-node.d.ts +34 -17
- package/dist/browser/flow-authoring.d.ts +1 -1
- package/dist/browser/flow-authoring.js +15906 -457
- package/dist/browser/flow-change-schema.d.ts +11 -0
- package/dist/browser/flow-change.d.ts +245 -44
- package/dist/browser/flow-change.js +5517 -117
- package/dist/browser/flow-input-value.d.ts +6 -0
- package/dist/browser/flow-notifications.d.ts +11 -2
- package/dist/browser/flowChanges-3o9Vs_1I.js +10137 -0
- package/dist/browser/{flowRunInputEditorStore-BYa8zFLC.js → flowRunInputEditorStore-Bgb5vSeS.js} +864 -4000
- package/dist/browser/flowWorkspace-DJzQVVtZ.js +43418 -0
- package/dist/browser/host-conformance.d.ts +7 -0
- package/dist/browser/host-conformance.js +39 -0
- package/dist/browser/inputValues-DkDT6u0o.js +43 -0
- package/dist/browser/licenses.md +137 -662
- package/dist/browser/{getPseudoElementBounds-qDxSDwzN.js → lite-BA96NG4M.js} +4409 -2987
- package/dist/browser/main-BDnNHhkU.js +50 -0
- package/dist/browser/{markdownContent-DUfLdnUt.js → markdownContent-D2oHGWc6.js} +53 -53
- package/dist/browser/theme.css +529 -34
- package/dist/browser/{typeScriptSession-CwMPjseS.js → typeScriptSession-v9Pb3G6d.js} +190 -191
- package/dist/browser/ui-input.d.ts +5 -0
- package/dist/browser/ui-label.d.ts +3 -0
- package/dist/browser/ui-textarea.d.ts +3 -0
- package/dist/browser/ui.css +3 -0
- package/dist/browser/ui.css.d.ts +1 -0
- package/dist/browser/ui.d.ts +62 -0
- package/dist/browser/ui.js +5407 -0
- package/dist/browser/value-B_yE9ean.js +101 -0
- package/dist/browser/warmCodeTheme-DVv4-rDO.js +35 -0
- package/dist/browser/webhook-method.d.ts +3 -0
- package/dist/browser/workbench-contract.d.ts +27 -2
- package/dist/browser/workbench.css +1 -1
- package/dist/browser/workbench.d.ts +2 -3
- package/dist/browser/workbench.js +4212 -1472
- package/dist/browser/workbenchSelect-B5zXyaaX.js +6423 -0
- package/dist/common/authoringExamples.d.ts +28 -0
- package/dist/common/connectorDecoders.d.ts +9 -0
- package/dist/common/control-api-conformance.d.ts +57 -0
- package/dist/common/control-api-conformance.js +9793 -208
- package/dist/common/control-api-errors.d.ts +49 -0
- package/dist/common/control-api.d.ts +484 -57
- package/dist/common/control-api.js +8917 -531
- package/dist/common/control-requests.d.ts +129 -0
- package/dist/common/control-requests.js +8662 -0
- package/dist/common/cron-trigger.d.ts +2 -1
- package/dist/common/cron-trigger.js +27 -24
- package/dist/common/draftOperations.d.ts +13 -0
- package/dist/common/engine-contract.d.ts +3 -1
- package/dist/common/event-sources.d.ts +49 -0
- package/dist/common/feishu-events.d.ts +19 -0
- package/dist/common/feishu-subscriptions.d.ts +10 -0
- package/dist/common/flow-agent.d.ts +10 -0
- package/dist/common/flow-connectionUsage.d.ts +12 -0
- package/dist/common/flow-encoding.d.ts +10 -2
- package/dist/common/flow-encoding.js +5170 -84
- package/dist/common/flow-graph.d.ts +59 -0
- package/dist/common/flow-json.d.ts +2 -0
- package/dist/common/flow-modules.d.ts +20 -0
- package/dist/common/flow-notifications.d.ts +11 -2
- package/dist/common/flow-schema.d.ts +17 -0
- package/dist/common/flow-semantics.d.ts +15 -7
- package/dist/common/flow-semantics.js +16394 -9734
- package/dist/common/flowInspection.d.ts +105 -0
- package/dist/common/fr-ClB96SQY.js +298 -0
- package/dist/common/integration-trigger.d.ts +30 -2
- package/dist/common/integration-trigger.js +7880 -71
- package/dist/common/ja-BJF-VrP2.js +298 -0
- package/dist/common/ko-Bght_VaB.js +298 -0
- package/dist/common/localization.d.ts +2 -0
- package/dist/common/localization.js +37 -1
- package/dist/common/mcp-conformance.d.ts +2 -0
- package/dist/common/mcp.d.ts +964 -0
- package/dist/common/mcp.js +9358 -0
- package/dist/common/poll-trigger.d.ts +7 -0
- package/dist/common/poll-trigger.js +7702 -25
- package/dist/common/provider-triggers.d.ts +4 -0
- package/dist/common/provider-triggers.js +11554 -2275
- package/dist/common/providerAccess.d.ts +20 -0
- package/dist/common/ru-DrP4BRM5.js +298 -0
- package/dist/common/run-events.d.ts +2 -2
- package/dist/common/run-events.js +11 -16
- package/dist/common/run-lifecycle.d.ts +5 -1
- package/dist/common/run-lifecycle.js +33 -3
- package/dist/common/run-results.d.ts +57 -0
- package/dist/common/runtime-contract.d.ts +38 -3
- package/dist/common/runtime-contract.js +312 -19
- package/dist/common/scheduler.d.ts +83 -60
- package/dist/common/scheduler.js +8625 -545
- package/dist/common/trigger-catalog.d.ts +22 -0
- package/dist/common/trigger-config-options.d.ts +13 -0
- package/dist/common/trigger-config.d.ts +7 -0
- package/dist/common/trigger-contract.d.ts +7 -0
- package/dist/common/trigger-localization.d.ts +7 -0
- package/dist/common/webhook-trigger.d.ts +5 -3
- package/dist/common/webhook-trigger.js +7071 -67
- package/dist/common/zh-CN-CxZ3yYfR.js +298 -0
- package/dist/common/zh-TW-CRmc3FMz.js +298 -0
- package/dist/index.d.ts +5 -5
- package/package.json +21 -1
- package/dist/browser/DesignerIcon-DdfuH2jW.js +0 -2066
- package/dist/browser/carbon-DMCVsjHo.js +0 -53
- package/dist/browser/createResourceDialog-4YQKl8lG.js +0 -505
- package/dist/browser/dist-BMqL-qR5.js +0 -1894
- package/dist/browser/dist-BpopSHwP.js +0 -1543
- package/dist/browser/dist-CP0883sY.js +0 -4
- package/dist/browser/dist-CUSrALSX.js +0 -1620
- package/dist/browser/flowChanges-Bs-ZcJV8.js +0 -12006
- package/dist/browser/flowWorkspace-BewofPeU.js +0 -45575
- package/dist/browser/icons-DRoMXL5h.js +0 -521
- package/dist/browser/languages-DgJehE1g.js +0 -62
- package/dist/browser/lib-GrGxYjsJ.js +0 -7855
- package/dist/browser/main-DmjVyuWr.js +0 -76
- package/dist/browser/waitNotificationInputs-DtrPBwA1.js +0 -26
- package/dist/browser/workbenchSelect-CX8KtT7L.js +0 -1375
|
@@ -19,19 +19,101 @@ function t(n, r) {
|
|
|
19
19
|
}
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/execution/common/engineContract.ts
|
|
22
|
-
var n = "open-flow-engine/
|
|
22
|
+
var n = "open-flow-engine/v5", r = "open-flow-engine/v5/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
|
|
30
|
-
|
|
60
|
+
function o(e) {
|
|
61
|
+
if (e == "open-flow-engine/v5") return i;
|
|
62
|
+
if (e == "open-flow-engine/v5/nodejs-compat-v1") return a;
|
|
31
63
|
}
|
|
32
64
|
//#endregion
|
|
33
65
|
//#region src/execution/common/runtime.ts
|
|
34
|
-
function
|
|
66
|
+
function s(e) {
|
|
67
|
+
let t = /* @__PURE__ */ new Set(), n = (e, r) => {
|
|
68
|
+
if (r > 64) throw Error("Task result exceeds the maximum JSON depth.");
|
|
69
|
+
if (e === null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e)) return e;
|
|
70
|
+
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 Error("Task result must contain only JSON values.");
|
|
71
|
+
t.add(e);
|
|
72
|
+
let i = Array.isArray(e) ? Array.from(e, (e) => n(e, r + 1)) : Object.fromEntries(Object.entries(e).filter(([, e]) => r != 0 || e !== void 0).map(([e, t]) => [e, n(t, r + 1)]));
|
|
73
|
+
return t.delete(e), i;
|
|
74
|
+
};
|
|
75
|
+
return e === void 0 ? void 0 : n(e, 0);
|
|
76
|
+
}
|
|
77
|
+
var c = [{
|
|
78
|
+
name: "supports Node builtin imports and asynchronous virtual file operations",
|
|
79
|
+
async verify(e) {
|
|
80
|
+
u(await e.invoke({
|
|
81
|
+
capability: async () => ({
|
|
82
|
+
body: null,
|
|
83
|
+
status: 403
|
|
84
|
+
}),
|
|
85
|
+
input: null,
|
|
86
|
+
invocationId: "nodejs-files",
|
|
87
|
+
program: {
|
|
88
|
+
...l(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}"),
|
|
89
|
+
engineContract: r
|
|
90
|
+
}
|
|
91
|
+
}), {
|
|
92
|
+
text: "你好",
|
|
93
|
+
bytes: 6
|
|
94
|
+
}, "Node virtual files");
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
name: "preserves abort reasons and cancels Promise timers",
|
|
98
|
+
async verify(e) {
|
|
99
|
+
u(await e.invoke({
|
|
100
|
+
capability: async () => ({
|
|
101
|
+
body: null,
|
|
102
|
+
status: 403
|
|
103
|
+
}),
|
|
104
|
+
input: null,
|
|
105
|
+
invocationId: "nodejs-abort",
|
|
106
|
+
program: {
|
|
107
|
+
...l(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}"),
|
|
108
|
+
engineContract: r
|
|
109
|
+
}
|
|
110
|
+
}), {
|
|
111
|
+
sameReason: !0,
|
|
112
|
+
name: "AbortError"
|
|
113
|
+
}, "Node cancellation");
|
|
114
|
+
}
|
|
115
|
+
}];
|
|
116
|
+
function l(e, t, r = {}) {
|
|
35
117
|
return {
|
|
36
118
|
engineContract: n,
|
|
37
119
|
engineDigest: e.engineDigest,
|
|
@@ -45,10 +127,10 @@ function a(e, t, r = {}) {
|
|
|
45
127
|
}
|
|
46
128
|
};
|
|
47
129
|
}
|
|
48
|
-
function
|
|
130
|
+
function u(e, n, r) {
|
|
49
131
|
if (!t(e, n)) throw Error(`${r}: expected ${JSON.stringify(n)}, received ${JSON.stringify(e)}.`);
|
|
50
132
|
}
|
|
51
|
-
async function
|
|
133
|
+
async function d(e, t, n) {
|
|
52
134
|
try {
|
|
53
135
|
await e;
|
|
54
136
|
} catch (e) {
|
|
@@ -57,17 +139,135 @@ async function s(e, t, n) {
|
|
|
57
139
|
}
|
|
58
140
|
throw Error(`${n}: operation unexpectedly succeeded.`);
|
|
59
141
|
}
|
|
60
|
-
var
|
|
142
|
+
var f = [
|
|
143
|
+
{
|
|
144
|
+
name: "rejects Task results that JSON transport would discard or coerce",
|
|
145
|
+
async verify(e) {
|
|
146
|
+
for (let t of [
|
|
147
|
+
"{ value: () => 42 }",
|
|
148
|
+
"{ value: Symbol(\"value\") }",
|
|
149
|
+
"{ value: NaN }",
|
|
150
|
+
"{ value: Infinity }",
|
|
151
|
+
"{ value: 1n }",
|
|
152
|
+
"{ value: { nested: undefined } }",
|
|
153
|
+
"{ value: [undefined] }",
|
|
154
|
+
"{ value: Array(1) }",
|
|
155
|
+
"{ value: new Date() }",
|
|
156
|
+
"{ value: { toJSON() { return \"hidden\" } } }",
|
|
157
|
+
"{ [Symbol(\"key\")]: 1 }",
|
|
158
|
+
"(() => { const value = {}; value.self = value; return { value } })()"
|
|
159
|
+
]) await d(e.invoke({
|
|
160
|
+
capability: async () => ({
|
|
161
|
+
body: null,
|
|
162
|
+
status: 200
|
|
163
|
+
}),
|
|
164
|
+
input: null,
|
|
165
|
+
invocationId: "invalid-task-result",
|
|
166
|
+
program: l(e, `export default () => (${t})`)
|
|
167
|
+
}), /Task result must contain only JSON values/, `Invalid Task result: ${t}`);
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: "snapshots JSON results while preserving missing ports and shared values",
|
|
172
|
+
async verify(e) {
|
|
173
|
+
let t = await e.invoke({
|
|
174
|
+
capability: async () => ({
|
|
175
|
+
body: null,
|
|
176
|
+
status: 200
|
|
177
|
+
}),
|
|
178
|
+
input: null,
|
|
179
|
+
invocationId: "json-task-result",
|
|
180
|
+
program: l(e, "export default () => {\n const shared = { text: 'hello', values: [1, true, null] };\n return { missing: undefined, nullable: null, first: shared, second: shared };\n }")
|
|
181
|
+
}), n = {
|
|
182
|
+
text: "hello",
|
|
183
|
+
values: [
|
|
184
|
+
1,
|
|
185
|
+
!0,
|
|
186
|
+
null
|
|
187
|
+
]
|
|
188
|
+
};
|
|
189
|
+
u(t, {
|
|
190
|
+
nullable: null,
|
|
191
|
+
first: n,
|
|
192
|
+
second: n
|
|
193
|
+
}, "JSON Task result");
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: "preserves Action error codes and fixed per-call Connection selection",
|
|
198
|
+
async verify(e) {
|
|
199
|
+
let t = [{
|
|
200
|
+
kind: "connector",
|
|
201
|
+
action: "example.echo",
|
|
202
|
+
connections: [{
|
|
203
|
+
connectionId: "work",
|
|
204
|
+
alias: "office"
|
|
205
|
+
}, { connectionId: "home" }]
|
|
206
|
+
}];
|
|
207
|
+
u(await e.invoke({
|
|
208
|
+
capabilities: t,
|
|
209
|
+
capability: async ({ payload: e }) => {
|
|
210
|
+
let n = m(t, e);
|
|
211
|
+
if (n.input.fail) throw Object.assign(/* @__PURE__ */ Error("Provider unavailable."), { code: "connector.unavailable" });
|
|
212
|
+
return {
|
|
213
|
+
body: n.connectionId ?? null,
|
|
214
|
+
status: 200
|
|
215
|
+
};
|
|
216
|
+
},
|
|
217
|
+
input: null,
|
|
218
|
+
invocationId: "action-accounts",
|
|
219
|
+
program: l(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 }")
|
|
220
|
+
}), [
|
|
221
|
+
"work",
|
|
222
|
+
"home",
|
|
223
|
+
"connector.unavailable"
|
|
224
|
+
], "Action selection and recovery");
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: "shares Action entries and assigns independent concurrent call identities",
|
|
229
|
+
async verify(e) {
|
|
230
|
+
let t = [];
|
|
231
|
+
u(await e.invoke({
|
|
232
|
+
capabilities: [{
|
|
233
|
+
kind: "connector",
|
|
234
|
+
action: "example.echo",
|
|
235
|
+
connections: []
|
|
236
|
+
}],
|
|
237
|
+
capability: async (e) => (t.push(e), {
|
|
238
|
+
body: e.payload,
|
|
239
|
+
status: 200
|
|
240
|
+
}),
|
|
241
|
+
input: null,
|
|
242
|
+
invocationId: "action-calls",
|
|
243
|
+
program: l(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 }")
|
|
244
|
+
}), {
|
|
245
|
+
same: !0,
|
|
246
|
+
values: [
|
|
247
|
+
1,
|
|
248
|
+
2,
|
|
249
|
+
3
|
|
250
|
+
].map((e) => ({
|
|
251
|
+
action: "example.echo",
|
|
252
|
+
input: { value: e }
|
|
253
|
+
}))
|
|
254
|
+
}, "Action results"), u(new Set(t.map((e) => e.callId)).size, 3, "Independent Action identities"), u(t.map((e) => e.invocationId), [
|
|
255
|
+
"action-calls",
|
|
256
|
+
"action-calls",
|
|
257
|
+
"action-calls"
|
|
258
|
+
], "Task identity");
|
|
259
|
+
}
|
|
260
|
+
},
|
|
61
261
|
{
|
|
62
262
|
name: "loads the fixed ESM closure and platform module",
|
|
63
263
|
async verify(e) {
|
|
64
|
-
|
|
264
|
+
u(await e.invoke({
|
|
65
265
|
capability: async () => {
|
|
66
266
|
throw Error("Capability must not be called.");
|
|
67
267
|
},
|
|
68
268
|
input: { value: 6 },
|
|
69
269
|
invocationId: "module-closure",
|
|
70
|
-
program:
|
|
270
|
+
program: l(e, "import { double } from './helper.mjs'\nimport { engineContract, identity } from 'open-flow:platform'\nexport default (input) => ({ engineContract, value: identity(double(input.value)) })", { helper: {
|
|
71
271
|
imports: [],
|
|
72
272
|
source: "export const double = (value) => value * 2"
|
|
73
273
|
} })
|
|
@@ -80,14 +280,14 @@ var c = [
|
|
|
80
280
|
{
|
|
81
281
|
name: "rejects modules outside the fixed closure",
|
|
82
282
|
async verify(e) {
|
|
83
|
-
await
|
|
283
|
+
await d(e.invoke({
|
|
84
284
|
capability: async () => ({
|
|
85
285
|
body: null,
|
|
86
286
|
status: 200
|
|
87
287
|
}),
|
|
88
288
|
input: null,
|
|
89
289
|
invocationId: "closed-linker",
|
|
90
|
-
program:
|
|
290
|
+
program: l(e, "import fs from 'node:fs'\nexport default () => fs.readFileSync('/etc/passwd', 'utf8')")
|
|
91
291
|
}), /invalid|unsupported|cannot import|not part of/i, "Closed linker");
|
|
92
292
|
}
|
|
93
293
|
},
|
|
@@ -95,7 +295,7 @@ var c = [
|
|
|
95
295
|
name: "copies asynchronous Capability requests and responses",
|
|
96
296
|
async verify(e) {
|
|
97
297
|
let t = [];
|
|
98
|
-
|
|
298
|
+
u(await e.invoke({
|
|
99
299
|
capability: async (e) => (t.push(e), {
|
|
100
300
|
body: {
|
|
101
301
|
accepted: !0,
|
|
@@ -105,7 +305,7 @@ var c = [
|
|
|
105
305
|
}),
|
|
106
306
|
input: { issue: 42 },
|
|
107
307
|
invocationId: "async-capability",
|
|
108
|
-
program:
|
|
308
|
+
program: l(e, "export default async (input, capability) => capability.artifact.put({ action: 'read', input })")
|
|
109
309
|
}), {
|
|
110
310
|
body: {
|
|
111
311
|
accepted: !0,
|
|
@@ -115,13 +315,13 @@ var c = [
|
|
|
115
315
|
}
|
|
116
316
|
},
|
|
117
317
|
status: 200
|
|
118
|
-
}, "Capability result"),
|
|
318
|
+
}, "Capability result"), u(t.map(({ invocationId: e, kind: t, payload: n }) => ({
|
|
119
319
|
invocationId: e,
|
|
120
320
|
kind: t,
|
|
121
321
|
payload: n
|
|
122
322
|
})), [{
|
|
123
323
|
invocationId: "async-capability",
|
|
124
|
-
kind: "
|
|
324
|
+
kind: "artifact.put",
|
|
125
325
|
payload: {
|
|
126
326
|
action: "read",
|
|
127
327
|
input: { issue: 42 }
|
|
@@ -129,23 +329,116 @@ var c = [
|
|
|
129
329
|
}], "Capability request");
|
|
130
330
|
}
|
|
131
331
|
},
|
|
332
|
+
{
|
|
333
|
+
name: "returns final outputs without exposing intermediate output capability",
|
|
334
|
+
async verify(e) {
|
|
335
|
+
u(await e.invoke({
|
|
336
|
+
capability: async () => {
|
|
337
|
+
throw Error("Capability must not be called.");
|
|
338
|
+
},
|
|
339
|
+
input: null,
|
|
340
|
+
invocationId: "final-outputs",
|
|
341
|
+
program: l(e, "export default (_input, context) => ({ available: typeof context.outputs, value: 1 })")
|
|
342
|
+
}), {
|
|
343
|
+
available: "undefined",
|
|
344
|
+
value: 1
|
|
345
|
+
}, "Final Task outputs");
|
|
346
|
+
}
|
|
347
|
+
},
|
|
132
348
|
{
|
|
133
349
|
name: "cancels a pending Capability and the user invocation",
|
|
134
350
|
async verify(e) {
|
|
135
351
|
let t = new AbortController(), n = !1, r, i = new Promise((e) => {
|
|
136
352
|
r = e;
|
|
137
|
-
}),
|
|
353
|
+
}), a = e.invoke({
|
|
354
|
+
capabilities: [{
|
|
355
|
+
kind: "connector",
|
|
356
|
+
action: "example.wait",
|
|
357
|
+
connections: []
|
|
358
|
+
}],
|
|
138
359
|
capability: async ({ signal: e }) => (r(), await new Promise((t, r) => e.addEventListener("abort", () => {
|
|
139
360
|
n = !0, r(e.reason);
|
|
140
361
|
}, { once: !0 }))),
|
|
141
362
|
input: null,
|
|
142
363
|
invocationId: "canceled-capability",
|
|
143
|
-
program:
|
|
364
|
+
program: l(e, "export default async (_input, context) => context.actions.example.wait({})"),
|
|
144
365
|
signal: t.signal
|
|
145
366
|
});
|
|
146
|
-
await i, t.abort(/* @__PURE__ */ Error("Invocation canceled.")), await
|
|
367
|
+
await i, t.abort(/* @__PURE__ */ Error("Invocation canceled.")), await d(a, /cancel|abort|disposed/i, "Canceled invocation"), u(n, !0, "Capability cancellation");
|
|
147
368
|
}
|
|
148
369
|
}
|
|
149
370
|
];
|
|
371
|
+
function p(e) {
|
|
372
|
+
let t = (e, n) => {
|
|
373
|
+
if (!(e === null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e))) {
|
|
374
|
+
if (typeof e != "object" || n.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" });
|
|
375
|
+
n.add(e);
|
|
376
|
+
for (let r of Array.isArray(e) ? e : Object.values(e)) t(r, n);
|
|
377
|
+
n.delete(e);
|
|
378
|
+
}
|
|
379
|
+
}, n = Object.create(null), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = (n) => {
|
|
380
|
+
let i = r.get(n);
|
|
381
|
+
return i ?? (i = async (r = {}, i) => (t(r, /* @__PURE__ */ new Set()), i !== void 0 && t(i, /* @__PURE__ */ new Set()), (await e({
|
|
382
|
+
action: n,
|
|
383
|
+
input: r,
|
|
384
|
+
...i === void 0 ? {} : { options: i }
|
|
385
|
+
})).body), r.set(n, i), i);
|
|
386
|
+
};
|
|
387
|
+
return n.call = async (e, t = {}, n) => {
|
|
388
|
+
if (typeof e != "string") throw Object.assign(/* @__PURE__ */ Error("Action ID must be a string."), { code: "capability.invalid" });
|
|
389
|
+
return a(e)(t, n);
|
|
390
|
+
}, Object.freeze(n), new Proxy(n, { get(e, t) {
|
|
391
|
+
if (typeof t != "string") return Reflect.get(e, t);
|
|
392
|
+
if (Object.hasOwn(e, t)) return e[t];
|
|
393
|
+
if (t.includes(".")) return a(t);
|
|
394
|
+
let n = i.get(t);
|
|
395
|
+
if (n == null) {
|
|
396
|
+
let e = t, r = Object.freeze(Object.create(null));
|
|
397
|
+
n = new Proxy(r, { get(t, n) {
|
|
398
|
+
return typeof n == "string" ? a(`${e}.${n}`) : void 0;
|
|
399
|
+
} }), i.set(t, n);
|
|
400
|
+
}
|
|
401
|
+
return n;
|
|
402
|
+
} });
|
|
403
|
+
}
|
|
404
|
+
function m(e, t) {
|
|
405
|
+
let n = Object.assign(/* @__PURE__ */ Error("The Action request is invalid."), { code: "capability.invalid" }), r = Object.assign(/* @__PURE__ */ Error("The Action or Connection is unavailable for this Code node."), { code: "capability.denied" });
|
|
406
|
+
if (typeof t != "object" || !t || Array.isArray(t)) throw n;
|
|
407
|
+
let i = t;
|
|
408
|
+
if (Object.keys(i).some((e) => ![
|
|
409
|
+
"action",
|
|
410
|
+
"input",
|
|
411
|
+
"options"
|
|
412
|
+
].includes(e)) || typeof i.action != "string" || !/^[A-Za-z0-9_-]+\.[A-Za-z0-9_.-]+$/.test(i.action) || i.input == null || typeof i.input != "object" || Array.isArray(i.input)) throw n;
|
|
413
|
+
let a = e.find((e) => "mode" in e), o = a?.mode == "independent" ? a.actions.find((e) => e.action == i.action) : void 0;
|
|
414
|
+
if (a?.mode == "independent" && o == null) throw r;
|
|
415
|
+
let s = e.flatMap((e) => "mode" in e ? [] : "action" in e ? e.action == i.action ? [...e.connections.flatMap((t) => t.alias == null ? [] : [{
|
|
416
|
+
action: e.action,
|
|
417
|
+
connectionId: t.connectionId,
|
|
418
|
+
alias: t.alias
|
|
419
|
+
}]), ...e.connectionId == null ? [] : [{
|
|
420
|
+
action: e.action,
|
|
421
|
+
connectionId: e.connectionId
|
|
422
|
+
}]] : [] : e.connectionHints?.filter((e) => e.action == i.action) ?? []), c = s.find((e) => e.alias == null)?.connectionId;
|
|
423
|
+
if (Object.hasOwn(i, "options")) {
|
|
424
|
+
if (i.options == null || typeof i.options != "object" || Array.isArray(i.options)) throw n;
|
|
425
|
+
let e = i.options, t = Object.keys(e);
|
|
426
|
+
if (t.length != 1) throw n;
|
|
427
|
+
if (typeof e.connectionId == "string" && e.connectionId.length > 0 && t[0] == "connectionId") c = e.connectionId;
|
|
428
|
+
else if (typeof e.connectionAlias == "string" && e.connectionAlias.length > 0 && t[0] == "connectionAlias") {
|
|
429
|
+
if (c = s.find((t) => t.alias == e.connectionAlias)?.connectionId, c == null) throw r;
|
|
430
|
+
} else throw n;
|
|
431
|
+
}
|
|
432
|
+
if (a?.mode == "independent") {
|
|
433
|
+
if (c != null && c != o?.connectionId) throw r;
|
|
434
|
+
c = o?.connectionId;
|
|
435
|
+
}
|
|
436
|
+
if (a?.mode == "shared" && Object.hasOwn(i, "options") && c == null) throw r;
|
|
437
|
+
return {
|
|
438
|
+
action: i.action,
|
|
439
|
+
input: i.input,
|
|
440
|
+
...c == null ? {} : { connectionId: c }
|
|
441
|
+
};
|
|
442
|
+
}
|
|
150
443
|
//#endregion
|
|
151
|
-
export { n as currentEngineContract,
|
|
444
|
+
export { p as createActions, n as currentEngineContract, o as findEngineContract, r as nodejsEngineContract, c as nodejsRuntimeConformanceCases, m as resolveAction, f as runtimeConformanceCases, s as snapshotRuntimeResult };
|
|
@@ -1,6 +1,13 @@
|
|
|
1
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';
|
|
5
|
+
export declare const normalizeWaitComment: (value?: string | null) => string | null;
|
|
6
|
+
export interface WaitResolution {
|
|
7
|
+
readonly action: WaitAction;
|
|
8
|
+
readonly resolvedAt: string;
|
|
9
|
+
readonly comment: string | null;
|
|
10
|
+
}
|
|
4
11
|
export type SchedulerEvent = {
|
|
5
12
|
readonly flowId: string;
|
|
6
13
|
readonly parentJobId?: string;
|
|
@@ -17,20 +24,14 @@ export type SchedulerEvent = {
|
|
|
17
24
|
readonly inputs: Readonly<Record<string, JsonValue>>;
|
|
18
25
|
readonly jobId: string;
|
|
19
26
|
readonly nodeId: string;
|
|
20
|
-
readonly nodeKind: 'condition' | 'connector' | 'javascript' | 'llm' | 'subflow' | 'value' | 'wait';
|
|
27
|
+
readonly nodeKind: 'agent' | 'approval' | 'condition' | 'connector' | 'javascript' | 'llm' | 'subflow' | 'value' | 'wait';
|
|
21
28
|
readonly nodeTitle?: string;
|
|
22
29
|
readonly runId: string;
|
|
23
30
|
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
31
|
} | {
|
|
32
32
|
readonly jobId: string;
|
|
33
33
|
readonly nodeId: string;
|
|
34
|
+
readonly outputs: Readonly<Record<string, JsonValue>>;
|
|
34
35
|
readonly runId: string;
|
|
35
36
|
readonly type: 'node.completed';
|
|
36
37
|
} | {
|
|
@@ -59,58 +60,68 @@ export type SchedulerEvent = {
|
|
|
59
60
|
export interface FlowRunResult {
|
|
60
61
|
readonly kind: 'node-results';
|
|
61
62
|
readonly nodes: readonly {
|
|
62
|
-
readonly jobs: readonly {
|
|
63
|
-
readonly jobId: string;
|
|
64
|
-
readonly outputs: Readonly<Record<string, JsonValue>>;
|
|
65
|
-
}[];
|
|
66
63
|
readonly nodeId: string;
|
|
64
|
+
readonly status: 'completed';
|
|
65
|
+
readonly jobId: string;
|
|
66
|
+
readonly outputs: Readonly<Record<string, JsonValue>>;
|
|
67
67
|
}[];
|
|
68
68
|
}
|
|
69
|
-
export interface
|
|
70
|
-
readonly
|
|
71
|
-
readonly
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
};
|
|
69
|
+
export interface PendingWait {
|
|
70
|
+
readonly jobId: string;
|
|
71
|
+
readonly nodeId: string;
|
|
72
|
+
readonly value: JsonValue;
|
|
73
|
+
readonly waitId: string;
|
|
74
|
+
readonly pending?: JsonValue;
|
|
98
75
|
}
|
|
99
|
-
export
|
|
100
|
-
readonly
|
|
101
|
-
readonly
|
|
76
|
+
export interface WaitRequest {
|
|
77
|
+
readonly jobId: string;
|
|
78
|
+
readonly nodeId: string;
|
|
79
|
+
readonly value: JsonValue;
|
|
80
|
+
readonly waitId: string;
|
|
81
|
+
readonly actions: readonly ['continue'] | readonly ['approve', 'reject'];
|
|
82
|
+
readonly prompt: string;
|
|
83
|
+
readonly notify: boolean;
|
|
102
84
|
readonly notification?: {
|
|
103
85
|
readonly input: Readonly<Record<string, JsonValue>>;
|
|
104
86
|
readonly messageHandle: string;
|
|
105
87
|
readonly taskId: string;
|
|
106
88
|
};
|
|
107
|
-
|
|
108
|
-
|
|
89
|
+
}
|
|
90
|
+
export type WaitOperation = {
|
|
91
|
+
readonly kind: 'create';
|
|
92
|
+
readonly wait: WaitRequest;
|
|
93
|
+
} | {
|
|
94
|
+
readonly kind: 'resolutions';
|
|
95
|
+
readonly waitIds: readonly string[];
|
|
96
|
+
readonly block: boolean;
|
|
97
|
+
};
|
|
98
|
+
export interface WaitHost {
|
|
99
|
+
readonly create: (wait: WaitRequest) => Effect.Effect<JsonValue | undefined, Error>;
|
|
100
|
+
readonly resolutions: (waitIds: readonly string[], block: boolean) => Effect.Effect<Readonly<Record<string, WaitResolution>>, Error>;
|
|
101
|
+
}
|
|
102
|
+
export declare const waitRetentionMs = 120000;
|
|
103
|
+
export interface FlowRunCheckpoint {
|
|
104
|
+
readonly bindingValues: Readonly<Record<string, string>>;
|
|
105
|
+
readonly inputs: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
|
|
106
|
+
readonly results: Readonly<Record<string, {
|
|
109
107
|
readonly jobId: string;
|
|
110
|
-
readonly
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
readonly outputs: Readonly<Record<string, JsonValue>>;
|
|
109
|
+
}>>;
|
|
110
|
+
readonly counts: Readonly<Record<string, Readonly<Record<string, number>>>>;
|
|
111
|
+
readonly frames: Readonly<Record<string, Readonly<Record<string, Readonly<Record<string, JsonValue>>>>>>;
|
|
112
|
+
readonly version: 5;
|
|
113
|
+
readonly waits: readonly PendingWait[];
|
|
114
|
+
readonly agents: Readonly<Record<string, {
|
|
115
|
+
readonly invocationId: string;
|
|
116
|
+
readonly input: Readonly<Record<string, JsonValue>>;
|
|
117
|
+
readonly remainingMs?: number;
|
|
118
|
+
readonly checkpoint: AgentCheckpoint;
|
|
119
|
+
}>>;
|
|
120
|
+
}
|
|
121
|
+
export type FlowRunOutcome = FlowRunResult | {
|
|
122
|
+
readonly checkpoint: FlowRunCheckpoint;
|
|
123
|
+
readonly kind: 'waiting';
|
|
124
|
+
readonly remainingMs?: number;
|
|
114
125
|
};
|
|
115
126
|
export interface SubflowRunResult {
|
|
116
127
|
readonly kind: 'function-outputs';
|
|
@@ -118,6 +129,10 @@ export interface SubflowRunResult {
|
|
|
118
129
|
readonly target: 'subflow';
|
|
119
130
|
}
|
|
120
131
|
interface TaskInvocationBase {
|
|
132
|
+
readonly agent?: {
|
|
133
|
+
readonly action: 'approve' | 'reject';
|
|
134
|
+
readonly checkpoint: AgentCheckpoint;
|
|
135
|
+
};
|
|
121
136
|
readonly additionalInputs: Readonly<Record<string, JsonValue>>;
|
|
122
137
|
readonly blockId: string;
|
|
123
138
|
readonly flowId: string;
|
|
@@ -135,27 +150,35 @@ export type TaskInvocation = TaskInvocationBase & ({
|
|
|
135
150
|
});
|
|
136
151
|
export interface TriggerSeed {
|
|
137
152
|
readonly nodeId: string;
|
|
138
|
-
readonly
|
|
153
|
+
readonly outputs: Readonly<Record<string, JsonValue>>;
|
|
139
154
|
}
|
|
140
155
|
export interface SchedulerFailure {
|
|
141
156
|
readonly code: string;
|
|
142
157
|
readonly message: string;
|
|
143
158
|
}
|
|
144
|
-
export
|
|
145
|
-
readonly bindingValues?: Readonly<Record<string, string>>;
|
|
159
|
+
export type FlowRunOptions = {
|
|
146
160
|
readonly createId: () => string;
|
|
147
161
|
readonly emit?: (event: SchedulerEvent) => Effect.Effect<void, Error>;
|
|
148
162
|
readonly flowId: string;
|
|
149
|
-
readonly inputs?: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
|
|
150
163
|
readonly invokeTask: (invocation: TaskInvocation) => Effect.Effect<unknown, Error>;
|
|
151
164
|
readonly projectFailure?: (error: unknown) => SchedulerFailure;
|
|
152
|
-
readonly
|
|
153
|
-
|
|
165
|
+
readonly runId: string;
|
|
166
|
+
readonly waits?: WaitHost;
|
|
167
|
+
readonly remainingMs?: number;
|
|
168
|
+
} & RunLaunch;
|
|
169
|
+
export type RunLaunch = {
|
|
170
|
+
readonly bindingValues?: Readonly<Record<string, string>>;
|
|
171
|
+
readonly inputs?: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
|
|
172
|
+
readonly trigger: TriggerSeed;
|
|
173
|
+
readonly resume?: never;
|
|
174
|
+
} | {
|
|
175
|
+
readonly resume: {
|
|
154
176
|
readonly checkpoint: unknown;
|
|
155
177
|
};
|
|
156
|
-
readonly
|
|
157
|
-
readonly
|
|
158
|
-
|
|
159
|
-
|
|
178
|
+
readonly bindingValues?: never;
|
|
179
|
+
readonly inputs?: never;
|
|
180
|
+
readonly trigger?: never;
|
|
181
|
+
};
|
|
182
|
+
export declare function decodeFlowRunCheckpoint(input: unknown): FlowRunCheckpoint;
|
|
160
183
|
export declare function runFlow(prepared: PreparedFlow, options: FlowRunOptions): Effect.Effect<FlowRunOutcome, Error>;
|
|
161
184
|
export {};
|