@oomol-lab/open-flow 0.1.0-beta.76 → 0.1.0-beta.78
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 +3 -0
- package/dist/browser/{ContentIcon-Cm1hbVzW.js → ContentIcon-CMn0c-kl.js} +99 -6
- package/dist/browser/{FlowCanvas-NzKtla_c.js → FlowCanvas-BQGBcfoL.js} +1709 -613
- package/dist/browser/{createResourceDialog-BgdedQqu.js → createResourceDialog-DCGxfKFM.js} +63 -57
- package/dist/browser/{dialog-aSElFFw2.js → dialog-WzR4CRFH.js} +76 -77
- package/dist/browser/{exportSvg-Dcz4HTo_.js → exportSvg-CYwyYiuH.js} +2 -2
- package/dist/browser/{flowChanges-NZyS7HSp.js → flowChanges-Bz4dbDN_.js} +6875 -11091
- package/dist/browser/{flowWorkspace-Bl0SDehy.js → flowWorkspace-BI6L6a4r.js} +1415 -3037
- package/dist/browser/licenses.md +1 -1
- package/dist/browser/preview.css +619 -462
- package/dist/browser/preview.js +9016 -14956
- package/dist/browser/theme.css +4 -2
- package/dist/browser/{tooltip-3XMK9jkr.js → tooltip-BDcVTNpu.js} +65 -2
- package/dist/browser/{typeScriptSession-C9sBGOKZ.js → typeScriptSession-CRoezJPN.js} +1 -1
- package/dist/browser/ui.css +112 -24
- package/dist/browser/ui.js +3 -2
- package/dist/browser/workbench.css +10020 -9842
- package/dist/browser/workbench.d.ts +5 -2
- package/dist/browser/workbench.js +2382 -2668
- package/dist/browser/{workbenchSelect-DBGP7Y4Z.js → workbenchSelect-DtAd0zc4.js} +2 -2
- package/dist/command/index.js +48 -48
- package/dist/common/authoring.d.ts +4 -4
- package/dist/common/authoringExamples.d.ts +3 -2
- package/dist/common/authoringSchema.d.ts +15 -4
- package/dist/common/control-api-conformance.js +155 -15
- package/dist/common/control-api-errors.d.ts +12 -0
- package/dist/common/control-api.d.ts +39 -2
- package/dist/common/control-api.js +180 -37
- package/dist/common/control-requests.d.ts +23 -3
- package/dist/common/control-requests.js +141 -14
- package/dist/common/engine-contract.d.ts +3 -2
- package/dist/common/flow-authoring.js +47 -7
- package/dist/common/flow-change-schema.d.ts +1 -1
- package/dist/common/flow-change.d.ts +2 -2
- package/dist/common/flow-change.js +48 -8
- package/dist/common/flow-encoding.js +47 -7
- package/dist/common/flow-semantics.js +86 -8
- package/dist/common/flow-state.d.ts +100 -0
- package/dist/common/flow-state.js +5794 -0
- package/dist/common/mcp.d.ts +96 -3
- package/dist/common/mcp.js +158 -13
- package/dist/common/run-events.js +19 -8
- package/dist/common/runtime-contract.d.ts +14 -0
- package/dist/common/runtime-contract.js +124 -17
- package/dist/common/runtime-nodejs-compat.js +11 -12
- package/dist/common/scheduler-node-execution.d.ts +1 -0
- package/dist/common/scheduler.d.ts +2 -1
- package/dist/common/scheduler.js +95 -40
- package/dist/common/state-conformance.d.ts +16 -0
- package/dist/common/tags.d.ts +4 -0
- package/dist/index.d.ts +11 -0
- package/package.json +5 -1
- package/src/control/common/api.ts +101 -11
- package/src/control/common/authoring.ts +7 -1
- package/src/control/common/authoringExamples.ts +9 -0
- package/src/control/common/authoringSchema.ts +18 -12
- package/src/control/common/errors.ts +6 -0
- package/src/control/common/flowDecoders.ts +1 -0
- package/src/control/common/mcp.ts +16 -0
- package/src/control/common/requests.ts +16 -2
- package/src/control/common/tags.ts +20 -0
- package/src/execution/common/events.ts +22 -7
- package/src/execution/common/node-execution.ts +3 -0
- package/src/execution/common/scheduler.ts +29 -13
- package/src/flow/common/change.ts +2 -1
- package/src/flow/common/changeSchema.ts +11 -1
- package/src/flow/common/errorHandling.ts +1 -1
- package/src/flow/common/semantics.ts +27 -1
- package/src/runtime/common/engineContract.ts +6 -3
- package/src/runtime/common/nodejsGuest.generated.json +11 -12
- package/src/runtime/common/runtime.ts +122 -7
- package/src/state/common/conformance.ts +81 -0
- package/src/state/common/state.ts +141 -0
- package/src/types/index.ts +11 -0
|
@@ -8604,6 +8604,43 @@ var httpRequestExecutorSchema = strictObject({
|
|
|
8604
8604
|
]).default("auto"),
|
|
8605
8605
|
statusPolicy: _enum(["success", "all"]).default("success")
|
|
8606
8606
|
}).extend({ kind: literal("http-request") });
|
|
8607
|
+
strictObject({
|
|
8608
|
+
scope: _enum(["draft", "live"]),
|
|
8609
|
+
values: boolean().optional()
|
|
8610
|
+
});
|
|
8611
|
+
strictObject({
|
|
8612
|
+
scope: _enum(["draft", "live"]),
|
|
8613
|
+
key: string().min(1).refine((key) => new TextEncoder().encode(key).length <= 256).optional()
|
|
8614
|
+
});
|
|
8615
|
+
strictObject({
|
|
8616
|
+
scope: _enum(["draft", "live"]),
|
|
8617
|
+
space: string().regex(/^(flow|node:.+)$/)
|
|
8618
|
+
});
|
|
8619
|
+
var skipDuplicatesExecutorSchema = strictObject({ fields: array(string().refine((field) => field.length > 0 && field.split(".").every((part) => part.length > 0), "Use a nonempty dot-separated field path.")).refine((fields) => new Set(fields).size === fields.length, "Identity fields must be distinct.").default([]) }).extend({ kind: literal("skip-duplicates") });
|
|
8620
|
+
object({
|
|
8621
|
+
version: literal(1),
|
|
8622
|
+
scope: _enum(["draft", "live"]),
|
|
8623
|
+
limits: object({
|
|
8624
|
+
maxValueBytes: number().positive(),
|
|
8625
|
+
maxValues: number().int().positive(),
|
|
8626
|
+
maxSpaces: number().int().positive(),
|
|
8627
|
+
maxIdentities: number().positive(),
|
|
8628
|
+
maxRunWrites: number().positive()
|
|
8629
|
+
}),
|
|
8630
|
+
values: array(object({
|
|
8631
|
+
key: string(),
|
|
8632
|
+
size: number().nonnegative(),
|
|
8633
|
+
updatedAt: number(),
|
|
8634
|
+
value: json$1().optional()
|
|
8635
|
+
})),
|
|
8636
|
+
spaces: array(object({
|
|
8637
|
+
space: string(),
|
|
8638
|
+
count: number().nonnegative(),
|
|
8639
|
+
pendingCount: number().nonnegative(),
|
|
8640
|
+
reservedCount: number().nonnegative(),
|
|
8641
|
+
updatedAt: number()
|
|
8642
|
+
}))
|
|
8643
|
+
});
|
|
8607
8644
|
//#endregion
|
|
8608
8645
|
//#region src/flow/common/json.ts
|
|
8609
8646
|
var maxJsonDepth = 64;
|
|
@@ -8890,7 +8927,8 @@ var managedFields = object({
|
|
|
8890
8927
|
flowId: text,
|
|
8891
8928
|
revisionId: text
|
|
8892
8929
|
}),
|
|
8893
|
-
httpRequestExecutorSchema
|
|
8930
|
+
httpRequestExecutorSchema,
|
|
8931
|
+
skipDuplicatesExecutorSchema
|
|
8894
8932
|
])
|
|
8895
8933
|
});
|
|
8896
8934
|
var managed = managedFields.transform(limitDecisionTask);
|
|
@@ -9144,7 +9182,8 @@ var revision = object({
|
|
|
9144
9182
|
literal(9),
|
|
9145
9183
|
literal(10),
|
|
9146
9184
|
literal(11),
|
|
9147
|
-
literal(12)
|
|
9185
|
+
literal(12),
|
|
9186
|
+
literal(13)
|
|
9148
9187
|
]),
|
|
9149
9188
|
document,
|
|
9150
9189
|
modules: record$1(text, module)
|
|
@@ -9399,14 +9438,14 @@ function repairRevisionEnvelope(value) {
|
|
|
9399
9438
|
checkJsonDepth(value);
|
|
9400
9439
|
const envelopeSource = record(value);
|
|
9401
9440
|
if (envelopeSource.kind != "open-flow-flow-revision" || envelopeSource.version != 1) throw new TypeError("The value is not an Open Flow Revision envelope.");
|
|
9402
|
-
if (typeof envelopeSource.modelVersion == "number" && envelopeSource.modelVersion >
|
|
9441
|
+
if (typeof envelopeSource.modelVersion == "number" && envelopeSource.modelVersion > 13) throw new TypeError("The Flow model is newer than this package.");
|
|
9403
9442
|
let sourceDocument = record(envelopeSource.modelVersion == 1 || envelopeSource.modelVersion == 2 ? upgradeLegacyDocument(envelopeSource.document) : envelopeSource.document);
|
|
9404
9443
|
if (typeof envelopeSource.modelVersion == "number" && envelopeSource.modelVersion < 6) sourceDocument = upgradeTaskNodes(sourceDocument);
|
|
9405
9444
|
sourceDocument = record(normalizeDocument(sourceDocument));
|
|
9406
9445
|
const bindings = record(sourceDocument.bindings);
|
|
9407
9446
|
const sourceGraph = repairGraph(sourceDocument.graph, bindings);
|
|
9408
9447
|
return decodeRevisionContent({
|
|
9409
|
-
modelVersion:
|
|
9448
|
+
modelVersion: 13,
|
|
9410
9449
|
document: {
|
|
9411
9450
|
bindings: repairedEntries(sourceDocument.bindings, binding),
|
|
9412
9451
|
graph: sourceGraph
|
|
@@ -9608,6 +9647,7 @@ array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, sha
|
|
|
9608
9647
|
...shape
|
|
9609
9648
|
})])).values()])).min(1);
|
|
9610
9649
|
function checkModelVersion(content) {
|
|
9650
|
+
if (content.modelVersion < 13 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind === "task" && "executor" in candidateNode.task && candidateNode.task.executor.kind === "skip-duplicates")) throw new Error("Skip Duplicates requires Flow model v13.");
|
|
9611
9651
|
if (content.modelVersion < 12 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && "moduleId" in candidateNode.task && candidateNode.task.capabilities?.some((item) => item.kind == "http"))) throw new TypeError("Code HTTP access requires Flow model version 12.");
|
|
9612
9652
|
if (content.modelVersion < 11 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && "executor" in candidateNode.task && candidateNode.task.executor.kind == "http-request")) throw new TypeError("HTTP Request requires Flow model version 11.");
|
|
9613
9653
|
if (content.modelVersion < 11 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && ("moduleId" in candidateNode.task ? candidateNode.task.capabilities?.some((item) => item.kind == "workflow") : candidateNode.task.executor.kind == "agent" && candidateNode.task.executor.tools.some((item) => item.kind == "workflow")))) throw new TypeError("Workflow tools require Flow model version 11.");
|
|
@@ -9669,10 +9709,10 @@ function upgradeRevisionContent(content) {
|
|
|
9669
9709
|
function upgradeDecodedRevisionContent(content) {
|
|
9670
9710
|
const graph = content.document.graph;
|
|
9671
9711
|
const hasManual = Object.values(graph.nodes).some((node) => node.kind == "manual");
|
|
9672
|
-
if (!hasManual && content.modelVersion ==
|
|
9712
|
+
if (!hasManual && content.modelVersion == 13) return content;
|
|
9673
9713
|
return {
|
|
9674
9714
|
...content,
|
|
9675
|
-
modelVersion:
|
|
9715
|
+
modelVersion: 13,
|
|
9676
9716
|
document: {
|
|
9677
9717
|
...content.document,
|
|
9678
9718
|
graph: hasManual ? {
|
|
@@ -10244,7 +10284,7 @@ function revisionRepairKind(bytes) {
|
|
|
10244
10284
|
return;
|
|
10245
10285
|
}
|
|
10246
10286
|
const source = value;
|
|
10247
|
-
return typeof source.modelVersion == "number" && source.modelVersion <
|
|
10287
|
+
return typeof source.modelVersion == "number" && source.modelVersion < 13 ? "upgrade" : "repair";
|
|
10248
10288
|
}
|
|
10249
10289
|
function repairRevision(bytes) {
|
|
10250
10290
|
return repairRevisionEnvelope(revisionValue(bytes));
|
|
@@ -10362,6 +10362,63 @@ function openApiFieldIssues(task) {
|
|
|
10362
10362
|
function openApiIssues(task) {
|
|
10363
10363
|
return openApiFieldIssues(task).map((issue) => issue.message);
|
|
10364
10364
|
}
|
|
10365
|
+
strictObject({
|
|
10366
|
+
scope: _enum(["draft", "live"]),
|
|
10367
|
+
values: boolean().optional()
|
|
10368
|
+
});
|
|
10369
|
+
strictObject({
|
|
10370
|
+
scope: _enum(["draft", "live"]),
|
|
10371
|
+
key: string().min(1).refine((key) => new TextEncoder().encode(key).length <= 256).optional()
|
|
10372
|
+
});
|
|
10373
|
+
strictObject({
|
|
10374
|
+
scope: _enum(["draft", "live"]),
|
|
10375
|
+
space: string().regex(/^(flow|node:.+)$/)
|
|
10376
|
+
});
|
|
10377
|
+
var skipDuplicatesConfigSchema = strictObject({ fields: array(string().refine((field) => field.length > 0 && field.split(".").every((part) => part.length > 0), "Use a nonempty dot-separated field path.")).refine((fields) => new Set(fields).size === fields.length, "Identity fields must be distinct.").default([]) });
|
|
10378
|
+
var skipDuplicatesExecutorSchema = skipDuplicatesConfigSchema.extend({ kind: literal("skip-duplicates") });
|
|
10379
|
+
function skipDuplicatesTask(config = skipDuplicatesConfigSchema.parse({}), name = "Skip Duplicates") {
|
|
10380
|
+
return {
|
|
10381
|
+
name,
|
|
10382
|
+
executor: {
|
|
10383
|
+
...config,
|
|
10384
|
+
kind: "skip-duplicates"
|
|
10385
|
+
},
|
|
10386
|
+
inputs: [{
|
|
10387
|
+
handle: "items",
|
|
10388
|
+
jsonSchema: { type: "array" },
|
|
10389
|
+
nullable: false
|
|
10390
|
+
}],
|
|
10391
|
+
outputs: ["items", "duplicates"].map((handle) => ({
|
|
10392
|
+
handle,
|
|
10393
|
+
jsonSchema: { type: "array" },
|
|
10394
|
+
nullable: false
|
|
10395
|
+
}))
|
|
10396
|
+
};
|
|
10397
|
+
}
|
|
10398
|
+
object$1({
|
|
10399
|
+
version: literal(1),
|
|
10400
|
+
scope: _enum(["draft", "live"]),
|
|
10401
|
+
limits: object$1({
|
|
10402
|
+
maxValueBytes: number().positive(),
|
|
10403
|
+
maxValues: number().int().positive(),
|
|
10404
|
+
maxSpaces: number().int().positive(),
|
|
10405
|
+
maxIdentities: number().positive(),
|
|
10406
|
+
maxRunWrites: number().positive()
|
|
10407
|
+
}),
|
|
10408
|
+
values: array(object$1({
|
|
10409
|
+
key: string(),
|
|
10410
|
+
size: number().nonnegative(),
|
|
10411
|
+
updatedAt: number(),
|
|
10412
|
+
value: json$1().optional()
|
|
10413
|
+
})),
|
|
10414
|
+
spaces: array(object$1({
|
|
10415
|
+
space: string(),
|
|
10416
|
+
count: number().nonnegative(),
|
|
10417
|
+
pendingCount: number().nonnegative(),
|
|
10418
|
+
reservedCount: number().nonnegative(),
|
|
10419
|
+
updatedAt: number()
|
|
10420
|
+
}))
|
|
10421
|
+
});
|
|
10365
10422
|
//#endregion
|
|
10366
10423
|
//#region src/flow/common/inputValue.ts
|
|
10367
10424
|
/** An explicit clear suppresses the default; absent mappings still inherit it. */
|
|
@@ -10736,7 +10793,8 @@ var managedFields = object$1({
|
|
|
10736
10793
|
flowId: text,
|
|
10737
10794
|
revisionId: text
|
|
10738
10795
|
}),
|
|
10739
|
-
httpRequestExecutorSchema
|
|
10796
|
+
httpRequestExecutorSchema,
|
|
10797
|
+
skipDuplicatesExecutorSchema
|
|
10740
10798
|
])
|
|
10741
10799
|
});
|
|
10742
10800
|
var managed = managedFields.transform(limitDecisionTask);
|
|
@@ -11006,7 +11064,8 @@ object$1({
|
|
|
11006
11064
|
literal(9),
|
|
11007
11065
|
literal(10),
|
|
11008
11066
|
literal(11),
|
|
11009
|
-
literal(12)
|
|
11067
|
+
literal(12),
|
|
11068
|
+
literal(13)
|
|
11010
11069
|
]),
|
|
11011
11070
|
document,
|
|
11012
11071
|
modules: record$1(text, module)
|
|
@@ -11352,7 +11411,7 @@ var nodeErrorSchema = {
|
|
|
11352
11411
|
}
|
|
11353
11412
|
};
|
|
11354
11413
|
function supportsNodeErrorHandling(node) {
|
|
11355
|
-
return supportsNodeRetry(node);
|
|
11414
|
+
return supportsNodeRetry(node) || node.kind === "task" && "executor" in node.task && node.task.executor.kind === "skip-duplicates";
|
|
11356
11415
|
}
|
|
11357
11416
|
function nodeSystemOutputPorts(node) {
|
|
11358
11417
|
return supportsNodeErrorHandling(node) && node.onError == "error" ? { error: {
|
|
@@ -11880,8 +11939,8 @@ function normalizeTriggerOutputs(trigger, outputs) {
|
|
|
11880
11939
|
}
|
|
11881
11940
|
//#endregion
|
|
11882
11941
|
//#region src/runtime/common/engineContract.ts
|
|
11883
|
-
/**
|
|
11884
|
-
var currentEngineContract = "open-flow-engine/
|
|
11942
|
+
/** v10 adds persistent Flow State to the published v9 Node compatibility and fetch contract. */
|
|
11943
|
+
var currentEngineContract = "open-flow-engine/v10";
|
|
11885
11944
|
/** The published v8 Node compatibility contract, retained for existing Publications and Runs. */
|
|
11886
11945
|
var nodejsEngineContract = "open-flow-engine/v8/nodejs-compat-v1";
|
|
11887
11946
|
var platformSource = (contract) => `export const engineContract = ${JSON.stringify(contract)}
|
|
@@ -11926,13 +11985,19 @@ var nodejsContract = {
|
|
|
11926
11985
|
].flatMap((name) => [name, `node:${name}`])),
|
|
11927
11986
|
platformSource: platformSource(nodejsEngineContract)
|
|
11928
11987
|
};
|
|
11929
|
-
var
|
|
11988
|
+
var v9Contract = {
|
|
11930
11989
|
...nodejsContract,
|
|
11931
11990
|
codeFetch: true,
|
|
11991
|
+
platformSource: platformSource("open-flow-engine/v9")
|
|
11992
|
+
};
|
|
11993
|
+
var currentContract = {
|
|
11994
|
+
...v9Contract,
|
|
11995
|
+
flowState: true,
|
|
11932
11996
|
platformSource: platformSource(currentEngineContract)
|
|
11933
11997
|
};
|
|
11934
11998
|
function findEngineContract(contract) {
|
|
11935
|
-
if (contract == "open-flow-engine/
|
|
11999
|
+
if (contract == "open-flow-engine/v10") return currentContract;
|
|
12000
|
+
if (contract == "open-flow-engine/v9") return v9Contract;
|
|
11936
12001
|
if (contract == "open-flow-engine/v8") return v8Contract;
|
|
11937
12002
|
if (contract == "open-flow-engine/v8/nodejs-compat-v1") return nodejsContract;
|
|
11938
12003
|
if (contract == "open-flow-engine/v7" || contract == "open-flow-engine/v7/nodejs-compat-v1") return {
|
|
@@ -24934,6 +24999,16 @@ async function validateFlow(revision, engine) {
|
|
|
24934
24999
|
message,
|
|
24935
25000
|
path: `/document/graph/nodes/${nodeId}/task/executor`
|
|
24936
25001
|
});
|
|
25002
|
+
if (task.executor.kind === "skip-duplicates") {
|
|
25003
|
+
const expected = skipDuplicatesTask(task.executor);
|
|
25004
|
+
if (!dequal(httpPortContracts(task.inputs), httpPortContracts(expected.inputs)) || !dequal(httpPortContracts(task.outputs), httpPortContracts(expected.outputs))) checked.diagnostics.push({
|
|
25005
|
+
code: "skip-duplicates.ports-invalid",
|
|
25006
|
+
column: 0,
|
|
25007
|
+
line: 1,
|
|
25008
|
+
message: "Deduplication ports must match the fixed contract.",
|
|
25009
|
+
path: `/document/graph/nodes/${nodeId}/task`
|
|
25010
|
+
});
|
|
25011
|
+
}
|
|
24937
25012
|
if (task.executor.kind == "http-request") {
|
|
24938
25013
|
for (const issue of httpRequestIssues(task.executor)) checked.diagnostics.push({
|
|
24939
25014
|
code: "http-request.config-invalid",
|
|
@@ -25068,6 +25143,7 @@ var httpPortContracts = (ports) => ports.filter((port) => "handle" in port).map(
|
|
|
25068
25143
|
async function prepareFlow(revision, engineContract, triggerId) {
|
|
25069
25144
|
const engine = findEngineContract(engineContract);
|
|
25070
25145
|
if (engine == null) return { kind: "engine-unsupported" };
|
|
25146
|
+
if (!engine.flowState && Object.values(revision.document.graph.nodes).some((node) => node.kind === "task" && "executor" in node.task && node.task.executor.kind === "skip-duplicates")) return { kind: "engine-unsupported" };
|
|
25071
25147
|
if (!engine.httpRequests && Object.values(revision.document.graph.nodes).some((node) => node.kind == "task" && "executor" in node.task && node.task.executor.kind == "http-request")) return { kind: "engine-unsupported" };
|
|
25072
25148
|
if (!engine.codeFetch && Object.values(revision.document.graph.nodes).some((node) => node.kind == "task" && "moduleId" in node.task && node.task.capabilities?.some((item) => item.kind == "http"))) return { kind: "engine-unsupported" };
|
|
25073
25149
|
if (!engine.workflowTools && Object.values(revision.document.graph.nodes).some((node) => nodeWorkflowReferences(node).some((ref) => ref.tool != null))) return { kind: "engine-unsupported" };
|
|
@@ -25116,11 +25192,13 @@ async function prepareFlow(revision, engineContract, triggerId) {
|
|
|
25116
25192
|
}
|
|
25117
25193
|
function createRuntimeProgram(prepared, entryModuleId, engineDigest) {
|
|
25118
25194
|
if (!Object.hasOwn(prepared.modules, entryModuleId)) return;
|
|
25195
|
+
const modules = /* @__PURE__ */ new Set([entryModuleId]);
|
|
25196
|
+
for (const id of modules) for (const imported of prepared.modules[id].imports) modules.add(imported);
|
|
25119
25197
|
return {
|
|
25120
25198
|
engineContract: prepared.engineContract,
|
|
25121
25199
|
engineDigest,
|
|
25122
25200
|
entryModuleId,
|
|
25123
|
-
modules: prepared.modules
|
|
25201
|
+
modules: Object.fromEntries([...modules].map((id) => [id, prepared.modules[id]]))
|
|
25124
25202
|
};
|
|
25125
25203
|
}
|
|
25126
25204
|
function agentActions(flow) {
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { JsonValue, ManagedTaskDefinitionOf } from './flow-model.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export { stateConformanceCases, type StateConformanceHarness } from './state-conformance.js';
|
|
4
|
+
export type StateScope = 'draft' | 'live';
|
|
5
|
+
export declare const stateQuerySchema: z.ZodObject<{
|
|
6
|
+
scope: z.ZodEnum<{
|
|
7
|
+
draft: "draft";
|
|
8
|
+
live: "live";
|
|
9
|
+
}>;
|
|
10
|
+
values: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
export declare const stateClearSchema: z.ZodObject<{
|
|
13
|
+
scope: z.ZodEnum<{
|
|
14
|
+
draft: "draft";
|
|
15
|
+
live: "live";
|
|
16
|
+
}>;
|
|
17
|
+
key: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
export declare const dedupeClearSchema: z.ZodObject<{
|
|
20
|
+
scope: z.ZodEnum<{
|
|
21
|
+
draft: "draft";
|
|
22
|
+
live: "live";
|
|
23
|
+
}>;
|
|
24
|
+
space: z.ZodString;
|
|
25
|
+
}, z.core.$strict>;
|
|
26
|
+
export type DedupeIdentity = string | number;
|
|
27
|
+
export declare const skipDuplicatesConfigSchema: z.ZodObject<{
|
|
28
|
+
fields: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
29
|
+
}, z.core.$strict>;
|
|
30
|
+
export type SkipDuplicatesConfig = z.infer<typeof skipDuplicatesConfigSchema>;
|
|
31
|
+
export interface SkipDuplicatesExecutor extends SkipDuplicatesConfig {
|
|
32
|
+
readonly kind: 'skip-duplicates';
|
|
33
|
+
}
|
|
34
|
+
export declare const skipDuplicatesExecutorSchema: z.ZodObject<{
|
|
35
|
+
fields: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
36
|
+
kind: z.ZodLiteral<"skip-duplicates">;
|
|
37
|
+
}, z.core.$strict>;
|
|
38
|
+
export declare function skipDuplicatesTask(config?: SkipDuplicatesConfig, name?: string): ManagedTaskDefinitionOf<SkipDuplicatesExecutor>;
|
|
39
|
+
export declare class StateError extends Error {
|
|
40
|
+
readonly retryable = false;
|
|
41
|
+
readonly catchable: boolean;
|
|
42
|
+
readonly code: 'capability.invalid' | 'capability.denied' | 'dedupe.full' | 'limit-exceeded' | 'node.input-invalid';
|
|
43
|
+
constructor(code: StateError['code'], message: string);
|
|
44
|
+
}
|
|
45
|
+
export declare function stateKey(key: unknown): string;
|
|
46
|
+
export declare function dedupeIdentities(value: unknown): DedupeIdentity[];
|
|
47
|
+
export declare function hashIdentities(ids: readonly DedupeIdentity[]): Promise<Uint8Array[]>;
|
|
48
|
+
/** Canonical identities include the field definition and preserve scalar types. */
|
|
49
|
+
export declare function skipDuplicatesIdentities(items: JsonValue, fields: readonly string[]): string[];
|
|
50
|
+
export interface FlowStateView {
|
|
51
|
+
readonly version: 1;
|
|
52
|
+
readonly scope: StateScope;
|
|
53
|
+
readonly limits: {
|
|
54
|
+
readonly maxValueBytes: number;
|
|
55
|
+
readonly maxValues: number;
|
|
56
|
+
readonly maxSpaces: number;
|
|
57
|
+
readonly maxIdentities: number;
|
|
58
|
+
readonly maxRunWrites: number;
|
|
59
|
+
};
|
|
60
|
+
readonly values: readonly {
|
|
61
|
+
readonly key: string;
|
|
62
|
+
readonly size: number;
|
|
63
|
+
readonly updatedAt: number;
|
|
64
|
+
readonly value?: JsonValue;
|
|
65
|
+
}[];
|
|
66
|
+
readonly spaces: readonly {
|
|
67
|
+
readonly space: string;
|
|
68
|
+
readonly count: number;
|
|
69
|
+
readonly pendingCount: number;
|
|
70
|
+
readonly reservedCount: number;
|
|
71
|
+
readonly updatedAt: number;
|
|
72
|
+
}[];
|
|
73
|
+
}
|
|
74
|
+
export declare const flowStateViewSchema: z.ZodObject<{
|
|
75
|
+
version: z.ZodLiteral<1>;
|
|
76
|
+
scope: z.ZodEnum<{
|
|
77
|
+
draft: "draft";
|
|
78
|
+
live: "live";
|
|
79
|
+
}>;
|
|
80
|
+
limits: z.ZodObject<{
|
|
81
|
+
maxValueBytes: z.ZodNumber;
|
|
82
|
+
maxValues: z.ZodNumber;
|
|
83
|
+
maxSpaces: z.ZodNumber;
|
|
84
|
+
maxIdentities: z.ZodNumber;
|
|
85
|
+
maxRunWrites: z.ZodNumber;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
values: z.ZodArray<z.ZodObject<{
|
|
88
|
+
key: z.ZodString;
|
|
89
|
+
size: z.ZodNumber;
|
|
90
|
+
updatedAt: z.ZodNumber;
|
|
91
|
+
value: z.ZodOptional<z.ZodJSONSchema>;
|
|
92
|
+
}, z.core.$strip>>;
|
|
93
|
+
spaces: z.ZodArray<z.ZodObject<{
|
|
94
|
+
space: z.ZodString;
|
|
95
|
+
count: z.ZodNumber;
|
|
96
|
+
pendingCount: z.ZodNumber;
|
|
97
|
+
reservedCount: z.ZodNumber;
|
|
98
|
+
updatedAt: z.ZodNumber;
|
|
99
|
+
}, z.core.$strip>>;
|
|
100
|
+
}, z.core.$strip>;
|