fix(kbdb): cypher proxy 補 /kbdb/entries CRUD + report_feedback 改打 /entries
kbdb-base Phase 9.6/9.7(HANDOFF §2 缺口① + §3b 連帶): - 9.6 cypher kbdb-proxy 補 /kbdb/entries CRUD(POST/GET list/GET :id/PATCH :id) 純轉發到 KBDB 基本盤 /entries,解鎖 mira _kbdb_client.py 主線遷移。 租戶隔離同 9.5:寫入注入 owner_id、list 強制本租戶過濾、PATCH 剝 owner_id。 刻意不開 DELETE(基本盤 delete 無 owner 檢查 → 跨租戶刪除風險)。 - 9.7 arcrun_report_feedback 從死 route /blocks 改打基本盤 /entries (entry_type=agent-feedback)。9.4 漏網的同類修;基本盤無 /blocks → 原本 404 假紅。 順帶(HANDOFF §6 harness 表達優化): - 重寫 cli/harness/CLAUDE.block.md 補三盲點(recipe 是公共投稿 / 缺能力補 API 不拼裝 / 自製零件退場路徑),目標 Haiku 級 CC 讀懂。 - README 零件 vs recipe 段對齊同三點。 cypher + mcp tsc exit 0。端到端 smoke test 隨後。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -51,11 +51,12 @@ export function registerReportFeedback(server: McpServer, env: Env, orgNamespace
|
||||
return { content: [{ type: "text", text: "Error: KBDB service binding unavailable" }], isError: true };
|
||||
}
|
||||
|
||||
const blockBody = {
|
||||
api_key: env.PLATFORM_API_KEY || undefined, // 若 platform key 在,聚集;否則用用戶 namespace
|
||||
type: "agent-feedback",
|
||||
source: "mcp-tool-call",
|
||||
user_id: orgNamespace,
|
||||
// kbdb-base 9.7:寫進基本盤 entries(entry_type=agent-feedback)。
|
||||
// 舊版打 v3 死 route /blocks(基本盤只 mount entries/templates/records)→ 404 假紅,已改。
|
||||
// owner_id = 用戶 namespace(self-hosted 單租戶聚集)。基本盤無 source/api_key 欄 → 併入 metadata。
|
||||
const entryBody = {
|
||||
entry_type: "agent-feedback",
|
||||
owner_id: orgNamespace,
|
||||
content: description,
|
||||
metadata_json: JSON.stringify({
|
||||
issue_type,
|
||||
@@ -64,6 +65,7 @@ export function registerReportFeedback(server: McpServer, env: Env, orgNamespace
|
||||
blocked: blocked ?? false,
|
||||
suggested_fix,
|
||||
agent_user_agent,
|
||||
source: "mcp-tool-call",
|
||||
reported_at: new Date().toISOString(),
|
||||
}),
|
||||
tags_json: JSON.stringify([
|
||||
@@ -74,11 +76,11 @@ export function registerReportFeedback(server: McpServer, env: Env, orgNamespace
|
||||
]),
|
||||
};
|
||||
|
||||
// 走 KBDB service binding(既有 pattern)
|
||||
const createResp = await kbdbFetch(env, `/blocks`, {
|
||||
// 走 KBDB service binding 打基本盤 /entries(薄殼模式不變)
|
||||
const createResp = await kbdbFetch(env, `/entries`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(blockBody),
|
||||
body: JSON.stringify(entryBody),
|
||||
});
|
||||
|
||||
if (!createResp.ok) {
|
||||
@@ -92,7 +94,7 @@ export function registerReportFeedback(server: McpServer, env: Env, orgNamespace
|
||||
error_code: "kbdb_write_failed",
|
||||
human_message: `回饋寫入 KBDB 失敗:HTTP ${createResp.status}`,
|
||||
next_actions: [
|
||||
"確認 KBDB 服務在線(試 https://kbdb-get.arcrun.dev/health)",
|
||||
"確認 KBDB 服務在線(KBDB worker /health)",
|
||||
"若持續失敗,可暫先在本地記下回饋,稍後重試",
|
||||
],
|
||||
detail: errBody.slice(0, 200),
|
||||
@@ -114,7 +116,9 @@ export function registerReportFeedback(server: McpServer, env: Env, orgNamespace
|
||||
data: {
|
||||
reported: true,
|
||||
issue_type,
|
||||
block_id: (data as { id?: string } | null)?.id,
|
||||
// 基本盤 /entries 回 { success, entry };舊 /blocks 回 { id } → 兩種都容忍
|
||||
entry_id: (data as { entry?: { id?: string }; id?: string } | null)?.entry?.id
|
||||
?? (data as { id?: string } | null)?.id,
|
||||
},
|
||||
hints: [
|
||||
issue_type === "success_story"
|
||||
|
||||
Reference in New Issue
Block a user