pushary 1.9.237 → 1.9.239

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 (144) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/{api-HJSGVYQY.js → api-TGQFNSNE.js} +15 -15
  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 +30 -30
  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 +35 -35
  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 +46 -46
  16. package/dist/bin/pushary-disconnect.js +30 -30
  17. package/dist/bin/pushary-display-hook.js +10 -0
  18. package/dist/bin/pushary-doctor.js +47 -47
  19. package/dist/bin/pushary-elicitation-hook.js +27 -27
  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 +35 -35
  23. package/dist/bin/pushary-login.js +23 -23
  24. package/dist/bin/pushary-logout.js +31 -31
  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 +34 -34
  30. package/dist/bin/pushary-permission-denied-hook.js +34 -34
  31. package/dist/bin/pushary-permission-hook.js +35 -35
  32. package/dist/bin/pushary-post-hook.js +34 -31
  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 +39 -39
  36. package/dist/bin/pushary-sessions.js +12 -12
  37. package/dist/bin/pushary-setup.js +58 -58
  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 +26 -26
  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-FMU5CMVS.js → chunk-22KXKP3P.js} +2 -2
  49. package/dist/{chunk-HMIFIDPC.js → chunk-2CNBP34Z.js} +3 -3
  50. package/dist/{chunk-BWYM4X2Z.js → chunk-2NFLU35D.js} +2 -2
  51. package/dist/{chunk-UX62CHEU.js → chunk-2QKCDW7C.js} +6 -6
  52. package/dist/{chunk-3XEOKKCT.js → chunk-34WXXHZK.js} +1 -1
  53. package/dist/{chunk-VJTMLOV4.js → chunk-35IKDC3S.js} +5 -5
  54. package/dist/{chunk-GEEQ5JLH.js → chunk-3OTL7RDO.js} +6 -6
  55. package/dist/{chunk-ORCSR77N.js → chunk-43EGMRVL.js} +10 -10
  56. package/dist/{chunk-LVSQJNUN.js → chunk-4XOSBQS3.js} +1 -1
  57. package/dist/{chunk-4QFQH4DE.js → chunk-6AT6CW76.js} +1 -1
  58. package/dist/{chunk-DJ67SBPF.js → chunk-6YHIIZCD.js} +4 -4
  59. package/dist/{chunk-77FFXRKW.js → chunk-775CXETC.js} +3 -3
  60. package/dist/{chunk-E7RUE3HG.js → chunk-7DK5D7K5.js} +3 -3
  61. package/dist/{chunk-6SSWRXJ3.js → chunk-7JVDYUXV.js} +4 -4
  62. package/dist/{chunk-PJHG34QL.js → chunk-7LDSPVKG.js} +3 -3
  63. package/dist/{chunk-BZ2LBE2K.js → chunk-ARDB6TVA.js} +6 -6
  64. package/dist/{chunk-ITDN4EH5.js → chunk-AS5IBOCJ.js} +1 -1
  65. package/dist/{chunk-MSTQIKS4.js → chunk-AXCHFAM2.js} +2 -2
  66. package/dist/{chunk-M6CLKAF6.js → chunk-B2UVKWAC.js} +3 -3
  67. package/dist/{chunk-U7HEUEZQ.js → chunk-BCFJAUVD.js} +97 -39
  68. package/dist/{chunk-3BNYU7LA.js → chunk-CM2CXLMV.js} +1 -1
  69. package/dist/{chunk-KJJTE4HC.js → chunk-CU53UYPR.js} +1 -1
  70. package/dist/{chunk-VO4VXPCH.js → chunk-CUKCOSSW.js} +1 -1
  71. package/dist/{chunk-DHU22BBS.js → chunk-CYRFUNSV.js} +4 -4
  72. package/dist/{chunk-PMJKR7WR.js → chunk-D5IDQEUV.js} +2 -2
  73. package/dist/{chunk-IBIKEGDF.js → chunk-DBYMWNEA.js} +9 -9
  74. package/dist/{chunk-XWL2QPIG.js → chunk-ENMJP2QR.js} +5 -5
  75. package/dist/{chunk-USOOH77B.js → chunk-EW6MOHU7.js} +1 -1
  76. package/dist/{chunk-I3OCBCNT.js → chunk-F3RLSCGY.js} +5 -5
  77. package/dist/{chunk-NBTUSWX2.js → chunk-F7UH6EIK.js} +1 -1
  78. package/dist/{chunk-T5WMBVKG.js → chunk-FETLPBX4.js} +5 -5
  79. package/dist/{chunk-JVAMUEHS.js → chunk-GHK2D2AY.js} +2 -2
  80. package/dist/{chunk-JWRCNFPM.js → chunk-HCUODMK4.js} +2 -2
  81. package/dist/{chunk-7RMOKXHS.js → chunk-HFTEGMJQ.js} +7 -7
  82. package/dist/{chunk-JOQ4H6NH.js → chunk-HUB2GUFP.js} +5 -5
  83. package/dist/{chunk-DF6TLBHZ.js → chunk-JSRQCQI4.js} +5 -5
  84. package/dist/{chunk-QXIDU6YJ.js → chunk-JUE3F3SH.js} +20 -2
  85. package/dist/{chunk-V2P2NUCI.js → chunk-K3KDWSGN.js} +3 -3
  86. package/dist/{chunk-XKWYE3ZY.js → chunk-K5QXVI6H.js} +5 -5
  87. package/dist/{chunk-OTRVJVKS.js → chunk-KEC6WMMH.js} +1 -1
  88. package/dist/{chunk-VC4EBXGF.js → chunk-KXIKVN4W.js} +6 -6
  89. package/dist/{chunk-DZJ4WO7T.js → chunk-LAZTGJCP.js} +1 -1
  90. package/dist/{chunk-UN7PMXBY.js → chunk-LB4TIIP6.js} +4 -4
  91. package/dist/{chunk-HYE5ARRS.js → chunk-M45LA6SN.js} +4 -4
  92. package/dist/{chunk-5Y5FFPNI.js → chunk-M5DTFZNE.js} +2 -2
  93. package/dist/{chunk-HSLZ2ZJI.js → chunk-MD35ZRMK.js} +1 -1
  94. package/dist/{chunk-Q43WP2LP.js → chunk-MQ7TQFAM.js} +4 -4
  95. package/dist/{chunk-MODLPJPU.js → chunk-NIL4UMQO.js} +4 -4
  96. package/dist/{chunk-BQS4RV3T.js → chunk-NYW3IHWT.js} +2 -2
  97. package/dist/{chunk-OOPL7BL2.js → chunk-O2RFCZXX.js} +1 -1
  98. package/dist/chunk-O6QSYCV7.js +48 -0
  99. package/dist/{chunk-JX5R7WCL.js → chunk-OBCDZUDW.js} +1 -1
  100. package/dist/{chunk-KJ2WZOHD.js → chunk-ODQRIHHZ.js} +3 -3
  101. package/dist/{chunk-HBB2B6YX.js → chunk-OKSLHMMV.js} +1 -1
  102. package/dist/{chunk-DFHMD7G7.js → chunk-OM4WDT5Q.js} +4 -4
  103. package/dist/{chunk-47UJLOWC.js → chunk-P3M2TEIB.js} +1 -1
  104. package/dist/{chunk-XIMXQ4OB.js → chunk-P6WHHGDL.js} +1 -1
  105. package/dist/{chunk-RZANH42A.js → chunk-PB2J2OH6.js} +2 -2
  106. package/dist/{chunk-56ZVNO4C.js → chunk-PMZLFGA4.js} +1 -1
  107. package/dist/{chunk-CKBAQUE3.js → chunk-PPW3FH2O.js} +8 -12
  108. package/dist/{chunk-JN23XJFF.js → chunk-PWLZRTPN.js} +5 -5
  109. package/dist/{chunk-66KEOAAB.js → chunk-QCWKDVGM.js} +3 -3
  110. package/dist/{chunk-DK4BKL43.js → chunk-QFCZHHXE.js} +5 -5
  111. package/dist/{chunk-UEZLE5S5.js → chunk-QXPBSQAJ.js} +12 -12
  112. package/dist/{chunk-EFYTCLOR.js → chunk-TBFF32OX.js} +3 -3
  113. package/dist/{chunk-PNLG2FXX.js → chunk-TSQUSQYM.js} +2 -2
  114. package/dist/{chunk-CWZCWIQT.js → chunk-TZ2JD5R2.js} +1 -1
  115. package/dist/{chunk-Q6F3FM5A.js → chunk-U6UOY645.js} +1 -1
  116. package/dist/{chunk-I4RKTMEX.js → chunk-URA3EVIO.js} +2 -2
  117. package/dist/{chunk-Q6KONQHQ.js → chunk-VFFTSN5A.js} +4 -4
  118. package/dist/{chunk-5V2X63OJ.js → chunk-WK6FLRWC.js} +6 -6
  119. package/dist/{chunk-QIWVSIK2.js → chunk-WLKHQOWW.js} +8 -8
  120. package/dist/{chunk-US4WGPDI.js → chunk-WO3XKRTP.js} +7 -7
  121. package/dist/{chunk-TOAPYOT6.js → chunk-XFVILXWT.js} +4 -4
  122. package/dist/{chunk-BUFXSMY6.js → chunk-XMCHE2KX.js} +2 -2
  123. package/dist/{chunk-GM4YH5PP.js → chunk-XULGWSCM.js} +3 -3
  124. package/dist/{chunk-7BRTSKYT.js → chunk-Y4FDXCBJ.js} +1 -1
  125. package/dist/{chunk-74Z7L2LQ.js → chunk-YJ6PCUUZ.js} +1 -1
  126. package/dist/{chunk-A636SGRV.js → chunk-YMVC3ADR.js} +35 -26
  127. package/dist/{chunk-Z5SJDN5J.js → chunk-YXNVJ6QV.js} +1 -1
  128. package/dist/{chunk-CLDEQACG.js → chunk-ZDI2GOT7.js} +2 -2
  129. package/dist/{codex-app-cards-switch-FY5HJYZR.js → codex-app-cards-switch-G66CLZF2.js} +11 -11
  130. package/dist/{codex-card-routing-3TVI3V2W.js → codex-card-routing-L564JCTO.js} +2 -2
  131. package/dist/{codex-desktop-launch-OOSA2UHI.js → codex-desktop-launch-WKHFUAT7.js} +3 -3
  132. package/dist/{codex-session-launch-6BNQDMCH.js → codex-session-launch-EBEKNB5T.js} +20 -20
  133. package/dist/{config-WOG7M4P2.js → config-F46PJ6G2.js} +3 -3
  134. package/dist/{global-upgrade-QGWLB3XX.js → global-upgrade-XK32FCB7.js} +9 -9
  135. package/dist/{identity-DSZ5C7LA.js → identity-MGMANSPJ.js} +4 -4
  136. package/dist/{live-capabilities-ARZLZCZC.js → live-capabilities-WZWQK6TQ.js} +4 -4
  137. package/dist/{paths-6QS77FBA.js → paths-I3B3AESI.js} +3 -3
  138. package/dist/{reapply-TXPOSMJF.js → reapply-FSHLY63O.js} +34 -34
  139. package/dist/src/index.d.ts +8 -3
  140. package/dist/src/index.js +33 -33
  141. package/dist/{upgrade-lock-6777RDS5.js → upgrade-lock-4TOOLEEM.js} +4 -4
  142. package/dist/{usage-4EOFN3X4.js → usage-AMBJJOGG.js} +3 -3
  143. package/package.json +1 -1
  144. package/dist/chunk-N3IM3JEH.js +0 -31
