@ofrnsb/whiteboard 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -2
- package/dist/boards-ykaNj5ns.d.ts +540 -0
- package/dist/chunk-ORDEALPW.js +1981 -0
- package/dist/chunk-ORDEALPW.js.map +1 -0
- package/dist/cli/index.js +2272 -0
- package/dist/core/index.d.ts +1495 -0
- package/dist/core/index.js +809 -0
- package/dist/core/index.js.map +1 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.js +3745 -0
- package/dist/index.js.map +1 -0
- package/dist/style.css +794 -0
- package/package.json +70 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/service.ts","../../src/core/agent-copy.ts","../../src/core/agent.ts"],"sourcesContent":["// A board's life on a server, as pure functions over Board objects: making it, editing it with a versioned history,\n// who is working on it, keeping or undoing the agent's work, and going back to a version. Storage, ids for the\n// organisation and the pauses between an agent's drawing steps belong to the host (see the CLI for one in another\n// language). Ported from simpul's platform/boards.ts.\nimport { z } from \"zod\";\nimport {\n applyOps, boardAt, BRUSHES, COL_TYPES, contentOf, foldIntoBase, NOTE_COLORS, opKeys, PENS, pendingBatchOf, planOf, ROUTES, SHAPES, stepsOf, TEXT_SIZES,\n type Board, type BoardActivity, type BoardChat, type BoardEdit, type BoardMode, type BoardOp, type BuildStep, type PendingBatch, type PlannedItem,\n} from \"./boards\";\nimport { BOARD_STEPS } from \"./agent-copy\";\nimport { BOARD, BOARD_CHATS_KEPT, BOARD_EDITS_KEPT, BOARD_HISTORY, COUNT, LEN } from \"./config\";\nimport { ERR, WORDS } from \"./copy\";\n\nconst maxEdits = (b: Board) => (b.mode === \"whiteboard\" ? BOARD_HISTORY.whiteboardEdits : BOARD_EDITS_KEPT);\n\n/** More about an edit: the agent's reason, and who is now working on the board (null clears it). */\nexport type EditMore = { why?: string; activity?: Omit<BoardActivity, \"at\"> | null; batch?: string; told?: boolean };\n\n/** The conversation acting on a board. */\nexport type Via = { chatId: string; userId: string };\n\n/** Ops are kept when small enough to store; a step without them cannot be replayed, so the base moves past it. */\nconst keepable = (ops: BoardOp[]) => ops.length <= BOARD_HISTORY.opsMax && JSON.stringify(ops).length <= BOARD_HISTORY.opsBytes;\n\n/**\n * Appends the edit that turned `prev` into `next`, with its ops, and trims the history. The base always sits just\n * before the oldest replayable edit, so base + the kept ops rebuild `next` exactly (boardAt).\n */\nfunction withEdit(prev: Board, next: Board, e: Omit<BoardEdit, \"version\" | \"ops\">, ops: BoardOp[], more: EditMore = {}): Board {\n const kept = keepable(ops);\n let base = kept ? prev.base ?? contentOf(prev) : contentOf(next);\n const edits: BoardEdit[] = [...prev.edits, { ...e, version: next.version, ...(more.why ? { why: more.why.slice(0, LEN.line) } : {}), ...(more.batch ? { batch: more.batch } : {}), ...(more.told ? { told: true } : {}), ...(kept ? { ops } : {}) }];\n const shell = { ...next, edits: [] };\n while (edits.length > maxEdits(next)) base = foldIntoBase(base, edits.shift()!, shell);\n const activity = more.activity === null ? undefined : more.activity ? { ...more.activity, at: next.updatedAt } : prev.activity;\n return { ...next, edits, base, activity };\n}\n\n/** One piece of agent work (one tool call): its edits share the id, so the piece can be kept or undone as one. */\nexport const newBatch = () => `bt_${crypto.randomUUID().replace(/-/g, \"\").slice(0, 10)}`;\n\n/** A short reference people can say and the agent can quote: WB-2611-AB12. */\nexport const newRef = (mode: BoardMode) => {\n const d = new Date();\n return `${mode === \"sheet\" ? \"SH\" : mode === \"tasks\" ? \"TB\" : \"WB\"}-${String(d.getFullYear()).slice(2)}${String(d.getMonth() + 1).padStart(2, \"0\")}-${crypto.randomUUID().slice(0, 4).toUpperCase()}`;\n};\n\nconst RANK: Record<BoardChat[\"what\"], number> = { read: 0, edited: 1, created: 2 };\n\n/** Remembers the conversation on the board; a chat keeps its strongest link (made it > changed it > read it). */\nexport function withChat(b: Board, via: Via | undefined, what: BoardChat[\"what\"], at = new Date().toISOString()): Board {\n if (!via) return b;\n const prev = b.chats?.find((c) => c.chatId === via.chatId);\n const kept: BoardChat = { chatId: via.chatId, userId: via.userId, at, what: prev && RANK[prev.what] > RANK[what] ? prev.what : what };\n return { ...b, chats: [kept, ...(b.chats ?? []).filter((c) => c.chatId !== via.chatId)].slice(0, BOARD_CHATS_KEPT) };\n}\n\n/** Who owns the board in the host: its organisation (tenant), team (unit) and project. */\nexport type Owner = { tenantId: string; unitId?: string; projectId?: string | null };\n\nexport type CreateInput = { title: string; mode?: BoardMode; id?: string; ref?: string };\n\n/** A new board, made by a person (`agent` false, `by` their name) or by the agent, with its first ops applied. */\nexport function createBoard(owner: Owner, input: CreateInput, ops: BoardOp[], agent: boolean, by: string, via?: Via, more: EditMore = {}): Board {\n const now = new Date().toISOString();\n const mode = input.mode ?? \"whiteboard\";\n const who = agent ? WORDS.agent : by;\n const empty: Board = {\n id: input.id ?? `brd_${crypto.randomUUID().replace(/-/g, \"\").slice(0, 12)}`, ref: input.ref ?? newRef(mode),\n tenantId: owner.tenantId, unitId: owner.unitId ?? owner.tenantId, projectId: owner.projectId ?? null,\n title: input.title.trim().slice(0, LEN.title) || WORDS.untitled, mode,\n createdBy: by, createdAt: now, updatedAt: now, updatedBy: who, version: 0,\n frames: [], notes: [], links: [], tabs: [], edits: [],\n };\n const b = applyOps(empty, ops, who, now);\n const made = withEdit(empty, b, { at: now, by: who, agent, what: agent ? ERR.membuatPapan : WORDS.created, keys: [] }, ops, more);\n return withChat({ ...made, base: made.base ?? contentOf(empty) }, via, \"created\", now);\n}\n\n/** `keys` overrides what gets outlined, so tidying the layout after a change does not light up every note. */\nexport function editBoard(board: Board, ops: BoardOp[], agent: boolean, by: string, what: string, keys = opKeys(ops), via?: Via, more: EditMore = {}): Board {\n if (!ops.length) return board;\n const who = agent ? WORDS.agent : by;\n const next = applyOps(board, ops, who);\n const done = withEdit(board, next, { at: next.updatedAt, by: who, agent, what, keys: [...new Set(keys)].slice(0, 400) }, ops, more);\n return withChat(done, via, \"edited\", next.updatedAt);\n}\n\n/** Shows who is at work on the board; the content and its version stay as they are. */\nexport function setActivity(board: Board, activity: Omit<BoardActivity, \"at\"> | null): Board {\n return { ...board, activity: activity ? { ...activity, at: new Date().toISOString() } : undefined };\n}\n\n/** The activity while it is fresh; an agent that stopped (or a tab that closed) fades out on its own. */\nexport function liveActivity(board: Board, now = Date.now()): BoardActivity | null {\n const a = board.activity;\n return a && now - Date.parse(a.at) < BOARD_HISTORY.activityMs ? a : null;\n}\n\n/** The board as a browser gets it: no stored ops or base (history has its own call), a stale activity dropped. */\nexport function publicBoard(b: Board): Board & { pendingBatch: PendingBatch | null } {\n const { base: _base, activity: _a, ...rest } = b;\n const activity = liveActivity(b);\n return { ...rest, edits: b.edits.map(({ ops: _ops, ...e }) => e), ...(activity ? { activity } : {}), pendingBatch: pendingBatchOf(b) };\n}\n\n/** What a browser polling at `since` gets: nothing new when the board is still at that version. */\nexport function snapshot(b: Board, since?: number) {\n return since === b.version\n ? { same: true, version: b.version, activity: liveActivity(b), pendingBatch: pendingBatchOf(b) }\n : { board: publicBoard(b) };\n}\n\n/** The read reason of each kind of build step, shown in the history and to anyone watching. */\nconst STEP_WHY: Record<BuildStep[\"kind\"], (s: BuildStep) => string> = {\n frame: () => BOARD_STEPS.frame,\n road: () => BOARD_STEPS.road,\n marks: (s) => {\n const labels = s.ops.flatMap((o) => (o.op === \"note.add\" && o.note.shape === \"pill\" && o.note.text ? [o.note.text] : []));\n return labels.length > 1 ? BOARD_STEPS.marksRange(labels[0], labels[labels.length - 1]) : BOARD_STEPS.marks;\n },\n cards: (s) => BOARD_STEPS.cards(s.ops.flatMap((o) => (o.op === \"note.add\" ? [o.note.title || o.note.text] : [])).filter(Boolean).slice(0, 3)),\n changes: () => BOARD_STEPS.changes,\n links: () => BOARD_STEPS.links,\n stickers: () => BOARD_STEPS.stickers,\n};\n\n/**\n * One edit the agent makes in a build, and how long the host should wait after saving it so anyone watching sees the\n * board grow (the plan is shown first: `planFirst` asks the host to save the activity alone, then pause).\n */\nexport type AgentStep = { ops: BoardOp[]; what: string; why: string; activity: Omit<BoardActivity, \"at\">; told?: boolean; pauseMs: number; planFirst?: boolean };\n\nconst gap = (n: number) => (n > 1 ? Math.min(BOARD_HISTORY.stepMs, Math.floor(BOARD_HISTORY.stepsTotalMs / (n - 1))) : 0);\n\n/** The agent's ops cut into visible steps (a frame, then its cards two at a time, then links...), each with its reason. */\nexport function buildSteps(ops: BoardOp[], batch: string, via?: Via, what?: string, why?: string, planFirst = false): AgentStep[] {\n const steps = stepsOf(ops, BOARD_HISTORY.cardsPerStep);\n const plan = planOf(ops, BOARD_HISTORY.planMax);\n const pauseMs = gap(steps.length);\n return steps.map((s, i) => ({\n ops: s.ops,\n what: i === 0 && what ? what : BOARD_STEPS.what[s.kind],\n why: i === 0 && why ? why : STEP_WHY[s.kind](s),\n activity: { by: WORDS.agent, agent: true, what: BOARD_STEPS.what[s.kind], ...(via ? { chatId: via.chatId } : {}), keys: opKeys(s.ops).slice(0, 60), plan, batch },\n pauseMs,\n ...(i === 0 && planFirst && plan.length ? { planFirst: true } : {}),\n }));\n}\n\n/** Beats told one at a time (draw_whiteboard): each its own edit carrying what was said, held long enough to read. */\nexport function toldSteps(beats: { say: string; ops: BoardOp[] }[], batch: string, via?: Via, why?: string): AgentStep[] {\n const P = BOARD_HISTORY.beat;\n return beats.map((bt, i) => ({\n ops: bt.ops,\n what: bt.say.slice(0, P.sayChars),\n why: i === 0 ? why?.trim() || bt.say : bt.say,\n activity: { by: WORDS.agent, agent: true, what: bt.say.slice(0, P.sayChars), ...(via ? { chatId: via.chatId } : {}), keys: opKeys(bt.ops).slice(0, 60), plan: planOf(bt.ops, BOARD_HISTORY.planMax), batch },\n told: true,\n pauseMs: Math.min(P.maxMs, P.baseMs + P.perItemMs * bt.ops.length),\n }));\n}\n\n/** The plan of a piece of work as activity alone, for the pause before its first step lands. */\nexport const planActivity = (ops: BoardOp[], what: string, batch: string, via?: Via): Omit<BoardActivity, \"at\"> & { plan: PlannedItem[] } => {\n const plan = planOf(ops, BOARD_HISTORY.planMax);\n return { by: WORDS.agent, agent: true, what, ...(via ? { chatId: via.chatId } : {}), keys: plan.map((p) => p.id).slice(0, 60), plan, batch };\n};\n\n/** Applies one agent step to a board (new or existing) as its own edit. */\nexport function applyStep(owner: Owner, target: Board | CreateInput, step: AgentStep, via?: Via): Board {\n const more = { why: step.why, activity: step.activity, batch: step.activity.batch, told: step.told };\n if (\"edits\" in target) return editBoard(target, step.ops, true, WORDS.agent, step.what, undefined, via, more);\n return createBoard(owner, target, step.ops, true, WORDS.agent, via, more);\n}\n\nconst decide = (b: Board, batch: string, by: string, how: \"kept\" | \"undone\", at = new Date().toISOString()): Board =>\n ({ ...b, edits: b.edits.map((e) => (e.batch === batch ? { ...e, decided: { by, at, how } } : e)) });\n\n/** Accepts the agent's work: recorded on its edits (history shows who kept it), the content and version unchanged. */\nexport function keepBatch(board: Board, batch: string, by: string): Board | { error: string } {\n if (!board.edits.some((e) => e.batch === batch)) return { error: ERR.batchNotFound };\n return decide(board, batch, by, \"kept\");\n}\n\n/**\n * Takes the agent's work back: the board returns to the version just before the batch's first edit, as a new edit.\n * Refused (with who) when someone else changed the board after the agent did, so their work is never dropped silently.\n */\nexport function undoBatch(board: Board, batch: string, by: string): Board | { error: string; conflict?: true } {\n const mine = board.edits.filter((e) => e.batch === batch);\n const first = mine[0];\n if (!first?.version) return { error: ERR.batchNotFound };\n const after = board.edits.filter((e) => (e.version ?? 0) > first.version! && e.batch !== batch && e.ops?.length !== 0);\n const others = [...new Set(after.map((e) => (e.by === by ? WORDS.you : e.by)))];\n if (others.length) return { error: ERR.batchChangedSince(others), conflict: true };\n const then = boardAt(board, first.version - 1);\n if (!then) return { error: ERR.versionNotKept(first.version - 1) };\n const back = editBoard(board, [{ op: \"restore\", to: contentOf(then) }], false, by, BOARD_STEPS.undoWhat, [], undefined, { why: BOARD_STEPS.undoWhy(first.why || first.what), activity: null });\n return decide(back, batch, by, \"undone\");\n}\n\n/** Makes an earlier version current again, as a new edit, so the restore itself can be undone. */\nexport function restoreBoard(board: Board, version: number, by: string): Board | { error: string } {\n const then = boardAt(board, version);\n if (!then) return { error: ERR.versionNotKept(version) };\n return editBoard(board, [{ op: \"restore\", to: contentOf(then) }], false, by, BOARD_STEPS.restoreWhat, [], undefined, { why: BOARD_STEPS.restoreWhy(version), activity: null });\n}\n\n// ---------- Validating ops that arrive from browsers (never the server-only restore) ----------\nconst id = z.string().min(1).max(LEN.id);\nconst n = z.number().finite();\nconst color = z.enum(NOTE_COLORS);\nconst cell = z.union([z.string().max(LEN.text), z.number().finite(), z.boolean(), z.null()]);\nconst col = z.object({ id, name: z.string().max(LEN.name), type: z.enum(COL_TYPES), options: z.array(z.string().max(LEN.label)).max(COUNT.wide).optional(), formula: z.string().max(LEN.line).optional(), total: z.enum([\"sum\", \"avg\", \"count\"]).nullable().optional(), width: n.optional() });\nconst notePatch = z.object({\n text: z.string().max(BOARD.maxText), x: n, y: n, w: n, h: n, color, frame: z.string().max(LEN.id).nullable(), owner: z.string().max(LEN.label), due: z.string().max(LEN.id),\n shape: z.enum(SHAPES), title: z.string().max(LEN.title), size: z.enum(TEXT_SIZES), points: z.array(n).max(COUNT.points),\n icon: z.string().max(LEN.short), pen: z.enum(PENS), dashed: z.boolean(), pressure: z.array(n).max(COUNT.points), brush: z.enum(BRUSHES), weight: n,\n}).partial();\nconst framePatch = z.object({ title: z.string().max(LEN.title), subtitle: z.string().max(LEN.line), x: n, y: n, w: n, h: n }).partial();\nconst linkPatch = z.object({ label: z.string().max(LEN.name), route: z.enum(ROUTES), dashed: z.boolean(), arrow: z.enum([\"end\", \"both\", \"none\"]) }).partial();\n\nexport const OpSchema: z.ZodType<BoardOp> = z.discriminatedUnion(\"op\", [\n z.object({ op: z.literal(\"title\"), title: z.string().max(LEN.title) }),\n z.object({ op: z.literal(\"note.add\"), note: notePatch.extend({ id, text: z.string().max(BOARD.maxText), x: n, y: n }) }),\n z.object({ op: z.literal(\"note.update\"), id, patch: notePatch }),\n z.object({ op: z.literal(\"note.remove\"), id }),\n z.object({ op: z.literal(\"frame.add\"), frame: framePatch.extend({ id, title: z.string().max(LEN.title), x: n, y: n }) }),\n z.object({ op: z.literal(\"frame.update\"), id, patch: framePatch }),\n z.object({ op: z.literal(\"frame.move\"), id, dx: n, dy: n }),\n z.object({ op: z.literal(\"frame.remove\"), id, keepNotes: z.boolean().optional() }),\n z.object({ op: z.literal(\"link.add\"), link: linkPatch.extend({ id, from: id, to: id }) }),\n z.object({ op: z.literal(\"link.update\"), id, patch: linkPatch }),\n z.object({ op: z.literal(\"link.remove\"), id }),\n z.object({ op: z.literal(\"tab.add\"), tab: z.object({ id, name: z.string().max(LEN.name), columns: z.array(col).max(COUNT.wide).optional() }) }),\n z.object({ op: z.literal(\"tab.rename\"), tab: id, name: z.string().max(LEN.name) }),\n z.object({ op: z.literal(\"tab.remove\"), tab: id }),\n z.object({ op: z.literal(\"col.add\"), tab: id, col, at: z.number().int().min(0).optional() }),\n z.object({ op: z.literal(\"col.update\"), tab: id, id, patch: col.omit({ id: true }).partial() }),\n z.object({ op: z.literal(\"col.remove\"), tab: id, id }),\n z.object({ op: z.literal(\"row.add\"), tab: id, row: z.object({ id, cells: z.record(z.string(), cell) }), at: z.number().int().min(0).optional() }),\n z.object({ op: z.literal(\"row.remove\"), tab: id, id }),\n z.object({ op: z.literal(\"cell.set\"), tab: id, row: id, col: id, value: cell }),\n]) as z.ZodType<BoardOp>;\n\n/** A person's edits as a browser sent them, or the problems with them. */\nexport const PatchInput = z.object({ ops: z.array(OpSchema).min(1).max(COUNT.bulk) });\n","// The agent tools' words: descriptions, argument hints and results (from simpul copy/domain.ts and copy/server.ts).\nimport { ILLUSTRATIONS } from \"./illustrations\";\nimport { LINE_ICONS } from \"./line-icons\";\nexport const TK_BOARDS = {\n agent: \"Agent\",\n sheetKind: \"sheet\",\n boardKind: \"whiteboard\",\n sheetShort: \"sheet\",\n boardShort: \"board\",\n tasksKind: \"task board\",\n /** The card title field of a task board the agent makes. */\n taskTitle: \"Task\",\n tasksShort: \"tasks\",\n arg: {\n why: \"one line in the user's language (English by default): why this change, grounded in the business rule or the data behind it (e.g. \\\"Day 21 added: at most 1 reminder per 7 days\\\"). It is read out when the board's history is replayed.\",\n noteOwner: \"person responsible, by name\",\n noteDue: \"due date as the user would read it, e.g. 14 Nov\",\n options: \"choices for a select column\",\n formula: \"computed column, e.g. {Qty} * {Price}; refers to other columns by name in braces\",\n total: \"footer total for this column\",\n itemKey: \"your name for this item, to connect it\",\n shape: \"note (sticky card, default in grid, row, timeline, matrix), box (default in stack, flow, diagram), text, ellipse, cloud (an outside service), cylinder (a database), sticker (a big illustration on its own: its name in icon, an optional caption in text)\",\n itemTitle: \"bold first line, e.g. Agent core\",\n color: \"paper (default box), ink = the one highlighted element, red = needs action, outline = not built yet, new = new in this step; tints yellow, blue, green, pink, purple, gray group things; sand, peach, orange are the warm card tones of a timeline (picked for you)\",\n icon: `a drawing for this item, by name. Line drawings for a marker sketch: ${LINE_ICONS.join(\", \")}. Full-colour illustrations for a sticker or a sticky note: ${ILLUSTRATIONS.join(\", \")}. Never an emoji.`,\n when: \"timeline only: the milestone on the road, e.g. Day 7, Week 2, 14 Nov\",\n cell: \"matrix only: [column, row] by header name or number, e.g. [\\\"Wednesday\\\", \\\"Week 2\\\"]\",\n across: \"matrix only: column headers left to right, e.g. Monday…Friday\",\n down: \"matrix only: row headers top to bottom, e.g. Week 1…4, or owners\",\n heading: \"big title and one-line subtitle with the concrete scope and numbers; icon is one illustration (by name) shown as a sticker beside the title\",\n at: \"diagram layout only: [column, row]\",\n box: \"[x, y, width, height]. Lay the story out left to right, then start a new row below; keep each beat's items together and leave 30 to 60 between neighbours. A block of 260 to 360 wide holds a title and one line; a wide block (500+) with size l or xl is for the one thing that must be seen; text notes 300 to 500 wide\",\n tone: \"what kind of thing it is, which sets its colour everywhere: fact (black), problem (red, what goes wrong), action (green, what we do), insight (purple, what it means), person (blue, a person, team or desk), system (orange, a system or data store)\",\n freeKey: \"a short name for this item, unique on the board, used by links (\\\"calls\\\", \\\"no-offer\\\", \\\"mb-787860\\\")\",\n itemX: \"where the item's left edge goes, in pixels from the left of the drawing space; the board is as wide as you need (3,000 to 5,000 is normal)\",\n itemY: \"where the item's top goes, in pixels from the top of the drawing space under the headline\",\n form: \"the item's shape: rect (default), square, circle, ellipse, diamond (a decision or a question), triangle (a warning or a peak), pentagon, hexagon (a process step), parallelogram (an input or a record), cylinder (a system or data store), cloud (outside the company), pill (a short tag), sticky (a yellow note in your voice), text (bare lettering: a caption, a heading over a group)\",\n itemW: \"width in pixels; leave out for the size's normal width (s 240, m 300, l 380, xl 480). For a horizontal bar chart, make each bar's width proportional to its value, scaled so the smallest bar is at least 150 wide (never narrower: its words must fit)\",\n itemH: \"height in pixels, at least what the words need (it grows to fit them). For a vertical bar chart, give every bar the same width (150 or more), its height proportional to its value, all on one baseline; a bar's own words are only its label and figure (the explanation goes in a text item or note beside the chart), so even a short bar keeps its true height\",\n layer: \"how deep in the explanation this item sits: 0 the main flow (the story's spine), 1 what a main item breaks down into, 2 what that breaks down into, and so on to 9. Wires take a colour per layer (black along the main flow), so a reader can follow one level of detail across the board\",\n qWhy: \"why it is so: the cause, the rule or the reason, with the evidence\",\n qWho: \"who: the customer, agent, desk, team or owner, by name\",\n qWhen: \"when: the date, period, deadline or how often\",\n qWhere: \"where: the desk, channel, branch, system or step it happens in\",\n qHow: \"how: the method, the source of the figure (system, table, filter) or the steps taken\",\n qHowMuch: \"how much or how many: the amount, count, rate or cost, with its unit\",\n qAssumes: \"what this figure or claim rests on that the data does not prove: a past rate that still holds, a price from the catalogue, a definition you chose, a period you picked\",\n freeTitle: \"what this is, with its number when it has one (\\\"950 eligible callers\\\"). Short: it is lettered in capitals\",\n itemText: \"what it means in plain words, the line a newcomer needs (\\\"asked for a product, do not hold it, no complaint open on the call\\\")\",\n linkFrom: \"key of the item the wire starts at (drawn in this beat or an earlier one)\",\n linkTo: \"key of the item the wire ends at, with the arrowhead\",\n linkLabel: \"a few words on the wire saying what happens along it (\\\"603 of them\\\", \\\"because\\\", \\\"hands over to\\\")\",\n beatItems: \"the items drawn while saying this beat's sentence\",\n beatLinks: \"the wires drawn in this beat, each between two keyed items\",\n nodeNote: \"a remark you would make out loud about this thing, stuck beside it as a yellow sticky note (the so-what, a caution, the source)\",\n say: \"what you would say aloud while drawing this beat, one sentence a listener could follow with their eyes closed (\\\"Of those 1,147, only 950 can actually be offered something\\\")\",\n size: \"lettering size: s for fine print and definitions, m normal, l for what matters, xl for the one number the board is about\",\n itemLine: \"the line under the title: the figure and what it means in plain words\",\n beatConnectors: \"arrows drawn in this beat, between keyed items (from this beat or an earlier one), each with a label saying what happens on it: how many move on, how many drop and why, who hands over to whom\",\n pen: \"the marker this item is drawn in (black, blue, green, red, purple, orange): its outline, words and drawing take that colour. Use colour to carry meaning across the board (one colour per idea or side), not decoration\",\n dashed: \"draw the outline as dashes: something optional, planned, not there yet, or a loose group around other items\",\n marks: \"what a person does with a marker to make a point: ring (circle an item), underline, highlight (yellow marker through it), cross (strike it out), tick. Give the item's key; the board draws the mark properly round it\",\n strokes: \"free layout only: lines you draw by hand over the items, each a list of [x, y] points in the same space: an underline under the key figure, a bracket, a divider between two halves, an axis, a curved arrow; three or four points are enough, the board smooths them into one flowing line. To circle or underline an item use marks instead. marker true for a thick highlighter\",\n layout: \"always free\",\n beside: \"place right of the previous section instead of below\",\n route: \"elbow (default), straight, or curve (default between matrix items)\",\n sectionSubtitle: \"one line under the section title saying what goes in it\",\n noteTitle: \"bold first line of the sticky (at most 4 words)\",\n board: \"board ref (WB-…/SH-…) or id, from create_*, list_boards or the user's message\",\n },\n notFound: (key: string) => `Board ${key} is not in this team. Find it with list_boards.`,\n wrongKind: (ref: string, kind: string) => `${ref} is a ${kind}; use the tools for that kind.`,\n badFormula: (name: string) => `The formula in column ${name} is not valid: use {Column name}, numbers, + - * / and brackets.`,\n formulaMissing: (name: string, refs: string) => `The formula in column ${name} refers to columns that do not exist: ${refs}.`,\n sheetSummary: (tabs: number, rows: number) => `${tabs} tabs, ${rows} rows`,\n tasksSummary: (lanes: string, cards: number) => `${cards} cards in lanes ${lanes}`,\n boardSummary: (sections: number, notes: number) => `${sections} sections, ${notes} notes`,\n listSep: \", \",\n problemSep: \"; \",\n skipped: (problems: string) => ` Skipped: ${problems}.`,\n createWhiteboard: {\n description: \"Make a sticky-note board the team edits with you: a heading, then sections (frames) with a one-line description, of big square sticky notes coloured by meaning (green went well, pink a problem, blue an idea, purple a risk). Use for retros, brainstorms and risk or stakeholder maps. For a plan, rollout, timeline, schedule or any explanation use draw_whiteboard. Write each note as a short title and one line. Show it with present: whiteboard block and the ref.\",\n layout: \"columns: sections side by side; timeline: phases left to right joined by arrows; grid: many sections in rows. A plan or explanation over time is drawn with draw_whiteboard instead\",\n running: (title: string) => `Building board ${title}`,\n done: (title: string) => `Board ${title} built`,\n result: (id: string, ref: string, title: string, summary: string) => `ref=${id} board ${ref} \"${title}\": ${summary}. Show it with present (whiteboard, this ref). The team can add notes; read it again with read_board.`,\n },\n createSheet: {\n description: \"Make a spreadsheet the team edits with you: tabs, typed columns (text, number, money, date, select with options, check), formulas between columns ({Qty} * {Price}) and footer totals. Fill rows yourself, or from a rows result with from_ref (its columns come along). Use only when the user asks for a sheet or wants something the team will keep filling in: trackers, budgets, checklists with owners. Never to answer a question: a ranking, a comparison, rates or totals from the data are shown as a built screen with present (figures, rings, bars), not as a sheet. Show it with present: sheet block and the ref.\",\n rows: \"values in column order (formula columns skipped), or objects keyed by column name\",\n fromRef: \"fill this tab from a rows result: its columns and rows\",\n running: (title: string) => `Building sheet ${title}`,\n done: (title: string) => `Sheet ${title} built`,\n result: (id: string, ref: string, title: string, summary: string) => `ref=${id} sheet ${ref} \"${title}\": ${summary}. Show it with present (sheet, this ref).`,\n },\n createTaskboard: {\n description: \"Make a task board the team works on with you: lanes in process order (any process: To do, In progress, Done; Lead, Qualified, Won; Admitted, Ward, Discharged), cards with a title and fields (owner, due date, priority, anything the work needs). People drag cards between lanes themselves; you move, add and assign them with update_taskboard. Use when the user wants to track work, a pipeline or a queue the team keeps moving. For records that live in a company system, show them as a board block instead: those moves are writes.\",\n lane: \"name of the lane field, in the team's words (Status, Stage, Tahap)\",\n lanes: \"the lanes, in process order\",\n fields: \"card fields beside the title and lane: owner, due date, priority...\",\n cards: \"objects keyed by field name: the title field, the lane field (one of the lanes), and any other field\",\n running: (title: string) => `Building task board ${title}`,\n done: (title: string) => `Task board ${title} built`,\n result: (id: string, ref: string, title: string, summary: string) => `ref=${id} task board ${ref} \"${title}\": ${summary}. Show it with present (taskboard, this ref).`,\n },\n updateTaskboard: {\n description: \"Change a task board: move cards to another lane (one or many at once), add cards, set card fields (owner, due date...), remove cards, add or rename lanes. Cards are found by their id from read_board, their title, or their 1-based number. Every change is kept in the board's history and the team sees it live.\",\n move: \"cards to move: card (id, title or number) and the lane to put it in\",\n running: \"Updating the task board\",\n done: \"Task board updated\",\n noLane: (lane: string, lanes: string) => `no lane \"${lane}\" (lanes: ${lanes})`,\n noCard: (card: string | number) => `no card \"${card}\"`,\n noField: (field: string) => `no field \"${field}\"`,\n notTasks: (ref: string) => `${ref} is not a task board`,\n edit: \"updated the task board\",\n result: (id: string, ref: string, summary: string, skipped: string) => `ref=${id} task board ${ref}: ${summary}.${skipped} Show it with present (taskboard, this ref).`,\n },\n draw: {\n description: \"Explain something on a whiteboard the way a sharp colleague does standing at one, or the way an investigator pins up an evidence wall, so that someone who was not there understands all of it without asking anything. You compose the board yourself: what goes where, in which shape, how big, and what joins what. Give a headline (the finding in one line), context (period, source, how many, what the terms mean) and beats in the order you would explain them. Each beat has say (the sentence you speak while drawing it; it is pinned up as a sticky note beside that beat), the items you draw in it, and the links you draw in it. Each item has a key, x and y (where its top-left goes, in board pixels, from the top-left of the space under the headline), a form (rect, square, circle, ellipse, diamond, triangle, pentagon, hexagon, parallelogram, cylinder, cloud, pill, sticky, text: whatever suits the thing), a title and text, a layer (0 the main flow, 1 to 9 each level of detail below it), and answers why, who, when, where, how and how much wherever they have an answer (nearly always). Always explain everything in full detail, whether or not the person asked for detail: a board full of detail is the point, not a problem; a reader should never need to ask anything. Say what the board assumes: on each item whose figure rests on an assumption (assumes), and in a closing group of the board headed Assumptions and open questions (its items wired with dashed links to what they underpin). Charts are drawn the same way: bars are rect items sized in proportion to their values (w for horizontal bars, h for vertical bars on one baseline), each labelled with its figure. Put the main finding where the eye lands first, group what belongs together, spread causes around their effect, chain a process along a line, branch a breakdown out from its whole, and drill every part down to the actual calls or records, up to ten layers deep (the part the story is about the deepest). Leave room for wires between things (about 120 to 200 pixels). The board keeps your picture clean: an item that would cover another moves to the nearest free spot, wires are routed around every item, never through one, and their labels sit where the wire still shows. Query your data down to the depth you draw before drawing. tone sets meaning and colour: fact, problem, action, insight, person, system. Use real names, numbers and dates from your tools. No emoji. Leave board out to start a new board with title; pass board to continue an existing one.\",\n headline: \"the finding in one line, as you would write it across the top (\\\"2 in 3 callers who ask never hear an offer\\\")\",\n context: \"one or two lines under the headline: the period, the source, how many, and what a term in the headline means\",\n beats: \"the explanation in the order you would give it, 4 to 12 beats: each beat is what you draw while saying one sentence (one to eight items and the links between them)\",\n skippedKeys: (keys: string[]) => ` Not drawn, keys repeated or not found: ${keys.join(\", \")}.`,\n board: \"existing board ref or id; leave out to make a new board\",\n title: \"title of a new board\",\n running: \"Drawing on the board\",\n writing: \"Planning the board\",\n done: \"Board drawn\",\n needTarget: \"Give title for a new board, or board to add to an existing one.\",\n result: (id: string, ref: string, summary: string, missing: string[]) => `ref=${id} board ${ref}: ${summary}.${missing.length ? ` Connectors skipped, keys not found: ${missing.join(\", \")}.` : \"\"} Show it with present (whiteboard, this ref).`,\n },\n read: {\n description: \"Read a whiteboard (sections and notes with their ids, owners, due dates and who wrote them, including the team's own notes) or a sheet (tabs, columns and rows with formulas computed). Pass note_ids to read only a selection the user asked about.\",\n running: \"Reading the board\",\n done: \"Board read\",\n head: (ref: string, title: string, kind: string, summary: string, by: string) => `${ref} \"${title}\" (${kind}, ${summary}, last changed by ${by}).`,\n },\n updateWhiteboard: {\n description: \"Change a whiteboard: extend a timeline road with new milestones (extend_timeline), add sections or notes (a note without a section sits on its own), move notes between sections (to group by theme: add the theme sections, move each note, then remove the emptied ones), edit (text, owner, due, colour) or remove notes, rename or remove sections, draw or remove arrows between notes or sections (dependencies, flow, cause and effect). Read it first with read_board for the ids. The board tidies itself after moves. Show it again with present (whiteboard) and the returned ref.\",\n extendTimeline: \"carry a timeline road on with new milestones (when, title, text, icon), in order, after the last one: the road is drawn further and each item gets its milestone and card on the right side. Use this, never loose notes, to add steps, phases or dates to a timeline. road: the track id from read_board when the board has more than one road\",\n extendWhat: \"Extending the timeline\",\n noRoad: \"This board has no timeline to extend yet; add one with draw_whiteboard (layout timeline).\",\n noteSection: \"section id or title; leave out for a note on its own\",\n updateLinks: \"restyle arrows: elbow or straight, dashed, label, arrowheads\",\n removeSections: \"section ids or titles; their notes stay on the board unless also removed\",\n addLinks: \"arrows; from and to are note ids, section ids or section titles\",\n removeLinks: \"arrow ids from read_board\",\n running: \"Updating the board\",\n done: \"Board updated\",\n addSections: \"adding sections\",\n edit: \"updating the board\",\n noSection: (s: string) => `section \"${s}\" does not exist`,\n noNote: (id: string) => `note ${id} does not exist`,\n noEnds: (from: string, to: string) => `arrow ${from} → ${to}: an end does not exist`,\n noLink: (id: string) => `arrow ${id} does not exist`,\n result: (id: string, ref: string, summary: string, skipped: string) => `ref=${id} board ${ref}: ${summary}.${skipped}`,\n },\n updateSheet: {\n description: \"Change a sheet: set cells (row by id from read_board or by 1-based number; column by name), add or remove rows, add, change (type, options, formula, total) or remove columns, add tabs or rename the tab. The team sees your changes outlined. Read it first with read_board. Show it again with present (sheet) and the returned ref.\",\n tab: \"tab name or id; the first tab when left out\",\n removeRows: \"row ids from read_board or 1-based row numbers\",\n removeColumns: \"column names or ids\",\n renameTab: \"new name for the tab\",\n running: \"Updating the sheet\",\n done: \"Sheet updated\",\n addTabs: \"adding tabs\",\n noTab: (tab: string | undefined, tabs: string) => `Tab ${tab} does not exist. Tabs available: ${tabs}.`,\n addColumns: \"adding columns\",\n noColumn: (c: string) => `column ${c} does not exist`,\n invalidFormula: \"(invalid formula)\",\n formulaRefs: (name: string, refs: string) => `formula ${name} refers to ${refs}`,\n noCell: (row: string | number, col: string) => `cell ${row}/${col} does not exist`,\n formulaCol: (name: string) => `${name} is a formula column`,\n noRow: (key: string | number) => `row ${key} does not exist`,\n usedBy: (name: string, users: string) => `column ${name} is used by formula ${users}`,\n edit: \"updating the sheet\",\n result: (id: string, ref: string, summary: string, skipped: string) => `ref=${id} sheet ${ref}: ${summary}.${skipped}`,\n },\n open: {\n description: \"Open an existing whiteboard, sheet or task board of the team so you can show it with present (the returned ref).\",\n running: \"Opening the board\",\n done: \"Board opened\",\n result: (id: string, ref: string, title: string, summary: string, mode: string) => `ref=${id} ${ref} \"${title}\" (${summary}). Show it with present (${mode}, this ref).`,\n },\n list: {\n description: \"List the team's whiteboards, sheets and task boards, newest change first, with refs, to find one the user mentions.\",\n running: \"Finding the team's boards\",\n done: \"Team boards found\",\n line: (ref: string, kind: string, title: string, summary: string, day: string, by: string) => `${ref} ${kind} \"${title}\", ${summary}, changed ${day} by ${by}`,\n none: \"This team has no whiteboards, sheets or task boards yet.\",\n },\n} as const;\n\nexport const BOARD_STEPS = {\n frame: \"Laying out the title and frame\",\n road: \"Drawing the road\",\n marks: \"Placing milestones\",\n marksRange: (from: string, to: string) => `${from} to ${to}`,\n cards: (titles: string[]) => (titles.length ? `Cards: ${titles.join(\", \")}` : \"Placing cards\"),\n changes: \"Tidying up\",\n links: \"Connecting steps\",\n stickers: \"Placing illustrations\",\n what: { frame: \"laying out the frame\", road: \"drawing the road\", marks: \"placing milestones\", cards: \"placing cards\", changes: \"tidying up\", links: \"connecting steps\", stickers: \"placing illustrations\" } as Record<\"frame\" | \"road\" | \"marks\" | \"cards\" | \"changes\" | \"links\" | \"stickers\", string>,\n restoreWhat: \"restored a version\",\n restoreWhy: (v: number) => `Restored to version ${v}`,\n undoWhat: \"undid the agent's work\",\n undoWhy: (what: string) => `Undone: ${what}`,\n reading: \"reading the board\",\n editing: \"editing the board\",\n} as const;\n","// The agent's whiteboard tools, as data and pure planners any host can serve: their names, descriptions and JSON\n// schemas (toolSpecs), and for each call the edits to make, in the steps someone watching should see them land.\n// The host loads and saves boards and waits `pauseMs` between steps. Ported from simpul's domain/toolkit/boards.ts.\nimport { z } from \"zod\";\nimport { zodToJsonSchema } from \"zod-to-json-schema\";\nimport {\n applyOps, boardText, extendTimelineOps, layoutOps, nextOrigin, NOTE_COLORS, opKeys, PENS, ROUTES, SHAPES, TEXT_SIZES, tidyOps, uid,\n type Board, type BoardOp,\n} from \"./boards\";\nimport { FORMS, layFree, TONES } from \"./free-board\";\nimport { TK_BOARDS as T, BOARD_STEPS } from \"./agent-copy\";\nimport { BOARD, BOARD_ARGS as A, LOOSE_NOTES, SECTION_NOTE_INSET } from \"./config\";\nimport { buildSteps, newBatch, planActivity, toldSteps, type AgentStep, type CreateInput, type Via } from \"./service\";\n\nconst icon = z.string().trim().max(A.ref).optional().describe(T.arg.icon);\nconst heading = z.object({ title: z.string().trim().min(1).max(A.headingTitle), subtitle: z.string().trim().max(A.headingSubtitle).optional(), icon }).describe(T.arg.heading);\nconst note = z.object({\n text: z.string().trim().min(1).max(A.noteText),\n title: z.string().trim().max(A.itemTitle).optional().describe(T.arg.noteTitle),\n icon,\n owner: z.string().trim().max(A.owner).optional().describe(T.arg.noteOwner),\n due: z.string().trim().max(A.due).optional().describe(T.arg.noteDue),\n color: z.enum(NOTE_COLORS).optional(),\n});\nconst section = z.object({ title: z.string().trim().min(1).max(A.sectionTitle), subtitle: z.string().trim().max(A.subtitle).optional().describe(T.arg.sectionSubtitle), notes: z.array(note).max(A.sectionNotes).default([]) });\nconst FREE = BOARD.draw.free;\nconst drawItem = z.object({\n key: z.string().trim().min(1).max(A.ref).optional().describe(T.arg.itemKey),\n shape: z.enum([\"box\", \"note\", \"ellipse\", \"pill\", \"cloud\", \"cylinder\", \"text\", \"sticker\", \"dot\"]).optional().describe(T.arg.shape),\n pen: z.enum(PENS).optional().describe(T.arg.pen), dashed: z.boolean().optional().describe(T.arg.dashed),\n title: z.string().trim().max(A.itemTitle).optional().describe(T.arg.itemTitle),\n text: z.string().trim().max(A.itemText).optional(),\n icon,\n when: z.string().trim().max(A.linkLabel).optional().describe(T.arg.when),\n color: z.enum(NOTE_COLORS).optional().describe(T.arg.color),\n size: z.enum(TEXT_SIZES).optional(),\n owner: z.string().trim().max(A.owner).optional(), due: z.string().trim().max(A.due).optional(),\n});\nconst boardArg = z.string().trim().min(1).max(A.ref).describe(T.arg.board);\nconst answer = z.string().trim().max(A.answer).optional();\nconst qa = { why: answer.describe(T.arg.qWhy), who: answer.describe(T.arg.qWho), when: answer.describe(T.arg.qWhen), where: answer.describe(T.arg.qWhere), how: answer.describe(T.arg.qHow), howMuch: answer.describe(T.arg.qHowMuch), assumes: answer.describe(T.arg.qAssumes) };\nconst freeItem = z.object({\n key: z.string().trim().min(1).max(A.ref).describe(T.arg.freeKey),\n x: z.number().finite().min(0).max(A.freeSpan).describe(T.arg.itemX), y: z.number().finite().min(0).max(A.freeSpan).describe(T.arg.itemY),\n form: z.enum(FORMS).optional().describe(T.arg.form),\n size: z.enum([\"s\", \"m\", \"l\", \"xl\"]).optional().describe(T.arg.size),\n w: z.number().finite().min(BOARD.minSize.shape.w).max(FREE.w).optional().describe(T.arg.itemW),\n h: z.number().finite().min(BOARD.minSize.shape.h).max(FREE.w).optional().describe(T.arg.itemH),\n layer: z.number().int().min(0).max(9).optional().describe(T.arg.layer),\n title: z.string().trim().max(A.itemTitle).optional().describe(T.arg.freeTitle),\n text: z.string().trim().max(A.itemText).optional().describe(T.arg.itemText),\n tone: z.enum(TONES).optional().describe(T.arg.tone), icon, ...qa,\n note: z.string().trim().max(A.say).optional().describe(T.arg.nodeNote),\n});\nconst freeLink = z.object({\n from: z.string().trim().min(1).max(A.ref).describe(T.arg.linkFrom), to: z.string().trim().min(1).max(A.ref).describe(T.arg.linkTo),\n label: z.string().trim().max(A.linkLabel).optional().describe(T.arg.linkLabel), dashed: z.boolean().optional().describe(T.arg.dashed),\n});\nconst freeBeat = z.object({\n say: z.string().trim().min(1).max(A.say).describe(T.arg.say),\n items: z.array(freeItem).max(A.beatItems).optional().describe(T.arg.beatItems),\n links: z.array(freeLink).max(A.beatItems).optional().describe(T.arg.beatLinks),\n});\nconst why = z.string().trim().max(A.why).optional().describe(T.arg.why);\n\nexport const CreateWhiteboardInput = z.object({\n title: z.string().trim().min(A.title.min).max(A.title.max),\n layout: z.enum([\"columns\", \"timeline\", \"grid\"]).default(\"columns\").describe(T.createWhiteboard.layout),\n heading: heading.optional(),\n sections: z.array(section).min(1).max(A.sections),\n why,\n});\nexport const DrawWhiteboardInput = z.object({\n board: z.string().trim().min(1).max(A.ref).optional().describe(T.draw.board),\n title: z.string().trim().min(A.title.min).max(A.title.max).optional().describe(T.draw.title),\n headline: z.string().trim().min(1).max(A.headingTitle).optional().describe(T.draw.headline),\n context: z.string().trim().max(A.headingSubtitle).optional().describe(T.draw.context),\n icon,\n beats: z.array(freeBeat).min(1).max(A.beats).describe(T.draw.beats),\n why,\n});\nexport const UpdateWhiteboardInput = z.object({\n board: boardArg,\n add_sections: z.array(section).max(A.sections).optional(),\n add_notes: z.array(note.extend({ section: z.string().trim().min(1).max(A.sectionTitle).optional().describe(T.updateWhiteboard.noteSection) })).max(A.addNotes).optional(),\n move_notes: z.array(z.object({ note_id: z.string().min(1).max(A.ref), section: z.string().trim().min(1).max(A.sectionTitle) })).max(A.moveNotes).optional(),\n update_notes: z.array(note.partial().extend({ note_id: z.string().min(1).max(A.ref), title: z.string().trim().max(A.itemTitle).optional(), shape: z.enum(SHAPES).optional(), size: z.enum(TEXT_SIZES).optional() })).max(A.updates).optional(),\n update_links: z.array(z.object({ link_id: z.string().min(1).max(A.ref), label: z.string().trim().max(A.linkLabel).optional(), route: z.enum(ROUTES).optional(), dashed: z.boolean().optional(), arrow: z.enum([\"end\", \"both\", \"none\"]).optional() })).max(A.updates).optional().describe(T.updateWhiteboard.updateLinks),\n remove_notes: z.array(z.string().min(1).max(A.ref)).max(A.moveNotes).optional(),\n rename_sections: z.array(z.object({ section: z.string().trim().min(1).max(A.sectionTitle), title: z.string().trim().min(1).max(A.sectionTitle) })).max(A.sections).optional(),\n remove_sections: z.array(z.string().trim().min(1).max(A.sectionTitle)).max(A.sections).optional().describe(T.updateWhiteboard.removeSections),\n add_links: z.array(z.object({ from: z.string().trim().min(1).max(A.sectionTitle), to: z.string().trim().min(1).max(A.sectionTitle), label: z.string().trim().max(A.linkLabel).optional() })).max(A.addLinks).optional().describe(T.updateWhiteboard.addLinks),\n remove_links: z.array(z.string().min(1).max(A.ref)).max(A.updates).optional().describe(T.updateWhiteboard.removeLinks),\n extend_timeline: z.object({ road: z.string().trim().min(1).max(A.ref).optional(), items: z.array(drawItem).min(1).max(A.sectionNotes) }).optional().describe(T.updateWhiteboard.extendTimeline),\n why,\n});\nexport const ReadBoardInput = z.object({ board: boardArg, note_ids: z.array(z.string().min(1).max(A.ref)).max(A.noteIds).optional() });\n\n/** How the host names a tool and tells the agent to show a board; simpul's own words mention its present block. */\nexport type ToolNames = { create: string; draw: string; update: string; read: string; list: string };\nexport const DEFAULT_NAMES: ToolNames = { create: \"create_whiteboard\", draw: \"draw_whiteboard\", update: \"update_whiteboard\", read: \"read_board\", list: \"list_boards\" };\n\nconst hostWords = (text: string, names: ToolNames, show: string) =>\n text\n .replace(/\\s*Show it (again )?with present[^.]*\\.?/g, \"\")\n .replace(/\\bcreate_whiteboard\\b/g, names.create)\n .replace(/\\bdraw_whiteboard\\b/g, names.draw)\n .replace(/\\bupdate_whiteboard\\b/g, names.update)\n .replace(/\\bread_board\\b/g, names.read)\n .replace(/\\blist_boards\\b/g, names.list)\n .trim();\n\n/**\n * The tools to give the agent: name, description and JSON schema of the arguments. `show` tells the agent how a\n * board appears in the host's answers (\"Put the returned show text in your reply.\").\n */\nexport function toolSpecs(show: string, names: ToolNames = DEFAULT_NAMES) {\n const spec = (name: string, description: string, schema: z.ZodTypeAny, shows = true) => ({\n name,\n description: `${hostWords(description, names, show)}${shows && show ? ` ${show}` : \"\"}`,\n parameters: zodToJsonSchema(schema, { $refStrategy: \"none\" }),\n });\n return [\n spec(names.create, T.createWhiteboard.description, CreateWhiteboardInput),\n spec(names.draw, T.draw.description, DrawWhiteboardInput),\n spec(names.update, T.updateWhiteboard.description, UpdateWhiteboardInput),\n spec(names.read, T.read.description, ReadBoardInput, false),\n ];\n}\n\nconst summary = (b: Board) => T.boardSummary(b.frames.length, b.notes.length);\n\n/** A plan for one tool call: a board to make (or none), the steps to save in order, and anything left undone. */\nexport type Plan = { create?: CreateInput; steps: AgentStep[]; problems: string[]; skippedKeys?: string[] };\n\n/** create_whiteboard: sections laid out as columns, a timeline or a grid, built frame by frame. */\nexport function planCreate(raw: unknown, via?: Via, batch = newBatch()): Plan {\n const i = CreateWhiteboardInput.parse(raw);\n // Every board opens with its title, even when the agent gave no heading.\n const ops = layoutOps(i.sections, i.layout, undefined, undefined, i.heading ?? { title: i.title }).ops;\n return { create: { title: i.title, mode: \"whiteboard\" }, steps: buildSteps(ops, batch, via, undefined, i.why), problems: [] };\n}\n\n/** draw_whiteboard: the beats told one at a time, each item where the agent put it, clear of what is drawn already. */\nexport function planDraw(raw: unknown, target: Board | null, via?: Via, batch = newBatch()): Plan {\n const i = DrawWhiteboardInput.parse(raw);\n if (!target && !i.title) throw new Error(T.draw.needTarget);\n const story = { headline: i.headline ?? i.title ?? target!.title, ...(i.context ? { context: i.context } : {}), ...(i.icon ? { icon: i.icon } : {}), beats: i.beats };\n const { steps, skipped } = layFree(story, target ? nextOrigin(target) : { x: 0, y: 0 }, target ?? undefined);\n return { ...(target ? {} : { create: { title: i.title!, mode: \"whiteboard\" as const } }), steps: toldSteps(steps, batch, via, i.why), problems: [], skippedKeys: skipped };\n}\n\n/** A section by id or by title (case-insensitive). */\nconst sectionOf = (b: Board, key: string) => b.frames.find((f) => f.id === key) ?? b.frames.find((f) => f.title.toLowerCase() === key.trim().toLowerCase());\n\n/**\n * update_whiteboard: every change of one call is one piece of agent work. Earlier stages (a timeline extended,\n * sections added) are applied to a working copy so the later ones (notes into those sections) can find them.\n */\nexport function planUpdate(raw: unknown, board: Board, via?: Via, batch = newBatch()): Plan {\n const i = UpdateWhiteboardInput.parse(raw);\n let b = board;\n const steps: AgentStep[] = [];\n const problems: string[] = [];\n const stage = (s: AgentStep[]) => {\n for (const step of s) b = applyOps(b, step.ops, T.agent);\n steps.push(...s);\n };\n if (i.extend_timeline) {\n const ext = extendTimelineOps(b, i.extend_timeline.items, i.extend_timeline.road);\n if (!ext) problems.push(T.updateWhiteboard.noRoad);\n else stage(buildSteps(ext.ops, batch, via, T.updateWhiteboard.extendWhat, i.why, true));\n }\n if (i.add_sections?.length) {\n const added = layoutOps(i.add_sections, \"columns\", nextOrigin(b)).ops;\n stage([{ ops: added, what: T.updateWhiteboard.addSections, why: i.why ?? T.updateWhiteboard.addSections, activity: planActivity(added, T.updateWhiteboard.addSections, batch, via), pauseMs: 0, planFirst: true }]);\n }\n const ops: BoardOp[] = [];\n let loose = 0;\n const free = nextOrigin(b);\n for (const n of i.add_notes ?? []) {\n const f = n.section ? sectionOf(b, n.section) : null;\n if (n.section && !f) { problems.push(T.updateWhiteboard.noSection(n.section)); continue; }\n const at = f ? { x: f.x + SECTION_NOTE_INSET, y: f.y + f.h } : { x: free.x + (loose % LOOSE_NOTES.perRow) * LOOSE_NOTES.dx, y: free.y + Math.floor(loose++ / LOOSE_NOTES.perRow) * LOOSE_NOTES.dy };\n ops.push({ op: \"note.add\", note: { id: uid(\"n\"), text: n.text, ...at, frame: f?.id ?? null, ...(n.owner ? { owner: n.owner } : {}), ...(n.due ? { due: n.due } : {}), ...(n.color ? { color: n.color } : {}) } });\n }\n for (const m of i.move_notes ?? []) {\n const f = sectionOf(b, m.section);\n if (!f) problems.push(T.updateWhiteboard.noSection(m.section));\n else if (!b.notes.some((x) => x.id === m.note_id)) problems.push(T.updateWhiteboard.noNote(m.note_id));\n else ops.push({ op: \"note.update\", id: m.note_id, patch: { frame: f.id } });\n }\n for (const u of i.update_notes ?? []) {\n if (!b.notes.some((x) => x.id === u.note_id)) { problems.push(T.updateWhiteboard.noNote(u.note_id)); continue; }\n const { note_id, ...patch } = u;\n ops.push({ op: \"note.update\", id: note_id, patch });\n }\n for (const id of i.remove_notes ?? []) ops.push({ op: \"note.remove\", id });\n for (const r of i.rename_sections ?? []) {\n const f = sectionOf(b, r.section);\n if (f) ops.push({ op: \"frame.update\", id: f.id, patch: { title: r.title } }); else problems.push(T.updateWhiteboard.noSection(r.section));\n }\n for (const s of i.remove_sections ?? []) {\n const f = sectionOf(b, s);\n if (f) ops.push({ op: \"frame.remove\", id: f.id }); else problems.push(T.updateWhiteboard.noSection(s));\n }\n const endOf = (key: string) => b.notes.find((x) => x.id === key)?.id ?? sectionOf(b, key)?.id;\n for (const l of i.add_links ?? []) {\n const from = endOf(l.from), to = endOf(l.to);\n if (!from || !to) { problems.push(T.updateWhiteboard.noEnds(l.from, l.to)); continue; }\n if (from === to || b.links.some((x) => x.from === from && x.to === to)) continue;\n // On a board whose wires the board routes itself, a new wire is routed the same way, around every item.\n const auto = b.links.some((x) => x.route === \"auto\") || b.edits.some((e) => e.told);\n ops.push({ op: \"link.add\", link: { id: uid(\"l\"), from, to, ...(auto ? { route: \"auto\" as const } : {}), ...(l.label ? { label: l.label } : {}) } });\n }\n for (const u of i.update_links ?? []) {\n const { link_id, ...patch } = u;\n if (b.links.some((x) => x.id === link_id)) ops.push({ op: \"link.update\", id: link_id, patch }); else problems.push(T.updateWhiteboard.noLink(link_id));\n }\n for (const id of i.remove_links ?? []) {\n if (b.links.some((x) => x.id === id)) ops.push({ op: \"link.remove\", id }); else problems.push(T.updateWhiteboard.noLink(id));\n }\n // One edit: the change plus the tidy-up it needs, outlining only what was asked for.\n const tidy = i.move_notes?.length || i.add_notes?.some((n) => n.section) || i.remove_sections?.length ? tidyOps(applyOps(b, ops, T.agent)) : [];\n if (ops.length) {\n const all = [...ops, ...tidy];\n steps.push({ ops: all, what: T.updateWhiteboard.edit, why: i.why ?? T.updateWhiteboard.edit, activity: { ...planActivity(ops, T.updateWhiteboard.edit, batch, via), keys: opKeys(ops).slice(0, 60) }, pauseMs: 0, planFirst: true });\n }\n return { steps, problems };\n}\n\n/** read_board: the board as text the agent reads (sections, notes with ids, owners, due dates, who wrote them). */\nexport function readBoard(raw: unknown, board: Board): string {\n const i = ReadBoardInput.parse(raw);\n const last = board.edits.at(-1);\n return `${T.read.head(board.ref, board.title, T.boardKind, summary(board), last?.by ?? board.updatedBy)}\\n${boardText(board, i.note_ids ? new Set(i.note_ids) : undefined)}`;\n}\n\n/** What the agent is told after a call: the board, what it holds now, and what was skipped and why. */\nexport function resultText(board: Board, plan: Pick<Plan, \"problems\" | \"skippedKeys\">, show: string): string {\n const problems = plan.problems.length ? T.skipped(plan.problems.join(T.problemSep)) : \"\";\n const keys = plan.skippedKeys?.length ? T.draw.skippedKeys(plan.skippedKeys) : \"\";\n return `Board ${board.ref} \"${board.title}\": ${summary(board)}.${problems}${keys} ${show}`.trim();\n}\n\nexport { BOARD_STEPS };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAAS,SAAS;;;ACDX,IAAM,YAAY;AAAA,EACvB,OAAO;AAAA,EACP,WAAW;AAAA,EACX,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,WAAW;AAAA;AAAA,EAEX,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,KAAK;AAAA,IACH,KAAK;AAAA,IACL,WAAW;AAAA,IACX,SAAS;AAAA,IACT,SAAS;AAAA,IACT,SAAS;AAAA,IACT,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.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { a as Board, c as BoardActivity, B as BoardOp } from './boards-ykaNj5ns.js';
|
|
3
|
+
export { Y as WbFrame, W as WbLink, b as WbNote } from './boards-ykaNj5ns.js';
|
|
4
|
+
|
|
5
|
+
/** One version in the board's history, as the server lists it. */
|
|
6
|
+
type HistoryEntry = {
|
|
7
|
+
version: number;
|
|
8
|
+
at: string;
|
|
9
|
+
by: string;
|
|
10
|
+
agent: boolean;
|
|
11
|
+
what: string;
|
|
12
|
+
why?: string;
|
|
13
|
+
keys: string[];
|
|
14
|
+
/** False: that step kept no ops, so versions before it can no longer be rebuilt. */
|
|
15
|
+
replayable?: boolean;
|
|
16
|
+
/** A beat of a told board: replayed with its sentence. */
|
|
17
|
+
told?: boolean;
|
|
18
|
+
};
|
|
19
|
+
/** One piece of agent work still waiting for the team to keep it or undo it. */
|
|
20
|
+
type PendingBatch = {
|
|
21
|
+
id: string;
|
|
22
|
+
by: string;
|
|
23
|
+
what: string;
|
|
24
|
+
why?: string;
|
|
25
|
+
keys: string[];
|
|
26
|
+
at: string;
|
|
27
|
+
};
|
|
28
|
+
/** What a load answers: the board when it changed since the version asked for, and who is working on it now. */
|
|
29
|
+
type BoardSnapshot = {
|
|
30
|
+
board?: Board | null;
|
|
31
|
+
activity?: BoardActivity | null;
|
|
32
|
+
pendingBatch?: PendingBatch | null;
|
|
33
|
+
};
|
|
34
|
+
interface BoardTransport {
|
|
35
|
+
/** The board, or nothing new when `since` is still its version. */
|
|
36
|
+
load(since?: number): Promise<BoardSnapshot>;
|
|
37
|
+
/** Applies a person's edits on the server and answers with the board as saved. */
|
|
38
|
+
save(ops: BoardOp[]): Promise<{
|
|
39
|
+
board: Board;
|
|
40
|
+
}>;
|
|
41
|
+
history?(): Promise<HistoryEntry[] | null>;
|
|
42
|
+
/** The board as it was at a version. */
|
|
43
|
+
at?(version: number): Promise<Board | null>;
|
|
44
|
+
/** Puts an earlier version back as the newest. */
|
|
45
|
+
restore?(version: number): Promise<BoardSnapshot>;
|
|
46
|
+
/** Keeps or undoes a piece of agent work as one. */
|
|
47
|
+
decide?(action: {
|
|
48
|
+
keepBatch: string;
|
|
49
|
+
} | {
|
|
50
|
+
undoBatch: string;
|
|
51
|
+
}): Promise<BoardSnapshot>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A transport over HTTP: GET url (?since=, ?history=1, ?at=), PATCH url {ops}, POST url {restore | keepBatch |
|
|
55
|
+
* undoBatch}. `init` adds headers (authorization) to every request.
|
|
56
|
+
*/
|
|
57
|
+
declare function httpTransport(url: string, init?: () => RequestInit | Promise<RequestInit>): BoardTransport;
|
|
58
|
+
|
|
59
|
+
type WhiteboardProps = {
|
|
60
|
+
/** The board to show; used for per-board preferences. */
|
|
61
|
+
boardId: string;
|
|
62
|
+
/** The board's short reference, shown in its header and quoted in questions to the agent ("WB-3"). */
|
|
63
|
+
boardRef: string;
|
|
64
|
+
title: string;
|
|
65
|
+
/** How the board is loaded and saved. */
|
|
66
|
+
transport: BoardTransport;
|
|
67
|
+
/** A board drawn without a server (a gallery or a test): read-only, nothing is loaded or saved. */
|
|
68
|
+
preview?: Board;
|
|
69
|
+
/** Sends a question about the board to the agent; the ask controls are hidden without it. */
|
|
70
|
+
onAsk?: (question: string) => void;
|
|
71
|
+
};
|
|
72
|
+
/** A live whiteboard: people and the agent draw on it together; edits are saved through the transport. */
|
|
73
|
+
declare function Whiteboard({ boardId, boardRef: reference, title, transport, preview, onAsk }: WhiteboardProps): react.JSX.Element;
|
|
74
|
+
|
|
75
|
+
/** Fired on window after a board edit is saved, with the board id. */
|
|
76
|
+
declare const BOARD_SAVED = "wb:board-saved";
|
|
77
|
+
|
|
78
|
+
export { BOARD_SAVED, Board, BoardActivity, BoardOp, type BoardSnapshot, type BoardTransport, type HistoryEntry, type PendingBatch, Whiteboard, type WhiteboardProps, httpTransport };
|