@akai-workflow-builder/cli-sdk 0.14.0 → 0.15.1

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 (42) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +57 -3
  3. package/dist/ctx/build-ctx.d.ts +10 -0
  4. package/dist/ctx/build-ctx.d.ts.map +1 -1
  5. package/dist/ctx/build-ctx.js +6 -0
  6. package/dist/ctx/private-egress.d.ts +81 -0
  7. package/dist/ctx/private-egress.d.ts.map +1 -0
  8. package/dist/ctx/private-egress.js +252 -0
  9. package/dist/ctx/read-file-stream.d.ts +7 -3
  10. package/dist/ctx/read-file-stream.d.ts.map +1 -1
  11. package/dist/ctx/read-file-stream.js +11 -5
  12. package/dist/ctx/safe-fetch.d.ts +48 -0
  13. package/dist/ctx/safe-fetch.d.ts.map +1 -1
  14. package/dist/ctx/safe-fetch.js +123 -14
  15. package/dist/define-connection.d.ts +3 -0
  16. package/dist/define-connection.d.ts.map +1 -1
  17. package/dist/define-connection.js +40 -0
  18. package/dist/index.d.ts +1 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/manifest/json-schema.d.ts +5 -0
  21. package/dist/manifest/json-schema.d.ts.map +1 -1
  22. package/dist/manifest/json-schema.js +36 -0
  23. package/dist/manifest/types.d.ts +6 -0
  24. package/dist/manifest/types.d.ts.map +1 -1
  25. package/dist/runtime/executor/index.d.ts +9 -0
  26. package/dist/runtime/executor/index.d.ts.map +1 -1
  27. package/dist/runtime/executor/index.js +2 -1
  28. package/dist/runtime/index.d.ts +1 -0
  29. package/dist/runtime/index.d.ts.map +1 -1
  30. package/dist/runtime/registry/connection-manifest.d.ts.map +1 -1
  31. package/dist/runtime/registry/connection-manifest.js +1 -0
  32. package/dist/runtime/registry/loader.js +34 -6
  33. package/dist/runtime/registry/manifest-wire.d.ts.map +1 -1
  34. package/dist/runtime/registry/manifest-wire.js +2 -1
  35. package/dist/runtime/registry/types.d.ts +7 -0
  36. package/dist/runtime/registry/types.d.ts.map +1 -1
  37. package/dist/runtime/registry/wire.d.ts +17 -0
  38. package/dist/runtime/registry/wire.d.ts.map +1 -1
  39. package/dist/runtime/registry/wire.js +13 -0
  40. package/dist/types.d.ts +23 -2
  41. package/dist/types.d.ts.map +1 -1
  42. package/package.json +3 -2
@@ -4,6 +4,7 @@ import { isIPv4, isIPv6 } from 'node:net';
4
4
  import { randomUUID } from 'node:crypto';
5
5
  import { Readable } from 'node:stream';
6
6
  import { AkaiEgressError, AkaiResponseTooLargeError } from '../errors.js';
7
+ import { canonicalIp, cidrContains, isForbiddenPinAddress, normalizePrivateEgress, } from './private-egress.js';
7
8
  import { ensureTrustedCa } from './trusted-ca.js';