@@ -14,7 +14,7 @@ import {
14
14
  reachVerdict,
15
15
  reachesYou,
16
16
  verifyDelivery
17
- } from "./chunk-UX62CHEU.js";
17
+ } from "./chunk-2QKCDW7C.js";
18
18
  import {
19
19
  describeRevokeAttempt,
20
20
  keyNoLongerAccepted,
@@ -29,20 +29,20 @@ import {
29
29
  isCI,
30
30
  terminalColumns,
31
31
  useColor
32
- } from "./chunk-JX5R7WCL.js";
32
+ } from "./chunk-OBCDZUDW.js";
33
33
  import {
34
34
  checkApiKey
35
- } from "./chunk-KJ2WZOHD.js";
35
+ } from "./chunk-ODQRIHHZ.js";
36
36
  import {
37
37
  reportedInstallSource
38
- } from "./chunk-BWYM4X2Z.js";
38
+ } from "./chunk-2NFLU35D.js";
39
39
  import {
40
40
  NPX_LATEST_COMMAND
41
- } from "./chunk-3BNYU7LA.js";
41
+ } from "./chunk-CM2CXLMV.js";
42
42
  import {
43
43
  NO_PAIRING_COMPUTER,
44
44
  PAIR_TTL_SECONDS
45
- } from "./chunk-QXIDU6YJ.js";
45
+ } from "./chunk-JUE3F3SH.js";
46
46
 
