dag-core / Exports
dag-core
Table of contents
Classes
- DagDefinitionService
- DagDefinitionValidator
- LifecycleTaskExecutorPort
- RunCostPolicyEvaluator
- NodeLifecycleRunner
- MissingNodeLifecycleFactory
- TimeSemanticsService
- DagRunStateMachine
- TaskRunStateMachine
Interfaces
- IStoredAssetMetadata
- ICreateAssetInput
- ICreateAssetReferenceInput
- IAssetContentResult
- IAssetStore
- IPortBinaryValue
- IQueueMessage
- IQueuePort
- ILeaseRecord
- ILeasePort
- IStoragePort
- ITaskExecutionInput
- ITaskExecutionSuccess
- ITaskExecutionFailure
- ITaskExecutorPort
- IClockPort
- IPromptBackendPort
- IRunNodeInput
- IResolvedTimeSemantics
- IDagRunTransitionValue
- ITaskRunTransitionValue
- INodeConfigObject
- IAssetReferenceBase
- IAssetReferenceByAssetId
- IAssetReferenceByUri
- IPortDefinition
- INodeManifest
- ICostPolicy
- IDagNode
- IEdgeBinding
- IDagEdgeDefinition
- IDagDefinition
- IDagRun
- ITaskRun
- IExecutionPathSegment
- IDagError
- ICostEstimate
- INodeExecutionContext
- INodeExecutionResult
- INodeLifecycle
- INodeLifecycleFactory
- INodeManifestRegistry
- INodeTaskHandler
- INodeTaskHandlerRegistry
- IDagNodeDefinition
- INodeDefinitionAssembly
- IRunCostPolicyEvaluator
- IPromptNodeDef
- IWorkflowJson
- IPromptRequest
- INodeError
- IPromptResponse
- IQueueStatus
- IQueueAction
- IOutputAsset
- IHistoryEntry
- INodeObjectInfo
- ISystemStats
- IRunProgressEventBase
- IExecutionStartedProgressEvent
- IExecutionCompletedProgressEvent
- IExecutionFailedProgressEvent
- ITaskStartedProgressEvent
- ITaskCompletedProgressEvent
- ITaskFailedProgressEvent
- IRunProgressEventReporter
- IRunNodeTrace
- IRunNodeError
- IRunResult
Type Aliases
- TPortPrimitive
- TPortBinaryKind
- TBinaryReferenceType
- TPortObjectValue
- TPortArrayValue
- TPortValue
- TPortPayload
- TTaskExecutionResult
- TDagRunTransitionEvent
- TTaskRunTransitionEvent
- TDagDefinitionStatus
- TPortValueType
- TBinaryKind
- TNodeConfigPrimitive
- TNodeConfigValue
- TNodeConfigRecord
- TAssetReferenceType
- TAssetReference
- TDagRunStatus
- TTaskRunStatus
- TDagTriggerType
- TErrorCategory
- TPromptLink
- TPromptInputValue
- TPrompt
- THistory
- TInputTypeSpec
- TObjectInfo
- TResult
- TRunProgressEventType
- TRunProgressEvent
Variables
- RUN_EVENT_PREFIX
- TASK_EVENT_PREFIX
- WORKER_EVENT_PREFIX
- SCHEDULER_EVENT_PREFIX
- EXECUTION_EVENT_PREFIX
- RUN_EVENTS
- TASK_EVENTS
- WORKER_EVENTS
- SCHEDULER_EVENTS
- EXECUTION_PROGRESS_EVENTS
- TASK_PROGRESS_EVENTS
- DAG_DEFINITION_STATUS
- DAG_RUN_STATUS
- TASK_RUN_STATUS
- DAG_CORE_PACKAGE_NAME
Functions
- validateEdgesAndBindings
- buildListPortHandleKey
- parseListPortHandleKey
- isPromptLink
- buildDagError
- buildValidationError
- buildDispatchError
- buildLeaseError
- buildTaskExecutionError
Type Aliases
TPortPrimitive
Ƭ TPortPrimitive: string | number | boolean | null
Primitive value types that can flow through node ports.
Defined in
TPortBinaryKind
Ƭ TPortBinaryKind: "image" | "video" | "audio" | "file"
Kind of binary content carried in a port payload.
Defined in
TBinaryReferenceType
Ƭ TBinaryReferenceType: "asset" | "uri"
Resolution strategy for binary references.
Defined in
TPortObjectValue
Ƭ TPortObjectValue: Record<string, TPortPrimitive>
A flat key-value object within a port payload.
Defined in
TPortArrayValue
Ƭ TPortArrayValue: TPortValue[]
An ordered list of port values.
Defined in
TPortValue
Ƭ TPortValue: TPortPrimitive | IPortBinaryValue | TPortArrayValue | TPortObjectValue
Any value that can appear in a single port slot.
Defined in
TPortPayload
Ƭ TPortPayload: Record<string, TPortValue>
Keyed collection of port values — the data flowing between DAG nodes.
Defined in
TTaskExecutionResult
Ƭ TTaskExecutionResult: ITaskExecutionSuccess | ITaskExecutionFailure
Discriminated union of task execution outcomes.
Defined in
TDagRunTransitionEvent
Ƭ TDagRunTransitionEvent: "QUEUE" | "START" | "COMPLETE_SUCCESS" | "COMPLETE_FAILURE" | "CANCEL"
Events that can trigger a DAG run state transition.
Defined in
state-machines/dag-run-state-machine.ts:7
TTaskRunTransitionEvent
Ƭ TTaskRunTransitionEvent: "QUEUE" | "START" | "COMPLETE_SUCCESS" | "COMPLETE_FAILURE" | "UPSTREAM_FAIL" | "SKIP" | "RETRY" | "CANCEL"
Events that can trigger a task run state transition.
Defined in
state-machines/task-run-state-machine.ts:7
TDagDefinitionStatus
Ƭ TDagDefinitionStatus: "draft" | "published" | "deprecated"
Publication state of a DAG definition.
Defined in
TPortValueType
Ƭ TPortValueType: "string" | "number" | "boolean" | "object" | "array" | "binary"
Supported value types for node port definitions.
Defined in
TBinaryKind
Ƭ TBinaryKind: "image" | "video" | "audio" | "file"
Kind of binary data a port can accept or produce.
Defined in
TNodeConfigPrimitive
Ƭ TNodeConfigPrimitive: string | number | boolean | null
Primitive values allowed in node configuration.
Defined in
TNodeConfigValue
Ƭ TNodeConfigValue: TNodeConfigPrimitive | INodeConfigObject | TNodeConfigValue[]
Any value that can appear inside a node's config.
Defined in
TNodeConfigRecord
Ƭ TNodeConfigRecord: INodeConfigObject
Top-level node configuration record. Alias for INodeConfigObject.
Defined in
TAssetReferenceType
Ƭ TAssetReferenceType: "asset" | "uri"
Discriminant for asset reference resolution strategy.
Defined in
TAssetReference
Ƭ TAssetReference: IAssetReferenceByAssetId | IAssetReferenceByUri
Discriminated union of asset references — either by asset ID or by URI.
Defined in
TDagRunStatus
Ƭ TDagRunStatus: "created" | "queued" | "running" | "success" | "failed" | "cancelled"
Lifecycle status of a DAG run. Terminal states: success, failed, cancelled.
Defined in
TTaskRunStatus
Ƭ TTaskRunStatus: "created" | "queued" | "running" | "success" | "failed" | "upstream_failed" | "skipped" | "cancelled"
Lifecycle status of a task run. Terminal states: success, failed, upstream_failed, skipped, cancelled.
Defined in
TDagTriggerType
Ƭ TDagTriggerType: "manual" | "scheduled" | "api"
How a DAG run was initiated.
Defined in
TErrorCategory
Ƭ TErrorCategory: "validation" | "state_transition" | "lease" | "dispatch" | "task_execution"
Classification of DAG errors by their origin and nature.
Defined in
TPromptLink
Ƭ TPromptLink: [string, number]
Link reference: [sourceNodeId, outputSlotIndex]
Defined in
TPromptInputValue
Ƭ TPromptInputValue: string | number | boolean | TPromptLink
A single input value: scalar or link
Defined in
TPrompt
Ƭ TPrompt: Record<string, IPromptNodeDef>
OpenAPI: Prompt schema — nodeId → node definition
Defined in
THistory
Ƭ THistory: Record<string, IHistoryEntry>
Defined in
TInputTypeSpec
Ƭ TInputTypeSpec: [string] | [string, Record<string, unknown>]
Defined in
TObjectInfo
Ƭ TObjectInfo: Record<string, INodeObjectInfo>
Defined in
TResult
Ƭ TResult<TValue, TError>: { ok: true ; value: TValue } | { ok: false ; error: TError }
Discriminated union representing either a successful value or an error.
Type parameters
| Name |
|---|
TValue |
TError |
Defined in
TRunProgressEventType
Ƭ TRunProgressEventType: "execution.started" | "execution.completed" | "execution.failed" | "task.started" | "task.completed" | "task.failed"
Discriminant for run progress event types covering execution and task phases.
Defined in
TRunProgressEvent
Ƭ TRunProgressEvent: IExecutionStartedProgressEvent | IExecutionCompletedProgressEvent | IExecutionFailedProgressEvent | ITaskStartedProgressEvent | ITaskCompletedProgressEvent | ITaskFailedProgressEvent
Union of all run progress event types.
Defined in
Variables
RUN_EVENT_PREFIX
• Const RUN_EVENT_PREFIX: "run"
Event name prefix for DAG run lifecycle events.
Defined in
TASK_EVENT_PREFIX
• Const TASK_EVENT_PREFIX: "task"
Event name prefix for task lifecycle events.
Defined in
WORKER_EVENT_PREFIX
• Const WORKER_EVENT_PREFIX: "worker"
Event name prefix for worker lifecycle events.
Defined in
SCHEDULER_EVENT_PREFIX
• Const SCHEDULER_EVENT_PREFIX: "scheduler"
Event name prefix for scheduler lifecycle events.
Defined in
EXECUTION_EVENT_PREFIX
• Const EXECUTION_EVENT_PREFIX: "execution"
Event name prefix for execution progress events.
Defined in
RUN_EVENTS
• Const RUN_EVENTS: Object
DAG run lifecycle event names.
Type declaration
| Name | Type |
|---|---|
CREATED | "created" |
QUEUED | "queued" |
RUNNING | "running" |
SUCCESS | "success" |
FAILED | "failed" |
CANCELLED | "cancelled" |
Defined in
TASK_EVENTS
• Const TASK_EVENTS: Object
Task lifecycle event names.
Type declaration
| Name | Type |
|---|---|
CREATED | "created" |
QUEUED | "queued" |
RUNNING | "running" |
SUCCESS | "success" |
FAILED | "failed" |
UPSTREAM_FAILED | "upstream_failed" |
SKIPPED | "skipped" |
CANCELLED | "cancelled" |
Defined in
WORKER_EVENTS
• Const WORKER_EVENTS: Object
Worker lifecycle event names.
Type declaration
| Name | Type |
|---|---|
LEASE_ACQUIRED | "lease_acquired" |
HEARTBEAT | "heartbeat" |
LEASE_EXPIRED | "lease_expired" |
EXECUTION_COMPLETE | "execution_complete" |
Defined in
SCHEDULER_EVENTS
• Const SCHEDULER_EVENTS: Object
Scheduler lifecycle event names.
Type declaration
| Name | Type |
|---|---|
EVALUATED | "evaluated" |
TRIGGERED | "triggered" |
SKIPPED | "skipped" |
Defined in
EXECUTION_PROGRESS_EVENTS
• Const EXECUTION_PROGRESS_EVENTS: Object
Execution-level progress event names.
Type declaration
| Name | Type |
|---|---|
STARTED | "execution.started" |
COMPLETED | "execution.completed" |
FAILED | "execution.failed" |
Defined in
TASK_PROGRESS_EVENTS
• Const TASK_PROGRESS_EVENTS: Object
Task-level progress event names.
Type declaration
| Name | Type |
|---|---|
STARTED | "task.started" |
COMPLETED | "task.completed" |
FAILED | "task.failed" |
Defined in
DAG_DEFINITION_STATUS
• Const DAG_DEFINITION_STATUS: Object
Constant enum for DAG definition publication statuses.
Type declaration
| Name | Type |
|---|---|
DRAFT | "draft" |
PUBLISHED | "published" |
DEPRECATED | "deprecated" |
Defined in
DAG_RUN_STATUS
• Const DAG_RUN_STATUS: Object
Constant enum for DAG run lifecycle statuses.
Type declaration
| Name | Type |
|---|---|
CREATED | "created" |
QUEUED | "queued" |
RUNNING | "running" |
SUCCESS | "success" |
FAILED | "failed" |
CANCELLED | "cancelled" |
Defined in
TASK_RUN_STATUS
• Const TASK_RUN_STATUS: Object
Constant enum for task run lifecycle statuses.
Type declaration
| Name | Type |
|---|---|
CREATED | "created" |
QUEUED | "queued" |
RUNNING | "running" |
SUCCESS | "success" |
FAILED | "failed" |
UPSTREAM_FAILED | "upstream_failed" |
SKIPPED | "skipped" |
CANCELLED | "cancelled" |
Defined in
DAG_CORE_PACKAGE_NAME
• Const DAG_CORE_PACKAGE_NAME: "@robota-sdk/dag-core"
Defined in
Functions
validateEdgesAndBindings
▸ validateEdgesAndBindings(definition, nodeIdSet, nodeById): IDagError[]
Validates edges, bindings, cross-edge input key conflicts, and cycle detection for a DAG definition.
Parameters
| Name | Type |
|---|---|
definition | IDagDefinition |
nodeIdSet | Set<string> |
nodeById | Map<string, IDagNode> |
Returns
Defined in
services/definition-edge-validator.ts:76
buildListPortHandleKey
▸ buildListPortHandleKey(portKey, index): string
Build a handle key for an indexed list port element, e.g. "images[0]".
Parameters
| Name | Type |
|---|---|
portKey | string |
index | number |
Returns
string
Defined in
parseListPortHandleKey
▸ parseListPortHandleKey(handleKey): { portKey: string ; index: number } | undefined
Parse a list port handle key back into its port key and index. Returns undefined if the key is not a valid list handle.
Parameters
| Name | Type |
|---|---|
handleKey | string |
Returns
{ portKey: string ; index: number } | undefined
Defined in
isPromptLink
▸ isPromptLink(value): value is TPromptLink
Parameters
| Name | Type |
|---|---|
value | TPromptInputValue |
Returns
value is TPromptLink
Defined in
buildDagError
▸ buildDagError(category, code, message, retryable, context?): IDagError
Create a structured IDagError with all required fields.
Parameters
| Name | Type |
|---|---|
category | TErrorCategory |
code | string |
message | string |
retryable | boolean |
context? | Record<string, string | number | boolean> |
Returns
Defined in
buildValidationError
▸ buildValidationError(code, message, context?): IDagError
Shorthand for creating a non-retryable validation error.
Parameters
| Name | Type |
|---|---|
code | string |
message | string |
context? | Record<string, string | number | boolean> |
Returns
Defined in
buildDispatchError
▸ buildDispatchError(code, message, context?): IDagError
Shorthand for creating a retryable dispatch error.
Parameters
| Name | Type |
|---|---|
code | string |
message | string |
context? | Record<string, string | number | boolean> |
Returns
Defined in
buildLeaseError
▸ buildLeaseError(code, message, context?): IDagError
Shorthand for creating a non-retryable lease error.
Parameters
| Name | Type |
|---|---|
code | string |
message | string |
context? | Record<string, string | number | boolean> |
Returns
Defined in
buildTaskExecutionError
▸ buildTaskExecutionError(code, message, retryable, context?): IDagError
Shorthand for creating a task execution error with configurable retryability.
Parameters
| Name | Type |
|---|---|
code | string |
message | string |
retryable | boolean |
context? | Record<string, string | number | boolean> |