drafted 1.11.3 → 1.11.4

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 (2) hide show
  1. package/mcp/server.mjs +21 -8
  2. package/package.json +4 -1
package/mcp/server.mjs CHANGED
@@ -1916,11 +1916,12 @@ tool('frame', 'Frame CRUD in the ACTIVE PROJECT. Dispatch by `action`: read (by
1916
1916
  title: z.string().optional().describe('[write + googleType] Title for a new native file. Defaults to filename from path.'),
1917
1917
  url: z.string().optional().describe('[write + googleType] Existing Google file URL to attach.'),
1918
1918
  googleId: z.string().optional().describe('[write + googleType] Existing Google file ID to attach. [Sheet/Doc/Slide actions] Native Google file ID to use when not resolving from path/frame.'),
1919
- officeType: z.enum(['xlsx']).optional().describe('[create_office] native Drafted-owned Office format to author. Currently xlsx (real .xlsx bytes — download is the file itself, no conversion).'),
1920
- rows: z.array(z.array(z.union([z.string(), z.number(), z.boolean(), z.null()]))).optional().describe('[create_office] initial rows for a single-sheet xlsx (2D array of cell values).'),
1921
- sheets: z.array(z.object({ name: z.string().optional(), rows: z.array(z.array(z.union([z.string(), z.number(), z.boolean(), z.null()]))).optional() })).optional().describe('[create_office] multiple sheets: [{ name, rows }].'),
1922
- sheet: z.string().optional().describe('[read_office] limit the read to one sheet by name.'),
1923
- maxCells: z.number().optional().describe('[read_office] cap non-empty cells returned (default 5000).'),
1919
+ officeType: z.enum(['xlsx', 'docx']).optional().describe('[create_office] native Drafted-owned Office format to author: xlsx (spreadsheet) or docx (document). Real OOXML bytes — download is the file itself, no conversion.'),
1920
+ rows: z.array(z.array(z.union([z.string(), z.number(), z.boolean(), z.null()]))).optional().describe('[create_office xlsx] initial rows for a single-sheet xlsx (2D array of cell values).'),
1921
+ sheets: z.array(z.object({ name: z.string().optional(), rows: z.array(z.array(z.union([z.string(), z.number(), z.boolean(), z.null()]))).optional() })).optional().describe('[create_office xlsx] multiple sheets: [{ name, rows }].'),
1922
+ paragraphs: z.array(z.object({ html: z.string().optional(), text: z.string().optional(), style: z.string().optional() })).optional().describe('[create_office docx] document paragraphs: [{ html?, text?, style? }]. html uses the inline subset <b>,<i>,<u>,<s>,<span style="color:#c00;font-size:12pt;font-family:Arial">. style = Heading1..Heading6 or Title.'),
1923
+ sheet: z.string().optional().describe('[read_office xlsx] limit the read to one sheet by name.'),
1924
+ maxCells: z.number().optional().describe('[read_office xlsx] cap non-empty cells returned (default 5000).'),
1924
1925
  ops: z.array(z.object({
1925
1926
  type: z.string(),
1926
1927
  sheet: z.string().optional(),
@@ -1933,7 +1934,19 @@ tool('frame', 'Frame CRUD in the ACTIVE PROJECT. Dispatch by `action`: read (by
1933
1934
  from: z.string().optional(),
1934
1935
  to: z.string().optional(),
1935
1936
  rows: z.array(z.array(z.union([z.string(), z.number(), z.boolean(), z.null()]))).optional(),
1936
- })).optional().describe('[edit_office] xlsx edit ops (resolved against stable cell/sheet addresses): {type:"setCell",sheet?,ref,value|formula} | {type:"setCells",sheet?,cells:[{ref,value|formula}]} | {type:"clearRange",sheet?,range} | {type:"addSheet",name,rows?} | {type:"renameSheet",from,to} | {type:"deleteSheet",name}.'),
1937
+ id: z.string().optional(),
1938
+ html: z.string().optional(),
1939
+ text: z.string().optional(),
1940
+ find: z.string().optional(),
1941
+ replace: z.string().optional(),
1942
+ all: z.boolean().optional(),
1943
+ start: z.number().optional(),
1944
+ end: z.number().optional(),
1945
+ style: z.string().optional(),
1946
+ after: z.string().optional(),
1947
+ before: z.string().optional(),
1948
+ attrs: z.object({ b: z.boolean().optional(), i: z.boolean().optional(), u: z.boolean().optional(), strike: z.boolean().optional(), color: z.string().optional(), size: z.number().optional(), font: z.string().optional() }).optional(),
1949
+ })).optional().describe('[edit_office] edit ops, resolved against stable addresses (no index drift). xlsx: {type:"setCell",sheet?,ref,value|formula} | {type:"setCells",sheet?,cells:[{ref,value|formula}]} | {type:"clearRange",sheet?,range} | {type:"addSheet",name,rows?} | {type:"renameSheet",from,to} | {type:"deleteSheet",name}. docx (id = paraId from read_office): {type:"setParagraph",id,html|text,style?} | {type:"format",id,start,end,attrs:{b,i,u,strike,color,size,font}} (run-level, char range) | {type:"replaceText",id,find,replace,all?} | {type:"setStyle",id,style} | {type:"insertParagraph",after|before,html|text,style?} | {type:"deleteParagraph",id}.'),
1937
1950
  format: z.enum(['plain_text', 'markdown']).optional().describe('[write_doc_content|append_doc_content] Source format hint. Currently plain_text and minimal markdown are accepted as text.'),
