@pushary/agent-hooks 1.9.42 → 1.9.44

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 (111) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +1 -0
  3. package/data/SKILL.md +7 -1
  4. package/data/cowork/SKILL.md +3 -1
  5. package/data/cursor-plugin/.cursor-plugin/plugin.json +1 -1
  6. package/data/cursor-plugin/skills/pushary/SKILL.md +6 -0
  7. package/data/vscode-plugin/skills/pushary/SKILL.md +6 -0
  8. package/dist/bin/pushary-bell-hook.js +27 -26
  9. package/dist/bin/pushary-bell.js +11 -11
  10. package/dist/bin/pushary-claude.js +30 -28
  11. package/dist/bin/pushary-clean.js +39 -38
  12. package/dist/bin/pushary-codex-bridge.js +38 -28
  13. package/dist/bin/pushary-codex-hook.js +35 -33
  14. package/dist/bin/pushary-codex-session.d.ts +1 -0
  15. package/dist/bin/pushary-codex-session.js +253 -0
  16. package/dist/bin/pushary-codex.js +13 -12
  17. package/dist/bin/pushary-connect.js +28 -27
  18. package/dist/bin/pushary-cowork.js +6 -6
  19. package/dist/bin/pushary-daemon.js +48 -47
  20. package/dist/bin/pushary-disconnect.js +27 -26
  21. package/dist/bin/pushary-doctor.js +85 -82
  22. package/dist/bin/pushary-elicitation-hook.js +27 -26
  23. package/dist/bin/pushary-gemini-bridge.js +22 -22
  24. package/dist/bin/pushary-gemini-hook.js +32 -30
  25. package/dist/bin/pushary-hook.js +33 -32
  26. package/dist/bin/pushary-login.js +16 -16
  27. package/dist/bin/pushary-logout.js +28 -27
  28. package/dist/bin/pushary-mcp.js +9 -9
  29. package/dist/bin/pushary-mode.js +14 -14
  30. package/dist/bin/pushary-notification-hook.js +26 -25
  31. package/dist/bin/pushary-opencode-hook.js +31 -29
  32. package/dist/bin/pushary-permission-denied-hook.js +31 -30
  33. package/dist/bin/pushary-permission-hook.js +30 -29
  34. package/dist/bin/pushary-post-hook.js +26 -25
  35. package/dist/bin/pushary-prompt-hook.js +26 -25
  36. package/dist/bin/pushary-session-end-hook.js +26 -25
  37. package/dist/bin/pushary-session-start-hook.js +31 -30
  38. package/dist/bin/pushary-setup.js +165 -112
  39. package/dist/bin/pushary-stats.js +5 -5
  40. package/dist/bin/pushary-status.js +35 -34
  41. package/dist/bin/pushary-stop-hook.js +26 -25
  42. package/dist/bin/pushary-stopfailure-hook.js +26 -25
  43. package/dist/bin/pushary-suggestions.js +14 -14
  44. package/dist/bin/pushary-transcript-register.js +18 -18
  45. package/dist/bin/pushary-transcripts.js +7 -7
  46. package/dist/bin/pushary-upgrade.js +41 -40
  47. package/dist/bin/pushary-wait.js +14 -14
  48. package/dist/bin/pushary.js +7 -6
  49. package/dist/{chunk-ZX3PFROQ.js → chunk-2NVXFWQY.js} +1 -1
  50. package/dist/{chunk-7L6YSHZO.js → chunk-3IRC3XFG.js} +2 -2
  51. package/dist/{chunk-IXNVIWNN.js → chunk-42CVAOC5.js} +2 -2
  52. package/dist/{chunk-EBZK2SJ2.js → chunk-4JHEZ2PV.js} +12 -5
  53. package/dist/{chunk-JBK47Y2M.js → chunk-4WBAHVBK.js} +11 -11
  54. package/dist/{chunk-AW4TDBUJ.js → chunk-53UZN7JW.js} +3 -3
  55. package/dist/{chunk-I7EZMNKI.js → chunk-5ZSBQHCM.js} +12 -173
  56. package/dist/{chunk-KYFWYPHN.js → chunk-6EV3B5CD.js} +1 -1
  57. package/dist/{chunk-X7TNLYNZ.js → chunk-75M7NFFC.js} +1 -1
  58. package/dist/{chunk-AUDM6HU6.js → chunk-7UM4NCUI.js} +2 -2
  59. package/dist/{chunk-5INZFKHL.js → chunk-ALY7ZBNB.js} +1 -1
  60. package/dist/{chunk-CGRVIUKE.js → chunk-BKK3JCTD.js} +80 -164
  61. package/dist/{chunk-K2SSNAUW.js → chunk-CAJCCQ7N.js} +1 -1
  62. package/dist/{chunk-B7PZBWBU.js → chunk-CESLE4UN.js} +10 -10
  63. package/dist/{chunk-MI67QQEQ.js → chunk-CEZTYTBN.js} +13 -11
  64. package/dist/{chunk-6PABNQVH.js → chunk-DD6IBKEJ.js} +4 -4
  65. package/dist/{chunk-Z4RM54LU.js → chunk-E76QCZIA.js} +2 -2
  66. package/dist/{chunk-RBUCXUT7.js → chunk-FI2F5KZJ.js} +4 -4
  67. package/dist/{chunk-IVUP2EE4.js → chunk-FKDZU6YX.js} +4 -4
  68. package/dist/{chunk-EA5NWDK7.js → chunk-FYNMFSIZ.js} +29 -0
  69. package/dist/{chunk-M2YE3OEC.js → chunk-GBCR2FH2.js} +3 -3
  70. package/dist/chunk-GOEIW2VH.js +266 -0
  71. package/dist/{chunk-JQX2L3ES.js → chunk-GRAPJKDK.js} +1 -1
  72. package/dist/{chunk-DPISXMLL.js → chunk-HV4TEKNP.js} +4 -4
  73. package/dist/{chunk-FMYXPJYS.js → chunk-IWHDNMM3.js} +5 -5
  74. package/dist/{chunk-ORLTWJ2O.js → chunk-JNU3LV47.js} +355 -138
  75. package/dist/{chunk-ZJY4KON3.js → chunk-KILK6SWZ.js} +7 -7
  76. package/dist/{chunk-J7OBJZ5S.js → chunk-KYLY6UMN.js} +1 -1
  77. package/dist/{chunk-T3Q4B6WV.js → chunk-L2ZM7LXN.js} +2 -2
  78. package/dist/{chunk-PJ3C6IID.js → chunk-LEHBWBCG.js} +4 -4
  79. package/dist/{chunk-ODPULZZG.js → chunk-M2L7625S.js} +2 -2
  80. package/dist/{chunk-BDSIE2MT.js → chunk-MIBCRQWK.js} +2 -2
  81. package/dist/{chunk-MAB6CGL5.js → chunk-MRQJCIFO.js} +1 -1
  82. package/dist/{chunk-F43LAKAK.js → chunk-OR6KJOHE.js} +2 -2
  83. package/dist/{chunk-Y3HTWB5S.js → chunk-OSMNLNPF.js} +1 -1
  84. package/dist/{chunk-CHD6IUNM.js → chunk-OWQOMGBF.js} +1 -1
  85. package/dist/{chunk-RTM5GVRZ.js → chunk-OZ7MLVDM.js} +15 -15
  86. package/dist/{chunk-4WM7IVVQ.js → chunk-PGHN5D4N.js} +2 -2
  87. package/dist/{chunk-OLLWYLQX.js → chunk-PQAFH4DF.js} +3 -11
  88. package/dist/{chunk-E47JEBUR.js → chunk-RGBTKOCC.js} +45 -8
  89. package/dist/{chunk-4UCTKLHY.js → chunk-S2ALW446.js} +3 -3
  90. package/dist/{chunk-3U3FU6ZX.js → chunk-SI2NC6UU.js} +3 -3
  91. package/dist/chunk-SVCT5D7K.js +196 -0
  92. package/dist/{chunk-ZVMFRUBD.js → chunk-SWDPCDLT.js} +4 -4
  93. package/dist/{chunk-DIJ532S7.js → chunk-T3KMJI4W.js} +2 -1
  94. package/dist/{chunk-NRSTNZYJ.js → chunk-T4CKP47U.js} +5 -5
  95. package/dist/{chunk-M7VKFAAK.js → chunk-TJZUQRMH.js} +3 -3
  96. package/dist/{chunk-ZV56INA6.js → chunk-TKTS3SIM.js} +3 -3
  97. package/dist/{chunk-RETRVO47.js → chunk-TWATOPHK.js} +2 -2
  98. package/dist/{chunk-WZNRDDC4.js → chunk-UC4PNLMK.js} +6 -6
  99. package/dist/{chunk-ASXBYX2N.js → chunk-UJXLVH66.js} +1 -1
  100. package/dist/{chunk-Q3QRD67J.js → chunk-UY5E2UUW.js} +5 -5
  101. package/dist/{chunk-FP2ZJK3T.js → chunk-UZVF6MP2.js} +5 -5
  102. package/dist/{chunk-STETTN4K.js → chunk-W2TA4EVZ.js} +5 -5
  103. package/dist/{chunk-QRNNIDGY.js → chunk-WBD7HZEZ.js} +1 -1
  104. package/dist/{chunk-QPT4PTUG.js → chunk-WMO2XVG4.js} +1 -1
  105. package/dist/{chunk-BZIXDIIT.js → chunk-XPQDBTW4.js} +1 -1
  106. package/dist/{global-upgrade-YEAGJG4G.js → global-upgrade-QSSDYZCZ.js} +6 -6
  107. package/dist/{paths-HQAICWAF.js → paths-55DDFLY4.js} +2 -2
  108. package/dist/{reapply-XBEB2B5A.js → reapply-MEU66ALO.js} +23 -22
  109. package/dist/src/index.js +20 -19
  110. package/dist/{upgrade-lock-GIO5QZ7E.js → upgrade-lock-YLXAU4AD.js} +3 -3
  111. package/package.json +5 -2
