pushary 1.9.260 → 1.9.262

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 (147) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +6 -0
  3. package/dist/{api-IT47BCBQ.js → api-TGVE6ZKD.js} +11 -11
  4. package/dist/bin/pushary-audit.js +3 -3
  5. package/dist/bin/pushary-bell-hook.js +29 -29
  6. package/dist/bin/pushary-bell.js +12 -12
  7. package/dist/bin/pushary-calls.js +15 -15
  8. package/dist/bin/pushary-claude.js +26 -26
  9. package/dist/bin/pushary-clean.js +40 -40
  10. package/dist/bin/pushary-codex-bridge.js +23 -23
  11. package/dist/bin/pushary-codex-hook.js +36 -36
  12. package/dist/bin/pushary-codex-session.js +8 -8
  13. package/dist/bin/pushary-codex.js +16 -16
  14. package/dist/bin/pushary-connect.js +36 -36
  15. package/dist/bin/pushary-cowork.js +5 -5
  16. package/dist/bin/pushary-daemon.js +47 -47
  17. package/dist/bin/pushary-disconnect.js +31 -31
  18. package/dist/bin/pushary-display-hook.js +60 -2
  19. package/dist/bin/pushary-doctor.js +143 -48
  20. package/dist/bin/pushary-elicitation-hook.js +28 -28
  21. package/dist/bin/pushary-gemini-bridge.js +18 -18
  22. package/dist/bin/pushary-gemini-hook.js +32 -32
  23. package/dist/bin/pushary-hook.js +36 -36
  24. package/dist/bin/pushary-login.js +41 -23
  25. package/dist/bin/pushary-logout.js +32 -32
  26. package/dist/bin/pushary-mcp.js +12 -12
  27. package/dist/bin/pushary-mode.js +16 -16
  28. package/dist/bin/pushary-notification-hook.js +28 -28
  29. package/dist/bin/pushary-opencode-bridge.js +22 -22
  30. package/dist/bin/pushary-opencode-hook.js +33 -33
  31. package/dist/bin/pushary-permission-denied-hook.js +35 -35
  32. package/dist/bin/pushary-permission-hook.js +36 -36
  33. package/dist/bin/pushary-post-hook.js +31 -31
  34. package/dist/bin/pushary-prompt-hook.js +28 -28
  35. package/dist/bin/pushary-session-end-hook.js +28 -28
  36. package/dist/bin/pushary-session-start-hook.js +40 -40
  37. package/dist/bin/pushary-sessions.js +12 -12
  38. package/dist/bin/pushary-setup.js +174 -82
  39. package/dist/bin/pushary-stats.js +5 -5
  40. package/dist/bin/pushary-status.js +37 -37
  41. package/dist/bin/pushary-stop-hook.js +28 -28
  42. package/dist/bin/pushary-stopfailure-hook.js +28 -28
  43. package/dist/bin/pushary-suggestions.js +16 -16
  44. package/dist/bin/pushary-transcript-register.js +17 -17
  45. package/dist/bin/pushary-transcripts.js +26 -26
  46. package/dist/bin/pushary-upgrade.js +48 -48
  47. package/dist/bin/pushary-wait.js +16 -16
  48. package/dist/bin/pushary.js +7 -7
  49. package/dist/{chunk-QYQMIAYH.js → chunk-23ELMB2F.js} +2 -2
  50. package/dist/{chunk-Y2OJGMJX.js → chunk-2DYJTOOU.js} +3 -3
  51. package/dist/{chunk-V3YAXCQU.js → chunk-2Q3ZTT57.js} +7 -7
  52. package/dist/{chunk-I7TBQ7S5.js → chunk-43DXK6WE.js} +1 -1
  53. package/dist/{chunk-2G3DG3NV.js → chunk-5K5MT22J.js} +4 -4
  54. package/dist/{chunk-XYSD5VPQ.js → chunk-5SVZXCAJ.js} +1 -1
  55. package/dist/{chunk-YAUW3PBG.js → chunk-67UJTXRZ.js} +1 -1
  56. package/dist/{chunk-7B27SJIZ.js → chunk-73ROMTIN.js} +6 -6
  57. package/dist/{chunk-7BJQM5GI.js → chunk-APTFA4KF.js} +1 -1
  58. package/dist/{chunk-4EGBDV3T.js → chunk-AURPPDRZ.js} +2 -2
  59. package/dist/{chunk-JBXHNML3.js → chunk-BTSJ2W7I.js} +1 -1
  60. package/dist/{chunk-EZI67YOT.js → chunk-BZ2V2ES3.js} +5 -5
  61. package/dist/{chunk-JWBRJTPT.js → chunk-C4D6R27P.js} +5 -5
  62. package/dist/{chunk-RLTFMU3B.js → chunk-CAOMKUSR.js} +4 -4
  63. package/dist/{chunk-DTSWVMTP.js → chunk-CC6BYFNM.js} +6 -6
  64. package/dist/{chunk-HD3ECNDC.js → chunk-CTTIW2A3.js} +2 -2
  65. package/dist/{chunk-AWRQHXQK.js → chunk-CXGRUUUM.js} +10 -10
  66. package/dist/{chunk-CTG3F2D5.js → chunk-D2666AVW.js} +6 -6
  67. package/dist/{chunk-C3EE5L6V.js → chunk-DIHUVYT2.js} +147 -40
  68. package/dist/{chunk-FUNDDXWK.js → chunk-DOMSM62I.js} +2 -2
  69. package/dist/{chunk-SFXNXZA5.js → chunk-DS3C4SRR.js} +2 -2
  70. package/dist/{chunk-6EE4F4PG.js → chunk-DU2YTOTA.js} +1 -1
  71. package/dist/{chunk-HQ6RWSWN.js → chunk-DU5MLJQL.js} +1 -1
  72. package/dist/{chunk-3VYL4GCX.js → chunk-EHH4PQG7.js} +4 -4
  73. package/dist/{chunk-277GOA5S.js → chunk-EPT6MZBG.js} +5 -5
  74. package/dist/{chunk-LDXGL2QH.js → chunk-EVJ5DPRU.js} +1 -1
  75. package/dist/{chunk-HUMF6AIT.js → chunk-F6LNIS2Y.js} +1 -1
  76. package/dist/{chunk-U7VDCUWD.js → chunk-FKYZEIH7.js} +10 -10
  77. package/dist/{chunk-KQVVDMUD.js → chunk-FNDKQEJP.js} +4 -4
  78. package/dist/{chunk-B3MTDMWH.js → chunk-FURJQUDT.js} +2 -2
  79. package/dist/{chunk-LG47IOFN.js → chunk-H4DPB3LK.js} +8 -8
  80. package/dist/{chunk-ZO65DKXG.js → chunk-H4XEEC4I.js} +2 -2
  81. package/dist/{chunk-BX2A6VVT.js → chunk-HB3S3KDX.js} +1 -1
  82. package/dist/{chunk-QXI7SYVB.js → chunk-HMN4XEJE.js} +4 -4
  83. package/dist/{chunk-2WLNEOT7.js → chunk-HSVVH7K2.js} +1 -1
  84. package/dist/{chunk-JHBGO2PF.js → chunk-HVY3YUJU.js} +1 -1
  85. package/dist/{chunk-DLJ4ZGPG.js → chunk-HZ76NLD2.js} +6 -6
  86. package/dist/{chunk-WAT7A5DW.js → chunk-I4D4XEIJ.js} +5 -5
  87. package/dist/{chunk-6JTLZZ32.js → chunk-IHH3HGQQ.js} +3 -3
  88. package/dist/{chunk-ELXKZ6XS.js → chunk-IK4MIPI2.js} +3 -3
  89. package/dist/{chunk-ATGFCOLG.js → chunk-IMSFJFN6.js} +1 -1
  90. package/dist/{chunk-X27JRAYF.js → chunk-IS5WMKN2.js} +3 -3
  91. package/dist/{chunk-3W5AT2Y4.js → chunk-J7V5ZFZC.js} +6 -6
  92. package/dist/{chunk-PGP4AQ6G.js → chunk-JG4JGAI2.js} +4 -4
  93. package/dist/{chunk-HUK6GLBG.js → chunk-JOQAW5BM.js} +12 -12
  94. package/dist/{chunk-BJ3PEW5V.js → chunk-JUCN4TV4.js} +5 -5
  95. package/dist/{chunk-QHF3SYTV.js → chunk-JVZCCUN4.js} +5 -5
  96. package/dist/{chunk-S5GQCO2I.js → chunk-K5ZEJCJO.js} +3 -3
  97. package/dist/{chunk-DRCBTY5T.js → chunk-KEC73KH6.js} +1 -1
  98. package/dist/{chunk-3N2FP6BB.js → chunk-LE6VFEJU.js} +1 -1
  99. package/dist/{chunk-6CI7KSDE.js → chunk-LZRXFGEP.js} +49 -3
  100. package/dist/chunk-MJW6P7A6.js +129 -0
  101. package/dist/{chunk-2D5MYSTO.js → chunk-NHLCREFU.js} +1 -1
  102. package/dist/{chunk-ITRSDEVH.js → chunk-NLW2YDL5.js} +5 -5
  103. package/dist/{chunk-OOWMON6B.js → chunk-OAE54AV7.js} +1 -1
  104. package/dist/{chunk-LO6EAFRS.js → chunk-Q54QQO5E.js} +5 -5
  105. package/dist/{chunk-R5AX37KI.js → chunk-QGYVOSDC.js} +1 -1
  106. package/dist/{chunk-IJUHRBKA.js → chunk-QIOPWRBQ.js} +1 -1
  107. package/dist/{chunk-DDRT2WJA.js → chunk-QWSXLYTX.js} +3 -3
  108. package/dist/{chunk-GIHIYB3Q.js → chunk-R33I7ZNR.js} +5 -5
  109. package/dist/{chunk-Z43TNC27.js → chunk-RA4RSVVJ.js} +1 -1
  110. package/dist/{chunk-6WBHZHZS.js → chunk-RX75OG6S.js} +6 -6
  111. package/dist/{chunk-S3R4CZT3.js → chunk-SCXUTDQM.js} +3 -3
  112. package/dist/{chunk-GNY6Z2U2.js → chunk-SG4IFPJP.js} +1 -1
  113. package/dist/{chunk-E7XXDMHV.js → chunk-SLD22IUB.js} +4 -4
  114. package/dist/{chunk-MR3JQ3LS.js → chunk-SOJPAKCB.js} +1 -1
  115. package/dist/{chunk-6FEJR64W.js → chunk-T4EVAVKF.js} +5 -5
  116. package/dist/{chunk-W6FZOPF4.js → chunk-V6MQUYE2.js} +7 -7
  117. package/dist/{chunk-JHPL4VBE.js → chunk-VDPUBIL2.js} +2 -2
  118. package/dist/{chunk-DP3AS752.js → chunk-VL4AJPCE.js} +4 -4
  119. package/dist/{chunk-63R6OZXQ.js → chunk-VSW5ZMPX.js} +3 -3
  120. package/dist/{chunk-DC32YKE2.js → chunk-VZVKJP3Q.js} +75 -3
  121. package/dist/{chunk-DLCLDR6K.js → chunk-W7QW3XFQ.js} +4 -4
  122. package/dist/{chunk-2MRIJ7TX.js → chunk-WCOI5PQU.js} +1 -1
  123. package/dist/{chunk-5J5JO5UQ.js → chunk-WFUVBCKK.js} +4 -4
  124. package/dist/{chunk-GFDMYQGZ.js → chunk-WOEMRT24.js} +3 -3
  125. package/dist/{chunk-64KRDJ46.js → chunk-WTFR2OK4.js} +38 -26
  126. package/dist/{chunk-XGF3JB3R.js → chunk-WV7OME3F.js} +2 -2
  127. package/dist/{chunk-SBY4JFPZ.js → chunk-WYYHSHBO.js} +2 -2
  128. package/dist/{chunk-CXSLZIBE.js → chunk-YEIHJAE6.js} +3 -3
  129. package/dist/{chunk-PFGQS4QA.js → chunk-YQTU6V4X.js} +2 -2
  130. package/dist/{chunk-HITBECZ4.js → chunk-ZPM6H6GM.js} +1 -1
  131. package/dist/{codex-app-cards-switch-WVE7EY3Q.js → codex-app-cards-switch-CQZL4XI6.js} +12 -12
  132. package/dist/{codex-card-routing-TW5PGTDQ.js → codex-card-routing-VV2HQAGX.js} +2 -2
  133. package/dist/{codex-desktop-launch-HCWAIOUD.js → codex-desktop-launch-FYXOQGBR.js} +3 -3
  134. package/dist/{codex-session-launch-QE7ET6HE.js → codex-session-launch-A4LDZ4GU.js} +20 -20
  135. package/dist/{config-G3A5OUOA.js → config-EHAN6BUF.js} +3 -3
  136. package/dist/{global-upgrade-RMVGM26D.js → global-upgrade-EJZ2EX7R.js} +9 -9
  137. package/dist/{identity-5YOIBGSM.js → identity-L7SFKUOG.js} +4 -4
  138. package/dist/{live-capabilities-DXRASGGQ.js → live-capabilities-QAVKVTKD.js} +4 -4
  139. package/dist/{paths-JZZB2B5C.js → paths-BD7XIUNJ.js} +3 -3
  140. package/dist/reapply-QFSUMRID.js +76 -0
  141. package/dist/src/index.d.ts +1 -0
  142. package/dist/src/index.js +34 -34
  143. package/dist/{upgrade-lock-RPTYWUWT.js → upgrade-lock-Y35PJNJT.js} +4 -4
  144. package/dist/{usage-LFHZHCB5.js → usage-E5Z3XUTZ.js} +3 -3
  145. package/package.json +1 -1
  146. package/dist/chunk-KQXWREMT.js +0 -69
  147. package/dist/reapply-55YYSVPF.js +0 -76
