@pushary/agent-hooks 1.7.0 → 1.7.2

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 (102) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/bin/pushary-bell-hook.js +23 -23
  3. package/dist/bin/pushary-bell.js +10 -10
  4. package/dist/bin/pushary-claude.js +46 -35
  5. package/dist/bin/pushary-clean.js +194 -102
  6. package/dist/bin/pushary-codex-bridge.js +18 -17
  7. package/dist/bin/pushary-codex-hook.js +53 -39
  8. package/dist/bin/pushary-codex.js +14 -12
  9. package/dist/bin/pushary-connect.js +16 -16
  10. package/dist/bin/pushary-cowork.js +5 -5
  11. package/dist/bin/pushary-daemon.js +27 -27
  12. package/dist/bin/pushary-disconnect.js +19 -17
  13. package/dist/bin/pushary-doctor.js +99 -43
  14. package/dist/bin/pushary-elicitation-hook.js +35 -26
  15. package/dist/bin/pushary-gemini-bridge.js +12 -12
  16. package/dist/bin/pushary-gemini-hook.js +47 -32
  17. package/dist/bin/pushary-hook.js +34 -32
  18. package/dist/bin/pushary-login.js +16 -16
  19. package/dist/bin/pushary-logout.js +8 -8
  20. package/dist/bin/pushary-mcp.js +9 -8
  21. package/dist/bin/pushary-mode.js +10 -10
  22. package/dist/bin/pushary-notification-hook.js +29 -27
  23. package/dist/bin/pushary-opencode-hook.js +46 -32
  24. package/dist/bin/pushary-permission-denied-hook.js +34 -32
  25. package/dist/bin/pushary-permission-hook.js +33 -31
  26. package/dist/bin/pushary-post-hook.js +29 -27
  27. package/dist/bin/pushary-prompt-hook.js +29 -27
  28. package/dist/bin/pushary-session-end-hook.js +29 -27
  29. package/dist/bin/pushary-session-start-hook.js +33 -31
  30. package/dist/bin/pushary-setup.js +143 -105
  31. package/dist/bin/pushary-stats.js +5 -5
  32. package/dist/bin/pushary-status.js +19 -19
  33. package/dist/bin/pushary-stop-hook.js +29 -27
  34. package/dist/bin/pushary-stopfailure-hook.js +29 -27
  35. package/dist/bin/pushary-suggestions.js +5 -5
  36. package/dist/bin/pushary-transcript-register.js +19 -19
  37. package/dist/bin/pushary-transcripts.js +7 -7
  38. package/dist/bin/pushary-upgrade.js +20 -20
  39. package/dist/bin/pushary-wait.js +10 -10
  40. package/dist/bin/pushary.js +6 -6
  41. package/dist/{chunk-IJ6ECPA6.js → chunk-2B4XCMH6.js} +75 -232
  42. package/dist/{chunk-EGKXSQCY.js → chunk-2XOHXZRC.js} +12 -4
  43. package/dist/{chunk-D6BULEJW.js → chunk-3NSRL5E7.js} +2 -2
  44. package/dist/{chunk-UC65FJJT.js → chunk-3RO2UWJQ.js} +2 -2
  45. package/dist/{chunk-73T6MSU5.js → chunk-4S7CCOXB.js} +5 -5
  46. package/dist/{chunk-7OS4IHGI.js → chunk-5GIBNUBD.js} +2 -2
  47. package/dist/chunk-5OP5MQI7.js +45 -0
  48. package/dist/{chunk-B3UXMSMW.js → chunk-65RN6ZCO.js} +1 -1
  49. package/dist/{chunk-2PS6QWDW.js → chunk-6NHXKTQU.js} +2 -2
  50. package/dist/{chunk-V6QRSU2G.js → chunk-6QZK4O36.js} +4 -4
  51. package/dist/{chunk-ZQ7IDOKY.js → chunk-A6WQF7FQ.js} +3 -3
  52. package/dist/{chunk-QXAK5RFU.js → chunk-AWZNDM3B.js} +1 -1
  53. package/dist/{chunk-JNXVOU6Y.js → chunk-D4OGEWLH.js} +19 -2
  54. package/dist/{chunk-R2XCLT6I.js → chunk-E3PLF7YB.js} +4 -4
  55. package/dist/{chunk-2C7CCWVX.js → chunk-F6BMJOSW.js} +1 -1
  56. package/dist/{chunk-XNCMT7YY.js → chunk-HOIGXMI7.js} +1 -1
  57. package/dist/{chunk-CVALVGA7.js → chunk-I7B2DNVU.js} +1 -1
  58. package/dist/{chunk-S3UD4V6W.js → chunk-INR3RVQ3.js} +13 -3
  59. package/dist/{chunk-52NVBNJT.js → chunk-IZVAVXHQ.js} +6 -4
  60. package/dist/{chunk-5HLTWFJ6.js → chunk-JMSB6CJT.js} +1 -1
  61. package/dist/{chunk-KYQXUGH7.js → chunk-KAJT6HPI.js} +3 -3
  62. package/dist/{chunk-VKVIAZQO.js → chunk-KLXYMPTM.js} +1 -1
  63. package/dist/{chunk-PQ4F64M2.js → chunk-L6IF4JOF.js} +3 -3
  64. package/dist/{chunk-ROQK7IN3.js → chunk-LI3C2IQY.js} +2 -2
  65. package/dist/{chunk-B234346F.js → chunk-M2JGLFFS.js} +1 -1
  66. package/dist/chunk-MY3UZO5U.js +99 -0
  67. package/dist/chunk-N6IOSZOE.js +185 -0
  68. package/dist/{chunk-DNJUSFBL.js → chunk-NYBZJ44G.js} +40 -5
  69. package/dist/{chunk-BBKNJJVX.js → chunk-OJRB5QKN.js} +6 -6
  70. package/dist/{chunk-PUDBG3GM.js → chunk-OXEF6JHD.js} +4 -4
  71. package/dist/{chunk-LEZFOTMI.js → chunk-PWNQGITG.js} +1 -1
  72. package/dist/{chunk-B76WVEDX.js → chunk-Q7CDBJXU.js} +1 -1
  73. package/dist/{chunk-KXMZMZD3.js → chunk-QSZ37ROP.js} +1 -1
  74. package/dist/{chunk-BH2SKSSK.js → chunk-R7ZETVNR.js} +1 -1
  75. package/dist/{chunk-DZURML2D.js → chunk-RLRDPZG4.js} +1 -1
  76. package/dist/{chunk-J2355HR7.js → chunk-SEIZQZEE.js} +1 -1
  77. package/dist/{chunk-V4AQBAVG.js → chunk-SJN64NJX.js} +1 -1
  78. package/dist/{chunk-B3YQANFN.js → chunk-SKEW3TQX.js} +1 -1
  79. package/dist/{chunk-L4H2Q2S4.js → chunk-SKMWPXGV.js} +500 -46
  80. package/dist/{chunk-WUNZAE7I.js → chunk-T3PRPFDY.js} +5 -5
  81. package/dist/{chunk-YYINL576.js → chunk-TVJYGZXB.js} +2 -2
  82. package/dist/{chunk-O2LEPIU6.js → chunk-U3MS6D5X.js} +1 -1
  83. package/dist/{chunk-5RUIFDTP.js → chunk-U4TMAANR.js} +33 -2
  84. package/dist/{chunk-KW2RRR7D.js → chunk-UFNBKYWT.js} +3 -3
  85. package/dist/{chunk-DVQDPI3T.js → chunk-UUTWHVSV.js} +35 -35
  86. package/dist/{chunk-X6KDKOV5.js → chunk-VQDJ6KB3.js} +3 -3
  87. package/dist/{chunk-UOAQ6QMP.js → chunk-VSGKQ3HI.js} +2 -2
  88. package/dist/{chunk-YROGUPOZ.js → chunk-WWTLAZQA.js} +25 -8
  89. package/dist/{chunk-SQRWHALT.js → chunk-WXIVUIXA.js} +2 -2
  90. package/dist/{chunk-HDRNWNVP.js → chunk-YLCSKVQQ.js} +9 -28
  91. package/dist/{chunk-JXUAXO74.js → chunk-YNJ2H2FD.js} +2 -2
  92. package/dist/{chunk-BWYJ6AAF.js → chunk-YU4222G2.js} +2 -2
  93. package/dist/{chunk-4F46VIEE.js → chunk-YU54LNC6.js} +6 -6
  94. package/dist/{chunk-EAQMWJPG.js → chunk-ZMWX5SDA.js} +8 -8
  95. package/dist/{chunk-6ADZQFVW.js → chunk-ZUKZJQGR.js} +1 -1
  96. package/dist/{reapply-6PH3FMPX.js → reapply-D6RSDYCK.js} +9 -9
  97. package/dist/src/index.d.ts +1 -0
  98. package/dist/src/index.js +22 -20
  99. package/package.json +2 -1
  100. package/dist/chunk-DANOZVZK.js +0 -307
  101. package/dist/chunk-P32LPT2L.js +0 -6
  102. package/dist/chunk-YHG74UFF.js +0 -12
