pushary 1.9.209 → 1.9.212

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 (145) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/{api-GBK5CCGM.js → api-SNFXRUBO.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 +34 -33
  8. package/dist/bin/pushary-clean.js +39 -39
  9. package/dist/bin/pushary-codex-bridge.js +23 -23
  10. package/dist/bin/pushary-codex-hook.js +38 -42
  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 +35 -35
  14. package/dist/bin/pushary-cowork.js +5 -5
  15. package/dist/bin/pushary-daemon.js +47 -47
  16. package/dist/bin/pushary-disconnect.js +30 -30
  17. package/dist/bin/pushary-display-hook.js +1 -0
  18. package/dist/bin/pushary-doctor.js +47 -47
  19. package/dist/bin/pushary-elicitation-hook.js +28 -29
  20. package/dist/bin/pushary-gemini-bridge.js +18 -18
  21. package/dist/bin/pushary-gemini-hook.js +33 -35
  22. package/dist/bin/pushary-hook.js +34 -36
  23. package/dist/bin/pushary-login.js +22 -22
  24. package/dist/bin/pushary-logout.js +30 -30
  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-bridge.js +22 -22
  29. package/dist/bin/pushary-opencode-hook.js +35 -39
  30. package/dist/bin/pushary-permission-denied-hook.js +34 -36
  31. package/dist/bin/pushary-permission-hook.js +34 -36
  32. package/dist/bin/pushary-post-hook.js +28 -28
  33. package/dist/bin/pushary-prompt-hook.js +27 -27
  34. package/dist/bin/pushary-session-end-hook.js +27 -27
  35. package/dist/bin/pushary-session-start-hook.js +40 -40
  36. package/dist/bin/pushary-sessions.js +14 -14
  37. package/dist/bin/pushary-setup.js +59 -59
  38. package/dist/bin/pushary-stats.js +5 -5
  39. package/dist/bin/pushary-status.js +36 -36
  40. package/dist/bin/pushary-stop-hook.js +27 -27
  41. package/dist/bin/pushary-stopfailure-hook.js +27 -27
  42. package/dist/bin/pushary-suggestions.js +16 -16
  43. package/dist/bin/pushary-transcript-register.js +17 -17
  44. package/dist/bin/pushary-transcripts.js +25 -25
  45. package/dist/bin/pushary-upgrade.js +47 -47
  46. package/dist/bin/pushary-wait.js +16 -16
  47. package/dist/bin/pushary.js +7 -7
  48. package/dist/{chunk-LEOHGIZ5.js → chunk-2FFSF562.js} +5 -5
  49. package/dist/{chunk-3C2AKI7G.js → chunk-3KADQBEQ.js} +5 -5
  50. package/dist/{chunk-6J3PIF74.js → chunk-3NEKVCP2.js} +4 -4
  51. package/dist/{chunk-672F6V2L.js → chunk-4NJBLOER.js} +2 -2
  52. package/dist/{chunk-GS4RR3LH.js → chunk-5B5PPHJH.js} +1 -1
  53. package/dist/{chunk-7EADTYSA.js → chunk-5E7QI7VP.js} +9 -9
  54. package/dist/{chunk-2W362OU6.js → chunk-65QMCTQ3.js} +2 -2
  55. package/dist/{chunk-JWPOZFT6.js → chunk-6FN7NPOE.js} +2 -2
  56. package/dist/{chunk-BSDG6I3C.js → chunk-74RTPZ2B.js} +45 -167
  57. package/dist/{chunk-LSUB2RBM.js → chunk-7H6BFJU5.js} +1 -1
  58. package/dist/{chunk-JA6DFYFJ.js → chunk-7KTLZJGF.js} +3 -3
  59. package/dist/{chunk-2L6RQHDJ.js → chunk-7MPVFAYZ.js} +1 -1
  60. package/dist/{chunk-JJB34JRR.js → chunk-7TROI3WY.js} +3 -3
  61. package/dist/{chunk-BV74A4Q3.js → chunk-A4I6XOX3.js} +3 -3
  62. package/dist/{chunk-BSBJKN3H.js → chunk-AINVDTY2.js} +4 -4
  63. package/dist/{chunk-JFSAQQO2.js → chunk-ARTOOCLW.js} +1 -1
  64. package/dist/{chunk-QMXE2YQO.js → chunk-AUDKOK2X.js} +6 -6
  65. package/dist/{chunk-FGYQI6YP.js → chunk-BLQ2JF2F.js} +1 -1
  66. package/dist/{chunk-GAJ5BULC.js → chunk-CR5X46JQ.js} +1 -1
  67. package/dist/{chunk-XSHAREYP.js → chunk-CVZMRD73.js} +4 -4
  68. package/dist/{chunk-5AY2STJB.js → chunk-D347AAH7.js} +4 -4
  69. package/dist/{chunk-VM6WBORP.js → chunk-DOPDHW6I.js} +2 -2
  70. package/dist/{chunk-CQIWQIT5.js → chunk-E5BZJAJ7.js} +7 -7
  71. package/dist/{chunk-SK65JVE3.js → chunk-FCIJEVDH.js} +1 -1
  72. package/dist/{chunk-AYITBDTL.js → chunk-FUZSKAEQ.js} +3 -3
  73. package/dist/{chunk-X6KWCU54.js → chunk-FYAEQIYF.js} +4 -4
  74. package/dist/{chunk-E4AOJK33.js → chunk-GDWAKBBT.js} +4 -4
  75. package/dist/{chunk-5SGCCWNR.js → chunk-GJ5XTWNZ.js} +1 -1
  76. package/dist/{chunk-XRURBIKQ.js → chunk-GKTQXPUM.js} +1 -1
  77. package/dist/{chunk-ERVRBZNI.js → chunk-GWDAFH4B.js} +2 -2
  78. package/dist/{chunk-RYK2DXDF.js → chunk-HCBPEZXH.js} +7 -7
  79. package/dist/{chunk-FZDIXPVK.js → chunk-HCILDIRX.js} +2 -2
  80. package/dist/{chunk-TC6DWKY5.js → chunk-HFDNWC2K.js} +1 -1
  81. package/dist/{chunk-GTHM6XOG.js → chunk-HTLG7JIU.js} +1 -1
  82. package/dist/{chunk-Q2NOGE3Y.js → chunk-HVBMU7HP.js} +8 -13
  83. package/dist/{chunk-CJAHB4QY.js → chunk-I2ZILRS4.js} +6 -6
  84. package/dist/{chunk-O44FWDIZ.js → chunk-I7KUHNSA.js} +3 -3
  85. package/dist/{chunk-TFCNGH7V.js → chunk-ID7W4YBQ.js} +1 -1
  86. package/dist/{chunk-VIKKRYII.js → chunk-KQRWWJLF.js} +1 -1
  87. package/dist/{chunk-EDEEKMDR.js → chunk-KSAE6TKK.js} +5 -5
  88. package/dist/{chunk-73TR7RU4.js → chunk-LLCNGORA.js} +3 -3
  89. package/dist/{chunk-GILLSUOE.js → chunk-LMQDIQI4.js} +5 -5
  90. package/dist/{chunk-SWUBCXOZ.js → chunk-LWFFQJ3Y.js} +3 -3
  91. package/dist/{chunk-VUUC2V3L.js → chunk-N4D5YYO2.js} +2 -2
  92. package/dist/{chunk-SW33W47V.js → chunk-NCPBMIR5.js} +4 -4
  93. package/dist/{chunk-EYO2THPZ.js → chunk-NDYH6TS3.js} +2 -2
  94. package/dist/{chunk-7AYZRIII.js → chunk-NETM5KD2.js} +2 -2
  95. package/dist/{chunk-6EPBLKBZ.js → chunk-NMG6GB3W.js} +5 -5
  96. package/dist/{chunk-MLTJWAA4.js → chunk-NYJXBV6G.js} +5 -5
  97. package/dist/{chunk-GTNSTDUB.js → chunk-O3375GQ5.js} +2 -2
  98. package/dist/{chunk-ADNPGA5K.js → chunk-PIXOAUE6.js} +6 -6
  99. package/dist/{chunk-YOM5NVDW.js → chunk-PKDU2BY4.js} +3 -3
  100. package/dist/{chunk-JF3IB3QX.js → chunk-POXHWH73.js} +14 -3
  101. package/dist/{chunk-W7EUKTEI.js → chunk-PRRJZZAF.js} +3 -3
  102. package/dist/{chunk-JSTAZSTC.js → chunk-PSKPKVM6.js} +1 -1
  103. package/dist/{chunk-HFDMGCBY.js → chunk-Q73RI245.js} +5 -5
  104. package/dist/{chunk-7V4ZAQNO.js → chunk-QLKIY3FD.js} +1 -1
  105. package/dist/{chunk-XELCQFDJ.js → chunk-QQEJDPYK.js} +1 -1
  106. package/dist/{chunk-ZS4UIFHQ.js → chunk-R4BUYRSV.js} +15 -13
  107. package/dist/{chunk-NPYCMOFC.js → chunk-RE5KA47K.js} +3 -3
  108. package/dist/{chunk-BPEYHTXU.js → chunk-RIGWC5YP.js} +2 -2
  109. package/dist/{chunk-7WVGOW6O.js → chunk-RS6WYORY.js} +5 -5
  110. package/dist/{chunk-VXXWVOKF.js → chunk-SGOP6D4K.js} +1 -1
  111. package/dist/{chunk-BXFI56J5.js → chunk-UP2JWLPI.js} +2 -2
  112. package/dist/{chunk-IGUP6LA5.js → chunk-UQQN6ST3.js} +5 -3
  113. package/dist/{chunk-52MSHZYI.js → chunk-UXQI33VO.js} +6 -6
  114. package/dist/{chunk-TGYDKCOB.js → chunk-V2R6Y4ES.js} +2 -2
  115. package/dist/{chunk-XMZEG5QB.js → chunk-V3QWU2WK.js} +4 -4
  116. package/dist/{chunk-IYGEE7XO.js → chunk-VKGJ4XY5.js} +1 -1
  117. package/dist/{chunk-3R4MGEZY.js → chunk-VLV34V6X.js} +13 -13
  118. package/dist/{chunk-GC64OIDA.js → chunk-VY7UHIPW.js} +2 -2
  119. package/dist/{chunk-RR3J362O.js → chunk-W2LDJTM6.js} +5 -5
  120. package/dist/{chunk-VQLAGEHH.js → chunk-WXWWCODY.js} +1 -1
  121. package/dist/{chunk-SOMSKUI6.js → chunk-Y3OHWGZV.js} +2 -2
  122. package/dist/{chunk-LNHO5GIB.js → chunk-Z5OUGH4K.js} +10 -10
  123. package/dist/{chunk-7Y4AMZG3.js → chunk-ZJYSZDFR.js} +1 -1
  124. package/dist/{chunk-OHLI6KUK.js → chunk-ZNF5ATIQ.js} +425 -74
  125. package/dist/{chunk-NQAET7YS.js → chunk-ZWT4WF2W.js} +4 -4
  126. package/dist/{chunk-TSUPVKMX.js → chunk-ZXQNUTK3.js} +10 -10
  127. package/dist/{chunk-RMASRYS4.js → chunk-ZYXC6ZEQ.js} +1 -1
  128. package/dist/{codex-app-cards-switch-PU6AZFVH.js → codex-app-cards-switch-3TCXMVNB.js} +11 -11
  129. package/dist/{codex-card-routing-SNFM7GND.js → codex-card-routing-SYP6VQTQ.js} +2 -2
  130. package/dist/{codex-desktop-launch-NRK2NF4M.js → codex-desktop-launch-4JX7HA66.js} +1 -1
  131. package/dist/{codex-session-launch-YQNK4MEM.js → codex-session-launch-ITEGM77S.js} +20 -20
  132. package/dist/{config-QTON6UUP.js → config-KVGNGI6J.js} +3 -3
  133. package/dist/{global-upgrade-AOZNS5TM.js → global-upgrade-SSWKV5NF.js} +9 -9
  134. package/dist/{identity-TILIXUYO.js → identity-BMEZY3ST.js} +4 -4
  135. package/dist/{live-capabilities-BE7NSCFI.js → live-capabilities-AXVWZKBK.js} +4 -4
  136. package/dist/{paths-MIWMKITN.js → paths-EFJCRBNQ.js} +3 -3
  137. package/dist/reapply-S26S7GHW.js +75 -0
  138. package/dist/src/index.d.ts +2 -21
  139. package/dist/src/index.js +33 -35
  140. package/dist/{upgrade-lock-N75TGVFZ.js → upgrade-lock-FCKMP6W2.js} +4 -4
  141. package/dist/{usage-IH2QUEKB.js → usage-NCJLUCAW.js} +3 -3
  142. package/package.json +1 -1
  143. package/dist/chunk-62HBT23T.js +0 -162
  144. package/dist/chunk-IBYFO5RP.js +0 -39
  145. package/dist/reapply-W7TCOBMH.js +0 -75
@@ -3,6 +3,8 @@ import {
3
3
  COST_TRACKING_ENV,
4
4
  DEFAULT_MODEL_PRICES,
5
5
  TEAMMATE_IDLE_ACTION,
6
+ UNNAMED_ACTION,
7
+ cancelledTurnNeedsNoPush,
6
8
  canonicalGateInputs,
7
9
  compactionAction,
8
10
  deriveReceiptMeta,
@@ -26,90 +28,123 @@ import {
26
28
  taskTitleFrom,
27
29
  toolResultErrorText,
28
30
  transcriptTokensIn,
29
- transcriptUsageRequest,
30
- turnWasCancelledByUser
31
- } from "./chunk-IGUP6LA5.js";
31
+ transcriptUsageRequest
32
+ } from "./chunk-UQQN6ST3.js";
32
33
  import {
34
+ askUser,
33
35
  cancelQuestion,
34
36
  clientErrorKindOf,
37
+ isAwayPaused,
38
+ isDecisionStopped,
39
+ isLocalQuestionHandoff,
35
40
  isPolicyConfig,
41
+ isQuestionLimitRefusal,
42
+ isStoredPastThePushCap,
43
+ isThePersonsStop,
36
44
  reportClientError,
37
45
  sendNotification,
38
46
  waitForAnswer,
47
+ waitForOpenQuestion,
48
+ waitForQuestion,
49
+ waitsForThePhone,
39
50
  writeDegraded
40
- } from "./chunk-Q2NOGE3Y.js";
51
+ } from "./chunk-HVBMU7HP.js";
41
52
  import {
42
53
  RETRY_ACK,
43
54
  readCommandAck,
44
55
  refusedReceiptMessage
45
- } from "./chunk-TFCNGH7V.js";
56
+ } from "./chunk-ID7W4YBQ.js";
46
57
  import {
58
+ SubscriptionRequiredError,
47
59
  isRetryable,
48
60
  withRetry
49
- } from "./chunk-HFDMGCBY.js";
61
+ } from "./chunk-Q73RI245.js";
50
62
  import {
51
63
  fetchAsCredential
52
- } from "./chunk-TC6DWKY5.js";
64
+ } from "./chunk-HFDNWC2K.js";
53
65
  import {
54
66
  branchFor,
55
67
  projectNameFor,
56
68
  repoKeyFor
57
- } from "./chunk-7V4ZAQNO.js";
69
+ } from "./chunk-QLKIY3FD.js";
58
70
  import {
59
71
  getMachineId
60
- } from "./chunk-FGYQI6YP.js";
72
+ } from "./chunk-BLQ2JF2F.js";
61
73
  import {
62
74
  reportedInstallSource
63
- } from "./chunk-SOMSKUI6.js";
75
+ } from "./chunk-Y3OHWGZV.js";
64
76
  import {
65
77
  IDLE_PROMPT_NOTIFICATION,
66
78
  NOTIFICATION_PUSH_TYPES,
67
79
  POSTTOOLUSE_MIRROR_ONLY_TOOLS,
68
80
  claudeConfigDir
69
- } from "./chunk-GTNSTDUB.js";
81
+ } from "./chunk-O3375GQ5.js";
70
82
  import {
71
83
  compareVersion,
72
84
  parseVersion
73
- } from "./chunk-E4AOJK33.js";
85
+ } from "./chunk-GDWAKBBT.js";
74
86
  import {
75
87
  getApiKey,
76
88
  getBaseUrl
77
- } from "./chunk-7Y4AMZG3.js";
89
+ } from "./chunk-ZJYSZDFR.js";
78
90
  import {
79
91
  writeFileAtomic,
80
92
  writeJsonAtomicDurable
81
93
  } from "./chunk-PM2NRK6Y.js";
