@pushary/agent-hooks 1.6.2 → 1.6.4

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 (88) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/bin/pushary-bell-hook.js +21 -18
  3. package/dist/bin/pushary-bell.js +8 -8
  4. package/dist/bin/pushary-claude.js +24 -22
  5. package/dist/bin/pushary-clean.js +38 -36
  6. package/dist/bin/pushary-codex-bridge.js +22 -21
  7. package/dist/bin/pushary-codex-hook.js +36 -30
  8. package/dist/bin/pushary-codex.js +11 -9
  9. package/dist/bin/pushary-connect.js +10 -8
  10. package/dist/bin/pushary-cowork.js +3 -3
  11. package/dist/bin/pushary-daemon.js +27 -27
  12. package/dist/bin/pushary-disconnect.js +20 -18
  13. package/dist/bin/pushary-doctor.js +53 -51
  14. package/dist/bin/pushary-elicitation-hook.js +23 -21
  15. package/dist/bin/pushary-gemini-bridge.js +9 -9
  16. package/dist/bin/pushary-gemini-hook.js +32 -26
  17. package/dist/bin/pushary-hook.js +34 -28
  18. package/dist/bin/pushary-login.js +8 -8
  19. package/dist/bin/pushary-logout.js +9 -9
  20. package/dist/bin/pushary-mode.js +7 -4
  21. package/dist/bin/pushary-notification-hook.js +25 -23
  22. package/dist/bin/pushary-opencode-hook.js +31 -25
  23. package/dist/bin/pushary-permission-denied-hook.js +29 -27
  24. package/dist/bin/pushary-permission-hook.js +28 -26
  25. package/dist/bin/pushary-post-hook.js +25 -23
  26. package/dist/bin/pushary-prompt-hook.js +25 -23
  27. package/dist/bin/pushary-session-end-hook.js +25 -23
  28. package/dist/bin/pushary-session-start-hook.js +29 -27
  29. package/dist/bin/pushary-setup.js +194 -105
  30. package/dist/bin/pushary-stats.js +2 -2
  31. package/dist/bin/pushary-status.js +12 -12
  32. package/dist/bin/pushary-stop-hook.js +25 -23
  33. package/dist/bin/pushary-stopfailure-hook.js +25 -23
  34. package/dist/bin/pushary-transcript-register.js +16 -16
  35. package/dist/bin/pushary-transcripts.js +4 -4
  36. package/dist/bin/pushary-upgrade.js +25 -24
  37. package/dist/bin/pushary-wait.js +7 -4
  38. package/dist/bin/pushary.js +8 -3
  39. package/dist/{chunk-N6AMKPDW.js → chunk-3LU74H52.js} +1 -1
  40. package/dist/{chunk-SB2CRLFK.js → chunk-3VZX4NSP.js} +1 -1
  41. package/dist/{chunk-ND43S2N4.js → chunk-53DN77WB.js} +1 -1
  42. package/dist/{chunk-KKZ5TDTB.js → chunk-5SWQZ6HY.js} +4 -4
  43. package/dist/{chunk-A6BENRKI.js → chunk-5U3FJ6YF.js} +7 -7
  44. package/dist/{chunk-CH4QMWBM.js → chunk-5UWV5GHM.js} +1 -1
  45. package/dist/{chunk-55AT5DJD.js → chunk-6NLWK6ZV.js} +2 -2
  46. package/dist/{chunk-HW2M7XAU.js → chunk-7CLTSZOL.js} +3 -3
  47. package/dist/{chunk-HETOKNIL.js → chunk-BJENQBMH.js} +3 -3
  48. package/dist/{chunk-A5ODW52C.js → chunk-CAS7GFWI.js} +75 -28
  49. package/dist/{chunk-M543MAUN.js → chunk-D3K2FPPJ.js} +8 -8
  50. package/dist/chunk-DESAUCH2.js +126 -0
  51. package/dist/{chunk-LH2N6VAN.js → chunk-DZTKLE7Q.js} +3 -1
  52. package/dist/{chunk-LVHGSD5E.js → chunk-EREBZHN2.js} +12 -6
  53. package/dist/{chunk-E72R2MHO.js → chunk-GBL4BTG3.js} +2 -2
  54. package/dist/{chunk-GKO7T4JM.js → chunk-H6XU22TN.js} +14 -8
  55. package/dist/{chunk-OXFWJIW4.js → chunk-HUB4Q35G.js} +1 -1
  56. package/dist/{chunk-NEUYPY3I.js → chunk-I2YUMZLE.js} +7 -6
  57. package/dist/{chunk-3PDQE66Q.js → chunk-I3XJATMR.js} +1 -1
  58. package/dist/{chunk-TCT4WUDP.js → chunk-JOGA3TL2.js} +6 -6
  59. package/dist/{chunk-ON7VIYOQ.js → chunk-K32C2RGK.js} +3 -1
  60. package/dist/{chunk-F5ENKWKY.js → chunk-LDRGVXLR.js} +1 -1
  61. package/dist/{chunk-TDXQQB55.js → chunk-LFMOYHPY.js} +1 -1
  62. package/dist/{chunk-572FZF7T.js → chunk-LJEL7IB5.js} +5 -5
  63. package/dist/{chunk-3HUDBDO7.js → chunk-LQI7W4RG.js} +1 -1
  64. package/dist/{chunk-RKSBBEGT.js → chunk-N62KAMMY.js} +1 -1
  65. package/dist/{chunk-LN3FETAC.js → chunk-NFH73H5B.js} +3 -3
  66. package/dist/{chunk-SD6SAIEV.js → chunk-NYMPLNV3.js} +3 -3
  67. package/dist/{chunk-KUQF2VO6.js → chunk-OZE2TQX5.js} +5 -5
  68. package/dist/{chunk-HYN2BILS.js → chunk-P4UYILQK.js} +5 -6
  69. package/dist/{chunk-HLY5W2P4.js → chunk-PBKEYMAO.js} +1 -1
  70. package/dist/{chunk-VQIINJ45.js → chunk-PJF7L7AA.js} +1 -1
  71. package/dist/chunk-POFBE6ZY.js +12 -0
  72. package/dist/{chunk-RKNA2L2J.js → chunk-R4HVHTNA.js} +1 -1
  73. package/dist/{chunk-2J63MNXV.js → chunk-UAP556WK.js} +5 -6
  74. package/dist/{chunk-HXKY6DFD.js → chunk-UGKDBJJX.js} +2 -2
  75. package/dist/{chunk-5KREBDUT.js → chunk-VA2R64I7.js} +1 -1
  76. package/dist/{chunk-NSG2Q4PI.js → chunk-VHNDE3ZD.js} +1 -1
  77. package/dist/chunk-VOCZHOXV.js +142 -0
  78. package/dist/{chunk-ZRLB3N37.js → chunk-XJG2FUWS.js} +3 -3
  79. package/dist/{chunk-7REOI7BC.js → chunk-XOMH53NB.js} +1 -1
  80. package/dist/{chunk-D5ORNUHK.js → chunk-YPONELWS.js} +6 -6
  81. package/dist/{chunk-XINNQCPW.js → chunk-YUGGNZSF.js} +1 -1
  82. package/dist/{chunk-D5PQGC5V.js → chunk-YXPGFRRW.js} +3 -3
  83. package/dist/{chunk-RK2MUM6Q.js → chunk-ZA5UXRNE.js} +3 -3
  84. package/dist/{reapply-KV6RTOQL.js → reapply-4DAJKNVP.js} +9 -9
  85. package/dist/src/index.d.ts +2 -2
  86. package/dist/src/index.js +17 -15
  87. package/package.json +1 -1
  88. package/dist/chunk-SAF6HGAA.js +0 -57
