{"version":270,"agent":"box-grants","message":"abso 690: while a seat holds its news stream, the abso-hooks mod's 30-second news poll stands down. abso news --stream marks the folder (.abso/news-stream.json) for the Monitor's 30 minutes plus the ticket's minute; --follow renews the mark on open and at each 45-second ping. The poll asks again once the mark runs out. Tests: client/test/news-stream.test.ts, client/hooks/register.test.ts (node client/test-mods.ts).","time":1792101682002,"timeIso":"2026-10-15T22:01:22.002Z","changes":5,"change":4093,"files":["client/hooks/register.test.ts","client/hooks/register.ts","client/src/announce.ts","client/src/news-stream.ts","client/test/news-stream.test.ts"],"draft":null,"diff":[{"path":"client/hooks/register.test.ts","added":10,"removed":0,"diff":"--- a/client/hooks/register.test.ts\n+++ b/client/hooks/register.test.ts\n@@ -62,6 +62,16 @@\n \texpect(log.split(\"\\n\").filter((l) => l.includes(\"Announcement from lead\"))).toHaveLength(1);\n });\n \n+test(\"while the seat holds its news stream (abso 690), the poll stands down, and asks again once the mark runs out\", async ($, on) => {\n+\tconst w = world(on, true, [[], []]);\n+\tw.written.set(\"/w/p/.abso/news-stream.json\", JSON.stringify({ until: 1_000_000 + 95_000 }));\n+\tawait $.session.start({ cwd: \"/w/p\" });\n+\tawait w.clock.advance(90_000);\n+\texpect(w.asked).toEqual([]);\n+\tawait w.clock.advance(30_000);\n+\texpect(w.asked).toEqual([\"https://avcs.test/p/p/a/bob/news\"]);\n+});\n+\n test(\"outside an abso folder it never asks\", async ($, on) => {\n \tconst w = world(on, false, [[\"should not arrive\"]]);\n \tawait $.session.start({ cwd: \"/w/p\" });"},{"path":"client/hooks/register.ts","added":6,"removed":0,"diff":"--- a/client/hooks/register.ts\n+++ b/client/hooks/register.ts\n@@ -217,6 +217,12 @@\n /** Ask for the news waiting for this agent (announcements, collisions) and hand it to the model. */\n async function pollNews($: Engine, root: string): Promise<void> {\n \ttry {\n+\t\t// While this seat holds its news stream (abso news --stream or --follow, abso 690), the stream wakes the chat.\n+\t\tconst mark = await readOr($, `${await stateOf($, root)}/news-stream.json`);\n+\t\tif (mark !== undefined) {\n+\t\t\tconst until = Number((JSON.parse(mark) as { until?: unknown }).until);\n+\t\t\tif (Number.isFinite(until) && until > (await $.clock.now())) return;\n+\t\t}\n \t\tconst config = JSON.parse(await $.fs.read(`${await stateOf($, root)}/config.json`)) as {\n \t\t\tserver: string;\n \t\t\tproject: string;"},{"path":"client/src/announce.ts","added":15,"removed":1,"diff":"--- a/client/src/announce.ts\n+++ b/client/src/announce.ts\n@@ -2,11 +2,14 @@\n // delivered once as news on each one's next edit (or the mod's next poll),\n // and the news waiting for this agent.\n \n+import { writeFileSync } from \"node:fs\";\n+import { join } from \"node:path\";\n import { newsLines } from \"./api.ts\";\n import { bool, type Parsed, str, UsageError } from \"./args.ts\";\n import { type Env, type Output, open, plural } from \"./commands.ts\";\n import { logNews } from \"./folder.ts\";\n-import { follow, monitorArgs, type Socket, streamText } from \"./news-stream.ts\";\n+import { follow, monitorArgs, type Socket, STREAM_MARK, streamMarkUntil, streamText } from \"./news-stream.ts\";\n+import { stateDir } from \"./state-dir.ts\";\n import { newsWithTime } from \"./times.ts\";\n \n export async function runAnnounce(args: Parsed, env: Env): Promise<Output> {\n@@ -74,12 +77,22 @@\n \treturn { text: lines.join(\"\\n\"), json: { ...answer } };\n }\n \n+/** Says this folder's seat holds its news stream until `until`, so the abso-hooks mod's poll stands down. Best effort. */\n+function markStream(root: string, until: number): void {\n+\ttry {\n+\t\twriteFileSync(join(stateDir(root), STREAM_MARK), JSON.stringify({ until }));\n+\t} catch {\n+\t\t// The mod keeps polling; nothing is lost.\n+\t}\n+}\n+\n export async function runNews(args: Parsed, env: Env): Promise<Output> {\n \tconst { root, config, api } = open(env);\n \tif (bool(args, \"stream\") && bool(args, \"follow\"))\n \t\tthrow new UsageError(\"abso news takes --stream or --follow, not both\");\n \tif (bool(args, \"stream\")) {\n \t\tconst ticket = await api.newsTicket();\n+\t\tmarkStream(root, streamMarkUntil(ticket, Date.now()));\n \t\treturn {\n \t\t\ttext: streamText(ticket, config.project, config.agent),\n \t\t\tjson: { monitor: monitorArgs(ticket, config.project, config.agent), expiresAt: ticket.expiresAt },\n@@ -99,6 +112,7 @@\n \t\t\t\t\tlogNews(root, [line]);\n \t\t\t\t\tenv.write(`${line.replace(/\\r?\\n/g, \" \")}\\n`);\n \t\t\t\t},\n+\t\t\t\theld: (until) => markStream(root, until),\n \t\t\t\tnote: (line) =>\n \t\t\t\t\tenv.write(`${line}\n `),"},{"path":"client/src/news-stream.ts","added":15,"removed":1,"diff":"--- a/client/src/news-stream.ts\n+++ b/client/src/news-stream.ts\n@@ -43,6 +43,14 @@\n \t].join(\"\\n\");\n }\n \n+/** The file that says this folder's seat holds its stream, until when: the abso-hooks mod's news poll skips meanwhile. */\n+export const STREAM_MARK = \"news-stream.json\";\n+\n+/** How long --stream's mark holds: the Monitor's 30 minutes, and the minute the ticket waits to be used. */\n+export function streamMarkUntil(ticket: NewsTicket, now: number): number {\n+\treturn Math.max(now, ticket.expiresAt) + MONITOR_TIMEOUT_MS;\n+}\n+\n /** The part of a WebSocket --follow uses: the platform's own, or a test's. */\n export interface Socket {\n \tonopen: (() => void) | null;\n@@ -79,6 +87,8 @@\n \tsleep(ms: number): Promise<void>;\n \tnow(): number;\n \tevery(ms: number, fn: () => void): () => void;\n+\t/** Called when a socket opens and at each ping: the stream is held until the next ping is due, and a little more. */\n+\theld?(until: number): void;\n \t/** Set when --follow should stop (Ctrl-C, or a test). */\n \treadonly stopped: () => boolean;\n }\n@@ -111,9 +121,13 @@\n \t\t\tconst socket = deps.connect(ticket.url, ticket.protocols);\n \t\t\tlet stopPing = () => {};\n \t\t\tsocket.onopen = () => {\n+\t\t\t\tdeps.held?.(deps.now() + 2 * PING_MS);\n \t\t\t\tstopPing = deps.every(PING_MS, () => {\n \t\t\t\t\tif (deps.stopped()) socket.close(1000);\n-\t\t\t\t\telse socket.send(PING);\n+\t\t\t\t\telse {\n+\t\t\t\t\t\tsocket.send(PING);\n+\t\t\t\t\t\tdeps.held?.(deps.now() + 2 * PING_MS);\n+\t\t\t\t\t}\n \t\t\t\t});\n \t\t\t};\n \t\t\tsocket.onmessage = (e) => {"},{"path":"client/test/news-stream.test.ts","added":12,"removed":0,"diff":"--- a/client/test/news-stream.test.ts\n+++ b/client/test/news-stream.test.ts\n@@ -15,6 +15,8 @@\n \tPING_MS,\n \tPONG,\n \ttype Socket,\n+\tSTREAM_MARK,\n+\tstreamMarkUntil,\n \tstreamText,\n } from \"../src/news-stream.ts\";\n \n@@ -127,10 +129,20 @@\n \n test(\"--follow keeps an idle socket open with a ping the object answers without waking\", async () => {\n \tconst w = world([{ frames: [], close: { code: 1006 } }]);\n+\tconst held: number[] = [];\n+\tw.deps.held = (until) => held.push(until);\n \tawait follow(w.deps);\n \tassert.deepEqual(w.sent, [PING]);\n+\t// The stream mark is renewed on open and at each ping, two pings ahead, so the mod's poll stands down meanwhile.\n+\t// The first socket opens and pings; the second opens a second later.\n+\tassert.deepEqual(held, [NOW + 2 * PING_MS, NOW + 2 * PING_MS, NOW + 1_000 + 2 * PING_MS]);\n });\n \n+test(\"--stream's mark holds for the Monitor's 30 minutes after the ticket's minute\", () => {\n+\tassert.equal(streamMarkUntil(ticket(1), NOW), NOW + 60_000 + MONITOR_TIMEOUT_MS);\n+\tassert.equal(STREAM_MARK, \"news-stream.json\");\n+});\n+\n test(\"a refused ticket or a refusal close ends --follow; a ticket that can't be had is tried again\", async () => {\n \tconst refusedClose = world([{ frames: [\"one item\"], close: { code: 4401, reason: \"the key was revoked\" } }]);\n \tassert.deepEqual(await follow(refusedClose.deps), { ended: \"refused\", reason: \"the key was revoked\" });"}],"ci":null}