@pushary/agent-hooks 1.5.0 → 1.5.1

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 (59) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +2 -1
  3. package/dist/bin/pushary-bell-hook.js +9 -9
  4. package/dist/bin/pushary-bell.js +2 -2
  5. package/dist/bin/pushary-claude.js +10 -10
  6. package/dist/bin/pushary-clean.js +12 -12
  7. package/dist/bin/pushary-codex-bridge.js +4 -4
  8. package/dist/bin/pushary-codex-hook.js +13 -13
  9. package/dist/bin/pushary-codex.js +3 -3
  10. package/dist/bin/pushary-daemon.js +15 -14
  11. package/dist/bin/pushary-disconnect.js +6 -6
  12. package/dist/bin/pushary-doctor.js +43 -15
  13. package/dist/bin/pushary-elicitation-hook.js +9 -9
  14. package/dist/bin/pushary-gemini-bridge.js +3 -3
  15. package/dist/bin/pushary-gemini-hook.js +11 -11
  16. package/dist/bin/pushary-hook.js +14 -14
  17. package/dist/bin/pushary-login.js +3 -3
  18. package/dist/bin/pushary-logout.js +1 -1
  19. package/dist/bin/pushary-notification-hook.js +12 -12
  20. package/dist/bin/pushary-opencode-hook.js +10 -10
  21. package/dist/bin/pushary-permission-denied-hook.js +14 -14
  22. package/dist/bin/pushary-permission-hook.js +14 -14
  23. package/dist/bin/pushary-post-hook.js +12 -12
  24. package/dist/bin/pushary-prompt-hook.js +12 -12
  25. package/dist/bin/pushary-session-end-hook.js +12 -12
  26. package/dist/bin/pushary-session-start-hook.js +16 -15
  27. package/dist/bin/pushary-setup.js +52 -51
  28. package/dist/bin/pushary-status.js +5 -5
  29. package/dist/bin/pushary-stop-hook.js +12 -12
  30. package/dist/bin/pushary-stopfailure-hook.js +12 -12
  31. package/dist/bin/pushary-transcript-register.js +8 -8
  32. package/dist/bin/pushary-upgrade.js +57 -27
  33. package/dist/{chunk-EADZPVYW.js → chunk-2AUIEZYS.js} +1 -1
  34. package/dist/{chunk-J4J45VPZ.js → chunk-4ERLRNOK.js} +2 -2
  35. package/dist/{chunk-SOCEY746.js → chunk-5UQ5ATIE.js} +1 -1
  36. package/dist/{chunk-KEOLNHR3.js → chunk-5ZZG76S2.js} +1 -1
  37. package/dist/chunk-6EEANS74.js +300 -0
  38. package/dist/{chunk-DYHXOXUF.js → chunk-6IU45EHE.js} +6 -20
  39. package/dist/{chunk-ORLJNJEO.js → chunk-6QFEQIPM.js} +1 -1
  40. package/dist/chunk-BY2CRWBO.js +38 -0
  41. package/dist/{chunk-FDHMNT24.js → chunk-D573TLP6.js} +1 -1
  42. package/dist/{chunk-3NBODGQS.js → chunk-HUAOMX4U.js} +1 -1
  43. package/dist/{chunk-F57RGL7K.js → chunk-IV3RHICU.js} +3 -3
  44. package/dist/{chunk-PNNBMH4E.js → chunk-JKBDGZFL.js} +12 -6
  45. package/dist/{chunk-DLJN5XEU.js → chunk-KHXVTWYS.js} +1 -1
  46. package/dist/{chunk-MYP4UUFH.js → chunk-M2LMXPJZ.js} +1 -1
  47. package/dist/{chunk-CQYHOHOK.js → chunk-MDJJW3LP.js} +2 -2
  48. package/dist/{chunk-OSSDK5RS.js → chunk-MU3WU2FO.js} +6 -2
  49. package/dist/{chunk-IYTQ4B5I.js → chunk-PJ27EHCD.js} +4 -4
  50. package/dist/{chunk-JF736N4C.js → chunk-R5KY3PBN.js} +4 -4
  51. package/dist/{chunk-NFKVRMTM.js → chunk-TZGCUNOX.js} +3 -3
  52. package/dist/{chunk-PCGZXWGQ.js → chunk-WNJSGZY7.js} +2 -2
  53. package/dist/{chunk-UQHUUZ5H.js → chunk-WOLPADR6.js} +1 -1
  54. package/dist/{chunk-7XT76LWT.js → chunk-X7FESZTD.js} +2 -2
  55. package/dist/{chunk-H5LHTC5X.js → chunk-YAWXKL2X.js} +1 -1
  56. package/dist/{chunk-NTQSICPJ.js → chunk-Z4VGIBJ7.js} +2 -2
  57. package/dist/{reapply-D2TFN6XK.js → reapply-5CZSTJZI.js} +10 -6
  58. package/dist/src/index.js +8 -8
  59. package/package.json +1 -1
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ codexTrustOutcome,
4
+ describeCodexTrustConfirmation
5
+ } from "../chunk-BY2CRWBO.js";
2
6
  import {
3
7
  runBrowserLogin
4
8
  } from "../chunk-YQMFGWBD.js";
