{"draft":null,"from":269,"to":270,"files":[{"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 `),"}],"unmatched":[]}