pushary 1.9.171 → 1.9.175

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 (139) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/{api-WOLCBFMV.js → api-MMBCOOHP.js} +11 -11
  3. package/dist/bin/pushary-audit.js +3 -3
  4. package/dist/bin/pushary-bell-hook.js +28 -28
  5. package/dist/bin/pushary-bell.js +12 -11
  6. package/dist/bin/pushary-calls.js +15 -15
  7. package/dist/bin/pushary-claude.js +32 -34
  8. package/dist/bin/pushary-clean.js +38 -38
  9. package/dist/bin/pushary-codex-bridge.js +23 -23
  10. package/dist/bin/pushary-codex-hook.js +44 -46
  11. package/dist/bin/pushary-codex-session.js +8 -8
  12. package/dist/bin/pushary-codex.js +19 -18
  13. package/dist/bin/pushary-connect.js +34 -34
  14. package/dist/bin/pushary-cowork.js +5 -5
  15. package/dist/bin/pushary-daemon.js +53 -52
  16. package/dist/bin/pushary-disconnect.js +29 -29
  17. package/dist/bin/pushary-doctor.js +46 -46
  18. package/dist/bin/pushary-elicitation-hook.js +31 -30
  19. package/dist/bin/pushary-gemini-bridge.js +21 -19
  20. package/dist/bin/pushary-gemini-hook.js +38 -40
  21. package/dist/bin/pushary-hook.js +36 -36
  22. package/dist/bin/pushary-login.js +22 -22
  23. package/dist/bin/pushary-logout.js +29 -29
  24. package/dist/bin/pushary-mcp.js +12 -12
  25. package/dist/bin/pushary-mode.js +16 -16
  26. package/dist/bin/pushary-notification-hook.js +27 -27
  27. package/dist/bin/pushary-opencode-hook.js +44 -53
  28. package/dist/bin/pushary-permission-denied-hook.js +36 -36
  29. package/dist/bin/pushary-permission-hook.js +36 -36
  30. package/dist/bin/pushary-post-hook.js +28 -28
  31. package/dist/bin/pushary-prompt-hook.js +27 -27
  32. package/dist/bin/pushary-session-end-hook.js +27 -27
  33. package/dist/bin/pushary-session-start-hook.js +38 -38
  34. package/dist/bin/pushary-sessions.js +14 -14
  35. package/dist/bin/pushary-setup.js +61 -59
  36. package/dist/bin/pushary-stats.js +5 -5
  37. package/dist/bin/pushary-status.js +35 -35
  38. package/dist/bin/pushary-stop-hook.js +27 -27
  39. package/dist/bin/pushary-stopfailure-hook.js +27 -27
  40. package/dist/bin/pushary-suggestions.js +16 -16
  41. package/dist/bin/pushary-transcript-register.js +17 -17
  42. package/dist/bin/pushary-transcripts.js +25 -25
  43. package/dist/bin/pushary-upgrade.js +43 -43
  44. package/dist/bin/pushary-wait.js +16 -16
  45. package/dist/bin/pushary.js +7 -7
  46. package/dist/{chunk-ZLMWP6X4.js → chunk-24W735XB.js} +2 -2
  47. package/dist/{chunk-GTB4MBMU.js → chunk-2RILXRZ5.js} +6 -6
  48. package/dist/{chunk-W46HI6T3.js → chunk-37EEYMUJ.js} +5 -5
  49. package/dist/{chunk-ZHO263F6.js → chunk-3F4UI7DP.js} +4 -4
  50. package/dist/{chunk-3I3RUJRD.js → chunk-3FMW4G3B.js} +2 -2
  51. package/dist/{chunk-UB5G7ZZN.js → chunk-3HVCLYEA.js} +1 -1
  52. package/dist/{chunk-JE6NVEOE.js → chunk-3O42YMMA.js} +7 -5
  53. package/dist/{chunk-GVIKF73A.js → chunk-3TGLZAON.js} +1 -1
  54. package/dist/{chunk-SM65Z6CM.js → chunk-537VC73A.js} +6 -6
  55. package/dist/{chunk-MJMRJ5ZF.js → chunk-5DEG6XEK.js} +1 -1
  56. package/dist/{chunk-EGPOBJZG.js → chunk-5RAMEVL5.js} +1 -1
  57. package/dist/{chunk-DXUPOVJP.js → chunk-6L5Q4I4V.js} +1 -1
  58. package/dist/{chunk-BKVQKWLY.js → chunk-6RAM3F5N.js} +5 -5
  59. package/dist/{chunk-CJODSIXH.js → chunk-6TJ463K6.js} +6 -6
  60. package/dist/{chunk-EQQOEDQZ.js → chunk-6YR7VLHE.js} +13 -13
  61. package/dist/{chunk-U2XCKXBH.js → chunk-77FE2JQB.js} +5 -5
  62. package/dist/{chunk-WI2WYKSE.js → chunk-A3DLOQJ7.js} +1 -1
  63. package/dist/{chunk-CLT4J5N5.js → chunk-ACWLYAEM.js} +2 -2
  64. package/dist/{chunk-Y54VMOE5.js → chunk-AN7252SG.js} +2 -2
  65. package/dist/{chunk-SJDYK47V.js → chunk-B7S5NLZB.js} +5 -5
  66. package/dist/{chunk-G7U5TFPY.js → chunk-CZG2AXJD.js} +1 -1
  67. package/dist/{chunk-7ODDR6FA.js → chunk-CZQGXJQY.js} +2 -2
  68. package/dist/{chunk-CFZUESTS.js → chunk-D3U46VX5.js} +1 -1
  69. package/dist/{chunk-L77OIGRB.js → chunk-DJHPBM5S.js} +23 -1
  70. package/dist/{chunk-3GIVPZIS.js → chunk-DOVLWIA4.js} +2 -2
  71. package/dist/{chunk-FJF2D32S.js → chunk-EG23IMEU.js} +3 -3
  72. package/dist/{chunk-PQEX64YL.js → chunk-EH7M4CXB.js} +6 -6
  73. package/dist/{chunk-WKRKTQLA.js → chunk-EMRFCGWI.js} +4 -4
  74. package/dist/{chunk-IHNII3GT.js → chunk-F66QGIJR.js} +3 -3
  75. package/dist/{chunk-RPMVO2RJ.js → chunk-F7JATJWH.js} +7 -5
  76. package/dist/{chunk-SQCW64C2.js → chunk-G74JB53L.js} +4 -4
  77. package/dist/{chunk-AVN4A4A6.js → chunk-GC75JZFG.js} +1 -1
  78. package/dist/{chunk-EGDFXMFK.js → chunk-GHTQ7IAZ.js} +5 -5
  79. package/dist/{chunk-XHUR62AQ.js → chunk-GMNBIURN.js} +3 -3
  80. package/dist/{chunk-JUE347Z7.js → chunk-GT4GUCCK.js} +6 -6
  81. package/dist/{chunk-2RN7D6VI.js → chunk-GVMPWNPA.js} +4 -4
  82. package/dist/{chunk-UCND4JHN.js → chunk-H75BEIQN.js} +1 -1
  83. package/dist/{chunk-LEAACRFN.js → chunk-HB2EJOEM.js} +2 -2
  84. package/dist/{chunk-5HT352IV.js → chunk-HLDDLBXI.js} +5 -5
  85. package/dist/{chunk-JNVUOEKM.js → chunk-HQS7MUTB.js} +4 -4
  86. package/dist/{chunk-AUF4BMGA.js → chunk-I2TMZ2VO.js} +10 -10
  87. package/dist/{chunk-GZZ7XGL5.js → chunk-KZ7FPLTR.js} +1 -1
  88. package/dist/{chunk-A2DVMIX4.js → chunk-LYC7OGLM.js} +1 -1
  89. package/dist/{chunk-5EU7V5CT.js → chunk-MFNSTUPF.js} +4 -4
  90. package/dist/{chunk-7AENNOGX.js → chunk-N4AVMDS3.js} +1 -1
  91. package/dist/{chunk-7XSZK4DH.js → chunk-NGXZD5B2.js} +3 -3
  92. package/dist/{chunk-FCNYCY6G.js → chunk-NIYGTZZ4.js} +3 -3
  93. package/dist/{chunk-DCYRV2BJ.js → chunk-NW4M5WK6.js} +2 -2
  94. package/dist/{chunk-SSKNRWWS.js → chunk-OQVTK7HS.js} +1 -1
  95. package/dist/{chunk-D6OCHPLT.js → chunk-OZBNNBZG.js} +2 -2
  96. package/dist/{chunk-HBJLJHZF.js → chunk-P35JKWDS.js} +2 -2
  97. package/dist/{chunk-7L3MVK44.js → chunk-P5AJZMHG.js} +5 -5
  98. package/dist/{chunk-D3TNLVVL.js → chunk-PBPF46MM.js} +4 -4
  99. package/dist/{chunk-2XEZJK7G.js → chunk-PWIHCKC2.js} +5 -5
  100. package/dist/{chunk-W4NCWOVL.js → chunk-PYNRQFXB.js} +1 -1
  101. package/dist/{chunk-KMKU2INV.js → chunk-QDF4VGHL.js} +1 -1
  102. package/dist/{chunk-5GUZJIEL.js → chunk-RDCP7PVJ.js} +4 -4
  103. package/dist/{chunk-CUWHBFBB.js → chunk-RHOZMBEL.js} +1 -1
  104. package/dist/{chunk-KNFZORNH.js → chunk-RIH62UGR.js} +3 -3
  105. package/dist/{chunk-E7ATFUXV.js → chunk-RX64LJJQ.js} +3 -3
  106. package/dist/{chunk-I72TVBOG.js → chunk-S7AT7T7H.js} +4 -4
  107. package/dist/{chunk-IYTTLDB5.js → chunk-SFXASSHE.js} +3 -3
  108. package/dist/{chunk-MV7NJYJX.js → chunk-TDZRZNXX.js} +3 -3
  109. package/dist/{chunk-UHKYKZQ5.js → chunk-TKGSV72S.js} +89 -45
  110. package/dist/{chunk-3PQWVDW5.js → chunk-TVJ4A32Y.js} +9 -9
  111. package/dist/{chunk-J2CRP5GN.js → chunk-UEKEMOE7.js} +2 -2
  112. package/dist/{chunk-FFJX6YOQ.js → chunk-UJKHGU7E.js} +1 -1
  113. package/dist/{chunk-HRUKMGRH.js → chunk-UNKYMIVH.js} +3 -3
  114. package/dist/{chunk-YG3KWXGC.js → chunk-VRY3F35M.js} +7 -7
  115. package/dist/{chunk-FIJPDZIR.js → chunk-VWKCVBDJ.js} +26 -25
  116. package/dist/{chunk-NJNK3ZUC.js → chunk-WC3JA2Q3.js} +2 -2
  117. package/dist/{chunk-DRRFOQGF.js → chunk-WWBOST2M.js} +2 -2
  118. package/dist/{chunk-KQXKDF4N.js → chunk-WXVCXQKB.js} +6 -6
  119. package/dist/{chunk-LABBFTYJ.js → chunk-X4RHTBTI.js} +5 -5
  120. package/dist/{chunk-IV7WDCKS.js → chunk-Y5IBOWHQ.js} +1 -1
  121. package/dist/{chunk-2SMEEXDR.js → chunk-YAP7HQNG.js} +1 -1
  122. package/dist/{chunk-2TRYSF64.js → chunk-YH6DJA7F.js} +20 -1
  123. package/dist/{chunk-FP4W2EI6.js → chunk-YHXH4SDN.js} +11 -11
  124. package/dist/{chunk-V762IZHX.js → chunk-YJWMKS4K.js} +5 -3
  125. package/dist/{chunk-NWHMER6L.js → chunk-YPGLRH6E.js} +2 -2
  126. package/dist/{codex-app-cards-switch-TRZKDOVK.js → codex-app-cards-switch-2KIZJC4H.js} +11 -11
  127. package/dist/{codex-card-routing-QGOX4RNI.js → codex-card-routing-WWPQAJ4X.js} +2 -2
  128. package/dist/{codex-desktop-launch-AI5J526F.js → codex-desktop-launch-H325FPFI.js} +1 -1
  129. package/dist/{codex-session-launch-UWD7U2LW.js → codex-session-launch-IRN5OGXZ.js} +20 -20
  130. package/dist/{config-QIHLQCEV.js → config-IDRTM5J7.js} +3 -3
  131. package/dist/{global-upgrade-4K5SGI7Q.js → global-upgrade-DX4ZXLZ5.js} +9 -9
  132. package/dist/{identity-MRXHTKAC.js → identity-FZSHIS7P.js} +4 -4
  133. package/dist/{live-capabilities-PO5JOGZJ.js → live-capabilities-2DIRQWGQ.js} +4 -4
  134. package/dist/{paths-AXIBD5XG.js → paths-BQORCROG.js} +3 -3
  135. package/dist/{reapply-7FJNSGUM.js → reapply-7SA3FKAJ.js} +31 -31
  136. package/dist/src/index.js +35 -35
  137. package/dist/{upgrade-lock-G3RQPHYM.js → upgrade-lock-TKFFUNHB.js} +4 -4
  138. package/dist/{usage-GDUDYZSV.js → usage-XHC7EO7E.js} +3 -3
  139. package/package.json +1 -1
