import { ReadableStream } from "node:stream/web"; import { ZodType } from "zod"; import { DependencyContainer as Container, DependencyContainer as DependencyContainer$1, Disposable, InjectionToken as InjectionToken$1, InjectionToken as TypeToken, Lifecycle, RegistrationOptions, container, delay, inject, injectAll, injectable, instanceCachingFactory, instancePerContainerCachingFactory, predicateAwareClassFactory, registry, singleton } from "tsyringe"; //#region src/contracts/baseTypes.d.ts type WorkflowId = string; type NodeId = string; type OutputPortKey = string; type InputPortKey = string; type PersistedTokenId = string; type NodeConnectionName = string; //#endregion //#region src/triggers/polling/PollingTriggerDedupWindow.d.ts declare class PollingTriggerDedupWindow { static readonly defaultCapN = 2000; merge(previous: ReadonlyArray, incoming: ReadonlyArray, capN?: number): ReadonlyArray; } //#endregion //#region src/triggers/polling/PollingTriggerLogger.d.ts interface PollingTriggerLogger { info(message: string): void; warn(message: string): void; error(message: string, exception?: Error): void; debug(message: string): void; } declare class NoOpPollingTriggerLogger implements PollingTriggerLogger { info(): void; warn(): void; error(): void; debug(): void; } //#endregion //#region src/contracts/credentialTypes.d.ts type CredentialTypeId = string; type CredentialInstanceId = string; type CredentialMaterialSourceKind = "db" | "env" | "code"; type CredentialSetupStatus = "draft" | "ready"; type CredentialHealthStatus = "unknown" | "healthy" | "failing"; type CredentialFieldSchema = Readonly<{ key: string; label: string; type: "string" | "password" | "textarea" | "json" | "boolean"; required?: true; order?: number; visibility?: "default" | "advanced"; placeholder?: string; helpText?: string; envVarName?: string; copyValue?: string; copyButtonLabel?: string; }>; type CredentialRequirement = Readonly<{ slotKey: string; label: string; acceptedTypes: ReadonlyArray; optional?: true; helpText?: string; helpUrl?: string; }>; type CredentialBindingKey = Readonly<{ workflowId: WorkflowId; nodeId: NodeId; slotKey: string; }>; type CredentialBinding = Readonly<{ key: CredentialBindingKey; instanceId: CredentialInstanceId; updatedAt: string; }>; type CredentialHealth = Readonly<{ status: CredentialHealthStatus; message?: string; testedAt?: string; expiresAt?: string; details?: Readonly>; }>; type OAuth2ProviderFromPublicConfig = Readonly<{ authorizeUrlFieldKey: string; tokenUrlFieldKey: string; userInfoUrlFieldKey?: string; }>; type CredentialOAuth2ScopesFromPublicConfig = Readonly<{ presetFieldKey: string; presetScopes: Readonly>>; customPresetKey?: string; customScopesFieldKey?: string; }>; type CredentialOAuth2AuthDefinition = Readonly<{ kind: "oauth2"; providerId: string; scopes: ReadonlyArray; scopesFromPublicConfig?: CredentialOAuth2ScopesFromPublicConfig; clientIdFieldKey?: string; clientSecretFieldKey?: string; } | { kind: "oauth2"; providerFromPublicConfig: OAuth2ProviderFromPublicConfig; scopes: ReadonlyArray; scopesFromPublicConfig?: CredentialOAuth2ScopesFromPublicConfig; clientIdFieldKey?: string; clientSecretFieldKey?: string; } | { kind: "oauth2"; providerId: string; authorizeUrl: string; tokenUrl: string; userInfoUrl?: string; scopes: ReadonlyArray; scopesFromPublicConfig?: CredentialOAuth2ScopesFromPublicConfig; clientIdFieldKey?: string; clientSecretFieldKey?: string; }>; type CredentialAuthDefinition = CredentialOAuth2AuthDefinition; type CredentialAdvancedSectionPresentation = Readonly<{ title?: string; description?: string; defaultOpen?: boolean; }>; type CredentialTypeDefinition = Readonly<{ typeId: CredentialTypeId; displayName: string; description?: string; publicFields?: ReadonlyArray; secretFields?: ReadonlyArray; advancedSection?: CredentialAdvancedSectionPresentation; supportedSourceKinds?: ReadonlyArray; auth?: CredentialAuthDefinition; }>; type CredentialJsonRecord = Readonly>; type CredentialInstanceRecord = Readonly<{ instanceId: CredentialInstanceId; typeId: CredentialTypeId; displayName: string; sourceKind: CredentialMaterialSourceKind; publicConfig: TPublicConfig; secretRef: CredentialJsonRecord; tags: ReadonlyArray; setupStatus: CredentialSetupStatus; createdAt: string; updatedAt: string; material: Readonly<{ source: "local" | "control-plane"; ref: string; }>; }>; type CredentialSessionFactoryArgs = Readonly<{ instance: CredentialInstanceRecord; material: TMaterial; publicConfig: TPublicConfig; }>; type CredentialSessionFactory = (args: CredentialSessionFactoryArgs) => Promise; type CredentialAccessTokenSessionArgs = Readonly<{ accessToken: string; grantedScopes: ReadonlyArray; publicConfig: TPublicConfig; }>; type CredentialAccessTokenSessionFactory = (args: CredentialAccessTokenSessionArgs) => Promise; type CredentialHealthTester = (args: CredentialSessionFactoryArgs) => Promise; type CredentialType = Readonly<{ definition: CredentialTypeDefinition; createSession: CredentialSessionFactory; createSessionFromAccessToken?: CredentialAccessTokenSessionFactory; test: CredentialHealthTester; }>; type AnyCredentialType = CredentialType; interface CredentialSessionService { getSession(args: Readonly<{ workflowId: WorkflowId; nodeId: NodeId; slotKey: string; }>): Promise; } interface CredentialTypeRegistry { listTypes(): ReadonlyArray; getType(typeId: CredentialTypeId): CredentialTypeDefinition | undefined; } declare class CredentialUnboundError extends Error { readonly bindingKey: CredentialBindingKey; readonly acceptedTypes: ReadonlyArray; constructor(bindingKey: CredentialBindingKey, acceptedTypes?: ReadonlyArray); private static createMessage; } //#endregion //#region src/contracts/collectionTypes.d.ts interface CollectionStore = Record> { insert(row: TRow): Promise; get(id: string): Promise<(TRow & { id: string; created_at: Date; updated_at: Date; }) | null>; findOne(filter: Partial): Promise<(TRow & { id: string; created_at: Date; updated_at: Date; }) | null>; list(opts?: { limit?: number; offset?: number; where?: Partial; }): Promise<{ rows: ReadonlyArray; total: number; }>; update(id: string, patch: Partial): Promise; delete(id: string): Promise<{ deleted: boolean; }>; } type CollectionsContext = Readonly>; //#endregion //#region src/contracts/CostTrackingTelemetryContract.d.ts type CostTrackingComponent = "chat" | "ocr" | "rag"; declare const CostTrackingTelemetryMetricNames: { readonly usage: "codemation.cost.usage"; readonly estimatedCost: "codemation.cost.estimated"; }; declare const CostTrackingTelemetryAttributeNames: { readonly component: "cost.component"; readonly provider: "cost.provider"; readonly operation: "cost.operation"; readonly pricingKey: "cost.pricing_key"; readonly usageUnit: "cost.usage_unit"; readonly currency: "cost.currency"; readonly currencyScale: "cost.currency_scale"; readonly estimateKind: "cost.estimate_kind"; }; interface CostTrackingUsageRecord { readonly component: CostTrackingComponent; readonly provider: string; readonly operation: string; readonly pricingKey: string; readonly usageUnit: string; readonly quantity: number; readonly modelName?: string; readonly attributes?: TelemetryAttributes; } interface CostTrackingPriceQuote { readonly currency: string; readonly currencyScale: number; readonly estimatedAmountMinor: number; readonly estimateKind: "catalog"; } interface CostTrackingTelemetry { captureUsage(args: CostTrackingUsageRecord): Promise; forScope(scope: TelemetryScope): CostTrackingTelemetry; } interface CostTrackingTelemetryFactory { create(args: Readonly<{ telemetry: ExecutionTelemetry; }>): CostTrackingTelemetry; } //#endregion //#region src/contracts/NoOpTelemetryArtifactReference.d.ts declare class NoOpTelemetryArtifactReference { static readonly value: TelemetryArtifactReference; } //#endregion //#region src/contracts/NoOpTelemetrySpanScope.d.ts declare class NoOpTelemetrySpanScope { static readonly value: TelemetrySpanScope; static readonly nodeExecutionTelemetryValue: NodeExecutionTelemetry; } //#endregion //#region src/contracts/NoOpNodeExecutionTelemetry.d.ts declare class NoOpNodeExecutionTelemetry { static readonly value: NodeExecutionTelemetry; } //#endregion //#region src/contracts/NoOpExecutionTelemetry.d.ts declare class NoOpExecutionTelemetry { static readonly value: ExecutionTelemetry; } //#endregion //#region src/contracts/NoOpExecutionTelemetryFactory.d.ts declare class NoOpExecutionTelemetryFactory implements ExecutionTelemetryFactory { create(_: Readonly<{ runId: RunId; workflowId: WorkflowId; parent?: ParentExecutionRef; policySnapshot?: PersistedRunPolicySnapshot; }>): ExecutionTelemetry; } //#endregion //#region src/contracts/CodemationTelemetryAttributeNames.d.ts declare class CodemationTelemetryAttributeNames { static readonly workflowId = "codemation.workflow.id"; static readonly runId = "codemation.run.id"; static readonly nodeId = "codemation.node.id"; static readonly activationId = "codemation.activation.id"; static readonly nodeType = "codemation.node.type"; static readonly nodeRole = "codemation.node.role"; static readonly workflowFolder = "codemation.workflow.folder"; static readonly connectionInvocationId = "codemation.connection.invocation_id"; static readonly toolName = "codemation.tool.name"; static readonly traceParentRunId = "codemation.parent.run.id"; static readonly iterationId = "codemation.iteration.id"; static readonly iterationIndex = "codemation.iteration.index"; static readonly parentInvocationId = "codemation.parent.invocation_id"; static readonly mcpServerId = "mcp.server_id"; static readonly mcpToolName = "mcp.tool_name"; static readonly nodeExecutionStatus = "codemation.node.execution_status"; static readonly runHaltReason = "codemation.run.halt_reason"; static readonly hitlTaskId = "codemation.hitl.task_id"; static readonly hitlChannel = "codemation.hitl.channel"; static readonly hitlDecisionStatus = "codemation.hitl.decision_status"; } //#endregion //#region src/contracts/GenAiTelemetryAttributeNames.d.ts declare class GenAiTelemetryAttributeNames { static readonly operationName = "gen_ai.operation.name"; static readonly requestModel = "gen_ai.request.model"; static readonly usageInputTokens = "gen_ai.usage.input_tokens"; static readonly usageOutputTokens = "gen_ai.usage.output_tokens"; static readonly usageTotalTokens = "gen_ai.usage.total_tokens"; static readonly usageCacheReadInputTokens = "gen_ai.usage.cache_read.input_tokens"; static readonly usageCacheCreationInputTokens = "gen_ai.usage.cache_creation.input_tokens"; static readonly usageReasoningTokens = "codemation.gen_ai.usage.reasoning_tokens"; } //#endregion //#region src/contracts/CodemationTelemetryMetricNames.d.ts declare class CodemationTelemetryMetricNames { static readonly agentTurns = "codemation.ai.turns"; static readonly agentToolCalls = "codemation.ai.tool_calls"; static readonly gmailMessagesEmitted = "codemation.gmail.messages_emitted"; static readonly gmailAttachments = "codemation.gmail.attachments"; static readonly gmailAttachmentBytes = "codemation.gmail.attachment_bytes"; } //#endregion //#region src/contracts/telemetryTypes.d.ts type TelemetryAttributePrimitive = string | number | boolean | null; interface TelemetryAttributes { readonly [key: string]: TelemetryAttributePrimitive | undefined; } interface TelemetryMetricRecord { readonly name: string; readonly value: number; readonly unit?: string; readonly attributes?: TelemetryAttributes; } interface TelemetrySpanEventRecord { readonly name: string; readonly occurredAt?: Date; readonly attributes?: TelemetryAttributes; } interface TelemetryArtifactAttachment { readonly kind: string; readonly contentType: string; readonly previewText?: string; readonly previewJson?: JsonValue; readonly payloadText?: string; readonly payloadJson?: JsonValue; readonly bytes?: number; readonly truncated?: boolean; readonly expiresAt?: Date; } interface TelemetryArtifactReference { readonly artifactId: string; readonly traceId?: string; readonly spanId?: string; } interface TelemetrySpanEnd { readonly status?: "ok" | "error"; readonly statusMessage?: string; readonly endedAt?: Date; readonly attributes?: TelemetryAttributes; } interface TelemetryChildSpanStart { readonly name: string; readonly kind?: "internal" | "client"; readonly startedAt?: Date; readonly attributes?: TelemetryAttributes; } interface TelemetryScope { readonly traceId?: string; readonly spanId?: string; readonly costTracking?: CostTrackingTelemetry; addSpanEvent(args: TelemetrySpanEventRecord): Promise | void; recordMetric(args: TelemetryMetricRecord): Promise | void; attachArtifact(args: TelemetryArtifactAttachment): Promise | TelemetryArtifactReference; } interface TelemetrySpanScope extends TelemetryScope { readonly traceId: string; readonly spanId: string; end(args?: TelemetrySpanEnd): Promise | void; asNodeTelemetry(args: Readonly<{ nodeId: NodeId; activationId: NodeActivationId; }>): NodeExecutionTelemetry; } interface NodeExecutionTelemetry extends ExecutionTelemetry, TelemetrySpanScope { startChildSpan(args: TelemetryChildSpanStart): TelemetrySpanScope; } interface ExecutionTelemetry extends TelemetryScope { readonly traceId: string; readonly spanId: string; forNode(args: Readonly<{ nodeId: NodeId; activationId: NodeActivationId; }>): NodeExecutionTelemetry; } interface ExecutionTelemetryFactory { create(args: Readonly<{ runId: RunId; workflowId: WorkflowId; parent?: ParentExecutionRef; policySnapshot?: PersistedRunPolicySnapshot; }>): ExecutionTelemetry; } //#endregion //#region src/contracts/workflowActivationPolicy.d.ts interface WorkflowActivationPolicy { isActive(workflowId: WorkflowId): boolean; } declare class AllWorkflowsActiveWorkflowActivationPolicy implements WorkflowActivationPolicy { isActive(_workflowId: WorkflowId): boolean; } //#endregion //#region src/contracts/webhookTypes.d.ts type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; interface WebhookControlSignal { readonly __webhookControl: true; readonly kind: "respondNow" | "respondNowAndContinue"; readonly responseItems: Items; readonly continueItems?: Items; } interface WebhookTriggerRoutingDiagnostics { warn(message: string): void; info?(message: string): void; } interface TriggerInstanceId { workflowId: WorkflowId; nodeId: NodeId; } interface WebhookInvocationMatch { endpointPath: string; workflowId: WorkflowId; nodeId: NodeId; methods: ReadonlyArray; parseJsonBody?: (body: unknown) => unknown; } type WebhookTriggerResolution = { status: "notFound"; } | { status: "methodNotAllowed"; match: WebhookInvocationMatch; } | { status: "ok"; match: WebhookInvocationMatch; }; interface WebhookTriggerMatcher { match(args: { endpointPath: string; method: HttpMethod; }): WebhookInvocationMatch | undefined; lookup(endpointPath: string): WebhookInvocationMatch | undefined; onEngineWorkflowsLoaded?(): void; onEngineStopped?(): void; reloadWebhookRoutes?(): void; } //#endregion //#region src/contracts/runtimeTypes.d.ts type HumanTaskId = string; type Duration = string; interface HumanTaskHandle { readonly taskId: HumanTaskId; readonly runId: string; readonly nodeId: string; readonly expiresAt: Date; readonly resumeUrl: string; readonly metadata?: Readonly>; } interface HumanTaskSubject { readonly title: string; readonly summary: string; readonly attributes?: JsonValue; } interface HumanTaskActor { readonly actorId: string; readonly displayName?: string; } interface ResumeContext { readonly decision: Readonly<{ kind: "decided"; value: unknown; actor: HumanTaskActor; decidedAt: Date; }> | Readonly<{ kind: "timed_out"; at: Date; }> | Readonly<{ kind: "auto_accepted"; at: Date; }>; readonly delivery: JsonValue; readonly task: HumanTaskHandle; } declare class SuspensionRequest extends Error { readonly request: Readonly<{ decisionSchema: ZodType; timeout: Duration; onTimeout: "halt" | "auto-accept"; subject: HumanTaskSubject; metadata?: Readonly>; deliver: (handle: HumanTaskHandle) => Promise; }>; constructor(request: Readonly<{ decisionSchema: ZodType; timeout: Duration; onTimeout: "halt" | "auto-accept"; subject: HumanTaskSubject; metadata?: Readonly>; deliver: (handle: HumanTaskHandle) => Promise; }>); } interface WorkflowRunnerService { runById(args: { workflowId: WorkflowId; startAt?: NodeId; items: Items; parent?: ParentExecutionRef; }): Promise; } interface WorkflowRunnerResolver { resolve(): WorkflowRunnerService | undefined; } interface WorkflowRepository { list(): ReadonlyArray; get(workflowId: WorkflowId): WorkflowDefinition | undefined; } interface LiveWorkflowRepository extends WorkflowRepository { setWorkflows(workflows: ReadonlyArray): void; } interface NodeResolver { resolve(token: TypeToken): T; } interface NodeExecutionStatePublisher { markQueued(args: { nodeId: NodeId; activationId?: NodeActivationId; inputsByPort?: NodeInputsByPort; }): Promise; markRunning(args: { nodeId: NodeId; activationId?: NodeActivationId; inputsByPort?: NodeInputsByPort; }): Promise; markCompleted(args: { nodeId: NodeId; activationId?: NodeActivationId; inputsByPort?: NodeInputsByPort; outputs?: NodeOutputs; }): Promise; markFailed(args: { nodeId: NodeId; activationId?: NodeActivationId; inputsByPort?: NodeInputsByPort; error: Error; }): Promise; appendConnectionInvocation(args: ConnectionInvocationAppendArgs): Promise; setChildRunId?(args: { nodeId: NodeId; childRunId: RunId; }): Promise; } type BinaryBody = ReadableStream | AsyncIterable | Uint8Array | ArrayBuffer; interface BinaryStorageWriteRequest { storageKey: string; body: BinaryBody; } interface BinaryStorageWriteResult { storageKey: string; size: number; sha256?: string; } interface BinaryStorageReadResult { body: ReadableStream; size?: number; } interface BinaryStorageStatResult { exists: boolean; size?: number; } interface BinaryStorage { readonly driverName: string; write(args: BinaryStorageWriteRequest): Promise; openReadStream(storageKey: string): Promise; stat(storageKey: string): Promise; delete(storageKey: string): Promise; deleteMany(storageKeys: ReadonlyArray): Promise; listByPrefix(prefix: string): Promise>; } interface BinaryAttachmentCreateRequest { name: string; body: BinaryBody; mimeType: string; filename?: string; previewKind?: BinaryAttachment["previewKind"]; } interface NodeBinaryAttachmentService extends ExecutionBinaryService { attach(args: BinaryAttachmentCreateRequest): Promise; withAttachment(item: Item, name: string, attachment: BinaryAttachment): Item; } declare const BINARY_DEFAULT_MAX_BYTES: number; interface ExecutionBinaryService { forNode(args: { nodeId: NodeId; activationId: NodeActivationId; }): NodeBinaryAttachmentService; openReadStream(attachment: BinaryAttachment): Promise; getBytes(attachment: BinaryAttachment, maxBytes?: number): Promise; getText(attachment: BinaryAttachment, maxBytes?: number): Promise; getJson(attachment: BinaryAttachment, maxBytes?: number): Promise; } interface ExecutionContext { runId: RunId; workflowId: WorkflowId; parent?: ParentExecutionRef; subworkflowDepth: number; engineMaxNodeActivations: number; engineMaxSubworkflowDepth: number; now: () => Date; data: RunDataSnapshot; nodeState?: NodeExecutionStatePublisher; telemetry: ExecutionTelemetry; binary: ExecutionBinaryService; getCredential(slotKey: string): Promise; iterationId?: NodeIterationId; itemIndex?: number; parentInvocationId?: ConnectionInvocationId; testContext?: RunTestContext; readonly collections?: CollectionsContext; resolve(token: TypeToken): T; } interface ExecutionContextFactory { create(args: { runId: RunId; workflowId: WorkflowId; parent?: ParentExecutionRef; policySnapshot?: PersistedRunPolicySnapshot; subworkflowDepth: number; engineMaxNodeActivations: number; engineMaxSubworkflowDepth: number; data: RunDataSnapshot; nodeState?: NodeExecutionStatePublisher; telemetry?: ExecutionTelemetry; getCredential(slotKey: string): Promise; testContext?: RunTestContext; }): ExecutionContext; } interface NodeExecutionContext extends ExecutionContext { nodeId: NodeId; activationId: NodeActivationId; config: TConfig; telemetry: NodeExecutionTelemetry; binary: NodeBinaryAttachmentService; resumeContext?: ResumeContext; } interface TriggerPollingPort { start(args: { intervalMs: number; seedState?: TState; runCycle: (cycleCtx: { previousState: TState | undefined; signal: AbortSignal; }) => Promise<{ items: Items; nextState: TState; }>; }): Promise; } interface PollingTriggerHandle extends TriggerPollingPort { readonly dedup: PollingTriggerDedupWindow; } interface TriggerSetupContext = TriggerNodeConfig, TSetupState$1 extends JsonValue | undefined = TriggerNodeSetupState> extends ExecutionContext { trigger: TriggerInstanceId; config: TConfig; previousState: TSetupState$1; registerCleanup(cleanup: TriggerCleanupHandle): void; emit(items: Items): Promise; readonly polling: PollingTriggerHandle; } interface TriggerTestItemsContext = TriggerNodeConfig, TSetupState$1 extends JsonValue | undefined = TriggerNodeSetupState> extends ExecutionContext { trigger: TriggerInstanceId; nodeId: NodeId; config: TConfig; previousState: TSetupState$1; } interface PersistedTriggerSetupState { trigger: TriggerInstanceId; updatedAt: string; state: TState; } interface TriggerSetupStateRepository { load(trigger: TriggerInstanceId): Promise; save(state: PersistedTriggerSetupState): Promise; delete(trigger: TriggerInstanceId): Promise; } interface TriggerCleanupHandle { stop(): Promise | void; } interface EngineHost { credentialSessions: CredentialSessionService; workflows?: WorkflowRunnerService; } interface RunnableNodeExecuteArgs = RunnableNodeConfig, TInputJson$1 = unknown> { readonly input: TInputJson$1; readonly item: Item; readonly itemIndex: number; readonly items: Items; readonly ctx: NodeExecutionContext; } interface RunnableNode = RunnableNodeConfig, TInputJson$1 = unknown, _TOutputJson = unknown> { readonly kind: "node"; readonly outputPorts?: ReadonlyArray; readonly inputSchema?: ZodType; execute(args: RunnableNodeExecuteArgs): Promise | unknown; } type ItemNode = RunnableNodeConfig, TInputJson$1 = unknown, TOutputJson$1 = unknown> = RunnableNode; interface MultiInputNode { kind: "node"; outputPorts?: ReadonlyArray; executeMulti(inputsByPort: NodeInputsByPort, ctx: NodeExecutionContext): Promise; } type TriggerSetupStateFor> = TriggerNodeSetupState; interface TriggerNode = TriggerNodeConfig> { kind: "trigger"; outputPorts: readonly ["main"]; setup(ctx: TriggerSetupContext): Promise>; execute(items: Items, ctx: NodeExecutionContext): Promise; } interface TestableTriggerNode = TriggerNodeConfig> extends TriggerNode { getTestItems(ctx: TriggerTestItemsContext): Promise; } type ExecutableTriggerNode = TriggerNodeConfig> = TriggerNode; interface NodeExecutionRequest { runId: RunId; activationId: NodeActivationId; workflowId: WorkflowId; nodeId: NodeId; input: Items; parent?: ParentExecutionRef; queue?: string; executionOptions?: RunExecutionOptions; } interface NodeExecutionScheduler { enqueue(request: NodeExecutionRequest): Promise<{ receiptId: string; }>; cancel?(receiptId: string): Promise; } interface NodeExecutionRequestHandler { handleNodeExecutionRequest(request: NodeExecutionRequest): Promise; } type NodeActivationRequestBase = Readonly<{ runId: RunId; activationId: NodeActivationId; workflowId: WorkflowId; nodeId: NodeId; parent?: ParentExecutionRef; executionOptions?: RunExecutionOptions; batchId?: string; ctx: NodeExecutionContext; }>; type NodeActivationRequest = (NodeActivationRequestBase & Readonly<{ kind: "single"; input: Items; }>) | (NodeActivationRequestBase & Readonly<{ kind: "multi"; inputsByPort: NodeInputsByPort; }>); interface NodeActivationReceipt { receiptId: string; mode?: "local" | "worker"; queue?: string; } interface PreparedNodeActivationDispatch { readonly receipt: NodeActivationReceipt; dispatch(): Promise; } interface NodeActivationContinuation { markNodeRunning(args: { runId: RunId; activationId: NodeActivationId; nodeId: NodeId; inputsByPort: NodeInputsByPort; }): Promise; resumeFromNodeResult(args: { runId: RunId; activationId: NodeActivationId; nodeId: NodeId; outputs: NodeOutputs; }): Promise; resumeFromNodeError(args: { runId: RunId; activationId: NodeActivationId; nodeId: NodeId; error: Error; }): Promise; } interface NodeActivationScheduler { setContinuation?(continuation: NodeActivationContinuation): void; prepareDispatch(request: NodeActivationRequest): Promise; cancel?(receiptId: string): Promise; } interface WorkflowNodeInstanceFactory { createNodes(workflow: WorkflowDefinition): ReadonlyMap; createByType(type: TypeToken): unknown; } interface NodeExecutor { execute(request: NodeActivationRequest): Promise; } interface WorkflowSnapshotFactory { create(workflow: WorkflowDefinition): PersistedWorkflowSnapshot; } interface WorkflowSnapshotResolver { resolve(args: { workflowId: WorkflowId; workflowSnapshot?: PersistedWorkflowSnapshot; }): WorkflowDefinition | undefined; } interface TriggerRuntimeDiagnostics { info(message: string): void; warn(message: string): void; } interface EngineDeps { credentialSessions: CredentialSessionService; liveWorkflowRepository: LiveWorkflowRepository; workflowRepository: WorkflowRepository; workflowActivationPolicy: WorkflowActivationPolicy; nodeResolver: NodeResolver; triggerSetupStateRepository: TriggerSetupStateRepository; webhookTriggerMatcher: WebhookTriggerMatcher; runIdFactory: RunIdFactory; activationIdFactory: ActivationIdFactory; workflowExecutionRepository: WorkflowExecutionRepository; activationScheduler: NodeActivationScheduler; runDataFactory: RunDataFactory; executionContextFactory: ExecutionContextFactory; executionTelemetryFactory?: ExecutionTelemetryFactory; nodeExecutor: NodeExecutor; eventBus?: RunEventBus; tokenRegistry: PersistedWorkflowTokenRegistryLike; workflowNodeInstanceFactory: WorkflowNodeInstanceFactory; workflowPolicyRuntimeDefaults?: WorkflowPolicyRuntimeDefaults; triggerRuntimeDiagnostics?: TriggerRuntimeDiagnostics; pollingTriggerLogger?: PollingTriggerLogger; } //#endregion //#region src/contracts/retryPolicySpec.types.d.ts type RetryPolicySpec = NoneRetryPolicySpec | FixedRetryPolicySpec | ExponentialRetryPolicySpec; interface NoneRetryPolicySpec { readonly kind: "none"; } interface FixedRetryPolicySpec { readonly kind: "fixed"; readonly maxAttempts: number; readonly delayMs: number; } interface ExponentialRetryPolicySpec { readonly kind: "exponential"; readonly maxAttempts: number; readonly initialDelayMs: number; readonly multiplier: number; readonly maxDelayMs?: number; readonly jitter?: boolean; } //#endregion //#region src/contracts/workflowTypes.d.ts type NodeIdRef = NodeId & Readonly<{ __codemationNodeJson?: TJson; }>; type NodeKind = "trigger" | "node"; type JsonPrimitive = string | number | boolean | null; interface JsonObject { readonly [key: string]: JsonValue; } type JsonValue = JsonPrimitive | JsonObject | JsonArray; type JsonArray = ReadonlyArray; type JsonNonArray = JsonPrimitive | JsonObject; interface Edge { from: { nodeId: NodeId; output: OutputPortKey; }; to: { nodeId: NodeId; input: InputPortKey; }; } interface WorkflowNodeConnection { readonly parentNodeId: NodeId; readonly connectionName: NodeConnectionName; readonly childNodeIds: ReadonlyArray; } interface WorkflowDefinition { id: WorkflowId; name: string; nodes: NodeDefinition[]; edges: Edge[]; readonly connections?: ReadonlyArray; discoveryPathSegments?: readonly string[]; readonly prunePolicy?: WorkflowPrunePolicySpec; readonly storagePolicy?: WorkflowStoragePolicySpec; readonly workflowErrorHandler?: WorkflowErrorHandlerSpec; } interface WorkflowGraph { next(nodeId: NodeId, output: OutputPortKey): ReadonlyArray>; } interface WorkflowGraphFactory { create(def: WorkflowDefinition): WorkflowGraph; } interface NodeConfigBase { readonly kind: NodeKind; readonly type: TypeToken; readonly name?: string; readonly id?: NodeId; readonly icon?: string; readonly description?: string; readonly execution?: Readonly<{ hint?: "local" | "worker"; queue?: string; }>; readonly retryPolicy?: RetryPolicySpec; readonly nodeErrorHandler?: NodeErrorHandlerSpec; readonly continueWhenEmptyOutput?: boolean; readonly declaredOutputPorts?: ReadonlyArray; readonly declaredInputPorts?: ReadonlyArray; getCredentialRequirements?(): ReadonlyArray; readonly emitsAssertions?: true; inspectorSummary?(): ReadonlyArray | undefined; } interface PollingTriggerConfig { getTriggerPollConfig(): Readonly<{ config: JsonObject; pollIntervalMs?: number; }>; } interface NodeInspectorSummaryRow { readonly label: string; readonly value: string; } declare const runnableNodeInputType: unique symbol; declare const runnableNodeOutputType: unique symbol; declare const triggerNodeOutputType: unique symbol; interface RunnableNodeConfig extends NodeConfigBase { readonly kind: "node"; readonly [runnableNodeInputType]?: TInputJson$1; readonly [runnableNodeOutputType]?: TOutputJson$1; readonly inputSchema?: ZodType; readonly emptyBatchExecution?: "skip" | "runOnce"; } declare const triggerNodeSetupStateType: unique symbol; interface TriggerNodeConfig extends NodeConfigBase { readonly kind: "trigger"; readonly [triggerNodeOutputType]?: TOutputJson$1; readonly [triggerNodeSetupStateType]?: TSetupState$1; readonly triggerKind?: "live" | "test"; } type RunnableNodeInputJson> = TConfig extends RunnableNodeConfig ? TInputJson : never; type RunnableNodeOutputJson> = TConfig extends RunnableNodeConfig ? TOutputJson : never; type TriggerNodeOutputJson> = TConfig extends TriggerNodeConfig ? TOutputJson : never; type TriggerNodeSetupState> = TConfig extends TriggerNodeConfig ? TSetupState : never; interface NodeDefinition { id: NodeId; kind: NodeKind; type: TypeToken; name?: string; config: NodeConfigBase; } interface NodeRef { id: NodeId; kind: NodeKind; name?: string; } declare function nodeRef(nodeId: NodeId): NodeIdRef; type PairedItemRef = Readonly<{ nodeId: NodeId; output: OutputPortKey; itemIndex: number; }>; type BinaryPreviewKind = "image" | "audio" | "video" | "download"; type BinaryAttachment = Readonly<{ id: string; storageKey: string; mimeType: string; size: number; storageDriver: string; previewKind: BinaryPreviewKind; createdAt: string; runId: RunId; workflowId: WorkflowId; nodeId: NodeId; activationId: NodeActivationId; filename?: string; sha256?: string; }>; type ItemBinary = Readonly>; type Item = Readonly<{ json: TJson; binary?: ItemBinary; meta?: Readonly>; paired?: ReadonlyArray; }>; type Items = ReadonlyArray>; type NodeOutputs = Partial>; type RunId = string; type NodeActivationId = string; type NodeIterationId = string; interface ParentExecutionRef { runId: RunId; workflowId: WorkflowId; nodeId: NodeId; subworkflowDepth?: number; engineMaxNodeActivations?: number; engineMaxSubworkflowDepth?: number; testContext?: RunTestContext; } interface RunDataSnapshot { getOutputs(nodeId: NodeId): NodeOutputs | undefined; getOutputItems(nodeId: NodeId | NodeIdRef, output?: OutputPortKey): Items; getOutputItem(nodeId: NodeId | NodeIdRef, itemIndex: number, output?: OutputPortKey): Item | undefined; } interface MutableRunData extends RunDataSnapshot { setOutputs(nodeId: NodeId, outputs: NodeOutputs): void; dump(): Record; } interface RunDataFactory { create(initial?: Record): MutableRunData; } interface RunIdFactory { makeRunId(): RunId; } interface ActivationIdFactory { makeActivationId(): NodeActivationId; } type UpstreamRefPlaceholder = `$${number}`; declare const branchRef: (index: number) => UpstreamRefPlaceholder; type ExecutionMode = "local" | "worker"; interface NodeSchedulerDecision { mode: ExecutionMode; queue?: string; } interface NodeOffloadPolicy { decide(args: { workflowId: WorkflowId; nodeId: NodeId; config: NodeConfigBase; }): NodeSchedulerDecision; } type WorkflowStoragePolicyMode = "ALL" | "SUCCESS" | "ERROR" | "NEVER"; type WorkflowStoragePolicySpec = WorkflowStoragePolicyMode | TypeToken; interface WorkflowStoragePolicyResolver { shouldPersist(args: WorkflowStoragePolicyDecisionArgs): boolean | Promise; } interface WorkflowStoragePolicyDecisionArgs { readonly runId: RunId; readonly workflowId: WorkflowId; readonly workflow: WorkflowDefinition; readonly finalStatus: "completed" | "failed"; readonly startedAt: string; readonly finishedAt: string; } interface WorkflowPrunePolicySpec { readonly runDataRetentionSeconds?: number; readonly binaryRetentionSeconds?: number; readonly telemetrySpanRetentionSeconds?: number; readonly telemetryArtifactRetentionSeconds?: number; readonly telemetryMetricRetentionSeconds?: number; } interface PersistedRunPolicySnapshot { readonly retentionSeconds?: number; readonly binaryRetentionSeconds?: number; readonly telemetrySpanRetentionSeconds?: number; readonly telemetryArtifactRetentionSeconds?: number; readonly telemetryMetricRetentionSeconds?: number; readonly storagePolicy: WorkflowStoragePolicyMode; } interface WorkflowErrorHandler { onError(ctx: WorkflowErrorContext): void | Promise; } interface WorkflowErrorContext { readonly runId: RunId; readonly workflowId: WorkflowId; readonly workflow: WorkflowDefinition; readonly failedNodeId: NodeId; readonly error: Error; readonly startedAt: string; readonly finishedAt: string; } type WorkflowErrorHandlerSpec = TypeToken | WorkflowErrorHandler; interface NodeErrorHandlerArgs { readonly kind: "single" | "multi"; readonly items: Items; readonly inputsByPort: Readonly> | undefined; readonly ctx: NodeExecutionContext; readonly error: Error; } interface NodeErrorHandler { handle(args: NodeErrorHandlerArgs): Promise; } type NodeErrorHandlerSpec = TypeToken | NodeErrorHandler; interface WorkflowPolicyRuntimeDefaults { readonly retentionSeconds?: number; readonly binaryRetentionSeconds?: number; readonly telemetrySpanRetentionSeconds?: number; readonly telemetryArtifactRetentionSeconds?: number; readonly telemetryMetricRetentionSeconds?: number; readonly storagePolicy?: WorkflowStoragePolicyMode; } //#endregion //#region src/contracts/testTriggerTypes.d.ts type TestSuiteRunId = string; interface TestTriggerSetupContext = TestTriggerNodeConfig> { readonly workflowId: WorkflowId; readonly nodeId: NodeId; readonly config: TConfig; readonly testSuiteRunId: TestSuiteRunId; getCredential(slotKey: string): Promise; readonly signal: AbortSignal; } interface TestTriggerNodeConfig extends TriggerNodeConfig { readonly triggerKind: "test"; generateItems(ctx: TestTriggerSetupContext>): AsyncIterable>; readonly concurrency?: number; readonly description?: string; caseLabel?(item: Item): string | undefined; } //#endregion //#region src/events/runEvents.d.ts type TestCaseRunStatus = "running" | "succeeded" | "failed" | "errored" | "cancelled"; type TestSuiteRunStatus = "succeeded" | "failed" | "partial" | "errored" | "cancelled"; type RunEvent = Readonly<{ kind: "runCreated"; runId: RunId; workflowId: WorkflowId; parent?: ParentExecutionRef; at: string; }> | Readonly<{ kind: "runSaved"; runId: RunId; workflowId: WorkflowId; parent?: ParentExecutionRef; at: string; state: PersistedRunState; }> | Readonly<{ kind: "nodeQueued"; runId: RunId; workflowId: WorkflowId; parent?: ParentExecutionRef; at: string; snapshot: NodeExecutionSnapshot; }> | Readonly<{ kind: "nodeStarted"; runId: RunId; workflowId: WorkflowId; parent?: ParentExecutionRef; at: string; snapshot: NodeExecutionSnapshot; }> | Readonly<{ kind: "nodeCompleted"; runId: RunId; workflowId: WorkflowId; parent?: ParentExecutionRef; at: string; snapshot: NodeExecutionSnapshot; }> | Readonly<{ kind: "nodeFailed"; runId: RunId; workflowId: WorkflowId; parent?: ParentExecutionRef; at: string; snapshot: NodeExecutionSnapshot; }> | Readonly<{ kind: "connectionInvocationStarted"; runId: RunId; workflowId: WorkflowId; parent?: ParentExecutionRef; at: string; record: ConnectionInvocationRecord; }> | Readonly<{ kind: "connectionInvocationCompleted"; runId: RunId; workflowId: WorkflowId; parent?: ParentExecutionRef; at: string; record: ConnectionInvocationRecord; }> | Readonly<{ kind: "connectionInvocationFailed"; runId: RunId; workflowId: WorkflowId; parent?: ParentExecutionRef; at: string; record: ConnectionInvocationRecord; }> | Readonly<{ kind: "testSuiteStarted"; testSuiteRunId: TestSuiteRunId; workflowId: WorkflowId; triggerNodeId: string; triggerNodeName?: string; concurrency: number; at: string; }> | Readonly<{ kind: "testSuiteFinished"; testSuiteRunId: TestSuiteRunId; workflowId: WorkflowId; status: TestSuiteRunStatus; totalCases: number; passedCases: number; failedCases: number; at: string; }> | Readonly<{ kind: "testCaseStarted"; testSuiteRunId: TestSuiteRunId; testCaseIndex: number; runId: RunId; workflowId: WorkflowId; testCaseLabel?: string; at: string; }> | Readonly<{ kind: "testCaseCompleted"; testSuiteRunId: TestSuiteRunId; testCaseIndex: number; runId: RunId; workflowId: WorkflowId; status: TestCaseRunStatus; at: string; }>; interface RunEventSubscription { close(): Promise; } interface RunEventBus { publish(event: RunEvent): Promise; subscribe(onEvent: (event: RunEvent) => void): Promise; subscribeToWorkflow(workflowId: WorkflowId, onEvent: (event: RunEvent) => void): Promise; } //#endregion //#region src/policies/executionLimits/EngineExecutionLimitsPolicy.d.ts interface EngineExecutionLimitsPolicyConfig { readonly defaultMaxNodeActivations: number; readonly hardMaxNodeActivations: number; readonly defaultMaxSubworkflowDepth: number; readonly hardMaxSubworkflowDepth: number; } declare const ENGINE_EXECUTION_LIMITS_DEFAULTS: EngineExecutionLimitsPolicyConfig; declare class EngineExecutionLimitsPolicy { private readonly config; constructor(config?: EngineExecutionLimitsPolicyConfig); createRootExecutionOptions(): RunExecutionOptions; mergeExecutionOptionsForNewRun(parent: ParentExecutionRef | undefined, user: RunExecutionOptions | undefined): RunExecutionOptions; private capNumber; } //#endregion //#region src/contracts/triggerInvokerTypes.d.ts interface TriggerInvoker { invoke(trigger: TriggerInstanceId, config: TriggerNodeConfig, lastRanAt: string | undefined): Promise; } //#endregion //#region src/di/CoreTokens.d.ts declare const CoreTokens: { readonly PersistedWorkflowTokenRegistry: TypeToken; readonly CredentialSessionService: TypeToken; readonly CredentialTypeRegistry: TypeToken; readonly WorkflowRunnerService: TypeToken; readonly LiveWorkflowRepository: TypeToken; readonly WorkflowRepository: TypeToken; readonly NodeResolver: TypeToken; readonly WorkflowNodeInstanceFactory: TypeToken; readonly RunIdFactory: TypeToken; readonly ActivationIdFactory: TypeToken; readonly WorkflowExecutionRepository: TypeToken; readonly TriggerSetupStateRepository: TypeToken; readonly NodeActivationScheduler: TypeToken; readonly RunDataFactory: TypeToken; readonly ExecutionContextFactory: TypeToken; readonly RunEventBus: TypeToken; readonly BinaryStorage: TypeToken; readonly WebhookBasePath: TypeToken; readonly EngineExecutionLimitsPolicy: TypeToken; readonly WorkflowActivationPolicy: TypeToken; readonly AgentMcpIntegration: TypeToken; readonly TriggerInvoker: TypeToken; }; //#endregion //#region src/contracts/runTypes.d.ts interface RunTestContext { readonly testSuiteRunId: string; readonly testCaseIndex: number; readonly testCaseLabel?: string; } interface RunExecutionOptions { localOnly?: boolean; webhook?: boolean; mode?: "manual" | "debug"; sourceWorkflowId?: WorkflowId; sourceRunId?: RunId; derivedFromRunId?: RunId; isMutable?: boolean; subworkflowDepth?: number; maxNodeActivations?: number; maxSubworkflowDepth?: number; testContext?: RunTestContext; } interface EngineRunCounters { completedNodeActivations: number; } type RunStopCondition = Readonly<{ kind: "workflowCompleted"; }> | Readonly<{ kind: "nodeCompleted"; nodeId: NodeId; }>; interface RunStateResetRequest { clearFromNodeId: NodeId; } interface PersistedRunControlState { stopCondition?: RunStopCondition; } interface PersistedWorkflowSnapshotNode { id: NodeId; kind: NodeKind; name?: string; nodeTokenId: PersistedTokenId; configTokenId: PersistedTokenId; tokenName?: string; configTokenName?: string; config: unknown; inspectorSummary?: ReadonlyArray>; } interface PersistedWorkflowSnapshot { id: WorkflowId; name: string; nodes: ReadonlyArray; edges: ReadonlyArray; workflowErrorHandlerConfigured?: boolean; connections?: ReadonlyArray; } type PinnedNodeOutputsByPort = Readonly>; interface PersistedMutableNodeState { pinnedOutputsByPort?: PinnedNodeOutputsByPort; lastDebugInput?: Items; } interface PersistedMutableRunState { nodesById: Readonly>; } type NodeInputsByPort = Readonly>; interface RunQueueEntry { nodeId: NodeId; input: Items; toInput?: InputPortKey; batchId?: string; from?: Readonly<{ nodeId: NodeId; output: OutputPortKey; }>; collect?: Readonly<{ expectedInputs: ReadonlyArray; received: Readonly>; }>; } type NodeExecutionStatus = "pending" | "queued" | "running" | "completed" | "failed" | "skipped" | "hitl-approved" | "hitl-rejected" | "hitl-timeout" | "hitl-auto-accepted" | "hitl-cancelled"; interface NodeExecutionError { message: string; name?: string; stack?: string; details?: JsonValue; } interface NodeExecutionSnapshot { runId: RunId; workflowId: WorkflowId; nodeId: NodeId; activationId?: NodeActivationId; parent?: ParentExecutionRef; status: NodeExecutionStatus; usedPinnedOutput?: boolean; queuedAt?: string; startedAt?: string; finishedAt?: string; updatedAt: string; inputsByPort?: NodeInputsByPort; outputs?: NodeOutputs; error?: NodeExecutionError; childRunId?: RunId; } type ConnectionInvocationId = string; interface ConnectionInvocationRecord { readonly invocationId: ConnectionInvocationId; readonly runId: RunId; readonly workflowId: WorkflowId; readonly connectionNodeId: NodeId; readonly parentAgentNodeId: NodeId; readonly parentAgentActivationId: NodeActivationId; readonly status: NodeExecutionStatus; readonly managedInput?: JsonValue; readonly managedOutput?: JsonValue; readonly statusLabel?: string; readonly subjectName?: string; readonly error?: NodeExecutionError; readonly queuedAt?: string; readonly startedAt?: string; readonly finishedAt?: string; readonly updatedAt: string; readonly iterationId?: NodeIterationId; readonly itemIndex?: number; readonly parentInvocationId?: ConnectionInvocationId; } type ConnectionInvocationAppendArgs = Readonly<{ invocationId: ConnectionInvocationId; connectionNodeId: NodeId; parentAgentNodeId: NodeId; parentAgentActivationId: NodeActivationId; status: NodeExecutionStatus; managedInput?: JsonValue; managedOutput?: JsonValue; statusLabel?: string; subjectName?: string; error?: NodeExecutionError; queuedAt?: string; startedAt?: string; finishedAt?: string; iterationId?: NodeIterationId; itemIndex?: number; parentInvocationId?: ConnectionInvocationId; }>; interface RunCurrentState { outputsByNode: Record; nodeSnapshotsByNodeId: Record; connectionInvocations?: ReadonlyArray; mutableState?: PersistedMutableRunState; } interface CurrentStateExecutionRequest { workflow: WorkflowDefinition; items?: Items; parent?: ParentExecutionRef; executionOptions?: RunExecutionOptions; workflowSnapshot?: PersistedWorkflowSnapshot; mutableState?: PersistedMutableRunState; currentState?: RunCurrentState; stopCondition?: RunStopCondition; reset?: RunStateResetRequest; } interface ExecutionFrontierPlan { rootNodeId?: NodeId; rootNodeInput?: Items; queue: RunQueueEntry[]; currentState: RunCurrentState; stopCondition: RunStopCondition; satisfiedNodeIds: ReadonlyArray; skippedNodeIds: ReadonlyArray; clearedNodeIds: ReadonlyArray; preservedPinnedNodeIds: ReadonlyArray; } type RunStatus = "running" | "pending" | "completed" | "failed" | "suspended" | "halted"; type RunHaltReason = "hitl-rejected" | "hitl-timeout" | "hitl-cancelled"; interface RunSummary { runId: RunId; workflowId: WorkflowId; startedAt: string; status: RunStatus; testCaseStatus?: TestCaseRunStatus; finishedAt?: string; parent?: ParentExecutionRef; executionOptions?: RunExecutionOptions; } interface PendingNodeExecution { runId: RunId; activationId: NodeActivationId; workflowId: WorkflowId; nodeId: NodeId; itemsIn: number; inputsByPort: NodeInputsByPort; receiptId: string; queue?: string; batchId?: string; enqueuedAt: string; } interface PersistedRunSchedulingState { pending?: PendingNodeExecution; queue: RunQueueEntry[]; } interface PersistedSuspensionEntry { readonly taskId: string; readonly nodeId: NodeId; readonly activationId: NodeActivationId; readonly itemIndex: number; readonly decisionSchemaHash: string; readonly deliveryRef: JsonValue; readonly timeoutAt: string; readonly onTimeout: "halt" | "auto-accept"; } interface PendingResumeEntry { readonly activationId: NodeActivationId; readonly nodeId: NodeId; readonly resumeContext: unknown; } interface PersistedRunState { runId: RunId; workflowId: WorkflowId; startedAt: string; finishedAt?: string; revision?: number; parent?: ParentExecutionRef; executionOptions?: RunExecutionOptions; control?: PersistedRunControlState; workflowSnapshot?: PersistedWorkflowSnapshot; mutableState?: PersistedMutableRunState; policySnapshot?: PersistedRunPolicySnapshot; engineCounters?: EngineRunCounters; status: RunStatus; reason?: RunHaltReason; pending?: PendingNodeExecution; queue: RunQueueEntry[]; outputsByNode: Record; nodeSnapshotsByNodeId: Record; connectionInvocations?: ReadonlyArray; suspension?: ReadonlyArray; pendingResume?: PendingResumeEntry; } interface WorkflowExecutionRepository { createRun(args: { runId: RunId; workflowId: WorkflowId; startedAt: string; parent?: ParentExecutionRef; executionOptions?: RunExecutionOptions; control?: PersistedRunControlState; workflowSnapshot?: PersistedWorkflowSnapshot; mutableState?: PersistedMutableRunState; policySnapshot?: PersistedRunPolicySnapshot; engineCounters?: EngineRunCounters; }): Promise; load(runId: RunId): Promise; loadSchedulingState(runId: RunId): Promise; save(state: PersistedRunState): Promise; deleteRun?(runId: RunId): Promise; } interface WorkflowExecutionListingRepository { listRuns(args?: Readonly<{ workflowId?: WorkflowId; limit?: number; }>): Promise>; } interface RunPruneCandidate { readonly runId: RunId; readonly workflowId: WorkflowId; readonly startedAt: string; readonly finishedAt: string; } interface WorkflowExecutionPruneRepository { listRunsOlderThan(args: Readonly<{ nowIso: string; defaultRetentionSeconds: number; limit?: number; }>): Promise>; } type RunResult = { runId: RunId; workflowId: WorkflowId; startedAt: string; status: "completed"; outputs: Items; } | { runId: RunId; workflowId: WorkflowId; startedAt: string; status: "pending"; pending: PendingNodeExecution; } | { runId: RunId; workflowId: WorkflowId; startedAt: string; status: "failed"; error: { message: string; }; } | { runId: RunId; workflowId: WorkflowId; startedAt: string; status: "halted"; reason: RunHaltReason; }; type WebhookRunResult = Readonly<{ runId: RunId; workflowId: WorkflowId; startedAt: string; runStatus: "pending" | "completed"; response: Items; }>; interface PersistedWorkflowTokenRegistryLike { register(type: TypeToken, packageId: string, persistedNameOverride?: string): string; getTokenId(type: TypeToken): string | undefined; resolve(tokenId: string): TypeToken | undefined; registerFromWorkflows?(workflows: ReadonlyArray): void; } interface RunCompletionNotifier { resolveRunCompletion(result: RunResult): void; resolveWebhookResponse(result: WebhookRunResult): void; } interface RunEventPublisherDeps { eventBus?: RunEventBus; } //#endregion //#region src/contracts/agentMcpTypes.d.ts interface NeedsReconsentEvent { readonly serverId: string; readonly credentialInstanceId: string; readonly missingScopesHint?: readonly string[]; } type AgentMcpToolMap = ReadonlyMap>>; interface AgentMcpIntegration { prepareMcpTools(args: { readonly workflowId: WorkflowId; readonly agentNodeId: NodeId; readonly serverIds: ReadonlyArray; readonly pinnedMcpTools: readonly string[]; readonly emitSpanEvent: (event: TelemetrySpanEventRecord) => void; readonly startChildSpan: (args: { readonly name: string; readonly attributes?: Record; }) => { readonly end: (args?: { status?: "ok" | "error"; statusMessage?: string; }) => void; }; readonly appendMcpInvocation?: (args: ConnectionInvocationAppendArgs) => Promise; readonly parentAgentActivationId?: NodeActivationId; readonly iterationId?: NodeIterationId; readonly itemIndex?: number; readonly parentInvocationId?: ConnectionInvocationId; }): Promise; } //#endregion export { injectAll as $, OutputPortKey as $i, NodeActivationContinuation as $n, TelemetrySpanEnd as $r, RunId as $t, RunHaltReason as A, CredentialInstanceId as Ai, RetryPolicySpec as An, WorkflowRunnerResolver as Ar, JsonPrimitive as At, WorkflowExecutionListingRepository as B, CredentialSetupStatus as Bi, EngineDeps as Bn, WebhookTriggerRoutingDiagnostics as Br, NodeInspectorSummaryRow as Bt, PersistedWorkflowSnapshotNode as C, CredentialAuthDefinition as Ci, runnableNodeInputType as Cn, TriggerRuntimeDiagnostics as Cr, ExecutionMode as Ct, RunCurrentState as D, CredentialHealth as Di, ExponentialRetryPolicySpec as Dn, TriggerTestItemsContext as Dr, JsonArray as Dt, RunCompletionNotifier as E, CredentialFieldSchema as Ei, triggerNodeSetupStateType as En, TriggerSetupStateRepository as Er, Items as Et, RunStatus as F, CredentialOAuth2ScopesFromPublicConfig as Fi, BinaryStorageReadResult as Fn, TriggerInstanceId as Fr, NodeDefinition as Ft, Disposable as G, CredentialUnboundError as Gi, ExecutionContextFactory as Gn, NodeExecutionTelemetry as Gr, NodeRef as Gt, WorkflowExecutionRepository as H, CredentialTypeDefinition as Hi, ExecutableTriggerNode as Hn, WorkflowActivationPolicy as Hr, NodeKind as Ht, RunStopCondition as I, CredentialRequirement as Ii, BinaryStorageStatResult as In, WebhookControlSignal as Ir, NodeErrorHandler as It, RegistrationOptions as J, PollingTriggerLogger as Ji, HumanTaskId as Jn, TelemetryAttributePrimitive as Jr, ParentExecutionRef as Jt, InjectionToken$1 as K, OAuth2ProviderFromPublicConfig as Ki, HumanTaskActor as Kn, TelemetryArtifactAttachment as Kr, NodeSchedulerDecision as Kt, RunSummary as L, CredentialSessionFactory as Li, BinaryStorageWriteRequest as Ln, WebhookInvocationMatch as Lr, NodeErrorHandlerArgs as Lt, RunQueueEntry as M, CredentialJsonRecord as Mi, BinaryAttachmentCreateRequest as Mn, WorkflowSnapshotFactory as Mr, MutableRunData as Mt, RunResult as N, CredentialMaterialSourceKind as Ni, BinaryBody as Nn, WorkflowSnapshotResolver as Nr, NodeActivationId as Nt, RunEventPublisherDeps as O, CredentialHealthStatus as Oi, FixedRetryPolicySpec as On, WorkflowNodeInstanceFactory as Or, JsonNonArray as Ot, RunStateResetRequest as P, CredentialOAuth2AuthDefinition as Pi, BinaryStorage as Pn, HttpMethod as Pr, NodeConfigBase as Pt, inject as Q, NodeId as Qi, MultiInputNode as Qn, TelemetryScope as Qr, RunDataSnapshot as Qt, RunTestContext as R, CredentialSessionFactoryArgs as Ri, BinaryStorageWriteResult as Rn, WebhookTriggerMatcher as Rr, NodeErrorHandlerSpec as Rt, PersistedWorkflowSnapshot as S, CredentialAdvancedSectionPresentation as Si, nodeRef as Sn, TriggerPollingPort as Sr, Edge as St, PinnedNodeOutputsByPort as T, CredentialBindingKey as Ti, triggerNodeOutputType as Tn, TriggerSetupStateFor as Tr, ItemBinary as Tt, Container as U, CredentialTypeId as Ui, ExecutionBinaryService as Un, ExecutionTelemetry as Ur, NodeOffloadPolicy as Ut, WorkflowExecutionPruneRepository as V, CredentialType as Vi, EngineHost as Vn, AllWorkflowsActiveWorkflowActivationPolicy as Vr, NodeIterationId as Vt, DependencyContainer$1 as W, CredentialTypeRegistry as Wi, ExecutionContext as Wn, ExecutionTelemetryFactory as Wr, NodeOutputs as Wt, container as X, InputPortKey as Xi, ItemNode as Xn, TelemetryChildSpanStart as Xr, PollingTriggerConfig as Xt, TypeToken as Y, PollingTriggerDedupWindow as Yi, HumanTaskSubject as Yn, TelemetryAttributes as Yr, PersistedRunPolicySnapshot as Yt, delay as Z, NodeConnectionName as Zi, LiveWorkflowRepository as Zn, TelemetryMetricRecord as Zr, RunDataFactory as Zt, PersistedMutableRunState as _, CollectionStore as _i, WorkflowStoragePolicyDecisionArgs as _n, RunnableNodeExecuteArgs as _r, TestTriggerNodeConfig as _t, ConnectionInvocationId as a, NoOpExecutionTelemetryFactory as ai, TriggerNodeOutputJson as an, NodeExecutionContext as ar, singleton as at, PersistedRunState as b, CredentialAccessTokenSessionArgs as bi, WorkflowStoragePolicySpec as bn, TriggerCleanupHandle as br, BinaryAttachment as bt, EngineRunCounters as c, NoOpTelemetrySpanScope as ci, WorkflowDefinition as cn, NodeExecutionScheduler as cr, ENGINE_EXECUTION_LIMITS_DEFAULTS as ct, NodeExecutionSnapshot as d, CostTrackingPriceQuote as di, WorkflowErrorHandlerSpec as dn, NodeResolver as dr, RunEvent as dt, PersistedTokenId as ea, TelemetrySpanEventRecord as ei, RunIdFactory as en, NodeActivationReceipt as er, injectable as et, NodeExecutionStatus as f, CostTrackingTelemetry as fi, WorkflowGraph as fn, PersistedTriggerSetupState as fr, RunEventBus as ft, PersistedMutableNodeState as g, CostTrackingUsageRecord as gi, WorkflowPrunePolicySpec as gn, RunnableNode as gr, TestSuiteRunId as gt, PendingResumeEntry as h, CostTrackingTelemetryMetricNames as hi, WorkflowPolicyRuntimeDefaults as hn, ResumeContext as hr, TestSuiteRunStatus as ht, ConnectionInvocationAppendArgs as i, CodemationTelemetryAttributeNames as ii, TriggerNodeConfig as in, NodeBinaryAttachmentService as ir, registry as it, RunPruneCandidate as j, CredentialInstanceRecord as ji, BINARY_DEFAULT_MAX_BYTES as jn, WorkflowRunnerService as jr, JsonValue as jt, RunExecutionOptions as k, CredentialHealthTester as ki, NoneRetryPolicySpec as kn, WorkflowRepository as kr, JsonObject as kt, ExecutionFrontierPlan as l, NoOpTelemetryArtifactReference as li, WorkflowErrorContext as ln, NodeExecutionStatePublisher as lr, EngineExecutionLimitsPolicy as lt, PendingNodeExecution as m, CostTrackingTelemetryFactory as mi, WorkflowNodeConnection as mn, PreparedNodeActivationDispatch as mr, TestCaseRunStatus as mt, AgentMcpToolMap as n, CodemationTelemetryMetricNames as ni, RunnableNodeInputJson as nn, NodeActivationRequestBase as nr, instancePerContainerCachingFactory as nt, ConnectionInvocationRecord as o, NoOpExecutionTelemetry as oi, TriggerNodeSetupState as on, NodeExecutionRequest as or, CoreTokens as ot, NodeInputsByPort as p, CostTrackingTelemetryAttributeNames as pi, WorkflowGraphFactory as pn, PollingTriggerHandle as pr, RunEventSubscription as pt, Lifecycle as q, NoOpPollingTriggerLogger as qi, HumanTaskHandle as qn, TelemetryArtifactReference as qr, PairedItemRef as qt, NeedsReconsentEvent as r, GenAiTelemetryAttributeNames as ri, RunnableNodeOutputJson as rn, NodeActivationScheduler as rr, predicateAwareClassFactory as rt, CurrentStateExecutionRequest as s, NoOpNodeExecutionTelemetry as si, UpstreamRefPlaceholder as sn, NodeExecutionRequestHandler as sr, TriggerInvoker as st, AgentMcpIntegration as t, WorkflowId as ta, TelemetrySpanScope as ti, RunnableNodeConfig as tn, NodeActivationRequest as tr, instanceCachingFactory as tt, NodeExecutionError as u, CostTrackingComponent as ui, WorkflowErrorHandler as un, NodeExecutor as ur, EngineExecutionLimitsPolicyConfig as ut, PersistedRunControlState as v, CollectionsContext as vi, WorkflowStoragePolicyMode as vn, SuspensionRequest as vr, TestTriggerSetupContext as vt, PersistedWorkflowTokenRegistryLike as w, CredentialBinding as wi, runnableNodeOutputType as wn, TriggerSetupContext as wr, Item as wt, PersistedSuspensionEntry as x, CredentialAccessTokenSessionFactory as xi, branchRef as xn, TriggerNode as xr, BinaryPreviewKind as xt, PersistedRunSchedulingState as y, AnyCredentialType as yi, WorkflowStoragePolicyResolver as yn, TestableTriggerNode as yr, ActivationIdFactory as yt, WebhookRunResult as z, CredentialSessionService as zi, Duration as zn, WebhookTriggerResolution as zr, NodeIdRef as zt }; //# sourceMappingURL=agentMcpTypes-BHX4RQCC.d.cts.map