1938
1951
  mode: z.enum(['replace', 'append', 'clear']).optional().describe('[Doc/Slide content actions] Optional mode hint for clients; prefer the explicit write/append/clear action names.'),
1939
1952
  slides: z.array(z.object({
@@ -2167,7 +2180,7 @@ tool('frame', 'Frame CRUD in the ACTIVE PROJECT. Dispatch by `action`: read (by
2167
2180
  case 'create_office': {
2168
2181
  // Author a native Drafted-owned Office file (real bytes; download is the
2169
2182
  // file itself). Populate via edit_office; read structure via read_office.
2170
- const { path, title, officeType = 'xlsx', rows, sheets } = args;
2183
+ const { path, title, officeType = 'xlsx', rows, sheets, paragraphs } = args;
2171
2184
  let layer = 'copy';
2172
2185
  let lane = 'default';
2173
2186
  let label = title;
@@ -2176,7 +2189,7 @@ tool('frame', 'Frame CRUD in the ACTIVE PROJECT. Dispatch by `action`: read (by
2176
2189
  if (p.length === 3) { layer = p[0]; lane = p[1]; label = p[2]; }
2177
2190
  }
2178
2191
  if (!label) throw new Error('Provide title (filename) or a /{layer}/{lane}/{filename} path for the new office file');
2179
- return ok(await api('POST', '/api/office/create', { projectId: getState().projectId, layer, lane, label, format: officeType, rows, sheets }));
2192
+ return ok(await api('POST', '/api/office/create', { projectId: getState().projectId, layer, lane, label, format: officeType, rows, sheets, paragraphs }));
2180
2193
  }
2181
2194
  case 'read_office': {
2182
2195
  const id = await resolveOfficeFrameId(args.path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drafted",
3
- "version": "1.11.3",
3
+ "version": "1.11.4",
4
4
  "description": "Drafted — visual thinking surface for humans and AI agents. Renders HTML, markdown, images, and code as frames on a zoomable canvas, with MCP tools for AI agents and real-time sync for humans.",
5
5
  "type": "module",
6
6
  "files": [
@@ -49,14 +49,17 @@
49
49
  "@modelcontextprotocol/sdk": "^1.27.1",
50
50
  "@sentry/browser": "^10.53.1",
51
51
  "@sentry/node": "^10.53.1",
52
+ "@xmldom/xmldom": "^0.9.10",
52
53
  "commander": "^11.1.0",
53
54
  "dagre": "^0.8.5",
55
+ "docx": "^9.7.1",
54
56
  "dotenv": "^17.3.1",
55
57
  "drizzle-orm": "^0.45.1",
56
58
  "esbuild": "^0.28.0",
57
59
  "exceljs": "^4.4.0",
58
60
  "express": "^4.18.2",
59
61
  "jsdom": "^27.0.1",
62
+ "jszip": "^3.10.1",
60
63
  "lucide": "^1.16.0",
61
64
  "mdast-util-from-markdown": "^2.0.3",
62
65
  "multer": "^2.1.1",