@codemation/core 0.11.0 → 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.
Files changed (101) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/CostCatalogContract-DD7fQ4FF.d.cts +19 -0
  3. package/dist/{EngineRuntimeRegistration.types-MPYWsEM0.d.cts → EngineRuntimeRegistration.types-DTV5_7Jw.d.cts} +3 -2
  4. package/dist/{EngineRuntimeRegistration.types-BZ_1XWAJ.d.ts → EngineRuntimeRegistration.types-Dl92Hdoi.d.ts} +2 -2
  5. package/dist/InMemoryRunDataFactory-qMiYjhCK.d.cts +202 -0
  6. package/dist/{InMemoryRunEventBusRegistry-sM4z4n_i.js → InMemoryRunEventBusRegistry-Bwunvt1T.js} +1 -1
  7. package/dist/{InMemoryRunEventBusRegistry-sM4z4n_i.js.map → InMemoryRunEventBusRegistry-Bwunvt1T.js.map} +1 -1
  8. package/dist/{InMemoryRunEventBusRegistry-VM3OWnHo.cjs → InMemoryRunEventBusRegistry-Sa86VxuV.cjs} +1 -1
  9. package/dist/{InMemoryRunEventBusRegistry-VM3OWnHo.cjs.map → InMemoryRunEventBusRegistry-Sa86VxuV.cjs.map} +1 -1
  10. package/dist/ItemsInputNormalizer-BhuxvZh5.js +36 -0
  11. package/dist/ItemsInputNormalizer-BhuxvZh5.js.map +1 -0
  12. package/dist/ItemsInputNormalizer-C09a7iFP.d.ts +321 -0
  13. package/dist/ItemsInputNormalizer-DLaD6rTl.d.cts +407 -0
  14. package/dist/ItemsInputNormalizer-Div-fb6a.cjs +43 -0
  15. package/dist/ItemsInputNormalizer-Div-fb6a.cjs.map +1 -0
  16. package/dist/RunIntentService-BOSGwmqn.d.ts +299 -0
  17. package/dist/RunIntentService-CWMMrAP4.d.cts +220 -0
  18. package/dist/{RunIntentService-MUHJ1bhO.d.cts → agentMcpTypes-DUmniLOY.d.cts} +183 -206
  19. package/dist/bootstrap/index.cjs +4 -2
  20. package/dist/bootstrap/index.d.cts +63 -5
  21. package/dist/bootstrap/index.d.ts +5 -4
  22. package/dist/bootstrap/index.js +4 -2
  23. package/dist/{bootstrap-Dgzsjoj7.js → bootstrap-CKTMMNmL.js} +174 -3
  24. package/dist/bootstrap-CKTMMNmL.js.map +1 -0
  25. package/dist/{bootstrap-dVmpU1ju.cjs → bootstrap-D460dCgS.cjs} +209 -36
  26. package/dist/bootstrap-D460dCgS.cjs.map +1 -0
  27. package/dist/browser.cjs +17 -0
  28. package/dist/browser.d.cts +4 -0
  29. package/dist/browser.d.ts +3 -0
  30. package/dist/browser.js +4 -0
  31. package/dist/contracts-CK0x6w_G.cjs +74 -0
  32. package/dist/contracts-CK0x6w_G.cjs.map +1 -0
  33. package/dist/contracts-DXdfTdpW.js +50 -0
  34. package/dist/contracts-DXdfTdpW.js.map +1 -0
  35. package/dist/contracts.cjs +6 -0
  36. package/dist/contracts.d.cts +5 -0
  37. package/dist/contracts.d.ts +2 -0
  38. package/dist/contracts.js +3 -0
  39. package/dist/di-DdsgWfVy.js +405 -0
  40. package/dist/di-DdsgWfVy.js.map +1 -0
  41. package/dist/di-tO6R7VJV.cjs +524 -0
  42. package/dist/di-tO6R7VJV.cjs.map +1 -0
  43. package/dist/executionPersistenceContracts-DenJJK2T.d.cts +275 -0
  44. package/dist/{index-Bes88mxT.d.ts → index-BZDhEQ6W.d.ts} +278 -415
  45. package/dist/{RunIntentService-BrEq6Jm6.d.ts → index-CSKKuK60.d.ts} +441 -286
  46. package/dist/index.cjs +97 -250
  47. package/dist/index.cjs.map +1 -1
  48. package/dist/index.d.cts +395 -803
  49. package/dist/index.d.ts +5 -3
  50. package/dist/index.js +58 -224
  51. package/dist/index.js.map +1 -1
  52. package/dist/params-DqRvku2h.d.cts +44 -0
  53. package/dist/{runtime-Duf3ClPw.js → runtime-BPZgnZ9G.js} +591 -382
  54. package/dist/runtime-BPZgnZ9G.js.map +1 -0
  55. package/dist/{runtime-vH0EeZzH.cjs → runtime-CyW9c9XM.cjs} +651 -500
  56. package/dist/runtime-CyW9c9XM.cjs.map +1 -0
  57. package/dist/testing.cjs +23 -21
  58. package/dist/testing.cjs.map +1 -1
  59. package/dist/testing.d.cts +3 -2
  60. package/dist/testing.d.ts +3 -2
  61. package/dist/testing.js +5 -3
  62. package/dist/testing.js.map +1 -1
  63. package/package.json +9 -5
  64. package/src/ai/AgentConnectionNodeCollector.ts +1 -1
  65. package/src/authoring/defineHumanApprovalNode.types.ts +379 -0
  66. package/src/authoring/index.ts +6 -0
  67. package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +29 -0
  68. package/src/contracts/CodemationTelemetryAttributeNames.ts +10 -0
  69. package/src/contracts/credentialTypes.ts +10 -0
  70. package/src/contracts/hitlSeamTypes.ts +34 -0
  71. package/src/contracts/humanTaskStoreTypes.ts +48 -0
  72. package/src/contracts/inboxChannelTypes.ts +58 -0
  73. package/src/contracts/index.ts +3 -0
  74. package/src/contracts/runTypes.ts +61 -3
  75. package/src/contracts/runtimeTypes.ts +112 -0
  76. package/src/credentials/CredentialMaterialProvider.types.ts +61 -0
  77. package/src/credentials/ManagedCredentialMaterialWriteError.ts +14 -0
  78. package/src/credentials/ManagedMaterialFetchError.ts +16 -0
  79. package/src/execution/ActivationEnqueueService.ts +16 -0
  80. package/src/execution/DefaultExecutionContextFactory.ts +11 -0
  81. package/src/execution/NodeExecutionSnapshotFactory.ts +7 -1
  82. package/src/execution/NodeExecutor.ts +60 -1
  83. package/src/execution/NodeExecutorFactory.ts +12 -2
  84. package/src/execution/NodeSuspensionHandler.ts +220 -0
  85. package/src/execution/PersistedRunStateTerminalBuilder.ts +5 -2
  86. package/src/execution/RunStateSemantics.ts +5 -0
  87. package/src/execution/RunSuspendedError.ts +21 -0
  88. package/src/index.ts +40 -0
  89. package/src/orchestration/Engine.ts +12 -2
  90. package/src/orchestration/EngineWaiters.ts +1 -1
  91. package/src/orchestration/NodeExecutionRequestHandlerService.ts +25 -2
  92. package/src/orchestration/RunContinuationService.ts +226 -2
  93. package/src/orchestration/TestSuiteOrchestrator.ts +5 -4
  94. package/src/runtime/RunIntentService.ts +3 -0
  95. package/src/workflow/dsl/ChainCursorResolver.ts +36 -0
  96. package/tsdown.config.ts +1 -1
  97. package/dist/InMemoryRunDataFactory-hmkh0lzR.d.cts +0 -138
  98. package/dist/bootstrap-Dgzsjoj7.js.map +0 -1
  99. package/dist/bootstrap-dVmpU1ju.cjs.map +0 -1
  100. package/dist/runtime-Duf3ClPw.js.map +0 -1
  101. package/dist/runtime-vH0EeZzH.cjs.map +0 -1