82
94
  import {
95
+ ASK_CONTEXT_MAX,
83
96
  BLOCKED_ACTION_GRANT_TTL_SECONDS,
84
97
  CLI_POLICY_REQUEST_CAPABILITIES,
85
98
  COMMAND_RECOVERY,
86
- HOOK_CWD_MAX_LENGTH,
99
+ DECISION_STOP_REASON,
100
+ HANDED_BACK_REASON,
87
101
  HOOK_SOURCES,
88
102
  POLICY_REQUEST_CAPABILITIES_HEADER,
103
+ QUESTION_LIMIT_PROMPT_REASON,
89
104
  REPO_AWARE_AGENTS,
105
+ UNVERIFIABLE_APPROVAL_REASON,
106
+ WITHDRAWN_APPROVAL_REASON,
107
+ agentQuestionContext,
108
+ answersToQuestionsAsAsked,
90
109
  askableToolPathOf,
91
110
  blockedActionIdentity,
92
111
  canCarryPendingCommand,
112
+ claudePreToolUseOutput,
113
+ claudeStoppedPreToolUseOutput,
93
114
  claudeTurnEndOutput,
94
115
  codexUnansweredPreToolUse,
116
+ denyReasonFrom,
117
+ effectiveWaitSeconds,
118
+ fitsAPlainSelect,
95
119
  gateOutputFor,
96
120
  governingToolInputOf,
121
+ hookWaitClamped,
122
+ hookWaitDeadline,
123
+ isAgentQuestionSet,
124
+ isAskableHookCwd,
97
125
  isAutoApprove,
98
126
  isClaudeWakePrompt,
99
127
  isGateOutcome,
128
+ isNativeAskEvent,
100
129
  isProvenModeResponse,
101
130
  isRecord,
131
+ isTypedAnswerQuestion,
102
132
  modeStateFromResponse,
103
133
  nativeRecord,
134
+ parseAgentQuestionAnswers,
104
135
  parsePermissionMode,
105
136
  pendingCommandEvents,
106
137
  pendingCommandInstruction,
138
+ plainAskOf,
107
139
  policyRequestCapabilitiesHeaderValue,
108
140
  questionLimitHandBack,
141
+ questionServedItsWholeWindow,
142
+ questionsShownAsASet,
143
+ refusesWhenUnanswered,
109
144
  resolveAutoResolveOrigin,
110
145
  resolvePolicy,
111
146
  unansweredRefusalReason
112
- } from "./chunk-JF3IB3QX.js";
147
+ } from "./chunk-POXHWH73.js";
113
148
 
