@pushary/agent-hooks 1.9.1 → 1.9.2

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 (105) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/data/cursor-plugin/.cursor-plugin/plugin.json +1 -1
  3. package/data/cursor-plugin/CHANGELOG.md +4 -0
  4. package/data/cursor-plugin/scripts/pushary-gate.mjs +1 -1
  5. package/data/vscode-plugin/.claude-plugin/plugin.json +1 -1
  6. package/data/vscode-plugin/CHANGELOG.md +4 -0
  7. package/data/vscode-plugin/scripts/pushary-gate.mjs +1 -1
  8. package/dist/bin/pushary-bell-hook.js +23 -23
  9. package/dist/bin/pushary-bell.js +9 -9
  10. package/dist/bin/pushary-claude.js +26 -26
  11. package/dist/bin/pushary-clean.js +28 -28
  12. package/dist/bin/pushary-codex-bridge.js +18 -18
  13. package/dist/bin/pushary-codex-hook.js +31 -31
  14. package/dist/bin/pushary-codex.js +13 -13
  15. package/dist/bin/pushary-connect.js +13 -13
  16. package/dist/bin/pushary-cowork.js +5 -5
  17. package/dist/bin/pushary-daemon.js +26 -26
  18. package/dist/bin/pushary-disconnect.js +18 -18
  19. package/dist/bin/pushary-doctor.js +99 -48
  20. package/dist/bin/pushary-elicitation-hook.js +25 -25
  21. package/dist/bin/pushary-gemini-bridge.js +13 -13
  22. package/dist/bin/pushary-gemini-hook.js +28 -28
  23. package/dist/bin/pushary-hook.js +32 -32
  24. package/dist/bin/pushary-login.js +26 -23
  25. package/dist/bin/pushary-logout.js +7 -7
  26. package/dist/bin/pushary-mcp.js +9 -9
  27. package/dist/bin/pushary-mode.js +9 -9
  28. package/dist/bin/pushary-notification-hook.js +28 -28
  29. package/dist/bin/pushary-opencode-hook.js +27 -27
  30. package/dist/bin/pushary-permission-denied-hook.js +32 -32
  31. package/dist/bin/pushary-permission-hook.js +31 -31
  32. package/dist/bin/pushary-post-hook.js +28 -28
  33. package/dist/bin/pushary-prompt-hook.js +28 -28
  34. package/dist/bin/pushary-session-end-hook.js +28 -28
  35. package/dist/bin/pushary-session-start-hook.js +31 -31
  36. package/dist/bin/pushary-setup.js +69 -52
  37. package/dist/bin/pushary-stats.js +5 -5
  38. package/dist/bin/pushary-status.js +15 -15
  39. package/dist/bin/pushary-stop-hook.js +28 -28
  40. package/dist/bin/pushary-stopfailure-hook.js +28 -28
  41. package/dist/bin/pushary-suggestions.js +4 -4
  42. package/dist/bin/pushary-transcript-register.js +19 -19
  43. package/dist/bin/pushary-transcripts.js +7 -7
  44. package/dist/bin/pushary-upgrade.js +21 -21
  45. package/dist/bin/pushary-wait.js +9 -9
  46. package/dist/bin/pushary.js +6 -6
  47. package/dist/{chunk-AKCJ5SNO.js → chunk-2E4SRGYD.js} +17 -12
  48. package/dist/{chunk-LXWUYG7D.js → chunk-2XK6D4WL.js} +1 -1
  49. package/dist/{chunk-JCER3Q6P.js → chunk-35N53QLA.js} +10 -9
  50. package/dist/{chunk-J7JXA2LX.js → chunk-3O4EBTR3.js} +1 -1
  51. package/dist/{chunk-XW2B4QV2.js → chunk-4KMTRXNL.js} +2 -2
  52. package/dist/{chunk-QQJCDRD3.js → chunk-6S727YUV.js} +5 -5
  53. package/dist/{chunk-JGQ2ANHQ.js → chunk-73BH4SZY.js} +2 -2
  54. package/dist/{chunk-FVOCQSBG.js → chunk-ABIW72ST.js} +1 -1
  55. package/dist/{chunk-CGRPHFOV.js → chunk-AL4NHBZ6.js} +1 -1
  56. package/dist/{chunk-D3RS57MN.js → chunk-B6BLCHJW.js} +3 -3
  57. package/dist/{chunk-SKEP3M6M.js → chunk-BFVE3WPB.js} +2 -2
  58. package/dist/{chunk-UYHLMBPQ.js → chunk-BK3R5NRE.js} +1 -1
  59. package/dist/{chunk-HU2LWGEE.js → chunk-CEHDCHXK.js} +1 -1
  60. package/dist/{chunk-CE4UH4AP.js → chunk-COVPHB56.js} +7 -5
  61. package/dist/{chunk-7ER66HZH.js → chunk-CTYCABBH.js} +1 -1
  62. package/dist/{chunk-COSADFEH.js → chunk-DKDZXJHZ.js} +1 -1
  63. package/dist/chunk-EO23EUOK.js +14 -0
  64. package/dist/{chunk-NVLXK2I6.js → chunk-ESME4HN2.js} +5 -5
  65. package/dist/{chunk-5K43TBK4.js → chunk-EUNYNLDU.js} +3 -3
  66. package/dist/{chunk-6Q4NM2LW.js → chunk-FHLRRCUZ.js} +3 -3
  67. package/dist/{chunk-VQLWYKX7.js → chunk-FWQM6V7Z.js} +1 -1
  68. package/dist/{chunk-IITCMJ4G.js → chunk-HLNSTJND.js} +2 -2
  69. package/dist/{chunk-ZMKEKWNR.js → chunk-HZ57E6LS.js} +18 -5
  70. package/dist/{chunk-JHZAZAI3.js → chunk-HZYUDXIH.js} +5 -5
  71. package/dist/{chunk-UPTEPARD.js → chunk-IH5NZMN4.js} +2 -2
  72. package/dist/{chunk-LZMH4EGE.js → chunk-IVPVCCFT.js} +1 -1
  73. package/dist/{chunk-QXL27RY6.js → chunk-JXLANQLV.js} +1 -1
  74. package/dist/{chunk-65TOHCXT.js → chunk-KP45FGHD.js} +4 -4
  75. package/dist/{chunk-4SB46XLF.js → chunk-L52OIZXV.js} +1 -1
  76. package/dist/{chunk-P7YDVWLL.js → chunk-MZXXLIF6.js} +1 -1
  77. package/dist/{chunk-GHKNUQYU.js → chunk-N2ATGXI4.js} +2 -2
  78. package/dist/{chunk-WWDPULS3.js → chunk-PN3F7LOB.js} +8 -8
  79. package/dist/{chunk-LKKYRNJT.js → chunk-Q36G3P7I.js} +1 -1
  80. package/dist/{chunk-SWGY5WNX.js → chunk-QDCEEQUS.js} +5 -5
  81. package/dist/{chunk-RNDFGHSQ.js → chunk-RTKPR4UA.js} +1 -1
  82. package/dist/{chunk-LJI7U6PM.js → chunk-SFKU5DXZ.js} +2 -2
  83. package/dist/{chunk-KR5JASA4.js → chunk-SI327OZF.js} +44 -16
  84. package/dist/{chunk-FJPC35OW.js → chunk-U4DLXAGD.js} +1 -1
  85. package/dist/{chunk-6QSDNXGM.js → chunk-UBCTOE5X.js} +2 -2
  86. package/dist/{chunk-RS4ZOFSF.js → chunk-UBNJYMTG.js} +7 -6
  87. package/dist/{chunk-PMS3EBD2.js → chunk-UX2YSFKS.js} +1 -1
  88. package/dist/{chunk-6JTTJIKJ.js → chunk-V3P2VSX7.js} +3 -3
  89. package/dist/{chunk-IJXJW2VH.js → chunk-VMGLXL74.js} +10 -10
  90. package/dist/{chunk-PEGKBNGN.js → chunk-WCHFDVCC.js} +5 -5
  91. package/dist/{chunk-6L7TNZ43.js → chunk-WM2MEFCA.js} +1 -1
  92. package/dist/{chunk-VH6763OR.js → chunk-XOXW4D6P.js} +3 -3
  93. package/dist/{chunk-SPB3QRE7.js → chunk-XXSAGQAV.js} +4 -4
  94. package/dist/{chunk-C6PPDKVI.js → chunk-Y4AUVOR7.js} +3 -3
  95. package/dist/{chunk-DMA3QUOB.js → chunk-Y6DSV2OS.js} +3 -3
  96. package/dist/{chunk-4XT4JXMG.js → chunk-Y73RBCQD.js} +1 -1
  97. package/dist/{chunk-XEIV5QOT.js → chunk-ZFDGCEKO.js} +14 -1
  98. package/dist/{chunk-RJ7ECJSZ.js → chunk-ZNUNWWCN.js} +4 -2
  99. package/dist/{chunk-V4H33GBM.js → chunk-ZSOFZDLY.js} +6 -6
  100. package/dist/{global-upgrade-ML2RHV4W.js → global-upgrade-N24WINE7.js} +6 -6
  101. package/dist/{paths-LG3IEDDM.js → paths-53PCHAOJ.js} +2 -2
  102. package/dist/{reapply-7PFOITE4.js → reapply-2SU2ZHEK.js} +8 -8
  103. package/dist/src/index.js +20 -20
  104. package/dist/{upgrade-lock-2A2YUUEU.js → upgrade-lock-F6SM6IEZ.js} +3 -3
  105. package/package.json +1 -1
