arcrun — AI workflow execution engine (clean history)
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>
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
// GET /components/:id — 取得零件最優版本合約
|
||||
// GET /components/:id/versions — 取得所有版本清單(含評分)
|
||||
// GET /components/search?q=... — 語意搜尋零件
|
||||
// Requirements: 12.2, 12.3
|
||||
|
||||
import { Hono } from 'hono';
|
||||
import type { Bindings } from '../types';
|
||||
import { getComponent, getComponentVersions, searchComponents } from '../actions/queryComponents';
|
||||
|
||||
const app = new Hono<{ Bindings: Bindings }>();
|
||||
|
||||
// 語意搜尋(必須在 /:id 之前,避免 "search" 被當作 id)
|
||||
app.get('/search', async c => {
|
||||
const q = c.req.query('q');
|
||||
if (!q || q.trim() === '') {
|
||||
return c.json({ success: false, error: 'q 參數必填' }, 400);
|
||||
}
|
||||
|
||||
const results = await searchComponents(q.trim(), c.env);
|
||||
return c.json({ success: true, data: { results, count: results.length } });
|
||||
});
|
||||
|
||||
// 取得所有版本
|
||||
app.get('/:id/versions', async c => {
|
||||
const id = c.req.param('id');
|
||||
const versions = await getComponentVersions(id, c.env);
|
||||
if (versions.length === 0) {
|
||||
return c.json({ success: false, error: `零件 ${id} 不存在` }, 404);
|
||||
}
|
||||
return c.json({ success: true, data: { versions, count: versions.length } });
|
||||
});
|
||||
|
||||
// 取得最優版本
|
||||
app.get('/:id', async c => {
|
||||
const id = c.req.param('id');
|
||||
const component = await getComponent(id, c.env);
|
||||
if (!component) {
|
||||
return c.json({ success: false, error: `零件 ${id} 不存在` }, 404);
|
||||
}
|
||||
return c.json({ success: true, data: component });
|
||||
});
|
||||
|
||||
export default app;
|
||||
Reference in New Issue
Block a user