drafted 1.17.2 → 1.17.3

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 +16 -1
  2. package/package.json +1 -1
package/mcp/server.mjs CHANGED
@@ -2893,7 +2893,22 @@ tool('fs', 'Navigate Drafted like a local filesystem. An org is the top folder:
2893
2893
  return ok({ ...result, path: `/${layer}/${lane}/${filename}`, sourceType: gw });
2894
2894
  }
2895
2895
  else if (content) body.content = content;
2896
- else if (file_path) body.file_path = file_path;
2896
+ else if (file_path) {
2897
+ // Local-file upload (stdio only): read the file here and send base64.
2898
+ // The HTTP API only accepts content/base64 — forwarding the raw path
2899
+ // makes the server reply 'content or base64 is required' (regression
2900
+ // from the fs consolidation; pre-fs write read the file locally).
2901
+ let resolved = file_path;
2902
+ try { resolved = resolve(file_path); } catch { /* keep as-is */ }
2903
+ if (!existsSync(resolved)) {
2904
+ return err(new Error(`file not found: ${file_path}`));
2905
+ }
2906
+ const buffer = readFileSync(resolved);
2907
+ const ext = extname(resolved).toLowerCase();
2908
+ const MIME = { '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.gif': 'image/gif', '.webp': 'image/webp', '.svg': 'image/svg+xml', '.pdf': 'application/pdf' };
2909
+ body.base64 = buffer.toString('base64');
2910
+ body.contentType = MIME[ext] || 'application/octet-stream';
2911
+ }
2897
2912
  else if (base64) body.base64 = base64;
2898
2913
  else return err(new Error('write requires one of content / file_path / base64 / googleType / state'));
2899
2914
  const result = await api('PUT', `/api/fs/${filePath}`, body, orgHeader);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drafted",
3
- "version": "1.17.2",
3
+ "version": "1.17.3",
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": [