@@ -3,28 +3,28 @@ import {
3
3
  addPusharyToolPermissions,
4
4
  isPusharyHook,
5
5
  removeClaudeMcpServers
6
- } from "./chunk-6Q4NM2LW.js";
6
+ } from "./chunk-FHLRRCUZ.js";
7
7
  import {
8
8
  CLAUDE_HOOK_EVENTS,
9
9
  addGeminiMcpServer,
10
10
  removeGeminiMcpServer
11
- } from "./chunk-D3RS57MN.js";
11
+ } from "./chunk-B6BLCHJW.js";
12
12
  import {
13
13
  CLAUDE_CODE_AGENT,
14
14
  parseApplyPatchFiles
15
- } from "./chunk-JCER3Q6P.js";
15
+ } from "./chunk-35N53QLA.js";
16
16
  import {
17
17
  guardBinary,
18
18
  holdBudgetOf,
19
19
  registerHookEntry
20
- } from "./chunk-ZMKEKWNR.js";
20
+ } from "./chunk-HZ57E6LS.js";
21
21
  import {
22
22
  PHONE_ANSWERED_TOOLS,
23
23
  hookCompatibleProfile,
24
24
  hookCompatibleProfileBySource,
25
25
  toToolLookup,
26
26
  withHookHoldBudget
27
- } from "./chunk-XEIV5QOT.js";
27
+ } from "./chunk-ZFDGCEKO.js";
28
28
 
