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); assert.equal(exampleConfig.masterAgentPollIntervalMs, 1_000); assert.equal(cloudConfig.masterAgentPollIntervalMs, 1_000); assert.equal(exampleConfig.skillLifecyclePollIntervalMs, 5_000); assert.equal(cloudConfig.skillLifecyclePollIntervalMs, 5_000); assert.equal(exampleConfig.skillLifecycleEnabled, true); assert.equal(cloudConfig.skillLifecycleEnabled, true); }); 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/); assert.match(source, /masterAgentPollIntervalMs\s*\?\?\s*1000/); assert.match(source, /skillLifecyclePollIntervalMs\s*\?\?\s*5000/); }); test("android reply wait loop polls with sub-second cadence", async () => { const source = await readFile( path.join( repoRoot, "android", "app", "src", "main", "java", "com", "hyzq", "boss", "ProjectDetailActivity.java", ), "utf8", ); assert.match(source, /REPLY_WAIT_POLL_INTERVAL_MS\s*=\s*800L/); });