@@ -3,28 +3,28 @@ import {
3
3
  addPusharyToolPermissions,
4
4
  isPusharyHook,
5
5
  removeClaudeMcpServers
6
- } from "./chunk-KYQXUGH7.js";
6
+ } from "./chunk-KAJT6HPI.js";
7
7
  import {
8
8
  CLAUDE_HOOK_EVENTS,
9
9
  addGeminiMcpServer,
10
10
  removeGeminiMcpServer
11
- } from "./chunk-ZQ7IDOKY.js";
11
+ } from "./chunk-A6WQF7FQ.js";
12
12
  import {
13
13
  CLAUDE_CODE_AGENT,
14
14
  parseApplyPatchFiles
15
- } from "./chunk-IJ6ECPA6.js";
15
+ } from "./chunk-2B4XCMH6.js";
16
16
  import {
17
17
  guardBinary,
18
18
  holdBudgetOf,
19
19
  registerHookEntry
20
- } from "./chunk-DNJUSFBL.js";
20
+ } from "./chunk-NYBZJ44G.js";
21
21
  import {
22
22
  PHONE_ANSWERED_TOOLS,
23
23
  hookCompatibleProfile,
24
24
  hookCompatibleProfileBySource,
25
25
  toToolLookup,
26
26
  withHookHoldBudget
27
- } from "./chunk-YROGUPOZ.js";
27
+ } from "./chunk-WWTLAZQA.js";
28
28
 
