pushary 1.9.22 → 1.9.24

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 (105) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/data/cursor-plugin/.cursor-plugin/plugin.json +1 -1
  3. package/data/cursor-plugin/CHANGELOG.md +4 -0
  4. package/data/cursor-plugin/scripts/pushary-gate.mjs +4 -2
  5. package/data/cursor-plugin/scripts/pushary-gate.test.mjs +14 -1
  6. package/dist/bin/pushary-bell-hook.js +25 -25
  7. package/dist/bin/pushary-bell.js +9 -9
  8. package/dist/bin/pushary-claude.js +27 -26
  9. package/dist/bin/pushary-clean.js +41 -93
  10. package/dist/bin/pushary-codex-bridge.js +17 -17
  11. package/dist/bin/pushary-codex-hook.js +33 -31
  12. package/dist/bin/pushary-codex.js +12 -12
  13. package/dist/bin/pushary-connect.js +24 -24
  14. package/dist/bin/pushary-cowork.js +5 -5
  15. package/dist/bin/pushary-daemon.js +31 -31
  16. package/dist/bin/pushary-disconnect.js +24 -24
  17. package/dist/bin/pushary-doctor.js +33 -33
  18. package/dist/bin/pushary-elicitation-hook.js +25 -25
  19. package/dist/bin/pushary-gemini-bridge.js +13 -13
  20. package/dist/bin/pushary-gemini-hook.js +27 -27
  21. package/dist/bin/pushary-hook.js +29 -29
  22. package/dist/bin/pushary-login.js +16 -16
  23. package/dist/bin/pushary-logout.js +77 -26
  24. package/dist/bin/pushary-mcp.js +9 -9
  25. package/dist/bin/pushary-mode.js +12 -12
  26. package/dist/bin/pushary-notification-hook.js +24 -24
  27. package/dist/bin/pushary-opencode-hook.js +26 -26
  28. package/dist/bin/pushary-permission-denied-hook.js +29 -29
  29. package/dist/bin/pushary-permission-hook.js +28 -28
  30. package/dist/bin/pushary-post-hook.js +24 -24
  31. package/dist/bin/pushary-prompt-hook.js +24 -24
  32. package/dist/bin/pushary-session-end-hook.js +24 -24
  33. package/dist/bin/pushary-session-start-hook.js +28 -28
  34. package/dist/bin/pushary-setup.js +46 -42
  35. package/dist/bin/pushary-stats.js +5 -5
  36. package/dist/bin/pushary-status.js +26 -26
  37. package/dist/bin/pushary-stop-hook.js +24 -24
  38. package/dist/bin/pushary-stopfailure-hook.js +24 -24
  39. package/dist/bin/pushary-suggestions.js +12 -12
  40. package/dist/bin/pushary-transcript-register.js +17 -17
  41. package/dist/bin/pushary-transcripts.js +7 -7
  42. package/dist/bin/pushary-upgrade.js +30 -30
  43. package/dist/bin/pushary-wait.js +12 -12
  44. package/dist/bin/pushary.js +6 -6
  45. package/dist/{chunk-2MW4OHWI.js → chunk-264EOGIK.js} +2 -2
  46. package/dist/{chunk-WAKQYJ6T.js → chunk-2E6AWHV7.js} +3 -3
  47. package/dist/{chunk-76YNWUXC.js → chunk-2F6UQ3YD.js} +1 -1
  48. package/dist/{chunk-YPZ4AE2R.js → chunk-2JTJZ7VI.js} +4 -4
  49. package/dist/{chunk-KH2EDRJQ.js → chunk-35U2QHH2.js} +2 -2
  50. package/dist/{chunk-GNQZY4GL.js → chunk-3WRJU7KN.js} +1 -1
  51. package/dist/{chunk-3BWW4UMT.js → chunk-7JHYWFY6.js} +2 -2
  52. package/dist/{chunk-ARJSQUIS.js → chunk-7Z2DLAEE.js} +2 -2
  53. package/dist/{chunk-AR4NXO4Q.js → chunk-CLVU24OZ.js} +2 -2
  54. package/dist/{chunk-YODL2CJV.js → chunk-CYGIJXAP.js} +2 -2
  55. package/dist/{chunk-P345G4DK.js → chunk-E4B7TXVS.js} +1 -1
  56. package/dist/{chunk-ZUOIDI6M.js → chunk-EE357RIP.js} +4 -4
  57. package/dist/{chunk-JQVGCDHW.js → chunk-EKPAV33G.js} +5 -5
  58. package/dist/{chunk-TH3HKKGW.js → chunk-G6GFNKF7.js} +18 -15
  59. package/dist/{chunk-T57BCGHQ.js → chunk-GBD6G4TA.js} +1 -1
  60. package/dist/{chunk-GFXZDU4V.js → chunk-GM2IFDVF.js} +38 -3
  61. package/dist/{chunk-5TLRS3AK.js → chunk-GXQVOKHJ.js} +2 -2
  62. package/dist/{chunk-NB2PY5JX.js → chunk-H2RD5EMR.js} +3 -3
  63. package/dist/{chunk-N2JP3RKP.js → chunk-HBR6ZZHN.js} +5 -5
  64. package/dist/{chunk-KCLWVCGN.js → chunk-HLXGEOX3.js} +4 -4
  65. package/dist/{chunk-Z7KB4R6U.js → chunk-IO5ZDIHY.js} +7 -7
  66. package/dist/{chunk-U2IEM5FF.js → chunk-IS737HST.js} +1 -1
  67. package/dist/{chunk-WE2RVY7V.js → chunk-JDWOK6PE.js} +1 -1
  68. package/dist/{chunk-CW3QUV6B.js → chunk-KT5BH6GC.js} +8 -8
  69. package/dist/{chunk-UFGU7AK3.js → chunk-KX776UXN.js} +2 -2
  70. package/dist/chunk-L5MCJNSI.js +166 -0
  71. package/dist/{chunk-KCXG2INQ.js → chunk-LHFK5F3T.js} +2 -2
  72. package/dist/{chunk-6TSEEKPL.js → chunk-LOERK6N3.js} +4 -4
  73. package/dist/{chunk-U26CAOZC.js → chunk-NJK4MGXL.js} +1 -1
  74. package/dist/{chunk-E7EOUEGQ.js → chunk-NQICO3ES.js} +4 -4
  75. package/dist/{chunk-U4OWRGYI.js → chunk-O3RRQTTV.js} +5 -5
  76. package/dist/{chunk-4AO2OVUA.js → chunk-OLWKCDK4.js} +6 -6
  77. package/dist/{chunk-TSFNX5J2.js → chunk-OSOCONIE.js} +5 -5
  78. package/dist/{chunk-75MJRC5I.js → chunk-OY6NJWDD.js} +1 -1
  79. package/dist/{chunk-YR3DHPYI.js → chunk-P447F2RB.js} +1 -1
  80. package/dist/{chunk-BDGKWUK2.js → chunk-Q7IEFI7V.js} +2 -2
  81. package/dist/{chunk-TZWZVAMN.js → chunk-QDKNLNCA.js} +3 -3
  82. package/dist/{chunk-BDV4WDIA.js → chunk-RFK2WN6S.js} +1 -1
  83. package/dist/{chunk-E3FSKKTJ.js → chunk-RIBIEQHU.js} +1 -1
  84. package/dist/{chunk-6SFTI7LM.js → chunk-RK7TDMQT.js} +3 -3
  85. package/dist/{chunk-G5YMVGAK.js → chunk-SBQCRQIP.js} +4 -4
  86. package/dist/{chunk-SGUGGHMC.js → chunk-SH2KK2ED.js} +3 -3
  87. package/dist/{chunk-E7HOX73X.js → chunk-T5KM7J75.js} +4 -4
  88. package/dist/{chunk-DV26ZWUC.js → chunk-T6TJA4RF.js} +2 -2
  89. package/dist/{chunk-6IOLTFNP.js → chunk-U23XTMBF.js} +21 -8
  90. package/dist/{chunk-YI543EKI.js → chunk-URCSJZNU.js} +3 -3
  91. package/dist/{chunk-YGR5PBOF.js → chunk-VFIZFKZY.js} +3 -3
  92. package/dist/{chunk-OZVZGWER.js → chunk-VICG46JC.js} +1 -1
  93. package/dist/{chunk-LH3GTSXC.js → chunk-W5NHIA4Y.js} +8 -8
  94. package/dist/{chunk-4PERN2SO.js → chunk-WYLA6J43.js} +1 -1
  95. package/dist/{chunk-XDTYGS6R.js → chunk-XA2RGGNR.js} +4 -4
  96. package/dist/{chunk-GWKT2ZZS.js → chunk-XQROISQB.js} +2 -2
  97. package/dist/{chunk-5AZ546F6.js → chunk-Z5L4NQHC.js} +1 -1
  98. package/dist/{chunk-AGIO7SF5.js → chunk-ZVON5PCF.js} +5 -5
  99. package/dist/{global-upgrade-F3QY6OHE.js → global-upgrade-DZGLAARJ.js} +6 -6
  100. package/dist/{paths-CBEAZNJR.js → paths-JATF66FP.js} +2 -2
  101. package/dist/{reapply-4HP6N7LY.js → reapply-7TDCFXNF.js} +20 -20
  102. package/dist/src/index.js +19 -19
  103. package/dist/{upgrade-lock-N3G5V2QS.js → upgrade-lock-LPIDFQEH.js} +3 -3
  104. package/package.json +1 -1
  105. package/dist/chunk-OYIN77HO.js +0 -72
