drafted 1.14.3 → 1.14.4

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 +8 -4
  2. package/package.json +1 -1
package/mcp/server.mjs CHANGED
@@ -1538,11 +1538,14 @@ async function launchDesktopSignin() {
1538
1538
  }
1539
1539
 
1540
1540
  // Poll auth.json (written by the desktop app's cookie->auth.json bridge on in-app sign-in)
1541
- // until a valid session id lands or the deadline passes.
1542
- async function waitForBootstrapAuth(deadline) {
1541
+ // until a NEW session id lands or the deadline passes. `staleSid` is whatever was already in
1542
+ // auth.json before sign-in was triggered — an expired bootstrap session from a prior install
1543
+ // (e.g. past its 30-day server-side TTL) sits in that file until it's replaced, so returning
1544
+ // on ANY sid would hand back the same dead value instead of waiting for a real re-auth.
1545
+ async function waitForBootstrapAuth(deadline, staleSid) {
1543
1546
  while (Date.now() < deadline) {
1544
1547
  const sid = getBootstrapSessionId();
1545
- if (sid) return sid;
1548
+ if (sid && sid !== staleSid) return sid;
1546
1549
  await new Promise(r => setTimeout(r, 1500));
1547
1550
  }
1548
1551
  return null;
@@ -1565,11 +1568,12 @@ if (!isRemote) tool('auth', 'Sign in to Drafted. On a local install the DESKTOP
1565
1568
  }
1566
1569
  } catch { /* stale session — continue to sign-in */ }
1567
1570
  }
1571
+ const staleSid = getBootstrapSessionId();
1568
1572
  if (await launchDesktopSignin()) {
1569
1573
  if (action === 'get_link') {
1570
1574
  return ok('Opening the Drafted app to sign in — approve in the app window, then retry your request.');
1571
1575
  }
1572
- const sid = await waitForBootstrapAuth(Date.now() + 180000);
1576
+ const sid = await waitForBootstrapAuth(Date.now() + 180000, staleSid);
1573
1577
  if (!sid) throw new Error('Timed out waiting for sign-in. Complete sign-in in the Drafted app window, then retry.');
1574
1578
  getState().sessionId = null;
1575
1579
  // cloneSession() can fail transiently right after the app plants the bootstrap
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drafted",
3
- "version": "1.14.3",
3
+ "version": "1.14.4",
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": [