Jobs API
Generated public TypeScript reference for @relkit/jobs.
Common APIs
For configuration and examples, read quickstart, schedules, comparison.
Frontend usage
Trigger and observe a job shows the client side of this capability.
Public imports
@relkit/jobs— 413 exports@relkit/jobs/adapter— 34 exports@relkit/jobs/server— 9 exports@relkit/jobs/legacy— 33 exports
All exported APIs
Names link to their complete contracts. Re-exports share their original contract; legacy exports keep their separate identity. Examples link to the API’s inline sample, a maintained repository usage, or the shared module walkthrough.
adapter-methods.ts
assertAdapterMethods
Synchronous adapter method check.
Throws
JobsCapabilityError when a method is missing.
Example
assertAdapterMethods(adapter);
Signature
declare const assertAdapterMethods: (adapter: JobsAdapterRuntime) => void;
assertAdapterMethodsEffect
Checks the methods promised by a jobs adapter.
Example
Effect.runSync(assertAdapterMethodsEffect(adapter));
Signature
declare const assertAdapterMethodsEffect: (
adapter: JobsAdapterRuntime,
) => Effect.Effect<undefined, JobsCapabilityFailure, never>;
adapter-requests.types.ts
NativeCancelRequest (interface)
Provider-facing cancel request contract at the adapter boundary.
Signature
export interface NativeCancelRequest {
readonly runId: string;
readonly operationId: string;
readonly reason?: string;
}
NativeControlReceipt (type alias)
Provider acknowledgement for a run control operation.
Signature
type NativeControlReceipt = RunCancellationReceipt | RunRetryReceipt | JobUnknownOutcome;
NativeReceipt (type alias)
Provider acknowledgement for an accepted submission.
Signature
type NativeReceipt = RunHandle | JobUnknownOutcome;
NativeRetryRequest (interface)
Provider-facing retry request contract at the adapter boundary.
Signature
export interface NativeRetryRequest {
readonly runId: string;
readonly operationId: string;
readonly retryIdentity?: string;
readonly canonicalInput?: JobWireEnvelope;
readonly inputHash?: string;
readonly inputSchemaHash?: string;
readonly taskId?: string;
readonly jobId?: string;
readonly taskVersion?: string;
readonly buildId?: string;
readonly scope?: string;
readonly acceptanceIdentity?: string;
readonly canonicalAdmission?: {
readonly validatePinnedInput: true;
readonly allocateFreshBudget: true;
readonly clearInitialDelay: true;
};
}
NativeSubmission (interface)
Provider request created from a validated job submission.
Signature
export interface NativeSubmission {
readonly jobId: string;
readonly taskId: string;
readonly taskVersion: string;
readonly buildId: string;
readonly execution?: "durable" | "retryable";
readonly scope?: string;
readonly input: JsonValue;
readonly operationId: string;
readonly idempotencyKey?: string;
readonly canonicalInput?: JobWireEnvelope;
readonly inputHash?: string;
readonly inputSchemaHash?: string;
readonly policy?: JsonValue;
readonly scheduledFor?: string;
readonly tags?: readonly string[];
readonly correlationId?: string;
readonly parentRunId?: string;
readonly propagation?: TracePropagation;
readonly acceptanceIdentity?: string;
readonly occurrenceIdentity?: string;
readonly retryOfRunId?: string;
}
NativeWatchRequest (interface)
Provider-facing watch request contract at the adapter boundary.
Signature
export interface NativeWatchRequest {
readonly runId: string;
readonly after?: string;
}
OperationContext (interface)
Scope, signal, and tracing data passed to one provider operation.
Signature
export interface OperationContext {
readonly signal: AbortSignal;
readonly application: string;
readonly environment: string;
readonly scope: string;
readonly service: string;
readonly serviceGeneration: string;
readonly operationId?: string;
readonly deadlineMs?: number;
readonly correlationId?: string;
readonly parentRunId?: string;
readonly propagation?: TracePropagation;
readonly acceptanceIdentity?: string;
readonly occurrenceIdentity?: string;
readonly inputSchemaHash?: string;
readonly retryOfRunId?: string;
}
adapter.ts
JOBS_ADAPTER_PROTOCOL_VERSION
Protocol version required by all jobs adapters.
Example
adapter.protocolVersion === JOBS_ADAPTER_PROTOCOL_VERSION;
Signature
declare const JOBS_ADAPTER_PROTOCOL_VERSION: 1;
JobsAdapterRuntime
Signature
declare const JobsAdapterRuntime: JobsAdapterRuntime;
JobsAdapterValidationError (class)
Invalid jobs adapter shape or protocol.
Example
if (error instanceof JobsAdapterValidationError) console.log(error.message);
Signature
declare class JobsAdapterValidationError
JobsCapabilityError
Signature
declare const JobsCapabilityError: typeof JobsCapabilityError;
JobsCapabilityReport
Signature
declare const JobsCapabilityReport: JobsCapabilityReport;
NativeCancelRequest
Signature
declare const NativeCancelRequest: NativeCancelRequest;
NativeControlReceipt
Signature
declare const NativeControlReceipt: NativeControlReceipt;
NativeDurableSleep
Signature
declare const NativeDurableSleep: NativeDurableSleep;
NativeLocator
Signature
declare const NativeLocator: string;
NativeObservation
Signature
declare const NativeObservation: NativeObservation;
NativeProgressWriter
Signature
declare const NativeProgressWriter: NativeProgressWriter;
NativeReceipt
Signature
declare const NativeReceipt: NativeReceipt;
NativeRetryRequest
Signature
declare const NativeRetryRequest: NativeRetryRequest;
NativeRun
Signature
declare const NativeRun: NativeRun;
NativeRunPage
Signature
declare const NativeRunPage: NativeRunPage;
NativeRunQuery
Signature
declare const NativeRunQuery: RunListQuery;
NativeScheduleOperations
Signature
declare const NativeScheduleOperations: NativeScheduleOperations;
NativeStreamWriter
Signature
declare const NativeStreamWriter: NativeStreamWriter;
NativeStreamWriters
Signature
declare const NativeStreamWriters: Readonly<Record<string, NativeStreamWriter>>;
NativeSubmission
Signature
declare const NativeSubmission: NativeSubmission;
NativeTaskWork
Signature
declare const NativeTaskWork: NativeTaskWork;
NativeTaskWorker
Signature
declare const NativeTaskWorker: NativeTaskWorker;
NativeWatchRequest
Signature
declare const NativeWatchRequest: NativeWatchRequest;
OperationContext
Signature
declare const OperationContext: OperationContext;
TaskExecutionBinding
Signature
declare const TaskExecutionBinding: TaskExecutionBinding;
TaskExecutionEnvelope
Signature
declare const TaskExecutionEnvelope: TaskExecutionEnvelope;
TaskExecutor
Signature
declare const TaskExecutor: TaskExecutor;
assertAdapterMethods
Signature
declare const assertAdapterMethods: (adapter: JobsAdapterRuntime) => void;
assertJobsAdapterRuntime
Synchronous adapter shape assertion.
Throws
TypeError or JobsCapabilityError when invalid.
Example
assertJobsAdapterRuntime(adapter);
Signature
declare const assertJobsAdapterRuntime: (value: unknown) => asserts value is JobsAdapterRuntime;
assertJobsAdapterRuntimeEffect
Validates an untrusted jobs adapter in Effect.
Example
Effect.runSync(assertJobsAdapterRuntimeEffect(adapter));
Signature
declare const assertJobsAdapterRuntimeEffect: (
value: unknown,
) => Effect.Effect<JobsAdapterRuntime, JobsCapabilityFailure | JobsAdapterValidationError, never>;
assertJobsCapability
Signature
declare const assertJobsCapability: (report: JobsCapabilityReport, capability: string) => void;
isJobsAdapterRuntime
Synchronous jobs adapter brand check.
Example
isJobsAdapterRuntime(value);
Signature
declare const isJobsAdapterRuntime: (value: unknown) => value is JobsAdapterRuntime;
isJobsAdapterRuntimeEffect
Checks the jobs adapter brand in Effect.
Example
Effect.runSync(isJobsAdapterRuntimeEffect(value));
Signature
declare const isJobsAdapterRuntimeEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
validateJobsCapabilityReport
Signature
declare const validateJobsCapabilityReport: (value: unknown) => JobsCapabilityReport;
adapter.types.ts
JobsAdapterRuntime (interface)
Provider protocol for submitting, reading, controlling, and observing jobs.
Signature
export interface JobsAdapterRuntime {
readonly kind: "jobs-adapter-runtime";
readonly protocolVersion: typeof JOBS_PROTOCOL_VERSION;
readonly capabilities: JobsCapabilityReport;
readonly submit: (request: NativeSubmission, context: OperationContext) => Promise<NativeReceipt>;
readonly get: (locator: NativeLocator, context: OperationContext) => Promise<NativeRun>;
readonly list: (query: NativeRunQuery, context: OperationContext) => Promise<NativeRunPage>;
readonly observe: (
request: NativeWatchRequest,
context: OperationContext,
) => AsyncIterable<NativeObservation>;
readonly cancel: (
request: NativeCancelRequest,
context: OperationContext,
) => Promise<NativeControlReceipt>;
readonly retry?: (
request: NativeRetryRequest,
context: OperationContext,
) => Promise<NativeControlReceipt>;
readonly close: () => Promise<void>;
readonly worker?: NativeTaskWorker;
readonly schedules?: NativeScheduleOperations;
readonly streams?: Readonly<Record<string, unknown>>;
}
NativeDurableSleep (interface)
Provider-facing durable sleep contract at the adapter boundary.
Signature
export interface NativeDurableSleep {
readonly sleep: (key: string, durationMs: number) => Promise<void>;
readonly sleepUntil?: (key: string, instant: string) => Promise<void>;
}
NativeLocator (type alias)
Provider-facing locator contract at the adapter boundary.
Signature
type NativeLocator = string;
NativeObservation (type alias)
Provider-facing observation contract at the adapter boundary.
Signature
type NativeObservation = RunWatchFrame<NativeRun>;
NativeProgressWriter (interface)
Provider-facing progress writer contract at the adapter boundary.
Signature
export interface NativeProgressWriter {
readonly emit: (
value: JsonValue,
context?: OperationContext,
) => MaybePromise<ProgressEmitReceipt | void>;
}
NativeRun (type alias)
Provider-facing run contract at the adapter boundary.
Signature
type NativeRun = RunSnapshot;
NativeRunPage (type alias)
Provider-facing run page contract at the adapter boundary.
Signature
type NativeRunPage = RunPage<NativeRun>;
NativeRunQuery (type alias)
Provider-facing run query contract at the adapter boundary.
Signature
type NativeRunQuery = RunListQuery;
NativeScheduleOperations (interface)
Provider-facing schedule operations contract at the adapter boundary.
Signature
export interface NativeScheduleOperations {
readonly list: (
query: Readonly<Record<string, unknown>>,
context: OperationContext,
) => Promise<unknown>;
readonly get: (id: string, context: OperationContext) => Promise<unknown>;
readonly upsert: (definition: JsonValue, context: OperationContext) => Promise<unknown>;
readonly pause: (id: string, context: OperationContext) => Promise<unknown>;
readonly resume: (id: string, context: OperationContext) => Promise<unknown>;
readonly delete: (id: string, context: OperationContext) => Promise<unknown>;
}
NativeStreamWriter (interface)
Provider-facing stream writer contract at the adapter boundary.
Signature
export interface NativeStreamWriter {
readonly emit: (
value: JsonValue,
context?: OperationContext,
) => MaybePromise<ProgressEmitReceipt | void>;
}
NativeStreamWriters (type alias)
Provider-facing stream writers contract at the adapter boundary.
Signature
type NativeStreamWriters = Readonly<Record<string, NativeStreamWriter>>;
NativeTaskWork (interface)
Provider-facing task work contract at the adapter boundary.
Signature
export interface NativeTaskWork {
readonly envelope: TaskExecutionEnvelope;
readonly binding: TaskExecutionBinding;
}
NativeTaskWorker (interface)
Provider worker operations for accepting and completing task work.
Signature
export interface NativeTaskWorker {
readonly next: (context: OperationContext) => Promise<NativeTaskWork | undefined>;
readonly complete: (runId: string, output: unknown, context: OperationContext) => Promise<void>;
readonly fail: (runId: string, error: unknown, context: OperationContext) => Promise<void>;
/** Returns an intentional provider park/yield to the native continuation owner. */
readonly suspend?: (runId: string, value: unknown, context: OperationContext) => Promise<void>;
}
TaskExecutionBinding (interface)
Provider-owned context and sinks supplied to one task execution.
Signature
export interface TaskExecutionBinding {
readonly run: {
readonly runId: string;
readonly jobId: string;
readonly taskId: string;
readonly taskVersion: string;
readonly buildId: string;
readonly service?: string;
readonly serviceGeneration?: string;
readonly attempt?: number;
readonly acceptedAt?: string;
readonly scheduledFor?: string;
readonly parentRunId?: string;
readonly deadlineMs?: number;
readonly scope?: string;
readonly inputSchemaHash?: string;
readonly acceptanceIdentity?: string;
readonly occurrenceIdentity?: string;
readonly propagation?: TracePropagation;
};
readonly signal: AbortSignal;
readonly isSuspension?: (cause: unknown) => boolean;
readonly sleep?: NativeDurableSleep;
readonly progress?: NativeProgressWriter;
readonly streams?: NativeStreamWriters;
}
TaskExecutionEnvelope (interface)
Provider-owned envelope containing the accepted task input and run identity.
Signature
export interface TaskExecutionEnvelope {
readonly runId: string;
readonly jobId: string;
readonly taskId: string;
readonly taskVersion: string;
readonly buildId: string;
readonly input: JobWireEnvelope;
readonly inputHash?: string;
readonly inputSchemaHash?: string;
readonly acceptedAt?: string;
readonly scheduledFor?: string;
readonly attempt?: number;
readonly parentRunId?: string;
readonly service?: string;
readonly serviceGeneration?: string;
readonly scope?: string;
readonly acceptanceIdentity?: string;
readonly occurrenceIdentity?: string;
readonly propagation?: TracePropagation;
}
TaskExecutor (interface)
Execution callback used by a native task worker.
Signature
export interface TaskExecutor {
readonly execute: (
envelope: TaskExecutionEnvelope,
binding: TaskExecutionBinding,
) => Promise<unknown>;
}
authorization-cursor-codec.ts
createCursorValue
Encodes a bounded authorization cursor, signing it when keys are supplied.
Throws
JobCursorError for invalid binding, key, or encoded size.
Example
createCursorValue(binding, { key: "secret" });
Signature
declare const createCursorValue: (binding: JobCursorBinding, options?: JobCursorOptions) => string;
readCursorValue
Decodes and verifies a cursor against the caller’s trusted authorization binding.
Throws
JobCursorError for invalid encoding, signature, or binding mismatch.
Example
readCursorValue(cursor, expected, { key: "secret" });
Signature
declare const readCursorValue: (
cursor: string,
expected: JobCursorBinding,
options?: JobCursorOptions,
) => JobCursorBinding;
authorization-cursor.ts
JobCursorBinding
Signature
declare const JobCursorBinding: JobCursorBinding;
JobCursorFailure (class)
A rejected cursor creation or verification.
Example
if (error instanceof JobCursorFailure) console.log(error.message);
Signature
declare class JobCursorFailure
JobCursorOptions
Signature
declare const JobCursorOptions: JobCursorOptions;
createJobCursor
Synchronous cursor creator.
Throws
JobCursorError when the binding or encoded cursor is invalid.
Example
createJobCursor(binding, { key: "secret" });
Signature
declare const createJobCursor: (binding: JobCursorBinding, options?: JobCursorOptions) => string;
createJobCursorEffect
Creates a bound, optionally signed job cursor in Effect.
Example
Effect.runSync(createJobCursorEffect(binding, { key: "secret" }));
Signature
declare const createJobCursorEffect: (
binding: JobCursorBinding,
options?: JobCursorOptions | undefined,
) => Effect.Effect<string, JobCursorFailure, never>;
readJobCursor
Synchronous bound cursor reader.
Throws
JobCursorError when the cursor is invalid or has a different binding.
Example
readJobCursor(cursor, expected, { key: "secret" });
Signature
declare const readJobCursor: (
cursor: string,
expected: JobCursorBinding,
options?: JobCursorOptions,
) => JobCursorBinding;
readJobCursorEffect
Reads and verifies a cursor against its expected binding in Effect.
Example
Effect.runSync(readJobCursorEffect(cursor, expected, { key: "secret" }));
Signature
declare const readJobCursorEffect: (
cursor: string,
expected: JobCursorBinding,
options?: JobCursorOptions | undefined,
) => Effect.Effect<JobCursorBinding, JobCursorFailure, never>;
authorization-cursor.types.ts
JobCursorBinding (interface)
Trusted job and scope identity bound into a pagination cursor.
Signature
export interface JobCursorBinding {
readonly application?: string;
readonly environment?: string;
readonly scope: string;
readonly subject?: string;
readonly jobId: string;
readonly operation: JobClientOperation;
readonly filters: JsonValue;
readonly schema: string;
readonly position: JsonValue;
}
JobCursorOptions (interface)
Options accepted for job cursor operations.
Signature
export interface JobCursorOptions {
readonly key: string | Uint8Array;
readonly keyId?: string;
}
authorization-errors.ts
A caller attempted a job operation outside its trusted grant.
Example
new JobAuthorizationError("Run belongs to another subject");
JobAuthorizationError (class)
A caller attempted a job operation outside its trusted grant.
Example
new JobAuthorizationError("Run belongs to another subject");
Signature
declare class JobAuthorizationError {
constructor(message = "Job operation is not authorized");
}
code (property)
Signature
readonly code: "RELKIT_JOB_ACCESS_DENIED"
JobCursorError (class)
A continuation cursor is malformed or bound to another request.
Example
new JobCursorError();
Signature
declare class JobCursorError {
constructor();
}
code (property)
Signature
readonly code: "RELKIT_JOB_CURSOR_INVALID"
authorization-failure.ts
JobAuthorizationFailure (class)
A denied or malformed jobs authorization decision.
Example
new JobAuthorizationFailure({ reason: "scope" });
Signature
declare class JobAuthorizationFailure
authorization-grant.ts
assertAuthorizedOperation
Synchronous compatibility assertion for an authorized operation.
Throws
JobAuthorizationError for an invalid grant or request.
Example
assertAuthorizedOperation(grant, request, trusted);
Signature
declare const assertAuthorizedOperation: (
grant: JobAccessGrant,
request: JobAccessRequest,
trusted: TrustedJobScope,
now?: number,
) => void;
assertAuthorizedOperationEffect
Validates a grant and the requested operation in Effect.
Example
Effect.runPromise(assertAuthorizedOperationEffect(grant, request, trusted));
Signature
declare const assertAuthorizedOperationEffect: (
grant: JobAccessGrant,
request: JobAccessRequest,
trusted: TrustedJobScope,
now?: number | undefined,
) => Effect.Effect<undefined, JobAuthorizationFailure, never>;
assertJobGrant
Synchronous compatibility assertion for policy grants.
Throws
JobAuthorizationError for an invalid or expired grant.
Example
assertJobGrant({ scope: "tenant:a" }, trusted);
Signature
declare const assertJobGrant: (
value: unknown,
trusted: TrustedJobScope,
now?: number,
) => asserts value is JobAccessGrant;
assertJobGrantEffect
Validates a grant against a trusted tenant scope and current time.
Example
Effect.runPromise(assertJobGrantEffect({ scope: "tenant:a" }, trusted));
Signature
declare const assertJobGrantEffect: (
value: unknown,
trusted: TrustedJobScope,
now?: number | undefined,
) => Effect.Effect<JobAccessGrant, JobAuthorizationFailure, never>;
boundedTextEffect
Checks bounded trusted and grant strings.
Example
Effect.runPromise(boundedTextEffect("tenant:a"));
Signature
declare const boundedTextEffect: (
value: unknown,
) => Effect.Effect<undefined, JobAuthorizationFailure, never>;
authorization-projection.ts
JobProjectionOptions
Signature
declare const JobProjectionOptions: JobProjectionOptions;
projectRunPage
Synchronous compatibility projection of a page.
Example
projectRunPage(page, ["progress"]);
Signature
declare const projectRunPage: (
page: RunPage<RunSnapshot>,
fields?: readonly JobClientField[],
options?: JobProjectionOptions,
) => RunPage<RunSnapshot>;
projectRunPageEffect
Projects a page of runs without exposing fields outside the grant.
Example
Effect.runSync(projectRunPageEffect(page, ["progress"]));
Signature
declare const projectRunPageEffect: (
page: RunPage<RunSnapshot>,
fields?: ReadonlyArray<JobClientField> | undefined,
options?: JobProjectionOptions | undefined,
) => Effect.Effect<RunPage<RunSnapshot>, never, never>;
projectRunSnapshot
Synchronous compatibility projection of one run.
Example
projectRunSnapshot(run, ["output"]);
Signature
declare const projectRunSnapshot: (
run: RunSnapshot,
fields?: readonly JobClientField[],
options?: JobProjectionOptions,
) => RunSnapshot;
projectRunSnapshotEffect
Copies only authorized run fields into a safe client snapshot.
Example
Effect.runSync(projectRunSnapshotEffect(run, ["output"]));
Signature
declare const projectRunSnapshotEffect: (
run: RunSnapshot,
fields?: ReadonlyArray<JobClientField> | undefined,
options?: JobProjectionOptions | undefined,
) => Effect.Effect<RunSnapshot, never, never>;
authorization-projection.types.ts
Fields needed to disclose a declared job error safely.
JobProjectionOptions (interface)
Fields needed to disclose a declared job error safely.
Signature
export interface JobProjectionOptions {
readonly declaredErrorIds?: readonly string[];
}
authorization.ts
JobAuthorizationError
Signature
declare const JobAuthorizationError: typeof JobAuthorizationError;
JobAuthorizationFailure
Signature
declare const JobAuthorizationFailure: typeof JobAuthorizationFailure;
JobCursorBinding
Signature
declare const JobCursorBinding: any;
JobCursorError
Signature
declare const JobCursorError: typeof JobCursorError;
JobCursorFailure
Signature
declare const JobCursorFailure: typeof JobCursorFailure;
JobCursorOptions
Signature
declare const JobCursorOptions: any;
TrustedJobScope
Signature
declare const TrustedJobScope: TrustedJobScope;
assertAuthorizedOperation
Signature
declare const assertAuthorizedOperation: (
grant: JobAccessGrant,
request: JobAccessRequest,
trusted: TrustedJobScope,
now?: number,
) => void;
assertAuthorizedOperationEffect
Signature
declare const assertAuthorizedOperationEffect: (
grant: JobAccessGrant,
request: JobAccessRequest,
trusted: TrustedJobScope,
now?: number | undefined,
) => Effect.Effect<undefined, JobAuthorizationFailure, never>;
assertJobGrant
Signature
declare const assertJobGrant: (
value: unknown,
trusted: TrustedJobScope,
now?: number,
) => asserts value is JobAccessGrant;
assertJobGrantEffect
Signature
declare const assertJobGrantEffect: (
value: unknown,
trusted: TrustedJobScope,
now?: number | undefined,
) => Effect.Effect<JobAccessGrant, JobAuthorizationFailure, never>;
authorize
Compatibility alias for authorizeJobAccess.
Example
await authorize(job, request, trusted);
Signature
declare const authorize: (
job: JobDescriptorAny,
request: JobAccessRequest,
trusted: TrustedJobScope,
context?: JobAuthorizationContext,
) => Promise<JobAccessGrant>;
authorizeJobAccess
Promise compatibility adapter for job authorization. Preflight denials still throw synchronously before a Promise is returned.
Throws
JobAuthorizationError for invalid preflight or policy decisions.
Example
await authorizeJobAccess(job, request, trusted);
Signature
declare const authorizeJobAccess: (
job: JobDescriptorAny,
request: JobAccessRequest,
trusted: TrustedJobScope,
context?: JobAuthorizationContext,
) => Promise<JobAccessGrant>;
authorizeJobAccessEffect
Authorizes a job operation against trusted scope in Effect. Policy callback failures are redacted to a tagged authorization failure.
Example
Effect.runPromise(authorizeJobAccessEffect(job, request, trusted));
Signature
declare const authorizeJobAccessEffect: (
job: JobDescriptorAny,
request: JobAccessRequest,
trusted: TrustedJobScope,
context?: JobAuthorizationContext | undefined,
) => Effect.Effect<Readonly<{ scope: string }>, JobAuthorizationFailure, never>;
createCursor
Compatibility alias for createJobCursor.
Example
createCursor(options);
Signature
declare const createCursor: (binding: JobCursorBinding, options?: JobCursorOptions) => string;
createJobCursor
Signature
declare const createJobCursor: (binding: JobCursorBinding, options?: JobCursorOptions) => string;
createJobCursorEffect
Signature
declare const createJobCursorEffect: (
binding: JobCursorBinding,
options?: JobCursorOptions | undefined,
) => Effect.Effect<string, JobCursorFailure, never>;
decodeCursor
Compatibility alias for readJobCursor.
Example
decodeCursor(cursor, options);
Signature
declare const decodeCursor: (
cursor: string,
expected: JobCursorBinding,
options?: JobCursorOptions,
) => JobCursorBinding;
projectRun
Compatibility alias for projectRunSnapshot.
Example
projectRun(snapshot, grant);
Signature
declare const projectRun: (
run: RunSnapshot,
fields?: readonly JobClientField[],
options?: JobProjectionOptions,
) => RunSnapshot;
projectRunPage
Signature
declare const projectRunPage: (
page: RunPage<RunSnapshot>,
fields?: readonly JobClientField[],
options?: JobProjectionOptions,
) => RunPage<RunSnapshot>;
projectRunPageEffect
Signature
declare const projectRunPageEffect: (
page: RunPage<RunSnapshot>,
fields?: ReadonlyArray<JobClientField> | undefined,
options?: JobProjectionOptions | undefined,
) => Effect.Effect<RunPage<RunSnapshot>, never, never>;
projectRunSnapshot
Signature
declare const projectRunSnapshot: (
run: RunSnapshot,
fields?: readonly JobClientField[],
options?: JobProjectionOptions,
) => RunSnapshot;
projectRunSnapshotEffect
Signature
declare const projectRunSnapshotEffect: (
run: RunSnapshot,
fields?: ReadonlyArray<JobClientField> | undefined,
options?: JobProjectionOptions | undefined,
) => Effect.Effect<RunSnapshot, never, never>;
readJobCursor
Signature
declare const readJobCursor: (
cursor: string,
expected: JobCursorBinding,
options?: JobCursorOptions,
) => JobCursorBinding;
readJobCursorEffect
Signature
declare const readJobCursorEffect: (
cursor: string,
expected: JobCursorBinding,
options?: JobCursorOptions | undefined,
) => Effect.Effect<JobCursorBinding, JobCursorFailure, never>;
authorization.types.ts
Trusted application and tenant context for a jobs authorization decision. The scope may be narrowed by a policy but never broadened.
Example
const trusted: TrustedJobScope = { application: "app", environment: "test", scope: "tenant:a" };
TrustedJobScope (interface)
Trusted application and tenant context for a jobs authorization decision. The scope may be narrowed by a policy but never broadened.
Example
const trusted: TrustedJobScope = { application: "app", environment: "test", scope: "tenant:a" };
Signature
export interface TrustedJobScope {
readonly application: string;
readonly environment: string;
readonly scope: string;
readonly subject?: string;
}
canonical-support.ts
CanonicalProjectionError (class)
A task schema that cannot be represented as faithful canonical JSON.
Example
new CanonicalProjectionError({ name: "input", reason: "invalid schema" });
Signature
declare class CanonicalProjectionError
assertCanonicalProjection
Synchronous canonical-schema assertion.
Throws
TypeError when the projection is not faithful canonical JSON.
Example
assertCanonicalProjection({ type: "string" }, "input");
Signature
declare const assertCanonicalProjection: (
value: unknown,
name: string,
allowVoid?: boolean,
) => void;
assertCanonicalProjectionEffect
Traverses a projected schema in Effect, preserving exact validation failures.
Example
Effect.runPromise(assertCanonicalProjectionEffect({ type: "string" }, "input"));
Signature
declare const assertCanonicalProjectionEffect: (
value: unknown,
name: string,
allowVoid?: any,
) => Effect.Effect<void, CanonicalProjectionError, never>;
capabilities.ts
JobsCapability
Signature
declare const JobsCapability: JobsCapability;
JobsCapabilityError (class)
Compatibility error raised by synchronous capability checks.
Example
if (error instanceof JobsCapabilityError) console.log(error.message);
Signature
declare class JobsCapabilityError {
constructor(capability: string, message = `Jobs capability "${capability}" is unavailable`);
}
code (property)
Signature
readonly code: "RELKIT_JOB_CAPABILITY_UNSUPPORTED"
capability (property)
Signature
readonly capability: string
JobsCapabilityFailure (class)
A capability rejected by the Effect jobs boundary.
Example
if (error instanceof JobsCapabilityFailure) console.log(error.message);
Signature
declare class JobsCapabilityFailure
JobsCapabilityName
Signature
declare const JobsCapabilityName: JobsCapabilityName;
JobsCapabilityReport
Signature
declare const JobsCapabilityReport: JobsCapabilityReport;
JobsCapabilitySupport
Signature
declare const JobsCapabilitySupport: JobsCapabilitySupport;
assertAdapterMethods
Signature
declare const assertAdapterMethods: (adapter: JobsAdapterRuntime) => void;
assertAdapterMethodsEffect
Signature
declare const assertAdapterMethodsEffect: (
adapter: JobsAdapterRuntime,
) => Effect.Effect<undefined, JobsCapabilityFailure, never>;
assertJobsCapability
Synchronously requires a supported jobs capability.
Throws
JobsCapabilityError when unsupported.
Example
assertJobsCapability(report, "submission");
Signature
declare const assertJobsCapability: (report: JobsCapabilityReport, capability: string) => void;
assertJobsCapabilityEffect
Requires support for one jobs capability.
Example
Effect.runSync(assertJobsCapabilityEffect(report, "submission"));
Signature
declare const assertJobsCapabilityEffect: (
report: JobsCapabilityReport,
capability: string,
) => Effect.Effect<undefined, JobsCapabilityFailure, never>;
validateJobsCapabilityReport
Synchronously validates and freezes a provider report.
Throws
JobsCapabilityError when invalid.
Example
validateJobsCapabilityReport(candidate);
Signature
declare const validateJobsCapabilityReport: (value: unknown) => JobsCapabilityReport;
validateJobsCapabilityReportEffect
Validates and freezes an untrusted provider report in Effect.
Example
Effect.runSync(validateJobsCapabilityReportEffect(candidate));
Signature
declare const validateJobsCapabilityReportEffect: (
value: unknown,
) => Effect.Effect<JobsCapabilityReport, JobsCapabilityFailure, never>;
capabilities.types.ts
Level of support reported by a jobs provider.
JobsCapability (interface)
Evidence and constraints for one provider capability.
Signature
export interface JobsCapability {
readonly support: JobsCapabilitySupport;
readonly constraints?: Readonly<Record<string, unknown>>;
readonly evidence?: readonly string[];
}
JobsCapabilityName (type alias)
Standard jobs capability names.
Signature
type JobsCapabilityName =
"submission" | "read" | "list" | "observation" | "cancel" | "retry" | "schedules" | "streams";
JobsCapabilityReport (interface)
Provider capabilities validated at the jobs boundary.
Signature
export interface JobsCapabilityReport {
readonly service: string;
readonly provider?: string;
readonly adapterId?: string;
readonly protocolVersion?: 1;
readonly features: Readonly<Record<string, boolean>>;
readonly capabilities?: Readonly<Record<string, JobsCapability>>;
readonly limits?: Readonly<Record<string, number>>;
}
JobsCapabilitySupport (type alias)
Level of support reported by a jobs provider.
Signature
type JobsCapabilitySupport = "native" | "adapter" | "unsupported" | "unverified";
client-abort.ts
JobClientAbortFailure (class)
Cancelled, timed out, or failed client enqueue, with the original cause.
Example
if (error instanceof JobClientAbortFailure) console.log(error.message);
Signature
declare class JobClientAbortFailure
runAbortable
Promise compatibility adapter for abortable client work.
Throws
The original cancellation, timeout, or provider error.
Example
await runAbortable(signal, undefined, () => Promise.resolve("ok"));
Signature
declare const runAbortable: <A>(
signal: AbortSignal,
deadlineMs: number | undefined,
work: (signal: AbortSignal) => Promise<A>,
) => Promise<A>;
runAbortableEffect
Runs client work with an Effect owned abort listener and deadline.
Example
Effect.runPromise(runAbortableEffect(signal, undefined, () => Promise.resolve("ok")));
Signature
declare const runAbortableEffect: <A>(
signal: AbortSignal,
deadlineMs: number | undefined,
work: (signal: AbortSignal) => Promise<A>,
) => Effect.Effect<Awaited<A>, JobClientAbortFailure, never>;
client-abort.types.ts
Cancellation and deadline state owned by one client enqueue.
JobClientAbortRegistration (interface)
Cancellation and deadline state owned by one client enqueue.
Signature
export interface JobClientAbortRegistration {
readonly stopped: Promise<Error>;
readonly failure: () => Error | undefined;
readonly dispose: () => void;
}
client-errors.ts
JobDependencyError (class)
A job call crossed an undeclared function dependency boundary.
Example
new JobDependencyError("billing.charge");
Signature
declare class JobDependencyError { constructor(readonly jobId: string) }
code (property)
Signature
readonly code: "RELKIT_JOB_DEPENDENCY_UNDECLARED"
JobInputValidationError (class)
Invalid caller input with the schema issues retained for clients.
Example
new JobInputValidationError(issues);
Signature
declare class JobInputValidationError { constructor(readonly issues: readonly StandardIssue[]) }
code (property)
Signature
readonly code: "RELKIT_JOB_INPUT_VALIDATION"
JobOperationCancelledError (class)
Caller cancellation before the job operation completed.
Example
new JobOperationCancelledError();
Signature
declare class JobOperationCancelledError {
constructor();
}
code (property)
Signature
readonly code: "ABORT_ERR"
JobOperationTimeoutError (class)
A job client operation exceeded its configured timeout.
Example
new JobOperationTimeoutError();
Signature
declare class JobOperationTimeoutError {
constructor();
}
code (property)
Signature
readonly code: "ETIMEDOUT"
JobProfileError (class)
Requested job provider profile is absent from client configuration.
Example
new JobProfileError("primary");
Signature
declare class JobProfileError { constructor(readonly profile: string) }
code (property)
Signature
readonly code: "RELKIT_JOB_PROFILE_UNKNOWN"
JobProviderError (class)
The selected provider does not implement job enqueue.
Example
new JobProviderError();
Signature
declare class JobProviderError {
constructor();
}
code (property)
Signature
readonly code: "RELKIT_JOB_PROVIDER_UNAVAILABLE"
client-utils-error.ts
ClientUtilityFailure (class)
Expected client helper failure with its original compatibility error.
Example
if (error instanceof ClientUtilityFailure) console.log(error.message);
Signature
declare class ClientUtilityFailure
client-utils-output.ts
normalizeResult
Synchronous provider receipt normalizer.
Throws
Original normalization error.
Example
normalizeResult(receipt, "default", undefined);
Signature
declare const normalizeResult: (
value: JobProviderResult | undefined,
profile: string,
correlationId: string | undefined,
) => JobEnqueueResult;
normalizeResultEffect
Normalizes a provider receipt in Effect.
Example
Effect.runSync(normalizeResultEffect(receipt, "default", undefined));
Signature
declare const normalizeResultEffect: (
value: JobProviderResult | undefined,
profile: string,
correlationId: string | undefined,
) => Effect.Effect<JobEnqueueResult, ClientUtilityFailure, never>;
notify
Synchronous client edge hook notification.
Example
notify(onEdge, edge);
Signature
declare const notify: <T>(
hook: ((value: T) => void) | undefined,
value: T,
enabled?: boolean,
) => void;
notifyEffect
Delivers a client edge hook without changing enqueue outcome in Effect.
Example
Effect.runSync(notifyEffect(onEdge, edge));
Signature
declare const notifyEffect: <T>(
hook: ((value: T) => void) | undefined,
value: T,
enabled?: boolean | undefined,
) => Effect.Effect<void, never, never>;
resolveCorrelation
Synchronous correlation id resolver.
Throws
Original callback error.
Example
resolveCorrelation(() => "request");
Signature
declare const resolveCorrelation: (value: JobClientOptions["correlationId"]) => string | undefined;
resolveCorrelationEffect
Resolves a configured correlation id in Effect.
Example
Effect.runSync(resolveCorrelationEffect(() => "request"));
Signature
declare const resolveCorrelationEffect: (
value: string | (() => string | undefined) | undefined,
) => Effect.Effect<string | undefined, ClientUtilityFailure, never>;
client-utils-validation.ts
assertOptionalText
Synchronous optional client text assertion.
Throws
TypeError for invalid text.
Example
assertOptionalText("request", "correlationId");
Signature
declare const assertOptionalText: (value: unknown, name: string) => void;
assertOptionalTextEffect
Validates optional client text in Effect.
Example
Effect.runSync(assertOptionalTextEffect("request", "correlationId"));
Signature
declare const assertOptionalTextEffect: (
value: unknown,
name: string,
) => Effect.Effect<void, ClientUtilityFailure, never>;
assertOptions
Synchronous enqueue options assertion.
Throws
TypeError for invalid options.
Example
assertOptions({ correlationId: "request" });
Signature
declare const assertOptions: (
value: unknown,
) => asserts value is { readonly correlationId?: string };
assertOptionsEffect
Validates enqueue options in Effect.
Example
Effect.runSync(assertOptionsEffect({ correlationId: "request" }));
Signature
declare const assertOptionsEffect: (
value: unknown,
) => Effect.Effect<void, ClientUtilityFailure, never>;
parseInput
Promise compatibility input validator.
Throws
Original input validation error.
Example
await parseInput(z.string(), "value");
Signature
declare const parseInput: (
schema: StandardSchemaV1 | undefined,
input: unknown,
) => Promise<unknown>;
parseInputEffect
Validates client input against an optional schema in Effect.
Example
Effect.runPromise(parseInputEffect(z.string(), "value"));
Signature
declare const parseInputEffect: (
schema: StandardSchemaV1<unknown, unknown> | undefined,
input: unknown,
) => Effect.Effect<unknown, ClientUtilityFailure, never>;
resolveProvider
Synchronous provider resolver.
Throws
Original profile or provider error.
Example
resolveProvider(source, "default", undefined);
Signature
declare const resolveProvider: (
source: unknown,
profile: string,
resolveProfile: ((profile: string) => unknown) | undefined,
) => JobProvider;
resolveProviderEffect
Resolves a job provider in Effect.
Example
Effect.runSync(resolveProviderEffect(source, "default"));
Signature
declare const resolveProviderEffect: (
source: unknown,
profile: string,
resolveProfile: ((profile: string) => unknown) | undefined,
) => Effect.Effect<JobProvider, ClientUtilityFailure, never>;
client-utils-value.ts
assertOptionalTextValue
Requires a present optional text field to be nonempty.
Throws
TypeError for nontext or blank text.
Example
assertOptionalTextValue("request-1", "correlationId");
Signature
declare const assertOptionalTextValue: (value: unknown, name: string) => void;
assertOptionsValue
Validates the client enqueue options shape and correlation identifier.
Throws
TypeError for missing object shape or invalid correlation text.
Example
assertOptionsValue({ correlationId: "request-1" });
Signature
declare const assertOptionsValue: (
value: unknown,
) => asserts value is { readonly correlationId?: string };
normalizeResultValue
Normalizes a provider acceptance into the public enqueue receipt.
Example
normalizeResultValue(result, "primary", "request-1");
Signature
declare const normalizeResultValue: (
value: JobProviderResult | undefined,
profile: string,
correlationId: string | undefined,
) => JobEnqueueResult;
notifyValue
Calls an optional observer without letting hook errors change acceptance.
Example
notifyValue(onAccepted, receipt);
Signature
declare const notifyValue: <T>(
hook: ((value: T) => void) | undefined,
value: T,
enabled?: boolean,
) => void;
parseInputValue
Validates authored client input before enqueueing.
Throws
JobInputValidationError for schema issues.
Example
await parseInputValue(schema, { id: "one" });
Signature
declare const parseInputValue: (
schema: StandardSchemaV1 | undefined,
input: unknown,
) => Promise<unknown>;
resolveCorrelationValue
Resolves a literal or lazy client correlation identifier.
Example
resolveCorrelationValue(() => "request-1");
Signature
declare const resolveCorrelationValue: (
value: JobClientOptions["correlationId"],
) => string | undefined;
resolveProviderValue
Resolves an enqueue provider from a named profile or explicit resolver.
Throws
JobProfileError or JobProviderError when unavailable.
Example
resolveProviderValue(providers, "primary", undefined);
Signature
declare const resolveProviderValue: (
source: unknown,
profile: string,
resolveProfile: ((profile: string) => unknown) | undefined,
) => JobProvider;
client-utils.ts
“./client-utils-output.js” (namespace export)
Re-exports all named exports from the “./client-utils-output.js” module.
Signature
export * from "./client-utils-output.js";
“./client-utils-validation.js” (namespace export)
Re-exports all named exports from the “./client-utils-validation.js” module.
Signature
export * from "./client-utils-validation.js";
ClientUtilityFailure
Signature
declare const ClientUtilityFailure: typeof ClientUtilityFailure;
JobClientAbortFailure
Signature
declare const JobClientAbortFailure: typeof JobClientAbortFailure;
runAbortable
Signature
declare const runAbortable: <A>(
signal: AbortSignal,
deadlineMs: number | undefined,
work: (signal: AbortSignal) => Promise<A>,
) => Promise<A>;
runAbortableEffect
Signature
declare const runAbortableEffect: <A>(
signal: AbortSignal,
deadlineMs: number | undefined,
work: (signal: AbortSignal) => Promise<A>,
) => Effect<Awaited<A>, JobClientAbortFailure, never>;
client.ts
EffectJobClient
Signature
declare const EffectJobClient: EffectJobClient<Input>;
JobClient
Signature
declare const JobClient: JobClient<Input>;
JobClientFailure (class)
Expected client setup or enqueue failure, preserving its original cause.
Example
if (error instanceof JobClientFailure) console.log(error.message);
Signature
declare class JobClientFailure
JobClientOptions
Signature
declare const JobClientOptions: JobClientOptions;
JobDeclaredEdge
Signature
declare const JobDeclaredEdge: JobDeclaredEdge;
JobDependencyError
Signature
declare const JobDependencyError: typeof JobDependencyError;
JobEnqueueOptions
Signature
declare const JobEnqueueOptions: JobEnqueueOptions;
JobEnqueueResult
Signature
declare const JobEnqueueResult: JobEnqueueResult;
JobInputValidationError
Signature
declare const JobInputValidationError: typeof JobInputValidationError;
JobInvocationBridge
Signature
declare const JobInvocationBridge: JobInvocationBridge;
JobInvocationBridgeOptions
Signature
declare const JobInvocationBridgeOptions: JobInvocationBridgeOptions;
JobObservedEdge
Signature
declare const JobObservedEdge: JobObservedEdge;
JobOperationCancelledError
Signature
declare const JobOperationCancelledError: typeof JobOperationCancelledError;
JobOperationContext
Signature
declare const JobOperationContext: JobOperationContext;
JobOperationTimeoutError
Signature
declare const JobOperationTimeoutError: typeof JobOperationTimeoutError;
JobProfileError
Signature
declare const JobProfileError: typeof JobProfileError;
JobProvider
Signature
declare const JobProvider: JobProvider;
JobProviderError
Signature
declare const JobProviderError: typeof JobProviderError;
JobProviderResult
Signature
declare const JobProviderResult: JobProviderResult;
JobState
Signature
declare const JobState: JobState;
JobStatus
Signature
declare const JobStatus: JobStatus;
createJobClient
Synchronous compatibility client factory.
Throws
The original invalid profile or provider error.
Example
createJobClient(options);
Signature
declare const createJobClient: (options: JobClientOptions) => EffectJobClient;
createJobClientEffect
Creates a jobs enqueue client in Effect.
Example
Effect.runSync(createJobClientEffect(options));
Signature
declare const createJobClientEffect: (
options: JobClientOptions,
) => Effect.Effect<EffectJobClient<unknown>, JobClientFailure, never>;
client.types.ts
EffectJobClient (interface)
A client whose enqueue operation is directly available in Effect.
Signature
export interface EffectJobClient<Input = unknown> extends JobClient<Input> {
readonly enqueueEffect: (
input: Input,
options?: JobEnqueueOptions,
) => Effect.Effect<JobEnqueueResult, JobClientFailure>;
}
JobClient (interface)
Client operations exposed for a job through its provider.
Signature
export interface JobClient<Input = unknown> {
readonly enqueue: (input: Input, options?: JobEnqueueOptions) => Promise<JobEnqueueResult>;
}
JobClientOptions (interface)
Options accepted for job client operations.
Signature
export interface JobClientOptions {
readonly ownerId: string;
readonly jobId: string;
readonly source: unknown;
readonly inputSchema?: StandardSchemaV1;
readonly profile?: string;
readonly resolveProfile?: (profile: string) => unknown;
readonly bridge?: JobInvocationBridge;
readonly signal?: () => AbortSignal;
readonly deadline?: () => number | undefined;
readonly correlationId?: string | (() => string | undefined);
readonly declared?: boolean;
readonly onDeclaredEdge?: (edge: JobDeclaredEdge) => void;
readonly onObservedEdge?: (edge: JobObservedEdge) => void;
}
JobClientState (interface)
Resolved dependencies shared by a client’s enqueue operations.
Signature
export interface JobClientState {
readonly options: JobClientOptions;
readonly ownerId: string;
readonly jobId: string;
readonly profile: string;
readonly declared: boolean;
readonly provider: JobProvider;
}
JobDeclaredEdge (interface)
Declared dependency between a task and job.
Signature
export interface JobDeclaredEdge {
readonly kind: "enqueues-job";
readonly from: string;
readonly to: string;
}
JobInvocationBridge (interface)
Bridge for invoking jobs from a task execution context.
Signature
export interface JobInvocationBridge {
readonly run: <A>(
operation: () => MaybePromise<A>,
options?: JobInvocationBridgeOptions,
) => Promise<A>;
}
JobInvocationBridgeOptions (interface)
Options accepted for job invocation bridge operations.
Signature
export interface JobInvocationBridgeOptions {
readonly name: string;
readonly attributes: Readonly<Record<string, unknown>>;
readonly signal: AbortSignal;
readonly kind?: "producer";
readonly input?: unknown;
}
JobObservedEdge (interface)
Job edge recorded during a concrete invocation.
Signature
export interface JobObservedEdge {
readonly relationship: "enqueues-job";
readonly from: string;
readonly to: string;
}
JobOperationContext (interface)
Trusted job, scope, and signal data available during a client operation.
Signature
export interface JobOperationContext {
readonly operation: "enqueue";
readonly signal: AbortSignal;
readonly profile: string;
readonly deadlineMs?: number;
readonly correlationId?: string;
readonly propagation?: TracePropagation;
}
JobProvider (interface)
Provider callback used to resolve the jobs runtime.
Signature
export interface JobProvider {
readonly enqueue: (
input: unknown,
options: JobEnqueueOptions,
context: JobOperationContext,
) => MaybePromise<JobProviderResult>;
}
JobProviderResult (type alias)
Runtime or handle returned by the job provider.
Signature
type JobProviderResult = Pick<JobEnqueueResult, "instanceId" | "accepted"> &
Partial<
Pick<
JobEnqueueResult,
| "status"
| "profile"
| "correlationId"
| "duplicate"
| "idempotencyKey"
| "idempotencyExpiresAt"
>
>;
control-errors.ts
JobControlUnknownError (class)
A native control write may have committed; callers can recover by operation ID.
Example
new JobControlUnknownError("cancel-1", "same-key");
Signature
declare class JobControlUnknownError { constructor(
readonly operationId: string,
readonly idempotencyKey?: string,
recovery: JobUnknownOutcome["recovery"] = { action: "inspect-native" },
) }
toJSON (method)
Serializes the bounded recovery contract for callers.
Example
error.toJSON();
Signature
declare const toJSON: () => JobUnknownOutcome;
code (property)
Signature
readonly code: "RELKIT_JOB_CONTROL_UNKNOWN"
outcome (property)
Signature
readonly outcome: "unknown"
recovery (property)
Signature
readonly recovery: { readonly action: "retry-with-same-key" | "inspect-native" | "unavailable"; readonly expiresAt?: string; }
JobObservationTimeoutError (class)
A native observation read exceeded its bounded timeout.
Example
new JobObservationTimeoutError(5_000);
Signature
declare class JobObservationTimeoutError { constructor(readonly timeoutMs: number) }
code (property)
Signature
readonly code: "RELKIT_JOB_OBSERVATION_TIMEOUT"
JobResultUnavailableError (class)
A completed run has no result available to this caller.
Example
new JobResultUnavailableError("expired");
Signature
declare class JobResultUnavailableError { constructor(
readonly availability: string,
message = "The requested job result is unavailable",
) }
code (property)
Signature
readonly code: "RELKIT_JOB_RESULT_UNAVAILABLE"
TaskBlockingWaitError (class)
Task execution cannot synchronously wait for another task result.
Example
new TaskBlockingWaitError();
Signature
declare class TaskBlockingWaitError {
constructor();
}
code (property)
Signature
readonly code: "RELKIT_TASK_BLOCKING_WAIT_UNSUPPORTED"
control-observe.ts
JobObserveFailure (class)
Expected run observation failure with its original cause.
Example
if (error instanceof JobObserveFailure) console.log(error.message);
Signature
declare class JobObserveFailure
observeWithTimeout
Compatibility async iterable with scoped iterator cleanup.
Throws
Original read, cancellation, or timeout error while consuming.
Example
for await (const frame of observeWithTimeout(source, signal, 1000)) console.log(frame);
Signature
declare const observeWithTimeout: (
source: AsyncIterable<RunWatchFrame<RunSnapshot>>,
signal: AbortSignal,
timeoutMs: number,
) => AsyncIterable<RunWatchFrame<RunSnapshot>>;
observeWithTimeoutEffect
Creates a scoped run observation stream in Effect.
Example
Effect.runPromise(
Effect.flatMap(observeWithTimeoutEffect(source, signal, 1000), Stream.runCollect),
);
Signature
declare const observeWithTimeoutEffect: (
source: AsyncIterable<RunWatchFrame<RunSnapshot>>,
signal: AbortSignal,
timeoutMs: number,
) => Effect.Effect<
Stream.Stream<RunWatchFrame<RunSnapshot>, JobObserveFailure, never>,
never,
never
>;
control-result.ts
JobResultFailure (class)
Expected result polling failure retaining its original cause.
Example
if (error instanceof JobResultFailure) console.log(error.message);
Signature
declare class JobResultFailure
ReadRun
Signature
declare const ReadRun: ReadRun;
ResultRunReader (class)
Injectable run snapshot reader for result polling.
Example
const service = yield * ResultRunReader;
Signature
declare class ResultRunReader
resultRunReaderLayer
Provides a snapshot reader for deterministic result polling.
Example
Effect.provide(waitForResultEffect(runtime, id, options), resultRunReaderLayer(readRun));
Signature
declare const resultRunReaderLayer: (
readRun: ReadRun,
) => Layer.Layer<ResultRunReader, never, never>;
waitForResult
Promise compatibility result polling.
Throws
Original validation, cancellation, read, or availability error.
Example
await waitForResult(runtime, id, options, readRun);
Signature
declare const waitForResult: (
runtime: JobsRuntime,
runId: string,
options: RunResultOptions,
readRun: ReadRun,
) => Promise<unknown>;
waitForResultEffect
Polls for a terminal result with Effect Clock and an owned abort listener.
Example
Effect.runPromise(
Effect.provide(waitForResultEffect(runtime, id, options), resultRunReaderLayer(readRun)),
);
Signature
declare const waitForResultEffect: (
runtime: JobsRuntime,
runId: string,
options: RunResultOptions,
) => Effect.Effect<unknown, JobResultFailure, ResultRunReader>;
control-result.types.ts
ReadRun (type alias)
Substitutable snapshot reader for result polling.
Signature
type ReadRun = (runtime: JobsRuntime, runId: string, signal?: AbortSignal) => Promise<RunSnapshot>;
control-support-methods.ts
operationContext
Synchronous native operation context creator.
Throws
Original runtime context error.
Example
operationContext(runtime, undefined);
Signature
declare const operationContext: (
runtime: JobsRuntime,
signal: AbortSignal | undefined,
operationId?: string,
) => OperationContext;
operationContextEffect
Creates a native operation context in Effect.
Example
Effect.runSync(operationContextEffect(runtime, undefined));
Signature
declare const operationContextEffect: (
runtime: JobsRuntime,
signal: AbortSignal | undefined,
operationId?: string | undefined,
) => Effect.Effect<OperationContext, ControlSupportFailure, never>;
requireMethod
Synchronous native method and capability assertion.
Throws
JobsCapabilityError when unavailable.
Example
requireMethod(runtime, "read", "get");
Signature
declare const requireMethod: (
runtime: JobsRuntime,
capability: string,
method: keyof JobsRuntime["adapter"],
) => void;
requireMethodEffect
Requires a native adapter method and capability in Effect.
Example
Effect.runSync(requireMethodEffect(runtime, "read", "get"));
Signature
declare const requireMethodEffect: (
runtime: JobsRuntime,
capability: string,
method: keyof JobsAdapterRuntime,
) => Effect.Effect<void, ControlSupportFailure, never>;
requireOperationId
Synchronous bounded control operation ID assertion.
Throws
TypeError when missing or too long.
Example
requireOperationId("cancel-1");
Signature
declare const requireOperationId: (value: string) => void;
requireOperationIdEffect
Validates a bounded control operation ID in Effect.
Example
Effect.runSync(requireOperationIdEffect("cancel-1"));
Signature
declare const requireOperationIdEffect: (
value: string,
) => Effect.Effect<void, ControlSupportFailure, never>;
control-support-observation.ts
isControlRecordEffect
Tests for a nonarray record in Effect.
Example
Effect.runSync(isControlRecordEffect({ id: "run" }));
Signature
declare const isControlRecordEffect: (
value: unknown,
) => Effect.Effect<boolean, ControlSupportFailure, never>;
isRecord
Synchronous nonarray record type guard.
Example
isRecord({ id: "run" });
Signature
declare const isRecord: (value: unknown) => value is Record<string, unknown>;
isTerminal
Synchronous terminal run status test.
Example
isTerminal(run);
Signature
declare const isTerminal: (run: RunSnapshot) => boolean;
isTerminalEffect
Tests whether a run is terminal in Effect.
Example
Effect.runSync(isTerminalEffect(run));
Signature
declare const isTerminalEffect: (
run: RunSnapshot,
) => Effect.Effect<boolean, ControlSupportFailure, never>;
observerTimeout
Synchronous bounded native observation timeout.
Throws
RangeError for an unsafe duration.
Example
observerTimeout(runtime);
Signature
declare const observerTimeout: (runtime: JobsRuntime, authored?: DurationInput) => number;
observerTimeoutEffect
Computes a bounded native observation read timeout in Effect.
Example
Effect.runSync(observerTimeoutEffect(runtime));
Signature
declare const observerTimeoutEffect: (
runtime: JobsRuntime,
authored?:
| `${number} second`
| `${number} seconds`
| `${number} minute`
| `${number} minutes`
| `${number} hour`
| `${number} hours`
| `${number} day`
| `${number} days`
| `${number} week`
| `${number} weeks`
| `${number} millisecond`
| `${number} milliseconds`
| undefined,
) => Effect.Effect<number, ControlSupportFailure, never>;
control-support-receipts.ts
isUnknown
Synchronous uncertain outcome type guard.
Example
if (isUnknown(response)) console.log(response.operationId);
Signature
declare const isUnknown: (value: unknown) => value is UnknownControlOutcome;
isUnknownEffect
Tests an uncertain native outcome in Effect.
Example
Effect.runSync(isUnknownEffect(response));
Signature
declare const isUnknownEffect: (
value: unknown,
) => Effect.Effect<boolean, ControlSupportFailure, never>;
normalizeCancellationReceipt
Synchronous cancellation receipt normalizer.
Throws
TypeError for a mismatched or malformed receipt.
Example
normalizeCancellationReceipt(value, "run", "cancel");
Signature
declare const normalizeCancellationReceipt: (
value: unknown,
runId: string,
operationId: string,
) => RunCancellationReceipt;
normalizeCancellationReceiptEffect
Normalizes a native cancellation receipt in Effect.
Example
Effect.runSync(normalizeCancellationReceiptEffect(value, "run", "cancel"));
Signature
declare const normalizeCancellationReceiptEffect: (
value: unknown,
runId: string,
operationId: string,
) => Effect.Effect<RunCancellationReceipt, ControlSupportFailure, never>;
normalizeRetryReceipt
Synchronous retry receipt normalizer.
Throws
TypeError for a mismatched or malformed receipt.
Example
normalizeRetryReceipt(value, "run-1");
Signature
declare const normalizeRetryReceipt: (value: unknown, originalRunId: string) => RunRetryReceipt;
normalizeRetryReceiptEffect
Normalizes a native retry receipt in Effect.
Example
Effect.runSync(normalizeRetryReceiptEffect(value, "run-1"));
Signature
declare const normalizeRetryReceiptEffect: (
value: unknown,
originalRunId: string,
) => Effect.Effect<RunRetryReceipt, ControlSupportFailure, never>;
unknownKey
Synchronous uncertain outcome key reader.
Example
unknownKey(response);
Signature
declare const unknownKey: (value: unknown) => string | undefined;
unknownKeyEffect
Reads an uncertain outcome’s idempotency key in Effect.
Example
Effect.runSync(unknownKeyEffect(response));
Signature
declare const unknownKeyEffect: (
value: unknown,
) => Effect.Effect<string | undefined, ControlSupportFailure, never>;
unknownRecovery
Synchronous uncertain outcome recovery reader.
Example
unknownRecovery(response);
Signature
declare const unknownRecovery: (value: unknown) => JobUnknownOutcome["recovery"] | undefined;
unknownRecoveryEffect
Reads bounded recovery guidance in Effect.
Example
Effect.runSync(unknownRecoveryEffect(response));
Signature
declare const unknownRecoveryEffect: (value: unknown) => Effect.Effect<
| {
readonly action: "retry-with-same-key" | "inspect-native" | "unavailable";
readonly expiresAt?: string;
}
| undefined,
ControlSupportFailure,
never
>;
control-support-run.ts
ControlSupportFailure (class)
Expected run control helper failure with its original cause.
Example
if (error instanceof ControlSupportFailure) console.log(error.message);
Signature
declare class ControlSupportFailure
controlSupportEffect
Runs a control helper inside an observed Effect.
Example
controlSupportEffect("controls.read", () => receipt);
Signature
declare const controlSupportEffect: <A>(
operation: JobsOperation,
compute: () => A,
) => Effect.Effect<A, ControlSupportFailure, never>;
runControlSupport
Synchronous control helper compatibility runner.
Throws
The original helper error on failure.
Example
runControlSupport(controlSupportEffect("controls.read", () => receipt));
Signature
declare const runControlSupport: <A>(effect: Effect.Effect<A, ControlSupportFailure>) => A;
control-support-value-observation.ts
isTerminal
Tests whether a run has reached a terminal state.
Example
isTerminal(snapshot);
Signature
declare const isTerminal: (run: RunSnapshot) => boolean;
observerTimeout
Resolves a bounded per-read observation timeout.
Throws
RangeError for invalid or oversized timeouts.
Example
observerTimeout(runtime, "2 seconds");
Signature
declare const observerTimeout: (runtime: JobsRuntime, authored?: DurationInput) => number;
control-support-value.ts
isRecord
Tests for a nonarray native response record.
Example
isRecord({ outcome: "requested" });
Signature
declare const isRecord: (value: unknown) => value is Record<string, unknown>;
isTerminal
Signature
declare const isTerminal: (run: RunSnapshot) => boolean;
isUnknown
Recognizes an uncertain native control outcome.
Example
isUnknown(response);
Signature
declare const isUnknown: (value: unknown) => value is UnknownControlOutcome;
normalizeCancellationReceipt
Validates and freezes a native cancellation receipt.
Throws
TypeError for mismatched identities or invalid fields.
Example
normalizeCancellationReceipt(receipt, "run-1", "cancel-1");
Signature
declare const normalizeCancellationReceipt: (
value: unknown,
runId: string,
operationId: string,
) => RunCancellationReceipt;
normalizeRetryReceipt
Validates that a native retry created a new run from the original.
Throws
TypeError for missing durable identity or reused run ID.
Example
normalizeRetryReceipt(receipt, "run-1");
Signature
declare const normalizeRetryReceipt: (value: unknown, originalRunId: string) => RunRetryReceipt;
observerTimeout
Signature
declare const observerTimeout: (runtime: JobsRuntime, authored?: DurationInput) => number;
operationContext
Builds a native context with a caller signal and optional operation ID.
Example
operationContext(runtime, undefined, "cancel-1");
Signature
declare const operationContext: (
runtime: JobsRuntime,
signal: AbortSignal | undefined,
operationId?: string,
) => OperationContext;
requireMethod
Requires a provider method and its reported capability.
Throws
JobsCapabilityError when unavailable.
Example
requireMethod(runtime, "read", "get");
Signature
declare const requireMethod: (
runtime: JobsRuntime,
capability: string,
method: keyof JobsRuntime["adapter"],
) => void;
requireOperationId
Validates a bounded idempotent control operation identity.
Throws
TypeError for blank or oversized IDs.
Example
requireOperationId("cancel-1");
Signature
declare const requireOperationId: (value: string) => void;
unknownKey
Reads an optional idempotency key from an uncertain outcome.
Example
unknownKey(response);
Signature
declare const unknownKey: (value: unknown) => string | undefined;
unknownRecovery
Copies a recognized native recovery action from an uncertain outcome.
Example
unknownRecovery(response);
Signature
declare const unknownRecovery: (value: unknown) => JobUnknownOutcome["recovery"] | undefined;
control-support.ts
“./control-support-methods.js” (namespace export)
Re-exports all named exports from the “./control-support-methods.js” module.
Signature
export * from "./control-support-methods.js";
“./control-support-observation.js” (namespace export)
Re-exports all named exports from the “./control-support-observation.js” module.
Signature
export * from "./control-support-observation.js";
“./control-support-receipts.js” (namespace export)
Re-exports all named exports from the “./control-support-receipts.js” module.
Signature
export * from "./control-support-receipts.js";
ControlSupportFailure
Signature
declare const ControlSupportFailure: typeof ControlSupportFailure;
JobObserveFailure
Signature
declare const JobObserveFailure: typeof JobObserveFailure;
JobObserveOptions
Signature
declare const JobObserveOptions: JobObserveOptions;
UnknownControlOutcome
Signature
declare const UnknownControlOutcome: UnknownControlOutcome;
observeWithTimeout
Signature
declare const observeWithTimeout: (
source: AsyncIterable<RunWatchFrame<RunSnapshot>>,
signal: AbortSignal,
timeoutMs: number,
) => AsyncIterable<RunWatchFrame<RunSnapshot>>;
observeWithTimeoutEffect
Signature
declare const observeWithTimeoutEffect: (
source: AsyncIterable<RunWatchFrame<RunSnapshot>>,
signal: AbortSignal,
timeoutMs: number,
) => Effect<Stream<RunWatchFrame<RunSnapshot>, JobObserveFailure, never>, never, never>;
control-support.types.ts
JobObserveOptions (interface)
Signal and per-read timeout for native run observation.
Signature
export interface JobObserveOptions {
readonly signal?: AbortSignal;
readonly timeout?: DurationInput;
}
UnknownControlOutcome (interface)
Native control response with an uncertain outcome.
Signature
export interface UnknownControlOutcome {
readonly operationId: string;
readonly idempotencyKey?: string;
readonly outcome: "unknown";
readonly recovery?: JobUnknownOutcome["recovery"];
}
control-write.ts
JobControlWriteFailure (class)
A cancelled, uncertain, or provider-failed native control write.
Example
new JobControlWriteFailure({ operationId: "op", kind: "unknown", cause: new Error() });
Signature
declare class JobControlWriteFailure
controlWrite
Promise compatibility adapter for native control writes.
Throws
The original cancellation, unknown-outcome, or provider error.
Example
await controlWrite(() => Promise.resolve("ok"), undefined, "op");
Signature
declare const controlWrite: <A>(
call: () => Promise<A>,
signal: AbortSignal | undefined,
operationId: string,
) => Promise<A>;
controlWriteEffect
Calls a native control write with an Effect-managed abort listener. Cancellation before the provider begins prevents the call. Cancellation after start produces an unknown outcome requiring operation-id recovery.
Example
Effect.runPromise(controlWriteEffect(() => Promise.resolve("ok"), undefined, "op"));
Signature
declare const controlWriteEffect: <A>(
call: () => Promise<A>,
signal: AbortSignal | undefined,
operationId: string,
) => Effect.Effect<A, JobControlWriteFailure, never>;
control-write.types.ts
Lifetime of one registered abort listener for a native control write.
ControlWriteRegistration (interface)
Lifetime of one registered abort listener for a native control write.
Signature
export interface ControlWriteRegistration {
readonly aborted: Promise<void>;
readonly isAborted: () => boolean;
readonly dispose: () => void;
}
controls-factory.ts
createJobsControls
Synchronous factory for a run controls facade.
Example
createJobsControls(runtime);
Signature
declare const createJobsControls: (runtime?: JobsRuntime) => JobsControls;
createJobsControlsEffect
Builds a run controls facade in Effect.
Example
Effect.runSync(createJobsControlsEffect(runtime));
Signature
declare const createJobsControlsEffect: (
runtime: JobsRuntime,
) => Effect.Effect<JobsControls, never, never>;
controls-observe.ts
observeRun
Synchronous compatibility adapter for run observation.
Throws
The original capability or provider error during setup.
Example
for await (const frame of observeRun(runtime, request)) console.log(frame);
Signature
declare const observeRun: (
runtime: JobsRuntime,
request: NativeWatchRequest,
options?: JobObserveOptions,
) => AsyncIterable<RunWatchFrame<RunSnapshot>>;
observeRunEffect
Acquires an async run observation iterator in Effect. The caller owns iterator consumption and should close it on early exit.
Example
Effect.runSync(observeRunEffect(runtime, request));
Signature
declare const observeRunEffect: (
runtime: JobsRuntime,
request: NativeWatchRequest,
options?: JobObserveOptions | undefined,
) => Effect.Effect<AsyncIterable<RunWatchFrame<RunSnapshot>>, JobControlFailure, never>;
controls-operations.ts
cancelRunValue
Signature
declare const cancelRunValue: (
runtime: JobsRuntime,
runId: string,
options: JobCancelOptions,
) => Promise<RunCancellationReceipt>;
getRunValue
Signature
declare const getRunValue: (
runtime: JobsRuntime,
locator: string,
signal?: AbortSignal,
) => Promise<RunSnapshot>;
listRunsValue
Signature
declare const listRunsValue: (
runtime: JobsRuntime,
query?: RunListQuery,
signal?: AbortSignal,
) => Promise<RunPage<RunSnapshot>>;
observeRunValue
Builds a native run observation with a scoped iterator timeout. The consumer owns the iterator and must close it on early exit.
Throws
The original capability or observer setup error.
Example
for await (const frame of observeRunValue(runtime, request)) console.log(frame);
Signature
declare const observeRunValue: (
runtime: JobsRuntime,
request: NativeWatchRequest,
options?: JobObserveOptions,
) => AsyncIterable<RunWatchFrame<RunSnapshot>>;
retryRunValue
Signature
declare const retryRunValue: (
runtime: JobsRuntime,
runId: string,
options: JobRetryOptions,
) => Promise<RunRetryReceipt>;
controls-read.ts
ControlReadFailure (class)
Expected native run read failure with its original compatibility cause.
Example
new ControlReadFailure({ cause: new Error("read unavailable") });
Signature
declare class ControlReadFailure
getRunOperationEffect
Checks read capability and requests one native run in Effect.
Example
Effect.runPromise(getRunOperationEffect(runtime, "run-1"));
Signature
declare const getRunOperationEffect: (
runtime: JobsRuntime,
locator: string,
signal?: AbortSignal | undefined,
) => Effect.Effect<NativeRun, ControlReadFailure, never>;
getRunValue
Promise compatibility read for internal control consumers.
Throws
The original capability, context, or provider error.
Example
await getRunValue(runtime, "run-1");
Signature
declare const getRunValue: (
runtime: JobsRuntime,
locator: string,
signal?: AbortSignal,
) => Promise<RunSnapshot>;
listRunsOperationEffect
Checks list capability and validates the page limit before native IO.
Example
Effect.runPromise(listRunsOperationEffect(runtime, { limit: 25 }));
Signature
declare const listRunsOperationEffect: (
runtime: JobsRuntime,
query?: RunListQuery | undefined,
signal?: AbortSignal | undefined,
) => Effect.Effect<NativeRunPage, ControlReadFailure, never>;
listRunsValue
Promise compatibility listing for internal control consumers.
Throws
The original capability, limit, context, or provider error.
Example
await listRunsValue(runtime, { limit: 25 });
Signature
declare const listRunsValue: (
runtime: JobsRuntime,
query?: RunListQuery,
signal?: AbortSignal,
) => Promise<RunPage<RunSnapshot>>;
controls-write-operations.ts
ControlOperationFailure (class)
Expected native control operation failure with its compatibility cause.
Example
new ControlOperationFailure({ cause: new Error("provider rejected") });
Signature
declare class ControlOperationFailure
cancelRunOperationEffect
Validates and submits an idempotent native cancellation in Effect.
Example
Effect.runPromise(cancelRunOperationEffect(runtime, "run", { operationId: "op" }));
Signature
declare const cancelRunOperationEffect: (
runtime: JobsRuntime,
runId: string,
options: JobCancelOptions,
) => Effect.Effect<RunCancellationReceipt, ControlOperationFailure, never>;
cancelRunValue
Promise compatibility cancellation for internal control consumers.
Throws
The original capability, cancellation, provider, or receipt error.
Example
await cancelRunValue(runtime, "run", { operationId: "op" });
Signature
declare const cancelRunValue: (
runtime: JobsRuntime,
runId: string,
options: JobCancelOptions,
) => Promise<RunCancellationReceipt>;
retryRunOperationEffect
Reuses pinned run identity to request a fresh native retry in Effect.
Example
Effect.runPromise(retryRunOperationEffect(runtime, "run", { operationId: "op" }));
Signature
declare const retryRunOperationEffect: (
runtime: JobsRuntime,
runId: string,
options: JobRetryOptions,
) => Effect.Effect<RunRetryReceipt, ControlOperationFailure, never>;
retryRunValue
Promise compatibility retry for internal control consumers.
Throws
The original capability, provider, cancellation, or receipt error.
Example
await retryRunValue(runtime, "run", { operationId: "op" });
Signature
declare const retryRunValue: (
runtime: JobsRuntime,
runId: string,
options: JobRetryOptions,
) => Promise<RunRetryReceipt>;
controls.ts
JobCancelOptions
Signature
declare const JobCancelOptions: JobCancelOptions;
JobControlFailure (class)
Expected failure while reading or changing a job run.
Example
if (error instanceof JobControlFailure) console.log(error.message);
Signature
declare class JobControlFailure
JobObserveOptions
Signature
declare const JobObserveOptions: JobObserveOptions;
JobRetryOptions
Signature
declare const JobRetryOptions: JobRetryOptions;
JobsControls
Signature
declare const JobsControls: JobsControls;
cancelRun
Promise compatibility adapter for cancellation.
Throws
The original provider or control error.
Example
await cancelRun(runtime, "run-1", { operationId: "op" });
Signature
declare const cancelRun: (
runtime: JobsRuntime,
runId: string,
options: JobCancelOptions,
) => Promise<RunCancellationReceipt>;
cancelRunEffect
Cancels a run in Effect.
Example
Effect.runPromise(cancelRunEffect(runtime, "run-1", { operationId: "op" }));
Signature
declare const cancelRunEffect: (
runtime: JobsRuntime,
runId: string,
options: JobCancelOptions,
) => Effect.Effect<RunCancellationReceipt, JobControlFailure, never>;
createJobsControls
Signature
declare const createJobsControls: (runtime?: JobsRuntime) => JobsControls;
createJobsControlsEffect
Signature
declare const createJobsControlsEffect: (
runtime: JobsRuntime,
) => Effect.Effect<JobsControls, never, never>;
getRun
Promise compatibility adapter for native run reads.
Throws
The original provider or capability error.
Example
await getRun(runtime, "run-1");
Signature
declare const getRun: (
runtime: JobsRuntime,
locator: string,
signal?: AbortSignal,
) => Promise<RunSnapshot>;
getRunEffect
Reads a native run in Effect.
Example
Effect.runPromise(getRunEffect(runtime, "run-1"));
Signature
declare const getRunEffect: (
runtime: JobsRuntime,
locator: string,
signal?: AbortSignal | undefined,
) => Effect.Effect<NativeRun, JobControlFailure, never>;
listRuns
Promise compatibility adapter for native run listings.
Throws
The original provider, capability, or limit error.
Example
await listRuns(runtime);
Signature
declare const listRuns: (
runtime: JobsRuntime,
query?: RunListQuery,
signal?: AbortSignal,
) => Promise<RunPage<RunSnapshot>>;
listRunsEffect
Lists native runs in Effect.
Example
Effect.runPromise(listRunsEffect(runtime));
Signature
declare const listRunsEffect: (
runtime: JobsRuntime,
query?: RunListQuery | undefined,
signal?: AbortSignal | undefined,
) => Effect.Effect<NativeRunPage, JobControlFailure, never>;
observeRun
Signature
declare const observeRun: (
runtime: JobsRuntime,
request: NativeWatchRequest,
options?: JobObserveOptions,
) => AsyncIterable<RunWatchFrame<RunSnapshot>>;
observeRunEffect
Signature
declare const observeRunEffect: (
runtime: JobsRuntime,
request: NativeWatchRequest,
options?: JobObserveOptions | undefined,
) => Effect.Effect<AsyncIterable<RunWatchFrame<RunSnapshot>>, JobControlFailure, never>;
retryRun
Promise compatibility adapter for retry.
Throws
The original provider or control error.
Example
await retryRun(runtime, "run-1", { operationId: "op" });
Signature
declare const retryRun: (
runtime: JobsRuntime,
runId: string,
options: JobRetryOptions,
) => Promise<RunRetryReceipt>;
retryRunEffect
Retries a run in Effect.
Example
Effect.runPromise(retryRunEffect(runtime, "run-1", { operationId: "op" }));
Signature
declare const retryRunEffect: (
runtime: JobsRuntime,
runId: string,
options: JobRetryOptions,
) => Effect.Effect<RunRetryReceipt, JobControlFailure, never>;
waitForResult
Promise compatibility adapter for result waiting.
Throws
The original observation or result error.
Example
await waitForResult(runtime, "run-1", { timeout: "1 second" });
Signature
declare const waitForResult: (
runtime: JobsRuntime,
runId: string,
options: RunResultOptions,
) => Promise<unknown>;
waitForResultEffect
Waits for a run result in Effect.
Example
Effect.runPromise(waitForResultEffect(runtime, "run-1", { timeout: "1 second" }));
Signature
declare const waitForResultEffect: (
runtime: JobsRuntime,
runId: string,
options: RunResultOptions,
) => Effect.Effect<unknown, JobControlFailure, never>;
controls.types.ts
JobCancelOptions (interface)
Options accepted for job cancel operations.
Signature
export interface JobCancelOptions {
readonly operationId: string;
readonly reason?: string;
readonly signal?: AbortSignal;
}
JobRetryOptions (interface)
Options accepted for job retry operations.
Signature
export interface JobRetryOptions {
readonly operationId: string;
readonly signal?: AbortSignal;
}
JobsControls (interface)
Run read, observation, cancellation, retry, result, and schedule operations.
Signature
export interface JobsControls {
readonly get: (
locator: string,
options?: { readonly signal?: AbortSignal },
) => Promise<RunSnapshot>;
readonly list: (
query?: RunListQuery,
options?: { readonly signal?: AbortSignal },
) => Promise<RunPage<RunSnapshot>>;
readonly observe: (
request: NativeWatchRequest,
options?: JobObserveOptions,
) => AsyncIterable<RunWatchFrame<RunSnapshot>>;
readonly cancel: (runId: string, options: JobCancelOptions) => Promise<RunCancellationReceipt>;
readonly retry: (runId: string, options: JobRetryOptions) => Promise<RunRetryReceipt>;
readonly result: (runId: string, options: RunResultOptions) => Promise<unknown>;
readonly schedules?: JobScheduleClient;
}
define-job-value.ts
defineJobValue
Binds a task to a named job with immutable scheduling and client policy metadata.
Example
import { defineJob } from "@relkit/app/jobs";
import { defineTask } from "@relkit/app/tasks";
import { z } from "@relkit/app/schema";
const task = defineTask({
id: "receipts.send",
version: "1",
input: z.object({ orderId: z.string() }),
output: z.object({ sent: z.boolean() }),
handler: async () => ({ sent: true }),
});
const job = defineJob({ name: "sendReceipt", task });
void job;
Signature
declare const defineJobValue: <
const Name extends string,
const Task extends TaskDescriptorAny,
const Id extends string = Name,
>(
options: DefineJobOptions<Name, Task, Id>,
) => JobDescriptor<Name, Id, Task>;
Since v0.4.1
JOB_PROFILE_DEPRECATED_CODE
Diagnostic code used when the one-release profile spelling is consumed as service.
Example
JOB_PROFILE_DEPRECATED_CODE === "RELKIT_JOB_PROFILE_DEPRECATED";
Signature
declare const JOB_PROFILE_DEPRECATED_CODE: "RELKIT_JOB_PROFILE_DEPRECATED";
RetryJitter
Signature
declare const RetryJitter: RetryJitter;
RetryPolicy
Signature
declare const RetryPolicy: RetryPolicy;
isJobDescriptorValue
Checks the runtime descriptor brand and task association.
Example
isJobDescriptorValue(candidate);
Signature
declare const isJobDescriptorValue: (value: unknown) => value is JobDescriptorAny;
define-job.ts
defineJob
Binds a task to an immutable job descriptor.
Throws
Original validation error for invalid definitions.
Example
import { defineJob, defineTask } from "@relkit/jobs";
import { z } from "@relkit/schema";
const echo = defineTask({
id: "echo",
version: "1",
input: z.string(),
output: z.string(),
execution: "retryable",
handler: async (input) => input,
});
const echoJob = defineJob({ name: "echoJob", task: echo });
Signature
declare const defineJob: <
const Name extends string,
const Task extends TaskDescriptorAny,
const Id extends string = Name,
>(
options: DefineJobOptions<Name, Task, Id>,
) => JobDescriptor<Name, Id, Task>;
Since v0.4.1
Backend and frontend example
Backend — these maintained files define the operation used by the frontend below.
/** Registers the export task as a public job exposing trigger, get, list and watch with progress/output fields. */
import { defineJob } from "@relkit/app/jobs";
import exportOrders from "../tasks/export-orders.task.js";
const exportOrdersJob = defineJob({
name: "exportOrders",
id: "orders.export-orders",
task: exportOrders,
client: {
public: true,
operations: ["trigger", "get", "list", "watch"],
fields: ["status", "progress", "output"],
},
});
export default exportOrdersJob;
Frontend
After frontend setup and pulling the commerce contract, render
this component under the provider. It selects this job’s public exportOrders name:
"use client";
/** Submits one commerce export and observes the accepted run without replaying an uncertain submission. */
import { useJobRun, useJobTrigger, useRelkitClient } from "@relkit/client/react";
/** Keeps the accepted receipt separate from the task's eventual output.
* @returns One explicit submission button and its receipt, observation, or failure state. */
export function ExportOrders() {
const { status } = useRelkitClient();
const submit = useJobTrigger("exportOrders");
const run = useJobRun("exportOrders", submit.data ? { runId: submit.data.runId } : {});
return (
<section>
<button
disabled={status !== "ready" || !submit.isIdle}
onClick={() => submit.mutate({ input: { orderIds: ["order-1"] } })}
>
Export orders
</button>
{submit.isPending && <p role="status">Submitting…</p>}
{submit.isError && (
<p role="alert">{String(submit.error)}. Check the outcome before submitting again.</p>
)}
{submit.data && <p>Run ID: {submit.data.runId}</p>}
<p role="status">
Connection: {run.connection}; run: {run.run?.status ?? "not accepted"}
</p>
</section>
);
}
The task determines the orderIds input. The job’s client.operations permits triggering and
observation, while client.fields selects public run data. The returned runId is an admission
receipt; completion and output arrive through the run observer. The example keeps uncertain
submissions visible instead of automatically sending them again.
Reference: useJobTrigger, useJobRun.
Continue with job clients and recovery.
JOB_PROFILE_DEPRECATED_CODE
Signature
declare const JOB_PROFILE_DEPRECATED_CODE: "RELKIT_JOB_PROFILE_DEPRECATED";
JobDefinitionFailure (class)
Expected job definition failure, retaining the original validation error.
Example
if (error instanceof JobDefinitionFailure) console.log(error.message);
Signature
declare class JobDefinitionFailure
RetryJitter
Signature
declare const RetryJitter: RetryJitter;
RetryPolicy
Signature
declare const RetryPolicy: RetryPolicy;
assertJobDescriptor
Synchronous job descriptor assertion.
Throws
TypeError for an invalid descriptor.
Example
assertJobDescriptor(job);
Signature
declare const assertJobDescriptor: (value: unknown) => asserts value is JobDescriptorAny;
assertJobDescriptorEffect
Asserts a valid job descriptor in Effect.
Example
Effect.runSync(assertJobDescriptorEffect(job));
Signature
declare const assertJobDescriptorEffect: (
value: unknown,
) => Effect.Effect<undefined, JobDefinitionFailure, never>;
defineJobEffect
Defines an immutable job descriptor in Effect.
Example
Effect.runSync(defineJobEffect({ name: "sendReceipt", task }));
Signature
declare const defineJobEffect: <
const Name extends string,
const Task extends TaskDescriptorAny,
const Id extends string = Name,
>(
options: DefineJobOptions<Name, Task, Id>,
) => Effect.Effect<JobDescriptor<Name, Id, Task>, JobDefinitionFailure, never>;
isJobDescriptor
Synchronous job descriptor type guard.
Example
if (isJobDescriptor(value)) console.log(value.name);
Signature
declare const isJobDescriptor: (value: unknown) => value is JobDescriptorAny;
isJobDescriptorEffect
Tests a value for a valid job descriptor in Effect.
Example
Effect.runSync(isJobDescriptorEffect(value));
Signature
declare const isJobDescriptorEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
define-task-support.ts
TaskSupportError (class)
An invalid task authoring helper input.
Example
new TaskSupportError({ reason: "Task tags must be unique" });
Signature
declare class TaskSupportError
assertHook
Synchronous optional hook assertion.
Throws
TypeError when the hook is not a function.
Example
assertHook(() => {}, "onStart");
Signature
declare const assertHook: (value: unknown, name: string) => void;
assertHookEffect
Validates an optional lifecycle hook in Effect.
Example
Effect.runPromise(assertHookEffect(() => {}, "onStart"));
Signature
declare const assertHookEffect: (
value: unknown,
name: string,
) => Effect.Effect<undefined, TaskSupportError, never>;
copyStrings
Synchronous authoring string adapter.
Throws
TypeError for invalid or duplicate strings.
Example
copyStrings(["red"], "tags");
Signature
declare const copyStrings: (value: unknown, name: string) => readonly string[] | undefined;
copyStringsEffect
Copies unique, bounded authoring strings in Effect.
Example
Effect.runPromise(copyStringsEffect(["red"], "tags"));
Signature
declare const copyStringsEffect: (
value: unknown,
name: string,
) => Effect.Effect<ReadonlyArray<string> | undefined, TaskSupportError, never>;
hasOwn
Synchronous own-property predicate.
Throws
A runtime defect if the Effect cannot execute synchronously.
Example
hasOwn({ id: 1 }, "id");
Signature
declare const hasOwn: (value: object, key: PropertyKey) => boolean;
hasOwnEffect
Checks property ownership in Effect.
Example
Effect.runSync(hasOwnEffect({ id: 1 }, "id"));
Signature
declare const hasOwnEffect: (
value: object,
key: PropertyKey,
) => Effect.Effect<boolean, never, never>;
isRecord
Synchronous non-array record predicate.
Throws
A runtime defect if the Effect cannot execute synchronously.
Example
isRecord({ id: 1 });
Signature
declare const isRecord: (value: unknown) => value is Record<PropertyKey, unknown>;
isRecordEffect
Tests for a non-array record in Effect.
Example
Effect.runSync(isRecordEffect({ id: 1 }));
Signature
declare const isRecordEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
isSchema
Synchronous Standard Schema v1 predicate.
Throws
A runtime defect if the Effect cannot execute synchronously.
Example
isSchema({ "~standard": { version: 1, validate() {} } });
Signature
declare const isSchema: (value: unknown) => boolean;
isSchemaEffect
Detects a Standard Schema v1 value in Effect.
Example
Effect.runSync(isSchemaEffect({ "~standard": { version: 1, validate() {} } }));
Signature
declare const isSchemaEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
define-task-value.ts
defineTaskValue
Declares a typed task with an immutable execution contract and handler.
Example
import { defineTask } from "@relkit/app/tasks";
import { z } from "@relkit/app/schema";
const exportOrders = defineTask({
id: "orders.export",
version: "1",
input: z.object({ orderIds: z.array(z.string()) }),
output: z.object({ exported: z.number() }),
handler: async ({ orderIds }) => ({ exported: orderIds.length }),
});
void exportOrders;
Signature
declare const defineTaskValue: <
const Id extends string,
const Version extends string,
const InputSchema extends StandardSchemaV1,
const OutputSchema extends StandardSchemaV1,
const Dependencies extends TaskDependencies = {},
const Errors extends readonly ErrorDescriptorAny[] = readonly [],
const Publishes extends readonly PublishedEventName[] = readonly [],
const ProgressSchema extends StandardSchemaV1 | undefined = undefined,
const Streams extends TaskStreamSchemas = {},
const Execution extends TaskExecution = "durable",
>(
options: DefineTaskOptions<
Id,
Version,
InputSchema,
OutputSchema,
Dependencies,
Errors,
Publishes,
ProgressSchema,
Streams,
Execution
>,
) => TaskDescriptor<
Id,
Version,
InputSchema,
OutputSchema,
Dependencies,
Errors,
Publishes,
ProgressSchema,
Streams,
Execution
>;
Since v0.4.1
isTaskDescriptorValue
Checks a candidate for the branded task descriptor shape.
Example
isTaskDescriptorValue(candidate);
Signature
declare const isTaskDescriptorValue: (value: unknown) => value is TaskDescriptorAny;
define-task.ts
defineTask
Declares a typed immutable task with an execution contract and handler.
Throws
Original validation error for invalid definitions.
Example
import { defineTask } from "@relkit/jobs";
import { z } from "@relkit/schema";
const echo = defineTask({
id: "echo",
version: "1",
input: z.string(),
output: z.string(),
execution: "retryable",
handler: async (input) => input,
});
Signature
declare const defineTask: <
const Id extends string,
const Version extends string,
const InputSchema extends StandardSchemaV1,
const OutputSchema extends StandardSchemaV1,
const Dependencies extends TaskDependencies = {},
const Errors extends readonly ErrorDescriptorAny[] = readonly [],
const Publishes extends readonly PublishedEventName[] = readonly [],
const ProgressSchema extends StandardSchemaV1 | undefined = undefined,
const Streams extends TaskStreamSchemas = {},
const Execution extends TaskExecution = "durable",
>(
options: DefineTaskOptions<
Id,
Version,
InputSchema,
OutputSchema,
Dependencies,
Errors,
Publishes,
ProgressSchema,
Streams,
Execution
>,
) => TaskDescriptor<
Id,
Version,
InputSchema,
OutputSchema,
Dependencies,
Errors,
Publishes,
ProgressSchema,
Streams,
Execution
>;
Since v0.4.1
TaskDefinitionFailure (class)
Expected task definition failure, retaining the original validation error.
Example
if (error instanceof TaskDefinitionFailure) console.log(error.message);
Signature
declare class TaskDefinitionFailure
assertTaskDescriptor
Synchronous task descriptor assertion.
Throws
TypeError for invalid descriptors.
Example
assertTaskDescriptor(task);
Signature
declare const assertTaskDescriptor: (value: unknown) => asserts value is TaskDescriptorAny;
assertTaskDescriptorEffect
Asserts a task descriptor in Effect.
Example
Effect.runSync(assertTaskDescriptorEffect(task));
Signature
declare const assertTaskDescriptorEffect: (
value: unknown,
) => Effect.Effect<undefined, TaskDefinitionFailure, never>;
defineTaskEffect
Defines an immutable task descriptor in Effect.
Example
Effect.runSync(defineTaskEffect({ id: "send", version: "1", input, output, handler }));
Signature
declare const defineTaskEffect: <
const Id extends string,
const Version extends string,
const InputSchema extends StandardSchemaV1,
const OutputSchema extends StandardSchemaV1,
const Dependencies extends TaskDependencies = {},
const Errors extends readonly ErrorDescriptorAny[] = readonly [],
const Publishes extends readonly PublishedEventName[] = readonly [],
const ProgressSchema extends StandardSchemaV1 | undefined = undefined,
const Streams extends Readonly<Record<string, StandardSchemaV1<unknown, unknown>>> = {},
const Execution extends TaskExecution = "durable",
>(
options: DefineTaskOptions<
Id,
Version,
InputSchema,
OutputSchema,
Dependencies,
Errors,
Publishes,
ProgressSchema,
Streams,
Execution
>,
) => Effect.Effect<
TaskDescriptor<
Id,
Version,
InputSchema,
OutputSchema,
Dependencies,
Errors,
Publishes,
ProgressSchema,
Streams,
Execution
>,
TaskDefinitionFailure,
never
>;
isTaskDescriptor
Synchronous task descriptor type guard.
Example
if (isTaskDescriptor(value)) console.log(value.id);
Signature
declare const isTaskDescriptor: (value: unknown) => value is TaskDescriptorAny;
isTaskDescriptorEffect
Checks a task descriptor candidate in Effect.
Example
Effect.runSync(isTaskDescriptorEffect(value));
Signature
declare const isTaskDescriptorEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
duration.ts
DurationInput
Signature
declare const DurationInput:
| `${number} second`
| `${number} seconds`
| `${number} minute`
| `${number} minutes`
| `${number} hour`
| `${number} hours`
| `${number} day`
| `${number} days`
| `${number} week`
| `${number} weeks`
| `${number} millisecond`
| `${number} milliseconds`;
DurationUnit
Signature
declare const DurationUnit: DurationUnit;
DurationValidationError (class)
A malformed, inexact, or unsafe authored duration.
Example
new DurationValidationError({ input: "1.1 milliseconds", reason: "Invalid duration" });
Signature
declare class DurationValidationError
durationToMillis
Compatibility adapter for authored duration parsing.
Throws
TypeError when the duration is invalid or cannot be represented safely.
Example
durationToMillis("1.5 seconds");
Signature
declare const durationToMillis: (value: DurationInput) => number;
durationToMillisEffect
Converts an authored duration to exact, safe milliseconds.
Example
Effect.runPromise(durationToMillisEffect("1.5 seconds"));
Signature
declare const durationToMillisEffect: (
value:
| `${number} second`
| `${number} seconds`
| `${number} minute`
| `${number} minutes`
| `${number} hour`
| `${number} hours`
| `${number} day`
| `${number} days`
| `${number} week`
| `${number} weeks`
| `${number} millisecond`
| `${number} milliseconds`,
) => Effect.Effect<number, DurationValidationError, never>;
isDurationInput
Tests authored duration syntax.
Throws
A runtime defect if the Effect cannot execute synchronously.
Example
isDurationInput("1 second");
Signature
declare const isDurationInput: (value: unknown) => value is DurationInput;
isDurationInputEffect
Tests authored duration syntax in the Effect path.
Example
Effect.runSync(isDurationInputEffect("1 second"));
Signature
declare const isDurationInputEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
parseDuration
Alias for durationToMillis.
Throws
TypeError when the duration is invalid or unsafe.
Example
parseDuration("1 second");
Signature
declare const parseDuration: (value: DurationInput) => number;
validateDuration
Alias for durationToMillis.
Throws
TypeError when the duration is invalid or unsafe.
Example
validateDuration("1 second");
Signature
declare const validateDuration: (value: DurationInput) => number;
duration.types.ts
Units accepted by the authored duration syntax.
DurationInput (type alias)
An authored decimal amount followed by one duration unit.
Signature
type DurationInput = `${number} ${DurationUnit}`;
DurationUnit (type alias)
Units accepted by the authored duration syntax.
Signature
type DurationUnit =
| "millisecond"
| "milliseconds"
| "second"
| "seconds"
| "minute"
| "minutes"
| "hour"
| "hours"
| "day"
| "days"
| "week"
| "weeks";
identity.ts
JobIdentityError (class)
An identity tuple containing a value that cannot be encoded as JSON.
Example
new JobIdentityError({ operation: "stableTuple", cause: new Error("invalid") });
Signature
declare class JobIdentityError
retryOperationIdentity
Synchronous retry-operation identity adapter.
Throws
A JSON validation error for unsupported values.
Example
retryOperationIdentity("r", "op");
Signature
declare const retryOperationIdentity: (runId: string, operationId: string) => string;
retryOperationIdentityEffect
Builds a retry-operation identity in Effect.
Example
Effect.runPromise(retryOperationIdentityEffect("r", "op"));
Signature
declare const retryOperationIdentityEffect: (
runId: string,
operationId: string,
) => Effect.Effect<string, JobIdentityError, never>;
scheduleOccurrenceIdentity
Synchronous schedule-occurrence identity adapter.
Throws
A JSON validation error for unsupported values.
Example
scheduleOccurrenceIdentity("s", "2026-01-01T00:00:00Z");
Signature
declare const scheduleOccurrenceIdentity: (scheduleId: string, scheduledFor: string) => string;
scheduleOccurrenceIdentityEffect
Builds a schedule-occurrence identity in Effect.
Example
Effect.runPromise(scheduleOccurrenceIdentityEffect("s", "2026-01-01T00:00:00Z"));
Signature
declare const scheduleOccurrenceIdentityEffect: (
scheduleId: string,
scheduledFor: string,
) => Effect.Effect<string, JobIdentityError, never>;
stableIdentityTuple
Synchronous compatibility adapter for identity tuples.
Throws
The original JSON validation error for unsupported values.
Example
stableIdentityTuple([1, "1"]);
Signature
declare const stableIdentityTuple: (values: readonly unknown[]) => string;
stableIdentityTupleEffect
Encodes typed tuple members in Effect so numeric and string values differ.
Example
Effect.runPromise(stableIdentityTupleEffect([1, "1"]));
Signature
declare const stableIdentityTupleEffect: (
values: ReadonlyArray<unknown>,
) => Effect.Effect<string, JobIdentityError, never>;
taskOperationIdentity
Synchronous task-operation identity adapter.
Throws
A JSON validation error for unsupported values.
Example
taskOperationIdentity("a", "send");
Signature
declare const taskOperationIdentity: (acceptanceIdentity: string, operation: string) => string;
taskOperationIdentityEffect
Builds a task-operation identity in Effect.
Example
Effect.runPromise(taskOperationIdentityEffect("a", "send"));
Signature
declare const taskOperationIdentityEffect: (
acceptanceIdentity: string,
operation: string,
) => Effect.Effect<string, JobIdentityError, never>;
identity.types.ts
IdentityValue (type alias)
JSON-safe representation of one identity tuple component.
Signature
type IdentityValue = JsonValue;
index.ts
“./adapter.js” (namespace export)
Re-exports all named exports from the “./adapter.js” module.
Signature
export * from "./adapter.js";
“./authorization.js” (namespace export)
Re-exports all named exports from the “./authorization.js” module.
Signature
export * from "./authorization.js";
“./capabilities.js” (namespace export)
Re-exports all named exports from the “./capabilities.js” module.
Signature
export * from "./capabilities.js";
“./control-errors.js” (namespace export)
Re-exports all named exports from the “./control-errors.js” module.
Signature
export * from "./control-errors.js";
“./controls.js” (namespace export)
Re-exports all named exports from the “./controls.js” module.
Signature
export * from "./controls.js";
“./define-job.js” (namespace export)
Re-exports all named exports from the “./define-job.js” module.
Signature
export * from "./define-job.js";
“./define-task.js” (namespace export)
Re-exports all named exports from the “./define-task.js” module.
Signature
export * from "./define-task.js";
“./identity.js” (namespace export)
Re-exports all named exports from the “./identity.js” module.
Signature
export * from "./identity.js";
“./migration.js” (namespace export)
Re-exports all named exports from the “./migration.js” module.
Signature
export * from "./migration.js";
“./resolve-binding.js” (namespace export)
Re-exports all named exports from the “./resolve-binding.js” module.
Signature
export * from "./resolve-binding.js";
“./run-id-router.js” (namespace export)
Re-exports all named exports from the “./run-id-router.js” module.
Signature
export * from "./run-id-router.js";
“./run-id.js” (namespace export)
Re-exports all named exports from the “./run-id.js” module.
Signature
export * from "./run-id.js";
“./runtime.js” (namespace export)
Re-exports all named exports from the “./runtime.js” module.
Signature
export * from "./runtime.js";
“./schedule-controls.js” (namespace export)
Re-exports all named exports from the “./schedule-controls.js” module.
Signature
export * from "./schedule-controls.js";
“./schedule-reconciliation.js” (namespace export)
Re-exports all named exports from the “./schedule-reconciliation.js” module.
Signature
export * from "./schedule-reconciliation.js";
“./service-options.js” (namespace export)
Re-exports all named exports from the “./service-options.js” module.
Signature
export * from "./service-options.js";
“./submission.js” (namespace export)
Re-exports all named exports from the “./submission.js” module.
Signature
export * from "./submission.js";
“./task-policy-validation.js” (namespace export)
Re-exports all named exports from the “./task-policy-validation.js” module.
Signature
export * from "./task-policy-validation.js";
“./task-progress.js” (namespace export)
Re-exports all named exports from the “./task-progress.js” module.
Signature
export * from "./task-progress.js";
“./task-types.js” (namespace export)
Re-exports all named exports from the “./task-types.js” module.
Signature
export * from "./task-types.js";
“./task-wire.js” (namespace export)
Re-exports all named exports from the “./task-wire.js” module.
Signature
export * from "./task-wire.js";
DefineJobOptions
Signature
declare const DefineJobOptions: DefineJobOptions<Name, Task, Id>;
DurationInput
Signature
declare const DurationInput:
| `${number} second`
| `${number} seconds`
| `${number} minute`
| `${number} minutes`
| `${number} hour`
| `${number} hours`
| `${number} day`
| `${number} days`
| `${number} week`
| `${number} weeks`
| `${number} millisecond`
| `${number} milliseconds`;
DurationUnit
Signature
declare const DurationUnit: DurationUnit;
DurationValidationError
Signature
declare const DurationValidationError: typeof DurationValidationError;
InstantValidationError
Signature
declare const InstantValidationError: typeof InstantValidationError;
JOB_NAME_MAX_LENGTH
Signature
declare const JOB_NAME_MAX_LENGTH: 64;
JOB_NAME_PATTERN
Signature
declare const JOB_NAME_PATTERN: RegExp;
JOB_NAME_RESERVED
Signature
declare const JOB_NAME_RESERVED: readonly [
"then",
"constructor",
"prototype",
"toJSON",
"toString",
"valueOf",
"hasOwnProperty",
"isPrototypeOf",
"propertyIsEnumerable",
"toLocaleString",
"__proto__",
];
JobAccessGrant
Signature
declare const JobAccessGrant: JobAccessGrant;
JobAccessRequest
Signature
declare const JobAccessRequest: JobAccessRequest;
JobAdmission
Signature
declare const JobAdmission: JobAdmission<Input>;
JobAuthorizationContext
Signature
declare const JobAuthorizationContext: JobAuthorizationContext;
JobClientAccess
Signature
declare const JobClientAccess: JobClientAccess<Streams>;
JobClientField
Signature
declare const JobClientField: JobClientField;
JobClientOperation
Signature
declare const JobClientOperation: JobClientOperation;
JobDescriptor
Signature
declare const JobDescriptor: JobDescriptor<Name, Id, Task>;
JobDescriptorAny
Signature
declare const JobDescriptorAny: JobDescriptorAny;
JobErrorEnvelope
Signature
declare const JobErrorEnvelope: JobErrorEnvelope;
JobName
Signature
declare const JobName: JobName<Name>;
JobNameValidationError
Signature
declare const JobNameValidationError: typeof JobNameValidationError;
JobRunResultOptions
Signature
declare const JobRunResultOptions: RunResultOptions;
JobRunStatus
Signature
declare const JobRunStatus: JobRunStatus;
JobScheduleClient
Signature
declare const JobScheduleClient: JobScheduleClient<Definition>;
JobServiceSelection
Signature
declare const JobServiceSelection: JobServiceSelection;
JobUnknownOutcome
Signature
declare const JobUnknownOutcome: JobUnknownOutcome;
JobWireEnvelope
Signature
declare const JobWireEnvelope: JobWireEnvelope;
JobsTelemetry
Signature
declare const JobsTelemetry: typeof JobsTelemetry;
JobsTelemetryLive
Signature
declare const JobsTelemetryLive: Layer<JobsTelemetry, never, never>;
JsonWireEnvelope
Signature
declare const JsonWireEnvelope: JsonWireEnvelope;
NamedStreamFrame
Signature
declare const NamedStreamFrame: NamedStreamFrame<Item>;
ProgressEmitReceipt
Signature
declare const ProgressEmitReceipt: ProgressEmitReceipt;
ResultAvailability
Signature
declare const ResultAvailability: ResultAvailability;
RunAvailability
Signature
declare const RunAvailability: RunAvailability;
RunCancellationReceipt
Signature
declare const RunCancellationReceipt: RunCancellationReceipt;
RunConnection
Signature
declare const RunConnection: RunConnection;
RunHandle
Signature
declare const RunHandle: RunHandle;
RunListQuery
Signature
declare const RunListQuery: RunListQuery;
RunPage
Signature
declare const RunPage: RunPage<Run>;
RunRetryReceipt
Signature
declare const RunRetryReceipt: RunRetryReceipt;
RunSnapshot
Signature
declare const RunSnapshot: RunSnapshot<Input, Output, Progress, Failure>;
RunWatchFrame
Signature
declare const RunWatchFrame: RunWatchFrame<Run>;
ScheduleDefinition
Signature
declare const ScheduleDefinition: ScheduleDefinition<Input>;
ScheduleListOptions
Signature
declare const ScheduleListOptions: ScheduleListOptions;
ScheduleMisfire
Signature
declare const ScheduleMisfire: ScheduleMisfire;
ScheduleOverlap
Signature
declare const ScheduleOverlap: ScheduleOverlap;
ScheduleReadReceipt
Signature
declare const ScheduleReadReceipt: ScheduleReadReceipt<Definition>;
ScheduleRecord
Signature
declare const ScheduleRecord: ScheduleRecord<Definition>;
ScheduleWriteOptions
Signature
declare const ScheduleWriteOptions: ScheduleWriteOptions;
ScheduleWriteOutcome
Signature
declare const ScheduleWriteOutcome: ScheduleWriteOutcome;
ScheduleWriteReceipt
Signature
declare const ScheduleWriteReceipt: ScheduleWriteReceipt<Definition>;
StreamIdentity
Signature
declare const StreamIdentity: StreamIdentity;
StreamItem
Signature
declare const StreamItem: JsonValue;
TASK_INPUT_MAX_BYTES
Signature
declare const TASK_INPUT_MAX_BYTES: 1048576;
TASK_ITEM_MAX_BYTES
Signature
declare const TASK_ITEM_MAX_BYTES: number;
TASK_KEY_MAX_BYTES
Signature
declare const TASK_KEY_MAX_BYTES: 256;
TASK_MAX_TAGS
Signature
declare const TASK_MAX_TAGS: 20;
TASK_OUTPUT_MAX_BYTES
Signature
declare const TASK_OUTPUT_MAX_BYTES: 1048576;
TASK_REASON_MAX_BYTES
Signature
declare const TASK_REASON_MAX_BYTES: 1024;
ValidJobName
Signature
declare const ValidJobName: ValidJobName<Name>;
VoidWireEnvelope
Signature
declare const VoidWireEnvelope: VoidWireEnvelope;
assertJobName
Signature
declare const assertJobName: (value: unknown, source?: string) => asserts value is JobName;
assertJobNameEffect
Signature
declare const assertJobNameEffect: (
value: unknown,
source?: any,
) => Effect<undefined, JobNameValidationError, never>;
assertRfc3339Instant
Signature
declare const assertRfc3339Instant: (value: unknown, name?: string) => asserts value is string;
assertRfc3339InstantEffect
Signature
declare const assertRfc3339InstantEffect: (
value: unknown,
name?: any,
) => Effect<undefined, InstantValidationError, never>;
copyTriggerOptions
Signature
declare const copyTriggerOptions: (value: unknown) => CopiedTriggerOptions;
durationToMillis
Signature
declare const durationToMillis: (value: DurationInput) => number;
durationToMillisEffect
Signature
declare const durationToMillisEffect: (
value:
| `${number} second`
| `${number} seconds`
| `${number} minute`
| `${number} minutes`
| `${number} hour`
| `${number} hours`
| `${number} day`
| `${number} days`
| `${number} week`
| `${number} weeks`
| `${number} millisecond`
| `${number} milliseconds`,
) => Effect<number, DurationValidationError, never>;
isDurationInput
Signature
declare const isDurationInput: (value: unknown) => value is DurationInput;
isDurationInputEffect
Signature
declare const isDurationInputEffect: (value: unknown) => Effect<boolean, never, never>;
isJobName
Signature
declare const isJobName: (value: unknown) => value is JobName;
isJobNameEffect
Signature
declare const isJobNameEffect: (value: unknown) => Effect<boolean, never, never>;
isRfc3339Instant
Signature
declare const isRfc3339Instant: (value: unknown) => value is string;
isRfc3339InstantEffect
Signature
declare const isRfc3339InstantEffect: (value: unknown) => Effect<boolean, never, never>;
isValidJobName
Signature
declare const isValidJobName: (value: unknown) => value is JobName;
normalizeJobName
Signature
declare const normalizeJobName: <const Name extends string>(value: Name) => ValidJobName<Name>;
parseDuration
Signature
declare const parseDuration: (value: DurationInput) => number;
validateDuration
Signature
declare const validateDuration: (value: DurationInput) => number;
validateJobName
Signature
declare const validateJobName: <const Name extends string>(value: Name) => ValidJobName<Name>;
validateJobNameEffect
Signature
declare const validateJobNameEffect: <const Name extends string>(
value: Name,
) => Effect<ValidJobName<Name>, JobNameValidationError, never>;
validateResultOptions
Signature
declare const validateResultOptions: (value: unknown) => RunResultOptions;
instant-validation.ts
InstantValidationError (class)
An invalid authored RFC 3339 instant.
Example
new InstantValidationError({ name: "instant", reason: "invalid" });
Signature
declare class InstantValidationError
assertRfc3339Instant
Synchronous RFC 3339 assertion.
Throws
TypeError when the instant is invalid.
Example
assertRfc3339Instant("2026-01-01T00:00:00Z");
Signature
declare const assertRfc3339Instant: (value: unknown, name?: string) => asserts value is string;
assertRfc3339InstantEffect
Requires an RFC 3339 instant in Effect.
Example
Effect.runPromise(assertRfc3339InstantEffect("2026-01-01T00:00:00Z"));
Signature
declare const assertRfc3339InstantEffect: (
value: unknown,
name?: any,
) => Effect.Effect<undefined, InstantValidationError, never>;
isRfc3339Instant
Synchronous RFC 3339 predicate.
Throws
A runtime defect if the Effect cannot execute synchronously.
Example
isRfc3339Instant("2026-01-01T00:00:00Z");
Signature
declare const isRfc3339Instant: (value: unknown) => value is string;
isRfc3339InstantEffect
Checks RFC 3339 syntax and calendar bounds in Effect.
Example
Effect.runSync(isRfc3339InstantEffect("2026-01-01T00:00:00Z"));
Signature
declare const isRfc3339InstantEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
job-name.ts
JOB_NAME_PATTERN
ASCII job names start with a lowercase letter and continue with letters or digits.
Example
JOB_NAME_PATTERN.test("sendEmail");
Signature
declare const JOB_NAME_PATTERN: RegExp;
JOB_NAME_RESERVED
JavaScript promise and object keys that cannot name callable jobs.
Example
JOB_NAME_RESERVED.includes("then");
Signature
declare const JOB_NAME_RESERVED: readonly [
"then",
"constructor",
"prototype",
"toJSON",
"toString",
"valueOf",
"hasOwnProperty",
"isPrototypeOf",
"propertyIsEnumerable",
"toLocaleString",
"__proto__",
];
JobName
Signature
declare const JobName: JobName<Name>;
JobNameValidationError (class)
A rejected authored job name with a stable validation tag.
Example
new JobNameValidationError({ source: "job name", reason: "Invalid name" });
Signature
declare class JobNameValidationError
ValidJobName
Signature
declare const ValidJobName: ValidJobName<Name>;
assertJobName
Asserts the job-name grammar for synchronous callers.
Throws
TypeError when the candidate is not a valid job name.
Example
assertJobName("sendEmail");
Signature
declare const assertJobName: (value: unknown, source?: string) => asserts value is JobName;
assertJobNameEffect
Validates a job name in the Effect error channel.
Example
Effect.runPromise(assertJobNameEffect("sendEmail"));
Signature
declare const assertJobNameEffect: (
value: unknown,
source?: any,
) => Effect.Effect<undefined, JobNameValidationError, never>;
isJobName
Tests a candidate against the job-name grammar.
Throws
A runtime defect if the Effect cannot execute synchronously.
Example
isJobName("sendEmail");
Signature
declare const isJobName: (value: unknown) => value is JobName;
isJobNameEffect
Tests a candidate against the job-name grammar in Effect.
Example
Effect.runSync(isJobNameEffect("sendEmail"));
Signature
declare const isJobNameEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
isValidJobName
Alias for isJobName.
Throws
A runtime defect if the Effect cannot execute synchronously.
Example
isValidJobName("sendEmail");
Signature
declare const isValidJobName: (value: unknown) => value is JobName;
normalizeJobName
Alias for validateJobName.
Throws
TypeError when the name is invalid.
Example
normalizeJobName("sendEmail");
Signature
declare const normalizeJobName: <const Name extends string>(value: Name) => ValidJobName<Name>;
validateJobName
Validates a literal job name for synchronous authors.
Throws
TypeError when the name is invalid.
Example
validateJobName("sendEmail");
Signature
declare const validateJobName: <const Name extends string>(value: Name) => ValidJobName<Name>;
validateJobNameEffect
Validates a literal name in Effect while retaining its literal type.
Example
Effect.runPromise(validateJobNameEffect("sendEmail"));
Signature
declare const validateJobNameEffect: <const Name extends string>(
value: Name,
) => Effect.Effect<ValidJobName<Name>, JobNameValidationError, never>;
job-name.types.ts
JobName (type alias)
A validated job name, preserving literal types when available.
Signature
type JobName<Name extends string = string> = string extends Name ? string : ValidJobName<Name>;
ValidJobName (type alias)
Compile-time predicate for a literal job name.
Signature
type ValidJobName<Name extends string = string> = string extends Name
? never
: Name extends (typeof JOB_NAME_RESERVED)[number]
? never
: Name extends `${LowercaseLetter}${infer Rest}`
? ValidCharacters<Rest> extends true
? AtMost64<Name> extends true
? Name
: never
: never
: never;
job-validation-value.ts
copyAdmission
Validates and freezes job admission policy against the canonical input schema.
Throws
TypeError for unsupported or unsafe admission values.
Example
copyAdmission({ idempotency: { key: "orderId" } }, inputSchema);
Signature
declare const copyAdmission: <Input>(
value: unknown,
canonicalSchema?: StandardSchemaV1,
) => JobAdmission<Input> | undefined;
copyClient
Validates the client operations and projected fields exposed by a job.
Throws
TypeError for an undeclared operation or invalid field.
Example
copyClient({ public: true, operations: ["status"] }, declarations);
Signature
declare const copyClient: (
value: unknown,
declarations: ClientDeclarations,
) => JobClientAccess | undefined;
job-validation.ts
ClientDeclarations
Signature
declare const ClientDeclarations: ClientDeclarations;
JobValidationFailure (class)
Expected job policy validation failure with its original cause.
Example
if (error instanceof JobValidationFailure) console.log(error.message);
Signature
declare class JobValidationFailure
copyAdmission
Synchronous job admission policy copier.
Throws
Original invalid policy error.
Example
copyAdmission({ pastAt: "run" });
Signature
declare const copyAdmission: <Input>(
value: unknown,
canonicalSchema?: StandardSchemaV1,
) => JobAdmission<Input> | undefined;
copyAdmissionEffect
Copies job admission policy in Effect.
Example
Effect.runSync(copyAdmissionEffect({ pastAt: "run" }));
Signature
declare const copyAdmissionEffect: <Input>(
value: unknown,
canonicalSchema?: StandardSchemaV1<unknown, unknown> | undefined,
) => Effect.Effect<JobAdmission<Input> | undefined, JobValidationFailure, never>;
copyClient
Synchronous job client access policy copier.
Throws
Original invalid policy error.
Example
copyClient({ public: true, operations: ["trigger"] }, {});
Signature
declare const copyClient: (
value: unknown,
declarations: ClientDeclarations,
) => JobClientAccess | undefined;
copyClientEffect
Copies job client access policy in Effect.
Example
Effect.runSync(copyClientEffect({ public: true, operations: ["trigger"] }, {}));
Signature
declare const copyClientEffect: (
value: unknown,
declarations: ClientDeclarations,
) => Effect.Effect<JobClientAccess | undefined, JobValidationFailure, never>;
job-validation.types.ts
Task schemas available when authoring job client access.
ClientDeclarations (interface)
Task schemas available when authoring job client access.
Signature
export interface ClientDeclarations {
readonly progress?: unknown;
readonly streams?: unknown;
}
job.types.ts
DefineJobOptions (type alias)
Options accepted for define job operations.
Signature
type DefineJobOptions<
Name extends string,
Task extends TaskDescriptorAny,
Id extends string = Name,
> = DescriptorMetadata &
JobServiceSelection & {
readonly name: Name & ValidJobName<Name>;
readonly id?: Id;
readonly task: Task;
readonly default?: boolean;
readonly schedules?: readonly ScheduleDefinition<InferInput<Task["input"]>>[];
readonly admission?: JobAdmission<InferOutput<Task["input"]>>;
readonly client?: JobClientAccess<StreamsOf<Task>>;
};
JobAdmission (interface)
Policy for late schedules and idempotent submissions.
Signature
export interface JobAdmission<Input = unknown> {
readonly pastAt?: "run" | "reject";
readonly idempotency?: {
readonly key?: Extract<keyof Input, string>;
readonly retention?: DurationInput;
};
}
JobAuthorizationContext (interface)
Trusted scope and optional subject data passed to an access policy.
Signature
export interface JobAuthorizationContext {
readonly application: string;
readonly environment: string;
readonly scope: string;
readonly subject?: string;
readonly auth?: unknown;
readonly run?: import("@relkit/contracts/jobs").RunSnapshot;
}
JobClientAccess (type alias)
Public or policy-guarded operations and fields exposed to clients.
Signature
type JobClientAccess<Streams extends TaskStreamSchemas = TaskStreamSchemas> =
| {
readonly public: true;
readonly operations: readonly JobClientOperation[];
readonly fields?: readonly JobClientField[];
readonly streams?: readonly (keyof Streams & string)[];
}
| {
readonly authorize: (
request: JobAccessRequest,
context: JobAuthorizationContext,
) => MaybePromise<JobAccessGrant>;
readonly public?: never;
readonly operations: readonly JobClientOperation[];
readonly fields?: readonly JobClientField[];
readonly streams?: readonly (keyof Streams & string)[];
};
JobClientField (type alias)
Run fields that authorization may expose to a client.
Signature
type JobClientField = "status" | "input" | "progress" | "output" | "error";
JobDescriptor (type alias)
Validated job definition and its task-specific trigger operation.
Signature
type JobDescriptor<
Name extends string,
Id extends string,
Task extends TaskDescriptorAny,
> = DescriptorBase<"job", Id> &
JobRef<Id, Task["input"], Task["output"], Task> & {
readonly name: Name;
readonly task: Task;
readonly input: Task["input"];
readonly output: Task["output"];
readonly errors?: Task["errors"];
readonly progress?: Task["progress"];
readonly streams?: Task["streams"];
readonly execution: Task["execution"];
readonly observation?: TaskObservation<
Task["streams"] extends TaskStreamSchemas ? Task["streams"] : {}
>;
readonly service?: string;
readonly default?: boolean;
readonly schedules?: readonly ScheduleDefinition<InferOutput<Task["input"]>>[];
readonly admission?: JobAdmission<InferOutput<Task["input"]>>;
readonly client?: JobClientAccess<StreamsOf<Task>>;
readonly trigger: (
input: InferInput<Task["input"]>,
options?: ServerTriggerOptions,
) => Promise<RunHandle>;
};
JobDescriptorAny (type alias)
Erases task-specific admission keys at runtime boundaries without making concrete jobs invariant.
Signature
type JobDescriptorAny = Omit<
JobDescriptor<string, string, TaskDescriptorAny>,
"admission" | "trigger"
> & {
readonly admission?: JobAdmission<any>;
readonly trigger: (input: any, options?: ServerTriggerOptions) => Promise<RunHandle>;
};
JobRunResultOptions (type alias)
Options accepted for job run result operations.
Signature
type JobRunResultOptions = RunResultOptions;
JobScheduleClient
Signature
declare const JobScheduleClient: JobScheduleClient<Definition>;
JobServiceSelection (type alias)
Mutually exclusive service and deprecated profile selectors.
Signature
type JobServiceSelection =
| { readonly service?: string; readonly profile?: never }
| { readonly service?: never; readonly profile?: string };
RetryJitter (type alias)
Jitter strategy for the compatibility retry policy.
Signature
type RetryJitter = "none" | "full" | "equal";
RetryPolicy (interface)
Compatibility retry attempts, delays, multiplier, and jitter.
Signature
export interface RetryPolicy {
readonly maxAttempts: number;
readonly initialDelayMs: number;
readonly maxDelayMs: number;
readonly multiplier: number;
readonly jitter: RetryJitter;
}
RunResultOptions
Signature
declare const RunResultOptions: RunResultOptions;
ScheduleDefinition
Signature
declare const ScheduleDefinition: ScheduleDefinition<Input>;
ScheduleListOptions
Signature
declare const ScheduleListOptions: ScheduleListOptions;
ScheduleMisfire
Signature
declare const ScheduleMisfire: ScheduleMisfire;
ScheduleOverlap
Signature
declare const ScheduleOverlap: ScheduleOverlap;
ScheduleReadReceipt
Signature
declare const ScheduleReadReceipt: ScheduleReadReceipt<Definition>;
ScheduleRecord
Signature
declare const ScheduleRecord: ScheduleRecord<Definition>;
ScheduleWriteOptions
Signature
declare const ScheduleWriteOptions: ScheduleWriteOptions;
ScheduleWriteOutcome
Signature
declare const ScheduleWriteOutcome: ScheduleWriteOutcome;
ScheduleWriteReceipt
Signature
declare const ScheduleWriteReceipt: ScheduleWriteReceipt<Definition>;
ServerTriggerOptions
Signature
declare const ServerTriggerOptions: ServerTriggerOptions;
TriggerOptions
Signature
declare const TriggerOptions: TriggerOptions;
jobs-observability.ts
JobsTelemetry (class)
Injectable observer for jobs Effect operations.
Example
Effect.provide(durationToMillisEffect("1 second"), JobsTelemetryLive);
Signature
declare class JobsTelemetry
JobsTelemetryLive
Live spans and bounded jobs operation metrics.
Example
Effect.provide(durationToMillisEffect("1 second"), JobsTelemetryLive);
Signature
declare const JobsTelemetryLive: Layer.Layer<JobsTelemetry, never, never>;
observeJobs
Observes an operation with a supplied service or the live observer.
Example
observeJobs("duration.toMillis", Effect.succeed(1000));
Signature
declare const observeJobs: <A, E, R>(
operation: JobsOperation,
effect: Effect.Effect<A, E, R>,
) => Effect.Effect<A, E, R>;
jobs-observability.types.ts
JobsOperation (type alias)
Stable, bounded operation labels recorded in spans and metrics.
Example
const operation: JobsOperation = "submission.write";
Signature
type JobsOperation =
| "duration.isInput"
| "duration.toMillis"
| "jobName.is"
| "jobName.assert"
| "jobName.validate"
| "identity.stableTuple"
| "identity.taskOperation"
| "identity.retryOperation"
| "identity.scheduleOccurrence"
| "instant.is"
| "instant.assert"
| "retry.validate"
| "control.write"
| "canonical.assertProjection"
| "taskSupport.copyStrings"
| "taskSupport.assertHook"
| "taskSupport.isSchema"
| "taskSupport.hasOwn"
| "taskSupport.isRecord"
| "taskObservation.copy"
| "migration.diagnose"
| "migration.legacy"
| "authorization.authorize"
| "authorization.grant"
| "authorization.operation"
| "server.readManifest"
| "server.run"
| "server.runtimeOptions"
| "capability.assert"
| "capability.validateReport"
| "adapter.assertMethods"
| "authorization.projectSnapshot"
| "authorization.projectPage"
| "adapter.assertRuntime"
| "adapter.isRuntime"
| "runtime.create"
| "runtime.current"
| "runtime.require"
| "runtime.validateManifest"
| "runtime.runIn"
| "serviceOptions.validate"
| "serviceOptions.serialize"
| "serviceOptions.deserialize"
| "serviceOptions.assertSupported"
| "submission.write"
| "submission.prepare"
| "submission.prepareCanonical"
| "submission.createPipeline"
| "submission.submitTask"
| "submission.submitJob"
| "submission.submitCanonical"
| "schedule.createControls"
| "schedule.list"
| "schedule.get"
| "schedule.write"
| "control.create"
| "control.get"
| "control.list"
| "control.observe"
| "control.cancel"
| "control.retry"
| "control.result"
| "legacy.defineJob"
| "authorization.createCursor"
| "authorization.readCursor"
| "runLocator.create"
| "runLocator.namespaceHash"
| "runLocator.validateKeyRing"
| "runLocator.verify"
| "runLocator.rotate"
| "runLocator.routerLoad"
| "runLocator.routerRegister"
| "runLocator.routerSnapshot"
| "runLocator.routerPersist"
| "runLocator.routerRoute"
| "trigger.copyOptions"
| "trigger.resultOptions"
| "schedule.copyDefinitions"
| "binding.resolve"
| "runtime.resolveBinding"
| "client.runAbortable"
| "client.create"
| "client.enqueue"
| "task.createProgressEmitter"
| "task.createStreamEmitter"
| "task.emitProgress"
| "task.emitStream"
| "schedule.reconcile"
| "schedule.owner"
| "schedule.operationId"
| "schedule.writeRecovery"
| "control.pollResult"
| "taskWire.encodeJob"
| "taskWire.encodeInput"
| "taskWire.encodeOutput"
| "taskWire.decodeJob"
| "taskWire.validateInput"
| "taskWire.validateCanonicalInput"
| "taskWire.validateOutput"
| "taskWire.validateCanonicalOutput"
| "job.define"
| "job.isDescriptor"
| "job.assertDescriptor"
| "task.define"
| "task.isDescriptor"
| "task.assertDescriptor"
| "client.resolveProvider"
| "client.parseInput"
| "client.assertOptions"
| "client.assertOptionalText"
| "client.normalizeResult"
| "client.notify"
| "client.resolveCorrelation"
| "taskValidation.assertSchema"
| "taskValidation.normalizeVersion"
| "taskValidation.inputWire"
| "taskValidation.canonicalSchema"
| "taskValidation.canonicalStreams"
| "taskValidation.retry"
| "taskValidation.dependencies"
| "taskValidation.errors"
| "taskValidation.streams"
| "taskValidation.duration"
| "taskPolicy.utf8Bytes"
| "taskPolicy.boundedString"
| "taskPolicy.fieldName"
| "taskPolicy.memoryBytes"
| "taskPolicy.scalarKey"
| "taskPolicy.tags"
| "taskPolicy.resources"
| "taskPolicy.concurrency"
| "taskPolicy.logging"
| "taskPolicy.retryDelay"
| "jobValidation.admission"
| "jobValidation.client"
| "submission.admission"
| "submission.submitPrepared"
| "control.observeSetup"
| "control.observeNext"
| "controlSupport.context"
| "controlSupport.requireMethod"
| "controlSupport.operationId"
| "controlSupport.cancelReceipt"
| "controlSupport.retryReceipt"
| "controlSupport.isUnknown"
| "controlSupport.unknownKey"
| "controlSupport.unknownRecovery"
| "controlSupport.isTerminal"
| "controlSupport.timeout"
| "controlSupport.isRecord"
| "submissionSupport.error"
| "submissionSupport.receipt"
| "submissionSupport.envelope"
| "submissionSupport.isUnknown"
| "submissionSupport.isRecord"
| "submissionSupport.idempotency"
| "submissionSupport.boundedKey"
| "submissionSupport.scheduledTime"
| "submissionSupport.correlation"
| "submissionSupport.propagation"
| "submissionSupport.parentRun"
| "submissionSupport.hashWire"
| "binding.selectProfile"
| "binding.taskId";
JobsTelemetryService (interface)
Substitutable observer used by jobs Effect operations.
Example
const observer: JobsTelemetryService = { observe: (_name, effect) => effect };
Signature
export interface JobsTelemetryService {
/** Surrounds an operation while preserving its success and error channels.
* @param operation - A stable operation name.
* @param effect - The operation to observe.
* @returns The observed Effect with unchanged success and error types.
* @example observer.observe("duration.toMillis", Effect.succeed(1000));
*/
readonly observe: <A, E, R>(
operation: JobsOperation,
effect: Effect.Effect<A, E, R>,
) => Effect.Effect<A, E, R>;
}
legacy-define-job.ts
DefineJobOptions
Signature
declare const DefineJobOptions: DefineJobOptions<Id, InputSchema, Target>;
IdempotencyDefinition
Signature
declare const IdempotencyDefinition: IdempotencyDefinition<Input>;
JobDescriptor
Signature
declare const JobDescriptor: JobDescriptor<Id, Input, InputSchema, Target>;
LegacyJobValidationError (class)
Invalid legacy job authoring options.
Example
if (error instanceof LegacyJobValidationError) console.log(error.message);
Signature
declare class LegacyJobValidationError
RetryJitter
Signature
declare const RetryJitter: RetryJitter;
RetryPolicy
Signature
declare const RetryPolicy: RetryPolicy;
ScheduleDefinition
Signature
declare const ScheduleDefinition: ScheduleDefinition<Input>;
ScheduleOverlap
Signature
declare const ScheduleOverlap: ScheduleOverlap;
defineJob
Synchronous compatibility adapter for legacy job authoring.
Throws
TypeError when the authored job is invalid.
Example
defineJob(options);
Signature
declare const defineJob: <
const Id extends string,
const InputSchema extends StandardSchemaV1,
const Target extends FunctionRefAny,
>(
options: DefineJobOptions<Id, InputSchema, Target>,
) => JobDescriptor<Id, InferInput<InputSchema>, InputSchema, Target>;
defineJobEffect
Defines a legacy function backed job in Effect.
Example
Effect.runSync(defineJobEffect(options));
Signature
declare const defineJobEffect: <
const Id extends string,
const InputSchema extends StandardSchemaV1,
const Target extends FunctionRefAny,
>(
options: DefineJobOptions<Id, InputSchema, Target>,
) => Effect.Effect<
JobDescriptor<Id, InferInput<InputSchema>, InputSchema, Target>,
LegacyJobValidationError,
never
>;
legacy-define-job.types.ts
DefineJobOptions (interface)
Options accepted for define job operations.
Signature
export interface DefineJobOptions<
Id extends string,
InputSchema extends StandardSchemaV1,
Target extends FunctionRefAny,
> extends DescriptorMetadata {
readonly id: Id;
readonly input: InputSchema;
readonly target: Target;
readonly profile?: string;
readonly retry: RetryPolicy;
readonly timeoutMs?: number;
readonly concurrency?: number;
readonly schedule?: readonly ScheduleDefinition<InferInput<InputSchema>>[];
readonly idempotency?: IdempotencyDefinition<InferInput<InputSchema>>;
}
IdempotencyDefinition (interface)
Legacy deduplication key and retention policy.
Signature
export interface IdempotencyDefinition<Input = unknown> {
readonly key: IdempotencyKey<Input>;
readonly retentionMs: number;
}
JobDescriptor (interface)
Validated job definition and its task-specific trigger operation.
Signature
export interface JobDescriptor<
Id extends string,
Input,
InputSchema extends StandardSchemaV1 = StandardSchemaV1,
Target extends FunctionRefAny = FunctionRefAny,
> extends DescriptorBase<"job", Id> {
readonly input: InputSchema;
readonly target: Target;
readonly profile?: string;
readonly retry: RetryPolicy;
readonly timeoutMs?: number;
readonly concurrency?: number;
readonly schedule?: readonly ScheduleDefinition<Input>[];
readonly idempotency?: IdempotencyDefinition<Input>;
}
RetryJitter (type alias)
Jitter strategy retained for legacy job retry policy.
Signature
type RetryJitter = "none" | "full" | "equal";
RetryPolicy (interface)
Legacy retry attempts, backoff, and jitter settings.
Signature
export interface RetryPolicy {
readonly maxAttempts: number;
readonly initialDelayMs: number;
readonly maxDelayMs: number;
readonly multiplier: number;
readonly jitter: RetryJitter;
}
ScheduleDefinition (interface)
Legacy schedule timing and overlap configuration.
Signature
export interface ScheduleDefinition<Input = JsonValue> {
readonly id: string;
readonly cron: string;
readonly timezone: string;
readonly input: Input;
readonly overlap: ScheduleOverlap;
}
ScheduleOverlap (type alias)
Legacy policy for simultaneous schedule occurrences.
Signature
type ScheduleOverlap = "skip" | "allow";
legacy.ts
Explicit one-release compatibility surface for function-target enqueue jobs.
“./client.js” (namespace export)
Re-exports all named exports from the “./client.js” module.
Signature
export * from "./client.js";
“./legacy-define-job.js” (namespace export)
Re-exports all named exports from the “./legacy-define-job.js” module.
Signature
export * from "./legacy-define-job.js";
migration-support.ts
breakingEffect
Constructs one breaking diagnostic within a migration Effect.
Example
Effect.runSync(breakingEffect("TASK_ID_CHANGED", "Task changed"));
Signature
declare const breakingEffect: (
code:
| "TASK_ID_CHANGED"
| "TASK_VERSION_CHANGED"
| "TASK_INPUT_SCHEMA_CHANGED"
| "DEDUPE_SCOPE_CHANGED"
| "PUBLIC_CLIENT_FINGERPRINT_CHANGED"
| "LEGACY_JOBS_DISABLED"
| "LEGACY_ALIAS_CONFLICT",
message: string,
) => Effect.Effect<JobMigrationDiagnostic, never, never>;
sameEffect
Compares schedule identifiers in authored order.
Example
Effect.runSync(sameEffect(["daily"], ["daily"]));
Signature
declare const sameEffect: (
left: ReadonlyArray<string> | undefined,
right: ReadonlyArray<string> | undefined,
) => Effect.Effect<boolean, never, never>;
migration.ts
JobBindingMigration
Signature
declare const JobBindingMigration: JobBindingMigration;
JobMigrationDiagnostic
Signature
declare const JobMigrationDiagnostic: JobMigrationDiagnostic;
JobMigrationSeverity
Signature
declare const JobMigrationSeverity: JobMigrationSeverity;
JobMigrationSnapshot
Signature
declare const JobMigrationSnapshot: JobMigrationSnapshot;
LegacyCompatibilitySnapshot
Signature
declare const LegacyCompatibilitySnapshot: LegacyCompatibilitySnapshot;
diagnoseJobMigration
Synchronous migration diagnostic adapter.
Throws
A runtime defect if the Effect cannot execute synchronously.
Example
diagnoseJobMigration(previous, next);
Signature
declare const diagnoseJobMigration: (
previous: JobMigrationSnapshot,
next: JobMigrationSnapshot,
) => readonly JobMigrationDiagnostic[];
diagnoseJobMigrationEffect
Diagnoses identity and contract changes between two job snapshots in Effect.
Example
Effect.runSync(diagnoseJobMigrationEffect(previous, next));
Signature
declare const diagnoseJobMigrationEffect: (
previous: JobMigrationSnapshot,
next: JobMigrationSnapshot,
) => Effect.Effect<ReadonlyArray<JobMigrationDiagnostic>, never, never>;
diagnoseLegacyCompatibility
Synchronous legacy compatibility diagnostic adapter.
Throws
A runtime defect if the Effect cannot execute synchronously.
Example
diagnoseLegacyCompatibility(snapshot);
Signature
declare const diagnoseLegacyCompatibility: (
snapshot: LegacyCompatibilitySnapshot,
) => readonly JobMigrationDiagnostic[];
diagnoseLegacyCompatibilityEffect
Diagnoses legacy configuration aliases in Effect.
Example
Effect.runSync(diagnoseLegacyCompatibilityEffect(snapshot));
Signature
declare const diagnoseLegacyCompatibilityEffect: (
snapshot: LegacyCompatibilitySnapshot,
) => Effect.Effect<ReadonlyArray<JobMigrationDiagnostic>, never, never>;
migration.types.ts
Binding mode recorded in a job migration snapshot.
JobBindingMigration (type alias)
Binding mode recorded in a job migration snapshot.
Signature
type JobBindingMigration = "implicit" | "default" | "explicit";
JobMigrationDiagnostic (interface)
Actionable compatibility finding for an authored job change.
Signature
export interface JobMigrationDiagnostic {
readonly code:
| "DEFAULT_DERIVED_JOB_ID_RENAME"
| "PINNED_JOB_ID_CHANGED"
| "IMPLICIT_TO_EXPLICIT_BINDING"
| "TASK_ID_CHANGED"
| "TASK_VERSION_CHANGED"
| "TASK_INPUT_SCHEMA_CHANGED"
| "HISTORICAL_RUNS_PINNED"
| "SCHEDULE_TARGET_CHANGED"
| "DEDUPE_SCOPE_CHANGED"
| "PUBLIC_CLIENT_FINGERPRINT_CHANGED"
| "LEGACY_JOBS_DISABLED"
| "LEGACY_ALIAS_CONFLICT"
| "LEGACY_ALIAS_DEPRECATED";
readonly severity: JobMigrationSeverity;
readonly breaking: boolean;
readonly message: string;
}
JobMigrationSeverity (type alias)
Severity assigned to one compatibility diagnostic.
Signature
type JobMigrationSeverity = "warning" | "error";
JobMigrationSnapshot (interface)
Versioned job identity and public contract facts used by migration checks.
Signature
export interface JobMigrationSnapshot {
readonly name: string;
readonly id: string;
readonly idSource?: "explicit" | "name";
readonly taskId: string;
readonly taskVersion: string;
readonly inputSchemaHash?: string;
readonly binding: JobBindingMigration;
readonly publicFingerprint?: string;
readonly clientFingerprint?: string;
readonly service?: string;
readonly hasHistoricalRuns?: boolean;
readonly scheduleIds?: readonly string[];
readonly dedupeScope?: string;
}
LegacyCompatibilitySnapshot (interface)
Legacy and replacement configuration keys involved in migration.
Signature
export interface LegacyCompatibilitySnapshot {
readonly usesFunctionTarget: boolean;
readonly legacyJobsEnabled: boolean;
readonly legacyKeys?: readonly ("job" | "defaults.job" | "profile")[];
readonly newKeys?: readonly ("jobs" | "defaults.jobs" | "service")[];
}
resolve-binding-error.ts
JobBindingResolutionError (class)
A deterministic task-to-job binding resolution failure.
Example
new JobBindingResolutionError("UNKNOWN_JOB_SELECTOR", "Unknown job");
Signature
declare class JobBindingResolutionError {
constructor(code: JobBindingErrorCode, message: string);
}
code (property)
Signature
readonly code: JobBindingErrorCode
resolve-binding-support.ts
JobBindingSupportFailure (class)
A provider profile selection failure with a stable resolution code.
Example
new JobBindingSupportFailure({ code: "UNKNOWN_JOB_PROFILE", reason: "Unknown profile" });
Signature
declare class JobBindingSupportFailure
selectProfile
Synchronous provider profile selector.
Throws
JobBindingResolutionError for missing or unknown profiles.
Example
selectProfile(undefined, ["default"], "send");
Signature
declare const selectProfile: (
requested: string | undefined,
profiles: ResolveBindingOptions["profiles"],
jobId: string,
) => string;
selectProfileEffect
Selects a provider profile in Effect.
Example
Effect.runSync(selectProfileEffect(undefined, ["default"], "send"));
Signature
declare const selectProfileEffect: (
requested: string | undefined,
profiles: ReadonlyArray<string> | Readonly<Record<string, unknown>> | undefined,
jobId: string,
) => Effect.Effect<string, JobBindingSupportFailure, never>;
taskIdOf
Synchronous task reference id reader.
Example
taskIdOf(taskRef);
Signature
declare const taskIdOf: (value: TaskRefAny | undefined) => string;
taskIdOfEffect
Reads a task reference id in Effect.
Example
Effect.runSync(taskIdOfEffect(taskRef));
Signature
declare const taskIdOfEffect: (
value: TaskRefAny | undefined,
) => Effect.Effect<string, never, never>;
resolve-binding.ts
BindingSource
Signature
declare const BindingSource: BindingSource;
JobBindingErrorCode
Signature
declare const JobBindingErrorCode: JobBindingErrorCode;
JobBindingFailure (class)
A typed task-to-job binding resolution failure.
Example
if (error instanceof JobBindingFailure) console.log(error.message);
Signature
declare class JobBindingFailure
JobBindingResolutionError
Signature
declare const JobBindingResolutionError: typeof JobBindingResolutionError;
ResolveBindingOptions
Signature
declare const ResolveBindingOptions: ResolveBindingOptions;
ResolvedTaskBinding
Signature
declare const ResolvedTaskBinding: ResolvedTaskBinding;
resolveBinding
Compatibility alias for task-to-job binding resolution.
Throws
JobBindingResolutionError for invalid or ambiguous bindings.
Example
resolveBinding({ task, implicitName: "send" });
Signature
declare const resolveBinding: (options: ResolveBindingOptions) => ResolvedTaskBinding;
resolveTaskBinding
Synchronous compatibility resolver for one task.
Throws
JobBindingResolutionError on ambiguity or invalid selector.
Example
resolveTaskBinding(options);
Signature
declare const resolveTaskBinding: (options: ResolveBindingOptions) => ResolvedTaskBinding;
resolveTaskBindingEffect
Resolves an explicit, default, or private implicit job in Effect.
Example
Effect.runSync(resolveTaskBindingEffect(options));
Signature
declare const resolveTaskBindingEffect: (
options: ResolveBindingOptions,
) => Effect.Effect<ResolvedTaskBinding, JobBindingFailure, never>;
resolve-binding.types.ts
BindingSource (type alias)
How a task selected its job binding.
Signature
type BindingSource = "explicit" | "default" | "implicit";
JobBindingErrorCode (type alias)
Machine-readable reason for a binding resolution failure.
Signature
type JobBindingErrorCode =
| "MISSING_IMPLICIT_NAME"
| "INVALID_IMPLICIT_NAME"
| "TASK_SELECTOR_MISMATCH"
| "UNKNOWN_JOB_SELECTOR"
| "AMBIGUOUS_JOB"
| "DUPLICATE_JOB_ID"
| "MULTIPLE_DEFAULT_JOBS"
| "MISSING_JOB_PROFILE"
| "AMBIGUOUS_JOB_PROFILE"
| "UNKNOWN_JOB_PROFILE";
ResolveBindingOptions (interface)
Inputs for resolving one task to its executable job.
Signature
export interface ResolveBindingOptions {
readonly task: TaskRefAny;
readonly jobs?: readonly JobDescriptorAny[];
readonly selector?: JobDescriptorAny | JobRefAny;
readonly implicitName?: string;
readonly profiles?: readonly string[] | Readonly<Record<string, unknown>>;
readonly defaultProfile?: string;
}
ResolvedTaskBinding (interface)
Canonical task-to-job selection returned by the binding resolver.
Signature
export interface ResolvedTaskBinding {
readonly taskId: string;
readonly taskVersion?: string;
readonly jobId: string;
readonly name: string;
readonly service?: string;
readonly profile: string;
readonly source: BindingSource;
readonly implicit: boolean;
readonly default: boolean;
readonly private: boolean;
readonly job?: JobDescriptorAny;
}
retry-policy.ts
RetryPolicyValidationError (class)
An invalid authored legacy retry policy.
Example
new RetryPolicyValidationError({ reason: "retry.maxAttempts must be positive" });
Signature
declare class RetryPolicyValidationError
validateRetry
Synchronous legacy retry policy validator.
Throws
TypeError when any retry field is invalid.
Example
validateRetry({ maxAttempts: 2, initialDelayMs: 0, maxDelayMs: 0, multiplier: 1, jitter: "none" });
Signature
declare const validateRetry: (value: LegacyRetryPolicy) => LegacyRetryPolicy;
validateRetryEffect
Validates legacy retry policy fields in Effect.
Example
Effect.runPromise(
validateRetryEffect({
maxAttempts: 2,
initialDelayMs: 0,
maxDelayMs: 0,
multiplier: 1,
jitter: "none",
}),
);
Signature
declare const validateRetryEffect: (value: RetryPolicy) => Effect.Effect<
Readonly<{
maxAttempts: number;
initialDelayMs: number;
maxDelayMs: number;
multiplier: number;
jitter: RetryJitter;
}>,
RetryPolicyValidationError,
never
>;
retry-policy.types.ts
LegacyRetryPolicy (type alias)
Legacy authored retry policy accepted by the validation boundary.
Signature
type LegacyRetryPolicy = RetryPolicy;
run-id-codec.ts
createRunLocatorValue
Serializes and signs a validated run locator payload.
Throws
RunLocatorError when keys, payload, or encoded length are invalid.
Example
createRunLocatorValue({ keyRing, payload });
Signature
declare const createRunLocatorValue: (options: RunLocatorCreateOptions) => string;
rotateRunLocatorKeysValue
Adds a signing key while retaining prior keys for existing locators.
Throws
RunLocatorError when the ring or new key identifier is invalid.
Example
rotateRunLocatorKeysValue(keyRing, "v2", "new-secret");
Signature
declare const rotateRunLocatorKeysValue: (
ring: RunLocatorKeyRing,
keyId: string,
secret: string | Uint8Array,
) => RunLocatorKeyRing;
verifyRunLocatorValue
Verifies a locator signature, payload, and requested deployment namespace.
Throws
RunLocatorError on malformed encoding, signature, or namespace.
Example
verifyRunLocatorValue(locator, { keyRing, application: "shop" });
Signature
declare const verifyRunLocatorValue: (
locator: string,
options: RunLocatorVerifyOptions,
) => VerifiedRunLocator;
run-id-errors.ts
Compatibility error for an invalid, unauthenticated, or unroutable locator.
Example
throw new RunLocatorError();
RunLocatorError (class)
Compatibility error for an invalid, unauthenticated, or unroutable locator.
Example
throw new RunLocatorError();
Signature
declare class RunLocatorError {
constructor();
}
code (property)
Signature
readonly code: "RELKIT_JOB_LOCATOR_INVALID"
run-id-router-store.ts
RunLocatorGenerationStorage (class)
Injectable persistence service for historical run locator generations.
Example
Effect.provide(RunLocatorRouter.fromStoreEffect(), runLocatorStoreLayer(store));
Signature
declare class RunLocatorGenerationStorage
RunLocatorStoreFailure (class)
Failure from generation persistence, preserving the original cause.
Example
if (error instanceof RunLocatorStoreFailure) console.log(error.message);
Signature
declare class RunLocatorStoreFailure
runLocatorStoreLayer
Provides a concrete generation store to Effect operations.
Example
runLocatorStoreLayer(memoryStore);
Signature
declare const runLocatorStoreLayer: (
store: RunLocatorGenerationStore,
) => Layer.Layer<RunLocatorGenerationStorage, never, never>;
run-id-router.ts
RunLocatorGeneration
Signature
declare const RunLocatorGeneration: RunLocatorGeneration;
RunLocatorGenerationStorage
Signature
declare const RunLocatorGenerationStorage: typeof RunLocatorGenerationStorage;
RunLocatorGenerationStore
Signature
declare const RunLocatorGenerationStore: RunLocatorGenerationStore;
RunLocatorRouter (class)
Routes signed run locators through retained service generations.
Example
new RunLocatorRouter([{ generation: "v1", keyRing }]);
Signature
declare class RunLocatorRouter {
constructor(generations: readonly RunLocatorGeneration[] = []);
}
fromStore (static method)
Promise compatibility loader.
Throws
The original storage error.
Example
await RunLocatorRouter.fromStore(store);
Signature
declare const fromStore: (store: RunLocatorGenerationStore) => Promise<RunLocatorRouter>;
register (method)
Synchronous generation registration.
Throws
RunLocatorError for invalid generation or keys.
Example
router.register("v2", ring);
Signature
declare const register: (generation: string, keyRing: RunLocatorKeyRing) => void;
snapshot (method)
Synchronous snapshot of retained generations.
Example
router.snapshot();
Signature
declare const snapshot: () => readonly RunLocatorGeneration[];
persist (method)
Promise compatibility persistence.
Throws
The original storage error.
Example
await router.persist(store);
Signature
declare const persist: (store: RunLocatorGenerationStore) => Promise<void>;
route (method)
Synchronously routes a signed locator.
Throws
RunLocatorError when no retained generation matches.
Example
router.route(locator);
Signature
declare const route: (
locator: string,
options?: Omit<RunLocatorVerifyOptions, "keyRing">,
) => VerifiedRunLocator;
registerEffect (property)
Registers a generation in Effect.
Example
Effect.runSync(router.registerEffect("v2", ring));
Signature
readonly registerEffect: (generation: string, keyRing: RunLocatorKeyRing) => Effect.Effect<void, RunLocatorFailure, never>
snapshotEffect (property)
Returns a sorted frozen snapshot in Effect.
Example
Effect.runSync(router.snapshotEffect());
Signature
readonly snapshotEffect: () => Effect.Effect<ReadonlyArray<Readonly<{ generation: string; keyRing: RunLocatorKeyRing; }>>, never, never>
persistEffect (property)
Persists the current snapshot through the storage service.
Example
Effect.runPromise(Effect.provide(router.persistEffect(), runLocatorStoreLayer(store)));
Signature
readonly persistEffect: () => Effect.Effect<void, RunLocatorStoreFailure, RunLocatorGenerationStorage>
routeEffect (property)
Routes a locator through retained generations in Effect.
Example
Effect.runSync(router.routeEffect(locator));
Signature
readonly routeEffect: (locator: string, options?: Omit<RunLocatorVerifyOptions, "keyRing"> | undefined) => Effect.Effect<VerifiedRunLocator, RunLocatorFailure, never>
RunLocatorStoreFailure
Signature
declare const RunLocatorStoreFailure: typeof RunLocatorStoreFailure;
runLocatorStoreLayer
Signature
declare const runLocatorStoreLayer: (
store: RunLocatorGenerationStore,
) => Layer<RunLocatorGenerationStorage, never, never>;
run-id-router.types.ts
RunLocatorGeneration (interface)
One retained service generation and its locator verification keys.
Signature
export interface RunLocatorGeneration {
readonly generation: string;
readonly keyRing: RunLocatorKeyRing;
}
RunLocatorGenerationStore (interface)
Replaceable persistence boundary for locator generations.
Signature
export interface RunLocatorGenerationStore {
readonly load: () => readonly RunLocatorGeneration[] | Promise<readonly RunLocatorGeneration[]>;
readonly save: (generations: readonly RunLocatorGeneration[]) => void | Promise<void>;
}
run-id-support.ts
assertSegment
Validates a bounded printable locator key identifier.
Throws
RunLocatorError for unsupported characters or length.
Example
assertSegment("key-v1");
Signature
declare const assertSegment: (value: string) => void;
isBase64Url
Checks canonical unpadded base64url encoding for one locator segment.
Example
isBase64Url("YQ");
Signature
declare const isBase64Url: (value: string | undefined) => value is string;
namespaceHash
Hashes the trusted deployment namespace used to bind durable run locators.
Throws
RunLocatorError when an identity is empty or exceeds its byte limit.
Example
namespaceHash("shop", "production", "orders");
Signature
declare const namespaceHash: (application: string, environment: string, scope: string) => string;
normalizePayload
Validates and freezes the payload before it is signed or returned to callers.
Throws
RunLocatorError for malformed identities or a mismatched namespace.
Example
normalizePayload(payload);
Signature
declare const normalizePayload: (value: RunLocatorPayload) => RunLocatorPayload;
validateRunLocatorKeyRing
Verifies the active key and every key identifier and secret in a key ring.
Throws
RunLocatorError for missing, oversized, or malformed keys.
Example
validateRunLocatorKeyRing({ activeKeyId: "v1", keys: { v1: "secret" } });
Signature
declare const validateRunLocatorKeyRing: (ring: RunLocatorKeyRing) => void;
run-id.ts
RUN_LOCATOR_MAX_BYTES
Maximum encoded locator size accepted at the jobs boundary.
Example
locator.length <= RUN_LOCATOR_MAX_BYTES;
Signature
declare const RUN_LOCATOR_MAX_BYTES: 4096;
RUN_LOCATOR_VERSION
Wire format version for signed run locators.
Example
RUN_LOCATOR_VERSION === 1;
Signature
declare const RUN_LOCATOR_VERSION: 1;
RunLocatorCreateOptions
Signature
declare const RunLocatorCreateOptions: RunLocatorCreateOptions;
RunLocatorError
Signature
declare const RunLocatorError: typeof RunLocatorError;
RunLocatorFailure (class)
Invalid signed run locator or key rotation.
Example
if (error instanceof RunLocatorFailure) console.log(error.message);
Signature
declare class RunLocatorFailure
RunLocatorKeyRing
Signature
declare const RunLocatorKeyRing: RunLocatorKeyRing;
RunLocatorKeyRingStore
Signature
declare const RunLocatorKeyRingStore: RunLocatorKeyRingStore;
RunLocatorPayload
Signature
declare const RunLocatorPayload: RunLocatorPayload;
RunLocatorVerifyOptions
Signature
declare const RunLocatorVerifyOptions: RunLocatorVerifyOptions;
VerifiedRunLocator
Signature
declare const VerifiedRunLocator: VerifiedRunLocator;
createRunLocator
Synchronously signs a run locator.
Throws
RunLocatorError when the payload or key ring is invalid.
Example
createRunLocator({ payload, keyRing });
Signature
declare const createRunLocator: (options: RunLocatorCreateOptions) => string;
createRunLocatorEffect
Signs a run locator in Effect.
Example
Effect.runSync(createRunLocatorEffect({ payload, keyRing }));
Signature
declare const createRunLocatorEffect: (
options: RunLocatorCreateOptions,
) => Effect.Effect<string, RunLocatorFailure, never>;
decodeRunLocator
Compatibility alias for verifyRunLocator.
Example
decodeRunLocator(locator, { keyRing });
Signature
declare const decodeRunLocator: (
locator: string,
options: RunLocatorVerifyOptions,
) => VerifiedRunLocator;
encodeRunLocator
Compatibility alias for createRunLocator.
Example
encodeRunLocator({ payload, keyRing });
Signature
declare const encodeRunLocator: (options: RunLocatorCreateOptions) => string;
namespaceHash
Synchronously hashes a trusted deployment namespace.
Throws
RunLocatorError for invalid identities.
Example
namespaceHash("shop", "production", "orders");
Signature
declare const namespaceHash: (application: string, environment: string, scope: string) => string;
namespaceHashEffect
Hashes a trusted deployment namespace in Effect.
Example
Effect.runSync(namespaceHashEffect("shop", "production", "orders"));
Signature
declare const namespaceHashEffect: (
application: string,
environment: string,
scope: string,
) => Effect.Effect<string, RunLocatorFailure, never>;
rotateRunLocatorKeys
Synchronously rotates a locator signing key.
Throws
RunLocatorError when the ring or key identifier is invalid.
Example
rotateRunLocatorKeys(ring, "v2", secret);
Signature
declare const rotateRunLocatorKeys: (
ring: RunLocatorKeyRing,
keyId: string,
secret: string | Uint8Array,
) => RunLocatorKeyRing;
rotateRunLocatorKeysEffect
Rotates the active locator signing key in Effect.
Example
Effect.runSync(rotateRunLocatorKeysEffect(ring, "v2", secret));
Signature
declare const rotateRunLocatorKeysEffect: (
ring: RunLocatorKeyRing,
keyId: string,
secret: string | Uint8Array<ArrayBufferLike>,
) => Effect.Effect<RunLocatorKeyRing, RunLocatorFailure, never>;
validateRunLocatorKeyRing
Synchronously validates a locator key ring.
Throws
RunLocatorError for invalid keys or IDs.
Example
validateRunLocatorKeyRing(ring);
Signature
declare const validateRunLocatorKeyRing: (ring: RunLocatorKeyRing) => void;
validateRunLocatorKeyRingEffect
Validates a locator key ring in Effect.
Example
Effect.runSync(validateRunLocatorKeyRingEffect(ring));
Signature
declare const validateRunLocatorKeyRingEffect: (
ring: RunLocatorKeyRing,
) => Effect.Effect<void, RunLocatorFailure, never>;
verifyRunLocator
Synchronously verifies a signed run locator.
Throws
RunLocatorError when the locator is invalid or has another namespace.
Example
verifyRunLocator(locator, { keyRing });
Signature
declare const verifyRunLocator: (
locator: string,
options: RunLocatorVerifyOptions,
) => VerifiedRunLocator;
verifyRunLocatorEffect
Verifies a run locator in Effect.
Example
Effect.runSync(verifyRunLocatorEffect(locator, { keyRing }));
Signature
declare const verifyRunLocatorEffect: (
locator: string,
options: RunLocatorVerifyOptions,
) => Effect.Effect<VerifiedRunLocator, RunLocatorFailure, never>;
run-id.types.ts
Signed run identity and namespace fields carried by a locator.
RunLocatorCreateOptions (interface)
Options accepted for run locator create operations.
Signature
export interface RunLocatorCreateOptions {
readonly payload: RunLocatorPayload;
readonly keyRing: RunLocatorKeyRing;
}
RunLocatorKeyRing (interface)
Signing and verification keys for run locators.
Signature
export interface RunLocatorKeyRing {
readonly activeKeyId: string;
readonly keys: Readonly<Record<string, string | Uint8Array>>;
}
RunLocatorKeyRingStore (interface)
Store of key rings used during locator rotation.
Signature
export interface RunLocatorKeyRingStore {
readonly load: () => RunLocatorKeyRing | Promise<RunLocatorKeyRing>;
readonly save: (ring: RunLocatorKeyRing) => void | Promise<void>;
}
RunLocatorPayload (interface)
Signed run identity and namespace fields carried by a locator.
Signature
export interface RunLocatorPayload {
readonly application: string;
readonly environment: string;
readonly serviceGeneration: string;
readonly jobId: string;
readonly taskId: string;
readonly taskVersion: string;
readonly buildId: string;
/** Accepted only while creating a locator; the clear-text scope is never encoded. */
readonly scope?: string;
readonly namespaceHash?: string;
readonly schemaHash?: string;
readonly native: { readonly kind: string; readonly value: string };
}
RunLocatorVerifyOptions (interface)
Options accepted for run locator verify operations.
Signature
export interface RunLocatorVerifyOptions {
readonly keyRing: RunLocatorKeyRing;
readonly application?: string;
readonly environment?: string;
readonly scope?: string;
}
VerifiedRunLocator (interface)
Decoded signed locator with trusted namespace and run identity.
Signature
export interface VerifiedRunLocator extends RunLocatorPayload {
readonly keyId: string;
readonly version: 1;
}
runtime-context.ts
JobsRuntimeCallbackError (class)
Failure raised by a callback executed inside an ambient runtime.
Example
if (error instanceof JobsRuntimeCallbackError) console.log(error.message);
Signature
declare class JobsRuntimeCallbackError
JobsRuntimeError (class)
Invalid runtime configuration or missing ambient runtime.
Example
if (error instanceof JobsRuntimeError) console.log(error.message);
Signature
declare class JobsRuntimeError
currentJobsRuntime
Reads the ambient runtime synchronously.
Example
currentJobsRuntime();
Signature
declare const currentJobsRuntime: () => JobsRuntime | undefined;
currentJobsRuntimeEffect
Reads the ambient runtime in Effect.
Example
Effect.runSync(currentJobsRuntimeEffect());
Signature
declare const currentJobsRuntimeEffect: () => Effect.Effect<JobsRuntime | undefined, never, never>;
requireJobsRuntime
Requires an ambient runtime synchronously.
Throws
Error when no runtime is bound.
Example
requireJobsRuntime();
Signature
declare const requireJobsRuntime: () => JobsRuntime;
requireJobsRuntimeEffect
Requires an ambient runtime in Effect.
Example
Effect.runSync(requireJobsRuntimeEffect());
Signature
declare const requireJobsRuntimeEffect: () => Effect.Effect<JobsRuntime, JobsRuntimeError, never>;
runInJobsRuntime
Runs a callback with a runtime bound to its async context.
Throws
The original callback error, if it throws.
Example
runInJobsRuntime(runtime, () => requireJobsRuntime());
Signature
declare const runInJobsRuntime: <A>(runtime: JobsRuntime, callback: () => A) => A;
runInJobsRuntimeEffect
Runs a callback with the given ambient runtime in Effect.
Example
Effect.runSync(runInJobsRuntimeEffect(runtime, () => requireJobsRuntime()));
Signature
declare const runInJobsRuntimeEffect: <A>(
runtime: JobsRuntime,
callback: () => A,
) => Effect.Effect<A, JobsRuntimeCallbackError, never>;
runWithJobsRuntime
Alias of runInJobsRuntime.
Throws
The original callback error.
Example
runWithJobsRuntime(runtime, () => 1);
Signature
declare const runWithJobsRuntime: <A>(runtime: JobsRuntime, callback: () => A) => A;
runWithJobsRuntimeEffect
Alias of runInJobsRuntimeEffect.
Example
Effect.runSync(runWithJobsRuntimeEffect(runtime, () => 1));
Signature
declare const runWithJobsRuntimeEffect: <A>(
runtime: JobsRuntime,
callback: () => A,
) => Effect.Effect<A, JobsRuntimeCallbackError, never>;
runtime-selection-value.ts
resolveBindingValue
Selects a task’s job from the runtime manifest and validates its build binding.
Throws
TypeError for missing, ambiguous, or mismatched bindings.
Example
resolveBindingValue(task, undefined, options);
Signature
declare const resolveBindingValue: (
task: TaskRefAny,
selector: JobRefAny | undefined,
options: JobsRuntimeOptions,
) => JobsRuntimeBinding;
runtime-selection.ts
RuntimeBindingFailure (class)
Invalid manifest or selector resolution for a runtime binding.
Example
if (error instanceof RuntimeBindingFailure) console.log(error.message);
Signature
declare class RuntimeBindingFailure
resolveBinding
Synchronous runtime binding resolver.
Throws
TypeError for ambiguous or unknown jobs.
Example
resolveBinding(task, undefined, options);
Signature
declare const resolveBinding: (
task: TaskRefAny,
selector: JobRefAny | undefined,
options: JobsRuntimeOptions,
) => JobsRuntimeBinding;
resolveBindingEffect
Resolves a task’s runtime binding in Effect.
Example
Effect.runSync(resolveBindingEffect(task, undefined, options));
Signature
declare const resolveBindingEffect: (
task: TaskRefAny,
selector: JobRefAny | undefined,
options: JobsRuntimeOptions,
) => Effect.Effect<JobsRuntimeBinding, RuntimeBindingFailure, never>;
runtime.ts
JobsManifestLike
Signature
declare const JobsManifestLike: JobsManifestLike;
JobsOperationOptions
Signature
declare const JobsOperationOptions: JobsOperationOptions;
JobsRuntime
Signature
declare const JobsRuntime: JobsRuntime;
JobsRuntimeBinding
Signature
declare const JobsRuntimeBinding: JobsRuntimeBinding;
JobsRuntimeCallbackError
Signature
declare const JobsRuntimeCallbackError: typeof JobsRuntimeCallbackError;
JobsRuntimeError
Signature
declare const JobsRuntimeError: typeof JobsRuntimeError;
JobsRuntimeOptions
Signature
declare const JobsRuntimeOptions: JobsRuntimeOptions;
NativeLocator
Signature
declare const NativeLocator: string;
TaskDescriptorAny
Signature
declare const TaskDescriptorAny: TaskDescriptorAny;
createJobsRuntime
Synchronously creates a validated jobs runtime.
Throws
TypeError or JobsCapabilityError for invalid configuration.
Example
createJobsRuntime({ adapter });
Signature
declare const createJobsRuntime: (options: JobsRuntimeOptions) => JobsRuntime;
createJobsRuntimeEffect
Creates a validated jobs runtime in Effect.
Example
Effect.runSync(createJobsRuntimeEffect({ adapter }));
Signature
declare const createJobsRuntimeEffect: (
options: JobsRuntimeOptions,
) => Effect.Effect<
JobsRuntime,
JobsCapabilityFailure | JobsAdapterValidationError | JobsRuntimeError,
never
>;
currentJobsRuntime
Signature
declare const currentJobsRuntime: () => JobsRuntime | undefined;
currentJobsRuntimeEffect
Signature
declare const currentJobsRuntimeEffect: () => Effect.Effect<JobsRuntime | undefined, never, never>;
requireJobsRuntime
Signature
declare const requireJobsRuntime: () => JobsRuntime;
requireJobsRuntimeEffect
Signature
declare const requireJobsRuntimeEffect: () => Effect.Effect<JobsRuntime, JobsRuntimeError, never>;
runInJobsRuntime
Signature
declare const runInJobsRuntime: <A>(runtime: JobsRuntime, callback: () => A) => A;
runInJobsRuntimeEffect
Signature
declare const runInJobsRuntimeEffect: <A>(
runtime: JobsRuntime,
callback: () => A,
) => Effect.Effect<A, JobsRuntimeCallbackError, never>;
runWithJobsRuntime
Signature
declare const runWithJobsRuntime: <A>(runtime: JobsRuntime, callback: () => A) => A;
runWithJobsRuntimeEffect
Signature
declare const runWithJobsRuntimeEffect: <A>(
runtime: JobsRuntime,
callback: () => A,
) => Effect.Effect<A, JobsRuntimeCallbackError, never>;
runtime.types.ts
JobsManifestLike (interface)
Minimal manifest fields used to resolve authored jobs and tasks.
Signature
export interface JobsManifestLike {
readonly protocol?: string;
readonly version?: number;
readonly app?: string;
readonly environment?: string;
readonly jobsProtocolVersion?: number;
readonly tasks?: readonly {
readonly id: string;
readonly version?: string;
readonly buildId?: string;
readonly schemaHashes?: unknown;
readonly policy?: unknown;
}[];
readonly jobs?: readonly {
readonly id: string;
readonly name: string;
readonly taskId: string;
readonly taskVersion?: string;
readonly buildId?: string;
readonly profile?: string;
readonly serviceGeneration?: string;
readonly default?: boolean;
}[];
}
JobsOperationOptions (type alias)
Caller signal and trusted metadata passed to a native jobs operation.
Signature
type JobsOperationOptions = Pick<OperationContext, "signal"> &
Partial<
Pick<
OperationContext,
| "scope"
| "operationId"
| "deadlineMs"
| "correlationId"
| "parentRunId"
| "propagation"
| "acceptanceIdentity"
| "occurrenceIdentity"
| "inputSchemaHash"
| "retryOfRunId"
>
>;
JobsRuntime (interface)
Validated runtime bindings and provider access for job operations.
Signature
export interface JobsRuntime {
readonly adapter: JobsAdapterRuntime;
readonly capabilities: JobsCapabilityReport;
readonly application: string;
readonly environment: string;
readonly scope: string;
readonly service: string;
readonly serviceGeneration: string;
readonly manifest?: JobsManifestLike;
readonly jobs?: readonly JobDescriptorAny[];
readonly taskExecutor?: TaskExecutor;
readonly tasks?: readonly TaskDescriptorAny[];
readonly resolveBinding: (task: TaskRefAny, selector?: JobRefAny) => JobsRuntimeBinding;
readonly operationContext: (options: JobsOperationOptions) => OperationContext;
readonly close: () => Promise<void>;
}
JobsRuntimeBinding (interface)
Resolved task, job, service, and build identity pinned for one run.
Signature
export interface JobsRuntimeBinding {
readonly taskId: string;
readonly taskVersion: string;
readonly jobId: string;
readonly name: string;
readonly profile: string;
readonly service: string;
readonly serviceGeneration: string;
readonly buildId: string;
readonly inputSchemaHash?: string;
readonly scope?: string;
readonly policy?: unknown;
}
JobsRuntimeOptions (interface)
Provider, manifest, and authored descriptors used to create a jobs runtime.
Signature
export interface JobsRuntimeOptions {
readonly adapter?: unknown;
readonly provider?: unknown;
readonly providerHandle?: { readonly value: unknown };
readonly capabilities?: JobsCapabilityReport;
readonly application?: string;
readonly environment?: string;
readonly scope?: string;
readonly service?: string;
readonly serviceGeneration?: string;
readonly manifest?: JobsManifestLike;
readonly jobs?: readonly JobDescriptorAny[];
readonly taskExecutor?: TaskExecutor;
readonly tasks?: readonly TaskDescriptorAny[];
}
schedule-controls-operations.ts
ScheduleOperationFailure (class)
Expected native schedule operation failure with its compatibility cause.
Example
new ScheduleOperationFailure({ cause: new Error("provider rejected") });
Signature
declare class ScheduleOperationFailure
getScheduleOperationEffect
Reads one bounded native schedule in Effect.
Example
Effect.runPromise(getScheduleOperationEffect(runtime, schedule, "hourly"));
Signature
declare const getScheduleOperationEffect: (
runtime: JobsRuntime,
schedule: NativeScheduleOperations,
id: string,
signal?: AbortSignal | undefined,
) => Effect.Effect<
ScheduleReadReceipt<ScheduleDefinition<unknown>>,
ScheduleOperationFailure,
never
>;
listSchedulesOperationEffect
Lists bounded native schedules in Effect.
Example
Effect.runPromise(listSchedulesOperationEffect(runtime, schedule));
Signature
declare const listSchedulesOperationEffect: (
runtime: JobsRuntime,
schedule: NativeScheduleOperations,
options?: ScheduleListOptions | undefined,
) => Effect.Effect<
ScheduleReadReceipt<ScheduleDefinition<unknown>>,
ScheduleOperationFailure,
never
>;
writeScheduleOperationEffect
Validates and performs one idempotent native schedule write in Effect.
Example
Effect.runPromise(writeScheduleOperationEffect(runtime, schedule, definition, options, "upsert"));
Signature
declare const writeScheduleOperationEffect: (
runtime: JobsRuntime,
schedule: NativeScheduleOperations,
value: string | ScheduleDefinition,
options: ScheduleWriteOptions,
operation: "delete" | "upsert" | "pause" | "resume",
) => Effect.Effect<Readonly<ScheduleWriteReceipt>, ScheduleOperationFailure, never>;
schedule-controls-value.ts
boundedCursor
Validates a native schedule pagination cursor byte limit.
Throws
RangeError when the cursor exceeds 4096 UTF-8 bytes.
Example
boundedCursor("next-page");
Signature
declare const boundedCursor: (value: string) => string;
boundedId
Validates schedule and operation identifiers against the byte limit.
Throws
TypeError for missing or oversized identifiers.
Example
boundedId("hourly");
Signature
declare const boundedId: (value: string) => string;
idleSignal
Creates a nonaborted signal when a caller did not supply one.
Example
idleSignal().aborted;
Signature
declare const idleSignal: () => AbortSignal;
isOutcome
Checks the known native schedule write outcomes.
Example
isOutcome("paused");
Signature
declare const isOutcome: (value: unknown) => boolean;
isRecord
Tests for a nonarray native response record.
Example
isRecord({ outcome: "available" });
Signature
declare const isRecord: (value: unknown) => value is Record<string, unknown>;
isUnknown
Recognizes an uncertain native schedule write for recovery.
Example
isUnknown({ operationId: "op", outcome: "unknown" });
Signature
declare const isUnknown: (value: unknown) => value is UnknownControlOutcome;
normalizeRead
Freezes a valid native schedule read receipt.
Throws
TypeError for an unrecognized outcome.
Example
normalizeRead({ outcome: "unavailable" });
Signature
declare const normalizeRead: (value: unknown) => ScheduleReadReceipt;
schedule-controls.ts
JobScheduleControlFailure (class)
A native schedule operation failed or returned an invalid receipt.
Example
if (error instanceof JobScheduleControlFailure) console.log(error.message);
Signature
declare class JobScheduleControlFailure
createScheduleControls
Synchronous schedule facade factory.
Throws
JobsCapabilityError when native schedules are unavailable.
Example
createScheduleControls(runtime);
Signature
declare const createScheduleControls: (runtime?: JobsRuntime) => JobScheduleClient;
createScheduleControlsEffect
Creates a schedule facade in Effect.
Example
Effect.runSync(createScheduleControlsEffect(runtime));
Signature
declare const createScheduleControlsEffect: (
runtime: JobsRuntime,
) => Effect.Effect<
JobScheduleClient<ScheduleDefinition<unknown>>,
JobScheduleControlFailure,
never
>;
getScheduleEffect
Reads a single native schedule in Effect.
Example
Effect.runPromise(getScheduleEffect(runtime, schedule, "hourly"));
Signature
declare const getScheduleEffect: (
runtime: JobsRuntime,
schedule: NativeScheduleOperations,
id: string,
signal?: AbortSignal | undefined,
) => Effect.Effect<
ScheduleReadReceipt<ScheduleDefinition<unknown>>,
JobScheduleControlFailure,
never
>;
listSchedulesEffect
Lists native schedules in Effect.
Example
Effect.runPromise(listSchedulesEffect(runtime, schedule));
Signature
declare const listSchedulesEffect: (
runtime: JobsRuntime,
schedule: NativeScheduleOperations,
options?: ScheduleListOptions | undefined,
) => Effect.Effect<
ScheduleReadReceipt<ScheduleDefinition<unknown>>,
JobScheduleControlFailure,
never
>;
writeScheduleEffect
Writes or changes a native schedule in Effect.
Example
Effect.runPromise(writeScheduleEffect(runtime, schedule, definition, options, "upsert"));
Signature
declare const writeScheduleEffect: (
runtime: JobsRuntime,
schedule: NativeScheduleOperations,
value: string | ScheduleDefinition,
options: ScheduleWriteOptions,
operation: "delete" | "upsert" | "pause" | "resume",
) => Effect.Effect<Readonly<ScheduleWriteReceipt>, JobScheduleControlFailure, never>;
schedule-reconciliation-identity.ts
scheduleOperationId
Synchronous idempotent native operation identity.
Example
scheduleOperationId(options, "hourly");
Signature
declare const scheduleOperationId: (
options: Pick<ScheduleReconciliationOptions, "context" | "jobId" | "buildId">,
scheduleId: string,
) => string;
scheduleOperationIdEffect
Builds an idempotent native operation identity in Effect.
Example
Effect.runSync(scheduleOperationIdEffect(options, "hourly"));
Signature
declare const scheduleOperationIdEffect: (
options: Pick<ScheduleReconciliationOptions, "jobId" | "context" | "buildId">,
scheduleId: string,
) => Effect.Effect<string, JobIdentityError, never>;
scheduleOwner
Synchronous stable schedule owner identity.
Example
scheduleOwner({ context, jobId: "send" });
Signature
declare const scheduleOwner: (
options: Pick<ScheduleReconciliationOptions, "context" | "jobId">,
) => string;
scheduleOwnerEffect
Builds a stable owner identity in Effect.
Example
Effect.runSync(scheduleOwnerEffect({ context, jobId: "send" }));
Signature
declare const scheduleOwnerEffect: (
options: Pick<ScheduleReconciliationOptions, "jobId" | "context">,
) => Effect.Effect<string, JobIdentityError, never>;
schedule-reconciliation-service.ts
NativeScheduleService (class)
Injectable native provider for schedule reconciliation.
Example
const service = yield * NativeScheduleService;
Signature
declare class NativeScheduleService
ScheduleReconciliationFailure (class)
Expected native schedule reconciliation failure with original cause.
Example
if (error instanceof ScheduleReconciliationFailure) console.log(error.message);
Signature
declare class ScheduleReconciliationFailure
nativeScheduleLayer
Provides a native schedule implementation to the Effect reconciler.
Example
nativeScheduleLayer(adapter.nativeSchedules);
Signature
declare const nativeScheduleLayer: (
native: NativeScheduleOperations,
) => Layer.Layer<NativeScheduleService, never, never>;
schedule-reconciliation-support.ts
isRecord
Tests for a nonarray provider record.
Example
isRecord({ id: "hourly" });
Signature
declare const isRecord: (value: unknown) => value is Record<string, any>;
isScheduleRecord
Recognizes a native schedule record with an identifier.
Example
isScheduleRecord({ id: "hourly" });
Signature
declare const isScheduleRecord: (value: unknown) => value is NativeOwnedScheduleRecord;
nativeDefinition
Adds ownership and canonical input metadata to a desired native schedule.
Throws
TypeError for non-JSON schedule input.
Example
nativeDefinition(schedule, options, "owner-1");
Signature
declare const nativeDefinition: (
schedule: ScheduleReconciliationOptions["desired"][number],
options: Omit<ScheduleReconciliationOptions, "native">,
owner: string,
) => Readonly<
| {
metadata: Readonly<{
buildId: string;
serviceGeneration: string;
canonicalInput: string;
taskVersion?: string;
taskId?: string;
owner: string;
application: string;
environment: string;
service: string;
scope: string;
jobId: string;
}>;
id: string;
input: unknown;
overlap?: ScheduleOverlap;
misfire?: ScheduleMisfire;
cron: string;
timezone: string;
every?: never;
}
| {
metadata: Readonly<{
buildId: string;
serviceGeneration: string;
canonicalInput: string;
taskVersion?: string;
taskId?: string;
owner: string;
application: string;
environment: string;
service: string;
scope: string;
jobId: string;
}>;
id: string;
input: unknown;
overlap?: ScheduleOverlap;
misfire?: ScheduleMisfire;
every: DurationInput;
cron?: never;
timezone?: never;
}
>;
writeContext
Binds one stable operation identity to a native schedule write.
Example
writeContext(context, "schedule-upsert-1");
Signature
declare const writeContext: (
context: OperationContext,
operationIdValue: string,
) => OperationContext;
writeWithRecovery
Promise compatibility native write retry.
Throws
Original terminal write error or unknown outcome error.
Example
await writeWithRecovery(() => native.upsert(value, context), context);
Signature
declare const writeWithRecovery: (
write: () => Promise<unknown>,
context: OperationContext,
) => Promise<unknown>;
writeWithRecoveryEffect
Retries an ambiguous native write once in Effect.
Example
Effect.runPromise(writeWithRecoveryEffect(() => native.upsert(value, context), context));
Signature
declare const writeWithRecoveryEffect: (
write: () => Promise<unknown>,
context: OperationContext,
) => Effect.Effect<unknown, ScheduleReconciliationFailure, never>;
schedule-reconciliation.ts
NativeOwnedScheduleRecord
Signature
declare const NativeOwnedScheduleRecord: NativeOwnedScheduleRecord;
NativeScheduleService
Signature
declare const NativeScheduleService: typeof NativeScheduleService;
ScheduleReconciliationFailure
Signature
declare const ScheduleReconciliationFailure: typeof ScheduleReconciliationFailure;
ScheduleReconciliationOptions
Signature
declare const ScheduleReconciliationOptions: ScheduleReconciliationOptions;
ScheduleReconciliationResult
Signature
declare const ScheduleReconciliationResult: ScheduleReconciliationResult;
nativeScheduleLayer
Signature
declare const nativeScheduleLayer: (
native: NativeScheduleOperations,
) => Layer<NativeScheduleService, never, never>;
reconcileNativeSchedules
Promise compatibility reconciler.
Throws
The original native, validation, or ownership error.
Example
await reconcileNativeSchedules(options);
Signature
declare const reconcileNativeSchedules: (
options: ScheduleReconciliationOptions,
) => Promise<ScheduleReconciliationResult>;
reconcileNativeSchedulesEffect
Reconciles owned schedules with ordered native writes in Effect.
Example
Effect.runPromise(
Effect.provide(reconcileNativeSchedulesEffect(options), nativeScheduleLayer(native)),
);
Signature
declare const reconcileNativeSchedulesEffect: (
options: Omit<ScheduleReconciliationOptions, "native">,
) => Effect.Effect<
Readonly<{ upserted: Array<string>; deleted: Array<string>; preserved: Array<string> }>,
ScheduleReconciliationFailure,
NativeScheduleService
>;
scheduleOperationId
Signature
declare const scheduleOperationId: (
options: Pick<ScheduleReconciliationOptions, "context" | "jobId" | "buildId">,
scheduleId: string,
) => string;
scheduleOperationIdEffect
Signature
declare const scheduleOperationIdEffect: (
options: Pick<ScheduleReconciliationOptions, "jobId" | "context" | "buildId">,
scheduleId: string,
) => Effect.Effect<string, JobIdentityError, never>;
scheduleOwner
Signature
declare const scheduleOwner: (
options: Pick<ScheduleReconciliationOptions, "context" | "jobId">,
) => string;
scheduleOwnerEffect
Signature
declare const scheduleOwnerEffect: (
options: Pick<ScheduleReconciliationOptions, "jobId" | "context">,
) => Effect.Effect<string, JobIdentityError, never>;
schedule-reconciliation.types.ts
NativeOwnedScheduleRecord (interface)
Native schedule visible to reconciliation, including ownership metadata.
Signature
export interface NativeOwnedScheduleRecord {
readonly id: string;
readonly state?: "active" | "paused" | "missing" | "unknown";
readonly definition?: ScheduleDefinition;
readonly metadata?: Readonly<Record<string, unknown>>;
}
ScheduleReconciliationOptions (interface)
Existing Promise API options, including the native provider.
Signature
export interface ScheduleReconciliationOptions {
readonly native: NativeScheduleOperations;
readonly desired: readonly ScheduleDefinition[];
readonly existing?: readonly NativeOwnedScheduleRecord[];
readonly context: OperationContext;
readonly jobId: string;
readonly taskId?: string;
readonly taskVersion?: string;
readonly buildId: string;
readonly workerReady?: (() => Promise<void>) | undefined;
}
ScheduleReconciliationResult (interface)
Ordered changes made by a reconciliation pass.
Signature
export interface ScheduleReconciliationResult {
readonly upserted: readonly string[];
readonly deleted: readonly string[];
readonly preserved: readonly string[];
}
schedule-validation.ts
ScheduleValidationError (class)
Invalid authored schedule definitions.
Example
if (error instanceof ScheduleValidationError) console.log(error.message);
Signature
declare class ScheduleValidationError
ScheduleValidationOptions
Signature
declare const ScheduleValidationOptions: ScheduleValidationOptions;
copySchedules
Synchronous schedule validation adapter.
Throws
TypeError when a schedule is invalid.
Example
copySchedules([{ id: "hourly", every: "1 hour", input: null }]);
Signature
declare const copySchedules: <CanonicalInput>(
value: unknown,
options?: ScheduleValidationOptions,
) => readonly ScheduleDefinition<CanonicalInput>[] | undefined;
copySchedulesEffect
Copies and validates authored schedules in Effect.
Example
Effect.runSync(copySchedulesEffect([{ id: "hourly", every: "1 hour", input: null }]));
Signature
declare const copySchedulesEffect: <CanonicalInput>(
value: unknown,
options?: ScheduleValidationOptions | undefined,
) => Effect.Effect<
ReadonlyArray<ScheduleDefinition<CanonicalInput>> | undefined,
ScheduleValidationError,
never
>;
schedule-validation.types.ts
ScheduleValidationOptions (interface)
Schemas used to validate and canonicalize authored schedule input.
Signature
export interface ScheduleValidationOptions {
readonly callerSchema?: StandardSchemaV1;
readonly canonicalSchema?: StandardSchemaV1;
}
schedule.types.ts
JobScheduleClient (interface)
Read and write operations available for a job’s schedules.
Signature
export interface JobScheduleClient<Definition = ScheduleDefinition> {
readonly list: (options?: ScheduleListOptions) => Promise<ScheduleReadReceipt<Definition>>;
readonly get: (
id: string,
options?: { readonly signal?: AbortSignal },
) => Promise<ScheduleReadReceipt<Definition>>;
readonly upsert: (
definition: Definition,
options: ScheduleWriteOptions,
) => Promise<ScheduleWriteReceipt<Definition>>;
readonly pause: (
id: string,
options: ScheduleWriteOptions,
) => Promise<ScheduleWriteReceipt<Definition>>;
readonly resume: (
id: string,
options: ScheduleWriteOptions,
) => Promise<ScheduleWriteReceipt<Definition>>;
readonly delete: (
id: string,
options: ScheduleWriteOptions,
) => Promise<ScheduleWriteReceipt<Definition>>;
}
ScheduleDefinition (type alias)
Authored schedule target, timing, and admission policy.
Signature
type ScheduleDefinition<Input = unknown> = {
readonly id: string;
readonly input: Input;
readonly overlap?: ScheduleOverlap;
readonly misfire?: ScheduleMisfire;
} & (
| { readonly cron: string; readonly timezone: string; readonly every?: never }
| { readonly every: DurationInput; readonly cron?: never; readonly timezone?: never }
);
ScheduleListOptions (interface)
Options accepted for schedule list operations.
Signature
export interface ScheduleListOptions {
readonly limit?: number;
readonly cursor?: string;
readonly signal?: AbortSignal;
}
ScheduleMisfire (type alias)
How missed occurrences are handled after downtime.
Signature
type ScheduleMisfire = "skip" | "latest" | "all";
ScheduleOverlap (type alias)
Whether simultaneous occurrences are skipped or allowed.
Signature
type ScheduleOverlap = "allow" | "skip";
ScheduleReadReceipt (interface)
Receipt returned after a schedule read operation.
Signature
export interface ScheduleReadReceipt<Definition = ScheduleDefinition> {
readonly outcome: "available" | "unavailable";
readonly schedule?: ScheduleRecord<Definition>;
readonly schedules?: readonly ScheduleRecord<Definition>[];
readonly nextCursor?: string;
readonly hasMore?: boolean;
readonly reason?: string;
}
ScheduleRecord (interface)
Provider read model for a persisted schedule.
Signature
export interface ScheduleRecord<Definition = ScheduleDefinition> {
readonly id: string;
readonly jobId: string;
readonly state: "active" | "paused" | "missing" | "unknown";
readonly definition: Definition;
readonly observedAt?: string;
}
ScheduleWriteOptions (interface)
Options accepted for schedule write operations.
Signature
export interface ScheduleWriteOptions {
readonly operationId: string;
readonly signal?: AbortSignal;
}
ScheduleWriteOutcome (type alias)
Result category for a native schedule mutation.
Signature
type ScheduleWriteOutcome =
"created" | "updated" | "paused" | "resumed" | "deleted" | "requested" | "unsupported";
ScheduleWriteReceipt (type alias)
Receipt returned after a schedule write operation.
Signature
type ScheduleWriteReceipt<Definition = ScheduleDefinition> =
| {
readonly operationId: string;
readonly scheduleId: string;
readonly outcome: ScheduleWriteOutcome;
readonly schedule?: ScheduleRecord<Definition>;
}
| (JobUnknownOutcome & { readonly scheduleId: string });
server-manifest.ts
JobsManifestReader (class)
Substitutable manifest file reader.
Example
Effect.provide(readJobsManifestEffect(config), JobsManifestReaderLive);
Signature
declare class JobsManifestReader
JobsManifestReaderLive
Live UTF-8 reader backed by Node’s file system.
Example
Effect.provide(readJobsManifestEffect(config), JobsManifestReaderLive);
Signature
declare const JobsManifestReaderLive: Layer.Layer<JobsManifestReader, never, never>;
JobsServerError (class)
A typed file, manifest, runtime, or callback failure.
Example
new JobsServerError({ operation: "readManifest", cause: new Error("missing") });
Signature
declare class JobsServerError
readJobsManifestEffect
Reads and validates the optional generated jobs manifest.
Example
Effect.provide(readJobsManifestEffect({ projectRoot: "." }), JobsManifestReaderLive);
Signature
declare const readJobsManifestEffect: (
config: RunWithJobsConfig,
) => Effect.Effect<Readonly<JobsManifestLike> | undefined, JobsServerError, JobsManifestReader>;
server.ts
JobsManifestReader
Signature
declare const JobsManifestReader: typeof JobsManifestReader;
JobsManifestReaderLive
Signature
declare const JobsManifestReaderLive: Layer<JobsManifestReader, never, never>;
JobsServerError
Signature
declare const JobsServerError: typeof JobsServerError;
RunResultOptions
Signature
declare const RunResultOptions: RunResultOptions;
RunWithJobsConfig
Signature
declare const RunWithJobsConfig: RunWithJobsConfig;
ServerTriggerOptions
Signature
declare const ServerTriggerOptions: ServerTriggerOptions;
TriggerOptions
Signature
declare const TriggerOptions: TriggerOptions;
runWithJobs
Promise compatibility adapter for server invocation.
Throws
The original manifest, runtime, callback, or close error.
Example
await runWithJobs({ projectRoot: "." }, () => "ok");
Signature
declare const runWithJobs: <A>(
config: RunWithJobsConfig,
callback: () => A | PromiseLike<A>,
) => Promise<Awaited<A>>;
runWithJobsEffect
Runs a server callback inside an owned or borrowed jobs runtime. An owned runtime closes after success, typed failure, or interruption.
Example
Effect.provide(
runWithJobsEffect({ projectRoot: "." }, () => "ok"),
JobsManifestReaderLive,
);
Signature
declare const runWithJobsEffect: <A>(
config: RunWithJobsConfig,
callback: () => A | PromiseLike<A>,
) => Effect.Effect<A, JobsServerError, JobsManifestReader>;
server.types.ts
JobsManifestLike
Signature
declare const JobsManifestLike: JobsManifestLike;
JobsManifestReaderService (interface)
Injectable file reader for manifest loading.
Example
const reader: JobsManifestReaderService = { read: () => Effect.succeed("{}") };
Signature
export interface JobsManifestReaderService {
/** Reads UTF-8 manifest data.
* @param path - Resolved manifest path.
* @returns File contents or JobsServerError.
* @example reader.read("/project/.relkit/generated/jobs.manifest.json");
*/
readonly read: (path: string) => Effect.Effect<string, JobsServerError>;
}
JobsRuntimeOptions
Signature
declare const JobsRuntimeOptions: JobsRuntimeOptions;
RunWithJobsConfig (interface)
Options for a server invocation with a jobs runtime. The caller retains ownership when runtime is supplied.
Example
const config: RunWithJobsConfig = { projectRoot: process.cwd() };
Signature
export interface RunWithJobsConfig {
readonly projectRoot: string;
readonly environment?: string;
readonly manifestPath?: string;
readonly runtime?: JobsRuntime;
readonly adapter?: unknown;
readonly provider?: unknown;
readonly providerHandle?: { readonly value: unknown };
readonly application?: string;
readonly scope?: string;
readonly service?: string;
readonly serviceGeneration?: string;
readonly capabilities?: JobsRuntimeOptions["capabilities"];
readonly jobs?: JobsRuntimeOptions["jobs"];
readonly taskExecutor?: JobsRuntimeOptions["taskExecutor"];
}
service-options-validation.ts
JobsServiceOptionsError (class)
Invalid authored jobs service options.
Example
if (error instanceof JobsServiceOptionsError) console.log(error.message);
Signature
declare class JobsServiceOptionsError
validateJobsServiceOptions
Synchronously validates jobs service options.
Throws
TypeError when any option is invalid.
Example
validateJobsServiceOptions({});
Signature
declare const validateJobsServiceOptions: (value: JobsServiceOptions | undefined) => void;
validateJobsServiceOptionsEffect
Validates jobs service limits, durations, and worker classes in Effect.
Example
Effect.runSync(validateJobsServiceOptionsEffect({}));
Signature
declare const validateJobsServiceOptionsEffect: (
value: JobsServiceOptions | undefined,
) => Effect.Effect<void, JobsServiceOptionsError, never>;
service-options.ts
JobsServiceBehavior
Signature
declare const JobsServiceBehavior: Readonly<Record<string, JsonValue>>;
JobsServiceOptionName
Signature
declare const JobsServiceOptionName: JobsServiceOptionName;
JobsServiceOptions
Signature
declare const JobsServiceOptions: JobsServiceOptions;
JobsServiceOptionsError
Signature
declare const JobsServiceOptionsError: typeof JobsServiceOptionsError;
assertSupportedJobsServiceOptions
Synchronously checks a provider’s supported option names.
Throws
Error with the unsupported option name.
Example
assertSupportedJobsServiceOptions({}, []);
Signature
declare const assertSupportedJobsServiceOptions: (
value: JobsServiceOptions,
supported: readonly JobsServiceOptionName[],
) => void;
assertSupportedJobsServiceOptionsEffect
Checks a provider’s supported service option names in Effect.
Example
Effect.runSync(assertSupportedJobsServiceOptionsEffect({}, []));
Signature
declare const assertSupportedJobsServiceOptionsEffect: (
value: JobsServiceOptions,
supported: ReadonlyArray<JobsServiceOptionName>,
) => Effect.Effect<undefined, JobsServiceOptionsError, never>;
deserializeJobsServiceOptions
Synchronously reads common options from stored service behavior.
Throws
TypeError when the record or an option is invalid.
Example
deserializeJobsServiceOptions({});
Signature
declare const deserializeJobsServiceOptions: (value: unknown) => JobsServiceOptions;
deserializeJobsServiceOptionsEffect
Parses common options from a stored service behavior record.
Example
Effect.runSync(deserializeJobsServiceOptionsEffect({}));
Signature
declare const deserializeJobsServiceOptionsEffect: (
value: unknown,
) => Effect.Effect<Readonly<JobsServiceOptions>, JobsServiceOptionsError, never>;
serializeJobsServiceOptions
Synchronously serializes service options.
Throws
TypeError when a field is not JSON.
Example
serializeJobsServiceOptions({}, undefined);
Signature
declare const serializeJobsServiceOptions: (
value: JobsServiceOptions | undefined,
native: JsonValue | undefined,
) => Readonly<Record<string, JsonValue>>;
serializeJobsServiceOptionsEffect
Serializes validated service options into a provider neutral record.
Example
Effect.runSync(serializeJobsServiceOptionsEffect({}, undefined));
Signature
declare const serializeJobsServiceOptionsEffect: (
value: JobsServiceOptions | undefined,
native: JsonValue | undefined,
) => Effect.Effect<Readonly<Record<string, JsonValue>>, JobsServiceOptionsError, never>;
validateJobsServiceOptions
Signature
declare const validateJobsServiceOptions: (value: JobsServiceOptions | undefined) => void;
validateJobsServiceOptionsEffect
Signature
declare const validateJobsServiceOptionsEffect: (
value: JobsServiceOptions | undefined,
) => Effect.Effect<void, JobsServiceOptionsError, never>;
service-options.types.ts
JobsServiceBehavior (type alias)
JSON configuration passed to a jobs service provider.
Signature
type JobsServiceBehavior = Readonly<Record<string, JsonValue>>;
JobsServiceOptionName (type alias)
Recognized top-level jobs service configuration keys.
Signature
type JobsServiceOptionName =
"limits" | "workers" | "observation" | "maxElapsed" | "hookTimeout" | "shutdownGrace";
JobsServiceOptions (interface)
Options accepted for jobs service operations.
Signature
export interface JobsServiceOptions {
readonly limits?: {
readonly inputBytes?: number;
readonly outputBytes?: number;
readonly progressItemBytes?: number;
readonly streamItemBytes?: number;
};
readonly workers?: {
readonly classes: readonly {
readonly id: string;
readonly cpu: number;
readonly memory: MemoryInput;
readonly nativeClass?: string;
}[];
};
readonly observation?: {
readonly pollInterval?: DurationInput;
readonly readTimeout?: DurationInput;
};
readonly maxElapsed?: DurationInput;
readonly hookTimeout?: DurationInput;
readonly shutdownGrace?: DurationInput;
}
submission-admission.ts
AdmissionIdentity (class)
Substitutable operation ID generator for admitted submissions.
Example
const service = yield * AdmissionIdentity;
Signature
declare class AdmissionIdentity
admissionIdentityLayer
Provides deterministic admission operation IDs.
Example
admissionIdentityLayer(() => "operation-1");
Signature
declare const admissionIdentityLayer: (
next: () => string,
) => Layer.Layer<AdmissionIdentity, never, never>;
boundedKey
Signature
declare const boundedKey: (value: string) => string;
prepareAdmission
Promise compatibility admission preparation.
Throws
Original binding, validation, or hashing error.
Example
await prepareAdmission(runtime, task, wire, copied);
Signature
declare const prepareAdmission: (
runtime: JobsRuntime,
task: TaskDescriptorAny,
wire: JobWireEnvelope,
copied: ReturnType<typeof copyTriggerOptions>,
job?: JobDescriptorAny,
) => Promise<SubmissionAdmission>;
prepareAdmissionEffect
Prepares binding, identity, scheduling, and input hash in Effect.
Example
Effect.runPromise(prepareAdmissionEffect(runtime, task, wire, copied));
Signature
declare const prepareAdmissionEffect: (
runtime: JobsRuntime,
task: TaskDescriptorAny,
wire: JobWireEnvelope,
copied: CopiedTriggerOptions,
job?: JobDescriptorAny | undefined,
) => Effect.Effect<
Readonly<{
binding: JobsRuntimeBinding;
input: JsonValue;
canonicalInput: JsonValue | undefined;
inputHash: string;
metadata: TaskSubmissionMetadata;
job?: JobDescriptorAny;
task: TaskDescriptorAny;
}>,
JobSubmissionPipelineFailure,
never
>;
submission-canonical.ts
submitCanonicalTask
Promise compatibility adapter for canonical submission.
Throws
The original validation, cancellation, or provider error.
Example
await submitCanonicalTask(runtime, task, options);
Signature
declare const submitCanonicalTask: (
runtime: JobsRuntime,
task: TaskDescriptorAny,
options: CanonicalTaskSubmissionOptions,
) => Promise<import("@relkit/contracts/jobs").RunHandle>;
submitCanonicalTaskEffect
Submits an already canonical task input in Effect.
Example
Effect.runPromise(submitCanonicalTaskEffect(runtime, task, options));
Signature
declare const submitCanonicalTaskEffect: (
runtime: JobsRuntime,
task: TaskDescriptorAny,
options: CanonicalTaskSubmissionOptions,
) => Effect.Effect<RunHandle, JobSubmissionPipelineFailure, never>;
submission-errors.ts
JobReceiptError (class)
A native accepted receipt failed durable identity validation.
Example
new JobReceiptError("Receipt is missing run ID");
Signature
declare class JobReceiptError {
constructor(message: string);
}
code (property)
Signature
readonly code: "RELKIT_JOB_RECEIPT_INVALID"
JobSubmissionCancelledError (class)
Caller cancellation happened before native acceptance began.
Example
new JobSubmissionCancelledError();
Signature
declare class JobSubmissionCancelledError {
constructor();
}
code (property)
Signature
readonly code: "RELKIT_JOB_SUBMISSION_CANCELLED"
JobSubmissionError (class)
A canonical job submission could not be accepted.
Example
new JobSubmissionError("Input hash mismatch");
Signature
declare class JobSubmissionError { constructor(
message: string,
readonly cause?: unknown,
) }
code (property)
Signature
readonly code: "RELKIT_JOB_SUBMISSION_FAILED"
JobSubmissionUnknownError (class)
Native acceptance may have committed and needs idempotent recovery.
Example
new JobSubmissionUnknownError("submit-1", "same-key");
Signature
declare class JobSubmissionUnknownError { constructor(
readonly operationId: string,
readonly idempotencyKey: string | undefined,
recovery: JobUnknownOutcome["recovery"] = { action: "inspect-native" },
) }
toJSON (method)
Serializes the bounded recovery contract for callers.
Example
error.toJSON();
Signature
declare const toJSON: () => JobUnknownOutcome;
code (property)
Signature
readonly code: "RELKIT_JOB_SUBMISSION_UNKNOWN"
outcome (property)
Signature
readonly outcome: "unknown"
recovery (property)
Signature
readonly recovery: { readonly action: "retry-with-same-key" | "inspect-native" | "unavailable"; readonly expiresAt?: string; }
submission-failure.ts
JobSubmissionPipelineFailure (class)
Expected failure at the jobs submission pipeline boundary.
Example
if (error instanceof JobSubmissionPipelineFailure) console.log(error.message);
Signature
declare class JobSubmissionPipelineFailure
submission-pipeline.ts
createSubmissionPipeline
Synchronous facade factory for the jobs submission pipeline.
Example
createSubmissionPipeline(runtime);
Signature
declare const createSubmissionPipeline: (runtime: JobsRuntime) => SubmissionPipeline;
createSubmissionPipelineEffect
Builds a task and job submission facade in Effect.
Example
Effect.runSync(createSubmissionPipelineEffect(runtime));
Signature
declare const createSubmissionPipelineEffect: (
runtime: JobsRuntime,
) => Effect.Effect<SubmissionPipeline, never, never>;
submitJob
Promise compatibility job submission.
Throws
The original capability, validation, cancellation, or provider error.
Example
await submitJob(job, "hello", {}, runtime);
Signature
declare const submitJob: (
job: JobDescriptorAny,
input: unknown,
options?: unknown,
runtime?: JobsRuntime,
) => Promise<RunHandle>;
submitJobEffect
Submits an authored job in Effect.
Example
Effect.runPromise(submitJobEffect(job, "hello", {}, runtime));
Signature
declare const submitJobEffect: (
job: JobDescriptorAny,
input: unknown,
options: unknown,
runtime: JobsRuntime,
) => Effect.Effect<RunHandle, JobSubmissionPipelineFailure, never>;
submitTask
Promise compatibility task submission.
Throws
The original capability, validation, cancellation, or provider error.
Example
await submitTask(task, "hello", {}, runtime);
Signature
declare const submitTask: (
task: TaskDescriptorAny,
input: unknown,
options?: unknown,
runtime?: JobsRuntime,
) => Promise<RunHandle>;
submitTaskEffect
Submits an authored task in Effect.
Example
Effect.runPromise(submitTaskEffect(task, "hello", {}, runtime));
Signature
declare const submitTaskEffect: (
task: TaskDescriptorAny,
input: unknown,
options: unknown,
runtime: JobsRuntime,
) => Effect.Effect<RunHandle, JobSubmissionPipelineFailure, never>;
submission-prepare.ts
prepareCanonicalSubmission
Promise compatibility adapter for canonical admission.
Throws
The original trigger or preparation error.
Example
await prepareCanonicalSubmission(runtime, task, wire);
Signature
declare const prepareCanonicalSubmission: (
runtime: JobsRuntime,
task: TaskDescriptorAny,
canonicalInput: ReturnType<typeof encodeJobWire>,
options?: unknown,
job?: JobDescriptorAny,
) => Promise<SubmissionAdmission>;
prepareCanonicalSubmissionEffect
Builds an admission from already canonical input in Effect.
Example
Effect.runPromise(prepareCanonicalSubmissionEffect(runtime, task, wire));
Signature
declare const prepareCanonicalSubmissionEffect: (
runtime: JobsRuntime,
task: TaskDescriptorAny,
canonicalInput: JobWireEnvelope,
options?: unknown,
job?: JobDescriptorAny | undefined,
) => Effect.Effect<
Readonly<{
binding: JobsRuntimeBinding;
input: JsonValue;
canonicalInput: JsonValue | undefined;
inputHash: string;
metadata: TaskSubmissionMetadata;
job?: JobDescriptorAny;
task: TaskDescriptorAny;
}>,
JobSubmissionPipelineFailure,
never
>;
prepareSubmission
Promise compatibility adapter for authored input admission.
Throws
The original validation or preparation error.
Example
await prepareSubmission(runtime, task, "hello");
Signature
declare const prepareSubmission: (
runtime: JobsRuntime,
task: TaskDescriptorAny,
input: unknown,
options?: unknown,
job?: JobDescriptorAny,
) => Promise<SubmissionAdmission>;
prepareSubmissionEffect
Validates authored input and builds a durable admission in Effect.
Example
Effect.runPromise(prepareSubmissionEffect(runtime, task, "hello"));
Signature
declare const prepareSubmissionEffect: (
runtime: JobsRuntime,
task: TaskDescriptorAny,
input: unknown,
options?: unknown,
job?: JobDescriptorAny | undefined,
) => Effect.Effect<
Readonly<{
binding: JobsRuntimeBinding;
input: JsonValue;
canonicalInput: JsonValue | undefined;
inputHash: string;
metadata: TaskSubmissionMetadata;
job?: JobDescriptorAny;
task: TaskDescriptorAny;
}>,
JobSubmissionPipelineFailure,
never
>;
submission-prepared.ts
submitPreparedSubmission
Promise compatibility prepared submission.
Throws
Original capability, cancellation, or provider error.
Example
await submitPreparedSubmission(runtime, admission);
Signature
declare const submitPreparedSubmission: (
runtime: JobsRuntime,
admission: SubmissionAdmission,
signal?: AbortSignal,
) => Promise<RunHandle>;
submitPreparedSubmissionEffect
Submits prepared canonical input in Effect.
Example
Effect.runPromise(submitPreparedSubmissionEffect(runtime, admission));
Signature
declare const submitPreparedSubmissionEffect: (
runtime: JobsRuntime,
admission: SubmissionAdmission,
signal?: any,
) => Effect.Effect<RunHandle, JobSubmissionPipelineFailure, never>;
submission-support-hash.ts
SubmissionDigest (class)
Substitutable SHA-256 digest provider for canonical submission input.
Example
const service = yield * SubmissionDigest;
Signature
declare class SubmissionDigest
hashWire
Promise compatibility canonical wire hasher.
Throws
Original canonical JSON or digest error.
Example
await hashWire({ version: 1, kind: "void" });
Signature
declare const hashWire: (value: unknown) => Promise<string>;
hashWireEffect
Hashes a canonical wire envelope in Effect.
Example
Effect.runPromise(hashWireEffect({ version: 1, kind: "void" }));
Signature
declare const hashWireEffect: (
value: unknown,
) => Effect.Effect<string, SubmissionSupportFailure, never>;
submissionDigestLayer
Provides a deterministic SHA-256 digest implementation.
Example
submissionDigestLayer(async () => new ArrayBuffer(32));
Signature
declare const submissionDigestLayer: (
digest: (bytes: Uint8Array) => Promise<ArrayBuffer>,
) => Layer.Layer<SubmissionDigest, never, never>;
submission-support-identity.ts
boundedKey
Synchronous bounded idempotency key.
Throws
TypeError when over 256 UTF-8 bytes.
Example
boundedKey("order-1");
Signature
declare const boundedKey: (value: string) => string;
boundedKeyEffect
Checks an idempotency key’s encoded byte limit in Effect.
Example
Effect.runSync(boundedKeyEffect("order-1"));
Signature
declare const boundedKeyEffect: (
value: string,
) => Effect.Effect<string, SubmissionSupportFailure, never>;
currentCorrelation
Synchronous request correlation reader.
Example
currentCorrelation();
Signature
declare const currentCorrelation: () => string | undefined;
currentCorrelationEffect
Reads request correlation from the invocation scope in Effect.
Example
Effect.runSync(currentCorrelationEffect());
Signature
declare const currentCorrelationEffect: () => Effect.Effect<
string | undefined,
SubmissionSupportFailure,
never
>;
currentTaskRunId
Synchronous current parent task run id reader.
Example
currentTaskRunId();
Signature
declare const currentTaskRunId: () => string | undefined;
currentTaskRunIdEffect
Reads the current parent task run id in Effect.
Example
Effect.runSync(currentTaskRunIdEffect());
Signature
declare const currentTaskRunIdEffect: () => Effect.Effect<
string | undefined,
SubmissionSupportFailure,
never
>;
explicitOrDerivedKey
Synchronous idempotency key resolver.
Throws
TypeError for a mismatched or invalid scalar key.
Example
explicitOrDerivedKey(job, options, input);
Signature
declare const explicitOrDerivedKey: (
job: { readonly admission?: { readonly idempotency?: { readonly key?: string } } } | undefined,
options: CopiedTriggerOptions,
input: JsonValue | undefined,
) => string | undefined;
explicitOrDerivedKeyEffect
Resolves an explicit or declared input idempotency key in Effect.
Example
Effect.runSync(explicitOrDerivedKeyEffect(job, options, input));
Signature
declare const explicitOrDerivedKeyEffect: (
job: { readonly admission?: { readonly idempotency?: { readonly key?: string } } } | undefined,
options: CopiedTriggerOptions,
input: JsonValue | undefined,
) => Effect.Effect<string | undefined, SubmissionSupportFailure, never>;
propagationFor
Synchronous correlated trace propagation reader.
Example
propagationFor("request-1");
Signature
declare const propagationFor: (correlationId: string | undefined) => TracePropagation | undefined;
propagationForEffect
Extends trace propagation with request correlation in Effect.
Example
Effect.runSync(propagationForEffect("request-1"));
Signature
declare const propagationForEffect: (
correlationId: string | undefined,
) => Effect.Effect<TracePropagation | undefined, SubmissionSupportFailure, never>;
scheduledTime
Synchronous absolute scheduled time calculator.
Throws
Original invalid duration error.
Example
scheduledTime(options, Date.now());
Signature
declare const scheduledTime: (options: CopiedTriggerOptions, now: number) => string | undefined;
scheduledTimeEffect
Calculates an absolute scheduled submission time in Effect.
Example
Effect.runSync(scheduledTimeEffect(options, Date.now()));
Signature
declare const scheduledTimeEffect: (
options: CopiedTriggerOptions,
now: number,
) => Effect.Effect<string | undefined, SubmissionSupportFailure, never>;
submission-support-receipts.ts
isRecord
Synchronous nonarray record guard.
Example
isRecord({ accepted: true });
Signature
declare const isRecord: (value: unknown) => value is Record<string, unknown>;
isSubmissionRecordEffect
Tests for a nonarray submission record in Effect.
Example
Effect.runSync(isSubmissionRecordEffect({ accepted: true }));
Signature
declare const isSubmissionRecordEffect: (
value: unknown,
) => Effect.Effect<boolean, SubmissionSupportFailure, never>;
isUnknown
Synchronous uncertain submission type guard.
Example
if (isUnknown(response)) console.log(response.operationId);
Signature
declare const isUnknown: (value: unknown) => value is UnknownSubmissionOutcome;
isUnknownSubmissionEffect
Tests an uncertain native submission outcome in Effect.
Example
Effect.runSync(isUnknownSubmissionEffect(response));
Signature
declare const isUnknownSubmissionEffect: (
value: unknown,
) => Effect.Effect<boolean, SubmissionSupportFailure, never>;
normalizeReceipt
Synchronous accepted receipt normalizer.
Throws
JobReceiptError or JobSubmissionUnknownError for invalid outcomes.
Example
normalizeReceipt(receipt, binding, metadata);
Signature
declare const normalizeReceipt: (
value: NativeReceipt | unknown,
binding: JobsRuntimeBinding,
metadata: TaskSubmissionMetadata,
) => RunHandle;
normalizeReceiptEffect
Validates a native accepted receipt in Effect.
Example
Effect.runSync(normalizeReceiptEffect(receipt, binding, metadata));
Signature
declare const normalizeReceiptEffect: (
value: unknown,
binding: JobsRuntimeBinding,
metadata: TaskSubmissionMetadata,
) => Effect.Effect<RunHandle, SubmissionSupportFailure, never>;
normalizeSubmissionError
Synchronous provider error normalizer.
Throws
Original constructor defect when normalization fails.
Example
normalizeSubmissionError(cause, metadata);
Signature
declare const normalizeSubmissionError: (cause: unknown, metadata: TaskSubmissionMetadata) => Error;
normalizeSubmissionErrorEffect
Normalizes an uncertain provider error in Effect.
Example
Effect.runSync(normalizeSubmissionErrorEffect(cause, metadata));
Signature
declare const normalizeSubmissionErrorEffect: (
cause: unknown,
metadata: TaskSubmissionMetadata,
) => Effect.Effect<Error, SubmissionSupportFailure, never>;
validatedEnvelope
Synchronous canonical envelope rebuilder.
Example
validatedEnvelope(admission);
Signature
declare const validatedEnvelope: (
admission: SubmissionAdmission,
) => { version: 1; kind: "void"; value?: never } | { version: 1; kind: "json"; value: JsonValue };
validatedEnvelopeEffect
Rebuilds a validated canonical envelope in Effect.
Example
Effect.runSync(validatedEnvelopeEffect(admission));
Signature
declare const validatedEnvelopeEffect: (
admission: SubmissionAdmission,
) => Effect.Effect<
{ version: 1; kind: "void"; value?: never } | { version: 1; kind: "json"; value: JsonValue },
SubmissionSupportFailure,
never
>;
submission-support-run.ts
SubmissionSupportFailure (class)
Expected submission helper failure with its original cause.
Example
if (error instanceof SubmissionSupportFailure) console.log(error.message);
Signature
declare class SubmissionSupportFailure
runSubmissionSupport
Synchronous submission helper compatibility runner.
Throws
The original helper error on failure.
Example
runSubmissionSupport(submissionSupportEffect("submission.prepare", () => receipt));
Signature
declare const runSubmissionSupport: <A>(effect: Effect.Effect<A, SubmissionSupportFailure>) => A;
submissionSupportEffect
Runs a submission helper inside an observed Effect.
Example
submissionSupportEffect("submission.prepare", () => receipt);
Signature
declare const submissionSupportEffect: <A>(
operation: JobsOperation,
compute: () => A,
) => Effect.Effect<A, SubmissionSupportFailure, never>;
submission-support-value-context.ts
currentCorrelation
Reads the parent invocation’s correlation identity.
Example
currentCorrelation();
Signature
declare const currentCorrelation: () => string | undefined;
currentTaskRunId
Reads the current parent task run from invocation ancestry.
Example
currentTaskRunId();
Signature
declare const currentTaskRunId: () => string | undefined;
propagationFor
Extends current trace propagation with an optional correlation identity.
Example
propagationFor("request-1");
Signature
declare const propagationFor: (correlationId: string | undefined) => TracePropagation | undefined;
submission-support-value.ts
boundedKey
Checks the 256-byte idempotency key limit.
Throws
TypeError for oversized keys.
Example
boundedKey("order-1");
Signature
declare const boundedKey: (value: string) => string;
currentCorrelation
Signature
declare const currentCorrelation: () => string | undefined;
currentTaskRunId
Signature
declare const currentTaskRunId: () => string | undefined;
explicitOrDerivedKey
Resolves explicit or input-derived idempotency and checks agreement.
Throws
TypeError for mismatched or nonscalar keys.
Example
explicitOrDerivedKey(job, options, { orderId: "one" });
Signature
declare const explicitOrDerivedKey: (
job: { readonly admission?: { readonly idempotency?: { readonly key?: string } } } | undefined,
options: CopiedTriggerOptions,
input: JsonValue | undefined,
) => string | undefined;
isRecord
Tests for a nonarray provider record.
Example
isRecord({ accepted: true });
Signature
declare const isRecord: (value: unknown) => value is Record<string, unknown>;
isUnknown
Recognizes a native unknown submission response with recovery data.
Example
isUnknown(response);
Signature
declare const isUnknown: (value: unknown) => value is UnknownSubmissionOutcome;
normalizeReceipt
Validates that native acceptance matches the pinned task and job binding.
Throws
JobReceiptError or JobSubmissionUnknownError for invalid outcomes.
Example
normalizeReceipt(receipt, binding, metadata);
Signature
declare const normalizeReceipt: (
value: NativeReceipt | unknown,
binding: JobsRuntimeBinding,
metadata: TaskSubmissionMetadata,
) => RunHandle;
normalizeSubmissionError
Normalizes provider rejection and uncertain acceptance into public errors.
Example
normalizeSubmissionError(cause, metadata);
Signature
declare const normalizeSubmissionError: (cause: unknown, metadata: TaskSubmissionMetadata) => Error;
propagationFor
Signature
declare const propagationFor: (correlationId: string | undefined) => TracePropagation | undefined;
scheduledTime
Resolves a trigger’s absolute time or delay against a supplied clock.
Throws
TypeError for an invalid duration.
Example
scheduledTime({ delay: "1 second" }, 0);
Signature
declare const scheduledTime: (options: CopiedTriggerOptions, now: number) => string | undefined;
validatedEnvelope
Rebuilds a canonical wire envelope from admitted input.
Example
validatedEnvelope(admission);
Signature
declare const validatedEnvelope: (
admission: SubmissionAdmission,
) => { version: 1; kind: "void"; value?: never } | { version: 1; kind: "json"; value: JsonValue };
submission-support.ts
“./submission-support-hash.js” (namespace export)
Re-exports all named exports from the “./submission-support-hash.js” module.
Signature
export * from "./submission-support-hash.js";
“./submission-support-identity.js” (namespace export)
Re-exports all named exports from the “./submission-support-identity.js” module.
Signature
export * from "./submission-support-identity.js";
“./submission-support-receipts.js” (namespace export)
Re-exports all named exports from the “./submission-support-receipts.js” module.
Signature
export * from "./submission-support-receipts.js";
JobSubmissionWriteFailure
Signature
declare const JobSubmissionWriteFailure: typeof JobSubmissionWriteFailure;
SubmissionSupportFailure
Signature
declare const SubmissionSupportFailure: typeof SubmissionSupportFailure;
UnknownSubmissionOutcome
Signature
declare const UnknownSubmissionOutcome: UnknownSubmissionOutcome;
submitAbortable
Signature
declare const submitAbortable: (
adapter: JobsAdapterRuntime,
request: Parameters<JobsAdapterRuntime["submit"]>[0],
context: OperationContext,
signal: AbortSignal,
metadata: TaskSubmissionMetadata,
) => Promise<unknown>;
submitAbortableEffect
Signature
declare const submitAbortableEffect: (
adapter: JobsAdapterRuntime,
request: NativeSubmission,
context: OperationContext,
signal: AbortSignal,
metadata: TaskSubmissionMetadata,
) => Effect<NativeReceipt, JobSubmissionWriteFailure, never>;
submission-support.types.ts
UnknownSubmissionOutcome (type alias)
Submission response that requires recovery after an uncertain native write.
Signature
type UnknownSubmissionOutcome = JobUnknownOutcome & {
readonly recovery: JobUnknownOutcome["recovery"];
};
submission-write.ts
JobSubmissionWriteFailure (class)
Cancelled, uncertain, or provider failed native submission.
Example
if (error instanceof JobSubmissionWriteFailure) console.log(error.message);
Signature
declare class JobSubmissionWriteFailure
submitAbortable
Promise compatibility adapter for native submission.
Throws
The original cancellation, unknown outcome, or provider error.
Example
await submitAbortable(adapter, request, context, signal, metadata);
Signature
declare const submitAbortable: (
adapter: JobsAdapterRuntime,
request: Parameters<JobsAdapterRuntime["submit"]>[0],
context: OperationContext,
signal: AbortSignal,
metadata: TaskSubmissionMetadata,
) => Promise<unknown>;
submitAbortableEffect
Submits with an Effect owned abort listener and uncertain outcome semantics.
Example
Effect.runPromise(submitAbortableEffect(adapter, request, context, signal, metadata));
Signature
declare const submitAbortableEffect: (
adapter: JobsAdapterRuntime,
request: NativeSubmission,
context: OperationContext,
signal: AbortSignal,
metadata: TaskSubmissionMetadata,
) => Effect.Effect<NativeReceipt, JobSubmissionWriteFailure, never>;
submission-write.types.ts
Listener and abort state owned for one native submission.
SubmissionWriteRegistration (interface)
Listener and abort state owned for one native submission.
Signature
export interface SubmissionWriteRegistration {
readonly aborted: Promise<void>;
readonly isAborted: () => boolean;
readonly dispose: () => void;
}
submission.ts
CanonicalTaskSubmissionOptions
Signature
declare const CanonicalTaskSubmissionOptions: CanonicalTaskSubmissionOptions;
JobReceiptError
Signature
declare const JobReceiptError: typeof JobReceiptError;
JobSubmissionCancelledError
Signature
declare const JobSubmissionCancelledError: typeof JobSubmissionCancelledError;
JobSubmissionError
Signature
declare const JobSubmissionError: typeof JobSubmissionError;
JobSubmissionPipelineFailure
Signature
declare const JobSubmissionPipelineFailure: typeof JobSubmissionPipelineFailure;
JobSubmissionUnknownError
Signature
declare const JobSubmissionUnknownError: typeof JobSubmissionUnknownError;
SubmissionAdmission
Signature
declare const SubmissionAdmission: SubmissionAdmission;
SubmissionPipeline
Signature
declare const SubmissionPipeline: SubmissionPipeline;
TaskSubmissionMetadata
Signature
declare const TaskSubmissionMetadata: TaskSubmissionMetadata;
createSubmissionPipeline
Signature
declare const createSubmissionPipeline: (runtime: JobsRuntime) => SubmissionPipeline;
createSubmissionPipelineEffect
Signature
declare const createSubmissionPipelineEffect: (
runtime: JobsRuntime,
) => Effect<SubmissionPipeline, never, never>;
prepareCanonicalSubmission
Signature
declare const prepareCanonicalSubmission: (
runtime: JobsRuntime,
task: TaskDescriptorAny,
canonicalInput: ReturnType<typeof encodeJobWire>,
options?: unknown,
job?: JobDescriptorAny,
) => Promise<SubmissionAdmission>;
prepareCanonicalSubmissionEffect
Signature
declare const prepareCanonicalSubmissionEffect: (
runtime: JobsRuntime,
task: TaskDescriptorAny,
canonicalInput: JobWireEnvelope,
options?: unknown,
job?: JobDescriptorAny | undefined,
) => Effect<
Readonly<{
binding: JobsRuntimeBinding;
input: JsonValue;
canonicalInput: JsonValue | undefined;
inputHash: string;
metadata: TaskSubmissionMetadata;
job?: JobDescriptorAny;
task: TaskDescriptorAny;
}>,
JobSubmissionPipelineFailure,
never
>;
prepareSubmission
Signature
declare const prepareSubmission: (
runtime: JobsRuntime,
task: TaskDescriptorAny,
input: unknown,
options?: unknown,
job?: JobDescriptorAny,
) => Promise<SubmissionAdmission>;
prepareSubmissionEffect
Signature
declare const prepareSubmissionEffect: (
runtime: JobsRuntime,
task: TaskDescriptorAny,
input: unknown,
options?: unknown,
job?: JobDescriptorAny | undefined,
) => Effect<
Readonly<{
binding: JobsRuntimeBinding;
input: JsonValue;
canonicalInput: JsonValue | undefined;
inputHash: string;
metadata: TaskSubmissionMetadata;
job?: JobDescriptorAny;
task: TaskDescriptorAny;
}>,
JobSubmissionPipelineFailure,
never
>;
submitCanonicalTask
Signature
declare const submitCanonicalTask: (
runtime: JobsRuntime,
task: TaskDescriptorAny,
options: CanonicalTaskSubmissionOptions,
) => Promise<import("@relkit/contracts/jobs").RunHandle>;
submitCanonicalTaskEffect
Signature
declare const submitCanonicalTaskEffect: (
runtime: JobsRuntime,
task: TaskDescriptorAny,
options: CanonicalTaskSubmissionOptions,
) => Effect<RunHandle, JobSubmissionPipelineFailure, never>;
submitJob
Signature
declare const submitJob: (
job: JobDescriptorAny,
input: unknown,
options?: unknown,
runtime?: JobsRuntime,
) => Promise<RunHandle>;
submitJobEffect
Signature
declare const submitJobEffect: (
job: JobDescriptorAny,
input: unknown,
options: unknown,
runtime: JobsRuntime,
) => Effect<RunHandle, JobSubmissionPipelineFailure, never>;
submitPreparedSubmission
Signature
declare const submitPreparedSubmission: (
runtime: JobsRuntime,
admission: SubmissionAdmission,
signal?: AbortSignal,
) => Promise<RunHandle>;
submitTask
Signature
declare const submitTask: (
task: TaskDescriptorAny,
input: unknown,
options?: unknown,
runtime?: JobsRuntime,
) => Promise<RunHandle>;
submitTaskEffect
Signature
declare const submitTaskEffect: (
task: TaskDescriptorAny,
input: unknown,
options: unknown,
runtime: JobsRuntime,
) => Effect<RunHandle, JobSubmissionPipelineFailure, never>;
submission.types.ts
CanonicalTaskSubmissionOptions (interface)
Options accepted for canonical task submission operations.
Signature
export interface CanonicalTaskSubmissionOptions {
readonly canonicalInput: JobWireEnvelope;
readonly operationId: string;
readonly idempotencyKey?: string;
readonly signal?: AbortSignal;
readonly scheduledFor?: string;
readonly occurrenceIdentity?: string;
readonly acceptanceIdentity?: string;
readonly retryOfRunId?: string;
readonly inputHash?: string;
readonly inputSchemaHash?: string;
readonly job?: JobDescriptorAny;
}
SubmissionAdmission (interface)
Prepared admission identity and timing for one submission.
Signature
export interface SubmissionAdmission {
readonly task: TaskDescriptorAny;
readonly job?: JobDescriptorAny;
readonly binding: JobsRuntimeBinding;
readonly input: JsonValue;
readonly canonicalInput: JsonValue | undefined;
readonly inputHash: string;
readonly metadata: TaskSubmissionMetadata;
}
SubmissionPipeline (interface)
Validated submission stages and their prepared values.
Signature
export interface SubmissionPipeline {
readonly submitTask: (
task: TaskDescriptorAny,
input: unknown,
options?: unknown,
) => Promise<RunHandle>;
readonly submitJob: (
job: JobDescriptorAny,
input: unknown,
options?: unknown,
) => Promise<RunHandle>;
}
TaskSubmissionMetadata (interface)
Task identity, build, and tracing facts sent with a submission.
Signature
export interface TaskSubmissionMetadata {
readonly operationId: string;
readonly idempotencyKey?: string;
readonly scheduledFor?: string;
readonly tags?: readonly string[];
readonly correlationId?: string;
readonly parentRunId?: string;
readonly propagation?: TracePropagation;
readonly acceptanceIdentity?: string;
readonly occurrenceIdentity?: string;
readonly inputSchemaHash?: string;
readonly retryOfRunId?: string;
}
task-client.types.ts
InputOf (type alias)
Caller input inferred from a task or job schema.
Signature
type InputOf<T> = T extends { readonly input: infer Schema }
? Schema extends StandardSchemaV1
? InferInput<Schema>
: unknown
: unknown;
JobTriggerClients (type alias)
Named job trigger clients mapped from declared dependencies.
Signature
type JobTriggerClients<M> = {
readonly [Name in keyof NonNullable<M> & string]: TaskJobClientFor<NonNullable<M>[Name]>;
};
OutputOf (type alias)
Validated output inferred from a task or job schema.
Signature
type OutputOf<T> = T extends { readonly output: infer Schema }
? Schema extends StandardSchemaV1
? InferOutput<Schema>
: unknown
: unknown;
TaskClientFor (type alias)
Typed trigger operation for one task reference.
Signature
type TaskClientFor<T> = {
readonly trigger: (input: InputOf<T>, options?: ServerTriggerOptions) => Promise<RunHandle>;
};
TaskClients (type alias)
Named task trigger clients mapped from declared dependencies.
Signature
type TaskClients<M> = {
readonly [Name in keyof NonNullable<M> & string]: TaskClientFor<NonNullable<M>[Name]>;
};
task-context-policy.types.ts
NormalizedTaskRetryPolicy (interface)
Fully populated retry policy used by the runtime.
Signature
export interface NormalizedTaskRetryPolicy {
readonly maxAttempts: number;
readonly initialDelay: DurationInput;
readonly maxDelay: DurationInput;
readonly factor: number;
readonly jitter: "none" | "full";
}
TaskAuthContext (interface)
Session lookup supplied to a task through its auth dependency.
Signature
export interface TaskAuthContext<Session = unknown> {
readonly getSession: () => Promise<Session | null>;
}
TaskConcurrency (interface)
Limit and optional input key for task execution concurrency.
Signature
export interface TaskConcurrency<InputKey extends string = string> {
readonly limit: number;
readonly key?: InputKey;
}
TaskResources (interface)
CPU and memory resources requested for task execution.
Signature
export interface TaskResources {
readonly cpu: number;
readonly memory: MemoryInput;
}
TaskRetryPolicy (interface)
Authoring policy for task retry attempts and backoff.
Signature
export interface TaskRetryPolicy {
readonly maxAttempts: number;
readonly initialDelay?: DurationInput;
readonly maxDelay?: DurationInput;
readonly factor?: number;
readonly jitter?: "none" | "full";
}
TaskSleepOptions (interface)
Stable sleep key used when a durable task suspends.
Signature
export interface TaskSleepOptions {
readonly key: string;
}
task-core.types.ts
DurationInput
Signature
declare const DurationInput:
| `${number} second`
| `${number} seconds`
| `${number} minute`
| `${number} minutes`
| `${number} hour`
| `${number} hours`
| `${number} day`
| `${number} days`
| `${number} week`
| `${number} weeks`
| `${number} millisecond`
| `${number} milliseconds`;
InputOf
Signature
declare const InputOf: InputOf<T>;
JobDescriptorForThisTask
Signature
declare const JobDescriptorForThisTask: JobDescriptorForThisTask<Task>;
JobTriggerClients
Signature
declare const JobTriggerClients: JobTriggerClients<M>;
MemoryInput (type alias)
Human-readable MiB or GiB memory quantity for task resources.
Signature
type MemoryInput = `${number} MiB` | `${number} GiB`;
NormalizedTaskRetryPolicy
Signature
declare const NormalizedTaskRetryPolicy: NormalizedTaskRetryPolicy;
OutputOf
Signature
declare const OutputOf: OutputOf<T>;
PublishedEventName (type alias)
Event names registered for the application.
Signature
type PublishedEventName = Extract<keyof Relkit.EventRegistry, string>;
RunResultOptions
Signature
declare const RunResultOptions: RunResultOptions;
ServerTriggerOptions
Signature
declare const ServerTriggerOptions: ServerTriggerOptions;
TaskAuthContext
Signature
declare const TaskAuthContext: TaskAuthContext<Session>;
TaskClientFor
Signature
declare const TaskClientFor: TaskClientFor<T>;
TaskClients
Signature
declare const TaskClients: TaskClients<M>;
TaskConcurrency
Signature
declare const TaskConcurrency: TaskConcurrency<InputKey>;
TaskContext (type alias)
Execution context assembled from the task’s declared dependencies and capabilities.
Signature
type TaskContext<
Execution extends TaskExecution = TaskExecution,
Dependencies extends TaskDependencies = {},
ProgressSchema extends StandardSchemaV1 | undefined = undefined,
Streams extends TaskStreamSchemas = {},
Publishes extends readonly string[] = readonly [],
> = TaskContextBase<Dependencies, Publishes> &
(Execution extends "durable"
? {
readonly sleep: (duration: DurationInput, options: TaskSleepOptions) => Promise<void>;
readonly sleepUntil: (instant: string, options: TaskSleepOptions) => Promise<void>;
}
: {}) &
([ProgressSchema] extends [StandardSchemaV1]
? { readonly progress: TaskProgressEmitter<InferInput<ProgressSchema>> }
: {}) &
([keyof Streams] extends [never] ? {} : { readonly streams: TaskStreamEmitters<Streams> });
TaskContextBase (interface)
Common invocation context shared by task handlers and hooks.
Signature
export interface TaskContextBase<
Dependencies extends TaskDependencies = {},
Publishes extends readonly string[] = readonly [],
> {
readonly run: TaskRunContext;
readonly invocation: InvocationMetadata;
readonly signal: AbortSignal;
readonly env: ResolvedApplicationEnv;
readonly log: PublicLogger;
readonly trace: PublicTrace;
readonly time: PublicClock;
readonly tasks: TaskClients<Dependencies["tasks"]>;
readonly jobs: JobTriggerClients<Dependencies["jobs"]>;
readonly agents: AgentClients<Dependencies["agents"]>;
readonly buckets: BucketClients<Dependencies["buckets"]>;
readonly cache: CacheClients<Dependencies["cache"]>;
readonly events: EventClients<PublishedEventMap<Publishes>>;
readonly database: RegisteredContext<"database", Readonly<Record<string, never>>>;
readonly auth: RegisteredContext<"auth", TaskAuthContext>;
readonly constants: RegisteredContext<"constants", Readonly<Record<string, never>>>;
readonly prompts: RegisteredContext<"prompts", Readonly<Record<string, never>>>;
readonly idempotencyKey: (operation: string) => string;
}
TaskDependencies (interface)
Resources a task explicitly declares before it can be executed.
Signature
export interface TaskDependencies {
readonly tasks?: Readonly<Record<string, TaskRefAny>>;
readonly jobs?: Readonly<Record<string, JobRefAny>>;
readonly agents?: Readonly<Record<string, AgentRefAny>>;
readonly buckets?: Readonly<Record<string, BucketRefAny>>;
readonly cache?: Readonly<Record<string, CacheRefAny>>;
}
TaskExecution (type alias)
Whether a task uses durable or retryable execution.
Signature
type TaskExecution = "durable" | "retryable";
TaskHookContext (type alias)
Invocation context visible to task lifecycle hooks.
Signature
type TaskHookContext<
Dependencies extends TaskDependencies = {},
Publishes extends readonly string[] = readonly [],
> = TaskContextBase<Dependencies, Publishes>;
TaskProgressEmitter
Signature
declare const TaskProgressEmitter: TaskProgressEmitter<Value>;
TaskProgressInput
Signature
declare const TaskProgressInput: TaskProgressInput<Schema>;
TaskProgressOutput
Signature
declare const TaskProgressOutput: TaskProgressOutput<Schema>;
TaskResources
Signature
declare const TaskResources: TaskResources;
TaskRetryPolicy
Signature
declare const TaskRetryPolicy: TaskRetryPolicy;
TaskRunContext (interface)
Stable run identity and attempt metadata available to a task.
Signature
export interface TaskRunContext {
readonly runId: string;
readonly jobId: string;
readonly taskId: string;
readonly taskVersion: string;
readonly buildId: string;
readonly service: string;
readonly attempt: number;
readonly acceptedAt: string;
readonly scheduledFor?: string;
readonly parentRunId?: string;
readonly acceptanceIdentity?: string;
}
TaskSleepOptions
Signature
declare const TaskSleepOptions: TaskSleepOptions;
TaskStreamEmitter
Signature
declare const TaskStreamEmitter: TaskStreamEmitter<Value>;
TaskStreamEmitters
Signature
declare const TaskStreamEmitters: TaskStreamEmitters<Streams>;
TaskStreamFrames
Signature
declare const TaskStreamFrames: TaskStreamFrames<Streams>;
TaskStreamInput
Signature
declare const TaskStreamInput: TaskStreamInput<Schema>;
TaskStreamItem
Signature
declare const TaskStreamItem: TaskStreamItem<Schema>;
TaskStreamOutput
Signature
declare const TaskStreamOutput: TaskStreamOutput<Schema>;
TaskStreamSchemas (type alias)
Named item schemas used to validate task stream emissions.
Signature
type TaskStreamSchemas = Readonly<Record<string, StandardSchemaV1>>;
TaskTriggerOptions
Signature
declare const TaskTriggerOptions: TaskTriggerOptions<Task>;
TriggerOptions
Signature
declare const TriggerOptions: TriggerOptions;
task-definition-inference.types.ts
TaskCallerInput (type alias)
Caller-facing input alias for a task reference.
Signature
type TaskCallerInput<T extends TaskRef> = TaskInput<T>;
TaskCanonicalInput (type alias)
Parsed canonical input inferred from a task’s input schema.
Signature
type TaskCanonicalInput<T extends TaskRef> = T extends { readonly input: infer Schema }
? Schema extends StandardSchemaV1
? InferOutput<Schema>
: unknown
: unknown;
TaskInput (type alias)
Caller input inferred from a task’s input schema.
Signature
type TaskInput<T extends TaskRef> = T extends { readonly input: infer Schema }
? Schema extends StandardSchemaV1
? InferInput<Schema>
: unknown
: unknown;
TaskOutput (type alias)
Validated output inferred from a task’s output schema.
Signature
type TaskOutput<T extends TaskRef> = T extends { readonly output: infer Schema }
? Schema extends StandardSchemaV1
? InferOutput<Schema>
: unknown
: unknown;
TaskRawHandlerOutput (type alias)
Handler return value accepted by a task’s output schema.
Signature
type TaskRawHandlerOutput<T extends TaskRef> = T extends { readonly output: infer Schema }
? Schema extends StandardSchemaV1
? InferInput<Schema>
: unknown
: unknown;
TaskValidatedOutput (type alias)
Output after validation through a task’s output schema.
Signature
type TaskValidatedOutput<T extends TaskRef> = TaskOutput<T>;
task-definition-support.types.ts
TaskFailureHook (type alias)
Hook invoked after task execution fails.
Signature
type TaskFailureHook<
Dependencies extends TaskDependencies,
Publishes extends readonly string[] = readonly [],
> = (error: unknown, context: TaskHookContext<Dependencies, Publishes>) => Promise<void>;
TaskHandler (type alias)
Handler receives validated input and scoped context, then returns output or a declared failure.
Signature
type TaskHandler<
InputSchema extends StandardSchemaV1,
OutputSchema extends StandardSchemaV1,
Execution extends TaskExecution,
Dependencies extends TaskDependencies,
Errors extends readonly ErrorDescriptorAny[],
ProgressSchema extends StandardSchemaV1 | undefined,
Streams extends TaskStreamSchemas,
Publishes extends readonly string[],
> = (
input: InferOutput<InputSchema>,
context: TaskContext<Execution, Dependencies, ProgressSchema, Streams, Publishes>,
) => MaybePromise<TaskHandlerResult<InferInput<OutputSchema>, Errors>>;
TaskHandlerResult (type alias)
Allowed output and declared failure forms returned by a task handler.
Signature
type TaskHandlerResult<Output, Errors extends readonly ErrorDescriptorAny[]> =
Output | DeclaredErrorsOf<Errors> | FunctionFailure<DeclaredErrorsOf<Errors>>;
TaskLogging (interface)
Log level and fields to redact during task execution.
Signature
export interface TaskLogging {
readonly level?: "trace" | "debug" | "info" | "warn" | "error";
readonly redact?: readonly string[];
}
TaskObservation (interface)
Visibility settings for progress and named streams.
Signature
export interface TaskObservation<
Streams extends TaskStreamSchemas = TaskStreamSchemas,
ProgressSchema extends StandardSchemaV1 | undefined = StandardSchemaV1 | undefined,
> {
readonly progress?: [ProgressSchema] extends [undefined] ? never : "live" | "durable";
readonly streams?: Readonly<{ [Name in keyof Streams & string]?: "live" | "history" }>;
}
TaskStartHook (type alias)
Hook invoked before task execution begins.
Signature
type TaskStartHook<
InputSchema extends StandardSchemaV1,
Dependencies extends TaskDependencies,
Publishes extends readonly string[] = readonly [],
> = (
input: InferOutput<InputSchema>,
context: TaskHookContext<Dependencies, Publishes>,
) => Promise<void>;
TaskSuccessHook (type alias)
Hook invoked after a task completes successfully.
Signature
type TaskSuccessHook<
OutputSchema extends StandardSchemaV1,
Dependencies extends TaskDependencies,
Publishes extends readonly string[] = readonly [],
> = (
output: InferOutput<OutputSchema>,
context: TaskHookContext<Dependencies, Publishes>,
) => Promise<void>;
task-definition.types.ts
DefineTaskOptions (interface)
Authoring contract for task schemas, dependencies, hooks, and execution policy.
Signature
export interface DefineTaskOptions<
Id extends string,
Version extends string,
InputSchema extends StandardSchemaV1,
OutputSchema extends StandardSchemaV1,
Dependencies extends TaskDependencies = {},
Errors extends readonly ErrorDescriptorAny[] = readonly [],
Publishes extends readonly PublishedEventName[] = readonly [],
ProgressSchema extends StandardSchemaV1 | undefined = undefined,
Streams extends TaskStreamSchemas = {},
Execution extends TaskExecution = "durable",
> extends DescriptorMetadata {
readonly id: Id;
readonly version: Version;
readonly input: InputSchema;
readonly inputWire?: StandardSchemaV1<InferOutput<InputSchema>, InferOutput<InputSchema>>;
readonly output: OutputSchema;
readonly errors?: Errors;
readonly execution?: Execution;
readonly dependencies?: ValidTaskDependencies<Dependencies>;
readonly publishes?: Publishes;
readonly progress?: ProgressSchema;
readonly streams?: Streams;
readonly observation?: TaskObservation<Streams, ProgressSchema>;
readonly retry?: TaskRetryPolicy;
readonly resources?: TaskResources;
readonly concurrency?: TaskConcurrency<CanonicalInputKey<InputSchema>>;
readonly maxDuration?: DurationInput;
readonly maxElapsed?: DurationInput;
readonly logging?: TaskLogging;
readonly onStart?: TaskStartHook<InputSchema, Dependencies, Publishes>;
readonly onSuccess?: TaskSuccessHook<OutputSchema, Dependencies, Publishes>;
readonly onFailure?: TaskFailureHook<Dependencies, Publishes>;
readonly handler: TaskHandler<
InputSchema,
OutputSchema,
Execution,
Dependencies,
Errors,
ProgressSchema,
Streams,
Publishes
>;
}
TaskCallerInput
Signature
declare const TaskCallerInput: TaskCallerInput<T>;
TaskCanonicalInput
Signature
declare const TaskCanonicalInput: TaskCanonicalInput<T>;
TaskDescriptor (interface)
Validated task definition with an attached trigger operation.
Signature
export interface TaskDescriptor<
Id extends string,
Version extends string,
InputSchema extends StandardSchemaV1,
OutputSchema extends StandardSchemaV1,
Dependencies extends TaskDependencies = {},
Errors extends readonly ErrorDescriptorAny[] = readonly [],
Publishes extends readonly string[] = readonly [],
ProgressSchema extends StandardSchemaV1 | undefined = undefined,
Streams extends TaskStreamSchemas = {},
Execution extends TaskExecution = TaskExecution,
>
extends DescriptorBase<"task", Id>, TaskRef<Id, InputSchema, OutputSchema, Errors> {
readonly version: Version;
readonly execution: Execution;
readonly inputWire?: StandardSchemaV1<InferOutput<InputSchema>, InferOutput<InputSchema>>;
readonly dependencies?: Dependencies;
readonly publishes?: Publishes;
readonly progress?: ProgressSchema;
readonly streams?: Streams;
readonly observation?: TaskObservation<Streams, ProgressSchema>;
readonly retry: NormalizedTaskRetryPolicy;
readonly resources?: TaskResources;
readonly concurrency?: TaskConcurrency<CanonicalInputKey<InputSchema>>;
readonly maxDuration?: DurationInput;
readonly maxElapsed?: DurationInput;
readonly logging?: TaskLogging;
readonly onStart?: TaskStartHook<InputSchema, Dependencies, Publishes>;
readonly onSuccess?: TaskSuccessHook<OutputSchema, Dependencies, Publishes>;
readonly onFailure?: TaskFailureHook<Dependencies, Publishes>;
readonly handler: TaskHandler<
InputSchema,
OutputSchema,
Execution,
Dependencies,
Errors,
ProgressSchema,
Streams,
Publishes
>;
readonly trigger: (
input: InferInput<InputSchema>,
options?: TaskTriggerOptions<TaskRef<Id, InputSchema, OutputSchema, Errors>>,
) => Promise<RunHandle>;
}
TaskDescriptorAny (type alias)
Task descriptor widened for registry and runtime boundaries.
Signature
type TaskDescriptorAny = DescriptorBase<"task", string> &
TaskRef<string, StandardSchemaV1, StandardSchemaV1, readonly ErrorDescriptorAny[]> & {
readonly version: string;
readonly execution: TaskExecution;
readonly inputWire?: StandardSchemaV1 | undefined;
readonly dependencies?: TaskDependencies | undefined;
readonly publishes?: readonly string[] | undefined;
readonly progress?: StandardSchemaV1 | undefined;
readonly streams?: TaskStreamSchemas | undefined;
readonly observation?: TaskObservation | undefined;
readonly retry: NormalizedTaskRetryPolicy;
readonly resources?: TaskResources | undefined;
readonly concurrency?: TaskConcurrency | undefined;
readonly maxDuration?: DurationInput | undefined;
readonly maxElapsed?: DurationInput | undefined;
readonly logging?: TaskLogging | undefined;
readonly onStart?: (...args: never[]) => Promise<void>;
readonly onSuccess?: (...args: never[]) => Promise<void>;
readonly onFailure?: (...args: never[]) => Promise<void>;
readonly handler: (...args: never[]) => unknown;
readonly trigger: (...args: never[]) => Promise<RunHandle>;
};
TaskFailureHook
Signature
declare const TaskFailureHook: TaskFailureHook<Dependencies, Publishes>;
TaskHandler
Signature
declare const TaskHandler: TaskHandler<
InputSchema,
OutputSchema,
Execution,
Dependencies,
Errors,
ProgressSchema,
Streams,
Publishes
>;
TaskHandlerResult
Signature
declare const TaskHandlerResult: TaskHandlerResult<Output, Errors>;
TaskInput
Signature
declare const TaskInput: TaskInput<T>;
TaskLogging
Signature
declare const TaskLogging: TaskLogging;
TaskObservation
Signature
declare const TaskObservation: TaskObservation<Streams, ProgressSchema>;
TaskOutput
Signature
declare const TaskOutput: TaskOutput<T>;
TaskRawHandlerOutput
Signature
declare const TaskRawHandlerOutput: TaskRawHandlerOutput<T>;
TaskStartHook
Signature
declare const TaskStartHook: TaskStartHook<InputSchema, Dependencies, Publishes>;
TaskSuccessHook
Signature
declare const TaskSuccessHook: TaskSuccessHook<OutputSchema, Dependencies, Publishes>;
TaskValidatedOutput
Signature
declare const TaskValidatedOutput: TaskValidatedOutput<T>;
task-emission.types.ts
TaskProgressEmitter (interface)
Emitter contract for task progress items.
Signature
export interface TaskProgressEmitter<Value = unknown> {
readonly emit: (value: Value) => Promise<ProgressEmitReceipt>;
}
TaskProgressInput (type alias)
Input type inferred for task progress.
Signature
type TaskProgressInput<Schema extends StandardSchemaV1> = InferInput<Schema>;
TaskProgressOutput (type alias)
Output type inferred for task progress.
Signature
type TaskProgressOutput<Schema extends StandardSchemaV1> = InferOutput<Schema>;
TaskStreamEmitter (interface)
Emitter contract for task stream items.
Signature
export interface TaskStreamEmitter<Value = unknown> {
readonly emit: (value: Value) => Promise<ProgressEmitReceipt>;
}
TaskStreamEmitters (type alias)
Named emitters whose input types follow each declared stream schema.
Signature
type TaskStreamEmitters<Streams extends TaskStreamSchemas> = {
readonly [Name in keyof Streams & string]: TaskStreamEmitter<TaskStreamInput<Streams[Name]>>;
};
TaskStreamFrames (type alias)
Discriminated frames for all declared task streams.
Signature
type TaskStreamFrames<Streams extends TaskStreamSchemas> = {
readonly [Name in keyof Streams & string]: NamedStreamFrame<TaskStreamOutput<Streams[Name]>> & {
readonly name: Name;
};
}[keyof Streams & string];
TaskStreamInput (type alias)
Input type inferred for task stream.
Signature
type TaskStreamInput<Schema extends StandardSchemaV1> = InferInput<Schema>;
TaskStreamItem (type alias)
Validated item output inferred from a stream schema.
Signature
type TaskStreamItem<Schema extends StandardSchemaV1> = InferOutput<Schema>;
TaskStreamOutput (type alias)
Output type inferred for task stream.
Signature
type TaskStreamOutput<Schema extends StandardSchemaV1> = InferOutput<Schema>;
task-observation-validation.ts
TaskObservationError (class)
An invalid task observation declaration.
Example
new TaskObservationError({ reason: "Task observation must be an object" });
Signature
declare class TaskObservationError
copyObservation
Synchronous task observation compatibility adapter.
Throws
TypeError when the declaration contradicts task schemas.
Example
copyObservation(undefined, undefined, undefined);
Signature
declare const copyObservation: (
value: unknown,
progress: unknown,
streams: ObservationStreams,
) => TaskObservation | undefined;
copyObservationEffect
Normalizes a task’s progress and stream observation declarations in Effect.
Example
Effect.runPromise(copyObservationEffect(undefined, undefined, undefined));
Signature
declare const copyObservationEffect: (
value: unknown,
progress: unknown,
streams: ObservationStreams,
) => Effect.Effect<NormalizedObservation, TaskObservationError, never>;
task-observation-validation.types.ts
NormalizedObservation (type alias)
Normalized observation configuration.
Signature
type NormalizedObservation = TaskObservation | undefined;
ObservationStreams (type alias)
Declared schemas available to the task observation validator.
Signature
type ObservationStreams = TaskStreamSchemas | undefined;
TaskObservation
Signature
declare const TaskObservation: TaskObservation<Streams, ProgressSchema>;
TaskStreamSchemas
Signature
declare const TaskStreamSchemas: Readonly<Record<string, StandardSchemaV1<unknown, unknown>>>;
task-policy-basic.ts
assertBoundedString
Synchronous bounded string assertion.
Throws
TypeError for invalid text.
Example
assertBoundedString("tag", "Task tag");
Signature
declare const assertBoundedString: (
value: unknown,
name: string,
maxBytes?: number,
) => asserts value is string;
assertBoundedStringEffect
Checks nonempty bounded UTF-8 text in Effect.
Example
Effect.runSync(assertBoundedStringEffect("tag", "Task tag"));
Signature
declare const assertBoundedStringEffect: (
value: unknown,
name: string,
maxBytes?: any,
) => Effect.Effect<void, TaskValidationFailure, never>;
assertCanonicalScalarKey
Synchronous required canonical scalar key assertion.
Throws
TypeError for unsupported projections or fields.
Example
assertCanonicalScalarKey(schema, "tenantId", "concurrency.key");
Signature
declare const assertCanonicalScalarKey: (
schema: StandardSchemaV1,
key: string,
name: string,
) => void;
assertCanonicalScalarKeyEffect
Checks that a concurrency key is a required canonical scalar in Effect.
Example
Effect.runSync(assertCanonicalScalarKeyEffect(schema, "tenantId", "concurrency.key"));
Signature
declare const assertCanonicalScalarKeyEffect: (
schema: StandardSchemaV1<unknown, unknown>,
key: string,
name: string,
) => Effect.Effect<void, TaskValidationFailure, never>;
assertFieldName
Synchronous top-level field name assertion.
Throws
TypeError for invalid paths or expressions.
Example
assertFieldName("tenantId");
Signature
declare const assertFieldName: (value: unknown, name?: string) => asserts value is string;
assertFieldNameEffect
Checks a top-level canonical field name in Effect.
Example
Effect.runSync(assertFieldNameEffect("tenantId"));
Signature
declare const assertFieldNameEffect: (
value: unknown,
name?: any,
) => Effect.Effect<void, TaskValidationFailure, never>;
memoryBytes
Synchronous memory quantity parser.
Throws
TypeError for invalid or unsafe quantities.
Example
memoryBytes("1 GiB");
Signature
declare const memoryBytes: (value: string) => number;
memoryBytesEffect
Parses an exact MiB or GiB memory quantity in Effect.
Example
Effect.runSync(memoryBytesEffect("1 GiB"));
Signature
declare const memoryBytesEffect: (
value: string,
) => Effect.Effect<number, TaskValidationFailure, never>;
utf8Bytes
Synchronous UTF-8 byte count.
Example
utf8Bytes("hello");
Signature
declare const utf8Bytes: (value: string) => number;
utf8BytesEffect
Counts encoded UTF-8 bytes in Effect.
Example
Effect.runSync(utf8BytesEffect("hello"));
Signature
declare const utf8BytesEffect: (
value: string,
) => Effect.Effect<number, TaskValidationFailure, never>;
task-policy-copy.ts
copyConcurrency
Synchronous task concurrency copier.
Throws
TypeError for invalid concurrency settings.
Example
copyConcurrency({ limit: 2 });
Signature
declare const copyConcurrency: (
value: unknown,
canonicalSchema?: StandardSchemaV1,
) => TaskConcurrency | undefined;
copyConcurrencyEffect
Copies bounded concurrency settings in Effect.
Example
Effect.runSync(copyConcurrencyEffect({ limit: 2 }));
Signature
declare const copyConcurrencyEffect: (
value: unknown,
canonicalSchema?: StandardSchemaV1<unknown, unknown> | undefined,
) => Effect.Effect<TaskConcurrency<string> | undefined, TaskValidationFailure, never>;
copyLogging
Synchronous logging policy copier.
Throws
TypeError for invalid logging policy.
Example
copyLogging({ level: "info" });
Signature
declare const copyLogging: (value: unknown) => TaskLogging | undefined;
copyLoggingEffect
Copies bounded logging settings in Effect.
Example
Effect.runSync(copyLoggingEffect({ level: "info" }));
Signature
declare const copyLoggingEffect: (
value: unknown,
) => Effect.Effect<TaskLogging | undefined, TaskValidationFailure, never>;
copyResources
Synchronous task resource copier.
Throws
TypeError for invalid CPU or memory settings.
Example
copyResources({ cpu: 1, memory: "1 GiB" });
Signature
declare const copyResources: (value: unknown) => TaskResources | undefined;
copyResourcesEffect
Copies validated CPU and memory settings in Effect.
Example
Effect.runSync(copyResourcesEffect({ cpu: 1, memory: "1 GiB" }));
Signature
declare const copyResourcesEffect: (
value: unknown,
) => Effect.Effect<TaskResources | undefined, TaskValidationFailure, never>;
copyTaskTags
Synchronous task tag copier.
Throws
TypeError for invalid or duplicate tags.
Example
copyTaskTags(["important"]);
Signature
declare const copyTaskTags: (value: unknown) => readonly string[] | undefined;
copyTaskTagsEffect
Copies bounded unique task tags in Effect.
Example
Effect.runSync(copyTaskTagsEffect(["important"]));
Signature
declare const copyTaskTagsEffect: (
value: unknown,
) => Effect.Effect<ReadonlyArray<string> | undefined, TaskValidationFailure, never>;
task-policy-random.ts
TaskPolicyRandom (class)
Substitutable random sample source for retry jitter.
Example
const service = yield * TaskPolicyRandom;
Signature
declare class TaskPolicyRandom
retryDelayMillis
Synchronous bounded retry delay calculator.
Throws
TypeError for invalid attempts or samples.
Example
retryDelayMillis(policy, 2, 0, () => 0.5);
Signature
declare const retryDelayMillis: (
policy: NormalizedTaskRetryPolicy,
attempt: number,
retryAfterMillis?: number,
random?: () => number,
) => number;
retryDelayMillisEffect
Computes bounded retry delay in Effect using an injectable sample source.
Example
Effect.runSync(
Effect.provide(
retryDelayMillisEffect(policy, 2),
taskPolicyRandomLayer(() => 0.5),
),
);
Signature
declare const retryDelayMillisEffect: (
policy: NormalizedTaskRetryPolicy,
attempt: number,
retryAfterMillis?: any,
random?: (() => number) | undefined,
) => Effect.Effect<number, TaskValidationFailure, never>;
taskPolicyRandomLayer
Provides deterministic retry jitter samples.
Example
taskPolicyRandomLayer(() => 0.5);
Signature
declare const taskPolicyRandomLayer: (
sample: () => number,
) => Layer.Layer<TaskPolicyRandom, never, never>;
task-policy-validation.ts
“./task-policy-basic.js” (namespace export)
Re-exports all named exports from the “./task-policy-basic.js” module.
Signature
export * from "./task-policy-basic.js";
“./task-policy-copy.js” (namespace export)
Re-exports all named exports from the “./task-policy-copy.js” module.
Signature
export * from "./task-policy-copy.js";
“./task-policy-random.js” (namespace export)
Re-exports all named exports from the “./task-policy-random.js” module.
Signature
export * from "./task-policy-random.js";
TASK_INPUT_MAX_BYTES
Signature
declare const TASK_INPUT_MAX_BYTES: 1048576;
TASK_ITEM_MAX_BYTES
Signature
declare const TASK_ITEM_MAX_BYTES: number;
TASK_KEY_MAX_BYTES
Signature
declare const TASK_KEY_MAX_BYTES: 256;
TASK_MAX_TAGS
Signature
declare const TASK_MAX_TAGS: 20;
TASK_OUTPUT_MAX_BYTES
Signature
declare const TASK_OUTPUT_MAX_BYTES: 1048576;
TASK_REASON_MAX_BYTES
Signature
declare const TASK_REASON_MAX_BYTES: 1024;
task-policy-value-copy.ts
assertCanonicalScalarKey
Requires a projected required string or number field for partitioning.
Throws
TypeError for missing or unsupported schema projections.
Example
assertCanonicalScalarKey(schema, "tenantId", "concurrency.key");
Signature
declare const assertCanonicalScalarKey: (
schema: StandardSchemaV1,
key: string,
name: string,
) => void;
copyConcurrency
Validates a bounded concurrency limit and optional canonical scalar key.
Throws
TypeError for invalid limits or keys.
Example
copyConcurrency({ limit: 2, key: "tenantId" }, schema);
Signature
declare const copyConcurrency: (
value: unknown,
canonicalSchema?: StandardSchemaV1,
) => TaskConcurrency | undefined;
copyLogging
Copies logging level and unique redaction keys.
Throws
TypeError for invalid levels or redaction names.
Example
copyLogging({ level: "info", redact: ["secret"] });
Signature
declare const copyLogging: (value: unknown) => TaskLogging | undefined;
copyResources
Validates CPU and exact memory for a task resource request.
Throws
TypeError for invalid CPU or memory.
Example
copyResources({ cpu: 1, memory: "1 GiB" });
Signature
declare const copyResources: (value: unknown) => TaskResources | undefined;
copyTaskTags
Copies unique, bounded task tags into a frozen list.
Throws
TypeError for duplicates, invalid text, or excess tags.
Example
copyTaskTags(["urgent"]);
Signature
declare const copyTaskTags: (value: unknown) => readonly string[] | undefined;
task-policy-value.ts
TASK_INPUT_MAX_BYTES
Maximum canonical task input bytes.
Example
TASK_INPUT_MAX_BYTES === 1_048_576;
Signature
declare const TASK_INPUT_MAX_BYTES: 1048576;
TASK_ITEM_MAX_BYTES
Maximum progress or stream item bytes.
Example
TASK_ITEM_MAX_BYTES === 65_536;
Signature
declare const TASK_ITEM_MAX_BYTES: number;
TASK_KEY_MAX_BYTES
Maximum identifier and scalar key bytes.
Example
TASK_KEY_MAX_BYTES === 256;
Signature
declare const TASK_KEY_MAX_BYTES: 256;
TASK_MAX_TAGS
Maximum count of unique task tags.
Example
TASK_MAX_TAGS === 20;
Signature
declare const TASK_MAX_TAGS: 20;
TASK_OUTPUT_MAX_BYTES
Maximum canonical task output bytes.
Example
TASK_OUTPUT_MAX_BYTES === 1_048_576;
Signature
declare const TASK_OUTPUT_MAX_BYTES: 1048576;
TASK_REASON_MAX_BYTES
Maximum bounded reason text bytes.
Example
TASK_REASON_MAX_BYTES === 1_024;
Signature
declare const TASK_REASON_MAX_BYTES: 1024;
assertBoundedString
Requires a nonempty UTF-8 string within a configured byte limit.
Throws
TypeError for empty, nontext, or oversized values.
Example
assertBoundedString("order-1", "orderId");
Signature
declare const assertBoundedString: (
value: unknown,
name: string,
maxBytes?: number,
) => asserts value is string;
assertCanonicalScalarKey
Signature
declare const assertCanonicalScalarKey: (
schema: StandardSchemaV1,
key: string,
name: string,
) => void;
assertFieldName
Requires one top-level canonical field name rather than a path.
Throws
TypeError for invalid paths or expressions.
Example
assertFieldName("tenantId");
Signature
declare const assertFieldName: (value: unknown, name?: string) => asserts value is string;
copyConcurrency
Signature
declare const copyConcurrency: (
value: unknown,
canonicalSchema?: StandardSchemaV1,
) => TaskConcurrency | undefined;
copyLogging
Signature
declare const copyLogging: (value: unknown) => TaskLogging | undefined;
copyResources
Signature
declare const copyResources: (value: unknown) => TaskResources | undefined;
copyTaskTags
Signature
declare const copyTaskTags: (value: unknown) => readonly string[] | undefined;
memoryBytes
Parses exact decimal MiB or GiB memory into safe integer bytes.
Throws
TypeError for fractional bytes or unsafe ranges.
Example
memoryBytes("1.5 GiB");
Signature
declare const memoryBytes: (value: string) => number;
retryDelayMillis
Computes bounded task retry delay with optional jitter and retry-after floor.
Throws
TypeError for invalid attempt or jitter.
Example
retryDelayMillis(policy, 2, 0, () => 0.5);
Signature
declare const retryDelayMillis: (
policy: NormalizedTaskRetryPolicy,
attempt: number,
retryAfterMillis?: number,
random?: () => number,
) => number;
utf8Bytes
Counts UTF-8 bytes rather than JavaScript code units.
Example
utf8Bytes("é");
Signature
declare const utf8Bytes: (value: string) => number;
task-progress-emission.ts
createEmission
Builds a validated Effect emitter and its compatibility adapter.
Example
createEmission(progressSchema, options, "progress");
Signature
declare const createEmission: <S extends StandardSchemaV1>(
schema: S,
options: TaskEmitterOptions,
kind: "progress" | "stream",
) => EffectTaskEmitter<InferInput<S>>;
task-progress-error.ts
TaskEmissionError (class)
Compatibility error thrown by Promise based task emitters.
Example
if (error instanceof TaskEmissionError) console.log(error.message);
Signature
declare class TaskEmissionError { constructor(
readonly code: TaskEmissionErrorCode,
message: string,
) }
TaskEmissionFailure (class)
Expected emission failure in Effect, retaining the compatibility error.
Example
if (error instanceof TaskEmissionFailure) console.log(error.message);
Signature
declare class TaskEmissionFailure
task-progress.ts
EffectTaskEmitter
Signature
declare const EffectTaskEmitter: EffectTaskEmitter<Value>;
TaskEmissionError
Signature
declare const TaskEmissionError: typeof TaskEmissionError;
TaskEmissionErrorCode
Signature
declare const TaskEmissionErrorCode: TaskEmissionErrorCode;
TaskEmissionFailure
Signature
declare const TaskEmissionFailure: typeof TaskEmissionFailure;
TaskEmissionSink
Signature
declare const TaskEmissionSink: TaskEmissionSink;
TaskEmitterOptions
Signature
declare const TaskEmitterOptions: TaskEmitterOptions;
TaskStreamEmitterOptions
Signature
declare const TaskStreamEmitterOptions: TaskStreamEmitterOptions;
TaskStreamSink
Signature
declare const TaskStreamSink: TaskStreamSink;
createTaskProgressEmitter
Compatibility factory for validated progress emitters.
Throws
TypeError if the configured byte limit is invalid.
Example
createTaskProgressEmitter(z.string());
Signature
declare const createTaskProgressEmitter: <S extends StandardSchemaV1>(
schema: S,
options?: TaskEmitterOptions,
) => EffectTaskEmitter<InferInput<S>>;
createTaskProgressEmitterEffect
Creates a validated progress emitter in Effect.
Example
Effect.runSync(createTaskProgressEmitterEffect(z.string()));
Signature
declare const createTaskProgressEmitterEffect: <S extends StandardSchemaV1>(
schema: S,
options?: TaskEmitterOptions | undefined,
) => Effect.Effect<EffectTaskEmitter<InferInput<S>>, TaskEmissionFailure, never>;
createTaskStreamEmitter
Compatibility factory for named stream emitters.
Throws
TypeError for invalid names or byte limits.
Example
createTaskStreamEmitter(z.string(), { name: "events" });
Signature
declare const createTaskStreamEmitter: <S extends StandardSchemaV1>(
schema: S,
options: TaskStreamEmitterOptions,
) => EffectTaskEmitter<InferInput<S>>;
createTaskStreamEmitterEffect
Creates a named stream emitter in Effect.
Example
Effect.runSync(createTaskStreamEmitterEffect(z.string(), { name: "events" }));
Signature
declare const createTaskStreamEmitterEffect: <S extends StandardSchemaV1>(
schema: S,
options: TaskStreamEmitterOptions,
) => Effect.Effect<EffectTaskEmitter<InferInput<S>>, TaskEmissionFailure, never>;
task-progress.types.ts
EffectTaskEmitter (interface)
An emitter with a typed Effect operation alongside its Promise adapter.
Signature
export interface EffectTaskEmitter<Value> {
readonly emit: (value: Value) => Promise<ProgressEmitReceipt>;
readonly emitEffect: (value: Value) => Effect.Effect<ProgressEmitReceipt, TaskEmissionFailure>;
}
TaskEmissionErrorCode (type alias)
Stable compatibility error codes for task emissions.
Signature
type TaskEmissionErrorCode =
| "RELKIT_TASK_PROGRESS_INVALID"
| "RELKIT_TASK_STREAM_INVALID"
| "RELKIT_TASK_PROGRESS_TOO_LARGE"
| "RELKIT_TASK_STREAM_TOO_LARGE"
| "RELKIT_TASK_PROGRESS_PERSISTENCE"
| "RELKIT_TASK_STREAM_PERSISTENCE"
| "RELKIT_TASK_PROGRESS_RETENTION"
| "RELKIT_TASK_STREAM_RETENTION"
| "RELKIT_TASK_EMISSION_ABORTED";
TaskEmissionSink (type alias)
Sink for a validated progress item.
Signature
type TaskEmissionSink = (
value: unknown,
signal: AbortSignal,
) => MaybePromise<ProgressEmitReceipt | void>;
TaskEmitterOptions (interface)
Delivery and retention settings for a progress emitter.
Signature
export interface TaskEmitterOptions {
readonly signal?: AbortSignal;
readonly sink?: TaskEmissionSink;
readonly durable?: boolean;
readonly maxBytes?: number;
readonly generation?: string;
readonly requireGeneration?: boolean;
}
TaskStreamEmitterOptions (interface)
Delivery settings for a named stream emitter.
Signature
export interface TaskStreamEmitterOptions extends Omit<TaskEmitterOptions, "sink"> {
readonly name: string;
readonly sink?: TaskStreamSink;
}
TaskStreamSink (type alias)
Sink for a validated named stream item.
Signature
type TaskStreamSink = (
value: unknown,
signal: AbortSignal,
identity: { readonly name: string; readonly generation?: string },
) => MaybePromise<ProgressEmitReceipt | void>;
task-types.ts
“./task-core.types.js” (namespace export)
Re-exports all named exports from the “./task-core.types.js” module.
Signature
export * from "./task-core.types.js";
“./task-definition.types.js” (namespace export)
Re-exports all named exports from the “./task-definition.types.js” module.
Signature
export * from "./task-definition.types.js";
task-validation-copy.ts
copyDependencies
Synchronous dependency map copier.
Throws
TypeError for invalid dependencies.
Example
copyDependencies({ tasks: {} });
Signature
declare const copyDependencies: <Dependencies extends TaskDependencies>(
value: unknown,
) => Dependencies | undefined;
copyDependenciesEffect
Copies declared task dependencies in Effect.
Example
Effect.runSync(copyDependenciesEffect({ tasks: {} }));
Signature
declare const copyDependenciesEffect: <Dependencies extends TaskDependencies>(
value: unknown,
) => Effect.Effect<Dependencies | undefined, TaskValidationFailure, never>;
copyErrors
Synchronous task error descriptor copier.
Throws
TypeError for invalid descriptors.
Example
copyErrors([]);
Signature
declare const copyErrors: (value: unknown) => readonly ErrorDescriptorAny[] | undefined;
copyErrorsEffect
Copies declared task errors in Effect.
Example
Effect.runSync(copyErrorsEffect([]));
Signature
declare const copyErrorsEffect: (
value: unknown,
) => Effect.Effect<ReadonlyArray<ErrorDescriptorAny> | undefined, TaskValidationFailure, never>;
copyStreams
Synchronous stream schema copier.
Throws
TypeError for invalid stream names or schemas.
Example
copyStreams({ text: z.string() });
Signature
declare const copyStreams: (value: unknown) => TaskStreamSchemas | undefined;
copyStreamsEffect
Copies named task stream schemas in Effect.
Example
Effect.runSync(copyStreamsEffect({ text: z.string() }));
Signature
declare const copyStreamsEffect: (
value: unknown,
) => Effect.Effect<
Readonly<Record<string, StandardSchemaV1<unknown, unknown>>> | undefined,
TaskValidationFailure,
never
>;
duration
Synchronous task duration validator.
Throws
TypeError for invalid duration.
Example
duration("1 second", "maxDuration", true);
Signature
declare const duration: (value: unknown, name: string, positive?: boolean) => DurationInput;
normalizeRetry
Synchronous retry policy normalizer.
Throws
TypeError for invalid retry settings.
Example
normalizeRetry({ maxAttempts: 3 });
Signature
declare const normalizeRetry: (value: unknown) => NormalizedTaskRetryPolicy;
normalizeRetryEffect
Normalizes a task retry policy in Effect.
Example
Effect.runSync(normalizeRetryEffect({ maxAttempts: 3 }));
Signature
declare const normalizeRetryEffect: (
value: unknown,
) => Effect.Effect<NormalizedTaskRetryPolicy, TaskValidationFailure, never>;
taskDurationEffect
Validates a readable task duration in Effect.
Example
Effect.runSync(taskDurationEffect("1 second", "maxDuration", true));
Signature
declare const taskDurationEffect: (
value: unknown,
name: string,
positive?: any,
) => Effect.Effect<
| `${number} second`
| `${number} seconds`
| `${number} minute`
| `${number} minutes`
| `${number} hour`
| `${number} hours`
| `${number} day`
| `${number} days`
| `${number} week`
| `${number} weeks`
| `${number} millisecond`
| `${number} milliseconds`,
TaskValidationFailure,
never
>;
task-validation-run.ts
TaskValidationFailure (class)
Expected task definition validation failure with its original cause.
Example
if (error instanceof TaskValidationFailure) console.log(error.message);
Signature
declare class TaskValidationFailure
runTaskValidation
Synchronous task validation compatibility runner.
Throws
The original validation error on failure.
Example
runTaskValidation(taskValidationEffect("task.validate", () => descriptor));
Signature
declare const runTaskValidation: <A>(effect: Effect.Effect<A, TaskValidationFailure>) => A;
taskValidationEffect
Runs a task validation calculation in observed Effect.
Example
taskValidationEffect("task.validate", () => descriptor);
Signature
declare const taskValidationEffect: <A>(
operation: JobsOperation,
compute: () => A,
) => Effect.Effect<A, TaskValidationFailure, never>;
task-validation-schema.ts
assertCanonicalSchemaSupport
Synchronous canonical schema assertion.
Throws
TypeError for unsupported schema projections.
Example
assertCanonicalSchemaSupport(z.string(), "output");
Signature
declare const assertCanonicalSchemaSupport: (
schema: StandardSchemaV1,
name: string,
allowVoid?: boolean,
) => void;
assertCanonicalSchemaSupportEffect
Checks canonical schema projection in Effect.
Example
Effect.runSync(assertCanonicalSchemaSupportEffect(z.string(), "output"));
Signature
declare const assertCanonicalSchemaSupportEffect: (
schema: StandardSchemaV1<unknown, unknown>,
name: string,
allowVoid?: any,
) => Effect.Effect<void, TaskValidationFailure, never>;
assertCanonicalStreamSupport
Synchronous named stream schema assertion.
Throws
TypeError for noncanonical stream schemas.
Example
assertCanonicalStreamSupport({ text: z.string() });
Signature
declare const assertCanonicalStreamSupport: (streams: TaskStreamSchemas | undefined) => void;
assertCanonicalStreamSupportEffect
Checks each named stream schema in Effect.
Example
Effect.runSync(assertCanonicalStreamSupportEffect({ text: z.string() }));
Signature
declare const assertCanonicalStreamSupportEffect: (
streams: Readonly<Record<string, StandardSchemaV1<unknown, unknown>>> | undefined,
) => Effect.Effect<void, TaskValidationFailure, never>;
assertInputWireSupport
Synchronous task inputWire support assertion.
Throws
TypeError for noncanonical input support.
Example
assertInputWireSupport(z.string(), undefined);
Signature
declare const assertInputWireSupport: (input: StandardSchemaV1, inputWire: unknown) => void;
assertInputWireSupportEffect
Checks canonical support for input and optional inputWire in Effect.
Example
Effect.runSync(assertInputWireSupportEffect(z.string(), undefined));
Signature
declare const assertInputWireSupportEffect: (
input: StandardSchemaV1<unknown, unknown>,
inputWire: unknown,
) => Effect.Effect<void, TaskValidationFailure, never>;
assertSchema
Synchronous Standard Schema v1 assertion.
Throws
TypeError for invalid schema.
Example
assertSchema(z.string(), "Task input");
Signature
declare const assertSchema: (value: unknown, name: string) => asserts value is StandardSchemaV1;
assertSchemaEffect
Asserts Standard Schema v1 in Effect.
Example
Effect.runSync(assertSchemaEffect(z.string(), "Task input"));
Signature
declare const assertSchemaEffect: (
value: unknown,
name: string,
) => Effect.Effect<void, TaskValidationFailure, never>;
normalizeVersion
Synchronous task version normalizer.
Throws
Original invalid identifier error.
Example
normalizeVersion("v1");
Signature
declare const normalizeVersion: (value: unknown) => string;
normalizeVersionEffect
Normalizes a task version or identifier in Effect.
Example
Effect.runSync(normalizeVersionEffect("v1"));
Signature
declare const normalizeVersionEffect: (
value: unknown,
) => Effect.Effect<string, TaskValidationFailure, never>;
task-validation-value-copy.ts
copyDependencies
Copies declared task dependencies by supported kind and stable name.
Throws
TypeError for unsupported kinds or invalid references.
Example
copyDependencies({ jobs: { send: jobRef } });
Signature
declare const copyDependencies: <Dependencies extends TaskDependencies>(
value: unknown,
) => Dependencies | undefined;
copyErrors
Copies unique declared task error descriptors.
Throws
TypeError for invalid descriptors or duplicate IDs.
Example
copyErrors([notFoundError]);
Signature
declare const copyErrors: (value: unknown) => readonly ErrorDescriptorAny[] | undefined;
copyStreams
Copies named task streams with Standard Schema validators.
Throws
TypeError for invalid stream names or validators.
Example
copyStreams({ events: eventSchema });
Signature
declare const copyStreams: (value: unknown) => TaskStreamSchemas | undefined;
task-validation-value.ts
assertCanonicalSchemaSupport
Checks a schema’s faithful canonical output projection.
Throws
TypeError for transforms or missing projections.
Example
assertCanonicalSchemaSupport(outputSchema, "Task output");
Signature
declare const assertCanonicalSchemaSupport: (
schema: StandardSchemaV1,
name: string,
allowVoid?: boolean,
) => void;
assertCanonicalStreamSupport
Checks every stream item schema for canonical output support.
Throws
TypeError for unsupported stream item schemas.
Example
assertCanonicalStreamSupport({ events: eventSchema });
Signature
declare const assertCanonicalStreamSupport: (streams: TaskStreamSchemas | undefined) => void;
assertInputWireSupport
Requires transformed input to provide a canonical identity validator.
Throws
TypeError for unsupported transformations.
Example
assertInputWireSupport(inputSchema, inputWireSchema);
Signature
declare const assertInputWireSupport: (input: StandardSchemaV1, inputWire: unknown) => void;
assertSchema
Requires the Standard Schema v1 validator shape.
Throws
TypeError for missing or malformed Standard Schema fields.
Example
assertSchema(schema, "Task input");
Signature
declare const assertSchema: (value: unknown, name: string) => asserts value is StandardSchemaV1;
duration
Validates readable duration text and optional positivity.
Throws
TypeError for unreadable or nonpositive durations.
Example
duration("1 second", "timeout", true);
Signature
declare const duration: (value: unknown, name: string, positive?: boolean) => DurationInput;
normalizeRetry
Applies safe retry defaults and validates delay, factor, and jitter.
Throws
TypeError for invalid attempts or delay relationships.
Example
normalizeRetry({ maxAttempts: 5 });
Signature
declare const normalizeRetry: (value: unknown) => NormalizedTaskRetryPolicy;
normalizeVersion
Normalizes the task version to a stable identifier.
Throws
TypeError for invalid identifiers.
Example
normalizeVersion("v1");
Signature
declare const normalizeVersion: (value: unknown) => string;
task-validation.ts
“./task-validation-copy.js” (namespace export)
Re-exports all named exports from the “./task-validation-copy.js” module.
Signature
export * from "./task-validation-copy.js";
“./task-validation-schema.js” (namespace export)
Re-exports all named exports from the “./task-validation-schema.js” module.
Signature
export * from "./task-validation-schema.js";
TaskValidationFailure
Signature
declare const TaskValidationFailure: typeof TaskValidationFailure;
copyConcurrency
Signature
declare const copyConcurrency: (
value: unknown,
canonicalSchema?: StandardSchemaV1,
) => TaskConcurrency | undefined;
copyLogging
Signature
declare const copyLogging: (value: unknown) => TaskLogging | undefined;
copyObservation
Signature
declare const copyObservation: (
value: unknown,
progress: unknown,
streams: ObservationStreams,
) => TaskObservation | undefined;
copyResources
Signature
declare const copyResources: (value: unknown) => TaskResources | undefined;
task-wire-codec.ts
decodeJobWire
Synchronous validated job wire decoder.
Throws
TaskWireValidationError or TypeError for malformed input.
Example
decodeJobWire(encodeTaskInput("value"));
Signature
declare const decodeJobWire: (envelope: unknown, maxBytes?: number) => JsonValue | undefined;
decodeJobWireEffect
Decodes and validates a job wire envelope in Effect.
Example
Effect.runSync(decodeJobWireEffect(encodeTaskInput("value")));
Signature
declare const decodeJobWireEffect: (
envelope: unknown,
maxBytes?: any,
) => Effect.Effect<JsonValue | undefined, TaskWireFailure, never>;
encodeJobWire
Synchronous generic job wire encoder.
Throws
TaskWireValidationError or TypeError for invalid input.
Example
encodeJobWire({ id: 1 });
Signature
declare const encodeJobWire: (value: unknown, maxBytes?: number) => JobWireEnvelope;
encodeJobWireEffect
Encodes a generic job wire envelope in Effect.
Example
Effect.runSync(encodeJobWireEffect({ id: 1 }));
Signature
declare const encodeJobWireEffect: (
value: unknown,
maxBytes?: any,
) => Effect.Effect<JobWireEnvelope, TaskWireFailure, never>;
encodeTaskInput
Synchronous task input encoder.
Throws
TaskWireValidationError or TypeError for invalid input.
Example
encodeTaskInput({ id: 1 });
Signature
declare const encodeTaskInput: (value: unknown, maxBytes?: number) => JobWireEnvelope;
encodeTaskInputEffect
Encodes task input in Effect.
Example
Effect.runSync(encodeTaskInputEffect({ id: 1 }));
Signature
declare const encodeTaskInputEffect: (
value: unknown,
maxBytes?: any,
) => Effect.Effect<JobWireEnvelope, TaskWireFailure, never>;
encodeTaskOutput
Synchronous task output encoder.
Throws
TaskWireValidationError or TypeError for invalid output.
Example
encodeTaskOutput("done");
Signature
declare const encodeTaskOutput: (value: unknown, maxBytes?: number) => JobWireEnvelope;
encodeTaskOutputEffect
Encodes task output in Effect.
Example
Effect.runSync(encodeTaskOutputEffect("done"));
Signature
declare const encodeTaskOutputEffect: (
value: unknown,
maxBytes?: any,
) => Effect.Effect<JobWireEnvelope, TaskWireFailure, never>;
task-wire-run.ts
TaskWireFailure (class)
Expected wire operation failure with its original compatibility error.
Example
if (error instanceof TaskWireFailure) console.log(error.message);
Signature
declare class TaskWireFailure
runWirePromise
Runs an Effect wire operation for Promise compatibility.
Throws
The original wire validation error on failure.
Example
await runWirePromise(wirePromiseEffect("wire.decode", async () => decoded));
Signature
declare const runWirePromise: <A>(effect: Effect.Effect<A, TaskWireFailure>) => Promise<A>;
runWireSync
Runs an Effect wire operation for synchronous compatibility.
Throws
The original wire validation error on failure.
Example
runWireSync(wireEffect("wire.encode", () => encoded));
Signature
declare const runWireSync: <A>(effect: Effect.Effect<A, TaskWireFailure>) => A;
wireEffect
Lifts a synchronous wire operation into observed Effect.
Example
wireEffect("wire.encode", () => encoded);
Signature
declare const wireEffect: <A>(
operation: JobsOperation,
compute: () => A,
) => Effect.Effect<A, TaskWireFailure, never>;
wirePromiseEffect
Lifts an asynchronous wire operation into observed Effect.
Example
wirePromiseEffect("wire.decode", async () => decoded);
Signature
declare const wirePromiseEffect: <A>(
operation: JobsOperation,
compute: () => Promise<A>,
) => Effect.Effect<A, TaskWireFailure, never>;
task-wire-support.ts
TaskWireErrorCode
Signature
declare const TaskWireErrorCode: TaskWireErrorCode;
TaskWireValidationError (class)
Invalid canonical task wire data with a stable machine-readable code.
Example
new TaskWireValidationError("RELKIT_TASK_WIRE_INVALID", "Invalid envelope");
Signature
declare class TaskWireValidationError { constructor(
readonly code: TaskWireErrorCode,
message: string,
) }
assertByteLimit
Requires a positive safe integer wire size limit.
Throws
TypeError for zero, negative, or noninteger limits.
Example
assertByteLimit(1024);
Signature
declare const assertByteLimit: (maxBytes: number) => void;
assertEnvelope
Rejects hostile or malformed wire envelope object shapes.
Throws
TaskWireValidationError for invalid or accessor-backed envelopes.
Example
assertEnvelope({ version: 1, kind: "void" });
Signature
declare const assertEnvelope: (value: unknown) => asserts value is JobWireEnvelope;
assertSize
Enforces the encoded UTF-8 size for canonical JSON text.
Throws
TaskWireValidationError or TypeError for invalid size.
Example
assertSize("{}", 1024, "RELKIT_TASK_INPUT_TOO_LARGE", "input");
Signature
declare const assertSize: (
text: string,
maxBytes: number,
code: TaskWireErrorCode,
name: string,
) => void;
encode
Canonicalizes JSON or void data into a bounded wire envelope.
Throws
TaskWireValidationError or TypeError for invalid data or limit.
Example
encode({ id: "one" }, 1024, "RELKIT_TASK_INPUT_INVALID", "RELKIT_TASK_INPUT_TOO_LARGE", "input");
Signature
declare const encode: (
value: unknown,
maxBytes: number,
invalidCode: TaskWireErrorCode,
sizeCode: TaskWireErrorCode,
name: string,
) => JobWireEnvelope;
hasOwn
Checks an envelope’s own property without consulting its prototype.
Example
hasOwn({ kind: "void" }, "kind");
Signature
declare const hasOwn: (value: object, key: PropertyKey) => boolean;
invalidEnvelope
Fails with the stable invalid-envelope error.
Throws
TaskWireValidationError with the wire-invalid code.
Example
if (invalid) invalidEnvelope();
Signature
declare const invalidEnvelope: () => never;
message
Converts a validator rejection into a bounded diagnostic string.
Example
message(new Error("invalid"));
Signature
declare const message: (error: unknown) => string;
validateValue
Runs Standard Schema validation and retains its parsed output.
Throws
TaskWireValidationError for issues or validator rejection.
Example
await validateValue(schema, "hello", "RELKIT_TASK_INPUT_INVALID");
Signature
declare const validateValue: <S extends StandardSchemaV1>(
schema: S,
value: InferInput<S>,
code: Extract<TaskWireErrorCode, "RELKIT_TASK_INPUT_INVALID" | "RELKIT_TASK_OUTPUT_INVALID">,
) => Promise<InferOutput<S>>;
task-wire-support.types.ts
Stable codes for wire validation, identity, and size errors.
TaskWireErrorCode (type alias)
Stable codes for wire validation, identity, and size errors.
Signature
type TaskWireErrorCode =
| "RELKIT_TASK_WIRE_INVALID"
| "RELKIT_TASK_INPUT_INVALID"
| "RELKIT_TASK_OUTPUT_INVALID"
| "RELKIT_TASK_INPUT_WIRE_NON_IDENTITY"
| "RELKIT_TASK_INPUT_TOO_LARGE"
| "RELKIT_TASK_OUTPUT_TOO_LARGE";
task-wire-validation.ts
validateCanonicalInput
Promise compatibility canonical input validation.
Throws
TaskWireValidationError or TypeError for invalid input.
Example
await validateCanonicalInput(z.number(), 7);
Signature
declare const validateCanonicalInput: <S extends StandardSchemaV1>(
schema: S,
canonical: unknown,
inputWire?: StandardSchemaV1<InferOutput<S>, InferOutput<S>>,
maxBytes?: number,
) => Promise<InferOutput<S>>;
validateCanonicalInputEffect
Validates retained canonical task input in Effect.
Example
Effect.runPromise(validateCanonicalInputEffect(z.number(), 7));
Signature
declare const validateCanonicalInputEffect: <S extends StandardSchemaV1>(
schema: S,
canonical: unknown,
inputWire?: StandardSchemaV1<InferOutput<S>, InferOutput<S>> | undefined,
maxBytes?: number | undefined,
) => Effect.Effect<InferOutput<S>, TaskWireFailure, never>;
validateCanonicalOutput
Promise compatibility canonical output validation.
Throws
TaskWireValidationError or TypeError for invalid output.
Example
await validateCanonicalOutput(z.string(), "done");
Signature
declare const validateCanonicalOutput: <S extends StandardSchemaV1>(
schema: S,
canonical: unknown,
maxBytes?: number,
) => Promise<InferOutput<S>>;
validateCanonicalOutputEffect
Validates a retained canonical task output in Effect.
Example
Effect.runPromise(validateCanonicalOutputEffect(z.string(), "done"));
Signature
declare const validateCanonicalOutputEffect: <S extends StandardSchemaV1>(
schema: S,
canonical: unknown,
maxBytes?: number | undefined,
) => Effect.Effect<InferOutput<S>, TaskWireFailure, never>;
validateTaskInput
Promise compatibility input validation.
Throws
TaskWireValidationError or TypeError for invalid input.
Example
await validateTaskInput(z.string(), "value");
Signature
declare const validateTaskInput: <S extends StandardSchemaV1>(
schema: S,
input: InferInput<S>,
maxBytes?: number,
) => Promise<{ readonly value: InferOutput<S>; readonly wire: JobWireEnvelope }>;
validateTaskInputEffect
Validates and encodes submitted task input in Effect.
Example
Effect.runPromise(validateTaskInputEffect(z.string(), "value"));
Signature
declare const validateTaskInputEffect: <S extends StandardSchemaV1>(
schema: S,
input: InferInput<S>,
maxBytes?: number | undefined,
) => Effect.Effect<
{ readonly value: InferOutput<S>; readonly wire: JobWireEnvelope },
TaskWireFailure,
never
>;
validateTaskOutput
Promise compatibility output validation.
Throws
TaskWireValidationError or TypeError for invalid output.
Example
await validateTaskOutput(z.string(), "done");
Signature
declare const validateTaskOutput: <S extends StandardSchemaV1>(
schema: S,
output: InferInput<S>,
maxBytes?: number,
) => Promise<{ readonly value: InferOutput<S>; readonly wire: JobWireEnvelope }>;
validateTaskOutputEffect
Validates and encodes task output in Effect.
Example
Effect.runPromise(validateTaskOutputEffect(z.string(), "done"));
Signature
declare const validateTaskOutputEffect: <S extends StandardSchemaV1>(
schema: S,
output: InferInput<S>,
maxBytes?: number | undefined,
) => Effect.Effect<
{ readonly value: InferOutput<S>; readonly wire: JobWireEnvelope },
TaskWireFailure,
never
>;
task-wire-value-validation.ts
validateCanonicalInput
Validates retained input without changing its canonical JSON bytes.
Throws
TaskWireValidationError for schema, size, or identity failures.
Example
await validateCanonicalInput(schema, "hello");
Signature
declare const validateCanonicalInput: <S extends StandardSchemaV1>(
schema: S,
canonical: unknown,
inputWire?: StandardSchemaV1<InferOutput<S>, InferOutput<S>>,
maxBytes?: number,
) => Promise<InferOutput<S>>;
validateCanonicalOutput
Validates retained output without changing canonical JSON bytes.
Throws
TaskWireValidationError for schema, size, or identity failures.
Example
await validateCanonicalOutput(schema, "done");
Signature
declare const validateCanonicalOutput: <S extends StandardSchemaV1>(
schema: S,
canonical: unknown,
maxBytes?: number,
) => Promise<InferOutput<S>>;
validateTaskInput
Validates authored task input and constructs its canonical wire form.
Throws
TaskWireValidationError for schema or size failures.
Example
await validateTaskInput(schema, "hello");
Signature
declare const validateTaskInput: <S extends StandardSchemaV1>(
schema: S,
input: InferInput<S>,
maxBytes?: number,
) => Promise<{ readonly value: InferOutput<S>; readonly wire: JobWireEnvelope }>;
validateTaskOutput
Validates task output and constructs its canonical wire form.
Throws
TaskWireValidationError for schema or size failures.
Example
await validateTaskOutput(schema, "done");
Signature
declare const validateTaskOutput: <S extends StandardSchemaV1>(
schema: S,
output: InferInput<S>,
maxBytes?: number,
) => Promise<{ readonly value: InferOutput<S>; readonly wire: JobWireEnvelope }>;
task-wire-value.ts
TaskWireErrorCode
Signature
declare const TaskWireErrorCode: TaskWireErrorCode;
TaskWireValidationError
Signature
declare const TaskWireValidationError: typeof TaskWireValidationError;
decodeJobWire
Decodes a hostile wire envelope into immutable canonical JSON.
Throws
TaskWireValidationError for malformed or oversized envelopes.
Example
decodeJobWire({ version: 1, kind: "void" });
Signature
declare const decodeJobWire: (envelope: unknown, maxBytes?: number) => JsonValue | undefined;
encodeJobWire
Encodes a generic jobs wire value with the input byte limit.
Throws
TaskWireValidationError for invalid or oversized data.
Example
encodeJobWire({ id: "one" });
Signature
declare const encodeJobWire: (value: unknown, maxBytes?: number) => JobWireEnvelope;
encodeTaskInput
Encodes submitted task input with input-specific failure codes.
Throws
TaskWireValidationError for invalid or oversized input.
Example
encodeTaskInput("hello");
Signature
declare const encodeTaskInput: (value: unknown, maxBytes?: number) => JobWireEnvelope;
encodeTaskOutput
Encodes handler output with output-specific failure codes.
Throws
TaskWireValidationError for invalid or oversized output.
Example
encodeTaskOutput("done");
Signature
declare const encodeTaskOutput: (value: unknown, maxBytes?: number) => JobWireEnvelope;
validateCanonicalInput
Signature
declare const validateCanonicalInput: <S extends StandardSchemaV1>(
schema: S,
canonical: unknown,
inputWire?: StandardSchemaV1<InferOutput<S>, InferOutput<S>>,
maxBytes?: number,
) => Promise<InferOutput<S>>;
validateCanonicalOutput
Signature
declare const validateCanonicalOutput: <S extends StandardSchemaV1>(
schema: S,
canonical: unknown,
maxBytes?: number,
) => Promise<InferOutput<S>>;
validateTaskInput
Signature
declare const validateTaskInput: <S extends StandardSchemaV1>(
schema: S,
input: InferInput<S>,
maxBytes?: number,
) => Promise<{ readonly value: InferOutput<S>; readonly wire: JobWireEnvelope }>;
validateTaskOutput
Signature
declare const validateTaskOutput: <S extends StandardSchemaV1>(
schema: S,
output: InferInput<S>,
maxBytes?: number,
) => Promise<{ readonly value: InferOutput<S>; readonly wire: JobWireEnvelope }>;
task-wire.ts
“./task-wire-codec.js” (namespace export)
Re-exports all named exports from the “./task-wire-codec.js” module.
Signature
export * from "./task-wire-codec.js";
“./task-wire-validation.js” (namespace export)
Re-exports all named exports from the “./task-wire-validation.js” module.
Signature
export * from "./task-wire-validation.js";
TaskWireErrorCode
Signature
declare const TaskWireErrorCode: TaskWireErrorCode;
TaskWireFailure
Signature
declare const TaskWireFailure: typeof TaskWireFailure;
TaskWireValidationError
Signature
declare const TaskWireValidationError: typeof TaskWireValidationError;
trigger-validation.ts
CopiedTriggerOptions
Signature
declare const CopiedTriggerOptions: CopiedTriggerOptions;
TriggerValidationError (class)
Invalid trigger or result observation options.
Example
if (error instanceof TriggerValidationError) console.log(error.message);
Signature
declare class TriggerValidationError
copyTriggerOptions
Synchronous trigger options validator.
Throws
TypeError for invalid fields.
Example
copyTriggerOptions({ operationId: "op" });
Signature
declare const copyTriggerOptions: (value: unknown) => CopiedTriggerOptions;
copyTriggerOptionsEffect
Validates and freezes trigger options in Effect.
Example
Effect.runSync(copyTriggerOptionsEffect({ operationId: "op" }));
Signature
declare const copyTriggerOptionsEffect: (
value: unknown,
) => Effect.Effect<CopiedTriggerOptions, TriggerValidationError, never>;
validateResultOptions
Synchronous result options validator.
Throws
TypeError for invalid fields.
Example
validateResultOptions({ timeout: "1 second" });
Signature
declare const validateResultOptions: (value: unknown) => RunResultOptions;
validateResultOptionsEffect
Validates bounded result observation options in Effect.
Example
Effect.runSync(validateResultOptionsEffect({ timeout: "1 second" }));
Signature
declare const validateResultOptionsEffect: (
value: unknown,
) => Effect.Effect<RunResultOptions, TriggerValidationError, never>;
trigger-validation.types.ts
CopiedTriggerOptions (type alias)
Validated trigger options with an optional authored job selector.
Signature
type CopiedTriggerOptions = ServerTriggerOptions & { readonly job?: unknown };
trigger.types.ts
JobDescriptorForThisTask (type alias)
Job reference constrained to target the selected task.
Signature
type JobDescriptorForThisTask<Task extends TaskRefAny = TaskRefAny> = JobRefAny & {
readonly task: Task;
};
RunResultOptions (interface)
Options accepted for run result operations.
Signature
export interface RunResultOptions {
readonly timeout: DurationInput;
readonly signal?: AbortSignal;
}
ServerTriggerOptions (interface)
Options accepted for server trigger operations.
Signature
export interface ServerTriggerOptions extends TriggerOptions {
readonly signal?: AbortSignal;
}
TaskTriggerOptions (interface)
Options accepted for task trigger operations.
Signature
export interface TaskTriggerOptions<
Task extends TaskRefAny = TaskRefAny,
> extends ServerTriggerOptions {
readonly job?: JobDescriptorForThisTask<Task>;
}
TriggerOptions (interface)
Browser-safe submission fields. Server-only signals and selectors are separate.
Signature
export interface TriggerOptions {
readonly operationId?: string;
readonly idempotencyKey?: string;
readonly delay?: DurationInput;
readonly at?: string;
readonly tags?: readonly string[];
readonly correlationId?: string;
}