@@ -1,5 +1,7 @@
1
- import { $a as CredentialTypeDefinition, $i as WebhookTriggerRoutingDiagnostics, Ai as PreparedNodeActivationDispatch, Ar as WorkflowDefinition, Bi as TriggerTestItemsContext, Cr as RunnableNodeConfig, Da as CostTrackingTelemetryFactory, Di as NodeResolver, Er as TriggerNodeConfig, Fn as RunEventBus, Ft as EngineRunCounters, Gn as Edge, Gt as PersistedRunSchedulingState, Hi as WorkflowRepository, Hn as ActivationIdFactory, In as RunEventSubscription, Ji as TriggerInstanceId, Jt as PersistedWorkflowSnapshotNode, Kn as ExecutionMode, Kt as PersistedRunState, La as CredentialFieldSchema, Ln as TestCaseRunStatus, Ma as AnyCredentialType, Mn as EngineExecutionLimitsPolicy, Mt as ConnectionInvocationId, Nt as ConnectionInvocationRecord, Pn as RunEvent, Qa as CredentialType, Qr as RetryPolicySpec, Ra as CredentialHealth, Rn as TestSuiteRunStatus, Rt as NodeExecutionSnapshot, Si as NodeExecutionRequest, Ta as CostTrackingTelemetry, Ti as NodeExecutionStatePublisher, Ua as CredentialJsonRecord, Un as BinaryAttachment, V as McpServerDeclaration, Vi as WorkflowNodeInstanceFactory, Xa as CredentialSessionService, Xi as WebhookInvocationMatch, Ya as CredentialSessionFactoryArgs, Yn as Items, Zi as WebhookTriggerMatcher, _i as NodeActivationRequest, _r as ParentExecutionRef, ai as BinaryStorageWriteResult, ao as PollingTriggerLogger, bi as NodeBinaryAttachmentService, br as RunDataSnapshot, cn as RunTestContext, co as NodeConnectionName, ct as CostCatalog, di as ExecutionContextFactory, dn as WorkflowExecutionPruneRepository, ei as BinaryBody, en as RunExecutionOptions, eo as CredentialTypeId, er as JsonValue, fn as WorkflowExecutionRepository, fo as WorkflowId, fr as NodeOffloadPolicy, ft as ParamDeep, hi as NodeActivationContinuation, hr as NodeSchedulerDecision, i as WorkflowSnapshotCodec, ir as NodeDefinition, ja as CollectionsContext, ka as CostTrackingUsageRecord, li as ExecutionBinaryService, lo as NodeId, lr as NodeInspectorSummaryRow, lt as CostCatalogEntry, ma as TelemetrySpanScope, na as ExecutionTelemetry, ni as BinaryStorageReadResult, nr as NodeActivationId, oi as EngineDeps, pr as NodeOutputs, qa as CredentialRequirement, qi as HttpMethod, qn as Item, ra as ExecutionTelemetryFactory, ri as BinaryStorageStatResult, rn as RunResult, rr as NodeConfigBase, sn as RunSummary, ta as WorkflowActivationPolicy, ti as BinaryStorage, tn as RunPruneCandidate, tr as MutableRunData, u as Engine, ui as ExecutionContext, un as WorkflowExecutionListingRepository, uo as OutputPortKey, ut as Expr, vr as PersistedRunPolicySnapshot, wi as NodeExecutionScheduler, wr as RunnableNodeInputJson, xi as NodeExecutionContext, xr as RunId, yi as NodeActivationScheduler, yn as TypeToken, yr as RunDataFactory, zi as TriggerSetupStateRepository, zn as TestSuiteRunId } from "./RunIntentService-BrEq6Jm6.js";
2
- import { ZodType, input, output, z } from "zod";
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
+ import { ZodType, z } from "zod";
3
5
 
4
6
  //#region src/orchestration/AbortControllerFactory.d.ts