@@ -2,16 +2,16 @@ import {
2
2
  needsShell,
3
3
  spawnClaude
4
4
  } from "./chunk-XHKBHWLX.js";
5
+ import {
6
+ readControlMode
7
+ } from "./chunk-R4HVHTNA.js";
5
8
  import {
6
9
  getMachineId
7
- } from "./chunk-LH2N6VAN.js";
10
+ } from "./chunk-DZTKLE7Q.js";
8
11
  import {
9
12
  pusharyDir,
10
13
  resolveGlobalBinary
11
- } from "./chunk-ON7VIYOQ.js";
12
- import {
13
- readControlMode
14
- } from "./chunk-RKNA2L2J.js";
14
+ } from "./chunk-K32C2RGK.js";
15
15
  import {
16
16
  readJsonSafe,
17
17
  writeFileAtomic,
@@ -1,6 +1,9 @@
1
+ import {
2
+ isDisabledByEnv
3
+ } from "./chunk-POFBE6ZY.js";
1
4
  import {
2
5
  autoUpdateState
3
- } from "./chunk-ON7VIYOQ.js";
6
+ } from "./chunk-K32C2RGK.js";
4
7
  import {
5
8
  readJsonSafe,
6
9
  writeJsonAtomic
@@ -18,7 +21,6 @@ var AUTO_UPDATE_FLAG = "--auto";
18
21
  var GLOBAL_PACKAGE_SUBPATH = "/lib/node_modules/@pushary/agent-hooks";
19
22
  var UPGRADE_ENTRY_SUBPATH = ["dist", "bin", "pushary-upgrade.js"];
20
23
  var NON_GLOBAL_INSTALL_SEGMENTS = ["/_npx/", "/.volta/"];
21
- var NOT_DISABLED_VALUES = /* @__PURE__ */ new Set(["", "0"]);
22
24
  var AUTO_UPDATE_RESULTS = ["updated", "current", "needs_manual", "failed", "finish_pending"];
23
25
  var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
24
26
  var isAutoUpdateResult = (value) => typeof value === "string" && AUTO_UPDATE_RESULTS.some((result) => result === value);
@@ -43,10 +45,7 @@ var parseAutoUpdateState = (value) => {
43
45
  announced: booleanField(value, "announced")
44
46
  };
45
47
  };
