@pushary/agent-hooks 0.92.1 → 0.93.1

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 (70) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/bin/pushary-bell-hook.js +4 -4
  3. package/dist/bin/pushary-bell.js +5 -5
  4. package/dist/bin/pushary-claude.js +41 -25
  5. package/dist/bin/pushary-clean.js +11 -11
  6. package/dist/bin/pushary-codex-bridge.js +10 -10
  7. package/dist/bin/pushary-codex-hook.js +48 -14
  8. package/dist/bin/pushary-codex.js +9 -8
  9. package/dist/bin/pushary-connect.js +7 -7
  10. package/dist/bin/pushary-daemon.js +13 -13
  11. package/dist/bin/pushary-disconnect.js +5 -5
  12. package/dist/bin/pushary-doctor.js +27 -20
  13. package/dist/bin/pushary-elicitation-hook.js +5 -5
  14. package/dist/bin/pushary-gemini-bridge.js +10 -10
  15. package/dist/bin/pushary-gemini-hook.js +10 -9
  16. package/dist/bin/pushary-hook.js +12 -12
  17. package/dist/bin/pushary-login.js +7 -7
  18. package/dist/bin/pushary-logout.js +4 -4
  19. package/dist/bin/pushary-mode.js +3 -3
  20. package/dist/bin/pushary-notification-hook.js +9 -8
  21. package/dist/bin/pushary-opencode-hook.js +10 -9
  22. package/dist/bin/pushary-permission-denied-hook.js +12 -12
  23. package/dist/bin/pushary-permission-hook.js +12 -12
  24. package/dist/bin/pushary-post-hook.js +9 -8
  25. package/dist/bin/pushary-prompt-hook.js +9 -8
  26. package/dist/bin/pushary-session-end-hook.js +9 -8
  27. package/dist/bin/pushary-session-start-hook.js +13 -13
  28. package/dist/bin/pushary-setup.js +21 -21
  29. package/dist/bin/pushary-stats.js +2 -2
  30. package/dist/bin/pushary-status.js +9 -9
  31. package/dist/bin/pushary-stop-hook.js +9 -8
  32. package/dist/bin/pushary-stopfailure-hook.js +9 -8
  33. package/dist/bin/pushary-transcripts.js +4 -4
  34. package/dist/bin/pushary-upgrade.js +12 -12
  35. package/dist/bin/pushary-wait.js +3 -3
  36. package/dist/{chunk-VHWCVD42.js → chunk-2ORRI66J.js} +1 -1
  37. package/dist/{chunk-I3ORVBTP.js → chunk-36LR2LOT.js} +5 -5
  38. package/dist/{chunk-7FE2KABY.js → chunk-46P3VES5.js} +1 -1
  39. package/dist/{chunk-L4E2BIJ2.js → chunk-4PE2SQVM.js} +57 -4
  40. package/dist/{chunk-YXDYKECP.js → chunk-5HGLZGI4.js} +138 -86
  41. package/dist/{chunk-OSALSIUF.js → chunk-6BIMJIRG.js} +1 -1
  42. package/dist/{chunk-UZNKVRLE.js → chunk-6WYL3XIP.js} +1 -1
  43. package/dist/{chunk-CELX75MW.js → chunk-BSEAOCCQ.js} +1 -1
  44. package/dist/{chunk-QZCFVWA7.js → chunk-EQRS3SGM.js} +3 -1
  45. package/dist/{chunk-BSZYIAZL.js → chunk-EYRGBYZG.js} +2 -1
  46. package/dist/{chunk-QCXKQJTG.js → chunk-FYOIW5RV.js} +3 -3
  47. package/dist/{chunk-ZMKKK6DC.js → chunk-HSAVPZ46.js} +3 -3
  48. package/dist/{chunk-2ACC5M7F.js → chunk-NVPYRDCT.js} +1 -1
  49. package/dist/{chunk-CNPAT3HL.js → chunk-OB4RF2TF.js} +2 -2
  50. package/dist/{chunk-JW4KO5AF.js → chunk-ODL52O5V.js} +1 -1
  51. package/dist/{chunk-I463AEG3.js → chunk-OYNPLEXP.js} +1 -1
  52. package/dist/{chunk-2XQSN66Q.js → chunk-QGA2ZB4I.js} +1 -1
  53. package/dist/{chunk-RQPQSJJH.js → chunk-QKNLW7H6.js} +26 -11
  54. package/dist/{chunk-F7OURW3C.js → chunk-RER3FRTD.js} +7 -7
  55. package/dist/{chunk-5NAZ7SFS.js → chunk-RH3TM7TO.js} +1 -1
  56. package/dist/{chunk-PYA4FLKI.js → chunk-ROHFVGXM.js} +2 -2
  57. package/dist/{chunk-I7W3UTDK.js → chunk-RX75MRGC.js} +10 -8
  58. package/dist/{chunk-4TFXV5MW.js → chunk-TDUTNYAQ.js} +1 -1
  59. package/dist/{chunk-BXTJVM7O.js → chunk-UZFVNEEU.js} +6 -6
  60. package/dist/{chunk-Z6RFZKY4.js → chunk-WY4ALDYN.js} +1 -1
  61. package/dist/chunk-Y3UGCQQC.js +53 -0
  62. package/dist/{chunk-CV2YD2JR.js → chunk-Y6XXFXVB.js} +43 -11
  63. package/dist/{chunk-3HS4YGHB.js → chunk-YANV5TGK.js} +3 -3
  64. package/dist/{chunk-VNMKIJZB.js → chunk-Z6CP5ZZD.js} +3 -0
  65. package/dist/{chunk-HDORB7WD.js → chunk-ZO2XG3CX.js} +1 -1
  66. package/dist/{chunk-SQYBP3QQ.js → chunk-ZTJF6ANY.js} +2 -2
  67. package/dist/src/index.d.ts +33 -3
  68. package/dist/src/index.js +13 -13
  69. package/package.json +2 -2
  70. package/dist/chunk-2LAHXHBR.js +0 -23
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.93.1
4
+
5
+ - Attach stable usage report IDs and preserve the report timestamp across retries so the server counts a replay once.
6
+ - Report restricted agent-key scope accurately and fail closed on unknown identity scopes.
7
+ - Requires the additive server accounting and key-capability changes from #1303 before rollout.
8
+
9
+ ## 0.93.0
10
+
11
+ Requires Node.js 20.3.0 or newer for shared cancellation signals.
12
+
13
+ - Register the expanded Claude and Codex hook coverage from the September 4 changes; preserve child-agent identity during compaction.
14
+ - Share one deadline across mode lookup, question reconciliation, event reporting, and command acknowledgement. Retain unresolved question markers for retry.
15
+ - Deliver queued phone instructions on UserPromptSubmit and keep observational hooks from consuming them.
16
+ - Redact credentials in notification activity, phone pushes, and unrecognized failure messages.
17
+ - Diagnose modified Codex hook definitions against their installed trust hashes.
18
+
3
19
  ## 0.92.1
