@oomol-lab/open-flow 0.1.0-beta.75 → 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 +2 -1
- package/dist/browser/{ContentIcon-FCpKiwjp.js → ContentIcon-Cm1hbVzW.js} +2 -2
- package/dist/browser/{FlowCanvas-dzRBnlUT.js → FlowCanvas-NzKtla_c.js} +62 -62
- package/dist/browser/{createResourceDialog-BeYDdUl-.js → createResourceDialog-BgdedQqu.js} +3 -3
- package/dist/browser/{dialog-ZtpsFbl4.js → dialog-aSElFFw2.js} +49 -24
- package/dist/browser/{exportSvg-DqXw1yf-.js → exportSvg-Dcz4HTo_.js} +2 -2
- package/dist/browser/{flowChanges-b_5UobFj.js → flowChanges-NZyS7HSp.js} +207 -396
- package/dist/browser/{flowWorkspace-ItojZbO4.js → flowWorkspace-Bl0SDehy.js} +90 -13
- package/dist/browser/preview.css +515 -649
- package/dist/browser/preview.js +454 -545
- 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 +515 -649
- package/dist/browser/workbench.js +7 -7
- package/dist/browser/{workbenchSelect-M441Lz0d.js → workbenchSelect-DBGP7Y4Z.js} +2 -2
- package/dist/command/index.js +33 -35
- package/dist/common/authoring.d.ts +3 -3
- package/dist/common/authoringSchema.d.ts +3 -0
- package/dist/common/connector-proxy.d.ts +1 -1
- package/dist/common/control-api-conformance.js +197 -136
- package/dist/common/control-api.d.ts +3 -2
- package/dist/common/control-api.js +192 -131
- package/dist/common/control-requests.js +126 -24
- 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 +5 -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 +40 -18
- 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 +46 -22
- package/dist/common/flow-encoding.js +40 -20
- 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 +2 -4
- package/dist/common/flow-semantics.js +83 -86
- 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 +13 -5
- package/dist/common/http-request.js +23 -5
- package/dist/common/integration-trigger.d.ts +2 -1
- package/dist/common/mcp.js +195 -134
- 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/runtime-contract.d.ts +23 -1
- package/dist/common/runtime-contract.js +604 -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 +1 -1
- package/dist/common/scheduler.js +25 -4
- 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 -1
- package/dist/common/webhook-trigger.d.ts +3 -1
- 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 +5 -1
- package/src/base/common/json.ts +1 -1
- package/src/connector/common/proxy.ts +1 -1
- package/src/control/common/api.ts +6 -5
- package/src/control/common/authoringSchema.ts +9 -2
- 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/node-execution.ts +1 -1
- package/src/execution/common/scheduler.ts +1 -1
- package/src/flow/common/change.ts +58 -192
- package/src/flow/common/changeSchema.ts +29 -4
- package/src/flow/common/connectionUsage.ts +1 -1
- 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 +2 -4
- package/src/flow/common/semantics.ts +11 -4
- package/src/flow/common/webhookResponse.ts +1 -1
- package/src/flow/common/workflowReferences.ts +31 -0
- package/src/http/common/authBindings.ts +6 -9
- package/src/http/common/hosts.ts +13 -0
- package/src/http/common/httpRequest.ts +30 -15
- package/src/openapi/common/openapi.ts +9 -5
- package/src/{execution → runtime}/common/engineContract.ts +20 -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 +3 -1
- 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/{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';
|
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,6 +9475,14 @@ 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
|
|
9475
9486
|
//#region src/http/common/headers.ts
|
|
9476
9487
|
/** Header names are case-insensitive; never silently combine duplicate business fields. */
|
|
9477
9488
|
function httpHeaderNameIssue(name, names) {
|
|
@@ -9760,7 +9771,14 @@ var workflowCapabilitySchema = strictObject({
|
|
|
9760
9771
|
inputs: array(port),
|
|
9761
9772
|
outputs: array(port).nullable()
|
|
9762
9773
|
});
|
|
9763
|
-
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
|
+
]);
|
|
9764
9782
|
var inline = object({
|
|
9765
9783
|
...ports,
|
|
9766
9784
|
name: text,
|
|
@@ -10124,7 +10142,8 @@ object({
|
|
|
10124
10142
|
literal(8),
|
|
10125
10143
|
literal(9),
|
|
10126
10144
|
literal(10),
|
|
10127
|
-
literal(11)
|
|
10145
|
+
literal(11),
|
|
10146
|
+
literal(12)
|
|
10128
10147
|
]),
|
|
10129
10148
|
document,
|
|
10130
10149
|
modules: record$1(text, module)
|
|
@@ -10541,10 +10560,12 @@ function nodeSystemOutputPorts(node) {
|
|
|
10541
10560
|
} } : {};
|
|
10542
10561
|
}
|
|
10543
10562
|
//#endregion
|
|
10544
|
-
//#region src/flow/common/
|
|
10563
|
+
//#region src/flow/common/model.ts
|
|
10545
10564
|
function portsByHandle(ports) {
|
|
10546
10565
|
return Object.fromEntries(ports.flatMap((port) => "handle" in port ? [[port.handle, port]] : []));
|
|
10547
10566
|
}
|
|
10567
|
+
//#endregion
|
|
10568
|
+
//#region src/flow/common/change.ts
|
|
10548
10569
|
function isTriggerNode(node) {
|
|
10549
10570
|
return [
|
|
10550
10571
|
"manual",
|
|
@@ -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,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';
|
|
@@ -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",
|
package/dist/index.d.ts
CHANGED
|
@@ -20,18 +20,50 @@ export interface ArtifactRef {
|
|
|
20
20
|
readonly kind: 'artifact';
|
|
21
21
|
readonly id: string;
|
|
22
22
|
readonly name: string;
|
|
23
|
-
readonly mediaType
|
|
23
|
+
readonly mediaType?: string;
|
|
24
24
|
readonly size: number;
|
|
25
25
|
readonly digest: string;
|
|
26
26
|
}
|
|
27
27
|
export interface ArtifactPutOptions {
|
|
28
28
|
readonly name: string;
|
|
29
|
-
readonly mediaType?: string
|
|
29
|
+
readonly mediaType?: string;
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
/** Strings are stored as UTF-8. */
|
|
32
|
+
export type ArtifactData = string | Uint8Array;
|
|
33
|
+
/** Artifacts belong to the current Run; an ArtifactRef is JSON and can be passed to downstream nodes. */
|
|
32
34
|
export interface ArtifactCapability {
|
|
33
35
|
put(data: ArtifactData, options: ArtifactPutOptions): Promise<ArtifactRef>;
|
|
34
|
-
open(ref: ArtifactRef): Promise<
|
|
36
|
+
open(ref: ArtifactRef): Promise<Uint8Array>;
|
|
37
|
+
}
|
|
38
|
+
export interface TaskFetchInit {
|
|
39
|
+
/** GET, HEAD, POST, PUT, PATCH, DELETE or OPTIONS. */
|
|
40
|
+
readonly method?: string;
|
|
41
|
+
readonly headers?: Readonly<Record<string, string>> | Iterable<readonly [string, string]>;
|
|
42
|
+
/** At most 1 MiB; strings are sent as UTF-8 text/plain unless a content-type header is supplied. */
|
|
43
|
+
readonly body?: string | Uint8Array | ArrayBuffer;
|
|
44
|
+
readonly signal?: AbortSignal;
|
|
45
|
+
}
|
|
46
|
+
export interface TaskFetchHeaders extends Iterable<[string, string]> {
|
|
47
|
+
get(name: string): string | null;
|
|
48
|
+
has(name: string): boolean;
|
|
49
|
+
entries(): IterableIterator<[string, string]>;
|
|
50
|
+
keys(): IterableIterator<string>;
|
|
51
|
+
values(): IterableIterator<string>;
|
|
52
|
+
forEach(callback: (value: string, name: string) => void): void;
|
|
53
|
+
}
|
|
54
|
+
/** A read-only subset of the Fetch Response; the body is buffered, at most 1 MiB, and readable once. */
|
|
55
|
+
export interface TaskFetchResponse {
|
|
56
|
+
readonly status: number;
|
|
57
|
+
readonly statusText: string;
|
|
58
|
+
readonly ok: boolean;
|
|
59
|
+
readonly redirected: false;
|
|
60
|
+
readonly url: string;
|
|
61
|
+
readonly headers: TaskFetchHeaders;
|
|
62
|
+
readonly bodyUsed: boolean;
|
|
63
|
+
bytes(): Promise<Uint8Array>;
|
|
64
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
65
|
+
text(): Promise<string>;
|
|
66
|
+
json(): Promise<unknown>;
|
|
35
67
|
}
|
|
36
68
|
export interface MediaPreviewPayload {
|
|
37
69
|
readonly type: 'video' | 'audio' | 'markdown' | 'iframe' | 'html';
|
|
@@ -60,12 +92,6 @@ export interface CsvPreviewPayload {
|
|
|
60
92
|
}
|
|
61
93
|
export type PreviewPayload = MediaPreviewPayload | TextPreviewPayload | ImagePreviewPayload | TablePreviewPayload | CsvPreviewPayload;
|
|
62
94
|
export type PreviewType = PreviewPayload['type'];
|
|
63
|
-
export interface TaskLogger {
|
|
64
|
-
debug(message: string, data?: unknown): void;
|
|
65
|
-
info(message: string, data?: unknown): void;
|
|
66
|
-
warn(message: string, data?: unknown): void;
|
|
67
|
-
error(message: string, data?: unknown): void;
|
|
68
|
-
}
|
|
69
95
|
export interface TaskContext<Actions extends object = Record<string, never>, Workflows extends object = {
|
|
70
96
|
call: (name: never, input?: never) => Promise<never>;
|
|
71
97
|
}> {
|
|
@@ -77,12 +103,13 @@ export interface TaskContext<Actions extends object = Record<string, never>, Wor
|
|
|
77
103
|
readonly runId: string;
|
|
78
104
|
readonly blockId: string;
|
|
79
105
|
readonly artifact: ArtifactCapability;
|
|
80
|
-
readonly fetch: typeof fetch;
|
|
81
|
-
readonly logger: TaskLogger;
|
|
82
106
|
/** Reads the selected direct predecessors, sorted by node ID; empty for a graph root. */
|
|
83
107
|
getPrevious(): Promise<readonly PreviousNode[]>;
|
|
84
|
-
|
|
85
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Calls an HTTP(S) URL whose host the node declares in its `http` Capability. Redirects are returned, not followed,
|
|
110
|
+
* and no platform credentials are added. Network failures reject with a TypeError.
|
|
111
|
+
*/
|
|
112
|
+
fetch(input: string | URL, init?: TaskFetchInit): Promise<TaskFetchResponse>;
|
|
86
113
|
}
|
|
87
114
|
export type TaskResult<Outputs extends object> = keyof Outputs extends never ? Outputs | void : Outputs;
|
|
88
115
|
export interface Task<Inputs extends object = Record<string, unknown>, Outputs extends object = Record<string, unknown>, Actions extends object = Record<string, never>, Workflows extends object = TaskContext['workflows']> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oomol-lab/open-flow",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.76",
|
|
4
4
|
"description": "TypeScript contracts and Browser runtime for Open Flow.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -113,6 +113,10 @@
|
|
|
113
113
|
"types": "./dist/common/runtime-contract.d.ts",
|
|
114
114
|
"import": "./dist/common/runtime-contract.js"
|
|
115
115
|
},
|
|
116
|
+
"./runtime-nodejs-compat": {
|
|
117
|
+
"types": "./dist/common/runtime-nodejs-compat.d.ts",
|
|
118
|
+
"import": "./dist/common/runtime-nodejs-compat.js"
|
|
119
|
+
},
|
|
116
120
|
"./scheduler": {
|
|
117
121
|
"types": "./dist/common/scheduler.d.ts",
|
|
118
122
|
"import": "./dist/common/scheduler.js"
|
package/src/base/common/json.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SourceOperation, SourceReferenceOperation } from '../../event-source/common/definition.ts'
|
|
2
|
-
import type { JsonValue } from '../../
|
|
2
|
+
import type { JsonValue } from '../../types/index.ts'
|
|
3
3
|
export type TriggerOperationRequest =
|
|
4
4
|
| { readonly operation: 'sourceReference'; readonly request: SourceReferenceOperation }
|
|
5
5
|
| { readonly operation: 'source'; readonly request: SourceOperation }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CanvasCommand } from '../../canvas/common/commands.ts'
|
|
2
2
|
|
|
3
|
-
import { currentEngineContract } from '../../
|
|
3
|
+
import { currentEngineContract } from '../../runtime/common/engineContract.ts'
|
|
4
4
|
import { workflowContractSchema, workflowReferencesSchema } from '../../workflow/common/workflow.ts'
|
|
5
5
|
export type { CanvasCommand, CanvasCommandSubscriber } from '../../canvas/common/commands.ts'
|
|
6
6
|
import type { LiveDetails } from './liveDetails.ts'
|
|
@@ -9,12 +9,12 @@ import { decodeLiveDetails } from './liveDetails.ts'
|
|
|
9
9
|
export { liveEntries } from './liveDetails.ts'
|
|
10
10
|
export { flowInputDefinitions } from './authoringFields.ts'
|
|
11
11
|
export type { LiveDetails, LiveEntry } from './liveDetails.ts'
|
|
12
|
+
import type { ProviderIconAppearance } from '../../connector/common/providerIconSprite.ts'
|
|
12
13
|
import type { AuthoringRead, AuthoringSearch, AuthoringRequest, AuthoringType } from './authoringSchema.ts'
|
|
13
|
-
import type { ProviderIconAppearance } from './providerIconSprite.ts'
|
|
14
14
|
|
|
15
15
|
import { authoringReadResponse, authoringSearchResponse, authoringEditResponse, authoringCheckResponse } from './authoringSchema.ts'
|
|
16
|
-
export { providerIconAppearance } from '
|
|
17
|
-
export type { ProviderIconAppearance, ProviderIconSprite, ProviderIconSpriteCatalog } from '
|
|
16
|
+
export { providerIconAppearance } from '../../connector/common/providerIconSprite.ts'
|
|
17
|
+
export type { ProviderIconAppearance, ProviderIconSprite, ProviderIconSpriteCatalog } from '../../connector/common/providerIconSprite.ts'
|
|
18
18
|
export { connectorAccess as decodeConnectorAccess, connectorAccessSnapshot as decodeConnectorAccessSnapshot } from './connectorDecoders.ts'
|
|
19
19
|
import type { ProviderAccessIdentity, ProviderAccessReference } from './providerAccess.ts'
|
|
20
20
|
export {
|
|
@@ -35,7 +35,8 @@ export { decodeEventSource, decodeEventSources, type CreateEventSource, type Upd
|
|
|
35
35
|
import type { TriggerCatalogCache } from './triggerCatalog.ts'
|
|
36
36
|
|
|
37
37
|
import { decodeTriggerCatalog } from './triggerCatalog.ts'
|
|
38
|
-
export { decodeTriggerCatalog, searchTriggerKeys, type TriggerCatalog, type TriggerCatalogCache
|
|
38
|
+
export { decodeTriggerCatalog, searchTriggerKeys, type TriggerCatalog, type TriggerCatalogCache } from './triggerCatalog.ts'
|
|
39
|
+
export type { TriggerDisplay } from '../../trigger/providers/localization.ts'
|
|
39
40
|
import type { TriggerConfigOption } from '../../trigger/common/configOptions.ts'
|
|
40
41
|
export type { TriggerConfigOption } from '../../trigger/common/configOptions.ts'
|
|
41
42
|
import type { ResultQuery } from './results.ts'
|
|
@@ -6,10 +6,12 @@ import {
|
|
|
6
6
|
connectorAgentToolSchema,
|
|
7
7
|
workflowAgentToolSchema,
|
|
8
8
|
connectorCapabilitySchema,
|
|
9
|
+
httpCapabilitySchema,
|
|
9
10
|
authoringDefinitionSchemas as definitions,
|
|
10
11
|
} from '../../flow/common/changeSchema.ts'
|
|
11
12
|
import { retryConfigurationSchema, retryNodeTypes } from '../../flow/common/retry.ts'
|
|
12
13
|
import { httpRequestConfigSchema } from '../../http/common/httpRequest.ts'
|
|
14
|
+
import { currentEngineContract, findEngineContract } from '../../runtime/common/engineContract.ts'
|
|
13
15
|
import { authoringLlmConfiguration } from './authoringLlm.ts'
|
|
14
16
|
import { authoringOpenApiSchema } from './authoringOpenApi.ts'
|
|
15
17
|
|
|
@@ -71,7 +73,9 @@ const agentTool = z.union([
|
|
|
71
73
|
workflowAgentToolSchema.omit({ id: true, inputs: true, outputs: true, revisionId: true }).extend({ inputs: toolSources }).strict(),
|
|
72
74
|
connectorAgentToolSchema.omit({ id: true, inputs: true }).extend({ inputs: toolSources }).strict(),
|
|
73
75
|
])
|
|
74
|
-
const authoringCapabilities = z.array(
|
|
76
|
+
const authoringCapabilities = z.array(
|
|
77
|
+
z.union([connectorCapabilitySchema, z.strictObject({ kind: z.literal('workflow'), name: id, flowId: id }), httpCapabilitySchema]),
|
|
78
|
+
)
|
|
75
79
|
const notification = z.strictObject({
|
|
76
80
|
...definitions.connector.shape,
|
|
77
81
|
messageHandle: id,
|
|
@@ -259,6 +263,9 @@ const requestContracts = {
|
|
|
259
263
|
},
|
|
260
264
|
}
|
|
261
265
|
|
|
266
|
+
const codeBuiltins = [...findEngineContract(currentEngineContract)!.builtinModules!].filter((name) => !name.startsWith('node:'))
|
|
267
|
+
const codeGuidance = `Code is an ES module whose default export receives (inputs, context) and returns the business outputs. It may import the Node builtins ${codeBuiltins.join(', ')}, with or without the node: prefix; fs is a fresh in-memory filesystem containing /tmp per execution. require, dynamic import, packages and the http/net builtins are unavailable. To call HTTP APIs, declare their hosts in config.capabilities as {kind: "http", hosts: ["api.example.com", "*.example.org"]} and use context.fetch(url, {method, headers, body}); it returns status, ok, headers.get(), text(), json() and bytes(), does not follow redirects, adds no credentials, and limits bodies to 1 MiB. Prefer an HTTP Request node for a single call without transformation and Connector Actions for services with accounts. context provides inputs, signal, getPrevious(), fetch, actions, workflows, artifact, flowId, runId and blockId. Select workflows through config.capabilities: [{kind: "workflow", flowId, name}]. Call context.workflows.call(name, input) and await its business output. The platform derives input/output types. Refresh a selected workflow tool with node.refresh and tool: its name. Calls obey node and Run time limits.`
|
|
268
|
+
|
|
262
269
|
/** Transport-independent discovery of the same requests the service validates. */
|
|
263
270
|
export function authoringRequestContract(name: string) {
|
|
264
271
|
if (!Object.hasOwn(requestContracts, name)) return undefined
|
|
@@ -308,7 +315,7 @@ export function authoringSchema(kind?: AuthoringType) {
|
|
|
308
315
|
: kind == 'agent'
|
|
309
316
|
? 'Tools accept Connector Actions or {kind: "workflow", flowId, name, description, approval, inputs}. Workflow parameter sources use model, input or value. The platform derives the interface. Refresh a workflow tool with node.refresh and tool: its name.'
|
|
310
317
|
: kind == 'code'
|
|
311
|
-
?
|
|
318
|
+
? codeGuidance
|
|
312
319
|
: 'Supply business configuration and input data. Fixed definitions are assembled by the tool. Existing constraints and defaults are preserved on partial updates.',
|
|
313
320
|
example: {
|
|
314
321
|
op: 'node.add',
|
|
@@ -17,7 +17,7 @@ export type AuthoringCapability = Exclude<TaskCapability, WorkflowCapability> |
|
|
|
17
17
|
export type WorkflowLookup = (flowId: string) => Promise<WorkflowContract | WorkflowCandidate>
|
|
18
18
|
|
|
19
19
|
interface ToolIdentity {
|
|
20
|
-
readonly kind?:
|
|
20
|
+
readonly kind?: string
|
|
21
21
|
readonly name?: string
|
|
22
22
|
readonly flowId?: string
|
|
23
23
|
}
|
|
@@ -4,8 +4,8 @@ import type { ConnectorConnection, CreateEventSource, ResultInfo, PollTriggerTes
|
|
|
4
4
|
import type { ProviderAccessIdentity } from './providerAccess.ts'
|
|
5
5
|
|
|
6
6
|
import { dequal } from 'dequal/lite'
|
|
7
|
-
import { currentEngineContract as engineContract } from '../../execution/common/engineContract.ts'
|
|
8
7
|
import { upgradeRevisionContent } from '../../flow/common/change.ts'
|
|
8
|
+
import { currentEngineContract as engineContract } from '../../runtime/common/engineContract.ts'
|
|
9
9
|
import { ControlClient, decodeRunEvent } from './api.ts'
|
|
10
10
|
import { allConnectorConnectionsQuery } from './connectorQueries.ts'
|
|
11
11
|
|
|
@@ -14,10 +14,10 @@ import type {
|
|
|
14
14
|
ProviderAccessBindingCandidate,
|
|
15
15
|
} from './api.ts'
|
|
16
16
|
|
|
17
|
+
import { providerIconAppearance } from '../../connector/common/providerIconSprite.ts'
|
|
17
18
|
import { exact, requiredFields, integer, invalidResponse, jsonValue, record, string } from './decoding.ts'
|
|
18
19
|
import { ApiError } from './errors.ts'
|
|
19
20
|
import { parseProviderAccessSource } from './providerAccess.ts'
|
|
20
|
-
import { providerIconAppearance } from './providerIconSprite.ts'
|
|
21
21
|
|
|
22
22
|
export function leinaBots(value: unknown): readonly LeinaBot[] {
|
|
23
23
|
const source = record(value)
|