@@ -1,36 +1,56 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runBrowserLogin
4
- } from "../chunk-5INZFKHL.js";
4
+ } from "../chunk-ALY7ZBNB.js";
5
5
  import {
6
6
  coworkOutput,
7
7
  coworkSelection
8
- } from "../chunk-M2YE3OEC.js";
8
+ } from "../chunk-GBCR2FH2.js";
9
9
  import "../chunk-PUZZELE6.js";
10
10
  import {
11
11
  clearDeclinedAgent,
12
12
  declinedAgentForSetupChoice
13
- } from "../chunk-AUDM6HU6.js";
13
+ } from "../chunk-7UM4NCUI.js";
14
14
  import {
15
15
  CURSOR_GATE_SCRIPT,
16
16
  describeVersionManagerPin,
17
+ saveSetupFailure,
17
18
  versionManagerOf
18
- } from "../chunk-EA5NWDK7.js";
19
+ } from "../chunk-FYNMFSIZ.js";
19
20
  import {
20
21
  codexTrustOutcome,
21
22
  describeCodexTrustConfirmation,
22
23
  needsCodexTrustStep
23
- } from "../chunk-BDSIE2MT.js";
24
+ } from "../chunk-MIBCRQWK.js";
25
+ import {
26
+ describeWaitLadder
27
+ } from "../chunk-CVWG2N3Y.js";
24
28
  import {
25
29
  writeStdoutFully
26
30
  } from "../chunk-EO23EUOK.js";