29
29
  // src/compatible-config.ts
30
30
  import { homedir } from "os";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  parseSseMessages
3
- } from "./chunk-JNXVOU6Y.js";
3
+ } from "./chunk-D4OGEWLH.js";
4
4
  import {
5
5
  NPX_LATEST_COMMAND
6
- } from "./chunk-B3UXMSMW.js";
6
+ } from "./chunk-65RN6ZCO.js";
7
7
 
8
8
  // src/mcp-stdio-bridge.ts
9
9
  var MCP_BRIDGE_BINARY = "pushary-mcp";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parseVersion
3
- } from "./chunk-ZQ7IDOKY.js";
3
+ } from "./chunk-A6WQF7FQ.js";
4
4
 
5
5
  // src/setup/agent-probe.ts
6
6
  import { execSync } from "child_process";
@@ -1,3 +1,28 @@
1
+ // src/cli/terminal-row.ts
2
+ var visibleLength = (text) => text.replace(/\x1b\[[0-9;]*m/g, "").length;
3
+ var clipToRow = (text, columns) => {
4
+ const budget = columns - 4;
5
+ if (budget <= 1 || visibleLength(text) <= budget) return text;
6
+ let visible = 0;
7
+ let out = "";
8
+ for (let i = 0; i < text.length; i += 1) {
9
+ const escape = /^\x1b\[[0-9;]*m/.exec(text.slice(i));
10
+ if (escape) {
11
+ out += escape[0];
12
+ i += escape[0].length - 1;
13
+ continue;
14
+ }
15
+ if (visible >= budget - 1) break;
16
+ out += text[i];
17
+ visible += 1;
18
+ }
19
+ return `${out}\u2026`;
20
+ };
21
+ var terminalColumns = (stream = process.stdout) => {
22
+ const columns = stream.columns;
23
+ return typeof columns === "number" && columns > 0 ? columns : 80;
24
+ };
25
+
1
26
  // src/cli/io.ts
2
27
  var truthyLevel = (value) => {
3
28
  if (value === void 0) return void 0;
@@ -5,6 +30,8 @@ var truthyLevel = (value) => {
5
30
  const parsed = Number(value);
6
31
  return Number.isFinite(parsed) ? parsed : 1;
7
32
  };
33
+ var ANSI_RESET = "\x1B[0m";
34
+ var ansiPainter = (enabled) => (open) => (text) => enabled() ? `${open}${text}${ANSI_RESET}` : text;
8
35
  var useColor = (context = {}, stream = process.stdout) => {
9
36
  const forced = truthyLevel(process.env.FORCE_COLOR);
10
37
  if (forced !== void 0) return forced > 0;
@@ -15,6 +42,7 @@ var useColor = (context = {}, stream = process.stdout) => {
15
42
  return stream.isTTY === true;
16
43
  };
17
44
  var SPINNER_FRAMES = [" ", ". ", ".. ", "..."];
45
+ var SPINNER_FRAME_WIDTH = SPINNER_FRAMES[0].length + 1;
18
46
  var SPINNER_INTERVAL_MS = 200;
19
47
  var describeError = (err) => {
20
48
  if (err instanceof Error) {
@@ -45,7 +73,7 @@ var createIo = (stream = process.stdout, context = {}) => {
45
73
  `);
46
74
  };
47
75
  const spinner = async (label, fn, options = {}) => {
48
- if (!color) {
76
+ if (stream.isTTY !== true) {
49
77
  try {
50
78
  await fn();
51
79
  line(` ${check()} ${label}`);
@@ -57,7 +85,7 @@ var createIo = (stream = process.stdout, context = {}) => {
57
85
  }
58
86
  let frame = 0;
59
87
  const timer = setInterval(() => {
60
- stream.write(`\r ${dim(SPINNER_FRAMES[frame++ % SPINNER_FRAMES.length])} ${label}`);
88
+ stream.write(`\r ${dim(SPINNER_FRAMES[frame++ % SPINNER_FRAMES.length])} ${clipToRow(label, terminalColumns(stream) - SPINNER_FRAME_WIDTH)}\x1B[K`);
61
89
  }, SPINNER_INTERVAL_MS);
62
90
  try {
63
91
  await fn();
@@ -75,6 +103,9 @@ var createIo = (stream = process.stdout, context = {}) => {
75
103
  };
76
104
 
77
105
  export {
106
+ clipToRow,
107
+ terminalColumns,
108
+ ansiPainter,
78
109
  useColor,
79
110
  createIo
80
111
  };
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  readExistingMachineId
3
- } from "./chunk-XNCMT7YY.js";
3
+ } from "./chunk-HOIGXMI7.js";
4
4
  import {
5
5
  NetworkError
6
6
  } from "./chunk-7QLSKOSU.js";
7
7
  import {
8
8
  getBaseUrl
9
- } from "./chunk-V4AQBAVG.js";
9
+ } from "./chunk-SJN64NJX.js";
10
10
  import {
11
11
  clientContextHeaders,
12
12
  getPackageVersion
13
- } from "./chunk-YROGUPOZ.js";
13
+ } from "./chunk-WWTLAZQA.js";
14
14
 
15
15
  // src/cli/net.ts
16
16
  import { createRequire } from "module";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  activeHookSource,
3
3
  activeIdentity
4
- } from "./chunk-WUNZAE7I.js";
4
+ } from "./chunk-T3PRPFDY.js";
5
5
  import {
6
6
  blockedActionFingerprint,
7
7
  defersToNativeMode,
@@ -9,17 +9,18 @@ import {
9
9
  hasBlockedActionHint,
10
10
  recordBlockedActionHint,
11
11
  reportMachineDenial
12
- } from "./chunk-52NVBNJT.js";
12
+ } from "./chunk-IZVAVXHQ.js";
13
13
  import {
14
14
  isGatingMoment,
15
15
  recordKeylessMoment
16
- } from "./chunk-2C7CCWVX.js";
16
+ } from "./chunk-F6BMJOSW.js";
17
17
  import {
18
+ announceSubscriptionRequired,
18
19
  denyReasonFrom,
19
- isDeferAnswer
20
- } from "./chunk-YHG74UFF.js";
20
+ isDeferAnswer,
21
+ oncePerSession
22
+ } from "./chunk-5OP5MQI7.js";
21
23
  import {
22
- DEFAULT_SESSION,
23
24
  UNNAMED_ACTION,
24
25
  claimThrottle,
25
26
  deriveAction,
@@ -36,9 +37,13 @@ import {
36
37
  reportEvent,
37
38
  scopePathFor,
38
39
  settleQuestionsForToolUse
39
- } from "./chunk-IJ6ECPA6.js";
40
+ } from "./chunk-2B4XCMH6.js";
41
+ import {
42
+ DEFAULT_SESSION
43
+ } from "./chunk-N6IOSZOE.js";
40
44
  import {
41
45
  DECISION_STOP_REASON,
46
+ UNVERIFIABLE_APPROVAL_REASON,
42
47
  askUser,
43
48
  cancelQuestion,
44
49
  claimBlockedAction,
@@ -48,14 +53,17 @@ import {
48
53
  requestGate,
49
54
  sendNotification,
50
55
  waitForQuestion
51
- } from "./chunk-EGKXSQCY.js";
56
+ } from "./chunk-2XOHXZRC.js";
57
+ import {
58
+ SubscriptionRequiredError
59
+ } from "./chunk-D4OGEWLH.js";
52
60
  import {
53
61
  getMachineId
54
- } from "./chunk-XNCMT7YY.js";
62
+ } from "./chunk-HOIGXMI7.js";
55
63
  import {
56
64
  getApiKey,
57
65
  getBaseUrl
58
- } from "./chunk-V4AQBAVG.js";
66
+ } from "./chunk-SJN64NJX.js";
59
67
  import {
60
68
  AGENT_QUESTION_STRATEGY,
61
69
  GATE_BLOCK_REASON_MAX_LENGTH,
@@ -83,7 +91,7 @@ import {
83
91
  parseAgentQuestions,
84
92
  resolveGate,
85
93
  stoppedOutput
86
- } from "./chunk-YROGUPOZ.js";
94
+ } from "./chunk-WWTLAZQA.js";
87
95
 
88
96
  // src/claude-permission-rules.ts
89
97
  import { readFileSync, statSync } from "fs";
@@ -152,9 +160,7 @@ var reportDecisionEpisode = async (apiKey, input) => {
152
160
  };
153
161
 
154
162
  // src/hook.ts
155
- import { basename, join as join2 } from "path";
156
- import { tmpdir } from "os";
157
- import { existsSync, writeFileSync } from "fs";
163
+ import { basename } from "path";
158
164
  var START_MS = Date.now();
159
165
  var ACTIVE_AGENT = activeIdentity(process.argv);
160
166
  var ACTIVE_SOURCE = activeHookSource(process.argv);
@@ -164,6 +170,11 @@ var deny = (reason) => claudePreToolUseOutput("deny", reason);
164
170
  var allowWithInput = (updatedInput) => claudePreToolUseOutput("allow", void 0, updatedInput);
165
171
  var ask = (reason) => claudePreToolUseOutput("ask", reason);
166
172
  var halted = (reason) => stoppedOutput(deny(reason), reason);
173
+ var outcomeOfFailedAsk = (error, sessionId, failure) => {
174
+ if (!(error instanceof SubscriptionRequiredError)) return failure;
175
+ announceSubscriptionRequired(error.upgradeUrl, sessionId);
176
+ return void 0;
177
+ };
167
178
  var storedWaitDeadline = (result, requestedDeadline) => {
168
179
  const stored = result.waitEndsAt ? Date.parse(result.waitEndsAt) : Number.NaN;
169
180
  return Number.isFinite(stored) ? Math.min(stored, requestedDeadline) : requestedDeadline;
@@ -187,8 +198,8 @@ var handlePushOnly = async (apiKey, description, projectName, timeoutSeconds, ti
187
198
  waitEndsAt: timeoutAction !== "approve" && timeoutAction !== "deny" || clampCut ? new Date(requestedDeadline).toISOString() : void 0,
188
199
  ...decision
189
200
  });
190
- } catch {
191
- return halted("Pushary could not create a verifiable approval. Retry the action.");
201
+ } catch (error) {
202
+ return outcomeOfFailedAsk(error, sessionId, halted(UNVERIFIABLE_APPROVAL_REASON));
192
203
  }
193
204
  if (isDecisionStopped(result)) return halted(DECISION_STOP_REASON);
194
205
  const deadline = storedWaitDeadline(result, requestedDeadline);
@@ -232,8 +243,8 @@ var handlePushFirst = async (apiKey, description, projectName, pushFirstSeconds,
232
243
  waitEndsAt: new Date(requestedDeadline).toISOString(),
233
244
  ...decision
234
245
  });
235
- } catch {
236
- return halted("Pushary could not create a verifiable approval. Retry the action.");
246
+ } catch (error) {
247
+ return outcomeOfFailedAsk(error, sessionId, halted(UNVERIFIABLE_APPROVAL_REASON));
237
248
  }
238
249
  if (isDecisionStopped(result)) return halted(DECISION_STOP_REASON);
239
250
  if (!isLocalQuestionHandoff(result) && !result.answered) announceWait(pushFirstSeconds, result.answerUrl, sessionId);
@@ -344,17 +355,6 @@ var announceWait = (waitSeconds, answerUrl, sessionId) => {
344
355
  }
345
356
  };
346
357
  var KEYLESS_NOTICE = "[pushary] Not connected (no API key), so your agent runs untouched. Approval moments are counted locally; see them with: npx @pushary/agent-hooks@latest stats. Connect: https://pushary.com/sign-up?utm_source=cli&utm_medium=keyless-hook";
347
- var oncePerSession = (kind, sessionId) => {
348
- try {
349
- const key = (sessionId || DEFAULT_SESSION).replace(/[^a-zA-Z0-9_-]/g, "");
350
- const marker = join2(tmpdir(), `pushary-${kind}-${key}`);
351
- if (existsSync(marker)) return false;
352
- writeFileSync(marker, "1", "utf-8");
353
- return true;
354
- } catch {
355
- return false;
356
- }
357
- };
358
358
  var keylessNoticeOnce = (sessionId) => {
359
359
  try {
360
360
  if (!oncePerSession("keyless", sessionId)) return;
@@ -391,8 +391,8 @@ var askAsOneCard = async (apiKey, input, parsed, projectName, deadline) => {
391
391
  toolUseId: input.tool_use_id,
392
392
  waitEndsAt: new Date(deadline).toISOString()
393
393
  });
394
- } catch {
395
- return null;
394
+ } catch (error) {
395
+ return outcomeOfFailedAsk(error, input.session_id, null);
396
396
  }
397
397
  if (isDecisionStopped(result)) return null;
398
398
  const answer = await waitForQuestion(apiKey, result, storedWaitDeadline(result, deadline));
@@ -424,8 +424,8 @@ var askQuestionByQuestion = async (apiKey, input, parsed, projectName, deadline)
424
424
  toolUseId: input.tool_use_id ? `${input.tool_use_id}#q${index}` : void 0,
425
425
  waitEndsAt: new Date(deadline).toISOString()
426
426
  });
427
- } catch {
428
- return null;
427
+ } catch (error) {
428
+ return outcomeOfFailedAsk(error, input.session_id, null);
429
429
  }
430
430
  if (isDecisionStopped(result)) return null;
431
431
  const answer = await waitForQuestion(apiKey, result, storedWaitDeadline(result, deadline));
@@ -478,8 +478,8 @@ var handleExitPlanMode = async (apiKey, input) => {
478
478
  blocker: "Waiting for you to approve the plan",
479
479
  waitEndsAt: new Date(deadline).toISOString()
480
480
  });
481
- } catch {
482
- return halted(DECISION_STOP_REASON);
481
+ } catch (error) {
482
+ return outcomeOfFailedAsk(error, input.session_id, halted(DECISION_STOP_REASON));
483
483
  }
484
484
  if (isDecisionStopped(result)) return halted(DECISION_STOP_REASON);
485
485
  const answer = await waitForQuestion(apiKey, result, storedWaitDeadline(result, deadline));
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyFetch
3
- } from "./chunk-KW2RRR7D.js";
3
+ } from "./chunk-UFNBKYWT.js";
4
4
  import {
5
5
  NetworkError
6
6
  } from "./chunk-7QLSKOSU.js";
@@ -9,11 +9,11 @@ import {
9
9
  } from "./chunk-KZERVKTD.js";
10
10
  import {
11
11
  getBaseUrl
12
- } from "./chunk-V4AQBAVG.js";
12
+ } from "./chunk-SJN64NJX.js";
13
13
  import {
14
14
  isValidApiKey,
15
15
  normalizeKeyScope
16
- } from "./chunk-YROGUPOZ.js";
16
+ } from "./chunk-WWTLAZQA.js";
17
17
 
