@tangle-network/agent-interface 5.10.19 → 5.10.20
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/harness-capabilities.d.ts +1 -8
- package/dist/harness-capabilities.js +10 -24
- package/dist/profile-kb/index.d.ts +2 -4
- package/dist/profile-kb/index.js +3 -40
- package/dist/profile-kb/models.d.ts +4 -0
- package/dist/profile-kb/models.js +44 -0
- package/dist/profile-kb/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -120,14 +120,7 @@ export interface ModelReasoningCapability {
|
|
|
120
120
|
* lower ceiling caps the list there. Pass `model` from your catalog; omit it for the harness-only set.
|
|
121
121
|
*/
|
|
122
122
|
export declare function reasoningEffortsFor(harness: HarnessType, model?: ModelReasoningCapability | null): readonly ReasoningEffort[];
|
|
123
|
-
/**
|
|
124
|
-
* The native control token a harness applies for one canonical effort, or `null` when it applies
|
|
125
|
-
* none. `effort: null` (nothing requested) is always `null`.
|
|
126
|
-
*
|
|
127
|
-
* One owner for both sides of the check: the adapter that builds the harness argv and the caller
|
|
128
|
-
* that verifies the receipt read this function, so a CLI that renames a rung moves both at once
|
|
129
|
-
* instead of turning into a refused run.
|
|
130
|
-
*/
|
|
123
|
+
/** Native token shared by argv builders and receipt verification; null means no control. */
|
|
131
124
|
export declare function nativeReasoningControl(harness: HarnessType, effort: ReasoningEffort | null, model?: string): string | null;
|
|
132
125
|
/** Whether the harness's runner honors a per-turn MODEL override (vs. picking the model itself). */
|
|
133
126
|
export declare function harnessHonorsModel(harness: HarnessType): boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { REASONING_EFFORTS, } from "./agent-profile.js";
|
|
2
2
|
import { resolveHarnessType } from "./harness.js";
|
|
3
|
+
import { findProfileKbModel } from "./profile-kb/models.js";
|
|
3
4
|
/** Canonical harness/model, effort and prompt controls. Model-specific capability comes from the serving catalog. */
|
|
4
5
|
/** low → high. `none` = thinking off; `ultracode` = max (claude-code mode). */
|
|
5
6
|
export const reasoningLadder = REASONING_EFFORTS;
|
|
@@ -262,12 +263,7 @@ export function reasoningEffortsFor(harness, model) {
|
|
|
262
263
|
}
|
|
263
264
|
// ── Native reasoning control (the exact token the harness process receives) ───
|
|
264
265
|
/**
|
|
265
|
-
*
|
|
266
|
-
* native reasoning control for that request. This is the value a materialization receipt carries
|
|
267
|
-
* as `reasoningEffort.applied`, so a caller can check that the effort it asked for reached the
|
|
268
|
-
* process instead of trusting an echo of its own request.
|
|
269
|
-
*
|
|
270
|
-
* Read from the argv builders that actually spawn each CLI, not from help text:
|
|
266
|
+
* CLI controls recorded as reasoningEffort.applied in materialization receipts:
|
|
271
267
|
* - claude-code — `--effort <value>`; it cannot express `none` or `minimal`, so both clamp to
|
|
272
268
|
* `low`, and `ultracode` becomes its ceiling `max`.
|
|
273
269
|
* - codex — `-c model_reasoning_effort="<value>"`; it takes the canonical rungs directly and
|
|
@@ -276,16 +272,10 @@ export function reasoningEffortsFor(harness, model) {
|
|
|
276
272
|
* `max` (pi 1.4.0 `cli/args.js`, the prime fork's `cli/args.ts`, openclaw `agent --help`).
|
|
277
273
|
* - kimi-code — the control is the FLAG itself, `--thinking` or `--no-thinking`, because kimi's
|
|
278
274
|
* thinking switch is binary. `medium` is its default and passes no flag at all.
|
|
279
|
-
* - opencode — `--variant <value
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
* answers `max` with 400). Pass `model` so this rung resolves; without it `xhigh` is sent.
|
|
284
|
-
*
|
|
285
|
-
* A harness with no entry applies NO native control: either it derives thinking from the model
|
|
286
|
-
* (gemini's `--thinking-budget`) or it plumbs no thinking flag at all (see
|
|
287
|
-
* {@link harnessHonorsEffort}). Both answer `null`, which is what their receipts carry — so an
|
|
288
|
-
* unknown harness is never asserted to have applied a control it cannot apply.
|
|
275
|
+
* - opencode — `--variant <value>`; `none` omits the flag. The sourced model KB owns native
|
|
276
|
+
* effort translations (Flash uses low/high/max). Otherwise `ultracode` becomes `max` for GLM
|
|
277
|
+
* and `xhigh` for other/unknown models; other rungs pass through.
|
|
278
|
+
* Unlisted harnesses apply no native control (see {@link harnessHonorsEffort}).
|
|
289
279
|
*/
|
|
290
280
|
const thinkingRung = (effort) => {
|
|
291
281
|
if (effort === "none")
|
|
@@ -312,19 +302,15 @@ const harnessNativeReasoningControl = {
|
|
|
312
302
|
opencode: (effort, model) => {
|
|
313
303
|
if (effort === "none")
|
|
314
304
|
return null;
|
|
305
|
+
const native = findProfileKbModel(model)?.nativeEfforts?.[effort];
|
|
306
|
+
if (native !== undefined)
|
|
307
|
+
return native;
|
|
315
308
|
if (effort !== "ultracode")
|
|
316
309
|
return effort;
|
|
317
310
|
return /(?:^|\/)glm-/iu.test(model ?? "") ? "max" : "xhigh";
|
|
318
311
|
},
|
|
319
312
|
};
|
|
320
|
-
/**
|
|
321
|
-
* The native control token a harness applies for one canonical effort, or `null` when it applies
|
|
322
|
-
* none. `effort: null` (nothing requested) is always `null`.
|
|
323
|
-
*
|
|
324
|
-
* One owner for both sides of the check: the adapter that builds the harness argv and the caller
|
|
325
|
-
* that verifies the receipt read this function, so a CLI that renames a rung moves both at once
|
|
326
|
-
* instead of turning into a refused run.
|
|
327
|
-
*/
|
|
313
|
+
/** Native token shared by argv builders and receipt verification; null means no control. */
|
|
328
314
|
export function nativeReasoningControl(harness, effort, model) {
|
|
329
315
|
if (effort === null)
|
|
330
316
|
return null;
|
|
@@ -9,18 +9,16 @@
|
|
|
9
9
|
import { composeAgentProfileGuidance, type AgentProfile } from "../agent-profile.js";
|
|
10
10
|
import type { HarnessType } from "../harness.js";
|
|
11
11
|
import { profileKbHarnesses } from "./harnesses.js";
|
|
12
|
-
import { profileKbModels } from "./models.js";
|
|
12
|
+
import { profileKbModels, profileKbNamesModel } from "./models.js";
|
|
13
13
|
import { profileKbDiscrepancies, profileKbLearnings } from "./records.js";
|
|
14
14
|
export type * from "./types.js";
|
|
15
15
|
export type { AgentProfileGuidanceBlock, AgentProfileGuidanceChannel, AgentProfileGuidanceOptions, } from "../agent-profile.js";
|
|
16
|
-
export { composeAgentProfileGuidance, profileKbDiscrepancies, profileKbHarnesses, profileKbLearnings, profileKbModels, };
|
|
16
|
+
export { composeAgentProfileGuidance, profileKbDiscrepancies, profileKbHarnesses, profileKbLearnings, profileKbModels, profileKbNamesModel, };
|
|
17
17
|
/**
|
|
18
18
|
* The guidance block sources the knowledge base owns. {@link withProfileKb}
|
|
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;
|
|
24
22
|
/** Which harness and model to compose guidance for. */
|
|
25
23
|
export interface ProfileKbSelection {
|
|
26
24
|
harness?: HarnessType | string;
|
package/dist/profile-kb/index.js
CHANGED
|
@@ -10,9 +10,9 @@ import { composeAgentProfileGuidance, } from "../agent-profile.js";
|
|
|
10
10
|
import { deepFreeze } from "../deep-freeze.js";
|
|
11
11
|
import { harnessSystemPromptIntents } from "../harness-capabilities.js";
|
|
12
12
|
import { profileKbHarnesses } from "./harnesses.js";
|
|
13
|
-
import { profileKbModels } from "./models.js";
|
|
13
|
+
import { findProfileKbModel, profileKbModels, profileKbNamesModel } from "./models.js";
|
|
14
14
|
import { profileKbDiscrepancies, profileKbLearnings } from "./records.js";
|
|
15
|
-
export { composeAgentProfileGuidance, profileKbDiscrepancies, profileKbHarnesses, profileKbLearnings, profileKbModels, };
|
|
15
|
+
export { composeAgentProfileGuidance, profileKbDiscrepancies, profileKbHarnesses, profileKbLearnings, profileKbModels, profileKbNamesModel, };
|
|
16
16
|
/**
|
|
17
17
|
* The guidance block sources the knowledge base owns. {@link withProfileKb}
|
|
18
18
|
* replaces blocks from these sources and keeps blocks any other layer added.
|
|
@@ -25,47 +25,10 @@ export const PROFILE_KB_SOURCES = ["harness", "model", "learning"];
|
|
|
25
25
|
* types stay as they were published.
|
|
26
26
|
*/
|
|
27
27
|
const harnessSnapshot = deepFreeze(structuredClone(profileKbHarnesses));
|
|
28
|
-
const modelSnapshot = deepFreeze(structuredClone(profileKbModels));
|
|
29
28
|
const learningSnapshot = deepFreeze(structuredClone(profileKbLearnings));
|
|
30
29
|
function harnessPosition(harness) {
|
|
31
30
|
return harnessSnapshot.findIndex((entry) => entry.id === harness);
|
|
32
31
|
}
|
|
33
|
-
const modelIndex = (() => {
|
|
34
|
-
const index = new Map();
|
|
35
|
-
modelSnapshot.forEach((model, position) => {
|
|
36
|
-
for (const name of [model.id, ...model.aliases]) {
|
|
37
|
-
const key = name.toLowerCase();
|
|
38
|
-
if (index.has(key)) {
|
|
39
|
-
throw new Error(`profile-kb: model name ${name} is declared twice`);
|
|
40
|
-
}
|
|
41
|
-
index.set(key, position);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
return index;
|
|
45
|
-
})();
|
|
46
|
-
/**
|
|
47
|
-
* Try the name as given, then without each leading `provider/` or route
|
|
48
|
-
* segment, after dropping a trailing `:suffix`.
|
|
49
|
-
*/
|
|
50
|
-
function matchModelName(model, lookup) {
|
|
51
|
-
if (!model)
|
|
52
|
-
return undefined;
|
|
53
|
-
const colon = model.lastIndexOf(":");
|
|
54
|
-
let candidate = (colon > 0 ? model.slice(0, colon) : model)
|
|
55
|
-
.trim()
|
|
56
|
-
.toLowerCase();
|
|
57
|
-
for (;;) {
|
|
58
|
-
const found = lookup(candidate);
|
|
59
|
-
if (found !== undefined)
|
|
60
|
-
return found;
|
|
61
|
-
const slash = candidate.indexOf("/");
|
|
62
|
-
if (slash < 0)
|
|
63
|
-
return undefined;
|
|
64
|
-
candidate = candidate.slice(slash + 1);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
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());
|
|
69
32
|
function learningsFor(harness, model) {
|
|
70
33
|
return learningSnapshot.filter((learning) => {
|
|
71
34
|
const scope = learning.appliesTo;
|
|
@@ -89,7 +52,7 @@ function profileKbGuidance(selection) {
|
|
|
89
52
|
const harness = selection.harness
|
|
90
53
|
? harnessSnapshot[harnessPosition(selection.harness)]
|
|
91
54
|
: undefined;
|
|
92
|
-
const model =
|
|
55
|
+
const model = findProfileKbModel(selection.model);
|
|
93
56
|
const blocks = [];
|
|
94
57
|
if (harness && harness.prompt.length > 0) {
|
|
95
58
|
blocks.push({
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import type { ProfileKbModel } from "./types.js";
|
|
2
2
|
/** Source-backed facts and conditional advice. API controls never become agent instructions. */
|
|
3
3
|
export declare const profileKbModels: readonly ProfileKbModel[];
|
|
4
|
+
/** Match an id/alias, then strip leading route segments and a trailing :suffix. */
|
|
5
|
+
export declare function findProfileKbModel(model: string | undefined): ProfileKbModel | undefined;
|
|
6
|
+
/** Whether this exact spelling is a declared model id or alias. */
|
|
7
|
+
export declare const profileKbNamesModel: (name: string) => boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { deepFreeze } from "../deep-freeze.js";
|
|
1
2
|
import { claim, kbEntry } from "./entry.js";
|
|
2
3
|
const CHECKED = "2026-10-04";
|
|
3
4
|
const source = (url, locator) => ({
|
|
@@ -229,6 +230,14 @@ export const profileKbModels = [
|
|
|
229
230
|
vendor: "DeepSeek",
|
|
230
231
|
surfaces: ["api", "router", "opencode"],
|
|
231
232
|
aliases: ["deepseek-flash", "deepseek/deepseek-v4.1-flash", "opencode/deepseek-v4.1-flash-free"],
|
|
233
|
+
nativeEfforts: {
|
|
234
|
+
minimal: "low",
|
|
235
|
+
low: "low",
|
|
236
|
+
medium: "high",
|
|
237
|
+
high: "high",
|
|
238
|
+
xhigh: "high",
|
|
239
|
+
ultracode: "max",
|
|
240
|
+
},
|
|
232
241
|
claims: [
|
|
233
242
|
claim("DeepSeek API ID deepseek-flash denotes V4.1-Flash: 1M context, 384K output, vision and tools; non-thinking mode is available. Router naming is a separate contract.", deepseekModel),
|
|
234
243
|
claim("Thinking defaults on at high. Native efforts are low, high and max; minimal maps to low, medium/xhigh to high, and ultra to max. With tools, preserve all previous reasoning_content, including turns without tool calls.", deepseekThinking),
|
|
@@ -273,3 +282,38 @@ export const profileKbModels = [
|
|
|
273
282
|
],
|
|
274
283
|
}),
|
|
275
284
|
];
|
|
285
|
+
// Both guidance and native controls read this snapshot, never mutable exports.
|
|
286
|
+
const modelSnapshot = deepFreeze(structuredClone(profileKbModels));
|
|
287
|
+
const modelIndex = (() => {
|
|
288
|
+
const index = new Map();
|
|
289
|
+
for (const model of modelSnapshot) {
|
|
290
|
+
for (const name of [model.id, ...model.aliases]) {
|
|
291
|
+
const key = name.toLowerCase();
|
|
292
|
+
if (index.has(key)) {
|
|
293
|
+
throw new Error(`profile-kb: model name ${name} is declared twice`);
|
|
294
|
+
}
|
|
295
|
+
index.set(key, model);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return index;
|
|
299
|
+
})();
|
|
300
|
+
/** Match an id/alias, then strip leading route segments and a trailing :suffix. */
|
|
301
|
+
export function findProfileKbModel(model) {
|
|
302
|
+
if (!model)
|
|
303
|
+
return undefined;
|
|
304
|
+
const colon = model.lastIndexOf(":");
|
|
305
|
+
let candidate = (colon > 0 ? model.slice(0, colon) : model)
|
|
306
|
+
.trim()
|
|
307
|
+
.toLowerCase();
|
|
308
|
+
for (;;) {
|
|
309
|
+
const found = modelIndex.get(candidate);
|
|
310
|
+
if (found !== undefined)
|
|
311
|
+
return found;
|
|
312
|
+
const slash = candidate.indexOf("/");
|
|
313
|
+
if (slash < 0)
|
|
314
|
+
return undefined;
|
|
315
|
+
candidate = candidate.slice(slash + 1);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
/** Whether this exact spelling is a declared model id or alias. */
|
|
319
|
+
export const profileKbNamesModel = (name) => modelIndex.has(name.trim().toLowerCase());
|
|
@@ -55,6 +55,8 @@ export interface ProfileKbModel {
|
|
|
55
55
|
aliases: string[];
|
|
56
56
|
/** Documented API default mapped onto the portable scale (ultracode means max); harness defaults can differ. */
|
|
57
57
|
defaultEffort?: ReasoningEffort;
|
|
58
|
+
/** Documented native tokens for the portable thinking rungs; none stays off. */
|
|
59
|
+
nativeEfforts?: Readonly<Record<Exclude<ReasoningEffort, "none">, string>>;
|
|
58
60
|
sources: ProfileKbSource[];
|
|
59
61
|
prompt: string[];
|
|
60
62
|
operator: string[];
|