27
31
  import {
28
- ensureCodexTrustsPusharyHooks
29
- } from "../chunk-Z4RM54LU.js";
32
+ BROWSER_CONNECT_COMMAND,
33
+ confirmAppConnection,
34
+ connectDevice,
35
+ connectViaAppPairing,
36
+ describeRoundTripOutcome,
37
+ pairingEscapeApplies,
38
+ printConnectInstructions,
39
+ roundTripEvidence,
40
+ verifyRoundTrip,
41
+ waitForYourPhone
42
+ } from "../chunk-KILK6SWZ.js";
43
+ import "../chunk-3EGEA4KH.js";
30
44
  import {
31
45
  readManagedControlEvidence,
32
46
  waitForMachineReadiness
33
- } from "../chunk-JBK47Y2M.js";
47
+ } from "../chunk-4WBAHVBK.js";
48
+ import {
49
+ ensureCodexTrustsPusharyHooks
50
+ } from "../chunk-E76QCZIA.js";
51
+ import {
52
+ setHumanStream
53
+ } from "../chunk-QCGNGEGE.js";
34
54
  import {
35
55
  describeSetupSideEffects,
36
56
  installAgentSkill,
@@ -44,7 +64,7 @@ import {
44
64
  soleGateFile,
45
65
  soleGateReceipt,
46
66
  soleGateReceiptFile
47
- } from "../chunk-RBUCXUT7.js";
67
+ } from "../chunk-FI2F5KZJ.js";
48
68
  import {
49
69
  HERMES_PIP_PACKAGE,
50
70
  describeDetection,
@@ -57,7 +77,11 @@ import {
57
77
  runHermesConfigScript,
58
78
  shortenHome,
59
79
  vscodeSettingsTargets
60
- } from "../chunk-DPISXMLL.js";
80
+ } from "../chunk-HV4TEKNP.js";
81
+ import {
82
+ mcpServerBearer,
83
+ readMacAppAgentKey
84
+ } from "../chunk-LEHBWBCG.js";
61
85
  import {
62
86
  AgentConfigError,
63
87
  FX_PUSHARY_TOOLS_RULE,
@@ -82,64 +106,13 @@ import {
82
106
  retryAgentCommand,
83
107
  withFxPusharyServer,
84
108
  writeFxProfile,
85
- writeInstructionBlock
86
- } from "../chunk-E47JEBUR.js";
109
+ writeInstructionBlock,
110
+ writeSetupConfigFile,
111
+ writeSetupConfigJson
112
+ } from "../chunk-RGBTKOCC.js";
87
113
  import {
88
114
  MCP_BRIDGE_BINARY
89
- } from "../chunk-RETRVO47.js";
90
- import {
91
- checkCodexInstall,
92
- detectProviderLiveCapabilities,
93
- expectedLaunchCapabilities,
94
- hasSpawnProvider,
95
- nodeCodexInstallProbe,
96
- resolveControlPolicy
97
- } from "../chunk-T3Q4B6WV.js";
98
- import {
99
- detectClaudeVersion
100
- } from "../chunk-RIVNNBEK.js";
101
- import {
102
- describeAutoUpdateAnnouncement,
103
- takeAutoUpdateAnnouncement
104
- } from "../chunk-7L6YSHZO.js";
105
- import {
106
- DAEMON_COLD_START_TIMEOUT_MS,
107
- clearDaemonNeedsLogin,
108
- daemonHasRemoteProof,
109
- daemonServiceDefinitionPath,
110
- daemonServiceManagerAvailable,
111
- disableDaemonService,
112
- ensureDaemonRunning,
113
- hasDaemonServiceDefinition,
114
- readDaemonStatus,
115
- replaceDaemonService,
116
- stopDaemonService,
117
- waitForDaemonRemoteProof
118
- } from "../chunk-STETTN4K.js";
119
- import {
120
- transcriptPreferenceForSetup
121
- } from "../chunk-QRNNIDGY.js";
122
- import "../chunk-XHKBHWLX.js";
123
- import {
124
- BROWSER_CONNECT_COMMAND,
125
- confirmAppConnection,
126
- connectDevice,
127
- connectViaAppPairing,
128
- describeRoundTripOutcome,
129
- pairingEscapeApplies,
130
- printConnectInstructions,
131
- roundTripEvidence,
132
- verifyRoundTrip,
133
- waitForYourPhone
134
- } from "../chunk-ZJY4KON3.js";
135
- import "../chunk-3EGEA4KH.js";
136
- import {
137
- setHumanStream
138
- } from "../chunk-QCGNGEGE.js";
139
- import {
140
- mcpServerBearer,
141
- readMacAppAgentKey
142
- } from "../chunk-PJ3C6IID.js";
115
+ } from "../chunk-TWATOPHK.js";
143
116
  import {
144
117
  OPENCODE_HOOK_BINARY,
145
118
  addOpenCodeMcpServer,
@@ -155,12 +128,16 @@ import {
155
128
  openCodePluginDir,
156
129
  openCodePluginFile,
157
130
  openCodeWired
158
- } from "../chunk-FP2ZJK3T.js";
131
+ } from "../chunk-UZVF6MP2.js";
159
132
  import {
160
133
  ansiPainter,
161
134
  createIo,
162
135
  useColor
163
136
  } from "../chunk-FO3MDD26.js";
