@pushary/agent-hooks 1.9.60 → 1.9.61

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 (99) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +6 -0
  3. package/dist/{api-ASQA5PZM.js → api-LW3PJQYY.js} +8 -7
  4. package/dist/bin/pushary-bell-hook.js +16 -15
  5. package/dist/bin/pushary-bell.js +4 -3
  6. package/dist/bin/pushary-claude.js +16 -15
  7. package/dist/bin/pushary-clean.js +26 -24
  8. package/dist/bin/pushary-codex-bridge.js +11 -10
  9. package/dist/bin/pushary-codex-hook.js +20 -19
  10. package/dist/bin/pushary-codex-session.js +9 -8
  11. package/dist/bin/pushary-codex.js +9 -8
  12. package/dist/bin/pushary-connect.js +18 -17
  13. package/dist/bin/pushary-cowork.js +1 -0
  14. package/dist/bin/pushary-daemon.js +24 -23
  15. package/dist/bin/pushary-disconnect.js +18 -17
  16. package/dist/bin/pushary-doctor.js +26 -25
  17. package/dist/bin/pushary-elicitation-hook.js +17 -16
  18. package/dist/bin/pushary-gemini-bridge.js +6 -5
  19. package/dist/bin/pushary-gemini-hook.js +18 -17
  20. package/dist/bin/pushary-hook.js +19 -18
  21. package/dist/bin/pushary-login.js +7 -6
  22. package/dist/bin/pushary-logout.js +17 -16
  23. package/dist/bin/pushary-mcp.js +9 -8
  24. package/dist/bin/pushary-mode.js +7 -6
  25. package/dist/bin/pushary-notification-hook.js +16 -15
  26. package/dist/bin/pushary-opencode-hook.js +17 -16
  27. package/dist/bin/pushary-permission-denied-hook.js +19 -18
  28. package/dist/bin/pushary-permission-hook.js +19 -18
  29. package/dist/bin/pushary-post-hook.js +16 -15
  30. package/dist/bin/pushary-prompt-hook.js +16 -15
  31. package/dist/bin/pushary-session-end-hook.js +16 -15
  32. package/dist/bin/pushary-session-start-hook.js +22 -21
  33. package/dist/bin/pushary-setup.js +4180 -78
  34. package/dist/bin/pushary-stats.js +1 -0
  35. package/dist/bin/pushary-status.js +20 -19
  36. package/dist/bin/pushary-stop-hook.js +16 -15
  37. package/dist/bin/pushary-stopfailure-hook.js +16 -15
  38. package/dist/bin/pushary-suggestions.js +7 -6
  39. package/dist/bin/pushary-transcript-register.js +9 -8
  40. package/dist/bin/pushary-transcripts.js +1 -0
  41. package/dist/bin/pushary-upgrade.js +33 -27
  42. package/dist/bin/pushary-wait.js +7 -6
  43. package/dist/bin/pushary.js +5 -4
  44. package/dist/{chunk-VIJIG5YL.js → chunk-4N5E4JNF.js} +2 -2
  45. package/dist/{chunk-WXZHQ3TT.js → chunk-4VRTSDGP.js} +2 -2
  46. package/dist/{chunk-YGE6ML3O.js → chunk-64S5PQBQ.js} +1 -1
  47. package/dist/{chunk-6MC2XXFD.js → chunk-6FJ6CK32.js} +3 -3
  48. package/dist/{chunk-RLVJ6TVL.js → chunk-6T5Z64KS.js} +24 -16
  49. package/dist/{chunk-4MWRR5IT.js → chunk-7BAO42UV.js} +1 -1
  50. package/dist/{chunk-5RU35K57.js → chunk-7HDGH3Z2.js} +1 -1
  51. package/dist/{chunk-J4KQL7YZ.js → chunk-7MCCXE5Y.js} +3 -3
  52. package/dist/{chunk-CDQHQAS7.js → chunk-BJTSKOH3.js} +3 -3
  53. package/dist/{chunk-4PZXI7WU.js → chunk-BQ2VV7LY.js} +2 -2
  54. package/dist/{chunk-56JCQQLS.js → chunk-BUZIEL7Y.js} +2 -2
  55. package/dist/{chunk-QUBIEZXC.js → chunk-CICLXLQN.js} +2 -2
  56. package/dist/{chunk-2QREHU4O.js → chunk-CJ5TCFD4.js} +3 -3
  57. package/dist/{chunk-W2IVTHIG.js → chunk-DQLCFGHK.js} +7 -5
  58. package/dist/{chunk-CEQ2AZH4.js → chunk-EUIPTDLX.js} +3 -3
  59. package/dist/{chunk-6LOQE4J4.js → chunk-G36T5LAP.js} +1 -1
  60. package/dist/{chunk-S54C6TQC.js → chunk-GDKQUB52.js} +4 -4
  61. package/dist/{chunk-PUHP4IBA.js → chunk-GKFO5JLN.js} +3 -3
  62. package/dist/{chunk-WXPVVXBU.js → chunk-GZCSWDAS.js} +3 -3
  63. package/dist/{chunk-DJ7EZIQA.js → chunk-HUI4OE43.js} +1 -1
  64. package/dist/{chunk-4MUFZU2G.js → chunk-IFPOHFDJ.js} +1 -1
  65. package/dist/{chunk-SOCJ2N3E.js → chunk-JGQV4MDQ.js} +5 -5
  66. package/dist/{chunk-U7NR4JVD.js → chunk-KPNZ7JUL.js} +2 -2
  67. package/dist/{chunk-HC3FHDKB.js → chunk-LBHJJEKT.js} +3 -3
  68. package/dist/{chunk-L3AFVFGQ.js → chunk-LN7DE5LY.js} +1 -1
  69. package/dist/chunk-MLKGABMK.js +9 -0
  70. package/dist/{chunk-6MJWYYAS.js → chunk-MWLTTLPK.js} +46 -2
  71. package/dist/{chunk-MUNL23WE.js → chunk-O65F2IIN.js} +3 -3
  72. package/dist/{chunk-625DZLT5.js → chunk-ORX5BTV4.js} +5 -5
  73. package/dist/{chunk-QLMOU57V.js → chunk-P3VQH65N.js} +7 -7
  74. package/dist/{chunk-Y5V4PA2Z.js → chunk-PITQ5ZIQ.js} +2 -2
  75. package/dist/{chunk-V57XLKZL.js → chunk-QER5R7Z6.js} +1 -1
  76. package/dist/{chunk-IF26ZGZ7.js → chunk-RGSW36XH.js} +1 -1
  77. package/dist/{chunk-EZHY65QA.js → chunk-RJHX66EY.js} +3 -3
  78. package/dist/{chunk-O6IUZGWV.js → chunk-SFAP4AJY.js} +1 -1
  79. package/dist/{chunk-7WFRY6OL.js → chunk-SHJVFW22.js} +1 -1
  80. package/dist/{chunk-FDWMG6NY.js → chunk-UADSXJZ4.js} +1 -1
  81. package/dist/{chunk-ZGOJLNKS.js → chunk-VX2MJ4X7.js} +1 -1
  82. package/dist/{chunk-SEILUNWB.js → chunk-XAO6EYGM.js} +2 -2
  83. package/dist/{chunk-CSOROFJY.js → chunk-Y6Z7DA5Y.js} +3 -3
  84. package/dist/{chunk-METMK3L4.js → chunk-YDR4BQ7R.js} +1 -1
  85. package/dist/{chunk-RPPXQNIA.js → chunk-ZEWIMY63.js} +1 -1
  86. package/dist/{chunk-QGSHV3WO.js → chunk-ZGU3NXL2.js} +75 -16
  87. package/dist/{codex-app-cards-switch-ZO76D2NY.js → codex-app-cards-switch-BD7LCI2I.js} +7 -6
  88. package/dist/{codex-desktop-launch-MJT5E3O3.js → codex-desktop-launch-V5CASSBB.js} +2 -1
  89. package/dist/{codex-session-launch-PTFCVIC7.js → codex-session-launch-5PKFKUFD.js} +11 -10
  90. package/dist/{config-SXV6XNVU.js → config-AEKH7HGC.js} +1 -0
  91. package/dist/{global-upgrade-ETDP32LO.js → global-upgrade-IUXJJDWF.js} +7 -6
  92. package/dist/{identity-OOLIOSMR.js → identity-YJIV2XTY.js} +4 -3
  93. package/dist/{live-capabilities-2XIFA7YO.js → live-capabilities-QYFW5QAW.js} +3 -2
  94. package/dist/{paths-IIOQZESZ.js → paths-A5GAR5PL.js} +3 -2
  95. package/dist/{reapply-KFAJSKOQ.js → reapply-BKJGICRJ.js} +18 -17
  96. package/dist/src/index.js +14 -13
  97. package/dist/{upgrade-lock-T6ILR644.js → upgrade-lock-DDB7WEWC.js} +4 -3
  98. package/dist/{usage-6TN7FVWS.js → usage-HBDNFZ3O.js} +1 -0
  99. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ensureCodexTrustsPusharyHooks
