pushary 1.9.35 → 1.9.36

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 (101) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -1
  3. package/dist/bin/pushary-bell-hook.js +25 -25
  4. package/dist/bin/pushary-bell.js +9 -9
  5. package/dist/bin/pushary-claude.js +24 -24
  6. package/dist/bin/pushary-clean.js +52 -45
  7. package/dist/bin/pushary-codex-bridge.js +17 -17
  8. package/dist/bin/pushary-codex-hook.js +30 -30
  9. package/dist/bin/pushary-codex.js +12 -12
  10. package/dist/bin/pushary-connect.js +24 -24
  11. package/dist/bin/pushary-cowork.js +5 -5
  12. package/dist/bin/pushary-daemon.js +32 -32
  13. package/dist/bin/pushary-disconnect.js +31 -28
  14. package/dist/bin/pushary-doctor.js +35 -34
  15. package/dist/bin/pushary-elicitation-hook.js +25 -25
  16. package/dist/bin/pushary-gemini-bridge.js +13 -13
  17. package/dist/bin/pushary-gemini-hook.js +27 -27
  18. package/dist/bin/pushary-hook.js +34 -30
  19. package/dist/bin/pushary-login.js +12 -12
  20. package/dist/bin/pushary-logout.js +24 -24
  21. package/dist/bin/pushary-mcp.js +9 -9
  22. package/dist/bin/pushary-mode.js +12 -12
  23. package/dist/bin/pushary-notification-hook.js +24 -24
  24. package/dist/bin/pushary-opencode-hook.js +26 -26
  25. package/dist/bin/pushary-permission-denied-hook.js +29 -29
  26. package/dist/bin/pushary-permission-hook.js +28 -28
  27. package/dist/bin/pushary-post-hook.js +24 -24
  28. package/dist/bin/pushary-prompt-hook.js +24 -24
  29. package/dist/bin/pushary-session-end-hook.js +24 -24
  30. package/dist/bin/pushary-session-start-hook.js +28 -28
  31. package/dist/bin/pushary-setup.js +65 -56
  32. package/dist/bin/pushary-stats.js +5 -5
  33. package/dist/bin/pushary-status.js +26 -26
  34. package/dist/bin/pushary-stop-hook.js +24 -24
  35. package/dist/bin/pushary-stopfailure-hook.js +24 -24
  36. package/dist/bin/pushary-suggestions.js +12 -12
  37. package/dist/bin/pushary-transcript-register.js +17 -17
  38. package/dist/bin/pushary-transcripts.js +7 -7
  39. package/dist/bin/pushary-upgrade.js +30 -30
  40. package/dist/bin/pushary-wait.js +12 -12
  41. package/dist/bin/pushary.js +6 -6
  42. package/dist/{chunk-4TFD3WAA.js → chunk-26AEFJSK.js} +2 -2
  43. package/dist/{chunk-7FQL5NWJ.js → chunk-2DZBIELP.js} +135 -23
  44. package/dist/{chunk-DCBSD22V.js → chunk-42FTY5II.js} +3 -3
  45. package/dist/{chunk-PEEJP4HN.js → chunk-4E4PZQFE.js} +4 -4
  46. package/dist/{chunk-6OGDGQTT.js → chunk-4NMDFPK7.js} +5 -5
  47. package/dist/{chunk-43H2FUNN.js → chunk-556JCOMK.js} +4 -4
  48. package/dist/{chunk-FQQSW7MD.js → chunk-55XIK7YS.js} +1 -1
  49. package/dist/{chunk-36ZCFJUI.js → chunk-5ML6E3L7.js} +1 -1
  50. package/dist/{chunk-NMQLY4PE.js → chunk-5S2P2CK6.js} +2 -2
  51. package/dist/{chunk-SMRMWDFE.js → chunk-6LKIK7V2.js} +43 -17
  52. package/dist/{chunk-U7CN5HG2.js → chunk-7GQILLZD.js} +5 -5
  53. package/dist/{chunk-B5RLJ6QD.js → chunk-7MOFAAZ3.js} +9 -5
  54. package/dist/{chunk-H52HBSOD.js → chunk-BS64ZHTB.js} +3 -3
  55. package/dist/{chunk-A455TSHF.js → chunk-CHNSFTD5.js} +2 -2
  56. package/dist/{chunk-WFPXKCN4.js → chunk-CHWJ7ZXI.js} +5 -5
  57. package/dist/{chunk-22YSHBTI.js → chunk-CRZ4CP7C.js} +3 -3
  58. package/dist/{chunk-WMB3OCI4.js → chunk-CRZKFEEO.js} +2 -2
  59. package/dist/{chunk-NKAMF2YJ.js → chunk-DC6KHRVH.js} +1 -1
  60. package/dist/{chunk-ULJFIF5N.js → chunk-EGTVN6YV.js} +1 -1
  61. package/dist/{chunk-A5FFSXZE.js → chunk-EH635XAR.js} +2 -2
  62. package/dist/{chunk-57FFQR46.js → chunk-EQXMVKKD.js} +1 -1
  63. package/dist/{chunk-EJWSE7S7.js → chunk-ETGGQWBR.js} +4 -4
  64. package/dist/{chunk-WPSI4246.js → chunk-F5W7B7YT.js} +1 -1
  65. package/dist/{chunk-OZMGO4WF.js → chunk-FBKGGIFB.js} +5 -5
  66. package/dist/{chunk-7IVV4LLF.js → chunk-GNESC5EF.js} +3 -3
  67. package/dist/{chunk-YABMIGR3.js → chunk-GTEF64CJ.js} +1 -1
  68. package/dist/{chunk-CK3W7Q5S.js → chunk-H3MOTS2C.js} +1 -1
  69. package/dist/{chunk-7UGGCTTW.js → chunk-HCKBZYBW.js} +2 -2
  70. package/dist/{chunk-HJNCVY5F.js → chunk-IPYCRJGM.js} +7 -7
  71. package/dist/{chunk-VTAC5FBZ.js → chunk-J36W6ARB.js} +1 -1
  72. package/dist/{chunk-GC3SUMYD.js → chunk-JAA7YJJZ.js} +4 -4
  73. package/dist/{chunk-FDNMQEU6.js → chunk-JWURAYXK.js} +2 -2
  74. package/dist/{chunk-UPRNSD2T.js → chunk-K5X25GUV.js} +4 -4
  75. package/dist/{chunk-UDECNZYI.js → chunk-KCUTE3EB.js} +2 -2
  76. package/dist/{chunk-CPYOJRDN.js → chunk-L25KSDIB.js} +8 -8
  77. package/dist/{chunk-45OXG3VR.js → chunk-LL256PHP.js} +1 -1
  78. package/dist/{chunk-Z6HDYK2A.js → chunk-MBBPLF5T.js} +2 -2
  79. package/dist/{chunk-XLXG6MA5.js → chunk-ML42WKI7.js} +3 -3
  80. package/dist/{chunk-FYQG2UTK.js → chunk-MNXHKEXB.js} +2 -2
  81. package/dist/{chunk-IRU7DKJW.js → chunk-NE5OPCD5.js} +7 -3
  82. package/dist/{chunk-3LS3GFJW.js → chunk-PRKH662J.js} +1 -1
  83. package/dist/{chunk-E2OZZZKP.js → chunk-QHL3Y6D2.js} +2 -2
  84. package/dist/{chunk-SMSX4TCC.js → chunk-QPUTCMAK.js} +1 -1
  85. package/dist/{chunk-HVUBWLER.js → chunk-RNRCOOQZ.js} +11 -11
  86. package/dist/{chunk-LOYSI2CZ.js → chunk-RYXSY3RH.js} +5 -5
  87. package/dist/{chunk-7S7H7V5V.js → chunk-SHLLDMPM.js} +97 -40
  88. package/dist/{chunk-V4ZIG66K.js → chunk-TRNSODJ6.js} +1 -1
  89. package/dist/{chunk-DQKEGNTI.js → chunk-U2PUHT4W.js} +1 -1
  90. package/dist/{chunk-HQKYWUBF.js → chunk-UDHT3W7I.js} +2 -2
  91. package/dist/{chunk-QJ3ENGBT.js → chunk-ULDOQF4Q.js} +3 -3
  92. package/dist/{chunk-EGTRIM74.js → chunk-VRALPR4B.js} +4 -4
  93. package/dist/{chunk-4PIAOJAW.js → chunk-X4BPD5RD.js} +1 -1
  94. package/dist/{chunk-FPYBX36E.js → chunk-Y5FCB66K.js} +5 -5
  95. package/dist/{chunk-YRDNKY77.js → chunk-YRAPCLOB.js} +6 -6
  96. package/dist/{global-upgrade-IZCB4WIE.js → global-upgrade-EF6RZBPU.js} +6 -6
  97. package/dist/{paths-4WAA57P5.js → paths-F645XTFZ.js} +2 -2
  98. package/dist/{reapply-GJ73ZHDD.js → reapply-HJOTWJAN.js} +20 -20
  99. package/dist/src/index.js +19 -19
  100. package/dist/{upgrade-lock-J5PIKSYV.js → upgrade-lock-APUN7YKQ.js} +3 -3
  101. package/package.json +1 -1
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  defersToNativeMode,
3
3
  reportMachineDenial