137
+ import {
138
+ describeAutoUpdateAnnouncement,
139
+ takeAutoUpdateAnnouncement
140
+ } from "../chunk-3IRC3XFG.js";
164
141
  import {
165
142
  addClaudeMcpServer,
166
143
  addCompatibleHooks,
@@ -179,7 +156,21 @@ import {
179
156
  hasCompatibleHooks,
180
157
  isClaudeMcpSnapshot,
181
158
  updateClaudeMcpSnapshot
182
- } from "../chunk-IVUP2EE4.js";
159
+ } from "../chunk-FKDZU6YX.js";
160
+ import {
161
+ DAEMON_COLD_START_TIMEOUT_MS,
162
+ clearDaemonNeedsLogin,
163
+ daemonHasRemoteProof,
164
+ daemonServiceDefinitionPath,
165
+ daemonServiceManagerAvailable,
166
+ disableDaemonService,
167
+ ensureDaemonRunning,
168
+ hasDaemonServiceDefinition,
169
+ readDaemonStatus,
170
+ replaceDaemonService,
171
+ stopDaemonService,
172
+ waitForDaemonRemoteProof
173
+ } from "../chunk-W2TA4EVZ.js";
183
174
  import {
184
175
  KEEP_HINT,
185
176
  captureHookTakeover,
@@ -191,25 +182,25 @@ import {
191
182
  geminiWired,
192
183
  planHooks,
193
184
  pusharyHookExecutable
194
- } from "../chunk-NRSTNZYJ.js";
185
+ } from "../chunk-T4CKP47U.js";
195
186
  import {
196
187
  GEMINI_HOOK_BINARY,
197
188
  GEMINI_HOOK_EVENTS,
198
189
  addGeminiHooks,
199
190
  addGeminiMcpServer
200
- } from "../chunk-3U3FU6ZX.js";
191
+ } from "../chunk-SI2NC6UU.js";
201
192
  import {
202
193
  AGENT_CHOICES,
203
194
  effectiveControlMode,
204
195
  effectiveVerify,
205
196
  parseSetupOptions
206
- } from "../chunk-KYFWYPHN.js";
207
- import "../chunk-Y3HTWB5S.js";
197
+ } from "../chunk-6EV3B5CD.js";
198
+ import "../chunk-OSMNLNPF.js";
208
199
  import "../chunk-GMXKITVA.js";
209
200
  import {
210
- compareVersion,
211
- parseVersion
212
- } from "../chunk-6ICPEJY5.js";
201
+ transcriptPreferenceForSetup
202
+ } from "../chunk-WBD7HZEZ.js";
203
+ import "../chunk-XHKBHWLX.js";
213
204
  import {
214
205
  KEY_FILE_MODE,
215
206
  exportLine,
@@ -222,28 +213,44 @@ import {
222
213
  recordMacAppKeyPrefix,
223
214
  resolveShellRc,
224
215
  writeKey
225
- } from "../chunk-M7VKFAAK.js";
216
+ } from "../chunk-TJZUQRMH.js";
217
+ import {
218
+ checkCodexInstall,
219
+ detectProviderLiveCapabilities,
220
+ expectedLaunchCapabilities,
221
+ hasSpawnProvider,
222
+ nodeCodexInstallProbe,
223
+ resolveControlPolicy
224
+ } from "../chunk-L2ZM7LXN.js";
225
+ import {
226
+ detectClaudeVersion
227
+ } from "../chunk-RIVNNBEK.js";
228
+ import {
229
+ compareVersion,
230
+ parseVersion
231
+ } from "../chunk-6ICPEJY5.js";
226
232
  import {
227
233
  reportEvent
228
- } from "../chunk-CGRVIUKE.js";
229
- import "../chunk-K2SSNAUW.js";
230
- import "../chunk-I7EZMNKI.js";
234
+ } from "../chunk-BKK3JCTD.js";
235
+ import "../chunk-CAJCCQ7N.js";
236
+ import "../chunk-5ZSBQHCM.js";
237
+ import "../chunk-M2L7625S.js";
238
+ import "../chunk-GOEIW2VH.js";
231
239
  import "../chunk-POFBE6ZY.js";
232
- import "../chunk-AW4TDBUJ.js";
240
+ import "../chunk-53UZN7JW.js";
233
241
  import {
234
242
  checkApiKey,
235
243
  describeKeyCheck,
236
244
  samePusharyAccount
237
- } from "../chunk-ZV56INA6.js";
238
- import "../chunk-4UCTKLHY.js";
239
- import "../chunk-QPT4PTUG.js";
245
+ } from "../chunk-TKTS3SIM.js";
246
+ import "../chunk-S2ALW446.js";
247
+ import "../chunk-WMO2XVG4.js";
240
248
  import {
241
249
  UsageError
242
250
  } from "../chunk-7QLSKOSU.js";
243
251
  import {
244
252
  EXIT
245
253
  } from "../chunk-KZERVKTD.js";
246
- import "../chunk-ODPULZZG.js";
247
254
  import {
248
255
  NpmMissingError,
249
256
  addCodexHookTrust,
@@ -288,18 +295,18 @@ import {
288
295
  resolveGlobalBinary,
289
296
  vscodePluginDir,
290
297
  vscodePluginMcp
291
- } from "../chunk-EBZK2SJ2.js";
298
+ } from "../chunk-4JHEZ2PV.js";
292
299
  import {
293
300
  backupFile,
294
- readJsonSafe,
295
- writeFileAtomic,
296
- writeJsonAtomic
301
+ readJsonSafe
297
302
  } from "../chunk-AQFEP65J.js";
298
- import "../chunk-CHD6IUNM.js";
303
+ import {
304
+ getBaseUrl
305
+ } from "../chunk-OWQOMGBF.js";
299
306
  import {
300
307
  NPX_LATEST_COMMAND,
301
308
  renderCommandHelp
302
- } from "../chunk-DIJ532S7.js";
309
+ } from "../chunk-T3KMJI4W.js";
303
310
  import {
304
311
  HOOK_COMPATIBLE_PROFILES,
305
312
  PRETOOLUSE_GATED_TOOLS,
@@ -307,13 +314,15 @@ import {
307
314
  computerOsOfPlatform,
308
315
  getPackageVersion,
309
316
  hookCompatibleProfile,
317
+ isApprovalMode,
310
318
  isComputerAgent,
311
319
  isNewerVersion,
312
320
  isRecord,
321
+ isTimeoutAction,
313
322
  isValidApiKey,
314
323
  launchedPackage,
315
324
  ownPackageName
316
- } from "../chunk-ORLTWJ2O.js";
325
+ } from "../chunk-JNU3LV47.js";
317
326
 