3
- } from "./chunk-56JCQQLS.js";
3
+ } from "./chunk-BUZIEL7Y.js";
4
4
  import {
5
5
  CODEX_INSTRUCTIONS_LABEL,
6
6
  GEMINI_INSTRUCTIONS_LABEL,
@@ -11,7 +11,7 @@ import {
11
11
  macAppFxBridge,
12
12
  refreshInstructionBlock,
13
13
  renderAgentInstructions
14
- } from "./chunk-WXZHQ3TT.js";
14
+ } from "./chunk-4VRTSDGP.js";
15
15
  import {
16
16
  OPENCODE_HOOK_BINARY,
17
17
  agentHookOwner,
@@ -21,7 +21,7 @@ import {
21
21
  openCodeInstructionsFile,
22
22
  openCodePluginDir,
23
23
  openCodeWired
24
- } from "./chunk-QGSHV3WO.js";
24
+ } from "./chunk-ZGU3NXL2.js";
25
25
  import {
26
26
  detectClaudeVersion
27
27
  } from "./chunk-USE5IEEW.js";
@@ -33,7 +33,7 @@ import {
33
33
  compatibleConfigFile,
34
34
  compatibleInstructionsFile,
35
35
  hasCompatibleHooks
36
- } from "./chunk-PUHP4IBA.js";
36
+ } from "./chunk-GKFO5JLN.js";
37
37
  import {
38
38
  claudeUnprovenHolds,
39
39
  claudeWired,
@@ -41,7 +41,7 @@ import {
41
41
  codexWired,
42
42
  geminiWired,
43
43
  planHooks
44
- } from "./chunk-CDQHQAS7.js";
44
+ } from "./chunk-BJTSKOH3.js";
45
45
  import {
46
46
  CLAUDE_HOOK_BINARY,
47
47
  CLAUDE_HOOK_EVENTS,
@@ -52,7 +52,7 @@ import {
52
52
  needsReregistration,
53
53
  registrationSignatures,
54
54
  supportedClaudeEvents
55
- } from "./chunk-IF26ZGZ7.js";
55
+ } from "./chunk-RGSW36XH.js";
56
56
  import {
57
57
  formatVersion
58
58
  } from "./chunk-6ICPEJY5.js";
