@pushary/agent-hooks 1.9.43 → 1.9.44

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 (106) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +1 -0
  3. package/dist/bin/pushary-bell-hook.js +27 -26
  4. package/dist/bin/pushary-bell.js +11 -11
  5. package/dist/bin/pushary-claude.js +30 -28
  6. package/dist/bin/pushary-clean.js +39 -38
  7. package/dist/bin/pushary-codex-bridge.js +38 -28
  8. package/dist/bin/pushary-codex-hook.js +35 -33
  9. package/dist/bin/pushary-codex-session.d.ts +1 -0
  10. package/dist/bin/pushary-codex-session.js +253 -0
  11. package/dist/bin/pushary-codex.js +13 -12
  12. package/dist/bin/pushary-connect.js +28 -27
  13. package/dist/bin/pushary-cowork.js +6 -6
  14. package/dist/bin/pushary-daemon.js +48 -47
  15. package/dist/bin/pushary-disconnect.js +27 -26
  16. package/dist/bin/pushary-doctor.js +85 -82
  17. package/dist/bin/pushary-elicitation-hook.js +27 -26
  18. package/dist/bin/pushary-gemini-bridge.js +22 -22
  19. package/dist/bin/pushary-gemini-hook.js +32 -30
  20. package/dist/bin/pushary-hook.js +33 -32
  21. package/dist/bin/pushary-login.js +16 -16
  22. package/dist/bin/pushary-logout.js +28 -27
  23. package/dist/bin/pushary-mcp.js +9 -9
  24. package/dist/bin/pushary-mode.js +14 -14
  25. package/dist/bin/pushary-notification-hook.js +26 -25
  26. package/dist/bin/pushary-opencode-hook.js +31 -29
  27. package/dist/bin/pushary-permission-denied-hook.js +31 -30
  28. package/dist/bin/pushary-permission-hook.js +30 -29
  29. package/dist/bin/pushary-post-hook.js +26 -25
  30. package/dist/bin/pushary-prompt-hook.js +26 -25
  31. package/dist/bin/pushary-session-end-hook.js +26 -25
  32. package/dist/bin/pushary-session-start-hook.js +31 -30
  33. package/dist/bin/pushary-setup.js +165 -112
  34. package/dist/bin/pushary-stats.js +5 -5
  35. package/dist/bin/pushary-status.js +35 -34
  36. package/dist/bin/pushary-stop-hook.js +26 -25
  37. package/dist/bin/pushary-stopfailure-hook.js +26 -25
  38. package/dist/bin/pushary-suggestions.js +14 -14
  39. package/dist/bin/pushary-transcript-register.js +18 -18
  40. package/dist/bin/pushary-transcripts.js +7 -7
  41. package/dist/bin/pushary-upgrade.js +41 -40
  42. package/dist/bin/pushary-wait.js +14 -14
  43. package/dist/bin/pushary.js +7 -6
  44. package/dist/{chunk-ZJXEQV3A.js → chunk-2NVXFWQY.js} +1 -1
  45. package/dist/{chunk-H64CU2VB.js → chunk-3IRC3XFG.js} +2 -2
  46. package/dist/{chunk-JB4JCGRW.js → chunk-42CVAOC5.js} +2 -2
  47. package/dist/{chunk-S3OWTQ6Z.js → chunk-4JHEZ2PV.js} +12 -5
  48. package/dist/{chunk-LE2YVPAT.js → chunk-4WBAHVBK.js} +11 -11
  49. package/dist/{chunk-53KLSE2F.js → chunk-53UZN7JW.js} +3 -3
  50. package/dist/{chunk-4T2TGP4T.js → chunk-5ZSBQHCM.js} +12 -173
  51. package/dist/{chunk-Q7CUTGT4.js → chunk-6EV3B5CD.js} +1 -1
  52. package/dist/{chunk-MSUMSXTI.js → chunk-75M7NFFC.js} +1 -1
  53. package/dist/{chunk-VIVLJK3T.js → chunk-7UM4NCUI.js} +2 -2
  54. package/dist/{chunk-F5ALKPNS.js → chunk-ALY7ZBNB.js} +1 -1
  55. package/dist/{chunk-YRE6GUFZ.js → chunk-BKK3JCTD.js} +80 -164
  56. package/dist/{chunk-O7ADPLBF.js → chunk-CAJCCQ7N.js} +1 -1
  57. package/dist/{chunk-AVT7GPOF.js → chunk-CESLE4UN.js} +10 -10
  58. package/dist/{chunk-Y4VZYKSW.js → chunk-CEZTYTBN.js} +13 -11
  59. package/dist/{chunk-CIERFMQT.js → chunk-DD6IBKEJ.js} +4 -4
  60. package/dist/{chunk-TH74SUVV.js → chunk-E76QCZIA.js} +2 -2
  61. package/dist/{chunk-ENGASUEL.js → chunk-FI2F5KZJ.js} +4 -4
  62. package/dist/{chunk-V5SUKRRI.js → chunk-FKDZU6YX.js} +4 -4
  63. package/dist/{chunk-EA5NWDK7.js → chunk-FYNMFSIZ.js} +29 -0
  64. package/dist/{chunk-JJWG7CBT.js → chunk-GBCR2FH2.js} +3 -3
  65. package/dist/chunk-GOEIW2VH.js +266 -0
  66. package/dist/{chunk-Y3N3SYBX.js → chunk-GRAPJKDK.js} +1 -1
  67. package/dist/{chunk-ZORCUL3Z.js → chunk-HV4TEKNP.js} +4 -4
  68. package/dist/{chunk-A64UCGX3.js → chunk-IWHDNMM3.js} +5 -5
  69. package/dist/{chunk-RXXKFM22.js → chunk-JNU3LV47.js} +355 -138
  70. package/dist/{chunk-C6QBNBL4.js → chunk-KILK6SWZ.js} +7 -7
  71. package/dist/{chunk-SATOTPXW.js → chunk-KYLY6UMN.js} +1 -1
  72. package/dist/{chunk-NV2LARV4.js → chunk-L2ZM7LXN.js} +2 -2
  73. package/dist/{chunk-F7SZ2RCK.js → chunk-LEHBWBCG.js} +4 -4
  74. package/dist/{chunk-LAAOHBLO.js → chunk-M2L7625S.js} +2 -2
  75. package/dist/{chunk-HC4DQXAT.js → chunk-MIBCRQWK.js} +2 -2
  76. package/dist/{chunk-J6MVBWF2.js → chunk-MRQJCIFO.js} +1 -1
  77. package/dist/{chunk-XLHFWG2E.js → chunk-OR6KJOHE.js} +2 -2
  78. package/dist/{chunk-55FB6OSG.js → chunk-OSMNLNPF.js} +1 -1
  79. package/dist/{chunk-GTOBOC6M.js → chunk-OWQOMGBF.js} +1 -1
  80. package/dist/{chunk-S4QT3YFG.js → chunk-OZ7MLVDM.js} +15 -15
  81. package/dist/{chunk-LWW7SBK3.js → chunk-PGHN5D4N.js} +2 -2
  82. package/dist/{chunk-IDVKJICN.js → chunk-PQAFH4DF.js} +3 -11
  83. package/dist/{chunk-VGPEXMYM.js → chunk-RGBTKOCC.js} +42 -7
  84. package/dist/{chunk-H6V5S52A.js → chunk-S2ALW446.js} +3 -3
  85. package/dist/{chunk-IMD5FN6Y.js → chunk-SI2NC6UU.js} +3 -3
  86. package/dist/chunk-SVCT5D7K.js +196 -0
  87. package/dist/{chunk-JW4S4O4W.js → chunk-SWDPCDLT.js} +4 -4
  88. package/dist/{chunk-LDCRV6HG.js → chunk-T3KMJI4W.js} +2 -1
  89. package/dist/{chunk-PIZ65U3D.js → chunk-T4CKP47U.js} +5 -5
  90. package/dist/{chunk-C3RVRTHS.js → chunk-TJZUQRMH.js} +3 -3
  91. package/dist/{chunk-C54VJJ37.js → chunk-TKTS3SIM.js} +3 -3
  92. package/dist/{chunk-LOUZNXTJ.js → chunk-TWATOPHK.js} +2 -2
  93. package/dist/{chunk-FPJHS6PA.js → chunk-UC4PNLMK.js} +6 -6
  94. package/dist/{chunk-JE6GG3OV.js → chunk-UJXLVH66.js} +1 -1
  95. package/dist/{chunk-45W43U2Q.js → chunk-UY5E2UUW.js} +5 -5
  96. package/dist/{chunk-O4SYJVAF.js → chunk-UZVF6MP2.js} +5 -5
  97. package/dist/{chunk-SCYAXV7U.js → chunk-W2TA4EVZ.js} +5 -5
  98. package/dist/{chunk-VQL62ECJ.js → chunk-WBD7HZEZ.js} +1 -1
  99. package/dist/{chunk-W3BO56VE.js → chunk-WMO2XVG4.js} +1 -1
  100. package/dist/{chunk-NKBAEGT7.js → chunk-XPQDBTW4.js} +1 -1
  101. package/dist/{global-upgrade-FFWOHOJ4.js → global-upgrade-QSSDYZCZ.js} +6 -6
  102. package/dist/{paths-Y2WPCM5Y.js → paths-55DDFLY4.js} +2 -2
  103. package/dist/{reapply-N3MV3CKD.js → reapply-MEU66ALO.js} +23 -22
  104. package/dist/src/index.js +20 -19
  105. package/dist/{upgrade-lock-ZXXNRH2P.js → upgrade-lock-YLXAU4AD.js} +3 -3
  106. package/package.json +5 -2
