@adtl/gateway 0.3.1 → 0.4.0
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 +45 -1
- package/dist/audit.d.ts +2 -0
- package/dist/audit.d.ts.map +1 -1
- package/dist/audit.js.map +1 -1
- package/dist/cli.js +54 -15
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +49 -44
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +10 -3
- package/dist/config.js.map +1 -1
- package/dist/gateway.d.ts +1 -1
- package/dist/gateway.d.ts.map +1 -1
- package/dist/gateway.js +3 -2
- package/dist/gateway.js.map +1 -1
- package/dist/hooks/claudeCode.d.ts +7 -1
- package/dist/hooks/claudeCode.d.ts.map +1 -1
- package/dist/hooks/claudeCode.js +43 -3
- package/dist/hooks/claudeCode.js.map +1 -1
- package/dist/hooks/run.d.ts.map +1 -1
- package/dist/hooks/run.js +7 -2
- package/dist/hooks/run.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/init/fromMcpJson.d.ts +41 -0
- package/dist/init/fromMcpJson.d.ts.map +1 -0
- package/dist/init/fromMcpJson.js +141 -0
- package/dist/init/fromMcpJson.js.map +1 -0
- package/dist/init/index.d.ts +2 -0
- package/dist/init/index.d.ts.map +1 -1
- package/dist/init/index.js +2 -0
- package/dist/init/index.js.map +1 -1
- package/dist/init/run.d.ts +13 -0
- package/dist/init/run.d.ts.map +1 -1
- package/dist/init/run.js +83 -11
- package/dist/init/run.js.map +1 -1
- package/dist/ledgerCli.d.ts +7 -0
- package/dist/ledgerCli.d.ts.map +1 -0
- package/dist/ledgerCli.js +86 -0
- package/dist/ledgerCli.js.map +1 -0
- package/dist/startup.d.ts +2 -0
- package/dist/startup.d.ts.map +1 -1
- package/dist/startup.js +9 -2
- package/dist/startup.js.map +1 -1
- package/package.json +6 -5
- package/src/audit.ts +2 -0
- package/src/cli.ts +46 -15
- package/src/config.ts +9 -3
- package/src/gateway.ts +3 -2
- package/src/hooks/claudeCode.ts +47 -4
- package/src/hooks/run.ts +7 -2
- package/src/index.ts +1 -0
- package/src/init/fromMcpJson.ts +165 -0
- package/src/init/index.ts +2 -0
- package/src/init/run.ts +91 -12
- package/src/ledgerCli.ts +83 -0
- package/src/startup.ts +10 -2
package/README.md
CHANGED
|
@@ -78,6 +78,23 @@ adtl-gateway init -c adtl.yaml --write # update the file (original kept as adt
|
|
|
78
78
|
|
|
79
79
|
Always review the result: a preset is a starting point, not a judgment about your data.
|
|
80
80
|
|
|
81
|
+
#### Starting from Claude Code's `.mcp.json`
|
|
82
|
+
|
|
83
|
+
If your servers are already set up in Claude Code, import them:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
adtl-gateway init -c adtl.yaml --from .mcp.json # print both files, change nothing
|
|
87
|
+
adtl-gateway init -c adtl.yaml --from .mcp.json --write # write them (originals kept as .bak)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
- Every stdio and HTTP server in `.mcp.json` becomes an upstream, with its command, args, env, url and headers. `${VAR}` and `${VAR:-default}` keep working, because the gateway expands them the same way. Names that aren't valid upstream ids are adjusted (`docs.api` becomes `docs-api`).
|
|
91
|
+
- `adtl.yaml` is created if it doesn't exist, with restrictive defaults and the two example policy rules; then rules are drafted for every tool as above.
|
|
92
|
+
- With `--write`, the imported servers in `.mcp.json` are replaced by one `adtl` entry that runs `npx -y @adtl/gateway@<version> --config adtl.yaml`. Everything else in the file is kept. Restart Claude Code afterwards.
|
|
93
|
+
- SSE servers stay in `.mcp.json`, because the gateway only speaks Streamable HTTP. So do entries that already run the gateway, and upstreams already in `adtl.yaml` are never changed. Re-running is safe.
|
|
94
|
+
- Any file with `mcpServers` works, such as Claude Desktop's `claude_desktop_config.json`. Servers added with `claude mcp add` live in `~/.claude.json` instead; list them with `claude mcp list`.
|
|
95
|
+
|
|
96
|
+
The gateway starts upstream servers with a minimal environment plus their `env:` entries, not your whole shell environment. If a server relied on a variable from your shell, add it under its `env:`, e.g. `GITHUB_TOKEN: "${GITHUB_TOKEN}"`.
|
|
97
|
+
|
|
81
98
|
Labels only get stricter as a session goes on. A session that has read anything untrusted stays untrusted until the session ends.
|
|
82
99
|
|
|
83
100
|
### Policy
|
|
@@ -178,6 +195,33 @@ With the [example policy](../../examples/adtl.yaml), `Bash` and `WebFetch` run f
|
|
|
178
195
|
|
|
179
196
|
The hook also refuses `Write` and `Edit` on your ADTL config and session files, and asks before shell commands that mention the session directory, so the agent can't simply clear its own taint. This is a speed bump, not a sandbox.
|
|
180
197
|
|
|
198
|
+
## Label ledger
|
|
199
|
+
|
|
200
|
+
Session labels end with the session. If an agent writes untrusted content to a file, a fresh session reading that file tomorrow would trust it. The ledger remembers who wrote what:
|
|
201
|
+
|
|
202
|
+
- After a call by a session that has read untrusted or private data, the text the call sent (tool arguments; with the Claude Code hooks also `Write` and `Edit` content, `Task` prompts and lines a shell command added to files) is recorded by content hash with the session's label. Clean sessions record nothing.
|
|
203
|
+
- Every result the gateway or the hooks label is looked up. If it contains recorded text, that label is joined in, with the origin `adtl-ledger` / `session:<id>`, and the audit entry gets `ledger: { chunks, writers }`.
|
|
204
|
+
- It is on by default and shared by the gateway, the interceptors and the hooks: one SQLite file at `~/.adtl/ledger.db` (or `ADTL_LEDGER`). Configure it in `adtl.yaml`:
|
|
205
|
+
|
|
206
|
+
```yaml
|
|
207
|
+
ledger:
|
|
208
|
+
enabled: true # default
|
|
209
|
+
path: ./ledger.db # optional; relative to this file
|
|
210
|
+
retentionDays: 90 # default
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Look after it with:
|
|
214
|
+
|
|
215
|
+
```sh
|
|
216
|
+
adtl-gateway ledger stats
|
|
217
|
+
adtl-gateway ledger verify # exit 1 if an entry was changed or removed
|
|
218
|
+
adtl-gateway ledger declassify notes.md # after checking it: clear the label of its current content
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Matching is by normalized chunks (whole text, paragraphs, lines of 32+ characters), so text copied into a bigger file still matches, and text the agent rewrote was already recorded with its session's label. Text a person rewrites by hand, binary files, and content an MCP server returns in another encoding (such as base64) are not matched. The Claude Code hook blocks `Write`/`Edit` on the ledger file and asks before shell commands that mention it or `ledger declassify`. Entries are hash-chained, not signed: an agent with shell access could still rebuild the file, which `verify` cannot detect. Signed entries are planned with labels that travel between agents (v0.5).
|
|
222
|
+
|
|
223
|
+
See [the delayed-injection demo](../../examples/delayed-injection-demo) (`npm run demo:ledger`).
|
|
224
|
+
|
|
181
225
|
## How it works
|
|
182
226
|
|
|
183
227
|
```
|
|
@@ -195,7 +239,7 @@ The gateway fails closed. If an interceptor errors or times out, the call is sto
|
|
|
195
239
|
- Tools, resources and prompts are proxied. Resource subscriptions, `list_changed` notifications and completions are not passed through yet.
|
|
196
240
|
- Resources and prompts are labeled by server defaults (`servers.<id>.defaults`) or the global defaults; there are no per-resource or per-prompt rules yet. A resource URI that two upstreams could serve is refused rather than guessed.
|
|
197
241
|
- Approvals come from one push channel (ntfy). Other channels, approvals inside the MCP client, and approver roles are planned.
|
|
198
|
-
-
|
|
242
|
+
- Session labels last for one agent session: one gateway process, or under Claude Code one Claude Code session (shared with the hooks). The [label ledger](#label-ledger) carries them into files, memory servers and sub-agents by content, but not across machines or other agents yet (v0.5).
|
|
199
243
|
- The Claude Code hooks label tools by name, not by what they touched: a `Read` of a downloaded file is as trusted as a `Read` of your own code.
|
|
200
244
|
- Labels are set by your config. Servers' own trust claims can only make labels stricter, unless you set `acceptServerClaims: true`.
|
|
201
245
|
|
package/dist/audit.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export interface AuditEntry {
|
|
|
26
26
|
matched?: unknown;
|
|
27
27
|
callHash?: unknown;
|
|
28
28
|
label?: unknown;
|
|
29
|
+
/** Present when the label ledger recognized content in the result: how many chunks matched, and which sessions wrote them. */
|
|
30
|
+
ledger?: unknown;
|
|
29
31
|
sessionLabel?: unknown;
|
|
30
32
|
warnings?: string[];
|
|
31
33
|
durationMs: number;
|
package/dist/audit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,YAAY,GAAG,gBAAgB,GAAG,aAAa,CAAC;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iGAAiG;IACjG,OAAO,EAAE,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,gBAAgB,CAAC;IAC9D,0FAA0F;IAC1F,GAAG,CAAC,EAAE,kBAAkB,CAAC;IACzB,mGAAmG;IACnG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,2FAA2F;IAC3F,QAAQ,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IACtF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;CAChC;A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HAA8H;IAC9H,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;CAChC;AAED,qBAAa,aAAc,YAAW,SAAS;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM;IAIjC,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;CAG/B;AAED,qBAAa,cAAe,YAAW,SAAS;IAC9C,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,CAAM;IACpC,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;CAG/B"}
|
package/dist/audit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoCpC,MAAM,OAAO,aAAa;IACH;IAArB,YAAqB,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;QAC/B,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,KAAiB;QACrB,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAClE,CAAC;CACF;AAED,MAAM,OAAO,cAAc;IAChB,OAAO,GAAiB,EAAE,CAAC;IACpC,KAAK,CAAC,KAAiB;QACrB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;CACF"}
|
package/dist/cli.js
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* servers through ADTL's interceptors.
|
|
5
5
|
*
|
|
6
6
|
* adtl-gateway --config adtl.yaml [--audit]
|
|
7
|
-
* adtl-gateway init --config adtl.yaml [--write]
|
|
7
|
+
* adtl-gateway init --config adtl.yaml [--from .mcp.json] [--write]
|
|
8
8
|
* adtl-gateway hook --config adtl.yaml [--gateway-server adtl]
|
|
9
|
+
* adtl-gateway ledger stats|verify|declassify <file>
|
|
9
10
|
*
|
|
10
11
|
* Point your MCP client (e.g. Claude Code's .mcp.json) at this command.
|
|
11
12
|
* Logs go to stderr; stdout carries MCP JSON-RPC only.
|
|
@@ -14,11 +15,13 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
14
15
|
import { EnvExpansionError } from "./config.js";
|
|
15
16
|
import { GATEWAY_VERSION } from "./gateway.js";
|
|
16
17
|
import { runHook } from "./hooks/run.js";
|
|
18
|
+
import { runLedgerCommand } from "./ledgerCli.js";
|
|
17
19
|
import { runInit } from "./init/run.js";
|
|
18
20
|
import { GatewayConfigError, loadGatewayConfig, startGateway } from "./startup.js";
|
|
19
21
|
const USAGE = `Usage: adtl-gateway --config <adtl.yaml> [--audit]
|
|
20
|
-
adtl-gateway init --config <adtl.yaml> [--write]
|
|
22
|
+
adtl-gateway init --config <adtl.yaml> [--from <.mcp.json>] [--write]
|
|
21
23
|
adtl-gateway hook --config <adtl.yaml> [--gateway-server <name>]
|
|
24
|
+
adtl-gateway ledger stats|verify|declassify <file> (see: adtl-gateway ledger --help)
|
|
22
25
|
|
|
23
26
|
Runs an MCP server over stdio that forwards tool calls to the upstream
|
|
24
27
|
servers in the config, checking and labeling each call with ADTL.
|
|
@@ -34,6 +37,11 @@ init:
|
|
|
34
37
|
for each tool the config doesn't cover yet (presets for GitHub,
|
|
35
38
|
filesystem and fetch; MCP tool hints otherwise). Existing entries are
|
|
36
39
|
never changed. Prints the updated config; review it before using it.
|
|
40
|
+
--from <file> First import the MCP servers of a client config (Claude
|
|
41
|
+
Code's .mcp.json, or any file with "mcpServers") into
|
|
42
|
+
gateway.upstreams, creating the config file if needed.
|
|
43
|
+
With --write, that file is changed to run the gateway
|
|
44
|
+
in place of the imported servers (original kept as .bak).
|
|
37
45
|
--write Update the config file in place (original kept as .bak).
|
|
38
46
|
|
|
39
47
|
hook:
|
|
@@ -69,12 +77,20 @@ function parseArgs(argv) {
|
|
|
69
77
|
out.audit = true;
|
|
70
78
|
else if (a === "--write" && out.init)
|
|
71
79
|
out.write = true;
|
|
80
|
+
else if (a === "--from" && out.init)
|
|
81
|
+
out.from = argv[++i];
|
|
72
82
|
else
|
|
73
83
|
throw new GatewayConfigError(`Unknown argument: ${a}\n\n${USAGE}`);
|
|
74
84
|
}
|
|
75
85
|
return out;
|
|
76
86
|
}
|
|
77
87
|
async function main() {
|
|
88
|
+
if (process.argv[2] === "ledger") {
|
|
89
|
+
const r = await runLedgerCommand(process.argv.slice(3));
|
|
90
|
+
console.log(r.stdout);
|
|
91
|
+
process.exitCode = r.exitCode;
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
78
94
|
const args = parseArgs(process.argv.slice(2));
|
|
79
95
|
// --help and --version print to stdout and exit; MCP is never served in these modes.
|
|
80
96
|
if (args.help)
|
|
@@ -84,7 +100,7 @@ async function main() {
|
|
|
84
100
|
if (!args.config)
|
|
85
101
|
throw new GatewayConfigError(`Missing --config\n\n${USAGE}`);
|
|
86
102
|
if (args.init)
|
|
87
|
-
return init(args.config, args.write === true);
|
|
103
|
+
return init(args.config, args.write === true, args.from);
|
|
88
104
|
if (args.hook)
|
|
89
105
|
return hook(args.config, args.gatewayServer);
|
|
90
106
|
const loaded = await loadGatewayConfig(args.config);
|
|
@@ -111,7 +127,21 @@ async function main() {
|
|
|
111
127
|
console.error(`[adtl-gateway] ${GATEWAY_VERSION} ready (session ${started.gateway.sessionId})`);
|
|
112
128
|
}
|
|
113
129
|
function summarize(r, path, write) {
|
|
114
|
-
const lines =
|
|
130
|
+
const lines = [];
|
|
131
|
+
if (r.mcp) {
|
|
132
|
+
const m = r.mcp;
|
|
133
|
+
for (const i of m.imported)
|
|
134
|
+
lines.push(` imported ${i.name}${i.id !== i.name ? ` as ${i.id}` : ""} from ${m.path}`);
|
|
135
|
+
for (const k of m.kept)
|
|
136
|
+
lines.push(` ${k.name}: already in the config as ${k.id}, kept as it is`);
|
|
137
|
+
for (const s of m.skipped)
|
|
138
|
+
lines.push(` ${s.name}: left in ${m.path} (${s.reason})`);
|
|
139
|
+
if (!m.imported.length && !m.kept.length)
|
|
140
|
+
lines.push(` nothing to import from ${m.path}`);
|
|
141
|
+
}
|
|
142
|
+
if (r.created)
|
|
143
|
+
lines.push(` ${write ? "created" : "would create"} ${path}`);
|
|
144
|
+
lines.push(...r.reports.map((s) => {
|
|
115
145
|
const parts = [`${s.added.length} tools added`];
|
|
116
146
|
if (s.kept.length)
|
|
117
147
|
parts.push(`${s.kept.length} kept`);
|
|
@@ -120,15 +150,21 @@ function summarize(r, path, write) {
|
|
|
120
150
|
if (s.stale.length)
|
|
121
151
|
parts.push(`no longer offered: ${s.stale.join(", ")}`);
|
|
122
152
|
return ` ${s.id} (${s.preset ? `preset ${s.preset}` : "from tool hints, review"}): ${parts.join("; ")}`;
|
|
123
|
-
});
|
|
153
|
+
}));
|
|
124
154
|
for (const f of r.failed)
|
|
125
155
|
lines.push(` ${f.id}: could not connect, skipped (${f.error})`);
|
|
126
|
-
const changed = r.reports.some((s) => s.added.length || s.addedDefaults);
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
156
|
+
const changed = r.created || r.mcp?.changed || r.reports.some((s) => s.added.length || s.addedDefaults);
|
|
157
|
+
let tail;
|
|
158
|
+
if (!changed)
|
|
159
|
+
tail = "Nothing to add.";
|
|
160
|
+
else if (!write)
|
|
161
|
+
tail = "Nothing written. Review the config above, then re-run with --write.";
|
|
162
|
+
else {
|
|
163
|
+
tail = r.created ? `Wrote ${path}.` : `Updated ${path} (original saved as ${path}.bak).`;
|
|
164
|
+
if (r.mcp?.changed)
|
|
165
|
+
tail += ` ${r.mcp.path} now runs the gateway (original saved as ${r.mcp.path}.bak); restart your MCP client.`;
|
|
166
|
+
tail += ' Review every line marked "review".';
|
|
167
|
+
}
|
|
132
168
|
return `${lines.join("\n")}\n${tail}`;
|
|
133
169
|
}
|
|
134
170
|
async function readStdin() {
|
|
@@ -145,16 +181,19 @@ async function hook(config, gatewayServer) {
|
|
|
145
181
|
process.stderr.write(`${out.stderr}\n`);
|
|
146
182
|
process.exitCode = out.exitCode;
|
|
147
183
|
}
|
|
148
|
-
async function init(path, write) {
|
|
149
|
-
const result = await runInit({ path, write });
|
|
150
|
-
if (!write)
|
|
184
|
+
async function init(path, write, from) {
|
|
185
|
+
const result = await runInit({ path, write, ...(from ? { from } : {}) });
|
|
186
|
+
if (!write) {
|
|
151
187
|
process.stdout.write(result.text);
|
|
188
|
+
if (result.mcp?.changed)
|
|
189
|
+
process.stdout.write(`\n# ${result.mcp.path} with --write:\n${result.mcp.text.replace(/^/gm, "# ")}\n`);
|
|
190
|
+
}
|
|
152
191
|
console.error(`[adtl-gateway] init\n${summarize(result, path, write)}`);
|
|
153
192
|
if (result.failed.length && !result.reports.length)
|
|
154
193
|
process.exitCode = 1;
|
|
155
194
|
}
|
|
156
195
|
main().catch((err) => {
|
|
157
|
-
const known = err instanceof GatewayConfigError || err instanceof EnvExpansionError;
|
|
196
|
+
const known = err instanceof GatewayConfigError || err instanceof EnvExpansionError || process.argv[2] === "ledger";
|
|
158
197
|
console.error(known ? `[adtl-gateway] ${err.message}` : err);
|
|
159
198
|
// For Claude Code hooks only exit code 2 stops the call; any other code lets it run.
|
|
160
199
|
process.exit(process.argv[2] === "hook" ? 2 : 1);
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAmB,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEnF,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCAoCyB,CAAC;AAcxC,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,GAAG,GAAS,EAAE,CAAC;IACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,MAAM;YAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;aACxC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,MAAM;YAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;aAC7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,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACnI,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,wBAAwB,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;IACxE,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM;QAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AAC3E,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC5B,MAAM,KAAK,GAAG,GAAG,YAAY,kBAAkB,IAAI,GAAG,YAAY,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC;IACpH,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,kBAAmB,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACxE,qFAAqF;IACrF,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
* to: you@example.com
|
|
22
22
|
*
|
|
23
23
|
* `${VAR}` in command, args, env, cwd, url, headers and approval settings is
|
|
24
|
-
* replaced from the gateway's environment. A missing variable is a config error
|
|
24
|
+
* replaced from the gateway's environment. A missing variable is a config error,
|
|
25
|
+
* unless a default is given: `${VAR:-default}`.
|
|
25
26
|
*/
|
|
26
27
|
import { z } from "zod";
|
|
27
28
|
export declare const StdioUpstreamSchema: z.ZodObject<{
|
|
@@ -121,6 +122,7 @@ export declare const EmailConfigSchema: z.ZodObject<{
|
|
|
121
122
|
to: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "atleastone">]>;
|
|
122
123
|
on: z.ZodDefault<z.ZodArray<z.ZodEnum<["pending", "blocked", "approved", "denied", "timeout", "undeliverable"]>, "atleastone">>;
|
|
123
124
|
}, "strict", z.ZodTypeAny, {
|
|
125
|
+
on: ["approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked", ...("approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked")[]];
|
|
124
126
|
smtp: {
|
|
125
127
|
host: string;
|
|
126
128
|
port: number;
|
|
@@ -130,7 +132,6 @@ export declare const EmailConfigSchema: z.ZodObject<{
|
|
|
130
132
|
};
|
|
131
133
|
from: string;
|
|
132
134
|
to: string | [string, ...string[]];
|
|
133
|
-
on: ["pending" | "blocked" | "approved" | "denied" | "timeout" | "undeliverable", ...("pending" | "blocked" | "approved" | "denied" | "timeout" | "undeliverable")[]];
|
|
134
135
|
}, {
|
|
135
136
|
smtp: {
|
|
136
137
|
host: string;
|
|
@@ -141,7 +142,7 @@ export declare const EmailConfigSchema: z.ZodObject<{
|
|
|
141
142
|
};
|
|
142
143
|
from: string;
|
|
143
144
|
to: string | [string, ...string[]];
|
|
144
|
-
on?: ["
|
|
145
|
+
on?: ["approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked", ...("approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked")[]] | undefined;
|
|
145
146
|
}>;
|
|
146
147
|
export declare const ApprovalsConfigSchema: z.ZodObject<{
|
|
147
148
|
/**
|
|
@@ -192,6 +193,7 @@ export declare const ApprovalsConfigSchema: z.ZodObject<{
|
|
|
192
193
|
to: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "atleastone">]>;
|
|
193
194
|
on: z.ZodDefault<z.ZodArray<z.ZodEnum<["pending", "blocked", "approved", "denied", "timeout", "undeliverable"]>, "atleastone">>;
|
|
194
195
|
}, "strict", z.ZodTypeAny, {
|
|
196
|
+
on: ["approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked", ...("approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked")[]];
|
|
195
197
|
smtp: {
|
|
196
198
|
host: string;
|
|
197
199
|
port: number;
|
|
@@ -201,7 +203,6 @@ export declare const ApprovalsConfigSchema: z.ZodObject<{
|
|
|
201
203
|
};
|
|
202
204
|
from: string;
|
|
203
205
|
to: string | [string, ...string[]];
|
|
204
|
-
on: ["pending" | "blocked" | "approved" | "denied" | "timeout" | "undeliverable", ...("pending" | "blocked" | "approved" | "denied" | "timeout" | "undeliverable")[]];
|
|
205
206
|
}, {
|
|
206
207
|
smtp: {
|
|
207
208
|
host: string;
|
|
@@ -212,17 +213,12 @@ export declare const ApprovalsConfigSchema: z.ZodObject<{
|
|
|
212
213
|
};
|
|
213
214
|
from: string;
|
|
214
215
|
to: string | [string, ...string[]];
|
|
215
|
-
on?: ["
|
|
216
|
+
on?: ["approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked", ...("approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked")[]] | undefined;
|
|
216
217
|
}>>;
|
|
217
218
|
}, "strict", z.ZodTypeAny, {
|
|
218
219
|
timeoutSeconds: number;
|
|
219
|
-
ntfy?: {
|
|
220
|
-
server: string;
|
|
221
|
-
topic: string;
|
|
222
|
-
replyTopic?: string | undefined;
|
|
223
|
-
token?: string | undefined;
|
|
224
|
-
} | undefined;
|
|
225
220
|
email?: {
|
|
221
|
+
on: ["approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked", ...("approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked")[]];
|
|
226
222
|
smtp: {
|
|
227
223
|
host: string;
|
|
228
224
|
port: number;
|
|
@@ -232,15 +228,14 @@ export declare const ApprovalsConfigSchema: z.ZodObject<{
|
|
|
232
228
|
};
|
|
233
229
|
from: string;
|
|
234
230
|
to: string | [string, ...string[]];
|
|
235
|
-
on: ["pending" | "blocked" | "approved" | "denied" | "timeout" | "undeliverable", ...("pending" | "blocked" | "approved" | "denied" | "timeout" | "undeliverable")[]];
|
|
236
231
|
} | undefined;
|
|
237
|
-
}, {
|
|
238
232
|
ntfy?: {
|
|
233
|
+
server: string;
|
|
239
234
|
topic: string;
|
|
240
|
-
server?: string | undefined;
|
|
241
235
|
replyTopic?: string | undefined;
|
|
242
236
|
token?: string | undefined;
|
|
243
237
|
} | undefined;
|
|
238
|
+
}, {
|
|
244
239
|
email?: {
|
|
245
240
|
smtp: {
|
|
246
241
|
host: string;
|
|
@@ -251,9 +246,15 @@ export declare const ApprovalsConfigSchema: z.ZodObject<{
|
|
|
251
246
|
};
|
|
252
247
|
from: string;
|
|
253
248
|
to: string | [string, ...string[]];
|
|
254
|
-
on?: ["
|
|
249
|
+
on?: ["approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked", ...("approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked")[]] | undefined;
|
|
255
250
|
} | undefined;
|
|
256
251
|
timeoutSeconds?: number | undefined;
|
|
252
|
+
ntfy?: {
|
|
253
|
+
topic: string;
|
|
254
|
+
server?: string | undefined;
|
|
255
|
+
replyTopic?: string | undefined;
|
|
256
|
+
token?: string | undefined;
|
|
257
|
+
} | undefined;
|
|
257
258
|
}>;
|
|
258
259
|
export type ApprovalsConfig = z.infer<typeof ApprovalsConfigSchema>;
|
|
259
260
|
export declare const GatewayConfigSchema: z.ZodObject<{
|
|
@@ -388,6 +389,7 @@ export declare const GatewayConfigSchema: z.ZodObject<{
|
|
|
388
389
|
to: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "atleastone">]>;
|
|
389
390
|
on: z.ZodDefault<z.ZodArray<z.ZodEnum<["pending", "blocked", "approved", "denied", "timeout", "undeliverable"]>, "atleastone">>;
|
|
390
391
|
}, "strict", z.ZodTypeAny, {
|
|
392
|
+
on: ["approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked", ...("approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked")[]];
|
|
391
393
|
smtp: {
|
|
392
394
|
host: string;
|
|
393
395
|
port: number;
|
|
@@ -397,7 +399,6 @@ export declare const GatewayConfigSchema: z.ZodObject<{
|
|
|
397
399
|
};
|
|
398
400
|
from: string;
|
|
399
401
|
to: string | [string, ...string[]];
|
|
400
|
-
on: ["pending" | "blocked" | "approved" | "denied" | "timeout" | "undeliverable", ...("pending" | "blocked" | "approved" | "denied" | "timeout" | "undeliverable")[]];
|
|
401
402
|
}, {
|
|
402
403
|
smtp: {
|
|
403
404
|
host: string;
|
|
@@ -408,17 +409,12 @@ export declare const GatewayConfigSchema: z.ZodObject<{
|
|
|
408
409
|
};
|
|
409
410
|
from: string;
|
|
410
411
|
to: string | [string, ...string[]];
|
|
411
|
-
on?: ["
|
|
412
|
+
on?: ["approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked", ...("approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked")[]] | undefined;
|
|
412
413
|
}>>;
|
|
413
414
|
}, "strict", z.ZodTypeAny, {
|
|
414
415
|
timeoutSeconds: number;
|
|
415
|
-
ntfy?: {
|
|
416
|
-
server: string;
|
|
417
|
-
topic: string;
|
|
418
|
-
replyTopic?: string | undefined;
|
|
419
|
-
token?: string | undefined;
|
|
420
|
-
} | undefined;
|
|
421
416
|
email?: {
|
|
417
|
+
on: ["approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked", ...("approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked")[]];
|
|
422
418
|
smtp: {
|
|
423
419
|
host: string;
|
|
424
420
|
port: number;
|
|
@@ -428,15 +424,14 @@ export declare const GatewayConfigSchema: z.ZodObject<{
|
|
|
428
424
|
};
|
|
429
425
|
from: string;
|
|
430
426
|
to: string | [string, ...string[]];
|
|
431
|
-
on: ["pending" | "blocked" | "approved" | "denied" | "timeout" | "undeliverable", ...("pending" | "blocked" | "approved" | "denied" | "timeout" | "undeliverable")[]];
|
|
432
427
|
} | undefined;
|
|
433
|
-
}, {
|
|
434
428
|
ntfy?: {
|
|
429
|
+
server: string;
|
|
435
430
|
topic: string;
|
|
436
|
-
server?: string | undefined;
|
|
437
431
|
replyTopic?: string | undefined;
|
|
438
432
|
token?: string | undefined;
|
|
439
433
|
} | undefined;
|
|
434
|
+
}, {
|
|
440
435
|
email?: {
|
|
441
436
|
smtp: {
|
|
442
437
|
host: string;
|
|
@@ -447,9 +442,15 @@ export declare const GatewayConfigSchema: z.ZodObject<{
|
|
|
447
442
|
};
|
|
448
443
|
from: string;
|
|
449
444
|
to: string | [string, ...string[]];
|
|
450
|
-
on?: ["
|
|
445
|
+
on?: ["approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked", ...("approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked")[]] | undefined;
|
|
451
446
|
} | undefined;
|
|
452
447
|
timeoutSeconds?: number | undefined;
|
|
448
|
+
ntfy?: {
|
|
449
|
+
topic: string;
|
|
450
|
+
server?: string | undefined;
|
|
451
|
+
replyTopic?: string | undefined;
|
|
452
|
+
token?: string | undefined;
|
|
453
|
+
} | undefined;
|
|
453
454
|
}>>;
|
|
454
455
|
/** Timeout for each interceptor invocation, in milliseconds. */
|
|
455
456
|
interceptorTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
@@ -465,22 +466,17 @@ export declare const GatewayConfigSchema: z.ZodObject<{
|
|
|
465
466
|
}>;
|
|
466
467
|
mode: "audit" | "active";
|
|
467
468
|
interceptorTimeoutMs: number;
|
|
469
|
+
audit?: string | undefined;
|
|
468
470
|
interceptors?: {
|
|
469
471
|
command: string;
|
|
470
472
|
args: string[];
|
|
471
473
|
env: Record<string, string>;
|
|
472
474
|
cwd?: string | undefined;
|
|
473
475
|
} | undefined;
|
|
474
|
-
audit?: string | undefined;
|
|
475
476
|
approvals?: {
|
|
476
477
|
timeoutSeconds: number;
|
|
477
|
-
ntfy?: {
|
|
478
|
-
server: string;
|
|
479
|
-
topic: string;
|
|
480
|
-
replyTopic?: string | undefined;
|
|
481
|
-
token?: string | undefined;
|
|
482
|
-
} | undefined;
|
|
483
478
|
email?: {
|
|
479
|
+
on: ["approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked", ...("approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked")[]];
|
|
484
480
|
smtp: {
|
|
485
481
|
host: string;
|
|
486
482
|
port: number;
|
|
@@ -490,7 +486,12 @@ export declare const GatewayConfigSchema: z.ZodObject<{
|
|
|
490
486
|
};
|
|
491
487
|
from: string;
|
|
492
488
|
to: string | [string, ...string[]];
|
|
493
|
-
|
|
489
|
+
} | undefined;
|
|
490
|
+
ntfy?: {
|
|
491
|
+
server: string;
|
|
492
|
+
topic: string;
|
|
493
|
+
replyTopic?: string | undefined;
|
|
494
|
+
token?: string | undefined;
|
|
494
495
|
} | undefined;
|
|
495
496
|
} | undefined;
|
|
496
497
|
}, {
|
|
@@ -503,21 +504,15 @@ export declare const GatewayConfigSchema: z.ZodObject<{
|
|
|
503
504
|
url: string;
|
|
504
505
|
headers?: Record<string, string> | undefined;
|
|
505
506
|
}>;
|
|
507
|
+
audit?: string | undefined;
|
|
506
508
|
interceptors?: {
|
|
507
509
|
command: string;
|
|
508
510
|
args?: string[] | undefined;
|
|
509
511
|
env?: Record<string, string> | undefined;
|
|
510
512
|
cwd?: string | undefined;
|
|
511
513
|
} | undefined;
|
|
512
|
-
audit?: string | undefined;
|
|
513
514
|
mode?: "audit" | "active" | undefined;
|
|
514
515
|
approvals?: {
|
|
515
|
-
ntfy?: {
|
|
516
|
-
topic: string;
|
|
517
|
-
server?: string | undefined;
|
|
518
|
-
replyTopic?: string | undefined;
|
|
519
|
-
token?: string | undefined;
|
|
520
|
-
} | undefined;
|
|
521
516
|
email?: {
|
|
522
517
|
smtp: {
|
|
523
518
|
host: string;
|
|
@@ -528,9 +523,15 @@ export declare const GatewayConfigSchema: z.ZodObject<{
|
|
|
528
523
|
};
|
|
529
524
|
from: string;
|
|
530
525
|
to: string | [string, ...string[]];
|
|
531
|
-
on?: ["
|
|
526
|
+
on?: ["approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked", ...("approved" | "denied" | "timeout" | "undeliverable" | "pending" | "blocked")[]] | undefined;
|
|
532
527
|
} | undefined;
|
|
533
528
|
timeoutSeconds?: number | undefined;
|
|
529
|
+
ntfy?: {
|
|
530
|
+
topic: string;
|
|
531
|
+
server?: string | undefined;
|
|
532
|
+
replyTopic?: string | undefined;
|
|
533
|
+
token?: string | undefined;
|
|
534
|
+
} | undefined;
|
|
534
535
|
} | undefined;
|
|
535
536
|
interceptorTimeoutMs?: number | undefined;
|
|
536
537
|
}>;
|
|
@@ -540,7 +541,11 @@ export declare class EnvExpansionError extends Error {
|
|
|
540
541
|
readonly variable: string;
|
|
541
542
|
constructor(variable: string, where: string);
|
|
542
543
|
}
|
|
543
|
-
/**
|
|
544
|
+
/**
|
|
545
|
+
* Replace `${VAR}` with values from `env`, and `${VAR:-default}` with `default`
|
|
546
|
+
* when VAR is unset or empty (as Claude Code's .mcp.json does). `$${VAR}` keeps
|
|
547
|
+
* a literal `${VAR}`.
|
|
548
|
+
*/
|
|
544
549
|
export declare function expandEnv(value: string, env: NodeJS.ProcessEnv, where: string): string;
|
|
545
550
|
export declare function expandUpstream<T extends Upstream>(id: string, u: T, env: NodeJS.ProcessEnv): T;
|
|
546
551
|
/** Expand `${VAR}` in every string of the approvals section. */
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAOrB,CAAC;AAEZ,eAAO,MAAM,kBAAkB;;;;;;;;;EAKpB,CAAC;AAEZ,eAAO,MAAM,cAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGzD,CAAC;AACZ,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,qBAAa,iBAAkB,SAAQ,KAAK;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM;gBAAhB,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CAIrD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAQtF;AAMD,wBAAgB,cAAc,CAAC,CAAC,SAAS,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,CAAC,CAY9F;AAED,gEAAgE;AAChE,wBAAgB,eAAe,CAAC,CAAC,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,eAAe,CAQ3F;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,QAAQ,GAAG,CAAC,IAAI,YAAY,CAE7D"}
|
package/dist/config.js
CHANGED
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
* to: you@example.com
|
|
22
22
|
*
|
|
23
23
|
* `${VAR}` in command, args, env, cwd, url, headers and approval settings is
|
|
24
|
-
* replaced from the gateway's environment. A missing variable is a config error
|
|
24
|
+
* replaced from the gateway's environment. A missing variable is a config error,
|
|
25
|
+
* unless a default is given: `${VAR:-default}`.
|
|
25
26
|
*/
|
|
26
27
|
import { z } from "zod";
|
|
27
28
|
import { EMAIL_EVENTS } from "./email.js";
|
|
@@ -111,12 +112,18 @@ export class EnvExpansionError extends Error {
|
|
|
111
112
|
this.name = "EnvExpansionError";
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* Replace `${VAR}` with values from `env`, and `${VAR:-default}` with `default`
|
|
117
|
+
* when VAR is unset or empty (as Claude Code's .mcp.json does). `$${VAR}` keeps
|
|
118
|
+
* a literal `${VAR}`.
|
|
119
|
+
*/
|
|
115
120
|
export function expandEnv(value, env, where) {
|
|
116
|
-
return value.replace(/(\$?)\$\{([A-Za-z_][A-Za-z0-9_]*)
|
|
121
|
+
return value.replace(/(\$?)\$\{([A-Za-z_][A-Za-z0-9_]*)(?::-([^}]*))?\}/g, (match, escape, name, fallback) => {
|
|
117
122
|
if (escape)
|
|
118
123
|
return match.slice(1);
|
|
119
124
|
const v = env[name];
|
|
125
|
+
if (fallback !== undefined)
|
|
126
|
+
return v === undefined || v === "" ? fallback : v;
|
|
120
127
|
if (v === undefined)
|
|
121
128
|
throw new EnvExpansionError(name, where);
|
|
122
129
|
return v;
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAEtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC;KACjC,MAAM,CAAC;IACN,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACrC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CA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AAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5H,OAAO,CAAC,CAAC;IACX,CAAC,CAAC;IACF,OAAO,IAAI,CAAC,CAAC,EAAE,mBAAmB,CAAoB,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,CAAW;IACxC,OAAO,KAAK,IAAI,CAAC,CAAC;AACpB,CAAC"}
|
package/dist/gateway.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { type CallToolResult, type GetPromptResult, type Prompt, type ReadResour
|
|
|
4
4
|
import type { ApprovalBroker } from "./approvals.js";
|
|
5
5
|
import type { AuditSink } from "./audit.js";
|
|
6
6
|
import type { InterceptorInvoker } from "./invoker.js";
|
|
7
|
-
export declare const GATEWAY_VERSION = "0.
|
|
7
|
+
export declare const GATEWAY_VERSION = "0.4.0";
|
|
8
8
|
/** `_meta` key on gateway-generated error results describing why a call was stopped. */
|
|
9
9
|
export declare const GATEWAY_DECISION_KEY = "adtl/gateway";
|
|
10
10
|
export interface GatewayLogger {
|