@@ -2,39 +2,39 @@ import {
2
2
  forgetPhoneApproval,
3
3
  rememberPhoneApproval,
4
4
  takePhoneApproval
5
- } from "./chunk-3GIVPZIS.js";
5
+ } from "./chunk-DOVLWIA4.js";
6
6
  import {
7
7
  claudeSettingsLocationFor,
8
8
  readClaudePermissionRules
9
- } from "./chunk-NWHMER6L.js";
9
+ } from "./chunk-YPGLRH6E.js";
10
10
  import {
11
11
  defersToNativeMode
12
- } from "./chunk-W4NCWOVL.js";
12
+ } from "./chunk-PYNRQFXB.js";
13
13
  import {
14
14
  askAgentQuestions,
15
15
  outcomeOfFailedAsk,
16
16
  storedWaitDeadline
17
- } from "./chunk-BKVQKWLY.js";
17
+ } from "./chunk-6RAM3F5N.js";
18
18
  import {
19
19
  reportMachineDenial
20
- } from "./chunk-JE6NVEOE.js";
20
+ } from "./chunk-3O42YMMA.js";
21
21
  import {
22
22
  isGatingMoment,
23
23
  recordKeylessMoment
24
- } from "./chunk-2SMEEXDR.js";
24
+ } from "./chunk-YAP7HQNG.js";
25
25
  import {
26
26
  isAdmitted,
27
27
  readAdmissionRules
28
- } from "./chunk-5HT352IV.js";
28
+ } from "./chunk-HLDDLBXI.js";
29
29
  import {
30
30
  isDeferAnswer,
31
31
  oncePerSession
32
- } from "./chunk-CUWHBFBB.js";
32
+ } from "./chunk-RHOZMBEL.js";
33
33
  import {
34
34
  activeHookSource,
35
35
  activeIdentity,
36
36
  namedSource
37
- } from "./chunk-W46HI6T3.js";
37
+ } from "./chunk-37EEYMUJ.js";
38
38
  import {
39
39
  DEFAULT_SESSION,
40
40
  approvalAwaitingRetry,
@@ -57,7 +57,7 @@ import {
57
57
  settleQuestionsForToolUse,
58
58
  sweepFilesOlderThan,
59
59
  userScope
60
- } from "./chunk-FIJPDZIR.js";
60
+ } from "./chunk-VWKCVBDJ.js";
61
61
  import {
62
62
  UNNAMED_ACTION,
63
63
  deriveAction,
@@ -68,12 +68,7 @@ import {
68
68
  patchDeletesFiles,
69
69
  permissionDeniedAction,
70
70
  scopePathFor
71
- } from "./chunk-CFZUESTS.js";
72
- import {
73
- branchFor,
74
- repoKeyFor,
75
- repositoryScopeFor
76
- } from "./chunk-2TRYSF64.js";
71
+ } from "./chunk-D3U46VX5.js";
77
72
  import {
78
73
  askUser,
79
74
  cancelQuestion,
@@ -90,23 +85,29 @@ import {
90
85
  waitForQuestion,
91
86
  waitsForThePhone,
92
87
  withdrawQuestion
93
- } from "./chunk-PQEX64YL.js";
88
+ } from "./chunk-EH7M4CXB.js";
89
+ import {
90
+ branchFor,
91
+ projectNameFor,
92
+ repoKeyFor,
93
+ repositoryScopeFor
94
+ } from "./chunk-YH6DJA7F.js";
94
95
  import {
95
96
  getMachineId
96
- } from "./chunk-MJMRJ5ZF.js";
97
+ } from "./chunk-5DEG6XEK.js";
97
98
  import {
98
99
  POSTTOOLUSE_MIRRORED_TOOLS
99
- } from "./chunk-DRRFOQGF.js";
100
+ } from "./chunk-WWBOST2M.js";
100
101
  import {
101
102
  getApiKey,
102
103
  getBaseUrl
103
- } from "./chunk-A2DVMIX4.js";
104
+ } from "./chunk-LYC7OGLM.js";
104
105
  import {
105
106
  writeFileAtomic
106
107
  } from "./chunk-PM2NRK6Y.js";
