@pushary/agent-hooks 1.8.1 → 1.8.3

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 (72) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/bin/pushary-bell-hook.js +12 -11
  3. package/dist/bin/pushary-bell.js +2 -2
  4. package/dist/bin/pushary-claude.js +16 -15
  5. package/dist/bin/pushary-clean.js +19 -18
  6. package/dist/bin/pushary-codex-bridge.js +14 -12
  7. package/dist/bin/pushary-codex-hook.js +19 -18
  8. package/dist/bin/pushary-codex.js +8 -8
  9. package/dist/bin/pushary-connect.js +7 -7
  10. package/dist/bin/pushary-daemon.js +92 -25
  11. package/dist/bin/pushary-disconnect.js +12 -11
  12. package/dist/bin/pushary-doctor.js +24 -21
  13. package/dist/bin/pushary-elicitation-hook.js +15 -14
  14. package/dist/bin/pushary-gemini-bridge.js +9 -6
  15. package/dist/bin/pushary-gemini-hook.js +17 -16
  16. package/dist/bin/pushary-hook.js +20 -19
  17. package/dist/bin/pushary-login.js +5 -5
  18. package/dist/bin/pushary-logout.js +1 -1
  19. package/dist/bin/pushary-mcp.js +6 -6
  20. package/dist/bin/pushary-mode.js +5 -5
  21. package/dist/bin/pushary-notification-hook.js +18 -17
  22. package/dist/bin/pushary-opencode-hook.js +16 -15
  23. package/dist/bin/pushary-permission-denied-hook.js +20 -19
  24. package/dist/bin/pushary-permission-hook.js +20 -19
  25. package/dist/bin/pushary-post-hook.js +18 -17
  26. package/dist/bin/pushary-prompt-hook.js +18 -17
  27. package/dist/bin/pushary-session-end-hook.js +18 -17
  28. package/dist/bin/pushary-session-start-hook.js +22 -21
  29. package/dist/bin/pushary-setup.js +37 -93
  30. package/dist/bin/pushary-status.js +11 -9
  31. package/dist/bin/pushary-stop-hook.js +18 -17
  32. package/dist/bin/pushary-stopfailure-hook.js +18 -17
  33. package/dist/bin/pushary-transcript-register.js +9 -8
  34. package/dist/bin/pushary-upgrade.js +219 -141
  35. package/dist/bin/pushary-wait.js +5 -5
  36. package/dist/bin/pushary.js +3 -3
  37. package/dist/{chunk-W2LJ4O3A.js → chunk-27A7L4DA.js} +1 -1
  38. package/dist/{chunk-I4HKMUZQ.js → chunk-34EQOFMH.js} +2 -2
  39. package/dist/{chunk-2SLCHCVN.js → chunk-4CW5EAOI.js} +1 -1
  40. package/dist/{chunk-F6NTWZZC.js → chunk-4DYHBXX4.js} +5 -5
  41. package/dist/{chunk-INSMZNS7.js → chunk-4SJIPHR3.js} +1 -1
  42. package/dist/chunk-6ICPEJY5.js +20 -0
  43. package/dist/{chunk-ZJYJAD52.js → chunk-6SS74UHS.js} +1 -1
  44. package/dist/{chunk-DVW2MYCM.js → chunk-6UDK5TY6.js} +1 -1
  45. package/dist/{chunk-MMVCI6DT.js → chunk-AKCE6ZRF.js} +3 -3
  46. package/dist/{chunk-HBWC3JVZ.js → chunk-APURTMSW.js} +2 -2
  47. package/dist/{chunk-QB6QYZ6B.js → chunk-CTNLP4A5.js} +4 -4
  48. package/dist/{chunk-GH6KGWMC.js → chunk-CXYKQAL2.js} +11 -9
  49. package/dist/{chunk-4A3UQERT.js → chunk-DMU5E6HJ.js} +1 -1
  50. package/dist/{chunk-FLQPM2GQ.js → chunk-E5JGQGLD.js} +2 -2
  51. package/dist/{chunk-JRQRNNGA.js → chunk-EJXEHNB5.js} +2 -2
  52. package/dist/{chunk-5DGNEUXK.js → chunk-FBTUF2PH.js} +1 -1
  53. package/dist/{chunk-EIGJYCOE.js → chunk-IEXWWAJY.js} +2 -2
  54. package/dist/{chunk-HQRCVEI2.js → chunk-MSMKCO4Y.js} +6 -6
  55. package/dist/{chunk-TKQ6LZQZ.js → chunk-OLYTGVCC.js} +5 -4
  56. package/dist/{chunk-ASWRMBOM.js → chunk-RIVNNBEK.js} +2 -1
  57. package/dist/{chunk-6TK4IY3A.js → chunk-SD6OLZJX.js} +3 -3
  58. package/dist/chunk-SOUJG6UY.js +198 -0
  59. package/dist/{chunk-KB2FTO4O.js → chunk-UXKXGRKG.js} +2 -2
  60. package/dist/{chunk-T55H6YEP.js → chunk-VF3X4MDB.js} +1 -1
  61. package/dist/{chunk-64H5IZZD.js → chunk-VI55VXDH.js} +1 -1
  62. package/dist/{chunk-NHCUXTEM.js → chunk-VUP5BMOD.js} +1 -1
  63. package/dist/{chunk-HOEB6AKG.js → chunk-XH7UNEHO.js} +1 -1
  64. package/dist/{chunk-LK2S5XIV.js → chunk-XNJ4MQF3.js} +2 -2
  65. package/dist/{chunk-HTEGMMT3.js → chunk-YLJ26RR2.js} +5 -18
  66. package/dist/{chunk-OCVVSRDA.js → chunk-YOYSXLUB.js} +2 -2
  67. package/dist/{chunk-GBNQXYN4.js → chunk-ZOKXZ3AS.js} +2 -2
  68. package/dist/{chunk-UPLV5AJF.js → chunk-ZR7LIQKO.js} +57 -5
  69. package/dist/{reapply-ICGTBHVE.js → reapply-DYOQAVUP.js} +8 -7
  70. package/dist/src/index.js +14 -13
  71. package/package.json +1 -1
  72. package/dist/chunk-VZMIHERK.js +0 -59
