@pushary/agent-hooks 1.5.0 → 1.6.0

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 (83) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +2 -1
  3. package/dist/bin/pushary-bell-hook.js +18 -18
  4. package/dist/bin/pushary-bell.js +6 -6
  5. package/dist/bin/pushary-claude.js +18 -18
  6. package/dist/bin/pushary-clean.js +19 -19
  7. package/dist/bin/pushary-codex-bridge.js +10 -10
  8. package/dist/bin/pushary-codex-hook.js +23 -23
  9. package/dist/bin/pushary-codex.js +6 -6
  10. package/dist/bin/pushary-connect.js +6 -6
  11. package/dist/bin/pushary-cowork.js +3 -3
  12. package/dist/bin/pushary-daemon.js +23 -22
  13. package/dist/bin/pushary-disconnect.js +10 -10
  14. package/dist/bin/pushary-doctor.js +52 -24
  15. package/dist/bin/pushary-elicitation-hook.js +17 -17
  16. package/dist/bin/pushary-gemini-bridge.js +9 -9
  17. package/dist/bin/pushary-gemini-hook.js +20 -20
  18. package/dist/bin/pushary-hook.js +23 -23
  19. package/dist/bin/pushary-login.js +7 -7
  20. package/dist/bin/pushary-logout.js +4 -4
  21. package/dist/bin/pushary-mode.js +3 -3
  22. package/dist/bin/pushary-notification-hook.js +20 -20
  23. package/dist/bin/pushary-opencode-hook.js +19 -19
  24. package/dist/bin/pushary-permission-denied-hook.js +24 -24
  25. package/dist/bin/pushary-permission-hook.js +23 -23
  26. package/dist/bin/pushary-post-hook.js +20 -20
  27. package/dist/bin/pushary-prompt-hook.js +20 -20
  28. package/dist/bin/pushary-session-end-hook.js +20 -20
  29. package/dist/bin/pushary-session-start-hook.js +24 -23
  30. package/dist/bin/pushary-setup.js +63 -62
  31. package/dist/bin/pushary-stats.js +2 -2
  32. package/dist/bin/pushary-status.js +10 -10
  33. package/dist/bin/pushary-stop-hook.js +20 -20
  34. package/dist/bin/pushary-stopfailure-hook.js +20 -20
  35. package/dist/bin/pushary-transcript-register.js +16 -16
  36. package/dist/bin/pushary-transcripts.js +4 -4
  37. package/dist/bin/pushary-upgrade.js +80 -32
  38. package/dist/bin/pushary-wait.js +3 -3
  39. package/dist/{chunk-KEOLNHR3.js → chunk-5MH5P366.js} +2 -2
  40. package/dist/{chunk-HVBF35GT.js → chunk-5QCZYSYR.js} +1 -1
  41. package/dist/{chunk-IYTQ4B5I.js → chunk-644CGYOB.js} +66 -12
  42. package/dist/{chunk-FDHMNT24.js → chunk-66BIMA62.js} +6 -5
  43. package/dist/{chunk-UQHUUZ5H.js → chunk-7JSE6JTZ.js} +1 -1
  44. package/dist/{chunk-NFKVRMTM.js → chunk-A2GS2ENL.js} +6 -6
  45. package/dist/{chunk-TFKBFQCE.js → chunk-A5URWZTP.js} +1 -1
  46. package/dist/{chunk-MYP4UUFH.js → chunk-ALG3IBLB.js} +1 -1
  47. package/dist/{chunk-TUXFIVOH.js → chunk-B6TYEKJR.js} +1 -1
  48. package/dist/{chunk-CQYHOHOK.js → chunk-BE4P7ERZ.js} +3 -3
  49. package/dist/{chunk-EADZPVYW.js → chunk-BK5F3FGE.js} +3 -3
  50. package/dist/{chunk-F57RGL7K.js → chunk-BW3Y2D24.js} +4 -4
  51. package/dist/chunk-BY2CRWBO.js +38 -0
  52. package/dist/{chunk-43LJSM4F.js → chunk-CSW6A2EW.js} +1 -1
  53. package/dist/{chunk-7XT76LWT.js → chunk-DZ75BJ7V.js} +3 -3
  54. package/dist/{chunk-DTQNDR7C.js → chunk-E7MJBWSR.js} +1 -1
  55. package/dist/{chunk-DYHXOXUF.js → chunk-F2OPOBRO.js} +7 -21
  56. package/dist/{chunk-43ZDACBO.js → chunk-F4KRNFDE.js} +1 -1
  57. package/dist/{chunk-ORLJNJEO.js → chunk-FDF72XHK.js} +2 -2
  58. package/dist/{chunk-JF736N4C.js → chunk-FI3LQCUH.js} +5 -5
  59. package/dist/{chunk-DLJN5XEU.js → chunk-G5LENVCZ.js} +3 -3
  60. package/dist/{chunk-K3QVDAZW.js → chunk-GDXSCXQC.js} +1 -1
  61. package/dist/{chunk-5HYNICS7.js → chunk-GOXINLDU.js} +1 -1
  62. package/dist/{chunk-2QT3GCU4.js → chunk-GP6SFVEN.js} +1 -1
  63. package/dist/{chunk-J4J45VPZ.js → chunk-HWG7X3VI.js} +3 -3
  64. package/dist/{chunk-PCGZXWGQ.js → chunk-KZBGITM4.js} +4 -4
  65. package/dist/{chunk-NTQSICPJ.js → chunk-MOQOJOMD.js} +3 -3
  66. package/dist/{chunk-3NBODGQS.js → chunk-NDS27FXU.js} +1 -1
  67. package/dist/{chunk-H5LHTC5X.js → chunk-NYD7W7AT.js} +1 -1
  68. package/dist/{chunk-PNNBMH4E.js → chunk-OP7HFIWE.js} +28 -12
  69. package/dist/{chunk-SOCEY746.js → chunk-OR3A3RLH.js} +1 -1
  70. package/dist/{chunk-XWEONSLV.js → chunk-PCVVCS4A.js} +1 -1
  71. package/dist/{chunk-KJRALILH.js → chunk-PRZXYILJ.js} +2 -2
  72. package/dist/{chunk-OSSDK5RS.js → chunk-RBPJO4KG.js} +6 -2
  73. package/dist/{chunk-TIWURSLS.js → chunk-SFNRAEEW.js} +1 -1
  74. package/dist/{chunk-USQDVBEV.js → chunk-TDKE3V6W.js} +1 -1
  75. package/dist/{chunk-HU5LSYL2.js → chunk-VMNI33F5.js} +1 -1
  76. package/dist/{chunk-UYDTFCHW.js → chunk-VZANUMIF.js} +1 -1
  77. package/dist/{chunk-3ZSGKLSO.js → chunk-XGL5JC6U.js} +2 -2
  78. package/dist/chunk-XQOT4CCK.js +305 -0
  79. package/dist/{chunk-T4QY64OR.js → chunk-YFD7CRIZ.js} +376 -10
  80. package/dist/{reapply-D2TFN6XK.js → reapply-RRDVJATI.js} +12 -8
  81. package/dist/src/index.d.ts +1 -0
  82. package/dist/src/index.js +12 -12
  83. package/package.json +1 -1