8
9
  /**
9
10
  * Default per-response byte cap for JSON/text `ctx.fetch` calls (override via
@@ -90,6 +91,51 @@ function hostMatches(hostname, allowed) {
90
91
  return hostname === a || hostname.endsWith(`.${a}`);
91
92
  });
92
93
  }
94
+ /**
95
+ * Decide whether an operator pin allows a request whose host resolved to a
96
+ * private address. Returns the pin and the checked addresses, or `null` — and
97
+ * on `null` the caller throws the same refusal it always has, word for word.
98
+ *
99
+ * A pin allows the call only when ALL of these hold:
100
+ * - the calling CLI is the pin's CLI (`cliId === pin.cli`);
101
+ * - the URL host is the pin's host, exactly: `url.hostname` is already
102
+ * lowercased by WHATWG URL, and there is no suffix or wildcard match, so
103
+ * `x.host`, `evilhost` and `host.evil.com` all fail;
104
+ * - the scheme is `https:` and the port is the pin's (443 by default);
105
+ * - EVERY resolved address is inside one of the pin's CIDRs and none of them
106
+ * is loopback, link-local (incl. the metadata address) or unspecified.
107
+ * Addresses are canonicalized first, so `::ffff:127.0.0.1` and `::ffff:7f00:1`
108
+ * are judged as the `127.0.0.1` they are. A mixed answer — one address in the
109
+ * CIDR, one outside it — fails: a single bad record is enough.
110
+ *
111
+ * Several pins may share a CLI and host; the first that satisfies all of the
112
+ * above wins.
113
+ */
114
+ export function matchPrivatePin(pins, cliId, url, addresses) {
115
+ if (url.protocol !== 'https:' || addresses.length === 0)
116
+ return null;
117
+ const port = url.port === '' ? 443 : Number(url.port);
118
+ for (const pin of pins) {
119
+ if (pin.cli !== cliId || pin.host !== url.hostname || pin.port !== port)
120
+ continue;
121
+ const checked = [];
122
+ let allInside = true;
123
+ for (const address of addresses) {
124
+ const ip = canonicalIp(address);
125
+ if (ip === null || isForbiddenPinAddress(ip) || !pin.cidrs.some((cidr) => cidrContains(cidr, ip))) {
126
+ allInside = false;
127
+ break;
128
+ }
129
+ // An IPv4-mapped IPv6 answer is pinned as the plain IPv4 address it is.
130
+ const canonical = ip.length === 4 ? Array.from(ip).join('.') : address;
131
+ if (!checked.includes(canonical))
132
+ checked.push(canonical);
133
+ }
134
+ if (allInside)
135
+ return { pin, addresses: checked };
136
+ }
137
+ return null;
138
+ }
93
139
  /**
94
140
  * Decide the redirect mode for one call.
95
141
  *
@@ -147,6 +193,9 @@ const FORWARDED_INIT_FIELDS = [
147
193
  export function createSafeFetch(binding) {
148
194
  const { egress, cliId, toolName, sdkVersion, tenantId, clientCert, userAgent, trustedCa, maxResponseBytes } = binding;
149
195
  const maxBytes = maxResponseBytes ?? DEFAULT_MAX_RESPONSE_BYTES;
196
+ // Validated once per binding. An entry that fails validation is gone from here
197
+ // on, so the request path below only ever sees pins that are safe to match.
198
+ const privatePins = normalizePrivateEgress(binding.privateEgress, binding.onPrivateEgressInvalid);
150
199
  return async function safeFetch(rawUrl, init = {}) {
151
200
  // Coerce once. Otherwise `new URL(rawUrl)` (for validation) and
152
201
  // `fetch(rawUrl, …)` would invoke `Symbol.toPrimitive`/`toString` twice,
@@ -191,9 +240,16 @@ export function createSafeFetch(binding) {
191
240
  dnsMessage: err instanceof Error ? err.message : String(err),
192
241
  });
193
242
  }
243
+ // Set only when an operator pin allows this call to reach a private address.
244
+ let pinned = null;
194
245
  if (!isDev) {
195
246
  for (const { address } of addresses) {
196
247
  if (isPrivateIp(address)) {
248
+ // The pin is judged against the WHOLE answer, once, at the first
249
+ // private address. No match → the refusal below, unchanged.
250
+ pinned = matchPrivatePin(privatePins, cliId, u, addresses.map((entry) => entry.address));
251
+ if (pinned !== null)
252
+ break;
197
253
  throw new AkaiEgressError(`safe-fetch: ${u.hostname} resolved to private address ${address}`, { hostname: u.hostname, address, allResolved: addresses.map((entry) => entry.address) });
198
254
  }
199
255
  }
@@ -234,14 +290,25 @@ export function createSafeFetch(binding) {
234
290
  // this path rides `node:https` — same TLS stack, zero dependencies —
235
291
  // and adapts back to a standard `Response`. Dev-mode `http:` URLs fall
236
292
  // through to plain fetch: there is no TLS handshake to present a cert on.
293
+ //
294
+ // A pinned private-egress call also rides `node:https`, for a different
295
+ // reason: global fetch would resolve the host a second time and could be
296
+ // sent to an address the check above never saw (DNS rebinding), and it
297
+ // cannot take a per-connection CA. See pinnedHttpsFetch.
298
+ //
237
299
  // Extra CAs go into Node's default CA list (extended, never replaced) so
238
300
  // every transport below picks them up: global fetch, a host-installed
239
301
  // global dispatcher (e.g. a proxy), and the node:https mTLS path.
240
302
  if (trustedCa !== undefined && u.protocol === 'https:')
241
303
  ensureTrustedCa(trustedCa, { cliId, toolName });
242
- const response = clientCert !== undefined && u.protocol === 'https:'
243
- ? await mtlsFetch(u, sanitized, clientCert)
244
- : await fetch(url, sanitized);
304
+ const response = pinned !== null
305
+ ? await pinnedHttpsFetch(u, sanitized, {
306
+ ...(clientCert !== undefined ? { identity: clientCert } : {}),
307
+ pin: { addresses: pinned.addresses, ...(pinned.pin.caPem !== undefined ? { caPem: pinned.pin.caPem } : {}) },
308
+ })
309
+ : clientCert !== undefined && u.protocol === 'https:'
310
+ ? await pinnedHttpsFetch(u, sanitized, { identity: clientCert })
311
+ : await fetch(url, sanitized);
245
312
  return capResponseBody(response, maxBytes, { hostname: u.hostname, cliId, toolName });
246
313
  };
247
314
  }
@@ -285,8 +352,26 @@ function capResponseBody(res, maxBytes, info) {
285
352
  /** Response statuses that must not carry a body (Response ctor throws otherwise). */