5
7
  /**
@@ -34,102 +36,136 @@ declare class SystemClock implements Clock {
34
36
  now(): Date;
35
37
  }
36
38
  //#endregion
37
- //#region src/authoring/defineNode.types.d.ts
38
- type MaybePromise$2<TValue> = TValue | Promise<TValue>;
39
- type ResolvableCredentialType = AnyCredentialType | CredentialTypeId;
40
- type SessionForCredentialType<TCredential extends ResolvableCredentialType> = TCredential extends AnyCredentialType ? Awaited<ReturnType<TCredential["createSession"]>> : unknown;
41
- type DefinedNodeCredentialBinding = ResolvableCredentialType | Readonly<{
42
- readonly type: ResolvableCredentialType | ReadonlyArray<ResolvableCredentialType>;
43
- readonly label?: string;
44
- readonly optional?: true;
45
- readonly helpText?: string;
46
- readonly helpUrl?: string;
47
- }>;
48
- type DefinedNodeCredentialBindings = Readonly<Record<string, DefinedNodeCredentialBinding>>;
49
- type SessionForBinding<TBinding extends DefinedNodeCredentialBinding> = TBinding extends Readonly<{
50
- type: infer TType;
51
- }> ? TType extends ReadonlyArray<infer TEntry> ? SessionForCredentialType<TEntry & ResolvableCredentialType> : SessionForCredentialType<TType & ResolvableCredentialType> : SessionForCredentialType<TBinding & ResolvableCredentialType>;
52
- type DefinedNodeCredentialAccessors<TBindings extends DefinedNodeCredentialBindings | undefined> = TBindings extends DefinedNodeCredentialBindings ? Readonly<{ [TKey in keyof TBindings]: () => Promise<SessionForBinding<TBindings[TKey]>> }> : Readonly<Record<string, never>>;
53
- interface DefinedNodeRunContext<TConfig$1 extends CredentialJsonRecord, TBindings extends DefinedNodeCredentialBindings | undefined> {
54
- readonly config: TConfig$1;
55
- readonly credentials: DefinedNodeCredentialAccessors<TBindings>;
56
- readonly execution: NodeExecutionContext<RunnableNodeConfig<TConfig$1, unknown>>;
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>;
57
82
  }
83
+ declare const HumanTaskStoreToken: TypeToken<HumanTaskStore | undefined>;
84
+ //#endregion
85
+ //#region src/contracts/hitlSeamTypes.d.ts
58
86
  /**
59
- * Arguments for {@link defineNode} `execute` (engine `ctx` matches {@link RunnableNode.execute};
60
- * the second callback parameter adds {@link DefinedNodeRunContext} for credential accessors).
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.
61
90
  */
62
- type DefineNodeExecuteArgs<TConfig$1 extends CredentialJsonRecord, TInputJson> = Readonly<{
63
- input: TInputJson;
64
- item: Item;
65
- itemIndex: number;
66
- items: Items;
67
- ctx: NodeExecutionContext<RunnableNodeConfig<TInputJson, unknown> & Readonly<{
68
- config: TConfig$1;
69
- }>>;
70
- }>;
71
- type DefinedNodeConfigInput<TConfigResolved extends CredentialJsonRecord, TItemJson> = ParamDeep<TConfigResolved, TItemJson>;
72
- interface DefinedNode<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TInputJson, TOutputJson, _TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
73
- readonly kind: "defined-node";
74
- readonly key: TKey$1;
75
- readonly title: string;
76
- readonly description?: string;
77
- create<TConfigItemJson = TInputJson>(config: DefinedNodeConfigInput<TConfig$1, TConfigItemJson>, name?: string, id?: string): RunnableNodeConfig<TInputJson, TOutputJson>;
78
- register(context: {
79
- registerNode<TValue>(token: TypeToken<TValue>, implementation?: TypeToken<TValue>): void;
80
- }): 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>;
81
106
  }
107
+ declare const HitlResumeTokenSignerToken: TypeToken<HitlResumeTokenSignerSeam | undefined>;
108
+ declare const HitlTimeoutJobSchedulerToken: TypeToken<HitlTimeoutJobSchedulerSeam | undefined>;
82
109
  /**
83
- * Plugin / DSL-friendly node: per-item `execute` with optional {@link RunnableNodeConfig.inputSchema}.
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.
84
114
  */
85
- interface DefineNodeOptions<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TInputJson, TOutputJson, TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
86
- readonly key: TKey$1;
87
- readonly title: string;
88
- readonly description?: string;
89
- /**
90
- * Canvas icon for this node (same contract as `NodeConfigBase.icon` on runnable configs).
91
- * The Next host resolves Lucide (`lucide:…`), built-in SVGs (`builtin:…`), Simple Icons (`si:…`), and image URLs (`https:`, `data:`, `/…`).
92
- */
93
- readonly icon?: string;
94
- /** Default values / form hints for **static** node configuration (credentials, retry, IDs), not per-item payload. */
95
- readonly input?: Readonly<Record<keyof TConfig$1 & string, unknown>>;
96
- readonly configSchema?: z.ZodType<TConfig$1>;
97
- readonly credentials?: TBindings;
98
- /**
99
- * Validates **`input`** (engine also accepts `inputSchema` on the node class).
100
- */
101
- readonly inputSchema?: ZodType<TInputJson>;
102
- /** Preserve inbound `item.binary` when `execute` returns plain JSON or item-shaped results without `binary`. */
103
- readonly keepBinaries?: boolean;
104
- /**
105
- * Static configuration summary surfaced in the workflow inspector — see
106
- * {@link import("../contracts/workflowTypes").NodeConfigBase.inspectorSummary}.
107
- *
108
- * Receives the static config; returns 2–6 short label/value pairs (or `undefined` to skip).
109
- */
110
- readonly inspectorSummary?: (args: Readonly<{
111
- config: TConfig$1;
112
- }>) => ReadonlyArray<NodeInspectorSummaryRow> | undefined;
113
- execute(args: DefineNodeExecuteArgs<TConfig$1, TInputJson>, context: DefinedNodeRunContext<TConfig$1, TBindings>): MaybePromise$2<TOutputJson>;
114
- }
115
+ declare const HitlWorkspaceIdToken: TypeToken<string | undefined>;
116
+ //#endregion
117
+ //#region src/contracts/inboxChannelTypes.d.ts
115
118
  /**
116
- * Batch-oriented defined node: `run` receives all item JSON once (last item in activation); emits one output per input row.
119
+ * A single inbox delivery channel.
120
+ * Implementations: `LocalInboxChannel`, `ControlPlaneInboxChannel`.
117
121
  */