47
47
  // src/onboarding.ts
48
48
  import qrcodeTerminal from "qrcode-terminal";
@@ -27,7 +27,7 @@ import {
27
27
  reportableSessionId,
28
28
  toToolLookup,
29
29
  truncateLine
30
- } from "./chunk-QXIDU6YJ.js";
30
+ } from "./chunk-JUE3F3SH.js";
31
31
 
32
32
  // ../hook-mapping/src/commit-receipt.ts
33
33
  var COMMIT_OUTPUT_MAX_LENGTH = 65536;
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-3EGEA4KH.js";
10
10
  import {
11
11
  getBaseUrl
12
- } from "./chunk-5Y5FFPNI.js";
12
+ } from "./chunk-M5DTFZNE.js";
13
13
  import {
14
14
  CLI_LOCAL_BIND_PATH,
15
15
  LOCAL_CONFIRM_HOST,
@@ -20,7 +20,7 @@ import {
20
20
  isLocalConfirmToken,
21
21
  isPhonePass,
22
22
  localTerminalEntryUrl
23
- } from "./chunk-QXIDU6YJ.js";
23
+ } from "./chunk-JUE3F3SH.js";
24
24
 
25
25
  // src/cli/login-ui.ts
26
26
  import { hostname } from "os";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  pusharyHookExecutable
3
- } from "./chunk-Q6KONQHQ.js";
3
+ } from "./chunk-VFFTSN5A.js";
4
4
  import {
5
5
  bridgeResolvesToApp,
6
6
  cursorUserHooks,
7
7
  executableFileName,
8
8
  isBridgeLocator,
9
9
  liveBridgeProbe
10
- } from "./chunk-PMJKR7WR.js";
10
+ } from "./chunk-D5IDQEUV.js";
11
11
  import {
12
12
  atLeast,
13
13
  parseVersion
@@ -21,7 +21,7 @@ import {
21
21
  isCursorHookPayload,
22
22
  isRecord,
23
23
  toolsCoveredByGateEntry
24
- } from "./chunk-QXIDU6YJ.js";
24
+ } from "./chunk-JUE3F3SH.js";
25
25
 
26
26
  // src/cursor-gate-registration.ts
27
27
  import { dirname, isAbsolute, join, resolve } from "path";
@@ -29,14 +29,12 @@ import {
29
29
  toolResultErrorText,
30
30
  transcriptTokensIn,
31
31
  transcriptUsageRequest
32
- } from "./chunk-ITDN4EH5.js";
32
+ } from "./chunk-AS5IBOCJ.js";
33
33
  import {
34
34
  askUser,
35
35
  cancelQuestion,
36
36
  clientErrorKindOf,
37
- isAwayPaused,
38
37
  isDecisionStopped,
39
- isLocalQuestionHandoff,
40
38
  isPolicyConfig,
41
39
  isQuestionLimitRefusal,
42
40
  isStoredPastThePushCap,
@@ -46,39 +44,38 @@ import {
46
44
  waitForAnswer,
47
45
  waitForOpenQuestion,
48
46
  waitForQuestion,
49
- waitsForThePhone,
50
47
  writeDegraded
51
- } from "./chunk-CKBAQUE3.js";
48
+ } from "./chunk-PPW3FH2O.js";
52
49
  import {
53
50
  RETRY_ACK,
54
51
  readCommandAck,
55
52
  refusedReceiptMessage
56
- } from "./chunk-VO4VXPCH.js";
53
+ } from "./chunk-CUKCOSSW.js";
57
54
  import {
58
55
  SubscriptionRequiredError,
59
56
  isRetryable,
60
57
  withRetry
61
- } from "./chunk-VJTMLOV4.js";
58
+ } from "./chunk-35IKDC3S.js";
62
59
  import {
63
60
  fetchAsCredential
64
- } from "./chunk-56ZVNO4C.js";
61
+ } from "./chunk-PMZLFGA4.js";
65
62
  import {
66
63
  branchFor,
67
64
  projectNameFor,
68
65
  repoKeyFor
69
- } from "./chunk-3XEOKKCT.js";
66
+ } from "./chunk-34WXXHZK.js";
70
67
  import {
71
68
  getMachineId
72
- } from "./chunk-OOPL7BL2.js";
69
+ } from "./chunk-O2RFCZXX.js";
73
70
  import {
74
71
  reportedInstallSource
75
- } from "./chunk-BWYM4X2Z.js";
72
+ } from "./chunk-2NFLU35D.js";
76
73
  import {
77
74
  IDLE_PROMPT_NOTIFICATION,
78
75
  NOTIFICATION_PUSH_TYPES,
79
76
  POSTTOOLUSE_MIRROR_ONLY_TOOLS,
80
77
  claudeConfigDir
81
- } from "./chunk-PMJKR7WR.js";
78
+ } from "./chunk-D5IDQEUV.js";
82
79
  import {
83
80
  compareVersion,
84
81
  parseVersion
@@ -87,11 +84,15 @@ import {
87
84
  getApiKey,
88
85
  getBaseUrl,
89
86
  isMalformedApiKeyError
90
- } from "./chunk-5Y5FFPNI.js";
87
+ } from "./chunk-M5DTFZNE.js";
91
88
  import {
92
89
  writeFileAtomic,
93
90
  writeJsonAtomicDurable
94
91
  } from "./chunk-PM2NRK6Y.js";