@@ -0,0 +1,38 @@
1
+ import {
2
+ NPX_LATEST_COMMAND
3
+ } from "./chunk-EA3IELHP.js";
4
+
5
+ // src/setup/codex-trust.ts
6
+ var CODEX_TRUST_TELEMETRY = {
7
+ verified: "verified",
8
+ refused: "manual",
9
+ unlisted: "manual",
10
+ skipped: "unverified",
11
+ unavailable: "unverified"
12
+ };
13
+ var isUnanswered = (confirmation) => confirmation.kind === "skipped" || confirmation.kind === "unavailable";
14
+ var codexTrustOutcome = (confirmation, portedTrustWritten) => isUnanswered(confirmation) && !portedTrustWritten ? "manual" : CODEX_TRUST_TELEMETRY[confirmation.kind];
15
+ var CODEX_TRUST_REFUSED = "Codex did not accept the trust Pushary asked for, so its hooks are not trusted yet. Open Codex, run /hooks, and choose Trust for the Pushary hooks.";
16
+ var describeUnlistedCodexHooks = (warnings) => {
17
+ const said = warnings[0] ? ` Codex said: ${warnings[0]}` : "";
18
+ return `Codex does not list the Pushary hooks, so it will not run them.${said} Run ${NPX_LATEST_COMMAND} doctor for details.`;
19
+ };
20
+ var describeCodexTrustConfirmation = (confirmation) => {
21
+ switch (confirmation.kind) {
22
+ case "verified":
23
+ return confirmation.wrote ? "Codex trusted the Pushary hooks when asked, and confirmed it." : "Codex confirms the Pushary hooks are trusted.";
24
+ case "refused":
25
+ return confirmation.writeError ? `${CODEX_TRUST_REFUSED} Codex said: ${confirmation.writeError}` : CODEX_TRUST_REFUSED;
26
+ case "unlisted":
27
+ return describeUnlistedCodexHooks(confirmation.warnings);
28
+ case "skipped":
29
+ return `Pushary did not ask Codex to confirm the trust: ${confirmation.reason}.`;
30
+ case "unavailable":
31
+ return `Codex could not be asked to confirm the Pushary hooks are trusted (${confirmation.reason}).`;
32
+ }
33
+ };
34
+
35
+ export {
36
+ codexTrustOutcome,
37
+ describeCodexTrustConfirmation
38
+ };
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  isValidApiKey,
15
15
  normalizeKeyScope