@@ -20,23 +20,23 @@ import {
20
20
  isPolicyConfig,
21
21
  sendNotification,
22
22
  waitForAnswer
23
- } from "./chunk-MMVCI6DT.js";
23
+ } from "./chunk-AKCE6ZRF.js";
24
24
  import {
25
25
  clientErrorKindOf,
26
26
  reportClientError
27
- } from "./chunk-KB2FTO4O.js";
27
+ } from "./chunk-UXKXGRKG.js";
28
28
  import {
29
29
  withRetry
30
- } from "./chunk-I4HKMUZQ.js";
30
+ } from "./chunk-34EQOFMH.js";
31
31
  import {
32
32
  getMachineId
33
- } from "./chunk-4A3UQERT.js";
33
+ } from "./chunk-DMU5E6HJ.js";
34
34
  import {
35
35
  reportedInstallSource
36
36
  } from "./chunk-5Y2DY6X4.js";
37
37
  import {
38
38
  canonicalJson
39
- } from "./chunk-UPLV5AJF.js";
39
+ } from "./chunk-ZR7LIQKO.js";
40
40
  import {
41
41
  writeFileAtomic
42
42
  } from "./chunk-T7E75EKA.js";
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-U4TMAANR.js";
15
15
  import {
16
16
  callMcpTool
17
- } from "./chunk-I4HKMUZQ.js";
17
+ } from "./chunk-34EQOFMH.js";
18
18
  import {
19
19
  reportedInstallSource
20
20
  } from "./chunk-5Y2DY6X4.js";
@@ -0,0 +1,20 @@
1
+ // src/agent-version.ts
2
+ var parseVersion = (raw) => {
3
+ const match = raw.match(/(\d+)\.(\d+)\.(\d+)/);
4
+ return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
5
+ };
6
+ var compareVersion = (a, b) => {
7
+ for (let index = 0; index < 3; index++) {
8
+ if (a[index] !== b[index]) return a[index] < b[index] ? -1 : 1;
9
+ }
10
+ return 0;
11
+ };
12
+ var atLeast = (version, floor) => compareVersion(version, floor) >= 0;
13
+ var formatVersion = (version) => version.join(".");
14
+
15
+ export {
16
+ parseVersion,
17
+ compareVersion,
18
+ atLeast,
19
+ formatVersion
20
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-UPLV5AJF.js";
3
+ } from "./chunk-ZR7LIQKO.js";
4
4
  import {
5
5
  readJsonSafe
6
6
  } from "./chunk-T7E75EKA.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyFetch
