pushary 1.8.1 → 1.8.2

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 (45) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/bin/pushary-bell-hook.js +6 -5
  3. package/dist/bin/pushary-claude.js +5 -4
  4. package/dist/bin/pushary-clean.js +7 -6
  5. package/dist/bin/pushary-codex-bridge.js +7 -5
  6. package/dist/bin/pushary-codex-hook.js +7 -6
  7. package/dist/bin/pushary-daemon.js +82 -18
  8. package/dist/bin/pushary-disconnect.js +4 -3
  9. package/dist/bin/pushary-doctor.js +10 -7
  10. package/dist/bin/pushary-elicitation-hook.js +6 -5
  11. package/dist/bin/pushary-gemini-bridge.js +7 -4
  12. package/dist/bin/pushary-gemini-hook.js +6 -5
  13. package/dist/bin/pushary-hook.js +9 -8
  14. package/dist/bin/pushary-notification-hook.js +8 -7
  15. package/dist/bin/pushary-opencode-hook.js +6 -5
  16. package/dist/bin/pushary-permission-denied-hook.js +9 -8
  17. package/dist/bin/pushary-permission-hook.js +9 -8
  18. package/dist/bin/pushary-post-hook.js +8 -7
  19. package/dist/bin/pushary-prompt-hook.js +8 -7
  20. package/dist/bin/pushary-session-end-hook.js +8 -7
  21. package/dist/bin/pushary-session-start-hook.js +10 -9
  22. package/dist/bin/pushary-setup.js +22 -78
  23. package/dist/bin/pushary-status.js +4 -2
  24. package/dist/bin/pushary-stop-hook.js +8 -7
  25. package/dist/bin/pushary-stopfailure-hook.js +8 -7
  26. package/dist/bin/pushary-transcript-register.js +5 -4
  27. package/dist/bin/pushary-upgrade.js +10 -8
  28. package/dist/{chunk-JRQRNNGA.js → chunk-644AEX4T.js} +1 -1
  29. package/dist/chunk-6ICPEJY5.js +20 -0
  30. package/dist/{chunk-GH6KGWMC.js → chunk-B3UVRGYP.js} +9 -7
  31. package/dist/{chunk-HBWC3JVZ.js → chunk-BDMC5H5L.js} +1 -1
  32. package/dist/{chunk-6TK4IY3A.js → chunk-DUA5O6X5.js} +1 -1
  33. package/dist/{chunk-FLQPM2GQ.js → chunk-EESPY5DG.js} +1 -1
  34. package/dist/{chunk-TKQ6LZQZ.js → chunk-I3XLHSOC.js} +3 -2
  35. package/dist/{chunk-QB6QYZ6B.js → chunk-MOTNSXC3.js} +2 -2
  36. package/dist/{chunk-HQRCVEI2.js → chunk-NNWQ5VDB.js} +1 -1
  37. package/dist/{chunk-ASWRMBOM.js → chunk-RIVNNBEK.js} +2 -1
  38. package/dist/{chunk-HTEGMMT3.js → chunk-S2UNQQQS.js} +4 -17
  39. package/dist/{chunk-OCVVSRDA.js → chunk-XEGVVU5H.js} +1 -1
  40. package/dist/chunk-XQZEIWAV.js +150 -0
  41. package/dist/{chunk-GBNQXYN4.js → chunk-YNCGXHM4.js} +1 -1
  42. package/dist/{reapply-ICGTBHVE.js → reapply-3UERAKQN.js} +6 -5
  43. package/dist/src/index.js +5 -4
  44. package/package.json +1 -1
  45. package/dist/chunk-VZMIHERK.js +0 -59
@@ -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,3 @@
1
- import {
2
- detectClaudeVersion
3
- } from "./chunk-ASWRMBOM.js";
4
1
  import {
5
2
  ensureCodexTrustsPusharyHooks
6
3
  } from "./chunk-W2LJ4O3A.js";