16
- } from "./chunk-T4QY64OR.js";
16
+ } from "./chunk-YFD7CRIZ.js";
17
17
 
18
18
  // src/session.ts
19
19
  var samePusharyAccount = (left, right) => left.kind === "ok" && right.kind === "ok" && left.identity.workspaceId !== "" && left.identity.workspaceId === right.identity.workspaceId && left.identity.siteId === right.identity.siteId;
@@ -4,14 +4,14 @@ import {
4
4
  } from "./chunk-XHKBHWLX.js";
5
5
  import {
6
6
  getMachineId
7
- } from "./chunk-UQHUUZ5H.js";
7
+ } from "./chunk-7JSE6JTZ.js";
8
8
  import {
9
9
  pusharyDir,
10
10
  resolveGlobalBinary
11
- } from "./chunk-DYHXOXUF.js";
11
+ } from "./chunk-F2OPOBRO.js";
12
12
  import {
13
13
  readControlMode
14
- } from "./chunk-USQDVBEV.js";
14
+ } from "./chunk-TDKE3V6W.js";
15
15
  import {
16
16
  readJsonSafe,
17
17
  writeFileAtomic,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readConfigFileKey
3
- } from "./chunk-USQDVBEV.js";
3
+ } from "./chunk-TDKE3V6W.js";
4
4
 
5
5
  // src/bell/fleet.ts
6
6
  import { closeSync, constants, futimesSync, lstatSync, mkdirSync, openSync, readdirSync, unlinkSync } from "fs";
@@ -2,7 +2,7 @@ import {
2
2
  HOOK_BUDGETS,
3
3
  HOOK_LOCATOR_BINARY,
4
4
  withHookHoldBudget
5
- } from "./chunk-T4QY64OR.js";
5
+ } from "./chunk-YFD7CRIZ.js";
6
6
  import {
7
7
  isReleaseVersion
8
8
  } from "./chunk-HWJW3CPO.js";
@@ -314,7 +314,8 @@ var CODEX_HOOK_BINARY = "pushary-codex-hook";
314
314
  var codexHome = () => codexHomeFrom(homedir());
315
315
  var codexHomeFrom = (home) => process.env.CODEX_HOME?.trim() || join2(home, ".codex");
316
316
  var codexConfigToml = () => join2(codexHome(), "config.toml");
317
- var codexHooksJson = () => join2(codexHome(), "hooks.json");
317
+ var codexHooksJsonIn = (home) => join2(home, "hooks.json");
318
+ var codexHooksJson = () => codexHooksJsonIn(codexHome());
318
319
  var codexAgentsMd = () => join2(codexHome(), "AGENTS.md");
319
320
  var codexSkillDir = () => join2(codexHome(), "skills", "pushary");