29
29
  // src/compatible-config.ts
30
30
  import { homedir } from "os";
@@ -2,17 +2,17 @@ import {
2
2
  CLAUDE_HOOK_EVENTS,
3
3
  GEMINI_HOOK_EVENTS,
4
4
  hasGeminiHooks
5
- } from "./chunk-D3RS57MN.js";
5
+ } from "./chunk-B6BLCHJW.js";
6
6
  import {
7
7
  CODEX_HOOK_EVENTS,
8
8
  hasCodexHooks,
9
9
  holdBudgetOf
10
- } from "./chunk-ZMKEKWNR.js";
10
+ } from "./chunk-HZ57E6LS.js";
11
11
  import {
12
12
  CURSOR_GATE_EVENTS,
13
13
  HOOK_LOCATOR_BINARY,
14
14
  hookCommandHoldBudget
15
- } from "./chunk-XEIV5QOT.js";
15
+ } from "./chunk-ZFDGCEKO.js";
16
16
 
17
17
  // src/diagnostics/wiring.ts
18
18
  var record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  CLAUDE_HOOK_EVENTS,
3
3
  supportedClaudeEvents
4
- } from "./chunk-D3RS57MN.js";
4
+ } from "./chunk-B6BLCHJW.js";
5
5
  import {
6
6
  guardBinary,
7
7
  holdBudgetOf,
8
8
  isProtectedByScope,
9
9
  registerHookEntry
10
- } from "./chunk-ZMKEKWNR.js";
10
+ } from "./chunk-HZ57E6LS.js";
11
11
  import {
12
12
  HOOK_LOCATOR_BINARY,
13
13
  withHookHoldBudget
14
- } from "./chunk-XEIV5QOT.js";
14
+ } from "./chunk-ZFDGCEKO.js";
15
15
 
16
16
  // src/claude-config.ts
17
17
  import { join } from "path";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  NPX_LATEST_COMMAND
3
- } from "./chunk-FVOCQSBG.js";
3
+ } from "./chunk-ABIW72ST.js";
4
4
 
5
5
  // src/setup/codex-trust.ts
6
6
  var CODEX_TRUST_TELEMETRY = {
@@ -10,10 +10,10 @@ import {
10
10
  resolvePackageVersionFromBinary,
11
11
  resolvePathBinary,
12
12
  resolvePathBinaryAsync
13
- } from "./chunk-ZMKEKWNR.js";
13
+ } from "./chunk-HZ57E6LS.js";
14
14
  import {
15
15
  MANAGED_PROVIDERS
16
- } from "./chunk-XEIV5QOT.js";
16
+ } from "./chunk-ZFDGCEKO.js";
17
17
 
18
18
  // src/setup/codex-install.ts
19
19
  var NATIVE_BINARY_MIN_BYTES = 20 * 1024 * 1024;
@@ -13,7 +13,7 @@ import {
13
13
  isReleaseVersion,
14
14
  ownPackageName,
15
15
  withHookHoldBudget
16
- } from "./chunk-XEIV5QOT.js";
16
+ } from "./chunk-ZFDGCEKO.js";
17
17
 
18
18
  // src/setup/paths.ts
19
19
  import { homedir as homedir2 } from "os";
@@ -365,9 +365,9 @@ var installGlobally = (options) => {
365
365
  }
