@pushary/agent-hooks 1.9.72 → 1.9.73

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 (124) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/{api-K4UGZNOE.js → api-JVWXPKEW.js} +10 -10
  3. package/dist/bin/pushary-bell-hook.js +25 -25
  4. package/dist/bin/pushary-bell.js +10 -10
  5. package/dist/bin/pushary-claude.js +26 -26
  6. package/dist/bin/pushary-clean.js +33 -33
  7. package/dist/bin/pushary-codex-bridge.js +21 -21
  8. package/dist/bin/pushary-codex-hook.js +30 -30
  9. package/dist/bin/pushary-codex-session.js +8 -8
  10. package/dist/bin/pushary-codex.js +13 -13
  11. package/dist/bin/pushary-connect.js +26 -26
  12. package/dist/bin/pushary-cowork.js +5 -5
  13. package/dist/bin/pushary-daemon.js +38 -38
  14. package/dist/bin/pushary-disconnect.js +25 -25
  15. package/dist/bin/pushary-doctor.js +41 -41
  16. package/dist/bin/pushary-elicitation-hook.js +25 -25
  17. package/dist/bin/pushary-gemini-bridge.js +15 -15
  18. package/dist/bin/pushary-gemini-hook.js +27 -27
  19. package/dist/bin/pushary-hook.js +29 -29
  20. package/dist/bin/pushary-login.js +20 -20
  21. package/dist/bin/pushary-logout.js +24 -24
  22. package/dist/bin/pushary-mcp.js +11 -11
  23. package/dist/bin/pushary-mode.js +15 -15
  24. package/dist/bin/pushary-notification-hook.js +24 -24
  25. package/dist/bin/pushary-opencode-hook.js +26 -26
  26. package/dist/bin/pushary-permission-denied-hook.js +29 -29
  27. package/dist/bin/pushary-permission-hook.js +29 -29
  28. package/dist/bin/pushary-post-hook.js +24 -24
  29. package/dist/bin/pushary-prompt-hook.js +24 -24
  30. package/dist/bin/pushary-session-end-hook.js +26 -26
  31. package/dist/bin/pushary-session-start-hook.js +34 -34
  32. package/dist/bin/pushary-setup.js +45 -45
  33. package/dist/bin/pushary-stats.js +5 -5
  34. package/dist/bin/pushary-status.js +31 -31
  35. package/dist/bin/pushary-stop-hook.js +24 -24
  36. package/dist/bin/pushary-stopfailure-hook.js +24 -24
  37. package/dist/bin/pushary-suggestions.js +15 -15
  38. package/dist/bin/pushary-transcript-register.js +16 -16
  39. package/dist/bin/pushary-transcripts.js +18 -18
  40. package/dist/bin/pushary-upgrade.js +39 -39
  41. package/dist/bin/pushary-wait.js +15 -15
  42. package/dist/bin/pushary.js +7 -7
  43. package/dist/{chunk-SMVTNLXU.js → chunk-2HFC4W6J.js} +1 -1
  44. package/dist/{chunk-OFTTOPTD.js → chunk-2JFEMKDG.js} +6 -6
  45. package/dist/{chunk-PZV27E4J.js → chunk-2NG3ANMT.js} +6 -6
  46. package/dist/{chunk-RRW2LVVR.js → chunk-2QB7HJVJ.js} +2 -2
  47. package/dist/{chunk-KYEZFN6K.js → chunk-3JJI5O5N.js} +1 -1
  48. package/dist/{chunk-LT2DOCFI.js → chunk-3QBKMSOZ.js} +1 -1
  49. package/dist/{chunk-37OD7FUI.js → chunk-3RAWW5DH.js} +6 -6
  50. package/dist/{chunk-4U7F7VMC.js → chunk-4LAD5A2Q.js} +4 -4
  51. package/dist/{chunk-2KDTIUC7.js → chunk-4UIR25GA.js} +1 -1
  52. package/dist/{chunk-4W7CKRWR.js → chunk-56GK65Z6.js} +3 -3
  53. package/dist/{chunk-ZWCKS65X.js → chunk-7FROPPIH.js} +2 -2
  54. package/dist/{chunk-E56VJY23.js → chunk-7M4AA7QF.js} +4 -4
  55. package/dist/{chunk-XGGAZJWJ.js → chunk-7RX5TOU3.js} +6 -6
  56. package/dist/{chunk-N4NSX5MB.js → chunk-7S46LCKD.js} +2 -2
  57. package/dist/{chunk-RO5G3OEN.js → chunk-AC5TVOAH.js} +9 -9
  58. package/dist/{chunk-EEFFP64A.js → chunk-AJWGZJFS.js} +119 -33
  59. package/dist/{chunk-5XKJH5GD.js → chunk-AVHL2ZTS.js} +49 -3
  60. package/dist/{chunk-4Y7EI5W5.js → chunk-AXZ67XVN.js} +1 -1
  61. package/dist/{chunk-TM4JH7YR.js → chunk-BLX6KRK5.js} +1 -1
  62. package/dist/{chunk-UTVNXB6U.js → chunk-CGWUVEOB.js} +3 -3
  63. package/dist/{chunk-DU7L7R4A.js → chunk-CMYFV3VC.js} +5 -5
  64. package/dist/{chunk-L3S2ZTQZ.js → chunk-DT6VCMXS.js} +2 -2
  65. package/dist/{chunk-EEQG7VF2.js → chunk-EITOMPFB.js} +4 -4
  66. package/dist/{chunk-R4B5AVFC.js → chunk-EUEGCEA7.js} +3 -3
  67. package/dist/{chunk-OGGUOTIK.js → chunk-EUHTC7K5.js} +1 -1
  68. package/dist/{chunk-EPARIXRC.js → chunk-F3WI32HG.js} +7 -7
  69. package/dist/{chunk-MWR25RQZ.js → chunk-FAKEKFCI.js} +3 -3
  70. package/dist/{chunk-SAXNYDPS.js → chunk-FB262EOM.js} +1 -1
  71. package/dist/{chunk-XHVHGDMB.js → chunk-FK3JSDH5.js} +13 -13
  72. package/dist/{chunk-5KS3E3T5.js → chunk-GBR6E7AY.js} +1 -1
  73. package/dist/{chunk-3S5X7VZJ.js → chunk-IN3MPEFA.js} +5 -5
  74. package/dist/{chunk-CAUNUTYE.js → chunk-JC7XUZST.js} +6 -3
  75. package/dist/{chunk-5KQN7AIL.js → chunk-JNTYPMVU.js} +10 -10
  76. package/dist/{chunk-2BVLEMGX.js → chunk-JWBZUTYF.js} +5 -5
  77. package/dist/{chunk-S6BD346V.js → chunk-JYOR57ZW.js} +3 -3
  78. package/dist/{chunk-N7A44RIA.js → chunk-KDQLKND5.js} +6 -6
  79. package/dist/{chunk-CR3HOHJC.js → chunk-KSLBS3II.js} +5 -5
  80. package/dist/{chunk-RXR44U2J.js → chunk-N4VRSFRZ.js} +5 -5
  81. package/dist/{chunk-6YZ72YP3.js → chunk-NGNBX3YH.js} +4 -4
  82. package/dist/{chunk-D6COE26P.js → chunk-NJSW2REO.js} +4 -4
  83. package/dist/{chunk-IBHZ3JFE.js → chunk-O4EAMVSC.js} +3 -3
  84. package/dist/{chunk-NVM4S37G.js → chunk-OJ3ZD5VX.js} +1 -1
  85. package/dist/{chunk-GNDPZBG3.js → chunk-PGJMSREY.js} +6 -6
  86. package/dist/{chunk-VFF7TP5B.js → chunk-PM2MHBMF.js} +3 -3
  87. package/dist/{chunk-YDSOTAZ6.js → chunk-PNXNWZ5P.js} +3 -3
  88. package/dist/{chunk-7KMLITXH.js → chunk-PPKIL4EL.js} +1 -1
  89. package/dist/{chunk-LCBZLTHW.js → chunk-QAWWTRDD.js} +4 -4
  90. package/dist/{chunk-ILWEGI4H.js → chunk-QMPM3CAN.js} +1 -1
  91. package/dist/{chunk-BMVWGPYB.js → chunk-R5PZPROX.js} +1 -1
  92. package/dist/{chunk-GUJBS6TK.js → chunk-RZVWEDIS.js} +3 -3
  93. package/dist/{chunk-VZG76CWC.js → chunk-S63VIM7E.js} +1 -1
  94. package/dist/{chunk-4TRA3GDE.js → chunk-S7VMHSJW.js} +3 -3
  95. package/dist/{chunk-LKXOSW2L.js → chunk-SQ5XCMPB.js} +4 -4
  96. package/dist/{chunk-LFBQ55OO.js → chunk-TFDMJHAB.js} +1 -1
  97. package/dist/{chunk-QFF3QVIV.js → chunk-TQ2L3ECX.js} +2 -2
  98. package/dist/{chunk-L6F62LKX.js → chunk-TTGBS5JB.js} +3 -3
  99. package/dist/{chunk-EW7CZHYP.js → chunk-U3EBM73X.js} +2 -2
  100. package/dist/{chunk-KFGRDWAW.js → chunk-UIF7HWHX.js} +4 -4
  101. package/dist/{chunk-5XYYBB5Z.js → chunk-UUCRWEEU.js} +2 -2
  102. package/dist/{chunk-LISVMDVS.js → chunk-VBSPP4QY.js} +3 -3
  103. package/dist/{chunk-WHM3OVBA.js → chunk-VJUDBZGC.js} +2 -2
  104. package/dist/{chunk-PWVQALO2.js → chunk-W47XZJSH.js} +2 -2
  105. package/dist/{chunk-QDISUNK3.js → chunk-WJJVCDEU.js} +6 -6
  106. package/dist/{chunk-PIO66HPG.js → chunk-WXV7J3DG.js} +3 -3
  107. package/dist/{chunk-6HTAOF6H.js → chunk-XKQ7CQGG.js} +1 -1
  108. package/dist/{chunk-DNCEZWRC.js → chunk-YZ6DMGZZ.js} +1 -1
  109. package/dist/{chunk-HIHA3GOR.js → chunk-Z7AIYWZ2.js} +2 -2
  110. package/dist/{chunk-QQ7VXRIN.js → chunk-ZBZBYUNZ.js} +5 -5
  111. package/dist/{codex-app-cards-switch-PWLWIWKG.js → codex-app-cards-switch-M7VH7AZH.js} +11 -11
  112. package/dist/{codex-desktop-launch-S3PDGLAY.js → codex-desktop-launch-6DASTBBA.js} +1 -1
  113. package/dist/{codex-session-launch-PY5IMFJU.js → codex-session-launch-2XSMFA4K.js} +18 -18
  114. package/dist/{config-SWV4YOP3.js → config-7QQOIFTW.js} +3 -3
  115. package/dist/{global-upgrade-DI3LGOQP.js → global-upgrade-XAKX26AN.js} +10 -10
  116. package/dist/{identity-AY35DGAO.js → identity-7AS5MBNM.js} +4 -4
  117. package/dist/{live-capabilities-IH3EGKL3.js → live-capabilities-DV4F7MIB.js} +5 -5
  118. package/dist/{paths-I4Q77ULZ.js → paths-GSMXYKT5.js} +3 -3
  119. package/dist/{reapply-OAV4IAG3.js → reapply-MR7UWBXR.js} +27 -27
  120. package/dist/src/index.d.ts +2 -6
  121. package/dist/src/index.js +28 -28
  122. package/dist/{upgrade-lock-7U5BOK6V.js → upgrade-lock-6OTHLCBZ.js} +4 -4
  123. package/dist/{usage-NTER4GHT.js → usage-H53PO3VQ.js} +3 -3
  124. package/package.json +2 -1
