Skip to content

Rulvar API reference


Rulvar API reference / @rulvar/rulvar / AdaptiveEvents

Type Alias: AdaptiveEvents

ts
type AdaptiveEvents = 
  | {
  applied: number;
  dropped: number;
  entryRef: number;
  planHash: string;
  revisionUnitsRemaining: number;
  type: "plan:revised";
}
  | {
  logicalTaskId: string;
  nodeId: string;
  type: "node:parked";
}
  | {
  logicalTaskId: string;
  nodeId: string;
  type: "node:cancelled";
}
  | {
  donorRef: number;
  logicalTaskId: string;
  nodeId: string;
  reclaimedUsd: number;
  type: "node:linked";
}
  | {
  coversToOrdinal: number;
  digestSeq: number;
  planHash: string;
  renderSize: number;
  type: "orchestrator:woke";
}
  | {
  atCap: boolean;
  capUsd?: number;
  finalizeReserveUsd?: number;
  orchestratorCapUsd?: number;
  orchestratorShare?: number;
  orchestratorSpentUsd?: number;
  runCeilingUsd?: number;
  runSpentUsd?: number;
  softWarning?: boolean;
  spentUsd?: number;
  type: "orchestrator:budget";
}
  | {
  childStatusCounts: Record<string, number>;
  completion: "complete" | "partial" | "rejected";
  minSpawnedChildren?: number;
  spawnedChildren?: number;
  type: "orchestrator:acceptance";
  verdict: "accepted" | "rejected";
}
  | {
  costToDateUsd: number;
  entryRef: number;
  kind: "scope_bigger" | "scope_different" | "blocked_with_evidence";
  logicalTaskId: string;
  type: "escalation:raised";
}
  | {
  by: ResolutionBy;
  countsAgainstLimit: boolean;
  decision: "retry" | "decompose" | "cancel" | "accept";
  entryRef: number;
  type: "escalation:decided";
}
  | {
  agentType: string;
  entryRef: number;
  logicalTaskId?: string;
  reserveUsd?: number;
  spawnUnitsAfter?: number;
  type: "spawn:admitted";
  verdict: "admit" | "reuse_full" | "admit_graft";
}
  | {
  agentType: string;
  code: string;
  entryRef?: number;
  logicalTaskId?: string;
  type: "spawn:rejected";
}
  | {
  generation: string;
  type: "admission:lease-lost";
  unitId: string;
}
  | {
  entryRef: number;
  gate: "mechanical" | "judge" | "spot-check";
  logicalTaskId: string;
  rung: number;
  type: "verify:failed";
}
  | {
  entryRef: number;
  op:   | "brief_set"
     | "fact_add"
     | "fact_supersede"
     | "lesson_add"
     | "observation_add";
  type: "ledger:op";
}
  | {
  logicalTaskId: string;
  stallStreak: number;
  type: "stall:detected";
}
  | {
  limit: number;
  oscillationCount: number;
  spawnKeyHash: string;
  type: "guard:oscillation";
}
  | {
  by: ResolutionBy;
  entryRef: number;
  targetRef: number;
  type: "resolution:applied";
}
  | {
  entryRef: number;
  reason: "already_resolved" | "target_abandoned";
  supersededBy: number;
  targetRef: number;
  type: "resolution:superseded";
}
  | {
  counter: string;
  entryRef: number;
  phi: number;
  remaining: number;
  type: "termination:debit";
}
  | {
  code: string;
  counter: string;
  entryRef: number;
  type: "termination:denied";
}
  | {
  field: string;
  frozenValue: Json;
  liveValue: Json;
  type: "termination:config-drift";
}
  | {
  code: "HASH_VERSION_TOO_OLD" | "HASH_VERSION_TOO_NEW";
  found: number;
  type: "journal:compat";
  window: [number, number];
};

Defined in: packages/core/dist/index.d.ts

