@0xmaxma/claude-gateway 1.8.8 → 1.8.10
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/README.md +32 -5
- package/dist/agent/runner.d.ts +14 -1
- package/dist/agent/runner.d.ts.map +1 -1
- package/dist/agent/runner.js +96 -3
- package/dist/agent/runner.js.map +1 -1
- package/dist/api/router.d.ts.map +1 -1
- package/dist/api/router.js +37 -3
- package/dist/api/router.js.map +1 -1
- package/dist/api/share-router.d.ts.map +1 -1
- package/dist/api/share-router.js +24 -0
- package/dist/api/share-router.js.map +1 -1
- package/dist/cli/args.d.ts +34 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +55 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/commands/app.d.ts +28 -0
- package/dist/cli/commands/app.d.ts.map +1 -0
- package/dist/cli/commands/app.js +411 -0
- package/dist/cli/commands/app.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/doctor.js +77 -16
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/service.d.ts.map +1 -1
- package/dist/cli/commands/service.js +373 -56
- package/dist/cli/commands/service.js.map +1 -1
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +1 -17
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/http-client.d.ts +8 -0
- package/dist/cli/http-client.d.ts.map +1 -1
- package/dist/cli/http-client.js +5 -2
- package/dist/cli/http-client.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +16 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/prompt.d.ts +17 -2
- package/dist/cli/prompt.d.ts.map +1 -1
- package/dist/cli/prompt.js +33 -2
- package/dist/cli/prompt.js.map +1 -1
- package/dist/config/loader.d.ts +8 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +15 -4
- package/dist/config/loader.js.map +1 -1
- package/dist/config/watcher.d.ts.map +1 -1
- package/dist/config/watcher.js +12 -0
- package/dist/config/watcher.js.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/session/store.d.ts +3 -2
- package/dist/session/store.d.ts.map +1 -1
- package/dist/session/store.js +1 -1
- package/dist/session/store.js.map +1 -1
- package/dist/share/session-video-catalog.d.ts +19 -0
- package/dist/share/session-video-catalog.d.ts.map +1 -0
- package/dist/share/session-video-catalog.js +119 -0
- package/dist/share/session-video-catalog.js.map +1 -0
- package/dist/types.d.ts +25 -0
- package/dist/types.d.ts.map +1 -1
- package/mcp/instructions.ts +14 -1
- package/mcp/server.ts +11 -5
- package/mcp/tools/image/module.ts +8 -71
- package/mcp/tools/shared/media.ts +76 -0
- package/mcp/tools/telegram/receiver-server.ts +15 -8
- package/mcp/tools/telegram/reply-attachment.ts +81 -0
- package/mcp/tools/video/module.ts +681 -0
- package/package.json +1 -1
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.parseInstallSource = parseInstallSource;
|
|
37
|
+
exports.runApp = runApp;
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
const args_1 = require("../args");
|
|
41
|
+
const load_dotenv_1 = require("../../load-dotenv");
|
|
42
|
+
const http_client_1 = require("../http-client");
|
|
43
|
+
const output_1 = require("../output");
|
|
44
|
+
const prompt_1 = require("../prompt");
|
|
45
|
+
const redact_1 = require("../redact");
|
|
46
|
+
/**
|
|
47
|
+
* `app list|start|stop|restart|uninstall|install` — a thin CLI wrapper over the
|
|
48
|
+
* existing `/v1/apps` REST API (src/api/apps-router.ts). This never talks to
|
|
49
|
+
* Docker directly: every action is the same admin-gated HTTP call the
|
|
50
|
+
* dashboard's App Store UI makes, so authorization and behavior can't drift
|
|
51
|
+
* between the two clients.
|
|
52
|
+
*
|
|
53
|
+
* `install` is the one asynchronous action — the server returns a `jobId`
|
|
54
|
+
* immediately (HTTP 202) and does the clone/build/start in the background.
|
|
55
|
+
* Without `--wait` this command reports only that the job was accepted (never
|
|
56
|
+
* "installed"); `--wait` polls `GET /v1/apps/jobs/:jobId` here and reports the
|
|
57
|
+
* real outcome. Either way, `claude-gateway api GET /v1/apps/jobs/<jobId>` is
|
|
58
|
+
* always available to check a job started elsewhere (e.g. --wait was skipped,
|
|
59
|
+
* or the CLI was interrupted).
|
|
60
|
+
*/
|
|
61
|
+
const VERBS = ['list', 'start', 'stop', 'restart', 'uninstall', 'install'];
|
|
62
|
+
/** Every flag `app` accepts, in any verb — the six every command takes plus
|
|
63
|
+
* `install`'s own. Anything else is a typo and is reported: this command
|
|
64
|
+
* builds its request body from named flags, so a dropped `--evn` would install
|
|
65
|
+
* an app with none of the environment the caller meant to give it, and exit 0.
|
|
66
|
+
* Same rule (and same reasoning) as `runResourceCommand` in ../index.ts. */
|
|
67
|
+
const APP_FLAG_NAMES = new Set([
|
|
68
|
+
'help',
|
|
69
|
+
'json',
|
|
70
|
+
'yes',
|
|
71
|
+
'url',
|
|
72
|
+
'key',
|
|
73
|
+
'config',
|
|
74
|
+
'version',
|
|
75
|
+
'commit',
|
|
76
|
+
'env',
|
|
77
|
+
'env-file',
|
|
78
|
+
'ports',
|
|
79
|
+
'wait',
|
|
80
|
+
]);
|
|
81
|
+
function isVerb(v) {
|
|
82
|
+
return !!v && VERBS.includes(v);
|
|
83
|
+
}
|
|
84
|
+
/** How long `install --wait` polls before giving up and telling the caller to
|
|
85
|
+
* poll by hand — generous because a cold Docker build can legitimately take
|
|
86
|
+
* minutes (matches the installer's own default build budget, see
|
|
87
|
+
* AppRestoreConfig.buildTimeoutMs in src/apps/installer.ts). */
|
|
88
|
+
const WAIT_TIMEOUT_MS = 30 * 60 * 1000;
|
|
89
|
+
const WAIT_POLL_INTERVAL_MS = 1500;
|
|
90
|
+
const ENV_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
91
|
+
/** A port as an operator writes one: decimal digits, nothing else. Deliberately
|
|
92
|
+
* stricter than `Number()`, which happily accepts `0x1F90`, `1e3`, `+8080` and
|
|
93
|
+
* ` 8080 ` — all integers by `Number.isInteger`, none of them a form the
|
|
94
|
+
* server, a compose file, or the person reading `docker ps` would recognise.
|
|
95
|
+
* `0x1F90` silently becoming 8080 is the worst of them: it binds a port the
|
|
96
|
+
* caller never named. Leading zeros are left to the server's range check. */
|
|
97
|
+
const PORT_RE = /^\d+$/;
|
|
98
|
+
/** `--env KEY=VALUE[,KEY=VALUE...]` → the `env_vars` object the install body
|
|
99
|
+
* expects. Shares its list parsing with `service --env` (see
|
|
100
|
+
* parseKeyValueList in ../args.ts); the systemd-only reserved-key check has
|
|
101
|
+
* no equivalent here — an app's reserved names are declared in its own
|
|
102
|
+
* app.yaml, not known to this command, so the server is the one place that
|
|
103
|
+
* can validate them. Returns null (message already on stderr) on malformed
|
|
104
|
+
* input. */
|
|
105
|
+
function parseEnvFlag(raw) {
|
|
106
|
+
const pairs = (0, args_1.parseKeyValueList)('env', raw, 'KEY=VALUE');
|
|
107
|
+
if (pairs === null)
|
|
108
|
+
return null;
|
|
109
|
+
const out = {};
|
|
110
|
+
for (const { key, value } of pairs) {
|
|
111
|
+
if (!ENV_KEY_RE.test(key)) {
|
|
112
|
+
process.stderr.write(`Invalid --env key "${key}" — must match [A-Za-z_][A-Za-z0-9_]*.\n`);
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
out[key] = value;
|
|
116
|
+
}
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
119
|
+
/** `--env-file <path>` → the same `env_vars` map `--env` builds, read from a
|
|
120
|
+
* dotenv file so a secret never has to appear in the command line at all.
|
|
121
|
+
* That matters here specifically: every value passed as `--env API_KEY=…` is
|
|
122
|
+
* visible to any local user in `/proc/<pid>/cmdline` for as long as the
|
|
123
|
+
* command runs, and is written verbatim into the caller's shell history.
|
|
124
|
+
* Same flag name and same purpose as `service install --env-file`, and the
|
|
125
|
+
* file is parsed by the shared `parseDotenv()` so an `.env` that works for
|
|
126
|
+
* the gateway works here too. Returns null (message already on stderr) when
|
|
127
|
+
* the file cannot be read or holds an invalid key. */
|
|
128
|
+
function parseEnvFileFlag(raw) {
|
|
129
|
+
if (raw === undefined)
|
|
130
|
+
return {};
|
|
131
|
+
if (typeof raw !== 'string' || raw.trim() === '') {
|
|
132
|
+
// Distinct from "not passed": the schema-less parser hands over a flag
|
|
133
|
+
// with nothing after it as boolean `true`, and reading that as "omitted"
|
|
134
|
+
// would install the app with none of the secrets the caller meant to give.
|
|
135
|
+
process.stderr.write('--env-file requires a path.\n');
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
const file = path.resolve((0, http_client_1.expandHome)(raw));
|
|
139
|
+
let text;
|
|
140
|
+
try {
|
|
141
|
+
text = fs.readFileSync(file, 'utf8');
|
|
142
|
+
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
process.stderr.write(`Could not read --env-file ${file}: ${err.message}\n`);
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
const out = {};
|
|
148
|
+
for (const { key, value } of (0, load_dotenv_1.parseDotenv)(text)) {
|
|
149
|
+
if (!ENV_KEY_RE.test(key)) {
|
|
150
|
+
// The key, never the value — this message goes to a terminal, and the
|
|
151
|
+
// file it is describing is the one holding the secrets.
|
|
152
|
+
process.stderr.write(`Invalid key "${key}" in ${file} — must match [A-Za-z_][A-Za-z0-9_]*.\n`);
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
out[key] = value;
|
|
156
|
+
}
|
|
157
|
+
return out;
|
|
158
|
+
}
|
|
159
|
+
/** `--ports NAME=PORT[,NAME=PORT...]` → the `ports` host-port-override object.
|
|
160
|
+
* Only the shape (decimal port numbers) is checked here; the port-number
|
|
161
|
+
* floor/ban list and "is this a port the app declares" are enforced
|
|
162
|
+
* server-side (see parsePortsField in apps-router.ts), since this command has
|
|
163
|
+
* no access to the app's app.yaml to check port names against. */
|
|
164
|
+
function parsePortsFlag(raw) {
|
|
165
|
+
const pairs = (0, args_1.parseKeyValueList)('ports', raw, 'NAME=PORT');
|
|
166
|
+
if (pairs === null)
|
|
167
|
+
return null;
|
|
168
|
+
const out = {};
|
|
169
|
+
for (const { key, value } of pairs) {
|
|
170
|
+
// Note this rejects an empty value too: `Number('')` is 0, not NaN, so a
|
|
171
|
+
// bare "web=" (a typo dropping the port number) would otherwise become
|
|
172
|
+
// port 0 — which the server rejects, but with a confusing "must be at
|
|
173
|
+
// least 1024" instead of the malformed input it actually is.
|
|
174
|
+
if (!PORT_RE.test(value.trim())) {
|
|
175
|
+
process.stderr.write(`Invalid --ports value for "${key}" — "${value}" is not a decimal port number.\n`);
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
out[key] = Number(value.trim());
|
|
179
|
+
}
|
|
180
|
+
return out;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Classify a single `<source>` positional the same way an operator would read
|
|
184
|
+
* it, so `app install` needs no separate `--registry-app`/`--github-url`/
|
|
185
|
+
* `--local-path` flags for the common case:
|
|
186
|
+
* - `https://...` / `http://...` → a GitHub URL (server validates the host)
|
|
187
|
+
* - `/...`, `./...`, `../...`, `~`, `~/...` → a local path (resolved to absolute —
|
|
188
|
+
* the API requires one)
|
|
189
|
+
* - anything else → a registry app name
|
|
190
|
+
* This is a pure client-side convenience; the server still validates the value
|
|
191
|
+
* makes sense for the mode it was sent in.
|
|
192
|
+
*
|
|
193
|
+
* A bare `~other-user/...` (not `~` or `~/`) deliberately falls through to the
|
|
194
|
+
* registry-app case rather than being treated as local: `expandHome()` only
|
|
195
|
+
* expands the current user's home, so resolving that form would silently
|
|
196
|
+
* produce a bogus path with a literal `~other-user` path segment instead of
|
|
197
|
+
* either the intended home directory or a clear error.
|
|
198
|
+
*/
|
|
199
|
+
function parseInstallSource(source) {
|
|
200
|
+
if (/^https?:\/\//i.test(source))
|
|
201
|
+
return { github_url: source };
|
|
202
|
+
if (source.startsWith('/') || source.startsWith('./') || source.startsWith('../') || source === '~' || source.startsWith('~/')) {
|
|
203
|
+
return { local_path: path.resolve((0, http_client_1.expandHome)(source)) };
|
|
204
|
+
}
|
|
205
|
+
return { registry_app: source };
|
|
206
|
+
}
|
|
207
|
+
function strFlag(v) {
|
|
208
|
+
return typeof v === 'string' ? v : undefined;
|
|
209
|
+
}
|
|
210
|
+
/** The job as it goes to stdout: the same object, with its log lines redacted
|
|
211
|
+
* exactly like the copy streamed to stderr. `printResult(job)` serialises the
|
|
212
|
+
* whole `JobState`, `logs` included, so printing it raw would undo — in the
|
|
213
|
+
* same command — the redaction two lines above it. */
|
|
214
|
+
function redactedJob(job) {
|
|
215
|
+
return job.logs ? { ...job, logs: (0, redact_1.redactLines)(job.logs) } : job;
|
|
216
|
+
}
|
|
217
|
+
/** Poll `GET /v1/apps/jobs/:jobId` until it settles, streaming new log lines
|
|
218
|
+
* to stderr as they appear (redacted defensively — see redact.ts — even
|
|
219
|
+
* though install logs are documented to name secrets, never their values).
|
|
220
|
+
* stdout gets exactly one JSON result, printed once the job is done, so
|
|
221
|
+
* `--json` output stays a single parseable value.
|
|
222
|
+
*
|
|
223
|
+
* A single poll that fails to reach the gateway (a brief network blip, or
|
|
224
|
+
* the gateway momentarily busy building the very app being installed) is
|
|
225
|
+
* reported and retried rather than aborting the whole wait — the install job
|
|
226
|
+
* itself keeps running server-side regardless of whether this one poll could
|
|
227
|
+
* reach it, so throwing here would trade a transient hiccup for a spurious
|
|
228
|
+
* "it failed" when the job was fine. */
|
|
229
|
+
async function waitForJob(baseUrl, key, jobId, flags) {
|
|
230
|
+
const compact = flags.json === true;
|
|
231
|
+
const deadline = Date.now() + WAIT_TIMEOUT_MS;
|
|
232
|
+
let seenLogs = 0;
|
|
233
|
+
for (;;) {
|
|
234
|
+
let job;
|
|
235
|
+
try {
|
|
236
|
+
const result = await (0, http_client_1.request)({ method: 'GET', path: `/v1/apps/jobs/${encodeURIComponent(jobId)}`, baseUrl, key });
|
|
237
|
+
job = result.data;
|
|
238
|
+
}
|
|
239
|
+
catch (err) {
|
|
240
|
+
if (!(err instanceof http_client_1.TransportError)) {
|
|
241
|
+
// The gateway answered with an error — most commonly 404 "Job not
|
|
242
|
+
// found" if it restarted mid-install (job state is in-memory, see
|
|
243
|
+
// AppInstaller.getJob in src/apps/installer.ts) or 401/403 if the key
|
|
244
|
+
// was revoked. Retrying for up to 30 minutes would never help here,
|
|
245
|
+
// unlike a transport failure below.
|
|
246
|
+
process.stderr.write(`Could not poll job ${jobId}: ${err.message}\n`);
|
|
247
|
+
return 1;
|
|
248
|
+
}
|
|
249
|
+
if (Date.now() >= deadline) {
|
|
250
|
+
process.stderr.write(`Still waiting on job ${jobId}, and the last poll failed: ${err.message}\n` +
|
|
251
|
+
`Check it with: claude-gateway api GET /v1/apps/jobs/${jobId}\n`);
|
|
252
|
+
return 1;
|
|
253
|
+
}
|
|
254
|
+
process.stderr.write(`Poll failed, retrying: ${err.message}\n`);
|
|
255
|
+
await new Promise((resolve) => setTimeout(resolve, WAIT_POLL_INTERVAL_MS));
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
const logs = job.logs ?? [];
|
|
259
|
+
for (; seenLogs < logs.length; seenLogs++) {
|
|
260
|
+
process.stderr.write((0, redact_1.redactLine)(logs[seenLogs]) + '\n');
|
|
261
|
+
}
|
|
262
|
+
if (job.status === 'completed') {
|
|
263
|
+
(0, output_1.printResult)(redactedJob(job), compact);
|
|
264
|
+
return 0;
|
|
265
|
+
}
|
|
266
|
+
if (job.status === 'failed') {
|
|
267
|
+
(0, output_1.printResult)(redactedJob(job), compact);
|
|
268
|
+
process.stderr.write(`Install failed: ${job.error ?? 'unknown error'}\n`);
|
|
269
|
+
return 1;
|
|
270
|
+
}
|
|
271
|
+
if (Date.now() >= deadline) {
|
|
272
|
+
process.stderr.write(`Still ${job.status} after ${Math.round(WAIT_TIMEOUT_MS / 60000)}m — giving up waiting, but the job itself keeps running.\n` +
|
|
273
|
+
`Check it with: claude-gateway api GET /v1/apps/jobs/${jobId}\n`);
|
|
274
|
+
return 1;
|
|
275
|
+
}
|
|
276
|
+
await new Promise((resolve) => setTimeout(resolve, WAIT_POLL_INTERVAL_MS));
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
/** `install`'s request body, or null when the caller's own input was wrong
|
|
280
|
+
* (message already on stderr). Built before any network call so a bad flag is
|
|
281
|
+
* reported on its own — see the note in `runApp`. */
|
|
282
|
+
function buildInstallBody(source, flags) {
|
|
283
|
+
const sourceBody = parseInstallSource(source);
|
|
284
|
+
const version = strFlag(flags.version);
|
|
285
|
+
const commit = strFlag(flags.commit);
|
|
286
|
+
if (version !== undefined && !sourceBody.registry_app) {
|
|
287
|
+
process.stderr.write('--version only applies to a registry source (a plain app name).\n');
|
|
288
|
+
return null;
|
|
289
|
+
}
|
|
290
|
+
if (commit !== undefined && !sourceBody.github_url) {
|
|
291
|
+
process.stderr.write('--commit only applies to a GitHub source (an http(s):// URL).\n');
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
const envVars = parseEnvFlag(flags.env);
|
|
295
|
+
if (envVars === null)
|
|
296
|
+
return null;
|
|
297
|
+
const fileEnv = parseEnvFileFlag(flags['env-file']);
|
|
298
|
+
if (fileEnv === null)
|
|
299
|
+
return null;
|
|
300
|
+
const portOverrides = parsePortsFlag(flags.ports);
|
|
301
|
+
if (portOverrides === null)
|
|
302
|
+
return null;
|
|
303
|
+
// `--env` wins on a conflict: it is the more specific of the two, named
|
|
304
|
+
// right here in the invocation, and it is how `docker run` resolves the same
|
|
305
|
+
// overlap — so a one-off `--env PORT=…` overrides the checked-in file
|
|
306
|
+
// without editing it.
|
|
307
|
+
const env = { ...fileEnv, ...envVars };
|
|
308
|
+
const body = { ...sourceBody };
|
|
309
|
+
if (version !== undefined)
|
|
310
|
+
body.version = version;
|
|
311
|
+
if (commit !== undefined)
|
|
312
|
+
body.commit = commit;
|
|
313
|
+
if (Object.keys(env).length)
|
|
314
|
+
body.env_vars = env;
|
|
315
|
+
if (Object.keys(portOverrides).length)
|
|
316
|
+
body.ports = portOverrides;
|
|
317
|
+
return body;
|
|
318
|
+
}
|
|
319
|
+
async function runApp(positionals, flags, config) {
|
|
320
|
+
const verb = positionals[0];
|
|
321
|
+
if (!verb || flags.help === true) {
|
|
322
|
+
// An explicit `--help` succeeds; a missing verb is a usage error.
|
|
323
|
+
printHelp(flags.help === true);
|
|
324
|
+
return flags.help === true ? 0 : 1;
|
|
325
|
+
}
|
|
326
|
+
if (!isVerb(verb)) {
|
|
327
|
+
process.stderr.write(`Unknown: app ${verb} (expected ${VERBS.join('|')})\n\n`);
|
|
328
|
+
printHelp(false);
|
|
329
|
+
return 1;
|
|
330
|
+
}
|
|
331
|
+
const unknown = (0, args_1.unknownFlagNames)(flags, APP_FLAG_NAMES);
|
|
332
|
+
if (unknown.length) {
|
|
333
|
+
process.stderr.write(`Unknown flag(s): ${unknown.map((f) => `--${f}`).join(' ')}\n\n`);
|
|
334
|
+
printHelp(false);
|
|
335
|
+
return 1;
|
|
336
|
+
}
|
|
337
|
+
// Everything wrong with the invocation itself is reported before the first
|
|
338
|
+
// network call. `resolveReachableUrl()` probes /health and, when it falls
|
|
339
|
+
// back, writes "Cannot reach the gateway at … using …" to stderr — printed
|
|
340
|
+
// above the "Missing argument" that is the actual problem, that reads as a
|
|
341
|
+
// connectivity failure for a command that was never going to make a request.
|
|
342
|
+
const name = positionals[1];
|
|
343
|
+
if (verb !== 'list' && !name) {
|
|
344
|
+
process.stderr.write(`Missing argument: app ${verb} <${verb === 'install' ? 'source' : 'name'}>\n\n`);
|
|
345
|
+
printHelp(false);
|
|
346
|
+
return 1;
|
|
347
|
+
}
|
|
348
|
+
const installBody = verb === 'install' ? buildInstallBody(name, flags) : undefined;
|
|
349
|
+
if (installBody === null)
|
|
350
|
+
return 1;
|
|
351
|
+
const baseUrl = await (0, http_client_1.resolveReachableUrl)((0, http_client_1.resolveUrlPlan)({ flagUrl: strFlag(flags.url), env: process.env, config }));
|
|
352
|
+
const key = (0, http_client_1.resolveKey)({ flagKey: strFlag(flags.key), env: process.env, config });
|
|
353
|
+
const compact = flags.json === true;
|
|
354
|
+
if (verb === 'list') {
|
|
355
|
+
const result = await (0, http_client_1.request)({ method: 'GET', path: '/v1/apps', baseUrl, key });
|
|
356
|
+
(0, output_1.printResult)(result.data, compact);
|
|
357
|
+
return 0;
|
|
358
|
+
}
|
|
359
|
+
if (verb === 'start' || verb === 'stop' || verb === 'restart') {
|
|
360
|
+
const result = await (0, http_client_1.request)({ method: 'POST', path: `/v1/apps/${encodeURIComponent(name)}/${verb}`, baseUrl, key });
|
|
361
|
+
(0, output_1.printResult)(result.data, compact);
|
|
362
|
+
return 0;
|
|
363
|
+
}
|
|
364
|
+
if (verb === 'uninstall') {
|
|
365
|
+
// No new implicit data deletion beyond what the API already does: this
|
|
366
|
+
// removes the app's containers and installed files, but never its backups
|
|
367
|
+
// (see DELETE /v1/apps/:name in apps-router.ts) — the confirmation prompt
|
|
368
|
+
// says exactly that, not a vaguer "delete everything". Only `uninstall`
|
|
369
|
+
// asks; start/stop/restart/install destroy nothing.
|
|
370
|
+
if (!(await (0, prompt_1.confirmAction)(flags, 'uninstall', `Uninstall app "${name}"? This removes its containers and installed files (backups are kept).`))) {
|
|
371
|
+
process.stderr.write('Aborted — the app was left in place.\n');
|
|
372
|
+
return 1;
|
|
373
|
+
}
|
|
374
|
+
const result = await (0, http_client_1.request)({ method: 'DELETE', path: `/v1/apps/${encodeURIComponent(name)}`, baseUrl, key });
|
|
375
|
+
(0, output_1.printResult)(result.data, compact);
|
|
376
|
+
return 0;
|
|
377
|
+
}
|
|
378
|
+
// verb === 'install'
|
|
379
|
+
const result = await (0, http_client_1.request)({ method: 'POST', path: '/v1/apps/install', baseUrl, key, body: installBody });
|
|
380
|
+
const jobId = result.data?.jobId;
|
|
381
|
+
if (flags.wait === true && jobId) {
|
|
382
|
+
return await waitForJob(baseUrl, key, jobId, flags);
|
|
383
|
+
}
|
|
384
|
+
(0, output_1.printResult)(result.data, compact);
|
|
385
|
+
// Accepted is not installed — the job runs in the background. Never claim
|
|
386
|
+
// success here; only --wait (or a manual poll) reports the real outcome.
|
|
387
|
+
if (jobId) {
|
|
388
|
+
process.stderr.write(`Install accepted (job ${jobId}) — this does not mean it finished. Check it with:\n` +
|
|
389
|
+
` claude-gateway api GET /v1/apps/jobs/${jobId}\n` +
|
|
390
|
+
`or re-run with --wait to follow it here.\n`);
|
|
391
|
+
}
|
|
392
|
+
return 0;
|
|
393
|
+
}
|
|
394
|
+
function printHelp(requested) {
|
|
395
|
+
const rows = [
|
|
396
|
+
['app list', 'List installed apps and their status'],
|
|
397
|
+
['app start <name>', 'Start a stopped app'],
|
|
398
|
+
['app stop <name>', 'Stop a running app'],
|
|
399
|
+
['app restart <name>', 'Restart an app'],
|
|
400
|
+
['app uninstall <name> [--yes]', "Remove an app's containers and installed files (keeps backups)"],
|
|
401
|
+
[
|
|
402
|
+
'app install <source> [--version <v>] [--commit <sha>] [--env K=V,...] [--env-file <path>] [--ports NAME=PORT,...] [--wait]',
|
|
403
|
+
'Install from the registry (plain name), a GitHub URL, or a local path (/, ./, ../, ~)',
|
|
404
|
+
],
|
|
405
|
+
];
|
|
406
|
+
const width = Math.max(...rows.map(([usage]) => usage.length)) + 2;
|
|
407
|
+
const lines = rows.map(([usage, desc]) => ` ${usage.padEnd(width)}${desc}`);
|
|
408
|
+
lines.push('', ' --env-file reads KEY=VALUE lines from a dotenv file, so secrets need not appear in the', ' command line (where /proc and shell history expose them); --env wins on a conflict.', ' <source> is classified by shape: an http(s):// URL is a GitHub source, a path starting', ' with /, ./, ../, or ~ is a local (symlinked) source, anything else is a registry app name.', ' install is asynchronous — it returns a jobId immediately (never reports "installed" on', ' its own). Poll it with `claude-gateway api GET /v1/apps/jobs/<jobId>`, or pass --wait to', ' have this command poll and report the real outcome.');
|
|
409
|
+
(0, output_1.writeCommandHelp)(requested, 'app', 'manage installed Docker-compose apps (wraps the /v1/apps REST API)', 'claude-gateway app <list|start|stop|restart|uninstall|install> [args] [--flags]', lines);
|
|
410
|
+
}
|
|
411
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,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AAE,qBAAqB,CAAC;QAC3C,CAAC,iBAAiB,EAAE,oBAAoB,CAAC;QACzC,CAAC,oBAAoB,EAAE,gBAAgB,CAAC;QACxC,CAAC,8BAA8B,EAAE,gEAAgE,CAAC;QAClG;YACE,4HAA4H;YAC5H,uFAAuF;SACxF;KACF,CAAC;IACF,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;IACnE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;IAC7E,KAAK,CAAC,IAAI,CACR,EAAE,EACF,0FAA0F,EAC1F,uFAAuF,EACvF,0FAA0F,EAC1F,8FAA8F,EAC9F,0FAA0F,EAC1F,4FAA4F,EAC5F,uDAAuD,CACxD,CAAC;IACF,IAAA,yBAAgB,EACd,SAAS,EACT,KAAK,EACL,oEAAoE,EACpE,iFAAiF,EACjF,KAAK,CACN,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA2C,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA2C,MAAM,gBAAgB,CAAC;AAyCxF,wBAAsB,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAqK/G"}
|
|
@@ -6,11 +6,12 @@ const health_1 = require("../health");
|
|
|
6
6
|
const manager_1 = require("../manager");
|
|
7
7
|
const output_1 = require("../output");
|
|
8
8
|
const colors_1 = require("../colors");
|
|
9
|
+
const url_1 = require("../../cli-viewer/url");
|
|
9
10
|
function printHelp() {
|
|
10
11
|
const c = (0, colors_1.paletteFor)((0, output_1.helpStream)(true));
|
|
11
12
|
(0, output_1.writeCommandHelp)(true, 'doctor', 'check config, key resolution, manager and connectivity', 'claude-gateway doctor [--url <url>] [--key <key>] [--config <path>] [--json]', [
|
|
12
|
-
` Exits 0 when every check passes. Rows marked ${c.dim('[--]')} are informational and`,
|
|
13
|
-
'
|
|
13
|
+
` Exits 0 when every check passes. Rows marked ${c.dim('[--]')} are informational and ${c.yellow('[warn]')}`,
|
|
14
|
+
' rows are advisory — neither fails the command. The key itself is never printed.',
|
|
14
15
|
]);
|
|
15
16
|
}
|
|
16
17
|
async function runDoctor(flags, config) {
|
|
@@ -48,7 +49,75 @@ async function runDoctor(flags, config) {
|
|
|
48
49
|
});
|
|
49
50
|
const health = await (0, health_1.probeHealth)(baseUrl);
|
|
50
51
|
checks.push({ name: 'health', ok: health.ok, detail: health.detail });
|
|
52
|
+
// Shared by the new check below and the alt-address block further down —
|
|
53
|
+
// both describe `config.publicUrl`, and using one normalizer (rather than
|
|
54
|
+
// each hand-rolling trim/strip) keeps them from silently disagreeing on
|
|
55
|
+
// what "the same URL" means.
|
|
56
|
+
const normalizedPublicUrl = (0, url_1.normalizePublicUrl)(config.publicUrl) ?? '';
|
|
51
57
|
// A gateway fronted by a reverse proxy has two addresses for one process.
|
|
58
|
+
// Resolved here (selection only, no network call yet) so the new
|
|
59
|
+
// gatewayPublicUrl check below can detect when it's about to probe the
|
|
60
|
+
// identical URL and share one fetch instead of firing two.
|
|
61
|
+
const alt = baseUrl === localUrl
|
|
62
|
+
? normalizedPublicUrl && normalizedPublicUrl !== baseUrl
|
|
63
|
+
? { urlName: 'publicUrl', healthName: 'publicHealth', url: normalizedPublicUrl }
|
|
64
|
+
: undefined
|
|
65
|
+
: manager !== 'unknown'
|
|
66
|
+
? { urlName: 'localUrl', healthName: 'localHealth', url: localUrl }
|
|
67
|
+
: undefined;
|
|
68
|
+
let altHealth;
|
|
69
|
+
// #472: gateway.publicUrl backs every feature that hands out a public link
|
|
70
|
+
// (generate_image reference edits, share_file, /cli). Nothing else in
|
|
71
|
+
// `doctor` checks for its presence — the row below (`publicUrl`/`publicHealth`)
|
|
72
|
+
// only exists when the value happens to be set, and stays silent otherwise.
|
|
73
|
+
// Gated on `diagnosingThisHost` like `manager` above: this is this host's own
|
|
74
|
+
// config file, so it is noise (and a config leak) when --url points elsewhere.
|
|
75
|
+
if (diagnosingThisHost) {
|
|
76
|
+
const gatewayPublicUrl = normalizedPublicUrl;
|
|
77
|
+
if (!gatewayPublicUrl) {
|
|
78
|
+
checks.push({
|
|
79
|
+
name: 'gatewayPublicUrl',
|
|
80
|
+
ok: true,
|
|
81
|
+
warn: true,
|
|
82
|
+
detail: 'not set — generate_image reference edits, share_file, and /cli will not work (see README "gateway.publicUrl")',
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
else if (/\$\{[^}]+\}/.test(gatewayPublicUrl)) {
|
|
86
|
+
// `loadCliConfig` (http-client.ts) reads config.json directly and does not
|
|
87
|
+
// interpolate ${VAR} placeholders like the gateway process's own loader
|
|
88
|
+
// does — this CLI invocation may not even share that env. Probing the
|
|
89
|
+
// literal placeholder string always fails, which would report a healthy,
|
|
90
|
+
// correctly configured gateway as broken. Configured-but-unverifiable is
|
|
91
|
+
// not a failure.
|
|
92
|
+
checks.push({
|
|
93
|
+
name: 'gatewayPublicUrl',
|
|
94
|
+
ok: true,
|
|
95
|
+
info: true,
|
|
96
|
+
detail: `configured (${gatewayPublicUrl}) — contains an unresolved \${VAR}; reachability cannot be checked from the CLI`,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
// Reuse an existing probe of the identical URL rather than firing a
|
|
101
|
+
// second one: `health` already covers the no-proxy case (publicUrl ==
|
|
102
|
+
// baseUrl), and the alt block below covers the reverse-proxy case
|
|
103
|
+
// (publicUrl == alt.url). Two independent probes of the same address a
|
|
104
|
+
// few hundred ms apart can disagree under a flaky/loaded proxy, which
|
|
105
|
+
// would otherwise show up as two contradictory rows for one fact.
|
|
106
|
+
const shareHealth = gatewayPublicUrl === baseUrl
|
|
107
|
+
? health
|
|
108
|
+
: alt?.urlName === 'publicUrl'
|
|
109
|
+
? (altHealth = await (0, health_1.probeHealth)(alt.url))
|
|
110
|
+
: await (0, health_1.probeHealth)(gatewayPublicUrl);
|
|
111
|
+
// `answered`, not `ok`: a proxy that answers 401/403 to an unauthenticated
|
|
112
|
+
// probe is up and doing its job, not unreachable — same reasoning as the
|
|
113
|
+
// publicHealth note below. Only "nothing answered at all" is a real fail.
|
|
114
|
+
checks.push({
|
|
115
|
+
name: 'gatewayPublicUrl',
|
|
116
|
+
ok: shareHealth.answered,
|
|
117
|
+
detail: shareHealth.answered ? `reachable (${gatewayPublicUrl})` : `unreachable: ${shareHealth.detail}`,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
52
121
|
// Probe the one the CLI is *not* using as well: without it, the most
|
|
53
122
|
// confusing states — proxy down while the gateway is healthy, or the reverse
|
|
54
123
|
// — appear as a single contradictory line with nothing to explain it. The
|
|
@@ -59,27 +128,19 @@ async function runDoctor(flags, config) {
|
|
|
59
128
|
// somewhere else. Passing the flag through would make it echo the target back
|
|
60
129
|
// as its own alternative, and then offer this host's publicUrl as context for
|
|
61
130
|
// a question about another host entirely.
|
|
62
|
-
const publicUrl = (config.publicUrl ?? '').replace(/\/+$/, '');
|
|
63
|
-
const alt = baseUrl === localUrl
|
|
64
|
-
? publicUrl && publicUrl !== baseUrl
|
|
65
|
-
? { urlName: 'publicUrl', healthName: 'publicHealth', url: publicUrl }
|
|
66
|
-
: undefined
|
|
67
|
-
: manager !== 'unknown'
|
|
68
|
-
? { urlName: 'localUrl', healthName: 'localHealth', url: localUrl }
|
|
69
|
-
: undefined;
|
|
70
|
-
let altHealth;
|
|
71
131
|
if (alt) {
|
|
72
132
|
checks.push({ name: alt.urlName, ok: true, detail: alt.url, info: true });
|
|
73
|
-
altHealth = await (0, health_1.probeHealth)(alt.url);
|
|
133
|
+
altHealth = altHealth ?? (await (0, health_1.probeHealth)(alt.url));
|
|
74
134
|
checks.push({ name: alt.healthName, ok: altHealth.ok, detail: altHealth.detail, info: true });
|
|
75
135
|
}
|
|
76
|
-
const allOk = checks.every((c) => c.info || c.ok);
|
|
136
|
+
const allOk = checks.every((c) => c.info || c.warn || c.ok);
|
|
77
137
|
const c = (0, colors_1.paletteFor)(process.stderr);
|
|
78
138
|
// Pad before colouring so escape codes never count toward the column width.
|
|
79
139
|
const lines = checks.map((chk) => {
|
|
80
|
-
// `info`
|
|
81
|
-
// passed or not, so the reader can tell the verdict rows from
|
|
82
|
-
|
|
140
|
+
// `warn`/`info` are checked first: an advisory row is marked distinctly
|
|
141
|
+
// whether it passed or not, so the reader can tell the verdict rows from
|
|
142
|
+
// the context.
|
|
143
|
+
const mark = chk.warn ? c.yellow('[warn]') : chk.info ? c.dim('[--]') : chk.ok ? c.green('[ok]') : c.red('[!!]');
|
|
83
144
|
return ` ${mark} ${c.bold(chk.name.padEnd(12))} ${chk.detail}`;
|
|
84
145
|
});
|
|
85
146
|
// Name the right component. A public URL that answered with a status is not
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../../src/cli/commands/doctor.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../../src/cli/commands/doctor.ts"],"names":[],"mappings":";;AAyCA,8BAqKC;AA9MD,gDAAwF;AACxF,sCAAqD;AACrD,wCAA2C;AAC3C,sCAAoE;AACpE,sCAAuC;AACvC,8CAA0D;AAsB1D,SAAS,SAAS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R,KAAK,CAAC,CAAC,MAAM,CACX,SAAS,CAAC,QAAQ;gBAChB,CAAC,CAAC,0EAA0E,SAAS,CAAC,MAAM,kJAAkJ;gBAC9O,CAAC,CAAC,gIAAgI,CACrI,EAAE,CACJ,CAAC;QACJ,CAAC;aAAM,IAAI,GAAG,CAAC,OAAO,KAAK,UAAU,IAAI,SAAS,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;YACpE,KAAK,CAAC,IAAI,CACR,KAAK,CAAC,CAAC,MAAM,CACX,MAAM,CAAC,QAAQ;gBACb,CAAC,CAAC,sFAAsF,MAAM,CAAC,MAAM,8FAA8F,QAAQ,WAAW;gBACtN,CAAC,CAAC,+HAA+H,QAAQ,WAAW,CACvJ,EAAE,CACJ,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,EAAE,EAAE,GAAG,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACtF,IAAA,kBAAS,EAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,CAAC,CAAC;IACxC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAmB,MAAM,gBAAgB,CAAC;AAmEhE,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,KAAK,CAAC;AAE/C;uEACuE;AACvE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,CAAC;AA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