pushary 1.9.174 → 1.9.176

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 (140) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/{api-MNYX7TLY.js → api-HKDF4HUI.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 -12
  6. package/dist/bin/pushary-calls.js +15 -15
  7. package/dist/bin/pushary-claude.js +27 -27
  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 +36 -36
  11. package/dist/bin/pushary-codex-session.js +8 -8
  12. package/dist/bin/pushary-codex.js +16 -16
  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 +45 -45
  16. package/dist/bin/pushary-disconnect.js +29 -29
  17. package/dist/bin/pushary-display-hook.js +4 -1
  18. package/dist/bin/pushary-doctor.js +46 -46
  19. package/dist/bin/pushary-elicitation-hook.js +28 -28
  20. package/dist/bin/pushary-gemini-bridge.js +18 -18
  21. package/dist/bin/pushary-gemini-hook.js +32 -32
  22. package/dist/bin/pushary-hook.js +36 -36
  23. package/dist/bin/pushary-login.js +22 -22
  24. package/dist/bin/pushary-logout.js +29 -29
  25. package/dist/bin/pushary-mcp.js +12 -12
  26. package/dist/bin/pushary-mode.js +16 -16
  27. package/dist/bin/pushary-notification-hook.js +27 -27
  28. package/dist/bin/pushary-opencode-hook.js +33 -33
  29. package/dist/bin/pushary-permission-denied-hook.js +36 -36
  30. package/dist/bin/pushary-permission-hook.js +36 -36
  31. package/dist/bin/pushary-post-hook.js +28 -28
  32. package/dist/bin/pushary-prompt-hook.js +27 -27
  33. package/dist/bin/pushary-session-end-hook.js +27 -27
  34. package/dist/bin/pushary-session-start-hook.js +38 -38
  35. package/dist/bin/pushary-sessions.js +14 -14
  36. package/dist/bin/pushary-setup.js +54 -54
  37. package/dist/bin/pushary-stats.js +5 -5
  38. package/dist/bin/pushary-status.js +35 -35
  39. package/dist/bin/pushary-stop-hook.js +27 -27
  40. package/dist/bin/pushary-stopfailure-hook.js +27 -27
  41. package/dist/bin/pushary-suggestions.js +16 -16
  42. package/dist/bin/pushary-transcript-register.js +17 -17
  43. package/dist/bin/pushary-transcripts.js +25 -25
  44. package/dist/bin/pushary-upgrade.js +43 -43
  45. package/dist/bin/pushary-wait.js +16 -16
  46. package/dist/bin/pushary.js +7 -7
  47. package/dist/{chunk-PDIN6FE5.js → chunk-22YIXSYO.js} +1 -1
  48. package/dist/{chunk-GTCNACQ2.js → chunk-2QAYI67U.js} +5 -5
  49. package/dist/{chunk-PWJ76P2L.js → chunk-32B47XDJ.js} +6 -6
  50. package/dist/{chunk-IQNM745W.js → chunk-33LHUEVR.js} +2 -2
  51. package/dist/{chunk-6HYQSAMW.js → chunk-35G4EP75.js} +2 -2
  52. package/dist/{chunk-7VG4JO77.js → chunk-37MNIPTT.js} +4 -4
  53. package/dist/{chunk-3L5DXDPK.js → chunk-3G5MYQAW.js} +1 -1
  54. package/dist/{chunk-XZOYXQ6J.js → chunk-3YRDILR5.js} +5 -5
  55. package/dist/{chunk-MF6FSDM4.js → chunk-3ZYXWHVC.js} +2 -2
  56. package/dist/{chunk-K5NBHOE6.js → chunk-4632OXAT.js} +2 -2
  57. package/dist/{chunk-2IEU6RX5.js → chunk-47CLYXO4.js} +1 -1
  58. package/dist/{chunk-7XALAS43.js → chunk-4CGAP5FK.js} +2 -2
  59. package/dist/{chunk-5LIGHRBH.js → chunk-4HBW4LQA.js} +1 -1
  60. package/dist/{chunk-R4RL4UDT.js → chunk-4KDNWZY5.js} +8 -7
  61. package/dist/{chunk-ET2BWLQX.js → chunk-4XXSXD6V.js} +3 -3
  62. package/dist/{chunk-TRXYUOWW.js → chunk-5IMANOES.js} +6 -6
  63. package/dist/{chunk-5JCKVJC6.js → chunk-5YCBMSQ5.js} +5 -5
  64. package/dist/{chunk-FPF7ZSH5.js → chunk-62QSMUXP.js} +2 -2
  65. package/dist/{chunk-C7SKKHMD.js → chunk-7BS6GDNH.js} +4 -4
  66. package/dist/{chunk-OLKAGHOO.js → chunk-AARWOJLD.js} +1 -1
  67. package/dist/{chunk-E2WABTIY.js → chunk-AFN7QVA3.js} +7 -7
  68. package/dist/{chunk-R3EIRYON.js → chunk-AWTLZVZY.js} +5 -5
  69. package/dist/{chunk-LH5JTAAH.js → chunk-BTURZF5T.js} +2 -2
  70. package/dist/{chunk-GPHESUOZ.js → chunk-DTVZOI3P.js} +4 -4
  71. package/dist/{chunk-57C45LJT.js → chunk-E2BTTHFS.js} +2 -2
  72. package/dist/{chunk-SNY4ABHS.js → chunk-E3Q4PPT2.js} +4 -4
  73. package/dist/{chunk-OFKKNHYJ.js → chunk-EORZZO65.js} +1 -1
  74. package/dist/{chunk-H3MY3EQP.js → chunk-EP52XR6V.js} +4 -4
  75. package/dist/{chunk-3FOW4K2L.js → chunk-FCP5RKB5.js} +4 -4
  76. package/dist/{chunk-BHBHY35A.js → chunk-FNIWB2SF.js} +4 -4
  77. package/dist/{chunk-PZNVSYIY.js → chunk-FX7OHXSS.js} +5 -5
  78. package/dist/{chunk-FS7WOHFO.js → chunk-GMJT73OD.js} +5 -5
  79. package/dist/{chunk-HUJWZIQ2.js → chunk-GTZAV2C5.js} +1 -1
  80. package/dist/{chunk-SHLAHE46.js → chunk-HP3CGRSN.js} +9 -9
  81. package/dist/{chunk-VH2DDTBE.js → chunk-IE6AT2WY.js} +10 -10
  82. package/dist/{chunk-N73CKAC6.js → chunk-JLDZKC7C.js} +1 -1
  83. package/dist/{chunk-2EHDZOJA.js → chunk-JPAG6LFV.js} +8 -8
  84. package/dist/{chunk-M4KQPSMS.js → chunk-K67ODHSQ.js} +1 -1
  85. package/dist/{chunk-YFOR2JQQ.js → chunk-KALND7MK.js} +1 -1
  86. package/dist/{chunk-LIVVVKIZ.js → chunk-KLNNWG4Q.js} +3 -3
  87. package/dist/{chunk-YDYKKSFU.js → chunk-LCRF7HAY.js} +3 -3
  88. package/dist/{chunk-O4AAXXXP.js → chunk-LE3K3ATT.js} +3 -3
  89. package/dist/{chunk-HZGSGLK4.js → chunk-LMHNRNXY.js} +6 -6
  90. package/dist/{chunk-ZLXN26UD.js → chunk-LQMJJPUZ.js} +6 -6
  91. package/dist/{chunk-PAYK5BD7.js → chunk-MMQPOOEO.js} +2 -2
  92. package/dist/{chunk-Z6YRFNN3.js → chunk-MP6ZJBDX.js} +4 -4
  93. package/dist/{chunk-7YVSQ342.js → chunk-MPDJBJMJ.js} +1 -1
  94. package/dist/{chunk-JG2ZVO5L.js → chunk-MPVNNWB7.js} +1 -1
  95. package/dist/{chunk-DJS7W4SC.js → chunk-N2IXM43C.js} +6 -6
  96. package/dist/{chunk-4IOCYW6O.js → chunk-N6DXMU4B.js} +3 -3
  97. package/dist/{chunk-HGVGOGVD.js → chunk-NGR6Z3XV.js} +3 -3
  98. package/dist/{chunk-RIHIXQAL.js → chunk-NQ5OIMQM.js} +11 -11
  99. package/dist/{chunk-VLEKL3PF.js → chunk-NTM53JUG.js} +1 -1
  100. package/dist/{chunk-TU5DTA2V.js → chunk-O7RSKV2Z.js} +1 -1
  101. package/dist/{chunk-YE7WPP7M.js → chunk-OIPN6XBI.js} +1 -1
  102. package/dist/{chunk-6BZCNKCY.js → chunk-OIVFH66C.js} +3 -3
  103. package/dist/{chunk-HLK3ZELO.js → chunk-OS47GTXC.js} +2 -2
  104. package/dist/{chunk-QCZMBOMF.js → chunk-P3CSTJ4U.js} +1 -1
  105. package/dist/{chunk-CPV25VW5.js → chunk-PI3EX3VU.js} +1 -1
  106. package/dist/{chunk-4NXEOPXZ.js → chunk-PI7Y4RP5.js} +1 -1
  107. package/dist/{chunk-WWVVLMPJ.js → chunk-PXYVGBX5.js} +2 -2
  108. package/dist/{chunk-76T3UMRC.js → chunk-Q2U2JJKN.js} +139 -43
  109. package/dist/{chunk-YXLWKFKC.js → chunk-QJ5CHRK7.js} +6 -6
  110. package/dist/{chunk-UJ6ZJNHK.js → chunk-QKBGPBTG.js} +2 -2
  111. package/dist/{chunk-CDUTYRXO.js → chunk-REJKLD33.js} +4 -4
  112. package/dist/{chunk-DNJKQHK2.js → chunk-RXWTLPC2.js} +1 -1
  113. package/dist/{chunk-6355EUTT.js → chunk-SFJTCSBC.js} +3 -3
  114. package/dist/{chunk-X5LTD4VA.js → chunk-SGYE4TSV.js} +1 -1
  115. package/dist/{chunk-VCWHZDP3.js → chunk-ST7NYREC.js} +2 -2
  116. package/dist/{chunk-RT6FAMIF.js → chunk-SZTB7X2F.js} +12 -12
  117. package/dist/{chunk-JXOVA3JW.js → chunk-TD77E4IG.js} +5 -5
  118. package/dist/{chunk-US4LUIFU.js → chunk-UTBF532I.js} +6 -1
  119. package/dist/{chunk-GGNKMBCN.js → chunk-UYATTR34.js} +4 -4
  120. package/dist/{chunk-DPHYIJNF.js → chunk-W7GT3CQ2.js} +3 -3
  121. package/dist/{chunk-IP4NJN6G.js → chunk-XUHE6XZC.js} +1 -1
  122. package/dist/{chunk-S3X6WLW5.js → chunk-YJ2SYX6E.js} +1 -1
  123. package/dist/{chunk-OBNVYNPQ.js → chunk-YKOQ432L.js} +3 -3
  124. package/dist/{chunk-A3YA4EIY.js → chunk-YYI6OSY7.js} +2 -2
  125. package/dist/{chunk-WAZIEUIG.js → chunk-YYTWOEVU.js} +4 -4
  126. package/dist/{chunk-CTLI2HJE.js → chunk-ZF5OOZYY.js} +5 -5
  127. package/dist/{codex-app-cards-switch-MJA47AZY.js → codex-app-cards-switch-R3AQ7GCL.js} +11 -11
  128. package/dist/{codex-card-routing-2MDDCMAO.js → codex-card-routing-MINRBWOA.js} +2 -2
  129. package/dist/{codex-desktop-launch-7IVPOMSK.js → codex-desktop-launch-IM7LRNWD.js} +1 -1
  130. package/dist/{codex-session-launch-U6JUH6X6.js → codex-session-launch-5LVPMCPB.js} +20 -20
  131. package/dist/{config-S2OVEI6F.js → config-JZAIUJYX.js} +3 -3
  132. package/dist/{global-upgrade-XGDWDFQN.js → global-upgrade-N6W3SRLW.js} +9 -9
  133. package/dist/{identity-7LLNHIP3.js → identity-5DYBKLN4.js} +4 -4
  134. package/dist/{live-capabilities-CI46M4XO.js → live-capabilities-3MCCEAF5.js} +4 -4
  135. package/dist/{paths-FVQYVHLH.js → paths-HDL3JGPR.js} +3 -3
  136. package/dist/{reapply-M4DKHUZX.js → reapply-WOVIOPFX.js} +31 -31
  137. package/dist/src/index.js +35 -35
  138. package/dist/{upgrade-lock-DTWLFPH2.js → upgrade-lock-AIEM2X72.js} +4 -4
  139. package/dist/{usage-IHNVIPGZ.js → usage-5RBIRZ6S.js} +3 -3
  140. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readTranscriptPreference
3
- } from "./chunk-YDYKKSFU.js";
3
+ } from "./chunk-LCRF7HAY.js";
4
4
 