@@ -0,0 +1,166 @@
1
+ import {
2
+ APPROVAL_SETTINGS_PATH
3
+ } from "./chunk-EE357RIP.js";
4
+ import {
5
+ readMacAppAgentKey
6
+ } from "./chunk-2JTJZ7VI.js";
7
+ import {
8
+ findExportedKeyLines,
9
+ isAdoptedMacAppKey,
10
+ isCliCreatedKey,
11
+ keyPrefix,
12
+ readCliCreatedKeyPrefix,
13
+ readConfigFileKey,
14
+ readKeySource,
15
+ readMacAppKeyPrefix
16
+ } from "./chunk-U23XTMBF.js";
17
+ import {
18
+ absoluteUrl
19
+ } from "./chunk-H2RD5EMR.js";
20
+ import {
21
+ isValidApiKey
22
+ } from "./chunk-GM2IFDVF.js";
23
+
24
+ // src/key-revocation.ts
25
+ var SELF_REVOKE_PATH = "/api/v1/server/keys/self/revoke";
26
+ var DEVICE_KEY_PATH = "/api/agent/device-key";
27
+ var FULL_ACCESS_ONLY_STATUS = 403;
28
+ var REVOKE_TIMEOUT_MS = 1e4;
29
+ var readRevokedCount = async (response) => {
30
+ try {
31
+ const body = await response.json();
32
+ const revoked = typeof body === "object" && body !== null && "revoked" in body ? body.revoked : void 0;
33
+ return typeof revoked === "number" && Number.isInteger(revoked) && revoked >= 0 ? revoked : null;
34
+ } catch {
35
+ return null;
36
+ }
37
+ };
38
+ var revokeAgentKey = async (apiKey, baseUrl, fetchImpl) => {
39
+ const response = await fetchImpl(`${baseUrl}${DEVICE_KEY_PATH}`, {
40
+ method: "DELETE",
41
+ headers: { Authorization: `Bearer ${apiKey}` },
42
+ signal: AbortSignal.timeout(REVOKE_TIMEOUT_MS)
43
+ });
44
+ if (!response.ok) return { kind: "refused", status: response.status };
45
+ const revoked = await readRevokedCount(response);
46
+ if (revoked === null) return { kind: "unconfirmed", status: response.status };
47
+ return revoked > 0 ? { kind: "revoked" } : { kind: "not_accepted" };
48
+ };
49
+ var revokeOwnKey = async (apiKey, baseUrl, fetchImpl = fetch) => {
50
+ try {
51
+ const response = await fetchImpl(`${baseUrl}${SELF_REVOKE_PATH}`, {
52
+ method: "POST",
53
+ headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
54
+ signal: AbortSignal.timeout(REVOKE_TIMEOUT_MS)
55
+ });
56
+ if (response.status === 401) return { kind: "not_accepted" };
57
+ if (response.status === FULL_ACCESS_ONLY_STATUS) return await revokeAgentKey(apiKey, baseUrl, fetchImpl);
58
+ if (!response.ok) return { kind: "refused", status: response.status };
59
+ return { kind: "revoked" };
60
+ } catch (err) {
61
+ return { kind: "unreachable", detail: err instanceof Error ? err.message : "network error" };
62
+ }
63
+ };
64
+ var REVOKE_DETAIL = {
65
+ revoked: "Revoked the key on pushary.com.",
66
+ not_accepted: "pushary.com had already stopped accepting the key.",
67
+ refused: "pushary.com refused to revoke the key",
68
+ unconfirmed: "pushary.com did not confirm the key was revoked",
69
+ unreachable: "Could not reach pushary.com to revoke the key"
70
+ };
71
+ var describeRevokeAttempt = (attempt) => {
72
+ if (attempt.kind === "refused" || attempt.kind === "unconfirmed") return `${REVOKE_DETAIL[attempt.kind]} (HTTP ${attempt.status}).`;
73
+ if (attempt.kind === "unreachable") return `${REVOKE_DETAIL.unreachable}: ${attempt.detail}`;
74
+ return REVOKE_DETAIL[attempt.kind];
75
+ };
76
+ var keyNoLongerAccepted = (attempt) => attempt.kind === "revoked" || attempt.kind === "not_accepted";
77
+ var keyValidityOf = (check) => {
78
+ switch (check.kind) {
79
+ case "ok":
80
+ case "locked":
81
+ return "valid";
82
+ case "rejected":
83
+ case "malformed":
84
+ return "invalid";
85
+ case "unreachable":
86
+ return "unknown";
87
+ }
88
+ };
89
+
90
+ // src/cli/held-key-revocation.ts
91
+ var readCliHeldKeys = (profiles) => {
92
+ const source = readKeySource();
93
+ return {
94
+ configKey: readConfigFileKey(),
95
+ profileKeys: findExportedKeyLines(profiles).map((line) => line.key),
96
+ envKey: source.kind === "env" ? source.key : null,
97
+ macAppKey: readMacAppAgentKey(),
98
+ macAppKeyPrefix: readMacAppKeyPrefix(),
99
+ cliCreatedKeyPrefix: readCliCreatedKeyPrefix()
100
+ };
101
+ };
102
+ var isMacAppCurrentOrAdoptedKey = (key, keys) => key === keys.macAppKey || isAdoptedMacAppKey(key, keys.macAppKeyPrefix);
103
+ var revocationOfStoredKey = (key, keys) => {
104
+ if (isMacAppCurrentOrAdoptedKey(key, keys)) return { kind: "mac_app_key", keyPrefix: keyPrefix(key) };
105
+ if (!isCliCreatedKey(key, keys.cliCreatedKeyPrefix)) return { kind: "no_creation_record", keyPrefix: keyPrefix(key) };
106
+ return { kind: "revoke", key };
107
+ };
108
+ var validKeys = (keys) => [...new Set(keys)].filter((key) => key !== null && isValidApiKey(key));
109
+ var environmentOnlyKey = (keys, stored) => validKeys([keys.envKey]).filter((key) => !stored.includes(key)).map((key) => ({ kind: "environment_only", keyPrefix: keyPrefix(key) }));
110
+ var planCliKeyRevocations = (keys) => {
111
+ const stored = validKeys([keys.configKey, ...keys.profileKeys]);
112
+ return [...stored.map((key) => revocationOfStoredKey(key, keys)), ...environmentOnlyKey(keys, stored)];
113
+ };
114
+ var keysToRevoke = (revocations) => revocations.flatMap((revocation) => revocation.kind === "revoke" ? [revocation.key] : []);
115
+ var sparedKeys = (revocations) => revocations.flatMap((revocation) => revocation.kind === "revoke" ? [] : [revocation]);
116
+ var runRevocation = async (revocation, run) => {
117
+ if (revocation.kind !== "revoke") return revocation;
118
+ if (run.dryRun) return { kind: "would_revoke", keyPrefix: keyPrefix(revocation.key) };
119
+ return { kind: "attempted", keyPrefix: keyPrefix(revocation.key), attempt: await revokeOwnKey(revocation.key, run.baseUrl) };
120
+ };
121
+ var revokeCliKeys = async (revocations, run) => {
122
+ const outcomes = [];
123
+ for (const revocation of revocations) outcomes.push(await runRevocation(revocation, run));
124
+ return outcomes;
125
+ };
126
+ var SPARED_KEY_WHY = {
127
+ mac_app_key: "It is the Pushary Mac app's key, and the app may still be using it.",
128
+ no_creation_record: "This CLI has no record of creating it, so it may be in use by the Mac app or on another machine."
129
+ };
130
+ var localRemovalOf = (dryRun) => dryRun ? "would be removed here" : "removed here";
131
+ var settingsUrlOf = (baseUrl) => absoluteUrl(baseUrl, APPROVAL_SETTINGS_PATH);
132
+ var revokeYourselfHint = (reason, baseUrl) => reason === "no_creation_record" ? `Revoke it at ${settingsUrlOf(baseUrl)} if nothing else uses it.` : null;
133
+ var describeCliKeyRevocation = (outcome, run) => {
134
+ const label = `API key ${outcome.keyPrefix}`;
135
+ switch (outcome.kind) {
136
+ case "would_revoke":
137
+ return { tone: "skipped", line: `${label} (would revoke it on pushary.com)`, next: null };
138
+ case "mac_app_key":
139
+ case "no_creation_record":
140
+ return {
141
+ tone: "skipped",
142
+ line: `${label}: ${localRemovalOf(run.dryRun)}, not revoked. ${SPARED_KEY_WHY[outcome.kind]}`,
143
+ next: revokeYourselfHint(outcome.kind, run.baseUrl)
144
+ };
145
+ case "environment_only":
146
+ return { tone: "skipped", line: `${label} in PUSHARY_API_KEY (left alone: Pushary did not write it)`, next: null };
147
+ case "attempted":
148
+ return keyNoLongerAccepted(outcome.attempt) ? { tone: "done", line: `${label}: ${describeRevokeAttempt(outcome.attempt)}`, next: null } : {
149
+ tone: "warning",
150
+ line: `${label}: ${describeRevokeAttempt(outcome.attempt)}`,
151
+ next: `It may still be valid. Revoke it at ${settingsUrlOf(run.baseUrl)}`
152
+ };
153
+ }
154
+ };
155
+
156
+ export {
157
+ revokeOwnKey,
158
+ keyNoLongerAccepted,
159
+ keyValidityOf,
160
+ readCliHeldKeys,
161
+ planCliKeyRevocations,
162
+ keysToRevoke,
163
+ sparedKeys,
164
+ revokeCliKeys,
165
+ describeCliKeyRevocation
166
+ };
@@ -8,10 +8,10 @@ import {
8
8
  codexHooksJsonIn,
9
9
  isPusharyCodexCommand,
10
10
  resolvePathBinary
11
- } from "./chunk-E7EOUEGQ.js";
11
+ } from "./chunk-NQICO3ES.js";
12
12
  import {
13
13
  getPackageVersion
14
- } from "./chunk-GFXZDU4V.js";
14
+ } from "./chunk-GM2IFDVF.js";
15
15
 
