@0xmaxma/claude-gateway 1.8.2 → 1.8.4

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 (99) hide show
  1. package/README.md +63 -2
  2. package/config.template.json +4 -0
  3. package/dist/agent/dreaming/config.d.ts +6 -0
  4. package/dist/agent/dreaming/config.d.ts.map +1 -1
  5. package/dist/agent/dreaming/config.js +17 -24
  6. package/dist/agent/dreaming/config.js.map +1 -1
  7. package/dist/agent/knowledge/config.d.ts.map +1 -1
  8. package/dist/agent/knowledge/config.js +7 -13
  9. package/dist/agent/knowledge/config.js.map +1 -1
  10. package/dist/agent/runner.d.ts +87 -13
  11. package/dist/agent/runner.d.ts.map +1 -1
  12. package/dist/agent/runner.js +342 -117
  13. package/dist/agent/runner.js.map +1 -1
  14. package/dist/agent/turn-stream.d.ts +202 -0
  15. package/dist/agent/turn-stream.d.ts.map +1 -0
  16. package/dist/agent/turn-stream.js +322 -0
  17. package/dist/agent/turn-stream.js.map +1 -0
  18. package/dist/api/apps-router.d.ts.map +1 -1
  19. package/dist/api/apps-router.js +14 -2
  20. package/dist/api/apps-router.js.map +1 -1
  21. package/dist/api/gateway-router.d.ts.map +1 -1
  22. package/dist/api/gateway-router.js +2 -3
  23. package/dist/api/gateway-router.js.map +1 -1
  24. package/dist/api/line-webhook-router.d.ts +43 -1
  25. package/dist/api/line-webhook-router.d.ts.map +1 -1
  26. package/dist/api/line-webhook-router.js +286 -38
  27. package/dist/api/line-webhook-router.js.map +1 -1
  28. package/dist/api/router.d.ts +7 -1
  29. package/dist/api/router.d.ts.map +1 -1
  30. package/dist/api/router.js +328 -114
  31. package/dist/api/router.js.map +1 -1
  32. package/dist/apps/agent-manager.d.ts.map +1 -1
  33. package/dist/apps/agent-manager.js +4 -1
  34. package/dist/apps/agent-manager.js.map +1 -1
  35. package/dist/apps/installer.d.ts +75 -2
  36. package/dist/apps/installer.d.ts.map +1 -1
  37. package/dist/apps/installer.js +198 -13
  38. package/dist/apps/installer.js.map +1 -1
  39. package/dist/cli/commands/debug-bundle.d.ts.map +1 -1
  40. package/dist/cli/commands/debug-bundle.js +9 -52
  41. package/dist/cli/commands/debug-bundle.js.map +1 -1
  42. package/dist/cli/commands/gateway.d.ts +6 -1
  43. package/dist/cli/commands/gateway.d.ts.map +1 -1
  44. package/dist/cli/commands/gateway.js +14 -3
  45. package/dist/cli/commands/gateway.js.map +1 -1
  46. package/dist/cli/commands/logs.d.ts +37 -0
  47. package/dist/cli/commands/logs.d.ts.map +1 -0
  48. package/dist/cli/commands/logs.js +356 -0
  49. package/dist/cli/commands/logs.js.map +1 -0
  50. package/dist/cli/index.d.ts.map +1 -1
  51. package/dist/cli/index.js +16 -5
  52. package/dist/cli/index.js.map +1 -1
  53. package/dist/cli/logs-dir.d.ts +69 -0
  54. package/dist/cli/logs-dir.d.ts.map +1 -0
  55. package/dist/cli/logs-dir.js +166 -0
  56. package/dist/cli/logs-dir.js.map +1 -0
  57. package/dist/config/agent-env.d.ts +41 -0
  58. package/dist/config/agent-env.d.ts.map +1 -0
  59. package/dist/config/agent-env.js +154 -0
  60. package/dist/config/agent-env.js.map +1 -0
  61. package/dist/config/loader.d.ts +33 -2
  62. package/dist/config/loader.d.ts.map +1 -1
  63. package/dist/config/loader.js +33 -9
  64. package/dist/config/loader.js.map +1 -1
  65. package/dist/config/watcher.d.ts +1 -0
  66. package/dist/config/watcher.d.ts.map +1 -1
  67. package/dist/config/watcher.js +22 -1
  68. package/dist/config/watcher.js.map +1 -1
  69. package/dist/index.js +50 -51
  70. package/dist/index.js.map +1 -1
  71. package/dist/load-dotenv.d.ts +17 -0
  72. package/dist/load-dotenv.d.ts.map +1 -1
  73. package/dist/load-dotenv.js +32 -9
  74. package/dist/load-dotenv.js.map +1 -1
  75. package/dist/logger.d.ts +52 -1
  76. package/dist/logger.d.ts.map +1 -1
  77. package/dist/logger.js +264 -2
  78. package/dist/logger.js.map +1 -1
  79. package/dist/session/store.d.ts +9 -0
  80. package/dist/session/store.d.ts.map +1 -1
  81. package/dist/session/store.js +12 -0
  82. package/dist/session/store.js.map +1 -1
  83. package/dist/shell/bypass-dialog.d.ts +234 -0
  84. package/dist/shell/bypass-dialog.d.ts.map +1 -0
  85. package/dist/shell/bypass-dialog.js +339 -0
  86. package/dist/shell/bypass-dialog.js.map +1 -0
  87. package/dist/shell/claude-pty-shell.js +67 -3
  88. package/dist/shell/claude-pty-shell.js.map +1 -1
  89. package/dist/shell/screen.d.ts +22 -11
  90. package/dist/shell/screen.d.ts.map +1 -1
  91. package/dist/shell/screen.js +50 -32
  92. package/dist/shell/screen.js.map +1 -1
  93. package/dist/types.d.ts +40 -0
  94. package/dist/types.d.ts.map +1 -1
  95. package/dist/utils/config-num.d.ts +22 -0
  96. package/dist/utils/config-num.d.ts.map +1 -0
  97. package/dist/utils/config-num.js +34 -0
  98. package/dist/utils/config-num.js.map +1 -0
  99. package/package.json +1 -1
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Locating and listing the gateway's log directory, shared by every reader.
3
+ *
4
+ * `debug-bundle` owned this privately and `gateway logs` needs the same three
5
+ * behaviours — the `--logDir` → config → default precedence, the literal `~`
6
+ * the shipped config template writes, and an errno instead of a silent empty
7
+ * listing. Two copies of that would drift, and the tilde bug is what a drifted
8
+ * copy looks like: `readdirSync('~/…')` throws ENOENT, which reads exactly like
9
+ * "the directory is empty".
10
+ */
11
+ /** The config file stores `logDir` exactly as written, and the shipped template
12
+ * writes `~/.claude-gateway/logs`. The server expands that itself on boot, so
13
+ * the literal tilde survives on disk and only bites a reader that forgets to
14
+ * expand it. */
15
+ export declare function resolveLogDir(flags: Record<string, string | boolean>): string;
16
+ /**
17
+ * The reason an explicitly passed `--config` did not contribute a `logDir`, or
18
+ * undefined when there is nothing to say.
19
+ *
20
+ * `loadCliConfig` answers `{}` for a file that is missing, unreadable or
21
+ * malformed — it cannot distinguish them, and for most commands that is the
22
+ * right shape. Here it is not: the caller then silently resolves the *default*
23
+ * log directory and reports "no log file at <default path>", naming a directory
24
+ * the operator never asked about while the typo in `--config` goes unmentioned.
25
+ * That is the same class of failure as the unexpanded `~`, arriving by a
26
+ * different route.
27
+ *
28
+ * Only an explicit `--config` is worth complaining about. The default config
29
+ * being absent is ordinary — a fresh install has no config yet, and the default
30
+ * log directory is the correct answer for it.
31
+ */
32
+ export declare function explicitConfigWarning(flags: Record<string, string | boolean>): string | undefined;
33
+ export interface LogDirListing {
34
+ names: string[];
35
+ /** Set when the directory could not be read at all — never "no logs found". */
36
+ error?: string;
37
+ }
38
+ /**
39
+ * Every entry in `dir`, or the reason it could not be read.
40
+ *
41
+ * The read used to be wrapped in a bare `catch { return [] }`, which reported
42
+ * every failure as "no logs found". That is how the unexpanded `~` stayed
43
+ * invisible: an ENOENT on a path that was never resolved looked exactly like an
44
+ * empty directory, and a permission problem still would. The caller needs the
45
+ * errno to say anything useful, so it is returned rather than eaten.
46
+ */
47
+ export declare function readLogDir(dir: string): LogDirListing;
48
+ /** Session logs in `dir` with their mtimes, or the reason the directory could
49
+ * not be read. Session loggers are created as `<agent>:session:<uuid>`, so the
50
+ * name carries the marker this filters on. */
51
+ export declare function listSessionLogs(dir: string): {
52
+ logs: Array<{
53
+ file: string;
54
+ mtimeMs: number;
55
+ }>;
56
+ error?: string;
57
+ };
58
+ /**
59
+ * Stream ids that have a live `<id>.log` in `dir`, sorted.
60
+ *
61
+ * Rotated generations (`<id>.log.1`) are deliberately excluded: they are not
62
+ * separate streams, and offering one as an `--agent` value would name a target
63
+ * that rotation can rename out from under the reader at any moment.
64
+ */
65
+ export declare function listLogStreamIds(dir: string): {
66
+ ids: string[];
67
+ error?: string;
68
+ };
69
+ //# sourceMappingURL=logs-dir.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs-dir.d.ts","sourceRoot":"","sources":["../../src/cli/logs-dir.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AAEH;;;iBAGiB;AACjB,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,MAAM,CAK7E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS,CAiBjG;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CASrD;AAED;;+CAE+C;AAC/C,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAgB/G;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAQ/E"}
@@ -0,0 +1,166 @@
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.resolveLogDir = resolveLogDir;
37
+ exports.explicitConfigWarning = explicitConfigWarning;
38
+ exports.readLogDir = readLogDir;
39
+ exports.listSessionLogs = listSessionLogs;
40
+ exports.listLogStreamIds = listLogStreamIds;
41
+ const fs = __importStar(require("fs"));
42
+ const os = __importStar(require("os"));
43
+ const path = __importStar(require("path"));
44
+ const http_client_1 = require("./http-client");
45
+ /**
46
+ * Locating and listing the gateway's log directory, shared by every reader.
47
+ *
48
+ * `debug-bundle` owned this privately and `gateway logs` needs the same three
49
+ * behaviours — the `--logDir` → config → default precedence, the literal `~`
50
+ * the shipped config template writes, and an errno instead of a silent empty
51
+ * listing. Two copies of that would drift, and the tilde bug is what a drifted
52
+ * copy looks like: `readdirSync('~/…')` throws ENOENT, which reads exactly like
53
+ * "the directory is empty".
54
+ */
55
+ /** The config file stores `logDir` exactly as written, and the shipped template
56
+ * writes `~/.claude-gateway/logs`. The server expands that itself on boot, so
57
+ * the literal tilde survives on disk and only bites a reader that forgets to
58
+ * expand it. */
59
+ function resolveLogDir(flags) {
60
+ if (typeof flags.logDir === 'string')
61
+ return (0, http_client_1.expandHome)(flags.logDir);
62
+ const cfg = (0, http_client_1.loadCliConfig)(typeof flags.config === 'string' ? flags.config : undefined);
63
+ if (cfg.logDir)
64
+ return (0, http_client_1.expandHome)(cfg.logDir);
65
+ return path.join(os.homedir(), '.claude-gateway', 'logs');
66
+ }
67
+ /**
68
+ * The reason an explicitly passed `--config` did not contribute a `logDir`, or
69
+ * undefined when there is nothing to say.
70
+ *
71
+ * `loadCliConfig` answers `{}` for a file that is missing, unreadable or
72
+ * malformed — it cannot distinguish them, and for most commands that is the
73
+ * right shape. Here it is not: the caller then silently resolves the *default*
74
+ * log directory and reports "no log file at <default path>", naming a directory
75
+ * the operator never asked about while the typo in `--config` goes unmentioned.
76
+ * That is the same class of failure as the unexpanded `~`, arriving by a
77
+ * different route.
78
+ *
79
+ * Only an explicit `--config` is worth complaining about. The default config
80
+ * being absent is ordinary — a fresh install has no config yet, and the default
81
+ * log directory is the correct answer for it.
82
+ */
83
+ function explicitConfigWarning(flags) {
84
+ if (typeof flags.logDir === 'string')
85
+ return undefined; // --logDir wins; config was never consulted
86
+ if (typeof flags.config !== 'string')
87
+ return undefined;
88
+ const file = (0, http_client_1.expandHome)(flags.config);
89
+ let raw;
90
+ try {
91
+ raw = fs.readFileSync(file, 'utf8');
92
+ }
93
+ catch (err) {
94
+ const e = err;
95
+ return `Warning: --config ${file} could not be read (${e.code ?? e.message}); falling back to the default log directory`;
96
+ }
97
+ try {
98
+ JSON.parse(raw);
99
+ }
100
+ catch (err) {
101
+ return `Warning: --config ${file} is not valid JSON (${err.message}); falling back to the default log directory`;
102
+ }
103
+ return undefined;
104
+ }
105
+ /**
106
+ * Every entry in `dir`, or the reason it could not be read.
107
+ *
108
+ * The read used to be wrapped in a bare `catch { return [] }`, which reported
109
+ * every failure as "no logs found". That is how the unexpanded `~` stayed
110
+ * invisible: an ENOENT on a path that was never resolved looked exactly like an
111
+ * empty directory, and a permission problem still would. The caller needs the
112
+ * errno to say anything useful, so it is returned rather than eaten.
113
+ */
114
+ function readLogDir(dir) {
115
+ try {
116
+ return { names: fs.readdirSync(dir) };
117
+ }
118
+ catch (err) {
119
+ const e = err;
120
+ if (e.code === 'ENOENT')
121
+ return { names: [], error: `${dir} does not exist` };
122
+ if (e.code === 'ENOTDIR')
123
+ return { names: [], error: `${dir} is not a directory` };
124
+ return { names: [], error: `${dir} could not be read (${e.code ?? e.message})` };
125
+ }
126
+ }
127
+ /** Session logs in `dir` with their mtimes, or the reason the directory could
128
+ * not be read. Session loggers are created as `<agent>:session:<uuid>`, so the
129
+ * name carries the marker this filters on. */
130
+ function listSessionLogs(dir) {
131
+ const listing = readLogDir(dir);
132
+ if (listing.error)
133
+ return { logs: [], error: listing.error };
134
+ const logs = listing.names
135
+ .filter((n) => n.endsWith('.log') && /session/i.test(n))
136
+ .map((n) => {
137
+ const file = path.join(dir, n);
138
+ let mtimeMs = 0;
139
+ try {
140
+ mtimeMs = fs.statSync(file).mtimeMs;
141
+ }
142
+ catch {
143
+ /* ignore */
144
+ }
145
+ return { file, mtimeMs };
146
+ });
147
+ return { logs };
148
+ }
149
+ /**
150
+ * Stream ids that have a live `<id>.log` in `dir`, sorted.
151
+ *
152
+ * Rotated generations (`<id>.log.1`) are deliberately excluded: they are not
153
+ * separate streams, and offering one as an `--agent` value would name a target
154
+ * that rotation can rename out from under the reader at any moment.
155
+ */
156
+ function listLogStreamIds(dir) {
157
+ const listing = readLogDir(dir);
158
+ if (listing.error)
159
+ return { ids: [], error: listing.error };
160
+ const ids = listing.names
161
+ .filter((n) => n.endsWith('.log'))
162
+ .map((n) => n.slice(0, -'.log'.length))
163
+ .sort();
164
+ return { ids };
165
+ }
166
+ //# sourceMappingURL=logs-dir.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs-dir.js","sourceRoot":"","sources":["../../src/cli/logs-dir.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,sCAKC;AAkBD,sDAiBC;AAiBD,gCASC;AAKD,0CAgBC;AASD,4CAQC;AA5HD,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,+CAA0D;A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AI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAC/B,IAAI,OAAO,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC;YACH,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC;QACtC,CAAC;QAAC,MAAM,CAAC;YACP,YAAY;QACd,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;IACL,OAAO,EAAE,IAAI,EAAE,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAAC,GAAW;IAC1C,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,OAAO,CAAC,KAAK;QAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;IAC5D,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK;SACtB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;SACjC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SACtC,IAAI,EAAE,CAAC;IACV,OAAO,EAAE,GAAG,EAAE,CAAC;AACjB,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Per-agent `.env` loading.
3
+ *
4
+ * Agent secrets (bot tokens above all) live in
5
+ * `~/.claude-gateway/agents/<id>/.env` and are referenced from `config.json`
6
+ * as `${VAR}` placeholders. `loadConfig()` resolves those placeholders from
7
+ * `process.env` alone, so the `.env` files must be folded into `process.env`
8
+ * *before* every config load — not just the one at startup.
9
+ *
10
+ * Issue #427: `agent_create` writes a new `agents/<id>/.env` and a `${VAR}`
11
+ * placeholder into `config.json` while the gateway is already running. Without
12
+ * a refresh on reload, that variable is never in `process.env`, the agent is
13
+ * silently dropped from the reloaded snapshot, and `agent.added` never fires —
14
+ * so the handler that *would* have loaded the `.env` is itself unreachable.
15
+ *
16
+ * The same one-way copy makes `process.env` a cache that outlives the file it
17
+ * came from: once a token is in there, a rotated value on disk cannot displace
18
+ * it. That is why this module tracks which variables it injected — see
19
+ * `injected` below.
20
+ */
21
+ /**
22
+ * The gateway's agents directory — the sibling `agents/` of `config.json`,
23
+ * which is where per-agent workspaces and their `.env` files live.
24
+ *
25
+ * Falls back to `~/.claude-gateway/agents` when there is no config path: the
26
+ * API routers serve requests whose `configPath` may be unset, and the apps
27
+ * agent manager has no config path at all.
28
+ */
29
+ export declare function agentsDirForConfig(configPath?: string): string;
30
+ /**
31
+ * Fold every `agents/<id>/.env` under `gatewayAgentsDir` into `process.env`.
32
+ *
33
+ * Safe to run before each config load: it picks up agents that appeared since
34
+ * the last one, and re-reading an unchanged file changes nothing.
35
+ * A missing directory, an unreadable file, or a `.env` belonging to an agent
36
+ * that is not in the config are all non-fatal: config loading has its own
37
+ * per-agent error handling, and failing here would take the whole gateway down
38
+ * over one bad file.
39
+ */
40
+ export declare function loadAgentEnvFiles(gatewayAgentsDir: string): void;
41
+ //# sourceMappingURL=agent-env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-env.d.ts","sourceRoot":"","sources":["../../src/config/agent-env.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAI9D;AAkDD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAmBhE"}
@@ -0,0 +1,154 @@
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.agentsDirForConfig = agentsDirForConfig;
37
+ exports.loadAgentEnvFiles = loadAgentEnvFiles;
38
+ const fs = __importStar(require("fs"));
39
+ const os = __importStar(require("os"));
40
+ const path = __importStar(require("path"));
41
+ const load_dotenv_1 = require("../load-dotenv");
42
+ /**
43
+ * Per-agent `.env` loading.
44
+ *
45
+ * Agent secrets (bot tokens above all) live in
46
+ * `~/.claude-gateway/agents/<id>/.env` and are referenced from `config.json`
47
+ * as `${VAR}` placeholders. `loadConfig()` resolves those placeholders from
48
+ * `process.env` alone, so the `.env` files must be folded into `process.env`
49
+ * *before* every config load — not just the one at startup.
50
+ *
51
+ * Issue #427: `agent_create` writes a new `agents/<id>/.env` and a `${VAR}`
52
+ * placeholder into `config.json` while the gateway is already running. Without
53
+ * a refresh on reload, that variable is never in `process.env`, the agent is
54
+ * silently dropped from the reloaded snapshot, and `agent.added` never fires —
55
+ * so the handler that *would* have loaded the `.env` is itself unreachable.
56
+ *
57
+ * The same one-way copy makes `process.env` a cache that outlives the file it
58
+ * came from: once a token is in there, a rotated value on disk cannot displace
59
+ * it. That is why this module tracks which variables it injected — see
60
+ * `injected` below.
61
+ */
62
+ /**
63
+ * The gateway's agents directory — the sibling `agents/` of `config.json`,
64
+ * which is where per-agent workspaces and their `.env` files live.
65
+ *
66
+ * Falls back to `~/.claude-gateway/agents` when there is no config path: the
67
+ * API routers serve requests whose `configPath` may be unset, and the apps
68
+ * agent manager has no config path at all.
69
+ */
70
+ function agentsDirForConfig(configPath) {
71
+ return configPath
72
+ ? path.join(path.dirname(configPath), 'agents')
73
+ : path.join(os.homedir(), '.claude-gateway', 'agents');
74
+ }
75
+ /**
76
+ * Variables this module injected, and the file each one came from.
77
+ *
78
+ * `process.env` is the only thing `loadConfig()` interpolates from, and it is
79
+ * process-lifetime state — so without this ledger there is no way to tell a
80
+ * value the *operator* exported (which must never be clobbered) from one we
81
+ * ourselves copied out of a `.env` on an earlier reload (which is just a stale
82
+ * cache of a file that may since have changed). Both look identical in
83
+ * `process.env`.
84
+ */
85
+ const injected = new Map();
86
+ /**
87
+ * Fold a single agent's `.env` file into `process.env`.
88
+ *
89
+ * A variable the process already had — exported by the operator, or provided
90
+ * by a *different* agent's `.env` — always wins; the file never clobbers it.
91
+ * A variable this module injected from *this* file is refreshed when the file
92
+ * changes, so a rotated token takes effect on reload instead of the process
93
+ * serving the revoked one until it is restarted.
94
+ *
95
+ * The `value === current` check is what keeps those two cases apart after the
96
+ * first load: if anything else has since assigned to the variable, the ledger
97
+ * no longer matches, ownership is dropped, and the file goes back to losing.
98
+ * Re-loading an unchanged file remains a no-op.
99
+ *
100
+ * Line syntax is `parseDotenv`'s, shared with `~/.claude-gateway/.env`, so a
101
+ * quoted token means the same thing in both places.
102
+ */
103
+ function loadAgentEnvFile(envFile) {
104
+ for (const { key, value } of (0, load_dotenv_1.parseDotenv)(fs.readFileSync(envFile, 'utf8'))) {
105
+ const current = process.env[key];
106
+ if (current === undefined) {
107
+ process.env[key] = value;
108
+ injected.set(key, { file: envFile, value });
109
+ continue;
110
+ }
111
+ const owned = injected.get(key);
112
+ if (owned && owned.file === envFile && owned.value === current) {
113
+ if (value !== current) {
114
+ process.env[key] = value;
115
+ injected.set(key, { file: envFile, value });
116
+ }
117
+ }
118
+ }
119
+ }
120
+ /**
121
+ * Fold every `agents/<id>/.env` under `gatewayAgentsDir` into `process.env`.
122
+ *
123
+ * Safe to run before each config load: it picks up agents that appeared since
124
+ * the last one, and re-reading an unchanged file changes nothing.
125
+ * A missing directory, an unreadable file, or a `.env` belonging to an agent
126
+ * that is not in the config are all non-fatal: config loading has its own
127
+ * per-agent error handling, and failing here would take the whole gateway down
128
+ * over one bad file.
129
+ */
130
+ function loadAgentEnvFiles(gatewayAgentsDir) {
131
+ let entries;
132
+ try {
133
+ if (!fs.existsSync(gatewayAgentsDir))
134
+ return;
135
+ entries = fs.readdirSync(gatewayAgentsDir);
136
+ }
137
+ catch {
138
+ return;
139
+ }
140
+ for (const agentId of entries) {
141
+ const envFile = path.join(gatewayAgentsDir, agentId, '.env');
142
+ try {
143
+ if (!fs.existsSync(envFile))
144
+ continue;
145
+ loadAgentEnvFile(envFile);
146
+ }
147
+ catch {
148
+ // Unreadable .env (permissions, race with a concurrent write): skip it
149
+ // and let loadConfig() report the resulting unresolvable ${VAR}.
150
+ continue;
151
+ }
152
+ }
153
+ }
154
+ //# sourceMappingURL=agent-env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-env.js","sourceRoot":"","sources":["../../src/config/agent-env.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,gDAIC;AA4DD,8CAmBC;AArHD,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,gDAA6C;AAE7C;;;;;;;;;;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AC,CAAC;YAC9C,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,iBAAiB,CAAC,gBAAwB;IACxD,IAAI,OAAiB,CAAC;IACtB,IAAI,CAAC;QACH,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC;YAAE,OAAO;QAC7C,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;IACT,CAAC;IACD,KAAK,MAAM,OAAO,IAAI,OAAO,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAC7D,IAAI,CAAC;YACH,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;gBAAE,SAAS;YACtC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAC5B,CAAC;QAAC,MAAM,CAAC;YACP,uEAAuE;YACvE,iEAAiE;YACjE,SAAS;QACX,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,4 +1,4 @@
1
- import { GatewayConfig } from '../types';
1
+ import { GatewayConfig, Logger } from '../types';
2
2
  export declare class ConfigValidationError extends Error {
3
3
  constructor(message: string);
4
4
  }