4
- } from "./chunk-FYQG2UTK.js";
4
+ } from "./chunk-MNXHKEXB.js";
5
5
  import {
6
6
  isGatingMoment,
7
7
  recordKeylessMoment
8
- } from "./chunk-VTAC5FBZ.js";
8
+ } from "./chunk-J36W6ARB.js";
9
9
  import {
10
10
  announceSubscriptionRequired,
11
11
  isDeferAnswer,
12
12
  oncePerSession
13
- } from "./chunk-NKAMF2YJ.js";
13
+ } from "./chunk-DC6KHRVH.js";
14
14
  import {
15
15
  activeHookSource,
16
16
  activeIdentity
17
- } from "./chunk-7S7H7V5V.js";
17
+ } from "./chunk-SHLLDMPM.js";
18
18
  import {
19
19
  DEFAULT_SESSION,
20
20
  UNNAMED_ACTION,
@@ -39,7 +39,7 @@ import {
39
39
  reportEvent,
40
40
  scopePathFor,
41
41
  settleQuestionsForToolUse
42
- } from "./chunk-SMRMWDFE.js";
42
+ } from "./chunk-6LKIK7V2.js";
43
43
  import {
44
44
  askUser,
45
45
  cancelQuestion,
@@ -52,20 +52,20 @@ import {
52
52
  sendNotification,
53
53
  waitForQuestion,
54
54
  waitsForThePhone
55
- } from "./chunk-OZMGO4WF.js";
55
+ } from "./chunk-FBKGGIFB.js";
56
56
  import {
57
57
  SubscriptionRequiredError
58
- } from "./chunk-H52HBSOD.js";
58
+ } from "./chunk-BS64ZHTB.js";
59
59
  import {
60
60
  getMachineId
61
- } from "./chunk-ULJFIF5N.js";
61
+ } from "./chunk-EGTVN6YV.js";
62
62
  import {
63
63
  getApiKey,
64
64
  getBaseUrl
65
- } from "./chunk-3LS3GFJW.js";
65
+ } from "./chunk-PRKH662J.js";
66
66
  import {
67
67
  NPX_LATEST_COMMAND
68
- } from "./chunk-45OXG3VR.js";
68
+ } from "./chunk-LL256PHP.js";
69
69
  import {
70
70
  AGENT_QUESTION_STRATEGY,
71
71
  DECISION_STOP_REASON,
@@ -110,7 +110,7 @@ import {
110
110
  resolveGate,
111
111
  timeoutActionWithoutLocalPrompt,
112
112
  unansweredRefusalReason
113
- } from "./chunk-7FQL5NWJ.js";
113
+ } from "./chunk-2DZBIELP.js";
114
114
 