46
- var isAutoUpdateDisabledByEnv = (env) => {
47
- const value = env[AUTO_UPDATE_DISABLE_ENV];
48
- return value !== void 0 && !NOT_DISABLED_VALUES.has(value.trim());
49
- };
48
+ var isAutoUpdateDisabledByEnv = (env) => isDisabledByEnv(env, AUTO_UPDATE_DISABLE_ENV);
50
49
  var isContinuousIntegration = (env) => Boolean(env.CI);
51
50
  var autoUpdateOffReason = (input) => {
52
51
  if (isAutoUpdateDisabledByEnv(input.env)) return "disabled_by_env";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parseVersion
3
- } from "./chunk-HW2M7XAU.js";
3
+ } from "./chunk-7CLTSZOL.js";
4
4
 
5
5
  // src/setup/agent-probe.ts
6
6
  import { execSync } from "child_process";
@@ -3,7 +3,7 @@ import {
3
3
  decodePublicKey,
4
4
  generateSessionKey,
5
5
  wrapSessionKey
6
- } from "./chunk-7REOI7BC.js";
6
+ } from "./chunk-XOMH53NB.js";
7
7
  import {
8
8
  fetchTranscriptRecipients,
9
9
  uploadTranscriptRecords
@@ -0,0 +1,12 @@
1
+ // src/cli/env-switch.ts
2
+ var CLIENT_REPORT_DISABLE_ENV = "PUSHARY_DISABLE_CLIENT_REPORTS";
3
+ var NOT_DISABLED_VALUES = /* @__PURE__ */ new Set(["", "0"]);
4
+ var isDisabledByEnv = (env, name) => {
5
+ const value = env[name];
6
+ return value !== void 0 && !NOT_DISABLED_VALUES.has(value.trim());
7
+ };
8
+
9
+ export {
10
+ CLIENT_REPORT_DISABLE_ENV,
11
+ isDisabledByEnv
12
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveInstallSourceFor
3
- } from "./chunk-NSG2Q4PI.js";
3
+ } from "./chunk-VHNDE3ZD.js";
4
4
  import {
5
5
  backupFile,
6
6
  readJsonSafe,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  registerTranscript
3
- } from "./chunk-M543MAUN.js";
3
+ } from "./chunk-D3K2FPPJ.js";
4
4
  import {
5
- degradedLine
6
- } from "./chunk-A5ODW52C.js";
5
+ writeDegraded
6
+ } from "./chunk-VOCZHOXV.js";
7
7
 
8
8
  // src/tool-hook-input.ts
9
9
  var OPTIONAL_TEXT_FIELDS = ["hook_event_name", "session_id", "cwd", "transcript_path", "tool_use_id", "permission_mode"];