366
366
  const started = (async () => {
367
367
  if (!npmIsOnPath()) throw new NpmMissingError();
368
- const { withUpgradeLock } = await import("./global-upgrade-ML2RHV4W.js");
369
- const { installWithUpgradeLock, ownsUpgradeLock } = await import("./upgrade-lock-2A2YUUEU.js");
370
- const { autoUpdateLock: autoUpdateLock2 } = await import("./paths-LG3IEDDM.js");
368
+ const { withUpgradeLock } = await import("./global-upgrade-N24WINE7.js");
369
+ const { installWithUpgradeLock, ownsUpgradeLock } = await import("./upgrade-lock-F6SM6IEZ.js");
370
+ const { autoUpdateLock: autoUpdateLock2 } = await import("./paths-53PCHAOJ.js");
371
371
  let result = "skipped";
372
372
  const install = async () => {
373
373
  const platform = process.platform;
@@ -510,6 +510,7 @@ var CODEX_HOOK_EVENTS = [
510
510
  { event: "PreCompact", matcher: "manual|auto", delivery: "telemetry", timeout: 5 },
511
511
  { event: "PostCompact", matcher: "manual|auto", delivery: "telemetry", timeout: 5 }
512
512
  ];
513
+ var CODEX_REQUIRED_APPROVAL_EVENTS = CODEX_HOOK_EVENTS.filter((event) => event.delivery === "approval").map((event) => event.event);
513
514
  var CODEX_EVENT_KEY = {
514
515
  PermissionRequest: "permission_request",
515
516
  PreToolUse: "pre_tool_use",
@@ -701,11 +702,22 @@ var codexTrustGaps = (config, hooksConfig, hooksJsonPath, command, positions) =>
701
702
  for (const definition of CODEX_HOOK_EVENTS) {
702
703
  const position = positions[definition.event];
703
704
  if (!position) continue;
704
- const stored = asRecord2(state?.[codexHookStateKey(hooksJsonPath, definition.event, position)])?.trusted_hash;
705
+ const hookState = asRecord2(state?.[codexHookStateKey(hooksJsonPath, definition.event, position)]);
706
+ if (definition.delivery === "approval" && hookState?.enabled === false) {
707
+ gaps.push({ event: definition.event, kind: "disabled" });
708
+ continue;
709
+ }
710
+ const stored = hookState?.trusted_hash;
705
711
  const eventKey = CODEX_EVENT_KEY[definition.event] ?? definition.event;
706
712
  const onDisk = asRecord2(
707
713
  asRecord2(hooks?.[definition.event]) ?? (Array.isArray(hooks?.[definition.event]) ? hooks[definition.event][position[0]] : void 0)
708
714
  );
715
+ const handlers = onDisk?.hooks;
716
+ const handler = Array.isArray(handlers) ? asRecord2(handlers[position[1]]) : void 0;
717
+ if (definition.delivery === "approval" && handler?.async === true) {
718
+ gaps.push({ event: definition.event, kind: "asynchronous" });
719
+ continue;
720
+ }
709
721
  const diskHash = onDisk ? codexEntryTrustHash(eventKey, onDisk) : void 0;
710
722
  if (stored !== void 0 && diskHash !== void 0 && stored === diskHash) {
711
723
  if (diskHash !== codexHookTrustHash(definition, command)) {
@@ -855,6 +867,7 @@ export {
855
867
  codexAgentsMd,
856
868
  codexSkillDir,
857
869
  CODEX_HOOK_EVENTS,
870
+ CODEX_REQUIRED_APPROVAL_EVENTS,
858
871
  addCodexMcpServer,
859
872
  readCodexMcpAuth,
860
873
  isPusharyCodexCommand,
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  clientErrorKindOf,
3
3
  reportClientError
4
- } from "./chunk-SPB3QRE7.js";
4
+ } from "./chunk-XXSAGQAV.js";
5
5
  import {
6
6
  SubscriptionRequiredError,
7
7
  callMcpTool
8
- } from "./chunk-VH6763OR.js";
8
+ } from "./chunk-XOXW4D6P.js";
9
9
  import {
10
10
  installNetworkDefaults
11
- } from "./chunk-6JTTJIKJ.js";
11
+ } from "./chunk-V3P2VSX7.js";
12
12
  import {
13
13
  getBaseUrl
14
- } from "./chunk-4SB46XLF.js";
14
+ } from "./chunk-L52OIZXV.js";
15
15
  import {
16
16
  ASK_AGENT_NAME_MAX,
17
17
  ASK_QUESTION_MAX,
18
18
  DECISION_LINE_MAX,
19
19
  truncateLine
20
- } from "./chunk-XEIV5QOT.js";
20
+ } from "./chunk-ZFDGCEKO.js";
21
21
 
22
22
  // src/api.ts
23
23
  import { randomUUID } from "crypto";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  registerTranscript
3
- } from "./chunk-WWDPULS3.js";
3
+ } from "./chunk-PN3F7LOB.js";
4
4
  import {
5
5
  writeDegraded
6
- } from "./chunk-SPB3QRE7.js";
6
+ } from "./chunk-XXSAGQAV.js";
7
7
 
8
8
  // src/tool-hook-input.ts
9
9
  var OPTIONAL_TEXT_FIELDS = ["hook_event_name", "session_id", "cwd", "transcript_path", "tool_use_id", "permission_mode"];
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  describeKeyCheck,
6
6
  keyCheckFromResponse
7
- } from "./chunk-DMA3QUOB.js";
7
+ } from "./chunk-Y6DSV2OS.js";
8
8
  import {
9
9
  EXIT
10
10
  } from "./chunk-KZERVKTD.js";
@@ -2,7 +2,7 @@ import {
2
2
  autoUpdateLock,
3
3
  installPackageGlobally,
4
4
  npmErrorMessage
5
- } from "./chunk-ZMKEKWNR.js";
5
+ } from "./chunk-HZ57E6LS.js";
6
6
  import {
7
7
  writeJsonAtomic
8
8
  } from "./chunk-T7E75EKA.js";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  AGENT_CHOICES