18
18
  // src/session.ts
19
19
  var samePusharyAccount = (left, right) => left.kind === "ok" && right.kind === "ok" && left.identity.workspaceId !== "" && left.identity.workspaceId === right.identity.workspaceId && left.identity.siteId === right.identity.siteId;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveInstallSourceFor
3
- } from "./chunk-ROQK7IN3.js";
3
+ } from "./chunk-LI3C2IQY.js";
4
4
  import {
5
5
  backupFile,
6
6
  readJsonSafe,
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-T7E75EKA.js";
10
10
  import {
11
11
  configFilePath
12
- } from "./chunk-V4AQBAVG.js";
12
+ } from "./chunk-SJN64NJX.js";
13
13
 
14
14
  // src/shell-alias.ts
15
15
  import { homedir } from "os";
@@ -156,7 +156,7 @@ var AGENTS = {
156
156
  label: "fx",
157
157
  connectVia: "Local MCP bridge",
158
158
  setupCommand: AGENT_HOOKS_SETUP_COMMAND,
159
- capabilityNote: "fx has no hooks that other tools can register, so Pushary cannot answer fx's own approval prompts. fx's agent reaches Pushary through its MCP tools when it chooses to ask."
159
+ capabilityNote: "fx has no hooks that other tools can register, so Pushary cannot answer fx's own approval prompts. Setup turns off fx's terminal question tool so fx's agent asks through Pushary. fx's full-access mode ignores that setting; there the agent is only instructed to ask through Pushary."
160
160
  },
