From c48d8ac7160c3cdcf32ed4e488807d3daeb8d457 Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Fri, 5 Jun 2026 13:07:23 +0900 Subject: feat(observability): Phase A logging substrate — Logger/Span ABI + journal sink (250 tests) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Structured, agent-first logging captured durably to an append-only journal file. Kernel (contracts/logging.ts): leveled/attributed Logger + Span, auto-scoped per extension (host stamps manifest.id, unspoofable), incremental span records (open/close) for crash-reconstructable traces, injected LogSink (pure record-builder). ctx.log on ToolContract; runTurn opens turn/step/tool-call spans and captures the verbatim pre-mutation prompt (the 'before') on the step span. journal-sink (new package, bootstrap dep — not an extension): LogSink appending NDJSON to a rotating journal; pure serialize + thin fs edge; fail-safe drop, never blocks a turn. host-bin injects it via HostDeps; session-orchestrator threads host.logger (childed per turn) into runTurn. Redaction is per-extension self-redaction (no shared helper — isolation over DRY). The out-of-process collector + SQLite store + the verbatim 'after' provider.request capture are Phase B / next (notes/observability-design.md §10/§11). Verified: tsc -b clean, 250 tests (218→+32), biome clean. Live boot: a turn's journal holds host logs + turn/step spans (open+close) + the prompt:before record with the verbatim messages array. Harness: ORCHESTRATOR §3 rule-scoping map; .dispatch/rules/isolation-over-dry.md; notes/observability-design.md (design D1–D10 + Phase A/B plan). --- bun.lock | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'bun.lock') diff --git a/bun.lock b/bun.lock index 0c5b609..d5446fe 100644 --- a/bun.lock +++ b/bun.lock @@ -31,6 +31,7 @@ "dependencies": { "@dispatch/auth-apikey": "workspace:*", "@dispatch/conversation-store": "workspace:*", + "@dispatch/journal-sink": "workspace:*", "@dispatch/kernel": "workspace:*", "@dispatch/provider-openai-compat": "workspace:*", "@dispatch/session-orchestrator": "workspace:*", @@ -39,6 +40,13 @@ "@dispatch/transport-http": "workspace:*", }, }, + "packages/journal-sink": { + "name": "@dispatch/journal-sink", + "version": "0.0.0", + "dependencies": { + "@dispatch/kernel": "workspace:*", + }, + }, "packages/kernel": { "name": "@dispatch/kernel", "version": "0.0.0", @@ -107,6 +115,8 @@ "@dispatch/host-bin": ["@dispatch/host-bin@workspace:packages/host-bin"], + "@dispatch/journal-sink": ["@dispatch/journal-sink@workspace:packages/journal-sink"], + "@dispatch/kernel": ["@dispatch/kernel@workspace:packages/kernel"], "@dispatch/provider-openai-compat": ["@dispatch/provider-openai-compat@workspace:packages/provider-openai-compat"], -- cgit v1.2.3