92
+ import {
93
+ getPackageVersion,
94
+ isKnownReleaseVersion
95
+ } from "./chunk-CXQWDQCJ.js";
95
96
  import {
96
97
  ASK_CONTEXT_MAX,
97
98
  BLOCKED_ACTION_GRANT_TTL_SECONDS,
@@ -100,6 +101,7 @@ import {
100
101
  DECISION_STOP_REASON,
101
102
  HANDED_BACK_REASON,
102
103
  HOOK_SOURCES,
104
+ POLICY_CACHE_TTL_SECONDS,
103
105
  POLICY_REQUEST_CAPABILITIES_HEADER,
104
106
  QUESTION_LIMIT_PROMPT_REASON,
105
107
  REPO_AWARE_AGENTS,
@@ -124,12 +126,15 @@ import {
124
126
  isAgentQuestionSet,
125
127
  isAskableHookCwd,
126
128
  isAutoApprove,
129
+ isAwayPaused,
127
130
  isClaudeWakePrompt,
128
131
  isGateOutcome,
132
+ isLocalQuestionHandoff,
129
133
  isNativeAskEvent,
130
134
  isProvenModeResponse,
131
135
  isRecord,
132
136
  isTypedAnswerQuestion,
137
+ missedAnswerRefusalReason,
133
138
  modeStateFromResponse,
134
139
  nativeRecord,
135
140
  parseAgentQuestionAnswers,
@@ -144,8 +149,9 @@ import {
144
149
  refusesWhenUnanswered,
145
150
  resolveAutoResolveOrigin,
146
151
  resolvePolicy,
147
- unansweredRefusalReason
148
- } from "./chunk-QXIDU6YJ.js";
152
+ unansweredRefusalReason,
153
+ waitsForThePhone
154
+ } from "./chunk-JUE3F3SH.js";
149
155
 
150
156
  // src/pending.ts
151
157
  import { join } from "path";
@@ -456,7 +462,8 @@ import { createHash as createHash2 } from "crypto";
456
462
  import { existsSync as existsSync2, lstatSync as lstatSync2, readFileSync as readFileSync2, readdirSync as readdirSync2, unlinkSync as unlinkSync2, utimesSync, writeFileSync as writeFileSync2 } from "fs";
457
463
  import { join as join2 } from "path";
458
464
  import { tmpdir as tmpdir2 } from "os";
459
- var CACHE_TTL_MS = 60 * 1e3;
465
+ var MS_PER_SECOND = 1e3;
466
+ var CACHE_TTL_MS = POLICY_CACHE_TTL_SECONDS * MS_PER_SECOND;
460
467
  var STALE_CACHE_MAX_MS = 12 * 60 * 60 * 1e3;
461
468
  var policyRequestFor = (agentType) => ({
462
469
  agent: agentType,
@@ -469,8 +476,28 @@ var policyCacheFile = (apiKey, agent, repoAware = false, sessionId) => {
469
476
  const hash = createHash2("sha256").update(parts.join(":")).digest("hex").slice(0, 12);
470
477
  return join2(tmpdir2(), `${POLICY_CACHE_PREFIX}${hash}.json`);
471
478
  };
479
+ var modePolicyStampOf = (stampOrVersion) => typeof stampOrVersion === "string" ? { policyVersion: stampOrVersion } : stampOrVersion ?? null;
480
+ var isPolicyReuseKey = (value) => typeof value === "string" && value.length > 0;
481
+ var policyReuseKeyIn = (body) => isRecord(body) && isPolicyReuseKey(body.policyReuseKey) ? body.policyReuseKey : void 0;
482
+ var isReusableSecondsCount = (value) => typeof value === "number" && Number.isInteger(value) && value >= 0;
483
+ var policyReuseOfferIn = (body) => {
484
+ if (!isRecord(body) || !isPolicyReuseKey(body.policyReuseKey) || !isReusableSecondsCount(body.reusableForSeconds)) return null;
485
+ return { key: body.policyReuseKey, forMs: Math.min(body.reusableForSeconds * MS_PER_SECOND, STALE_CACHE_MAX_MS) };
486
+ };
472
487
  var isAbsentOrNullableString = (value) => value === void 0 || value === null || typeof value === "string";
473
- var isCachedPolicyRead = (value) => isPolicyConfig(value) && isRecord(value) && (value._cachedAt === void 0 || typeof value._cachedAt === "number") && isAbsentOrNullableString(value._policyVersion) && isAbsentOrNullableString(value._sessionId);
488
+ var isAbsentOrNullableNumber = (value) => value === void 0 || value === null || typeof value === "number";
489
+ var isCachedPolicyRead = (value) => isPolicyConfig(value) && isRecord(value) && (value._cachedAt === void 0 || typeof value._cachedAt === "number") && isAbsentOrNullableString(value._policyVersion) && isAbsentOrNullableString(value._sessionId) && isAbsentOrNullableString(value._reuseKey) && isAbsentOrNullableNumber(value._reusableUntil) && (value._clientVersion === void 0 || typeof value._clientVersion === "string");
490
+ var reuseFieldsOf = (offer, cachedAt) => offer === null ? { _reuseKey: null, _reusableUntil: null } : { _reuseKey: offer.key, _reusableUntil: cachedAt + offer.forMs };
491
+ var wasCachedForSession = (cached, sessionId) => (cached._sessionId ?? null) === (sessionId ?? null);
492
+ var wasCachedAtVersion = (cached, expectedVersion) => expectedVersion == null || (cached._policyVersion ?? null) === expectedVersion;
493
+ var theModeNamesTheKeyOf = (cached, stamp) => stamp?.policyReuseKey !== void 0 && cached._reuseKey === stamp.policyReuseKey;
494
+ var wasCachedByThisClient = (cached, clientVersion) => isKnownReleaseVersion(clientVersion) && cached._clientVersion === clientVersion;
495
+ var isInsideItsReuseWindow = (cached, now) => {
496
+ if (cached._cachedAt === void 0 || cached._reusableUntil === void 0 || cached._reusableUntil === null) return false;
497
+ const reusableUntil = Math.min(cached._reusableUntil, cached._cachedAt + STALE_CACHE_MAX_MS);
498
+ return now - cached._cachedAt >= 0 && now < reusableUntil;
499
+ };
500
+ var isReusableWhileItsKeyHolds = (cached, check) => theModeNamesTheKeyOf(cached, check.stamp) && wasCachedByThisClient(cached, check.clientVersion) && isInsideItsReuseWindow(cached, check.now) && wasCachedForSession(cached, check.sessionId) && wasCachedAtVersion(cached, check.stamp?.policyVersion);
474
501
  var isPolicyCacheName = (name) => name.startsWith(POLICY_CACHE_PREFIX) && name.endsWith(".json");
475
502
  var policyCachePruneStamp = () => join2(tmpdir2(), `pushary-policy-prune-${POLICY_CACHE_FORMAT}-${process.getuid?.() ?? "user"}.stamp`);
476
503
  var POLICY_CACHE_PRUNE_INTERVAL_MS = 60 * 60 * 1e3;
@@ -538,10 +565,12 @@ var fetchPolicy = async (apiKey, agent, repoAware = false, sessionId, signal) =>
538
565
  }
539
566
  const raw = await response.json();
540
567
  if (!isPolicyConfig(raw)) throw new Error("Invalid policy response");
541
- return raw;
568
+ return { policy: raw, reuse: policyReuseOfferIn(raw) };
542
569
  }, { maxAttempts: 2, shouldRetry: (error) => signal?.aborted !== true && isRetryable(error) });
543
570
  };