@@ -6,11 +6,42 @@ export declare class DuplicateAgentIdError extends Error {
6
6
  constructor(id: string);
7
7
  }
8
8
  export declare class MissingEnvVarError extends Error {
9
+ /**
10
+ * The unresolved variable, exposed separately so callers can log it as a
11
+ * field instead of scraping it back out of `message`.
12
+ */
13
+ readonly varName: string;
9
14
  constructor(varName: string);
10
15
  }
16
+ /** An agent that was dropped from the loaded config rather than started. */
17
+ export interface SkippedAgent {
18
+ /** The agent's id, or `index N` when the entry was too malformed to have one. */
19
+ id: string;
20
+ /** Human-readable cause, e.g. `Missing environment variable: ACME_BOT_TOKEN`. */
21
+ reason: string;
22
+ /** Set only when the agent was dropped because a `${VAR}` did not resolve. */
23
+ missingVar?: string;
24
+ }
25
+ export interface LoadConfigOptions {
26
+ /**
27
+ * Called once per dropped agent. Skipping is deliberately non-fatal (one bad
28
+ * agent must not take the gateway down), which historically made it invisible:
29
+ * the only signal was a `console.warn` that never reaches `logs/gateway.log`.
30
+ * Callers that have a structured logger should pass this so a dropped agent
31
+ * is diagnosable — see issue #427.
32
+ */
33
+ onSkippedAgent?: (skipped: SkippedAgent) => void;
34
+ }
35
+ /**
36
+ * Emit one `SkippedAgent` through a caller's structured logger.
37
+ *
38
+ * Shared by the startup load and every reload so both write the same fields
39
+ * under the same key — `grep "Agent skipped" logs/gateway.log` finds either.
40
+ */
41
+ export declare function logSkippedAgents(logger: Logger, skipped: readonly SkippedAgent[], message: string): void;
11
42
  /**
12
43
  * Load and validate config.json from the given path.
13
44
  * Interpolates ${VAR} env vars throughout the config.
14
45
  */