320
321
  var CODEX_HOOK_EVENTS = [
@@ -386,10 +387,11 @@ var readCodexMcpAuth = (config) => {
386
387
  if (typeof pushary.bearer_token === "string") return { method: "legacy-bearer" };
387
388
  return void 0;
388
389
  };
390
+ var isPusharyCodexCommand = (command) => command.includes(CODEX_HOOK_BINARY) || command.includes(HOOK_LOCATOR_BINARY);
389
391
  var isPusharyCommand = (hook, scope) => {
390
392
  const command = String(asRecord2(hook)?.command ?? "");
391
393
  if (isProtectedByScope(command, scope)) return false;
392
- return command.includes(CODEX_HOOK_BINARY) || command.includes(HOOK_LOCATOR_BINARY);
394
+ return isPusharyCodexCommand(command);
393
395
  };
394
396
  var isPusharyCodexHook = (entry, scope) => {
395
397
  const hooks = asRecord2(entry)?.hooks;
@@ -463,23 +465,6 @@ var codexEntryTrustHash = (eventKey, entry) => {
463
465
  if (typeof entry.matcher === "string") identity.matcher = entry.matcher;
464
466
  return "sha256:" + createHash("sha256").update(canonicalJson(identity), "utf8").digest("hex");
465
467
  };
466
- var codexTrustSchemeAgrees = (hooksConfig, config, hooksJsonPath) => {
467
- const hooks = asRecord2(hooksConfig?.hooks);
468
- const state = asRecord2(asRecord2(config.hooks)?.state);
469
- if (!hooks || !state) return false;
470
- for (const [event, entries] of Object.entries(hooks)) {
471
- if (!Array.isArray(entries)) continue;
472
- const eventKey = CODEX_EVENT_KEY[event] ?? codexEventKeyOf(event);
473
- for (const [index, entry] of entries.entries()) {
474
- const record = asRecord2(entry);
475
- if (!record) continue;
476
- const stored = asRecord2(state[`${hooksJsonPath}:${eventKey}:${index}:0`])?.trusted_hash;
477
- if (typeof stored !== "string") continue;
478
- if (stored === codexEntryTrustHash(eventKey, record)) return true;
479
- }
480
- }
481
- return false;
482
- };
483
468
  var codexHookPositions = (hooksConfig) => {
484
469
  const hooks = asRecord2(hooksConfig?.hooks);
485
470
  const positions = {};
@@ -676,18 +661,19 @@ export {
676
661
  codexHome,
677
662
  codexHomeFrom,
678
663
  codexConfigToml,
664
+ codexHooksJsonIn,
679
665
  codexHooksJson,
680
666
  codexAgentsMd,
681
667
  codexSkillDir,
682
668
  CODEX_HOOK_EVENTS,
683
669
  addCodexMcpServer,
684
670
  readCodexMcpAuth,
671
+ isPusharyCodexCommand,
685
672
  codexRegistrationHolder,
686
673
  addCodexHooks,
687
674
  removeCodexHooks,
688
675
  hasCodexHooks,
689
676
  missingCodexHookEvents,
690
- codexTrustSchemeAgrees,
691
677
  codexHookPositions,
692
678
  codexVacatedIndexes,
693
679
  dropVacatedCodexHookTrust,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSafeReadOnlyCommand
3
- } from "./chunk-T4QY64OR.js";
3
+ } from "./chunk-YFD7CRIZ.js";
4
4
 
5
5
  // src/ledger.ts
6
6
  import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync } from "fs";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  registerTranscript
3
- } from "./chunk-NFKVRMTM.js";
3
+ } from "./chunk-A2GS2ENL.js";
4
4
  import {
5
5
  degradedLine
6
- } from "./chunk-T4QY64OR.js";
6
+ } from "./chunk-YFD7CRIZ.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"];
@@ -3,28 +3,28 @@ import {
3
3
  addPusharyToolPermissions,
4
4
  isPusharyHook,
5
5
  removeClaudeMcpServers
6
- } from "./chunk-J4J45VPZ.js";
6
+ } from "./chunk-HWG7X3VI.js";
7
7
  import {
8
8
  CLAUDE_HOOK_EVENTS,
9
9
  addGeminiMcpServer,
10
10
  removeGeminiMcpServer
11
- } from "./chunk-EADZPVYW.js";
11
+ } from "./chunk-BK5F3FGE.js";
12
12
  import {
13
13
  CLAUDE_CODE_AGENT,
14
14
  parseApplyPatchFiles
15
- } from "./chunk-FDHMNT24.js";
15
+ } from "./chunk-66BIMA62.js";
16
16
  import {
17
17
  guardBinary,
18
18
  holdBudgetOf,
19
19
  registerHookEntry
20
- } from "./chunk-DYHXOXUF.js";
20
+ } from "./chunk-F2OPOBRO.js";
21
21
  import {
22
22
  PHONE_ANSWERED_TOOLS,
23
23
  hookCompatibleProfile,
24
24
  hookCompatibleProfileBySource,
25
25
  toToolLookup,
26
26
  withHookHoldBudget
27
- } from "./chunk-T4QY64OR.js";
27
+ } from "./chunk-YFD7CRIZ.js";
28
28
 
29
29
  // src/compatible-config.ts
30
30
  import { homedir } from "os";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  openCodeConfigDirFrom
3
- } from "./chunk-TUXFIVOH.js";
3
+ } from "./chunk-B6TYEKJR.js";
4
4
  import {
5
5
  codexHomeFrom
6
- } from "./chunk-DYHXOXUF.js";
6
+ } from "./chunk-F2OPOBRO.js";
7
7
  import {
8
8
  HOOK_COMPATIBLE_PROFILES
9
- } from "./chunk-T4QY64OR.js";
9
+ } from "./chunk-YFD7CRIZ.js";
10
10
 
