@lastshotlabs/slingshot-orchestration-temporal
npm install @lastshotlabs/slingshot-orchestration-temporal
Functions
Section titled “Functions”buildSearchAttributes
Section titled “buildSearchAttributes”Build the Temporal search attributes written for a Slingshot run.
function buildSearchAttributes(kind: 'task' | 'workflow', name: string, opts?: Pick<RunOptions, 'tenantId' | 'priority' | 'tags'>,): Record<string, string[] | number[]>Source: packages/slingshot-orchestration-temporal/src/searchAttributes.ts
buildVisibilityQuery
Section titled “buildVisibilityQuery”Translate a portable run filter into a Temporal visibility query string.
function buildVisibilityQuery(filter?: RunFilter): string | undefinedSource: packages/slingshot-orchestration-temporal/src/searchAttributes.ts
createTemporalOrchestrationAdapter
Section titled “createTemporalOrchestrationAdapter”Creates a Temporal-backed OrchestrationAdapter that translates the
framework’s task/workflow operations into Temporal Client calls.
The adapter validates the supplied options, then returns an
OrchestrationAdapter whose methods map to Temporal primitives:
- registerTask / registerWorkflow — record definitions (immutable after
start()). - runTask / runWorkflow — start a Temporal workflow execution with
idempotent
workflowIdderivation andUSE_EXISTINGconflict policy. - getRun — describe + query a workflow to build a unified
Runview including progress, steps, and terminal output/error. - cancelRun / signal — cancel or deliver a user-defined signal.
- schedule / unschedule / listSchedules — manage cron-based schedules.
- listRuns — paginated visibility query with offset/limit support.
- onProgress — poll-based progress subscription with automatic cleanup.
- start — verify connectivity and search-attribute availability.
- shutdown — dispose progress pollers, close the client and (if owned) the underlying connection.
function createTemporalOrchestrationAdapter(rawOptions: TemporalOrchestrationAdapterOptions & { structuredLogger?: Logger; logger?: Logger; },): OrchestrationAdapter & SignalCapability & ScheduleCapability & ObservabilityCapability & ProgressCapability & TemporalOrchestrationHealthCapabilitySource: packages/slingshot-orchestration-temporal/src/adapter.ts
createTemporalOrchestrationWorker
Section titled “createTemporalOrchestrationWorker”Create the Temporal worker supervisor that executes portable Slingshot tasks and workflows inside real Temporal workers.
async function createTemporalOrchestrationWorker(rawOptions: TemporalOrchestrationWorkerOptions,): Promise<TemporalOrchestrationWorkerSupervisor>Source: packages/slingshot-orchestration-temporal/src/worker.ts
deriveTemporalRunId
Section titled “deriveTemporalRunId”Derive the Temporal workflow ID used for a portable run.
When an idempotency key is present the result is deterministic across retries for the same task/workflow name and tenant. Without one, a fresh public run ID is generated.
function deriveTemporalRunId(options: { kind: 'task' | 'workflow'; name: string; tenantId?: string; idempotencyKey?: string; }): stringSource: packages/slingshot-orchestration-temporal/src/ids.ts
encodeTag
Section titled “encodeTag”Encode a single Slingshot run tag into a Temporal-safe visibility token.
function encodeTag(key: string, value: string): stringSource: packages/slingshot-orchestration-temporal/src/searchAttributes.ts
encodeTags
Section titled “encodeTags”Encode a tag map into stable, sorted Temporal visibility values.
function encodeTags(tags?: Record<string, string>): string[]Source: packages/slingshot-orchestration-temporal/src/searchAttributes.ts
generateDirectoryDefinitionsModule
Section titled “generateDirectoryDefinitionsModule”Generate a temporary definitions module that re-exports a set of handlers files so the Temporal worker can import them through a single module path.
async function generateDirectoryDefinitionsModule(options: { outDir: string; files: readonly string[]; }): Promise<string>Source: packages/slingshot-orchestration-temporal/src/workflowModuleGenerator.ts
mapTemporalFailure
Section titled “mapTemporalFailure”Map a Temporal failure to a typed OrchestrationError so that callers
receive a stable, machine-readable code rather than an opaque throw.
Handled cases:
WorkflowFailedError— surfaces the underlying cause message asADAPTER_ERRORCancelledFailure— maps toADAPTER_ERRORwith a clear “cancelled” messageTerminatedFailure— maps toADAPTER_ERRORwith a clear “terminated” messageTimeoutFailure— maps toADAPTER_ERRORwith the timeout type in the message
All other errors are wrapped with wrapTemporalError.
function mapTemporalFailure(prefix: string, error: unknown): OrchestrationErrorSource: packages/slingshot-orchestration-temporal/src/errors.ts
mapTemporalStatus
Section titled “mapTemporalStatus”Map Temporal workflow execution states onto the portable orchestration run status enum.
function mapTemporalStatus(statusName: string | undefined): RunStatusSource: packages/slingshot-orchestration-temporal/src/statusMap.ts
temporalAdapterOptionsSchema
Section titled “temporalAdapterOptionsSchema”Validation schema for the server-side Temporal orchestration adapter options.
dataConverter and interceptors are pass-through slots forwarded to both
the Temporal Client and Worker constructors. Use dataConverter to
install a payload codec for sensitive-data redaction (PII), and
interceptors to inject auth headers, tracing, or custom workflow/activity
interceptor modules.
Source: packages/slingshot-orchestration-temporal/src/validation.ts
temporalConnectionConfigSchema
Section titled “temporalConnectionConfigSchema”Validation schema for manifest-style Temporal connection settings.
Config Fields
Section titled “Config Fields”| Field | Description |
|---|---|
address | Temporal server host:port address. |
defaultActivityTaskQueue | Default task queue for activity tasks when not specified per-activity. |
namespace | Temporal namespace to connect to. Defaults to the server default namespace. |
tls | TLS configuration for securing the Temporal connection. |
workflowTaskQueue | Task queue used for dispatching workflow tasks. |
Source: packages/slingshot-orchestration-temporal/src/validation.ts
temporalWorkerOptionsSchema
Section titled “temporalWorkerOptionsSchema”Validation schema for the Temporal worker bootstrap options.
Config Fields
Section titled “Config Fields”| Field | Description |
|---|---|
buildId | Build identifier used for Temporal worker versioning. |
connection | Temporal NativeConnection or Connection instance for the worker. |
defaultActivityTaskQueue | Default task queue for activity tasks when not specified per-activity. |
definitionsModulePath | Absolute or resolvable path to the module exporting task and workflow definitions. |
eventSink | Event sink for forwarding worker lifecycle events to the application event bus. |
generatedWorkflowsDir | Directory containing generated Temporal workflow bundles. |
identity | Human-readable identity string reported to the Temporal server for this worker. |
maxConcurrentActivityTaskExecutions | Maximum number of activity tasks executed concurrently by this worker. |
maxConcurrentWorkflowTaskExecutions | Maximum number of workflow tasks executed concurrently by this worker. |
namespace | Temporal namespace the worker connects to. |
ownsConnection | When true the worker will close the connection on shutdown. |
taskNames | Explicit list of task names to register. When omitted all exported tasks are used. |
workflowTaskQueue | Task queue the worker polls for workflow tasks. |
Source: packages/slingshot-orchestration-temporal/src/validation.ts
toRunError
Section titled “toRunError”Convert an unknown thrown value into the portable orchestration RunError shape.
function toRunError(error: unknown): RunErrorSource: packages/slingshot-orchestration-temporal/src/runError.ts
wrapTemporalError
Section titled “wrapTemporalError”Wrap an unknown Temporal failure in a portable OrchestrationError.
function wrapTemporalError(message: string, error: unknown): OrchestrationErrorSource: packages/slingshot-orchestration-temporal/src/errors.ts
Classes
Section titled “Classes”TemporalConnectionError
Section titled “TemporalConnectionError”Error raised when the Temporal adapter cannot establish or maintain a connection to the Temporal server.
Source: packages/slingshot-orchestration-temporal/src/errors.ts
TemporalOrchestrationError
Section titled “TemporalOrchestrationError”Base error for Temporal-specific orchestration failures.
Adds an adapter field so consumers can identify which adapter backend
produced the error when multiple orchestration adapters are in use.
Source: packages/slingshot-orchestration-temporal/src/errors.ts
Interfaces
Section titled “Interfaces”TemporalOrchestrationHealthCapability
Section titled “TemporalOrchestrationHealthCapability”Health-check capability for the Temporal orchestration adapter.
Returns the current health state including Temporal connection status and whether the adapter has been started.
Source: packages/slingshot-orchestration-temporal/src/adapter.ts
TemporalConnectionConfig
Section titled “TemporalConnectionConfig”Typed manifest-style Temporal connection settings.
Source: packages/slingshot-orchestration-temporal/src/validation.ts
TemporalOrchestrationAdapterOptions
Section titled “TemporalOrchestrationAdapterOptions”Typed options accepted by createTemporalOrchestrationAdapter().
Source: packages/slingshot-orchestration-temporal/src/validation.ts
TemporalOrchestrationWorkerOptions
Section titled “TemporalOrchestrationWorkerOptions”Typed options accepted by createTemporalOrchestrationWorker().
Source: packages/slingshot-orchestration-temporal/src/validation.ts