@tangle-network/agent-interface 5.10.12 → 5.10.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.
|
@@ -94,11 +94,11 @@ export declare function harnessSupportsModel(harness: HarnessType, modelId: stri
|
|
|
94
94
|
* `openai` → `codex`, `moonshot` → `kimi-code`); `null` when any router-backed harness will do. */
|
|
95
95
|
export declare function preferredHarnessForModel(modelId: string): HarnessType | null;
|
|
96
96
|
/**
|
|
97
|
-
* Keep `modelId` when the harness can run it; otherwise return the
|
|
98
|
-
* `candidateIds
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
97
|
+
* Keep `modelId` when the harness can run it; otherwise return the first compatible id in
|
|
98
|
+
* `candidateIds`. When nothing in the candidate list fits, the original id is returned unchanged
|
|
99
|
+
* so the caller sees the incompatibility instead of a silent wrong substitution. `candidateIds` are
|
|
100
|
+
* canonical ("provider/model") ids — the caller maps its own catalog shape down to ids, keeping
|
|
101
|
+
* this layer catalog-agnostic.
|
|
102
102
|
*/
|
|
103
103
|
export declare function snapModelToHarness(harness: HarnessType, modelId: string, candidateIds: readonly string[]): string;
|
|
104
104
|
/**
|
|
@@ -41,13 +41,12 @@ export function formatSeatSpec(seat) {
|
|
|
41
41
|
* Vendor locks, before the measured {@link harnessModelExclusions}. Absent means router-backed.
|
|
42
42
|
* Claude Code and Codex run any Router model: their native vendor wire passes through for vendor
|
|
43
43
|
* models and translates others to chat completions (including images/tools; hosted tools drop).
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* {@link vendorHarness} chooses a default harness; it is not
|
|
44
|
+
* Kimi Code on a managed box writes an `openai_legacy` provider that sends chat completions to the
|
|
45
|
+
* Router, so it runs any Router model too. A caller's vendor key/login remains vendor-limited;
|
|
46
|
+
* this table does not know credentials. {@link vendorHarness} chooses a default harness; it is not
|
|
47
|
+
* a provider restriction.
|
|
47
48
|
*/
|
|
48
|
-
const harnessProviderLock = {
|
|
49
|
-
"kimi-code": ["moonshot"],
|
|
50
|
-
};
|
|
49
|
+
const harnessProviderLock = {};
|
|
51
50
|
/**
|
|
52
51
|
* The harness that natively speaks a vendor's models. A model of that vendor adopts it when the
|
|
53
52
|
* caller names no harness ({@link preferredHarnessForModel}), and a locked harness handed such a
|
|
@@ -203,35 +202,15 @@ export function preferredHarnessForModel(modelId) {
|
|
|
203
202
|
}
|
|
204
203
|
// ── Harness ↔ model snapping (catalog-aware) ─────────────────────────────────
|
|
205
204
|
/**
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
"kimi-code": [/^moonshot\//],
|
|
212
|
-
};
|
|
213
|
-
const numericDesc = new Intl.Collator(undefined, {
|
|
214
|
-
numeric: true,
|
|
215
|
-
sensitivity: "base",
|
|
216
|
-
});
|
|
217
|
-
/**
|
|
218
|
-
* Keep `modelId` when the harness can run it; otherwise return the harness's best compatible id from
|
|
219
|
-
* `candidateIds` (preferred patterns in order, highest version within a pattern). When nothing in the
|
|
220
|
-
* candidate list fits, the original id is returned unchanged so the caller sees the incompatibility
|
|
221
|
-
* instead of a silent wrong substitution. `candidateIds` are canonical ("provider/model") ids — the
|
|
222
|
-
* caller maps its own catalog shape down to ids, keeping this layer catalog-agnostic.
|
|
205
|
+
* Keep `modelId` when the harness can run it; otherwise return the first compatible id in
|
|
206
|
+
* `candidateIds`. When nothing in the candidate list fits, the original id is returned unchanged
|
|
207
|
+
* so the caller sees the incompatibility instead of a silent wrong substitution. `candidateIds` are
|
|
208
|
+
* canonical ("provider/model") ids — the caller maps its own catalog shape down to ids, keeping
|
|
209
|
+
* this layer catalog-agnostic.
|
|
223
210
|
*/
|
|
224
211
|
export function snapModelToHarness(harness, modelId, candidateIds) {
|
|
225
212
|
if (harnessSupportsModel(harness, modelId))
|
|
226
213
|
return modelId;
|
|
227
|
-
const patterns = harnessPreferredModelPatterns[harness] ?? [];
|
|
228
|
-
for (const pattern of patterns) {
|
|
229
|
-
const matches = candidateIds
|
|
230
|
-
.filter((id) => pattern.test(id))
|
|
231
|
-
.sort((a, b) => numericDesc.compare(b, a));
|
|
232
|
-
if (matches.length > 0)
|
|
233
|
-
return matches[0];
|
|
234
|
-
}
|
|
235
214
|
return candidateIds.find((id) => harnessSupportsModel(harness, id)) ?? modelId;
|
|
236
215
|
}
|
|
237
216
|
/**
|