286
353
  const NULL_BODY_STATUSES = new Set([204, 205, 304]);
287
354
  /**
288
- * Minimal fetch-over-`node:https` used only for mutual-TLS requests. Parity
289
- * notes vs global fetch:
355
+ * A `lookup` that answers with the addresses safe-fetch already checked, so the
356
+ * socket cannot be sent anywhere a second DNS answer might point. Node calls it
357
+ * in either shape — `all: true` (happy-eyeballs, the default since Node 20) wants
358
+ * a list, the legacy form wants one address and its family.
359
+ */
360
+ export function pinnedLookup(addresses) {
361
+ const entries = addresses.map((address) => ({ address, family: isIPv6(address) ? 6 : 4 }));
362
+ return (_hostname, options, callback) => {
363
+ if (options.all) {
364
+ callback(null, entries.map((entry) => ({ ...entry })));
365
+ }
366
+ else {
367
+ callback(null, entries[0].address, entries[0].family);
368
+ }
369
+ };
370
+ }
371
+ /**
372
+ * Minimal fetch-over-`node:https`, used for the two cases global fetch cannot
373
+ * serve: mutual-TLS requests (`identity`) and operator-pinned private egress
374
+ * (`pin`). Parity notes vs global fetch:
290
375
  * - `https.request` never follows redirects itself, so redirect handling is
291
376
  * explicit: under `redirect: 'manual'` a 3xx is returned to the caller like
292
377
  * any other response, and otherwise it is rejected — matching what
@@ -297,8 +382,21 @@ const NULL_BODY_STATUSES = new Set([204, 205, 304]);
297
382
  * buffered, not streamed (fine for the ≤tens-of-MB payloads tools move).
298
383
  * - No `accept-encoding` is sent, so upstreams respond uncompressed; if one
299
384
  * compresses anyway the raw bytes surface with `content-encoding` intact.
385
+ *
386
+ * With a `pin`, the connection is held to what the egress check saw:
387
+ * - `lookup` answers only the checked addresses, so a second DNS answer (DNS
388
+ * rebinding) cannot redirect the socket;
389
+ * - `servername` is the pinned host and `ca` is the pin's CA when it has one —
390
+ * verification stays on, and the CA replaces the default store for this
391
+ * connection alone;
392
+ * - the `Host` header is forced to the pinned host. Global fetch ignores a
393
+ * caller-supplied `Host`, `node:https` does not, and the private gateway
394
+ * behind a pinned host routes on it, so a handler could otherwise ask a
395
+ * shared load balancer for a different internal service;
396
+ * - `agent: false` opens a fresh connection through that `lookup` instead of
397
+ * reusing a pooled socket that was dialled under another answer.
300
398
  */
