drafted 1.19.45 → 1.19.47

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 +15 -3
  2. package/package.json +1 -1
package/mcp/server.mjs CHANGED
@@ -2562,15 +2562,26 @@ async function sessionSurfaceBlock() {
2562
2562
  async function getGoogleDriveAvailability() {
2563
2563
  try {
2564
2564
  const status = await api('GET', '/api/google/status');
2565
+ const others = Array.isArray(status?.otherConnectedOrgs) ? status.otherConnectedOrgs : [];
2566
+ const otherHint = others.length
2567
+ ? ' Google Drive IS connected in org(s) you belong to: '
2568
+ + others.map((o) => `${o.orgName} (${o.mode}) → address /o/${o.orgSlug}/...`).join('; ')
2569
+ + '.'
2570
+ : '';
2565
2571
  return {
2566
2572
  connected: !!status?.connected,
2567
2573
  driveRootFolderName: status?.driveRootFolderName || null,
2574
+ otherConnectedOrgs: others,
2568
2575
  preference: status?.connected
2569
2576
  ? 'Google Drive is connected for this org — strongly prefer Google Workspace frames (.google-doc / .google-sheet / .google-slide) for docs, sheets, and decks.'
2570
- : 'Google Drive is not connected for this org — use normal Drafted frames (.md / .html); Google Workspace writes will fail.',
2577
+ : 'Google Drive is not connected for this org — use normal Drafted frames (.md / .html); Google Workspace writes will fail.' + otherHint,
2571
2578
  };
2572
- } catch {
2573
- return { connected: false, driveRootFolderName: null, preference: 'Google Drive status unavailable use normal Drafted frames.' };
2579
+ } catch (e) {
2580
+ // Never throw, but never mask WHY either: the name-before-work gate 403s every
2581
+ // api() call on an unnamed agent session, and swallowing that read as "not
2582
+ // connected" sent an agent chasing a Drive bug that was really an unnamed session.
2583
+ console.error('[google-drive-avail] status unavailable:', e instanceof Error ? e.message : e);
2584
+ return { connected: false, driveRootFolderName: null, otherConnectedOrgs: [], preference: 'Google Drive status unavailable — use normal Drafted frames.' };
2574
2585
  }
2575
2586
  }
2576
2587
 
@@ -4392,6 +4403,7 @@ tool('drive', 'The org\'s Google Drive mirror: its state, and the conflicts a hu
4392
4403
  connectionMode: conn?.connectionMode || null,
4393
4404
  googleEmail: conn?.googleEmail || null,
4394
4405
  driveRootFolderName: conn?.driveRootFolderName || null,
4406
+ otherConnectedOrgs: conn?.otherConnectedOrgs || [],
4395
4407
  syncEnabled: conn?.syncEnabled ?? null,
4396
4408
  openConflicts: rows.length,
4397
4409
  openConflictsByType: countByType(rows),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drafted",
3
- "version": "1.19.45",
3
+ "version": "1.19.47",
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": [