544
- var readPolicy = async (apiKey, expectedVersion, agent, repoAware = false, sessionId, signal) => {
571
+ var readPolicy = async (apiKey, modeStamp, agent, repoAware = false, sessionId, signal) => {
572
+ const expectedVersion = modeStamp?.policyVersion;
573
+ const clientVersion = getPackageVersion();
545
574
  const path = policyCacheFile(apiKey, agent, repoAware, sessionId);
546
575
  const sharedPath = policyCacheFile(apiKey, agent, repoAware);
547
576
  const firstForThisSession = path !== sharedPath && !existsSync2(path);
@@ -551,21 +580,30 @@ var readPolicy = async (apiKey, expectedVersion, agent, repoAware = false, sessi
551
580
  try {
552
581
  const cached = JSON.parse(readFileSync2(readPath, "utf-8"));
553
582
  if (!isCachedPolicyRead(cached)) throw new Error("Corrupted cache");
554
- const versionStale = expectedVersion != null && (cached._policyVersion ?? null) !== expectedVersion;
555
- const sessionStale = (cached._sessionId ?? null) !== (sessionId ?? null);
556
- const age = cached._cachedAt ? Date.now() - cached._cachedAt : 0;
583
+ const now = Date.now();
584
+ const versionStale = !wasCachedAtVersion(cached, expectedVersion);
585
+ const sessionStale = !wasCachedForSession(cached, sessionId);
586
+ const age = cached._cachedAt ? now - cached._cachedAt : 0;
557
587
  const ttlFresh = !cached._cachedAt || age < CACHE_TTL_MS;
558
588
  if (ttlFresh && !versionStale && !sessionStale) {
559
589
  return currentPolicy(cached);
560
590
  }
591
+ if (isReusableWhileItsKeyHolds(cached, { stamp: modeStamp, sessionId, clientVersion, now })) return currentPolicy(cached);
561
592
  if (!sessionStale && age < STALE_CACHE_MAX_MS) staleCache = staleFallback(versionStale ? { ...cached, knownSuperseded: true } : cached, cached._cachedAt);
562
593
  } catch {
563
594
  }
564
595
  }
565
596
  try {
566
- const policy = await fetchPolicy(apiKey, agent, repoAware, sessionId, signal);
597
+ const { policy, reuse } = await fetchPolicy(apiKey, agent, repoAware, sessionId, signal);
567
598
  const cachedAt = Date.now();
568
- const entry = { ...policy, _cachedAt: cachedAt, _policyVersion: expectedVersion ?? null, _sessionId: sessionId ?? null };
599
+ const entry = {
600
+ ...policy,
601
+ _cachedAt: cachedAt,
602
+ _policyVersion: expectedVersion ?? null,
603
+ _sessionId: sessionId ?? null,
604
+ ...reuseFieldsOf(reuse, cachedAt),
605
+ _clientVersion: clientVersion
606
+ };
569
607
  if (firstForThisSession) removePolicyCachesTooOldToServe(cachedAt);
570
608
  writePolicyCache(path, entry);
571
609
  if (path !== sharedPath) writePolicyCache(sharedPath, entry);
@@ -575,7 +613,10 @@ var readPolicy = async (apiKey, expectedVersion, agent, repoAware = false, sessi
575
613
  throw new PolicyUnavailable(error);
576
614
  }
577
615
  };
578
- var getPolicy = async (apiKey, expectedVersion, agent, repoAware = false, sessionId, signal) => (await readPolicy(apiKey, expectedVersion, agent, repoAware, sessionId, signal)).policy;
616
+ var getPolicy = async (apiKey, stampOrVersion, agent, repoAware = false, sessionId, signal) => {
617
+ const modeStamp = modePolicyStampOf(stampOrVersion);
618
+ return (await readPolicy(apiKey, modeStamp, agent, repoAware, sessionId, signal)).policy;
619
+ };
579
620
  var PolicyUnavailable = class extends Error {
580
621
  constructor(cause) {
581
622
  super("Failed to fetch policy and no cached policy available", { cause });
@@ -587,21 +628,24 @@ var lastPolicyOfAnySessionOr = (apiKey, agent, repoAware, error) => {
587
628
  if (cached) return staleFallback(cached, cached._cachedAt);
588
629
  throw error;
589
630
  };
590
- var readFreshPolicyOfAnySession = (path, expectedVersion) => {
631
+ var readFreshPolicyOfAnySession = (path, modeStamp, sessionId) => {
591
632
  try {
592
633
  const cached = JSON.parse(readFileSync2(path, "utf-8"));
593
634
  if (!isCachedPolicyRead(cached) || cached._cachedAt === void 0) return null;
594
- if (Date.now() - cached._cachedAt >= CACHE_TTL_MS) return null;
595
- if (expectedVersion != null && (cached._policyVersion ?? null) !== expectedVersion) return null;
635
+ const now = Date.now();
636
+ if (isReusableWhileItsKeyHolds(cached, { stamp: modeStamp, sessionId, clientVersion: getPackageVersion(), now })) return cached;
637
+ if (now - cached._cachedAt >= CACHE_TTL_MS) return null;
638
+ if (!wasCachedAtVersion(cached, modeStamp?.policyVersion)) return null;
596
639
  return cached;
597
640
  } catch {
598
641
  return null;
599
642
  }
600
643
  };
601
- var getPolicyForStandingDenies = async (apiKey, expectedVersion, agent, repoAware, sessionId, signal) => {
602
- const fresh = readFreshPolicyOfAnySession(policyCacheFile(apiKey, agent, repoAware), expectedVersion);
644
+ var getPolicyForStandingDenies = async (apiKey, stampOrVersion, agent, repoAware, sessionId, signal) => {
645
+ const modeStamp = modePolicyStampOf(stampOrVersion);
646
+ const fresh = readFreshPolicyOfAnySession(policyCacheFile(apiKey, agent, repoAware), modeStamp, sessionId);
603
647
  if (fresh) return currentPolicy(fresh);
604
- return readPolicy(apiKey, expectedVersion, agent, repoAware, sessionId, signal).catch((error) => lastPolicyOfAnySessionOr(apiKey, agent, repoAware, error));
648
+ return readPolicy(apiKey, modeStamp, agent, repoAware, sessionId, signal).catch((error) => lastPolicyOfAnySessionOr(apiKey, agent, repoAware, error));
605
649
  };
606
650
  var STANDING_DENIES_FROM_STALE_POLICY = "standing_denies_from_stale_policy";
607
651
  var STANDING_DENIES_FROM_STALE_POLICY_FALLBACK = "checked standing denies against this session's cached policy, or else the last one any session cached, of any version: a deny added since is missed and a deny removed since still refuses";
@@ -672,7 +716,12 @@ var readReusableMode = (apiKey, sessionId, maxAgeMs) => {
672
716
  if (Date.now() - last.at >= maxAgeMs) return null;
673
717
  return { ...last.state, degraded: false };
674
718
  };
675
- var unansweredModeRead = (state) => ({ state, answeredLive: false });
719
+ var withoutPolicyReuseKey = ({ policyReuseKey: _droppedReuseKey, ...state }) => state;
720
+ var withThePolicyReuseKeyOf = (state, body) => {
721
+ const policyReuseKey = policyReuseKeyIn(body);
722
+ return policyReuseKey === void 0 ? state : { ...state, policyReuseKey };
723
+ };
724
+ var unansweredModeRead = (state) => ({ state: withoutPolicyReuseKey(state), answeredLive: false });
676
725
  var isTimeoutReason = (reason) => reason instanceof Error && reason.name === "TimeoutError";
677
726
  var wasCancelledByTheCaller = (signal) => signal?.aborted === true && !isTimeoutReason(signal.reason);
678
727
  var readModeState = async (apiKey, sessionId, reuseWithinMs, signal) => {
@@ -698,7 +747,7 @@ var readModeState = async (apiKey, sessionId, reuseWithinMs, signal) => {
698
747
  }
699
748
  const state = modeStateFromResponse(body);
700
749
  writeLastGoodMode(apiKey, state, sessionId);
701
- return { state, answeredLive: true };
750
+ return { state: withThePolicyReuseKeyOf(state, body), answeredLive: true };
702
751
  } catch (error) {
703
752
  if (!wasCancelledByTheCaller(signal)) void reportClientError({ kind: clientErrorKindOf(error), code: "mode_fetch_failed" });
704
753
  return unansweredModeRead(degradedFallback(apiKey, sessionId));
@@ -1050,9 +1099,8 @@ var refusingTimeoutOutput = (window) => deny(unansweredRefusalReason(window.paus
1050
1099
  var unservedApprovalOutput = (window, event) => isNativeAskEvent(event) ? ask(WITHDRAWN_APPROVAL_REASON) : refusingTimeoutOutput(window);
1051
1100
  var approvingTimeoutOutput = (window, event) => questionServedItsWholeWindow(window) ? allow() : unservedApprovalOutput(window, event);
1052
1101
  var missedAnswerOutput = (missedAnswer, reply, handBackReason) => {
1053
- if (missedAnswer.kind === "refuse" && isAwayPaused(reply)) return deny(unansweredRefusalReason(true));
1054
- if (missedAnswer.kind === "refuse" && waitsForThePhone(reply)) return deny(missedAnswer.reason);
1055
- return ask(handBackReason);
1102
+ const refusal = missedAnswerRefusalReason(missedAnswer, reply);
1103
+ return refusal === void 0 ? ask(handBackReason) : deny(refusal);
1056
1104
  };
1057
1105
  var promptFollowsAHandBack = (call) => call.agentPromptFollows && call.missedAnswer.kind !== "refuse";
1058
1106
  var questionLimitOutput = (handBack) => handBack.kind === "refuse" ? deny(handBack.reason) : ask(QUESTION_LIMIT_PROMPT_REASON);
@@ -1374,13 +1422,18 @@ var sweepExpired = (dir, nowMs, ttlMs) => {
1374
1422
  return;
1375
1423
  }
1376
1424
  };
1377
- var readClaimed = (claimed, ttlMs) => {
1425
+ var readRecorded = (path, ttlMs) => {
1378
1426
  try {
1379
- const record = lstatSync3(claimed);
1427
+ const record = lstatSync3(path);
1380
1428
  if (!record.isFile() || Date.now() - record.mtimeMs >= ttlMs) return null;
1381
- return parseDecision(readFileSync4(claimed, "utf-8"));
1429
+ return parseDecision(readFileSync4(path, "utf-8"));
1382
1430
  } catch {
1383
1431
  return null;
1432
+ }
1433
+ };
1434
+ var readClaimed = (claimed, ttlMs) => {
1435
+ try {
1436
+ return readRecorded(claimed, ttlMs);
1384
1437
  } finally {
1385
1438
  removeQuietly(claimed);
1386
1439
  }
@@ -1417,6 +1470,11 @@ var callDecisionStore = (name, ttlMs) => {
1417
1470
  }
1418
1471
  return readClaimed(claimed, ttlMs);
1419
1472
  },
1473
+ peek: (key) => {
1474
+ if (!key) return null;
1475
+ const dir = decisionDir();
1476
+ return isPrivateFolder(dir) ? readRecorded(join6(dir, key), ttlMs) : null;
1477
+ },
1420
1478
  forget: (key) => {
1421
1479
  if (!key) return;
1422
1480
  const dir = decisionDir();
@@ -8,7 +8,7 @@ import {
8
8
  PUSHARY_CLI_LATEST_FOR_POWERSHELL,
9
9
  SETUP_AGENT_CHOICES,
10
10
  isApprovalMode
11
- } from "./chunk-QXIDU6YJ.js";
11
+ } from "./chunk-JUE3F3SH.js";
12
12
 
13
13
  // src/cli/mode-request.ts
14
14
  var parseDuration = (value) => {
@@ -10,7 +10,7 @@ import {
10
10
  uploadTranscriptRecords,
11
11
  verifyAnchoredRecipients,
12
12
  wrapSessionKey
13
- } from "./chunk-E7RUE3HG.js";
13
+ } from "./chunk-7DK5D7K5.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
  isFinalCommandAckRefusal
3
- } from "./chunk-QXIDU6YJ.js";
3
+ } from "./chunk-JUE3F3SH.js";
4
4
 
5
5
  // src/command-ack-outcome.ts
6
6
  var SETTLED_ACK = { outcome: "settled" };
@@ -4,21 +4,21 @@ import {
4
4
  claimThrottle,
5
5
  releaseThrottle,
6
6
  reportEvent
7
- } from "./chunk-U7HEUEZQ.js";
7
+ } from "./chunk-BCFJAUVD.js";
8
8
  import {
9
9
  deriveToolTarget,
10
10
  permissionDeniedAction
11
- } from "./chunk-ITDN4EH5.js";
11
+ } from "./chunk-AS5IBOCJ.js";
12
12
  import {
13
13
  projectNameFor
14
- } from "./chunk-3XEOKKCT.js";
14
+ } from "./chunk-34WXXHZK.js";
15
15
  import {
16
16
  PERMISSION_ALLOWED_EVENT,
17
17
  PERMISSION_DENIED_EVENT,
18
18
  machineApprovalFor,
19
19
  machineDecisionFor,
20
20
  wireVerdictFor
21
- } from "./chunk-QXIDU6YJ.js";
21
+ } from "./chunk-JUE3F3SH.js";
22
22
 
23
23
  // src/machine-decision-audit.ts
24
24
  var MACHINE_DECISION_REPORT_TIMEOUT_MS = 800;
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  quoteIfNeeded,
7
7
  shellDoubleQuoted
8
- } from "./chunk-Q43WP2LP.js";
8
+ } from "./chunk-MQ7TQFAM.js";
9
9
  import {
10
10
  writeFileAtomic
11
11
  } from "./chunk-PM2NRK6Y.js";
@@ -24,7 +24,7 @@ import {
24
24
  PUSHARY_HOSTS,
25
25
  PUSHARY_TOOL_PREFIX,
26
26
  withHookHoldBudget
27
- } from "./chunk-QXIDU6YJ.js";
27
+ } from "./chunk-JUE3F3SH.js";
28
28
 
