@tangle-network/agent-interface 5.8.0 → 5.9.0

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.
@@ -130,7 +130,7 @@ export declare function reasoningEffortsFor(harness: HarnessType, model?: ModelR
130
130
  * that verifies the receipt read this function, so a CLI that renames a rung moves both at once
131
131
  * instead of turning into a refused run.
132
132
  */
133
- export declare function nativeReasoningControl(harness: HarnessType, effort: ReasoningEffort | null): string | null;
133
+ export declare function nativeReasoningControl(harness: HarnessType, effort: ReasoningEffort | null, model?: string): string | null;
134
134
  /** Whether the harness's runner honors a per-turn MODEL override (vs. picking the model itself). */
135
135
  export declare function harnessHonorsModel(harness: HarnessType): boolean;
136
136
  /** Whether the harness's runner honors a reasoning-EFFORT override (vs. dropping it). */
@@ -253,8 +253,8 @@ export function snapHarnessToModel(harness, modelId) {
253
253
  * - claude-code: `--effort` accepts `low|medium|high|xhigh|max`; canonical `ultracode` maps to
254
254
  * native `max`. It cannot express `none` or `minimal`, and an unsupported value is warned about
255
255
  * and silently replaced with the default rather than rejected — so the set must not overstate.
256
- * - pi: `--thinking` accepts `off|minimal|low|medium|high|xhigh`; canonical `none` maps to
257
- * `off` and `ultracode` clamps to `xhigh`, its top rung.
256
+ * - pi: `--thinking` accepts `off|minimal|low|medium|high|xhigh|max` (pi 1.4.0
257
+ * `cli/args.js`); canonical `none` maps to `off` and `ultracode` to `max`.
258
258
  * - prime: the prime fork of the pi line accepts the same `--thinking` set
259
259
  * (`off|minimal|low|medium|high|xhigh|max`); canonical `none` maps to `off` and `ultracode` to
260
260
  * `max`.
@@ -316,19 +316,26 @@ export function reasoningEffortsFor(harness, model) {
316
316
  * `low`, and `ultracode` becomes its ceiling `max`.
317
317
  * - codex — `-c model_reasoning_effort="<value>"`; it takes the canonical rungs directly and
318
318
  * names its ceiling `ultra`.
319
- * - pi — `--thinking <value>`; `none` becomes `off` and `ultracode` clamps to `xhigh`, the
320
- * highest rung the pi line accepts.
321
- * - prime — `--thinking <value>`; the fork carries `max` above `xhigh`, so `ultracode` reaches
322
- * `max`. This is the one rung where prime and pi differ.
319
+ * - pi, prime and openclaw — `--thinking <value>`; `none` becomes `off` and `ultracode` reaches
320
+ * `max` (pi 1.4.0 `cli/args.js`, the prime fork's `cli/args.ts`, openclaw `agent --help`).
323
321
  * - kimi-code — the control is the FLAG itself, `--thinking` or `--no-thinking`, because kimi's
324
322
  * thinking switch is binary. `medium` is its default and passes no flag at all.
325
- * - opencode — the router-backed variant name is the canonical rung unchanged.
323
+ * - opencode — `--variant <value>`, forwarded verbatim as the provider's reasoning effort; `none`
324
+ * omits the flag, as the sandbox adapter does. No
325
+ * provider spells `ultracode`, so it becomes the model's ceiling: `max` for GLM (Z.ai answers
326
+ * 400 code 1210 for anything outside `none…max`) and `xhigh` for every other model (GPT-6
327
+ * answers `max` with 400). Pass `model` so this rung resolves; without it `xhigh` is sent.
326
328
  *
327
329
  * A harness with no entry applies NO native control: either it derives thinking from the model
328
330
  * (gemini's `--thinking-budget`) or it plumbs no thinking flag at all (see
329
331
  * {@link harnessHonorsEffort}). Both answer `null`, which is what their receipts carry — so an
330
332
  * unknown harness is never asserted to have applied a control it cannot apply.
331
333
  */
334
+ const thinkingRung = (effort) => {
335
+ if (effort === "none")
336
+ return "off";
337
+ return effort === "ultracode" ? "max" : effort;
338
+ };
332
339
  const harnessNativeReasoningControl = {
333
340
  "claude-code": (effort) => {
334
341
  if (effort === "none" || effort === "minimal")
@@ -336,16 +343,9 @@ const harnessNativeReasoningControl = {
336
343
  return effort === "ultracode" ? "max" : effort;
337
344
  },
338
345
  codex: (effort) => (effort === "ultracode" ? "ultra" : effort),
339
- pi: (effort) => {
340
- if (effort === "none")
341
- return "off";
342
- return effort === "ultracode" ? "xhigh" : effort;
343
- },
344
- prime: (effort) => {
345
- if (effort === "none")
346
- return "off";
347
- return effort === "ultracode" ? "max" : effort;
348
- },
346
+ pi: thinkingRung,
347
+ prime: thinkingRung,
348
+ openclaw: thinkingRung,
349
349
  "kimi-code": (effort) => {
350
350
  if (effort === "medium")
351
351
  return null;
@@ -353,7 +353,13 @@ const harnessNativeReasoningControl = {
353
353
  ? "--no-thinking"
354
354
  : "--thinking";
355
355
  },
356
- opencode: (effort) => effort,
356
+ opencode: (effort, model) => {
357
+ if (effort === "none")
358
+ return null;
359
+ if (effort !== "ultracode")
360
+ return effort;
361
+ return /(?:^|\/)glm-/iu.test(model ?? "") ? "max" : "xhigh";
362
+ },
357
363
  };
358
364
  /**
359
365
  * The native control token a harness applies for one canonical effort, or `null` when it applies
@@ -363,10 +369,10 @@ const harnessNativeReasoningControl = {
363
369
  * that verifies the receipt read this function, so a CLI that renames a rung moves both at once
364
370
  * instead of turning into a refused run.
365
371
  */
366
- export function nativeReasoningControl(harness, effort) {
372
+ export function nativeReasoningControl(harness, effort, model) {
367
373
  if (effort === null)
368
374
  return null;
369
- return harnessNativeReasoningControl[harness]?.(effort) ?? null;
375
+ return harnessNativeReasoningControl[harness]?.(effort, model) ?? null;
370
376
  }
371
377
  // ── Per-turn selector support (does the harness honor the chat pickers?) ──────
372
378
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-interface",
3
- "version": "5.8.0",
3
+ "version": "5.9.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -86,7 +86,7 @@
86
86
  "dependencies": {
87
87
  "@noble/hashes": "2.4.0",
88
88
  "spdx-expression-parse": "5.0.0",
89
- "zod": "4.6.7"
89
+ "zod": "^4.6.6"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@types/node": "26.6.5",