@pushary/agent-hooks 0.89.13 → 0.90.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 (78) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/data/SKILL.md +1 -1
  3. package/data/cursor-plugin/skills/pushary/SKILL.md +1 -1
  4. package/data/vscode-plugin/skills/pushary/SKILL.md +1 -1
  5. package/dist/bin/pushary-bell-hook.js +4 -4
  6. package/dist/bin/pushary-bell.js +8 -8
  7. package/dist/bin/pushary-claude.js +72 -21
  8. package/dist/bin/pushary-clean.js +16 -42
  9. package/dist/bin/pushary-codex-bridge.js +37 -12
  10. package/dist/bin/pushary-codex-hook.js +45 -12
  11. package/dist/bin/pushary-codex.js +7 -7
  12. package/dist/bin/pushary-connect.js +11 -10
  13. package/dist/bin/pushary-daemon.js +187 -63
  14. package/dist/bin/pushary-disconnect.js +8 -8
  15. package/dist/bin/pushary-doctor.js +108 -25
  16. package/dist/bin/pushary-elicitation-hook.js +4 -4
  17. package/dist/bin/pushary-gemini-bridge.js +33 -11
  18. package/dist/bin/pushary-gemini-hook.js +21 -10
  19. package/dist/bin/pushary-hook.js +13 -13
  20. package/dist/bin/pushary-login.js +18 -7
  21. package/dist/bin/pushary-logout.js +6 -6
  22. package/dist/bin/pushary-mode.js +28 -21
  23. package/dist/bin/pushary-notification-hook.js +7 -7
  24. package/dist/bin/pushary-opencode-hook.js +8 -8
  25. package/dist/bin/pushary-permission-denied-hook.js +11 -11
  26. package/dist/bin/pushary-permission-hook.js +11 -11
  27. package/dist/bin/pushary-post-hook.js +14 -8
  28. package/dist/bin/pushary-prompt-hook.js +7 -7
  29. package/dist/bin/pushary-session-end-hook.js +7 -7
  30. package/dist/bin/pushary-session-start-hook.js +7 -7
  31. package/dist/bin/pushary-setup.js +168 -45
  32. package/dist/bin/pushary-stats.js +4 -4
  33. package/dist/bin/pushary-status.js +11 -10
  34. package/dist/bin/pushary-stop-hook.js +14 -8
  35. package/dist/bin/pushary-stopfailure-hook.js +7 -7
  36. package/dist/bin/pushary-suggestions.js +2 -2
  37. package/dist/bin/pushary-transcripts.js +6 -6
  38. package/dist/bin/pushary-upgrade.js +15 -15
  39. package/dist/bin/pushary-wait.js +5 -5
  40. package/dist/bin/pushary.js +1 -1
  41. package/dist/{chunk-B2HND22S.js → chunk-2LAHXHBR.js} +1 -1
  42. package/dist/{chunk-GMJDQDXU.js → chunk-43GMYSS4.js} +1 -0
  43. package/dist/{chunk-OX35BSPV.js → chunk-4LOPSGLP.js} +70 -11
  44. package/dist/{chunk-JTBDBKHU.js → chunk-54ELC7D7.js} +1 -1
  45. package/dist/{chunk-C56VHSXU.js → chunk-5NAZ7SFS.js} +1 -1
  46. package/dist/{chunk-4IPSMEGT.js → chunk-7FE2KABY.js} +12 -2
  47. package/dist/{chunk-RAEPAUNJ.js → chunk-7TPQEWUZ.js} +1 -1
  48. package/dist/{chunk-ZO43JTT3.js → chunk-AJYV3VGU.js} +1 -1
  49. package/dist/{chunk-QFJZHVVL.js → chunk-AZPIQG4G.js} +35 -1
  50. package/dist/{chunk-5MNTWAAJ.js → chunk-B6H2KAQC.js} +29 -22
  51. package/dist/{chunk-MNTZKFZI.js → chunk-BQBEH6TV.js} +5 -5
  52. package/dist/{chunk-WHDSJ6PD.js → chunk-BVBEURWJ.js} +1 -1
  53. package/dist/{chunk-ZWEKONU6.js → chunk-CELX75MW.js} +1 -1
  54. package/dist/{chunk-ZP3SNUP7.js → chunk-CNPAT3HL.js} +3 -2
  55. package/dist/{chunk-YXT55PYF.js → chunk-DYP6SMOR.js} +1 -1
  56. package/dist/chunk-DZDI62LY.js +145 -0
  57. package/dist/{chunk-VF3RTVWY.js → chunk-EZIEXHYM.js} +15 -7
  58. package/dist/{chunk-7JZCADBR.js → chunk-F2ICEWZL.js} +101 -19
  59. package/dist/{chunk-JHJHCMAF.js → chunk-F7OURW3C.js} +24 -6
  60. package/dist/{chunk-VASZ6TWW.js → chunk-FQL5E6NG.js} +2 -2
  61. package/dist/{chunk-JVLB5CAJ.js → chunk-GL3FFM7A.js} +7 -4
  62. package/dist/{chunk-5YEF55AX.js → chunk-H2QZRQR2.js} +1 -1
  63. package/dist/{chunk-S4BLNILH.js → chunk-I463AEG3.js} +1 -1
  64. package/dist/{chunk-ANMHIZZY.js → chunk-JW4KO5AF.js} +1 -1
  65. package/dist/{chunk-3YGGEDJK.js → chunk-KUZWXPUS.js} +3 -2
  66. package/dist/{chunk-N4QJ3CLX.js → chunk-L4E2BIJ2.js} +80 -7
  67. package/dist/{chunk-NBDU3R3G.js → chunk-OSALSIUF.js} +1 -1
  68. package/dist/{chunk-KNLKHJZR.js → chunk-PYA4FLKI.js} +32 -21
  69. package/dist/chunk-QCGNGEGE.js +15 -0
  70. package/dist/chunk-S6LYP7QA.js +127 -0
  71. package/dist/{chunk-M3UABYRT.js → chunk-UZNKVRLE.js} +1 -1
  72. package/dist/{chunk-FOGW6O2Y.js → chunk-VHWCVD42.js} +1 -1
  73. package/dist/{chunk-QINYXLA5.js → chunk-VNMKIJZB.js} +15 -2
  74. package/dist/{chunk-CBGGUEKE.js → chunk-Y6BWPERV.js} +90 -7
  75. package/dist/src/index.d.ts +3 -0
  76. package/dist/src/index.js +11 -11
  77. package/package.json +1 -1
  78. package/dist/chunk-MSTHT2M7.js +0 -72
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  defersToNativeMode
4
- } from "../chunk-S4BLNILH.js";
4
+ } from "../chunk-I463AEG3.js";
5
5
  import {
6
6
  isGatingMoment,
7
7
  recordKeylessMoment
8
- } from "../chunk-FOGW6O2Y.js";
8
+ } from "../chunk-VHWCVD42.js";
9
9
  import {
10
10
  readHookInput
11
11
  } from "../chunk-6CUUA7HO.js";
