pushary 1.9.63 → 1.9.65

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 (129) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/README.md +1 -1
  3. package/dist/{api-UHUUAONF.js → api-32B3XLJR.js} +10 -11
  4. package/dist/bin/pushary-bell-hook.js +27 -30
  5. package/dist/bin/pushary-bell.js +12 -13
  6. package/dist/bin/pushary-claude.js +28 -31
  7. package/dist/bin/pushary-clean.js +68 -43
  8. package/dist/bin/pushary-codex-bridge.js +22 -24
  9. package/dist/bin/pushary-codex-hook.js +34 -37
  10. package/dist/bin/pushary-codex-session.js +8 -8
  11. package/dist/bin/pushary-codex.js +13 -15
  12. package/dist/bin/pushary-connect.js +26 -29
  13. package/dist/bin/pushary-cowork.js +5 -5
  14. package/dist/bin/pushary-daemon.js +39 -42
  15. package/dist/bin/pushary-disconnect.js +62 -43
  16. package/dist/bin/pushary-doctor.js +109 -44
  17. package/dist/bin/pushary-elicitation-hook.js +27 -30
  18. package/dist/bin/pushary-gemini-bridge.js +16 -18
  19. package/dist/bin/pushary-gemini-hook.js +29 -32
  20. package/dist/bin/pushary-hook.js +31 -34
  21. package/dist/bin/pushary-login.js +19 -20
  22. package/dist/bin/pushary-logout.js +26 -29
  23. package/dist/bin/pushary-mcp.js +11 -12
  24. package/dist/bin/pushary-mode.js +14 -15
  25. package/dist/bin/pushary-notification-hook.js +26 -29
  26. package/dist/bin/pushary-opencode-hook.js +28 -31
  27. package/dist/bin/pushary-permission-denied-hook.js +31 -34
  28. package/dist/bin/pushary-permission-hook.js +30 -33
  29. package/dist/bin/pushary-post-hook.js +26 -29
  30. package/dist/bin/pushary-prompt-hook.js +26 -29
  31. package/dist/bin/pushary-session-end-hook.js +28 -31
  32. package/dist/bin/pushary-session-start-hook.js +35 -38
  33. package/dist/bin/pushary-setup.js +129 -74
  34. package/dist/bin/pushary-stats.js +5 -5
  35. package/dist/bin/pushary-status.js +31 -34
  36. package/dist/bin/pushary-stop-hook.js +26 -29
  37. package/dist/bin/pushary-stopfailure-hook.js +26 -29
  38. package/dist/bin/pushary-suggestions.js +14 -15
  39. package/dist/bin/pushary-transcript-register.js +18 -21
  40. package/dist/bin/pushary-transcripts.js +17 -18
  41. package/dist/bin/pushary-upgrade.js +40 -44
  42. package/dist/bin/pushary-wait.js +14 -15
  43. package/dist/bin/pushary.js +7 -8
  44. package/dist/{chunk-V5W3CK7F.js → chunk-2VADJ6JH.js} +2 -2
  45. package/dist/{chunk-3GVV7XVT.js → chunk-2Z7I7DHT.js} +1 -1
  46. package/dist/{chunk-7GRQGXF4.js → chunk-3KXBRSL3.js} +1 -1
  47. package/dist/{chunk-P6RF4RQN.js → chunk-3LF7T3NW.js} +6 -6
  48. package/dist/{chunk-PXAOEFJZ.js → chunk-3UNAPXED.js} +14 -16
  49. package/dist/{chunk-TMGJAFSD.js → chunk-4LUWNBGD.js} +3 -3
  50. package/dist/{chunk-CLABCSZC.js → chunk-6CZX6YOE.js} +5 -5
  51. package/dist/{chunk-VFJSVPNL.js → chunk-7ILQX47W.js} +3 -3
  52. package/dist/{chunk-4WFAP6QN.js → chunk-ADXHPGBZ.js} +9 -11
  53. package/dist/{chunk-75ODMNOM.js → chunk-AN7C3CHH.js} +1 -1
  54. package/dist/{chunk-BQFL2ECS.js → chunk-ANP3DIST.js} +3 -57
  55. package/dist/chunk-ATPJGHUP.js +1201 -0
  56. package/dist/{chunk-6Z2VR3BA.js → chunk-BAGBCSXA.js} +1 -1
  57. package/dist/{chunk-WUOOZE5S.js → chunk-BEQ3MEE3.js} +2 -2
  58. package/dist/{chunk-ELAK46NR.js → chunk-BKCI53W6.js} +4 -4
  59. package/dist/{chunk-HAIXS4OX.js → chunk-CSKABVSH.js} +3 -3
  60. package/dist/{chunk-GNUARBRZ.js → chunk-CU2PXLZ6.js} +4 -4
  61. package/dist/{chunk-FVERRWDP.js → chunk-CZ65D6Q5.js} +2 -2
  62. package/dist/{chunk-PJ34FOIV.js → chunk-DM24VZOI.js} +5 -5
  63. package/dist/{chunk-TBKHQWIH.js → chunk-DTVHZDYM.js} +5 -5
  64. package/dist/{chunk-PIQ4HHA2.js → chunk-DXMUJTYF.js} +4 -6
  65. package/dist/{chunk-IOH2T3CB.js → chunk-ED2SWTPC.js} +4 -4
  66. package/dist/{chunk-FAF5AW3P.js → chunk-EEVE7H5Z.js} +4 -4
  67. package/dist/{chunk-EHHTQURL.js → chunk-F56GTJFG.js} +5 -5
  68. package/dist/{chunk-GZS72NCF.js → chunk-FFSIYBBU.js} +4 -4
  69. package/dist/{chunk-L5CDGXPO.js → chunk-FWS2KLV2.js} +4 -4
  70. package/dist/{chunk-T3GHXR6N.js → chunk-GA257T2E.js} +5 -5
  71. package/dist/{chunk-SKUSGWFK.js → chunk-GTBWWCCM.js} +6 -6
  72. package/dist/{chunk-YK6GR4GU.js → chunk-HDGB6SQ4.js} +2 -2
  73. package/dist/{chunk-OY6Z4IKB.js → chunk-HIYLAC3C.js} +3 -3
  74. package/dist/{chunk-RAJ3QEIL.js → chunk-HVOQUPSO.js} +1 -1
  75. package/dist/{chunk-KUCL7ETL.js → chunk-I2UBF2SS.js} +1 -1
  76. package/dist/{chunk-VHZAJ6IB.js → chunk-ICFHMJTW.js} +3 -3
  77. package/dist/{chunk-HZ72EMJE.js → chunk-ITYKN2K3.js} +2 -2
  78. package/dist/{chunk-XBTWG2VL.js → chunk-IZVEBBDH.js} +5 -5
  79. package/dist/{chunk-VN7XH6TU.js → chunk-JCWHOB36.js} +2 -2
  80. package/dist/{chunk-5JK3DQGZ.js → chunk-JFKMPLNF.js} +2 -2
  81. package/dist/{chunk-FEAGK25K.js → chunk-LMC5UPL7.js} +1 -1
  82. package/dist/{chunk-7NCLUA65.js → chunk-MNKIR2ZB.js} +11 -0
  83. package/dist/{chunk-SARPHHTT.js → chunk-NOH3EJFH.js} +1 -1
  84. package/dist/{chunk-OP5IBEV7.js → chunk-NUEPJ5W6.js} +2 -2
  85. package/dist/{chunk-OU3BYBJ3.js → chunk-OA6EADFT.js} +3 -3
  86. package/dist/{chunk-LGZ545TA.js → chunk-ONBL2GCU.js} +12 -6
  87. package/dist/{chunk-LTT54NOU.js → chunk-P5HZEGT7.js} +65 -8
  88. package/dist/{chunk-YMZOM6BD.js → chunk-PP7FC3Y7.js} +10 -10
  89. package/dist/{chunk-T6XQNOZV.js → chunk-Q2BD4IBX.js} +12 -12
  90. package/dist/{chunk-DMNLFWGY.js → chunk-QNZ6G3LY.js} +210 -151
  91. package/dist/{chunk-BCVCUDFI.js → chunk-QSW3HAKI.js} +1 -1
  92. package/dist/{chunk-HOIO66DU.js → chunk-R4FL5JHK.js} +4 -4
  93. package/dist/{chunk-VUFHYMSP.js → chunk-RABLE5R6.js} +1 -1
  94. package/dist/{chunk-2MZ6ROWZ.js → chunk-RRHHWYPX.js} +6 -6
  95. package/dist/{chunk-5LOP4AVD.js → chunk-SCMEVDAR.js} +128 -26
  96. package/dist/{chunk-XE5N352V.js → chunk-SROWUG5W.js} +1 -1
  97. package/dist/{chunk-QW3FRUFB.js → chunk-SZBMTOUZ.js} +1 -1
  98. package/dist/{chunk-V7N5NOZV.js → chunk-TJUJAK5L.js} +1 -1
  99. package/dist/{chunk-OJEIS5L2.js → chunk-TK4JU2F7.js} +1 -1
  100. package/dist/{chunk-VDBXSUXP.js → chunk-U2P2LQ5B.js} +7 -7
  101. package/dist/{chunk-AB3VAQ25.js → chunk-UHS5MMAI.js} +3 -3
  102. package/dist/{chunk-OW6VBXXI.js → chunk-UM2X7HL6.js} +63 -36
  103. package/dist/{chunk-KL76XWZ7.js → chunk-UMTMFDL2.js} +1 -1
  104. package/dist/{chunk-MRCVYYPW.js → chunk-VHKK3US3.js} +3 -3
  105. package/dist/{chunk-S2Z6VWHH.js → chunk-W5L2ZLHE.js} +6 -7
  106. package/dist/{chunk-EQ26IKZM.js → chunk-WOHP7EL6.js} +7 -6
  107. package/dist/{chunk-3QLFB2EY.js → chunk-WY6YAMZW.js} +37 -214
  108. package/dist/{chunk-XO3KAH7K.js → chunk-XJIIU36L.js} +1 -1
  109. package/dist/{chunk-QC2W42DE.js → chunk-XZCJC3QO.js} +12 -12
  110. package/dist/{chunk-BUQU3OPX.js → chunk-Y64JGYTB.js} +1 -1
  111. package/dist/{chunk-KLZZI5TU.js → chunk-Z3M627TQ.js} +1 -1
  112. package/dist/{codex-app-cards-switch-LXMAIOFB.js → codex-app-cards-switch-HK4RMOBI.js} +11 -12
  113. package/dist/{codex-desktop-launch-VE5RLFUU.js → codex-desktop-launch-OCO6N7SA.js} +1 -1
  114. package/dist/{codex-session-launch-XZZWXCPK.js → codex-session-launch-ETZQTVFS.js} +19 -21
  115. package/dist/{config-PPX25AV5.js → config-YY54G3CC.js} +3 -3
  116. package/dist/{global-upgrade-NRMHNLNU.js → global-upgrade-5DN5G3ZQ.js} +10 -12
  117. package/dist/{identity-ZFQR7JNW.js → identity-EGL6HAWG.js} +4 -5
  118. package/dist/{live-capabilities-SJRYRKNB.js → live-capabilities-WU3FYJJG.js} +5 -7
  119. package/dist/{paths-7VTVOQXJ.js → paths-ZG6KDM6Y.js} +7 -3
  120. package/dist/reapply-AQLNCCTE.js +63 -0
  121. package/dist/src/index.js +20 -23
  122. package/dist/{upgrade-lock-VAYJZVTB.js → upgrade-lock-BIRXIKHJ.js} +4 -5
  123. package/dist/{usage-C4DIYUR6.js → usage-43C2DHDU.js} +3 -3
  124. package/package.json +1 -1
  125. package/dist/chunk-6ICPEJY5.js +0 -20
  126. package/dist/chunk-MK4USZYQ.js +0 -615
  127. package/dist/chunk-QENTGE75.js +0 -86
  128. package/dist/chunk-VC3HFFMQ.js +0 -41
  129. package/dist/reapply-WOANOIRZ.js +0 -64