3
- } from "./chunk-2SLCHCVN.js";
3
+ } from "./chunk-4CW5EAOI.js";
4
4
  import {
5
5
  NetworkError
6
6
  } from "./chunk-7QLSKOSU.js";
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  clientErrorKindOf,
3
3
  reportClientError
4
- } from "./chunk-KB2FTO4O.js";
4
+ } from "./chunk-UXKXGRKG.js";
5
5
  import {
6
6
  SubscriptionRequiredError,
7
7
  callMcpTool
8
- } from "./chunk-I4HKMUZQ.js";
8
+ } from "./chunk-34EQOFMH.js";
9
9
  import {
10
10
  installNetworkDefaults
11
- } from "./chunk-2SLCHCVN.js";
11
+ } from "./chunk-4CW5EAOI.js";
12
12
  import {
13
13
  getBaseUrl
14
14
  } from "./chunk-ON5JW2HP.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  pusharyHookExecutable
3
- } from "./chunk-OCVVSRDA.js";
3
+ } from "./chunk-YOYSXLUB.js";
4
4
  import {
5
5
  isProtectedByScope,
6
6
  registerHookEntry
7
- } from "./chunk-UPLV5AJF.js";
7
+ } from "./chunk-ZR7LIQKO.js";
8
8
 
9
9
  // src/skills-cli.ts
10
10
  import { execSync } from "child_process";
@@ -3,21 +3,21 @@ import {
3
3
  addPusharyToolPermissions,
4
4
  isPusharyHook,
5
5
  removeClaudeMcpServers
6
- } from "./chunk-JRQRNNGA.js";
6
+ } from "./chunk-EJXEHNB5.js";
7
7
  import {
8
8
  CLAUDE_HOOK_EVENTS,
9
9
  addGeminiMcpServer,
10
10
  removeGeminiMcpServer
11
- } from "./chunk-HTEGMMT3.js";
11
+ } from "./chunk-YLJ26RR2.js";
12
12
  import {
13
13
  CLAUDE_CODE_AGENT,
14
14
  parseApplyPatchFiles
15
- } from "./chunk-F6NTWZZC.js";
15
+ } from "./chunk-4DYHBXX4.js";
16
16
  import {
17
17
  guardBinary,
18
18
  holdBudgetOf,
19
19
  registerHookEntry
20
- } from "./chunk-UPLV5AJF.js";
20
+ } from "./chunk-ZR7LIQKO.js";
21
21
  import {
22
22
  PHONE_ANSWERED_TOOLS,
23
23
  hookCompatibleProfile,
@@ -1,33 +1,35 @@
1
- import {
2
- detectClaudeVersion
3
- } from "./chunk-ASWRMBOM.js";
4
1
  import {
5
2
  ensureCodexTrustsPusharyHooks
6
- } from "./chunk-W2LJ4O3A.js";
3
+ } from "./chunk-27A7L4DA.js";
7
4
  import {
8
5
  addClaudeMcpServer,
9
6
  addPusharyHooks,
10
7
  addPusharyToolPermissions
11
- } from "./chunk-JRQRNNGA.js";
8
+ } from "./chunk-EJXEHNB5.js";
9
+ import {
10
+ detectClaudeVersion
11
+ } from "./chunk-RIVNNBEK.js";
12
12
  import {
13
13
  claudeUnprovenHolds,
14
14
  claudeWired,
15
15
  codexUnprovenHolds,
16
16
  codexWired,
17
17
  geminiWired
18
- } from "./chunk-OCVVSRDA.js";
18
+ } from "./chunk-YOYSXLUB.js";
19
19
  import {
20
20
  CLAUDE_HOOK_BINARY,
21
21
  CLAUDE_HOOK_EVENTS,
22
22
  GEMINI_HOOK_BINARY,
23
23
  addGeminiHooks,
24
24
  addGeminiMcpServer,
25
- formatVersion,
26
25
  hasGeminiHooks,
27
26
  needsReregistration,
28
27
  registrationSignatures,
29
28
  supportedClaudeEvents
30
- } from "./chunk-HTEGMMT3.js";
29
+ } from "./chunk-YLJ26RR2.js";
30
+ import {
31
+ formatVersion
32
+ } from "./chunk-6ICPEJY5.js";
31
33
  import {
32
34
  CODEX_HOOK_BINARY,
33
35
  addCodexHookTrust,
@@ -47,7 +49,7 @@ import {
47
49
  registrationHolderOf,
48
50
  resolveGlobalBinary,
49
51
  vscodePluginMcp
50
- } from "./chunk-UPLV5AJF.js";
52
+ } from "./chunk-ZR7LIQKO.js";
51
53
  import {
52
54
  readJsonSafe,
53
55
  writeFileAtomic,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-UPLV5AJF.js";
3
+ } from "./chunk-ZR7LIQKO.js";
4
4
  import {
5
5
  writeFileAtomic
6
6
  } from "./chunk-T7E75EKA.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  registerTranscript
