@folijs/agent 0.3.2 → 0.4.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +124 -21
  3. package/dist/changes.d.ts +23 -0
  4. package/dist/changes.d.ts.map +1 -0
  5. package/dist/changes.js +136 -0
  6. package/dist/changes.js.map +1 -0
  7. package/dist/formatting.d.ts +24 -0
  8. package/dist/formatting.d.ts.map +1 -0
  9. package/dist/formatting.js +106 -0
  10. package/dist/formatting.js.map +1 -0
  11. package/dist/handles.js +32 -12
  12. package/dist/handles.js.map +1 -1
  13. package/dist/index.d.ts +7 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +3 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/inserts.d.ts +42 -0
  18. package/dist/inserts.d.ts.map +1 -0
  19. package/dist/inserts.js +242 -0
  20. package/dist/inserts.js.map +1 -0
  21. package/dist/operations.d.ts.map +1 -1
  22. package/dist/operations.js +52 -27
  23. package/dist/operations.js.map +1 -1
  24. package/dist/paragraphs.d.ts +16 -0
  25. package/dist/paragraphs.d.ts.map +1 -0
  26. package/dist/paragraphs.js +146 -0
  27. package/dist/paragraphs.js.map +1 -0
  28. package/dist/read.d.ts +15 -1
  29. package/dist/read.d.ts.map +1 -1
  30. package/dist/read.js +138 -6
  31. package/dist/read.js.map +1 -1
  32. package/dist/schema.d.ts +25 -0
  33. package/dist/schema.d.ts.map +1 -0
  34. package/dist/schema.js +51 -0
  35. package/dist/schema.js.map +1 -0
  36. package/dist/session.d.ts +79 -2
  37. package/dist/session.d.ts.map +1 -1
  38. package/dist/session.js +147 -18
  39. package/dist/session.js.map +1 -1
  40. package/dist/stories.d.ts +2 -0
  41. package/dist/stories.d.ts.map +1 -0
  42. package/dist/stories.js +80 -0
  43. package/dist/stories.js.map +1 -0
  44. package/dist/tables.d.ts +21 -0
  45. package/dist/tables.d.ts.map +1 -0
  46. package/dist/tables.js +485 -0
  47. package/dist/tables.js.map +1 -0
  48. package/dist/tools.d.ts +89 -0
  49. package/dist/tools.d.ts.map +1 -0
  50. package/dist/tools.js +717 -0
  51. package/dist/tools.js.map +1 -0
  52. package/package.json +4 -4
  53. package/src/changes.ts +193 -0
  54. package/src/formatting.ts +149 -0
  55. package/src/handles.ts +40 -13
  56. package/src/index.ts +23 -0
  57. package/src/inserts.ts +339 -0
  58. package/src/operations.ts +71 -34
  59. package/src/paragraphs.ts +188 -0
  60. package/src/read.ts +141 -9
  61. package/src/schema.ts +74 -0
  62. package/src/session.ts +256 -20
  63. package/src/stories.ts +92 -0
  64. package/src/tables.ts +664 -0
  65. package/src/tools.ts +925 -0