4
20
 
5
21
  ### A rejected key is an answer, not an empty poll
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  handleBell
4
- } from "../chunk-5NAZ7SFS.js";
4
+ } from "../chunk-RH3TM7TO.js";
5
5
  import {
6
6
  readHookInput
7
7
  } from "../chunk-6CUUA7HO.js";
8
- import "../chunk-OSALSIUF.js";
8
+ import "../chunk-6BIMJIRG.js";
9
9
  import "../chunk-BC3VCZ3E.js";
10
- import "../chunk-JW4KO5AF.js";
10
+ import "../chunk-ODL52O5V.js";
11
11
  import "../chunk-4LL6LG5X.js";
12
12
  import "../chunk-2UMNXADU.js";
13
- import "../chunk-VNMKIJZB.js";
13
+ import "../chunk-Z6CP5ZZD.js";
14
14
 
15
15
  // bin/pushary-bell-hook.ts
16
16
  var main = async () => {
@@ -5,7 +5,7 @@ import {
5
5
  liveAgentCount,
6
6
  ring,
7
7
  upgradeThreshold
8
- } from "../chunk-5NAZ7SFS.js";
8
+ } from "../chunk-RH3TM7TO.js";
9
9
  import {
10
10
  addBellHooks,
11
11
  bellInstalled,
@@ -15,7 +15,7 @@ import "../chunk-EZIEXHYM.js";
15
15
  import "../chunk-L4ZCFMWW.js";
16
16
  import {
17
17
  claudeSettings
18
- } from "../chunk-CV2YD2JR.js";
18
+ } from "../chunk-Y6XXFXVB.js";
19
19
  import {
20
20
  createIo
21
21
  } from "../chunk-5RUIFDTP.js";