5
5
  // src/transcript-setting.ts
6
6
  var transcriptEnvironmentPreference = () => {
@@ -4,10 +4,10 @@ import {
4
4
  } from "./chunk-55L4JSPA.js";
5
5
  import {
6
6
  fetchAsCredential
7
- } from "./chunk-N73CKAC6.js";
7
+ } from "./chunk-JLDZKC7C.js";
8
8
  import {
9
9
  getBaseUrl
10
- } from "./chunk-TU5DTA2V.js";
10
+ } from "./chunk-O7RSKV2Z.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-US4LUIFU.js";
18
+ } from "./chunk-UTBF532I.js";
19
19
 
20
20
  // src/transcript-recipient-pin.ts
21
21
  import { createHash } from "crypto";
@@ -4,10 +4,10 @@ import {
4
4
  keyPrefix,
5
5
  readConfigFileKey,
6
6
  readMacAppKeyPrefix
7
- } from "./chunk-YDYKKSFU.js";
7
+ } from "./chunk-LCRF7HAY.js";
8
8
  import {
9
9
  NPX_LATEST_COMMAND
10
- } from "./chunk-S3X6WLW5.js";
10
+ } from "./chunk-YJ2SYX6E.js";
11
11
 
12
12
  // src/key-signed-out.ts