@@ -4,10 +4,10 @@ import {
4
4
  keyPrefix,
5
5
  readConfigFileKey,
6
6
  readMacAppKeyPrefix
7
- } from "./chunk-6YZ72YP3.js";
7
+ } from "./chunk-NGNBX3YH.js";
8
8
  import {
9
9
  NPX_LATEST_COMMAND
10
- } from "./chunk-7KMLITXH.js";
10
+ } from "./chunk-PPKIL4EL.js";
11
11
 
12
12
  // src/key-signed-out.ts
13
13
  var VERDICT_BY_CHECK = {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSafeReadOnlyCommand
3
- } from "./chunk-5XKJH5GD.js";
3
+ } from "./chunk-AVHL2ZTS.js";
4
4
 
5
5
  // src/ledger.ts
6
6
  import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync } from "fs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  HOOK_HOLD_BUDGET_ENV,
3
3
  hookHoldBudgetProof
4
- } from "./chunk-5XKJH5GD.js";
4
+ } from "./chunk-AVHL2ZTS.js";
5
5
 
6
6
  // src/hold-budget.ts
7
7
  var takeHookHoldBudget = (args = process.argv.slice(2), env = process.env) => {
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  compatibleConfigFile
3
- } from "./chunk-KFGRDWAW.js";
3
+ } from "./chunk-UIF7HWHX.js";
4
4
  import {
5
5
  hookOwnerOf,
6
6
  hookOwnerOfCommands,
7
7
  liveBridgeProbe,
8
8
  resolveBridgeStub
9
- } from "./chunk-LCBZLTHW.js";
9
+ } from "./chunk-QAWWTRDD.js";
10
10
  import {
11
11
  AGENT_CHOICES
12
- } from "./chunk-SMVTNLXU.js";
12
+ } from "./chunk-2HFC4W6J.js";
13
13
  import {
14
14
  claudeSettings,
15
15
  codexHooksJson,
@@ -18,10 +18,10 @@ import {
18
18
  guardedArgv,
19
19
  pusharyDir,
20
20
  vscodePluginDir
21
- } from "./chunk-N4NSX5MB.js";
21
+ } from "./chunk-7S46LCKD.js";
22
22
  import {
23
23
  readJsonSafe
24
- } from "./chunk-GUJBS6TK.js";
24
+ } from "./chunk-RZVWEDIS.js";
25
25
  import {
26
26
  HOOK_BUDGETS,
27
27
  HOOK_COMPATIBLE_PROFILES,
@@ -29,7 +29,7 @@ import {
29
29
  OPENCODE_APPROVAL_EVENT,
30
30
  hookCompatibleProfile,
31
31
  isRecord
32
- } from "./chunk-5XKJH5GD.js";
32
+ } from "./chunk-AVHL2ZTS.js";
33
33
 