118
- interface DefineBatchNodeOptions<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TInputJson, TOutputJson, TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
119
- readonly key: TKey$1;
120
- readonly title: string;
121
- readonly description?: string;
122
- readonly icon?: string;
123
- readonly input?: Readonly<Record<keyof TConfig$1 & string, unknown>>;
124
- readonly configSchema?: z.ZodType<TConfig$1>;
125
- readonly credentials?: TBindings;
126
- readonly inspectorSummary?: (args: Readonly<{
127
- config: TConfig$1;
128
- }>) => ReadonlyArray<NodeInspectorSummaryRow> | undefined;
129
- run(items: ReadonlyArray<TInputJson>, context: DefinedNodeRunContext<TConfig$1, TBindings>): MaybePromise$2<ReadonlyArray<TOutputJson>>;
130
- }
131
- declare function defineNode<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TInputJson, TOutputJson, TBindings extends DefinedNodeCredentialBindings | undefined = undefined>(options: DefineNodeOptions<TKey$1, TConfig$1, TInputJson, TOutputJson, TBindings>): DefinedNode<TKey$1, TConfig$1, TInputJson, TOutputJson, TBindings>;
132
- declare function defineBatchNode<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TInputJson, TOutputJson, TBindings extends DefinedNodeCredentialBindings | undefined = undefined>(options: DefineBatchNodeOptions<TKey$1, TConfig$1, TInputJson, TOutputJson, TBindings>): DefinedNode<TKey$1, TConfig$1, TInputJson, TOutputJson, TBindings>;
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>;
133
169
  //#endregion
134
170
  //#region src/authoring/DefinedNodeRegistry.d.ts
135
171
  declare class DefinedNodeRegistry {
@@ -159,288 +195,6 @@ declare function defineCredential<TPublicSource extends CredentialFieldMap<any>
159
195
  readonly key: string;
160
196
  };
161
197
  //#endregion