114
149
  // src/pending.ts
115
150
  import { join } from "path";
@@ -817,8 +852,304 @@ var readNewUsage = (transcriptPath, sessionId) => {
817
852
  }
818
853
  };
819
854
 
855
+ // src/answer.ts
856
+ var isDeferAnswer = (value) => value === "defer";
857
+
858
+ // src/session-notice.ts
859
+ import { existsSync as existsSync3, writeFileSync as writeFileSync4 } from "fs";
860
+ import { tmpdir as tmpdir4 } from "os";
861
+ import { join as join4 } from "path";
862
+ var SUBSCRIPTION_REQUIRED_NOTICE_KIND = "subscription-required";
863
+ var oncePerSession = (kind, sessionId) => {
864
+ try {
865
+ const key = (sessionId || DEFAULT_SESSION).replace(/[^a-zA-Z0-9_-]/g, "");
866
+ const marker = join4(tmpdir4(), `pushary-${kind}-${key}`);
867
+ if (existsSync3(marker)) return false;
868
+ writeFileSync4(marker, "1", "utf-8");
869
+ return true;
870
+ } catch {
871
+ return false;
872
+ }
873
+ };
874
+ var subscriptionRequiredNotice = (upgradeUrl) => `[pushary] Your Pushary workspace has no active subscription, so approvals stay with your agent. Subscribe: ${upgradeUrl}`;
875
+ var announceSubscriptionRequired = (upgradeUrl, sessionId) => {
876
+ try {
877
+ if (!oncePerSession(SUBSCRIPTION_REQUIRED_NOTICE_KIND, sessionId)) return;
878
+ process.stderr.write(`${subscriptionRequiredNotice(upgradeUrl)}
879
+ `);
880
+ } catch {
881
+ return;
882
+ }
883
+ };
884
+
885
+ // src/agent-question-ask.ts
886
+ var ONLY_QUESTION = { index: 0, total: 1 };
887
+ var STOPPED = { kind: "stopped" };
888
+ var UNAVAILABLE = { kind: "unavailable" };
889
+ var UNANSWERED = { kind: "unanswered" };
890
+ var answeredWith = (answers) => ({ kind: "answered", answers });
891
+ var failedAskOutcome = (error, sessionId) => outcomeOfFailedAsk(error, sessionId, UNAVAILABLE) ?? UNANSWERED;
892
+ var richCardOf = (question) => {
893
+ const shownAsASet = questionsShownAsASet([question]);
894
+ if (!shownAsASet) return void 0;
895
+ return isAgentQuestionSet(shownAsASet) || !fitsAPlainSelect(question) ? shownAsASet : void 0;
896
+ };
897
+ var writeInTravelsBesideThePlainSelect = (question, ask2, richCard) => ask2.type === "select" && richCard === void 0 && question.allowOther !== false;
898
+ var cardOf = (question) => {
899
+ const ask2 = plainAskOf(question);
900
+ const richCard = richCardOf(question);
901
+ return {
902
+ type: ask2.type,
903
+ ...ask2.type === "select" ? { options: [...ask2.options] } : {},
904
+ ...richCard ? { questions: [...richCard] } : {},
905
+ ...writeInTravelsBesideThePlainSelect(question, ask2, richCard) ? { allowOther: true } : {}
906
+ };
907
+ };
908
+ var positionedToolUseId = (toolUseId, position) => toolUseId && position.total > 1 ? `${toolUseId}#q${position.index}` : toolUseId;
909
+ var outcomeOfFailedAsk = (error, sessionId, failure) => {
910
+ if (isQuestionLimitRefusal(error)) return void 0;
911
+ if (!(error instanceof SubscriptionRequiredError)) return failure;
912
+ announceSubscriptionRequired(error.upgradeUrl, sessionId);
913
+ return void 0;
914
+ };
915
+ var storedWaitDeadline = (result, requestedDeadline) => {
916
+ const stored = result.waitEndsAt ? Date.parse(result.waitEndsAt) : Number.NaN;
917
+ return Number.isFinite(stored) ? Math.min(stored, requestedDeadline) : requestedDeadline;
918
+ };
919
+ var questionContext = (question, index, total, project) => {
920
+ const subject = agentQuestionContext(question.header, project);
921
+ const line = total > 1 ? `${subject} (${index + 1} of ${total})` : subject;
922
+ return line.slice(0, ASK_CONTEXT_MAX);
923
+ };
924
+ var legacyAnswerMap = (question, value) => JSON.stringify({ [question.question]: question.multiSelect ? JSON.stringify([value]) : value });
925
+ var answerInTheEarlierForm = (question, value) => isTypedAnswerQuestion(question) ? null : parseAgentQuestionAnswers([question], legacyAnswerMap(question, value));
926
+ var answersOnOneCard = (question, value, typedAnswer = false) => answersToQuestionsAsAsked([question], value, typedAnswer) ?? answerInTheEarlierForm(question, value);
927
+ var answersToTheCard = (question, value, typedAnswer = false) => richCardOf(question) ? answersToQuestionsAsAsked([question], value, typedAnswer) : answersOnOneCard(question, value, typedAnswer);
928
+ var oneCardAsk = (call, only, position = ONLY_QUESTION) => ({
929
+ question: only.question,
930
+ ...cardOf(only),
931
+ context: questionContext(only, position.index, position.total, call.projectName),
932
+ agentName: call.agentName,
933
+ sessionId: call.sessionId,
934
+ machineId: getMachineId(),
935
+ toolName: call.toolName,
936
+ toolUseId: positionedToolUseId(call.toolUseId, position)
937
+ });
938
+ var outcomeOfOneCardAnswer = (only, answer) => {
939
+ const values = answer.answered && answer.value ? answersToTheCard(only, answer.value, answer.typedAnswer) : null;
940
+ if (!values || !answer.typedAnswer && isDeferAnswer(answer.value)) {
941
+ return UNANSWERED;
942
+ }
943
+ return answeredWith(values);
944
+ };
945
+ var askAsOneCard = async (apiKey, call, only) => {
946
+ let result;
947
+ try {
948
+ result = await askUser(apiKey, { ...oneCardAsk(call, only), waitEndsAt: new Date(call.deadline).toISOString() });
949
+ } catch (error) {
950
+ return failedAskOutcome(error, call.sessionId);
951
+ }
952
+ if (isDecisionStopped(result)) return STOPPED;
953
+ call.onQuestionCreated?.(result.correlationId);
954
+ const answer = await waitForQuestion(apiKey, result, storedWaitDeadline(result, call.deadline), void 0, call.signal);
955
+ if (isDecisionStopped(answer)) return STOPPED;
956
+ return outcomeOfOneCardAnswer(only, answer);
957
+ };
958
+ var askAgentQuestionWhileOpen = async (apiKey, call, only, askerStillWaits, position = ONLY_QUESTION) => {
959
+ let result;
960
+ try {
961
+ result = await askUser(apiKey, oneCardAsk(call, only, position));
962
+ } catch (error) {
963
+ return failedAskOutcome(error, call.sessionId);
964
+ }
965
+ if (isThePersonsStop(result)) return STOPPED;
966
+ call.onQuestionCreated?.(result.correlationId);
967
+ const answer = await waitForOpenQuestion(apiKey, result, askerStillWaits);
968
+ if (isThePersonsStop(answer)) return STOPPED;
969
+ return outcomeOfOneCardAnswer(only, answer);
970
+ };
971
+ var askQuestionByQuestion = async (apiKey, call, questions) => {
972
+ const answers = {};
973
+ for (const [index, question] of questions.entries()) {
974
+ if (call.signal?.aborted) return UNANSWERED;
975
+ let result;
976
+ try {
977
+ result = await askUser(apiKey, {
978
+ question: question.question,
979
+ ...cardOf(question),
980
+ context: questionContext(question, index, questions.length, call.projectName),
981
+ agentName: call.agentName,
982
+ sessionId: call.sessionId,
983
+ machineId: getMachineId(),
984
+ toolName: call.toolName,
985
+ toolUseId: positionedToolUseId(call.toolUseId, { index, total: questions.length }),
986
+ waitEndsAt: new Date(call.deadline).toISOString()
987
+ });
988
+ } catch (error) {
989
+ return failedAskOutcome(error, call.sessionId);
990
+ }
991
+ if (isDecisionStopped(result)) return STOPPED;
992
+ call.onQuestionCreated?.(result.correlationId);
993
+ const answer = await waitForQuestion(apiKey, result, storedWaitDeadline(result, call.deadline), void 0, call.signal);
994
+ if (isDecisionStopped(answer)) return STOPPED;
995
+ const legacyValue = answer.answered ? answer.value?.trim() : void 0;
996
+ const values = legacyValue ? answersOnOneCard(question, legacyValue, answer.typedAnswer) : null;
997
+ const value = values?.[question.question];
998
+ if (!value || !answer.typedAnswer && isDeferAnswer(answer.value)) {
999
+ return UNANSWERED;
1000
+ }
1001
+ answers[question.question] = value;
1002
+ }
1003
+ return answeredWith(answers);
1004
+ };
1005
+ var askAgentQuestions = (apiKey, call, questions) => {
1006
+ const [only, ...rest] = questions;
1007
+ if (!only) return Promise.resolve(UNANSWERED);
1008
+ return rest.length === 0 ? askAsOneCard(apiKey, call, only) : askQuestionByQuestion(apiKey, call, questions);
1009
+ };
1010
+
820
1011
  // src/codex-adapter.ts