@@ -68,6 +68,7 @@ import {
68
68
  codexConfigToml,
69
69
  codexHookPositions,
70
70
  codexHooksJson,
71
+ codexMcpStartsCommand,
71
72
  codexRegistrationHolder,
72
73
  codexVacatedIndexes,
73
74
  dropVacatedCodexHookTrust,
@@ -82,11 +83,11 @@ import {
82
83
  registeredCommands,
83
84
  registrationHolderOf,
84
85
  vscodePluginMcp
85
- } from "./chunk-6MJWYYAS.js";
86
+ } from "./chunk-MWLTTLPK.js";
86
87
  import {
87
88
  resolveGlobalBinDir,
88
89
  resolveGlobalBinary
89
- } from "./chunk-2QREHU4O.js";
90
+ } from "./chunk-CJ5TCFD4.js";
90
91
  import {
91
92
  readJsonSafe,
92
93
  writeFileAtomic,
@@ -250,13 +251,23 @@ var inspectConfiguredManagedProviders = (paths = {}) => {
250
251
  }
251
252
  return providers;
252
253
  };
253
- var reapplyCodexSettings = (apiKey, paths = {}) => {
254
+ var codexNativeOwnershipFor = (hooksConfig, requested, macAppAvailable) => hooksConfig === null && macAppAvailable ? "preserve" : requested;
255
+ var reapplyCodexSettings = (apiKey, paths = {}, nativeOwnership = "preserve") => {
254
256
  const configPath = paths.configPath ?? codexConfigToml();
255
257
  const hooksPath = paths.hooksPath ?? codexHooksJson();
256
258
  const config = readToml(configPath);
257
259
  const hooksConfig = readJson(hooksPath);
258
260
  const configured = config != null && !!config.mcp_servers?.pushary || hooksConfig != null && hasCodexHooks(hooksConfig);
259
261
  if (!configured) return { configured: false, reapplied: false, hooks: false, mcp: false };
262
+ const startedCommand = config != null && codexMcpStartsCommand(config);
263
+ let mcpWrite = null;
264
+ if (config != null && apiKey) {
265
+ try {
266
+ mcpWrite = addCodexMcpServer(config, apiKey, codexNativeOwnershipFor(hooksConfig, nativeOwnership, paths.macAppAvailable ?? true));
267
+ } catch {
268
+ return { configured: true, reapplied: false, hooks: false, mcp: false, failed: true };
269
+ }
270
+ }
260
271
  const command = guardBinary((paths.resolveBinary ?? resolveGlobalBinary)(CODEX_HOOK_BINARY) ?? CODEX_HOOK_BINARY);
261
272
  let hooks = false;
262
273
  let mcp = false;
@@ -277,12 +288,9 @@ var reapplyCodexSettings = (apiKey, paths = {}) => {
277
288
  dropVacatedCodexHookTrust(config, hooksPath, vacated);
278
289
  addCodexHookTrust(config, hooksPath, command, codexHookPositions(hooksConfig ?? void 0));
279
290
  }
280
- if (apiKey) {
281
- addCodexMcpServer(config, apiKey);
282
- }
283
291
  if (hooks || apiKey) {
284
292
  writeFileAtomic(configPath, stringifyTOML(config), modeToPreserve(configPath), "utf-8");
285
- mcp = Boolean(apiKey);
293
+ mcp = mcpWrite === "wrote-key";
286
294
  }
287
295
  } catch {
288
296
  failed = true;
@@ -290,7 +298,7 @@ var reapplyCodexSettings = (apiKey, paths = {}) => {
290
298
  }
291
299
  }
292
300
  if (config === null) hooks = false;
293
- return { configured: true, reapplied: hooks || mcp, hooks, mcp, failed };
301
+ return { configured: true, reapplied: hooks || mcp, hooks, mcp, failed, ...mcp && startedCommand ? { codexRestartRequired: true } : {} };
294
302
  };
