@lastshotlabs/slingshot-orchestration-engine
npm install @lastshotlabs/slingshot-orchestration-engine
Functions
Section titled “Functions”createCachedRunHandle
Section titled “createCachedRunHandle”Generate a sortable public orchestration run ID.
The format is run_ plus a Crockford-style timestamp/random suffix so adapters can
use the same externally-visible identifier even when the underlying engine keeps its
own internal job ID.
function createCachedRunHandle<TOutput>(id: string, loader: () => Promise<TOutput>,): RunHandle<TOutput>Source: packages/slingshot-orchestration-engine/src/adapter.ts
createIdempotencyScope
Section titled “createIdempotencyScope”Minimal identity of the task or workflow being deduped.
function createIdempotencyScope(target: IdempotencyTarget, options: Pick<RunOptions, 'idempotencyKey' | 'tenantId'>,): string | undefinedSource: packages/slingshot-orchestration-engine/src/idempotency.ts
createMemoryAdapter
Section titled “createMemoryAdapter”Create the in-process orchestration adapter.
This adapter is the lightest execution mode: no external infrastructure, no durability across process restarts, and full support for observability/progress within the running process.
function createMemoryAdapter(options: { concurrency?: number; eventSink?: OrchestrationEventSink; maxPayloadBytes?: number; logger?: import('@lastshotlabs/slingshot-core').Logger; /** * Pre-built `HookServices` instance. When provided, the adapter threads it into * workflow `onStart`/`onComplete`/`onFail` hooks and `TaskContext.services`. * Construct via `buildHookServices()` from `@lastshotlabs/slingshot-core` at the * adapter's call site (typically inside the orchestration plugin's * `setupMiddleware`, where `app`/`pluginState`/`bus` are all in scope). * * Omitting this field means hooks see `services: undefined` — appropriate for * tests, standalone scripts, or any setup where the framework state isn't * reachable. */ hookServices?: import('@lastshotlabs/slingshot-core').HookServices; } = {},): OrchestrationAdapter & ObservabilityCapability & SignalCapability & ScheduleCapability &Source: packages/slingshot-orchestration-engine/src/adapters/memory.ts
createOrchestrationRuntime
Section titled “createOrchestrationRuntime”Build the portable orchestration runtime from a concrete adapter plus registered task and workflow definitions.
This composition root is intentionally framework-agnostic. It can run in plain scripts, tests, workers, or inside the Slingshot plugin wrapper.
function createOrchestrationRuntime(options: OrchestrationRuntimeOptions,): OrchestrationRuntimeSource: packages/slingshot-orchestration-engine/src/runtime.ts
createSqliteAdapter
Section titled “createSqliteAdapter”Create the SQLite-backed orchestration adapter.
This adapter reuses the shared task/workflow runners from the core package while persisting run and step state to SQLite so pending work can resume after restart.
function createSqliteAdapter(options: { path: string; concurrency?: number; eventSink?: OrchestrationEventSink; maxPayloadBytes?: number; logger?: import('@lastshotlabs/slingshot-core').Logger; /** Pre-built `HookServices` for in-process workflow hooks and task contexts. See `createMemoryAdapter` for the same field. */ hookServices?: import('@lastshotlabs/slingshot-core').HookServices; }): OrchestrationAdapter & ObservabilityCapability &Source: packages/slingshot-orchestration-engine/src/adapters/sqlite.ts
defineTask
Section titled “defineTask”Validate that a public orchestration identifier uses kebab-case.
function defineTask<TInput, TOutput>(config: TaskDefinition<TInput, TOutput>,): ResolvedTask<TInput, TOutput>Source: packages/slingshot-orchestration-engine/src/defineTask.ts
defineWorkflow
Section titled “defineWorkflow”Reference a task inside a workflow by object or public name.
Prefer passing the resolved task object when authoring nearby code so refactors stay type-safe. String names remain useful for cross-module composition.
function defineWorkflow<TInput, TOutput>(config: WorkflowDefinition<TInput, TOutput>,): ResolvedWorkflow<TInput, TOutput>Source: packages/slingshot-orchestration-engine/src/defineWorkflow.ts
generateRunId
Section titled “generateRunId”Generate a sortable public orchestration run ID.
The format is run_ plus a Crockford-style timestamp/random suffix so adapters can
use the same externally-visible identifier even when the underlying engine keeps its
own internal job ID.
function generateRunId(): stringSource: packages/slingshot-orchestration-engine/src/adapter.ts
parallel
Section titled “parallel”Reference a task inside a workflow by object or public name.
Prefer passing the resolved task object when authoring nearby code so refactors stay type-safe. String names remain useful for cross-module composition.
function parallel<TWorkflowInput = unknown>(steps: StepEntry<TWorkflowInput>[],): ParallelEntry<TWorkflowInput>Source: packages/slingshot-orchestration-engine/src/defineWorkflow.ts
Reference a task inside a workflow by object or public name.
Prefer passing the resolved task object when authoring nearby code so refactors stay type-safe. String names remain useful for cross-module composition.
function sleep<TWorkflowInput = unknown>(name: string, duration: | number | ((ctx: { workflowInput: TWorkflowInput; results: Record<string, unknown> }) => number),): SleepEntry<TWorkflowInput>Source: packages/slingshot-orchestration-engine/src/defineWorkflow.ts
Reference a task inside a workflow by object or public name.
Prefer passing the resolved task object when authoring nearby code so refactors stay type-safe. String names remain useful for cross-module composition.
function step<TWorkflowInput = unknown>(name: string, taskOrName: string | AnyResolvedTask, options?: StepOptions<TWorkflowInput>,): StepEntry<TWorkflowInput>Source: packages/slingshot-orchestration-engine/src/defineWorkflow.ts
stepResult
Section titled “stepResult”Reference a task inside a workflow by object or public name.
Prefer passing the resolved task object when authoring nearby code so refactors stay type-safe. String names remain useful for cross-module composition.
function stepResult<TResult = unknown>(results: Record<string, unknown>, name: string, task?: AnyResolvedTask,): TResult | undefined; export function stepResult<TResult = unknown>( results: Record<string, unknown>, name: string, ): TResult | undefinedSource: packages/slingshot-orchestration-engine/src/defineWorkflow.ts
Classes
Section titled “Classes”OrchestrationAdapterError
Section titled “OrchestrationAdapterError”Error type used by the orchestration runtime, adapters, and plugin helpers.
Consumers should branch on code for durable error handling instead of parsing the
message text.
Source: packages/slingshot-orchestration-engine/src/errors.ts
OrchestrationError
Section titled “OrchestrationError”Error type used by the orchestration runtime, adapters, and plugin helpers.
Consumers should branch on code for durable error handling instead of parsing the
message text.
Source: packages/slingshot-orchestration-engine/src/errors.ts
OrchestrationRunNotFoundError
Section titled “OrchestrationRunNotFoundError”Error type used by the orchestration runtime, adapters, and plugin helpers.
Consumers should branch on code for durable error handling instead of parsing the
message text.
Source: packages/slingshot-orchestration-engine/src/errors.ts
OrchestrationTimeoutError
Section titled “OrchestrationTimeoutError”Error type used by the orchestration runtime, adapters, and plugin helpers.
Consumers should branch on code for durable error handling instead of parsing the
message text.
Source: packages/slingshot-orchestration-engine/src/errors.ts
WorkflowHookError
Section titled “WorkflowHookError”Thrown when a workflow lifecycle hook (onStart, onComplete, or onFail)
raises and continueOnHookError is not set on the hook configuration. The
workflow is failed with a hookFailed failure step.
Source: packages/slingshot-orchestration-engine/src/engine/workflowRunner.ts
Interfaces
Section titled “Interfaces”CancelOutcome
Section titled “CancelOutcome”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
CoreOrchestrationAdapter
Section titled “CoreOrchestrationAdapter”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
ObservabilityCapability
Section titled “ObservabilityCapability”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
OrchestrationEventMap
Section titled “OrchestrationEventMap”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
OrchestrationEventSink
Section titled “OrchestrationEventSink”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
OrchestrationRuntime
Section titled “OrchestrationRuntime”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
OrchestrationRuntimeOptions
Section titled “OrchestrationRuntimeOptions”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
ParallelEntry
Section titled “ParallelEntry”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
ProgressCapability
Section titled “ProgressCapability”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
ResolvedTask
Section titled “ResolvedTask”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
ResolvedWorkflow
Section titled “ResolvedWorkflow”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
RetryPolicy
Section titled “RetryPolicy”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
RunError
Section titled “RunError”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
RunFilter
Section titled “RunFilter”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
RunHandle
Section titled “RunHandle”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
RunOptions
Section titled “RunOptions”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
RunProgress
Section titled “RunProgress”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
ScheduleCapability
Section titled “ScheduleCapability”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
ScheduleHandle
Section titled “ScheduleHandle”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
SignalCapability
Section titled “SignalCapability”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
SleepEntry
Section titled “SleepEntry”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
SlingshotLogger
Section titled “SlingshotLogger”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
StepEntry
Section titled “StepEntry”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
StepInputContext
Section titled “StepInputContext”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
StepOptions
Section titled “StepOptions”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
StepRun
Section titled “StepRun”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
TaskContext
Section titled “TaskContext”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
TaskDefinition
Section titled “TaskDefinition”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
WorkflowDefinition
Section titled “WorkflowDefinition”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
WorkflowRun
Section titled “WorkflowRun”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
AnyResolvedTask
Section titled “AnyResolvedTask”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
AnyResolvedWorkflow
Section titled “AnyResolvedWorkflow”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
OrchestrationAdapter
Section titled “OrchestrationAdapter”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
OrchestrationCapability
Section titled “OrchestrationCapability”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
OrchestrationErrorCode
Section titled “OrchestrationErrorCode”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
RunStatus
Section titled “RunStatus”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts
WorkflowEntry
Section titled “WorkflowEntry”Retry policy shared by tasks and step-level overrides.
Source: packages/slingshot-orchestration-engine/src/types.ts