107
108
  import {
108
109
  NPX_LATEST_COMMAND
109
- } from "./chunk-IV7WDCKS.js";
110
+ } from "./chunk-Y5IBOWHQ.js";
110
111
  import {
111
112
  AGENT_QUESTION_STRATEGY,
112
113
  AGENT_QUESTION_TOOL,
@@ -140,6 +141,7 @@ import {
140
141
  claudePermissionRequestOutput,
141
142
  claudePreToolUseOutput,
142
143
  claudePromptTakesTheCall,
144
+ claudeQuestionAnswers,
143
145
  claudeStoppedPermissionRequestOutput,
144
146
  claudeStoppedPreToolUseOutput,
145
147
  denyReasonFrom,
@@ -152,6 +154,7 @@ import {
152
154
  hookWaitClamped,
153
155
  hookWaitDeadline,
154
156
  hookWritePath,
157
+ isApprovedOnlyAtPermissionRequest,
155
158
  isBlockedActionRequest,
156
159
  isClaudeRefusalsOnlyTool,
157
160
  isCursorHookPayload,
@@ -177,7 +180,7 @@ import {
177
180
  timeoutActionWithoutLocalPrompt,
178
181
  unansweredRefusalReason,
179
182
  unapprovedScopeReason
180
- } from "./chunk-L77OIGRB.js";
183
+ } from "./chunk-DJHPBM5S.js";
181
184
 
182
185
  // src/terminal-answer-watch.ts
183
186
  import { closeSync, openSync, readSync, statSync } from "fs";
@@ -294,9 +297,6 @@ var reportDecisionEpisode = async (apiKey, input) => {
294
297
  }
295
298
  };
296
299
 
297
- // src/hook.ts
298
- import { basename } from "path";
299
-
300
300
  // src/pre-tool-use-output.ts
301
301
  var allow = (reason) => claudePreToolUseOutput("allow", reason);
302
302
  var deny = (reason) => claudePreToolUseOutput("deny", reason);
@@ -585,7 +585,7 @@ var outcomeOfDispatch = (decided) => {
585
585
  };
586
586
  var dispatchModeDecision = async (apiKey, input, toolPolicy, machineId, trainingConsent = false, scopeReason, scopePath, terminalLive, askReason, matchedRoute) => {
587
587
  const description = describeToolCall(input.tool_name, input.tool_input, "hook");
588
- const projectName = basename(input.cwd ?? process.cwd());
588
+ const projectName = projectNameFor(input.cwd);
589
589
  const sessionId = input.session_id;
590
590
  const toolTarget = deriveToolTarget(input.tool_name, input.tool_input);
591
591
  const ownPrompt = hasItsOwnApprovalPrompt(ACTIVE_SOURCE);
@@ -697,7 +697,7 @@ var handleAskUserQuestion = async (apiKey, input, modeState) => {
697
697
  if (questionHandedToTheTerminal(input.tool_name, modeState)) return void 0;
698
698
  const questions = parseAgentQuestions(input.tool_input ?? {});
699
699
  if (!questions) return void 0;
700
- const projectName = basename(input.cwd ?? process.cwd());
700
+ const projectName = projectNameFor(input.cwd);
701
701
  const deadline = hookWaitDeadline(START_MS, effectiveWaitSeconds("wait", 0, "claude"), "claude", Date.now());
702
702
  const outcome = await askAgentQuestions(apiKey, {
703
703
  toolName: AGENT_QUESTION_TOOL,
@@ -709,7 +709,7 @@ var handleAskUserQuestion = async (apiKey, input, modeState) => {
709
709
  }, questions);
710
710
  switch (outcome.kind) {
711
711
  case "answered":
712
- return allowWithInput({ ...input.tool_input ?? {}, answers: outcome.answers });
712
+ return allowWithInput({ ...input.tool_input ?? {}, answers: claudeQuestionAnswers(questions, outcome.answers) });
713
713
  case "stopped":
714
714
  case "unavailable":
715
715
  return halted(DECISION_STOP_REASON);
@@ -719,13 +719,13 @@ var handleAskUserQuestion = async (apiKey, input, modeState) => {
719
719
  };
720
720
  var PLAN_APPROVE = "Approve, start coding";
721
721
  var PLAN_KEEP_PLANNING = "Keep planning";
722
- var handleExitPlanMode = async (apiKey, input) => {
722
+ var askThePlanQuestion = async (apiKey, input) => {
723
723
  const toolInput = input.tool_input ?? {};
724
- const projectName = basename(input.cwd ?? process.cwd());
724
+ const projectName = projectNameFor(input.cwd);
725
725
  const deadline = hookWaitDeadline(START_MS, effectiveWaitSeconds("wait", 0, "claude"), "claude", Date.now());
726
- let result;
726
+ let question;
727
727
  try {
728
- result = await askUser(apiKey, {
728
+ question = await askUser(apiKey, {
729
729
  question: `Approve the plan and start coding in ${projectName}?`,
730
730
  type: "select",
731
731
  options: [PLAN_APPROVE, PLAN_KEEP_PLANNING],
@@ -743,17 +743,34 @@ var handleExitPlanMode = async (apiKey, input) => {
743
743
  waitEndsAt: new Date(deadline).toISOString()
744
744
  });
745
745
  } catch (error) {
746
- return outcomeOfFailedAsk(error, input.session_id, halted(DECISION_STOP_REASON));
746
+ return { kind: "settled", answer: outcomeOfFailedAsk(error, input.session_id, "failed") ?? "unanswered" };
747
747
  }
748
- if (isDecisionStopped(result)) return halted(DECISION_STOP_REASON);
749
- const answer = await waitForQuestion(apiKey, result, storedWaitDeadline(result, deadline));
750
- if (isDecisionStopped(answer)) return halted(DECISION_STOP_REASON);
748
+ if (isDecisionStopped(question)) return { kind: "settled", answer: "stopped" };
749
+ return { kind: "asked", question, deadline: storedWaitDeadline(question, deadline) };
750
+ };
751
+ var planAnswerOf = async (apiKey, question, deadline, signal) => {
752
+ const answer = await waitForQuestion(apiKey, question, deadline, void 0, signal);
753
+ if (isDecisionStopped(answer)) return "stopped";
751
754
  const value = answer.answered ? (answer.value ?? "").trim() : "";
752
- if (!value || isDeferAnswer(answer.value)) {
753
- return void 0;
755
+ if (!value || isDeferAnswer(answer.value)) return "unanswered";
756
+ return value === PLAN_APPROVE ? "approved" : "declined";
757
+ };
758
+ var preToolUsePlanOutput = (answer) => {
759
+ switch (answer) {
760
+ case "approved":
761
+ return allow();
762
+ case "declined":
763
+ return deny(PLAN_DECLINED_REASON);
764
+ case "stopped":
765
+ case "failed":
766
+ return halted(DECISION_STOP_REASON);
767
+ case "unanswered":
768
+ return void 0;
754
769
  }
755
- if (value === PLAN_APPROVE) return allow();
756
- return deny(PLAN_DECLINED_REASON);
770
+ };
771
+ var handleExitPlanMode = async (apiKey, input) => {
772
+ const plan = await askThePlanQuestion(apiKey, input);
773
+ return preToolUsePlanOutput(plan.kind === "settled" ? plan.answer : await planAnswerOf(apiKey, plan.question, plan.deadline));
757
774
  };
758
775
  var handleKeyless = (input) => {
759
776
  try {
@@ -761,7 +778,7 @@ var handleKeyless = (input) => {
761
778
  recordKeylessMoment({
762
779
  ts: Date.now(),
763
780
  tool: input.tool_name,
764
- project: basename(input.cwd ?? process.cwd()),
781
+ project: projectNameFor(input.cwd),
765
782
  sessionId: input.session_id
766
783
  });
767
784
  }
@@ -931,6 +948,7 @@ var decidePreToolUse = async (input, canonical) => {
931
948
  if (input.tool_name === "AskUserQuestion") {
932
949
  return settledAs("asked", await handleAskUserQuestion(apiKey, input, modeState));
933
950
  }
951
+ if (isApprovedOnlyAtPermissionRequest(ACTIVE_SOURCE, input.tool_name)) return settledAs("native_mode", void 0);
934
952
  if (input.tool_name === "ExitPlanMode") {
935
953
  return settledAs("asked", await handleExitPlanMode(apiKey, input));
936
954
  }
@@ -981,10 +999,35 @@ var toPermissionRequestOutput = (hookOutput) => {
981
999
  return void 0;
982
1000
  };
983
1001
  var answerOfTheReplay = (replayed) => replayed.humanDecision ? toPermissionRequestOutput(replayed.result) : void 0;
1002
+ var permissionRequestPlanOutput = (answer, plan) => {
1003
+ switch (answer) {
1004
+ case "approved":
1005
+ return permReqAllow(plan);
1006
+ case "declined":
1007
+ return permReqDeny(PLAN_DECLINED_REASON);
1008
+ case "stopped":
1009
+ return permReqDeny(DECISION_STOP_REASON);
1010
+ case "failed":
1011
+ case "unanswered":
1012
+ return void 0;
1013
+ }
1014
+ };
1015
+ var answerThePlanBesideTheDialog = async (apiKey, input) => {
1016
+ const toolInput = input.tool_input ?? {};
1017
+ const plan = await askThePlanQuestion(apiKey, input);
1018
+ if (plan.kind === "settled") return permissionRequestPlanOutput(plan.answer, toolInput);
1019
+ const stop = new AbortController();
1020
+ const first = await Promise.race([planAnswerOf(apiKey, plan.question, plan.deadline, stop.signal), terminalAnswered(input, stop.signal)]).finally(() => stop.abort());
1021
+ if (first === TERMINAL_ANSWERED) {
1022
+ await withdrawQuestion(apiKey, plan.question.correlationId);
1023
+ return void 0;
1024
+ }
1025
+ return permissionRequestPlanOutput(first, toolInput);
1026
+ };
984
1027
  var handlePermissionRequest = async (input, canonical, holdBudgetSeconds) => {
985
1028
  if (isPusharyOwnOrConnectorTool(input.tool_name)) return permReqAllow();
986
1029
  const claudeRules = claudePermissionRulesFor(input);
987
- if (canonical === void 0 && !claudeRulesMayCover(input, claudeRules) && isPermissionRequestOwnedByPreToolUse(input.tool_name, input.permission_mode, shouldDeferToNativeMode) && !terminalStaysLiveForTheCall(terminalLiveFactsOf(input))) return void 0;
1030
+ if (canonical === void 0 && !claudeRulesMayCover(input, claudeRules) && isPermissionRequestOwnedByPreToolUse(ACTIVE_SOURCE, input.tool_name, input.permission_mode, shouldDeferToNativeMode) && !terminalStaysLiveForTheCall(terminalLiveFactsOf(input))) return void 0;
988
1031
  let apiKey;
989
1032
  try {
990
1033
  apiKey = getApiKey();
@@ -1007,6 +1050,7 @@ var handlePermissionRequest = async (input, canonical, holdBudgetSeconds) => {
1007
1050
  if (canonical === null) return permReqDeny(UNREADABLE_CALL_REASON);
1008
1051
  if (isMcpCallInClaudeCode(input) && claimMcpHoldHandback(blockedActionFingerprintFor(input))) return void 0;
1009
1052
  if (agentQuestionStrategy(ACTIVE_SOURCE, "PermissionRequest", input.tool_name) === AGENT_QUESTION_STRATEGY.native) return void 0;
1053
+ if (isApprovedOnlyAtPermissionRequest(ACTIVE_SOURCE, input.tool_name)) return await answerThePlanBesideTheDialog(apiKey, input);
1010
1054
  if (verdict.kind === "gate" && verdict.scopeReason && (canonical?.toolInputs.length ?? 0) > 1) return permReqDeny(SCOPE_BATCH_REASON);
1011
1055
  const approvedCall = PHONE_APPROVAL_SOURCE ? takePhoneApproval(PHONE_APPROVAL_SOURCE, input) : void 0;
1012
1056
  const preToolUseAllowLeftThePrompt = PHONE_APPROVAL_SOURCE !== null && (verdict.kind === "allow" || approvedCall !== void 0);
@@ -1015,7 +1059,7 @@ var handlePermissionRequest = async (input, canonical, holdBudgetSeconds) => {
1015
1059
  const scopeQuestion = verdict.kind === "gate" && Boolean(verdict.scopeReason);
1016
1060
  const preToolUseRanForTheCall = PRETOOLUSE_HANDLED_TOOLS.has(input.tool_name) && isAdmitted(readAdmissionRules(), "claude", "PreToolUse");
1017
1061
  const preToolUseAskedTheScopeQuestion = scopeQuestion && terminalLive && preToolUseRanForTheCall;
1018
- const preToolUseOwnsTheCall = !scopeQuestion && !preToolUseAllowLeftThePrompt && !claudeAllowlistOwnsCall(gateInput, verdict, input.permission_mode, claudeRules) && (isPermissionRequestOwnedByPreToolUse(input.tool_name, input.permission_mode, shouldDeferToNativeMode) || preToolUseRanForTheCall && approvalRouteOutranksAutoMode(gateInput, verdict, input.permission_mode));
1062
+ const preToolUseOwnsTheCall = !scopeQuestion && !preToolUseAllowLeftThePrompt && !claudeAllowlistOwnsCall(gateInput, verdict, input.permission_mode, claudeRules) && (isPermissionRequestOwnedByPreToolUse(ACTIVE_SOURCE, input.tool_name, input.permission_mode, shouldDeferToNativeMode) || preToolUseRanForTheCall && approvalRouteOutranksAutoMode(gateInput, verdict, input.permission_mode));
1019
1063
  if (!handedOff && (preToolUseAskedTheScopeQuestion || preToolUseOwnsTheCall)) return void 0;
1020
1064
  const terminalLiveDispatch = handedOff ? { holdBudgetSeconds } : void 0;
1021
1065
  switch (verdict.kind) {
@@ -1044,7 +1088,7 @@ var reportPermissionDenied = (input) => reportEvent({
1044
1088
  occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
1045
1089
  toolUseId: input.tool_use_id,
1046
1090
  agentType: ACTIVE_AGENT.type,
1047
- agentName: agentNameIn(basename(input.cwd ?? process.cwd())),
1091
+ agentName: agentNameIn(projectNameFor(input.cwd)),
1048
1092
  action: permissionDeniedAction(input.tool_name),
1049
1093
  sessionId: input.session_id,
1050
1094
  ...permissionModeOf(input)
@@ -1061,7 +1105,7 @@ var notifyPermissionDenied = async (apiKey, input) => {
1061
1105
  if (claimThrottle(`permdenied:${sessionKey}:${input.tool_name}`, PERMISSION_DENIED_NOTICE_WINDOW_MS) !== "passed") return;
1062
1106
  const mode = await fetchModeState(apiKey, input.session_id).catch(() => null);
1063
1107
  if (mode?.kill || mode?.mode === "terminal_only") return;
1064
- const projectName = basename(input.cwd ?? process.cwd());
1108
+ const projectName = projectNameFor(input.cwd);
1065
1109
  await sendNotification(apiKey, {
1066
1110
  title: `Auto mode blocked ${input.tool_name}`,
1067
1111
  body: `Your agent was denied ${input.tool_name} in ${projectName}.`,
@@ -1,33 +1,33 @@
1
1
  import {
2
2
  MANAGED_CLAUDE_SETTINGS_BY_PLATFORM
3
- } from "./chunk-NWHMER6L.js";
3
+ } from "./chunk-YPGLRH6E.js";
4
4
  import {
5
5
  declinedAgentsFile,
6
6
  readDeclinedAgents
7
- } from "./chunk-Y54VMOE5.js";
7
+ } from "./chunk-AN7252SG.js";
8
8
  import {
9
9
  OPENCODE_HOOK_BINARY,
10
10
  openCodeConfigDir,
11
11
  openCodePluginFile
12
- } from "./chunk-KQXKDF4N.js";
12
+ } from "./chunk-WXVCXQKB.js";
13
13
  import {
14
14
  openCodePluginArgv
15
- } from "./chunk-UCND4JHN.js";
15
+ } from "./chunk-H75BEIQN.js";
16
16
  import {
17
17
  liveCursorGateCoverage
18
- } from "./chunk-I72TVBOG.js";
18
+ } from "./chunk-S7AT7T7H.js";
19
19
  import {
20
20
  compatibleConfigFile,
21
21
  compatibleHookEvents,
22
22
  grokHome,
23
23
  parseConfigDocument
24
- } from "./chunk-W46HI6T3.js";
24
+ } from "./chunk-37EEYMUJ.js";
25
25
  import {
26
26
  DEFAULT_HOOKS_KEY_PATH,
27
27
  GEMINI_HOOK_BINARY,
28
28
  GEMINI_HOOK_EVENTS,
29
29
  hooksAt
30
- } from "./chunk-5EU7V5CT.js";
30
+ } from "./chunk-MFNSTUPF.js";
31
31
  import {
32
32
  CODEX_EARLIER_APPROVAL_MATCHERS,
33
33
  CODEX_HOOK_BINARY,
@@ -55,7 +55,7 @@ import {
55
55
  parseHookArgv,
56
56
  parseHookCommand,
57
57
  supportedClaudeEvents
58
- } from "./chunk-DRRFOQGF.js";
58
+ } from "./chunk-WWBOST2M.js";
59
59
  import {
60
60
  readRegularJsonFile,
61
61
  readRegularTextFile
@@ -69,7 +69,7 @@ import {
69
69
  OPENCODE_APPROVAL_EVENT,
70
70
  isRecord,
71
71
  matcherMatchesEveryCall
72
- } from "./chunk-L77OIGRB.js";
72
+ } from "./chunk-DJHPBM5S.js";
73
73
 
74
74
  // src/hook-wiring.ts
75
75
  import { createHash } from "crypto";
@@ -9,7 +9,7 @@ import {
9
9
  installedCodexApp,
10
10
  readCodexAppRuntime,
11
11
  shellQuoted
12
- } from "./chunk-FCNYCY6G.js";
12
+ } from "./chunk-NIYGTZZ4.js";
13
13
  import {
14
14
  CODEX_APP_LAUNCH_AT_LOGIN_VERB,
15
15
  CODEX_APP_LAUNCH_VARIABLE
@@ -19,7 +19,7 @@ import {
19
19
  } from "./chunk-QCGNGEGE.js";
20
20
  import {
21
21
  xml
22
- } from "./chunk-JUE347Z7.js";
22
+ } from "./chunk-GT4GUCCK.js";
23
23
  import {
24
24
  writeFileAtomic
25
25
  } from "./chunk-PM2NRK6Y.js";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  RETRY_ACK,
6
6
  refusedReceiptMessage
7
- } from "./chunk-GVIKF73A.js";
7
+ } from "./chunk-3TGLZAON.js";
8
8
 
9
9
  // src/command-receipts.ts
10
10
  import { randomUUID } from "crypto";
@@ -4,10 +4,10 @@ import {
4
4
  } from "./chunk-55L4JSPA.js";
5
5
  import {
6
6
  fetchAsCredential
7
- } from "./chunk-SSKNRWWS.js";
7
+ } from "./chunk-OQVTK7HS.js";
8
8
  import {
9
9
  getBaseUrl
10
- } from "./chunk-A2DVMIX4.js";
10
+ } from "./chunk-LYC7OGLM.js";
11
11
  import {
12
12
  writeJsonAtomicDurable
13
13
  } from "./chunk-PM2NRK6Y.js";
@@ -15,7 +15,7 @@ import {
15
15
  compressTranscriptRecord,
16
16
  redactSecretsFromContent,
17
17
  transcriptRecordPlaintext
18
- } from "./chunk-L77OIGRB.js";
18
+ } from "./chunk-DJHPBM5S.js";
19
19
 
20
20
  // src/transcript-recipient-pin.ts
21
21
  import { createHash } from "crypto";
@@ -2,31 +2,31 @@ import {
2
2
  SIGNED_OUT_ON_MAC_MESSAGE,
3
3
  describeSignedOutKey,
4
4
  readSignedOutDiagnosis
5
- } from "./chunk-LEAACRFN.js";
5
+ } from "./chunk-HB2EJOEM.js";
6
6
  import {
7
7
  APPROVAL_RULES_PATH
8
- } from "./chunk-D6OCHPLT.js";
8
+ } from "./chunk-OZBNNBZG.js";
9
9
  import {
10
10
  createIo
11
- } from "./chunk-DXUPOVJP.js";
11
+ } from "./chunk-6L5Q4I4V.js";
12
12
  import {
13
13
  absoluteUrl,
14
14
  checkApiKey,
15
15
  describeKeyCheck,
16
16
  keyCheckFromResponse
17
- } from "./chunk-IYTTLDB5.js";
17
+ } from "./chunk-SFXASSHE.js";
18
18
  import {
19
19
  readKeySource
20
- } from "./chunk-7XSZK4DH.js";
20
+ } from "./chunk-NGXZD5B2.js";
21
21
  import {
22
22
  getBaseUrl
23
- } from "./chunk-A2DVMIX4.js";
23
+ } from "./chunk-LYC7OGLM.js";
24
24
  import {
25
25
  EXIT
26
26
  } from "./chunk-BG4HHB7E.js";
27
27
  import {
28
28
  KEY_SCOPE
29
- } from "./chunk-L77OIGRB.js";
29
+ } from "./chunk-DJHPBM5S.js";
30
30
 
31
31
  // src/cli/report-key.ts
32
32
  var { dim, yellow } = createIo();
@@ -27,11 +27,7 @@ import {
27
27
  toolResultErrorText,
28
28
  transcriptTokensIn,
29
29
  transcriptUsageRequest
30
- } from "./chunk-CFZUESTS.js";
31
- import {
32
- branchFor,
33
- repoKeyFor
34
- } from "./chunk-2TRYSF64.js";
30
+ } from "./chunk-D3U46VX5.js";
35
31
  import {
36
32
  cancelQuestion,
37
33
  clientErrorKindOf,
@@ -39,39 +35,44 @@ import {
39
35
  reportClientError,
40
36
  sendNotification,
41
37
  waitForAnswer
42
- } from "./chunk-PQEX64YL.js";
38
+ } from "./chunk-EH7M4CXB.js";
43
39
  import {
44
40
  RETRY_ACK,
45
41
  readCommandAck,
46
42
  refusedReceiptMessage
47
- } from "./chunk-GVIKF73A.js";
43
+ } from "./chunk-3TGLZAON.js";
48
44
  import {
49
45
  isRetryable,
50
46
  withRetry
51
- } from "./chunk-EGDFXMFK.js";
47
+ } from "./chunk-GHTQ7IAZ.js";
52
48
  import {
53
49
  fetchAsCredential
54
- } from "./chunk-SSKNRWWS.js";
50
+ } from "./chunk-OQVTK7HS.js";
51
+ import {
52
+ branchFor,
53
+ projectNameFor,
54
+ repoKeyFor
55
+ } from "./chunk-YH6DJA7F.js";
55
56
  import {
56
57
  getMachineId
57
- } from "./chunk-MJMRJ5ZF.js";
58
+ } from "./chunk-5DEG6XEK.js";
58
59
  import {
59
60
  reportedInstallSource
60
- } from "./chunk-3I3RUJRD.js";
61
+ } from "./chunk-3FMW4G3B.js";
61
62
  import {
62
63
  IDLE_PROMPT_NOTIFICATION,
63
64
  NOTIFICATION_PUSH_TYPES,
64
65
  POSTTOOLUSE_MIRROR_ONLY_TOOLS,
65
66
  claudeConfigDir
66
- } from "./chunk-DRRFOQGF.js";
67
+ } from "./chunk-WWBOST2M.js";
67
68
  import {
68
69
  compareVersion,
69
70
  parseVersion
70
- } from "./chunk-D3TNLVVL.js";
71
+ } from "./chunk-PBPF46MM.js";
71
72
  import {
72
73
  getApiKey,
73
74
  getBaseUrl
74
- } from "./chunk-A2DVMIX4.js";
75
+ } from "./chunk-LYC7OGLM.js";
75
76
  import {
76
77
  writeFileAtomic,
77
78
  writeJsonAtomicDurable
@@ -102,7 +103,7 @@ import {
102
103
  resolveAutoResolveOrigin,
103
104
  resolvePolicy,
104
105
  unansweredRefusalReason
105
- } from "./chunk-L77OIGRB.js";
106
+ } from "./chunk-DJHPBM5S.js";
106
107
 