@@ -63,12 +63,11 @@ var matches = (rule, source, event) => {
63
63
  var isAdmitted = (rules, source, event) => !rules.disabled.some((rule) => matches(rule, source, event));
64
64
  var readHookInput = async (source, fallbackEvent = "", stdin = process.stdin, parseInput) => {
65
65
  if (source === null) {
66
- process.stderr.write(`${degradedLine("hook", {
66
+ writeDegraded("hook", {
67
67
  reason: "unknown_agent",
68
68
  fallback: "stood aside, so nothing is gated or reported for this call",
69
69
  event: fallbackEvent
70
- })}
71
- `);
70
+ });
72
71
  return null;
73
72
  }
74
73
  let raw = "";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyFetch
3
- } from "./chunk-SAF6HGAA.js";
3
+ } from "./chunk-DESAUCH2.js";
4
4
  import {
5
5
  NetworkError
6
6
  } from "./chunk-7QLSKOSU.js";
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  isValidApiKey,
15
15
  normalizeKeyScope
16
- } from "./chunk-A5ODW52C.js";
16
+ } from "./chunk-CAS7GFWI.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
  readTranscriptPreference
3
- } from "./chunk-RKNA2L2J.js";
3
+ } from "./chunk-R4HVHTNA.js";
4
4
 
5
5
  // src/transcript-setting.ts
6
6
  var transcriptEnvironmentPreference = () => {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-OSJEMXSR.js";
4
4
  import {
5
5
  normalizeInstallSource
6
- } from "./chunk-A5ODW52C.js";
6
+ } from "./chunk-CAS7GFWI.js";
7
7
 
8
8
  // src/install-source.ts
9
9
  import { readFileSync } from "fs";
