@pushary/agent-hooks 1.9.59 → 1.9.61

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 (130) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +6 -0
  3. package/data/cursor-plugin/.cursor-plugin/plugin.json +5 -1
  4. package/data/cursor-plugin/CHANGELOG.md +4 -0
  5. package/dist/{api-UVJGNZIF.js → api-LW3PJQYY.js} +12 -11
  6. package/dist/bin/pushary-bell-hook.js +30 -29
  7. package/dist/bin/pushary-bell.js +13 -12
  8. package/dist/bin/pushary-claude.js +32 -30
  9. package/dist/bin/pushary-clean.js +61 -54
  10. package/dist/bin/pushary-codex-bridge.js +23 -22
  11. package/dist/bin/pushary-codex-hook.js +35 -34
  12. package/dist/bin/pushary-codex-session.js +9 -8
  13. package/dist/bin/pushary-codex.js +16 -15
  14. package/dist/bin/pushary-connect.js +30 -29
  15. package/dist/bin/pushary-cowork.js +8 -7
  16. package/dist/bin/pushary-daemon.js +40 -39
  17. package/dist/bin/pushary-disconnect.js +43 -29
  18. package/dist/bin/pushary-doctor.js +52 -47
  19. package/dist/bin/pushary-elicitation-hook.js +30 -29
  20. package/dist/bin/pushary-gemini-bridge.js +16 -15
  21. package/dist/bin/pushary-gemini-hook.js +32 -31
  22. package/dist/bin/pushary-hook.js +34 -33
  23. package/dist/bin/pushary-login.js +23 -19
  24. package/dist/bin/pushary-logout.js +37 -31
  25. package/dist/bin/pushary-mcp.js +13 -12
  26. package/dist/bin/pushary-mode.js +42 -55
  27. package/dist/bin/pushary-notification-hook.js +29 -28
  28. package/dist/bin/pushary-opencode-hook.js +31 -30
  29. package/dist/bin/pushary-permission-denied-hook.js +34 -33
  30. package/dist/bin/pushary-permission-hook.js +33 -32
  31. package/dist/bin/pushary-post-hook.js +29 -28
  32. package/dist/bin/pushary-prompt-hook.js +29 -28
  33. package/dist/bin/pushary-session-end-hook.js +29 -28
  34. package/dist/bin/pushary-session-start-hook.js +36 -35
  35. package/dist/bin/pushary-setup.js +4397 -292
  36. package/dist/bin/pushary-stats.js +6 -5
  37. package/dist/bin/pushary-status.js +42 -36
  38. package/dist/bin/pushary-stop-hook.js +29 -28
  39. package/dist/bin/pushary-stopfailure-hook.js +29 -28
  40. package/dist/bin/pushary-suggestions.js +34 -39
  41. package/dist/bin/pushary-transcript-register.js +21 -20
  42. package/dist/bin/pushary-transcripts.js +34 -20
  43. package/dist/bin/pushary-upgrade.js +77 -50
  44. package/dist/bin/pushary-wait.js +37 -42
  45. package/dist/bin/pushary.js +9 -8
  46. package/dist/{chunk-PVANKDWM.js → chunk-2AELPDMT.js} +1 -1
  47. package/dist/{chunk-W47WL6JY.js → chunk-33OOEVPG.js} +1 -1
  48. package/dist/{chunk-BRUHVTFB.js → chunk-4N5E4JNF.js} +2 -2
  49. package/dist/{chunk-6ONSTCDJ.js → chunk-4VRTSDGP.js} +5 -5
  50. package/dist/{chunk-DS7X36Z3.js → chunk-64S5PQBQ.js} +4 -4
  51. package/dist/{chunk-KQHY6L3X.js → chunk-6FJ6CK32.js} +4 -4
  52. package/dist/{chunk-EBQTWH5O.js → chunk-6T5Z64KS.js} +39 -31
  53. package/dist/{chunk-JAKBCKEB.js → chunk-7BAO42UV.js} +8 -7
  54. package/dist/chunk-7BHI3PZN.js +41 -0
  55. package/dist/{chunk-5BNXJTOZ.js → chunk-7HDGH3Z2.js} +3 -12
  56. package/dist/{chunk-D6CXQIXO.js → chunk-7JXJJNQ5.js} +1 -1
  57. package/dist/{chunk-KHDD74MK.js → chunk-7MCCXE5Y.js} +5 -5
  58. package/dist/{chunk-AY32RSUC.js → chunk-ADR3KHOC.js} +2 -2
  59. package/dist/{chunk-MMLIQDTG.js → chunk-ATKN4BJT.js} +1 -1
  60. package/dist/{chunk-762CDAJJ.js → chunk-AXJLJJ3M.js} +7 -0
  61. package/dist/{chunk-4XXZUFWN.js → chunk-BG4Y64FW.js} +1 -1
  62. package/dist/{chunk-X4ES7QBT.js → chunk-BJTSKOH3.js} +9 -7
  63. package/dist/{chunk-TCH5UCPR.js → chunk-BQ2VV7LY.js} +2 -2
  64. package/dist/{chunk-IBXHVYN2.js → chunk-BUZIEL7Y.js} +2 -2
  65. package/dist/{chunk-UFJS4RR7.js → chunk-CICLXLQN.js} +3 -3
  66. package/dist/{chunk-US3IT6ZC.js → chunk-CJ5TCFD4.js} +11 -4
  67. package/dist/{chunk-5JWCWALO.js → chunk-DQLCFGHK.js} +12 -10
  68. package/dist/{chunk-V3PDUDPB.js → chunk-ELLJPP6O.js} +2 -2
  69. package/dist/{chunk-BMPZ5HVJ.js → chunk-ERK24P76.js} +11 -1
  70. package/dist/{chunk-2WMZDKPM.js → chunk-EUIPTDLX.js} +13 -13
  71. package/dist/{chunk-RQDP2SJY.js → chunk-FUZ5VYWD.js} +1 -1
  72. package/dist/{chunk-5PP4455M.js → chunk-G36T5LAP.js} +3 -3
  73. package/dist/{chunk-3N2ZTHZZ.js → chunk-GAMVAORR.js} +1 -1
  74. package/dist/{chunk-YQVKG5MC.js → chunk-GDKQUB52.js} +7 -6
  75. package/dist/{chunk-KQWN7C5C.js → chunk-GKFO5JLN.js} +4 -4
  76. package/dist/{chunk-MYU5D5VH.js → chunk-GZCSWDAS.js} +4 -4
  77. package/dist/{chunk-2FVP7WRP.js → chunk-HUI4OE43.js} +3 -3
  78. package/dist/{chunk-AS4Z6KS4.js → chunk-IFPOHFDJ.js} +1 -1
  79. package/dist/{chunk-L3NVHPBU.js → chunk-JGQV4MDQ.js} +6 -6
  80. package/dist/{chunk-UVZK5LIK.js → chunk-K4MBKXAE.js} +1 -1
  81. package/dist/{chunk-EHCIQA5D.js → chunk-KPNZ7JUL.js} +4 -4
  82. package/dist/{chunk-4QF2YLYK.js → chunk-LBHJJEKT.js} +6 -6
  83. package/dist/{chunk-5O6D4J2K.js → chunk-LN7DE5LY.js} +2 -2
  84. package/dist/chunk-MLKGABMK.js +9 -0
  85. package/dist/{chunk-KZCYHWDF.js → chunk-MWLTTLPK.js} +107 -50
  86. package/dist/{chunk-WWAVHLGS.js → chunk-NKLNU577.js} +5 -5
  87. package/dist/{chunk-GMXKITVA.js → chunk-NMUI3ZWG.js} +1 -1
  88. package/dist/{chunk-SIU6OWA6.js → chunk-O65F2IIN.js} +6 -6
  89. package/dist/{chunk-T65RIQK2.js → chunk-ORX5BTV4.js} +6 -6
  90. package/dist/{chunk-VAJHDTJX.js → chunk-P3VQH65N.js} +28 -17
  91. package/dist/{chunk-CPRA7IEK.js → chunk-PITQ5ZIQ.js} +2 -2
  92. package/dist/chunk-PPY5N2E6.js +58 -0
  93. package/dist/{chunk-UTJ5465F.js → chunk-QER5R7Z6.js} +2 -2
  94. package/dist/{chunk-TDOKDCFH.js → chunk-RGSW36XH.js} +3 -3
  95. package/dist/{chunk-WW24SG27.js → chunk-RJHX66EY.js} +21 -11
  96. package/dist/{chunk-M46WDK64.js → chunk-SFAP4AJY.js} +1 -1
  97. package/dist/{chunk-MSU3VKGJ.js → chunk-SHJVFW22.js} +2 -2
  98. package/dist/{chunk-RAMQBSVZ.js → chunk-SVQWHV65.js} +1 -1
  99. package/dist/{chunk-3NROUNIS.js → chunk-UADSXJZ4.js} +2 -2
  100. package/dist/{chunk-M6MOQBR5.js → chunk-USE5IEEW.js} +1 -1
  101. package/dist/{chunk-KW3DED2A.js → chunk-VX2MJ4X7.js} +4 -4
  102. package/dist/{chunk-OZIXBN3O.js → chunk-WFSGCFXQ.js} +2 -2
  103. package/dist/{chunk-KAJDKYUM.js → chunk-WN3RACVD.js} +3 -3
  104. package/dist/chunk-X3YKQJCZ.js +36 -0
  105. package/dist/{chunk-5EFNBL6V.js → chunk-XAO6EYGM.js} +3 -3
  106. package/dist/{chunk-BKVX53QR.js → chunk-XEJOPVCG.js} +1 -1
  107. package/dist/{chunk-75UYYIFJ.js → chunk-XV6S5PWW.js} +3 -3
  108. package/dist/{chunk-3RKIJM26.js → chunk-Y5VKZNFN.js} +2 -2
  109. package/dist/{chunk-DK35M4TH.js → chunk-Y6Z7DA5Y.js} +5 -5
  110. package/dist/{chunk-MA37WNVS.js → chunk-YDR4BQ7R.js} +4 -4
  111. package/dist/{chunk-XGP5VSQG.js → chunk-YPD3MTFU.js} +1 -1
  112. package/dist/{chunk-LAEW5QQD.js → chunk-ZEWIMY63.js} +1 -1
  113. package/dist/{chunk-JBCMXSBO.js → chunk-ZGU3NXL2.js} +77 -18
  114. package/dist/{codex-app-cards-switch-N77RWKCO.js → codex-app-cards-switch-BD7LCI2I.js} +12 -11
  115. package/dist/{codex-desktop-launch-KIX7OMTL.js → codex-desktop-launch-V5CASSBB.js} +2 -1
  116. package/dist/{codex-session-launch-XV7SIIWP.js → codex-session-launch-5PKFKUFD.js} +20 -19
  117. package/dist/{config-HH4DYYNX.js → config-AEKH7HGC.js} +4 -3
  118. package/dist/{global-upgrade-YWIVJIUR.js → global-upgrade-IUXJJDWF.js} +10 -9
  119. package/dist/{identity-4J7Y2MW3.js → identity-YJIV2XTY.js} +5 -4
  120. package/dist/{live-capabilities-LHZBCI5U.js → live-capabilities-QYFW5QAW.js} +5 -4
  121. package/dist/{paths-ES3V7BWQ.js → paths-A5GAR5PL.js} +4 -3
  122. package/dist/reapply-BKJGICRJ.js +63 -0
  123. package/dist/src/index.js +23 -22
  124. package/dist/{upgrade-lock-TJPKU5HL.js → upgrade-lock-DDB7WEWC.js} +5 -4
  125. package/dist/usage-HBDNFZ3O.js +11 -0
  126. package/package.json +1 -1
  127. package/dist/chunk-7QLSKOSU.js +0 -19
  128. package/dist/chunk-EO23EUOK.js +0 -14
  129. package/dist/reapply-KA5SIYWX.js +0 -62
  130. package/dist/usage-7ALXBJVJ.js +0 -10
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  SETUP_FLAGS
3
- } from "./chunk-75UYYIFJ.js";
3
+ } from "./chunk-XV6S5PWW.js";
4
4
  import {
5
5
  parseFlags
6
- } from "./chunk-GMXKITVA.js";
6
+ } from "./chunk-NMUI3ZWG.js";
7
7
  import {
8
8
  UsageError
9
- } from "./chunk-7QLSKOSU.js";
9
+ } from "./chunk-PPY5N2E6.js";
10
10
  import {
11
11
  NPX_LATEST_COMMAND
12
- } from "./chunk-BMPZ5HVJ.js";
12
+ } from "./chunk-ERK24P76.js";
13
13
  import {
14
14
  CLAUDE_CONNECTOR_GUIDE,
15
15
  CLAUDE_CONNECTOR_STEPS,
@@ -17,7 +17,7 @@ import {
17
17
  CLAUDE_CONNECTOR_URL,
18
18
  COWORK_CONNECTOR_LIMIT,
19
19
  COWORK_STANDING_INSTRUCTIONS
20
- } from "./chunk-762CDAJJ.js";
20
+ } from "./chunk-AXJLJJ3M.js";
21
21
 