3
- } from "./chunk-HU2LWGEE.js";
3
+ } from "./chunk-CEHDCHXK.js";
4
4
  import {
5
5
  isBridgeLocator
6
- } from "./chunk-LXWUYG7D.js";
6
+ } from "./chunk-2XK6D4WL.js";
7
7
  import {
8
8
  pusharyHookExecutable
9
- } from "./chunk-5K43TBK4.js";
9
+ } from "./chunk-EUNYNLDU.js";
10
10
  import {
11
11
  BELL_HOOK_BINARY
12
- } from "./chunk-COSADFEH.js";
12
+ } from "./chunk-DKDZXJHZ.js";
13
13
 
14
14
  // src/setup/hook-ownership.ts
15
15
  var commandsIn = (value) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  NPX_LATEST_COMMAND
3
- } from "./chunk-FVOCQSBG.js";
3
+ } from "./chunk-ABIW72ST.js";
4
4
 
5
5
  // src/config.ts
6
6
  import { readFileSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSafeReadOnlyCommand
3
- } from "./chunk-XEIV5QOT.js";
3
+ } from "./chunk-ZFDGCEKO.js";
4
4
 
5
5
  // src/ledger.ts
6
6
  import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync } from "fs";
@@ -5,7 +5,7 @@ import {
5
5
  permissionDeniedAction,
6
6
  releaseThrottle,
7
7
  reportEvent
8
- } from "./chunk-JCER3Q6P.js";
8
+ } from "./chunk-35N53QLA.js";
9
9
  import {
10
10
  DEFAULT_SESSION
11
11
  } from "./chunk-N6IOSZOE.js";
@@ -13,7 +13,7 @@ import {
13
13
  machineDecisionFor,
14
14
  shouldDeferToNativeMode,
15
15
  wireVerdictFor
16
- } from "./chunk-XEIV5QOT.js";
16
+ } from "./chunk-ZFDGCEKO.js";
17
17
 
18
18
  // src/machine-decision-audit.ts
19
19
  import { basename } from "path";
@@ -6,38 +6,38 @@ import {
6
6
  } from "./chunk-SGZJ5LYH.js";
7
7
  import {
8
8
  hookOwnerOf
9
- } from "./chunk-65TOHCXT.js";
9
+ } from "./chunk-KP45FGHD.js";
10
10
  import {
11
11
  ensureDaemonRunning
12
- } from "./chunk-PEGKBNGN.js";
12
+ } from "./chunk-WCHFDVCC.js";
13
13
  import {
14
14
  buildTranscriptRecords,
15
15
  decodePublicKey,
16
16
  generateSessionKey,
17
17
  wrapSessionKey
18
- } from "./chunk-FJPC35OW.js";
18
+ } from "./chunk-U4DLXAGD.js";
19
19
  import {
20
20
  fetchTranscriptRecipients,
21
21
  uploadTranscriptRecords
22
- } from "./chunk-PMS3EBD2.js";
22
+ } from "./chunk-UX2YSFKS.js";
23
23
  import {
24
24
  transcriptEnvironmentPreference,
25
25
  transcriptsEnabled
26
- } from "./chunk-7ER66HZH.js";
26
+ } from "./chunk-CTYCABBH.js";
27
27
  import {
28
28
  readTranscriptPreference
29
- } from "./chunk-RJ7ECJSZ.js";
29
+ } from "./chunk-ZNUNWWCN.js";
30
30
  import {
31
31
  codexHome,
32
32
  pusharyDir
33
- } from "./chunk-ZMKEKWNR.js";
33
+ } from "./chunk-HZ57E6LS.js";
34
34
  import {
35
35
  writeJsonAtomic
36
36
  } from "./chunk-T7E75EKA.js";
37
37
  import {
38
38
  getApiKey,
39
39
  getBaseUrl
40
- } from "./chunk-4SB46XLF.js";
40
+ } from "./chunk-L52OIZXV.js";
41
41
 
42
42
  // src/transcript-registration.ts
43
43
  import { createHash } from "crypto";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-3EGEA4KH.js";
10
10
  import {
11
11
  getBaseUrl
12
- } from "./chunk-4SB46XLF.js";
12
+ } from "./chunk-L52OIZXV.js";
13
13
 
14
14
  // src/cli/login-ui.ts
15
15
  import { hostname } from "os";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  ensureCodexTrustsPusharyHooks
3
- } from "./chunk-KR5JASA4.js";
3
+ } from "./chunk-SI327OZF.js";
4
4
  import {
5
5
  addClaudeMcpServer,
6
6
  addPusharyHooks,
7
7
  addPusharyToolPermissions
8
- } from "./chunk-6Q4NM2LW.js";
8
+ } from "./chunk-FHLRRCUZ.js";
9
9
  import {
10
10
  detectClaudeVersion
11
11
  } from "./chunk-RIVNNBEK.js";
@@ -15,7 +15,7 @@ import {
15
15
  codexUnprovenHolds,
16
16
  codexWired,
17
17
  geminiWired
18
- } from "./chunk-5K43TBK4.js";
18
+ } from "./chunk-EUNYNLDU.js";
19
19
  import {
20
20
  CLAUDE_HOOK_BINARY,
21
21
  CLAUDE_HOOK_EVENTS,
@@ -26,7 +26,7 @@ import {
26
26
  needsReregistration,
27
27
  registrationSignatures,
28
28
  supportedClaudeEvents
29
- } from "./chunk-D3RS57MN.js";
29
+ } from "./chunk-B6BLCHJW.js";
30
30
  import {
31
31
  formatVersion
32
32
  } from "./chunk-6ICPEJY5.js";