162
- //#region src/ai/NodeBackedToolConfig.d.ts
163
- declare class NodeBackedToolConfig<TNodeConfig extends RunnableNodeConfig<any, any>, TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny> implements ToolConfig {
164
- readonly name: string;
165
- readonly node: TNodeConfig;
166
- readonly type: TypeToken<unknown>;
167
- readonly toolKind: "nodeBacked";
168
- readonly description?: string;
169
- readonly presentation?: AgentCanvasPresentation;
170
- private readonly inputSchemaValue;
171
- private readonly outputSchemaValue;
172
- private readonly mapInputValue?;
173
- private readonly mapOutputValue?;
174
- constructor(name: string, node: TNodeConfig, options: NodeBackedToolConfigOptions<TNodeConfig, TInputSchema, TOutputSchema>);
175
- getCredentialRequirements(): ReadonlyArray<CredentialRequirement>;
176
- getInputSchema(): TInputSchema;
177
- getOutputSchema(): TOutputSchema;
178
- toNodeItem(args: NodeBackedToolInputMapperArgs<TNodeConfig, input<TInputSchema>>): Item<RunnableNodeInputJson<TNodeConfig>>;
179
- toToolOutput(args: NodeBackedToolOutputMapperArgs<TNodeConfig, input<TInputSchema>>): output<TOutputSchema>;
180
- private readDefaultToolOutput;
181
- private isItem;
182
- }
183
- //#endregion
184
- //#region src/ai/CallableToolConfig.d.ts
185
- type CallableToolExecuteHandler<TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny> = (args: ToolExecuteArgs<CallableToolConfig<TInputSchema, TOutputSchema>, input<TInputSchema>>) => Promise<output<TOutputSchema>> | output<TOutputSchema>;
186
- type CallableToolConfigOptions<TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny> = Readonly<{
187
- name: string;
188
- description?: string;
189
- presentation?: AgentCanvasPresentation;
190
- inputSchema: TInputSchema;
191
- outputSchema: TOutputSchema;
192
- /**
193
- * Optional credential slots for this tool (same contract as other {@link ToolConfig} shapes).
194
- */
195
- credentialRequirements?: ReadonlyArray<CredentialRequirement>;
196
- execute: CallableToolExecuteHandler<TInputSchema, TOutputSchema>;
197
- }>;
198
- /**
199
- * Inline callable agent tool: DSL sugar over {@link ToolConfig} without a separate {@link NodeResolver}-registered {@link Tool} class.
200
- */
201
- declare class CallableToolConfig<TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny> implements ToolConfig {
202
- readonly name: string;
203
- readonly type: TypeToken<unknown>;
204
- readonly toolKind: "callable";
205
- readonly description?: string;
206
- readonly presentation?: AgentCanvasPresentation;
207
- private readonly inputSchemaValue;
208
- private readonly outputSchemaValue;
209
- private readonly credentialRequirementsValue?;
210
- private readonly executeHandler;
211
- constructor(name: string, options: CallableToolConfigOptions<TInputSchema, TOutputSchema>);
212
- getCredentialRequirements(): ReadonlyArray<CredentialRequirement>;
213
- getInputSchema(): TInputSchema;
214
- getOutputSchema(): TOutputSchema;
215
- /**
216
- * Parses tool input and output with the configured Zod schemas.
217
- */
218
- executeTool(args: ToolExecuteArgs<CallableToolConfig<TInputSchema, TOutputSchema>, input<TInputSchema>>): Promise<output<TOutputSchema>>;
219
- private parseInput;
220
- private parseOutput;
221
- private decorateValidationError;
222
- }
223
- //#endregion
224
- //#region src/ai/CallableToolFactory.d.ts
225
- declare class CallableToolFactoryImpl {
226
- callableTool<TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny>(options: CallableToolConfigOptions<TInputSchema, TOutputSchema>): CallableToolConfig<TInputSchema, TOutputSchema>;
227
- }
228
- declare const CallableToolFactory: CallableToolFactoryImpl;
229
- //#endregion
230
- //#region src/ai/CallableToolKindToken.d.ts
231
- /**
232
- * Shared {@link import("../di").TypeToken} marker for {@link CallableToolConfig}.
233
- * Callable tools are not registered in {@link NodeResolver}; this class only satisfies {@link ToolConfig#type}.
234
- */
235
- declare class CallableToolKindToken {}
236
- //#endregion
237
- //#region src/ai/AgentToolFactory.d.ts
238
- declare class AgentToolFactoryImpl {
239
- asTool<TNodeConfig extends RunnableNodeConfig<any, any>, TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny>(node: TNodeConfig, options: Readonly<{
240
- name?: string;
241
- } & NodeBackedToolConfigOptions<TNodeConfig, TInputSchema, TOutputSchema>>): NodeBackedToolConfig<TNodeConfig, TInputSchema, TOutputSchema>;
242
- private withDefaultAgentInputMapper;
243
- private mergeAgentToolInputWithCurrentItem;
244
- private isMergeableRecord;
245
- }
246
- declare const AgentToolFactory: AgentToolFactoryImpl;
247
- //#endregion
248
- //#region src/ai/AgentMessageConfigNormalizerFactory.d.ts
249
- declare class AgentMessageConfigNormalizer {
250
- /**
251
- * Prefer {@code input.messages} when present (ItemNode / engine-mapped payloads); otherwise resolve from
252
- * {@link AgentNodeConfig.messages} templates.
253
- */
254
- static resolveFromInputOrConfig<TInputJson, TOutputJson>(input: unknown, config: AgentNodeConfig<TInputJson, TOutputJson>, args: AgentMessageBuildArgs<TInputJson>): ReadonlyArray<AgentMessageDto>;
255
- static normalize<TInputJson, TOutputJson>(config: AgentNodeConfig<TInputJson, TOutputJson>, args: AgentMessageBuildArgs<TInputJson>): ReadonlyArray<AgentMessageDto>;
256
- private static tryMessagesFromStructuredInput;
257
- private static normalizeRichMessages;
258
- private static lineToDto;
259
- }
260
- //#endregion
261
- //#region src/ai/AgentConfigInspectorFactory.d.ts
262
- declare class AgentConfigInspector {
263
- static isAgentNodeConfig(config: NodeConfigBase | undefined): config is AgentNodeConfig<any, any>;
264
- private static hasCompatibleMessageConfiguration;
265
- }
266
- //#endregion
267
- //#region src/ai/AiHost.d.ts
268
- interface AgentCanvasPresentation<TIcon extends string = string> {
269
- readonly label?: string;
270
- readonly icon?: TIcon;
271
- }
272
- type ZodSchemaAny = ZodType<any, any, any>;
273
- interface ToolConfig {
274
- readonly type: TypeToken<unknown>;
275
- readonly name: string;
276
- readonly description?: string;
277
- readonly presentation?: AgentCanvasPresentation;
278
- getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
279
- }
280
- type ToolExecuteArgs<TConfig$1 extends ToolConfig = ToolConfig, TInput = unknown> = Readonly<{
281
- config: TConfig$1;
282
- input: TInput;
283
- ctx: NodeExecutionContext<any>;
284
- item: Item;
285
- itemIndex: number;
286
- items: Items;
287
- /**
288
- * Optional sub-agent boundary hooks: when present, the live `agent.tool.call` span and the
289
- * planned tool-call invocationId are forwarded so node-backed runtimes can re-root their child
290
- * execution scope. Plain function tools may safely ignore these hooks.
291
- */
292
- hooks?: Readonly<{
293
- parentSpan?: TelemetrySpanScope;
294
- parentInvocationId?: ConnectionInvocationId;
295
- }>;
296
- }>;
297
- interface Tool<TConfig$1 extends ToolConfig = ToolConfig, TInputSchema extends ZodSchemaAny = ZodSchemaAny, TOutputSchema extends ZodSchemaAny = ZodSchemaAny> {
298
- readonly defaultDescription: string;
299
- readonly inputSchema: TInputSchema;
300
- readonly outputSchema: TOutputSchema;
301
- execute(args: ToolExecuteArgs<TConfig$1, input<TInputSchema>>): Promise<output<TOutputSchema>> | output<TOutputSchema>;
302
- }
303
- type AgentTool<TInputSchema extends ZodSchemaAny = ZodSchemaAny, TOutputSchema extends ZodSchemaAny = ZodSchemaAny> = Tool<ToolConfig, TInputSchema, TOutputSchema>;
304
- type AgentToolExecuteArgs<TInput = unknown> = ToolExecuteArgs<ToolConfig, TInput>;
305
- type AgentToolToken = TypeToken<Tool<ToolConfig, ZodSchemaAny, ZodSchemaAny>>;
306
- type AgentMessageRole = "system" | "user" | "assistant";
307
- type AgentMessageBuildArgs<TInputJson = unknown> = Readonly<{
308
- item: Item<TInputJson>;
309
- itemIndex: number;
310
- items: Items<TInputJson>;
311
- ctx: NodeExecutionContext<any>;
312
- }>;
313
- interface AgentMessageDto {
314
- readonly role: AgentMessageRole;
315
- readonly content: string;
316
- }
317
- type AgentMessageTemplateContent<TInputJson = unknown> = string | ((args: AgentMessageBuildArgs<TInputJson>) => string);
318
- interface AgentMessageTemplate<TInputJson = unknown> {
319
- readonly role: AgentMessageRole;
320
- readonly content: AgentMessageTemplateContent<TInputJson>;
321
- }
322
- /** A single prompt line: fixed DTO or template with optional function `content`. */
323
- type AgentMessageLine<TInputJson = unknown> = AgentMessageDto | AgentMessageTemplate<TInputJson>;
324
- /**
325
- * Message list for an agent. Prefer a **plain array** of `{ role, content }` (optionally with function `content` for templates).
326
- * Use the object form only when you need `buildMessages` to append messages after optional `prompt` lines.
327
- */
328
- type AgentMessageConfig<TInputJson = unknown> = Expr<ReadonlyArray<AgentMessageLine<TInputJson>>, TInputJson> | ReadonlyArray<AgentMessageLine<TInputJson>> | {
329
- readonly prompt?: ReadonlyArray<AgentMessageLine<TInputJson>>;
330
- readonly buildMessages?: (args: AgentMessageBuildArgs<TInputJson>) => ReadonlyArray<AgentMessageDto>;
331
- };
332
- type AgentTurnLimitBehavior = "error" | "respondWithLastMessage";
333
- interface AgentModelInvocationOptions {
334
- readonly maxTokens?: number;
335
- readonly providerOptions?: Readonly<Record<string, JsonValue>>;
336
- }
337
- interface AgentGuardrailConfig {
338
- readonly maxTurns?: number;
339
- readonly onTurnLimitReached?: AgentTurnLimitBehavior;
340
- readonly modelInvocationOptions?: AgentModelInvocationOptions;
341
- }
342
- /** Defaults aligned with common tool-agent iteration limits (many products use ~10 max rounds). */
343
- declare const AgentGuardrailDefaults: {
344
- readonly maxTurns: 10;
345
- readonly onTurnLimitReached: AgentTurnLimitBehavior;
346
- };
347
- interface AgentToolDefinition {
348
- readonly name: string;
349
- readonly description: string;
350
- readonly inputSchema: ZodSchemaAny;
351
- }
352
- type AgentToolCall = Readonly<{
353
- id?: string;
354
- name: string;
355
- input: unknown;
356
- }>;
357
- type AgentToolCallPlanner<_TNodeConfig = unknown> = (item: Item, index: number, items: Items, ctx: NodeExecutionContext<any>) => ReadonlyArray<AgentToolCall>;
358
- interface ChatModelConfig {
359
- readonly type: TypeToken<ChatModelFactory<ChatModelConfig>>;
360
- readonly name: string;
361
- readonly provider?: string;
362
- readonly modelName?: string;
363
- readonly presentation?: AgentCanvasPresentation;
364
- getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
365
- }
366
- /**
367
- * Provider-neutral chat language model wrapper returned by a {@link ChatModelFactory}.
368
- *
369
- * Thin adapter around an AI SDK `LanguageModelV2` (from `@ai-sdk/provider`) plus the call-site
370
- * defaults Codemation needs at every generate/stream: the provider label, the model name used for
371
- * pricing / telemetry, and the default invocation options (max output tokens, temperature,
372
- * provider-specific overrides).
373
- *
374
- * The consumer (AIAgentNode / AgentStructuredOutputRunner) passes `languageModel` directly into
375
- * `generateText({ model, ... })` from the `ai` package.
376
- */
377
- interface ChatLanguageModel {
378
- /** AI SDK `LanguageModelV2` instance (kept `unknown` to avoid leaking the SDK type into `@codemation/core`). */
379
- readonly languageModel: unknown;
380
- /** Stable pricing/telemetry key — e.g. `"gpt-4.1-nano"`. */
381
- readonly modelName: string;
382
- /** Provider label — e.g. `"openai"`. Used for cost tracking. */
383
- readonly provider?: string;
384
- /** Defaults merged into every call. Consumers may override per-invocation. */
385
- readonly defaultCallOptions?: ChatLanguageModelCallOptions;
386
- }
387
- interface ChatLanguageModelCallOptions {
388
- readonly maxOutputTokens?: number;
389
- readonly temperature?: number;
390
- readonly providerOptions?: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
391
- }
392
- /**
393
- * Options for a structured-output generate call. Mirrors
394
- * `generateText({ output: Output.object(...) })` from the `ai` package.
395
- */
396
- interface StructuredOutputOptions {
397
- /** Optional schema name — used by some providers as the JSON schema name attribute. */
398
- readonly schemaName?: string;
399
- /** When `true`, the consumer should pass a strict-mode-compatible JSON Schema record. */
400
- readonly strict?: boolean;
401
- }
402
- interface ChatModelFactory<TConfig$1 extends ChatModelConfig = ChatModelConfig> {
403
- create(args: Readonly<{
404
- config: TConfig$1;
405
- ctx: NodeExecutionContext<any>;
406
- }>): Promise<ChatLanguageModel> | ChatLanguageModel;
407
- }
408
- type NodeBackedToolInputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown> = Readonly<{
409
- input: TToolInput;
410
- item: Item;
411
- itemIndex: number;
412
- items: Items;
413
- ctx: NodeExecutionContext<any>;
414
- node: TNodeConfig;
415
- }>;
416
- type NodeBackedToolOutputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown> = Readonly<{
417
- input: TToolInput;
418
- item: Item;
419
- itemIndex: number;
420
- items: Items;
421
- ctx: NodeExecutionContext<any>;
422
- node: TNodeConfig;
423
- outputs: NodeOutputs;
424
- }>;
425
- type NodeBackedToolInputMapper<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown> = (args: NodeBackedToolInputMapperArgs<TNodeConfig, TToolInput>) => Item<RunnableNodeInputJson<TNodeConfig>> | RunnableNodeInputJson<TNodeConfig>;
426
- type NodeBackedToolOutputMapper<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown, TToolOutput = unknown> = (args: NodeBackedToolOutputMapperArgs<TNodeConfig, TToolInput>) => TToolOutput;
427
- type NodeBackedToolConfigOptions<TNodeConfig extends RunnableNodeConfig<any, any>, TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny> = Readonly<{
428
- description?: string;
429
- presentation?: AgentCanvasPresentation;
430
- inputSchema: TInputSchema;
431
- outputSchema: TOutputSchema;
432
- mapInput?: NodeBackedToolInputMapper<TNodeConfig, input<TInputSchema>>;
433
- mapOutput?: NodeBackedToolOutputMapper<TNodeConfig, input<TInputSchema>, output<TOutputSchema>>;
434
- }>;
435
- interface AgentNodeConfig<TInputJson = unknown, TOutputJson = unknown> extends RunnableNodeConfig<TInputJson, TOutputJson> {
436
- readonly messages: AgentMessageConfig<TInputJson>;
437
- readonly chatModel: ChatModelConfig;
438
- readonly tools?: ReadonlyArray<ToolConfig>;
439
- readonly guardrails?: AgentGuardrailConfig;
440
- readonly outputSchema?: ZodType<TOutputJson>;
441
- }
442
- type AgentAttachmentRole = "languageModel" | "tool" | "nestedAgent";
443
- //#endregion
444
198
  //#region src/authoring/callableTool.types.d.ts
