@pushary/agent-hooks 0.89.3 → 0.89.5

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 (58) 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 +25 -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 +155 -40
  11. package/dist/bin/pushary-disconnect.js +3 -4
  12. package/dist/bin/pushary-doctor.js +77 -39
  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 +125 -39
  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 +110 -46
  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-GOEXZ5QJ.js → chunk-3XTFX4CL.js} +10 -2
  39. package/dist/{chunk-ZYPS2XMT.js → chunk-4ZHQNBDP.js} +1 -1
  40. package/dist/{chunk-HUJAAWNL.js → chunk-GKAKAOKC.js} +10 -3
  41. package/dist/{chunk-LGXTBUT4.js → chunk-KOPUTJQC.js} +1 -0
  42. package/dist/{chunk-LALHWDWL.js → chunk-L3YUHEB6.js} +16 -4
  43. package/dist/{chunk-SQOFGPNX.js → chunk-LURY4WNF.js} +1 -1
  44. package/dist/{chunk-JT6TIBYH.js → chunk-MZBT2LXW.js} +4 -4
  45. package/dist/{chunk-3UBYTSCY.js → chunk-NFI2K2ZQ.js} +15 -7
  46. package/dist/chunk-NKHEHEUM.js +56 -0
  47. package/dist/{chunk-3O2XPYLF.js → chunk-OBI4YMCT.js} +1 -1
  48. package/dist/{chunk-LUCFN47K.js → chunk-QH4AA7QV.js} +1 -1
  49. package/dist/chunk-TRQ46MXR.js +648 -0
  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/{chunk-B7JE4XHD.js → chunk-WQGMUIDW.js} +1 -1
  53. package/dist/src/index.js +7 -5
  54. package/package.json +1 -1
  55. package/dist/chunk-GIRT7677.js +0 -11
  56. package/dist/chunk-K42SZKYF.js +0 -343
  57. package/dist/chunk-NRGRUOAR.js +0 -25
  58. package/dist/chunk-RN3NOEJF.js +0 -9
@@ -12,7 +12,7 @@ import {
12
12
  savePendingCommand,
13
13
  sendNotification,
14
14
  waitForAnswer
15
- } from "./chunk-HUJAAWNL.js";
15
+ } from "./chunk-GKAKAOKC.js";
16
16
  import {
17
17
  AGENT_IDENTITIES,
18
18
  deriveReceiptMeta,
@@ -26,10 +26,10 @@ import {
26
26
  summarizeStop,
27
27
  taskTitleFrom,
28
28
  toolResultErrorText
29
- } from "./chunk-LGXTBUT4.js";
29
+ } from "./chunk-KOPUTJQC.js";
30
30
  import {
31
31
  getMachineId
32
- } from "./chunk-RN3NOEJF.js";
32
+ } from "./chunk-2HYPZLYY.js";
33
33
  import {
34
34
  withRetry
35
35
  } from "./chunk-BSZYIAZL.js";
@@ -670,7 +670,7 @@ var consumesActivityContext = (agentType) => {
670
670
  return pendingCommandEvents(source).some((event) => event !== "Stop");
671
671
  };
672
672
  var detectInstallMode = () => (process.argv[1] ?? "").includes("_npx") ? "npx" : "cli";