@@ -49,7 +49,7 @@ import {
49
49
  registrationHolderOf,
50
50
  resolveGlobalBinary,
51
51
  vscodePluginMcp
52
- } from "./chunk-ZMKEKWNR.js";
52
+ } from "./chunk-HZ57E6LS.js";
53
53
  import {
54
54
  readJsonSafe,
55
55
  writeFileAtomic,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PRETOOLUSE_GATED_TOOLS
3
- } from "./chunk-XEIV5QOT.js";
3
+ } from "./chunk-ZFDGCEKO.js";
4
4
 
5
5
  // src/claude-tools.ts
6
6
  var POSTTOOLUSE_MIRROR_ONLY_TOOLS = ["TodoWrite", "Task", "WebFetch", "WebSearch"];
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  parseSseMessages
3
- } from "./chunk-VH6763OR.js";
3
+ } from "./chunk-XOXW4D6P.js";
4
4
  import {
5
5
  NPX_LATEST_COMMAND
6
- } from "./chunk-FVOCQSBG.js";
6
+ } from "./chunk-ABIW72ST.js";
7
7
 
8
8
  // src/mcp-stdio-bridge.ts
9
9
  var MCP_BRIDGE_BINARY = "pushary-mcp";
@@ -2,14 +2,16 @@ import {
2
2
  spawnClaude
3
3
  } from "./chunk-XHKBHWLX.js";
4
4
  import {
5
+ CODEX_HOOK_EVENTS,
6
+ CODEX_REQUIRED_APPROVAL_EVENTS,
5
7
  codexHome,
6
8
  codexHooksJsonIn,
7
9
  isPusharyCodexCommand,
8
10
  resolvePathBinary
9
- } from "./chunk-ZMKEKWNR.js";
11
+ } from "./chunk-HZ57E6LS.js";
10
12
  import {
11
13
  getPackageVersion
12
- } from "./chunk-XEIV5QOT.js";
14
+ } from "./chunk-ZFDGCEKO.js";
13
15
 
14
16
  // src/codex-app-server.ts
15
17
  import { existsSync, realpathSync } from "fs";
@@ -20,6 +22,7 @@ var CODEX_HOOK_STATUS = {
20
22
  modified: "modified",
21
23
  managed: "managed",
22
24
  disabled: "disabled",
25
+ asynchronous: "asynchronous",
23
26
  notListed: "not listed"
24
27
  };
25
28
  var CODEX_APP_SERVER_ARGS = ["app-server"];
@@ -42,11 +45,19 @@ var CODEX_NOT_ASKED = {
42
45
  };
43
46
  var UNRECOGNISED_LISTING = "Codex answered hooks/list in a shape Pushary does not recognise";
44
47
  var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