@@ -27,19 +27,19 @@ import {
27
27
  } from "../chunk-BVBEURWJ.js";
28
28
  import "../chunk-43GMYSS4.js";
29
29
  import "../chunk-DINDL2CF.js";
30
- import "../chunk-OSALSIUF.js";
30
+ import "../chunk-6BIMJIRG.js";
31
31
  import "../chunk-BC3VCZ3E.js";
32
32
  import "../chunk-7QLSKOSU.js";
33
33
  import {
34
34
  EXIT
35
35
  } from "../chunk-KZERVKTD.js";
36
- import "../chunk-JW4KO5AF.js";
36
+ import "../chunk-ODL52O5V.js";
37
37
  import {
38
38
  readJsonSafe,
39
39
  writeJsonAtomic
40
40
  } from "../chunk-4LL6LG5X.js";
41
41
  import "../chunk-2UMNXADU.js";
42
- import "../chunk-VNMKIJZB.js";
42
+ import "../chunk-Z6CP5ZZD.js";
43
43
 
44
44
  // bin/pushary-bell.ts
45
45
  exitOnHelpFlag("bell");
@@ -7,26 +7,26 @@ import {
7
7
  } from "../chunk-YKLCWWEI.js";
8
8
  import {
9
9
  ensureDaemonRunning
10
- } from "../chunk-SQYBP3QQ.js";
10
+ } from "../chunk-ZTJF6ANY.js";
11
11
  import {
12
12
  buildTranscriptRecords,
13
13
  decodePublicKey,
14
14
  generateSessionKey,
15
15
  wrapSessionKey
16
- } from "../chunk-7FE2KABY.js";
16
+ } from "../chunk-46P3VES5.js";
17
17
  import {
18
18
  fetchTranscriptRecipients,
19
19
  uploadTranscriptRecords
20
- } from "../chunk-QZCFVWA7.js";
20
+ } from "../chunk-EQRS3SGM.js";
21
21
  import {
22
22
  transcriptsEnabled
23
- } from "../chunk-UZNKVRLE.js";
23
+ } from "../chunk-6WYL3XIP.js";
24
24
  import {
25
25
  SESSION_IDLE_TIMEOUT_MS,
26
26
  describeIdleWindow,
27
27
  startProcessOwnership,
28
28
  withSpawnProcessOwnership
29
- } from "../chunk-4TFXV5MW.js";
29
+ } from "../chunk-TDUTNYAQ.js";
30
30
  import {
31
31
  needsShell,
32
32
  spawnClaude
@@ -41,7 +41,7 @@ import {
41
41
  phoneDrivenEnv,
42
42
  repoKeyFor,
43
43
  reportEvent
44
- } from "../chunk-YXDYKECP.js";
44
+ } from "../chunk-5HGLZGI4.js";
45
45
  import {
46
46
  DEFAULT_SESSION,
47
47
  askUser,
@@ -53,25 +53,26 @@ import {
53
53
  removePendingCommand,
54
54
  savePendingCommand,
55
55
  waitForAnswer
56
- } from "../chunk-F7OURW3C.js";
56
+ } from "../chunk-RER3FRTD.js";
57
57
  import {
58
58
  UNNAMED_ACTION,
59
59
  deriveToolTarget,
60
60
  describeToolCall,
61
61
  scopePathFor
62
- } from "../chunk-L4E2BIJ2.js";
62
+ } from "../chunk-4PE2SQVM.js";
63
+ import "../chunk-Y3UGCQQC.js";
63
64
  import {
64
65
  getMachineId
65
- } from "../chunk-2ACC5M7F.js";
66
- import "../chunk-CV2YD2JR.js";
66
+ } from "../chunk-NVPYRDCT.js";
67
+ import "../chunk-Y6XXFXVB.js";
67
68
  import "../chunk-DINDL2CF.js";
68
- import "../chunk-OSALSIUF.js";
69
+ import "../chunk-6BIMJIRG.js";
69
70
  import "../chunk-BC3VCZ3E.js";
70
- import "../chunk-BSZYIAZL.js";
71
+ import "../chunk-EYRGBYZG.js";
71
72
  import "../chunk-SAF6HGAA.js";
