@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,126 @@
|
|
|
1
|
+
import {
|
|
2
|
+
readExistingMachineId
|
|
3
|
+
} from "./chunk-DZTKLE7Q.js";
|
|
4
|
+
import {
|
|
5
|
+
NetworkError
|
|
6
|
+
} from "./chunk-7QLSKOSU.js";
|
|
7
|
+
import {
|
|
8
|
+
getBaseUrl
|
|
9
|
+
} from "./chunk-OSJEMXSR.js";
|
|
10
|
+
import {
|
|
11
|
+
clientContextHeaders
|
|
12
|
+
} from "./chunk-CAS7GFWI.js";
|
|
13
|
+
import {
|
|
14
|
+
getPackageVersion
|
|
15
|
+
} from "./chunk-HWJW3CPO.js";
|
|
16
|
+
|
|
17
|
+
// src/cli/net.ts
|
|
18
|
+
import { createRequire } from "module";
|
|
19
|
+
|
|
20
|
+
// src/cli/client-context.ts
|
|
21
|
+
import { randomUUID } from "crypto";
|
|
22
|
+
var CLI_RUN_ID = randomUUID();
|
|
23
|
+
var cliPlatform = () => `${process.platform}-${process.arch}`;
|
|
24
|
+
var memoizedContext = null;
|
|
25
|
+
var safeMachineId = () => {
|
|
26
|
+
try {
|
|
27
|
+
return readExistingMachineId();
|
|
28
|
+
} catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var readCliClientContext = () => ({
|
|
33
|
+
surface: "cli",
|
|
34
|
+
clientVersion: getPackageVersion(),
|
|
35
|
+
machineId: safeMachineId(),
|
|
36
|
+
runId: CLI_RUN_ID,
|
|
37
|
+
platform: cliPlatform()
|
|
38
|
+
});
|
|
39
|
+
var cliClientContext = () => {
|
|
40
|
+
if (memoizedContext) return memoizedContext;
|
|
41
|
+
const context = readCliClientContext();
|
|
42
|
+
if (context.machineId !== null) memoizedContext = context;
|
|
43
|
+
return context;
|
|
44
|
+
};
|
|
45
|
+
var originOf = (url) => {
|
|
46
|
+
try {
|
|
47
|
+
return new URL(url).origin;
|
|
48
|
+
} catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var requestUrlOf = (input) => typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
53
|
+
var isPusharyRequest = (input, baseUrl) => {
|
|
54
|
+
const target = originOf(requestUrlOf(input));
|
|
55
|
+
return target !== null && target === originOf(baseUrl);
|
|
56
|
+
};
|
|
57
|
+
var mergeClientContextHeaders = (input, init, context) => {
|
|
58
|
+
const headers = new Headers(input instanceof Request ? input.headers : void 0);
|
|
59
|
+
new Headers(init?.headers).forEach((value, name) => headers.set(name, value));
|
|
60
|
+
for (const [name, value] of Object.entries(clientContextHeaders(context))) {
|
|
61
|
+
if (!headers.has(name)) headers.set(name, value);
|
|
62
|
+
}
|
|
63
|
+
return headers;
|
|
64
|
+
};
|
|
65
|
+
var withClientContext = (fetchImpl, options) => (input, init) => isPusharyRequest(input, options.baseUrl()) ? fetchImpl(input, { ...init, headers: mergeClientContextHeaders(input, init, options.context()) }) : fetchImpl(input, init);
|
|
66
|
+
var installed = false;
|
|
67
|
+
var installClientContextHeaders = () => {
|
|
68
|
+
if (installed) return;
|
|
69
|
+
installed = true;
|
|
70
|
+
globalThis.fetch = withClientContext(globalThis.fetch.bind(globalThis), { baseUrl: getBaseUrl, context: cliClientContext });
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// src/cli/net.ts
|
|
74
|
+
var requireCjs = createRequire(import.meta.url);
|
|
75
|
+
var PROXY_VARS = ["HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy"];
|
|
76
|
+
var proxyFromEnv = () => {
|
|
77
|
+
for (const name of PROXY_VARS) {
|
|
78
|
+
const value = process.env[name]?.trim();
|
|
79
|
+
if (value) return value;
|
|
80
|
+
}
|
|
81
|
+
return void 0;
|
|
82
|
+
};
|
|
83
|
+
var installed2 = false;
|
|
84
|
+
var installNetworkDefaults = () => {
|
|
85
|
+
if (installed2) return;
|
|
86
|
+
installed2 = true;
|
|
87
|
+
installClientContextHeaders();
|
|
88
|
+
if (!proxyFromEnv()) return;
|
|
89
|
+
try {
|
|
90
|
+
const { EnvHttpProxyAgent, setGlobalDispatcher } = requireCjs("undici");
|
|
91
|
+
setGlobalDispatcher(new EnvHttpProxyAgent());
|
|
92
|
+
} catch {
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
var isNetworkFailure = (err) => {
|
|
96
|
+
if (!(err instanceof Error)) return false;
|
|
97
|
+
const code = err.code;
|
|
98
|
+
if (code && ["ENOTFOUND", "ECONNREFUSED", "ECONNRESET", "ETIMEDOUT", "EAI_AGAIN", "EPROTO", "CERT_HAS_EXPIRED", "UNABLE_TO_VERIFY_LEAF_SIGNATURE"].includes(code)) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
return err.name === "AbortError" || err.name === "TimeoutError" || /fetch failed/i.test(err.message);
|
|
102
|
+
};
|
|
103
|
+
var DEFAULT_TIMEOUT_MS = 15e3;
|
|
104
|
+
var pusharyFetch = async (url, init = {}) => {
|
|
105
|
+
installNetworkDefaults();
|
|
106
|
+
const { timeoutMs = DEFAULT_TIMEOUT_MS, signal, ...rest } = init;
|
|
107
|
+
try {
|
|
108
|
+
return await fetch(url, {
|
|
109
|
+
...rest,
|
|
110
|
+
signal: signal ?? AbortSignal.timeout(timeoutMs)
|
|
111
|
+
});
|
|
112
|
+
} catch (err) {
|
|
113
|
+
if (isNetworkFailure(err)) {
|
|
114
|
+
const proxy = proxyFromEnv();
|
|
115
|
+
const via = proxy ? ` (via proxy ${proxy})` : "";
|
|
116
|
+
throw new NetworkError(`Could not reach ${new URL(url).host}${via}: ${err instanceof Error ? err.message : String(err)}`);
|
|
117
|
+
}
|
|
118
|
+
throw err;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export {
|
|
123
|
+
installNetworkDefaults,
|
|
124
|
+
isNetworkFailure,
|
|
125
|
+
pusharyFetch
|
|
126
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pusharyDir
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-K32C2RGK.js";
|
|
4
4
|
import {
|
|
5
5
|
writeFileAtomic
|
|
6
6
|
} from "./chunk-T7E75EKA.js";
|
|
@@ -18,6 +18,7 @@ var readMachineId = (filePath) => {
|
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
+
var readExistingMachineId = (options = {}) => readMachineId(options.filePath ?? join(pusharyDir(), "machine-id"));
|
|
21
22
|
var getOrCreateMachineId = (options = {}) => {
|
|
22
23
|
const filePath = options.filePath ?? join(pusharyDir(), "machine-id");
|
|
23
24
|
const existing = readMachineId(filePath);
|
|
@@ -41,5 +42,6 @@ var getOrCreateMachineId = (options = {}) => {
|
|
|
41
42
|
var getMachineId = (options = {}) => getOrCreateMachineId(options);
|
|
42
43
|
|
|
43
44
|
export {
|
|
45
|
+
readExistingMachineId,
|
|
44
46
|
getMachineId
|
|
45
47
|
};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clientErrorKindOf,
|
|
3
|
+
reportClientError
|
|
4
|
+
} from "./chunk-VOCZHOXV.js";
|
|
1
5
|
import {
|
|
2
6
|
callMcpTool
|
|
3
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BJENQBMH.js";
|
|
4
8
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
installNetworkDefaults
|
|
10
|
+
} from "./chunk-DESAUCH2.js";
|
|
7
11
|
import {
|
|
8
12
|
getBaseUrl
|
|
9
13
|
} from "./chunk-OSJEMXSR.js";
|
|
@@ -44,7 +48,7 @@ var isBlockedActionClaim = (data) => {
|
|
|
44
48
|
};
|
|
45
49
|
|
|
46
50
|
// src/api.ts
|
|
47
|
-
|
|
51
|
+
installNetworkDefaults();
|
|
48
52
|
var DECISION_STOP_REASON = "Approval was cancelled or became unavailable. Retry only after resolving it.";
|
|
49
53
|
var isDecisionStopped = (result) => result.handoffAction === "stop" || ["cancelled", "unavailable", "stopped", "missing"].includes(result.status ?? "");
|
|
50
54
|
var isLocalQuestionHandoff = (result) => result.suppressed === true || result.noDevices === true || result.status === "terminal" || result.status === "notified";
|
|
@@ -130,7 +134,8 @@ var requestGate = async (apiKey, request, timeoutMs = 15e3) => {
|
|
|
130
134
|
try {
|
|
131
135
|
const reply = await postAgentRequest(apiKey, GATE_PATH, request, timeoutMs);
|
|
132
136
|
return isGateReply(reply) ? reply : null;
|
|
133
|
-
} catch {
|
|
137
|
+
} catch (error) {
|
|
138
|
+
void reportClientError({ kind: clientErrorKindOf(error), code: "gate_request_failed" });
|
|
134
139
|
return null;
|
|
135
140
|
}
|
|
136
141
|
};
|
|
@@ -138,7 +143,8 @@ var claimBlockedAction = async (apiKey, request, timeoutMs) => {
|
|
|
138
143
|
try {
|
|
139
144
|
const reply = await postAgentRequest(apiKey, BLOCKED_ACTION_CLAIM_PATH, request, timeoutMs);
|
|
140
145
|
return isBlockedActionClaim(reply) ? reply.granted : null;
|
|
141
|
-
} catch {
|
|
146
|
+
} catch (error) {
|
|
147
|
+
void reportClientError({ kind: clientErrorKindOf(error), code: "blocked_action_claim_failed" });
|
|
142
148
|
return null;
|
|
143
149
|
}
|
|
144
150
|
};
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
resolveBinary,
|
|
3
3
|
resolveGlobalPackageVersion,
|
|
4
4
|
resolvePackageVersionFromBinary
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-K32C2RGK.js";
|
|
6
6
|
import {
|
|
7
7
|
MANAGED_PROVIDERS
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CAS7GFWI.js";
|
|
9
9
|
|
|
10
10
|
// src/live-capabilities.ts
|
|
11
11
|
var CLAUDE_BRIDGE_CAPABILITY = "claude-bridge";
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NOTIFICATION_PUSH_TYPES,
|
|
3
3
|
POSTTOOLUSE_MIRROR_ONLY_TOOLS
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YUGGNZSF.js";
|
|
5
5
|
import {
|
|
6
6
|
cancelQuestion,
|
|
7
7
|
isPolicyConfig,
|
|
8
8
|
sendNotification,
|
|
9
9
|
waitForAnswer
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-EREBZHN2.js";
|
|
11
11
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
clientErrorKindOf,
|
|
13
|
+
reportClientError
|
|
14
|
+
} from "./chunk-VOCZHOXV.js";
|
|
14
15
|
import {
|
|
15
16
|
withRetry
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-BJENQBMH.js";
|
|
18
|
+
import {
|
|
19
|
+
getMachineId
|
|
20
|
+
} from "./chunk-DZTKLE7Q.js";
|
|
17
21
|
import {
|
|
18
22
|
reportedInstallSource
|
|
19
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-VHNDE3ZD.js";
|
|
20
24
|
import {
|
|
21
25
|
getApiKey,
|
|
22
26
|
getBaseUrl
|
|
@@ -44,7 +48,7 @@ import {
|
|
|
44
48
|
resolveAutoResolveOrigin,
|
|
45
49
|
resolvePolicy,
|
|
46
50
|
toToolLookup
|
|
47
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-CAS7GFWI.js";
|
|
48
52
|
|
|
49
53
|
// src/policy.ts
|
|
50
54
|
import { createHash } from "crypto";
|
|
@@ -176,12 +180,14 @@ var fetchModeState = async (apiKey, sessionId, reuseWithinMs = 0, signal) => {
|
|
|
176
180
|
signal: AbortSignal.any([AbortSignal.timeout(3e3), ...signal ? [signal] : []])
|
|
177
181
|
});
|
|
178
182
|
if (!response.ok) {
|
|
183
|
+
void reportClientError({ kind: "http_status", code: `mode_http_${response.status}` });
|
|
179
184
|
return degradedFallback(apiKey, response.status === 401 || response.status === 403);
|
|
180
185
|
}
|
|
181
186
|
const state = modeStateFromResponse(await response.json());
|
|
182
187
|
writeLastGoodMode(apiKey, state, sessionId);
|
|
183
188
|
return state;
|
|
184
|
-
} catch {
|
|
189
|
+
} catch (error) {
|
|
190
|
+
void reportClientError({ kind: clientErrorKindOf(error), code: "mode_fetch_failed" });
|
|
185
191
|
return degradedFallback(apiKey);
|
|
186
192
|
}
|
|
187
193
|
};
|
|
@@ -2,21 +2,21 @@ import {
|
|
|
2
2
|
detectProviderLiveCapabilities,
|
|
3
3
|
hasSpawnProvider,
|
|
4
4
|
resolveControlPolicy
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GBL4BTG3.js";
|
|
6
6
|
import {
|
|
7
7
|
daemonHasRemoteProof,
|
|
8
8
|
daemonServiceManagerAvailable,
|
|
9
9
|
hasDaemonServiceDefinition,
|
|
10
10
|
readDaemonNeedsLogin,
|
|
11
11
|
readDaemonStatus
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import {
|
|
14
|
-
getMachineId
|
|
15
|
-
} from "./chunk-LM2IOEDK.js";
|
|
12
|
+
} from "./chunk-OZE2TQX5.js";
|
|
16
13
|
import {
|
|
17
14
|
readControlMode,
|
|
18
15
|
readKeySource
|
|
19
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-R4HVHTNA.js";
|
|
17
|
+
import {
|
|
18
|
+
getMachineId
|
|
19
|
+
} from "./chunk-DZTKLE7Q.js";
|
|
20
20
|
import {
|
|
21
21
|
getBaseUrl
|
|
22
22
|
} from "./chunk-OSJEMXSR.js";
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
HOOK_BUDGETS,
|
|
3
3
|
HOOK_LOCATOR_BINARY,
|
|
4
4
|
withHookHoldBudget
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-CAS7GFWI.js";
|
|
6
6
|
import {
|
|
7
7
|
isReleaseVersion
|
|
8
8
|
} from "./chunk-HWJW3CPO.js";
|
|
@@ -625,6 +625,7 @@ var bridgeAgentKey = () => join3(pusharyDir(), "bridge-auth", "agent-key.json");
|
|
|
625
625
|
var autoUpdateState = () => join3(pusharyDir(), "auto-update.json");
|
|
626
626
|
var autoUpdateLock = () => join3(pusharyDir(), "auto-update.lock");
|
|
627
627
|
var autoUpdateLog = () => join3(pusharyDir(), "logs", "auto-update.log");
|
|
628
|
+
var clientReportClaims = () => join3(pusharyDir(), "client-reports");
|
|
628
629
|
var claudeRegistrationReceipt = () => join3(pusharyDir(), "setup", "claude-registration.json");
|
|
629
630
|
var hermesConfigReceipt = () => join3(pusharyDir(), "setup", "hermes-config.json");
|
|
630
631
|
var hookTakeoverReceipt = (agent) => join3(pusharyDir(), "setup", `hook-takeover-${agent}.json`);
|
|
@@ -698,6 +699,7 @@ export {
|
|
|
698
699
|
autoUpdateState,
|
|
699
700
|
autoUpdateLock,
|
|
700
701
|
autoUpdateLog,
|
|
702
|
+
clientReportClaims,
|
|
701
703
|
claudeRegistrationReceipt,
|
|
702
704
|
hermesConfigReceipt,
|
|
703
705
|
hookTakeoverReceipt,
|
|
@@ -3,28 +3,28 @@ import {
|
|
|
3
3
|
addPusharyToolPermissions,
|
|
4
4
|
isPusharyHook,
|
|
5
5
|
removeClaudeMcpServers
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZA5UXRNE.js";
|
|
7
7
|
import {
|
|
8
8
|
CLAUDE_HOOK_EVENTS,
|
|
9
9
|
addGeminiMcpServer,
|
|
10
10
|
removeGeminiMcpServer
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7CLTSZOL.js";
|
|
12
12
|
import {
|
|
13
13
|
CLAUDE_CODE_AGENT,
|
|
14
14
|
parseApplyPatchFiles
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-H6XU22TN.js";
|
|
16
16
|
import {
|
|
17
17
|
guardBinary,
|
|
18
18
|
holdBudgetOf,
|
|
19
19
|
registerHookEntry
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-K32C2RGK.js";
|
|
21
21
|
import {
|
|
22
22
|
PHONE_ANSWERED_TOOLS,
|
|
23
23
|
hookCompatibleProfile,
|
|
24
24
|
hookCompatibleProfileBySource,
|
|
25
25
|
toToolLookup,
|
|
26
26
|
withHookHoldBudget
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-CAS7GFWI.js";
|
|
28
28
|
|
|
29
29
|
// src/compatible-config.ts
|
|
30
30
|
import { homedir } from "os";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
openCodeConfigDirFrom
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3VZX4NSP.js";
|
|
4
4
|
import {
|
|
5
5
|
codexHomeFrom
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-K32C2RGK.js";
|
|
7
7
|
import {
|
|
8
8
|
HOOK_COMPATIBLE_PROFILES
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CAS7GFWI.js";
|
|
10
10
|
|
|
11
11
|
// src/vscode-config.ts
|
|
12
12
|
import { homedir } from "os";
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
permissionDeniedAction,
|
|
8
8
|
releaseThrottle,
|
|
9
9
|
reportEvent
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-H6XU22TN.js";
|
|
11
11
|
import {
|
|
12
12
|
canonicalJson
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-K32C2RGK.js";
|
|
14
14
|
import {
|
|
15
15
|
writeFileAtomic
|
|
16
16
|
} from "./chunk-T7E75EKA.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
machineDecisionFor,
|
|
21
21
|
shouldDeferToNativeMode,
|
|
22
22
|
wireVerdictFor
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-CAS7GFWI.js";
|
|
24
24
|
|
|
25
25
|
// src/machine-decision-audit.ts
|
|
26
26
|
import { basename } from "path";
|
|
@@ -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-
|
|
10
|
+
} from "./chunk-DZTKLE7Q.js";
|
|
8
11
|
import {
|
|
9
12
|
pusharyDir,
|
|
10
13
|
resolveGlobalBinary
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import {
|
|
13
|
-
readControlMode
|
|
14
|
-
} from "./chunk-CWIARY6F.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-
|
|
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";
|
|
@@ -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,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
registerTranscript
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-D3K2FPPJ.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
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
|
-
|
|
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-
|
|
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-
|
|
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;
|