@lastshotlabs/slingshot-orchestration-temporal
npm install @lastshotlabs/slingshot-orchestration-temporal
Functions
Section titled “Functions”buildSearchAttributes
Section titled “buildSearchAttributes”Encode a single Slingshot run tag into a Temporal-safe visibility token.
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”Encode a single Slingshot run tag into a Temporal-safe visibility token.
function buildVisibilityQuery(filter?: RunFilter): string | undefinedSource: packages/slingshot-orchestration-temporal/src/searchAttributes.ts
createTemporalOrchestrationAdapter
Section titled “createTemporalOrchestrationAdapter”Per-workflow concurrency cap for in-flight maybeQueryState polls. Two
concurrent callers (e.g. getRun and an onProgress poll tick) both racing
against a hung Temporal cluster previously stacked 60+ pending queries per
workflow — this Map collapses concurrent calls to a single in-flight query
per runId.
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”Running Temporal worker group created for a Slingshot orchestration definition set.
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 single Slingshot run tag into a Temporal-safe visibility token.
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”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.
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 manifest-style Temporal connection settings.
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 manifest-style Temporal connection settings.
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”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.
function wrapTemporalError(message: string, error: unknown): OrchestrationErrorSource: packages/slingshot-orchestration-temporal/src/errors.ts
Classes
Section titled “Classes”TemporalConnectionError
Section titled “TemporalConnectionError”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
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”Per-workflow concurrency cap for in-flight maybeQueryState polls. Two
concurrent callers (e.g. getRun and an onProgress poll tick) both racing
against a hung Temporal cluster previously stacked 60+ pending queries per
workflow — this Map collapses concurrent calls to a single in-flight query
per runId.
Source: packages/slingshot-orchestration-temporal/src/adapter.ts
TemporalConnectionConfig
Section titled “TemporalConnectionConfig”Validation schema for manifest-style Temporal connection settings.
Source: packages/slingshot-orchestration-temporal/src/validation.ts
TemporalOrchestrationAdapterOptions
Section titled “TemporalOrchestrationAdapterOptions”Validation schema for manifest-style Temporal connection settings.
Source: packages/slingshot-orchestration-temporal/src/validation.ts
TemporalOrchestrationWorkerOptions
Section titled “TemporalOrchestrationWorkerOptions”Validation schema for manifest-style Temporal connection settings.
Source: packages/slingshot-orchestration-temporal/src/validation.ts