From e8caf2a57e6b698ea66516cdc407b7a87a42301e Mon Sep 17 00:00:00 2001
From: th-kim0823
Date: Sat, 9 May 2026 14:58:49 +0900
Subject: [PATCH] feat(wire): answer_event.v1 schema (fb-33)
Discriminated ndjson event for `kebab ask --stream`. Mirrors
the ingest_progress.v1 pattern (stderr stream + stdout final
answer.v1 for backwards compat).
Co-Authored-By: Claude Opus 4.7 (1M context)
---
docs/wire-schema/v1/answer_event.schema.json | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
create mode 100644 docs/wire-schema/v1/answer_event.schema.json
diff --git a/docs/wire-schema/v1/answer_event.schema.json b/docs/wire-schema/v1/answer_event.schema.json
new file mode 100644
index 0000000..80a46f9
--- /dev/null
+++ b/docs/wire-schema/v1/answer_event.schema.json
@@ -0,0 +1,17 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://kb.local/wire/v1/answer_event.schema.json",
+ "title": "AnswerEvent v1",
+ "description": "Streaming event emitted by `kebab ask --stream`. One event per line on stderr (ndjson). Discriminated by `kind`. Terminal: `final`. Final stdout line is `answer.v1` for backwards compat (see ingest_progress.v1 precedent).",
+ "type": "object",
+ "required": ["schema_version", "kind", "ts"],
+ "properties": {
+ "schema_version": { "const": "answer_event.v1" },
+ "kind": { "enum": ["retrieval_done", "token", "final"] },
+ "ts": { "type": "string", "format": "date-time" },
+ "hits": { "type": "array", "description": "retrieval_done: search_hit.v1[]" },
+ "delta": { "type": "string", "description": "token: incremental string chunk" },
+ "turn_index": { "type": ["integer", "null"], "minimum": 0, "description": "token: matches Answer.turn_index" },
+ "answer": { "type": "object", "description": "final: complete answer.v1 payload" }
+ }
+}