drafted 1.11.21 → 1.11.22

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 -2
  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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drafted",
3
- "version": "1.11.21",
3
+ "version": "1.11.22",
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": [