@usine/executor
The usine scoped Worker contract with local, exe.dev, and SSH adapters.
Modules
Section titled “Modules”Classes
Section titled “Classes”AttemptWorkspace
Section titled “AttemptWorkspace”The serializable location and RunSpec of an Attempt checkout. Owning this record does not grant access to live resources or credentials.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AttemptWorkspace(…
args):AttemptWorkspace
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlyspec:RunSpec
worker
Section titled “worker”
readonlyworker:string&Brand<"WorkerName">
worktree
Section titled “worktree”
readonlyworktree:string&Brand<"WorktreePath">
CheckoutRequest
Section titled “CheckoutRequest”The repository, revision, and Agent task assigned to a Worker for one Attempt’s checkout.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CheckoutRequest(…
args):CheckoutRequest
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlyagent:Agent
attemptId
Section titled “attemptId”
readonlyattemptId:string&Brand<"AttemptId">
maxAttemptMinutes
Section titled “maxAttemptMinutes”
readonlymaxAttemptMinutes:Option<number>
Maximum minutes of live Attempt execution, or none for no timer; preparation and resource cleanup are outside this budget.
maxAttemptTokens
Section titled “maxAttemptTokens”
readonlymaxAttemptTokens:Option<number>
Maximum consumed tokens across the parent and every child, or none for no token ceiling; operator Holds never pause this ceiling.
maxChildren
Section titled “maxChildren”
readonlymaxChildren:number&Brand<"ChildSessionBudget">
parentEffort
Section titled “parentEffort”
readonlyparentEffort:"off"|"minimal"|"low"|"medium"|"high"|"xhigh"|"max"
parentModel
Section titled “parentModel”
readonlyparentModel:Option<string&Brand<"ModelId">>
payload
Section titled “payload”
readonlypayload:Json
reattach
Section titled “reattach”
readonlyreattach:boolean
The Attempt outlived an orchestrator restart and its parent task is still live: preparation takes over the checkout it already has instead of creating one, and launch reattaches to the running parent.
repository
Section titled “repository”
readonlyrepository:string&Brand<"RepositoryName">
resume
Section titled “resume”
readonlyresume:Option<SalvagePushed>
The previous Attempt’s pushed salvage to check out instead of the bare revision.
revision
Section titled “revision”
readonlyrevision:string&Brand<"RepositoryRevision">
salvageRef
Section titled “salvageRef”
readonlysalvageRef:string&Brand<"SalvageRef">
Where the Worker pushes this Attempt’s unfinished work if the Attempt ends without success.
readonlytask:string&Brand<"AttemptTask">
worker
Section titled “worker”
readonlyworker:string&Brand<"WorkerName">
CredentialProvider
Section titled “CredentialProvider”Mints renewable repository-scoped credentials for an Attempt.
Extends
Section titled “Extends”Context.ServiceClass
Properties
Section titled “Properties”Service
Section titled “Service”
readonlyService:object
The service’s operations: what yield* CredentialProvider returns.
readonlyissue: (repository,attemptId) =>Effect.Effect<WorkerCredential,CredentialUnavailableError>
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
repository |
RepositoryName |
attemptId |
AttemptId |
Returns
Section titled “Returns”Effect.Effect<WorkerCredential, CredentialUnavailableError>
CredentialUnavailableError
Section titled “CredentialUnavailableError”A Worker could not obtain access to the repository assigned to an Attempt.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CredentialUnavailableError(…
args):CredentialUnavailableError
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlycause:unknown
message
Section titled “message”
readonlymessage:string
repository
Section titled “repository”
readonlyrepository:string&Brand<"RepositoryName">
Executor
Section titled “Executor”Prepares isolated checkouts, runs Attempts on a Worker, and releases their resources (ADR 0006).
Extends
Section titled “Extends”Context.ServiceClass
Properties
Section titled “Properties”Service
Section titled “Service”
readonlyService:object
The service’s operations: what yield* Executor returns.
cancel
Section titled “cancel”
readonlycancel: (attemptId) =>Effect.Effect<void,ExecutorError>
Stops preparation and releases partial resources, or cancels the live parent task with a grace period before forced termination. A canceled prepared Attempt cannot launch. Repeated cancellation after release is a no-op.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
attemptId |
AttemptId |
Returns
Section titled “Returns”Effect.Effect<void, ExecutorError>
intervene
Section titled “intervene”
readonlyintervene: (attemptId,intervention) =>Effect.Effect<void,AttemptFailure>
Delivers an attributed operator action to the active Attempt’s live session.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
attemptId |
AttemptId |
intervention |
Intervention |
Returns
Section titled “Returns”Effect.Effect<void, AttemptFailure>
isLive
Section titled “isLive”
readonlyisLive: (attemptId) =>Effect.Effect<boolean,AttemptFailure>
Whether the Attempt’s parent task survived an orchestrator restart and can be reattached: it still runs, or it reported success before its checkout was harvested.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
attemptId |
AttemptId |
Returns
Section titled “Returns”Effect.Effect<boolean, AttemptFailure>
readonlykind:WorkerKind
outcome
Section titled “outcome”
readonlyoutcome: (attemptId) =>Effect.Effect<Option.Option<Result.Result<StepResult,AttemptFailure>>,AttemptFailure>
The result an Attempt’s finished parent task left in durable storage before an
orchestrator restart: the harvested result, or the parent’s failure. None when
nothing was stored, or when isLive says the Attempt is reattached instead.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
attemptId |
AttemptId |
Returns
Section titled “Returns”Effect.Effect<Option.Option<Result.Result<StepResult, AttemptFailure>>, AttemptFailure>
preflight
Section titled “preflight”
readonlypreflight: (worker,brains) =>Effect.Effect<void,ExecutorError>
Verifies Git and each rostered brain where the Worker runs children; never installs tools or logs in.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
worker |
WorkerName |
brains |
ReadonlyArray<BrainSpec> |
Returns
Section titled “Returns”Effect.Effect<void, ExecutorError>
prepare
Section titled “prepare”
readonlyprepare: (request) =>Effect.Effect<PreparedAttempt,ExecutorError,Scope.Scope>
Verifies the assigned brain before acquiring the Attempt in the caller’s scope. Clone, fetch, and lock waits
remain interruptible; partial preparation releases everything already acquired
before reporting failure. Each request identifies a fresh Attempt, or a live one
to reattach when reattach is set.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
request |
CheckoutRequest |
Returns
Section titled “Returns”Effect.Effect<PreparedAttempt, ExecutorError, Scope.Scope>
recover
Section titled “recover”
readonlyrecover: <E>(attempt,record) =>Effect.Effect<void,E|ExecutorError>
Reconciles an old checkout before new Attempts start; records its salvage before releasing any work.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
E |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
attempt |
AttemptRecovery |
record |
(salvage) => Effect.Effect<void, E> |
Returns
Section titled “Returns”Effect.Effect<void, E | ExecutorError>
ExecutorOperationError
Section titled “ExecutorOperationError”A Worker operation failed before its requested work completed.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ExecutorOperationError(…
args):ExecutorOperationError
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlycause:unknown
message
Section titled “message”
readonlymessage:string
operation
Section titled “operation”
readonlyoperation:"launch"|"preflight"|"prepare"|"cancel"|"cleanup"
WorkerCapabilityError
Section titled “WorkerCapabilityError”A verify-only preflight found a Worker capability missing or incompatible.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WorkerCapabilityError(…
args):WorkerCapabilityError
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”capability
Section titled “capability”
readonlycapability:"gateway"|"machine"|"toolchain"|"harness-login"|"credentials"
readonlycause:unknown
message
Section titled “message”
readonlymessage:string
worker
Section titled “worker”
readonlyworker:string&Brand<"WorkerName">
WorkerCredential
Section titled “WorkerCredential”A repository-scoped Worker credential and the instant at which it stops authorizing requests.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WorkerCredential(…
args):WorkerCredential
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”expiresAt
Section titled “expiresAt”
readonlyexpiresAt:Utc
readonlyvalue:Redacted<string>
Interfaces
Section titled “Interfaces”PreparedAttempt
Section titled “PreparedAttempt”One prepared Attempt with a scoped checkout and repository access. Use it within the scope that prepared it. Closing that scope stops any active session before removing the checkout and releasing credentials, including when launch never starts.
Properties
Section titled “Properties”launch
Section titled “launch”
readonlylaunch: (io) =>Effect<StepResult,InfraFailure|DefectFailure|AgentFailure|RunawayFailure|ChildSessionBudgetFailure>
Runs this Attempt once, recording channel activity through io. Completion,
failure, or interruption releases its resources before returning. Cleanup
failures are logged without replacing the agent’s outcome or retrying its work.
Reusing an Attempt after launch or release fails with an infrastructure error.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
io |
Sink |
Returns
Section titled “Returns”Effect<StepResult, InfraFailure | DefectFailure | AgentFailure | RunawayFailure | ChildSessionBudgetFailure>
workspace
Section titled “workspace”
readonlyworkspace:AttemptWorkspace
Checkout metadata suitable for inspection or serialization; contains no credentials.
Type Aliases
Section titled “Type Aliases”ExecutorError
Section titled “ExecutorError”ExecutorError = typeof
ExecutorError.Type
A readiness, access, or lifecycle failure reported by a Worker operation.
ExecutorOperation
Section titled “ExecutorOperation”ExecutorOperation = typeof
ExecutorOperation.Type
The Worker operation that failed during readiness checks or an Attempt’s lifecycle.
WorkerCapability
Section titled “WorkerCapability”WorkerCapability = typeof
WorkerCapability.Type
A prerequisite a Worker must satisfy before it can accept Attempts.
gateway is the Gateway in front of the Worker’s machine: its admin API
answers the orchestrator, and the machine reaches it.
WorktreePath
Section titled “WorktreePath”WorktreePath = typeof
WorktreePath.Type
One Attempt’s disposable checkout directory.
Variables
Section titled “Variables”ExecutorError
Section titled “ExecutorError”
constExecutorError:Schema.Union<readonly [typeofExecutorOperationError, typeofCredentialUnavailableError, typeofWorkerCapabilityError]>
A readiness, access, or lifecycle failure reported by a Worker operation.
ExecutorOperation
Section titled “ExecutorOperation”
constExecutorOperation:Schema.Literals<readonly ["preflight","prepare","launch","cancel","cleanup"]>
The Worker operation that failed during readiness checks or an Attempt’s lifecycle.
logPreflightFailure
Section titled “logPreflightFailure”
constlogPreflightFailure: <A,R>(effect) =>Effect.Effect<A,ExecutorError,R>
Logs every preflight refusal so a missing capability is explainable from logs alone.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
A |
R |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
effect |
Effect.Effect<A, ExecutorError, R> |
Returns
Section titled “Returns”Effect.Effect<A, ExecutorError, R>
WorkerCapability
Section titled “WorkerCapability”
constWorkerCapability:Schema.Literals<readonly ["machine","toolchain","harness-login","credentials","gateway"]>
A prerequisite a Worker must satisfy before it can accept Attempts.
gateway is the Gateway in front of the Worker’s machine: its admin API
answers the orchestrator, and the machine reaches it.
WorktreePath
Section titled “WorktreePath”
constWorktreePath:Schema.brand<Schema.NonEmptyString,"WorktreePath">
One Attempt’s disposable checkout directory.