fly-session: LegacyAgentWorker, the legacy Game Boy agent over the neural core

Agent.Initialize checks the profile against the dataset fingerprint and
warms up as the legacy fresh start does; Prepare applies sugar, ticks the
548625/32768 ms frame on the rational clock and decodes with
gameboy-readout-context-v1; Commit installs the frame, stimulates, then
reinforces once; Agent.Rollback is legacy-ratchet-rollback-v1's agent
half; capture is agent_to_chunks in an envelope and a restore resets the
readout transient as a fresh legacy process has it.
This commit is contained in:
acamilo 2026-09-23 14:45:25 +00:00
parent 72cefb773b
commit 9bdfb079e5
5 changed files with 1811 additions and 0 deletions

View file

@ -439,7 +439,9 @@ dependencies = [
name = "fly-session" name = "fly-session"
version = "0.1.1" version = "0.1.1"
dependencies = [ dependencies = [
"flate2",
"fly-session-types", "fly-session-types",
"flybrain-core",
"flybus", "flybus",
"serde_json", "serde_json",
"tempfile", "tempfile",

View file

@ -23,6 +23,11 @@ path = "src/bin/fly-session.rs"
# Everything else this crate needs is std or Tokio. # Everything else this crate needs is std or Tokio.
fly-session-types = { path = "../fly-session-types" } fly-session-types = { path = "../fly-session-types" }
flybus = { path = "../flybus" } flybus = { path = "../flybus" }
# AGENT-01: the legacy agent worker is an adapter over the existing neural core (LIF kernel,
# plasticity, retina, fixed readout, checkpoint chunks). Pure Rust, no emulator.
flybrain-core = { path = "../flybrain-core" }
# The toy connectome fixture is written as gzipped `.binz` arrays, the dataset loader's format.
flate2 = { workspace = true }
serde_json = { workspace = true } serde_json = { workspace = true }
# `rt-multi-thread` is not only for the tests: a worker process and a dedicated-thread # `rt-multi-thread` is not only for the tests: a worker process and a dedicated-thread

File diff suppressed because it is too large Load diff

View file

@ -29,6 +29,7 @@ pub mod dedup;
pub mod environment; pub mod environment;
pub mod harness; pub mod harness;
pub mod launcher; pub mod launcher;
pub mod legacy_agent;
pub mod measure; pub mod measure;
pub mod media; pub mod media;
pub mod metrics; pub mod metrics;

View file

@ -606,6 +606,13 @@ async fn execute<E: WorkerEndpoint>(
fn classify_default(method: &str) -> Option<OpClass> { fn classify_default(method: &str) -> Option<OpClass> {
match method { match method {
"Agent.Prepare" | "Agent.Commit" | "Environment.Advance" => Some(OpClass::StepMutation), "Agent.Prepare" | "Agent.Commit" | "Environment.Advance" => Some(OpClass::StepMutation),
// The extension methods of `workers-v1` section 7 are mutations under the step operation
// key (`legacy-gameboy-v1` section 11): `SaveSlot` at `(e, k)`, `RestoreSlot` and
// `Agent.Rollback` at the new epoch `(e', k)`. A lost reply replays from the same cache
// rather than rolling back twice.
"Agent.Rollback" | "Environment.SaveSlot" | "Environment.RestoreSlot" => {
Some(OpClass::StepMutation)
}
// `ipc-v1` section 5 retains lifecycle *and capture* replies until // `ipc-v1` section 5 retains lifecycle *and capture* replies until
// `Worker.Acknowledge`. The restore methods join them: their replies carry a // `Worker.Acknowledge`. The restore methods join them: their replies carry a
// once-only token and, for an environment, the restored observation's artifact, and a // once-only token and, for an environment, the restored observation's artifact, and a