22
22
  // src/cli/cowork.ts
23
23
  import { readFileSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  UsageError
3
- } from "./chunk-7QLSKOSU.js";
3
+ } from "./chunk-PPY5N2E6.js";
4
4
 
5
5
  // src/cli/flags.ts
6
6
  var normalize = (raw) => raw.replace(/^--?/, "");
@@ -4,30 +4,30 @@ import {
4
4
  postLiveSession,
5
5
  postLiveSessionUntilAccepted,
6
6
  startLiveSessionHeartbeat
7
- } from "./chunk-V3PDUDPB.js";
7
+ } from "./chunk-ELLJPP6O.js";
8
8
  import {
9
9
  SESSION_IDLE_TIMEOUT_MS,
10
10
  describeIdleWindow,
11
11
  idleDeadlinePassed,
12
12
  startProcessOwnership
13
- } from "./chunk-MSU3VKGJ.js";
13
+ } from "./chunk-SHJVFW22.js";
14
14
  import {
15
15
  spawnClaude
16
16
  } from "./chunk-XHKBHWLX.js";
17
17
  import {
18
18
  repoKeyFor
19
- } from "./chunk-XGP5VSQG.js";
19
+ } from "./chunk-YPD3MTFU.js";
20
20
  import {
21
21
  isAskUserResponse,
22
22
  isDecisionStopped,
23
23
  isWaitForAnswerResponse,
24
24
  withdrawQuestion,
25
25
  writeDegraded
26
- } from "./chunk-WW24SG27.js";
26
+ } from "./chunk-RJHX66EY.js";
27
27
  import {
28
28
  callMcpTool,
29
29
  isRetryable
30
- } from "./chunk-5EFNBL6V.js";
30
+ } from "./chunk-XAO6EYGM.js";
31
31
  import {
32
32
  AGENT_QUESTION_DESCRIPTION_MAX,
33
33
  AGENT_QUESTION_HEADER_MAX,
@@ -48,7 +48,7 @@ import {
48
48
  parseCodexQuestions,
49
49
  planElicitationAsk,
50
50
  readElicitationFields
51
- } from "./chunk-762CDAJJ.js";
51
+ } from "./chunk-AXJLJJ3M.js";
52
52
 