34
34
  // src/opencode-plugin.ts
35
35
  var OPENCODE_PLUGIN_MARKER = "pushary-opencode-plugin w1";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  compatibleConfigFile,
3
3
  hasCompatibleHooks
4
- } from "./chunk-KFGRDWAW.js";
4
+ } from "./chunk-UIF7HWHX.js";
5
5
  import {
6
6
  pusharyHookExecutable
7
- } from "./chunk-LCBZLTHW.js";
7
+ } from "./chunk-QAWWTRDD.js";
8
8
  import {
9
9
  isProtectedByScope,
10
10
  registerHookEntry
11
- } from "./chunk-N4NSX5MB.js";
11
+ } from "./chunk-7S46LCKD.js";
12
12
  import {
13
13
  isRecord
14
- } from "./chunk-5XKJH5GD.js";
14
+ } from "./chunk-AVHL2ZTS.js";
15
15
 
16
16
  // src/cursor-config.ts
17
17
  var hookCommandOf = (entry) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readConfigFileKey
3
- } from "./chunk-6YZ72YP3.js";
3
+ } from "./chunk-NGNBX3YH.js";
4
4
 
5
5
  // src/bell/fleet.ts
6
6
  import { closeSync, constants, futimesSync, lstatSync, mkdirSync, openSync, readdirSync, unlinkSync } from "fs";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-N4NSX5MB.js";
3
+ } from "./chunk-7S46LCKD.js";
4
4
  import {
5
5
  readJsonSafe,
6
6
  writeFileAtomic
7
- } from "./chunk-GUJBS6TK.js";
7
+ } from "./chunk-RZVWEDIS.js";
8
8
  import {
9
9
  DECLINED_AGENTS_FILE,
10
10
  DISCONNECT_AGENT_IDS,
@@ -13,7 +13,7 @@ import {
13
13
  serializeDeclinedAgents,
14
14
  withDeclinedAgent,
15
15
  withoutDeclinedAgent
16
- } from "./chunk-5XKJH5GD.js";
16
+ } from "./chunk-AVHL2ZTS.js";
17
17
 
18
18
  // src/declined-agents-file.ts
19
19
  import { join } from "path";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  configFilePath
3
- } from "./chunk-BMVWGPYB.js";
3
+ } from "./chunk-R5PZPROX.js";
4
4
  import {
5
5
  normalizeInstallSource
6
- } from "./chunk-5XKJH5GD.js";
6
+ } from "./chunk-AVHL2ZTS.js";
7
7
 
8
8
  // src/install-source.ts
9
9
  import { readFileSync } from "fs";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  keyCheckFromResponse
3
- } from "./chunk-4TRA3GDE.js";
3
+ } from "./chunk-S7VMHSJW.js";
4
4
  import {
5
5
  installNetworkDefaults
6
- } from "./chunk-IBHZ3JFE.js";
6
+ } from "./chunk-O4EAMVSC.js";
7
7
  import {
8
8
  getBaseUrl
9
- } from "./chunk-BMVWGPYB.js";
9
+ } from "./chunk-R5PZPROX.js";
10
10
  import {
11
11
  isRecord,
12
12
  isToolErrorResult,
13
13
  toolFailureCodeOfResult
14
- } from "./chunk-5XKJH5GD.js";
14
+ } from "./chunk-AVHL2ZTS.js";
15
15
 
