@0xmaxma/claude-gateway 1.8.3 → 1.8.5

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.
Files changed (88) hide show
  1. package/README.md +58 -1
  2. package/config.template.json +5 -3
  3. package/dist/agent/model-catalog.d.ts.map +1 -1
  4. package/dist/agent/model-catalog.js +5 -13
  5. package/dist/agent/model-catalog.js.map +1 -1
  6. package/dist/agent/runner.d.ts +1 -1
  7. package/dist/agent/runner.d.ts.map +1 -1
  8. package/dist/agent/runner.js +22 -3
  9. package/dist/agent/runner.js.map +1 -1
  10. package/dist/api/apps-router.d.ts.map +1 -1
  11. package/dist/api/apps-router.js +31 -9
  12. package/dist/api/apps-router.js.map +1 -1
  13. package/dist/api/gateway-router.js +1 -1
  14. package/dist/api/gateway-router.js.map +1 -1
  15. package/dist/api/share-router.d.ts +8 -0
  16. package/dist/api/share-router.d.ts.map +1 -1
  17. package/dist/api/share-router.js +100 -10
  18. package/dist/api/share-router.js.map +1 -1
  19. package/dist/apps/agent-manager.d.ts +35 -2
  20. package/dist/apps/agent-manager.d.ts.map +1 -1
  21. package/dist/apps/agent-manager.js +131 -15
  22. package/dist/apps/agent-manager.js.map +1 -1
  23. package/dist/apps/installer.d.ts +41 -1
  24. package/dist/apps/installer.d.ts.map +1 -1
  25. package/dist/apps/installer.js +52 -3
  26. package/dist/apps/installer.js.map +1 -1
  27. package/dist/cli/commands/debug-bundle.d.ts.map +1 -1
  28. package/dist/cli/commands/debug-bundle.js +9 -52
  29. package/dist/cli/commands/debug-bundle.js.map +1 -1
  30. package/dist/cli/commands/gateway.d.ts +6 -1
  31. package/dist/cli/commands/gateway.d.ts.map +1 -1
  32. package/dist/cli/commands/gateway.js +14 -3
  33. package/dist/cli/commands/gateway.js.map +1 -1
  34. package/dist/cli/commands/logs.d.ts +37 -0
  35. package/dist/cli/commands/logs.d.ts.map +1 -0
  36. package/dist/cli/commands/logs.js +429 -0
  37. package/dist/cli/commands/logs.js.map +1 -0
  38. package/dist/cli/index.d.ts.map +1 -1
  39. package/dist/cli/index.js +21 -4
  40. package/dist/cli/index.js.map +1 -1
  41. package/dist/cli/logs-dir.d.ts +69 -0
  42. package/dist/cli/logs-dir.d.ts.map +1 -0
  43. package/dist/cli/logs-dir.js +166 -0
  44. package/dist/cli/logs-dir.js.map +1 -0
  45. package/dist/cli/output.d.ts +34 -0
  46. package/dist/cli/output.d.ts.map +1 -1
  47. package/dist/cli/output.js +56 -10
  48. package/dist/cli/output.js.map +1 -1
  49. package/dist/config/claude-settings.d.ts +41 -0
  50. package/dist/config/claude-settings.d.ts.map +1 -0
  51. package/dist/config/claude-settings.js +102 -0
  52. package/dist/config/claude-settings.js.map +1 -0
  53. package/dist/config/watcher.d.ts.map +1 -1
  54. package/dist/config/watcher.js +5 -0
  55. package/dist/config/watcher.js.map +1 -1
  56. package/dist/index.js +36 -1
  57. package/dist/index.js.map +1 -1
  58. package/dist/logger.d.ts +52 -1
  59. package/dist/logger.d.ts.map +1 -1
  60. package/dist/logger.js +264 -2
  61. package/dist/logger.js.map +1 -1
  62. package/dist/session/process.d.ts +43 -1
  63. package/dist/session/process.d.ts.map +1 -1
  64. package/dist/session/process.js +154 -9
  65. package/dist/session/process.js.map +1 -1
  66. package/dist/share/share-store.d.ts +45 -4
  67. package/dist/share/share-store.d.ts.map +1 -1
  68. package/dist/share/share-store.js +127 -23
  69. package/dist/share/share-store.js.map +1 -1
  70. package/dist/shell/bypass-dialog.d.ts +104 -12
  71. package/dist/shell/bypass-dialog.d.ts.map +1 -1
  72. package/dist/shell/bypass-dialog.js +146 -14
  73. package/dist/shell/bypass-dialog.js.map +1 -1
  74. package/dist/shell/claude-pty-shell.js +29 -4
  75. package/dist/shell/claude-pty-shell.js.map +1 -1
  76. package/dist/shell/screen.d.ts +15 -11
  77. package/dist/shell/screen.d.ts.map +1 -1
  78. package/dist/shell/screen.js +42 -33
  79. package/dist/shell/screen.js.map +1 -1
  80. package/dist/types.d.ts +20 -0
  81. package/dist/types.d.ts.map +1 -1
  82. package/mcp/server.ts +2 -2
  83. package/mcp/tools/image/module.ts +10 -3
  84. package/mcp/tools/share-file/module.ts +169 -0
  85. package/mcp/tools/shared/share-client.ts +8 -4
  86. package/mcp/tools/telegram/receiver-server.ts +12 -2
  87. package/package.json +1 -1
  88. package/mcp/tools/share-image/module.ts +0 -120