15
- export declare function loadConfig(configPath: string): GatewayConfig;
46
+ export declare function loadConfig(configPath: string, options?: LoadConfigOptions): GatewayConfig;
16
47
  //# sourceMappingURL=loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,EAAE,EAAE,MAAM;CAIvB;AAED,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAI5B;AAuED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,CA+I5D"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGjD,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,EAAE,EAAE,MAAM;CAIvB;AAED,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAEb,OAAO,EAAE,MAAM;CAK5B;AAuED,4EAA4E;AAC5E,MAAM,WAAW,YAAY;IAC3B,iFAAiF;IACjF,EAAE,EAAE,MAAM,CAAC;IACX,iFAAiF;IACjF,MAAM,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;CAClD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,SAAS,YAAY,EAAE,EAChC,OAAO,EAAE,MAAM,GACd,IAAI,CAQN;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,aAAa,CAwJzF"}
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.MissingEnvVarError = exports.DuplicateAgentIdError = exports.ConfigValidationError = void 0;
37
+ exports.logSkippedAgents = logSkippedAgents;
37
38
  exports.loadConfig = loadConfig;
38
39
  const fs = __importStar(require("fs"));
39
40
  const public_url_1 = require("./public-url");
@@ -55,6 +56,7 @@ class MissingEnvVarError extends Error {
55
56
  constructor(varName) {
56
57
  super(`Missing environment variable: ${varName}`);
57
58
  this.name = 'MissingEnvVarError';
59
+ this.varName = varName;
58
60
  }
59
61
  }