@@ -34,7 +34,7 @@ import {
34
34
  toCodexWire,
35
35
  toPolicyLookup,
36
36
  toPolicyLookups
37
- } from "../chunk-OX35BSPV.js";
37
+ } from "../chunk-4LOPSGLP.js";
38
38
  import {
39
39
  DEFAULT_SESSION,
40
40
  askUser,
@@ -42,7 +42,7 @@ import {
42
42
  pollForAnswer,
43
43
  savePendingQuestion,
44
44
  sendNotification
45
- } from "../chunk-JHJHCMAF.js";
45
+ } from "../chunk-F7OURW3C.js";
46
46
  import {
47
47
  UNNAMED_ACTION,
48
48
  deriveActionBody,
@@ -50,18 +50,18 @@ import {
50
50
  deriveToolTarget,
51
51
  describeToolCall,
52
52
  scopePathFor
53
- } from "../chunk-N4QJ3CLX.js";
53
+ } from "../chunk-L4E2BIJ2.js";
54
54
  import {
55
55
  getMachineId
56
- } from "../chunk-JTBDBKHU.js";
56
+ } from "../chunk-54ELC7D7.js";
57
57
  import {
58
58
  canonicalJson
59
- } from "../chunk-3YGGEDJK.js";
59
+ } from "../chunk-KUZWXPUS.js";
60
60
  import "../chunk-BSZYIAZL.js";
61
61
  import "../chunk-SAF6HGAA.js";
62
62
  import "../chunk-7QLSKOSU.js";
63
63
  import "../chunk-KZERVKTD.js";
64
- import "../chunk-ANMHIZZY.js";
64
+ import "../chunk-JW4KO5AF.js";
65
65
  import "../chunk-4LL6LG5X.js";
66
66
  import {
67
67
  getApiKey
@@ -73,7 +73,7 @@ import {
73
73
  hookWaitClamped,
74
74
  hookWaitDeadline,
75
75
  resolveGate
76
- } from "../chunk-QINYXLA5.js";
76
+ } from "../chunk-VNMKIJZB.js";
77
77
 
78
78
  // bin/pushary-codex-hook.ts
79
79
  import { basename } from "path";
