patchcord 0.5.126 → 0.5.128

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "patchcord",
3
3
  "description": "Cross-machine agent messaging. Messages from other agents land in the inbox and wake the agent to reply.",
4
- "version": "0.5.126",
4
+ "version": "0.5.128",
5
5
  "author": {
6
6
  "name": "ppravdin"
7
7
  },
package/bin/patchcord.mjs CHANGED
@@ -934,11 +934,26 @@ if (cmd === "login" || cmd === "orchestrator" || cmd === "teamlead" || cmd === "
934
934
  const accountCall = async (method, path, body) => {
935
935
  let m = await requireAuth();
936
936
  let r = await _httpJSON(method, `${m.baseUrl}${path}`, m.token, body);
937
- if (r.status === "401" || r.status === "403") {
938
- // Stale/invalid account token. Forget it and fail fast do NOT auto-relogin
939
- // (would hang headless, see requireAuth). The user re-runs `patchcord login`.
940
- forgetAuth();
941
- console.error(`patchcord account token rejected (HTTP ${r.status}). Run \`patchcord login\` again. Cannot continue.`);
937
+ // NEVER delete the stored credential on a request-level failure. The account
938
+ // token (pcm-) does not expire, and a 401/403 is almost never proof it is bad:
939
+ // - 401 can be transient (server restart / DB blip surfaces as a false
940
+ // "invalid main token"). Deleting it would strand a headless agent that
941
+ // cannot open a browser login.
942
+ // - 403 means THIS action is forbidden (namespace/role) — it says nothing
943
+ // about credential validity.
944
+ // Surface the error and stop. If the token is genuinely revoked, the user
945
+ // runs `patchcord login` — an explicit, human action, never automatic.
946
+ if (r.status === "401") {
947
+ console.error(`patchcord: account request returned HTTP 401. Your login was NOT deleted. If this keeps happening, run \`patchcord login\`.`);
948
+ process.exit(1);
949
+ }
950
+ if (r.status === "403") {
951
+ const reason = (r.json && (r.json.error || r.json.message)) || (r.body || "").slice(0, 200) || "forbidden";
952
+ console.error(`patchcord: request forbidden (HTTP 403): ${reason}`);
953
+ process.exit(1);
954
+ }
955
+ if (r.status === "503") {
956
+ console.error(`patchcord: server temporarily unavailable (HTTP 503). Retry in a moment.`);
942
957
  process.exit(1);
943
958
  }
944
959
  return { ...r, m };
@@ -1675,10 +1690,15 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
1675
1690
  // (~/.gemini/settings.json) while Antigravity is PER-PROJECT
1676
1691
  // (<project>/.agents/mcp_config.json). So the shared global skill must be
1677
1692
  // seeded ONLY off Gemini CLI's global config — never off an Antigravity config.
1678
- // A patchcord entry in the global ~/.gemini/antigravity(-cli)/mcp_config.json is
1679
- // a leaked per-project token: it makes agy load the patchcord MCP (and its
1680
- // "check inbox first" instruction) in EVERY project, and it kept this skill
1681
- // seeded everywhere. We strip that leak below and gate the skill on Gemini only.
1693
+ // A patchcord entry in the global ~/.gemini/antigravity(-cli)/mcp_config.json or
1694
+ // ~/.gemini/config/mcp_config.json (Antigravity's post-migration global path
1695
+ // confirmed live via the sibling ~/.gemini/config/.migrated marker; the older
1696
+ // two paths are its predecessors) is a leaked per-project token: it makes agy
1697
+ // load the patchcord MCP (and its "check inbox first" instruction) in EVERY
1698
+ // project, and it kept this skill seeded everywhere. We strip that leak below
1699
+ // and gate the skill on Gemini only. Keep all three paths in sync — a prior
1700
+ // fix (a36809c) covered only the first two and missed the migrated path,
1701
+ // leaving leaks there uncleaned.
1682
1702
  if (existsSync(join(HOME, ".gemini"))) {
1683
1703
  // Remove any leaked patchcord server from Antigravity's GLOBAL configs so a
1684
1704
  // per-project token stops hijacking every agy session. Preserve other MCP
@@ -1686,6 +1706,7 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
1686
1706
  for (const agGlobal of [
1687
1707
  join(HOME, ".gemini", "antigravity", "mcp_config.json"),
1688
1708
  join(HOME, ".gemini", "antigravity-cli", "mcp_config.json"),
1709
+ join(HOME, ".gemini", "config", "mcp_config.json"),
1689
1710
  ]) {
1690
1711
  if (!existsSync(agGlobal)) continue;
1691
1712
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchcord",
3
- "version": "0.5.126",
3
+ "version": "0.5.128",
4
4
  "description": "Cross-machine agent messaging for Claude Code and Codex",
5
5
  "scripts": {
6
6
  "version": "node scripts/sync-plugin-version.mjs && git add .claude-plugin/plugin.json"