@tangle-network/agent-interface 5.10.12 → 5.10.14

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 harness's best compatible id from
98
- * `candidateIds` (preferred patterns in order, highest version within a pattern). When nothing in the
99
- * candidate list fits, the original id is returned unchanged so the caller sees the incompatibility
100
- * instead of a silent wrong substitution. `candidateIds` are canonical ("provider/model") ids — the
101
- * caller maps its own catalog shape down to ids, keeping this layer catalog-agnostic.
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
- * A caller's vendor key/login remains vendor-limited; this table does not know credentials.
45
- * NanoClaw also routes every provider through the Router, so it has no Anthropic lock.
46
- * {@link vendorHarness} chooses a default harness; it is not a provider restriction.
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
- * Per-harness ranking patterns for {@link snapModelToHarness}, best first; within one pattern the
207
- * highest version wins (numeric-aware). Only vendor-locked harnesses need an entry — a router-backed
208
- * harness never snaps (it runs the model as-is).
209
- */
210
- const harnessPreferredModelPatterns = {
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
  /**
@@ -25,8 +25,8 @@ export declare function agentLearningFileKind(path: string): AgentLearningFileKi
25
25
  export declare const AgentLearningFileSchema: z.ZodObject<{
26
26
  path: z.ZodString;
27
27
  kind: z.ZodEnum<{
28
- fact: "fact";
29
28
  note: "note";
29
+ fact: "fact";
30
30
  preference: "preference";
31
31
  "skill-source": "skill-source";
32
32
  }>;
@@ -102,8 +102,8 @@ declare const materialSchema: z.ZodObject<{
102
102
  files: z.ZodArray<z.ZodObject<{
103
103
  path: z.ZodString;
104
104
  kind: z.ZodEnum<{
105
- fact: "fact";
106
105
  note: "note";
106
+ fact: "fact";
107
107
  preference: "preference";
108
108
  "skill-source": "skill-source";
109
109
  }>;
@@ -180,8 +180,8 @@ export declare const AgentLearningManifestSchema: z.ZodObject<{
180
180
  files: z.ZodArray<z.ZodObject<{
181
181
  path: z.ZodString;
182
182
  kind: z.ZodEnum<{
183
- fact: "fact";
184
183
  note: "note";
184
+ fact: "fact";
185
185
  preference: "preference";
186
186
  "skill-source": "skill-source";
187
187
  }>;
@@ -283,8 +283,8 @@ declare const exportMaterialSchema: z.ZodObject<{
283
283
  files: z.ZodArray<z.ZodObject<{
284
284
  path: z.ZodString;
285
285
  kind: z.ZodEnum<{
286
- fact: "fact";
287
286
  note: "note";
287
+ fact: "fact";
288
288
  preference: "preference";
289
289
  "skill-source": "skill-source";
290
290
  }>;
@@ -384,8 +384,8 @@ export declare const AgentLearningExportSchema: z.ZodObject<{
384
384
  files: z.ZodArray<z.ZodObject<{
385
385
  path: z.ZodString;
386
386
  kind: z.ZodEnum<{
387
- fact: "fact";
388
387
  note: "note";
388
+ fact: "fact";
389
389
  preference: "preference";
390
390
  "skill-source": "skill-source";
391
391
  }>;
@@ -469,14 +469,14 @@ export declare const AgentLearningCapabilitiesSchema: z.ZodObject<{
469
469
  revision: z.ZodString;
470
470
  }, z.core.$strict>;
471
471
  importKinds: z.ZodArray<z.ZodEnum<{
472
- fact: "fact";
473
472
  note: "note";
473
+ fact: "fact";
474
474
  preference: "preference";
475
475
  "skill-source": "skill-source";
476
476
  }>>;
477
477
  exportKinds: z.ZodArray<z.ZodEnum<{
478
- fact: "fact";
479
478
  note: "note";
479
+ fact: "fact";
480
480
  preference: "preference";
481
481
  "skill-source": "skill-source";
482
482
  }>>;
@@ -19,6 +19,8 @@ export { composeAgentProfileGuidance, profileKbDiscrepancies, profileKbHarnesses
19
19
  * replaces blocks from these sources and keeps blocks any other layer added.
20
20
  */
21
21
  export declare const PROFILE_KB_SOURCES: readonly ["harness", "model", "learning"];
22
+ /** Whether the knowledge base lists this exact spelling: a model id or one of its aliases, such as `zai-coding-plan/glm-5.3`. */
23
+ export declare const profileKbNamesModel: (name: string) => boolean;
22
24
  /** Which harness and model to compose guidance for. */
23
25
  export interface ProfileKbSelection {
24
26
  harness?: HarnessType | string;
@@ -64,9 +64,8 @@ function matchModelName(model, lookup) {
64
64
  candidate = candidate.slice(slash + 1);
65
65
  }
66
66
  }
67
- function modelPosition(model) {
68
- return matchModelName(model, (candidate) => modelIndex.get(candidate)) ?? -1;
69
- }
67
+ /** Whether the knowledge base lists this exact spelling: a model id or one of its aliases, such as `zai-coding-plan/glm-5.3`. */
68
+ export const profileKbNamesModel = (name) => modelIndex.has(name.trim().toLowerCase());
70
69
  function learningsFor(harness, model) {
71
70
  return learningSnapshot.filter((learning) => {
72
71
  const scope = learning.appliesTo;
@@ -90,7 +89,7 @@ function profileKbGuidance(selection) {
90
89
  const harness = selection.harness
91
90
  ? harnessSnapshot[harnessPosition(selection.harness)]
92
91
  : undefined;
93
- const model = modelSnapshot[modelPosition(selection.model)];
92
+ const model = modelSnapshot[matchModelName(selection.model, (candidate) => modelIndex.get(candidate)) ?? -1];
94
93
  const blocks = [];
95
94
  if (harness && harness.prompt.length > 0) {
96
95
  blocks.push({
@@ -10,6 +10,7 @@ import { canonicalCandidateDigest, sha256DigestSchema, environmentNameSchema, he
10
10
  import { harnessTypeSchema } from "./harness.js";
11
11
  import { AgentProfileValueError, assertAgentProfileValue, canonicalAgentProfileJson } from "./agent-profile-canonical.js";
12
12
  import { harnessHonorsEffort, harnessHonorsModel, harnessModelSupport, harnessReasoningEfforts, harnessSystemPromptIntents, resolveModelProvider, } from "./harness-capabilities.js";
13
+ import { profileKbNamesModel } from "./profile-kb/index.js";
13
14
  import { SANDBOX_SIZE_PRESET_NAMES, } from "./sandbox-size.js";
14
15
  const profileOpaqueValueSchema = z.unknown().transform((value, context) => {
15
16
  if (value === undefined || isBoundedJsonMaterial(value, { dataPropertiesOnly: true, content: true }))
@@ -442,8 +443,8 @@ export const agentProfileSchema = z
442
443
  context.addIssue({ code: "custom", path: ["seats", 0, "permissions"], message: "first seat permissions must match profile permissions" });
443
444
  }
444
445
  for (const [index, seat] of profile.seats.entries()) {
445
- const provider = resolveModelProvider(seat.model);
446
- if (provider !== seat.provider) {
446
+ // The bare id's family provider (`glm-5.3` → `zai`), or a spelling the knowledge base lists (opencode's `zai-coding-plan/glm-5.3`).
447
+ if (resolveModelProvider(seat.model) !== seat.provider && !profileKbNamesModel(`${seat.provider}/${seat.model}`)) {
447
448
  context.addIssue({ code: "custom", path: ["seats", index, "provider"], message: "seat provider must match the model provider" });
448
449
  }
449
450
  if (!harnessHonorsModel(seat.harness)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-interface",
3
- "version": "5.10.12",
3
+ "version": "5.10.14",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",