@@ -0,0 +1,142 @@
1
+ import {
2
+ CLIENT_REPORT_DISABLE_ENV,
3
+ isDisabledByEnv
4
+ } from "./chunk-POFBE6ZY.js";
5
+ import {
6
+ isNetworkFailure
7
+ } from "./chunk-DESAUCH2.js";
8
+ import {
9
+ clientReportClaims
10
+ } from "./chunk-K32C2RGK.js";
11
+ import {
12
+ getApiKey,
13
+ getBaseUrl
14
+ } from "./chunk-OSJEMXSR.js";
15
+ import {
16
+ CLIENT_REPORT_PATH,
17
+ degradedLine
18
+ } from "./chunk-CAS7GFWI.js";
19
+
20
+ // src/client-report-claim.ts
21
+ import { createHash } from "crypto";
22
+ import { closeSync, mkdirSync, openSync, readdirSync, unlinkSync } from "fs";
23
+ import { join } from "path";
24
+ var CLIENT_REPORT_WINDOW_MS = 6e4;
25
+ var CLAIM_DIRECTORY_MODE = 448;
26
+ var CLAIM_FILE_MODE = 384;
27
+ var CLAIM_KEY_HASH_LENGTH = 16;
28
+ var CLAIM_FILE_PATTERN = /^[0-9a-f]{16}-(\d+)$/;
29
+ var EXCLUSIVE_CREATE = "wx";
30
+ var ALREADY_EXISTS = "EEXIST";
31
+ var WINDOWS_KEPT_BEHIND = 1;
32
+ var reportWindowOf = (now) => Math.floor(now / CLIENT_REPORT_WINDOW_MS);
33
+ var claimFileName = (key, window) => `${createHash("sha256").update(key).digest("hex").slice(0, CLAIM_KEY_HASH_LENGTH)}-${window}`;
34
+ var errorCodeOf = (error) => typeof error === "object" && error !== null && "code" in error && typeof error.code === "string" ? error.code : null;
35
+ var claimWindowOf = (fileName) => {
36
+ const match = CLAIM_FILE_PATTERN.exec(fileName);
37
+ return match ? Number(match[1]) : null;
38
+ };
39
+ var isStaleClaim = (fileName, window) => {
40
+ const claimedWindow = claimWindowOf(fileName);
41
+ return claimedWindow !== null && claimedWindow < window - WINDOWS_KEPT_BEHIND;
42
+ };
43
+ var removeQuietly = (filePath) => {
44
+ try {
45
+ unlinkSync(filePath);
46
+ } catch {
47
+ return;
48
+ }
49
+ };
50
+ var removeStaleClaims = (claimsDir, window) => {
51
+ try {
52
+ for (const fileName of readdirSync(claimsDir)) {
53
+ if (isStaleClaim(fileName, window)) removeQuietly(join(claimsDir, fileName));
54
+ }
55
+ } catch {
56
+ return;
57
+ }
58
+ };
59
+ var claimReportWindow = (claimsDir, key, now) => {
60
+ const window = reportWindowOf(now);
61
+ try {
62
+ mkdirSync(claimsDir, { recursive: true, mode: CLAIM_DIRECTORY_MODE });
63
+ closeSync(openSync(join(claimsDir, claimFileName(key, window)), EXCLUSIVE_CREATE, CLAIM_FILE_MODE));
64
+ } catch (error) {
65
+ return errorCodeOf(error) === ALREADY_EXISTS ? "already_claimed" : "unavailable";
66
+ }
67
+ removeStaleClaims(claimsDir, window);
68
+ return "claimed";
69
+ };
70
+
71
+ // src/client-report.ts
72
+ var CLIENT_REPORT_TIMEOUT_MS = 1e3;
73
+ var readApiKey = () => {
74
+ try {
75
+ return getApiKey();
76
+ } catch {
77
+ return null;
78
+ }
79
+ };
80
+ var defaultDeps = () => ({
81
+ disabled: () => isDisabledByEnv(process.env, CLIENT_REPORT_DISABLE_ENV),
82
+ fetchImpl: fetch,
83
+ apiKey: readApiKey,
84
+ baseUrl: getBaseUrl,
85
+ now: Date.now,
86
+ claimsDir: clientReportClaims()
87
+ });
88
+ var reportKey = (event) => `${event.kind}:${event.code}`;
89
+ var createClientErrorReporter = (deps) => {
90
+ const windowClaimedInProcess = /* @__PURE__ */ new Map();
91
+ const claimInProcess = (key, now) => {
92
+ if (windowClaimedInProcess.get(key) === reportWindowOf(now)) return false;
93
+ windowClaimedInProcess.set(key, reportWindowOf(now));
94
+ return true;
95
+ };
96
+ const claimReport = (key, now) => {
97
+ const claim = claimReportWindow(deps.claimsDir, key, now);
98
+ return claim === "unavailable" ? claimInProcess(key, now) : claim === "claimed";
99
+ };
100
+ return async (event) => {
101
+ try {
102
+ if (deps.disabled()) return;
103
+ const apiKey = deps.apiKey();
104
+ const now = deps.now();
105
+ if (!apiKey || !claimReport(reportKey(event), now)) return;
106
+ await deps.fetchImpl(`${deps.baseUrl()}${CLIENT_REPORT_PATH}`, {
107
+ method: "POST",
108
+ headers: { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json" },
109
+ body: JSON.stringify({ ...event, occurredAt: new Date(now).toISOString() }),
110
+ signal: AbortSignal.timeout(CLIENT_REPORT_TIMEOUT_MS)
111
+ });
112
+ } catch {
113
+ return;
114
+ }
115
+ };
116
+ };
117
+ var processReporter = null;
118
+ var inFlightReports = /* @__PURE__ */ new Set();
119
+ var reportClientError = (event) => {
120
+ processReporter ??= createClientErrorReporter(defaultDeps());
121
+ const report = processReporter(event);
122
+ inFlightReports.add(report);
123
+ void report.finally(() => inFlightReports.delete(report));
124
+ return report;
125
+ };
126
+ var exitAfterClientReports = async (code) => {
127
+ await Promise.all(inFlightReports);
128
+ return process.exit(code);
129
+ };
130
+ var clientErrorKindOf = (error) => isNetworkFailure(error) ? "network" : "unexpected";
131
+ var writeDegraded = (subsystem, report) => {
132
+ process.stderr.write(`${degradedLine(subsystem, report)}
133
+ `);
134
+ void reportClientError({ kind: "degraded", code: `${subsystem}:${report.reason}` });
135
+ };
136
+
137
+ export {
138
+ reportClientError,
139
+ exitAfterClientReports,
140
+ clientErrorKindOf,
141
+ writeDegraded
142
+ };
@@ -12,14 +12,14 @@ import {
12
12
  } from "./chunk-5RUIFDTP.js";
13
13
  import {
14
14
  callMcpTool
15
- } from "./chunk-HETOKNIL.js";
15
+ } from "./chunk-BJENQBMH.js";
16
16
  import {
17
17
  reportedInstallSource
18
- } from "./chunk-NSG2Q4PI.js";
18
+ } from "./chunk-VHNDE3ZD.js";
19
19
  import {
20
20
  PAIR_TTL_SECONDS,
21
21
  isAnswerSource
22
- } from "./chunk-A5ODW52C.js";
22
+ } from "./chunk-CAS7GFWI.js";
23
23
  import {
24
24
  NPX_LATEST_COMMAND
25
25
  } from "./chunk-EA3IELHP.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  redactSecrets