60
62
  exports.MissingEnvVarError = MissingEnvVarError;
@@ -123,11 +125,38 @@ function validateAgent(agent, index) {
123
125
  }
124
126
  return null;
125
127
  }
128
+ /**
129
+ * Emit one `SkippedAgent` through a caller's structured logger.
130
+ *
131
+ * Shared by the startup load and every reload so both write the same fields
132
+ * under the same key — `grep "Agent skipped" logs/gateway.log` finds either.
133
+ */
134
+ function logSkippedAgents(logger, skipped, message) {
135
+ for (const s of skipped) {
136
+ logger.warn(message, {
137
+ id: s.id,
138
+ reason: s.reason,
139
+ ...(s.missingVar ? { missingVar: s.missingVar } : {}),
140
+ });
141
+ }
142
+ }
126
143
  /**
127
144
  * Load and validate config.json from the given path.
128
145
  * Interpolates ${VAR} env vars throughout the config.
129
146
  */
130
- function loadConfig(configPath) {
147
+ function loadConfig(configPath, options) {
148
+ const skippedAgents = [];
149
+ /**
150
+ * The single place an agent is dropped. Both the console warning and the
151
+ * structured-logger callback go through here on purpose: when they were two
152
+ * parallel statements per call site, a new skip site could easily carry one
153
+ * and not the other — reintroducing exactly the invisible drop of #427.
154
+ */
155
+ const skipAgent = (id, reason, missingVar) => {
156
+ console.warn(`[gateway] Skipping agent "${id}": ${reason}`);
157
+ skippedAgents.push(id);
158
+ options?.onSkippedAgent?.({ id, reason, ...(missingVar ? { missingVar } : {}) });
159
+ };
131
160
  let raw;
132
161
  try {
133
162
  raw = fs.readFileSync(configPath, 'utf-8');
@@ -154,19 +183,15 @@ function loadConfig(configPath) {
154
183
  }
155
184
  // Validate each agent before interpolation — skip invalid agents with a warning
156
185
  const validAgents = [];
157
- const skippedAgents = [];
158
186
  for (let i = 0; i < config.agents.length; i++) {
159
187
  const agent = config.agents[i];
160
188
  if (typeof agent !== 'object' || agent === null) {
161
- console.warn(`[gateway] Skipping agent at index ${i}: must be an object`);
162
- skippedAgents.push(`index ${i}`);
189
+ skipAgent(`index ${i}`, 'Config entry must be an object');
163
190
  continue;
164
191
  }
165
192
  const error = validateAgent(agent, i);
166
193
  if (error) {
167
- const agentId = agent.id || `index ${i}`;
168
- console.warn(`[gateway] Skipping agent "${agentId}": ${error}`);
169
- skippedAgents.push(String(agentId));
194
+ skipAgent(String(agent.id || `index ${i}`), error);
170
195
  continue;
171
196
  }
172
197
  validAgents.push(agent);
@@ -230,8 +255,7 @@ function loadConfig(configPath) {
230
255
  }
231
256
  catch (err) {
232
257
  if (err instanceof MissingEnvVarError) {
233
- console.warn(`[gateway] Skipping agent "${agent.id}": ${err.message}`);
234
- skippedAgents.push(String(agent.id));
258
+ skipAgent(String(agent.id), err.message, err.varName);
235
259
  continue;
236
260
  }
237
261
  throw err;
@@ -1 +1 @@
1
- {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkGA,gCA+IC;AAjPD,uCAAyB;AAEzB,6CAAuD;AAEvD,MAAa,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AALD,sDAKC;AAED,MAAa,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,EAAU;QACpB,KAAK,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AALD,sDAKC;AAED,MAAa,kBAAmB,SAAQ,KAAK;IAC3C,YAAY,OAAe;QACzB,KAAK,CAAC,iCAAiC,OAAO,EAAE,CAAC,CAAC;QAClD,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AALD,gDAKC;AAED;;;GAGG;AACH,SAAS,kBAAkB,CAAC,KAAa;IACvC,OAAO,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE,OAAe,EAAE,EAAE;QAC5D,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACtC,IAAI,QAA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AkB,CAAC,MAAM,KAAK,CAAC,IAAK,MAAM,CAAC,MAAoB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/E,MAAM,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;QACpC,MAAM,aAAa,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;YAC1C,CAAC,CAAC,kCAAkC,OAAO,+IAA+I;YAC1L,CAAC,CAAC,EAAE,CAAC;QACP,MAAM,IAAI,qBAAqB,CAC7B,wFAAwF,aAAa,EAAE,CACxG,CAAC;IACJ,CAAC;IAED,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7B,OAAO,CAAC,IAAI,CAAC,aAAa,aAAa,CAAC,MAAM,sBAAsB,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClG,CAAC;IAED,OAAO;QACL,MAAM,EAAE,kBAAkB;QAC1B,OAAO,EAAE,mBAAmB;KACZ,CAAC;AACrB,CAAC"}
@@ -17,6 +17,7 @@ export declare class ConfigWatcher extends EventEmitter {
17
17
  on(event: 'channel.removed', listener: (agentId: string, channel: string) => void): this;
18
18
  private watchHandle;
19
19
  private currentConfig;
20
+ private readonly agentsDir;
20
21
  constructor(configPath: string, initialConfig: GatewayConfig, logger: Logger);
21
22
  start(): void;
22
23
  stop(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"watcher.d.ts","sourceRoot":"","sources":["../../src/config/watcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAK9D,QAAA,MAAM,2BAA2B,EAAE,MAAM,EAMxC,CAAC;AAOF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE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