@pushary/agent-hooks 1.9.7 → 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 +11 -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 +101 -79
- 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 -39
- package/dist/bin/pushary-disconnect.js +189 -54
- package/dist/bin/pushary-doctor.js +67 -58
- 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 -32
- package/dist/bin/pushary-setup.js +91 -101
- 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 +55 -25
- package/dist/bin/pushary-wait.js +23 -19
- package/dist/bin/pushary.js +15 -14
- package/dist/{chunk-R3YW55MY.js → chunk-2A53H4S6.js} +17 -15
- package/dist/{chunk-4YO4T5FV.js → chunk-2QGYMY7A.js} +83 -3
- package/dist/{chunk-MBK7N46B.js → chunk-2QTO5YIT.js} +6 -6
- package/dist/{chunk-D6S5EKXA.js → chunk-2VZAALEJ.js} +5 -9
- package/dist/chunk-2WXF3QJR.js +49 -0
- package/dist/{chunk-JCWZ23MJ.js → chunk-3I6IVOZV.js} +3 -3
- package/dist/chunk-3Z3A37WD.js +77 -0
- package/dist/{chunk-Z6HPS67T.js → chunk-5QUPKDI5.js} +1 -1
- package/dist/{chunk-JWKBDSPF.js → chunk-6TE27XZR.js} +2 -2
- package/dist/{chunk-STQRUH3S.js → chunk-7DVNSQWF.js} +59 -15
- package/dist/{chunk-QTO6HEZD.js → chunk-7PT35RY2.js} +2 -2
- package/dist/{chunk-7OIWWZAD.js → chunk-B64KHETR.js} +3 -3
- package/dist/chunk-BEJRK4DF.js +94 -0
- package/dist/chunk-BXET3ALR.js +46 -0
- package/dist/{chunk-6DJTDHBI.js → chunk-CD47ZFFZ.js} +1 -1
- package/dist/{chunk-UFVGSEWH.js → chunk-CKV3UPMU.js} +2 -2
- package/dist/{chunk-4FK6RZVJ.js → chunk-CLOSJ4ES.js} +1 -1
- package/dist/{chunk-AVNKVF7N.js → chunk-DKMD6AWR.js} +4 -4
- package/dist/{chunk-SBLPHUEB.js → chunk-DL7XWKYV.js} +7 -5
- package/dist/{chunk-BTQGAXZ3.js → chunk-DPGSLWOS.js} +8 -8
- package/dist/{chunk-KYO45G5L.js → chunk-DUZVXBBU.js} +1 -1
- package/dist/{chunk-EB4XGVBG.js → chunk-EUW7JL2K.js} +0 -32
- package/dist/{chunk-4D2AYNSE.js → chunk-FQ2GORVG.js} +2 -2
- package/dist/{chunk-W2KI5KPD.js → chunk-HRULIYDU.js} +2 -2
- package/dist/{chunk-QR6VE5ME.js → chunk-I5IJRMNV.js} +58 -8
- package/dist/{chunk-T7Y5EADL.js → chunk-I6MJXLMY.js} +2 -2
- package/dist/{chunk-N4EUSDKX.js → chunk-IAD2RT4L.js} +14 -14
- package/dist/{chunk-H37L7TT3.js → chunk-IHFDPV7C.js} +2 -2
- package/dist/{chunk-3GNUXXDZ.js → chunk-IHO3YQAN.js} +2 -2
- package/dist/{chunk-JWQZSYCK.js → chunk-KF3UZLYI.js} +1 -1
- package/dist/chunk-KFF7G225.js +599 -0
- package/dist/{chunk-MZPXVH4A.js → chunk-KHNFLYJO.js} +204 -28
- package/dist/{chunk-QFEM7R6T.js → chunk-KRCR2CRQ.js} +9 -9
- package/dist/{chunk-VXRXFU6Q.js → chunk-LKLVTG3V.js} +14 -7
- package/dist/{chunk-KFKL3FHS.js → chunk-LWOO567I.js} +4 -3
- package/dist/{chunk-HPRZJKRO.js → chunk-M6BZZFVQ.js} +1 -1
- package/dist/{chunk-X5NXPCIC.js → chunk-MFF3ONG5.js} +16 -2
- package/dist/{chunk-H7MMU64M.js → chunk-MGRFDGWU.js} +2 -2
- package/dist/{chunk-L76HTPU6.js → chunk-MKTJEXZ3.js} +3 -3
- package/dist/{chunk-NIBFSARF.js → chunk-MXHTGVFZ.js} +33 -9
- package/dist/{chunk-ADSQDYYG.js → chunk-N4QSPI3B.js} +54 -5
- package/dist/{chunk-AQ55ZSSS.js → chunk-NWDG3MSW.js} +1 -1
- package/dist/chunk-OP7IHC2I.js +24 -0
- package/dist/{chunk-KT5E2RLS.js → chunk-QOLITCIP.js} +1 -1
- package/dist/{chunk-JXISQ7DT.js → chunk-TCQ43LSG.js} +3 -3
- package/dist/chunk-TCWKTUAE.js +50 -0
- package/dist/{chunk-RQGODFQN.js → chunk-V5HPPF3E.js} +1 -1
- package/dist/{chunk-7264S5HZ.js → chunk-WG3K4TCH.js} +1 -1
- package/dist/{chunk-GKI6LFAV.js → chunk-WS4H76EP.js} +2 -2
- package/dist/{chunk-XWAYAO3V.js → chunk-WWOHTTVP.js} +2 -2
- package/dist/{chunk-SD3272LS.js → chunk-YIG2R3BJ.js} +9 -7
- package/dist/{chunk-ZUTU43FT.js → chunk-ZBHUHJG6.js} +4 -4
- package/dist/{chunk-AUUXS44H.js → chunk-ZBK6E2OR.js} +1 -1
- package/dist/{chunk-QQ4HBXZC.js → chunk-ZN3C6GBG.js} +84 -673
- package/dist/{chunk-CBQACHKY.js → chunk-ZSTSEBG7.js} +1 -1
- package/dist/{chunk-3PVDOCFI.js → chunk-ZW3XZLJC.js} +5 -5
- package/dist/{global-upgrade-E2HUEB4B.js → global-upgrade-I56HNM23.js} +6 -6
- package/dist/{paths-QVTEGNZV.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-JCIDZMHF.js → upgrade-lock-B34TAUKV.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-ANEAA37E.js +0 -197
- package/dist/chunk-MNWRUGMH.js +0 -86
- package/dist/chunk-RQSOEB4S.js +0 -44
- package/dist/reapply-5QVKM6LA.js +0 -38
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
DISCONNECT_AGENT_IDS,
|
|
3
|
+
SETUP_AGENT_CHOICES,
|
|
4
|
+
isApprovalMode
|
|
5
|
+
} from "./chunk-I5IJRMNV.js";
|
|
6
|
+
|
|
7
|
+
// src/cli/mode-request.ts
|
|
8
|
+
var parseDuration = (value) => {
|
|
9
|
+
const match = value.match(/^(\d+)(m|h)$/);
|
|
10
|
+
if (!match) return null;
|
|
11
|
+
const amount = Number(match[1]);
|
|
12
|
+
return match[2] === "h" ? amount * 3600 : amount * 60;
|
|
13
|
+
};
|
|
14
|
+
var modeRequestBody = (mode, duration) => {
|
|
15
|
+
if (duration === void 0) return { mode, permanent: true };
|
|
16
|
+
const ttlSeconds = parseDuration(duration);
|
|
17
|
+
return ttlSeconds ? { mode, ttlSeconds } : null;
|
|
18
|
+
};
|
|
19
|
+
var UPDATES_ONLY_MODE_INPUTS = ["updates-only", "updates_only"];
|
|
20
|
+
var UPDATES_ONLY_MODE = "notify_only";
|
|
21
|
+
var MODE_PROSE_NAMES = {
|
|
22
|
+
[UPDATES_ONLY_MODE]: "Updates only"
|
|
23
|
+
};
|
|
24
|
+
var isUpdatesOnlyInput = (value) => UPDATES_ONLY_MODE_INPUTS.includes(value);
|
|
25
|
+
var resolveModeInput = (value) => {
|
|
26
|
+
const name = value.trim().toLowerCase();
|
|
27
|
+
if (isUpdatesOnlyInput(name)) return UPDATES_ONLY_MODE;
|
|
28
|
+
return isApprovalMode(name) ? name : null;
|
|
29
|
+
};
|
|
30
|
+
var describeMode = (mode) => {
|
|
31
|
+
const prose = isApprovalMode(mode) ? MODE_PROSE_NAMES[mode] : void 0;
|
|
32
|
+
return prose === void 0 ? mode : `${prose} (${mode})`;
|
|
33
|
+
};
|
|
4
34
|
|
|
5
35
|
// src/cli/commands.ts
|
|
6
36
|
var NPX_LATEST_COMMAND = "npx pushary@latest";
|
|
@@ -44,14 +74,16 @@ var COMMAND_LIST = [
|
|
|
44
74
|
summary: "Sign in from this terminal, no key to copy (--with-token to pipe one in)"
|
|
45
75
|
},
|
|
46
76
|
{
|
|
47
|
-
name: "
|
|
77
|
+
name: "sign-out",
|
|
48
78
|
module: "pushary-logout",
|
|
49
|
-
|
|
79
|
+
aliases: ["logout"],
|
|
80
|
+
summary: "Sign out: remove the key this machine stores, and say what it does not remove (also: logout)"
|
|
50
81
|
},
|
|
51
82
|
{
|
|
52
|
-
name: "
|
|
83
|
+
name: "pair",
|
|
53
84
|
module: "pushary-connect",
|
|
54
|
-
|
|
85
|
+
aliases: ["connect"],
|
|
86
|
+
summary: "Pair a phone without re-running setup (--app for the Pushary app; also: connect)"
|
|
55
87
|
},
|
|
56
88
|
{
|
|
57
89
|
name: "bell",
|
|
@@ -63,7 +95,7 @@ var COMMAND_LIST = [
|
|
|
63
95
|
]
|
|
64
96
|
},
|
|
65
97
|
{ name: "doctor", module: "pushary-doctor", summary: "Verify your Pushary installation is working" },
|
|
66
|
-
{ name: "disconnect", module: "pushary-disconnect", summary:
|
|
98
|
+
{ name: "disconnect", module: "pushary-disconnect", summary: `Turn off one agent (${DISCONNECT_AGENT_IDS.join("|")})` },
|
|
67
99
|
{ name: "clean", module: "pushary-clean", summary: "Remove Pushary from this machine (--everything: the Mac app's setup too, --dry-run: preview)" },
|
|
68
100
|
{ name: "mode", module: "pushary-mode", summary: "Choose where approval requests appear" },
|
|
69
101
|
{ name: "wait", module: "pushary-wait", summary: 'Show or set the "wait for your phone" ladder (pushary wait 45)' },
|
|
@@ -92,8 +124,14 @@ var COMMAND_LIST = [
|
|
|
92
124
|
}
|
|
93
125
|
];
|
|
94
126
|
var COMMANDS = COMMAND_LIST;
|
|
95
|
-
var
|
|
127
|
+
var answersTo = (command, token) => command.name === token || (command.aliases ?? []).includes(token);
|
|
128
|
+
var findCommand = (token) => COMMANDS.find((command) => answersTo(command, token));
|
|
96
129
|
var isCommandName = (name) => COMMANDS.some((command) => command.name === name);
|
|
130
|
+
var resolveCommandName = (token) => {
|
|
131
|
+
const name = findCommand(token)?.name;
|
|
132
|
+
return name !== void 0 && isCommandName(name) ? name : null;
|
|
133
|
+
};
|
|
134
|
+
var isInvocationOf = (token, name) => resolveCommandName(token) === name;
|
|
97
135
|
var COMMAND_OPTIONS = {
|
|
98
136
|
cowork: [
|
|
99
137
|
["--open", "Also open the setup guide in your browser"],
|
|
@@ -111,7 +149,7 @@ var COMMAND_OPTIONS = {
|
|
|
111
149
|
["trust --rotate", "Accept the keys the server is offering now and resume syncing"]
|
|
112
150
|
],
|
|
113
151
|
mode: [
|
|
114
|
-
["<mode>",
|
|
152
|
+
["<mode>", `One of: push_only, push_first, terminal_only, notify_only (Updates only; also: ${UPDATES_ONLY_MODE_INPUTS.join(", ")})`],
|
|
115
153
|
["status", "Show the current override"],
|
|
116
154
|
["clear", "Drop the override and go back to per-tool policies"],
|
|
117
155
|
["--for <30m|2h>", "Expire the override after this long"]
|
|
@@ -125,7 +163,7 @@ var COMMAND_OPTIONS = {
|
|
|
125
163
|
["--json", "Emit the whole report as one object instead of the screen"],
|
|
126
164
|
["--devices", "Also list the machines registered to this site"]
|
|
127
165
|
],
|
|
128
|
-
|
|
166
|
+
"sign-out": [
|
|
129
167
|
["--revoke", "Also kill the key server-side, so it stops working everywhere"],
|
|
130
168
|
["--json", "Emit the result as one object instead of the screen"]
|
|
131
169
|
],
|
|
@@ -168,10 +206,10 @@ var SETUP_OPTIONS = [
|
|
|
168
206
|
["--connect app", "Pair the native Pushary app, no key to paste (default)"],
|
|
169
207
|
["--connect browser", "Approve in a browser tab instead. For a machine with no app"],
|
|
170
208
|
["--connect web", "Legacy browser subscribe page"],
|
|
171
|
-
["--connect none", "Skip
|
|
209
|
+
["--connect none", "Skip pairing a phone, same as --skip-phone"],
|
|
172
210
|
["--control auto|on|off", "Manage phone-start automatically (default), require it, or disable its background service"],
|
|
173
211
|
["--transcripts on|off", "Enable or disable encrypted transcript sync on this machine"],
|
|
174
|
-
["--skip-phone", "Skip
|
|
212
|
+
["--skip-phone", "Skip pairing a phone"],
|
|
175
213
|
["--take-over-hooks", "Replace hooks the Pushary Mac app owns with the CLI's. Without it the app's wiring is kept"],
|
|
176
214
|
["--verify roundtrip", "Send a real question and wait for you to answer it (default when a human is present)"],
|
|
177
215
|
["--verify push", "Only prove a notification was delivered. Automatic when nobody is at the terminal"],
|
|
@@ -220,8 +258,9 @@ var renderHelp = (version) => {
|
|
|
220
258
|
""
|
|
221
259
|
].join("\n");
|
|
222
260
|
};
|
|
223
|
-
var renderCommandHelp = (
|
|
224
|
-
const spec = findCommand(
|
|
261
|
+
var renderCommandHelp = (token, version) => {
|
|
262
|
+
const spec = findCommand(token);
|
|
263
|
+
const name = spec?.name ?? token;
|
|
225
264
|
const options = name === "setup" ? SETUP_OPTIONS : COMMAND_OPTIONS[name] ?? [];
|
|
226
265
|
const width = options.length > 0 ? Math.max(...options.map(([flag]) => flag.length)) + 2 : 0;
|
|
227
266
|
return [
|
|
@@ -241,9 +280,14 @@ var renderCommandHelp = (name, version) => {
|
|
|
241
280
|
};
|
|
242
281
|
|
|
243
282
|
export {
|
|
283
|
+
modeRequestBody,
|
|
284
|
+
UPDATES_ONLY_MODE_INPUTS,
|
|
285
|
+
resolveModeInput,
|
|
286
|
+
describeMode,
|
|
244
287
|
NPX_LATEST_COMMAND,
|
|
245
288
|
COMMANDS,
|
|
246
|
-
|
|
289
|
+
resolveCommandName,
|
|
290
|
+
isInvocationOf,
|
|
247
291
|
renderHelp,
|
|
248
292
|
renderCommandHelp
|
|
249
293
|
};
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-POFBE6ZY.js";
|
|
4
4
|
import {
|
|
5
5
|
autoUpdateState
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZBHUHJG6.js";
|
|
7
7
|
import {
|
|
8
8
|
readJsonSafe,
|
|
9
9
|
writeJsonAtomic
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
cliPackagePathSegments,
|
|
15
15
|
globalUpgradeEntry,
|
|
16
16
|
ownPackageRoot
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-I5IJRMNV.js";
|
|
18
18
|
|
|
19
19
|
// src/auto-update.ts
|
|
20
20
|
import { spawn } from "child_process";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SETUP_FLAGS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DL7XWKYV.js";
|
|
4
4
|
import {
|
|
5
5
|
parseFlags
|
|
6
6
|
} from "./chunk-GMXKITVA.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-7QLSKOSU.js";
|
|
10
10
|
import {
|
|
11
11
|
NPX_LATEST_COMMAND
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7DVNSQWF.js";
|
|
13
13
|
import {
|
|
14
14
|
CLAUDE_CONNECTOR_GUIDE,
|
|
15
15
|
CLAUDE_CONNECTOR_STEPS,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
CLAUDE_CONNECTOR_URL,
|
|
18
18
|
COWORK_CONNECTOR_LIMIT,
|
|
19
19
|
COWORK_STANDING_INSTRUCTIONS
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-I5IJRMNV.js";
|
|
21
21
|
|
|
22
22
|
// src/cli/cowork.ts
|
|
23
23
|
import { readFileSync } from "fs";
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SIGNED_OUT_ON_MAC_MESSAGE,
|
|
3
|
+
describeSignedOutKey,
|
|
4
|
+
readSignedOutDiagnosis
|
|
5
|
+
} from "./chunk-2WXF3QJR.js";
|
|
6
|
+
import {
|
|
7
|
+
createIo
|
|
8
|
+
} from "./chunk-U4TMAANR.js";
|
|
9
|
+
import {
|
|
10
|
+
readKeySource
|
|
11
|
+
} from "./chunk-N4QSPI3B.js";
|
|
12
|
+
import {
|
|
13
|
+
absoluteUrl,
|
|
14
|
+
checkApiKey,
|
|
15
|
+
describeKeyCheck,
|
|
16
|
+
keyCheckFromResponse
|
|
17
|
+
} from "./chunk-LWOO567I.js";
|
|
18
|
+
import {
|
|
19
|
+
EXIT
|
|
20
|
+
} from "./chunk-KZERVKTD.js";
|
|
21
|
+
import {
|
|
22
|
+
getBaseUrl
|
|
23
|
+
} from "./chunk-5QUPKDI5.js";
|
|
24
|
+
|
|
25
|
+
// src/cli/report-key.ts
|
|
26
|
+
var { dim, yellow } = createIo();
|
|
27
|
+
var printReport = (report) => {
|
|
28
|
+
console.log(` ${yellow("!")} ${report.message}`);
|
|
29
|
+
for (const line of report.next) console.log(` ${dim(line)}`);
|
|
30
|
+
};
|
|
31
|
+
var signedOutKeyReport = (check) => {
|
|
32
|
+
if (check.kind !== "rejected") return null;
|
|
33
|
+
const diagnosis = readSignedOutDiagnosis(readKeySource().key, "rejected");
|
|
34
|
+
if (diagnosis.kind !== "signed_out_on_mac") return null;
|
|
35
|
+
return { message: SIGNED_OUT_ON_MAC_MESSAGE, next: describeSignedOutKey(diagnosis), exitCode: EXIT.UNAUTHENTICATED, fatal: true };
|
|
36
|
+
};
|
|
37
|
+
var printKeyCheck = (check, baseUrl) => {
|
|
38
|
+
const report = signedOutKeyReport(check) ?? describeKeyCheck(check, baseUrl);
|
|
39
|
+
printReport(report);
|
|
40
|
+
return report;
|
|
41
|
+
};
|
|
42
|
+
var exitIfKeyFailure = async (response, baseUrl) => {
|
|
43
|
+
const check = await keyCheckFromResponse(response, baseUrl);
|
|
44
|
+
if (!check) return;
|
|
45
|
+
const report = printKeyCheck(check, baseUrl);
|
|
46
|
+
process.exit(report.exitCode);
|
|
47
|
+
};
|
|
48
|
+
var responseDetail = async (response) => {
|
|
49
|
+
try {
|
|
50
|
+
const body = await response.json();
|
|
51
|
+
const text = [body.error, body.message].find((part) => typeof part === "string" && part);
|
|
52
|
+
if (typeof text === "string") return text;
|
|
53
|
+
} catch {
|
|
54
|
+
}
|
|
55
|
+
return response.statusText || `HTTP ${response.status}`;
|
|
56
|
+
};
|
|
57
|
+
var exitOnFailedResponse = async (response, baseUrl) => {
|
|
58
|
+
await exitIfKeyFailure(response, baseUrl);
|
|
59
|
+
console.log(` ${yellow("!")} Failed: ${await responseDetail(response)}`);
|
|
60
|
+
process.exit(EXIT.FAILED);
|
|
61
|
+
};
|
|
62
|
+
var REFUSED_SETTINGS_ACTION = {
|
|
63
|
+
mode: "change the approval mode",
|
|
64
|
+
wait: "change how long approvals wait for you",
|
|
65
|
+
suggestions: "read or accept rule suggestions"
|
|
66
|
+
};
|
|
67
|
+
var APPROVAL_SETTINGS_PATH = "/dashboard/agent/settings";
|
|
68
|
+
var AGENT_KEY_SCOPE = "agent";
|
|
69
|
+
var isAgentKeyRefusal = (status, check) => status === 401 && check.kind === "ok" && check.identity.keyScope === AGENT_KEY_SCOPE;
|
|
70
|
+
var describeAgentKeyRefusal = (request, baseUrl = getBaseUrl()) => ({
|
|
71
|
+
message: `This computer's key cannot ${REFUSED_SETTINGS_ACTION[request]}. Keys from pushary login, phone pairing and the Mac app run approvals and notifications, not account settings.`,
|
|
72
|
+
next: [
|
|
73
|
+
`Change it from the Pushary app, your phone, or the dashboard: ${absoluteUrl(baseUrl, APPROVAL_SETTINGS_PATH)}`,
|
|
74
|
+
"The key itself is valid. Nothing on this computer needs fixing."
|
|
75
|
+
],
|
|
76
|
+
exitCode: EXIT.USAGE,
|
|
77
|
+
fatal: true
|
|
78
|
+
});
|
|
79
|
+
var exitOnFailedSettingsRequest = async (response, settings) => {
|
|
80
|
+
if (response.status === 401) {
|
|
81
|
+
const check = await checkApiKey(settings.apiKey, { baseUrl: settings.baseUrl });
|
|
82
|
+
if (isAgentKeyRefusal(response.status, check)) {
|
|
83
|
+
const report = describeAgentKeyRefusal(settings.request, settings.baseUrl);
|
|
84
|
+
printReport(report);
|
|
85
|
+
process.exit(report.exitCode);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return exitOnFailedResponse(response, settings.baseUrl);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export {
|
|
92
|
+
printKeyCheck,
|
|
93
|
+
exitOnFailedSettingsRequest
|
|
94
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
pusharyDir
|
|
3
|
+
} from "./chunk-ZBHUHJG6.js";
|
|
4
|
+
import {
|
|
5
|
+
readJsonSafe,
|
|
6
|
+
writeFileAtomic
|
|
7
|
+
} from "./chunk-T7E75EKA.js";
|
|
8
|
+
import {
|
|
9
|
+
DECLINED_AGENTS_FILE,
|
|
10
|
+
HOOK_SOURCES,
|
|
11
|
+
normalizeAgentId,
|
|
12
|
+
parseDeclinedAgents,
|
|
13
|
+
serializeDeclinedAgents,
|
|
14
|
+
withDeclinedAgent,
|
|
15
|
+
withoutDeclinedAgent
|
|
16
|
+
} from "./chunk-I5IJRMNV.js";
|
|
17
|
+
|
|
18
|
+
// src/declined-agents-file.ts
|
|
19
|
+
import { join } from "path";
|
|
20
|
+
var DECLINED_AGENTS_MODE = 384;
|
|
21
|
+
var declinedAgentsFile = () => join(pusharyDir(), DECLINED_AGENTS_FILE);
|
|
22
|
+
var readDeclinedAgents = (file = declinedAgentsFile()) => {
|
|
23
|
+
const stored = readJsonSafe(file);
|
|
24
|
+
return stored.kind === "ok" ? parseDeclinedAgents(stored.value) : [];
|
|
25
|
+
};
|
|
26
|
+
var writeDeclinedAgents = (agents, file) => writeFileAtomic(file, serializeDeclinedAgents(agents), DECLINED_AGENTS_MODE, "utf-8");
|
|
27
|
+
var changeDeclinedAgents = (file, applies, next) => {
|
|
28
|
+
const current = readDeclinedAgents(file);
|
|
29
|
+
if (!applies(current)) return "unchanged";
|
|
30
|
+
try {
|
|
31
|
+
writeDeclinedAgents(next(current), file);
|
|
32
|
+
return "changed";
|
|
33
|
+
} catch {
|
|
34
|
+
return "unwritable";
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var recordDeclinedAgent = (agent, file = declinedAgentsFile()) => changeDeclinedAgents(file, (current) => !current.includes(agent), (current) => withDeclinedAgent(current, agent));
|
|
38
|
+
var clearDeclinedAgent = (agent, file = declinedAgentsFile()) => changeDeclinedAgents(file, (current) => current.includes(agent), (current) => withoutDeclinedAgent(current, agent));
|
|
39
|
+
var declinedAgentForSetupChoice = (choice) => normalizeAgentId(choice, HOOK_SOURCES);
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
declinedAgentsFile,
|
|
43
|
+
recordDeclinedAgent,
|
|
44
|
+
clearDeclinedAgent,
|
|
45
|
+
declinedAgentForSetupChoice
|
|
46
|
+
};
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-KZERVKTD.js";
|
|
4
4
|
import {
|
|
5
5
|
renderCommandHelp
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7DVNSQWF.js";
|
|
7
7
|
import {
|
|
8
8
|
getPackageVersion
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-I5IJRMNV.js";
|
|
10
10
|
|
|
11
11
|
// src/cli/usage.ts
|
|
12
12
|
var exitOnHelpFlag = (command) => {
|
|
@@ -4,18 +4,18 @@ import {
|
|
|
4
4
|
} from "./chunk-POFBE6ZY.js";
|
|
5
5
|
import {
|
|
6
6
|
isNetworkFailure
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-TCQ43LSG.js";
|
|
8
8
|
import {
|
|
9
9
|
clientReportClaims
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ZBHUHJG6.js";
|
|
11
11
|
import {
|
|
12
12
|
getApiKey,
|
|
13
13
|
getBaseUrl
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-5QUPKDI5.js";
|
|
15
15
|
import {
|
|
16
16
|
CLIENT_REPORT_PATH,
|
|
17
17
|
degradedLine
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-I5IJRMNV.js";
|
|
19
19
|
|
|
20
20
|
// src/client-report-claim.ts
|
|
21
21
|
import { createHash } from "crypto";
|
|
@@ -8,8 +8,9 @@ import {
|
|
|
8
8
|
SETUP_AGENT_CHOICES,
|
|
9
9
|
SETUP_CONNECT_MODES,
|
|
10
10
|
isSetupConnectMode,
|
|
11
|
-
isValidApiKey
|
|
12
|
-
|
|
11
|
+
isValidApiKey,
|
|
12
|
+
normalizeAgentId
|
|
13
|
+
} from "./chunk-I5IJRMNV.js";
|
|
13
14
|
|
|
14
15
|
// src/setup/options.ts
|
|
15
16
|
var AGENT_CHOICES = SETUP_AGENT_CHOICES;
|
|
@@ -42,7 +43,6 @@ var SETUP_FLAGS = {
|
|
|
42
43
|
values: ["key", "connect", "agents", "verify", "control", "transcripts"]
|
|
43
44
|
};
|
|
44
45
|
var effectiveControlMode = (options, stored, configPresent) => options.controlExplicit ? options.control : stored ?? (configPresent ? null : options.control);
|
|
45
|
-
var isAgentChoice = (value) => AGENT_CHOICES.includes(value);
|
|
46
46
|
var parseAgentSelection = (raw, yes) => {
|
|
47
47
|
if (raw === void 0) {
|
|
48
48
|
return yes ? { kind: "auto" } : { kind: "ask" };
|
|
@@ -52,13 +52,15 @@ var parseAgentSelection = (raw, yes) => {
|
|
|
52
52
|
if (value === "none") return { kind: "none" };
|
|
53
53
|
const parts = value.split(",").map((part) => part.trim()).filter((part) => part !== "");
|
|
54
54
|
if (parts.length === 0) throw new UsageError("--agents needs a value");
|
|
55
|
-
const
|
|
55
|
+
const resolved = parts.map((part) => ({ part, agent: normalizeAgentId(part, AGENT_CHOICES) }));
|
|
56
|
+
const unknown = resolved.flatMap(({ part, agent }) => agent === null ? [part] : []);
|
|
56
57
|
if (unknown.length > 0) {
|
|
57
58
|
throw new UsageError(
|
|
58
59
|
`--agents does not know: ${unknown.join(", ")}. Use auto, none, or any of: ${AGENT_CHOICES.join(", ")}`
|
|
59
60
|
);
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
+
const agents = resolved.flatMap(({ agent }) => agent === null ? [] : [agent]);
|
|
63
|
+
return { kind: "explicit", agents: [...new Set(agents)] };
|
|
62
64
|
};
|
|
63
65
|
var parseSetupOptions = (input) => {
|
|
64
66
|
const flags = parseFlags(input.argv, SETUP_FLAGS);
|
|
@@ -6,38 +6,38 @@ import {
|
|
|
6
6
|
} from "./chunk-SGZJ5LYH.js";
|
|
7
7
|
import {
|
|
8
8
|
hookOwnerOf
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YIG2R3BJ.js";
|
|
10
10
|
import {
|
|
11
11
|
ensureDaemonRunning
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-LKLVTG3V.js";
|
|
13
13
|
import {
|
|
14
14
|
buildTranscriptRecords,
|
|
15
15
|
decodePublicKey,
|
|
16
16
|
generateSessionKey,
|
|
17
17
|
wrapSessionKey
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-ZBK6E2OR.js";
|
|
19
19
|
import {
|
|
20
20
|
fetchTranscriptRecipients,
|
|
21
21
|
uploadTranscriptRecords
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-CLOSJ4ES.js";
|
|
23
23
|
import {
|
|
24
24
|
transcriptEnvironmentPreference,
|
|
25
25
|
transcriptsEnabled
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-M6BZZFVQ.js";
|
|
27
27
|
import {
|
|
28
28
|
readTranscriptPreference
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-N4QSPI3B.js";
|
|
30
30
|
import {
|
|
31
31
|
codexHome,
|
|
32
32
|
pusharyDir
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-ZBHUHJG6.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-5QUPKDI5.js";
|
|
41
41
|
|
|
42
42
|
// src/transcript-registration.ts
|
|
43
43
|
import { createHash } from "crypto";
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
pusharyHookExecutable
|
|
3
|
-
} from "./chunk-4YO4T5FV.js";
|
|
4
|
-
import {
|
|
5
|
-
isProtectedByScope,
|
|
6
|
-
registerHookEntry
|
|
7
|
-
} from "./chunk-ZUTU43FT.js";
|
|
8
|
-
|
|
9
1
|
// src/skills-cli.ts
|
|
10
2
|
import { execSync } from "child_process";
|
|
11
3
|
var PUSHARY_SKILL_SOURCE = "Pushary/pushary-skill";
|
|
@@ -33,28 +25,6 @@ var installAgentSkill = async (request, effects) => {
|
|
|
33
25
|
return "packaged-copy";
|
|
34
26
|
};
|
|
35
27
|
|
|
36
|
-
// src/cursor-config.ts
|
|
37
|
-
var hookCommandOf = (entry) => {
|
|
38
|
-
const command = entry && typeof entry === "object" && !Array.isArray(entry) ? entry.command : void 0;
|
|
39
|
-
return typeof command === "string" ? command : "";
|
|
40
|
-
};
|
|
41
|
-
var isPusharyCursorEntry = (entry) => pusharyHookExecutable(hookCommandOf(entry)) !== null;
|
|
42
|
-
var registerCursorGate = (existing, entry) => registerHookEntry(existing, isPusharyCursorEntry, entry);
|
|
43
|
-
var withoutPusharyCursorHooks = (hooks, scope) => {
|
|
44
|
-
let removed = 0;
|
|
45
|
-
const kept = {};
|
|
46
|
-
for (const [event, entries] of Object.entries(hooks)) {
|
|
47
|
-
if (!Array.isArray(entries)) {
|
|
48
|
-
kept[event] = entries;
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
const others = entries.filter((entry) => !isPusharyCursorEntry(entry) || isProtectedByScope(hookCommandOf(entry), scope));
|
|
52
|
-
removed += entries.length - others.length;
|
|
53
|
-
if (others.length > 0 || entries.length === 0) kept[event] = others;
|
|
54
|
-
}
|
|
55
|
-
return { hooks: kept, removed };
|
|
56
|
-
};
|
|
57
|
-
|
|
58
28
|
// src/cli/dry-run.ts
|
|
59
29
|
import { execFileSync } from "child_process";
|
|
60
30
|
import { rmSync, writeFileSync } from "fs";
|
|
@@ -92,8 +62,6 @@ export {
|
|
|
92
62
|
PUSHARY_SKILL_NAME,
|
|
93
63
|
installSkillViaSkillsCli,
|
|
94
64
|
installAgentSkill,
|
|
95
|
-
registerCursorGate,
|
|
96
|
-
withoutPusharyCursorHooks,
|
|
97
65
|
createGuards,
|
|
98
66
|
describeSetupSideEffects
|
|
99
67
|
};
|