drafted 1.11.21 → 1.11.23

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 +22 -5
  2. package/package.json +1 -1
package/mcp/server.mjs CHANGED
@@ -1003,7 +1003,7 @@ async function connectAgentWs() {
1003
1003
  agentWs.on('open', () => {
1004
1004
  console.error('[MCP-WS] Connected');
1005
1005
  if (getState().projectId) {
1006
- agentWs.send(JSON.stringify({ type: 'join', projectId: getState().projectId, agent: true }));
1006
+ agentWs.send(JSON.stringify({ type: 'join', projectId: getState().projectId, agent: true, agentLabel: getAgentLabel() }));
1007
1007
  }
1008
1008
  });
1009
1009
 
@@ -1025,13 +1025,27 @@ async function connectAgentWs() {
1025
1025
  });
1026
1026
  }
1027
1027
 
1028
+ // Build a display-only label for this agent session (editor + active project).
1029
+ // Identity stays the cloned gc_session id (read server-side from the cookie);
1030
+ // this is only used for window titles / presence display.
1031
+ function getAgentLabel() {
1032
+ const editor = process.env.DRAFTED_AGENT_NAME
1033
+ || (process.env.CLAUDECODE ? 'Claude Code' : null)
1034
+ || (process.env.CURSOR_TRACE_ID ? 'Cursor' : null)
1035
+ || process.env.TERM_PROGRAM
1036
+ || 'agent';
1037
+ const meta = getState().projectMeta;
1038
+ const proj = meta?.name || meta?.slug || null;
1039
+ return proj ? `${editor} - ${proj}` : editor;
1040
+ }
1041
+
1028
1042
  async function joinAgentWsRoom(projectId) {
1029
1043
  // Ensure WS is connected (may not be after restart/session re-clone)
1030
1044
  if (!agentWs || agentWs.readyState > WebSocket.OPEN) {
1031
1045
  await connectAgentWs();
1032
1046
  }
1033
1047
  if (!agentWs) return;
1034
- const msg = JSON.stringify({ type: 'join', projectId, agent: true });
1048
+ const msg = JSON.stringify({ type: 'join', projectId, agent: true, agentLabel: getAgentLabel() });
1035
1049
  if (agentWs.readyState === WebSocket.OPEN) {
1036
1050
  agentWs.send(msg);
1037
1051
  } else if (agentWs.readyState === WebSocket.CONNECTING) {
@@ -2480,9 +2494,12 @@ tool('ls', 'List contents of the ACTIVE PROJECT. Use ls / after project(action="
2480
2494
  try {
2481
2495
  const params = new URLSearchParams();
2482
2496
  params.set('path', path);
2483
- // Recursive walks can return huge content payloads force summary mode
2484
- // so each entry stays small. Agents that need full content can read individual frames.
2485
- if (recursive) {
2497
+ // At layer depth (/designs, /wireframes, etc.) auto-recurse so frames in sublanes
2498
+ // are always visible without this, agents only see root frames and miss any frame
2499
+ // whose lane != "". Recursive walks force summary mode to keep payloads small.
2500
+ const cleanPath = (path || '/').replace(/^\/+|\/+$/g, '');
2501
+ const pathDepth = cleanPath ? cleanPath.split('/').length : 0;
2502
+ if (recursive || pathDepth === 1) {
2486
2503
  params.set('recursive', 'true');
2487
2504
  params.set('summary', 'true');
2488
2505
  } else if (summary) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drafted",
3
- "version": "1.11.21",
3
+ "version": "1.11.23",
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": [