pushary 1.9.19 → 1.9.21

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 (102) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/bin/pushary-bell-hook.js +27 -27
  3. package/dist/bin/pushary-bell.js +14 -12
  4. package/dist/bin/pushary-claude.js +26 -26
  5. package/dist/bin/pushary-clean.js +36 -33
  6. package/dist/bin/pushary-codex-bridge.js +18 -18
  7. package/dist/bin/pushary-codex-hook.js +32 -32
  8. package/dist/bin/pushary-codex.js +13 -13
  9. package/dist/bin/pushary-connect.js +25 -25
  10. package/dist/bin/pushary-cowork.js +5 -5
  11. package/dist/bin/pushary-daemon.js +33 -33
  12. package/dist/bin/pushary-disconnect.js +25 -25
  13. package/dist/bin/pushary-doctor.js +34 -34
  14. package/dist/bin/pushary-elicitation-hook.js +27 -27
  15. package/dist/bin/pushary-gemini-bridge.js +14 -14
  16. package/dist/bin/pushary-gemini-hook.js +29 -29
  17. package/dist/bin/pushary-hook.js +31 -31
  18. package/dist/bin/pushary-login.js +13 -13
  19. package/dist/bin/pushary-logout.js +36 -20
  20. package/dist/bin/pushary-mcp.js +10 -10
  21. package/dist/bin/pushary-mode.js +13 -13
  22. package/dist/bin/pushary-notification-hook.js +26 -26
  23. package/dist/bin/pushary-opencode-hook.js +28 -28
  24. package/dist/bin/pushary-permission-denied-hook.js +31 -31
  25. package/dist/bin/pushary-permission-hook.js +30 -30
  26. package/dist/bin/pushary-post-hook.js +26 -26
  27. package/dist/bin/pushary-prompt-hook.js +26 -26
  28. package/dist/bin/pushary-session-end-hook.js +26 -26
  29. package/dist/bin/pushary-session-start-hook.js +30 -30
  30. package/dist/bin/pushary-setup.js +76 -51
  31. package/dist/bin/pushary-stats.js +5 -5
  32. package/dist/bin/pushary-status.js +34 -29
  33. package/dist/bin/pushary-stop-hook.js +26 -26
  34. package/dist/bin/pushary-stopfailure-hook.js +26 -26
  35. package/dist/bin/pushary-suggestions.js +13 -13
  36. package/dist/bin/pushary-transcript-register.js +19 -19
  37. package/dist/bin/pushary-transcripts.js +9 -9
  38. package/dist/bin/pushary-upgrade.js +31 -31
  39. package/dist/bin/pushary-wait.js +13 -13
  40. package/dist/bin/pushary.js +7 -7
  41. package/dist/{chunk-YONHM5BQ.js → chunk-247PAUW6.js} +1 -1
  42. package/dist/{chunk-QLG6UKIB.js → chunk-2V55RBUR.js} +5 -5
  43. package/dist/{chunk-5RMD75P2.js → chunk-4BKAZ4JN.js} +10 -6
  44. package/dist/{chunk-HYPSYXP4.js → chunk-4RJQPI36.js} +5 -5
  45. package/dist/{chunk-XQ4HTTBB.js → chunk-4WHNRAOK.js} +1 -1
  46. package/dist/{chunk-VCLDXVR3.js → chunk-5PW6GMQO.js} +3 -3
  47. package/dist/{chunk-2V2CCTGQ.js → chunk-6WBIQQHO.js} +1 -1
  48. package/dist/{chunk-XGHXQUDG.js → chunk-6WINXCXY.js} +1 -1
  49. package/dist/{chunk-KT36OCRW.js → chunk-7AFLHL2R.js} +6 -3
  50. package/dist/{chunk-FT7UNIS3.js → chunk-AQFEP65J.js} +2 -1
  51. package/dist/{chunk-7TSL3JCX.js → chunk-AXBFNQG6.js} +1 -1
  52. package/dist/{chunk-LHGB64O2.js → chunk-B6KZME5D.js} +1 -1
  53. package/dist/{chunk-E2RXTRM2.js → chunk-BDL6GJOQ.js} +4 -4
  54. package/dist/{chunk-DKFAJHLI.js → chunk-BERMVODT.js} +9 -8
  55. package/dist/{chunk-LXYNKZFP.js → chunk-BV5JPACQ.js} +2 -2
  56. package/dist/{chunk-FEKP3NJR.js → chunk-CEF4UQ3X.js} +21 -8
  57. package/dist/{chunk-MGW26CW7.js → chunk-ESHO7OC3.js} +1 -1
  58. package/dist/{chunk-4ABHSCFJ.js → chunk-FH4O3QGQ.js} +29 -26
  59. package/dist/{chunk-3FG2VCH3.js → chunk-FUXCWF4Y.js} +11 -8
  60. package/dist/{chunk-23QKUOEV.js → chunk-G4TV5GYU.js} +2 -2
  61. package/dist/{chunk-TBTCBAQC.js → chunk-GMJOSAAP.js} +11 -11
  62. package/dist/{chunk-2YAHQ763.js → chunk-I52ALHOM.js} +5 -5
  63. package/dist/{chunk-6TQLZP7F.js → chunk-IEYFFMTU.js} +3 -3
  64. package/dist/{chunk-T27NT7LJ.js → chunk-II6OFDB3.js} +4 -4
  65. package/dist/{chunk-TNZYTGAJ.js → chunk-IIQ77WUJ.js} +6 -6
  66. package/dist/{chunk-ATDOYZXC.js → chunk-IM7EGZVH.js} +1 -1
  67. package/dist/{chunk-CRW4P7JU.js → chunk-JHAPJRAN.js} +1 -1
  68. package/dist/{chunk-6GQDOO5P.js → chunk-L5NPRGVE.js} +10 -9
  69. package/dist/{chunk-A6U4RRFM.js → chunk-LUDGBOLV.js} +2 -2
  70. package/dist/{chunk-KRDQQL2X.js → chunk-NBGJ3EOE.js} +2 -2
  71. package/dist/{chunk-MID7BURF.js → chunk-NVXC6ZBR.js} +2 -2
  72. package/dist/{chunk-SB2GN6OP.js → chunk-OYIN77HO.js} +3 -2
  73. package/dist/{chunk-Z4YQ7ZMO.js → chunk-PCF7JUTP.js} +3 -3
  74. package/dist/{chunk-5LQRUBFB.js → chunk-PCVAK67W.js} +1 -1
  75. package/dist/{chunk-SEZUF33H.js → chunk-PYWZYM74.js} +5 -14
  76. package/dist/{chunk-AXG5QMRM.js → chunk-QHY3UDYC.js} +3 -3
  77. package/dist/{chunk-SIOYJRL4.js → chunk-RVP6COOQ.js} +2 -2
  78. package/dist/{chunk-QDRDDVLH.js → chunk-SVQOEVAT.js} +4 -4
  79. package/dist/{chunk-B4OS2OVD.js → chunk-TBCXMW2C.js} +3 -3
  80. package/dist/{chunk-XUUE6MYM.js → chunk-TJ4KMPYO.js} +10 -10
  81. package/dist/{chunk-5C2GFTWE.js → chunk-TQIPIFL7.js} +1 -1
  82. package/dist/{chunk-5PYLU6OS.js → chunk-TVBEHME2.js} +7 -6
  83. package/dist/{chunk-FRZS7XQF.js → chunk-U6GYFWT4.js} +8 -5
  84. package/dist/{chunk-736I6CBY.js → chunk-UKCRTTKF.js} +1 -1
  85. package/dist/{chunk-UAA4BEYM.js → chunk-UZ2YEGIT.js} +3 -3
  86. package/dist/{chunk-6HMCOGKJ.js → chunk-VBPASZU7.js} +13 -8
  87. package/dist/{chunk-YXYSPMD3.js → chunk-VD2AWSER.js} +2 -2
  88. package/dist/{chunk-MHYXM43K.js → chunk-VRXX2AY2.js} +2 -2
  89. package/dist/{chunk-6WEC3KZP.js → chunk-VTR4VRL2.js} +1 -1
  90. package/dist/{chunk-BIQF3C4H.js → chunk-XNO3CSVW.js} +1 -1
  91. package/dist/{chunk-DVLQ4TVD.js → chunk-Y2BOLNJV.js} +5 -5
  92. package/dist/{chunk-W4TZAKOD.js → chunk-Y6PZ3B5U.js} +2 -2
  93. package/dist/{chunk-NILVJ7HV.js → chunk-YCL2V5FD.js} +9 -9
  94. package/dist/{chunk-YAU4JCYI.js → chunk-YLLGKY7K.js} +3 -3
  95. package/dist/{chunk-OWUDBHXW.js → chunk-Z5EYCMJH.js} +2 -2
  96. package/dist/{chunk-SXVXANPI.js → chunk-ZNAGS7O7.js} +3 -3
  97. package/dist/{global-upgrade-XEMENBZA.js → global-upgrade-AHRKGQ7M.js} +7 -7
  98. package/dist/{paths-VW5CI5KS.js → paths-AGUCNYQ5.js} +2 -2
  99. package/dist/{reapply-7KPSIO4L.js → reapply-BUCDXIIM.js} +21 -21
  100. package/dist/src/index.js +20 -20
  101. package/dist/{upgrade-lock-VT6XMQMB.js → upgrade-lock-7Z5WBZVH.js} +4 -4
  102. package/package.json +1 -1
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runBrowserLogin
4
- } from "../chunk-BIQF3C4H.js";
4
+ } from "../chunk-XNO3CSVW.js";
5
5
  import {
6
6
  coworkOutput,
7
7
  coworkSelection
8
- } from "../chunk-Z4YQ7ZMO.js";
8
+ } from "../chunk-PCF7JUTP.js";
9
9
  import "../chunk-PUZZELE6.js";
