drafted 1.21.2 → 1.21.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 +12 -2
  2. package/package.json +1 -1
package/mcp/server.mjs CHANGED
@@ -1061,7 +1061,14 @@ async function cloneSession() {
1061
1061
  // id (stable per machine) so they ALSO keep one stable session/name across restarts
1062
1062
  // instead of churning a fresh session every process. (Org is per-request, so a
1063
1063
  // shared child session does NOT cause cross-agent org clobbering.)
1064
- const agentKey = (process.env.DRAFTED_AGENT_NAME || '').trim() || bootstrapId;
1064
+ //
1065
+ // A Causeway-launched agent keys on its Causeway session: without that, a single-org
1066
+ // user's concurrent anonymous agents dedupe to ONE shared session and one surface, so
1067
+ // a dashboard following one of them shows all of them (embed-follow contract §1.3).
1068
+ const causewaySession = (process.env.CAUSEWAY_SESSION_ID || '').trim();
1069
+ const agentKey = (process.env.DRAFTED_AGENT_NAME || '').trim()
1070
+ || (causewaySession ? `causeway-session:${causewaySession}` : '')
1071
+ || bootstrapId;
1065
1072
  const res = await serverFetch(`${getServerUrl()}/auth/session/clone`, {
1066
1073
  method: 'POST',
1067
1074
  headers: { 'Content-Type': 'application/json', Cookie: `gc_session=${bootstrapId}` },
@@ -1810,7 +1817,10 @@ async function connectAgentWs() {
1810
1817
  // moment it connects — before opening any project. Project work later flips it active.
1811
1818
  // suggestedName (basename of the working directory) lets the server offer it in the
1812
1819
  // name-before-work gate message and as the tab placeholder.
1813
- try { agentWs.send(JSON.stringify({ type: 'agent-hello', agentLabel: getAgentLabel(), suggestedName: getSuggestedSessionName() })); } catch {}
1820
+ // externalSessionId: the Causeway session this agent runs in, opaque to Drafted, so the
1821
+ // Causeway dashboard can follow this session (GET /api/surfaces?external=).
1822
+ const externalSessionId = (process.env.CAUSEWAY_SESSION_ID || '').trim() || undefined;
1823
+ try { agentWs.send(JSON.stringify({ type: 'agent-hello', agentLabel: getAgentLabel(), suggestedName: getSuggestedSessionName(), externalSessionId })); } catch {}
1814
1824
  // Local capabilities for the Get set up page: only a status word, never the
1815
1825
  // Google account, scopes or client. Same open-race guard as the hello.
1816
1826
  if (!isRemote) detectGwsStatus().then((gws) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drafted",
3
- "version": "1.21.2",
3
+ "version": "1.21.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": [