72
73
  import "../chunk-7QLSKOSU.js";
73
74
  import "../chunk-KZERVKTD.js";
74
- import "../chunk-JW4KO5AF.js";
75
+ import "../chunk-ODL52O5V.js";
75
76
  import "../chunk-4LL6LG5X.js";
76
77
  import {
77
78
  getApiKey,
@@ -80,7 +81,7 @@ import {
80
81
  import {
81
82
  KILL_REASON,
82
83
  resolveGate
83
- } from "../chunk-VNMKIJZB.js";
84
+ } from "../chunk-Z6CP5ZZD.js";
84
85
 
85
86
  // src/wrapper/claudeBinary.ts
86
87
  import { statSync } from "fs";
@@ -240,7 +241,8 @@ var createSyncState = () => ({
240
241
  providerKeyId: null,
241
242
  seen: /* @__PURE__ */ new Set(),
242
243
  keyUploaded: false,
243
- keyRejected: false
244
+ keyRejected: false,
245
+ keyUnavailable: false
244
246
  });
245
247
  var syncTick = async (lines, state, uploader, sessionId, machineId) => {
246
248
  if (state.keyRejected) return state;
@@ -265,6 +267,7 @@ var syncTick = async (lines, state, uploader, sessionId, machineId) => {
265
267
  const seen = new Set(state.seen);
266
268
  let keyUploaded = state.keyUploaded;
267
269
  let keyRejected = false;
270
+ let keyUnavailable = false;
268
271
  let rejected = 0;
269
272
  for (const chunk of chunkRecords(built.records)) {
270
273
  const result = await uploader.uploadRecords({
@@ -280,6 +283,10 @@ var syncTick = async (lines, state, uploader, sessionId, machineId) => {
280
283
  keyRejected = true;
281
284
  break;
282
285
  }
286
+ if (result.keyUnavailable) {
287
+ keyUnavailable = true;
288
+ break;
289
+ }
283
290
  if (!result.ok) break;
284
291
  for (const id of result.settledIds ?? chunk.map((r) => r.localId)) seen.add(id);
285
292
  rejected += result.rejectedIds.length;
@@ -295,7 +302,8 @@ var syncTick = async (lines, state, uploader, sessionId, machineId) => {
295
302
  providerKeyId,
296
303
  seen,
297
304
  keyUploaded,
298
- keyRejected
305
+ keyRejected,
306
+ keyUnavailable
299
307
  };
300
308
  };
301
309
  var MAX_RECORDS_PER_BATCH = 200;
@@ -384,7 +392,7 @@ var startTranscriptSync = (opts) => {
384
392
  void (async () => {
385
393
  const before = state.sessionKey;
386
394
  await tick();
387
- const idle = state.sessionKey === null && before === null;
395
+ const idle = state.sessionKey === null && before === null || state.keyUnavailable;
388
396
  schedule(nextInterval(delayMs, idle, baseIntervalMs, maxIntervalMs));
389
397
  })();
390
398
  }, delayMs);
@@ -717,6 +725,9 @@ var createRemoteApprover = (deps) => {
717
725
  };
718
726
  };
719
727
 
728
+ // src/wrapper/authRejection.ts
729
+ var isAuthRejection = (status) => status === 401 || status === 403;
730
+
720
731
  // src/wrapper/drainClient.ts
721
732
  var drainPendingCommand = async (apiKey, sessionId, signal, baseUrl = getBaseUrl()) => {
722
733
  try {
@@ -729,11 +740,12 @@ var drainPendingCommand = async (apiKey, sessionId, signal, baseUrl = getBaseUrl
729
740
  body: JSON.stringify(sessionId ? { sessionId } : {}),
730
741
  signal
731
742
  });
732
- if (!response.ok) return null;
743
+ if (!response.ok) return { command: null, rejected: isAuthRejection(response.status) };
733
744
  const data = await response.json();
734
- return typeof data.command === "string" && data.command.length > 0 ? data.command : null;
745
+ const command = typeof data.command === "string" && data.command.length > 0 ? data.command : null;
746
+ return { command, rejected: false };
735
747
  } catch {
736
- return null;
748
+ return { command: null, rejected: false };
737
749
  }
738
750
  };
739
751
 
@@ -746,6 +758,7 @@ var MAX_ERROR_STREAK = 6;
746
758
  var REQUEST_TIMEOUT_MS = 1e4;
747
759
  var PollRejectedError = class extends Error {
748
760
  };
761
+ var EMPTY_DRAIN = { command: null, rejected: false };
749
762
  var startCommandPoller = (opts) => {
750
763
  const drain = opts.drain ?? drainPendingCommand;
751
764
  const slow = opts.slowPollMs ?? SLOW_POLL_MS;
@@ -813,11 +826,15 @@ var startCommandPoller = (opts) => {
813
826
  }
814
827
  }
815
828
  } else {
816
- ;
817
- [command] = await Promise.all([
818
- wantCommands ? drain(opts.apiKey, opts.getSessionId?.(), controller.signal) : Promise.resolve(null),
829
+ const [drained] = await Promise.all([
830
+ wantCommands ? drain(opts.apiKey, opts.getSessionId?.(), controller.signal) : Promise.resolve(EMPTY_DRAIN),
819
831
  fetchMode()
820
832
  ]);
833
+ if (drained.rejected) {
834
+ reportAuthRejection();
835
+ throw new PollRejectedError();
836
+ }
837
+ command = drained.command;
821
838
  }
822
839
  errorStreak = 0;
823
840
  if (command) {
@@ -861,7 +878,6 @@ var startCommandPoller = (opts) => {
861
878
 
862
879
  // src/wrapper/pollClient.ts
863
880
  var APPROVAL_MODES = /* @__PURE__ */ new Set(["push_only", "terminal_only", "push_first", "notify_only"]);
864
- var isRejection = (status) => status === 401 || status === 403;
865
881
  var pollAgent = async (apiKey, sessionId, wantCommand, signal, baseUrl = getBaseUrl(), machineId) => {
866
882
  try {
867
883
  const sessionKey = sessionId || DEFAULT_SESSION;
@@ -911,7 +927,7 @@ var pollAgent = async (apiKey, sessionId, wantCommand, signal, baseUrl = getBase
911
927
  }),
912
928
  signal
913
929
  });
914
- if (!response.ok) return { command: null, mode: null, rejected: isRejection(response.status) };
930
+ if (!response.ok) return { command: null, mode: null, rejected: isAuthRejection(response.status) };
915
931
  const data = await response.json();
916
932
  const claimedCommand = (id, text) => ({
917
933
  id,
@@ -9,16 +9,16 @@ import {
9
9
  restoreHookTakeover,
10
10
  restoreMcpServer,
11
11
  runHermesPythonScript
12
- } from "../chunk-QCXKQJTG.js";
12
+ } from "../chunk-FYOIW5RV.js";
13
13
  import {
14
14
  removeInstructionBlock,
15
15
  shortenHome,
16
16
  unregisterPluginLocation,
17
17
  vscodeSettingsTargets
18
- } from "../chunk-3HS4YGHB.js";
18
+ } from "../chunk-YANV5TGK.js";
19
19
  import {
20
20
  pusharyHookExecutable
21
- } from "../chunk-ZMKKK6DC.js";
21
+ } from "../chunk-HSAVPZ46.js";
22
22
  import {
23
23
  OPENCODE_PLUGIN_SIBLING,
24
24
  OPENCODE_PLUGIN_SIBLING_CONTENTS,
@@ -28,26 +28,26 @@ import {
28
28
  openCodePluginDir,
29
29
  openCodePluginFile,
30
30
  removeOpenCodeMcpServer
31
- } from "../chunk-CELX75MW.js";
31
+ } from "../chunk-BSEAOCCQ.js";
32
32
  import {
33
33
  isClaudeMcpSnapshot,
34
34
  removeClaudeMcpServers,
35
35
  removeGeminiSettings,
36
36
  removePusharySettings,
37
37
  restoreClaudeMcpServer
38
- } from "../chunk-I7W3UTDK.js";
39
- import "../chunk-2LAHXHBR.js";
38
+ } from "../chunk-RX75MRGC.js";
40
39
  import "../chunk-DSTLA2TC.js";
41
40
  import "../chunk-EZIEXHYM.js";
42
41
  import {
43
42
  disableDaemonService
44
- } from "../chunk-SQYBP3QQ.js";
43
+ } from "../chunk-ZTJF6ANY.js";
45
44
  import "../chunk-XHKBHWLX.js";
46
45
  import {
47
46
  execNpm
48
47
  } from "../chunk-L4ZCFMWW.js";
49
- import "../chunk-L4E2BIJ2.js";
50
- import "../chunk-2ACC5M7F.js";
48
+ import "../chunk-4PE2SQVM.js";
49
+ import "../chunk-Y3UGCQQC.js";
50
+ import "../chunk-NVPYRDCT.js";
51
51
  import {
52
52
  claudeJson,
53
53
  claudeMcpReceipt,
@@ -73,7 +73,7 @@ import {
73
73
  restoreCodexHookTrust,
74
74
  vscodePluginDir,
75
75
  vscodePluginMcp
76
- } from "../chunk-CV2YD2JR.js";
76
+ } from "../chunk-Y6XXFXVB.js";
77
77
  import {
78
78
  rejectUnknownFlags
79
79
  } from "../chunk-GMXKITVA.js";
@@ -94,7 +94,7 @@ import "../chunk-2UMNXADU.js";
94
94
  import {
95
95
  CURSOR_GATE_EVENTS,
96
96
  HOOK_LOCATOR_BINARY
97
- } from "../chunk-VNMKIJZB.js";
97
+ } from "../chunk-Z6CP5ZZD.js";
98
98
 
