drafted 1.19.38 → 1.19.39

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 +14 -0
  2. package/package.json +1 -1
package/mcp/server.mjs CHANGED
@@ -1653,6 +1653,7 @@ async function resolveProjectArg(projectArg, { required = true } = {}) {
1653
1653
  * /projects/<folder>/<project>/<layer>/<lane>/<file>
1654
1654
  * /projects/<project>/<layer>/<file> (layer-root file)
1655
1655
  * /o/<org>/projects/<project>/<layer>/<lane>/<file> (URL form)
1656
+ * /o/<org>[/<folder>]/tasks/<lane?>/<file> | /tasks/... (tasks root)
1656
1657
  * /f/<uuid> | bare UUID
1657
1658
  * Returns { frameId } or throws with a helpful message.
1658
1659
  */
@@ -1666,6 +1667,19 @@ async function resolveFsFramePath(path) {
1666
1667
  let fsPath = p;
1667
1668
  const urlForm = p.match(/^\/o\/[^/]+\/projects\/(.+)$/);
1668
1669
  if (urlForm) fsPath = '/projects/' + urlForm[1];
1670
+ // Tasks form. This is the address Drafted PRINTS for a task (the /tasks root,
1671
+ // not the system project behind it), so it has to resolve here too — a printed
1672
+ // path that this tool rejects is the worst kind of dead end. Checked after the
1673
+ // /projects form so the raw `/projects/tasks/tasks/...` URL still works.
1674
+ const taskForm = !urlForm && (p.match(/^\/o\/([^/]+)\/(?:(.+?)\/)?tasks\/(.+)$/) || p.match(/^()()\/tasks\/(.+)$/));
1675
+ if (taskForm) {
1676
+ const sys = await api('POST', '/api/tasks/project', { create: false }, {
1677
+ ...(taskForm[1] ? { 'X-Drafted-Org': decodeURIComponent(taskForm[1]) } : {}),
1678
+ ...(taskForm[2] ? { 'X-Drafted-Folder': taskForm[2] } : {}),
1679
+ }).catch((e) => (e.status === 404 ? null : Promise.reject(e)));
1680
+ if (!sys?.id) throw new Error(`Not found: ${path} — this org has no tasks yet.`);
1681
+ fsPath = `/projects/${sys.id}/tasks/${taskForm[3]}`;
1682
+ }
1669
1683
  if (!fsPath.startsWith('/projects')) {
1670
1684
  throw new Error('Target must be a frame URL, frame ID, or path /projects/<project>/<layer>/<lane>/<file>');
1671
1685
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drafted",
3
- "version": "1.19.38",
3
+ "version": "1.19.39",
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": [