53
53
  // src/codex-question-owner.ts
54
54
  import { createHash } from "crypto";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  announceSubscriptionRequired,
3
3
  isDeferAnswer
4
- } from "./chunk-LAEW5QQD.js";
4
+ } from "./chunk-ZEWIMY63.js";
5
5
  import {
6
6
  AUTO_DECISION_WINDOW_MS,
7
7
  DEFAULT_SESSION,
@@ -10,18 +10,18 @@ import {
10
10
  permissionDeniedAction,
11
11
  releaseThrottle,
12
12
  reportEvent
13
- } from "./chunk-5JWCWALO.js";
13
+ } from "./chunk-DQLCFGHK.js";
14
14
  import {
15
15
  askUser,
16
16
  isDecisionStopped,
17
17
  waitForQuestion
18
- } from "./chunk-WW24SG27.js";
18
+ } from "./chunk-RJHX66EY.js";
19
19
  import {
20
20
  SubscriptionRequiredError
21
- } from "./chunk-5EFNBL6V.js";
21
+ } from "./chunk-XAO6EYGM.js";
22
22
  import {
23
23
  getMachineId
24
- } from "./chunk-M46WDK64.js";
24
+ } from "./chunk-SFAP4AJY.js";
25
25
  import {
26
26
  ASK_CONTEXT_MAX,
27
27
  agentQuestionContext,
@@ -33,7 +33,7 @@ import {
33
33
  questionsShownAsASet,
34
34
  shouldDeferToNativeMode,
35
35
  wireVerdictFor
36
- } from "./chunk-762CDAJJ.js";
36
+ } from "./chunk-AXJLJJ3M.js";
37
37
 