673
- var acknowledgePendingCommand = async (apiKey, baseUrl, commandId, sessionId, machineId, timeoutMs) => {
673
+ var acknowledgePendingCommand = async (apiKey, baseUrl, commandId, sessionId, machineId, timeoutMs, state = "delivered") => {
674
674
  try {
675
675
  const response = await fetch(`${baseUrl}/api/agent/command/ack`, {
676
676
  method: "POST",
@@ -678,7 +678,13 @@ var acknowledgePendingCommand = async (apiKey, baseUrl, commandId, sessionId, ma
678
678
  "Content-Type": "application/json",
679
679
  "Authorization": `Bearer ${apiKey}`
680
680
  },
681
- body: JSON.stringify({ commandId, sessionId: sessionId ?? null, machineId, state: "delivered" }),
681
+ body: JSON.stringify({
682
+ commandId,
683
+ sessionId: sessionId ?? null,
684
+ machineId,
685
+ state,
686
+ ...state === "failed" ? { failureCode: "consumer_rejected" } : {}
687
+ }),
682
688
  signal: AbortSignal.timeout(timeoutMs)
683
689
  });
684
690
  return response.ok;
@@ -729,16 +735,18 @@ var reportEvent = async (event, options = {}) => {
729
735
  const result = await res.json();
730
736
  const withoutPending = () => ({ ...result, pendingCommand: void 0, pendingCommandId: void 0 });
731
737
  if (storedCommand) {
738
+ const failed = storedCommand.failed === true;
732
739
  const acknowledged = await acknowledgePendingCommand(
733
740
  apiKey,
734
741
  baseUrl,
735
742
  storedCommand.id,
736
743
  event.sessionId,
737
744
  machineId,
738
- options.timeoutMs ?? 1e4
745
+ options.timeoutMs ?? 1e4,
746
+ failed ? "failed" : "delivered"
739
747
  );
740
748
  if (!acknowledged) return withoutPending();
741
- if (storedCommand.delivered) {
749
+ if (storedCommand.delivered || failed) {
742
750
  removePendingCommand(sessionKey, storedCommand.id, receiptNamespace);
743
751
  return withoutPending();
744
752
  }
@@ -0,0 +1,56 @@
1
+ import {
2
+ resolveBinary,
3
+ resolveGlobalPackageVersion,
4
+ resolvePackageVersionFromBinary
5
+ } from "./chunk-PZA7G4CN.js";
6
+
7
+ // src/live-capabilities.ts
8
+ var CLAUDE_BRIDGE_CAPABILITY = "claude-bridge";
9
+ var CLAUDE_RESUME_CAPABILITY = "claude-resume";
10
+ var CODEX_BRIDGE_CAPABILITY = "codex-bridge";
11
+ var CODEX_RESUME_CAPABILITY = "codex-resume";
12
+ var GEMINI_BRIDGE_CAPABILITY = "gemini-bridge";
13
+ var GEMINI_RESUME_CAPABILITY = "gemini-resume";
14
+ var GEMINI_BRIDGE_MIN_VERSION = [0, 40, 0];
15
+ var version = (raw) => {
16
+ const match = raw?.match(/^(\d+)\.(\d+)\.(\d+)/);
17
+ return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
18
+ };
19
+ var geminiLiveCapabilities = (rawVersion) => {
20
+ const installed = version(rawVersion);
21
+ if (!installed) return [];
22
+ for (let index = 0; index < GEMINI_BRIDGE_MIN_VERSION.length; index++) {
23
+ if (installed[index] > GEMINI_BRIDGE_MIN_VERSION[index]) break;
24
+ if (installed[index] < GEMINI_BRIDGE_MIN_VERSION[index]) return [];
25
+ }
26
+ return [GEMINI_BRIDGE_CAPABILITY, GEMINI_RESUME_CAPABILITY];
27
+ };
28
+ var providerLiveCapabilities = (probe) => [
29
+ ...probe.claude ? [CLAUDE_BRIDGE_CAPABILITY, CLAUDE_RESUME_CAPABILITY] : [],
30
+ ...probe.codex ? [CODEX_BRIDGE_CAPABILITY, CODEX_RESUME_CAPABILITY] : [],
31
+ ...geminiLiveCapabilities(probe.geminiVersion)
32
+ ];
33
+ var hasSpawnProvider = (capabilities) => capabilities.some(
34
+ (capability) => capability === CLAUDE_BRIDGE_CAPABILITY || capability === CODEX_BRIDGE_CAPABILITY || capability === GEMINI_BRIDGE_CAPABILITY
35
+ );
36
+ var resolveControlPolicy = (input) => {
37
+ if (input.mode === "off") return "disabled";
38
+ if (input.mode === null && !input.servicePresent) return "preserve-absent";
39
+ if (input.providerAvailable && input.managerAvailable) return "enabled";
40
+ return input.servicePresent ? "legacy" : "unsupported";
41
+ };
42
+ var detectProviderLiveCapabilities = (providers = ["claude", "codex", "gemini"]) => {
43
+ const enabled = new Set(providers);
44
+ const geminiBin = enabled.has("gemini") ? resolveBinary("gemini") : void 0;
45
+ return providerLiveCapabilities({
46
+ claude: enabled.has("claude") && resolveBinary("claude") !== void 0,
47
+ codex: enabled.has("codex") && resolveBinary("codex") !== void 0,
48
+ geminiVersion: geminiBin ? resolvePackageVersionFromBinary(geminiBin, "@google/gemini-cli") ?? resolveGlobalPackageVersion("@google/gemini-cli") : void 0
49
+ });
50
+ };
51
+
52
+ export {
53
+ hasSpawnProvider,
54
+ resolveControlPolicy,
55
+ detectProviderLiveCapabilities
56
+ };
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-7TS2G4QG.js";
4
4
  import {
5
5
  hasCodexHooks
6
- } from "./chunk-VKVHY5HD.js";
6
+ } from "./chunk-V37ZXMH3.js";
7
7
  import {
8
8
  HOOK_LOCATOR_BINARY
9
9
  } from "./chunk-L4C2JXJS.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-O5B7EK5U.js";
4
4
  import {
5
5
  codexHomeFrom
6
- } from "./chunk-VKVHY5HD.js";
6
+ } from "./chunk-V37ZXMH3.js";
7
7
 
8
8
  // src/vscode-config.ts
9
9
  import { homedir } from "os";