295
303
  var repairCodexHolds = (paths = {}) => {
296
304
  const idle = { configured: false, reapplied: false, hooks: false, mcp: false };
@@ -408,12 +416,13 @@ var KEPT_FOR_APP = { configured: true, reapplied: false, hooks: false, mcp: fals
408
416
  var FAILED_REAPPLY = { configured: false, reapplied: false, hooks: false, mcp: false, failed: true };
409
417
  var noInstructionBlock = () => null;
410
418
  var reapplyAllAgents = (apiKey, options = {}) => {
419
+ const appAvailable = (options.appAvailable ?? macAppBridgeAvailable)();
411
420
  const runners = [
412
421
  { id: "claude", label: "Claude Code", run: () => reapplyClaudeSettings(apiKey), instructions: noInstructionBlock },
413
422
  {
414
423
  id: "codex",
415
424
  label: "Codex",
416
- run: () => reapplyCodexSettings(apiKey),
425
+ run: () => reapplyCodexSettings(apiKey, { macAppAvailable: appAvailable }, "take-over"),
417
426
  instructions: () => ({ file: codexAgentsMd(), body: renderAgentInstructions(CODEX_INSTRUCTIONS_LABEL) })
418
427
  },
419
428
  {
@@ -438,7 +447,6 @@ var reapplyAllAgents = (apiKey, options = {}) => {
438
447
  instructions: () => compatibleInstructionTarget(profile)
439
448
  }))
440
449
  ];
441
- const appAvailable = (options.appAvailable ?? macAppBridgeAvailable)();
442
450
  const done = [];
443
451
  for (const runner of runners) {
444
452
  try {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readExistingMachineId
3
- } from "./chunk-O6IUZGWV.js";
3
+ } from "./chunk-SFAP4AJY.js";
4
4
  import {
5
5
  NetworkError
6
6
  } from "./chunk-PPY5N2E6.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-POFBE6ZY.js";
4
4
  import {
5
5
  autoUpdateState
6
- } from "./chunk-6MJWYYAS.js";
6
+ } from "./chunk-MWLTTLPK.js";
7
7
  import {
8
8
  readJsonSafe,
9
9
  writeJsonAtomic
@@ -3,21 +3,21 @@ import {
3
3
  expectedLaunchCapabilities,
4
4
  hasSpawnProvider,
5
5
  resolveControlPolicy
6
- } from "./chunk-6LOQE4J4.js";
6
+ } from "./chunk-G36T5LAP.js";
7
7
  import {
8
8
  daemonHasRemoteProof,
9
9
  daemonServiceManagerAvailable,
10
10
  hasDaemonServiceDefinition,
11
11
  readDaemonNeedsLogin,
12
12
  readDaemonStatus
13
- } from "./chunk-HC3FHDKB.js";
13
+ } from "./chunk-LBHJJEKT.js";
14
14
  import {
15
15
  readControlMode,
16
16
  readKeySource
17
17
  } from "./chunk-WN3RACVD.js";
18
18
  import {
19
19
  getMachineId
20
- } from "./chunk-O6IUZGWV.js";
20
+ } from "./chunk-SFAP4AJY.js";
21
21
  import {
22
22
  getBaseUrl
23
23
  } from "./chunk-BG4Y64FW.js";
@@ -2,19 +2,19 @@ import {
2
2
  CLAUDE_HOOK_EVENTS,
3
3
  GEMINI_HOOK_EVENTS,
4
4
  hasGeminiHooks
5
- } from "./chunk-IF26ZGZ7.js";
5
+ } from "./chunk-RGSW36XH.js";
6
6
  import {
7
7
  AGENT_CHOICES
8
8
  } from "./chunk-XV6S5PWW.js";
9
9
  import {
10
10
  BELL_HOOK_BINARY
11
- } from "./chunk-4MUFZU2G.js";
11
+ } from "./chunk-IFPOHFDJ.js";
12
12
  import {
13
13
  CODEX_HOOK_EVENTS,
14
14
  HOOK_SHELL,
15
15
  hasCodexHooks,
16
16
  holdBudgetOf
17
- } from "./chunk-6MJWYYAS.js";
17
+ } from "./chunk-MWLTTLPK.js";
18
18
  import {
19
19
  CURSOR_GATE_EVENTS,
20
20
  HOOK_LOCATOR_BINARY,
@@ -8,13 +8,13 @@ import {
8
8
  everyProgramFileIsThere,
9
9
  installedCodexApp,
10
10
  shellQuoted
11
- } from "./chunk-Y5V4PA2Z.js";
11
+ } from "./chunk-PITQ5ZIQ.js";
12
12
  import {
13
13
  writeHuman
14
14
  } from "./chunk-QCGNGEGE.js";