115
115
  // src/claude-permission-rules.ts
116
116
  import { readFileSync, statSync } from "fs";
@@ -4,7 +4,7 @@ import {
4
4
  forkFinishWithUpgradeLock,
5
5
  installWithUpgradeLock,
6
6
  releaseAutoUpdateLock
7
- } from "./chunk-FQQSW7MD.js";
7
+ } from "./chunk-55XIK7YS.js";
8
8
  import {
9
9
  describeAutoUpdateCheck,
10
10
  globalInstallLocation,
@@ -14,7 +14,7 @@ import {
14
14
  readAutoUpdateState,
15
15
  updateAutoUpdateState,
16
16
  upgradeEntryFor
17
- } from "./chunk-7UGGCTTW.js";
17
+ } from "./chunk-HCKBZYBW.js";
18
18
  import {
19
19
  EXIT
20
20
  } from "./chunk-KZERVKTD.js";
@@ -27,10 +27,10 @@ import {
27
27
  npmErrorMessage,
28
28
  readGlobalCliInstallAt,
29
29
  readGlobalPrefix
30
- } from "./chunk-UPRNSD2T.js";
30
+ } from "./chunk-K5X25GUV.js";
31
31
  import {
32
32
  NPX_LATEST_COMMAND
33
- } from "./chunk-45OXG3VR.js";
33
+ } from "./chunk-LL256PHP.js";
34
34
  import {
35
35
  commandsPackage,
36
36
  globalUpgradeEntry,
@@ -39,7 +39,7 @@ import {
39
39
  isSameMajorVersion,
40
40
  ownPackageRoot,
41
41
  packageVersionAt
42
- } from "./chunk-7FQL5NWJ.js";
42
+ } from "./chunk-2DZBIELP.js";
43
43
 
44
44
  // src/global-upgrade.ts
45
45
  import { existsSync } from "fs";
@@ -3,28 +3,29 @@ import {
3
3
  addGeminiMcpServer,
4
4
  removeGeminiMcpServer,
5
5
  supportedClaudeEvents
6
- } from "./chunk-QJ3ENGBT.js";
6
+ } from "./chunk-ULDOQF4Q.js";
7
7
  import {
8
8
  CLAUDE_CODE_AGENT,
9
- parseApplyPatchFiles
10
- } from "./chunk-SMRMWDFE.js";
9
+ compatibleToolLookup
10
+ } from "./chunk-6LKIK7V2.js";
11
11
  import {
12
12
  guardBinary,
13
13
  guardBinaryRefusing,
14
14
  holdBudgetOf,
15
15
  isProtectedByScope,
16
16
  registerHookEntry
17
- } from "./chunk-UPRNSD2T.js";
17
+ } from "./chunk-K5X25GUV.js";
18
18
  import {
19
19
  HOOK_LOCATOR_BINARY,
20
20
  PHONE_ANSWERED_TOOLS,
21
+ compatibleTargetFiles,
21
22
  hookCompatibleProfile,
22
23
  hookCompatibleProfileBySource,
24
+ isRecord,
23
25
  pusharyMissingReason,
24
26
  refusalOutput,
25
- toToolLookup,
26
27
  withHookHoldBudget
27
- } from "./chunk-7FQL5NWJ.js";
28
+ } from "./chunk-2DZBIELP.js";
28
29
 
29
30
  // src/claude-config.ts
30
31
  import { join } from "path";
@@ -146,14 +147,14 @@ var addPusharyToolPermissions = (settings) => {
146
147
  permissions.allow = filtered;
147
148
  };
