/** * The assistant door to a meeting's summary: a * person's own assistant over Cotton MCP reads a meeting's lines and writes * its summary, actions, summarised_by (its own name) and summarised_at, and * one meetings_action row per action — the same columns the Mac's local * model writes. Checked against the shipped definitions with the record * tools' own validation; every value is invented. */ import { describe, expect, it } from "vitest"; import { parseTable } from "../src/definitions.ts"; import { KITS } from "../src/kits.ts"; import { validateCreate, validatePatch } from "../src/mcp/tools/records/values.ts"; import { Table } from "../src/mcp/tools/records/table.ts"; const ASSISTANT = "an-assistants-token"; function shipped(id: string): Table { const raw = KITS.meetings!.tables.find((t) => t.id === id) as Record | undefined; expect(raw, `Meetings ships ${id}`).toBeDefined(); return new Table(parseTable(raw!)!); } function refusal(fn: () => unknown): string { try { fn(); } catch (error) { return (error as Error).message; } return ""; } /** RULE (meetings-summaries, 17 Nov 2026): an assistant over MCP may write a meeting's summary, actions, summarised_by and summarised_at, and make its action rows; what the transcriber and the core work out stays theirs. */ describe("an assistant summarises a meeting", () => { it("writes the meeting's summary columns, stamped with its own name", () => { const meeting = shipped("meetings_meeting"); const patch = validatePatch(meeting, { summary: "- The quote is split in two phases.", actions: "Send the revised quote — Ben (S2), by Thu 19 Nov", summarised_by: "Claude", summarised_at: "2026-11-17T12:00:00.000Z" }, ASSISTANT); expect(patch.summarised_by).toBe("Claude"); for (const key of ["status", "lines", "transcribed_by", "summary_why", "summary_asked_at"]) { expect(refusal(() => validatePatch(meeting, { [key]: key === "lines" ? 3 : "ready" }, ASSISTANT)), key).toBe(`"${key}" is read only`); } }); it("makes an action row with words, who, day and its own name, never the todo link the core writes", () => { const action = shipped("meetings_action"); const made = validateCreate(action, { meeting: "m-1", position: 1, words: "Send the revised quote", who: "S2", due: "2026-11-19", due_said: "by Thursday", at_ms: 61_000, made_by: "Claude" }, ASSISTANT); expect(made).toMatchObject({ words: "Send the revised quote", who: "S2", due: "2026-11-19", made_by: "Claude" }); expect(refusal(() => validateCreate(action, { meeting: "m-1", words: "x", todo: "t-1" }, ASSISTANT))).toBe('"todo" is read only'); expect(refusal(() => validateCreate(action, { meeting: "m-1" }, ASSISTANT))).toBe('"words" is required'); }); });