3.6/3.7 查詢誠實化:兩庫都查、缺件回 not_found+分型指路 suggestion
📋 SDD:workflow-discovery task 3.6/3.7(leo 07-31 步驟 3 考題)
契約以頂層 arcrun-usable/verify.sh 01+03 組為準。
- 3.6 recipe 納入 /cypher/search:零件 registry 落空後查 RECIPES KV
(resolveRecipe,執行鏈同一套解析);recipe found 附 source/description/endpoint
- 3.7 缺件分型指路:status 契約定 not_found(verify grep),suggestion 欄——
名字含服務詞(google/telegram/…)=外部 API 樣貌 → 指 skill write_recipe;
含計算詞(encrypt/hash/…)=計算原語樣貌 → 指 skill add_new_wasm_component 投稿 PR;
判不出型誠實說判不出、兩條路都給。規則簡單可解釋(不接 LLM),判準在 code 註解
- 相近候選:not_found 附 similar_components/similar_recipes——全名搜不中就斷詞
(ASCII 詞+中日韓 2-gram)打 registry /components/search,
「判斷有沒有新資料」媒合到 if_control(leo:AI 不用知道零件存在)
- 修頭節點假 found:resolveNodeRole 把無入邊頭節點判 Input,searchNodes 對 Input
無條件 found ⇒ 「aes_encrypt >> … >> code」的頭被掩蓋。改為只有字面
input/trigger/…/output 名才短路(isVirtualIoName),真名字照查兩庫
- registry 查詢層補 input_schema/output_schema 透傳:KV 一直有存
(indexOnlyComponent),toComponentRecord 丟掉 ⇒ /cypher/search 給不出
「怎麼填 payload」。順手補 REGISTRY_BASE_URL 可選覆蓋(比照 KBDB_GRAPH_URL 慣例,
本地 dev/self-hosted registry 掛別處時用)
驗:cypher-executor+registry tsc 全綠;vitest 9 failed/179 passed=與 5cadc60
基線完全相同(既有債非本次造成);本地 wrangler dev(cypher 指本地 registry,
KV 用 index-only 種入 20 份 repo 合約)跑頂層 verify.sh 01+03 組 9/9 全綠,
含 telegram_send 種入後 recipe found 路徑實測。部署到實例後需對真環境重驗。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,10 @@ export interface ComponentRecord {
|
||||
call_count: number;
|
||||
wasm_r2_key?: string;
|
||||
score: number;
|
||||
// 零件合約的 I/O schema。KV 記錄一直有存(indexOnlyComponent 寫入),
|
||||
// 過去查詢層把它丟掉 ⇒ /cypher/search 給不出「怎麼填 payload」——2026-07-31 補透傳。
|
||||
input_schema?: Record<string, unknown>;
|
||||
output_schema?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
// ── id 解析:支援 hash_id 和 canonical_id 兩種格式 ──────────────────────────
|
||||
@@ -158,5 +162,11 @@ function toComponentRecord(v: Record<string, unknown>): ComponentRecord {
|
||||
call_count: parseInt(String(v.call_count ?? '0'), 10),
|
||||
wasm_r2_key: v.wasm_r2_key ? String(v.wasm_r2_key) : undefined,
|
||||
score: computeScore(v),
|
||||
input_schema: isPlainObject(v.input_schema) ? v.input_schema : undefined,
|
||||
output_schema: isPlainObject(v.output_schema) ? v.output_schema : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
function isPlainObject(x: unknown): x is Record<string, unknown> {
|
||||
return typeof x === 'object' && x !== null && !Array.isArray(x);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user