@xyne/workflow-sdk 3.2.54 → 3.2.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/agent-step.d.ts +30 -15
- package/dist/agents/agent-step.d.ts.map +1 -1
- package/dist/agents/agent-step.js +15 -5
- package/dist/agents/agent-step.js.map +1 -1
- package/dist/agents/citation-resolve.js +1 -1
- package/dist/agents/citation-resolve.js.map +1 -1
- package/dist/agents/contract.d.ts +16 -8
- package/dist/agents/contract.d.ts.map +1 -1
- package/dist/agents/host-agent-step.d.ts +20 -10
- package/dist/agents/host-agent-step.d.ts.map +1 -1
- package/dist/agents/host-agent-step.js +7 -3
- package/dist/agents/host-agent-step.js.map +1 -1
- package/dist/agents/provider.d.ts +2 -2
- package/dist/agents/tool-types.d.ts +13 -2
- package/dist/agents/tool-types.d.ts.map +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/client/workflow-client.js.map +1 -1
- package/dist/common/attachment.d.ts +24 -7
- package/dist/common/attachment.d.ts.map +1 -1
- package/dist/common/attachment.js +34 -7
- package/dist/common/attachment.js.map +1 -1
- package/dist/common/multipart-values.d.ts +21 -0
- package/dist/common/multipart-values.d.ts.map +1 -0
- package/dist/common/multipart-values.js +63 -0
- package/dist/common/multipart-values.js.map +1 -0
- package/dist/completion/address.d.ts +27 -0
- package/dist/completion/address.d.ts.map +1 -0
- package/dist/completion/address.js +62 -0
- package/dist/completion/address.js.map +1 -0
- package/dist/completion/attach.d.ts +20 -0
- package/dist/completion/attach.d.ts.map +1 -0
- package/dist/completion/attach.js +37 -0
- package/dist/completion/attach.js.map +1 -0
- package/dist/completion/index.d.ts +6 -0
- package/dist/completion/index.d.ts.map +1 -0
- package/dist/completion/index.js +4 -0
- package/dist/completion/index.js.map +1 -0
- package/dist/completion/types.d.ts +109 -0
- package/dist/completion/types.d.ts.map +1 -0
- package/dist/completion/types.js +35 -0
- package/dist/completion/types.js.map +1 -0
- package/dist/connectors/builtin/builtin-connector.d.ts.map +1 -1
- package/dist/connectors/builtin/builtin-connector.js +6 -2
- package/dist/connectors/builtin/builtin-connector.js.map +1 -1
- package/dist/connectors/builtin/steps/code.step.d.ts +20 -10
- package/dist/connectors/builtin/steps/code.step.d.ts.map +1 -1
- package/dist/connectors/builtin/steps/code.step.js +14 -7
- package/dist/connectors/builtin/steps/code.step.js.map +1 -1
- package/dist/connectors/builtin/steps/cycle.step.d.ts +36 -7
- package/dist/connectors/builtin/steps/cycle.step.d.ts.map +1 -1
- package/dist/connectors/builtin/steps/cycle.step.js +84 -6
- package/dist/connectors/builtin/steps/cycle.step.js.map +1 -1
- package/dist/connectors/builtin/steps/delay.step.d.ts +49 -0
- package/dist/connectors/builtin/steps/delay.step.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/delay.step.js +40 -0
- package/dist/connectors/builtin/steps/delay.step.js.map +1 -0
- package/dist/connectors/builtin/steps/http-request.step.d.ts +100 -50
- package/dist/connectors/builtin/steps/http-request.step.d.ts.map +1 -1
- package/dist/connectors/builtin/steps/http-request.step.js +14 -15
- package/dist/connectors/builtin/steps/http-request.step.js.map +1 -1
- package/dist/connectors/builtin/steps/map.step.d.ts.map +1 -1
- package/dist/connectors/builtin/steps/map.step.js +9 -2
- package/dist/connectors/builtin/steps/map.step.js.map +1 -1
- package/dist/connectors/builtin/steps/multipart-body.d.ts +23 -0
- package/dist/connectors/builtin/steps/multipart-body.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/multipart-body.js +40 -0
- package/dist/connectors/builtin/steps/multipart-body.js.map +1 -0
- package/dist/connectors/builtin/steps/parallel.step.d.ts.map +1 -1
- package/dist/connectors/builtin/steps/parallel.step.js +9 -2
- package/dist/connectors/builtin/steps/parallel.step.js.map +1 -1
- package/dist/connectors/builtin/steps/wait-for-api-call.step.d.ts +80 -0
- package/dist/connectors/builtin/steps/wait-for-api-call.step.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/wait-for-api-call.step.js +104 -0
- package/dist/connectors/builtin/steps/wait-for-api-call.step.js.map +1 -0
- package/dist/connectors/builtin/steps/wait-for-human.step.d.ts +1057 -0
- package/dist/connectors/builtin/steps/wait-for-human.step.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/wait-for-human.step.js +222 -0
- package/dist/connectors/builtin/steps/wait-for-human.step.js.map +1 -0
- package/dist/connectors/builtin/steps/wait-for-webhook.step.d.ts +80 -0
- package/dist/connectors/builtin/steps/wait-for-webhook.step.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/wait-for-webhook.step.js +104 -0
- package/dist/connectors/builtin/steps/wait-for-webhook.step.js.map +1 -0
- package/dist/connectors/builtin/steps/wait.step.d.ts +10 -35
- package/dist/connectors/builtin/steps/wait.step.d.ts.map +1 -1
- package/dist/connectors/builtin/steps/wait.step.js +11 -57
- package/dist/connectors/builtin/steps/wait.step.js.map +1 -1
- package/dist/conversational-flow/create.d.ts +2 -1
- package/dist/conversational-flow/create.d.ts.map +1 -1
- package/dist/conversational-flow/create.js +2 -2
- package/dist/conversational-flow/create.js.map +1 -1
- package/dist/conversational-flow/edit/build.js +1 -1
- package/dist/conversational-flow/edit/build.js.map +1 -1
- package/dist/conversational-flow/edit/questions.d.ts +35 -0
- package/dist/conversational-flow/edit/questions.d.ts.map +1 -0
- package/dist/conversational-flow/edit/questions.js +188 -0
- package/dist/conversational-flow/edit/questions.js.map +1 -0
- package/dist/conversational-flow/questions.d.ts +32 -0
- package/dist/conversational-flow/questions.d.ts.map +1 -0
- package/dist/conversational-flow/questions.js +122 -0
- package/dist/conversational-flow/questions.js.map +1 -0
- package/dist/engine/config-validator.d.ts.map +1 -1
- package/dist/engine/config-validator.js +29 -0
- package/dist/engine/config-validator.js.map +1 -1
- package/dist/engine/pause-step.d.ts +21 -4
- package/dist/engine/pause-step.d.ts.map +1 -1
- package/dist/engine/pause-step.js +11 -2
- package/dist/engine/pause-step.js.map +1 -1
- package/dist/engine/read-config.d.ts +12 -0
- package/dist/engine/read-config.d.ts.map +1 -0
- package/dist/engine/read-config.js +50 -0
- package/dist/engine/read-config.js.map +1 -0
- package/dist/engine/workflow-executor.d.ts.map +1 -1
- package/dist/engine/workflow-executor.js +38 -56
- package/dist/engine/workflow-executor.js.map +1 -1
- package/dist/index.d.ts +14 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/persistence/in-memory-adapter.d.ts +3 -18
- package/dist/persistence/in-memory-adapter.d.ts.map +1 -1
- package/dist/persistence/in-memory-adapter.js +9 -61
- package/dist/persistence/in-memory-adapter.js.map +1 -1
- package/dist/persistence/types.d.ts +29 -58
- package/dist/persistence/types.d.ts.map +1 -1
- package/dist/router/approval-context.d.ts +1 -1
- package/dist/router/approval-context.d.ts.map +1 -1
- package/dist/router/approval-context.js +3 -3
- package/dist/router/approval-context.js.map +1 -1
- package/dist/router/types.d.ts +18 -7
- package/dist/router/types.d.ts.map +1 -1
- package/dist/router/workflow-router.d.ts.map +1 -1
- package/dist/router/workflow-router.js +164 -123
- package/dist/router/workflow-router.js.map +1 -1
- package/dist/runtime/workflow-runtime.d.ts +40 -45
- package/dist/runtime/workflow-runtime.d.ts.map +1 -1
- package/dist/runtime/workflow-runtime.js +188 -123
- package/dist/runtime/workflow-runtime.js.map +1 -1
- package/dist/steps/base-step.d.ts +11 -10
- package/dist/steps/base-step.d.ts.map +1 -1
- package/dist/steps/base-step.js.map +1 -1
- package/dist/storage/files.d.ts +39 -0
- package/dist/storage/files.d.ts.map +1 -0
- package/dist/storage/files.js +75 -0
- package/dist/storage/files.js.map +1 -0
- package/dist/storage/in-memory-adapter.d.ts +15 -8
- package/dist/storage/in-memory-adapter.d.ts.map +1 -1
- package/dist/storage/in-memory-adapter.js +36 -18
- package/dist/storage/in-memory-adapter.js.map +1 -1
- package/dist/storage/types.d.ts +36 -26
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/storage/types.js +5 -6
- package/dist/storage/types.js.map +1 -1
- package/dist/testing/mock-step-context.d.ts +7 -2
- package/dist/testing/mock-step-context.d.ts.map +1 -1
- package/dist/testing/mock-step-context.js +2 -1
- package/dist/testing/mock-step-context.js.map +1 -1
- package/dist/testing/test-connector.d.ts +1 -1
- package/dist/testing/test-connector.js +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/known-types.d.ts +51 -1
- package/dist/types/known-types.d.ts.map +1 -1
- package/dist/types/known-types.js +54 -1
- package/dist/types/known-types.js.map +1 -1
- package/dist/types/pause-state.d.ts +0 -8
- package/dist/types/pause-state.d.ts.map +1 -1
- package/dist/types/pause-state.js.map +1 -1
- package/dist/types/workflow-variable.d.ts +20 -10
- package/dist/types/workflow-variable.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Folding a multipart delivery's files into its payload.
|
|
3
|
+
*
|
|
4
|
+
* Pure, because the files are already stored by the time anything here runs:
|
|
5
|
+
* the whole merge — field grouping, the single-versus-list decision, a field
|
|
6
|
+
* the contract never declared — is a table test, the same way
|
|
7
|
+
* {@link resolveGate} is.
|
|
8
|
+
*/
|
|
9
|
+
import type { DeliveryFile } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* The payload a gate's contract will be checked against: the request's text
|
|
12
|
+
* fields plus every stored file under its own field name.
|
|
13
|
+
*
|
|
14
|
+
* `contract` only settles arity — a field it declares as a list of attachments
|
|
15
|
+
* gets a list even when one file arrived. A file under a field the contract
|
|
16
|
+
* never mentions is merged anyway and left for the contract check to reject,
|
|
17
|
+
* which says `invalid` with the field named instead of silently dropping it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function attachDeliveryFiles(payload: unknown, files: readonly DeliveryFile[], contract: Record<string, unknown> | undefined): unknown;
|
|
20
|
+
//# sourceMappingURL=attach.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attach.d.ts","sourceRoot":"","sources":["../../src/completion/attach.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,SAAS,YAAY,EAAE,EAC9B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC5C,OAAO,CAuBT"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Folding a multipart delivery's files into its payload.
|
|
3
|
+
*
|
|
4
|
+
* Pure, because the files are already stored by the time anything here runs:
|
|
5
|
+
* the whole merge — field grouping, the single-versus-list decision, a field
|
|
6
|
+
* the contract never declared — is a table test, the same way
|
|
7
|
+
* {@link resolveGate} is.
|
|
8
|
+
*/
|
|
9
|
+
import { isAttachmentArrayProperty } from '../common/attachment.js';
|
|
10
|
+
import { addMultipartValue } from '../common/multipart-values.js';
|
|
11
|
+
/**
|
|
12
|
+
* The payload a gate's contract will be checked against: the request's text
|
|
13
|
+
* fields plus every stored file under its own field name.
|
|
14
|
+
*
|
|
15
|
+
* `contract` only settles arity — a field it declares as a list of attachments
|
|
16
|
+
* gets a list even when one file arrived. A file under a field the contract
|
|
17
|
+
* never mentions is merged anyway and left for the contract check to reject,
|
|
18
|
+
* which says `invalid` with the field named instead of silently dropping it.
|
|
19
|
+
*/
|
|
20
|
+
export function attachDeliveryFiles(payload, files, contract) {
|
|
21
|
+
if (files.length === 0)
|
|
22
|
+
return payload;
|
|
23
|
+
const merged = payload !== null && typeof payload === 'object' && !Array.isArray(payload)
|
|
24
|
+
? { ...payload }
|
|
25
|
+
: {};
|
|
26
|
+
const byField = new Map();
|
|
27
|
+
for (const file of files) {
|
|
28
|
+
byField.set(file.fieldName, [...(byField.get(file.fieldName) ?? []), file.attachment]);
|
|
29
|
+
}
|
|
30
|
+
for (const [field, attachments] of byField) {
|
|
31
|
+
addMultipartValue(merged, field, isAttachmentArrayProperty(contract, field) || attachments.length > 1
|
|
32
|
+
? attachments
|
|
33
|
+
: attachments[0]);
|
|
34
|
+
}
|
|
35
|
+
return merged;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=attach.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attach.js","sourceRoot":"","sources":["../../src/completion/attach.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAGpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAgB,EAChB,KAA8B,EAC9B,QAA6C;IAE7C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC;IAEvC,MAAM,MAAM,GACV,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QACxE,CAAC,CAAC,EAAE,GAAI,OAAmC,EAAE;QAC7C,CAAC,CAAC,EAAE,CAAC;IAET,MAAM,OAAO,GAAG,IAAI,GAAG,EAAwB,CAAC;IAChD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IACzF,CAAC;IAED,KAAK,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,IAAI,OAAO,EAAE,CAAC;QAC3C,iBAAiB,CACf,MAAM,EACN,KAAK,EACL,yBAAyB,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC;YAClE,CAAC,CAAC,WAAW;YACb,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CACnB,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { Address, Delivery, DeliveryFile, DeliveryOutcome } from './types.js';
|
|
2
|
+
export { httpStatusFor } from './types.js';
|
|
3
|
+
export { collectStepIds, resolveGate } from './address.js';
|
|
4
|
+
export type { Resolution } from './address.js';
|
|
5
|
+
export { attachDeliveryFiles } from './attach.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/completion/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3D,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/completion/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Continuing a run from outside — the inbound half of what `ingest/` does for
|
|
3
|
+
* starting one.
|
|
4
|
+
*
|
|
5
|
+
* The SDK names no URL and authenticates nobody: a host authenticates the
|
|
6
|
+
* caller with its own middleware, then calls `runtime.deliver`. What arrives is
|
|
7
|
+
* a {@link Delivery}; what the engine did with it is a {@link DeliveryOutcome},
|
|
8
|
+
* which the host maps to a status code. The outcomes are data rather than
|
|
9
|
+
* thrown messages because a machine caller has to decide from the answer
|
|
10
|
+
* whether to retry, stop, or fix its body.
|
|
11
|
+
*/
|
|
12
|
+
import type { PayloadError } from '../common/validate-payload.js';
|
|
13
|
+
import type { Attachment } from '../common/attachment.js';
|
|
14
|
+
/** Which parked node a delivery is for. */
|
|
15
|
+
export interface Address {
|
|
16
|
+
readonly executionId: string;
|
|
17
|
+
/**
|
|
18
|
+
* The author's own step id, as written in the config — unique across a
|
|
19
|
+
* workflow, and stable across runs, which is why it can go in a URL at
|
|
20
|
+
* authoring time when no execution exists yet.
|
|
21
|
+
*/
|
|
22
|
+
readonly stepId: string;
|
|
23
|
+
/**
|
|
24
|
+
* The exact node, for a step id with more than one parked instance. The
|
|
25
|
+
* engine resolves it from `stepId` whenever that is unambiguous, so a caller
|
|
26
|
+
* only needs it for a fan-out.
|
|
27
|
+
*/
|
|
28
|
+
readonly nodePath?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Which attempt of the gate this answers. A gate that re-parks — an agent
|
|
31
|
+
* re-dispatch, another round of a cycle — carries one, and a stale answer to
|
|
32
|
+
* the attempt before is superseded rather than applied.
|
|
33
|
+
*/
|
|
34
|
+
readonly fence?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* One file of a multipart delivery — already in storage.
|
|
38
|
+
*
|
|
39
|
+
* A reference rather than bytes, because the host streamed the part into its
|
|
40
|
+
* store while parsing: nothing between the socket and the store ever held the
|
|
41
|
+
* whole file, so a delivery's memory cost is the same whether it carries a
|
|
42
|
+
* kilobyte or a gigabyte.
|
|
43
|
+
*
|
|
44
|
+
* The consequence is that bytes exist before the engine has judged them. Every
|
|
45
|
+
* outcome other than `applied` therefore deletes what it was sent.
|
|
46
|
+
*/
|
|
47
|
+
export interface DeliveryFile {
|
|
48
|
+
/** The multipart field name — which key of the payload this file belongs to. */
|
|
49
|
+
readonly fieldName: string;
|
|
50
|
+
readonly attachment: Attachment;
|
|
51
|
+
}
|
|
52
|
+
/** What the outside world reported. */
|
|
53
|
+
export interface Delivery {
|
|
54
|
+
/**
|
|
55
|
+
* The body, or a multipart request's text fields. File parts come separately
|
|
56
|
+
* in {@link files}, because they are not payload until they are stored.
|
|
57
|
+
*/
|
|
58
|
+
readonly payload: unknown;
|
|
59
|
+
/**
|
|
60
|
+
* Uploaded files, merged into the payload under their field names once
|
|
61
|
+
* stored. Needs a StorageAdapter on the runtime.
|
|
62
|
+
*/
|
|
63
|
+
readonly files?: readonly DeliveryFile[];
|
|
64
|
+
/**
|
|
65
|
+
* How {@link payload} was encoded. `multipart` means every field arrived as
|
|
66
|
+
* text whatever it represents, so the engine re-reads each against the gate's
|
|
67
|
+
* contract; `json` (the default) means it is already typed and is left alone.
|
|
68
|
+
*
|
|
69
|
+
* The distinction matters because one URL takes both: without it the same
|
|
70
|
+
* contract would hand a step `"7003"` from one sender and `7003` from the
|
|
71
|
+
* other, and nothing downstream would catch it.
|
|
72
|
+
*/
|
|
73
|
+
readonly encoding?: 'json' | 'multipart';
|
|
74
|
+
/**
|
|
75
|
+
* The sender's id for this delivery. A repeat of one already applied is a
|
|
76
|
+
* duplicate rather than an error, which is what makes `curl --retry` safe.
|
|
77
|
+
*/
|
|
78
|
+
readonly deliveryId?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* What the engine did. `ignored` means the delivery was understood and
|
|
82
|
+
* deliberately dropped — the sender should stop, not retry.
|
|
83
|
+
*/
|
|
84
|
+
export type DeliveryOutcome = {
|
|
85
|
+
readonly kind: 'applied';
|
|
86
|
+
readonly nodePath: string;
|
|
87
|
+
} | {
|
|
88
|
+
readonly kind: 'ignored';
|
|
89
|
+
readonly reason: 'duplicate' | 'already_answered' | 'superseded' | 'run_ended';
|
|
90
|
+
} | {
|
|
91
|
+
readonly kind: 'unknown';
|
|
92
|
+
} | {
|
|
93
|
+
readonly kind: 'not_ready';
|
|
94
|
+
} | {
|
|
95
|
+
readonly kind: 'ambiguous';
|
|
96
|
+
readonly nodePaths: readonly string[];
|
|
97
|
+
} | {
|
|
98
|
+
readonly kind: 'invalid';
|
|
99
|
+
readonly issues: readonly PayloadError[];
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* The status a host should answer with. A recommendation, not a rule — the host
|
|
103
|
+
* owns its API.
|
|
104
|
+
*
|
|
105
|
+
* `ignored` answers 2xx on purpose: a non-2xx makes a sender's recovery worker
|
|
106
|
+
* redeliver a payload we dropped deliberately.
|
|
107
|
+
*/
|
|
108
|
+
export declare function httpStatusFor(outcome: DeliveryOutcome): number;
|
|
109
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/completion/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,2CAA2C;AAC3C,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,YAAY;IAC3B,gFAAgF;IAChF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;CACjC;AAED,uCAAuC;AACvC,MAAM,WAAW,QAAQ;IACvB;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IACzC;;;;;;;;OAQG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACvD;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,kBAAkB,GAAG,YAAY,GAAG,WAAW,CAAC;CAChF,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GAC9B;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GACrE;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAA;CAAE,CAAC;AAE3E;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAe9D"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Continuing a run from outside — the inbound half of what `ingest/` does for
|
|
3
|
+
* starting one.
|
|
4
|
+
*
|
|
5
|
+
* The SDK names no URL and authenticates nobody: a host authenticates the
|
|
6
|
+
* caller with its own middleware, then calls `runtime.deliver`. What arrives is
|
|
7
|
+
* a {@link Delivery}; what the engine did with it is a {@link DeliveryOutcome},
|
|
8
|
+
* which the host maps to a status code. The outcomes are data rather than
|
|
9
|
+
* thrown messages because a machine caller has to decide from the answer
|
|
10
|
+
* whether to retry, stop, or fix its body.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The status a host should answer with. A recommendation, not a rule — the host
|
|
14
|
+
* owns its API.
|
|
15
|
+
*
|
|
16
|
+
* `ignored` answers 2xx on purpose: a non-2xx makes a sender's recovery worker
|
|
17
|
+
* redeliver a payload we dropped deliberately.
|
|
18
|
+
*/
|
|
19
|
+
export function httpStatusFor(outcome) {
|
|
20
|
+
switch (outcome.kind) {
|
|
21
|
+
case 'applied':
|
|
22
|
+
return 202;
|
|
23
|
+
case 'ignored':
|
|
24
|
+
return 200;
|
|
25
|
+
case 'not_ready':
|
|
26
|
+
return 409;
|
|
27
|
+
case 'ambiguous':
|
|
28
|
+
return 400;
|
|
29
|
+
case 'invalid':
|
|
30
|
+
return 422;
|
|
31
|
+
case 'unknown':
|
|
32
|
+
return 404;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/completion/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAyFH;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,OAAwB;IACpD,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC;QACb,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC;QACb,KAAK,WAAW;YACd,OAAO,GAAG,CAAC;QACb,KAAK,WAAW;YACd,OAAO,GAAG,CAAC;QACb,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC;QACb,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-connector.d.ts","sourceRoot":"","sources":["../../../src/connectors/builtin/builtin-connector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"builtin-connector.d.ts","sourceRoot":"","sources":["../../../src/connectors/builtin/builtin-connector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAwBnE,qBAAa,gBAAiB,SAAQ,aAAa;IACjD,SAAkB,EAAE,aAAa;IACjC,SAAkB,OAAO,WAAW;IACpC,SAAkB,IAAI,cAAc;IACpC,SAAkB,WAAW,mGACgE;IAC7F,SAAkB,IAAI,YAAY;IAIlC,iGAAiG;IACjG,SAAkB,WAAW,EAAE,SAAS,oBAAoB,EAAE,CAE5D;IAEF;;;;OAIG;IACH,SAAkB,KAAK,EAAE,SAAS,OAAO,EAAE,CAgBxC;IAEH,SAAkB,QAAQ,EAAE,SAAS,UAAU,EAAE,CAK/C;CACH"}
|
|
@@ -25,7 +25,9 @@ import { MapStep } from './steps/map.step.js';
|
|
|
25
25
|
import { ParallelStep } from './steps/parallel.step.js';
|
|
26
26
|
import { CycleStep } from './steps/cycle.step.js';
|
|
27
27
|
import { SwitchStep } from './steps/switch.step.js';
|
|
28
|
-
import {
|
|
28
|
+
import { DelayStep } from './steps/delay.step.js';
|
|
29
|
+
import { WaitForWebhookStep } from './steps/wait-for-webhook.step.js';
|
|
30
|
+
import { WaitForHumanStep } from './steps/wait-for-human.step.js';
|
|
29
31
|
import { DefaultManualTrigger } from './triggers/default-manual-trigger.js';
|
|
30
32
|
import { DefaultEventTrigger } from './triggers/default-event-trigger.js';
|
|
31
33
|
import { DefaultCronTrigger } from './triggers/default-cron-trigger.js';
|
|
@@ -58,7 +60,9 @@ export class BuiltinConnector extends BaseConnector {
|
|
|
58
60
|
new ParallelStep(),
|
|
59
61
|
new CycleStep(),
|
|
60
62
|
new SwitchStep(),
|
|
61
|
-
new
|
|
63
|
+
new WaitForHumanStep(),
|
|
64
|
+
new WaitForWebhookStep(),
|
|
65
|
+
new DelayStep(),
|
|
62
66
|
]);
|
|
63
67
|
triggers = [
|
|
64
68
|
new DefaultManualTrigger(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-connector.js","sourceRoot":"","sources":["../../../src/connectors/builtin/builtin-connector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,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EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAEnF,MAAM,OAAO,gBAAiB,SAAQ,aAAa;IAC/B,EAAE,GAAG,SAAS,CAAC;IACf,OAAO,GAAG,OAAO,CAAC;IAClB,IAAI,GAAG,UAAU,CAAC;IAClB,WAAW,GAC3B,0FAA0F,CAAC;IAC3E,IAAI,GAAG,QAAQ,CAAC;IAIlC,iGAAiG;IAC/E,WAAW,GAAoC;QAC/D,GAAG,uBAAuB;KAC3B,CAAC;IAEF;;;;OAIG;IACe,KAAK,GAAuB,YAAY,CAAC,uBAAuB,EAAE;QAClF,IAAI,UAAU,EAAE;QAChB,IAAI,mBAAmB,EAAE;QACzB,IAAI,QAAQ,EAAE;QACd,IAAI,eAAe,EAAE;QACrB,IAAI,QAAQ,EAAE;QACd,IAAI,SAAS,EAAE;QACf,IAAI,eAAe,EAAE;QACrB,IAAI,QAAQ,EAAE;QACd,IAAI,OAAO,EAAE;QACb,IAAI,YAAY,EAAE;QAClB,IAAI,SAAS,EAAE;QACf,IAAI,UAAU,EAAE;QAChB,IAAI,gBAAgB,EAAE;QACtB,IAAI,kBAAkB,EAAE;QACxB,IAAI,SAAS,EAAE;KAChB,CAAC,CAAC;IAEe,QAAQ,GAA0B;QAClD,IAAI,oBAAoB,EAAgB;QACxC,IAAI,mBAAmB,EAAgB;QACvC,IAAI,kBAAkB,EAAgB;QACtC,IAAI,uBAAuB,EAAgB;KAC5C,CAAC;CACH"}
|
|
@@ -36,18 +36,21 @@ export declare const CodeStepConfigSchema: z.ZodObject<{
|
|
|
36
36
|
attachments: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodObject<{
|
|
37
37
|
name: z.ZodString;
|
|
38
38
|
mimeType: z.ZodString;
|
|
39
|
-
|
|
39
|
+
handle: z.ZodString;
|
|
40
40
|
size: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
hash: z.ZodOptional<z.ZodString>;
|
|
41
42
|
}, "strip", z.ZodTypeAny, {
|
|
42
43
|
name: string;
|
|
43
44
|
mimeType: string;
|
|
44
|
-
|
|
45
|
+
handle: string;
|
|
45
46
|
size?: number | undefined;
|
|
47
|
+
hash?: string | undefined;
|
|
46
48
|
}, {
|
|
47
49
|
name: string;
|
|
48
50
|
mimeType: string;
|
|
49
|
-
|
|
51
|
+
handle: string;
|
|
50
52
|
size?: number | undefined;
|
|
53
|
+
hash?: string | undefined;
|
|
51
54
|
}>, "many">, z.ZodString]>>;
|
|
52
55
|
collectOutputFiles: z.ZodDefault<z.ZodBoolean>;
|
|
53
56
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -61,8 +64,9 @@ export declare const CodeStepConfigSchema: z.ZodObject<{
|
|
|
61
64
|
attachments?: string | {
|
|
62
65
|
name: string;
|
|
63
66
|
mimeType: string;
|
|
64
|
-
|
|
67
|
+
handle: string;
|
|
65
68
|
size?: number | undefined;
|
|
69
|
+
hash?: string | undefined;
|
|
66
70
|
}[] | undefined;
|
|
67
71
|
}, {
|
|
68
72
|
code: string;
|
|
@@ -74,8 +78,9 @@ export declare const CodeStepConfigSchema: z.ZodObject<{
|
|
|
74
78
|
attachments?: string | {
|
|
75
79
|
name: string;
|
|
76
80
|
mimeType: string;
|
|
77
|
-
|
|
81
|
+
handle: string;
|
|
78
82
|
size?: number | undefined;
|
|
83
|
+
hash?: string | undefined;
|
|
79
84
|
}[] | undefined;
|
|
80
85
|
collectOutputFiles?: boolean | undefined;
|
|
81
86
|
}>;
|
|
@@ -104,18 +109,21 @@ export declare class CodeStep extends BaseActionStep<typeof CodeStepConfigSchema
|
|
|
104
109
|
attachments: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodObject<{
|
|
105
110
|
name: z.ZodString;
|
|
106
111
|
mimeType: z.ZodString;
|
|
107
|
-
|
|
112
|
+
handle: z.ZodString;
|
|
108
113
|
size: z.ZodOptional<z.ZodNumber>;
|
|
114
|
+
hash: z.ZodOptional<z.ZodString>;
|
|
109
115
|
}, "strip", z.ZodTypeAny, {
|
|
110
116
|
name: string;
|
|
111
117
|
mimeType: string;
|
|
112
|
-
|
|
118
|
+
handle: string;
|
|
113
119
|
size?: number | undefined;
|
|
120
|
+
hash?: string | undefined;
|
|
114
121
|
}, {
|
|
115
122
|
name: string;
|
|
116
123
|
mimeType: string;
|
|
117
|
-
|
|
124
|
+
handle: string;
|
|
118
125
|
size?: number | undefined;
|
|
126
|
+
hash?: string | undefined;
|
|
119
127
|
}>, "many">, z.ZodString]>>;
|
|
120
128
|
collectOutputFiles: z.ZodDefault<z.ZodBoolean>;
|
|
121
129
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -129,8 +137,9 @@ export declare class CodeStep extends BaseActionStep<typeof CodeStepConfigSchema
|
|
|
129
137
|
attachments?: string | {
|
|
130
138
|
name: string;
|
|
131
139
|
mimeType: string;
|
|
132
|
-
|
|
140
|
+
handle: string;
|
|
133
141
|
size?: number | undefined;
|
|
142
|
+
hash?: string | undefined;
|
|
134
143
|
}[] | undefined;
|
|
135
144
|
}, {
|
|
136
145
|
code: string;
|
|
@@ -142,8 +151,9 @@ export declare class CodeStep extends BaseActionStep<typeof CodeStepConfigSchema
|
|
|
142
151
|
attachments?: string | {
|
|
143
152
|
name: string;
|
|
144
153
|
mimeType: string;
|
|
145
|
-
|
|
154
|
+
handle: string;
|
|
146
155
|
size?: number | undefined;
|
|
156
|
+
hash?: string | undefined;
|
|
147
157
|
}[] | undefined;
|
|
148
158
|
collectOutputFiles?: boolean | undefined;
|
|
149
159
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.step.d.ts","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/code.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"code.step.d.ts","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/code.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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AAM,EAAE,OAAO,CAAC;IAqB3E,OAAO,CACpB,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,oBAAoB,GACxB,OAAO,CAAC,cAAc,CAAC;CAuG3B"}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Must return a JSON-serializable value.
|
|
16
16
|
*/
|
|
17
|
+
import { Readable } from 'node:stream';
|
|
17
18
|
import { z } from 'zod';
|
|
18
19
|
import { BaseActionStep } from '../../../steps/base-step.js';
|
|
19
20
|
import { bindSandboxSession } from '../../../sandbox/types.js';
|
|
@@ -38,6 +39,8 @@ const CodeStepOutputSchema = z.object({
|
|
|
38
39
|
});
|
|
39
40
|
// ─── Mounting bound documents ───
|
|
40
41
|
const MOUNT_DIR = '/mnt/files';
|
|
42
|
+
/** How large a document may be to mount into a sandbox, which takes bytes. */
|
|
43
|
+
const MAX_MOUNT_BYTES = 8 * 1024 * 1024;
|
|
41
44
|
function planMounts(attachments) {
|
|
42
45
|
return attachments.map((attachment) => ({
|
|
43
46
|
attachment,
|
|
@@ -148,8 +151,7 @@ export class CodeStep extends BaseActionStep {
|
|
|
148
151
|
const scope = ctx.runtime.attributes;
|
|
149
152
|
const bound = Array.isArray(config.attachments) ? config.attachments : [];
|
|
150
153
|
const mounts = planMounts(bound);
|
|
151
|
-
|
|
152
|
-
if (mounts.length > 0 && !storage) {
|
|
154
|
+
if (mounts.length > 0 && !ctx.files.available) {
|
|
153
155
|
throw new Error('Code step execution failed: documents are bound to this step but no '
|
|
154
156
|
+ 'StorageAdapter is configured, so their bytes cannot be read. '
|
|
155
157
|
+ 'Configure a storage backend to mount documents into the sandbox.');
|
|
@@ -157,10 +159,13 @@ export class CodeStep extends BaseActionStep {
|
|
|
157
159
|
const handle = await ctx.sandbox.create(scope ? { scope } : {});
|
|
158
160
|
try {
|
|
159
161
|
const session = bindSandboxSession(ctx.sandbox, handle);
|
|
160
|
-
if (mounts.length > 0
|
|
162
|
+
if (mounts.length > 0) {
|
|
161
163
|
await session.writeFiles(await Promise.all(mounts.map(async (m) => ({
|
|
162
164
|
path: m.path,
|
|
163
|
-
bytes
|
|
165
|
+
// A sandbox takes bytes, not a stream, so this is one of the few
|
|
166
|
+
// places a file is materialised — capped, and loud when it is
|
|
167
|
+
// too big, rather than quietly exhausting the heap.
|
|
168
|
+
bytes: await ctx.files.buffer(m.attachment, { maxBytes: MAX_MOUNT_BYTES }),
|
|
164
169
|
}))));
|
|
165
170
|
ctx.log.info(`mounted ${String(mounts.length)} document(s) at ${MOUNT_DIR}: ${mounts.map((m) => m.name).join(', ')}`);
|
|
166
171
|
}
|
|
@@ -184,11 +189,13 @@ export class CodeStep extends BaseActionStep {
|
|
|
184
189
|
ctx.log.info(logged);
|
|
185
190
|
const payload = res.stdout.slice(markerAt + RESULT_MARKER.length).trim();
|
|
186
191
|
const result = JSON.parse(payload);
|
|
187
|
-
const files = config.collectOutputFiles &&
|
|
188
|
-
? await Promise.all(res.artifacts.map((a) =>
|
|
192
|
+
const files = config.collectOutputFiles && ctx.files.available
|
|
193
|
+
? await Promise.all(res.artifacts.map((a) => ctx.files.put({
|
|
189
194
|
name: a.path.split('/').pop() ?? 'output',
|
|
190
195
|
mimeType: a.mimeType,
|
|
191
|
-
bytes
|
|
196
|
+
// The sandbox already handed these over as bytes; wrapping rather
|
|
197
|
+
// than copying keeps the adapter's one entry point a stream.
|
|
198
|
+
stream: Readable.from(Buffer.from(a.bytes)),
|
|
192
199
|
})))
|
|
193
200
|
: [];
|
|
194
201
|
return { result, ...(config.collectOutputFiles ? { files } : {}) };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.step.js","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/code.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,k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K,CAAC,SAAS;gBAC5D,CAAC,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;oBACzD,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,QAAQ;oBACzC,QAAQ,EAAE,CAAC,CAAC,QAAQ;oBACpB,kEAAkE;oBAClE,6DAA6D;oBAC7D,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;iBAC5C,CAAC,CAAC,CAAC;gBACJ,CAAC,CAAC,EAAE,CAAC;YACP,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QACrE,CAAC;gBAAS,CAAC;YACT,MAAM,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;gBAC3C,0BAA0B;YAC5B,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF"}
|
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
* round before, and the executor saves that jump on its step records — so a
|
|
17
17
|
* resumed execution replays into the same round with the same input.
|
|
18
18
|
*
|
|
19
|
-
* Output: `{ rounds, exit, result }`
|
|
19
|
+
* Output: `{ rounds, exit, result?, state }`. `result` is a FINISH's value and
|
|
20
|
+
* nothing else's, so later steps can be typed against the `result` schema the
|
|
21
|
+
* author declares; `state` is the last round's input whatever ended the cycle,
|
|
22
|
+
* which on a give-up is the only diagnostic there is. One field meaning both
|
|
23
|
+
* would make the declared schema false on two of the three exits.
|
|
20
24
|
*/
|
|
21
25
|
import { z } from 'zod';
|
|
22
26
|
import { BaseControlFlowStep } from '../../../steps/base-step.js';
|
|
@@ -37,6 +41,7 @@ export declare const CycleStepConfigSchema: z.ZodObject<{
|
|
|
37
41
|
type: z.ZodString;
|
|
38
42
|
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
39
43
|
maxIterations: z.ZodDefault<z.ZodNumber>;
|
|
44
|
+
result: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
40
45
|
}, "strip", z.ZodTypeAny, {
|
|
41
46
|
input: Record<string, unknown>;
|
|
42
47
|
body: z.objectOutputType<{
|
|
@@ -44,12 +49,14 @@ export declare const CycleStepConfigSchema: z.ZodObject<{
|
|
|
44
49
|
type: z.ZodString;
|
|
45
50
|
}, z.ZodTypeAny, "passthrough">[];
|
|
46
51
|
maxIterations: number;
|
|
52
|
+
result?: Record<string, unknown> | undefined;
|
|
47
53
|
}, {
|
|
48
54
|
body: z.objectInputType<{
|
|
49
55
|
id: z.ZodString;
|
|
50
56
|
type: z.ZodString;
|
|
51
57
|
}, z.ZodTypeAny, "passthrough">[];
|
|
52
58
|
input?: Record<string, unknown> | undefined;
|
|
59
|
+
result?: Record<string, unknown> | undefined;
|
|
53
60
|
maxIterations?: number | undefined;
|
|
54
61
|
}>;
|
|
55
62
|
export type CycleStepConfig = z.infer<typeof CycleStepConfigSchema>;
|
|
@@ -58,8 +65,10 @@ export interface CycleStepOutput extends Record<string, unknown> {
|
|
|
58
65
|
rounds: number;
|
|
59
66
|
/** Why the CYCLE ended. */
|
|
60
67
|
exit: 'completed' | 'finish' | 'max_iterations';
|
|
61
|
-
/**
|
|
62
|
-
result
|
|
68
|
+
/** What a FINISH handed back. Absent on every other exit — read `exit` first. */
|
|
69
|
+
result?: Record<string, unknown>;
|
|
70
|
+
/** The last round's input, whatever ended the cycle. */
|
|
71
|
+
state: Record<string, unknown>;
|
|
63
72
|
}
|
|
64
73
|
export declare class CycleStep extends BaseControlFlowStep<typeof CycleStepConfigSchema, CycleStepOutput> {
|
|
65
74
|
readonly type = BuiltinStepType.CYCLE;
|
|
@@ -78,6 +87,7 @@ export declare class CycleStep extends BaseControlFlowStep<typeof CycleStepConfi
|
|
|
78
87
|
type: z.ZodString;
|
|
79
88
|
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
80
89
|
maxIterations: z.ZodDefault<z.ZodNumber>;
|
|
90
|
+
result: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
81
91
|
}, "strip", z.ZodTypeAny, {
|
|
82
92
|
input: Record<string, unknown>;
|
|
83
93
|
body: z.objectOutputType<{
|
|
@@ -85,26 +95,31 @@ export declare class CycleStep extends BaseControlFlowStep<typeof CycleStepConfi
|
|
|
85
95
|
type: z.ZodString;
|
|
86
96
|
}, z.ZodTypeAny, "passthrough">[];
|
|
87
97
|
maxIterations: number;
|
|
98
|
+
result?: Record<string, unknown> | undefined;
|
|
88
99
|
}, {
|
|
89
100
|
body: z.objectInputType<{
|
|
90
101
|
id: z.ZodString;
|
|
91
102
|
type: z.ZodString;
|
|
92
103
|
}, z.ZodTypeAny, "passthrough">[];
|
|
93
104
|
input?: Record<string, unknown> | undefined;
|
|
105
|
+
result?: Record<string, unknown> | undefined;
|
|
94
106
|
maxIterations?: number | undefined;
|
|
95
107
|
}>;
|
|
96
108
|
readonly outputSchema: z.ZodObject<{
|
|
97
109
|
rounds: z.ZodNumber;
|
|
98
110
|
exit: z.ZodEnum<["completed", "finish", "max_iterations"]>;
|
|
99
|
-
result: z.ZodRecord<z.ZodString, z.ZodUnknown
|
|
111
|
+
result: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
112
|
+
state: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
100
113
|
}, "strip", z.ZodTypeAny, {
|
|
101
|
-
result: Record<string, unknown>;
|
|
102
114
|
rounds: number;
|
|
103
115
|
exit: "finish" | "completed" | "max_iterations";
|
|
116
|
+
state: Record<string, unknown>;
|
|
117
|
+
result?: Record<string, unknown> | undefined;
|
|
104
118
|
}, {
|
|
105
|
-
result: Record<string, unknown>;
|
|
106
119
|
rounds: number;
|
|
107
120
|
exit: "finish" | "completed" | "max_iterations";
|
|
121
|
+
state: Record<string, unknown>;
|
|
122
|
+
result?: Record<string, unknown> | undefined;
|
|
108
123
|
}>;
|
|
109
124
|
readonly category: "control";
|
|
110
125
|
readonly branchModel: "iterate";
|
|
@@ -115,8 +130,22 @@ export declare class CycleStep extends BaseControlFlowStep<typeof CycleStepConfi
|
|
|
115
130
|
readonly label: "Each round";
|
|
116
131
|
}];
|
|
117
132
|
getBranches(config: Record<string, unknown>): Record<string, WorkflowStepConfig[]>;
|
|
133
|
+
/** The result field holds a JSON Schema, which the editor edits as one. */
|
|
134
|
+
decorateConfigSchema(jsonSchema: Record<string, unknown>): Record<string, unknown>;
|
|
135
|
+
/**
|
|
136
|
+
* `result` is whatever the author declared, `state` is shaped by `input` —
|
|
137
|
+
* the same trick the HTTP step does with its response.
|
|
138
|
+
*
|
|
139
|
+
* `result` is deliberately out of `required`: only a FINISH produces one.
|
|
140
|
+
* Nothing reads `required` during ref resolution today, so this documents the
|
|
141
|
+
* exit the author has to check rather than enforcing it.
|
|
142
|
+
*/
|
|
143
|
+
resolveOutputJsonSchema(config: Record<string, unknown>): Record<string, unknown>;
|
|
118
144
|
branchScopeSchemas(config: Record<string, unknown>): Record<string, Record<string, unknown>>;
|
|
119
|
-
/**
|
|
145
|
+
/**
|
|
146
|
+
* A GO_TO starts a round, so it must carry exactly the keys `input` declares;
|
|
147
|
+
* a FINISH ends the cycle, so it answers to `result` instead.
|
|
148
|
+
*/
|
|
120
149
|
checkJump(config: Record<string, unknown>, jump: {
|
|
121
150
|
kind: JumpKind;
|
|
122
151
|
value: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cycle.step.d.ts","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/cycle.step.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cycle.step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