@codemation/core 0.11.1 → 0.12.0
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/CHANGELOG.md +6 -0
- package/dist/{CostCatalogContract-DZgcUBE4.d.cts → CostCatalogContract-DD7fQ4FF.d.cts} +2 -2
- package/dist/{EngineRuntimeRegistration.types-Cggm5GVY.d.cts → EngineRuntimeRegistration.types-DTV5_7Jw.d.cts} +3 -3
- package/dist/{EngineRuntimeRegistration.types-BQbS9_gs.d.ts → EngineRuntimeRegistration.types-Dl92Hdoi.d.ts} +2 -2
- package/dist/InMemoryRunDataFactory-qMiYjhCK.d.cts +202 -0
- package/dist/{ItemsInputNormalizer-D-MH8MBs.js → ItemsInputNormalizer-BhuxvZh5.js} +2 -2
- package/dist/{ItemsInputNormalizer-D-MH8MBs.js.map → ItemsInputNormalizer-BhuxvZh5.js.map} +1 -1
- package/dist/{ItemsInputNormalizer-_Mfcd3YU.d.ts → ItemsInputNormalizer-C09a7iFP.d.ts} +2 -2
- package/dist/{ItemsInputNormalizer-C_dpn76M.d.cts → ItemsInputNormalizer-DLaD6rTl.d.cts} +3 -3
- package/dist/{ItemsInputNormalizer-CwdOhSAK.cjs → ItemsInputNormalizer-Div-fb6a.cjs} +2 -2
- package/dist/{ItemsInputNormalizer-CwdOhSAK.cjs.map → ItemsInputNormalizer-Div-fb6a.cjs.map} +1 -1
- package/dist/{RunIntentService-BVur7x9n.d.ts → RunIntentService-BOSGwmqn.d.ts} +18 -4
- package/dist/{RunIntentService-CEF-sFfI.d.cts → RunIntentService-CWMMrAP4.d.cts} +18 -4
- package/dist/{agentMcpTypes-ZiNbNsEi.d.cts → agentMcpTypes-DUmniLOY.d.cts} +183 -4
- package/dist/bootstrap/index.cjs +3 -3
- package/dist/bootstrap/index.d.cts +63 -7
- package/dist/bootstrap/index.d.ts +5 -5
- package/dist/bootstrap/index.js +3 -3
- package/dist/{bootstrap-D_Yyi0wL.js → bootstrap-CKTMMNmL.js} +173 -4
- package/dist/bootstrap-CKTMMNmL.js.map +1 -0
- package/dist/{bootstrap-BxuTFTLB.cjs → bootstrap-D460dCgS.cjs} +175 -4
- package/dist/bootstrap-D460dCgS.cjs.map +1 -0
- package/dist/browser.cjs +3 -2
- package/dist/browser.d.cts +4 -4
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +3 -3
- package/dist/contracts.d.cts +5 -5
- package/dist/contracts.d.ts +2 -2
- package/dist/{di-0Wop7z1y.js → di-DdsgWfVy.js} +31 -2
- package/dist/di-DdsgWfVy.js.map +1 -0
- package/dist/{di-BlEKdoZS.cjs → di-tO6R7VJV.cjs} +36 -1
- package/dist/di-tO6R7VJV.cjs.map +1 -0
- package/dist/{executionPersistenceContracts-BgZMRsTa.d.cts → executionPersistenceContracts-DenJJK2T.d.cts} +2 -2
- package/dist/{index-62Ba9f7D.d.ts → index-BZDhEQ6W.d.ts} +277 -101
- package/dist/{index-zWGtEhrf.d.ts → index-CSKKuK60.d.ts} +441 -5
- package/dist/index.cjs +71 -161
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +395 -97
- package/dist/index.d.ts +5 -5
- package/dist/index.js +56 -159
- package/dist/index.js.map +1 -1
- package/dist/{params-B5SENSzZ.d.cts → params-DqRvku2h.d.cts} +2 -2
- package/dist/{runtime-cxmUkk0l.js → runtime-BPZgnZ9G.js} +611 -16
- package/dist/runtime-BPZgnZ9G.js.map +1 -0
- package/dist/{runtime-DBzq5YBi.cjs → runtime-CyW9c9XM.cjs} +670 -15
- package/dist/runtime-CyW9c9XM.cjs.map +1 -0
- package/dist/testing.cjs +3 -3
- package/dist/testing.d.cts +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +3 -3
- package/package.json +1 -1
- package/src/authoring/defineHumanApprovalNode.types.ts +379 -0
- package/src/authoring/index.ts +6 -0
- package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +29 -0
- package/src/contracts/CodemationTelemetryAttributeNames.ts +10 -0
- package/src/contracts/credentialTypes.ts +10 -0
- package/src/contracts/hitlSeamTypes.ts +34 -0
- package/src/contracts/humanTaskStoreTypes.ts +48 -0
- package/src/contracts/inboxChannelTypes.ts +58 -0
- package/src/contracts/index.ts +3 -0
- package/src/contracts/runTypes.ts +61 -3
- package/src/contracts/runtimeTypes.ts +112 -0
- package/src/credentials/CredentialMaterialProvider.types.ts +61 -0
- package/src/credentials/ManagedCredentialMaterialWriteError.ts +14 -0
- package/src/credentials/ManagedMaterialFetchError.ts +16 -0
- package/src/execution/ActivationEnqueueService.ts +16 -0
- package/src/execution/DefaultExecutionContextFactory.ts +11 -0
- package/src/execution/NodeExecutionSnapshotFactory.ts +7 -1
- package/src/execution/NodeExecutor.ts +60 -1
- package/src/execution/NodeExecutorFactory.ts +12 -2
- package/src/execution/NodeSuspensionHandler.ts +220 -0
- package/src/execution/PersistedRunStateTerminalBuilder.ts +5 -2
- package/src/execution/RunStateSemantics.ts +5 -0
- package/src/execution/RunSuspendedError.ts +21 -0
- package/src/index.ts +40 -0
- package/src/orchestration/Engine.ts +12 -2
- package/src/orchestration/EngineWaiters.ts +1 -1
- package/src/orchestration/NodeExecutionRequestHandlerService.ts +25 -2
- package/src/orchestration/RunContinuationService.ts +226 -2
- package/src/orchestration/TestSuiteOrchestrator.ts +5 -4
- package/src/runtime/RunIntentService.ts +3 -0
- package/src/workflow/dsl/ChainCursorResolver.ts +36 -0
- package/dist/InMemoryRunDataFactory-C7YItvHG.d.cts +0 -123
- package/dist/bootstrap-BxuTFTLB.cjs.map +0 -1
- package/dist/bootstrap-D_Yyi0wL.js.map +0 -1
- package/dist/di-0Wop7z1y.js.map +0 -1
- package/dist/di-BlEKdoZS.cjs.map +0 -1
- package/dist/runtime-DBzq5YBi.cjs.map +0 -1
- package/dist/runtime-cxmUkk0l.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { i as WorkflowSnapshotCodec, u as Engine } from "./RunIntentService-
|
|
3
|
-
import { B as ZodSchemaAny, K as CallableToolConfig, q as CallableToolConfigOptions } from "./ItemsInputNormalizer-
|
|
1
|
+
import { $a as CredentialFieldSchema, $t as PersistedRunState, A as DefinedNodeCredentialAccessors, Aa as TelemetrySpanScope, Ar as RunId, Ci as HumanTaskHandle, Da as TelemetryScope, Dr as PersistedRunPolicySnapshot, Eo as OutputPortKey, Er as ParentExecutionRef, Fi as NodeExecutionContext, Fr as TriggerNodeConfig, Ga as CostTrackingUsageRecord, Gn as RunEventSubscription, Ii as NodeExecutionRequest, Ji as SuspensionRequest, Jn as TestSuiteRunId, Kn as TestCaseRunStatus, M as DefinedNodeCredentialBindings, Mr as RunnableNodeConfig, Ni as NodeActivationScheduler, O as DefinedNode, On as TypeToken, Oo as WorkflowId, Or as RunDataFactory, Pi as NodeBinaryAttachmentService, Qn as BinaryAttachment, Qt as PersistedRunSchedulingState, Ri as NodeExecutionScheduler, Rt as ConnectionInvocationId, Si as HumanTaskActor, Sr as NodeOutputs, Ti as HumanTaskSubject, To as NodeId, Ua as CostTrackingTelemetryFactory, Un as RunEvent, Va as CostTrackingTelemetry, Vi as NodeResolver, Vn as EngineExecutionLimitsPolicy, Vt as EngineRunCounters, Wi as PreparedNodeActivationDispatch, Wn as RunEventBus, Wt as NodeExecutionSnapshot, Zn as ActivationIdFactory, _a as WorkflowActivationPolicy, _n as RunTestContext, ao as CredentialJsonRecord, bi as ExecutionContext, bn as WorkflowExecutionPruneRepository, cn as RunExecutionOptions, di as BinaryStorageReadResult, do as CredentialSessionFactoryArgs, dr as NodeActivationId, eo as CredentialHealth, er as Edge, fa as WebhookInvocationMatch, fi as BinaryStorageStatResult, fn as RunResult, fo as CredentialSessionService, fr as NodeConfigBase, gi as EngineDeps, gn as RunSummary, ha as WebhookTriggerRoutingDiagnostics, ho as CredentialTypeDefinition, ht as CostCatalogEntry, ia as WorkflowRepository, ir as Items, ji as NodeActivationRequest, ki as NodeActivationContinuation, kr as RunDataSnapshot, la as HttpMethod, li as BinaryBody, lo as CredentialRequirement, lr as JsonValue, mi as BinaryStorageWriteResult, mo as CredentialType, mt as CostCatalog, na as TriggerTestItemsContext, nn as PersistedWorkflowSnapshotNode, nr as Item, pa as WebhookTriggerMatcher, pr as NodeDefinition, qa as CollectionsContext, qn as TestSuiteRunStatus, ra as WorkflowNodeInstanceFactory, si as RetryPolicySpec, ta as TriggerSetupStateRepository, tr as ExecutionMode, ua as TriggerInstanceId, ui as BinaryStorage, un as RunPruneCandidate, ur as MutableRunData, va as ExecutionTelemetry, vr as NodeInspectorSummaryRow, wr as NodeSchedulerDecision, xi as ExecutionContextFactory, xn as WorkflowExecutionRepository, xo as PollingTriggerLogger, xr as NodeOffloadPolicy, ya as ExecutionTelemetryFactory, yi as ExecutionBinaryService, yn as WorkflowExecutionListingRepository, zi as NodeExecutionStatePublisher, zr as WorkflowDefinition, zt as ConnectionInvocationRecord } from "./index-CSKKuK60.js";
|
|
2
|
+
import { i as WorkflowSnapshotCodec, u as Engine } from "./RunIntentService-BOSGwmqn.js";
|
|
3
|
+
import { B as ZodSchemaAny, K as CallableToolConfig, q as CallableToolConfigOptions } from "./ItemsInputNormalizer-C09a7iFP.js";
|
|
4
4
|
import { ZodType, z } from "zod";
|
|
5
5
|
|
|
6
6
|
//#region src/orchestration/AbortControllerFactory.d.ts
|
|
@@ -36,102 +36,136 @@ declare class SystemClock implements Clock {
|
|
|
36
36
|
now(): Date;
|
|
37
37
|
}
|
|
38
38
|
//#endregion
|
|
39
|
-
//#region src/
|
|
40
|
-
type
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
readonly
|
|
45
|
-
readonly
|
|
46
|
-
readonly
|
|
47
|
-
readonly
|
|
48
|
-
readonly
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
readonly
|
|
57
|
-
readonly
|
|
58
|
-
readonly
|
|
39
|
+
//#region src/contracts/humanTaskStoreTypes.d.ts
|
|
40
|
+
type HumanTaskStatus = "pending" | "decided" | "timed_out" | "auto_accepted" | "cancelled";
|
|
41
|
+
/** Persisted record for a single HITL task instance. */
|
|
42
|
+
interface HumanTaskRecord {
|
|
43
|
+
readonly id: string;
|
|
44
|
+
readonly runId: string;
|
|
45
|
+
readonly workflowId: string;
|
|
46
|
+
readonly workspaceId?: string;
|
|
47
|
+
readonly nodeId: string;
|
|
48
|
+
readonly activationId: string;
|
|
49
|
+
readonly itemIndex: number;
|
|
50
|
+
readonly status: HumanTaskStatus;
|
|
51
|
+
readonly channel: string;
|
|
52
|
+
readonly subject: HumanTaskSubject;
|
|
53
|
+
readonly metadata: Record<string, JsonValue>;
|
|
54
|
+
readonly decisionSchemaJson: string;
|
|
55
|
+
readonly decisionSchemaHash: string;
|
|
56
|
+
readonly onTimeout: "halt" | "auto-accept";
|
|
57
|
+
readonly deliveryRef?: JsonValue;
|
|
58
|
+
readonly decision?: JsonValue;
|
|
59
|
+
readonly decidedAt?: Date;
|
|
60
|
+
readonly decidedBy?: HumanTaskActor;
|
|
61
|
+
readonly resumeTokenHash: string;
|
|
62
|
+
readonly expiresAt: Date;
|
|
63
|
+
readonly createdAt: Date;
|
|
64
|
+
}
|
|
65
|
+
interface HumanTaskStore {
|
|
66
|
+
create(record: HumanTaskRecord): Promise<void>;
|
|
67
|
+
findById(taskId: string): Promise<HumanTaskRecord | undefined>;
|
|
68
|
+
findByResumeTokenHash(tokenHash: string): Promise<HumanTaskRecord | undefined>;
|
|
69
|
+
findPendingForWorkspace(workspaceId: string): Promise<ReadonlyArray<HumanTaskRecord>>;
|
|
70
|
+
/** Returns all pending tasks regardless of workspace. Used by the local dev inbox (non-managed mode). */
|
|
71
|
+
findAllPending(): Promise<ReadonlyArray<HumanTaskRecord>>;
|
|
72
|
+
markDecided(args: {
|
|
73
|
+
taskId: string;
|
|
74
|
+
decision: JsonValue;
|
|
75
|
+
decidedBy: HumanTaskActor;
|
|
76
|
+
decidedAt: Date;
|
|
77
|
+
}): Promise<void>;
|
|
78
|
+
markTimedOut(taskId: string): Promise<void>;
|
|
79
|
+
markAutoAccepted(taskId: string): Promise<void>;
|
|
80
|
+
markCancelled(taskId: string): Promise<void>;
|
|
81
|
+
cancelPendingForRun(runId: string): Promise<void>;
|
|
59
82
|
}
|
|
83
|
+
declare const HumanTaskStoreToken: TypeToken<HumanTaskStore | undefined>;
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/contracts/hitlSeamTypes.d.ts
|
|
60
86
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
87
|
+
* Seam interfaces for HITL collaborators that are implemented in `@codemation/host`
|
|
88
|
+
* and injected into `NodeSuspensionHandler` at runtime. Core defines the interface only —
|
|
89
|
+
* no HTTP, vendor SDK, or Prisma dependencies here.
|
|
63
90
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
interface
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
create<TConfigItemJson = TInputJson>(config: DefinedNodeConfigInput<TConfig$1, TConfigItemJson>, name?: string, id?: string): RunnableNodeConfig<TInputJson, TOutputJson>;
|
|
80
|
-
register(context: {
|
|
81
|
-
registerNode<TValue>(token: TypeToken<TValue>, implementation?: TypeToken<TValue>): void;
|
|
82
|
-
}): void;
|
|
91
|
+
/** Signs and hashes a HITL resume token. Core only needs the sign and hash operations. */
|
|
92
|
+
interface HitlResumeTokenSignerSeam {
|
|
93
|
+
sign(args: {
|
|
94
|
+
taskId: string;
|
|
95
|
+
expiresAt: Date;
|
|
96
|
+
schemaHash: string;
|
|
97
|
+
}): string;
|
|
98
|
+
hashToken(token: string): string;
|
|
99
|
+
}
|
|
100
|
+
/** Schedules a delayed BullMQ job that drives the timeout path. */
|
|
101
|
+
interface HitlTimeoutJobSchedulerSeam {
|
|
102
|
+
enqueueTimeoutJob(args: {
|
|
103
|
+
taskId: string;
|
|
104
|
+
expiresAt: Date;
|
|
105
|
+
}): Promise<void>;
|
|
83
106
|
}
|
|
107
|
+
declare const HitlResumeTokenSignerToken: TypeToken<HitlResumeTokenSignerSeam | undefined>;
|
|
108
|
+
declare const HitlTimeoutJobSchedulerToken: TypeToken<HitlTimeoutJobSchedulerSeam | undefined>;
|
|
84
109
|
/**
|
|
85
|
-
*
|
|
110
|
+
* Optional workspace ID injected into NodeSuspensionHandler in managed mode (T7 security fix).
|
|
111
|
+
* Allows the handler to stamp the workspaceId on each HumanTaskRecord so HitlCallbackHandler
|
|
112
|
+
* can assert workspace identity independently of the HMAC middleware.
|
|
113
|
+
* Not registered in non-managed mode; NodeSuspensionHandler defaults to null.
|
|
86
114
|
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
readonly description?: string;
|
|
91
|
-
/**
|
|
92
|
-
* Canvas icon for this node (same contract as `NodeConfigBase.icon` on runnable configs).
|
|
93
|
-
* The Next host resolves Lucide (`lucide:…`), built-in SVGs (`builtin:…`), Simple Icons (`si:…`), and image URLs (`https:`, `data:`, `/…`).
|
|
94
|
-
*/
|
|
95
|
-
readonly icon?: string;
|
|
96
|
-
/** Default values / form hints for **static** node configuration (credentials, retry, IDs), not per-item payload. */
|
|
97
|
-
readonly input?: Readonly<Record<keyof TConfig$1 & string, unknown>>;
|
|
98
|
-
readonly configSchema?: z.ZodType<TConfig$1>;
|
|
99
|
-
readonly credentials?: TBindings;
|
|
100
|
-
/**
|
|
101
|
-
* Validates **`input`** (engine also accepts `inputSchema` on the node class).
|
|
102
|
-
*/
|
|
103
|
-
readonly inputSchema?: ZodType<TInputJson>;
|
|
104
|
-
/** Preserve inbound `item.binary` when `execute` returns plain JSON or item-shaped results without `binary`. */
|
|
105
|
-
readonly keepBinaries?: boolean;
|
|
106
|
-
/**
|
|
107
|
-
* Static configuration summary surfaced in the workflow inspector — see
|
|
108
|
-
* {@link import("../contracts/workflowTypes").NodeConfigBase.inspectorSummary}.
|
|
109
|
-
*
|
|
110
|
-
* Receives the static config; returns 2–6 short label/value pairs (or `undefined` to skip).
|
|
111
|
-
*/
|
|
112
|
-
readonly inspectorSummary?: (args: Readonly<{
|
|
113
|
-
config: TConfig$1;
|
|
114
|
-
}>) => ReadonlyArray<NodeInspectorSummaryRow> | undefined;
|
|
115
|
-
execute(args: DefineNodeExecuteArgs<TConfig$1, TInputJson>, context: DefinedNodeRunContext<TConfig$1, TBindings>): MaybePromise$2<TOutputJson>;
|
|
116
|
-
}
|
|
115
|
+
declare const HitlWorkspaceIdToken: TypeToken<string | undefined>;
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/contracts/inboxChannelTypes.d.ts
|
|
117
118
|
/**
|
|
118
|
-
*
|
|
119
|
+
* A single inbox delivery channel.
|
|
120
|
+
* Implementations: `LocalInboxChannel`, `ControlPlaneInboxChannel`.
|
|
119
121
|
*/
|
|
120
|
-
interface
|
|
121
|
-
readonly
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
122
|
+
interface InboxChannel {
|
|
123
|
+
readonly kind: "local" | "control-plane-inbox";
|
|
124
|
+
deliver(args: InboxDeliverArgs): Promise<InboxDelivery>;
|
|
125
|
+
updateOnDecision?(args: InboxOnDecisionArgs): Promise<void>;
|
|
126
|
+
updateOnTimeout?(args: InboxOnTimeoutArgs): Promise<void>;
|
|
127
|
+
}
|
|
128
|
+
type InboxDeliverArgs = Readonly<{
|
|
129
|
+
task: HumanTaskHandle;
|
|
130
|
+
subject: HumanTaskSubject;
|
|
131
|
+
priority: "low" | "normal" | "high";
|
|
132
|
+
item: Item;
|
|
133
|
+
/** Present in managed mode (from `PairingConfig.workspaceId`). */
|
|
134
|
+
workspaceId?: string;
|
|
135
|
+
}>;
|
|
136
|
+
type InboxDelivery = {
|
|
137
|
+
kind: "local";
|
|
138
|
+
inboxItemId: string;
|
|
139
|
+
} | {
|
|
140
|
+
kind: "cp";
|
|
141
|
+
inboxItemId: string;
|
|
142
|
+
workspaceId: string;
|
|
143
|
+
};
|
|
144
|
+
type InboxOnDecisionArgs = Readonly<{
|
|
145
|
+
delivery: InboxDelivery;
|
|
146
|
+
decision: {
|
|
147
|
+
approved: boolean;
|
|
148
|
+
note?: string;
|
|
149
|
+
};
|
|
150
|
+
actor: HumanTaskActor;
|
|
151
|
+
}>;
|
|
152
|
+
type InboxOnTimeoutArgs = Readonly<{
|
|
153
|
+
delivery: InboxDelivery;
|
|
154
|
+
policy: "halt" | "auto-accept";
|
|
155
|
+
}>;
|
|
156
|
+
/**
|
|
157
|
+
* Resolves the correct `InboxChannel` for the current deployment mode
|
|
158
|
+
* (local dev vs. managed/CP). Implemented in `@codemation/host`.
|
|
159
|
+
*/
|
|
160
|
+
interface InboxChannelResolverSeam {
|
|
161
|
+
resolve(): {
|
|
162
|
+
channel: InboxChannel;
|
|
163
|
+
workspaceId?: string;
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
declare const InboxChannelResolverToken: TypeToken<InboxChannelResolverSeam | undefined>;
|
|
167
|
+
declare const LocalInboxChannelToken: TypeToken<InboxChannel | undefined>;
|
|
168
|
+
declare const ControlPlaneInboxChannelToken: TypeToken<InboxChannel | undefined>;
|
|
135
169
|
//#endregion
|
|
136
170
|
//#region src/authoring/DefinedNodeRegistry.d.ts
|
|
137
171
|
declare class DefinedNodeRegistry {
|
|
@@ -264,12 +298,12 @@ type DefinePollingTriggerTestItemsContext<TConfig$1 extends TriggerNodeConfig<an
|
|
|
264
298
|
/**
|
|
265
299
|
* Options accepted by `definePollingTrigger`.
|
|
266
300
|
*/
|
|
267
|
-
interface DefinePollingTriggerOptions<TKey
|
|
301
|
+
interface DefinePollingTriggerOptions<TKey extends string, TConfig$1 extends CredentialJsonRecord, TItemJson, TState extends JsonValue | undefined, TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
|
|
268
302
|
/**
|
|
269
303
|
* Unique node-token-id-style key, e.g. `"msgraph-mail.on-new-mail"`.
|
|
270
304
|
* Used as the persisted runtime type name — must be stable across deployments.
|
|
271
305
|
*/
|
|
272
|
-
readonly key: TKey
|
|
306
|
+
readonly key: TKey;
|
|
273
307
|
readonly title: string;
|
|
274
308
|
readonly description?: string;
|
|
275
309
|
/** Canvas icon (same contract as `NodeConfigBase.icon`). */
|
|
@@ -324,9 +358,9 @@ interface DefinePollingTriggerOptions<TKey$1 extends string, TConfig$1 extends C
|
|
|
324
358
|
*
|
|
325
359
|
* `poll` is also directly callable for unit-testing — no runtime needed.
|
|
326
360
|
*/
|
|
327
|
-
interface DefinedPollingTrigger<TKey
|
|
361
|
+
interface DefinedPollingTrigger<TKey extends string, TConfig$1 extends CredentialJsonRecord, TItemJson, TState extends JsonValue | undefined, TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
|
|
328
362
|
readonly kind: "defined-polling-trigger";
|
|
329
|
-
readonly key: TKey
|
|
363
|
+
readonly key: TKey;
|
|
330
364
|
readonly title: string;
|
|
331
365
|
readonly description?: string;
|
|
332
366
|
/**
|
|
@@ -391,7 +425,7 @@ declare class DefinedPollingTriggerConfig<TConfig$1 extends CredentialJsonRecord
|
|
|
391
425
|
* });
|
|
392
426
|
* ```
|
|
393
427
|
*/
|
|
394
|
-
declare function definePollingTrigger<TKey
|
|
428
|
+
declare function definePollingTrigger<TKey extends string, TConfig$1 extends CredentialJsonRecord, TItemJson, TState extends JsonValue | undefined, TBindings extends DefinedNodeCredentialBindings | undefined = undefined>(options: DefinePollingTriggerOptions<TKey, TConfig$1, TItemJson, TState, TBindings>): DefinedPollingTrigger<TKey, TConfig$1, TItemJson, TState, TBindings>;
|
|
395
429
|
//#endregion
|
|
396
430
|
//#region src/events/ConnectionInvocationEventPublisher.d.ts
|
|
397
431
|
/**
|
|
@@ -570,8 +604,9 @@ declare class DefaultExecutionContextFactory implements ExecutionContextFactory
|
|
|
570
604
|
private readonly costTrackingFactory;
|
|
571
605
|
private readonly currentDate;
|
|
572
606
|
private readonly collections?;
|
|
607
|
+
private readonly nodeResolver?;
|
|
573
608
|
private readonly telemetryDecoratorFactory;
|
|
574
|
-
constructor(binaryStorage?: BinaryStorage, telemetryFactory?: ExecutionTelemetryFactory, costTrackingFactory?: CostTrackingTelemetryFactory, currentDate?: () => Date, collections?: CollectionsContext | undefined);
|
|
609
|
+
constructor(binaryStorage?: BinaryStorage, telemetryFactory?: ExecutionTelemetryFactory, costTrackingFactory?: CostTrackingTelemetryFactory, currentDate?: () => Date, collections?: CollectionsContext | undefined, nodeResolver?: NodeResolver | undefined);
|
|
575
610
|
create(args: {
|
|
576
611
|
runId: RunId;
|
|
577
612
|
workflowId: WorkflowId;
|
|
@@ -641,15 +676,71 @@ declare class NodeOutputNormalizer {
|
|
|
641
676
|
private applyOutput;
|
|
642
677
|
}
|
|
643
678
|
//#endregion
|
|
679
|
+
//#region src/execution/NodeSuspensionHandler.d.ts
|
|
680
|
+
/**
|
|
681
|
+
* Handles per-item `SuspensionRequest` catches in the engine's item execution loop.
|
|
682
|
+
*
|
|
683
|
+
* Responsibilities:
|
|
684
|
+
* 1. Generate a `taskId` (UUID v4).
|
|
685
|
+
* 2. Persist a `HumanTask` row via `HumanTaskStore.create`.
|
|
686
|
+
* 3. Sign a resume URL via `HitlResumeTokenSigner.sign`.
|
|
687
|
+
* 4. Enqueue a delayed BullMQ timeout job via `HitlTimeoutJobScheduler.enqueue`.
|
|
688
|
+
* 5. Build a `HumanTaskHandle` and call `deliver`.
|
|
689
|
+
* 6. Append a `PersistedSuspensionEntry` to the run state and flip status to `"suspended"`.
|
|
690
|
+
* 7. Persist via `WorkflowExecutionRepository.save`.
|
|
691
|
+
* 8. Throw `RunSuspendedError` so the caller can exit cleanly.
|
|
692
|
+
*
|
|
693
|
+
* If `deliver` throws, the error propagates up to `NodeExecutionRequestHandlerService`
|
|
694
|
+
* which routes it through `resumeFromNodeError` → run status becomes `"failed"`.
|
|
695
|
+
*
|
|
696
|
+
* `humanTaskStore`, `tokenSigner`, and `timeoutScheduler` are optional —
|
|
697
|
+
* when not registered (e.g. in unit tests), the handler still suspends the run but
|
|
698
|
+
* skips persistence, token signing, and job scheduling.
|
|
699
|
+
*/
|
|
700
|
+
declare class NodeSuspensionHandler {
|
|
701
|
+
private readonly workflowExecutionRepository;
|
|
702
|
+
private readonly humanTaskStore?;
|
|
703
|
+
private readonly tokenSigner?;
|
|
704
|
+
private readonly timeoutScheduler?;
|
|
705
|
+
/** Workspace ID to stamp on HumanTaskRecord in managed mode (T7 security fix). Null in non-managed mode. */
|
|
706
|
+
private readonly workspaceId?;
|
|
707
|
+
constructor(workflowExecutionRepository: WorkflowExecutionRepository, humanTaskStore?: HumanTaskStore | undefined, tokenSigner?: HitlResumeTokenSignerSeam | undefined, timeoutScheduler?: HitlTimeoutJobSchedulerSeam | undefined, /** Workspace ID to stamp on HumanTaskRecord in managed mode (T7 security fix). Null in non-managed mode. */
|
|
708
|
+
workspaceId?: string | undefined);
|
|
709
|
+
handle(args: {
|
|
710
|
+
runId: RunId;
|
|
711
|
+
nodeId: NodeId;
|
|
712
|
+
activationId: NodeActivationId;
|
|
713
|
+
itemIndex: number;
|
|
714
|
+
suspensionRequest: SuspensionRequest;
|
|
715
|
+
state: PersistedRunState;
|
|
716
|
+
/** Telemetry scope of the node's per-item span. Used to emit `hitl.task.*` span events. */
|
|
717
|
+
telemetry?: TelemetryScope;
|
|
718
|
+
}): Promise<never>;
|
|
719
|
+
/**
|
|
720
|
+
* Parse a duration string into milliseconds.
|
|
721
|
+
* Accepts ISO 8601 durations ("PT24H", "PT30M") and shorthand ("24h", "30m", "1d").
|
|
722
|
+
* Throws for unrecognised formats.
|
|
723
|
+
*/
|
|
724
|
+
private parseDurationMs;
|
|
725
|
+
private hashSchema;
|
|
726
|
+
private schemaToJson;
|
|
727
|
+
}
|
|
728
|
+
//#endregion
|
|
644
729
|
//#region src/execution/NodeExecutor.d.ts
|
|
645
730
|
declare class NodeExecutor {
|
|
646
731
|
private readonly nodeInstanceFactory;
|
|
647
732
|
private readonly retryRunner;
|
|
733
|
+
/** Required for HITL suspension support. When omitted, `SuspensionRequest` throws upward. */
|
|
734
|
+
private readonly suspensionHandler?;
|
|
735
|
+
/** Required alongside `suspensionHandler`. */
|
|
736
|
+
private readonly loadRunState?;
|
|
648
737
|
private readonly fanInMerger;
|
|
649
738
|
private readonly outputNormalizer;
|
|
650
739
|
private readonly itemExprResolver;
|
|
651
740
|
private readonly outputBehaviorResolver;
|
|
652
|
-
constructor(nodeInstanceFactory: WorkflowNodeInstanceFactory, retryRunner: InProcessRetryRunner, itemExprResolver?: ItemExprResolver, outputBehaviorResolver?: RunnableOutputBehaviorResolver
|
|
741
|
+
constructor(nodeInstanceFactory: WorkflowNodeInstanceFactory, retryRunner: InProcessRetryRunner, itemExprResolver?: ItemExprResolver, outputBehaviorResolver?: RunnableOutputBehaviorResolver, /** Required for HITL suspension support. When omitted, `SuspensionRequest` throws upward. */
|
|
742
|
+
suspensionHandler?: NodeSuspensionHandler | undefined, /** Required alongside `suspensionHandler`. */
|
|
743
|
+
loadRunState?: ((runId: RunId) => Promise<PersistedRunState | undefined>) | undefined);
|
|
653
744
|
execute(request: NodeActivationRequest): Promise<NodeOutputs>;
|
|
654
745
|
private assertRequiredCredentialsBound;
|
|
655
746
|
private isCredentialError;
|
|
@@ -968,6 +1059,91 @@ interface OAuthFlowExecutor {
|
|
|
968
1059
|
}): Promise<OAuthMaterial>;
|
|
969
1060
|
}
|
|
970
1061
|
//#endregion
|
|
1062
|
+
//#region src/credentials/CredentialMaterialProvider.types.d.ts
|
|
1063
|
+
/**
|
|
1064
|
+
* Material provider seam — see `docs/design/credentials-oauth-unification.md`,
|
|
1065
|
+
* "Material provider seam" section. Sits beside the workspace's
|
|
1066
|
+
* `CredentialStore`; persistence of the row stays at the store, persistence of
|
|
1067
|
+
* the bytes goes through this provider so they can live at the control plane
|
|
1068
|
+
* in managed mode.
|
|
1069
|
+
*/
|
|
1070
|
+
/**
|
|
1071
|
+
* Pointer to material bytes. For local rows `ref` is the workspace instance id
|
|
1072
|
+
* and the bytes co-locate with the row (existing `CredentialOAuth2Material` /
|
|
1073
|
+
* `CredentialSecretMaterial` tables). For control-plane rows `ref` is the
|
|
1074
|
+
* CP-side credential id; the workspace stores only the pointer.
|
|
1075
|
+
*/
|
|
1076
|
+
type CredentialMaterialRef = Readonly<{
|
|
1077
|
+
source: "local" | "control-plane";
|
|
1078
|
+
id: string;
|
|
1079
|
+
}>;
|
|
1080
|
+
/**
|
|
1081
|
+
* Decrypted material bytes returned by a provider. Shape matches
|
|
1082
|
+
* `OAuthMaterial` — every supported credential type today is OAuth-shaped.
|
|
1083
|
+
*/
|
|
1084
|
+
type MaterialBundle = OAuthMaterial;
|
|
1085
|
+
/**
|
|
1086
|
+
* Caller context recorded by the CP material endpoint per fetch (D5 in the
|
|
1087
|
+
* `credentials-vault` sprint README). The local provider accepts but ignores
|
|
1088
|
+
* it; standalone mode has no audit log.
|
|
1089
|
+
*/
|
|
1090
|
+
type CallerContext = Readonly<{
|
|
1091
|
+
workspaceId: string;
|
|
1092
|
+
caller: Readonly<{
|
|
1093
|
+
kind: "workflow-node";
|
|
1094
|
+
workflowId: string;
|
|
1095
|
+
nodeId: string;
|
|
1096
|
+
}> | Readonly<{
|
|
1097
|
+
kind: "concierge";
|
|
1098
|
+
chatId: string;
|
|
1099
|
+
}> | Readonly<{
|
|
1100
|
+
kind: "research-agent";
|
|
1101
|
+
chatId: string;
|
|
1102
|
+
}> | Readonly<{
|
|
1103
|
+
kind: "manual";
|
|
1104
|
+
userId: string;
|
|
1105
|
+
}>;
|
|
1106
|
+
reason?: string;
|
|
1107
|
+
}>;
|
|
1108
|
+
interface CredentialMaterialProvider {
|
|
1109
|
+
getMaterial(ref: CredentialMaterialRef, context: CallerContext): Promise<MaterialBundle>;
|
|
1110
|
+
setMaterial(ref: CredentialMaterialRef, material: MaterialBundle): Promise<void>;
|
|
1111
|
+
}
|
|
1112
|
+
/**
|
|
1113
|
+
* Thrown by a provider when asked to operate on a `ref.source` it does not
|
|
1114
|
+
* handle (e.g. the local provider being asked to read `control-plane` bytes).
|
|
1115
|
+
* Exported so `instanceof`-checks work across the workspace boundary.
|
|
1116
|
+
*/
|
|
1117
|
+
declare class IllegalMaterialSourceError extends Error {
|
|
1118
|
+
readonly source: CredentialMaterialRef["source"];
|
|
1119
|
+
readonly providerName: string;
|
|
1120
|
+
constructor(source: CredentialMaterialRef["source"], providerName: string);
|
|
1121
|
+
}
|
|
1122
|
+
//#endregion
|
|
1123
|
+
//#region src/credentials/ManagedCredentialMaterialWriteError.d.ts
|
|
1124
|
+
/**
|
|
1125
|
+
* Thrown by managed-mode providers when `setMaterial` is called. Managed
|
|
1126
|
+
* credential bytes are owned by the control plane; the workspace must not
|
|
1127
|
+
* mutate them. See `docs/design/credentials-oauth-unification.md` and
|
|
1128
|
+
* `planning/sprints/credentials-vault/02-controlplane-material-provider.md`.
|
|
1129
|
+
*/
|
|
1130
|
+
declare class ManagedCredentialMaterialWriteError extends Error {
|
|
1131
|
+
constructor(message?: string);
|
|
1132
|
+
}
|
|
1133
|
+
//#endregion
|
|
1134
|
+
//#region src/credentials/ManagedMaterialFetchError.d.ts
|
|
1135
|
+
/**
|
|
1136
|
+
* Thrown by `ControlPlaneCredentialMaterialProvider` when the control-plane
|
|
1137
|
+
* material endpoint returns a non-2xx response or a malformed body. Exposes
|
|
1138
|
+
* the HTTP status and the raw error body so call sites can surface actionable
|
|
1139
|
+
* detail without parsing strings.
|
|
1140
|
+
*/
|
|
1141
|
+
declare class ManagedMaterialFetchError extends Error {
|
|
1142
|
+
readonly status: number;
|
|
1143
|
+
readonly providerErrorBody: string;
|
|
1144
|
+
constructor(status: number, providerErrorBody: string, message?: string);
|
|
1145
|
+
}
|
|
1146
|
+
//#endregion
|
|
971
1147
|
//#region src/orchestration/TestSuiteRunIdFactory.d.ts
|
|
972
1148
|
/**
|
|
973
1149
|
* Mints unique TestSuiteRun identifiers. Separated from {@link import("../types").RunIdFactory}
|
|
@@ -985,7 +1161,7 @@ declare class TestSuiteRunIdFactory {
|
|
|
985
1161
|
interface TestSuiteOrchestratorEngine {
|
|
986
1162
|
runWorkflow(wf: WorkflowDefinition, startAt: NodeId, items: Items, parent?: ParentExecutionRef, executionOptions?: RunExecutionOptions): Promise<RunResult>;
|
|
987
1163
|
waitForCompletion(runId: RunId): Promise<Extract<RunResult, {
|
|
988
|
-
status: "completed" | "failed";
|
|
1164
|
+
status: "completed" | "failed" | "halted";
|
|
989
1165
|
}>>;
|
|
990
1166
|
}
|
|
991
1167
|
interface TestSuiteCaseOutcome {
|
|
@@ -1036,5 +1212,5 @@ declare class TestSuiteOrchestrator {
|
|
|
1036
1212
|
private publish;
|
|
1037
1213
|
}
|
|
1038
1214
|
//#endregion
|
|
1039
|
-
export {
|
|
1040
|
-
//# sourceMappingURL=index-
|
|
1215
|
+
export { getPersistedRuntimeTypeMetadata as $, NodeEventPublisher as $t, InMemoryWorkflowExecutionRepository as A, DefineCredentialOptions as At, NodeExecutor as B, InboxOnTimeoutArgs as Bt, PollingRunCycleResult as C, CollectionFieldDefinition as Ct, EngineCompositionDeps as D, c as Dt, WorkflowRepositoryWebhookTriggerMatcher as E, DefinedCollection as Et, DefaultDrivingScheduler as F, InboxChannelResolverSeam as Ft, CatalogBackedCostTrackingTelemetryFactory as G, HitlTimeoutJobSchedulerToken as Gt, RunnableOutputBehaviorResolver as H, HitlResumeTokenSignerSeam as Ht, InlineDrivingScheduler as I, InboxChannelResolverToken as It, AsyncSleeper as J, HumanTaskStatus as Jt, DefaultExecutionContextFactory as K, HitlWorkspaceIdToken as Kt, ConfigDrivenOffloadPolicy as L, InboxDeliverArgs as Lt, InMemoryBinaryStorage as M, DefinedNodeRegistry as Mt, LocalOnlyScheduler as N, ControlPlaneInboxChannelToken as Nt, EngineFactory as O, defineCollection as Ot, HintOnlyOffloadPolicy as P, InboxChannel as Pt, chatModel as Q, SystemClock as Qt, StaticCostCatalog as R, InboxDelivery as Rt, PollingRunCycleArgs as S, CollectionDefinition as St, PollingTriggerStartArgs as T, DefineCollectionOptions as Tt, ItemExprResolver as U, HitlResumeTokenSignerToken as Ut, NodeOutputNormalizer as V, LocalInboxChannelToken as Vt, InProcessRetryRunner as W, HitlTimeoutJobSchedulerSeam as Wt, DefaultExecutionBinaryService as X, HumanTaskStoreToken as Xt, ChildExecutionScopeFactory as Y, HumanTaskStore as Yt, UnavailableBinaryStorage as Z, Clock as Zt, OAuthFlowStartResult as _, DefinedPollingTrigger as _t, TestSuiteRunResult as a, InjectableRuntimeDecoratorComposer as at, WorkflowEdgePortError as b, DefinedCollectionRegistry as bt, ManagedCredentialMaterialWriteError as c, PersistedRuntimeTypeMetadata as ct, CredentialMaterialRef as d, ConnectionInvocationEventPublisher as dt, CredentialResolverFactory as en, node as et, IllegalMaterialSourceError as f, DefinePollingTriggerExecuteContext as ft, OAuthFlowStartArgs as g, DefinePollingTriggerTestItemsContext as gt, OAuthFlowExecutor as h, DefinePollingTriggerPollResult as ht, TestSuiteOrchestratorEngine as i, PersistedRuntimeTypeMetadataStore as it, InMemoryRunDataFactory as j, defineCredential as jt, RunSummaryMapper as k, callableTool as kt, CallerContext as l, EventPublishingWorkflowExecutionRepository as lt, OAuthFlowCallbackArgs as m, DefinePollingTriggerPollContext as mt, TestSuiteCaseOutcome as n, StackTraceCallSitePathResolver as nt, TestSuiteRunIdFactory as o, PersistedRuntimeTypeDecoratorOptions as ot, MaterialBundle as p, DefinePollingTriggerOptions as pt, DefaultAsyncSleeper as q, HumanTaskRecord as qt, TestSuiteOrchestrator as r, PersistedRuntimeTypeNameResolver as rt, ManagedMaterialFetchError as s, PersistedRuntimeTypeKind as st, RunTestSuiteArgs as t, AbortControllerFactory as tn, tool as tt, CredentialMaterialProvider as u, InMemoryRunEventBus as ut, OAuthMaterial as v, DefinedPollingTriggerConfig as vt, PollingTriggerRuntime as w, CollectionIndexDefinition as wt, WorkflowEdgePortValidationResult as x, CollectionColumnBuilder as xt, WorkflowEdgePortValidator as y, definePollingTrigger as yt, NodeInstanceFactory as z, InboxOnDecisionArgs as zt };
|
|
1216
|
+
//# sourceMappingURL=index-BZDhEQ6W.d.ts.map
|