@@ -3,13 +3,13 @@ import {
3
3
  } from "./chunk-WHB622LP.js";
4
4
  import {
5
5
  ensureDaemonRunning
6
- } from "./chunk-3W5AT2Y4.js";
6
+ } from "./chunk-J7V5ZFZC.js";
7
7
  import {
8
8
  hookOwnerOf
9
- } from "./chunk-2G3DG3NV.js";
9
+ } from "./chunk-5K5MT22J.js";
10
10
  import {
11
11
  hookMeaning
12
- } from "./chunk-JHBGO2PF.js";
12
+ } from "./chunk-HVY3YUJU.js";
13
13
  import {
14
14
  buildTranscriptRecords,
15
15
  changedRecipientsMessage,
@@ -24,11 +24,11 @@ import {
24
24
  uploadTranscriptRecords,
25
25
  verifyAnchoredRecipients,
26
26
  wrapSessionKey
27
- } from "./chunk-GFDMYQGZ.js";
27
+ } from "./chunk-WOEMRT24.js";
28
28
  import {
29
29
  transcriptEnvironmentPreference,
30
30
  transcriptsEnabled
31
- } from "./chunk-6EE4F4PG.js";
31
+ } from "./chunk-DU2YTOTA.js";
32
32
  import {
33
33
  external_exports,
34
34
  ownedOnlyByThisUser,
@@ -36,19 +36,19 @@ import {
36
36
  } from "./chunk-P6DUWKAO.js";
37
37
  import {
38
38
  fetchAsCredential
39
- } from "./chunk-3N2FP6BB.js";
39
+ } from "./chunk-LE6VFEJU.js";
40
40
  import {
41
41
  readTranscriptPreference
42
- } from "./chunk-S5GQCO2I.js";
42
+ } from "./chunk-K5ZEJCJO.js";
43
43
  import {
44
44
  claudeConfigDir,
45
45
  codexHome,
46
46
  pusharyDir
47
- } from "./chunk-4EGBDV3T.js";
47
+ } from "./chunk-AURPPDRZ.js";
48
48
  import {
49
49
  getApiKey,
50
50
  getBaseUrl
51
- } from "./chunk-XGF3JB3R.js";
51
+ } from "./chunk-WV7OME3F.js";
52
52
  import {
53
53
  writeJsonAtomic,
54
54
  writeJsonAtomicDurable
@@ -61,7 +61,7 @@ import {
61
61
  isHookSource,
62
62
  isRecord,
63
63
  redactSecretsFromContent
64
- } from "./chunk-DC32YKE2.js";
64
+ } from "./chunk-VZVKJP3Q.js";
65
65
 