161
161
  qwen_code: {
162
162
  ...defaults,
@@ -455,7 +455,19 @@ var compatibleTargetFiles = (profile) => {
455
455
  };
456
456
 
457
457
  // ../contracts/src/redaction.ts
458
- var SECRET_REDACTION_RULES = [
458
+ var CREDENTIAL_KEY = String.raw`(?:secret|token|password|passwd|api[_-]?key|access[_-]?key|client[_-]?secret|private[_-]?key)["']?\s*[=:]\s*`;
459
+ var CLOSED_DOUBLE_QUOTE = '"';
460
+ var CLOSED_SINGLE_QUOTE = "'";
461
+ var DOUBLE_QUOTE_OR_CUT_OFF = String.raw`(?:"|\\?$)`;
462
+ var SINGLE_QUOTE_OR_CUT_OFF = "(?:'|$)";
463
+ var credentialAssignmentRule = (doubleQuoteEnd, singleQuoteEnd) => ({
464
+ pattern: new RegExp(
465
+ String.raw`(${CREDENTIAL_KEY})(?:(")(?:\\[\s\S]|[^"\\])*${doubleQuoteEnd}|(')[^']*${singleQuoteEnd}|\S+)`,
466
+ "gi"
467
+ ),
468
+ replacement: "$1$2$3[redacted]$2$3"
469
+ });
470
+ var PRECISE_SECRET_RULES = [
459
471
  { pattern: /\bpk_[A-Za-z0-9_]+\.[A-Za-z0-9_]+/g, replacement: "[redacted]" },
460
472
  { pattern: /-----BEGIN[A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?-----END[A-Z0-9 ]*PRIVATE KEY-----/g, replacement: "[redacted key]" },
461
473
  { pattern: /\bsk-[A-Za-z0-9_-]{16,}\b/g, replacement: "[redacted]" },
@@ -472,14 +484,19 @@ var SECRET_REDACTION_RULES = [
472
484
  { pattern: /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, replacement: "[redacted]" },
473
485
  { pattern: /\b([a-z][a-z0-9+.-]*:\/\/[^\s:/@]+:)[^\s@/]+@/gi, replacement: "$1[redacted]@" },
474
486
  { pattern: /\bbearer\s+[A-Za-z0-9._~+/=-]+/gi, replacement: "bearer [redacted]" },
475
- { pattern: /\bauthorization:\s*\S+/gi, replacement: "authorization: [redacted]" },
476
- {
477
- pattern: /((?:secret|token|password|passwd|api[_-]?key|access[_-]?key|client[_-]?secret|private[_-]?key)["']?\s*[=:]\s*)(?:(")(?:\\[\s\S]|[^"\\])*(?:"|\\?$)|(')[^']*(?:'|$)|\S+)/gi,
478
- replacement: "$1$2$3[redacted]$2$3"
479
- }
487
+ { pattern: /\bauthorization:\s*\S+/gi, replacement: "authorization: [redacted]" }
488
+ ];
489
+ var SECRET_REDACTION_RULES = [
490
+ ...PRECISE_SECRET_RULES,
491
+ credentialAssignmentRule(CLOSED_DOUBLE_QUOTE, CLOSED_SINGLE_QUOTE)
492
+ ];
493
+ var CUT_OFF_TEXT_REDACTION_RULES = [
494
+ ...PRECISE_SECRET_RULES,
495
+ credentialAssignmentRule(DOUBLE_QUOTE_OR_CUT_OFF, SINGLE_QUOTE_OR_CUT_OFF)
480
496
  ];
481
497
  var HIGH_ENTROPY_RULE = { pattern: /[A-Za-z0-9+/]{40,}={0,2}/g, replacement: "[redacted]" };
482
- var redactSecrets = (text) => SECRET_REDACTION_RULES.reduce((acc, rule) => acc.replace(rule.pattern, rule.replacement), text);
498
+ var applyRedactionRules = (rules, text) => rules.reduce((acc, rule) => acc.replace(rule.pattern, rule.replacement), text);
499
+ var redactSecrets = (text) => applyRedactionRules(SECRET_REDACTION_RULES, text);
483
500
  var redactSecretsDeep = (text) => redactSecrets(text).replace(HIGH_ENTROPY_RULE.pattern, HIGH_ENTROPY_RULE.replacement);
484
501
 
485
502
  // ../contracts/src/degraded.ts
@@ -3,11 +3,11 @@ import {
3
3
  decodePublicKey,
4
4
  generateSessionKey,
5
5
  wrapSessionKey
6
- } from "./chunk-BH2SKSSK.js";
6
+ } from "./chunk-R7ZETVNR.js";
7
7
  import {
8
8
  fetchTranscriptRecipients,
9
9
  uploadTranscriptRecords
10
- } from "./chunk-KXMZMZD3.js";
10
+ } from "./chunk-QSZ37ROP.js";
11
11
 
12
12
  // src/live-session.ts
13
13
  var MAX_TRANSCRIPT_QUEUE = 100;
@@ -8,21 +8,23 @@ import {
8
8
  writeHuman
9
9
  } from "./chunk-QCGNGEGE.js";
10
10
  import {
11
+ clipToRow,
12
+ terminalColumns,
11
13
  useColor
12
- } from "./chunk-5RUIFDTP.js";
14
+ } from "./chunk-U4TMAANR.js";
13
15
  import {
14
16
  callMcpTool
15
- } from "./chunk-JNXVOU6Y.js";
17
+ } from "./chunk-D4OGEWLH.js";
16
18
  import {
17
19
  reportedInstallSource
18
- } from "./chunk-ROQK7IN3.js";
20
+ } from "./chunk-LI3C2IQY.js";
19
21
  import {
20
22
  NPX_LATEST_COMMAND
21
- } from "./chunk-B3UXMSMW.js";
23
+ } from "./chunk-65RN6ZCO.js";
22
24
  import {
23
25
  PAIR_TTL_SECONDS,
24
26
  isAnswerSource
25
- } from "./chunk-YROGUPOZ.js";
27
+ } from "./chunk-WWTLAZQA.js";
26
28
 