38
38
  // src/machine-decision-audit.ts
39
39
  import { basename } from "path";
@@ -4,19 +4,19 @@ import {
4
4
  outcomeOfFailedAsk,
5
5
  reportMachineDenial,
6
6
  storedWaitDeadline
7
- } from "./chunk-T65RIQK2.js";
7
+ } from "./chunk-ORX5BTV4.js";
8
8
  import {
9
9
  isGatingMoment,
10
10
  recordKeylessMoment
11
- } from "./chunk-RAMQBSVZ.js";
11
+ } from "./chunk-SVQWHV65.js";
12
12
  import {
13
13
  isDeferAnswer,
14
14
  oncePerSession
15
- } from "./chunk-LAEW5QQD.js";
15
+ } from "./chunk-ZEWIMY63.js";
16
16
  import {
17
17
  activeHookSource,
18
18
  activeIdentity
19
- } from "./chunk-KQWN7C5C.js";
19
+ } from "./chunk-GKFO5JLN.js";
20
20
  import {
21
21
  DEFAULT_SESSION,
22
22
  UNNAMED_ACTION,
@@ -40,33 +40,38 @@ import {
40
40
  reportEvent,
41
41
  scopePathFor,
42
42
  settleQuestionsForToolUse
43
- } from "./chunk-5JWCWALO.js";
43
+ } from "./chunk-DQLCFGHK.js";
44
44
  import {
45
45
  repoKeyFor
46
- } from "./chunk-XGP5VSQG.js";
46
+ } from "./chunk-YPD3MTFU.js";
47
47
  import {
48
48
  askUser,
49
49
  cancelQuestion,
50
50
  claimBlockedAction,
51
+ clientErrorKindOf,
51
52
  isAwayPaused,
52
53
  isDecisionStopped,
53
54
  isLocalQuestionHandoff,
54
55
  pollForAnswer,
56
+ reportClientError,
55
57
  requestGate,
56
58
  sendNotification,
57
59
  waitForQuestion,
58
60
  waitsForThePhone
59
- } from "./chunk-WW24SG27.js";
61
+ } from "./chunk-RJHX66EY.js";
60
62
  import {
61
63
  getMachineId
62
- } from "./chunk-M46WDK64.js";
64
+ } from "./chunk-SFAP4AJY.js";
65
+ import {
66
+ claudeConfigDir
67
+ } from "./chunk-MWLTTLPK.js";
63
68
  import {
64
69
  getApiKey,
65
70
  getBaseUrl
66
- } from "./chunk-4XXZUFWN.js";
71
+ } from "./chunk-BG4Y64FW.js";
67
72
  import {
68
73
  NPX_LATEST_COMMAND
69
- } from "./chunk-BMPZ5HVJ.js";
74
+ } from "./chunk-ERK24P76.js";
70
75
  import {
71
76
  AGENT_QUESTION_STRATEGY,
72
77
  AGENT_QUESTION_TOOL,
@@ -111,7 +116,7 @@ import {
111
116
  resolveGate,
112
117
  timeoutActionWithoutLocalPrompt,
113
118
  unansweredRefusalReason
114
- } from "./chunk-762CDAJJ.js";
119
+ } from "./chunk-AXJLJJ3M.js";
115
120
 
116
121
  // src/claude-permission-rules.ts
117
122
  import { readFileSync, statSync } from "fs";
@@ -124,7 +129,7 @@ var MANAGED_CLAUDE_SETTINGS_BY_PLATFORM = {
124
129
  };
125
130
  var MAX_CLAUDE_SETTINGS_BYTES = 1048576;