10
10
  import {
11
11
  clearDeclinedAgent,
12
12
  declinedAgentForSetupChoice
13
- } from "../chunk-6TQLZP7F.js";
13
+ } from "../chunk-IEYFFMTU.js";
14
14
  import {
15
15
  CURSOR_GATE_SCRIPT,
16
16
  describeVersionManagerPin,
@@ -20,17 +20,17 @@ import {
20
20
  codexTrustOutcome,
21
21
  describeCodexTrustConfirmation,
22
22
  needsCodexTrustStep
23
- } from "../chunk-SIOYJRL4.js";
23
+ } from "../chunk-RVP6COOQ.js";
24
24
  import {
25
25
  writeStdoutFully
26
26
  } from "../chunk-EO23EUOK.js";
27
27
  import {
28
28
  ensureCodexTrustsPusharyHooks
29
- } from "../chunk-W4TZAKOD.js";
29
+ } from "../chunk-Y6PZ3B5U.js";
30
30
  import {
31
31
  readManagedControlEvidence,
32
32
  waitForMachineReadiness
33
- } from "../chunk-TNZYTGAJ.js";
33
+ } from "../chunk-IIQ77WUJ.js";
34
34
  import {
35
35
  describeSetupSideEffects,
36
36
  installAgentSkill,
@@ -44,7 +44,7 @@ import {
44
44
  soleGateFile,
45
45
  soleGateReceipt,
46
46
  soleGateReceiptFile
47
- } from "../chunk-FRZS7XQF.js";
47
+ } from "../chunk-U6GYFWT4.js";
48
48
  import {
49
49
  HERMES_PIP_PACKAGE,
50
50
  describeDetection,
@@ -57,7 +57,7 @@ import {
57
57
  runHermesConfigScript,
58
58
  shortenHome,
59
59
  vscodeSettingsTargets
60
- } from "../chunk-AXG5QMRM.js";
60
+ } from "../chunk-QHY3UDYC.js";
61
61
  import {
62
62
  AgentConfigError,
63
63
  FX_PUSHARY_TOOLS_RULE,
@@ -83,10 +83,10 @@ import {
83
83
  withFxPusharyServer,
84
84
  writeFxProfile,
85
85
  writeInstructionBlock
86
- } from "../chunk-5RMD75P2.js";
86
+ } from "../chunk-4BKAZ4JN.js";
87
87
  import {
88
88
  MCP_BRIDGE_BINARY
89
- } from "../chunk-YXYSPMD3.js";
89
+ } from "../chunk-VD2AWSER.js";
90
90
  import {
91
91
  checkCodexInstall,
92
92
  detectProviderLiveCapabilities,
@@ -94,14 +94,14 @@ import {
94
94
  hasSpawnProvider,
95
95
  nodeCodexInstallProbe,
96
96
  resolveControlPolicy
97
- } from "../chunk-OWUDBHXW.js";
97
+ } from "../chunk-Z5EYCMJH.js";
98
98
  import {
99
99
  detectClaudeVersion
100
100
  } from "../chunk-RIVNNBEK.js";