3
- } from "./chunk-6TK4IY3A.js";
3
+ } from "./chunk-SD6OLZJX.js";
4
4
  import {
5
5
  writeDegraded
6
- } from "./chunk-KB2FTO4O.js";
6
+ } from "./chunk-UXKXGRKG.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"];
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  CLAUDE_HOOK_EVENTS,
3
3
  supportedClaudeEvents
4
- } from "./chunk-HTEGMMT3.js";
4
+ } from "./chunk-YLJ26RR2.js";
5
5
  import {
6
6
  guardBinary,
7
7
  holdBudgetOf,
8
8
  isProtectedByScope,
9
9
  registerHookEntry
10
- } from "./chunk-UPLV5AJF.js";
10
+ } from "./chunk-ZR7LIQKO.js";
11
11
  import {
12
12
  HOOK_LOCATOR_BINARY,
13
13
  withHookHoldBudget
@@ -5,7 +5,7 @@ import {
5
5
  permissionDeniedAction,
6
6
  releaseThrottle,
7
7
  reportEvent
8
- } from "./chunk-F6NTWZZC.js";
8
+ } from "./chunk-4DYHBXX4.js";
9
9
  import {
10
10
  DEFAULT_SESSION
11
11
  } from "./chunk-N6IOSZOE.js";
@@ -7,11 +7,11 @@ import {
7
7
  } from "./chunk-TJMAXQ5Q.js";
8
8
  import {
9
9
  getMachineId
10
- } from "./chunk-4A3UQERT.js";
10
+ } from "./chunk-DMU5E6HJ.js";
11
11
  import {
12
12
  pusharyDir,
13
13
  resolveGlobalBinary
14
- } from "./chunk-UPLV5AJF.js";
14
+ } from "./chunk-ZR7LIQKO.js";
15
15
  import {
16
16
  readJsonSafe,
17
17
  writeFileAtomic,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  activeHookSource,
3
3
  activeIdentity
4
- } from "./chunk-QB6QYZ6B.js";
4
+ } from "./chunk-CTNLP4A5.js";
5
5
  import {
6
6
  defersToNativeMode,
7
7
  reportMachineDenial
8
- } from "./chunk-5DGNEUXK.js";
8
+ } from "./chunk-FBTUF2PH.js";
9
9
  import {
10
10
  isGatingMoment,
11
11
  recordKeylessMoment
@@ -39,7 +39,7 @@ import {
39
39
  reportEvent,
40
40
  scopePathFor,
41
41
  settleQuestionsForToolUse
42
- } from "./chunk-F6NTWZZC.js";
42
+ } from "./chunk-4DYHBXX4.js";
43
43
  import {
44
44
  DEFAULT_SESSION
45
45
  } from "./chunk-N6IOSZOE.js";
@@ -55,13 +55,13 @@ import {
55
55
  requestGate,
56
56
  sendNotification,
57
57
  waitForQuestion
58
- } from "./chunk-MMVCI6DT.js";
58
+ } from "./chunk-AKCE6ZRF.js";
59
59
  import {
60
60
  SubscriptionRequiredError
61
- } from "./chunk-I4HKMUZQ.js";
61
+ } from "./chunk-34EQOFMH.js";
62
62
  import {
63
63
  getMachineId
64
- } from "./chunk-4A3UQERT.js";
64
+ } from "./chunk-DMU5E6HJ.js";
65
65
  import {
66
66
  getApiKey,
67
67
  getBaseUrl
@@ -1,22 +1,23 @@
1
1
  import {
2
2
  detectProviderLiveCapabilities,
3
+ expectedLaunchCapabilities,
3
4
  hasSpawnProvider,
4
5
  resolveControlPolicy
5
- } from "./chunk-VZMIHERK.js";
6
+ } from "./chunk-SOUJG6UY.js";
6
7
  import {
7
8
  daemonHasRemoteProof,
8
9
  daemonServiceManagerAvailable,
9
10
  hasDaemonServiceDefinition,
10
11
  readDaemonNeedsLogin,
11
12
  readDaemonStatus
12
- } from "./chunk-EIGJYCOE.js";
13
+ } from "./chunk-IEXWWAJY.js";
13
14
  import {
14
15
  readControlMode,
15
16
  readKeySource
16
17
  } from "./chunk-TJMAXQ5Q.js";