16
16
  // src/retry.ts
17
17
  var isRetryable = (err) => {
@@ -1,24 +1,24 @@
1
1
  import {
2
2
  APPROVAL_RULES_PATH,
3
3
  canChangeApprovalSettings
4
- } from "./chunk-QFF3QVIV.js";
4
+ } from "./chunk-TQ2L3ECX.js";
5
5
  import {
6
6
  callMcpTool
7
- } from "./chunk-E56VJY23.js";
7
+ } from "./chunk-7M4AA7QF.js";
8
8
  import {
9
9
  absoluteUrl
10
- } from "./chunk-4TRA3GDE.js";
10
+ } from "./chunk-S7VMHSJW.js";
11
11
  import {
12
12
  getBaseUrl
13
- } from "./chunk-BMVWGPYB.js";
13
+ } from "./chunk-R5PZPROX.js";
14
14
  import {
15
15
  NPX_LATEST_COMMAND
16
- } from "./chunk-7KMLITXH.js";
16
+ } from "./chunk-PPKIL4EL.js";
17
17
  import {
18
18
  APPROVAL_MODE_META,
19
19
  classifyConfirmResponse,
20
20
  isAnswerSource
21
- } from "./chunk-5XKJH5GD.js";
21
+ } from "./chunk-AVHL2ZTS.js";
22
22
 
23
23
  // src/reach.ts
24
24
  var reachVerdict = (channels) => {
@@ -4,7 +4,7 @@ import {
4
4
  quoteIfNeeded,
5
5
  shellDoubleQuoted,
6
6
  writeFileAtomic
7
- } from "./chunk-GUJBS6TK.js";
7
+ } from "./chunk-RZVWEDIS.js";
8
8
  import {
9
9
  CLAUDE_PRETOOLUSE_MATCHER,
10
10
  CODEX_QUESTION_TOOLS,
@@ -12,7 +12,7 @@ import {
12
12
  HOOK_LOCATOR_BINARY,
13
13
  PRETOOLUSE_GATED_TOOLS,
14
14
  withHookHoldBudget
15
- } from "./chunk-5XKJH5GD.js";
15
+ } from "./chunk-AVHL2ZTS.js";
16
16
 
17
17
  // src/setup/paths.ts
18
18
  import { createHash as createHash2 } from "crypto";
@@ -3,13 +3,13 @@ import {
3
3
  loadPin,
4
4
  savePin,
5
5
  verifyRecipients
6
- } from "./chunk-SAXNYDPS.js";
6
+ } from "./chunk-FB262EOM.js";
7
7
  import {
8
8
  ensureDaemonRunning
9
- } from "./chunk-QDISUNK3.js";
9
+ } from "./chunk-WJJVCDEU.js";
10
10
  import {
11
11
  hookOwnerOf
12
- } from "./chunk-LCBZLTHW.js";
12
+ } from "./chunk-QAWWTRDD.js";
13
13
  import {
14
14
  buildTranscriptRecords,
15
15
  decodePublicKey,
@@ -18,26 +18,26 @@ import {
18
18
  recordSealerFor,
19
19
  uploadTranscriptRecords,
20
20
  wrapSessionKey
21
- } from "./chunk-CAUNUTYE.js";
21
+ } from "./chunk-JC7XUZST.js";
22
22
  import {
23
23
  transcriptEnvironmentPreference,
24
24
  transcriptsEnabled
25
- } from "./chunk-VZG76CWC.js";
25
+ } from "./chunk-S63VIM7E.js";
26
26
  import {
27
27
  readTranscriptPreference
28
- } from "./chunk-6YZ72YP3.js";
28
+ } from "./chunk-NGNBX3YH.js";
29
29
  import {
30
30
  claudeConfigDir,
31
31
  codexHome,
32
32
  pusharyDir
33
- } from "./chunk-N4NSX5MB.js";
33
+ } from "./chunk-7S46LCKD.js";
34
34
  import {
35
35
  writeJsonAtomic
36
- } from "./chunk-GUJBS6TK.js";
36
+ } from "./chunk-RZVWEDIS.js";
37
37
  import {
38
38
  getApiKey,
39
39
  getBaseUrl
40
- } from "./chunk-BMVWGPYB.js";
40
+ } from "./chunk-R5PZPROX.js";
41
41
 
42
42
  // src/transcript-registration.ts
43
43
  import { createHash } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  repoKeyFor
