open-standards/jouleclaw/jouleclaw-rs/crates/jouleclaw-jcr1/conformance/stream-window-vectors.json
Transaction Science e3ed89cd95 jouleclaw: wave-47 — streaming-cascade substrate
Today's research confirmed streaming / continuous-interaction is the
2026 load-bearing AI shape: Thinking Machines shipped Interaction
Models (May 11, 2026) with parallel continuous streams + 200ms
micro-turns + 0.40s response latency; the τ-Voice ICASSP-2026
benchmark canonical-quantizes at 200ms ticks; production voice
agents (OpenAI gpt-realtime, Google gemini-live, xAI grok-voice)
all converge on <150ms barge-in. Today's JouleClaw cascade assumes
request → walk-tiers → answer; that shape doesn't fit.

This wave is the substrate for the streaming shape, typed up so any
downstream model / network / codec slots in without rewriting.

1. jouleclaw-stream (new crate) — pure types.
   - Tick { window_id, channel_id, kind: TickKind { Audio | Text |
     Video | Marker { TickMarker { Start | End | BargeIn | Silence
     | EndOfTurn | Custom } } }, bytes, ts_ns }
   - StreamSpec { tick_window_ms, max_chunk_bytes, max_ticks_per_
     window, channels: Vec<ChannelSpec { id, direction, kind_tag,
     mime }> } + duplex_voice_default()
   - StreamWindow with push validation + has_barge_in + content_hash
   - RollingConservationLedger: streaming analog of the per-request
     DeterministicVerifier. Tracks inbound + outbound + substrate
     bytes per window over a rolling buffer; surfaces a
     WindowConservationFinding { Conforming | Hallucination |
     BargeInIgnored } per tick. BargeInIgnored is the load-bearing
     check: if a barge-in fires and the cascade is still emitting
     outbound past the deadline, the ledger flags it on the spot.
   - DEFAULT_TICK_WINDOW_MS = 200; BARGE_IN_DEADLINE_MS = 150 —
     both lifted from production voice-agent guidance.
   - 16 tests.

2. jouleclaw-stream-oracle (new crate) — gate-per-window Oracle.
   - StreamOracle trait + WindowVerdict { Pass | Fail | Yield |
     NeedMore }. Yield is the load-bearing new variant — the
     cascade MUST stop emitting outbound within
     BARGE_IN_DEADLINE_MS. NeedMore lets the Oracle defer commitment
     across windows.
   - Reference backends: AlwaysPassStream, BargeInDetector,
     PerTickAdapter<O: Oracle> (lifts the per-request Oracle into
     the streaming surface so the existing fuzz + future Lean
     backends compose).
   - CompositeStreamOracle: unlike the per-request CompositeOracle
     that short-circuits on first Fail, the streaming composite
     ALWAYS runs every backend and combines by dominance rank
     (Fail > Yield > NeedMore > Pass). A window can carry a
     barge-in AND a content failure; both signals matter.
   - 10 tests.

3. jouleclaw-jcr1 — stream-window/1 schema.
   - StreamWindowReceipt: jc_receipt + id + closed_at + steward +
     stream_id + window_id + window_hash (BLAKE3 of canonical
     StreamWindow JSON) + tick_count + inbound/outbound bytes +
     joules_uj + energy_provenance + WindowVerdictWire +
     WindowConservationWire.
   - Canonical JSON with sorted keys + content-addressed via
     BLAKE3, ready for COSE_Sign1 over the canonical bytes via the
     existing v1 signing path.
   - 3 conformance vectors (Pass / Yield / Hallucination) with
     embedded content_hash the Rust verifier asserts byte-equal at
     test time. Other-language verifiers must round-trip under
     canonical encoding and match the hash.
   - 4 stream_window tests on top of the existing jcr1 surface.