99
99
  // bin/pushary-clean.ts
100
100
  import { existsSync, readFileSync, copyFileSync, readdirSync } from "fs";
@@ -6,19 +6,19 @@ import {
6
6
  postLiveSession,
7
7
  postLiveSessionUntilAccepted,
8
8
  startLiveSessionHeartbeat
9
- } from "../chunk-CNPAT3HL.js";
10
- import "../chunk-7FE2KABY.js";
11
- import "../chunk-QZCFVWA7.js";
9
+ } from "../chunk-OB4RF2TF.js";
10
+ import "../chunk-46P3VES5.js";
11
+ import "../chunk-EQRS3SGM.js";
12
12
  import {
13
13
  transcriptsEnabled
14
- } from "../chunk-UZNKVRLE.js";
14
+ } from "../chunk-6WYL3XIP.js";
15
15
  import {
16
16
  SESSION_IDLE_TIMEOUT_MS,
17
17
  describeIdleWindow,
18
18
  idleDeadlinePassed,
19
19
  startProcessOwnership,
20
20
  withSpawnProcessOwnership
21
- } from "../chunk-4TFXV5MW.js";
21
+ } from "../chunk-TDUTNYAQ.js";
22
22
  import {
23
23
  spawnClaude
24
24
  } from "../chunk-XHKBHWLX.js";