126
131
  var claudeSettingsLocationFor = (cwd, environment = process.env, home = homedir(), platform = process.platform) => ({
127
- configDir: environment.CLAUDE_CONFIG_DIR || join(home, ".claude"),
132
+ configDir: claudeConfigDir(home, environment),
128
133
  projectDir: environment.CLAUDE_PROJECT_DIR || cwd || void 0,
129
134
  managedSettingsPath: MANAGED_CLAUDE_SETTINGS_BY_PLATFORM[platform]
130
135
  });
@@ -528,6 +533,10 @@ var remindedOfApprovedRetry = (input) => {
528
533
  markApprovalReminded(approval);
529
534
  return true;
530
535
  };
536
+ var reportHookFailure = async (code, error) => {
537
+ console.error(`[Pushary] ${code}: could not complete the approval check; keeping the agent's existing fallback.`);
538
+ await reportClientError({ kind: clientErrorKindOf(error), code });
539
+ };
531
540
  var handlePreToolUse = async (input, canonical) => {
532
541
  if (isPusharyOwnTool(input.tool_name)) return void 0;
533
542
  let apiKey;
@@ -554,10 +563,10 @@ var handlePreToolUse = async (input, canonical) => {
554
563
  if (verdict.kind === "gate" && verdict.scopeReason && (canonical?.toolInputs.length ?? 0) > 1) return deny(SCOPE_BATCH_REASON);
555
564
  if (agentQuestionStrategy(ACTIVE_SOURCE, "PreToolUse", input.tool_name) === AGENT_QUESTION_STRATEGY.native) return void 0;
556
565
  if (input.tool_name === "AskUserQuestion") {
557
- return handleAskUserQuestion(apiKey, input, modeState);
566
+ return await handleAskUserQuestion(apiKey, input, modeState);
558
567
  }
559
568
  if (input.tool_name === "ExitPlanMode") {
560
- return handleExitPlanMode(apiKey, input);
569
+ return await handleExitPlanMode(apiKey, input);
561
570
  }
562
571
  if (await claimedBlockedActionRetry(apiKey, input)) return allow(BLOCKED_ACTION_ALLOW_REASON);
563
572
  if (remindedOfApprovedRetry(input)) return deny(BLOCKED_ACTION_CHANGED_RETRY_REASON);
@@ -577,9 +586,10 @@ var handlePreToolUse = async (input, canonical) => {
577
586
  case "defer":
578
587
  return undecidedCall(SOLE_GATE_UNDECIDED_REASON);
579
588
  default:
580
- return dispatchModeHandler(apiKey, input, verdict.policy, getMachineId(), modeState.trainingConsent, verdict.scopeReason, verdict.scopePath);
589
+ return await dispatchModeHandler(apiKey, input, verdict.policy, getMachineId(), modeState.trainingConsent, verdict.scopeReason, verdict.scopePath);
581
590
  }
582
- } catch {
591
+ } catch (error) {
592
+ await reportHookFailure("pre_tool_use_failed", error);
583
593
  return undecidedCall(SOLE_GATE_UNDECIDED_REASON);
584
594
  }
585
595
  };
@@ -631,7 +641,8 @@ var handlePermissionRequest = async (input, canonical) => {
631
641
  await dispatchModeHandler(apiKey, input, verdict.policy, getMachineId(), modeState.trainingConsent, verdict.scopeReason, verdict.scopePath)
632
642
  );
633
643
  }
634
- } catch {
644
+ } catch (error) {
645
+ await reportHookFailure("permission_request_failed", error);
635
646
  return void 0;
636
647
  }
637
648
  };
@@ -294,7 +294,7 @@ var loadedOnce = (load) => {
294
294
  };
295
295
 
296
296
  // src/codex-desktop-proxy.ts
297
- var loadThePhone = () => import("./api-UVJGNZIF.js");
297
+ var loadThePhone = () => import("./api-LW3PJQYY.js");
298
298
  var theFirstCardLoadsAgain = () => {
299
299
  };
300
300
  var APP_SERVER_COMMAND = "app-server";
@@ -827,7 +827,7 @@ var codexDesktopCommand = async (args, entry, readAccount) => {
827
827
  return runCodexDesktopProxy(engine2, args.slice(3), readAccount, { watchesForCards: layoutIsKnown });
828
828
  }
829
829
  if (args[0] === APP_CARDS_FLAG) {
830
- const { codexAppCardsCommandOnThisMac } = await import("./codex-app-cards-switch-N77RWKCO.js");
830
+ const { codexAppCardsCommandOnThisMac } = await import("./codex-app-cards-switch-BD7LCI2I.js");
831
831
  return codexAppCardsCommandOnThisMac(args.slice(1), entry, readAccount);
832
832
  }
833
833
  if (args.length > 2) throw new Error("Usage: pushary codex --desktop [path/to/Codex.app]");
