@mantyx/sdk 2026.11.8 → 2026.11.10

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/CHANGELOG.md CHANGED
@@ -25,6 +25,10 @@ and new releases use calendar versions (`YYYY.M.RELEASE`). Historical versions r
25
25
  providers rank above the user's own text; elsewhere, and with `"context"`,
26
26
  they stay ahead of the user message.
27
27
 
28
+
29
+ - Optional new harness mode on runs and sessions, with per-message overrides
30
+ (`newLoop` / `new_loop` / `NewLoop`). Existing runs keep the legacy loop.
31
+
28
32
  - Configure a fallback model for ephemeral runs and sessions. MANTYX preserves
29
33
  completed tool results during failover and keeps switched sessions on the fallback.
30
34
 
@@ -55,8 +59,6 @@ and new releases use calendar versions (`YYYY.M.RELEASE`). Historical versions r
55
59
  `400` unless it carries a system prompt) and rejects `mantyx` /
56
60
  `mantyx_plugin` tool refs with `400`.
57
61
 
58
- - Experimental `newLoop` opt-in for the reviewed harness loop. Agent runs use the existing loop.
59
-
60
62
  ### Changed
61
63
 
62
64
  - Agent run reply text no longer glues tool rounds together ("…checking now.Found 3"):
@@ -323,6 +323,7 @@ function specForRun(spec) {
323
323
  if (spec.modelId) out.modelId = spec.modelId;
324
324
  if (spec.tools) out.tools = spec.tools;
325
325
  if (spec.openRouterProvider !== void 0) out.openRouterProvider = spec.openRouterProvider;
326
+ if (spec.newLoop !== void 0) out.newLoop = spec.newLoop;
326
327
  if (spec.reasoningLevel !== void 0) out.reasoningLevel = spec.reasoningLevel;
327
328
  if (spec.outputSchema !== void 0) out.outputSchema = spec.outputSchema;
328
329
  if (spec.metadata) out.metadata = spec.metadata;
@@ -336,6 +337,7 @@ function specForSession(spec, contextId) {
336
337
  if (spec.modelId) out.modelId = spec.modelId;
337
338
  if (spec.tools) out.tools = spec.tools;
338
339
  if (spec.openRouterProvider !== void 0) out.openRouterProvider = spec.openRouterProvider;
340
+ if (spec.newLoop !== void 0) out.newLoop = spec.newLoop;
339
341
  if (spec.reasoningLevel !== void 0) out.reasoningLevel = spec.reasoningLevel;
340
342
  if (spec.outputSchema !== void 0) out.outputSchema = spec.outputSchema;
341
343
  const meta = { ...spec.metadata ?? {} };
@@ -56,6 +56,7 @@ export interface MantyxAgentSpec {
56
56
  systemPrompt?: string;
57
57
  modelId?: string;
58
58
  tools?: ToolRef[];
59
+ newLoop?: boolean;
59
60
  reasoningLevel?: ReasoningLevel;
60
61
  openRouterProvider?: OpenRouterProviderPreferences;
61
62
  /**
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MantyxError,
3
3
  MantyxRunError
4
- } from "./chunk-HZGH34UW.js";
4
+ } from "./chunk-LISLOB7S.js";
5
5
 
6
6
  // src/a2a-server.ts
7
7
  import {
@@ -239,6 +239,7 @@ function specForRun(spec) {
239
239
  if (spec.modelId) out.modelId = spec.modelId;
240
240
  if (spec.tools) out.tools = spec.tools;
241
241
  if (spec.openRouterProvider !== void 0) out.openRouterProvider = spec.openRouterProvider;
242
+ if (spec.newLoop !== void 0) out.newLoop = spec.newLoop;
242
243
  if (spec.reasoningLevel !== void 0) out.reasoningLevel = spec.reasoningLevel;
243
244
  if (spec.outputSchema !== void 0) out.outputSchema = spec.outputSchema;
244
245
  if (spec.metadata) out.metadata = spec.metadata;
@@ -252,6 +253,7 @@ function specForSession(spec, contextId) {
252
253
  if (spec.modelId) out.modelId = spec.modelId;
253
254
  if (spec.tools) out.tools = spec.tools;
254
255
  if (spec.openRouterProvider !== void 0) out.openRouterProvider = spec.openRouterProvider;
256
+ if (spec.newLoop !== void 0) out.newLoop = spec.newLoop;
255
257
  if (spec.reasoningLevel !== void 0) out.reasoningLevel = spec.reasoningLevel;
256
258
  if (spec.outputSchema !== void 0) out.outputSchema = spec.outputSchema;
257
259
  const meta = { ...spec.metadata ?? {} };
@@ -1311,6 +1311,7 @@ var AgentSession = class {
1311
1311
  if (this.tools.length > 0) body.tools = serializeToolRefs(this.tools);
1312
1312
  if (opts.metadata && Object.keys(opts.metadata).length > 0) body.metadata = opts.metadata;
1313
1313
  if (opts.openRouterProvider !== void 0) body.openRouterProvider = opts.openRouterProvider;
1314
+ if (opts.newLoop !== void 0) body.newLoop = opts.newLoop;
1314
1315
  if (opts.reasoningLevel !== void 0) {
1315
1316
  body.reasoningLevel = normalizeReasoningLevel(opts.reasoningLevel);
1316
1317
  }
@@ -1415,6 +1416,7 @@ function serializeAgentSpec(spec, extra = {}) {
1415
1416
  if (spec.modelId) body.modelId = spec.modelId;
1416
1417
  if (spec.fallbackModelId) body.fallbackModelId = spec.fallbackModelId;
1417
1418
  if (spec.openRouterProvider !== void 0) body.openRouterProvider = spec.openRouterProvider;
1419
+ if (spec.newLoop !== void 0) body.newLoop = spec.newLoop;
1418
1420
  if (spec.reasoningLevel !== void 0) {
1419
1421
  body.reasoningLevel = normalizeReasoningLevel(spec.reasoningLevel);
1420
1422
  }
package/dist/client.d.ts CHANGED
@@ -219,6 +219,8 @@ export interface AgentSpecBase {
219
219
  */
220
220
  reasoningLevel?: ReasoningLevel;
221
221
  openRouterProvider?: OpenRouterProviderPreferences;
222
+ /** Opt into the new harness loop. Omit to inherit the session default, otherwise false. */
223
+ newLoop?: boolean;
222
224
  budgets?: {
223
225
  maxToolTurns?: number;
224
226
  };
@@ -1144,6 +1146,8 @@ export declare class AgentSession {
1144
1146
  */
1145
1147
  reasoningLevel?: ReasoningLevel;
1146
1148
  openRouterProvider?: OpenRouterProviderPreferences;
1149
+ /** Override the execution mode for this message; omission inherits the session default. */
1150
+ newLoop?: boolean;
1147
1151
  /**
1148
1152
  * Per-message override for `outputSchema`. Applies only to this run
1149
1153
  * and does not mutate the session's stored value.
@@ -1187,6 +1191,8 @@ export declare class AgentSession {
1187
1191
  metadata?: Record<string, string>;
1188
1192
  reasoningLevel?: ReasoningLevel;
1189
1193
  openRouterProvider?: OpenRouterProviderPreferences;
1194
+ /** Override the execution mode for this message; omission inherits the session default. */
1195
+ newLoop?: boolean;
1190
1196
  outputSchema?: OutputSchema;
1191
1197
  loopDetection?: LoopDetection | false;
1192
1198
  toolBudgets?: ToolBudgets;
@@ -1205,6 +1211,8 @@ export declare class AgentSession {
1205
1211
  metadata?: Record<string, string>;
1206
1212
  reasoningLevel?: ReasoningLevel;
1207
1213
  openRouterProvider?: OpenRouterProviderPreferences;
1214
+ /** Override the execution mode for this message; omission inherits the session default. */
1215
+ newLoop?: boolean;
1208
1216
  outputSchema?: OutputSchema;
1209
1217
  loopDetection?: LoopDetection | false;
1210
1218
  toolBudgets?: ToolBudgets;
@@ -149,6 +149,7 @@ export interface RunComputerUseOptions {
149
149
  /** Disable the `request_confirmation` tool entirely. Default false (it is included). */
150
150
  disableConfirmation?: boolean;
151
151
  /** Provider reasoning strength for the session. */
152
+ newLoop?: boolean;
152
153
  reasoningLevel?: ReasoningLevel;
153
154
  /** Observability metadata stored on the session. */
154
155
  metadata?: Record<string, string>;
package/dist/index.cjs CHANGED
@@ -1383,6 +1383,7 @@ var AgentSession = class {
1383
1383
  if (this.tools.length > 0) body.tools = serializeToolRefs(this.tools);
1384
1384
  if (opts.metadata && Object.keys(opts.metadata).length > 0) body.metadata = opts.metadata;
1385
1385
  if (opts.openRouterProvider !== void 0) body.openRouterProvider = opts.openRouterProvider;
1386
+ if (opts.newLoop !== void 0) body.newLoop = opts.newLoop;
1386
1387
  if (opts.reasoningLevel !== void 0) {
1387
1388
  body.reasoningLevel = normalizeReasoningLevel(opts.reasoningLevel);
1388
1389
  }
@@ -1487,6 +1488,7 @@ function serializeAgentSpec(spec, extra = {}) {
1487
1488
  if (spec.modelId) body.modelId = spec.modelId;
1488
1489
  if (spec.fallbackModelId) body.fallbackModelId = spec.fallbackModelId;
1489
1490
  if (spec.openRouterProvider !== void 0) body.openRouterProvider = spec.openRouterProvider;
1491
+ if (spec.newLoop !== void 0) body.newLoop = spec.newLoop;
1490
1492
  if (spec.reasoningLevel !== void 0) {
1491
1493
  body.reasoningLevel = normalizeReasoningLevel(spec.reasoningLevel);
1492
1494
  }
@@ -2560,6 +2562,7 @@ async function runComputerUse(opts) {
2560
2562
  systemPrompt,
2561
2563
  ...opts.model ? { modelId: opts.model } : {},
2562
2564
  tools,
2565
+ ...opts.newLoop !== void 0 ? { newLoop: opts.newLoop } : {},
2563
2566
  ...opts.reasoningLevel !== void 0 ? { reasoningLevel: opts.reasoningLevel } : {},
2564
2567
  ...opts.metadata ? { metadata: opts.metadata } : {}
2565
2568
  });
@@ -2599,7 +2602,7 @@ async function runComputerUse(opts) {
2599
2602
  }
2600
2603
 
2601
2604
  // src/version.ts
2602
- var SDK_VERSION = "2026.11.8";
2605
+ var SDK_VERSION = "2026.11.10";
2603
2606
  // Annotate the CommonJS export names for ESM import in node:
2604
2607
  0 && (module.exports = {
2605
2608
  AgentSession,
package/dist/index.js CHANGED
@@ -25,7 +25,7 @@ import {
25
25
  taskPlanFromEventData,
26
26
  toToolParametersWire,
27
27
  zodToJsonSchema
28
- } from "./chunk-HZGH34UW.js";
28
+ } from "./chunk-LISLOB7S.js";
29
29
 
30
30
  // src/oauth.ts
31
31
  var DEFAULT_OAUTH_BASE_URL = "https://app.mantyx.io";
@@ -562,6 +562,7 @@ async function runComputerUse(opts) {
562
562
  systemPrompt,
563
563
  ...opts.model ? { modelId: opts.model } : {},
564
564
  tools,
565
+ ...opts.newLoop !== void 0 ? { newLoop: opts.newLoop } : {},
565
566
  ...opts.reasoningLevel !== void 0 ? { reasoningLevel: opts.reasoningLevel } : {},
566
567
  ...opts.metadata ? { metadata: opts.metadata } : {}
567
568
  });
@@ -601,7 +602,7 @@ async function runComputerUse(opts) {
601
602
  }
602
603
 
603
604
  // src/version.ts
604
- var SDK_VERSION = "2026.11.8";
605
+ var SDK_VERSION = "2026.11.10";
605
606
  export {
606
607
  AgentSession,
607
608
  COMPUTER_USE_ACTIONS,
package/dist/version.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Release version — synced from sdk/VERSION (`pnpm run sync-version`).
3
3
  */
4
- export declare const SDK_VERSION = "2026.11.8";
4
+ export declare const SDK_VERSION = "2026.11.10";
@@ -252,6 +252,7 @@ The agent spec is the body shape used by `POST /agent-runs` and `POST
252
252
  "systemPrompt": "You are helpful.", // required (or a `system` message, see §4.0.1)
253
253
  "modelId": "platform:cm6abc123", // optional, see §3
254
254
  "reasoningLevel": "medium", // optional, see §4.4
255
+ "newLoop": true, // optional opt-in; omitted/false keeps the legacy loop
255
256
  "tools": [
256
257
  {
257
258
  "kind": "local",
@@ -838,7 +839,7 @@ Two equivalent input shapes are accepted:
838
839
  | Form | Values | Notes |
839
840
  | ---------- | -------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
840
841
  | **String** | `"off"`, `"low"`, `"medium"`, `"high"` | Snaps to fixed anchors: off=0, low=30, medium=50, high=80. |
841
- | **Number** | integer `0`–`100` | Pass-through to `RunAgentOptions.reasoningLevel`. `0` explicitly disables provider thinking even on reasoning models. |
842
+ | **Number** | integer `0`–`100` | Pass-through to `RunAgentOptions.reasoningLevel`. `0` requests off, or the lowest supported effort on models that require reasoning. |
842
843
 
843
844
  When omitted, thinking is off.
844
845
 
@@ -909,6 +910,71 @@ each request (`usage.cost`), so a pinned provider or `sort` is billed at what
909
910
  it actually cost. The catalog's per-token prices are a reference estimate and
910
911
  are used only when OpenRouter does not report a cost.
911
912
 
913
+ ### 4.4.2 `newLoop` (opt-in harness)
914
+
915
+ `newLoop` is an optional boolean on run creation, session creation, and session
916
+ message requests. Omission keeps the legacy loop for new runs/sessions. A message
917
+ inherits its session's setting; an explicit `false` overrides it for that message
918
+ only. Checkpoints retain the selected mode through approval and worker restarts.
919
+ The chat `/api/chat` and `/api/chat/stream` request bodies also accept this flag
920
+ per message (multipart accepts the strings `"true"` and `"false"`).
921
+
922
+ With `newLoop: true`:
923
+
924
+ - Tool calls execute in model order. Adjacent read-only tools may overlap, with
925
+ at most eight running at once; writes and unclassified tools form barriers.
926
+ Tool metadata must accurately describe side effects. Internal SDK tools can
927
+ set `parallelSafe: false` to serialize reads sharing a mutable resource.
928
+ - The loop guard tracks a bounded history of call/result observations, including
929
+ alternating cycles. New evidence resets the no-progress streak. Internal SDK
930
+ tools can return `{ text, progress: { key } }` with a stable evidence version
931
+ to exclude volatile timestamps from that comparison. Without a key, full
932
+ output is compared; changed output is not proof of task completion.
933
+ - An empty reply is not an answer. When the model returns no text and no tool
934
+ call, it is asked once more, as in the legacy loop; if it is still empty the
935
+ run ends with `errorClass: "empty_response"` instead of a success with empty
936
+ text.
937
+ - Waiting is not refused. When the same read-only call (`readOnly: true`) is
938
+ requested again with an unchanged answer, reaching the nudge threshold does
939
+ not skip it: it runs, and the model is told the results have stopped changing and
940
+ that it may keep waiting or should change approach. An unchanged answer from
941
+ a read is what a queued job or a slow export looks like. Unchanged results
942
+ keep counting, so the hard cutoff still ends a real loop. A cycle through
943
+ different calls, or a repeated batch that contains any other tool, is
944
+ skipped as before.
945
+ - Completion guards fail closed. A thrown verifier, a `stop` decision, or
946
+ exhausted final-answer corrections produces `completion_incomplete` through
947
+ the existing execution-error channel. The internal SDK defaults to two
948
+ corrections (`maxCompletionContinuations`), retained through checkpoints.
949
+ Required or unfinished task plans are not accepted after correction exhaustion.
950
+ - Budget-forced final summaries remain partial output: the terminal status is
951
+ `error_max_turns`, with `budget_exhausted` error metadata. The internal SDK
952
+ rejects the run and exposes partial text through `onPartialError`.
953
+ - Runtime research-tool caps are not installed by default. Explicit `toolBudgets`
954
+ still apply. The automatic chat supervisor is disabled;
955
+ agent runs/sessions retain their existing explicit `supervisor` setting.
956
+ - Omitted `reasoningLevel` defaults to 50 regardless of streaming callbacks.
957
+ Explicit levels keep their normal meaning.
958
+ - Local context trimming preserves the head and tail of long tool output, with
959
+ an omission marker in the middle. Omitted content is not an artifact store.
960
+ - Recovery from an empty assistant turn allows further tool work instead of
961
+ instructing the model to finalize immediately.
962
+
963
+ Approval requirements, explicit guard settings, and maximum tool-turn limits
964
+ remain in force. This mode does not introduce a code workbench, persistent
965
+ specialist sessions, or provider-native history across separate user messages.
966
+ Provider-native compaction retains its separate explicit setting.
967
+ Completion verification still depends on the host's guard and available evidence;
968
+ the loop does not independently prove that every requested task is complete.
969
+ The deterministic regression harness is documented in `docs/harness-testing.md`
970
+ in the repository.
971
+
972
+ TypeScript: `client.runAgent({ systemPrompt: "Help", prompt: "Do the task", newLoop: true })`.
973
+ Python: `client.run_agent(system_prompt="Help", prompt="Do the task", new_loop=True)`.
974
+ Go: set `RunSpec.NewLoop` / `SessionSpec.NewLoop` to a boolean pointer, or use
975
+ `WithNewLoop(true)` on a session message. The internal runtime accepts
976
+ `RunAgentOptions.newLoop` as well.
977
+
912
978
  ### 4.5 `outputSchema` (structured final reply)
913
979
 
914
980
  `outputSchema` constrains the model's **final assistant text** to a JSON
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mantyx/sdk",
3
- "version": "2026.11.8",
3
+ "version": "2026.11.10",
4
4
  "description": "MANTYX as a hosted agent runtime: define agents inline, mix server-resolved MCP and A2A tools with locally-executed tools, run them remotely.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -62,7 +62,7 @@
62
62
  "tsrs": "0.25.0-ts7.1.0-beta",
63
63
  "tsup": "^9.0.0",
64
64
  "typescript": "~7.0.2",
65
- "vitest": "^5.1.0"
65
+ "vitest": "^5.1.1"
66
66
  },
67
67
  "keywords": [
68
68
  "mantyx",