101
101
  import {
102
102
  describeAutoUpdateAnnouncement,
103
103
  takeAutoUpdateAnnouncement
104
- } from "../chunk-VCLDXVR3.js";
104
+ } from "../chunk-5PW6GMQO.js";
105
105
  import {
106
106
  DAEMON_COLD_START_TIMEOUT_MS,
107
107
  clearDaemonNeedsLogin,
@@ -115,10 +115,10 @@ import {
115
115
  replaceDaemonService,
116
116
  stopDaemonService,
117
117
  waitForDaemonRemoteProof
118
- } from "../chunk-6GQDOO5P.js";
118
+ } from "../chunk-L5NPRGVE.js";
119
119
  import {
120
120
  transcriptPreferenceForSetup
121
- } from "../chunk-2V2CCTGQ.js";
121
+ } from "../chunk-6WBIQQHO.js";
122
122
  import "../chunk-XHKBHWLX.js";
123
123
  import {
124
124
  BROWSER_CONNECT_COMMAND,
@@ -130,14 +130,15 @@ import {
130
130
  printConnectInstructions,
131
131
  roundTripEvidence,
132
132
  verifyRoundTrip
133
- } from "../chunk-5PYLU6OS.js";
133
+ } from "../chunk-TVBEHME2.js";
134
134
  import "../chunk-3EGEA4KH.js";
135
135
  import {
136
136
  setHumanStream
137
137
  } from "../chunk-QCGNGEGE.js";
138
138
  import {
139
+ mcpServerBearer,
139
140
  readMacAppAgentKey
140
- } from "../chunk-HYPSYXP4.js";
141
+ } from "../chunk-4RJQPI36.js";
141
142
  import {
142
143
  OPENCODE_HOOK_BINARY,
143
144
  addOpenCodeMcpServer,
@@ -153,7 +154,7 @@ import {
153
154
  openCodePluginDir,
154
155
  openCodePluginFile,
155
156
  openCodeWired
156
- } from "../chunk-DKFAJHLI.js";
157
+ } from "../chunk-BERMVODT.js";
157
158
  import {
158
159
  ansiPainter,
159
160
  createIo,
@@ -175,7 +176,7 @@ import {
175
176
  hasCompatibleHooks,
176
177
  isClaudeMcpSnapshot,
177
178
  updateClaudeMcpSnapshot
178
- } from "../chunk-E2RXTRM2.js";
179
+ } from "../chunk-BDL6GJOQ.js";
179
180
  import {
180
181
  KEEP_HINT,
181
182
  captureHookTakeover,
@@ -185,22 +186,21 @@ import {
185
186
  describeAppOwnership,
186
187
  describeHookOwnership,
187
188
  geminiWired,
188
- mcpBearerKey,
189
189
  planHooks,
190
190
  pusharyHookExecutable
191
- } from "../chunk-SEZUF33H.js";
191
+ } from "../chunk-PYWZYM74.js";
192
192
  import {
193
193
  GEMINI_HOOK_BINARY,
194
194
  addGeminiHooks,
195
195
  addGeminiMcpServer
196
- } from "../chunk-YAU4JCYI.js";
196
+ } from "../chunk-YLLGKY7K.js";
197
197
  import {
198
198
  AGENT_CHOICES,
199
199
  effectiveControlMode,
200
200
  effectiveVerify,
201
201
  parseSetupOptions
202
- } from "../chunk-YONHM5BQ.js";
203
- import "../chunk-7TSL3JCX.js";
202
+ } from "../chunk-247PAUW6.js";
203
+ import "../chunk-AXBFNQG6.js";
204
204
  import "../chunk-GMXKITVA.js";