13
13
  var VERDICT_BY_CHECK = {
@@ -10,7 +10,7 @@ import {
10
10
  uploadTranscriptRecords,
11
11
  verifyAnchoredRecipients,
12
12
  wrapSessionKey
13
- } from "./chunk-6BZCNKCY.js";
13
+ } from "./chunk-OIVFH66C.js";
14
14
 
15
15
  // src/live-session.ts
16
16
  var LIVE_TRANSCRIPT_LIMITS = { queuedRecords: 100, recordCharacters: 32 * 1024 };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  redactSecretsFromContent
3
- } from "./chunk-US4LUIFU.js";
3
+ } from "./chunk-UTBF532I.js";
4
4
 
5
5
  // src/cli/terminal-row.ts
6
6
  var visibleLength = (text) => text.replace(/\x1b\[[0-9;]*m/g, "").length;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_SESSION
3
- } from "./chunk-RT6FAMIF.js";
3
+ } from "./chunk-SZTB7X2F.js";
4
4
 
5
5
  // src/answer.ts
6
6
  var isDeferAnswer = (value) => value === "defer";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  projectNameFor
3
- } from "./chunk-DNJKQHK2.js";
3
+ } from "./chunk-RXWTLPC2.js";
4
4
  import {
5
5
  readConfigFileKey
6
- } from "./chunk-YDYKKSFU.js";
6
+ } from "./chunk-LCRF7HAY.js";
7
7
 
8
8
  // src/bell/fleet.ts
9
9
  import { closeSync, constants, futimesSync, lstatSync, mkdirSync, openSync, readdirSync, unlinkSync } from "fs";
