feat(FN-2610): merge fusion/fn-2610 (auto-resolved)

- fix(FN-2610): add changeset for health version fix
- test(FN-2610): verify health endpoint returns real package version
- fix(FN-2610): read version from package.json in health endpoint
This commit is contained in:
Fusion
2026-04-26 13:34:28 -07:00
committed by gsxdsm
parent 73a2f1b6ec
commit 7f54e86ce8
3 changed files with 51 additions and 2 deletions

View File

@@ -51,6 +51,23 @@ import { validateRemoteAuthToken } from "./remote-auth.js";
const __dirname = dirname(fileURLToPath(import.meta.url));
const PACKAGE_VERSION = (() => {
try {
const packageJsonPath = join(__dirname, "..", "package.json");
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8")) as {
version?: unknown;
};
if (typeof packageJson.version === "string" && packageJson.version.length > 0) {
return packageJson.version;
}
} catch {
// Fall through to environment fallback.
}
return process.env.npm_package_version ?? "0.0.0";
})();
const DEFAULT_AI_SESSION_TTL_MS = SESSION_CLEANUP_DEFAULT_MAX_AGE_MS;
const MIN_AI_SESSION_TTL_MS = 10 * 60 * 1000;
const MAX_AI_SESSION_TTL_MS = 30 * 24 * 60 * 60 * 1000;
@@ -899,7 +916,7 @@ export function createServer(store: TaskStore, options?: ServerOptions): ReturnT
app.get("/api/health", (_req, res) => {
res.json({
status: "ok",
version: process.env.npm_package_version ?? "0.4.0",
version: PACKAGE_VERSION,
uptime: Math.floor(process.uptime()),
});
});