@@ -0,0 +1,58 @@
1
+ import {
2
+ EXIT
3
+ } from "./chunk-KZERVKTD.js";
4
+
5
+ // src/cli/errors.ts
6
+ var UsageError = class extends Error {
7
+ constructor(hint) {
8
+ super(hint);
9
+ this.hint = hint;
10
+ this.name = "UsageError";
11
+ }
12
+ };
13
+ var UserError = class extends Error {
14
+ constructor(message, next = [], code = EXIT.FAILED) {
15
+ super(message);
16
+ this.next = next;
17
+ this.code = code;
18
+ this.name = "UserError";
19
+ }
20
+ };
21
+ var NetworkError = class extends Error {
22
+ constructor(message) {
23
+ super(message);
24
+ this.name = "NetworkError";
25
+ }
26
+ };
27
+ var AuthError = class extends Error {
28
+ constructor(message) {
29
+ super(message);
30
+ this.name = "AuthError";
31
+ }
32
+ };
33
+ var InputRequiredError = class extends Error {
34
+ constructor(message, flag) {
35
+ super(message);
36
+ this.flag = flag;
37
+ this.name = "InputRequiredError";
38
+ }
39
+ };
40
+ var exitCodeFor = (err) => {
41
+ if (err instanceof UsageError) return EXIT.USAGE;
42
+ if (err instanceof InputRequiredError) return EXIT.INPUT_REQUIRED;
43
+ if (err instanceof AuthError) return EXIT.UNAUTHENTICATED;
44
+ if (err instanceof NetworkError) return EXIT.UNREACHABLE;
45
+ if (err instanceof UserError) return err.code;
46
+ return EXIT.FAILED;
47
+ };
48
+ var messageFor = (err) => {
49
+ if (err instanceof Error) return err.message;
50
+ return String(err);
51
+ };
52
+
53
+ export {
54
+ UsageError,
55
+ NetworkError,
56
+ exitCodeFor,
57
+ messageFor
58
+ };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  CODEX_HOOK_STATUS
3
- } from "./chunk-IBXHVYN2.js";
3
+ } from "./chunk-BUZIEL7Y.js";
4
4
  import {
5
5
  NPX_LATEST_COMMAND
6
- } from "./chunk-BMPZ5HVJ.js";
6
+ } from "./chunk-ERK24P76.js";
7
7
 
8
8
  // src/setup/codex-trust.ts
9
9
  var CODEX_TRUST_TELEMETRY = {
@@ -5,16 +5,16 @@ import {
5
5
  import {
6
6
  NOTIFICATION_MATCHED_TYPES,
7
7
  POSTTOOLUSE_MIRRORED_TOOLS
8
- } from "./chunk-W47WL6JY.js";
8
+ } from "./chunk-33OOEVPG.js";
9
9
  import {
10
10
  isProtectedByScope,
11
11
  registerHookEntry
12
- } from "./chunk-KZCYHWDF.js";
12
+ } from "./chunk-MWLTTLPK.js";
13
13
  import {
14
14
  CLAUDE_PRETOOLUSE_MATCHER,
15
15
  HOOK_BUDGETS,
16
16
  HOOK_LOCATOR_BINARY
17
- } from "./chunk-762CDAJJ.js";
17
+ } from "./chunk-AXJLJJ3M.js";
18
18
 
19
19
  // src/gemini-config.ts
20
20
  var GEMINI_HOOK_BINARY = "pushary-gemini-hook";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SubscriptionRequiredError,
3
3
  callMcpTool
4
- } from "./chunk-5EFNBL6V.js";
4
+ } from "./chunk-XAO6EYGM.js";
5
5
  import {
6
6
  CLIENT_REPORT_DISABLE_ENV,
7
7
  isDisabledByEnv
@@ -9,14 +9,14 @@ import {
9
9
  import {
10
10
  installNetworkDefaults,
11
11
  isNetworkFailure
12
- } from "./chunk-JAKBCKEB.js";
12
+ } from "./chunk-7BAO42UV.js";
13
13
  import {
14
14
  clientReportClaims
15
- } from "./chunk-KZCYHWDF.js";
15
+ } from "./chunk-MWLTTLPK.js";
16
16
  import {
17
17
  getApiKey,
18
18
  getBaseUrl
19
- } from "./chunk-4XXZUFWN.js";
19
+ } from "./chunk-BG4Y64FW.js";
20
20
  import {
21
21
  ASK_AGENT_NAME_MAX,
22
22
  CLIENT_REPORT_PATH,
@@ -24,7 +24,7 @@ import {
24
24
  GATE_PERMISSION_MODE_MAX_LENGTH,
25
25
  degradedLine,
26
26
  truncateLine
27
- } from "./chunk-762CDAJJ.js";
27
+ } from "./chunk-AXJLJJ3M.js";
28
28
 
29
29
  // src/api.ts
30
30
  import { randomUUID } from "crypto";
