@pushary/agent-hooks 0.62.1 → 0.62.2
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 +34 -0
- package/dist/bin/pushary-claude.js +5 -2
- package/dist/bin/pushary-clean.js +3 -2
- package/dist/bin/pushary-codex-hook.js +5 -2
- package/dist/bin/pushary-codex.js +5 -2
- package/dist/bin/pushary-connect.js +14 -12
- package/dist/bin/pushary-daemon.js +5 -4
- package/dist/bin/pushary-doctor.js +18 -13
- package/dist/bin/pushary-gemini-hook.js +5 -2
- package/dist/bin/pushary-hook.js +8 -5
- package/dist/bin/pushary-login.js +13 -10
- package/dist/bin/pushary-logout.js +9 -8
- package/dist/bin/pushary-mode.js +29 -6
- package/dist/bin/pushary-notification-hook.js +5 -2
- package/dist/bin/pushary-permission-denied-hook.js +6 -3
- package/dist/bin/pushary-permission-hook.js +6 -3
- package/dist/bin/pushary-post-hook.js +5 -2
- package/dist/bin/pushary-prompt-hook.js +5 -2
- package/dist/bin/pushary-session-end-hook.js +5 -2
- package/dist/bin/pushary-session-start-hook.js +5 -2
- package/dist/bin/pushary-setup.js +15 -12
- package/dist/bin/pushary-stats.js +3 -2
- package/dist/bin/pushary-status.js +20 -7
- package/dist/bin/pushary-stop-hook.js +5 -2
- package/dist/bin/pushary-stopfailure-hook.js +5 -2
- package/dist/bin/pushary-suggestions.js +27 -2
- package/dist/bin/pushary-upgrade.js +3 -2
- package/dist/bin/pushary-wait.js +29 -6
- package/dist/bin/pushary.js +9 -2
- package/dist/{chunk-HIIBSYFJ.js → chunk-5ZDYDU2Q.js} +5 -1
- package/dist/{chunk-SP7OZXCQ.js → chunk-7OXIC7E3.js} +1 -15
- package/dist/{chunk-HNTKTK5B.js → chunk-BSZYIAZL.js} +4 -0
- package/dist/{chunk-YJ7YZRVV.js → chunk-G4TARJAY.js} +8 -54
- package/dist/{chunk-N4DA4CJB.js → chunk-GMXKITVA.js} +13 -0
- package/dist/chunk-KZERVKTD.js +16 -0
- package/dist/{chunk-3O27ZSRE.js → chunk-NGZMVCXN.js} +1 -1
- package/dist/chunk-SAF6HGAA.js +57 -0
- package/dist/{chunk-5SO3CEGJ.js → chunk-SDXF5I46.js} +1 -1
- package/dist/{chunk-ONVEYEVR.js → chunk-SR52774M.js} +2 -2
- package/dist/{chunk-IIZZYUWK.js → chunk-WXFEK7KD.js} +4 -2
- package/dist/{chunk-QHOVJXOT.js → chunk-Z3Z4VK5F.js} +2 -1
- package/dist/src/index.js +6 -3
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
runBrowserLogin
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-Z3Z4VK5F.js";
|
|
5
5
|
import {
|
|
6
6
|
addClaudeMcpServer,
|
|
7
7
|
addPusharyHooks,
|
|
@@ -35,11 +35,8 @@ import {
|
|
|
35
35
|
connectViaAppPairing,
|
|
36
36
|
printConnectInstructions,
|
|
37
37
|
setHumanStream
|
|
38
|
-
} from "../chunk-
|
|
38
|
+
} from "../chunk-NGZMVCXN.js";
|
|
39
39
|
import "../chunk-3EGEA4KH.js";
|
|
40
|
-
import {
|
|
41
|
-
parseFlags
|
|
42
|
-
} from "../chunk-N4DA4CJB.js";
|
|
43
40
|
import {
|
|
44
41
|
KEY_FILE_MODE,
|
|
45
42
|
exportLine,
|
|
@@ -54,10 +51,10 @@ import {
|
|
|
54
51
|
import {
|
|
55
52
|
checkApiKey,
|
|
56
53
|
describeKeyCheck
|
|
57
|
-
} from "../chunk-
|
|
54
|
+
} from "../chunk-G4TARJAY.js";
|
|
58
55
|
import {
|
|
59
|
-
|
|
60
|
-
} from "../chunk-
|
|
56
|
+
parseFlags
|
|
57
|
+
} from "../chunk-GMXKITVA.js";
|
|
61
58
|
import {
|
|
62
59
|
installClaudeAlias,
|
|
63
60
|
resolveShellRc
|
|
@@ -70,19 +67,25 @@ import {
|
|
|
70
67
|
resolveGlobalBinary
|
|
71
68
|
} from "../chunk-MUEW424A.js";
|
|
72
69
|
import {
|
|
73
|
-
EXIT,
|
|
74
70
|
getPackageVersion,
|
|
75
71
|
renderCommandHelp
|
|
76
|
-
} from "../chunk-
|
|
72
|
+
} from "../chunk-7OXIC7E3.js";
|
|
77
73
|
import {
|
|
78
74
|
reportEvent
|
|
79
|
-
} from "../chunk-
|
|
80
|
-
import "../chunk-
|
|
75
|
+
} from "../chunk-5ZDYDU2Q.js";
|
|
76
|
+
import "../chunk-BSZYIAZL.js";
|
|
77
|
+
import "../chunk-SAF6HGAA.js";
|
|
78
|
+
import {
|
|
79
|
+
UsageError
|
|
80
|
+
} from "../chunk-7QLSKOSU.js";
|
|
81
81
|
import {
|
|
82
82
|
isValidApiKey
|
|
83
83
|
} from "../chunk-DQAN3JQP.js";
|
|
84
84
|
import "../chunk-RN3NOEJF.js";
|
|
85
85
|
import "../chunk-2UMNXADU.js";
|
|
86
|
+
import {
|
|
87
|
+
EXIT
|
|
88
|
+
} from "../chunk-KZERVKTD.js";
|
|
86
89
|
|
|
87
90
|
// bin/pushary-setup.ts
|
|
88
91
|
import { existsSync, readFileSync, writeFileSync, mkdirSync, cpSync, rmSync, renameSync } from "fs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
exitOnHelpFlag
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-WXFEK7KD.js";
|
|
5
|
+
import "../chunk-7OXIC7E3.js";
|
|
6
6
|
import {
|
|
7
7
|
readLedgerSummary
|
|
8
8
|
} from "../chunk-WLGEY4UX.js";
|
|
@@ -10,6 +10,7 @@ import "../chunk-DQAN3JQP.js";
|
|
|
10
10
|
import {
|
|
11
11
|
getApiKey
|
|
12
12
|
} from "../chunk-2UMNXADU.js";
|
|
13
|
+
import "../chunk-KZERVKTD.js";
|
|
13
14
|
|
|
14
15
|
// bin/pushary-stats.ts
|
|
15
16
|
exitOnHelpFlag("stats");
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
describeReach,
|
|
4
4
|
fetchChannels,
|
|
5
5
|
reachVerdict
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-NGZMVCXN.js";
|
|
7
7
|
import "../chunk-3EGEA4KH.js";
|
|
8
8
|
import {
|
|
9
9
|
readKeySource
|
|
@@ -12,21 +12,28 @@ import "../chunk-6MTNS63X.js";
|
|
|
12
12
|
import {
|
|
13
13
|
checkApiKey,
|
|
14
14
|
describeKeyCheck
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-G4TARJAY.js";
|
|
16
16
|
import {
|
|
17
17
|
createIo
|
|
18
18
|
} from "../chunk-TX7KBKT7.js";
|
|
19
|
-
import
|
|
19
|
+
import {
|
|
20
|
+
rejectUnknownFlags
|
|
21
|
+
} from "../chunk-GMXKITVA.js";
|
|
20
22
|
import "../chunk-BC3VCZ3E.js";
|
|
21
23
|
import {
|
|
22
24
|
exitOnHelpFlag
|
|
23
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-WXFEK7KD.js";
|
|
26
|
+
import "../chunk-7OXIC7E3.js";
|
|
27
|
+
import "../chunk-BSZYIAZL.js";
|
|
28
|
+
import "../chunk-SAF6HGAA.js";
|
|
24
29
|
import {
|
|
25
|
-
|
|
26
|
-
} from "../chunk-
|
|
27
|
-
import "../chunk-HNTKTK5B.js";
|
|
30
|
+
UsageError
|
|
31
|
+
} from "../chunk-7QLSKOSU.js";
|
|
28
32
|
import "../chunk-DQAN3JQP.js";
|
|
29
33
|
import "../chunk-2UMNXADU.js";
|
|
34
|
+
import {
|
|
35
|
+
EXIT
|
|
36
|
+
} from "../chunk-KZERVKTD.js";
|
|
30
37
|
|
|
31
38
|
// src/status.ts
|
|
32
39
|
var keySourceLine = (source) => {
|
|
@@ -171,6 +178,7 @@ var statusJson = (facts, report) => ({
|
|
|
171
178
|
exitOnHelpFlag("status");
|
|
172
179
|
var { bold, dim, green, red, yellow } = createIo();
|
|
173
180
|
var args = process.argv.slice(2);
|
|
181
|
+
rejectUnknownFlags(args.filter((a) => a !== "status"), ["--json"]);
|
|
174
182
|
var json = args.includes("--json");
|
|
175
183
|
var main = async () => {
|
|
176
184
|
const source = readKeySource();
|
|
@@ -202,6 +210,11 @@ var main = async () => {
|
|
|
202
210
|
process.exit(report.exitCode);
|
|
203
211
|
};
|
|
204
212
|
main().catch((err) => {
|
|
213
|
+
if (err instanceof UsageError) {
|
|
214
|
+
process.stderr.write(` ! ${err.message}
|
|
215
|
+
`);
|
|
216
|
+
process.exit(EXIT.USAGE);
|
|
217
|
+
}
|
|
205
218
|
console.error(` ${yellow("!")} status failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
206
219
|
process.exit(1);
|
|
207
220
|
});
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
handleStop
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-5ZDYDU2Q.js";
|
|
5
|
+
import "../chunk-BSZYIAZL.js";
|
|
6
|
+
import "../chunk-SAF6HGAA.js";
|
|
7
|
+
import "../chunk-7QLSKOSU.js";
|
|
6
8
|
import "../chunk-DQAN3JQP.js";
|
|
7
9
|
import "../chunk-RN3NOEJF.js";
|
|
8
10
|
import "../chunk-2UMNXADU.js";
|
|
11
|
+
import "../chunk-KZERVKTD.js";
|
|
9
12
|
|
|
10
13
|
// bin/pushary-stop-hook.ts
|
|
11
14
|
var main = async () => {
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
handleStopFailure
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-5ZDYDU2Q.js";
|
|
5
|
+
import "../chunk-BSZYIAZL.js";
|
|
6
|
+
import "../chunk-SAF6HGAA.js";
|
|
7
|
+
import "../chunk-7QLSKOSU.js";
|
|
6
8
|
import "../chunk-DQAN3JQP.js";
|
|
7
9
|
import "../chunk-RN3NOEJF.js";
|
|
8
10
|
import "../chunk-2UMNXADU.js";
|
|
11
|
+
import "../chunk-KZERVKTD.js";
|
|
9
12
|
|
|
10
13
|
// bin/pushary-stopfailure-hook.ts
|
|
11
14
|
var main = async () => {
|
|
@@ -2,14 +2,23 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createIo
|
|
4
4
|
} from "../chunk-TX7KBKT7.js";
|
|
5
|
+
import {
|
|
6
|
+
rejectUnknownFlags
|
|
7
|
+
} from "../chunk-GMXKITVA.js";
|
|
5
8
|
import {
|
|
6
9
|
exitOnHelpFlag
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
10
|
+
} from "../chunk-WXFEK7KD.js";
|
|
11
|
+
import "../chunk-7OXIC7E3.js";
|
|
12
|
+
import {
|
|
13
|
+
UsageError
|
|
14
|
+
} from "../chunk-7QLSKOSU.js";
|
|
9
15
|
import {
|
|
10
16
|
getApiKey,
|
|
11
17
|
getBaseUrl
|
|
12
18
|
} from "../chunk-2UMNXADU.js";
|
|
19
|
+
import {
|
|
20
|
+
EXIT
|
|
21
|
+
} from "../chunk-KZERVKTD.js";
|
|
13
22
|
|
|
14
23
|
// bin/pushary-suggestions.ts
|
|
15
24
|
exitOnHelpFlag("suggestions");
|
|
@@ -22,6 +31,17 @@ var errorMessage = async (res) => {
|
|
|
22
31
|
return `HTTP ${res.status}`;
|
|
23
32
|
}
|
|
24
33
|
};
|
|
34
|
+
{
|
|
35
|
+
const raw = process.argv.slice(2);
|
|
36
|
+
const positional = raw[0] === "suggestions" ? raw.slice(1) : raw;
|
|
37
|
+
try {
|
|
38
|
+
rejectUnknownFlags(positional, []);
|
|
39
|
+
} catch (err) {
|
|
40
|
+
process.stderr.write(` ! ${err instanceof Error ? err.message : String(err)}
|
|
41
|
+
`);
|
|
42
|
+
process.exit(EXIT.USAGE);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
25
45
|
var main = async () => {
|
|
26
46
|
const apiKey = getApiKey();
|
|
27
47
|
const baseUrl = getBaseUrl();
|
|
@@ -69,6 +89,11 @@ var main = async () => {
|
|
|
69
89
|
}
|
|
70
90
|
};
|
|
71
91
|
main().catch((err) => {
|
|
92
|
+
if (err instanceof UsageError) {
|
|
93
|
+
process.stderr.write(` ! ${err.message}
|
|
94
|
+
`);
|
|
95
|
+
process.exit(EXIT.USAGE);
|
|
96
|
+
}
|
|
72
97
|
console.error(err instanceof Error ? err.message : String(err));
|
|
73
98
|
process.exit(1);
|
|
74
99
|
});
|
|
@@ -31,12 +31,13 @@ import {
|
|
|
31
31
|
} from "../chunk-MUEW424A.js";
|
|
32
32
|
import {
|
|
33
33
|
exitOnHelpFlag
|
|
34
|
-
} from "../chunk-
|
|
35
|
-
import "../chunk-
|
|
34
|
+
} from "../chunk-WXFEK7KD.js";
|
|
35
|
+
import "../chunk-7OXIC7E3.js";
|
|
36
36
|
import "../chunk-DQAN3JQP.js";
|
|
37
37
|
import {
|
|
38
38
|
getApiKey
|
|
39
39
|
} from "../chunk-2UMNXADU.js";
|
|
40
|
+
import "../chunk-KZERVKTD.js";
|
|
40
41
|
|
|
41
42
|
// bin/pushary-upgrade.ts
|
|
42
43
|
import { existsSync as existsSync2 } from "fs";
|
package/dist/bin/pushary-wait.js
CHANGED
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
exitOnFailedResponse
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-SR52774M.js";
|
|
5
5
|
import {
|
|
6
6
|
describeWaitLadder
|
|
7
7
|
} from "../chunk-IIENZE2J.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-G4TARJAY.js";
|
|
9
9
|
import {
|
|
10
10
|
createIo
|
|
11
11
|
} from "../chunk-TX7KBKT7.js";
|
|
12
|
-
import
|
|
12
|
+
import {
|
|
13
|
+
rejectUnknownFlags
|
|
14
|
+
} from "../chunk-GMXKITVA.js";
|
|
13
15
|
import {
|
|
14
16
|
exitOnHelpFlag
|
|
15
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-WXFEK7KD.js";
|
|
18
|
+
import "../chunk-7OXIC7E3.js";
|
|
19
|
+
import "../chunk-SAF6HGAA.js";
|
|
16
20
|
import {
|
|
17
|
-
|
|
18
|
-
} from "../chunk-
|
|
21
|
+
UsageError
|
|
22
|
+
} from "../chunk-7QLSKOSU.js";
|
|
19
23
|
import "../chunk-DQAN3JQP.js";
|
|
20
24
|
import {
|
|
21
25
|
getApiKey,
|
|
22
26
|
getBaseUrl
|
|
23
27
|
} from "../chunk-2UMNXADU.js";
|
|
28
|
+
import {
|
|
29
|
+
EXIT
|
|
30
|
+
} from "../chunk-KZERVKTD.js";
|
|
24
31
|
|
|
25
32
|
// bin/pushary-wait.ts
|
|
26
33
|
exitOnHelpFlag("wait");
|
|
@@ -61,6 +68,17 @@ var setWindow = async (baseUrl, headers, seconds) => {
|
|
|
61
68
|
const data = await res.json();
|
|
62
69
|
return data.defaultPushFirstSeconds;
|
|
63
70
|
};
|
|
71
|
+
{
|
|
72
|
+
const raw = process.argv.slice(2);
|
|
73
|
+
const positional = raw[0] === "wait" ? raw.slice(1) : raw;
|
|
74
|
+
try {
|
|
75
|
+
rejectUnknownFlags(positional, []);
|
|
76
|
+
} catch (err) {
|
|
77
|
+
process.stderr.write(` ! ${err instanceof Error ? err.message : String(err)}
|
|
78
|
+
`);
|
|
79
|
+
process.exit(EXIT.USAGE);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
64
82
|
var main = async () => {
|
|
65
83
|
const apiKey = getApiKey();
|
|
66
84
|
const baseUrl = getBaseUrl();
|
|
@@ -90,6 +108,11 @@ var main = async () => {
|
|
|
90
108
|
console.log(` ${green("\u2713")} Default push window set to ${cyan(`${value}s`)} ${dim("\u2014 ping your phone that long, then the terminal takes over")}`);
|
|
91
109
|
};
|
|
92
110
|
main().catch((err) => {
|
|
111
|
+
if (err instanceof UsageError) {
|
|
112
|
+
process.stderr.write(` ! ${err.message}
|
|
113
|
+
`);
|
|
114
|
+
process.exit(EXIT.USAGE);
|
|
115
|
+
}
|
|
93
116
|
console.error(` ${yellow("!")} ${err instanceof Error ? err.message : err}`);
|
|
94
117
|
process.exit(1);
|
|
95
118
|
});
|
package/dist/bin/pushary.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
COMMANDS,
|
|
4
|
-
EXIT,
|
|
5
4
|
getPackageVersion,
|
|
6
5
|
isCommandName,
|
|
7
6
|
renderHelp
|
|
8
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-7OXIC7E3.js";
|
|
8
|
+
import {
|
|
9
|
+
installProxyDispatcher
|
|
10
|
+
} from "../chunk-SAF6HGAA.js";
|
|
11
|
+
import "../chunk-7QLSKOSU.js";
|
|
12
|
+
import {
|
|
13
|
+
EXIT
|
|
14
|
+
} from "../chunk-KZERVKTD.js";
|
|
9
15
|
|
|
10
16
|
// bin/pushary.ts
|
|
11
17
|
var LOADERS = {
|
|
@@ -25,6 +31,7 @@ var LOADERS = {
|
|
|
25
31
|
upgrade: () => import("./pushary-upgrade.js"),
|
|
26
32
|
hook: () => import("./pushary-hook.js")
|
|
27
33
|
};
|
|
34
|
+
installProxyDispatcher();
|
|
28
35
|
var argv = process.argv.slice(2);
|
|
29
36
|
var command = argv[0] ?? "";
|
|
30
37
|
var wants = (...names) => argv.some((arg) => names.includes(arg));
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
callMcpTool,
|
|
3
3
|
withRetry
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BSZYIAZL.js";
|
|
5
|
+
import {
|
|
6
|
+
installProxyDispatcher
|
|
7
|
+
} from "./chunk-SAF6HGAA.js";
|
|
5
8
|
import {
|
|
6
9
|
ACTION_BODY_MAX,
|
|
7
10
|
DECISION_LINE_MAX,
|
|
@@ -204,6 +207,7 @@ var fetchModeState = async (apiKey, sessionId) => {
|
|
|
204
207
|
var fetchModeOverride = async (apiKey) => (await fetchModeState(apiKey)).mode;
|
|
205
208
|
|
|
206
209
|
// src/api.ts
|
|
210
|
+
installProxyDispatcher();
|
|
207
211
|
var askUser = async (apiKey, params, timeoutMs = 15e3) => {
|
|
208
212
|
const result = await callMcpTool(apiKey, "ask_user", { ...params, wait: false }, { maxRetries: 3, timeoutMs });
|
|
209
213
|
if (!isAskUserResponse(result)) throw new Error("Invalid ask_user response");
|
|
@@ -201,24 +201,10 @@ var getPackageVersion = () => {
|
|
|
201
201
|
}
|
|
202
202
|
};
|
|
203
203
|
|
|
204
|
-
// src/exit.ts
|
|
205
|
-
var EXIT = {
|
|
206
|
-
OK: 0,
|
|
207
|
-
FAILED: 1,
|
|
208
|
-
USAGE: 2,
|
|
209
|
-
NOT_CONFIGURED: 3,
|
|
210
|
-
UNAUTHENTICATED: 4,
|
|
211
|
-
PROBLEMS_FOUND: 5,
|
|
212
|
-
NO_DEVICE: 6,
|
|
213
|
-
INPUT_REQUIRED: 7,
|
|
214
|
-
UNREACHABLE: 8
|
|
215
|
-
};
|
|
216
|
-
|
|
217
204
|
export {
|
|
218
205
|
COMMANDS,
|
|
219
206
|
isCommandName,
|
|
220
207
|
renderHelp,
|
|
221
208
|
renderCommandHelp,
|
|
222
|
-
getPackageVersion
|
|
223
|
-
EXIT
|
|
209
|
+
getPackageVersion
|
|
224
210
|
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
installProxyDispatcher
|
|
3
|
+
} from "./chunk-SAF6HGAA.js";
|
|
1
4
|
import {
|
|
2
5
|
getBaseUrl
|
|
3
6
|
} from "./chunk-2UMNXADU.js";
|
|
@@ -31,6 +34,7 @@ var withRetry = async (fn, options = {}) => {
|
|
|
31
34
|
};
|
|
32
35
|
|
|
33
36
|
// src/mcp-http.ts
|
|
37
|
+
installProxyDispatcher();
|
|
34
38
|
var parseSseJson = (body) => {
|
|
35
39
|
const messages = [];
|
|
36
40
|
for (const event of body.split(/\r?\n\r?\n/)) {
|
|
@@ -1,68 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
pusharyFetch
|
|
3
|
+
} from "./chunk-SAF6HGAA.js";
|
|
1
4
|
import {
|
|
2
5
|
NetworkError
|
|
3
6
|
} from "./chunk-7QLSKOSU.js";
|
|
4
|
-
import {
|
|
5
|
-
EXIT
|
|
6
|
-
} from "./chunk-SP7OZXCQ.js";
|
|
7
7
|
import {
|
|
8
8
|
isValidApiKey
|
|
9
9
|
} from "./chunk-DQAN3JQP.js";
|
|
10
10
|
import {
|
|
11
11
|
getBaseUrl
|
|
12
12
|
} from "./chunk-2UMNXADU.js";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var requireCjs = createRequire(import.meta.url);
|
|
17
|
-
var PROXY_VARS = ["HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy"];
|
|
18
|
-
var proxyFromEnv = () => {
|
|
19
|
-
for (const name of PROXY_VARS) {
|
|
20
|
-
const value = process.env[name]?.trim();
|
|
21
|
-
if (value) return value;
|
|
22
|
-
}
|
|
23
|
-
return void 0;
|
|
24
|
-
};
|
|
25
|
-
var installed = false;
|
|
26
|
-
var installProxyDispatcher = () => {
|
|
27
|
-
if (installed) return;
|
|
28
|
-
installed = true;
|
|
29
|
-
if (!proxyFromEnv()) return;
|
|
30
|
-
try {
|
|
31
|
-
const { EnvHttpProxyAgent, setGlobalDispatcher } = requireCjs("undici");
|
|
32
|
-
setGlobalDispatcher(new EnvHttpProxyAgent());
|
|
33
|
-
} catch {
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
var isNetworkFailure = (err) => {
|
|
37
|
-
if (!(err instanceof Error)) return false;
|
|
38
|
-
const code = err.code;
|
|
39
|
-
if (code && ["ENOTFOUND", "ECONNREFUSED", "ECONNRESET", "ETIMEDOUT", "EAI_AGAIN", "EPROTO", "CERT_HAS_EXPIRED", "UNABLE_TO_VERIFY_LEAF_SIGNATURE"].includes(code)) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
return err.name === "AbortError" || err.name === "TimeoutError" || /fetch failed/i.test(err.message);
|
|
43
|
-
};
|
|
44
|
-
var DEFAULT_TIMEOUT_MS = 15e3;
|
|
45
|
-
var pusharyFetch = async (url, init = {}) => {
|
|
46
|
-
installProxyDispatcher();
|
|
47
|
-
const { timeoutMs = DEFAULT_TIMEOUT_MS, signal, ...rest } = init;
|
|
48
|
-
try {
|
|
49
|
-
return await fetch(url, {
|
|
50
|
-
...rest,
|
|
51
|
-
signal: signal ?? AbortSignal.timeout(timeoutMs)
|
|
52
|
-
});
|
|
53
|
-
} catch (err) {
|
|
54
|
-
if (isNetworkFailure(err)) {
|
|
55
|
-
const proxy = proxyFromEnv();
|
|
56
|
-
const via = proxy ? ` (via proxy ${proxy})` : "";
|
|
57
|
-
throw new NetworkError(`Could not reach ${new URL(url).host}${via}: ${err instanceof Error ? err.message : String(err)}`);
|
|
58
|
-
}
|
|
59
|
-
throw err;
|
|
60
|
-
}
|
|
61
|
-
};
|
|
13
|
+
import {
|
|
14
|
+
EXIT
|
|
15
|
+
} from "./chunk-KZERVKTD.js";
|
|
62
16
|
|
|
63
17
|
// src/session.ts
|
|
64
18
|
var IDENTITY_PATH = "/api/v1/server/identity";
|
|
65
|
-
var
|
|
19
|
+
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
66
20
|
var SUBSCRIPTION_REQUIRED_CODE = "subscription_required";
|
|
67
21
|
var DEFAULT_UPGRADE_PATH = "/dashboard/settings?tab=billing";
|
|
68
22
|
var KEY_SCOPES = ["full_access", "connector", "bound"];
|
|
@@ -120,7 +74,7 @@ var checkApiKey = async (apiKey, options = {}) => {
|
|
|
120
74
|
if (!isValidApiKey(apiKey)) return { kind: "malformed" };
|
|
121
75
|
const baseUrl = options.baseUrl ?? getBaseUrl();
|
|
122
76
|
const fetchImpl = options.fetchImpl ?? pusharyFetch;
|
|
123
|
-
const timeoutMs = options.timeoutMs ??
|
|
77
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
124
78
|
let response;
|
|
125
79
|
try {
|
|
126
80
|
response = await fetchImpl(`${baseUrl.replace(/\/+$/, "")}${IDENTITY_PATH}`, {
|
|
@@ -9,6 +9,18 @@ var known = (spec, name) => {
|
|
|
9
9
|
if (spec.values.includes(name)) return "value";
|
|
10
10
|
return void 0;
|
|
11
11
|
};
|
|
12
|
+
var rejectUnknownFlags = (args, allowed) => {
|
|
13
|
+
for (const token of args) {
|
|
14
|
+
if (token === "--") break;
|
|
15
|
+
if (!token.startsWith("-")) continue;
|
|
16
|
+
const name = token.includes("=") ? token.slice(0, token.indexOf("=")) : token;
|
|
17
|
+
if (!allowed.includes(name)) {
|
|
18
|
+
throw new UsageError(
|
|
19
|
+
`Unknown flag: ${name}${allowed.length > 0 ? `. This command accepts ${allowed.join(", ")}` : ". This command takes no flags"}`
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
12
24
|
var parseFlags = (argv, spec) => {
|
|
13
25
|
const bools = /* @__PURE__ */ new Set();
|
|
14
26
|
const values = /* @__PURE__ */ new Map();
|
|
@@ -53,5 +65,6 @@ var parseFlags = (argv, spec) => {
|
|
|
53
65
|
};
|
|
54
66
|
|
|
55
67
|
export {
|
|
68
|
+
rejectUnknownFlags,
|
|
56
69
|
parseFlags
|
|
57
70
|
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NetworkError
|
|
3
|
+
} from "./chunk-7QLSKOSU.js";
|
|
4
|
+
|
|
5
|
+
// src/cli/net.ts
|
|
6
|
+
import { createRequire } from "module";
|
|
7
|
+
var requireCjs = createRequire(import.meta.url);
|
|
8
|
+
var PROXY_VARS = ["HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy"];
|
|
9
|
+
var proxyFromEnv = () => {
|
|
10
|
+
for (const name of PROXY_VARS) {
|
|
11
|
+
const value = process.env[name]?.trim();
|
|
12
|
+
if (value) return value;
|
|
13
|
+
}
|
|
14
|
+
return void 0;
|
|
15
|
+
};
|
|
16
|
+
var installed = false;
|
|
17
|
+
var installProxyDispatcher = () => {
|
|
18
|
+
if (installed) return;
|
|
19
|
+
installed = true;
|
|
20
|
+
if (!proxyFromEnv()) return;
|
|
21
|
+
try {
|
|
22
|
+
const { EnvHttpProxyAgent, setGlobalDispatcher } = requireCjs("undici");
|
|
23
|
+
setGlobalDispatcher(new EnvHttpProxyAgent());
|
|
24
|
+
} catch {
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var isNetworkFailure = (err) => {
|
|
28
|
+
if (!(err instanceof Error)) return false;
|
|
29
|
+
const code = err.code;
|
|
30
|
+
if (code && ["ENOTFOUND", "ECONNREFUSED", "ECONNRESET", "ETIMEDOUT", "EAI_AGAIN", "EPROTO", "CERT_HAS_EXPIRED", "UNABLE_TO_VERIFY_LEAF_SIGNATURE"].includes(code)) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
return err.name === "AbortError" || err.name === "TimeoutError" || /fetch failed/i.test(err.message);
|
|
34
|
+
};
|
|
35
|
+
var DEFAULT_TIMEOUT_MS = 15e3;
|
|
36
|
+
var pusharyFetch = async (url, init = {}) => {
|
|
37
|
+
installProxyDispatcher();
|
|
38
|
+
const { timeoutMs = DEFAULT_TIMEOUT_MS, signal, ...rest } = init;
|
|
39
|
+
try {
|
|
40
|
+
return await fetch(url, {
|
|
41
|
+
...rest,
|
|
42
|
+
signal: signal ?? AbortSignal.timeout(timeoutMs)
|
|
43
|
+
});
|
|
44
|
+
} catch (err) {
|
|
45
|
+
if (isNetworkFailure(err)) {
|
|
46
|
+
const proxy = proxyFromEnv();
|
|
47
|
+
const via = proxy ? ` (via proxy ${proxy})` : "";
|
|
48
|
+
throw new NetworkError(`Could not reach ${new URL(url).host}${via}: ${err instanceof Error ? err.message : String(err)}`);
|
|
49
|
+
}
|
|
50
|
+
throw err;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
installProxyDispatcher,
|
|
56
|
+
pusharyFetch
|
|
57
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
describeKeyCheck,
|
|
3
3
|
keyCheckFromResponse
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-G4TARJAY.js";
|
|
5
5
|
import {
|
|
6
6
|
createIo
|
|
7
7
|
} from "./chunk-TX7KBKT7.js";
|
|
8
8
|
import {
|
|
9
9
|
EXIT
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KZERVKTD.js";
|
|
11
11
|
|
|
12
12
|
// src/cli/report-key.ts
|
|
13
13
|
var { dim, yellow } = createIo();
|
|
@@ -227,7 +227,8 @@ var runBrowserLogin = async (ui, options, deps = {}) => {
|
|
|
227
227
|
} else if (state2.kind === "payment-required") {
|
|
228
228
|
ui.say(` ${ui.yellow("!")} A plan is needed before a key can be issued. Nothing was created yet.`);
|
|
229
229
|
ui.say(` ${ui.dim("Choose one at")} ${ui.cyan(state2.checkoutUrl)}`);
|
|
230
|
-
ui.say(` ${ui.dim("
|
|
230
|
+
ui.say(` ${ui.dim("Keep the browser tab open and this finishes on its own once the plan is active.")}`);
|
|
231
|
+
ui.say(` ${ui.dim("If you closed it, reopen the page and enter the same code again.")}`);
|
|
231
232
|
if (!options.noBrowser && canOpenBrowser()) openInBrowser(state2.checkoutUrl);
|
|
232
233
|
} else if (state2.kind === "unreachable") {
|
|
233
234
|
ui.say(` ${ui.yellow("!")} Still trying. pushary.com is not answering ${ui.dim(`(${state2.detail})`)}`);
|