@@ -1,184 +1,30 @@
1
1
  import {
2
- CLIENT_REPORT_DISABLE_ENV,
3
- isDisabledByEnv
4
- } from "./chunk-POFBE6ZY.js";
2
+ clientErrorKindOf,
3
+ isAskUserResponse,
4
+ isBlockedActionClaim,
5
+ isGateReply,
6
+ isWaitForAnswerResponse,
7
+ reportClientError
8
+ } from "./chunk-GOEIW2VH.js";
5
9
  import {
6
10
  SubscriptionRequiredError,
7
11
  callMcpTool
8
- } from "./chunk-53KLSE2F.js";
12
+ } from "./chunk-53UZN7JW.js";
9
13
  import {
10
- installNetworkDefaults,
11
- isNetworkFailure
12
- } from "./chunk-H6V5S52A.js";
14
+ installNetworkDefaults
15
+ } from "./chunk-S2ALW446.js";
13
16
  import {
14
- clientReportClaims
15
- } from "./chunk-S3OWTQ6Z.js";
16
- import {
17
- getApiKey,
18
17
  getBaseUrl
19
- } from "./chunk-GTOBOC6M.js";
18
+ } from "./chunk-OWQOMGBF.js";
20
19
  import {
21
20
  ASK_AGENT_NAME_MAX,
22
- CLIENT_REPORT_PATH,
23
21
  DECISION_LINE_MAX,
24
22
  GATE_PERMISSION_MODE_MAX_LENGTH,
25
- degradedLine,
26
23
  truncateLine
27
- } from "./chunk-RXXKFM22.js";
28
-
29
- // src/client-report-claim.ts
30
- import { createHash } from "crypto";
31
- import { closeSync, mkdirSync, openSync, readdirSync, unlinkSync } from "fs";
32
- import { join } from "path";
33
- var CLIENT_REPORT_WINDOW_MS = 6e4;
34
- var CLAIM_DIRECTORY_MODE = 448;
35
- var CLAIM_FILE_MODE = 384;
36
- var CLAIM_KEY_HASH_LENGTH = 16;
37
- var CLAIM_FILE_PATTERN = /^[0-9a-f]{16}-(\d+)$/;
38
- var EXCLUSIVE_CREATE = "wx";
39
- var ALREADY_EXISTS = "EEXIST";
40
- var WINDOWS_KEPT_BEHIND = 1;
41
- var reportWindowOf = (now) => Math.floor(now / CLIENT_REPORT_WINDOW_MS);
42
- var claimFileName = (key, window) => `${createHash("sha256").update(key).digest("hex").slice(0, CLAIM_KEY_HASH_LENGTH)}-${window}`;
43
- var errorCodeOf = (error) => typeof error === "object" && error !== null && "code" in error && typeof error.code === "string" ? error.code : null;
44
- var claimWindowOf = (fileName) => {
45
- const match = CLAIM_FILE_PATTERN.exec(fileName);
46
- return match ? Number(match[1]) : null;
47
- };
48
- var isStaleClaim = (fileName, window) => {
49
- const claimedWindow = claimWindowOf(fileName);
50
- return claimedWindow !== null && claimedWindow < window - WINDOWS_KEPT_BEHIND;
51
- };
52
- var removeQuietly = (filePath) => {
53
- try {
54
- unlinkSync(filePath);
55
- } catch {
56
- return;
57
- }
58
- };
59
- var removeStaleClaims = (claimsDir, window) => {
60
- try {
61
- for (const fileName of readdirSync(claimsDir)) {
62
- if (isStaleClaim(fileName, window)) removeQuietly(join(claimsDir, fileName));
63
- }
64
- } catch {
65
- return;
66
- }
67
- };
68
- var claimReportWindow = (claimsDir, key, now) => {
69
- const window = reportWindowOf(now);
70
- try {
71
- mkdirSync(claimsDir, { recursive: true, mode: CLAIM_DIRECTORY_MODE });
72
- closeSync(openSync(join(claimsDir, claimFileName(key, window)), EXCLUSIVE_CREATE, CLAIM_FILE_MODE));
73
- } catch (error) {
74
- return errorCodeOf(error) === ALREADY_EXISTS ? "already_claimed" : "unavailable";
75
- }
76
- removeStaleClaims(claimsDir, window);
77
- return "claimed";
78
- };
79
-
80
- // src/client-report.ts
81
- var CLIENT_REPORT_TIMEOUT_MS = 1e3;
82
- var readApiKey = () => {
83
- try {
84
- return getApiKey();
85
- } catch {
86
- return null;
87
- }
88
- };
89
- var defaultDeps = () => ({
90
- disabled: () => isDisabledByEnv(process.env, CLIENT_REPORT_DISABLE_ENV),
91
- fetchImpl: fetch,
92
- apiKey: readApiKey,
93
- baseUrl: getBaseUrl,
94
- now: Date.now,
95
- claimsDir: clientReportClaims()
96
- });
97
- var reportKey = (event) => `${event.kind}:${event.code}`;
98
- var createClientErrorReporter = (deps) => {
99
- const windowClaimedInProcess = /* @__PURE__ */ new Map();
100
- const claimInProcess = (key, now) => {
101
- if (windowClaimedInProcess.get(key) === reportWindowOf(now)) return false;
102
- windowClaimedInProcess.set(key, reportWindowOf(now));
103
- return true;
104
- };
105
- const claimReport = (key, now) => {
106
- const claim = claimReportWindow(deps.claimsDir, key, now);
107
- return claim === "unavailable" ? claimInProcess(key, now) : claim === "claimed";
108
- };
109
- return async (event) => {
110
- try {
111
- if (deps.disabled()) return;
112
- const apiKey = deps.apiKey();
113
- const now = deps.now();
114
- if (!apiKey || !claimReport(reportKey(event), now)) return;
115
- await deps.fetchImpl(`${deps.baseUrl()}${CLIENT_REPORT_PATH}`, {
116
- method: "POST",
117
- headers: { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json" },
118
- body: JSON.stringify({ ...event, occurredAt: new Date(now).toISOString() }),
119
- signal: AbortSignal.timeout(CLIENT_REPORT_TIMEOUT_MS)
120
- });
121
- } catch {
122
- return;
123
- }
124
- };
125
- };
126
- var processReporter = null;
127
- var inFlightReports = /* @__PURE__ */ new Set();
128
- var reportClientError = (event) => {
129
- processReporter ??= createClientErrorReporter(defaultDeps());
130
- const report = processReporter(event);
131
- inFlightReports.add(report);
132
- void report.finally(() => inFlightReports.delete(report));
133
- return report;
134
- };
135
- var exitAfterClientReports = async (code) => {
136
- await Promise.all(inFlightReports);
137
- return process.exit(code);
138
- };
139
- var clientErrorKindOf = (error) => isNetworkFailure(error) ? "network" : "unexpected";
140
- var writeDegraded = (subsystem, report) => {
141
- process.stderr.write(`${degradedLine(subsystem, report)}
142
- `);
143
- void reportClientError({ kind: "degraded", code: `${subsystem}:${report.reason}` });
144
- };
24
+ } from "./chunk-JNU3LV47.js";
145
25
 