66
66
  // src/transcript-registration.ts
67
67
  import { createHash as createHash4 } from "crypto";
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  APPROVAL_RULES_PATH,
3
3
  canChangeApprovalSettings
4
- } from "./chunk-FUNDDXWK.js";
4
+ } from "./chunk-DOMSM62I.js";
5
5
  import {
6
6
  callMcpTool
7
- } from "./chunk-JWBRJTPT.js";
7
+ } from "./chunk-C4D6R27P.js";
8
8
  import {
9
9
  absoluteUrl
10
- } from "./chunk-CXSLZIBE.js";
10
+ } from "./chunk-YEIHJAE6.js";
11
11
  import {
12
12
  getBaseUrl
13
- } from "./chunk-XGF3JB3R.js";
13
+ } from "./chunk-WV7OME3F.js";
14
14
  import {
15
15
  NPX_LATEST_COMMAND
16
- } from "./chunk-7BJQM5GI.js";
16
+ } from "./chunk-APTFA4KF.js";
17
17
  import {
18
18
  AGENT_STOP_DEFAULT_SECONDS,
19
19
  APPROVAL_MODE_META,
@@ -21,7 +21,7 @@ import {
21
21
  classifyConfirmResponse,
22
22
  isAnswerSource,
23
23
  roundTripAsk
24
- } from "./chunk-DC32YKE2.js";
24
+ } from "./chunk-VZVKJP3Q.js";
25
25
 
26
26
  // src/reach.ts
27
27
  var PUSHARY_APP_DOWNLOAD_URL = "https://pushary.com/download";