package/dist/tables.js ADDED
@@ -0,0 +1,485 @@
1
+ /**
2
+ * Table operations (23.3, ADR-0013): a table named by its handle, its rows and columns by the
3
+ * indexes `read` prints (`r1 c1`: rows as with every change accepted, grid columns). Each is a
4
+ * core command run with the selection where it acts, so every edit is tracked as the editor
5
+ * tracks it.
6
+ */
7
+ import { CellSelection, deleteRows as deleteRowsCommand, Fragment, insertRow, insertTable as insertTableCommand, Slice, setCellShading, setTableStyle as setTableStyleCommand, tableStyles, toggleHeaderRow, } from "@folijs/core";
8
+ import { changed, inline, MAX_WRITTEN, quote, resolve, } from "./operations.js";
9
+ import { readBlocks } from "./read.js";
10
+ import { refuse } from "./result.js";
11
+ /** The depth of the innermost cell around `$pos`, or -1. */
12
+ function cellDepth($pos) {
13
+ for (let d = $pos.depth; d > 0; d--)
14
+ if ($pos.node(d).type.name === "tableCell")
15
+ return d;
16
+ return -1;
17
+ }
18
+ /** Word's limits: what `insertTable` of core takes. */
19
+ const MAX_ROWS = 1000;
20
+ const MAX_COLUMNS = 63;
21
+ /** The rows of the table at `pos` as `read` numbers them: those not deleted as tracked changes. */
22
+ function rowsOf(pos, table) {
23
+ const rows = [];
24
+ table.forEach((row, offset, index) => {
25
+ if (row.attrs.revision?.deletion)
26
+ return;
27
+ const start = pos + 1 + offset;
28
+ const cells = [];
29
+ let column = 1 + (row.attrs.gridBefore ?? 0);
30
+ row.forEach((cell, cellOffset) => {
31
+ const span = cell.attrs.gridSpan ?? 1;
32
+ cells.push({ pos: start + 1 + cellOffset, node: cell, column, span });
33
+ column += span;
34
+ });
35
+ rows.push({ index, pos: start, node: row, cells });
36
+ });
37
+ return rows;
38
+ }
39
+ /** The table `handle` names: a table's own, or a paragraph's in one of its cells. */
40
+ function tableOf(context, handle) {
41
+ const found = resolve(context, handle);
42
+ if ("ok" in found)
43
+ return found;
44
+ let { pos, node } = found;
45
+ if (node.type.name !== "table") {
46
+ const $pos = context.editor.state.doc.resolve(pos);
47
+ const depth = cellDepth($pos);
48
+ if (depth < 0)
49
+ return refuse("invalid", `Block ${handle} is not a table or in one. A table is named by the handle of its "table" line, or of a paragraph in one of its cells.`);
50
+ pos = $pos.before(depth - 2);
51
+ node = $pos.node(depth - 2);
52
+ }
53
+ return { handle: context.handles.at(pos, node), pos, node, rows: rowsOf(pos, node) };
54
+ }
55
+ const count = (n, one) => `${n} ${one}${n === 1 ? "" : "s"}`;
56
+ /** The row `row` (1-based, as read prints it), or why there is none. */
57
+ function rowAt(table, row) {
58
+ const found = Number.isInteger(row) ? table.rows[row - 1] : undefined;
59
+ return (found ??
60
+ refuse("invalid", `Table ${table.handle} has ${count(table.rows.length, "row")}: row is 1 to ${table.rows.length}.`));
61
+ }
62
+ /**
63
+ * The cell at `row`, grid column `column`: the one spanning it, or the top of the vertical merge
64
+ * that covers it (where its text is).
65
+ */
66
+ function cellAt(table, row, column) {
67
+ let r = rowAt(table, row);
68
+ if ("ok" in r)
69
+ return r;
70
+ const columns = Math.max(0, ...table.rows.map((x) => x.cells.reduce((n, c) => Math.max(n, c.column + c.span - 1), 0)));
71
+ const at = (x) => x.cells.find((c) => column >= c.column && column < c.column + c.span);
72
+ let cell = Number.isInteger(column) ? at(r) : undefined;
73
+ if (!cell)
74
+ return refuse("invalid", `Row ${row} of table ${table.handle} has no cell in column ${String(column)}: columns are 1 to ${columns}.`);
75
+ // Merged up: the text is in the merge's top cell.
76
+ for (let i = table.rows.indexOf(r) - 1; cell.node.attrs.vMerge === "continue" && i >= 0; i--) {
77
+ r = table.rows[i];
78
+ cell = at(r) ?? cell;
79
+ }
80
+ return cell;
81
+ }
82
+ /** The table's blocks as they read now: its line and its cells' blocks. */
83
+ function tableBlocks(context, handle) {
84
+ const blocks = readBlocks(context.editor.state, context.handles);
85
+ const inTable = new Set([handle]);
86
+ const handles = blocks
87
+ .filter((b) => {
88
+ const mine = b.handle === handle || (b.cell && inTable.has(b.cell.table));
89
+ // A table nested in a cell is part of it too.
90
+ if (mine && b.kind === "table")
91
+ inTable.add(b.handle);
92
+ return mine;
93
+ })
94
+ .map((b) => b.handle);
95
+ return changed(context, handles);
96
+ }
97
+ /** Puts the caret in a cell's first paragraph. */
98
+ const caretIn = (context, cell) => context.editor.select(cell.pos + 2);
99
+ /**
100
+ * Puts the caret where core's row commands act on `row` alone: a cell not in a vertical merge
101
+ * (a merged cell stands for every row of its merge). False when every cell of the row is.
102
+ */
103
+ function caretInRow(context, row) {
104
+ const cell = row.cells.find((c) => !c.node.attrs.vMerge);
105
+ if (cell)
106
+ caretIn(context, cell);
107
+ return !!cell;
108
+ }
109
+ const MERGED = (table, row) => `Every cell of row ${row} of table ${table} is part of a vertical merge, which runs over rows around it: Foli cannot insert or delete next to it alone. Nothing was changed.`;
110
+ /** Handles of the paragraphs in `node` (at `pos`): a row's or a cell's. */
111
+ function paragraphsIn(context, pos, node) {
112
+ const out = [];
113
+ node.descendants((child, offset) => {
114
+ if (child.type.name !== "paragraph")
115
+ return true;
116
+ out.push(context.handles.at(pos + 1 + offset, child));
117
+ return false;
118
+ });
119
+ return out;
120
+ }
121
+ /**
122
+ * The answer of a table operation: the blocks it changed (their handles; default the table's
123
+ * own line), and the whole table as it reads now.
124
+ */
125
+ function answer(context, table, changedHandles) {
126
+ const whole = tableBlocks(context, table);
127
+ const wanted = new Set(changedHandles ?? [table]);
128
+ return { blocks: whole.blocks.filter((b) => wanted.has(b.handle)), text: whole.text };
129
+ }
130
+ /** Rows of cell texts as a model gives them, or why they are not. */
131
+ function cellTexts(value, what) {
132
+ const rows = Array.isArray(value) ? value : null;
133
+ if (!rows?.length ||
134
+ !rows.every((r) => Array.isArray(r) && r.every((c) => typeof c === "string")))
135
+ return refuse("invalid", `${what} is a list of rows, each a list of its cells' texts: [["Name", "Price"], ["Tea", "3.50"]].`);
136
+ const written = rows.flat().reduce((n, t) => n + t.length, 0);
137
+ if (written > MAX_WRITTEN)
138
+ return refuse("invalid", `That is ${written} characters: more than ${MAX_WRITTEN} at once.`);
139
+ return rows;
140
+ }
141
+ /** Fills `cells` (positions in the document as it is) with `texts`, in one transaction. */
142
+ function fill(context, cells, texts) {
143
+ const { editor } = context;
144
+ const tr = editor.state.tr;
145
+ // From the last: a filled cell moves the ones after it.
146
+ for (let i = Math.min(cells.length, texts.length) - 1; i >= 0; i--) {
147
+ const cell = cells[i];
148
+ // A cell a vertical merge goes on through takes no text: it is the merge's top cell's.
149
+ if (cell.node.attrs.vMerge === "continue")
150
+ continue;
151
+ const nodes = inline(editor, texts[i]);
152
+ if (nodes.length)
153
+ tr.insert(cell.pos + 2, nodes);
154
+ }
155
+ if (tr.docChanged)
156
+ editor.dispatch(tr);
157
+ }
158
+ /** The table style named `name` (capitals do not count), or why there is none. */
159
+ function tableStyle(context, name) {
160
+ const names = tableStyles(context.editor.state);
161
+ const found = names.find((n) => typeof name === "string" && n.toLowerCase() === name.trim().toLowerCase());
162
+ return (found ??
163
+ refuse("unknown-style", `There is no table style ${quote(String(name))}. The table styles are: ${names.map((n) => quote(n)).join(", ")}.`));
164
+ }
165
+ /**
166
+ * Where to put the caret for core's `insertTable` to put a table next to the block at `pos`:
167
+ * at a paragraph's end it goes after, at its start before.
168
+ */
169
+ function caretFor(context, pos, node, where) {
170
+ const $pos = context.editor.state.doc.resolve(pos);
171
+ const parent = $pos.parent;
172
+ const index = $pos.index();
173
+ const paragraph = (n) => n?.type.name === "paragraph";
174
+ if (paragraph(node)) {
175
+ if (where === "before")
176
+ return pos + 1;
177
+ if (node.content.size)
178
+ return pos + node.nodeSize - 1;
179
+ // After an empty paragraph: before the next one, else at its own start (before it).
180
+ const next = parent.maybeChild(index + 1);
181
+ return paragraph(next) ? pos + node.nodeSize + 1 : pos + 1;
182
+ }
183
+ if (where === "after") {
184
+ const next = parent.maybeChild(index + 1);
185
+ return paragraph(next) ? pos + node.nodeSize + 1 : null;
186
+ }
187
+ const previous = parent.maybeChild(index - 1);
188
+ return paragraph(previous) ? pos - 1 : null;
189
+ }
190
+ /** @internal */
191
+ export function insertTable(context, handle, cells, options = {}) {
192
+ const { editor } = context;
193
+ const texts = cellTexts(cells, "cells");
194
+ if ("ok" in texts)
195
+ return texts;
196
+ const columns = Math.max(...texts.map((r) => r.length));
197
+ if (texts.length > MAX_ROWS || columns > MAX_COLUMNS || columns < 1)
198
+ return refuse("invalid", `A table has 1 to ${MAX_ROWS} rows and 1 to ${MAX_COLUMNS} columns.`);
199
+ const where = options.where ?? "after";
200
+ if (where !== "after" && where !== "before")
201
+ return refuse("invalid", 'where is "after" or "before".');
202
+ const style = options.style === undefined || options.style === null
203
+ ? null
204
+ : tableStyle(context, options.style);
205
+ if (style && typeof style !== "string")
206
+ return style;
207
+ const found = resolve(context, handle);
208
+ if ("ok" in found)
209
+ return found;
210
+ const caret = caretFor(context, found.pos, found.node, where);
211
+ if (caret === null)
212
+ return refuse("invalid", `A table goes next to a paragraph, and there is none ${where} block ${handle}: insert one there first (insert_paragraphs), then the table next to it.`);
213
+ editor.select(caret);
214
+ const before = editor.state.doc;
215
+ if (!editor.run(insertTableCommand(texts.length, columns)) || editor.state.doc === before)
216
+ return refuse("refused", `A table could not be inserted ${where} block ${handle} (a locked content control?). Nothing was changed.`);
217
+ // The caret is in its first cell.
218
+ const $from = editor.state.selection.$from;
219
+ const depth = cellDepth($from);
220
+ const tablePos = $from.before(depth - 2);
221
+ const made = () => {
222
+ const node = editor.state.doc.nodeAt(tablePos);
223
+ return {
224
+ handle: context.handles.at(tablePos, node),
225
+ pos: tablePos,
226
+ node,
227
+ rows: rowsOf(tablePos, node),
228
+ };
229
+ };
230
+ const table = made();
231
+ fill(context, table.rows.flatMap((r) => r.cells), texts.flatMap((r) => Array.from({ length: columns }, (_, i) => r[i] ?? "")));
232
+ if (options.header) {
233
+ caretIn(context, made().rows[0]?.cells[0]);
234
+ if (!editor.run(toggleHeaderRow))
235
+ return refuse("refused", "The table's first row could not be made a header row. Nothing was changed.");
236
+ }
237
+ if ((style && style !== "Table Grid") || options.style === null) {
238
+ caretIn(context, made().rows[0]?.cells[0]);
239
+ if (!editor.run(setTableStyleCommand(style ?? null)))
240
+ return refuse("refused", "The table's style could not be set. Nothing was changed.");
241
+ }
242
+ return { ok: true, ...tableBlocks(context, table.handle) };
243
+ }
244
+ /** @internal */
245
+ export function insertRows(context, handle, row, cells, where = "after") {
246
+ const { editor } = context;
247
+ const table = tableOf(context, handle);
248
+ if ("ok" in table)
249
+ return table;
250
+ const reference = rowAt(table, row);
251
+ if ("ok" in reference)
252
+ return reference;
253
+ const texts = cellTexts(cells, "cells");
254
+ if ("ok" in texts)
255
+ return texts;
256
+ if (where !== "after" && where !== "before")
257
+ return refuse("invalid", 'where is "after" or "before".');
258
+ const most = reference.cells.length;
259
+ const long = texts.findIndex((r) => r.length > most);
260
+ if (long >= 0)
261
+ return refuse("invalid", `A new row is made like row ${row}, which has ${count(most, "cell")}: row ${long + 1} of cells gives ${texts[long]?.length}.`);
262
+ if (texts.length > MAX_ROWS)
263
+ return refuse("invalid", `At most ${MAX_ROWS} rows at once.`);
264
+ if (!caretInRow(context, reference))
265
+ return refuse("refused", MERGED(table.handle, row));
266
+ const made = [];
267
+ for (const [i, rowTexts] of texts.entries()) {
268
+ const before = editor.state.doc;
269
+ // The first next to the reference row; the others after the one just made.
270
+ if (!editor.run(insertRow(i === 0 && where === "before" ? -1 : 1)) ||
271
+ editor.state.doc === before)
272
+ return refuse("refused", `Rows could not be inserted in table ${table.handle} (a locked content control?). Nothing was changed.`);
273
+ const $from = editor.state.selection.$from;
274
+ const depth = cellDepth($from);
275
+ const rows = () => rowsOf(table.pos, editor.state.doc.nodeAt(table.pos));
276
+ const index = rows().find((r) => r.pos === $from.before(depth - 1))?.index;
277
+ if (index === undefined)
278
+ return refuse("refused", `Rows could not be inserted in table ${table.handle}. Nothing was changed.`);
279
+ made.push(index);
280
+ const fresh = rows().find((r) => r.index === index);
281
+ // A cell a vertical merge goes on through has no text of its own: text for it is refused.
282
+ const merged = fresh.cells.findIndex((c, k) => c.node.attrs.vMerge === "continue" && (rowTexts[k] ?? "") !== "");
283
+ if (merged >= 0)
284
+ return refuse("invalid", `Cell ${merged + 1} of a new row (column ${fresh.cells[merged]?.column}) goes on the vertical merge above it, whose text is its top cell's: give "" for it. Nothing was changed.`);
285
+ fill(context, fresh.cells, rowTexts);
286
+ // The caret back in the new row (filling moved it): the next one goes after it.
287
+ caretInRow(context, rows().find((r) => r.index === index));
288
+ }
289
+ const node = editor.state.doc.nodeAt(table.pos);
290
+ const handles = rowsOf(table.pos, node)
291
+ .filter((r) => made.includes(r.index))
292
+ .flatMap((r) => paragraphsIn(context, r.pos, r.node));
293
+ return { ok: true, ...answer(context, table.handle, handles) };
294
+ }
295
+ /** @internal */
296
+ export function deleteRows(context, handle, rows) {
297
+ const { editor } = context;
298
+ const table = tableOf(context, handle);
299
+ if ("ok" in table)
300
+ return table;
301
+ if (!Array.isArray(rows) || !rows.length)
302
+ return refuse("invalid", "rows is a list of row numbers, as read prints them: [2, 3].");
303
+ const picked = [];
304
+ for (const r of new Set(rows)) {
305
+ const found = rowAt(table, r);
306
+ if ("ok" in found)
307
+ return found;
308
+ picked.push(found);
309
+ }
310
+ // A row starting a vertical merge that goes on below it: its text is the merge's, which a
311
+ // tracked deletion would hide. Deleted only with every row the merge covers.
312
+ for (const row of picked) {
313
+ const at = table.rows.indexOf(row);
314
+ for (const cell of row.cells) {
315
+ if (cell.node.attrs.vMerge !== "restart")
316
+ continue;
317
+ const covered = [];
318
+ for (const below of table.rows.slice(at + 1)) {
319
+ const goesOn = below.cells.some((c) => c.column === cell.column && c.node.attrs.vMerge === "continue");
320
+ if (!goesOn)
321
+ break;
322
+ covered.push(below);
323
+ }
324
+ if (covered.some((r) => !picked.includes(r)))
325
+ return refuse("refused", `Row ${at + 1} of table ${table.handle} starts a vertical merge in column ${cell.column} that goes on to row ${table.rows.indexOf(covered[covered.length - 1]) + 1}, and holds its text: delete those rows with it, or set the text of a row that stays first. Nothing was changed.`);
326
+ }
327
+ }
328
+ // From the last: rows deleted as tracked changes stay, and those before keep their place.
329
+ picked.sort((a, b) => b.index - a.index);
330
+ for (const row of picked) {
331
+ const node = editor.state.doc.nodeAt(table.pos);
332
+ if (node?.type.name !== "table")
333
+ break;
334
+ const now = rowsOf(table.pos, node).find((r) => r.index === row.index);
335
+ if (!now)
336
+ continue;
337
+ const number = table.rows.indexOf(row) + 1;
338
+ if (!caretInRow(context, now))
339
+ return refuse("refused", MERGED(table.handle, number));
340
+ const before = editor.state.doc;
341
+ if (!editor.run(deleteRowsCommand) || editor.state.doc === before)
342
+ return refuse("refused", `Row ${number} of table ${table.handle} could not be deleted (a locked content control?). Nothing was changed.`);
343
+ }
344
+ const all = picked.length === table.rows.length;
345
+ const numbers = [...new Set(rows)].sort((a, b) => a - b).join(", ");
346
+ const { text } = all ? { text: "" } : tableBlocks(context, table.handle);
347
+ // A row of one's own insertion goes; any other stays, a tracked deletion.
348
+ const how = "(a tracked deletion; a row you inserted yourself is removed)";
349
+ return {
350
+ ok: true,
351
+ blocks: [],
352
+ rows: picked.length,
353
+ text: all
354
+ ? `Deleted table ${table.handle}, every row of it ${how}.`
355
+ : `Deleted ${picked.length === 1 ? "row" : "rows"} ${numbers} of table ${table.handle} ${how}. The table now reads:\n${text}`,
356
+ };
357
+ }
358
+ /** @internal */
359
+ export function setCells(context, handle, cells) {
360
+ const { editor } = context;
361
+ const table = tableOf(context, handle);
362
+ if ("ok" in table)
363
+ return table;
364
+ if (!Array.isArray(cells) || !cells.length)
365
+ return refuse("invalid", 'cells is a list of { row, column, text }: [{ "row": 2, "column": 1, "text": "Tea" }].');
366
+ const targets = new Map();
367
+ let written = 0;
368
+ for (const given of cells) {
369
+ if (typeof given?.text !== "string")
370
+ return refuse("invalid", "Each cell has its text: a string.");
371
+ const cell = cellAt(table, given.row, given.column);
372
+ if ("ok" in cell)
373
+ return cell;
374
+ if (cell.node.content.content.some((b) => b.type.name !== "paragraph"))
375
+ return refuse("invalid", `The cell at row ${given.row}, column ${given.column} of table ${table.handle} holds a table: edit its paragraphs by their handles instead.`);
376
+ written += given.text.length;
377
+ targets.set(cell.pos, { cell, text: given.text });
378
+ }
379
+ if (written > MAX_WRITTEN)
380
+ return refuse("invalid", `That is ${written} characters: more than ${MAX_WRITTEN} at once.`);
381
+ const before = editor.state.doc;
382
+ const tr = editor.state.tr;
383
+ // From the last cell: each replacement moves the ones after it.
384
+ for (const { cell, text } of [...targets.values()].sort((a, b) => b.cell.pos - a.cell.pos)) {
385
+ const from = cell.pos + 2;
386
+ const to = cell.pos + cell.node.nodeSize - 2;
387
+ const marks = cell.node.firstChild?.firstChild?.marks ?? [];
388
+ const nodes = inline(editor, text).map((n) => n.isText
389
+ ? n.mark(marks.filter((m) => !["insertion", "deletion", "formatChange"].includes(m.type.name)))
390
+ : n);
391
+ if (from === to && !nodes.length)
392
+ continue;
393
+ tr.replace(from, to, new Slice(Fragment.from(nodes), 0, 0));
394
+ }
395
+ if (tr.docChanged)
396
+ editor.dispatch(tr);
397
+ if (tr.docChanged && editor.state.doc === before)
398
+ return refuse("refused", `The cells of table ${table.handle} could not be changed (a locked content control?). Nothing was changed.`);
399
+ const now = tableOf(context, table.handle);
400
+ if ("ok" in now)
401
+ return { ok: true, ...tableBlocks(context, table.handle) };
402
+ const handles = cells.flatMap((c) => {
403
+ const cell = cellAt(now, c.row, c.column);
404
+ return "ok" in cell ? [] : paragraphsIn(context, cell.pos, cell.node);
405
+ });
406
+ return { ok: true, ...answer(context, table.handle, handles) };
407
+ }
408
+ /** @internal */
409
+ export function setTableStyle(context, handle, style) {
410
+ const { editor } = context;
411
+ const table = tableOf(context, handle);
412
+ if ("ok" in table)
413
+ return table;
414
+ const name = style === null ? null : tableStyle(context, style);
415
+ if (name !== null && typeof name !== "string")
416
+ return name;
417
+ caretIn(context, table.rows[0]?.cells[0]);
418
+ if (!editor.run(setTableStyleCommand(name)))
419
+ return refuse("refused", `The style of table ${table.handle} could not be set.`);
420
+ return { ok: true, ...answer(context, table.handle) };
421
+ }
422
+ /** @internal */
423
+ export function shadeCells(context, handle, fill, options = {}) {
424
+ const { editor } = context;
425
+ const table = tableOf(context, handle);
426
+ if ("ok" in table)
427
+ return table;
428
+ const color = typeof fill === "string" ? fill.trim().replace(/^#/, "") : fill;
429
+ if (color !== null && !/^[0-9A-Fa-f]{6}$/.test(color))
430
+ return refuse("invalid", 'fill is a color as RRGGBB ("D9E2F3"), or null to take the shading off.');
431
+ const { row, column } = options;
432
+ const last = table.rows.length;
433
+ const rows = row === undefined ? [1, last] : [row, row];
434
+ const firsts = table.rows.map((r) => r.cells[0]?.column ?? 1);
435
+ const ends = table.rows.map((r) => r.cells.reduce((n, c) => Math.max(n, c.column + c.span - 1), 0));
436
+ const columns = column === undefined ? [Math.min(...firsts), Math.max(...ends)] : [column, column];
437
+ const pick = (r, c, side) => {
438
+ const x = rowAt(table, r);
439
+ if ("ok" in x)
440
+ return x;
441
+ if (column !== undefined)
442
+ return cellAt(table, r, c);
443
+ const cell = side === "first" ? x.cells[0] : x.cells[x.cells.length - 1];
444
+ return cell ?? refuse("invalid", `Row ${r} has no cells.`);
445
+ };
446
+ const anchor = pick(rows[0], columns[0], "first");
447
+ if ("ok" in anchor)
448
+ return anchor;
449
+ const head = pick(rows[1], columns[1], "last");
450
+ if ("ok" in head)
451
+ return head;
452
+ editor.dispatch(editor.state.tr.setSelection(CellSelection.create(editor.state.doc, anchor.pos, head.pos)));
453
+ if (!editor.run(setCellShading(color)))
454
+ return refuse("refused", `The cells of table ${table.handle} could not be shaded.`);
455
+ return { ok: true, ...answer(context, table.handle) };
456
+ }
457
+ /**
458
+ * @internal
459
+ * Makes the first `count` rows the header rows (repeated on each page), and no others: each
460
+ * row's own property, tracked as its formatting change (23.2).
461
+ */
462
+ export function setHeaderRows(context, handle, count) {
463
+ const { editor } = context;
464
+ const table = tableOf(context, handle);
465
+ if ("ok" in table)
466
+ return table;
467
+ if (!Number.isInteger(count) || count < 0 || count > table.rows.length)
468
+ return refuse("invalid", `count is how many rows from the top are header rows: 0 to ${table.rows.length}.`);
469
+ const tr = editor.state.tr;
470
+ table.rows.forEach((row, i) => {
471
+ const header = i < count;
472
+ if ((row.node.attrs.header === true) !== header)
473
+ tr.setNodeMarkup(row.pos, row.node.type, { ...row.node.attrs, header: header || null });
474
+ });
475
+ if (tr.docChanged) {
476
+ const before = editor.state.doc;
477
+ editor.dispatch(tr);
478
+ if (editor.state.doc === before)
479
+ return refuse("refused", `The header rows of table ${table.handle} could not be set (a locked content control?).`);
480
+ }
481
+ return { ok: true, ...answer(context, table.handle) };
482
+ }
483
+ /** @internal What the table actions Foli cannot record as tracked changes say. */
484
+ export const UNTRACKED_TABLE_EDIT = "Adding or deleting columns, merging or splitting cells and changing column widths cannot be recorded as tracked changes yet, and every edit here is one: nothing was changed. To give the reader a table with other columns, insert a new table next to this one with the cells you want, delete this one, and say why in a comment.";
485
+ //# sourceMappingURL=tables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tables.js","sourceRoot":"","sources":["../src/tables.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,aAAa,EACb,UAAU,IAAI,iBAAiB,EAC/B,QAAQ,EACR,SAAS,EACT,WAAW,IAAI,kBAAkB,EAGjC,KAAK,EACL,cAAc,EACd,aAAa,IAAI,oBAAoB,EACrC,WAAW,EACX,eAAe,GAChB,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AAC;QACpB,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,MAAM;YAC7B,OAAO,MAAM,CACX,SAAS,EACT,4BAA4B,KAAK,CAAC,MAAM,gDAAgD,CACzF,CAAC;IACN,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;AACxD,CAAC;AAED,kFAAkF;AAClF,MAAM,CAAC,MAAM,oBAAoB,GAC/B,sUAAsU,CAAC"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * The tools (ADR-0013): what a model is given to edit a session's document, with the words it
3
+ * reads (names, descriptions, JSON Schemas, the instructions). An app running its own model
4
+ * loop gives it `agentTools(session)`; `@folijs/mcp` serves the same definitions, and its code
5
+ * mode (`run`) gets its methods from them.
6
+ */
7
+ import type { Result } from "./result.js";
8
+ import { type JsonSchema } from "./schema.js";
9
+ import type { Session } from "./session.js";
10
+ /** Blocks the `read` tool gives when it is not told how many. */
11
+ export declare const READ_LIMIT = 200;
12
+ /**
13
+ * What to say to the model once, before the tools (a system prompt's part). Each tool's
14
+ * description stands without it.
15
+ */
16
+ export declare const INSTRUCTIONS = "These tools read and edit Word documents (.docx). Every edit is a tracked change a person will accept or reject in Word: change only what the task asks, and use comment to explain a change that is not obvious.\n\nWork on what read shows. read gives the document a line per block:\n [b7] Clause, 1.1, changed: text\n[b7] is the block's handle: pass it to the other tools. After it come where the block is in a table (r1 c1: row and grid column; c1-2 a cell spanning two; \"merged down\" or \"merged up\" a vertical merge, its text in the top cell), its style, its list number, \"changed\" if it has tracked changes, its comments; after the colon, its text. \u21B5 is a line break. A line \"table, 3 rows, 2 columns\" is a table: its cells' blocks follow, indented. A line \"not editable: \u2026\" is content you cannot change.\nWords in brackets ([picture], [note], [empty: Offer date]) are not text: never put them in find. [empty: \u2026] is a content control to fill with fill_control; \u00ABName\u00BB is a merge field to fill with update_fields.\nA handle stays its block's while you edit; a deleted block's is refused. A tool that changes the document returns the blocks it changed as they are now: do not read again to check (after update_fields do: it returns none). When a tool refuses, its message says what to do instead: follow it.\nread shows the body; read with headers also shows the headers and footers after the body (in a read in parts, after its last part), their handles h1, f1\u2026, which the same tools edit: no comments, breaks or notes go there, and their content controls are not filled. The text of notes ([note]) is not shown.";
17
+ /** What a tool answers the model: text, and whether it is a refusal. */
18
+ export interface ToolAnswer {
19
+ text: string;
20
+ isError?: boolean;
21
+ }
22
+ /** A tool bound to a session: give the model its name, description and schema; call `run`. */
23
+ export interface AgentTool {
24
+ name: string;
25
+ /** For the model: what it does, when to use it, what it returns. */
26
+ description: string;
27
+ /** Its arguments, as a JSON Schema object. */
28
+ inputSchema: JsonSchema & {
29
+ type: "object";
30
+ };
31
+ /** Does what the model asked; arguments that do not fit the schema are refused in words. */
32
+ run(args?: Record<string, unknown>): ToolAnswer;
33
+ }
34
+ /**
35
+ * A method of code mode's `doc` (ADR-0010): what a script calls instead of a tool. A refusal
36
+ * is thrown as an `Error` with its message.
37
+ */
38
+ export interface ScriptMethod {
39
+ name: string;
40
+ /** Its line in the summary of `doc` a model is given. */
41
+ signature: string;
42
+ /**
43
+ * What a run counts of it: `edit`, the blocks its value's `blocks` are; `insert`, those and
44
+ * how many; `delete`, a block deleted or emptied; `fields`, fields updated.
45
+ */
46
+ effect?: "edit" | "insert" | "delete" | "fields";
47
+ call(session: Session, args: readonly unknown[], host?: ToolHost): unknown;
48
+ }
49
+ /**
50
+ * What the app gives the tools that the document does not hold (23.6): a picture's bytes for a
51
+ * path the model names. Without it, pictures are refused.
52
+ */
53
+ export interface ToolHost {
54
+ picture?(path: string): Result<{
55
+ data: Uint8Array;
56
+ contentType?: string;
57
+ }>;
58
+ }
59
+ /** A tool over any session: what `agentTools` binds, and what a server serves. */
60
+ export interface ToolDefinition {
61
+ name: string;
62
+ description: string;
63
+ inputSchema: JsonSchema & {
64
+ type: "object";
65
+ };
66
+ /**
67
+ * Arguments are taken as checked against `inputSchema` (`invalid` first: `agentTools` does);
68
+ * others may be there.
69
+ */
70
+ run(session: Session, args: Record<string, unknown>, host?: ToolHost): ToolAnswer;
71
+ /** Its methods in code mode, in the order they are listed. */
72
+ methods: readonly ScriptMethod[];
73
+ /** Only for a session that reviews changes (`SessionOptions.review`, 23.8). */
74
+ review?: true;
75
+ }
76
+ /** The tools, in the order a model is given them. */
77
+ export declare const AGENT_TOOLS: readonly ToolDefinition[];
78
+ /** The tools a session is given: the review tool only to one that reviews changes. */
79
+ export declare const toolsFor: (session: {
80
+ reviewing: boolean;
81
+ }) => readonly ToolDefinition[];
82
+ /**
83
+ * The tools over one session, for an app that runs its own model loop: give the model
84
+ * `INSTRUCTIONS` and each tool's name, description and schema, and pass its calls to `run`.
85
+ * A call whose arguments do not fit the schema is answered with why, as a refusal. `host`
86
+ * gives the `insert` tool a picture's bytes by path; without it, pictures are refused.
87
+ */
88
+ export declare function agentTools(session: Session, host?: ToolHost): AgentTool[];
89
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAM,MAAM,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAW,KAAK,UAAU,EAAwB,MAAM,aAAa,CAAC;AAC7E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAI5C,iEAAiE;AACjE,eAAO,MAAM,UAAU,MAAM,CAAC;AAE9B;;;GAGG;AACH,eAAO,MAAM,YAAY,2nDAOwR,CAAC;AAElT,wEAAwE;AACxE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,8FAA8F;AAC9F,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,WAAW,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9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