148
149
  var addPusharyHooks = (settings, binDir, version = null) => {
149
- const resolve2 = (name) => guardBinary(binDir ? join(binDir, name) : name);
150
+ const resolve = (name) => guardBinary(binDir ? join(binDir, name) : name);
150
151
  const hooks = ensureRecord(settings, "hooks");
151
152
  const supported = new Map(supportedClaudeEvents(version).map((hook) => [hook.event, hook]));
152
153
  for (const known of CLAUDE_HOOK_EVENTS) {
153
154
  const current = Array.isArray(hooks[known.event]) ? hooks[known.event] : [];
154
155
  const definition = supported.get(known.event);
155
156
  if (definition) {
156
- hooks[known.event] = registerHookEntry(current, isPusharyHook, entry(definition, resolve2));
157
+ hooks[known.event] = registerHookEntry(current, isPusharyHook, entry(definition, resolve));
157
158
  continue;
158
159
  }
159
160
  const others = current.filter((item) => !isPusharyHook(item));
@@ -164,11 +165,11 @@ var addPusharyHooks = (settings, binDir, version = null) => {
164
165
  }
165
166
  }
166
167
  };
167
- var entry = (definition, resolve2) => ({
168
+ var entry = (definition, resolve) => ({
168
169
  ...definition.matcher ? { matcher: definition.matcher } : {},
169
170
  hooks: [{
170
171
  type: "command",
171
- command: withHookHoldBudget(resolve2(definition.binary), holdBudgetOf(definition)),
172
+ command: withHookHoldBudget(resolve(definition.binary), holdBudgetOf(definition)),
172
173
  timeout: definition.timeout
173
174
  }]
174
175
  });
@@ -195,9 +196,37 @@ var removePusharySettings = (settings, scope) => {
195
196
  return changed;
196
197
  };
197
198
 
199
+ // src/config-document.ts
200
+ import { parse, stringify } from "smol-toml";
201
+ var parseConfigDocument = (text, format) => {
202
+ if (text === null) return { kind: "missing" };
203
+ try {
204
+ const value = format === "toml" ? parse(text) : JSON.parse(text);
205
+ return isRecord(value) ? { kind: "parsed", value } : { kind: "unreadable" };
206
+ } catch {
207
+ return { kind: "unreadable" };
208
+ }
209
+ };
210
+ var readConfigDocument = (path, format, files) => {
211
+ try {
212
+ return parseConfigDocument(files.read(path), format);
213
+ } catch {
214
+ return { kind: "unreadable" };
215
+ }
216
+ };
217
+ var serializeConfigDocument = (value, format) => format === "toml" ? stringify(value) : `${JSON.stringify(value, null, 2)}
218
+ `;
219
+
198
220
  // src/compatible-config.ts
199
221
  import { homedir } from "os";
200
- import { isAbsolute, join as join2, resolve } from "path";
222
+ import { join as join2 } from "path";
223
+ var hasCompatibleMcpServer = (profile, contents) => {
224
+ if (!profile.mcp) return false;
225
+ const document = parseConfigDocument(contents, profile.mcp.file.format);
226
+ if (document.kind !== "parsed") return false;
227
+ const servers = document.value[profile.mcp.container];
228
+ return isRecord(servers) && isRecord(servers.pushary);
229
+ };
201
230
  var AGENT_FLAG = "--agent";
202
231
  var SOURCE_FLAG = "--source";
203
232
  var EVENT_FLAG = "--event";
@@ -237,25 +266,24 @@ var activeHookSource = (argv) => {
237
266
  if (source === void 0) return "claude";
238
267
  return source === "claude" ? "claude" : hookCompatibleProfileBySource(source)?.source ?? null;
239
268
  };
240
- var PATCH_INPUT_KEYS = ["command", "patch", "input"];
241
- var patchedFiles = (toolInput) => [...new Set(PATCH_INPUT_KEYS.flatMap((key) => parseApplyPatchFiles(toolInput[key])))];
242
- var lookupFor = (profile, input) => {
243
- const absolute = (path) => input.cwd && !isAbsolute(path) ? resolve(input.cwd, path) : path;
244
- const toolInput = input.tool_input ?? {};
245
- const lookup = toToolLookup(profile, input.tool_name ?? "", toolInput, absolute);
246
- if (!lookup.unreadable) return lookup;
247
- const files = patchedFiles(toolInput);
248
- return files.length === 1 ? { ...lookup, input: { ...lookup.input, file_path: absolute(files[0]) }, unreadable: false } : lookup;
249
- };
250
- var normalizeToolCall = (profile, input) => {
269
+ function normalizeToolCall(profile, input) {
251
270
  if (!profile || !input.tool_name) return input;
252
- const lookup = lookupFor(profile, input);
271
+ const lookup = compatibleToolLookup(profile, input.tool_name, input.tool_input ?? {}, input.cwd);
253
272
  return { ...input, tool_name: lookup.tool, tool_input: lookup.input };
273
+ }
274
+ var grokHome = (home = homedir(), environment = process.env) => environment.GROK_HOME?.trim() || join2(home, ".grok");
275
+ var compatibleFilePath = (file, home = homedir()) => join2(file.root === "grok_home" ? grokHome(home) : home, ...file.path);
276
+ var compatibleDocuments = (profile, home) => {
277
+ const documents = /* @__PURE__ */ new Map();
278
+ for (const file of [profile.configFile, profile.mcp?.file, profile.permissionRuleFile]) {
279
+ if (file) documents.set(compatibleFilePath(file, home), file);
280
+ }
281
+ return documents;
254
282
  };
255
- var underHome = (segments, home = homedir()) => join2(home, ...segments);
256
- var compatibleConfigFile = (profile, home) => underHome(profile.configFile, home);
257
- var compatibleMcpFile = (profile, home) => profile.mcp ? underHome(profile.mcp.file, home) : null;
258
- var compatibleInstructionsFile = (profile, home) => profile.instructions ? underHome(profile.instructions.file, home) : null;
283
+ var compatibleTargetPaths = (profile, home) => compatibleTargetFiles(profile).map((file) => compatibleFilePath(file, home));
284
+ var compatibleConfigFile = (profile, home) => compatibleFilePath(profile.configFile, home);
285
+ var compatibleMcpFile = (profile, home) => profile.mcp ? compatibleFilePath(profile.mcp.file, home) : null;
286
+ var compatibleInstructionsFile = (profile, home) => profile.instructions ? compatibleFilePath(profile.instructions.file, home) : null;
259
287
  var asRecord2 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
260
288
  var ensureRecord2 = (target, key) => {
261
289
  const existing = asRecord2(target[key]);
@@ -283,14 +311,22 @@ var translateMatcher = (profile, definition, matcher) => {
283
311
  const spellings = matcher.split("|").filter((canonical) => !carriesPhoneAnswer(profile, canonical)).flatMap((canonical) => [canonical, ...aliasesFor(profile, canonical)]);
284
312
  return [.../* @__PURE__ */ new Set([...spellings, ...soleGateCoverage(profile, definition), ...profile.extraMatchers])].join("|");
285
313
  };
286
- var TOOL_MATCHED_EVENTS = /* @__PURE__ */ new Set(["PreToolUse", "PostToolUse"]);
314
+ var TOOL_MATCHED_EVENTS = /* @__PURE__ */ new Set(["PreToolUse", "PostToolUse", "PostToolUseFailure"]);
287
315
  var isPusharyHandler = (entry2, scope) => {
288
316
  const record = asRecord2(entry2);
289
317
  return record !== void 0 && !Array.isArray(record.hooks) && isPusharyHook({ hooks: [record] }, scope);
290
318
  };
291
319
  var isPusharyCompatibleEntry = (entry2, scope) => isPusharyHook(entry2, scope) || isPusharyHandler(entry2, scope);
292
320
  var withoutMatcher = ({ matcher, ...hook }) => hook;
293
- var compatibleHookEvents = (profile) => CLAUDE_HOOK_EVENTS.filter((hook) => profile.events.includes(hook.event)).map((hook) => {
321
+ var compatibleDefinitions = (profile) => {
322
+ if (profile.source !== "grok") return CLAUDE_HOOK_EVENTS;
323
+ return [
324
+ ...CLAUDE_HOOK_EVENTS,
325
+ { event: "PostToolUseFailure", binary: "pushary-post-hook", timeout: 10, delivery: "telemetry", since: [1, 0, 0] },
326
+ { event: "StopCancelled", binary: "pushary-stopfailure-hook", timeout: 10, delivery: "telemetry", since: [1, 0, 0] }
327
+ ];
328
+ };
329
+ var compatibleHookEvents = (profile) => compatibleDefinitions(profile).filter((hook) => profile.events.includes(hook.event)).map((hook) => {
294
330
  if (!hook.matcher) return hook;
295
331
  if (!TOOL_MATCHED_EVENTS.has(hook.event)) return withoutMatcher(hook);
296
332
  return { ...hook, matcher: translateMatcher(profile, hook, hook.matcher) };
@@ -309,7 +345,7 @@ var hooksShapeConflict = (config, profile) => {
309
345
  walked.push(key);
310
346
  node = nested;
311
347
  }
312
- const clash = CLAUDE_HOOK_EVENTS.find(({ event }) => node[event] !== void 0 && !Array.isArray(node[event]));
348
+ const clash = compatibleDefinitions(profile).find(({ event }) => node[event] !== void 0 && !Array.isArray(node[event]));
313
349
  return clash ? dotted([...walked, clash.event]) : void 0;
314
350
  };
315
351
  var permissionsShapeConflict = (config) => {
@@ -325,15 +361,15 @@ var addCompatibleToolPermissions = (config) => {
325
361
  addPusharyToolPermissions(config);
326
362
  return WRITTEN;
327
363
  };
328
- var commandFor = (profile, definition, resolve2) => {
329
- const named = `${resolve2(definition.binary)} ${agentArgument(profile)}`;
364
+ var commandFor = (profile, definition, resolve) => {
365
+ const named = `${resolve(definition.binary)} ${agentArgument(profile)}`;
330
366
  const command = payloadNamesItsEvent(profile) ? named : `${named} ${eventArgument(definition.event)}`;
331
367
  return withHookHoldBudget(command, holdBudgetOf(definition));
332
368
  };
333
369
  var writesBareHandler = (profile, definition) => profile.nonToolEntries === "handler" && !TOOL_MATCHED_EVENTS.has(definition.event);
334
- var guardFor = (profile, definition, path) => isSoleGateEvent(profile, definition) ? guardBinaryRefusing(path, refusalOutput(profile, pusharyMissingReason(profile))) : guardBinary(path);
335
- var entryFor = (profile, definition, resolve2) => {
336
- const handler = { type: "command", command: commandFor(profile, definition, resolve2), timeout: definition.timeout };
370
+ var guardFor = (profile, definition, path) => isSoleGateEvent(profile, definition) || profile.source === "grok" && definition.delivery === "approval" ? guardBinaryRefusing(path, refusalOutput(profile, pusharyMissingReason(profile))) : guardBinary(path);
371
+ var entryFor = (profile, definition, resolve) => {
372
+ const handler = { type: "command", command: commandFor(profile, definition, resolve), timeout: definition.timeout };
337
373
  if (writesBareHandler(profile, definition)) return handler;
338
374
  return {
339
375
  ...definition.matcher ? { matcher: definition.matcher } : {},
@@ -345,12 +381,12 @@ var addCompatibleHooks = (config, profile, binDir) => {
345
381
  if (conflictAt) return { ok: false, conflictAt };
346
382
  const hooks = descend(config, profile.hooksKeyPath);
347
383
  const supported = new Map(compatibleHookEvents(profile).map((hook) => [hook.event, hook]));
348
- for (const known of CLAUDE_HOOK_EVENTS) {
384
+ for (const known of compatibleDefinitions(profile)) {
349
385
  const current = Array.isArray(hooks[known.event]) ? hooks[known.event] : [];
350
386
  const definition = supported.get(known.event);
351
387
  if (definition) {
352
- const resolve2 = (name) => guardFor(profile, definition, binDir ? join2(binDir, name) : name);
353
- hooks[known.event] = registerHookEntry(current, isPusharyCompatibleEntry, entryFor(profile, definition, resolve2));
388
+ const resolve = (name) => guardFor(profile, definition, binDir ? join2(binDir, name) : name);
389
+ hooks[known.event] = registerHookEntry(current, isPusharyCompatibleEntry, entryFor(profile, definition, resolve));
354
390
  continue;
355
391
  }
356
392
  const others = current.filter((item) => !isPusharyCompatibleEntry(item));
@@ -363,7 +399,7 @@ var removeCompatibleHooks = (config, profile, scope) => {
363
399
  const hooks = findMap(config, profile.hooksKeyPath);
364
400
  if (!hooks) return false;
365
401
  let changed = false;
366
- for (const { event } of CLAUDE_HOOK_EVENTS) {
402
+ for (const { event } of compatibleDefinitions(profile)) {
367
403
  const entries = hooks[event];
368
404
  if (!Array.isArray(entries)) continue;
369
405
  const kept = entries.filter((entry2) => !isPusharyCompatibleEntry(entry2, scope));
@@ -390,9 +426,15 @@ var missingCompatibleHookEvents = (config, profile) => {
390
426
  return !Array.isArray(entries) || !entries.some((entry2) => isPusharyCompatibleEntry(entry2));
391
427
  }).map(({ event }) => event);
392
428
  };
393
- var compatiblePermissionRuleFile = (profile, home) => profile.permissionRuleFile ? underHome(profile.permissionRuleFile, home) : null;
429
+ var compatiblePermissionRuleFile = (profile, home) => profile.permissionRuleFile ? compatibleFilePath(profile.permissionRuleFile, home) : null;
394
430
  var addCompatibleMcpServer = (config, profile, apiKey) => {
395
431
  if (!profile.mcp) return;
432
+ if (profile.mcp.shape === "grok_http") {
433
+ const container = profile.mcp.container;
434
+ if (config[container] !== void 0 && !asRecord2(config[container])) throw new Error(`${profile.label} ${container} is not a table; configuration was left unchanged.`);
435
+ ensureRecord2(config, container).pushary = { url: PUSHARY_MCP_URL, headers: { Authorization: `Bearer ${apiKey}` } };
436
+ return;
437
+ }
396
438
  if (profile.mcp.shape === "gemini_http") {
397
439
  addGeminiMcpServer(config, apiKey);
398
440
  return;
@@ -411,10 +453,20 @@ var addCompatibleMcpServer = (config, profile, apiKey) => {
411
453
  };
412
454
  var removeCompatibleMcpServer = (config, profile) => {
413
455
  if (!profile.mcp) return false;
456
+ if (profile.mcp.shape === "grok_http") {
457
+ const container = profile.mcp.container;
458
+ const servers = asRecord2(config[container]);
459
+ if (!servers || servers.pushary === void 0) return false;
460
+ delete servers.pushary;
461
+ if (Object.keys(servers).length === 0) delete config[container];
462
+ return true;
463
+ }
414
464
  return profile.mcp.shape === "gemini_http" ? removeGeminiMcpServer(config) : removeClaudeMcpServers(config);
415
465
  };
416
466
 
417
467
  export {
468
+ readConfigDocument,
469
+ serializeConfigDocument,
418
470
  addClaudeMcpServer,
419
471
  isClaudeMcpSnapshot,
420
472
  captureClaudeMcpServer,
@@ -425,11 +477,16 @@ export {
425
477
  addPusharyToolPermissions,
426
478
  addPusharyHooks,
427
479
  removePusharySettings,
480
+ hasCompatibleMcpServer,
428
481
  profileFromArgv,
429
482
  activeIdentity,
430
483
  namedEvent,
431
484
  activeHookSource,
432
485
  normalizeToolCall,
486
+ grokHome,
487
+ compatibleFilePath,
488
+ compatibleDocuments,
489
+ compatibleTargetPaths,
433
490
  compatibleConfigFile,
434
491
  compatibleMcpFile,
435
492
  compatibleInstructionsFile,
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-3EGEA4KH.js";
10
10
  import {
11
11
  getBaseUrl
12
- } from "./chunk-3LS3GFJW.js";
12
+ } from "./chunk-PRKH662J.js";
13
13
 
14
14
  // src/cli/login-ui.ts
15
15
  import { hostname } from "os";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PRETOOLUSE_GATED_TOOLS
3
- } from "./chunk-7FQL5NWJ.js";
3
+ } from "./chunk-2DZBIELP.js";
4
4
 
5
5
  // src/claude-tools.ts
6
6
  var POSTTOOLUSE_MIRROR_ONLY_TOOLS = ["TodoWrite", "Task", "WebFetch", "WebSearch"];
@@ -3,11 +3,11 @@ import {
3
3
  decodePublicKey,
4
4
  generateSessionKey,
5
5
  wrapSessionKey
6
- } from "./chunk-CK3W7Q5S.js";
6
+ } from "./chunk-H3MOTS2C.js";
7
7
  import {
8
8
  fetchTranscriptRecipients,
9
9
  uploadTranscriptRecords
10
- } from "./chunk-4PIAOJAW.js";
10
+ } from "./chunk-X4BPD5RD.js";
11
11
 
12
12
  // src/live-session.ts
13
13
  var MAX_TRANSCRIPT_QUEUE = 100;
@@ -5,16 +5,16 @@ import {
5
5
  import {
6
6
  NOTIFICATION_MATCHED_TYPES,
7
7
  POSTTOOLUSE_MIRRORED_TOOLS
8
- } from "./chunk-DQKEGNTI.js";
8
+ } from "./chunk-U2PUHT4W.js";
9
9
  import {
10
10
  isProtectedByScope,
11
11
  registerHookEntry
12
- } from "./chunk-UPRNSD2T.js";
12
+ } from "./chunk-K5X25GUV.js";
13
13
  import {
14
14
  CLAUDE_PRETOOLUSE_MATCHER,
15
15
  HOOK_BUDGETS,
16
16
  HOOK_LOCATOR_BINARY
17
- } from "./chunk-7FQL5NWJ.js";
17
+ } from "./chunk-2DZBIELP.js";
18
18
 
19
19
  // src/gemini-config.ts
20
20
  var GEMINI_HOOK_BINARY = "pushary-gemini-hook";
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  macAppBridgeAvailable
3
- } from "./chunk-WFPXKCN4.js";
3
+ } from "./chunk-CHWJ7ZXI.js";
4
4
  import {
5
5
  keyPrefix
6
- } from "./chunk-DCBSD22V.js";
6
+ } from "./chunk-42FTY5II.js";
7
7
  import {
8
8
  bridgeAgentKey
9
- } from "./chunk-UPRNSD2T.js";
9
+ } from "./chunk-K5X25GUV.js";
10
10
  import {
11
11
  readJsonSafe
12
12
  } from "./chunk-AQFEP65J.js";
13
13
  import {
14
14
  isValidApiKey
15
- } from "./chunk-7FQL5NWJ.js";
15
+ } from "./chunk-2DZBIELP.js";
16
16
 
17
17
  // src/shared-mcp-key.ts
18
18
  var asRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getBaseUrl
3
- } from "./chunk-3LS3GFJW.js";
3
+ } from "./chunk-PRKH662J.js";
4
4
 
5
5
  // src/transcript-api.ts
6
6
  var fetchTranscriptRecipients = async (apiKey, baseUrl = getBaseUrl()) => {
@@ -4,14 +4,14 @@ import {
4
4
  } from "./chunk-XHKBHWLX.js";
5
5
  import {
6
6
  readControlMode
7
- } from "./chunk-DCBSD22V.js";
7
+ } from "./chunk-42FTY5II.js";
8
8
  import {
9
9
  getMachineId
10
- } from "./chunk-ULJFIF5N.js";
10
+ } from "./chunk-EGTVN6YV.js";
11
11
  import {
12
12
  pusharyDir,
13
13
  resolveGlobalBinary
14
- } from "./chunk-UPRNSD2T.js";
14
+ } from "./chunk-K5X25GUV.js";
15
15
  import {
16
16
  readJsonSafe,
17
17
  writeFileAtomic,
@@ -20,7 +20,7 @@ import {
20
20
  } from "./chunk-AQFEP65J.js";
21
21
  import {
22
22
  getApiKey
23
- } from "./chunk-3LS3GFJW.js";
23
+ } from "./chunk-PRKH662J.js";
24
24
  import {
25
25
  CLI_PACKAGE_NAMES,
26
26
  cmdShimTarget,
@@ -28,7 +28,7 @@ import {
28
28
  globalPackageFolder,
29
29
  globalRootFor,
30
30
  isRecord
31
- } from "./chunk-7FQL5NWJ.js";
31
+ } from "./chunk-2DZBIELP.js";
32
32
 
33
33
  // src/daemon-lifecycle.ts
34
34
  import { dirname, join, win32 as win32Path } from "path";
@@ -3,27 +3,27 @@ import {
3
3
  expectedLaunchCapabilities,
4
4
  hasSpawnProvider,
5
5
  resolveControlPolicy
6
- } from "./chunk-4TFD3WAA.js";
6
+ } from "./chunk-26AEFJSK.js";
7
7
  import {
8
8
  daemonHasRemoteProof,
9
9
  daemonServiceManagerAvailable,
10
10
  hasDaemonServiceDefinition,
11
11
  readDaemonNeedsLogin,
12
12
  readDaemonStatus
13
- } from "./chunk-FPYBX36E.js";
13
+ } from "./chunk-Y5FCB66K.js";
14
14
  import {
15
15
  readControlMode,
16
16
  readKeySource
17
- } from "./chunk-DCBSD22V.js";
17
+ } from "./chunk-42FTY5II.js";
18
18
  import {
19
19
  getMachineId
20
- } from "./chunk-ULJFIF5N.js";
20
+ } from "./chunk-EGTVN6YV.js";
21
21
  import {
22
22
  getBaseUrl
23
- } from "./chunk-3LS3GFJW.js";
23
+ } from "./chunk-PRKH662J.js";
24
24
  import {
25
25
  getPackageVersion
26
- } from "./chunk-7FQL5NWJ.js";
26
+ } from "./chunk-2DZBIELP.js";
27
27
 