445
199
  /**
446
200
  * Workflow-facing helper for inline Zod-typed agent tools (same as {@link CallableToolFactory.callableTool}).
@@ -544,12 +298,12 @@ type DefinePollingTriggerTestItemsContext<TConfig$1 extends TriggerNodeConfig<an
544
298
  /**
545
299
  * Options accepted by `definePollingTrigger`.
546
300
  */
547
- interface DefinePollingTriggerOptions<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TItemJson, TState extends JsonValue | undefined, TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
301
+ interface DefinePollingTriggerOptions<TKey extends string, TConfig$1 extends CredentialJsonRecord, TItemJson, TState extends JsonValue | undefined, TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
548
302
  /**
549
303
  * Unique node-token-id-style key, e.g. `"msgraph-mail.on-new-mail"`.
550
304
  * Used as the persisted runtime type name — must be stable across deployments.
551
305
  */
552
- readonly key: TKey$1;
306
+ readonly key: TKey;
553
307
  readonly title: string;
554
308
  readonly description?: string;
555
309
  /** Canvas icon (same contract as `NodeConfigBase.icon`). */
@@ -604,9 +358,9 @@ interface DefinePollingTriggerOptions<TKey$1 extends string, TConfig$1 extends C
604
358
  *
605
359
  * `poll` is also directly callable for unit-testing — no runtime needed.