3
- } from "./chunk-ILWEGI4H.js";
3
+ } from "./chunk-QMPM3CAN.js";
4
4
  import {
5
5
  cancelQuestion,
6
6
  clientErrorKindOf,
@@ -8,29 +8,32 @@ import {
8
8
  reportClientError,
9
9
  sendNotification,
10
10
  waitForAnswer
11
- } from "./chunk-DU7L7R4A.js";
11
+ } from "./chunk-CMYFV3VC.js";
12
12
  import {
13
13
  withRetry
14
- } from "./chunk-E56VJY23.js";
14
+ } from "./chunk-7M4AA7QF.js";
15
15
  import {
16
16
  getMachineId
17
- } from "./chunk-5XYYBB5Z.js";
17
+ } from "./chunk-UUCRWEEU.js";
18
18
  import {
19
19
  reportedInstallSource
20
- } from "./chunk-ZWCKS65X.js";
20
+ } from "./chunk-7FROPPIH.js";
21
21
  import {
22
22
  IDLE_PROMPT_NOTIFICATION,
23
23
  NOTIFICATION_PUSH_TYPES,
24
24
  POSTTOOLUSE_MIRROR_ONLY_TOOLS,
25
- canonicalJson
26
- } from "./chunk-N4NSX5MB.js";
25
+ canonicalJson,
26
+ claudeConfigDir
27
+ } from "./chunk-7S46LCKD.js";
27
28
  import {
29
+ compareVersion,
30
+ parseVersion,
28
31
  writeFileAtomic
29
- } from "./chunk-GUJBS6TK.js";
32
+ } from "./chunk-RZVWEDIS.js";
30
33
  import {
31
34
  getApiKey,
32
35
  getBaseUrl
33
- } from "./chunk-BMVWGPYB.js";
36
+ } from "./chunk-R5PZPROX.js";
34
37
  import {
35
38
  ACTION_BODY_MAX,
36
39
  AGENTS,
@@ -43,20 +46,23 @@ import {
43
46
  GATE_MAX_TOOL_INPUTS,
44
47
  HOOK_COMPATIBLE_PROFILES,
45
48
  HOOK_SOURCES,
46
- PENDING_COMMAND_PREFIX,
47
49
  REPO_AWARE_AGENTS,
48
50
  TASK_OUTPUT_TOOL,
49
51
  TASK_STOP_TOOL,
50
52
  blockedActionIdentity,
53
+ canCarryPendingCommand,
51
54
  canonicalToolName,
55
+ claudeTurnEndOutput,
52
56
  conversationText,
53
57
  gateOutputFor,
54
58
  hookCompatibleProfileBySource,
55
59
  isAutoApprove,
60
+ isRecord,
56
61
  isTokenCount,
57
62
  modeStateFromResponse,
58
63
  parseMcpToolName,
59
64
  pendingCommandEvents,
65
+ pendingCommandInstruction,
60
66
  questionLimitHandBack,
61
67
  redactSecrets,
62
68
  redactSecretsDeep,
@@ -66,7 +72,7 @@ import {
66
72
  toToolLookup,
67
73
  truncateLine,
68
74
  unansweredRefusalReason
69
- } from "./chunk-5XKJH5GD.js";
75
+ } from "./chunk-AVHL2ZTS.js";
70
76
 
71
77
  // ../hook-mapping/src/describe.ts
72
78
  import { isAbsolute, relative, resolve } from "path";
@@ -1582,14 +1588,78 @@ var forgetBlockedActionHint = (fingerprint) => {
1582
1588
  }
1583
1589
  };
1584
1590
 
