@oomol-lab/open-flow 0.1.0-beta.74 → 0.1.0-beta.76
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 -1
- package/dist/browser/{ContentIcon-CUQHjQIw.js → ContentIcon-Cm1hbVzW.js} +4 -3
- package/dist/browser/{FlowCanvas-Dtf8_cQp.js → FlowCanvas-NzKtla_c.js} +62 -62
- package/dist/browser/{createResourceDialog-DI9pL-Yr.js → createResourceDialog-BgdedQqu.js} +3 -3
- package/dist/browser/{dialog-BYJGvItc.js → dialog-aSElFFw2.js} +322 -26
- package/dist/browser/{exportSvg-BOoy7-Db.js → exportSvg-Dcz4HTo_.js} +2 -2
- package/dist/browser/{flowChanges-RL-H4CjD.js → flowChanges-NZyS7HSp.js} +490 -438
- package/dist/browser/{flowWorkspace-BkDsETj0.js → flowWorkspace-Bl0SDehy.js} +499 -61
- package/dist/browser/preview.css +696 -825
- package/dist/browser/preview.js +1399 -717
- package/dist/browser/theme.css +114 -262
- package/dist/browser/{tooltip-wZJRB9oP.js → tooltip-3XMK9jkr.js} +1 -1
- package/dist/browser/{typeScriptSession-CSRwWmZm.js → typeScriptSession-C9sBGOKZ.js} +1 -1
- package/dist/browser/ui.css +354 -460
- package/dist/browser/ui.js +1 -1
- package/dist/browser/workbench.css +696 -825
- package/dist/browser/workbench.js +13 -7
- package/dist/browser/{workbenchSelect-BcWPWGzw.js → workbenchSelect-DBGP7Y4Z.js} +2 -2
- package/dist/command/index.js +41 -43
- package/dist/common/authoring.d.ts +5 -5
- package/dist/common/authoringExamples.d.ts +3 -2
- package/dist/common/authoringSchema.d.ts +70 -4
- package/dist/common/connector-proxy.d.ts +1 -1
- package/dist/common/control-api-conformance.js +250 -138
- package/dist/common/control-api.d.ts +3 -2
- package/dist/common/control-api.js +246 -134
- package/dist/common/control-requests.d.ts +3 -3
- package/dist/common/control-requests.js +353 -79
- package/dist/common/cron-trigger.d.ts +2 -1
- package/dist/common/decision.d.ts +4 -4
- package/dist/common/decision.js +5 -2
- package/dist/common/engine-contract.d.ts +6 -1
- package/dist/common/event-source-definition.d.ts +1 -1
- package/dist/common/event-source-view.d.ts +22 -0
- package/dist/common/event-source.d.ts +1 -1
- package/dist/common/event-source.js +24 -65
- package/dist/common/event-sources.d.ts +0 -21
- package/dist/common/flow-authoring.js +90 -19
- package/dist/common/flow-change-schema.d.ts +9 -1
- package/dist/common/flow-change.d.ts +7 -201
- package/dist/common/flow-change.js +96 -23
- package/dist/common/flow-encoding.js +89 -21
- package/dist/common/flow-graph.d.ts +2 -1
- package/dist/common/flow-input-value.d.ts +1 -1
- package/dist/common/flow-model.d.ts +121 -0
- package/dist/common/flow-notifications.d.ts +1 -1
- package/dist/common/flow-retry.d.ts +3 -5
- package/dist/common/flow-semantics.js +816 -586
- package/dist/common/flow-workflowReferences.d.ts +8 -0
- package/dist/common/flowInspection.d.ts +1 -1
- package/dist/common/http-hosts.d.ts +6 -0
- package/dist/common/http-request.d.ts +164 -0
- package/dist/common/http-request.js +5272 -0
- package/dist/common/integration-trigger.d.ts +2 -1
- package/dist/common/mcp.d.ts +3 -3
- package/dist/common/mcp.js +248 -136
- package/dist/common/openapi.d.ts +4 -4
- package/dist/common/openapi.js +4 -1
- package/dist/common/poll-trigger.d.ts +2 -1
- package/dist/common/run-events.js +11 -9
- package/dist/common/runtime-contract.d.ts +23 -1
- package/dist/common/runtime-contract.js +607 -72
- package/dist/common/runtime-nodejs-compat.d.ts +44 -0
- package/dist/common/runtime-nodejs-compat.js +5870 -0
- package/dist/common/scheduler-checkpoint.d.ts +1 -1
- package/dist/common/scheduler-node-execution.d.ts +1 -1
- package/dist/common/scheduler.d.ts +2 -2
- package/dist/common/scheduler.js +95 -25
- package/dist/common/trigger-catalog.d.ts +1 -7
- package/dist/common/trigger-config-options.d.ts +1 -1
- package/dist/common/trigger-config.d.ts +1 -1
- package/dist/common/trigger-contract.d.ts +2 -1
- package/dist/common/trigger-localization.d.ts +8 -2
- package/dist/common/trigger-model.d.ts +101 -0
- package/dist/common/webhook-response.d.ts +1 -3
- package/dist/common/webhook-trigger.d.ts +3 -1
- package/dist/common/webhook-trigger.js +12 -11
- package/dist/common/workflow.d.ts +3 -12
- package/dist/common/workflow.js +25 -23
- package/dist/index.d.ts +41 -14
- package/package.json +9 -1
- package/skills/open-flow/references/flow-authoring.md +1 -0
- package/skills/open-flow/references/flow-n8n-conversion.md +19 -15
- package/src/base/common/json.ts +1 -1
- package/src/connector/common/proxy.ts +1 -1
- package/src/control/common/api.ts +7 -5
- package/src/control/common/authoring.ts +14 -3
- package/src/control/common/authoringExamples.ts +8 -0
- package/src/control/common/authoringSchema.ts +38 -25
- package/src/control/common/authoringTools.ts +1 -1
- package/src/control/common/conformance.ts +1 -1
- package/src/control/common/connectorDecoders.ts +1 -1
- package/src/control/common/eventSources.ts +2 -29
- package/src/control/common/triggerCatalog.ts +1 -8
- package/src/decision/common/decision.ts +15 -7
- package/src/event-source/common/definition.ts +1 -1
- package/src/event-source/common/index.ts +1 -1
- package/src/event-source/common/view.ts +20 -0
- package/src/execution/common/checkpoint.ts +1 -1
- package/src/execution/common/events.ts +3 -0
- package/src/execution/common/node-execution.ts +5 -3
- package/src/execution/common/scheduler.ts +2 -1
- package/src/flow/common/change.ts +59 -192
- package/src/flow/common/changeSchema.ts +39 -5
- package/src/flow/common/connectionUsage.ts +1 -1
- package/src/flow/common/graph.ts +10 -4
- package/src/flow/common/inputValue.ts +1 -1
- package/src/flow/common/model.ts +130 -0
- package/src/flow/common/modules.ts +1 -1
- package/src/flow/common/portChanges.ts +1 -1
- package/src/flow/common/retry.ts +3 -5
- package/src/flow/common/semantics.ts +71 -7
- package/src/flow/common/webhookResponse.ts +4 -8
- package/src/flow/common/workflowReferences.ts +31 -0
- package/src/http/common/authBindings.ts +9 -0
- package/src/http/common/headers.ts +5 -0
- package/src/http/common/hosts.ts +13 -0
- package/src/http/common/httpRequest.ts +266 -0
- package/src/openapi/common/openapi.ts +9 -5
- package/src/{execution → runtime}/common/engineContract.ts +24 -15
- package/src/runtime/common/nodejsCompat.ts +275 -0
- package/src/runtime/common/nodejsGuest.generated.json +47 -0
- package/src/runtime/common/runtime.ts +1138 -0
- package/src/trigger/common/config.ts +1 -1
- package/src/trigger/common/configOptions.ts +1 -1
- package/src/trigger/common/contract.ts +2 -1
- package/src/trigger/common/cron.ts +2 -1
- package/src/trigger/common/integration.ts +2 -1
- package/src/trigger/common/model.ts +87 -0
- package/src/trigger/common/poll.ts +2 -1
- package/src/trigger/common/webhook.ts +7 -4
- package/src/trigger/providers/fieldDescriptions.ts +1 -1
- package/src/trigger/providers/localization.ts +9 -2
- package/src/trigger/providers/remote.ts +1 -1
- package/src/types/index.ts +44 -15
- package/src/workflow/common/workflow.ts +3 -44
- package/src/execution/common/runtime.ts +0 -563
- package/src/openapi/common/authBindings.ts +0 -12
- /package/src/{control → connector}/common/providerIconSprite.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Graph, JsonValue } from './flow-change.js';
|
|
2
|
+
import type { AgentCheckpoint } from './runtime-contract.js';
|
|
2
3
|
import type { DependenciesCheckpoint } from './scheduler-dependencies.js';
|
|
3
4
|
import type { ExecutableNode } from './scheduler-node-execution.js';
|
|
4
|
-
import type { AgentCheckpoint } from './runtime-contract.js';
|
|
5
5
|
export interface PendingWait {
|
|
6
6
|
readonly jobId: string;
|
|
7
7
|
readonly nodeId: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { AgentConfig } from './flow-agent.js';
|
|
2
2
|
import type { Graph, GraphNode, JsonValue, TriggerNode } from './flow-change.js';
|
|
3
3
|
import type { WebhookResponseSnapshot } from './webhook-response.js';
|
|
4
|
+
import type { AgentCheckpoint } from './runtime-contract.js';
|
|
4
5
|
import type { FlowRunCheckpoint } from './scheduler-checkpoint.js';
|
|
5
6
|
import type { Dependencies } from './scheduler-dependencies.js';
|
|
6
|
-
import type { AgentCheckpoint } from './runtime-contract.js';
|
|
7
7
|
import type { FlowRunOptions, SchedulerEvent, SchedulerFailure } from './scheduler.js';
|
|
8
8
|
import * as Effect from 'effect/Effect';
|
|
9
9
|
import { z } from 'zod';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { TaskCapability, JsonValue, WaitAction, WaitAutoContinue } from './flow-change.js';
|
|
2
2
|
import type { PreparedFlow } from './flow-semantics.js';
|
|
3
3
|
import type { WebhookResponseSnapshot } from './webhook-response.js';
|
|
4
|
+
import type { AgentCheckpoint } from './runtime-contract.js';
|
|
4
5
|
import type { PreviousNode } from '../index.js';
|
|
5
6
|
import type { FlowRunCheckpoint } from './scheduler-checkpoint.js';
|
|
6
|
-
import type { AgentCheckpoint } from './runtime-contract.js';
|
|
7
7
|
import * as Effect from 'effect/Effect';
|
|
8
8
|
export type { DependenciesCheckpoint } from './scheduler-dependencies.js';
|
|
9
9
|
export type { FlowRunCheckpoint, PendingWait, PendingWorkflowCall } from './scheduler-checkpoint.js';
|
|
@@ -33,7 +33,7 @@ export type SchedulerEvent = {
|
|
|
33
33
|
readonly inputs: Readonly<Record<string, JsonValue>>;
|
|
34
34
|
readonly jobId: string;
|
|
35
35
|
readonly nodeId: string;
|
|
36
|
-
readonly nodeKind: 'agent' | 'approval' | 'condition' | 'connector' | 'decision' | 'javascript' | 'openapi' | 'llm' | 'value' | 'wait' | 'outputs' | 'workflow' | 'webhook-response';
|
|
36
|
+
readonly nodeKind: 'agent' | 'approval' | 'condition' | 'connector' | 'decision' | 'javascript' | 'openapi' | 'http-request' | 'llm' | 'value' | 'wait' | 'outputs' | 'workflow' | 'webhook-response';
|
|
37
37
|
readonly nodeTitle?: string;
|
|
38
38
|
readonly runId: string;
|
|
39
39
|
readonly type: 'node.started';
|
package/dist/common/scheduler.js
CHANGED
|
@@ -9383,6 +9383,9 @@ function schemaValidationErrors(value, schema) {
|
|
|
9383
9383
|
}
|
|
9384
9384
|
//#endregion
|
|
9385
9385
|
//#region src/decision/common/decision.ts
|
|
9386
|
+
function isDecisionExecutor(executor) {
|
|
9387
|
+
return executor.kind === "decision";
|
|
9388
|
+
}
|
|
9386
9389
|
var decisionLimits = {
|
|
9387
9390
|
choice: 255,
|
|
9388
9391
|
score: 10
|
|
@@ -9405,7 +9408,7 @@ function limitDecisionQuestions(questions) {
|
|
|
9405
9408
|
}
|
|
9406
9409
|
/** Loading an oversized task also updates its previously generated output schemas. */
|
|
9407
9410
|
function limitDecisionTask(task) {
|
|
9408
|
-
if (task.executor
|
|
9411
|
+
if (!isDecisionExecutor(task.executor)) return task;
|
|
9409
9412
|
const original = task.executor.questions;
|
|
9410
9413
|
const questions = limitDecisionQuestions(original);
|
|
9411
9414
|
if (questions === original) return task;
|
|
@@ -9472,11 +9475,73 @@ function answerSchema(question) {
|
|
|
9472
9475
|
};
|
|
9473
9476
|
}
|
|
9474
9477
|
//#endregion
|
|
9478
|
+
//#region src/http/common/hosts.ts
|
|
9479
|
+
/** Hosts of a Code `http` Capability: lowercase DNS names or IPv4 addresses; `*.example.com` matches subdomains only. */
|
|
9480
|
+
var httpHostPattern = /^(?:\*\.)?(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
9481
|
+
/** Wildcards must name a registrable suffix, so `*.com` is rejected. */
|
|
9482
|
+
function isHttpHost(value) {
|
|
9483
|
+
return httpHostPattern.test(value) && (!value.startsWith("*.") || value.slice(2).includes("."));
|
|
9484
|
+
}
|
|
9485
|
+
//#endregion
|
|
9486
|
+
//#region src/http/common/headers.ts
|
|
9487
|
+
/** Header names are case-insensitive; never silently combine duplicate business fields. */
|
|
9488
|
+
function httpHeaderNameIssue(name, names) {
|
|
9489
|
+
if (!/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/.test(name)) return "invalid";
|
|
9490
|
+
if (names.some((candidate) => candidate.toLowerCase() === name.toLowerCase())) return "duplicate";
|
|
9491
|
+
}
|
|
9492
|
+
//#endregion
|
|
9493
|
+
//#region src/http/common/httpRequest.ts
|
|
9494
|
+
var parameterSchema = strictObject({
|
|
9495
|
+
mode: _enum(["fields", "object"]).default("fields"),
|
|
9496
|
+
names: array(string$1()).default([])
|
|
9497
|
+
});
|
|
9498
|
+
var httpRequestExecutorSchema = strictObject({
|
|
9499
|
+
method: _enum([
|
|
9500
|
+
"GET",
|
|
9501
|
+
"POST",
|
|
9502
|
+
"PUT",
|
|
9503
|
+
"PATCH",
|
|
9504
|
+
"DELETE",
|
|
9505
|
+
"HEAD",
|
|
9506
|
+
"OPTIONS"
|
|
9507
|
+
]).default("GET"),
|
|
9508
|
+
query: parameterSchema.default({
|
|
9509
|
+
mode: "fields",
|
|
9510
|
+
names: []
|
|
9511
|
+
}),
|
|
9512
|
+
headers: parameterSchema.default({
|
|
9513
|
+
mode: "fields",
|
|
9514
|
+
names: []
|
|
9515
|
+
}),
|
|
9516
|
+
bodyFormat: _enum([
|
|
9517
|
+
"none",
|
|
9518
|
+
"json",
|
|
9519
|
+
"text",
|
|
9520
|
+
"form"
|
|
9521
|
+
]).default("none"),
|
|
9522
|
+
authentication: union([
|
|
9523
|
+
strictObject({ type: literal("none") }),
|
|
9524
|
+
strictObject({ type: _enum(["bearer", "basic"]) }),
|
|
9525
|
+
strictObject({
|
|
9526
|
+
type: literal("apiKey"),
|
|
9527
|
+
name: string$1(),
|
|
9528
|
+
in: _enum(["header", "query"])
|
|
9529
|
+
})
|
|
9530
|
+
]).default({ type: "none" }),
|
|
9531
|
+
responseFormat: _enum([
|
|
9532
|
+
"auto",
|
|
9533
|
+
"json",
|
|
9534
|
+
"text"
|
|
9535
|
+
]).default("auto"),
|
|
9536
|
+
statusPolicy: _enum(["success", "all"]).default("success")
|
|
9537
|
+
}).extend({ kind: literal("http-request") });
|
|
9538
|
+
//#endregion
|
|
9475
9539
|
//#region src/flow/common/retry.ts
|
|
9476
9540
|
var retryNodeTypes = [
|
|
9477
9541
|
"code",
|
|
9478
9542
|
"connector",
|
|
9479
9543
|
"openapi",
|
|
9544
|
+
"http-request",
|
|
9480
9545
|
"llm",
|
|
9481
9546
|
"decision"
|
|
9482
9547
|
];
|
|
@@ -9565,22 +9630,6 @@ var webhookResponseTimeout = {
|
|
|
9565
9630
|
function webhookResponseAllowsBody(status) {
|
|
9566
9631
|
return status !== 204 && status !== 205 && status !== 304;
|
|
9567
9632
|
}
|
|
9568
|
-
var webhookHeadersPort = {
|
|
9569
|
-
jsonSchema: {
|
|
9570
|
-
type: "object",
|
|
9571
|
-
additionalProperties: { type: [
|
|
9572
|
-
"string",
|
|
9573
|
-
"number",
|
|
9574
|
-
"boolean"
|
|
9575
|
-
] }
|
|
9576
|
-
},
|
|
9577
|
-
nullable: true
|
|
9578
|
-
};
|
|
9579
|
-
/** Header names are case-insensitive; never silently combine duplicate business fields. */
|
|
9580
|
-
function webhookHeaderNameIssue(name, names) {
|
|
9581
|
-
if (!/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/.test(name)) return "invalid";
|
|
9582
|
-
if (names.some((candidate) => candidate.toLowerCase() === name.toLowerCase())) return "duplicate";
|
|
9583
|
-
}
|
|
9584
9633
|
/** Fixed inputs belong to the node, not author-supplied definitions. */
|
|
9585
9634
|
var webhookResponseInputs = [
|
|
9586
9635
|
{
|
|
@@ -9597,7 +9646,17 @@ var webhookResponseInputs = [
|
|
|
9597
9646
|
},
|
|
9598
9647
|
{
|
|
9599
9648
|
handle: "headers",
|
|
9600
|
-
jsonSchema:
|
|
9649
|
+
jsonSchema: {
|
|
9650
|
+
jsonSchema: {
|
|
9651
|
+
type: "object",
|
|
9652
|
+
additionalProperties: { type: [
|
|
9653
|
+
"string",
|
|
9654
|
+
"number",
|
|
9655
|
+
"boolean"
|
|
9656
|
+
] }
|
|
9657
|
+
},
|
|
9658
|
+
nullable: true
|
|
9659
|
+
}.jsonSchema,
|
|
9601
9660
|
nullable: false,
|
|
9602
9661
|
value: {}
|
|
9603
9662
|
}
|
|
@@ -9611,7 +9670,7 @@ function webhookHeaderValues(source) {
|
|
|
9611
9670
|
const headers = {};
|
|
9612
9671
|
const names = [];
|
|
9613
9672
|
for (const [name, value] of Object.entries(source)) {
|
|
9614
|
-
if (
|
|
9673
|
+
if (httpHeaderNameIssue(name, names) != null) return;
|
|
9615
9674
|
if (typeof value !== "string" && typeof value !== "boolean" && !(typeof value === "number" && Number.isFinite(value))) return;
|
|
9616
9675
|
const text = String(value);
|
|
9617
9676
|
if ([...text].some((character) => character.charCodeAt(0) > 255 || /[\0\r\n]/.test(character))) return;
|
|
@@ -9712,7 +9771,14 @@ var workflowCapabilitySchema = strictObject({
|
|
|
9712
9771
|
inputs: array(port),
|
|
9713
9772
|
outputs: array(port).nullable()
|
|
9714
9773
|
});
|
|
9715
|
-
var capability = union([
|
|
9774
|
+
var capability = union([
|
|
9775
|
+
connectorCapabilitySchema,
|
|
9776
|
+
workflowCapabilitySchema,
|
|
9777
|
+
strictObject({
|
|
9778
|
+
kind: literal("http"),
|
|
9779
|
+
hosts: array(text.refine(isHttpHost, "Use a lowercase host name or IPv4 address, optionally prefixed by \"*.\" for subdomains.")).min(1).max(20).describe("Hosts Code may call with context.fetch. \"*.example.com\" matches subdomains only.")
|
|
9780
|
+
})
|
|
9781
|
+
]);
|
|
9716
9782
|
var inline = object({
|
|
9717
9783
|
...ports,
|
|
9718
9784
|
name: text,
|
|
@@ -9822,7 +9888,8 @@ var managedFields = object({
|
|
|
9822
9888
|
kind: literal("workflow"),
|
|
9823
9889
|
flowId: text,
|
|
9824
9890
|
revisionId: text
|
|
9825
|
-
})
|
|
9891
|
+
}),
|
|
9892
|
+
httpRequestExecutorSchema
|
|
9826
9893
|
])
|
|
9827
9894
|
});
|
|
9828
9895
|
var managed = managedFields.transform(limitDecisionTask);
|
|
@@ -10075,7 +10142,8 @@ object({
|
|
|
10075
10142
|
literal(8),
|
|
10076
10143
|
literal(9),
|
|
10077
10144
|
literal(10),
|
|
10078
|
-
literal(11)
|
|
10145
|
+
literal(11),
|
|
10146
|
+
literal(12)
|
|
10079
10147
|
]),
|
|
10080
10148
|
document,
|
|
10081
10149
|
modules: record$1(text, module)
|
|
@@ -10492,10 +10560,12 @@ function nodeSystemOutputPorts(node) {
|
|
|
10492
10560
|
} } : {};
|
|
10493
10561
|
}
|
|
10494
10562
|
//#endregion
|
|
10495
|
-
//#region src/flow/common/
|
|
10563
|
+
//#region src/flow/common/model.ts
|
|
10496
10564
|
function portsByHandle(ports) {
|
|
10497
10565
|
return Object.fromEntries(ports.flatMap((port) => "handle" in port ? [[port.handle, port]] : []));
|
|
10498
10566
|
}
|
|
10567
|
+
//#endregion
|
|
10568
|
+
//#region src/flow/common/change.ts
|
|
10499
10569
|
function isTriggerNode(node) {
|
|
10500
10570
|
return [
|
|
10501
10571
|
"manual",
|
|
@@ -11458,7 +11528,7 @@ function executeNode(context, input) {
|
|
|
11458
11528
|
const kind = nodeKind(node);
|
|
11459
11529
|
const title = nodeTitle(node);
|
|
11460
11530
|
const projectedInputs = Object.fromEntries(Object.entries(nodeInputs).filter(([handle]) => {
|
|
11461
|
-
if (node.kind == "task" && "executor" in node.task && node.task
|
|
11531
|
+
if (node.kind == "task" && "executor" in node.task && ["openapi", "http-request"].includes(node.task.executor.kind) && handle.startsWith("auth.")) return false;
|
|
11462
11532
|
const mapping = nodeInputMappings(node)[handle];
|
|
11463
11533
|
return mapping?.kind != "sources" || mapping.sources.every((source) => source.kind != "binding");
|
|
11464
11534
|
}));
|
|
@@ -11509,7 +11579,7 @@ function executeNode(context, input) {
|
|
|
11509
11579
|
input: Object.fromEntries(Object.entries(nodeInputs).filter(([handle]) => {
|
|
11510
11580
|
if (additional.has(handle)) return false;
|
|
11511
11581
|
const task = "executor" in node.task ? node.task : void 0;
|
|
11512
|
-
if (task
|
|
11582
|
+
if (task == null || !["openapi", "http-request"].includes(task.executor.kind)) return true;
|
|
11513
11583
|
const mapping = node.inputs[handle];
|
|
11514
11584
|
return mapping?.kind != "unset" && (mapping != null || task.inputs.some((port) => "handle" in port && port.handle == handle && port.value !== void 0));
|
|
11515
11585
|
})),
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import type { TriggerKeySnapshot } from './flow-change.js';
|
|
2
2
|
import type { UiLanguage } from './localization.js';
|
|
3
|
+
import type { TriggerDisplay } from './trigger-localization.js';
|
|
3
4
|
import type { TriggerKeySummary } from './control-api.js';
|
|
4
|
-
export interface TriggerDisplay {
|
|
5
|
-
readonly configInputs: Readonly<Record<string, string>>;
|
|
6
|
-
readonly configInputLabels: Readonly<Record<string, string>>;
|
|
7
|
-
readonly displayName: string;
|
|
8
|
-
readonly description: string;
|
|
9
|
-
readonly outputs: Readonly<Record<string, string>>;
|
|
10
|
-
}
|
|
11
5
|
export interface TriggerCatalog {
|
|
12
6
|
readonly version: 3;
|
|
13
7
|
readonly locale: UiLanguage;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Group, InputPort, InputValues, JsonValue } from './flow-
|
|
1
|
+
import type { Group, InputPort, InputValues, JsonValue } from './flow-model.js';
|
|
2
2
|
/** Deployment-bound selections owned by the Trigger configuration contract. */
|
|
3
3
|
export declare function clearTriggerExternalConfig(key: string, config: InputValues): InputValues;
|
|
4
4
|
export declare function triggerConfigValue(input: InputPort, config: InputValues): JsonValue | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { JsonValue, Port, PortDefinition
|
|
1
|
+
import type { JsonValue, Port, PortDefinition } from './flow-model.js';
|
|
2
|
+
import type { TriggerNode } from './trigger-model.js';
|
|
2
3
|
import { webhookMethods, webhookSupportsBody } from './webhook-method.js';
|
|
3
4
|
export { webhookMethods, webhookSupportsBody };
|
|
4
5
|
export declare const errorOutputs: readonly Port[];
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import type { TriggerDisplay } from './trigger-catalog.js';
|
|
2
|
-
import type { TriggerKeySnapshot } from './flow-change.js';
|
|
3
1
|
import type { UiLanguage } from './localization.js';
|
|
2
|
+
import type { TriggerKeySnapshot } from './trigger-model.js';
|
|
3
|
+
export interface TriggerDisplay {
|
|
4
|
+
readonly configInputs: Readonly<Record<string, string>>;
|
|
5
|
+
readonly configInputLabels: Readonly<Record<string, string>>;
|
|
6
|
+
readonly displayName: string;
|
|
7
|
+
readonly description: string;
|
|
8
|
+
readonly outputs: Readonly<Record<string, string>>;
|
|
9
|
+
}
|
|
4
10
|
type Translations = Readonly<Record<string, Partial<TriggerDisplay>>>;
|
|
5
11
|
export declare function loadTriggerTranslations(locale: UiLanguage): Promise<Translations>;
|
|
6
12
|
export declare function localizeTrigger(definition: TriggerKeySnapshot, locale: UiLanguage): Promise<TriggerDisplay>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { Group, InputPort, InputValues, Port } from './flow-model.js';
|
|
2
|
+
import type { WebhookMethod } from './webhook-method.js';
|
|
3
|
+
/** Trigger node shapes. The graph node union and its operations belong to flow/common/change.ts. */
|
|
4
|
+
export type TriggerSchedule = {
|
|
5
|
+
readonly expression: string;
|
|
6
|
+
readonly timezone: string;
|
|
7
|
+
readonly type: 'cron';
|
|
8
|
+
} | {
|
|
9
|
+
readonly type: 'every';
|
|
10
|
+
readonly unit: 'day' | 'hour' | 'minute' | 'month' | 'week';
|
|
11
|
+
readonly value: number;
|
|
12
|
+
};
|
|
13
|
+
interface TriggerKeySnapshotBase {
|
|
14
|
+
readonly configInputs: readonly (InputPort | Group)[];
|
|
15
|
+
readonly definitionVersion: number;
|
|
16
|
+
readonly description: string;
|
|
17
|
+
readonly displayName: string;
|
|
18
|
+
readonly key: string;
|
|
19
|
+
readonly name: string;
|
|
20
|
+
readonly outputs: readonly Port[];
|
|
21
|
+
readonly provider: string;
|
|
22
|
+
}
|
|
23
|
+
export type IntegrationEndpointMethod = 'DELETE' | 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT';
|
|
24
|
+
export type IntegrationBodyFormat = 'form' | 'json' | 'multipart' | 'text';
|
|
25
|
+
export interface IntegrationEndpointDeclaration {
|
|
26
|
+
readonly body: {
|
|
27
|
+
readonly allowArray: boolean;
|
|
28
|
+
readonly allowEmpty: boolean;
|
|
29
|
+
readonly formats: readonly IntegrationBodyFormat[];
|
|
30
|
+
};
|
|
31
|
+
readonly methods: readonly IntegrationEndpointMethod[];
|
|
32
|
+
readonly successStatus: number;
|
|
33
|
+
}
|
|
34
|
+
export type TriggerKeySnapshot = (TriggerKeySnapshotBase & {
|
|
35
|
+
readonly type: 'poll';
|
|
36
|
+
}) | (TriggerKeySnapshotBase & {
|
|
37
|
+
readonly endpoint: IntegrationEndpointDeclaration;
|
|
38
|
+
readonly type: 'integration';
|
|
39
|
+
});
|
|
40
|
+
export interface WebhookBodyField extends InputPort {
|
|
41
|
+
}
|
|
42
|
+
export interface WebhookOptions {
|
|
43
|
+
readonly allowedOrigins?: readonly string[];
|
|
44
|
+
readonly responseBody?: {
|
|
45
|
+
readonly kind: 'workflow-outputs';
|
|
46
|
+
readonly output?: string;
|
|
47
|
+
readonly timeoutMs?: number;
|
|
48
|
+
} | {
|
|
49
|
+
readonly kind: 'webhook-response';
|
|
50
|
+
readonly nodeId?: string;
|
|
51
|
+
readonly timeoutMs?: number;
|
|
52
|
+
};
|
|
53
|
+
readonly responseData?: string;
|
|
54
|
+
readonly responseHeaders?: Readonly<Record<string, string>>;
|
|
55
|
+
readonly responseHeadersSource?: {
|
|
56
|
+
readonly kind: 'workflow-outputs';
|
|
57
|
+
readonly output?: string;
|
|
58
|
+
};
|
|
59
|
+
readonly responseHeaderOutputs?: Readonly<Record<string, string>>;
|
|
60
|
+
readonly responseStatusCode?: number;
|
|
61
|
+
readonly responseStatusCodeOutput?: string;
|
|
62
|
+
}
|
|
63
|
+
interface TriggerNodeBase {
|
|
64
|
+
readonly onError?: never;
|
|
65
|
+
readonly description?: string;
|
|
66
|
+
readonly icon?: string;
|
|
67
|
+
readonly name: string;
|
|
68
|
+
}
|
|
69
|
+
export type TriggerNode = (TriggerNodeBase & {
|
|
70
|
+
readonly kind: 'manual';
|
|
71
|
+
}) | (TriggerNodeBase & {
|
|
72
|
+
readonly kind: 'start';
|
|
73
|
+
readonly inputDefs: readonly Port[];
|
|
74
|
+
}) | (TriggerNodeBase & {
|
|
75
|
+
readonly kind: 'error';
|
|
76
|
+
readonly sourceFlowIds?: readonly string[];
|
|
77
|
+
}) | (TriggerNodeBase & {
|
|
78
|
+
readonly bodyFields: readonly WebhookBodyField[];
|
|
79
|
+
readonly kind: 'webhook';
|
|
80
|
+
readonly method: WebhookMethod;
|
|
81
|
+
readonly options?: WebhookOptions;
|
|
82
|
+
}) | (TriggerNodeBase & {
|
|
83
|
+
readonly cronTimes: readonly TriggerSchedule[];
|
|
84
|
+
readonly kind: 'cron';
|
|
85
|
+
}) | (TriggerNodeBase & {
|
|
86
|
+
readonly connectionId?: string;
|
|
87
|
+
readonly config: InputValues;
|
|
88
|
+
readonly definition: TriggerKeySnapshot & {
|
|
89
|
+
readonly type: 'poll';
|
|
90
|
+
};
|
|
91
|
+
readonly kind: 'poll';
|
|
92
|
+
readonly pollTimes: readonly TriggerSchedule[];
|
|
93
|
+
}) | (TriggerNodeBase & {
|
|
94
|
+
readonly connectionId?: string;
|
|
95
|
+
readonly config: InputValues;
|
|
96
|
+
readonly definition: TriggerKeySnapshot & {
|
|
97
|
+
readonly type: 'integration';
|
|
98
|
+
};
|
|
99
|
+
readonly kind: 'integration';
|
|
100
|
+
});
|
|
101
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InputPort, JsonValue, Port, PortDefinition } from './flow-
|
|
1
|
+
import type { InputPort, JsonValue, Port, PortDefinition } from './flow-model.js';
|
|
2
2
|
export declare const webhookResponseTimeout: {
|
|
3
3
|
readonly defaultMs: 30000;
|
|
4
4
|
readonly minMs: 1000;
|
|
@@ -27,8 +27,6 @@ export declare const webhookHeadersPort: {
|
|
|
27
27
|
readonly nullable: true;
|
|
28
28
|
};
|
|
29
29
|
export declare function workflowOutputsPort(outputs: readonly Port[]): PortDefinition;
|
|
30
|
-
/** Header names are case-insensitive; never silently combine duplicate business fields. */
|
|
31
|
-
export declare function webhookHeaderNameIssue(name: string, names: readonly string[]): 'invalid' | 'duplicate' | undefined;
|
|
32
30
|
/** Fixed inputs belong to the node, not author-supplied definitions. */
|
|
33
31
|
export declare const webhookResponseInputs: readonly InputPort[];
|
|
34
32
|
export interface WebhookResponseSnapshot {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { JsonValue
|
|
1
|
+
import type { JsonValue } from './flow-model.js';
|
|
2
|
+
import type { WebhookMethod } from './webhook-method.js';
|
|
3
|
+
import type { WebhookBodyField, WebhookOptions } from './trigger-model.js';
|
|
2
4
|
export { webhookSupportsBody } from './trigger-contract.js';
|
|
3
5
|
export { webhookResponseAllowsBody, webhookResponseTimeout } from './webhook-response.js';
|
|
4
6
|
export type { WebhookResponseSnapshot } from './webhook-response.js';
|
|
@@ -91,6 +91,13 @@ function isJsonObject(value) {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
//#endregion
|
|
94
|
+
//#region src/http/common/headers.ts
|
|
95
|
+
/** Header names are case-insensitive; never silently combine duplicate business fields. */
|
|
96
|
+
function httpHeaderNameIssue(name, names) {
|
|
97
|
+
if (!/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/.test(name)) return "invalid";
|
|
98
|
+
if (names.some((candidate) => candidate.toLowerCase() === name.toLowerCase())) return "duplicate";
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
94
101
|
//#region src/flow/common/webhookResponse.ts
|
|
95
102
|
var webhookResponseTimeout = {
|
|
96
103
|
defaultMs: 3e4,
|
|
@@ -100,7 +107,7 @@ var webhookResponseTimeout = {
|
|
|
100
107
|
function webhookResponseAllowsBody(status) {
|
|
101
108
|
return status !== 204 && status !== 205 && status !== 304;
|
|
102
109
|
}
|
|
103
|
-
|
|
110
|
+
({
|
|
104
111
|
jsonSchema: {
|
|
105
112
|
type: "object",
|
|
106
113
|
additionalProperties: { type: [
|
|
@@ -110,13 +117,7 @@ var webhookHeadersPort = {
|
|
|
110
117
|
] }
|
|
111
118
|
},
|
|
112
119
|
nullable: true
|
|
113
|
-
};
|
|
114
|
-
/** Header names are case-insensitive; never silently combine duplicate business fields. */
|
|
115
|
-
function webhookHeaderNameIssue(name, names) {
|
|
116
|
-
if (!/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/.test(name)) return "invalid";
|
|
117
|
-
if (names.some((candidate) => candidate.toLowerCase() === name.toLowerCase())) return "duplicate";
|
|
118
|
-
}
|
|
119
|
-
webhookHeadersPort.jsonSchema;
|
|
120
|
+
}).jsonSchema;
|
|
120
121
|
function validWebhookStatus(value) {
|
|
121
122
|
return typeof value === "number" && Number.isInteger(value) && value >= 200 && value <= 599 && webhookResponseAllowsBody(value);
|
|
122
123
|
}
|
|
@@ -126,7 +127,7 @@ function webhookHeaderValues(source) {
|
|
|
126
127
|
const headers = {};
|
|
127
128
|
const names = [];
|
|
128
129
|
for (const [name, value] of Object.entries(source)) {
|
|
129
|
-
if (
|
|
130
|
+
if (httpHeaderNameIssue(name, names) != null) return;
|
|
130
131
|
if (typeof value !== "string" && typeof value !== "boolean" && !(typeof value === "number" && Number.isFinite(value))) return;
|
|
131
132
|
const text = String(value);
|
|
132
133
|
if ([...text].some((character) => character.charCodeAt(0) > 255 || /[\0\r\n]/.test(character))) return;
|
|
@@ -2929,7 +2930,7 @@ function webhookResponseHeaders(result, options) {
|
|
|
2929
2930
|
if (!isJsonObject(source)) return;
|
|
2930
2931
|
const values = /* @__PURE__ */ new Map();
|
|
2931
2932
|
for (const [name, value] of Object.entries(source)) {
|
|
2932
|
-
if (
|
|
2933
|
+
if (httpHeaderNameIssue(name, [...values.values()].map((entry) => entry.name)) != null) return;
|
|
2933
2934
|
values.set(name.toLowerCase(), {
|
|
2934
2935
|
name,
|
|
2935
2936
|
value
|
|
@@ -2938,7 +2939,7 @@ function webhookResponseHeaders(result, options) {
|
|
|
2938
2939
|
if (whole == null) {
|
|
2939
2940
|
const names = [];
|
|
2940
2941
|
for (const [name, output] of Object.entries(options.responseHeaderOutputs ?? {})) {
|
|
2941
|
-
if (
|
|
2942
|
+
if (httpHeaderNameIssue(name, names) != null) return;
|
|
2942
2943
|
names.push(name);
|
|
2943
2944
|
values.set(name.toLowerCase(), {
|
|
2944
2945
|
name,
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type { TaskNode, ManagedTaskDefinition, Port, JsonValue, RevisionContent,
|
|
1
|
+
import type { TaskNode, ManagedTaskDefinition, Port, JsonValue, RevisionContent, WorkflowCapability, AgentWorkflowTool } from './flow-change.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
readonly flowId: string;
|
|
6
|
-
readonly revisionId: string;
|
|
7
|
-
}
|
|
3
|
+
export type { WorkflowExecutor } from './flow-model.js';
|
|
4
|
+
export { nodeWorkflowReferences } from './flow-workflowReferences.js';
|
|
8
5
|
export declare const publishedWorkflowInterfaceSchema: z.ZodObject<{
|
|
9
6
|
inputs: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
10
7
|
handle: z.ZodString;
|
|
@@ -91,12 +88,6 @@ export declare const workflowReferencesSchema: z.ZodObject<{
|
|
|
91
88
|
}, z.core.$strip>>;
|
|
92
89
|
}, z.core.$strip>;
|
|
93
90
|
export type WorkflowReferences = z.infer<typeof workflowReferencesSchema>;
|
|
94
|
-
/** Workflow declarations share discovery across authoring, admission and resource indexing. */
|
|
95
|
-
export declare function nodeWorkflowReferences(node: GraphNode): readonly {
|
|
96
|
-
readonly target: Omit<WorkflowCapability, 'kind' | 'name'>;
|
|
97
|
-
readonly path: string;
|
|
98
|
-
readonly tool?: string;
|
|
99
|
-
}[];
|
|
100
91
|
export declare function workflowCapability(name: string, target: WorkflowContract | WorkflowCandidate): WorkflowCapability;
|
|
101
92
|
export declare function workflowAgentTool(id: string, name: string, target: WorkflowContract | WorkflowCandidate, previous?: AgentWorkflowTool): AgentWorkflowTool;
|
|
102
93
|
export declare function workflowInterfaceIssues(target: {
|
package/dist/common/workflow.js
CHANGED
|
@@ -9531,6 +9531,31 @@ function comparePorts(source, target) {
|
|
|
9531
9531
|
} : result;
|
|
9532
9532
|
}
|
|
9533
9533
|
//#endregion
|
|
9534
|
+
//#region src/flow/common/workflowReferences.ts
|
|
9535
|
+
/** Workflow declarations share discovery across authoring, admission and resource indexing. */
|
|
9536
|
+
function nodeWorkflowReferences(node) {
|
|
9537
|
+
if (node.kind != "task") return [];
|
|
9538
|
+
if ("moduleId" in node.task) return (node.task.capabilities ?? []).flatMap((item, index) => item.kind == "workflow" ? [{
|
|
9539
|
+
target: item,
|
|
9540
|
+
path: `task/capabilities/${index}`,
|
|
9541
|
+
tool: item.name
|
|
9542
|
+
}] : []);
|
|
9543
|
+
if (node.task.executor.kind == "workflow") return [{
|
|
9544
|
+
target: {
|
|
9545
|
+
...node.task.executor,
|
|
9546
|
+
inputs: node.task.inputs.filter((port) => "handle" in port),
|
|
9547
|
+
outputs: node.task.outputs.filter((port) => "handle" in port)
|
|
9548
|
+
},
|
|
9549
|
+
path: "task/executor"
|
|
9550
|
+
}];
|
|
9551
|
+
if (node.task.executor.kind == "agent") return node.task.executor.tools.flatMap((item, index) => item.kind == "workflow" ? [{
|
|
9552
|
+
target: item,
|
|
9553
|
+
path: `task/executor/tools/${index}`,
|
|
9554
|
+
tool: item.name
|
|
9555
|
+
}] : []);
|
|
9556
|
+
return [];
|
|
9557
|
+
}
|
|
9558
|
+
//#endregion
|
|
9534
9559
|
//#region src/workflow/common/workflow.ts
|
|
9535
9560
|
var portSchema = object({
|
|
9536
9561
|
handle: string().min(1),
|
|
@@ -9686,29 +9711,6 @@ var workflowReferencesSchema = object({
|
|
|
9686
9711
|
}).nullable()
|
|
9687
9712
|
}))
|
|
9688
9713
|
});
|
|
9689
|
-
/** Workflow declarations share discovery across authoring, admission and resource indexing. */
|
|
9690
|
-
function nodeWorkflowReferences(node) {
|
|
9691
|
-
if (node.kind != "task") return [];
|
|
9692
|
-
if ("moduleId" in node.task) return (node.task.capabilities ?? []).flatMap((item, index) => item.kind == "workflow" ? [{
|
|
9693
|
-
target: item,
|
|
9694
|
-
path: `task/capabilities/${index}`,
|
|
9695
|
-
tool: item.name
|
|
9696
|
-
}] : []);
|
|
9697
|
-
if (node.task.executor.kind == "workflow") return [{
|
|
9698
|
-
target: {
|
|
9699
|
-
...node.task.executor,
|
|
9700
|
-
inputs: node.task.inputs.filter((port) => "handle" in port),
|
|
9701
|
-
outputs: node.task.outputs.filter((port) => "handle" in port)
|
|
9702
|
-
},
|
|
9703
|
-
path: "task/executor"
|
|
9704
|
-
}];
|
|
9705
|
-
if (node.task.executor.kind == "agent") return node.task.executor.tools.flatMap((item, index) => item.kind == "workflow" ? [{
|
|
9706
|
-
target: item,
|
|
9707
|
-
path: `task/executor/tools/${index}`,
|
|
9708
|
-
tool: item.name
|
|
9709
|
-
}] : []);
|
|
9710
|
-
return [];
|
|
9711
|
-
}
|
|
9712
9714
|
function workflowCapability(name, target) {
|
|
9713
9715
|
return {
|
|
9714
9716
|
kind: "workflow",
|