29
29
  // src/setup/paths.ts
30
30
  import { createHash as createHash2 } from "crypto";
@@ -1,33 +1,33 @@
1
1
  import {
2
2
  MANAGED_CLAUDE_SETTINGS_BY_PLATFORM
3
- } from "./chunk-BQS4RV3T.js";
3
+ } from "./chunk-NYW3IHWT.js";
4
4
  import {
5
5
  declinedAgentsFile,
6
6
  readDeclinedAgents
7
- } from "./chunk-JVAMUEHS.js";
7
+ } from "./chunk-GHK2D2AY.js";
8
8
  import {
9
9
  OPENCODE_HOOK_BINARY,
10
10
  openCodeConfigDir,
11
11
  openCodePluginFile
12
- } from "./chunk-7RMOKXHS.js";
12
+ } from "./chunk-HFTEGMJQ.js";
13
13
  import {
14
14
  openCodePluginArgv
15
- } from "./chunk-LVSQJNUN.js";
15
+ } from "./chunk-4XOSBQS3.js";
16
16
  import {
17
17
  liveCursorGateCoverage
18
- } from "./chunk-M6CLKAF6.js";
18
+ } from "./chunk-B2UVKWAC.js";
19
19
  import {
20
20
  compatibleConfigFile,
21
21
  compatibleHookEvents,
22
22
  grokHome,
23
23
  parseConfigDocument
24
- } from "./chunk-I3OCBCNT.js";
24
+ } from "./chunk-F3RLSCGY.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-Q6KONQHQ.js";
30
+ } from "./chunk-VFFTSN5A.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-PMJKR7WR.js";
58
+ } from "./chunk-D5IDQEUV.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-QXIDU6YJ.js";
72
+ } from "./chunk-JUE3F3SH.js";
73
73
 
