@pushary/agent-hooks 1.6.3 → 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.
- package/CHANGELOG.md +5 -0
- package/dist/bin/pushary-bell-hook.js +21 -18
- package/dist/bin/pushary-bell.js +8 -8
- package/dist/bin/pushary-claude.js +24 -22
- package/dist/bin/pushary-clean.js +38 -36
- package/dist/bin/pushary-codex-bridge.js +22 -21
- package/dist/bin/pushary-codex-hook.js +36 -30
- package/dist/bin/pushary-codex.js +11 -9
- package/dist/bin/pushary-connect.js +10 -8
- package/dist/bin/pushary-cowork.js +3 -3
- package/dist/bin/pushary-daemon.js +27 -27
- package/dist/bin/pushary-disconnect.js +20 -18
- package/dist/bin/pushary-doctor.js +53 -51
- package/dist/bin/pushary-elicitation-hook.js +23 -21
- package/dist/bin/pushary-gemini-bridge.js +9 -9
- package/dist/bin/pushary-gemini-hook.js +32 -26
- package/dist/bin/pushary-hook.js +34 -28
- package/dist/bin/pushary-login.js +8 -8
- package/dist/bin/pushary-logout.js +9 -9
- package/dist/bin/pushary-mode.js +7 -4
- package/dist/bin/pushary-notification-hook.js +25 -23
- package/dist/bin/pushary-opencode-hook.js +31 -25
- package/dist/bin/pushary-permission-denied-hook.js +29 -27
- package/dist/bin/pushary-permission-hook.js +28 -26
- package/dist/bin/pushary-post-hook.js +25 -23
- package/dist/bin/pushary-prompt-hook.js +25 -23
- package/dist/bin/pushary-session-end-hook.js +25 -23
- package/dist/bin/pushary-session-start-hook.js +29 -27
- package/dist/bin/pushary-setup.js +71 -69
- package/dist/bin/pushary-stats.js +2 -2
- package/dist/bin/pushary-status.js +12 -12
- package/dist/bin/pushary-stop-hook.js +25 -23
- package/dist/bin/pushary-stopfailure-hook.js +25 -23
- package/dist/bin/pushary-transcript-register.js +16 -16
- package/dist/bin/pushary-transcripts.js +4 -4
- package/dist/bin/pushary-upgrade.js +25 -24
- package/dist/bin/pushary-wait.js +7 -4
- package/dist/bin/pushary.js +8 -3
- package/dist/{chunk-NMRH3VX4.js → chunk-3LU74H52.js} +1 -1
- package/dist/{chunk-STOMNX4S.js → chunk-3VZX4NSP.js} +1 -1
- package/dist/{chunk-YOCXPNQ5.js → chunk-53DN77WB.js} +1 -1
- package/dist/{chunk-REYWOCQJ.js → chunk-5SWQZ6HY.js} +4 -4
- package/dist/{chunk-57YDFAPP.js → chunk-5U3FJ6YF.js} +7 -7
- package/dist/{chunk-4KSTLHWY.js → chunk-5UWV5GHM.js} +1 -1
- package/dist/{chunk-DX5FOQSO.js → chunk-6NLWK6ZV.js} +2 -2
- package/dist/{chunk-57DDP4TB.js → chunk-7CLTSZOL.js} +3 -3
- package/dist/{chunk-HETOKNIL.js → chunk-BJENQBMH.js} +3 -3
- package/dist/{chunk-GHOB245Q.js → chunk-CAS7GFWI.js} +59 -27
- package/dist/{chunk-LDS4ERW4.js → chunk-D3K2FPPJ.js} +8 -8
- package/dist/chunk-DESAUCH2.js +126 -0
- package/dist/{chunk-LM2IOEDK.js → chunk-DZTKLE7Q.js} +3 -1
- package/dist/{chunk-LVHGSD5E.js → chunk-EREBZHN2.js} +12 -6
- package/dist/{chunk-COGHCL6K.js → chunk-GBL4BTG3.js} +2 -2
- package/dist/{chunk-JBXUKGZS.js → chunk-H6XU22TN.js} +14 -8
- package/dist/{chunk-EJ7ADMNM.js → chunk-HUB4Q35G.js} +1 -1
- package/dist/{chunk-HCVAMXHT.js → chunk-I2YUMZLE.js} +1 -1
- package/dist/{chunk-GQPCPEG2.js → chunk-I3XJATMR.js} +1 -1
- package/dist/{chunk-ILGL4L3J.js → chunk-JOGA3TL2.js} +6 -6
- package/dist/{chunk-3BJQYXTL.js → chunk-K32C2RGK.js} +3 -1
- package/dist/{chunk-NKR4YDRP.js → chunk-LDRGVXLR.js} +1 -1
- package/dist/{chunk-3UOC3GRO.js → chunk-LFMOYHPY.js} +1 -1
- package/dist/{chunk-BG6OCZ4N.js → chunk-LJEL7IB5.js} +5 -5
- package/dist/{chunk-VDMX5EMU.js → chunk-LQI7W4RG.js} +1 -1
- package/dist/{chunk-RJUHSFYE.js → chunk-N62KAMMY.js} +1 -1
- package/dist/{chunk-P35IUFFR.js → chunk-NFH73H5B.js} +3 -3
- package/dist/{chunk-UAV5MNKY.js → chunk-NYMPLNV3.js} +3 -3
- package/dist/{chunk-QKOVVL7I.js → chunk-OZE2TQX5.js} +5 -5
- package/dist/{chunk-CTOK3AYA.js → chunk-P4UYILQK.js} +5 -6
- package/dist/{chunk-WD6W7QDI.js → chunk-PBKEYMAO.js} +1 -1
- package/dist/{chunk-ICGAIM2R.js → chunk-PJF7L7AA.js} +1 -1
- package/dist/chunk-POFBE6ZY.js +12 -0
- package/dist/{chunk-CWIARY6F.js → chunk-R4HVHTNA.js} +1 -1
- package/dist/{chunk-JX67DVMY.js → chunk-UAP556WK.js} +5 -6
- package/dist/{chunk-TZ4KUNZG.js → chunk-UGKDBJJX.js} +2 -2
- package/dist/{chunk-JBU7XKY2.js → chunk-VA2R64I7.js} +1 -1
- package/dist/{chunk-NPGOQQCV.js → chunk-VHNDE3ZD.js} +1 -1
- package/dist/chunk-VOCZHOXV.js +142 -0
- package/dist/{chunk-HHYVBHHC.js → chunk-XJG2FUWS.js} +3 -3
- package/dist/{chunk-KNIIFNNQ.js → chunk-XOMH53NB.js} +1 -1
- package/dist/{chunk-WA7SQX6S.js → chunk-YPONELWS.js} +6 -6
- package/dist/{chunk-BEHGVU4W.js → chunk-YUGGNZSF.js} +1 -1
- package/dist/{chunk-SND3C2AV.js → chunk-YXPGFRRW.js} +3 -3
- package/dist/{chunk-H3FEVIQD.js → chunk-ZA5UXRNE.js} +3 -3
- package/dist/{reapply-IB7YE7BU.js → reapply-4DAJKNVP.js} +9 -9
- package/dist/src/index.js +17 -15
- package/package.json +1 -1
- package/dist/chunk-SAF6HGAA.js +0 -57
|
@@ -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-
|
|
15
|
+
} from "./chunk-BJENQBMH.js";
|
|
16
16
|
import {
|
|
17
17
|
reportedInstallSource
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-VHNDE3ZD.js";
|
|
19
19
|
import {
|
|
20
20
|
PAIR_TTL_SECONDS,
|
|
21
21
|
isAnswerSource
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-CAS7GFWI.js";
|
|
23
23
|
import {
|
|
24
24
|
NPX_LATEST_COMMAND
|
|
25
25
|
} from "./chunk-EA3IELHP.js";
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
detectClaudeVersion
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PBKEYMAO.js";
|
|
4
4
|
import {
|
|
5
5
|
ensureCodexTrustsPusharyHooks
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-53DN77WB.js";
|
|
7
7
|
import {
|
|
8
8
|
addClaudeMcpServer,
|
|
9
9
|
addPusharyHooks,
|
|
10
10
|
addPusharyToolPermissions
|
|
11
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
50
|
+
} from "./chunk-K32C2RGK.js";
|
|
51
51
|
import {
|
|
52
52
|
readJsonSafe,
|
|
53
53
|
writeFileAtomic,
|
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
CLAUDE_HOOK_EVENTS,
|
|
3
3
|
GEMINI_HOOK_EVENTS,
|
|
4
4
|
hasGeminiHooks
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-7CLTSZOL.js";
|
|
6
6
|
import {
|
|
7
7
|
CODEX_HOOK_EVENTS,
|
|
8
8
|
hasCodexHooks,
|
|
9
9
|
holdBudgetOf
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-K32C2RGK.js";
|
|
11
11
|
import {
|
|
12
12
|
CURSOR_GATE_EVENTS,
|
|
13
13
|
HOOK_LOCATOR_BINARY,
|
|
14
14
|
hookCommandHoldBudget
|
|
15
|
-
} from "./chunk-
|
|
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-
|
|
4
|
+
} from "./chunk-7CLTSZOL.js";
|
|
5
5
|
import {
|
|
6
6
|
guardBinary,
|
|
7
7
|
holdBudgetOf,
|
|
8
8
|
isProtectedByScope,
|
|
9
9
|
registerHookEntry
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-K32C2RGK.js";
|
|
11
11
|
import {
|
|
12
12
|
HOOK_LOCATOR_BINARY,
|
|
13
13
|
withHookHoldBudget
|
|
14
|
-
} from "./chunk-
|
|
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-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
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-
|
|
20
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-YUGGNZSF.js";
|
|
20
|
+
import "./chunk-K32C2RGK.js";
|
|
21
21
|
import "./chunk-T7E75EKA.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-CAS7GFWI.js";
|
|
23
23
|
import "./chunk-HWJW3CPO.js";
|
|
24
24
|
export {
|
|
25
25
|
ensureCodexTrustAfterReapply,
|
package/dist/src/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
handlePreToolUse
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
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-
|
|
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-
|
|
22
|
-
import "../chunk-
|
|
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-
|
|
28
|
-
import "../chunk-
|
|
29
|
-
import "../chunk-
|
|
30
|
-
import "../chunk-
|
|
31
|
-
import "../chunk-
|
|
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-
|
|
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-
|
|
44
|
+
} from "../chunk-CAS7GFWI.js";
|
|
43
45
|
import "../chunk-EA3IELHP.js";
|
|
44
46
|
import "../chunk-HWJW3CPO.js";
|
|
45
47
|
export {
|
package/package.json
CHANGED
package/dist/chunk-SAF6HGAA.js
DELETED
|
@@ -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
|
-
};
|