107
108
  // src/pending.ts
108
109
  import { join } from "path";
@@ -1240,7 +1241,7 @@ var takeGateOutcome = (toolUseId) => {
1240
1241
  };
1241
1242
 
1242
1243
  // src/events.ts
1243
- import { basename, join as join10 } from "path";
1244
+ import { join as join10 } from "path";
1244
1245
  import { existsSync as existsSync5, mkdirSync as mkdirSync7, readFileSync as readFileSync8, statSync as statSync7, writeFileSync as writeFileSync8 } from "fs";
1245
1246
  import { tmpdir as tmpdir9 } from "os";
1246
1247
  var INTENT_DIR = join10(tmpdir9(), "pushary-intent");
@@ -1565,7 +1566,7 @@ var handlePostToolUse = async (input, agent = CLAUDE_CODE_AGENT) => {
1565
1566
  const deadline = Date.now() + HOOK_BUDGET_MS;
1566
1567
  const signal = AbortSignal.timeout(HOOK_BUDGET_MS);
1567
1568
  try {
1568
- const projectName = basename(input.cwd ?? process.cwd());
1569
+ const projectName = projectNameFor(input.cwd);
1569
1570
  const action = describeToolCall(input.tool_name, input.tool_input, "event");
1570
1571
  const lookup = toPolicyLookup(input.tool_name, input.tool_input);
1571
1572
  const toolResult = input.tool_response ?? input.tool_result;
@@ -1635,7 +1636,7 @@ var handleUserPrompt = async (input, agent = CLAUDE_CODE_AGENT) => {
1635
1636
  const deadline = Date.now() + HOOK_BUDGET_MS;
1636
1637
  const signal = AbortSignal.timeout(HOOK_BUDGET_MS);
1637
1638
  try {
1638
- const projectName = basename(input.cwd ?? process.cwd());
1639
+ const projectName = projectNameFor(input.cwd);
1639
1640
  const sessionKey = input.session_id || DEFAULT_SESSION;
1640
1641
  const titlesEnabled = process.env.PUSHARY_TASK_TITLES !== "off";
1641
1642
  const taskTitle = titlesEnabled ? taskTitleFrom(input.prompt) : void 0;
@@ -1675,7 +1676,7 @@ var handleStop = async (input, agent = CLAUDE_CODE_AGENT) => {
1675
1676
  const deadline = Date.now() + HOOK_BUDGET_MS;
1676
1677
  const signal = AbortSignal.timeout(HOOK_BUDGET_MS);
1677
1678
  try {
1678
- const projectName = basename(input.cwd ?? process.cwd());
1679
+ const projectName = projectNameFor(input.cwd);
1679
1680
  const sessionKey = input.session_id || DEFAULT_SESSION;
1680
1681
  noteBackgroundWork(sessionKey, hasRunningBackgroundTasks(input.background_tasks));
1681
1682
  const late = await reconcilePendingQuestions(sessionKey, void 0, signal);
@@ -1717,7 +1718,7 @@ var isSubagentStop = (input) => input.hook_event_name === "SubagentStop" || type
1717
1718
  var SUBAGENT_STOP_REPORT_TIMEOUT_MS = 4e3;
1718
1719
  var handleSubagentStop = async (input, agent = CLAUDE_CODE_AGENT) => {
1719
1720
  try {
1720
- const projectName = basename(input.cwd ?? process.cwd());
1721
+ const projectName = projectNameFor(input.cwd);
1721
1722
  await reportEvent({
1722
1723
  event: "session_end",
1723
1724
  agentType: agent.type,
@@ -1736,7 +1737,7 @@ var isCompactionEvent = (hookEventName) => hookEventName === "PreCompact" || hoo
1736
1737
  var COMPACTION_REPORT_TIMEOUT_MS = 4e3;
1737
1738
  var handleCompaction = async (input, agent = CLAUDE_CODE_AGENT) => {
1738
1739
  try {
1739
- const projectName = basename(input.cwd ?? process.cwd());
1740
+ const projectName = projectNameFor(input.cwd);
1740
1741
  await reportEvent({
1741
1742
  event: "compaction",
1742
1743
  agentType: agent.type,
@@ -1750,7 +1751,7 @@ var handleCompaction = async (input, agent = CLAUDE_CODE_AGENT) => {
1750
1751
  };
1751
1752
  var handleSessionStart = async (input, agent = CLAUDE_CODE_AGENT) => {
1752
1753
  try {
1753
- const projectName = basename(input.cwd ?? process.cwd());
1754
+ const projectName = projectNameFor(input.cwd);
1754
1755
  const action = input.agent_id ? "Subagent started" : sessionStartAction(input.source);
1755
1756
  await reportEvent({
1756
1757
  event: "session_start",
@@ -1765,7 +1766,7 @@ var handleSessionStart = async (input, agent = CLAUDE_CODE_AGENT) => {
1765
1766
  };
1766
1767
  var handleSessionEnd = async (input, agent = CLAUDE_CODE_AGENT, options = {}) => {
1767
1768
  try {
1768
- const projectName = basename(input.cwd ?? process.cwd());
1769
+ const projectName = projectNameFor(input.cwd);
1769
1770
  const action = sessionEndAction(input.reason);
1770
1771
  const sessionKey = input.session_id || DEFAULT_SESSION;
1771
1772
  if (options.reconcile ?? true) {
@@ -1794,7 +1795,7 @@ var pushesNotification = (notifType, sessionKey) => NOTIFICATION_PUSH_TYPES.has(
1794
1795
  var handleNotification = async (input, agent = CLAUDE_CODE_AGENT) => {
1795
1796
  const signal = AbortSignal.timeout(HOOK_BUDGET_MS);
1796
1797
  try {
1797
- const projectName = basename(input.cwd ?? process.cwd());
1798
+ const projectName = projectNameFor(input.cwd);
1798
1799
  const notifType = notificationTypeOf(input) ?? "";
1799
1800
  const sessionKey = input.session_id || DEFAULT_SESSION;
1800
1801
  const teammateIdle = input.hook_event_name === "TeammateIdle";
@@ -1856,7 +1857,7 @@ var handleStopFailure = async (input, agent = CLAUDE_CODE_AGENT) => {
1856
1857
  } catch {
1857
1858
  return;
1858
1859
  }
1859
- const projectName = basename(input.cwd ?? process.cwd());
1860
+ const projectName = projectNameFor(input.cwd);
1860
1861
  const reason = describeStopFailure(input.error);
1861
1862
  await reportEvent({
1862
1863
  event: "turn_error",
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-DRRFOQGF.js";
3
+ } from "./chunk-WWBOST2M.js";
4
4
  import {
5
5
  readJsonSafe
6
6
  } from "./chunk-PM2NRK6Y.js";
7
7
  import {
8
8
  isRecord
9
- } from "./chunk-L77OIGRB.js";
9
+ } from "./chunk-DJHPBM5S.js";
10
10
 
11
11
  // src/process-ownership.ts
12
12
  import { createHash, randomUUID } from "crypto";
@@ -3,7 +3,7 @@ import {
3
3
  formatVersion,
4
4
  quoteIfNeeded,
5
5
  shellDoubleQuoted
6
- } from "./chunk-D3TNLVVL.js";
6
+ } from "./chunk-PBPF46MM.js";
7
7
  import {
8
8
  writeFileAtomic
9
9
  } from "./chunk-PM2NRK6Y.js";
@@ -22,7 +22,7 @@ import {
22
22
  PUSHARY_HOSTS,
23
23
  PUSHARY_TOOL_PREFIX,
24
24
  withHookHoldBudget
25
- } from "./chunk-L77OIGRB.js";
25
+ } from "./chunk-DJHPBM5S.js";
26
26
 
27
27
  // src/setup/paths.ts
28
28
  import { createHash as createHash2 } from "crypto";