@pushary/agent-hooks 1.4.2 → 1.5.0
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 +11 -0
- package/README.md +27 -0
- package/data/vscode-plugin/README.md +1 -1
- package/data/vscode-plugin/scripts/pushary-gate.mjs +2 -2
- package/dist/bin/pushary-bell-hook.js +22 -21
- package/dist/bin/pushary-bell.js +10 -10
- package/dist/bin/pushary-claude.js +28 -24
- package/dist/bin/pushary-clean.js +25 -25
- package/dist/bin/pushary-codex-bridge.js +16 -14
- package/dist/bin/pushary-codex-hook.js +32 -27
- package/dist/bin/pushary-codex.js +15 -10
- package/dist/bin/pushary-connect.js +11 -11
- package/dist/bin/pushary-cowork.js +6 -6
- package/dist/bin/pushary-daemon.js +31 -28
- package/dist/bin/pushary-disconnect.js +16 -16
- package/dist/bin/pushary-doctor.js +81 -38
- package/dist/bin/pushary-elicitation-hook.js +23 -22
- package/dist/bin/pushary-gemini-bridge.js +13 -11
- package/dist/bin/pushary-gemini-hook.js +29 -24
- package/dist/bin/pushary-hook.js +30 -30
- package/dist/bin/pushary-login.js +14 -14
- package/dist/bin/pushary-logout.js +8 -8
- package/dist/bin/pushary-mode.js +7 -7
- package/dist/bin/pushary-notification-hook.js +26 -25
- package/dist/bin/pushary-opencode-hook.js +25 -24
- package/dist/bin/pushary-permission-denied-hook.js +30 -29
- package/dist/bin/pushary-permission-hook.js +29 -28
- package/dist/bin/pushary-post-hook.js +26 -25
- package/dist/bin/pushary-prompt-hook.js +26 -25
- package/dist/bin/pushary-session-end-hook.js +26 -25
- package/dist/bin/pushary-session-start-hook.js +32 -27
- package/dist/bin/pushary-setup.js +58 -53
- package/dist/bin/pushary-stats.js +6 -6
- package/dist/bin/pushary-status.js +15 -15
- package/dist/bin/pushary-stop-hook.js +26 -25
- package/dist/bin/pushary-stopfailure-hook.js +26 -25
- package/dist/bin/pushary-suggestions.js +4 -4
- package/dist/bin/pushary-transcript-register.js +20 -19
- package/dist/bin/pushary-transcripts.js +8 -8
- package/dist/bin/pushary-upgrade.js +231 -37
- package/dist/bin/pushary-wait.js +7 -7
- package/dist/bin/pushary.js +8 -8
- package/dist/{chunk-4BROEAKH.js → chunk-2QT3GCU4.js} +1 -1
- package/dist/{chunk-PC6DU5C4.js → chunk-3NBODGQS.js} +1 -1
- package/dist/{chunk-55KW4FLG.js → chunk-3ZSGKLSO.js} +2 -2
- package/dist/{chunk-NY6XQ6CA.js → chunk-43LJSM4F.js} +2 -2
- package/dist/{chunk-LEAAERSQ.js → chunk-43ZDACBO.js} +1 -1
- package/dist/{chunk-M5CTUFF3.js → chunk-5HYNICS7.js} +1 -1
- package/dist/{chunk-EQRS3SGM.js → chunk-66H2QQAK.js} +1 -1
- package/dist/{chunk-BZ4GDOJX.js → chunk-7XT76LWT.js} +7 -7
- package/dist/{chunk-SUWRZYQG.js → chunk-CQYHOHOK.js} +3 -3
- package/dist/{chunk-MUVTZNJW.js → chunk-DLJN5XEU.js} +3 -3
- package/dist/{chunk-25RTLTQD.js → chunk-DTQNDR7C.js} +1 -1
- package/dist/{chunk-TRLFZKVG.js → chunk-DYHXOXUF.js} +43 -6
- package/dist/{chunk-FAH3D74E.js → chunk-EA3IELHP.js} +6 -0
- package/dist/{chunk-LPYCPFBZ.js → chunk-EADZPVYW.js} +3 -3
- package/dist/{chunk-VW66JEGU.js → chunk-F57RGL7K.js} +8 -8
- package/dist/{chunk-G653QPTR.js → chunk-FDHMNT24.js} +7 -7
- package/dist/{chunk-Y3MM6PYN.js → chunk-H5LHTC5X.js} +1 -1
- package/dist/{chunk-EYRGBYZG.js → chunk-HETOKNIL.js} +1 -1
- package/dist/{chunk-UM5J3J4V.js → chunk-HU5LSYL2.js} +2 -2
- package/dist/{chunk-2V2IKOGJ.js → chunk-HVBF35GT.js} +2 -2
- package/dist/{chunk-DINDL2CF.js → chunk-HWJW3CPO.js} +25 -5
- package/dist/{chunk-XDP3UYH5.js → chunk-IYTQ4B5I.js} +8 -8
- package/dist/{chunk-II7PUMPB.js → chunk-J4J45VPZ.js} +3 -3
- package/dist/{chunk-VIOL2DJS.js → chunk-JF736N4C.js} +5 -5
- package/dist/{chunk-ZVY25BMK.js → chunk-K3QVDAZW.js} +1 -1
- package/dist/{chunk-TYEO6T5J.js → chunk-KEOLNHR3.js} +2 -2
- package/dist/{chunk-T5SZ4PML.js → chunk-KJRALILH.js} +7 -4
- package/dist/{chunk-VOMOZ4D5.js → chunk-MYP4UUFH.js} +1 -1
- package/dist/{chunk-UJBZIKSY.js → chunk-NFKVRMTM.js} +8 -8
- package/dist/{chunk-WPVHRUDT.js → chunk-NTQSICPJ.js} +3 -3
- package/dist/{chunk-JVTOML54.js → chunk-ORLJNJEO.js} +2 -2
- package/dist/{chunk-2UMNXADU.js → chunk-OSJEMXSR.js} +5 -1
- package/dist/chunk-OSSDK5RS.js +162 -0
- package/dist/{chunk-TWWLVOPB.js → chunk-P4BNYJ5Q.js} +5 -5
- package/dist/{chunk-4ZDKSDVW.js → chunk-PCGZXWGQ.js} +4 -4
- package/dist/{chunk-ACYIZ3KH.js → chunk-PNNBMH4E.js} +5 -5
- package/dist/{chunk-LGXUGYUH.js → chunk-PYCQXCI5.js} +2 -2
- package/dist/{chunk-MW6ZPC6R.js → chunk-SOCEY746.js} +1 -1
- package/dist/{chunk-SOUZBGYJ.js → chunk-T4QY64OR.js} +15 -14
- package/dist/{chunk-DY4ILT6L.js → chunk-TFKBFQCE.js} +1 -1
- package/dist/{chunk-GZ7E6VOB.js → chunk-TIWURSLS.js} +1 -1
- package/dist/{chunk-F4UWL4NY.js → chunk-TUXFIVOH.js} +1 -1
- package/dist/{chunk-NHTAHAIS.js → chunk-UQHUUZ5H.js} +1 -1
- package/dist/{chunk-FU2DFEAZ.js → chunk-USQDVBEV.js} +2 -2
- package/dist/{chunk-YXP3WPAI.js → chunk-UYDTFCHW.js} +1 -1
- package/dist/{chunk-NOWZUGZW.js → chunk-XWEONSLV.js} +1 -1
- package/dist/{chunk-GKIUEIDX.js → chunk-YQMFGWBD.js} +1 -1
- package/dist/{reapply-J527BCJG.js → reapply-D2TFN6XK.js} +9 -8
- package/dist/src/index.js +18 -16
- package/package.json +1 -1
package/dist/bin/pushary-wait.js
CHANGED
|
@@ -4,19 +4,17 @@ import {
|
|
|
4
4
|
} from "../chunk-CVWG2N3Y.js";
|
|
5
5
|
import {
|
|
6
6
|
exitOnFailedResponse
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-XWEONSLV.js";
|
|
8
|
+
import "../chunk-43LJSM4F.js";
|
|
9
9
|
import {
|
|
10
10
|
createIo
|
|
11
11
|
} from "../chunk-5RUIFDTP.js";
|
|
12
12
|
import {
|
|
13
13
|
exitOnHelpFlag
|
|
14
|
-
} from "../chunk-
|
|
15
|
-
import "../chunk-FAH3D74E.js";
|
|
14
|
+
} from "../chunk-P4BNYJ5Q.js";
|
|
16
15
|
import {
|
|
17
16
|
rejectUnknownFlags
|
|
18
17
|
} from "../chunk-GMXKITVA.js";
|
|
19
|
-
import "../chunk-DINDL2CF.js";
|
|
20
18
|
import "../chunk-SAF6HGAA.js";
|
|
21
19
|
import {
|
|
22
20
|
UsageError
|
|
@@ -27,8 +25,10 @@ import {
|
|
|
27
25
|
import {
|
|
28
26
|
getApiKey,
|
|
29
27
|
getBaseUrl
|
|
30
|
-
} from "../chunk-
|
|
31
|
-
import "../chunk-
|
|
28
|
+
} from "../chunk-OSJEMXSR.js";
|
|
29
|
+
import "../chunk-T4QY64OR.js";
|
|
30
|
+
import "../chunk-EA3IELHP.js";
|
|
31
|
+
import "../chunk-HWJW3CPO.js";
|
|
32
32
|
|
|
33
33
|
// bin/pushary-wait.ts
|
|
34
34
|
exitOnHelpFlag("wait");
|
package/dist/bin/pushary.js
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
COMMANDS,
|
|
4
|
-
isCommandName,
|
|
5
|
-
renderHelp
|
|
6
|
-
} from "../chunk-FAH3D74E.js";
|
|
7
|
-
import {
|
|
8
|
-
getPackageVersion
|
|
9
|
-
} from "../chunk-DINDL2CF.js";
|
|
10
2
|
import {
|
|
11
3
|
installProxyDispatcher
|
|
12
4
|
} from "../chunk-SAF6HGAA.js";
|
|
@@ -14,6 +6,14 @@ import "../chunk-7QLSKOSU.js";
|
|
|
14
6
|
import {
|
|
15
7
|
EXIT
|
|
16
8
|
} from "../chunk-KZERVKTD.js";
|
|
9
|
+
import {
|
|
10
|
+
COMMANDS,
|
|
11
|
+
isCommandName,
|
|
12
|
+
renderHelp
|
|
13
|
+
} from "../chunk-EA3IELHP.js";
|
|
14
|
+
import {
|
|
15
|
+
getPackageVersion
|
|
16
|
+
} from "../chunk-HWJW3CPO.js";
|
|
17
17
|
|
|
18
18
|
// src/cli/runtime.ts
|
|
19
19
|
var supportsRuntime = (version) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SETUP_FLAGS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TFKBFQCE.js";
|
|
4
4
|
import {
|
|
5
5
|
parseFlags
|
|
6
6
|
} from "./chunk-GMXKITVA.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
CLAUDE_CONNECTOR_URL,
|
|
15
15
|
COWORK_CONNECTOR_LIMIT,
|
|
16
16
|
COWORK_STANDING_INSTRUCTIONS
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-T4QY64OR.js";
|
|
18
18
|
|
|
19
19
|
// src/cli/cowork.ts
|
|
20
20
|
import { readFileSync } from "fs";
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
} from "./chunk-KZERVKTD.js";
|
|
10
10
|
import {
|
|
11
11
|
getBaseUrl
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-OSJEMXSR.js";
|
|
13
13
|
import {
|
|
14
14
|
isValidApiKey,
|
|
15
15
|
normalizeKeyScope
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-T4QY64OR.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;
|
|
@@ -4,17 +4,14 @@ import {
|
|
|
4
4
|
} from "./chunk-XHKBHWLX.js";
|
|
5
5
|
import {
|
|
6
6
|
getMachineId
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-UQHUUZ5H.js";
|
|
8
8
|
import {
|
|
9
9
|
pusharyDir,
|
|
10
10
|
resolveGlobalBinary
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import {
|
|
13
|
-
getPackageVersion
|
|
14
|
-
} from "./chunk-DINDL2CF.js";
|
|
11
|
+
} from "./chunk-DYHXOXUF.js";
|
|
15
12
|
import {
|
|
16
13
|
readControlMode
|
|
17
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-USQDVBEV.js";
|
|
18
15
|
import {
|
|
19
16
|
readJsonSafe,
|
|
20
17
|
writeFileAtomic,
|
|
@@ -23,7 +20,10 @@ import {
|
|
|
23
20
|
} from "./chunk-T7E75EKA.js";
|
|
24
21
|
import {
|
|
25
22
|
getApiKey
|
|
26
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-OSJEMXSR.js";
|
|
24
|
+
import {
|
|
25
|
+
getPackageVersion
|
|
26
|
+
} from "./chunk-HWJW3CPO.js";
|
|
27
27
|
|
|
28
28
|
// src/daemon-lifecycle.ts
|
|
29
29
|
import { dirname, join, win32 as win32Path } from "path";
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
permissionDeniedAction,
|
|
8
8
|
releaseThrottle,
|
|
9
9
|
reportEvent
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-FDHMNT24.js";
|
|
11
11
|
import {
|
|
12
12
|
canonicalJson
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DYHXOXUF.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-T4QY64OR.js";
|
|
24
24
|
|
|
25
25
|
// src/machine-decision-audit.ts
|
|
26
26
|
import { basename } from "path";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
openCodeConfigDirFrom
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TUXFIVOH.js";
|
|
4
4
|
import {
|
|
5
5
|
codexHomeFrom
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DYHXOXUF.js";
|
|
7
7
|
import {
|
|
8
8
|
HOOK_COMPATIBLE_PROFILES
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-T4QY64OR.js";
|
|
10
10
|
|
|
11
11
|
// src/vscode-config.ts
|
|
12
12
|
import { homedir } from "os";
|
|
@@ -2,12 +2,19 @@ import {
|
|
|
2
2
|
HOOK_BUDGETS,
|
|
3
3
|
HOOK_LOCATOR_BINARY,
|
|
4
4
|
withHookHoldBudget
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-T4QY64OR.js";
|
|
6
|
+
import {
|
|
7
|
+
isReleaseVersion
|
|
8
|
+
} from "./chunk-HWJW3CPO.js";
|
|
6
9
|
|
|
7
10
|
// src/npm.ts
|
|
8
11
|
import { execFileSync, execSync } from "child_process";
|
|
9
12
|
import { existsSync, readFileSync, realpathSync } from "fs";
|
|
10
13
|
import { dirname, isAbsolute, join, relative, resolve } from "path";
|
|
14
|
+
var AGENT_HOOKS_PACKAGE = "@pushary/agent-hooks";
|
|
15
|
+
var LATEST_RELEASE_URL = `https://registry.npmjs.org/${AGENT_HOOKS_PACKAGE}/latest`;
|
|
16
|
+
var REGISTRY_TIMEOUT_MS = 5e3;
|
|
17
|
+
var LATEST_TAG = "latest";
|
|
11
18
|
var cleanNpmEnv = () => {
|
|
12
19
|
const env = {};
|
|
13
20
|
for (const [key, value] of Object.entries(process.env)) {
|
|
@@ -16,10 +23,11 @@ var cleanNpmEnv = () => {
|
|
|
16
23
|
}
|
|
17
24
|
return env;
|
|
18
25
|
};
|
|
26
|
+
var NPM_ERROR_METADATA = /^(code|syscall|path|dest|errno)\s/i;
|
|
19
27
|
var npmErrorMessage = (err) => {
|
|
20
28
|
const e = err;
|
|
21
29
|
const text = [e?.stderr, e?.stdout].map((part) => part ? part.toString() : "").join("\n");
|
|
22
|
-
const line = text.split("\n").map((l) => l.replace(/^npm error\s*/i, "").trim()).find((l) => l && !l.startsWith("A complete log") &&
|
|
30
|
+
const line = text.split("\n").map((l) => l.replace(/^npm error\s*/i, "").trim()).find((l) => l && !l.startsWith("A complete log") && !NPM_ERROR_METADATA.test(l));
|
|
23
31
|
return line || e?.message || String(err);
|
|
24
32
|
};
|
|
25
33
|
var execNpm = (args, options = {}) => {
|
|
@@ -143,6 +151,26 @@ var resolveGlobalBinDir = (probe) => {
|
|
|
143
151
|
return resolved ? resolved.slice(0, resolved.length - probe.length - 1) : void 0;
|
|
144
152
|
};
|
|
145
153
|
var quoteIfNeeded = (path) => /\s/.test(path) ? `"${path}"` : path;
|
|
154
|
+
var fetchLatestPublishedVersion = async (request = {}) => {
|
|
155
|
+
try {
|
|
156
|
+
const response = await (request.fetchImpl ?? fetch)(LATEST_RELEASE_URL, {
|
|
157
|
+
signal: AbortSignal.timeout(request.timeoutMs ?? REGISTRY_TIMEOUT_MS)
|
|
158
|
+
});
|
|
159
|
+
if (!response.ok) return void 0;
|
|
160
|
+
const body = await response.json();
|
|
161
|
+
const version = body && typeof body === "object" && "version" in body ? body.version : void 0;
|
|
162
|
+
return typeof version === "string" && isReleaseVersion(version) ? version : void 0;
|
|
163
|
+
} catch {
|
|
164
|
+
return void 0;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
var POSIX_SHELL_WORD = /^[\w@%+=:,./-]+$/;
|
|
168
|
+
var quoteForPosixShell = (value) => POSIX_SHELL_WORD.test(value) ? value : `'${value.replaceAll("'", `'\\''`)}'`;
|
|
169
|
+
var installAgentHooksGlobally = (request, runNpm = execNpm) => {
|
|
170
|
+
const prefixFlag = request.prefix === void 0 ? "" : ` --prefix ${quoteForPosixShell(request.prefix)}`;
|
|
171
|
+
const spec = quoteForPosixShell(`${AGENT_HOOKS_PACKAGE}@${request.version}`);
|
|
172
|
+
runNpm(`install -g --no-workspaces${prefixFlag} ${spec}`, { timeout: request.timeoutMs });
|
|
173
|
+
};
|
|
146
174
|
var needsGlobalInstall = (requested, installed, binaryPresent) => requested !== installed || !binaryPresent;
|
|
147
175
|
var installState;
|
|
148
176
|
var installGlobally = (options) => {
|
|
@@ -153,13 +181,13 @@ var installGlobally = (options) => {
|
|
|
153
181
|
const pinned = process.env.PUSHARY_PIN_GLOBAL_VERSION !== "0";
|
|
154
182
|
if (pinned && !needsGlobalInstall(
|
|
155
183
|
options.version,
|
|
156
|
-
resolveGlobalPackageVersion(
|
|
157
|
-
globalPackageBinsPresent(
|
|
184
|
+
resolveGlobalPackageVersion(AGENT_HOOKS_PACKAGE),
|
|
185
|
+
globalPackageBinsPresent(AGENT_HOOKS_PACKAGE)
|
|
158
186
|
)) {
|
|
159
187
|
return "skipped";
|
|
160
188
|
}
|
|
161
|
-
const
|
|
162
|
-
|
|
189
|
+
const version = pinned && options.version && options.version !== "0.0.0" ? options.version : LATEST_TAG;
|
|
190
|
+
installAgentHooksGlobally({ version, timeoutMs: options.timeoutMs ?? 12e4 });
|
|
163
191
|
return "installed";
|
|
164
192
|
})();
|
|
165
193
|
installState = started;
|
|
@@ -609,6 +637,9 @@ var claudeSettingsLocal = () => join3(homedir2(), ".claude", "settings.local.jso
|
|
|
609
637
|
var pusharyDir = () => join3(homedir2(), ".pushary");
|
|
610
638
|
var claudeMcpReceipt = () => join3(pusharyDir(), "setup", "claude-mcp.json");
|
|
611
639
|
var bridgeAgentKey = () => join3(pusharyDir(), "bridge-auth", "agent-key.json");
|
|
640
|
+
var autoUpdateState = () => join3(pusharyDir(), "auto-update.json");
|
|
641
|
+
var autoUpdateLock = () => join3(pusharyDir(), "auto-update.lock");
|
|
642
|
+
var autoUpdateLog = () => join3(pusharyDir(), "logs", "auto-update.log");
|
|
612
643
|
var claudeRegistrationReceipt = () => join3(pusharyDir(), "setup", "claude-registration.json");
|
|
613
644
|
var hermesConfigReceipt = () => join3(pusharyDir(), "setup", "hermes-config.json");
|
|
614
645
|
var hookTakeoverReceipt = (agent) => join3(pusharyDir(), "setup", `hook-takeover-${agent}.json`);
|
|
@@ -622,6 +653,7 @@ export {
|
|
|
622
653
|
registeredCommands,
|
|
623
654
|
namesOurBinary,
|
|
624
655
|
registrationHolderOf,
|
|
656
|
+
LATEST_TAG,
|
|
625
657
|
npmErrorMessage,
|
|
626
658
|
execNpm,
|
|
627
659
|
resolveGlobalBinary,
|
|
@@ -630,6 +662,8 @@ export {
|
|
|
630
662
|
resolvePackageVersionFromBinary,
|
|
631
663
|
resolveGlobalPackageVersion,
|
|
632
664
|
resolveGlobalBinDir,
|
|
665
|
+
fetchLatestPublishedVersion,
|
|
666
|
+
installAgentHooksGlobally,
|
|
633
667
|
installGlobally,
|
|
634
668
|
holdBudgetOf,
|
|
635
669
|
guardBinary,
|
|
@@ -675,6 +709,9 @@ export {
|
|
|
675
709
|
pusharyDir,
|
|
676
710
|
claudeMcpReceipt,
|
|
677
711
|
bridgeAgentKey,
|
|
712
|
+
autoUpdateState,
|
|
713
|
+
autoUpdateLock,
|
|
714
|
+
autoUpdateLog,
|
|
678
715
|
claudeRegistrationReceipt,
|
|
679
716
|
hermesConfigReceipt,
|
|
680
717
|
hookTakeoverReceipt,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/cli/commands.ts
|
|
2
|
+
var NPX_LATEST_COMMAND = "npx @pushary/agent-hooks@latest";
|
|
2
3
|
var COMMAND_LIST = [
|
|
3
4
|
{
|
|
4
5
|
name: "cowork",
|
|
@@ -132,6 +133,10 @@ var COMMAND_OPTIONS = {
|
|
|
132
133
|
["--bundle", "Write a redacted diagnostics file you can attach to a support thread"]
|
|
133
134
|
],
|
|
134
135
|
suggestions: [["accept <id>", "Turn a mined suggestion into an always-allow rule"]],
|
|
136
|
+
upgrade: [
|
|
137
|
+
["--auto=off", "Stop Pushary updating itself in the background"],
|
|
138
|
+
["--auto=on", "Update in the background again: once a day at session start, within the same major version"]
|
|
139
|
+
],
|
|
135
140
|
bell: [
|
|
136
141
|
["(no flags)", "Turn the bell on for Claude Code"],
|
|
137
142
|
["--test", "Ring once, now, so you can hear what it does"],
|
|
@@ -232,6 +237,7 @@ var renderCommandHelp = (name, version) => {
|
|
|
232
237
|
};
|
|
233
238
|
|
|
234
239
|
export {
|
|
240
|
+
NPX_LATEST_COMMAND,
|
|
235
241
|
COMMANDS,
|
|
236
242
|
isCommandName,
|
|
237
243
|
renderHelp,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NOTIFICATION_MATCHED_TYPES,
|
|
3
3
|
POSTTOOLUSE_MIRRORED_TOOLS
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UYDTFCHW.js";
|
|
5
5
|
import {
|
|
6
6
|
isProtectedByScope,
|
|
7
7
|
registerHookEntry
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-DYHXOXUF.js";
|
|
9
9
|
import {
|
|
10
10
|
CLAUDE_PRETOOLUSE_MATCHER,
|
|
11
11
|
HOOK_BUDGETS,
|
|
12
12
|
HOOK_LOCATOR_BINARY
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-T4QY64OR.js";
|
|
14
14
|
|
|
15
15
|
// src/gemini-config.ts
|
|
16
16
|
var GEMINI_HOOK_BINARY = "pushary-gemini-hook";
|
|
@@ -2,27 +2,27 @@ import {
|
|
|
2
2
|
detectProviderLiveCapabilities,
|
|
3
3
|
hasSpawnProvider,
|
|
4
4
|
resolveControlPolicy
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KEOLNHR3.js";
|
|
6
6
|
import {
|
|
7
7
|
daemonHasRemoteProof,
|
|
8
8
|
daemonServiceManagerAvailable,
|
|
9
9
|
hasDaemonServiceDefinition,
|
|
10
10
|
readDaemonNeedsLogin,
|
|
11
11
|
readDaemonStatus
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7XT76LWT.js";
|
|
13
13
|
import {
|
|
14
14
|
getMachineId
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import {
|
|
17
|
-
getPackageVersion
|
|
18
|
-
} from "./chunk-DINDL2CF.js";
|
|
15
|
+
} from "./chunk-UQHUUZ5H.js";
|
|
19
16
|
import {
|
|
20
17
|
readControlMode,
|
|
21
18
|
readKeySource
|
|
22
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-USQDVBEV.js";
|
|
23
20
|
import {
|
|
24
21
|
getBaseUrl
|
|
25
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-OSJEMXSR.js";
|
|
23
|
+
import {
|
|
24
|
+
getPackageVersion
|
|
25
|
+
} from "./chunk-HWJW3CPO.js";
|
|
26
26
|
|
|
27
27
|
// src/machines.ts
|
|
28
28
|
import { hostname } from "os";
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NOTIFICATION_PUSH_TYPES,
|
|
3
3
|
POSTTOOLUSE_MIRROR_ONLY_TOOLS
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UYDTFCHW.js";
|
|
5
5
|
import {
|
|
6
6
|
cancelQuestion,
|
|
7
7
|
isPolicyConfig,
|
|
8
8
|
sendNotification,
|
|
9
9
|
waitForAnswer
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-PYCQXCI5.js";
|
|
11
11
|
import {
|
|
12
12
|
getMachineId
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-UQHUUZ5H.js";
|
|
14
14
|
import {
|
|
15
15
|
withRetry
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-HETOKNIL.js";
|
|
17
17
|
import {
|
|
18
18
|
reportedInstallSource
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-HU5LSYL2.js";
|
|
20
20
|
import {
|
|
21
21
|
getApiKey,
|
|
22
22
|
getBaseUrl
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-OSJEMXSR.js";
|
|
24
24
|
import {
|
|
25
25
|
ACTION_BODY_MAX,
|
|
26
26
|
AGENT_LABELS_BY_TYPE,
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
resolveAutoResolveOrigin,
|
|
45
45
|
resolvePolicy,
|
|
46
46
|
toToolLookup
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-T4QY64OR.js";
|
|
48
48
|
|
|
49
49
|
// src/policy.ts
|
|
50
50
|
import { createHash } from "crypto";
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
decodePublicKey,
|
|
4
4
|
generateSessionKey,
|
|
5
5
|
wrapSessionKey
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TIWURSLS.js";
|
|
7
7
|
import {
|
|
8
8
|
fetchTranscriptRecipients,
|
|
9
9
|
uploadTranscriptRecords
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-66H2QQAK.js";
|
|
11
11
|
|
|
12
12
|
// src/live-session.ts
|
|
13
13
|
var MAX_TRANSCRIPT_QUEUE = 100;
|
|
@@ -3,6 +3,7 @@ import { readFileSync } from "fs";
|
|
|
3
3
|
import { dirname, join, parse } from "path";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
var PACKAGE_NAME = "@pushary/agent-hooks";
|
|
6
|
+
var UNKNOWN_VERSION = "0.0.0";
|
|
6
7
|
var findOwnPackageJson = (start) => {
|
|
7
8
|
const { root } = parse(start);
|
|
8
9
|
let dir = start;
|
|
@@ -20,13 +21,24 @@ var findOwnPackageJson = (start) => {
|
|
|
20
21
|
}
|
|
21
22
|
};
|
|
22
23
|
var getPackageVersion = () => {
|
|
24
|
+
const root = ownPackageRoot();
|
|
25
|
+
return (root === void 0 ? void 0 : packageVersionAt(root)) ?? UNKNOWN_VERSION;
|
|
26
|
+
};
|
|
27
|
+
var ownPackageRoot = () => {
|
|
23
28
|
try {
|
|
24
29
|
const found = findOwnPackageJson(dirname(fileURLToPath(import.meta.url)));
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return
|
|
30
|
+
return found ? dirname(found) : void 0;
|
|
31
|
+
} catch {
|
|
32
|
+
return void 0;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var packageVersionAt = (packageRoot) => {
|
|
36
|
+
try {
|
|
37
|
+
const manifest = JSON.parse(readFileSync(join(packageRoot, "package.json"), "utf-8"));
|
|
38
|
+
const version = manifest && typeof manifest === "object" && "version" in manifest ? manifest.version : void 0;
|
|
39
|
+
return typeof version === "string" ? version : void 0;
|
|
28
40
|
} catch {
|
|
29
|
-
return
|
|
41
|
+
return void 0;
|
|
30
42
|
}
|
|
31
43
|
};
|
|
32
44
|
var isNewerVersion = (candidate, current) => {
|
|
@@ -38,8 +50,16 @@ var isNewerVersion = (candidate, current) => {
|
|
|
38
50
|
}
|
|
39
51
|
return false;
|
|
40
52
|
};
|
|
53
|
+
var RELEASE_VERSION = /^\d+\.\d+\.\d+$/;
|
|
54
|
+
var isReleaseVersion = (value) => RELEASE_VERSION.test(value);
|
|
55
|
+
var majorOf = (version) => parseInt(version.split(".")[0] ?? "", 10) || 0;
|
|
56
|
+
var isSameMajorVersion = (candidate, current) => majorOf(candidate) === majorOf(current);
|
|
41
57
|
|
|
42
58
|
export {
|
|
43
59
|
getPackageVersion,
|
|
44
|
-
|
|
60
|
+
ownPackageRoot,
|
|
61
|
+
packageVersionAt,
|
|
62
|
+
isNewerVersion,
|
|
63
|
+
isReleaseVersion,
|
|
64
|
+
isSameMajorVersion
|
|
45
65
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
activeHookSource,
|
|
3
3
|
activeIdentity
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JF736N4C.js";
|
|
5
5
|
import {
|
|
6
6
|
blockedActionFingerprint,
|
|
7
7
|
defersToNativeMode,
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
hasBlockedActionHint,
|
|
10
10
|
recordBlockedActionHint,
|
|
11
11
|
reportMachineDenial
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-CQYHOHOK.js";
|
|
13
13
|
import {
|
|
14
14
|
isGatingMoment,
|
|
15
15
|
recordKeylessMoment
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-43ZDACBO.js";
|
|
17
17
|
import {
|
|
18
18
|
denyReasonFrom,
|
|
19
19
|
isDeferAnswer
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
reportEvent,
|
|
37
37
|
scopePathFor,
|
|
38
38
|
settleQuestionsForToolUse
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-FDHMNT24.js";
|
|
40
40
|
import {
|
|
41
41
|
DECISION_STOP_REASON,
|
|
42
42
|
askUser,
|
|
@@ -48,14 +48,14 @@ import {
|
|
|
48
48
|
requestGate,
|
|
49
49
|
sendNotification,
|
|
50
50
|
waitForQuestion
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-PYCQXCI5.js";
|
|
52
52
|
import {
|
|
53
53
|
getMachineId
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-UQHUUZ5H.js";
|
|
55
55
|
import {
|
|
56
56
|
getApiKey,
|
|
57
57
|
getBaseUrl
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-OSJEMXSR.js";
|
|
59
59
|
import {
|
|
60
60
|
AGENT_QUESTION_STRATEGY,
|
|
61
61
|
GATE_BLOCK_REASON_MAX_LENGTH,
|
|
@@ -79,7 +79,7 @@ import {
|
|
|
79
79
|
parseAgentQuestions,
|
|
80
80
|
resolveGate,
|
|
81
81
|
stoppedOutput
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-T4QY64OR.js";
|
|
83
83
|
|
|
84
84
|
// src/decision-episode.ts
|
|
85
85
|
var EPISODE_PATH = "/api/agent/decision-episode";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CLAUDE_HOOK_EVENTS,
|
|
3
3
|
supportedClaudeEvents
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EADZPVYW.js";
|
|
5
5
|
import {
|
|
6
6
|
guardBinary,
|
|
7
7
|
holdBudgetOf,
|
|
8
8
|
isProtectedByScope,
|
|
9
9
|
registerHookEntry
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DYHXOXUF.js";
|
|
11
11
|
import {
|
|
12
12
|
HOOK_LOCATOR_BINARY,
|
|
13
13
|
withHookHoldBudget
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-T4QY64OR.js";
|
|
15
15
|
|
|
16
16
|
// src/claude-config.ts
|
|
17
17
|
import { join } from "path";
|