16
16
  // src/codex-app-server.ts
17
17
  import { existsSync, realpathSync } from "fs";
@@ -3,18 +3,18 @@ import {
3
3
  addGeminiMcpServer,
4
4
  removeGeminiMcpServer,
5
5
  supportedClaudeEvents
6
- } from "./chunk-YGR5PBOF.js";
6
+ } from "./chunk-VFIZFKZY.js";
7
7
  import {
8
8
  CLAUDE_CODE_AGENT,
9
9
  parseApplyPatchFiles
10
- } from "./chunk-CW3QUV6B.js";
10
+ } from "./chunk-KT5BH6GC.js";
11
11
  import {
12
12
  guardBinary,
13
13
  guardBinaryRefusing,
14
14
  holdBudgetOf,
15
15
  isProtectedByScope,
16
16
  registerHookEntry
17
- } from "./chunk-E7EOUEGQ.js";
17
+ } from "./chunk-NQICO3ES.js";
18
18
  import {
19
19
  HOOK_LOCATOR_BINARY,
20
20
  PHONE_ANSWERED_TOOLS,
@@ -24,7 +24,7 @@ import {
24
24
  refusalOutput,
25
25
  toToolLookup,
26
26
  withHookHoldBudget
27
- } from "./chunk-GFXZDU4V.js";
27
+ } from "./chunk-GM2IFDVF.js";
28
28
 
