Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/shared/generated/runtime/CadenceHint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

/**
* A hint a region can pass back to the governor about preferred next
* tick cadence. The governor may honor or override; it owns the
* final policy.
*/
export type CadenceHint = "faster" | "hold" | "slower" | "sleep";
7 changes: 7 additions & 0 deletions src/shared/generated/runtime/ComputeClass.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

/**
* Compute footprint class. Drives governor decisions about which
* regions to throttle first under compute/thermal pressure.
*/
export type ComputeClass = "bookkeeping" | "cpu" | "cpu-vectorized" | "inference-light" | "inference-heavy";
7 changes: 7 additions & 0 deletions src/shared/generated/runtime/MemoryClass.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

/**
* Memory footprint class. Drives governor decisions about which
* regions to throttle first under memory pressure.
*/
export type MemoryClass = "light" | "moderate" | "heavy" | "vram-sensitive";
7 changes: 7 additions & 0 deletions src/shared/generated/runtime/PersonaLifecycle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

/**
* Persona lifecycle events relevant to regions (allow regions to
* allocate / deallocate per-persona state).
*/
export type PersonaLifecycle = { "kind": "created", persona_id: string, } | { "kind": "destroyed", persona_id: string, };
7 changes: 7 additions & 0 deletions src/shared/generated/runtime/PressureLevel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

/**
* Coarse system pressure level surfaced to regions so they can adjust
* internally without parsing every PressureSignal variant.
*/
export type PressureLevel = "nominal" | "moderate" | "high" | "critical";
18 changes: 18 additions & 0 deletions src/shared/generated/runtime/PressureProfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ComputeClass } from "./ComputeClass";
import type { MemoryClass } from "./MemoryClass";
import type { PressureSignalKind } from "./PressureSignalKind";

/**
* What a region declares about its resource footprint at registration
* time. The governor reads this once at register, then re-queries it
* when pressure shifts (regions may report different profiles after
* adapting under load — e.g., hippocampus drops from `Heavy` to
* `Moderate` when working memory is pruned).
*/
export type PressureProfile = { memory_class: MemoryClass, compute_class: ComputeClass,
/**
* Pressure kinds this region wants `on_signal` calls for. Other
* kinds are filtered out by the governor.
*/
responds_to: Array<PressureSignalKind>, };
11 changes: 11 additions & 0 deletions src/shared/generated/runtime/PressureSignalKind.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

/**
* Which kinds of pressure signals a region wants to receive via
* `on_signal`. The governor filters and routes signals based on this.
*
* Mirrors the variants of [`PressureSignal`] but is a kind-only enum
* (no payload) so it can be declared statically by a region at
* registration time.
*/
export type PressureSignalKind = "thermal" | "battery-low" | "system-mem-high" | "vram-high" | "user-active" | "inference-queue-depth" | "speculation-miss-rate";
11 changes: 11 additions & 0 deletions src/shared/generated/runtime/RegionId.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

/**
* Stable identifier for a brain region. Used by SubstrateGovernor for
* policy lookup and by telemetry/log streams for tagging events.
*
* Carries `Cow<'static, str>` so static IDs ("hippocampus") cost
* nothing and dynamic IDs (custom regions registered at runtime) are
* still supported.
*/
export type RegionId = string;
11 changes: 11 additions & 0 deletions src/shared/generated/runtime/RegionSignal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { PersonaLifecycle } from "./PersonaLifecycle";
import type { PressureLevel } from "./PressureLevel";
import type { SleepPhase } from "./SleepPhase";

/**
* Signals the substrate sends to regions out-of-band (not on the
* regular tick). Regions that don't care about a signal default to a
* no-op.
*/
export type RegionSignal = { "kind": "persona-lifecycle" } & PersonaLifecycle | { "kind": "sleep-transition", persona_id: string, phase: SleepPhase, } | { "kind": "system-pressure-changed", level: PressureLevel, };
54 changes: 54 additions & 0 deletions src/shared/generated/runtime/RegionTelemetry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { PressureSignal } from "../governor/PressureSignal";
import type { RegionId } from "./RegionId";

/**
* Per-tick telemetry shape every brain region emits.
*
* Emitted on every tick. The substrate routes it to:
*
* - **The governor** — reads `consumed_since_last` / `published` to
* tune region budget (yield-learning loop, algorithm 7).
* - **The operator surface** — `./jtag region/stats` / `region/yield`
* read aggregate telemetry across personas.
* - **The substrate event stream** — `RegionTickCompleted` and
* `ReadyBufferUpdated` events for cross-region awareness.
*/
export type RegionTelemetry = {
/**
* Which region this came from. Stable string id.
*/
region_id: RegionId,
/**
* Persona scope. `None` means the tick was global (background
* work not tied to a specific persona).
*/
persona_id: string | null,
/**
* When this tick started (wall clock).
*/
tick_started_at: string,
/**
* How long the tick body ran.
*/
tick_duration: string,
/**
* Items the region published to ready-buffers this tick.
*/
published: number,
/**
* Items in the region's ready-buffers consumed by handlers since
* the last tick.
*/
consumed_since_last: number,
/**
* Handler `peek` calls that returned `None` since the last tick.
* Signals to the governor that the region should be upweighted
* (handlers are asking for stuff that's not staged yet).
*/
buffer_misses_since_last: number,
/**
* Pressure the region observed (DB slow, embedding queue full,
* etc.). Surfaced to the governor for cascade evaluation.
*/
pressure_observed?: PressureSignal, };
8 changes: 8 additions & 0 deletions src/shared/generated/runtime/SleepPhase.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

/**
* Sleep/wake phases for the persona-level cognitive cycle. The sleep
* policy region (L0-4d) emits these; other regions react by changing
* their tick body (active vs idle vs sleep consolidation).
*/
export type SleepPhase = "active" | "idle" | "sleep";
34 changes: 34 additions & 0 deletions src/shared/generated/runtime/TickOutcome.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { PressureSignal } from "../governor/PressureSignal";
import type { CadenceHint } from "./CadenceHint";

/**
* Yield telemetry returned by every region tick. Feeds the substrate
* governor's yield-learning loop (algorithm 7 in
* COGNITION-ALGORITHMS.md, lands in L0-4c).
*
* Regions emit this from every tick. The governor reads aggregate
* (`consumed_since_last` vs `published`) to upweight regions whose
* output is being consumed by handlers and downweight regions whose
* output is ignored.
*/
export type TickOutcome = {
/**
* Items the region pre-staged this tick (publishes to ready-buffers).
*/
published: number,
/**
* Items in the region's ready-buffer that have been consumed by
* handlers since the last tick. The denominator for yield.
*/
consumed_since_last: number,
/**
* Pressure observation. If the region detected backpressure (DB
* slow, embedding queue full, etc.), reports it here for the
* governor.
*/
pressure_observed?: PressureSignal,
/**
* Optional next-tick hint (region requests faster/slower cadence).
*/
cadence_hint?: CadenceHint, };
Loading
Loading