@@ -27,17 +27,17 @@ import {
27
27
  } from "../chunk-L4ZCFMWW.js";
28
28
  import {
29
29
  getMachineId
30
- } from "../chunk-2ACC5M7F.js";
31
- import "../chunk-CV2YD2JR.js";
32
- import "../chunk-OSALSIUF.js";
30
+ } from "../chunk-NVPYRDCT.js";
31
+ import "../chunk-Y6XXFXVB.js";
32
+ import "../chunk-6BIMJIRG.js";
33
33
  import "../chunk-BC3VCZ3E.js";
34
- import "../chunk-JW4KO5AF.js";
34
+ import "../chunk-ODL52O5V.js";
35
35
  import "../chunk-4LL6LG5X.js";
36
36
  import {
37
37
  getApiKey,
38
38
  getBaseUrl
39
39
  } from "../chunk-2UMNXADU.js";
40
- import "../chunk-VNMKIJZB.js";
40
+ import "../chunk-Z6CP5ZZD.js";
41
41
 
42
42
  // bin/pushary-codex-bridge.ts
43
43
  import { existsSync } from "fs";
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  defersToNativeMode
4
- } from "../chunk-I463AEG3.js";
4
+ } from "../chunk-OYNPLEXP.js";
5
5
  import {
6
6
  isGatingMoment,
7
7
  recordKeylessMoment
8
- } from "../chunk-VHWCVD42.js";
8
+ } from "../chunk-2ORRI66J.js";
9
9
  import {
10
10
  readHookInput
11
11
  } from "../chunk-6CUUA7HO.js";