@@ -8,26 +5,31 @@ import {
8
5
  addClaudeMcpServer,
9
6
  addPusharyHooks,
10
7
  addPusharyToolPermissions
11
- } from "./chunk-JRQRNNGA.js";
8
+ } from "./chunk-644AEX4T.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-XEGVVU5H.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-S2UNQQQS.js";
30
+ import {
31
+ formatVersion
32
+ } from "./chunk-6ICPEJY5.js";
31
33
  import {
32
34
  CODEX_HOOK_BINARY,
33
35
  addCodexHookTrust,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyHookExecutable
3
- } from "./chunk-OCVVSRDA.js";
3
+ } from "./chunk-XEGVVU5H.js";
4
4
  import {
5
5
  isProtectedByScope,
6
6
  registerHookEntry
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-SGZJ5LYH.js";
7
7
  import {
8
8
  hookOwnerOf
9
- } from "./chunk-GBNQXYN4.js";
9
+ } from "./chunk-YNCGXHM4.js";
10
10
  import {
11
11
  ensureDaemonRunning
12
12
  } from "./chunk-EIGJYCOE.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  registerTranscript
3
- } from "./chunk-6TK4IY3A.js";
3
+ } from "./chunk-DUA5O6X5.js";
4
4
  import {
5
5
  writeDegraded
6
6
  } from "./chunk-KB2FTO4O.js";
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  detectProviderLiveCapabilities,
3
+ expectedLaunchCapabilities,
3
4
  hasSpawnProvider,
4
5
  resolveControlPolicy
5
- } from "./chunk-VZMIHERK.js";
6
+ } from "./chunk-XQZEIWAV.js";
6
7
  import {
7
8
  daemonHasRemoteProof,
8
9
  daemonServiceManagerAvailable,
@@ -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,
@@ -3,12 +3,12 @@ import {
3
3
  addPusharyToolPermissions,
4
4
  isPusharyHook,
5
5
  removeClaudeMcpServers
6
- } from "./chunk-JRQRNNGA.js";
6
+ } from "./chunk-644AEX4T.js";
7
7
  import {
8
8
  CLAUDE_HOOK_EVENTS,
9
9
  addGeminiMcpServer,
10
10
  removeGeminiMcpServer
11
- } from "./chunk-HTEGMMT3.js";
11
+ } from "./chunk-S2UNQQQS.js";
12
12
  import {
13
13
  CLAUDE_CODE_AGENT,
14
14
  parseApplyPatchFiles
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  activeHookSource,
3
3
  activeIdentity
4
- } from "./chunk-QB6QYZ6B.js";
4
+ } from "./chunk-MOTNSXC3.js";
5
5
  import {
6
6
  defersToNativeMode,
7
7
  reportMachineDenial
@@ -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
  };
@@ -1,3 +1,7 @@
1
+ import {
2
+ atLeast,
3
+ formatVersion
4
+ } from "./chunk-6ICPEJY5.js";
1
5
  import {
2
6
  NOTIFICATION_MATCHED_TYPES,
3
7
  POSTTOOLUSE_MIRRORED_TOOLS
@@ -111,20 +115,6 @@ var missingGeminiHookEvents = (settings) => {
111
115
  }).map((definition) => definition.event);
112
116
  };
113
117
 
114
- // src/agent-version.ts
115
- var parseVersion = (raw) => {
116
- const match = raw.match(/(\d+)\.(\d+)\.(\d+)/);
117
- return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
118
- };
119
- var compareVersion = (a, b) => {
120
- for (let index = 0; index < 3; index++) {
121
- if (a[index] !== b[index]) return a[index] < b[index] ? -1 : 1;
122
- }
123
- return 0;
124
- };
125
- var atLeast = (version, floor) => compareVersion(version, floor) >= 0;
126
- var formatVersion = (version) => version.join(".");
127
-
128
118
  // src/claude-events.ts
129
119
  var MIRRORED_TOOLS = POSTTOOLUSE_MIRRORED_TOOLS.join("|");
130
120
  var ESTABLISHED = [1, 0, 0];