@@ -3,10 +3,10 @@ import {
3
3
  forkFinishWithUpgradeLock,
4
4
  installWithUpgradeLock,
5
5
  releaseAutoUpdateLock
6
- } from "./chunk-PIQ4HHA2.js";
6
+ } from "./chunk-DXMUJTYF.js";
7
7
  import {
8
8
  phoneStartIsRequired
9
- } from "./chunk-HOIO66DU.js";
9
+ } from "./chunk-R4FL5JHK.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-PJ34FOIV.js";
21
+ } from "./chunk-DM24VZOI.js";
22
22
  import {
23
23
  EXIT
24
24
  } from "./chunk-KZERVKTD.js";
@@ -26,17 +26,17 @@ import {
26
26
  autoUpdateLock,
27
27
  autoUpdateLog,
28
28
  autoUpdateState
29
- } from "./chunk-MK4USZYQ.js";
29
+ } from "./chunk-ATPJGHUP.js";
30
30
  import {
31
31
  execNpm,
32
32
  fetchLatestPublishedVersion,
33
33
  npmErrorMessage,
34
34
  readGlobalCliInstallAt,
35
35
  readGlobalPrefix
36
- } from "./chunk-5LOP4AVD.js";
36
+ } from "./chunk-SCMEVDAR.js";
37
37
  import {
38
38
  NPX_LATEST_COMMAND
39
- } from "./chunk-6Z2VR3BA.js";
39
+ } from "./chunk-BAGBCSXA.js";
40
40
  import {
41
41
  commandsPackage,
42
42
  globalUpgradeEntry,
@@ -59,6 +59,7 @@ var FINISHED_UPGRADE = { kind: "finished" };
59
59
  var refreshedPartsOf = (agent) => [
60
60
  ...agent.result.hooks ? ["hooks"] : [],
61
61
  ...agent.result.mcp ? ["MCP key"] : [],
62
+ ...agent.result.approvalRules ? ["approval rules"] : [],
62
63
  ...agent.instructions?.outcome === "refreshed" ? ["instructions"] : []
63
64
  ];
64
65
  var wasRefreshed = (agent) => refreshedPartsOf(agent).length > 0;
@@ -1,23 +1,25 @@
1
1
  import {
2
- CLAUDE_HOOK_EVENTS,
3
2
  addGeminiMcpServer,
4
- removeGeminiMcpServer,
5
- supportedClaudeEvents
6
- } from "./chunk-BQFL2ECS.js";
3
+ removeGeminiMcpServer
4
+ } from "./chunk-ANP3DIST.js";
7
5
  import {
8
6
  CLAUDE_CODE_AGENT,
9
7
  compatibleToolLookup
10
- } from "./chunk-PXAOEFJZ.js";
8
+ } from "./chunk-3UNAPXED.js";
11
9
  import {
10
+ CLAUDE_HOOK_EVENTS,
11
+ PUSHARY_MCP_URL,
12
+ addClaudeMcpServer,
13
+ addPusharyToolPermissions,
12
14
  guardBinary,
13
15
  guardBinaryRefusing,
14
16
  holdBudgetOf,
15
- isProtectedByScope,
16
- registerHookEntry
17
- } from "./chunk-MK4USZYQ.js";
17
+ isPusharyHook,
18
+ registerHookEntry,
19
+ removeClaudeMcpServers
20
+ } from "./chunk-ATPJGHUP.js";
18
21
  import {
19
22
  HOOK_COMPATIBLE_PROFILES,
20
- HOOK_LOCATOR_BINARY,
21
23
  PHONE_ANSWERED_TOOLS,
22
24
  compatibleTargetFiles,
23
25
  hookCompatibleProfile,
@@ -26,176 +28,7 @@ import {
26
28
  pusharyMissingReason,
27
29
  refusalOutput,
28
30
  withHookHoldBudget
29
- } from "./chunk-7NCLUA65.js";
30
-
31
- // src/claude-config.ts
32
- import { join } from "path";
33
- import { isDeepStrictEqual } from "util";
34
- var PUSHARY_MCP_URL = "https://pushary.com/api/mcp/mcp";
35
- var PUSHARY_PERMISSION_RULE = "mcp__pushary__*";
36
- var asRecord = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
37
- var ensureRecord = (target, key) => {
38
- const existing = asRecord(target[key]);
39
- if (existing) return existing;
40
- const created = {};
41
- target[key] = created;
42
- return created;
43
- };
44
- var isPusharyPermission = (rule) => typeof rule === "string" && (rule.includes("pushary") || rule.includes("MCP(pushary"));
45
- var HOOK_BINARIES = /* @__PURE__ */ new Set([
46
- ...CLAUDE_HOOK_EVENTS.map((hook) => hook.binary),
47
- HOOK_LOCATOR_BINARY
48
- ]);
49
- var namesPusharyBinary = (command) => command.split(/[\s/\\"']+/).some((segment) => HOOK_BINARIES.has(segment.replace(/\.(cmd|exe)$/i, "")));
50
- var isPusharyHook = (entry2, scope) => {
51
- const hooks = asRecord(entry2)?.hooks;
52
- if (!Array.isArray(hooks)) return false;
53
- return hooks.some((hook) => {
54
- const command = String(asRecord(hook)?.command ?? "");
55
- if (isProtectedByScope(command, scope)) return false;
56
- return namesPusharyBinary(command);
57
- });
58
- };
59
- var pusharyMcpServer = (apiKey) => ({
60
- type: "http",
61
- url: PUSHARY_MCP_URL,
62
- headers: { Authorization: `Bearer ${apiKey}` }
63
- });
64
- var addClaudeMcpServer = (config, apiKey) => {
65
- const mcpServers = ensureRecord(config, "mcpServers");
66
- mcpServers.pushary = pusharyMcpServer(apiKey);
67
- };
68
- var isClaudeMcpSnapshot = (value) => {
69
- if (!value || typeof value !== "object" || Array.isArray(value)) return false;
70
- const snapshot = value;
71
- return typeof snapshot.hadMcpServers === "boolean" && typeof snapshot.mcpServersWasRecord === "boolean" && (!snapshot.hadMcpServers || snapshot.mcpServersWasRecord || Object.hasOwn(snapshot, "mcpServers")) && typeof snapshot.hadPushary === "boolean" && (!snapshot.hadPushary || Object.hasOwn(snapshot, "pushary")) && (!Object.hasOwn(snapshot, "installedPushary") || asRecord(snapshot.installedPushary)?.type === "http" && asRecord(snapshot.installedPushary)?.url === PUSHARY_MCP_URL);
72
- };
73
- var captureClaudeMcpServer = (config, apiKey) => {
74
- const mcpServers = asRecord(config.mcpServers);
75
- const hadMcpServers = Object.hasOwn(config, "mcpServers");
76
- return {
77
- hadMcpServers,
78
- mcpServersWasRecord: Boolean(mcpServers),
79
- ...hadMcpServers && !mcpServers ? { mcpServers: structuredClone(config.mcpServers) } : {},
80
- hadPushary: Boolean(mcpServers && Object.hasOwn(mcpServers, "pushary")),
81
- ...mcpServers && Object.hasOwn(mcpServers, "pushary") ? { pushary: structuredClone(mcpServers.pushary) } : {},
82
- ...apiKey ? { installedPushary: pusharyMcpServer(apiKey) } : {}
83
- };
84
- };
85
- var updateClaudeMcpSnapshot = (snapshot, apiKey) => ({
86
- ...snapshot,
87
- installedPushary: pusharyMcpServer(apiKey)
88
- });
89
- var restoreClaudeMcpServer = (config, snapshot) => {
90
- const mcpServers = asRecord(config.mcpServers);
91
- const current = asRecord(mcpServers?.pushary);
92
- if (Object.hasOwn(snapshot, "installedPushary")) {
93
- if (!isDeepStrictEqual(mcpServers?.pushary, snapshot.installedPushary)) return false;
94
- } else if (current?.type !== "http" || current.url !== PUSHARY_MCP_URL) {
95
- return false;
96
- }
97
- if (!snapshot.mcpServersWasRecord) {
98
- if (Object.keys(mcpServers).length === 1) {
99
- if (snapshot.hadMcpServers) config.mcpServers = structuredClone(snapshot.mcpServers);
100
- else delete config.mcpServers;
101
- } else {
102
- delete mcpServers.pushary;
103
- }
104
- } else if (snapshot.hadPushary) {
105
- mcpServers.pushary = structuredClone(snapshot.pushary);
106
- } else {
107
- delete mcpServers.pushary;
108
- if (!snapshot.hadMcpServers && Object.keys(mcpServers).length === 0) delete config.mcpServers;
109
- }
110
- return true;
111
- };
112
- var removeClaudeMcpServers = (config) => {
113
- let changed = false;
114
- const removeFrom = (target) => {
115
- const mcpServers = asRecord(target.mcpServers);
116
- if (!mcpServers?.pushary) return;
117
- delete mcpServers.pushary;
118
- if (Object.keys(mcpServers).length === 0) delete target.mcpServers;
119
- changed = true;
120
- };
121
- removeFrom(config);
122
- const projects = asRecord(config.projects);
123
- if (projects) {
124
- for (const project of Object.values(projects)) {
125
- const projectConfig = asRecord(project);
126
- if (projectConfig) removeFrom(projectConfig);
127
- }
128
- }
129
- return changed;
130
- };
131
- var removePusharyToolPermissions = (settings) => {
132
- const permissions = asRecord(settings.permissions);
133
- if (!permissions || !Array.isArray(permissions.allow)) return false;
134
- const filtered = permissions.allow.filter((rule) => !isPusharyPermission(rule));
135
- if (filtered.length === permissions.allow.length) return false;
136
- if (filtered.length === 0) delete permissions.allow;
137
- else permissions.allow = filtered;
138
- if (Object.keys(permissions).length === 0) delete settings.permissions;
139
- return true;
140
- };
141
- var addPusharyToolPermissions = (settings) => {
142
- const permissions = ensureRecord(settings, "permissions");
143
- const allow = Array.isArray(permissions.allow) ? permissions.allow : [];
144
- const filtered = allow.filter((rule) => !isPusharyPermission(rule));
145
- if (!filtered.includes(PUSHARY_PERMISSION_RULE)) {
146
- filtered.push(PUSHARY_PERMISSION_RULE);
147
- }
148
- permissions.allow = filtered;
149
- };
150
- var addPusharyHooks = (settings, binDir, version = null) => {
151
- const resolve = (name) => guardBinary(binDir ? join(binDir, name) : name);
152
- const hooks = ensureRecord(settings, "hooks");
153
- const supported = new Map(supportedClaudeEvents(version).map((hook) => [hook.event, hook]));
154
- for (const known of CLAUDE_HOOK_EVENTS) {
155
- const current = Array.isArray(hooks[known.event]) ? hooks[known.event] : [];
156
- const definition = supported.get(known.event);
157
- if (definition) {
158
- hooks[known.event] = registerHookEntry(current, isPusharyHook, entry(definition, resolve));
159
- continue;
160
- }
161
- const others = current.filter((item) => !isPusharyHook(item));
162
- if (others.length > 0) {
163
- hooks[known.event] = others;
164
- } else {
165
- delete hooks[known.event];
166
- }
167
- }
168
- };
169
- var entry = (definition, resolve) => ({
170
- ...definition.matcher ? { matcher: definition.matcher } : {},
171
- hooks: [{
172
- type: "command",
173
- command: withHookHoldBudget(resolve(definition.binary), holdBudgetOf(definition)),
174
- timeout: definition.timeout
175
- }]
176
- });
177
- var removePusharySettings = (settings, scope) => {
178
- let changed = scope?.keepMcpServer === true ? false : removeClaudeMcpServers(settings);
179
- if (scope?.keepMcpServer !== true && removePusharyToolPermissions(settings)) changed = true;
180
- const hooks = asRecord(settings.hooks);
181
- if (hooks) {
182
- for (const { event: key } of CLAUDE_HOOK_EVENTS) {
183
- const entries = hooks[key];
184
- if (!Array.isArray(entries)) continue;
185
- const filtered = entries.filter((entry2) => !isPusharyHook(entry2, scope));
186
- if (filtered.length !== entries.length) {
187
- if (filtered.length === 0) {
188
- delete hooks[key];
189
- } else {
190
- hooks[key] = filtered;
191
- }
192
- changed = true;
193
- }
194
- }
195
- if (Object.keys(hooks).length === 0) delete settings.hooks;
196
- }
197
- return changed;
198
- };
31
+ } from "./chunk-MNKIR2ZB.js";
199
32
 
200
33
  // src/config-document.ts
201
34
  import { parse, stringify } from "smol-toml";
@@ -220,7 +53,7 @@ var serializeConfigDocument = (value, format) => format === "toml" ? stringify(v
220
53
 
221
54
  // src/compatible-config.ts
222
55
  import { homedir } from "os";
223
- import { join as join2 } from "path";
56
+ import { join } from "path";
224
57
  var hasCompatibleMcpServer = (profile, contents) => {
225
58
  if (!profile.mcp) return false;
226
59
  const document = parseConfigDocument(contents, profile.mcp.file.format);
@@ -272,8 +105,8 @@ function normalizeToolCall(profile, input) {
272
105
  const lookup = compatibleToolLookup(profile, input.tool_name, input.tool_input ?? {}, input.cwd);
273
106
  return { ...input, tool_name: lookup.tool, tool_input: lookup.input };
274
107
  }
275
- var grokHome = (home = homedir(), environment = process.env) => environment.GROK_HOME?.trim() || join2(home, ".grok");
276
- var compatibleFilePath = (file, home = homedir()) => join2(file.root === "grok_home" ? grokHome(home) : home, ...file.path);
108
+ var grokHome = (home = homedir(), environment = process.env) => environment.GROK_HOME?.trim() || join(home, ".grok");
109
+ var compatibleFilePath = (file, home = homedir()) => join(file.root === "grok_home" ? grokHome(home) : home, ...file.path);
277
110
  var compatibleDocuments = (profile, home) => {
278
111
  const documents = /* @__PURE__ */ new Map();
279
112
  for (const file of [profile.configFile, profile.mcp?.file, profile.permissionRuleFile]) {
@@ -292,21 +125,21 @@ var compatibleInstructionsFile = (profile, home) => profile.instructions ? compa
292
125
  var PUSHARY_OWNED_FILE_STEM = "pushary";
293
126
  var isPusharyOwnedFile = (file) => file.path.at(-1)?.split(".")[0] === PUSHARY_OWNED_FILE_STEM;
294
127
  var isEmptiedPusharyOwnedDocument = (file, document) => isPusharyOwnedFile(file) && Object.keys(document).length === 0;
295
- var asRecord2 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
296
- var ensureRecord2 = (target, key) => {
297
- const existing = asRecord2(target[key]);
128
+ var asRecord = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
129
+ var ensureRecord = (target, key) => {
130
+ const existing = asRecord(target[key]);
298
131
  if (existing) return existing;
299
132
  const created = {};
300
133
  target[key] = created;
301
134
  return created;
302
135
  };
303
- var descend = (config, keyPath) => keyPath.reduce(ensureRecord2, config);
304
- var findMap = (config, keyPath) => keyPath.reduce((node, key) => node && asRecord2(node[key]), config);
136
+ var descend = (config, keyPath) => keyPath.reduce(ensureRecord, config);
137
+ var findMap = (config, keyPath) => keyPath.reduce((node, key) => node && asRecord(node[key]), config);
305
138
  var pruneEmptyMap = (config, keyPath) => {
306
139
  if (keyPath.length === 0) return false;
307
140
  const parent = findMap(config, keyPath.slice(0, -1));
308
141
  const key = keyPath[keyPath.length - 1];
309
- const map = asRecord2(parent?.[key]);
142
+ const map = asRecord(parent?.[key]);
310
143
  if (!parent || !map || Object.keys(map).length > 0) return false;
311
144
  delete parent[key];
312
145
  return true;
@@ -320,11 +153,11 @@ var translateMatcher = (profile, definition, matcher) => {
320
153
  return [.../* @__PURE__ */ new Set([...spellings, ...soleGateCoverage(profile, definition), ...profile.extraMatchers])].join("|");
321
154
  };
322
155
  var TOOL_MATCHED_EVENTS = /* @__PURE__ */ new Set(["PreToolUse", "PostToolUse", "PostToolUseFailure"]);
323
- var isPusharyHandler = (entry2, scope) => {
324
- const record = asRecord2(entry2);
156
+ var isPusharyHandler = (entry, scope) => {
157
+ const record = asRecord(entry);
325
158
  return record !== void 0 && !Array.isArray(record.hooks) && isPusharyHook({ hooks: [record] }, scope);
326
159
  };
327
- var isPusharyCompatibleEntry = (entry2, scope) => isPusharyHook(entry2, scope) || isPusharyHandler(entry2, scope);
160
+ var isPusharyCompatibleEntry = (entry, scope) => isPusharyHook(entry, scope) || isPusharyHandler(entry, scope);
328
161
  var withoutMatcher = ({ matcher, ...hook }) => hook;
329
162
  var compatibleDefinitions = (profile) => {
330
163
  if (profile.source !== "grok") return CLAUDE_HOOK_EVENTS;
@@ -343,12 +176,12 @@ var WRITTEN = { ok: true };
343
176
  var ROOT_KEY = "(root)";
344
177
  var dotted = (segments) => segments.join(".") || ROOT_KEY;
345
178
  var hooksShapeConflict = (config, profile) => {
346
- if (!asRecord2(config)) return ROOT_KEY;
179
+ if (!asRecord(config)) return ROOT_KEY;
347
180
  const walked = [];
348
181
  let node = config;
349
182
  for (const key of profile.hooksKeyPath) {
350
183
  if (node[key] === void 0) return void 0;
351
- const nested = asRecord2(node[key]);
184
+ const nested = asRecord(node[key]);
352
185
  if (!nested) return dotted([...walked, key]);
353
186
  walked.push(key);
354
187
  node = nested;
@@ -357,9 +190,9 @@ var hooksShapeConflict = (config, profile) => {
357
190
  return clash ? dotted([...walked, clash.event]) : void 0;
358
191
  };
359
192
  var permissionsShapeConflict = (config) => {
360
- if (!asRecord2(config)) return ROOT_KEY;
193
+ if (!asRecord(config)) return ROOT_KEY;
361
194
  if (config.permissions === void 0) return void 0;
362
- const permissions = asRecord2(config.permissions);
195
+ const permissions = asRecord(config.permissions);
363
196
  if (!permissions) return "permissions";
364
197
  return permissions.allow !== void 0 && !Array.isArray(permissions.allow) ? "permissions.allow" : void 0;
365
198
  };
@@ -393,7 +226,7 @@ var addCompatibleHooks = (config, profile, binDir) => {
393
226
  const current = Array.isArray(hooks[known.event]) ? hooks[known.event] : [];
394
227
  const definition = supported.get(known.event);
395
228
  if (definition) {
396
- const resolve = (name) => guardFor(profile, definition, binDir ? join2(binDir, name) : name);
229
+ const resolve = (name) => guardFor(profile, definition, binDir ? join(binDir, name) : name);
397
230
  hooks[known.event] = registerHookEntry(current, isPusharyCompatibleEntry, entryFor(profile, definition, resolve));
398
231
  continue;
399
232
  }
@@ -410,7 +243,7 @@ var removeCompatibleHooks = (config, profile, scope) => {
410
243
  for (const { event } of compatibleDefinitions(profile)) {
411
244
  const entries = hooks[event];
412
245
  if (!Array.isArray(entries)) continue;
413
- const kept = entries.filter((entry2) => !isPusharyCompatibleEntry(entry2, scope));
246
+ const kept = entries.filter((entry) => !isPusharyCompatibleEntry(entry, scope));
414
247
  if (kept.length === entries.length) continue;
415
248
  if (kept.length === 0) delete hooks[event];
416
249
  else hooks[event] = kept;
@@ -424,14 +257,14 @@ var hasCompatibleHooks = (config, profile) => {
424
257
  if (!hooks) return false;
425
258
  return compatibleHookEvents(profile).some(({ event }) => {
426
259
  const entries = hooks[event];
427
- return Array.isArray(entries) && entries.some((entry2) => isPusharyCompatibleEntry(entry2));
260
+ return Array.isArray(entries) && entries.some((entry) => isPusharyCompatibleEntry(entry));
428
261
  });
429
262
  };
430
263
  var missingCompatibleHookEvents = (config, profile) => {
431
264
  const hooks = findMap(config, profile.hooksKeyPath);
432
265
  return compatibleHookEvents(profile).filter(({ event }) => {
433
266
  const entries = hooks?.[event];
434
- return !Array.isArray(entries) || !entries.some((entry2) => isPusharyCompatibleEntry(entry2));
267
+ return !Array.isArray(entries) || !entries.some((entry) => isPusharyCompatibleEntry(entry));
435
268
  }).map(({ event }) => event);
436
269
  };
437
270
  var compatiblePermissionRuleFile = (profile, home) => profile.permissionRuleFile ? compatibleFilePath(profile.permissionRuleFile, home) : null;
@@ -439,8 +272,8 @@ var addCompatibleMcpServer = (config, profile, apiKey) => {
439
272
  if (!profile.mcp) return;
440
273
  if (profile.mcp.shape === "grok_http") {
441
274
  const container = profile.mcp.container;
442
- if (config[container] !== void 0 && !asRecord2(config[container])) throw new Error(`${profile.label} ${container} is not a table; configuration was left unchanged.`);
443
- ensureRecord2(config, container).pushary = { url: PUSHARY_MCP_URL, headers: { Authorization: `Bearer ${apiKey}` } };
275
+ if (config[container] !== void 0 && !asRecord(config[container])) throw new Error(`${profile.label} ${container} is not a table; configuration was left unchanged.`);
276
+ ensureRecord(config, container).pushary = { url: PUSHARY_MCP_URL, headers: { Authorization: `Bearer ${apiKey}` } };
444
277
  return;
445
278
  }
446
279
  if (profile.mcp.shape === "gemini_http") {
@@ -448,7 +281,7 @@ var addCompatibleMcpServer = (config, profile, apiKey) => {
448
281
  return;
449
282
  }
450
283
  if (profile.mcp.shape === "antigravity_http") {
451
- ensureRecord2(config, "mcpServers").pushary = {
284
+ ensureRecord(config, "mcpServers").pushary = {
452
285
  serverUrl: PUSHARY_MCP_URL,
453
286
  headers: { Authorization: `Bearer ${apiKey}` }
454
287
  };
@@ -456,14 +289,14 @@ var addCompatibleMcpServer = (config, profile, apiKey) => {
456
289
  }
457
290
  addClaudeMcpServer(config, apiKey);
458
291
  if (!profile.mcp.trusted) return;
459
- const server = asRecord2(asRecord2(config.mcpServers)?.pushary);
292
+ const server = asRecord(asRecord(config.mcpServers)?.pushary);
460
293
  if (server) server.trust = true;
461
294
  };
462
295
  var removeCompatibleMcpServer = (config, profile) => {
463
296
  if (!profile.mcp) return false;
464
297
  if (profile.mcp.shape === "grok_http") {
465
298
  const container = profile.mcp.container;
466
- const servers = asRecord2(config[container]);
299
+ const servers = asRecord(config[container]);
467
300
  if (!servers || servers.pushary === void 0) return false;
468
301
  delete servers.pushary;
469
302
  if (Object.keys(servers).length === 0) delete config[container];
@@ -475,16 +308,6 @@ var removeCompatibleMcpServer = (config, profile) => {
475
308
  export {
476
309
  readConfigDocument,
477
310
  serializeConfigDocument,
478
- addClaudeMcpServer,
479
- isClaudeMcpSnapshot,
480
- captureClaudeMcpServer,
481
- updateClaudeMcpSnapshot,
482
- restoreClaudeMcpServer,
483
- removeClaudeMcpServers,
484
- removePusharyToolPermissions,
485
- addPusharyToolPermissions,
486
- addPusharyHooks,
487
- removePusharySettings,
488
311
  hasCompatibleMcpServer,
489
312
  profileFromArgv,
490
313
  activeIdentity,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSafeReadOnlyCommand
3
- } from "./chunk-7NCLUA65.js";
3
+ } from "./chunk-MNKIR2ZB.js";
4
4
 
5
5
  // src/ledger.ts
6
6
  import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync } from "fs";
@@ -4,19 +4,19 @@ import {
4
4
  outcomeOfFailedAsk,
5
5
  reportMachineDenial,
6
6
  storedWaitDeadline
7
- } from "./chunk-2MZ6ROWZ.js";
7
+ } from "./chunk-RRHHWYPX.js";
8
8
  import {
9
9
  isGatingMoment,
10
10
  recordKeylessMoment
11
- } from "./chunk-XO3KAH7K.js";
11
+ } from "./chunk-XJIIU36L.js";
12
12
  import {
13
13
  isDeferAnswer,
14
14
  oncePerSession
15
- } from "./chunk-KL76XWZ7.js";
15
+ } from "./chunk-UMTMFDL2.js";
16
16
  import {
17
17
  activeHookSource,
18
18
  activeIdentity
19
- } from "./chunk-3QLFB2EY.js";
19
+ } from "./chunk-WY6YAMZW.js";
20
20
  import {
21
21
  DEFAULT_SESSION,
22
22
  UNNAMED_ACTION,
@@ -40,10 +40,10 @@ import {
40
40
  reportEvent,
41
41
  scopePathFor,
42
42
  settleQuestionsForToolUse
43
- } from "./chunk-PXAOEFJZ.js";
43
+ } from "./chunk-3UNAPXED.js";
44
44
  import {
45
45
  repoKeyFor
46
- } from "./chunk-7GRQGXF4.js";
46
+ } from "./chunk-3KXBRSL3.js";
47
47
  import {
48
48
  askUser,
49
49
  cancelQuestion,
@@ -59,20 +59,20 @@ import {
59
59
  sendNotification,
60
60
  waitForQuestion,
61
61
  waitsForThePhone
62
- } from "./chunk-TBKHQWIH.js";
62
+ } from "./chunk-DTVHZDYM.js";
63
63
  import {
64
64
  getMachineId
65
- } from "./chunk-L5CDGXPO.js";
65
+ } from "./chunk-FWS2KLV2.js";
66
66
  import {
67
67
  claudeConfigDir
68
- } from "./chunk-MK4USZYQ.js";
68
+ } from "./chunk-ATPJGHUP.js";
69
69
  import {
70
70
  getApiKey,
71
71
  getBaseUrl
72
- } from "./chunk-BUQU3OPX.js";
72
+ } from "./chunk-Y64JGYTB.js";
73
73
  import {
74
74
  NPX_LATEST_COMMAND
75
- } from "./chunk-6Z2VR3BA.js";
75
+ } from "./chunk-BAGBCSXA.js";
76
76
  import {
77
77
  AGENT_QUESTION_STRATEGY,
78
78
  AGENT_QUESTION_TOOL,
@@ -121,7 +121,7 @@ import {
121
121
  resolveGate,
122
122
  timeoutActionWithoutLocalPrompt,
123
123
  unansweredRefusalReason
124
- } from "./chunk-7NCLUA65.js";
124
+ } from "./chunk-MNKIR2ZB.js";
125
125
 
126
126
  // src/claude-permission-rules.ts
127
127
  import { readFileSync, statSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  NPX_LATEST_COMMAND
3
- } from "./chunk-6Z2VR3BA.js";
3
+ } from "./chunk-BAGBCSXA.js";
4
4
 
5
5
  // src/config.ts
6
6
  import { readFileSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  guardBinary
3
- } from "./chunk-MK4USZYQ.js";
3
+ } from "./chunk-ATPJGHUP.js";
4
4
 
5
5
  // src/bell/install.ts
6
6
  import { join } from "path";
@@ -22,23 +22,22 @@ import {
22
22
  turnCodexAppCardsOff,
23
23
  turnCodexAppCardsOn,
24
24
  whyLaunchctlFailed
25
- } from "./chunk-OU3BYBJ3.js";
26
- import "./chunk-5JK3DQGZ.js";
25
+ } from "./chunk-OA6EADFT.js";
26
+ import "./chunk-JFKMPLNF.js";
27
27
  import "./chunk-XCEN33UP.js";
28
28
  import "./chunk-QCGNGEGE.js";
29
- import "./chunk-4WFAP6QN.js";
29
+ import "./chunk-ADXHPGBZ.js";
30
30
  import "./chunk-XHKBHWLX.js";
31
- import "./chunk-IOH2T3CB.js";
31
+ import "./chunk-ED2SWTPC.js";
32
32
  import "./chunk-E46NE7FB.js";
33
- import "./chunk-L5CDGXPO.js";
34
- import "./chunk-V5W3CK7F.js";
35
- import "./chunk-QENTGE75.js";
36
- import "./chunk-MK4USZYQ.js";
37
- import "./chunk-5LOP4AVD.js";
38
- import "./chunk-BUQU3OPX.js";
39
- import "./chunk-6Z2VR3BA.js";
33
+ import "./chunk-FWS2KLV2.js";
34
+ import "./chunk-2VADJ6JH.js";
35
+ import "./chunk-ATPJGHUP.js";
36
+ import "./chunk-SCMEVDAR.js";
37
+ import "./chunk-Y64JGYTB.js";
38
+ import "./chunk-BAGBCSXA.js";
40
39
  import "./chunk-QTOLNRET.js";
41
- import "./chunk-7NCLUA65.js";
40
+ import "./chunk-MNKIR2ZB.js";
42
41
  import "./chunk-MLKGABMK.js";
43
42
  export {
44
43
  CODEX_APP_CARDS_DIRECTORY,
@@ -11,7 +11,7 @@ import {
11
11
  installedCodexApp,
12
12
  shellQuoted,
13
13
  writeDesktopProxy
14
- } from "./chunk-5JK3DQGZ.js";
14
+ } from "./chunk-JFKMPLNF.js";
15
15
  import "./chunk-XCEN33UP.js";
16
16
  import {
17
17
  CODEX_APP_LAUNCH_VARIABLE
@@ -11,36 +11,34 @@ import {
11
11
  isCodexQuestionLeftWithTheLocalClient,
12
12
  planCodexElicitation,
13
13
  reportOwnedQuestion
14
- } from "./chunk-P6RF4RQN.js";
15
- import "./chunk-OP5IBEV7.js";
16
- import "./chunk-HOIO66DU.js";
17
- import "./chunk-OY6Z4IKB.js";
18
- import "./chunk-CLABCSZC.js";
19
- import "./chunk-VUFHYMSP.js";
20
- import "./chunk-BCVCUDFI.js";
21
- import "./chunk-V7N5NOZV.js";
14
+ } from "./chunk-3LF7T3NW.js";
15
+ import "./chunk-NUEPJ5W6.js";
16
+ import "./chunk-R4FL5JHK.js";
17
+ import "./chunk-HIYLAC3C.js";
18
+ import "./chunk-6CZX6YOE.js";
19
+ import "./chunk-RABLE5R6.js";
20
+ import "./chunk-QSW3HAKI.js";
21
+ import "./chunk-TJUJAK5L.js";
22
22
  import "./chunk-XHKBHWLX.js";
23
- import "./chunk-6ICPEJY5.js";
24
- import "./chunk-7GRQGXF4.js";
23
+ import "./chunk-3KXBRSL3.js";
25
24
  import {
26
25
  writeDegraded
27
- } from "./chunk-TBKHQWIH.js";
26
+ } from "./chunk-DTVHZDYM.js";
28
27
  import "./chunk-POFBE6ZY.js";
29
- import "./chunk-ELAK46NR.js";
30
- import "./chunk-AB3VAQ25.js";
31
- import "./chunk-VFJSVPNL.js";
32
- import "./chunk-L5CDGXPO.js";
28
+ import "./chunk-BKCI53W6.js";
29
+ import "./chunk-UHS5MMAI.js";
30
+ import "./chunk-7ILQX47W.js";
31
+ import "./chunk-FWS2KLV2.js";
33
32
  import "./chunk-PPY5N2E6.js";
34
33
  import "./chunk-KZERVKTD.js";
35
- import "./chunk-QENTGE75.js";
36
- import "./chunk-MK4USZYQ.js";
37
- import "./chunk-5LOP4AVD.js";
38
- import "./chunk-BUQU3OPX.js";
39
- import "./chunk-6Z2VR3BA.js";
34
+ import "./chunk-ATPJGHUP.js";
35
+ import "./chunk-SCMEVDAR.js";
36
+ import "./chunk-Y64JGYTB.js";
37
+ import "./chunk-BAGBCSXA.js";
40
38
  import "./chunk-QTOLNRET.js";
41
39
  import {
42
40
  canonicalJsonText
43
- } from "./chunk-7NCLUA65.js";
41
+ } from "./chunk-MNKIR2ZB.js";
44
42
  import "./chunk-MLKGABMK.js";
45
43
 
46
44
  // src/codex-session-launch.ts
@@ -3,9 +3,9 @@ import {
3
3
  getApiKey,
4
4
  getBaseUrl,
5
5
  resetKeyDriftWarning
6
- } from "./chunk-BUQU3OPX.js";
7
- import "./chunk-6Z2VR3BA.js";
8
- import "./chunk-7NCLUA65.js";
6
+ } from "./chunk-Y64JGYTB.js";
7
+ import "./chunk-BAGBCSXA.js";
8
+ import "./chunk-MNKIR2ZB.js";
9
9
  import "./chunk-MLKGABMK.js";
10
10
  export {
11
11
  configFilePath,