1591
+ // src/claude-session-record.ts
1592
+ import { readFileSync as readFileSync6, readdirSync as readdirSync4, statSync as statSync6 } from "fs";
1593
+ import { join as join7 } from "path";
1594
+ var UNREADABLE = { kind: "unreadable" };
1595
+ var OTHER_SESSION = { kind: "other_session" };
1596
+ var PROCESS_ID = /^[1-9]\d*$/;
1597
+ var SESSION_FILE_SUFFIX = ".json";
1598
+ var SESSION_FILE_MAX_BYTES = 64 * 1024;
1599
+ var isRunning = (pid) => {
1600
+ try {
1601
+ process.kill(pid, 0);
1602
+ return true;
1603
+ } catch (error) {
1604
+ return error instanceof Error && "code" in error && error.code === "EPERM";
1605
+ }
1606
+ };
1607
+ var isSmallRegularFile = (path) => {
1608
+ try {
1609
+ const stats = statSync6(path);
1610
+ return stats.isFile() && stats.size <= SESSION_FILE_MAX_BYTES;
1611
+ } catch {
1612
+ return false;
1613
+ }
1614
+ };
1615
+ var readSessionFile = (path, sessionId) => {
1616
+ if (!isSmallRegularFile(path)) return UNREADABLE;
1617
+ try {
1618
+ const parsed = JSON.parse(readFileSync6(path, "utf-8"));
1619
+ if (!isRecord(parsed) || typeof parsed.sessionId !== "string") return UNREADABLE;
1620
+ if (parsed.sessionId !== sessionId) return OTHER_SESSION;
1621
+ return { kind: "this_session", version: typeof parsed.version === "string" ? parsed.version : null };
1622
+ } catch {
1623
+ return UNREADABLE;
1624
+ }
1625
+ };
1626
+ var runningSessionFiles = (sessions) => {
1627
+ try {
1628
+ return readdirSync4(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}`));
1629
+ } catch {
1630
+ return [];
1631
+ }
1632
+ };
1633
+ var parsedSessionVersion = (version) => {
1634
+ const release = version === null ? null : parseVersion(version);
1635
+ return version === null || release === null ? null : { version, release };
1636
+ };
1637
+ var isParsed = (entry) => entry !== null;
1638
+ var lowerVersion = (lowest, entry) => compareVersion(entry.release, lowest.release) < 0 ? entry : lowest;
1639
+ var oldestVersionAcross = (readings) => {
1640
+ if (readings.some((reading) => reading.kind === "unreadable")) return null;
1641
+ const parsed = readings.flatMap((reading) => reading.kind === "this_session" ? [reading.version] : []).map(parsedSessionVersion);
1642
+ if (parsed.length === 0 || !parsed.every(isParsed)) return null;
1643
+ return parsed.filter(isParsed).reduce(lowerVersion).version;
1644
+ };
1645
+ var claudeSessionVersion = (sessionId, environment = process.env) => {
1646
+ if (!sessionId) return null;
1647
+ try {
1648
+ const sessions = join7(claudeConfigDir(void 0, environment), "sessions");
1649
+ return oldestVersionAcross(runningSessionFiles(sessions).map((path) => readSessionFile(path, sessionId)));
1650
+ } catch {
1651
+ return null;
1652
+ }
1653
+ };
1654
+
1585
1655
  // src/background-work.ts
1586
1656
  import { createHash as createHash7 } from "crypto";
1587
- import { mkdirSync as mkdirSync6, rmSync as rmSync5, statSync as statSync6, writeFileSync as writeFileSync6 } from "fs";
1657
+ import { mkdirSync as mkdirSync6, rmSync as rmSync5, statSync as statSync7, writeFileSync as writeFileSync6 } from "fs";
1588
1658
  import { tmpdir as tmpdir7 } from "os";
1589
- import { join as join7 } from "path";
1659
+ import { join as join8 } from "path";
1590
1660
  var BACKGROUND_WORK_TTL_MS = 60 * 60 * 1e3;
1591
- var backgroundWorkDir = () => join7(tmpdir7(), "pushary-background-work");
1592
- var markerFor = (sessionKey) => join7(backgroundWorkDir(), createHash7("sha256").update(sessionKey).digest("hex"));
1661
+ var backgroundWorkDir = () => join8(tmpdir7(), "pushary-background-work");
1662
+ var markerFor = (sessionKey) => join8(backgroundWorkDir(), createHash7("sha256").update(sessionKey).digest("hex"));
1593
1663
  var hasRunningBackgroundTasks = (backgroundTasks) => Array.isArray(backgroundTasks) && backgroundTasks.length > 0;
1594
1664
  var noteBackgroundWork = (sessionKey, running) => {
1595
1665
  try {
@@ -1605,21 +1675,21 @@ var noteBackgroundWork = (sessionKey, running) => {
1605
1675
  };
1606
1676
  var isWaitingOnBackgroundWork = (sessionKey, nowMs = Date.now()) => {
1607
1677
  try {
1608
- return nowMs - statSync6(markerFor(sessionKey)).mtimeMs < BACKGROUND_WORK_TTL_MS;
1678
+ return nowMs - statSync7(markerFor(sessionKey)).mtimeMs < BACKGROUND_WORK_TTL_MS;
1609
1679
  } catch {
1610
1680
  return false;
1611
1681
  }
1612
1682
  };
1613
1683
 
1614
1684
  // src/events.ts
1615
- import { basename as basename2, join as join8 } from "path";
1616
- import { existsSync as existsSync6, mkdirSync as mkdirSync7, readFileSync as readFileSync6, statSync as statSync7, writeFileSync as writeFileSync7 } from "fs";
1685
+ import { basename as basename2, join as join9 } from "path";
1686
+ import { existsSync as existsSync6, mkdirSync as mkdirSync7, readFileSync as readFileSync7, statSync as statSync8, writeFileSync as writeFileSync7 } from "fs";
1617
1687
  import { tmpdir as tmpdir8 } from "os";
1618
- var INTENT_DIR = join8(tmpdir8(), "pushary-intent");
1688
+ var INTENT_DIR = join9(tmpdir8(), "pushary-intent");
1619
1689
  var INTENT_MAX_BYTES = 2048;
1620
1690
  var INTENT_GRACE_MS = 10 * 60 * 1e3;
1621
1691
  var sanitizeSession = (sessionId) => sessionId.replace(/[^A-Za-z0-9_-]/g, "_").slice(0, 128) || DEFAULT_SESSION;
1622
- var intentFile = (sessionId) => join8(INTENT_DIR, sanitizeSession(sessionId));
1692
+ var intentFile = (sessionId) => join9(INTENT_DIR, sanitizeSession(sessionId));
1623
1693
  var saveLastPrompt = (sessionId, prompt) => {
1624
1694
  try {
1625
1695
  const trimmed = prompt.replace(/\s+/g, " ").trim().slice(0, INTENT_MAX_BYTES);
@@ -1632,8 +1702,8 @@ var saveLastPrompt = (sessionId, prompt) => {
1632
1702
  var readLastPrompt = (sessionId) => {
1633
1703
  try {
1634
1704
  const path = intentFile(sessionId);
1635
- if (isDefaultSession(sessionId) && statSync7(path).mtimeMs < Date.now() - INTENT_GRACE_MS) return void 0;
1636
- const value = readFileSync6(path, "utf-8").trim();
1705
+ if (isDefaultSession(sessionId) && statSync8(path).mtimeMs < Date.now() - INTENT_GRACE_MS) return void 0;
1706
+ const value = readFileSync7(path, "utf-8").trim();
1637
1707
  return value.length > 0 ? value : void 0;
1638
1708
  } catch {
1639
1709
  return void 0;
@@ -1698,7 +1768,7 @@ var readFreshCachedPolicy = (apiKey, agentType, sessionId) => {
1698
1768
  const request = policyRequestFor(agentType);
1699
1769
  const path = policyCacheFile(apiKey, request.agent, request.repoAware);
1700
1770
  if (!existsSync6(path)) return null;
1701
- const cached = JSON.parse(readFileSync6(path, "utf-8"));
1771
+ const cached = JSON.parse(readFileSync7(path, "utf-8"));
1702
1772
  if (!isPolicyConfig(cached)) return null;
1703
1773
  if ((cached._sessionId ?? null) !== (sessionId ?? null)) return null;
1704
1774
  if (!cached._cachedAt || Date.now() - cached._cachedAt >= POLICY_CACHE_TTL_MS) return null;
@@ -1741,8 +1811,9 @@ var deriveAutoDecisionBeacon = (toolName, toolInput, liveMode, agentType, cwd, s
1741
1811
  };
1742
1812
  var AUTO_DECISION_WINDOW_MS = 15 * 60 * 1e3;
1743
1813
  var HOOK_ACTIVE_WINDOW_MS = 30 * 60 * 1e3;
1814
+ var hookSourceOfAgentType = (agentType) => HOOK_SOURCES.find((candidate) => AGENT_IDENTITIES[candidate].type === agentType);
1744
1815
  var deriveUsage = (payload, agent, event) => {
1745
- const source = HOOK_SOURCES.find((candidate) => AGENT_IDENTITIES[candidate].type === agent.type);
1816
+ const source = hookSourceOfAgentType(agent.type);
1746
1817
  const request = source ? transcriptUsageRequest({ source, event, payload, costTracking: process.env[COST_TRACKING_ENV] }) : null;
1747
1818
  if (!request) return void 0;
1748
1819
  try {
@@ -1751,16 +1822,19 @@ var deriveUsage = (payload, agent, event) => {
1751
1822
  return void 0;
1752
1823
  }
1753
1824
  };
1754
- var mergeAdditionalContext = (existing, reported) => {
1825
+ var pendingInstructionOf = (reported) => {
1755
1826
  const pendingCommand = reported.status === "fulfilled" ? reported.value?.pendingCommand : void 0;
1756
- if (typeof pendingCommand !== "string" || pendingCommand.trim().length === 0) return existing;
1757
- const injected = `${PENDING_COMMAND_PREFIX} ${pendingCommand.trim()}`;
1827
+ return typeof pendingCommand === "string" ? pendingCommandInstruction(pendingCommand) : void 0;
1828
+ };
1829
+ var mergeAdditionalContext = (existing, reported) => {
1830
+ const injected = pendingInstructionOf(reported);
1831
+ if (injected === void 0) return existing;
1758
1832
  return existing ? `${existing}
1759
1833
 
1760
1834
  ${injected}` : injected;
1761
1835
  };
1762
1836
  var consumesActivityContext = (agentType) => {
1763
- const source = HOOK_SOURCES.find((candidate) => AGENT_IDENTITIES[candidate].type === agentType);
1837
+ const source = hookSourceOfAgentType(agentType);
1764
1838
  if (!source) return false;
1765
1839
  return pendingCommandEvents(source).some((event) => event !== "Stop");
1766
1840
  };
@@ -1998,7 +2072,10 @@ var handleUserPrompt = async (input, agent = CLAUDE_CODE_AGENT) => {
1998
2072
  }
1999
2073
  };
2000
2074
  var UNUSED_APPROVAL_INSTRUCTION = "The person allowed, from Pushary, the call auto mode blocked. Send that call again now, exactly as it was with nothing changed, to use their approval. It covers only that exact call.";
2001
- var phoneInstructionOf = (pendingCommand) => typeof pendingCommand === "string" && pendingCommand.trim().length > 0 ? `The user sent a new instruction from their phone via Pushary: ${pendingCommand.trim()}` : null;
2075
+ var carriesInstructionAtTurnEnd = (agentType) => {
2076
+ const source = hookSourceOfAgentType(agentType);
2077
+ return source !== void 0 && canCarryPendingCommand(source, "Stop");
2078
+ };
2002
2079
  var handleStop = async (input, agent = CLAUDE_CODE_AGENT) => {
2003
2080
  const deadline = Date.now() + HOOK_BUDGET_MS;
2004
2081
  const signal = AbortSignal.timeout(HOOK_BUDGET_MS);
@@ -2007,6 +2084,7 @@ var handleStop = async (input, agent = CLAUDE_CODE_AGENT) => {
2007
2084
  const sessionKey = input.session_id || DEFAULT_SESSION;
2008
2085
  noteBackgroundWork(sessionKey, hasRunningBackgroundTasks(input.background_tasks));
2009
2086
  const late = await reconcilePendingQuestions(sessionKey, void 0, signal);
2087
+ const carriesInstruction = carriesInstructionAtTurnEnd(agent.type);
2010
2088
  const tasks = [
2011
2089
  reportEvent({
2012
2090
  event: "session_end",
@@ -2015,7 +2093,12 @@ var handleStop = async (input, agent = CLAUDE_CODE_AGENT) => {
2015
2093
  action: summarizeStop(input),
2016
2094
  ...sessionIdentityOf(input),
2017
2095
  usage: deriveUsage(input, agent, "Stop")
2018
- }, { maxAttempts: 1, budgetMs: Math.min(DRAINING_REPORT_BUDGET_MS, Math.max(0, deadline - Date.now())), signal })
2096
+ }, {
2097
+ maxAttempts: 1,
2098
+ budgetMs: Math.min(DRAINING_REPORT_BUDGET_MS, Math.max(0, deadline - Date.now())),
2099
+ signal,
2100
+ skipDrain: !carriesInstruction
2101
+ })
2019
2102
  ];
2020
2103
  if (late.length > 0) {
2021
2104
  tasks.push(notifyLateAnswers(getApiKey(), late, `${agent.label} - ${projectName}`, input.session_id, signal));
@@ -2023,10 +2106,13 @@ var handleStop = async (input, agent = CLAUDE_CODE_AGENT) => {
2023
2106
  }
2024
2107
  if (!isDefaultSession(sessionKey) && listPendingQuestions(sessionKey).length === 0) removePendingSession(sessionKey);
2025
2108
  const [reported] = await Promise.allSettled(tasks);
2026
- const pendingCommand = reported.status === "fulfilled" ? reported.value?.pendingCommand : void 0;
2027
2109
  const unusedApproval = !input.stop_hook_active && approvalAwaitingRetry(input.session_id) !== null;
2028
- const instructions = [unusedApproval ? UNUSED_APPROVAL_INSTRUCTION : null, phoneInstructionOf(pendingCommand)].filter((instruction) => instruction !== null);
2029
- return instructions.length > 0 ? { decision: "block", reason: instructions.join("\n\n") } : void 0;
2110
+ const instruction = carriesInstruction ? pendingInstructionOf(reported) : void 0;
2111
+ return claudeTurnEndOutput({
2112
+ instruction,
2113
+ continueReason: unusedApproval ? UNUSED_APPROVAL_INSTRUCTION : void 0,
2114
+ claudeVersion: instruction === void 0 ? null : claudeSessionVersion(input.session_id)
2115
+ });
2030
2116
  } catch {
2031
2117
  return void 0;
2032
2118
  }
@@ -2103,6 +2103,51 @@ var powerShellCommandHasAVisibleConsequence = (command, judge) => {
2103
2103
  return powerShellReadingIsDestructive(reading, judge) || stages.some((stage) => stageHasAVisibleConsequence(stage, judge)) || reading.statements.some(listsRecursivelyIntoARemoval) || runsFetchedPowerShellCode(stages, judge) || runsADownloadedFile(stages, judge) || reading.posixCommands.some((words) => judge.commandShowsAConsequence(words));
2104
2104
  };
2105
2105
 
2106
+ // ../contracts/src/release-version.ts
2107
+ var RELEASE_VERSION_PATTERN = /^(0|[1-9]\d{0,8})\.(0|[1-9]\d{0,8})\.(0|[1-9]\d{0,8})$/;
2108
+ var parseReleaseVersion = (version) => {
2109
+ const match = RELEASE_VERSION_PATTERN.exec(version);
2110
+ return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
2111
+ };
2112
+ var compareReleaseVersions = (left, right) => {
2113
+ for (let index = 0; index < left.length; index++) {
2114
+ if (left[index] !== right[index]) return left[index] < right[index] ? -1 : 1;
2115
+ }
2116
+ return 0;
2117
+ };
2118
+ var isReleaseBelow = (version, floor) => compareReleaseVersions(version, floor) < 0;
2119
+ var formatReleaseVersion = (version) => version.join(".");
2120
+
2121
+ // ../contracts/src/claude-turn-end.ts
2122
+ var STOP_CONTEXT_RELEASE = [2, 1, 163];
2123
+ var readsStopContext = (claudeVersion) => {
2124
+ const release = claudeVersion === null ? null : parseReleaseVersion(claudeVersion);
2125
+ return release !== null && !isReleaseBelow(release, STOP_CONTEXT_RELEASE);
2126
+ };
2127
+ var stopContext = (additionalContext) => ({
2128
+ hookEventName: "Stop",
2129
+ additionalContext
2130
+ });
2131
+ var instructionAtTurnEnd = (instruction, claudeVersion) => readsStopContext(claudeVersion) ? { hookSpecificOutput: stopContext(instruction) } : { decision: "block", reason: instruction };
2132
+ var claudeTurnEndOutput = ({
2133
+ instruction,
2134
+ continueReason,
2135
+ claudeVersion
2136
+ }) => {
2137
+ if (instruction === void 0) return continueReason === void 0 ? void 0 : { decision: "block", reason: continueReason };
2138
+ if (continueReason === void 0) return instructionAtTurnEnd(instruction, claudeVersion);
2139
+ return readsStopContext(claudeVersion) ? { decision: "block", reason: continueReason, hookSpecificOutput: stopContext(instruction) } : { decision: "block", reason: `${continueReason}
2140
+
2141
+ ${instruction}` };
2142
+ };
2143
+
2144
+ // ../contracts/src/pending-command.ts
2145
+ var PENDING_COMMAND_PREFIX = "The user sent a new instruction from their phone via Pushary:";
2146
+ var pendingCommandInstruction = (command) => {
2147
+ const instruction = command.trim();
2148
+ return instruction.length === 0 ? void 0 : `${PENDING_COMMAND_PREFIX} ${instruction}`;
2149
+ };
2150
+
2106
2151
  // ../contracts/src/command-analysis/sql-text.ts
2107
2152
  var UNCERTAIN_SQL = { kind: "uncertain" };
2108
2153
  var STRING_PLACEHOLDER = "''";
@@ -2900,7 +2945,6 @@ var withoutDeclinedAgent = (agents, agent) => agents.filter((candidate) => candi
2900
2945
  // ../contracts/src/cli-version-standing.ts
2901
2946
  var FIRST_AUTO_UPDATING_RELEASE = [1, 5, 0];
2902
2947
  var MIN_SAFE_RELEASE = [1, 9, 26];
2903
- var formatReleaseVersion = (version) => version.join(".");
2904
2948
  var FIRST_AUTO_UPDATING_CLI_VERSION = formatReleaseVersion(FIRST_AUTO_UPDATING_RELEASE);
2905
2949
  var MIN_SAFE_CLI_VERSION = formatReleaseVersion(MIN_SAFE_RELEASE);
2906
2950
 
@@ -6550,7 +6594,6 @@ var claudePreToolUseOutput = (decision, reason, updatedInput) => ({
6550
6594
  ...updatedInput ? { updatedInput } : {}
6551
6595
  }
6552
6596
  });
6553
- var PENDING_COMMAND_PREFIX = "The user sent a new instruction from their phone via Pushary:";
6554
6597
  var pendingCommandEvents = (source) => {
6555
6598
  switch (source) {
6556
6599
  case "claude":
@@ -6588,6 +6631,7 @@ var compatiblePendingCommandEvents = (source) => {
6588
6631
  if (!profile || profile.wire !== "permission_decision") return [];
6589
6632
  return COMPATIBLE_PENDING_COMMAND_EVENTS.filter((event) => profile.events.includes(event));
6590
6633
  };
6634
+ var canCarryPendingCommand = (source, event) => pendingCommandEvents(source).includes(event);
6591
6635
  var claudePermissionRequestOutput = (decision, reason, updatedInput) => ({
6592
6636
  hookSpecificOutput: {
6593
6637
  hookEventName: "PermissionRequest",
@@ -6863,6 +6907,8 @@ export {
6863
6907
  NO_CURSOR_GATE,
6864
6908
  toolsCoveredByGateEntry,
6865
6909
  cursorGateOwnsToolCall,
6910
+ claudeTurnEndOutput,
6911
+ pendingCommandInstruction,
6866
6912
  degradedLine,
6867
6913
  KEY_SCOPE,
6868
6914
  normalizeKeyScope,
@@ -6997,8 +7043,8 @@ export {
6997
7043
  claudePermissionDeniedOutput,
6998
7044
  codexStopRescueOutput,
6999
7045
  claudePreToolUseOutput,
7000
- PENDING_COMMAND_PREFIX,
7001
7046
  pendingCommandEvents,
7047
+ canCarryPendingCommand,
7002
7048
  claudePermissionRequestOutput,
7003
7049
  gateOutputFor,
7004
7050
  renderElicitationOutput,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_SESSION
3
- } from "./chunk-EEFFP64A.js";
3
+ } from "./chunk-AJWGZJFS.js";
4
4
 
5
5
  // src/answer.ts
6
6
  var isDeferAnswer = (value) => value === "defer";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  guardBinary
3
- } from "./chunk-N4NSX5MB.js";
3
+ } from "./chunk-7S46LCKD.js";
4
4
 
5
5
  // src/bell/install.ts
6
6
  import { join } from "path";