606
360
  */
607
- interface DefinedPollingTrigger<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TItemJson, TState extends JsonValue | undefined, TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
361
+ interface DefinedPollingTrigger<TKey extends string, TConfig$1 extends CredentialJsonRecord, TItemJson, TState extends JsonValue | undefined, TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
608
362
  readonly kind: "defined-polling-trigger";
609
- readonly key: TKey$1;
363
+ readonly key: TKey;
610
364
  readonly title: string;
611
365
  readonly description?: string;
612
366
  /**
@@ -671,28 +425,7 @@ declare class DefinedPollingTriggerConfig<TConfig$1 extends CredentialJsonRecord
671
425
  * });
672
426
  * ```
673
427
  */
674
- declare function definePollingTrigger<TKey$1 extends string, TConfig$1 extends CredentialJsonRecord, TItemJson, TState extends JsonValue | undefined, TBindings extends DefinedNodeCredentialBindings | undefined = undefined>(options: DefinePollingTriggerOptions<TKey$1, TConfig$1, TItemJson, TState, TBindings>): DefinedPollingTrigger<TKey$1, TConfig$1, TItemJson, TState, TBindings>;
675
- //#endregion
676
- //#region src/ai/AgentConnectionNodeCollector.d.ts
677
- type AgentConnectionNodeRole = "languageModel" | "tool" | "nestedAgent";
678
- type AgentConnectionCredentialSource = Readonly<{
679
- getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
680
- }>;
681
- type AgentConnectionNodeDescriptor = Readonly<{
682
- nodeId: NodeId;
683
- parentNodeId: NodeId;
684
- connectionName: NodeConnectionName;
685
- role: AgentConnectionNodeRole;
686
- name: string;
687
- typeName: string;
688
- icon?: string;
689
- credentialSource: AgentConnectionCredentialSource;
690
- }>;
691
- type McpServerResolver = (id: string) => McpServerDeclaration | undefined;
692
- type AgentConnectionNodeCollectorApi = Readonly<{
693
- collect(parentNodeId: NodeId, agentConfig: AgentNodeConfig<any, any>, mcpServerResolver?: McpServerResolver): ReadonlyArray<AgentConnectionNodeDescriptor>;
694
- }>;
695
- declare const AgentConnectionNodeCollector: AgentConnectionNodeCollectorApi;
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>;
696
429
  //#endregion
697
430
  //#region src/events/ConnectionInvocationEventPublisher.d.ts
698
431
  /**
@@ -801,18 +534,6 @@ declare function tool(options?: PersistedRuntimeTypeDecoratorOptions): ClassDeco
801
534
  /** Marks a class as a persisted chat-model runtime type and an injectable tsyringe service. */
802
535
  declare function chatModel(options?: PersistedRuntimeTypeDecoratorOptions): ClassDecorator;
803
536
  //#endregion
804
- //#region src/serialization/ItemsInputNormalizer.d.ts
805
- /**
806
- * Normalizes external inputs into the engine's canonical `Items` shape.
807
- * Used at host and builder boundaries where callers may provide either a raw value,
808
- * a single item-like object, or an array of item-like values.
809
- */
810
- declare class ItemsInputNormalizer {
811
- normalize(raw: unknown): Items;
812
- private normalizeItem;
813
- private isItem;
814
- }
815
- //#endregion
816
537
  //#region src/binaries/UnavailableBinaryStorage.d.ts
817
538
  declare class UnavailableBinaryStorage implements BinaryStorage {
818
539
  readonly driverName = "unavailable";
@@ -883,8 +604,9 @@ declare class DefaultExecutionContextFactory implements ExecutionContextFactory
883
604
  private readonly costTrackingFactory;
884
605
  private readonly currentDate;
885
606
  private readonly collections?;
607
+ private readonly nodeResolver?;
886
608
  private readonly telemetryDecoratorFactory;
887
- 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);
888
610
  create(args: {
889
611
  runId: RunId;
890
612
  workflowId: WorkflowId;
@@ -954,15 +676,71 @@ declare class NodeOutputNormalizer {
954
676
  private applyOutput;
955
677
  }
956
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
957
729
  //#region src/execution/NodeExecutor.d.ts
958
730
  declare class NodeExecutor {
959
731
  private readonly nodeInstanceFactory;
960
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?;
961
737
  private readonly fanInMerger;
962
738
  private readonly outputNormalizer;
963
739
  private readonly itemExprResolver;
964
740
  private readonly outputBehaviorResolver;
965
- 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);
966
744
  execute(request: NodeActivationRequest): Promise<NodeOutputs>;
967
745
  private assertRequiredCredentialsBound;
968
746
  private isCredentialError;
@@ -1281,6 +1059,91 @@ interface OAuthFlowExecutor {
1281
1059
  }): Promise<OAuthMaterial>;
1282
1060
  }
1283
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
1284
1147
  //#region src/orchestration/TestSuiteRunIdFactory.d.ts