27
29
  // src/reach.ts
28
30
  var reachVerdict = (channels) => {
@@ -462,29 +464,6 @@ var writeStatusLine = (text) => {
462
464
  ` : ` ${text}
463
465
  `);
464
466
  };
465
- var visibleLength = (text) => text.replace(/\x1b\[[0-9;]*m/g, "").length;
466
- var clipToRow = (text, columns) => {
467
- const budget = columns - 4;
468
- if (budget <= 1 || visibleLength(text) <= budget) return text;
469
- let visible = 0;
470
- let out = "";
471
- for (let i = 0; i < text.length; i += 1) {
472
- const escape = /^\x1b\[[0-9;]*m/.exec(text.slice(i));
473
- if (escape) {
474
- out += escape[0];
475
- i += escape[0].length - 1;
476
- continue;
477
- }
478
- if (visible >= budget - 1) break;
479
- out += text[i];
480
- visible += 1;
481
- }
482
- return `${out}\u2026`;
483
- };
484
- var terminalColumns = () => {
485
- const columns = process.stdout.columns;
486
- return typeof columns === "number" && columns > 0 ? columns : 80;
487
- };
488
467
  var startSpinner = (getLabel) => {
489
468
  if (!humanIsTty()) {
490
469
  writeHuman(` ${getLabel()}
@@ -787,6 +766,8 @@ var describePairFailure = (reason) => {
787
766
  return "Finish setting up in the Pushary app, then run setup again";
788
767
  case "authorize_failed":
789
768
  return "The app could not authorize this terminal. Re-run setup to try again";
769
+ case "payment_required":
770
+ return "Your Pushary workspace has no active subscription. Subscribe in the Pushary app or at pushary.com, then run setup again";
790
771
  default:
791
772
  return "Pairing failed. Re-run setup to try again";
792
773
  }
@@ -2,10 +2,10 @@ import {
2
2
  resolveBinary,
3
3
  resolveGlobalPackageVersion,
4
4
  resolvePackageVersionFromBinary
5
- } from "./chunk-DNJUSFBL.js";
5
+ } from "./chunk-NYBZJ44G.js";
6
6
  import {
7
7
  MANAGED_PROVIDERS
8
- } from "./chunk-YROGUPOZ.js";
8
+ } from "./chunk-WWTLAZQA.js";
9
9
 