@@ -21,9 +21,11 @@ import {
21
21
  describeApplyPatch,
22
22
  fetchModeState,
23
23
  getPolicy,
24
+ handleCompaction,
24
25
  handlePostToolUse,
25
26
  handleSessionEnd,
26
27
  handleStop,
28
+ handleSubagentStop,
27
29
  handleUserPrompt,
28
30
  permissionTimeoutDecision,
29
31
  policyRequestFor,
@@ -34,7 +36,7 @@ import {
34
36
  toCodexWire,
35
37
  toPolicyLookup,
36
38
  toPolicyLookups
37
- } from "../chunk-YXDYKECP.js";
39
+ } from "../chunk-5HGLZGI4.js";
38
40
  import {
39
41
  DEFAULT_SESSION,
40
42
  askUser,
@@ -42,26 +44,28 @@ import {
42
44
  pollForAnswer,
43
45
  savePendingQuestion,
44
46
  sendNotification
45
- } from "../chunk-F7OURW3C.js";
47
+ } from "../chunk-RER3FRTD.js";
46
48
  import {
47
49
  UNNAMED_ACTION,
48
50
  deriveActionBody,
49
51
  deriveBlocker,
50
52
  deriveToolTarget,
51
53
  describeToolCall,
52
- scopePathFor
53
- } from "../chunk-L4E2BIJ2.js";
54
+ scopePathFor,
55
+ sessionIdentityOf
56
+ } from "../chunk-4PE2SQVM.js";
57
+ import "../chunk-Y3UGCQQC.js";
54
58
  import {
55
59
  getMachineId
56
- } from "../chunk-2ACC5M7F.js";
60
+ } from "../chunk-NVPYRDCT.js";
57
61
  import {
58
62
  canonicalJson
59
- } from "../chunk-CV2YD2JR.js";
60
- import "../chunk-BSZYIAZL.js";
63
+ } from "../chunk-Y6XXFXVB.js";
64
+ import "../chunk-EYRGBYZG.js";
61
65
  import "../chunk-SAF6HGAA.js";
62
66
  import "../chunk-7QLSKOSU.js";
63
67
  import "../chunk-KZERVKTD.js";
64
- import "../chunk-JW4KO5AF.js";
68
+ import "../chunk-ODL52O5V.js";
65
69
  import "../chunk-4LL6LG5X.js";
66
70
  import {
67
71
  getApiKey
@@ -73,7 +77,7 @@ import {
73
77
  hookWaitClamped,
74
78
  hookWaitDeadline,
75
79
  resolveGate
76
- } from "../chunk-VNMKIJZB.js";
80
+ } from "../chunk-Z6CP5ZZD.js";
77
81
 
78
82
  // bin/pushary-codex-hook.ts
79
83
  import { basename } from "path";
@@ -388,14 +392,17 @@ var decidePreToolUse = async (input) => {
388
392
  return codexPass();
389
393
  }
390
394
  };
391
- var reportSessionStart = async (input) => {
395
+ var reportSessionStart = async (input, action = "Session started") => {
392
396
  try {
393
397
  await reportEvent({
394
398
  event: "session_begin",
395
399
  agentType: CODEX_AGENT.type,
396
400
  agentName: agentNameFor(input),
397
- action: "Session started",
398
- sessionId: input.session_id
401
+ action,
402
+ // Not `sessionId: input.session_id`. On SubagentStart that would announce
403
+ // the parent session a second time under the same id; this gives the
404
+ // subagent its own row and names the parent beside it.
405
+ ...sessionIdentityOf(input)
399
406
  }, { maxAttempts: 1, timeoutMs: 5e3 });
400
407
  } catch {
401
408
  }
@@ -458,6 +465,33 @@ var main = async () => {
458
465
  reason: input.reason
459
466
  }, CODEX_AGENT, { reconcile: false, reportAttempts: 1, reportTimeoutMs: 1200 });
460
467
  break;
468
+ // Observability only, and none of them carries context back, so none uses
469
+ // emitContext. Each goes through the same handler Claude Code's own hook
470
+ // does, rather than a Codex-shaped copy of it, so the two agents cannot
471
+ // drift into reporting the same moment differently.
472
+ case "SubagentStart":
473
+ await reportSessionStart(input, "Subagent started");
474
+ break;
475
+ case "SubagentStop":
476
+ await handleSubagentStop({
477
+ hook_event_name: input.hook_event_name,
478
+ cwd: input.cwd,
479
+ session_id: input.session_id,
480
+ agent_id: input.agent_id,
481
+ agent_type: input.agent_type,
482
+ last_assistant_message: input.last_assistant_message
483
+ }, CODEX_AGENT);
484
+ break;
485
+ case "PreCompact":
486
+ case "PostCompact":
487
+ await handleCompaction({
488
+ hook_event_name: input.hook_event_name,
489
+ trigger: input.trigger,
490
+ cwd: input.cwd,
491
+ session_id: input.session_id,
492
+ agent_id: input.agent_id
493
+ }, CODEX_AGENT);
494
+ break;
461
495
  default:
462
496
  break;
463
497
  }