74
74
  // src/hook-wiring.ts
75
75
  import { createHash } from "crypto";
@@ -18,18 +18,18 @@ import {
18
18
  settingSnapshot,
19
19
  writeHermesSetting,
20
20
  writeSetupReceipt
21
- } from "./chunk-DFHMD7G7.js";
21
+ } from "./chunk-OM4WDT5Q.js";
22
22
  import {
23
23
  OPENCLAW_MIN_VERSION,
24
24
  OPENCLAW_PLUGIN_ID,
25
25
  OPENCLAW_PLUGIN_PACKAGE
26
- } from "./chunk-PJHG34QL.js";
26
+ } from "./chunk-7LDSPVKG.js";
27
27
  import {
28
28
  retryAgentCommand
29
- } from "./chunk-77FFXRKW.js";
29
+ } from "./chunk-775CXETC.js";
30
30
  import {
31
31
  configFilePath
32
- } from "./chunk-5Y5FFPNI.js";
32
+ } from "./chunk-M5DTFZNE.js";
33
33
  import {
34
34
  readJsonSafe,
35
35
  writeJsonAtomic
@@ -37,7 +37,7 @@ import {
37
37
  import {
38
38
  readSetupOutcomeProperties,
39
39
  redactSecretsFromContent
40
- } from "./chunk-QXIDU6YJ.js";
40
+ } from "./chunk-JUE3F3SH.js";
41
41
 
42
42
  // src/hermes/shell-gate.ts
43
43
  var readHermesShellGate = async (launcher) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  shouldDeferToNativeMode
3
- } from "./chunk-QXIDU6YJ.js";
3
+ } from "./chunk-JUE3F3SH.js";
4
4
 