45
- var isCodexListedHook = (value) => isRecord(value) && typeof value.key === "string" && typeof value.eventName === "string" && typeof value.command === "string" && typeof value.sourcePath === "string" && typeof value.enabled === "boolean" && typeof value.isManaged === "boolean" && typeof value.currentHash === "string" && typeof value.trustStatus === "string";
48
+ var hasCodexHookIdentity = (value) => isRecord(value) && typeof value.key === "string" && value.key.length > 0 && typeof value.eventName === "string" && value.eventName.length > 0 && typeof value.sourcePath === "string" && value.sourcePath.length > 0 && typeof value.enabled === "boolean" && typeof value.isManaged === "boolean" && typeof value.currentHash === "string" && value.currentHash.length > 0 && typeof value.trustStatus === "string" && value.trustStatus.length > 0;
49
+ var isCodexListedHook = (value) => hasCodexHookIdentity(value) && (value.handlerType === void 0 || value.handlerType === "command") && typeof value.command === "string" && value.command.length > 0 && (value.async === void 0 || typeof value.async === "boolean");
50
+ var isCodexHookMetadata = (value) => {
51
+ if (isCodexListedHook(value)) return true;
52
+ if (!hasCodexHookIdentity(value)) return false;
53
+ if (value.handlerType === "prompt" || value.handlerType === "agent") return true;
54
+ return value.handlerType === "mcpTool" && typeof value.server === "string" && value.server.length > 0 && typeof value.tool === "string" && value.tool.length > 0;
55
+ };
46
56
  var listedHookFields = (hook) => ({
47
57
  key: hook.key,
48
58
  eventName: hook.eventName,
49
59
  command: hook.command,
60
+ async: hook.async ?? false,
50
61
  sourcePath: hook.sourcePath,
51
62
  enabled: hook.enabled,
52
63
  isManaged: hook.isManaged,
@@ -67,20 +78,17 @@ var hooksListingOf = (result) => {
67
78
  const warnings = [];
68
79
  for (const layer of result.data) {
69
80
  if (!isRecord(layer) || !Array.isArray(layer.hooks)) return null;
81
+ if (!layer.hooks.every(isCodexHookMetadata)) return null;
70
82
  hooks.push(...layer.hooks.filter(isCodexListedHook).map(listedHookFields));
71
83
  warnings.push(...diagnosticMessages(layer.warnings), ...diagnosticMessages(layer.errors));
72
84
  }
73
85
  return { hooks, warnings };
74
86
  };
75
87
  var isPusharyHookIn = (hooksJsonPath, hook) => hook.sourcePath === hooksJsonPath && isPusharyCodexCommand(hook.command);
76
- var isTrustableByPushary = (hook) => hook.enabled && !hook.isManaged && hook.trustStatus !== CODEX_HOOK_STATUS.managed;
88
+ var isTrustableByPushary = (hook) => hook.enabled && !hook.isManaged && hook.trustStatus !== CODEX_HOOK_STATUS.managed && !(CODEX_REQUIRED_APPROVAL_EVENTS.includes(hookEventOf(hook.eventName)) && hook.async === true);
77
89
  var pusharyHooksIn = (hooks, hooksJsonPath) => hooks.filter((hook) => isPusharyHookIn(hooksJsonPath, hook));
78
90
  var selectPusharyCodexHooks = (hooks, hooksJsonPath) => pusharyHooksIn(hooks, hooksJsonPath).filter(isTrustableByPushary);
79
- var codexTrustVerdict = (hooks, hooksJsonPath) => {
80
- if (pusharyHooksIn(hooks, hooksJsonPath).length === 0) return { kind: "unlisted" };
81
- const untrusted = selectPusharyCodexHooks(hooks, hooksJsonPath).filter((hook) => hook.trustStatus !== CODEX_HOOK_STATUS.trusted);
82
- return untrusted.length === 0 ? { kind: "trusted" } : { kind: "untrusted", hooks: untrusted };
83
- };
91
+ var codexTrustVerdict = (hooks, hooksJsonPath) => assessCodexHookTrust(CODEX_HOOK_EVENTS.map((event) => event.event), pusharyHooksIn(hooks, hooksJsonPath));
84
92
  var codexTrustEdit = (hooks) => ({
85
93
  edits: [{
86
94
  keyPath: HOOKS_STATE_KEY_PATH,
@@ -94,16 +102,34 @@ var initializeParams = (clientVersion) => ({
94
102
  });
95
103
  var hooksListParams = (cwd) => ({ cwds: [cwd] });
96
104
  var hookEventOf = (eventName) => eventName.charAt(0).toUpperCase() + eventName.slice(1);
105
+ var trustStatusOf = (hook) => {
106
+ if (!hook.enabled) return CODEX_HOOK_STATUS.disabled;
107
+ if (CODEX_REQUIRED_APPROVAL_EVENTS.includes(hookEventOf(hook.eventName)) && hook.async === true) return CODEX_HOOK_STATUS.asynchronous;
108
+ return hook.trustStatus;
109
+ };
97
110
  var readingOf = (hook) => ({
98
111
  event: hookEventOf(hook.eventName),
99
- status: hook.enabled ? hook.trustStatus : CODEX_HOOK_STATUS.disabled
112
+ status: trustStatusOf(hook)
100
113
  });
101
- var codexHookTrustByEvent = (events, hooks) => events.map((event) => hooks.map(readingOf).find((reading) => reading.event === event) ?? { event, status: CODEX_HOOK_STATUS.notListed });
102
- var CODEX_TRUST_FAILURES = /* @__PURE__ */ new Set([CODEX_HOOK_STATUS.untrusted, CODEX_HOOK_STATUS.modified]);
103
- var isCodexTrustFailure = (reading) => CODEX_TRUST_FAILURES.has(reading.status);
114
+ var codexHookTrustByEvent = (events, hooks) => {
115
+ const readings = hooks.map(readingOf);
116
+ const result = [];
117
+ for (const event of events) {
118
+ const matching = readings.filter((reading) => reading.event === event);
119
+ result.push(...matching.length > 0 ? matching : [{ event, status: CODEX_HOOK_STATUS.notListed }]);
120
+ }
121
+ return result;
122
+ };
123
+ var isCodexTrustFailure = (reading) => {
124
+ if (reading.status === CODEX_HOOK_STATUS.trusted || reading.status === CODEX_HOOK_STATUS.managed) return false;
125
+ if (reading.status === CODEX_HOOK_STATUS.disabled || reading.status === CODEX_HOOK_STATUS.notListed) {
126
+ return CODEX_REQUIRED_APPROVAL_EVENTS.includes(reading.event);
127
+ }
128
+ return true;
129
+ };
104
130
  var eventsWithStatus = (readings, status) => readings.filter((reading) => reading.status === status).map((reading) => reading.event);
105
131
  var assessCodexHookTrust = (events, hooks) => {
106
- const readings = codexHookTrustByEvent(events, hooks);
132
+ const readings = codexHookTrustByEvent([.../* @__PURE__ */ new Set([...events, ...CODEX_REQUIRED_APPROVAL_EVENTS])], hooks);
107
133
  const notListed = eventsWithStatus(readings, CODEX_HOOK_STATUS.notListed);
108
134
  if (readings.length > 0 && notListed.length === readings.length) return { kind: "unlisted" };
109
135
  const disabled = eventsWithStatus(readings, CODEX_HOOK_STATUS.disabled);
@@ -265,7 +291,7 @@ var confirmationAfterWrite = (listing, hooksJsonPath, writeError) => {
265
291
  const verdict = codexTrustVerdict(listing.hooks, hooksJsonPath);
266
292
  if (verdict.kind === "trusted") return { kind: "verified", wrote: true };
267
293
  if (verdict.kind === "unlisted") return { kind: "unlisted", warnings: listing.warnings };
268
- return { kind: "refused", hooks: verdict.hooks.map(readingOf), writeError };
294
+ return { kind: "refused", hooks: verdict.failures, writeError };
269
295
  };
270
296
  var trustConversation = (launch, hooksJsonPath) => async (session) => {
271
297
  const unavailable = await openSession(session);
@@ -275,7 +301,9 @@ var trustConversation = (launch, hooksJsonPath) => async (session) => {
275
301
  const verdict = codexTrustVerdict(before.hooks, hooksJsonPath);
276
302
  if (verdict.kind === "trusted") return { kind: "verified", wrote: false };
277
303
  if (verdict.kind === "unlisted") return { kind: "unlisted", warnings: before.warnings };
278
- const written = await session.request(METHOD_CONFIG_BATCH_WRITE, codexTrustEdit(verdict.hooks));
304
+ const trustable = selectPusharyCodexHooks(before.hooks, hooksJsonPath).filter((hook) => hook.trustStatus === CODEX_HOOK_STATUS.untrusted || hook.trustStatus === CODEX_HOOK_STATUS.modified);
305
+ if (trustable.length === 0) return { kind: "refused", hooks: verdict.failures, writeError: null };
306
+ const written = await session.request(METHOD_CONFIG_BATCH_WRITE, codexTrustEdit(trustable));
279
307
  const after = await listHooks(session, launch);
280
308
  if (!isListing(after)) return after;
281
309
  return confirmationAfterWrite(after, hooksJsonPath, written.kind === "error" ? written.message : null);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  redactSecretsFromContent
3
- } from "./chunk-XEIV5QOT.js";
3
+ } from "./chunk-ZFDGCEKO.js";
4
4
 
5
5
  // src/crypto.ts
6
6
  import nacl from "tweetnacl";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  configFilePath
3
- } from "./chunk-4SB46XLF.js";
3
+ } from "./chunk-L52OIZXV.js";
4
4
  import {
5
5
  normalizeInstallSource
6
- } from "./chunk-XEIV5QOT.js";
6
+ } from "./chunk-ZFDGCEKO.js";
7
7
 
8
8
  // src/install-source.ts
9
9
  import { readFileSync } from "fs";
@@ -14,18 +14,19 @@ import {
14
14
  } from "./chunk-U4TMAANR.js";
15
15
  import {
16
16
  callMcpTool
17
- } from "./chunk-VH6763OR.js";
17
+ } from "./chunk-XOXW4D6P.js";
18
18
  import {
19
19
  reportedInstallSource
20
- } from "./chunk-6QSDNXGM.js";
20
+ } from "./chunk-UBCTOE5X.js";
21
21
  import {
22
22
  NPX_LATEST_COMMAND
23
- } from "./chunk-FVOCQSBG.js";
23
+ } from "./chunk-ABIW72ST.js";
24
24
  import {
25
25
  NO_PAIRING_COMPUTER,
26
26
  PAIR_TTL_SECONDS,
27
+ classifyConfirmResponse,
27
28
  isAnswerSource
28
- } from "./chunk-XEIV5QOT.js";
29
+ } from "./chunk-ZFDGCEKO.js";
29
30
 
