@pushary/agent-hooks 1.9.6 → 1.9.8
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 +19 -0
- package/README.md +3 -3
- package/data/cursor-plugin/README.md +3 -7
- package/data/vscode-plugin/README.md +1 -1
- package/dist/bin/pushary-bell-hook.js +22 -23
- package/dist/bin/pushary-bell.js +9 -9
- package/dist/bin/pushary-claude.js +27 -28
- package/dist/bin/pushary-clean.js +98 -76
- package/dist/bin/pushary-codex-bridge.js +18 -18
- package/dist/bin/pushary-codex-hook.js +32 -33
- package/dist/bin/pushary-codex.js +13 -13
- package/dist/bin/pushary-connect.js +24 -21
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +51 -38
- package/dist/bin/pushary-disconnect.js +187 -52
- package/dist/bin/pushary-doctor.js +68 -56
- package/dist/bin/pushary-elicitation-hook.js +24 -25
- package/dist/bin/pushary-gemini-bridge.js +13 -13
- package/dist/bin/pushary-gemini-hook.js +29 -30
- package/dist/bin/pushary-hook.js +30 -32
- package/dist/bin/pushary-login.js +12 -12
- package/dist/bin/pushary-logout.js +105 -42
- package/dist/bin/pushary-mcp.js +9 -9
- package/dist/bin/pushary-mode.js +28 -31
- package/dist/bin/pushary-notification-hook.js +26 -28
- package/dist/bin/pushary-opencode-hook.js +28 -29
- package/dist/bin/pushary-permission-denied-hook.js +30 -32
- package/dist/bin/pushary-permission-hook.js +29 -31
- package/dist/bin/pushary-post-hook.js +26 -28
- package/dist/bin/pushary-prompt-hook.js +26 -28
- package/dist/bin/pushary-session-end-hook.js +26 -28
- package/dist/bin/pushary-session-start-hook.js +31 -31
- package/dist/bin/pushary-setup.js +98 -106
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +34 -18
- package/dist/bin/pushary-stop-hook.js +26 -28
- package/dist/bin/pushary-stopfailure-hook.js +26 -28
- package/dist/bin/pushary-suggestions.js +19 -21
- package/dist/bin/pushary-transcript-register.js +18 -19
- package/dist/bin/pushary-transcripts.js +7 -7
- package/dist/bin/pushary-upgrade.js +67 -31
- package/dist/bin/pushary-wait.js +23 -19
- package/dist/bin/pushary.js +15 -14
- package/dist/{chunk-BSZ7VBVT.js → chunk-2A53H4S6.js} +17 -15
- package/dist/{chunk-D7SOOVHX.js → chunk-2QGYMY7A.js} +83 -3
- package/dist/{chunk-SVTHEMM3.js → chunk-2QTO5YIT.js} +6 -6
- package/dist/{chunk-WN6WYUCV.js → chunk-2VZAALEJ.js} +5 -9
- package/dist/chunk-2WXF3QJR.js +49 -0
- package/dist/{chunk-UKNKYTTY.js → chunk-3I6IVOZV.js} +3 -3
- package/dist/chunk-3Z3A37WD.js +77 -0
- package/dist/{chunk-2QRE6QH2.js → chunk-5QUPKDI5.js} +1 -1
- package/dist/chunk-6TE27XZR.js +69 -0
- package/dist/{chunk-L6USMDTW.js → chunk-7DVNSQWF.js} +59 -15
- package/dist/{chunk-SNJ3BOCP.js → chunk-7PT35RY2.js} +27 -8
- package/dist/{chunk-CBVDW2N6.js → chunk-B64KHETR.js} +3 -3
- package/dist/chunk-BEJRK4DF.js +94 -0
- package/dist/chunk-BXET3ALR.js +46 -0
- package/dist/{chunk-DJ4BB264.js → chunk-CD47ZFFZ.js} +1 -1
- package/dist/{chunk-FBD3QGVJ.js → chunk-CKV3UPMU.js} +2 -2
- package/dist/{chunk-7JTVYR5B.js → chunk-CLOSJ4ES.js} +1 -1
- package/dist/{chunk-DA4FTGTK.js → chunk-DKMD6AWR.js} +4 -4
- package/dist/{chunk-SPXBXN23.js → chunk-DL7XWKYV.js} +7 -5
- package/dist/{chunk-VRT3EEZN.js → chunk-DPGSLWOS.js} +8 -8
- package/dist/{chunk-3BUAEQCY.js → chunk-DUZVXBBU.js} +1 -1
- package/dist/{chunk-6GERGJHF.js → chunk-EUW7JL2K.js} +0 -32
- package/dist/{chunk-75CA37FZ.js → chunk-FQ2GORVG.js} +2 -2
- package/dist/{chunk-WUKUXICK.js → chunk-HRULIYDU.js} +2 -2
- package/dist/{chunk-Q4E56K4X.js → chunk-I5IJRMNV.js} +78 -8
- package/dist/{chunk-MKJ3RTUS.js → chunk-I6MJXLMY.js} +2 -2
- package/dist/{chunk-YPXUD6DW.js → chunk-IAD2RT4L.js} +14 -14
- package/dist/{chunk-LBLCFD5K.js → chunk-IHFDPV7C.js} +2 -2
- package/dist/{chunk-BVCHY4OY.js → chunk-IHO3YQAN.js} +2 -2
- package/dist/{chunk-RDK7FX5F.js → chunk-KF3UZLYI.js} +1 -1
- package/dist/chunk-KFF7G225.js +599 -0
- package/dist/{chunk-TE5M6GGK.js → chunk-KHNFLYJO.js} +204 -28
- package/dist/{chunk-CCDVL63C.js → chunk-KRCR2CRQ.js} +9 -9
- package/dist/{chunk-ZC3TF4LR.js → chunk-LKLVTG3V.js} +18 -9
- package/dist/{chunk-4QKM44N6.js → chunk-LWOO567I.js} +4 -3
- package/dist/{chunk-KK54WQ74.js → chunk-M6BZZFVQ.js} +1 -1
- package/dist/{chunk-RIC6OOJX.js → chunk-MFF3ONG5.js} +21 -1
- package/dist/{chunk-IMGJYFCX.js → chunk-MGRFDGWU.js} +3 -2
- package/dist/{chunk-ZPW4MJOV.js → chunk-MKTJEXZ3.js} +3 -3
- package/dist/{chunk-2I23NFVT.js → chunk-MXHTGVFZ.js} +52 -9
- package/dist/{chunk-5BHROGRB.js → chunk-N4QSPI3B.js} +54 -5
- package/dist/{chunk-DGQTJDSJ.js → chunk-NWDG3MSW.js} +1 -1
- package/dist/chunk-OP7IHC2I.js +24 -0
- package/dist/{chunk-EVFY3VE6.js → chunk-QOLITCIP.js} +1 -1
- package/dist/{chunk-W4Q7NFXU.js → chunk-TCQ43LSG.js} +3 -3
- package/dist/chunk-TCWKTUAE.js +50 -0
- package/dist/{chunk-EZAFBC2C.js → chunk-V5HPPF3E.js} +8 -4
- package/dist/{chunk-Q23MMVTD.js → chunk-WG3K4TCH.js} +1 -1
- package/dist/{chunk-F56SB65Y.js → chunk-WS4H76EP.js} +2 -2
- package/dist/{chunk-HWQNQVY6.js → chunk-WWOHTTVP.js} +2 -2
- package/dist/{chunk-NVGDMTX3.js → chunk-YIG2R3BJ.js} +9 -7
- package/dist/{chunk-HJXZJF6O.js → chunk-ZBHUHJG6.js} +4 -4
- package/dist/{chunk-5AXCOTIT.js → chunk-ZBK6E2OR.js} +1 -1
- package/dist/{chunk-5PMTC2CB.js → chunk-ZN3C6GBG.js} +84 -673
- package/dist/{chunk-GQHZIBAZ.js → chunk-ZSTSEBG7.js} +1 -1
- package/dist/{chunk-PYZC54KA.js → chunk-ZW3XZLJC.js} +61 -17
- package/dist/{global-upgrade-7F5RP45B.js → global-upgrade-I56HNM23.js} +6 -6
- package/dist/{paths-MELXIVBO.js → paths-AGY43CXS.js} +2 -2
- package/dist/reapply-IA5XUKWW.js +57 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +19 -20
- package/dist/{upgrade-lock-AHRBA66K.js → upgrade-lock-B34TAUKV.js} +5 -3
- package/package.json +1 -1
- package/dist/chunk-HT3WMM6Q.js +0 -44
- package/dist/chunk-IR5FRUPQ.js +0 -197
- package/dist/chunk-JUFKJCZG.js +0 -38
- package/dist/chunk-SJN22ADZ.js +0 -86
- package/dist/reapply-NOB2Q6C4.js +0 -35
package/dist/bin/pushary-wait.js
CHANGED
|
@@ -3,34 +3,37 @@ import {
|
|
|
3
3
|
describeWaitLadder
|
|
4
4
|
} from "../chunk-CVWG2N3Y.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
} from "../chunk-
|
|
6
|
+
exitOnFailedSettingsRequest
|
|
7
|
+
} from "../chunk-BEJRK4DF.js";
|
|
8
|
+
import "../chunk-2WXF3QJR.js";
|
|
8
9
|
import {
|
|
9
10
|
createIo
|
|
10
11
|
} from "../chunk-U4TMAANR.js";
|
|
11
12
|
import {
|
|
12
13
|
exitOnHelpFlag
|
|
13
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-CKV3UPMU.js";
|
|
14
15
|
import {
|
|
15
16
|
rejectUnknownFlags
|
|
16
17
|
} from "../chunk-GMXKITVA.js";
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
18
|
+
import "../chunk-N4QSPI3B.js";
|
|
19
|
+
import "../chunk-LWOO567I.js";
|
|
20
|
+
import "../chunk-TCQ43LSG.js";
|
|
21
|
+
import "../chunk-DUZVXBBU.js";
|
|
20
22
|
import {
|
|
21
23
|
UsageError
|
|
22
24
|
} from "../chunk-7QLSKOSU.js";
|
|
23
25
|
import {
|
|
24
26
|
EXIT
|
|
25
27
|
} from "../chunk-KZERVKTD.js";
|
|
26
|
-
import "../chunk-
|
|
28
|
+
import "../chunk-FQ2GORVG.js";
|
|
29
|
+
import "../chunk-ZBHUHJG6.js";
|
|
27
30
|
import "../chunk-T7E75EKA.js";
|
|
28
31
|
import {
|
|
29
32
|
getApiKey,
|
|
30
33
|
getBaseUrl
|
|
31
|
-
} from "../chunk-
|
|
32
|
-
import "../chunk-
|
|
33
|
-
import "../chunk-
|
|
34
|
+
} from "../chunk-5QUPKDI5.js";
|
|
35
|
+
import "../chunk-7DVNSQWF.js";
|
|
36
|
+
import "../chunk-I5IJRMNV.js";
|
|
34
37
|
|
|
35
38
|
// bin/pushary-wait.ts
|
|
36
39
|
exitOnHelpFlag("wait");
|
|
@@ -56,18 +59,18 @@ var printLadder = (data) => {
|
|
|
56
59
|
console.log(` ${dim("Reset it:")} ${cyan("pushary wait clear")}`);
|
|
57
60
|
console.log(` ${dim("Per-tool rules live in the dashboard under Agent \u2192 Policies.")}`);
|
|
58
61
|
};
|
|
59
|
-
var fetchPolicy = async (
|
|
60
|
-
const res = await fetch(`${baseUrl}/api/mcp/policy`, { headers });
|
|
61
|
-
if (!res.ok) await
|
|
62
|
+
var fetchPolicy = async (settings, headers) => {
|
|
63
|
+
const res = await fetch(`${settings.baseUrl}/api/mcp/policy`, { headers });
|
|
64
|
+
if (!res.ok) await exitOnFailedSettingsRequest(res, settings);
|
|
62
65
|
return res.json();
|
|
63
66
|
};
|
|
64
|
-
var setWindow = async (
|
|
65
|
-
const res = await fetch(`${baseUrl}/api/mcp/policy`, {
|
|
67
|
+
var setWindow = async (settings, headers, seconds) => {
|
|
68
|
+
const res = await fetch(`${settings.baseUrl}/api/mcp/policy`, {
|
|
66
69
|
method: "PATCH",
|
|
67
70
|
headers,
|
|
68
71
|
body: JSON.stringify({ defaultPushFirstSeconds: seconds })
|
|
69
72
|
});
|
|
70
|
-
if (!res.ok) await
|
|
73
|
+
if (!res.ok) await exitOnFailedSettingsRequest(res, settings);
|
|
71
74
|
const data = await res.json();
|
|
72
75
|
return data.defaultPushFirstSeconds;
|
|
73
76
|
};
|
|
@@ -85,6 +88,7 @@ var setWindow = async (baseUrl, headers, seconds) => {
|
|
|
85
88
|
var main = async () => {
|
|
86
89
|
const apiKey = getApiKey();
|
|
87
90
|
const baseUrl = getBaseUrl();
|
|
91
|
+
const settings = { request: "wait", apiKey, baseUrl };
|
|
88
92
|
const headers = {
|
|
89
93
|
"Authorization": `Bearer ${apiKey}`,
|
|
90
94
|
"Content-Type": "application/json"
|
|
@@ -93,11 +97,11 @@ var main = async () => {
|
|
|
93
97
|
const args = rest[0] === "wait" ? rest.slice(1) : rest;
|
|
94
98
|
const arg = args[0];
|
|
95
99
|
if (!arg || arg === "status") {
|
|
96
|
-
printLadder(await fetchPolicy(
|
|
100
|
+
printLadder(await fetchPolicy(settings, headers));
|
|
97
101
|
return;
|
|
98
102
|
}
|
|
99
103
|
if (arg === "clear" || arg === "reset") {
|
|
100
|
-
const value2 = await setWindow(
|
|
104
|
+
const value2 = await setWindow(settings, headers, 20);
|
|
101
105
|
console.log(` ${green("\u2713")} Default push window reset to ${cyan(`${value2}s`)}`);
|
|
102
106
|
return;
|
|
103
107
|
}
|
|
@@ -107,7 +111,7 @@ var main = async () => {
|
|
|
107
111
|
console.log(` ${dim("Usage: pushary wait <seconds> | status | clear")}`);
|
|
108
112
|
process.exit(EXIT.USAGE);
|
|
109
113
|
}
|
|
110
|
-
const value = await setWindow(
|
|
114
|
+
const value = await setWindow(settings, headers, Math.trunc(seconds));
|
|
111
115
|
const ladder = describeWaitLadder({ tool: "*", mode: "push_first", pushFirstSeconds: value, timeoutSeconds: 0, timeoutAction: "escalate" });
|
|
112
116
|
console.log(` ${green("\u2713")} Default push window set to ${cyan(`${value}s`)} ${dim(`(${ladder})`)}`);
|
|
113
117
|
};
|
package/dist/bin/pushary.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
installNetworkDefaults
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-TCQ43LSG.js";
|
|
5
|
+
import "../chunk-DUZVXBBU.js";
|
|
6
6
|
import "../chunk-7QLSKOSU.js";
|
|
7
7
|
import {
|
|
8
8
|
EXIT
|
|
9
9
|
} from "../chunk-KZERVKTD.js";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-ZBHUHJG6.js";
|
|
11
11
|
import "../chunk-T7E75EKA.js";
|
|
12
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-5QUPKDI5.js";
|
|
13
13
|
import {
|
|
14
14
|
COMMANDS,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} from "../chunk-
|
|
15
|
+
renderHelp,
|
|
16
|
+
resolveCommandName
|
|
17
|
+
} from "../chunk-7DVNSQWF.js";
|
|
18
18
|
import {
|
|
19
19
|
getPackageVersion
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-I5IJRMNV.js";
|
|
21
21
|
|
|
22
22
|
// src/cli/runtime.ts
|
|
23
23
|
var supportsRuntime = (version) => {
|
|
@@ -33,8 +33,8 @@ var LOADERS = {
|
|
|
33
33
|
daemon: () => import("./pushary-daemon.js"),
|
|
34
34
|
status: () => import("./pushary-status.js"),
|
|
35
35
|
login: () => import("./pushary-login.js"),
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
"sign-out": () => import("./pushary-logout.js"),
|
|
37
|
+
pair: () => import("./pushary-connect.js"),
|
|
38
38
|
bell: () => import("./pushary-bell.js"),
|
|
39
39
|
doctor: () => import("./pushary-doctor.js"),
|
|
40
40
|
disconnect: () => import("./pushary-disconnect.js"),
|
|
@@ -54,21 +54,22 @@ if (!supportsRuntime(process.versions.node)) {
|
|
|
54
54
|
installNetworkDefaults();
|
|
55
55
|
var argv = process.argv.slice(2);
|
|
56
56
|
var command = argv[0] ?? "";
|
|
57
|
+
var resolved = resolveCommandName(command);
|
|
57
58
|
var wants = (...names) => argv.some((arg) => names.includes(arg));
|
|
58
|
-
if (!command || wants("--help", "-h") &&
|
|
59
|
+
if (!command || wants("--help", "-h") && resolved === null) {
|
|
59
60
|
process.stdout.write(renderHelp(getPackageVersion()));
|
|
60
61
|
process.exit(EXIT.OK);
|
|
61
62
|
}
|
|
62
|
-
if (wants("--version", "-v") &&
|
|
63
|
+
if (wants("--version", "-v") && resolved === null) {
|
|
63
64
|
process.stdout.write(`${getPackageVersion()}
|
|
64
65
|
`);
|
|
65
66
|
process.exit(EXIT.OK);
|
|
66
67
|
}
|
|
67
|
-
if (
|
|
68
|
+
if (resolved === null) {
|
|
68
69
|
process.stderr.write(`Unknown command: ${command}
|
|
69
70
|
`);
|
|
70
71
|
process.stderr.write(`Run \`pushary --help\`. Available: ${COMMANDS.map((c) => c.name).join(", ")}
|
|
71
72
|
`);
|
|
72
73
|
process.exit(EXIT.USAGE);
|
|
73
74
|
}
|
|
74
|
-
await LOADERS[
|
|
75
|
+
await LOADERS[resolved]();
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
activeHookSource,
|
|
3
3
|
activeIdentity
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KHNFLYJO.js";
|
|
5
5
|
import {
|
|
6
6
|
defersToNativeMode,
|
|
7
7
|
reportMachineDenial
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-IHO3YQAN.js";
|
|
9
9
|
import {
|
|
10
10
|
isGatingMoment,
|
|
11
11
|
recordKeylessMoment
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZSTSEBG7.js";
|
|
13
13
|
import {
|
|
14
14
|
announceSubscriptionRequired,
|
|
15
15
|
denyReasonFrom,
|
|
@@ -39,13 +39,11 @@ import {
|
|
|
39
39
|
reportEvent,
|
|
40
40
|
scopePathFor,
|
|
41
41
|
settleQuestionsForToolUse
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-KRCR2CRQ.js";
|
|
43
43
|
import {
|
|
44
44
|
DEFAULT_SESSION
|
|
45
45
|
} from "./chunk-N6IOSZOE.js";
|
|
46
46
|
import {
|
|
47
|
-
DECISION_STOP_REASON,
|
|
48
|
-
UNVERIFIABLE_APPROVAL_REASON,
|
|
49
47
|
askUser,
|
|
50
48
|
cancelQuestion,
|
|
51
49
|
claimBlockedAction,
|
|
@@ -55,24 +53,27 @@ import {
|
|
|
55
53
|
requestGate,
|
|
56
54
|
sendNotification,
|
|
57
55
|
waitForQuestion
|
|
58
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-2VZAALEJ.js";
|
|
59
57
|
import {
|
|
60
58
|
SubscriptionRequiredError
|
|
61
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-MKTJEXZ3.js";
|
|
62
60
|
import {
|
|
63
61
|
getMachineId
|
|
64
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-DUZVXBBU.js";
|
|
65
63
|
import {
|
|
66
64
|
getApiKey,
|
|
67
65
|
getBaseUrl
|
|
68
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-5QUPKDI5.js";
|
|
69
67
|
import {
|
|
70
68
|
NPX_LATEST_COMMAND
|
|
71
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-7DVNSQWF.js";
|
|
72
70
|
import {
|
|
73
71
|
AGENT_QUESTION_STRATEGY,
|
|
72
|
+
DECISION_STOP_REASON,
|
|
74
73
|
GATE_BLOCK_REASON_MAX_LENGTH,
|
|
75
74
|
GATE_WIRE,
|
|
75
|
+
UNVERIFIABLE_APPROVAL_REASON,
|
|
76
|
+
WITHDRAWN_APPROVAL_REASON,
|
|
76
77
|
agentQuestionStrategy,
|
|
77
78
|
agentRulesAllowEveryInput,
|
|
78
79
|
buildDecisionEpisodeFeatures,
|
|
@@ -83,6 +84,7 @@ import {
|
|
|
83
84
|
claudePermissionRulesFromSettings,
|
|
84
85
|
claudePreToolUseOutput,
|
|
85
86
|
claudePromptsBeforeAnEdit,
|
|
87
|
+
claudeStoppedPreToolUseOutput,
|
|
86
88
|
editAsksAtTheAgentsPrompt,
|
|
87
89
|
effectiveWaitSeconds,
|
|
88
90
|
hookHoldWindowMs,
|
|
@@ -96,7 +98,7 @@ import {
|
|
|
96
98
|
parseAgentQuestions,
|
|
97
99
|
resolveGate,
|
|
98
100
|
stoppedOutput
|
|
99
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-I5IJRMNV.js";
|
|
100
102
|
|
|
101
103
|
// src/claude-permission-rules.ts
|
|
102
104
|
import { readFileSync, statSync } from "fs";
|
|
@@ -174,7 +176,7 @@ var allow = (reason) => claudePreToolUseOutput("allow", reason);
|
|
|
174
176
|
var deny = (reason) => claudePreToolUseOutput("deny", reason);
|
|
175
177
|
var allowWithInput = (updatedInput) => claudePreToolUseOutput("allow", void 0, updatedInput);
|
|
176
178
|
var ask = (reason) => claudePreToolUseOutput("ask", reason);
|
|
177
|
-
var halted = (reason) =>
|
|
179
|
+
var halted = (reason) => claudeStoppedPreToolUseOutput(reason);
|
|
178
180
|
var outcomeOfFailedAsk = (error, sessionId, failure) => {
|
|
179
181
|
if (!(error instanceof SubscriptionRequiredError)) return failure;
|
|
180
182
|
announceSubscriptionRequired(error.upgradeUrl, sessionId);
|
|
@@ -218,7 +220,7 @@ var handlePushOnly = async (apiKey, description, projectName, timeoutSeconds, ti
|
|
|
218
220
|
return answer.value === "yes" ? allow() : deny(denyReasonFrom(answer.value, answer.note));
|
|
219
221
|
}
|
|
220
222
|
if (timeoutAction === "wait" || clampCut || deadline < requestedDeadline) {
|
|
221
|
-
return ask(
|
|
223
|
+
return ask(WITHDRAWN_APPROVAL_REASON);
|
|
222
224
|
}
|
|
223
225
|
switch (timeoutAction) {
|
|
224
226
|
case "approve":
|
|
@@ -261,7 +263,7 @@ var handlePushFirst = async (apiKey, description, projectName, pushFirstSeconds,
|
|
|
261
263
|
signals.humanDecision = true;
|
|
262
264
|
return answer.value === "yes" ? allow() : deny(denyReasonFrom(answer.value, answer.note));
|
|
263
265
|
}
|
|
264
|
-
return ask(
|
|
266
|
+
return ask(WITHDRAWN_APPROVAL_REASON);
|
|
265
267
|
};
|
|
266
268
|
var handleNotifyOnly = async (apiKey, description, projectName, sessionId, machineId) => {
|
|
267
269
|
try {
|
|
@@ -2,17 +2,93 @@ import {
|
|
|
2
2
|
CLAUDE_HOOK_EVENTS,
|
|
3
3
|
GEMINI_HOOK_EVENTS,
|
|
4
4
|
hasGeminiHooks
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3I6IVOZV.js";
|
|
6
6
|
import {
|
|
7
7
|
CODEX_HOOK_EVENTS,
|
|
8
8
|
hasCodexHooks,
|
|
9
9
|
holdBudgetOf
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ZBHUHJG6.js";
|
|
11
11
|
import {
|
|
12
12
|
CURSOR_GATE_EVENTS,
|
|
13
13
|
HOOK_LOCATOR_BINARY,
|
|
14
14
|
hookCommandHoldBudget
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-I5IJRMNV.js";
|
|
16
|
+
|
|
17
|
+
// src/diagnostics/bridge.ts
|
|
18
|
+
import { execFileSync } from "child_process";
|
|
19
|
+
import { existsSync, readFileSync } from "fs";
|
|
20
|
+
import { homedir } from "os";
|
|
21
|
+
import { dirname, join } from "path";
|
|
22
|
+
var BRIDGE_BUNDLE_IDENTIFIER = "com.pushary.app";
|
|
23
|
+
var BRIDGE_HELPER_SUFFIX = "/Contents/Helpers/pushary-bridge";
|
|
24
|
+
var BRIDGE_BUNDLE_ROOTS = ["/Applications/Pushary.app", "$HOME/Applications/Pushary.app"];
|
|
25
|
+
var expandHome = (path, home) => path.replaceAll("$HOME", home);
|
|
26
|
+
var parseBridgeStub = (contents, stubPath) => {
|
|
27
|
+
const helperSuffix = contents.match(/^H=(\S+)$/m)?.[1] ?? BRIDGE_HELPER_SUFFIX;
|
|
28
|
+
const cachePath = contents.match(/^C="([^"\n]+)"$/m)?.[1] ?? join(dirname(stubPath), ".bridge-cache");
|
|
29
|
+
const rootsLine = contents.match(/^for P in ((?:"[^"\n]*"\s*)+); do$/m)?.[1];
|
|
30
|
+
const bundleRoots = rootsLine ? [...rootsLine.matchAll(/"([^"]*)"/g)].map((match) => match[1]) : BRIDGE_BUNDLE_ROOTS;
|
|
31
|
+
const bundleIdentifier = contents.match(/kMDItemCFBundleIdentifier == "([^"]+)"/)?.[1] ?? BRIDGE_BUNDLE_IDENTIFIER;
|
|
32
|
+
return { helperSuffix, cachePath, bundleRoots, bundleIdentifier };
|
|
33
|
+
};
|
|
34
|
+
var resolveBridgeStub = (stubPath, probe) => {
|
|
35
|
+
const contents = probe.readFile(stubPath);
|
|
36
|
+
if (contents === null) return { kind: "no-stub", stub: stubPath };
|
|
37
|
+
const shape = parseBridgeStub(contents, stubPath);
|
|
38
|
+
const helperIn = (bundle) => `${bundle}${shape.helperSuffix}`;
|
|
39
|
+
const looked = [];
|
|
40
|
+
for (const root of shape.bundleRoots.map((root2) => expandHome(root2, probe.home))) {
|
|
41
|
+
looked.push(root);
|
|
42
|
+
if (probe.exists(helperIn(root))) return { kind: "bundle", helper: helperIn(root), via: "root" };
|
|
43
|
+
}
|
|
44
|
+
const cached = shape.cachePath ? probe.readFile(shape.cachePath)?.split("\n")[0]?.trim() : void 0;
|
|
45
|
+
if (cached) {
|
|
46
|
+
looked.push(cached);
|
|
47
|
+
if (probe.exists(helperIn(cached))) return { kind: "bundle", helper: helperIn(cached), via: "cache" };
|
|
48
|
+
}
|
|
49
|
+
for (const found of probe.mdfind(shape.bundleIdentifier)) {
|
|
50
|
+
looked.push(found);
|
|
51
|
+
if (probe.exists(helperIn(found))) return { kind: "bundle", helper: helperIn(found), via: "spotlight" };
|
|
52
|
+
}
|
|
53
|
+
return { kind: "missing", stub: stubPath, looked };
|
|
54
|
+
};
|
|
55
|
+
var BRIDGE_GONE_MESSAGE = "the Mac app is gone but its hooks remain; run pushary setup or reinstall the app";
|
|
56
|
+
var describeBridgeResolution = (resolution) => {
|
|
57
|
+
switch (resolution.kind) {
|
|
58
|
+
case "bundle":
|
|
59
|
+
return `${resolution.helper} (${resolution.via === "root" ? "installed" : resolution.via === "cache" ? "cached path" : "found by Spotlight"})`;
|
|
60
|
+
case "missing":
|
|
61
|
+
return BRIDGE_GONE_MESSAGE;
|
|
62
|
+
case "no-stub":
|
|
63
|
+
return `${resolution.stub} is not there; ${BRIDGE_GONE_MESSAGE}`;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var isBridgeLocator = (executable) => executable !== null && executable.split(/[/\\]/).pop() === HOOK_LOCATOR_BINARY;
|
|
67
|
+
var spotlight = (bundleIdentifier) => {
|
|
68
|
+
if (process.platform !== "darwin") return [];
|
|
69
|
+
try {
|
|
70
|
+
return execFileSync("/usr/bin/mdfind", [`kMDItemCFBundleIdentifier == "${bundleIdentifier}"`], {
|
|
71
|
+
encoding: "utf-8",
|
|
72
|
+
timeout: 5e3,
|
|
73
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
74
|
+
}).split("\n").map((line) => line.trim()).filter((line) => line !== "");
|
|
75
|
+
} catch {
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
var readOrNull = (path) => {
|
|
80
|
+
try {
|
|
81
|
+
return readFileSync(path, "utf-8");
|
|
82
|
+
} catch {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
var liveBridgeProbe = () => ({
|
|
87
|
+
exists: existsSync,
|
|
88
|
+
readFile: readOrNull,
|
|
89
|
+
mdfind: spotlight,
|
|
90
|
+
home: homedir()
|
|
91
|
+
});
|
|
16
92
|
|
|
17
93
|
// src/diagnostics/wiring.ts
|
|
18
94
|
var record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
@@ -131,6 +207,10 @@ var describeOtherHolder = (holder) => `another hook also registered on ${holder.
|
|
|
131
207
|
var describeHoldSentence = (agentLabel) => `${agentLabel} waits for every hook on an event, so the terminal cannot move until that one returns, however fast your phone answered.`;
|
|
132
208
|
|
|
133
209
|
export {
|
|
210
|
+
resolveBridgeStub,
|
|
211
|
+
describeBridgeResolution,
|
|
212
|
+
isBridgeLocator,
|
|
213
|
+
liveBridgeProbe,
|
|
134
214
|
pusharyHookExecutable,
|
|
135
215
|
claudeWired,
|
|
136
216
|
codexWired,
|
|
@@ -3,27 +3,27 @@ import {
|
|
|
3
3
|
expectedLaunchCapabilities,
|
|
4
4
|
hasSpawnProvider,
|
|
5
5
|
resolveControlPolicy
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-I6MJXLMY.js";
|
|
7
7
|
import {
|
|
8
8
|
daemonHasRemoteProof,
|
|
9
9
|
daemonServiceManagerAvailable,
|
|
10
10
|
hasDaemonServiceDefinition,
|
|
11
11
|
readDaemonNeedsLogin,
|
|
12
12
|
readDaemonStatus
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-LKLVTG3V.js";
|
|
14
14
|
import {
|
|
15
15
|
readControlMode,
|
|
16
16
|
readKeySource
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-N4QSPI3B.js";
|
|
18
18
|
import {
|
|
19
19
|
getMachineId
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-DUZVXBBU.js";
|
|
21
21
|
import {
|
|
22
22
|
getBaseUrl
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-5QUPKDI5.js";
|
|
24
24
|
import {
|
|
25
25
|
getPackageVersion
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-I5IJRMNV.js";
|
|
27
27
|
|
|
28
28
|
// src/machines.ts
|
|
29
29
|
import { hostname } from "os";
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clientErrorKindOf,
|
|
3
3
|
reportClientError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DKMD6AWR.js";
|
|
5
5
|
import {
|
|
6
6
|
SubscriptionRequiredError,
|
|
7
7
|
callMcpTool
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-MKTJEXZ3.js";
|
|
9
9
|
import {
|
|
10
10
|
installNetworkDefaults
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-TCQ43LSG.js";
|
|
12
12
|
import {
|
|
13
13
|
getBaseUrl
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-5QUPKDI5.js";
|
|
15
15
|
import {
|
|
16
16
|
ASK_AGENT_NAME_MAX,
|
|
17
17
|
ASK_QUESTION_MAX,
|
|
18
18
|
DECISION_LINE_MAX,
|
|
19
19
|
truncateLine
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-I5IJRMNV.js";
|
|
21
21
|
|
|
22
22
|
// src/api.ts
|
|
23
23
|
import { randomUUID } from "crypto";
|
|
@@ -56,11 +56,9 @@ var isBlockedActionClaim = (data) => {
|
|
|
56
56
|
|
|
57
57
|
// src/api.ts
|
|
58
58
|
installNetworkDefaults();
|
|
59
|
-
var DECISION_STOP_REASON = "Approval was cancelled or became unavailable. Retry only after resolving it.";
|
|
60
59
|
var isDecisionStopped = (result) => result.handoffAction === "stop" || ["cancelled", "unavailable", "stopped", "missing"].includes(result.status ?? "");
|
|
61
60
|
var isLocalQuestionHandoff = (result) => result.suppressed === true || result.noDevices === true || result.status === "terminal" || result.status === "notified";
|
|
62
61
|
var STOPPED = { answered: false, handoffAction: "stop" };
|
|
63
|
-
var UNVERIFIABLE_APPROVAL_REASON = "Pushary could not create a verifiable approval. Retry the action.";
|
|
64
62
|
var unavailableQuestionUnlessSubscriptionRequired = (error) => {
|
|
65
63
|
if (error instanceof SubscriptionRequiredError) throw error;
|
|
66
64
|
return { correlationId: "", status: "unavailable" };
|
|
@@ -174,10 +172,8 @@ export {
|
|
|
174
172
|
isPolicyConfig,
|
|
175
173
|
isAskUserResponse,
|
|
176
174
|
isWaitForAnswerResponse,
|
|
177
|
-
DECISION_STOP_REASON,
|
|
178
175
|
isDecisionStopped,
|
|
179
176
|
isLocalQuestionHandoff,
|
|
180
|
-
UNVERIFIABLE_APPROVAL_REASON,
|
|
181
177
|
unavailableQuestionUnlessSubscriptionRequired,
|
|
182
178
|
askUser,
|
|
183
179
|
waitForAnswer,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
findExportedKeyLine,
|
|
3
|
+
keyPrefix,
|
|
4
|
+
readConfigFileKey,
|
|
5
|
+
readMacAppKeyPrefix
|
|
6
|
+
} from "./chunk-N4QSPI3B.js";
|
|
7
|
+
import {
|
|
8
|
+
NPX_LATEST_COMMAND
|
|
9
|
+
} from "./chunk-7DVNSQWF.js";
|
|
10
|
+
|
|
11
|
+
// src/key-signed-out.ts
|
|
12
|
+
var VERDICT_BY_CHECK = {
|
|
13
|
+
ok: "accepted",
|
|
14
|
+
locked: "accepted",
|
|
15
|
+
rejected: "rejected",
|
|
16
|
+
malformed: "unchecked",
|
|
17
|
+
unreachable: "unchecked"
|
|
18
|
+
};
|
|
19
|
+
var activeKeyVerdictOf = (check) => check === null ? "unchecked" : VERDICT_BY_CHECK[check.kind];
|
|
20
|
+
var NOT_SIGNED_OUT = { kind: "none" };
|
|
21
|
+
var isMacAppKey = (key, macAppKeyPrefix) => keyPrefix(key) === macAppKeyPrefix;
|
|
22
|
+
var diagnoseSignedOutKey = (evidence) => {
|
|
23
|
+
const adopted = evidence.macAppKeyPrefix;
|
|
24
|
+
if (evidence.configKey !== null || adopted === null) return NOT_SIGNED_OUT;
|
|
25
|
+
if (evidence.activeKey !== null) {
|
|
26
|
+
if (!isMacAppKey(evidence.activeKey, adopted) || evidence.activeKeyVerdict === "accepted") return NOT_SIGNED_OUT;
|
|
27
|
+
}
|
|
28
|
+
const exported = evidence.exportedKey;
|
|
29
|
+
return { kind: "signed_out_on_mac", deadExport: exported && isMacAppKey(exported.key, adopted) ? exported : null };
|
|
30
|
+
};
|
|
31
|
+
var SIGNED_OUT_ON_MAC_MESSAGE = "This computer used the key the Pushary Mac app signed in with, and it was signed out on this Mac, so it no longer works here.";
|
|
32
|
+
var describeSignedOutKey = (diagnosis) => [
|
|
33
|
+
`Run pushary login, or re-run ${NPX_LATEST_COMMAND} setup, to connect this computer again.`,
|
|
34
|
+
...diagnosis.deadExport ? [`${diagnosis.deadExport.path} line ${diagnosis.deadExport.line} still exports the old key (${keyPrefix(diagnosis.deadExport.key)}). Delete that line, or let login replace it, then open a new terminal.`] : []
|
|
35
|
+
];
|
|
36
|
+
var readSignedOutDiagnosis = (activeKey, activeKeyVerdict) => diagnoseSignedOutKey({
|
|
37
|
+
configKey: readConfigFileKey(),
|
|
38
|
+
macAppKeyPrefix: readMacAppKeyPrefix(),
|
|
39
|
+
activeKey,
|
|
40
|
+
activeKeyVerdict,
|
|
41
|
+
exportedKey: findExportedKeyLine()
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export {
|
|
45
|
+
activeKeyVerdictOf,
|
|
46
|
+
SIGNED_OUT_ON_MAC_MESSAGE,
|
|
47
|
+
describeSignedOutKey,
|
|
48
|
+
readSignedOutDiagnosis
|
|
49
|
+
};
|
|
@@ -5,16 +5,16 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
NOTIFICATION_MATCHED_TYPES,
|
|
7
7
|
POSTTOOLUSE_MIRRORED_TOOLS
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CD47ZFFZ.js";
|
|
9
9
|
import {
|
|
10
10
|
isProtectedByScope,
|
|
11
11
|
registerHookEntry
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZBHUHJG6.js";
|
|
13
13
|
import {
|
|
14
14
|
CLAUDE_PRETOOLUSE_MATCHER,
|
|
15
15
|
HOOK_BUDGETS,
|
|
16
16
|
HOOK_LOCATOR_BINARY
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-I5IJRMNV.js";
|
|
18
18
|
|
|
19
19
|
// src/gemini-config.ts
|
|
20
20
|
var GEMINI_HOOK_BINARY = "pushary-gemini-hook";
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
openCodePluginArgv,
|
|
3
|
+
openCodePluginFile
|
|
4
|
+
} from "./chunk-MFF3ONG5.js";
|
|
5
|
+
import {
|
|
6
|
+
compatibleConfigFile
|
|
7
|
+
} from "./chunk-KHNFLYJO.js";
|
|
8
|
+
import {
|
|
9
|
+
hookOwnerOf,
|
|
10
|
+
hookOwnerOfCommands
|
|
11
|
+
} from "./chunk-YIG2R3BJ.js";
|
|
12
|
+
import {
|
|
13
|
+
liveBridgeProbe,
|
|
14
|
+
resolveBridgeStub
|
|
15
|
+
} from "./chunk-2QGYMY7A.js";
|
|
16
|
+
import {
|
|
17
|
+
claudeSettings,
|
|
18
|
+
codexHooksJson,
|
|
19
|
+
cursorUserHooks,
|
|
20
|
+
geminiSettings,
|
|
21
|
+
pusharyDir,
|
|
22
|
+
vscodePluginDir
|
|
23
|
+
} from "./chunk-ZBHUHJG6.js";
|
|
24
|
+
import {
|
|
25
|
+
readJsonSafe
|
|
26
|
+
} from "./chunk-T7E75EKA.js";
|
|
27
|
+
import {
|
|
28
|
+
HOOK_COMPATIBLE_PROFILES,
|
|
29
|
+
HOOK_LOCATOR_BINARY,
|
|
30
|
+
hookCompatibleProfile
|
|
31
|
+
} from "./chunk-I5IJRMNV.js";
|
|
32
|
+
|
|
33
|
+
// src/setup/agent-hook-owner.ts
|
|
34
|
+
import { readFileSync } from "fs";
|
|
35
|
+
import { join } from "path";
|
|
36
|
+
var COMPATIBLE_HOOK_FILES = Object.fromEntries(
|
|
37
|
+
HOOK_COMPATIBLE_PROFILES.map((profile) => [profile.agentType, () => compatibleConfigFile(profile)])
|
|
38
|
+
);
|
|
39
|
+
var HOOK_FILES = {
|
|
40
|
+
claude_code: claudeSettings,
|
|
41
|
+
codex: codexHooksJson,
|
|
42
|
+
gemini_cli: geminiSettings,
|
|
43
|
+
cursor: cursorUserHooks,
|
|
44
|
+
vscode: () => join(vscodePluginDir(), "hooks", "hooks.json"),
|
|
45
|
+
...COMPATIBLE_HOOK_FILES
|
|
46
|
+
};
|
|
47
|
+
var agentHookFile = (agent) => HOOK_FILES[agent]?.() ?? null;
|
|
48
|
+
var agentHookOwner = (agent, appAvailable) => {
|
|
49
|
+
const file = agentHookFile(agent);
|
|
50
|
+
if (!file) return "none";
|
|
51
|
+
const document = readJsonSafe(file);
|
|
52
|
+
const profile = hookCompatibleProfile(agent);
|
|
53
|
+
return hookOwnerOf(
|
|
54
|
+
document.kind === "ok" ? document.value : null,
|
|
55
|
+
appAvailable,
|
|
56
|
+
profile ? profile.hooksKeyPath : void 0
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
var readTextOrNull = (path) => {
|
|
60
|
+
try {
|
|
61
|
+
return readFileSync(path, "utf-8");
|
|
62
|
+
} catch {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var openCodePluginOwner = (appAvailable, pluginFile = openCodePluginFile()) => {
|
|
67
|
+
const contents = readTextOrNull(pluginFile);
|
|
68
|
+
return hookOwnerOfCommands(contents === null ? [] : openCodePluginArgv(contents) ?? [], appAvailable);
|
|
69
|
+
};
|
|
70
|
+
var macAppBridgeAvailable = () => resolveBridgeStub(join(pusharyDir(), "bin", HOOK_LOCATOR_BINARY), liveBridgeProbe()).kind === "bundle";
|
|
71
|
+
|
|
72
|
+
export {
|
|
73
|
+
agentHookFile,
|
|
74
|
+
agentHookOwner,
|
|
75
|
+
openCodePluginOwner,
|
|
76
|
+
macAppBridgeAvailable
|
|
77
|
+
};
|