301
- async function mtlsFetch(url, init, identity) {
399
+ async function pinnedHttpsFetch(url, init, { identity, pin }) {
302
400
  const headers = init.headers;
303
401
  const method = (init.method ?? 'GET').toUpperCase();
304
402
  let body;
@@ -318,14 +416,25 @@ async function mtlsFetch(url, init, identity) {
318
416
  headers.forEach((value, name) => {
319
417
  headerRecord[name] = value;
320
418
  });
419
+ // `Headers` lowercases names, so this drops every spelling a handler tried.
420
+ if (pin)
421
+ headerRecord['host'] = url.host;
422
+ const requestOptions = {
423
+ method,
424
+ headers: headerRecord,
425
+ ...(identity ? { cert: identity.cert, key: identity.key } : {}),
426
+ ...(pin
427
+ ? {
428
+ lookup: pinnedLookup(pin.addresses),
429
+ servername: url.hostname,
430
+ agent: false,
431
+ ...(pin.caPem !== undefined ? { ca: pin.caPem } : {}),
432
+ }
433
+ : {}),
434
+ ...(init.signal ? { signal: init.signal } : {}),
435
+ };
321
436
  return new Promise((resolve, reject) => {
322
- const req = httpsRequest(url, {
323
- method,
324
- headers: headerRecord,
325
- cert: identity.cert,
326
- key: identity.key,
327
- ...(init.signal ? { signal: init.signal } : {}),
328
- }, (res) => {
437
+ const req = httpsRequest(url, requestOptions, (res) => {
329
438
  // Synchronous throws in here (e.g. Response rejecting an interim
330
439
  // status) must reject the fetch promise, not escape into http's
331
440
  // event handling.
@@ -336,7 +445,7 @@ async function mtlsFetch(url, init, identity) {
336
445
  status < 400 &&
337
446
  res.headers.location !== undefined) {
338
447
  res.resume();
339
- reject(new AkaiEgressError(`safe-fetch: refusing redirect (${status}) on mutual-TLS request to ${url.hostname}`, { hostname: url.hostname, status }));
448
+ reject(new AkaiEgressError(`safe-fetch: refusing redirect (${status}) on ${pin ? 'pinned private-egress' : 'mutual-TLS'} request to ${url.hostname}`, { hostname: url.hostname, status }));
340
449
  return;
341
450
  }
342
451
  // rawHeaders (flat name/value pairs) preserves repeated headers like
@@ -17,6 +17,9 @@ export declare function isAkaiConnection(x: unknown): x is ConnectionDef;
17
17
  *
18
18
  * CLIs link to a connection through `defineCLI({ connectionSlug: <slug> })` —
19
19
  * `defineCLI` is unchanged.
20
+ *
21
+ * A connection that sets `mcpServer` instead stands for a hosted MCP server: it has
22
+ * no CLIs, no static OAuth client and no secrets (see {@link ConnectionSpec.mcpServer}).
20
23
  */
21
24
  export declare function defineConnection(spec: ConnectionSpec): ConnectionDef;
22
25
  //# sourceMappingURL=define-connection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"define-connection.d.ts","sourceRoot":"","sources":["../src/define-connection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EAEb,cAAc,EAGf,MAAM,YAAY,CAAC;AAkQpB,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,aAAa,CAE/D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,aAAa,CAkFpE"}
1
+ {"version":3,"file":"define-connection.d.ts","sourceRoot":"","sources":["../src/define-connection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EAEb,cAAc,EAGf,MAAM,YAAY,CAAC;AAsSpB,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,aAAa,CAE/D;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,aAAa,CAmFpE"}
@@ -155,9 +155,45 @@ const ConnectionSpecShape = z
155
155
  oauth: ConnectionOAuthConfigShape.optional(),
156
156
  jwtRefresh: JwtRefreshShape.optional(),
157
157
  nativeBuiltin: z.boolean({ error: 'nativeBuiltin must be a boolean if provided' }).optional(),
158
+ mcpServer: z
159
+ .object({ url: UrlString }, { error: 'mcpServer must be an object with a url if provided' })
160
+ .optional(),
158
161
  override: z.boolean({ error: 'override must be a boolean if provided' }).optional(),
159
162
  })
160
163
  .superRefine((spec, ctx) => {
164
+ // A hosted MCP server authenticates through the server's own OAuth (discovered + dynamically
165
+ // registered by the host at connect time) or not at all. It carries no static OAuth client and
166
+ // no credentials of its own, so every credential-shaped field is forbidden. Checked first (and
167
+ // returning early) so the surfaced issue names the mcpServer conflict, not a downstream rule.
168
+ if (spec.mcpServer) {
169
+ if (spec.authKind === 'apiKey') {
170
+ ctx.addIssue({
171
+ code: 'custom',
172
+ path: ['authKind'],
173
+ message: "authKind 'apiKey' is not supported with mcpServer yet (use 'oauth2' or 'none')",
174
+ });
175
+ }
176
+ if (spec.oauth !== undefined) {
177
+ ctx.addIssue({
178
+ code: 'custom',
179
+ path: ['oauth'],
180
+ message: 'oauth must not be set with mcpServer (the host discovers the server OAuth metadata and registers dynamically)',
181
+ });
182
+ }
183
+ if (spec.secrets !== undefined && spec.secrets.length > 0) {
184
+ ctx.addIssue({ code: 'custom', path: ['secrets'], message: 'secrets must not be set with mcpServer' });
185
+ }
186
+ if (spec.apiKeyHeader !== undefined) {
187
+ ctx.addIssue({ code: 'custom', path: ['apiKeyHeader'], message: 'apiKeyHeader must not be set with mcpServer' });
188
+ }
189
+ if (spec.jwtRefresh !== undefined) {
190
+ ctx.addIssue({ code: 'custom', path: ['jwtRefresh'], message: 'jwtRefresh must not be set with mcpServer' });
191
+ }
192
+ if (spec.nativeBuiltin === true) {
193
+ ctx.addIssue({ code: 'custom', path: ['nativeBuiltin'], message: 'nativeBuiltin must not be true with mcpServer' });
194
+ }
195
+ return;
196
+ }
161
197
  if (spec.secrets) {
162
198
  const seen = new Set();
163
199
  for (const s of spec.secrets) {
@@ -262,6 +298,9 @@ export function isAkaiConnection(x) {
262
298
  *
263
299
  * CLIs link to a connection through `defineCLI({ connectionSlug: <slug> })` —
264
300
  * `defineCLI` is unchanged.
301
+ *
302
+ * A connection that sets `mcpServer` instead stands for a hosted MCP server: it has
303
+ * no CLIs, no static OAuth client and no secrets (see {@link ConnectionSpec.mcpServer}).
265
304
  */
266
305
  export function defineConnection(spec) {
267
306
  const parsed = ConnectionSpecShape.safeParse(spec);
@@ -332,6 +371,7 @@ export function defineConnection(spec) {
332
371
  }
333
372
  : {}),
334
373
  ...(v.nativeBuiltin !== undefined ? { nativeBuiltin: v.nativeBuiltin } : {}),
374
+ ...(v.mcpServer !== undefined ? { mcpServer: Object.freeze({ url: v.mcpServer.url }) } : {}),
335
375
  ...(v.override !== undefined ? { override: v.override } : {}),
336
376
  };
337
377
  Object.freeze(def);
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export { buildCtx } from './ctx/build-ctx.js';
8
8
  export type { BuildCtxParams } from './ctx/build-ctx.js';
9
9
  export { createSafeFetch } from './ctx/safe-fetch.js';
10
10
  export type { SafeFetch, SafeFetchBinding } from './ctx/safe-fetch.js';
11
+ export type { PrivateEgressPin } from './ctx/private-egress.js';
11
12
  export type { AnyToolDef, CLIDef, CLISpec, ClientCertOptions, ConnectionAuthKind, ConnectionDef, ConnectionOAuthConfig, ConnectionSpec, DynamicEgress, InputOf, NetworkOptions, OAuthAdminField, OutputOf, PropertiesOf, PropertyDecl, RefreshStrategy, SecretDecl, SecretsOf, StepFetcher, TokenEndpointAuthMethod, ToolCtx, ToolDef, ToolLogger, ToolOptions, ToolSpec, } from './types.js';
12
13
  export { createSafePath } from './ctx/safe-path.js';
13
14
  export type { SafePath } from './ctx/safe-path.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACjH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,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oBAAoB,CAAC;AACpD,YAAY,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,eAAe,EACf,aAAa,EACb,aAAa,EACb,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,QAAQ,EACR,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,0BAA0B,EAC1B,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,+BAA+B,EAC/B,kBAAkB,EAClB,aAAa,EACb,YAAY,GACb,MAAM,qBAAqB,CAAC"}
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import type { ConnectionManifest } from './types.js';
3
+ /** True when `val` parses as a URL with the `https:` protocol. Shared with the registry loader. */
4
+ export declare function isHttpsUrl(val: string): boolean;
3
5
  /**
4
6
  * Cross-check for dynamic-egress references. Mirrors the invariant
5
7
  * `defineCLI()` enforces at spec time:
@@ -118,6 +120,9 @@ export declare const ConnectionManifestSchema: z.ZodObject<{
118
120
  claimTtlSeconds: z.ZodOptional<z.ZodNumber>;
119
121
  }, z.core.$strip>>;
120
122
  nativeBuiltin: z.ZodOptional<z.ZodBoolean>;
123
+ mcpServer: z.ZodOptional<z.ZodObject<{
124
+ url: z.ZodString;
125
+ }, z.core.$strip>>;
121
126
  override: z.ZodOptional<z.ZodBoolean>;
122
127
  }, z.core.$strip>>;
123
128
  tools: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"json-schema.d.ts","sourceRoot":"","sources":["../../src/manifest/json-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAyPrD;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiFnC,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,EAAE,OAAsD,CAAC;AAExF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAE/D"}
1
+ {"version":3,"file":"json-schema.d.ts","sourceRoot":"","sources":["../../src/manifest/json-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAmLrD,mGAAmG;AACnG,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAM/C;AAmGD;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiFnC,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,EAAE,OAAsD,CAAC;AAExF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAE/D"}
@@ -162,6 +162,15 @@ const ManifestJwtRefreshSchema = z.object({
162
162
  revocationBackoffMs: z.number().int().positive().optional(),
163
163
  claimTtlSeconds: z.number().int().positive().optional(),
164
164
  });
165
+ /** True when `val` parses as a URL with the `https:` protocol. Shared with the registry loader. */
166
+ export function isHttpsUrl(val) {
167
+ try {
168
+ return new URL(val).protocol === 'https:';
169
+ }
170
+ catch {
171
+ return false;
172
+ }
173
+ }
165
174
  const ManifestConnectionSchema = z
166
175
  .object({
167
176
  slug: z.string().regex(CONNECTION_SLUG_RE),
@@ -183,9 +192,36 @@ const ManifestConnectionSchema = z
183
192
  oauth: ManifestConnectionOAuthSchema.optional(),
184
193
  jwtRefresh: ManifestJwtRefreshSchema.optional(),
185
194
  nativeBuiltin: z.boolean().optional(),
195
+ mcpServer: z.object({ url: z.string() }).optional(),
186
196
  override: z.boolean().optional(),
187
197
  })
188
198
  .superRefine((c, ctx) => {
199
+ // A hosted MCP server connection (mirrors defineConnection): https url, auth via the server's
200
+ // own discovered OAuth or none, and no credential-shaped field of its own.
201
+ if (c.mcpServer !== undefined) {
202
+ if (!isHttpsUrl(c.mcpServer.url)) {
203
+ ctx.addIssue({ code: 'custom', path: ['mcpServer', 'url'], message: 'must be an https URL' });
204
+ }
205
+ if (c.authKind === 'apiKey') {
206
+ ctx.addIssue({ code: 'custom', path: ['authKind'], message: "authKind 'apiKey' is not supported with mcpServer" });
207
+ }
208
+ if (c.oauth !== undefined) {
209
+ ctx.addIssue({ code: 'custom', path: ['oauth'], message: 'oauth must not be set with mcpServer' });
210
+ }
211
+ if (c.secrets !== undefined && c.secrets.length > 0) {
212
+ ctx.addIssue({ code: 'custom', path: ['secrets'], message: 'secrets must not be set with mcpServer' });
213
+ }
214
+ if (c.apiKeyHeader !== undefined) {
215
+ ctx.addIssue({ code: 'custom', path: ['apiKeyHeader'], message: 'apiKeyHeader must not be set with mcpServer' });
216
+ }
217
+ if (c.jwtRefresh !== undefined) {
218
+ ctx.addIssue({ code: 'custom', path: ['jwtRefresh'], message: 'jwtRefresh must not be set with mcpServer' });
219
+ }
220
+ if (c.nativeBuiltin === true) {
221
+ ctx.addIssue({ code: 'custom', path: ['nativeBuiltin'], message: 'nativeBuiltin must not be true with mcpServer' });
222
+ }
223
+ return;
224
+ }
189
225
  // Mirror the defineConnection invariants so an embed that would project a
190
226
  // nonsensical wire shape degrades to eager rather than validating: oauth is
191
227
  // required for oauth2 and forbidden otherwise; jwtRefresh is the non-oauth2
@@ -239,6 +239,12 @@ export interface ManifestConnection {
239
239
  readonly jwtRefresh?: ManifestJwtRefresh;
240
240
  /** Governance FACT: auto-resolves without a user credential (no secrets + native transport). */
241
241
  readonly nativeBuiltin?: boolean;
242
+ /** Hosted MCP server this connection stands for (https `url`). When set, `authKind` is `oauth2`
243
+ * (the server's own OAuth, discovered + dynamically registered by the host) or `none`, and there
244
+ * is no `oauth` block, `secrets`, `apiKeyHeader`, `jwtRefresh` or `nativeBuiltin: true`. */
245
+ readonly mcpServer?: {
246
+ readonly url: string;
247
+ };
242
248
  /** Cross-repo override opt-in — mirrors {@link ConnectionManifest.override}. Not emitted to the
243
249
  * wire, but a manifest-driven registry reads it for connection-slug collision resolution. */
244
250
  readonly override?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/manifest/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAG5B,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAIhC,QAAQ,CAAC,UAAU,CAAC,EAAE,O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 -1,3 +1,4 @@
1
+ import type { PrivateEgressPin } from '../../ctx/private-egress.js';
1
2
  import type { ToolLogger } from '../../types.js';
2
3
  import { type ConvertedFile } from './image-compress.js';
3
4
  import type { Registry } from '../registry/index.js';
@@ -49,6 +50,14 @@ export interface ExecuteParams {
49
50
  * (undefined/false) = remote: tar + PUT, unchanged.
50
51
  */
51
52
  readonly localOutput?: boolean;
53
+ /**
54
+ * Operator-pinned private egress, passed through to `buildCtx`. Host-runtime
55
+ * configuration ONLY: it is never read from `body`, the tool definition, its
56
+ * secrets or its properties, so a tenant who controls a connection secret
57
+ * cannot add or widen an entry. Default (undefined) = no private address is
58
+ * reachable, exactly as before.
59
+ */
60
+ readonly privateEgress?: readonly PrivateEgressPin[];
52
61
  }
53
62
  export declare function executeTool(params: ExecuteParams): Promise<ExecuteResult>;
54
63
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/executor/index.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAqC,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKpF,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAUhE,MAAM,MAAM,gBAAgB,GACxB,cAAc,GACd,eAAe,GACf,oBAAoB,GACpB,gBAAgB,GAChB,sBAAsB,GACtB,kBAAkB,GAClB,qBAAqB,GACrB,wBAAwB,GACxB,gBAAgB,GAChB,oBAAoB,GACpB,YAAY,GACZ,eAAe,GAIf,kBAAkB,GAElB,oBAAoB,GACpB,oBAAoB,GACpB,uBAAuB,GACvB,wBAAwB,GACxB,mBAAmB,GACnB,uBAAuB,GACvB,sBAAsB,CAAC;AAE3B,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,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EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACtD;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CA0R/E"}
@@ -29,7 +29,7 @@ import { redactSecrets } from './redact.js';
29
29
  // src/runtime/executor/ (tests) and dist/runtime/executor/ (runtime).
30
30
  const { version: SDK_VERSION } = createRequire(import.meta.url)('../../../package.json');
31
31
  export async function executeTool(params) {
32
- const { registry, body, logger, signal, workdir, tenantId, localOutput } = params;
32
+ const { registry, body, logger, signal, workdir, tenantId, localOutput, privateEgress } = params;
33
33
  // resolveTool works in both eager and lazy mode: in lazy mode it imports the
34
34
  // CLI's handler module on first use (and caches it). Eager mode is a plain map
35
35
  // hit, same as lookupTool. The lazy import can throw (bad bundle, manifest/
@@ -149,6 +149,7 @@ export async function executeTool(params) {
149
149
  workdir,
150
150
  sdkVersion: SDK_VERSION,
151
151
  ...(tenantId !== undefined ? { tenantId } : {}),
152
+ ...(privateEgress !== undefined ? { privateEgress } : {}),
152
153
  ...(outputDir !== undefined ? { outputDir } : {}),
153
154
  ...(body.oauthAccessToken !== undefined ? { oauthAccessToken: body.oauthAccessToken } : {}),
154
155
  ...(body.appTokenAccessToken !== undefined ? { appTokenAccessToken: body.appTokenAccessToken } : {}),
@@ -9,6 +9,7 @@
9
9
  */
10
10
  export * from './executor/index.js';
11
11
  export type { ConvertedFile } from './executor/image-compress.js';
12
+ export type { PrivateEgressPin } from '../ctx/private-egress.js';
12
13
  export * from './registry/index.js';
13
14
  export { toWireListPayload } from './registry/wire.js';
14
15
  export * from './execute-request.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAc,qBAAqB,CAAC;AACpC,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAc,qBAAqB,CAAC;AACpC,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,cAAc,sBAAsB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"connection-manifest.d.ts","sourceRoot":"","sources":["../../../src/runtime/registry/connection-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EACV,kBAAkB,EAInB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,iBAAiB,EAIlB,MAAM,YAAY,CAAC;AAEpB;qFACqF;AACrF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB,CAiBhF"}
1
+ {"version":3,"file":"connection-manifest.d.ts","sourceRoot":"","sources":["../../../src/runtime/registry/connection-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EACV,kBAAkB,EAInB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,iBAAiB,EAIlB,MAAM,YAAY,CAAC;AAEpB;qFACqF;AACrF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB,CAkBhF"}
@@ -15,6 +15,7 @@ export function connectionToManifest(conn) {
15
15
  ...(conn.oauth !== undefined ? { oauth: copyOAuth(conn.oauth) } : {}),
16
16
  ...(conn.jwtRefresh !== undefined ? { jwtRefresh: copyJwtRefresh(conn.jwtRefresh) } : {}),
17
17
  ...(conn.nativeBuiltin !== undefined ? { nativeBuiltin: conn.nativeBuiltin } : {}),
18
+ ...(conn.mcpServer !== undefined ? { mcpServer: { url: conn.mcpServer.url } } : {}),
18
19
  ...(conn.override !== undefined ? { override: conn.override } : {}),
19
20
  };
20
21
  }
@@ -24,7 +24,7 @@ import { promises as fs } from 'node:fs';
24
24
  import path from 'node:path';
25
25
  import { pathToFileURL } from 'node:url';
26
26
  import { DYNAMIC_EGRESS_PREFIXES } from '../../tool.js';
27
- import { validateManifest } from '../../manifest/json-schema.js';
27
+ import { isHttpsUrl, validateManifest } from '../../manifest/json-schema.js';
28
28
  import { manifestConnectionToWire, manifestToWireCli, manifestToWireTools } from './manifest-wire.js';
29
29
  import { toWireListPayload as toWireListPayloadFn } from './wire.js';
30
30
  export class Registry {
@@ -750,11 +750,19 @@ function isBrandedConnection(x) {
750
750
  }
751
751
  if (!isConnectionAuthKind(o.authKind))
752
752
  return false;
753
- // oauth is required for oauth2 and forbidden for all other authKinds.
754
- if (o.authKind === 'oauth2' && o.oauth === undefined)
755
- return false;
756
- if (o.authKind !== 'oauth2' && o.oauth !== undefined)
757
- return false;
753
+ // A hosted MCP server connection (no CLIs, auth via the server's own discovered OAuth) has its
754
+ // own rules, mirroring defineConnection — and is exempt from the oauth2-requires-oauth rule.
755
+ if (o.mcpServer !== undefined) {
756
+ if (!isHostedMcpConnection(o))
757
+ return false;
758
+ }
759
+ else {
760
+ // oauth is required for oauth2 and forbidden for all other authKinds.
761
+ if (o.authKind === 'oauth2' && o.oauth === undefined)
762
+ return false;
763
+ if (o.authKind !== 'oauth2' && o.oauth !== undefined)
764
+ return false;
765
+ }
758
766
  if (o.oauth !== undefined && !isBrandedConnectionOAuth(o.oauth))
759
767
  return false;
760
768
  // Optional wire-relevant fields — the /tools/list serializer reads each
@@ -774,6 +782,26 @@ function isBrandedConnection(x) {
774
782
  return false;
775
783
  return true;
776
784
  }
785
+ /**
786
+ * Rules for a connection declaring `mcpServer` (mirrors defineConnection): an https `url`,
787
+ * `authKind` `oauth2` or `none`, and no `oauth` block, secrets, apiKeyHeader, jwtRefresh or
788
+ * `nativeBuiltin: true`. Standalone by design — no CLI has to link to it for it to load.
789
+ */
790
+ function isHostedMcpConnection(o) {
791
+ const server = o.mcpServer;
792
+ if (server === null || typeof server !== 'object')
793
+ return false;
794
+ const url = server.url;
795
+ if (typeof url !== 'string' || !isHttpsUrl(url))
796
+ return false;
797
+ if (o.authKind !== 'oauth2' && o.authKind !== 'none')
798
+ return false;
799
+ if (o.oauth !== undefined || o.apiKeyHeader !== undefined || o.jwtRefresh !== undefined)
800
+ return false;
801
+ if (Array.isArray(o.secrets) && o.secrets.length > 0)
802
+ return false;
803
+ return o.nativeBuiltin !== true;
804
+ }
777
805
  function isConnectionAuthKind(x) {
778
806
  return x === 'apiKey' || x === 'oauth2' || x === 'none';
779
807
  }
@@ -1 +1 @@
1
- {"version":3,"file":"manifest-wire.d.ts","sourceRoot":"","sources":["../../../src/runtime/registry/manifest-wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EACnB,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC;AAEjD,wFAAwF;AACxF,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,kBAAkB,EAAE,MAAM,EAAE,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C,SAAS,EAAE,aAAa,CAAC;IAAE,QAAQ,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC,GAC7E;IAAE,IAAI,EAAE,YAAY,EAAE,CAAC;IAAC,KAAK,EAAE,aAAa,EAAE,CAAA;CAAE,CAMlD"}
@@ -1,4 +1,4 @@
1
- import { isWireSecretDecl, wireEgress, wireHosts, wireJwtRefresh, } from './wire.js';
1
+ import { isWireSecretDecl, wireEgress, wireHosts, wireJwtRefresh, wireMcpServer, } from './wire.js';
2
2
  /** Project one manifest's CLI-level metadata to its wire entry. Mirrors `toWireCli`. */
3
3
  export function manifestToWireCli(m, source) {
4
4
  return {
@@ -103,6 +103,7 @@ export function manifestConnectionToWire(mc, source) {
103
103
  ...(hosts ? { hosts } : {}),
104
104
  ...(jwtRefresh ? { jwtRefresh } : {}),
105
105
  ...(mc.nativeBuiltin === true ? { nativeBuiltin: true } : {}),
106
+ ...wireMcpServer(mc.mcpServer),
106
107
  source,
107
108
  };
108
109
  if (!mc.oauth)
@@ -183,6 +183,13 @@ export interface BrandedConnection {
183
183
  * about the connection's auth model, not host policy. Deel-internal tenancy and reserved-UI
184
184
  * hiding are akai-app concerns and are NOT modeled here (cli-service stays vendor-agnostic). */
185
185
  readonly nativeBuiltin?: boolean;
186
+ /** Hosted MCP server this connection stands for (https `url`). Such a connection has no CLIs:
187
+ * the host (akai-app) turns it into an MCP connection, signing in through the server's own
188
+ * discovered OAuth + RFC 7591 dynamic client registration — so it carries no `oauth` block and
189
+ * no secrets. Mirrors the SDK `ConnectionDef.mcpServer`. */
190
+ readonly mcpServer?: {
191
+ readonly url: string;
192
+ };
186
193
  /** Opt-in cross-repo override: when a customer connection sets this, its slug
187
194
  * intentionally REPLACES a colliding baseline one instead of being dropped.
188
195
  * Absent/false ⇒ the safe default (first definition wins). Authored via