@pushary/agent-hooks 0.89.2 → 0.89.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 +9 -0
- package/README.md +40 -0
- package/dist/bin/pushary-bell-hook.js +3 -3
- package/dist/bin/pushary-bell.js +9 -10
- package/dist/bin/pushary-claude.js +106 -24
- package/dist/bin/pushary-clean.js +28 -7
- package/dist/bin/pushary-codex-bridge.js +17 -7
- package/dist/bin/pushary-codex-hook.js +8 -7
- package/dist/bin/pushary-codex.js +6 -4
- package/dist/bin/pushary-connect.js +4 -4
- package/dist/bin/pushary-daemon.js +141 -21
- package/dist/bin/pushary-disconnect.js +3 -4
- package/dist/bin/pushary-doctor.js +45 -29
- package/dist/bin/pushary-elicitation-hook.js +4 -2
- package/dist/bin/pushary-gemini-bridge.js +16 -6
- package/dist/bin/pushary-gemini-hook.js +6 -4
- package/dist/bin/pushary-hook.js +9 -7
- package/dist/bin/pushary-login.js +4 -4
- package/dist/bin/pushary-logout.js +5 -6
- package/dist/bin/pushary-mode.js +2 -2
- package/dist/bin/pushary-notification-hook.js +6 -4
- package/dist/bin/pushary-opencode-hook.js +14 -6
- package/dist/bin/pushary-permission-denied-hook.js +7 -5
- package/dist/bin/pushary-permission-hook.js +7 -5
- package/dist/bin/pushary-post-hook.js +6 -4
- package/dist/bin/pushary-prompt-hook.js +6 -4
- package/dist/bin/pushary-session-end-hook.js +6 -4
- package/dist/bin/pushary-session-start-hook.js +6 -4
- package/dist/bin/pushary-setup.js +49 -28
- package/dist/bin/pushary-stats.js +2 -2
- package/dist/bin/pushary-status.js +7 -6
- package/dist/bin/pushary-stop-hook.js +6 -4
- package/dist/bin/pushary-stopfailure-hook.js +6 -4
- package/dist/bin/pushary-suggestions.js +2 -2
- package/dist/bin/pushary-upgrade.js +63 -28
- package/dist/bin/pushary-wait.js +2 -2
- package/dist/bin/pushary.js +1 -1
- package/dist/chunk-2HYPZLYY.js +45 -0
- package/dist/{chunk-ZYPS2XMT.js → chunk-4ZHQNBDP.js} +1 -1
- package/dist/{chunk-B7JE4XHD.js → chunk-7IJYOBHL.js} +1 -1
- package/dist/{chunk-NRGRUOAR.js → chunk-FWUEYXSD.js} +4 -0
- package/dist/{chunk-J3YDT4HM.js → chunk-GKAKAOKC.js} +68 -2
- package/dist/{chunk-GOEXZ5QJ.js → chunk-GPNOHKFO.js} +9 -2
- package/dist/{chunk-SQOFGPNX.js → chunk-KJ57OPCC.js} +1 -1
- package/dist/{chunk-LGXTBUT4.js → chunk-KOPUTJQC.js} +1 -0
- package/dist/{chunk-HEQVIIBN.js → chunk-MZBT2LXW.js} +4 -4
- package/dist/{chunk-6XSC6Z2K.js → chunk-NFI2K2ZQ.js} +80 -23
- package/dist/{chunk-K42SZKYF.js → chunk-NLMSSKES.js} +251 -6
- package/dist/{chunk-4VYUMYWD.js → chunk-OBI4YMCT.js} +17 -2
- package/dist/{chunk-LUCFN47K.js → chunk-QH4AA7QV.js} +1 -1
- package/dist/{chunk-VKVHY5HD.js → chunk-V37ZXMH3.js} +11 -3
- package/dist/{chunk-MHBC2XUP.js → chunk-VP7SDXYG.js} +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +7 -5
- package/package.json +1 -1
- package/dist/chunk-GIRT7677.js +0 -11
- package/dist/chunk-RN3NOEJF.js +0 -9
- package/dist/{chunk-LALHWDWL.js → chunk-W6NPWHBJ.js} +3 -3
|
@@ -2,22 +2,29 @@
|
|
|
2
2
|
import {
|
|
3
3
|
HEARTBEAT_INTERVAL_MS,
|
|
4
4
|
sendHeartbeat
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-VP7SDXYG.js";
|
|
6
6
|
import {
|
|
7
7
|
DAEMON_LEASE_RENEW_INTERVAL_MS,
|
|
8
8
|
acquireDaemonLease,
|
|
9
|
+
ensureDaemonRunning,
|
|
10
|
+
manageDaemonService,
|
|
11
|
+
parseDaemonAction,
|
|
9
12
|
readDaemonStatus,
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
replaceDaemonService,
|
|
14
|
+
requestDaemonHandoff,
|
|
15
|
+
stopDaemonRunning
|
|
16
|
+
} from "../chunk-NLMSSKES.js";
|
|
12
17
|
import {
|
|
18
|
+
CLAUDE_BRIDGE_CAPABILITY,
|
|
19
|
+
CLAUDE_RESUME_CAPABILITY,
|
|
13
20
|
CODEX_BRIDGE_CAPABILITY,
|
|
14
21
|
CODEX_RESUME_CAPABILITY,
|
|
15
22
|
geminiLiveCapabilities
|
|
16
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-FWUEYXSD.js";
|
|
17
24
|
import {
|
|
18
25
|
findLiveProcessBySpawnId,
|
|
19
26
|
ownsLiveProcess
|
|
20
|
-
} from "../chunk-
|
|
27
|
+
} from "../chunk-4ZHQNBDP.js";
|
|
21
28
|
import {
|
|
22
29
|
spawnClaude
|
|
23
30
|
} from "../chunk-XHKBHWLX.js";
|
|
@@ -26,20 +33,19 @@ import {
|
|
|
26
33
|
resolveGlobalPackageVersion,
|
|
27
34
|
resolvePackageVersionFromBinary
|
|
28
35
|
} from "../chunk-PZA7G4CN.js";
|
|
29
|
-
import "../chunk-VKVHY5HD.js";
|
|
30
|
-
import "../chunk-GIRT7677.js";
|
|
31
36
|
import {
|
|
32
37
|
getMachineId
|
|
33
|
-
} from "../chunk-
|
|
38
|
+
} from "../chunk-2HYPZLYY.js";
|
|
39
|
+
import "../chunk-V37ZXMH3.js";
|
|
34
40
|
import {
|
|
35
41
|
exitOnHelpFlag
|
|
36
|
-
} from "../chunk-
|
|
37
|
-
import "../chunk-
|
|
42
|
+
} from "../chunk-KJ57OPCC.js";
|
|
43
|
+
import "../chunk-GPNOHKFO.js";
|
|
38
44
|
import "../chunk-DINDL2CF.js";
|
|
39
|
-
import "../chunk-6MTNS63X.js";
|
|
40
45
|
import {
|
|
41
46
|
EXIT
|
|
42
47
|
} from "../chunk-KZERVKTD.js";
|
|
48
|
+
import "../chunk-6MTNS63X.js";
|
|
43
49
|
import {
|
|
44
50
|
getApiKey,
|
|
45
51
|
getBaseUrl
|
|
@@ -48,7 +54,8 @@ import "../chunk-L4C2JXJS.js";
|
|
|
48
54
|
|
|
49
55
|
// src/spawn-daemon.ts
|
|
50
56
|
import { execFileSync, spawn } from "child_process";
|
|
51
|
-
import { existsSync } from "fs";
|
|
57
|
+
import { existsSync, statSync } from "fs";
|
|
58
|
+
import { homedir } from "os";
|
|
52
59
|
import { basename, dirname, join } from "path";
|
|
53
60
|
|
|
54
61
|
// src/stop-requests.ts
|
|
@@ -167,6 +174,29 @@ var isAuthFailure = (err) => {
|
|
|
167
174
|
if (candidate.name !== "DrainError") return false;
|
|
168
175
|
return candidate.status === 401 || candidate.status === 403;
|
|
169
176
|
};
|
|
177
|
+
var providerLaunchError = (requestedAgent, binaries) => {
|
|
178
|
+
const agent = requestedAgent === "codex" || requestedAgent === "gemini" ? requestedAgent : "claude";
|
|
179
|
+
if (binaries[agent]) return null;
|
|
180
|
+
return agent === "claude" ? "Claude Code is not installed on this machine" : `${agent === "codex" ? "Codex" : "Gemini"} CLI is not installed on this machine`;
|
|
181
|
+
};
|
|
182
|
+
var resolveSpawnDirectory = (requested, options = {}) => {
|
|
183
|
+
const fallbackDir = options.fallbackDir ?? process.cwd();
|
|
184
|
+
const value = requested?.trim();
|
|
185
|
+
if (!value) return { ok: true, cwd: fallbackDir };
|
|
186
|
+
const homeDir = options.homeDir ?? homedir();
|
|
187
|
+
const cwd = value === "~" ? homeDir : value.startsWith("~/") || value.startsWith("~\\") ? join(homeDir, value.slice(2)) : value;
|
|
188
|
+
if (!(options.exists ?? existsSync)(cwd)) {
|
|
189
|
+
return { ok: false, message: `Directory does not exist: ${value}` };
|
|
190
|
+
}
|
|
191
|
+
try {
|
|
192
|
+
if (!(options.isDirectory ?? ((path) => statSync(path).isDirectory()))(cwd)) {
|
|
193
|
+
return { ok: false, message: `Not a directory: ${value}` };
|
|
194
|
+
}
|
|
195
|
+
} catch {
|
|
196
|
+
return { ok: false, message: `Not a directory: ${value}` };
|
|
197
|
+
}
|
|
198
|
+
return { ok: true, cwd };
|
|
199
|
+
};
|
|
170
200
|
var isFlagShapedPrompt = (prompt) => prompt.trimStart().startsWith("-");
|
|
171
201
|
var buildSpawnLaunch = (req, opts) => {
|
|
172
202
|
if (isFlagShapedPrompt(req.prompt)) return null;
|
|
@@ -209,6 +239,7 @@ var runSpawnDaemon = async () => {
|
|
|
209
239
|
const machineId = getMachineId();
|
|
210
240
|
const baseUrl = getBaseUrl();
|
|
211
241
|
const pusharyBin = resolveBinary("pushary") ?? "pushary";
|
|
242
|
+
const claudeBin = resolveBinary("claude");
|
|
212
243
|
const codexBin = resolveBinary("codex");
|
|
213
244
|
const geminiBin = resolveBinary("gemini");
|
|
214
245
|
const geminiCapabilities = geminiBin ? geminiLiveCapabilities(
|
|
@@ -261,8 +292,18 @@ var runSpawnDaemon = async () => {
|
|
|
261
292
|
if (launchedProcesses.size >= MAX_TRACKED_PROCESSES) {
|
|
262
293
|
return Promise.reject(new Error("This daemon is already tracking 100 active sessions"));
|
|
263
294
|
}
|
|
295
|
+
const directory = resolveSpawnDirectory(req.cwd);
|
|
296
|
+
if (!directory.ok) return Promise.reject(new Error(directory.message));
|
|
297
|
+
const agent = req.agent === "codex" || req.agent === "gemini" ? req.agent : "claude";
|
|
298
|
+
const providerBin = resolveBinary(agent);
|
|
299
|
+
const unavailable = providerLaunchError(req.agent, {
|
|
300
|
+
claude: agent === "claude" ? providerBin ?? null : null,
|
|
301
|
+
codex: agent === "codex" ? providerBin ?? null : null,
|
|
302
|
+
gemini: agent === "gemini" ? providerBin ?? null : null
|
|
303
|
+
});
|
|
304
|
+
if (unavailable) return Promise.reject(new Error(unavailable));
|
|
264
305
|
spawnTimestamps.push(Date.now());
|
|
265
|
-
const cwd =
|
|
306
|
+
const cwd = directory.cwd;
|
|
266
307
|
const env = {
|
|
267
308
|
...process.env,
|
|
268
309
|
PUSHARY_SPAWN_ID: req.id,
|
|
@@ -274,10 +315,10 @@ var runSpawnDaemon = async () => {
|
|
|
274
315
|
PUSHARY_BRIDGE_RESUME_SESSION_ID: req.resumeSessionId || void 0
|
|
275
316
|
} : {},
|
|
276
317
|
...req.agent === "codex" ? {
|
|
277
|
-
PUSHARY_CODEX_COMMAND:
|
|
318
|
+
PUSHARY_CODEX_COMMAND: providerBin ?? "codex"
|
|
278
319
|
} : {},
|
|
279
320
|
...req.agent === "gemini" ? {
|
|
280
|
-
PUSHARY_GEMINI_COMMAND:
|
|
321
|
+
PUSHARY_GEMINI_COMMAND: providerBin ?? "gemini"
|
|
281
322
|
} : {}
|
|
282
323
|
};
|
|
283
324
|
const plan = buildSpawnLaunch(req, {
|
|
@@ -504,6 +545,7 @@ var runSpawnDaemon = async () => {
|
|
|
504
545
|
"spawn",
|
|
505
546
|
STOP_CAPABILITY,
|
|
506
547
|
STOP_ACK_CAPABILITY,
|
|
548
|
+
...claudeBin ? [CLAUDE_BRIDGE_CAPABILITY, CLAUDE_RESUME_CAPABILITY] : [],
|
|
507
549
|
...codexBin ? [CODEX_BRIDGE_CAPABILITY, CODEX_RESUME_CAPABILITY] : [],
|
|
508
550
|
...geminiCapabilities
|
|
509
551
|
]
|
|
@@ -541,10 +583,88 @@ var runSpawnDaemon = async () => {
|
|
|
541
583
|
|
|
542
584
|
// bin/pushary-daemon.ts
|
|
543
585
|
exitOnHelpFlag("daemon");
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
);
|
|
549
|
-
|
|
586
|
+
var serviceFailure = (result) => result.kind === "ok" ? null : result.detail;
|
|
587
|
+
var applyService = (action) => serviceFailure(manageDaemonService(action));
|
|
588
|
+
var waitForManagedDaemon = async () => {
|
|
589
|
+
const result = await ensureDaemonRunning({ spawnDaemon: () => {
|
|
590
|
+
} });
|
|
591
|
+
return "detail" in result ? result.detail : null;
|
|
592
|
+
};
|
|
593
|
+
var main = async () => {
|
|
594
|
+
const action = parseDaemonAction(process.argv.slice(2));
|
|
595
|
+
if (!action) {
|
|
596
|
+
process.stderr.write("Unknown daemon action. Use install, start, stop, restart, status, uninstall, or foreground.\n");
|
|
597
|
+
return EXIT.USAGE;
|
|
598
|
+
}
|
|
599
|
+
if (action === "foreground") return await runSpawnDaemon();
|
|
600
|
+
if (action === "status") {
|
|
601
|
+
const status = readDaemonStatus();
|
|
602
|
+
process.stdout.write(`Pushary daemon: ${status.kind}${status.pid ? ` (pid ${status.pid})` : ""}
|
|
603
|
+
`);
|
|
604
|
+
return status.kind === "running" ? EXIT.OK : EXIT.UNREACHABLE;
|
|
605
|
+
}
|
|
606
|
+
if (action === "install") {
|
|
607
|
+
const installed = await replaceDaemonService();
|
|
608
|
+
if (installed.kind !== "ok") {
|
|
609
|
+
process.stderr.write(`[pushary] daemon service install failed: ${installed.detail}
|
|
610
|
+
`);
|
|
611
|
+
return EXIT.FAILED;
|
|
612
|
+
}
|
|
613
|
+
const unhealthy = await waitForManagedDaemon();
|
|
614
|
+
if (unhealthy) {
|
|
615
|
+
process.stderr.write(`[pushary] daemon service installed but unavailable: ${unhealthy}
|
|
616
|
+
`);
|
|
617
|
+
return EXIT.UNREACHABLE;
|
|
618
|
+
}
|
|
619
|
+
process.stdout.write("[pushary] daemon service installed and online\n");
|
|
620
|
+
return EXIT.OK;
|
|
621
|
+
}
|
|
622
|
+
if (action === "start") {
|
|
623
|
+
const failed2 = applyService("start");
|
|
624
|
+
if (failed2) {
|
|
625
|
+
process.stderr.write(`[pushary] daemon service could not start: ${failed2}
|
|
626
|
+
`);
|
|
627
|
+
return EXIT.FAILED;
|
|
628
|
+
}
|
|
629
|
+
const unhealthy = await waitForManagedDaemon();
|
|
630
|
+
if (unhealthy) {
|
|
631
|
+
process.stderr.write(`[pushary] daemon service did not become healthy: ${unhealthy}
|
|
632
|
+
`);
|
|
633
|
+
return EXIT.UNREACHABLE;
|
|
634
|
+
}
|
|
635
|
+
process.stdout.write("[pushary] daemon service online\n");
|
|
636
|
+
return EXIT.OK;
|
|
637
|
+
}
|
|
638
|
+
const serviceAction = action === "uninstall" ? "uninstall" : "stop";
|
|
639
|
+
const failed = applyService(serviceAction);
|
|
640
|
+
const stopped = await stopDaemonRunning();
|
|
641
|
+
if (failed || stopped.kind === "unavailable") {
|
|
642
|
+
const detail = [failed, stopped.kind === "unavailable" ? stopped.detail : null].filter(Boolean).join("; ");
|
|
643
|
+
process.stderr.write(`[pushary] daemon could not stop: ${detail}
|
|
644
|
+
`);
|
|
645
|
+
return EXIT.FAILED;
|
|
646
|
+
}
|
|
647
|
+
if (action === "restart") {
|
|
648
|
+
const startFailed = applyService("start");
|
|
649
|
+
if (startFailed) {
|
|
650
|
+
process.stderr.write(`[pushary] daemon service could not restart: ${startFailed}
|
|
651
|
+
`);
|
|
652
|
+
return EXIT.FAILED;
|
|
653
|
+
}
|
|
654
|
+
const unhealthy = await waitForManagedDaemon();
|
|
655
|
+
if (unhealthy) {
|
|
656
|
+
process.stderr.write(`[pushary] daemon service did not become healthy: ${unhealthy}
|
|
657
|
+
`);
|
|
658
|
+
return EXIT.UNREACHABLE;
|
|
659
|
+
}
|
|
660
|
+
process.stdout.write("[pushary] daemon service restarted\n");
|
|
661
|
+
return EXIT.OK;
|
|
662
|
+
}
|
|
663
|
+
process.stdout.write(action === "uninstall" ? "[pushary] daemon service removed\n" : "[pushary] daemon stopped\n");
|
|
664
|
+
return EXIT.OK;
|
|
665
|
+
};
|
|
666
|
+
main().then((code) => process.exit(code)).catch((err) => {
|
|
667
|
+
process.stderr.write(`[pushary] daemon error: ${err instanceof Error ? err.message : String(err)}
|
|
668
|
+
`);
|
|
669
|
+
process.exit(EXIT.FAILED);
|
|
550
670
|
});
|
|
@@ -29,12 +29,11 @@ import {
|
|
|
29
29
|
geminiSettings,
|
|
30
30
|
removeCodexHooks,
|
|
31
31
|
removeCodexSettings
|
|
32
|
-
} from "../chunk-
|
|
33
|
-
import "../chunk-GIRT7677.js";
|
|
32
|
+
} from "../chunk-V37ZXMH3.js";
|
|
34
33
|
import {
|
|
35
34
|
exitOnHelpFlag
|
|
36
|
-
} from "../chunk-
|
|
37
|
-
import "../chunk-
|
|
35
|
+
} from "../chunk-KJ57OPCC.js";
|
|
36
|
+
import "../chunk-GPNOHKFO.js";
|
|
38
37
|
import "../chunk-DINDL2CF.js";
|
|
39
38
|
import "../chunk-KZERVKTD.js";
|
|
40
39
|
import "../chunk-L4C2JXJS.js";
|
|
@@ -5,11 +5,9 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
claudeWired,
|
|
7
7
|
codexWired,
|
|
8
|
-
geminiWired
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
readDaemonStatus
|
|
12
|
-
} from "../chunk-K42SZKYF.js";
|
|
8
|
+
geminiWired,
|
|
9
|
+
pusharyHookExecutable
|
|
10
|
+
} from "../chunk-OBI4YMCT.js";
|
|
13
11
|
import {
|
|
14
12
|
agentProbes,
|
|
15
13
|
detectAgent,
|
|
@@ -18,7 +16,7 @@ import {
|
|
|
18
16
|
isDetected,
|
|
19
17
|
isPluginRegistered,
|
|
20
18
|
vscodeSettingsTargets
|
|
21
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-QH4AA7QV.js";
|
|
22
20
|
import {
|
|
23
21
|
OPENCODE_PLUGIN_PLACEHOLDER,
|
|
24
22
|
openCodePluginDir,
|
|
@@ -32,10 +30,20 @@ import {
|
|
|
32
30
|
} from "../chunk-7TS2G4QG.js";
|
|
33
31
|
import "../chunk-ATBKJNWS.js";
|
|
34
32
|
import "../chunk-AIGDBRIJ.js";
|
|
33
|
+
import {
|
|
34
|
+
readDaemonStatus
|
|
35
|
+
} from "../chunk-NLMSSKES.js";
|
|
35
36
|
import "../chunk-XHKBHWLX.js";
|
|
36
37
|
import {
|
|
37
38
|
execNpm
|
|
38
39
|
} from "../chunk-PZA7G4CN.js";
|
|
40
|
+
import {
|
|
41
|
+
readLedgerSummary
|
|
42
|
+
} from "../chunk-VZKXBFUA.js";
|
|
43
|
+
import "../chunk-KOPUTJQC.js";
|
|
44
|
+
import {
|
|
45
|
+
getMachineId
|
|
46
|
+
} from "../chunk-2HYPZLYY.js";
|
|
39
47
|
import {
|
|
40
48
|
claudeJson,
|
|
41
49
|
claudeSettings,
|
|
@@ -55,15 +63,7 @@ import {
|
|
|
55
63
|
readCodexMcpAuth,
|
|
56
64
|
untrustedCodexHookEvents,
|
|
57
65
|
vscodePluginDir
|
|
58
|
-
} from "../chunk-
|
|
59
|
-
import {
|
|
60
|
-
readLedgerSummary
|
|
61
|
-
} from "../chunk-VZKXBFUA.js";
|
|
62
|
-
import "../chunk-GIRT7677.js";
|
|
63
|
-
import "../chunk-LGXTBUT4.js";
|
|
64
|
-
import {
|
|
65
|
-
getMachineId
|
|
66
|
-
} from "../chunk-RN3NOEJF.js";
|
|
66
|
+
} from "../chunk-V37ZXMH3.js";
|
|
67
67
|
import {
|
|
68
68
|
describeReach,
|
|
69
69
|
describeRoundTrip,
|
|
@@ -82,19 +82,18 @@ import {
|
|
|
82
82
|
import {
|
|
83
83
|
keyPrefix,
|
|
84
84
|
readKeySource
|
|
85
|
-
} from "../chunk-
|
|
85
|
+
} from "../chunk-W6NPWHBJ.js";
|
|
86
86
|
import {
|
|
87
87
|
parseFlags
|
|
88
88
|
} from "../chunk-GMXKITVA.js";
|
|
89
89
|
import {
|
|
90
90
|
exitOnHelpFlag
|
|
91
|
-
} from "../chunk-
|
|
92
|
-
import "../chunk-
|
|
91
|
+
} from "../chunk-KJ57OPCC.js";
|
|
92
|
+
import "../chunk-GPNOHKFO.js";
|
|
93
93
|
import "../chunk-BC3VCZ3E.js";
|
|
94
94
|
import {
|
|
95
95
|
getPackageVersion
|
|
96
96
|
} from "../chunk-DINDL2CF.js";
|
|
97
|
-
import "../chunk-6MTNS63X.js";
|
|
98
97
|
import {
|
|
99
98
|
callMcpTool,
|
|
100
99
|
sendMcpRequest
|
|
@@ -107,18 +106,20 @@ import {
|
|
|
107
106
|
import {
|
|
108
107
|
EXIT
|
|
109
108
|
} from "../chunk-KZERVKTD.js";
|
|
109
|
+
import "../chunk-6MTNS63X.js";
|
|
110
110
|
import {
|
|
111
111
|
getBaseUrl
|
|
112
112
|
} from "../chunk-2UMNXADU.js";
|
|
113
113
|
import {
|
|
114
|
-
CURSOR_GATE_EVENTS
|
|
114
|
+
CURSOR_GATE_EVENTS,
|
|
115
|
+
HOOK_LOCATOR_BINARY
|
|
115
116
|
} from "../chunk-L4C2JXJS.js";
|
|
116
117
|
|
|
117
118
|
// bin/pushary-doctor.ts
|
|
118
119
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
119
120
|
import { join } from "path";
|
|
120
121
|
import { homedir as homedir2 } from "os";
|
|
121
|
-
import {
|
|
122
|
+
import { execFileSync } from "child_process";
|
|
122
123
|
import { confirm } from "@inquirer/prompts";
|
|
123
124
|
import { parse as parseTOML } from "smol-toml";
|
|
124
125
|
|
|
@@ -175,6 +176,17 @@ var resolveDoctorExit = ({ keyExit, failures }) => {
|
|
|
175
176
|
return EXIT.PROBLEMS_FOUND;
|
|
176
177
|
};
|
|
177
178
|
|
|
179
|
+
// src/setup/agent-exec.ts
|
|
180
|
+
var firstToken = (command) => {
|
|
181
|
+
const trimmed = command.trim();
|
|
182
|
+
const quote = trimmed[0];
|
|
183
|
+
if (quote === '"' || quote === "'") {
|
|
184
|
+
const close = trimmed.indexOf(quote, 1);
|
|
185
|
+
if (close > 0) return trimmed.slice(1, close);
|
|
186
|
+
}
|
|
187
|
+
return trimmed.split(/\s+/)[0] ?? "";
|
|
188
|
+
};
|
|
189
|
+
|
|
178
190
|
// bin/pushary-doctor.ts
|
|
179
191
|
exitOnHelpFlag("doctor");
|
|
180
192
|
var parseDoctorOptions = (argv) => {
|
|
@@ -219,10 +231,12 @@ var readJson = (path) => {
|
|
|
219
231
|
}
|
|
220
232
|
};
|
|
221
233
|
var commandResolves = (command) => {
|
|
222
|
-
|
|
234
|
+
const target = pusharyHookExecutable(command) ?? firstToken(command);
|
|
235
|
+
if (!target) return false;
|
|
236
|
+
if (target.includes("/") || target.includes("\\")) return existsSync(target);
|
|
223
237
|
try {
|
|
224
238
|
const whichCmd = process.platform === "win32" ? "where" : "which";
|
|
225
|
-
|
|
239
|
+
execFileSync(whichCmd, [target], { stdio: "ignore", timeout: 5e3 });
|
|
226
240
|
return true;
|
|
227
241
|
} catch {
|
|
228
242
|
return false;
|
|
@@ -240,6 +254,7 @@ var extractHookCommand = (entries, needle) => {
|
|
|
240
254
|
}
|
|
241
255
|
return null;
|
|
242
256
|
};
|
|
257
|
+
var extractAgentHookCommand = (entries, needle) => extractHookCommand(entries, needle) ?? extractHookCommand(entries, HOOK_LOCATOR_BINARY);
|
|
243
258
|
var extractHookTimeout = (entries, needle) => {
|
|
244
259
|
if (!Array.isArray(entries)) return null;
|
|
245
260
|
for (const entry of entries) {
|
|
@@ -342,7 +357,7 @@ var main = async () => {
|
|
|
342
357
|
const daemon = readDaemonStatus();
|
|
343
358
|
const daemonOk = daemon.kind === "running";
|
|
344
359
|
const daemonFailure = daemonOk ? null : `local state is ${daemon.kind}`;
|
|
345
|
-
const daemonDetail = daemonFailure ? `${daemonFailure}; run \`pushary daemon\`
|
|
360
|
+
const daemonDetail = daemonFailure ? `${daemonFailure}; run \`pushary daemon install\` to install or repair the background service` : null;
|
|
346
361
|
check(
|
|
347
362
|
daemonOk,
|
|
348
363
|
"Remote-control daemon",
|
|
@@ -395,10 +410,11 @@ var main = async () => {
|
|
|
395
410
|
{ event: "PermissionDenied", needle: "pushary-permission-denied-hook", label: "PermissionDenied hook" }
|
|
396
411
|
];
|
|
397
412
|
for (const { event, needle, label } of CLAUDE_HOOK_CHECKS) {
|
|
398
|
-
const
|
|
413
|
+
const configured = JSON.stringify(hooks?.[event] ?? []);
|
|
414
|
+
const present = configured.includes(needle) || configured.includes(HOOK_LOCATOR_BINARY);
|
|
399
415
|
check(present, `Claude Code: ${label}`, present ? void 0 : "missing \u2014 run npx @pushary/agent-hooks@latest upgrade");
|
|
400
416
|
}
|
|
401
|
-
const preHookCommand =
|
|
417
|
+
const preHookCommand = extractAgentHookCommand(hooks?.PreToolUse, "pushary-hook");
|
|
402
418
|
if (preHookCommand) {
|
|
403
419
|
const resolves = commandResolves(preHookCommand);
|
|
404
420
|
check(resolves, "Claude Code: hook command resolves", resolves ? preHookCommand : `not on PATH \u2014 ${preHookCommand}`);
|
|
@@ -464,7 +480,7 @@ var main = async () => {
|
|
|
464
480
|
if (hooksInstalled) {
|
|
465
481
|
const missingEvents = missingCodexHookEvents(codexHooksConfig);
|
|
466
482
|
check(missingEvents.length === 0, "Codex: native hooks installed", missingEvents.length === 0 ? "all 6 events" : `missing ${missingEvents.join(", ")}, re-run setup`);
|
|
467
|
-
const hookCommand =
|
|
483
|
+
const hookCommand = extractAgentHookCommand(codexHooksConfig.hooks?.PreToolUse, "pushary-codex-hook") ?? extractAgentHookCommand(codexHooksConfig.hooks?.PermissionRequest, "pushary-codex-hook");
|
|
468
484
|
if (hookCommand) {
|
|
469
485
|
const resolves = commandResolves(hookCommand);
|
|
470
486
|
check(resolves, "Codex: hook command resolves", resolves ? hookCommand : `not on PATH: ${hookCommand}`);
|
|
@@ -525,12 +541,12 @@ var main = async () => {
|
|
|
525
541
|
const missingEvents = missingGeminiHookEvents(geminiSettings2);
|
|
526
542
|
check(missingEvents.length === 0, "Gemini CLI: native hooks installed", missingEvents.length === 0 ? "all 5 events" : `missing ${missingEvents.join(", ")}, re-run setup`);
|
|
527
543
|
const geminiHooks = geminiSettings2.hooks;
|
|
528
|
-
const hookCommand =
|
|
544
|
+
const hookCommand = extractAgentHookCommand(geminiHooks?.BeforeTool, GEMINI_HOOK_BINARY) ?? extractAgentHookCommand(geminiHooks?.AfterTool, GEMINI_HOOK_BINARY) ?? extractAgentHookCommand(geminiHooks?.SessionStart, GEMINI_HOOK_BINARY);
|
|
529
545
|
if (hookCommand) {
|
|
530
546
|
const resolves = commandResolves(hookCommand);
|
|
531
547
|
check(resolves, "Gemini CLI: hook command resolves", resolves ? hookCommand : `not on PATH: ${hookCommand}`);
|
|
532
548
|
}
|
|
533
|
-
const geminiTimeout = extractHookTimeout(geminiHooks?.BeforeTool, GEMINI_HOOK_BINARY);
|
|
549
|
+
const geminiTimeout = extractHookTimeout(geminiHooks?.BeforeTool, GEMINI_HOOK_BINARY) ?? extractHookTimeout(geminiHooks?.BeforeTool, HOOK_LOCATOR_BINARY);
|
|
534
550
|
if (typeof geminiTimeout === "number") {
|
|
535
551
|
const ok = geminiTimeout >= 3e4;
|
|
536
552
|
check(ok, "Gemini CLI: hook timeout", ok ? `${geminiTimeout}ms` : `${geminiTimeout}ms too short (Gemini timeouts are milliseconds) \u2014 re-run setup`);
|
|
@@ -11,14 +11,16 @@ import {
|
|
|
11
11
|
cancelQuestion,
|
|
12
12
|
pollForAnswer,
|
|
13
13
|
savePendingQuestion
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-GKAKAOKC.js";
|
|
15
15
|
import {
|
|
16
16
|
getMachineId
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-2HYPZLYY.js";
|
|
18
|
+
import "../chunk-V37ZXMH3.js";
|
|
18
19
|
import "../chunk-BSZYIAZL.js";
|
|
19
20
|
import "../chunk-SAF6HGAA.js";
|
|
20
21
|
import "../chunk-7QLSKOSU.js";
|
|
21
22
|
import "../chunk-KZERVKTD.js";
|
|
23
|
+
import "../chunk-6MTNS63X.js";
|
|
22
24
|
import {
|
|
23
25
|
getApiKey
|
|
24
26
|
} from "../chunk-2UMNXADU.js";
|
|
@@ -10,18 +10,17 @@ import "../chunk-PMHTCDEO.js";
|
|
|
10
10
|
import {
|
|
11
11
|
startProcessOwnership,
|
|
12
12
|
withSpawnProcessOwnership
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-4ZHQNBDP.js";
|
|
14
14
|
import {
|
|
15
15
|
spawnClaude
|
|
16
16
|
} from "../chunk-XHKBHWLX.js";
|
|
17
17
|
import {
|
|
18
18
|
resolveBinary
|
|
19
19
|
} from "../chunk-PZA7G4CN.js";
|
|
20
|
-
import "../chunk-VKVHY5HD.js";
|
|
21
|
-
import "../chunk-GIRT7677.js";
|
|
22
20
|
import {
|
|
23
21
|
getMachineId
|
|
24
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-2HYPZLYY.js";
|
|
23
|
+
import "../chunk-V37ZXMH3.js";
|
|
25
24
|
import "../chunk-6MTNS63X.js";
|
|
26
25
|
import {
|
|
27
26
|
getApiKey,
|
|
@@ -216,7 +215,11 @@ var runGeminiBridge = async (options) => {
|
|
|
216
215
|
await liveSessionSleep(options.pollIntervalMs ?? 2e3, options.signal);
|
|
217
216
|
continue;
|
|
218
217
|
}
|
|
219
|
-
const response = await postLiveSession(options, "/api/agent/command/drain", {
|
|
218
|
+
const response = await postLiveSession(options, "/api/agent/command/drain", {
|
|
219
|
+
sessionId,
|
|
220
|
+
machineId: options.machineId,
|
|
221
|
+
ackMode: true
|
|
222
|
+
});
|
|
220
223
|
if (response.ok) {
|
|
221
224
|
const command = object((await response.json()).command);
|
|
222
225
|
const commandId = string(command?.id);
|
|
@@ -225,10 +228,17 @@ var runGeminiBridge = async (options) => {
|
|
|
225
228
|
try {
|
|
226
229
|
const outcome2 = await turn(text, commandId);
|
|
227
230
|
if (outcome2 === "aborted") break;
|
|
228
|
-
pendingAck = {
|
|
231
|
+
pendingAck = {
|
|
232
|
+
commandId,
|
|
233
|
+
sessionId,
|
|
234
|
+
machineId: options.machineId,
|
|
235
|
+
state: "delivered"
|
|
236
|
+
};
|
|
229
237
|
} catch (error) {
|
|
230
238
|
pendingAck = {
|
|
231
239
|
commandId,
|
|
240
|
+
sessionId,
|
|
241
|
+
machineId: options.machineId,
|
|
232
242
|
state: "failed",
|
|
233
243
|
failureCode: "gemini_rejected",
|
|
234
244
|
failureMessage: (error instanceof Error ? error.message : String(error)).slice(0, 240)
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
readLastUserPrompt,
|
|
22
22
|
repoKeyFor,
|
|
23
23
|
reportEvent
|
|
24
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-NFI2K2ZQ.js";
|
|
25
25
|
import {
|
|
26
26
|
DEFAULT_SESSION,
|
|
27
27
|
askUser,
|
|
@@ -29,22 +29,24 @@ import {
|
|
|
29
29
|
savePendingQuestion,
|
|
30
30
|
sendNotification,
|
|
31
31
|
waitForAnswer
|
|
32
|
-
} from "../chunk-
|
|
32
|
+
} from "../chunk-GKAKAOKC.js";
|
|
33
33
|
import {
|
|
34
34
|
deriveActionBody,
|
|
35
35
|
deriveBlocker,
|
|
36
36
|
deriveToolTarget,
|
|
37
37
|
describeToolCall,
|
|
38
38
|
scopePathFor
|
|
39
|
-
} from "../chunk-
|
|
39
|
+
} from "../chunk-KOPUTJQC.js";
|
|
40
40
|
import {
|
|
41
41
|
getMachineId
|
|
42
|
-
} from "../chunk-
|
|
42
|
+
} from "../chunk-2HYPZLYY.js";
|
|
43
|
+
import "../chunk-V37ZXMH3.js";
|
|
43
44
|
import "../chunk-BSZYIAZL.js";
|
|
44
45
|
import "../chunk-SAF6HGAA.js";
|
|
45
46
|
import "../chunk-OFRNZWC4.js";
|
|
46
47
|
import "../chunk-7QLSKOSU.js";
|
|
47
48
|
import "../chunk-KZERVKTD.js";
|
|
49
|
+
import "../chunk-6MTNS63X.js";
|
|
48
50
|
import {
|
|
49
51
|
getApiKey
|
|
50
52
|
} from "../chunk-2UMNXADU.js";
|
package/dist/bin/pushary-hook.js
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
handlePreToolUse
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-MZBT2LXW.js";
|
|
5
5
|
import "../chunk-ATBKJNWS.js";
|
|
6
6
|
import "../chunk-VZKXBFUA.js";
|
|
7
7
|
import {
|
|
8
8
|
readHookInput
|
|
9
9
|
} from "../chunk-6CUUA7HO.js";
|
|
10
10
|
import "../chunk-YHG74UFF.js";
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-NFI2K2ZQ.js";
|
|
12
|
+
import "../chunk-GKAKAOKC.js";
|
|
13
|
+
import "../chunk-KOPUTJQC.js";
|
|
14
|
+
import "../chunk-2HYPZLYY.js";
|
|
15
|
+
import "../chunk-V37ZXMH3.js";
|
|
15
16
|
import {
|
|
16
17
|
exitOnHelpFlag
|
|
17
|
-
} from "../chunk-
|
|
18
|
-
import "../chunk-
|
|
18
|
+
} from "../chunk-KJ57OPCC.js";
|
|
19
|
+
import "../chunk-GPNOHKFO.js";
|
|
19
20
|
import "../chunk-DINDL2CF.js";
|
|
20
21
|
import "../chunk-BSZYIAZL.js";
|
|
21
22
|
import "../chunk-SAF6HGAA.js";
|
|
22
23
|
import "../chunk-OFRNZWC4.js";
|
|
23
24
|
import "../chunk-7QLSKOSU.js";
|
|
24
25
|
import "../chunk-KZERVKTD.js";
|
|
26
|
+
import "../chunk-6MTNS63X.js";
|
|
25
27
|
import "../chunk-2UMNXADU.js";
|
|
26
28
|
import "../chunk-L4C2JXJS.js";
|
|
27
29
|
|
|
@@ -13,19 +13,18 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
readKeySource,
|
|
15
15
|
writeKey
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-W6NPWHBJ.js";
|
|
17
17
|
import {
|
|
18
18
|
parseFlags
|
|
19
19
|
} from "../chunk-GMXKITVA.js";
|
|
20
20
|
import {
|
|
21
21
|
exitOnHelpFlag
|
|
22
|
-
} from "../chunk-
|
|
23
|
-
import "../chunk-
|
|
22
|
+
} from "../chunk-KJ57OPCC.js";
|
|
23
|
+
import "../chunk-GPNOHKFO.js";
|
|
24
24
|
import "../chunk-BC3VCZ3E.js";
|
|
25
25
|
import {
|
|
26
26
|
getPackageVersion
|
|
27
27
|
} from "../chunk-DINDL2CF.js";
|
|
28
|
-
import "../chunk-6MTNS63X.js";
|
|
29
28
|
import "../chunk-SAF6HGAA.js";
|
|
30
29
|
import "../chunk-OFRNZWC4.js";
|
|
31
30
|
import {
|
|
@@ -34,6 +33,7 @@ import {
|
|
|
34
33
|
import {
|
|
35
34
|
EXIT
|
|
36
35
|
} from "../chunk-KZERVKTD.js";
|
|
36
|
+
import "../chunk-6MTNS63X.js";
|
|
37
37
|
import "../chunk-2UMNXADU.js";
|
|
38
38
|
import {
|
|
39
39
|
isValidApiKey
|
|
@@ -4,25 +4,23 @@ import {
|
|
|
4
4
|
codexConfigToml,
|
|
5
5
|
cursorUserMcp,
|
|
6
6
|
geminiSettings
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-GIRT7677.js";
|
|
7
|
+
} from "../chunk-V37ZXMH3.js";
|
|
9
8
|
import {
|
|
10
9
|
createIo
|
|
11
10
|
} from "../chunk-5RUIFDTP.js";
|
|
12
11
|
import {
|
|
13
12
|
clearKey,
|
|
14
13
|
readKeySource
|
|
15
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-W6NPWHBJ.js";
|
|
16
15
|
import {
|
|
17
16
|
parseFlags
|
|
18
17
|
} from "../chunk-GMXKITVA.js";
|
|
19
18
|
import {
|
|
20
19
|
exitOnHelpFlag
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
20
|
+
} from "../chunk-KJ57OPCC.js";
|
|
21
|
+
import "../chunk-GPNOHKFO.js";
|
|
23
22
|
import "../chunk-BC3VCZ3E.js";
|
|
24
23
|
import "../chunk-DINDL2CF.js";
|
|
25
|
-
import "../chunk-6MTNS63X.js";
|
|
26
24
|
import "../chunk-OFRNZWC4.js";
|
|
27
25
|
import {
|
|
28
26
|
UsageError
|
|
@@ -30,6 +28,7 @@ import {
|
|
|
30
28
|
import {
|
|
31
29
|
EXIT
|
|
32
30
|
} from "../chunk-KZERVKTD.js";
|
|
31
|
+
import "../chunk-6MTNS63X.js";
|
|
33
32
|
import {
|
|
34
33
|
getBaseUrl
|
|
35
34
|
} from "../chunk-2UMNXADU.js";
|
package/dist/bin/pushary-mode.js
CHANGED
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
} from "../chunk-GMXKITVA.js";
|
|
12
12
|
import {
|
|
13
13
|
exitOnHelpFlag
|
|
14
|
-
} from "../chunk-
|
|
15
|
-
import "../chunk-
|
|
14
|
+
} from "../chunk-KJ57OPCC.js";
|
|
15
|
+
import "../chunk-GPNOHKFO.js";
|
|
16
16
|
import "../chunk-DINDL2CF.js";
|
|
17
17
|
import "../chunk-SAF6HGAA.js";
|
|
18
18
|
import {
|