@@ -114,6 +114,7 @@ var claimReportWindow = (claimsDir, key, now) => {
114
114
 
115
115
  // src/client-report.ts
116
116
  var CLIENT_REPORT_TIMEOUT_MS = 1e3;
117
+ var CLIENT_REPORT_MAX_ATTEMPTS = 2;
117
118
  var readApiKey = () => {
118
119
  try {
119
120
  return getApiKey();
@@ -147,12 +148,21 @@ var createClientErrorReporter = (deps) => {
147
148
  const apiKey = deps.apiKey();
148
149
  const now = deps.now();
149
150
  if (!apiKey || !claimReport(reportKey(event), now)) return;
150
- await deps.fetchImpl(`${deps.baseUrl()}${CLIENT_REPORT_PATH}`, {
151
- method: "POST",
152
- headers: { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json" },
153
- body: JSON.stringify({ ...event, occurredAt: new Date(now).toISOString() }),
154
- signal: AbortSignal.timeout(CLIENT_REPORT_TIMEOUT_MS)
155
- });
151
+ const signal = AbortSignal.timeout(CLIENT_REPORT_TIMEOUT_MS);
152
+ for (let attempt = 0; attempt < CLIENT_REPORT_MAX_ATTEMPTS && !signal.aborted; attempt++) {
153
+ try {
154
+ const response = await deps.fetchImpl(`${deps.baseUrl()}${CLIENT_REPORT_PATH}`, {
155
+ method: "POST",
156
+ headers: { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json" },
157
+ body: JSON.stringify({ ...event, occurredAt: new Date(now).toISOString() }),
158
+ signal
159
+ });
160
+ await response.body?.cancel();
161
+ if (response.ok || response.status < 500 && response.status !== 429) return;
162
+ } catch {
163
+ if (signal.aborted) return;
164
+ }
165
+ }
156
166
  } catch {
157
167
  return;
158
168
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-KZCYHWDF.js";
3
+ } from "./chunk-MWLTTLPK.js";
4
4
  import {
5
5
  writeFileAtomic
6
6
  } from "./chunk-QENTGE75.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-KZCYHWDF.js";
3
+ } from "./chunk-MWLTTLPK.js";
4
4
  import {
5
5
  readJsonSafe
6
6
  } from "./chunk-QENTGE75.js";
7
7
  import {
8
8
  isRecord
9
- } from "./chunk-762CDAJJ.js";
9
+ } from "./chunk-AXJLJJ3M.js";
10
10
 
11
11
  // src/process-ownership.ts
12
12
  import { createHash, randomUUID } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSafeReadOnlyCommand
3
- } from "./chunk-762CDAJJ.js";
3
+ } from "./chunk-AXJLJJ3M.js";
4
4
 
5
5
  // src/ledger.ts
6
6
  import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync } from "fs";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  parseSseMessages
3
- } from "./chunk-5EFNBL6V.js";
3
+ } from "./chunk-XAO6EYGM.js";
4
4
  import {
5
5
  NPX_LATEST_COMMAND
6
- } from "./chunk-BMPZ5HVJ.js";
6
+ } from "./chunk-ERK24P76.js";
7
7
 
8
8
  // src/mcp-stdio-bridge.ts
9
9
  var MCP_BRIDGE_BINARY = "pushary-mcp";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-6ICPEJY5.js";
7
7
  import {
8
8
  isRecord
9
- } from "./chunk-762CDAJJ.js";
9
+ } from "./chunk-AXJLJJ3M.js";
10
10
 
11
11
  // src/setup/agent-probe.ts
12
12
  import { execSync } from "child_process";
@@ -7,7 +7,7 @@ import {
7
7
  reachVerdict,
8
8
  reachesYou,
9
9
  verifyDelivery
10
- } from "./chunk-2FVP7WRP.js";
10
+ } from "./chunk-HUI4OE43.js";
11
11
  import {
12
12
  generateKeypair,
13
13
  openSealedKey,
@@ -24,14 +24,14 @@ import {
24
24
  } from "./chunk-FO3MDD26.js";
25
25
  import {
26
26
  reportedInstallSource
27
- } from "./chunk-3RKIJM26.js";
27
+ } from "./chunk-Y5VKZNFN.js";
28
28
  import {
29
29
  NPX_LATEST_COMMAND
30
- } from "./chunk-BMPZ5HVJ.js";
30
+ } from "./chunk-ERK24P76.js";
31
31
  import {
32
32
  NO_PAIRING_COMPUTER,
33
33
  PAIR_TTL_SECONDS
34
- } from "./chunk-762CDAJJ.js";
34
+ } from "./chunk-AXJLJJ3M.js";
35
35
 
36
36
  // src/onboarding.ts
37
37
  import qrcodeTerminal from "qrcode-terminal";
@@ -4,10 +4,10 @@ import {
4
4
  } from "./chunk-QENTGE75.js";
5
5
  import {
6
6
  configFilePath
7
- } from "./chunk-4XXZUFWN.js";
7
+ } from "./chunk-BG4Y64FW.js";
8
8
  import {
9
9
  readSetupOutcomeProperties
10
- } from "./chunk-762CDAJJ.js";
10
+ } from "./chunk-AXJLJJ3M.js";
11
11
 
12
12
  // src/hooks-spec.ts
13
13
  var CURSOR_GATE_SCRIPT = "pushary-gate.mjs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveInstallSourceFor
3
- } from "./chunk-3RKIJM26.js";
3
+ } from "./chunk-Y5VKZNFN.js";
4
4
  import {
5
5
  backupFile,
6
6
  readJsonSafe,
@@ -9,11 +9,11 @@ import {
9
9
  } from "./chunk-QENTGE75.js";
10
10
  import {
11
11
  configFilePath
12
- } from "./chunk-4XXZUFWN.js";
12
+ } from "./chunk-BG4Y64FW.js";
13
13
  import {
14
14
  API_KEY_PREFIX_PATTERN,
15
15
  isRecord
16
- } from "./chunk-762CDAJJ.js";
16
+ } from "./chunk-AXJLJJ3M.js";
17
17
 