4. Demo binary — examples/wave47_streaming_pipeline.rs in
   jouleclaw-stack. Simulates a duplex-voice stream over 13 windows
   (~2.6 s at 200 ms each). Builds a CompositeStreamOracle (always-
   pass + barge-in detector + per-tick adapter wrapping a per-
   request Oracle), runs each window through the oracle + the
   conservation ledger, mints a stream-window/1 receipt per window.
   The yield correctly fires on the barge-in window; hallucinations
   flag when outbound bursts past the rolling budget.

The triangle is the type system; wave-46 filled per-request backend
slots; wave-47 extends the same triangle to streaming windows
without rewriting the triangle itself. Stream Oracles compose with
per-request Oracles via PerTickAdapter; the rolling conservation
ledger surfaces the streaming analog of the same Conforming /
Hallucination findings the per-request verifier emits; the JCR-1
receipt schema mirrors v1's wire shape so existing infrastructure
consumes it without surgery.

Workspace check clean.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
2026-06-05 04:12:16 -04:00

88 lines
3.3 KiB
JSON

{
"spec": "JCR-1 stream-window v1",
"schema_id": "stream-window/1",
"canonical_encoding": "JSON with sorted object keys (recursively); UTF-8; no whitespace; no float coercion. content_hash is BLAKE3 hex of the canonical bytes.",
"note": "Three vectors covering the load-bearing per-window verdicts a streaming cascade must mint receipts for: a clean Pass, a barge-in Yield, and a Hallucination flagged by the rolling conservation ledger. Implementers in any language MUST round-trip every receipt under canonical encoding and assert byte-equal content_hash against the embedded value.",
"vector_count": 3,
"vectors": [
{
"n": 1,
"description": "Pass — clean window, conservation conforming, Estimator joules.",
"content_hash": "ee359043b4fc4a4b25b7cd5f47c631f0c675a478e3b4c3883bc908fb00948615",
"receipt": {
"jc_receipt": "stream-window/1",
"id": "stream-demo:0001",
"closed_at": "2026-06-05T00:00:00Z",
"steward": "did:keri:EJ9testStewardAID000000000000000",
"stream_id": "stream-demo",
"window_id": 1,
"window_hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"tick_count": 4,
"inbound_bytes": 6400,
"outbound_bytes": 4800,
"joules_uj": 350,
"energy_provenance": "Estimator",
"verdict": {
"kind": "pass",
"chain": ["always-pass-stream"]
},
"conservation": {
"kind": "conforming"
}
}
},
{
"n": 2,
"description": "Yield — barge-in fired in window 7; the cascade must stop emitting outbound within 150 ms.",
"content_hash": "c88dffbb8a0dc0eb492adb2089fe24931f9490fdc4696bc0e53c5510be6837d7",
"receipt": {
"jc_receipt": "stream-window/1",
"id": "stream-demo:0007",
"closed_at": "2026-06-05T00:00:01Z",
"steward": "did:keri:EJ9testStewardAID000000000000000",
"stream_id": "stream-demo",
"window_id": 7,
"window_hash": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"tick_count": 5,
"inbound_bytes": 6400,
"outbound_bytes": 1200,
"joules_uj": 120,
"energy_provenance": "Estimator",
"verdict": {
"kind": "yield",
"seen_at": 7
},
"conservation": {
"kind": "conforming"
}
}
},
{
"n": 3,
"description": "Hallucination — outbound exceeded the rolling inbound + substrate budget by 2048 bytes.",
"content_hash": "0c7f6a530f1216514b8ac5fcb799497c1ebee6cd0b444d5c975a9d02277ebb74",
"receipt": {
"jc_receipt": "stream-window/1",
"id": "stream-demo:0012",
"closed_at": "2026-06-05T00:00:02Z",
"steward": "did:keri:EJ9testStewardAID000000000000000",
"stream_id": "stream-demo",
"window_id": 12,
"window_hash": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
"tick_count": 3,
"inbound_bytes": 1024,
"outbound_bytes": 6144,
"joules_uj": 980,
"energy_provenance": "HwShunt",
"verdict": {
"kind": "pass",
"chain": ["always-pass-stream"]
},
"conservation": {
"kind": "hallucination",
"unaccounted": 2048
}
}
}
]
}