@pushary/agent-hooks 0.89.3 → 0.89.4

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 (56) hide show
  1. package/README.md +40 -0
  2. package/dist/bin/pushary-bell-hook.js +3 -3
  3. package/dist/bin/pushary-bell.js +9 -10
  4. package/dist/bin/pushary-claude.js +62 -26
  5. package/dist/bin/pushary-clean.js +28 -7
  6. package/dist/bin/pushary-codex-bridge.js +4 -5
  7. package/dist/bin/pushary-codex-hook.js +8 -7
  8. package/dist/bin/pushary-codex.js +6 -4
  9. package/dist/bin/pushary-connect.js +4 -4
  10. package/dist/bin/pushary-daemon.js +141 -21
  11. package/dist/bin/pushary-disconnect.js +3 -4
  12. package/dist/bin/pushary-doctor.js +31 -20
  13. package/dist/bin/pushary-elicitation-hook.js +4 -2
  14. package/dist/bin/pushary-gemini-bridge.js +3 -4
  15. package/dist/bin/pushary-gemini-hook.js +6 -4
  16. package/dist/bin/pushary-hook.js +9 -7
  17. package/dist/bin/pushary-login.js +4 -4
  18. package/dist/bin/pushary-logout.js +5 -6
  19. package/dist/bin/pushary-mode.js +2 -2
  20. package/dist/bin/pushary-notification-hook.js +6 -4
  21. package/dist/bin/pushary-opencode-hook.js +14 -6
  22. package/dist/bin/pushary-permission-denied-hook.js +7 -5
  23. package/dist/bin/pushary-permission-hook.js +7 -5
  24. package/dist/bin/pushary-post-hook.js +6 -4
  25. package/dist/bin/pushary-prompt-hook.js +6 -4
  26. package/dist/bin/pushary-session-end-hook.js +6 -4
  27. package/dist/bin/pushary-session-start-hook.js +6 -4
  28. package/dist/bin/pushary-setup.js +49 -28
  29. package/dist/bin/pushary-stats.js +2 -2
  30. package/dist/bin/pushary-status.js +7 -6
  31. package/dist/bin/pushary-stop-hook.js +6 -4
  32. package/dist/bin/pushary-stopfailure-hook.js +6 -4
  33. package/dist/bin/pushary-suggestions.js +2 -2
  34. package/dist/bin/pushary-upgrade.js +63 -28
  35. package/dist/bin/pushary-wait.js +2 -2
  36. package/dist/bin/pushary.js +1 -1
  37. package/dist/chunk-2HYPZLYY.js +45 -0
  38. package/dist/{chunk-ZYPS2XMT.js → chunk-4ZHQNBDP.js} +1 -1
  39. package/dist/{chunk-B7JE4XHD.js → chunk-7IJYOBHL.js} +1 -1
  40. package/dist/{chunk-NRGRUOAR.js → chunk-FWUEYXSD.js} +4 -0
  41. package/dist/{chunk-HUJAAWNL.js → chunk-GKAKAOKC.js} +10 -3
  42. package/dist/{chunk-GOEXZ5QJ.js → chunk-GPNOHKFO.js} +9 -2
  43. package/dist/{chunk-SQOFGPNX.js → chunk-KJ57OPCC.js} +1 -1
  44. package/dist/{chunk-LGXTBUT4.js → chunk-KOPUTJQC.js} +1 -0
  45. package/dist/{chunk-JT6TIBYH.js → chunk-MZBT2LXW.js} +4 -4
  46. package/dist/{chunk-3UBYTSCY.js → chunk-NFI2K2ZQ.js} +15 -7
  47. package/dist/{chunk-K42SZKYF.js → chunk-NLMSSKES.js} +251 -6
  48. package/dist/{chunk-3O2XPYLF.js → chunk-OBI4YMCT.js} +1 -1
  49. package/dist/{chunk-LUCFN47K.js → chunk-QH4AA7QV.js} +1 -1
  50. package/dist/{chunk-VKVHY5HD.js → chunk-V37ZXMH3.js} +11 -3
  51. package/dist/{chunk-MHBC2XUP.js → chunk-VP7SDXYG.js} +1 -1
  52. package/dist/src/index.js +7 -5
  53. package/package.json +1 -1
  54. package/dist/chunk-GIRT7677.js +0 -11
  55. package/dist/chunk-RN3NOEJF.js +0 -9
  56. package/dist/{chunk-LALHWDWL.js → chunk-W6NPWHBJ.js} +3 -3