@@ -29,7 +29,7 @@ import {
29
29
  toolResultErrorText,
30
30
  transcriptTokensIn,
31
31
  transcriptUsageRequest
32
- } from "./chunk-JHBGO2PF.js";
32
+ } from "./chunk-HVY3YUJU.js";
33
33
  import {
34
34
  askUser,
35
35
  cancelQuestion,
@@ -45,37 +45,37 @@ import {
45
45
  waitForOpenQuestion,
46
46
  waitForQuestion,
47
47
  writeDegraded
48
- } from "./chunk-6WBHZHZS.js";
48
+ } from "./chunk-RX75OG6S.js";
49
49
  import {
50
50
  RETRY_ACK,
51
51
  readCommandAck,
52
52
  refusedReceiptMessage
53
- } from "./chunk-HUMF6AIT.js";
53
+ } from "./chunk-F6LNIS2Y.js";
54
54
  import {
55
55
  SubscriptionRequiredError,
56
56
  isRetryable,
57
57
  withRetry
58
- } from "./chunk-JWBRJTPT.js";
58
+ } from "./chunk-C4D6R27P.js";
59
59
  import {
60
60
  fetchAsCredential
61
- } from "./chunk-3N2FP6BB.js";
61
+ } from "./chunk-LE6VFEJU.js";
62
62
  import {
63
63
  branchFor,
64
64
  projectNameFor,
65
65
  repoKeyFor
66
- } from "./chunk-LDXGL2QH.js";
66
+ } from "./chunk-EVJ5DPRU.js";
67
67
  import {
68
68
  getMachineId
69
- } from "./chunk-2WLNEOT7.js";
69
+ } from "./chunk-HSVVH7K2.js";
70
70
  import {
71
71
  reportedInstallSource
72
- } from "./chunk-HD3ECNDC.js";
72
+ } from "./chunk-CTTIW2A3.js";
73
73
  import {
74
74
  IDLE_PROMPT_NOTIFICATION,
75
75
  NOTIFICATION_PUSH_TYPES,
76
76
  POSTTOOLUSE_MIRROR_ONLY_TOOLS,
77
77
  claudeConfigDir
78
- } from "./chunk-4EGBDV3T.js";
78
+ } from "./chunk-AURPPDRZ.js";
79
79
  import {
80
80
  compareVersion,
81
81
  parseVersion
@@ -84,7 +84,7 @@ import {
84
84
  getApiKey,
85
85
  getBaseUrl,
86
86
  isMalformedApiKeyError
87
- } from "./chunk-XGF3JB3R.js";
87
+ } from "./chunk-WV7OME3F.js";
88
88
  import {
89
89
  writeFileAtomic,
90
90
  writeJsonAtomicDurable
@@ -152,7 +152,7 @@ import {
152
152
  resolvePolicy,
153
153
  unansweredRefusalReason,
154
154
  waitsForThePhone
155
- } from "./chunk-DC32YKE2.js";
155
+ } from "./chunk-VZVKJP3Q.js";
156
156
 
157
157
  // src/pending.ts
158
158
  import { join } from "path";
@@ -458,6 +458,12 @@ var emitHookOutput = async (render, write = writeOutput) => {
458
458
  }
459
459
  };
460
460
 
461
+ // src/telemetry-opt-out.ts
462
+ var TELEMETRY_OPT_OUT_VARIABLES = ["DO_NOT_TRACK", "PUSHARY_TELEMETRY_DISABLED"];
463
+ var OPT_IN_SPELLINGS = ["", "0", "false"];
464
+ var variableOptsOut = (value) => value !== void 0 && !OPT_IN_SPELLINGS.includes(value.trim().toLowerCase());
465
+ var telemetryOptedOut = (env) => TELEMETRY_OPT_OUT_VARIABLES.some((name) => variableOptsOut(env[name]));
466
+
461
467
  // src/policy.ts
462
468
  import { createHash as createHash2 } from "crypto";
463
469
  import { existsSync as existsSync2, lstatSync as lstatSync2, readFileSync as readFileSync2, readdirSync as readdirSync2, unlinkSync as unlinkSync2, utimesSync, writeFileSync as writeFileSync2 } from "fs";