11
11
  // src/vscode-config.ts
12
12
  import { homedir } from "os";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HOOK_LOCATOR_BINARY
3
- } from "./chunk-T4QY64OR.js";
3
+ } from "./chunk-YFD7CRIZ.js";
4
4
 
5
5
  // src/diagnostics/bridge.ts
6
6
  import { execFileSync } from "child_process";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  HOOK_HOLD_BUDGET_ENV,
3
3
  hookHoldBudgetProof
4
- } from "./chunk-T4QY64OR.js";
4
+ } from "./chunk-YFD7CRIZ.js";
5
5
 
6
6
  // src/hold-budget.ts
7
7
  var takeHookHoldBudget = (args = process.argv.slice(2), env = process.env) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readTranscriptPreference
3
- } from "./chunk-USQDVBEV.js";
3
+ } from "./chunk-TDKE3V6W.js";
4
4
 
5
5
  // src/transcript-setting.ts
6
6
  var transcriptEnvironmentPreference = () => {
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  CLAUDE_HOOK_EVENTS,
3
3
  supportedClaudeEvents
4
- } from "./chunk-EADZPVYW.js";
4
+ } from "./chunk-BK5F3FGE.js";
5
5
  import {
6
6
  guardBinary,
7
7
  holdBudgetOf,
8
8
  isProtectedByScope,
9
9
  registerHookEntry
10
- } from "./chunk-DYHXOXUF.js";
10
+ } from "./chunk-F2OPOBRO.js";
11
11
  import {
12
12
  HOOK_LOCATOR_BINARY,
13
13
  withHookHoldBudget
14
- } from "./chunk-T4QY64OR.js";
14
+ } from "./chunk-YFD7CRIZ.js";
15
15
 
16
16
  // src/claude-config.ts
17
17
  import { join } from "path";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  AGENT_CHOICES
3
- } from "./chunk-TFKBFQCE.js";
3
+ } from "./chunk-A5URWZTP.js";
4
4
  import {
5
5
  isBridgeLocator
6
- } from "./chunk-K3QVDAZW.js";
6
+ } from "./chunk-GDXSCXQC.js";
7
7
  import {
8
8
  pusharyHookExecutable
9
- } from "./chunk-NTQSICPJ.js";
9
+ } from "./chunk-MOQOJOMD.js";
10
10
  import {
11
11
  BELL_HOOK_BINARY
12
- } from "./chunk-SOCEY746.js";
12
+ } from "./chunk-OR3A3RLH.js";
13
13
 
14
14
  // src/setup/hook-ownership.ts
15
15
  var commandsIn = (value) => {
@@ -2,17 +2,17 @@ import {
2
2
  CLAUDE_HOOK_EVENTS,
3
3
  GEMINI_HOOK_EVENTS,
4
4
  hasGeminiHooks
5
- } from "./chunk-EADZPVYW.js";
5
+ } from "./chunk-BK5F3FGE.js";
6
6
  import {
7
7
  CODEX_HOOK_EVENTS,
8
8
  hasCodexHooks,
9
9
  holdBudgetOf
10
- } from "./chunk-DYHXOXUF.js";
10
+ } from "./chunk-F2OPOBRO.js";
11
11
  import {
12
12
  CURSOR_GATE_EVENTS,
13
13
  HOOK_LOCATOR_BINARY,
14
14
  hookCommandHoldBudget
15
- } from "./chunk-T4QY64OR.js";
15
+ } from "./chunk-YFD7CRIZ.js";
16
16
 
17
17
  // src/diagnostics/wiring.ts
18
18
  var record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parseVersion
3
- } from "./chunk-EADZPVYW.js";
3
+ } from "./chunk-BK5F3FGE.js";
4
4
 
5
5
  // src/setup/agent-probe.ts
6
6
  import { execSync } from "child_process";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolvePathBinary
3
- } from "./chunk-DYHXOXUF.js";
3
+ } from "./chunk-F2OPOBRO.js";
4
4
 
5
5
  // src/hermes-config.ts
6
6
  import { execFileSync } from "child_process";