205
205
  import {
206
206
  compareVersion,
@@ -218,28 +218,28 @@ import {
218
218
  recordMacAppKeyPrefix,
219
219
  resolveShellRc,
220
220
  writeKey
221
- } from "../chunk-4ABHSCFJ.js";
221
+ } from "../chunk-FH4O3QGQ.js";
222
222
  import {
223
223
  reportEvent
224
- } from "../chunk-NILVJ7HV.js";
225
- import "../chunk-CRW4P7JU.js";
226
- import "../chunk-DVLQ4TVD.js";
224
+ } from "../chunk-YCL2V5FD.js";
225
+ import "../chunk-JHAPJRAN.js";
226
+ import "../chunk-Y2BOLNJV.js";
227
227
  import "../chunk-POFBE6ZY.js";
228
- import "../chunk-SXVXANPI.js";
228
+ import "../chunk-ZNAGS7O7.js";
229
229
  import {
230
230
  checkApiKey,
231
231
  describeKeyCheck,
232
232
  samePusharyAccount
233
- } from "../chunk-UAA4BEYM.js";
234
- import "../chunk-B4OS2OVD.js";
235
- import "../chunk-KRDQQL2X.js";
233
+ } from "../chunk-UZ2YEGIT.js";
234
+ import "../chunk-TBCXMW2C.js";
235
+ import "../chunk-NBGJ3EOE.js";
236
236
  import {
237
237
  UsageError
238
238
  } from "../chunk-7QLSKOSU.js";
239
239
  import {
240
240
  EXIT
241
241
  } from "../chunk-KZERVKTD.js";
242
- import "../chunk-MID7BURF.js";
242
+ import "../chunk-NVXC6ZBR.js";
243
243
  import {
244
244
  NpmMissingError,
245
245
  addCodexHookTrust,
@@ -284,18 +284,18 @@ import {
284
284
  resolveGlobalBinary,
285
285
  vscodePluginDir,
286
286
  vscodePluginMcp
287
- } from "../chunk-FEKP3NJR.js";
287
+ } from "../chunk-CEF4UQ3X.js";
288
288
  import {
289
289
  backupFile,
290
290
  readJsonSafe,
291
291
  writeFileAtomic,
292
292
  writeJsonAtomic
293
- } from "../chunk-FT7UNIS3.js";
294
- import "../chunk-XQ4HTTBB.js";
293
+ } from "../chunk-AQFEP65J.js";
294
+ import "../chunk-4WHNRAOK.js";
295
295
  import {
296
296
  NPX_LATEST_COMMAND,
297
297
  renderCommandHelp
298
- } from "../chunk-LHGB64O2.js";
298
+ } from "../chunk-B6KZME5D.js";
299
299
  import {
300
300
  HOOK_COMPATIBLE_PROFILES,
301
301
  PRETOOLUSE_GATED_TOOLS,
@@ -306,10 +306,11 @@ import {
306
306
  hookCompatibleProfile,
307
307
  isComputerAgent,
308
308
  isNewerVersion,
309
+ isRecord,
309
310
  isValidApiKey,
310
311
  launchedPackage,
311
312
  ownPackageName
312
- } from "../chunk-6HMCOGKJ.js";
313
+ } from "../chunk-VBPASZU7.js";
313
314
 
314
315
  // bin/pushary-setup.ts
315
316
  import { existsSync, readFileSync, writeFileSync, mkdirSync, cpSync, rmSync, renameSync, realpathSync, statSync, openSync, readSync, closeSync } from "fs";
@@ -545,7 +546,8 @@ var PLAN_CONFIGS = {
545
546
  };
546
547
 
547
548
  // src/setup/key-account.ts
