@pushary/agent-hooks 1.9.49 → 1.9.51

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 (120) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +0 -1
  3. package/dist/api-PPNFRSJC.js +55 -0
  4. package/dist/bin/pushary-bell-hook.js +28 -25
  5. package/dist/bin/pushary-bell.js +13 -11
  6. package/dist/bin/pushary-claude.js +36 -32
  7. package/dist/bin/pushary-clean.js +68 -42
  8. package/dist/bin/pushary-codex-bridge.js +23 -20
  9. package/dist/bin/pushary-codex-hook.js +35 -31
  10. package/dist/bin/pushary-codex-session.js +17 -616
  11. package/dist/bin/pushary-codex.js +15 -12
  12. package/dist/bin/pushary-connect.js +31 -28
  13. package/dist/bin/pushary-cowork.js +7 -6
  14. package/dist/bin/pushary-daemon.js +55 -52
  15. package/dist/bin/pushary-disconnect.js +29 -26
  16. package/dist/bin/pushary-doctor.js +57 -52
  17. package/dist/bin/pushary-elicitation-hook.js +28 -25
  18. package/dist/bin/pushary-gemini-bridge.js +17 -15
  19. package/dist/bin/pushary-gemini-hook.js +32 -28
  20. package/dist/bin/pushary-hook.js +34 -31
  21. package/dist/bin/pushary-login.js +19 -16
  22. package/dist/bin/pushary-logout.js +30 -27
  23. package/dist/bin/pushary-mcp.js +11 -9
  24. package/dist/bin/pushary-mode.js +16 -14
  25. package/dist/bin/pushary-notification-hook.js +27 -24
  26. package/dist/bin/pushary-opencode-hook.js +31 -27
  27. package/dist/bin/pushary-permission-denied-hook.js +32 -29
  28. package/dist/bin/pushary-permission-hook.js +31 -28
  29. package/dist/bin/pushary-post-hook.js +27 -24
  30. package/dist/bin/pushary-prompt-hook.js +27 -24
  31. package/dist/bin/pushary-session-end-hook.js +27 -24
  32. package/dist/bin/pushary-session-start-hook.js +32 -29
  33. package/dist/bin/pushary-setup.js +145 -82
  34. package/dist/bin/pushary-stats.js +8 -7
  35. package/dist/bin/pushary-status.js +35 -32
  36. package/dist/bin/pushary-stop-hook.js +27 -24
  37. package/dist/bin/pushary-stopfailure-hook.js +27 -24
  38. package/dist/bin/pushary-suggestions.js +16 -14
  39. package/dist/bin/pushary-transcript-register.js +19 -17
  40. package/dist/bin/pushary-transcripts.js +10 -9
  41. package/dist/bin/pushary-upgrade.js +46 -42
  42. package/dist/bin/pushary-wait.js +16 -14
  43. package/dist/bin/pushary.js +10 -8
  44. package/dist/{chunk-IF2UPWD2.js → chunk-26MUPAKS.js} +1 -1
  45. package/dist/{chunk-AWMMABVB.js → chunk-2QPHUCXU.js} +49 -135
  46. package/dist/{chunk-WEY5ZHDB.js → chunk-2YSCVT6Q.js} +5 -5
  47. package/dist/chunk-36NGFHE4.js +72 -0
  48. package/dist/{chunk-25SYEAW4.js → chunk-3ICRY72Q.js} +3 -3
  49. package/dist/{chunk-LZYJMSOY.js → chunk-3OLEGCMU.js} +3 -3
  50. package/dist/{chunk-B7LV6W7U.js → chunk-3RPN7AAT.js} +1 -1
  51. package/dist/{chunk-VCZN7NAB.js → chunk-3YAOJEHG.js} +7 -5
  52. package/dist/{chunk-TGCIFEDE.js → chunk-43NXSBNZ.js} +13 -11
  53. package/dist/{chunk-Y74IJ2IO.js → chunk-4JM2CK2A.js} +4 -4
  54. package/dist/{chunk-KEAIIVW3.js → chunk-4QQEUJL4.js} +2 -2
  55. package/dist/{chunk-XNZB274I.js → chunk-5463UUO2.js} +1 -1
  56. package/dist/{chunk-ZMYLVFXC.js → chunk-5CRQCIHR.js} +14 -9
  57. package/dist/{chunk-KIO2MZQC.js → chunk-6QPRQVQM.js} +5 -3
  58. package/dist/{chunk-4PCJ6DYK.js → chunk-6SWMKF5E.js} +2 -2
  59. package/dist/{chunk-Y7WD72J7.js → chunk-7CLLWDCP.js} +1 -1
  60. package/dist/{chunk-TYTIDEBW.js → chunk-7DBTOPOT.js} +5 -5
  61. package/dist/chunk-7YAVKENV.js +271 -0
  62. package/dist/{chunk-34AQAQKW.js → chunk-AA2K3H7Y.js} +4 -4
  63. package/dist/{chunk-DH4BWFU7.js → chunk-AZHTI5JX.js} +5 -5
  64. package/dist/{chunk-PA54A437.js → chunk-BUXDR6US.js} +1 -1
  65. package/dist/{chunk-VUS6QGND.js → chunk-CQ5JGRML.js} +5 -1
  66. package/dist/{chunk-YVO4HIHX.js → chunk-DT5CACWZ.js} +12 -10
  67. package/dist/{chunk-LLRYP5TR.js → chunk-DT5Y55FI.js} +5 -5
  68. package/dist/{chunk-ZTTCYHOM.js → chunk-DUMZORSL.js} +8 -6
  69. package/dist/{chunk-XTVEW2NG.js → chunk-EGKD4S5H.js} +1 -1
  70. package/dist/{chunk-FPKQGWAF.js → chunk-EJCPHLY2.js} +2 -2
  71. package/dist/{chunk-YTYXFA5M.js → chunk-FI73DGNB.js} +1 -1
  72. package/dist/{chunk-JGNYCRB2.js → chunk-FV34HT35.js} +1 -1
  73. package/dist/{chunk-KK2DIUVV.js → chunk-GCN73COS.js} +1 -1
  74. package/dist/{chunk-SE4JFMLW.js → chunk-GTSI6NG6.js} +8 -6
  75. package/dist/chunk-JBT3ZSJS.js +92 -0
  76. package/dist/chunk-JZDRR7BL.js +427 -0
  77. package/dist/{chunk-KBGKWB5T.js → chunk-K3BIMGP4.js} +4 -2
  78. package/dist/{chunk-LY3OJFBW.js → chunk-KQBXPGXO.js} +2 -1
  79. package/dist/{chunk-OR5F63C2.js → chunk-LF3TLC7B.js} +2 -168
  80. package/dist/{chunk-QYBL4EHD.js → chunk-LXRQLDGW.js} +11 -11
  81. package/dist/{chunk-ZOKMGBPR.js → chunk-MC4VY5LK.js} +16 -5
  82. package/dist/{chunk-OW4DNSQ6.js → chunk-NSY2V7XU.js} +1 -1
  83. package/dist/{chunk-X3RCIOIH.js → chunk-ONCWYACA.js} +1 -1
  84. package/dist/{chunk-EP6S6VY3.js → chunk-PMJEN6CX.js} +6 -6
  85. package/dist/{chunk-K73CBZKW.js → chunk-PTNSIGLB.js} +4 -4
  86. package/dist/chunk-PVDSN6TB.js +729 -0
  87. package/dist/chunk-QTOLNRET.js +169 -0
  88. package/dist/{chunk-APASKZ2I.js → chunk-RLADRNPV.js} +5 -3
  89. package/dist/{chunk-BOVSUH4N.js → chunk-S6RNS4UL.js} +2 -2
  90. package/dist/{chunk-34RXPM5U.js → chunk-SRXBOMSR.js} +3 -3
  91. package/dist/{chunk-HXRH7ZCK.js → chunk-TQ6AGJVH.js} +2 -2
  92. package/dist/{chunk-SALUTWPX.js → chunk-UKX5WIB5.js} +4 -4
  93. package/dist/{chunk-ABMEBN2R.js → chunk-UR7XX2DV.js} +6 -4
  94. package/dist/{chunk-BXK6ZJVJ.js → chunk-UVT6B6XN.js} +2 -2
  95. package/dist/{chunk-5Q2FRMPC.js → chunk-VD2OAF7Q.js} +4 -4
  96. package/dist/{chunk-XH3F66VD.js → chunk-VYBH6D4X.js} +3 -3
  97. package/dist/{chunk-UCF3EZZL.js → chunk-VZRCM362.js} +13 -13
  98. package/dist/{chunk-7RMSB4A2.js → chunk-W26Q2DTD.js} +14 -12
  99. package/dist/{chunk-OWQHE2VV.js → chunk-WVSM3G4C.js} +19 -4
  100. package/dist/{chunk-GDDXGBTM.js → chunk-X5GHIFST.js} +2 -2
  101. package/dist/chunk-XCEN33UP.js +7 -0
  102. package/dist/{chunk-UHVD7BSV.js → chunk-XQHPHJHR.js} +6 -6
  103. package/dist/{chunk-OZLGTMIY.js → chunk-XSUJ2PQY.js} +2 -2
  104. package/dist/{chunk-ZYYQJSIO.js → chunk-YQDZ7ZIL.js} +44 -462
  105. package/dist/{chunk-PXUNPXOX.js → chunk-ZOP3I2GQ.js} +3 -3
  106. package/dist/{chunk-WLT6J3SB.js → chunk-ZXGDBCIH.js} +2 -2
  107. package/dist/codex-app-cards-switch-ZQRT7MXB.js +52 -0
  108. package/dist/codex-desktop-launch-X7UKQ4VR.js +27 -0
  109. package/dist/codex-session-launch-IX33LOQZ.js +331 -0
  110. package/dist/config-HX6ZNOIL.js +14 -0
  111. package/dist/{global-upgrade-AIUSS2YH.js → global-upgrade-DGP2E2NE.js} +8 -6
  112. package/dist/identity-YISWVJ2A.js +15 -0
  113. package/dist/live-capabilities-44KFBOD4.js +53 -0
  114. package/dist/{paths-RO34TYNM.js → paths-VLGX4GJA.js} +4 -2
  115. package/dist/{reapply-KTNPP4XE.js → reapply-35F3WDTB.js} +24 -21
  116. package/dist/src/index.d.ts +3 -3
  117. package/dist/src/index.js +22 -19
  118. package/dist/{upgrade-lock-5UAGXIW7.js → upgrade-lock-LMO3DSSU.js} +5 -3
  119. package/dist/usage-ZC6BKIE3.js +10 -0
  120. package/package.json +1 -1