29
29
  // src/claude-config.ts
30
30
  import { join } from "path";
@@ -10,7 +10,7 @@ import {
10
10
  isSetupConnectMode,
11
11
  isValidApiKey,
12
12
  normalizeAgentId
13
- } from "./chunk-GFXZDU4V.js";
13
+ } from "./chunk-GM2IFDVF.js";
14
14
 
15
15
  // src/setup/options.ts
16
16
  var AGENT_CHOICES = SETUP_AGENT_CHOICES;
@@ -13,7 +13,7 @@ import {
13
13
  isReleaseVersion,
14
14
  ownPackageName,
15
15
  withHookHoldBudget
16
- } from "./chunk-GFXZDU4V.js";
16
+ } from "./chunk-GM2IFDVF.js";
17
17
 
18
18
  // src/setup/paths.ts
19
19
  import { homedir as homedir2 } from "os";
@@ -395,9 +395,9 @@ var installGlobally = (options) => {
395
395
  }
396
396
  const started = (async () => {
397
397
  if (!npmIsOnPath()) throw new NpmMissingError();
398
- const { withUpgradeLock } = await import("./global-upgrade-F3QY6OHE.js");
399
- const { installWithUpgradeLock, ownsUpgradeLock } = await import("./upgrade-lock-N3G5V2QS.js");
400
- const { autoUpdateLock: autoUpdateLock2 } = await import("./paths-CBEAZNJR.js");
398
+ const { withUpgradeLock } = await import("./global-upgrade-DZGLAARJ.js");
399
+ const { installWithUpgradeLock, ownsUpgradeLock } = await import("./upgrade-lock-LPIDFQEH.js");
400
+ const { autoUpdateLock: autoUpdateLock2 } = await import("./paths-JATF66FP.js");
401
401
  let result = "skipped";
402
402
  const install = async () => {
403
403
  const platform = process.platform;
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  compatibleConfigFile
3
- } from "./chunk-6TSEEKPL.js";
3
+ } from "./chunk-LOERK6N3.js";
4
4
  import {
5
5
  hookOwnerOf,
6
6
  hookOwnerOfCommands,
7
7
  liveBridgeProbe,
8
8
  resolveBridgeStub
9
- } from "./chunk-TSFNX5J2.js";
9
+ } from "./chunk-OSOCONIE.js";
10
10
  import {
11
11
  AGENT_CHOICES
12
- } from "./chunk-U26CAOZC.js";
12
+ } from "./chunk-NJK4MGXL.js";
13
13
  import {
14
14
  claudeSettings,
15
15
  codexHooksJson,
@@ -18,7 +18,7 @@ import {
18
18
  guardedArgv,
19
19
  pusharyDir,
20
20
  vscodePluginDir
21
- } from "./chunk-E7EOUEGQ.js";
21
+ } from "./chunk-NQICO3ES.js";
22
22
  import {
23
23
  readJsonSafe
24
24
  } from "./chunk-AQFEP65J.js";