@@ -1314,7 +1320,7 @@ var phoneDrivenEnv = (base) => ({
1314
1320
  import { join as join5 } from "path";
1315
1321
  import { tmpdir as tmpdir5 } from "os";
1316
1322
  import { createHash as createHash4 } from "crypto";
1317
- import { existsSync as existsSync4, mkdirSync as mkdirSync3, statSync as statSync3, writeFileSync as writeFileSync5, rmSync as rmSync2 } from "fs";
1323
+ import { existsSync as existsSync4, mkdirSync as mkdirSync3, statSync as statSync3, writeFileSync as writeFileSync5, rmSync as rmSync2, utimesSync as utimesSync2 } from "fs";
1318
1324
  var THROTTLE_DIR = join5(tmpdir5(), "pushary-throttle");
1319
1325
  var markerPath = (key) => join5(THROTTLE_DIR, createHash4("sha256").update(key).digest("hex").slice(0, 16));
1320
1326
  var claimThrottle = (key, windowMs) => {
@@ -1331,16 +1337,24 @@ var claimThrottle = (key, windowMs) => {
1331
1337
  var releaseThrottle = (key) => {
1332
1338
  rmSync2(markerPath(key), { force: true });
1333
1339
  };
1340
+ var rearmThrottle = (key, windowMs, retryAfterMs) => {
1341
+ const stampSeconds = (Date.now() - windowMs + retryAfterMs) / 1e3;
1342
+ utimesSync2(markerPath(key), stampSeconds, stampSeconds);
1343
+ };
1344
+ var renewThrottle = (key) => {
1345
+ const stampSeconds = Date.now() / 1e3;
1346
+ utimesSync2(markerPath(key), stampSeconds, stampSeconds);
1347
+ };
1334
1348
 
1335
1349
  // src/blocked-action-hint.ts
1336
1350
  import { createHash as createHash5 } from "crypto";
1337
- import { existsSync as existsSync5, mkdirSync as mkdirSync5, readFileSync as readFileSync5, readdirSync as readdirSync4, rmSync as rmSync4, statSync as statSync4, utimesSync as utimesSync2 } from "fs";
1351
+ import { existsSync as existsSync5, mkdirSync as mkdirSync5, readFileSync as readFileSync5, readdirSync as readdirSync4, rmSync as rmSync4, statSync as statSync4, utimesSync as utimesSync4 } from "fs";
1338
1352
  import { tmpdir as tmpdir7 } from "os";
1339
1353
  import { join as join7 } from "path";
1340
1354
 
1341
1355
  // src/call-decision-store.ts
1342
1356
  import { randomUUID } from "crypto";
1343
- import { lstatSync as lstatSync3, mkdirSync as mkdirSync4, readFileSync as readFileSync4, readdirSync as readdirSync3, renameSync, rmSync as rmSync3, writeFileSync as writeFileSync6 } from "fs";
1357
+ import { linkSync, lstatSync as lstatSync3, mkdirSync as mkdirSync4, readFileSync as readFileSync4, readdirSync as readdirSync3, renameSync, rmSync as rmSync3, utimesSync as utimesSync3, writeFileSync as writeFileSync6 } from "fs";
1344
1358
  import { tmpdir as tmpdir6, userInfo } from "os";
1345
1359
  import { join as join6 } from "path";
1346
1360
  var userScope = () => {
@@ -1403,6 +1417,8 @@ var parseDecision = (raw) => {
1403
1417
  return typeof parsed.toolUseId === "string" && parsed.toolUseId ? { kind: "approved", toolUseId: parsed.toolUseId } : null;
1404
1418
  }
1405
1419
  if (parsed.kind === "handled") return { kind: "handled" };
1420
+ if (parsed.kind === "settled") return { kind: "settled" };
1421
+ if (parsed.kind === "set_aside") return { kind: "set_aside" };
1406
1422
  if (parsed.kind === "denied") {
1407
1423
  return { kind: "denied", reason: typeof parsed.reason === "string" ? parsed.reason : "" };
1408
1424
  }
@@ -1426,7 +1442,8 @@ var readRecorded = (path, ttlMs) => {
1426
1442
  try {
1427
1443
  const record = lstatSync3(path);
1428
1444
  if (!record.isFile() || Date.now() - record.mtimeMs >= ttlMs) return null;
1429
- return parseDecision(readFileSync4(path, "utf-8"));
1445
+ const decision = parseDecision(readFileSync4(path, "utf-8"));
1446
+ return decision === null ? null : { decision, recordedAtMs: record.mtimeMs };
1430
1447
  } catch {
1431
1448
  return null;
1432
1449
  }
@@ -1438,6 +1455,35 @@ var readClaimed = (claimed, ttlMs) => {
1438
1455
  removeQuietly(claimed);
1439
1456
  }
1440
1457
  };
1458
+ var MS_PER_SECOND2 = 1e3;
1459
+ var isStillLive = (recordedAtMs, ttlMs) => Date.now() - recordedAtMs < ttlMs;
1460
+ var SWEEP_STAMP = ".swept";
1461
+ var sweepDue = (dir, nowMs, sweepEveryMs) => {
1462
+ try {
1463
+ const sweptAtMs = lstatSync3(join6(dir, SWEEP_STAMP)).mtimeMs;
1464
+ return sweptAtMs > nowMs || nowMs - sweptAtMs >= sweepEveryMs;
1465
+ } catch {
1466
+ return true;
1467
+ }
1468
+ };
1469
+ var stampTheSweep = (dir) => {
1470
+ try {
1471
+ writeFileSync6(join6(dir, SWEEP_STAMP), "", { mode: PRIVATE_FILE_MODE });
1472
+ } catch {
1473
+ return;
1474
+ }
1475
+ };
1476
+ var sweepUnlessSweptWithin = (dir, ttlMs, sweepEveryMs) => {
1477
+ const nowMs = Date.now();
1478
+ if (sweepEveryMs === void 0) {
1479
+ sweepExpired(dir, nowMs, ttlMs);
1480
+ return;
1481
+ }
1482
+ if (!sweepDue(dir, nowMs, sweepEveryMs)) return;
1483
+ stampTheSweep(dir);
1484
+ sweepExpired(dir, nowMs, ttlMs);
1485
+ };
1486
+ var isAlreadyPresent = (error) => error instanceof Error && "code" in error && error.code === "EEXIST";
1441
1487
  var A_RECORD_IN_FLIGHT = /\.(?:pending|claimed)$/;
1442
1488
  var recordedKeyAt = (dir, key, ttlMs) => {
1443
1489
  try {
@@ -1456,8 +1502,19 @@ var recordedKeysStartingWith = (dir, prefix, ttlMs) => {
1456
1502
  return [];
1457
1503
  }
1458
1504
  };
1459
- var callDecisionStore = (name, ttlMs) => {
1505
+ var callDecisionStore = (name, ttlMs, options = {}) => {
1460
1506
  const decisionDir = () => join6(tmpdir6(), `pushary-${name}-decisions-${userScope()}`);
1507
+ const claimRecorded = (key) => {
1508
+ const dir = decisionDir();
1509
+ if (!isPrivateFolder(dir)) return null;
1510
+ const claimed = join6(dir, `${key}.${randomUUID()}.claimed`);
1511
+ try {
1512
+ renameSync(join6(dir, key), claimed);
1513
+ } catch {
1514
+ return null;
1515
+ }
1516
+ return readClaimed(claimed, ttlMs);
1517
+ };
1461
1518
  return {
1462
1519
  record: (key, decision) => {
1463
1520
  if (!key) return;
@@ -1466,7 +1523,7 @@ var callDecisionStore = (name, ttlMs) => {
1466
1523
  reportUnrecordedDecision(`${decisionDir()} is not a folder only this user can open`);
1467
1524
  return;
1468
1525
  }
1469
- sweepExpired(dir, Date.now(), ttlMs);
1526
+ sweepUnlessSweptWithin(dir, ttlMs, options.sweepAtMostEveryMs);
1470
1527
  const pending = join6(dir, `${key}.${randomUUID()}.pending`);
1471
1528
  try {
1472
1529
  writeFileSync6(pending, JSON.stringify(decision), { encoding: "utf-8", mode: PRIVATE_FILE_MODE, flag: "wx" });
@@ -1476,22 +1533,34 @@ var callDecisionStore = (name, ttlMs) => {
1476
1533
  reportUnrecordedDecision(error instanceof Error ? error.message : String(error));
1477
1534
  }
1478
1535
  },
1479
- consume: (key) => {
1480
- if (!key) return null;
1536
+ recordUnlessPresent: (key, { decision, recordedAtMs }) => {
1537
+ if (!isStillLive(recordedAtMs, ttlMs)) return;
1481
1538
  const dir = decisionDir();
1482
- if (!isPrivateFolder(dir)) return null;
1483
- const claimed = join6(dir, `${key}.${randomUUID()}.claimed`);
1539
+ if (!isPrivateFolder(dir)) return;
1540
+ const pending = join6(dir, `${key}.${randomUUID()}.pending`);
1484
1541
  try {
1485
- renameSync(join6(dir, key), claimed);
1486
- } catch {
1487
- return null;
1542
+ writeFileSync6(pending, JSON.stringify(decision), { encoding: "utf-8", mode: PRIVATE_FILE_MODE, flag: "wx" });
1543
+ utimesSync3(pending, Date.now() / MS_PER_SECOND2, recordedAtMs / MS_PER_SECOND2);
1544
+ linkSync(pending, join6(dir, key));
1545
+ } catch (error) {
1546
+ if (!isAlreadyPresent(error)) reportUnrecordedDecision(error instanceof Error ? error.message : String(error));
1547
+ } finally {
1548
+ removeQuietly(pending);
1488
1549
  }
1489
- return readClaimed(claimed, ttlMs);
1550
+ },
1551
+ consume: (key) => {
1552
+ if (!key) return null;
1553
+ return claimRecorded(key)?.decision ?? null;
1554
+ },
1555
+ consumeRecorded: (key) => claimRecorded(key),
1556
+ recordedAtMs: (key) => {
1557
+ const dir = decisionDir();
1558
+ return isPrivateFolder(dir) ? recordedKeyAt(dir, key, ttlMs)?.recordedAtMs ?? null : null;
1490
1559
  },
1491
1560
  peek: (key) => {
1492
1561
  if (!key) return null;
1493
1562
  const dir = decisionDir();
1494
- return isPrivateFolder(dir) ? readRecorded(join6(dir, key), ttlMs) : null;
1563
+ return isPrivateFolder(dir) ? readRecorded(join6(dir, key), ttlMs)?.decision ?? null : null;
1495
1564
  },
1496
1565
  forget: (key) => {
1497
1566
  if (!key) return;
@@ -1590,7 +1659,7 @@ var markApprovalReminded = (approval) => {
1590
1659
  const { atime, mtime } = statSync4(path);
1591
1660
  const { fingerprint, sessionId, toolName } = approval;
1592
1661
  writeFileAtomic(path, JSON.stringify({ fingerprint, sessionId, toolName, reminded: true }), 384);
1593
- utimesSync2(path, atime, mtime);
1662
+ utimesSync4(path, atime, mtime);
1594
1663
  } catch {
1595
1664
  return;
1596
1665
  }
@@ -1699,7 +1768,7 @@ var isWaitingOnBackgroundWork = (sessionKey, nowMs = Date.now()) => {
1699
1768
 
1700
1769
  // src/gate-outcome-record.ts
1701
1770
  import { createHash as createHash7 } from "crypto";
1702
- import { lstatSync as lstatSync4, readFileSync as readFileSync7, readdirSync as readdirSync6, utimesSync as utimesSync3, writeFileSync as writeFileSync8 } from "fs";
1771
+ import { lstatSync as lstatSync4, readFileSync as readFileSync7, readdirSync as readdirSync6, utimesSync as utimesSync5, writeFileSync as writeFileSync8 } from "fs";
1703
1772
  import { tmpdir as tmpdir9 } from "os";
1704
1773
  import { join as join10 } from "path";
1705
1774
  var GATE_OUTCOME_RECORD_TTL_MS = 60 * 60 * 1e3;
@@ -1720,7 +1789,7 @@ var claimedSweep = (stamp, nowMs) => {
1720
1789
  try {
1721
1790
  const stamped = lstatSync4(stamp);
1722
1791
  if (!stamped.isFile() || nowMs - stamped.mtimeMs < GATE_OUTCOME_SWEEP_INTERVAL_MS) return false;
1723
- utimesSync3(stamp, nowMs / 1e3, nowMs / 1e3);
1792
+ utimesSync5(stamp, nowMs / 1e3, nowMs / 1e3);
1724
1793
  return true;
1725
1794
  } catch {
1726
1795
  return startedSweepStamp(stamp);
@@ -1917,6 +1986,42 @@ var deriveAutoDecisionBeacon = (toolName, toolInput, liveMode, agentType, cwd, s
1917
1986
  };
1918
1987
  var AUTO_DECISION_WINDOW_MS = 15 * 60 * 1e3;
1919
1988
  var HOOK_ACTIVE_WINDOW_MS = 30 * 60 * 1e3;
1989
+ var HOOK_ACTIVE_REPORT = { maxAttempts: 1, timeoutMs: 800 };
1990
+ var HOOK_ACTIVE_RETRY_MS = 2 * 60 * 1e3;
1991
+ var HOOK_ACTIVE_CUT_SHORT_RETRY_MS = 10 * 60 * 1e3;
1992
+ var EventRejectedError = class extends Error {
1993
+ constructor(status) {
1994
+ super(`/api/agent/event rejected (${status})`);
1995
+ this.status = status;
1996
+ }
1997
+ };
1998
+ var TOO_MANY_REQUESTS = 429;
1999
+ var isDefinitiveRefusal = (error) => error instanceof EventRejectedError && error.status >= 400 && error.status < 500 && error.status !== TOO_MANY_REQUESTS;
2000
+ var isTimeout = (error) => error instanceof Error && error.name === "TimeoutError";
2001
+ var hookActiveWindowAfter = (error, toolReportSettled) => {
2002
+ if (error === null || isDefinitiveRefusal(error)) return { kind: "full" };
2003
+ if (toolReportSettled && !isTimeout(error)) return { kind: "retry", afterMs: HOOK_ACTIVE_CUT_SHORT_RETRY_MS };
2004
+ return { kind: "retry", afterMs: HOOK_ACTIVE_RETRY_MS };
2005
+ };
2006
+ var keepThrottleQuietly = (keep) => {
2007
+ try {
2008
+ keep();
2009
+ } catch {
2010
+ return;
2011
+ }
2012
+ };
2013
+ var holdHookActiveWindow = (throttleKey, window) => keepThrottleQuietly(() => window.kind === "full" ? renewThrottle(throttleKey) : rearmThrottle(throttleKey, HOOK_ACTIVE_WINDOW_MS, window.afterMs));
2014
+ var reportHookActive = async (throttleKey, event, signals, report = reportEvent) => {
2015
+ holdHookActiveWindow(throttleKey, { kind: "retry", afterMs: HOOK_ACTIVE_RETRY_MS });
2016
+ const signal = AbortSignal.any([signals.budget, signals.toolReportSettled]);
2017
+ try {
2018
+ await report(event, { ...HOOK_ACTIVE_REPORT, requireOk: true, skipDrain: true, signal });
2019
+ holdHookActiveWindow(throttleKey, { kind: "full" });
2020
+ } catch (error) {
2021
+ holdHookActiveWindow(throttleKey, hookActiveWindowAfter(error, signals.toolReportSettled.aborted));
2022
+ }
2023
+ };
2024
+ var telemetryOptOutMark = (env = process.env) => telemetryOptedOut(env) ? { telemetryOptOut: true } : {};
1920
2025
  var permissionModeOf = (input) => {
1921
2026
  const permissionMode = parsePermissionMode(input.permission_mode);
1922
2027
  return permissionMode === void 0 ? {} : { permissionMode };
@@ -2028,7 +2133,7 @@ var reportEvent = async (event, options = {}) => {
2028
2133
  }),
2029
2134
  signal: AbortSignal.any([AbortSignal.timeout(timeoutMs), ...options.signal ? [options.signal] : []])
2030
2135
  });
2031
- if ((options.requireOk || event.usage !== void 0) && !res.ok) throw new Error(`/api/agent/event rejected (${res.status})`);
2136
+ if ((options.requireOk || event.usage !== void 0) && !res.ok) throw new EventRejectedError(res.status);
2032
2137
  try {
2033
2138
  const result = await res.json();
2034
2139
  const withoutPending = () => ({ ...result, pendingCommand: void 0, pendingCommandId: void 0 });
@@ -2157,17 +2262,18 @@ var handlePostToolUse = async (input, agent = CLAUDE_CODE_AGENT) => {
2157
2262
  skipDrain: insideSubagent
2158
2263
  });
2159
2264
  const extraReports = [];
2160
- if (claimThrottle(`hookactive:${sessionKey}`, HOOK_ACTIVE_WINDOW_MS) === "passed") {
2265
+ const hookActiveKey = `hookactive:${sessionKey}`;
2266
+ if (claimThrottle(hookActiveKey, HOOK_ACTIVE_WINDOW_MS) === "passed") {
2267
+ const toolReportSettled = new AbortController();
2268
+ void toolReport.finally(() => toolReportSettled.abort()).catch(() => void 0);
2161
2269
  extraReports.push(
2162
- reportEvent(
2163
- {
2164
- event: "agent_hook_active",
2165
- agentType: agent.type,
2166
- agentName: `${agent.label} - ${projectName}`,
2167
- sessionId: input.session_id
2168
- },
2169
- { maxAttempts: 1, timeoutMs: 800, signal }
2170
- )
2270
+ reportHookActive(hookActiveKey, {
2271
+ event: "agent_hook_active",
2272
+ agentType: agent.type,
2273
+ agentName: `${agent.label} - ${projectName}`,
2274
+ sessionId: input.session_id,
2275
+ ...telemetryOptOutMark()
2276
+ }, { budget: signal, toolReportSettled: toolReportSettled.signal })
2171
2277
  );
2172
2278
  }
2173
2279
  const [reported] = await Promise.allSettled([toolReport, ...extraReports]);
@@ -2452,6 +2558,7 @@ export {
2452
2558
  phoneDrivenEnv,
2453
2559
  claimThrottle,
2454
2560
  releaseThrottle,
2561
+ telemetryOptedOut,
2455
2562
  policyRequestFor,
2456
2563
  getPolicy,
2457
2564
  getPolicyForStandingDenies,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  absoluteUrl
3
- } from "./chunk-CXSLZIBE.js";
3
+ } from "./chunk-YEIHJAE6.js";
4
4
  import {
5
5
  KEY_SCOPE
6
- } from "./chunk-DC32YKE2.js";
6
+ } from "./chunk-VZVKJP3Q.js";
7
7
 
8
8
  // src/cli/approval-settings-pages.ts
9
9
  var API_KEYS_PATH = "/dashboard/agent/settings";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  autoUpdateLock
3
- } from "./chunk-4EGBDV3T.js";
3
+ } from "./chunk-AURPPDRZ.js";
4
4
  import {
5
5
  installPackageGlobally,
6
6
  npmErrorMessage,
7
7
  throwIfNpmRefusesInstall
8
- } from "./chunk-E7XXDMHV.js";
8
+ } from "./chunk-SLD22IUB.js";
9
9
  import {
10
10
  writeJsonAtomic
11
11
  } from "./chunk-PM2NRK6Y.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readTranscriptPreference
3
- } from "./chunk-S5GQCO2I.js";
3
+ } from "./chunk-K5ZEJCJO.js";
4
4
 
5
5
  // src/transcript-setting.ts
6
6
  var transcriptEnvironmentPreference = () => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSafeReadOnlyCommand
3
- } from "./chunk-DC32YKE2.js";
3
+ } from "./chunk-VZVKJP3Q.js";
4
4
 
5
5
  // src/ledger.ts
6
6
  import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync } from "fs";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  compatibleConfigFile,
3
3
  hasCompatibleHooks
4
- } from "./chunk-DLJ4ZGPG.js";
4
+ } from "./chunk-HZ76NLD2.js";
5
5
  import {
6
6
  pusharyHookExecutable
7
- } from "./chunk-2G3DG3NV.js";
7
+ } from "./chunk-5K5MT22J.js";
8
8
  import {
9
9
  isProtectedByScope,
10
10
  registerHookEntry
11
- } from "./chunk-4EGBDV3T.js";
11
+ } from "./chunk-AURPPDRZ.js";
12
12
  import {
13
13
  isRecord
14
- } from "./chunk-DC32YKE2.js";
14
+ } from "./chunk-VZVKJP3Q.js";
15
15
 
