Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01fab56cc6 | ||
|
|
4f10f6e584
|
||
|
|
e8e4d64e42
|
||
|
|
31ad7f9446
|
||
|
|
6d185ab97e | ||
|
|
89101d1b20
|
||
|
|
2516fae4fc | ||
|
|
e0c08c8b00
|
||
|
|
5b106af0f3 |
@@ -66,3 +66,7 @@ AGENTS.md
|
||||
|
||||
.python-version
|
||||
.venv
|
||||
|
||||
discussion/*
|
||||
!discussion/lessons/
|
||||
!discussion/lessons/**
|
||||
|
||||
Generated
+1133
-348
File diff suppressed because it is too large
Load Diff
@@ -7,6 +7,7 @@ members = [
|
||||
"crates/console/prometeu-system",
|
||||
"crates/console/prometeu-vm",
|
||||
"crates/host/prometeu-host-desktop-winit",
|
||||
"crates/host/prometeu-host-headless",
|
||||
"crates/tools/prometeu-cli",
|
||||
"crates/tools/pbxgen-dummy-boy",
|
||||
"crates/tools/pbxgen-stress",
|
||||
|
||||
@@ -135,6 +135,7 @@ Current canonical domains:
|
||||
- `asset/bank`
|
||||
- `firmware`
|
||||
- `host-dependent`
|
||||
- `host/headless`
|
||||
|
||||
Global coverage artifacts:
|
||||
|
||||
@@ -157,6 +158,7 @@ Domain-oriented evidence helpers:
|
||||
make coverage-domain-list
|
||||
make coverage-domain-evidence DOMAIN=firmware
|
||||
make coverage-domain-evidence DOMAIN=host-dependent
|
||||
make coverage-domain-evidence DOMAIN=host/headless
|
||||
```
|
||||
|
||||
Per-domain baselines currently start around `60`.
|
||||
|
||||
@@ -11,9 +11,9 @@ mod program_image;
|
||||
mod value;
|
||||
|
||||
pub use abi::{
|
||||
TrapInfo, TRAP_BAD_RET_SLOTS, TRAP_DIV_ZERO, TRAP_EXPLICIT, TRAP_ILLEGAL_INSTRUCTION,
|
||||
TRAP_INVALID_FUNC, TRAP_INVALID_INTRINSIC, TRAP_INVALID_LOCAL, TRAP_INVALID_SYSCALL, TRAP_OOB,
|
||||
TRAP_STACK_UNDERFLOW, TRAP_TYPE,
|
||||
SourceSpan, TrapInfo, TRAP_BAD_RET_SLOTS, TRAP_DIV_ZERO, TRAP_EXPLICIT,
|
||||
TRAP_ILLEGAL_INSTRUCTION, TRAP_INVALID_FUNC, TRAP_INVALID_INTRINSIC, TRAP_INVALID_LOCAL,
|
||||
TRAP_INVALID_SYSCALL, TRAP_OOB, TRAP_STACK_UNDERFLOW, TRAP_TYPE,
|
||||
};
|
||||
pub use assembler::{assemble, AsmError};
|
||||
pub use decoder::{decode_next, DecodeError};
|
||||
|
||||
@@ -579,6 +579,8 @@ mod tests {
|
||||
|
||||
assert_eq!(firmware.os.sessions().vm_session_count(), 0);
|
||||
assert_eq!(firmware.os.vm().current_cartridge_title(), "");
|
||||
assert_eq!(firmware.os.lifecycle().resident_game(), None);
|
||||
assert_eq!(firmware.os.lifecycle().foreground_owner(), ForegroundOwner::Hub);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -9,6 +9,10 @@ pub struct ResetStep;
|
||||
impl ResetStep {
|
||||
pub fn on_enter(&mut self, ctx: &mut PrometeuContext) {
|
||||
ctx.os.log(LogLevel::Info, LogSource::Pos, 0, "Firmware Reset".to_string());
|
||||
// Reset is a cold-boot boundary. Clearing only the VM session leaves
|
||||
// the lifecycle registry pointing at the old resident game, which
|
||||
// rejects the next cartridge as a second resident game.
|
||||
let _ = ctx.os.lifecycle().terminate_resident_game();
|
||||
ctx.os.sessions().clear_vm_sessions();
|
||||
ctx.os.vm().reset_global_runtime_state();
|
||||
}
|
||||
|
||||
@@ -159,6 +159,15 @@ impl<'a> VmFacade<'a> {
|
||||
self.os.vm_runtime.debug_step_request = true;
|
||||
}
|
||||
|
||||
pub fn clear_debug_step_request(&mut self) {
|
||||
if let Some(session) = self.active_session_mut() {
|
||||
session.runtime.debug_step_request = false;
|
||||
return;
|
||||
}
|
||||
|
||||
self.os.vm_runtime.debug_step_request = false;
|
||||
}
|
||||
|
||||
pub fn debug_step_requested(&self) -> bool {
|
||||
self.active_session()
|
||||
.map(|session| session.runtime.debug_step_request)
|
||||
|
||||
@@ -65,7 +65,7 @@ pub struct VirtualMachineRuntime {
|
||||
|
||||
impl VirtualMachineRuntime {
|
||||
pub const CYCLES_PER_LOGICAL_FRAME: u64 = 1_500_000;
|
||||
pub const SLICE_PER_TICK: u64 = 1_500_000;
|
||||
pub const SLICE_PER_TICK: u64 = 250_000;
|
||||
pub const MAX_LOG_LEN: usize = 256;
|
||||
pub const MAX_LOGS_PER_FRAME: u32 = 10;
|
||||
|
||||
|
||||
@@ -76,6 +76,9 @@ impl VirtualMachineRuntime {
|
||||
vm: &mut VirtualMachine,
|
||||
platform: &mut dyn RuntimePlatform,
|
||||
) -> Option<CrashReport> {
|
||||
if vm.call_stack_is_empty() {
|
||||
vm.prepare_boot_call();
|
||||
}
|
||||
let step_result = {
|
||||
let mut ctx = HostContext::new_platform(Some(platform));
|
||||
let mut fs = VirtualFS::new();
|
||||
@@ -96,18 +99,28 @@ impl VirtualMachineRuntime {
|
||||
};
|
||||
|
||||
match step_result {
|
||||
Ok(_) => None,
|
||||
Err(e) => {
|
||||
let report = match e {
|
||||
LogicalFrameEndingReason::Trap(trap) => CrashReport::VmTrap { trap },
|
||||
LogicalFrameEndingReason::Panic(message) => {
|
||||
CrashReport::VmPanic { message, pc: Some(vm.pc() as u32) }
|
||||
}
|
||||
other => CrashReport::VmPanic {
|
||||
message: format!("Unexpected fault during step: {:?}", other),
|
||||
pc: Some(vm.pc() as u32),
|
||||
},
|
||||
};
|
||||
Ok(())
|
||||
| Err(
|
||||
LogicalFrameEndingReason::FrameSync
|
||||
| LogicalFrameEndingReason::BudgetExhausted
|
||||
| LogicalFrameEndingReason::Halted
|
||||
| LogicalFrameEndingReason::EndOfRom
|
||||
| LogicalFrameEndingReason::Breakpoint,
|
||||
) => None,
|
||||
Err(LogicalFrameEndingReason::Trap(trap)) => {
|
||||
let report = CrashReport::VmTrap { trap };
|
||||
self.log(
|
||||
log_service,
|
||||
LogLevel::Error,
|
||||
LogSource::Vm,
|
||||
report.log_tag(),
|
||||
format!("PVM Fault during Step: {}", report),
|
||||
);
|
||||
self.last_crash_report = Some(report.clone());
|
||||
Some(report)
|
||||
}
|
||||
Err(LogicalFrameEndingReason::Panic(message)) => {
|
||||
let report = CrashReport::VmPanic { message, pc: Some(vm.pc() as u32) };
|
||||
self.log(
|
||||
log_service,
|
||||
LogLevel::Error,
|
||||
|
||||
@@ -19,8 +19,8 @@ prometeu-system = { path = "../../console/prometeu-system" }
|
||||
prometeu-drivers = { path = "../../console/prometeu-drivers" }
|
||||
prometeu-hal = { path= "../../console/prometeu-hal" }
|
||||
winit = "0.30.12"
|
||||
pixels = "0.15.0"
|
||||
pixels = "0.17.2"
|
||||
cpal = "0.15.3"
|
||||
ringbuf = "0.4.7"
|
||||
serde_json = "1.0.149"
|
||||
clap = { version = "4.5", features = ["derive"] }
|
||||
clap = { version = "4.5", features = ["derive"] }
|
||||
|
||||
@@ -397,7 +397,7 @@ impl AudioMixer {
|
||||
let vol_l = vol_f * (1.0 - pan_f).sqrt();
|
||||
let vol_r = vol_f * pan_f.sqrt();
|
||||
|
||||
for frame in buffer.chunks_exact_mut(2) {
|
||||
for frame in buffer.as_chunks_mut::<2>().0 {
|
||||
let pos_int = voice.pos as usize;
|
||||
let pos_fract = voice.pos - pos_int as f64;
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
[package]
|
||||
name = "prometeu-host-headless"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
description = "In-process Prometeu host that boots and steps cartridges without a window, display, or audio device."
|
||||
|
||||
[dependencies]
|
||||
prometeu-bytecode = { path = "../../console/prometeu-bytecode" }
|
||||
prometeu-drivers = { path = "../../console/prometeu-drivers" }
|
||||
prometeu-firmware = { path = "../../console/prometeu-firmware" }
|
||||
prometeu-hal = { path = "../../console/prometeu-hal" }
|
||||
prometeu-system = { path = "../../console/prometeu-system" }
|
||||
prometeu-vm = { path = "../../console/prometeu-vm" }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
base64 = "0.22"
|
||||
png = "0.17"
|
||||
getrandom = "0.3"
|
||||
|
||||
[[bench]]
|
||||
name = "temporal"
|
||||
harness = false
|
||||
@@ -0,0 +1,83 @@
|
||||
use std::fs;
|
||||
use std::hint::black_box;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::time::{Instant, SystemTime, UNIX_EPOCH};
|
||||
|
||||
use prometeu_bytecode::SourceSpan;
|
||||
use prometeu_bytecode::assembler::assemble;
|
||||
use prometeu_bytecode::model::{BytecodeModule, DebugInfo, Export, FunctionMeta};
|
||||
use prometeu_host_headless::{AdvanceFramesStop, HeadlessHost};
|
||||
|
||||
const SAMPLE_FRAMES: u64 = 300;
|
||||
const SAMPLE_COUNT: u32 = 10;
|
||||
|
||||
fn main() {
|
||||
let cartridge = benchmark_cartridge();
|
||||
let mut samples = Vec::with_capacity(SAMPLE_COUNT as usize);
|
||||
|
||||
for _ in 0..SAMPLE_COUNT {
|
||||
let mut host = HeadlessHost::new();
|
||||
host.boot(cartridge.to_string_lossy()).expect("boot benchmark cartridge");
|
||||
|
||||
let started = Instant::now();
|
||||
let outcome =
|
||||
black_box(host.advance_frames(SAMPLE_FRAMES)).expect("advance benchmark frames");
|
||||
let elapsed = started.elapsed();
|
||||
|
||||
assert_eq!(outcome.completed, SAMPLE_FRAMES);
|
||||
assert_eq!(outcome.stop, AdvanceFramesStop::Completed);
|
||||
samples.push(elapsed.as_secs_f64());
|
||||
}
|
||||
|
||||
samples.sort_by(f64::total_cmp);
|
||||
let median_seconds = samples[samples.len() / 2];
|
||||
let frames_per_second = SAMPLE_FRAMES as f64 / median_seconds;
|
||||
println!(
|
||||
"headless advance_frames: median={median_seconds:.6}s frames={SAMPLE_FRAMES} throughput={frames_per_second:.2} frames/s samples={SAMPLE_COUNT}"
|
||||
);
|
||||
|
||||
fs::remove_dir_all(&cartridge).expect("remove benchmark cartridge");
|
||||
}
|
||||
|
||||
fn benchmark_cartridge() -> PathBuf {
|
||||
let directory = std::env::temp_dir().join(format!(
|
||||
"prometeu-headless-benchmark-{}-{}",
|
||||
std::process::id(),
|
||||
SystemTime::now().duration_since(UNIX_EPOCH).expect("system clock").as_nanos()
|
||||
));
|
||||
fs::create_dir_all(&directory).expect("create benchmark cartridge");
|
||||
|
||||
let code = assemble("FRAME_SYNC\nRET\n").expect("assemble benchmark program");
|
||||
let module = BytecodeModule {
|
||||
version: 0,
|
||||
const_pool: vec![],
|
||||
functions: vec![FunctionMeta {
|
||||
code_offset: 0,
|
||||
code_len: code.len() as u32,
|
||||
param_slots: 0,
|
||||
local_slots: 0,
|
||||
return_slots: 0,
|
||||
max_stack_slots: 1,
|
||||
}],
|
||||
code,
|
||||
debug_info: Some(DebugInfo {
|
||||
pc_to_span: vec![(0, SourceSpan { file_id: 1, start: 0, end: 10 })],
|
||||
function_names: vec![(0, "main".into())],
|
||||
}),
|
||||
exports: vec![Export { symbol: "main".into(), func_idx: 0 }],
|
||||
syscalls: vec![],
|
||||
}
|
||||
.serialize();
|
||||
|
||||
fs::write(directory.join("program.pbx"), module).expect("write benchmark program");
|
||||
write_manifest(&directory);
|
||||
directory
|
||||
}
|
||||
|
||||
fn write_manifest(directory: &Path) {
|
||||
fs::write(
|
||||
directory.join("manifest.json"),
|
||||
"{\n \"magic\": \"PMTU\",\n \"cartridge_version\": 1,\n \"app_id\": 90,\n \"title\": \"Headless Temporal Benchmark\",\n \"app_version\": \"0.1.0\",\n \"app_mode\": \"Game\",\n \"capabilities\": []\n}\n",
|
||||
)
|
||||
.expect("write benchmark manifest");
|
||||
}
|
||||
@@ -0,0 +1,406 @@
|
||||
//! Versioned external tooling boundary; the host API itself remains synchronous.
|
||||
mod wire;
|
||||
pub use wire::Limits;
|
||||
|
||||
use crate::{AdvanceFrameOutcome, HeadlessHost};
|
||||
use serde_json::{Value, json};
|
||||
use std::io::{self, BufRead, Write};
|
||||
use std::sync::{Arc, Mutex, mpsc};
|
||||
use wire::{CAPABILITIES, Command, Request, WireError};
|
||||
|
||||
#[derive(Default)]
|
||||
struct Control {
|
||||
active: Option<String>,
|
||||
advancing: bool,
|
||||
canceled: bool,
|
||||
}
|
||||
|
||||
enum Job {
|
||||
Work(String, Command),
|
||||
Stop(Option<String>),
|
||||
ReadError(io::Error),
|
||||
}
|
||||
|
||||
struct Output<W> {
|
||||
writer: Mutex<W>,
|
||||
session: String,
|
||||
limit: usize,
|
||||
}
|
||||
|
||||
impl<W: Write> Output<W> {
|
||||
fn send(&self, value: Value) -> io::Result<()> {
|
||||
let mut bytes = serde_json::to_vec(&value)?;
|
||||
if bytes.len() > self.limit {
|
||||
bytes = serde_json::to_vec(&json!({"type":"response","sessionId":self.session,
|
||||
"requestId":value.get("requestId"),"error":{"code":"response_too_large",
|
||||
"message":"response exceeds configured limit","details":{"maxResponseBytes":self.limit}}}))?;
|
||||
}
|
||||
if bytes.len() > self.limit {
|
||||
return Err(io::Error::other("response limit cannot contain error"));
|
||||
}
|
||||
let mut writer = self.writer.lock().map_err(|_| io::Error::other("output poisoned"))?;
|
||||
writer.write_all(&bytes)?;
|
||||
writer.write_all(b"\n")?;
|
||||
writer.flush()
|
||||
}
|
||||
|
||||
fn reply(&self, id: Option<&str>, result: Result<Value, WireError>) -> io::Result<()> {
|
||||
let mut value = json!({"type":"response","sessionId":self.session,"requestId":id});
|
||||
match result {
|
||||
Ok(r) => value["result"] = r,
|
||||
Err(e) => value["error"] = serde_json::to_value(e)?,
|
||||
}
|
||||
self.send(value)
|
||||
}
|
||||
}
|
||||
|
||||
enum Line {
|
||||
Data(Vec<u8>),
|
||||
Oversized,
|
||||
Truncated,
|
||||
Eof,
|
||||
}
|
||||
|
||||
/// Consume at most one line without ever accumulating more than the configured bound.
|
||||
fn read_line(reader: &mut impl BufRead, limit: usize) -> io::Result<Line> {
|
||||
let mut bytes = Vec::new();
|
||||
let mut oversized = false;
|
||||
loop {
|
||||
let chunk = reader.fill_buf()?;
|
||||
if chunk.is_empty() {
|
||||
return Ok(if oversized {
|
||||
Line::Oversized
|
||||
} else if bytes.is_empty() {
|
||||
Line::Eof
|
||||
} else {
|
||||
Line::Truncated
|
||||
});
|
||||
}
|
||||
let newline = chunk.iter().position(|b| *b == b'\n');
|
||||
let length = newline.unwrap_or(chunk.len());
|
||||
if !oversized {
|
||||
if length > limit.saturating_sub(bytes.len()) {
|
||||
oversized = true;
|
||||
bytes.clear();
|
||||
} else {
|
||||
bytes.extend_from_slice(&chunk[..length]);
|
||||
}
|
||||
}
|
||||
reader.consume(length + usize::from(newline.is_some()));
|
||||
if newline.is_some() {
|
||||
if bytes.last() == Some(&b'\r') {
|
||||
bytes.pop();
|
||||
}
|
||||
return Ok(if oversized { Line::Oversized } else { Line::Data(bytes) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn read_commands<R: BufRead, W: Write>(
|
||||
mut input: R,
|
||||
output: &Output<W>,
|
||||
control: &Mutex<Control>,
|
||||
sender: &mpsc::Sender<Job>,
|
||||
limits: &Limits,
|
||||
) -> io::Result<()> {
|
||||
let mut initialized = false;
|
||||
loop {
|
||||
let bytes = match read_line(&mut input, limits.max_command_bytes)? {
|
||||
Line::Eof => break,
|
||||
Line::Truncated => {
|
||||
output.reply(None, Err(WireError::new("invalid_request", "EOF before LF")))?;
|
||||
break;
|
||||
}
|
||||
Line::Oversized => {
|
||||
output.reply(
|
||||
None,
|
||||
Err(WireError::new("request_too_large", "command exceeds configured limit")),
|
||||
)?;
|
||||
continue;
|
||||
}
|
||||
Line::Data(bytes) => bytes,
|
||||
};
|
||||
let raw: Value = match serde_json::from_slice(&bytes) {
|
||||
Ok(value) => value,
|
||||
Err(error) => {
|
||||
output.reply(None, Err(WireError::new("invalid_request", error.to_string())))?;
|
||||
continue;
|
||||
}
|
||||
};
|
||||
let id = raw
|
||||
.get("requestId")
|
||||
.and_then(Value::as_str)
|
||||
.filter(|id| wire::valid_id(id))
|
||||
.map(str::to_owned);
|
||||
let request = serde_json::from_value::<Request>(raw)
|
||||
.map_err(|e| WireError::new("invalid_request", e.to_string()))
|
||||
.and_then(wire::parse);
|
||||
let (id, command) = match request {
|
||||
Ok(value) => value,
|
||||
Err(error) => {
|
||||
output.reply(id.as_deref(), Err(error))?;
|
||||
continue;
|
||||
}
|
||||
};
|
||||
if let Command::Shutdown = command {
|
||||
let mut c = control.lock().unwrap();
|
||||
c.canceled = true;
|
||||
sender.send(Job::Stop(Some(id))).map_err(|_| io::Error::other("execution stopped"))?;
|
||||
return Ok(());
|
||||
}
|
||||
if let Command::Initialize(params) = command {
|
||||
let result = if initialized {
|
||||
Err(WireError::new("already_initialized", "session already initialized"))
|
||||
} else if params.protocol_version.major != 1 {
|
||||
Err(WireError::new("incompatible_version", "protocol major must be 1"))
|
||||
} else if params
|
||||
.required_capabilities
|
||||
.iter()
|
||||
.any(|c| !CAPABILITIES.contains(&c.as_str()))
|
||||
{
|
||||
Err(WireError::new("unsupported_capability", "required capability unavailable"))
|
||||
} else {
|
||||
initialized = true;
|
||||
Ok(json!({"protocolVersion":{"major":1,"minor":0},"capabilities":CAPABILITIES}))
|
||||
};
|
||||
output.reply(Some(&id), result)?;
|
||||
continue;
|
||||
}
|
||||
if !initialized {
|
||||
output.reply(Some(&id), Err(WireError::new("not_initialized", "initialize first")))?;
|
||||
continue;
|
||||
}
|
||||
let mut c = control.lock().unwrap();
|
||||
if let Command::Cancel(params) = command {
|
||||
let result = if c.advancing && c.active.as_deref() == Some(¶ms.target_request_id) {
|
||||
c.canceled = true;
|
||||
Ok(json!({"targetRequestId":params.target_request_id,"requested":true}))
|
||||
} else {
|
||||
Err(WireError::new("not_cancelable", "no matching active advance"))
|
||||
};
|
||||
output.reply(Some(&id), result)?;
|
||||
continue;
|
||||
}
|
||||
if c.active.is_some() {
|
||||
output.reply(Some(&id), Err(WireError::new("busy", "a host operation is active")))?;
|
||||
continue;
|
||||
}
|
||||
if let Command::Advance(params) = &command
|
||||
&& params.frames > limits.max_frames
|
||||
{
|
||||
output.reply(
|
||||
Some(&id),
|
||||
Err(WireError::new("limit_exceeded", "frames exceeds maxFrames")),
|
||||
)?;
|
||||
continue;
|
||||
}
|
||||
c.active = Some(id.clone());
|
||||
c.advancing = matches!(command, Command::Advance(_));
|
||||
c.canceled = false;
|
||||
sender.send(Job::Work(id, command)).map_err(|_| io::Error::other("execution stopped"))?;
|
||||
}
|
||||
let mut c = control.lock().unwrap();
|
||||
c.canceled = true;
|
||||
sender.send(Job::Stop(None)).map_err(|_| io::Error::other("execution stopped"))
|
||||
}
|
||||
|
||||
fn execute<W: Write>(
|
||||
host: &mut HeadlessHost,
|
||||
command: Command,
|
||||
id: &str,
|
||||
output: &Output<W>,
|
||||
control: &Mutex<Control>,
|
||||
) -> io::Result<Result<Value, WireError>> {
|
||||
Ok(match command {
|
||||
Command::Boot(p) => {
|
||||
host.boot(p.path).map(|()| wire::state(host.get_state())).map_err(wire::host_error)
|
||||
}
|
||||
Command::Reset => {
|
||||
host.reset();
|
||||
Ok(wire::state(host.get_state()))
|
||||
}
|
||||
Command::SetInput(p) => {
|
||||
host.set_input(p.into());
|
||||
Ok(json!({}))
|
||||
}
|
||||
Command::ClearInput => {
|
||||
host.clear_input();
|
||||
Ok(json!({}))
|
||||
}
|
||||
Command::GetState => Ok(wire::state(host.get_state())),
|
||||
Command::GetFault => Ok(host.get_fault().as_ref().map(wire::fault).unwrap_or(Value::Null)),
|
||||
Command::Capture => host.capture_frame().map_err(wire::host_error).and_then(wire::capture),
|
||||
Command::Advance(p) => {
|
||||
let mut result = json!({"requested":p.frames,"completed":0,"stop":"completed"});
|
||||
for completed in 0..p.frames {
|
||||
if control.lock().unwrap().canceled {
|
||||
result["stop"] = json!("canceled");
|
||||
break;
|
||||
}
|
||||
match host.advance_frame() {
|
||||
Ok(AdvanceFrameOutcome::FrameCompleted { .. }) => {
|
||||
result["completed"] = json!(completed + 1);
|
||||
output.send(
|
||||
json!({"type":"progress","sessionId":output.session,"requestId":id,
|
||||
"requested":p.frames,"completed":completed + 1}),
|
||||
)?;
|
||||
}
|
||||
Ok(AdvanceFrameOutcome::Faulted(report)) => {
|
||||
result["stop"] = json!("faulted");
|
||||
result["fault"] = wire::fault(&report);
|
||||
break;
|
||||
}
|
||||
Ok(AdvanceFrameOutcome::Terminated) => {
|
||||
result["stop"] = json!("terminated");
|
||||
break;
|
||||
}
|
||||
Err(error) => {
|
||||
result["stop"] = json!("host_error");
|
||||
result["error"] = serde_json::to_value(wire::host_error(error))?;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(result)
|
||||
}
|
||||
_ => unreachable!("reader handles control commands"),
|
||||
})
|
||||
}
|
||||
|
||||
/// Serve one process session. The input reader stays responsive while the owner
|
||||
/// executes a frame. On fatal output failure the process caller must exit; a
|
||||
/// blocking OS stdin reader cannot be joined until that input is closed.
|
||||
pub fn serve<R: BufRead + Send + 'static, W: Write + Send + 'static>(
|
||||
input: R,
|
||||
writer: W,
|
||||
limits: Limits,
|
||||
runtime_version: &str,
|
||||
) -> io::Result<()> {
|
||||
limits.validate()?;
|
||||
let mut random = [0u8; 16];
|
||||
getrandom::fill(&mut random).map_err(|e| io::Error::other(e.to_string()))?;
|
||||
let session: String = random.iter().map(|v| format!("{v:02x}")).collect();
|
||||
let output =
|
||||
Arc::new(Output { writer: Mutex::new(writer), session, limit: limits.max_response_bytes });
|
||||
output.send(
|
||||
json!({"type":"hello","sessionId":output.session,"protocolVersion":{"major":1,"minor":0},
|
||||
"runtimeVersion":runtime_version,"capabilities":CAPABILITIES,"limits":limits}),
|
||||
)?;
|
||||
let control = Arc::new(Mutex::new(Control::default()));
|
||||
let (sender, receiver) = mpsc::channel();
|
||||
let reader_output = output.clone();
|
||||
let reader_control = control.clone();
|
||||
let reader = std::thread::spawn(move || {
|
||||
if let Err(error) = read_commands(input, &reader_output, &reader_control, &sender, &limits)
|
||||
{
|
||||
reader_control.lock().unwrap().canceled = true;
|
||||
let _ = sender.send(Job::ReadError(error));
|
||||
}
|
||||
});
|
||||
let mut host = HeadlessHost::new();
|
||||
while let Ok(job) = receiver.recv() {
|
||||
match job {
|
||||
Job::Work(id, command) => {
|
||||
let result = execute(&mut host, command, &id, &output, &control)?;
|
||||
// Release authority under the same lock as response publication:
|
||||
// a client reacting to this reply cannot race a stale busy flag.
|
||||
let mut c = control.lock().unwrap();
|
||||
output.reply(Some(&id), result)?;
|
||||
c.active = None;
|
||||
c.advancing = false;
|
||||
}
|
||||
Job::Stop(id) => {
|
||||
drop(host);
|
||||
if let Some(id) = id {
|
||||
output.reply(Some(&id), Ok(json!({"closed":true})))?;
|
||||
}
|
||||
reader.join().map_err(|_| io::Error::other("input reader panicked"))?;
|
||||
return Ok(());
|
||||
}
|
||||
Job::ReadError(error) => return Err(error),
|
||||
}
|
||||
}
|
||||
reader.join().map_err(|_| io::Error::other("input reader panicked"))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::io::{BufReader, Cursor};
|
||||
|
||||
#[test]
|
||||
fn bounded_lines_accept_fragmentation_and_recover_after_oversize() {
|
||||
let mut reader = BufReader::with_capacity(2, Cursor::new(b"12345\n123456\nok\r\n"));
|
||||
assert!(matches!(read_line(&mut reader, 5).unwrap(), Line::Data(v) if v == b"12345"));
|
||||
assert!(matches!(read_line(&mut reader, 5).unwrap(), Line::Oversized));
|
||||
assert!(matches!(read_line(&mut reader, 5).unwrap(), Line::Data(v) if v == b"ok"));
|
||||
assert!(matches!(read_line(&mut reader, 5).unwrap(), Line::Eof));
|
||||
assert!(matches!(read_line(&mut Cursor::new(b"no LF"), 10).unwrap(), Line::Truncated));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn input_snapshot_is_replacement_and_rejects_unknown_fields() {
|
||||
let input: wire::Input = serde_json::from_value(json!({"right":true})).unwrap();
|
||||
let signals: prometeu_hal::InputSignals = input.into();
|
||||
assert!(signals.right_signal);
|
||||
assert!(!signals.left_signal);
|
||||
assert_eq!(signals.x_pos, 0);
|
||||
assert!(serde_json::from_value::<wire::Input>(json!({"rigth":true})).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn response_limit_counts_the_complete_envelope_and_keeps_correlation() {
|
||||
let output =
|
||||
Output { writer: Mutex::new(Vec::new()), session: "session".into(), limit: 4096 };
|
||||
output.reply(Some("capture"), Ok(json!({"data":"x".repeat(4096)}))).unwrap();
|
||||
let bytes = output.writer.into_inner().unwrap();
|
||||
assert!(bytes.len() <= 4097);
|
||||
let result: Value = serde_json::from_slice(&bytes).unwrap();
|
||||
assert_eq!(result["requestId"], "capture");
|
||||
assert_eq!(result["sessionId"], "session");
|
||||
assert_eq!(result["error"]["code"], "response_too_large");
|
||||
assert!(result.get("result").is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn distributed_request_fixtures_are_accepted_by_the_actual_parser() {
|
||||
let requests: Vec<Value> = serde_json::from_str(include_str!(
|
||||
"../../../../../devtools/headless-protocol/requests.json"
|
||||
))
|
||||
.unwrap();
|
||||
assert_eq!(requests.len(), 11);
|
||||
for request in requests {
|
||||
wire::parse(serde_json::from_value(request).unwrap()).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn capture_preserves_independent_ids_and_excludes_padding_without_channel_loss() {
|
||||
use base64::Engine as _;
|
||||
use prometeu_hal::app_mode::AppMode;
|
||||
use prometeu_hal::{FrameId, OwnedRgba8888Frame, RenderOwnership};
|
||||
let frame = OwnedRgba8888Frame::new(
|
||||
FrameId::new(91),
|
||||
RenderOwnership::new(1, AppMode::Game, 41),
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
vec![0x12345678, 0xffffffff, 0xabcdef01, 0xffffffff],
|
||||
)
|
||||
.unwrap();
|
||||
let capture =
|
||||
wire::capture(crate::CapturedFrame { logical_frame_index: 7, frame }).unwrap();
|
||||
assert_eq!(capture["logicalFrameIndex"], 7);
|
||||
assert_eq!(capture["frameId"], 91);
|
||||
assert_eq!(capture["stridePixels"], 2);
|
||||
let png = base64::engine::general_purpose::STANDARD
|
||||
.decode(capture["data"].as_str().unwrap())
|
||||
.unwrap();
|
||||
let mut reader = png::Decoder::new(Cursor::new(png)).read_info().unwrap();
|
||||
let mut bytes = vec![0; reader.output_buffer_size()];
|
||||
let info = reader.next_frame(&mut bytes).unwrap();
|
||||
assert_eq!((info.width, info.height), (1, 2));
|
||||
assert_eq!(&bytes[..info.buffer_size()], &[0x12, 0x34, 0x56, 0x78, 0xab, 0xcd, 0xef, 0x01]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,330 @@
|
||||
use base64::{Engine as _, engine::general_purpose::STANDARD};
|
||||
use prometeu_bytecode::Value as VmValue;
|
||||
use prometeu_hal::InputSignals;
|
||||
use prometeu_system::CrashReport;
|
||||
use prometeu_vm::VmInitError;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{Value, json};
|
||||
use std::io;
|
||||
|
||||
use crate::{CapturedFrame, HostError, HostExecutionStatus, HostState};
|
||||
|
||||
pub const CAPABILITIES: &[&str] = &[
|
||||
"boot",
|
||||
"reset",
|
||||
"set_input",
|
||||
"clear_input",
|
||||
"advance",
|
||||
"capture",
|
||||
"get_state",
|
||||
"get_fault",
|
||||
"cancel",
|
||||
"shutdown",
|
||||
];
|
||||
|
||||
#[derive(Clone, Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Limits {
|
||||
pub max_frames: u64,
|
||||
pub max_command_bytes: usize,
|
||||
pub max_response_bytes: usize,
|
||||
pub handshake_timeout_ms: u64,
|
||||
pub call_timeout_ms: u64,
|
||||
pub shutdown_timeout_ms: u64,
|
||||
}
|
||||
|
||||
impl Default for Limits {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
max_frames: 600,
|
||||
max_command_bytes: 64 * 1024,
|
||||
max_response_bytes: 32 * 1024 * 1024,
|
||||
handshake_timeout_ms: 5_000,
|
||||
call_timeout_ms: 60_000,
|
||||
shutdown_timeout_ms: 5_000,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Limits {
|
||||
pub fn validate(&self) -> io::Result<()> {
|
||||
if self.max_frames == 0
|
||||
|| self.max_command_bytes < 4096
|
||||
|| self.max_response_bytes < 4096
|
||||
|| self.handshake_timeout_ms == 0
|
||||
|| self.call_timeout_ms == 0
|
||||
|| self.shutdown_timeout_ms == 0
|
||||
{
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::InvalidInput,
|
||||
"limits must be positive and message bounds at least 4096 bytes",
|
||||
));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(deny_unknown_fields, rename_all = "camelCase")]
|
||||
pub(super) struct Request {
|
||||
pub request_id: String,
|
||||
pub command: String,
|
||||
pub params: Value,
|
||||
}
|
||||
|
||||
pub(super) fn valid_id(id: &str) -> bool {
|
||||
!id.is_empty() && id.len() <= 128
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub(super) struct Version {
|
||||
pub major: u32,
|
||||
pub minor: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(deny_unknown_fields, rename_all = "camelCase")]
|
||||
pub(super) struct Initialize {
|
||||
pub protocol_version: Version,
|
||||
pub required_capabilities: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub(super) struct Boot {
|
||||
pub path: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub(super) struct Advance {
|
||||
pub frames: u64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(deny_unknown_fields, rename_all = "camelCase")]
|
||||
pub(super) struct Cancel {
|
||||
pub target_request_id: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize)]
|
||||
#[serde(default, deny_unknown_fields, rename_all = "camelCase")]
|
||||
pub(super) struct Input {
|
||||
up: bool,
|
||||
down: bool,
|
||||
left: bool,
|
||||
right: bool,
|
||||
a: bool,
|
||||
b: bool,
|
||||
x: bool,
|
||||
y: bool,
|
||||
l: bool,
|
||||
r: bool,
|
||||
start: bool,
|
||||
select: bool,
|
||||
touch: bool,
|
||||
touch_x: i32,
|
||||
touch_y: i32,
|
||||
}
|
||||
|
||||
impl From<Input> for InputSignals {
|
||||
fn from(s: Input) -> Self {
|
||||
Self {
|
||||
up_signal: s.up,
|
||||
down_signal: s.down,
|
||||
left_signal: s.left,
|
||||
right_signal: s.right,
|
||||
a_signal: s.a,
|
||||
b_signal: s.b,
|
||||
x_signal: s.x,
|
||||
y_signal: s.y,
|
||||
l_signal: s.l,
|
||||
r_signal: s.r,
|
||||
start_signal: s.start,
|
||||
select_signal: s.select,
|
||||
f_signal: s.touch,
|
||||
x_pos: s.touch_x,
|
||||
y_pos: s.touch_y,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(super) enum Command {
|
||||
Initialize(Initialize),
|
||||
Boot(Boot),
|
||||
Reset,
|
||||
SetInput(Input),
|
||||
ClearInput,
|
||||
Advance(Advance),
|
||||
Capture,
|
||||
GetState,
|
||||
GetFault,
|
||||
Cancel(Cancel),
|
||||
Shutdown,
|
||||
}
|
||||
|
||||
fn params<T: serde::de::DeserializeOwned>(value: Value) -> Result<T, WireError> {
|
||||
serde_json::from_value(value).map_err(|e| WireError::new("invalid_params", e.to_string()))
|
||||
}
|
||||
|
||||
fn empty(value: &Value) -> Result<(), WireError> {
|
||||
if value.as_object().is_some_and(|v| v.is_empty()) {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(WireError::new("invalid_params", "expected an empty params object"))
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn parse(req: Request) -> Result<(String, Command), WireError> {
|
||||
if !valid_id(&req.request_id) {
|
||||
return Err(WireError::new("invalid_request", "requestId must contain 1..128 UTF-8 bytes"));
|
||||
}
|
||||
let command = match req.command.as_str() {
|
||||
"initialize" => Command::Initialize(params(req.params)?),
|
||||
"boot" => {
|
||||
let p: Boot = params(req.params)?;
|
||||
if p.path.trim().is_empty() {
|
||||
return Err(WireError::new("invalid_params", "path is empty"));
|
||||
}
|
||||
Command::Boot(p)
|
||||
}
|
||||
"advance" => Command::Advance(params(req.params)?),
|
||||
"set_input" => Command::SetInput(params(req.params)?),
|
||||
"cancel" => {
|
||||
let p: Cancel = params(req.params)?;
|
||||
if !valid_id(&p.target_request_id) {
|
||||
return Err(WireError::new("invalid_params", "invalid targetRequestId"));
|
||||
}
|
||||
Command::Cancel(p)
|
||||
}
|
||||
"reset" | "clear_input" | "capture" | "get_state" | "get_fault" | "shutdown" => {
|
||||
empty(&req.params)?;
|
||||
match req.command.as_str() {
|
||||
"reset" => Command::Reset,
|
||||
"clear_input" => Command::ClearInput,
|
||||
"capture" => Command::Capture,
|
||||
"get_state" => Command::GetState,
|
||||
"get_fault" => Command::GetFault,
|
||||
_ => Command::Shutdown,
|
||||
}
|
||||
}
|
||||
_ => return Err(WireError::new("unknown_command", "unknown command")),
|
||||
};
|
||||
Ok((req.request_id, command))
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub(super) struct WireError {
|
||||
pub code: &'static str,
|
||||
pub message: String,
|
||||
pub details: Value,
|
||||
}
|
||||
|
||||
impl WireError {
|
||||
pub fn new(code: &'static str, message: impl Into<String>) -> Self {
|
||||
Self { code, message: message.into(), details: json!({}) }
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn host_error(error: HostError) -> WireError {
|
||||
let (code, details) = match &error {
|
||||
HostError::AlreadyBooted => ("already_booted", json!({})),
|
||||
HostError::BootFailed { reason, report } => {
|
||||
("boot_failed", json!({"reason":reason,"fault":report.as_ref().map(fault)}))
|
||||
}
|
||||
HostError::InvalidState { operation, status } => {
|
||||
("invalid_state", json!({"operation":operation,"status":status_name(*status)}))
|
||||
}
|
||||
HostError::FrameAdvanceWatchdogExpired { host_tick_limit } => {
|
||||
("watchdog_expired", json!({"hostTickLimit":host_tick_limit}))
|
||||
}
|
||||
HostError::FrameNotPublished { previous } => {
|
||||
("frame_not_published", json!({"previousFrameId":previous.map(|id| id.get())}))
|
||||
}
|
||||
HostError::NoFrameAvailable => ("no_frame_available", json!({})),
|
||||
};
|
||||
WireError { code, message: error.to_string(), details }
|
||||
}
|
||||
|
||||
fn status_name(status: HostExecutionStatus) -> &'static str {
|
||||
match status {
|
||||
HostExecutionStatus::Running => "running",
|
||||
HostExecutionStatus::Paused => "paused",
|
||||
HostExecutionStatus::Terminated => "terminated",
|
||||
HostExecutionStatus::Faulted => "faulted",
|
||||
}
|
||||
}
|
||||
|
||||
fn stack_value(value: &VmValue) -> Value {
|
||||
match value {
|
||||
VmValue::Int32(v) => json!({"kind":"int32","value":v}),
|
||||
VmValue::Int64(v) => json!({"kind":"int64","value":v.to_string()}),
|
||||
VmValue::Float(v) => json!({"kind":"float64","value":v.to_string()}),
|
||||
VmValue::Boolean(v) => json!({"kind":"boolean","value":v}),
|
||||
VmValue::String(v) => json!({"kind":"string","value":v.as_ref()}),
|
||||
VmValue::HeapRef(v) => json!({"kind":"heap_ref","value":v.0}),
|
||||
VmValue::Null => json!({"kind":"null","value":null}),
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn state(s: HostState) -> Value {
|
||||
json!({"pc":s.pc,"stackTop":s.stack_top.iter().map(stack_value).collect::<Vec<_>>(),
|
||||
"logicalFrameIndex":s.frame_index,"tickIndex":s.tick_index,"appId":s.app_id,
|
||||
"status":status_name(s.status)})
|
||||
}
|
||||
|
||||
pub(super) fn fault(report: &CrashReport) -> Value {
|
||||
let mut result = json!({"kind":report.kind(),"pc":report.pc(),"summary":report.summary()});
|
||||
match report {
|
||||
CrashReport::VmTrap { trap } => {
|
||||
result["trap"] = json!({"code":trap.code,"opcode":trap.opcode,
|
||||
"message":trap.message,"pc":trap.pc,"span":trap.span});
|
||||
}
|
||||
CrashReport::VmPanic { message, .. } => {
|
||||
result["message"] = json!(message);
|
||||
}
|
||||
CrashReport::VmInit { error } => {
|
||||
let code = match error {
|
||||
VmInitError::InvalidFormat => "invalid_format",
|
||||
VmInitError::UnsupportedFormat => "unsupported_format",
|
||||
VmInitError::ImageLoadFailed(_) => "image_load_failed",
|
||||
VmInitError::LoaderPatchFailed(_) => "loader_patch_failed",
|
||||
VmInitError::EntrypointNotFound => "entrypoint_not_found",
|
||||
VmInitError::VerificationFailed(_) => "verification_failed",
|
||||
};
|
||||
result["initError"] = json!({"code":code,"message":format!("{error:?}")});
|
||||
}
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
pub(super) fn capture(c: CapturedFrame) -> Result<Value, WireError> {
|
||||
let frame = c.frame;
|
||||
let width = u32::try_from(frame.width)
|
||||
.map_err(|_| WireError::new("capture_failed", "width exceeds PNG limit"))?;
|
||||
let height = u32::try_from(frame.height)
|
||||
.map_err(|_| WireError::new("capture_failed", "height exceeds PNG limit"))?;
|
||||
let mut rgba = Vec::new();
|
||||
for y in 0..frame.height {
|
||||
for pixel in frame.row(y).ok_or_else(|| WireError::new("capture_failed", "invalid row"))? {
|
||||
rgba.extend_from_slice(&pixel.to_be_bytes());
|
||||
}
|
||||
}
|
||||
let mut bytes = Vec::new();
|
||||
{
|
||||
let mut encoder = png::Encoder::new(&mut bytes, width, height);
|
||||
encoder.set_color(png::ColorType::Rgba);
|
||||
encoder.set_depth(png::BitDepth::Eight);
|
||||
let mut writer =
|
||||
encoder.write_header().map_err(|e| WireError::new("capture_failed", e.to_string()))?;
|
||||
writer
|
||||
.write_image_data(&rgba)
|
||||
.map_err(|e| WireError::new("capture_failed", e.to_string()))?;
|
||||
writer.finish().map_err(|e| WireError::new("capture_failed", e.to_string()))?;
|
||||
}
|
||||
Ok(json!({"mimeType":"image/png","encoding":"base64","data":STANDARD.encode(bytes),
|
||||
"width":width,"height":height,"stridePixels":frame.stride_pixels,"pixelFormat":"RGBA8888",
|
||||
"logicalFrameIndex":c.logical_frame_index,"frameId":frame.frame_id.get()}))
|
||||
}
|
||||
@@ -0,0 +1,497 @@
|
||||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
|
||||
use prometeu_bytecode::Value;
|
||||
use prometeu_drivers::MemoryBanks;
|
||||
use prometeu_drivers::hardware::Hardware;
|
||||
use prometeu_firmware::firmware_state::{AppCrashesStep, ResetStep};
|
||||
use prometeu_firmware::{BootTarget, Firmware, FirmwareState};
|
||||
use prometeu_hal::{
|
||||
AssetBridge, AudioBridge, FrameId, Game2DFrameComposer, InputPlatform, InputSignals,
|
||||
OwnedRgba8888Frame, RenderBackend, RenderSubmission, RenderSubmissionSink, RenderSubmitError,
|
||||
RuntimePlatform, TelemetryPlatform,
|
||||
};
|
||||
use prometeu_system::{CrashReport, LatestRenderFrameStore};
|
||||
|
||||
const BOOT_TICK_LIMIT: usize = 64;
|
||||
const HOST_FRAME_ADVANCE_TICK_LIMIT: usize = 100_000;
|
||||
|
||||
/// One published logical frame plus the automation counter.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct CapturedFrame {
|
||||
pub logical_frame_index: u64,
|
||||
pub frame: OwnedRgba8888Frame,
|
||||
}
|
||||
|
||||
/// Debugger-shaped execution snapshot.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct HostState {
|
||||
pub pc: usize,
|
||||
pub stack_top: Vec<Value>,
|
||||
pub frame_index: u64,
|
||||
pub tick_index: u64,
|
||||
pub app_id: u32,
|
||||
pub status: HostExecutionStatus,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum HostExecutionStatus {
|
||||
Running,
|
||||
Paused,
|
||||
Terminated,
|
||||
Faulted,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum AdvanceFrameOutcome {
|
||||
FrameCompleted { logical_frame_index: u64, frame_id: FrameId },
|
||||
Faulted(CrashReport),
|
||||
Terminated,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum AdvanceFramesStop {
|
||||
Completed,
|
||||
Faulted(CrashReport),
|
||||
Terminated,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct AdvanceFramesOutcome {
|
||||
pub requested: u64,
|
||||
pub completed: u64,
|
||||
pub stop: AdvanceFramesStop,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum HostError {
|
||||
AlreadyBooted,
|
||||
BootFailed { reason: String, report: Option<CrashReport> },
|
||||
InvalidState { operation: &'static str, status: HostExecutionStatus },
|
||||
FrameAdvanceWatchdogExpired { host_tick_limit: usize },
|
||||
FrameNotPublished { previous: Option<FrameId> },
|
||||
NoFrameAvailable,
|
||||
}
|
||||
|
||||
impl fmt::Display for HostError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::AlreadyBooted => write!(f, "boot requires reset before another attempt"),
|
||||
Self::BootFailed { reason, .. } => write!(f, "boot failed: {reason}"),
|
||||
Self::InvalidState { operation, status } => {
|
||||
write!(f, "{operation} is invalid while execution is {status:?}")
|
||||
}
|
||||
Self::FrameAdvanceWatchdogExpired { host_tick_limit } => {
|
||||
write!(
|
||||
f,
|
||||
"headless host frame-advance watchdog expired after {host_tick_limit} firmware ticks"
|
||||
)
|
||||
}
|
||||
Self::FrameNotPublished { .. } => {
|
||||
write!(f, "logical frame closed without its canonical published frame")
|
||||
}
|
||||
Self::NoFrameAvailable => write!(f, "no completed frame is available for capture"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for HostError {}
|
||||
|
||||
/// In-process host. The desktop winit runner is a separate crate and is not linked here.
|
||||
pub struct HeadlessHost {
|
||||
firmware: Firmware,
|
||||
platform: HeadlessPlatform,
|
||||
signals: InputSignals,
|
||||
boot_attempted: bool,
|
||||
last_completed_frame: Option<CompletedFrame>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
struct CompletedFrame {
|
||||
logical_frame_index: u64,
|
||||
frame_id: FrameId,
|
||||
}
|
||||
|
||||
struct HeadlessPlatform {
|
||||
hardware: Hardware,
|
||||
store: LatestRenderFrameStore,
|
||||
}
|
||||
|
||||
impl HeadlessHost {
|
||||
pub fn new() -> Self {
|
||||
let memory_banks = Arc::new(MemoryBanks::new());
|
||||
let hardware = Hardware::new_with_memory_banks(Arc::clone(&memory_banks));
|
||||
let store = LatestRenderFrameStore::default();
|
||||
Self {
|
||||
firmware: Firmware::new(None),
|
||||
platform: HeadlessPlatform { hardware, store },
|
||||
signals: InputSignals::default(),
|
||||
boot_attempted: false,
|
||||
last_completed_frame: None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Load `path` and tick until the firmware is in `GameRunning`.
|
||||
///
|
||||
/// The transition into `GameRunning` is the last tick. The first game
|
||||
/// logical frame stays available for [`Self::advance_frame`].
|
||||
pub fn boot(&mut self, path: impl Into<String>) -> Result<(), HostError> {
|
||||
if self.boot_attempted {
|
||||
return Err(HostError::AlreadyBooted);
|
||||
}
|
||||
self.boot_attempted = true;
|
||||
let path = path.into();
|
||||
self.firmware.boot_target = BootTarget::Cartridge { path, debug: false, debug_port: 7777 };
|
||||
|
||||
for _ in 0..BOOT_TICK_LIMIT {
|
||||
if matches!(self.firmware.state, FirmwareState::GameRunning(_)) {
|
||||
return Ok(());
|
||||
}
|
||||
if matches!(self.firmware.state, FirmwareState::AppCrashes(_)) {
|
||||
let report = self.get_fault();
|
||||
let reason = report
|
||||
.as_ref()
|
||||
.map(CrashReport::summary)
|
||||
.unwrap_or_else(|| "cartridge crashed during boot".to_string());
|
||||
return Err(HostError::BootFailed { reason, report });
|
||||
}
|
||||
if matches!(self.firmware.state, FirmwareState::HubHome(_)) {
|
||||
return Err(HostError::BootFailed {
|
||||
reason: "cartridge did not load".to_string(),
|
||||
report: None,
|
||||
});
|
||||
}
|
||||
self.tick_once();
|
||||
}
|
||||
|
||||
if matches!(self.firmware.state, FirmwareState::GameRunning(_)) {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(HostError::BootFailed {
|
||||
reason: "boot did not reach the game".to_string(),
|
||||
report: self.get_fault(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub fn reset(&mut self) {
|
||||
self.signals = InputSignals::default();
|
||||
self.firmware.change_state(
|
||||
FirmwareState::Reset(ResetStep),
|
||||
&self.signals,
|
||||
&mut self.platform,
|
||||
);
|
||||
self.platform.store = LatestRenderFrameStore::default();
|
||||
self.boot_attempted = false;
|
||||
self.last_completed_frame = None;
|
||||
}
|
||||
|
||||
pub fn pause(&mut self) -> Result<(), HostError> {
|
||||
self.require_active("pause")?;
|
||||
self.firmware.os.vm().set_paused(true);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn resume(&mut self) -> Result<(), HostError> {
|
||||
self.require_active("resume")?;
|
||||
self.firmware.os.vm().set_paused(false);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Execute one VM instruction. This does not close a logical frame.
|
||||
pub fn step(&mut self) -> Result<Option<CrashReport>, HostError> {
|
||||
self.require_active("step")?;
|
||||
self.firmware.os.vm().set_paused(true);
|
||||
let report = self.firmware.os.vm().debug_step_active_session(&mut self.platform);
|
||||
self.platform.hardware.audio.clear_commands();
|
||||
Ok(report)
|
||||
}
|
||||
|
||||
pub fn advance_frame(&mut self) -> Result<AdvanceFrameOutcome, HostError> {
|
||||
if let Some(report) = self.get_fault() {
|
||||
return Ok(AdvanceFrameOutcome::Faulted(report));
|
||||
}
|
||||
if !matches!(self.firmware.state, FirmwareState::GameRunning(_)) {
|
||||
return Ok(AdvanceFrameOutcome::Terminated);
|
||||
}
|
||||
|
||||
let start = self.firmware.os.vm().logical_frame_index();
|
||||
let previous_frame_id = self.platform.store.latest_frame().map(|frame| frame.frame_id);
|
||||
self.firmware.os.vm().set_paused(false);
|
||||
self.firmware.os.vm().request_debug_step();
|
||||
|
||||
for _ in 0..HOST_FRAME_ADVANCE_TICK_LIMIT {
|
||||
self.tick_once();
|
||||
if let Some(report) = self.get_fault() {
|
||||
self.finish_frame_advance();
|
||||
return Ok(AdvanceFrameOutcome::Faulted(report));
|
||||
}
|
||||
if !matches!(self.firmware.state, FirmwareState::GameRunning(_)) {
|
||||
self.finish_frame_advance();
|
||||
return Ok(AdvanceFrameOutcome::Terminated);
|
||||
}
|
||||
|
||||
let logical_frame_index = self.firmware.os.vm().logical_frame_index();
|
||||
if logical_frame_index > start {
|
||||
self.finish_frame_advance();
|
||||
let frame = self
|
||||
.platform
|
||||
.store
|
||||
.latest_frame()
|
||||
.ok_or(HostError::FrameNotPublished { previous: previous_frame_id })?;
|
||||
if Some(frame.frame_id) == previous_frame_id {
|
||||
return Err(HostError::FrameNotPublished { previous: previous_frame_id });
|
||||
}
|
||||
self.last_completed_frame =
|
||||
Some(CompletedFrame { logical_frame_index, frame_id: frame.frame_id });
|
||||
return Ok(AdvanceFrameOutcome::FrameCompleted {
|
||||
logical_frame_index,
|
||||
frame_id: frame.frame_id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
self.finish_frame_advance();
|
||||
Err(HostError::FrameAdvanceWatchdogExpired {
|
||||
host_tick_limit: HOST_FRAME_ADVANCE_TICK_LIMIT,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn advance_frames(&mut self, count: u64) -> Result<AdvanceFramesOutcome, HostError> {
|
||||
let mut completed = 0;
|
||||
for _ in 0..count {
|
||||
match self.advance_frame()? {
|
||||
AdvanceFrameOutcome::FrameCompleted { .. } => completed += 1,
|
||||
AdvanceFrameOutcome::Faulted(report) => {
|
||||
return Ok(AdvanceFramesOutcome {
|
||||
requested: count,
|
||||
completed,
|
||||
stop: AdvanceFramesStop::Faulted(report),
|
||||
});
|
||||
}
|
||||
AdvanceFrameOutcome::Terminated => {
|
||||
return Ok(AdvanceFramesOutcome {
|
||||
requested: count,
|
||||
completed,
|
||||
stop: AdvanceFramesStop::Terminated,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(AdvanceFramesOutcome { requested: count, completed, stop: AdvanceFramesStop::Completed })
|
||||
}
|
||||
|
||||
pub fn set_input(&mut self, signals: InputSignals) {
|
||||
self.signals = signals;
|
||||
}
|
||||
|
||||
pub fn clear_input(&mut self) {
|
||||
self.signals = InputSignals::default();
|
||||
}
|
||||
|
||||
pub fn set_right(&mut self, down: bool) {
|
||||
self.signals.right_signal = down;
|
||||
}
|
||||
|
||||
pub fn capture_frame(&self) -> Result<CapturedFrame, HostError> {
|
||||
let completed = self.last_completed_frame.ok_or(HostError::NoFrameAvailable)?;
|
||||
let frame = self.platform.store.latest_frame().ok_or(HostError::NoFrameAvailable)?;
|
||||
if frame.frame_id != completed.frame_id {
|
||||
return Err(HostError::FrameNotPublished { previous: Some(completed.frame_id) });
|
||||
}
|
||||
Ok(CapturedFrame { logical_frame_index: completed.logical_frame_index, frame })
|
||||
}
|
||||
|
||||
pub fn get_state(&mut self) -> HostState {
|
||||
let status = self.execution_status();
|
||||
HostState {
|
||||
pc: self.firmware.os.vm().active_pc().unwrap_or(0),
|
||||
stack_top: self.firmware.os.vm().active_operand_stack_top(10),
|
||||
frame_index: self.firmware.os.vm().logical_frame_index(),
|
||||
tick_index: self.firmware.os.vm().tick_index(),
|
||||
app_id: self.firmware.os.vm().current_app_id(),
|
||||
status,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_fault(&mut self) -> Option<CrashReport> {
|
||||
if let Some(report) = self.firmware.os.vm().last_crash_report() {
|
||||
return Some(report.clone());
|
||||
}
|
||||
match &self.firmware.state {
|
||||
FirmwareState::AppCrashes(AppCrashesStep { report }) => Some(report.clone()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn tick_once(&mut self) {
|
||||
self.firmware.tick(&self.signals, &mut self.platform);
|
||||
self.platform.hardware.audio.clear_commands();
|
||||
}
|
||||
|
||||
fn execution_status(&mut self) -> HostExecutionStatus {
|
||||
if self.fault_is_visible() {
|
||||
HostExecutionStatus::Faulted
|
||||
} else if !matches!(self.firmware.state, FirmwareState::GameRunning(_)) {
|
||||
HostExecutionStatus::Terminated
|
||||
} else if self.firmware.os.vm().paused() {
|
||||
HostExecutionStatus::Paused
|
||||
} else {
|
||||
HostExecutionStatus::Running
|
||||
}
|
||||
}
|
||||
|
||||
fn fault_is_visible(&mut self) -> bool {
|
||||
self.firmware.os.vm().last_crash_report().is_some()
|
||||
|| matches!(self.firmware.state, FirmwareState::AppCrashes(_))
|
||||
}
|
||||
|
||||
fn require_active(&mut self, operation: &'static str) -> Result<(), HostError> {
|
||||
let status = self.execution_status();
|
||||
if matches!(status, HostExecutionStatus::Running | HostExecutionStatus::Paused) {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(HostError::InvalidState { operation, status })
|
||||
}
|
||||
}
|
||||
|
||||
fn finish_frame_advance(&mut self) {
|
||||
self.firmware.os.vm().set_paused(true);
|
||||
self.firmware.os.vm().clear_debug_step_request();
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for HeadlessHost {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl RenderSubmissionSink for HeadlessPlatform {
|
||||
fn submit_render_submission(
|
||||
&mut self,
|
||||
submission: RenderSubmission,
|
||||
) -> Result<(), RenderSubmitError> {
|
||||
let frame_id = submission.frame_id;
|
||||
let ownership = submission.ownership;
|
||||
self.hardware.submit_render_submission(submission)?;
|
||||
let (width, height) = self.hardware.gfx.size();
|
||||
let pixels = self.hardware.gfx.front_buffer().to_vec();
|
||||
let frame = OwnedRgba8888Frame::packed(frame_id, ownership, width, height, pixels)
|
||||
.map_err(|_| RenderSubmitError::SubmissionRejected)?;
|
||||
self.store.publish_frame(frame);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl RuntimePlatform for HeadlessPlatform {
|
||||
fn display_size(&self) -> (usize, usize) {
|
||||
(Hardware::W, Hardware::H)
|
||||
}
|
||||
|
||||
fn render_submission_sink(&mut self) -> &mut dyn RenderSubmissionSink {
|
||||
self
|
||||
}
|
||||
|
||||
fn render_backend(&mut self) -> &mut dyn RenderBackend {
|
||||
&mut self.hardware
|
||||
}
|
||||
|
||||
fn game2d_frame_composer(&mut self) -> &mut dyn Game2DFrameComposer {
|
||||
&mut self.hardware
|
||||
}
|
||||
|
||||
fn audio(&self) -> &dyn AudioBridge {
|
||||
self.hardware.audio()
|
||||
}
|
||||
|
||||
fn audio_mut(&mut self) -> &mut dyn AudioBridge {
|
||||
self.hardware.audio_mut()
|
||||
}
|
||||
|
||||
fn input(&self) -> &dyn InputPlatform {
|
||||
self.hardware.input()
|
||||
}
|
||||
|
||||
fn input_mut(&mut self) -> &mut dyn InputPlatform {
|
||||
self.hardware.input_mut()
|
||||
}
|
||||
|
||||
fn assets(&self) -> &dyn AssetBridge {
|
||||
self.hardware.assets()
|
||||
}
|
||||
|
||||
fn assets_mut(&mut self) -> &mut dyn AssetBridge {
|
||||
self.hardware.assets_mut()
|
||||
}
|
||||
|
||||
fn telemetry(&self) -> &dyn TelemetryPlatform {
|
||||
self.hardware.telemetry()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::fs;
|
||||
|
||||
use prometeu_bytecode::assembler::assemble;
|
||||
use prometeu_bytecode::model::{BytecodeModule, Export, FunctionMeta};
|
||||
|
||||
use super::{AdvanceFrameOutcome, HeadlessHost};
|
||||
|
||||
#[test]
|
||||
fn termination_during_frame_advance_clears_host_step_control() {
|
||||
let cartridge = non_closing_cartridge();
|
||||
let mut host = HeadlessHost::new();
|
||||
host.boot(cartridge.to_string_lossy()).expect("boot non-closing cartridge");
|
||||
host.firmware.request_home_from_host();
|
||||
|
||||
assert_eq!(
|
||||
host.advance_frame().expect("lifecycle termination"),
|
||||
AdvanceFrameOutcome::Terminated
|
||||
);
|
||||
assert!(host.firmware.os.vm().paused());
|
||||
assert!(!host.firmware.os.vm().debug_step_requested());
|
||||
|
||||
fs::remove_dir_all(cartridge).expect("remove test cartridge");
|
||||
}
|
||||
|
||||
fn non_closing_cartridge() -> std::path::PathBuf {
|
||||
let directory = std::env::temp_dir().join(format!(
|
||||
"prometeu-headless-termination-cleanup-{}-{}",
|
||||
std::process::id(),
|
||||
std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.expect("system clock")
|
||||
.as_nanos()
|
||||
));
|
||||
fs::create_dir_all(&directory).expect("create test cartridge");
|
||||
|
||||
let code = assemble("JMP 0\n").expect("assemble non-closing program");
|
||||
let module = BytecodeModule {
|
||||
version: 0,
|
||||
const_pool: vec![],
|
||||
functions: vec![FunctionMeta {
|
||||
code_offset: 0,
|
||||
code_len: code.len() as u32,
|
||||
param_slots: 0,
|
||||
local_slots: 0,
|
||||
return_slots: 0,
|
||||
max_stack_slots: 1,
|
||||
}],
|
||||
code,
|
||||
debug_info: None,
|
||||
exports: vec![Export { symbol: "main".into(), func_idx: 0 }],
|
||||
syscalls: vec![],
|
||||
}
|
||||
.serialize();
|
||||
fs::write(directory.join("program.pbx"), module).expect("write test program");
|
||||
fs::write(
|
||||
directory.join("manifest.json"),
|
||||
"{\n \"magic\": \"PMTU\",\n \"cartridge_version\": 1,\n \"app_id\": 91,\n \"title\": \"Termination Cleanup\",\n \"app_version\": \"0.1.0\",\n \"app_mode\": \"Game\",\n \"capabilities\": []\n}\n",
|
||||
)
|
||||
.expect("write test manifest");
|
||||
|
||||
directory
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
//! Headless Prometeu host.
|
||||
//!
|
||||
//! This crate boots a directory cartridge and steps logical frames in process.
|
||||
//! It does not open a window, a display surface, or an audio device.
|
||||
//!
|
||||
//! The desktop host's `stepFrame` command still advances on the 60 Hz winit loop.
|
||||
//! That pacing stays in `prometeu-host-desktop-winit` until a later protocol agenda.
|
||||
|
||||
pub mod automation;
|
||||
mod host;
|
||||
|
||||
pub use host::{
|
||||
AdvanceFrameOutcome, AdvanceFramesOutcome, AdvanceFramesStop, CapturedFrame, HeadlessHost,
|
||||
HostError, HostExecutionStatus, HostState,
|
||||
};
|
||||
@@ -0,0 +1,639 @@
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
use prometeu_bytecode::SourceSpan;
|
||||
use prometeu_bytecode::assembler::assemble;
|
||||
use prometeu_bytecode::model::{BytecodeModule, DebugInfo, Export, FunctionMeta, SyscallDecl};
|
||||
use prometeu_hal::InputSignals;
|
||||
use prometeu_hal::app_mode::AppMode;
|
||||
use prometeu_hal::color::Color;
|
||||
use prometeu_host_headless::{
|
||||
AdvanceFrameOutcome, AdvanceFramesStop, CapturedFrame, HeadlessHost, HostError,
|
||||
HostExecutionStatus, HostState,
|
||||
};
|
||||
use prometeu_system::CrashReport;
|
||||
|
||||
const RED: u32 = Color::RED.raw();
|
||||
const BLUE: u32 = Color::BLUE.raw();
|
||||
const GREEN: u32 = Color::GREEN.raw();
|
||||
const BLACK: u32 = Color::BLACK.raw();
|
||||
|
||||
#[test]
|
||||
fn headless_source_has_no_timing_wait_or_interactive_backend_dependency() {
|
||||
let source = include_str!("../src/host.rs");
|
||||
let manifest = include_str!("../Cargo.toml");
|
||||
|
||||
for forbidden in
|
||||
["FRAME_PUBLISH_SPINS", "spin_loop", "thread::sleep", "ensure_worker", "RenderWorkerConfig"]
|
||||
{
|
||||
assert!(!source.contains(forbidden), "headless source contains {forbidden}");
|
||||
}
|
||||
for forbidden in ["winit", "pixels", "cpal"] {
|
||||
assert!(!manifest.contains(forbidden), "headless manifest contains {forbidden}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lifecycle_state_and_preconditions_are_structural() {
|
||||
let mut host = HeadlessHost::new();
|
||||
assert_eq!(host.get_state().status, HostExecutionStatus::Terminated);
|
||||
assert_eq!(host.capture_frame(), Err(HostError::NoFrameAvailable));
|
||||
assert_eq!(
|
||||
host.pause(),
|
||||
Err(HostError::InvalidState {
|
||||
operation: "pause",
|
||||
status: HostExecutionStatus::Terminated,
|
||||
})
|
||||
);
|
||||
|
||||
let cartridge = color_cartridge();
|
||||
host.boot(&cartridge).expect("boot");
|
||||
let booted = host.get_state();
|
||||
assert_eq!(booted.status, HostExecutionStatus::Running);
|
||||
assert_eq!(booted.pc, 0, "boot must not execute the first game instruction");
|
||||
assert_eq!(host.boot(&cartridge), Err(HostError::AlreadyBooted));
|
||||
|
||||
host.pause().expect("pause");
|
||||
assert_eq!(host.get_state().status, HostExecutionStatus::Paused);
|
||||
host.resume().expect("resume");
|
||||
assert_eq!(host.get_state().status, HostExecutionStatus::Running);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn step_does_not_complete_a_logical_frame() {
|
||||
let mut host = boot_color();
|
||||
let before = host.get_state();
|
||||
assert_eq!(host.step().expect("step"), None);
|
||||
let after = host.get_state();
|
||||
assert_eq!(after.frame_index, before.frame_index);
|
||||
assert_ne!(after.pc, before.pc);
|
||||
assert_eq!(after.status, HostExecutionStatus::Paused);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stepping_frame_sync_is_not_a_fault_or_completed_runtime_frame() {
|
||||
let dir = temp_cart("step-frame-sync");
|
||||
write_cartridge(&dir, 51, "Step Frame Sync", &module(asm("FRAME_SYNC\nRET\n"), vec![]), &[]);
|
||||
let mut host = HeadlessHost::new();
|
||||
host.boot(&dir).expect("boot frame-sync cartridge");
|
||||
let before = host.get_state().frame_index;
|
||||
|
||||
assert_eq!(host.step().expect("step frame sync"), None);
|
||||
assert_eq!(host.get_state().frame_index, before);
|
||||
assert!(host.get_fault().is_none());
|
||||
assert_eq!(host.get_state().status, HostExecutionStatus::Paused);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn one_logical_frame_may_span_multiple_internal_ticks() {
|
||||
let dir = temp_cart("multi-tick");
|
||||
write_cartridge(&dir, 47, "Multi Tick", &multi_tick_program(), &[]);
|
||||
let mut host = HeadlessHost::new();
|
||||
host.boot(&dir).expect("boot multi-tick cartridge");
|
||||
let before = host.get_state();
|
||||
|
||||
completed(host.advance_frame().expect("multi-tick frame"));
|
||||
|
||||
let after = host.get_state();
|
||||
assert_eq!(after.frame_index, before.frame_index + 1);
|
||||
assert!(after.tick_index >= before.tick_index + 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn outer_frame_limit_is_a_host_error_and_finishes_paused() {
|
||||
let dir = temp_cart("frame-limit");
|
||||
write_cartridge(&dir, 50, "Frame Limit", &module(asm("JMP 0\n"), vec![]), &[]);
|
||||
let mut host = HeadlessHost::new();
|
||||
host.boot(&dir).expect("boot non-closing cartridge");
|
||||
|
||||
assert_eq!(
|
||||
host.advance_frame(),
|
||||
Err(HostError::FrameAdvanceWatchdogExpired { host_tick_limit: 100_000 })
|
||||
);
|
||||
assert_eq!(host.get_state().status, HostExecutionStatus::Paused);
|
||||
assert!(host.get_fault().is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn one_frame_returns_and_captures_the_exact_published_frame() {
|
||||
let mut host = boot_color();
|
||||
let before = host.get_state().frame_index;
|
||||
let (logical_frame_index, frame_id) = completed(host.advance_frame().expect("frame"));
|
||||
let captured = host.capture_frame().expect("capture");
|
||||
|
||||
assert_eq!(logical_frame_index, before + 1);
|
||||
assert_eq!(captured.logical_frame_index, logical_frame_index);
|
||||
assert_eq!(captured.frame.frame_id, frame_id);
|
||||
assert_eq!(captured.frame.ownership.app_mode, AppMode::Game);
|
||||
assert_eq!(captured.frame.ownership.app_id, 41);
|
||||
assert_eq!(captured.frame.stride_pixels, captured.frame.width);
|
||||
assert_eq!(captured.frame.pixels.len(), 480 * 270);
|
||||
assert_eq!(host.capture_frame().expect("repeat capture"), captured);
|
||||
|
||||
let mut mutated_clone = captured.clone();
|
||||
mutated_clone.frame.pixels[0] = GREEN;
|
||||
assert_ne!(host.capture_frame().expect("owned capture").frame.pixels[0], GREEN);
|
||||
assert_eq!(host.get_state().status, HostExecutionStatus::Paused);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn zero_frames_is_an_explicit_noop() {
|
||||
let mut host = boot_color();
|
||||
let before = host.get_state();
|
||||
let outcome = host.advance_frames(0).expect("zero frames");
|
||||
|
||||
assert_eq!(outcome.requested, 0);
|
||||
assert_eq!(outcome.completed, 0);
|
||||
assert_eq!(outcome.stop, AdvanceFramesStop::Completed);
|
||||
let after = host.get_state();
|
||||
assert_eq!(after.frame_index, before.frame_index);
|
||||
assert_eq!(after.tick_index, before.tick_index);
|
||||
assert_eq!(after.status, before.status);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn clear_input_drops_right() {
|
||||
let mut host = boot_color();
|
||||
host.set_right(true);
|
||||
host.clear_input();
|
||||
completed(host.advance_frame().expect("frame"));
|
||||
assert_color(&host.capture_frame().expect("frame"), BLUE);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn right_hold_then_release_changes_pixels() {
|
||||
let mut host = boot_color();
|
||||
let before = host.get_state().frame_index;
|
||||
|
||||
host.set_right(true);
|
||||
assert_completed(host.advance_frames(60).expect("hold"), 60);
|
||||
let held = host.capture_frame().expect("held frame");
|
||||
assert_eq!(host.get_state().frame_index, before + 60);
|
||||
assert_color(&held, RED);
|
||||
assert!(host.get_fault().is_none());
|
||||
|
||||
host.set_right(false);
|
||||
assert_completed(host.advance_frames(1).expect("release"), 1);
|
||||
let released = host.capture_frame().expect("released frame");
|
||||
assert_eq!(released.logical_frame_index, before + 61);
|
||||
assert_color(&released, BLUE);
|
||||
assert!(host.get_fault().is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn normalized_button_press_hold_release_and_clear_are_observable() {
|
||||
let mut host = boot_input_edges();
|
||||
|
||||
let mut signals = InputSignals { right_signal: true, ..InputSignals::default() };
|
||||
host.set_input(signals);
|
||||
completed(host.advance_frame().expect("press"));
|
||||
assert_color(&host.capture_frame().expect("pressed"), RED);
|
||||
|
||||
completed(host.advance_frame().expect("hold"));
|
||||
assert_color(&host.capture_frame().expect("held"), BLUE);
|
||||
|
||||
signals.right_signal = false;
|
||||
host.set_input(signals);
|
||||
completed(host.advance_frame().expect("release"));
|
||||
assert_color(&host.capture_frame().expect("released"), GREEN);
|
||||
|
||||
host.set_input(InputSignals {
|
||||
right_signal: true,
|
||||
f_signal: true,
|
||||
x_pos: 123,
|
||||
y_pos: 45,
|
||||
..InputSignals::default()
|
||||
});
|
||||
host.clear_input();
|
||||
completed(host.advance_frame().expect("clear"));
|
||||
assert_color(&host.capture_frame().expect("cleared"), BLACK);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn normalized_touch_edges_and_coordinates_use_the_same_input_surface() {
|
||||
let mut host = boot_touch_edges();
|
||||
let mut signals =
|
||||
InputSignals { f_signal: true, x_pos: 123, y_pos: 45, ..InputSignals::default() };
|
||||
|
||||
host.set_input(signals);
|
||||
completed(host.advance_frame().expect("touch press"));
|
||||
assert_color(&host.capture_frame().expect("touch pressed"), RED);
|
||||
|
||||
completed(host.advance_frame().expect("touch hold"));
|
||||
assert_color(&host.capture_frame().expect("touch held"), BLUE);
|
||||
|
||||
signals.f_signal = false;
|
||||
host.set_input(signals);
|
||||
completed(host.advance_frame().expect("touch release"));
|
||||
assert_color(&host.capture_frame().expect("touch released"), GREEN);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn two_runs_match_oracle() {
|
||||
let first = run_color_sequence();
|
||||
let second = run_color_sequence();
|
||||
assert_eq!(first.held.logical_frame_index, second.held.logical_frame_index);
|
||||
assert_eq!(first.held.frame.pixels, second.held.frame.pixels);
|
||||
assert_eq!(first.held.frame.frame_id, second.held.frame.frame_id);
|
||||
assert_eq!(first.released.frame.pixels, second.released.frame.pixels);
|
||||
assert_eq!(first.released.frame.frame_id, second.released.frame.frame_id);
|
||||
assert_eq!(first.released.logical_frame_index, second.released.logical_frame_index);
|
||||
assert_same_state(&first.state, &second.state);
|
||||
assert_eq!(first.fault, second.fault);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reset_matches_fresh_host() {
|
||||
let mut host = boot_color();
|
||||
let _ = run_on(&mut host);
|
||||
host.reset();
|
||||
assert_eq!(host.get_state().status, HostExecutionStatus::Terminated);
|
||||
assert_eq!(host.capture_frame(), Err(HostError::NoFrameAvailable));
|
||||
host.boot(color_cartridge()).expect("reboot");
|
||||
let after_reset = run_on(&mut host);
|
||||
let fresh = run_color_sequence();
|
||||
|
||||
assert_eq!(after_reset.held.frame.pixels, fresh.held.frame.pixels);
|
||||
assert_eq!(after_reset.released.frame.pixels, fresh.released.frame.pixels);
|
||||
assert_eq!(after_reset.held.frame.frame_id, fresh.held.frame.frame_id);
|
||||
assert_eq!(after_reset.released.frame.frame_id, fresh.released.frame.frame_id);
|
||||
assert_eq!(after_reset.released.logical_frame_index, fresh.released.logical_frame_index);
|
||||
assert_same_state(&after_reset.state, &fresh.state);
|
||||
assert_eq!(after_reset.fault, fresh.fault);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn trap_is_structured() {
|
||||
let dir = temp_cart("fault");
|
||||
write_cartridge(&dir, 42, "Fault", &fault_program(), &[]);
|
||||
let mut host = HeadlessHost::new();
|
||||
host.boot(&dir).expect("boot fault cartridge");
|
||||
let outcome = host.advance_frame().expect("faulting frame");
|
||||
|
||||
match outcome {
|
||||
AdvanceFrameOutcome::Faulted(CrashReport::VmTrap { trap }) => {
|
||||
assert_eq!(trap.code, prometeu_bytecode::TRAP_EXPLICIT);
|
||||
assert_eq!(trap.opcode, prometeu_bytecode::isa::core::CoreOpCode::Trap as u16);
|
||||
assert_eq!(trap.pc, 0);
|
||||
assert_eq!(trap.span, Some(SourceSpan { file_id: 7, start: 11, end: 15 }));
|
||||
assert!(trap.message.contains("main"));
|
||||
}
|
||||
other => panic!("expected VmTrap outcome, got {other:?}"),
|
||||
}
|
||||
assert!(matches!(host.get_fault(), Some(CrashReport::VmTrap { .. })));
|
||||
assert_eq!(host.get_state().status, HostExecutionStatus::Faulted);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn instruction_step_fault_remains_structured() {
|
||||
let dir = temp_cart("step-fault");
|
||||
write_cartridge(&dir, 48, "Step Fault", &fault_program(), &[]);
|
||||
let mut host = HeadlessHost::new();
|
||||
host.boot(&dir).expect("boot fault cartridge");
|
||||
|
||||
let report = host.step().expect("step result").expect("structured step fault");
|
||||
assert!(matches!(report, CrashReport::VmTrap { .. }));
|
||||
assert_eq!(host.get_fault(), Some(report));
|
||||
assert_eq!(host.get_state().status, HostExecutionStatus::Faulted);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn batch_stops_early_on_fault_and_reports_partial_progress() {
|
||||
let dir = temp_cart("fault-batch");
|
||||
write_cartridge(&dir, 43, "Fault Batch", &delayed_fault_program(), &gfx_syscalls());
|
||||
let mut host = HeadlessHost::new();
|
||||
host.boot(&dir).expect("boot fault cartridge");
|
||||
|
||||
let outcome = host.advance_frames(5).expect("batch outcome");
|
||||
assert_eq!(outcome.requested, 5);
|
||||
assert_eq!(outcome.completed, 2);
|
||||
assert!(matches!(outcome.stop, AdvanceFramesStop::Faulted(CrashReport::VmTrap { .. })));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn advance_after_reset_reports_termination_without_ticking() {
|
||||
let mut host = boot_color();
|
||||
host.reset();
|
||||
let before = host.get_state().tick_index;
|
||||
|
||||
assert_eq!(host.advance_frame().expect("termination outcome"), AdvanceFrameOutcome::Terminated);
|
||||
assert_eq!(host.get_state().tick_index, before);
|
||||
let batch = host.advance_frames(3).expect("terminated batch");
|
||||
assert_eq!(batch.completed, 0);
|
||||
assert_eq!(batch.stop, AdvanceFramesStop::Terminated);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vm_init_failure_is_returned_as_structured_boot_failure() {
|
||||
let dir = temp_cart("bad-pbx");
|
||||
write_cartridge(&dir, 44, "Bad PBX", b"not a pbx", &[]);
|
||||
let mut host = HeadlessHost::new();
|
||||
|
||||
let error = host.boot(&dir).expect_err("invalid PBX must fail boot");
|
||||
assert!(matches!(
|
||||
error,
|
||||
HostError::BootFailed { report: Some(CrashReport::VmInit { .. }), .. }
|
||||
));
|
||||
assert_eq!(host.get_state().status, HostExecutionStatus::Faulted);
|
||||
assert!(matches!(host.get_fault(), Some(CrashReport::VmInit { .. })));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn end_of_rom_completes_a_logical_frame() {
|
||||
let dir = temp_cart("end-of-rom");
|
||||
write_cartridge(&dir, 45, "End Of Rom", &module(asm("RET\n"), vec![]), &[]);
|
||||
let mut host = HeadlessHost::new();
|
||||
host.boot(&dir).expect("boot end-of-rom cartridge");
|
||||
|
||||
let first = completed(host.advance_frame().expect("first frame"));
|
||||
let second = completed(host.advance_frame().expect("second frame"));
|
||||
assert_eq!(second.0, first.0 + 1);
|
||||
assert_ne!(second.1, first.1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn three_hundred_frames_complete_without_realtime_pacing() {
|
||||
let mut host = boot_color();
|
||||
assert_completed(host.advance_frames(300).expect("fast frames"), 300);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn audio_play_does_not_need_a_device() {
|
||||
let mut host = boot_color();
|
||||
completed(host.advance_frame().expect("frame with audio.play"));
|
||||
assert!(host.get_fault().is_none());
|
||||
assert_color(&host.capture_frame().expect("frame"), BLUE);
|
||||
}
|
||||
|
||||
struct ColorOracle {
|
||||
held: CapturedFrame,
|
||||
released: CapturedFrame,
|
||||
state: HostState,
|
||||
fault: Option<CrashReport>,
|
||||
}
|
||||
|
||||
fn boot_color() -> HeadlessHost {
|
||||
let mut host = HeadlessHost::new();
|
||||
host.boot(color_cartridge()).expect("boot color cartridge");
|
||||
host
|
||||
}
|
||||
|
||||
fn boot_input_edges() -> HeadlessHost {
|
||||
let dir = temp_cart("input-edges");
|
||||
write_cartridge(&dir, 46, "Input Edges", &input_edge_program(), &gfx_syscalls());
|
||||
let mut host = HeadlessHost::new();
|
||||
host.boot(&dir).expect("boot input cartridge");
|
||||
host
|
||||
}
|
||||
|
||||
fn boot_touch_edges() -> HeadlessHost {
|
||||
let dir = temp_cart("touch-edges");
|
||||
write_cartridge(&dir, 49, "Touch Edges", &touch_edge_program(), &gfx_syscalls());
|
||||
let mut host = HeadlessHost::new();
|
||||
host.boot(&dir).expect("boot touch cartridge");
|
||||
host
|
||||
}
|
||||
|
||||
fn color_cartridge() -> String {
|
||||
let dir = temp_cart("color");
|
||||
write_cartridge(&dir, 41, "Right Pixel", &color_program(), &color_syscalls());
|
||||
dir
|
||||
}
|
||||
|
||||
fn run_color_sequence() -> ColorOracle {
|
||||
let mut host = boot_color();
|
||||
run_on(&mut host)
|
||||
}
|
||||
|
||||
fn run_on(host: &mut HeadlessHost) -> ColorOracle {
|
||||
host.set_right(true);
|
||||
assert_completed(host.advance_frames(60).expect("hold"), 60);
|
||||
let held = host.capture_frame().expect("held");
|
||||
host.set_right(false);
|
||||
assert_completed(host.advance_frames(1).expect("release"), 1);
|
||||
let released = host.capture_frame().expect("released");
|
||||
let state = host.get_state();
|
||||
let fault = host.get_fault();
|
||||
ColorOracle { held, released, state, fault }
|
||||
}
|
||||
|
||||
fn completed(outcome: AdvanceFrameOutcome) -> (u64, prometeu_hal::FrameId) {
|
||||
match outcome {
|
||||
AdvanceFrameOutcome::FrameCompleted { logical_frame_index, frame_id } => {
|
||||
(logical_frame_index, frame_id)
|
||||
}
|
||||
other => panic!("expected completed frame, got {other:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
fn assert_completed(outcome: prometeu_host_headless::AdvanceFramesOutcome, expected: u64) {
|
||||
assert_eq!(outcome.requested, expected);
|
||||
assert_eq!(outcome.completed, expected);
|
||||
assert_eq!(outcome.stop, AdvanceFramesStop::Completed);
|
||||
}
|
||||
|
||||
fn assert_color(captured: &CapturedFrame, color: u32) {
|
||||
assert_eq!(captured.frame.width, 480);
|
||||
assert_eq!(captured.frame.height, 270);
|
||||
assert!(captured.frame.pixels.iter().all(|pixel| *pixel == color));
|
||||
}
|
||||
|
||||
fn assert_same_state(left: &HostState, right: &HostState) {
|
||||
assert_eq!(left.pc, right.pc);
|
||||
assert_eq!(left.frame_index, right.frame_index);
|
||||
assert_eq!(left.tick_index, right.tick_index);
|
||||
assert_eq!(left.app_id, right.app_id);
|
||||
assert_eq!(left.status, right.status);
|
||||
assert_eq!(format!("{:?}", left.stack_top), format!("{:?}", right.stack_top));
|
||||
}
|
||||
|
||||
fn temp_cart(name: &str) -> String {
|
||||
let dir = std::env::temp_dir().join(format!(
|
||||
"prometeu-headless-{name}-{}-{}",
|
||||
std::process::id(),
|
||||
std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_nanos()
|
||||
));
|
||||
fs::create_dir_all(&dir).expect("temp cartridge dir");
|
||||
dir.to_string_lossy().into_owned()
|
||||
}
|
||||
|
||||
fn write_cartridge(dir: &str, app_id: u32, title: &str, program: &[u8], syscalls: &[SyscallDecl]) {
|
||||
let path = Path::new(dir);
|
||||
fs::write(path.join("program.pbx"), program).expect("program");
|
||||
fs::write(
|
||||
path.join("manifest.json"),
|
||||
format!(
|
||||
"{{\n \"magic\": \"PMTU\",\n \"cartridge_version\": 1,\n \"app_id\": {app_id},\n \"title\": \"{title}\",\n \"app_version\": \"0.1.0\",\n \"app_mode\": \"Game\",\n \"capabilities\": [\"gfx2d\", \"audio\"]\n}}\n"
|
||||
),
|
||||
)
|
||||
.expect("manifest");
|
||||
let _ = syscalls;
|
||||
}
|
||||
|
||||
fn color_program() -> Vec<u8> {
|
||||
let mut rom = Vec::new();
|
||||
rom.extend(asm("PUSH_I32 0\n\
|
||||
PUSH_I32 0\n\
|
||||
PUSH_I32 0\n\
|
||||
PUSH_I32 255\n\
|
||||
PUSH_I32 128\n\
|
||||
PUSH_I32 1\n\
|
||||
PUSH_I32 0\n\
|
||||
HOSTCALL 1\n\
|
||||
POP_N 1\n\
|
||||
INTRINSIC 0x2000\n\
|
||||
INTRINSIC 0x2013\n\
|
||||
INTRINSIC 0x2032\n"));
|
||||
let jump_to_blue = rom.len() + 2;
|
||||
rom.extend(asm("JMP_IF_FALSE 0"));
|
||||
rom.extend(asm(&format!("PUSH_I64 {RED}\nHOSTCALL 0\nFRAME_SYNC\nRET\n")));
|
||||
let blue_at = rom.len() as u32;
|
||||
rom.extend(asm(&format!("PUSH_I64 {BLUE}\nHOSTCALL 0\nFRAME_SYNC\nRET\n")));
|
||||
rom[jump_to_blue..jump_to_blue + 4].copy_from_slice(&blue_at.to_le_bytes());
|
||||
module(rom, color_syscalls())
|
||||
}
|
||||
|
||||
fn input_edge_program() -> Vec<u8> {
|
||||
let mut rom = Vec::new();
|
||||
let pressed_jump = emit_right_predicate(&mut rom, 0x2030);
|
||||
rom.extend(asm(&format!("PUSH_I64 {RED}\nHOSTCALL 0\nFRAME_SYNC\nRET\n")));
|
||||
let released_at = rom.len() as u32;
|
||||
rom[pressed_jump..pressed_jump + 4].copy_from_slice(&released_at.to_le_bytes());
|
||||
|
||||
let released_jump = emit_right_predicate(&mut rom, 0x2031);
|
||||
rom.extend(asm(&format!("PUSH_I64 {GREEN}\nHOSTCALL 0\nFRAME_SYNC\nRET\n")));
|
||||
let down_at = rom.len() as u32;
|
||||
rom[released_jump..released_jump + 4].copy_from_slice(&down_at.to_le_bytes());
|
||||
|
||||
let down_jump = emit_right_predicate(&mut rom, 0x2032);
|
||||
rom.extend(asm(&format!("PUSH_I64 {BLUE}\nHOSTCALL 0\nFRAME_SYNC\nRET\n")));
|
||||
let idle_at = rom.len() as u32;
|
||||
rom[down_jump..down_jump + 4].copy_from_slice(&idle_at.to_le_bytes());
|
||||
rom.extend(asm(&format!("PUSH_I64 {BLACK}\nHOSTCALL 0\nFRAME_SYNC\nRET\n")));
|
||||
|
||||
module(rom, gfx_syscalls())
|
||||
}
|
||||
|
||||
fn emit_right_predicate(rom: &mut Vec<u8>, predicate: u32) -> usize {
|
||||
rom.extend(asm(&format!("INTRINSIC 0x2000\nINTRINSIC 0x2013\nINTRINSIC {predicate:#x}\n")));
|
||||
let target = rom.len() + 2;
|
||||
rom.extend(asm("JMP_IF_FALSE 0\n"));
|
||||
target
|
||||
}
|
||||
|
||||
fn touch_edge_program() -> Vec<u8> {
|
||||
let mut rom = Vec::new();
|
||||
let pressed_jump = emit_touch_predicate(&mut rom, 0x2030);
|
||||
rom.extend(asm(&format!("PUSH_I64 {RED}\nHOSTCALL 0\nFRAME_SYNC\nRET\n")));
|
||||
let released_at = rom.len() as u32;
|
||||
rom[pressed_jump..pressed_jump + 4].copy_from_slice(&released_at.to_le_bytes());
|
||||
|
||||
let released_jump = emit_touch_predicate(&mut rom, 0x2031);
|
||||
rom.extend(asm(&format!("PUSH_I64 {GREEN}\nHOSTCALL 0\nFRAME_SYNC\nRET\n")));
|
||||
let down_at = rom.len() as u32;
|
||||
rom[released_jump..released_jump + 4].copy_from_slice(&down_at.to_le_bytes());
|
||||
|
||||
let down_jump = emit_touch_predicate(&mut rom, 0x2032);
|
||||
rom.extend(asm(&format!("PUSH_I64 {BLUE}\nHOSTCALL 0\nFRAME_SYNC\nRET\n")));
|
||||
let idle_at = rom.len() as u32;
|
||||
rom[down_jump..down_jump + 4].copy_from_slice(&idle_at.to_le_bytes());
|
||||
rom.extend(asm(&format!("PUSH_I64 {BLACK}\nHOSTCALL 0\nFRAME_SYNC\nRET\n")));
|
||||
|
||||
module(rom, gfx_syscalls())
|
||||
}
|
||||
|
||||
fn emit_touch_predicate(rom: &mut Vec<u8>, predicate: u32) -> usize {
|
||||
rom.extend(asm(&format!(
|
||||
"INTRINSIC 0x2001\nINTRINSIC 0x2020\nINTRINSIC {predicate:#x}\n\
|
||||
INTRINSIC 0x2001\nINTRINSIC 0x2021\nPUSH_I64 123\nEQ\nAND\n\
|
||||
INTRINSIC 0x2001\nINTRINSIC 0x2022\nPUSH_I64 45\nEQ\nAND\n"
|
||||
)));
|
||||
let target = rom.len() + 2;
|
||||
rom.extend(asm("JMP_IF_FALSE 0\n"));
|
||||
target
|
||||
}
|
||||
|
||||
fn fault_program() -> Vec<u8> {
|
||||
// `INTRINSIC 0xDEADBEEF` is rejected by the loader as `VerificationFailed`.
|
||||
// `TRAP` is a legal instruction that becomes `CrashReport::VmTrap` at runtime.
|
||||
module(asm("TRAP\nFRAME_SYNC\nRET\n"), vec![])
|
||||
}
|
||||
|
||||
fn delayed_fault_program() -> Vec<u8> {
|
||||
let mut rom =
|
||||
asm("GET_GLOBAL 0\nPUSH_I32 1\nADD\nSET_GLOBAL 0\nGET_GLOBAL 0\nPUSH_I32 3\nEQ\n");
|
||||
let continue_jump = rom.len() + 2;
|
||||
rom.extend(asm("JMP_IF_FALSE 0\nTRAP\n"));
|
||||
let continue_at = rom.len() as u32;
|
||||
rom[continue_jump..continue_jump + 4].copy_from_slice(&continue_at.to_le_bytes());
|
||||
rom.extend(asm(&format!("PUSH_I64 {BLACK}\nHOSTCALL 0\nFRAME_SYNC\nRET\n")));
|
||||
module(rom, gfx_syscalls())
|
||||
}
|
||||
|
||||
fn multi_tick_program() -> Vec<u8> {
|
||||
let mut rom = asm("PUSH_I32 30000\nSET_LOCAL 0\n");
|
||||
let loop_at = rom.len() as u32;
|
||||
rom.extend(asm("GET_LOCAL 0\nPUSH_I32 1\nSUB\nSET_LOCAL 0\nGET_LOCAL 0\nPUSH_I32 0\nGT\n"));
|
||||
rom.extend(asm(&format!("JMP_IF_TRUE {loop_at}\nFRAME_SYNC\nRET\n")));
|
||||
module_with_locals(rom, vec![], 1)
|
||||
}
|
||||
|
||||
fn color_syscalls() -> Vec<SyscallDecl> {
|
||||
vec![
|
||||
SyscallDecl {
|
||||
module: "gfx2d".into(),
|
||||
name: "clear".into(),
|
||||
version: 1,
|
||||
arg_slots: 1,
|
||||
ret_slots: 0,
|
||||
},
|
||||
SyscallDecl {
|
||||
module: "audio".into(),
|
||||
name: "play".into(),
|
||||
version: 1,
|
||||
arg_slots: 7,
|
||||
ret_slots: 1,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
fn gfx_syscalls() -> Vec<SyscallDecl> {
|
||||
vec![SyscallDecl {
|
||||
module: "gfx2d".into(),
|
||||
name: "clear".into(),
|
||||
version: 1,
|
||||
arg_slots: 1,
|
||||
ret_slots: 0,
|
||||
}]
|
||||
}
|
||||
|
||||
fn module(code: Vec<u8>, syscalls: Vec<SyscallDecl>) -> Vec<u8> {
|
||||
module_with_locals(code, syscalls, 0)
|
||||
}
|
||||
|
||||
fn module_with_locals(code: Vec<u8>, syscalls: Vec<SyscallDecl>, local_slots: u16) -> Vec<u8> {
|
||||
BytecodeModule {
|
||||
version: 0,
|
||||
const_pool: vec![],
|
||||
functions: vec![FunctionMeta {
|
||||
code_offset: 0,
|
||||
code_len: code.len() as u32,
|
||||
param_slots: 0,
|
||||
local_slots,
|
||||
return_slots: 0,
|
||||
max_stack_slots: 8,
|
||||
}],
|
||||
code,
|
||||
debug_info: Some(DebugInfo {
|
||||
pc_to_span: vec![(0, SourceSpan { file_id: 7, start: 11, end: 15 })],
|
||||
function_names: vec![(0, "main".into())],
|
||||
}),
|
||||
exports: vec![Export { symbol: "main".into(), func_idx: 0 }],
|
||||
syscalls,
|
||||
}
|
||||
.serialize()
|
||||
}
|
||||
|
||||
fn asm(source: &str) -> Vec<u8> {
|
||||
assemble(source).expect("assemble")
|
||||
}
|
||||
@@ -13,11 +13,26 @@ path = "src/main.rs"
|
||||
name = "prometeu-runtime"
|
||||
path = "src/bin/prometeu-runtime.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "prometeu-headless"
|
||||
path = "src/bin/prometeu-headless.rs"
|
||||
|
||||
[package.metadata.dist]
|
||||
dist = true
|
||||
include = [
|
||||
"../../../devtools/headless-protocol",
|
||||
"../../../docs/specs/runtime/11a-headless-automation-protocol.md",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "4.5", features = ["derive"] }
|
||||
prometeu-host-desktop-winit = { path = "../../host/prometeu-host-desktop-winit" }
|
||||
prometeu-host-headless = { path = "../../host/prometeu-host-headless" }
|
||||
|
||||
[dev-dependencies]
|
||||
jsonschema = { version = "0.33", default-features = false }
|
||||
serde_json = "1"
|
||||
prometeu-bytecode = { path = "../../console/prometeu-bytecode" }
|
||||
prometeu-hal = { path = "../../console/prometeu-hal" }
|
||||
base64 = "0.22"
|
||||
png = "0.17"
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
use clap::Parser;
|
||||
use prometeu_cli::{HeadlessArgs, run_headless};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(
|
||||
name = "prometeu-headless",
|
||||
version,
|
||||
about = "Deterministic headless JSONL automation host"
|
||||
)]
|
||||
struct Cli {
|
||||
#[command(flatten)]
|
||||
options: HeadlessArgs,
|
||||
}
|
||||
|
||||
fn main() -> std::io::Result<()> {
|
||||
run_headless(Cli::parse().options)
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
//! Shared CLI options for the dispatcher and its headless executable.
|
||||
use clap::Args;
|
||||
use prometeu_host_headless::automation::Limits;
|
||||
|
||||
#[derive(Args, Debug)]
|
||||
pub struct HeadlessArgs {
|
||||
/// Use the versioned JSONL stdin/stdout protocol (required).
|
||||
#[arg(long, required = true)]
|
||||
pub stdio: bool,
|
||||
#[arg(long, default_value_t = 600)]
|
||||
pub max_frames: u64,
|
||||
#[arg(long, default_value_t = 65536)]
|
||||
pub max_command_bytes: usize,
|
||||
#[arg(long, default_value_t = 33554432)]
|
||||
pub max_response_bytes: usize,
|
||||
#[arg(long, default_value_t = 5000)]
|
||||
pub handshake_timeout_ms: u64,
|
||||
#[arg(long, default_value_t = 60000)]
|
||||
pub call_timeout_ms: u64,
|
||||
#[arg(long, default_value_t = 5000)]
|
||||
pub shutdown_timeout_ms: u64,
|
||||
}
|
||||
|
||||
impl HeadlessArgs {
|
||||
pub fn limits(&self) -> Limits {
|
||||
Limits {
|
||||
max_frames: self.max_frames,
|
||||
max_command_bytes: self.max_command_bytes,
|
||||
max_response_bytes: self.max_response_bytes,
|
||||
handshake_timeout_ms: self.handshake_timeout_ms,
|
||||
call_timeout_ms: self.call_timeout_ms,
|
||||
shutdown_timeout_ms: self.shutdown_timeout_ms,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn forwarded_args(&self) -> Vec<String> {
|
||||
vec![
|
||||
"--stdio".into(),
|
||||
"--max-frames".into(),
|
||||
self.max_frames.to_string(),
|
||||
"--max-command-bytes".into(),
|
||||
self.max_command_bytes.to_string(),
|
||||
"--max-response-bytes".into(),
|
||||
self.max_response_bytes.to_string(),
|
||||
"--handshake-timeout-ms".into(),
|
||||
self.handshake_timeout_ms.to_string(),
|
||||
"--call-timeout-ms".into(),
|
||||
self.call_timeout_ms.to_string(),
|
||||
"--shutdown-timeout-ms".into(),
|
||||
self.shutdown_timeout_ms.to_string(),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run_headless(args: HeadlessArgs) -> std::io::Result<()> {
|
||||
prometeu_host_headless::automation::serve(
|
||||
std::io::BufReader::new(std::io::stdin()),
|
||||
std::io::stdout(),
|
||||
args.limits(),
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
)
|
||||
}
|
||||
@@ -19,6 +19,8 @@ struct Cli {
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum Commands {
|
||||
/// Starts the versioned headless automation process (no native window).
|
||||
Headless(prometeu_cli::HeadlessArgs),
|
||||
/// Executes a cartridge using the available runtime.
|
||||
Run {
|
||||
/// Path to the cartridge (directory or .pmc file).
|
||||
@@ -65,6 +67,11 @@ fn main() {
|
||||
};
|
||||
|
||||
match cli.command {
|
||||
Some(Commands::Headless(options)) => {
|
||||
let args = options.forwarded_args();
|
||||
let borrowed: Vec<&str> = args.iter().map(String::as_str).collect();
|
||||
dispatch(&exe_dir, "prometeu-headless", &borrowed);
|
||||
}
|
||||
Some(Commands::Run { cart }) => {
|
||||
dispatch(&exe_dir, "prometeu-runtime", &["--run", &cart]);
|
||||
}
|
||||
@@ -99,6 +106,7 @@ fn dispatch(exe_dir: &Path, bin_name: &str, args: &[&str]) {
|
||||
"prometeu: command '{}' is not yet available in this distribution on {}",
|
||||
match bin_name {
|
||||
"prometeu-runtime" => "run/debug",
|
||||
"prometeu-headless" => "headless",
|
||||
"prometeuc" => "build/verify c",
|
||||
"prometeup" => "pack/verify p",
|
||||
_ => bin_name,
|
||||
|
||||
@@ -0,0 +1,615 @@
|
||||
use base64::{Engine as _, engine::general_purpose::STANDARD};
|
||||
use prometeu_bytecode::SourceSpan;
|
||||
use prometeu_bytecode::assembler::assemble;
|
||||
use prometeu_bytecode::model::{BytecodeModule, DebugInfo, Export, FunctionMeta, SyscallDecl};
|
||||
use prometeu_host_headless::{AdvanceFramesStop, HeadlessHost};
|
||||
use serde_json::{Value, json};
|
||||
use std::collections::HashMap;
|
||||
use std::fs;
|
||||
use std::io::{BufRead, BufReader, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{Child, ChildStdin, Command, Stdio};
|
||||
use std::sync::{
|
||||
atomic::{AtomicU64, Ordering},
|
||||
mpsc,
|
||||
};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
struct TempDir(PathBuf);
|
||||
impl TempDir {
|
||||
fn new() -> Self {
|
||||
static COUNTER: AtomicU64 = AtomicU64::new(0);
|
||||
let path = std::env::temp_dir().join(format!(
|
||||
"prometeu-protocol-test-{}-{}-{}",
|
||||
std::process::id(),
|
||||
std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_nanos(),
|
||||
COUNTER.fetch_add(1, Ordering::Relaxed)
|
||||
));
|
||||
fs::create_dir(&path).unwrap();
|
||||
Self(path)
|
||||
}
|
||||
}
|
||||
impl Drop for TempDir {
|
||||
fn drop(&mut self) {
|
||||
let _ = fs::remove_dir_all(&self.0);
|
||||
}
|
||||
}
|
||||
|
||||
struct Client {
|
||||
child: Child,
|
||||
input: Option<ChildStdin>,
|
||||
messages: mpsc::Receiver<Result<Value, String>>,
|
||||
pending: HashMap<String, Value>,
|
||||
next: u64,
|
||||
hello: Value,
|
||||
}
|
||||
|
||||
impl Client {
|
||||
fn new(args: &[&str]) -> Self {
|
||||
Self::spawn(Path::new(env!("CARGO_BIN_EXE_prometeu-headless")), args, None)
|
||||
}
|
||||
|
||||
fn spawn(binary: &Path, args: &[&str], cwd: Option<&Path>) -> Self {
|
||||
let mut command = Command::new(binary);
|
||||
command.args(args).stdin(Stdio::piped()).stdout(Stdio::piped()).stderr(Stdio::inherit());
|
||||
if let Some(cwd) = cwd {
|
||||
command.current_dir(cwd);
|
||||
}
|
||||
let mut child = command.spawn().unwrap();
|
||||
let input = child.stdin.take();
|
||||
let stdout = child.stdout.take().unwrap();
|
||||
let (sender, messages) = mpsc::channel();
|
||||
std::thread::spawn(move || {
|
||||
for line in BufReader::new(stdout).lines() {
|
||||
let value = line.map_err(|e| e.to_string()).and_then(|line| {
|
||||
serde_json::from_str(&line)
|
||||
.map_err(|e| format!("non-protocol stdout: {e}: {line}"))
|
||||
});
|
||||
if sender.send(value).is_err() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
let mut client =
|
||||
Self { child, input, messages, pending: HashMap::new(), next: 0, hello: Value::Null };
|
||||
client.hello = client.event();
|
||||
assert_eq!(client.hello["type"], "hello");
|
||||
client
|
||||
}
|
||||
|
||||
fn event(&self) -> Value {
|
||||
let message = self
|
||||
.messages
|
||||
.recv_timeout(Duration::from_secs(15))
|
||||
.expect("protocol reply deadline")
|
||||
.unwrap();
|
||||
static SCHEMA: std::sync::OnceLock<jsonschema::Validator> = std::sync::OnceLock::new();
|
||||
let schema = SCHEMA.get_or_init(|| {
|
||||
let value: Value = serde_json::from_str(include_str!(
|
||||
"../../../../devtools/headless-protocol/response.schema.json"
|
||||
))
|
||||
.unwrap();
|
||||
jsonschema::validator_for(&value).unwrap()
|
||||
});
|
||||
if let Err(error) = schema.validate(&message) {
|
||||
panic!("server message violates published schema: {error}: {message}");
|
||||
}
|
||||
message
|
||||
}
|
||||
|
||||
fn raw(&mut self, bytes: &[u8]) {
|
||||
self.input.as_mut().unwrap().write_all(bytes).unwrap();
|
||||
self.input.as_mut().unwrap().flush().unwrap();
|
||||
}
|
||||
|
||||
fn send(&mut self, command: &str, params: Value) -> String {
|
||||
self.next += 1;
|
||||
let id = format!("q{}", self.next);
|
||||
let mut bytes =
|
||||
serde_json::to_vec(&json!({"requestId":id,"command":command,"params":params})).unwrap();
|
||||
bytes.push(b'\n');
|
||||
self.raw(&bytes);
|
||||
id
|
||||
}
|
||||
|
||||
fn response(&mut self, id: &str) -> Value {
|
||||
if let Some(value) = self.pending.remove(id) {
|
||||
return value;
|
||||
}
|
||||
loop {
|
||||
let message = self.event();
|
||||
if message["type"] == "progress" {
|
||||
continue;
|
||||
}
|
||||
let message_id = message["requestId"].as_str().unwrap().to_owned();
|
||||
if message_id == id {
|
||||
return message;
|
||||
}
|
||||
self.pending.insert(message_id, message);
|
||||
}
|
||||
}
|
||||
|
||||
fn call(&mut self, command: &str, params: Value) -> Value {
|
||||
let id = self.send(command, params);
|
||||
self.response(&id)
|
||||
}
|
||||
|
||||
fn ok(&mut self, command: &str, params: Value) -> Value {
|
||||
let response = self.call(command, params);
|
||||
assert!(response.get("error").is_none(), "{response}");
|
||||
response["result"].clone()
|
||||
}
|
||||
|
||||
fn initialize(&mut self) {
|
||||
self.ok("initialize", json!({"protocolVersion":{"major":1,"minor":0},"requiredCapabilities":["advance","capture","cancel"]}));
|
||||
}
|
||||
|
||||
fn wait_exit(&mut self) {
|
||||
let deadline = Instant::now() + Duration::from_secs(5);
|
||||
loop {
|
||||
if let Some(status) = self.child.try_wait().unwrap() {
|
||||
assert!(status.success(), "{status}");
|
||||
return;
|
||||
}
|
||||
assert!(Instant::now() < deadline, "process did not exit");
|
||||
std::thread::sleep(Duration::from_millis(5));
|
||||
}
|
||||
}
|
||||
|
||||
fn close(&mut self) {
|
||||
self.ok("shutdown", json!({}));
|
||||
self.input.take();
|
||||
self.wait_exit();
|
||||
}
|
||||
}
|
||||
impl Drop for Client {
|
||||
fn drop(&mut self) {
|
||||
let _ = self.child.kill();
|
||||
let _ = self.child.wait();
|
||||
}
|
||||
}
|
||||
|
||||
fn cartridge(code: &str, gfx: bool) -> TempDir {
|
||||
cartridge_bytes(assemble(code).unwrap(), gfx)
|
||||
}
|
||||
|
||||
fn cartridge_bytes(code: Vec<u8>, gfx: bool) -> TempDir {
|
||||
let dir = TempDir::new();
|
||||
let module = BytecodeModule {
|
||||
version: 0,
|
||||
const_pool: vec![],
|
||||
functions: vec![FunctionMeta {
|
||||
code_offset: 0,
|
||||
code_len: code.len() as u32,
|
||||
param_slots: 0,
|
||||
local_slots: 0,
|
||||
return_slots: 0,
|
||||
max_stack_slots: 8,
|
||||
}],
|
||||
code,
|
||||
debug_info: Some(DebugInfo {
|
||||
pc_to_span: vec![(0, SourceSpan { file_id: 7, start: 11, end: 15 })],
|
||||
function_names: vec![(0, "main".into())],
|
||||
}),
|
||||
exports: vec![Export { symbol: "main".into(), func_idx: 0 }],
|
||||
syscalls: if gfx {
|
||||
vec![SyscallDecl {
|
||||
module: "gfx2d".into(),
|
||||
name: "clear".into(),
|
||||
version: 1,
|
||||
arg_slots: 1,
|
||||
ret_slots: 0,
|
||||
}]
|
||||
} else {
|
||||
vec![]
|
||||
},
|
||||
};
|
||||
fs::write(dir.0.join("program.pbx"), module.serialize()).unwrap();
|
||||
fs::write(
|
||||
dir.0.join("manifest.json"),
|
||||
serde_json::to_vec(&json!({"magic":"PMTU","cartridge_version":1,"app_id":41,
|
||||
"title":"Protocol test","app_version":"0.1.0","app_mode":"Game","capabilities":["gfx2d"]}))
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
dir
|
||||
}
|
||||
|
||||
fn colored_cart() -> TempDir {
|
||||
cartridge("PUSH_I64 4278190335\nHOSTCALL 0\nFRAME_SYNC\nRET\n", true)
|
||||
}
|
||||
fn boot(client: &mut Client, dir: &TempDir) {
|
||||
client.ok("boot", json!({"path":dir.0}));
|
||||
}
|
||||
fn png_bytes(capture: &Value) -> Vec<u8> {
|
||||
let bytes = STANDARD.decode(capture["data"].as_str().unwrap()).unwrap();
|
||||
let decoder = png::Decoder::new(std::io::Cursor::new(bytes));
|
||||
let mut reader = decoder.read_info().unwrap();
|
||||
let mut output = vec![0; reader.output_buffer_size()];
|
||||
let info = reader.next_frame(&mut output).unwrap();
|
||||
assert_eq!(info.color_type, png::ColorType::Rgba);
|
||||
assert_eq!(info.width as u64, capture["width"].as_u64().unwrap());
|
||||
assert_eq!(info.height as u64, capture["height"].as_u64().unwrap());
|
||||
output.truncate(info.buffer_size());
|
||||
output
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn handshake_versions_capabilities_and_limits_are_explicit() {
|
||||
let mut c = Client::new(&["--stdio"]);
|
||||
assert_eq!(c.hello["runtimeVersion"], env!("CARGO_PKG_VERSION"));
|
||||
assert_eq!(c.hello["protocolVersion"], json!({"major":1,"minor":0}));
|
||||
assert_eq!(
|
||||
c.hello["limits"],
|
||||
json!({"maxFrames":600,"maxCommandBytes":65536,"maxResponseBytes":33554432,
|
||||
"handshakeTimeoutMs":5000,"callTimeoutMs":60000,"shutdownTimeoutMs":5000})
|
||||
);
|
||||
assert_eq!(c.call("get_state", json!({}))["error"]["code"], "not_initialized");
|
||||
assert_eq!(
|
||||
c.call(
|
||||
"initialize",
|
||||
json!({"protocolVersion":{"major":2,"minor":0},"requiredCapabilities":[]})
|
||||
)["error"]["code"],
|
||||
"incompatible_version"
|
||||
);
|
||||
assert_eq!(
|
||||
c.call(
|
||||
"initialize",
|
||||
json!({"protocolVersion":{"major":1,"minor":0},"requiredCapabilities":["telepathy"]})
|
||||
)["error"]["code"],
|
||||
"unsupported_capability"
|
||||
);
|
||||
assert_eq!(
|
||||
c.ok(
|
||||
"initialize",
|
||||
json!({"protocolVersion":{"major":1,"minor":42},"requiredCapabilities":[]})
|
||||
)["protocolVersion"]["minor"],
|
||||
0
|
||||
);
|
||||
assert_eq!(
|
||||
c.call(
|
||||
"initialize",
|
||||
json!({"protocolVersion":{"major":1,"minor":0},"requiredCapabilities":[]})
|
||||
)["error"]["code"],
|
||||
"already_initialized"
|
||||
);
|
||||
c.close();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn malformed_fragmented_and_oversized_commands_do_not_desynchronize() {
|
||||
let mut c = Client::new(&["--stdio", "--max-command-bytes", "4096"]);
|
||||
c.initialize();
|
||||
c.raw(b"not json\n");
|
||||
assert_eq!(c.event()["error"]["code"], "invalid_request");
|
||||
c.raw(&[0xff, b'\n']);
|
||||
assert_eq!(c.event()["error"]["code"], "invalid_request");
|
||||
let mut huge = vec![b' '; 5000];
|
||||
huge.push(b'\n');
|
||||
c.raw(&huge);
|
||||
assert_eq!(c.event()["error"]["code"], "request_too_large");
|
||||
c.raw(b"{\"requestId\":\"fragment\",\"command\":\"get_");
|
||||
assert!(c.messages.try_recv().is_err());
|
||||
c.raw(b"state\",\"params\":{}}\r\n");
|
||||
assert_eq!(c.response("fragment")["result"]["status"], "terminated");
|
||||
assert_eq!(c.call("get_state", json!({"typo":1}))["error"]["code"], "invalid_params");
|
||||
assert_eq!(c.call("advance", json!({"frames":-1}))["error"]["code"], "invalid_params");
|
||||
assert_eq!(c.call("advance", json!({"frames":601}))["error"]["code"], "limit_exceeded");
|
||||
assert_eq!(c.call("missing", json!({}))["error"]["code"], "unknown_command");
|
||||
c.close();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lifecycle_and_capture_match_the_in_process_canonical_oracle() {
|
||||
let dir = colored_cart();
|
||||
let mut c = Client::new(&["--stdio"]);
|
||||
c.initialize();
|
||||
assert_eq!(c.call("capture", json!({}))["error"]["code"], "no_frame_available");
|
||||
boot(&mut c, &dir);
|
||||
assert_eq!(c.call("boot", json!({"path":dir.0}))["error"]["code"], "already_booted");
|
||||
let initial = c.ok("get_state", json!({}));
|
||||
assert_eq!(initial, c.ok("get_state", json!({})), "no background ticks");
|
||||
assert_eq!(
|
||||
c.ok("advance", json!({"frames":0})),
|
||||
json!({"requested":0,"completed":0,"stop":"completed"})
|
||||
);
|
||||
c.ok("set_input", json!({"right":true,"touch":true,"touchX":123,"touchY":45}));
|
||||
c.ok("clear_input", json!({}));
|
||||
let outcome = c.ok("advance", json!({"frames":3}));
|
||||
assert_eq!(outcome["completed"], 3);
|
||||
let capture = c.ok("capture", json!({}));
|
||||
let mut host = HeadlessHost::new();
|
||||
host.boot(dir.0.to_string_lossy()).unwrap();
|
||||
assert_eq!(host.advance_frames(3).unwrap().stop, AdvanceFramesStop::Completed);
|
||||
let expected = host.capture_frame().unwrap();
|
||||
let pixels: Vec<u8> = expected.frame.pixels.iter().flat_map(|v| v.to_be_bytes()).collect();
|
||||
assert_eq!(png_bytes(&capture), pixels);
|
||||
assert_eq!(capture["logicalFrameIndex"], expected.logical_frame_index);
|
||||
assert_eq!(capture["frameId"], expected.frame.frame_id.get());
|
||||
assert_eq!(capture["stridePixels"], expected.frame.stride_pixels);
|
||||
assert_eq!(c.ok("get_fault", json!({})), Value::Null);
|
||||
c.ok("reset", json!({}));
|
||||
assert_eq!(c.call("capture", json!({}))["error"]["code"], "no_frame_available");
|
||||
assert_eq!(c.ok("advance", json!({"frames":1}))["stop"], "terminated");
|
||||
boot(&mut c, &dir);
|
||||
c.ok("advance", json!({"frames":3}));
|
||||
assert_eq!(c.ok("capture", json!({})), capture);
|
||||
c.close();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn independent_processes_match_pixels_ids_state_and_fault() {
|
||||
// Color is selected by the real normalized RIGHT-down intrinsic.
|
||||
let mut code = assemble("INTRINSIC 0x2000\nINTRINSIC 0x2013\nINTRINSIC 0x2032\n").unwrap();
|
||||
let jump = code.len() + 2;
|
||||
code.extend(
|
||||
assemble("JMP_IF_FALSE 0\nPUSH_I64 4278190335\nHOSTCALL 0\nFRAME_SYNC\nRET\n").unwrap(),
|
||||
);
|
||||
let blue = code.len() as u32;
|
||||
code[jump..jump + 4].copy_from_slice(&blue.to_le_bytes());
|
||||
code.extend(assemble("PUSH_I64 65535\nHOSTCALL 0\nFRAME_SYNC\nRET\n").unwrap());
|
||||
let dir = cartridge_bytes(code, true);
|
||||
let run = |c: &mut Client| {
|
||||
boot(c, &dir);
|
||||
c.ok("set_input", json!({"right":true}));
|
||||
c.ok("advance", json!({"frames":12}));
|
||||
let held = c.ok("capture", json!({}));
|
||||
assert!(png_bytes(&held).as_chunks::<4>().0.iter().all(|p| *p == [255, 0, 0, 255]));
|
||||
c.ok("clear_input", json!({}));
|
||||
c.ok("advance", json!({"frames":1}));
|
||||
let released = c.ok("capture", json!({}));
|
||||
assert!(png_bytes(&released).as_chunks::<4>().0.iter().all(|p| *p == [0, 0, 255, 255]));
|
||||
(held, released, c.ok("get_state", json!({})), c.ok("get_fault", json!({})))
|
||||
};
|
||||
let mut first = Client::new(&["--stdio"]);
|
||||
first.initialize();
|
||||
let expected = run(&mut first);
|
||||
first.ok("reset", json!({}));
|
||||
assert_eq!(run(&mut first), expected);
|
||||
first.close();
|
||||
let mut second = Client::new(&["--stdio"]);
|
||||
second.initialize();
|
||||
assert_eq!(run(&mut second), expected);
|
||||
second.close();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn partial_guest_fault_and_host_watchdog_are_distinct_outcomes() {
|
||||
let mut code =
|
||||
assemble("GET_GLOBAL 0\nPUSH_I32 1\nADD\nSET_GLOBAL 0\nGET_GLOBAL 0\nPUSH_I32 3\nEQ\n")
|
||||
.unwrap();
|
||||
let jump = code.len() + 2;
|
||||
code.extend(assemble("JMP_IF_FALSE 0\nTRAP\n").unwrap());
|
||||
let next = code.len() as u32;
|
||||
code[jump..jump + 4].copy_from_slice(&next.to_le_bytes());
|
||||
code.extend(assemble("PUSH_I64 255\nHOSTCALL 0\nFRAME_SYNC\nRET\n").unwrap());
|
||||
let dir = cartridge_bytes(code, true);
|
||||
let mut c = Client::new(&["--stdio"]);
|
||||
c.initialize();
|
||||
boot(&mut c, &dir);
|
||||
let outcome = c.ok("advance", json!({"frames":5}));
|
||||
assert_eq!(outcome["completed"], 2);
|
||||
assert_eq!(outcome["stop"], "faulted");
|
||||
assert_eq!(outcome["fault"], c.ok("get_fault", json!({})));
|
||||
c.ok("reset", json!({}));
|
||||
let infinite = cartridge("JMP 0\n", false);
|
||||
boot(&mut c, &infinite);
|
||||
let outcome = c.ok("advance", json!({"frames":5}));
|
||||
assert_eq!(outcome["completed"], 0);
|
||||
assert_eq!(outcome["stop"], "host_error");
|
||||
assert_eq!(outcome["error"]["code"], "watchdog_expired");
|
||||
assert_eq!(c.ok("get_fault", json!({})), Value::Null);
|
||||
assert_eq!(c.ok("get_state", json!({}))["status"], "paused");
|
||||
c.close();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn faults_and_boot_failures_are_structured_not_log_parsing() {
|
||||
let dir = cartridge("TRAP\nFRAME_SYNC\nRET\n", false);
|
||||
let mut c = Client::new(&["--stdio"]);
|
||||
c.initialize();
|
||||
boot(&mut c, &dir);
|
||||
let result = c.ok("advance", json!({"frames":5}));
|
||||
assert_eq!(result["completed"], 0);
|
||||
assert_eq!(result["stop"], "faulted");
|
||||
assert_eq!(result["fault"]["kind"], "vm_trap");
|
||||
assert!(result["fault"]["trap"]["code"].is_number());
|
||||
assert_eq!(c.ok("get_fault", json!({})), result["fault"]);
|
||||
assert_eq!(c.ok("get_state", json!({}))["status"], "faulted");
|
||||
c.ok("reset", json!({}));
|
||||
fs::write(dir.0.join("program.pbx"), b"not PBX").unwrap();
|
||||
let response = c.call("boot", json!({"path":dir.0}));
|
||||
assert_eq!(response["error"]["code"], "boot_failed");
|
||||
assert_eq!(response["error"]["details"]["fault"]["kind"], "vm_init");
|
||||
assert!(response["error"]["details"]["fault"]["initError"]["code"].is_string());
|
||||
c.close();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn conflicting_work_is_rejected_and_cancellation_reports_partial_progress() {
|
||||
let dir = colored_cart();
|
||||
let mut c = Client::new(&["--stdio", "--max-frames", "100000"]);
|
||||
c.initialize();
|
||||
boot(&mut c, &dir);
|
||||
let advance = c.send("advance", json!({"frames":100000}));
|
||||
assert_eq!(c.event()["type"], "progress");
|
||||
assert_eq!(c.call("reset", json!({}))["error"]["code"], "busy");
|
||||
c.ok("cancel", json!({"targetRequestId":advance}));
|
||||
let response = c.response(&advance);
|
||||
let result = &response["result"];
|
||||
assert_eq!(result["stop"], "canceled");
|
||||
assert!(
|
||||
result["completed"].as_u64().unwrap() >= 1
|
||||
&& result["completed"].as_u64().unwrap() < 100000
|
||||
);
|
||||
assert_eq!(c.ok("get_state", json!({}))["logicalFrameIndex"], result["completed"]);
|
||||
assert_eq!(
|
||||
c.call("cancel", json!({"targetRequestId":advance}))["error"]["code"],
|
||||
"not_cancelable"
|
||||
);
|
||||
c.close();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shutdown_and_eof_interrupt_active_work_without_resuming_it() {
|
||||
let dir = colored_cart();
|
||||
for explicit in [true, false] {
|
||||
let mut c = Client::new(&["--stdio", "--max-frames", "100000"]);
|
||||
c.initialize();
|
||||
boot(&mut c, &dir);
|
||||
let advance = c.send("advance", json!({"frames":100000}));
|
||||
assert_eq!(c.event()["type"], "progress");
|
||||
if explicit {
|
||||
let shutdown = c.send("shutdown", json!({}));
|
||||
assert_eq!(c.response(&advance)["result"]["stop"], "canceled");
|
||||
assert_eq!(c.response(&shutdown)["result"]["closed"], true);
|
||||
} else {
|
||||
c.input.take();
|
||||
assert_eq!(c.response(&advance)["result"]["stop"], "canceled");
|
||||
}
|
||||
c.wait_exit();
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn idle_eof_and_truncated_eof_close_the_process() {
|
||||
for suffix in [b"".as_slice(), b"{\"requestId\":\"partial\"".as_slice()] {
|
||||
let mut c = Client::new(&["--stdio"]);
|
||||
c.raw(suffix);
|
||||
c.input.take();
|
||||
if !suffix.is_empty() {
|
||||
assert_eq!(c.event()["error"]["code"], "invalid_request");
|
||||
}
|
||||
c.wait_exit();
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dispatcher_works_from_a_relocated_installation_and_other_cwd() {
|
||||
let installation = TempDir::new();
|
||||
let cwd = TempDir::new();
|
||||
let dispatcher = installation.0.join(if cfg!(windows) { "prometeu.exe" } else { "prometeu" });
|
||||
let headless = installation.0.join(if cfg!(windows) {
|
||||
"prometeu-headless.exe"
|
||||
} else {
|
||||
"prometeu-headless"
|
||||
});
|
||||
fs::copy(env!("CARGO_BIN_EXE_prometeu"), &dispatcher).unwrap();
|
||||
fs::copy(env!("CARGO_BIN_EXE_prometeu-headless"), &headless).unwrap();
|
||||
let mut c = Client::spawn(
|
||||
&dispatcher,
|
||||
&[
|
||||
"headless",
|
||||
"--stdio",
|
||||
"--max-frames",
|
||||
"17",
|
||||
"--max-command-bytes",
|
||||
"8192",
|
||||
"--max-response-bytes",
|
||||
"16384",
|
||||
"--handshake-timeout-ms",
|
||||
"1234",
|
||||
"--call-timeout-ms",
|
||||
"2345",
|
||||
"--shutdown-timeout-ms",
|
||||
"3456",
|
||||
],
|
||||
Some(&cwd.0),
|
||||
);
|
||||
assert_eq!(
|
||||
c.hello["limits"],
|
||||
json!({"maxFrames":17,"maxCommandBytes":8192,"maxResponseBytes":16384,
|
||||
"handshakeTimeoutMs":1234,"callTimeoutMs":2345,"shutdownTimeoutMs":3456})
|
||||
);
|
||||
c.initialize();
|
||||
c.close();
|
||||
let help = Command::new(&dispatcher).arg("--help").output().unwrap();
|
||||
let help = String::from_utf8(help.stdout).unwrap();
|
||||
for name in ["run", "debug", "headless"] {
|
||||
assert!(help.contains(name));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_binary_and_invalid_cli_limits_fail_explicitly() {
|
||||
let installation = TempDir::new();
|
||||
let dispatcher = installation.0.join(if cfg!(windows) { "prometeu.exe" } else { "prometeu" });
|
||||
fs::copy(env!("CARGO_BIN_EXE_prometeu"), &dispatcher).unwrap();
|
||||
let result = Command::new(&dispatcher).args(["headless", "--stdio"]).output().unwrap();
|
||||
assert!(!result.status.success());
|
||||
assert!(String::from_utf8_lossy(&result.stderr).contains("headless"));
|
||||
for args in
|
||||
[vec!["--stdio", "--max-frames", "0"], vec!["--stdio", "--max-response-bytes", "1"], vec![]]
|
||||
{
|
||||
let result =
|
||||
Command::new(env!("CARGO_BIN_EXE_prometeu-headless")).args(args).output().unwrap();
|
||||
assert!(!result.status.success());
|
||||
assert!(result.stdout.is_empty());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn schemas_and_distributed_request_fixtures_are_consistent() {
|
||||
let request: Value = serde_json::from_str(include_str!(
|
||||
"../../../../devtools/headless-protocol/request.schema.json"
|
||||
))
|
||||
.unwrap();
|
||||
let response: Value = serde_json::from_str(include_str!(
|
||||
"../../../../devtools/headless-protocol/response.schema.json"
|
||||
))
|
||||
.unwrap();
|
||||
jsonschema::meta::validate(&request).unwrap();
|
||||
jsonschema::meta::validate(&response).unwrap();
|
||||
let validator = jsonschema::validator_for(&request).unwrap();
|
||||
let valid: Vec<Value> =
|
||||
serde_json::from_str(include_str!("../../../../devtools/headless-protocol/requests.json"))
|
||||
.unwrap();
|
||||
for request in valid {
|
||||
validator.validate(&request).unwrap();
|
||||
}
|
||||
let invalid: Vec<Value> = serde_json::from_str(include_str!(
|
||||
"../../../../devtools/headless-protocol/invalid-requests.json"
|
||||
))
|
||||
.unwrap();
|
||||
let mut c = Client::new(&["--stdio"]);
|
||||
c.initialize();
|
||||
for request in invalid {
|
||||
assert!(!validator.is_valid(&request), "{request}");
|
||||
let mut bytes = serde_json::to_vec(&request).unwrap();
|
||||
bytes.push(b'\n');
|
||||
c.raw(&bytes);
|
||||
assert!(c.event().get("error").is_some(), "{request}");
|
||||
}
|
||||
c.close();
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "requires PROMETEU_PROTOCOL_TEST_INSTALL pointing to an extracted dist archive"]
|
||||
fn packaged_installation_smoke() {
|
||||
let installation = PathBuf::from(
|
||||
std::env::var_os("PROMETEU_PROTOCOL_TEST_INSTALL")
|
||||
.expect("set extracted distribution path"),
|
||||
);
|
||||
for file in [
|
||||
"prometeu",
|
||||
"prometeu-runtime",
|
||||
"prometeu-headless",
|
||||
"headless-protocol/request.schema.json",
|
||||
"headless-protocol/response.schema.json",
|
||||
"11a-headless-automation-protocol.md",
|
||||
] {
|
||||
assert!(installation.join(file).is_file(), "missing packaged {file}");
|
||||
}
|
||||
let cwd = TempDir::new();
|
||||
let dir = colored_cart();
|
||||
let mut c =
|
||||
Client::spawn(&installation.join("prometeu"), &["headless", "--stdio"], Some(&cwd.0));
|
||||
assert_eq!(c.hello["runtimeVersion"], env!("CARGO_PKG_VERSION"));
|
||||
c.initialize();
|
||||
boot(&mut c, &dir);
|
||||
c.ok("advance", json!({"frames":3}));
|
||||
let capture = c.ok("capture", json!({}));
|
||||
assert!(png_bytes(&capture).as_chunks::<4>().0.iter().all(|p| *p == [255, 0, 0, 255]));
|
||||
c.input.take();
|
||||
c.wait_exit();
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
[
|
||||
{
|
||||
"requestId": "negative",
|
||||
"command": "advance",
|
||||
"params": {
|
||||
"frames": -1
|
||||
}
|
||||
},
|
||||
{
|
||||
"requestId": "wrong-input",
|
||||
"command": "set_input",
|
||||
"params": {
|
||||
"rigth": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"requestId": "extra",
|
||||
"command": "get_state",
|
||||
"params": {
|
||||
"extra": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"requestId": "unknown",
|
||||
"command": "missing",
|
||||
"params": {}
|
||||
},
|
||||
{
|
||||
"requestId": "blank-path",
|
||||
"command": "boot",
|
||||
"params": {
|
||||
"path": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"requestId": "",
|
||||
"command": "reset",
|
||||
"params": {}
|
||||
},
|
||||
{
|
||||
"requestId": "no-params",
|
||||
"command": "get_state"
|
||||
},
|
||||
{
|
||||
"requestId": "null-params",
|
||||
"command": "get_state",
|
||||
"params": null
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,284 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://prometeu.dev/headless/v1/request.schema.json",
|
||||
"title": "Prometeu Headless v1 Request",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"requestId",
|
||||
"command",
|
||||
"params"
|
||||
],
|
||||
"properties": {
|
||||
"requestId": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 128
|
||||
},
|
||||
"command": {
|
||||
"type": "string"
|
||||
},
|
||||
"params": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"oneOf": [
|
||||
{
|
||||
"properties": {
|
||||
"command": {
|
||||
"const": "initialize"
|
||||
},
|
||||
"params": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"protocolVersion",
|
||||
"requiredCapabilities"
|
||||
],
|
||||
"properties": {
|
||||
"protocolVersion": {
|
||||
"$ref": "#/$defs/version"
|
||||
},
|
||||
"requiredCapabilities": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"command": {
|
||||
"const": "boot"
|
||||
},
|
||||
"params": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"path"
|
||||
],
|
||||
"properties": {
|
||||
"path": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"pattern": "\\S"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"command": {
|
||||
"const": "advance"
|
||||
},
|
||||
"params": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"frames"
|
||||
],
|
||||
"properties": {
|
||||
"frames": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 18446744073709551615
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"command": {
|
||||
"const": "set_input"
|
||||
},
|
||||
"params": {
|
||||
"$ref": "#/$defs/input"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"command": {
|
||||
"const": "cancel"
|
||||
},
|
||||
"params": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"targetRequestId"
|
||||
],
|
||||
"properties": {
|
||||
"targetRequestId": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 128
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"command": {
|
||||
"const": "reset"
|
||||
},
|
||||
"params": {
|
||||
"type": "object",
|
||||
"maxProperties": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"command": {
|
||||
"const": "clear_input"
|
||||
},
|
||||
"params": {
|
||||
"type": "object",
|
||||
"maxProperties": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"command": {
|
||||
"const": "capture"
|
||||
},
|
||||
"params": {
|
||||
"type": "object",
|
||||
"maxProperties": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"command": {
|
||||
"const": "get_state"
|
||||
},
|
||||
"params": {
|
||||
"type": "object",
|
||||
"maxProperties": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"command": {
|
||||
"const": "get_fault"
|
||||
},
|
||||
"params": {
|
||||
"type": "object",
|
||||
"maxProperties": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"command": {
|
||||
"const": "shutdown"
|
||||
},
|
||||
"params": {
|
||||
"type": "object",
|
||||
"maxProperties": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"$defs": {
|
||||
"version": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"major",
|
||||
"minor"
|
||||
],
|
||||
"properties": {
|
||||
"major": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 4294967295
|
||||
},
|
||||
"minor": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 4294967295
|
||||
}
|
||||
}
|
||||
},
|
||||
"input": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"up": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"down": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"left": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"right": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"a": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"b": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"x": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"y": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"l": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"r": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"start": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"select": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"touch": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"touchX": {
|
||||
"type": "integer",
|
||||
"minimum": -2147483648,
|
||||
"maximum": 2147483647,
|
||||
"default": 0
|
||||
},
|
||||
"touchY": {
|
||||
"type": "integer",
|
||||
"minimum": -2147483648,
|
||||
"maximum": 2147483647,
|
||||
"default": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
[
|
||||
{
|
||||
"requestId": "init",
|
||||
"command": "initialize",
|
||||
"params": {
|
||||
"protocolVersion": {
|
||||
"major": 1,
|
||||
"minor": 0
|
||||
},
|
||||
"requiredCapabilities": [
|
||||
"advance",
|
||||
"capture",
|
||||
"cancel"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"requestId": "boot",
|
||||
"command": "boot",
|
||||
"params": {
|
||||
"path": "/cartridge"
|
||||
}
|
||||
},
|
||||
{
|
||||
"requestId": "reset",
|
||||
"command": "reset",
|
||||
"params": {}
|
||||
},
|
||||
{
|
||||
"requestId": "input",
|
||||
"command": "set_input",
|
||||
"params": {
|
||||
"right": true,
|
||||
"touch": true,
|
||||
"touchX": 123,
|
||||
"touchY": 45
|
||||
}
|
||||
},
|
||||
{
|
||||
"requestId": "clear",
|
||||
"command": "clear_input",
|
||||
"params": {}
|
||||
},
|
||||
{
|
||||
"requestId": "advance",
|
||||
"command": "advance",
|
||||
"params": {
|
||||
"frames": 60
|
||||
}
|
||||
},
|
||||
{
|
||||
"requestId": "capture",
|
||||
"command": "capture",
|
||||
"params": {}
|
||||
},
|
||||
{
|
||||
"requestId": "get_state",
|
||||
"command": "get_state",
|
||||
"params": {}
|
||||
},
|
||||
{
|
||||
"requestId": "get_fault",
|
||||
"command": "get_fault",
|
||||
"params": {}
|
||||
},
|
||||
{
|
||||
"requestId": "shutdown",
|
||||
"command": "shutdown",
|
||||
"params": {}
|
||||
},
|
||||
{
|
||||
"requestId": "cancel",
|
||||
"command": "cancel",
|
||||
"params": {
|
||||
"targetRequestId": "advance"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,666 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"title": "Prometeu headless server messages v1.0",
|
||||
"$comment": "requestId additionally has a 128 UTF-8-byte bound; uint counters require lossless decoding. v1.0 producers are checked strictly. Consumers must allow compatible minor extensions.",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "hello"
|
||||
},
|
||||
"sessionId": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"protocolVersion": {
|
||||
"$ref": "#/$defs/version"
|
||||
},
|
||||
"runtimeVersion": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"capabilities": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"limits": {
|
||||
"$ref": "#/$defs/limits"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"sessionId",
|
||||
"protocolVersion",
|
||||
"runtimeVersion",
|
||||
"capabilities",
|
||||
"limits"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "progress"
|
||||
},
|
||||
"sessionId": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"requestId": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 128
|
||||
},
|
||||
"requested": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"completed": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"sessionId",
|
||||
"requestId",
|
||||
"requested",
|
||||
"completed"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "response"
|
||||
},
|
||||
"sessionId": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"requestId": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"minLength": 1,
|
||||
"maxLength": 128
|
||||
},
|
||||
"error": {
|
||||
"$ref": "#/$defs/error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"sessionId",
|
||||
"requestId",
|
||||
"error"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "response"
|
||||
},
|
||||
"sessionId": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"requestId": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 128
|
||||
},
|
||||
"result": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/$defs/negotiated"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/state"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/advance"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/capture"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/fault"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {},
|
||||
"required": [],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"targetRequestId": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 128
|
||||
},
|
||||
"requested": {
|
||||
"const": true
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"targetRequestId",
|
||||
"requested"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"closed": {
|
||||
"const": true
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"closed"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"sessionId",
|
||||
"requestId",
|
||||
"result"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
],
|
||||
"$defs": {
|
||||
"version": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"major": {
|
||||
"const": 1
|
||||
},
|
||||
"minor": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"major",
|
||||
"minor"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"error": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "string"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"details": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"code",
|
||||
"message",
|
||||
"details"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"stack": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {
|
||||
"const": "int32"
|
||||
},
|
||||
"value": {
|
||||
"type": "integer",
|
||||
"minimum": -2147483648,
|
||||
"maximum": 2147483647
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"kind",
|
||||
"value"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {
|
||||
"enum": [
|
||||
"int64",
|
||||
"float64",
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"kind",
|
||||
"value"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {
|
||||
"const": "heap_ref"
|
||||
},
|
||||
"value": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"kind",
|
||||
"value"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {
|
||||
"const": "boolean"
|
||||
},
|
||||
"value": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"kind",
|
||||
"value"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {
|
||||
"const": "null"
|
||||
},
|
||||
"value": {
|
||||
"type": "null"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"kind",
|
||||
"value"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"state": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pc": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"stackTop": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/stack"
|
||||
}
|
||||
},
|
||||
"logicalFrameIndex": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"tickIndex": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"appId": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"status": {
|
||||
"enum": [
|
||||
"running",
|
||||
"paused",
|
||||
"terminated",
|
||||
"faulted"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"pc",
|
||||
"stackTop",
|
||||
"logicalFrameIndex",
|
||||
"tickIndex",
|
||||
"appId",
|
||||
"status"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"fault": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pc": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"minimum": 0
|
||||
},
|
||||
"summary": {
|
||||
"type": "string"
|
||||
},
|
||||
"kind": {
|
||||
"const": "vm_trap"
|
||||
},
|
||||
"trap": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"opcode": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"pc": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"span": {
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"code",
|
||||
"opcode",
|
||||
"message",
|
||||
"pc",
|
||||
"span"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"pc",
|
||||
"summary",
|
||||
"kind",
|
||||
"trap"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pc": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"minimum": 0
|
||||
},
|
||||
"summary": {
|
||||
"type": "string"
|
||||
},
|
||||
"kind": {
|
||||
"const": "vm_panic"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"pc",
|
||||
"summary",
|
||||
"kind",
|
||||
"message"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pc": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"minimum": 0
|
||||
},
|
||||
"summary": {
|
||||
"type": "string"
|
||||
},
|
||||
"kind": {
|
||||
"const": "vm_init"
|
||||
},
|
||||
"initError": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "string"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"code",
|
||||
"message"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"pc",
|
||||
"summary",
|
||||
"kind",
|
||||
"initError"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"advance": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"requested": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"completed": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"stop": {
|
||||
"enum": [
|
||||
"completed",
|
||||
"faulted",
|
||||
"terminated",
|
||||
"canceled",
|
||||
"host_error"
|
||||
]
|
||||
},
|
||||
"fault": {
|
||||
"$ref": "#/$defs/fault"
|
||||
},
|
||||
"error": {
|
||||
"$ref": "#/$defs/error"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"requested",
|
||||
"completed",
|
||||
"stop"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"allOf": [
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"stop": {
|
||||
"const": "faulted"
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"required": [
|
||||
"fault"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"stop": {
|
||||
"const": "host_error"
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"required": [
|
||||
"error"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"capture": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"mimeType": {
|
||||
"const": "image/png"
|
||||
},
|
||||
"encoding": {
|
||||
"const": "base64"
|
||||
},
|
||||
"data": {
|
||||
"type": "string",
|
||||
"contentEncoding": "base64"
|
||||
},
|
||||
"width": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"height": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"stridePixels": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"pixelFormat": {
|
||||
"const": "RGBA8888"
|
||||
},
|
||||
"logicalFrameIndex": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"frameId": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"mimeType",
|
||||
"encoding",
|
||||
"data",
|
||||
"width",
|
||||
"height",
|
||||
"stridePixels",
|
||||
"pixelFormat",
|
||||
"logicalFrameIndex",
|
||||
"frameId"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"negotiated": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"protocolVersion": {
|
||||
"$ref": "#/$defs/version"
|
||||
},
|
||||
"capabilities": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"protocolVersion",
|
||||
"capabilities"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"limits": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"maxFrames": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"maxCommandBytes": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"maxResponseBytes": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"handshakeTimeoutMs": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"callTimeoutMs": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"shutdownTimeoutMs": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"maxFrames",
|
||||
"maxCommandBytes",
|
||||
"maxResponseBytes",
|
||||
"handshakeTimeoutMs",
|
||||
"callTimeoutMs",
|
||||
"shutdownTimeoutMs"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
{"type":"meta","next_id":{"DSC":25,"AGD":25,"DEC":13,"PLN":11,"LSN":29,"CLSN":1}}
|
||||
{"type":"discussion","id":"DSC-0023","status":"done","ticket":"perf-full-migration-to-atomic-telemetry","title":"Agenda - [PERF] Full Migration to Atomic Telemetry","created_at":"2026-04-10","updated_at":"2026-04-10","tags":["perf","runtime","telemetry"],"agendas":[{"id":"AGD-0021","file":"workflow/agendas/AGD-0021-full-migration-to-atomic-telemetry.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}],"decisions":[{"id":"DEC-0008","file":"workflow/decisions/DEC-0008-full-migration-to-atomic-telemetry.md","status":"accepted","created_at":"2026-04-10","updated_at":"2026-04-10"}],"plans":[{"id":"PLN-0007","file":"workflow/plans/PLN-0007-full-migration-to-atomic-telemetry.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}],"lessons":[{"id":"LSN-0028","file":"lessons/DSC-0023-perf-full-migration-to-atomic-telemetry/LSN-0028-converging-to-single-atomic-telemetry-source.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0020","status":"done","ticket":"jenkins-gitea-integration","title":"Jenkins Gitea Integration and Relocation","created_at":"2026-04-07","updated_at":"2026-04-07","tags":["ci","jenkins","gitea"],"agendas":[{"id":"AGD-0018","file":"workflow/agendas/AGD-0018-jenkins-gitea-integration-and-relocation.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"decisions":[{"id":"DEC-0003","file":"workflow/decisions/DEC-0003-jenkins-gitea-strategy.md","status":"accepted","created_at":"2026-04-07","updated_at":"2026-04-07"}],"plans":[{"id":"PLN-0003","file":"workflow/plans/PLN-0003-jenkins-gitea-execution.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"lessons":[{"id":"LSN-0021","file":"lessons/DSC-0020-jenkins-gitea-integration/LSN-0021-jenkins-gitea-integration.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}]}
|
||||
{"type":"discussion","id":"DSC-0021","status":"done","ticket":"asset-entry-codec-enum-with-metadata","title":"Asset Entry Codec Enum Contract","created_at":"2026-04-09","updated_at":"2026-04-09","tags":["asset","runtime","codec","metadata"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0024","file":"lessons/DSC-0021-asset-entry-codec-enum-contract/LSN-0024-string-on-the-wire-enum-in-runtime.md","status":"done","created_at":"2026-04-09","updated_at":"2026-04-09"}]}
|
||||
{"type":"discussion","id":"DSC-0022","status":"done","ticket":"tile-bank-vs-glyph-bank-domain-naming","title":"Glyph Bank Domain Naming Contract","created_at":"2026-04-09","updated_at":"2026-04-10","tags":["gfx","runtime","naming","domain-model"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0025","file":"lessons/DSC-0022-glyph-bank-domain-naming/LSN-0025-rename-artifact-by-meaning-not-by-token.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0001","status":"done","ticket":"legacy-runtime-learn-import","title":"Import legacy runtime learn into discussion lessons","created_at":"2026-03-27","updated_at":"2026-03-27","tags":["migration","tech-debt"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0001","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0001-prometeu-learn-index.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0002","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0002-historical-asset-status-first-fault-and-return-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0003","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0003-historical-audio-status-first-fault-and-return-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0004","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0004-historical-cartridge-boot-protocol-and-manifest-authority.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0005","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0005-historical-game-memcard-slots-surface-and-semantics.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0006","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0006-historical-gfx-status-first-fault-and-return-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0007","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0007-historical-retired-fault-and-input-decisions.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0008","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0008-historical-vm-core-and-assets.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0009","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0009-mental-model-asset-management.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0010","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0010-mental-model-audio.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0011","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0011-mental-model-gfx.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0012","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0012-mental-model-input.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0013","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0013-mental-model-observability-and-debugging.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0014","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0014-mental-model-portability-and-cross-platform.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0015","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0015-mental-model-save-memory-and-memcard.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0016","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0016-mental-model-status-first-and-fault-thinking.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0017","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0017-mental-model-time-and-cycles.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0018","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0018-mental-model-touch.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"}]}
|
||||
{"type":"discussion","id":"DSC-0002","status":"open","ticket":"runtime-edge-test-plan","title":"Agenda - Runtime Edge Test Plan","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0001","file":"workflow/agendas/AGD-0001-runtime-edge-test-plan.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0003","status":"open","ticket":"packed-cartridge-loader-pmc","title":"Agenda - Packed Cartridge Loader PMC","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0002","file":"workflow/agendas/AGD-0002-packed-cartridge-loader-pmc.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0004","status":"open","ticket":"system-run-cart","title":"Agenda - System Run Cart","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0003","file":"workflow/agendas/AGD-0003-system-run-cart.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0005","status":"open","ticket":"system-fault-semantics-and-control-surface","title":"Agenda - System Fault Semantics and Control Surface","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0004","file":"workflow/agendas/AGD-0004-system-fault-semantics-and-control-surface.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0006","status":"open","ticket":"vm-owned-random-service","title":"Agenda - VM-Owned Random Service","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0005","file":"workflow/agendas/AGD-0005-vm-owned-random-service.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0007","status":"open","ticket":"app-home-filesystem-surface-and-semantics","title":"Agenda - App Home Filesystem Surface and Semantics","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0006","file":"workflow/agendas/AGD-0006-app-home-filesystem-surface-and-semantics.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0008","status":"done","ticket":"perf-runtime-telemetry-hot-path","title":"Agenda - [PERF] Runtime Telemetry Hot Path","created_at":"2026-03-27","updated_at":"2026-04-10","tags":[],"agendas":[{"id":"AGD-0007","file":"workflow/agendas/AGD-0007-perf-runtime-telemetry-hot-path.md","status":"done","created_at":"2026-03-27","updated_at":"2026-04-10"}],"decisions":[{"id":"DEC-0005","file":"workflow/decisions/DEC-0005-perf-push-based-telemetry-model.md","status":"accepted","created_at":"2026-04-10","updated_at":"2026-04-10"}],"plans":[{"id":"PLN-0005","file":"workflow/plans/PLN-0005-perf-push-based-telemetry-implementation.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}],"lessons":[{"id":"LSN-0026","file":"lessons/DSC-0008-perf-runtime-telemetry-hot-path/LSN-0026-push-based-telemetry-model.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0009","status":"open","ticket":"perf-async-background-work-lanes-for-assets-and-fs","title":"Agenda - [PERF] Async Background Work Lanes for Assets and FS","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0008","file":"workflow/agendas/AGD-0008-perf-async-background-work-lanes-for-assets-and-fs.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0010","status":"open","ticket":"perf-host-desktop-frame-pacing-and-presentation","title":"Agenda - [PERF] Host Desktop Frame Pacing and Presentation","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0009","file":"workflow/agendas/AGD-0009-perf-host-desktop-frame-pacing-and-presentation.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0011","status":"open","ticket":"perf-gfx-render-pipeline-and-dirty-regions","title":"Agenda - [PERF] GFX Render Pipeline and Dirty Regions","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0010","file":"workflow/agendas/AGD-0010-perf-gfx-render-pipeline-and-dirty-regions.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0012","status":"open","ticket":"perf-runtime-introspection-syscalls","title":"Agenda - [PERF] Runtime Introspection Syscalls","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0011","file":"workflow/agendas/AGD-0011-perf-runtime-introspection-syscalls.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0013","status":"open","ticket":"perf-host-debug-overlay-isolation","title":"Agenda - [PERF] Host Debug Overlay Isolation","created_at":"2026-03-27","updated_at":"2026-04-10","tags":[],"agendas":[{"id":"AGD-0012","file":"workflow/agendas/AGD-0012-perf-host-debug-overlay-isolation.md","status":"done","created_at":"2026-03-27","updated_at":"2026-04-10"},{"id":"AGD-0022","file":"AGD-0022-host-overlay-tooling-boundary-revision.md","status":"accepted","created_at":"2026-04-10","updated_at":"2026-04-10"},{"id":"AGD-0023","file":"AGD-0023-overlay-log-metric-last-frame.md","status":"accepted","created_at":"2026-04-10","updated_at":"2026-04-10"}],"decisions":[{"id":"DEC-0007","file":"workflow/decisions/DEC-0007-perf-host-debug-overlay-isolation.md","status":"accepted","created_at":"2026-04-10","updated_at":"2026-04-10"},{"id":"DEC-0009","file":"DEC-0009-host-overlay-tooling-boundary.md","status":"accepted","created_at":"2026-04-10","updated_at":"2026-04-10","ref_agenda":"AGD-0022"},{"id":"DEC-0010","file":"DEC-0010-overlay-log-metric-last-frame.md","status":"accepted","created_at":"2026-04-10","updated_at":"2026-04-10","ref_agenda":"AGD-0023"}],"plans":[{"id":"PLN-0006","file":"workflow/plans/PLN-0006-perf-host-debug-overlay-isolation.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"},{"id":"PLN-0008","file":"PLN-0008-host-overlay-native-composition-alignment.md","status":"in_progress","created_at":"2026-04-10","updated_at":"2026-04-10","ref_decisions":["DEC-0007","DEC-0008","DEC-0009","DEC-0010"]}],"lessons":[{"id":"LSN-0027","file":"lessons/DSC-0013-perf-host-debug-overlay-isolation/LSN-0027-host-debug-overlay-isolation.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0024","status":"open","ticket":"generic-memory-bank-slot-contract","title":"Agenda - Generic Memory Bank Slot Contract","created_at":"2026-04-10","updated_at":"2026-04-10","tags":["runtime","asset","memory-bank","slots","host"],"agendas":[{"id":"AGD-0024","file":"AGD-0024-generic-memory-bank-slot-contract.md","status":"accepted","created_at":"2026-04-10","updated_at":"2026-04-10"}],"decisions":[{"id":"DEC-0012","file":"DEC-0012-asset-manager-bank-telemetry-slot-contract.md","status":"accepted","created_at":"2026-04-10","updated_at":"2026-04-10","ref_agenda":"AGD-0024"}],"plans":[{"id":"PLN-0010","file":"PLN-0010-asset-manager-bank-telemetry-slot-contract.md","status":"in_progress","created_at":"2026-04-10","updated_at":"2026-04-10","ref_decisions":["DEC-0012"]}],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0014","status":"open","ticket":"perf-vm-allocation-and-copy-pressure","title":"Agenda - [PERF] VM Allocation and Copy Pressure","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0013","file":"workflow/agendas/AGD-0013-perf-vm-allocation-and-copy-pressure.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0015","status":"open","ticket":"perf-cartridge-boot-and-program-ownership","title":"Agenda - [PERF] Cartridge Boot and Program Ownership","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0014","file":"workflow/agendas/AGD-0014-perf-cartridge-boot-and-program-ownership.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0016","status":"done","ticket":"tilemap-empty-cell-vs-tile-id-zero","title":"Tilemap Empty Cell vs Tile ID Zero","created_at":"2026-03-27","updated_at":"2026-04-09","tags":[],"agendas":[{"id":"AGD-0015","file":"workflow/agendas/AGD-0015-tilemap-empty-cell-vs-tile-id-zero.md","status":"done","created_at":"2026-03-27","updated_at":"2026-04-09"}],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0022","file":"lessons/DSC-0016-tilemap-empty-cell-semantics/LSN-0022-tilemap-empty-cell-convergence.md","status":"done","created_at":"2026-04-09","updated_at":"2026-04-09"}]}
|
||||
{"type":"discussion","id":"DSC-0017","status":"done","ticket":"asset-entry-metadata-normalization-contract","title":"Asset Entry Metadata Normalization Contract","created_at":"2026-03-27","updated_at":"2026-04-09","tags":[],"agendas":[{"id":"AGD-0016","file":"workflow/agendas/AGD-0016-asset-entry-metadata-normalization-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-04-09"}],"decisions":[{"id":"DEC-0004","file":"workflow/decisions/DEC-0004-asset-entry-metadata-normalization-contract.md","status":"accepted","created_at":"2026-04-09","updated_at":"2026-04-09"}],"plans":[],"lessons":[{"id":"LSN-0023","file":"lessons/DSC-0017-asset-metadata-normalization/LSN-0023-typed-asset-metadata-helpers.md","status":"done","created_at":"2026-04-09","updated_at":"2026-04-09"}]}
|
||||
{"type":"discussion","id":"DSC-0018","status":"done","ticket":"asset-load-asset-id-int-contract","title":"Asset Load Asset ID Int Contract","created_at":"2026-03-27","updated_at":"2026-03-27","tags":["asset","runtime","abi"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0019","file":"lessons/DSC-0018-asset-load-asset-id-int-contract/LSN-0019-asset-load-id-abi-convergence.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"}]}
|
||||
{"type":"discussion","id":"DSC-0019","status":"done","ticket":"jenkinsfile-correction","title":"Jenkinsfile Correction and Relocation","created_at":"2026-04-07","updated_at":"2026-04-07","tags":["ci","jenkins"],"agendas":[{"id":"AGD-0017","file":"workflow/agendas/AGD-0017-jenkinsfile-correction.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"decisions":[{"id":"DEC-0002","file":"workflow/decisions/DEC-0002-jenkinsfile-strategy.md","status":"accepted","created_at":"2026-04-07","updated_at":"2026-04-07"}],"plans":[{"id":"PLN-0002","file":"workflow/plans/PLN-0002-jenkinsfile-execution.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"lessons":[{"id":"LSN-0020","file":"lessons/DSC-0019-jenkins-ci-standardization/LSN-0020-jenkins-standard-relocation.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}]}
|
||||
@@ -1,26 +0,0 @@
|
||||
{"type":"meta","next_id":{"DSC":26,"AGD":26,"DEC":14,"PLN":17,"LSN":31,"CLSN":1}}
|
||||
{"type":"discussion","id":"DSC-0023","status":"done","ticket":"perf-full-migration-to-atomic-telemetry","title":"Agenda - [PERF] Full Migration to Atomic Telemetry","created_at":"2026-04-10","updated_at":"2026-04-10","tags":["perf","runtime","telemetry"],"agendas":[{"id":"AGD-0021","file":"workflow/agendas/AGD-0021-full-migration-to-atomic-telemetry.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}],"decisions":[{"id":"DEC-0008","file":"workflow/decisions/DEC-0008-full-migration-to-atomic-telemetry.md","status":"accepted","created_at":"2026-04-10","updated_at":"2026-04-10"}],"plans":[{"id":"PLN-0007","file":"workflow/plans/PLN-0007-full-migration-to-atomic-telemetry.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}],"lessons":[{"id":"LSN-0028","file":"lessons/DSC-0023-perf-full-migration-to-atomic-telemetry/LSN-0028-converging-to-single-atomic-telemetry-source.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0020","status":"done","ticket":"jenkins-gitea-integration","title":"Jenkins Gitea Integration and Relocation","created_at":"2026-04-07","updated_at":"2026-04-07","tags":["ci","jenkins","gitea"],"agendas":[{"id":"AGD-0018","file":"workflow/agendas/AGD-0018-jenkins-gitea-integration-and-relocation.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"decisions":[{"id":"DEC-0003","file":"workflow/decisions/DEC-0003-jenkins-gitea-strategy.md","status":"accepted","created_at":"2026-04-07","updated_at":"2026-04-07"}],"plans":[{"id":"PLN-0003","file":"workflow/plans/PLN-0003-jenkins-gitea-execution.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"lessons":[{"id":"LSN-0021","file":"lessons/DSC-0020-jenkins-gitea-integration/LSN-0021-jenkins-gitea-integration.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}]}
|
||||
{"type":"discussion","id":"DSC-0021","status":"done","ticket":"asset-entry-codec-enum-with-metadata","title":"Asset Entry Codec Enum Contract","created_at":"2026-04-09","updated_at":"2026-04-09","tags":["asset","runtime","codec","metadata"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0024","file":"lessons/DSC-0021-asset-entry-codec-enum-contract/LSN-0024-string-on-the-wire-enum-in-runtime.md","status":"done","created_at":"2026-04-09","updated_at":"2026-04-09"}]}
|
||||
{"type":"discussion","id":"DSC-0022","status":"done","ticket":"tile-bank-vs-glyph-bank-domain-naming","title":"Glyph Bank Domain Naming Contract","created_at":"2026-04-09","updated_at":"2026-04-10","tags":["gfx","runtime","naming","domain-model"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0025","file":"lessons/DSC-0022-glyph-bank-domain-naming/LSN-0025-rename-artifact-by-meaning-not-by-token.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0001","status":"done","ticket":"legacy-runtime-learn-import","title":"Import legacy runtime learn into discussion lessons","created_at":"2026-03-27","updated_at":"2026-03-27","tags":["migration","tech-debt"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0001","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0001-prometeu-learn-index.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0002","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0002-historical-asset-status-first-fault-and-return-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0003","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0003-historical-audio-status-first-fault-and-return-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0004","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0004-historical-cartridge-boot-protocol-and-manifest-authority.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0005","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0005-historical-game-memcard-slots-surface-and-semantics.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0006","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0006-historical-gfx-status-first-fault-and-return-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0007","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0007-historical-retired-fault-and-input-decisions.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0008","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0008-historical-vm-core-and-assets.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0009","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0009-mental-model-asset-management.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0010","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0010-mental-model-audio.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0011","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0011-mental-model-gfx.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0012","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0012-mental-model-input.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0013","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0013-mental-model-observability-and-debugging.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0014","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0014-mental-model-portability-and-cross-platform.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0015","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0015-mental-model-save-memory-and-memcard.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0016","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0016-mental-model-status-first-and-fault-thinking.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0017","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0017-mental-model-time-and-cycles.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0018","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0018-mental-model-touch.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"}]}
|
||||
{"type":"discussion","id":"DSC-0002","status":"open","ticket":"runtime-edge-test-plan","title":"Agenda - Runtime Edge Test Plan","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0001","file":"workflow/agendas/AGD-0001-runtime-edge-test-plan.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0003","status":"open","ticket":"packed-cartridge-loader-pmc","title":"Agenda - Packed Cartridge Loader PMC","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0002","file":"workflow/agendas/AGD-0002-packed-cartridge-loader-pmc.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0004","status":"open","ticket":"system-run-cart","title":"Agenda - System Run Cart","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0003","file":"workflow/agendas/AGD-0003-system-run-cart.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0005","status":"open","ticket":"system-fault-semantics-and-control-surface","title":"Agenda - System Fault Semantics and Control Surface","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0004","file":"workflow/agendas/AGD-0004-system-fault-semantics-and-control-surface.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0006","status":"open","ticket":"vm-owned-random-service","title":"Agenda - VM-Owned Random Service","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0005","file":"workflow/agendas/AGD-0005-vm-owned-random-service.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0007","status":"open","ticket":"app-home-filesystem-surface-and-semantics","title":"Agenda - App Home Filesystem Surface and Semantics","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0006","file":"workflow/agendas/AGD-0006-app-home-filesystem-surface-and-semantics.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0008","status":"done","ticket":"perf-runtime-telemetry-hot-path","title":"Agenda - [PERF] Runtime Telemetry Hot Path","created_at":"2026-03-27","updated_at":"2026-04-10","tags":[],"agendas":[{"id":"AGD-0007","file":"workflow/agendas/AGD-0007-perf-runtime-telemetry-hot-path.md","status":"done","created_at":"2026-03-27","updated_at":"2026-04-10"}],"decisions":[{"id":"DEC-0005","file":"workflow/decisions/DEC-0005-perf-push-based-telemetry-model.md","status":"accepted","created_at":"2026-04-10","updated_at":"2026-04-10"}],"plans":[{"id":"PLN-0005","file":"workflow/plans/PLN-0005-perf-push-based-telemetry-implementation.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}],"lessons":[{"id":"LSN-0026","file":"lessons/DSC-0008-perf-runtime-telemetry-hot-path/LSN-0026-push-based-telemetry-model.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0009","status":"open","ticket":"perf-async-background-work-lanes-for-assets-and-fs","title":"Agenda - [PERF] Async Background Work Lanes for Assets and FS","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0008","file":"workflow/agendas/AGD-0008-perf-async-background-work-lanes-for-assets-and-fs.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0010","status":"open","ticket":"perf-host-desktop-frame-pacing-and-presentation","title":"Agenda - [PERF] Host Desktop Frame Pacing and Presentation","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0009","file":"workflow/agendas/AGD-0009-perf-host-desktop-frame-pacing-and-presentation.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0011","status":"open","ticket":"perf-gfx-render-pipeline-and-dirty-regions","title":"Agenda - [PERF] GFX Render Pipeline and Dirty Regions","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0010","file":"workflow/agendas/AGD-0010-perf-gfx-render-pipeline-and-dirty-regions.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0012","status":"open","ticket":"perf-runtime-introspection-syscalls","title":"Agenda - [PERF] Runtime Introspection Syscalls","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0011","file":"workflow/agendas/AGD-0011-perf-runtime-introspection-syscalls.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0013","status":"done","ticket":"perf-host-debug-overlay-isolation","title":"Agenda - [PERF] Host Debug Overlay Isolation","created_at":"2026-03-27","updated_at":"2026-04-10","tags":[],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0027","file":"lessons/DSC-0013-perf-host-debug-overlay-isolation/LSN-0027-host-debug-overlay-isolation.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0024","status":"done","ticket":"generic-memory-bank-slot-contract","title":"Agenda - Generic Memory Bank Slot Contract","created_at":"2026-04-10","updated_at":"2026-04-10","tags":["runtime","asset","memory-bank","slots","host"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0029","file":"lessons/DSC-0024-generic-memory-bank-slot-contract/LSN-0029-slot-first-bank-telemetry-belongs-in-asset-manager.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0025","status":"done","ticket":"scene-bank-and-viewport-cache-refactor","title":"Scene Bank and Viewport Cache Refactor","created_at":"2026-04-11","updated_at":"2026-04-14","tags":["gfx","tilemap","runtime","render"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0030","file":"lessons/DSC-0025-scene-bank-and-viewport-cache-refactor/LSN-0030-canonical-scene-cache-and-resolver-split.md","status":"done","created_at":"2026-04-14","updated_at":"2026-04-14"}]}
|
||||
{"type":"discussion","id":"DSC-0014","status":"open","ticket":"perf-vm-allocation-and-copy-pressure","title":"Agenda - [PERF] VM Allocation and Copy Pressure","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0013","file":"workflow/agendas/AGD-0013-perf-vm-allocation-and-copy-pressure.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0015","status":"open","ticket":"perf-cartridge-boot-and-program-ownership","title":"Agenda - [PERF] Cartridge Boot and Program Ownership","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0014","file":"workflow/agendas/AGD-0014-perf-cartridge-boot-and-program-ownership.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0016","status":"done","ticket":"tilemap-empty-cell-vs-tile-id-zero","title":"Tilemap Empty Cell vs Tile ID Zero","created_at":"2026-03-27","updated_at":"2026-04-09","tags":[],"agendas":[{"id":"AGD-0015","file":"workflow/agendas/AGD-0015-tilemap-empty-cell-vs-tile-id-zero.md","status":"done","created_at":"2026-03-27","updated_at":"2026-04-09"}],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0022","file":"lessons/DSC-0016-tilemap-empty-cell-semantics/LSN-0022-tilemap-empty-cell-convergence.md","status":"done","created_at":"2026-04-09","updated_at":"2026-04-09"}]}
|
||||
{"type":"discussion","id":"DSC-0017","status":"done","ticket":"asset-entry-metadata-normalization-contract","title":"Asset Entry Metadata Normalization Contract","created_at":"2026-03-27","updated_at":"2026-04-09","tags":[],"agendas":[{"id":"AGD-0016","file":"workflow/agendas/AGD-0016-asset-entry-metadata-normalization-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-04-09"}],"decisions":[{"id":"DEC-0004","file":"workflow/decisions/DEC-0004-asset-entry-metadata-normalization-contract.md","status":"accepted","created_at":"2026-04-09","updated_at":"2026-04-09"}],"plans":[],"lessons":[{"id":"LSN-0023","file":"lessons/DSC-0017-asset-metadata-normalization/LSN-0023-typed-asset-metadata-helpers.md","status":"done","created_at":"2026-04-09","updated_at":"2026-04-09"}]}
|
||||
{"type":"discussion","id":"DSC-0018","status":"done","ticket":"asset-load-asset-id-int-contract","title":"Asset Load Asset ID Int Contract","created_at":"2026-03-27","updated_at":"2026-03-27","tags":["asset","runtime","abi"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0019","file":"lessons/DSC-0018-asset-load-asset-id-int-contract/LSN-0019-asset-load-id-abi-convergence.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"}]}
|
||||
{"type":"discussion","id":"DSC-0019","status":"done","ticket":"jenkinsfile-correction","title":"Jenkinsfile Correction and Relocation","created_at":"2026-04-07","updated_at":"2026-04-07","tags":["ci","jenkins"],"agendas":[{"id":"AGD-0017","file":"workflow/agendas/AGD-0017-jenkinsfile-correction.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"decisions":[{"id":"DEC-0002","file":"workflow/decisions/DEC-0002-jenkinsfile-strategy.md","status":"accepted","created_at":"2026-04-07","updated_at":"2026-04-07"}],"plans":[{"id":"PLN-0002","file":"workflow/plans/PLN-0002-jenkinsfile-execution.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"lessons":[{"id":"LSN-0020","file":"lessons/DSC-0019-jenkins-ci-standardization/LSN-0020-jenkins-standard-relocation.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}]}
|
||||
@@ -1,29 +0,0 @@
|
||||
{"type":"meta","next_id":{"DSC":29,"AGD":29,"DEC":17,"PLN":30,"LSN":31,"CLSN":1}}
|
||||
{"type":"discussion","id":"DSC-0023","status":"done","ticket":"perf-full-migration-to-atomic-telemetry","title":"Agenda - [PERF] Full Migration to Atomic Telemetry","created_at":"2026-04-10","updated_at":"2026-04-10","tags":["perf","runtime","telemetry"],"agendas":[{"id":"AGD-0021","file":"workflow/agendas/AGD-0021-full-migration-to-atomic-telemetry.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}],"decisions":[{"id":"DEC-0008","file":"workflow/decisions/DEC-0008-full-migration-to-atomic-telemetry.md","status":"accepted","created_at":"2026-04-10","updated_at":"2026-04-10"}],"plans":[{"id":"PLN-0007","file":"workflow/plans/PLN-0007-full-migration-to-atomic-telemetry.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}],"lessons":[{"id":"LSN-0028","file":"lessons/DSC-0023-perf-full-migration-to-atomic-telemetry/LSN-0028-converging-to-single-atomic-telemetry-source.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0020","status":"done","ticket":"jenkins-gitea-integration","title":"Jenkins Gitea Integration and Relocation","created_at":"2026-04-07","updated_at":"2026-04-07","tags":["ci","jenkins","gitea"],"agendas":[{"id":"AGD-0018","file":"workflow/agendas/AGD-0018-jenkins-gitea-integration-and-relocation.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"decisions":[{"id":"DEC-0003","file":"workflow/decisions/DEC-0003-jenkins-gitea-strategy.md","status":"accepted","created_at":"2026-04-07","updated_at":"2026-04-07"}],"plans":[{"id":"PLN-0003","file":"workflow/plans/PLN-0003-jenkins-gitea-execution.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"lessons":[{"id":"LSN-0021","file":"lessons/DSC-0020-jenkins-gitea-integration/LSN-0021-jenkins-gitea-integration.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}]}
|
||||
{"type":"discussion","id":"DSC-0021","status":"done","ticket":"asset-entry-codec-enum-with-metadata","title":"Asset Entry Codec Enum Contract","created_at":"2026-04-09","updated_at":"2026-04-09","tags":["asset","runtime","codec","metadata"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0024","file":"lessons/DSC-0021-asset-entry-codec-enum-contract/LSN-0024-string-on-the-wire-enum-in-runtime.md","status":"done","created_at":"2026-04-09","updated_at":"2026-04-09"}]}
|
||||
{"type":"discussion","id":"DSC-0022","status":"done","ticket":"tile-bank-vs-glyph-bank-domain-naming","title":"Glyph Bank Domain Naming Contract","created_at":"2026-04-09","updated_at":"2026-04-10","tags":["gfx","runtime","naming","domain-model"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0025","file":"lessons/DSC-0022-glyph-bank-domain-naming/LSN-0025-rename-artifact-by-meaning-not-by-token.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0001","status":"done","ticket":"legacy-runtime-learn-import","title":"Import legacy runtime learn into discussion lessons","created_at":"2026-03-27","updated_at":"2026-03-27","tags":["migration","tech-debt"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0001","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0001-prometeu-learn-index.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0002","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0002-historical-asset-status-first-fault-and-return-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0003","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0003-historical-audio-status-first-fault-and-return-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0004","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0004-historical-cartridge-boot-protocol-and-manifest-authority.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0005","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0005-historical-game-memcard-slots-surface-and-semantics.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0006","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0006-historical-gfx-status-first-fault-and-return-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0007","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0007-historical-retired-fault-and-input-decisions.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0008","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0008-historical-vm-core-and-assets.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0009","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0009-mental-model-asset-management.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0010","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0010-mental-model-audio.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0011","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0011-mental-model-gfx.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0012","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0012-mental-model-input.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0013","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0013-mental-model-observability-and-debugging.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0014","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0014-mental-model-portability-and-cross-platform.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0015","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0015-mental-model-save-memory-and-memcard.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0016","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0016-mental-model-status-first-and-fault-thinking.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0017","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0017-mental-model-time-and-cycles.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0018","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0018-mental-model-touch.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"}]}
|
||||
{"type":"discussion","id":"DSC-0002","status":"open","ticket":"runtime-edge-test-plan","title":"Agenda - Runtime Edge Test Plan","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0001","file":"workflow/agendas/AGD-0001-runtime-edge-test-plan.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0003","status":"open","ticket":"packed-cartridge-loader-pmc","title":"Agenda - Packed Cartridge Loader PMC","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0002","file":"workflow/agendas/AGD-0002-packed-cartridge-loader-pmc.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0004","status":"open","ticket":"system-run-cart","title":"Agenda - System Run Cart","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0003","file":"workflow/agendas/AGD-0003-system-run-cart.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0005","status":"open","ticket":"system-fault-semantics-and-control-surface","title":"Agenda - System Fault Semantics and Control Surface","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0004","file":"workflow/agendas/AGD-0004-system-fault-semantics-and-control-surface.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0006","status":"open","ticket":"vm-owned-random-service","title":"Agenda - VM-Owned Random Service","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0005","file":"workflow/agendas/AGD-0005-vm-owned-random-service.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0007","status":"open","ticket":"app-home-filesystem-surface-and-semantics","title":"Agenda - App Home Filesystem Surface and Semantics","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0006","file":"workflow/agendas/AGD-0006-app-home-filesystem-surface-and-semantics.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0008","status":"done","ticket":"perf-runtime-telemetry-hot-path","title":"Agenda - [PERF] Runtime Telemetry Hot Path","created_at":"2026-03-27","updated_at":"2026-04-10","tags":[],"agendas":[{"id":"AGD-0007","file":"workflow/agendas/AGD-0007-perf-runtime-telemetry-hot-path.md","status":"done","created_at":"2026-03-27","updated_at":"2026-04-10"}],"decisions":[{"id":"DEC-0005","file":"workflow/decisions/DEC-0005-perf-push-based-telemetry-model.md","status":"accepted","created_at":"2026-04-10","updated_at":"2026-04-10"}],"plans":[{"id":"PLN-0005","file":"workflow/plans/PLN-0005-perf-push-based-telemetry-implementation.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}],"lessons":[{"id":"LSN-0026","file":"lessons/DSC-0008-perf-runtime-telemetry-hot-path/LSN-0026-push-based-telemetry-model.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0009","status":"open","ticket":"perf-async-background-work-lanes-for-assets-and-fs","title":"Agenda - [PERF] Async Background Work Lanes for Assets and FS","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0008","file":"workflow/agendas/AGD-0008-perf-async-background-work-lanes-for-assets-and-fs.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0010","status":"open","ticket":"perf-host-desktop-frame-pacing-and-presentation","title":"Agenda - [PERF] Host Desktop Frame Pacing and Presentation","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0009","file":"workflow/agendas/AGD-0009-perf-host-desktop-frame-pacing-and-presentation.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0011","status":"open","ticket":"perf-gfx-render-pipeline-and-dirty-regions","title":"Agenda - [PERF] GFX Render Pipeline and Dirty Regions","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0010","file":"workflow/agendas/AGD-0010-perf-gfx-render-pipeline-and-dirty-regions.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0012","status":"open","ticket":"perf-runtime-introspection-syscalls","title":"Agenda - [PERF] Runtime Introspection Syscalls","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0011","file":"workflow/agendas/AGD-0011-perf-runtime-introspection-syscalls.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0013","status":"done","ticket":"perf-host-debug-overlay-isolation","title":"Agenda - [PERF] Host Debug Overlay Isolation","created_at":"2026-03-27","updated_at":"2026-04-10","tags":[],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0027","file":"lessons/DSC-0013-perf-host-debug-overlay-isolation/LSN-0027-host-debug-overlay-isolation.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0024","status":"done","ticket":"generic-memory-bank-slot-contract","title":"Agenda - Generic Memory Bank Slot Contract","created_at":"2026-04-10","updated_at":"2026-04-10","tags":["runtime","asset","memory-bank","slots","host"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0029","file":"lessons/DSC-0024-generic-memory-bank-slot-contract/LSN-0029-slot-first-bank-telemetry-belongs-in-asset-manager.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0025","status":"done","ticket":"scene-bank-and-viewport-cache-refactor","title":"Scene Bank and Viewport Cache Refactor","created_at":"2026-04-11","updated_at":"2026-04-14","tags":["gfx","tilemap","runtime","render"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0030","file":"lessons/DSC-0025-scene-bank-and-viewport-cache-refactor/LSN-0030-canonical-scene-cache-and-resolver-split.md","status":"done","created_at":"2026-04-14","updated_at":"2026-04-14"}]}
|
||||
{"type":"discussion","id":"DSC-0026","status":"open","ticket":"render-all-scene-cache-and-camera-integration","title":"Integrate render_all with Scene Cache and Camera","created_at":"2026-04-14","updated_at":"2026-04-15","tags":["gfx","runtime","render","camera","scene"],"agendas":[{"id":"AGD-0026","file":"workflow/agendas/AGD-0026-render-all-scene-cache-and-camera-integration.md","status":"accepted","created_at":"2026-04-14","updated_at":"2026-04-15"}],"decisions":[{"id":"DEC-0014","file":"workflow/decisions/DEC-0014-frame-composer-render-integration.md","status":"accepted","created_at":"2026-04-14","updated_at":"2026-04-15","ref_agenda":"AGD-0026"}],"plans":[{"id":"PLN-0017","file":"workflow/plans/PLN-0017-frame-composer-core-and-hardware-ownership.md","status":"accepted","created_at":"2026-04-14","updated_at":"2026-04-15","ref_decisions":["DEC-0014"]},{"id":"PLN-0018","file":"workflow/plans/PLN-0018-sprite-controller-and-frame-emission-model.md","status":"accepted","created_at":"2026-04-14","updated_at":"2026-04-14","ref_decisions":["DEC-0014"]},{"id":"PLN-0019","file":"workflow/plans/PLN-0019-scene-binding-camera-and-scene-status.md","status":"accepted","created_at":"2026-04-14","updated_at":"2026-04-15","ref_decisions":["DEC-0014"]},{"id":"PLN-0020","file":"workflow/plans/PLN-0020-cache-refresh-and-render-frame-path.md","status":"accepted","created_at":"2026-04-14","updated_at":"2026-04-15","ref_decisions":["DEC-0014"]},{"id":"PLN-0021","file":"workflow/plans/PLN-0021-service-retirement-callsite-migration-and-regression.md","status":"accepted","created_at":"2026-04-14","updated_at":"2026-04-15","ref_decisions":["DEC-0014"]}],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0027","status":"open","ticket":"frame-composer-public-syscall-surface","title":"Agenda - FrameComposer Public Syscall Surface","created_at":"2026-04-17","updated_at":"2026-04-17","tags":["gfx","runtime","syscall","abi","frame-composer","scene","camera","sprites"],"agendas":[{"id":"AGD-0027","file":"workflow/agendas/AGD-0027-frame-composer-public-syscall-surface.md","status":"accepted","created_at":"2026-04-17","updated_at":"2026-04-17"}],"decisions":[{"id":"DEC-0015","file":"workflow/decisions/DEC-0015-frame-composer-public-syscall-surface.md","status":"accepted","created_at":"2026-04-17","updated_at":"2026-04-17","ref_agenda":"AGD-0027"}],"plans":[{"id":"PLN-0022","file":"workflow/plans/PLN-0022-composer-syscall-domain-and-spec-propagation.md","status":"accepted","created_at":"2026-04-17","updated_at":"2026-04-17","ref_decisions":["DEC-0015"]},{"id":"PLN-0023","file":"workflow/plans/PLN-0023-composer-runtime-dispatch-and-legacy-removal.md","status":"accepted","created_at":"2026-04-17","updated_at":"2026-04-17","ref_decisions":["DEC-0015"]},{"id":"PLN-0024","file":"workflow/plans/PLN-0024-composer-cartridge-tooling-and-regression-migration.md","status":"accepted","created_at":"2026-04-17","updated_at":"2026-04-17","ref_decisions":["DEC-0015"]},{"id":"PLN-0025","file":"workflow/plans/PLN-0025-final-ci-validation-and-polish.md","status":"accepted","created_at":"2026-04-17","updated_at":"2026-04-17","ref_decisions":["DEC-0015"]}],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0028","status":"open","ticket":"deferred-overlay-and-primitive-composition","title":"Deferred Overlay and Primitive Composition over FrameComposer","created_at":"2026-04-18","updated_at":"2026-04-18","tags":["gfx","runtime","render","frame-composer","overlay","primitives","hud"],"agendas":[{"id":"AGD-0028","file":"workflow/agendas/AGD-0028-deferred-overlay-and-primitive-composition.md","status":"accepted","created_at":"2026-04-18","updated_at":"2026-04-18"}],"decisions":[{"id":"DEC-0016","file":"workflow/decisions/DEC-0016-deferred-gfx-overlay-outside-frame-composer.md","status":"accepted","created_at":"2026-04-18","updated_at":"2026-04-18","ref_agenda":"AGD-0028"}],"plans":[{"id":"PLN-0026","file":"workflow/plans/PLN-0026-gfx-overlay-contract-and-spec-propagation.md","status":"accepted","created_at":"2026-04-18","updated_at":"2026-04-18","ref_decisions":["DEC-0016"]},{"id":"PLN-0027","file":"workflow/plans/PLN-0027-deferred-gfx-overlay-subsystem.md","status":"accepted","created_at":"2026-04-18","updated_at":"2026-04-18","ref_decisions":["DEC-0016"]},{"id":"PLN-0028","file":"workflow/plans/PLN-0028-runtime-frame-end-overlay-integration-and-parity.md","status":"accepted","created_at":"2026-04-18","updated_at":"2026-04-18","ref_decisions":["DEC-0016"]},{"id":"PLN-0029","file":"workflow/plans/PLN-0029-final-overlay-ci-validation-and-polish.md","status":"accepted","created_at":"2026-04-18","updated_at":"2026-04-18","ref_decisions":["DEC-0016"]}],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0014","status":"open","ticket":"perf-vm-allocation-and-copy-pressure","title":"Agenda - [PERF] VM Allocation and Copy Pressure","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0013","file":"workflow/agendas/AGD-0013-perf-vm-allocation-and-copy-pressure.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0015","status":"open","ticket":"perf-cartridge-boot-and-program-ownership","title":"Agenda - [PERF] Cartridge Boot and Program Ownership","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0014","file":"workflow/agendas/AGD-0014-perf-cartridge-boot-and-program-ownership.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0016","status":"done","ticket":"tilemap-empty-cell-vs-tile-id-zero","title":"Tilemap Empty Cell vs Tile ID Zero","created_at":"2026-03-27","updated_at":"2026-04-09","tags":[],"agendas":[{"id":"AGD-0015","file":"workflow/agendas/AGD-0015-tilemap-empty-cell-vs-tile-id-zero.md","status":"done","created_at":"2026-03-27","updated_at":"2026-04-09"}],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0022","file":"lessons/DSC-0016-tilemap-empty-cell-semantics/LSN-0022-tilemap-empty-cell-convergence.md","status":"done","created_at":"2026-04-09","updated_at":"2026-04-09"}]}
|
||||
{"type":"discussion","id":"DSC-0017","status":"done","ticket":"asset-entry-metadata-normalization-contract","title":"Asset Entry Metadata Normalization Contract","created_at":"2026-03-27","updated_at":"2026-04-09","tags":[],"agendas":[{"id":"AGD-0016","file":"workflow/agendas/AGD-0016-asset-entry-metadata-normalization-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-04-09"}],"decisions":[{"id":"DEC-0004","file":"workflow/decisions/DEC-0004-asset-entry-metadata-normalization-contract.md","status":"accepted","created_at":"2026-04-09","updated_at":"2026-04-09"}],"plans":[],"lessons":[{"id":"LSN-0023","file":"lessons/DSC-0017-asset-metadata-normalization/LSN-0023-typed-asset-metadata-helpers.md","status":"done","created_at":"2026-04-09","updated_at":"2026-04-09"}]}
|
||||
{"type":"discussion","id":"DSC-0018","status":"done","ticket":"asset-load-asset-id-int-contract","title":"Asset Load Asset ID Int Contract","created_at":"2026-03-27","updated_at":"2026-03-27","tags":["asset","runtime","abi"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0019","file":"lessons/DSC-0018-asset-load-asset-id-int-contract/LSN-0019-asset-load-id-abi-convergence.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"}]}
|
||||
{"type":"discussion","id":"DSC-0019","status":"done","ticket":"jenkinsfile-correction","title":"Jenkinsfile Correction and Relocation","created_at":"2026-04-07","updated_at":"2026-04-07","tags":["ci","jenkins"],"agendas":[{"id":"AGD-0017","file":"workflow/agendas/AGD-0017-jenkinsfile-correction.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"decisions":[{"id":"DEC-0002","file":"workflow/decisions/DEC-0002-jenkinsfile-strategy.md","status":"accepted","created_at":"2026-04-07","updated_at":"2026-04-07"}],"plans":[{"id":"PLN-0002","file":"workflow/plans/PLN-0002-jenkinsfile-execution.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"lessons":[{"id":"LSN-0020","file":"lessons/DSC-0019-jenkins-ci-standardization/LSN-0020-jenkins-standard-relocation.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}]}
|
||||
@@ -1,29 +0,0 @@
|
||||
{"type":"meta","next_id":{"DSC":29,"AGD":29,"DEC":17,"PLN":30,"LSN":32,"CLSN":1}}
|
||||
{"type":"discussion","id":"DSC-0023","status":"done","ticket":"perf-full-migration-to-atomic-telemetry","title":"Agenda - [PERF] Full Migration to Atomic Telemetry","created_at":"2026-04-10","updated_at":"2026-04-10","tags":["perf","runtime","telemetry"],"agendas":[{"id":"AGD-0021","file":"workflow/agendas/AGD-0021-full-migration-to-atomic-telemetry.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}],"decisions":[{"id":"DEC-0008","file":"workflow/decisions/DEC-0008-full-migration-to-atomic-telemetry.md","status":"accepted","created_at":"2026-04-10","updated_at":"2026-04-10"}],"plans":[{"id":"PLN-0007","file":"workflow/plans/PLN-0007-full-migration-to-atomic-telemetry.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}],"lessons":[{"id":"LSN-0028","file":"lessons/DSC-0023-perf-full-migration-to-atomic-telemetry/LSN-0028-converging-to-single-atomic-telemetry-source.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0020","status":"done","ticket":"jenkins-gitea-integration","title":"Jenkins Gitea Integration and Relocation","created_at":"2026-04-07","updated_at":"2026-04-07","tags":["ci","jenkins","gitea"],"agendas":[{"id":"AGD-0018","file":"workflow/agendas/AGD-0018-jenkins-gitea-integration-and-relocation.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"decisions":[{"id":"DEC-0003","file":"workflow/decisions/DEC-0003-jenkins-gitea-strategy.md","status":"accepted","created_at":"2026-04-07","updated_at":"2026-04-07"}],"plans":[{"id":"PLN-0003","file":"workflow/plans/PLN-0003-jenkins-gitea-execution.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"lessons":[{"id":"LSN-0021","file":"lessons/DSC-0020-jenkins-gitea-integration/LSN-0021-jenkins-gitea-integration.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}]}
|
||||
{"type":"discussion","id":"DSC-0021","status":"done","ticket":"asset-entry-codec-enum-with-metadata","title":"Asset Entry Codec Enum Contract","created_at":"2026-04-09","updated_at":"2026-04-09","tags":["asset","runtime","codec","metadata"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0024","file":"lessons/DSC-0021-asset-entry-codec-enum-contract/LSN-0024-string-on-the-wire-enum-in-runtime.md","status":"done","created_at":"2026-04-09","updated_at":"2026-04-09"}]}
|
||||
{"type":"discussion","id":"DSC-0022","status":"done","ticket":"tile-bank-vs-glyph-bank-domain-naming","title":"Glyph Bank Domain Naming Contract","created_at":"2026-04-09","updated_at":"2026-04-10","tags":["gfx","runtime","naming","domain-model"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0025","file":"lessons/DSC-0022-glyph-bank-domain-naming/LSN-0025-rename-artifact-by-meaning-not-by-token.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0001","status":"done","ticket":"legacy-runtime-learn-import","title":"Import legacy runtime learn into discussion lessons","created_at":"2026-03-27","updated_at":"2026-03-27","tags":["migration","tech-debt"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0001","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0001-prometeu-learn-index.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0002","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0002-historical-asset-status-first-fault-and-return-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0003","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0003-historical-audio-status-first-fault-and-return-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0004","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0004-historical-cartridge-boot-protocol-and-manifest-authority.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0005","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0005-historical-game-memcard-slots-surface-and-semantics.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0006","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0006-historical-gfx-status-first-fault-and-return-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0007","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0007-historical-retired-fault-and-input-decisions.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0008","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0008-historical-vm-core-and-assets.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0009","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0009-mental-model-asset-management.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0010","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0010-mental-model-audio.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0011","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0011-mental-model-gfx.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0012","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0012-mental-model-input.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0013","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0013-mental-model-observability-and-debugging.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0014","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0014-mental-model-portability-and-cross-platform.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0015","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0015-mental-model-save-memory-and-memcard.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0016","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0016-mental-model-status-first-and-fault-thinking.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0017","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0017-mental-model-time-and-cycles.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0018","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0018-mental-model-touch.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"}]}
|
||||
{"type":"discussion","id":"DSC-0002","status":"open","ticket":"runtime-edge-test-plan","title":"Agenda - Runtime Edge Test Plan","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0001","file":"workflow/agendas/AGD-0001-runtime-edge-test-plan.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0003","status":"open","ticket":"packed-cartridge-loader-pmc","title":"Agenda - Packed Cartridge Loader PMC","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0002","file":"workflow/agendas/AGD-0002-packed-cartridge-loader-pmc.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0004","status":"open","ticket":"system-run-cart","title":"Agenda - System Run Cart","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0003","file":"workflow/agendas/AGD-0003-system-run-cart.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0005","status":"open","ticket":"system-fault-semantics-and-control-surface","title":"Agenda - System Fault Semantics and Control Surface","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0004","file":"workflow/agendas/AGD-0004-system-fault-semantics-and-control-surface.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0006","status":"open","ticket":"vm-owned-random-service","title":"Agenda - VM-Owned Random Service","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0005","file":"workflow/agendas/AGD-0005-vm-owned-random-service.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0007","status":"open","ticket":"app-home-filesystem-surface-and-semantics","title":"Agenda - App Home Filesystem Surface and Semantics","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0006","file":"workflow/agendas/AGD-0006-app-home-filesystem-surface-and-semantics.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0008","status":"done","ticket":"perf-runtime-telemetry-hot-path","title":"Agenda - [PERF] Runtime Telemetry Hot Path","created_at":"2026-03-27","updated_at":"2026-04-10","tags":[],"agendas":[{"id":"AGD-0007","file":"workflow/agendas/AGD-0007-perf-runtime-telemetry-hot-path.md","status":"done","created_at":"2026-03-27","updated_at":"2026-04-10"}],"decisions":[{"id":"DEC-0005","file":"workflow/decisions/DEC-0005-perf-push-based-telemetry-model.md","status":"accepted","created_at":"2026-04-10","updated_at":"2026-04-10"}],"plans":[{"id":"PLN-0005","file":"workflow/plans/PLN-0005-perf-push-based-telemetry-implementation.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}],"lessons":[{"id":"LSN-0026","file":"lessons/DSC-0008-perf-runtime-telemetry-hot-path/LSN-0026-push-based-telemetry-model.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0009","status":"open","ticket":"perf-async-background-work-lanes-for-assets-and-fs","title":"Agenda - [PERF] Async Background Work Lanes for Assets and FS","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0008","file":"workflow/agendas/AGD-0008-perf-async-background-work-lanes-for-assets-and-fs.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0010","status":"open","ticket":"perf-host-desktop-frame-pacing-and-presentation","title":"Agenda - [PERF] Host Desktop Frame Pacing and Presentation","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0009","file":"workflow/agendas/AGD-0009-perf-host-desktop-frame-pacing-and-presentation.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0011","status":"open","ticket":"perf-gfx-render-pipeline-and-dirty-regions","title":"Agenda - [PERF] GFX Render Pipeline and Dirty Regions","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0010","file":"workflow/agendas/AGD-0010-perf-gfx-render-pipeline-and-dirty-regions.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0012","status":"open","ticket":"perf-runtime-introspection-syscalls","title":"Agenda - [PERF] Runtime Introspection Syscalls","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0011","file":"workflow/agendas/AGD-0011-perf-runtime-introspection-syscalls.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0013","status":"done","ticket":"perf-host-debug-overlay-isolation","title":"Agenda - [PERF] Host Debug Overlay Isolation","created_at":"2026-03-27","updated_at":"2026-04-10","tags":[],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0027","file":"lessons/DSC-0013-perf-host-debug-overlay-isolation/LSN-0027-host-debug-overlay-isolation.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0024","status":"done","ticket":"generic-memory-bank-slot-contract","title":"Agenda - Generic Memory Bank Slot Contract","created_at":"2026-04-10","updated_at":"2026-04-10","tags":["runtime","asset","memory-bank","slots","host"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0029","file":"lessons/DSC-0024-generic-memory-bank-slot-contract/LSN-0029-slot-first-bank-telemetry-belongs-in-asset-manager.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0025","status":"done","ticket":"scene-bank-and-viewport-cache-refactor","title":"Scene Bank and Viewport Cache Refactor","created_at":"2026-04-11","updated_at":"2026-04-14","tags":["gfx","tilemap","runtime","render"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0030","file":"lessons/DSC-0025-scene-bank-and-viewport-cache-refactor/LSN-0030-canonical-scene-cache-and-resolver-split.md","status":"done","created_at":"2026-04-14","updated_at":"2026-04-14"}]}
|
||||
{"type":"discussion","id":"DSC-0026","status":"done","ticket":"render-all-scene-cache-and-camera-integration","title":"Integrate render_all with Scene Cache and Camera","created_at":"2026-04-14","updated_at":"2026-04-18","tags":["gfx","runtime","render","camera","scene"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0031","file":"lessons/DSC-0026-render-all-scene-cache-and-camera-integration/LSN-0031-frame-composition-belongs-above-the-render-backend.md","status":"done","created_at":"2026-04-18","updated_at":"2026-04-18"}]}
|
||||
{"type":"discussion","id":"DSC-0027","status":"open","ticket":"frame-composer-public-syscall-surface","title":"Agenda - FrameComposer Public Syscall Surface","created_at":"2026-04-17","updated_at":"2026-04-17","tags":["gfx","runtime","syscall","abi","frame-composer","scene","camera","sprites"],"agendas":[{"id":"AGD-0027","file":"workflow/agendas/AGD-0027-frame-composer-public-syscall-surface.md","status":"accepted","created_at":"2026-04-17","updated_at":"2026-04-17"}],"decisions":[{"id":"DEC-0015","file":"workflow/decisions/DEC-0015-frame-composer-public-syscall-surface.md","status":"accepted","created_at":"2026-04-17","updated_at":"2026-04-17","ref_agenda":"AGD-0027"}],"plans":[{"id":"PLN-0022","file":"workflow/plans/PLN-0022-composer-syscall-domain-and-spec-propagation.md","status":"accepted","created_at":"2026-04-17","updated_at":"2026-04-17","ref_decisions":["DEC-0015"]},{"id":"PLN-0023","file":"workflow/plans/PLN-0023-composer-runtime-dispatch-and-legacy-removal.md","status":"accepted","created_at":"2026-04-17","updated_at":"2026-04-17","ref_decisions":["DEC-0015"]},{"id":"PLN-0024","file":"workflow/plans/PLN-0024-composer-cartridge-tooling-and-regression-migration.md","status":"accepted","created_at":"2026-04-17","updated_at":"2026-04-17","ref_decisions":["DEC-0015"]},{"id":"PLN-0025","file":"workflow/plans/PLN-0025-final-ci-validation-and-polish.md","status":"accepted","created_at":"2026-04-17","updated_at":"2026-04-17","ref_decisions":["DEC-0015"]}],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0028","status":"open","ticket":"deferred-overlay-and-primitive-composition","title":"Deferred Overlay and Primitive Composition over FrameComposer","created_at":"2026-04-18","updated_at":"2026-04-18","tags":["gfx","runtime","render","frame-composer","overlay","primitives","hud"],"agendas":[{"id":"AGD-0028","file":"workflow/agendas/AGD-0028-deferred-overlay-and-primitive-composition.md","status":"accepted","created_at":"2026-04-18","updated_at":"2026-04-18"}],"decisions":[{"id":"DEC-0016","file":"workflow/decisions/DEC-0016-deferred-gfx-overlay-outside-frame-composer.md","status":"accepted","created_at":"2026-04-18","updated_at":"2026-04-18","ref_agenda":"AGD-0028"}],"plans":[{"id":"PLN-0026","file":"workflow/plans/PLN-0026-gfx-overlay-contract-and-spec-propagation.md","status":"accepted","created_at":"2026-04-18","updated_at":"2026-04-18","ref_decisions":["DEC-0016"]},{"id":"PLN-0027","file":"workflow/plans/PLN-0027-deferred-gfx-overlay-subsystem.md","status":"accepted","created_at":"2026-04-18","updated_at":"2026-04-18","ref_decisions":["DEC-0016"]},{"id":"PLN-0028","file":"workflow/plans/PLN-0028-runtime-frame-end-overlay-integration-and-parity.md","status":"accepted","created_at":"2026-04-18","updated_at":"2026-04-18","ref_decisions":["DEC-0016"]},{"id":"PLN-0029","file":"workflow/plans/PLN-0029-final-overlay-ci-validation-and-polish.md","status":"accepted","created_at":"2026-04-18","updated_at":"2026-04-18","ref_decisions":["DEC-0016"]}],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0014","status":"open","ticket":"perf-vm-allocation-and-copy-pressure","title":"Agenda - [PERF] VM Allocation and Copy Pressure","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0013","file":"workflow/agendas/AGD-0013-perf-vm-allocation-and-copy-pressure.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0015","status":"open","ticket":"perf-cartridge-boot-and-program-ownership","title":"Agenda - [PERF] Cartridge Boot and Program Ownership","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0014","file":"workflow/agendas/AGD-0014-perf-cartridge-boot-and-program-ownership.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0016","status":"done","ticket":"tilemap-empty-cell-vs-tile-id-zero","title":"Tilemap Empty Cell vs Tile ID Zero","created_at":"2026-03-27","updated_at":"2026-04-09","tags":[],"agendas":[{"id":"AGD-0015","file":"workflow/agendas/AGD-0015-tilemap-empty-cell-vs-tile-id-zero.md","status":"done","created_at":"2026-03-27","updated_at":"2026-04-09"}],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0022","file":"lessons/DSC-0016-tilemap-empty-cell-semantics/LSN-0022-tilemap-empty-cell-convergence.md","status":"done","created_at":"2026-04-09","updated_at":"2026-04-09"}]}
|
||||
{"type":"discussion","id":"DSC-0017","status":"done","ticket":"asset-entry-metadata-normalization-contract","title":"Asset Entry Metadata Normalization Contract","created_at":"2026-03-27","updated_at":"2026-04-09","tags":[],"agendas":[{"id":"AGD-0016","file":"workflow/agendas/AGD-0016-asset-entry-metadata-normalization-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-04-09"}],"decisions":[{"id":"DEC-0004","file":"workflow/decisions/DEC-0004-asset-entry-metadata-normalization-contract.md","status":"accepted","created_at":"2026-04-09","updated_at":"2026-04-09"}],"plans":[],"lessons":[{"id":"LSN-0023","file":"lessons/DSC-0017-asset-metadata-normalization/LSN-0023-typed-asset-metadata-helpers.md","status":"done","created_at":"2026-04-09","updated_at":"2026-04-09"}]}
|
||||
{"type":"discussion","id":"DSC-0018","status":"done","ticket":"asset-load-asset-id-int-contract","title":"Asset Load Asset ID Int Contract","created_at":"2026-03-27","updated_at":"2026-03-27","tags":["asset","runtime","abi"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0019","file":"lessons/DSC-0018-asset-load-asset-id-int-contract/LSN-0019-asset-load-id-abi-convergence.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"}]}
|
||||
{"type":"discussion","id":"DSC-0019","status":"done","ticket":"jenkinsfile-correction","title":"Jenkinsfile Correction and Relocation","created_at":"2026-04-07","updated_at":"2026-04-07","tags":["ci","jenkins"],"agendas":[{"id":"AGD-0017","file":"workflow/agendas/AGD-0017-jenkinsfile-correction.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"decisions":[{"id":"DEC-0002","file":"workflow/decisions/DEC-0002-jenkinsfile-strategy.md","status":"accepted","created_at":"2026-04-07","updated_at":"2026-04-07"}],"plans":[{"id":"PLN-0002","file":"workflow/plans/PLN-0002-jenkinsfile-execution.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"lessons":[{"id":"LSN-0020","file":"lessons/DSC-0019-jenkins-ci-standardization/LSN-0020-jenkins-standard-relocation.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}]}
|
||||
@@ -1,29 +0,0 @@
|
||||
{"type":"meta","next_id":{"DSC":29,"AGD":29,"DEC":18,"PLN":33,"LSN":34,"CLSN":1}}
|
||||
{"type":"discussion","id":"DSC-0023","status":"done","ticket":"perf-full-migration-to-atomic-telemetry","title":"Agenda - [PERF] Full Migration to Atomic Telemetry","created_at":"2026-04-10","updated_at":"2026-04-10","tags":["perf","runtime","telemetry"],"agendas":[{"id":"AGD-0021","file":"workflow/agendas/AGD-0021-full-migration-to-atomic-telemetry.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}],"decisions":[{"id":"DEC-0008","file":"workflow/decisions/DEC-0008-full-migration-to-atomic-telemetry.md","status":"accepted","created_at":"2026-04-10","updated_at":"2026-04-10"}],"plans":[{"id":"PLN-0007","file":"workflow/plans/PLN-0007-full-migration-to-atomic-telemetry.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}],"lessons":[{"id":"LSN-0028","file":"lessons/DSC-0023-perf-full-migration-to-atomic-telemetry/LSN-0028-converging-to-single-atomic-telemetry-source.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0020","status":"done","ticket":"jenkins-gitea-integration","title":"Jenkins Gitea Integration and Relocation","created_at":"2026-04-07","updated_at":"2026-04-07","tags":["ci","jenkins","gitea"],"agendas":[{"id":"AGD-0018","file":"workflow/agendas/AGD-0018-jenkins-gitea-integration-and-relocation.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"decisions":[{"id":"DEC-0003","file":"workflow/decisions/DEC-0003-jenkins-gitea-strategy.md","status":"accepted","created_at":"2026-04-07","updated_at":"2026-04-07"}],"plans":[{"id":"PLN-0003","file":"workflow/plans/PLN-0003-jenkins-gitea-execution.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"lessons":[{"id":"LSN-0021","file":"lessons/DSC-0020-jenkins-gitea-integration/LSN-0021-jenkins-gitea-integration.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}]}
|
||||
{"type":"discussion","id":"DSC-0021","status":"done","ticket":"asset-entry-codec-enum-with-metadata","title":"Asset Entry Codec Enum Contract","created_at":"2026-04-09","updated_at":"2026-04-09","tags":["asset","runtime","codec","metadata"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0024","file":"lessons/DSC-0021-asset-entry-codec-enum-contract/LSN-0024-string-on-the-wire-enum-in-runtime.md","status":"done","created_at":"2026-04-09","updated_at":"2026-04-09"}]}
|
||||
{"type":"discussion","id":"DSC-0022","status":"done","ticket":"tile-bank-vs-glyph-bank-domain-naming","title":"Glyph Bank Domain Naming Contract","created_at":"2026-04-09","updated_at":"2026-04-10","tags":["gfx","runtime","naming","domain-model"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0025","file":"lessons/DSC-0022-glyph-bank-domain-naming/LSN-0025-rename-artifact-by-meaning-not-by-token.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0001","status":"done","ticket":"legacy-runtime-learn-import","title":"Import legacy runtime learn into discussion lessons","created_at":"2026-03-27","updated_at":"2026-03-27","tags":["migration","tech-debt"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0001","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0001-prometeu-learn-index.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0002","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0002-historical-asset-status-first-fault-and-return-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0003","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0003-historical-audio-status-first-fault-and-return-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0004","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0004-historical-cartridge-boot-protocol-and-manifest-authority.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0005","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0005-historical-game-memcard-slots-surface-and-semantics.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0006","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0006-historical-gfx-status-first-fault-and-return-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0007","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0007-historical-retired-fault-and-input-decisions.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0008","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0008-historical-vm-core-and-assets.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0009","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0009-mental-model-asset-management.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0010","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0010-mental-model-audio.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0011","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0011-mental-model-gfx.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0012","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0012-mental-model-input.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0013","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0013-mental-model-observability-and-debugging.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0014","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0014-mental-model-portability-and-cross-platform.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0015","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0015-mental-model-save-memory-and-memcard.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0016","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0016-mental-model-status-first-and-fault-thinking.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0017","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0017-mental-model-time-and-cycles.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0018","file":"lessons/DSC-0001-runtime-learn-legacy-import/LSN-0018-mental-model-touch.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"}]}
|
||||
{"type":"discussion","id":"DSC-0002","status":"open","ticket":"runtime-edge-test-plan","title":"Agenda - Runtime Edge Test Plan","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0001","file":"workflow/agendas/AGD-0001-runtime-edge-test-plan.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0003","status":"open","ticket":"packed-cartridge-loader-pmc","title":"Agenda - Packed Cartridge Loader PMC","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0002","file":"workflow/agendas/AGD-0002-packed-cartridge-loader-pmc.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0004","status":"open","ticket":"system-run-cart","title":"Agenda - System Run Cart","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0003","file":"workflow/agendas/AGD-0003-system-run-cart.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0005","status":"open","ticket":"system-fault-semantics-and-control-surface","title":"Agenda - System Fault Semantics and Control Surface","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0004","file":"workflow/agendas/AGD-0004-system-fault-semantics-and-control-surface.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0006","status":"open","ticket":"vm-owned-random-service","title":"Agenda - VM-Owned Random Service","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0005","file":"workflow/agendas/AGD-0005-vm-owned-random-service.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0007","status":"open","ticket":"app-home-filesystem-surface-and-semantics","title":"Agenda - App Home Filesystem Surface and Semantics","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0006","file":"workflow/agendas/AGD-0006-app-home-filesystem-surface-and-semantics.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0008","status":"done","ticket":"perf-runtime-telemetry-hot-path","title":"Agenda - [PERF] Runtime Telemetry Hot Path","created_at":"2026-03-27","updated_at":"2026-04-10","tags":[],"agendas":[{"id":"AGD-0007","file":"workflow/agendas/AGD-0007-perf-runtime-telemetry-hot-path.md","status":"done","created_at":"2026-03-27","updated_at":"2026-04-10"}],"decisions":[{"id":"DEC-0005","file":"workflow/decisions/DEC-0005-perf-push-based-telemetry-model.md","status":"accepted","created_at":"2026-04-10","updated_at":"2026-04-10"}],"plans":[{"id":"PLN-0005","file":"workflow/plans/PLN-0005-perf-push-based-telemetry-implementation.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}],"lessons":[{"id":"LSN-0026","file":"lessons/DSC-0008-perf-runtime-telemetry-hot-path/LSN-0026-push-based-telemetry-model.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0009","status":"open","ticket":"perf-async-background-work-lanes-for-assets-and-fs","title":"Agenda - [PERF] Async Background Work Lanes for Assets and FS","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0008","file":"workflow/agendas/AGD-0008-perf-async-background-work-lanes-for-assets-and-fs.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0010","status":"open","ticket":"perf-host-desktop-frame-pacing-and-presentation","title":"Agenda - [PERF] Host Desktop Frame Pacing and Presentation","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0009","file":"workflow/agendas/AGD-0009-perf-host-desktop-frame-pacing-and-presentation.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0011","status":"open","ticket":"perf-gfx-render-pipeline-and-dirty-regions","title":"Agenda - [PERF] GFX Render Pipeline and Dirty Regions","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0010","file":"workflow/agendas/AGD-0010-perf-gfx-render-pipeline-and-dirty-regions.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0012","status":"review","ticket":"perf-runtime-introspection-syscalls","title":"Agenda - [PERF] Runtime Introspection Syscalls","created_at":"2026-03-27","updated_at":"2026-04-19","tags":["perf","runtime","syscall","telemetry","debug","asset"],"agendas":[{"id":"AGD-0011","file":"workflow/agendas/AGD-0011-perf-runtime-introspection-syscalls.md","status":"accepted","created_at":"2026-03-27","updated_at":"2026-04-18"}],"decisions":[{"id":"DEC-0009","file":"workflow/decisions/DEC-0009-host-owned-debug-and-certification.md","status":"accepted","created_at":"2026-04-18","updated_at":"2026-04-19","ref_agenda":"AGD-0011"}],"plans":[{"id":"PLN-0030","file":"workflow/plans/PLN-0030-dec9-spec-boundary-propagation.md","status":"done","created_at":"2026-04-19","updated_at":"2026-04-19","ref_decisions":["DEC-0009"]},{"id":"PLN-0031","file":"workflow/plans/PLN-0031-dec9-runtime-bank-abi-cleanup.md","status":"done","created_at":"2026-04-19","updated_at":"2026-04-19","ref_decisions":["DEC-0009"]},{"id":"PLN-0032","file":"workflow/plans/PLN-0032-dec9-host-debugger-and-certification-alignment.md","status":"done","created_at":"2026-04-19","updated_at":"2026-04-19","ref_decisions":["DEC-0009"]}],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0013","status":"done","ticket":"perf-host-debug-overlay-isolation","title":"Agenda - [PERF] Host Debug Overlay Isolation","created_at":"2026-03-27","updated_at":"2026-04-10","tags":[],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0027","file":"lessons/DSC-0013-perf-host-debug-overlay-isolation/LSN-0027-host-debug-overlay-isolation.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0024","status":"done","ticket":"generic-memory-bank-slot-contract","title":"Agenda - Generic Memory Bank Slot Contract","created_at":"2026-04-10","updated_at":"2026-04-10","tags":["runtime","asset","memory-bank","slots","host"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0029","file":"lessons/DSC-0024-generic-memory-bank-slot-contract/LSN-0029-slot-first-bank-telemetry-belongs-in-asset-manager.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0025","status":"done","ticket":"scene-bank-and-viewport-cache-refactor","title":"Scene Bank and Viewport Cache Refactor","created_at":"2026-04-11","updated_at":"2026-04-14","tags":["gfx","tilemap","runtime","render"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0030","file":"lessons/DSC-0025-scene-bank-and-viewport-cache-refactor/LSN-0030-canonical-scene-cache-and-resolver-split.md","status":"done","created_at":"2026-04-14","updated_at":"2026-04-14"}]}
|
||||
{"type":"discussion","id":"DSC-0026","status":"done","ticket":"render-all-scene-cache-and-camera-integration","title":"Integrate render_all with Scene Cache and Camera","created_at":"2026-04-14","updated_at":"2026-04-18","tags":["gfx","runtime","render","camera","scene"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0031","file":"lessons/DSC-0026-render-all-scene-cache-and-camera-integration/LSN-0031-frame-composition-belongs-above-the-render-backend.md","status":"done","created_at":"2026-04-18","updated_at":"2026-04-18"}]}
|
||||
{"type":"discussion","id":"DSC-0027","status":"done","ticket":"frame-composer-public-syscall-surface","title":"Agenda - FrameComposer Public Syscall Surface","created_at":"2026-04-17","updated_at":"2026-04-18","tags":["gfx","runtime","syscall","abi","frame-composer","scene","camera","sprites"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0032","file":"lessons/DSC-0027-frame-composer-public-syscall-surface/LSN-0032-public-abi-must-follow-the-canonical-service-boundary.md","status":"done","created_at":"2026-04-18","updated_at":"2026-04-18"}]}
|
||||
{"type":"discussion","id":"DSC-0028","status":"done","ticket":"deferred-overlay-and-primitive-composition","title":"Deferred Overlay and Primitive Composition over FrameComposer","created_at":"2026-04-18","updated_at":"2026-04-18","tags":["gfx","runtime","render","frame-composer","overlay","primitives","hud"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0033","file":"lessons/DSC-0028-deferred-overlay-and-primitive-composition/LSN-0033-debug-primitives-should-be-a-final-overlay-not-part-of-game-composition.md","status":"done","created_at":"2026-04-18","updated_at":"2026-04-18"}]}
|
||||
{"type":"discussion","id":"DSC-0014","status":"open","ticket":"perf-vm-allocation-and-copy-pressure","title":"Agenda - [PERF] VM Allocation and Copy Pressure","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0013","file":"workflow/agendas/AGD-0013-perf-vm-allocation-and-copy-pressure.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0015","status":"open","ticket":"perf-cartridge-boot-and-program-ownership","title":"Agenda - [PERF] Cartridge Boot and Program Ownership","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0014","file":"workflow/agendas/AGD-0014-perf-cartridge-boot-and-program-ownership.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0016","status":"done","ticket":"tilemap-empty-cell-vs-tile-id-zero","title":"Tilemap Empty Cell vs Tile ID Zero","created_at":"2026-03-27","updated_at":"2026-04-09","tags":[],"agendas":[{"id":"AGD-0015","file":"workflow/agendas/AGD-0015-tilemap-empty-cell-vs-tile-id-zero.md","status":"done","created_at":"2026-03-27","updated_at":"2026-04-09"}],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0022","file":"lessons/DSC-0016-tilemap-empty-cell-semantics/LSN-0022-tilemap-empty-cell-convergence.md","status":"done","created_at":"2026-04-09","updated_at":"2026-04-09"}]}
|
||||
{"type":"discussion","id":"DSC-0017","status":"done","ticket":"asset-entry-metadata-normalization-contract","title":"Asset Entry Metadata Normalization Contract","created_at":"2026-03-27","updated_at":"2026-04-09","tags":[],"agendas":[{"id":"AGD-0016","file":"workflow/agendas/AGD-0016-asset-entry-metadata-normalization-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-04-09"}],"decisions":[{"id":"DEC-0004","file":"workflow/decisions/DEC-0004-asset-entry-metadata-normalization-contract.md","status":"accepted","created_at":"2026-04-09","updated_at":"2026-04-09"}],"plans":[],"lessons":[{"id":"LSN-0023","file":"lessons/DSC-0017-asset-metadata-normalization/LSN-0023-typed-asset-metadata-helpers.md","status":"done","created_at":"2026-04-09","updated_at":"2026-04-09"}]}
|
||||
{"type":"discussion","id":"DSC-0018","status":"done","ticket":"asset-load-asset-id-int-contract","title":"Asset Load Asset ID Int Contract","created_at":"2026-03-27","updated_at":"2026-03-27","tags":["asset","runtime","abi"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0019","file":"lessons/DSC-0018-asset-load-asset-id-int-contract/LSN-0019-asset-load-id-abi-convergence.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"}]}
|
||||
{"type":"discussion","id":"DSC-0019","status":"done","ticket":"jenkinsfile-correction","title":"Jenkinsfile Correction and Relocation","created_at":"2026-04-07","updated_at":"2026-04-07","tags":["ci","jenkins"],"agendas":[{"id":"AGD-0017","file":"workflow/agendas/AGD-0017-jenkinsfile-correction.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"decisions":[{"id":"DEC-0002","file":"workflow/decisions/DEC-0002-jenkinsfile-strategy.md","status":"accepted","created_at":"2026-04-07","updated_at":"2026-04-07"}],"plans":[{"id":"PLN-0002","file":"workflow/plans/PLN-0002-jenkinsfile-execution.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}],"lessons":[{"id":"LSN-0020","file":"lessons/DSC-0019-jenkins-ci-standardization/LSN-0020-jenkins-standard-relocation.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}]}
|
||||
@@ -1,49 +0,0 @@
|
||||
{"type":"meta","next_id":{"DSC":49,"AGD":52,"DEC":43,"PLN":174,"LSN":57,"CLSN":1}}
|
||||
{"type":"discussion","id":"DSC-0044","status":"done","ticket":"hub-suspended-game-kill-affordance","title":"Hub Suspended Game Kill Affordance","created_at":"2026-07-05","updated_at":"2026-07-05","tags":["hub","lifecycle","game","ui"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0054","file":"discussion/lessons/DSC-0044-hub-suspended-game-kill-affordance/LSN-0054-manual-hub-kill-must-share-game-termination-cleanup.md","status":"done","created_at":"2026-07-05","updated_at":"2026-07-05"}]}
|
||||
{"type":"discussion","id":"DSC-0043","status":"done","ticket":"system-os-cartridge-switch-orchestrator","title":"SystemOS Cartridge Switch Orchestrator","created_at":"2026-07-03","updated_at":"2026-07-05","tags":["runtime","os","lifecycle","game","cartridge","architecture"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0053","file":"discussion/lessons/DSC-0043-system-os-cartridge-switch-orchestrator/LSN-0053-game-switching-is-lifecycle-replacement-not-loader-work.md","status":"done","created_at":"2026-07-05","updated_at":"2026-07-05"}]}
|
||||
{"type":"discussion","id":"DSC-0039","status":"abandoned","ticket":"render-pipeline-family-and-future-3d","title":"Render Pipeline Family and Future 3D","created_at":"2026-06-04","updated_at":"2026-06-04","tags":["gfx","renderer","runtime","architecture","pipeline"],"agendas":[{"id":"AGD-0039","file":"AGD-0039-render-pipeline-family-and-future-3d.md","status":"abandoned","created_at":"2026-06-04","updated_at":"2026-06-04","_override_reason":"User explicitly chose to close this agenda without a new decision because DSC-0038 already established enough architecture for future extension, and 3D is intentionally deferred."}],"decisions":[],"plans":[],"lessons":[],"_override_reason":"User explicitly chose to close this agenda without a new decision because DSC-0038 already established enough architecture for future extension, and 3D is intentionally deferred."}
|
||||
{"type":"discussion","id":"DSC-0040","status":"done","ticket":"vm-render-parallel-execution-boundary","title":"VM and Render Parallel Execution Boundary","created_at":"2026-06-04","updated_at":"2026-06-06","tags":["runtime","renderer","vm","concurrency","architecture","perf"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0048","file":"discussion/lessons/DSC-0040-vm-render-parallel-execution-boundary/LSN-0048-render-workers-need-a-closed-packet-contract.md","status":"done","created_at":"2026-06-06","updated_at":"2026-06-06"}]}
|
||||
{"type":"discussion","id":"DSC-0041","status":"done","ticket":"foreground-stack-game-pause-shell-vm-backed","title":"Foreground Stack, Game Pause, and VM-Backed Shell Coexistence","created_at":"2026-06-05","updated_at":"2026-07-05","tags":["runtime","os","lifecycle","shell","game","vm","foreground","architecture"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0052","file":"discussion/lessons/DSC-0041-foreground-stack-game-pause-shell-vm-backed/LSN-0052-foreground-ownership-and-vm-session-ownership-are-separate.md","status":"done","created_at":"2026-07-05","updated_at":"2026-07-05"}]}
|
||||
{"type":"discussion","id":"DSC-0042","status":"done","ticket":"real-render-worker-establishment","title":"Real Render Worker Establishment","created_at":"2026-06-06","updated_at":"2026-06-20","tags":["runtime","renderer","worker","concurrency","host","hal","architecture"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0049","file":"discussion/lessons/DSC-0042-real-render-worker-establishment/LSN-0049-render-worker-publication-boundary.md","status":"done","created_at":"2026-06-20","updated_at":"2026-06-20"}]}
|
||||
{"type":"discussion","id":"DSC-0038","status":"done","ticket":"render-frame-packet-boundary","title":"Logical Render Pipelines and Command Packets","created_at":"2026-05-25","updated_at":"2026-06-04","tags":["gfx","renderer","runtime","frame-composer","architecture","ui","pipeline"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0047","file":"discussion/lessons/DSC-0038-render-frame-packet-boundary/LSN-0047-typed-render-submissions-preserve-domain-boundaries.md","status":"done","created_at":"2026-06-04","updated_at":"2026-06-04"}]}
|
||||
{"type":"discussion","id":"DSC-0035","status":"done","ticket":"task-owned-shell-windows","title":"Agenda - Task-Owned Shell Windows","created_at":"2026-05-15","updated_at":"2026-05-15","tags":["runtime","os","task","window-manager","shell","lifecycle"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0044","file":"discussion/lessons/DSC-0035-task-owned-shell-windows/LSN-0044-task-window-liveness-belongs-to-the-task.md","status":"done","created_at":"2026-05-15","updated_at":"2026-05-15"}]}
|
||||
{"type":"discussion","id":"DSC-0034","status":"done","ticket":"system-os-domain-facades","title":"Agenda - SystemOS Domain Facades","created_at":"2026-05-15","updated_at":"2026-05-15","tags":["runtime","os","services","api-surface","lifecycle","fs"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0043","file":"discussion/lessons/DSC-0034-system-os-domain-facades/LSN-0043-systemos-domain-facades.md","status":"done","created_at":"2026-05-15","updated_at":"2026-05-15"}]}
|
||||
{"type":"discussion","id":"DSC-0023","status":"done","ticket":"perf-full-migration-to-atomic-telemetry","title":"Agenda - [PERF] Full Migration to Atomic Telemetry","created_at":"2026-04-10","updated_at":"2026-06-04","tags":["perf","runtime","telemetry"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0028","file":"discussion/lessons/DSC-0023-perf-full-migration-to-atomic-telemetry/LSN-0028-converging-to-single-atomic-telemetry-source.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0020","status":"done","ticket":"jenkins-gitea-integration","title":"Jenkins Gitea Integration and Relocation","created_at":"2026-04-07","updated_at":"2026-06-04","tags":["ci","jenkins","gitea"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0021","file":"discussion/lessons/DSC-0020-jenkins-gitea-integration/LSN-0021-jenkins-gitea-integration.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}]}
|
||||
{"type":"discussion","id":"DSC-0021","status":"done","ticket":"asset-entry-codec-enum-with-metadata","title":"Asset Entry Codec Enum Contract","created_at":"2026-04-09","updated_at":"2026-04-09","tags":["asset","runtime","codec","metadata"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0024","file":"discussion/lessons/DSC-0021-asset-entry-codec-enum-contract/LSN-0024-string-on-the-wire-enum-in-runtime.md","status":"done","created_at":"2026-04-09","updated_at":"2026-04-09"}]}
|
||||
{"type":"discussion","id":"DSC-0022","status":"done","ticket":"tile-bank-vs-glyph-bank-domain-naming","title":"Glyph Bank Domain Naming Contract","created_at":"2026-04-09","updated_at":"2026-04-10","tags":["gfx","runtime","naming","domain-model"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0025","file":"discussion/lessons/DSC-0022-glyph-bank-domain-naming/LSN-0025-rename-artifact-by-meaning-not-by-token.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0001","status":"done","ticket":"legacy-runtime-learn-import","title":"Import legacy runtime learn into discussion lessons","created_at":"2026-03-27","updated_at":"2026-03-27","tags":["migration","tech-debt"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0001","file":"discussion/lessons/DSC-0001-runtime-learn-legacy-import/LSN-0001-prometeu-learn-index.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0002","file":"discussion/lessons/DSC-0001-runtime-learn-legacy-import/LSN-0002-historical-asset-status-first-fault-and-return-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0003","file":"discussion/lessons/DSC-0001-runtime-learn-legacy-import/LSN-0003-historical-audio-status-first-fault-and-return-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0004","file":"discussion/lessons/DSC-0001-runtime-learn-legacy-import/LSN-0004-historical-cartridge-boot-protocol-and-manifest-authority.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0005","file":"discussion/lessons/DSC-0001-runtime-learn-legacy-import/LSN-0005-historical-game-memcard-slots-surface-and-semantics.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0006","file":"discussion/lessons/DSC-0001-runtime-learn-legacy-import/LSN-0006-historical-gfx-status-first-fault-and-return-contract.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0007","file":"discussion/lessons/DSC-0001-runtime-learn-legacy-import/LSN-0007-historical-retired-fault-and-input-decisions.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0008","file":"discussion/lessons/DSC-0001-runtime-learn-legacy-import/LSN-0008-historical-vm-core-and-assets.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0009","file":"discussion/lessons/DSC-0001-runtime-learn-legacy-import/LSN-0009-mental-model-asset-management.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0010","file":"discussion/lessons/DSC-0001-runtime-learn-legacy-import/LSN-0010-mental-model-audio.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0011","file":"discussion/lessons/DSC-0001-runtime-learn-legacy-import/LSN-0011-mental-model-gfx.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0012","file":"discussion/lessons/DSC-0001-runtime-learn-legacy-import/LSN-0012-mental-model-input.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0013","file":"discussion/lessons/DSC-0001-runtime-learn-legacy-import/LSN-0013-mental-model-observability-and-debugging.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0014","file":"discussion/lessons/DSC-0001-runtime-learn-legacy-import/LSN-0014-mental-model-portability-and-cross-platform.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0015","file":"discussion/lessons/DSC-0001-runtime-learn-legacy-import/LSN-0015-mental-model-save-memory-and-memcard.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0016","file":"discussion/lessons/DSC-0001-runtime-learn-legacy-import/LSN-0016-mental-model-status-first-and-fault-thinking.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0017","file":"discussion/lessons/DSC-0001-runtime-learn-legacy-import/LSN-0017-mental-model-time-and-cycles.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"},{"id":"LSN-0018","file":"discussion/lessons/DSC-0001-runtime-learn-legacy-import/LSN-0018-mental-model-touch.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"}]}
|
||||
{"type":"discussion","id":"DSC-0002","status":"done","ticket":"runtime-edge-test-plan","title":"Agenda - Runtime Edge Test Plan","created_at":"2026-03-27","updated_at":"2026-04-21","tags":[],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0037","file":"discussion/lessons/DSC-0002-runtime-edge-test-plan/LSN-0037-domain-gates-must-be-owned-by-the-repository.md","status":"done","created_at":"2026-04-21","updated_at":"2026-04-21"}]}
|
||||
{"type":"discussion","id":"DSC-0003","status":"open","ticket":"packed-cartridge-loader-pmc","title":"Agenda - Packed Cartridge Loader PMC","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0002","file":"AGD-0002-packed-cartridge-loader-pmc.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0004","status":"done","ticket":"system-run-cart","title":"Agenda - System Run Cart","created_at":"2026-03-27","updated_at":"2026-07-03","tags":[],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0051","file":"discussion/lessons/DSC-0004-system-run-cart/LSN-0051-launch-authority-belongs-to-systemos.md","status":"done","created_at":"2026-07-03","updated_at":"2026-07-03"}]}
|
||||
{"type":"discussion","id":"DSC-0005","status":"open","ticket":"system-fault-semantics-and-control-surface","title":"Agenda - System Fault Semantics and Control Surface","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0004","file":"AGD-0004-system-fault-semantics-and-control-surface.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0006","status":"open","ticket":"vm-owned-random-service","title":"Agenda - VM-Owned Random Service","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0005","file":"AGD-0005-vm-owned-random-service.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0007","status":"open","ticket":"app-home-filesystem-surface-and-semantics","title":"Agenda - App Home Filesystem Surface and Semantics","created_at":"2026-03-27","updated_at":"2026-03-27","tags":[],"agendas":[{"id":"AGD-0006","file":"AGD-0006-app-home-filesystem-surface-and-semantics.md","status":"open","created_at":"2026-03-27","updated_at":"2026-03-27"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0045","status":"open","ticket":"background-service-audio-execution","title":"Background Service and Audio Execution","created_at":"2026-07-05","updated_at":"2026-07-05","tags":["runtime","os","lifecycle","service","audio","background","architecture"],"agendas":[{"id":"AGD-0048","file":"AGD-0048-background-service-audio-execution.md","status":"open","created_at":"2026-07-05","updated_at":"2026-07-05"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0008","status":"done","ticket":"perf-runtime-telemetry-hot-path","title":"Agenda - [PERF] Runtime Telemetry Hot Path","created_at":"2026-03-27","updated_at":"2026-06-04","tags":[],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0026","file":"discussion/lessons/DSC-0008-perf-runtime-telemetry-hot-path/LSN-0026-push-based-telemetry-model.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0009","status":"done","ticket":"perf-async-background-work-lanes-for-assets-and-fs","title":"Agenda - [PERF] Async Background Work Lanes for Assets and FS","created_at":"2026-03-27","updated_at":"2026-07-01","tags":["perf","asset","fs","async","scheduler","runtime"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0050","file":"discussion/lessons/DSC-0009-perf-async-background-work-lanes-for-assets-and-fs/LSN-0050-serial-async-lanes-bound-backlog-complexity.md","status":"done","created_at":"2026-07-01","updated_at":"2026-07-01"}]}
|
||||
{"type":"discussion","id":"DSC-0010","status":"done","ticket":"perf-host-desktop-frame-pacing-and-presentation","title":"Agenda - [PERF] Host Desktop Frame Pacing and Presentation","created_at":"2026-03-27","updated_at":"2026-04-20","tags":[],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0036","file":"discussion/lessons/DSC-0010-perf-host-desktop-frame-pacing-and-presentation/LSN-0036-frame-publication-and-host-invalidation-must-be-separate.md","status":"done","created_at":"2026-04-20","updated_at":"2026-04-20"}]}
|
||||
{"type":"discussion","id":"DSC-0011","status":"abandoned","ticket":"perf-gfx-render-pipeline-and-dirty-regions","title":"Agenda - [PERF] GFX Render Pipeline and Dirty Regions","created_at":"2026-03-27","updated_at":"2026-06-28","tags":[],"agendas":[{"id":"AGD-0010","file":"AGD-0010-perf-gfx-render-pipeline-and-dirty-regions.md","status":"abandoned","created_at":"2026-03-27","updated_at":"2026-06-28","_override_reason":"User explicitly chose to remove this agenda because it no longer applies to the current render scenario; future optimizations can be discussed when needed."}],"decisions":[],"plans":[],"lessons":[],"_override_reason":"User explicitly chose to abandon this discussion because it no longer applies to the current render scenario; future optimizations can be discussed when needed."}
|
||||
{"type":"discussion","id":"DSC-0012","status":"done","ticket":"perf-runtime-introspection-syscalls","title":"Agenda - [PERF] Runtime Introspection Syscalls","created_at":"2026-03-27","updated_at":"2026-04-19","tags":["perf","runtime","syscall","telemetry","debug","asset"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0034","file":"discussion/lessons/DSC-0012-perf-runtime-introspection-syscalls/LSN-0034-host-owned-debug-boundaries.md","status":"done","created_at":"2026-04-19","updated_at":"2026-04-19"}]}
|
||||
{"type":"discussion","id":"DSC-0013","status":"done","ticket":"perf-host-debug-overlay-isolation","title":"Agenda - [PERF] Host Debug Overlay Isolation","created_at":"2026-03-27","updated_at":"2026-04-10","tags":[],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0027","file":"discussion/lessons/DSC-0013-perf-host-debug-overlay-isolation/LSN-0027-host-debug-overlay-isolation.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0024","status":"done","ticket":"generic-memory-bank-slot-contract","title":"Agenda - Generic Memory Bank Slot Contract","created_at":"2026-04-10","updated_at":"2026-04-10","tags":["runtime","asset","memory-bank","slots","host"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0029","file":"discussion/lessons/DSC-0024-generic-memory-bank-slot-contract/LSN-0029-slot-first-bank-telemetry-belongs-in-asset-manager.md","status":"done","created_at":"2026-04-10","updated_at":"2026-04-10"}]}
|
||||
{"type":"discussion","id":"DSC-0025","status":"done","ticket":"scene-bank-and-viewport-cache-refactor","title":"Scene Bank and Viewport Cache Refactor","created_at":"2026-04-11","updated_at":"2026-04-14","tags":["gfx","tilemap","runtime","render"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0030","file":"discussion/lessons/DSC-0025-scene-bank-and-viewport-cache-refactor/LSN-0030-canonical-scene-cache-and-resolver-split.md","status":"done","created_at":"2026-04-14","updated_at":"2026-04-14"}]}
|
||||
{"type":"discussion","id":"DSC-0026","status":"done","ticket":"render-all-scene-cache-and-camera-integration","title":"Integrate render_all with Scene Cache and Camera","created_at":"2026-04-14","updated_at":"2026-04-18","tags":["gfx","runtime","render","camera","scene"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0031","file":"discussion/lessons/DSC-0026-render-all-scene-cache-and-camera-integration/LSN-0031-frame-composition-belongs-above-the-render-backend.md","status":"done","created_at":"2026-04-18","updated_at":"2026-04-18"}]}
|
||||
{"type":"discussion","id":"DSC-0027","status":"done","ticket":"frame-composer-public-syscall-surface","title":"Agenda - FrameComposer Public Syscall Surface","created_at":"2026-04-17","updated_at":"2026-04-18","tags":["gfx","runtime","syscall","abi","frame-composer","scene","camera","sprites"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0032","file":"discussion/lessons/DSC-0027-frame-composer-public-syscall-surface/LSN-0032-public-abi-must-follow-the-canonical-service-boundary.md","status":"done","created_at":"2026-04-18","updated_at":"2026-04-18"}]}
|
||||
{"type":"discussion","id":"DSC-0028","status":"done","ticket":"deferred-overlay-and-primitive-composition","title":"Deferred Overlay and Primitive Composition over FrameComposer","created_at":"2026-04-18","updated_at":"2026-04-18","tags":["gfx","runtime","render","frame-composer","overlay","primitives","hud"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0033","file":"discussion/lessons/DSC-0028-deferred-overlay-and-primitive-composition/LSN-0033-debug-primitives-should-be-a-final-overlay-not-part-of-game-composition.md","status":"done","created_at":"2026-04-18","updated_at":"2026-04-18"}]}
|
||||
{"type":"discussion","id":"DSC-0029","status":"done","ticket":"scene-bank-glyph-runtime-binding-leak","title":"Scene Bank Glyph Runtime Binding Leak","created_at":"2026-04-24","updated_at":"2026-04-24","tags":["gfx","runtime","asset","scene","glyph","format","architecture"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0038","file":"discussion/lessons/DSC-0029-scene-bank-glyph-runtime-binding-leak/LSN-0038-cold-scene-dependencies-must-bind-by-asset-identity.md","status":"done","created_at":"2026-04-24","updated_at":"2026-04-24"}]}
|
||||
{"type":"discussion","id":"DSC-0014","status":"done","ticket":"perf-vm-allocation-and-copy-pressure","title":"Agenda - [PERF] VM Allocation and Copy Pressure","created_at":"2026-03-27","updated_at":"2026-04-20","tags":[],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0035","file":"discussion/lessons/DSC-0014-perf-vm-allocation-and-copy-pressure/LSN-0035-first-materialization-is-not-the-same-as-hot-path-copy-pressure.md","status":"done","created_at":"2026-04-20","updated_at":"2026-04-20"}]}
|
||||
{"type":"discussion","id":"DSC-0015","status":"abandoned","ticket":"perf-cartridge-boot-and-program-ownership","title":"Agenda - [PERF] Cartridge Boot and Program Ownership","created_at":"2026-03-27","updated_at":"2026-04-20","tags":[],"agendas":[{"id":"AGD-0014","file":"AGD-0014-perf-cartridge-boot-and-program-ownership.md","status":"abandoned","created_at":"2026-03-27","updated_at":"2026-04-20","_override_reason":"User explicitly chose to close the discussion without decision because FS->memory copy for the program is already acceptable."}],"decisions":[],"plans":[],"lessons":[],"_override_reason":"User explicitly chose to abandon the discussion without creating a decision because FS->memory copy for the program is already acceptable."}
|
||||
{"type":"discussion","id":"DSC-0016","status":"done","ticket":"tilemap-empty-cell-vs-tile-id-zero","title":"Tilemap Empty Cell vs Tile ID Zero","created_at":"2026-03-27","updated_at":"2026-06-04","tags":[],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0022","file":"discussion/lessons/DSC-0016-tilemap-empty-cell-semantics/LSN-0022-tilemap-empty-cell-convergence.md","status":"done","created_at":"2026-04-09","updated_at":"2026-04-09"}]}
|
||||
{"type":"discussion","id":"DSC-0017","status":"done","ticket":"asset-entry-metadata-normalization-contract","title":"Asset Entry Metadata Normalization Contract","created_at":"2026-03-27","updated_at":"2026-06-04","tags":[],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0023","file":"discussion/lessons/DSC-0017-asset-metadata-normalization/LSN-0023-typed-asset-metadata-helpers.md","status":"done","created_at":"2026-04-09","updated_at":"2026-04-09"}]}
|
||||
{"type":"discussion","id":"DSC-0018","status":"done","ticket":"asset-load-asset-id-int-contract","title":"Asset Load Asset ID Int Contract","created_at":"2026-03-27","updated_at":"2026-03-27","tags":["asset","runtime","abi"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0019","file":"discussion/lessons/DSC-0018-asset-load-asset-id-int-contract/LSN-0019-asset-load-id-abi-convergence.md","status":"done","created_at":"2026-03-27","updated_at":"2026-03-27"}]}
|
||||
{"type":"discussion","id":"DSC-0019","status":"done","ticket":"jenkinsfile-correction","title":"Jenkinsfile Correction and Relocation","created_at":"2026-04-07","updated_at":"2026-06-04","tags":["ci","jenkins"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0020","file":"discussion/lessons/DSC-0019-jenkins-ci-standardization/LSN-0020-jenkins-standard-relocation.md","status":"done","created_at":"2026-04-07","updated_at":"2026-04-07"}]}
|
||||
{"type":"discussion","id":"DSC-0030","status":"done","ticket":"internal-viewport-270p","title":"Agenda - Internal Viewport 270p (480x270)","created_at":"2026-04-27","updated_at":"2026-04-28","tags":["gfx","runtime","viewport","resolution","frame-composer","host"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0039","file":"discussion/lessons/DSC-0030-internal-viewport-270p/LSN-0039-resolution-baseline-changes-are-runtime-wide-contracts.md","status":"done","created_at":"2026-04-28","updated_at":"2026-04-28"}]}
|
||||
{"type":"discussion","id":"DSC-0031","status":"done","ticket":"runtime-mode-separation-game-system","title":"Agenda - Runtime Mode Separation: Game and System","created_at":"2026-05-11","updated_at":"2026-05-14","tags":["runtime","firmware","hub","system-apps","game-mode","scheduler"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0040","file":"discussion/lessons/DSC-0031-runtime-mode-separation-game-system/LSN-0040-system-pipeline-separation.md","status":"done","created_at":"2026-05-14","updated_at":"2026-05-14"}]}
|
||||
{"type":"discussion","id":"DSC-0032","status":"done","ticket":"system-os-lifecycle-process-task-contract","title":"Agenda - SystemOS Lifecycle, Process and Task Contract","created_at":"2026-05-14","updated_at":"2026-05-15","tags":["runtime","os","lifecycle","process","task","shell","firmware"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0041","file":"discussion/lessons/DSC-0032-system-os-lifecycle-process-task-contract/LSN-0041-systemos-lifecycle-authority.md","status":"done","created_at":"2026-05-15","updated_at":"2026-05-15"}]}
|
||||
{"type":"discussion","id":"DSC-0033","status":"done","ticket":"system-os-service-ownership-and-module-layout","title":"Agenda - SystemOS Service Ownership and Module Layout","created_at":"2026-05-14","updated_at":"2026-05-15","tags":["runtime","os","services","module-layout","vm","window-manager","logging"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0042","file":"discussion/lessons/DSC-0033-system-os-service-ownership-and-module-layout/LSN-0042-systemos-service-ownership-boundary.md","status":"done","created_at":"2026-05-15","updated_at":"2026-05-15"}]}
|
||||
{"type":"discussion","id":"DSC-0036","status":"done","ticket":"prometeu-hub-ui-direction","title":"Agenda - Prometeu Hub UI Direction","created_at":"2026-05-15","updated_at":"2026-05-22","tags":["hub","ui","shell","system-apps","lifecycle","design-system"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0045","file":"discussion/lessons/DSC-0036-prometeu-hub-ui-direction/LSN-0045-hub-ui-slices-should-prove-os-boundaries.md","status":"done","created_at":"2026-05-22","updated_at":"2026-05-22"}]}
|
||||
{"type":"discussion","id":"DSC-0037","status":"done","ticket":"rgba8888-framebuffer-and-pixel-format-direction","title":"Agenda - RGBA8888 Framebuffer and Pixel Format Direction","created_at":"2026-05-22","updated_at":"2026-05-23","tags":["gfx","framebuffer","rgb565","rgba8888","renderer","assets","host","backend"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0046","file":"discussion/lessons/DSC-0037-rgba8888-framebuffer-and-pixel-format-direction/LSN-0046-pixel-format-contracts-must-move-as-one-surface.md","status":"done","created_at":"2026-05-23","updated_at":"2026-05-23"}]}
|
||||
{"type":"discussion","id":"DSC-0046","status":"done","ticket":"runtime-owned-variable-glyph-bank-palette-protocol","title":"Runtime-Owned Variable Glyph Bank Palette Protocol","created_at":"2026-07-14","updated_at":"2026-07-14","tags":["runtime","gfx","assets","glyph-bank","palette-serialization","protocol"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0055","file":"discussion/lessons/DSC-0046-runtime-owned-variable-glyph-bank-palette-protocol/LSN-0055-runtime-owned-asset-protocols-must-align-payload-residency-and-lookup.md","status":"done","created_at":"2026-07-14","updated_at":"2026-07-14"}]}
|
||||
{"type":"discussion","id":"DSC-0047","status":"open","ticket":"portable-host-backend-strategy","title":"Portable Host Backend Strategy","created_at":"2026-07-14","updated_at":"2026-07-14","tags":["host","desktop","portable","sdl","backend","rendering","input","audio","linux","android","handheld"],"agendas":[{"id":"AGD-0050","file":"AGD-0050-portable-host-backend-strategy.md","status":"open","created_at":"2026-07-14","updated_at":"2026-07-14"}],"decisions":[],"plans":[],"lessons":[]}
|
||||
{"type":"discussion","id":"DSC-0048","status":"done","ticket":"corrigir-identificacao-formato-pbx","title":"Corrigir Identificacao do Formato PBX","created_at":"2026-07-15","updated_at":"2026-07-15","tags":["runtime","bytecode","pbx","loader","format","architecture"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0056","file":"discussion/lessons/DSC-0048-corrigir-identificacao-formato-pbx/LSN-0056-runtime-artifact-identity-must-not-borrow-frontend-names.md","status":"done","created_at":"2026-07-15","updated_at":"2026-07-15"}]}
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
---
|
||||
id: LSN-0057
|
||||
ticket: headless-automation-host-and-deterministic-runtime-control
|
||||
title: Deterministic Host Control Follows Logical Runtime Boundaries
|
||||
created: 2026-09-22
|
||||
tags: [runtime, host, headless, deterministic, testing, input, framebuffer, lifecycle]
|
||||
---
|
||||
|
||||
## Context
|
||||
|
||||
Prometeu needed an automation host that could boot and control a real cartridge
|
||||
without a window, display surface, audio device, or refresh-rate delay. The
|
||||
runtime already had the necessary domain boundaries: normalized
|
||||
`InputSignals`, logical-frame execution, structured `CrashReport` values, and
|
||||
worker-published `OwnedRgba8888Frame` values. The missing piece was a host that
|
||||
composed those boundaries without inheriting desktop presentation concerns.
|
||||
|
||||
The implementation introduced the in-process `prometeu-host-headless` library
|
||||
under `DEC-0043`. It proved deterministic input, frame advancement, pixel
|
||||
capture, faults, audio discard, and reset behavior with directory cartridges
|
||||
assembled directly in Rust tests.
|
||||
|
||||
## Key Decisions
|
||||
|
||||
### Logical Frames, Not Host Ticks, Are the Automation Unit
|
||||
|
||||
**What:** `advance_frame` repeatedly ticks firmware until the VM closes one
|
||||
logical frame or reports a fault. It temporarily releases VM pause through the
|
||||
existing debug-step request and leaves the VM paused afterward.
|
||||
|
||||
**Why:** A firmware tick is an execution budget slice, not necessarily a guest
|
||||
frame. Exposing ticks would make automation sensitive to budget configuration
|
||||
and host speed. Waiting for `FrameSync`, end-of-ROM, or a fault gives callers a
|
||||
guest-visible boundary.
|
||||
|
||||
**Trade-offs:** One automation operation may execute multiple firmware ticks.
|
||||
The host must therefore drain audio after every tick and must distinguish
|
||||
instruction stepping from logical-frame advancement.
|
||||
|
||||
### Published Worker Frames Are the Pixel Oracle
|
||||
|
||||
**What:** Frame capture reads the `LatestRenderFrameStore` populated by the
|
||||
existing render worker and waits for a frame id newer than the one observed
|
||||
before advancement.
|
||||
|
||||
**Why:** Reading mutable hardware buffers would create a second observation
|
||||
path and could expose partially applied work. The published
|
||||
`OwnedRgba8888Frame` is already the runtime's canonical completed-frame
|
||||
boundary, as described by `LSN-0049`.
|
||||
|
||||
**Trade-offs:** Logical execution and frame publication finish on different
|
||||
threads, so capture must synchronize with publication. That wait is worker
|
||||
completion, not refresh pacing.
|
||||
|
||||
### Cold Reset Must Clear Lifecycle Ownership as Well as VM State
|
||||
|
||||
**What:** Entering `FirmwareState::Reset` terminates the resident game before
|
||||
clearing VM sessions and global runtime cartridge state.
|
||||
|
||||
**Why:** Clearing only the VM session registry leaves the foreground lifecycle
|
||||
stack pointing at the old resident task. The next boot then looks like a second
|
||||
resident game and fails with `ResidentGameAlreadyExists`. A cold boot boundary
|
||||
must clear both execution state and the ownership records that authorize it.
|
||||
|
||||
**Trade-offs:** Reset is destructive lifecycle replacement. It intentionally
|
||||
does not preserve the previous game as resumable state; Home suspend/resume is
|
||||
the separate contract for preservation.
|
||||
|
||||
## Patterns and Algorithms
|
||||
|
||||
### Deterministic Frame Advancement
|
||||
|
||||
1. Record the current logical-frame index and latest published frame id.
|
||||
2. Unpause the active VM session and request one debug frame step.
|
||||
3. Tick firmware with the retained `InputSignals`.
|
||||
4. Clear pending audio commands after every tick.
|
||||
5. Continue until the logical-frame index advances or a structured fault is
|
||||
visible.
|
||||
6. Pause the VM again.
|
||||
7. Read the publication store until the worker publishes a different frame id.
|
||||
|
||||
This keeps the oracle independent of wall-clock refresh timing while exercising
|
||||
the same firmware, VM, render worker, input, and audio paths as a real host.
|
||||
|
||||
### Repeatability Oracle
|
||||
|
||||
Compare only stable runtime outputs:
|
||||
|
||||
- logical-frame index;
|
||||
- published RGBA8888 pixels and frame identity progression;
|
||||
- debugger-shaped state (`pc`, stack top, frame index, and app id);
|
||||
- structured fault data.
|
||||
|
||||
Do not compare host CPU time, `Instant` timestamps, or certification budgets.
|
||||
Those values characterize execution conditions, not deterministic guest state.
|
||||
|
||||
## Pitfalls
|
||||
|
||||
- One firmware tick is not guaranteed to complete one guest frame.
|
||||
- Instruction `step` and logical-frame advancement have different contracts.
|
||||
- Capturing the hardware front buffer bypasses the canonical worker publication
|
||||
boundary.
|
||||
- Sleeping for a display period makes a headless host inherit presentation
|
||||
pacing and turns 300-frame tests into multi-second runs.
|
||||
- Clearing VM sessions without clearing resident-game lifecycle ownership does
|
||||
not produce a cold reset.
|
||||
- Opening or emulating an audio device is unnecessary when the required sink
|
||||
semantics are simply to consume and discard queued commands.
|
||||
|
||||
## References
|
||||
|
||||
- Decision: `DEC-0043` (Headless Host and Deterministic Frame Control)
|
||||
- Related lesson: `LSN-0049` (Render Workers Publish Frames, Hosts Present Them)
|
||||
- Related lesson: `LSN-0053` (Game Switching Is Lifecycle Replacement, Not Loader Work)
|
||||
- Audio contract: `docs/specs/runtime/05-audio-peripheral.md`
|
||||
|
||||
## Takeaways
|
||||
|
||||
- Automation should advance guest-defined logical boundaries, not host loop
|
||||
iterations.
|
||||
- Deterministic input is a retained normalized value supplied to every tick.
|
||||
- The render worker's publication store is the single trustworthy pixel oracle.
|
||||
- Headless execution can reuse production runtime paths without linking native
|
||||
presentation or audio-device libraries.
|
||||
- A cold reset must clear lifecycle ownership and execution state together.
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
---
|
||||
id: LSN-0058
|
||||
ticket: headless-automation-host-hardening
|
||||
title: Deterministic Observation Must Follow the Active Producer
|
||||
created: 2026-09-23
|
||||
tags: [runtime, host, headless, deterministic, rendering, testing, debugger]
|
||||
---
|
||||
|
||||
## Context
|
||||
|
||||
The first headless automation host appeared to synchronize frame capture with a
|
||||
render worker: it started a worker, remembered the latest published frame id,
|
||||
and spun for a bounded number of iterations after logical execution. Source
|
||||
revalidation showed that this story did not match the running system. A Game
|
||||
cartridge executes inside an active `VmSession`, and that session selected the
|
||||
existing `LocalSynchronous` render consumer. The worker started on the global
|
||||
fallback runtime never consumed the active session's submissions.
|
||||
|
||||
The visible frame was already published synchronously through the normal
|
||||
platform sink. The spin was therefore redundant in successful runs and would
|
||||
still have been incorrect for a future asynchronous path because it waited for
|
||||
"any different frame" rather than the specific frame requested by automation.
|
||||
|
||||
## Key Decisions
|
||||
|
||||
### The Observation Contract Follows the Active Execution Owner
|
||||
|
||||
**What:** The headless host intentionally uses the active session's local
|
||||
synchronous consumer and removes the unused global worker and bounded spin.
|
||||
|
||||
**Why:** Synchronization must be defined against the component that actually
|
||||
produces the observed value. Waiting on an unrelated worker creates accidental
|
||||
success and makes the architecture harder to reason about.
|
||||
|
||||
**Trade-offs:** The deterministic headless host does not exercise worker
|
||||
concurrency on every cartridge run. Worker equivalence remains a separate
|
||||
runtime conformance concern rather than part of each game's oracle.
|
||||
|
||||
### Completion Carries Exact Identity
|
||||
|
||||
**What:** Successful frame advancement retains the explicit
|
||||
`{logical_frame_index, FrameId}` pair and capture validates that exact published
|
||||
frame before cloning its `OwnedRgba8888Frame`.
|
||||
|
||||
**Why:** A generation change only proves that something was published. It does
|
||||
not prove which logical operation produced it. Exact identity makes stale or
|
||||
mis-associated observations detectable.
|
||||
|
||||
**Trade-offs:** Logical frame numbers and render frame ids remain separate
|
||||
domains. Callers compare the explicit pair rather than assuming equality or a
|
||||
fixed offset.
|
||||
|
||||
### A Tick Slice Must Be Smaller Than the Logical Budget
|
||||
|
||||
**What:** The runtime's per-firmware-tick execution slice is smaller than the
|
||||
total logical-frame cycle budget. Headless advancement loops across slices
|
||||
until the frame closes or a terminal outcome occurs.
|
||||
|
||||
**Why:** When both limits were equal, `BudgetExhausted` left zero remaining
|
||||
logical budget, so another tick could not make progress. The documented
|
||||
multi-tick contract existed only nominally. Separating the limits makes a tick
|
||||
an implementation slice and keeps a logical frame as the automation unit.
|
||||
|
||||
**Trade-offs:** A computation-heavy logical frame can span several firmware
|
||||
ticks. This is observable through deterministic tick counters but does not
|
||||
change guest frame semantics.
|
||||
|
||||
### Debug Instruction Step Must Prime the Entry Call
|
||||
|
||||
**What:** The shared debugger instruction-step primitive prepares the VM entry
|
||||
call when the call stack is empty before executing one instruction.
|
||||
|
||||
**Why:** Direct boot intentionally stops before the first game instruction. A
|
||||
debug step at that point previously encountered the coroutine safepoint and
|
||||
reported `FrameSync` as an unexpected panic instead of executing the first
|
||||
instruction.
|
||||
|
||||
**Trade-offs:** Entry preparation remains shared runtime behavior. No
|
||||
headless-specific VM branch is introduced.
|
||||
|
||||
## Patterns and Algorithms
|
||||
|
||||
### Deterministic Frame Advance
|
||||
|
||||
1. Record the current logical-frame index and latest canonical frame id.
|
||||
2. Release pause and request the same one-frame stop used by debugger control.
|
||||
3. Tick firmware while feeding the retained normalized `InputSignals`.
|
||||
4. Continue through internal cycle-slice exhaustion.
|
||||
5. Stop on exactly one logical-frame increment, structured fault, lifecycle
|
||||
termination, or a typed host safety-limit error.
|
||||
6. Clear the frame-step request and finish paused.
|
||||
7. On success, require a new canonical frame and retain its exact identity with
|
||||
the completed logical index.
|
||||
|
||||
### Deterministic Oracle Boundary
|
||||
|
||||
Include observations that describe simulated execution: logical frame and
|
||||
frame identity, canonical pixels and layout, guest-visible state, structured
|
||||
status/faults, and deterministic machine counters.
|
||||
|
||||
Exclude observations of the host running the simulation: wall time, CPU time,
|
||||
thread scheduling, presentation cadence, worker timing, and host-only
|
||||
identities.
|
||||
|
||||
## Pitfalls
|
||||
|
||||
- A worker created by a host may not own the active session being automated.
|
||||
- Bounded spinning is neither an acknowledgement nor an identity check.
|
||||
- "Latest changed" is weaker than "the requested frame was published."
|
||||
- Equal slice and logical budgets can make multi-tick continuation impossible
|
||||
even when the control loop appears to support it.
|
||||
- A debug step from a pristine boot boundary must establish the same entry-call
|
||||
precondition as normal execution.
|
||||
- Human-readable fault summaries are useful diagnostics but are not a stable
|
||||
automation interface; retain structured `CrashReport` values.
|
||||
|
||||
## References
|
||||
|
||||
- Decision: `DEC-0044` (Deterministic Headless Automation Host Contract)
|
||||
- Prior lesson: `LSN-0057` (Deterministic Host Control Follows Logical Runtime Boundaries)
|
||||
- Render worker lesson: `LSN-0049` (Render Workers Publish Frames, Hosts Present Them)
|
||||
- Graphics contract: `docs/specs/runtime/04-gfx-peripheral.md`
|
||||
- Debug contract: `docs/specs/runtime/10-debug-inspection-and-profiling.md`
|
||||
- Portability and headless contract: `docs/specs/runtime/11-portability-and-cross-platform-execution.md`
|
||||
|
||||
## Takeaways
|
||||
|
||||
- Revalidate ownership and data flow from source before hardening a wait.
|
||||
- Deterministic observation requires exact completion identity, not timing luck.
|
||||
- Keep logical-frame control above internal execution slices.
|
||||
- Use one production runtime path for interactive debugging and headless
|
||||
automation; vary host transport and pacing, not machine semantics.
|
||||
- Test infrastructure boundaries with counters and structured outcomes instead
|
||||
of sleeps or log parsing.
|
||||
@@ -1,86 +0,0 @@
|
||||
---
|
||||
id: AGD-0002
|
||||
ticket: packed-cartridge-loader-pmc
|
||||
title: Agenda - Packed Cartridge Loader PMC
|
||||
status: open
|
||||
created: 2026-03-27
|
||||
resolved:
|
||||
decision:
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Agenda - Packed Cartridge Loader PMC
|
||||
|
||||
## Problema
|
||||
|
||||
O loader reconhece a extensão `.pmc`, mas o caminho empacotado ainda nao existe de verdade.
|
||||
|
||||
Hoje o dispatcher aceita a intenção e delega para um loader que sempre falha com `InvalidFormat`.
|
||||
|
||||
## Dor
|
||||
|
||||
- A plataforma declara dois formatos de entrada, mas só um funciona.
|
||||
- Distribuição real de cartuchos fica travada no layout de diretório.
|
||||
- Host, firmware e ferramentas nao conseguem validar o caminho de distribuição final.
|
||||
- O runtime continua dependente de estrutura de workspace em vez de artefato fechado.
|
||||
|
||||
## Alvo da Discussao
|
||||
|
||||
Definir o formato e o contrato do cartucho empacotado `.pmc` como artefato de distribuição do runtime.
|
||||
|
||||
O objetivo nao é só "descompactar um zip", e sim fixar:
|
||||
|
||||
- layout interno;
|
||||
- regras de validação;
|
||||
- limites de compatibilidade;
|
||||
- superfície de erro;
|
||||
- impacto em assinatura/versionamento futuro.
|
||||
|
||||
## O Que Precisa Ser Definido
|
||||
|
||||
1. Container.
|
||||
O `.pmc` é zip, tar, formato próprio, ou envelope simples com header e blobs?
|
||||
|
||||
2. Estrutura interna.
|
||||
Quais arquivos são obrigatórios e opcionais:
|
||||
- `manifest.json`
|
||||
- `program.pbx`
|
||||
- `assets.pa`
|
||||
- outros metadados
|
||||
|
||||
3. Regras de validação.
|
||||
Ordem de parsing, integridade, presença de arquivos, tamanho máximo, duplicatas e versão suportada.
|
||||
|
||||
4. Política de compatibilidade.
|
||||
Como o loader reage a versões futuras do container e do manifesto.
|
||||
|
||||
5. Segurança e determinismo.
|
||||
Como impedir traversal, nomes ambíguos, arquivos extras maliciosos e dependência da ordem física do container.
|
||||
|
||||
6. Relação com o loader de diretório.
|
||||
O comportamento validado deve ser idêntico entre diretório e `.pmc`, mudando apenas a origem dos bytes.
|
||||
|
||||
## O Que Necessita Para Resolver
|
||||
|
||||
- especificação mínima do container `.pmc`;
|
||||
- decisão sobre biblioteca/abordagem de parsing;
|
||||
- matriz de erros determinísticos;
|
||||
- testes com cartuchos sintéticos válidos e inválidos;
|
||||
- garantia de equivalência comportamental com o loader de diretório.
|
||||
|
||||
## Fora de Escopo
|
||||
|
||||
- compressão otimizada;
|
||||
- assinatura criptográfica;
|
||||
- distribuição incremental;
|
||||
- pipeline completo do builder/packer.
|
||||
|
||||
## Critério de Saida Desta Agenda
|
||||
|
||||
Pode virar PR quando houver definição escrita de:
|
||||
|
||||
- formato do `.pmc`;
|
||||
- arquivos obrigatórios;
|
||||
- erros canônicos;
|
||||
- invariantes de segurança;
|
||||
- estratégia de testes de compatibilidade entre diretório e pacote.
|
||||
@@ -1,65 +0,0 @@
|
||||
---
|
||||
id: AGD-0004
|
||||
ticket: system-fault-semantics-and-control-surface
|
||||
title: Agenda - System Fault Semantics and Control Surface
|
||||
status: open
|
||||
created: 2026-03-27
|
||||
resolved:
|
||||
decision:
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Agenda - System Fault Semantics and Control Surface
|
||||
|
||||
## Problema
|
||||
|
||||
O dominio `system` e pequeno, mas mistura consulta simples com superficie de controle de fluxo.
|
||||
|
||||
Hoje:
|
||||
|
||||
- `SystemHasCart` responde diretamente;
|
||||
- `SystemRunCart` ainda nao tem efeito real;
|
||||
- a agenda `009` resolve semantica funcional, mas nao fecha por si so a politica de fault do dominio.
|
||||
|
||||
## Dor
|
||||
|
||||
- sem uma agenda propria, `system` pode herdar fault semantics por acidente;
|
||||
- `run_cart` pode acabar consolidando `Panic` ou `Trap` onde deveria existir retorno operacional;
|
||||
- a fronteira entre falha do app, falha do firmware e falha do runtime fica opaca.
|
||||
|
||||
## Hotspots Atuais
|
||||
|
||||
- [dispatch.rs](/Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/crates/console/prometeu-system/src/virtual_machine_runtime/dispatch.rs#L114)
|
||||
- [system.rs](/Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/crates/console/prometeu-hal/src/syscalls/domains/system.rs#L4)
|
||||
- [009-system-run-cart.md](/Users/niltonconstantino/personal/workspace.personal/intrepid/prometeu/runtime/docs/runtime/agendas/009-system-run-cart.md)
|
||||
|
||||
## Alvo da Discussao
|
||||
|
||||
Fechar a politica de fault e retorno do dominio `system`.
|
||||
|
||||
## O Que Precisa Ser Definido
|
||||
|
||||
1. Queries simples.
|
||||
Decidir a politica de fault para consultas como `has_cart`.
|
||||
|
||||
2. `run_cart`.
|
||||
Decidir como falhas operacionais de transicao devem ser expostas:
|
||||
- `status`;
|
||||
- `Trap`;
|
||||
- `Panic`.
|
||||
|
||||
3. Relacao com firmware.
|
||||
Delimitar quando a falha pertence ao app, ao firmware ou ao runtime.
|
||||
|
||||
## Dependencias
|
||||
|
||||
- `../specs/16a-syscall-policies.md`
|
||||
- `009-system-run-cart.md`
|
||||
|
||||
## Critério de Saida Desta Agenda
|
||||
|
||||
Pode virar PR quando houver decisao escrita sobre:
|
||||
|
||||
- matriz de `status`/`Trap`/`Panic` para `system`;
|
||||
- politica de retorno/falha de `run_cart`;
|
||||
- relacao com firmware e crash surface.
|
||||
@@ -1,79 +0,0 @@
|
||||
---
|
||||
id: AGD-0005
|
||||
ticket: vm-owned-random-service
|
||||
title: Agenda - VM-Owned Random Service
|
||||
status: open
|
||||
created: 2026-03-27
|
||||
resolved:
|
||||
decision:
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Agenda - VM-Owned Random Service
|
||||
|
||||
## Problema
|
||||
|
||||
Precisamos de random como primeiro consumidor stateful VM-owned, mas sem fechar um contrato minimo o dominio pode nascer incoerente e nao deterministico.
|
||||
|
||||
## Alvo da Discussao
|
||||
|
||||
Fechar o perfil minimo de random VM-owned em cima do core definido na decisao `006`.
|
||||
|
||||
## O Que Precisa Ser Definido
|
||||
|
||||
1. Surface minima do servico.
|
||||
Fechar operacoes como:
|
||||
- `new(seed) -> rng_ref`;
|
||||
- `next(rng_ref) -> int`;
|
||||
- `destroy(rng_ref)`.
|
||||
|
||||
2. Determinismo e replay.
|
||||
Definir:
|
||||
- seed explicita obrigatoria;
|
||||
- regra de reproducao frame a frame;
|
||||
- comportamento esperado em replay.
|
||||
|
||||
3. Lifecycle e validade.
|
||||
Definir:
|
||||
- como lidar com `rng_ref` invalido/stale;
|
||||
- relacao com GC;
|
||||
- destruicao explicita vs cleanup por GC.
|
||||
|
||||
4. Fault/status do dominio.
|
||||
Definir:
|
||||
- quais erros sao `status`;
|
||||
- quais casos viram `Trap`;
|
||||
- inexistencia de `Panic` operacional.
|
||||
|
||||
5. Metadados e versionamento.
|
||||
Definir IDs/version das operacoes de random para garantir mapeamento 1:1 FE/backend/runtime.
|
||||
|
||||
## Open Questions de Arquitetura
|
||||
|
||||
1. v1 aceita apenas modo deterministico por seed ou tambem entropy host?
|
||||
2. `next` retorna apenas `int` ou precisamos variantes (`u32`, `float`) no mesmo ciclo?
|
||||
3. precisamos de clone/split de gerador no MVP?
|
||||
4. destruicao explicita deve ser obrigatoria para certificacao/custo ou opcional?
|
||||
|
||||
## Dependencias
|
||||
|
||||
- `../decisions/006-vm-owned-stateful-core-contract.md`
|
||||
- `../virtual-machine/ISA_CORE.md`
|
||||
- `../specs/16-host-abi-and-syscalls.md`
|
||||
- `../specs/16a-syscall-policies.md`
|
||||
|
||||
## Fora de Escopo
|
||||
|
||||
- entropy nao deterministica como contrato base;
|
||||
- PRNGs multiplos no mesmo ciclo de fechamento;
|
||||
- APIs de colecoes stateful;
|
||||
- window/app model.
|
||||
|
||||
## Criterio de Saida Desta Agenda
|
||||
|
||||
Pode virar PR quando houver decisao escrita sobre:
|
||||
|
||||
- surface minima de random VM-owned;
|
||||
- contrato de determinismo/replay;
|
||||
- fault/status de random;
|
||||
- IDs/versionamento e validacoes de verifier para as operacoes do dominio.
|
||||
@@ -1,157 +0,0 @@
|
||||
---
|
||||
id: AGD-0006
|
||||
ticket: app-home-filesystem-surface-and-semantics
|
||||
title: Agenda - App Home Filesystem Surface and Semantics
|
||||
status: open
|
||||
created: 2026-03-27
|
||||
resolved:
|
||||
decision:
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Agenda - App Home Filesystem Surface and Semantics
|
||||
|
||||
## Problema
|
||||
|
||||
Apps precisam de filesystem util para dados de usuario, cache e configuracao, mas sem acesso ao FS inteiro do host.
|
||||
|
||||
Sem um contrato claro de `home` por app, a API tende a crescer com semantica inconsistente entre plataformas.
|
||||
|
||||
## Inputs Ja Fechados
|
||||
|
||||
1. Todo `app` acessa somente sua `home` logica.
|
||||
2. Nunca ha acesso direto ao filesystem global do host pela userland.
|
||||
3. O runtime `fs` interno continua cobrindo tanto `game` quanto `app`.
|
||||
4. Existe uma async IO lane compartilhavel por assets, memcard e FS. Esta
|
||||
agenda deve decidir a API publica de FS considerando essa lane, mas a
|
||||
existencia da lane ja esta fechada por `DEC-0034`.
|
||||
|
||||
## Fronteira com a Async IO Lane
|
||||
|
||||
`DEC-0034` fecha a existencia de uma lane serial para trabalho async de IO. FS
|
||||
pode consumir essa lane internamente para escrita, configuracao, leitura ou
|
||||
listagem, conforme prioridade operacional definida pelo runtime.
|
||||
|
||||
Esta agenda continua dona da decisao sobre API publica de FS para `app home`.
|
||||
Portanto, a existencia da lane nao implica criar agora request handles, polling
|
||||
publico ou novas syscalls de FS. Esses shapes permanecem em aberto aqui.
|
||||
|
||||
## Alvo da Discussao
|
||||
|
||||
Fechar a superficie e semantica funcional de `fs` para perfil `app`, com sandbox por `app_id` e transporte de bytes via decisao `003`.
|
||||
|
||||
## O Que Precisa Ser Definido
|
||||
|
||||
1. Surface minima do perfil `app`.
|
||||
Operacoes candidatas:
|
||||
- `read`;
|
||||
- `write`;
|
||||
- `exists`;
|
||||
- `stat`;
|
||||
- `list_dir`;
|
||||
- `delete`;
|
||||
- `mkdir`;
|
||||
- `rename`.
|
||||
|
||||
2. Modelo de caminho logico.
|
||||
Definir:
|
||||
- raiz virtual (`home`);
|
||||
- normalizacao de path;
|
||||
- bloqueio de path traversal;
|
||||
- limites de profundidade/tamanho.
|
||||
|
||||
3. Mapeamento host.
|
||||
Definir:
|
||||
- como `home` vira caminho fisico no host;
|
||||
- isolamento entre apps por `app_id`;
|
||||
- regras de portabilidade entre hosts.
|
||||
|
||||
4. Semantica de leitura/escrita.
|
||||
Definir:
|
||||
- leitura total vs parcial;
|
||||
- overwrite vs append;
|
||||
- truncation;
|
||||
- criacao implicita;
|
||||
- escrita atomica por arquivo (quando aplicavel).
|
||||
|
||||
5. Quotas e capacidade.
|
||||
Definir:
|
||||
- se v1 tem quota por app;
|
||||
- comportamento para `storage full`;
|
||||
- exposicao de metrica de uso livre/ocupado.
|
||||
|
||||
6. Metadados e listagem.
|
||||
Definir:
|
||||
- campos minimos de `stat`;
|
||||
- shape canonico de `list_dir`;
|
||||
- timestamps (sim/nao e com qual garantia).
|
||||
|
||||
7. Fault/status do dominio.
|
||||
Fechar fronteira de:
|
||||
- `status` operacional;
|
||||
- `Trap` estrutural;
|
||||
- `Panic` interno.
|
||||
E obrigatorio fechar, por operacao, a matriz final de retorno e fault class.
|
||||
|
||||
## Responsabilidade Absorvida da Agenda 003
|
||||
|
||||
No perfil `app` (`home` sandbox), esta agenda passa a ser a fonte normativa para:
|
||||
|
||||
1. Catalogo de `status` de filesystem para app.
|
||||
Minimo esperado:
|
||||
- `OK`;
|
||||
- `NOT_FOUND`;
|
||||
- `PATH_INVALID`;
|
||||
- `ACCESS_DENIED`;
|
||||
- `NO_SPACE`;
|
||||
- `ALREADY_EXISTS`;
|
||||
- `UNAVAILABLE`.
|
||||
|
||||
2. Matriz por operacao (`read`, `write`, `exists`, `stat`, `list_dir`, `delete`, `mkdir`, `rename`).
|
||||
Para cada caso, classificar explicitamente:
|
||||
- `status`;
|
||||
- `Trap`;
|
||||
- `Panic`.
|
||||
|
||||
3. Shape de retorno por operacao.
|
||||
Definir, no minimo:
|
||||
- `status` como primeiro retorno;
|
||||
- `bytes_transferred` em `read`/`write` quando aplicavel;
|
||||
- payload de metadados/listagem com formato canonico.
|
||||
|
||||
4. Regra de escrita parcial.
|
||||
`write` nao pode reportar sucesso parcial silencioso.
|
||||
Quando a operacao nao puder ser concluida conforme contrato, deve retornar falha de dominio.
|
||||
|
||||
## Open Questions de Arquitetura
|
||||
|
||||
1. O v1 precisa de quota fixa por app ou apenas limites fisicos do host?
|
||||
2. `rename` entra no MVP ou pode ficar para fase seguinte?
|
||||
3. Qual conjunto minimo de metadados garante portabilidade real entre hosts?
|
||||
4. Qual grau de atomicidade e obrigatorio para escrita de arquivo no v1?
|
||||
5. Quais operacoes de FS devem consumir a async IO lane e quais permanecem
|
||||
sincrono-aparentes para a userland?
|
||||
|
||||
## Dependencias
|
||||
|
||||
- `../decisions/003-vm-owned-byte-transfer-protocol.md`
|
||||
- `../decisions/007-filesystem-fault-core-policy.md`
|
||||
- `../specs/13-cartridge.md`
|
||||
- `../specs/12-firmware-pos-and-prometeuhub.md`
|
||||
- `../specs/16a-syscall-policies.md`
|
||||
|
||||
## Fora de Escopo
|
||||
|
||||
- slots de memcard para `game` (fechado na `spec 08`);
|
||||
- acesso cross-app;
|
||||
- sync remoto/cloud;
|
||||
- DB embutido como contrato de plataforma.
|
||||
|
||||
## Criterio de Saida Desta Agenda
|
||||
|
||||
Pode virar PR quando houver decisao escrita sobre:
|
||||
|
||||
- surface minima de `fs` para `app` em `home`;
|
||||
- sandbox e isolamento por `app_id`;
|
||||
- semantica final de path/read/write/listagem;
|
||||
- matriz completa de fault/status para as operacoes do perfil `app`.
|
||||
@@ -1,208 +0,0 @@
|
||||
---
|
||||
id: AGD-0048
|
||||
ticket: background-service-audio-execution
|
||||
title: Agenda - Background Service and Audio Execution
|
||||
status: open
|
||||
created: 2026-07-05
|
||||
resolved:
|
||||
decision:
|
||||
tags: [runtime, os, lifecycle, service, audio, background, architecture]
|
||||
---
|
||||
|
||||
# Agenda - Background Service and Audio Execution
|
||||
|
||||
## Contexto
|
||||
|
||||
O runtime ja tem sinais claros de preparacao para multitarefa controlada:
|
||||
|
||||
- `TaskState::Background` existe como estado de tarefa;
|
||||
- `VmSession` separa estado mutavel de VM por tarefa/processo;
|
||||
- `SystemOS` e dono de lifecycle, task/process, VM sessions, filesystem,
|
||||
memcard, windows e logging;
|
||||
- a spec de eventos separa foreground ownership de execution eligibility;
|
||||
- o contrato atual declara que execucao real em background fica fora do v1, mas
|
||||
o modelo foi desenhado para permitir servicos ou processos de midia no futuro.
|
||||
|
||||
O caso motivador e:
|
||||
|
||||
```text
|
||||
Game foreground -> Home -> music player -> escolher musica -> voltar ao Game
|
||||
```
|
||||
|
||||
Depois disso, o Game deve voltar ao foreground enquanto o player continua
|
||||
executando e produzindo audio junto com audio do Game.
|
||||
|
||||
## Problema
|
||||
|
||||
Hoje o runtime preserva sessoes, mas nao tem contrato para uma sessao continuar
|
||||
executando quando nao e foreground.
|
||||
|
||||
Os pontos atuais que bloqueiam o caso:
|
||||
|
||||
- `TaskKind` so distingue `Game` e `Shell`;
|
||||
- `ProcessKind` so distingue `VmGame`, `VmShell` e `NativeShell`;
|
||||
- `ProcessState` nao possui estado normativo de background-running;
|
||||
- `GameRunningStep` ticka apenas o Game foreground;
|
||||
- `ShellRunningStep` ticka apenas o Shell foreground;
|
||||
- `HubHomeStep` nao ticka sessoes VM em background;
|
||||
- `Audio` e `AudioMixer` usam vozes globais sem namespace por tarefa/sessao;
|
||||
- cada logical frame chama `platform.audio_mut().clear_commands()`, o que torna
|
||||
perigoso tickar dois produtores de audio no mesmo frame;
|
||||
- pausa de lifecycle hoje emite `MasterPause`, afetando o mixer inteiro.
|
||||
|
||||
Sem uma decisao, background service pode virar apenas "tickar mais uma VM", mas
|
||||
isso quebraria isolamento, audio, debugger, lifecycle e previsibilidade.
|
||||
|
||||
## Pontos Criticos
|
||||
|
||||
1. **Execution eligibility nao e foreground.**
|
||||
O contrato atual ja separa os conceitos, mas a implementacao ainda so ticka o
|
||||
owner foreground. Precisamos introduzir uma politica explicita de quem pode
|
||||
executar em background.
|
||||
|
||||
2. **Servico nao e Shell escondido.**
|
||||
Um music player pode ter UI de Shell para escolher musica, mas a reproducao
|
||||
continua como servico quando a UI deixa o foreground. Fechar isso como
|
||||
`Shell` em background confundiria janela, tarefa, sessao e servico.
|
||||
|
||||
3. **Audio precisa de origem.**
|
||||
Hoje `voice_id` e global no mixer. Se Game e player usam `voice_id = 0`, um
|
||||
sobrescreve o outro. Precisamos decidir se o mixer tera namespaces por
|
||||
`AudioOwner`, se servicos terao pool dedicado, ou se o player nao usara a
|
||||
mesma superficie `audio.*`.
|
||||
|
||||
4. **Pausa de Game nao pode pausar servico de midia.**
|
||||
`MasterPause` global serve para o contrato atual de pausa/debug, mas nao
|
||||
expressa "pausar Game audio e manter music player". Pausa precisa virar
|
||||
escopo por origem ou politica de mixer.
|
||||
|
||||
5. **Servico precisa de lifecycle proprio.**
|
||||
Deve existir contrato para start, foreground UI, background-running, stop,
|
||||
crash, terminate, recurso negado, e talvez wake/resume de UI.
|
||||
|
||||
6. **Budget e determinismo precisam ser fechados.**
|
||||
Se servicos rodam junto com Game, precisamos decidir cota por frame, ordem de
|
||||
ticks, starvation, crash isolation, e se background service participa do
|
||||
mesmo tempo deterministico da maquina.
|
||||
|
||||
7. **Sistema de apps precisa descobrir e lancar o player.**
|
||||
Hoje Home lista Game cartridges e tem Shells nativos fixos. O caso de music
|
||||
player exige decidir se ele e cartridge `System`, app instalado, Shell nativo,
|
||||
ou novo perfil `Service`.
|
||||
|
||||
## Opcoes
|
||||
|
||||
### Opcao A - Background Service como novo tipo de processo/sessao
|
||||
|
||||
Criar contrato explicito para `Service`:
|
||||
|
||||
- `TaskKind::Service` ou entidade equivalente;
|
||||
- `ProcessKind::VmService` / `NativeService`;
|
||||
- execution eligibility independente de foreground;
|
||||
- UI de controle opcional via Shell task associada ao servico;
|
||||
- audio com origem por service/session;
|
||||
- lifecycle proprio: start, background, foreground-control, stop, crash.
|
||||
|
||||
**Pros:**
|
||||
- modela diretamente music player e futuros servicos;
|
||||
- preserva a separacao entre UI foreground e execucao;
|
||||
- evita transformar Shell em "processo que tambem e daemon";
|
||||
- facilita quotas, permissao e observabilidade.
|
||||
|
||||
**Contras:**
|
||||
- maior mudanca arquitetural;
|
||||
- exige novo contrato em specs, SystemOS, firmware, audio e testes;
|
||||
- precisa fechar politica de recursos antes de implementar.
|
||||
|
||||
**Manutencao:**
|
||||
- melhor base para crescer com qualidade, desde que o MVP seja pequeno.
|
||||
|
||||
### Opcao B - Shell em background com audio permitido
|
||||
|
||||
Permitir que uma VM Shell continue tickando quando sai do foreground e use audio
|
||||
normalmente.
|
||||
|
||||
**Pros:**
|
||||
- reaproveita Shell, WindowManager e VM session existentes;
|
||||
- menor numero de novos tipos no curto prazo.
|
||||
|
||||
**Contras:**
|
||||
- mistura UI e servico;
|
||||
- torna `TaskState::Background` semantico antes de definir `ProcessState`;
|
||||
- abre precedente para qualquer Shell continuar executando;
|
||||
- nao resolve sozinho namespace de audio, pause por origem, quotas e debugging.
|
||||
|
||||
**Manutencao:**
|
||||
- atraente como atalho, mas tende a espalhar excecoes pela firmware state
|
||||
machine.
|
||||
|
||||
### Opcao C - Audio player como servico nativo OS-owned, sem VM background
|
||||
|
||||
Implementar music player como servico nativo de SystemOS, controlado por uma
|
||||
Shell UI. A reproducao continua no host/OS sem tickar VM em background.
|
||||
|
||||
**Pros:**
|
||||
- entrega o caso de musica com menor risco para scheduler VM;
|
||||
- evita abrir execucao arbitraria de background agora;
|
||||
- audio service pode ser projetado como recurso OS-owned e depois exposto.
|
||||
|
||||
**Contras:**
|
||||
- nao resolve background VM services em geral;
|
||||
- player deixa de ser app userland completo no primeiro ciclo;
|
||||
- precisa ainda fechar origem/mixagem de audio e relacao com UI.
|
||||
|
||||
**Manutencao:**
|
||||
- bom MVP se o objetivo imediato for media playback, mas deve ser declarado como
|
||||
`media service` nativo, nao como contrato geral de background VM.
|
||||
|
||||
## Sugestao / Recomendacao
|
||||
|
||||
Recomendo fechar em duas camadas:
|
||||
|
||||
1. **Decisao de arquitetura:** introduzir o conceito de service/background
|
||||
execution como contrato de SystemOS, separado de foreground Shell e Game.
|
||||
Essa decisao deve definir execution eligibility, lifecycle, quotas, crash
|
||||
policy, controle de UI e relacao com VM sessions.
|
||||
|
||||
2. **MVP de media:** implementar primeiro um `media/audio service` com escopo
|
||||
reduzido, preferencialmente OS-owned ou `Service` bem delimitado, antes de
|
||||
permitir background VM arbitrario.
|
||||
|
||||
Para excelente qualidade, o primeiro plano nao deve tentar "qualquer app em
|
||||
background". O alvo deve ser: um unico servico de audio/midia, com origem de
|
||||
audio propria, controle por Hub/Shell, execucao enquanto Game esta foreground,
|
||||
e testes end-to-end de mistura e lifecycle.
|
||||
|
||||
## Perguntas em Aberto
|
||||
|
||||
- O music player deve ser um cartridge `System`, um novo `Service`, ou um
|
||||
servico nativo do OS controlado por Shell?
|
||||
- A UI do player e a reproducao pertencem a mesma tarefa ou a tarefas
|
||||
separadas?
|
||||
- Um servico pode ter janela foreground temporaria e continuar sem janela?
|
||||
- Quantos servicos background podem existir no MVP: um media service ou N
|
||||
servicos?
|
||||
- O background service recebe ticks todo frame, tick rate reduzido, ou apenas
|
||||
eventos?
|
||||
- O audio mixer deve isolar vozes por `TaskId`, `ProcessId`, `VmSessionId`,
|
||||
`AppId`, ou novo `AudioOwner`?
|
||||
- Como pausar apenas o audio do Game durante Home/debug sem pausar musica?
|
||||
- O debugger inspeciona foreground session apenas ou tambem sessoes background?
|
||||
- Como crash de servico e exibido: toast/log, janela de crash, ou parada
|
||||
silenciosa com diagnostico?
|
||||
- Que capacidades sao necessarias para media service: `audio`, `fs`, `asset`,
|
||||
talvez `background_audio`?
|
||||
|
||||
## Criterio para Encerrar
|
||||
|
||||
Esta agenda pode virar decisao quando houver resposta escrita para:
|
||||
|
||||
- modelo de entidade (`Service` novo vs Shell background vs native OS service);
|
||||
- execution eligibility e ordem de ticks;
|
||||
- lifecycle e estados de task/process;
|
||||
- ownership/namespace de audio e politica de pausa por origem;
|
||||
- relacao entre UI foreground do player e reproducao background;
|
||||
- escopo do MVP e explicitamente o que fica fora;
|
||||
- testes obrigatorios de lifecycle, audio mixing, crash isolation e regressao do
|
||||
contrato Game/Home/Shell existente.
|
||||
|
||||
@@ -1,138 +0,0 @@
|
||||
---
|
||||
id: AGD-0050
|
||||
ticket: portable-host-backend-strategy
|
||||
title: Portable Host Backend Strategy
|
||||
status: open
|
||||
created: 2026-07-14
|
||||
resolved:
|
||||
decision:
|
||||
tags: [host, desktop, portable, sdl, backend, rendering, input, audio, linux, android, handheld]
|
||||
---
|
||||
|
||||
## Contexto
|
||||
|
||||
O runtime ja tem uma fronteira de host relativamente clara: o host desktop atual vive em `crates/host/prometeu-host-desktop-winit`, usando `winit`, `pixels` e `cpal` para janela, apresentacao de framebuffer, input e audio.
|
||||
|
||||
A direcao desejada nao e substituir esse host de forma disruptiva no primeiro corte. A proposta e estudar e construir um segundo host portatil para servir como runtime host em handhelds e consoles portateis, especialmente hardwares chineses que rodam Linux internamente e, em alguns casos, Android customizado. O mesmo host tambem deve servir como base para uma futura versao DIY do hardware, desde que ela rode sobre um Linux base compatível. SDL e a hipotese principal, mas a agenda tambem deve avaliar outras familias de host/backend antes de virar decisao normativa.
|
||||
|
||||
Esse novo host deve conviver com o host atual durante estabilizacao, mas nao e descartavel: ele e candidato a se tornar o host principal quando provar paridade e estabilidade.
|
||||
|
||||
A troca deve ficar isolada no dominio de host: contratos de runtime, firmware, frame, input semantico e audio semantico nao devem mudar por causa da escolha de backend. Essa separacao e justamente o objetivo arquitetural que permite que um host portatil evolua para principal sem arrastar o runtime.
|
||||
|
||||
## Problema
|
||||
|
||||
Hoje a existencia de um unico host desktop torna dificil separar problemas do runtime de problemas do adaptador de plataforma. Um novo host portatil pode ajudar em testes, portabilidade, comparacao operacional e reducao de dependencia de uma pilha unica de janela/render/audio. O alvo "mobile" desta agenda nao significa telefone/tablet como produto primario; significa hardware portatil dedicado, geralmente com controles fisicos, framebuffer/display integrado, Linux customizado e distribuicao fora do modelo desktop tradicional. O alvo tambem inclui um possivel handheld DIY futuro, em que o valor esperado e ja existir um host pronto se o dispositivo expuser um Linux base suficiente.
|
||||
|
||||
O risco e tratar uma tecnologia especifica como resposta antes de comparar os requisitos reais de Linux handheld e Android. A agenda precisa cravar o modelo de host paralelo em estabilizacao, com destino de host principal, e entao escolher a familia de backend que melhor atende esse objetivo.
|
||||
|
||||
## Pontos Criticos
|
||||
|
||||
- A troca de host deve ser simples e local ao host, sem exigir mudancas em runtime, firmware, asset protocol, render packet, VM ou syscalls.
|
||||
- O novo host precisa consumir as mesmas saidas canonicas do runtime: frames RGBA8888, comandos semanticos de audio e eventos de input normalizados.
|
||||
- A estrategia deve preservar o host `winit` enquanto o novo host ainda nao provar equivalencia operacional, mas o novo host e candidato a virar o host principal depois dessa prova.
|
||||
- O alvo primario e portabilidade operacional para handhelds Linux e consoles portateis com controles fisicos; Android customizado e um alvo possivel que deve influenciar a escolha de API, packaging e input/audio.
|
||||
- O host portatil deve ser viavel em um futuro hardware DIY rodando Linux base, sem exigir um runtime especial ou fork de contratos.
|
||||
- Testes devem distinguir contrato comum de host de detalhes especificos de backend.
|
||||
- SDL2 pode ter ecossistema Rust mais estabelecido; SDL3 pode estar mais alinhado com a direcao upstream. A escolha da versao e uma pergunta separada da decisao de criar um segundo host.
|
||||
- A arquitetura deve evitar duplicar logica de runtime loop, pacing, debugger, stats e presentation policy quando essa logica for comum a qualquer host.
|
||||
- Outras familias de host tambem devem ser avaliadas: evoluir `winit`, SDL2/SDL3, backend Android nativo, ou uma camada multiplataforma alternativa.
|
||||
|
||||
## Opcoes
|
||||
|
||||
### Opcao A - Manter apenas o host winit atual
|
||||
|
||||
- **Abordagem:** continuar evoluindo `prometeu-host-desktop-winit` como unico host desktop.
|
||||
- **Pro:** menor custo imediato; evita nova dependencia nativa.
|
||||
- **Con:** mantem a pilha de plataforma unica como ponto de acoplamento pratico.
|
||||
- **Tradeoff:** bom para estabilidade curta, fraco para provar independencia real do host.
|
||||
|
||||
### Opcao B - Migrar diretamente do host winit para outro backend
|
||||
|
||||
- **Abordagem:** substituir o host desktop atual por um novo backend portatil assim que a escolha tecnologica for feita.
|
||||
- **Pro:** reduz a manutencao para um unico host depois da migracao.
|
||||
- **Con:** aumenta risco de regressao e mistura decisao de backend com mudanca operacional.
|
||||
- **Tradeoff:** so faz sentido depois de prova local de superioridade e paridade, o que ainda nao existe.
|
||||
|
||||
### Opcao C - Criar um host SDL paralelo com destino de principal
|
||||
|
||||
- **Abordagem:** adicionar um novo crate/binario de host SDL que implemente os mesmos contratos externos do host atual, mantendo `winit` como referencia e rollback ate haver evidencia de equivalencia.
|
||||
- **Pro:** permite teste A/B, reduz risco, valida se a fronteira de host esta realmente limpa, atende a meta de handheld Linux/Android customizado/DIY e preserva caminho para tornar SDL o host principal.
|
||||
- **Con:** aumenta temporariamente manutencao e exige fatorar partes comuns se houver duplicacao.
|
||||
- **Tradeoff:** melhor caminho para chegar a um host principal portatil sem reabrir runtime.
|
||||
|
||||
### Opcao D - Evoluir winit/pixels/cpal como host portatil
|
||||
|
||||
- **Abordagem:** manter a familia atual e investir em configuracao, input, fullscreen, packaging e compatibilidade de Linux handheld/Android/DIY dentro dela.
|
||||
- **Pro:** reaproveita o host existente e reduz dependencias nativas novas.
|
||||
- **Con:** pode nao resolver os problemas praticos de distribuicao, gamepad/device handling, fullscreen/scaling, Android customizado e ambientes handheld.
|
||||
- **Tradeoff:** forte se a pilha atual suportar bem os alvos; fraco se o problema real for portabilidade operacional.
|
||||
|
||||
### Opcao E - Host Android nativo separado
|
||||
|
||||
- **Abordagem:** tratar Linux handheld e Android como hosts diferentes: SDL ou winit para Linux; Android com camada nativa/propria quando o alvo amadurecer.
|
||||
- **Pro:** permite respeitar o ciclo de vida, packaging, input e audio do Android sem contaminar o host Linux.
|
||||
- **Con:** duplica mais superficie e adia a promessa de um host portatil unico.
|
||||
- **Tradeoff:** bom se Android tiver requisitos proprios demais; ruim se SDL conseguir cobrir Android bem o bastante.
|
||||
|
||||
### Opcao F - Camada multiplataforma alternativa
|
||||
|
||||
- **Abordagem:** avaliar alternativas como uma camada Rust-first ou game-framework-level para janela, input, audio e render.
|
||||
- **Pro:** pode reduzir FFI nativa e integrar melhor com Cargo.
|
||||
- **Con:** pode ser menos madura para Linux handheld/Android real, packaging e controles.
|
||||
- **Tradeoff:** deve ser considerada, mas precisa provar vantagem concreta sobre SDL para justificar risco.
|
||||
|
||||
## Sugestao / Recomendacao
|
||||
|
||||
Recomendacao inicial: manter a **Opcao C** como favorita, mas ampliar a fase de agenda para comparar SDL com as demais familias de host antes da decisao. O resultado desejado continua sendo um segundo host portatil, inicialmente paralelo, com destino explicito de se tornar o host principal quando atingir paridade e estabilidade.
|
||||
|
||||
O caminho recomendado e:
|
||||
|
||||
1. Definir o contrato minimo de equivalencia entre hosts: janela, framebuffer RGBA8888, input, audio, pacing, debugger/logs e encerramento.
|
||||
2. Identificar o que e comum ao host e o que e backend especifico.
|
||||
3. Comparar as familias candidatas contra esse contrato: SDL2, SDL3, winit atual evoluido, Android nativo separado e alternativas Rust-first.
|
||||
4. Implementar o candidato escolhido como novo crate/binario sem remover `prometeu-host-desktop-winit`.
|
||||
5. Permitir troca simples por binario/comando/feature, mantendo o runtime cego para a escolha.
|
||||
6. Tratar handheld Linux como alvo primario de produto para esse host; tratar Android customizado e DIY Linux como restricoes de desenho quando afetarem backend, packaging, input, audio ou boot/runtime integration.
|
||||
7. Promover o novo host a principal apenas depois de evidencia de estabilidade e paridade.
|
||||
|
||||
## Perguntas em Aberto
|
||||
|
||||
- [ ] A primeira implementacao SDL deve usar SDL2 ou SDL3?
|
||||
- [ ] SDL deve ser a familia escolhida, ou winit evoluido, Android nativo separado ou outra camada oferece melhor caminho?
|
||||
- [ ] A selecao do host deve ser por binario separado, feature Cargo, parametro CLI, ou combinacao desses mecanismos?
|
||||
- [ ] Qual e o menor conjunto de comportamento que define paridade aceitavel com o host winit?
|
||||
- [ ] Quais partes do host atual devem virar modulo comum antes do SDL, e quais devem ser duplicadas primeiro para evitar abstracao prematura?
|
||||
- [ ] O host SDL deve reutilizar `cpal` para audio inicialmente ou usar audio SDL desde o primeiro corte?
|
||||
- [ ] Quais familias de hardware handheld Linux devem ser usadas como referencia inicial?
|
||||
- [ ] Handheld Linux exige controles/gamepad, fullscreen, scaling, latency, sleep/resume, framebuffer/display mode ou packaging especificos desde o primeiro corte?
|
||||
- [ ] Qual e o "Linux base" minimo que um futuro hardware DIY precisaria expor para rodar o host portatil sem fork?
|
||||
- [ ] Android customizado deve ser criterio de escolha entre SDL2 e SDL3 agora, ou deve ficar como compatibilidade futura?
|
||||
- [ ] Como validar input e pacing de forma automatizada sem depender de janela real em CI?
|
||||
- [ ] O nome do crate deve ser `prometeu-host-desktop-sdl`, `prometeu-host-desktop-sdl2`, ou algo neutro a versao?
|
||||
|
||||
## Criterio para Encerrar
|
||||
|
||||
A agenda pode virar decision quando estiver claro:
|
||||
|
||||
- se o novo host sera paralelo em estabilizacao, com destino de host principal;
|
||||
- qual familia de backend sera alvo inicial;
|
||||
- se SDL for escolhido, qual versao SDL sera alvo inicial;
|
||||
- como a selecao/troca de host deve funcionar;
|
||||
- quais contratos sao comuns e proibidos de mudar;
|
||||
- quais requisitos minimos de handheld Linux e possivel Android customizado entram no primeiro plano;
|
||||
- qual contrato minimo de Linux base mantem aberta a opcao de hardware DIY;
|
||||
- qual evidencia minima prova paridade suficiente para iniciar planos de implementacao.
|
||||
|
||||
## Discussion
|
||||
|
||||
Ponto inicial aceito pelo usuario: a intencao e ter um segundo host para testes, com troca simples e facil, aproveitando o trabalho ja feito para isolar essa troca no host sem envolver runtime ou outros dominios.
|
||||
|
||||
Atualizacao de escopo: o novo host nao e descartavel. O objetivo e servir como runtime host para sistemas Linux rodando em consoles portateis e hardwares handheld chineses, e possivelmente Android customizado. Assim que estiver estavel, ele deve poder virar o host principal.
|
||||
|
||||
Atualizacao de escopo: outras familias de host/backend tambem devem viver nesta agenda. SDL segue como hipotese forte, mas a decisao deve comparar opcoes antes de cravar a tecnologia.
|
||||
|
||||
Clarificacao: "mobile" nesta agenda nao se refere primariamente a telefone/tablet. O foco sao dispositivos portateis dedicados com Linux interno ou Android customizado, geralmente com controles fisicos e ambiente de distribuicao proprio.
|
||||
|
||||
Clarificacao: a agenda tambem deve preservar a opcao de um futuro hardware DIY. A premissa desejada e que, se esse hardware expuser um Linux base suficiente, o runtime ja tenha um host portatil pronto para rodar nele.
|
||||
|
||||
## Resolution
|
||||
+1
-1
@@ -15,4 +15,4 @@ targets = ["aarch64-apple-darwin", "x86_64-apple-darwin"]
|
||||
unix-archive = ".zip"
|
||||
macos-universal-binaries = true
|
||||
[dist.hooks]
|
||||
pre-build = ["./scripts/pre-dist.sh"]
|
||||
pre-build = ["./scripts/gen-version.sh"]
|
||||
|
||||
@@ -75,7 +75,9 @@ palette, host presentation, or compatibility contract.
|
||||
|
||||
### Published owned frame
|
||||
|
||||
The canonical worker-published frame value is `OwnedRgba8888Frame`.
|
||||
The canonical published frame value is `OwnedRgba8888Frame`. It is produced by
|
||||
either the local synchronous consumer or the asynchronous render worker; the
|
||||
consumer path does not change the frame contract.
|
||||
|
||||
`OwnedRgba8888Frame` contains:
|
||||
|
||||
@@ -184,6 +186,13 @@ producer path MUST remain non-blocking with respect to worker rasterization and
|
||||
host present. A slow worker can cause replacement/drop telemetry, but it MUST
|
||||
NOT create an unbounded queue or stall VM logical frame production.
|
||||
|
||||
A local synchronous consumer consumes the same immutable `RenderSubmission`
|
||||
through the same render backend and publishes the same canonical
|
||||
`OwnedRgba8888Frame` before returning. It does not use the asynchronous
|
||||
single-slot handoff and therefore does not weaken or reinterpret the worker's
|
||||
non-blocking producer contract. A host may select this path when an explicit
|
||||
synchronous observation boundary is part of its host contract.
|
||||
|
||||
### 4.4 Frame pacing
|
||||
|
||||
Game logical frames are paced by the runtime frame scheduler, not by render
|
||||
|
||||
@@ -81,6 +81,27 @@ When the host activates instruction-level inspection, it may observe:
|
||||
- operand stack
|
||||
- call stack
|
||||
|
||||
### 3.3 Debugger and Headless Semantic Alignment
|
||||
|
||||
Interactive debugging and deterministic headless automation share runtime
|
||||
meanings even though their transports and pacing differ:
|
||||
|
||||
| Runtime meaning | Debugger command/observation | Headless operation |
|
||||
| --- | --- | --- |
|
||||
| Pause active VM execution | `pause` | `pause()` |
|
||||
| Resume active VM execution | `resume` | `resume()` |
|
||||
| Execute one VM instruction and remain paused | `step` | `step()` |
|
||||
| Complete one logical frame and remain paused | `stepFrame` | `advance_frame()` |
|
||||
| Read overlapping execution state | `getState` | `get_state()` |
|
||||
| Observe structured current fault | event/current state | `get_fault()` |
|
||||
| Inject normalized input | not defined by the debugger protocol | `set_input()` |
|
||||
| Reset the machine execution | not defined by the debugger protocol | `reset()` |
|
||||
| Capture the canonical published frame | not defined by the debugger protocol | `capture_frame()` |
|
||||
|
||||
The in-process headless API does not itself define or extend a wire protocol.
|
||||
The separate [headless automation protocol](11a-headless-automation-protocol.md)
|
||||
exposes that API over versioned JSONL/stdio without extending human DevTools.
|
||||
|
||||
## 4 State Inspection Boundary
|
||||
|
||||
Detailed state inspection is a host-owned concern. The runtime may expose deterministic machine state to host tooling, but this chapter does not define a general guest ABI for introspection convenience.
|
||||
|
||||
@@ -118,8 +118,8 @@ Hardware differences:
|
||||
The graphics system:
|
||||
|
||||
- produces typed logical render submissions that render to RGBA8888 output
|
||||
- may consume Game submissions through a render worker that publishes owned
|
||||
`OwnedRgba8888Frame` values
|
||||
- consumes Game submissions through either a local synchronous consumer or a
|
||||
render worker, both of which publish owned `OwnedRgba8888Frame` values
|
||||
- uses an indexed palette
|
||||
- does not depend on a specific GPU
|
||||
|
||||
@@ -128,8 +128,8 @@ The platform layer:
|
||||
- exposes typed service facades for render submission, render backend
|
||||
execution, Game 2D composition, input, audio, assets, and telemetry
|
||||
- consumes closed render submissions through a render-surface implementation
|
||||
- transports published RGBA8888 output or worker-published
|
||||
`OwnedRgba8888Frame` pixels into a host presentation surface without
|
||||
- transports published `OwnedRgba8888Frame` pixels into a host presentation
|
||||
surface without
|
||||
injecting host-owned debug overlay pixels
|
||||
- is the runtime-facing portability boundary; runtime and firmware code must not
|
||||
depend on a monolithic hardware bridge or on a concrete hardware aggregate
|
||||
@@ -216,3 +216,80 @@ PROMETEU promises:
|
||||
|
||||
- **identical logical behavior**
|
||||
- **reproducible technical decisions**
|
||||
|
||||
## 13 Deterministic Headless Control
|
||||
|
||||
The external tooling boundary is specified separately in
|
||||
[Headless Automation Protocol v1](11a-headless-automation-protocol.md). It preserves
|
||||
the in-process semantics in this section and does not extend the guest ABI.
|
||||
|
||||
The headless host is a separate, generic Prometeu host for in-process
|
||||
automation. It runs the same directory cartridge, firmware, active VM session,
|
||||
capability checks, normalized input, render submissions, and fault model as an
|
||||
interactive host. A cartridge cannot detect or request headless execution, and
|
||||
headless execution grants no additional guest capability.
|
||||
|
||||
The headless host requires no native window, display server, physical input,
|
||||
physical audio device, or realtime frame pacing. It uses the explicit local
|
||||
synchronous Game render consumer. A successful logical-frame advance returns
|
||||
only after the exact canonical `OwnedRgba8888Frame` for that advance has been
|
||||
published. It does not start or wait for an asynchronous render worker, and
|
||||
publication correctness does not use spinning, yielding, sleeping, or a
|
||||
wall-clock timeout.
|
||||
|
||||
### 13.1 Control contract
|
||||
|
||||
- `boot(path)` loads a normal directory cartridge and stops on entry to
|
||||
`GameRunning`, before the first game instruction. A second boot attempt
|
||||
requires `reset()` and otherwise returns `AlreadyBooted`.
|
||||
- `reset()` enters the normal firmware reset boundary and clears input, active
|
||||
sessions, structured faults, and headless frame correlation. Capture is
|
||||
unavailable until the new run completes a frame.
|
||||
- `pause()` and `resume()` control the active VM session. `step()` executes one
|
||||
VM instruction and finishes paused without reporting a completed logical
|
||||
frame.
|
||||
- `set_input()` retains one complete `InputSignals` snapshot, including the
|
||||
digital pad and touch signal/coordinates. `clear_input()` restores its
|
||||
default. The normal begin-frame input sampling defined by the input
|
||||
peripheral derives `pressed`, `released`, `down`, and `hold` state.
|
||||
- `advance_frame()` advances internal firmware ticks until exactly one logical
|
||||
frame closes through `FrameSync` or `EndOfRom`, or until a structured fault or
|
||||
lifecycle termination prevents completion. Internal cycle-slice exhaustion
|
||||
continues the same frame; it is not itself a frame boundary.
|
||||
- `advance_frames(n)` is repeated `advance_frame()`. It reports the requested
|
||||
and completed counts plus completed-all, fault, or termination. Zero is a
|
||||
no-op; fault or termination preserves partial completed progress.
|
||||
- A frame advance finishes paused and clears its host-owned debug-step request,
|
||||
including when lifecycle termination interrupts the advance. Guest faults
|
||||
are outcomes represented by `CrashReport`; host precondition and publication
|
||||
failures are host errors. A deterministic headless-host watchdog also bounds
|
||||
the number of firmware ticks spent advancing one logical frame. Its limit is
|
||||
tooling policy, not a guest cycle budget, runtime fault, or wall-clock
|
||||
performance requirement.
|
||||
- `capture_frame()` returns an owned clone of the canonical frame paired with
|
||||
the latest successful advance. The explicit `{logical_frame_index, FrameId}`
|
||||
pair is authoritative; no numeric equality or fixed offset is implied.
|
||||
- `get_state()` classifies execution as running, paused, terminated, or faulted
|
||||
and exposes the overlapping debugger state. `get_fault()` returns structured
|
||||
`CrashReport` data rather than requiring log or summary parsing.
|
||||
- Valid audio commands pass through normal runtime semantics. The headless host
|
||||
drains them into a null/discard sink; it does not synthesize PCM or require an
|
||||
output device.
|
||||
|
||||
### 13.2 Deterministic oracle
|
||||
|
||||
Deterministic comparison includes the logical-frame index and paired `FrameId`,
|
||||
canonical framebuffer pixels (or a stable pixel hash) and dimensions/stride,
|
||||
guest-visible PC/stack/app state, structured execution status and fault data,
|
||||
and deterministic counters describing simulated execution.
|
||||
|
||||
The oracle excludes wall-clock or boot-time timestamps, real elapsed duration,
|
||||
host CPU time, thread-scheduling measurements, presentation cadence,
|
||||
render-worker timing telemetry, and host-owned identities without simulated
|
||||
machine meaning. The same cartridge, initial machine state, and per-frame input
|
||||
timeline must produce the same included observations on independent runs and
|
||||
after reset.
|
||||
|
||||
AI tooling may consume this generic host API from outside the machine. It does
|
||||
not create an AI mode, testing mode, replay protocol, gameplay introspection
|
||||
surface, or guest capability.
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
# Headless Automation Protocol v1
|
||||
|
||||
**Domain:** runtime host tooling. **Function:** normative.
|
||||
|
||||
This chapter implements Studio DSC-0068 / DEC-0060 baseline v1, runtime phase
|
||||
of PLN-0139. The host owns this wire contract. It does not change guest ABI,
|
||||
firmware, VM, frame/input semantics or the desktop DevTools protocol.
|
||||
|
||||
## Process and transport
|
||||
|
||||
`prometeu headless --stdio` starts the distributed `prometeu-headless` tool from
|
||||
the same installation. One process owns one HeadlessHost. No display, native
|
||||
audio, network service or realtime pacing is required. A client must use its
|
||||
configured installation; missing binaries/capabilities are explicit failures.
|
||||
|
||||
Transport is UTF-8 JSON objects separated by LF (CRLF is accepted). stdout is
|
||||
protocol-only; diagnostics go to stderr. Fragmented reads must be accumulated;
|
||||
allocation is bounded by the command limit. An oversized line is rejected and
|
||||
drained through LF before reading the next request. EOF with an incomplete line
|
||||
reports `invalid_request`, then closes the session. EOF always requests shutdown.
|
||||
|
||||
All sizes exclude the LF delimiter and include the complete JSON envelope and
|
||||
base64 payload. Responses exceeding their bound become `response_too_large`,
|
||||
never truncated data. Clients must continuously consume stdout, including events.
|
||||
Backpressure may block output; the supervising client owns wall-clock deadlines
|
||||
and may terminate the process tree. There is no transport replay or durable queue.
|
||||
|
||||
## Handshake and compatibility
|
||||
|
||||
The server first emits a `hello` object with `sessionId`, `protocolVersion`
|
||||
(`major: 1, minor: 0`), real `runtimeVersion`, `capabilities` and `limits`.
|
||||
Session identity is opaque and process-local, excluded from deterministic oracles.
|
||||
|
||||
Before work, the client sends `initialize` with `protocolVersion` and an array
|
||||
`requiredCapabilities`. An incompatible major returns `incompatible_version`;
|
||||
missing capabilities return `unsupported_capability`. The session remains
|
||||
uninitialized and cannot execute work. Compatible minor additions are permitted;
|
||||
the initialize result returns the lesser supported minor. Initialize is accepted
|
||||
once; repeated initialization returns `already_initialized`. Shutdown is permitted
|
||||
even before initialization. All other work requires successful initialization.
|
||||
|
||||
## Envelopes
|
||||
|
||||
```json
|
||||
{"requestId":"a1","command":"advance","params":{"frames":60}}
|
||||
```
|
||||
|
||||
`requestId` is a nonempty string of at most 128 UTF-8 bytes, selected by the
|
||||
client; concurrent requests must have distinct identities. `command` and `params`
|
||||
are required. Unknown fields and invalid parameter types are rejected. The
|
||||
request schema is distributed in `devtools/headless-protocol/request.schema.json`;
|
||||
`response.schema.json` defines hello, progress and every response/result shape.
|
||||
Valid and invalid request fixtures are shipped beside the schemas. Process tests
|
||||
validate actual server output against the response schema (including image results).
|
||||
|
||||
```json
|
||||
{"type":"response","sessionId":"opaque","requestId":"a1","result":{"requested":60,"completed":60,"stop":"completed"}}
|
||||
{"type":"response","sessionId":"opaque","requestId":"a1","error":{"code":"busy","message":"...","details":{}}}
|
||||
```
|
||||
|
||||
A response contains exactly one of result/error. Errors have stable `code`,
|
||||
human-readable `message` and structured `details`. Unparseable/unusable request
|
||||
identity is represented by null; valid identity is preserved on parameter errors.
|
||||
Malformed JSON, invalid schema and unknown commands must never disappear silently.
|
||||
Wire requestId is correlation, not deduplication: the client must not retry an
|
||||
advance blindly after a lost response. Studio task-level clientRequestId and
|
||||
operationId are a separate boundary, not part of this wire protocol.
|
||||
|
||||
## Commands
|
||||
|
||||
| Command | Parameters | Result/meaning |
|
||||
| --- | --- | --- |
|
||||
| initialize | protocolVersion, requiredCapabilities | negotiated version and capabilities |
|
||||
| boot | path (nonempty directory-cartridge path) | current state; existing boot preconditions apply |
|
||||
| reset | empty object | reset state, clears input/fault/frame correlation |
|
||||
| set_input | complete snapshot fields listed below; omitted fields reset to defaults | input replaced, not patched |
|
||||
| clear_input | empty object | input restored to defaults |
|
||||
| advance | frames: unsigned integer, including zero | requested, completed, stop, optional fault/error details |
|
||||
| capture | empty object | PNG/base64 plus canonical frame metadata |
|
||||
| get_state | empty object | pc, stackTop, logicalFrameIndex, tickIndex, appId, status |
|
||||
| get_fault | empty object | fault object or null |
|
||||
| cancel | targetRequestId | acknowledgement that cancellation was requested for that active advance |
|
||||
| shutdown | empty object | acknowledgement after the active operation stops and host is dropped |
|
||||
|
||||
Input snapshot fields are `up`, `down`, `left`, `right`, `a`, `b`, `x`, `y`, `l`,
|
||||
`r`, `start`, `select`, `touch` (booleans), and `touchX`, `touchY` (signed i32).
|
||||
Omitted booleans are false and omitted coordinates are zero. The ordinary runtime
|
||||
begin-frame sampling derives press/release/hold edges. No new input semantics exist.
|
||||
|
||||
State statuses are `running`, `paused`, `terminated`, `faulted`; `running` does
|
||||
not mean background execution. Stack values preserve their type through tagged
|
||||
`kind`/`value` objects; i64 values are decimal strings and float values carry an
|
||||
exact round-trippable string (including non-finite values). Faults expose kind,
|
||||
pc, summary and structural trap code/opcode/message/source span or init-error code.
|
||||
No client must parse a summary to distinguish trap, panic or initialization failure.
|
||||
|
||||
## Ordering, cancellation and lifecycle
|
||||
|
||||
Only one host operation is admitted at a time. Conflicting work, including state
|
||||
inspection while the host is executing, returns `busy`; it is not implicitly
|
||||
queued. The command reader remains available for cancel/shutdown while an advance
|
||||
executes. Cancellation targets an active advance's requestId; no active matching
|
||||
advance returns `not_cancelable`. An acknowledgement is not a completed cancellation.
|
||||
|
||||
Advancement is repeated `advance_frame()`, checking cancellation between frames.
|
||||
The current frame keeps the existing deterministic host-tick watchdog. Zero frames
|
||||
is a no-op. Results preserve requested/completed counts and `stop` values:
|
||||
`completed`, `faulted`, `terminated`, `canceled`, `host_error`.
|
||||
Guest faults are outcomes, not malformed-request errors. Host errors include a
|
||||
stable code and known completed progress; they do not manufacture guest faults.
|
||||
|
||||
Each completed frame emits `type: progress`, requestId, sessionId, requested and
|
||||
completed counts before the terminal response. A client can retain known progress
|
||||
if the process dies. The final response is authoritative when delivered.
|
||||
|
||||
Shutdown/EOF requests cancellation, waits for the active work to reach its boundary,
|
||||
drops the host and exits; explicit shutdown receives its response after cleanup.
|
||||
Disconnect never starts/resumes execution. A failed process requires a new explicit
|
||||
session, not replay. Host session loss does not implicitly release Studio authority.
|
||||
|
||||
## Capture
|
||||
|
||||
Capture returns `mimeType: image/png`, `encoding: base64`, `data`, `width`, `height`,
|
||||
`stridePixels`, `pixelFormat: RGBA8888`, `logicalFrameIndex` and `frameId`.
|
||||
The envelope carries sessionId; the Studio consumer adds build correlation.
|
||||
Frame identities/counters on this wire are unsigned JSON integers and must be
|
||||
decoded losslessly. logicalFrameIndex and frameId have no numeric equality rule.
|
||||
|
||||
PNG stores visible RGBA channels in row order, losslessly, without stride padding.
|
||||
stridePixels describes the original canonical buffer. Before a completed frame,
|
||||
including after reset, capture returns `no_frame_available`; it cannot reuse an
|
||||
old run. No desktop screenshot, hash-only substitute, temporary-image-file transport
|
||||
or continuous video is permitted.
|
||||
|
||||
## Configurable limits and supervision
|
||||
|
||||
| CLI option / handshake field | Default |
|
||||
| --- | --- |
|
||||
| --max-frames / maxFrames | 600 |
|
||||
| --max-command-bytes / maxCommandBytes | 65536 |
|
||||
| --max-response-bytes / maxResponseBytes | 33554432 |
|
||||
| --handshake-timeout-ms / handshakeTimeoutMs | 5000 |
|
||||
| --call-timeout-ms / callTimeoutMs | 60000 |
|
||||
| --shutdown-timeout-ms / shutdownTimeoutMs | 5000 |
|
||||
|
||||
Limits must be positive; message bounds must be at least 4096 bytes to admit the
|
||||
handshake and bounded errors. Limits apply to serialized bytes, not characters.
|
||||
Clients must enforce the advertised handshake/call deadlines and 5-second default
|
||||
cancel/shutdown grace, then terminate only the process tree they own. Deadlines are
|
||||
host supervision, not simulated guest time. Runtime enforces frame/message bounds
|
||||
without clamping. Requests over limits fail explicitly. Clients configure startup
|
||||
timeouts before seeing the handshake, then verify the announced values.
|
||||
|
||||
## Conformance
|
||||
|
||||
The runtime gate includes fragmented/invalid/oversized lines, negotiation failures,
|
||||
all commands, busy/cancel/shutdown races, EOF, real CLI distribution invocation,
|
||||
PNG pixel equality, independent logical/render identity, repeat/reset determinism,
|
||||
structured faults, progress on partial failure and retained desktop run/debug.
|
||||
Neither Studio UI nor an AI model is required. See `tests/automation_process.rs`
|
||||
in prometeu-cli and the in-process deterministic-control tests in the headless crate.
|
||||
@@ -90,6 +90,7 @@ In the current state, no chapter under the active `docs/runtime/specs/` root is
|
||||
| [`09a-coroutines-and-cooperative-scheduling.md`](09a-coroutines-and-cooperative-scheduling.md) | VM coroutine model | normative |
|
||||
| [`10-debug-inspection-and-profiling.md`](10-debug-inspection-and-profiling.md) | machine diagnostics | normative |
|
||||
| [`11-portability-and-cross-platform-execution.md`](11-portability-and-cross-platform-execution.md) | portability contract | normative |
|
||||
| [`11a-headless-automation-protocol.md`](11a-headless-automation-protocol.md) | external headless host automation | normative |
|
||||
| [`12-firmware-pos-and-prometeuhub.md`](12-firmware-pos-and-prometeuhub.md) | firmware and system orchestration | normative |
|
||||
| [`13-cartridge.md`](13-cartridge.md) | cartridge package | normative |
|
||||
| [`14-boot-profiles.md`](14-boot-profiles.md) | firmware boot flow | normative |
|
||||
|
||||
@@ -50,6 +50,12 @@
|
||||
"paths": [
|
||||
"crates/host/prometeu-host-desktop-winit/src/"
|
||||
]
|
||||
},
|
||||
"host/headless": {
|
||||
"baseline_percent": 80,
|
||||
"paths": [
|
||||
"crates/host/prometeu-host-headless/src/"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+13
-8
@@ -1,30 +1,35 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -euo pipefail
|
||||
|
||||
# Resolve inputs from this checkout, independently of the caller's cwd.
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# Generate version
|
||||
./scripts/gen-version.sh
|
||||
|
||||
# Prepare staging for SDK extra files
|
||||
echo "Preparing dist-staging..."
|
||||
rm -rf dist-staging/devtools/debugger-protocol
|
||||
|
||||
mkdir -p dist-staging/devtools/debugger-protocol
|
||||
mkdir -p dist-staging/devtools/headless-protocol dist-staging/docs/runtime
|
||||
|
||||
cp devtools/debugger-protocol/protocol.json dist-staging/devtools/debugger-protocol/
|
||||
|
||||
cp VERSION.txt dist-staging/devtools/debugger-protocol/VERSION.txt
|
||||
cp devtools/headless-protocol/*.json dist-staging/devtools/headless-protocol/
|
||||
cp VERSION.txt dist-staging/devtools/headless-protocol/VERSION.txt
|
||||
cp docs/specs/runtime/11a-headless-automation-protocol.md dist-staging/docs/runtime/
|
||||
|
||||
# Clean and prepare the version-specific directory
|
||||
echo "Cleaning dist-staging/stable..."
|
||||
echo "Preparing dist-staging/stable (existing archives are retained)..."
|
||||
mkdir -p "dist-staging/stable"
|
||||
rm -rf "dist-staging/stable/*"
|
||||
|
||||
# Build stable using cargo build
|
||||
dist build
|
||||
dist build "$@"
|
||||
|
||||
echo "Copying target/distrib content to dist-staging/stable..."
|
||||
if [ -d "target/distrib" ] && [ "$(ls -A target/distrib)" ]; then
|
||||
cp -r target/distrib/* "dist-staging/stable/"
|
||||
else
|
||||
echo "Warning: target/dist directory not found or empty."
|
||||
fi
|
||||
echo "Error: target/distrib directory not found or empty." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user