@@ -5,28 +5,61 @@ import {
5
5
  import {
6
6
  SubscriptionRequiredError,
7
7
  callMcpTool
8
- } from "./chunk-LZYJMSOY.js";
8
+ } from "./chunk-3OLEGCMU.js";
9
9
  import {
10
10
  installNetworkDefaults,
11
11
  isNetworkFailure
12
- } from "./chunk-ABMEBN2R.js";
12
+ } from "./chunk-UR7XX2DV.js";
13
13
  import {
14
14
  clientReportClaims
15
- } from "./chunk-ZYYQJSIO.js";
15
+ } from "./chunk-YQDZ7ZIL.js";
16
16
  import {
17
17
  getApiKey,
18
18
  getBaseUrl
19
- } from "./chunk-VUS6QGND.js";
19
+ } from "./chunk-CQ5JGRML.js";
20
20
  import {
21
21
  ASK_AGENT_NAME_MAX,
22
22
  CLIENT_REPORT_PATH,
23
23
  DECISION_LINE_MAX,
24
24
  GATE_PERMISSION_MODE_MAX_LENGTH,
25
25
  degradedLine,
26
- localRepoKey,
27
- normalizeRepoRemote,
28
26
  truncateLine
29
- } from "./chunk-OR5F63C2.js";
27
+ } from "./chunk-LF3TLC7B.js";
28
+
29
+ // src/api.ts
30
+ import { randomUUID } from "crypto";
31
+
32
+ // src/validate.ts
33
+ var isPolicyConfig = (data) => {
34
+ if (!data || typeof data !== "object") return false;
35
+ const d = data;
36
+ return (d.resolvedAgent === void 0 || typeof d.resolvedAgent === "string") && Array.isArray(d.policies) && typeof d.defaultTimeoutSeconds === "number" && typeof d.defaultTimeoutAction === "string";
37
+ };
38
+ var isAskUserResponse = (data) => {
39
+ if (!data || typeof data !== "object") return false;
40
+ const d = data;
41
+ return typeof d.correlationId === "string" && typeof d.status === "string" && (d.answered === void 0 || typeof d.answered === "boolean") && (d.value === void 0 || typeof d.value === "string") && (d.note === void 0 || typeof d.note === "string") && (d.waitEndsAt === void 0 || typeof d.waitEndsAt === "string");
42
+ };
43
+ var isWaitForAnswerResponse = (data) => {
44
+ if (!data || typeof data !== "object") return false;
45
+ const d = data;
46
+ return typeof d.answered === "boolean";
47
+ };
48
+ var GATE_REPLY_KINDS = ["kill", "allow", "deny", "ask", "no_opinion"];
49
+ var isSettlementOutputs = (value) => {
50
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
51
+ const outputs = value;
52
+ return (outputs.approve === void 0 || typeof outputs.approve === "string") && (outputs.deny === void 0 || typeof outputs.deny === "string");
53
+ };
54
+ var isGateReply = (data) => {
55
+ if (!data || typeof data !== "object") return false;
56
+ const d = data;
57
+ return GATE_REPLY_KINDS.includes(d.kind) && (d.output === void 0 || typeof d.output === "string") && (d.correlationId === void 0 || typeof d.correlationId === "string") && (d.deadlineSeconds === void 0 || typeof d.deadlineSeconds === "number") && (d.noDevices === void 0 || typeof d.noDevices === "boolean") && (d.suppressed === void 0 || typeof d.suppressed === "boolean") && (d.settlementOutputs === void 0 || isSettlementOutputs(d.settlementOutputs));
58
+ };
59
+ var isBlockedActionClaim = (data) => {
60
+ if (!data || typeof data !== "object") return false;
61
+ return typeof data.granted === "boolean";
62
+ };
30
63
 