821
1012
  import { resolve } from "path";
1013
+
1014
+ // src/pre-tool-use-output.ts
1015
+ var allow = (reason) => claudePreToolUseOutput("allow", reason);
1016
+ var deny = (reason) => claudePreToolUseOutput("deny", reason);
1017
+ var ask = (reason) => claudePreToolUseOutput("ask", reason);
1018
+ var halted = (reason) => claudeStoppedPreToolUseOutput(reason);
1019
+
1020
+ // src/permission-ask-outcome.ts
1021
+ var NO_ASKED_FILE_PATH = {};
1022
+ var NO_SENDABLE_CWD = {};
1023
+ var sendableCwd = (cwd) => cwd !== void 0 && isAskableHookCwd(cwd) ? { cwd } : NO_SENDABLE_CWD;
1024
+ var askedFilePathOf = (toolName, toolInput, cwd) => {
1025
+ const toolPath = askableToolPathOf(toolName, toolInput);
1026
+ return toolPath === void 0 ? NO_ASKED_FILE_PATH : { toolPath, ...sendableCwd(cwd) };
1027
+ };
1028
+ var questionWindowOf = (question, { cutShort }) => ({
1029
+ clampCut: cutShort,
1030
+ paused: isAwayPaused(question),
1031
+ overflow: isStoredPastThePushCap(question)
1032
+ });
1033
+ var refusingTimeoutOutput = (window) => deny(unansweredRefusalReason(window.paused));
1034
+ var unservedApprovalOutput = (window, event) => isNativeAskEvent(event) ? ask(WITHDRAWN_APPROVAL_REASON) : refusingTimeoutOutput(window);
1035
+ var approvingTimeoutOutput = (window, event) => questionServedItsWholeWindow(window) ? allow() : unservedApprovalOutput(window, event);
1036
+ var questionLimitOutput = (handBack) => handBack.kind === "refuse" ? deny(handBack.reason) : ask(QUESTION_LIMIT_PROMPT_REASON);
1037
+ var outcomeOfFailedPermissionAsk = (error, sessionId, questionLimitFacts, subscriptionRequiredOutput) => {
1038
+ if (isQuestionLimitRefusal(error)) return questionLimitOutput(questionLimitHandBack(questionLimitFacts));
1039
+ return outcomeOfFailedAsk(error, sessionId, halted(UNVERIFIABLE_APPROVAL_REASON)) ?? subscriptionRequiredOutput;
1040
+ };
1041
+ var handlePushOnly = async (apiKey, call, timeoutSeconds, timeoutAction, signals) => {
1042
+ const {
1043
+ description,
1044
+ projectName,
1045
+ agentName,
1046
+ sessionId,
1047
+ machineId,
1048
+ toolName,
1049
+ toolTarget,
1050
+ decision,
1051
+ agentPromptFollows,
1052
+ startMs,
1053
+ subscriptionRequiredOutput,
1054
+ announceWait
1055
+ } = call;
1056
+ const effectiveWait = effectiveWaitSeconds(timeoutAction, timeoutSeconds, "claude");
1057
+ const now = Date.now();
1058
+ const requestedDeadline = hookWaitDeadline(startMs, effectiveWait, "claude", now);
1059
+ const clampCut = hookWaitClamped(startMs, effectiveWait, "claude", now);
1060
+ let result;
1061
+ try {
1062
+ result = await askUser(apiKey, {
1063
+ question: `Allow ${description || UNNAMED_ACTION}?`,
1064
+ type: "confirm",
1065
+ context: `Agent wants to run this in ${projectName}`,
1066
+ agentName,
1067
+ sessionId,
1068
+ machineId,
1069
+ toolName,
1070
+ toolTarget,
1071
+ waitEndsAt: timeoutAction !== "approve" && timeoutAction !== "deny" || clampCut ? new Date(requestedDeadline).toISOString() : void 0,
1072
+ ...decision
1073
+ });
1074
+ } catch (error) {
1075
+ signals.askFailed = true;
1076
+ return outcomeOfFailedPermissionAsk(error, sessionId, {
1077
+ refusesUnanswered: refusesWhenUnanswered({ mode: "push_only", timeoutAction }),
1078
+ agentPromptFollows
1079
+ }, subscriptionRequiredOutput);
1080
+ }
1081
+ if (isDecisionStopped(result)) return halted(DECISION_STOP_REASON);
1082
+ const deadline = storedWaitDeadline(result, requestedDeadline);
1083
+ if (waitsForThePhone(result)) announceWait(effectiveWait, result.answerUrl, sessionId);
1084
+ const answer = await waitForQuestion(apiKey, result, deadline);
1085
+ if (isDecisionStopped(answer)) return halted(DECISION_STOP_REASON);
1086
+ if (!answer.answered && isLocalQuestionHandoff(result)) return ask("Approve in the current client.");
1087
+ if (answer.answered) {
1088
+ if (isDeferAnswer(answer.value)) return ask(HANDED_BACK_REASON);
1089
+ signals.humanDecision = true;
1090
+ return answer.value === "yes" ? allow() : deny(denyReasonFrom(answer.value, answer.note));
1091
+ }
1092
+ const window = questionWindowOf(result, { cutShort: clampCut || deadline < requestedDeadline });
1093
+ if (timeoutAction === "wait" || window.clampCut) {
1094
+ return ask(WITHDRAWN_APPROVAL_REASON);
1095
+ }
1096
+ switch (timeoutAction) {
1097
+ case "approve":
1098
+ return approvingTimeoutOutput(window, call.event);
1099
+ case "deny":
1100
+ return refusingTimeoutOutput(window);
1101
+ default:
1102
+ return ask("No push response, asking in terminal");
1103
+ }
1104
+ };
1105
+ var handlePushFirst = async (apiKey, call, pushFirstSeconds, signals) => {
1106
+ const {
1107
+ description,
1108
+ projectName,
1109
+ agentName,
1110
+ sessionId,
1111
+ machineId,
1112
+ toolName,
1113
+ toolTarget,
1114
+ decision,
1115
+ agentPromptFollows,
1116
+ startMs,
1117
+ subscriptionRequiredOutput,
1118
+ announceWait
1119
+ } = call;
1120
+ const requestedDeadline = hookWaitDeadline(startMs, pushFirstSeconds, "claude", Date.now());
1121
+ let result;
1122
+ try {
1123
+ result = await askUser(apiKey, {
1124
+ question: `Allow ${description || UNNAMED_ACTION}?`,
1125
+ type: "confirm",
1126
+ context: `Agent wants to run this in ${projectName}`,
1127
+ agentName,
1128
+ sessionId,
1129
+ machineId,
1130
+ toolName,
1131
+ toolTarget,
1132
+ waitEndsAt: new Date(requestedDeadline).toISOString(),
1133
+ ...decision
1134
+ });
1135
+ } catch (error) {
1136
+ signals.askFailed = true;
1137
+ return outcomeOfFailedPermissionAsk(error, sessionId, { refusesUnanswered: false, agentPromptFollows }, subscriptionRequiredOutput);
1138
+ }
1139
+ if (isDecisionStopped(result)) return halted(DECISION_STOP_REASON);
1140
+ if (waitsForThePhone(result)) announceWait(pushFirstSeconds, result.answerUrl, sessionId);
1141
+ const deadline = storedWaitDeadline(result, requestedDeadline);
1142
+ const answer = await waitForQuestion(apiKey, result, deadline, 1500);
1143
+ if (isDecisionStopped(answer)) return halted(DECISION_STOP_REASON);
1144
+ if (answer.answered) {
1145
+ if (isDeferAnswer(answer.value)) return ask(HANDED_BACK_REASON);
1146
+ signals.humanDecision = true;
1147
+ return answer.value === "yes" ? allow() : deny(denyReasonFrom(answer.value, answer.note));
1148
+ }
1149
+ return ask(WITHDRAWN_APPROVAL_REASON);
1150
+ };
1151
+
1152
+ // src/codex-adapter.ts
822
1153
  var CODEX_AGENT = { type: "codex", label: "Codex" };