10
10
  // src/live-capabilities.ts
11
11
  var CLAUDE_BRIDGE_CAPABILITY = "claude-bridge";
@@ -3,14 +3,14 @@ import {
3
3
  } from "./chunk-POFBE6ZY.js";
4
4
  import {
5
5
  autoUpdateState
6
- } from "./chunk-DNJUSFBL.js";
6
+ } from "./chunk-NYBZJ44G.js";
7
7
  import {
8
8
  readJsonSafe,
9
9
  writeJsonAtomic
10
10
  } from "./chunk-T7E75EKA.js";
11
11
  import {
12
12
  ownPackageRoot
13
- } from "./chunk-YROGUPOZ.js";
13
+ } from "./chunk-WWTLAZQA.js";
14
14
 
15
15
  // src/auto-update.ts
16
16
  import { spawn } from "child_process";
@@ -2,27 +2,27 @@ import {
2
2
  detectProviderLiveCapabilities,
3
3
  hasSpawnProvider,
4
4
  resolveControlPolicy
5
- } from "./chunk-JXUAXO74.js";
5
+ } from "./chunk-YNJ2H2FD.js";
6
6
  import {
7
7
  daemonHasRemoteProof,
8
8
  daemonServiceManagerAvailable,
9
9
  hasDaemonServiceDefinition,
10
10
  readDaemonNeedsLogin,
11
11
  readDaemonStatus
12
- } from "./chunk-73T6MSU5.js";
12
+ } from "./chunk-4S7CCOXB.js";
13
13
  import {
14
14
  readControlMode,
15
15
  readKeySource
16
- } from "./chunk-UOAQ6QMP.js";
16
+ } from "./chunk-VSGKQ3HI.js";
17
17
  import {
18
18
  getMachineId
19
- } from "./chunk-XNCMT7YY.js";
19
+ } from "./chunk-HOIGXMI7.js";
20
20
  import {
21
21
  getBaseUrl
22
- } from "./chunk-V4AQBAVG.js";
22
+ } from "./chunk-SJN64NJX.js";
23
23
  import {
24
24
  getPackageVersion
25
- } from "./chunk-YROGUPOZ.js";
25
+ } from "./chunk-WWTLAZQA.js";
26
26
 
