Files
loki/scripts/test/control-next-step.ts
T
Cato 2b0b1bc49a Unify mobile agent conversations, run status and shared project progress (#1201)
* Make mobile agent conversations and shared project progress coherent

* Remove the retired automatic personal-goal dispatch reader

* Keep the conversation connection indicator in sync with its live stream

* Preserve existing phone install identity and clarify the historical implementation plan

* Make session recovery instructions user-facing and record the security-alert source review

* Carry project proposals into coding handoffs and clarify empty-session routing
2026-10-14 22:58:37 -07:00

24 lines
923 B
TypeScript

import assert from "node:assert/strict";
import { controlNextStep } from "../../src/lib/control-next-step";
const now = Date.parse("2026-10-15T12:00:00Z");
assert.equal(
controlNextStep(
{ next: "Obsolete production database advice", mtime: now - 150 * 86_400_000 },
undefined,
now / 1000,
),
null,
);
assert.equal(controlNextStep({ next: "Undated", mtime: NaN }, undefined, now / 1000), null);
assert.equal(controlNextStep({ next: "Future", mtime: now + 1000 }, undefined, now / 1000), null);
assert.equal(
controlNextStep({ next: "Current task", mtime: now - 60_000 }, undefined, now / 1000)?.text,
"Current task",
);
assert.equal(controlNextStep(null, "Unknown", now / 1000), null);
assert.equal(
controlNextStep(null, "Profile suggestion", now / 1000)?.label,
"Suggested next (profile):",
);
console.log("✓ Control does not promote old, future or unknown handoffs as current instructions");