5
5
  // src/native-defer.ts
6
6
  var nativeDeferOptions = () => {
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  addGeminiMcpServer,
3
3
  removeGeminiMcpServer
4
- } from "./chunk-Q6KONQHQ.js";
4
+ } from "./chunk-VFFTSN5A.js";
5
5
  import {
6
6
  CLAUDE_CODE_AGENT
7
- } from "./chunk-U7HEUEZQ.js";
7
+ } from "./chunk-BCFJAUVD.js";
8
8
  import {
9
9
  compatibleToolLookup
10
- } from "./chunk-ITDN4EH5.js";
10
+ } from "./chunk-AS5IBOCJ.js";
11
11
  import {
12
12
  CLAUDE_HOOK_EVENTS,
13
13
  PUSHARY_MCP_URL,
@@ -19,7 +19,7 @@ import {
19
19
  isPusharyHook,
20
20
  registerHookEntry,
21
21
  removeClaudeMcpServers
22
- } from "./chunk-PMJKR7WR.js";
22
+ } from "./chunk-D5IDQEUV.js";
23
23
  import {
24
24
  AGENT_ENFORCEMENT,
25
25
  HOOK_COMPATIBLE_PROFILES,
@@ -32,7 +32,7 @@ import {
32
32
  pusharyMissingReason,
33
33
  refusalOutput,
34
34
  withHookHoldBudget
35
- } from "./chunk-QXIDU6YJ.js";
35
+ } from "./chunk-JUE3F3SH.js";
36
36
 
37
37
  // src/config-document.ts
38
38
  import { parse, stringify } from "smol-toml";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  RETRY_ACK,
6
6
  refusedReceiptMessage
7
- } from "./chunk-VO4VXPCH.js";
7
+ } from "./chunk-CUKCOSSW.js";
8
8
 
9
9
  // src/command-receipts.ts
10
10
  import { randomUUID } from "crypto";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  UNSET_IGNORED_SHELL_VALUE_STEP
3
- } from "./chunk-DJ67SBPF.js";
3
+ } from "./chunk-6YHIIZCD.js";
4
4
  import {
5
5
  notificationAnswerStep
6
- } from "./chunk-UX62CHEU.js";
6
+ } from "./chunk-2QKCDW7C.js";
7
7
  import {
8
8
  matchMacAccountStep,
9
9
  retryAgentCommand
10
- } from "./chunk-77FFXRKW.js";
10
+ } from "./chunk-775CXETC.js";
11
11
  import {
12
12
  NPX_LATEST_COMMAND,
13
13
  npmExecSetupCommandFor
14
- } from "./chunk-3BNYU7LA.js";
14
+ } from "./chunk-CM2CXLMV.js";
15
15
  import {
16
16
  EXIT
17
17
  } from "./chunk-BG4HHB7E.js";
@@ -21,7 +21,7 @@ import {
21
21
  import {
22
22
  compatibleProfileFor,
23
23
  isCompatibleAgentType
24
- } from "./chunk-QXIDU6YJ.js";
24
+ } from "./chunk-JUE3F3SH.js";
25
25
 
26
26
  // src/setup/closing.ts
27
27
  var ACTIVITY_URL = "pushary.com/dashboard/agent/activity";