16
16
  // src/cursor-config.ts
17
17
  var hookCommandOf = (entry) => {
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  openClawLauncherCandidates
3
- } from "./chunk-X27JRAYF.js";
3
+ } from "./chunk-IS5WMKN2.js";
4
4
  import {
5
5
  openCodeConfigDirFrom
6
- } from "./chunk-W6FZOPF4.js";
6
+ } from "./chunk-V6MQUYE2.js";
7
7
  import {
8
8
  nativeClaudeInstallPath
9
9
  } from "./chunk-TCE3J44Z.js";
10
10
  import {
11
11
  grokHome
12
- } from "./chunk-DLJ4ZGPG.js";
12
+ } from "./chunk-HZ76NLD2.js";
13
13
  import {
14
14
  claudeConfigDir,
15
15
  clineDataDirectory,
16
16
  codexHomeFrom,
17
17
  openClawEnvironmentOf,
18
18
  openClawPathsFrom
19
- } from "./chunk-4EGBDV3T.js";
19
+ } from "./chunk-AURPPDRZ.js";
20
20
  import {
21
21
  HOOK_COMPATIBLE_PROFILES
22
- } from "./chunk-DC32YKE2.js";
22
+ } from "./chunk-VZVKJP3Q.js";
23
23
 
24
24
  // src/vscode-config.ts