146
26
  // src/api.ts
147
27
  import { randomUUID } from "crypto";
148
-
149
- // src/validate.ts
150
- var isPolicyConfig = (data) => {
151
- if (!data || typeof data !== "object") return false;
152
- const d = data;
153
- return (d.resolvedAgent === void 0 || typeof d.resolvedAgent === "string") && Array.isArray(d.policies) && typeof d.defaultTimeoutSeconds === "number" && typeof d.defaultTimeoutAction === "string";
154
- };
155
- var isAskUserResponse = (data) => {
156
- if (!data || typeof data !== "object") return false;
157
- const d = data;
158
- 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");
159
- };
160
- var isWaitForAnswerResponse = (data) => {
161
- if (!data || typeof data !== "object") return false;
162
- const d = data;
163
- return typeof d.answered === "boolean";
164
- };
165
- var GATE_REPLY_KINDS = ["kill", "allow", "deny", "ask", "no_opinion"];
166
- var isSettlementOutputs = (value) => {
167
- if (!value || typeof value !== "object" || Array.isArray(value)) return false;
168
- const outputs = value;
169
- return (outputs.approve === void 0 || typeof outputs.approve === "string") && (outputs.deny === void 0 || typeof outputs.deny === "string");
170
- };
171
- var isGateReply = (data) => {
172
- if (!data || typeof data !== "object") return false;
173
- const d = data;
174
- 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));
175
- };
176
- var isBlockedActionClaim = (data) => {
177
- if (!data || typeof data !== "object") return false;
178
- return typeof data.granted === "boolean";
179
- };
180
-
181
- // src/api.ts
182
28
  installNetworkDefaults();
