@duetso/agent 0.3.0 → 0.3.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/README.md +14 -4
- package/dist/package.json +1 -1
- package/dist/src/cli/auto-upgrade.d.ts.map +1 -1
- package/dist/src/cli/auto-upgrade.js +7 -54
- package/dist/src/cli/auto-upgrade.js.map +1 -1
- package/dist/src/cli/connect.d.ts +45 -0
- package/dist/src/cli/connect.d.ts.map +1 -0
- package/dist/src/cli/connect.js +265 -0
- package/dist/src/cli/connect.js.map +1 -0
- package/dist/src/cli/help.d.ts +1 -0
- package/dist/src/cli/help.d.ts.map +1 -1
- package/dist/src/cli/help.js +25 -5
- package/dist/src/cli/help.js.map +1 -1
- package/dist/src/cli/model.d.ts +5 -0
- package/dist/src/cli/model.d.ts.map +1 -1
- package/dist/src/cli/model.js +43 -0
- package/dist/src/cli/model.js.map +1 -1
- package/dist/src/cli/route.d.ts +10 -0
- package/dist/src/cli/route.d.ts.map +1 -1
- package/dist/src/cli/route.js +31 -1
- package/dist/src/cli/route.js.map +1 -1
- package/dist/src/cli/shared.d.ts +11 -0
- package/dist/src/cli/shared.d.ts.map +1 -1
- package/dist/src/cli/shared.js +31 -0
- package/dist/src/cli/shared.js.map +1 -1
- package/dist/src/cli.d.ts +3 -1
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +9 -1
- package/dist/src/cli.js.map +1 -1
- package/dist/src/connected-providers/billing.d.ts +6 -0
- package/dist/src/connected-providers/billing.d.ts.map +1 -0
- package/dist/src/connected-providers/billing.js +11 -0
- package/dist/src/connected-providers/billing.js.map +1 -0
- package/dist/src/connected-providers/capability-probe.d.ts +17 -0
- package/dist/src/connected-providers/capability-probe.d.ts.map +1 -0
- package/dist/src/connected-providers/capability-probe.js +92 -0
- package/dist/src/connected-providers/capability-probe.js.map +1 -0
- package/dist/src/connected-providers/fake-issuer.d.ts +61 -0
- package/dist/src/connected-providers/fake-issuer.d.ts.map +1 -0
- package/dist/src/connected-providers/fake-issuer.js +161 -0
- package/dist/src/connected-providers/fake-issuer.js.map +1 -0
- package/dist/src/connected-providers/fallback-notice.d.ts +11 -0
- package/dist/src/connected-providers/fallback-notice.d.ts.map +1 -0
- package/dist/src/connected-providers/fallback-notice.js +20 -0
- package/dist/src/connected-providers/fallback-notice.js.map +1 -0
- package/dist/src/connected-providers/fallback.d.ts +11 -0
- package/dist/src/connected-providers/fallback.d.ts.map +1 -0
- package/dist/src/connected-providers/fallback.js +37 -0
- package/dist/src/connected-providers/fallback.js.map +1 -0
- package/dist/src/connected-providers/refresh.d.ts +12 -0
- package/dist/src/connected-providers/refresh.d.ts.map +1 -0
- package/dist/src/connected-providers/refresh.js +72 -0
- package/dist/src/connected-providers/refresh.js.map +1 -0
- package/dist/src/connected-providers/registry.d.ts +17 -0
- package/dist/src/connected-providers/registry.d.ts.map +1 -0
- package/dist/src/connected-providers/registry.js +30 -0
- package/dist/src/connected-providers/registry.js.map +1 -0
- package/dist/src/connected-providers/store.d.ts +41 -0
- package/dist/src/connected-providers/store.d.ts.map +1 -0
- package/dist/src/connected-providers/store.js +145 -0
- package/dist/src/connected-providers/store.js.map +1 -0
- package/dist/src/connected-providers/tokens.d.ts +42 -0
- package/dist/src/connected-providers/tokens.d.ts.map +1 -0
- package/dist/src/connected-providers/tokens.js +148 -0
- package/dist/src/connected-providers/tokens.js.map +1 -0
- package/dist/src/connected-providers/transport-preference.d.ts +26 -0
- package/dist/src/connected-providers/transport-preference.d.ts.map +1 -0
- package/dist/src/connected-providers/transport-preference.js +42 -0
- package/dist/src/connected-providers/transport-preference.js.map +1 -0
- 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/file-lock.d.ts +22 -0
- package/dist/src/file-lock.d.ts.map +1 -0
- package/dist/src/file-lock.js +69 -0
- package/dist/src/file-lock.js.map +1 -0
- package/dist/src/model-resolution/catalog.d.ts +24 -10
- package/dist/src/model-resolution/catalog.d.ts.map +1 -1
- package/dist/src/model-resolution/catalog.js +61 -36
- package/dist/src/model-resolution/catalog.js.map +1 -1
- package/dist/src/model-resolution/duet-gateway.d.ts +2 -0
- package/dist/src/model-resolution/duet-gateway.d.ts.map +1 -1
- package/dist/src/model-resolution/duet-gateway.js +57 -4
- package/dist/src/model-resolution/duet-gateway.js.map +1 -1
- package/dist/src/model-resolution/resolver.d.ts +17 -0
- package/dist/src/model-resolution/resolver.d.ts.map +1 -1
- package/dist/src/model-resolution/resolver.js +49 -4
- package/dist/src/model-resolution/resolver.js.map +1 -1
- package/dist/src/model-routing/table.js +18 -18
- package/dist/src/model-routing/table.js.map +1 -1
- package/dist/src/session/session.d.ts.map +1 -1
- package/dist/src/session/session.js +8 -5
- package/dist/src/session/session.js.map +1 -1
- package/dist/src/tui/sidebar.d.ts.map +1 -1
- package/dist/src/tui/sidebar.js +40 -1
- package/dist/src/tui/sidebar.js.map +1 -1
- package/dist/src/turn-runner/agent-events.d.ts +2 -0
- package/dist/src/turn-runner/agent-events.d.ts.map +1 -1
- package/dist/src/turn-runner/agent-events.js +11 -0
- package/dist/src/turn-runner/agent-events.js.map +1 -1
- package/dist/src/turn-runner/subagent.d.ts +4 -1
- package/dist/src/turn-runner/subagent.d.ts.map +1 -1
- package/dist/src/turn-runner/subagent.js +11 -3
- package/dist/src/turn-runner/subagent.js.map +1 -1
- package/dist/src/turn-runner/turn-runner.d.ts +4 -1
- package/dist/src/turn-runner/turn-runner.d.ts.map +1 -1
- package/dist/src/turn-runner/turn-runner.js +74 -19
- package/dist/src/turn-runner/turn-runner.js.map +1 -1
- package/dist/src/turn-runner/usage-accounting.d.ts +5 -2
- package/dist/src/turn-runner/usage-accounting.d.ts.map +1 -1
- package/dist/src/turn-runner/usage-accounting.js +18 -6
- package/dist/src/turn-runner/usage-accounting.js.map +1 -1
- package/dist/src/types/protocol.d.ts +11 -3
- package/dist/src/types/protocol.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { closeSync, openSync, readFileSync, statSync, unlinkSync, writeSync } from "node:fs";
|
|
2
|
+
/** Locks older than this are assumed to belong to a terminated process. */
|
|
3
|
+
export const DEFAULT_STALE_LOCK_MS = 10 * 60 * 1000;
|
|
4
|
+
/**
|
|
5
|
+
* Try once to own an advisory lock file, reclaiming one stale lock if needed.
|
|
6
|
+
* Callers that require waiting retry this primitive on their own budget.
|
|
7
|
+
*/
|
|
8
|
+
export function acquireFileLock(lockPath, options = {}) {
|
|
9
|
+
const now = options.now ?? Date.now();
|
|
10
|
+
const staleAfterMs = options.staleAfterMs ?? DEFAULT_STALE_LOCK_MS;
|
|
11
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
12
|
+
try {
|
|
13
|
+
const fd = openSync(lockPath, "wx");
|
|
14
|
+
writeSync(fd, JSON.stringify({ pid: process.pid, startedAt: now }));
|
|
15
|
+
return { fd, lockPath };
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
if (!hasCode(error, "EEXIST"))
|
|
19
|
+
return null;
|
|
20
|
+
if (!isStaleLock(lockPath, now, staleAfterMs))
|
|
21
|
+
return null;
|
|
22
|
+
try {
|
|
23
|
+
unlinkSync(lockPath);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
/** Close and remove a lock. Release is best-effort so cleanup cannot mask the protected result. */
|
|
33
|
+
export function releaseFileLock(handle) {
|
|
34
|
+
try {
|
|
35
|
+
closeSync(handle.fd);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// The descriptor may already be closed after an interrupted operation.
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
unlinkSync(handle.lockPath);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// A missing lock is already released.
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function isStaleLock(lockPath, now, staleAfterMs) {
|
|
48
|
+
try {
|
|
49
|
+
const payload = JSON.parse(readFileSync(lockPath, "utf8"));
|
|
50
|
+
if (typeof payload.startedAt === "number")
|
|
51
|
+
return now - payload.startedAt > staleAfterMs;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// Fall through to the mtime check: an unreadable payload may be a holder
|
|
55
|
+
// caught between creating the file and writing it, not a dead process.
|
|
56
|
+
}
|
|
57
|
+
// Unreadable or payload-free locks go stale by file age, never instantly —
|
|
58
|
+
// reclaiming a lock mid-write would let two writers race the store.
|
|
59
|
+
try {
|
|
60
|
+
return now - statSync(lockPath).mtimeMs > staleAfterMs;
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function hasCode(error, code) {
|
|
67
|
+
return error instanceof Error && "code" in error && error.code === code;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=file-lock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-lock.js","sourceRoot":"","sources":["../../src/file-lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE7F,2EAA2E;AAC3E,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAqBpD;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAgB,EAChB,UAAkC,EAAE;IAEpC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;IACtC,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,qBAAqB,CAAC;IACnE,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,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AQ;YAAE,OAAO,GAAG,GAAG,OAAO,CAAC,SAAS,GAAG,YAAY,CAAC;IAC3F,CAAC;IAAC,MAAM,CAAC;QACP,yEAAyE;QACzE,uEAAuE;IACzE,CAAC;IACD,2EAA2E;IAC3E,oEAAoE;IACpE,IAAI,CAAC;QACH,OAAO,GAAG,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC,OAAO,GAAG,YAAY,CAAC;IACzD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,SAAS,OAAO,CAAC,KAAc,EAAE,IAAY;IAC3C,OAAO,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC;AAC1E,CAAC"}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ConnectedProviderId } from "../connected-providers/store.js";
|
|
2
|
+
/** Metered providers considered by the router when resolving an unpinned model. */
|
|
3
|
+
export type RouterProviderName = "duet-gateway" | "vercel-ai-gateway" | "openrouter";
|
|
4
|
+
/** Any backend capable of carrying a curated catalog model. */
|
|
5
|
+
export type TransportName = RouterProviderName | ConnectedProviderId;
|
|
6
|
+
/** Versionless model families accepted anywhere a curated shorthand is accepted. */
|
|
7
|
+
export type FamilyName = "fable" | "opus" | "sonnet" | "haiku" | "sol" | "terra" | "luna" | "kimi" | "grok" | "deepseek" | "glm";
|
|
2
8
|
export interface ProviderPreference {
|
|
3
9
|
/** Provider identifier accepted by pi-ai or handled locally by model resolution. */
|
|
4
|
-
provider:
|
|
10
|
+
provider: RouterProviderName;
|
|
5
11
|
/** Env var override for providers whose credential is not discoverable through pi-ai. */
|
|
6
12
|
customEnvVar?: () => string | null;
|
|
7
13
|
}
|
|
8
14
|
export interface ProviderModelCandidate {
|
|
9
15
|
/** Provider that supports the candidate model. */
|
|
10
|
-
provider:
|
|
16
|
+
provider: RouterProviderName;
|
|
11
17
|
/** Fully resolved provider:modelId string passed to the runtime model loader. */
|
|
12
18
|
modelName: string;
|
|
13
19
|
}
|
|
@@ -19,6 +25,10 @@ export declare const DEFAULT_CLI_MEMORY_MODEL = "gpt-5.6-luna";
|
|
|
19
25
|
* AI_GATEWAY_API_KEY for the gateway transport.
|
|
20
26
|
*/
|
|
21
27
|
export declare const PROVIDER_ORDER: readonly ProviderPreference[];
|
|
28
|
+
/** Latest shorthand for each family, derived from the first matching catalog entry. */
|
|
29
|
+
export declare const FAMILY_LATEST: Readonly<Record<FamilyName, string>>;
|
|
30
|
+
/** Resolve a versionless family name to the first versioned shorthand in catalog order. */
|
|
31
|
+
export declare function resolveFamilyShorthand(name: string): string | undefined;
|
|
22
32
|
export declare function isProviderPinnedModelName(modelName: string): boolean;
|
|
23
33
|
/**
|
|
24
34
|
* Clamp a resolved model's output-token ceiling to the catalog's
|
|
@@ -30,28 +40,32 @@ export declare function clampModelOutputTokens<T extends {
|
|
|
30
40
|
id: string;
|
|
31
41
|
maxTokens: number;
|
|
32
42
|
}>(model: T): T;
|
|
33
|
-
export declare function getProviderDefaultModel(provider:
|
|
34
|
-
export declare function getProviderMemoryModel(provider:
|
|
43
|
+
export declare function getProviderDefaultModel(provider: RouterProviderName): string;
|
|
44
|
+
export declare function getProviderMemoryModel(provider: RouterProviderName): string;
|
|
35
45
|
export declare function getModelCandidates(modelName: string): readonly ProviderModelCandidate[];
|
|
36
46
|
export declare function isKnownShorthand(modelName: string): boolean;
|
|
37
47
|
export declare function canonicalizeModelName(modelName: string): string;
|
|
48
|
+
/** Resolve a curated shorthand or alias to the id served by a specific transport. */
|
|
49
|
+
export declare function transportModelId(transport: TransportName, shorthand: string): string | undefined;
|
|
50
|
+
/** Recover the curated shorthand represented by a transport-specific model id. */
|
|
51
|
+
export declare function shorthandForTransportModel(transport: TransportName, modelId: string): string | undefined;
|
|
38
52
|
/**
|
|
39
53
|
* Normalize a `provider:modelId` model id against catalog aliases so users can
|
|
40
54
|
* pass familiar variants like `claude-opus-4-7` even when the underlying
|
|
41
55
|
* provider catalog spells it `claude-opus-4.7`. Falls back to the input id
|
|
42
56
|
* when no alias matches so unknown ids reach the provider lookup unchanged.
|
|
43
57
|
*/
|
|
44
|
-
export declare function canonicalizeProviderModelId(provider:
|
|
58
|
+
export declare function canonicalizeProviderModelId(provider: RouterProviderName, modelId: string): string;
|
|
45
59
|
/**
|
|
46
60
|
* Map user-friendly provider names (and common aliases) onto the canonical
|
|
47
|
-
* `
|
|
61
|
+
* `RouterProviderName`. Returns `undefined` for unknown values so callers can
|
|
48
62
|
* surface a list of accepted names.
|
|
49
63
|
*/
|
|
50
|
-
export declare function resolveProviderShorthand(name: string):
|
|
64
|
+
export declare function resolveProviderShorthand(name: string): RouterProviderName | undefined;
|
|
51
65
|
/** Names accepted by `--provider`, in canonical order, for help and errors. */
|
|
52
66
|
export declare const PROVIDER_SHORTHANDS: readonly string[];
|
|
53
67
|
/** Build a `provider:modelId` reference for a provider's default chat model. */
|
|
54
|
-
export declare function pinnedDefaultModel(provider:
|
|
68
|
+
export declare function pinnedDefaultModel(provider: RouterProviderName): string;
|
|
55
69
|
/** Build a `provider:modelId` reference for a provider's memory model. */
|
|
56
|
-
export declare function pinnedMemoryModel(provider:
|
|
70
|
+
export declare function pinnedMemoryModel(provider: RouterProviderName): string;
|
|
57
71
|
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/model-resolution/catalog.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/model-resolution/catalog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,mFAAmF;AACnF,MAAM,MAAM,kBAAkB,GAAG,cAAc,GAAG,mBAAmB,GAAG,YAAY,CAAC;AAErF,+DAA+D;AAC/D,MAAM,MAAM,aAAa,GAAG,k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B,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEhG;AAED,kFAAkF;AAClF,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAGpB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAIjG;AAYD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAerF;AAED,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAAqC,CAAC;AAEvF,gFAAgF;AAChF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,CAEvE;AAED,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,CAEtE"}
|
|
@@ -25,12 +25,13 @@ const MEMORY_MODEL_BY_PROVIDER = {
|
|
|
25
25
|
// gpt-5.6-luna has no OpenRouter route: pi-ai's catalog does not ship it, so
|
|
26
26
|
// `openrouter:openai/gpt-5.6-luna` resolves to undefined (unlike the
|
|
27
27
|
// duet/vercel gateway routes, which synthesize an openai-responses
|
|
28
|
-
// passthrough). Keep OPENROUTER_API_KEY-only users on
|
|
29
|
-
//
|
|
30
|
-
openrouter: "
|
|
28
|
+
// passthrough). Keep OPENROUTER_API_KEY-only users on haiku-4.5, which pi-ai
|
|
29
|
+
// ships directly, until pi-ai adds luna.
|
|
30
|
+
openrouter: "haiku-4.5",
|
|
31
31
|
};
|
|
32
32
|
const MODEL_DEFINITIONS = [
|
|
33
33
|
{
|
|
34
|
+
family: "opus",
|
|
34
35
|
shorthand: "opus-4.8",
|
|
35
36
|
aliases: [
|
|
36
37
|
"claude-opus-4.8",
|
|
@@ -42,9 +43,11 @@ const MODEL_DEFINITIONS = [
|
|
|
42
43
|
"duet-gateway": "anthropic/claude-opus-4.8",
|
|
43
44
|
"vercel-ai-gateway": "anthropic/claude-opus-4.8",
|
|
44
45
|
openrouter: "anthropic/claude-opus-4.8",
|
|
46
|
+
"github-copilot": "claude-opus-4.8",
|
|
45
47
|
},
|
|
46
48
|
},
|
|
47
49
|
{
|
|
50
|
+
family: "opus",
|
|
48
51
|
shorthand: "opus-4.7",
|
|
49
52
|
aliases: [
|
|
50
53
|
"claude-opus-4.7",
|
|
@@ -56,6 +59,7 @@ const MODEL_DEFINITIONS = [
|
|
|
56
59
|
"duet-gateway": "anthropic/claude-opus-4.7",
|
|
57
60
|
"vercel-ai-gateway": "anthropic/claude-opus-4.7",
|
|
58
61
|
openrouter: "anthropic/claude-opus-4.7",
|
|
62
|
+
"github-copilot": "claude-opus-4.7",
|
|
59
63
|
},
|
|
60
64
|
},
|
|
61
65
|
{
|
|
@@ -68,6 +72,7 @@ const MODEL_DEFINITIONS = [
|
|
|
68
72
|
// listed because the clone backs `vercel-ai-gateway` (which `duet-gateway`
|
|
69
73
|
// resolves through); add the anthropic/openrouter routes once pi-ai ships
|
|
70
74
|
// them so a pinned resolve does not fall through to an undefined model.
|
|
75
|
+
family: "sonnet",
|
|
71
76
|
shorthand: "sonnet-5",
|
|
72
77
|
aliases: ["claude-sonnet-5", "anthropic/claude-sonnet-5"],
|
|
73
78
|
modelsByProvider: {
|
|
@@ -76,6 +81,7 @@ const MODEL_DEFINITIONS = [
|
|
|
76
81
|
},
|
|
77
82
|
},
|
|
78
83
|
{
|
|
84
|
+
family: "sonnet",
|
|
79
85
|
shorthand: "sonnet-4.6",
|
|
80
86
|
aliases: [
|
|
81
87
|
"claude-sonnet-4.6",
|
|
@@ -87,9 +93,11 @@ const MODEL_DEFINITIONS = [
|
|
|
87
93
|
"duet-gateway": "anthropic/claude-sonnet-4.6",
|
|
88
94
|
"vercel-ai-gateway": "anthropic/claude-sonnet-4.6",
|
|
89
95
|
openrouter: "anthropic/claude-sonnet-4.6",
|
|
96
|
+
"github-copilot": "claude-sonnet-4.6",
|
|
90
97
|
},
|
|
91
98
|
},
|
|
92
99
|
{
|
|
100
|
+
family: "haiku",
|
|
93
101
|
shorthand: "haiku-4.5",
|
|
94
102
|
aliases: [
|
|
95
103
|
"claude-haiku-4.5",
|
|
@@ -101,24 +109,7 @@ const MODEL_DEFINITIONS = [
|
|
|
101
109
|
"duet-gateway": "anthropic/claude-haiku-4.5",
|
|
102
110
|
"vercel-ai-gateway": "anthropic/claude-haiku-4.5",
|
|
103
111
|
openrouter: "anthropic/claude-haiku-4.5",
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
shorthand: "gpt-5.5",
|
|
108
|
-
aliases: ["openai/gpt-5.5", "openai/gpt-5-5"],
|
|
109
|
-
modelsByProvider: {
|
|
110
|
-
"duet-gateway": "openai/gpt-5.5",
|
|
111
|
-
"vercel-ai-gateway": "openai/gpt-5.5",
|
|
112
|
-
openrouter: "openai/gpt-5.5",
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
shorthand: "gpt-5.4-mini",
|
|
117
|
-
aliases: ["openai/gpt-5.4-mini", "openai/gpt-5-4-mini"],
|
|
118
|
-
modelsByProvider: {
|
|
119
|
-
"duet-gateway": "openai/gpt-5.4-mini",
|
|
120
|
-
"vercel-ai-gateway": "openai/gpt-5.4-mini",
|
|
121
|
-
openrouter: "openai/gpt-5.4-mini",
|
|
112
|
+
"github-copilot": "claude-haiku-4.5",
|
|
122
113
|
},
|
|
123
114
|
},
|
|
124
115
|
{
|
|
@@ -129,36 +120,43 @@ const MODEL_DEFINITIONS = [
|
|
|
129
120
|
// duet-gateway.ts) so its low reasoning effort survives to the wire. pi-ai's
|
|
130
121
|
// catalog does not ship luna, so the `openrouter:openai/gpt-5.6-luna` route
|
|
131
122
|
// would resolve to an undefined model; it is intentionally omitted until
|
|
132
|
-
// pi-ai adds it, and OPENROUTER-only users stay on
|
|
123
|
+
// pi-ai adds it, and OPENROUTER-only users stay on haiku-4.5 (see
|
|
133
124
|
// MEMORY_MODEL_BY_PROVIDER).
|
|
125
|
+
family: "luna",
|
|
134
126
|
shorthand: "gpt-5.6-luna",
|
|
135
127
|
aliases: ["openai/gpt-5.6-luna", "openai/gpt-5-6-luna"],
|
|
136
128
|
modelsByProvider: {
|
|
137
129
|
"duet-gateway": "openai/gpt-5.6-luna",
|
|
138
130
|
"vercel-ai-gateway": "openai/gpt-5.6-luna",
|
|
131
|
+
"openai-codex": "gpt-5.6-luna",
|
|
139
132
|
},
|
|
140
133
|
},
|
|
141
134
|
{
|
|
135
|
+
family: "sol",
|
|
142
136
|
shorthand: "gpt-5.6-sol",
|
|
143
137
|
aliases: ["openai/gpt-5.6-sol", "openai/gpt-5-6-sol"],
|
|
144
138
|
modelsByProvider: {
|
|
145
139
|
"duet-gateway": "openai/gpt-5.6-sol",
|
|
146
140
|
"vercel-ai-gateway": "openai/gpt-5.6-sol",
|
|
147
141
|
openrouter: "openai/gpt-5.6-sol",
|
|
142
|
+
"openai-codex": "gpt-5.6-sol",
|
|
148
143
|
},
|
|
149
144
|
maxOutputTokens: 128000,
|
|
150
145
|
},
|
|
151
146
|
{
|
|
147
|
+
family: "terra",
|
|
152
148
|
shorthand: "gpt-5.6-terra",
|
|
153
149
|
aliases: ["openai/gpt-5.6-terra", "openai/gpt-5-6-terra"],
|
|
154
150
|
modelsByProvider: {
|
|
155
151
|
"duet-gateway": "openai/gpt-5.6-terra",
|
|
156
152
|
"vercel-ai-gateway": "openai/gpt-5.6-terra",
|
|
157
153
|
openrouter: "openai/gpt-5.6-terra",
|
|
154
|
+
"openai-codex": "gpt-5.6-terra",
|
|
158
155
|
},
|
|
159
156
|
maxOutputTokens: 128000,
|
|
160
157
|
},
|
|
161
158
|
{
|
|
159
|
+
family: "kimi",
|
|
162
160
|
shorthand: "kimi-k3",
|
|
163
161
|
aliases: ["moonshotai/kimi-k3"],
|
|
164
162
|
modelsByProvider: {
|
|
@@ -173,6 +171,7 @@ const MODEL_DEFINITIONS = [
|
|
|
173
171
|
// xAI's Grok 4.3 is routed through the duet/vercel gateways under the
|
|
174
172
|
// `xai/grok-4.3` model id. We do not currently configure a direct xAI
|
|
175
173
|
// provider, so the gateway entries are the only routes.
|
|
174
|
+
family: "grok",
|
|
176
175
|
shorthand: "grok-4.3",
|
|
177
176
|
aliases: ["xai/grok-4.3", "xai/grok-4-3", "grok-4-3"],
|
|
178
177
|
modelsByProvider: {
|
|
@@ -186,6 +185,7 @@ const MODEL_DEFINITIONS = [
|
|
|
186
185
|
// under the shared `deepseek/deepseek-v4-pro` model id. We do not configure
|
|
187
186
|
// a direct DeepSeek provider, so the gateway and OpenRouter entries are the
|
|
188
187
|
// only routes.
|
|
188
|
+
family: "deepseek",
|
|
189
189
|
shorthand: "deepseek-v4-pro",
|
|
190
190
|
aliases: ["deepseek/deepseek-v4-pro"],
|
|
191
191
|
modelsByProvider: {
|
|
@@ -202,30 +202,21 @@ const MODEL_DEFINITIONS = [
|
|
|
202
202
|
// provider. pi-ai's catalog does not ship it yet, so resolution clones the
|
|
203
203
|
// Opus 4.8 entry (identical anthropic-messages transport, 1M context, 128k
|
|
204
204
|
// output cap) until it does; see `resolveMissingModel` in duet-gateway.ts.
|
|
205
|
+
family: "fable",
|
|
205
206
|
shorthand: "fable-5",
|
|
206
207
|
aliases: ["claude-fable-5", "anthropic/claude-fable-5"],
|
|
207
208
|
modelsByProvider: {
|
|
208
209
|
"duet-gateway": "anthropic/claude-fable-5",
|
|
209
210
|
"vercel-ai-gateway": "anthropic/claude-fable-5",
|
|
210
211
|
openrouter: "anthropic/claude-fable-5",
|
|
211
|
-
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
// Zhipu's GLM 4.7 is routed through the duet/vercel gateways under the
|
|
215
|
-
// `zai/glm-4.7` model id and through OpenRouter as `z-ai/glm-4.7`. We do not
|
|
216
|
-
// configure a direct Zhipu provider, so these are the only routes.
|
|
217
|
-
shorthand: "glm-4.7",
|
|
218
|
-
aliases: ["zai/glm-4.7", "z-ai/glm-4.7", "glm-4-7"],
|
|
219
|
-
modelsByProvider: {
|
|
220
|
-
"duet-gateway": "zai/glm-4.7",
|
|
221
|
-
"vercel-ai-gateway": "zai/glm-4.7",
|
|
222
|
-
openrouter: "z-ai/glm-4.7",
|
|
212
|
+
"github-copilot": "claude-fable-5",
|
|
223
213
|
},
|
|
224
214
|
},
|
|
225
215
|
{
|
|
226
216
|
// Zhipu's GLM 5.2 is routed through the duet/vercel gateways under the
|
|
227
217
|
// `zai/glm-5.2` model id and through OpenRouter as `z-ai/glm-5.2`. We do not
|
|
228
218
|
// configure a direct Zhipu provider, so these are the only routes.
|
|
219
|
+
family: "glm",
|
|
229
220
|
shorthand: "glm-5.2",
|
|
230
221
|
aliases: ["zai/glm-5.2", "z-ai/glm-5.2", "glm-5-2"],
|
|
231
222
|
modelsByProvider: {
|
|
@@ -234,7 +225,30 @@ const MODEL_DEFINITIONS = [
|
|
|
234
225
|
openrouter: "z-ai/glm-5.2",
|
|
235
226
|
},
|
|
236
227
|
},
|
|
228
|
+
{
|
|
229
|
+
// Zhipu's GLM 4.7 is routed through the duet/vercel gateways under the
|
|
230
|
+
// `zai/glm-4.7` model id and through OpenRouter as `z-ai/glm-4.7`. We do not
|
|
231
|
+
// configure a direct Zhipu provider, so these are the only routes.
|
|
232
|
+
family: "glm",
|
|
233
|
+
shorthand: "glm-4.7",
|
|
234
|
+
aliases: ["zai/glm-4.7", "z-ai/glm-4.7", "glm-4-7"],
|
|
235
|
+
modelsByProvider: {
|
|
236
|
+
"duet-gateway": "zai/glm-4.7",
|
|
237
|
+
"vercel-ai-gateway": "zai/glm-4.7",
|
|
238
|
+
openrouter: "z-ai/glm-4.7",
|
|
239
|
+
},
|
|
240
|
+
},
|
|
237
241
|
];
|
|
242
|
+
const familyLatest = {};
|
|
243
|
+
for (const definition of MODEL_DEFINITIONS) {
|
|
244
|
+
familyLatest[definition.family] ??= definition.shorthand;
|
|
245
|
+
}
|
|
246
|
+
/** Latest shorthand for each family, derived from the first matching catalog entry. */
|
|
247
|
+
export const FAMILY_LATEST = Object.freeze(familyLatest);
|
|
248
|
+
/** Resolve a versionless family name to the first versioned shorthand in catalog order. */
|
|
249
|
+
export function resolveFamilyShorthand(name) {
|
|
250
|
+
return FAMILY_LATEST[name.trim().toLowerCase()];
|
|
251
|
+
}
|
|
238
252
|
export function isProviderPinnedModelName(modelName) {
|
|
239
253
|
return modelName.includes(":");
|
|
240
254
|
}
|
|
@@ -276,6 +290,15 @@ export function isKnownShorthand(modelName) {
|
|
|
276
290
|
export function canonicalizeModelName(modelName) {
|
|
277
291
|
return findModelDefinition(modelName)?.shorthand ?? modelName;
|
|
278
292
|
}
|
|
293
|
+
/** Resolve a curated shorthand or alias to the id served by a specific transport. */
|
|
294
|
+
export function transportModelId(transport, shorthand) {
|
|
295
|
+
return findModelDefinition(shorthand)?.modelsByProvider[transport];
|
|
296
|
+
}
|
|
297
|
+
/** Recover the curated shorthand represented by a transport-specific model id. */
|
|
298
|
+
export function shorthandForTransportModel(transport, modelId) {
|
|
299
|
+
return MODEL_DEFINITIONS.find((definition) => definition.modelsByProvider[transport] === modelId)
|
|
300
|
+
?.shorthand;
|
|
301
|
+
}
|
|
279
302
|
/**
|
|
280
303
|
* Normalize a `provider:modelId` model id against catalog aliases so users can
|
|
281
304
|
* pass familiar variants like `claude-opus-4-7` even when the underlying
|
|
@@ -290,11 +313,13 @@ export function canonicalizeProviderModelId(provider, modelId) {
|
|
|
290
313
|
}
|
|
291
314
|
function findModelDefinition(modelName) {
|
|
292
315
|
const normalized = modelName.toLowerCase();
|
|
293
|
-
|
|
316
|
+
const familyShorthand = resolveFamilyShorthand(normalized);
|
|
317
|
+
return MODEL_DEFINITIONS.find((definition) => definition.shorthand === (familyShorthand ?? normalized) ||
|
|
318
|
+
definition.aliases.includes(normalized));
|
|
294
319
|
}
|
|
295
320
|
/**
|
|
296
321
|
* Map user-friendly provider names (and common aliases) onto the canonical
|
|
297
|
-
* `
|
|
322
|
+
* `RouterProviderName`. Returns `undefined` for unknown values so callers can
|
|
298
323
|
* surface a list of accepted names.
|
|
299
324
|
*/
|
|
300
325
|
export function resolveProviderShorthand(name) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../../src/model-resolution/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../../src/model-resolution/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAqD7D,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAC5C,MAAM,CAAC,MAAM,wBAAwB,GAAG,cAAc,CAAC;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkC;IAC3D;QACE,QAAQ,EAAE,cAAc;QACxB,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,IAAI,CAAC;KAC9F;IACD,EAAE,QAAQ,EAAE,mBAAmB,EAAE;IACjC,EAAE,QAAQ,EAAE,YAAY,EAAE;CAC3B,CAAC;AAEF,MAAM,yBAAyB,GAAuC;IACpE,cAAc,EAAE,iBAAiB;IACjC,mBAAmB,EAAE,iBAAiB;IACtC,UAAU,EAAE,iBAAiB;CAC9B,CAAC;AAEF,MAAM,wBAAwB,GAAuC;IACnE,cAAc,EAAE,wBAAwB;IACxC,mBAAmB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C,MAAM,mBAAmB,GAAsB,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;AAEvF,gFAAgF;AAChF,MAAM,UAAU,kBAAkB,CAAC,QAA4B;IAC7D,OAAO,eAAe,CAAC,QAAQ,EAAE,uBAAuB,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtE,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,iBAAiB,CAAC,QAA4B;IAC5D,OAAO,eAAe,CAAC,QAAQ,EAAE,sBAAsB,CAAC,QAAQ,CAAC,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,eAAe,CAAC,QAA4B,EAAE,SAAiB;IACtE,MAAM,SAAS,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;IAC7F,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,YAAY,QAAQ,6BAA6B,SAAS,EAAE,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,SAAS,CAAC,SAAS,CAAC;AAC7B,CAAC"}
|
|
@@ -32,6 +32,8 @@ export declare function getDuetGatewayBaseUrl(): string;
|
|
|
32
32
|
* set for explicit `vercel-ai-gateway:*` pins.
|
|
33
33
|
*/
|
|
34
34
|
export declare function resolveDuetGatewayModel(modelId: string): Model<any>;
|
|
35
|
+
/** Apply gateway capabilities that are newer than the pinned model catalog. */
|
|
36
|
+
export declare function applyVercelGatewayModelOverrides(modelId: string, model: Model<any>): Model<any>;
|
|
35
37
|
/**
|
|
36
38
|
* Clone a known sibling on the same provider to build a Model pi-ai has not
|
|
37
39
|
* shipped yet; returns undefined when the provider/modelId pair is not a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duet-gateway.d.ts","sourceRoot":"","sources":["../../../src/model-resolution/duet-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,KAAK,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"duet-gateway.d.ts","sourceRoot":"","sources":["../../../src/model-resolution/duet-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAuE3E;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,wBAAwB,iBAAiB,CAAC;AACvD,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AAEjE,wBAAgB,qBAAqB,IAAI,MAAM,CAI9C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CASnE;AAuBD,+EAA+E;AAC/E,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAY/F;AAmGD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAY7F;AA4CD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAU1E"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { getEnvApiKey, getModel } from "@earendil-works/pi-ai";
|
|
2
|
+
import { isConnectedProviderId } from "../connected-providers/store.js";
|
|
3
|
+
import { connectedProviderApiKey, refreshConnectedTokenInBackground, } from "../connected-providers/tokens.js";
|
|
2
4
|
const DEFAULT_DUET_GATEWAY_BASE_URL = "https://gateway.duet.so";
|
|
3
5
|
const OPENAI_MODEL_PREFIX = "openai/";
|
|
4
6
|
const VERCEL_GATEWAY_BASE_URL = "https://ai-gateway.vercel.sh";
|
|
@@ -27,6 +29,15 @@ const OPENAI_GATEWAY_MODEL_OVERRIDES = {
|
|
|
27
29
|
cost: { input: 1, output: 6, cacheRead: 0.1, cacheWrite: 1.25 },
|
|
28
30
|
},
|
|
29
31
|
};
|
|
32
|
+
// Vercel exposes GLM 5.2's maximum reasoning mode, but the pinned pi-ai
|
|
33
|
+
// catalog does not yet describe it. Keep the product-level `xhigh` setting
|
|
34
|
+
// wire-faithful until that metadata ships upstream.
|
|
35
|
+
const VERCEL_GATEWAY_MODEL_OVERRIDES = {
|
|
36
|
+
"zai/glm-5.2": {
|
|
37
|
+
thinkingLevelMap: { xhigh: "max" },
|
|
38
|
+
compat: { forceAdaptiveThinking: true },
|
|
39
|
+
},
|
|
40
|
+
};
|
|
30
41
|
const KIMI_K3_CAPABILITIES = {
|
|
31
42
|
input: ["text", "image"],
|
|
32
43
|
contextWindow: 1_000_000,
|
|
@@ -103,9 +114,25 @@ function resolveDuetGatewayUpstream(modelId) {
|
|
|
103
114
|
if (modelId.startsWith(OPENAI_MODEL_PREFIX)) {
|
|
104
115
|
return resolveOpenAIResponsesModel(modelId);
|
|
105
116
|
}
|
|
106
|
-
|
|
117
|
+
const upstream = getModel("vercel-ai-gateway", modelId) ??
|
|
107
118
|
resolveMissingModel("vercel-ai-gateway", modelId) ??
|
|
108
|
-
synthesizePassthroughModel(modelId, "anthropic-messages")
|
|
119
|
+
synthesizePassthroughModel(modelId, "anthropic-messages");
|
|
120
|
+
return applyVercelGatewayModelOverrides(modelId, upstream);
|
|
121
|
+
}
|
|
122
|
+
/** Apply gateway capabilities that are newer than the pinned model catalog. */
|
|
123
|
+
export function applyVercelGatewayModelOverrides(modelId, model) {
|
|
124
|
+
const overrides = VERCEL_GATEWAY_MODEL_OVERRIDES[modelId];
|
|
125
|
+
if (!overrides)
|
|
126
|
+
return model;
|
|
127
|
+
return {
|
|
128
|
+
...model,
|
|
129
|
+
...overrides,
|
|
130
|
+
thinkingLevelMap: {
|
|
131
|
+
...model.thinkingLevelMap,
|
|
132
|
+
...overrides.thinkingLevelMap,
|
|
133
|
+
},
|
|
134
|
+
compat: { ...model.compat, ...overrides.compat },
|
|
135
|
+
};
|
|
109
136
|
}
|
|
110
137
|
/**
|
|
111
138
|
* Build a minimal spec for a gateway model pi-ai's catalog has not shipped yet.
|
|
@@ -138,6 +165,26 @@ function synthesizePassthroughModel(modelId, api) {
|
|
|
138
165
|
* moment pi-ai ships that provider/model pair.
|
|
139
166
|
*/
|
|
140
167
|
const MISSING_MODEL_CLONES = {
|
|
168
|
+
"openai-codex": [
|
|
169
|
+
{
|
|
170
|
+
// Drop once pi-ai ships openai-codex:gpt-5.6-sol.
|
|
171
|
+
from: "gpt-5.5",
|
|
172
|
+
to: "gpt-5.6-sol",
|
|
173
|
+
overrides: OPENAI_GATEWAY_MODEL_OVERRIDES["openai/gpt-5.6-sol"],
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
// Drop once pi-ai ships openai-codex:gpt-5.6-terra.
|
|
177
|
+
from: "gpt-5.5",
|
|
178
|
+
to: "gpt-5.6-terra",
|
|
179
|
+
overrides: OPENAI_GATEWAY_MODEL_OVERRIDES["openai/gpt-5.6-terra"],
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
// Drop once pi-ai ships openai-codex:gpt-5.6-luna.
|
|
183
|
+
from: "gpt-5.5",
|
|
184
|
+
to: "gpt-5.6-luna",
|
|
185
|
+
overrides: OPENAI_GATEWAY_MODEL_OVERRIDES["openai/gpt-5.6-luna"],
|
|
186
|
+
},
|
|
187
|
+
],
|
|
141
188
|
"vercel-ai-gateway": [
|
|
142
189
|
{ from: "anthropic/claude-opus-4.8", to: "anthropic/claude-fable-5", overrides: FABLE_5_COST },
|
|
143
190
|
{
|
|
@@ -161,12 +208,12 @@ const MISSING_MODEL_CLONES = {
|
|
|
161
208
|
overrides: KIMI_K3_CAPABILITIES,
|
|
162
209
|
},
|
|
163
210
|
{
|
|
164
|
-
from: "openai/gpt-5.
|
|
211
|
+
from: "openai/gpt-5.4",
|
|
165
212
|
to: "openai/gpt-5.6-sol",
|
|
166
213
|
overrides: OPENAI_GATEWAY_MODEL_OVERRIDES["openai/gpt-5.6-sol"],
|
|
167
214
|
},
|
|
168
215
|
{
|
|
169
|
-
from: "openai/gpt-5.
|
|
216
|
+
from: "openai/gpt-5.4",
|
|
170
217
|
to: "openai/gpt-5.6-terra",
|
|
171
218
|
overrides: OPENAI_GATEWAY_MODEL_OVERRIDES["openai/gpt-5.6-terra"],
|
|
172
219
|
},
|
|
@@ -253,6 +300,12 @@ export function resolveProviderApiKey(provider) {
|
|
|
253
300
|
if (provider === "duet-gateway") {
|
|
254
301
|
return process.env[DUET_GATEWAY_API_KEY_ENV];
|
|
255
302
|
}
|
|
303
|
+
if (isConnectedProviderId(provider)) {
|
|
304
|
+
const token = connectedProviderApiKey(provider);
|
|
305
|
+
if (!token)
|
|
306
|
+
refreshConnectedTokenInBackground(provider);
|
|
307
|
+
return token;
|
|
308
|
+
}
|
|
256
309
|
return getEnvApiKey(provider);
|
|
257
310
|
}
|
|
258
311
|
//# sourceMappingURL=duet-gateway.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duet-gateway.js","sourceRoot":"","sources":["../../../src/model-resolution/duet-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAc,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"duet-gateway.js","sourceRoot":"","sources":["../../../src/model-resolution/duet-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAc,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EACL,uBAAuB,EACvB,iCAAiC,GAClC,MAAM,kCAAkC,CAAC;AAE1C,MAAM,6BAA6B,GAAG,yBAAyB,CAAC;AAChE,MAAM,mBAAmB,GAAG,SAAS,CAAC;AACtC,MAAM,uBAAuB,GAAG,8BAA8B,CAAC;AA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
|
1
1
|
import { type Model } from "@earendil-works/pi-ai";
|
|
2
2
|
import { type RoutingCatalogAdapter, type RoutingTable } from "../model-routing/table.js";
|
|
3
|
+
import { type RouterProviderName } from "./catalog.js";
|
|
4
|
+
import { connectedTransportSnapshot } from "../cli/shared.js";
|
|
5
|
+
import { type ConnectedProviderId } from "../connected-providers/store.js";
|
|
3
6
|
export { DEFAULT_CLI_MEMORY_MODEL, DEFAULT_CLI_MODEL } from "./catalog.js";
|
|
4
7
|
/**
|
|
5
8
|
* Resolves which provider:modelId the CLI talks to, plus the provenance for
|
|
@@ -20,10 +23,14 @@ export interface ModelResolution {
|
|
|
20
23
|
routed?: boolean;
|
|
21
24
|
}
|
|
22
25
|
export declare function resolveModelName(model: string): Model<any>;
|
|
26
|
+
/** Resolve an auxiliary actor through configured metered router order only. */
|
|
27
|
+
export declare function resolveMeteredModelName(modelName: string): Model<any>;
|
|
23
28
|
/** Shared concrete-catalog boundary used by every model-routing composition site. */
|
|
24
29
|
export declare const routingCatalogAdapter: RoutingCatalogAdapter;
|
|
25
30
|
/** Resolve a concrete catalog name to the provider-pinned reference used for model calls. */
|
|
26
31
|
export declare function pinnedModelReference(name: string): string;
|
|
32
|
+
/** Router providers whose credential env var is configured in this process. */
|
|
33
|
+
export declare function configuredRouterProviders(): RouterProviderName[];
|
|
27
34
|
/**
|
|
28
35
|
* Same selection logic as resolveCliModel, but picks each provider's cheaper
|
|
29
36
|
* observational-memory model.
|
|
@@ -34,5 +41,15 @@ export declare function resolveCliMemoryModel(memoryModelName: string | undefine
|
|
|
34
41
|
* "inferred from AI_GATEWAY_API_KEY in an env file" etc.
|
|
35
42
|
*/
|
|
36
43
|
export declare function resolveCliModel(modelName: string | undefined, dotenvKeys: Set<string>, routingTable?: RoutingTable): ModelResolution;
|
|
44
|
+
interface ConnectedModelResolutionDependencies {
|
|
45
|
+
snapshot(): ReturnType<typeof connectedTransportSnapshot>;
|
|
46
|
+
apiKey(provider: ConnectedProviderId): string | undefined;
|
|
47
|
+
applyHook<T extends {
|
|
48
|
+
id: string;
|
|
49
|
+
}>(provider: ConnectedProviderId, model: T): T | undefined;
|
|
50
|
+
refresh(provider: ConnectedProviderId): void;
|
|
51
|
+
}
|
|
52
|
+
/** Resolve an unpinned catalog name through connected plans, then router order. */
|
|
53
|
+
export declare function resolveModelReference(modelName: string, deps?: ConnectedModelResolutionDependencies): string;
|
|
37
54
|
export declare function describeModelResolution(resolution: ModelResolution): string;
|
|
38
55
|
//# sourceMappingURL=resolver.d.ts.map
|