@@ -29,7 +29,7 @@ import {
29
29
  OPENCODE_APPROVAL_EVENT,
30
30
  hookCompatibleProfile,
31
31
  isRecord
32
- } from "./chunk-GFXZDU4V.js";
32
+ } from "./chunk-GM2IFDVF.js";
33
33
 
34
34
  // src/opencode-plugin.ts
35
35
  var OPENCODE_PLUGIN_MARKER = "pushary-opencode-plugin w1";
@@ -3,27 +3,27 @@ import {
3
3
  expectedLaunchCapabilities,
4
4
  hasSpawnProvider,
5
5
  resolveControlPolicy
6
- } from "./chunk-UFGU7AK3.js";
6
+ } from "./chunk-KX776UXN.js";
7
7
  import {
8
8
  daemonHasRemoteProof,
9
9
  daemonServiceManagerAvailable,
10
10
  hasDaemonServiceDefinition,
11
11
  readDaemonNeedsLogin,
12
12
  readDaemonStatus
13
- } from "./chunk-N2JP3RKP.js";
13
+ } from "./chunk-HBR6ZZHN.js";
14
14
  import {
15
15
  readControlMode,
16
16
  readKeySource
17
- } from "./chunk-6IOLTFNP.js";
17
+ } from "./chunk-U23XTMBF.js";
18
18
  import {
19
19
  getMachineId
20
- } from "./chunk-U2IEM5FF.js";
20
+ } from "./chunk-IS737HST.js";
21
21
  import {
22
22
  getBaseUrl
23
- } from "./chunk-75MJRC5I.js";
23
+ } from "./chunk-OY6NJWDD.js";
24
24
  import {
25
25
  getPackageVersion
26
- } from "./chunk-GFXZDU4V.js";
26
+ } from "./chunk-GM2IFDVF.js";
27
27
 
28
28
  // src/machines.ts
29
29
  import { hostname } from "os";
