@duetso/agent 0.3.12 → 0.3.13
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/dist/package.json +6 -6
- package/dist/src/cli/connect.d.ts +7 -0
- package/dist/src/cli/connect.d.ts.map +1 -1
- package/dist/src/cli/connect.js +46 -27
- package/dist/src/cli/connect.js.map +1 -1
- package/dist/src/connected-providers/capability-probe.d.ts.map +1 -1
- package/dist/src/connected-providers/capability-probe.js +13 -8
- package/dist/src/connected-providers/capability-probe.js.map +1 -1
- package/dist/src/connected-providers/fake-issuer.d.ts +16 -1
- package/dist/src/connected-providers/fake-issuer.d.ts.map +1 -1
- package/dist/src/connected-providers/fake-issuer.js +89 -42
- package/dist/src/connected-providers/fake-issuer.js.map +1 -1
- package/dist/src/connected-providers/refresh.d.ts.map +1 -1
- package/dist/src/connected-providers/refresh.js +9 -2
- package/dist/src/connected-providers/refresh.js.map +1 -1
- package/dist/src/connected-providers/registry.d.ts +8 -2
- package/dist/src/connected-providers/registry.d.ts.map +1 -1
- package/dist/src/connected-providers/registry.js +18 -3
- package/dist/src/connected-providers/registry.js.map +1 -1
- package/dist/src/connected-providers/tokens.d.ts.map +1 -1
- package/dist/src/connected-providers/tokens.js +10 -6
- package/dist/src/connected-providers/tokens.js.map +1 -1
- package/dist/src/core/structured-output.d.ts.map +1 -1
- package/dist/src/core/structured-output.js +2 -1
- package/dist/src/core/structured-output.js.map +1 -1
- package/dist/src/memory/observational.d.ts +0 -1
- package/dist/src/memory/observational.d.ts.map +1 -1
- package/dist/src/memory/observational.js +19 -39
- package/dist/src/memory/observational.js.map +1 -1
- package/dist/src/model-resolution/catalog.d.ts.map +1 -1
- package/dist/src/model-resolution/catalog.js +6 -9
- package/dist/src/model-resolution/catalog.js.map +1 -1
- package/dist/src/model-resolution/duet-gateway.d.ts +52 -45
- package/dist/src/model-resolution/duet-gateway.d.ts.map +1 -1
- package/dist/src/model-resolution/duet-gateway.js +192 -264
- package/dist/src/model-resolution/duet-gateway.js.map +1 -1
- package/dist/src/model-resolution/models.d.ts +24 -0
- package/dist/src/model-resolution/models.d.ts.map +1 -0
- package/dist/src/model-resolution/models.js +63 -0
- package/dist/src/model-resolution/models.js.map +1 -0
- package/dist/src/model-resolution/resolver.d.ts +1 -1
- package/dist/src/model-resolution/resolver.d.ts.map +1 -1
- package/dist/src/model-resolution/resolver.js +18 -17
- package/dist/src/model-resolution/resolver.js.map +1 -1
- package/dist/src/model-routing/advisor.js +9 -1
- package/dist/src/model-routing/advisor.js.map +1 -1
- package/dist/src/turn-runner/turn-runner.d.ts.map +1 -1
- package/dist/src/turn-runner/turn-runner.js +4 -0
- package/dist/src/turn-runner/turn-runner.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Model } from "@earendil-works/pi-ai";
|
|
1
|
+
import { type Api, type Model, type Provider, type ProviderAuth } from "@earendil-works/pi-ai";
|
|
2
2
|
/** Request header the product reads to attribute a gateway call to a tier. */
|
|
3
3
|
export declare const DUET_TIER_HEADER = "x-duet-tier";
|
|
4
4
|
/**
|
|
@@ -13,64 +13,71 @@ export declare const DUET_TIER_HEADER = "x-duet-tier";
|
|
|
13
13
|
export declare function duetTierHeaders(): Record<string, string> | undefined;
|
|
14
14
|
/**
|
|
15
15
|
* The Duet gateway proxies Vercel's AI Gateway path layout and authenticates
|
|
16
|
-
* with a `DUET_API_KEY` token scoped to a single org.
|
|
17
|
-
*
|
|
18
|
-
* model definitions and only swaps `baseUrl` to point at Duet.
|
|
19
|
-
*
|
|
20
|
-
* `DUET_GATEWAY_BASE_URL` can point model traffic at a dedicated gateway
|
|
21
|
-
* origin. When it is unset, model traffic goes directly to
|
|
16
|
+
* with a `DUET_API_KEY` token scoped to a single org. `DUET_GATEWAY_BASE_URL`
|
|
17
|
+
* points model traffic at a different origin; unset, it goes to
|
|
22
18
|
* `https://gateway.duet.so`.
|
|
23
|
-
*
|
|
24
|
-
* Auth flows through pi-ai's existing vercel-ai-gateway path, which reads
|
|
25
|
-
* `AI_GATEWAY_API_KEY` — the CLI shims that env var from `DUET_API_KEY` at
|
|
26
|
-
* startup so users only need to set the duet token.
|
|
27
19
|
*/
|
|
28
20
|
export declare const DUET_GATEWAY_API_KEY_ENV = "DUET_API_KEY";
|
|
29
21
|
export declare const DUET_GATEWAY_BASE_URL_ENV = "DUET_GATEWAY_BASE_URL";
|
|
30
22
|
export declare function getDuetGatewayBaseUrl(): string;
|
|
31
23
|
/**
|
|
32
|
-
*
|
|
24
|
+
* A gateway route: where a request goes, and which credential it carries.
|
|
25
|
+
*
|
|
26
|
+
* The Duet gateway is a proxy in front of Vercel's — same catalog, same model
|
|
27
|
+
* ids, same protocols — so the origin and the credential are the entire
|
|
28
|
+
* difference between them. Every rule below is therefore written once against
|
|
29
|
+
* a route rather than twice per gateway, and a third gateway of this shape
|
|
30
|
+
* costs one entry rather than another parallel set of functions.
|
|
31
|
+
*/
|
|
32
|
+
export interface GatewayRoute {
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
/** Read per call: the Duet origin is configurable, Vercel's is fixed. */
|
|
36
|
+
origin(): string;
|
|
37
|
+
auth(): ProviderAuth;
|
|
38
|
+
/** Request headers the route needs on every model it serves. */
|
|
39
|
+
headers(): Record<string, string> | undefined;
|
|
40
|
+
}
|
|
41
|
+
export declare const GATEWAY_ROUTES: readonly GatewayRoute[];
|
|
42
|
+
/** The route serving `providerId`, or undefined when it is not a gateway. */
|
|
43
|
+
export declare function gatewayRoute(providerId: string): GatewayRoute | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* A gateway as a first-class pi-ai provider.
|
|
33
46
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* semantics, so the TUI never sees reasoning/thinking events.
|
|
47
|
+
* `auth` is why this is a provider rather than a bag of rewritten models: a
|
|
48
|
+
* credential is resolved per provider, and `duet-gateway` is not an id pi-ai's
|
|
49
|
+
* env-key map knows. Declaring it on the provider is what lets any call
|
|
50
|
+
* resolve the token without being handed one.
|
|
39
51
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* set for explicit `vercel-ai-gateway:*` pins.
|
|
52
|
+
* All three transports are declared because serialization belongs to the
|
|
53
|
+
* provider: rewriting a model's `api` to one the provider does not implement
|
|
54
|
+
* yields a model that claims Responses and is sent as Anthropic, silently
|
|
55
|
+
* dropping reasoning effort and mangling tool-result images.
|
|
45
56
|
*/
|
|
46
|
-
export declare function
|
|
47
|
-
/** Apply gateway capabilities that are newer than the pinned model catalog. */
|
|
48
|
-
export declare function applyVercelGatewayModelOverrides(modelId: string, model: Model<any>): Model<any>;
|
|
57
|
+
export declare function gatewayProvider(route: GatewayRoute): Provider;
|
|
49
58
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
59
|
+
* Resolve a `<gateway>:<modelId>` string to a Model.
|
|
60
|
+
*
|
|
61
|
+
* An id the catalog has not shipped still resolves: a gateway serves a model
|
|
62
|
+
* the moment its vendor lists it, and waiting for a catalog release to use it
|
|
63
|
+
* is the coupling this module exists to avoid. The synthesized entry is
|
|
64
|
+
* deliberately conservative so an unknown model never 400s on an
|
|
65
|
+
* over-advertised window.
|
|
55
66
|
*/
|
|
56
|
-
export declare function
|
|
67
|
+
export declare function resolveGatewayModel(route: GatewayRoute, modelId: string): Model<Api>;
|
|
57
68
|
/**
|
|
58
|
-
*
|
|
59
|
-
* `duet-gateway` provider that pi-ai's built-in env-key map does not
|
|
60
|
-
* know about.
|
|
69
|
+
* The API key to send for a provider, resolved the way Duet stores keys.
|
|
61
70
|
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* any direct `complete()` call would silently send an empty API key
|
|
68
|
-
* and fail with `Could not resolve authentication method` even when
|
|
69
|
-
* `DUET_API_KEY` is set.
|
|
71
|
+
* Two kinds of caller need this. Connected providers (ChatGPT, Copilot) keep
|
|
72
|
+
* their token in Duet's own store, which pi-ai cannot see at all. And the
|
|
73
|
+
* api-dispatch `complete()` used for structured output does no provider auth
|
|
74
|
+
* resolution whatsoever, so it needs the key handed to it — including for
|
|
75
|
+
* `duet-gateway`, an id pi-ai's env-key map does not know.
|
|
70
76
|
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
77
|
+
* A gateway rebase deliberately rewrites `model.provider` to
|
|
78
|
+
* `"duet-gateway"` so cost and usage telemetry attribute the call to the Duet
|
|
79
|
+
* proxy rather than to Vercel; that rename is what puts the id outside pi-ai's
|
|
80
|
+
* map in the first place.
|
|
74
81
|
*/
|
|
75
82
|
export declare function resolveProviderApiKey(provider: string): string | undefined;
|
|
76
83
|
//# sourceMappingURL=duet-gateway.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duet-gateway.d.ts","sourceRoot":"","sources":["../../../src/model-resolution/duet-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"duet-gateway.d.ts","sourceRoot":"","sources":["../../../src/model-resolution/duet-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,GAAG,EACR,KAAK,KAAK,EACV,KAAK,QAAQ,EACb,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAa/B,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,gBAAgB,CAAC;AAE9C;;;;;;;;GAQG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAGpE;AAQD;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,iBAAiB,CAAC;AACvD,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AAEjE,wBAAgB,qBAAqB,IAAI,MAAM,CAI9C;AAED;;;;;;;;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