// KBDB Base — atomic universal table worker (arcrun self-hosted data layer + official core). // SDD: .agents/specs/arcrun/kbdb-base/design.md // // Base = D1 only (free, no credit card): entries / templates / records + LIKE search + recipe-stats. // Optional modules (NOT in this base): embed (Vectorize+AI binding, semantic search), triplet (separate repo). import { Hono } from 'hono'; import type { Bindings } from './types'; import { entryRoutes } from './routes/entries'; import { templateRoutes } from './routes/templates'; import { recordRoutes } from './routes/records'; import { recipeStatRoutes } from './routes/recipe-stats'; import { embedRoutes } from './routes/embed'; const app = new Hono<{ Bindings: Bindings }>(); app.get('/', (c) => c.json({ service: 'arcrun-kbdb', tier: 'base', status: 'ok' })); app.get('/health', (c) => c.json({ ok: true })); app.route('/entries', entryRoutes); app.route('/templates', templateRoutes); app.route('/records', recordRoutes); app.route('/recipe-stats', recipeStatRoutes); // Optional embed module admin (backfill). Route mounts unconditionally; the handler // honestly 409s when the embed binding is off (base 對內容語意無知,只認通用 embed 旗標)。 app.route('/embed', embedRoutes); export default app;