@@ -174,9 +164,6 @@ export {
174
164
  removeGeminiSettings,
175
165
  hasGeminiHooks,
176
166
  missingGeminiHookEvents,
177
- parseVersion,
178
- compareVersion,
179
- formatVersion,
180
167
  CLAUDE_HOOK_BINARY,
181
168
  CLAUDE_HOOK_EVENTS,
182
169
  supportedClaudeEvents,
@@ -2,7 +2,7 @@ import {
2
2
  CLAUDE_HOOK_EVENTS,
3
3
  GEMINI_HOOK_EVENTS,
4
4
  hasGeminiHooks
5
- } from "./chunk-HTEGMMT3.js";
5
+ } from "./chunk-S2UNQQQS.js";
6
6
  import {
7
7
  CODEX_HOOK_EVENTS,
8
8
  hasCodexHooks,
@@ -0,0 +1,150 @@
1
+ import {
2
+ realpath
3
+ } from "./chunk-RIVNNBEK.js";
4
+ import {
5
+ resolveGlobalBinary,
6
+ resolveGlobalPackageVersion,
7
+ resolvePackageVersionFromBinary,
8
+ resolvePathBinary
9
+ } from "./chunk-UPLV5AJF.js";
10
+ import {
11
+ MANAGED_PROVIDERS
12
+ } from "./chunk-5YY3IJT4.js";
13
+
14
+ // src/setup/codex-install.ts
15
+ var NATIVE_BINARY_MIN_BYTES = 20 * 1024 * 1024;
16
+ var packageRootFor = (probe, binPath) => {
17
+ const binDir = probe.dirname(binPath);
18
+ const root = probe.dirname(binDir);
19
+ return probe.join(root, "bin") === binDir && probe.exists(probe.join(root, "package.json")) ? root : null;
20
+ };
21
+ var holdsNativeBinary = (probe, dir, depth = 0) => {
22
+ if (depth > 4) return false;
23
+ const entries = probe.listDir(dir);
24
+ if (!entries) return false;
25
+ return entries.some((entry) => {
26
+ const path = probe.join(dir, entry);
27
+ const size = probe.fileSize(path);
28
+ if (size !== null) return size >= NATIVE_BINARY_MIN_BYTES;
29
+ return holdsNativeBinary(probe, path, depth + 1);
30
+ });
31
+ };
32
+ var platformPackages = (probe, packageRoot) => {
33
+ const scopes = [probe.join(packageRoot, "node_modules", "@openai"), probe.dirname(packageRoot)];
34
+ return scopes.flatMap(
35
+ (scope) => (probe.listDir(scope) ?? []).filter((entry) => entry.startsWith("codex-")).map((entry) => probe.join(scope, entry))
36
+ );
37
+ };
38
+ var checkCodexInstall = (probe) => {
39
+ const onPath = probe.resolveOnPath();
40
+ if (!onPath) return { kind: "unknown" };
41
+ const packageRoot = packageRootFor(probe, probe.realpath(onPath) ?? onPath);
42
+ if (!packageRoot) return { kind: "unknown" };
43
+ const vendors = platformPackages(probe, packageRoot).map((pkg) => probe.join(pkg, "vendor")).filter((vendor) => probe.exists(vendor));
44
+ if (vendors.length === 0) return { kind: "unknown" };
45
+ if (vendors.some((vendor) => holdsNativeBinary(probe, vendor))) return { kind: "ok" };
46
+ return { kind: "binary-missing", vendorDir: vendors[0] };
47
+ };
48
+
49
+ // src/setup/codex-install-probe.ts
50
+ import { existsSync, readdirSync, statSync } from "fs";
51
+ import { dirname, join } from "path";
52
+ var listDir = (path) => {
53
+ try {
54
+ return readdirSync(path);
55
+ } catch {
56
+ return null;
57
+ }
58
+ };
59
+ var fileSize = (path) => {
60
+ try {
61
+ const stat = statSync(path);
62
+ return stat.isFile() ? stat.size : null;
63
+ } catch {
64
+ return null;
65
+ }
66
+ };
67
+ var nodeCodexInstallProbe = (resolveOnPath) => ({
68
+ resolveOnPath,
69
+ realpath,
70
+ exists: existsSync,
71
+ listDir,
72
+ fileSize,
73
+ join,
74
+ dirname
75
+ });
76
+ var codexInstallHealthAt = (binary) => checkCodexInstall(nodeCodexInstallProbe(() => binary));
77
+
78
+ // src/live-capabilities.ts
79
+ var CLAUDE_BRIDGE_CAPABILITY = "claude-bridge";
80
+ var CLAUDE_RESUME_CAPABILITY = "claude-resume";
81
+ var CODEX_BRIDGE_CAPABILITY = "codex-bridge";
82
+ var CODEX_RESUME_CAPABILITY = "codex-resume";
83
+ var GEMINI_BRIDGE_CAPABILITY = "gemini-bridge";
84
+ var GEMINI_RESUME_CAPABILITY = "gemini-resume";
85
+ var GEMINI_BRIDGE_MIN_VERSION = [0, 40, 0];
86
+ var version = (raw) => {
87
+ const match = raw?.match(/^(\d+)\.(\d+)\.(\d+)/);
88
+ return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
89
+ };
90
+ var geminiLiveCapabilities = (rawVersion) => {
91
+ const installed = version(rawVersion);
92
+ if (!installed) return [];
93
+ for (let index = 0; index < GEMINI_BRIDGE_MIN_VERSION.length; index++) {
94
+ if (installed[index] > GEMINI_BRIDGE_MIN_VERSION[index]) break;
95
+ if (installed[index] < GEMINI_BRIDGE_MIN_VERSION[index]) return [];
96
+ }
97
+ return [GEMINI_BRIDGE_CAPABILITY, GEMINI_RESUME_CAPABILITY];
98
+ };
99
+ var providerLiveCapabilities = (probe) => [
100
+ ...probe.claude ? [CLAUDE_BRIDGE_CAPABILITY, CLAUDE_RESUME_CAPABILITY] : [],
101
+ ...probe.codex ? [CODEX_BRIDGE_CAPABILITY, CODEX_RESUME_CAPABILITY] : [],
102
+ ...geminiLiveCapabilities(probe.geminiVersion)
103
+ ];
104
+ var PROVIDER_BY_BRIDGE_CAPABILITY = [
105
+ [CLAUDE_BRIDGE_CAPABILITY, "claude"],
106
+ [CODEX_BRIDGE_CAPABILITY, "codex"],
107
+ [GEMINI_BRIDGE_CAPABILITY, "gemini"]
108
+ ];
109
+ var launchableProviders = (capabilities) => PROVIDER_BY_BRIDGE_CAPABILITY.filter(([capability]) => capabilities.includes(capability)).map(([, provider]) => provider);
110
+ var hasSpawnProvider = (capabilities) => launchableProviders(capabilities).length > 0;
111
+ var resolveControlPolicy = (input) => {
112
+ if (input.mode === "off") return "disabled";
113
+ if (input.mode === null && !input.servicePresent) return "preserve-absent";
114
+ if (input.providerAvailable && input.managerAvailable) return "enabled";
115
+ return input.servicePresent ? "legacy" : "unsupported";
116
+ };
117
+ var resolveProviderBinary = (provider, platform = process.platform) => platform === "win32" ? resolveGlobalBinary(provider) ?? resolvePathBinary(provider, platform) : resolvePathBinary(provider, platform) ?? resolveGlobalBinary(provider);
118
+ var codexBinaryIsBroken = (binary) => codexInstallHealthAt(binary).kind === "binary-missing";
119
+ var detectCapabilities = (providers, codexCanStart) => {
120
+ const enabled = new Set(providers);
121
+ const binaryFor = (provider) => enabled.has(provider) ? resolveProviderBinary(provider) : void 0;
122
+ const codexBin = binaryFor("codex");
123
+ const geminiBin = binaryFor("gemini");
124
+ return providerLiveCapabilities({
125
+ claude: binaryFor("claude") !== void 0,
126
+ codex: codexBin !== void 0 && codexCanStart(codexBin),
127
+ geminiVersion: geminiBin ? resolvePackageVersionFromBinary(geminiBin, "@google/gemini-cli") ?? resolveGlobalPackageVersion("@google/gemini-cli") : void 0
128
+ });
129
+ };
130
+ var anyInstalledCodex = () => true;
131
+ var codexWithItsProgram = (binary) => !codexBinaryIsBroken(binary);
132
+ var detectProviderLiveCapabilities = (providers = MANAGED_PROVIDERS) => detectCapabilities(providers, anyInstalledCodex);
133
+ var detectLaunchableProviderCapabilities = (providers = MANAGED_PROVIDERS) => detectCapabilities(providers, codexWithItsProgram);
134
+ var SPAWN_CAPABILITY = "spawn";
135
+ var launchAdvertisement = (launchable) => hasSpawnProvider(launchable) ? [SPAWN_CAPABILITY, ...launchable] : launchable;
136
+ var expectedLaunchCapabilities = (providers = MANAGED_PROVIDERS) => launchAdvertisement(detectLaunchableProviderCapabilities(providers));
137
+
138
+ export {
139
+ checkCodexInstall,
140
+ nodeCodexInstallProbe,
141
+ launchableProviders,
142
+ hasSpawnProvider,
143
+ resolveControlPolicy,
144
+ resolveProviderBinary,
145
+ codexBinaryIsBroken,
146
+ detectProviderLiveCapabilities,
147
+ detectLaunchableProviderCapabilities,
148
+ launchAdvertisement,
149
+ expectedLaunchCapabilities
150
+ };
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-MYHG7PX2.js";
7
7
  import {
8
8
  pusharyHookExecutable
9
- } from "./chunk-OCVVSRDA.js";
9
+ } from "./chunk-XEGVVU5H.js";
10
10
  import {
11
11
  BELL_HOOK_BINARY
12
12
  } from "./chunk-HOEB6AKG.js";
