feat: 薄殼原則落地 + seed 下沉 API + MCP 進主庫 + 部署一致性

壓測四橫向問題修正(docs 壓測報告):

① 薄殼原則成鐵律:能力長在 API,CLI/MCP/lib 只暴露
   - seed 下沉成 API 行為:cypher-executor POST /init/seed(一次灌 API+auth recipe),
     種子資料移到 server src/lib/api-recipe-seeds.ts,CLI 改薄殼一次呼叫
   - 解除 deployFullyOk 連坐 + init 補 seed auth recipe + update 補 seed/全 KV
   - registry SUBMISSIONS_KV 補進 REQUIRED_KV_NAMESPACES(修 20/21)

② MCP 統一帳號來源(單一 remote MCP + .env 切 MCP URL)
   - MCP 從 sibling repo 搬進 arcrun/mcp/(remote Worker,route 改 mcp.arcrun.dev)
   - config 加 mcp_url 三層解析 + getMcpUrl + DEFAULT_MCP_URL
   - 新增 acr mcp-setup:依 config 寫專案 .mcp.json(接案切資料夾自動切 MCP)
   - acr --version 改動態讀 package.json(根治漂移)

③ Deploy 一致性
   - tests/release.feature + scripts/check-release.sh
   - local-deploy.sh:CLI npm publish + auto patch bump + CHANGELOG
   - local-deploy.sh bash 3.2 相容修正(mapfile / 空陣列 set -u)
   - builtins/pnpm-lock.yaml

④ README self-hosted 同步現況(移除 R2 殘留、加 flag/env、多帳號)

CLI bump → 1.3.0

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
uncle6me-web
2026-06-06 15:45:35 +08:00
parent 5f381a44a6
commit 3e65e22775
58 changed files with 8608 additions and 74 deletions
+120
View File
@@ -0,0 +1,120 @@
/**
* api-recipe-seeds.tsserver 端,唯一真相)
*
* 現役 API recipe 的種子定義。self-host 新帳號裝好後,POST /init/seed 端點把這些灌進空的 RECIPES KV。
*
* API recipe = http_request + 固定設定(endpoint/method 模板)。
* 不需 deploy Workercypher-executor 執行時直接 fetch(見 routes/recipes.ts)。
*
* 為何放在 cypher-executor/src(薄殼原則 rule 07 + 壓測 §5.5):
* - 「裝好之後預設有哪些 recipe」是 API 的能力,不是 CLI 的。seed 應由 API 端點完成
* POST /init/seed),CLI/MCP 只呼叫一次。種子資料是這個能力的一部分,故放 server。
* - 種子的 endpoint 字串(sheets.googleapis.com 等)是 recipe 的「資料欄位」(宣告打哪),
* 非 TS 裡的呼叫實作;真正呼叫仍走零件 / http_request。rule 02 §2.2 hook 已對本檔加例外
* richblack 2026-06-06 授權,與 auth-recipe-seeds.ts 同理由)。
*
* 來源:2026-06-01 從 prod cypher.arcrun.dev/recipes 逐一查得的現役定義。
* 對應 SDD.agents/specs/arcrun/sdk-and-website/self-hosted-init.md §5
*
* KBDB recipekbdb_*)採 Supabase 模式(richblack 2026-06-02):
* 進 seed = 展示能力(引子)。使用者要用 → 去 arcrun 取統一 API Key 當 credential。
* FOLLOW-UPKBDB 端):endpoint 現為 kbdb.finally.clickKBDB 應改用統一對外網址;
* KBDB 改網址後同步更新此處。seed 先照現況進。
*/
export interface ApiRecipeSeed {
canonical_id: string;
display_name: string;
description?: string;
endpoint: string;
method: string;
auth_service?: string;
}
export const API_RECIPE_SEEDS: ApiRecipeSeed[] = [
// ── KBDBSupabase 模式,auth_service=kbdb static_key)──
{
canonical_id: 'kbdb_get',
display_name: 'KBDB Get',
description: 'GET 讀取 block / 查詢。_path 帶查詢路徑。auth: kbdb static_key。',
endpoint: 'https://kbdb.finally.click{{_path}}',
method: 'GET',
auth_service: 'kbdb',
},
{
canonical_id: 'kbdb_create_block',
display_name: 'KBDB Create Block',
description: 'POST /blocks 建立 block。body 帶 block 欄位(content/type/page_name/source/user_id 等)。auth: kbdb static_key。',
endpoint: 'https://kbdb.finally.click/blocks',
method: 'POST',
auth_service: 'kbdb',
},
{
canonical_id: 'kbdb_patch_block',
display_name: 'KBDB Patch Block',
description: 'PATCH /blocks/:id 局部更新。_path 帶 /blocks/{id}body 帶要改的欄位。auth: kbdb static_key。',
endpoint: 'https://kbdb.finally.click{{_path}}',
method: 'PATCH',
auth_service: 'kbdb',
},
{
canonical_id: 'kbdb_delete',
display_name: 'KBDB Delete',
description: 'DELETE /blocks/:id 刪除 block。_path 帶 /blocks/{id}。auth: kbdb static_key。',
endpoint: 'https://kbdb.finally.click{{_path}}',
method: 'DELETE',
auth_service: 'kbdb',
},
{
canonical_id: 'kbdb_ingest',
display_name: 'KBDB Ingest',
description: 'POST /blocks/ingest 批次寫入。body 帶 input。auth: kbdb static_key。',
endpoint: 'https://kbdb.finally.click/blocks/ingest',
method: 'POST',
auth_service: 'kbdb',
},
// ── Googleservice_account)──
{
canonical_id: 'gmail_send',
display_name: 'Gmail Send',
description: '寄 Gmail。POST messages/sendbody 帶 rawbase64url MIME)。auth: google service_account。',
endpoint: 'https://gmail.googleapis.com/gmail/v1/users/me/messages/send',
method: 'POST',
auth_service: 'google_gmail_sa',
},
{
canonical_id: 'google_sheets_append',
display_name: 'Google Sheets Append',
description: '寫 Sheets。PUT values?valueInputOption=RAWbody 帶 values。auth: google service_account。',
endpoint: 'https://sheets.googleapis.com{{_path}}',
method: 'PUT',
auth_service: 'google_sheets_sa',
},
{
canonical_id: 'google_sheets_read',
display_name: 'Google Sheets Read',
description: '讀 Sheets。GET values。_path 帶完整路徑。auth: google service_account。',
endpoint: 'https://sheets.googleapis.com{{_path}}',
method: 'GET',
auth_service: 'google_sheets_sa',
},
// ── 訊息(static_key)──
{
canonical_id: 'telegram_send',
display_name: 'Telegram Send',
description: 'Telegram sendMessage。token 在 URL path{{auth.bot_token}}),body 帶 chat_id+text。auth: static_key path 注入。',
endpoint: 'https://api.telegram.org/bot{{auth.bot_token}}/sendMessage',
method: 'POST',
auth_service: 'telegram',
},
{
canonical_id: 'line_notify_send',
display_name: 'LINE Notify',
description: 'LINE Notify 推訊息。POST notifybody 帶 messageform-urlencoded)。auth: static_key Bearer line token。',
endpoint: 'https://notify-api.line.me/api/notify',
method: 'POST',
auth_service: 'line_notify',
},
];