Improve conversation realtime refresh and heartbeat defaults

This commit is contained in:
kris
2026-04-07 14:17:30 +08:00
parent 233f61a649
commit f83ab50d6b
7 changed files with 82 additions and 10 deletions

View File

@@ -0,0 +1,29 @@
import test from "node:test";
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
test("shipped local-agent configs use the faster heartbeat default", async () => {
const exampleConfig = JSON.parse(
await readFile(path.join(repoRoot, "local-agent", "config.example.json"), "utf8"),
);
const cloudConfig = JSON.parse(
await readFile(path.join(repoRoot, "local-agent", "config.cloud.json"), "utf8"),
);
assert.equal(exampleConfig.heartbeatIntervalMs, 15_000);
assert.equal(cloudConfig.heartbeatIntervalMs, 15_000);
});
test("device enrollment snippet advertises the faster heartbeat default", async () => {
const source = await readFile(path.join(repoRoot, "src", "components", "app-ui.tsx"), "utf8");
assert.match(source, /heartbeatIntervalMs:\s*15000/);
});
test("local-agent runtime falls back to the faster heartbeat default", async () => {
const source = await readFile(path.join(repoRoot, "local-agent", "server.mjs"), "utf8");
assert.match(source, /heartbeatIntervalMs\s*\?\?\s*15000/);
});