31
64
  // src/client-report-claim.ts
32
65
  import { createHash } from "crypto";
@@ -145,41 +178,6 @@ var writeDegraded = (subsystem, report) => {
145
178
  void reportClientError({ kind: "degraded", code: `${subsystem}:${report.reason}` });
146
179
  };
147
180
 
148
- // src/api.ts
149
- import { randomUUID } from "crypto";
150
-
151
- // src/validate.ts
152
- var isPolicyConfig = (data) => {
153
- if (!data || typeof data !== "object") return false;
154
- const d = data;
155
- return (d.resolvedAgent === void 0 || typeof d.resolvedAgent === "string") && Array.isArray(d.policies) && typeof d.defaultTimeoutSeconds === "number" && typeof d.defaultTimeoutAction === "string";
156
- };
157
- var isAskUserResponse = (data) => {
158
- if (!data || typeof data !== "object") return false;
159
- const d = data;
160
- return typeof d.correlationId === "string" && typeof d.status === "string" && (d.answered === void 0 || typeof d.answered === "boolean") && (d.value === void 0 || typeof d.value === "string") && (d.note === void 0 || typeof d.note === "string") && (d.waitEndsAt === void 0 || typeof d.waitEndsAt === "string");
161
- };
162
- var isWaitForAnswerResponse = (data) => {
163
- if (!data || typeof data !== "object") return false;
164
- const d = data;
165
- return typeof d.answered === "boolean";
166
- };
167
- var GATE_REPLY_KINDS = ["kill", "allow", "deny", "ask", "no_opinion"];
168
- var isSettlementOutputs = (value) => {
169
- if (!value || typeof value !== "object" || Array.isArray(value)) return false;
170
- const outputs = value;
171
- return (outputs.approve === void 0 || typeof outputs.approve === "string") && (outputs.deny === void 0 || typeof outputs.deny === "string");
172
- };
173
- var isGateReply = (data) => {
174
- if (!data || typeof data !== "object") return false;
175
- const d = data;
176
- return GATE_REPLY_KINDS.includes(d.kind) && (d.output === void 0 || typeof d.output === "string") && (d.correlationId === void 0 || typeof d.correlationId === "string") && (d.deadlineSeconds === void 0 || typeof d.deadlineSeconds === "number") && (d.noDevices === void 0 || typeof d.noDevices === "boolean") && (d.suppressed === void 0 || typeof d.suppressed === "boolean") && (d.settlementOutputs === void 0 || isSettlementOutputs(d.settlementOutputs));
177
- };
178
- var isBlockedActionClaim = (data) => {
179
- if (!data || typeof data !== "object") return false;
180
- return typeof data.granted === "boolean";
181
- };
182
-
183
181
  // src/api.ts