@@ -1 +1 @@
1
- {"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/gateway.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAmB,MAAM,gBAAgB,CAAC;AAMhE;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,MAAM,EAAE,EACrB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EACvC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,MAAM,CAAC,CA8BjB"}
1
+ {"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/gateway.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAmB,MAAM,gBAAgB,CAAC;AAOhE;;;;;;;;;;;;;GAaG;AACH,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,MAAM,EAAE,EACrB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EACvC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,MAAM,CAAC,CAmCjB"}
@@ -41,20 +41,29 @@ const health_1 = require("../health");
41
41
  const manager_1 = require("../manager");
42
42
  const output_1 = require("../output");
43
43
  const output_2 = require("../output");
44
+ const logs_1 = require("./logs");
44
45
  /**
45
- * `gateway start|status|restart|stop` — whole-process lifecycle.
46
+ * `gateway start|status|restart|stop|logs` — whole-process lifecycle.
46
47
  *
47
48
  * `start` is handled by the boot entry point (src/index.ts), which recognises
48
49
  * it before the CLI is ever imported; it is listed here only so the usage text
49
50
  * and an unknown-verb error stay honest. Restart/stop must be performed by
50
51
  * whatever manager owns the process (it has to stop the very process serving
51
52
  * HTTP), so detection resolves the manager and the action is delegated to it.
53
+ *
54
+ * `logs` is the odd one out: it touches no process at all, reading the log
55
+ * files directly so it still answers when the gateway is wedged or dead. It
56
+ * lives here because the logs are the gateway's, and an operator looking for
57
+ * them looks under the noun they already know.
52
58
  */