823
1154
  var codexAllow = () => ({ kind: "allow" });
824
1155
  var codexDeny = (reason) => ({ kind: "deny", reason });
@@ -871,20 +1202,23 @@ var codexQuestionLimitDecision = (facts) => {
871
1202
  const handBack = questionLimitHandBack(facts);
872
1203
  return handBack.kind === "refuse" ? codexDeny(handBack.reason) : codexPass();
873
1204
  };
874
- var questionServedItsWholeWindow = (window) => !window.clampCut && !window.paused && !window.overflow;
875
1205
  var permissionTimeoutDecision = (timeoutAction, window) => {
876
- if (timeoutAction === "approve") return questionServedItsWholeWindow(window) ? codexAllow() : codexPass();
877
- if (timeoutAction === "deny") return codexDeny(unansweredRefusalReason(window.paused));
878
- return codexPass();
1206
+ switch (timeoutAction) {
1207
+ case "approve":
1208
+ return questionServedItsWholeWindow(window) ? codexAllow() : codexPass();
1209
+ case "deny":
1210
+ return codexDeny(unansweredRefusalReason(window.paused));
1211
+ case "escalate":
1212
+ case "wait":
1213
+ default:
1214
+ return codexPass();
1215
+ }
879
1216
  };
880
1217
  var codexDecisionOf = (ending) => ending.kind === "deny" ? codexDeny(ending.reason) : codexPass();
881
1218
  var codexUnansweredDecision = (rule, fullWindowServed, paused) => codexDecisionOf(codexUnansweredPreToolUse({ mode: rule.mode, timeoutAction: rule.timeoutAction, fullWindowServed, paused }));
