import { Hono } from 'hono'; import type { Bindings } from '../types'; export const healthRouter = new Hono<{ Bindings: Bindings }>(); // t162(leo 07-31 實撞:「小幫手一直顯示知識庫需要更新…重新更新後並不會消失」): // daemon cloudVersionStale() 讀 /health 的 `bundle_version` 判斷是否過舊—— // 但本端點過去只回 {ok:true},**從沒吐這個欄位** ⇒ daemon 恆讀到空字串 // ⇒ 恆判 stale ⇒ 假警報永遠不消失(安裝器其實一直有注入 ARCRUN_BUNDLE_VERSION var, // 只是沒有人把它吐出來)。修=誠實回報本實例的 bundle 版本。 // 未注入(本地 dev/很舊的實例)就省略該欄——daemon 對空字串仍判 stale, // 那是**正確的**(真的是老實例,該更新)。 healthRouter.get('/health', (c) => { const bundleVersion = c.env.ARCRUN_BUNDLE_VERSION; return c.json( bundleVersion ? { ok: true, bundle_version: bundleVersion } : { ok: true }, ); }); healthRouter.get('/', (c) => c.json({ service: 'arcrun-cypher-executor', version: '1.0.0', status: 'ok', }) );