@@ -2,39 +2,39 @@ import {
2
2
  forgetPhoneApproval,
3
3
  rememberPhoneApproval,
4
4
  takePhoneApproval
5
- } from "./chunk-57C45LJT.js";
5
+ } from "./chunk-E2BTTHFS.js";
6
6
  import {
7
7
  claudeSettingsLocationFor,
8
8
  readClaudePermissionRules
9
- } from "./chunk-K5NBHOE6.js";
9
+ } from "./chunk-4632OXAT.js";
10
10
  import {
11
11
  defersToNativeMode
12
- } from "./chunk-7YVSQ342.js";
12
+ } from "./chunk-MPDJBJMJ.js";
13
13
  import {
14
14
  askAgentQuestions,
15
15
  outcomeOfFailedAsk,
16
16
  storedWaitDeadline
17
- } from "./chunk-R4RL4UDT.js";
17
+ } from "./chunk-4KDNWZY5.js";
18
18
  import {
19
19
  reportMachineDenial
20
- } from "./chunk-C7SKKHMD.js";
20
+ } from "./chunk-7BS6GDNH.js";
21
21
  import {
22
22
  isGatingMoment,
23
23
  recordKeylessMoment
24
- } from "./chunk-VLEKL3PF.js";
24
+ } from "./chunk-NTM53JUG.js";
25
25
  import {
26
26
  isAdmitted,
27
27
  readAdmissionRules
28
- } from "./chunk-CTLI2HJE.js";
28
+ } from "./chunk-ZF5OOZYY.js";
29
29
  import {
30
30
  isDeferAnswer,
31
31
  oncePerSession
32
- } from "./chunk-4NXEOPXZ.js";
32
+ } from "./chunk-PI7Y4RP5.js";
33
33
  import {
34
34
  activeHookSource,
35
35
  activeIdentity,
36
36
  namedSource
37
- } from "./chunk-R3EIRYON.js";
37
+ } from "./chunk-AWTLZVZY.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-RT6FAMIF.js";
60
+ } from "./chunk-SZTB7X2F.js";
61
61
  import {
62
62
  UNNAMED_ACTION,
63
63
  deriveAction,
@@ -68,7 +68,7 @@ import {
68
68
  patchDeletesFiles,
69
69
  permissionDeniedAction,
70
70
  scopePathFor
71
- } from "./chunk-OFKKNHYJ.js";
71
+ } from "./chunk-EORZZO65.js";
72
72
  import {
73
73
  askUser,
74
74
  cancelQuestion,
@@ -85,29 +85,29 @@ import {
85
85
  waitForQuestion,
86
86
  waitsForThePhone,
87
87
  withdrawQuestion
88
- } from "./chunk-YXLWKFKC.js";
88
+ } from "./chunk-QJ5CHRK7.js";
89
89
  import {
90
90
  branchFor,
91
91
  projectNameFor,
92
92
  repoKeyFor,
93
93
  repositoryScopeFor
94
- } from "./chunk-DNJKQHK2.js";
94
+ } from "./chunk-RXWTLPC2.js";
95
95
  import {
96
96
  getMachineId
97
- } from "./chunk-YFOR2JQQ.js";
97
+ } from "./chunk-KALND7MK.js";
98
98
  import {
99
99
  POSTTOOLUSE_MIRRORED_TOOLS
100
- } from "./chunk-MF6FSDM4.js";
100
+ } from "./chunk-3ZYXWHVC.js";
101
101
  import {
102
102
  getApiKey,
103
103
  getBaseUrl
104
- } from "./chunk-TU5DTA2V.js";
104
+ } from "./chunk-O7RSKV2Z.js";
105
105
  import {
106
106
  writeFileAtomic
107
107
  } from "./chunk-PM2NRK6Y.js";
