pushary 1.9.234 → 1.9.236

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 (149) hide show
  1. package/CHANGELOG.md +20 -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/redaction.mjs +2 -0
  5. package/data/openclaw-plugin/dist/redaction.js +2 -0
  6. package/data/vscode-plugin/.claude-plugin/plugin.json +1 -1
  7. package/data/vscode-plugin/CHANGELOG.md +4 -0
  8. package/data/vscode-plugin/scripts/redaction.mjs +2 -0
  9. package/dist/{api-M67GCEPF.js → api-ZRAS6XVR.js} +11 -11
  10. package/dist/bin/pushary-audit.js +3 -3
  11. package/dist/bin/pushary-bell-hook.js +28 -28
  12. package/dist/bin/pushary-bell.js +12 -12
  13. package/dist/bin/pushary-calls.js +15 -15
  14. package/dist/bin/pushary-claude.js +26 -26
  15. package/dist/bin/pushary-clean.js +39 -39
  16. package/dist/bin/pushary-codex-bridge.js +23 -23
  17. package/dist/bin/pushary-codex-hook.js +34 -34
  18. package/dist/bin/pushary-codex-session.js +8 -8
  19. package/dist/bin/pushary-codex.js +16 -16
  20. package/dist/bin/pushary-connect.js +35 -35
  21. package/dist/bin/pushary-cowork.js +5 -5
  22. package/dist/bin/pushary-daemon.js +46 -46
  23. package/dist/bin/pushary-disconnect.js +30 -30
  24. package/dist/bin/pushary-display-hook.js +9 -0
  25. package/dist/bin/pushary-doctor.js +47 -47
  26. package/dist/bin/pushary-elicitation-hook.js +27 -27
  27. package/dist/bin/pushary-gemini-bridge.js +18 -18
  28. package/dist/bin/pushary-gemini-hook.js +31 -31
  29. package/dist/bin/pushary-hook.js +35 -35
  30. package/dist/bin/pushary-login.js +23 -23
  31. package/dist/bin/pushary-logout.js +31 -31
  32. package/dist/bin/pushary-mcp.js +12 -12
  33. package/dist/bin/pushary-mode.js +16 -16
  34. package/dist/bin/pushary-notification-hook.js +27 -27
  35. package/dist/bin/pushary-opencode-bridge.js +22 -22
  36. package/dist/bin/pushary-opencode-hook.js +32 -32
  37. package/dist/bin/pushary-permission-denied-hook.js +34 -34
  38. package/dist/bin/pushary-permission-hook.js +35 -35
  39. package/dist/bin/pushary-post-hook.js +28 -28
  40. package/dist/bin/pushary-prompt-hook.js +27 -27
  41. package/dist/bin/pushary-session-end-hook.js +27 -27
  42. package/dist/bin/pushary-session-start-hook.js +39 -39
  43. package/dist/bin/pushary-sessions.js +12 -12
  44. package/dist/bin/pushary-setup.js +634 -118
  45. package/dist/bin/pushary-stats.js +5 -5
  46. package/dist/bin/pushary-status.js +36 -36
  47. package/dist/bin/pushary-stop-hook.js +27 -27
  48. package/dist/bin/pushary-stopfailure-hook.js +27 -27
  49. package/dist/bin/pushary-suggestions.js +16 -16
  50. package/dist/bin/pushary-transcript-register.js +17 -17
  51. package/dist/bin/pushary-transcripts.js +26 -26
  52. package/dist/bin/pushary-upgrade.js +47 -47
  53. package/dist/bin/pushary-wait.js +16 -16
  54. package/dist/bin/pushary.js +7 -7
  55. package/dist/{chunk-VNEKDZRS.js → chunk-2H63TCPL.js} +8 -8
  56. package/dist/{chunk-T6KURDWS.js → chunk-2MB3FZAJ.js} +2 -2
  57. package/dist/{chunk-WMELBTKZ.js → chunk-35IY2SPK.js} +3 -3
  58. package/dist/{chunk-ADMVVNW2.js → chunk-37RAJAPB.js} +1 -1
  59. package/dist/{chunk-XW7UUCSM.js → chunk-3SEH5JU3.js} +6 -6
  60. package/dist/{chunk-U6HLDWKF.js → chunk-3W7UZY2B.js} +4 -4
  61. package/dist/{chunk-RGJ6YCGT.js → chunk-4CUOYT5O.js} +3 -3
  62. package/dist/{chunk-NDPIHRLT.js → chunk-4OHGEWKF.js} +5 -5
  63. package/dist/{chunk-2JM3H72Y.js → chunk-4OLECRWP.js} +1 -1
  64. package/dist/{chunk-TZDZ3QGG.js → chunk-5JRALQKT.js} +3 -3
  65. package/dist/{chunk-AS326WXH.js → chunk-5PWGMOHP.js} +115 -49
  66. package/dist/{chunk-4JJDUPF5.js → chunk-6LF7EQIZ.js} +7 -7
  67. package/dist/{chunk-ZGQCZKNY.js → chunk-74MBT2PL.js} +2 -2
  68. package/dist/{chunk-6XKHPCFW.js → chunk-7HKBGKLY.js} +2 -2
  69. package/dist/{chunk-KKVTBTX5.js → chunk-7TGJ6FPW.js} +5 -5
  70. package/dist/{chunk-YUBMSPWE.js → chunk-ABQRDSE5.js} +12 -34
  71. package/dist/{chunk-5ZTBYRTQ.js → chunk-B6GCLODI.js} +1 -1
  72. package/dist/{chunk-GRWWQNKA.js → chunk-BX3VDXXW.js} +3 -3
  73. package/dist/{chunk-DXB3WZQH.js → chunk-CFIZWE37.js} +1 -1
  74. package/dist/{chunk-7O766ACL.js → chunk-CG2YLNCB.js} +1 -1
  75. package/dist/{chunk-KAHKKD4R.js → chunk-D6O4XDS5.js} +2 -2
  76. package/dist/{chunk-BBPSHOSK.js → chunk-DEZKBMHO.js} +4 -4
  77. package/dist/{chunk-6RMGY4KP.js → chunk-DKFM2NSF.js} +4 -4
  78. package/dist/{chunk-EKCCDM3D.js → chunk-EZ4QXQNX.js} +5 -5
  79. package/dist/{chunk-746XV434.js → chunk-FIIRS53K.js} +3 -3
  80. package/dist/{chunk-OVM54QWV.js → chunk-GNCOGELX.js} +4 -3
  81. package/dist/{chunk-E7QTBSY2.js → chunk-GQGV7H6W.js} +2 -2
  82. package/dist/{chunk-2X7O2QE3.js → chunk-GS2SPPBB.js} +3 -3
  83. package/dist/{chunk-OI5PIRYC.js → chunk-HAZ72WZD.js} +16 -16
  84. package/dist/{chunk-EA6DCQMW.js → chunk-HB4BB66C.js} +6 -6
  85. package/dist/{chunk-MNVPOPER.js → chunk-HR7UASHX.js} +2 -2
  86. package/dist/{chunk-WOH6BCX7.js → chunk-HTDRJMP5.js} +4 -4
  87. package/dist/{chunk-J3LMHXHV.js → chunk-HY27YNME.js} +1 -1
  88. package/dist/{chunk-N5FLIE3B.js → chunk-J2JGO6SS.js} +1 -1
  89. package/dist/{chunk-Q3LFQVDS.js → chunk-J65WHWPK.js} +1 -1
  90. package/dist/{chunk-E4XS75YY.js → chunk-JZ272QIY.js} +1 -1
  91. package/dist/{chunk-256X3DP6.js → chunk-KVGQYML5.js} +2 -2
  92. package/dist/{chunk-BWGJWF7M.js → chunk-LZYSSSF3.js} +10 -10
  93. package/dist/{chunk-FQNL4HE7.js → chunk-M45REXUU.js} +4 -4
  94. package/dist/{chunk-A4QB2DOJ.js → chunk-NEQMXQZQ.js} +2 -2
  95. package/dist/{chunk-6MKKNXW6.js → chunk-NH4HBX7J.js} +1 -1
  96. package/dist/{chunk-NHKJDBKZ.js → chunk-NSUIUOE7.js} +1 -1
  97. package/dist/{chunk-AJCFOXEE.js → chunk-NVJQHRM3.js} +9 -9
  98. package/dist/{chunk-DECR2ASU.js → chunk-O3UOI6ML.js} +5 -5
  99. package/dist/{chunk-3ABPJTSC.js → chunk-OGFKB66L.js} +1 -1
  100. package/dist/{chunk-R3VB6IWK.js → chunk-OHMC3ZFE.js} +4 -4
  101. package/dist/{chunk-VWELQENE.js → chunk-OSRHNYI6.js} +1 -1
  102. package/dist/{chunk-FHMZFJJI.js → chunk-P3JLLHOO.js} +3 -3
  103. package/dist/{chunk-3JIMXIO5.js → chunk-P4ZXHSJX.js} +1 -1
  104. package/dist/{chunk-PIEQTKMS.js → chunk-PDIDI2JS.js} +6 -6
  105. package/dist/{chunk-WC4WLJ6L.js → chunk-QFP4D7BE.js} +1 -1
  106. package/dist/{chunk-PIEQVLWA.js → chunk-QKX4J66I.js} +6 -6
  107. package/dist/{chunk-V7DKNNN3.js → chunk-QNM5EW76.js} +5 -5
  108. package/dist/{chunk-A3V2JCN3.js → chunk-RHML34U3.js} +5 -5
  109. package/dist/{chunk-HXYZSB4U.js → chunk-RXFLVAIV.js} +3 -2
  110. package/dist/{chunk-BEEJ3QJP.js → chunk-SPGDOHHJ.js} +2 -2
  111. package/dist/{chunk-3FW2QYX2.js → chunk-SU3M242B.js} +11 -11
  112. package/dist/{chunk-HEOH4JH3.js → chunk-T5OA2WR7.js} +5 -5
  113. package/dist/{chunk-LT2X6GMR.js → chunk-TBHZAZPR.js} +3 -3
  114. package/dist/{chunk-DXLNLE7C.js → chunk-TJJEYS3S.js} +4 -4
  115. package/dist/{chunk-Z6VYPLVI.js → chunk-TKTZBQIL.js} +5 -5
  116. package/dist/{chunk-QU6OSEUV.js → chunk-U33VHYHK.js} +26 -0
  117. package/dist/{chunk-MCJGCJUQ.js → chunk-UBPTE3MH.js} +1 -1
  118. package/dist/{chunk-ZHPK2JGH.js → chunk-UKHFRW5M.js} +2 -2
  119. package/dist/{chunk-JMHS55ZS.js → chunk-UODLZ2D6.js} +3 -3
  120. package/dist/{chunk-JD67C7KL.js → chunk-UY6AOWQU.js} +162 -21
  121. package/dist/{chunk-2BSSRM5U.js → chunk-VQXWLHLD.js} +1 -1
  122. package/dist/{chunk-7KIEBY2I.js → chunk-VRV7MD3W.js} +1 -1
  123. package/dist/{chunk-VTCM3LRD.js → chunk-VSNFCUGH.js} +3 -3
  124. package/dist/{chunk-IPVZPZBT.js → chunk-W4F6RVN5.js} +5 -5
  125. package/dist/{chunk-BM4WXLS6.js → chunk-WFUWUWCT.js} +2 -2
  126. package/dist/{chunk-KNM3GFV5.js → chunk-X3SEEC4X.js} +7 -7
  127. package/dist/{chunk-ZATM23SV.js → chunk-XEXFRZS7.js} +1 -1
  128. package/dist/{chunk-IAUCVHGV.js → chunk-XX3Z4KQL.js} +1 -1
  129. package/dist/{chunk-J6CSPMZF.js → chunk-XYOB4W72.js} +4 -4
  130. package/dist/{chunk-E43Q5IZQ.js → chunk-Y4GEE5VA.js} +12 -12
  131. package/dist/{chunk-G6Y63AZ2.js → chunk-YKTCIWKY.js} +2 -2
  132. package/dist/{chunk-WXSWR2FG.js → chunk-Z3XPHDVP.js} +4 -4
  133. package/dist/{chunk-JCRH5R45.js → chunk-ZAKG5GGJ.js} +12 -4
  134. package/dist/{chunk-JO7YECNL.js → chunk-ZQ5NCJVO.js} +1 -1
  135. package/dist/{chunk-IX2DIIR5.js → chunk-ZT4PSGTB.js} +2 -2
  136. package/dist/{codex-app-cards-switch-FCF22YK6.js → codex-app-cards-switch-CEWQAZD2.js} +11 -11
  137. package/dist/{codex-card-routing-33FTWY2U.js → codex-card-routing-VRLWXQ4Z.js} +2 -2
  138. package/dist/{codex-desktop-launch-CMMBCQDF.js → codex-desktop-launch-EU5BXQFP.js} +3 -3
  139. package/dist/{codex-session-launch-VW4737L5.js → codex-session-launch-7PSWFAOC.js} +20 -20
  140. package/dist/{config-GPO476YL.js → config-UQOFNS26.js} +3 -3
  141. package/dist/{global-upgrade-6DOQCXZJ.js → global-upgrade-WO2MIUOJ.js} +9 -9
  142. package/dist/{identity-4OD6GQPB.js → identity-7UK4G6K7.js} +4 -4
  143. package/dist/{live-capabilities-X6O5HJCK.js → live-capabilities-HRJBL4FO.js} +4 -4
  144. package/dist/{paths-LYVFVRQM.js → paths-2FPNRZAX.js} +3 -3
  145. package/dist/{reapply-GKXG74LO.js → reapply-GH4LWS25.js} +34 -34
  146. package/dist/src/index.js +33 -33
  147. package/dist/{upgrade-lock-LZIWY4Q6.js → upgrade-lock-CA25EHHB.js} +4 -4
  148. package/dist/{usage-RN5ED6TT.js → usage-23UD3UL7.js} +3 -3
  149. package/package.json +1 -1
