From f25ad317417e596d6025d50922d9b4cbadb51362 Mon Sep 17 00:00:00 2001 From: th-kim0823 Date: Sat, 9 May 2026 18:00:58 +0900 Subject: [PATCH] feat(wire): search_response.v1 schema (fb-34) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wrapper around search_hit.v1[] with next_cursor + truncated. Wire breaking — agent that parses bare array must adapt. Co-Authored-By: Claude Opus 4.7 (1M context) --- docs/wire-schema/v1/search_response.schema.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 docs/wire-schema/v1/search_response.schema.json diff --git a/docs/wire-schema/v1/search_response.schema.json b/docs/wire-schema/v1/search_response.schema.json new file mode 100644 index 0000000..156a218 --- /dev/null +++ b/docs/wire-schema/v1/search_response.schema.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://kb.local/wire/v1/search_response.schema.json", + "title": "SearchResponse v1", + "description": "Top-level wrapper for `kebab search --json` output. Replaces the bare `search_hit.v1[]` array — wraps it with pagination + truncation metadata. Token counts are approximate (chars/4 estimate, no tokenizer dep). On `truncated: true`, caller may either widen `--max-tokens` or follow `next_cursor` for the next page. Stale `next_cursor` (corpus_revision changed since issued) returns `error.v1.code = stale_cursor`.", + "type": "object", + "required": ["schema_version", "hits", "next_cursor", "truncated"], + "properties": { + "schema_version": { "const": "search_response.v1" }, + "hits": { "type": "array", "description": "search_hit.v1[]" }, + "next_cursor": { "type": ["string", "null"], "description": "Opaque base64 cursor for next page; null when no more hits." }, + "truncated": { "type": "boolean", "description": "True when budget forced snippet shortening or k reduction. Caller can request next page via next_cursor or pass higher k." } + } +}