@@ -1,18 +1,21 @@
1
1
  import {
2
2
  detectClaudeVersion
3
- } from "./chunk-3NBODGQS.js";
3
+ } from "./chunk-NDS27FXU.js";
4
+ import {
5
+ ensureCodexTrustsPusharyHooks
6
+ } from "./chunk-XQOT4CCK.js";
4
7
  import {
5
8
  addClaudeMcpServer,
6
9
  addPusharyHooks,
7
10
  addPusharyToolPermissions
8
- } from "./chunk-J4J45VPZ.js";
11
+ } from "./chunk-HWG7X3VI.js";
9
12
  import {
10
13
  claudeUnprovenHolds,
11
14
  claudeWired,
12
15
  codexUnprovenHolds,
13
16
  codexWired,
14
17
  geminiWired
15
- } from "./chunk-NTQSICPJ.js";
18
+ } from "./chunk-MOQOJOMD.js";
16
19
  import {
17
20
  CLAUDE_HOOK_BINARY,
18
21
  CLAUDE_HOOK_EVENTS,
@@ -24,7 +27,7 @@ import {
24
27
  needsReregistration,
25
28
  registrationSignatures,
26
29
  supportedClaudeEvents
27
- } from "./chunk-EADZPVYW.js";
30
+ } from "./chunk-BK5F3FGE.js";
28
31
  import {
29
32
  CODEX_HOOK_BINARY,
30
33
  addCodexHookTrust,
@@ -44,7 +47,7 @@ import {
44
47
  registrationHolderOf,
45
48
  resolveGlobalBinary,
46
49
  vscodePluginMcp
47
- } from "./chunk-DYHXOXUF.js";
50
+ } from "./chunk-F2OPOBRO.js";
48
51
  import {
49
52
  readJsonSafe,
50
53
  writeFileAtomic,
@@ -123,6 +126,7 @@ var reapplyClaudeSettings = (apiKey, paths = {}) => {
123
126
  const claudeJsonWritable = claudeJson != null;
124
127
  let hooks = false;
125
128
  let mcp = false;
129
+ let failed = false;
126
130
  try {
127
131
  if (!settingsWritable) throw new Error("settings.json could not be parsed");
128
132
  const s = settings;
@@ -132,6 +136,7 @@ var reapplyClaudeSettings = (apiKey, paths = {}) => {
132
136
  writeJson(settingsPath, s);
133
137
  hooks = true;
134
138
  } catch {
139
+ failed = true;
135
140
  }
136
141
  if (apiKey) {
137
142
  try {
@@ -141,9 +146,10 @@ var reapplyClaudeSettings = (apiKey, paths = {}) => {
141
146
  writeJson(claudeJsonPath, cj);
142
147
  mcp = true;
143
148
  } catch {
149
+ failed = true;
144
150
  }
145
151
  }
146
- return { configured: true, reapplied: hooks || mcp, hooks, mcp };
152
+ return { configured: true, reapplied: hooks || mcp, hooks, mcp, failed };
147
153
  };
148
154
  var reapplyClaudeForVersion = (apiKey, paths = {}) => {
149
155
  const idle = { verdict: "current", rewrote: false, missing: [] };
@@ -212,6 +218,7 @@ var reapplyCodexSettings = (apiKey, paths = {}) => {
212
218
  const command = guardBinary((paths.resolveBinary ?? resolveGlobalBinary)(CODEX_HOOK_BINARY) ?? CODEX_HOOK_BINARY);
213
219
  let hooks = false;
214
220
  let mcp = false;
221
+ let failed = hooksConfig === null || config === null;
215
222
  const vacated = codexVacatedIndexes(hooksConfig ?? void 0);
216
223
  if (hooksConfig != null) {
217
224
  try {
@@ -219,6 +226,7 @@ var reapplyCodexSettings = (apiKey, paths = {}) => {
219
226
  writeJson(hooksPath, hooksConfig);
220
227
  hooks = true;
221
228
  } catch {
229
+ failed = true;
222
230
  }
223
231
  }
224
232
  if (config != null) {
@@ -229,15 +237,18 @@ var reapplyCodexSettings = (apiKey, paths = {}) => {
229
237
  }
230
238
  if (apiKey) {
231
239
  addCodexMcpServer(config, apiKey);
232
- mcp = true;
233
240
  }
234
241
  if (hooks || apiKey) {
235
242
  writeFileAtomic(configPath, stringifyTOML(config), modeToPreserve(configPath), "utf-8");
243
+ mcp = Boolean(apiKey);
236
244
  }
237
245
  } catch {
246
+ failed = true;
247
+ hooks = false;
238
248
  }
239
249
  }
240
- return { configured: true, reapplied: hooks || mcp, hooks, mcp };
250
+ if (config === null) hooks = false;
251
+ return { configured: true, reapplied: hooks || mcp, hooks, mcp, failed };
241
252
  };
242
253
  var repairCodexHolds = (paths = {}) => {
243
254
  const idle = { configured: false, reapplied: false, hooks: false, mcp: false };
@@ -262,13 +273,14 @@ var reapplyGeminiSettings = (apiKey, paths = {}) => {
262
273
  let mcp = false;
263
274
  try {
264
275
  addGeminiHooks(settings, guardBinary(resolveGlobalBinary(GEMINI_HOOK_BINARY) ?? GEMINI_HOOK_BINARY));
265
- hooks = true;
266
276
  if (apiKey) {
267
277
  addGeminiMcpServer(settings, apiKey);
268
- mcp = true;
269
278
  }
270
279
  writeJson(settingsPath, settings);
280
+ hooks = true;
281
+ mcp = Boolean(apiKey);
271
282
  } catch {
283
+ return { configured: true, reapplied: false, hooks: false, mcp: false, failed: true };
272
284
  }
273
285
  return { configured: true, reapplied: hooks || mcp, hooks, mcp };
274
286
  };
@@ -283,7 +295,7 @@ var reapplyPluginMcp = (mcpPath, apiKey) => {
283
295
  writeJson(mcpPath, mcpConfig);
284
296
  return { configured: true, reapplied: true, hooks: false, mcp: true };
285
297
  } catch {
286
- return { configured: true, reapplied: false, hooks: false, mcp: false };
298
+ return { configured: true, reapplied: false, hooks: false, mcp: false, failed: true };
287
299
  }
288
300
  };
289
301
  var reapplyCursorPlugin = (apiKey, paths = {}) => reapplyPluginMcp(
@@ -305,10 +317,13 @@ var reapplyAllAgents = (apiKey) => {
305
317
  const result = runner.run();
306
318
  if (result.configured) done.push({ id: runner.id, label: runner.label, result });
307
319
  } catch {
320
+ done.push({ id: runner.id, label: runner.label, result: { configured: false, reapplied: false, hooks: false, mcp: false, failed: true } });
308
321
  }
309
322
  }
310
323
  return done;
311
324
  };
325
+ var isRewrittenCodex = (agent) => agent.id === "codex" && agent.result.hooks;
326
+ var ensureCodexTrustAfterReapply = async (agents, options = {}) => agents.some(isRewrittenCodex) ? ensureCodexTrustsPusharyHooks(options) : null;
312
327
 
313
328
  export {
314
329
  reapplyClaudeSettings,
@@ -319,5 +334,6 @@ export {
319
334
  reapplyGeminiSettings,
320
335
  reapplyCursorPlugin,
321
336
  reapplyVsCodePlugin,
322
- reapplyAllAgents
337
+ reapplyAllAgents,
338
+ ensureCodexTrustAfterReapply
323
339
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  guardBinary
3
- } from "./chunk-DYHXOXUF.js";
3
+ } from "./chunk-F2OPOBRO.js";
4
4
 
5
5
  // src/bell/install.ts
6
6
  import { join } from "path";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  describeKeyCheck,
3
3
  keyCheckFromResponse
4
- } from "./chunk-43LJSM4F.js";
4
+ } from "./chunk-CSW6A2EW.js";
5
5
  import {
6
6
  createIo
7
7
  } from "./chunk-5RUIFDTP.js";
@@ -15,11 +15,11 @@ import {
15
15
  } from "./chunk-HETOKNIL.js";
16
16
  import {
17
17
  reportedInstallSource
18
- } from "./chunk-HU5LSYL2.js";
18
+ } from "./chunk-VMNI33F5.js";
19
19
  import {
20
20
  PAIR_TTL_SECONDS,
21
21
  isAnswerSource
22
- } from "./chunk-T4QY64OR.js";
22
+ } from "./chunk-YFD7CRIZ.js";
23
23
  import {
24
24
  NPX_LATEST_COMMAND
25
25
  } from "./chunk-EA3IELHP.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  autoUpdateState