108
108
  import {
109
109
  NPX_LATEST_COMMAND
110
- } from "./chunk-S3X6WLW5.js";
110
+ } from "./chunk-YJ2SYX6E.js";
111
111
  import {
112
112
  AGENT_QUESTION_STRATEGY,
113
113
  AGENT_QUESTION_TOOL,
@@ -142,6 +142,7 @@ import {
142
142
  claudePreToolUseOutput,
143
143
  claudePromptTakesTheCall,
144
144
  claudeQuestionAnswers,
145
+ claudeQuestionAskedInBothPlaces,
145
146
  claudeStoppedPermissionRequestOutput,
146
147
  claudeStoppedPreToolUseOutput,
147
148
  denyReasonFrom,
@@ -154,6 +155,7 @@ import {
154
155
  hookWaitClamped,
155
156
  hookWaitDeadline,
156
157
  hookWritePath,
158
+ isApprovedOnlyAtPermissionRequest,
157
159
  isBlockedActionRequest,
158
160
  isClaudeRefusalsOnlyTool,
159
161
  isCursorHookPayload,
@@ -179,7 +181,7 @@ import {
179
181
  timeoutActionWithoutLocalPrompt,
180
182
  unansweredRefusalReason,
181
183
  unapprovedScopeReason
182
- } from "./chunk-US4LUIFU.js";
184
+ } from "./chunk-UTBF532I.js";
183
185
 
184
186
  // src/terminal-answer-watch.ts
185
187
  import { closeSync, openSync, readSync, statSync } from "fs";
@@ -206,9 +208,11 @@ var messageParts = (line) => {
206
208
  };
207
209
  var isToolUse = (part) => part.type === "tool_use" && typeof part.id === "string" && typeof part.name === "string";
208
210
  var isToolResultFor = (toolUseId) => (part) => part.type === "tool_result" && part.tool_use_id === toolUseId;
211
+ var questionsAskedBy = (toolName, toolInput) => toolName === AGENT_QUESTION_TOOL && isRecord(toolInput) ? parseAgentQuestions(toolInput) : void 0;
212
+ var identifyingInputOf = (toolName, toolInput) => questionsAskedBy(toolName, toolInput) ?? toolInput ?? {};
209
213
  var matchingToolUseIds = (lines, call) => {
210
- const wanted = stableJson(call.toolInput);
211
- return lines.flatMap(messageParts).filter(isToolUse).filter((part) => part.name === call.toolName && stableJson(part.input ?? {}) === wanted).map((part) => part.id);
214
+ const wanted = stableJson(identifyingInputOf(call.toolName, call.toolInput));
215
+ return lines.flatMap(messageParts).filter(isToolUse).filter((part) => part.name === call.toolName && stableJson(identifyingInputOf(part.name, part.input)) === wanted).map((part) => part.id);
212
216
  };
213
217
  var toolUseIdOf = (lines, call) => matchingToolUseIds(lines, call).at(-1);
214
218
  var toolResultArrived = (lines, toolUseId) => lines.some((line) => messageParts(line).some(isToolResultFor(toolUseId)));
@@ -692,20 +696,22 @@ var terminalLiveFactsOf = (input) => ({
692
696
  toolName: input.tool_name
693
697
  });
694
698
  var preToolUseHandsOff = (input, gateInput, verdict) => claudePromptTakesTheCall(terminalLiveFactsOf(input), gateInput, verdict);
695
- var handleAskUserQuestion = async (apiKey, input, modeState) => {
696
- if (questionHandedToTheTerminal(input.tool_name, modeState)) return void 0;
697
- const questions = parseAgentQuestions(input.tool_input ?? {});
698
- if (!questions) return void 0;
699
+ var claudeQuestionAskOf = (input) => {
699
700
  const projectName = projectNameFor(input.cwd);
700
- const deadline = hookWaitDeadline(START_MS, effectiveWaitSeconds("wait", 0, "claude"), "claude", Date.now());
701
- const outcome = await askAgentQuestions(apiKey, {
701
+ return {
702
702
  toolName: AGENT_QUESTION_TOOL,
703
703
  agentName: agentNameIn(projectName),
704
704
  projectName,
705
705
  sessionId: input.session_id,
706
- toolUseId: input.tool_use_id,
707
- deadline
708
- }, questions);
706
+ toolUseId: input.tool_use_id
707
+ };
708
+ };
709
+ var claudeQuestionDeadline = () => hookWaitDeadline(START_MS, effectiveWaitSeconds("wait", 0, "claude"), "claude", Date.now());
710
+ var handleAskUserQuestion = async (apiKey, input, modeState) => {
711
+ if (questionHandedToTheTerminal(input.tool_name, modeState)) return void 0;
712
+ const questions = parseAgentQuestions(input.tool_input ?? {});
713
+ if (!questions) return void 0;
714
+ const outcome = await askAgentQuestions(apiKey, { ...claudeQuestionAskOf(input), deadline: claudeQuestionDeadline() }, questions);
709
715
  switch (outcome.kind) {
710
716
  case "answered":
711
717
  return allowWithInput({ ...input.tool_input ?? {}, answers: claudeQuestionAnswers(questions, outcome.answers) });
@@ -718,13 +724,13 @@ var handleAskUserQuestion = async (apiKey, input, modeState) => {
718
724
  };
719
725
  var PLAN_APPROVE = "Approve, start coding";
720
726
  var PLAN_KEEP_PLANNING = "Keep planning";
721
- var handleExitPlanMode = async (apiKey, input) => {
727
+ var askThePlanQuestion = async (apiKey, input) => {
722
728
  const toolInput = input.tool_input ?? {};
723
729
  const projectName = projectNameFor(input.cwd);
724
730
  const deadline = hookWaitDeadline(START_MS, effectiveWaitSeconds("wait", 0, "claude"), "claude", Date.now());
725
- let result;
731
+ let question;
726
732
  try {
727
- result = await askUser(apiKey, {
733
+ question = await askUser(apiKey, {
728
734
  question: `Approve the plan and start coding in ${projectName}?`,
729
735
  type: "select",
730
736
  options: [PLAN_APPROVE, PLAN_KEEP_PLANNING],
@@ -742,17 +748,34 @@ var handleExitPlanMode = async (apiKey, input) => {
742
748
  waitEndsAt: new Date(deadline).toISOString()
743
749
  });
744
750
  } catch (error) {
745
- return outcomeOfFailedAsk(error, input.session_id, halted(DECISION_STOP_REASON));
751
+ return { kind: "settled", answer: outcomeOfFailedAsk(error, input.session_id, "failed") ?? "unanswered" };
746
752
  }
747
- if (isDecisionStopped(result)) return halted(DECISION_STOP_REASON);
748
- const answer = await waitForQuestion(apiKey, result, storedWaitDeadline(result, deadline));
749
- if (isDecisionStopped(answer)) return halted(DECISION_STOP_REASON);
753
+ if (isDecisionStopped(question)) return { kind: "settled", answer: "stopped" };
754
+ return { kind: "asked", question, deadline: storedWaitDeadline(question, deadline) };
755
+ };
756
+ var planAnswerOf = async (apiKey, question, deadline, signal) => {
757
+ const answer = await waitForQuestion(apiKey, question, deadline, void 0, signal);
758
+ if (isDecisionStopped(answer)) return "stopped";
750
759
  const value = answer.answered ? (answer.value ?? "").trim() : "";
751
- if (!value || isDeferAnswer(answer.value)) {
752
- return void 0;
760
+ if (!value || isDeferAnswer(answer.value)) return "unanswered";
761
+ return value === PLAN_APPROVE ? "approved" : "declined";
762
+ };
763
+ var preToolUsePlanOutput = (answer) => {
764
+ switch (answer) {
765
+ case "approved":
766
+ return allow();
767
+ case "declined":
768
+ return deny(PLAN_DECLINED_REASON);
769
+ case "stopped":
770
+ case "failed":
771
+ return halted(DECISION_STOP_REASON);
772
+ case "unanswered":
773
+ return void 0;
753
774
  }
754
- if (value === PLAN_APPROVE) return allow();
755
- return deny(PLAN_DECLINED_REASON);
775
+ };
776
+ var handleExitPlanMode = async (apiKey, input) => {
777
+ const plan = await askThePlanQuestion(apiKey, input);
778
+ return preToolUsePlanOutput(plan.kind === "settled" ? plan.answer : await planAnswerOf(apiKey, plan.question, plan.deadline));
756
779
  };
757
780
  var handleKeyless = (input) => {
758
781
  try {
@@ -928,8 +951,10 @@ var decidePreToolUse = async (input, canonical) => {
928
951
  if (verdict.kind === "gate" && verdict.scopeReason && (canonical?.toolInputs.length ?? 0) > 1) return settledAs("denied", deny(SCOPE_BATCH_REASON));
929
952
  if (agentQuestionStrategy(ACTIVE_SOURCE, "PreToolUse", input.tool_name) === AGENT_QUESTION_STRATEGY.native) return settledAs("terminal_only", void 0);
930
953
  if (input.tool_name === "AskUserQuestion") {
954
+ if (claudeQuestionAskedInBothPlaces(terminalLiveFactsOf(input))) return settledAs("terminal_only", void 0);
931
955
  return settledAs("asked", await handleAskUserQuestion(apiKey, input, modeState));
932
956
  }
957
+ if (isApprovedOnlyAtPermissionRequest(ACTIVE_SOURCE, input.tool_name)) return settledAs("native_mode", void 0);
933
958
  if (input.tool_name === "ExitPlanMode") {
934
959
  return settledAs("asked", await handleExitPlanMode(apiKey, input));
935
960
  }
@@ -980,10 +1005,79 @@ var toPermissionRequestOutput = (hookOutput) => {
980
1005
  return void 0;
981
1006
  };
982
1007
  var answerOfTheReplay = (replayed) => replayed.humanDecision ? toPermissionRequestOutput(replayed.result) : void 0;
1008
+ var permissionRequestPlanOutput = (answer, plan) => {
1009
+ switch (answer) {
1010
+ case "approved":
1011
+ return permReqAllow(plan);
1012
+ case "declined":
1013
+ return permReqDeny(PLAN_DECLINED_REASON);
1014
+ case "stopped":
1015
+ return permReqDeny(DECISION_STOP_REASON);
1016
+ case "failed":
1017
+ case "unanswered":
1018
+ return void 0;
1019
+ }
1020
+ };
1021
+ var answerThePlanBesideTheDialog = async (apiKey, input) => {
1022
+ const toolInput = input.tool_input ?? {};
1023
+ const plan = await askThePlanQuestion(apiKey, input);
1024
+ if (plan.kind === "settled") return permissionRequestPlanOutput(plan.answer, toolInput);
1025
+ const stop = new AbortController();
1026
+ const first = await Promise.race([planAnswerOf(apiKey, plan.question, plan.deadline, stop.signal), terminalAnswered(input, stop.signal)]).finally(() => stop.abort());
1027
+ if (first === TERMINAL_ANSWERED) {
1028
+ await withdrawQuestion(apiKey, plan.question.correlationId);
1029
+ return void 0;
1030
+ }
1031
+ return permissionRequestPlanOutput(first, toolInput);
1032
+ };
1033
+ var questionDeadlineBesideTheDialog = (holdBudgetSeconds) => holdBudgetSeconds === void 0 ? claudeQuestionDeadline() : Math.min(claudeQuestionDeadline(), START_MS + hookHoldWindowMs("claude", holdBudgetSeconds));
1034
+ var dialogAnswerFromThePhone = (input, questions, outcome) => outcome.kind === "answered" ? permReqAllow({ ...input.tool_input ?? {}, answers: claudeQuestionAnswers(questions, outcome.answers) }) : void 0;
1035
+ var DIALOG_CLOSING_SIGNALS = ["SIGTERM", "SIGHUP", "SIGINT"];
1036
+ var DIALOG_CLOSE_WITHDRAWAL_BACKSTOP_MS = 3e3;
1037
+ var withdrawWhenTheDialogCloses = (apiKey, stop, openPhoneQuestion) => {
1038
+ const onClose = () => {
1039
+ stop.abort();
1040
+ setTimeout(() => process.exit(0), DIALOG_CLOSE_WITHDRAWAL_BACKSTOP_MS).unref();
1041
+ void openPhoneQuestion().then((open) => open === void 0 ? void 0 : withdrawQuestion(apiKey, open)).catch(() => void 0).finally(() => process.exit(0));
1042
+ };
1043
+ for (const signal of DIALOG_CLOSING_SIGNALS) process.once(signal, onClose);
1044
+ return () => {
1045
+ for (const signal of DIALOG_CLOSING_SIGNALS) process.off(signal, onClose);
1046
+ };
1047
+ };
1048
+ var askClaudeQuestionBesideTheDialog = async (apiKey, input, modeState, holdBudgetSeconds) => {
1049
+ if (questionHandedToTheTerminal(input.tool_name, modeState)) return void 0;
1050
+ const questions = parseAgentQuestions(input.tool_input ?? {});
1051
+ if (!questions) return void 0;
1052
+ const stop = new AbortController();
1053
+ const asked = [];
1054
+ const terminal = terminalAnswered(input, stop.signal);
1055
+ const phone = askAgentQuestions(apiKey, {
1056
+ ...claudeQuestionAskOf(input),
1057
+ deadline: questionDeadlineBesideTheDialog(holdBudgetSeconds),
1058
+ signal: stop.signal,
1059
+ onQuestionCreated: (correlationId) => {
1060
+ asked.push(correlationId);
1061
+ }
1062
+ }, questions);
1063
+ const stopWatchingTheDialog = withdrawWhenTheDialogCloses(apiKey, stop, () => phone.then(() => asked.at(-1), () => asked.at(-1)));
1064
+ try {
1065
+ const first = await Promise.race([phone, terminal]).finally(() => stop.abort());
1066
+ if (first !== TERMINAL_ANSWERED) return dialogAnswerFromThePhone(input, questions, first);
1067
+ await phone;
1068
+ const openOnThePhone = asked.at(-1);
1069
+ if (openOnThePhone !== void 0) await withdrawQuestion(apiKey, openOnThePhone);
1070
+ return void 0;
1071
+ } finally {
1072
+ stopWatchingTheDialog();
1073
+ }
1074
+ };
983
1075
  var handlePermissionRequest = async (input, canonical, holdBudgetSeconds) => {
984
1076
  if (isPusharyOwnOrConnectorTool(input.tool_name)) return permReqAllow();
985
1077
  const claudeRules = claudePermissionRulesFor(input);
986
- if (canonical === void 0 && !claudeRulesMayCover(input, claudeRules) && isPermissionRequestOwnedByPreToolUse(input.tool_name, input.permission_mode, shouldDeferToNativeMode) && !terminalStaysLiveForTheCall(terminalLiveFactsOf(input))) return void 0;
1078
+ const callFacts = terminalLiveFactsOf(input);
1079
+ const questionBesideTheDialog = claudeQuestionAskedInBothPlaces(callFacts);
1080
+ if (canonical === void 0 && !claudeRulesMayCover(input, claudeRules) && isPermissionRequestOwnedByPreToolUse(ACTIVE_SOURCE, input.tool_name, input.permission_mode, shouldDeferToNativeMode) && !terminalStaysLiveForTheCall(callFacts) && !questionBesideTheDialog) return void 0;
987
1081
  let apiKey;
988
1082
  try {
989
1083
  apiKey = getApiKey();
@@ -1004,17 +1098,19 @@ var handlePermissionRequest = async (input, canonical, holdBudgetSeconds) => {
1004
1098
  return permReqDeny(verdict.reason);
1005
1099
  }
1006
1100
  if (canonical === null) return permReqDeny(UNREADABLE_CALL_REASON);
1101
+ if (questionBesideTheDialog) return await askClaudeQuestionBesideTheDialog(apiKey, input, modeState, holdBudgetSeconds);
1007
1102
  if (isMcpCallInClaudeCode(input) && claimMcpHoldHandback(blockedActionFingerprintFor(input))) return void 0;
1008
1103
  if (agentQuestionStrategy(ACTIVE_SOURCE, "PermissionRequest", input.tool_name) === AGENT_QUESTION_STRATEGY.native) return void 0;
1104
+ if (isApprovedOnlyAtPermissionRequest(ACTIVE_SOURCE, input.tool_name)) return await answerThePlanBesideTheDialog(apiKey, input);
1009
1105
  if (verdict.kind === "gate" && verdict.scopeReason && (canonical?.toolInputs.length ?? 0) > 1) return permReqDeny(SCOPE_BATCH_REASON);
1010
1106
  const approvedCall = PHONE_APPROVAL_SOURCE ? takePhoneApproval(PHONE_APPROVAL_SOURCE, input) : void 0;
1011
1107
  const preToolUseAllowLeftThePrompt = PHONE_APPROVAL_SOURCE !== null && (verdict.kind === "allow" || approvedCall !== void 0);
1012
1108
  const handedOff = preToolUseHandsOff(input, gateInput, verdict);
1013
- const terminalLive = terminalStaysLiveForTheCall(terminalLiveFactsOf(input));
1109
+ const terminalLive = terminalStaysLiveForTheCall(callFacts);
1014
1110
  const scopeQuestion = verdict.kind === "gate" && Boolean(verdict.scopeReason);
1015
1111
  const preToolUseRanForTheCall = PRETOOLUSE_HANDLED_TOOLS.has(input.tool_name) && isAdmitted(readAdmissionRules(), "claude", "PreToolUse");
1016
1112
  const preToolUseAskedTheScopeQuestion = scopeQuestion && terminalLive && preToolUseRanForTheCall;
1017
- 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));
1113
+ 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));
1018
1114
  if (!handedOff && (preToolUseAskedTheScopeQuestion || preToolUseOwnsTheCall)) return void 0;
1019
1115
  const terminalLiveDispatch = handedOff ? { holdBudgetSeconds } : void 0;
1020
1116
  switch (verdict.kind) {
@@ -8,21 +8,21 @@ import {
8
8
  SubscriptionRequiredError,
9
9
  callMcpTool,
10
10
  isRetryable
11
- } from "./chunk-5JCKVJC6.js";
11
+ } from "./chunk-5YCBMSQ5.js";
12
12
  import {
13
13
  fetchAsCredential
14
- } from "./chunk-N73CKAC6.js";
14
+ } from "./chunk-JLDZKC7C.js";
15
15
  import {
16
16
  installNetworkDefaults,
17
17
  isNetworkFailure
18
- } from "./chunk-ET2BWLQX.js";
18
+ } from "./chunk-4XXSXD6V.js";
19
19
  import {
20
20
  clientReportClaims
21
- } from "./chunk-MF6FSDM4.js";
21
+ } from "./chunk-3ZYXWHVC.js";
22
22
  import {
23
23
  getApiKey,
24
24
  getBaseUrl
25
- } from "./chunk-TU5DTA2V.js";
25
+ } from "./chunk-O7RSKV2Z.js";
26
26
  import {
27
27
  ASK_AGENT_NAME_MAX,
28
28
  CLIENT_REPORT_PATH,
@@ -32,7 +32,7 @@ import {
32
32
  degradedLine,
33
33
  isDecisionStoppedReply,
34
34
  truncateLine
35
- } from "./chunk-US4LUIFU.js";
35
+ } from "./chunk-UTBF532I.js";
36
36
 
37
37
  // src/api.ts
38
38
  import { randomUUID } from "crypto";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-POFBE6ZY.js";
4
4
  import {
5
5
  autoUpdateState
6
- } from "./chunk-MF6FSDM4.js";
6
+ } from "./chunk-3ZYXWHVC.js";
7
7
  import {
8
8
  readJsonSafe,
9
9
  writeJsonAtomic
@@ -17,7 +17,7 @@ import {
17
17
  } from "./chunk-UQTQ6HPO.js";
18
18
  import {
19
19
  isAutoUpdateResult
20
- } from "./chunk-US4LUIFU.js";
20
+ } from "./chunk-UTBF532I.js";
21
21
 
22
22
  // src/auto-update.ts
23
23
  import { spawn } from "child_process";
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  UNNAMED_ACTION
3
- } from "./chunk-OFKKNHYJ.js";
3
+ } from "./chunk-EORZZO65.js";
4
4
  import {
5
5
  askUser,
6
6
  isAwayPaused,
7
7
  isLocalQuestionHandoff,
8
8
  unavailableQuestionUnlessRefused,
9
9
  waitForQuestion
10
- } from "./chunk-YXLWKFKC.js";
10
+ } from "./chunk-QJ5CHRK7.js";
11
11
  import {
12
12
  getMachineId
13
- } from "./chunk-YFOR2JQQ.js";
13
+ } from "./chunk-KALND7MK.js";
14
14
  import {
15
15
  hookWaitClamped,
16
16
  hookWaitDeadline,
17
17
  scopeBreachReasonOf
18
- } from "./chunk-US4LUIFU.js";
18
+ } from "./chunk-UTBF532I.js";
19
19
 
20
20
  // src/pushed-question.ts
21
21
  var scopeQuestionOf = (verdict) => {
@@ -2,7 +2,7 @@ import {
2
2
  localRepoKey,
3
3
  normalizeRepoRemote,
4
4
  parseGitBranch
5
- } from "./chunk-US4LUIFU.js";
5
+ } from "./chunk-UTBF532I.js";
6
6
 
7
7
  // src/repo.ts
8
8
  import { existsSync, readFileSync, statSync } from "fs";
@@ -3,16 +3,16 @@ import {
3
3
  NpmMissingError,
4
4
  NpmPermissionError,
5
5
  NpmReleaseAgeError
6
- } from "./chunk-GGNKMBCN.js";
6
+ } from "./chunk-UYATTR34.js";
7
7
  import {
8
8
  writeFileAtomic
9
9
  } from "./chunk-PM2NRK6Y.js";