3
- } from "./chunk-A5ODW52C.js";
3
+ } from "./chunk-CAS7GFWI.js";
4
4
 
5
5
  // src/crypto.ts
6
6
  import nacl from "tweetnacl";
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  detectClaudeVersion
3
- } from "./chunk-HLY5W2P4.js";
3
+ } from "./chunk-PBKEYMAO.js";
4
4
  import {
5
5
  ensureCodexTrustsPusharyHooks
6
- } from "./chunk-ND43S2N4.js";
6
+ } from "./chunk-53DN77WB.js";
7
7
  import {
8
8
  addClaudeMcpServer,
9
9
  addPusharyHooks,
10
10
  addPusharyToolPermissions
11
- } from "./chunk-RK2MUM6Q.js";
11
+ } from "./chunk-ZA5UXRNE.js";
12
12
  import {
13
13
  claudeUnprovenHolds,
14
14
  claudeWired,
15
15
  codexUnprovenHolds,
16
16
  codexWired,
17
17
  geminiWired
18
- } from "./chunk-D5PQGC5V.js";
18
+ } from "./chunk-YXPGFRRW.js";
19
19
  import {
20
20
  CLAUDE_HOOK_BINARY,
21
21
  CLAUDE_HOOK_EVENTS,
@@ -27,7 +27,7 @@ import {
27
27
  needsReregistration,
28
28
  registrationSignatures,
29
29
  supportedClaudeEvents
30
- } from "./chunk-HW2M7XAU.js";
30
+ } from "./chunk-7CLTSZOL.js";
31
31
  import {
32
32
  CODEX_HOOK_BINARY,
33
33
  addCodexHookTrust,
@@ -47,7 +47,7 @@ import {
47
47
  registrationHolderOf,
48
48
  resolveGlobalBinary,
49
49
  vscodePluginMcp
50
- } from "./chunk-ON7VIYOQ.js";
50
+ } from "./chunk-K32C2RGK.js";
51
51
  import {
52
52
  readJsonSafe,
53
53
  writeFileAtomic,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PRETOOLUSE_GATED_TOOLS
3
- } from "./chunk-A5ODW52C.js";
3
+ } from "./chunk-CAS7GFWI.js";
4
4
 
5
5
  // src/claude-tools.ts
6
6
  var POSTTOOLUSE_MIRROR_ONLY_TOOLS = ["TodoWrite", "Task", "WebFetch", "WebSearch"];
@@ -2,17 +2,17 @@ import {
2
2
  CLAUDE_HOOK_EVENTS,
3
3
  GEMINI_HOOK_EVENTS,
4
4
  hasGeminiHooks
5
- } from "./chunk-HW2M7XAU.js";
5
+ } from "./chunk-7CLTSZOL.js";
6
6
  import {
7
7
  CODEX_HOOK_EVENTS,
8
8
  hasCodexHooks,
9
9
  holdBudgetOf
10
- } from "./chunk-ON7VIYOQ.js";
10
+ } from "./chunk-K32C2RGK.js";
11
11
  import {
12
12
  CURSOR_GATE_EVENTS,
13
13
  HOOK_LOCATOR_BINARY,
14
14
  hookCommandHoldBudget
15
- } from "./chunk-A5ODW52C.js";
15
+ } from "./chunk-CAS7GFWI.js";
16
16
 
17
17
  // src/diagnostics/wiring.ts
18
18
  var record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  CLAUDE_HOOK_EVENTS,
3
3
  supportedClaudeEvents
