@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
|
@@ -3,28 +3,28 @@ import {
|
|
|
3
3
|
addPusharyToolPermissions,
|
|
4
4
|
isPusharyHook,
|
|
5
5
|
removeClaudeMcpServers
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-J4J45VPZ.js";
|
|
7
7
|
import {
|
|
8
8
|
CLAUDE_HOOK_EVENTS,
|
|
9
9
|
addGeminiMcpServer,
|
|
10
10
|
removeGeminiMcpServer
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-EADZPVYW.js";
|
|
12
12
|
import {
|
|
13
13
|
CLAUDE_CODE_AGENT,
|
|
14
14
|
parseApplyPatchFiles
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-FDHMNT24.js";
|
|
16
16
|
import {
|
|
17
17
|
guardBinary,
|
|
18
18
|
holdBudgetOf,
|
|
19
19
|
registerHookEntry
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-DYHXOXUF.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-T4QY64OR.js";
|
|
28
28
|
|
|
29
29
|
// src/compatible-config.ts
|
|
30
30
|
import { homedir } from "os";
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
resolveBinary,
|
|
3
3
|
resolveGlobalPackageVersion,
|
|
4
4
|
resolvePackageVersionFromBinary
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-DYHXOXUF.js";
|
|
6
6
|
import {
|
|
7
7
|
MANAGED_PROVIDERS
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-T4QY64OR.js";
|
|
9
9
|
|
|
10
10
|
// src/live-capabilities.ts
|
|
11
11
|
var CLAUDE_BRIDGE_CAPABILITY = "claude-bridge";
|
|
@@ -12,14 +12,17 @@ import {
|
|
|
12
12
|
} from "./chunk-5RUIFDTP.js";
|
|
13
13
|
import {
|
|
14
14
|
callMcpTool
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-HETOKNIL.js";
|
|
16
16
|
import {
|
|
17
17
|
reportedInstallSource
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-HU5LSYL2.js";
|
|
19
19
|
import {
|
|
20
20
|
PAIR_TTL_SECONDS,
|
|
21
21
|
isAnswerSource
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-T4QY64OR.js";
|
|
23
|
+
import {
|
|
24
|
+
NPX_LATEST_COMMAND
|
|
25
|
+
} from "./chunk-EA3IELHP.js";
|
|
23
26
|
|
|
24
27
|
// src/reach.ts
|
|
25
28
|
var reachVerdict = (channels) => {
|
|
@@ -752,7 +755,7 @@ var PAIR_STOP_BEFORE_EXPIRY_MS = 1e4;
|
|
|
752
755
|
var PAIR_TIMEOUT_MS = PAIR_TTL_SECONDS * 1e3 - PAIR_STOP_BEFORE_EXPIRY_MS;
|
|
753
756
|
var PAIR_HINT_AFTER_MS = 45e3;
|
|
754
757
|
var PAIR_BROWSER_FALLBACK_AFTER_MS = 6e4;
|
|
755
|
-
var BROWSER_CONNECT_COMMAND =
|
|
758
|
+
var BROWSER_CONNECT_COMMAND = `${NPX_LATEST_COMMAND} setup --connect browser`;
|
|
756
759
|
var PAIR_BROWSER_FALLBACK_LINE = `Still waiting? Sign in with a browser instead: Ctrl-C, then ${BROWSER_CONNECT_COMMAND}`;
|
|
757
760
|
var SYSTEM_PAIR_CLOCK = { now: () => Date.now(), sleep };
|
|
758
761
|
var startPairing = async (cliPublicKey) => {
|
|
@@ -6,38 +6,38 @@ import {
|
|
|
6
6
|
} from "./chunk-SGZJ5LYH.js";
|
|
7
7
|
import {
|
|
8
8
|
hookOwnerOf
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PCGZXWGQ.js";
|
|
10
10
|
import {
|
|
11
11
|
ensureDaemonRunning
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7XT76LWT.js";
|
|
13
13
|
import {
|
|
14
14
|
buildTranscriptRecords,
|
|
15
15
|
decodePublicKey,
|
|
16
16
|
generateSessionKey,
|
|
17
17
|
wrapSessionKey
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-TIWURSLS.js";
|
|
19
19
|
import {
|
|
20
20
|
fetchTranscriptRecipients,
|
|
21
21
|
uploadTranscriptRecords
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-66H2QQAK.js";
|
|
23
23
|
import {
|
|
24
24
|
transcriptEnvironmentPreference,
|
|
25
25
|
transcriptsEnabled
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-2QT3GCU4.js";
|
|
27
27
|
import {
|
|
28
28
|
codexHome,
|
|
29
29
|
pusharyDir
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-DYHXOXUF.js";
|
|
31
31
|
import {
|
|
32
32
|
readTranscriptPreference
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-USQDVBEV.js";
|
|
34
34
|
import {
|
|
35
35
|
writeJsonAtomic
|
|
36
36
|
} from "./chunk-T7E75EKA.js";
|
|
37
37
|
import {
|
|
38
38
|
getApiKey,
|
|
39
39
|
getBaseUrl
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-OSJEMXSR.js";
|
|
41
41
|
|
|
42
42
|
// src/transcript-registration.ts
|
|
43
43
|
import { createHash } from "crypto";
|
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
CLAUDE_HOOK_EVENTS,
|
|
3
3
|
GEMINI_HOOK_EVENTS,
|
|
4
4
|
hasGeminiHooks
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-EADZPVYW.js";
|
|
6
6
|
import {
|
|
7
7
|
CODEX_HOOK_EVENTS,
|
|
8
8
|
hasCodexHooks,
|
|
9
9
|
holdBudgetOf
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DYHXOXUF.js";
|
|
11
11
|
import {
|
|
12
12
|
CURSOR_GATE_EVENTS,
|
|
13
13
|
HOOK_LOCATOR_BINARY,
|
|
14
14
|
hookCommandHoldBudget
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-T4QY64OR.js";
|
|
16
16
|
|
|
17
17
|
// src/diagnostics/wiring.ts
|
|
18
18
|
var record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
registerTranscript
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NFKVRMTM.js";
|
|
4
4
|
import {
|
|
5
5
|
degradedLine
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-T4QY64OR.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"];
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NPX_LATEST_COMMAND
|
|
3
|
+
} from "./chunk-EA3IELHP.js";
|
|
4
|
+
|
|
1
5
|
// src/config.ts
|
|
2
6
|
import { readFileSync } from "fs";
|
|
3
7
|
import { join } from "path";
|
|
@@ -33,7 +37,7 @@ var getApiKey = () => {
|
|
|
33
37
|
const fileKey = readKeyFromConfigFile();
|
|
34
38
|
if (fileKey) return fileKey;
|
|
35
39
|
throw new Error(
|
|
36
|
-
|
|
40
|
+
`PUSHARY_API_KEY is not set and no key was found in ~/.pushary/config.json. Run \`${NPX_LATEST_COMMAND} setup\`, or get your API key at https://pushary.com/sign-up?from=ai-coding`
|
|
37
41
|
);
|
|
38
42
|
};
|
|
39
43
|
var getBaseUrl = () => process.env.PUSHARY_BASE_URL?.trim() || process.env.PUSHARY_API_URL?.trim() || "https://pushary.com";
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import {
|
|
2
|
+
autoUpdateState
|
|
3
|
+
} from "./chunk-DYHXOXUF.js";
|
|
4
|
+
import {
|
|
5
|
+
readJsonSafe,
|
|
6
|
+
writeJsonAtomic
|
|
7
|
+
} from "./chunk-T7E75EKA.js";
|
|
8
|
+
import {
|
|
9
|
+
ownPackageRoot
|
|
10
|
+
} from "./chunk-HWJW3CPO.js";
|
|
11
|
+
|
|
12
|
+
// src/auto-update.ts
|
|
13
|
+
import { spawn } from "child_process";
|
|
14
|
+
import { dirname, join } from "path";
|
|
15
|
+
var AUTO_UPDATE_DISABLE_ENV = "PUSHARY_DISABLE_AUTOUPDATE";
|
|
16
|
+
var AUTO_UPDATE_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
17
|
+
var AUTO_UPDATE_FLAG = "--auto";
|
|
18
|
+
var GLOBAL_PACKAGE_SUBPATH = "/lib/node_modules/@pushary/agent-hooks";
|
|
19
|
+
var UPGRADE_ENTRY_SUBPATH = ["dist", "bin", "pushary-upgrade.js"];
|
|
20
|
+
var NON_GLOBAL_INSTALL_SEGMENTS = ["/_npx/", "/.volta/"];
|
|
21
|
+
var NOT_DISABLED_VALUES = /* @__PURE__ */ new Set(["", "0"]);
|
|
22
|
+
var AUTO_UPDATE_RESULTS = ["updated", "current", "needs_manual", "failed"];
|
|
23
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24
|
+
var isAutoUpdateResult = (value) => typeof value === "string" && AUTO_UPDATE_RESULTS.some((result) => result === value);
|
|
25
|
+
var stringField = (record, key) => {
|
|
26
|
+
const value = record[key];
|
|
27
|
+
return typeof value === "string" ? value : void 0;
|
|
28
|
+
};
|
|
29
|
+
var booleanField = (record, key) => {
|
|
30
|
+
const value = record[key];
|
|
31
|
+
return typeof value === "boolean" ? value : void 0;
|
|
32
|
+
};
|
|
33
|
+
var parseAutoUpdateState = (value) => {
|
|
34
|
+
if (!isRecord(value)) return {};
|
|
35
|
+
return {
|
|
36
|
+
disabled: booleanField(value, "disabled"),
|
|
37
|
+
lastCheckAt: stringField(value, "lastCheckAt"),
|
|
38
|
+
lastResult: isAutoUpdateResult(value.lastResult) ? value.lastResult : void 0,
|
|
39
|
+
from: stringField(value, "from"),
|
|
40
|
+
to: stringField(value, "to"),
|
|
41
|
+
at: stringField(value, "at"),
|
|
42
|
+
detail: stringField(value, "detail"),
|
|
43
|
+
announced: booleanField(value, "announced")
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
var isAutoUpdateDisabledByEnv = (env) => {
|
|
47
|
+
const value = env[AUTO_UPDATE_DISABLE_ENV];
|
|
48
|
+
return value !== void 0 && !NOT_DISABLED_VALUES.has(value.trim());
|
|
49
|
+
};
|
|
50
|
+
var isContinuousIntegration = (env) => Boolean(env.CI);
|
|
51
|
+
var autoUpdateOffReason = (input) => {
|
|
52
|
+
if (isAutoUpdateDisabledByEnv(input.env)) return "disabled_by_env";
|
|
53
|
+
if (input.state.disabled === true) return "disabled_by_user";
|
|
54
|
+
if (isContinuousIntegration(input.env)) return "ci";
|
|
55
|
+
if (input.platform === "win32") return "windows";
|
|
56
|
+
return null;
|
|
57
|
+
};
|
|
58
|
+
var globalInstallPrefix = (packageRoot) => {
|
|
59
|
+
const root = packageRoot.replace(/\/+$/, "");
|
|
60
|
+
if (!root.endsWith(GLOBAL_PACKAGE_SUBPATH)) return null;
|
|
61
|
+
if (NON_GLOBAL_INSTALL_SEGMENTS.some((segment) => root.includes(segment))) return null;
|
|
62
|
+
const prefix = root.slice(0, -GLOBAL_PACKAGE_SUBPATH.length);
|
|
63
|
+
return prefix.startsWith("/") ? prefix : null;
|
|
64
|
+
};
|
|
65
|
+
var upgradeEntryFor = (prefix) => join(prefix, GLOBAL_PACKAGE_SUBPATH, ...UPGRADE_ENTRY_SUBPATH);
|
|
66
|
+
var checkedWithinInterval = (lastCheckAt, now) => {
|
|
67
|
+
const last = lastCheckAt === void 0 ? Number.NaN : Date.parse(lastCheckAt);
|
|
68
|
+
if (Number.isNaN(last)) return false;
|
|
69
|
+
const elapsed = now - last;
|
|
70
|
+
return elapsed >= 0 && elapsed < AUTO_UPDATE_INTERVAL_MS;
|
|
71
|
+
};
|
|
72
|
+
var autoUpdateDecision = (input) => {
|
|
73
|
+
if (input.isSubagentStart) return { kind: "skip", reason: "subagent_start" };
|
|
74
|
+
const offReason = autoUpdateOffReason(input);
|
|
75
|
+
if (offReason !== null) return { kind: "skip", reason: offReason };
|
|
76
|
+
const prefix = input.packageRoot === void 0 ? null : globalInstallPrefix(input.packageRoot);
|
|
77
|
+
if (prefix === null) return { kind: "skip", reason: "not_global_install" };
|
|
78
|
+
if (checkedWithinInterval(input.state.lastCheckAt, input.now)) return { kind: "skip", reason: "checked_recently" };
|
|
79
|
+
return { kind: "check", prefix };
|
|
80
|
+
};
|
|
81
|
+
var parseAutoUpdateFlag = (args) => {
|
|
82
|
+
const token = args.find((arg) => arg === AUTO_UPDATE_FLAG || arg.startsWith(`${AUTO_UPDATE_FLAG}=`));
|
|
83
|
+
if (token === void 0) return { kind: "absent" };
|
|
84
|
+
if (token === AUTO_UPDATE_FLAG) return { kind: "run" };
|
|
85
|
+
const value = token.slice(AUTO_UPDATE_FLAG.length + 1);
|
|
86
|
+
if (value === "on") return { kind: "set", enabled: true };
|
|
87
|
+
if (value === "off") return { kind: "set", enabled: false };
|
|
88
|
+
return { kind: "invalid", value };
|
|
89
|
+
};
|
|
90
|
+
var AUTO_UPDATE_RESULT_LABELS = {
|
|
91
|
+
updated: "updated",
|
|
92
|
+
current: "up to date",
|
|
93
|
+
needs_manual: "needs a manual upgrade",
|
|
94
|
+
failed: "failed"
|
|
95
|
+
};
|
|
96
|
+
var versionsOf = (state) => state.from && state.to ? `${state.from} to ${state.to}` : state.from;
|
|
97
|
+
var describeAutoUpdateCheck = (state) => {
|
|
98
|
+
const label = state.lastResult ? AUTO_UPDATE_RESULT_LABELS[state.lastResult] : "no result recorded";
|
|
99
|
+
return [label, versionsOf(state), state.detail].filter(Boolean).join(", ");
|
|
100
|
+
};
|
|
101
|
+
var pendingAutoUpdateAnnouncement = (state) => state.lastResult === "updated" && state.announced !== true && state.from && state.to ? { from: state.from, to: state.to } : null;
|
|
102
|
+
var describeAutoUpdateAnnouncement = (announcement) => `Pushary updated itself from ${announcement.from} to ${announcement.to}.`;
|
|
103
|
+
var takeAutoUpdateAnnouncement = (statePath, markAnnounced) => {
|
|
104
|
+
try {
|
|
105
|
+
const announcement = pendingAutoUpdateAnnouncement(readAutoUpdateState(statePath));
|
|
106
|
+
if (announcement && markAnnounced) updateAutoUpdateState(statePath, { announced: true });
|
|
107
|
+
return announcement;
|
|
108
|
+
} catch {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
var readAutoUpdateState = (statePath) => {
|
|
113
|
+
const read = readJsonSafe(statePath);
|
|
114
|
+
return read.kind === "ok" ? parseAutoUpdateState(read.value) : {};
|
|
115
|
+
};
|
|
116
|
+
var updateAutoUpdateState = (statePath, patch) => {
|
|
117
|
+
const next = { ...readAutoUpdateState(statePath), ...patch };
|
|
118
|
+
writeJsonAtomic(statePath, next);
|
|
119
|
+
return next;
|
|
120
|
+
};
|
|
121
|
+
var ignoreSpawnFailure = () => void 0;
|
|
122
|
+
var spawnDetached = (command, args, cwd) => {
|
|
123
|
+
const child = spawn(command, [...args], { cwd, detached: true, stdio: "ignore" });
|
|
124
|
+
child.on("error", ignoreSpawnFailure);
|
|
125
|
+
child.unref();
|
|
126
|
+
};
|
|
127
|
+
var triggerAutoUpdate = (trigger) => {
|
|
128
|
+
try {
|
|
129
|
+
const statePath = trigger.statePath ?? autoUpdateState();
|
|
130
|
+
const now = trigger.now ?? Date.now();
|
|
131
|
+
const decision = autoUpdateDecision({
|
|
132
|
+
env: trigger.env ?? process.env,
|
|
133
|
+
state: readAutoUpdateState(statePath),
|
|
134
|
+
now,
|
|
135
|
+
platform: trigger.platform ?? process.platform,
|
|
136
|
+
packageRoot: trigger.packageRoot ?? ownPackageRoot(),
|
|
137
|
+
isSubagentStart: trigger.isSubagentStart
|
|
138
|
+
});
|
|
139
|
+
if (decision.kind === "skip") return decision;
|
|
140
|
+
updateAutoUpdateState(statePath, { lastCheckAt: new Date(now).toISOString() });
|
|
141
|
+
const spawnUpgrade = trigger.spawn ?? spawnDetached;
|
|
142
|
+
spawnUpgrade(trigger.execPath ?? process.execPath, [upgradeEntryFor(decision.prefix), AUTO_UPDATE_FLAG], dirname(statePath));
|
|
143
|
+
return decision;
|
|
144
|
+
} catch {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export {
|
|
150
|
+
AUTO_UPDATE_DISABLE_ENV,
|
|
151
|
+
isAutoUpdateDisabledByEnv,
|
|
152
|
+
autoUpdateOffReason,
|
|
153
|
+
globalInstallPrefix,
|
|
154
|
+
upgradeEntryFor,
|
|
155
|
+
parseAutoUpdateFlag,
|
|
156
|
+
describeAutoUpdateCheck,
|
|
157
|
+
describeAutoUpdateAnnouncement,
|
|
158
|
+
takeAutoUpdateAnnouncement,
|
|
159
|
+
readAutoUpdateState,
|
|
160
|
+
updateAutoUpdateState,
|
|
161
|
+
triggerAutoUpdate
|
|
162
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EXIT
|
|
3
|
+
} from "./chunk-KZERVKTD.js";
|
|
1
4
|
import {
|
|
2
5
|
renderCommandHelp
|
|
3
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-EA3IELHP.js";
|
|
4
7
|
import {
|
|
5
8
|
getPackageVersion
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
EXIT
|
|
9
|
-
} from "./chunk-KZERVKTD.js";
|
|
9
|
+
} from "./chunk-HWJW3CPO.js";
|
|
10
10
|
|
|
11
11
|
// src/cli/usage.ts
|
|
12
12
|
var exitOnHelpFlag = (command) => {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AGENT_CHOICES
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TFKBFQCE.js";
|
|
4
4
|
import {
|
|
5
5
|
isBridgeLocator
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-K3QVDAZW.js";
|
|
7
7
|
import {
|
|
8
8
|
pusharyHookExecutable
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-NTQSICPJ.js";
|
|
10
10
|
import {
|
|
11
11
|
BELL_HOOK_BINARY
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-SOCEY746.js";
|
|
13
13
|
|
|
14
14
|
// src/setup/hook-ownership.ts
|
|
15
15
|
var commandsIn = (value) => {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
detectClaudeVersion
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3NBODGQS.js";
|
|
4
4
|
import {
|
|
5
5
|
addClaudeMcpServer,
|
|
6
6
|
addPusharyHooks,
|
|
7
7
|
addPusharyToolPermissions
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-J4J45VPZ.js";
|
|
9
9
|
import {
|
|
10
10
|
claudeUnprovenHolds,
|
|
11
11
|
claudeWired,
|
|
12
12
|
codexUnprovenHolds,
|
|
13
13
|
codexWired,
|
|
14
14
|
geminiWired
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-NTQSICPJ.js";
|
|
16
16
|
import {
|
|
17
17
|
CLAUDE_HOOK_BINARY,
|
|
18
18
|
CLAUDE_HOOK_EVENTS,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
needsReregistration,
|
|
25
25
|
registrationSignatures,
|
|
26
26
|
supportedClaudeEvents
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-EADZPVYW.js";
|
|
28
28
|
import {
|
|
29
29
|
CODEX_HOOK_BINARY,
|
|
30
30
|
addCodexHookTrust,
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
registrationHolderOf,
|
|
45
45
|
resolveGlobalBinary,
|
|
46
46
|
vscodePluginMcp
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-DYHXOXUF.js";
|
|
48
48
|
import {
|
|
49
49
|
readJsonSafe,
|
|
50
50
|
writeFileAtomic,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
callMcpTool
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HETOKNIL.js";
|
|
4
4
|
import {
|
|
5
5
|
installProxyDispatcher
|
|
6
6
|
} from "./chunk-SAF6HGAA.js";
|
|
7
7
|
import {
|
|
8
8
|
getBaseUrl
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-OSJEMXSR.js";
|
|
10
10
|
|
|
11
11
|
// src/api.ts
|
|
12
12
|
import { randomUUID } from "crypto";
|
|
@@ -22,6 +22,7 @@ var COWORK_STANDING_INSTRUCTIONS = `Pushary is connected as a custom connector.
|
|
|
22
22
|
- If Pushary tools are missing or disabled, report that once and continue within my authorization. Do not claim a notification or approval was delivered.`;
|
|
23
23
|
|
|
24
24
|
// ../contracts/src/agent-manifest.ts
|
|
25
|
+
var AGENT_HOOKS_SETUP_COMMAND = "npx @pushary/agent-hooks@latest setup";
|
|
25
26
|
var defaults = {
|
|
26
27
|
hasStoredIdentity: true,
|
|
27
28
|
hookSource: null,
|
|
@@ -53,7 +54,7 @@ var AGENTS = {
|
|
|
53
54
|
managedProvider: true,
|
|
54
55
|
enforcement: "enforced",
|
|
55
56
|
connectVia: "Native hooks + MCP",
|
|
56
|
-
setupCommand:
|
|
57
|
+
setupCommand: AGENT_HOOKS_SETUP_COMMAND,
|
|
57
58
|
enforcementDetail: "Shell, writes and edits, subject to Claude Code permission mode and explicit policy."
|
|
58
59
|
},
|
|
59
60
|
claude_chat: {
|
|
@@ -80,7 +81,7 @@ var AGENTS = {
|
|
|
80
81
|
managedProvider: true,
|
|
81
82
|
enforcement: "enforced",
|
|
82
83
|
connectVia: "Native hooks + MCP",
|
|
83
|
-
setupCommand:
|
|
84
|
+
setupCommand: AGENT_HOOKS_SETUP_COMMAND,
|
|
84
85
|
enforcementDetail: "Shell and apply_patch edits through native permission hooks; requires a compatible Codex runtime."
|
|
85
86
|
},
|
|
86
87
|
chatgpt: {
|
|
@@ -100,7 +101,7 @@ var AGENTS = {
|
|
|
100
101
|
managedProvider: true,
|
|
101
102
|
enforcement: "enforced",
|
|
102
103
|
connectVia: "Native hooks + MCP",
|
|
103
|
-
setupCommand:
|
|
104
|
+
setupCommand: AGENT_HOOKS_SETUP_COMMAND,
|
|
104
105
|
enforcementDetail: "Shell, writes and edits through native BeforeTool hooks."
|
|
105
106
|
},
|
|
106
107
|
hermes: {
|
|
@@ -109,7 +110,7 @@ var AGENTS = {
|
|
|
109
110
|
policyAgent: "hermes",
|
|
110
111
|
enforcement: "enforced",
|
|
111
112
|
connectVia: "Native Python plugin + approval transport",
|
|
112
|
-
setupCommand:
|
|
113
|
+
setupCommand: AGENT_HOOKS_SETUP_COMMAND,
|
|
113
114
|
enforcementDetail: "Hermes dangerous-command approvals when the Pushary transport is selected; optional PUSHARY_GATE_TOOLS gates named tools.",
|
|
114
115
|
capabilityNote: "Uses the Python plugin, not a macOS bridge HookSource. CLI disconnect and managed-provider controls are not implemented for Hermes."
|
|
115
116
|
},
|
|
@@ -122,7 +123,7 @@ var AGENTS = {
|
|
|
122
123
|
disconnectable: true,
|
|
123
124
|
enforcement: "enforced",
|
|
124
125
|
connectVia: "Editor plugin hooks + MCP",
|
|
125
|
-
setupCommand:
|
|
126
|
+
setupCommand: AGENT_HOOKS_SETUP_COMMAND,
|
|
126
127
|
enforcementDetail: "With installed hooks: shell, MCP execution and Write/Delete/Edit tool calls. Plain MCP remains cooperative."
|
|
127
128
|
},
|
|
128
129
|
vscode: {
|
|
@@ -133,7 +134,7 @@ var AGENTS = {
|
|
|
133
134
|
policyAgent: "vscode",
|
|
134
135
|
enforcement: "enforced",
|
|
135
136
|
connectVia: "Agent plugin hooks + MCP",
|
|
136
|
-
setupCommand:
|
|
137
|
+
setupCommand: AGENT_HOOKS_SETUP_COMMAND,
|
|
137
138
|
enforcementDetail: "PreToolUse approval hooks from the installed agent plugin; the host decides which events it exposes.",
|
|
138
139
|
capabilityNote: "Has both a bridge HookSource and a per-agent policy profile. CLI disconnect and managed-provider controls are not implemented for VS Code."
|
|
139
140
|
},
|
|
@@ -147,7 +148,7 @@ var AGENTS = {
|
|
|
147
148
|
disconnectable: true,
|
|
148
149
|
enforcement: "enforced",
|
|
149
150
|
connectVia: "Generated plugin + MCP",
|
|
150
|
-
setupCommand:
|
|
151
|
+
setupCommand: AGENT_HOOKS_SETUP_COMMAND,
|
|
151
152
|
enforcementDetail: "Shell, writes, edits and web fetches when OpenCode itself asks for permission."
|
|
152
153
|
},
|
|
153
154
|
qwen_code: {
|
|
@@ -160,7 +161,7 @@ var AGENTS = {
|
|
|
160
161
|
disconnectable: true,
|
|
161
162
|
enforcement: "enforced",
|
|
162
163
|
connectVia: "Native hooks + MCP",
|
|
163
|
-
setupCommand:
|
|
164
|
+
setupCommand: AGENT_HOOKS_SETUP_COMMAND,
|
|
164
165
|
enforcementDetail: "Shell, writes and edits through native PreToolUse hooks, matched on Qwen's own tool names and their Claude-shaped aliases."
|
|
165
166
|
},
|
|
166
167
|
codebuddy: {
|
|
@@ -173,7 +174,7 @@ var AGENTS = {
|
|
|
173
174
|
disconnectable: true,
|
|
174
175
|
enforcement: "enforced",
|
|
175
176
|
connectVia: "Native hooks + MCP",
|
|
176
|
-
setupCommand:
|
|
177
|
+
setupCommand: AGENT_HOOKS_SETUP_COMMAND,
|
|
177
178
|
enforcementDetail: "Shell, writes and edits through native PreToolUse hooks, plus PermissionRequest. CodeBuddy implements the Claude Code hook specification."
|
|
178
179
|
},
|
|
179
180
|
qoder: {
|
|
@@ -186,7 +187,7 @@ var AGENTS = {
|
|
|
186
187
|
disconnectable: true,
|
|
187
188
|
enforcement: "enforced",
|
|
188
189
|
connectVia: "Native hooks + MCP",
|
|
189
|
-
setupCommand:
|
|
190
|
+
setupCommand: AGENT_HOOKS_SETUP_COMMAND,
|
|
190
191
|
enforcementDetail: "Shell, writes and edits through native PreToolUse hooks, plus PermissionRequest, over Qoder's superset of the Claude Code event list.",
|
|
191
192
|
capabilityNote: "Qoder documents no user-level instructions file, so the proactive-ask block is not installed. Hooks and MCP are unaffected. Like every agent in this family, the CLI wires it; the macOS app does not yet."
|
|
192
193
|
},
|
|
@@ -200,7 +201,7 @@ var AGENTS = {
|
|
|
200
201
|
disconnectable: true,
|
|
201
202
|
enforcement: "enforced",
|
|
202
203
|
connectVia: "Native hooks",
|
|
203
|
-
setupCommand:
|
|
204
|
+
setupCommand: AGENT_HOOKS_SETUP_COMMAND,
|
|
204
205
|
enforcementDetail: "Execute, Create, Edit and ApplyPatch through native PreToolUse hooks in ~/.factory/hooks.json.",
|
|
205
206
|
capabilityNote: "Droid registers MCP servers through `droid mcp add` rather than a documented remote-server config shape, so setup writes hooks only. Add Pushary's MCP server yourself to let Droid send notifications and ask questions."
|
|
206
207
|
},
|
|
@@ -214,14 +215,14 @@ var AGENTS = {
|
|
|
214
215
|
disconnectable: true,
|
|
215
216
|
enforcement: "enforced",
|
|
216
217
|
connectVia: "Native hooks",
|
|
217
|
-
setupCommand:
|
|
218
|
+
setupCommand: AGENT_HOOKS_SETUP_COMMAND,
|
|
218
219
|
enforcementDetail: "exec, write and edit through native PreToolUse hooks, answered in Devin's own approve/block schema.",
|
|
219
220
|
capabilityNote: "Devin CLI answers PreToolUse with `{decision}` rather than a permission decision. Pushary blocks an unanswered approval because this adapter cannot request a native prompt reliably. Question and plan dialogs remain with Devin; this adapter does not render their answers. It also fires no Notification event."
|
|
220
221
|
},
|
|
221
222
|
windsurf: {
|
|
222
223
|
...defaults,
|
|
223
224
|
label: "Windsurf",
|
|
224
|
-
setupCommand:
|
|
225
|
+
setupCommand: AGENT_HOOKS_SETUP_COMMAND,
|
|
225
226
|
setupChoice: "Other"
|
|
226
227
|
},
|
|
227
228
|
unknown: {
|
|
@@ -238,7 +239,7 @@ var AGENTS = {
|
|
|
238
239
|
...defaults,
|
|
239
240
|
hasStoredIdentity: false,
|
|
240
241
|
label: "Any MCP client",
|
|
241
|
-
setupCommand:
|
|
242
|
+
setupCommand: AGENT_HOOKS_SETUP_COMMAND,
|
|
242
243
|
setupChoice: "Other"
|
|
243
244
|
},
|
|
244
245
|
http: {
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
COMPATIBLE_AGENT_TYPES,
|
|
9
9
|
isValidApiKey
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-T4QY64OR.js";
|
|
11
11
|
|
|
12
12
|
// src/setup/options.ts
|
|
13
13
|
var AGENT_CHOICES = ["claude_code", "codex", "gemini_cli", "hermes", "cursor", "vscode", "opencode", ...COMPATIBLE_AGENT_TYPES, "custom"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveInstallSourceFor
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HU5LSYL2.js";
|
|
4
4
|
import {
|
|
5
5
|
backupFile,
|
|
6
6
|
readJsonSafe,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-T7E75EKA.js";
|
|
10
10
|
import {
|
|
11
11
|
configFilePath
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-OSJEMXSR.js";
|
|
13
13
|
|
|
14
14
|
// src/shell-alias.ts
|
|
15
15
|
import { homedir } from "os";
|