15
15
  import {
16
16
  xml
17
- } from "./chunk-HC3FHDKB.js";
17
+ } from "./chunk-LBHJJEKT.js";
18
18
  import {
19
19
  CODEX_APP_LAUNCH_AT_LOGIN_VERB,
20
20
  CODEX_APP_LAUNCH_VARIABLE
@@ -7,10 +7,10 @@ import {
7
7
  codexHome,
8
8
  codexHooksJsonIn,
9
9
  isPusharyCodexCommand
10
- } from "./chunk-6MJWYYAS.js";
10
+ } from "./chunk-MWLTTLPK.js";
11
11
  import {
12
12
  resolvePathBinary
13
- } from "./chunk-2QREHU4O.js";
13
+ } from "./chunk-CJ5TCFD4.js";
14
14
  import {
15
15
  getPackageVersion
16
16
  } from "./chunk-QTOLNRET.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  notificationAnswerStep
3
- } from "./chunk-DJ7EZIQA.js";
3
+ } from "./chunk-HUI4OE43.js";
4
4
  import {
5
5
  matchMacAccountStep,
6
6
  retryAgentCommand
7
- } from "./chunk-WXZHQ3TT.js";
7
+ } from "./chunk-4VRTSDGP.js";
8
8
  import {
9
9
  EXIT
10
10
  } from "./chunk-KZERVKTD.js";
@@ -366,9 +366,9 @@ var installGlobally = (options) => {
366
366
  }
367
367
  const started = (async () => {
368
368
  if (!npmIsOnPath()) throw new NpmMissingError();
369
- const { withUpgradeLock } = await import("./global-upgrade-ETDP32LO.js");
370
- const { installWithUpgradeLock, ownsUpgradeLock } = await import("./upgrade-lock-T6ILR644.js");
371
- const { autoUpdateLock } = await import("./paths-IIOQZESZ.js");
369
+ const { withUpgradeLock } = await import("./global-upgrade-IUXJJDWF.js");
370
+ const { installWithUpgradeLock, ownsUpgradeLock } = await import("./upgrade-lock-DDB7WEWC.js");
371
+ const { autoUpdateLock } = await import("./paths-A5GAR5PL.js");
372
372
  let result = "skipped";
373
373
  const install = async () => {
374
374
  const platform = process.platform;
@@ -13,19 +13,19 @@ import {
13
13
  reportClientError,
14
14
  sendNotification,
15
15
  waitForAnswer
16
- } from "./chunk-EZHY65QA.js";
16
+ } from "./chunk-RJHX66EY.js";
17
17
  import {
18
18
  withRetry
19
- } from "./chunk-SEILUNWB.js";
19
+ } from "./chunk-XAO6EYGM.js";
20
20
  import {
21
21
  getMachineId
22
- } from "./chunk-O6IUZGWV.js";
22
+ } from "./chunk-SFAP4AJY.js";
23
23
  import {
24
24
  reportedInstallSource
25
25
  } from "./chunk-Y5VKZNFN.js";
26
26
  import {
27
27
  canonicalJson
28
- } from "./chunk-6MJWYYAS.js";
28
+ } from "./chunk-MWLTTLPK.js";
29
29
  import {
30
30
  writeFileAtomic
31
31
  } from "./chunk-QENTGE75.js";
@@ -224,6 +224,7 @@ var parseApplyPatchFiles = (command) => [...new Set(parseApplyPatchOps(command).
224
224
  var patchDeletesFiles = (toolName, toolInput) => toolName === "apply_patch" && parseApplyPatchOps(toolInput.command).some((entry) => entry.op === "delete");
225
225
  var OPENCODE_TOOL_NAMES = {
226
226
  bash: "Bash",
227
+ shell: "Bash",
227
228
  // A shell command reaching outside the worktree asks a second time under its
228
229
  // own key. It is still the same command, and still Bash.
229
230
  external_directory: "Bash",
@@ -236,7 +237,8 @@ var OPENCODE_TOOL_NAMES = {
236
237
  grep: "Grep",
237
238
  webfetch: "WebFetch",
238
239
  websearch: "WebSearch",
239
- task: "Task"
240
+ task: "Task",
241
+ subagent: "Task"
240
242
  };
241
243
  var PATCH_ARG_KEYS = ["command", "patch", "input"];
242
244
  var patchedFilesIn = (input) => [...new Set(PATCH_ARG_KEYS.flatMap((key) => parseApplyPatchFiles(input[key])))];
@@ -6,10 +6,10 @@ import {
6
6
  } from "./chunk-QW3FRUFB.js";
7
7
  import {
8
8
  ensureDaemonRunning
9
- } from "./chunk-HC3FHDKB.js";
9
+ } from "./chunk-LBHJJEKT.js";
10
10
  import {
11
11
  hookOwnerOf
12
- } from "./chunk-CDQHQAS7.js";
12
+ } from "./chunk-BJTSKOH3.js";
13
13
  import {
14
14
  buildTranscriptRecords,
15
15
  decodePublicKey,
@@ -31,7 +31,7 @@ import {
31
31
  claudeConfigDir,
32
32
  codexHome,
33
33
  pusharyDir
34
- } from "./chunk-6MJWYYAS.js";
34
+ } from "./chunk-MWLTTLPK.js";
35
35
  import {
36
36
  writeJsonAtomic
37
37
  } from "./chunk-QENTGE75.js";
@@ -13,7 +13,7 @@ import {
13
13
  resolvePackageVersionFromBinary,
14
14
  resolvePathBinary,
15
15
  resolvePathBinaryAsync
16
- } from "./chunk-2QREHU4O.js";
16
+ } from "./chunk-CJ5TCFD4.js";
17
17
  import {
18
18
  MANAGED_PROVIDERS
19
19
  } from "./chunk-AXJLJJ3M.js";
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  openCodeConfigDirFrom
3
- } from "./chunk-QGSHV3WO.js";
3
+ } from "./chunk-ZGU3NXL2.js";
4
4
  import {
5
5
  nativeClaudeInstallPath
6
6
  } from "./chunk-VUFHYMSP.js";