18
18
  // src/shell-alias.ts
19
19
  import { homedir } from "os";
@@ -0,0 +1,36 @@
1
+ import {
2
+ isApprovalMode,
3
+ isRecord,
4
+ isTimeoutAction
5
+ } from "./chunk-AXJLJJ3M.js";
6
+
7
+ // src/cli/settings-response.ts
8
+ var isFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value);
9
+ var isWaitSeconds = (value) => isFiniteNumber(value) && value >= 0;
10
+ var isModeOverride = (value) => isRecord(value) && isApprovalMode(value.mode) && (value.expiresAt === null || typeof value.expiresAt === "string" && Number.isFinite(Date.parse(value.expiresAt)));
11
+ var modeResponse = (value) => {
12
+ if (!isRecord(value) || value.override !== null && !isModeOverride(value.override) || value.permanent !== void 0 && typeof value.permanent !== "boolean") throw new Error("Invalid mode response");
13
+ return { override: value.override, ...typeof value.permanent === "boolean" ? { permanent: value.permanent } : {} };
14
+ };
15
+ var isWaitPolicy = (value) => isRecord(value) && typeof value.tool === "string" && isApprovalMode(value.mode) && isTimeoutAction(value.timeoutAction) && isWaitSeconds(value.timeoutSeconds) && isWaitSeconds(value.pushFirstSeconds);
16
+ var waitWindowResponse = (value) => {
17
+ if (!isRecord(value) || !isWaitSeconds(value.defaultPushFirstSeconds)) throw new Error("Invalid wait response");
18
+ return value.defaultPushFirstSeconds;
19
+ };
20
+ var waitResponse = (value) => {
21
+ const defaultPushFirstSeconds = waitWindowResponse(value);
22
+ if (!isRecord(value) || !Array.isArray(value.policies) || !value.policies.every(isWaitPolicy) || value.modeOverride !== null && !isApprovalMode(value.modeOverride)) throw new Error("Invalid wait response");
23
+ return { policies: value.policies, defaultPushFirstSeconds, modeOverride: value.modeOverride };
24
+ };
25
+ var isSuggestion = (value) => isRecord(value) && typeof value.id === "string" && typeof value.toolPattern === "string" && (value.kind === "auto_approve" || value.kind === "always_deny") && isFiniteNumber(value.evidenceApproved) && isFiniteNumber(value.evidenceDenied) && isFiniteNumber(value.windowDays);
26
+ var suggestionsResponse = (value) => {
27
+ if (!isRecord(value) || !Array.isArray(value.suggestions) || !value.suggestions.every(isSuggestion)) throw new Error("Invalid suggestions response");
28
+ return value.suggestions;
29
+ };
30
+
31
+ export {
32
+ modeResponse,
33
+ waitWindowResponse,
34
+ waitResponse,
35
+ suggestionsResponse
36
+ };
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  keyCheckFromResponse
3
- } from "./chunk-MA37WNVS.js";
3
+ } from "./chunk-YDR4BQ7R.js";
4
4
  import {
5
5
  installNetworkDefaults
6
- } from "./chunk-JAKBCKEB.js";
6
+ } from "./chunk-7BAO42UV.js";
7
7
  import {
8
8
  getBaseUrl
9
- } from "./chunk-4XXZUFWN.js";
9
+ } from "./chunk-BG4Y64FW.js";
10
10
 
11
11
  // src/retry.ts
12
12
  var isRetryable = (err) => {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  HOOK_HOLD_BUDGET_ENV,
3
3
  hookHoldBudgetProof
4
- } from "./chunk-762CDAJJ.js";
4
+ } from "./chunk-AXJLJJ3M.js";
5
5
 
6
6
  // src/hold-budget.ts
7
7
  var takeHookHoldBudget = (args = process.argv.slice(2), env = process.env) => {
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  parseFlags
3
- } from "./chunk-GMXKITVA.js";
3
+ } from "./chunk-NMUI3ZWG.js";
4
4
  import {
5
5
  UsageError
6
- } from "./chunk-7QLSKOSU.js";
6
+ } from "./chunk-PPY5N2E6.js";
7
7
  import {
8
8
  SETUP_AGENT_CHOICES,
9
9
  SETUP_CONNECT_MODES,
10
10
  isSetupConnectMode,
11
11
  isValidApiKey,
12
12
  normalizeAgentId
13
- } from "./chunk-762CDAJJ.js";
13
+ } from "./chunk-AXJLJJ3M.js";
14
14
 
15
15
  // src/setup/options.ts
16
16
  var AGENT_CHOICES = SETUP_AGENT_CHOICES;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  configFilePath
3
- } from "./chunk-4XXZUFWN.js";
3
+ } from "./chunk-BG4Y64FW.js";
4
4
  import {
5
5
  normalizeInstallSource
6
- } from "./chunk-762CDAJJ.js";
6
+ } from "./chunk-AXJLJJ3M.js";
7
7
 
8
8
  // src/install-source.ts
9
9
  import { readFileSync } from "fs";