27
27
  // src/machines.ts
28
28
  import { hostname } from "os";
@@ -6,38 +6,38 @@ import {
6
6
  } from "./chunk-SGZJ5LYH.js";
7
7
  import {
8
8
  hookOwnerOf
9
- } from "./chunk-R2XCLT6I.js";
9
+ } from "./chunk-E3PLF7YB.js";
10
10
  import {
11
11
  ensureDaemonRunning
12
- } from "./chunk-73T6MSU5.js";
12
+ } from "./chunk-4S7CCOXB.js";
13
13
  import {
14
14
  buildTranscriptRecords,
15
15
  decodePublicKey,
16
16
  generateSessionKey,
17
17
  wrapSessionKey
18
- } from "./chunk-BH2SKSSK.js";
18
+ } from "./chunk-R7ZETVNR.js";
19
19
  import {
20
20
  fetchTranscriptRecipients,
21
21
  uploadTranscriptRecords
22
- } from "./chunk-KXMZMZD3.js";
22
+ } from "./chunk-QSZ37ROP.js";
23
23
  import {
24
24
  transcriptEnvironmentPreference,
25
25
  transcriptsEnabled
26
- } from "./chunk-B76WVEDX.js";
26
+ } from "./chunk-Q7CDBJXU.js";
27
27
  import {
28
28
  readTranscriptPreference
29
- } from "./chunk-UOAQ6QMP.js";
29
+ } from "./chunk-VSGKQ3HI.js";
30
30
  import {
31
31
  codexHome,
32
32
  pusharyDir
33
- } from "./chunk-DNJUSFBL.js";
33
+ } from "./chunk-NYBZJ44G.js";
34
34
  import {
35
35
  writeJsonAtomic
36
36
  } from "./chunk-T7E75EKA.js";
37
37
  import {
38
38
  getApiKey,
39
39
  getBaseUrl
40
- } from "./chunk-V4AQBAVG.js";
40
+ } from "./chunk-SJN64NJX.js";
41
41
 
42
42
  // src/transcript-registration.ts
43
43
  import { createHash } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readConfigFileKey
3
- } from "./chunk-UOAQ6QMP.js";
3
+ } from "./chunk-VSGKQ3HI.js";
4
4
 
5
5
  // src/bell/fleet.ts
6
6
  import { closeSync, constants, futimesSync, lstatSync, mkdirSync, openSync, readdirSync, unlinkSync } from "fs";
@@ -9,17 +9,17 @@ import {
9
9
  reapplyGeminiSettings,
10
10
  reapplyVsCodePlugin,
11
11
  repairCodexHolds
12
- } from "./chunk-BBKNJJVX.js";
13
- import "./chunk-O2LEPIU6.js";
14
- import "./chunk-7OS4IHGI.js";
15
- import "./chunk-KYQXUGH7.js";
16
- import "./chunk-PQ4F64M2.js";
17
- import "./chunk-ZQ7IDOKY.js";
12
+ } from "./chunk-OJRB5QKN.js";
13
+ import "./chunk-U3MS6D5X.js";
14
+ import "./chunk-5GIBNUBD.js";
15
+ import "./chunk-KAJT6HPI.js";
16
+ import "./chunk-L6IF4JOF.js";
17
+ import "./chunk-A6WQF7FQ.js";
18
18
  import "./chunk-XHKBHWLX.js";
19
- import "./chunk-DZURML2D.js";
20
- import "./chunk-DNJUSFBL.js";
19
+ import "./chunk-RLRDPZG4.js";
20
+ import "./chunk-NYBZJ44G.js";
21
21
  import "./chunk-T7E75EKA.js";
22
- import "./chunk-YROGUPOZ.js";
22
+ import "./chunk-WWTLAZQA.js";
23
23
  export {
24
24
  ensureCodexTrustAfterReapply,
25
25
  inspectConfiguredManagedProviders,
@@ -109,6 +109,7 @@ declare const handlePostToolUse: (input: {
109
109
  tool_result?: unknown;
110
110
  cwd?: string;
111
111
  session_id?: string;
112
+ agent_id?: string;
112
113
  transcript_path?: string;
113
114
  tool_use_id?: string;
114
115
  }, agent?: AgentIdentity) => Promise<string | undefined>;