@@ -9,13 +9,14 @@ import {
9
9
  reapplyGeminiSettings,
10
10
  reapplyVsCodePlugin,
11
11
  repairCodexHolds
12
- } from "./chunk-GH6KGWMC.js";
13
- import "./chunk-ASWRMBOM.js";
12
+ } from "./chunk-B3UVRGYP.js";
14
13
  import "./chunk-W2LJ4O3A.js";
15
- import "./chunk-JRQRNNGA.js";
16
- import "./chunk-OCVVSRDA.js";
17
- import "./chunk-HTEGMMT3.js";
14
+ import "./chunk-644AEX4T.js";
15
+ import "./chunk-RIVNNBEK.js";
16
+ import "./chunk-XEGVVU5H.js";
17
+ import "./chunk-S2UNQQQS.js";
18
18
  import "./chunk-XHKBHWLX.js";
19
+ import "./chunk-6ICPEJY5.js";
19
20
  import "./chunk-VFFHQC7W.js";
20
21
  import "./chunk-UPLV5AJF.js";
21
22
  import "./chunk-T7E75EKA.js";
package/dist/src/index.js CHANGED
@@ -1,15 +1,16 @@
1
1
  import {
2
2
  handlePreToolUse
3
- } from "../chunk-HQRCVEI2.js";
4
- import "../chunk-QB6QYZ6B.js";
5
- import "../chunk-JRQRNNGA.js";
3
+ } from "../chunk-NNWQ5VDB.js";
4
+ import "../chunk-MOTNSXC3.js";
5
+ import "../chunk-644AEX4T.js";
6
6
  import "../chunk-5DGNEUXK.js";