882
- var NO_ASKED_FILE_PATH = {};
883
- var sendableCwd = (cwd) => cwd !== void 0 && cwd.length > 0 && cwd.length <= HOOK_CWD_MAX_LENGTH ? { cwd } : {};
884
1219
  var codexAskedFilePathOf = (gateInput) => {
885
1220
  const governing = governingToolInputOf(gateInput);
886
- const toolPath = governing === void 0 ? void 0 : askableToolPathOf(gateInput.toolName, governing);
887
- return toolPath === void 0 ? NO_ASKED_FILE_PATH : { toolPath, ...sendableCwd(gateInput.cwd) };
1221
+ return governing === void 0 ? NO_ASKED_FILE_PATH : askedFilePathOf(gateInput.toolName, governing, gateInput.cwd);
888
1222
  };
889
1223
 
890
1224
  // src/driver.ts
@@ -897,18 +1231,18 @@ var phoneDrivenEnv = (base) => ({
897
1231
  });
898
1232
 
899
1233
  // src/throttle.ts
900
- import { join as join4 } from "path";
901
- import { tmpdir as tmpdir4 } from "os";
1234
+ import { join as join5 } from "path";
1235
+ import { tmpdir as tmpdir5 } from "os";
902
1236
  import { createHash as createHash4 } from "crypto";