17
18
  import {
18
19
  getMachineId
19
- } from "./chunk-4A3UQERT.js";
20
+ } from "./chunk-DMU5E6HJ.js";
20
21
  import {
21
22
  getBaseUrl
22
23
  } from "./chunk-ON5JW2HP.js";
@@ -135,7 +136,7 @@ var readManagedControlEvidence = (apiKey, providers, serverProof) => {
135
136
  const keyCurrent = Boolean(apiKey) && readKeySource().key === apiKey && readDaemonNeedsLogin().kind !== "blocked";
136
137
  const policy = resolveControlPolicy({ mode: readControlMode(), providerAvailable, managerAvailable, servicePresent: serviceInstalled || daemon.kind !== "absent" });
137
138
  const localProof = daemonHasRemoteProof(daemon, now);
138
- const remote = serverProof?.kind === "ready" ? machineReadiness([serverProof.machine], daemon.machineId ?? "", ["spawn", ...capabilities], now) : serverProof;
139
+ const remote = serverProof?.kind === "ready" ? machineReadiness([serverProof.machine], daemon.machineId ?? "", expectedLaunchCapabilities(providers), now) : serverProof;
139
140
  return {
140
141
  ready: keyCurrent && policy === "enabled" && providerAvailable && managerAvailable && serviceInstalled && localProof && remote?.kind === "ready",
141
142
  keyCurrent,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parseVersion
3
- } from "./chunk-HTEGMMT3.js";
3
+ } from "./chunk-6ICPEJY5.js";
4
4
 
5
5
  // src/setup/agent-probe.ts
6
6
  import { execSync } from "child_process";