4
- } from "./chunk-HW2M7XAU.js";
4
+ } from "./chunk-7CLTSZOL.js";
5
5
  import {
6
6
  guardBinary,
7
7
  holdBudgetOf,
8
8
  isProtectedByScope,
9
9
  registerHookEntry
10
- } from "./chunk-ON7VIYOQ.js";
10
+ } from "./chunk-K32C2RGK.js";
11
11
  import {
12
12
  HOOK_LOCATOR_BINARY,
13
13
  withHookHoldBudget
14
- } from "./chunk-A5ODW52C.js";
14
+ } from "./chunk-CAS7GFWI.js";
15
15
 
16
16
  // src/claude-config.ts
17
17
  import { join } from "path";
@@ -9,17 +9,17 @@ import {
9
9
  reapplyGeminiSettings,
10
10
  reapplyVsCodePlugin,
11
11
  repairCodexHolds
12
- } from "./chunk-D5ORNUHK.js";
13
- import "./chunk-HLY5W2P4.js";
14
- import "./chunk-ND43S2N4.js";
15
- import "./chunk-RK2MUM6Q.js";
16
- import "./chunk-D5PQGC5V.js";
17
- import "./chunk-HW2M7XAU.js";
12
+ } from "./chunk-YPONELWS.js";
13
+ import "./chunk-PBKEYMAO.js";
14
+ import "./chunk-53DN77WB.js";
15
+ import "./chunk-ZA5UXRNE.js";
16
+ import "./chunk-YXPGFRRW.js";
17
+ import "./chunk-7CLTSZOL.js";
18
18
  import "./chunk-XHKBHWLX.js";
19
- import "./chunk-XINNQCPW.js";
20
- import "./chunk-ON7VIYOQ.js";
19
+ import "./chunk-YUGGNZSF.js";
20
+ import "./chunk-K32C2RGK.js";
21
21
  import "./chunk-T7E75EKA.js";
22
- import "./chunk-A5ODW52C.js";
22
+ import "./chunk-CAS7GFWI.js";
23
23
  import "./chunk-HWJW3CPO.js";
24
24
  export {
25
25
  ensureCodexTrustAfterReapply,
@@ -1,5 +1,5 @@
1
1
  import { CanonicalGateInputs, ReceiptMeta } from '@pushary/hook-mapping';
2
- import { ClaudePreToolUseOutput, MachineDecisionOrigin, SettledOutcome, AgentQuestion, PolicyConfig, ApprovalMode, ModeState } from '@pushary/contracts';
2
+ import { ClaudePreToolUseOutput, SetupOutcomeBeacon, MachineDecisionOrigin, SettledOutcome, AgentQuestion, PolicyConfig, ApprovalMode, ModeState } from '@pushary/contracts';
3
3
  export { ApprovalMode, ModeState, PolicyConfig, ToolPolicy, resolvePolicy } from '@pushary/contracts';
4
4
 
5
5
  interface ToolHookInput {
@@ -30,7 +30,7 @@ interface AgentIdentity {
30
30
  readonly type: string;
31
31
  readonly label: string;
32
32
  }
33
- interface AgentEvent {
33
+ interface AgentEvent extends Partial<Omit<SetupOutcomeBeacon, 'agents'>> {
34
34
  occurredAt?: string;
35
35
  toolUseId?: string;
36
36
  event: string;
package/dist/src/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  handlePreToolUse
3
- } from "../chunk-A6BENRKI.js";
4
- import "../chunk-572FZF7T.js";
5
- import "../chunk-RK2MUM6Q.js";
6
- import "../chunk-SD6SAIEV.js";
7
- import "../chunk-CH4QMWBM.js";
3
+ } from "../chunk-5U3FJ6YF.js";
4
+ import "../chunk-LJEL7IB5.js";
5
+ import "../chunk-ZA5UXRNE.js";
6
+ import "../chunk-NYMPLNV3.js";
7
+ import "../chunk-5UWV5GHM.js";
8
8
  import "../chunk-YHG74UFF.js";
9
- import "../chunk-HW2M7XAU.js";
9
+ import "../chunk-7CLTSZOL.js";
10
10
  import {
11
11
  fetchAccountPublicKey
12
12
  } from "../chunk-66H2QQAK.js";
@@ -18,20 +18,22 @@ import {
18
18
  handlePostToolUse,
19
19
  handleStop,
20
20
  reportEvent
21
- } from "../chunk-GKO7T4JM.js";
22
- import "../chunk-XINNQCPW.js";
21
+ } from "../chunk-H6XU22TN.js";
22
+ import "../chunk-YUGGNZSF.js";
23
23
  import {
24
24
  askUser,
25
25
  cancelQuestion,
26
26
  waitForAnswer
27
- } from "../chunk-LVHGSD5E.js";
28
- import "../chunk-LH2N6VAN.js";
29
- import "../chunk-ON7VIYOQ.js";
30
- import "../chunk-HETOKNIL.js";
31
- import "../chunk-SAF6HGAA.js";
27
+ } from "../chunk-EREBZHN2.js";
28
+ import "../chunk-VOCZHOXV.js";
29
+ import "../chunk-POFBE6ZY.js";
30
+ import "../chunk-BJENQBMH.js";
31
+ import "../chunk-DESAUCH2.js";
32
+ import "../chunk-DZTKLE7Q.js";
32
33
  import "../chunk-7QLSKOSU.js";
