{"draft":null,"from":72,"to":73,"files":[{"path":"worker/project/http.ts","added":18,"removed":0,"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@@ -429,6 +431,8 @@\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\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@@ -466,6 +470,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@@ -491,6 +497,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@@ -507,6 +515,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@@ -520,6 +530,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@@ -537,6 +549,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@@ -546,6 +560,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@@ -557,6 +573,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":[]}