183
29
  var isDecisionStopped = (result) => result.handoffAction === "stop" || ["cancelled", "unavailable", "stopped", "missing"].includes(result.status ?? "");
184
30
  var isAwayPaused = (result) => result.paused === true;
@@ -297,13 +143,6 @@ var claimBlockedAction = async (apiKey, request, timeoutMs) => {
297
143
  };
298
144
 
299
145
  export {
300
- reportClientError,
301
- exitAfterClientReports,
302
- clientErrorKindOf,
303
- writeDegraded,
304
- isPolicyConfig,
305
- isAskUserResponse,
306
- isWaitForAnswerResponse,
307
146
  isDecisionStopped,
308
147
  isAwayPaused,
309
148
  isLocalQuestionHandoff,
@@ -10,7 +10,7 @@ import {
10
10
  isSetupConnectMode,
11
11
  isValidApiKey,
12
12
  normalizeAgentId
13
- } from "./chunk-RXXKFM22.js";
13
+ } from "./chunk-JNU3LV47.js";
14
14
 
15
15
  // src/setup/options.ts
16
16
  var AGENT_CHOICES = SETUP_AGENT_CHOICES;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  redactSecretsFromContent
3
- } from "./chunk-RXXKFM22.js";
3
+ } from "./chunk-JNU3LV47.js";
4
4
 
5
5
  // src/crypto.ts
6
6
  import nacl from "tweetnacl";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-S3OWTQ6Z.js";
3
+ } from "./chunk-4JHEZ2PV.js";
4
4
  import {
5
5
  readJsonSafe,
6
6
  writeFileAtomic
@@ -13,7 +13,7 @@ import {
13
13
  serializeDeclinedAgents,
14
14
  withDeclinedAgent,
15
15
  withoutDeclinedAgent
16
- } from "./chunk-RXXKFM22.js";
16
+ } from "./chunk-JNU3LV47.js";
17
17
 
18
18
  // src/declined-agents-file.ts
19
19
  import { join } from "path";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-3EGEA4KH.js";
10
10
  import {
11
11
  getBaseUrl
12
- } from "./chunk-GTOBOC6M.js";
12
+ } from "./chunk-OWQOMGBF.js";
13
13
 
14
14
  // src/cli/login-ui.ts
15
15
  import { hostname } from "os";