33
34
  import "../chunk-KZERVKTD.js";
34
- import "../chunk-NSG2Q4PI.js";
35
+ import "../chunk-VHNDE3ZD.js";
36
+ import "../chunk-K32C2RGK.js";
35
37
  import "../chunk-T7E75EKA.js";
36
38
  import {
37
39
  getApiKey,
@@ -39,7 +41,7 @@ import {
39
41
  } from "../chunk-OSJEMXSR.js";
40
42
  import {
41
43
  resolvePolicy
42
- } from "../chunk-A5ODW52C.js";
44
+ } from "../chunk-CAS7GFWI.js";
43
45
  import "../chunk-EA3IELHP.js";
44
46
  import "../chunk-HWJW3CPO.js";
45
47
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushary/agent-hooks",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "description": "Permission hooks for AI coding agents: route tool approvals through Pushary push notifications",
5
5
  "keywords": [
6
6
  "pushary",
@@ -1,57 +0,0 @@
1
- import {
2
- NetworkError
3
- } from "./chunk-7QLSKOSU.js";
4
-
5
- // src/cli/net.ts
6
- import { createRequire } from "module";
7
- var requireCjs = createRequire(import.meta.url);
8
- var PROXY_VARS = ["HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy"];
9
- var proxyFromEnv = () => {
10
- for (const name of PROXY_VARS) {
11
- const value = process.env[name]?.trim();
12
- if (value) return value;
13
- }
14
- return void 0;
15
- };
16
- var installed = false;
17
- var installProxyDispatcher = () => {
18
- if (installed) return;
19
- installed = true;
20
- if (!proxyFromEnv()) return;
21
- try {
22
- const { EnvHttpProxyAgent, setGlobalDispatcher } = requireCjs("undici");
23
- setGlobalDispatcher(new EnvHttpProxyAgent());
24
- } catch {
25
- }
26
- };
27
- var isNetworkFailure = (err) => {
28
- if (!(err instanceof Error)) return false;
29
- const code = err.code;
30
- if (code && ["ENOTFOUND", "ECONNREFUSED", "ECONNRESET", "ETIMEDOUT", "EAI_AGAIN", "EPROTO", "CERT_HAS_EXPIRED", "UNABLE_TO_VERIFY_LEAF_SIGNATURE"].includes(code)) {
31
- return true;
32
- }
33
- return err.name === "AbortError" || err.name === "TimeoutError" || /fetch failed/i.test(err.message);
34
- };
35
- var DEFAULT_TIMEOUT_MS = 15e3;
36
- var pusharyFetch = async (url, init = {}) => {
37
- installProxyDispatcher();
38
- const { timeoutMs = DEFAULT_TIMEOUT_MS, signal, ...rest } = init;
39
- try {
40
- return await fetch(url, {
41
- ...rest,
42
- signal: signal ?? AbortSignal.timeout(timeoutMs)
43
- });
44
- } catch (err) {
45
- if (isNetworkFailure(err)) {
46
- const proxy = proxyFromEnv();
47
- const via = proxy ? ` (via proxy ${proxy})` : "";
48
- throw new NetworkError(`Could not reach ${new URL(url).host}${via}: ${err instanceof Error ? err.message : String(err)}`);
49
- }
50
- throw err;
51
- }
52
- };
53
-
54
- export {
55
- installProxyDispatcher,
56
- pusharyFetch
57
- };