7
7
  import {
8
8
  grokHome
9
- } from "./chunk-PUHP4IBA.js";
9
+ } from "./chunk-GKFO5JLN.js";
10
10
  import {
11
11
  claudeConfigDir,
12
12
  codexHomeFrom
13
- } from "./chunk-6MJWYYAS.js";
13
+ } from "./chunk-MWLTTLPK.js";
14
14
  import {
15
15
  resolvePathBinary
16
- } from "./chunk-2QREHU4O.js";
16
+ } from "./chunk-CJ5TCFD4.js";
17
17
  import {
18
18
  HOOK_COMPATIBLE_PROFILES
19
19
  } from "./chunk-AXJLJJ3M.js";
@@ -3,18 +3,18 @@ import {
3
3
  addGeminiMcpServer,
4
4
  removeGeminiMcpServer,
5
5
  supportedClaudeEvents
6
- } from "./chunk-IF26ZGZ7.js";
6
+ } from "./chunk-RGSW36XH.js";
7
7
  import {
8
8
  CLAUDE_CODE_AGENT,
9
9
  compatibleToolLookup
10
- } from "./chunk-W2IVTHIG.js";
10
+ } from "./chunk-DQLCFGHK.js";
11
11
  import {
12
12
  guardBinary,
13
13
  guardBinaryRefusing,
14
14
  holdBudgetOf,
15
15
  isProtectedByScope,
16
16
  registerHookEntry
17
- } from "./chunk-6MJWYYAS.js";
17
+ } from "./chunk-MWLTTLPK.js";
18
18
  import {
19
19
  HOOK_COMPATIBLE_PROFILES,
20
20
  HOOK_LOCATOR_BINARY,
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  compatibleConfigFile,
3
3
  hasCompatibleHooks
4
- } from "./chunk-PUHP4IBA.js";
4
+ } from "./chunk-GKFO5JLN.js";
5
5
  import {
6
6
  pusharyHookExecutable
7
- } from "./chunk-CDQHQAS7.js";
7
+ } from "./chunk-BJTSKOH3.js";
8
8
  import {
9
9
  isProtectedByScope,
10
10
  registerHookEntry
11
- } from "./chunk-6MJWYYAS.js";
11
+ } from "./chunk-MWLTTLPK.js";
12
12
  import {
13
13
  isRecord
14
14
  } from "./chunk-AXJLJJ3M.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  callMcpTool
3
- } from "./chunk-SEILUNWB.js";
3
+ } from "./chunk-XAO6EYGM.js";
4
4
  import {
5
5
  NPX_LATEST_COMMAND
6
6
  } from "./chunk-ERK24P76.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  guardBinary
3
- } from "./chunk-6MJWYYAS.js";
3
+ } from "./chunk-MWLTTLPK.js";
4
4
 
5
5
  // src/bell/install.ts
6
6
  import { join } from "path";
@@ -3,10 +3,10 @@ import {
3
3
  forkFinishWithUpgradeLock,
4
4
  installWithUpgradeLock,
5
5
  releaseAutoUpdateLock
6
- } from "./chunk-VIJIG5YL.js";
6
+ } from "./chunk-4N5E4JNF.js";
7
7
  import {
8
8
  phoneStartIsRequired
9
- } from "./chunk-6LOQE4J4.js";
9
+ } from "./chunk-G36T5LAP.js";
10
10
  import {
11
11
  describeAutoUpdateCheck,
12
12
  globalInstallLocation,
@@ -18,7 +18,7 @@ import {
18
18
  readAutoUpdateState,
19
19
  updateAutoUpdateState,
20
20
  upgradeEntryFor
21
- } from "./chunk-5RU35K57.js";
21
+ } from "./chunk-7HDGH3Z2.js";
22
22
  import {
23
23
  EXIT
24
24
  } from "./chunk-KZERVKTD.js";