@@ -9,15 +13,18 @@ import {
9
13
  import "../chunk-PUZZELE6.js";
10
14
  import {
11
15
  detectClaudeVersion
12
- } from "../chunk-3NBODGQS.js";
16
+ } from "../chunk-HUAOMX4U.js";
13
17
  import {
14
18
  describeVersionManagerPin,
15
19
  versionManagerOf
16
20
  } from "../chunk-GU3EJCVV.js";
21
+ import {
22
+ ensureCodexTrustsPusharyHooks
23
+ } from "../chunk-6EEANS74.js";
17
24
  import {
18
25
  readManagedControlEvidence,
19
26
  waitForMachineReadiness
20
- } from "../chunk-F57RGL7K.js";
27
+ } from "../chunk-IV3RHICU.js";
21
28
  import {
22
29
  HERMES_CONFIG_SCRIPT,
23
30
  HERMES_PIP_PACKAGE,
@@ -27,7 +34,7 @@ import {
27
34
  isHermesConfigReceipt,
28
35
  resolveHermesPython,
29
36
  runHermesPythonScript
30
- } from "../chunk-H5LHTC5X.js";
37
+ } from "../chunk-YAWXKL2X.js";
31
38
  import {
32
39
  describeDetection,
33
40
  detectAllAgents,
@@ -39,7 +46,7 @@ import {
39
46
  shortenHome,
40
47
  vscodeSettingsTargets,
41
48
  writeInstructionBlock
42
- } from "../chunk-DLJN5XEU.js";
49
+ } from "../chunk-KHXVTWYS.js";
43
50
  import {
44
51
  OPENCODE_HOOK_BINARY,
45
52
  addOpenCodeMcpServer,
@@ -61,7 +68,7 @@ import {
61
68
  compatibleMcpFile,
62
69
  compatiblePermissionRuleFile,
63
70
  hasCompatibleHooks
64
- } from "../chunk-JF736N4C.js";
71
+ } from "../chunk-R5KY3PBN.js";
65
72
  import {
66
73
  addClaudeMcpServer,
67
74
  addPusharyHooks,
@@ -69,16 +76,16 @@ import {
69
76
  captureClaudeMcpServer,
70
77
  isClaudeMcpSnapshot,
71
78
  updateClaudeMcpSnapshot
72
- } from "../chunk-J4J45VPZ.js";
79
+ } from "../chunk-4ERLRNOK.js";
73
80
  import {
74
81
  detectProviderLiveCapabilities,
75
82
  hasSpawnProvider,
76
83
  resolveControlPolicy
77
- } from "../chunk-KEOLNHR3.js";
84
+ } from "../chunk-5ZZG76S2.js";
78
85
  import {
79
86
  describeAutoUpdateAnnouncement,
80
87
  takeAutoUpdateAnnouncement
81
- } from "../chunk-OSSDK5RS.js";
88
+ } from "../chunk-MU3WU2FO.js";
82
89
  import {
83
90
  KEEP_HINT,
84
91
  captureHookTakeover,
@@ -88,7 +95,7 @@ import {
88
95
  hookOwnerOf,
89
96
  mcpBearerKey,
90
97
  planHooks
91
- } from "../chunk-PCGZXWGQ.js";
98
+ } from "../chunk-WNJSGZY7.js";
92
99
  import {
93
100
  AGENT_CHOICES,
94
101
  effectiveControlMode,
@@ -104,7 +111,7 @@ import {
104
111
  codexWired,
105
112
  geminiWired,
106
113
  pusharyHookExecutable
107
- } from "../chunk-NTQSICPJ.js";
114
+ } from "../chunk-Z4VGIBJ7.js";
108
115
  import {
109
116
  clearDaemonNeedsLogin,
110
117
  daemonHasRemoteProof,
@@ -117,26 +124,25 @@ import {
117
124
  replaceDaemonService,
118
125
  stopDaemonService,
119
126
  waitForDaemonRemoteProof
120
- } from "../chunk-7XT76LWT.js";
127
+ } from "../chunk-X7FESZTD.js";
121
128
  import {
122
129
  GEMINI_HOOK_BINARY,
123
130
  addGeminiHooks,
124
131
  addGeminiMcpServer,
125
132
  compareVersion,
126
- formatVersion,
127
133
  parseVersion
128
- } from "../chunk-EADZPVYW.js";
129
- import "../chunk-SOCEY746.js";
134
+ } from "../chunk-2AUIEZYS.js";
135
+ import "../chunk-5UQ5ATIE.js";
130
136
  import {
131
137
  transcriptPreferenceForSetup
132
138
  } from "../chunk-2QT3GCU4.js";