903
- import { existsSync as existsSync3, mkdirSync as mkdirSync3, statSync as statSync3, writeFileSync as writeFileSync4, rmSync as rmSync2 } from "fs";
904
- var THROTTLE_DIR = join4(tmpdir4(), "pushary-throttle");
905
- var markerPath = (key) => join4(THROTTLE_DIR, createHash4("sha256").update(key).digest("hex").slice(0, 16));
1237
+ import { existsSync as existsSync4, mkdirSync as mkdirSync3, statSync as statSync3, writeFileSync as writeFileSync5, rmSync as rmSync2 } from "fs";
1238
+ var THROTTLE_DIR = join5(tmpdir5(), "pushary-throttle");
1239
+ var markerPath = (key) => join5(THROTTLE_DIR, createHash4("sha256").update(key).digest("hex").slice(0, 16));
906
1240
  var claimThrottle = (key, windowMs) => {
907
1241
  try {
908
1242
  const path = markerPath(key);
909
- if (existsSync3(path) && Date.now() - statSync3(path).mtimeMs < windowMs) return "throttled";
1243
+ if (existsSync4(path) && Date.now() - statSync3(path).mtimeMs < windowMs) return "throttled";
910
1244
  mkdirSync3(THROTTLE_DIR, { recursive: true });
911
- writeFileSync4(path, "", "utf-8");
1245
+ writeFileSync5(path, "", "utf-8");
912
1246
  return "passed";
913
1247
  } catch {
914
1248
  return "unavailable";
@@ -920,15 +1254,15 @@ var releaseThrottle = (key) => {
920
1254
 
921
1255
  // src/blocked-action-hint.ts
922
1256
  import { createHash as createHash5 } from "crypto";
923
- import { existsSync as existsSync4, mkdirSync as mkdirSync5, readFileSync as readFileSync5, readdirSync as readdirSync4, rmSync as rmSync4, statSync as statSync4, utimesSync as utimesSync2 } from "fs";
924
- import { tmpdir as tmpdir6 } from "os";
925
- import { join as join6 } from "path";
1257
+ import { existsSync as existsSync5, mkdirSync as mkdirSync5, readFileSync as readFileSync5, readdirSync as readdirSync4, rmSync as rmSync4, statSync as statSync4, utimesSync as utimesSync2 } from "fs";
1258
+ import { tmpdir as tmpdir7 } from "os";
1259
+ import { join as join7 } from "path";
926
1260
 
927
1261
  // src/call-decision-store.ts
928
1262
  import { randomUUID } from "crypto";
929
- import { lstatSync as lstatSync3, mkdirSync as mkdirSync4, readFileSync as readFileSync4, readdirSync as readdirSync3, renameSync, rmSync as rmSync3, writeFileSync as writeFileSync5 } from "fs";
930
- import { tmpdir as tmpdir5, userInfo } from "os";
931
- import { join as join5 } from "path";
1263
+ import { lstatSync as lstatSync3, mkdirSync as mkdirSync4, readFileSync as readFileSync4, readdirSync as readdirSync3, renameSync, rmSync as rmSync3, writeFileSync as writeFileSync6 } from "fs";
1264
+ import { tmpdir as tmpdir6, userInfo } from "os";
1265
+ import { join as join6 } from "path";
932
1266
  var userScope = () => {
933
1267
  try {
934
1268
  const info = userInfo();
@@ -1007,7 +1341,7 @@ var parseDecision = (raw) => {
1007
1341
  var sweepExpired = (dir, nowMs, ttlMs) => {
1008
1342
  try {
1009
1343
  for (const name of readdirSync3(dir)) {
1010
- const path = join5(dir, name);
1344
+ const path = join6(dir, name);
1011
1345
  try {
1012
1346
  if (nowMs - lstatSync3(path).mtimeMs >= ttlMs) rmSync3(path, { force: true });
1013
1347
  } catch {
@@ -1030,7 +1364,7 @@ var readClaimed = (claimed, ttlMs) => {
1030
1364
  }
1031
1365
  };
1032
1366
  var callDecisionStore = (name, ttlMs) => {
1033
- const decisionDir = () => join5(tmpdir5(), `pushary-${name}-decisions-${userScope()}`);
1367
+ const decisionDir = () => join6(tmpdir6(), `pushary-${name}-decisions-${userScope()}`);
1034
1368
  return {
1035
1369
  record: (key, decision) => {
1036
1370
  if (!key) return;
@@ -1040,10 +1374,10 @@ var callDecisionStore = (name, ttlMs) => {
1040
1374
  return;
1041
1375
  }
1042
1376
  sweepExpired(dir, Date.now(), ttlMs);
1043
- const pending = join5(dir, `${key}.${randomUUID()}.pending`);
1377
+ const pending = join6(dir, `${key}.${randomUUID()}.pending`);
1044
1378
  try {
1045
- writeFileSync5(pending, JSON.stringify(decision), { encoding: "utf-8", mode: PRIVATE_FILE_MODE, flag: "wx" });
1046
- renameSync(pending, join5(dir, key));
1379
+ writeFileSync6(pending, JSON.stringify(decision), { encoding: "utf-8", mode: PRIVATE_FILE_MODE, flag: "wx" });
1380
+ renameSync(pending, join6(dir, key));
1047
1381
  } catch (error) {
1048
1382
  removeQuietly(pending);
1049
1383
  reportUnrecordedDecision(error instanceof Error ? error.message : String(error));
@@ -1053,9 +1387,9 @@ var callDecisionStore = (name, ttlMs) => {
1053
1387
  if (!key) return null;
1054
1388
  const dir = decisionDir();
1055
1389
  if (!isPrivateFolder(dir)) return null;
1056
- const claimed = join5(dir, `${key}.${randomUUID()}.claimed`);
1390
+ const claimed = join6(dir, `${key}.${randomUUID()}.claimed`);
1057
1391
  try {
1058
- renameSync(join5(dir, key), claimed);
1392
+ renameSync(join6(dir, key), claimed);
1059
1393
  } catch {
1060
1394
  return null;
1061
1395
  }
@@ -1064,7 +1398,7 @@ var callDecisionStore = (name, ttlMs) => {
1064
1398
  forget: (key) => {
1065
1399
  if (!key) return;
1066
1400
  const dir = decisionDir();
1067
- if (isPrivateFolder(dir)) removeQuietly(join5(dir, key));
1401
+ if (isPrivateFolder(dir)) removeQuietly(join6(dir, key));
1068
1402
  }
1069
1403
  };
1070
1404
  };
@@ -1086,13 +1420,13 @@ var blockedActionFingerprint = ({ source = "claude", sessionId, toolName, toolIn
1086
1420
  const subject = blockedActionSubject(source, sessionId, canonical.toolName, canonicalInput, cwd);
1087
1421
  return subject ? createHash5("sha256").update(blockedActionIdentity(subject), "utf8").digest("hex") : null;
1088
1422
  };
1089
- var hintDir = () => join6(tmpdir6(), `pushary-blocked-action-hints-${userScope()}`);
1090
- var hintFile = (fingerprint) => join6(hintDir(), fingerprint);
1423
+ var hintDir = () => join7(tmpdir7(), `pushary-blocked-action-hints-${userScope()}`);
1424
+ var hintFile = (fingerprint) => join7(hintDir(), fingerprint);
1091
1425
  var isExpired = (mtimeMs, nowMs) => nowMs - mtimeMs >= BLOCKED_ACTION_HINT_TTL_MS;
1092
1426
  var sweepFilesOlderThan = (dir, ttlMs, nowMs) => {
1093
1427
  try {
1094
1428
  for (const name of readdirSync4(dir)) {
1095
- const path = join6(dir, name);
1429
+ const path = join7(dir, name);
1096
1430
  try {
1097
1431
  if (nowMs - statSync4(path).mtimeMs >= ttlMs) rmSync4(path, { force: true });
1098
1432
  } catch {
@@ -1107,7 +1441,7 @@ var recordBlockedActionHint = (fingerprint, approved) => {
1107
1441
  if (!isFingerprint(fingerprint)) return false;
1108
1442
  try {
1109
1443
  const dir = hintDir();
1110
- if (!existsSync4(dir)) mkdirSync5(dir, { recursive: true, mode: 448 });
1444
+ if (!existsSync5(dir)) mkdirSync5(dir, { recursive: true, mode: 448 });
1111
1445
  else sweepFilesOlderThan(dir, BLOCKED_ACTION_HINT_TTL_MS, Date.now());
1112
1446
  writeFileAtomic(hintFile(fingerprint), JSON.stringify({ fingerprint, ...approved }), 384);
1113
1447
  return true;
@@ -1170,7 +1504,7 @@ var forgetBlockedActionHint = (fingerprint) => {
1170
1504
 
1171
1505
  // src/claude-session-record.ts
1172
1506
  import { readFileSync as readFileSync6, readdirSync as readdirSync5, statSync as statSync5 } from "fs";
1173
- import { join as join7 } from "path";
1507
+ import { join as join8 } from "path";
1174
1508
  var UNREADABLE = { kind: "unreadable" };
1175
1509
  var OTHER_SESSION = { kind: "other_session" };
1176
1510
  var PROCESS_ID = /^[1-9]\d*$/;
@@ -1205,7 +1539,7 @@ var readSessionFile = (path, sessionId) => {
1205
1539
  };
1206
1540
  var runningSessionFiles = (sessions) => {
1207
1541
  try {
1208
- return readdirSync5(sessions).filter((name) => name.endsWith(SESSION_FILE_SUFFIX)).map((name) => name.slice(0, -SESSION_FILE_SUFFIX.length)).filter((pid) => PROCESS_ID.test(pid) && isRunning(Number(pid))).map((pid) => join7(sessions, `${pid}${SESSION_FILE_SUFFIX}`));
1542
+ return readdirSync5(sessions).filter((name) => name.endsWith(SESSION_FILE_SUFFIX)).map((name) => name.slice(0, -SESSION_FILE_SUFFIX.length)).filter((pid) => PROCESS_ID.test(pid) && isRunning(Number(pid))).map((pid) => join8(sessions, `${pid}${SESSION_FILE_SUFFIX}`));
1209
1543
  } catch {
1210
1544
  return [];
1211
1545
  }
@@ -1225,7 +1559,7 @@ var oldestVersionAcross = (readings) => {
1225
1559
  var claudeSessionVersion = (sessionId, environment = process.env) => {
1226
1560
  if (!sessionId) return null;
1227
1561
  try {
1228
- const sessions = join7(claudeConfigDir(void 0, environment), "sessions");
1562
+ const sessions = join8(claudeConfigDir(void 0, environment), "sessions");
1229
1563
  return oldestVersionAcross(runningSessionFiles(sessions).map((path) => readSessionFile(path, sessionId)));
1230
1564
  } catch {
1231
1565
  return null;
@@ -1234,12 +1568,12 @@ var claudeSessionVersion = (sessionId, environment = process.env) => {
1234
1568
 
1235
1569
  // src/background-work.ts
1236
1570
  import { createHash as createHash6 } from "crypto";
1237
- import { mkdirSync as mkdirSync6, rmSync as rmSync5, statSync as statSync6, writeFileSync as writeFileSync6 } from "fs";
1238
- import { tmpdir as tmpdir7 } from "os";
1239
- import { join as join8 } from "path";
1571
+ import { mkdirSync as mkdirSync6, rmSync as rmSync5, statSync as statSync6, writeFileSync as writeFileSync7 } from "fs";
1572
+ import { tmpdir as tmpdir8 } from "os";
1573
+ import { join as join9 } from "path";
1240
1574
  var BACKGROUND_WORK_TTL_MS = 60 * 60 * 1e3;
1241
- var backgroundWorkDir = () => join8(tmpdir7(), "pushary-background-work");
1242
- var markerFor = (sessionKey) => join8(backgroundWorkDir(), createHash6("sha256").update(sessionKey).digest("hex"));
1575
+ var backgroundWorkDir = () => join9(tmpdir8(), "pushary-background-work");
1576
+ var markerFor = (sessionKey) => join9(backgroundWorkDir(), createHash6("sha256").update(sessionKey).digest("hex"));
1243
1577
  var hasRunningBackgroundTasks = (backgroundTasks) => Array.isArray(backgroundTasks) && backgroundTasks.length > 0;
1244
1578
  var noteBackgroundWork = (sessionKey, running) => {
1245
1579
  try {
@@ -1248,7 +1582,7 @@ var noteBackgroundWork = (sessionKey, running) => {
1248
1582
  return;
1249
1583
  }
1250
1584
  mkdirSync6(backgroundWorkDir(), { recursive: true, mode: 448 });
1251
- writeFileSync6(markerFor(sessionKey), "", { mode: 384 });
1585
+ writeFileSync7(markerFor(sessionKey), "", { mode: 384 });
1252
1586
  } catch {
1253
1587
  return;
1254
1588
  }
@@ -1263,18 +1597,18 @@ var isWaitingOnBackgroundWork = (sessionKey, nowMs = Date.now()) => {
1263
1597
 
1264
1598
  // src/gate-outcome-record.ts
1265
1599
  import { createHash as createHash7 } from "crypto";
1266
- import { lstatSync as lstatSync4, readFileSync as readFileSync7, readdirSync as readdirSync6, utimesSync as utimesSync3, writeFileSync as writeFileSync7 } from "fs";
1267
- import { tmpdir as tmpdir8 } from "os";
1268
- import { join as join9 } from "path";
1600
+ import { lstatSync as lstatSync4, readFileSync as readFileSync7, readdirSync as readdirSync6, utimesSync as utimesSync3, writeFileSync as writeFileSync8 } from "fs";
1601
+ import { tmpdir as tmpdir9 } from "os";
1602
+ import { join as join10 } from "path";
1269
1603
  var GATE_OUTCOME_RECORD_TTL_MS = 60 * 60 * 1e3;
1270
1604
  var GATE_OUTCOME_RECORD_LIMIT = 512;
1271
1605
  var GATE_OUTCOME_SWEEP_INTERVAL_MS = 10 * 60 * 1e3;
1272
1606
  var GATE_OUTCOME_SWEEP_STAMP = ".swept";
1273
- var gateOutcomeDirectory = () => join9(tmpdir8(), `pushary-gate-outcomes-${userScope()}`);
1607
+ var gateOutcomeDirectory = () => join10(tmpdir9(), `pushary-gate-outcomes-${userScope()}`);
1274
1608
  var gateOutcomeRecordName = (toolUseId) => createHash7("sha256").update(toolUseId, "utf-8").digest("hex").slice(0, 32);
1275
1609
  var startedSweepStamp = (stamp) => {
1276
1610
  try {
1277
- writeFileSync7(stamp, "", { flag: "wx", mode: PRIVATE_FILE_MODE });
1611
+ writeFileSync8(stamp, "", { flag: "wx", mode: PRIVATE_FILE_MODE });
1278
1612
  return true;
1279
1613
  } catch {
1280
1614
  return false;
@@ -1291,7 +1625,7 @@ var claimedSweep = (stamp, nowMs) => {
1291
1625
  }
1292
1626
  };
1293
1627
  var sweepWhenDue = (dir, nowMs) => {
1294
- if (claimedSweep(join9(dir, GATE_OUTCOME_SWEEP_STAMP), nowMs)) sweepExpired(dir, nowMs, GATE_OUTCOME_RECORD_TTL_MS);
1628
+ if (claimedSweep(join10(dir, GATE_OUTCOME_SWEEP_STAMP), nowMs)) sweepExpired(dir, nowMs, GATE_OUTCOME_RECORD_TTL_MS);
1295
1629
  };
1296
1630
  var hasRoomForARecord = (dir) => readdirSync6(dir).length < GATE_OUTCOME_RECORD_LIMIT;
1297
1631
  var isFreshRecord = (path, nowMs) => {
@@ -1312,7 +1646,7 @@ var recordGateOutcome = (toolUseId, outcome) => {
1312
1646
  if (!dir) return;
1313
1647
  sweepWhenDue(dir, Date.now());
1314
1648
  if (!hasRoomForARecord(dir)) return;
1315
- writeFileSync7(join9(dir, gateOutcomeRecordName(toolUseId)), outcome, { encoding: "utf-8", mode: PRIVATE_FILE_MODE });
1649
+ writeFileSync8(join10(dir, gateOutcomeRecordName(toolUseId)), outcome, { encoding: "utf-8", mode: PRIVATE_FILE_MODE });
1316
1650
  } catch {
1317
1651
  return;
1318
1652
  }
@@ -1321,27 +1655,27 @@ var takeGateOutcome = (toolUseId) => {
1321
1655
  if (!toolUseId) return void 0;
1322
1656
  const dir = gateOutcomeDirectory();
1323
1657
  if (!isPrivateFolder(dir)) return void 0;
1324
- const path = join9(dir, gateOutcomeRecordName(toolUseId));
1658
+ const path = join10(dir, gateOutcomeRecordName(toolUseId));
1325
1659
  const recorded = readFreshRecord(path, Date.now());
1326
1660
  removeQuietly(path);
1327
1661
  return isGateOutcome(recorded) ? recorded : void 0;
1328
1662
  };
1329
1663
 
1330
1664
  // src/events.ts
1331
- import { join as join10 } from "path";
1332
- import { existsSync as existsSync5, mkdirSync as mkdirSync7, readFileSync as readFileSync8, statSync as statSync7, writeFileSync as writeFileSync8 } from "fs";
1333
- import { tmpdir as tmpdir9 } from "os";
1334
- var INTENT_DIR = join10(tmpdir9(), "pushary-intent");
1665
+ import { join as join11 } from "path";
1666
+ import { existsSync as existsSync6, mkdirSync as mkdirSync7, readFileSync as readFileSync8, statSync as statSync7, writeFileSync as writeFileSync9 } from "fs";
1667
+ import { tmpdir as tmpdir10 } from "os";
1668
+ var INTENT_DIR = join11(tmpdir10(), "pushary-intent");
1335
1669
  var INTENT_MAX_BYTES = 2048;
1336
1670
  var INTENT_GRACE_MS = 10 * 60 * 1e3;
1337
1671
  var sanitizeSession = (sessionId) => sessionId.replace(/[^A-Za-z0-9_-]/g, "_").slice(0, 128) || DEFAULT_SESSION;
1338
- var intentFile = (sessionId) => join10(INTENT_DIR, sanitizeSession(sessionId));
1672
+ var intentFile = (sessionId) => join11(INTENT_DIR, sanitizeSession(sessionId));
1339
1673
  var saveLastPrompt = (sessionId, prompt) => {
1340
1674
  try {
1341
1675
  const trimmed = prompt.replace(/\s+/g, " ").trim().slice(0, INTENT_MAX_BYTES);
1342
1676
  if (!trimmed) return;
1343
1677
  mkdirSync7(INTENT_DIR, { recursive: true });
1344
- writeFileSync8(intentFile(sessionId), trimmed, "utf-8");
1678
+ writeFileSync9(intentFile(sessionId), trimmed, "utf-8");
1345
1679
  } catch {
1346
1680
  }
1347
1681
  };
@@ -1437,7 +1771,7 @@ var POLICY_CACHE_TTL_MS = 5 * 60 * 1e3;
1437
1771
  var readFreshCachedPolicy = (apiKey, agentType, sessionId) => {
1438
1772
  const request = policyRequestFor(agentType);
1439
1773
  const path = policyCacheFile(apiKey, request.agent, request.repoAware, sessionId);
1440
- if (!existsSync5(path)) return null;
1774
+ if (!existsSync6(path)) return null;
1441
1775
  const cached = JSON.parse(readFileSync8(path, "utf-8"));
1442
1776
  if (!isCachedPolicyRead(cached)) return null;
1443
1777
  if ((cached._sessionId ?? null) !== (sessionId ?? null)) return null;
@@ -1984,7 +2318,7 @@ var handleStopFailure = async (input, agent = CLAUDE_CODE_AGENT) => {
1984
2318
  // so without this the phone's queued instruction is taken and destroyed.
1985
2319
  }, { maxAttempts: 1, timeoutMs: 2500, signal }).catch(() => {
1986
2320
  });
1987
- if (turnWasCancelledByUser(input)) return;
2321
+ if (cancelledTurnNeedsNoPush(input)) return;
1988
2322
  const mode = await fetchModeState(apiKey, input.session_id, MODE_REUSE_MS, signal).catch(() => null);
1989
2323
  if (mode?.kill || mode?.mode === "terminal_only") return;
1990
2324
  await sendNotification(apiKey, {
@@ -2025,6 +2359,24 @@ export {
2025
2359
  fetchLiveModeState,
2026
2360
  fetchModeOverride,
2027
2361
  readLastUserPrompt,
2362
+ isDeferAnswer,
2363
+ oncePerSession,
2364
+ announceSubscriptionRequired,
2365
+ outcomeOfFailedAsk,
2366
+ storedWaitDeadline,
2367
+ askAgentQuestionWhileOpen,
2368
+ askAgentQuestions,
2369
+ allow,
2370
+ deny,
2371
+ ask,
2372
+ halted,
2373
+ askedFilePathOf,
2374
+ questionWindowOf,
2375
+ refusingTimeoutOutput,
2376
+ approvingTimeoutOutput,
2377
+ questionLimitOutput,
2378
+ handlePushOnly,
2379
+ handlePushFirst,
2028
2380
  CODEX_AGENT,
2029
2381
  codexAllow,
2030
2382
  codexDeny,
@@ -2035,7 +2387,6 @@ export {
2035
2387
  toPolicyLookup,
2036
2388
  toPolicyLookups,
2037
2389
  codexQuestionLimitDecision,
2038
- questionServedItsWholeWindow,
2039
2390
  permissionTimeoutDecision,
2040
2391
  codexDecisionOf,
2041
2392
  codexUnansweredDecision,