318
327
  // bin/pushary-setup.ts
319
328
  import { existsSync, readFileSync, writeFileSync, mkdirSync, cpSync, rmSync, renameSync, realpathSync, statSync, openSync, readSync, closeSync } from "fs";
@@ -622,6 +631,39 @@ var planPhoneCheck = (context) => {
622
631
  return "connect";
623
632
  };
624
633
 
634
+ // src/setup/wait-guidance.ts
635
+ var UNAVAILABLE = "Approval settings unavailable. Run pushary wait before stepping away.";
636
+ var isPolicyRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
637
+ var isWaitSeconds = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0;
638
+ var setupWaitGuidance = (value) => {
639
+ if (!isPolicyRecord(value) || !Array.isArray(value.policies)) return UNAVAILABLE;
640
+ if (value.modeOverride != null && !isApprovalMode(value.modeOverride)) return UNAVAILABLE;
641
+ const rule = value.policies.find((row) => isPolicyRecord(row) && row.tool === "*") ?? {
642
+ mode: value.defaultMode,
643
+ pushFirstSeconds: value.defaultPushFirstSeconds,
644
+ timeoutSeconds: value.defaultTimeoutSeconds,
645
+ timeoutAction: value.defaultTimeoutAction
646
+ };
647
+ if (!isPolicyRecord(rule) || !isApprovalMode(rule.mode) || !isTimeoutAction(rule.timeoutAction) || !isWaitSeconds(rule.pushFirstSeconds) || !isWaitSeconds(rule.timeoutSeconds)) return UNAVAILABLE;
648
+ const mode = value.modeOverride ?? rule.mode;
649
+ if (!isApprovalMode(mode)) return UNAVAILABLE;
650
+ let behavior = describeWaitLadder({ tool: "*", mode, pushFirstSeconds: rule.pushFirstSeconds, timeoutSeconds: rule.timeoutSeconds, timeoutAction: rule.timeoutAction });
651
+ if (rule.timeoutSeconds === 0 && rule.timeoutAction === "approve") behavior = "auto-approve";
652
+ if (rule.timeoutSeconds === 0 && rule.timeoutAction === "deny") behavior = "auto-deny";
653
+ return `Workspace default: ${behavior}. Agent, repository and tool rules can differ. Run pushary wait to inspect the rules.`;
654
+ };
655
+ var fetchSetupWaitGuidance = async (apiKey) => {
656
+ try {
657
+ const response = await fetch(`${getBaseUrl()}/api/mcp/policy`, {
658
+ headers: { Authorization: `Bearer ${apiKey}` },
659
+ signal: AbortSignal.timeout(5e3)
660
+ });
661
+ return response.ok ? setupWaitGuidance(await response.json()) : UNAVAILABLE;
662
+ } catch {
663
+ return UNAVAILABLE;
664
+ }
665
+ };
666
+
625
667
  // src/setup/closing.ts
626
668
  var ACTIVITY_URL = "pushary.com/dashboard/agent/activity";
627
669
  var TRANSCRIPT_SYNC_NOTICE = `Transcripts sync redacted and encrypted. Your phone can decrypt them; authorized Pushary compliance admins can recover them for documented legal obligations. Turn off: ${NPX_LATEST_COMMAND} setup --transcripts off`;