@@ -1,11 +1,20 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  withUpgradeLock
4
- } from "../chunk-PIEQTKMS.js";
5
- import "../chunk-BM4WXLS6.js";
4
+ } from "../chunk-PDIDI2JS.js";
5
+ import "../chunk-WFUWUWCT.js";
6
6
  import {
7
- runBrowserLogin
8
- } from "../chunk-JD67C7KL.js";
7
+ browserEntryUrl,
8
+ cancelLogin,
9
+ listenForThisTerminal,
10
+ localConfirmStateHash,
11
+ newLocalConfirmState,
12
+ pollOnce,
13
+ printLoginNotice,
14
+ runBrowserLogin,
15
+ startLogin,
16
+ waitForLogin
17
+ } from "../chunk-UY6AOWQU.js";
9
18
  import {
10
19
  INSTALL_NODE_STEP,
11
20
  NPM_FILE_IN_USE_STEP,
@@ -19,7 +28,7 @@ import {
19
28
  renderCommandSurface,
20
29
  teamOfferLines,
21
30
  unverifiedKeyClosingReason
22
- } from "../chunk-YUBMSPWE.js";
31
+ } from "../chunk-ABQRDSE5.js";
23
32
  import {
24
33
  WRONG_ACCOUNT_HINT,
25
34
  canAskAtTheTerminal,
@@ -42,29 +51,32 @@ import {
42
51
  someoneIsAtTheTerminal,
43
52
  switchBackToTheShellKeyLine,
44
53
  wrongAccountHintPlacement
45
- } from "../chunk-FQNL4HE7.js";
54
+ } from "../chunk-M45REXUU.js";
46
55
  import {
47
56
  instructionsChannelFor,
48
57
  pairingComputerOf,
49
58
  planPhoneCheck
50
- } from "../chunk-6MKKNXW6.js";
59
+ } from "../chunk-NH4HBX7J.js";
51
60
  import {
52
61
  coworkOutput,
53
62
  coworkSelection
54
- } from "../chunk-TZDZ3QGG.js";
55
- import "../chunk-PUZZELE6.js";
63
+ } from "../chunk-5JRALQKT.js";
64
+ import {
65
+ canOpenBrowser,
66
+ openInBrowser
67
+ } from "../chunk-PUZZELE6.js";
56
68
  import {
57
69
  readCodexHooksOnDisk
58
- } from "../chunk-AJCFOXEE.js";
70
+ } from "../chunk-NVJQHRM3.js";
59
71
  import {
60
72
  macAppHistoryDecision,
61
73
  nativeBridgeAccount
62
74
  } from "../chunk-TWWOQKXK.js";
63
- import "../chunk-MNVPOPER.js";
75
+ import "../chunk-HR7UASHX.js";
64
76
  import {
65
77
  clearDeclinedAgent,
66
78
  declinedAgentForSetupChoice
67
- } from "../chunk-G6Y63AZ2.js";
79
+ } from "../chunk-YKTCIWKY.js";
68
80
  import {
69
81
  OPENCLAW_RESTART_NOTE,
70
82
  describeOpenClawInstallFailure,
@@ -72,7 +84,7 @@ import {
72
84
  gateHermesShell,
73
85
  readHermesShellGate,
74
86
  saveSetupFailure
75
- } from "../chunk-Z6VYPLVI.js";
87
+ } from "../chunk-TKTZBQIL.js";
76
88
  import {
77
89
  CODEX_NEEDS_A_NEWER_VERSION,
78
90
  CODEX_SETTINGS_STOP_A_HOOK,
@@ -88,27 +100,46 @@ import {
88
100
  describeHermesState,
89
101
  hermesGateShellCommand,
90
102
  needsCodexTrustStep
91
- } from "../chunk-U6HLDWKF.js";
103
+ } from "../chunk-3W7UZY2B.js";
92
104
  import {
93
105
  describeWaitLadder
94
106
  } from "../chunk-CVWG2N3Y.js";
95
107
  import {
96
108
  writeJsonError,
97
109
  writeStdoutFully
98
- } from "../chunk-ZATM23SV.js";
110
+ } from "../chunk-XEXFRZS7.js";
99
111
  import {
112
+ EXIT_ABORTED,
113
+ EXIT_TERMINATED,
114
+ PAIR_TIMEOUT_MS,
115
+ PHONE_WAIT_SKIP_KEY,
116
+ SYSTEM_PAIR_CLOCK,
117
+ buildPairLinks,
100
118
  canShowPairingQr,
119
+ cancelPairing,
101
120
  confirmAppConnection,
102
121
  connectDevice,
103
122
  connectViaAppPairing,
104
123
  describeCancelledPairing,
124
+ describeCancelledSignIn,
125
+ describePairFailure,
105
126
  describePairingEscape,
127
+ describeSignInEscape,
128
+ heldUntilTheSignalExits,
129
+ keyLeftInPairing,
106
130
  pairingEscapeApplies,
107
131
  phoneAwaitsNotificationPermission,
132
+ phoneWaitWasSkipped,
133
+ pollAppPairing,
108
134
  printConnectInstructions,
135
+ printQr,
136
+ startPairing,
109
137
  waitForYourPhone
110
- } from "../chunk-AS326WXH.js";
111
- import "../chunk-3EGEA4KH.js";
138
+ } from "../chunk-5PWGMOHP.js";
139
+ import {
140
+ generateKeypair,
141
+ publicKeyFingerprint
142
+ } from "../chunk-3EGEA4KH.js";
112
143
  import {
113
144
  SETUP_AGENT_NAME,
114
145
  describeAnswerTestPrompt,
@@ -116,7 +147,7 @@ import {
116
147
  roundTripEvidence,
117
148
  roundTripWasAnswered,
118
149
  verifyRoundTrip
119
- } from "../chunk-XW7UUCSM.js";
150
+ } from "../chunk-3SEH5JU3.js";
120
151
  import {
121
152
  keepLinuxDaemonAfterLogout,
122
153
  lingerReportOf
@@ -124,13 +155,13 @@ import {
124
155
  import {
125
156
  readManagedControlEvidence,
126
157
  waitForMachineReadiness
127
- } from "../chunk-V7DKNNN3.js";
158
+ } from "../chunk-QNM5EW76.js";
128
159
  import {
129
160
  ensureCodexTrustsPusharyHooks,
130
161
  hermesHistoryHelperRecordPath,
131
162
  hermesHistoryNeedsTheCliHelper,
132
163
  recordInstalledHermesHistoryHelper
133
- } from "../chunk-WMELBTKZ.js";
164
+ } from "../chunk-35IY2SPK.js";
134
165
  import {
135
166
  scheduleWithTimer
136
167
  } from "../chunk-AVFPHV4N.js";
@@ -141,7 +172,7 @@ import {
141
172
  } from "../chunk-UOPOVQ2P.js";
142
173
  import {
143
174
  codexEngineBehindLauncher
144
- } from "../chunk-WXSWR2FG.js";
175
+ } from "../chunk-Z3XPHDVP.js";
145
176
  import "../chunk-XCEN33UP.js";
146
177
  import {
147
178
  CODEX_ENGINE_DIRECTORY,
@@ -155,9 +186,10 @@ import {
155
186
  claimSoleGate,
156
187
  registerCursorGate,
157
188
  soleGateFile,
189
+ soleGateLeftAloneFor,
158
190
  soleGateReceipt,
159
191
  soleGateReceiptFile
160
- } from "../chunk-JCRH5R45.js";
192
+ } from "../chunk-ZAKG5GGJ.js";
161
193
  import {
162
194
  describeDetection,
163
195
  detectAllAgents,
@@ -167,12 +199,14 @@ import {
167
199
  registerPluginLocation,
168
200
  shortenHome,
169
201
  vscodeSettingsTargets
170
- } from "../chunk-DECR2ASU.js";
171
- import "../chunk-OYIN77HO.js";
202
+ } from "../chunk-O3UOI6ML.js";
203
+ import {
204
+ revokeOwnKey
205
+ } from "../chunk-OYIN77HO.js";
172
206
  import {
173
207
  mcpServerBearer,
174
208
  readMacAppAgentKey
175
- } from "../chunk-BBPSHOSK.js";
209
+ } from "../chunk-DEZKBMHO.js";
176
210
  import {
177
211
  HERMES_CONFIG_FILE,
178
212
  HERMES_GATE_TOOLS_KEY,
@@ -191,7 +225,7 @@ import {
191
225
  routesHermesQuestions,
192
226
  runsAnOlderPlugin,
193
227
  shippedHermesPlugin
194
- } from "../chunk-WOH6BCX7.js";
228
+ } from "../chunk-HTDRJMP5.js";
195
229
  import {
196
230
  setHumanStream
197
231
  } from "../chunk-QCGNGEGE.js";
