{"draft":null,"from":2,"to":318,"files":[{"path":"worker/project/http.ts","added":45,"removed":11,"diff":"--- a/worker/project/http.ts\n+++ b/worker/project/http.ts\n@@ -1,6 +1,8 @@\n // The JSON routes of the contract (docs/v2-slice1.md), as a pure function of\n // the project calls, so they can be tested in Node without a Worker.\n+\n import type { EditBody, ProjectCalls, ProjectHistory } from \"./project-api.ts\";\n+import { unseenError } from \"./unseen.ts\";\n \n export interface Answer {\n \tstatus: number;\n@@ -47,9 +49,11 @@\n }\n \n /**\n- * What a reader may not do. Edits and records (which old edit mods send on\n- * their own) and publishes answer 200 {ok: false, reason}, so a mod only logs\n- * it; the rest are refused outright.\n+ * What a reader may not do: change code. Edits and records (which old edit\n+ * mods send on their own) and publishes answer 200 {ok: false, reason}, so a\n+ * mod only logs it; the rest are refused outright. Talking stays open (abso\n+ * 682, Christopher: \"readers need to be able to do asks and news and stuff\"):\n+ * announcements, notes on lines, asks and issues all work for a reader.\n  */\n const NOT_FOR_READERS: Record<string, \"answer\" | \"refuse\"> = {\n \tedit: \"answer\",\n@@ -66,10 +70,12 @@\n };\n \n /** A path the project won't hold: .avcs/ is each folder's own settings. */\n+/** A path under a folder's state folder (.abso/, or .avcs/ from before the rename), which never leaves it. */\n function localPath(paths: string[]): string | undefined {\n-\treturn paths.find((p) => p === \".avcs\" || p.startsWith(\".avcs/\") || p.startsWith(\"./.avcs/\"));\n+\treturn paths.find((p) => [\".abso\", \".avcs\"].some((d) => p === d || p.startsWith(`${d}/`) || p.startsWith(`./${d}/`)));\n }\n-const LOCAL = (p: string) => fail(400, `${p} is under .avcs/, which stays in the agent's folder`);\n+const LOCAL = (p: string) =>\n+\tfail(400, `${p} is under ${p.replace(/^\\.\\//, \"\").split(\"/\")[0]}/, which stays in the agent's folder`);\n \n /**\n  * The reader rules (#37, Reporter), for one agent call: the answer to\n@@ -94,7 +100,7 @@\n \t\t\tif (me && (me.draftChanges > 0 || (me.parked?.length ?? 0) > 0)) {\n \t\t\t\treturn fail(\n \t\t\t\t\t409,\n-\t\t\t\t\t`${agent} has unpublished changes; publish or restore them (abso restore --all) before it becomes a reader`,\n+\t\t\t\t\t`${agent} has unpushed changes; push or restore them (abso restore --all) before it becomes a reader`,\n \t\t\t\t);\n \t\t\t}\n \t\t}\n@@ -312,11 +318,11 @@\n \t\t\t\treturn { status: 200, body: history.blame(q.file, num(q.from), num(q.to), num(q.version), draft, who) };\n \t\t\tconst line = num(q.line);\n \t\t\tif (!line || !Number.isInteger(line)) return fail(400, \"why needs ?line=<number>\");\n-\t\t\treturn { status: 200, body: history.why(q.file, line, draft, who) };\n+\t\t\treturn { status: 200, body: history.why(q.file, line, draft, who, num(q.version)) };\n \t\t}\n \t\tif (op === \"announce\" && agent === undefined) {\n \t\t\t// The sender comes from the route, like every other agent op, not from\n-\t\t\t// a body field anyone can fill in (Security, #31).\n+\t\t\t// a body field anyone can fill in (#31).\n \t\t\treturn fail(400, \"announce from your own agent: POST /p/:project/a/<you>/announce {text, to?}\");\n \t\t}\n \t\tif (op === \"files\" && agent === undefined) {\n@@ -346,6 +352,17 @@\n \t\t\tconst limit = q.limit !== undefined && Number.isInteger(Number(q.limit)) ? Number(q.limit) : undefined;\n \t\t\treturn { status: 200, body: history.refusals(q.agent || undefined, limit) };\n \t\t}\n+\t\tif (op === \"without\") {\n+\t\t\t// GET ?version=<n>&versions=<n,n>: version n of shared with those versions left out (without.ts).\n+\t\t\tconst q = (body ?? {}) as Record<string, string | undefined>;\n+\t\t\tconst history = project as ProjectCalls & Partial<ProjectHistory>;\n+\t\t\tif (!history.without) return fail(501, \"without needs the engine\");\n+\t\t\tconst version = q.version !== undefined && /^\\d+$/.test(q.version) ? Number(q.version) : undefined;\n+\t\t\tconst versions = (q.versions ?? \"\").split(\",\").filter((s) => s.trim() !== \"\");\n+\t\t\tif (version === undefined || versions.length === 0 || versions.some((s) => !/^\\s*\\d+\\s*$/.test(s)))\n+\t\t\t\treturn fail(400, \"without needs ?version=<number>&versions=<number,number>\");\n+\t\t\treturn { status: 200, body: history.without(version, versions.map(Number)) };\n+\t\t}\n \t\tif (op === \"log\" || op === \"show\" || op === \"file\" || op === \"compare\") {\n \t\t\t// GETs: ?draft=<name> (shared when absent); log ?limit, ?path; show ?version; file ?path, ?version; compare ?from, ?to.\n \t\t\tconst q = (body ?? {}) as Record<string, string | undefined>;\n@@ -377,7 +394,8 @@\n \t\t\t\tconst from = int(q.from);\n \t\t\t\tconst to = int(q.to);\n \t\t\t\tif (from === undefined || to === undefined) return fail(400, \"compare needs ?from=<number>&to=<number>\");\n-\t\t\t\treturn { status: 200, body: history.compare(from, to, draft, who) };\n+\t\t\t\t// summary=1: each file's size and SHA-256, not its texts (abso issue 680).\n+\t\t\t\treturn { status: 200, body: history.compare(from, to, draft, who, q.summary === \"1\") };\n \t\t\t}\n \t\t\tconst version = Number(q.version);\n \t\t\tif (q.version === undefined || !Number.isInteger(version)) return fail(400, \"show needs ?version=<number>\");\n@@ -426,7 +444,9 @@\n \t\t\t}\n \t\t\tcase \"publish\": {\n \t\t\t\tconst message = (body as { message?: string })?.message;\n-\t\t\t\tif (typeof message !== \"string\" || !message.trim()) return fail(400, \"publish needs {message} saying why\");\n+\t\t\t\tif (typeof message !== \"string\" || !message.trim()) return fail(400, \"push needs {message} saying why\");\n+\t\t\t\tconst unseen = unseenError(\"the message\", message);\n+\t\t\t\tif (unseen) return fail(400, unseen);\n \t\t\t\t// asIs (#37): publish even with collided lines untouched since the sync, both sides kept.\n \t\t\t\treturn { status: 200, body: project.publish(agent, message, (body as { asIs?: unknown }).asIs === true) };\n \t\t\t}\n@@ -436,7 +456,7 @@\n \t\t\t\tif ((body as { full?: unknown } | undefined)?.full === true) {\n \t\t\t\t\t// {full: true}: every file in the agent's view, as a first sync answers (#37).\n \t\t\t\t\tconst history = project as ProjectCalls & Partial<ProjectHistory>;\n-\t\t\t\t\tif (!history.syncFull) return fail(501, \"a full sync needs the engine\");\n+\t\t\t\t\tif (!history.syncFull) return fail(501, \"a full pull needs the engine\");\n \t\t\t\t\tif (label !== undefined && typeof label !== \"string\") return fail(400, \"label must be a label name\");\n \t\t\t\t\treturn { status: 200, body: history.syncFull(agent, label as string | undefined) };\n \t\t\t\t}\n@@ -464,6 +484,8 @@\n \t\t\tcase \"land\": {\n \t\t\t\tconst message = (body as { message?: string })?.message;\n \t\t\t\tif (typeof message !== \"string\" || !message.trim()) return fail(400, \"land needs {message} saying why\");\n+\t\t\t\tconst unseen = unseenError(\"the message\", message);\n+\t\t\t\tif (unseen) return fail(400, unseen);\n \t\t\t\treturn { status: 200, body: project.land(agent, message) };\n \t\t\t}\n \t\t\tcase \"draft-sync\":\n@@ -489,6 +511,8 @@\n \t\t\t\tif (!history.amend) return fail(501, \"amend needs the engine\");\n \t\t\t\tconst message = (body as { message?: unknown } | undefined)?.message;\n \t\t\t\tif (typeof message !== \"string\" || !message.trim()) return fail(400, \"amend needs {message}\");\n+\t\t\t\tconst unseen = unseenError(\"the message\", message);\n+\t\t\t\tif (unseen) return fail(400, unseen);\n \t\t\t\treturn { status: 200, body: history.amend(agent, message) };\n \t\t\t}\n \t\t\t// Pluck (#27): take some versions of a named draft into shared.\n@@ -505,6 +529,8 @@\n \t\t\t\tif (!Array.isArray(b.versions) || b.versions.length === 0 || !b.versions.every((v) => Number.isInteger(v)))\n \t\t\t\t\treturn fail(400, \"pluck needs {versions: [number]}\");\n \t\t\t\tif (typeof b.message !== \"string\" || !b.message.trim()) return fail(400, \"pluck needs {message} saying why\");\n+\t\t\t\tconst unseen = unseenError(\"the message\", b.message);\n+\t\t\t\tif (unseen) return fail(400, unseen);\n \t\t\t\treturn {\n \t\t\t\t\tstatus: 200,\n \t\t\t\t\tbody: history.pluck(agent, b.draft, b.versions as number[], b.message, b.withDependencies === true),\n@@ -518,6 +544,8 @@\n \t\t\t\tif (!Array.isArray(b.versions) || b.versions.length === 0 || !b.versions.every((v) => Number.isInteger(v)))\n \t\t\t\t\treturn fail(400, \"drop needs {versions: [number], message}\");\n \t\t\t\tif (typeof b.message !== \"string\" || !b.message.trim()) return fail(400, \"drop needs {message} saying why\");\n+\t\t\t\tconst unseen = unseenError(\"the message\", b.message);\n+\t\t\t\tif (unseen) return fail(400, unseen);\n \t\t\t\treturn { status: 200, body: history.drop(agent, b.versions as number[], b.message, b.withDependents === true) };\n \t\t\t}\n \t\t\t// Announcements, and news without an edit.\n@@ -535,6 +563,8 @@\n \t\t\t\tif (!history.note || !history.closeNote) return fail(501, `${op} needs the engine`);\n \t\t\t\tconst b = (body ?? {}) as Record<string, unknown>;\n \t\t\t\tif (op === \"note-close\") return { status: 200, body: history.closeNote(agent, b.id as number, b.how) };\n+\t\t\t\tconst unseen = unseenError(\"the note\", b.text);\n+\t\t\t\tif (unseen) return fail(400, unseen);\n \t\t\t\treturn { status: 200, body: history.note(agent, b) };\n \t\t\t}\n \t\t\tcase \"announce\":\n@@ -544,6 +574,8 @@\n \t\t\t\tif (op === \"news\") return { status: 200, body: history.news(agent) };\n \t\t\t\tconst b = (body ?? {}) as { text?: unknown; to?: unknown };\n \t\t\t\tif (typeof b.text !== \"string\" || !b.text.trim()) return fail(400, \"announce needs {text}\");\n+\t\t\t\tconst unseen = unseenError(\"the text\", b.text);\n+\t\t\t\tif (unseen) return fail(400, unseen);\n \t\t\t\tif (b.to !== undefined && (!Array.isArray(b.to) || !b.to.every((a) => typeof a === \"string\")))\n \t\t\t\t\treturn fail(400, \"to must be a list of agent names\");\n \t\t\t\treturn { status: 200, body: history.announce(agent, b.text, b.to as string[] | undefined, how) };\n@@ -555,6 +587,8 @@\n \t\t\t\tconst b = (body ?? {}) as { text?: unknown; files?: unknown; issue?: unknown; done?: unknown };\n \t\t\t\tif (b.text !== null && (typeof b.text !== \"string\" || !b.text.trim()))\n \t\t\t\t\treturn fail(400, \"starting needs {text}, or {text: null} to take it back\");\n+\t\t\t\tconst unseen = unseenError(\"the note\", b.text);\n+\t\t\t\tif (unseen) return fail(400, unseen);\n \t\t\t\tif (b.files !== undefined && (!Array.isArray(b.files) || !b.files.every((f) => typeof f === \"string\")))\n \t\t\t\t\treturn fail(400, \"files must be a list of paths\");\n \t\t\t\t// issue (#54): the issue the note works on; done: a take-back because the work is finished, closing it."}],"unmatched":[]}