@@ -2,23 +2,23 @@ import {
2
2
  CLAUDE_HOOK_EVENTS,
3
3
  GEMINI_HOOK_EVENTS,
4
4
  hasGeminiHooks
5
- } from "./chunk-YGR5PBOF.js";
5
+ } from "./chunk-VFIZFKZY.js";
6
6
  import {
7
7
  AGENT_CHOICES
8
- } from "./chunk-U26CAOZC.js";
8
+ } from "./chunk-NJK4MGXL.js";
9
9
  import {
10
10
  BELL_HOOK_BINARY
11
- } from "./chunk-OZVZGWER.js";
11
+ } from "./chunk-VICG46JC.js";
12
12
  import {
13
13
  CODEX_HOOK_EVENTS,
14
14
  hasCodexHooks,
15
15
  holdBudgetOf
16
- } from "./chunk-E7EOUEGQ.js";
16
+ } from "./chunk-NQICO3ES.js";
17
17
  import {
18
18
  CURSOR_GATE_EVENTS,
19
19
  HOOK_LOCATOR_BINARY,
20
20
  hookCommandHoldBudget
21
- } from "./chunk-GFXZDU4V.js";
21
+ } from "./chunk-GM2IFDVF.js";
22
22
 
23
23
  // src/diagnostics/bridge.ts
24
24
  import { execFileSync } from "child_process";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  NPX_LATEST_COMMAND
3
- } from "./chunk-TZWZVAMN.js";
3
+ } from "./chunk-QDKNLNCA.js";
4
4
 
5
5
  // src/config.ts
6
6
  import { readFileSync } from "fs";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-3EGEA4KH.js";
10
10
  import {
11
11
  getBaseUrl
12
- } from "./chunk-75MJRC5I.js";
12
+ } from "./chunk-OY6NJWDD.js";
13
13
 
14
14
  // src/cli/login-ui.ts
15
15
  import { hostname } from "os";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  parseSseMessages
3
- } from "./chunk-6SFTI7LM.js";
3
+ } from "./chunk-RK7TDMQT.js";
4
4
  import {
5
5
  NPX_LATEST_COMMAND
6
- } from "./chunk-TZWZVAMN.js";
6
+ } from "./chunk-QDKNLNCA.js";
7
7
 
8
8
  // src/mcp-stdio-bridge.ts
9
9
  var MCP_BRIDGE_BINARY = "pushary-mcp";
@@ -2,7 +2,7 @@ import {
2
2
  DISCONNECT_AGENT_IDS,
3
3
  SETUP_AGENT_CHOICES,
4
4
  isApprovalMode
5
- } from "./chunk-GFXZDU4V.js";
5
+ } from "./chunk-GM2IFDVF.js";
6
6
 
7
7
  // src/cli/mode-request.ts
8
8
  var parseDuration = (value) => {
@@ -142,7 +142,7 @@ var COMMAND_OPTIONS = {
142
142
  ],
143
143
  clean: [
144
144
  ["--dry-run", "List everything it would remove and change nothing"],
145
- ["--everything", "Also revoke the keys the CLI wrote (config.json and its shell profile export) and remove what the Mac app set up: quits it, then its keychain items, local state and editor extension"],
145
+ ["--everything", "Also revoke the key this CLI created (any other key is only removed) and remove what the Mac app set up: quits it, then its keychain items, local state and editor extension"],
146
146
  ["--yes", "Remove everything without asking"]
147
147
  ],
148
148
  transcripts: [
@@ -165,7 +165,7 @@ var COMMAND_OPTIONS = {
165
165
  ["--devices", "Also list the machines registered to this site"]
166
166
  ],
167
167
  "sign-out": [
168
- ["--revoke", "Also kill the key server-side, so it stops working everywhere"],
168
+ ["--revoke", "Also revoke the key server-side if this CLI created it; any other key is only removed"],
169
169
  ["--json", "Emit the result as one object instead of the screen"]
170
170
  ],
171
171
  doctor: [
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PRETOOLUSE_GATED_TOOLS
3
- } from "./chunk-GFXZDU4V.js";
3
+ } from "./chunk-GM2IFDVF.js";
4
4
 
5
5
  // src/claude-tools.ts
6
6
  var POSTTOOLUSE_MIRROR_ONLY_TOOLS = ["TodoWrite", "Task", "WebFetch", "WebSearch"];
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  redactSecretsFromContent
3
- } from "./chunk-GFXZDU4V.js";
3
+ } from "./chunk-GM2IFDVF.js";
4
4
 
5
5
  // src/crypto.ts
6
6
  import nacl from "tweetnacl";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  keyCheckFromResponse
3
- } from "./chunk-NB2PY5JX.js";
3
+ } from "./chunk-H2RD5EMR.js";
4
4
  import {
5
5
  installNetworkDefaults
6
- } from "./chunk-WAKQYJ6T.js";
6
+ } from "./chunk-2E6AWHV7.js";
7
7
  import {
8
8
  getBaseUrl
9
- } from "./chunk-75MJRC5I.js";
9
+ } from "./chunk-OY6NJWDD.js";
10
10
 
11
11
  // src/retry.ts
12
12
  var isRetryable = (err) => {
@@ -14,19 +14,19 @@ import {
14
14
  } from "./chunk-FO3MDD26.js";
15
15
  import {
16
16
  callMcpTool
17
- } from "./chunk-6SFTI7LM.js";
17
+ } from "./chunk-RK7TDMQT.js";
18
18
  import {
19
19
  reportedInstallSource
20
- } from "./chunk-5TLRS3AK.js";
20
+ } from "./chunk-GXQVOKHJ.js";
21
21
  import {
22
22
  NPX_LATEST_COMMAND
23
- } from "./chunk-TZWZVAMN.js";
23
+ } from "./chunk-QDKNLNCA.js";
24
24
  import {
25
25
  NO_PAIRING_COMPUTER,
26
26
  PAIR_TTL_SECONDS,
27
27
  classifyConfirmResponse,
28
28
  isAnswerSource
29
- } from "./chunk-GFXZDU4V.js";
29
+ } from "./chunk-GM2IFDVF.js";
30
30
 
