922a57fe34
Self-hosted 開源:WASM 零件 + recipe + cypher-executor,跑在你自己的 Cloudflare。 此為重建的乾淨歷史起點(移除曾誤 commit 的 GCP SA 金鑰,舊歷史保留在 richblack/arcrun 與本地 backup 分支)。含: - acr init --self-hosted installer(建 KV/R2 + codeload 拉預編譯 wasm + wrangler deploy + seed recipe) - recipe push 把關(資料外流提醒 + 打通檢查) - 19 個正當零件預編譯 wasm(claude_api/km_writer/kbdb_upsert_block 排除:違反 DECISIONS §1) - CLI / cypher-executor / registry / 完整 SDD Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
120 lines
4.7 KiB
TypeScript
120 lines
4.7 KiB
TypeScript
/**
|
||
* api-recipe-seeds.ts
|
||
*
|
||
* 現役 API recipe 的種子定義。self-host 新帳號 init 時把這些灌進空的 RECIPES KV
|
||
* (透過 cypher-executor 的 POST /recipes,或 CF KV REST API 直接寫)。
|
||
*
|
||
* API recipe = http_request + 固定設定(endpoint/method 模板)。
|
||
* 不需 deploy Worker,cypher-executor 執行時直接 fetch(見 cypher-executor/src/routes/recipes.ts)。
|
||
*
|
||
* 放在 CLI 端而非 cypher-executor/src:
|
||
* - seed 資料是「installer 要灌進用戶 KV 的種子」,本就屬 CLI 職責(SDD self-hosted-init.md §4)。
|
||
* - rule 02 §2.2 hook 擋 cypher-executor TS hard-code API endpoint;seed 的 endpoint 是資料欄位,
|
||
* 放 CLI 端避開誤判,也更符合職責切分。
|
||
*
|
||
* 來源:2026-06-01 從 prod cypher.arcrun.dev/recipes 逐一查得的現役定義。
|
||
* 對應 SDD:.agents/specs/arcrun/sdk-and-website/self-hosted-init.md §5
|
||
*
|
||
* KBDB recipe(kbdb_*)採 Supabase 模式(richblack 2026-06-02):
|
||
* 進 seed = 展示能力(引子)。使用者要用 → 去 arcrun 取統一 API Key 當 credential。
|
||
* FOLLOW-UP(KBDB 端):endpoint 現為 kbdb.finally.click,KBDB 應改用統一對外網址;
|
||
* 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[] = [
|
||
// ── KBDB(Supabase 模式,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',
|
||
},
|
||
|
||
// ── Google(service_account)──
|
||
{
|
||
canonical_id: 'gmail_send',
|
||
display_name: 'Gmail Send',
|
||
description: '寄 Gmail。POST messages/send,body 帶 raw(base64url 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=RAW,body 帶 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 notify,body 帶 message(form-urlencoded)。auth: static_key Bearer line token。',
|
||
endpoint: 'https://notify-api.line.me/api/notify',
|
||
method: 'POST',
|
||
auth_service: 'line_notify',
|
||
},
|
||
];
|