@@ -250,7 +250,10 @@ var fromRecordedDecision = (decision) => {
250
250
  if (decision.kind === "denied") return codexDeny(decision.reason);
251
251
  return codexPass();
252
252
  };
253
+ var PUSHARY_OWN_TOOL_PREFIX = "mcp__pushary__";
254
+ var isPusharyOwnTool = (toolName) => typeof toolName === "string" && toolName.startsWith(PUSHARY_OWN_TOOL_PREFIX);
253
255
  var decidePermissionRequest = async (input) => {
256
+ if (isPusharyOwnTool(input.tool_name)) return codexPass();
254
257
  const recorded = consumeCodexCallDecision(callKeyFor(input));
255
258
  if (recorded) return fromRecordedDecision(recorded);
256
259
  try {
@@ -278,7 +281,7 @@ var decidePermissionRequest = async (input) => {
278
281
  if (answer.value === "yes") return codexAllow();
279
282
  return codexDeny(denyReasonFrom(answer.value, answer.note));
280
283
  }
281
- savePendingQuestion(input.session_id || DEFAULT_SESSION, correlationId);
284
+ savePendingQuestion(input.session_id || DEFAULT_SESSION, correlationId, input.tool_use_id);
282
285
  if (toolPolicy.mode === "push_first") return codexPass();
283
286
  if (clampCut) return codexPass();
284
287
  return permissionTimeoutDecision(toolPolicy.timeoutAction);
@@ -293,7 +296,33 @@ var recordPreToolUse = (key, outcome) => {
293
296
  );
294
297
  return outcome;
295
298
  };
299
+ var permissionRequestNeverFires = (permissionMode) => permissionMode === "bypassPermissions";
300
+ var decidePushFirstBeforeTheTool = async (apiKey, input, lookup, pushFirstSeconds, callKey) => {
301
+ let pushed;
302
+ try {
303
+ pushed = await pushQuestion(apiKey, input, lookup, pushFirstSeconds, "push_first");
304
+ } catch {
305
+ return recordPreToolUse(callKey, codexPass());
306
+ }
307
+ const { answer, correlationId, suppressed, noDevices } = pushed;
308
+ if (suppressed || noDevices) {
309
+ await cancelQuestion(apiKey, correlationId).catch(() => {
310
+ });
311
+ return recordPreToolUse(callKey, codexPass());
312
+ }
313
+ if (answer.answered) {
314
+ if (isDeferAnswer(answer.value)) return recordPreToolUse(callKey, codexPass());
315
+ if (answer.value === "yes") {
316
+ recordCodexCallDecision(callKey, { kind: "approved" });
317
+ return codexPass();
318
+ }
319
+ return recordPreToolUse(callKey, codexDeny(denyReasonFrom(answer.value, answer.note)));
320
+ }
321
+ savePendingQuestion(input.session_id || DEFAULT_SESSION, correlationId, input.tool_use_id);
322
+ return recordPreToolUse(callKey, codexPass());
323
+ };
296
324
  var decidePreToolUse = async (input) => {
325
+ if (isPusharyOwnTool(input.tool_name)) return codexPass();
297
326
  let apiKey;
298
327
  try {
299
328
  apiKey = getApiKey();
@@ -342,7 +371,7 @@ var decidePreToolUse = async (input) => {
342
371
  }
343
372
  return recordPreToolUse(callKey, codexDeny(denyReasonFrom(answer.value, answer.note)));
344
373
  }
345
- savePendingQuestion(input.session_id || DEFAULT_SESSION, correlationId);
374
+ savePendingQuestion(input.session_id || DEFAULT_SESSION, correlationId, input.tool_use_id);
346
375
  if (clampCut) return recordPreToolUse(callKey, codexPass());
347
376
  return recordPreToolUse(callKey, preToolUseTimeoutDecision(toolPolicy.timeoutAction));
348
377
  }
@@ -351,6 +380,9 @@ var decidePreToolUse = async (input) => {
351
380
  recordCodexCallDecision(callKey, { kind: "handled" });
352
381
  return codexPass();
353
382
  }
383
+ if (toolPolicy.mode === "push_first" && permissionRequestNeverFires(input.permission_mode)) {
384
+ return decidePushFirstBeforeTheTool(apiKey, input, lookup, toolPolicy.pushFirstSeconds, callKey);
385
+ }
354
386
  return codexPass();
355
387
  } catch {
356
388
  return codexPass();
@@ -398,7 +430,8 @@ var main = async () => {
398
430
  tool_input: lookup.input,
399
431
  tool_result: asToolResult(input.tool_response),
400
432
  cwd: input.cwd,
401
- session_id: input.session_id
433
+ session_id: input.session_id,
434
+ tool_use_id: input.tool_use_id
402
435
  }, CODEX_AGENT));