31
31
  // src/reach.ts
32
32
  var reachVerdict = (channels) => {
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  openCodeConfigDirFrom
3
- } from "./chunk-U4OWRGYI.js";
3
+ } from "./chunk-O3RRQTTV.js";
4
4
  import {
5
5
  codexHomeFrom,
6
6
  resolvePathBinary
7
- } from "./chunk-E7EOUEGQ.js";
7
+ } from "./chunk-NQICO3ES.js";
8
8
  import {
9
9
  HOOK_COMPATIBLE_PROFILES
10
- } from "./chunk-GFXZDU4V.js";
10
+ } from "./chunk-GM2IFDVF.js";
11
11
 
12
12
  // src/hermes-config.ts
13
13
  import { execFileSync } from "child_process";
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  registerTranscript
3
- } from "./chunk-LH3GTSXC.js";
3
+ } from "./chunk-W5NHIA4Y.js";
4
4
  import {
5
5
  namedEvent
6
- } from "./chunk-6TSEEKPL.js";
6
+ } from "./chunk-LOERK6N3.js";
7
7
  import {
8
8
  writeDegraded
9
- } from "./chunk-AGIO7SF5.js";
9
+ } from "./chunk-ZVON5PCF.js";
10
10
  import {
11
11
  claudeShapedHookInput,
12
12
  hookCompatibleProfileBySource
13
- } from "./chunk-GFXZDU4V.js";
13
+ } from "./chunk-GM2IFDVF.js";
14
14
 
15
15
  // src/tool-hook-input.ts
16
16
  var OPTIONAL_TEXT_FIELDS = ["hook_event_name", "session_id", "cwd", "transcript_path", "tool_use_id", "permission_mode"];
@@ -3,11 +3,11 @@ import {
3
3
  decodePublicKey,
4
4
  generateSessionKey,
5
5
  wrapSessionKey
6
- } from "./chunk-E3FSKKTJ.js";
6
+ } from "./chunk-RIBIEQHU.js";
7
7
  import {
8
8
  fetchTranscriptRecipients,
9
9
  uploadTranscriptRecords
10
- } from "./chunk-GNQZY4GL.js";
10
+ } from "./chunk-3WRJU7KN.js";
11
11
 
12
12
  // src/live-session.ts
13
13
  var MAX_TRANSCRIPT_QUEUE = 100;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveInstallSourceFor
3
- } from "./chunk-5TLRS3AK.js";
3
+ } from "./chunk-GXQVOKHJ.js";
4
4
  import {
5
5
  backupFile,
6
6
  readJsonSafe,
@@ -9,11 +9,11 @@ import {
9
9
  } from "./chunk-AQFEP65J.js";
10
10
  import {
11
11
  configFilePath
12
- } from "./chunk-75MJRC5I.js";
12
+ } from "./chunk-OY6NJWDD.js";
13
13
  import {
14
14
  API_KEY_PREFIX_PATTERN,
15
15
  isRecord
16
- } from "./chunk-GFXZDU4V.js";
16
+ } from "./chunk-GM2IFDVF.js";
17
17
 
18
18
  // src/shell-alias.ts
19
19
  import { homedir } from "os";
@@ -115,6 +115,8 @@ var isDisabledExport = (line) => {
115
115
  };
116
116
  var keyPrefix = (key) => key.split(".")[0] ?? key;
117
117
  var MAC_APP_KEY_PREFIX_FIELD = "macAppKeyPrefix";