10
10
  import {
11
11
  NPX_LATEST_COMMAND
12
- } from "./chunk-S3X6WLW5.js";
12
+ } from "./chunk-YJ2SYX6E.js";
13
13
  import {
14
14
  readSetupAgentFailures
15
- } from "./chunk-US4LUIFU.js";
15
+ } from "./chunk-UTBF532I.js";
16
16
 
17
17
  // src/setup/config-write.ts
18
18
  var AgentConfigWriteError = class extends Error {
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  RETRY_ACK,
6
6
  refusedReceiptMessage
7
- } from "./chunk-5LIGHRBH.js";
7
+ } from "./chunk-4HBW4LQA.js";
8
8
 
9
9
  // src/command-receipts.ts
10
10
  import { randomUUID } from "crypto";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  autoUpdateLock
3
- } from "./chunk-MF6FSDM4.js";
3
+ } from "./chunk-3ZYXWHVC.js";
4
4
  import {
5
5
  installPackageGlobally,
6
6
  npmErrorMessage,
7
7
  throwIfNpmRefusesInstall
8
- } from "./chunk-GGNKMBCN.js";
8
+ } from "./chunk-UYATTR34.js";
9
9
  import {
10
10
  writeJsonAtomic
11
11
  } from "./chunk-PM2NRK6Y.js";
