313aeb13bf
Part 1(框架,cypher-executor webhooks-named.ts):加同步查詢 trigger。
現有 named webhook /trigger 回 {success,data,trace,duration_ms} 信封、只有 POST;
查詢面(console/MCP 打 graph neighbors/traverse)要 GET + 直接拿最終節點輸出當 response。
新端點同步 await 執行 workflow graph → 回 result.data(最終節點輸出)本身當 body(非 202):
- GET /q/:ns/:name (namespace 走 path,input 走 query string)
- GET /webhooks/named/:name/query (X-Arcrun-API-Key header,input 走 query string)
- POST /webhooks/named/:name/query (header,input 走 body)
- POST /webhooks/named/:ns/:name/query (namespace 走 path,input 走 body)
認證沿用 X-Arcrun-API-Key。誠實(mindset §7):節點失敗回 error+trace(500,非假綠);
paused 工作流無法同步回答 → 409 明講;輸出 5 MiB 硬上限(超過 413);duration 走 header 不污染 body。
Part 2(A 類 workflow.yaml):registry/examples/graph-neighbors/。
http_request 打 base custom domain kbdb.finally.click(避 CF 1042)撈 triplet records
→ code 零件記憶體 BFS(對照 kbdb-graph-plugin graph-traverse.ts)→ 同步回鄰居。
把 graph plugin 內建 GET /graph/neighbors 泛化成查詢面 workflow 的示範。
測試:cypher-executor/tests/query-trigger.test.ts(7 測,全綠)——同步回輸出(非 202)、
GET/POST × header/path 四端點、節點失敗回錯+trace、缺 key 401、不存在 404。
用內建 comp_uppercase(純記憶體)證明 Part 1 同步 trigger 機制本身可用。
待驗:graph_neighbors 需 code 零件部署 leo21c 後才能 live 端到端(另線處理);
triplet template id 上線前對一次(workflow 已參數化未寫死)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015d5jDbuqT5Htwv3Q88XXKk
44 lines
1.8 KiB
Markdown
44 lines
1.8 KiB
Markdown
# Arcrun Examples Library
|
||
|
||
> 給 AI 操盤手快速參考的 workflow 範本庫。每個範例都是可直接 `acr push` 部署的 YAML。
|
||
>
|
||
> 對應 SDD: `matrix/arcrun/.agents/specs/llm-interface/` Milestone 3.3
|
||
|
||
## 結構
|
||
|
||
每個範例一個資料夾:
|
||
|
||
```
|
||
{slug}/
|
||
├── workflow.yaml 可直接 push 部署
|
||
├── description.md 解決什麼問題 / 怎麼觸發 / 預期結果
|
||
└── tags.json ["webhook", "llm", "cron", ...] 用於搜尋
|
||
```
|
||
|
||
## 範例列表
|
||
|
||
| Slug | 場景 |
|
||
|---|---|
|
||
| `webhook-to-http` | 簡單轉發:webhook → 打另一個 API |
|
||
| `cron-watcher` | 每 5 分鐘掃資料庫 → 觸發子 workflow(mira pattern) |
|
||
| `llm-classify` | claude_api 分類文字 → 寫 KBDB |
|
||
| `rag-search-answer` | 從 KBDB 找 context → claude 回答 |
|
||
| `email-summary` | gmail 收信 → claude 摘要 → telegram 推 |
|
||
| `pdf-to-blocks` | 上傳 PDF → 轉文字 → 切 chunk → 存 KBDB |
|
||
| `github-issue-bot` | 收 GH webhook → claude 分析 → 留 comment |
|
||
| `daily-digest` | cron → 多源聚合(KBDB / RSS / 等) → 推送 |
|
||
| `parallel-fanout` | 一份輸入分發多 workflow 並行處理 |
|
||
| `error-retry` | try_catch + wait + retry 重試外部 API |
|
||
| `graph-neighbors` | 同步查詢:撈 KBDB triplet → 記憶體 BFS 找 N 跳鄰居(查詢面工作流,走同步查詢 trigger) |
|
||
|
||
## 如何用(AI 視角)
|
||
|
||
1. `arcrun_search_examples('rag context answer')` → 命中 `rag-search-answer`
|
||
2. 拿 YAML,按自己需求改 prompt / 資料來源
|
||
3. `arcrun_validate_yaml` → `arcrun_push_workflow` → 完成
|
||
|
||
## CI 自動同步
|
||
|
||
GH Actions 監聽本目錄變動 → 把每個範例 PATCH 進 KBDB type=workflow-example
|
||
(含 YAML + description + tags)。MCP `search_examples` 走 KBDB semantic search。
|