28
28
  // src/machines.ts
29
29
  import { hostname } from "os";
@@ -5,15 +5,15 @@ import {
5
5
  readGlobalUpgradeSubject,
6
6
  upgradeInstalledPackage,
7
7
  withUpgradeLock
8
- } from "./chunk-LOYSI2CZ.js";
9
- import "./chunk-FQQSW7MD.js";
10
- import "./chunk-7UGGCTTW.js";
8
+ } from "./chunk-RYXSY3RH.js";
9
+ import "./chunk-55XIK7YS.js";
10
+ import "./chunk-HCKBZYBW.js";
11
11
  import "./chunk-POFBE6ZY.js";
12
12
  import "./chunk-KZERVKTD.js";
13
- import "./chunk-UPRNSD2T.js";
13
+ import "./chunk-K5X25GUV.js";
14
14
  import "./chunk-AQFEP65J.js";
15
- import "./chunk-45OXG3VR.js";
16
- import "./chunk-7FQL5NWJ.js";
15
+ import "./chunk-LL256PHP.js";
16
+ import "./chunk-2DZBIELP.js";
17
17
  export {
18
18
  finishGlobalUpgrade,
19
19
  finishUpgradeWithLock,
@@ -32,8 +32,8 @@ import {
32
32
  pusharyDir,
33
33
  vscodePluginDir,
34
34
  vscodePluginMcp
35
- } from "./chunk-UPRNSD2T.js";
36
- import "./chunk-7FQL5NWJ.js";
35
+ } from "./chunk-K5X25GUV.js";
36
+ import "./chunk-2DZBIELP.js";
37
37
  export {
38
38
  autoUpdateLock,
39
39
  autoUpdateLog,
@@ -11,34 +11,34 @@ import {
11
11
  reapplyOpenCodePlugin,
12
12
  reapplyVsCodePlugin,
13
13
  repairCodexHolds
14
- } from "./chunk-HJNCVY5F.js";
15
- import "./chunk-A455TSHF.js";
14
+ } from "./chunk-IPYCRJGM.js";
15
+ import "./chunk-CHNSFTD5.js";
16
16
  import "./chunk-RIVNNBEK.js";