403
436
  break;
404
437
  }
@@ -1,26 +1,26 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  reportEvent
4
- } from "../chunk-OX35BSPV.js";
4
+ } from "../chunk-4LOPSGLP.js";
5
5
  import {
6
6
  askUser,
7
7
  waitForAnswer
8
- } from "../chunk-JHJHCMAF.js";
9
- import "../chunk-N4QJ3CLX.js";
8
+ } from "../chunk-F7OURW3C.js";
9
+ import "../chunk-L4E2BIJ2.js";
10
10
  import {
11
11
  getMachineId
12
- } from "../chunk-JTBDBKHU.js";
13
- import "../chunk-3YGGEDJK.js";
12
+ } from "../chunk-54ELC7D7.js";
13
+ import "../chunk-KUZWXPUS.js";
14
14
  import "../chunk-BSZYIAZL.js";
15
15
  import "../chunk-SAF6HGAA.js";
16
16
  import "../chunk-7QLSKOSU.js";
17
17
  import "../chunk-KZERVKTD.js";
18
- import "../chunk-ANMHIZZY.js";
18
+ import "../chunk-JW4KO5AF.js";
19
19
  import "../chunk-4LL6LG5X.js";
20
20
  import {
21
21
  getApiKey
22
22
  } from "../chunk-2UMNXADU.js";
23
- import "../chunk-QINYXLA5.js";
23
+ import "../chunk-VNMKIJZB.js";
24
24
 
25
25
  // bin/pushary-codex.ts
26
26
  import { basename } from "path";
@@ -1,16 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  printKeyCheck
4
- } from "../chunk-YXT55PYF.js";
4
+ } from "../chunk-DYP6SMOR.js";
5
5
  import {
6
- confirmAppConnection,
7
6
  connectDevice,
7
+ connectExistingApp,
8
8
  printConnectInstructions
9
- } from "../chunk-KNLKHJZR.js";
9
+ } from "../chunk-PYA4FLKI.js";
10
10
  import "../chunk-3EGEA4KH.js";
11
11
  import {
12
12
  checkApiKey
13
- } from "../chunk-ZO43JTT3.js";
13
+ } from "../chunk-AJYV3VGU.js";
14
+ import "../chunk-QCGNGEGE.js";
14
15
  import {
15
16
  createIo
16
17
  } from "../chunk-5RUIFDTP.js";
@@ -19,12 +20,12 @@ import {
19
20
  } from "../chunk-GMXKITVA.js";
20
21
  import {
21
22
  exitOnHelpFlag
22
- } from "../chunk-WHDSJ6PD.js";
23
- import "../chunk-GMJDQDXU.js";
23
+ } from "../chunk-BVBEURWJ.js";
24
+ import "../chunk-43GMYSS4.js";
24
25
  import "../chunk-DINDL2CF.js";
25
26
  import {
26
27
  readKeySource
27
- } from "../chunk-NBDU3R3G.js";
28
+ } from "../chunk-OSALSIUF.js";
28
29
  import "../chunk-BC3VCZ3E.js";
29
30
  import "../chunk-BSZYIAZL.js";
30
31
  import "../chunk-SAF6HGAA.js";
@@ -34,10 +35,10 @@ import {
34
35
  import {
35
36
  EXIT
36
37
  } from "../chunk-KZERVKTD.js";
37
- import "../chunk-ANMHIZZY.js";
38
+ import "../chunk-JW4KO5AF.js";
38
39
  import "../chunk-4LL6LG5X.js";
39
40
  import "../chunk-2UMNXADU.js";
40
- import "../chunk-QINYXLA5.js";
41
+ import "../chunk-VNMKIJZB.js";
41
42
 
42
43
  // bin/pushary-connect.ts
43
44
  exitOnHelpFlag("connect");
@@ -79,7 +80,7 @@ var main = async () => {
79
80
  if (keyCheck.kind !== "unreachable") process.exit(report.exitCode);
80
81
  console.log();
81
82
  }
82
- const result = options.mode === "app" ? await confirmAppConnection(source.key) : process.stdout.isTTY ? await connectDevice(source.key, { showCapabilities: true }) : await printConnectInstructions(source.key);
83
+ const result = options.mode === "app" ? await connectExistingApp(source.key) : process.stdout.isTTY ? await connectDevice(source.key, { showCapabilities: true }) : await printConnectInstructions(source.key);
83
84
  console.log();
84
85
  if (result.reachesYou) {
85
86
  console.log(` ${dim("Your phone can receive approvals. Try")} ${cyan("pushary doctor --roundtrip")} ${dim("to answer one.")}`);