@@ -2,22 +2,29 @@
2
2
  import {
3
3
  HEARTBEAT_INTERVAL_MS,
4
4
  sendHeartbeat
5
- } from "../chunk-MHBC2XUP.js";
5
+ } from "../chunk-VP7SDXYG.js";
6
6
  import {
7
7
  DAEMON_LEASE_RENEW_INTERVAL_MS,
8
8
  acquireDaemonLease,
9
+ ensureDaemonRunning,
10
+ manageDaemonService,
11
+ parseDaemonAction,
9
12
  readDaemonStatus,
10
- requestDaemonHandoff
11
- } from "../chunk-K42SZKYF.js";
13
+ replaceDaemonService,
14
+ requestDaemonHandoff,
15
+ stopDaemonRunning
16
+ } from "../chunk-NLMSSKES.js";
12
17
  import {
18
+ CLAUDE_BRIDGE_CAPABILITY,
19
+ CLAUDE_RESUME_CAPABILITY,
13
20
  CODEX_BRIDGE_CAPABILITY,
14
21
  CODEX_RESUME_CAPABILITY,
15
22
  geminiLiveCapabilities
16
- } from "../chunk-NRGRUOAR.js";
23
+ } from "../chunk-FWUEYXSD.js";
17
24
  import {
18
25
  findLiveProcessBySpawnId,
19
26
  ownsLiveProcess
20
- } from "../chunk-ZYPS2XMT.js";
27
+ } from "../chunk-4ZHQNBDP.js";
21
28
  import {
22
29
  spawnClaude
23
30
  } from "../chunk-XHKBHWLX.js";
@@ -26,20 +33,19 @@ import {
26
33
  resolveGlobalPackageVersion,
27
34
  resolvePackageVersionFromBinary
28
35
  } from "../chunk-PZA7G4CN.js";
29
- import "../chunk-VKVHY5HD.js";
30
- import "../chunk-GIRT7677.js";
31
36
  import {
32
37
  getMachineId
33
- } from "../chunk-RN3NOEJF.js";
38
+ } from "../chunk-2HYPZLYY.js";
39
+ import "../chunk-V37ZXMH3.js";
34
40
  import {
35
41
  exitOnHelpFlag
36
- } from "../chunk-SQOFGPNX.js";
37
- import "../chunk-GOEXZ5QJ.js";
42
+ } from "../chunk-KJ57OPCC.js";
43
+ import "../chunk-GPNOHKFO.js";
38
44
  import "../chunk-DINDL2CF.js";
39
- import "../chunk-6MTNS63X.js";
40
45
  import {
41
46
  EXIT
42
47
  } from "../chunk-KZERVKTD.js";