53
59
  async function runGatewayLifecycle(positionals, flags, config) {
54
60
  const verb = positionals[0];
55
61
  if (!verb) {
56
62
  // `gateway --help` is a help request (0); a bare `gateway` is a usage error (1).
57
- (0, output_2.writeCommandHelp)(flags.help === true, 'gateway', 'manage the gateway process on this host', 'claude-gateway gateway <start|status|restart|stop>', [' start is the only command that boots a server; the rest are manager-aware.']);
63
+ (0, output_2.writeCommandHelp)(flags.help === true, 'gateway', 'manage the gateway process on this host', 'claude-gateway gateway <start|status|restart|stop|logs>', [
64
+ ' start is the only command that boots a server; status/restart/stop are manager-aware.',
65
+ ' logs reads the log files directly and works even when the gateway is dead.',
66
+ ]);
58
67
  return flags.help === true ? 0 : 1;
59
68
  }
60
69
  switch (verb) {
@@ -69,8 +78,10 @@ async function runGatewayLifecycle(positionals, flags, config) {
69
78
  return gatewayAction('restart');
70
79
  case 'stop':
71
80
  return gatewayAction('stop');
81
+ case 'logs':
82
+ return (0, logs_1.runGatewayLogs)(flags);
72
83
  default:
73
- process.stderr.write(`Unknown: gateway ${verb} (expected start|status|restart|stop)\n`);
84
+ process.stderr.write(`Unknown: gateway ${verb} (expected start|status|restart|stop|logs)\n`);
74
85
  return 1;
75
86
  }
76
87
  }
@@ -1 +1 @@
1
- {"version":3,"file":"gateway.js","sourceRoot":"","sources":["../../../src/cli/commands/gateway.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,kDAkCC;AAnDD,iDAA6C;AAC7C,uCAAyB;AACzB,gDAAgE;AAChE,sCAAwC;AACxC,wCAAoF;AACpF,sCAAsC;AACtC,sCAA6C;AAE7C;;;;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B,CAAC;AACH,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Render one stored line as `<ts> <level> <message>` with `data` appended
3
+ * compactly.
4
+ *
5
+ * A line that is not a gateway log record is passed through verbatim rather
6
+ * than dropped or replaced with a placeholder: anything already in the file is
7
+ * something the operator may need to see, and a reader that silently discards
8
+ * what it does not recognise is how a corrupt tail looks like an idle gateway.
9
+ */
10
+ export declare function formatLogLine(line: string): string;
11
+ /**
12
+ * The last `count` lines of `file`, oldest first, with the offset they were
13
+ * read to.
14
+ *
15
+ * Reads backwards in chunks so the cost is bounded by what is asked for rather
16
+ * than by the size of the file.
17
+ *
18
+ * `endPos` is what `--follow` must resume from. Following from a *later*
19
+ * `statSync` would skip whatever the gateway appended in between: those bytes
20
+ * are past the tail's read and before the follower's start, so nothing would
21
+ * ever print them. Nothing can interleave here within this process — the read
22
+ * is synchronous — but the writer is a different process, which is the whole
23
+ * reason the command exists.
24
+ */
25
+ export declare function tailFrom(file: string, count: number): {
26
+ lines: string[];
27
+ endPos: number;
28
+ };
29
+ /** The last `count` lines of `file`, oldest first. */
30
+ export declare function tailLines(file: string, count: number): string[];
31
+ export interface LogsRunOptions {
32
+ /** Stops `--follow`. Tests pass one; the CLI wires it to SIGINT. */
33
+ signal?: AbortSignal;
34
+ pollMs?: number;
35
+ }
36
+ export declare function runGatewayLogs(flags: Record<string, string | boolean>, opts?: LogsRunOptions): Promise<number>;
37
+ //# sourceMappingURL=logs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/logs.ts"],"names":[],"mappings":"AAsCA;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAmBlD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CA8BzF;AAED,sDAAsD;AACtD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAE/D;AAQD,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA+BD,wBAAsB,cAAc,CAClC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EACvC,IAAI,GAAE,cAAmB,GACxB,OAAO,CAAC,MAAM,CAAC,CAoHjB"}
@@ -0,0 +1,429 @@
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.formatLogLine = formatLogLine;
37
+ exports.tailFrom = tailFrom;
38
+ exports.tailLines = tailLines;
39
+ exports.runGatewayLogs = runGatewayLogs;
40
+ const fs = __importStar(require("fs"));
41
+ const path = __importStar(require("path"));
42
+ const logs_dir_1 = require("../logs-dir");
43
+ const output_1 = require("../output");
44
+ /**
45
+ * `gateway logs` — read the gateway's own logs without knowing where they live.
46
+ *
47
+ * The data was always well structured (one JSON object per line, written by
48
+ * src/logger.ts); what was missing was any way to reach it from the CLI, so
49
+ * operators had to know the on-disk layout and reach for `tail` by hand. A
50
+ * `logs` command was in scope for #374 and dropped in #375 rather than shipped
51
+ * as an always-failing stub; this is the version that works (#435).
52
+ *
53
+ * Every failure here is explicit — a missing directory, an unknown agent, a bad
54
+ * `--lines` — because the one thing a log reader must never do is answer "no
55
+ * logs" when the real answer is "I looked in the wrong place".
56
+ */
57
+ /** Default tail length, matching what `tail` gives you for free minus the guesswork. */
58
+ const DEFAULT_LINES = 50;
59
+ /** Chunk size for the reverse read. */
60
+ const TAIL_CHUNK = 64 * 1024;
61
+ /** Ceiling on how much of a file the tail will scan backwards. A session log can
62
+ * be hundreds of MB; reading it whole to show 50 lines would be the same
63
+ * mistake `debug-bundle` exists to avoid. A tail that hits this stops early and
64
+ * returns what it has, which is still the newest content. */
65
+ const TAIL_MAX_SCAN = 8 * 1024 * 1024;
66
+ /** How often `--follow` re-stats the file. */
67
+ const DEFAULT_POLL_MS = 300;
68
+ /**
69
+ * Render one stored line as `<ts> <level> <message>` with `data` appended
70
+ * compactly.
71
+ *
72
+ * A line that is not a gateway log record is passed through verbatim rather
73
+ * than dropped or replaced with a placeholder: anything already in the file is
74
+ * something the operator may need to see, and a reader that silently discards
75
+ * what it does not recognise is how a corrupt tail looks like an idle gateway.
76
+ */
77
+ function formatLogLine(line) {
78
+ let rec;
79
+ try {
80
+ rec = JSON.parse(line);
81
+ }
82
+ catch {
83
+ return line;
84
+ }
85
+ if (rec === null || typeof rec !== 'object' || typeof rec.message !== 'string')
86
+ return line;
87
+ const ts = typeof rec.ts === 'string' ? rec.ts : '-';
88
+ const level = typeof rec.level === 'string' ? rec.level.toUpperCase().padEnd(5) : '- ';
89
+ const head = `${ts} ${level} ${rec.message}`;
90
+ if (rec.data === undefined)
91
+ return head;
92
+ let data;
93
+ try {
94
+ data = JSON.stringify(rec.data);
95
+ }
96
+ catch {
97
+ return head; // circular/unserialisable — the message alone is still useful
98
+ }
99
+ return `${head} ${data}`;
100
+ }
101
+ /**
102
+ * The last `count` lines of `file`, oldest first, with the offset they were
103
+ * read to.
104
+ *
105
+ * Reads backwards in chunks so the cost is bounded by what is asked for rather
106
+ * than by the size of the file.
107
+ *
108
+ * `endPos` is what `--follow` must resume from. Following from a *later*
109
+ * `statSync` would skip whatever the gateway appended in between: those bytes
110
+ * are past the tail's read and before the follower's start, so nothing would
111
+ * ever print them. Nothing can interleave here within this process — the read
112
+ * is synchronous — but the writer is a different process, which is the whole
113
+ * reason the command exists.
114
+ */
115
+ function tailFrom(file, count) {
116
+ const fd = fs.openSync(file, 'r');
117
+ try {
118
+ const size = fs.fstatSync(fd).size;
119
+ let pos = size;
120
+ let scanned = 0;
121
+ let text = '';
122
+ while (pos > 0 && scanned < TAIL_MAX_SCAN) {
123
+ const len = Math.min(TAIL_CHUNK, pos);
124
+ pos -= len;
125
+ scanned += len;
126
+ const buf = Buffer.alloc(len);
127
+ fs.readSync(fd, buf, 0, len, pos);
128
+ text = buf.toString('utf-8') + text;
129
+ // +1 because the newline that ends the (count)th-from-last line belongs to
130
+ // the line before it — stopping at `count` can return one line short.
131
+ if (countNewlines(text) > count)
132
+ break;
133
+ }
134
+ const lines = text.split('\n');
135
+ // A leading fragment from a chunk boundary is not a whole line. It only
136
+ // exists when the scan stopped short of the start of the file. Dropping it
137
+ // is safe even when the boundary happens to land exactly on a newline: the
138
+ // loop only stops with more than `count` lines in hand, so the one dropped
139
+ // is always older than the newest `count`.
140
+ if (pos > 0 && lines.length > 0)
141
+ lines.shift();
142
+ while (lines.length > 0 && lines[lines.length - 1] === '')
143
+ lines.pop();
144
+ return { lines: lines.length > count ? lines.slice(lines.length - count) : lines, endPos: size };
145
+ }
146
+ finally {
147
+ fs.closeSync(fd);
148
+ }
149
+ }
150
+ /** The last `count` lines of `file`, oldest first. */
151
+ function tailLines(file, count) {
152
+ return tailFrom(file, count).lines;
153
+ }
154
+ function countNewlines(s) {
155
+ let n = 0;
156
+ for (let i = 0; i < s.length; i++)
157
+ if (s.charCodeAt(i) === 10)
158
+ n++;
159
+ return n;
160
+ }
161
+ /** Positive integer, or the reason it is not one. */
162
+ function parseLines(raw) {
163
+ if (raw === undefined)
164
+ return { lines: DEFAULT_LINES };
165
+ if (typeof raw !== 'string')
166
+ return { error: '--lines requires a value (a positive integer)' };
167
+ if (!/^\d+$/.test(raw))
168
+ return { error: `--lines must be a positive integer, got "${raw}"` };
169
+ const n = Number(raw);
170
+ if (!Number.isSafeInteger(n) || n < 1)
171
+ return { error: `--lines must be a positive integer, got "${raw}"` };
172
+ return { lines: n };
173
+ }
174
+ function printHelp(requested) {
175
+ (0, output_1.writeCommandHelp)(requested, 'gateway logs', 'read the gateway log files on this host', 'claude-gateway gateway logs [--follow] [--lines <n>] [--agent <id>] [--json] [--logDir <path>] [--config <path>]', [
176
+ ' --follow Stream new lines until interrupted (Ctrl-C)',
177
+ ` --lines <n> How many lines to show (default ${DEFAULT_LINES})`,
178
+ ' --agent <id> Read <id>.log instead of the process-wide gateway.log',
179
+ ' --json Print the stored lines verbatim, one JSON object per line',
180
+ ' --logDir <path> Read logs from here instead of the configured directory',
181
+ ' --config <path> Read logDir from this config file',
182
+ '',
183
+ ' Reads files directly, so it works even when the gateway is wedged or dead.',
184
+ ]);
185
+ }
186
+ async function runGatewayLogs(flags, opts = {}) {
187
+ if (flags.help === true) {
188
+ printHelp(true);
189
+ return 0;
190
+ }
191
+ const parsed = parseLines(flags.lines);
192
+ if ('error' in parsed) {
193
+ process.stderr.write(`${parsed.error}\n`);
194
+ return 1;
195
+ }
196
+ if (flags.agent !== undefined && typeof flags.agent !== 'string') {
197
+ process.stderr.write('--agent requires a value (a log stream id)\n');
198
+ return 1;
199
+ }
200
+ const logDir = (0, logs_dir_1.resolveLogDir)(flags);
201
+ // Before anything else reads a path: if `--config` named a file we could not
202
+ // use, say so now. Otherwise the "no log file at …" below names the default
203
+ // directory and reads like an answer rather than a misdirection.
204
+ const configWarning = (0, logs_dir_1.explicitConfigWarning)(flags);
205
+ if (configWarning)
206
+ process.stderr.write(`${configWarning}\n`);
207
+ const streamId = typeof flags.agent === 'string' ? flags.agent : 'gateway';
208
+ // A stream id reaches the filesystem, so it must not be able to leave the log
209
+ // directory. Session streams legitimately contain ':' (`<agent>:session:<id>`),
210
+ // so this rejects traversal rather than restricting the charset.
211
+ if (streamId.includes('/') || streamId.includes('\\') || streamId.split(path.sep).includes('..')) {
212
+ process.stderr.write(`Invalid --agent "${streamId}": a log stream id cannot contain a path separator\n`);
213
+ return 1;
214
+ }
215
+ const file = path.join(logDir, `${streamId}.log`);
216
+ if (!fs.existsSync(file)) {
217
+ // Never "no logs found": say which path was tried, and — since an unknown
218
+ // id is usually a typo — what could have been meant instead.
219
+ const { ids, error } = (0, logs_dir_1.listLogStreamIds)(logDir);
220
+ process.stderr.write(`No log file at ${file}\n`);
221
+ if (error) {
222
+ process.stderr.write(`${error}\n`);
223
+ }
224
+ else if (ids.length > 0) {
225
+ process.stderr.write(`Available streams (--agent <id>): ${ids.join(', ')}\n`);
226
+ }
227
+ else {
228
+ process.stderr.write(`${logDir} holds no log files yet\n`);
229
+ }
230
+ return 1;
231
+ }
232
+ const asJson = flags.json === true;
233
+ // Whether anyone is still reading our output, and why they stopped.
234
+ //
235
+ // A downstream reader that closes early — `gateway logs --follow | head -5`,
236
+ // a pager quit with `q` — ends the command normally. A write into a pipe
237
+ // nobody reads never throws; it arrives as an asynchronous 'error' on stdout,
238
+ // which with no listener is an uncaught exception that kills the CLI with a
239
+ // stack trace after the output the operator asked for.
240
+ //
241
+ // The listener covers the whole command rather than just the follow loop: the
242
+ // tail is written before following starts, and `gateway logs --lines 20000 |
243
+ // head -1` is the same broken pipe with no follow involved.
244
+ const sink = {};
245
+ const onSinkError = (err) => {
246
+ // Stop either way — but a stdout error that is *not* the reader leaving (a
247
+ // full disk, a read-only redirect) is a real failure and has to be
248
+ // reported. Attaching any listener marks the 'error' handled, so one that
249
+ // ignored those codes would turn a loud crash into a follow that streams
250
+ // into nothing and still exits 0.
251
+ if (!isPipeClosed(err))
252
+ sink.failure = err;
253
+ sink.onBroken?.();
254
+ };
255
+ const emit = (line) => {
256
+ if (line === '')
257
+ return;
258
+ process.stdout.write(`${asJson ? line : formatLogLine(line)}\n`);
259
+ };
260
+ process.stdout.on('error', onSinkError);
261
+ try {
262
+ let tail;
263
+ try {
264
+ // Resume from where the tail stopped, not from a fresh stat: the gateway is
265
+ // a different process and may have appended in between.
266
+ tail = tailFrom(file, parsed.lines);
267
+ }
268
+ catch (err) {
269
+ const e = err;
270
+ process.stderr.write(`Cannot read ${file} (${e.code ?? e.message})\n`);
271
+ }
272
+ let exitCode = 1;
273
+ if (tail) {
274
+ for (const line of tail.lines)
275
+ emit(line);
276
+ if (flags.follow === true)
277
+ await followFile(file, tail.endPos, emit, opts, sink);
278
+ exitCode = 0;
279
+ }
280
+ // Wait for the writes before judging them. A stdout failure is reported
281
+ // asynchronously, so returning as soon as the last `emit` call returns
282
+ // decides the exit code before the failure that decides it has arrived —
283
+ // `gateway logs > <full disk>` exited 0 with an empty stderr, and only the
284
+ // follow path escaped it, because following happens to keep the process
285
+ // there long enough for the error to land.
286
+ //
287
+ // The same wait is what makes the command self-contained: the `finally`
288
+ // below detaches the only 'error' listener stdout has, and detaching it
289
+ // while a write is still in flight leaves that error to the process. That
290
+ // it did not crash was luck — src/entry.ts calls `exitAfterFlush` on the
291
+ // next tick, and its own drain re-attached one just in time.
292
+ await (0, output_1.flushStream)(process.stdout);
293
+ if (sink.failure) {
294
+ process.stderr.write(`Cannot write output (${sink.failure.code ?? sink.failure.message})\n`);
295
+ return 1;
296
+ }
297
+ return exitCode;
298
+ }
299
+ finally {
300
+ process.stdout.off('error', onSinkError);
301
+ }
302
+ }
303
+ /**
304
+ * Whether an error means "nobody is reading this any more".
305
+ *
306
+ * Only EPIPE: measured on this platform, a closed pipe reports EPIPE on every
307
+ * failed write and never leaves `process.stdout` destroyed, so the
308
+ * ERR_STREAM_DESTROYED that a torn-down stream would report is not reachable
309
+ * here. Anything else is treated as a genuine write failure and surfaced.
310
+ */
311
+ function isPipeClosed(err) {
312
+ return err?.code === 'EPIPE';
313
+ }
314
+ /**
315
+ * Stream lines appended to `file` until aborted.
316
+ *
317
+ * Polls rather than using `fs.watch` because the file it is following can be
318
+ * rotated out from under it (src/logger.ts renames `<name>.log` to
319
+ * `<name>.log.1`): a watcher holds the old inode and would go quiet forever
320
+ * while the gateway writes happily into the new file. Comparing the inode on
321
+ * every poll turns that into a reopen.
322
+ */
323
+ async function followFile(file, fromPos, emit, opts, sink) {
324
+ const pollMs = opts.pollMs ?? DEFAULT_POLL_MS;
325
+ let pos = fromPos;
326
+ let inode;
327
+ let carry = '';
328
+ try {
329
+ inode = fs.statSync(file).ino;
330
+ }
331
+ catch {
332
+ /* the file was there a moment ago; treat it as rotated on the next poll */
333
+ }
334
+ const drain = () => {
335
+ let stat;
336
+ try {
337
+ stat = fs.statSync(file);
338
+ }
339
+ catch {
340
+ return; // mid-rotation: the rename has happened, the new file has not appeared
341
+ }
342
+ if (inode !== undefined && stat.ino !== inode) {
343
+ // Rotated: a different file now answers to this name. Start at its
344
+ // beginning — the bytes between the old position and the rotation are in
345
+ // `<name>.log.1`, which the operator can read directly.
346
+ inode = stat.ino;
347
+ pos = 0;
348
+ carry = '';
349
+ }
350
+ else if (stat.size < pos) {
351
+ // Truncated in place (maxFiles = 0 unlinks rather than renames).
352
+ pos = 0;
353
+ carry = '';
354
+ }
355
+ if (inode === undefined)
356
+ inode = stat.ino;
357
+ if (stat.size <= pos)
358
+ return;
359
+ const len = stat.size - pos;
360
+ const buf = Buffer.alloc(len);
361
+ let read = 0;
362
+ const fd = fs.openSync(file, 'r');
363
+ try {
364
+ read = fs.readSync(fd, buf, 0, len, pos);
365
+ }
366
+ finally {
367
+ fs.closeSync(fd);
368
+ }
369
+ pos += read;
370
+ // A tail can land mid-line; hold the fragment until its newline arrives so
371
+ // a line is never emitted in two halves.
372
+ const chunk = carry + buf.subarray(0, read).toString('utf-8');
373
+ const parts = chunk.split('\n');
374
+ carry = parts.pop() ?? '';
375
+ for (const line of parts)
376
+ emit(line);
377
+ };
378
+ await new Promise((resolve) => {
379
+ const timer = setInterval(() => {
380
+ try {
381
+ drain();
382
+ }
383
+ catch {
384
+ /* transient (rotation race, permissions) — the next poll retries */
385
+ }
386
+ }, pollMs);
387
+ // Deliberately NOT unref'ed. An unref'ed interval is right wherever the
388
+ // process is kept alive by something else — `src/logger.ts:324`'s retention
389
+ // sweep runs inside the gateway server, which its HTTP listener holds open,
390
+ // and `src/cli/output.ts:54`'s flush deadline is a bound on a wait, not the
391
+ // reason to keep waiting. Here the interval is the only ref'ed handle there
392
+ // is: `process.once('SIGINT')` does not hold the loop open, so unref'ing
393
+ // drained the loop and exited 0 the moment the tail had been written —
394
+ // `--follow` printed the tail and returned instead of following (#439).
395
+ // Nothing leaks: `stop()` clears the interval on every path out.
396
+ const stop = () => {
397
+ clearInterval(timer);
398
+ sink.onBroken = undefined;
399
+ if (opts.signal)
400
+ opts.signal.removeEventListener('abort', stop);
401
+ else
402
+ process.off('SIGINT', stop);
403
+ resolve();
404
+ };
405
+ // The reader going away is how a follow normally ends. The 'error' itself
406
+ // is caught by the command-wide stdout listener; this is what turns it into
407
+ // "stop polling" rather than a loop that keeps draining into nothing.
408
+ sink.onBroken = stop;
409
+ if (opts.signal) {
410
+ if (opts.signal.aborted)
411
+ return stop();
412
+ opts.signal.addEventListener('abort', stop, { once: true });
413
+ }
414
+ else {
415
+ process.once('SIGINT', stop);
416
+ }
417
+ });
418
+ // One last pass so lines written between the final poll and the interrupt are
419
+ // not lost, then flush any line the file never terminated.
420
+ try {
421
+ drain();
422
+ }
423
+ catch {
424
+ /* best-effort */
425
+ }
426
+ if (carry !== '')
427
+ emit(carry);
428
+ }
429
+ //# sourceMappingURL=logs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs.js","sourceRoot":"","sources":["../../../src/cli/commands/logs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,sCAmBC;AAgBD,4BA8BC;AAGD,8BAEC;AA2CD,wCAuHC;AAvRD,uCAAyB;AACzB,2CAA6B;AAC7B,0CAAqF;AACrF,sCAA0D;AAE1D;;;;;;;;;;;;GAYG;AAEH,wFAAwF;AACxF,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,uCAAuC;AACvC,MAAM,UAAU,GAAG,EAAE,GAAG,IAAI,CAAC;AAC7B;;;8DAG8D;AAC9D,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AACtC,8CAA8C;AAC9C,MAAM,eAAe,GAAG,GAAG,CAAC;AAS5B;;;;;;;;GAQG;AACH,SAAgB,aAAa,CAAC,IAAY;IACxC,IAAI,GAAc,CAAC;IACnB,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAc,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC5F,MAAM,EAAE,GAAG,OAAO,GAAG,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAA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AC,KAAK,CAAC,CAAC;AAChC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAc,KAAK,EAAE,MAAM,UAAU,CAAC;AA2B7C;;;;;;;GAOG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAwD5D;AA8KD;;;;uEAIuE;AACvE,eAAO,MAAM,MAAM,KAAK,CAAC;AAEzB;2EAC2E;AAC3E,eAAO,MAAM,WAAW,KAAK,CAAC;AAE9B,eAAO,MAAM,SAAS,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAW9D,CAAC;AAEF;;;;+DAI+D;AAC/D,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,SAAS,GAAG,MAAM,EAAE,CAG1F"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAc,KAAK,EAAE,MAAM,UAAU,CAAC;AAsC7C;;;;;;;GAOG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAwD5D;AA8KD;;;;uEAIuE;AACvE,eAAO,MAAM,MAAM,KAAK,CAAC;AAEzB;2EAC2E;AAC3E,eAAO,MAAM,WAAW,KAAK,CAAC;AAE9B,eAAO,MAAM,SAAS,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAiB9D,CAAC;AAEF;;;;+DAI+D;AAC/D,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,SAAS,GAAG,MAAM,EAAE,CAG1F"}
package/dist/cli/index.js CHANGED
@@ -50,15 +50,26 @@ const debug_bundle_1 = require("./commands/debug-bundle");
50
50
  const agents_1 = require("./commands/agents");
51
51
  const channels_1 = require("./commands/channels");
52
52
  /** Flags that are always boolean regardless of command — never consume the next
53
- * token as a value (see parseCliArgs). */
54
- const GLOBAL_BOOLEAN_FLAGS = new Set(['help', 'json', 'yes', 'print']);
53
+ * token as a value (see parseCliArgs). `follow` is here rather than in the
54
+ * gateway command because the verb is a positional: `gateway --follow logs`
55
+ * would otherwise parse `logs` as the flag's value and leave no command at all.
56
+ * No generated resource command declares a `--follow` value flag. */
57
+ const GLOBAL_BOOLEAN_FLAGS = new Set(['help', 'json', 'yes', 'print', 'follow']);
55
58
  /** Flags every command accepts, on top of whatever the generated manifest
56
59
  * declares for that command. Anything outside this set and the command's own
57
60
  * flags is a typo, and is reported rather than dropped: a resource command
58
61
  * builds its query/body from `cmd.flags` alone, so an unrecognised flag would
59
- * otherwise be parsed, ignored, and reported as success. */
62
+ * otherwise be parsed, ignored, and reported as success.
63
+ *
64
+ * Not simply `GLOBAL_BOOLEAN_FLAGS` spread in: the two sets answer different
65
+ * questions. `follow` has to parse as a boolean everywhere so the gateway verb
66
+ * survives, but it means nothing to a resource command, and accepting it there
67
+ * would quietly re-open the hole this check exists to close. */
60
68
  const GLOBAL_FLAG_NAMES = new Set([
61
- ...GLOBAL_BOOLEAN_FLAGS,
69
+ 'help',
70
+ 'json',
71
+ 'yes',
72
+ 'print',
62
73
  'url',
63
74
  'key',
64
75
  'config',
@@ -292,6 +303,12 @@ exports.NAME_W = 36;
292
303
  exports.NOUN_NAME_W = 48;
293
304
  exports.CORE_HELP = [
294
305
  ['gateway status|restart|stop', 'Manage the gateway process (manager-aware)'],
306
+ // Its own row, not folded into the line above: `logs` is the one entry there
307
+ // that does *not* go through the owning manager — it reads the files directly
308
+ // and works when the gateway is wedged or dead, which is when it matters.
309
+ // Described as lifecycle management, it read as a variant of stop/restart and
310
+ // was reported as missing from help by someone looking straight at it.
311
+ ['gateway logs', 'Read the gateway log files (works when it is down)'],
295
312
  ['service install|status|uninstall', 'Run the gateway as a systemd-user or PM2 service'],
296
313
  ['update [check]', 'Check for / install a newer claude-gateway'],
297
314
  ['claude version|update [check]', 'Inspect / update the Claude Code binary'],