30
31
  // src/reach.ts
31
32
  var reachVerdict = (channels) => {
@@ -206,8 +207,8 @@ var defaultCancel = async (apiKey, correlationId) => {
206
207
  });
207
208
  };
208
209
  var answeredRoundTrip = (answer, correlationId, latencyMs) => {
209
- if (answer.value !== "yes" && answer.value !== "no") {
210
- return { kind: "error", detail: "the server reported an answer without a valid Yes or No value" };
210
+ if (answer.value === void 0 || classifyConfirmResponse(answer.value) === null) {
211
+ return { kind: "error", detail: "the server reported an answer without a valid Yes, No or defer value" };
211
212
  }
212
213
  return {
213
214
  kind: "answered",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getBaseUrl
3
- } from "./chunk-4SB46XLF.js";
3
+ } from "./chunk-L52OIZXV.js";
4
4
 
5
5
  // src/transcript-api.ts
6
6
  var fetchTranscriptRecipients = async (apiKey, baseUrl = getBaseUrl()) => {
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  readExistingMachineId
3
- } from "./chunk-J7JXA2LX.js";
3
+ } from "./chunk-3O4EBTR3.js";
4
4
  import {
5
5
  NetworkError
6
6
  } from "./chunk-7QLSKOSU.js";
7
7
  import {
8
8
  getBaseUrl
9
- } from "./chunk-4SB46XLF.js";
9
+ } from "./chunk-L52OIZXV.js";
10
10
  import {
11
11
  clientContextHeaders,
12
12
  getPackageVersion
13
- } from "./chunk-XEIV5QOT.js";
13
+ } from "./chunk-ZFDGCEKO.js";
14
14
 
15
15
  // src/cli/net.ts
16
16
  import { createRequire } from "module";