@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,4 +1,5 @@
|
|
|
1
|
-
import type { JsonValue
|
|
1
|
+
import type { JsonValue } from './flow-model.js';
|
|
2
|
+
import type { TriggerSchedule } from './trigger-model.js';
|
|
2
3
|
export declare function validateTriggerSchedule(rules: readonly TriggerSchedule[]): void;
|
|
3
4
|
export declare function validateCronExpression(expression: string, timezone: string): void;
|
|
4
5
|
export declare function nextTriggerScheduledAt(rules: readonly TriggerSchedule[], afterMs: number): number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { JsonValue,
|
|
1
|
+
import type { JsonValue, ManagedTaskDefinitionOf, TaskExecutor } from './flow-model.js';
|
|
2
2
|
export type DecisionQuestion = {
|
|
3
3
|
readonly name: string;
|
|
4
4
|
readonly instructions: string;
|
|
@@ -36,12 +36,12 @@ export declare const decisionLimits: {
|
|
|
36
36
|
export declare function limitDecisionQuestion(question: DecisionQuestion): DecisionQuestion;
|
|
37
37
|
export declare function limitDecisionQuestions(questions: readonly DecisionQuestion[]): readonly DecisionQuestion[];
|
|
38
38
|
/** Loading an oversized task also updates its previously generated output schemas. */
|
|
39
|
-
export declare function limitDecisionTask(task:
|
|
39
|
+
export declare function limitDecisionTask<Task extends ManagedTaskDefinitionOf<TaskExecutor>>(task: Task): Task;
|
|
40
40
|
export declare const decisionStateSchema: JsonValue;
|
|
41
41
|
export declare const defaultDecisionQuestion: (name?: string) => DecisionQuestion;
|
|
42
42
|
export declare function decisionQuestionIssues(questions: readonly DecisionQuestion[]): readonly DecisionIssue[];
|
|
43
43
|
export declare function decisionAnswerSchema(question: DecisionQuestion): JsonValue;
|
|
44
|
-
export declare function decisionTask(questions?: readonly DecisionQuestion[], name?: string):
|
|
45
|
-
export declare function decisionTaskIssues(task:
|
|
44
|
+
export declare function decisionTask(questions?: readonly DecisionQuestion[], name?: string): ManagedTaskDefinitionOf<DecisionExecutor>;
|
|
45
|
+
export declare function decisionTaskIssues(task: ManagedTaskDefinitionOf<TaskExecutor>): readonly DecisionIssue[];
|
|
46
46
|
export declare function decisionRequest(questions: readonly DecisionQuestion[], state: JsonValue): JsonValue;
|
|
47
47
|
export declare function decisionAnswers(questions: readonly DecisionQuestion[], response: unknown): Readonly<Record<string, JsonValue>>;
|
package/dist/common/decision.js
CHANGED
|
@@ -3686,6 +3686,9 @@ function schemaValidationErrors(value, schema) {
|
|
|
3686
3686
|
}
|
|
3687
3687
|
//#endregion
|
|
3688
3688
|
//#region src/decision/common/decision.ts
|
|
3689
|
+
function isDecisionExecutor(executor) {
|
|
3690
|
+
return executor.kind === "decision";
|
|
3691
|
+
}
|
|
3689
3692
|
var decisionModel = "typesafe/jev";
|
|
3690
3693
|
var decisionLimits = {
|
|
3691
3694
|
choice: 255,
|
|
@@ -3709,7 +3712,7 @@ function limitDecisionQuestions(questions) {
|
|
|
3709
3712
|
}
|
|
3710
3713
|
/** Loading an oversized task also updates its previously generated output schemas. */
|
|
3711
3714
|
function limitDecisionTask(task) {
|
|
3712
|
-
if (task.executor
|
|
3715
|
+
if (!isDecisionExecutor(task.executor)) return task;
|
|
3713
3716
|
const original = task.executor.questions;
|
|
3714
3717
|
const questions = limitDecisionQuestions(original);
|
|
3715
3718
|
if (questions === original) return task;
|
|
@@ -3834,7 +3837,7 @@ function decisionTask(questions = [defaultDecisionQuestion()], name = "AI Decisi
|
|
|
3834
3837
|
}
|
|
3835
3838
|
function decisionTaskIssues(task) {
|
|
3836
3839
|
task = limitDecisionTask(task);
|
|
3837
|
-
if (task.executor
|
|
3840
|
+
if (!isDecisionExecutor(task.executor)) return [];
|
|
3838
3841
|
const expected = decisionTask(task.executor.questions, task.name);
|
|
3839
3842
|
return [...decisionQuestionIssues(task.executor.questions), ...!dequal(task.inputs, expected.inputs) || !dequal(task.outputs, expected.outputs) ? [{
|
|
3840
3843
|
field: "ports",
|
|
@@ -6,7 +6,12 @@ export interface EngineContract {
|
|
|
6
6
|
readonly waitAutoContinue?: boolean;
|
|
7
7
|
readonly webhookResponses?: boolean;
|
|
8
8
|
readonly workflowTools?: boolean;
|
|
9
|
+
readonly httpRequests?: boolean;
|
|
10
|
+
/** Code may call `context.fetch` for hosts declared by its `http` Capability. */
|
|
11
|
+
readonly codeFetch?: boolean;
|
|
9
12
|
}
|
|
10
|
-
|
|
13
|
+
/** v9 is a single contract: the Node compatibility builtins, `context.fetch`, and no `context.egress`. */
|
|
14
|
+
export declare const currentEngineContract = "open-flow-engine/v9";
|
|
15
|
+
/** The published v8 Node compatibility contract, retained for existing Publications and Runs. */
|
|
11
16
|
export declare const nodejsEngineContract = "open-flow-engine/v8/nodejs-compat-v1";
|
|
12
17
|
export declare function findEngineContract(contract: string): EngineContract | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Public projection of a source that Connector validates and Open Flow exposes unchanged. */
|
|
3
|
+
export declare const eventSourceViewSchema: z.ZodObject<{
|
|
4
|
+
appId: z.ZodNullable<z.ZodString>;
|
|
5
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
6
|
+
installationId: z.ZodOptional<z.ZodString>;
|
|
7
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
8
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
9
|
+
projectKey: z.ZodOptional<z.ZodString>;
|
|
10
|
+
subscriptionStatus: z.ZodOptional<z.ZodEnum<{
|
|
11
|
+
error: "error";
|
|
12
|
+
idle: "idle";
|
|
13
|
+
pending: "pending";
|
|
14
|
+
ready: "ready";
|
|
15
|
+
}>>;
|
|
16
|
+
lastError: z.ZodOptional<z.ZodString>;
|
|
17
|
+
signingSecretConfigured: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
manageSubscriptions: z.ZodNullable<z.ZodBoolean>;
|
|
19
|
+
verificationTokenConfigured: z.ZodNullable<z.ZodBoolean>;
|
|
20
|
+
encryptKeyConfigured: z.ZodNullable<z.ZodBoolean>;
|
|
21
|
+
verifiedAt: z.ZodNullable<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EventSourceDefinition, SourceConfiguration } from './event-source-definition.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { eventSourceViewSchema } from './event-
|
|
3
|
+
import { eventSourceViewSchema } from './event-source-view.js';
|
|
4
4
|
export type { EventSourceDefinition, SourceConfiguration, SourceEvent, SourceSubscription, SourceOperation, SourceReference, SourceReferenceOperation, } from './event-source-definition.js';
|
|
5
5
|
export { SourceIdentityError } from './event-source-definition.js';
|
|
6
6
|
export declare function eventSourceDefinition(kind: string): EventSourceDefinition;
|
|
@@ -5569,71 +5569,6 @@ function json(params) {
|
|
|
5569
5569
|
return jsonSchema;
|
|
5570
5570
|
}
|
|
5571
5571
|
//#endregion
|
|
5572
|
-
//#region src/control/common/eventSources.ts
|
|
5573
|
-
var id = string().min(1).max(256);
|
|
5574
|
-
var eventType = string().regex(/^[a-z][a-z0-9_.:]{0,127}$/);
|
|
5575
|
-
var name = string().trim().min(1).max(128);
|
|
5576
|
-
var eventSourceViewSchema = object({
|
|
5577
|
-
version: literal(1),
|
|
5578
|
-
sourceId: id,
|
|
5579
|
-
revision: int().positive(),
|
|
5580
|
-
name,
|
|
5581
|
-
provider: _enum([
|
|
5582
|
-
"feishu",
|
|
5583
|
-
"feishu_app_bot",
|
|
5584
|
-
"slackbot",
|
|
5585
|
-
"intercom",
|
|
5586
|
-
"sentry",
|
|
5587
|
-
"zoom",
|
|
5588
|
-
"fireflies",
|
|
5589
|
-
"jira"
|
|
5590
|
-
]),
|
|
5591
|
-
appId: id.nullable(),
|
|
5592
|
-
workspaceId: id.optional(),
|
|
5593
|
-
installationId: id.optional(),
|
|
5594
|
-
organizationId: id.optional(),
|
|
5595
|
-
projectId: id.optional(),
|
|
5596
|
-
projectKey: id.optional(),
|
|
5597
|
-
subscriptionStatus: _enum([
|
|
5598
|
-
"idle",
|
|
5599
|
-
"pending",
|
|
5600
|
-
"ready",
|
|
5601
|
-
"error"
|
|
5602
|
-
]).optional(),
|
|
5603
|
-
lastError: string().optional(),
|
|
5604
|
-
signingSecretConfigured: boolean().optional(),
|
|
5605
|
-
connectionId: id,
|
|
5606
|
-
teamId: id.nullable(),
|
|
5607
|
-
enabled: boolean(),
|
|
5608
|
-
eventTypes: array(eventType),
|
|
5609
|
-
manageSubscriptions: boolean().nullable(),
|
|
5610
|
-
verificationTokenConfigured: boolean().nullable(),
|
|
5611
|
-
encryptKeyConfigured: boolean().nullable(),
|
|
5612
|
-
endpointUrl: string().nullable(),
|
|
5613
|
-
verifiedAt: string().nullable(),
|
|
5614
|
-
lastReceivedAt: string().nullable(),
|
|
5615
|
-
updatedAt: string(),
|
|
5616
|
-
consumers: array(object({
|
|
5617
|
-
flowId: id,
|
|
5618
|
-
flowName: string(),
|
|
5619
|
-
triggerNodeId: id
|
|
5620
|
-
}))
|
|
5621
|
-
}).pick({
|
|
5622
|
-
appId: true,
|
|
5623
|
-
workspaceId: true,
|
|
5624
|
-
installationId: true,
|
|
5625
|
-
organizationId: true,
|
|
5626
|
-
projectId: true,
|
|
5627
|
-
projectKey: true,
|
|
5628
|
-
subscriptionStatus: true,
|
|
5629
|
-
lastError: true,
|
|
5630
|
-
signingSecretConfigured: true,
|
|
5631
|
-
manageSubscriptions: true,
|
|
5632
|
-
verificationTokenConfigured: true,
|
|
5633
|
-
encryptKeyConfigured: true,
|
|
5634
|
-
verifiedAt: true
|
|
5635
|
-
});
|
|
5636
|
-
//#endregion
|
|
5637
5572
|
//#region src/event-source/common/catalog.generated.json
|
|
5638
5573
|
var catalog_generated_default = [
|
|
5639
5574
|
{
|
|
@@ -5704,6 +5639,30 @@ var catalog_generated_default = [
|
|
|
5704
5639
|
//#region src/event-source/common/definition.ts
|
|
5705
5640
|
var SourceIdentityError = class extends Error {};
|
|
5706
5641
|
//#endregion
|
|
5642
|
+
//#region src/event-source/common/view.ts
|
|
5643
|
+
var id = string().min(1).max(256);
|
|
5644
|
+
/** Public projection of a source that Connector validates and Open Flow exposes unchanged. */
|
|
5645
|
+
var eventSourceViewSchema = object({
|
|
5646
|
+
appId: id.nullable(),
|
|
5647
|
+
workspaceId: id.optional(),
|
|
5648
|
+
installationId: id.optional(),
|
|
5649
|
+
organizationId: id.optional(),
|
|
5650
|
+
projectId: id.optional(),
|
|
5651
|
+
projectKey: id.optional(),
|
|
5652
|
+
subscriptionStatus: _enum([
|
|
5653
|
+
"idle",
|
|
5654
|
+
"pending",
|
|
5655
|
+
"ready",
|
|
5656
|
+
"error"
|
|
5657
|
+
]).optional(),
|
|
5658
|
+
lastError: string().optional(),
|
|
5659
|
+
signingSecretConfigured: boolean().optional(),
|
|
5660
|
+
manageSubscriptions: boolean().nullable(),
|
|
5661
|
+
verificationTokenConfigured: boolean().nullable(),
|
|
5662
|
+
encryptKeyConfigured: boolean().nullable(),
|
|
5663
|
+
verifiedAt: string().nullable()
|
|
5664
|
+
});
|
|
5665
|
+
//#endregion
|
|
5707
5666
|
//#region src/event-source/common/index.ts
|
|
5708
5667
|
function eventSourceDefinition(kind) {
|
|
5709
5668
|
for (const entry of catalog_generated_default) if (entry.kind === kind) return entry;
|
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const eventSourceViewSchema: z.ZodObject<{
|
|
3
|
-
appId: z.ZodNullable<z.ZodString>;
|
|
4
|
-
workspaceId: z.ZodOptional<z.ZodString>;
|
|
5
|
-
installationId: z.ZodOptional<z.ZodString>;
|
|
6
|
-
organizationId: z.ZodOptional<z.ZodString>;
|
|
7
|
-
projectId: z.ZodOptional<z.ZodString>;
|
|
8
|
-
projectKey: z.ZodOptional<z.ZodString>;
|
|
9
|
-
subscriptionStatus: z.ZodOptional<z.ZodEnum<{
|
|
10
|
-
error: "error";
|
|
11
|
-
idle: "idle";
|
|
12
|
-
pending: "pending";
|
|
13
|
-
ready: "ready";
|
|
14
|
-
}>>;
|
|
15
|
-
lastError: z.ZodOptional<z.ZodString>;
|
|
16
|
-
signingSecretConfigured: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
-
manageSubscriptions: z.ZodNullable<z.ZodBoolean>;
|
|
18
|
-
verificationTokenConfigured: z.ZodNullable<z.ZodBoolean>;
|
|
19
|
-
encryptKeyConfigured: z.ZodNullable<z.ZodBoolean>;
|
|
20
|
-
verifiedAt: z.ZodNullable<z.ZodString>;
|
|
21
|
-
}, z.core.$strip>;
|
|
22
1
|
export interface CreateFeishuEventSource {
|
|
23
2
|
readonly kind?: 'feishu';
|
|
24
3
|
readonly version: 1;
|
|
@@ -2887,6 +2887,9 @@ function createSchemaComparer() {
|
|
|
2887
2887
|
createSchemaComparer();
|
|
2888
2888
|
//#endregion
|
|
2889
2889
|
//#region src/decision/common/decision.ts
|
|
2890
|
+
function isDecisionExecutor(executor) {
|
|
2891
|
+
return executor.kind === "decision";
|
|
2892
|
+
}
|
|
2890
2893
|
var decisionLimits = {
|
|
2891
2894
|
choice: 255,
|
|
2892
2895
|
score: 10
|
|
@@ -2909,7 +2912,7 @@ function limitDecisionQuestions(questions) {
|
|
|
2909
2912
|
}
|
|
2910
2913
|
/** Loading an oversized task also updates its previously generated output schemas. */
|
|
2911
2914
|
function limitDecisionTask(task) {
|
|
2912
|
-
if (task.executor
|
|
2915
|
+
if (!isDecisionExecutor(task.executor)) return task;
|
|
2913
2916
|
const original = task.executor.questions;
|
|
2914
2917
|
const questions = limitDecisionQuestions(original);
|
|
2915
2918
|
if (questions === original) return task;
|
|
@@ -3009,15 +3012,6 @@ function decisionTask(questions = [defaultDecisionQuestion()], name = "AI Decisi
|
|
|
3009
3012
|
};
|
|
3010
3013
|
}
|
|
3011
3014
|
//#endregion
|
|
3012
|
-
//#region src/openapi/common/authBindings.ts
|
|
3013
|
-
/** Never allow credentials to enter a Revision as literal node inputs. */
|
|
3014
|
-
function assertOpenApiAuthBindings(document) {
|
|
3015
|
-
for (const node of Object.values(document.graph.nodes)) {
|
|
3016
|
-
if (node.kind != "task" || !("executor" in node.task) || node.task.executor.kind != "openapi") continue;
|
|
3017
|
-
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.");
|
|
3018
|
-
}
|
|
3019
|
-
}
|
|
3020
|
-
//#endregion
|
|
3021
3015
|
//#region src/flow/common/inputValue.ts
|
|
3022
3016
|
/** Converts explicit user values at authoring boundaries, never persisted legacy data. */
|
|
3023
3017
|
function inputValues(values) {
|
|
@@ -8706,6 +8700,66 @@ function preprocess(fn, schema) {
|
|
|
8706
8700
|
function datetime(params) {
|
|
8707
8701
|
return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
|
|
8708
8702
|
}
|
|
8703
|
+
//#endregion
|
|
8704
|
+
//#region src/http/common/authBindings.ts
|
|
8705
|
+
/** Never allow credentials to enter a Revision as literal inputs of an OpenAPI or HTTP request node. */
|
|
8706
|
+
function assertHttpAuthBindings(inputs) {
|
|
8707
|
+
for (const [handle, mapping] of Object.entries(inputs)) if (handle.startsWith("auth.") && mapping.kind == "value") throw new TypeError("HTTP authentication accepts deployment variables and upstream outputs only.");
|
|
8708
|
+
}
|
|
8709
|
+
//#endregion
|
|
8710
|
+
//#region src/http/common/hosts.ts
|
|
8711
|
+
/** Hosts of a Code `http` Capability: lowercase DNS names or IPv4 addresses; `*.example.com` matches subdomains only. */
|
|
8712
|
+
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])?$/;
|
|
8713
|
+
/** Wildcards must name a registrable suffix, so `*.com` is rejected. */
|
|
8714
|
+
function isHttpHost(value) {
|
|
8715
|
+
return httpHostPattern.test(value) && (!value.startsWith("*.") || value.slice(2).includes("."));
|
|
8716
|
+
}
|
|
8717
|
+
//#endregion
|
|
8718
|
+
//#region src/http/common/httpRequest.ts
|
|
8719
|
+
var parameterSchema = strictObject({
|
|
8720
|
+
mode: _enum(["fields", "object"]).default("fields"),
|
|
8721
|
+
names: array(string()).default([])
|
|
8722
|
+
});
|
|
8723
|
+
var httpRequestExecutorSchema = strictObject({
|
|
8724
|
+
method: _enum([
|
|
8725
|
+
"GET",
|
|
8726
|
+
"POST",
|
|
8727
|
+
"PUT",
|
|
8728
|
+
"PATCH",
|
|
8729
|
+
"DELETE",
|
|
8730
|
+
"HEAD",
|
|
8731
|
+
"OPTIONS"
|
|
8732
|
+
]).default("GET"),
|
|
8733
|
+
query: parameterSchema.default({
|
|
8734
|
+
mode: "fields",
|
|
8735
|
+
names: []
|
|
8736
|
+
}),
|
|
8737
|
+
headers: parameterSchema.default({
|
|
8738
|
+
mode: "fields",
|
|
8739
|
+
names: []
|
|
8740
|
+
}),
|
|
8741
|
+
bodyFormat: _enum([
|
|
8742
|
+
"none",
|
|
8743
|
+
"json",
|
|
8744
|
+
"text",
|
|
8745
|
+
"form"
|
|
8746
|
+
]).default("none"),
|
|
8747
|
+
authentication: union([
|
|
8748
|
+
strictObject({ type: literal("none") }),
|
|
8749
|
+
strictObject({ type: _enum(["bearer", "basic"]) }),
|
|
8750
|
+
strictObject({
|
|
8751
|
+
type: literal("apiKey"),
|
|
8752
|
+
name: string(),
|
|
8753
|
+
in: _enum(["header", "query"])
|
|
8754
|
+
})
|
|
8755
|
+
]).default({ type: "none" }),
|
|
8756
|
+
responseFormat: _enum([
|
|
8757
|
+
"auto",
|
|
8758
|
+
"json",
|
|
8759
|
+
"text"
|
|
8760
|
+
]).default("auto"),
|
|
8761
|
+
statusPolicy: _enum(["success", "all"]).default("success")
|
|
8762
|
+
}).extend({ kind: literal("http-request") });
|
|
8709
8763
|
function checkJsonDepth(value, depth = 0) {
|
|
8710
8764
|
if (depth > 64) throw new TypeError("Value exceeds the maximum JSON depth.");
|
|
8711
8765
|
if (value != null && typeof value == "object") for (const child of Object.values(value)) checkJsonDepth(child, depth + 1);
|
|
@@ -8716,6 +8770,7 @@ var retryNodeTypes = [
|
|
|
8716
8770
|
"code",
|
|
8717
8771
|
"connector",
|
|
8718
8772
|
"openapi",
|
|
8773
|
+
"http-request",
|
|
8719
8774
|
"llm",
|
|
8720
8775
|
"decision"
|
|
8721
8776
|
];
|
|
@@ -8882,7 +8937,14 @@ var workflowCapabilitySchema = strictObject({
|
|
|
8882
8937
|
inputs: array(port),
|
|
8883
8938
|
outputs: array(port).nullable()
|
|
8884
8939
|
});
|
|
8885
|
-
var capability = union([
|
|
8940
|
+
var capability = union([
|
|
8941
|
+
connectorCapabilitySchema,
|
|
8942
|
+
workflowCapabilitySchema,
|
|
8943
|
+
strictObject({
|
|
8944
|
+
kind: literal("http"),
|
|
8945
|
+
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.")
|
|
8946
|
+
})
|
|
8947
|
+
]);
|
|
8886
8948
|
var inline = object({
|
|
8887
8949
|
...ports,
|
|
8888
8950
|
name: text,
|
|
@@ -8992,7 +9054,8 @@ var managedFields = object({
|
|
|
8992
9054
|
kind: literal("workflow"),
|
|
8993
9055
|
flowId: text,
|
|
8994
9056
|
revisionId: text
|
|
8995
|
-
})
|
|
9057
|
+
}),
|
|
9058
|
+
httpRequestExecutorSchema
|
|
8996
9059
|
])
|
|
8997
9060
|
});
|
|
8998
9061
|
var managed = managedFields.transform(limitDecisionTask);
|
|
@@ -9261,7 +9324,8 @@ var revision = object({
|
|
|
9261
9324
|
literal(8),
|
|
9262
9325
|
literal(9),
|
|
9263
9326
|
literal(10),
|
|
9264
|
-
literal(11)
|
|
9327
|
+
literal(11),
|
|
9328
|
+
literal(12)
|
|
9265
9329
|
]),
|
|
9266
9330
|
document,
|
|
9267
9331
|
modules: record$1(text, module)
|
|
@@ -9292,7 +9356,7 @@ function decodeRevisionContent(value) {
|
|
|
9292
9356
|
checkJsonDepth(value);
|
|
9293
9357
|
const content = revision.parse(value);
|
|
9294
9358
|
checkModelVersion(content);
|
|
9295
|
-
|
|
9359
|
+
assertDocumentHttpAuthBindings(content.document);
|
|
9296
9360
|
return content;
|
|
9297
9361
|
}
|
|
9298
9362
|
var shapes = {
|
|
@@ -9462,6 +9526,8 @@ array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, sha
|
|
|
9462
9526
|
...shape
|
|
9463
9527
|
})])).values()])).min(1);
|
|
9464
9528
|
function checkModelVersion(content) {
|
|
9529
|
+
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.");
|
|
9530
|
+
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.");
|
|
9465
9531
|
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.");
|
|
9466
9532
|
if (content.modelVersion < 10 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "webhook" && (candidateNode.options?.responseBody != null || candidateNode.options?.responseStatusCodeOutput != null || candidateNode.options?.responseHeadersSource != null || candidateNode.options?.responseHeaderOutputs != null))) throw new TypeError("Dynamic Webhook responses require Flow model version 10.");
|
|
9467
9533
|
if (content.modelVersion < 9 && Object.values(content.document.graph.nodes).some((candidateNode) => "retry" in candidateNode && candidateNode.retry != null)) throw new TypeError("Node retries require Flow model version 9.");
|
|
@@ -9476,6 +9542,9 @@ function checkModelVersion(content) {
|
|
|
9476
9542
|
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.");
|
|
9477
9543
|
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.");
|
|
9478
9544
|
}
|
|
9545
|
+
function assertDocumentHttpAuthBindings(content) {
|
|
9546
|
+
for (const graphNode of Object.values(content.graph.nodes)) if (graphNode.kind == "task" && "executor" in graphNode.task && ["openapi", "http-request"].includes(graphNode.task.executor.kind)) assertHttpAuthBindings(graphNode.inputs);
|
|
9547
|
+
}
|
|
9479
9548
|
//#endregion
|
|
9480
9549
|
//#region src/flow/common/condition.ts
|
|
9481
9550
|
var unaryOperator = (operator) => operator.startsWith("is");
|
|
@@ -9554,6 +9623,8 @@ function decodeTaskCapabilities(value) {
|
|
|
9554
9623
|
if (workflowToolNameIssue(item.name, names)) throw new TypeError("Workflow tool names must be unique provider-compatible names.");
|
|
9555
9624
|
names.add(item.name);
|
|
9556
9625
|
}
|
|
9626
|
+
const http = parsed.filter((item) => item.kind == "http");
|
|
9627
|
+
if (http.length > 1 || http.some((item) => new Set(item.hosts).size != item.hosts.length)) throw new TypeError("Code declares HTTP hosts once, without duplicates.");
|
|
9557
9628
|
let connectorIndex = 0;
|
|
9558
9629
|
return parsed.map((item) => item.kind == "connector" ? connectors[connectorIndex++] : item);
|
|
9559
9630
|
}
|
|
@@ -9684,10 +9755,10 @@ function isTriggerNode(node) {
|
|
|
9684
9755
|
function upgradeDecodedRevisionContent(content) {
|
|
9685
9756
|
const graph = content.document.graph;
|
|
9686
9757
|
const hasManual = Object.values(graph.nodes).some((node) => node.kind == "manual");
|
|
9687
|
-
if (!hasManual && content.modelVersion ==
|
|
9758
|
+
if (!hasManual && content.modelVersion == 12) return content;
|
|
9688
9759
|
return {
|
|
9689
9760
|
...content,
|
|
9690
|
-
modelVersion:
|
|
9761
|
+
modelVersion: 12,
|
|
9691
9762
|
document: {
|
|
9692
9763
|
...content.document,
|
|
9693
9764
|
graph: hasManual ? {
|
|
@@ -9722,7 +9793,7 @@ function invalid(message) {
|
|
|
9722
9793
|
throw new FlowChangeError(message);
|
|
9723
9794
|
}
|
|
9724
9795
|
function applyFlowChanges(content, operations) {
|
|
9725
|
-
const source = content.modelVersion !=
|
|
9796
|
+
const source = content.modelVersion != 12 || Object.values(content.document.graph.nodes).some((node) => node.kind == "manual") ? decodeRevisionContent(content) : content;
|
|
9726
9797
|
const document = { ...source.document };
|
|
9727
9798
|
const modules = { ...source.modules };
|
|
9728
9799
|
for (const operation of operations) switch (operation.kind) {
|
|
@@ -10167,10 +10238,10 @@ function applyFlowChanges(content, operations) {
|
|
|
10167
10238
|
break;
|
|
10168
10239
|
}
|
|
10169
10240
|
}
|
|
10170
|
-
|
|
10241
|
+
assertDocumentHttpAuthBindings(document);
|
|
10171
10242
|
return upgradeDecodedRevisionContent({
|
|
10172
10243
|
document,
|
|
10173
|
-
modelVersion:
|
|
10244
|
+
modelVersion: 12,
|
|
10174
10245
|
modules
|
|
10175
10246
|
});
|
|
10176
10247
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChangeOperation, FlowDocument, JsonValue, RevisionContent } from './flow-change.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
export declare const currentFlowModelVersion =
|
|
3
|
+
export declare const currentFlowModelVersion = 12;
|
|
4
4
|
export declare const connectorCapabilitySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
5
5
|
kind: z.ZodLiteral<"connector">;
|
|
6
6
|
action: z.ZodString;
|
|
@@ -46,6 +46,10 @@ export declare const workflowCapabilitySchema: z.ZodObject<{
|
|
|
46
46
|
handle: z.ZodString;
|
|
47
47
|
}, z.core.$strip>>>;
|
|
48
48
|
}, z.core.$strict>;
|
|
49
|
+
export declare const httpCapabilitySchema: z.ZodObject<{
|
|
50
|
+
kind: z.ZodLiteral<"http">;
|
|
51
|
+
hosts: z.ZodArray<z.ZodString>;
|
|
52
|
+
}, z.core.$strict>;
|
|
49
53
|
export declare const agentToolFields: {
|
|
50
54
|
id: z.ZodString;
|
|
51
55
|
name: z.ZodString;
|
|
@@ -345,6 +349,9 @@ export declare const authoringDefinitionSchemas: {
|
|
|
345
349
|
nullable: z.ZodBoolean;
|
|
346
350
|
handle: z.ZodString;
|
|
347
351
|
}, z.core.$strip>>>;
|
|
352
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
353
|
+
kind: z.ZodLiteral<"http">;
|
|
354
|
+
hosts: z.ZodArray<z.ZodString>;
|
|
348
355
|
}, z.core.$strict>]>>;
|
|
349
356
|
connector: z.ZodObject<{
|
|
350
357
|
action: z.ZodString;
|
|
@@ -474,3 +481,4 @@ export declare function parseOperation<Value>(candidate: unknown, index: number,
|
|
|
474
481
|
export declare function decodeChangeOperation(candidate: unknown, index: number): ChangeOperation;
|
|
475
482
|
export declare function decodeChangeOperations(value: unknown): readonly ChangeOperation[];
|
|
476
483
|
export declare function changeOperationsSchema(kind?: string): JsonValue;
|
|
484
|
+
export declare function assertDocumentHttpAuthBindings(content: FlowDocument): void;
|