3
- } from "./chunk-DYHXOXUF.js";
3
+ } from "./chunk-F2OPOBRO.js";
4
4
  import {
5
5
  readJsonSafe,
6
6
  writeJsonAtomic
@@ -19,7 +19,7 @@ var GLOBAL_PACKAGE_SUBPATH = "/lib/node_modules/@pushary/agent-hooks";
19
19
  var UPGRADE_ENTRY_SUBPATH = ["dist", "bin", "pushary-upgrade.js"];
20
20
  var NON_GLOBAL_INSTALL_SEGMENTS = ["/_npx/", "/.volta/"];
21
21
  var NOT_DISABLED_VALUES = /* @__PURE__ */ new Set(["", "0"]);
22
- var AUTO_UPDATE_RESULTS = ["updated", "current", "needs_manual", "failed"];
22
+ var AUTO_UPDATE_RESULTS = ["updated", "current", "needs_manual", "failed", "finish_pending"];
23
23
  var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
24
24
  var isAutoUpdateResult = (value) => typeof value === "string" && AUTO_UPDATE_RESULTS.some((result) => result === value);
25
25
  var stringField = (record, key) => {
@@ -53,6 +53,7 @@ var autoUpdateOffReason = (input) => {
53
53
  if (input.state.disabled === true) return "disabled_by_user";
54
54
  if (isContinuousIntegration(input.env)) return "ci";
55
55
  if (input.platform === "win32") return "windows";
56
+ if (input.platform === "linux") return "linux";
56
57
  return null;
57
58
  };
58
59
  var globalInstallPrefix = (packageRoot) => {
@@ -89,6 +90,7 @@ var parseAutoUpdateFlag = (args) => {
89
90
  };
90
91
  var AUTO_UPDATE_RESULT_LABELS = {
91
92
  updated: "updated",
93
+ finish_pending: "installed; configuration refresh pending",
92
94
  current: "up to date",
93
95
  needs_manual: "needs a manual upgrade",
94
96
  failed: "failed"
@@ -98,6 +100,7 @@ var describeAutoUpdateCheck = (state) => {
98
100
  const label = state.lastResult ? AUTO_UPDATE_RESULT_LABELS[state.lastResult] : "no result recorded";
99
101
  return [label, versionsOf(state), state.detail].filter(Boolean).join(", ");
100
102
  };
103
+ var hasPendingUpgradeFinish = (state, installed) => state.to === installed && (state.lastResult === "finish_pending" || state.lastResult === "updated" && Boolean(state.detail));
101
104
  var pendingAutoUpdateAnnouncement = (state) => state.lastResult === "updated" && state.announced !== true && state.from && state.to ? { from: state.from, to: state.to } : null;
102
105
  var describeAutoUpdateAnnouncement = (announcement) => `Pushary updated itself from ${announcement.from} to ${announcement.to}.`;
103
106
  var takeAutoUpdateAnnouncement = (statePath, markAnnounced) => {
@@ -154,6 +157,7 @@ export {
154
157
  upgradeEntryFor,
155
158
  parseAutoUpdateFlag,
156
159
  describeAutoUpdateCheck,
160
+ hasPendingUpgradeFinish,
157
161
  describeAutoUpdateAnnouncement,
158
162
  takeAutoUpdateAnnouncement,
159
163
  readAutoUpdateState,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  redactSecrets
3
- } from "./chunk-T4QY64OR.js";
3
+ } from "./chunk-YFD7CRIZ.js";
4
4
 
5
5
  // src/crypto.ts
6
6
  import nacl from "tweetnacl";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveInstallSourceFor
3
- } from "./chunk-HU5LSYL2.js";
3
+ } from "./chunk-VMNI33F5.js";
4
4
  import {
5
5
  backupFile,
6
6
  readJsonSafe,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-OSJEMXSR.js";
4
4
  import {
5
5
  normalizeInstallSource
6
- } from "./chunk-T4QY64OR.js";
6
+ } from "./chunk-YFD7CRIZ.js";
7
7
 
8
8
  // src/install-source.ts
9
9
  import { readFileSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PRETOOLUSE_GATED_TOOLS
3
- } from "./chunk-T4QY64OR.js";
3
+ } from "./chunk-YFD7CRIZ.js";
4
4
 
5
5
  // src/claude-tools.ts
6
6
  var POSTTOOLUSE_MIRROR_ONLY_TOOLS = ["TodoWrite", "Task", "WebFetch", "WebSearch"];
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SETUP_FLAGS
3
- } from "./chunk-TFKBFQCE.js";
3
+ } from "./chunk-A5URWZTP.js";
4
4
  import {
5
5
  parseFlags
6
6
  } from "./chunk-GMXKITVA.js";
@@ -14,7 +14,7 @@ import {
14
14
  CLAUDE_CONNECTOR_URL,
15
15
  COWORK_CONNECTOR_LIMIT,
16
16
  COWORK_STANDING_INSTRUCTIONS
17
- } from "./chunk-T4QY64OR.js";
17
+ } from "./chunk-YFD7CRIZ.js";
18
18
 
19
19
  // src/cli/cowork.ts
20
20
  import { readFileSync } from "fs";