@@ -199,7 +233,7 @@ import {
199
233
  findOpenClawLauncher,
200
234
  isOpenClawWired,
201
235
  openClawPathsNow
202
- } from "../chunk-RGJ6YCGT.js";
236
+ } from "../chunk-4CUOYT5O.js";
203
237
  import {
204
238
  FX_PICKS_UP_CONFIGURATION,
205
239
  FX_PUSHARY_TOOLS_RULE,
@@ -216,7 +250,7 @@ import {
216
250
  readFxProfileForSetup,
217
251
  withFxPusharyServer,
218
252
  writeFxProfile
219
- } from "../chunk-NDPIHRLT.js";
253
+ } from "../chunk-4OHGEWKF.js";
220
254
  import {
221
255
  AgentConfigError,
222
256
  afterAgentFailureNote,
@@ -229,10 +263,10 @@ import {
229
263
  retryAgentCommand,
230
264
  writeSetupConfigFile,
231
265
  writeSetupConfigJson
232
- } from "../chunk-GRWWQNKA.js";
266
+ } from "../chunk-BX3VDXXW.js";
233
267
  import {
234
268
  MCP_BRIDGE_BINARY
235
- } from "../chunk-6RMGY4KP.js";
269
+ } from "../chunk-DKFM2NSF.js";
236
270
  import {
237
271
  OPENCODE_HOOK_BINARY,
238
272
  addOpenCodeMcpServer,
@@ -251,12 +285,12 @@ import {
251
285
  openCodePluginFile,
252
286
  openCodeWired,
253
287
  withOpenCodeAskRules
254
- } from "../chunk-KNM3GFV5.js";
255
- import "../chunk-7O766ACL.js";
256
- import "../chunk-N5FLIE3B.js";
288
+ } from "../chunk-X3SEEC4X.js";
289
+ import "../chunk-CG2YLNCB.js";
290
+ import "../chunk-J2JGO6SS.js";
257
291
  import {
258
292
  keyScopeOf
259
- } from "../chunk-E7QTBSY2.js";
293
+ } from "../chunk-GQGV7H6W.js";
260
294
  import {
261
295
  ansiPainter,
262
296
  ciMarker,
@@ -265,7 +299,7 @@ import {
265
299
  describeError,
266
300
  isCI,
267
301
  useColor
268
- } from "../chunk-VWELQENE.js";
302
+ } from "../chunk-OSRHNYI6.js";
269
303
  import {
270
304
  checkCodexInstall,
271
305
  describeMissingControlPrerequisite,
@@ -278,16 +312,16 @@ import {
278
312
  nodeCodexInstallProbe,
279
313
  phoneStartIsRequired,
280
314
  resolveControlPolicy
281
- } from "../chunk-FHMZFJJI.js";
315
+ } from "../chunk-P3JLLHOO.js";
282
316
  import {
283
317
  detectClaudeVersion
284
- } from "../chunk-WC4WLJ6L.js";
318
+ } from "../chunk-QFP4D7BE.js";
285
319
  import "../chunk-TCE3J44Z.js";
286
320
  import {
287
321
  describeAutoUpdateAnnouncement,
288
322
  takeAutoUpdateAnnouncement
289
- } from "../chunk-KAHKKD4R.js";
290
- import "../chunk-JMHS55ZS.js";
323
+ } from "../chunk-D6O4XDS5.js";
324
+ import "../chunk-UODLZ2D6.js";
291
325
  import "../chunk-WHB622LP.js";
292
326
  import {
293
327
  addCompatibleHooks,
@@ -302,7 +336,7 @@ import {
302
336
  compatibleRecord,
303
337
  compatibleTargetPaths,
304
338
  hasCompatibleHooks
305
- } from "../chunk-HEOH4JH3.js";
339
+ } from "../chunk-T5OA2WR7.js";
306
340
  import {
307
341
  DAEMON_COLD_START_TIMEOUT_MS,
308
342
  clearDaemonNeedsLogin,
@@ -321,7 +355,7 @@ import {
321
355
  stopDaemonService,
322
356
  versionManagerOf,
323
357
  waitForDaemonRemoteProof
324
- } from "../chunk-PIEQVLWA.js";
358
+ } from "../chunk-QKX4J66I.js";
325
359
  import {
326
360
  GEMINI_HOOK_BINARY,
327
361
  GEMINI_HOOK_EVENTS,
@@ -337,38 +371,38 @@ import {
337
371
  geminiWired,
338
372
  planHooks,
339
373
  pusharyHookExecutable
340
- } from "../chunk-DXLNLE7C.js";
374
+ } from "../chunk-TJJEYS3S.js";
341
375
  import {
342
376
  reportEvent
343
- } from "../chunk-3FW2QYX2.js";
344
- import "../chunk-NHKJDBKZ.js";
377
+ } from "../chunk-SU3M242B.js";
378
+ import "../chunk-NSUIUOE7.js";
345
379
  import {
346
380
  AGENT_CHOICES,
347
381
  effectiveAgentSelection,
348
382
  effectiveControlMode,
349
383
  effectiveVerify,
350
384
  parseSetupOptions
351
- } from "../chunk-OVM54QWV.js";
352
- import "../chunk-3JIMXIO5.js";
385
+ } from "../chunk-GNCOGELX.js";
386
+ import "../chunk-P4ZXHSJX.js";
353
387
  import "../chunk-BZIBNSQE.js";
354
388
  import {
355
389
  transcriptPreferenceForSetup
356
- } from "../chunk-2JM3H72Y.js";
390
+ } from "../chunk-4OLECRWP.js";
357
391
  import "../chunk-P6DUWKAO.js";
358
392
  import "../chunk-3PSNUHC5.js";
359
- import "../chunk-EA6DCQMW.js";
360
- import "../chunk-3ABPJTSC.js";
393
+ import "../chunk-HB4BB66C.js";
394
+ import "../chunk-OGFKB66L.js";
361
395
  import "../chunk-POFBE6ZY.js";
362
- import "../chunk-KKVTBTX5.js";
363
- import "../chunk-Q3LFQVDS.js";
364
- import "../chunk-IAUCVHGV.js";
396
+ import "../chunk-7TGJ6FPW.js";
397
+ import "../chunk-J65WHWPK.js";
398
+ import "../chunk-XX3Z4KQL.js";
365
399
  import {
366
400
  checkApiKey,
367
401
  describeKeyCheck,
368
402
  samePusharyAccount
369
- } from "../chunk-LT2X6GMR.js";
370
- import "../chunk-746XV434.js";
371
- import "../chunk-J3LMHXHV.js";
403
+ } from "../chunk-TBHZAZPR.js";
404
+ import "../chunk-FIIRS53K.js";
405
+ import "../chunk-HY27YNME.js";
372
406
  import {
373
407
  KEY_FILE_MODE,
374
408
  installClaudeAlias,
@@ -383,8 +417,8 @@ import {
383
417
  resolveShellRc,
384
418
  shellKeyWasReplaced,
385
419
  writeKey
386
- } from "../chunk-2X7O2QE3.js";
387
- import "../chunk-ZHPK2JGH.js";
420
+ } from "../chunk-GS2SPPBB.js";
421
+ import "../chunk-UKHFRW5M.js";
388
422
  import {
389
423
  CLAUDE_CODE_PUSHARY_PERMISSION_RULES,
390
424
  CLINE_AUTO_APPROVE_STEP,
@@ -446,7 +480,7 @@ import {
446
480
  vscodePluginDir,
447
481
  vscodePluginMcp,
448
482
  writeInstructionBlock
449
- } from "../chunk-ZGQCZKNY.js";
483
+ } from "../chunk-74MBT2PL.js";
450
484
  import {
451
485
  compareVersion,
452
486
  parseVersion
@@ -468,10 +502,11 @@ import {
468
502
  runNpmInTerminal,
469
503
  setupNeedsGlobalInstall,
470
504
  setupWouldDowngrade
471
- } from "../chunk-R3VB6IWK.js";
505
+ } from "../chunk-OHMC3ZFE.js";
472
506
  import {
473
- getBaseUrl
474
- } from "../chunk-A4QB2DOJ.js";
507
+ getBaseUrl,
508
+ readApiKey
509
+ } from "../chunk-NEQMXQZQ.js";
475
510
  import {
476
511
  UsageError
477
512
  } from "../chunk-CINBAX5G.js";
@@ -483,7 +518,7 @@ import {
483
518
  NPX_LATEST_COMMAND,
484
519
  isInvocationOf,
485
520
  renderCommandHelp
486
- } from "../chunk-HXYZSB4U.js";
521
+ } from "../chunk-RXFLVAIV.js";
487
522
  import {
488
523
  EXIT
489
524
  } from "../chunk-BG4HHB7E.js";
@@ -498,6 +533,7 @@ import {
498
533
  CURSOR_GATE_SCRIPT,
499
534
  HOOK_COMPATIBLE_PROFILES,
500
535
  PRETOOLUSE_GATED_TOOLS,
536
+ SETUP_STOPPED_PATH,
501
537
  SUPPORT_EMAIL,
502
538
  computerOsOfPlatform,
503
539
  hookCompatibleProfile,
@@ -505,13 +541,13 @@ import {
505
541
  isRecord,
506
542
  isTimeoutAction,
507
543
  isValidApiKey
508
- } from "../chunk-QU6OSEUV.js";
544
+ } from "../chunk-U33VHYHK.js";
509
545
  import "../chunk-MLKGABMK.js";
510
546
 
511
547
  // bin/pushary-setup.ts
512
548
  import { existsSync as existsSync2, readFileSync, writeFileSync, mkdirSync, cpSync, rmSync, renameSync, realpathSync, statSync, openSync, readSync, closeSync } from "fs";
513
549
  import { join as join5, dirname as dirname3, basename } from "path";
514
- import { homedir, hostname } from "os";
550
+ import { homedir, hostname as hostname2 } from "os";
515
551
  import { execSync } from "child_process";
516
552
  import { input, confirm } from "@inquirer/prompts";
517
553
  import { fileURLToPath } from "url";