17
17
  import "./chunk-XHKBHWLX.js";
18
- import "./chunk-WFPXKCN4.js";
19
- import "./chunk-7S7H7V5V.js";
20
- import "./chunk-6OGDGQTT.js";
21
- import "./chunk-QJ3ENGBT.js";
22
- import "./chunk-57FFQR46.js";
23
- import "./chunk-36ZCFJUI.js";
18
+ import "./chunk-CHWJ7ZXI.js";
19
+ import "./chunk-SHLLDMPM.js";
20
+ import "./chunk-4NMDFPK7.js";
21
+ import "./chunk-ULDOQF4Q.js";
22
+ import "./chunk-EQXMVKKD.js";
23
+ import "./chunk-5ML6E3L7.js";
24
24
  import "./chunk-GMXKITVA.js";
25
25
  import "./chunk-6ICPEJY5.js";
26
- import "./chunk-SMRMWDFE.js";
27
- import "./chunk-DQKEGNTI.js";
28
- import "./chunk-OZMGO4WF.js";
26
+ import "./chunk-6LKIK7V2.js";
27
+ import "./chunk-U2PUHT4W.js";
28
+ import "./chunk-FBKGGIFB.js";
29
29
  import "./chunk-POFBE6ZY.js";
30
- import "./chunk-H52HBSOD.js";
31
- import "./chunk-7IVV4LLF.js";
32
- import "./chunk-22YSHBTI.js";
33
- import "./chunk-ULJFIF5N.js";
30
+ import "./chunk-BS64ZHTB.js";
31
+ import "./chunk-GNESC5EF.js";
32
+ import "./chunk-CRZ4CP7C.js";
33
+ import "./chunk-EGTVN6YV.js";
34
34
  import "./chunk-7QLSKOSU.js";
35
35
  import "./chunk-KZERVKTD.js";
36
- import "./chunk-NMQLY4PE.js";
37
- import "./chunk-UPRNSD2T.js";
36
+ import "./chunk-5S2P2CK6.js";
37
+ import "./chunk-K5X25GUV.js";
38
38
  import "./chunk-AQFEP65J.js";
39
- import "./chunk-3LS3GFJW.js";
40
- import "./chunk-45OXG3VR.js";
41
- import "./chunk-7FQL5NWJ.js";
39
+ import "./chunk-PRKH662J.js";
40
+ import "./chunk-LL256PHP.js";
41
+ import "./chunk-2DZBIELP.js";
42
42
  export {
43
43
  ensureCodexTrustAfterReapply,
44
44
  inspectConfiguredManagedProviders,