548
- var agentConfigKeySource = (macAppInstalled) => macAppInstalled ? "mac-app" : "agent-settings";
549
+ var isKeyHeldByMacApp = (key, holder) => holder.macAppInstalled && holder.macAppKey === key;
550
+ var agentConfigKeySource = (agentConfigKey, holder) => isKeyHeldByMacApp(agentConfigKey, holder) ? "mac-app" : "agent-settings";
549
551
  var pickReusableKey = (candidates) => {
550
552
  if (candidates.storedKey !== null && candidates.storedCheck !== null) {
551
553
  return { source: "stored", key: candidates.storedKey, check: candidates.storedCheck };
@@ -554,7 +556,7 @@ var pickReusableKey = (candidates) => {
554
556
  return { source: "environment", key: candidates.envKey, check: candidates.envCheck };
555
557
  }
556
558
  if (candidates.agentConfigKey !== null && candidates.agentConfigCheck !== null) {
557
- return { source: agentConfigKeySource(candidates.macAppInstalled), key: candidates.agentConfigKey, check: candidates.agentConfigCheck };
559
+ return { source: agentConfigKeySource(candidates.agentConfigKey, candidates), key: candidates.agentConfigKey, check: candidates.agentConfigCheck };
558
560
  }
559
561
  return null;
560
562
  };
@@ -572,6 +574,11 @@ var accountHandleOf = (identity) => identity.siteSlug ? `@${identity.siteSlug}`
572
574
  var keyAccountHandle = (check2) => check2.kind === "ok" ? accountHandleOf(check2.identity) : null;
573
575
  var continueAsQuestion = (account) => account ? `Continue as ${account}?` : "Continue with this key?";
574
576
  var WRONG_ACCOUNT_HINT = `Wrong account? Run ${NPX_LATEST_COMMAND} setup --connect app`;
577
+ var wrongAccountHintPlacement = (context) => {
578
+ if (!context.canPairWithApp) return "none";
579
+ if (context.planInactive && !context.dryRun) return "with-inactive-plan";
580
+ return context.reusedWithoutAsking ? "after-key-check" : "none";
581
+ };
575
582
  var planNameOf = (plan) => {
576
583
  const known = PLAN_TYPES.find((type) => type === plan);
577
584
  return known ? PLAN_CONFIGS[known].name : null;
@@ -756,12 +763,15 @@ var describeClosing = (facts) => {
756
763
  var RETRY_AGENT_LABEL = "Retry just this agent:";
757
764
  var INSTALL_NODE_STEP = "Install the current Node.js LTS, which includes npm, then run setup again.";
758
765
  var NPM_PREFIX_STEP = "npm can't install globally here. Use nvm, or run: npm config set prefix ~/.npm-global, then run setup again.";
766
+ var NPM_FILE_IN_USE_STEP = "Close other terminals or editors that use Node, then run setup again.";
759
767
  var nextStepFor = (failure) => {
760
768
  switch (failure.remedy) {
761
769
  case "install-node":
762
770
  return { kind: "install-node", instruction: INSTALL_NODE_STEP };
763
771
  case "fix-npm-prefix":
764
772
  return { kind: "fix-npm-prefix", instruction: NPM_PREFIX_STEP };
773
+ case "close-node-programs":
774
+ return { kind: "close-node-programs", instruction: NPM_FILE_IN_USE_STEP };
765
775
  case "match-mac-account":
766
776
  return { kind: "match-mac-account", instruction: matchMacAccountStep(failure.agent, null) };
767
777
  case "retry-agent":
@@ -775,6 +785,7 @@ var describeAgentFailures = (failures, agentName) => failures.map((failure) => (
775
785
  var agentFailureFollowUps = (failures) => [
776
786
  ...failures.some((failure) => failure.remedy === "install-node") ? ["install-node"] : [],
777
787
  ...failures.some((failure) => failure.remedy === "fix-npm-prefix") ? ["fix-npm-prefix"] : [],
788
+ ...failures.some((failure) => failure.remedy === "close-node-programs") ? ["close-node-programs"] : [],
778
789
  ...failures.some((failure) => failure.remedy === "retry-agent") ? ["run-doctor"] : []
779
790
  ];
780
791
  var unverifiedKeyClosingReason = (facts) => {
@@ -944,7 +955,6 @@ var pickAppKey = (candidates) => candidates.fromAgents.find(
944
955
  ) ?? null;
945
956
 
946
957
  // src/vscode-gate-hooks.ts
947
- var isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
948
958
  var runsTheGate = (entry) => typeof entry.command === "string" && (pusharyHookExecutable(entry.command)?.endsWith(CURSOR_GATE_SCRIPT) ?? false);
949
959
  var guardedEntry = (entry, command) => isRecord(entry) && runsTheGate(entry) ? { ...entry, command } : entry;
950
960
  var guardVsCodeGateHooks = (document, gateScript) => {
@@ -1045,14 +1055,19 @@ var readJson = (filePath) => {
1045
1055
  return {};
1046
1056
  }
1047
1057
  };
1058
+ var AGENT_JSON_REFUSAL = {
1059
+ unparseable: "is not valid JSON",
1060
+ unreadable: "could not be read",
1061
+ "not-an-object": "is not a JSON object"
1062
+ };
1048
1063
  var readAgentJson = (filePath) => {
1049
1064
  const result = readJsonSafe(filePath);
1050
- if (result.kind === "ok") return result.value;
1065
+ if (result.kind === "ok" && isRecord(result.value)) return result.value;
1051
1066
  if (result.kind === "missing") return {};
1052
1067
  const backup = backupFile(filePath);
1053
- const reason = result.kind === "unparseable" ? "is not valid JSON" : "could not be read";
1068
+ const reason = AGENT_JSON_REFUSAL[result.kind === "ok" ? "not-an-object" : result.kind];
1054
1069
  throw new AgentConfigError(
1055
- configFailureKind(result.kind),
1070
+ configFailureKind(result.kind === "unreadable" ? "unreadable" : "unparseable"),
1056
1071
  filePath,
1057
1072
  `${filePath} ${reason}, so it was left untouched. A copy is at ${backup}. Fix or remove the original, then re-run setup.`
1058
1073
  );
@@ -1521,7 +1536,7 @@ var installCursorUserHooks = (gateScript) => {
1521
1536
  let userHooks = {};
1522
1537
  if (existsSync(CURSOR_USER_HOOKS)) {
1523
1538
  const result = readJsonSafe(CURSOR_USER_HOOKS);
1524
- if (result.kind === "ok") userHooks = result.value;
1539
+ if (result.kind === "ok" && isRecord(result.value)) userHooks = result.value;
1525
1540
  else if (result.kind !== "missing") {
1526
1541
  let backup = "";
1527
1542
  try {
@@ -1529,13 +1544,13 @@ var installCursorUserHooks = (gateScript) => {
1529
1544
  } catch {
1530
1545
  }
1531
1546
  throw new AgentConfigError(
1532
- configFailureKind(result.kind),
1547
+ configFailureKind(result.kind === "unreadable" ? "unreadable" : "unparseable"),
1533
1548
  CURSOR_USER_HOOKS,
1534
1549
  `Could not parse or read Cursor hooks.json; left it untouched${backup ? ` and backed it up at ${backup}` : ""}. Fix the file, then re-run setup.`
1535
1550
  );
1536
1551
  }
1537
1552
  }
1538
- const hooks = userHooks.hooks ?? {};
1553
+ const hooks = isRecord(userHooks.hooks) ? userHooks.hooks : {};
1539
1554
  for (const event of Object.keys(bundled)) {
1540
1555
  const template = bundled[event]?.[0];
1541
1556
  if (!template) throw new Error(`bundled Cursor hooks.json missing a ${event} entry`);
@@ -1966,7 +1981,7 @@ var appMcpKeyFor = (agent) => {
1966
1981
  return auth?.method === "embedded" ? auth.key : null;
1967
1982
  }
1968
1983
  const entry = APP_MCP_ENTRIES[agent];
1969
- return entry ? mcpBearerKey(readAgentJson(entry.file()), entry.container, "headers") : null;
1984
+ return entry ? mcpServerBearer(readAgentJson(entry.file())[entry.container]) : null;
1970
1985
  };
1971
1986
  var appWiringAccountKeyFor = (agent) => MAC_APP_DEVICE_KEY_AGENTS.has(agent) ? readMacAppAgentKey() : appMcpKeyFor(agent);
1972
1987
  var appMcpKeyIfReadable = (agent) => {
@@ -2294,6 +2309,8 @@ var agentFailureFollowUpLine = (followUp) => {
2294
2309
  return INSTALL_NODE_STEP;
2295
2310
  case "fix-npm-prefix":
2296
2311
  return NPM_PREFIX_STEP;
2312
+ case "close-node-programs":
2313
+ return NPM_FILE_IN_USE_STEP;
2297
2314
  case "run-doctor":
2298
2315
  return `${dim("Run")} ${NPX_LATEST_COMMAND} doctor ${dim("for the reason, or send it to")} ${SUPPORT_EMAIL}`;
2299
2316
  }
@@ -2479,6 +2496,7 @@ var main = async () => {
2479
2496
  dryRun: options.dryRun,
2480
2497
  canPairWithApp
2481
2498
  });
2499
+ const macAppHolder = { macAppInstalled: appBridgeAvailable, macAppKey: readMacAppAgentKey() };
2482
2500
  const reusable = pickReusableKey({
2483
2501
  storedKey,
2484
2502
  storedCheck,
@@ -2486,7 +2504,7 @@ var main = async () => {
2486
2504
  envCheck,
2487
2505
  agentConfigKey: appKey,
2488
2506
  agentConfigCheck: appKeyCheck,
2489
- macAppInstalled: appBridgeAvailable
2507
+ ...macAppHolder
2490
2508
  });
2491
2509
  const reuseAccepted = reusable !== null && await acceptReusableKey(reusable, keyReuse);
2492
2510
  const reuseDeclined = reusable !== null && !reuseAccepted;
@@ -2590,7 +2608,13 @@ var main = async () => {
2590
2608
  if (!options.dryRun) recordSetupKey(trimmedKey);
2591
2609
  markStep("verify-key");
2592
2610
  const keyCheck = await verifyKeyOrExit(trimmedKey, options, storedKeyCheck ?? void 0);
2593
- if (reuseAccepted && keyReuse === "announce") console.log(` ${dim(WRONG_ACCOUNT_HINT)}`);
2611
+ const wrongAccountHint = wrongAccountHintPlacement({
2612
+ canPairWithApp,
2613
+ reusedWithoutAsking: reuseAccepted && keyReuse === "announce",
2614
+ planInactive: keyCheck.kind === "locked",
2615
+ dryRun: options.dryRun
2616
+ });
2617
+ if (wrongAccountHint === "after-key-check") console.log(` ${dim(WRONG_ACCOUNT_HINT)}`);
2594
2618
  if (options.dryRun) {
2595
2619
  markStep("resolve-agents");
2596
2620
  const plannedAgents = await resolveAgents(options);
@@ -2605,7 +2629,7 @@ var main = async () => {
2605
2629
  console.log(` ${TRANSCRIPT_SYNC_NOTICE}`);
2606
2630
  }
2607
2631
  const rc = await saveApiKey(trimmedKey, controlMode, transcriptSync);
2608
- if (trimmedKey === appKey) recordMacAppKeyPrefix(trimmedKey);
2632
+ if (isKeyHeldByMacApp(trimmedKey, macAppHolder)) recordMacAppKeyPrefix(trimmedKey);
2609
2633
  if (keyCheck.kind === "ok") clearDaemonNeedsLogin();
2610
2634
  markStep("resolve-agents");
2611
2635
  const agents = await resolveAgents(options);
@@ -2796,7 +2820,8 @@ var main = async () => {
2796
2820
  console.log();
2797
2821
  if (keyCheck.kind === "locked" || keyCheck.kind === "unreachable") {
2798
2822
  const report = describeKeyCheck(keyCheck);
2799
- const next = keyCheck.kind === "locked" ? [...report.next, describeLockedKeyAccount(trimmedKey, pairedHandle), WRONG_ACCOUNT_HINT] : [...report.next, "Finish activation: pushary setup (reuses the saved key)."];
2823
+ const inactivePlanHint = wrongAccountHint === "with-inactive-plan" ? [WRONG_ACCOUNT_HINT] : [];
2824
+ const next = keyCheck.kind === "locked" ? [...report.next, describeLockedKeyAccount(trimmedKey, pairedHandle), ...inactivePlanHint] : [...report.next, "Finish activation: pushary setup (reuses the saved key)."];
2800
2825
  const exitCode2 = failures.length > 0 || controlLifecycleFailure ? EXIT.PROBLEMS_FOUND : report.exitCode;
2801
2826
  printManualSteps();
2802
2827
  console.log(` ${yellow(bold(keyCheck.kind === "locked" ? "Agents configured, approvals inactive." : "Configuration saved, activation unverified."))}`);
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  readLedgerSummary
4
- } from "../chunk-736I6CBY.js";
4
+ } from "../chunk-UKCRTTKF.js";
5
5
  import {
6
6
  exitOnHelpFlag
7
- } from "../chunk-LXYNKZFP.js";
7
+ } from "../chunk-BV5JPACQ.js";
8
8
  import "../chunk-KZERVKTD.js";
9
9
  import {
10
10
  getApiKey
11
- } from "../chunk-XQ4HTTBB.js";
12
- import "../chunk-LHGB64O2.js";
13
- import "../chunk-6HMCOGKJ.js";
11
+ } from "../chunk-4WHNRAOK.js";
12
+ import "../chunk-B6KZME5D.js";
13
+ import "../chunk-VBPASZU7.js";
14
14
 
15
15
  // bin/pushary-stats.ts
16
16
  exitOnHelpFlag("stats");
@@ -2,77 +2,82 @@
2
2
  import {
3
3
  describeLastSeen,
4
4
  listMachines
5
- } from "../chunk-TNZYTGAJ.js";
6
- import "../chunk-OWUDBHXW.js";
5
+ } from "../chunk-IIQ77WUJ.js";
6
+ import "../chunk-Z5EYCMJH.js";
7
7
  import "../chunk-RIVNNBEK.js";
8
- import "../chunk-6GQDOO5P.js";
8
+ import "../chunk-L5NPRGVE.js";
9
9
  import "../chunk-XHKBHWLX.js";
10
10
  import {
11
11
  describeReach,
12
12
  fetchChannels,
13
13
  reachVerdict
14
- } from "../chunk-5PYLU6OS.js";
14
+ } from "../chunk-TVBEHME2.js";
15
15
  import "../chunk-3EGEA4KH.js";
16
16
  import "../chunk-QCGNGEGE.js";
17
17
  import {
18
18
  CONNECTED_THROUGH_MAC_APP,
19
19
  readMacAppConnectionWhenKeyless
20
- } from "../chunk-HYPSYXP4.js";
20
+ } from "../chunk-4RJQPI36.js";
21
21
  import {
22
22
  SIGNED_OUT_ON_MAC_MESSAGE,
23
23
  activeKeyVerdictOf,
24
24
  describeSignedOutKey,
25
25
  readSignedOutDiagnosis
26
- } from "../chunk-2YAHQ763.js";
27
- import "../chunk-DKFAJHLI.js";
26
+ } from "../chunk-I52ALHOM.js";
27
+ import "../chunk-BERMVODT.js";
28
28
  import {
29
29
  createIo
30
30
  } from "../chunk-FO3MDD26.js";
31
31
  import {
32
32
  exitOnHelpFlag
33
- } from "../chunk-LXYNKZFP.js";
34
- import "../chunk-E2RXTRM2.js";
35
- import "../chunk-SEZUF33H.js";
36
- import "../chunk-YAU4JCYI.js";
37
- import "../chunk-YONHM5BQ.js";
38
- import "../chunk-7TSL3JCX.js";
33
+ } from "../chunk-BV5JPACQ.js";
34
+ import "../chunk-BDL6GJOQ.js";
35
+ import "../chunk-PYWZYM74.js";
36
+ import "../chunk-YLLGKY7K.js";
37
+ import "../chunk-247PAUW6.js";
38
+ import "../chunk-AXBFNQG6.js";
39
39
  import {
40
40
  rejectUnknownFlags
41
41
  } from "../chunk-GMXKITVA.js";
42
42
  import "../chunk-6ICPEJY5.js";
43
43
  import {
44
44
  readKeySource
45
- } from "../chunk-4ABHSCFJ.js";
46
- import "../chunk-NILVJ7HV.js";
47
- import "../chunk-CRW4P7JU.js";
48
- import "../chunk-DVLQ4TVD.js";
45
+ } from "../chunk-FH4O3QGQ.js";
46
+ import "../chunk-YCL2V5FD.js";
47
+ import "../chunk-JHAPJRAN.js";
48
+ import "../chunk-Y2BOLNJV.js";
49
49
  import "../chunk-POFBE6ZY.js";
50
- import "../chunk-SXVXANPI.js";
50
+ import "../chunk-ZNAGS7O7.js";
51
51
  import {
52
52
  checkApiKey,
53
53
  describeKeyCheck
54
- } from "../chunk-UAA4BEYM.js";
55
- import "../chunk-B4OS2OVD.js";
56
- import "../chunk-KRDQQL2X.js";
54
+ } from "../chunk-UZ2YEGIT.js";
55
+ import "../chunk-TBCXMW2C.js";
56
+ import "../chunk-NBGJ3EOE.js";
57
57
  import {
58
58
  UsageError
59
59
  } from "../chunk-7QLSKOSU.js";
60
60
  import {
61
61
  EXIT
62
62
  } from "../chunk-KZERVKTD.js";
63
- import "../chunk-MID7BURF.js";
64
- import "../chunk-FEKP3NJR.js";
65
- import "../chunk-FT7UNIS3.js";
66
- import "../chunk-XQ4HTTBB.js";
67
- import "../chunk-LHGB64O2.js";
68
- import "../chunk-6HMCOGKJ.js";
63
+ import "../chunk-NVXC6ZBR.js";
64
+ import "../chunk-CEF4UQ3X.js";
65
+ import "../chunk-AQFEP65J.js";
66
+ import "../chunk-4WHNRAOK.js";
67
+ import "../chunk-B6KZME5D.js";
68
+ import "../chunk-VBPASZU7.js";
69
69
 
70
70
  // src/status.ts
71
+ var SIGNED_OUT_LINE = { label: "Server", value: "key signed out on this Mac", ok: false };
71
72
  var signedOutReport = (facts, lines) => {
72
73
  const signedOut = facts.signedOut;
73
74
  if (signedOut?.kind !== "signed_out_on_mac") return null;
74
- lines.push({ label: "Server", value: "key signed out on this Mac", ok: false });
75
- return { lines, headline: SIGNED_OUT_ON_MAC_MESSAGE, next: [...describeSignedOutKey(signedOut)], exitCode: EXIT.UNAUTHENTICATED };
75
+ return {
76
+ lines: [...lines, SIGNED_OUT_LINE],
77
+ headline: SIGNED_OUT_ON_MAC_MESSAGE,
78
+ next: [...describeSignedOutKey(signedOut)],
79
+ exitCode: EXIT.UNAUTHENTICATED
80
+ };
76
81
  };
77
82
  var connectedThroughMacAppReport = (macApp) => ({
78
83
  lines: [{ label: "Key", value: `${macApp.keyPrefix} held by the Pushary Mac app`, ok: true }],
@@ -1,45 +1,45 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  readHookInput
4
- } from "../chunk-T27NT7LJ.js";
5
- import "../chunk-XUUE6MYM.js";
6
- import "../chunk-6WEC3KZP.js";
7
- import "../chunk-6GQDOO5P.js";
8
- import "../chunk-XGHXQUDG.js";
9
- import "../chunk-ATDOYZXC.js";
10
- import "../chunk-2V2CCTGQ.js";
4
+ } from "../chunk-II6OFDB3.js";
5
+ import "../chunk-TJ4KMPYO.js";
6
+ import "../chunk-VTR4VRL2.js";
7
+ import "../chunk-L5NPRGVE.js";
8
+ import "../chunk-6WINXCXY.js";
9
+ import "../chunk-IM7EGZVH.js";
10
+ import "../chunk-6WBIQQHO.js";
11
11
  import "../chunk-XHKBHWLX.js";
12
12
  import {
13
13
  activeHookSource,
14
14
  activeIdentity
15
- } from "../chunk-E2RXTRM2.js";
16
- import "../chunk-SEZUF33H.js";
17
- import "../chunk-YAU4JCYI.js";
18
- import "../chunk-YONHM5BQ.js";
19
- import "../chunk-7TSL3JCX.js";
15
+ } from "../chunk-BDL6GJOQ.js";
16
+ import "../chunk-PYWZYM74.js";
17
+ import "../chunk-YLLGKY7K.js";
18
+ import "../chunk-247PAUW6.js";
19
+ import "../chunk-AXBFNQG6.js";
20
20
  import "../chunk-GMXKITVA.js";
21
21
  import "../chunk-6ICPEJY5.js";
22
- import "../chunk-4ABHSCFJ.js";
22
+ import "../chunk-FH4O3QGQ.js";
23
23
  import {
24
24
  handleStop,
25
25
  handleSubagentStop,
26
26
  isSubagentStop
27
- } from "../chunk-NILVJ7HV.js";
28
- import "../chunk-CRW4P7JU.js";
29
- import "../chunk-DVLQ4TVD.js";
27
+ } from "../chunk-YCL2V5FD.js";
28
+ import "../chunk-JHAPJRAN.js";
29
+ import "../chunk-Y2BOLNJV.js";
30
30
  import "../chunk-POFBE6ZY.js";
31
- import "../chunk-SXVXANPI.js";
32
- import "../chunk-UAA4BEYM.js";
33
- import "../chunk-B4OS2OVD.js";
34
- import "../chunk-KRDQQL2X.js";
31
+ import "../chunk-ZNAGS7O7.js";
32
+ import "../chunk-UZ2YEGIT.js";
33
+ import "../chunk-TBCXMW2C.js";
34
+ import "../chunk-NBGJ3EOE.js";
35
35
  import "../chunk-7QLSKOSU.js";
36
36
  import "../chunk-KZERVKTD.js";
37
- import "../chunk-MID7BURF.js";
38
- import "../chunk-FEKP3NJR.js";
39
- import "../chunk-FT7UNIS3.js";
40
- import "../chunk-XQ4HTTBB.js";
41
- import "../chunk-LHGB64O2.js";
42
- import "../chunk-6HMCOGKJ.js";
37
+ import "../chunk-NVXC6ZBR.js";
38
+ import "../chunk-CEF4UQ3X.js";
39
+ import "../chunk-AQFEP65J.js";
40
+ import "../chunk-4WHNRAOK.js";
41
+ import "../chunk-B6KZME5D.js";
42
+ import "../chunk-VBPASZU7.js";
43
43
 
44
44
  // bin/pushary-stop-hook.ts
45
45
  var AGENT = activeIdentity(process.argv);