184
182
  installNetworkDefaults();
185
183
  var isDecisionStopped = (result) => result.handoffAction === "stop" || ["cancelled", "unavailable", "stopped", "missing"].includes(result.status ?? "");
@@ -202,17 +200,17 @@ var withinAskUserLimits = (params) => ({
202
200
  blocker: truncateOptional(params.blocker, DECISION_LINE_MAX),
203
201
  permissionMode: boundedPermissionMode(params.permissionMode)
204
202
  });
205
- var askUser = async (apiKey, params, timeoutMs = 15e3) => {
203
+ var askUser = async (apiKey, params, timeoutMs = 15e3, baseUrl) => {
206
204
  const identified = params.toolUseId || params.requestId ? params : { ...params, requestId: randomUUID() };
207
- const result = await callMcpTool(apiKey, "ask_user", { ...withinAskUserLimits(identified), pausedAware: true, wait: false }, { maxRetries: 3, timeoutMs });
205
+ const result = await callMcpTool(apiKey, "ask_user", { ...withinAskUserLimits(identified), pausedAware: true, wait: false }, { maxRetries: 3, timeoutMs, baseUrl });
208
206
  if (!isAskUserResponse(result)) throw new Error("Invalid ask_user response");
209
207
  return result;
210
208
  };
211
- var waitForAnswer = async (apiKey, correlationId, timeoutMs = 3e4, signal) => {
209
+ var waitForAnswer = async (apiKey, correlationId, timeoutMs = 3e4, signal, baseUrl) => {
212
210
  const result = await callMcpTool(apiKey, "wait_for_answer", {
213
211
  correlationId,
214
212
  timeoutMs
215
- }, { timeoutMs: timeoutMs + 1e4, signal });
213
+ }, { timeoutMs: timeoutMs + 1e4, signal, baseUrl });
216
214
  if (!isWaitForAnswerResponse(result)) throw new Error("Invalid wait_for_answer response");
217
215
  return result;
218
216
  };
@@ -224,7 +222,7 @@ var nextLongPollMs = (deadlineMs, nowMs) => {
224
222
  return hold >= MIN_LONG_POLL_MS ? hold : null;
225
223
  };