@@ -538,6 +574,18 @@ import {
538
574
  import { cursorHide } from "@inquirer/ansi";
539
575
  import figures from "@inquirer/figures";
540
576
  import { styleText } from "util";
577
+ var ONE_SECOND_MS = 1e3;
578
+ var tickEverySecondWithTimer = (tick, everyMs) => {
579
+ const timer = setInterval(tick, everyMs);
580
+ timer.unref?.();
581
+ return () => clearInterval(timer);
582
+ };
583
+ var TERMINAL_BELL = "\x07";
584
+ var idleCountdownLine = (countdown) => {
585
+ if (countdown.tickedCount === 0) return `Nothing is ticked. Setup stops in ${countdown.secondsLeft} s unless you tick an agent.`;
586
+ return countdown.keystrokes === 0 ? `Setting up the detected agents in ${countdown.secondsLeft} s. Press any key to choose.` : `Setting up the ticked agents in ${countdown.secondsLeft} s. Press Enter to set them up now.`;
587
+ };
588
+ var wholeSecondsIn = (ms) => Math.max(1, Math.ceil(ms / ONE_SECOND_MS));
541
589
  var PAGE_SIZE = 7;
542
590
  var SELECT_ALL_KEY = "a";
543
591
  var INVERT_KEY = "i";
@@ -572,11 +620,21 @@ var renderAgentPicker = (config, done) => {
572
620
  const [keystrokes, setKeystrokes] = useState(0);
573
621
  const prefix = usePrefix({ status, theme: PICKER_THEME });
574
622
  const scheduleIdle = config.scheduleIdle ?? scheduleWithTimer;
623
+ const scheduleTick = config.scheduleTick ?? tickEverySecondWithTimer;
624
+ const [secondsLeft, setSecondsLeft] = useState(wholeSecondsIn(config.idleLimitMs));
575
625
  const settle = (outcome) => {
576
626
  setStatus("done");
577
627
  done(outcome);
578
628
  };
579
629
  useEffect(() => scheduleIdle(() => settle(outcomeWhenIdle(keystrokes, choices)), config.idleLimitMs), [keystrokes]);
630
+ useEffect(() => {
631
+ let left = wholeSecondsIn(config.idleLimitMs);
632
+ setSecondsLeft(left);
633
+ return scheduleTick(() => {
634
+ left = Math.max(1, left - 1);
635
+ setSecondsLeft(left);
636
+ }, ONE_SECOND_MS);
637
+ }, [keystrokes]);
580
638
  const submit = () => {
581
639
  const picked = tickedAgents(choices);
582
640
  const verdict = config.validate(picked);
@@ -599,6 +657,7 @@ var renderAgentPicker = (config, done) => {
599
657
  };
600
658
  const respondToKey = (key) => {
601
659
  setKeystrokes(keystrokes + 1);
660
+ setSecondsLeft(wholeSecondsIn(config.idleLimitMs));
602
661
  if (isEnterKey(key)) submit();
603
662
  else if (isUpKey(key)) moveCursor(-1);
604
663
  else if (isDownKey(key)) moveCursor(1);
@@ -616,7 +675,8 @@ var renderAgentPicker = (config, done) => {
616
675
  page,
617
676
  " ",
618
677
  error ? PICKER_THEME.style.error(error) : "",
619
- renderedKeyHelp()
678
+ renderedKeyHelp(),
679
+ styleText("dim", idleCountdownLine({ secondsLeft, keystrokes, tickedCount: tickedAgents(choices).length }))
620
680
  ].filter(Boolean).join("\n").trimEnd();
621
681
  return `${lines}${cursorHide}`;
622
682
  };
@@ -645,19 +705,107 @@ var agentSetupTargets = (exists) => ({
645
705
  });
646
706
 
647
707
  // src/cli/enter-key.ts
648
- var enterKeyListener = (input2 = process.stdin) => {
708
+ var CONTROL_C = "";
709
+ var interruptThisProcess = () => {
710
+ process.kill(process.pid, "SIGINT");
711
+ };
712
+ var singleKeyListener = (key, input2 = process.stdin, interrupt = interruptThisProcess) => {
649
713
  if (input2.isTTY !== true) return null;
650
- return (onEnter) => {
651
- const onLine = () => onEnter();
652
- input2.on("data", onLine);
714
+ const wanted = key.toLowerCase();
715
+ return (onKey) => {
716
+ const wasRaw = input2.isRaw === true;
717
+ const onData = (chunk) => {
718
+ const typed = chunk.toString().toLowerCase();
719
+ if (typed.includes(CONTROL_C)) interrupt();
720
+ else if (typed.includes(wanted)) onKey();
721
+ };
722
+ input2.setRawMode(true);
723
+ input2.on("data", onData);
653
724
  input2.resume();
654
725
  return () => {
655
- input2.off("data", onLine);
726
+ input2.off("data", onData);
727
+ input2.setRawMode(wasRaw);
656
728
  input2.pause();
657
729
  };
658
730
  };
659
731
  };
660
732
 
733
+ // src/setup/restart-steps.ts
734
+ var AND_LIST = new Intl.ListFormat("en", { style: "long", type: "conjunction" });
735
+ var namesNeeding = (restarts, kind) => [...new Set(restarts.filter((restart) => restart.kind === kind).map((restart) => restart.agentName))];
736
+ var describeRestarts = (restarts) => {
737
+ const restart = namesNeeding(restarts, "restart");
738
+ const quit = namesNeeding(restarts, "quit-and-reopen");
739
+ return [
740
+ ...restart.length > 0 ? [`Restart ${AND_LIST.format(restart)} to load Pushary.`] : [],
741
+ ...quit.length > 0 ? [`Fully quit and reopen ${AND_LIST.format(quit)}. A Reload Window may not be enough.`] : []
742
+ ];
743
+ };
744
+
745
+ // src/setup/agent-output.ts
746
+ var AGENTS_WHOSE_STEPS_ARE_THE_INSTRUCTIONS = /* @__PURE__ */ new Set(["custom"]);
747
+ var setupMayChangeHermesShellGate = (context) => context.agent === "hermes" && context.hermesShellGate !== "report";
748
+ var agentOutputModeFor = (context) => {
749
+ if (context.verbose) return "every-step";
750
+ if (AGENTS_WHOSE_STEPS_ARE_THE_INSTRUCTIONS.has(context.agent)) return "every-step";
751
+ return setupMayChangeHermesShellGate(context) ? "every-step" : "one-line";
752
+ };
753
+ var TERMINAL_CONTROL_SEQUENCE = /\x1b\[[0-9;?]*[A-Za-z]/g;
754
+ var CARRIAGE_RETURN = "\r";
755
+ var WARNING_MARK = "!";
756
+ var SUCCESS_MARK = "\u2713";
757
+ var visibleText = (line) => line.replace(TERMINAL_CONTROL_SEQUENCE, "").trim();
758
+ var lastRedrawOf = (line) => line.slice(line.lastIndexOf(CARRIAGE_RETURN) + 1);
759
+ var ERASE_TO_END_OF_LINE = "\x1B[K";
760
+ var printedLinesOf = (written) => {
761
+ const lines = written.split("\n").map((line) => lastRedrawOf(line).split(ERASE_TO_END_OF_LINE).join(""));
762
+ return lines.at(-1) === "" ? lines.slice(0, -1) : lines;
763
+ };
764
+ var endsAWarning = (text) => text === "" || text.startsWith(SUCCESS_MARK);
765
+ var warningLinesOf = (lines) => {
766
+ const kept = [];
767
+ let insideWarning = false;
768
+ for (const line of lines) {
769
+ const text = visibleText(line);
770
+ if (text.startsWith(WARNING_MARK)) {
771
+ insideWarning = true;
772
+ kept.push(line);
773
+ } else if (endsAWarning(text)) {
774
+ insideWarning = false;
775
+ } else if (insideWarning) {
776
+ kept.push(line);
777
+ }
778
+ }
779
+ return kept;
780
+ };
781
+ var textOf = (chunk) => typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8");
782
+ var captureStreamWrites = (stream) => {
783
+ const original = stream.write;
784
+ let written = "";
785
+ let released = false;
786
+ const capturingWrite = (chunk, encodingOrCallback, callback) => {
787
+ written += textOf(chunk);
788
+ const done = typeof encodingOrCallback === "function" ? encodingOrCallback : callback;
789
+ done?.(null);
790
+ return true;
791
+ };
792
+ stream.write = capturingWrite;
793
+ return {
794
+ written: () => written,
795
+ writeThrough: (text) => {
796
+ original.call(stream, text);
797
+ },
798
+ release: () => {
799
+ if (released) return;
800
+ released = true;
801
+ stream.write = original;
802
+ }
803
+ };
804
+ };
805
+ var PROGRESS_MARK = "\u2026";
806
+ var progressLineFor = (agentName) => ` ${PROGRESS_MARK} ${agentName}`;
807
+ var CLEAR_PROGRESS_LINE = `\r${ERASE_TO_END_OF_LINE}`;
808
+
661
809
  // src/setup/service-notice.ts
662
810
  var PHONE_START_OPT_OUT = "Turn it off with --control off.";
663
811
  var describeServiceInstall = (servicePresent) => servicePresent ? `Updating the background service that lets your phone start agents. ${PHONE_START_OPT_OUT}` : `Installing a background service so your phone can start agents. ${PHONE_START_OPT_OUT}`;
@@ -779,7 +927,186 @@ var parseCodexEngineManifestVersion = (contents) => {
779
927
  };
780
928
  var parseEmbeddedCodexVersion = (haystack) => haystack.match(/cli_version(\d+\.\d+\.\d+)/)?.[1] ?? null;
781
929
 
930
+ // src/setup/sign-in.ts
931
+ import { hostname } from "os";
932
+ var SIGN_IN_ENTER_KEY = "\r";
933
+ var SIGN_IN_TIMEOUT_MINUTES = Math.ceil(PAIR_TIMEOUT_MS / 6e4);
934
+ var SIGN_IN_CANCELLED_LINE = "Cancelled. Nothing was written.";
935
+ var SIGN_IN_STOPPED_LINE = "Stopped before you signed in. The sign-in code was cancelled.";
936
+ var SIGN_IN_KEEPS_RUNNING_LINE = `This keeps running until you sign in, for up to ${SIGN_IN_TIMEOUT_MINUTES} minutes. Keep it running.`;
937
+ var PHONE_DENIED_REASON = "denied";
938
+ var appWaitGaveUp = (poll) => poll.kind === "timeout" || poll.kind === "unreachable" || poll.kind === "decrypt";
939
+ var describeStartFailure = (started) => {
940
+ if (started.kind === "rate-limited") return `too many attempts, retry in ${started.retryAfterSeconds}s`;
941
+ if (started.kind === "unavailable") return started.detail;
942
+ return "pairing could not start";
943
+ };
944
+ var fingerprintLine = (ui, fingerprint, browser, app) => {
945
+ const where = browser && app ? "The page and the app show" : browser ? "The page shows" : "The app shows";
946
+ return ` ${ui.dim(`${where} ${fingerprint}. Check it matches.`)}`;
947
+ };
948
+ var revokeKeyThatArrivedLate = async (apiKey) => {
949
+ await revokeOwnKey(apiKey, getBaseUrl()).catch(() => {
950
+ });
951
+ };
952
+ var lateKeyOf = (finished) => {
953
+ if (finished === null) return null;
954
+ if (finished.via === "browser") return finished.report.state.kind === "authorized" ? finished.report.state.apiKey : null;
955
+ return finished.poll.kind === "paired" ? finished.poll.apiKey : null;
956
+ };
957
+ var signedIn = (outcome) => outcome.kind === "browser" || outcome.kind === "app";
958
+ var settledLoser = (loser) => loser ?? Promise.resolve(null);
959
+ var releaseLoginLeftOver = async (login, loser, deps) => {
960
+ const lateKey = lateKeyOf(await settledLoser(loser));
961
+ if (lateKey !== null) return revokeKeyThatArrivedLate(lateKey);
962
+ await cancelLogin(login, deps);
963
+ const left = await pollOnce(login, deps);
964
+ if (left.kind === "authorized") await revokeKeyThatArrivedLate(left.apiKey);
965
+ };
966
+ var releasePairingLeftOver = async (pairing, keypair, loser) => {
967
+ const lateKey = lateKeyOf(await settledLoser(loser)) ?? await keyLeftInPairing(pairing.pairId, keypair);
968
+ if (lateKey !== null) await revokeKeyThatArrivedLate(lateKey);
969
+ await cancelPairing(pairing.pairId);
970
+ };
971
+ var printSignInScreen = async (screen) => {
972
+ const { ui, login, pairing } = screen;
973
+ ui.say("");
974
+ ui.say(` ${ui.bold("Sign in to Pushary")}`);
975
+ ui.say("");
976
+ if (login !== null) {
977
+ if (screen.offersEnter) ui.say(" Press Enter to sign in with your browser.");
978
+ ui.say(` ${screen.offersEnter ? "Or go to" : "Go to"} ${ui.cyan(login.verificationUrl)} on any device and enter ${ui.bold(login.userCode)}`);
979
+ }
980
+ if (pairing !== null) {
981
+ const links = buildPairLinks(pairing.pairId, screen.keypair.publicKeyB64, void 0, pairing.code);
982
+ ui.say("");
983
+ ui.say(login === null ? " Scan this with your phone's camera or the Pushary app." : " Have the Pushary app? Scan this with your phone instead.");
984
+ await printQr(links.qrLink);
985
+ ui.say(` ${ui.dim("Or open on your phone:")} ${ui.cyan(links.universalLink)}`);
986
+ }
987
+ ui.say(fingerprintLine(ui, publicKeyFingerprint(screen.keypair.publicKeyB64), login !== null, pairing !== null));
988
+ ui.say("");
989
+ ui.say(` ${ui.dim(screen.offersEnter ? "Waiting for you to sign in. Ctrl-C to stop." : SIGN_IN_KEEPS_RUNNING_LINE)}`);
990
+ };
991
+ var signInForSetup = async (ui, options, deps = {}) => {
992
+ const keypair = generateKeypair();
993
+ const clock = deps.clock ?? SYSTEM_PAIR_CLOCK;
994
+ const requestedAt = clock.now();
995
+ const showQr = deps.showQr ?? canShowPairingQr();
996
+ const loginDeps = deps.login ?? {};
997
+ const browserCanOpen = deps.browserAvailable ?? canOpenBrowser();
998
+ const enterKey = browserCanOpen ? deps.enter === void 0 ? singleKeyListener(SIGN_IN_ENTER_KEY) : deps.enter : null;
999
+ const localState = newLocalConfirmState();
1000
+ const [started, pairing] = await Promise.all([
1001
+ startLogin(hostname(), options.cliVersion, loginDeps, {
1002
+ command: "setup",
1003
+ keypair,
1004
+ ...enterKey === null ? {} : { localConfirmStateHash: localConfirmStateHash(localState) }
1005
+ }),
1006
+ showQr ? startPairing(keypair.publicKeyB64, options.computer) : Promise.resolve(null)
1007
+ ]);
1008
+ const login = started.kind === "ok" ? started.start : null;
1009
+ if (login === null && pairing === null) return { kind: "unavailable", detail: describeStartFailure(started) };
1010
+ const browserAvailable = login !== null && browserCanOpen;
1011
+ const enter = login === null ? null : enterKey;
1012
+ const listener = login !== null && enter !== null ? await listenForThisTerminal(login, localState, loginDeps) : null;
1013
+ const openBrowser = deps.openBrowser ?? openInBrowser;
1014
+ const controller = new AbortController();
1015
+ const bothWaysStopped = new Promise((resolve) => controller.signal.addEventListener("abort", () => resolve(), { once: true }));
1016
+ const appClock = { now: clock.now, sleep: (ms) => Promise.race([clock.sleep(ms), bothWaysStopped]) };
1017
+ let appStopped = false;
1018
+ let interruptedWith = null;
1019
+ let releaseEnter = () => {
1020
+ };
1021
+ let enterReleased = false;
1022
+ const stopEnter = () => {
1023
+ if (enterReleased) return;
1024
+ enterReleased = true;
1025
+ releaseEnter();
1026
+ };
1027
+ const stopBothWays = () => {
1028
+ controller.abort();
1029
+ appStopped = true;
1030
+ stopEnter();
1031
+ listener?.close();
1032
+ };
1033
+ const cancelBothWays = () => Promise.allSettled([
1034
+ login === null ? null : cancelLogin(login, loginDeps),
1035
+ pairing === null ? null : cancelPairing(pairing.pairId)
1036
+ ]);
1037
+ const cancelOnSignal = (exitCode) => () => {
1038
+ if (interruptedWith !== null) return;
1039
+ interruptedWith = exitCode;
1040
+ stopBothWays();
1041
+ ui.say("");
1042
+ ui.say(` ${ui.yellow("!")} ${exitCode === EXIT_TERMINATED ? SIGN_IN_STOPPED_LINE : SIGN_IN_CANCELLED_LINE}`);
1043
+ const flushed = options.onCancelled(exitCode);
1044
+ void Promise.allSettled([Promise.resolve(flushed), cancelBothWays()]).finally(() => process.exit(exitCode));
1045
+ };
1046
+ const onInterrupt = cancelOnSignal(EXIT_ABORTED);
1047
+ const onTerminate = cancelOnSignal(EXIT_TERMINATED);
1048
+ process.once("SIGINT", onInterrupt);
1049
+ process.once("SIGTERM", onTerminate);
1050
+ try {
1051
+ await printSignInScreen({ ui, login, pairing, keypair, offersEnter: enter !== null });
1052
+ if (interruptedWith !== null) return heldUntilTheSignalExits();
1053
+ const openTheBrowser = () => {
1054
+ if (login === null) return;
1055
+ if (openBrowser(browserEntryUrl(login, listener))) ui.say(` ${ui.dim("Opened your browser.")}`);
1056
+ else ui.say(` ${ui.yellow("!")} Couldn't open a browser. Go to ${ui.cyan(login.verificationUrl)} and enter ${ui.bold(login.userCode)}`);
1057
+ };
1058
+ if (enter !== null && !enterReleased) releaseEnter = enter(openTheBrowser);
1059
+ const pending = /* @__PURE__ */ new Map();
1060
+ if (login !== null) {
1061
+ const notice = (state) => printLoginNotice(ui, state, browserAvailable);
1062
+ pending.set("browser", waitForLogin(login, { signal: controller.signal, onNotice: notice }, loginDeps).then((report) => ({ via: "browser", report })));
1063
+ }
1064
+ if (pairing !== null) {
1065
+ const deadline = requestedAt + PAIR_TIMEOUT_MS;
1066
+ pending.set("app", pollAppPairing({ pairId: pairing.pairId, keypair, deadline, clock: appClock, stopped: () => appStopped }).then((poll) => ({ via: "app", poll })));
1067
+ }
1068
+ const finishWith = async (outcome) => {
1069
+ stopBothWays();
1070
+ const released = Promise.allSettled([
1071
+ login !== null && outcome.kind !== "browser" ? releaseLoginLeftOver(login, pending.get("browser"), loginDeps) : null,
1072
+ pairing !== null && outcome.kind !== "app" ? releasePairingLeftOver(pairing, keypair, pending.get("app")) : null
1073
+ ]);
1074
+ if (!signedIn(outcome)) await released;
1075
+ if (interruptedWith !== null) return heldUntilTheSignalExits();
1076
+ return outcome;
1077
+ };
1078
+ while (pending.size > 0) {
1079
+ const finished = await Promise.race(pending.values());
1080
+ if (interruptedWith !== null) return heldUntilTheSignalExits();
1081
+ pending.delete(finished.via);
1082
+ if (finished.via === "browser") {
1083
+ const state = finished.report.state;
1084
+ if (state.kind === "authorized") return await finishWith({ kind: "browser", apiKey: state.apiKey, siteSlug: state.siteSlug });
1085
+ if (state.kind === "rejected") return await finishWith({ kind: "rejected" });
1086
+ continue;
1087
+ }
1088
+ const poll = finished.poll;
1089
+ if (poll.kind === "paired") return await finishWith({ kind: "app", apiKey: poll.apiKey, handle: poll.handle ?? null });
1090
+ if (poll.kind === "failed" && (poll.reason === PHONE_DENIED_REASON || !pending.has("browser"))) {
1091
+ return await finishWith({ kind: "app_stopped", detail: describePairFailure(poll.reason, "setup") });
1092
+ }
1093
+ if (poll.kind === "failed" && pending.has("browser")) {
1094
+ ui.say(` ${ui.yellow("!")} ${describePairFailure(poll.reason, "setup")}`);
1095
+ ui.say(` ${ui.dim("You can still sign in with your browser.")}`);
1096
+ }
1097
+ if (pairing !== null && appWaitGaveUp(poll)) void cancelPairing(pairing.pairId);
1098
+ }
1099
+ return await finishWith({ kind: "expired" });
1100
+ } finally {
1101
+ stopEnter();
1102
+ listener?.close();
1103
+ process.off("SIGINT", onInterrupt);
1104
+ process.off("SIGTERM", onTerminate);
1105
+ }
1106
+ };
1107
+
782
1108
  // src/setup/telemetry.ts
1109
+ import { randomUUID } from "crypto";
783
1110
  var roundTripOutcome = (outcome) => {
784
1111
  switch (outcome?.kind) {
785
1112
  case "answered":
@@ -819,15 +1146,37 @@ var recordCodexTrust = (outcome) => {
819
1146
  var emitted = false;
820
1147
  var SETUP_COMPLETED_EVENT = "agent_setup_completed";
821
1148
  var SETUP_AGENT_TYPE = "setup";
1149
+ var SETUP_RUN_ID = randomUUID();
1150
+ var SETUP_STOP_TIMEOUT_MS = 2e3;
1151
+ var saveLocalSetupDiagnostic = (event) => {
1152
+ try {
1153
+ saveSetupFailure({ ...event });
1154
+ } catch {
1155
+ process.stderr.write("[pushary] Could not save the local setup diagnostic. Keep the setup output for support.\n");
1156
+ }
1157
+ };
1158
+ var postSetupStop = async (beacon) => {
1159
+ await fetch(`${getBaseUrl()}${SETUP_STOPPED_PATH}`, {
1160
+ method: "POST",
1161
+ headers: { "content-type": "application/json" },
1162
+ body: JSON.stringify(beacon),
1163
+ signal: AbortSignal.timeout(SETUP_STOP_TIMEOUT_MS)
1164
+ });
1165
+ };
1166
+ var savedKeyInForce = () => {
1167
+ const read = readApiKey();
1168
+ return read.kind === "key" ? read.key : null;
1169
+ };
822
1170
  var defaultDeps = {
823
1171
  report: async (event, options) => {
824
- try {
825
- saveSetupFailure({ ...event });
826
- } catch {
827
- process.stderr.write("[pushary] Could not save the local setup diagnostic. Keep the setup output for support.\n");
828
- }
1172
+ saveLocalSetupDiagnostic({ ...event });
829
1173
  return reportEvent(event, options);
830
- }
1174
+ },
1175
+ reportStop: async (beacon) => {
1176
+ saveLocalSetupDiagnostic({ event: SETUP_COMPLETED_EVENT, agentType: SETUP_AGENT_TYPE, ...beacon });
1177
+ return postSetupStop(beacon);
1178
+ },
1179
+ savedKey: savedKeyInForce
831
1180
  };
832
1181
  var completeBeacon = (run) => ({
833
1182
  ...run,
@@ -839,9 +1188,14 @@ var emit = async (deps, run) => {
839
1188
  if (emitted) return;
840
1189
  emitted = true;
841
1190
  try {
1191
+ const apiKey = recordedKey ?? deps.savedKey();
1192
+ if (apiKey === null && run.abortReason !== null) {
1193
+ await deps.reportStop({ ...completeBeacon(run), runId: SETUP_RUN_ID });
1194
+ return;
1195
+ }
842
1196
  await deps.report(
843
1197
  { event: SETUP_COMPLETED_EVENT, agentType: SETUP_AGENT_TYPE, ...completeBeacon(run) },
844
- { maxAttempts: 1, timeoutMs: 2e3, ...recordedKey ? { apiKey: recordedKey } : {} }
1198
+ { maxAttempts: 1, timeoutMs: 2e3, ...apiKey ? { apiKey } : {} }
845
1199
  );
846
1200
  } catch {
847
1201
  }
@@ -926,7 +1280,10 @@ var decideSetupHandoff = (input2) => {
926
1280
  return { kind: "hand_off", version: npmAllows.version, heldBy };
927
1281
  };
928
1282
  var argumentsAfterSetup = (argv) => argv[0] !== void 0 && isInvocationOf(argv[0], SETUP_COMMAND) ? argv.slice(1) : argv;
929
- var handoffNpmArgs = (packageName, version, setupArgs) => ["exec", "--yes", `--package=${packageName}@${version}`, "--", CLI_COMMAND, SETUP_COMMAND, ...setupArgs];
1283
+ var VERBOSE_FLAG = "--verbose";
1284
+ var FIRST_RELEASE_WITH_VERBOSE = "1.9.235";
1285
+ var setupArgsTheReleaseKnows = (version, setupArgs) => isNewerVersion(FIRST_RELEASE_WITH_VERBOSE, version) ? setupArgs.filter((arg) => arg !== VERBOSE_FLAG) : setupArgs;
1286
+ var handoffNpmArgs = (packageName, version, setupArgs) => ["exec", "--yes", `--package=${packageName}@${version}`, "--", CLI_COMMAND, SETUP_COMMAND, ...setupArgsTheReleaseKnows(version, setupArgs)];
930
1287
  var daysOld = (days) => `${days} ${days === 1 ? "day" : "days"}`;
931
1288
  var releasesNpmInstalls = (rule) => {
932
1289
  switch (rule.kind) {
@@ -1033,6 +1390,13 @@ var manualSteps = [];
1033
1390
  var noteManual = (step) => {
1034
1391
  manualSteps.push(step);
1035
1392
  };
1393
+ var restartsNoted = [];
1394
+ var manualStepsPrinted = 0;
1395
+ var restartsPrinted = 0;
1396
+ var noteRestart = (restart, step) => {
1397
+ noteManual(step);
1398
+ restartsNoted.push({ step, restart });
1399
+ };
1036
1400
  var codexApprovals = null;
1037
1401
  var humanStream = process.stdout;
1038
1402
  var writeHuman = (text) => {
@@ -1371,7 +1735,7 @@ var setupHermes = async (_apiKey, context) => {
1371
1735
  const message = describeHermesInstallFailure(outcome.reason, shortenHome(hermesPluginDirectory(defaultHermesHome())), shortenHome(receipts.receiptPath));
1372
1736
  console.log(` ${yellow("!")} ${message}`);
1373
1737
  noteManual(message);
1374
- return "skipped";
1738
+ return "unchanged";
1375
1739
  }
1376
1740
  reportHermesInstall(outcome, plugin.version);
1377
1741
  await connectHermesHistoryHelper(context);
@@ -1413,7 +1777,7 @@ var setupOpenClaw = async (_apiKey) => {
1413
1777
  const message = describeOpenClawInstallFailure(outcome.reason, outcome.detail);
1414
1778
  console.log(` ${yellow("!")} ${message}`);
1415
1779
  noteManual(message);
1416
- return "skipped";
1780
+ return "unchanged";
1417
1781
  }
1418
1782
  reportOpenClawInstall(outcome);
1419
1783
  const { state } = outcome.inspection;
@@ -1810,7 +2174,7 @@ var setupCursor = async (apiKey) => {
1810
2174
  console.log(` ${dim("\u2022")} Permission gate registered once in ~/.cursor/hooks.json`);
1811
2175
  console.log(` ${dim("\u2022")} Risky shell commands route to push approval before they run`);
1812
2176
  console.log(` ${dim("\u2022")} Fully quit and reopen Cursor to load it (a Reload Window may not be enough)`);
1813
- noteManual("Fully quit and reopen Cursor. A Reload Window may not be enough.");
2177
+ noteRestart({ agentName: "Cursor", kind: "quit-and-reopen" }, "Fully quit and reopen Cursor. A Reload Window may not be enough.");
1814
2178
  };
1815
2179
  var resolveBundledVsCodePlugin = () => {
1816
2180
  const dir = dirname3(fileURLToPath(import.meta.url));
@@ -1907,19 +2271,18 @@ var setupVsCode = async (apiKey) => {
1907
2271
  console.log(` ${dim("These settings files already have a chat.pluginLocations block, and")}`);
1908
2272
  console.log(` ${dim("they contain comments, so they were left untouched rather than rewritten.")}`);
1909
2273
  console.log(` ${dim("Add this entry inside that block:")}`);
1910
- console.log();
1911
- console.log(` ${cyan(`${JSON.stringify(VSCODE_PLUGIN_DIR)}: true`)}`);
1912
- console.log();
2274
+ console.log(` ${cyan(`${JSON.stringify(VSCODE_PLUGIN_DIR)}: true`)}`);
1913
2275
  for (const path of registration.manual) {
1914
2276
  console.log(` ${dim("in")} ${path}`);
1915
2277
  }
2278
+ console.log();
1916
2279
  noteManual(
1917
2280
  `Add ${JSON.stringify(VSCODE_PLUGIN_DIR)}: true to the chat.pluginLocations block in ${registration.manual.join(" and ")}. Full snippet:
1918
2281
  ${pluginLocationSnippet(VSCODE_PLUGIN_DIR)}`
1919
2282
  );
1920
2283
  }
1921
2284
  console.log(` ${dim("\u2022")} Fully quit and reopen VS Code to load the plugin`);
1922
- noteManual("Fully quit and reopen VS Code. A Reload Window may not pick up a new plugin location.");
2285
+ noteRestart({ agentName: "VS Code", kind: "quit-and-reopen" }, "Fully quit and reopen VS Code. A Reload Window may not pick up a new plugin location.");
1923
2286
  };
1924
2287
  var keySavedInConfigLine = (configPath) => `Your key is saved in ${configPath}, which is where hooks read it.`;
1925
2288
  var saveApiKey = async (apiKey, origin, controlMode, transcriptSync, replacedKeyRecordWasHonoured) => {
@@ -2012,7 +2375,7 @@ var setupFx = async () => {
2012
2375
  `);
2013
2376
  if (process.platform === "win32") {
2014
2377
  console.log(` ${yellow("!")} fx does not run on Windows. Skipping.`);
2015
- return "skipped";
2378
+ return "unchanged";
2016
2379
  }
2017
2380
  if (!existsSync2(fxConfigDir())) {
2018
2381
  console.log(` ${yellow("!")} fx not found (${fxConfigDir()} does not exist). Skipping.`);
@@ -2127,7 +2490,7 @@ var setupGemini = async (apiKey) => {
2127
2490
  console.log(` ${dim("\u2022")} Gate covers ${bold("run_shell_command")}, ${bold("write_file")}, ${bold("replace")} and MCP tool calls`);
2128
2491
  console.log(` ${dim("\u2022")} Auto-allowed tools: Pushary MCP calls run without a confirmation prompt`);
2129
2492
  console.log(` ${dim("Restart Gemini CLI to load the new config.")}`);
2130
- noteManual("Restart Gemini CLI to load the new config.");
2493
+ noteRestart({ agentName: "Gemini CLI", kind: "restart" }, "Restart Gemini CLI to load the new config.");
2131
2494
  };
2132
2495
  var OPENCODE_INSTRUCTIONS = openCodeInstructionsFile;
2133
2496
  var openCodeApprovalLines = (change, leftOpen) => {
@@ -2173,7 +2536,7 @@ var setupOpenCode = async (apiKey) => {
2173
2536
  for (const line of openCodeApprovalLines(askRules, leftOpen)) console.log(line);
2174
2537
  console.log(` ${dim("\u2022")} Receipts: tool results, prompts and turn boundaries reach your account`);
2175
2538
  console.log(` ${dim("Restart OpenCode to load the plugin.")}`);
2176
- noteManual("Restart OpenCode to load the plugin.");
2539
+ noteRestart({ agentName: "OpenCode", kind: "restart" }, "Restart OpenCode to load the plugin.");
2177
2540
  return "configured";
2178
2541
  };
2179
2542
  var clearSetupChoiceDecline = (agent) => {
@@ -2297,8 +2660,20 @@ var soleGateSettingText = (gate, value) => `"${gate.key}": "${value}"`;
2297
2660
  var reportSoleGate = (profile, gate, claim) => {
2298
2661
  const settings = shortenHome(soleGateFile(gate));
2299
2662
  switch (claim.kind) {
2663
+ case "left_for_a_person": {
2664
+ const note = `${profile.label} was left as it is. Setting it up turns off its own prompt, so setup does that only when you choose it. To set it up, run ${retryAgentCommand(profile.agentType)}`;
2665
+ console.log(` ${yellow("!")} ${note}`);
2666
+ noteManual(note);
2667
+ return;
2668
+ }
2669
+ case "settings_unreadable": {
2670
+ const note = `${profile.label} was left as it is. ${settings} is not a settings file setup can read, so setup cannot tell whether you chose a Tool Permission mode there. Fix or remove that file, then run ${retryAgentCommand(profile.agentType)}`;
2671
+ console.log(` ${yellow("!")} ${note}`);
2672
+ noteManual(note);
2673
+ return;
2674
+ }
2300
2675
  case "claimed":
2301
- console.log(` ${dim("\u2022")} Pushary is the only gate: set ${soleGateSettingText(gate, gate.value)} in ${settings}, so ${profile.label} no longer asks in its own prompt. ${dim(`pushary disconnect ${profile.source} puts it back.`)}`);
2676
+ console.log(` ${yellow("!")} Pushary is the only gate: set ${soleGateSettingText(gate, gate.value)} in ${settings}, so ${profile.label} no longer asks in its own prompt. ${dim(`pushary disconnect ${profile.source} puts it back.`)}`);
2302
2677
  return;
2303
2678
  case "already_sole_gate":
2304
2679
  console.log(` ${dim("\u2022")} ${profile.label} already has ${soleGateSettingText(gate, gate.value)}, so Pushary is its only gate`);
@@ -2311,7 +2686,17 @@ var reportSoleGate = (profile, gate, claim) => {
2311
2686
  }
2312
2687
  }
2313
2688
  };
2314
- var setupCompatibleAgent = (profile) => async (apiKey) => {
2689
+ var pusharyHooksAlreadyInSoleGateAgent = (profile) => {
2690
+ if (profile.soleGate === null) return false;
2691
+ const hooks = readJsonSafe(compatibleConfigFile(profile));
2692
+ return hooks.kind === "ok" && isRecord(hooks.value) && hasCompatibleHooks(hooks.value, profile);
2693
+ };
2694
+ var readSoleGateSettings = (gate) => {
2695
+ const saved = readJsonSafe(soleGateFile(gate));
2696
+ if (saved.kind === "missing") return { kind: "missing" };
2697
+ return saved.kind === "ok" && isRecord(saved.value) ? { kind: "record", value: saved.value } : { kind: "unreadable" };
2698
+ };
2699
+ var setupCompatibleAgent = (profile) => async (apiKey, context) => {
2315
2700
  const configFile = compatibleConfigFile(profile);
2316
2701
  const mcpFile = compatibleMcpFile(profile);
2317
2702
  const permissionFile = compatiblePermissionRuleFile(profile);
@@ -2324,6 +2709,13 @@ var setupCompatibleAgent = (profile) => async (apiKey) => {
2324
2709
  console.log(` ${dim(`Install ${profile.label} and re-run setup to configure.`)}`);
2325
2710
  return "skipped";
2326
2711
  }
2712
+ const gate = profile.soleGate;
2713
+ const chosenBefore = context.agentsChosenByPerson || pusharyHooksAlreadyInSoleGateAgent(profile);
2714
+ const leftAlone = gate ? soleGateLeftAloneFor(readSoleGateSettings(gate), gate, chosenBefore) : null;
2715
+ if (gate && leftAlone) {
2716
+ reportSoleGate(profile, gate, leftAlone);
2717
+ return "unchanged";
2718
+ }
2327
2719
  await installGlobally2();
2328
2720
  const documents = /* @__PURE__ */ new Map();
2329
2721
  const open = (file) => {
@@ -2359,7 +2751,7 @@ var setupCompatibleAgent = (profile) => async (apiKey) => {
2359
2751
  ${yellow("!")} ${profile.label} keeps something unexpected where Pushary writes. Nothing was changed.`);
2360
2752
  for (const conflict of declined) console.log(` ${dim(`\u2022 ${conflict}`)}`);
2361
2753
  console.log(` ${dim("Pushary expects a list of hook entries there. Move that key and re-run setup.")}`);
2362
- return "skipped";
2754
+ return "unchanged";
2363
2755
  }
2364
2756
  for (const [path, document] of documents) {
2365
2757
  await spinner(`Writing ${shortenHome(path)}`, async () => {
@@ -2372,7 +2764,6 @@ var setupCompatibleAgent = (profile) => async (apiKey) => {
2372
2764
  writeInstructionBlock(instructionsFile, renderAgentInstructions(profile.instructions.label));
2373
2765
  });
2374
2766
  }
2375
- const gate = profile.soleGate;
2376
2767
  const settingsPath = gate ? soleGateFile(gate) : null;
2377
2768
  const settings = settingsPath ? readAgentJson(settingsPath) : null;
2378
2769
  const soleGateClaim = gate && settings ? claimSoleGate(settings, gate) : null;
@@ -2389,9 +2780,12 @@ var setupCompatibleAgent = (profile) => async (apiKey) => {
2389
2780
  if (mcpFile) console.log(` ${dim("\u2022")} MCP server: ${profile.label} can send notifications and ask questions`);
2390
2781
  else console.log(` ${dim("\u2022")} ${dim(`No MCP server: ${profile.label} documents no remote-server config shape, so approvals work and agent-initiated questions do not`)}`);
2391
2782
  if (instructionsFile) console.log(` ${dim("\u2022")} Proactive instructions: ${shortenHome(instructionsFile)}`);
2392
- if (gate && soleGateClaim) reportSoleGate(profile, gate, soleGateClaim);
2783
+ if (gate && soleGateClaim) {
2784
+ reportSoleGate(profile, gate, soleGateClaim);
2785
+ console.log();
2786
+ }
2393
2787
  console.log(` ${dim(`Restart ${profile.label} to load the new config.`)}`);
2394
- noteManual(`Restart ${profile.label} to load the new config.`);
2788
+ noteRestart({ agentName: profile.label, kind: "restart" }, `Restart ${profile.label} to load the new config.`);
2395
2789
  return "configured";
2396
2790
  };
2397
2791
  var COMPATIBLE_SETUP = HOOK_COMPATIBLE_PROFILES.reduce((installers, profile) => ({
@@ -2482,6 +2876,11 @@ var verifyKeyOrExit = async (apiKey, options, precomputed) => {
2482
2876
  }
2483
2877
  return result;
2484
2878
  };
2879
+ var describeSignInStop = (stop) => {
2880
+ if (stop.kind === "app_stopped") return stop.detail;
2881
+ if (stop.kind === "expired") return "The sign-in code expired before it was used. Nothing was written.";
2882
+ return `Couldn't start sign-in ${dim(`(${stop.detail})`)}. Check your connection. Nothing was written.`;
2883
+ };
2485
2884
  var printPairingEscape = (lines) => {
2486
2885
  console.log();
2487
2886
  for (const line of lines) console.log(line === "" ? "" : ` ${line}`);
@@ -2568,6 +2967,48 @@ var AGENT_LABELS = Object.fromEntries(
2568
2967
  `${AGENT_NAMES[agent].padEnd(NAME_COLUMN)}${dim(AGENT_CAPABILITIES[agent])}`
2569
2968
  ])
2570
2969
  );
2970
+ var printSteps = (steps) => {
2971
+ for (const line of steps) console.log(line);
2972
+ };
2973
+ var printAgentLine = (agent, steps) => {
2974
+ console.log(` ${check} ${AGENT_LABELS[agent]}`);
2975
+ printSteps(warningLinesOf(steps));
2976
+ };
2977
+ var printWhyUnchanged = (steps) => {
2978
+ const warnings = warningLinesOf(steps);
2979
+ printSteps(warnings.length > 0 ? warnings : steps);
2980
+ };
2981
+ var installWithOneLine = async (agent, install) => {
2982
+ const stream = humanStream;
2983
+ const capture = captureStreamWrites(stream);
2984
+ const showsProgress = stream.isTTY === true;
2985
+ let finished = false;
2986
+ const finish = () => {
2987
+ if (finished) return;
2988
+ finished = true;
2989
+ if (showsProgress) capture.writeThrough(CLEAR_PROGRESS_LINE);
2990
+ capture.release();
2991
+ process.off("exit", showStepsOnExit);
2992
+ };
2993
+ const showStepsOnExit = () => {
2994
+ if (finished) return;
2995
+ finish();
2996
+ stream.write(capture.written());
2997
+ };
2998
+ process.once("exit", showStepsOnExit);
2999
+ if (showsProgress) capture.writeThrough(progressLineFor(AGENT_NAMES[agent]));
3000
+ try {
3001
+ const outcome = await install();
3002
+ finish();
3003
+ return { outcome, steps: printedLinesOf(capture.written()) };
3004
+ } catch (err) {
3005
+ finish();
3006
+ printSteps(printedLinesOf(capture.written()));
3007
+ throw err;
3008
+ } finally {
3009
+ finish();
3010
+ }
3011
+ };
2571
3012
  var detectAgents = () => {
2572
3013
  const map = {};
2573
3014
  for (const entry of detectAllAgents()) {
@@ -2577,7 +3018,9 @@ var detectAgents = () => {
2577
3018
  };
2578
3019
  var canRunBrowserLogin = () => process.stdout.isTTY === true && !isCI();
2579
3020
  var AGENT_PICKER_IDLE_LIMIT_MS = 2e4;
2580
- var answeredWith = (agents) => ({ agents, nobodyAnswered: false });
3021
+ var answeredWith = (agents) => ({ agents, nobodyAnswered: false, chosenByPerson: true });
3022
+ var pickedWithoutAPerson = (agents, nobodyAnswered) => ({ agents, nobodyAnswered, chosenByPerson: false });
3023
+ var tickedByAPersonWhoLeft = (agents) => ({ agents, nobodyAnswered: true, chosenByPerson: true });
2581
3024
  var AGENT_PICKER_IDLE_SECONDS = AGENT_PICKER_IDLE_LIMIT_MS / 1e3;
2582
3025
  var CHOOSE_WITH_AGENTS_FLAG = "(--agents to choose)";
2583
3026
  var selectDetectedAgents = async (detected) => {
@@ -2609,9 +3052,9 @@ var agentResolutionFromPicker = async (outcome, detected) => {
2609
3052
  return answeredWith(outcome.agents);
2610
3053
  case "idle-before-any-key":
2611
3054
  console.log(` ${yellow("!")} Nothing was pressed at the agent question for ${AGENT_PICKER_IDLE_SECONDS} seconds.`);
2612
- return { agents: await selectDetectedAgents(detected), nobodyAnswered: true };
3055
+ return pickedWithoutAPerson(await selectDetectedAgents(detected), true);
2613
3056
  case "idle-after-keys":
2614
- return { agents: await selectAgentsTickedWhenIdle(outcome.agents, detected), nobodyAnswered: true };
3057
+ return tickedByAPersonWhoLeft(await selectAgentsTickedWhenIdle(outcome.agents, detected));
2615
3058
  }
2616
3059
  };
2617
3060
  var resolveAgents = async (options) => {
@@ -2621,7 +3064,7 @@ var resolveAgents = async (options) => {
2621
3064
  for (const agent of options.agents.agents) {
2622
3065
  if (agent !== "custom" && !detected2[agent].found) {
2623
3066
  console.log(` ${yellow("!")} ${AGENT_NAMES[agent]} was not detected on this machine.`);
2624
- console.log(` ${dim("Continuing anyway. The steps below say what was configured.")}`);
3067
+ console.log(` ${dim("Continuing anyway. Setup says below what it configured.")}`);
2625
3068
  }
2626
3069
  }
2627
3070
  return answeredWith(options.agents.agents);
@@ -2631,8 +3074,9 @@ var resolveAgents = async (options) => {
2631
3074
  const selection = effectiveAgentSelection(options.agents, {
2632
3075
  someoneCanAnswer: someoneIsAtTheTerminal({ stdoutIsTty: process.stdout.isTTY === true, nonInteractive: options.nonInteractive })
2633
3076
  });
2634
- if (selection.kind === "auto") return answeredWith(await selectDetectedAgents(detected));
3077
+ if (selection.kind === "auto") return pickedWithoutAPerson(await selectDetectedAgents(detected), false);
2635
3078
  const hint = hasDetectedAgents ? "(detected agents pre-selected)" : "(space = toggle, enter = confirm)";
3079
+ if (process.stdout.isTTY === true) process.stdout.write(TERMINAL_BELL);
2636
3080
  return agentResolutionFromPicker(
2637
3081
  await pickAgentsUntilIdle({
2638
3082
  message: "Which agents do you use? " + dim(hint),
@@ -2690,11 +3134,25 @@ var reportDryRun = (apiKey, agents, keyCheck, controlMode) => {
2690
3134
  console.log(` ${dim("Re-run without --dry-run to apply.")}`);
2691
3135
  console.log();
2692
3136
  };
2693
- var printManualSteps = () => {
2694
- if (manualSteps.length === 0) return;
3137
+ var printManualStepsNotYetShown = () => {
3138
+ const newSteps = manualSteps.slice(manualStepsPrinted);
3139
+ const newRestarts = restartsNoted.slice(restartsPrinted);
3140
+ manualStepsPrinted = manualSteps.length;
3141
+ restartsPrinted = restartsNoted.length;
3142
+ if (newSteps.length === 0) return;
3143
+ const restartSteps = new Set(newRestarts.map((noted) => noted.step));
3144
+ const steps = [
3145
+ ...newSteps.filter((step) => !restartSteps.has(step)),
3146
+ ...describeRestarts(newRestarts.map((noted) => noted.restart))
3147
+ ];
2695
3148
  console.log(` ${bold("Still to do")}`);
2696
- for (const step of manualSteps) console.log(` ${dim("\u2022")} ${step}`);
3149
+ for (const step of steps) console.log(` ${dim("\u2022")} ${step}`);
3150
+ console.log();
3151
+ };
3152
+ var showManualStepsSoFar = () => {
3153
+ if (manualSteps.length === manualStepsPrinted) return;
2697
3154
  console.log();
3155
+ printManualStepsNotYetShown();
2698
3156
  };
2699
3157
  var announceSetupHandoff = (line) => {
2700
3158
  console.log();
@@ -2809,11 +3267,51 @@ var main = async () => {
2809
3267
  reportDryRun(null, plannedAgents, null, controlMode);
2810
3268
  await emitJson(options, { ok: true, dryRun: true, agents: plannedAgents, control: controlMode, keyCheck: "skipped", key: "none" });
2811
3269
  return;
3270
+ } else if (connectMode === "app" && canPairWithApp && !options.connectExplicit) {
3271
+ if (reuseDeclined) console.log();
3272
+ markStep("sign-in");
3273
+ const previous = readKeyInForce();
3274
+ const signedIn2 = await signInForSetup(
3275
+ { say: (line) => console.log(line), bold, dim, cyan, yellow },
3276
+ {
3277
+ cliVersion: version,
3278
+ computer: pairingComputerOf(hostname2(), process.platform, detectedAgentChoices()),
3279
+ onCancelled: async (exitCode2) => {
3280
+ printPairingEscape(describeCancelledSignIn(exitCode2));
3281
+ await reportSetupAbort("pairing-cancelled", exitCode2);
3282
+ }
3283
+ }
3284
+ );
3285
+ if (signedIn2.kind === "rejected") {
3286
+ console.log();
3287
+ console.log(` ${yellow("!")} That request was rejected in the browser. Nothing was written.`);
3288
+ console.log();
3289
+ process.exit(await abortWith("login-rejected", EXIT.NOT_CONFIGURED));
3290
+ }
3291
+ if (signedIn2.kind === "app_stopped" || signedIn2.kind === "expired" || signedIn2.kind === "unavailable") {
3292
+ console.log();
3293
+ console.log(` ${yellow("!")} ${describeSignInStop(signedIn2)}`);
3294
+ printPairingEscape(describeSignInEscape());
3295
+ process.exit(await abortWith("pairing-failed", EXIT.NOT_CONFIGURED));
3296
+ }
3297
+ trimmedKey = signedIn2.apiKey;
3298
+ keyOrigin = "created_by_this_cli";
3299
+ keyFromPairing = signedIn2.kind === "app";
3300
+ pairedHandle = signedIn2.kind === "app" && signedIn2.handle ? `@${signedIn2.handle}` : null;
3301
+ console.log();
3302
+ if (signedIn2.kind === "browser") console.log(` ${check} Signed in${signedIn2.siteSlug ? ` ${dim(`(${signedIn2.siteSlug})`)}` : ""}`);
3303
+ if (signedIn2.kind === "app") console.log(` ${check} Your phone approved this computer`);
3304
+ if (pairedHandle) console.log(` ${check} Connected to ${cyan(pairedHandle)}`);
3305
+ const previousKeyLeftActive = describePreviousKeyLeftActive(previous.key, trimmedKey);
3306
+ if (previousKeyLeftActive !== null) {
3307
+ console.log(` ${yellow("!")} ${previousKeyLeftActive}`);
3308
+ console.log(` ${dim("Revoke it at")} ${cyan("pushary.com/dashboard/agent/settings")} ${dim("if nothing else uses it.")}`);
3309
+ }
2812
3310
  } else if (connectMode === "app" && canPairWithApp) {
2813
3311
  if (reuseDeclined) console.log();
2814
3312
  markStep("pair");
2815
3313
  const previous = readKeyInForce();
2816
- const computer = pairingComputerOf(hostname(), process.platform, detectedAgentChoices());
3314
+ const computer = pairingComputerOf(hostname2(), process.platform, detectedAgentChoices());
2817
3315
  const paired = await connectViaAppPairing({
2818
3316
  computer,
2819
3317
  command: "setup",
@@ -2858,7 +3356,7 @@ var main = async () => {
2858
3356
  markStep("browser-login");
2859
3357
  const outcome = await runBrowserLogin(
2860
3358
  { say: (line) => console.log(line), bold, dim, cyan, yellow },
2861
- { cliVersion: version }
3359
+ { cliVersion: version, command: "setup" }
2862
3360
  );
2863
3361
  if (outcome.kind === "ok") {
2864
3362
  trimmedKey = outcome.apiKey;
@@ -2921,10 +3419,11 @@ var main = async () => {
2921
3419
  if (isKeyHeldByMacApp(trimmedKey, macAppHolder)) recordMacAppKeyPrefix(trimmedKey);
2922
3420
  if (keyCheck.kind === "ok") clearDaemonNeedsLogin();
2923
3421
  markStep("resolve-agents");
2924
- const { agents, nobodyAnswered } = await resolveAgents(options);
3422
+ const { agents, nobodyAnswered, chosenByPerson } = await resolveAgents(options);
2925
3423
  const context = {
2926
3424
  rc,
2927
3425
  sessionHistory: transcriptSync,
3426
+ agentsChosenByPerson: chosenByPerson,
2928
3427
  hermesShellGate: hermesShellGateChoice({
2929
3428
  requested: options.hermesGateTerminal,
2930
3429
  canAsk: !nobodyAnswered && canAskAtTheTerminal({ stdoutIsTty: process.stdout.isTTY === true, nonInteractive: options.nonInteractive, dryRun: options.dryRun })
@@ -2968,6 +3467,7 @@ var main = async () => {
2968
3467
  const failures = [];
2969
3468
  const completed = [];
2970
3469
  const skipped = [];
3470
+ const leftUnchanged = [];
2971
3471
  const hookOwners = [];
2972
3472
  let controlLifecycleFailure = null;
2973
3473
  if (agents.length === 0) {
@@ -2975,6 +3475,7 @@ var main = async () => {
2975
3475
  ${check} API key saved. No agents configured.`);
2976
3476
  console.log(` ${dim("Run setup again with --agents <id> when you want one wired up.")}`);
2977
3477
  } else {
3478
+ if (!options.verbose) console.log();
2978
3479
  for (const [index, agent] of agents.entries()) {
2979
3480
  markStep(`configure:${agent}`);
2980
3481
  try {
@@ -2986,7 +3487,7 @@ var main = async () => {
2986
3487
  if (!account.matches) {
2987
3488
  hookOwners.push({ agent, owner: "app", kept: true });
2988
3489
  failures.push(describedAgentFailure(agent, "app-account-mismatch"));
2989
- const [summary, ...steps] = describeMacAccountMismatch({
3490
+ const [summary, ...steps2] = describeMacAccountMismatch({
2990
3491
  agent,
2991
3492
  agentName: AGENT_NAMES[agent],
2992
3493
  setupAccount: account.setupAccount,
@@ -2994,7 +3495,7 @@ var main = async () => {
2994
3495
  });
2995
3496
  console.log(`
2996
3497
  ${yellow("!")} ${summary}`);
2997
- for (const step of steps) console.log(` ${dim(step)}`);
3498
+ for (const step of steps2) console.log(` ${dim(step)}`);
2998
3499
  continue;
2999
3500
  }
3000
3501
  console.log(`
@@ -3005,14 +3506,19 @@ var main = async () => {
3005
3506
  continue;
3006
3507
  }
3007
3508
  if (ownerBefore === "app") captureTakeoverReceipt(agent);
3008
- const outcome = await AGENT_SETUP[agent](trimmedKey, context);
3009
- if (outcome === "skipped") {
3509
+ const install = () => AGENT_SETUP[agent](trimmedKey, context);
3510
+ const { outcome, steps } = agentOutputModeFor({ agent, verbose: options.verbose, hermesShellGate: context.hermesShellGate }) === "one-line" ? await installWithOneLine(agent, install) : { outcome: await install(), steps: null };
3511
+ if (outcome === "skipped" || outcome === "unchanged") {
3010
3512
  skipped.push(agent);
3513
+ if (outcome === "unchanged") leftUnchanged.push(agent);
3514
+ if (outcome === "unchanged" && steps) printWhyUnchanged(steps);
3011
3515
  } else if (outcome === "verified" || await agentIsWired(agent)) {
3012
3516
  completed.push(agent);
3013
3517
  clearSetupChoiceDecline(agent);
3014
3518
  hookOwners.push({ agent, owner: agentHookOwner(agent, appBridgeAvailable), kept: false });
3519
+ if (steps) printAgentLine(agent, steps);
3015
3520
  } else {
3521
+ if (steps) printSteps(steps);
3016
3522
  const failure = describedAgentFailure(agent, "not-wired");
3017
3523
  failures.push(failure);
3018
3524
  console.log(` ${yellow("!")} ${AGENT_NAMES[agent]} ${failure.detail}`);
@@ -3026,9 +3532,14 @@ var main = async () => {
3026
3532
  if (continuation) console.log(` ${dim(continuation)}`);
3027
3533
  }
3028
3534
  }
3029
- if (skipped.length > 0) {
3535
+ const notInstalled = skipped.filter((agent) => !leftUnchanged.includes(agent));
3536
+ if (notInstalled.length > 0) {
3537
+ console.log();
3538
+ console.log(` ${yellow("!")} Not configured: ${notInstalled.map((agent) => AGENT_NAMES[agent]).join(", ")} ${dim("(not installed on this machine)")}`);
3539
+ }
3540
+ if (leftUnchanged.length > 0) {
3030
3541
  console.log();
3031
- console.log(` ${yellow("!")} Not configured: ${skipped.map((a) => a.replace("_", " ")).join(", ")} ${dim("(not installed on this machine)")}`);
3542
+ console.log(` ${yellow("!")} Not configured: ${leftUnchanged.map((agent) => AGENT_NAMES[agent]).join(", ")} ${dim("(the reason is above)")}`);
3032
3543
  }
3033
3544
  if (failures.length > 0) {
3034
3545
  console.log();
@@ -3036,6 +3547,7 @@ var main = async () => {
3036
3547
  console.log(` ${yellow("!")} Failed: ${failedAgentNames(failures).join(", ")}${configured ? ` ${dim(configured)}` : ""}`);
3037
3548
  for (const followUp of agentFailureFollowUps(failures)) console.log(` ${agentFailureFollowUpLine(followUp)}`);
3038
3549
  }
3550
+ showManualStepsSoFar();
3039
3551
  if (!keyFromPairing && !nobodyAnswered) {
3040
3552
  markStep("project-instructions");
3041
3553
  await offerProjectInstructions(agents, options);
@@ -3052,6 +3564,7 @@ var main = async () => {
3052
3564
  console.log(` ${check} Phone-start background service disabled.`);
3053
3565
  }
3054
3566
  }
3567
+ showManualStepsSoFar();
3055
3568
  markStep(CONNECT_PHONE_STEP);
3056
3569
  if (keyCheck.kind === "ok") console.log(` ${dim(await fetchSetupWaitGuidance(trimmedKey))}`);
3057
3570
  const skipPhone = options.skipPhone;
@@ -3095,7 +3608,7 @@ var main = async () => {
3095
3608
  phone = await printConnectInstructions(trimmedKey, connectInstructions);
3096
3609
  break;
3097
3610
  case "wait-for-app": {
3098
- const skip = enterKeyListener();
3611
+ const skip = singleKeyListener(PHONE_WAIT_SKIP_KEY);
3099
3612
  phone = skip === null ? await printConnectInstructions(trimmedKey, connectInstructions) : await waitForYourPhone(trimmedKey, { skip });
3100
3613
  break;
3101
3614
  }
@@ -3103,6 +3616,8 @@ var main = async () => {
3103
3616
  phone = await connectDevice(trimmedKey, { showCapabilities: !options.connectExplicit });
3104
3617
  break;
3105
3618
  }
3619
+ const phoneSkippedAtTheTerminal = phoneWaitWasSkipped(phone);
3620
+ if (phoneSkippedAtTheTerminal) phone = null;
3106
3621
  let roundTrip = null;
3107
3622
  if (verifyMode === "roundtrip" && keyCheck.kind === "ok" && !skipPhone && // Reaching nobody is already reported by the delivery check above, in copy
3108
3623
  // that names the fix. Asking a question nobody can receive would repeat it
@@ -3132,7 +3647,7 @@ var main = async () => {
3132
3647
  const report = describeRoundTripOutcome(roundTrip, { appPlatforms, keyScope });
3133
3648
  if (!report.ok) console.log(` ${yellow("!")} ${report.message}`);
3134
3649
  for (const line of report.next) console.log(` ${dim(line)}`);
3135
- } else if (verifyMode === "roundtrip" && keyCheck.kind === "ok") {
3650
+ } else if (verifyMode === "roundtrip" && keyCheck.kind === "ok" && !phoneSkippedAtTheTerminal) {
3136
3651
  console.log();
3137
3652
  console.log(` ${dim("Skipped the round trip: nothing is connected that could answer it.")}`);
3138
3653
  }
@@ -3142,7 +3657,7 @@ var main = async () => {
3142
3657
  const inactivePlanHint = wrongAccountHint === "with-inactive-plan" ? [WRONG_ACCOUNT_HINT] : [];
3143
3658
  const next = keyCheck.kind === "locked" ? [...report.next, describeLockedKeyAccount(trimmedKey, pairedHandle), ...inactivePlanHint] : [...report.next, "Finish activation: pushary setup (reuses the saved key)."];
3144
3659
  const exitCode2 = failures.length > 0 || controlLifecycleFailure ? EXIT.PROBLEMS_FOUND : report.exitCode;
3145
- printManualSteps();
3660
+ printManualStepsNotYetShown();
3146
3661
  console.log(` ${yellow(bold(keyCheck.kind === "locked" ? "Agents configured, approvals inactive." : "Configuration saved, activation unverified."))}`);
3147
3662
  if (failures.length > 0) {
3148
3663
  console.log();
@@ -3185,7 +3700,7 @@ var main = async () => {
3185
3700
  });
3186
3701
  process.exit(exitCode2);
3187
3702
  }
3188
- printManualSteps();
3703
+ printManualStepsNotYetShown();
3189
3704
  const configuredNothing = agents.length > 0 && completed.length === 0;
3190
3705
  const agentsOk = failures.length === 0 && !configuredNothing;
3191
3706
  const reachChecked = phone !== null;
@@ -3312,7 +3827,8 @@ var main = async () => {
3312
3827
  roundTripAnswer: roundTripAnswerOf(roundTrip),
3313
3828
  appPlatforms: phone?.appPlatforms,
3314
3829
  codexApprovals,
3315
- phoneAwaitsNotifications: phone !== null && phoneAwaitsNotificationPermission(phone)
3830
+ phoneAwaitsNotifications: phone !== null && phoneAwaitsNotificationPermission(phone),
3831
+ phoneSkippedAtTheTerminal
3316
3832
  });
3317
3833
  console.log(` ${closing.ok ? green(bold(closing.headline)) : yellow(bold(closing.headline))}`);
3318
3834
  if (failures.length > 0) {
@@ -3326,7 +3842,7 @@ var main = async () => {
3326
3842
  for (const line of closing.next) console.log(` ${line}`);
3327
3843
  console.log();
3328
3844
  console.log(` ${dim("Useful:")}`);
3329
- for (const line of renderCommandSurface(keyScope)) console.log(` ${dim(line)}`);
3845
+ for (const line of renderCommandSurface()) console.log(` ${dim(line)}`);
3330
3846
  const teamOffer = teamOfferLines(closing.ok, keyCheck?.kind === "ok" ? keyCheck.identity.plan : null);
3331
3847
  if (teamOffer.length > 0) console.log();
3332
3848
  for (const line of teamOffer) console.log(` ${line}`);
@@ -3376,7 +3892,7 @@ var main = async () => {
3376
3892
  exitCode
3377
3893
  });
3378
3894
  if (exitCode !== EXIT.OK) {
3379
- if (configuredNothing && failures.length === 0) {
3895
+ if (configuredNothing && failures.length === 0 && leftUnchanged.length === 0) {
3380
3896
  console.log(` ${yellow("!")} Nothing was configured: none of the agents you asked for are installed here.`);
3381
3897
  console.log(` ${dim("Your key is saved. Install one and re-run, or pass --agents none to accept this.")}`);
3382
3898
  console.log();