@@ -1,26 +1,27 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  reportEvent
4
- } from "../chunk-YXDYKECP.js";
4
+ } from "../chunk-5HGLZGI4.js";
5
5
  import {
6
6
  askUser,
7
7
  waitForAnswer
8
- } from "../chunk-F7OURW3C.js";
9
- import "../chunk-L4E2BIJ2.js";
8
+ } from "../chunk-RER3FRTD.js";
9
+ import "../chunk-4PE2SQVM.js";
10
+ import "../chunk-Y3UGCQQC.js";
10
11
  import {
11
12
  getMachineId
12
- } from "../chunk-2ACC5M7F.js";
13
- import "../chunk-CV2YD2JR.js";
14
- import "../chunk-BSZYIAZL.js";
13
+ } from "../chunk-NVPYRDCT.js";
14
+ import "../chunk-Y6XXFXVB.js";
15
+ import "../chunk-EYRGBYZG.js";
15
16
  import "../chunk-SAF6HGAA.js";
16
17
  import "../chunk-7QLSKOSU.js";
17
18
  import "../chunk-KZERVKTD.js";
18
- import "../chunk-JW4KO5AF.js";
19
+ import "../chunk-ODL52O5V.js";
19
20
  import "../chunk-4LL6LG5X.js";
20
21
  import {
21
22
  getApiKey
22
23
  } from "../chunk-2UMNXADU.js";
23
- import "../chunk-VNMKIJZB.js";
24
+ import "../chunk-Z6CP5ZZD.js";
24
25
 
25
26
  // bin/pushary-codex.ts
26
27
  import { basename } from "path";
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  printKeyCheck
4
- } from "../chunk-Z6RFZKY4.js";
4
+ } from "../chunk-WY4ALDYN.js";
5
5
  import {
6
6
  connectDevice,
7
7
  connectExistingApp,
8
8
  printConnectInstructions
9
- } from "../chunk-PYA4FLKI.js";
9
+ } from "../chunk-ROHFVGXM.js";
10
10
  import "../chunk-3EGEA4KH.js";
11
11
  import {
12
12
  checkApiKey
13
- } from "../chunk-BXTJVM7O.js";
13
+ } from "../chunk-UZFVNEEU.js";
14
14
  import "../chunk-QCGNGEGE.js";
15
15
  import {
16
16
  createIo
@@ -25,9 +25,9 @@ import "../chunk-43GMYSS4.js";
25
25
  import "../chunk-DINDL2CF.js";
26
26
  import {
27
27
  readKeySource
28
- } from "../chunk-OSALSIUF.js";
28
+ } from "../chunk-6BIMJIRG.js";
29
29
  import "../chunk-BC3VCZ3E.js";
30
- import "../chunk-BSZYIAZL.js";
30
+ import "../chunk-EYRGBYZG.js";
31
31
  import "../chunk-SAF6HGAA.js";
32
32
  import {
33
33
  UsageError
@@ -35,10 +35,10 @@ import {
35
35
  import {
36
36
  EXIT
37
37
  } from "../chunk-KZERVKTD.js";
38
- import "../chunk-JW4KO5AF.js";
38
+ import "../chunk-ODL52O5V.js";
39
39
  import "../chunk-4LL6LG5X.js";
40
40
  import "../chunk-2UMNXADU.js";
41
- import "../chunk-VNMKIJZB.js";
41
+ import "../chunk-Z6CP5ZZD.js";
42
42
 
43
43
  // bin/pushary-connect.ts
44
44
  exitOnHelpFlag("connect");