226
224
  var pollForAnswer = async (apiKey, correlationId, deadlineMs, pollInterval = 2e3) => {
227
- const sleep = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
225
+ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
228
226
  while (Date.now() < deadlineMs) {
229
227
  const hold = nextLongPollMs(deadlineMs, Date.now());
230
228
  if (hold === null) {
@@ -244,8 +242,8 @@ var pollForAnswer = async (apiKey, correlationId, deadlineMs, pollInterval = 2e3
244
242
  }
245
243
  return withdrawQuestion(apiKey, correlationId);
246
244
  };
247
- var cancelQuestion = async (apiKey, correlationId, signal) => {
248
- return callMcpTool(apiKey, "cancel_question", { correlationId }, { signal, timeoutMs: 4e3, maxRetries: 1 });
245
+ var cancelQuestion = async (apiKey, correlationId, signal, baseUrl) => {
246
+ return callMcpTool(apiKey, "cancel_question", { correlationId }, { signal, timeoutMs: 4e3, maxRetries: 1, baseUrl });
249
247
  };
250
248
  var withdrawQuestion = async (apiKey, correlationId, transport = { cancelQuestion, waitForAnswer }) => {
251
249
  try {
@@ -298,90 +296,6 @@ var claimBlockedAction = async (apiKey, request, timeoutMs) => {
298
296
  }
299
297
  };
300
298
 
301
- // src/repo.ts
302
- import { existsSync, readFileSync, statSync } from "fs";
303
- import { basename, dirname, isAbsolute, join as join2, resolve } from "path";
304
- var MAX_PARENT_WALK = 64;
305
- var GIT_FILE_PREFIX = "gitdir:";
306
- var findGitDir = (startDir) => {
307
- let current = resolve(startDir);
308
- for (let depth = 0; depth < MAX_PARENT_WALK; depth += 1) {
309
- const candidate = join2(current, ".git");
310
- try {
311
- if (existsSync(candidate)) {
312
- if (statSync(candidate).isDirectory()) return candidate;
313
- const pointer = readFileSync(candidate, "utf-8").trim();
314
- if (pointer.startsWith(GIT_FILE_PREFIX)) {
315
- const target = pointer.slice(GIT_FILE_PREFIX.length).trim();
316
- return isAbsolute(target) ? target : resolve(current, target);
317
- }
318
- }
319
- } catch {
320
- }
321
- const parent = dirname(current);
322
- if (parent === current) return void 0;
323
- current = parent;
324
- }
325
- return void 0;
326
- };
327
- var configPathFor = (gitDir) => {
328
- const index = gitDir.replace(/\\/g, "/").indexOf("/worktrees/");
329
- return index === -1 ? join2(gitDir, "config") : join2(gitDir.slice(0, index), "config");
330
- };
331
- var ORIGIN_SECTION = /^\[remote "origin"\]/;
332
- var SECTION_HEADER = /^\[/;
333
- var URL_LINE = /^url\s*=\s*(.+)$/;
334
- var readOriginRemote = (gitDir) => {
335
- try {
336
- const configPath = configPathFor(gitDir);
337
- if (!existsSync(configPath)) return void 0;
338
- let inOrigin = false;
339
- for (const rawLine of readFileSync(configPath, "utf-8").split("\n")) {
340
- const line = rawLine.trim();
341
- if (SECTION_HEADER.test(line)) {
342
- inOrigin = ORIGIN_SECTION.test(line);
343
- continue;
344
- }
345
- if (!inOrigin) continue;
346
- const url = URL_LINE.exec(line);
347
- if (url) return url[1]?.trim();
348
- }
349
- } catch {
350
- }
351
- return void 0;
352
- };
353
- var deriveRepoKey = (cwd) => {
354
- const dir = cwd && cwd.length > 0 ? cwd : process.cwd();
355
- try {
356
- const gitDir = findGitDir(dir);
357
- if (gitDir) {
358
- const remote = readOriginRemote(gitDir);
359
- const normalized = remote ? normalizeRepoRemote(remote) : void 0;
360
- if (normalized) return normalized;
361
- const root = gitDir.endsWith(".git") ? dirname(gitDir) : dir;
362
- return localRepoKey(basename(root));
363
- }
364
- return localRepoKey(basename(resolve(dir)));
365
- } catch {
366
- return void 0;
367
- }
368
- };
369
- var repoKeyCache = /* @__PURE__ */ new Map();
370
- var REPO_KEY_ENV = "PUSHARY_REPO_KEY";
371
- var repoKeyFor = (cwd) => {
372
- const override = process.env[REPO_KEY_ENV];
373
- if (typeof override === "string") {
374
- const trimmed = override.trim();
375
- if (trimmed.toLowerCase() === "off") return void 0;
376
- if (trimmed.length > 0) return trimmed.toLowerCase();
377
- }
378
- const dir = cwd && cwd.length > 0 ? cwd : process.cwd();
379
- if (repoKeyCache.has(dir)) return repoKeyCache.get(dir);
380
- const derived = deriveRepoKey(dir);
381
- repoKeyCache.set(dir, derived);
382
- return derived;
383
- };
384
-
385
299
  export {
386
300
  reportClientError,
387
301
  exitAfterClientReports,
@@ -397,6 +311,7 @@ export {
397
311
  unavailableQuestionUnlessSubscriptionRequired,
398
312
  askUser,
399
313
  waitForAnswer,
314
+ WAIT_RESPONSE_GRACE_MS,
400
315
  nextLongPollMs,
401
316
  pollForAnswer,
402
317
  cancelQuestion,
@@ -404,6 +319,5 @@ export {
404
319
  waitForQuestion,
405
320
  sendNotification,
406
321
  requestGate,
407
- claimBlockedAction,
408
- repoKeyFor
322
+ claimBlockedAction
409
323
  };
@@ -2,23 +2,23 @@ import {
2
2
  CLAUDE_HOOK_EVENTS,
3
3
  GEMINI_HOOK_EVENTS,
4
4
  hasGeminiHooks
5
- } from "./chunk-25SYEAW4.js";
5
+ } from "./chunk-3ICRY72Q.js";
6
6
  import {
7
7
  AGENT_CHOICES
8
- } from "./chunk-PA54A437.js";
8
+ } from "./chunk-BUXDR6US.js";
9
9
  import {
10
10
  BELL_HOOK_BINARY
11
- } from "./chunk-XTVEW2NG.js";
11
+ } from "./chunk-EGKD4S5H.js";
12
12
  import {
13
13
  CODEX_HOOK_EVENTS,
14
14
  hasCodexHooks,
15
15
  holdBudgetOf
16
- } from "./chunk-ZYYQJSIO.js";
16
+ } from "./chunk-YQDZ7ZIL.js";
17
17
  import {
18
18
  CURSOR_GATE_EVENTS,
19
19
  HOOK_LOCATOR_BINARY,
20
20
  hookCommandHoldBudget
21
- } from "./chunk-OR5F63C2.js";
21
+ } from "./chunk-LF3TLC7B.js";
22
22
 
23
23
  // src/diagnostics/bridge.ts
24
24
  import { execFileSync } from "child_process";
@@ -0,0 +1,72 @@
1
+ // src/codex-engine-fallback.ts
2
+ import { spawn } from "child_process";
3
+ import { rmSync } from "fs";
4
+ import { join } from "path";
5
+ var CODEX_APP_LAUNCH_VARIABLE = "CODEX_CLI_PATH";
6
+ var CODEX_ENGINE_PENDING_VARIABLE = "PUSHARY_CODEX_ENGINE_PENDING";
7
+ var CODEX_ENGINE_DIRECTORY = "Contents/Resources/codex-cli";
8
+ var CODEX_ENGINE_ENTRYPOINT = "bin/codex";
9
+ var CODEX_ENGINE_MANIFEST = "codex-package.json";
10
+ var FORWARDED_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
11
+ var COULD_NOT_RUN = 1;
12
+ var LEFT_TO_THE_LAUNCHER = 1;
13
+ var RUNS_WITHOUT_PUSHARY = "[pushary] Pushary could not start, so Codex runs without it.\n";
14
+ var NO_SUCH_PROCESS = "ESRCH";
15
+ var ADOPTED_BY_THE_SYSTEM = 1;
16
+ var codexEngineInside = (app) => join(app, CODEX_ENGINE_DIRECTORY, CODEX_ENGINE_ENTRYPOINT);
17
+ var codexEngineEnvironment = (engine) => {
18
+ const { [CODEX_ENGINE_PENDING_VARIABLE]: _pending, ...inherited } = process.env;
19
+ return { ...inherited, [CODEX_APP_LAUNCH_VARIABLE]: engine };
20
+ };
21
+ var launcherWaitingOnThisProcess = () => process.env[CODEX_ENGINE_PENDING_VARIABLE] ? process.ppid : null;
22
+ var launcherIsGone = (launcher) => {
23
+ if (launcher === ADOPTED_BY_THE_SYSTEM) return true;
24
+ try {
25
+ process.kill(launcher, 0);
26
+ return false;
27
+ } catch (error) {
28
+ return error instanceof Error && "code" in error && error.code === NO_SUCH_PROCESS;
29
+ }
30
+ };
31
+ var tellTheLauncherTheEngineStarted = () => {
32
+ const pending = process.env[CODEX_ENGINE_PENDING_VARIABLE];
33
+ if (!pending) return;
34
+ try {
35
+ rmSync(pending, { force: true });
36
+ } catch {
37
+ return;
38
+ }
39
+ };
40
+ var runTheEngineWithoutPushary = (app, engineArgs) => new Promise((resolve) => {
41
+ const engine = codexEngineInside(app);
42
+ const child = spawn(engine, [...engineArgs], { stdio: "inherit", env: codexEngineEnvironment(engine) });
43
+ const forward = (signal) => {
44
+ child.kill(signal);
45
+ };
46
+ const finish = (code) => {
47
+ for (const signal of FORWARDED_SIGNALS) process.off(signal, forward);
48
+ resolve(code);
49
+ };
50
+ for (const signal of FORWARDED_SIGNALS) process.on(signal, forward);
51
+ child.once("error", () => finish(COULD_NOT_RUN));
52
+ child.once("close", (code) => finish(code ?? COULD_NOT_RUN));
53
+ });
54
+ var letCodexRunWithoutPushary = (app, engineArgs) => {
55
+ if (launcherWaitingOnThisProcess() !== null) return Promise.resolve(LEFT_TO_THE_LAUNCHER);
56
+ process.stderr.write(RUNS_WITHOUT_PUSHARY);
57
+ return runTheEngineWithoutPushary(app, engineArgs);
58
+ };
59
+
60
+ export {
61
+ CODEX_APP_LAUNCH_VARIABLE,
62
+ CODEX_ENGINE_PENDING_VARIABLE,
63
+ CODEX_ENGINE_DIRECTORY,
64
+ CODEX_ENGINE_ENTRYPOINT,
65
+ CODEX_ENGINE_MANIFEST,
66
+ codexEngineInside,
67
+ codexEngineEnvironment,
68
+ launcherWaitingOnThisProcess,
69
+ launcherIsGone,
70
+ tellTheLauncherTheEngineStarted,
71
+ letCodexRunWithoutPushary
72
+ };
@@ -5,16 +5,16 @@ import {
5
5
  import {
6
6
  NOTIFICATION_MATCHED_TYPES,
7
7
  POSTTOOLUSE_MIRRORED_TOOLS
8
- } from "./chunk-B7LV6W7U.js";
8
+ } from "./chunk-3RPN7AAT.js";
9
9
  import {
10
10
  isProtectedByScope,
11
11
  registerHookEntry
12
- } from "./chunk-ZYYQJSIO.js";
12
+ } from "./chunk-YQDZ7ZIL.js";
13
13
  import {
14
14
  CLAUDE_PRETOOLUSE_MATCHER,
15
15
  HOOK_BUDGETS,
16
16
  HOOK_LOCATOR_BINARY
17
- } from "./chunk-OR5F63C2.js";
17
+ } from "./chunk-LF3TLC7B.js";
18
18
 
