@akai-workflow-builder/cli-sdk 0.5.0 → 0.6.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.
- package/CHANGELOG.md +19 -0
- package/README.md +2 -2
- package/dist/ctx/safe-fetch.d.ts +19 -0
- package/dist/ctx/safe-fetch.d.ts.map +1 -1
- package/dist/ctx/safe-fetch.js +29 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/manifest/index.d.ts +1 -1
- package/dist/manifest/index.d.ts.map +1 -1
- package/dist/manifest/json-schema.d.ts +77 -0
- package/dist/manifest/json-schema.d.ts.map +1 -1
- package/dist/manifest/json-schema.js +102 -0
- package/dist/manifest/types.d.ts +128 -0
- package/dist/manifest/types.d.ts.map +1 -1
- package/dist/runtime/registry/connection-manifest.d.ts +27 -0
- package/dist/runtime/registry/connection-manifest.d.ts.map +1 -0
- package/dist/runtime/registry/connection-manifest.js +76 -0
- package/dist/runtime/registry/index.d.ts +2 -1
- package/dist/runtime/registry/index.d.ts.map +1 -1
- package/dist/runtime/registry/index.js +2 -1
- package/dist/runtime/registry/loader.d.ts +1 -0
- package/dist/runtime/registry/loader.d.ts.map +1 -1
- package/dist/runtime/registry/loader.js +83 -15
- package/dist/runtime/registry/manifest-wire.d.ts +18 -2
- package/dist/runtime/registry/manifest-wire.d.ts.map +1 -1
- package/dist/runtime/registry/manifest-wire.js +81 -1
- package/dist/runtime/registry/wire.d.ts +27 -1
- package/dist/runtime/registry/wire.d.ts.map +1 -1
- package/dist/runtime/registry/wire.js +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,25 @@ All notable changes to `@akai-workflow-builder/cli-sdk` are documented here.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
6
|
|
|
7
|
+
## [0.6.1](https://github.com/akai-workflow-builder/akai-cli-sdk/compare/cli-sdk-v0.6.0...cli-sdk-v0.6.1) (2026-08-23)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **ctx:** document and release the redirect 'manual' change (AKAI-2446) ([de0b7d2](https://github.com/akai-workflow-builder/akai-cli-sdk/commit/de0b7d23e655a8ac1e748897a1c71b16e010a3d8))
|
|
13
|
+
|
|
14
|
+
## [0.6.0](https://github.com/akai-workflow-builder/akai-cli-sdk/compare/cli-sdk-v0.5.0...cli-sdk-v0.6.0) (2026-08-21)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* embed connection in manifest so mixed packages load lazily ([28be12a](https://github.com/akai-workflow-builder/akai-cli-sdk/commit/28be12a37a5fe10f128be5b464e7fdbbb12e6a71))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* enforce embedded connection slug matches connectionSlug; fix test pointer ([509b3ab](https://github.com/akai-workflow-builder/akai-cli-sdk/commit/509b3ab209e459cb26054894ef6c659cb600f411))
|
|
25
|
+
|
|
7
26
|
## [0.5.0](https://github.com/akai-workflow-builder/akai-cli-sdk/compare/cli-sdk-v0.4.1...cli-sdk-v0.5.0) (2026-08-20)
|
|
8
27
|
|
|
9
28
|
|
package/README.md
CHANGED
|
@@ -349,10 +349,10 @@ options: {
|
|
|
349
349
|
- **Protocol** — HTTPS-only in production. HTTP allowed only when `NODE_ENV === 'development'`.
|
|
350
350
|
- **Host** — exact-or-suffix-with-dot. `api.example.com` matches itself and `*.api.example.com`; `evil.api.example.com.attacker.tld` does not.
|
|
351
351
|
- **DNS preflight** — hostname resolved before the request. In production, addresses in private (RFC 1918), loopback, link-local, or unique-local IPv6 ranges are refused (IPv4, IPv6, v4-mapped, and canonicalized forms). In development the private-IP refusal is skipped so handlers can target local services.
|
|
352
|
-
- **Redirects** — `redirect: 'error'` is
|
|
352
|
+
- **Redirects** — the SDK never follows a redirect, so a `Location:` to another host cannot smuggle a request past the egress check. `redirect: 'error'` is the default and `'follow'` is refused (it is downgraded to `'error'`), because following is the one mode that could leave the allowlisted host after the check has passed. `redirect: 'manual'` is honoured: it follows nothing, so the handler receives the 3xx itself — which is how a form-post portal reports success — and reaching the `Location:` costs a fresh `ctx.fetch` that re-runs the whole preflight.
|
|
353
353
|
- **Identity headers** — `user-agent`, `x-akai-cli`, `x-akai-tool`, `x-akai-request-id` are stamped on every request. `x-akai-tenant` is stamped only when the host runtime passes a tenant id to `buildCtx`; otherwise it is removed even if a handler tried to set it. Handler-supplied values for any of these are always overwritten.
|
|
354
354
|
|
|
355
|
-
Protocol, host, and DNS-preflight failures reject with `AkaiEgressError` before any network request is made.
|
|
355
|
+
Protocol, host, and DNS-preflight failures reject with `AkaiEgressError` before any network request is made. Under `redirect: 'error'` — the default, and where `'follow'` is downgraded to — a redirect surfaces instead as a `fetch` rejection after the initial response: same outcome (no follow-through), different error type. Under `'manual'` there is no failure to surface, because the 3xx is a successful result: it is returned to the handler as an ordinary response.
|
|
356
356
|
|
|
357
357
|
Spec validation also rejects egress hosts that don't pass a syntactic DNS-hostname check — `localhost` (single label), IP literals, hosts with spaces or slashes — so they can't be declared in the first place. The check is shape-only; it doesn't verify the name is publicly resolvable, so internal DNS zones still pass the spec and are then handled at DNS-preflight time.
|
|
358
358
|
|
package/dist/ctx/safe-fetch.d.ts
CHANGED
|
@@ -41,5 +41,24 @@ export interface SafeFetchBinding {
|
|
|
41
41
|
readonly maxResponseBytes?: number;
|
|
42
42
|
}
|
|
43
43
|
export type SafeFetch = (url: string, init?: RequestInit) => Promise<Response>;
|
|
44
|
+
/** The redirect modes a caller may ask for (lib.dom's `RequestRedirect`). */
|
|
45
|
+
type RedirectMode = 'error' | 'follow' | 'manual';
|
|
46
|
+
/**
|
|
47
|
+
* Decide the redirect mode for one call.
|
|
48
|
+
*
|
|
49
|
+
* The default stays `'error'`: a followed redirect is the one way a fetch can
|
|
50
|
+
* leave the allowlisted host after the egress check has passed, so `'follow'`
|
|
51
|
+
* is never honoured.
|
|
52
|
+
*
|
|
53
|
+
* `'manual'` is honoured, because it does not follow anything — the caller gets
|
|
54
|
+
* the 3xx itself and has to issue a fresh `safeFetch` for the Location, which
|
|
55
|
+
* runs the whole egress + DNS preflight again. Tools that speak to form-post
|
|
56
|
+
* portals need this: a Django or Struts login answers 302 on success, and the
|
|
57
|
+
* status and Set-Cookie headers on that 302 ARE the result. Without it those
|
|
58
|
+
* flows fail with undici's opaque `TypeError: fetch failed` / `unexpected
|
|
59
|
+
* redirect`.
|
|
60
|
+
*/
|
|
61
|
+
export declare function resolveRedirect(requested: RedirectMode | undefined): RedirectMode;
|
|
44
62
|
export declare function createSafeFetch(binding: SafeFetchBinding): SafeFetch;
|
|
63
|
+
export {};
|
|
45
64
|
//# sourceMappingURL=safe-fetch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-fetch.d.ts","sourceRoot":"","sources":["../../src/ctx/safe-fetch.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,0BAA0B,QAAkB,CAAC;AAE1D;;;;;;;;GAQG;AACH,eAAO,MAAM,iCAAiC,QAAoB,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,kBAAkB,CAAC;IACzC,kEAA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wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAoGpE"}
|
package/dist/ctx/safe-fetch.js
CHANGED
|
@@ -89,6 +89,24 @@ function hostMatches(hostname, allowed) {
|
|
|
89
89
|
return hostname === a || hostname.endsWith(`.${a}`);
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Decide the redirect mode for one call.
|
|
94
|
+
*
|
|
95
|
+
* The default stays `'error'`: a followed redirect is the one way a fetch can
|
|
96
|
+
* leave the allowlisted host after the egress check has passed, so `'follow'`
|
|
97
|
+
* is never honoured.
|
|
98
|
+
*
|
|
99
|
+
* `'manual'` is honoured, because it does not follow anything — the caller gets
|
|
100
|
+
* the 3xx itself and has to issue a fresh `safeFetch` for the Location, which
|
|
101
|
+
* runs the whole egress + DNS preflight again. Tools that speak to form-post
|
|
102
|
+
* portals need this: a Django or Struts login answers 302 on success, and the
|
|
103
|
+
* status and Set-Cookie headers on that 302 ARE the result. Without it those
|
|
104
|
+
* flows fail with undici's opaque `TypeError: fetch failed` / `unexpected
|
|
105
|
+
* redirect`.
|
|
106
|
+
*/
|
|
107
|
+
export function resolveRedirect(requested) {
|
|
108
|
+
return requested === 'manual' || requested === 'error' ? requested : 'error';
|
|
109
|
+
}
|
|
92
110
|
function abortError(signal) {
|
|
93
111
|
return signal.reason ?? new DOMException('The operation was aborted.', 'AbortError');
|
|
94
112
|
}
|
|
@@ -112,7 +130,8 @@ async function lookupWithSignal(hostname, signal) {
|
|
|
112
130
|
}
|
|
113
131
|
// Caller-supplied `init` keys forwarded to fetch. Excludes Node/undici
|
|
114
132
|
// transport options like `dispatcher` that can route around the egress
|
|
115
|
-
// check. `headers
|
|
133
|
+
// check. `headers` and `signal` are constructed/pinned below; `redirect` is
|
|
134
|
+
// handled by {@link resolveRedirect}.
|
|
116
135
|
const FORWARDED_INIT_FIELDS = [
|
|
117
136
|
'method',
|
|
118
137
|
'body',
|
|
@@ -192,7 +211,7 @@ export function createSafeFetch(binding) {
|
|
|
192
211
|
// Allow-list forwarding: blocks `init.dispatcher` (undici) and other
|
|
193
212
|
// Node-specific transport options that could reroute past the egress
|
|
194
213
|
// check and the DNS-resolved address.
|
|
195
|
-
const sanitized = { headers, redirect:
|
|
214
|
+
const sanitized = { headers, redirect: resolveRedirect(init.redirect), signal };
|
|
196
215
|
for (const key of FORWARDED_INIT_FIELDS) {
|
|
197
216
|
if (init[key] !== undefined) {
|
|
198
217
|
sanitized[key] = init[key];
|
|
@@ -258,8 +277,10 @@ const NULL_BODY_STATUSES = new Set([204, 205, 304]);
|
|
|
258
277
|
/**
|
|
259
278
|
* Minimal fetch-over-`node:https` used only for mutual-TLS requests. Parity
|
|
260
279
|
* notes vs global fetch:
|
|
261
|
-
* - `
|
|
262
|
-
* a
|
|
280
|
+
* - `https.request` never follows redirects itself, so redirect handling is
|
|
281
|
+
* explicit: under `redirect: 'manual'` a 3xx is returned to the caller like
|
|
282
|
+
* any other response, and otherwise it is rejected — matching what
|
|
283
|
+
* {@link resolveRedirect} asks of the global-fetch path.
|
|
263
284
|
* - The request body is serialized by round-tripping through `new Response()`,
|
|
264
285
|
* which applies WHATWG body extraction — FormData multipart boundaries,
|
|
265
286
|
* URLSearchParams/Blob content-types — identically to fetch. Bodies are
|
|
@@ -300,7 +321,10 @@ async function mtlsFetch(url, init, identity) {
|
|
|
300
321
|
// event handling.
|
|
301
322
|
try {
|
|
302
323
|
const status = res.statusCode ?? 0;
|
|
303
|
-
if (
|
|
324
|
+
if (init.redirect !== 'manual' &&
|
|
325
|
+
status >= 300 &&
|
|
326
|
+
status < 400 &&
|
|
327
|
+
res.headers.location !== undefined) {
|
|
304
328
|
res.resume();
|
|
305
329
|
reject(new AkaiEgressError(`safe-fetch: refusing redirect (${status}) on mutual-TLS request to ${url.hostname}`, { hostname: url.hostname, status }));
|
|
306
330
|
return;
|
package/dist/index.d.ts
CHANGED
|
@@ -12,5 +12,5 @@ export type { SafePath } from './ctx/safe-path.js';
|
|
|
12
12
|
export { AkaiConnectionError, AkaiEgressError, AkaiError, AkaiInputError, AkaiPathError, AkaiPropertyError, AkaiResponseTooLargeError, AkaiSecretError, AkaiSpecError, AkaiToolError, describeError, } from './errors.js';
|
|
13
13
|
export type { ToolErrorKind } from './errors.js';
|
|
14
14
|
export { ConnectionManifestSchema, ManifestJSONSchema, SCHEMA_VERSION, toSchema, validateManifest, } from './manifest/index.js';
|
|
15
|
-
export type { ClientCertManifest, ConnectionManifest, DynamicEgressManifest, HttpToolManifest, ManifestProperty, ManifestSecret, NativeToolManifest, SchemaVersion, ToolManifest, } from './manifest/index.js';
|
|
15
|
+
export type { ClientCertManifest, ConnectionManifest, DynamicEgressManifest, HttpToolManifest, ManifestConnection, ManifestConnectionAuthKind, ManifestConnectionOAuth, ManifestJwtRefresh, ManifestOAuthAdminField, ManifestProperty, ManifestRefreshStrategy, ManifestSecret, ManifestTokenEndpointAuthMethod, NativeToolManifest, SchemaVersion, ToolManifest, } from './manifest/index.js';
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,YAAY,EACV,UAAU,EACV,MAAM,EACN,OAAO,EACP,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,OAAO,EACP,cAAc,EACd,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,OAAO,EACP,OAAO,EACP,UAAU,EACV,WAAW,EACX,QAAQ,GACT,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,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,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,YAAY,GACb,MAAM,qBAAqB,CAAC"}
|
|
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,M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,cAAc,EACd,+BAA+B,EAC/B,kBAAkB,EAClB,aAAa,EACb,YAAY,GACb,MAAM,qBAAqB,CAAC"}
|
package/dist/manifest/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ export { toSchema } from './to-schema.js';
|
|
|
2
2
|
export { ConnectionManifestSchema, ManifestJSONSchema, validateManifest, } from './json-schema.js';
|
|
3
3
|
export { SCHEMA_VERSION } from './constants.js';
|
|
4
4
|
export type { SchemaVersion } from './constants.js';
|
|
5
|
-
export type { ClientCertManifest, ConnectionManifest, DynamicEgressManifest, HttpToolManifest, ManifestProperty, ManifestSecret, NativeToolManifest, ToolManifest, } from './types.js';
|
|
5
|
+
export type { ClientCertManifest, ConnectionManifest, DynamicEgressManifest, HttpToolManifest, ManifestConnection, ManifestConnectionAuthKind, ManifestConnectionOAuth, ManifestJwtRefresh, ManifestOAuthAdminField, ManifestProperty, ManifestRefreshStrategy, ManifestSecret, ManifestTokenEndpointAuthMethod, NativeToolManifest, ToolManifest, } from './types.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/manifest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,YAAY,GACb,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/manifest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,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,YAAY,GACb,MAAM,YAAY,CAAC"}
|
|
@@ -38,6 +38,83 @@ export declare const ConnectionManifestSchema: z.ZodObject<{
|
|
|
38
38
|
connectionSlug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
39
39
|
vendorScopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
40
40
|
override: z.ZodOptional<z.ZodBoolean>;
|
|
41
|
+
connection: z.ZodOptional<z.ZodObject<{
|
|
42
|
+
slug: z.ZodString;
|
|
43
|
+
name: z.ZodString;
|
|
44
|
+
vendor: z.ZodString;
|
|
45
|
+
blurb: z.ZodString;
|
|
46
|
+
longDesc: z.ZodString;
|
|
47
|
+
instructions: z.ZodArray<z.ZodString>;
|
|
48
|
+
authKind: z.ZodEnum<{
|
|
49
|
+
apiKey: "apiKey";
|
|
50
|
+
oauth2: "oauth2";
|
|
51
|
+
none: "none";
|
|
52
|
+
}>;
|
|
53
|
+
secrets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
54
|
+
key: z.ZodString;
|
|
55
|
+
name: z.ZodString;
|
|
56
|
+
description: z.ZodString;
|
|
57
|
+
required: z.ZodBoolean;
|
|
58
|
+
injected: z.ZodOptional<z.ZodBoolean>;
|
|
59
|
+
adminManaged: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
+
serverOnly: z.ZodOptional<z.ZodBoolean>;
|
|
61
|
+
}, z.core.$strip>>>;
|
|
62
|
+
apiKeyHeader: z.ZodOptional<z.ZodString>;
|
|
63
|
+
hosts: z.ZodOptional<z.ZodObject<{
|
|
64
|
+
production: z.ZodOptional<z.ZodString>;
|
|
65
|
+
demo: z.ZodOptional<z.ZodString>;
|
|
66
|
+
dev: z.ZodOptional<z.ZodString>;
|
|
67
|
+
}, z.core.$strip>>;
|
|
68
|
+
oauth: z.ZodOptional<z.ZodObject<{
|
|
69
|
+
authorizeUrl: z.ZodString;
|
|
70
|
+
tokenUrl: z.ZodString;
|
|
71
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
72
|
+
pkce: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
+
tokenEndpointAuthMethod: z.ZodOptional<z.ZodEnum<{
|
|
74
|
+
client_secret_post: "client_secret_post";
|
|
75
|
+
client_secret_basic: "client_secret_basic";
|
|
76
|
+
}>>;
|
|
77
|
+
extraAuthorizeParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
78
|
+
refreshStrategy: z.ZodOptional<z.ZodEnum<{
|
|
79
|
+
cron: "cron";
|
|
80
|
+
jit: "jit";
|
|
81
|
+
}>>;
|
|
82
|
+
adminFields: z.ZodArray<z.ZodObject<{
|
|
83
|
+
key: z.ZodString;
|
|
84
|
+
label: z.ZodString;
|
|
85
|
+
secret: z.ZodOptional<z.ZodBoolean>;
|
|
86
|
+
}, z.core.$strip>>;
|
|
87
|
+
hasCustomConnectFlow: z.ZodOptional<z.ZodBoolean>;
|
|
88
|
+
tokenResponsePath: z.ZodOptional<z.ZodString>;
|
|
89
|
+
appToken: z.ZodOptional<z.ZodObject<{
|
|
90
|
+
tokenUrl: z.ZodString;
|
|
91
|
+
requestStyle: z.ZodOptional<z.ZodEnum<{
|
|
92
|
+
oauth2_client_credentials: "oauth2_client_credentials";
|
|
93
|
+
json: "json";
|
|
94
|
+
}>>;
|
|
95
|
+
credentialParams: z.ZodOptional<z.ZodObject<{
|
|
96
|
+
id: z.ZodString;
|
|
97
|
+
secret: z.ZodString;
|
|
98
|
+
}, z.core.$strip>>;
|
|
99
|
+
tokenField: z.ZodOptional<z.ZodString>;
|
|
100
|
+
expiresField: z.ZodOptional<z.ZodString>;
|
|
101
|
+
}, z.core.$strip>>;
|
|
102
|
+
}, z.core.$strip>>;
|
|
103
|
+
jwtRefresh: z.ZodOptional<z.ZodObject<{
|
|
104
|
+
name: z.ZodString;
|
|
105
|
+
envs: z.ZodArray<z.ZodObject<{
|
|
106
|
+
env: z.ZodString;
|
|
107
|
+
accessKey: z.ZodString;
|
|
108
|
+
refreshKey: z.ZodString;
|
|
109
|
+
refreshUrl: z.ZodString;
|
|
110
|
+
}, z.core.$strip>>;
|
|
111
|
+
defaultAtTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
revocationBackoffMs: z.ZodOptional<z.ZodNumber>;
|
|
113
|
+
claimTtlSeconds: z.ZodOptional<z.ZodNumber>;
|
|
114
|
+
}, z.core.$strip>>;
|
|
115
|
+
nativeBuiltin: z.ZodOptional<z.ZodBoolean>;
|
|
116
|
+
override: z.ZodOptional<z.ZodBoolean>;
|
|
117
|
+
}, z.core.$strip>>;
|
|
41
118
|
tools: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
42
119
|
transport: z.ZodLiteral<"http">;
|
|
43
120
|
egress: z.ZodUnion<readonly [z.ZodArray<z.ZodString>, 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;
|
|
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;AA6NrD;;;;;;;;;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"}
|
|
@@ -90,6 +90,92 @@ const ToolManifestSchema = z.discriminatedUnion('transport', [
|
|
|
90
90
|
HttpToolManifestSchema,
|
|
91
91
|
NativeToolManifestSchema,
|
|
92
92
|
]);
|
|
93
|
+
// ── Embedded connection (AKAI-2408) ─────────────────────────────────────────
|
|
94
|
+
// A mixed package embeds its sibling connection in the CLI manifest so a lazy
|
|
95
|
+
// registry can register it FROM THE MANIFEST. The shape mirrors the runtime
|
|
96
|
+
// `BrandedConnection` (minus the brand) field-for-field, so validation here is
|
|
97
|
+
// what lets `readCliManifest` trust `manifest.connection` before projecting it
|
|
98
|
+
// with `manifestConnectionToWire`. A connection block that fails validation
|
|
99
|
+
// makes the WHOLE manifest fall back to eager import — the safe superset — so a
|
|
100
|
+
// malformed embed degrades to today's behavior rather than serving a broken
|
|
101
|
+
// connection. Declaring every field the wire reads also stops Zod from silently
|
|
102
|
+
// stripping one (which would drop it from the wire projection).
|
|
103
|
+
const ManifestOAuthAdminFieldSchema = z.object({
|
|
104
|
+
key: z.string(),
|
|
105
|
+
label: z.string(),
|
|
106
|
+
secret: z.boolean().optional(),
|
|
107
|
+
});
|
|
108
|
+
const ManifestConnectionOAuthSchema = z.object({
|
|
109
|
+
authorizeUrl: z.string(),
|
|
110
|
+
tokenUrl: z.string(),
|
|
111
|
+
scopes: z.array(z.string()).optional(),
|
|
112
|
+
pkce: z.boolean().optional(),
|
|
113
|
+
tokenEndpointAuthMethod: z.enum(['client_secret_post', 'client_secret_basic']).optional(),
|
|
114
|
+
extraAuthorizeParams: z.record(z.string(), z.string()).optional(),
|
|
115
|
+
refreshStrategy: z.enum(['cron', 'jit']).optional(),
|
|
116
|
+
adminFields: z.array(ManifestOAuthAdminFieldSchema),
|
|
117
|
+
hasCustomConnectFlow: z.boolean().optional(),
|
|
118
|
+
tokenResponsePath: z.string().optional(),
|
|
119
|
+
appToken: z
|
|
120
|
+
.object({
|
|
121
|
+
tokenUrl: z.string(),
|
|
122
|
+
requestStyle: z.enum(['oauth2_client_credentials', 'json']).optional(),
|
|
123
|
+
credentialParams: z.object({ id: z.string(), secret: z.string() }).optional(),
|
|
124
|
+
tokenField: z.string().optional(),
|
|
125
|
+
expiresField: z.string().optional(),
|
|
126
|
+
})
|
|
127
|
+
.optional(),
|
|
128
|
+
});
|
|
129
|
+
const ManifestJwtRefreshSchema = z.object({
|
|
130
|
+
name: z.string(),
|
|
131
|
+
envs: z.array(z.object({
|
|
132
|
+
env: z.string(),
|
|
133
|
+
accessKey: z.string(),
|
|
134
|
+
refreshKey: z.string(),
|
|
135
|
+
refreshUrl: z.string(),
|
|
136
|
+
})),
|
|
137
|
+
defaultAtTtlMs: z.number().int().positive().optional(),
|
|
138
|
+
revocationBackoffMs: z.number().int().positive().optional(),
|
|
139
|
+
claimTtlSeconds: z.number().int().positive().optional(),
|
|
140
|
+
});
|
|
141
|
+
const ManifestConnectionSchema = z
|
|
142
|
+
.object({
|
|
143
|
+
slug: z.string().regex(CONNECTION_SLUG_RE),
|
|
144
|
+
name: z.string(),
|
|
145
|
+
vendor: z.string(),
|
|
146
|
+
blurb: z.string(),
|
|
147
|
+
longDesc: z.string(),
|
|
148
|
+
instructions: z.array(z.string()),
|
|
149
|
+
authKind: z.enum(['apiKey', 'oauth2', 'none']),
|
|
150
|
+
secrets: z.array(ManifestSecretSchema).optional(),
|
|
151
|
+
apiKeyHeader: z.string().optional(),
|
|
152
|
+
hosts: z
|
|
153
|
+
.object({
|
|
154
|
+
production: z.string().optional(),
|
|
155
|
+
demo: z.string().optional(),
|
|
156
|
+
dev: z.string().optional(),
|
|
157
|
+
})
|
|
158
|
+
.optional(),
|
|
159
|
+
oauth: ManifestConnectionOAuthSchema.optional(),
|
|
160
|
+
jwtRefresh: ManifestJwtRefreshSchema.optional(),
|
|
161
|
+
nativeBuiltin: z.boolean().optional(),
|
|
162
|
+
override: z.boolean().optional(),
|
|
163
|
+
})
|
|
164
|
+
.superRefine((c, ctx) => {
|
|
165
|
+
// Mirror the defineConnection invariants so an embed that would project a
|
|
166
|
+
// nonsensical wire shape degrades to eager rather than validating: oauth is
|
|
167
|
+
// required for oauth2 and forbidden otherwise; jwtRefresh is the non-oauth2
|
|
168
|
+
// refresh mechanism (mutually exclusive with an oauth block / oauth2).
|
|
169
|
+
if (c.authKind === 'oauth2' && c.oauth === undefined) {
|
|
170
|
+
ctx.addIssue({ code: 'custom', path: ['oauth'], message: "oauth is required when authKind is 'oauth2'" });
|
|
171
|
+
}
|
|
172
|
+
if (c.authKind !== 'oauth2' && c.oauth !== undefined) {
|
|
173
|
+
ctx.addIssue({ code: 'custom', path: ['oauth'], message: `oauth must not be set when authKind is '${c.authKind}'` });
|
|
174
|
+
}
|
|
175
|
+
if (c.jwtRefresh !== undefined && (c.authKind === 'oauth2' || c.oauth !== undefined)) {
|
|
176
|
+
ctx.addIssue({ code: 'custom', path: ['jwtRefresh'], message: 'jwtRefresh must not be set alongside oauth / authKind oauth2' });
|
|
177
|
+
}
|
|
178
|
+
});
|
|
93
179
|
const ConnectionManifestBaseSchema = z.object({
|
|
94
180
|
$schemaVersion: z.literal(SCHEMA_VERSION),
|
|
95
181
|
id: z.string(),
|
|
@@ -111,6 +197,9 @@ const ConnectionManifestBaseSchema = z.object({
|
|
|
111
197
|
// Cross-repo override opt-in — in the validator so validateManifest() round-
|
|
112
198
|
// trips it (a manifest-driven registry reads it for collision resolution).
|
|
113
199
|
override: z.boolean().optional(),
|
|
200
|
+
// Embedded sibling connection from a MIXED package (AKAI-2408). Optional +
|
|
201
|
+
// additive → does NOT bump SCHEMA_VERSION; a plain single-CLI manifest omits it.
|
|
202
|
+
connection: ManifestConnectionSchema.optional(),
|
|
114
203
|
tools: z.array(ToolManifestSchema),
|
|
115
204
|
});
|
|
116
205
|
/**
|
|
@@ -195,6 +284,19 @@ export const ConnectionManifestSchema = ConnectionManifestBaseSchema.superRefine
|
|
|
195
284
|
}
|
|
196
285
|
}
|
|
197
286
|
}
|
|
287
|
+
// A MIXED package embeds its sibling connection; the CLI must actually group
|
|
288
|
+
// under it (AKAI-2408). Enforce connectionSlug === connection.slug so a lazy
|
|
289
|
+
// /tools/list can't advertise an embedded connection the CLI doesn't link to
|
|
290
|
+
// (or link to a different/absent slug) — a mismatch would desync the
|
|
291
|
+
// CLI→connection grouping from the eager path. Failing validation here makes
|
|
292
|
+
// the loader safely eager-fall-back rather than serve a broken linkage.
|
|
293
|
+
if (m.connection && m.connectionSlug !== m.connection.slug) {
|
|
294
|
+
ctx.addIssue({
|
|
295
|
+
code: 'custom',
|
|
296
|
+
path: ['connection', 'slug'],
|
|
297
|
+
message: `embedded connection.slug '${m.connection.slug}' must match connectionSlug '${m.connectionSlug ?? 'null'}'`,
|
|
298
|
+
});
|
|
299
|
+
}
|
|
198
300
|
});
|
|
199
301
|
/**
|
|
200
302
|
* Published JSON Schema (Draft 2020-12) for the Connections manifest.
|
package/dist/manifest/types.d.ts
CHANGED
|
@@ -113,6 +113,123 @@ export interface NativeToolManifest extends BaseToolManifest {
|
|
|
113
113
|
readonly egress: null;
|
|
114
114
|
}
|
|
115
115
|
export type ToolManifest = HttpToolManifest | NativeToolManifest;
|
|
116
|
+
/** The auth kind a connection declares — WHAT auth, never the glue. Wire-format
|
|
117
|
+
* mirror of the runtime `ConnectionAuthKind` (kept here so the manifest layer
|
|
118
|
+
* stays self-contained — see the file header). */
|
|
119
|
+
export type ManifestConnectionAuthKind = 'apiKey' | 'oauth2' | 'none';
|
|
120
|
+
/** Client-auth method on the OAuth token exchange. Mirror of the runtime type. */
|
|
121
|
+
export type ManifestTokenEndpointAuthMethod = 'client_secret_post' | 'client_secret_basic';
|
|
122
|
+
/** How akai-app keeps the access token fresh once the connection is live. Mirror of the runtime type. */
|
|
123
|
+
export type ManifestRefreshStrategy = 'cron' | 'jit';
|
|
124
|
+
/**
|
|
125
|
+
* One OAuth-app credential an admin enters once per tenant (e.g. the client
|
|
126
|
+
* id/secret). SHAPE only — the VALUE lives in akai-app. Wire-format mirror of
|
|
127
|
+
* `BrandedOAuthAdminField`.
|
|
128
|
+
*/
|
|
129
|
+
export interface ManifestOAuthAdminField {
|
|
130
|
+
readonly key: string;
|
|
131
|
+
readonly label: string;
|
|
132
|
+
readonly secret?: boolean;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* The OAuth SHAPE a connection declares, in the pure manifest layer. Secret
|
|
136
|
+
* VALUES never appear here — they stay in akai-app keyed by slug. Field-for-field
|
|
137
|
+
* mirror of the runtime `BrandedConnectionOAuth` so
|
|
138
|
+
* {@link ManifestConnection} projects byte-identically to the branded wire path.
|
|
139
|
+
*/
|
|
140
|
+
export interface ManifestConnectionOAuth {
|
|
141
|
+
readonly authorizeUrl: string;
|
|
142
|
+
readonly tokenUrl: string;
|
|
143
|
+
/** OAuth authorize scope set; the wire serializer defaults a missing list to []. */
|
|
144
|
+
readonly scopes?: readonly string[];
|
|
145
|
+
readonly pkce?: boolean;
|
|
146
|
+
readonly tokenEndpointAuthMethod?: ManifestTokenEndpointAuthMethod;
|
|
147
|
+
readonly extraAuthorizeParams?: Record<string, string>;
|
|
148
|
+
readonly refreshStrategy?: ManifestRefreshStrategy;
|
|
149
|
+
readonly adminFields: readonly ManifestOAuthAdminField[];
|
|
150
|
+
readonly hasCustomConnectFlow?: boolean;
|
|
151
|
+
readonly tokenResponsePath?: string;
|
|
152
|
+
/** Client-credentials app-token mint spec; akai-app mints + injects it as ctx.appToken. */
|
|
153
|
+
readonly appToken?: {
|
|
154
|
+
readonly tokenUrl: string;
|
|
155
|
+
readonly requestStyle?: 'oauth2_client_credentials' | 'json';
|
|
156
|
+
readonly credentialParams?: {
|
|
157
|
+
readonly id: string;
|
|
158
|
+
readonly secret: string;
|
|
159
|
+
};
|
|
160
|
+
readonly tokenField?: string;
|
|
161
|
+
readonly expiresField?: string;
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Declarative JWT-refresh config in the pure manifest layer. Field-for-field
|
|
166
|
+
* mirror of the runtime `BrandedJwtRefresh` — token rows + endpoints + timing.
|
|
167
|
+
* No secret VALUES; the HTTP exchange stays host-side, keyed by slug.
|
|
168
|
+
*/
|
|
169
|
+
export interface ManifestJwtRefresh {
|
|
170
|
+
readonly name: string;
|
|
171
|
+
readonly envs: readonly {
|
|
172
|
+
readonly env: string;
|
|
173
|
+
readonly accessKey: string;
|
|
174
|
+
readonly refreshKey: string;
|
|
175
|
+
readonly refreshUrl: string;
|
|
176
|
+
}[];
|
|
177
|
+
readonly defaultAtTtlMs?: number;
|
|
178
|
+
readonly revocationBackoffMs?: number;
|
|
179
|
+
readonly claimTtlSeconds?: number;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* A connection embedded inside a CLI's `manifest.json` (AKAI-2408).
|
|
183
|
+
*
|
|
184
|
+
* A "mixed" package default-exports BOTH a `defineCLI()` result AND a
|
|
185
|
+
* `defineConnection()` result. Historically its `manifest.json` described only
|
|
186
|
+
* the CLI, so a manifest-driven (lazy) registry that catalogued it from the
|
|
187
|
+
* manifest would silently DROP the sibling connection (its OAuth slug/shape) —
|
|
188
|
+
* an auth-breaking regression. Rather than fall back to eager import for the
|
|
189
|
+
* whole package (the memory cost we're removing), the CLI manifest now embeds
|
|
190
|
+
* its sibling connection here so the lazy registry can register the connection
|
|
191
|
+
* FROM THE MANIFEST, byte-identically to the eager path.
|
|
192
|
+
*
|
|
193
|
+
* This is the pure, serialisable mirror of the runtime `BrandedConnection`
|
|
194
|
+
* (minus the `__akaiConnection` brand): the SHAPE needed to reconstruct a
|
|
195
|
+
* `WireConnectionEntry` (slug, authKind, secrets, oauth/jwtRefresh shape). It
|
|
196
|
+
* carries NO secret values. `override` is not emitted to `/tools/list` (the wire
|
|
197
|
+
* never carried it) but is preserved so a manifest-driven registry resolves a
|
|
198
|
+
* connection-slug collision the same way the eager loader does.
|
|
199
|
+
*
|
|
200
|
+
* Produced by `connectionToManifest()` (see runtime/registry/connection-manifest.ts)
|
|
201
|
+
* and projected to the wire by `manifestConnectionToWire()`.
|
|
202
|
+
*/
|
|
203
|
+
export interface ManifestConnection {
|
|
204
|
+
readonly slug: string;
|
|
205
|
+
readonly name: string;
|
|
206
|
+
readonly vendor: string;
|
|
207
|
+
readonly blurb: string;
|
|
208
|
+
readonly longDesc: string;
|
|
209
|
+
readonly instructions: readonly string[];
|
|
210
|
+
readonly authKind: ManifestConnectionAuthKind;
|
|
211
|
+
/** User-facing secret DECLARATIONS — key declarations only, exactly like
|
|
212
|
+
* {@link ConnectionManifest.secrets}. Secret VALUES never appear here. */
|
|
213
|
+
readonly secrets?: readonly ManifestSecret[];
|
|
214
|
+
/** Header carrying the apiKey credential (e.g. `Authorization` ⇒ `Bearer <token>`).
|
|
215
|
+
* Only meaningful for `authKind` `apiKey`. */
|
|
216
|
+
readonly apiKeyHeader?: string;
|
|
217
|
+
/** Per-environment host map for the connection's API. */
|
|
218
|
+
readonly hosts?: {
|
|
219
|
+
readonly production?: string;
|
|
220
|
+
readonly demo?: string;
|
|
221
|
+
readonly dev?: string;
|
|
222
|
+
};
|
|
223
|
+
/** Present iff `authKind` is `oauth2`. SHAPE only — never secret values. */
|
|
224
|
+
readonly oauth?: ManifestConnectionOAuth;
|
|
225
|
+
/** Declarative background JWT-refresh config for a non-OAuth connection. SHAPE only. */
|
|
226
|
+
readonly jwtRefresh?: ManifestJwtRefresh;
|
|
227
|
+
/** Governance FACT: auto-resolves without a user credential (no secrets + native transport). */
|
|
228
|
+
readonly nativeBuiltin?: boolean;
|
|
229
|
+
/** Cross-repo override opt-in — mirrors {@link ConnectionManifest.override}. Not emitted to the
|
|
230
|
+
* wire, but a manifest-driven registry reads it for connection-slug collision resolution. */
|
|
231
|
+
readonly override?: boolean;
|
|
232
|
+
}
|
|
116
233
|
export interface ConnectionManifest {
|
|
117
234
|
readonly $schemaVersion: SchemaVersion;
|
|
118
235
|
readonly id: string;
|
|
@@ -145,6 +262,17 @@ export interface ConnectionManifest {
|
|
|
145
262
|
* it only when set.
|
|
146
263
|
*/
|
|
147
264
|
readonly override?: boolean;
|
|
265
|
+
/**
|
|
266
|
+
* Sibling connection embedded from a MIXED package (AKAI-2408) — a package
|
|
267
|
+
* whose default export is `[cli, connection]`. Present only when this CLI
|
|
268
|
+
* shipped alongside a `defineConnection()` result; the lazy registry registers
|
|
269
|
+
* it FROM THE MANIFEST so a mixed package loads lazily without dropping its
|
|
270
|
+
* connection's OAuth slug/shape. Optional on the wire — a plain single-CLI
|
|
271
|
+
* manifest omits it, so consumers treat absent as "no embedded connection".
|
|
272
|
+
* `toSchema()` (CLI→manifest) never emits it; the mixed-package bundler sets it
|
|
273
|
+
* via `connectionToManifest()`.
|
|
274
|
+
*/
|
|
275
|
+
readonly connection?: ManifestConnection;
|
|
148
276
|
readonly tools: readonly ToolManifest[];
|
|
149
277
|
}
|
|
150
278
|
export {};
|
|
@@ -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,EA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IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;;;;;OASG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,kBAAkB,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;CACzC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connection → manifest serializer (AKAI-2408).
|
|
3
|
+
*
|
|
4
|
+
* The symmetric counterpart to `toSchema()` (CLI → manifest). A MIXED package
|
|
5
|
+
* default-exports BOTH a `defineCLI()` result and a `defineConnection()` result;
|
|
6
|
+
* its `manifest.json` historically described only the CLI, so a lazy registry
|
|
7
|
+
* catalogued from that manifest would silently DROP the sibling connection's
|
|
8
|
+
* OAuth slug/shape — an auth-breaking regression, which forced mixed packages to
|
|
9
|
+
* load EAGERLY (the memory cost). This serializer projects the built
|
|
10
|
+
* `BrandedConnection` into a pure {@link ManifestConnection} the mixed-package
|
|
11
|
+
* bundler embeds as `manifest.connection`, so the lazy registry can register the
|
|
12
|
+
* connection FROM THE MANIFEST — byte-identically to the eager path.
|
|
13
|
+
*
|
|
14
|
+
* The projection is a FAITHFUL structural copy (like `defineConnection` builds
|
|
15
|
+
* its def): it preserves every field — and the presence of every optional — that
|
|
16
|
+
* `toWireConnection` reads, so `manifestConnectionToWire(connectionToManifest(c))`
|
|
17
|
+
* equals `toWireConnection(c)` byte-for-byte. It carries NO secret values.
|
|
18
|
+
*
|
|
19
|
+
* Cross-repo import (the cli-service / tenant bundler):
|
|
20
|
+
* `import { connectionToManifest } from '@akai-workflow-builder/cli-sdk/runtime'`
|
|
21
|
+
*/
|
|
22
|
+
import type { ManifestConnection } from '../../manifest/types.js';
|
|
23
|
+
import type { BrandedConnection } from './types.js';
|
|
24
|
+
/** Project a built {@link BrandedConnection} to its pure, serialisable
|
|
25
|
+
* {@link ManifestConnection}. Deterministic, no I/O — safe to call at build time. */
|
|
26
|
+
export declare function connectionToManifest(conn: BrandedConnection): ManifestConnection;
|
|
27
|
+
//# sourceMappingURL=connection-manifest.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** Project a built {@link BrandedConnection} to its pure, serialisable
|
|
2
|
+
* {@link ManifestConnection}. Deterministic, no I/O — safe to call at build time. */
|
|
3
|
+
export function connectionToManifest(conn) {
|
|
4
|
+
return {
|
|
5
|
+
slug: conn.slug,
|
|
6
|
+
name: conn.name,
|
|
7
|
+
vendor: conn.vendor,
|
|
8
|
+
blurb: conn.blurb,
|
|
9
|
+
longDesc: conn.longDesc,
|
|
10
|
+
instructions: [...conn.instructions],
|
|
11
|
+
authKind: conn.authKind,
|
|
12
|
+
...(conn.secrets !== undefined ? { secrets: conn.secrets.map(copySecret) } : {}),
|
|
13
|
+
...(conn.apiKeyHeader !== undefined ? { apiKeyHeader: conn.apiKeyHeader } : {}),
|
|
14
|
+
...(conn.hosts !== undefined ? { hosts: { ...conn.hosts } } : {}),
|
|
15
|
+
...(conn.oauth !== undefined ? { oauth: copyOAuth(conn.oauth) } : {}),
|
|
16
|
+
...(conn.jwtRefresh !== undefined ? { jwtRefresh: copyJwtRefresh(conn.jwtRefresh) } : {}),
|
|
17
|
+
...(conn.nativeBuiltin !== undefined ? { nativeBuiltin: conn.nativeBuiltin } : {}),
|
|
18
|
+
...(conn.override !== undefined ? { override: conn.override } : {}),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function copySecret(s) {
|
|
22
|
+
return {
|
|
23
|
+
key: s.key,
|
|
24
|
+
name: s.name,
|
|
25
|
+
description: s.description,
|
|
26
|
+
required: s.required,
|
|
27
|
+
...(s.injected !== undefined ? { injected: s.injected } : {}),
|
|
28
|
+
...(s.adminManaged !== undefined ? { adminManaged: s.adminManaged } : {}),
|
|
29
|
+
...(s.serverOnly !== undefined ? { serverOnly: s.serverOnly } : {}),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function copyOAuth(o) {
|
|
33
|
+
return {
|
|
34
|
+
authorizeUrl: o.authorizeUrl,
|
|
35
|
+
tokenUrl: o.tokenUrl,
|
|
36
|
+
...(o.scopes !== undefined ? { scopes: [...o.scopes] } : {}),
|
|
37
|
+
...(o.pkce !== undefined ? { pkce: o.pkce } : {}),
|
|
38
|
+
...(o.tokenEndpointAuthMethod !== undefined ? { tokenEndpointAuthMethod: o.tokenEndpointAuthMethod } : {}),
|
|
39
|
+
...(o.extraAuthorizeParams !== undefined ? { extraAuthorizeParams: { ...o.extraAuthorizeParams } } : {}),
|
|
40
|
+
...(o.refreshStrategy !== undefined ? { refreshStrategy: o.refreshStrategy } : {}),
|
|
41
|
+
adminFields: o.adminFields.map((f) => ({
|
|
42
|
+
key: f.key,
|
|
43
|
+
label: f.label,
|
|
44
|
+
...(f.secret !== undefined ? { secret: f.secret } : {}),
|
|
45
|
+
})),
|
|
46
|
+
...(o.hasCustomConnectFlow !== undefined ? { hasCustomConnectFlow: o.hasCustomConnectFlow } : {}),
|
|
47
|
+
...(o.tokenResponsePath !== undefined ? { tokenResponsePath: o.tokenResponsePath } : {}),
|
|
48
|
+
...(o.appToken !== undefined
|
|
49
|
+
? {
|
|
50
|
+
appToken: {
|
|
51
|
+
tokenUrl: o.appToken.tokenUrl,
|
|
52
|
+
...(o.appToken.requestStyle !== undefined ? { requestStyle: o.appToken.requestStyle } : {}),
|
|
53
|
+
...(o.appToken.credentialParams !== undefined
|
|
54
|
+
? { credentialParams: { ...o.appToken.credentialParams } }
|
|
55
|
+
: {}),
|
|
56
|
+
...(o.appToken.tokenField !== undefined ? { tokenField: o.appToken.tokenField } : {}),
|
|
57
|
+
...(o.appToken.expiresField !== undefined ? { expiresField: o.appToken.expiresField } : {}),
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
: {}),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function copyJwtRefresh(j) {
|
|
64
|
+
return {
|
|
65
|
+
name: j.name,
|
|
66
|
+
envs: j.envs.map((e) => ({
|
|
67
|
+
env: e.env,
|
|
68
|
+
accessKey: e.accessKey,
|
|
69
|
+
refreshKey: e.refreshKey,
|
|
70
|
+
refreshUrl: e.refreshUrl,
|
|
71
|
+
})),
|
|
72
|
+
...(j.defaultAtTtlMs !== undefined ? { defaultAtTtlMs: j.defaultAtTtlMs } : {}),
|
|
73
|
+
...(j.revocationBackoffMs !== undefined ? { revocationBackoffMs: j.revocationBackoffMs } : {}),
|
|
74
|
+
...(j.claimTtlSeconds !== undefined ? { claimTtlSeconds: j.claimTtlSeconds } : {}),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
@@ -3,5 +3,6 @@ export type { LoadRegistryOptions } from './loader.js';
|
|
|
3
3
|
export type { BrandedCLI, BrandedConnection, BrandedConnectionOAuth, BrandedOAuthAdminField, BrandedTool, BrandedToolOptions, BrandedSecretDecl, ConnectionAuthKind, ConnectionEntry, ConnectionRefreshStrategy, ConnectionTokenEndpointAuthMethod, RegistryEntry, RegistrySource, RegistryStats, ToolLookup, } from './types.js';
|
|
4
4
|
export type { WireCliEntry, WireConnectionEntry, WireConnectionOAuth, WireListPayload, WireTenant, WireToolEntry, } from './wire.js';
|
|
5
5
|
export { toWireListPayload } from './wire.js';
|
|
6
|
-
export { manifestToWireCli, manifestToWireTools, manifestsToWireCatalog, } from './manifest-wire.js';
|
|
6
|
+
export { manifestConnectionToWire, manifestToWireCli, manifestToWireTools, manifestsToWireCatalog, } from './manifest-wire.js';
|
|
7
|
+
export { connectionToManifest } from './connection-manifest.js';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/registry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,yBAAyB,EACzB,iCAAiC,EACjC,aAAa,EACb,cAAc,EACd,aAAa,EACb,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,UAAU,EACV,aAAa,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/registry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,yBAAyB,EACzB,iCAAiC,EACjC,aAAa,EACb,cAAc,EACd,aAAa,EACb,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,UAAU,EACV,aAAa,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { Registry } from './loader.js';
|
|
2
2
|
export { toWireListPayload } from './wire.js';
|
|
3
|
-
export { manifestToWireCli, manifestToWireTools, manifestsToWireCatalog, } from './manifest-wire.js';
|
|
3
|
+
export { manifestConnectionToWire, manifestToWireCli, manifestToWireTools, manifestsToWireCatalog, } from './manifest-wire.js';
|
|
4
|
+
export { connectionToManifest } from './connection-manifest.js';
|
|
@@ -44,6 +44,7 @@ export declare class Registry {
|
|
|
44
44
|
private readonly loadFailures;
|
|
45
45
|
private readonly lazyByCliId;
|
|
46
46
|
private readonly resolvedCache;
|
|
47
|
+
private readonly manifestConnBySlug;
|
|
47
48
|
private constructor();
|
|
48
49
|
static load(opts: LoadRegistryOptions): Promise<Registry>;
|
|
49
50
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/runtime/registry/loader.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAMV,eAAe,EACf,WAAW,EACX,aAAa,EAEb,aAAa,EACb,UAAU,EACX,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKjD,OAAO,KAAK,EAAgB,eAAe,EAAE,UAAU,EAAiB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/runtime/registry/loader.ts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IACnD,OAAO,CAAC,gBAAgB;IAiBxB,OAAO,IAAI,aAAa,CAAC,aAAa,CAAC;IAIvC,WAAW,IAAI,aAAa,CAAC,eAAe,CAAC;IAI7C;wCACoC;IACpC,QAAQ,IAAI,aAAa,CAAC,WAAW,CAAC;IAItC,KAAK,IAAI,aAAa;IAyCtB;;;;;;;OAOG;IACH,aAAa,CAAC,MAAM,GAAE,UAAU,GAAG,IAAW,GAAG,eAAe;CA2BjE"}
|
|
@@ -25,7 +25,7 @@ import path from 'node:path';
|
|
|
25
25
|
import { pathToFileURL } from 'node:url';
|
|
26
26
|
import { DYNAMIC_EGRESS_PREFIXES } from '../../tool.js';
|
|
27
27
|
import { validateManifest } from '../../manifest/json-schema.js';
|
|
28
|
-
import { manifestToWireCli, manifestToWireTools } from './manifest-wire.js';
|
|
28
|
+
import { manifestConnectionToWire, manifestToWireCli, manifestToWireTools } from './manifest-wire.js';
|
|
29
29
|
import { toWireListPayload as toWireListPayloadFn } from './wire.js';
|
|
30
30
|
export class Registry {
|
|
31
31
|
// Map keyed by `cli.id`. Stable iteration order matches insertion which
|
|
@@ -47,7 +47,14 @@ export class Registry {
|
|
|
47
47
|
// so concurrent `resolveTool` calls for the same CLI import it once. A rejected
|
|
48
48
|
// import is evicted so a later call can retry.
|
|
49
49
|
resolvedCache;
|
|
50
|
-
|
|
50
|
+
// Lazy mode only (AKAI-2408): connections embedded in a MIXED package's
|
|
51
|
+
// manifest.json, keyed by slug. Identity-only (no handlers), so they never
|
|
52
|
+
// import a module — they are projected onto `/tools/list` via
|
|
53
|
+
// `manifestConnectionToWire`, byte-identically to an eager ConnectionEntry.
|
|
54
|
+
// Empty in eager mode. Their slug space is UNIFIED with eager connections'
|
|
55
|
+
// (see `chooseConn` in `load`), so a duplicate collides the same way.
|
|
56
|
+
manifestConnBySlug;
|
|
57
|
+
constructor(entries, connections, loadFailures, lazyClis = [], manifestConns = []) {
|
|
51
58
|
this.byCliId = new Map();
|
|
52
59
|
for (const e of entries)
|
|
53
60
|
this.byCliId.set(e.cli.id, e);
|
|
@@ -59,6 +66,9 @@ export class Registry {
|
|
|
59
66
|
for (const l of lazyClis)
|
|
60
67
|
this.lazyByCliId.set(l.cliId, l);
|
|
61
68
|
this.resolvedCache = new Map();
|
|
69
|
+
this.manifestConnBySlug = new Map();
|
|
70
|
+
for (const m of manifestConns)
|
|
71
|
+
this.manifestConnBySlug.set(m.slug, m);
|
|
62
72
|
}
|
|
63
73
|
static async load(opts) {
|
|
64
74
|
const failures = [];
|
|
@@ -173,21 +183,35 @@ export class Registry {
|
|
|
173
183
|
if (replace)
|
|
174
184
|
cliChoice.set(cand.id, cand);
|
|
175
185
|
};
|
|
186
|
+
const connChoice = new Map();
|
|
187
|
+
const chooseConn = (cand) => {
|
|
188
|
+
const existing = connChoice.get(cand.slug);
|
|
189
|
+
if (!existing) {
|
|
190
|
+
connChoice.set(cand.slug, cand);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const replace = resolveCollision('connection slug', cand.slug, { packagePath: existing.packagePath, source: existing.source, override: existing.override }, { packagePath: cand.packagePath, source: cand.source, override: cand.override });
|
|
194
|
+
if (replace)
|
|
195
|
+
connChoice.set(cand.slug, cand);
|
|
196
|
+
};
|
|
176
197
|
const ingestLazyScan = (scan) => {
|
|
177
198
|
failures.push(...scan.failures);
|
|
178
|
-
//
|
|
179
|
-
// (slug
|
|
180
|
-
const conns = [];
|
|
199
|
+
// Manifest-less CLIs → unified CLI chooser; eager connections → unified
|
|
200
|
+
// connection chooser (slug space is independent of the cli-id space).
|
|
181
201
|
for (const item of scan.eager) {
|
|
182
|
-
if (item.kind === 'connection')
|
|
183
|
-
|
|
184
|
-
|
|
202
|
+
if (item.kind === 'connection') {
|
|
203
|
+
chooseConn({ kind: 'eager', slug: item.entry.connection.slug, source: item.entry.source, packagePath: item.entry.packagePath, override: item.entry.connection.override === true, entry: item.entry });
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
185
206
|
chooseCli({ kind: 'eager', id: item.entry.cli.id, source: item.entry.source, packagePath: item.entry.packagePath, override: item.entry.cli.override === true, entry: item.entry });
|
|
207
|
+
}
|
|
186
208
|
}
|
|
187
|
-
ingest(conns);
|
|
188
209
|
for (const l of scan.lazyClis) {
|
|
189
210
|
chooseCli({ kind: 'lazy', id: l.cliId, source: l.source, packagePath: l.packagePath, override: l.override, lazy: l });
|
|
190
211
|
}
|
|
212
|
+
for (const m of scan.manifestConns) {
|
|
213
|
+
chooseConn({ kind: 'manifest', slug: m.slug, source: m.source, packagePath: m.packagePath, override: m.override, manifest: m });
|
|
214
|
+
}
|
|
191
215
|
};
|
|
192
216
|
// Same baseline-before-customer invariant as the eager path.
|
|
193
217
|
if (opts.baselinePath)
|
|
@@ -202,7 +226,15 @@ export class Registry {
|
|
|
202
226
|
else
|
|
203
227
|
lazyEntries.push(cand.lazy);
|
|
204
228
|
}
|
|
205
|
-
|
|
229
|
+
const eagerConns = [];
|
|
230
|
+
const manifestConns = [];
|
|
231
|
+
for (const cand of connChoice.values()) {
|
|
232
|
+
if (cand.kind === 'eager')
|
|
233
|
+
eagerConns.push(cand.entry);
|
|
234
|
+
else
|
|
235
|
+
manifestConns.push(cand.manifest);
|
|
236
|
+
}
|
|
237
|
+
return new Registry(eagerEntries, eagerConns, failures, lazyEntries, manifestConns);
|
|
206
238
|
}
|
|
207
239
|
/**
|
|
208
240
|
* Synchronous lookup — resolves only EAGERLY-loaded CLIs. In lazy mode a CLI
|
|
@@ -296,6 +328,14 @@ export class Registry {
|
|
|
296
328
|
else
|
|
297
329
|
customerCount++;
|
|
298
330
|
}
|
|
331
|
+
// Manifest-embedded connections (AKAI-2408) count toward the same totals —
|
|
332
|
+
// no import needed, the slug/source come straight from the manifest.
|
|
333
|
+
for (const m of this.manifestConnBySlug.values()) {
|
|
334
|
+
if (m.source === 'baseline')
|
|
335
|
+
baselineCount++;
|
|
336
|
+
else
|
|
337
|
+
customerCount++;
|
|
338
|
+
}
|
|
299
339
|
// An intentional override is not a load failure — split it out so
|
|
300
340
|
// `failedCount` means "something actually went wrong" (safe to alert on).
|
|
301
341
|
let overriddenCount = 0;
|
|
@@ -305,7 +345,7 @@ export class Registry {
|
|
|
305
345
|
return {
|
|
306
346
|
cliCount: this.byCliId.size + this.lazyByCliId.size,
|
|
307
347
|
toolCount,
|
|
308
|
-
connectionCount: this.byConnectionSlug.size,
|
|
348
|
+
connectionCount: this.byConnectionSlug.size + this.manifestConnBySlug.size,
|
|
309
349
|
baselineCount,
|
|
310
350
|
customerCount,
|
|
311
351
|
failedCount: this.loadFailures.length - overriddenCount,
|
|
@@ -322,7 +362,7 @@ export class Registry {
|
|
|
322
362
|
*/
|
|
323
363
|
toWirePayload(tenant = null) {
|
|
324
364
|
const eager = toWireListPayloadFn(this.entries(), this.connections(), tenant);
|
|
325
|
-
if (this.lazyByCliId.size === 0)
|
|
365
|
+
if (this.lazyByCliId.size === 0 && this.manifestConnBySlug.size === 0)
|
|
326
366
|
return eager;
|
|
327
367
|
const lazyClis = [];
|
|
328
368
|
const lazyTools = [];
|
|
@@ -332,7 +372,15 @@ export class Registry {
|
|
|
332
372
|
}
|
|
333
373
|
const clis = [...eager.clis, ...lazyClis].sort((a, b) => a.id.localeCompare(b.id));
|
|
334
374
|
const tools = [...eager.tools, ...lazyTools].sort((a, b) => a.cli.localeCompare(b.cli) || (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
335
|
-
|
|
375
|
+
// Manifest-embedded connections (AKAI-2408) project via `manifestConnectionToWire`
|
|
376
|
+
// — byte-identical to `toWireConnection` — and merge with the eager ones,
|
|
377
|
+
// re-sorted by slug to match `toWireListPayload`'s connection ordering. The
|
|
378
|
+
// merged array is indistinguishable from an all-eager one.
|
|
379
|
+
const manifestConns = [...this.manifestConnBySlug.values()].map((m) => manifestConnectionToWire(m.connection, m.source));
|
|
380
|
+
const connections = manifestConns.length === 0
|
|
381
|
+
? eager.connections
|
|
382
|
+
: [...eager.connections, ...manifestConns].sort((a, b) => a.slug.localeCompare(b.slug));
|
|
383
|
+
return { ...eager, clis, tools, connections };
|
|
336
384
|
}
|
|
337
385
|
}
|
|
338
386
|
/**
|
|
@@ -421,11 +469,12 @@ async function scanPathLazy(root, source, logger) {
|
|
|
421
469
|
catch (err) {
|
|
422
470
|
if (err.code === 'ENOENT') {
|
|
423
471
|
logger?.warn({ root, source }, 'registry: package root does not exist; treating as empty');
|
|
424
|
-
return { lazyClis: [], eager: [], failures: [] };
|
|
472
|
+
return { lazyClis: [], manifestConns: [], eager: [], failures: [] };
|
|
425
473
|
}
|
|
426
474
|
throw err;
|
|
427
475
|
}
|
|
428
476
|
const lazyClis = [];
|
|
477
|
+
const manifestConns = [];
|
|
429
478
|
const eager = [];
|
|
430
479
|
const failures = [];
|
|
431
480
|
const subdirs = dirents
|
|
@@ -453,6 +502,20 @@ async function scanPathLazy(root, source, logger) {
|
|
|
453
502
|
entryPoint,
|
|
454
503
|
override: manifest.override === true,
|
|
455
504
|
});
|
|
505
|
+
// MIXED package (AKAI-2408): the CLI manifest embeds its sibling connection
|
|
506
|
+
// so a mixed package loads LAZILY instead of falling back to eager import.
|
|
507
|
+
// Surface it as a manifest-sourced connection so it participates in the
|
|
508
|
+
// catalog + slug-collision detection exactly like an eager ConnectionEntry.
|
|
509
|
+
// Its handler-less identity needs no module import — only the CLI's does.
|
|
510
|
+
if (manifest.connection) {
|
|
511
|
+
manifestConns.push({
|
|
512
|
+
slug: manifest.connection.slug,
|
|
513
|
+
connection: manifest.connection,
|
|
514
|
+
source,
|
|
515
|
+
packagePath,
|
|
516
|
+
override: manifest.connection.override === true,
|
|
517
|
+
});
|
|
518
|
+
}
|
|
456
519
|
continue;
|
|
457
520
|
}
|
|
458
521
|
// No usable manifest → eager import (connection packages + manifest-less
|
|
@@ -474,7 +537,7 @@ async function scanPathLazy(root, source, logger) {
|
|
|
474
537
|
failures.push({ packagePath, source, error: message });
|
|
475
538
|
}
|
|
476
539
|
}
|
|
477
|
-
return { lazyClis, eager, failures };
|
|
540
|
+
return { lazyClis, manifestConns, eager, failures };
|
|
478
541
|
}
|
|
479
542
|
/**
|
|
480
543
|
* Read + shallow-validate a package's `manifest.json`. Returns the parsed
|
|
@@ -482,6 +545,11 @@ async function scanPathLazy(root, source, logger) {
|
|
|
482
545
|
* `undefined` when the file is absent, unreadable, unparseable, or the wrong
|
|
483
546
|
* shape — in every "undefined" case the caller falls back to eager import, so a
|
|
484
547
|
* bad manifest degrades to today's behavior rather than dropping the package.
|
|
548
|
+
*
|
|
549
|
+
* A MIXED package's `manifest.connection` block (AKAI-2408) is validated as part
|
|
550
|
+
* of the full-schema check below, so a returned manifest with `connection` set is
|
|
551
|
+
* safe for the caller to surface as a manifest-sourced connection; a malformed
|
|
552
|
+
* connection block fails validation and the whole package falls back to eager.
|
|
485
553
|
*/
|
|
486
554
|
async function readCliManifest(packagePath, logger) {
|
|
487
555
|
const manifestPath = path.join(packagePath, 'manifest.json');
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
* (`{ from: 'secret:KEY' }`) and native (`null` ⇒ `[]`) cases can never drift
|
|
20
20
|
* from the branded projection.
|
|
21
21
|
*/
|
|
22
|
-
import type { ConnectionManifest } from '../../manifest/types.js';
|
|
23
|
-
import { type WireCliEntry, type WireToolEntry } from './wire.js';
|
|
22
|
+
import type { ConnectionManifest, ManifestConnection } from '../../manifest/types.js';
|
|
23
|
+
import { type WireCliEntry, type WireConnectionEntry, type WireToolEntry } from './wire.js';
|
|
24
24
|
export type WireSource = 'baseline' | 'customer';
|
|
25
25
|
/** Project one manifest's CLI-level metadata to its wire entry. Mirrors `toWireCli`. */
|
|
26
26
|
export declare function manifestToWireCli(m: ConnectionManifest, source: WireSource): WireCliEntry;
|
|
@@ -31,6 +31,22 @@ export declare function manifestToWireCli(m: ConnectionManifest, source: WireSou
|
|
|
31
31
|
* order is preserved rather than re-sorted.
|
|
32
32
|
*/
|
|
33
33
|
export declare function manifestToWireTools(m: ConnectionManifest, source: WireSource): WireToolEntry[];
|
|
34
|
+
/**
|
|
35
|
+
* Project a MIXED package's embedded {@link ManifestConnection} to its wire
|
|
36
|
+
* entry (AKAI-2408). Mirrors `toWireConnection` (wire.ts) byte-for-byte — same
|
|
37
|
+
* defensive validation and optional-field elision rules — so a connection
|
|
38
|
+
* registered FROM A MANIFEST is indistinguishable on `/tools/list` from one
|
|
39
|
+
* loaded eagerly from its module. `test/registry/connection-manifest.test.ts`
|
|
40
|
+
* asserts exactly that byte-identity across every connection shape (a
|
|
41
|
+
* dropped/diverging connection is auth-breaking).
|
|
42
|
+
*
|
|
43
|
+
* The elision that matters most: jwtRefresh is dropped whenever an `oauth` block
|
|
44
|
+
* is present OR `authKind === 'oauth2'` (the two are mutually exclusive on the
|
|
45
|
+
* wire), and apiKeyHeader is only emitted for `authKind` `apiKey` — identical to
|
|
46
|
+
* the branded path. Host-map/secret/jwtRefresh validation is delegated to the
|
|
47
|
+
* SAME shared helpers wire.ts uses, so those cases can never drift.
|
|
48
|
+
*/
|
|
49
|
+
export declare function manifestConnectionToWire(mc: ManifestConnection, source: WireSource): WireConnectionEntry;
|
|
34
50
|
/**
|
|
35
51
|
* Assemble the CLI + tool halves of a `/tools/list` payload from a set of
|
|
36
52
|
* manifests, applying the SAME ordering as `toWireListPayload`: CLIs sorted by
|
|
@@ -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,MAAM,yBAAyB,CAAC;
|
|
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,UAAU,GAAG,YAAY,CA6BzF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,kBAAkB,EAAE,MAAM,EAAE,UAAU,GAAG,aAAa,EAAE,CAiB9F;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,kBAAkB,EAAE,MAAM,EAAE,UAAU,GAAG,mBAAmB,CA+DxG;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,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 { wireEgress } from './wire.js';
|
|
1
|
+
import { isWireSecretDecl, wireEgress, wireHosts, wireJwtRefresh, } 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 {
|
|
@@ -54,6 +54,86 @@ export function manifestToWireTools(m, source) {
|
|
|
54
54
|
source,
|
|
55
55
|
}));
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Project a MIXED package's embedded {@link ManifestConnection} to its wire
|
|
59
|
+
* entry (AKAI-2408). Mirrors `toWireConnection` (wire.ts) byte-for-byte — same
|
|
60
|
+
* defensive validation and optional-field elision rules — so a connection
|
|
61
|
+
* registered FROM A MANIFEST is indistinguishable on `/tools/list` from one
|
|
62
|
+
* loaded eagerly from its module. `test/registry/connection-manifest.test.ts`
|
|
63
|
+
* asserts exactly that byte-identity across every connection shape (a
|
|
64
|
+
* dropped/diverging connection is auth-breaking).
|
|
65
|
+
*
|
|
66
|
+
* The elision that matters most: jwtRefresh is dropped whenever an `oauth` block
|
|
67
|
+
* is present OR `authKind === 'oauth2'` (the two are mutually exclusive on the
|
|
68
|
+
* wire), and apiKeyHeader is only emitted for `authKind` `apiKey` — identical to
|
|
69
|
+
* the branded path. Host-map/secret/jwtRefresh validation is delegated to the
|
|
70
|
+
* SAME shared helpers wire.ts uses, so those cases can never drift.
|
|
71
|
+
*/
|
|
72
|
+
export function manifestConnectionToWire(mc, source) {
|
|
73
|
+
const hosts = wireHosts(mc.hosts);
|
|
74
|
+
const jwtRefresh = mc.authKind === 'oauth2' || mc.oauth ? undefined : wireJwtRefresh(mc.jwtRefresh);
|
|
75
|
+
const rawSecrets = Array.isArray(mc.secrets) ? mc.secrets : [];
|
|
76
|
+
const secrets = rawSecrets.filter(isWireSecretDecl).map((s) => ({
|
|
77
|
+
name: s.name,
|
|
78
|
+
description: s.description,
|
|
79
|
+
required: s.required,
|
|
80
|
+
key: s.key,
|
|
81
|
+
...(s.adminManaged === true ? { adminManaged: true } : {}),
|
|
82
|
+
...(s.injected === true ? { injected: true } : {}),
|
|
83
|
+
...(s.serverOnly === true ? { serverOnly: true } : {}),
|
|
84
|
+
}));
|
|
85
|
+
const base = {
|
|
86
|
+
slug: mc.slug,
|
|
87
|
+
name: mc.name,
|
|
88
|
+
vendor: mc.vendor,
|
|
89
|
+
blurb: mc.blurb,
|
|
90
|
+
longDesc: mc.longDesc,
|
|
91
|
+
instructions: [...mc.instructions],
|
|
92
|
+
authKind: mc.authKind,
|
|
93
|
+
...(secrets.length > 0 ? { secrets } : {}),
|
|
94
|
+
...(mc.authKind === 'apiKey' && typeof mc.apiKeyHeader === 'string' && mc.apiKeyHeader.length > 0
|
|
95
|
+
? { apiKeyHeader: mc.apiKeyHeader }
|
|
96
|
+
: {}),
|
|
97
|
+
...(hosts ? { hosts } : {}),
|
|
98
|
+
...(jwtRefresh ? { jwtRefresh } : {}),
|
|
99
|
+
...(mc.nativeBuiltin === true ? { nativeBuiltin: true } : {}),
|
|
100
|
+
source,
|
|
101
|
+
};
|
|
102
|
+
if (!mc.oauth)
|
|
103
|
+
return base;
|
|
104
|
+
return {
|
|
105
|
+
...base,
|
|
106
|
+
oauth: {
|
|
107
|
+
authorizeUrl: mc.oauth.authorizeUrl,
|
|
108
|
+
tokenUrl: mc.oauth.tokenUrl,
|
|
109
|
+
scopes: Array.isArray(mc.oauth.scopes) ? mc.oauth.scopes.filter((s) => typeof s === 'string') : [],
|
|
110
|
+
pkce: mc.oauth.pkce ?? false,
|
|
111
|
+
tokenEndpointAuthMethod: mc.oauth.tokenEndpointAuthMethod ?? 'client_secret_basic',
|
|
112
|
+
extraAuthorizeParams: mc.oauth.extraAuthorizeParams ? { ...mc.oauth.extraAuthorizeParams } : {},
|
|
113
|
+
refreshStrategy: mc.oauth.refreshStrategy ?? 'cron',
|
|
114
|
+
adminFields: mc.oauth.adminFields.map((f) => ({
|
|
115
|
+
key: f.key,
|
|
116
|
+
label: f.label,
|
|
117
|
+
secret: f.secret ?? false,
|
|
118
|
+
})),
|
|
119
|
+
...(mc.oauth.hasCustomConnectFlow !== undefined ? { hasCustomConnectFlow: mc.oauth.hasCustomConnectFlow } : {}),
|
|
120
|
+
...(typeof mc.oauth.tokenResponsePath === 'string' && mc.oauth.tokenResponsePath.length > 0
|
|
121
|
+
? { tokenResponsePath: mc.oauth.tokenResponsePath }
|
|
122
|
+
: {}),
|
|
123
|
+
...(mc.oauth.appToken && typeof mc.oauth.appToken.tokenUrl === 'string' && mc.oauth.appToken.tokenUrl.length > 0
|
|
124
|
+
? {
|
|
125
|
+
appToken: {
|
|
126
|
+
tokenUrl: mc.oauth.appToken.tokenUrl,
|
|
127
|
+
...(mc.oauth.appToken.requestStyle ? { requestStyle: mc.oauth.appToken.requestStyle } : {}),
|
|
128
|
+
...(mc.oauth.appToken.credentialParams ? { credentialParams: { ...mc.oauth.appToken.credentialParams } } : {}),
|
|
129
|
+
...(mc.oauth.appToken.tokenField ? { tokenField: mc.oauth.appToken.tokenField } : {}),
|
|
130
|
+
...(mc.oauth.appToken.expiresField ? { expiresField: mc.oauth.appToken.expiresField } : {}),
|
|
131
|
+
},
|
|
132
|
+
}
|
|
133
|
+
: {}),
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
57
137
|
/**
|
|
58
138
|
* Assemble the CLI + tool halves of a `/tools/list` payload from a set of
|
|
59
139
|
* manifests, applying the SAME ordering as `toWireListPayload`: CLIs sorted by
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConnectionEntry, RegistryEntry } from './types.js';
|
|
1
|
+
import type { BrandedConnection, BrandedSecretDecl, ConnectionEntry, RegistryEntry } from './types.js';
|
|
2
2
|
export interface WireToolEntry {
|
|
3
3
|
/** CLI id this tool belongs to (e.g. `"jira"`). */
|
|
4
4
|
readonly cli: string;
|
|
@@ -149,6 +149,32 @@ export interface WireListPayload {
|
|
|
149
149
|
readonly tenant: WireTenant | null;
|
|
150
150
|
}
|
|
151
151
|
export declare function toWireListPayload(entries: ReadonlyArray<RegistryEntry>, connectionEntries?: ReadonlyArray<ConnectionEntry>, tenant?: WireTenant | null): WireListPayload;
|
|
152
|
+
export declare function toWireConnection(conn: BrandedConnection, source: 'baseline' | 'customer'): WireConnectionEntry;
|
|
153
|
+
/**
|
|
154
|
+
* Serialize a connection's declarative jwtRefresh config for the wire. Validates the shape (a
|
|
155
|
+
* malformed customer package could hand a non-object, or an env missing keys) and emits
|
|
156
|
+
* declarations only — no secret values. Envs missing a required field are dropped; the whole field
|
|
157
|
+
* is omitted when nothing usable remains, matching the optional-field style used for `oauth`.
|
|
158
|
+
*/
|
|
159
|
+
export declare function wireJwtRefresh(jr: unknown): WireConnectionEntry['jwtRefresh'] | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* Serialize a connection's per-environment host map for the wire. Only the
|
|
162
|
+
* three known keys (`production`/`demo`/`dev`) with non-empty string values are
|
|
163
|
+
* carried through; anything else is dropped. Returns `undefined` when no valid
|
|
164
|
+
* host is present so the caller omits the field entirely (matching the
|
|
165
|
+
* optional-field style used for `oauth`). No secret values live here — hosts are
|
|
166
|
+
* non-sensitive API base URLs.
|
|
167
|
+
*/
|
|
168
|
+
export declare function wireHosts(hosts: unknown): {
|
|
169
|
+
production?: string;
|
|
170
|
+
demo?: string;
|
|
171
|
+
dev?: string;
|
|
172
|
+
} | undefined;
|
|
173
|
+
/** Full-shape guard for a secret declaration before it's serialized onto the
|
|
174
|
+
* wire. The loader validates this at load time too (isBrandedSecretDecl), but
|
|
175
|
+
* the serializer stays self-defensive so a partial entry can't emit `undefined`
|
|
176
|
+
* fields onto the wire. */
|
|
177
|
+
export declare function isWireSecretDecl(s: unknown): s is BrandedSecretDecl;
|
|
152
178
|
/**
|
|
153
179
|
* Serialize a tool's egress for the wire. A static allowlist passes through;
|
|
154
180
|
* a dynamic ref `{ from: 'property:<KEY>' }` or `{ from: 'secret:<KEY>' }`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../../src/runtime/registry/wire.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../../src/runtime/registry/wire.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAEV,iBAAiB,EACjB,iBAAiB,EAEjB,eAAe,EACf,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,aAAa;IAC5B,mDAAmD;IACnD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC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,QAAQ,CAAC,IAAI,EAAE,SAAS,YAAY,EAAE,CAAC;IACvC,oHAAoH;IACpH,QAAQ,CAAC,WAAW,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACrD,wFAAwF;IACxF,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;CACpC;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,aAAa,CAAC,aAAa,CAAC,EACrC,iBAAiB,GAAE,aAAa,CAAC,eAAe,CAAM,EACtD,MAAM,GAAE,UAAU,GAAG,IAAW,GAC/B,eAAe,CAyBjB;AAkCD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAE,UAAU,GAAG,UAAU,GAC9B,mBAAmB,CA6FrB;AA6BD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,OAAO,GAAG,mBAAmB,CAAC,YAAY,CAAC,GAAG,SAAS,CA2BzF;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAS1G;AAED;;;2BAG2B;AAC3B,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,iBAAiB,CAUnE;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,CASpD"}
|
|
@@ -67,7 +67,7 @@ function toWireCli(cli, source) {
|
|
|
67
67
|
source,
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
function toWireConnection(conn, source) {
|
|
70
|
+
export function toWireConnection(conn, source) {
|
|
71
71
|
const hosts = wireHosts(conn.hosts);
|
|
72
72
|
// jwtRefresh is the background-refresh mechanism for NON-OAuth connections; OAuth connections
|
|
73
73
|
// refresh through their own token flow. The two are mutually exclusive — keyed on the declared
|
|
@@ -188,7 +188,7 @@ function toWireTool(cliId, toolKey, tool, source) {
|
|
|
188
188
|
* declarations only — no secret values. Envs missing a required field are dropped; the whole field
|
|
189
189
|
* is omitted when nothing usable remains, matching the optional-field style used for `oauth`.
|
|
190
190
|
*/
|
|
191
|
-
function wireJwtRefresh(jr) {
|
|
191
|
+
export function wireJwtRefresh(jr) {
|
|
192
192
|
if (!jr || typeof jr !== 'object')
|
|
193
193
|
return undefined;
|
|
194
194
|
const o = jr;
|
|
@@ -228,7 +228,7 @@ function wireJwtRefresh(jr) {
|
|
|
228
228
|
* optional-field style used for `oauth`). No secret values live here — hosts are
|
|
229
229
|
* non-sensitive API base URLs.
|
|
230
230
|
*/
|
|
231
|
-
function wireHosts(hosts) {
|
|
231
|
+
export function wireHosts(hosts) {
|
|
232
232
|
if (hosts === null || typeof hosts !== 'object')
|
|
233
233
|
return undefined;
|
|
234
234
|
const o = hosts;
|
|
@@ -244,7 +244,7 @@ function wireHosts(hosts) {
|
|
|
244
244
|
* wire. The loader validates this at load time too (isBrandedSecretDecl), but
|
|
245
245
|
* the serializer stays self-defensive so a partial entry can't emit `undefined`
|
|
246
246
|
* fields onto the wire. */
|
|
247
|
-
function isWireSecretDecl(s) {
|
|
247
|
+
export function isWireSecretDecl(s) {
|
|
248
248
|
if (!s || typeof s !== 'object')
|
|
249
249
|
return false;
|
|
250
250
|
const o = s;
|