48
+ import "../chunk-6MTNS63X.js";
43
49
  import {
44
50
  getApiKey,
45
51
  getBaseUrl
@@ -48,7 +54,8 @@ import "../chunk-L4C2JXJS.js";
48
54
 
49
55
  // src/spawn-daemon.ts
50
56
  import { execFileSync, spawn } from "child_process";
51
- import { existsSync } from "fs";
57
+ import { existsSync, statSync } from "fs";
58
+ import { homedir } from "os";
52
59
  import { basename, dirname, join } from "path";
53
60
 
54
61
  // src/stop-requests.ts
@@ -167,6 +174,29 @@ var isAuthFailure = (err) => {
167
174
  if (candidate.name !== "DrainError") return false;
168
175
  return candidate.status === 401 || candidate.status === 403;
169
176
  };
177
+ var providerLaunchError = (requestedAgent, binaries) => {
178
+ const agent = requestedAgent === "codex" || requestedAgent === "gemini" ? requestedAgent : "claude";
179
+ if (binaries[agent]) return null;
180
+ return agent === "claude" ? "Claude Code is not installed on this machine" : `${agent === "codex" ? "Codex" : "Gemini"} CLI is not installed on this machine`;
181
+ };
182
+ var resolveSpawnDirectory = (requested, options = {}) => {
183
+ const fallbackDir = options.fallbackDir ?? process.cwd();
184
+ const value = requested?.trim();
185
+ if (!value) return { ok: true, cwd: fallbackDir };
186
+ const homeDir = options.homeDir ?? homedir();
187
+ const cwd = value === "~" ? homeDir : value.startsWith("~/") || value.startsWith("~\\") ? join(homeDir, value.slice(2)) : value;
188
+ if (!(options.exists ?? existsSync)(cwd)) {
189
+ return { ok: false, message: `Directory does not exist: ${value}` };
190
+ }
191
+ try {
192
+ if (!(options.isDirectory ?? ((path) => statSync(path).isDirectory()))(cwd)) {
193
+ return { ok: false, message: `Not a directory: ${value}` };
194
+ }
195
+ } catch {
196
+ return { ok: false, message: `Not a directory: ${value}` };
197
+ }
198
+ return { ok: true, cwd };
199
+ };
170
200
  var isFlagShapedPrompt = (prompt) => prompt.trimStart().startsWith("-");
171
201
  var buildSpawnLaunch = (req, opts) => {
172
202
  if (isFlagShapedPrompt(req.prompt)) return null;
@@ -209,6 +239,7 @@ var runSpawnDaemon = async () => {
209
239
  const machineId = getMachineId();
210
240
  const baseUrl = getBaseUrl();
211
241
  const pusharyBin = resolveBinary("pushary") ?? "pushary";
242
+ const claudeBin = resolveBinary("claude");
212
243
  const codexBin = resolveBinary("codex");
213
244
  const geminiBin = resolveBinary("gemini");
214
245
  const geminiCapabilities = geminiBin ? geminiLiveCapabilities(
@@ -261,8 +292,18 @@ var runSpawnDaemon = async () => {
261
292
  if (launchedProcesses.size >= MAX_TRACKED_PROCESSES) {
262
293
  return Promise.reject(new Error("This daemon is already tracking 100 active sessions"));
263
294
  }
295
+ const directory = resolveSpawnDirectory(req.cwd);
296
+ if (!directory.ok) return Promise.reject(new Error(directory.message));
297
+ const agent = req.agent === "codex" || req.agent === "gemini" ? req.agent : "claude";
298
+ const providerBin = resolveBinary(agent);
299
+ const unavailable = providerLaunchError(req.agent, {
300
+ claude: agent === "claude" ? providerBin ?? null : null,
301
+ codex: agent === "codex" ? providerBin ?? null : null,
302
+ gemini: agent === "gemini" ? providerBin ?? null : null
303
+ });
304
+ if (unavailable) return Promise.reject(new Error(unavailable));
264
305
  spawnTimestamps.push(Date.now());
265
- const cwd = req.cwd && existsSync(req.cwd) ? req.cwd : process.cwd();
306
+ const cwd = directory.cwd;
266
307
  const env = {
267
308
  ...process.env,
268
309
  PUSHARY_SPAWN_ID: req.id,
@@ -274,10 +315,10 @@ var runSpawnDaemon = async () => {
274
315
  PUSHARY_BRIDGE_RESUME_SESSION_ID: req.resumeSessionId || void 0
275
316
  } : {},
276
317
  ...req.agent === "codex" ? {
277
- PUSHARY_CODEX_COMMAND: codexBin ?? "codex"
318
+ PUSHARY_CODEX_COMMAND: providerBin ?? "codex"
278
319
  } : {},
279
320
  ...req.agent === "gemini" ? {
280
- PUSHARY_GEMINI_COMMAND: geminiBin ?? "gemini"
321
+ PUSHARY_GEMINI_COMMAND: providerBin ?? "gemini"
281
322
  } : {}
282
323
  };
283
324
  const plan = buildSpawnLaunch(req, {
@@ -504,6 +545,7 @@ var runSpawnDaemon = async () => {
504
545
  "spawn",
505
546
  STOP_CAPABILITY,
506
547
  STOP_ACK_CAPABILITY,
548
+ ...claudeBin ? [CLAUDE_BRIDGE_CAPABILITY, CLAUDE_RESUME_CAPABILITY] : [],
507
549
  ...codexBin ? [CODEX_BRIDGE_CAPABILITY, CODEX_RESUME_CAPABILITY] : [],
508
550
  ...geminiCapabilities
509
551
  ]
@@ -541,10 +583,88 @@ var runSpawnDaemon = async () => {
541
583
 
542
584
  // bin/pushary-daemon.ts
543
585
  exitOnHelpFlag("daemon");
544
- runSpawnDaemon().then((code) => process.exit(code)).catch((err) => {
545
- process.stderr.write(
546
- `[pushary] daemon error: ${err instanceof Error ? err.message : String(err)}
547
- `
548
- );
549
- process.exit(1);
586
+ var serviceFailure = (result) => result.kind === "ok" ? null : result.detail;
587
+ var applyService = (action) => serviceFailure(manageDaemonService(action));
588
+ var waitForManagedDaemon = async () => {
589
+ const result = await ensureDaemonRunning({ spawnDaemon: () => {
590
+ } });
591
+ return "detail" in result ? result.detail : null;
592
+ };
593
+ var main = async () => {
594
+ const action = parseDaemonAction(process.argv.slice(2));
595
+ if (!action) {
596
+ process.stderr.write("Unknown daemon action. Use install, start, stop, restart, status, uninstall, or foreground.\n");
597
+ return EXIT.USAGE;
598
+ }
599
+ if (action === "foreground") return await runSpawnDaemon();
600
+ if (action === "status") {
601
+ const status = readDaemonStatus();
602
+ process.stdout.write(`Pushary daemon: ${status.kind}${status.pid ? ` (pid ${status.pid})` : ""}
603
+ `);
604
+ return status.kind === "running" ? EXIT.OK : EXIT.UNREACHABLE;
605
+ }
606
+ if (action === "install") {
607
+ const installed = await replaceDaemonService();
608
+ if (installed.kind !== "ok") {
609
+ process.stderr.write(`[pushary] daemon service install failed: ${installed.detail}
610
+ `);
611
+ return EXIT.FAILED;
612
+ }
613
+ const unhealthy = await waitForManagedDaemon();
614
+ if (unhealthy) {
615
+ process.stderr.write(`[pushary] daemon service installed but unavailable: ${unhealthy}
616
+ `);
617
+ return EXIT.UNREACHABLE;
618
+ }
619
+ process.stdout.write("[pushary] daemon service installed and online\n");
620
+ return EXIT.OK;
621
+ }
622
+ if (action === "start") {
623
+ const failed2 = applyService("start");
624
+ if (failed2) {
625
+ process.stderr.write(`[pushary] daemon service could not start: ${failed2}
626
+ `);
627
+ return EXIT.FAILED;
628
+ }
629
+ const unhealthy = await waitForManagedDaemon();
630
+ if (unhealthy) {
631
+ process.stderr.write(`[pushary] daemon service did not become healthy: ${unhealthy}
632
+ `);
633
+ return EXIT.UNREACHABLE;
634
+ }
635
+ process.stdout.write("[pushary] daemon service online\n");
636
+ return EXIT.OK;
637
+ }
638
+ const serviceAction = action === "uninstall" ? "uninstall" : "stop";
639
+ const failed = applyService(serviceAction);
640
+ const stopped = await stopDaemonRunning();
641
+ if (failed || stopped.kind === "unavailable") {
642
+ const detail = [failed, stopped.kind === "unavailable" ? stopped.detail : null].filter(Boolean).join("; ");
643
+ process.stderr.write(`[pushary] daemon could not stop: ${detail}
644
+ `);
645
+ return EXIT.FAILED;
646
+ }
647
+ if (action === "restart") {
648
+ const startFailed = applyService("start");
649
+ if (startFailed) {
650
+ process.stderr.write(`[pushary] daemon service could not restart: ${startFailed}
651
+ `);
652
+ return EXIT.FAILED;
653
+ }
654
+ const unhealthy = await waitForManagedDaemon();
655
+ if (unhealthy) {
656
+ process.stderr.write(`[pushary] daemon service did not become healthy: ${unhealthy}
657
+ `);
658
+ return EXIT.UNREACHABLE;
659
+ }
660
+ process.stdout.write("[pushary] daemon service restarted\n");
661
+ return EXIT.OK;
662
+ }
663
+ process.stdout.write(action === "uninstall" ? "[pushary] daemon service removed\n" : "[pushary] daemon stopped\n");
664
+ return EXIT.OK;
665
+ };
666
+ main().then((code) => process.exit(code)).catch((err) => {
667
+ process.stderr.write(`[pushary] daemon error: ${err instanceof Error ? err.message : String(err)}
668
+ `);
669
+ process.exit(EXIT.FAILED);
550
670
  });
@@ -29,12 +29,11 @@ import {
29
29
  geminiSettings,
30
30
  removeCodexHooks,
31
31
  removeCodexSettings
32
- } from "../chunk-VKVHY5HD.js";
33
- import "../chunk-GIRT7677.js";
32
+ } from "../chunk-V37ZXMH3.js";
34
33
  import {
35
34
  exitOnHelpFlag
36
- } from "../chunk-SQOFGPNX.js";
37
- import "../chunk-GOEXZ5QJ.js";
35
+ } from "../chunk-KJ57OPCC.js";
36
+ import "../chunk-GPNOHKFO.js";
38
37
  import "../chunk-DINDL2CF.js";
39
38
  import "../chunk-KZERVKTD.js";
40
39
  import "../chunk-L4C2JXJS.js";
@@ -7,10 +7,7 @@ import {
7
7
  codexWired,
8
8
  geminiWired,
9
9
  pusharyHookExecutable
10
- } from "../chunk-3O2XPYLF.js";
11
- import {
12
- readDaemonStatus
13
- } from "../chunk-K42SZKYF.js";
10
+ } from "../chunk-OBI4YMCT.js";
14
11
  import {
15
12
  agentProbes,
16
13
  detectAgent,
@@ -19,7 +16,7 @@ import {
19
16
  isDetected,
20
17
  isPluginRegistered,
21
18
  vscodeSettingsTargets
22
- } from "../chunk-LUCFN47K.js";
19
+ } from "../chunk-QH4AA7QV.js";
23
20
  import {
24
21
  OPENCODE_PLUGIN_PLACEHOLDER,
25
22
  openCodePluginDir,
@@ -33,10 +30,20 @@ import {
33
30
  } from "../chunk-7TS2G4QG.js";
34
31
  import "../chunk-ATBKJNWS.js";
35
32
  import "../chunk-AIGDBRIJ.js";
33
+ import {
34
+ readDaemonStatus
35
+ } from "../chunk-NLMSSKES.js";
36
36
  import "../chunk-XHKBHWLX.js";
37
37
  import {
38
38
  execNpm
39
39
  } from "../chunk-PZA7G4CN.js";
40
+ import {
41
+ readLedgerSummary
42
+ } from "../chunk-VZKXBFUA.js";
43
+ import "../chunk-KOPUTJQC.js";
44
+ import {
45
+ getMachineId
46
+ } from "../chunk-2HYPZLYY.js";
40
47
  import {
41
48
  claudeJson,
42
49
  claudeSettings,
@@ -56,15 +63,7 @@ import {
56
63
  readCodexMcpAuth,
57
64
  untrustedCodexHookEvents,
58
65
  vscodePluginDir
59
- } from "../chunk-VKVHY5HD.js";
60
- import {
61
- readLedgerSummary
62
- } from "../chunk-VZKXBFUA.js";
63
- import "../chunk-GIRT7677.js";
64
- import "../chunk-LGXTBUT4.js";
65
- import {
66
- getMachineId
67
- } from "../chunk-RN3NOEJF.js";
66
+ } from "../chunk-V37ZXMH3.js";
68
67
  import {
69
68
  describeReach,
70
69
  describeRoundTrip,
@@ -83,19 +82,18 @@ import {
83
82
  import {
84
83
  keyPrefix,
85
84
  readKeySource
86
- } from "../chunk-LALHWDWL.js";
85
+ } from "../chunk-W6NPWHBJ.js";
87
86
  import {
88
87
  parseFlags
89
88
  } from "../chunk-GMXKITVA.js";
90
89
  import {
91
90
  exitOnHelpFlag
92
- } from "../chunk-SQOFGPNX.js";
93
- import "../chunk-GOEXZ5QJ.js";
91
+ } from "../chunk-KJ57OPCC.js";
92
+ import "../chunk-GPNOHKFO.js";
94
93
  import "../chunk-BC3VCZ3E.js";
95
94
  import {
96
95
  getPackageVersion
97
96
  } from "../chunk-DINDL2CF.js";
98
- import "../chunk-6MTNS63X.js";
99
97
  import {
100
98
  callMcpTool,
101
99
  sendMcpRequest
@@ -108,6 +106,7 @@ import {
108
106
  import {
109
107
  EXIT
110
108
  } from "../chunk-KZERVKTD.js";
109
+ import "../chunk-6MTNS63X.js";
111
110
  import {
112
111
  getBaseUrl
113
112
  } from "../chunk-2UMNXADU.js";
@@ -177,6 +176,17 @@ var resolveDoctorExit = ({ keyExit, failures }) => {
177
176
  return EXIT.PROBLEMS_FOUND;
178
177
  };
179
178
 
179
+ // src/setup/agent-exec.ts
180
+ var firstToken = (command) => {
181
+ const trimmed = command.trim();
182
+ const quote = trimmed[0];
183
+ if (quote === '"' || quote === "'") {
184
+ const close = trimmed.indexOf(quote, 1);
185
+ if (close > 0) return trimmed.slice(1, close);
186
+ }
187
+ return trimmed.split(/\s+/)[0] ?? "";
188
+ };
189
+
180
190
  // bin/pushary-doctor.ts
181
191
  exitOnHelpFlag("doctor");
182
192
  var parseDoctorOptions = (argv) => {
@@ -221,7 +231,8 @@ var readJson = (path) => {
221
231
  }
222
232
  };
223
233
  var commandResolves = (command) => {
224
- const target = pusharyHookExecutable(command) ?? command;
234
+ const target = pusharyHookExecutable(command) ?? firstToken(command);
235
+ if (!target) return false;
225
236
  if (target.includes("/") || target.includes("\\")) return existsSync(target);
226
237
  try {
227
238
  const whichCmd = process.platform === "win32" ? "where" : "which";
@@ -346,7 +357,7 @@ var main = async () => {
346
357
  const daemon = readDaemonStatus();
347
358
  const daemonOk = daemon.kind === "running";
348
359
  const daemonFailure = daemonOk ? null : `local state is ${daemon.kind}`;
349
- const daemonDetail = daemonFailure ? `${daemonFailure}; run \`pushary daemon\` in a terminal to inspect it` : null;
360
+ const daemonDetail = daemonFailure ? `${daemonFailure}; run \`pushary daemon install\` to install or repair the background service` : null;
350
361
  check(
351
362
  daemonOk,
352
363
  "Remote-control daemon",
@@ -11,14 +11,16 @@ import {
11
11
  cancelQuestion,
12
12
  pollForAnswer,
13
13
  savePendingQuestion
14
- } from "../chunk-HUJAAWNL.js";
14
+ } from "../chunk-GKAKAOKC.js";
15
15
  import {
16
16
  getMachineId
17
- } from "../chunk-RN3NOEJF.js";
17
+ } from "../chunk-2HYPZLYY.js";
18
+ import "../chunk-V37ZXMH3.js";
18
19
  import "../chunk-BSZYIAZL.js";
19
20
  import "../chunk-SAF6HGAA.js";
20
21
  import "../chunk-7QLSKOSU.js";
21
22
  import "../chunk-KZERVKTD.js";
23
+ import "../chunk-6MTNS63X.js";
22
24
  import {
23
25
  getApiKey
24
26
  } from "../chunk-2UMNXADU.js";
@@ -10,18 +10,17 @@ import "../chunk-PMHTCDEO.js";
10
10
  import {
11
11
  startProcessOwnership,
12
12
  withSpawnProcessOwnership
13
- } from "../chunk-ZYPS2XMT.js";
13
+ } from "../chunk-4ZHQNBDP.js";
14
14
  import {
15
15
  spawnClaude
16
16
  } from "../chunk-XHKBHWLX.js";
17
17
  import {
18
18
  resolveBinary
19
19
  } from "../chunk-PZA7G4CN.js";
20
- import "../chunk-VKVHY5HD.js";
21
- import "../chunk-GIRT7677.js";
22
20
  import {
23
21
  getMachineId
24
- } from "../chunk-RN3NOEJF.js";
22
+ } from "../chunk-2HYPZLYY.js";
23
+ import "../chunk-V37ZXMH3.js";
25
24
  import "../chunk-6MTNS63X.js";
26
25
  import {
27
26
  getApiKey,
@@ -21,7 +21,7 @@ import {
21
21
  readLastUserPrompt,
22
22
  repoKeyFor,
23
23
  reportEvent
24
- } from "../chunk-3UBYTSCY.js";
24
+ } from "../chunk-NFI2K2ZQ.js";
25
25
  import {
26
26
  DEFAULT_SESSION,
27
27
  askUser,
@@ -29,22 +29,24 @@ import {
29
29
  savePendingQuestion,
30
30
  sendNotification,
31
31
  waitForAnswer
32
- } from "../chunk-HUJAAWNL.js";
32
+ } from "../chunk-GKAKAOKC.js";
33
33
  import {
34
34
  deriveActionBody,
35
35
  deriveBlocker,
36
36
  deriveToolTarget,
37
37
  describeToolCall,
38
38
  scopePathFor
39
- } from "../chunk-LGXTBUT4.js";
39
+ } from "../chunk-KOPUTJQC.js";
40
40
  import {
41
41
  getMachineId
42
- } from "../chunk-RN3NOEJF.js";
42
+ } from "../chunk-2HYPZLYY.js";
43
+ import "../chunk-V37ZXMH3.js";
43
44
  import "../chunk-BSZYIAZL.js";
44
45
  import "../chunk-SAF6HGAA.js";
45
46
  import "../chunk-OFRNZWC4.js";
46
47
  import "../chunk-7QLSKOSU.js";
47
48
  import "../chunk-KZERVKTD.js";
49
+ import "../chunk-6MTNS63X.js";
48
50
  import {
49
51
  getApiKey
50
52
  } from "../chunk-2UMNXADU.js";
@@ -1,27 +1,29 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  handlePreToolUse
4
- } from "../chunk-JT6TIBYH.js";
4
+ } from "../chunk-MZBT2LXW.js";
5
5
  import "../chunk-ATBKJNWS.js";
6
6
  import "../chunk-VZKXBFUA.js";
7
7
  import {
8
8
  readHookInput
9
9
  } from "../chunk-6CUUA7HO.js";
10
10
  import "../chunk-YHG74UFF.js";
11
- import "../chunk-3UBYTSCY.js";
12
- import "../chunk-HUJAAWNL.js";
13
- import "../chunk-LGXTBUT4.js";
14
- import "../chunk-RN3NOEJF.js";
11
+ import "../chunk-NFI2K2ZQ.js";
12
+ import "../chunk-GKAKAOKC.js";
13
+ import "../chunk-KOPUTJQC.js";
14
+ import "../chunk-2HYPZLYY.js";
15
+ import "../chunk-V37ZXMH3.js";
15
16
  import {
16
17
  exitOnHelpFlag
17
- } from "../chunk-SQOFGPNX.js";
18
- import "../chunk-GOEXZ5QJ.js";
18
+ } from "../chunk-KJ57OPCC.js";
19
+ import "../chunk-GPNOHKFO.js";
19
20
  import "../chunk-DINDL2CF.js";
20
21
  import "../chunk-BSZYIAZL.js";
21
22
  import "../chunk-SAF6HGAA.js";
22
23
  import "../chunk-OFRNZWC4.js";
23
24
  import "../chunk-7QLSKOSU.js";
24
25
  import "../chunk-KZERVKTD.js";
26
+ import "../chunk-6MTNS63X.js";
25
27
  import "../chunk-2UMNXADU.js";
26
28
  import "../chunk-L4C2JXJS.js";
27
29
 
@@ -13,19 +13,18 @@ import {
13
13
  import {
14
14
  readKeySource,
15
15
  writeKey
16
- } from "../chunk-LALHWDWL.js";
16
+ } from "../chunk-W6NPWHBJ.js";
17
17
  import {
18
18
  parseFlags
19
19
  } from "../chunk-GMXKITVA.js";
20
20
  import {
21
21
  exitOnHelpFlag
22
- } from "../chunk-SQOFGPNX.js";
23
- import "../chunk-GOEXZ5QJ.js";
22
+ } from "../chunk-KJ57OPCC.js";
23
+ import "../chunk-GPNOHKFO.js";
24
24
  import "../chunk-BC3VCZ3E.js";
25
25
  import {
26
26
  getPackageVersion
27
27
  } from "../chunk-DINDL2CF.js";
28
- import "../chunk-6MTNS63X.js";
29
28
  import "../chunk-SAF6HGAA.js";
30
29
  import "../chunk-OFRNZWC4.js";
31
30
  import {
@@ -34,6 +33,7 @@ import {
34
33
  import {
35
34
  EXIT
36
35
  } from "../chunk-KZERVKTD.js";
36
+ import "../chunk-6MTNS63X.js";
37
37
  import "../chunk-2UMNXADU.js";
38
38
  import {
39
39
  isValidApiKey
@@ -4,25 +4,23 @@ import {
4
4
  codexConfigToml,
5
5
  cursorUserMcp,
6
6
  geminiSettings
7
- } from "../chunk-VKVHY5HD.js";
8
- import "../chunk-GIRT7677.js";
7
+ } from "../chunk-V37ZXMH3.js";
9
8
  import {
10
9
  createIo
11
10
  } from "../chunk-5RUIFDTP.js";
12
11
  import {
13
12
  clearKey,
14
13
  readKeySource
15
- } from "../chunk-LALHWDWL.js";
14
+ } from "../chunk-W6NPWHBJ.js";
16
15
  import {
17
16
  parseFlags
18
17
  } from "../chunk-GMXKITVA.js";
19
18
  import {
20
19
  exitOnHelpFlag
21
- } from "../chunk-SQOFGPNX.js";
22
- import "../chunk-GOEXZ5QJ.js";
20
+ } from "../chunk-KJ57OPCC.js";
21
+ import "../chunk-GPNOHKFO.js";
23
22
  import "../chunk-BC3VCZ3E.js";
24
23
  import "../chunk-DINDL2CF.js";
25
- import "../chunk-6MTNS63X.js";
26
24
  import "../chunk-OFRNZWC4.js";
27
25
  import {
28
26
  UsageError
@@ -30,6 +28,7 @@ import {
30
28
  import {
31
29
  EXIT
32
30
  } from "../chunk-KZERVKTD.js";
31
+ import "../chunk-6MTNS63X.js";
33
32
  import {
34
33
  getBaseUrl
35
34
  } from "../chunk-2UMNXADU.js";
@@ -11,8 +11,8 @@ import {
11
11
  } from "../chunk-GMXKITVA.js";
12
12
  import {
13
13
  exitOnHelpFlag
14
- } from "../chunk-SQOFGPNX.js";
15
- import "../chunk-GOEXZ5QJ.js";
14
+ } from "../chunk-KJ57OPCC.js";
15
+ import "../chunk-GPNOHKFO.js";
16
16
  import "../chunk-DINDL2CF.js";
17
17
  import "../chunk-SAF6HGAA.js";
18
18
  import {
@@ -4,15 +4,17 @@ import {
4
4
  } from "../chunk-6CUUA7HO.js";
5
5
  import {
6
6
  handleNotification
7
- } from "../chunk-3UBYTSCY.js";
8
- import "../chunk-HUJAAWNL.js";
9
- import "../chunk-LGXTBUT4.js";
10
- import "../chunk-RN3NOEJF.js";
7
+ } from "../chunk-NFI2K2ZQ.js";
8
+ import "../chunk-GKAKAOKC.js";
9
+ import "../chunk-KOPUTJQC.js";
10
+ import "../chunk-2HYPZLYY.js";
11
+ import "../chunk-V37ZXMH3.js";
11
12
  import "../chunk-BSZYIAZL.js";
12
13
  import "../chunk-SAF6HGAA.js";
13
14
  import "../chunk-OFRNZWC4.js";
14
15
  import "../chunk-7QLSKOSU.js";
15
16
  import "../chunk-KZERVKTD.js";
17
+ import "../chunk-6MTNS63X.js";
16
18
  import "../chunk-2UMNXADU.js";
17
19
  import "../chunk-L4C2JXJS.js";
18
20
 
@@ -19,7 +19,7 @@ import {
19
19
  policyRequestFor,
20
20
  readLastPrompt,
21
21
  repoKeyFor
22
- } from "../chunk-3UBYTSCY.js";
22
+ } from "../chunk-NFI2K2ZQ.js";
23
23
  import {
24
24
  DEFAULT_SESSION,
25
25
  askUser,
@@ -27,23 +27,26 @@ import {
27
27
  savePendingQuestion,
28
28
  sendNotification,
29
29
  waitForAnswer
30
- } from "../chunk-HUJAAWNL.js";
30
+ } from "../chunk-GKAKAOKC.js";
31
31
  import {
32
+ HOOK_FALLBACK_MAX,
32
33
  OPENCODE_TOOL_NAMES,
33
34
  deriveActionBody,
34
35
  deriveBlocker,
35
36
  deriveToolTarget,
36
37
  describeToolCall,
37
38
  scopePathFor
38
- } from "../chunk-LGXTBUT4.js";
39
+ } from "../chunk-KOPUTJQC.js";
39
40
  import {
40
41
  getMachineId
41
- } from "../chunk-RN3NOEJF.js";
42
+ } from "../chunk-2HYPZLYY.js";
43
+ import "../chunk-V37ZXMH3.js";
42
44
  import "../chunk-BSZYIAZL.js";
43
45
  import "../chunk-SAF6HGAA.js";
44
46
  import "../chunk-OFRNZWC4.js";
45
47
  import "../chunk-7QLSKOSU.js";
46
48
  import "../chunk-KZERVKTD.js";
49
+ import "../chunk-6MTNS63X.js";
47
50
  import {
48
51
  getApiKey
49
52
  } from "../chunk-2UMNXADU.js";
@@ -55,6 +58,7 @@ import {
55
58
  gateOutputFor,
56
59
  hookWaitClamped,
57
60
  hookWaitDeadline,
61
+ redactSecrets,
58
62
  resolveGate
59
63
  } from "../chunk-L4C2JXJS.js";
60
64
 
@@ -108,9 +112,13 @@ var pollForAnswer = async (apiKey, correlationId, deadlineMs, pollInterval = 2e3
108
112
  return { answered: false };
109
113
  };
110
114
  var agentNameFor = (input) => `${OPENCODE_AGENT.label} - ${basename(input.cwd ?? process.cwd())}`;
115
+ var describeFor = (input, lookup) => {
116
+ if (lookup.tool) return describeToolCall(lookup.tool, lookup.input, "hook");
117
+ return redactSecrets(input.title ?? "").trim().slice(0, HOOK_FALLBACK_MAX) || "this request";
118
+ };
111
119
  var pushQuestion = async (apiKey, input, lookup, waitSeconds, mode, pollInterval = 2e3) => {
112
120
  const projectName = basename(input.cwd ?? process.cwd());
113
- const description = describeToolCall(lookup.tool, lookup.input, "hook");
121
+ const description = describeFor(input, lookup);
114
122
  const result = await askUser(apiKey, {
115
123
  question: `Allow ${description}?`,
116
124
  type: "confirm",
@@ -147,7 +155,7 @@ var notifyApprovalNeeded = async (apiKey, input, lookup) => {
147
155
  try {
148
156
  await sendNotification(apiKey, {
149
157
  title: "Agent needs approval",
150
- body: describeToolCall(lookup.tool, lookup.input, "hook"),
158
+ body: describeFor(input, lookup),
151
159
  agentName: agentNameFor(input),
152
160
  sessionId: input.session_id,
153
161
  machineId: getMachineId()