25
25
  import { homedir } from "os";
@@ -2,7 +2,7 @@ import {
2
2
  localRepoKey,
3
3
  normalizeRepoRemote,
4
4
  parseGitBranch
5
- } from "./chunk-DC32YKE2.js";
5
+ } from "./chunk-VZVKJP3Q.js";
6
6
 
7
7
  // src/repo.ts
8
8
  import { existsSync, readFileSync, statSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isFinalCommandAckRefusal
3
- } from "./chunk-DC32YKE2.js";
3
+ } from "./chunk-VZVKJP3Q.js";
4
4
 
5
5
  // src/command-ack-outcome.ts
6
6
  var SETTLED_ACK = { outcome: "settled" };
@@ -1,35 +1,35 @@
1
1
  import {
2
2
  MANAGED_CLAUDE_SETTINGS_BY_PLATFORM
3
- } from "./chunk-QYQMIAYH.js";
3
+ } from "./chunk-23ELMB2F.js";
4
4
  import {
5
5
  declinedAgentsFile,
6
6
  readDeclinedAgents
7
- } from "./chunk-SBY4JFPZ.js";
7
+ } from "./chunk-WYYHSHBO.js";
8
8
  import {
9
9
  OPENCODE_HOOK_BINARY,
10
10
  openCodeConfigDir,
11
11
  openCodePluginFile
12
- } from "./chunk-W6FZOPF4.js";
12
+ } from "./chunk-V6MQUYE2.js";
13
13
  import {
14
14
  openCodePluginArgv
15
- } from "./chunk-ATGFCOLG.js";
15
+ } from "./chunk-IMSFJFN6.js";
16
16
  import {
17
17
  liveCursorGateCoverage
18
- } from "./chunk-DDRT2WJA.js";
18
+ } from "./chunk-QWSXLYTX.js";
19
19
  import {
20
20
  compatibleConfigFile,
21
21
  compatibleHookEvents,
22
22
  grokHome
23
- } from "./chunk-DLJ4ZGPG.js";
23
+ } from "./chunk-HZ76NLD2.js";
24
24
  import {
25
25
  parseConfigDocument
26
- } from "./chunk-Z43TNC27.js";
26
+ } from "./chunk-RA4RSVVJ.js";
27
27
  import {
28
28
  DEFAULT_HOOKS_KEY_PATH,
29
29
  GEMINI_HOOK_BINARY,
30
30
  GEMINI_HOOK_EVENTS,
31
31
  hooksAt
32
- } from "./chunk-2G3DG3NV.js";
32
+ } from "./chunk-5K5MT22J.js";
33
33
  import {
34
34
  CODEX_EARLIER_APPROVAL_MATCHERS,
35
35
  CODEX_HOOK_BINARY,
@@ -57,7 +57,7 @@ import {
57
57
  parseHookArgv,
58
58
  parseHookCommand,
59
59
  supportedClaudeEvents
60
- } from "./chunk-4EGBDV3T.js";
60
+ } from "./chunk-AURPPDRZ.js";
61
61
  import {
62
62
  readRegularJsonFile,
63
63
  readRegularTextFile
@@ -71,7 +71,7 @@ import {
71
71
  OPENCODE_APPROVAL_EVENT,
72
72
  isRecord,
73
73
  matcherMatchesEveryCall
74
- } from "./chunk-DC32YKE2.js";
74
+ } from "./chunk-VZVKJP3Q.js";
75
75
 