7
7
  import "../chunk-7ITOAMCD.js";
8
8
  import "../chunk-5OP5MQI7.js";
9
- import "../chunk-HTEGMMT3.js";
9
+ import "../chunk-S2UNQQQS.js";
10
10
  import {
11
11
  fetchAccountPublicKey
12
12
  } from "../chunk-UMMCHS6P.js";
13
+ import "../chunk-6ICPEJY5.js";
13
14
  import {
14
15
  fetchModeOverride,
15
16
  fetchModeState,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pushary",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "description": "Permission hooks for AI coding agents: route tool approvals through Pushary push notifications",
5
5
  "keywords": [
6
6
  "pushary",
@@ -1,59 +0,0 @@
1
- import {
2
- resolveBinary,
3
- resolveGlobalPackageVersion,
4
- resolvePackageVersionFromBinary
5
- } from "./chunk-UPLV5AJF.js";
6
- import {
7
- MANAGED_PROVIDERS
8
- } from "./chunk-5YY3IJT4.js";
9
-
10
- // src/live-capabilities.ts
11
- var CLAUDE_BRIDGE_CAPABILITY = "claude-bridge";
12
- var CLAUDE_RESUME_CAPABILITY = "claude-resume";
13
- var CODEX_BRIDGE_CAPABILITY = "codex-bridge";
14
- var CODEX_RESUME_CAPABILITY = "codex-resume";
15
- var GEMINI_BRIDGE_CAPABILITY = "gemini-bridge";
16
- var GEMINI_RESUME_CAPABILITY = "gemini-resume";
17
- var GEMINI_BRIDGE_MIN_VERSION = [0, 40, 0];
18
- var version = (raw) => {
19
- const match = raw?.match(/^(\d+)\.(\d+)\.(\d+)/);
20
- return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
21
- };
22
- var geminiLiveCapabilities = (rawVersion) => {
23
- const installed = version(rawVersion);
24
- if (!installed) return [];
25
- for (let index = 0; index < GEMINI_BRIDGE_MIN_VERSION.length; index++) {
26
- if (installed[index] > GEMINI_BRIDGE_MIN_VERSION[index]) break;
27
- if (installed[index] < GEMINI_BRIDGE_MIN_VERSION[index]) return [];
28
- }
29
- return [GEMINI_BRIDGE_CAPABILITY, GEMINI_RESUME_CAPABILITY];
30
- };
31
- var providerLiveCapabilities = (probe) => [
32
- ...probe.claude ? [CLAUDE_BRIDGE_CAPABILITY, CLAUDE_RESUME_CAPABILITY] : [],
33
- ...probe.codex ? [CODEX_BRIDGE_CAPABILITY, CODEX_RESUME_CAPABILITY] : [],
34
- ...geminiLiveCapabilities(probe.geminiVersion)
35
- ];
36
- var hasSpawnProvider = (capabilities) => capabilities.some(
37
- (capability) => capability === CLAUDE_BRIDGE_CAPABILITY || capability === CODEX_BRIDGE_CAPABILITY || capability === GEMINI_BRIDGE_CAPABILITY
38
- );
39
- var resolveControlPolicy = (input) => {
40
- if (input.mode === "off") return "disabled";
41
- if (input.mode === null && !input.servicePresent) return "preserve-absent";
42
- if (input.providerAvailable && input.managerAvailable) return "enabled";
43
- return input.servicePresent ? "legacy" : "unsupported";
44
- };
45
- var detectProviderLiveCapabilities = (providers = MANAGED_PROVIDERS) => {
46
- const enabled = new Set(providers);
47
- const geminiBin = enabled.has("gemini") ? resolveBinary("gemini") : void 0;
48
- return providerLiveCapabilities({
49
- claude: enabled.has("claude") && resolveBinary("claude") !== void 0,
50
- codex: enabled.has("codex") && resolveBinary("codex") !== void 0,
51
- geminiVersion: geminiBin ? resolvePackageVersionFromBinary(geminiBin, "@google/gemini-cli") ?? resolveGlobalPackageVersion("@google/gemini-cli") : void 0
52
- });
53
- };
54
-
55
- export {
56
- hasSpawnProvider,
57
- resolveControlPolicy,
58
- detectProviderLiveCapabilities
59
- };