@@ -26,14 +26,14 @@ import {
26
26
  autoUpdateLock,
27
27
  autoUpdateLog,
28
28
  autoUpdateState
29
- } from "./chunk-6MJWYYAS.js";
29
+ } from "./chunk-MWLTTLPK.js";
30
30
  import {
31
31
  execNpm,
32
32
  fetchLatestPublishedVersion,
33
33
  npmErrorMessage,
34
34
  readGlobalCliInstallAt,
35
35
  readGlobalPrefix
36
- } from "./chunk-2QREHU4O.js";
36
+ } from "./chunk-CJ5TCFD4.js";
37
37
  import {
38
38
  NPX_LATEST_COMMAND
39
39
  } from "./chunk-ERK24P76.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  macAppBridgeAvailable
3
- } from "./chunk-QGSHV3WO.js";
3
+ } from "./chunk-ZGU3NXL2.js";
4
4
  import {
5
5
  keyPrefix
6
6
  } from "./chunk-WN3RACVD.js";
7
7
  import {
8
8
  bridgeAgentKey
9
- } from "./chunk-6MJWYYAS.js";
9
+ } from "./chunk-MWLTTLPK.js";
10
10
  import {
11
11
  readJsonSafe
12
12
  } from "./chunk-QENTGE75.js";
@@ -7,13 +7,13 @@ import {
7
7
  } from "./chunk-WN3RACVD.js";