@@ -66,5 +66,6 @@ var readFile = (path) => {
66
66
  var detectClaudeVersion = () => readClaudeVersion({ resolveOnPath: () => onPath("claude"), realpath, readFile });
67
67
 
68
68
  export {
69
+ realpath,
69
70
  detectClaudeVersion
70
71
  };
@@ -6,10 +6,10 @@ import {
6
6
  } from "./chunk-SGZJ5LYH.js";
7
7
  import {
8
8
  hookOwnerOf
9
- } from "./chunk-GBNQXYN4.js";
9
+ } from "./chunk-ZOKXZ3AS.js";
10
10
  import {
11
11
  ensureDaemonRunning
12
- } from "./chunk-EIGJYCOE.js";
12
+ } from "./chunk-IEXWWAJY.js";
13
13
  import {
14
14
  buildTranscriptRecords,
15
15
  decodePublicKey,
@@ -30,7 +30,7 @@ import {
30
30
  import {
31
31
  codexHome,
32
32
  pusharyDir
33
- } from "./chunk-UPLV5AJF.js";
33
+ } from "./chunk-ZR7LIQKO.js";
34
34
  import {
35
35
  writeJsonAtomic
36
36
  } from "./chunk-T7E75EKA.js";
@@ -0,0 +1,198 @@
1
+ import {
2
+ realpath
3
+ } from "./chunk-RIVNNBEK.js";
4
+ import {
5
+ readGlobalPrefixAsync,
6
+ resolveGlobalBinary,
7
+ resolveGlobalBinaryAt,
8
+ resolveGlobalPackageVersion,
9
+ resolveGlobalPackageVersionAsync,
10
+ resolvePackageVersionFromBinary,
11
+ resolvePathBinary,
12
+ resolvePathBinaryAsync
13
+ } from "./chunk-ZR7LIQKO.js";
14
+ import {
15
+ MANAGED_PROVIDERS
16
+ } from "./chunk-5YY3IJT4.js";
17
+
18
+ // src/setup/codex-install.ts
19
+ var NATIVE_BINARY_MIN_BYTES = 20 * 1024 * 1024;
20
+ var packageRootFor = (probe, binPath) => {
21
+ const binDir = probe.dirname(binPath);
22
+ const root = probe.dirname(binDir);
23
+ return probe.join(root, "bin") === binDir && probe.exists(probe.join(root, "package.json")) ? root : null;
24
+ };
25
+ var holdsNativeBinary = (probe, dir, depth = 0) => {
26
+ if (depth > 4) return false;
27
+ const entries = probe.listDir(dir);
28
+ if (!entries) return false;
29
+ return entries.some((entry) => {
30
+ const path = probe.join(dir, entry);
31
+ const size = probe.fileSize(path);
32
+ if (size !== null) return size >= NATIVE_BINARY_MIN_BYTES;
33
+ return holdsNativeBinary(probe, path, depth + 1);
34
+ });
35
+ };
36
+ var platformPackages = (probe, packageRoot) => {
37
+ const scopes = [probe.join(packageRoot, "node_modules", "@openai"), probe.dirname(packageRoot)];
38
+ return scopes.flatMap(
39
+ (scope) => (probe.listDir(scope) ?? []).filter((entry) => entry.startsWith("codex-")).map((entry) => probe.join(scope, entry))
40
+ );
41
+ };
42
+ var checkCodexInstall = (probe) => {
43
+ const onPath = probe.resolveOnPath();
44
+ if (!onPath) return { kind: "unknown" };
45
+ const packageRoot = packageRootFor(probe, probe.realpath(onPath) ?? onPath);
46
+ if (!packageRoot) return { kind: "unknown" };
47
+ const vendors = platformPackages(probe, packageRoot).map((pkg) => probe.join(pkg, "vendor")).filter((vendor) => probe.exists(vendor));
48
+ if (vendors.length === 0) return { kind: "unknown" };
49
+ if (vendors.some((vendor) => holdsNativeBinary(probe, vendor))) return { kind: "ok" };
50
+ return { kind: "binary-missing", vendorDir: vendors[0] };
51
+ };
52
+
53
+ // src/setup/codex-install-probe.ts
54
+ import { existsSync, readdirSync, statSync } from "fs";
55
+ import { dirname, join } from "path";
56
+ var listDir = (path) => {
57
+ try {
58
+ return readdirSync(path);
59
+ } catch {
60
+ return null;
61
+ }
62
+ };
63
+ var fileSize = (path) => {
64
+ try {
65
+ const stat = statSync(path);
66
+ return stat.isFile() ? stat.size : null;
67
+ } catch {
68
+ return null;
69
+ }
70
+ };
71
+ var nodeCodexInstallProbe = (resolveOnPath) => ({
72
+ resolveOnPath,
73
+ realpath,
74
+ exists: existsSync,
75
+ listDir,
76
+ fileSize,
77
+ join,
78
+ dirname
79
+ });
80
+ var codexInstallHealthAt = (binary) => checkCodexInstall(nodeCodexInstallProbe(() => binary));
81
+
82
+ // src/live-capabilities.ts
83
+ var CLAUDE_BRIDGE_CAPABILITY = "claude-bridge";
84
+ var CLAUDE_RESUME_CAPABILITY = "claude-resume";
85
+ var CODEX_BRIDGE_CAPABILITY = "codex-bridge";
86
+ var CODEX_RESUME_CAPABILITY = "codex-resume";
87
+ var GEMINI_BRIDGE_CAPABILITY = "gemini-bridge";
88
+ var GEMINI_RESUME_CAPABILITY = "gemini-resume";
89
+ var GEMINI_BRIDGE_MIN_VERSION = [0, 40, 0];
90
+ var version = (raw) => {
91
+ const match = raw?.match(/^(\d+)\.(\d+)\.(\d+)/);
92
+ return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
93
+ };
94
+ var geminiLiveCapabilities = (rawVersion) => {
95
+ const installed = version(rawVersion);
96
+ if (!installed) return [];
97
+ for (let index = 0; index < GEMINI_BRIDGE_MIN_VERSION.length; index++) {
98
+ if (installed[index] > GEMINI_BRIDGE_MIN_VERSION[index]) break;
99
+ if (installed[index] < GEMINI_BRIDGE_MIN_VERSION[index]) return [];
100
+ }
101
+ return [GEMINI_BRIDGE_CAPABILITY, GEMINI_RESUME_CAPABILITY];
102
+ };
103
+ var providerLiveCapabilities = (probe) => [
104
+ ...probe.claude ? [CLAUDE_BRIDGE_CAPABILITY, CLAUDE_RESUME_CAPABILITY] : [],
105
+ ...probe.codex ? [CODEX_BRIDGE_CAPABILITY, CODEX_RESUME_CAPABILITY] : [],
106
+ ...geminiLiveCapabilities(probe.geminiVersion)
107
+ ];
108
+ var PROVIDER_BY_BRIDGE_CAPABILITY = [
109
+ [CLAUDE_BRIDGE_CAPABILITY, "claude"],
110
+ [CODEX_BRIDGE_CAPABILITY, "codex"],
111
+ [GEMINI_BRIDGE_CAPABILITY, "gemini"]
112
+ ];
113
+ var launchableProviders = (capabilities) => PROVIDER_BY_BRIDGE_CAPABILITY.filter(([capability]) => capabilities.includes(capability)).map(([, provider]) => provider);
114
+ var hasSpawnProvider = (capabilities) => launchableProviders(capabilities).length > 0;
115
+ var resolveControlPolicy = (input) => {
116
+ if (input.mode === "off") return "disabled";
117
+ if (input.mode === null && !input.servicePresent) return "preserve-absent";
118
+ if (input.providerAvailable && input.managerAvailable) return "enabled";
119
+ return input.servicePresent ? "legacy" : "unsupported";
120
+ };
121
+ var preferGlobalProviderBinary = (platform) => platform === "win32";
122
+ var resolveProviderBinary = (provider, platform = process.platform) => preferGlobalProviderBinary(platform) ? resolveGlobalBinary(provider) ?? resolvePathBinary(provider, platform) : resolvePathBinary(provider, platform) ?? resolveGlobalBinary(provider);
123
+ var codexBinaryIsBroken = (binary) => codexInstallHealthAt(binary).kind === "binary-missing";
124
+ var detectCapabilities = (providers, codexCanStart) => {
125
+ const enabled = new Set(providers);
126
+ const binaryFor = (provider) => enabled.has(provider) ? resolveProviderBinary(provider) : void 0;
127
+ const codexBin = binaryFor("codex");
128
+ const geminiBin = binaryFor("gemini");
129
+ return providerLiveCapabilities({
130
+ claude: binaryFor("claude") !== void 0,
131
+ codex: codexBin !== void 0 && codexCanStart(codexBin),
132
+ geminiVersion: geminiBin ? resolvePackageVersionFromBinary(geminiBin, "@google/gemini-cli") ?? resolveGlobalPackageVersion("@google/gemini-cli") : void 0
133
+ });
134
+ };
135
+ var anyInstalledCodex = () => true;
136
+ var codexWithItsProgram = (binary) => !codexBinaryIsBroken(binary);
137
+ var detectProviderLiveCapabilities = (providers = MANAGED_PROVIDERS) => detectCapabilities(providers, anyInstalledCodex);
138
+ var detectLaunchableProviderCapabilities = (providers = MANAGED_PROVIDERS) => detectCapabilities(providers, codexWithItsProgram);
139
+ var SPAWN_CAPABILITY = "spawn";
140
+ var launchAdvertisement = (launchable) => hasSpawnProvider(launchable) ? [SPAWN_CAPABILITY, ...launchable] : launchable;
141
+ var expectedLaunchCapabilities = (providers = MANAGED_PROVIDERS) => launchAdvertisement(detectLaunchableProviderCapabilities(providers));
142
+ var discoverProviderInventory = async (providers, signal, platform = process.platform) => {
143
+ let prefix;
144
+ const globalBinary = async (provider) => {
145
+ const location = await (prefix ??= readGlobalPrefixAsync(signal));
146
+ return location === void 0 ? void 0 : resolveGlobalBinaryAt(provider, location, platform);
147
+ };
148
+ const findBinary = async (provider) => {
149
+ const binary = preferGlobalProviderBinary(platform) ? await globalBinary(provider) ?? await resolvePathBinaryAsync(provider, signal, platform) : await resolvePathBinaryAsync(provider, signal, platform) ?? await globalBinary(provider);
150
+ return [provider, binary];
151
+ };
152
+ const found = await Promise.all([...new Set(providers)].map(findBinary));
153
+ const binaries = {};
154
+ for (const [provider, binary] of found) {
155
+ if (binary !== void 0) binaries[provider] = binary;
156
+ }
157
+ return {
158
+ binaries,
159
+ capabilities: providerLiveCapabilities({
160
+ claude: binaries.claude !== void 0,
161
+ codex: binaries.codex !== void 0 && !codexBinaryIsBroken(binaries.codex),
162
+ geminiVersion: binaries.gemini ? resolvePackageVersionFromBinary(binaries.gemini, "@google/gemini-cli") ?? await resolveGlobalPackageVersionAsync("@google/gemini-cli", signal) : void 0
163
+ })
164
+ };
165
+ };
166
+ var trackProviderInventory = async (providers, onChange) => {
167
+ const controller = new AbortController();
168
+ let current = await discoverProviderInventory(providers, controller.signal);
169
+ let pending;
170
+ const accept = (next) => {
171
+ if (controller.signal.aborted) return;
172
+ current = next;
173
+ onChange(current);
174
+ };
175
+ const refresh = () => {
176
+ if (controller.signal.aborted) return Promise.resolve();
177
+ return pending ??= discoverProviderInventory(providers, controller.signal).then(accept).finally(() => {
178
+ pending = void 0;
179
+ });
180
+ };
181
+ return { get current() {
182
+ return current;
183
+ }, refresh, stop: () => controller.abort() };
184
+ };
185
+
186
+ export {
187
+ checkCodexInstall,
188
+ nodeCodexInstallProbe,
189
+ launchableProviders,
190
+ hasSpawnProvider,
191
+ resolveControlPolicy,
192
+ resolveProviderBinary,
193
+ codexBinaryIsBroken,
194
+ detectProviderLiveCapabilities,
195
+ launchAdvertisement,
196
+ expectedLaunchCapabilities,
197
+ trackProviderInventory
198
+ };
@@ -4,10 +4,10 @@ import {
4
4
  } from "./chunk-POFBE6ZY.js";
5
5
  import {
6
6
  isNetworkFailure
7
- } from "./chunk-2SLCHCVN.js";
7
+ } from "./chunk-4CW5EAOI.js";
8
8
  import {
9
9
  clientReportClaims
10
- } from "./chunk-UPLV5AJF.js";
10
+ } from "./chunk-ZR7LIQKO.js";
11
11
  import {
12
12
  getApiKey,
13
13
  getBaseUrl
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parseSseMessages
3
- } from "./chunk-I4HKMUZQ.js";
3
+ } from "./chunk-34EQOFMH.js";
4
4
  import {
5
5
  NPX_LATEST_COMMAND
6
6
  } from "./chunk-35X5UDML.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-POFBE6ZY.js";
