@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,4 @@
|
|
|
1
|
-
import type { Group, InputPort, InputValues, JsonValue } from '../../flow/common/
|
|
1
|
+
import type { Group, InputPort, InputValues, JsonValue } from '../../flow/common/model.ts'
|
|
2
2
|
|
|
3
3
|
import { inputValue } from '../../flow/common/inputValue.ts'
|
|
4
4
|
import { matchesSchema } from '../../flow/common/schema.ts'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { JsonValue, Port, PortDefinition
|
|
1
|
+
import type { JsonValue, Port, PortDefinition } from '../../flow/common/model.ts'
|
|
2
|
+
import type { TriggerNode } from './model.ts'
|
|
2
3
|
|
|
3
4
|
import { isJsonObject } from '../../base/common/json.ts'
|
|
4
5
|
import { matchesSchema } from '../../flow/common/schema.ts'
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { resolveTriggerConfig, triggerConfigValues } from './config.ts'
|
|
2
2
|
import type { ConnectorProxy } from '../../connector/common/proxy.ts'
|
|
3
|
-
import type {
|
|
3
|
+
import type { JsonValue } from '../../flow/common/model.ts'
|
|
4
4
|
import type { TriggerConfigOption, TriggerConfigOptionsContext } from './configOptions.ts'
|
|
5
|
+
import type { IntegrationEndpointMethod, TriggerKeySnapshot } from './model.ts'
|
|
5
6
|
|
|
6
7
|
import { dequal } from 'dequal/lite'
|
|
7
8
|
import { isJsonObject, isJsonValue } from '../../base/common/json.ts'
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { Group, InputPort, InputValues, Port } from '../../flow/common/model.ts'
|
|
2
|
+
import type { WebhookMethod } from '../../flow/common/webhookMethod.ts'
|
|
3
|
+
|
|
4
|
+
/** Trigger node shapes. The graph node union and its operations belong to flow/common/change.ts. */
|
|
5
|
+
|
|
6
|
+
export type TriggerSchedule =
|
|
7
|
+
| { readonly expression: string; readonly timezone: string; readonly type: 'cron' }
|
|
8
|
+
| { readonly type: 'every'; readonly unit: 'day' | 'hour' | 'minute' | 'month' | 'week'; readonly value: number }
|
|
9
|
+
|
|
10
|
+
interface TriggerKeySnapshotBase {
|
|
11
|
+
readonly configInputs: readonly (InputPort | Group)[]
|
|
12
|
+
readonly definitionVersion: number
|
|
13
|
+
readonly description: string
|
|
14
|
+
readonly displayName: string
|
|
15
|
+
readonly key: string
|
|
16
|
+
readonly name: string
|
|
17
|
+
readonly outputs: readonly Port[]
|
|
18
|
+
readonly provider: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type IntegrationEndpointMethod = 'DELETE' | 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT'
|
|
22
|
+
|
|
23
|
+
export type IntegrationBodyFormat = 'form' | 'json' | 'multipart' | 'text'
|
|
24
|
+
|
|
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
|
+
|
|
35
|
+
export type TriggerKeySnapshot =
|
|
36
|
+
| (TriggerKeySnapshotBase & { readonly type: 'poll' })
|
|
37
|
+
| (TriggerKeySnapshotBase & { readonly endpoint: IntegrationEndpointDeclaration; readonly type: 'integration' })
|
|
38
|
+
|
|
39
|
+
export interface WebhookBodyField extends InputPort {}
|
|
40
|
+
|
|
41
|
+
export interface WebhookOptions {
|
|
42
|
+
readonly allowedOrigins?: readonly string[]
|
|
43
|
+
readonly responseBody?:
|
|
44
|
+
| { readonly kind: 'workflow-outputs'; readonly output?: string; readonly timeoutMs?: number }
|
|
45
|
+
| { readonly kind: 'webhook-response'; readonly nodeId?: string; readonly timeoutMs?: number }
|
|
46
|
+
readonly responseData?: string
|
|
47
|
+
readonly responseHeaders?: Readonly<Record<string, string>>
|
|
48
|
+
readonly responseHeadersSource?: {
|
|
49
|
+
readonly kind: 'workflow-outputs'
|
|
50
|
+
readonly output?: string
|
|
51
|
+
}
|
|
52
|
+
readonly responseHeaderOutputs?: Readonly<Record<string, string>>
|
|
53
|
+
readonly responseStatusCode?: number
|
|
54
|
+
readonly responseStatusCodeOutput?: string
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface TriggerNodeBase {
|
|
58
|
+
readonly onError?: never
|
|
59
|
+
readonly description?: string
|
|
60
|
+
readonly icon?: string
|
|
61
|
+
readonly name: string
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type TriggerNode =
|
|
65
|
+
| (TriggerNodeBase & { readonly kind: 'manual' })
|
|
66
|
+
| (TriggerNodeBase & { readonly kind: 'start'; readonly inputDefs: readonly Port[] })
|
|
67
|
+
| (TriggerNodeBase & { readonly kind: 'error'; readonly sourceFlowIds?: readonly string[] })
|
|
68
|
+
| (TriggerNodeBase & {
|
|
69
|
+
readonly bodyFields: readonly WebhookBodyField[]
|
|
70
|
+
readonly kind: 'webhook'
|
|
71
|
+
readonly method: WebhookMethod
|
|
72
|
+
readonly options?: WebhookOptions
|
|
73
|
+
})
|
|
74
|
+
| (TriggerNodeBase & { readonly cronTimes: readonly TriggerSchedule[]; readonly kind: 'cron' })
|
|
75
|
+
| (TriggerNodeBase & {
|
|
76
|
+
readonly connectionId?: string
|
|
77
|
+
readonly config: InputValues
|
|
78
|
+
readonly definition: TriggerKeySnapshot & { readonly type: 'poll' }
|
|
79
|
+
readonly kind: 'poll'
|
|
80
|
+
readonly pollTimes: readonly TriggerSchedule[]
|
|
81
|
+
})
|
|
82
|
+
| (TriggerNodeBase & {
|
|
83
|
+
readonly connectionId?: string
|
|
84
|
+
readonly config: InputValues
|
|
85
|
+
readonly definition: TriggerKeySnapshot & { readonly type: 'integration' }
|
|
86
|
+
readonly kind: 'integration'
|
|
87
|
+
})
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { resolveTriggerConfig, triggerConfigValues } from './config.ts'
|
|
2
2
|
import type { ConnectorProxy } from '../../connector/common/proxy.ts'
|
|
3
|
-
import type { JsonValue
|
|
3
|
+
import type { JsonValue } from '../../flow/common/model.ts'
|
|
4
4
|
import type { TriggerConfigOption, TriggerConfigOptionsContext } from './configOptions.ts'
|
|
5
|
+
import type { TriggerKeySnapshot, TriggerSchedule } from './model.ts'
|
|
5
6
|
|
|
6
7
|
const encoder = new TextEncoder()
|
|
7
8
|
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type { JsonValue
|
|
1
|
+
import type { JsonValue } from '../../flow/common/model.ts'
|
|
2
|
+
import type { WebhookMethod } from '../../flow/common/webhookMethod.ts'
|
|
3
|
+
import type { WebhookBodyField, WebhookOptions } from './model.ts'
|
|
2
4
|
|
|
3
5
|
import { dequal } from 'dequal/lite'
|
|
4
6
|
import { isJsonObject } from '../../base/common/json.ts'
|
|
5
|
-
import {
|
|
7
|
+
import { validWebhookStatus, webhookHeaderValues, encodeWebhookBody } from '../../flow/common/webhookResponse.ts'
|
|
8
|
+
import { httpHeaderNameIssue } from '../../http/common/headers.ts'
|
|
6
9
|
|
|
7
10
|
export { webhookSupportsBody } from './contract.ts'
|
|
8
11
|
export { webhookResponseAllowsBody, webhookResponseTimeout } from '../../flow/common/webhookResponse.ts'
|
|
@@ -34,7 +37,7 @@ export function webhookResponseHeaders(result: unknown, options: WebhookOptions)
|
|
|
34
37
|
const values = new Map<string, { name: string; value: unknown }>()
|
|
35
38
|
for (const [name, value] of Object.entries(source)) {
|
|
36
39
|
if (
|
|
37
|
-
|
|
40
|
+
httpHeaderNameIssue(
|
|
38
41
|
name,
|
|
39
42
|
[...values.values()].map((entry) => entry.name),
|
|
40
43
|
) != null
|
|
@@ -45,7 +48,7 @@ export function webhookResponseHeaders(result: unknown, options: WebhookOptions)
|
|
|
45
48
|
if (whole == null) {
|
|
46
49
|
const names: string[] = []
|
|
47
50
|
for (const [name, output] of Object.entries(options.responseHeaderOutputs ?? {})) {
|
|
48
|
-
if (
|
|
51
|
+
if (httpHeaderNameIssue(name, names) != null) return
|
|
49
52
|
names.push(name)
|
|
50
53
|
values.set(name.toLowerCase(), { name, value: workflowOutputValue(result, output) })
|
|
51
54
|
}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import type { TriggerDisplay } from '../../control/common/triggerCatalog.ts'
|
|
2
|
-
import type { TriggerKeySnapshot } from '../../flow/common/change.ts'
|
|
3
1
|
import type { UiLanguage } from '../../localization/common/languages.ts'
|
|
2
|
+
import type { TriggerKeySnapshot } from '../common/model.ts'
|
|
4
3
|
|
|
5
4
|
import { englishTriggerFieldDescriptions } from './fieldDescriptions.ts'
|
|
6
5
|
import { triggerConfigFieldLabels } from './fieldLabels.ts'
|
|
7
6
|
|
|
7
|
+
export interface TriggerDisplay {
|
|
8
|
+
readonly configInputs: Readonly<Record<string, string>>
|
|
9
|
+
readonly configInputLabels: Readonly<Record<string, string>>
|
|
10
|
+
readonly displayName: string
|
|
11
|
+
readonly description: string
|
|
12
|
+
readonly outputs: Readonly<Record<string, string>>
|
|
13
|
+
}
|
|
14
|
+
|
|
8
15
|
type Translations = Readonly<Record<string, Partial<TriggerDisplay>>>
|
|
9
16
|
|
|
10
17
|
const loaders = {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ConnectorProxy, TriggerOperationRequest } from '../../connector/common/proxy.ts'
|
|
2
|
-
import type { TriggerKeySnapshot } from '../../flow/common/change.ts'
|
|
3
2
|
import type { TriggerConfigOption } from '../common/configOptions.ts'
|
|
4
3
|
import type {
|
|
5
4
|
IntegrationDefinition,
|
|
@@ -8,6 +7,7 @@ import type {
|
|
|
8
7
|
IntegrationStateContext,
|
|
9
8
|
ListenerPage,
|
|
10
9
|
} from '../common/integration.ts'
|
|
10
|
+
import type { TriggerKeySnapshot } from '../common/model.ts'
|
|
11
11
|
import type { PollDefinition, PollResult } from '../common/poll.ts'
|
|
12
12
|
|
|
13
13
|
import { isJsonObject } from '../../base/common/json.ts'
|
package/src/types/index.ts
CHANGED
|
@@ -22,21 +22,56 @@ export interface ArtifactRef {
|
|
|
22
22
|
readonly kind: 'artifact'
|
|
23
23
|
readonly id: string
|
|
24
24
|
readonly name: string
|
|
25
|
-
readonly mediaType
|
|
25
|
+
readonly mediaType?: string
|
|
26
26
|
readonly size: number
|
|
27
27
|
readonly digest: string
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export interface ArtifactPutOptions {
|
|
31
31
|
readonly name: string
|
|
32
|
-
readonly mediaType?: string
|
|
32
|
+
readonly mediaType?: string
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
/** Strings are stored as UTF-8. */
|
|
36
|
+
export type ArtifactData = string | Uint8Array
|
|
36
37
|
|
|
38
|
+
/** Artifacts belong to the current Run; an ArtifactRef is JSON and can be passed to downstream nodes. */
|
|
37
39
|
export interface ArtifactCapability {
|
|
38
40
|
put(data: ArtifactData, options: ArtifactPutOptions): Promise<ArtifactRef>
|
|
39
|
-
open(ref: ArtifactRef): Promise<
|
|
41
|
+
open(ref: ArtifactRef): Promise<Uint8Array>
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface TaskFetchInit {
|
|
45
|
+
/** GET, HEAD, POST, PUT, PATCH, DELETE or OPTIONS. */
|
|
46
|
+
readonly method?: string
|
|
47
|
+
readonly headers?: Readonly<Record<string, string>> | Iterable<readonly [string, string]>
|
|
48
|
+
/** At most 1 MiB; strings are sent as UTF-8 text/plain unless a content-type header is supplied. */
|
|
49
|
+
readonly body?: string | Uint8Array | ArrayBuffer
|
|
50
|
+
readonly signal?: AbortSignal
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface TaskFetchHeaders extends Iterable<[string, string]> {
|
|
54
|
+
get(name: string): string | null
|
|
55
|
+
has(name: string): boolean
|
|
56
|
+
entries(): IterableIterator<[string, string]>
|
|
57
|
+
keys(): IterableIterator<string>
|
|
58
|
+
values(): IterableIterator<string>
|
|
59
|
+
forEach(callback: (value: string, name: string) => void): void
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** A read-only subset of the Fetch Response; the body is buffered, at most 1 MiB, and readable once. */
|
|
63
|
+
export interface TaskFetchResponse {
|
|
64
|
+
readonly status: number
|
|
65
|
+
readonly statusText: string
|
|
66
|
+
readonly ok: boolean
|
|
67
|
+
readonly redirected: false
|
|
68
|
+
readonly url: string
|
|
69
|
+
readonly headers: TaskFetchHeaders
|
|
70
|
+
readonly bodyUsed: boolean
|
|
71
|
+
bytes(): Promise<Uint8Array>
|
|
72
|
+
arrayBuffer(): Promise<ArrayBuffer>
|
|
73
|
+
text(): Promise<string>
|
|
74
|
+
json(): Promise<unknown>
|
|
40
75
|
}
|
|
41
76
|
|
|
42
77
|
export interface MediaPreviewPayload {
|
|
@@ -73,13 +108,6 @@ export interface CsvPreviewPayload {
|
|
|
73
108
|
export type PreviewPayload = MediaPreviewPayload | TextPreviewPayload | ImagePreviewPayload | TablePreviewPayload | CsvPreviewPayload
|
|
74
109
|
export type PreviewType = PreviewPayload['type']
|
|
75
110
|
|
|
76
|
-
export interface TaskLogger {
|
|
77
|
-
debug(message: string, data?: unknown): void
|
|
78
|
-
info(message: string, data?: unknown): void
|
|
79
|
-
warn(message: string, data?: unknown): void
|
|
80
|
-
error(message: string, data?: unknown): void
|
|
81
|
-
}
|
|
82
|
-
|
|
83
111
|
export interface TaskContext<
|
|
84
112
|
Actions extends object = Record<string, never>,
|
|
85
113
|
Workflows extends object = { call: (name: never, input?: never) => Promise<never> },
|
|
@@ -92,12 +120,13 @@ export interface TaskContext<
|
|
|
92
120
|
readonly runId: string
|
|
93
121
|
readonly blockId: string
|
|
94
122
|
readonly artifact: ArtifactCapability
|
|
95
|
-
readonly fetch: typeof fetch
|
|
96
|
-
readonly logger: TaskLogger
|
|
97
123
|
/** Reads the selected direct predecessors, sorted by node ID; empty for a graph root. */
|
|
98
124
|
getPrevious(): Promise<readonly PreviousNode[]>
|
|
99
|
-
|
|
100
|
-
|
|
125
|
+
/**
|
|
126
|
+
* Calls an HTTP(S) URL whose host the node declares in its `http` Capability. Redirects are returned, not followed,
|
|
127
|
+
* and no platform credentials are added. Network failures reject with a TypeError.
|
|
128
|
+
*/
|
|
129
|
+
fetch(input: string | URL, init?: TaskFetchInit): Promise<TaskFetchResponse>
|
|
101
130
|
}
|
|
102
131
|
|
|
103
132
|
export type TaskResult<Outputs extends object> = keyof Outputs extends never ? Outputs | void : Outputs
|
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
TaskNode,
|
|
3
|
-
ManagedTaskDefinition,
|
|
4
|
-
Port,
|
|
5
|
-
JsonValue,
|
|
6
|
-
RevisionContent,
|
|
7
|
-
GraphNode,
|
|
8
|
-
WorkflowCapability,
|
|
9
|
-
AgentWorkflowTool,
|
|
10
|
-
} from '../../flow/common/change.ts'
|
|
1
|
+
import type { TaskNode, ManagedTaskDefinition, Port, JsonValue, RevisionContent, WorkflowCapability, AgentWorkflowTool } from '../../flow/common/change.ts'
|
|
11
2
|
|
|
12
3
|
import { dequal } from 'dequal/lite'
|
|
13
4
|
import { z } from 'zod'
|
|
14
5
|
import { comparePorts, matchesSchema } from '../../flow/common/schema.ts'
|
|
15
6
|
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
readonly flowId: string
|
|
19
|
-
readonly revisionId: string
|
|
20
|
-
}
|
|
7
|
+
export type { WorkflowExecutor } from '../../flow/common/model.ts'
|
|
8
|
+
export { nodeWorkflowReferences } from '../../flow/common/workflowReferences.ts'
|
|
21
9
|
|
|
22
10
|
const portSchema = z.object({
|
|
23
11
|
handle: z.string().min(1),
|
|
@@ -183,35 +171,6 @@ export const workflowReferencesSchema = z.object({
|
|
|
183
171
|
})
|
|
184
172
|
export type WorkflowReferences = z.infer<typeof workflowReferencesSchema>
|
|
185
173
|
|
|
186
|
-
/** Workflow declarations share discovery across authoring, admission and resource indexing. */
|
|
187
|
-
export function nodeWorkflowReferences(node: GraphNode): readonly {
|
|
188
|
-
readonly target: Omit<WorkflowCapability, 'kind' | 'name'>
|
|
189
|
-
readonly path: string
|
|
190
|
-
readonly tool?: string
|
|
191
|
-
}[] {
|
|
192
|
-
if (node.kind != 'task') return []
|
|
193
|
-
if ('moduleId' in node.task)
|
|
194
|
-
return (node.task.capabilities ?? []).flatMap((item, index) =>
|
|
195
|
-
item.kind == 'workflow' ? [{ target: item, path: `task/capabilities/${index}`, tool: item.name }] : [],
|
|
196
|
-
)
|
|
197
|
-
if (node.task.executor.kind == 'workflow')
|
|
198
|
-
return [
|
|
199
|
-
{
|
|
200
|
-
target: {
|
|
201
|
-
...node.task.executor,
|
|
202
|
-
inputs: node.task.inputs.filter((port) => 'handle' in port),
|
|
203
|
-
outputs: node.task.outputs.filter((port) => 'handle' in port),
|
|
204
|
-
},
|
|
205
|
-
path: 'task/executor',
|
|
206
|
-
},
|
|
207
|
-
]
|
|
208
|
-
if (node.task.executor.kind == 'agent')
|
|
209
|
-
return node.task.executor.tools.flatMap((item, index) =>
|
|
210
|
-
item.kind == 'workflow' ? [{ target: item, path: `task/executor/tools/${index}`, tool: item.name }] : [],
|
|
211
|
-
)
|
|
212
|
-
return []
|
|
213
|
-
}
|
|
214
|
-
|
|
215
174
|
export function workflowCapability(name: string, target: WorkflowContract | WorkflowCandidate): WorkflowCapability {
|
|
216
175
|
return {
|
|
217
176
|
kind: 'workflow',
|