drafted 1.19.37 → 1.19.38

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 +17 -1
  2. package/package.json +1 -1
package/mcp/server.mjs CHANGED
@@ -4014,12 +4014,28 @@ tool('fs', 'Navigate Drafted like a local filesystem. A FOLDER is the single con
4014
4014
  const body = {};
4015
4015
  if (gw) {
4016
4016
  // Google Workspace frames are created via the workspace endpoint (the
4017
- // label drops the .google-* extension), then populated with native actions.
4017
+ // label drops the .google-* extension). Content (inline text, a local
4018
+ // text file, or base64) rides along: the server populates the Doc
4019
+ // (markdown → headings/bullets/styles/tables) or Sheet (CSV rows).
4020
+ let gwContent = null;
4021
+ if (content !== undefined && content !== null && content !== '') gwContent = String(content);
4022
+ else if (file_path) {
4023
+ const resolved = (() => { try { return resolve(file_path); } catch { return file_path; } })();
4024
+ if (!existsSync(resolved)) return err(new Error(`file not found: ${file_path}`));
4025
+ if (typeof file_path === 'string' && /\.(xlsx|xls|pdf|png|jpe?g|gif|webp|zip|docx)$/i.test(resolved)) {
4026
+ return err(new Error(`binary file ${basename(resolved)} cannot populate a ${gw}: pass content= (CSV for .google-sheet, markdown for .google-doc) or write a .xlsx frame instead`));
4027
+ }
4028
+ gwContent = readFileSync(resolved, 'utf8');
4029
+ } else if (base64) {
4030
+ try { gwContent = Buffer.from(base64, 'base64').toString('utf8'); } catch { gwContent = null; }
4031
+ }
4018
4032
  const label = basename(filename, extname(filename)) || filename;
4019
4033
  const result = await api('POST', '/api/google/workspace/create-frame', {
4020
4034
  projectId: getState().projectId,
4021
4035
  layer, lane, label, type: gw, title: title || label,
4036
+ ...(gwContent ? { content: gwContent } : {}),
4022
4037
  }, orgHeader);
4038
+ if (result?.contentError) return err(new Error(`${gw} created but content population failed: ${result.contentError} — populate via google doc-content/sheet-values actions`));
4023
4039
  return ok({ ...result, path: `/${layer}/${lane}/${filename}`, sourceType: gw });
4024
4040
  }
4025
4041
  else if (content) body.content = content;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drafted",
3
- "version": "1.19.37",
3
+ "version": "1.19.38",
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": [