19
19
  // src/gemini-config.ts
20
20
  var GEMINI_HOOK_BINARY = "pushary-gemini-hook";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  keyCheckFromResponse
3
- } from "./chunk-34RXPM5U.js";
3
+ } from "./chunk-SRXBOMSR.js";
4
4
  import {
5
5
  installNetworkDefaults
6
- } from "./chunk-ABMEBN2R.js";
6
+ } from "./chunk-UR7XX2DV.js";
7
7
  import {
8
8
  getBaseUrl
9
- } from "./chunk-VUS6QGND.js";
9
+ } from "./chunk-CQ5JGRML.js";
10
10
 
11
11
  // src/retry.ts
12
12
  var isRetryable = (err) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PRETOOLUSE_GATED_TOOLS
3
- } from "./chunk-OR5F63C2.js";
3
+ } from "./chunk-LF3TLC7B.js";
4
4
 
5
5
  // src/claude-tools.ts
6
6
  var POSTTOOLUSE_MIRROR_ONLY_TOOLS = ["TodoWrite", "Task", "WebFetch", "WebSearch"];
@@ -1,16 +1,18 @@
1
1
  import {
2
2
  openCodeConfigDirFrom
3
- } from "./chunk-LLRYP5TR.js";
3
+ } from "./chunk-DT5Y55FI.js";
4
4
  import {
5
5
  grokHome
6
- } from "./chunk-Y74IJ2IO.js";
6
+ } from "./chunk-4JM2CK2A.js";
7
+ import {
8
+ codexHomeFrom
9
+ } from "./chunk-YQDZ7ZIL.js";
7
10
  import {
8
- codexHomeFrom,
9
11
  resolvePathBinary
10
- } from "./chunk-ZYYQJSIO.js";
12
+ } from "./chunk-JZDRR7BL.js";
11
13
  import {
12
14
  HOOK_COMPATIBLE_PROFILES
13
- } from "./chunk-OR5F63C2.js";
15
+ } from "./chunk-LF3TLC7B.js";
14
16
 