4
4
  import {
5
5
  autoUpdateState
6
- } from "./chunk-UPLV5AJF.js";
6
+ } from "./chunk-ZR7LIQKO.js";
7
7
  import {
8
8
  readJsonSafe,
9
9
  writeJsonAtomic
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  describeKeyCheck,
6
6
  keyCheckFromResponse
7
- } from "./chunk-DVW2MYCM.js";
7
+ } from "./chunk-6UDK5TY6.js";
8
8
  import {
9
9
  EXIT
10
10
  } from "./chunk-KZERVKTD.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  guardBinary
3
- } from "./chunk-UPLV5AJF.js";
3
+ } from "./chunk-ZR7LIQKO.js";
4
4
 
5
5
  // src/bell/install.ts
6
6
  import { join } from "path";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MCP_BRIDGE_BINARY
3
- } from "./chunk-T55H6YEP.js";
3
+ } from "./chunk-VF3X4MDB.js";
4
4
  import {
5
5
  openCodeConfigDirFrom
6
6
  } from "./chunk-NOLPURUI.js";
@@ -11,7 +11,7 @@ import {
11
11
  NpmMissingError,
12
12
  codexHomeFrom,
13
13
  resolvePathBinary
14
- } from "./chunk-UPLV5AJF.js";
14
+ } from "./chunk-ZR7LIQKO.js";
15
15
  import {
16
16
  readJsonSafe,
17
17
  writeFileAtomic,