@oomol-lab/open-flow 0.1.0-beta.55 → 0.1.0-beta.56
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 +1 -1
- package/dist/browser/{createResourceDialog-4H5_lZ6s.js → createResourceDialog-Btjes3wD.js} +2 -2
- package/dist/browser/flow-authoring-edge.d.ts +3 -3
- package/dist/browser/flow-authoring-node.d.ts +26 -46
- package/dist/browser/flow-authoring.js +9155 -21002
- package/dist/browser/flow-change-schema.d.ts +1 -1
- package/dist/browser/flow-change.d.ts +14 -104
- package/dist/browser/flow-change.js +121 -296
- package/dist/browser/{flowChanges-ZzG-f9cg.js → flowChanges-BxutPLYO.js} +1494 -1830
- package/dist/browser/{flowWorkspace-ChpRaTMX.js → flowWorkspace-Dg4mqfa6.js} +118 -293
- package/dist/browser/{icons-CdAB9wyS.js → icons-p2A9zs8t.js} +126 -317
- package/dist/browser/lib-DrKav3HG.js +11403 -0
- package/dist/browser/preview.css +1 -1
- package/dist/browser/preview.js +9308 -9565
- package/dist/browser/ui-idTooltip.d.ts +11 -0
- package/dist/browser/ui.d.ts +5 -0
- package/dist/browser/ui.js +83 -1
- package/dist/browser/workbench.css +1 -1
- package/dist/browser/workbench.js +210 -411
- package/dist/browser/{workbenchSelect-BRZN4ish.js → workbenchSelect-LRp_Xjeq.js} +1 -1
- package/dist/common/control-api-conformance.js +212 -245
- package/dist/common/control-api.d.ts +6 -6
- package/dist/common/control-api.js +216 -250
- package/dist/common/control-requests.js +468 -1476
- package/dist/common/decision.js +6325 -6369
- package/dist/common/flow-agent.d.ts +1 -1
- package/dist/common/flow-connectionUsage.d.ts +1 -2
- package/dist/common/flow-encoding.d.ts +2 -4
- package/dist/common/flow-encoding.js +119 -180
- package/dist/common/flow-graph.d.ts +10 -10
- package/dist/common/flow-semantics.d.ts +4 -9
- package/dist/common/flow-semantics.js +9024 -9230
- package/dist/common/flowInspection.d.ts +3 -21
- package/dist/common/integration-trigger.js +8642 -8686
- package/dist/common/mcp.d.ts +0 -1
- package/dist/common/mcp.js +117 -140
- package/dist/common/openapi.js +6325 -6369
- package/dist/common/poll-trigger.js +8642 -8686
- package/dist/common/run-events.js +0 -1
- package/dist/common/scheduler.d.ts +3 -9
- package/dist/common/scheduler.js +116 -207
- package/dist/common/webhook-trigger.js +6325 -6369
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import type { AgentInput, AgentTool, JsonValue, ManagedTaskDefinition, ManagedTa
|
|
|
2
2
|
export type AgentConfig = Extract<ManagedTaskExecutor, {
|
|
3
3
|
readonly kind: 'agent';
|
|
4
4
|
}>;
|
|
5
|
-
export declare function agentConfigIssues(task: ManagedTaskDefinition
|
|
5
|
+
export declare function agentConfigIssues(task: ManagedTaskDefinition): readonly string[];
|
|
6
6
|
export declare function agentInput(source: Exclude<AgentInput, {
|
|
7
7
|
readonly kind: 'model';
|
|
8
8
|
}>, input: Readonly<Record<string, JsonValue>>): JsonValue;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FlowDocument,
|
|
1
|
+
import type { FlowDocument, RevisionContent } from '../browser/flow-change.js';
|
|
2
2
|
export interface ConnectionUsage {
|
|
3
3
|
readonly providerId: string;
|
|
4
4
|
readonly connectionId?: string;
|
|
@@ -6,7 +6,6 @@ export interface ConnectionUsage {
|
|
|
6
6
|
readonly triggerId?: string;
|
|
7
7
|
readonly nodeId: string;
|
|
8
8
|
readonly name: string;
|
|
9
|
-
readonly target: GraphTarget;
|
|
10
9
|
readonly kind: 'connector' | 'agent' | 'trigger' | 'notification' | 'code';
|
|
11
10
|
}
|
|
12
11
|
export declare function connectionUsage(document: FlowDocument): readonly ConnectionUsage[];
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import type { CodeModule, FlowDocument, Graph, Group, InputPort, JsonValue,
|
|
1
|
+
import type { CodeModule, FlowDocument, Graph, Group, InputPort, JsonValue, ManagedTaskDefinition, Port, RevisionContent, TriggerNode } from '@oomol-lab/open-flow/flow-change';
|
|
2
2
|
export { maxJsonDepth } from './flow-json.js';
|
|
3
3
|
export { decodeFlowDocument, decodeRevisionContent } from '../browser/flow-change-schema.js';
|
|
4
4
|
export declare function canonicalJsonBytes(value: JsonValue): Uint8Array;
|
|
5
5
|
export declare function digestBytes(bytes: Uint8Array): Promise<string>;
|
|
6
6
|
export declare function canonicalPorts(value: readonly (InputPort | Port | Group)[]): JsonValue;
|
|
7
|
-
export declare function canonicalOutputs(value: readonly (OutputMapping & Port)[]): JsonValue;
|
|
8
7
|
export declare function canonicalGraph(value: Graph): JsonValue;
|
|
9
8
|
export declare function canonicalRevisionGraph(content: RevisionContent, graph: Graph): JsonValue;
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function canonicalTask(task: FlowDocument['tasks'][string]): JsonValue;
|
|
9
|
+
export declare function canonicalTask(task: ManagedTaskDefinition): JsonValue;
|
|
12
10
|
export declare function triggerRuntimeJson(trigger: TriggerNode): string;
|
|
13
11
|
export declare function canonicalDocument(document: FlowDocument): JsonValue;
|
|
14
12
|
export declare function canonicalModule(module: CodeModule): JsonValue;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
//#region src/openapi/common/authBindings.ts
|
|
2
2
|
/** Never allow credentials to enter a Revision as literal node inputs. */
|
|
3
3
|
function assertOpenApiAuthBindings(document) {
|
|
4
|
-
for (const
|
|
5
|
-
if (node.kind != "task" || node.
|
|
6
|
-
for (const [handle, mapping] of Object.entries(node.inputs)) if (handle.startsWith("auth.") &&
|
|
4
|
+
for (const node of Object.values(document.graph.nodes)) {
|
|
5
|
+
if (node.kind != "task" || !("executor" in node.task) || node.task.executor.kind != "openapi") continue;
|
|
6
|
+
for (const [handle, mapping] of Object.entries(node.inputs)) if (handle.startsWith("auth.") && mapping.kind == "value") throw new TypeError("OpenAPI authentication accepts deployment variables and upstream outputs only.");
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
@@ -2813,6 +2813,9 @@ function handlePipeResult(left, next, ctx) {
|
|
|
2813
2813
|
issues: left.issues
|
|
2814
2814
|
}, ctx);
|
|
2815
2815
|
}
|
|
2816
|
+
var $ZodPreprocess = /*@__PURE__*/ $constructor("$ZodPreprocess", (inst, def) => {
|
|
2817
|
+
$ZodPipe.init(inst, def);
|
|
2818
|
+
});
|
|
2816
2819
|
var $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
2817
2820
|
$ZodType.init(inst, def);
|
|
2818
2821
|
defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
|
|
@@ -5637,6 +5640,10 @@ function pipe(in_, out) {
|
|
|
5637
5640
|
out
|
|
5638
5641
|
});
|
|
5639
5642
|
}
|
|
5643
|
+
var ZodPreprocess = /*@__PURE__*/ $constructor("ZodPreprocess", (inst, def) => {
|
|
5644
|
+
ZodPipe.init(inst, def);
|
|
5645
|
+
$ZodPreprocess.init(inst, def);
|
|
5646
|
+
});
|
|
5640
5647
|
var ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
|
|
5641
5648
|
$ZodReadonly.init(inst, def);
|
|
5642
5649
|
ZodType.init(inst, def);
|
|
@@ -5685,6 +5692,13 @@ function json$1(params) {
|
|
|
5685
5692
|
});
|
|
5686
5693
|
return jsonSchema;
|
|
5687
5694
|
}
|
|
5695
|
+
function preprocess(fn, schema) {
|
|
5696
|
+
return new ZodPreprocess({
|
|
5697
|
+
type: "pipe",
|
|
5698
|
+
in: transform(fn),
|
|
5699
|
+
out: schema
|
|
5700
|
+
});
|
|
5701
|
+
}
|
|
5688
5702
|
//#endregion
|
|
5689
5703
|
//#region src/json-schema-subset/utils.ts
|
|
5690
5704
|
var nextId = 0;
|
|
@@ -8332,7 +8346,7 @@ var isObject = (x) => x !== null && typeof x === "object";
|
|
|
8332
8346
|
var isPlainObject = (x) => isObject(x) && !isArray(x);
|
|
8333
8347
|
var toPlainObject = (x) => isPlainObject(x) ? x : void 0;
|
|
8334
8348
|
//#endregion
|
|
8335
|
-
//#region src/
|
|
8349
|
+
//#region src/flow/common/schemaComparer.ts
|
|
8336
8350
|
function isStringLikeSchema(value) {
|
|
8337
8351
|
return toPlainObject(value)?.type === "string";
|
|
8338
8352
|
}
|
|
@@ -8578,24 +8592,15 @@ var group = object({
|
|
|
8578
8592
|
collapsed: boolean().optional(),
|
|
8579
8593
|
group: text
|
|
8580
8594
|
});
|
|
8581
|
-
var
|
|
8595
|
+
var source = union([object({
|
|
8582
8596
|
kind: literal("node"),
|
|
8583
8597
|
nodeId: text,
|
|
8584
8598
|
output: text,
|
|
8585
8599
|
field: text.optional()
|
|
8586
|
-
})
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
});
|
|
8591
|
-
var source = union([
|
|
8592
|
-
nodeSource,
|
|
8593
|
-
flowSource,
|
|
8594
|
-
object({
|
|
8595
|
-
kind: literal("binding"),
|
|
8596
|
-
bindingId: text
|
|
8597
|
-
})
|
|
8598
|
-
]);
|
|
8600
|
+
}), object({
|
|
8601
|
+
kind: literal("binding"),
|
|
8602
|
+
bindingId: text
|
|
8603
|
+
})]);
|
|
8599
8604
|
var fixedInput = union([object({ kind: literal("unset") }), object({
|
|
8600
8605
|
kind: literal("value"),
|
|
8601
8606
|
value: json
|
|
@@ -8732,7 +8737,9 @@ var managed = object({
|
|
|
8732
8737
|
inputs: array(input.extend({ source: agentInput }))
|
|
8733
8738
|
})),
|
|
8734
8739
|
notification: object({
|
|
8735
|
-
|
|
8740
|
+
action: text,
|
|
8741
|
+
connectionId: text.optional(),
|
|
8742
|
+
inputDefinitions: array(input),
|
|
8736
8743
|
messageHandle: text,
|
|
8737
8744
|
inputs: record$1(text, agentValue)
|
|
8738
8745
|
}).optional()
|
|
@@ -8855,21 +8862,10 @@ var node = union([
|
|
|
8855
8862
|
kind: literal("value"),
|
|
8856
8863
|
values: array(input)
|
|
8857
8864
|
}),
|
|
8858
|
-
object({
|
|
8859
|
-
...base,
|
|
8860
|
-
kind: literal("subflow"),
|
|
8861
|
-
subflowId: text
|
|
8862
|
-
}),
|
|
8863
|
-
object({
|
|
8864
|
-
...base,
|
|
8865
|
-
kind: literal("task"),
|
|
8866
|
-
task: inline,
|
|
8867
|
-
additionalInputs: array(input).optional()
|
|
8868
|
-
}),
|
|
8869
8865
|
object({
|
|
8870
8866
|
...base,
|
|
8871
8867
|
kind: literal("task"),
|
|
8872
|
-
|
|
8868
|
+
task: union([inline, managed]),
|
|
8873
8869
|
additionalInputs: array(input).optional()
|
|
8874
8870
|
}),
|
|
8875
8871
|
strictObject({
|
|
@@ -8924,10 +8920,6 @@ var node = union([
|
|
|
8924
8920
|
})
|
|
8925
8921
|
})
|
|
8926
8922
|
]);
|
|
8927
|
-
var target = union([object({ kind: literal("flow") }), object({
|
|
8928
|
-
kind: literal("subflow"),
|
|
8929
|
-
id: text
|
|
8930
|
-
})]);
|
|
8931
8923
|
var edge = object({
|
|
8932
8924
|
source: text,
|
|
8933
8925
|
target: text,
|
|
@@ -8935,13 +8927,8 @@ var edge = object({
|
|
|
8935
8927
|
});
|
|
8936
8928
|
var at = {
|
|
8937
8929
|
nodeId: text,
|
|
8938
|
-
target
|
|
8930
|
+
target: never().optional()
|
|
8939
8931
|
};
|
|
8940
|
-
var subflow = object({
|
|
8941
|
-
name: text,
|
|
8942
|
-
inputs: array(input),
|
|
8943
|
-
outputs: array(port.extend({ sources: array(union([nodeSource, flowSource])) }))
|
|
8944
|
-
});
|
|
8945
8932
|
var graph = object({
|
|
8946
8933
|
nodes: record$1(text, node),
|
|
8947
8934
|
edges: array(edge).default([])
|
|
@@ -8955,17 +8942,16 @@ var module = object({
|
|
|
8955
8942
|
imports: strings,
|
|
8956
8943
|
source: text
|
|
8957
8944
|
});
|
|
8958
|
-
var document = object({
|
|
8945
|
+
var document = preprocess(rejectRetiredDefinitions, object({
|
|
8959
8946
|
bindings: record$1(text, binding),
|
|
8960
|
-
graph
|
|
8961
|
-
|
|
8962
|
-
tasks: record$1(text, managed)
|
|
8963
|
-
});
|
|
8947
|
+
graph
|
|
8948
|
+
}));
|
|
8964
8949
|
var revision = object({
|
|
8965
8950
|
modelVersion: union([
|
|
8966
8951
|
literal(2),
|
|
8967
8952
|
literal(4),
|
|
8968
|
-
literal(5)
|
|
8953
|
+
literal(5),
|
|
8954
|
+
literal(6)
|
|
8969
8955
|
]),
|
|
8970
8956
|
document,
|
|
8971
8957
|
modules: record$1(text, module)
|
|
@@ -8974,6 +8960,15 @@ var envelope = revision.extend({
|
|
|
8974
8960
|
kind: literal("open-flow-flow-revision"),
|
|
8975
8961
|
version: literal(1)
|
|
8976
8962
|
});
|
|
8963
|
+
function rejectRetiredDefinitions(value) {
|
|
8964
|
+
const candidate = record(value);
|
|
8965
|
+
if (candidate.tasks !== void 0 && (candidate.tasks === null || typeof candidate.tasks !== "object" || Array.isArray(candidate.tasks) || Object.keys(candidate.tasks).length > 0)) throw new TypeError("Independent Task definitions are no longer supported.");
|
|
8966
|
+
if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => Object.hasOwn(record(candidateNode), "taskId"))) throw new TypeError("Task references are no longer supported.");
|
|
8967
|
+
const subflows = candidate.subflows;
|
|
8968
|
+
if (subflows !== void 0 && (subflows === null || typeof subflows !== "object" || Array.isArray(subflows) || Object.keys(subflows).length > 0)) throw new TypeError("Subflows are no longer supported.");
|
|
8969
|
+
if (Object.values(record(record(candidate.graph).nodes)).some((candidateNode) => record(candidateNode).kind === "subflow")) throw new TypeError("Subflow nodes are no longer supported.");
|
|
8970
|
+
return value;
|
|
8971
|
+
}
|
|
8977
8972
|
function record(value) {
|
|
8978
8973
|
return value != null && typeof value == "object" && !Array.isArray(value) ? value : {};
|
|
8979
8974
|
}
|
|
@@ -9042,26 +9037,9 @@ function upgradeLegacyGraph(value) {
|
|
|
9042
9037
|
function upgradeLegacyDocument(value) {
|
|
9043
9038
|
const candidate = record(value);
|
|
9044
9039
|
const root = upgradeLegacyGraph(candidate.graph);
|
|
9045
|
-
const subflows = Object.fromEntries(Object.entries(record(candidate.subflows)).map(([id, subflowCandidate]) => {
|
|
9046
|
-
const legacySubflow = record(subflowCandidate);
|
|
9047
|
-
const upgraded = upgradeLegacyGraph(legacySubflow.graph);
|
|
9048
|
-
const outputs = Array.isArray(legacySubflow.outputs) ? legacySubflow.outputs.map((outputCandidate) => {
|
|
9049
|
-
const output = record(outputCandidate);
|
|
9050
|
-
return {
|
|
9051
|
-
...output,
|
|
9052
|
-
sources: upgradeLegacySources(output.sources, upgraded.resolutionIds)
|
|
9053
|
-
};
|
|
9054
|
-
}) : legacySubflow.outputs;
|
|
9055
|
-
return [id, {
|
|
9056
|
-
...legacySubflow,
|
|
9057
|
-
graph: upgraded.graph,
|
|
9058
|
-
outputs
|
|
9059
|
-
}];
|
|
9060
|
-
}));
|
|
9061
9040
|
return {
|
|
9062
9041
|
...candidate,
|
|
9063
|
-
graph: root.graph
|
|
9064
|
-
subflows
|
|
9042
|
+
graph: root.graph
|
|
9065
9043
|
};
|
|
9066
9044
|
}
|
|
9067
9045
|
function repairedEntries(value, schema, repair) {
|
|
@@ -9121,30 +9099,66 @@ function repairGraph(value, bindings) {
|
|
|
9121
9099
|
edges: Array.isArray(candidate.edges) ? candidate.edges.flatMap((edgeCandidate) => edge.safeParse(edgeCandidate).data ?? []) : []
|
|
9122
9100
|
};
|
|
9123
9101
|
}
|
|
9102
|
+
function upgradeTaskNodes(candidateDocument) {
|
|
9103
|
+
const definitions = record(candidateDocument.tasks);
|
|
9104
|
+
const sourceGraph = record(candidateDocument.graph);
|
|
9105
|
+
const nodes = Object.fromEntries(Object.entries(record(sourceGraph.nodes)).map(([id, value]) => {
|
|
9106
|
+
const candidateNode = record(value);
|
|
9107
|
+
if (candidateNode.kind != "task" || !Object.hasOwn(candidateNode, "taskId")) return [id, value];
|
|
9108
|
+
if (typeof candidateNode.taskId != "string" || candidateNode.task !== void 0) throw new TypeError("Invalid legacy Task reference.");
|
|
9109
|
+
const task = record(definitions[candidateNode.taskId]);
|
|
9110
|
+
const executor = record(task.executor);
|
|
9111
|
+
let upgraded = task;
|
|
9112
|
+
if (executor.kind == "agent" && executor.notification != null) {
|
|
9113
|
+
const notice = record(executor.notification);
|
|
9114
|
+
const connector = record(definitions[String(notice.taskId)]);
|
|
9115
|
+
const config = record(connector.executor);
|
|
9116
|
+
if (config.kind != "connector") throw new TypeError("Invalid legacy Agent notification reference.");
|
|
9117
|
+
const { taskId: _, ...rest } = notice;
|
|
9118
|
+
upgraded = {
|
|
9119
|
+
...task,
|
|
9120
|
+
executor: {
|
|
9121
|
+
...executor,
|
|
9122
|
+
notification: {
|
|
9123
|
+
...rest,
|
|
9124
|
+
action: config.action,
|
|
9125
|
+
connectionId: config.connectionId,
|
|
9126
|
+
inputDefinitions: Array.isArray(connector.inputs) ? connector.inputs.filter((candidatePort) => Object.hasOwn(record(candidatePort), "handle")) : connector.inputs
|
|
9127
|
+
}
|
|
9128
|
+
}
|
|
9129
|
+
};
|
|
9130
|
+
}
|
|
9131
|
+
const { taskId: _, ...rest } = candidateNode;
|
|
9132
|
+
return [id, {
|
|
9133
|
+
...rest,
|
|
9134
|
+
task: managed.parse(upgraded)
|
|
9135
|
+
}];
|
|
9136
|
+
}));
|
|
9137
|
+
const { tasks: _, ...rest } = candidateDocument;
|
|
9138
|
+
return {
|
|
9139
|
+
...rest,
|
|
9140
|
+
graph: {
|
|
9141
|
+
...sourceGraph,
|
|
9142
|
+
nodes
|
|
9143
|
+
}
|
|
9144
|
+
};
|
|
9145
|
+
}
|
|
9124
9146
|
/** Best-effort recovery for a parseable Revision envelope. Invalid collection entries are discarded. */
|
|
9125
9147
|
function repairRevisionEnvelope(value) {
|
|
9126
9148
|
checkJsonDepth(value);
|
|
9127
9149
|
const envelopeSource = record(value);
|
|
9128
9150
|
if (envelopeSource.kind != "open-flow-flow-revision" || envelopeSource.version != 1) throw new TypeError("The value is not an Open Flow Revision envelope.");
|
|
9129
|
-
if (typeof envelopeSource.modelVersion == "number" && envelopeSource.modelVersion >
|
|
9130
|
-
|
|
9151
|
+
if (typeof envelopeSource.modelVersion == "number" && envelopeSource.modelVersion > 6) throw new TypeError("The Flow model is newer than this package.");
|
|
9152
|
+
let sourceDocument = record(envelopeSource.modelVersion == 1 || envelopeSource.modelVersion == 2 ? upgradeLegacyDocument(envelopeSource.document) : envelopeSource.document);
|
|
9153
|
+
if (typeof envelopeSource.modelVersion == "number" && envelopeSource.modelVersion < 6) sourceDocument = upgradeTaskNodes(sourceDocument);
|
|
9154
|
+
rejectRetiredDefinitions(sourceDocument);
|
|
9131
9155
|
const bindings = record(sourceDocument.bindings);
|
|
9132
9156
|
const sourceGraph = repairGraph(sourceDocument.graph, bindings);
|
|
9133
|
-
const subflows = Object.fromEntries(Object.entries(record(sourceDocument.subflows)).flatMap(([id, subflowCandidate]) => {
|
|
9134
|
-
const legacySubflow = record(subflowCandidate);
|
|
9135
|
-
const result = subflow.extend({ graph }).safeParse({
|
|
9136
|
-
...legacySubflow,
|
|
9137
|
-
graph: repairGraph(legacySubflow.graph, bindings)
|
|
9138
|
-
});
|
|
9139
|
-
return result.success ? [[id, result.data]] : [];
|
|
9140
|
-
}));
|
|
9141
9157
|
return decodeRevisionContent({
|
|
9142
|
-
modelVersion:
|
|
9158
|
+
modelVersion: 6,
|
|
9143
9159
|
document: {
|
|
9144
9160
|
bindings: repairedEntries(sourceDocument.bindings, binding),
|
|
9145
|
-
graph: sourceGraph
|
|
9146
|
-
subflows,
|
|
9147
|
-
tasks: repairedEntries(sourceDocument.tasks, managed)
|
|
9161
|
+
graph: sourceGraph
|
|
9148
9162
|
},
|
|
9149
9163
|
modules: repairedEntries(envelopeSource.modules, module)
|
|
9150
9164
|
});
|
|
@@ -9156,7 +9170,7 @@ function decodeFlowDocument(value) {
|
|
|
9156
9170
|
function decodeRevisionContent(value) {
|
|
9157
9171
|
checkJsonDepth(value);
|
|
9158
9172
|
const content = revision.parse(value);
|
|
9159
|
-
|
|
9173
|
+
checkModelVersion(content);
|
|
9160
9174
|
assertOpenApiAuthBindings(content.document);
|
|
9161
9175
|
return content;
|
|
9162
9176
|
}
|
|
@@ -9168,7 +9182,7 @@ function decodeRevisionEnvelope(value) {
|
|
|
9168
9182
|
document: upgradeLegacyDocument(revisionSource.document)
|
|
9169
9183
|
} : value;
|
|
9170
9184
|
const content = envelope.parse(candidate);
|
|
9171
|
-
|
|
9185
|
+
checkModelVersion(content);
|
|
9172
9186
|
assertOpenApiAuthBindings(content.document);
|
|
9173
9187
|
return {
|
|
9174
9188
|
modelVersion: content.modelVersion,
|
|
@@ -9193,12 +9207,12 @@ var shapes = {
|
|
|
9193
9207
|
value: text
|
|
9194
9208
|
},
|
|
9195
9209
|
"graph.edge.connect": {
|
|
9196
|
-
|
|
9197
|
-
|
|
9210
|
+
edge,
|
|
9211
|
+
target: never().optional()
|
|
9198
9212
|
},
|
|
9199
9213
|
"graph.edge.disconnect": {
|
|
9200
|
-
|
|
9201
|
-
|
|
9214
|
+
edge,
|
|
9215
|
+
target: never().optional()
|
|
9202
9216
|
},
|
|
9203
9217
|
"graph.node.create": {
|
|
9204
9218
|
...at,
|
|
@@ -9262,13 +9276,11 @@ var shapes = {
|
|
|
9262
9276
|
},
|
|
9263
9277
|
"graph.node.resolution.set": {
|
|
9264
9278
|
...at,
|
|
9265
|
-
target: object({ kind: literal("flow") }),
|
|
9266
9279
|
before: object(wait),
|
|
9267
9280
|
value: object(wait)
|
|
9268
9281
|
},
|
|
9269
9282
|
"graph.node.webhook.set": {
|
|
9270
9283
|
...at,
|
|
9271
|
-
target: object({ kind: literal("flow") }),
|
|
9272
9284
|
before: object(webhook),
|
|
9273
9285
|
value: object(webhook)
|
|
9274
9286
|
},
|
|
@@ -9315,58 +9327,19 @@ var shapes = {
|
|
|
9315
9327
|
imports: strings,
|
|
9316
9328
|
source: text
|
|
9317
9329
|
},
|
|
9318
|
-
"
|
|
9319
|
-
|
|
9320
|
-
|
|
9321
|
-
|
|
9322
|
-
"subflow.definition.set": {
|
|
9323
|
-
subflowId: text,
|
|
9324
|
-
before: subflow,
|
|
9325
|
-
definition: subflow
|
|
9326
|
-
},
|
|
9327
|
-
"subflow.delete": { subflowId: text },
|
|
9328
|
-
"task.create": {
|
|
9329
|
-
taskId: text,
|
|
9330
|
-
task: managed
|
|
9331
|
-
},
|
|
9332
|
-
"task.delete": { taskId: text },
|
|
9333
|
-
"task.connector.connection.set": {
|
|
9334
|
-
taskId: text,
|
|
9335
|
-
before: text.optional(),
|
|
9336
|
-
value: text.optional()
|
|
9337
|
-
},
|
|
9338
|
-
"task.decision.set": {
|
|
9339
|
-
taskId: text,
|
|
9340
|
-
before: managed,
|
|
9341
|
-
value: managed
|
|
9342
|
-
},
|
|
9343
|
-
"task.openapi.set": {
|
|
9344
|
-
taskId: text,
|
|
9345
|
-
before: managed,
|
|
9346
|
-
value: managed
|
|
9347
|
-
},
|
|
9348
|
-
"task.agent.set": {
|
|
9349
|
-
taskId: text,
|
|
9350
|
-
before: managed,
|
|
9351
|
-
value: managed
|
|
9352
|
-
},
|
|
9353
|
-
"task.llm.mode.set": {
|
|
9354
|
-
taskId: text,
|
|
9355
|
-
before: _enum(["chat", "json"]),
|
|
9356
|
-
value: _enum(["chat", "json"])
|
|
9357
|
-
},
|
|
9358
|
-
"task.name.set": {
|
|
9359
|
-
taskId: text,
|
|
9360
|
-
before: text,
|
|
9361
|
-
value: text
|
|
9330
|
+
"graph.node.task.set": {
|
|
9331
|
+
...at,
|
|
9332
|
+
before: union([inline, managed]),
|
|
9333
|
+
value: union([inline, managed])
|
|
9362
9334
|
}
|
|
9363
9335
|
};
|
|
9364
9336
|
array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, shape instanceof ZodType ? shape : object({
|
|
9365
9337
|
kind: literal(kind),
|
|
9366
9338
|
...shape
|
|
9367
9339
|
})])).values()])).min(1);
|
|
9368
|
-
function
|
|
9369
|
-
if (content.modelVersion <
|
|
9340
|
+
function checkModelVersion(content) {
|
|
9341
|
+
if (content.modelVersion < 6 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && "executor" in candidateNode.task)) throw new TypeError("Node-owned managed Tasks require Flow model version 6.");
|
|
9342
|
+
if (content.modelVersion < 5 && Object.values(content.document.graph.nodes).some((itemNode) => itemNode.kind == "error")) throw new TypeError("Error workflows require Flow model version 5.");
|
|
9370
9343
|
}
|
|
9371
9344
|
//#endregion
|
|
9372
9345
|
//#region src/flow/common/encoding.ts
|
|
@@ -9420,15 +9393,6 @@ function canonicalInputMapping(value) {
|
|
|
9420
9393
|
function canonicalInputs(value) {
|
|
9421
9394
|
return Object.fromEntries(entries(value).map(([handle, mapping]) => [handle, canonicalInputMapping(mapping)]));
|
|
9422
9395
|
}
|
|
9423
|
-
function canonicalOutputs(value) {
|
|
9424
|
-
return value.map((output) => ({
|
|
9425
|
-
...output.description == null ? {} : { description: output.description },
|
|
9426
|
-
handle: output.handle,
|
|
9427
|
-
jsonSchema: output.jsonSchema,
|
|
9428
|
-
nullable: output.nullable,
|
|
9429
|
-
sources: output.sources.map((source) => ({ ...source }))
|
|
9430
|
-
}));
|
|
9431
|
-
}
|
|
9432
9396
|
function canonicalOperand(operand) {
|
|
9433
9397
|
return operand.kind === "source" ? {
|
|
9434
9398
|
kind: "source",
|
|
@@ -9464,18 +9428,13 @@ function canonicalNode(value) {
|
|
|
9464
9428
|
matchMode: value.matchMode,
|
|
9465
9429
|
kind: value.kind
|
|
9466
9430
|
};
|
|
9467
|
-
case "subflow": return {
|
|
9468
|
-
...common,
|
|
9469
|
-
kind: value.kind,
|
|
9470
|
-
subflowId: value.subflowId
|
|
9471
|
-
};
|
|
9472
9431
|
case "task": {
|
|
9473
|
-
const node = value.task
|
|
9432
|
+
const node = "moduleId" in value.task ? Object.assign({}, common, {
|
|
9474
9433
|
kind: value.kind,
|
|
9475
9434
|
task: canonicalInlineTask(value.task)
|
|
9476
9435
|
}) : Object.assign({}, common, {
|
|
9477
9436
|
kind: value.kind,
|
|
9478
|
-
|
|
9437
|
+
task: canonicalTask(value.task)
|
|
9479
9438
|
});
|
|
9480
9439
|
if (value.additionalInputs != null) node.additionalInputs = canonicalPorts(value.additionalInputs);
|
|
9481
9440
|
return node;
|
|
@@ -9557,22 +9516,9 @@ function canonicalLegacyGraph(graph) {
|
|
|
9557
9516
|
}))
|
|
9558
9517
|
};
|
|
9559
9518
|
}
|
|
9560
|
-
function canonicalLegacyOutputs(value, graph) {
|
|
9561
|
-
const resolutionIds = resolutionNodeIds(graph);
|
|
9562
|
-
return value.map((output) => ({
|
|
9563
|
-
...output.description == null ? {} : { description: output.description },
|
|
9564
|
-
handle: output.handle,
|
|
9565
|
-
jsonSchema: output.jsonSchema,
|
|
9566
|
-
nullable: output.nullable,
|
|
9567
|
-
sources: output.sources.map((source) => canonicalLegacySource(source, resolutionIds))
|
|
9568
|
-
}));
|
|
9569
|
-
}
|
|
9570
9519
|
function canonicalRevisionGraph(content, graph) {
|
|
9571
9520
|
return content.modelVersion == 2 ? canonicalLegacyGraph(graph) : canonicalGraph(graph);
|
|
9572
9521
|
}
|
|
9573
|
-
function canonicalRevisionOutputs(content, value, graph) {
|
|
9574
|
-
return content.modelVersion == 2 ? canonicalLegacyOutputs(value, graph) : canonicalOutputs(value);
|
|
9575
|
-
}
|
|
9576
9522
|
function canonicalTask(task) {
|
|
9577
9523
|
return {
|
|
9578
9524
|
executor: task.executor,
|
|
@@ -9682,29 +9628,22 @@ function triggerRuntimeJson(trigger) {
|
|
|
9682
9628
|
function canonicalDocument(document) {
|
|
9683
9629
|
return {
|
|
9684
9630
|
bindings: Object.fromEntries(entries(document.bindings)),
|
|
9685
|
-
graph: canonicalGraph(document.graph)
|
|
9686
|
-
subflows: Object.fromEntries(entries(document.subflows).map(([id, subflow]) => [id, {
|
|
9687
|
-
graph: canonicalGraph(subflow.graph),
|
|
9688
|
-
inputs: canonicalPorts(subflow.inputs),
|
|
9689
|
-
name: subflow.name,
|
|
9690
|
-
outputs: canonicalOutputs(subflow.outputs)
|
|
9691
|
-
}])),
|
|
9692
|
-
tasks: Object.fromEntries(entries(document.tasks).map(([id, task]) => [id, canonicalTask(task)]))
|
|
9631
|
+
graph: canonicalGraph(document.graph)
|
|
9693
9632
|
};
|
|
9694
9633
|
}
|
|
9695
9634
|
function canonicalRevisionDocument(content) {
|
|
9696
|
-
if (content.modelVersion
|
|
9635
|
+
if (content.modelVersion >= 6) return canonicalDocument(content.document);
|
|
9636
|
+
if (content.modelVersion != 2) return {
|
|
9637
|
+
...canonicalDocument(content.document),
|
|
9638
|
+
subflows: {},
|
|
9639
|
+
tasks: {}
|
|
9640
|
+
};
|
|
9697
9641
|
const { document } = content;
|
|
9698
9642
|
return {
|
|
9699
9643
|
bindings: Object.fromEntries(entries(document.bindings)),
|
|
9700
9644
|
graph: canonicalLegacyGraph(document.graph),
|
|
9701
|
-
subflows:
|
|
9702
|
-
|
|
9703
|
-
inputs: canonicalPorts(subflow.inputs),
|
|
9704
|
-
name: subflow.name,
|
|
9705
|
-
outputs: canonicalLegacyOutputs(subflow.outputs, subflow.graph)
|
|
9706
|
-
}])),
|
|
9707
|
-
tasks: Object.fromEntries(entries(document.tasks).map(([id, task]) => [id, canonicalTask(task)]))
|
|
9645
|
+
subflows: {},
|
|
9646
|
+
tasks: {}
|
|
9708
9647
|
};
|
|
9709
9648
|
}
|
|
9710
9649
|
function canonicalModule(module) {
|
|
@@ -9745,10 +9684,10 @@ function revisionRepairKind(bytes) {
|
|
|
9745
9684
|
return;
|
|
9746
9685
|
}
|
|
9747
9686
|
const source = value;
|
|
9748
|
-
return typeof source.modelVersion == "number" && source.modelVersion <
|
|
9687
|
+
return typeof source.modelVersion == "number" && source.modelVersion < 6 ? "upgrade" : "repair";
|
|
9749
9688
|
}
|
|
9750
9689
|
function repairRevision(bytes) {
|
|
9751
9690
|
return repairRevisionEnvelope(revisionValue(bytes));
|
|
9752
9691
|
}
|
|
9753
9692
|
//#endregion
|
|
9754
|
-
export { canonicalDocument, canonicalGraph, canonicalJsonBytes, canonicalModule,
|
|
9693
|
+
export { canonicalDocument, canonicalGraph, canonicalJsonBytes, canonicalModule, canonicalPorts, canonicalRevisionGraph, canonicalTask, decodeFlowDocument, decodeRevision, decodeRevisionContent, digestBytes, encodeRevision, maxJsonDepth, repairRevision, revisionRepairKind, triggerRuntimeJson };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Diagnostic
|
|
1
|
+
import type { Graph, GraphNode, InputPortDefinition, NodeSource, PortDefinition, RevisionContent, SchemaMismatch } from '../browser/flow-change.js';
|
|
2
|
+
import type { Diagnostic } from './flow-semantics.js';
|
|
3
3
|
export declare function isResolutionNode(node: GraphNode | undefined): node is Extract<GraphNode, {
|
|
4
4
|
readonly kind: 'approval' | 'wait';
|
|
5
5
|
}>;
|
|
6
|
-
export declare function nodeInputPorts(
|
|
6
|
+
export declare function nodeInputPorts(node: GraphNode): Readonly<Record<string, InputPortDefinition>>;
|
|
7
7
|
export declare function resolutionActions(node: Extract<GraphNode, {
|
|
8
8
|
readonly kind: 'approval' | 'wait';
|
|
9
9
|
}>): readonly ['continue'] | readonly ['approve', 'reject'];
|
|
10
10
|
export declare function resolutionOutputPorts(node: Extract<GraphNode, {
|
|
11
11
|
readonly kind: 'approval' | 'wait';
|
|
12
12
|
}>): Readonly<Record<string, PortDefinition>>;
|
|
13
|
-
export declare function nodeOutputPorts(
|
|
14
|
-
export declare function nodeOutputDescription(
|
|
13
|
+
export declare function nodeOutputPorts(node: GraphNode): Readonly<Record<string, PortDefinition>>;
|
|
14
|
+
export declare function nodeOutputDescription(graph: Graph, nodeId: string, output: string): string | undefined;
|
|
15
15
|
export declare function graphOrder(graph: Graph): readonly string[];
|
|
16
16
|
export type InputSourceCheck = {
|
|
17
17
|
readonly kind: 'available';
|
|
@@ -50,10 +50,10 @@ export interface InputSourcesCheck {
|
|
|
50
50
|
readonly sources: readonly InputSourceCheck[];
|
|
51
51
|
}
|
|
52
52
|
/** Check one saved binding without enumerating candidate ports. */
|
|
53
|
-
export declare function checkInputSource(
|
|
54
|
-
export declare function checkInputSources(
|
|
53
|
+
export declare function checkInputSource(graph: Graph, target: string, handle: string, source: Pick<NodeSource, 'nodeId' | 'output' | 'field'>): InputSourceCheck;
|
|
54
|
+
export declare function checkInputSources(graph: Graph, target: string, handle: string, sources: readonly Pick<NodeSource, 'nodeId' | 'output' | 'field'>[]): InputSourcesCheck;
|
|
55
55
|
/** Enumerate structurally available outputs while retaining their compatibility with one input. */
|
|
56
|
-
export declare function inputSourceCandidates(
|
|
57
|
-
export declare function availableOutputs(
|
|
58
|
-
export declare function validateFlowGraph(revision: RevisionContent
|
|
56
|
+
export declare function inputSourceCandidates(graph: Graph, target: string, handle: string): Readonly<Record<string, readonly InputSourceCandidate[]>>;
|
|
57
|
+
export declare function availableOutputs(graph: Graph, target: string, handle?: string): Readonly<Record<string, readonly string[]>>;
|
|
58
|
+
export declare function validateFlowGraph(revision: RevisionContent): readonly Diagnostic[];
|
|
59
59
|
export {};
|
|
@@ -3,7 +3,7 @@ export { connectionUsage, removeConnectionUsage } from './flow-connectionUsage.j
|
|
|
3
3
|
export { matchesTriggerOutputs, triggerOutputDefinitions, triggerOutputPorts } from './trigger-contract.js';
|
|
4
4
|
import type { EngineContract } from './engine-contract.js';
|
|
5
5
|
import type { RuntimeProgram } from './runtime-contract.js';
|
|
6
|
-
import type { ConnectorActionCapability, ConnectorCapability,
|
|
6
|
+
import type { ConnectorActionCapability, ConnectorCapability, Graph, RevisionContent, SchemaMismatch } from '../browser/flow-change.js';
|
|
7
7
|
export { availableOutputs, graphOrder, nodeInputPorts } from './flow-graph.js';
|
|
8
8
|
export { validateModules } from './flow-modules.js';
|
|
9
9
|
export { matchesSchema, schemaValidationErrors, variableInputCompatible } from './flow-schema.js';
|
|
@@ -11,10 +11,8 @@ export { agentInput, agentToolInput, agentToolSchema } from './flow-agent.js';
|
|
|
11
11
|
export interface SemanticClosure {
|
|
12
12
|
readonly dependencies: {
|
|
13
13
|
readonly bindings: ReadonlySet<string>;
|
|
14
|
-
readonly
|
|
14
|
+
readonly nodes: ReadonlySet<string>;
|
|
15
15
|
readonly modules: ReadonlySet<string>;
|
|
16
|
-
readonly subflows: ReadonlySet<string>;
|
|
17
|
-
readonly tasks: ReadonlySet<string>;
|
|
18
16
|
};
|
|
19
17
|
readonly digest: string;
|
|
20
18
|
}
|
|
@@ -45,8 +43,6 @@ export interface PreparedFlow {
|
|
|
45
43
|
readonly engineContract: string;
|
|
46
44
|
readonly graph: Graph;
|
|
47
45
|
readonly modules: RevisionContent['modules'];
|
|
48
|
-
readonly subflows: FlowDocument['subflows'];
|
|
49
|
-
readonly tasks: FlowDocument['tasks'];
|
|
50
46
|
}
|
|
51
47
|
export type PrepareFlowResult = {
|
|
52
48
|
readonly kind: 'engine-unsupported';
|
|
@@ -60,6 +56,5 @@ export type PrepareFlowResult = {
|
|
|
60
56
|
};
|
|
61
57
|
export declare function prepareFlow(revision: RevisionContent, engineContract: string, triggerId?: string): Promise<PrepareFlowResult>;
|
|
62
58
|
export declare function createRuntimeProgram(prepared: PreparedFlow, entryModuleId: string, engineDigest: string): RuntimeProgram | undefined;
|
|
63
|
-
export declare function
|
|
64
|
-
export declare function
|
|
65
|
-
export declare function codeActions(flow: Pick<PreparedFlow, 'graph' | 'subflows'>): readonly ConnectorCapability[];
|
|
59
|
+
export declare function agentActions(flow: Pick<PreparedFlow, 'graph'>): readonly ConnectorActionCapability[];
|
|
60
|
+
export declare function codeActions(flow: Pick<PreparedFlow, 'graph'>): readonly ConnectorCapability[];
|