15
17
  // src/hermes-config.ts
16
18
  import { execFileSync } from "child_process";
@@ -4,19 +4,19 @@ import {
4
4
  outcomeOfFailedAsk,
5
5
  reportMachineDenial,
6
6
  storedWaitDeadline
7
- } from "./chunk-EP6S6VY3.js";
7
+ } from "./chunk-PMJEN6CX.js";
8
8
  import {
9
9
  isGatingMoment,
10
10
  recordKeylessMoment
11
- } from "./chunk-Y7WD72J7.js";
11
+ } from "./chunk-7CLLWDCP.js";
12
12
  import {
13
13
  isDeferAnswer,
14
14
  oncePerSession
15
- } from "./chunk-IF2UPWD2.js";
15
+ } from "./chunk-26MUPAKS.js";
16
16
  import {
17
17
  activeHookSource,
18
18
  activeIdentity
19
- } from "./chunk-Y74IJ2IO.js";
19
+ } from "./chunk-4JM2CK2A.js";
20
20
  import {
21
21
  DEFAULT_SESSION,
22
22
  UNNAMED_ACTION,
@@ -40,7 +40,10 @@ import {
40
40
  reportEvent,
41
41
  scopePathFor,
42
42
  settleQuestionsForToolUse
43
- } from "./chunk-YVO4HIHX.js";
43
+ } from "./chunk-DT5CACWZ.js";
44
+ import {
45
+ repoKeyFor
46
+ } from "./chunk-JBT3ZSJS.js";
44
47
  import {
45
48
  askUser,
46
49
  cancelQuestion,
@@ -49,22 +52,21 @@ import {
49
52
  isDecisionStopped,
50
53
  isLocalQuestionHandoff,
51
54
  pollForAnswer,
52
- repoKeyFor,
53
55
  requestGate,
54
56
  sendNotification,
55
57
  waitForQuestion,
56
58
  waitsForThePhone
57
- } from "./chunk-AWMMABVB.js";
59
+ } from "./chunk-2QPHUCXU.js";
58
60
  import {
59
61
  getMachineId
60
- } from "./chunk-LY3OJFBW.js";
62
+ } from "./chunk-KQBXPGXO.js";
61
63
  import {
62
64
  getApiKey,
63
65
  getBaseUrl
64
- } from "./chunk-VUS6QGND.js";
66
+ } from "./chunk-CQ5JGRML.js";
65
67
  import {
66
68
  NPX_LATEST_COMMAND
67
- } from "./chunk-ZOKMGBPR.js";
69
+ } from "./chunk-MC4VY5LK.js";
68
70
  import {
69
71
  AGENT_QUESTION_STRATEGY,
70
72
  AGENT_QUESTION_TOOL,
@@ -109,7 +111,7 @@ import {
109
111
  resolveGate,
110
112
  timeoutActionWithoutLocalPrompt,
111
113
  unansweredRefusalReason
112
- } from "./chunk-OR5F63C2.js";
114
+ } from "./chunk-LF3TLC7B.js";
113
115
 
114
116
  // src/claude-permission-rules.ts
115
117
  import { readFileSync, statSync } from "fs";