118
+ var CLI_CREATED_KEY_PREFIX_FIELD = "cliCreatedKeyPrefix";
119
+ var isCliCreatedKey = (key, createdPrefix) => keyPrefix(key) === createdPrefix;
118
120
  var findKeyExport = (contents) => {
119
121
  const lines = contents.split("\n");
120
122
  for (const [index, line] of lines.entries()) {
@@ -131,6 +133,11 @@ var keepMacAppKeyPrefix = (current, apiKey) => {
131
133
  const { [MAC_APP_KEY_PREFIX_FIELD]: recorded, ...rest } = current;
132
134
  return recorded === keyPrefix(apiKey) ? { ...rest, [MAC_APP_KEY_PREFIX_FIELD]: recorded } : rest;
133
135
  };
136
+ var savedKeyIsCliCreated = (current, apiKey, origin) => origin === "created_by_this_cli" || current[CLI_CREATED_KEY_PREFIX_FIELD] === keyPrefix(apiKey);
137
+ var withKeyRecords = (current, apiKey, origin) => {
138
+ const { [CLI_CREATED_KEY_PREFIX_FIELD]: _previous, ...rest } = keepMacAppKeyPrefix(current, apiKey);
139
+ return savedKeyIsCliCreated(current, apiKey, origin) ? { ...rest, [CLI_CREATED_KEY_PREFIX_FIELD]: keyPrefix(apiKey) } : rest;
140
+ };
134
141
  var manualKeyStepFor = (kind, platform) => kind === "no-rc" || platform === "win32" ? "config-only" : "paste-export";
135
142
  var rcResult = (kind, over = {}) => ({
136
143
  kind,
@@ -211,7 +218,7 @@ var resolveRcTarget = () => {
211
218
  const fallback = FALLBACK_RCS.map((name) => join2(homedir2(), name)).find(existsSync2);
212
219
  return fallback ? { path: fallback, shell: null } : null;
213
220
  };
214
- var writeKey = (apiKey, options = {}) => {
221
+ var writeKey = (apiKey, origin, options = {}) => {
215
222
  const configPath = configFilePath();
216
223
  const existing = readJsonSafe(configPath);
217
224
  let current = {};
@@ -229,7 +236,7 @@ var writeKey = (apiKey, options = {}) => {
229
236
  writeJsonAtomic(
230
237
  configPath,
231
238
  {
232
- ...keepMacAppKeyPrefix(current, apiKey),
239
+ ...withKeyRecords(current, apiKey, origin),
233
240
  apiKey,
234
241
  installSource: resolveInstallSourceFor(current),
235
242
  ...options.controlMode ? { controlMode: options.controlMode } : {},
@@ -248,7 +255,7 @@ var clearKey = (options = {}) => {
248
255
  const existing = readConfigRecord(configPath);
249
256
  let removedFromConfig = false;
250
257
  if (existing !== null && typeof existing.apiKey === "string") {
251
- const { apiKey: _dropped, [MAC_APP_KEY_PREFIX_FIELD]: _adopted, ...rest } = existing;
258
+ const { apiKey: _dropped, [MAC_APP_KEY_PREFIX_FIELD]: _adopted, [CLI_CREATED_KEY_PREFIX_FIELD]: _created, ...rest } = existing;
252
259
  writeJsonAtomic(configPath, rest, KEY_FILE_MODE);
253
260
  restrictFile(configPath);
254
261
  removedFromConfig = true;
@@ -306,11 +313,13 @@ var readKeySource = () => {
306
313
  if (fileKey) return { kind: "config", key: fileKey, origin: configPath, drift: null };
307
314
  return { kind: "none", key: null, origin: null, drift: null };
308
315
  };
309
- var readMacAppKeyPrefix = (configPath = configFilePath()) => {
310
- const recorded = readConfigRecord(configPath)?.[MAC_APP_KEY_PREFIX_FIELD];
316
+ var readRecordedKeyPrefix = (configPath, field) => {
317
+ const recorded = readConfigRecord(configPath)?.[field];
311
318
  return typeof recorded === "string" && API_KEY_PREFIX_PATTERN.test(recorded) ? recorded : null;
312
319
  };
320
+ var readMacAppKeyPrefix = (configPath = configFilePath()) => readRecordedKeyPrefix(configPath, MAC_APP_KEY_PREFIX_FIELD);
313
321
  var isAdoptedMacAppKey = (key, adoptedPrefix) => keyPrefix(key) === adoptedPrefix;
322
+ var readCliCreatedKeyPrefix = (configPath = configFilePath()) => readRecordedKeyPrefix(configPath, CLI_CREATED_KEY_PREFIX_FIELD);
314
323
  var recordMacAppKeyPrefix = (apiKey, configPath = configFilePath()) => {
315
324
  const config = readConfigRecord(configPath);
316
325
  if (config === null || config.apiKey !== apiKey) return false;
@@ -348,7 +357,9 @@ export {
348
357
  exportLine,
349
358
  isDisabledExport,
350
359
  keyPrefix,
360
+ isCliCreatedKey,
351
361
  manualKeyStepFor,
362
+ resolveRcTarget,
352
363
  writeKey,
353
364
  clearKey,
354
365
  readConfigFileKey,
@@ -357,7 +368,9 @@ export {
357
368
  readKeySource,
358
369
  readMacAppKeyPrefix,
359
370
  isAdoptedMacAppKey,
371
+ readCliCreatedKeyPrefix,
360
372
  recordMacAppKeyPrefix,
373
+ shellProfileCandidates,
361
374
  findExportedKeyLines,
362
375
  findExportedKeyLine
363
376
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SETUP_FLAGS
3
- } from "./chunk-U26CAOZC.js";
3
+ } from "./chunk-NJK4MGXL.js";
4
4
  import {
5
5
  parseFlags
6
6
  } from "./chunk-GMXKITVA.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-7QLSKOSU.js";
10
10
  import {
11
11
  NPX_LATEST_COMMAND
12
- } from "./chunk-TZWZVAMN.js";
12
+ } from "./chunk-QDKNLNCA.js";
13
13
  import {
14
14
  CLAUDE_CONNECTOR_GUIDE,
15
15
  CLAUDE_CONNECTOR_STEPS,
@@ -17,7 +17,7 @@ import {
17
17
  CLAUDE_CONNECTOR_URL,
18
18
  COWORK_CONNECTOR_LIMIT,
19
19
  COWORK_STANDING_INSTRUCTIONS
20
- } from "./chunk-GFXZDU4V.js";
20
+ } from "./chunk-GM2IFDVF.js";
21
21
 
22
22
  // src/cli/cowork.ts
23
23
  import { readFileSync } from "fs";