1285
1148
  /**
1286
1149
  * Mints unique TestSuiteRun identifiers. Separated from {@link import("../types").RunIdFactory}
@@ -1298,7 +1161,7 @@ declare class TestSuiteRunIdFactory {
1298
1161
  interface TestSuiteOrchestratorEngine {
1299
1162
  runWorkflow(wf: WorkflowDefinition, startAt: NodeId, items: Items, parent?: ParentExecutionRef, executionOptions?: RunExecutionOptions): Promise<RunResult>;
1300
1163
  waitForCompletion(runId: RunId): Promise<Extract<RunResult, {
1301
- status: "completed" | "failed";
1164
+ status: "completed" | "failed" | "halted";
1302
1165
  }>>;
1303
1166
  }
1304
1167
  interface TestSuiteCaseOutcome {
@@ -1349,5 +1212,5 @@ declare class TestSuiteOrchestrator {
1349
1212
  private publish;
1350
1213
  }
1351
1214
  //#endregion
1352
- export { InjectableRuntimeDecoratorComposer as $, NodeBackedToolConfigOptions as $t, ConfigDrivenOffloadPolicy as A, defineBatchNode as An, AgentCanvasPresentation as At, DefaultAsyncSleeper as B, AgentModelInvocationOptions as Bt, InMemoryWorkflowExecutionRepository as C, DefineNodeOptions as Cn, CollectionIndexDefinition as Ct, HintOnlyOffloadPolicy as D, DefinedNodeCredentialBinding as Dn, defineCollection as Dt, LocalOnlyScheduler as E, DefinedNodeCredentialAccessors as En, c as Et, RunnableOutputBehaviorResolver as F, CredentialResolverFactory as Fn, AgentMessageDto as Ft, ItemsInputNormalizer as G, AgentToolDefinition as Gt, ChildExecutionScopeFactory as H, AgentTool as Ht, ItemExprResolver as I, AbortControllerFactory as In, AgentMessageLine as It, node as J, AgentTurnLimitBehavior as Jt, chatModel as K, AgentToolExecuteArgs as Kt, InProcessRetryRunner as L, AgentMessageRole as Lt, NodeInstanceFactory as M, Clock as Mn, AgentGuardrailDefaults as Mt, NodeExecutor as N, SystemClock as Nn, AgentMessageBuildArgs as Nt, DefaultDrivingScheduler as O, DefinedNodeCredentialBindings as On, callableTool as Ot, NodeOutputNormalizer as P, NodeEventPublisher as Pn, AgentMessageConfig as Pt, PersistedRuntimeTypeMetadataStore as Q, ChatModelFactory as Qt, CatalogBackedCostTrackingTelemetryFactory as R, AgentMessageTemplate as Rt, RunSummaryMapper as S, DefineNodeExecuteArgs as Sn, CollectionFieldDefinition as St, InMemoryBinaryStorage as T, DefinedNodeConfigInput as Tn, DefinedCollection as Tt, DefaultExecutionBinaryService as U, AgentToolCall as Ut, AsyncSleeper as V, AgentNodeConfig as Vt, UnavailableBinaryStorage as W, AgentToolCallPlanner as Wt, StackTraceCallSitePathResolver as X, ChatLanguageModelCallOptions as Xt, tool as Y, ChatLanguageModel as Yt, PersistedRuntimeTypeNameResolver as Z, ChatModelConfig as Zt, PollingTriggerRuntime as _, NodeBackedToolConfig as _n, DefinedPollingTriggerConfig as _t, TestSuiteRunResult as a, Tool as an, ConnectionInvocationEventPublisher as at, EngineCompositionDeps as b, DefinedNodeRegistry as bn, CollectionColumnBuilder as bt, OAuthFlowExecutor as c, ZodSchemaAny as cn, AgentConnectionNodeDescriptor as ct, OAuthMaterial as d, AgentToolFactory as dn, DefinePollingTriggerExecuteContext as dt, NodeBackedToolInputMapper as en, PersistedRuntimeTypeDecoratorOptions as et, WorkflowEdgePortValidator as f, CallableToolKindToken as fn, DefinePollingTriggerOptions as ft, PollingRunCycleResult as g, CallableToolExecuteHandler as gn, DefinedPollingTrigger as gt, PollingRunCycleArgs as h, CallableToolConfigOptions as hn, DefinePollingTriggerTestItemsContext as ht, TestSuiteOrchestratorEngine as i, StructuredOutputOptions as in, InMemoryRunEventBus as it, StaticCostCatalog as j, defineNode as jn, AgentGuardrailConfig as jt, InlineDrivingScheduler as k, DefinedNodeRunContext as kn, AgentAttachmentRole as kt, OAuthFlowStartArgs as l, AgentConfigInspector as ln, AgentConnectionNodeRole as lt, WorkflowEdgePortValidationResult as m, CallableToolConfig as mn, DefinePollingTriggerPollResult as mt, TestSuiteCaseOutcome as n, NodeBackedToolOutputMapper as nn, PersistedRuntimeTypeMetadata as nt, TestSuiteRunIdFactory as o, ToolConfig as on, AgentConnectionCredentialSource as ot, WorkflowEdgePortError as p, CallableToolFactory as pn, DefinePollingTriggerPollContext as pt, getPersistedRuntimeTypeMetadata as q, AgentToolToken as qt, TestSuiteOrchestrator as r, NodeBackedToolOutputMapperArgs as rn, EventPublishingWorkflowExecutionRepository as rt, OAuthFlowCallbackArgs as s, ToolExecuteArgs as sn, AgentConnectionNodeCollector as st, RunTestSuiteArgs as t, NodeBackedToolInputMapperArgs as tn, PersistedRuntimeTypeKind as tt, OAuthFlowStartResult as u, AgentMessageConfigNormalizer as un, McpServerResolver as ut, PollingTriggerStartArgs as v, DefineCredentialOptions as vn, definePollingTrigger as vt, InMemoryRunDataFactory as w, DefinedNode as wn, DefineCollectionOptions as wt, EngineFactory as x, DefineBatchNodeOptions as xn, CollectionDefinition as xt, WorkflowRepositoryWebhookTriggerMatcher as y, defineCredential as yn, DefinedCollectionRegistry as yt, DefaultExecutionContextFactory as z, AgentMessageTemplateContent as zt };
1353
- //# sourceMappingURL=index-Bes88mxT.d.ts.map
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