76
76
  // src/hook-wiring.ts
77
77
  import { createHash } from "crypto";
@@ -4,16 +4,16 @@ import {
4
4
  } from "./chunk-WHB622LP.js";
5
5
  import {
6
6
  keyPrefix
7
- } from "./chunk-S5GQCO2I.js";
7
+ } from "./chunk-K5ZEJCJO.js";
8
8
  import {
9
9
  keyPrefixToShow
10
- } from "./chunk-XGF3JB3R.js";
10
+ } from "./chunk-WV7OME3F.js";
11
11
  import {
12
12
  NPX_LATEST_COMMAND
13
- } from "./chunk-7BJQM5GI.js";
13
+ } from "./chunk-APTFA4KF.js";
14
14
  import {
15
15
  isValidApiKey
16
- } from "./chunk-DC32YKE2.js";
16
+ } from "./chunk-VZVKJP3Q.js";
17
17
 
18
18
  // src/setup/key-account.ts
19
19
  var isKeyHeldByMacApp = (key, holder) => holder.macAppInstalled && holder.macAppKey === key;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  projectNameFor
3
- } from "./chunk-LDXGL2QH.js";
3
+ } from "./chunk-EVJ5DPRU.js";
4
4
  import {
5
5
  readConfigFileKey
6
- } from "./chunk-S5GQCO2I.js";
6
+ } from "./chunk-K5ZEJCJO.js";
7
7
 
8
8
  // src/bell/fleet.ts
9
9
  import { closeSync, constants, futimesSync, lstatSync, mkdirSync, openSync, readdirSync, unlinkSync } from "fs";