@@ -27,7 +27,7 @@ import {
27
27
  toolResultErrorText,
28
28
  transcriptTokensIn,
29
29
  transcriptUsageRequest
30
- } from "./chunk-OFKKNHYJ.js";
30
+ } from "./chunk-EORZZO65.js";
31
31
  import {
32
32
  cancelQuestion,
33
33
  clientErrorKindOf,
@@ -35,44 +35,44 @@ import {
35
35
  reportClientError,
36
36
  sendNotification,
37
37
  waitForAnswer
38
- } from "./chunk-YXLWKFKC.js";
38
+ } from "./chunk-QJ5CHRK7.js";
39
39
  import {
40
40
  RETRY_ACK,
41
41
  readCommandAck,
42
42
  refusedReceiptMessage
43
- } from "./chunk-5LIGHRBH.js";
43
+ } from "./chunk-4HBW4LQA.js";
44
44
  import {
45
45
  isRetryable,
46
46
  withRetry
47
- } from "./chunk-5JCKVJC6.js";
47
+ } from "./chunk-5YCBMSQ5.js";
48
48
  import {
49
49
  fetchAsCredential
50
- } from "./chunk-N73CKAC6.js";
50
+ } from "./chunk-JLDZKC7C.js";
51
51
  import {
52
52
  branchFor,
53
53
  projectNameFor,
54
54
  repoKeyFor
55
- } from "./chunk-DNJKQHK2.js";
55
+ } from "./chunk-RXWTLPC2.js";
56
56
  import {
57
57
  getMachineId
58
- } from "./chunk-YFOR2JQQ.js";
58
+ } from "./chunk-KALND7MK.js";
59
59
  import {
60
60
  reportedInstallSource
61
- } from "./chunk-LH5JTAAH.js";
61
+ } from "./chunk-BTURZF5T.js";
62
62
  import {
63
63
  IDLE_PROMPT_NOTIFICATION,
64
64
  NOTIFICATION_PUSH_TYPES,
65
65
  POSTTOOLUSE_MIRROR_ONLY_TOOLS,
66
66
  claudeConfigDir
67
- } from "./chunk-MF6FSDM4.js";
67
+ } from "./chunk-3ZYXWHVC.js";
68
68
  import {
69
69
  compareVersion,
70
70
  parseVersion
71
- } from "./chunk-GGNKMBCN.js";
71
+ } from "./chunk-UYATTR34.js";
72
72
  import {
73
73
  getApiKey,
74
74
  getBaseUrl
75
- } from "./chunk-TU5DTA2V.js";
75
+ } from "./chunk-O7RSKV2Z.js";
76
76
  import {
77
77
  writeFileAtomic,
78
78
  writeJsonAtomicDurable
@@ -103,7 +103,7 @@ import {
103
103
  resolveAutoResolveOrigin,
104
104
  resolvePolicy,
105
105
  unansweredRefusalReason
106
- } from "./chunk-US4LUIFU.js";
106
+ } from "./chunk-UTBF532I.js";
107
107
 
108
108
  // src/pending.ts
109
109
  import { join } from "path";