@@ -3,18 +3,18 @@ import {
3
3
  addGeminiMcpServer,
4
4
  removeGeminiMcpServer,
5
5
  supportedClaudeEvents
6
- } from "./chunk-25SYEAW4.js";
6
+ } from "./chunk-3ICRY72Q.js";
7
7
  import {
8
8
  CLAUDE_CODE_AGENT,
9
9
  compatibleToolLookup
10
- } from "./chunk-YVO4HIHX.js";
10
+ } from "./chunk-DT5CACWZ.js";
11
11
  import {
12
12
  guardBinary,
13
13
  guardBinaryRefusing,
14
14
  holdBudgetOf,
15
15
  isProtectedByScope,
16
16
  registerHookEntry
17
- } from "./chunk-ZYYQJSIO.js";
17
+ } from "./chunk-YQDZ7ZIL.js";
18
18
  import {
19
19
  HOOK_LOCATOR_BINARY,
20
20
  PHONE_ANSWERED_TOOLS,
@@ -25,7 +25,7 @@ import {
25
25
  pusharyMissingReason,
26
26
  refusalOutput,
27
27
  withHookHoldBudget
28
- } from "./chunk-OR5F63C2.js";
28
+ } from "./chunk-LF3TLC7B.js";
29
29
 
30
30
  // src/claude-config.ts
31
31
  import { join } from "path";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  configFilePath
3
- } from "./chunk-VUS6QGND.js";
3
+ } from "./chunk-CQ5JGRML.js";
4
4
  import {
5
5
  normalizeInstallSource
6
- } from "./chunk-OR5F63C2.js";
6
+ } from "./chunk-LF3TLC7B.js";
7
7
 
8
8
  // src/install-source.ts
9
9
  import { readFileSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  redactSecretsFromContent
3
- } from "./chunk-OR5F63C2.js";
3
+ } from "./chunk-LF3TLC7B.js";
4
4
 
5
5
  // src/crypto.ts
6
6
  import nacl from "tweetnacl";
@@ -1,17 +1,19 @@
1
- import {
2
- readControlMode
3
- } from "./chunk-XH3F66VD.js";
4
1
  import {
5
2
  needsShell,
6
3
  spawnClaude
7
4
  } from "./chunk-XHKBHWLX.js";
5
+ import {
6
+ readControlMode
7
+ } from "./chunk-VYBH6D4X.js";
8
8
  import {
9
9
  getMachineId
10
- } from "./chunk-LY3OJFBW.js";
10
+ } from "./chunk-KQBXPGXO.js";
11
+ import {
12
+ pusharyDir
13
+ } from "./chunk-YQDZ7ZIL.js";
11
14
  import {
12
- pusharyDir,
13
15
  resolveGlobalBinary
14
- } from "./chunk-ZYYQJSIO.js";
16
+ } from "./chunk-JZDRR7BL.js";
15
17
  import {
16
18
  readJsonSafe,
17
19
  writeFileAtomic,
@@ -20,15 +22,17 @@ import {
20
22
  } from "./chunk-AQFEP65J.js";
21
23
  import {
22
24
  getApiKey
23
- } from "./chunk-VUS6QGND.js";
25
+ } from "./chunk-CQ5JGRML.js";
24
26
  import {
25
27
  CLI_PACKAGE_NAMES,
26
28
  cmdShimTarget,
27
29
  getPackageVersion,
28
30
  globalPackageFolder,
29
- globalRootFor,
31
+ globalRootFor
32
+ } from "./chunk-QTOLNRET.js";
33
+ import {
30
34
  isRecord
31
- } from "./chunk-OR5F63C2.js";
35
+ } from "./chunk-LF3TLC7B.js";
32
36
 
33
37
  // src/daemon-lifecycle.ts
34
38
  import { dirname, join, win32 as win32Path } from "path";
@@ -1121,6 +1125,7 @@ export {
1121
1125
  daemonHasRemoteProof,
1122
1126
  daemonServiceManagerAvailable,
1123
1127
  DAEMON_LEASE_RENEW_INTERVAL_MS,
1128
+ xml,
1124
1129
  parseDaemonAction,
1125
1130
  manageDaemonService,
1126
1131
  hasDaemonServiceDefinition,
@@ -6,12 +6,14 @@ import {
6
6
  CODEX_REQUIRED_APPROVAL_EVENTS,
7
7
  codexHome,
8
8
  codexHooksJsonIn,
9
- isPusharyCodexCommand,
9
+ isPusharyCodexCommand
10
+ } from "./chunk-YQDZ7ZIL.js";
11
+ import {
10
12
  resolvePathBinary
11
- } from "./chunk-ZYYQJSIO.js";
13
+ } from "./chunk-JZDRR7BL.js";
12
14
  import {
13
15
  getPackageVersion
14
- } from "./chunk-OR5F63C2.js";
16
+ } from "./chunk-QTOLNRET.js";
15
17
 
16
18
  // src/codex-app-server.ts
17
19
  import { existsSync, realpathSync } from "fs";
@@ -4,10 +4,10 @@ import {
4
4
  keyPrefix,
5
5
  readConfigFileKey,
6
6
  readMacAppKeyPrefix
7
- } from "./chunk-XH3F66VD.js";
7
+ } from "./chunk-VYBH6D4X.js";
8
8
  import {
9
9
  NPX_LATEST_COMMAND
10
- } from "./chunk-ZOKMGBPR.js";
10
+ } from "./chunk-MC4VY5LK.js";
11
11
 
12
12
  // src/key-signed-out.ts
13
13
  var VERDICT_BY_CHECK = {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSafeReadOnlyCommand
3
- } from "./chunk-OR5F63C2.js";
3
+ } from "./chunk-LF3TLC7B.js";
4
4
 
5
5
  // src/ledger.ts
6
6
  import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync } from "fs";