Adaptive orchestration, resolutions, and accounting: emitted only by runs where the corresponding machinery is active (applicability per mode: https://docs.rulvar.com/guide/adaptive-orchestration). The types land as one closed catalog with M7-T03; emitters arrive with their tasks.

Union Members

Type Literal

ts
{
  applied: number;
  dropped: number;
  entryRef: number;
  planHash: string;
  revisionUnitsRemaining: number;
  type: "plan:revised";
}

Type Literal

ts
{
  logicalTaskId: string;
  nodeId: string;
  type: "node:parked";
}

Type Literal

ts
{
  logicalTaskId: string;
  nodeId: string;
  type: "node:cancelled";
}

Type Literal

ts
{
  donorRef: number;
  logicalTaskId: string;
  nodeId: string;
  reclaimedUsd: number;
  type: "node:linked";
}

Type Literal

ts
{
  coversToOrdinal: number;
  digestSeq: number;
  planHash: string;
  renderSize: number;
  type: "orchestrator:woke";
}

Type Literal

ts
{
  atCap: boolean;
  capUsd?: number;
  finalizeReserveUsd?: number;
  orchestratorCapUsd?: number;
  orchestratorShare?: number;
  orchestratorSpentUsd?: number;
  runCeilingUsd?: number;
  runSpentUsd?: number;
  softWarning?: boolean;
  spentUsd?: number;
  type: "orchestrator:budget";
}
NameTypeDescriptionDefined in
atCapboolean-packages/core/dist/index.d.ts
capUsd?number-packages/core/dist/index.d.ts
finalizeReserveUsd?number-packages/core/dist/index.d.ts
orchestratorCapUsd?number-packages/core/dist/index.d.ts
orchestratorShare?number-packages/core/dist/index.d.ts
orchestratorSpentUsd?number-packages/core/dist/index.d.ts
runCeilingUsd?number-packages/core/dist/index.d.ts
runSpentUsd?number-packages/core/dist/index.d.ts
softWarning?boolean-packages/core/dist/index.d.ts
spentUsd?number-packages/core/dist/index.d.ts
type"orchestrator:budget"Two emitted shapes share the discriminant: the cap-freeze form carries { atCap: true, spentUsd, capUsd, finalizeReserveUsd }, and the per-wake digest form carries atCap plus the passive WakeBudgetBlock fields (runSpentUsd .. softWarning).packages/core/dist/index.d.ts

Type Literal

ts
{
  childStatusCounts: Record<string, number>;
  completion: "complete" | "partial" | "rejected";
  minSpawnedChildren?: number;
  spawnedChildren?: number;
  type: "orchestrator:acceptance";
  verdict: "accepted" | "rejected";
}

Type Literal

ts
{
  costToDateUsd: number;
  entryRef: number;
  kind: "scope_bigger" | "scope_different" | "blocked_with_evidence";
  logicalTaskId: string;
  type: "escalation:raised";
}

Type Literal

ts
{
  by: ResolutionBy;
  countsAgainstLimit: boolean;
  decision: "retry" | "decompose" | "cancel" | "accept";
  entryRef: number;
  type: "escalation:decided";
}

Type Literal

ts
{
  agentType: string;
  entryRef: number;
  logicalTaskId?: string;
  reserveUsd?: number;
  spawnUnitsAfter?: number;
  type: "spawn:admitted";
  verdict: "admit" | "reuse_full" | "admit_graft";
}
NameTypeDescriptionDefined in
agentTypestring-packages/core/dist/index.d.ts
entryRefnumberThe journaled admission decision entry, or, on direct ctx.agent budget admissions (RV4806), the dispatch entry itself: no decision entry exists on that path.packages/core/dist/index.d.ts
logicalTaskId?stringAbsent on direct ctx.agent budget admissions (RV4806): no lineage layer minted a logical task id for a plain dispatch.packages/core/dist/index.d.ts
reserveUsd?numberThe COMMITTED reserve of this admission in USD, the allowance clamped number the settle releases (RV4801); present on the admissions that commit one (direct ctx.agent dispatches and ctx.workflow children, RV4806).packages/core/dist/index.d.ts
spawnUnitsAfter?numberSpawn-unit balance after the budget-layer debit. Present on budget-layer admissions (the orchestrator spawn tools and ctx.workflow children); absent on lineage-layer admissions (ctx.agent roots), whose spawn-unit debit rides the dispatch itself (v1.22.0 review P2-5).packages/core/dist/index.d.ts
type"spawn:admitted"-packages/core/dist/index.d.ts
verdict"admit" | "reuse_full" | "admit_graft"-packages/core/dist/index.d.ts

Type Literal

ts
{
  agentType: string;
  code: string;
  entryRef?: number;
  logicalTaskId?: string;
  type: "spawn:rejected";
}
NameTypeDescriptionDefined in
agentTypestring-packages/core/dist/index.d.ts
codestring-packages/core/dist/index.d.ts
entryRef?numberThe journaled admission decision entry; absent for the pre-admission config gates (orchestrate maxSpawns), which reject before anything is journaled.packages/core/dist/index.d.ts
logicalTaskId?string-packages/core/dist/index.d.ts
type"spawn:rejected"-packages/core/dist/index.d.ts

Type Literal

ts
{
  generation: string;
  type: "admission:lease-lost";
  unitId: string;
}
NameTypeDescriptionDefined in
generationstring-packages/core/dist/index.d.ts
type"admission:lease-lost"The durable admission lease of this run expired under a live holder (RV4804): a renew failed and the scheduler's own answer no longer says granted, so the reserved capacity may be re-granted to another run while this one is alive. Announced once per run, never fatal: the wire-level quota still gates every dispatch and the settle release stays idempotent. Environmental telemetry, exactly like the rest of admission: nothing of it is journaled.packages/core/dist/index.d.ts
unitIdstring-packages/core/dist/index.d.ts

Type Literal

ts
{
  entryRef: number;
  gate: "mechanical" | "judge" | "spot-check";
  logicalTaskId: string;
  rung: number;
  type: "verify:failed";
}

Type Literal

ts
{
  entryRef: number;
  op:   | "brief_set"
     | "fact_add"
     | "fact_supersede"
     | "lesson_add"
     | "observation_add";
  type: "ledger:op";
}

Type Literal

ts
{
  logicalTaskId: string;
  stallStreak: number;
  type: "stall:detected";
}

Type Literal

ts
{
  limit: number;
  oscillationCount: number;
  spawnKeyHash: string;
  type: "guard:oscillation";
}

Type Literal

ts
{
  by: ResolutionBy;
  entryRef: number;
  targetRef: number;
  type: "resolution:applied";
}

Type Literal

ts
{
  entryRef: number;
  reason: "already_resolved" | "target_abandoned";
  supersededBy: number;
  targetRef: number;
  type: "resolution:superseded";
}

Type Literal

ts
{
  counter: string;
  entryRef: number;
  phi: number;
  remaining: number;
  type: "termination:debit";
}

Type Literal

ts
{
  code: string;
  counter: string;
  entryRef: number;
  type: "termination:denied";
}

Type Literal

ts
{
  field: string;
  frozenValue: Json;
  liveValue: Json;
  type: "termination:config-drift";
}

Type Literal

ts
{
  code: "HASH_VERSION_TOO_OLD" | "HASH_VERSION_TOO_NEW";
  found: number;
  type: "journal:compat";
  window: [number, number];
}
NameTypeDescriptionDefined in
code"HASH_VERSION_TOO_OLD" | "HASH_VERSION_TOO_NEW"-packages/core/dist/index.d.ts
foundnumber-packages/core/dist/index.d.ts
type"journal:compat"Declared for hosts; not emitted today. The compatibility scan runs strictly before a run's event stream exists, so the refusal travels only as the typed JournalCompatibilityError (which carries the same fields).packages/core/dist/index.d.ts
window[number, number]-packages/core/dist/index.d.ts