@usine/durable/attempt-runtime
Classes
Section titled “Classes”AttemptReport
Section titled “AttemptReport”What the parent said when it finished. Commits and pull requests are harvested by the executor afterwards.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AttemptReport(…
args):AttemptReport
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”message
Section titled “message”
readonlymessage:string
AttemptRequest
Section titled “AttemptRequest”One Attempt’s parent to run: its RunSpec, plus the checkout the parent and its children work in.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AttemptRequest(…
args):AttemptRequest
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlycwd:string
Absolute path of the Attempt’s worktree on the machine its children run on.
environment
Section titled “environment”
readonlyenvironment:object
The only process environment the parent’s children and every command they
run may see: the Worker’s allowlisted variables plus the Attempt’s single-repo
credential configuration (ADR 0011). The orchestrator’s own environment,
which holds the App private key, is never inherited. On a RemoteShell
host the variables are exported on top of the remote machine’s own environment.
Index Signature
Section titled “Index Signature”[key: string]: string
readonlyhost:LocalProcess|RemoteShell
Where the parent’s children run.
readonlyspec:RunSpec
worker
Section titled “worker”
readonlyworker:string&Brand<"WorkerName">
AttemptRuntime
Section titled “AttemptRuntime”Runs an Attempt’s Pi parent as a durable task in the orchestrator process.
execute is idempotent per Attempt id: the first call creates the task and
its parent conversation, a later call (after an orchestrator restart) finds
them in storage and waits for the same work. Everything the parent and its
children do reaches io as attempt channel envelopes in order, so the
transcript and the run drawer keep working unchanged.
Extends
Section titled “Extends”Context.ServiceClass
Properties
Section titled “Properties”Service
Section titled “Service”
readonlyService:object
The service’s operations: what yield* AttemptRuntime returns.
cancel
Section titled “cancel”
readonlycancel: (attemptId) =>Effect.Effect<void,AttemptFailure>
Cancels the Attempt: aborts the task bottom-up (children, then the parent conversation) and settles execute.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
attemptId |
AttemptId |
Returns
Section titled “Returns”Effect.Effect<void, AttemptFailure>
execute
Section titled “execute”
readonlyexecute: (request,io) =>Effect.Effect<AttemptReport,AttemptFailure>
Creates or reattaches the Attempt’s parent task, records its activity through io, and waits for its report.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
request |
AttemptRequest |
io |
Sink |
Returns
Section titled “Returns”Effect.Effect<AttemptReport, AttemptFailure>
finished
Section titled “finished”
readonlyfinished: (attemptId) =>Effect.Effect<Option.Option<FinishedAttempt>,AttemptFailure>
What the Attempt’s parent task left once it finished and execute relayed its terminal envelope,
kept after that envelope so an orchestrator that stopped before recording the Attempt’s outcome can
still finish it. None while the task runs or before the relay, after cancel, and when the Attempt has no task.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
attemptId |
AttemptId |
Returns
Section titled “Returns”Effect.Effect<Option.Option<FinishedAttempt>, AttemptFailure>
intervene
Section titled “intervene”
readonlyintervene: (attemptId,intervention) =>Effect.Effect<void,AttemptFailure>
Applies an operator action to the live parent or one of its children; the result is recorded through the Attempt’s sink.
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 is still open in durable storage, so a restart reattaches instead of starting over.
Stays true until execute has relayed the terminal envelope, even when the task itself finished earlier.
A canceled task is never live.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
attemptId |
AttemptId |
Returns
Section titled “Returns”Effect.Effect<boolean, AttemptFailure>
recordResult
Section titled “recordResult”
readonlyrecordResult: (attemptId,result) =>Effect.Effect<void,AttemptFailure>
Keeps the Attempt’s harvested result with its durable record, so finished returns it once the parent’s report is relayed.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
attemptId |
AttemptId |
result |
StepResult |
Returns
Section titled “Returns”Effect.Effect<void, AttemptFailure>
request
Section titled “request”
readonlyrequest: (attemptId) =>Effect.Effect<Option.Option<StoredRequest>,AttemptFailure>
The request the Attempt’s task was created with, read back for a reattachment; none when the Attempt has no task.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
attemptId |
AttemptId |
Returns
Section titled “Returns”Effect.Effect<Option.Option<StoredRequest>, AttemptFailure>
ParentFailed
Section titled “ParentFailed”The parent task ended with a failure.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ParentFailed(…
args):ParentFailed
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”failure
Section titled “failure”
readonlyfailure:InfraFailure|DefectFailure|AgentFailure|RunawayFailure|ChildSessionBudgetFailure
ParentReported
Section titled “ParentReported”The parent reported success, and no harvested result was recorded: the Attempt’s checkout still has to be harvested.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ParentReported(…
args):ParentReported
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”report
Section titled “report”
readonlyreport:AttemptReport
ResultRecorded
Section titled “ResultRecorded”The executor recorded the Attempt’s harvested result with recordResult.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ResultRecorded(…
args):ResultRecorded
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”result
Section titled “result”
readonlyresult:StepResult
StoredRequest
Section titled “StoredRequest”What durable storage keeps of an Attempt’s request: what identifies its
work. The child host and the environment describe the process that runs
the Attempt, so each execute call supplies them afresh.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new StoredRequest(…
args):StoredRequest
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlycwd:string
Absolute path of the Attempt’s worktree on the machine its children run on.
readonlyspec:RunSpec
worker
Section titled “worker”
readonlyworker:string&Brand<"WorkerName">
Type Aliases
Section titled “Type Aliases”FinishedAttempt
Section titled “FinishedAttempt”FinishedAttempt = typeof
FinishedAttempt.Type
What durable storage keeps of an Attempt whose parent task finished and relayed its terminal envelope.
Variables
Section titled “Variables”FinishedAttempt
Section titled “FinishedAttempt”
constFinishedAttempt:Schema.Union<readonly [typeofParentReported, typeofResultRecorded, typeofParentFailed]>
What durable storage keeps of an Attempt whose parent task finished and relayed its terminal envelope.