Skip to content

Rulvar API reference


Rulvar API reference / @rulvar/core / OrchestratorExtensionIO

Interface: OrchestratorExtensionIO ​

Defined in: packages/core/src/orchestrator/extension.ts:81

The per-run IO the extension closes over (engine-owned effects).

Properties ​

PropertyModifierTypeDescriptionDefined in
admissionreadonlyAdmissionControllerThe single admission point for all spawns.packages/core/src/orchestrator/extension.ts:122
baseScopereadonlystringThe scope the orchestrate call runs in ('' at the top level).packages/core/src/orchestrator/extension.ts:84
finalizeReserveUsd?readonlynumberThe finalize reserve carved out of the cap, resolved with it.packages/core/src/orchestrator/extension.ts:106
gatesreadonlyRecord<string, unknown>The per-engine mechanical gate registry: named pure functions over AgentResult.artifacts. Typed loose at the seam exactly like profiles.packages/core/src/orchestrator/extension.ts:94
orchestratorCapUsd?readonlynumberThe resolved orchestrator cap in absolute USD (DEF-7; XF-09): min(budget.capUsd, capFraction x B0) on a fresh run, the frozen orchestrator_budget_reserve dollars on resume. Resolved strictly before boot so an extension can freeze it into termination.init; always present under PlanRunner (an unresolvable cap refuses boot).packages/core/src/orchestrator/extension.ts:104
profilesreadonlyRecord<string, unknown>Registered agent profiles advertised to this orchestrate call.packages/core/src/orchestrator/extension.ts:88
runCeilingUsd?readonlynumberThe run USD ceiling (B0), when one exists.packages/core/src/orchestrator/extension.ts:96
runIdreadonlystring-packages/core/src/orchestrator/extension.ts:82

Methods ​

abandonBranch() ​

ts
abandonBranch(attempt): Promise<{
  applied: boolean;
  seq: number;
}>;

Defined in: packages/core/src/orchestrator/extension.ts:141

Appends the severing abandon ref-entry over a branch through the ResolutionArbiter (DEF-4/DEF-5).

Parameters ​

ParameterType
attempt{ authorizedBy: number; logicalTaskId?: string; nodeId?: string; reason: string; retainCheckpoint?: boolean; retainWorktree?: boolean; target: number; }
attempt.authorizedBynumber
attempt.logicalTaskId?string
attempt.nodeId?string
attempt.reasonstring
attempt.retainCheckpoint?boolean
attempt.retainWorktree?boolean
attempt.targetnumber

Returns ​

Promise<{ applied: boolean; seq: number; }>


append() ​

ts
append(input): Promise<JournalEntry>;

Defined in: packages/core/src/orchestrator/extension.ts:116

Total-order append; the extension owns its scopes' content keys.

Parameters ​

ParameterType
inputExtensionAppendInput

Returns ​

Promise&lt;JournalEntry&gt;


cancel() ​

ts
cancel(handle, reason?): Promise<{
  cancelled: boolean;
  handle: number;
}>;

Defined in: packages/core/src/orchestrator/extension.ts:136

Cancels an in-flight child by handle (AbortSignal).

Parameters ​

ParameterType
handlenumber
reason?string

Returns ​

Promise<{ cancelled: boolean; handle: number; }>


dispatch() ​

ts
dispatch(
   spec, 
   childScope, 
   identity): Promise<{
  handle: number;
}>;

Defined in: packages/core/src/orchestrator/extension.ts:128

Dispatches one child agent under the EXPLICIT child scope through the ordinary ctx.agent path (semaphore, budget layers, forward matching). Returns the journal-derived handle (the dispatch seq).

Parameters ​

ParameterType
specExtensionDispatchSpec
childScopestring
identity{ logicalTaskId: string; nodeId: string; }
identity.logicalTaskIdstring
identity.nodeIdstring

Returns ​

Promise<{ handle: number; }>


emit() ​

ts
emit(event, options?): void;

Defined in: packages/core/src/orchestrator/extension.ts:158

Telemetry emission into the run event stream.

Parameters ​

ParameterTypeDescription
event{ type: string; } & Record&lt;string, unknown&gt;-
options?{ replayed?: boolean; }-
options.replayed?booleanMarks the event as the replay of a journal-recovered decision (the standard envelope flag), so extension surfaces can emit recovered admissions honestly (v1.22.0 review P2-5).

Returns ​

void


flush() ​

ts
flush(): Promise<void>;

Defined in: packages/core/src/orchestrator/extension.ts:120

Flushes the serialized append queue before reading back.

Returns ​

Promise&lt;void&gt;


mintId() ​

ts
mintId(): string;

Defined in: packages/core/src/orchestrator/extension.ts:108

ULID minting for engine-owned identifiers (NodeIds).

Returns ​

string


orchestratorScope() ​

ts
orchestratorScope(): string;

Defined in: packages/core/src/orchestrator/extension.ts:86

The orchestrator's child scope (agent:<seq>); throws before the loop starts.

Returns ​

string


priceUsd() ​

ts
priceUsd(servedBy, usage): number | undefined;

Defined in: packages/core/src/orchestrator/extension.ts:156

The engine price fold (journal facts in, USD out).

Parameters ​

ParameterType
servedBystring | undefined
usageUsage

Returns ​

number | undefined


random() ​

ts
random(key?): Promise<number>;

Defined in: packages/core/src/orchestrator/extension.ts:114

A journaled random draw in [0, 1) under the orchestrate scope: the ctx.random primitive, computed once live and replayed by match. The spot-check gate draws HERE, never Math.random.

Parameters ​

ParameterType
key?string

Returns ​

Promise&lt;number&gt;


registerAlias() ​

ts
registerAlias(donorScope, targetScope): void;

Defined in: packages/core/src/orchestrator/extension.ts:154

Registers a node.link scope-prefix alias for forward matching (DEF-5). Idempotent; rebuilt by fold on resume.

Parameters ​

ParameterType
donorScopestring
targetScopestring

Returns ​

void


settledOf() ​

ts
settledOf(handle): 
  | AgentResult<unknown>
  | undefined;

Defined in: packages/core/src/orchestrator/extension.ts:134

The settled result of a dispatched child, when it settled.

Parameters ​

ParameterType
handlenumber

Returns ​

| AgentResult&lt;unknown&gt; | undefined


snapshot() ​

ts
snapshot(): readonly JournalEntry[];

Defined in: packages/core/src/orchestrator/extension.ts:118

The pinned journal view backing every pure fold.

Returns ​

readonly JournalEntry[]


terminate()? ​

ts
optional terminate(error): void;

Defined in: packages/core/src/orchestrator/extension.ts:180

A deterministic run failure declared by the extension (v1.35.0 review P2-1): the first call stores the error and aborts the orchestrator loop; the orchestrate settle boundary rethrows it, so the run fails with the given typed error instead of asking the model to finish. Later calls do nothing. The intended producer is a journaled policy verdict (the PlanRunner guards fallback 'fail-run'): boot terminates again from the journal on resume, so the failure rolls forward without another decision or model call. Optional so IO implementations built before v1.36 keep compiling.

Parameters ​

ParameterType
errorError

Returns ​

void