@@ -653,6 +695,7 @@ var SURFACE_COLUMN = Math.max(...COMMAND_SURFACE.map((entry) => entry.command.le
653
695
  var renderCommandSurface = () => COMMAND_SURFACE.map((entry) => `${entry.command.padEnd(SURFACE_COLUMN)}${entry.summary}`);
654
696
  var nextSteps = (facts, reachable) => {
655
697
  const lines = ["Delivery follows the current approval mode, recipient rules and presence. pushary mode status shows the workspace setting.", facts.managedControlReady === true ? "Phone-start and steering: local and server checks passed just now. Recheck after sleep or network changes." : "Phone-start and steering: unverified. Run pushary doctor to check the provider, background service and server route."];
698
+ lines.push("Before stepping away, run pushary wait to see how long phone approvals wait and what happens if you do not answer.");
656
699
  if (facts.staleEnvironmentKey) {
657
700
  lines.push("Open a new terminal or unset PUSHARY_API_KEY, then run pushary doctor before starting an agent.");
658
701
  }
@@ -689,6 +732,7 @@ var describeClosing = (facts) => {
689
732
  headline: `Setup finished with ${count} problem${count === 1 ? "" : "s"}.`,
690
733
  next: [
691
734
  ...nextSteps(facts, reachable),
735
+ "For support: pushary doctor --bundle creates a redacted diagnostic with the last setup failure. Review it before sharing.",
692
736
  "",
693
737
  `Approvals: ${ACTIVITY_URL}`
694
738
  ],
@@ -732,6 +776,7 @@ var describeClosing = (facts) => {
732
776
  ok: false,
733
777
  headline: "Agents configured. Phone delivery is unverified.",
734
778
  next: [
779
+ "Your agent configuration is saved. Once your phone is connected, run pushary doctor --roundtrip to finish verification without reinstalling.",
735
780
  "Approval routing depends on your mode, presence and recipients. Check the phone and its notification settings.",
736
781
  "",
737
782
  ...nextSteps(facts, false)
@@ -911,7 +956,16 @@ var recordCodexTrust = (outcome) => {
911
956
  var emitted = false;
912
957
  var SETUP_COMPLETED_EVENT = "agent_setup_completed";
913
958
  var SETUP_AGENT_TYPE = "setup";
914
- var defaultDeps = { report: reportEvent };
959
+ var defaultDeps = {
960
+ report: async (event, options) => {
961
+ try {
962
+ saveSetupFailure({ ...event });
963
+ } catch {
964
+ process.stderr.write("[pushary] Could not save the local setup diagnostic. Keep the setup output for support.\n");
965
+ }
966
+ return reportEvent(event, options);
967
+ }
968
+ };
915
969
  var completeBeacon = (run) => ({
916
970
  ...run,
917
971
  codexTrust: recordedCodexTrust,
@@ -1090,9 +1144,7 @@ var readAgentJson = (filePath) => {
1090
1144
  );
1091
1145
  };
1092
1146
  var writeJson = (filePath, data) => {
1093
- const dir = dirname2(filePath);
1094
- if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
1095
- writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n", "utf-8");
1147
+ writeSetupConfigJson(filePath, data);
1096
1148
  };
1097
1149
  var readAgentToml = (filePath) => {
1098
1150
  let raw;
@@ -1202,7 +1254,7 @@ var setupClaudeCode = async (apiKey) => {
1202
1254
  }
1203
1255
  mcpSnapshot = updateClaudeMcpSnapshot(mcpReceipt.value, apiKey);
1204
1256
  }
1205
- writeJsonAtomic(CLAUDE_MCP_RECEIPT, mcpSnapshot, 384);
1257
+ writeSetupConfigJson(CLAUDE_MCP_RECEIPT, mcpSnapshot, 384);
1206
1258
  await spinner("Adding MCP server (type: http)", async () => {
1207
1259
  addClaudeMcpServer(claudeJson2, apiKey);
1208
1260
  });
@@ -1213,10 +1265,10 @@ var setupClaudeCode = async (apiKey) => {
1213
1265
  addPusharyHooks(settings, resolveGlobalBinDir("pushary-hook"), detectClaudeVersion());
1214
1266
  });
1215
1267
  await spinner(`Writing ${CLAUDE_JSON}`, async () => {
1216
- writeJsonAtomic(CLAUDE_JSON, claudeJson2, 384);
1268
+ writeSetupConfigJson(CLAUDE_JSON, claudeJson2, 384);
1217
1269
  });
1218
1270
  await spinner(`Writing ${CLAUDE_SETTINGS}`, async () => {
1219
- writeJsonAtomic(CLAUDE_SETTINGS, settings);
1271
+ writeSetupConfigJson(CLAUDE_SETTINGS, settings);
1220
1272
  });
1221
1273
  await installSkill("claude-code", CLAUDE_SKILL_DIR);
1222
1274
  console.log();
@@ -1388,7 +1440,7 @@ var removeCodexNotifyEntry = (codexConfig) => {
1388
1440
  } else {
1389
1441
  config.notify = filtered;
1390
1442
  }
1391
- writeFileSync(codexConfig, stringifyTOML(config), "utf-8");
1443
+ writeSetupConfigFile(codexConfig, stringifyTOML(config), KEY_FILE_MODE);
1392
1444
  };
1393
1445
  var addCodexNotifyEntry = (codexConfig) => {
1394
1446
  const pusharyCodexPath = resolveGlobalBinary("pushary-codex") ?? "pushary-codex";
@@ -1402,7 +1454,7 @@ var addCodexNotifyEntry = (codexConfig) => {
1402
1454
  if (!notify.some((n) => typeof n === "string" && n.includes("pushary-codex"))) {
1403
1455
  notify.push(pusharyCodexPath);
1404
1456
  config.notify = notify;
1405
- writeFileSync(codexConfig, stringifyTOML(config), "utf-8");
1457
+ writeSetupConfigFile(codexConfig, stringifyTOML(config), KEY_FILE_MODE);
1406
1458
  }
1407
1459
  };
1408
1460
  var confirmCodexTrust = async () => {
@@ -1443,7 +1495,7 @@ var setupCodex = async (apiKey) => {
1443
1495
  await spinner("Adding Pushary MCP server (key embedded, auto-allowed)", async () => {
1444
1496
  const config = readAgentToml(codexConfig);
1445
1497
  addCodexMcpServer(config, apiKey);
1446
- writeFileAtomic(codexConfig, stringifyTOML(config), KEY_FILE_MODE);
1498
+ writeSetupConfigFile(codexConfig, stringifyTOML(config), KEY_FILE_MODE);
1447
1499
  });
1448
1500
  const codexVersion = detectCodexVersion();
1449
1501
  const hooksSupported = codexSupportsHooks(codexVersion);
@@ -1468,7 +1520,7 @@ var setupCodex = async (apiKey) => {
1468
1520
  const config = raw ? parseTOML(raw) : {};
1469
1521
  dropVacatedCodexHookTrust(config, CODEX_HOOKS_JSON, vacated);
1470
1522
  addCodexHookTrust(config, CODEX_HOOKS_JSON, hookCommand, hookPositions);
1471
- writeFileSync(codexConfig, stringifyTOML(config), "utf-8");
1523
+ writeSetupConfigFile(codexConfig, stringifyTOML(config), KEY_FILE_MODE);
1472
1524
  portedTrustWritten = true;
1473
1525
  }, { optional: true });
1474
1526
  await spinner("Removing legacy notify handler", async () => {
@@ -1632,7 +1684,7 @@ var setupCursor = async (apiKey) => {
1632
1684
  if (servers.pushary) {
1633
1685
  servers.pushary.headers = { ...servers.pushary.headers, Authorization: `Bearer ${apiKey}` };
1634
1686
  mcp.mcpServers = servers;
1635
- writeJsonAtomic(mcpPath, mcp, KEY_FILE_MODE);
1687
+ writeSetupConfigJson(mcpPath, mcp, KEY_FILE_MODE);
1636
1688
  }
1637
1689
  });
1638
1690
  await spinner("Registering permission gate (~/.cursor/hooks.json)", async () => {
@@ -1676,7 +1728,7 @@ var registerVsCodePlugin = (pluginDir) => {
1676
1728
  }
1677
1729
  if (current !== null) backupFile(settingsPath);
1678
1730
  mkdirSync(dirname2(settingsPath), { recursive: true });
1679
- writeFileAtomic(settingsPath, result.content);
1731
+ writeSetupConfigFile(settingsPath, result.content);
1680
1732
  written.push(settingsPath);
1681
1733
  }
1682
1734
  return { written, manual };
@@ -1721,7 +1773,7 @@ var setupVsCode = async (apiKey) => {
1721
1773
  if (servers.pushary) {
1722
1774
  servers.pushary.headers = { ...servers.pushary.headers, Authorization: `Bearer ${apiKey}` };
1723
1775
  mcp.mcpServers = servers;
1724
- writeJsonAtomic(mcpPath, mcp, KEY_FILE_MODE);
1776
+ writeSetupConfigJson(mcpPath, mcp, KEY_FILE_MODE);
1725
1777
  }
1726
1778
  pinGuardedVsCodeGate(VSCODE_PLUGIN_DIR);
1727
1779
  });
@@ -1921,7 +1973,7 @@ var setupGemini = async (apiKey) => {
1921
1973
  addGeminiHooks(settings, guardBinary(resolveGlobalBinary(GEMINI_HOOK_BINARY) ?? GEMINI_HOOK_BINARY));
1922
1974
  });
1923
1975
  await spinner(`Writing ${GEMINI_SETTINGS}`, async () => {
1924
- writeJsonAtomic(GEMINI_SETTINGS, settings, KEY_FILE_MODE);
1976
+ writeSetupConfigJson(GEMINI_SETTINGS, settings, KEY_FILE_MODE);
1925
1977
  });
1926
1978
  await spinner("Teaching Gemini to ask via push (~/.gemini/GEMINI.md)", async () => {
1927
1979
  writeInstructionBlock(GEMINI_MD, renderAgentInstructions("Gemini"));
@@ -1953,7 +2005,7 @@ var setupOpenCode = async (apiKey) => {
1953
2005
  await spinner(`Adding MCP server (${openCodeConfigFile()})`, async () => {
1954
2006
  const config = readAgentJson(openCodeConfigFile());
1955
2007
  addOpenCodeMcpServer(config, apiKey);
1956
- writeJsonAtomic(openCodeConfigFile(), config, KEY_FILE_MODE);
2008
+ writeSetupConfigJson(openCodeConfigFile(), config, KEY_FILE_MODE);
1957
2009
  });
1958
2010
  await spinner("Teaching OpenCode to ask via push", async () => {
1959
2011
  writeInstructionBlock(OPENCODE_INSTRUCTIONS(), renderAgentInstructions("OpenCode"));
@@ -2027,7 +2079,7 @@ var captureTakeoverReceipt = (agent) => {
2027
2079
  } : {},
2028
2080
  ...mcp ? { mcpServer: captureMcpServer(mcp[0], mcp[1]) } : {}
2029
2081
  };
2030
- writeJsonAtomic(hookTakeoverReceipt(agent), receipt, 384);
2082
+ writeSetupConfigJson(hookTakeoverReceipt(agent), receipt, 384);
2031
2083
  };
2032
2084
  var agentIsWired = (agent) => {
2033
2085
  const readJson2 = (path) => {
@@ -2149,8 +2201,8 @@ var setupCompatibleAgent = (profile) => async (apiKey) => {
2149
2201
  }
2150
2202
  for (const [path, document] of documents) {
2151
2203
  await spinner(`Writing ${shortenHome(path)}`, async () => {
2152
- if (document.format === "toml") writeFileAtomic(path, stringifyTOML(document.value), KEY_FILE_MODE);
2153
- else writeJsonAtomic(path, document.value, KEY_FILE_MODE);
2204
+ if (document.format === "toml") writeSetupConfigFile(path, stringifyTOML(document.value), KEY_FILE_MODE);
2205
+ else writeSetupConfigJson(path, document.value, KEY_FILE_MODE);
2154
2206
  });
2155
2207
  }
2156
2208
  if (instructionsFile && profile.instructions) {
@@ -2164,8 +2216,8 @@ var setupCompatibleAgent = (profile) => async (apiKey) => {
2164
2216
  const soleGateClaim = gate && settings ? claimSoleGate(settings, gate) : null;
2165
2217
  if (gate && settingsPath && settings && soleGateClaim?.kind === "claimed") {
2166
2218
  await spinner(`Making Pushary the only gate (${shortenHome(settingsPath)})`, async () => {
2167
- writeJsonAtomic(soleGateReceiptFile(gate), soleGateReceipt(gate), KEY_FILE_MODE);
2168
- writeJsonAtomic(settingsPath, settings);
2219
+ writeSetupConfigJson(soleGateReceiptFile(gate), soleGateReceipt(gate), KEY_FILE_MODE);
2220
+ writeSetupConfigJson(settingsPath, settings);
2169
2221
  });
2170
2222
  }
2171
2223
  console.log();
@@ -2780,6 +2832,7 @@ var main = async () => {
2780
2832
  }
2781
2833
  }
2782
2834
  markStep("connect-phone");
2835
+ if (keyCheck.kind === "ok") console.log(` ${dim(await fetchSetupWaitGuidance(trimmedKey))}`);
2783
2836
  const skipPhone = options.skipPhone;
2784
2837
  let phone = null;
2785
2838
  const verifyMode = effectiveVerify(options, { paired: keyFromPairing });
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  readLedgerSummary
4
- } from "../chunk-JQX2L3ES.js";
4
+ } from "../chunk-GRAPJKDK.js";
5
5
  import {
6
6
  exitOnHelpFlag
7
- } from "../chunk-F43LAKAK.js";
7
+ } from "../chunk-OR6KJOHE.js";
8
8
  import "../chunk-KZERVKTD.js";
9
9
  import {
10
10
  getApiKey
11
- } from "../chunk-CHD6IUNM.js";
12
- import "../chunk-DIJ532S7.js";
13
- import "../chunk-ORLTWJ2O.js";
11
+ } from "../chunk-OWQOMGBF.js";
12
+ import "../chunk-T3KMJI4W.js";
13
+ import "../chunk-JNU3LV47.js";
14
14
 
15
15
  // bin/pushary-stats.ts
16
16
  exitOnHelpFlag("stats");
@@ -1,71 +1,72 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- describeLastSeen,
4
- listMachines
5
- } from "../chunk-JBK47Y2M.js";
6
- import "../chunk-T3Q4B6WV.js";
7
- import "../chunk-RIVNNBEK.js";
8
- import "../chunk-STETTN4K.js";
9
- import "../chunk-XHKBHWLX.js";
10
2
  import {
11
3
  describeReach,
12
4
  fetchChannels,
13
5
  reachVerdict
14
- } from "../chunk-ZJY4KON3.js";
6
+ } from "../chunk-KILK6SWZ.js";
15
7
  import "../chunk-3EGEA4KH.js";
8
+ import {
9
+ describeLastSeen,
10
+ listMachines
11
+ } from "../chunk-4WBAHVBK.js";
16
12
  import "../chunk-QCGNGEGE.js";
17
13
  import {
18
14
  CONNECTED_THROUGH_MAC_APP,
19
15
  readMacAppConnectionWhenKeyless
20
- } from "../chunk-PJ3C6IID.js";
16
+ } from "../chunk-LEHBWBCG.js";
21
17
  import {
22
18
  SIGNED_OUT_ON_MAC_MESSAGE,
23
19
  activeKeyVerdictOf,
24
20
  describeSignedOutKey,
25
21
  readSignedOutDiagnosis
26
- } from "../chunk-IXNVIWNN.js";
27
- import "../chunk-FP2ZJK3T.js";
22
+ } from "../chunk-42CVAOC5.js";
23
+ import "../chunk-UZVF6MP2.js";
28
24
  import {
29
25
  createIo
30
26
  } from "../chunk-FO3MDD26.js";
31
- import {
32
- exitOnHelpFlag
33
- } from "../chunk-F43LAKAK.js";
34
- import "../chunk-IVUP2EE4.js";
35
- import "../chunk-NRSTNZYJ.js";
36
- import "../chunk-3U3FU6ZX.js";
37
- import "../chunk-KYFWYPHN.js";
38
- import "../chunk-Y3HTWB5S.js";
27
+ import "../chunk-FKDZU6YX.js";
28
+ import "../chunk-W2TA4EVZ.js";
29
+ import "../chunk-T4CKP47U.js";
30
+ import "../chunk-SI2NC6UU.js";
31
+ import "../chunk-6EV3B5CD.js";
32
+ import "../chunk-OSMNLNPF.js";
39
33
  import {
40
34
  rejectUnknownFlags
41
35
  } from "../chunk-GMXKITVA.js";
42
- import "../chunk-6ICPEJY5.js";
36
+ import "../chunk-XHKBHWLX.js";
43
37
  import {
44
38
  readKeySource
45
- } from "../chunk-M7VKFAAK.js";
46
- import "../chunk-CGRVIUKE.js";
47
- import "../chunk-K2SSNAUW.js";
48
- import "../chunk-I7EZMNKI.js";
39
+ } from "../chunk-TJZUQRMH.js";
40
+ import {
41
+ exitOnHelpFlag
42
+ } from "../chunk-OR6KJOHE.js";
43
+ import "../chunk-L2ZM7LXN.js";
44
+ import "../chunk-RIVNNBEK.js";
45
+ import "../chunk-6ICPEJY5.js";
46
+ import "../chunk-BKK3JCTD.js";
47
+ import "../chunk-CAJCCQ7N.js";
48
+ import "../chunk-5ZSBQHCM.js";
49
+ import "../chunk-M2L7625S.js";
50
+ import "../chunk-GOEIW2VH.js";
49
51
  import "../chunk-POFBE6ZY.js";
50
- import "../chunk-AW4TDBUJ.js";
52
+ import "../chunk-53UZN7JW.js";
51
53
  import {
52
54
  checkApiKey,
53
55
  describeKeyCheck
54
- } from "../chunk-ZV56INA6.js";
55
- import "../chunk-4UCTKLHY.js";
56
- import "../chunk-QPT4PTUG.js";
56
+ } from "../chunk-TKTS3SIM.js";
57
+ import "../chunk-S2ALW446.js";
58
+ import "../chunk-WMO2XVG4.js";
57
59
  import {
58
60
  UsageError
59
61
  } from "../chunk-7QLSKOSU.js";
60
62
  import {
61
63
  EXIT
62
64
  } from "../chunk-KZERVKTD.js";
63
- import "../chunk-ODPULZZG.js";
64
- import "../chunk-EBZK2SJ2.js";
65
+ import "../chunk-4JHEZ2PV.js";
65
66
  import "../chunk-AQFEP65J.js";
66
- import "../chunk-CHD6IUNM.js";
67
- import "../chunk-DIJ532S7.js";
68
- import "../chunk-ORLTWJ2O.js";
67
+ import "../chunk-OWQOMGBF.js";
68
+ import "../chunk-T3KMJI4W.js";
69
+ import "../chunk-JNU3LV47.js";
69
70
 
70
71
  // src/status.ts
71
72
  var SIGNED_OUT_LINE = { label: "Server", value: "key signed out on this Mac", ok: false };