133
139
  import "../chunk-XHKBHWLX.js";
134
140
  import {
135
141
  reportEvent
136
- } from "../chunk-FDHMNT24.js";
142
+ } from "../chunk-D573TLP6.js";
137
143
  import "../chunk-UYDTFCHW.js";
138
144
  import "../chunk-PYCQXCI5.js";
139
- import "../chunk-UQHUUZ5H.js";
145
+ import "../chunk-WOLPADR6.js";
140
146
  import {
141
147
  addCodexHookTrust,
142
148
  addCodexHooks,
@@ -152,7 +158,6 @@ import {
152
158
  codexHome,
153
159
  codexHookPositions,
154
160
  codexSkillDir2 as codexSkillDir,
155
- codexTrustSchemeAgrees,
156
161
  codexVacatedIndexes,
157
162
  cursorPluginDir,
158
163
  cursorUserHooks,
@@ -176,7 +181,7 @@ import {
176
181
  resolveGlobalBinary,
177
182
  vscodePluginDir,
178
183
  vscodePluginMcp
179
- } from "../chunk-DYHXOXUF.js";
184
+ } from "../chunk-6IU45EHE.js";
180
185
  import {
181
186
  BROWSER_CONNECT_COMMAND,
182
187
  confirmAppConnection,
@@ -446,15 +451,6 @@ var readCodexVersion = (probe) => {
446
451
  return bundled ? parseCodexVersion(bundled) : null;
447
452
  };
448
453
 
449
- // src/setup/codex-trust.ts
450
- var CODEX_TRUST_VERIFIED_MAX = [0, 155, 1];
451
- var planCodexTrust = (installed, hashingProvenOnThisMachine) => hashingProvenOnThisMachine || compareCodexVersion(installed, CODEX_TRUST_VERIFIED_MAX) <= 0 ? { kind: "pretrust" } : { kind: "manual", installed, verifiedMax: CODEX_TRUST_VERIFIED_MAX };
452
- var codexTrustOutcome = (pretrusted) => pretrusted ? "pretrusted" : "manual";
453
- var describeUnverifiedCodexTrust = (plan, surface) => {
454
- const where = surface === "chatgpt" ? "Open ChatGPT, then Settings and Hooks," : "Open Codex";
455
- return `Codex ${formatVersion(plan.installed)} is newer than the last version Pushary verified (${formatVersion(plan.verifiedMax)}), so its hooks are not trusted yet. ${where} and choose Trust for the Pushary hooks.`;
456
- };
457
-
458
454
  // src/setup/codex-install.ts
459
455
  var NATIVE_BINARY_MIN_BYTES = 20 * 1024 * 1024;
460
456
  var packageRootFor = (probe, binPath) => {
@@ -1036,6 +1032,13 @@ var addCodexNotifyEntry = (codexConfig) => {
1036
1032
  writeFileSync(codexConfig, stringifyTOML(config), "utf-8");
1037
1033
  }
1038
1034
  };
1035
+ var confirmCodexTrust = async () => {
1036
+ let confirmation = { kind: "unavailable", reason: "setup could not ask Codex" };
1037
+ await spinner("Checking the Pushary hook's trust with Codex", async () => {
1038
+ confirmation = await ensureCodexTrustsPusharyHooks();
1039
+ }, { optional: true });
1040
+ return confirmation;
1041
+ };
1039
1042
  var setupCodex = async (apiKey) => {
1040
1043
  console.log(`
1041
1044
  ${bold("Setting up Codex")}
@@ -1071,12 +1074,7 @@ var setupCodex = async (apiKey) => {
1071
1074
  });
1072
1075
  const codexVersion = detectCodexVersion();
1073
1076
  const hooksSupported = codexSupportsHooks(codexVersion);
1074
- const trustPlan = hooksSupported && codexVersion !== null ? planCodexTrust(
1075
- codexVersion,
1076
- codexTrustSchemeAgrees(readAgentJson(CODEX_HOOKS_JSON), readAgentToml(codexConfig), CODEX_HOOKS_JSON)
1077
- ) : null;
1078
- const trustAuto = trustPlan?.kind === "pretrust";
1079
- let trusted = false;
1077
+ let portedTrustWritten = false;
1080
1078
  if (hooksSupported) {
1081
1079
  const hookCommand = guardBinary(resolveGlobalBinary("pushary-codex-hook") ?? "pushary-codex-hook");
1082
1080
  let hookPositions = {};
@@ -1088,24 +1086,21 @@ var setupCodex = async (apiKey) => {
1088
1086
  writeJson(CODEX_HOOKS_JSON, hooksConfig);
1089
1087
  hookPositions = codexHookPositions(hooksConfig);
1090
1088
  });
1091
- if (trustAuto) {
1092
- await spinner("Trusting the Pushary hook (skips the /hooks step)", async () => {
1093
- let raw = "";
1094
- try {
1095
- raw = readFileSync(codexConfig, "utf-8");
1096
- } catch {
1097
- }
1098
- const config = raw ? parseTOML(raw) : {};
1099
- dropVacatedCodexHookTrust(config, CODEX_HOOKS_JSON, vacated);
1100
- addCodexHookTrust(config, CODEX_HOOKS_JSON, hookCommand, hookPositions);
1101
- writeFileSync(codexConfig, stringifyTOML(config), "utf-8");
1102
- trusted = true;
1103
- }, { optional: true });
1104
- }
1089
+ await spinner("Writing trust entries for the Pushary hook", async () => {
1090
+ let raw = "";
1091
+ try {
1092
+ raw = readFileSync(codexConfig, "utf-8");
1093
+ } catch {
1094
+ }
1095
+ const config = raw ? parseTOML(raw) : {};
1096
+ dropVacatedCodexHookTrust(config, CODEX_HOOKS_JSON, vacated);
1097
+ addCodexHookTrust(config, CODEX_HOOKS_JSON, hookCommand, hookPositions);
1098
+ writeFileSync(codexConfig, stringifyTOML(config), "utf-8");
1099
+ portedTrustWritten = true;
1100
+ }, { optional: true });
1105
1101
  await spinner("Removing legacy notify handler", async () => {
1106
1102
  removeCodexNotifyEntry(codexConfig);
1107
1103
  });
1108
- recordCodexTrust(codexTrustOutcome(trusted));
1109
1104
  } else {
1110
1105
  if (codexVersion !== null) {
1111
1106
  console.log(` ${yellow("!")} This Codex version predates native hooks (needs ${CODEX_HOOKS_MIN_VERSION.join(".")}+).`);
@@ -1125,6 +1120,9 @@ var setupCodex = async (apiKey) => {
1125
1120
  await spinner("Teaching Codex to ask via push (~/.codex/AGENTS.md)", async () => {
1126
1121
  writeInstructionBlock(CODEX_AGENTS_MD, renderAgentInstructions("Codex"));
1127
1122
  });
1123
+ const confirmation = hooksSupported ? await confirmCodexTrust() : null;
1124
+ const trustOutcome = confirmation === null ? null : codexTrustOutcome(confirmation, portedTrustWritten);
1125
+ if (trustOutcome !== null) recordCodexTrust(trustOutcome);
1128
1126
  console.log();
1129
1127
  console.log(` ${dim("What this configured:")}`);
1130
1128
  console.log(` ${dim("\u2022")} MCP server: Codex can send notifications and ask questions`);
@@ -1133,11 +1131,14 @@ var setupCodex = async (apiKey) => {
1133
1131
  console.log(` ${dim("\u2022")} Auto-allowed tools: no permission prompts for Pushary MCP calls`);
1134
1132
  if (hooksSupported) {
1135
1133
  console.log(` ${dim("\u2022")} Native hooks: phone approvals, policy enforcement, kill switch, session tracking`);
1136
- if (trusted) {
1134
+ if (trustOutcome === "verified") {
1135
+ console.log(` ${dim("\u2022")} Hook trusted, and Codex confirmed it: no ${cyan("/hooks")} step`);
1136
+ } else if (trustOutcome === "unverified" && confirmation) {
1137
1137
  console.log(` ${dim("\u2022")} Hook pre-trusted: no ${cyan("/hooks")} step. If approvals never arrive, ${cyan("/hooks")} re-trusts it`);
1138
+ console.log(` ${dim(describeCodexTrustConfirmation(confirmation))}`);
1138
1139
  } else {
1139
- if (trustPlan?.kind === "manual") {
1140
- console.log(` ${yellow("!")} ${describeUnverifiedCodexTrust(trustPlan, bundled ? "chatgpt" : "codex")}`);
1140
+ if (confirmation) {
1141
+ console.log(` ${yellow("!")} ${describeCodexTrustConfirmation(confirmation)}`);
1141
1142
  }
1142
1143
  console.log();
1143
1144
  console.log(` ${bold("One step left, and it happens inside Codex")}`);
@@ -2,12 +2,12 @@
2
2
  import {
3
3
  describeLastSeen,
4
4
  listMachines
5
- } from "../chunk-F57RGL7K.js";
6
- import "../chunk-KEOLNHR3.js";
7
- import "../chunk-7XT76LWT.js";
5
+ } from "../chunk-IV3RHICU.js";
6
+ import "../chunk-5ZZG76S2.js";
7
+ import "../chunk-X7FESZTD.js";
8
8
  import "../chunk-XHKBHWLX.js";
9
- import "../chunk-UQHUUZ5H.js";
10
- import "../chunk-DYHXOXUF.js";
9
+ import "../chunk-WOLPADR6.js";
10
+ import "../chunk-6IU45EHE.js";
11
11
  import {
12
12
  describeReach,
13
13
  fetchChannels,
@@ -2,20 +2,20 @@
2
2
  import {
3
3
  activeHookSource,
4
4
  activeIdentity
5
- } from "../chunk-JF736N4C.js";
6
- import "../chunk-J4J45VPZ.js";
5
+ } from "../chunk-R5KY3PBN.js";
6
+ import "../chunk-4ERLRNOK.js";
7
7
  import {
8
8
  readHookInput
9
- } from "../chunk-ORLJNJEO.js";
10
- import "../chunk-NFKVRMTM.js";
9
+ } from "../chunk-6QFEQIPM.js";
10
+ import "../chunk-TZGCUNOX.js";
11
11
  import "../chunk-SGZJ5LYH.js";
12
- import "../chunk-PCGZXWGQ.js";
12
+ import "../chunk-WNJSGZY7.js";
13
13
  import "../chunk-TFKBFQCE.js";
14
14
  import "../chunk-K3QVDAZW.js";
15
- import "../chunk-NTQSICPJ.js";
16
- import "../chunk-7XT76LWT.js";
17
- import "../chunk-EADZPVYW.js";
18
- import "../chunk-SOCEY746.js";
15
+ import "../chunk-Z4VGIBJ7.js";
16
+ import "../chunk-X7FESZTD.js";
17
+ import "../chunk-2AUIEZYS.js";
18
+ import "../chunk-5UQ5ATIE.js";
19
19
  import "../chunk-TIWURSLS.js";
20
20
  import "../chunk-66H2QQAK.js";
21
21
  import "../chunk-2QT3GCU4.js";
@@ -24,11 +24,11 @@ import {
24
24
  handleStop,
25
25
  handleSubagentStop,
26
26
  isSubagentStop
27
- } from "../chunk-FDHMNT24.js";
27
+ } from "../chunk-D573TLP6.js";
28
28
  import "../chunk-UYDTFCHW.js";
29
29
  import "../chunk-PYCQXCI5.js";
30
- import "../chunk-UQHUUZ5H.js";
31
- import "../chunk-DYHXOXUF.js";
30
+ import "../chunk-WOLPADR6.js";
31
+ import "../chunk-6IU45EHE.js";
32
32
  import "../chunk-GMXKITVA.js";
33
33
  import "../chunk-USQDVBEV.js";
34
34
  import "../chunk-HETOKNIL.js";
@@ -2,31 +2,31 @@
2
2
  import {
3
3
  activeHookSource,
4
4
  activeIdentity
5
- } from "../chunk-JF736N4C.js";
6
- import "../chunk-J4J45VPZ.js";
5
+ } from "../chunk-R5KY3PBN.js";
6
+ import "../chunk-4ERLRNOK.js";
7
7
  import {
8
8
  readHookInput
9
- } from "../chunk-ORLJNJEO.js";
10
- import "../chunk-NFKVRMTM.js";
9
+ } from "../chunk-6QFEQIPM.js";
10
+ import "../chunk-TZGCUNOX.js";
11
11
  import "../chunk-SGZJ5LYH.js";
12
- import "../chunk-PCGZXWGQ.js";
12
+ import "../chunk-WNJSGZY7.js";
13
13
  import "../chunk-TFKBFQCE.js";
14
14
  import "../chunk-K3QVDAZW.js";
15
- import "../chunk-NTQSICPJ.js";
16
- import "../chunk-7XT76LWT.js";
17
- import "../chunk-EADZPVYW.js";
18
- import "../chunk-SOCEY746.js";
15
+ import "../chunk-Z4VGIBJ7.js";
16
+ import "../chunk-X7FESZTD.js";
17
+ import "../chunk-2AUIEZYS.js";
18
+ import "../chunk-5UQ5ATIE.js";
19
19
  import "../chunk-TIWURSLS.js";
20
20
  import "../chunk-66H2QQAK.js";
21
21
  import "../chunk-2QT3GCU4.js";
22
22
  import "../chunk-XHKBHWLX.js";
23
23
  import {
24
24
  handleStopFailure
25
- } from "../chunk-FDHMNT24.js";
25
+ } from "../chunk-D573TLP6.js";
26
26
  import "../chunk-UYDTFCHW.js";
27
27
  import "../chunk-PYCQXCI5.js";
28
- import "../chunk-UQHUUZ5H.js";
29
- import "../chunk-DYHXOXUF.js";
28
+ import "../chunk-WOLPADR6.js";
29
+ import "../chunk-6IU45EHE.js";
30
30
  import "../chunk-GMXKITVA.js";
31
31
  import "../chunk-USQDVBEV.js";
32
32
  import "../chunk-HETOKNIL.js";
@@ -1,22 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  registerTranscript
4
- } from "../chunk-NFKVRMTM.js";
4
+ } from "../chunk-TZGCUNOX.js";
5
5
  import "../chunk-SGZJ5LYH.js";
6
- import "../chunk-PCGZXWGQ.js";
6
+ import "../chunk-WNJSGZY7.js";
7
7
  import "../chunk-TFKBFQCE.js";
8
8
  import "../chunk-K3QVDAZW.js";
9
- import "../chunk-NTQSICPJ.js";
10
- import "../chunk-7XT76LWT.js";
11
- import "../chunk-EADZPVYW.js";
12
- import "../chunk-SOCEY746.js";
9
+ import "../chunk-Z4VGIBJ7.js";
10
+ import "../chunk-X7FESZTD.js";
11
+ import "../chunk-2AUIEZYS.js";
12
+ import "../chunk-5UQ5ATIE.js";
13
13
  import "../chunk-TIWURSLS.js";
14
14
  import "../chunk-66H2QQAK.js";
15
15
  import "../chunk-2QT3GCU4.js";
16
16
  import "../chunk-XHKBHWLX.js";
17
17
  import "../chunk-UYDTFCHW.js";
18
- import "../chunk-UQHUUZ5H.js";
19
- import "../chunk-DYHXOXUF.js";
18
+ import "../chunk-WOLPADR6.js";
19
+ import "../chunk-6IU45EHE.js";
20
20
  import "../chunk-GMXKITVA.js";
21
21
  import "../chunk-USQDVBEV.js";
22
22
  import "../chunk-7QLSKOSU.js";
@@ -1,27 +1,34 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
+ describeCodexTrustConfirmation
4
+ } from "../chunk-BY2CRWBO.js";
5
+ import {
6
+ ensureCodexTrustAfterReapply,
3
7
  reapplyAllAgents
4
- } from "../chunk-PNNBMH4E.js";
5
- import "../chunk-3NBODGQS.js";
8
+ } from "../chunk-JKBDGZFL.js";
9
+ import "../chunk-HUAOMX4U.js";
10
+ import "../chunk-6EEANS74.js";
6
11
  import {
7
12
  waitForMachineReadiness
8
- } from "../chunk-F57RGL7K.js";
9
- import "../chunk-J4J45VPZ.js";
13
+ } from "../chunk-IV3RHICU.js";
14
+ import "../chunk-4ERLRNOK.js";
10
15
  import {
11
16
  detectProviderLiveCapabilities,
12
17
  hasSpawnProvider,
13
18
  resolveControlPolicy
14
- } from "../chunk-KEOLNHR3.js";
19
+ } from "../chunk-5ZZG76S2.js";
15
20
  import {
16
21
  AUTO_UPDATE_DISABLE_ENV,
17
22
  describeAutoUpdateCheck,
18
23
  globalInstallPrefix,
24
+ hasPendingUpgradeFinish,
19
25
  isAutoUpdateDisabledByEnv,
20
26
  parseAutoUpdateFlag,
27
+ readAutoUpdateState,
21
28
  updateAutoUpdateState,
22
29
  upgradeEntryFor
23
- } from "../chunk-OSSDK5RS.js";
24
- import "../chunk-NTQSICPJ.js";
30
+ } from "../chunk-MU3WU2FO.js";
31
+ import "../chunk-Z4VGIBJ7.js";
25
32
  import {
26
33
  daemonHasRemoteProof,
27
34
  daemonServiceManagerAvailable,
@@ -32,13 +39,13 @@ import {
32
39
  replaceDaemonService,
33
40
  stopDaemonService,
34
41
  waitForDaemonRemoteProof
35
- } from "../chunk-7XT76LWT.js";
36
- import "../chunk-EADZPVYW.js";
42
+ } from "../chunk-X7FESZTD.js";
43
+ import "../chunk-2AUIEZYS.js";
37
44
  import {
38
45
  needsShell
39
46
  } from "../chunk-XHKBHWLX.js";
40
47
  import "../chunk-UYDTFCHW.js";
41
- import "../chunk-UQHUUZ5H.js";
48
+ import "../chunk-WOLPADR6.js";
42
49
  import {
43
50
  LATEST_TAG,
44
51
  autoUpdateLock,
@@ -54,7 +61,7 @@ import {
54
61
  npmErrorMessage,
55
62
  resolveGlobalBinary,
56
63
  vscodePluginDir
57
- } from "../chunk-DYHXOXUF.js";
64
+ } from "../chunk-6IU45EHE.js";
58
65
  import {
59
66
  exitOnHelpFlag
60
67
  } from "../chunk-P4BNYJ5Q.js";
@@ -172,11 +179,23 @@ var finishInNewInstall = (request) => {
172
179
  };
173
180
  var incompleteFinishDetail = (logPath) => `installed, but refreshing the agent configs did not finish cleanly; see ${logPath}`;
174
181
  var newMajorDetail = (latest) => `${latest} is a new major version; run ${MANUAL_UPGRADE_COMMAND}`;
182
+ var finishInstalledUpgrade = (context, from, to) => {
183
+ const pending = { result: "finish_pending", from, to, detail: incompleteFinishDetail(context.logPath) };
184
+ recordAutoUpdateCheck(context.statePath, pending, new Date(context.now()).toISOString());
185
+ try {
186
+ context.finish({ entry: upgradeEntryFor(context.prefix), prefix: context.prefix, logPath: context.logPath });
187
+ return { result: "updated", from, to };
188
+ } catch {
189
+ return pending;
190
+ }
191
+ };
175
192
  var checkAndInstall = async (context) => {
176
193
  const installed = packageVersionAt(context.packageRoot);
177
194
  if (installed === void 0 || !isReleaseVersion(installed)) {
178
195
  return { result: "failed", from: installed, detail: UNREADABLE_INSTALLED_VERSION };
179
196
  }
197
+ const previous = readAutoUpdateState(context.statePath);
198
+ if (hasPendingUpgradeFinish(previous, installed)) return finishInstalledUpgrade(context, previous.from, installed);
180
199
  const latest = await fetchLatestPublishedVersion({ fetchImpl: context.fetchImpl });
181
200
  if (latest === void 0) return { result: "failed", from: installed, detail: UNREACHABLE_REGISTRY };
182
201
  if (!isNewerVersion(latest, installed)) return { result: "current", from: installed };
@@ -189,12 +208,7 @@ var checkAndInstall = async (context) => {
189
208
  } catch (error) {
190
209
  return { result: "failed", from: installed, to: latest, detail: npmErrorMessage(error) };
191
210
  }
192
- try {
193
- context.finish({ entry: upgradeEntryFor(context.prefix), prefix: context.prefix, logPath: context.logPath });
194
- } catch {
195
- return { result: "updated", from: installed, to: latest, detail: incompleteFinishDetail(context.logPath) };
196
- }
197
- return { result: "updated", from: installed, to: latest };
211
+ return finishInstalledUpgrade(context, installed, latest);
198
212
  };
199
213
  var recordAutoUpdateCheck = (statePath, check, at) => updateAutoUpdateState(statePath, {
200
214
  lastCheckAt: at,
@@ -206,6 +220,7 @@ var recordAutoUpdateCheck = (statePath, check, at) => updateAutoUpdateState(stat
206
220
  announced: check.result === "updated" ? false : void 0
207
221
  });
208
222
  var runAutoUpdate = async (run = {}) => {
223
+ if ((run.platform ?? process.platform) === "linux") return { kind: "linux" };
209
224
  const packageRoot = run.packageRoot ?? ownPackageRoot();
210
225
  const prefix = packageRoot === void 0 ? null : globalInstallPrefix(packageRoot);
211
226
  if (packageRoot === void 0 || prefix === null) return { kind: "not_global_install" };
@@ -216,6 +231,7 @@ var runAutoUpdate = async (run = {}) => {
216
231
  try {
217
232
  const check = await checkAndInstall({
218
233
  packageRoot,
234
+ statePath: run.statePath ?? autoUpdateState(),
219
235
  prefix,
220
236
  logPath,
221
237
  now,
@@ -284,6 +300,7 @@ var finishUpgrade = async () => {
284
300
  apiKey = void 0;
285
301
  }
286
302
  const inspectedAgents = reapplyAllAgents(apiKey);
303
+ const codexTrust = await ensureCodexTrustAfterReapply(inspectedAgents);
287
304
  const refreshed = inspectedAgents.filter((agent) => agent.result.reapplied);
288
305
  const configuredControlProviders = inspectedAgents.filter((agent) => agent.result.configured && (agent.id === "claude" || agent.id === "codex" || agent.id === "gemini")).map((agent) => agent.id);
289
306
  const controlMode = readControlMode();
@@ -332,6 +349,10 @@ var finishUpgrade = async () => {
332
349
  } else {
333
350
  console.log("No agent config on this machine needed refreshing.");
334
351
  }
352
+ if (codexTrust) {
353
+ console.log();
354
+ console.log(describeCodexTrustConfirmation(codexTrust));
355
+ }
335
356
  console.log();
336
357
  if (!daemonReady) {
337
358
  console.error(controlPolicy === "disabled" ? "Upgrade installed, but the disabled background service could not be fully removed. Re-run setup with --control off." : controlPolicy === "legacy" ? legacyStopFailure ? `Upgrade installed, but the legacy background service could not be stopped: ${legacyStopFailure}. Run setup with --control off.` : "Upgrade installed and the legacy background service was stopped, but it cannot be safely adopted. Run setup with --control off, or restore its provider and native service manager." : controlPolicy === "enabled" && !apiKey ? "Upgrade installed, but phone-start could not be reconciled because no API key was readable. Re-run setup." : "Upgrade installed, but the background service did not start. Run: pushary daemon install");
@@ -344,6 +365,7 @@ var finishUpgrade = async () => {
344
365
  var AUTO_UPDATE_ON_MESSAGE = "Automatic updates are on. Pushary checks for a new version once a day, when an agent session starts.";
345
366
  var AUTO_UPDATE_OFF_MESSAGE = "Automatic updates are off. Turn them back on with: pushary upgrade --auto=on";
346
367
  var AUTO_UPDATE_RUN_MESSAGES = {
368
+ linux: `Automatic updates are paused on Linux to protect running sessions. When your sessions have finished, run: ${NPX_LATEST_COMMAND} upgrade`,
347
369
  not_global_install: `This copy of Pushary is not a global npm install, so it does not update itself. Run: ${NPX_LATEST_COMMAND} upgrade`,
348
370
  locked: "Another automatic update is already running."
349
371
  };
@@ -361,7 +383,18 @@ var runAutomaticUpdate = async () => {
361
383
  return;
362
384
  }
363
385
  console.log(`Automatic update: ${describeAutoUpdateCheck(outcome.state)}`);
364
- if (outcome.state.lastResult === "failed") process.exitCode = 1;
386
+ if (outcome.state.lastResult === "failed" || outcome.state.lastResult === "finish_pending") process.exitCode = 1;
387
+ };
388
+ var finishGlobalUpgrade = () => {
389
+ const upgradedBinary = resolveGlobalBinary("pushary-upgrade");
390
+ if (!upgradedBinary) {
391
+ console.error("Upgrade installed, but the new pushary-upgrade binary could not be found on PATH.");
392
+ process.exit(1);
393
+ }
394
+ execFileSync2(upgradedBinary, [FINISH_UPGRADE_FLAG], {
395
+ stdio: "inherit",
396
+ shell: needsShell(upgradedBinary)
397
+ });
365
398
  };
366
399
  var main = async () => {
367
400
  if (process.argv.includes(FINISH_UPGRADE_FLAG)) {
@@ -400,6 +433,11 @@ var main = async () => {
400
433
  console.log("Check the result with: pushary doctor");
401
434
  return;
402
435
  }
436
+ const pending = readAutoUpdateState(autoUpdateState());
437
+ if (hasPendingUpgradeFinish(pending, installed)) {
438
+ finishGlobalUpgrade();
439
+ updateAutoUpdateState(autoUpdateState(), { lastResult: "updated", detail: void 0, announced: false });
440
+ }
403
441
  const latest = await fetchLatestPublishedVersion();
404
442
  if (latest && !isNewerVersion(latest, installed)) {
405
443
  console.log(`Already on the latest version (${installed}).`);
@@ -412,14 +450,6 @@ var main = async () => {
412
450
  console.error(`Upgrade failed: ${npmErrorMessage(err)}`);
413
451
  process.exit(1);
414
452
  }
415
- const upgradedBinary = resolveGlobalBinary("pushary-upgrade");
416
- if (!upgradedBinary) {
417
- console.error("Upgrade installed, but the new pushary-upgrade binary could not be found on PATH.");
418
- process.exit(1);
419
- }
420
- execFileSync2(upgradedBinary, [FINISH_UPGRADE_FLAG], {
421
- stdio: "inherit",
422
- shell: needsShell(upgradedBinary)
423
- });
453
+ finishGlobalUpgrade();
424
454
  };
425
455
  main();
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  isProtectedByScope,
7
7
  registerHookEntry
8
- } from "./chunk-DYHXOXUF.js";
8
+ } from "./chunk-6IU45EHE.js";
9
9
  import {
10
10
  CLAUDE_PRETOOLUSE_MATCHER,
11
11
  HOOK_BUDGETS,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  CLAUDE_HOOK_EVENTS,
3
3
  supportedClaudeEvents
4
- } from "./chunk-EADZPVYW.js";
4
+ } from "./chunk-2AUIEZYS.js";
5
5
  import {
6
6
  guardBinary,
7
7
  holdBudgetOf,
8
8
  isProtectedByScope,
9
9
  registerHookEntry
10
- } from "./chunk-DYHXOXUF.js";
10
+ } from "./chunk-6IU45EHE.js";
11
11
  import {
12
12
  HOOK_LOCATOR_BINARY,
13
13
  withHookHoldBudget
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  guardBinary
3
- } from "./chunk-DYHXOXUF.js";
3
+ } from "./chunk-6IU45EHE.js";
4
4
 
5
5
  // src/bell/install.ts
6
6
  import { join } from "path";
@@ -2,7 +2,7 @@ import {
2
2
  resolveBinary,
3
3
  resolveGlobalPackageVersion,
4
4
  resolvePackageVersionFromBinary
5
- } from "./chunk-DYHXOXUF.js";
5
+ } from "./chunk-6IU45EHE.js";
6
6
  import {
7
7
  MANAGED_PROVIDERS
8
8
  } from "./chunk-T4QY64OR.js";