8
8
  import {
9
9
  getMachineId
10
- } from "./chunk-O6IUZGWV.js";
10
+ } from "./chunk-SFAP4AJY.js";
11
11
  import {
12
12
  pusharyDir
13
- } from "./chunk-6MJWYYAS.js";
13
+ } from "./chunk-MWLTTLPK.js";
14
14
  import {
15
15
  resolveGlobalBinary
16
- } from "./chunk-2QREHU4O.js";
16
+ } from "./chunk-CJ5TCFD4.js";
17
17
  import {
18
18
  readJsonSafe,
19
19
  writeFileAtomic,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-6MJWYYAS.js";
3
+ } from "./chunk-MWLTTLPK.js";
4
4
  import {
5
5
  readJsonSafe,
6
6
  writeFileAtomic
@@ -0,0 +1,9 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ export {
8
+ __export
9
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  quoteIfNeeded,
3
3
  shellDoubleQuoted
4
- } from "./chunk-2QREHU4O.js";
4
+ } from "./chunk-CJ5TCFD4.js";
5
5
  import {
6
6
  CODEX_QUESTION_TOOLS,
7
7
  HOOK_BUDGETS,
@@ -201,18 +201,59 @@ var ensureRecord = (target, key) => {
201
201
  return created;
202
202
  };
203
203
  var CODEX_MCP_URL = "https://pushary.com/api/mcp/mcp";
204
- var addCodexMcpServer = (config, apiKey) => {
204
+ var CODEX_HTTP_ONLY_FIELDS = ["url", "http_headers", "env_http_headers", "http_headers_helper", "bearer_token", "bearer_token_env_var", "auth", "oauth", "oauth_resource"];
205
+ var NATIVE_MCP_TRANSPORT_FIELDS = [...CODEX_HTTP_ONLY_FIELDS, "args", "env", "env_vars", "cwd"];
206
+ var OLD_CLI_HTTP_FIELDS = /* @__PURE__ */ new Set(["url", "http_headers"]);
207
+ var nativeCodexMcpCommand = () => join2(homedir2(), ".pushary", "bin", "pushary-mcp");
208
+ var isNativeCodexMcpEntry = (entry, command) => {
209
+ const server = asRecord2(entry);
210
+ return server?.command === command && NATIVE_MCP_TRANSPORT_FIELDS.every((field) => !(field in server));
211
+ };
212
+ var carriesOnlyAnAuthorizationHeader = (headers) => {
213
+ const record = asRecord2(headers);
214
+ return record !== void 0 && Object.keys(record).length === 1 && typeof record.Authorization === "string";
215
+ };
216
+ var isOldCliMixedCodexMcpEntry = (entry, command) => {
217
+ const server = asRecord2(entry);
218
+ return server?.command === command && server.url === CODEX_MCP_URL && carriesOnlyAnAuthorizationHeader(server.http_headers) && NATIVE_MCP_TRANSPORT_FIELDS.every((field) => OLD_CLI_HTTP_FIELDS.has(field) || !(field in server));
219
+ };
220
+ var codexMcpMixesCommandWithHttp = (entry) => {
221
+ const server = asRecord2(entry);
222
+ return server !== void 0 && "command" in server && CODEX_HTTP_ONLY_FIELDS.some((field) => field in server);
223
+ };
224
+ var CODEX_RESTART_AFTER_TRANSPORT_CHANGE = "Fully quit and reopen Codex to load the updated Pushary configuration.";
225
+ var codexMcpStartsCommand = (config) => {
226
+ const pushary = asRecord2(asRecord2(config.mcp_servers)?.pushary);
227
+ return pushary !== void 0 && "command" in pushary && pushary.enabled !== false;
228
+ };
229
+ var addCodexMcpServer = (config, apiKey, nativeOwnership = "preserve") => {
230
+ const existing = asRecord2(asRecord2(config.mcp_servers)?.pushary);
231
+ if (existing !== void 0 && "command" in existing) {
232
+ const command = nativeCodexMcpCommand();
233
+ if (!isOldCliMixedCodexMcpEntry(existing, command) && !isNativeCodexMcpEntry(existing, command)) {
234
+ throw new Error("Pushary MCP has an unrecognized or mixed transport. Its configuration was left unchanged.");
235
+ }
236
+ if (nativeOwnership === "preserve") {
237
+ for (const field of OLD_CLI_HTTP_FIELDS) delete existing[field];
238
+ return "kept-native";
239
+ }
240
+ }
205
241
  const servers = ensureRecord(config, "mcp_servers");
206
242
  const pushary = ensureRecord(servers, "pushary");
243
+ delete pushary.command;
207
244
  pushary.url = CODEX_MCP_URL;
208
245
  ensureRecord(pushary, "http_headers").Authorization = `Bearer ${apiKey}`;
209
246
  pushary.default_tools_approval_mode = "approve";
210
247
  delete pushary.bearer_token_env_var;
211
248
  delete pushary.tools;
249
+ return "wrote-key";
212
250
  };
213
251
  var readCodexMcpAuth = (config) => {
214
252
  const pushary = asRecord2(asRecord2(config.mcp_servers)?.pushary);
215
253
  if (!pushary) return void 0;
254
+ if ("command" in pushary) {
255
+ return isNativeCodexMcpEntry(pushary, nativeCodexMcpCommand()) ? { method: "native" } : void 0;
256
+ }
216
257
  const authorization = asRecord2(pushary.http_headers)?.Authorization;
217
258
  if (typeof authorization === "string" && authorization.startsWith("Bearer ")) {
218
259
  return { method: "embedded", key: authorization.slice("Bearer ".length).trim() };
@@ -517,6 +558,9 @@ export {
517
558
  codexSkillDir,
518
559
  CODEX_HOOK_EVENTS,
519
560
  CODEX_REQUIRED_APPROVAL_EVENTS,
561
+ codexMcpMixesCommandWithHttp,
562
+ CODEX_RESTART_AFTER_TRANSPORT_CHANGE,
563
+ codexMcpStartsCommand,
520
564
  addCodexMcpServer,
521
565
  readCodexMcpAuth,
522
566
  isPusharyCodexCommand,
@@ -10,7 +10,7 @@ import {
10
10
  describeIdleWindow,
11
11
  idleDeadlinePassed,
12
12
  startProcessOwnership
13
- } from "./chunk-7WFRY6OL.js";
13
+ } from "./chunk-SHJVFW22.js";
14
14
  import {
15
15
  spawnClaude
16
16
  } from "./chunk-XHKBHWLX.js";
@@ -23,11 +23,11 @@ import {
23
23
  isWaitForAnswerResponse,
24
24
  withdrawQuestion,
25
25
  writeDegraded
26
- } from "./chunk-EZHY65QA.js";
26
+ } from "./chunk-RJHX66EY.js";
27
27
  import {
28
28
  callMcpTool,
29
29
  isRetryable
30
- } from "./chunk-SEILUNWB.js";
30
+ } from "./chunk-XAO6EYGM.js";
31
31
  import {
32
32
  AGENT_QUESTION_DESCRIPTION_MAX,
33
33
  AGENT_QUESTION_HEADER_MAX,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  announceSubscriptionRequired,
3
3
  isDeferAnswer
4
- } from "./chunk-RPPXQNIA.js";
4
+ } from "./chunk-ZEWIMY63.js";
5
5
  import {
6
6
  AUTO_DECISION_WINDOW_MS,
7
7
  DEFAULT_SESSION,
@@ -10,18 +10,18 @@ import {
10
10
  permissionDeniedAction,
11
11
  releaseThrottle,
12
12
  reportEvent
13
- } from "./chunk-W2IVTHIG.js";
13
+ } from "./chunk-DQLCFGHK.js";
14
14
  import {
15
15
  askUser,
16
16
  isDecisionStopped,
17
17
  waitForQuestion
18
- } from "./chunk-EZHY65QA.js";
18
+ } from "./chunk-RJHX66EY.js";
19
19
  import {
20
20
  SubscriptionRequiredError
21
- } from "./chunk-SEILUNWB.js";
21
+ } from "./chunk-XAO6EYGM.js";
22
22
  import {
23
23
  getMachineId
24
- } from "./chunk-O6IUZGWV.js";
24
+ } from "./chunk-SFAP4AJY.js";
25
25
  import {
26
26
  ASK_CONTEXT_MAX,
27
27
  agentQuestionContext,