@mantyx/sdk 2026.11.9 → 2026.11.11
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 +16 -2
- package/dist/a2a-server.cjs +2 -0
- package/dist/a2a-server.d.ts +1 -0
- package/dist/a2a-server.js +3 -1
- package/dist/{chunk-HZGH34UW.js → chunk-KPAGE6FD.js} +13 -2
- package/dist/client.d.ts +31 -6
- package/dist/computer-use.d.ts +4 -3
- package/dist/index.cjs +15 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -2
- package/dist/version.d.ts +1 -1
- package/docs/agent-runs-protocol.md +95 -9
- package/docs/wire-protocol.md +27 -26
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,18 @@ and new releases use calendar versions (`YYYY.M.RELEASE`). Historical versions r
|
|
|
13
13
|
|
|
14
14
|
### Added
|
|
15
15
|
|
|
16
|
+
- `supervisor.modelId` picks the model the run supervisor reviews with, and
|
|
17
|
+
`supervisor: true` enables the supervisor with its defaults (previously only
|
|
18
|
+
objects and `false` were accepted).
|
|
19
|
+
|
|
20
|
+
- `ToolInteraction` and `ConversationMessage.toolInteractions` type the retained
|
|
21
|
+
tool calls carried on prior `assistant` messages, which the server already
|
|
22
|
+
accepts and session history returns.
|
|
23
|
+
|
|
24
|
+
- Contract tests replay the shared request fixtures and SSE transcripts in
|
|
25
|
+
`sdk/contract/`, so a request field the server accepts but the SDK cannot
|
|
26
|
+
send now fails CI.
|
|
27
|
+
|
|
16
28
|
- `turnInstructions` on agent runs and per-message session sends gives the
|
|
17
29
|
model context for one turn only. It is placed ahead of that turn's user
|
|
18
30
|
message, never stored in the session transcript, and never merged into the
|
|
@@ -25,6 +37,10 @@ and new releases use calendar versions (`YYYY.M.RELEASE`). Historical versions r
|
|
|
25
37
|
providers rank above the user's own text; elsewhere, and with `"context"`,
|
|
26
38
|
they stay ahead of the user message.
|
|
27
39
|
|
|
40
|
+
|
|
41
|
+
- Optional new harness mode on runs and sessions, with per-message overrides
|
|
42
|
+
(`newLoop` / `new_loop` / `NewLoop`). Existing runs keep the legacy loop.
|
|
43
|
+
|
|
28
44
|
- Configure a fallback model for ephemeral runs and sessions. MANTYX preserves
|
|
29
45
|
completed tool results during failover and keeps switched sessions on the fallback.
|
|
30
46
|
|
|
@@ -55,8 +71,6 @@ and new releases use calendar versions (`YYYY.M.RELEASE`). Historical versions r
|
|
|
55
71
|
`400` unless it carries a system prompt) and rejects `mantyx` /
|
|
56
72
|
`mantyx_plugin` tool refs with `400`.
|
|
57
73
|
|
|
58
|
-
- Experimental `newLoop` opt-in for the reviewed harness loop. Agent runs use the existing loop.
|
|
59
|
-
|
|
60
74
|
### Changed
|
|
61
75
|
|
|
62
76
|
- Agent run reply text no longer glues tool rounds together ("…checking now.Found 3"):
|
package/dist/a2a-server.cjs
CHANGED
|
@@ -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 ?? {} };
|
package/dist/a2a-server.d.ts
CHANGED
package/dist/a2a-server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MantyxError,
|
|
3
3
|
MantyxRunError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KPAGE6FD.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
|
}
|
|
@@ -1646,19 +1648,28 @@ var TOOL_BUDGETS_MAX_ENTRIES = 32;
|
|
|
1646
1648
|
var TOOL_BUDGET_MAX_NAME_LEN = 120;
|
|
1647
1649
|
var TOOL_BUDGET_MAX_CALLS = 1e3;
|
|
1648
1650
|
var SUPERVISOR_INTERVAL_MAX = 100;
|
|
1651
|
+
var SUPERVISOR_MODEL_ID_MAX = 512;
|
|
1649
1652
|
var SUPERVISOR_REASONING_CHARS_MAX = 5e4;
|
|
1650
1653
|
var SUPERVISOR_REASONING_MS_MAX = 6e5;
|
|
1651
1654
|
function normalizeSupervisor(value) {
|
|
1652
|
-
if (value === false) return
|
|
1655
|
+
if (value === true || value === false) return value;
|
|
1653
1656
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
1654
1657
|
throw new MantyxError(
|
|
1655
|
-
`supervisor must be
|
|
1658
|
+
`supervisor must be a boolean or an object, got ${JSON.stringify(value)}`
|
|
1656
1659
|
);
|
|
1657
1660
|
}
|
|
1658
1661
|
const out = {};
|
|
1659
1662
|
if (value.interval !== void 0) {
|
|
1660
1663
|
out.interval = assertThreshold("supervisor.interval", value.interval, 1, SUPERVISOR_INTERVAL_MAX);
|
|
1661
1664
|
}
|
|
1665
|
+
if (value.modelId !== void 0) {
|
|
1666
|
+
if (typeof value.modelId !== "string" || value.modelId.length < 1 || value.modelId.length > SUPERVISOR_MODEL_ID_MAX) {
|
|
1667
|
+
throw new MantyxError(
|
|
1668
|
+
`supervisor.modelId must be a 1..${SUPERVISOR_MODEL_ID_MAX}-char string, got ${JSON.stringify(value.modelId)}`
|
|
1669
|
+
);
|
|
1670
|
+
}
|
|
1671
|
+
out.modelId = value.modelId;
|
|
1672
|
+
}
|
|
1662
1673
|
if (value.reasoningTrigger !== void 0) {
|
|
1663
1674
|
if (value.reasoningTrigger === false) {
|
|
1664
1675
|
out.reasoningTrigger = false;
|
package/dist/client.d.ts
CHANGED
|
@@ -69,11 +69,25 @@ export interface InputFileUrlAttachmentMetadata {
|
|
|
69
69
|
}
|
|
70
70
|
/** Attachment metadata on session-event `user_message` replay frames. */
|
|
71
71
|
export type AttachmentMetadata = InputFileAttachmentMetadata | InputFileUrlAttachmentMetadata;
|
|
72
|
+
/**
|
|
73
|
+
* A retained tool call and its result, carried on a prior `assistant`
|
|
74
|
+
* message. The server replays it to the model as a `tool_use` +
|
|
75
|
+
* `tool_result` pair. Session history returns these for `retain: true`
|
|
76
|
+
* tools; one-shot runs can send them to seed replayable history.
|
|
77
|
+
*/
|
|
78
|
+
export interface ToolInteraction {
|
|
79
|
+
toolUseId: string;
|
|
80
|
+
name: string;
|
|
81
|
+
args?: Record<string, unknown>;
|
|
82
|
+
content: string;
|
|
83
|
+
}
|
|
72
84
|
/** One entry in a multi-role `messages` array. */
|
|
73
85
|
export interface ConversationMessage {
|
|
74
86
|
role: "user" | "assistant" | "system";
|
|
75
87
|
content: string;
|
|
76
88
|
attachments?: MessageAttachment[];
|
|
89
|
+
/** Retained tool interactions on an `assistant` message. */
|
|
90
|
+
toolInteractions?: ToolInteraction[];
|
|
77
91
|
}
|
|
78
92
|
/** Build an inline file attachment for the last user message in a run. */
|
|
79
93
|
export declare function inputFileAttachment(opts: {
|
|
@@ -219,6 +233,8 @@ export interface AgentSpecBase {
|
|
|
219
233
|
*/
|
|
220
234
|
reasoningLevel?: ReasoningLevel;
|
|
221
235
|
openRouterProvider?: OpenRouterProviderPreferences;
|
|
236
|
+
/** Opt into the new harness loop. Omit to inherit the session default, otherwise false. */
|
|
237
|
+
newLoop?: boolean;
|
|
222
238
|
budgets?: {
|
|
223
239
|
maxToolTurns?: number;
|
|
224
240
|
};
|
|
@@ -284,8 +300,9 @@ export interface AgentSpecBase {
|
|
|
284
300
|
* Run-supervisor (platform LLM judge). Periodically reviews the agent's
|
|
285
301
|
* transcript and may steer the run (`on_track`, `redirect`, `finalize`).
|
|
286
302
|
*
|
|
287
|
-
* Pass an object to override the review interval
|
|
288
|
-
*
|
|
303
|
+
* Pass an object to override the review interval or judge model, `true` to
|
|
304
|
+
* enable it with defaults, or `false` to explicitly disable the platform
|
|
305
|
+
* judge for this run / session. When omitted on
|
|
289
306
|
* ephemeral API runs, MANTYX enables the supervisor (default interval `5`).
|
|
290
307
|
* SDK-only runs (`runAgent` without the HTTP API) keep the supervisor off
|
|
291
308
|
* unless you pass a value here. See `docs/agent-runs-protocol.md` §4.8.
|
|
@@ -295,7 +312,7 @@ export interface AgentSpecBase {
|
|
|
295
312
|
* `action` is `redirect` or `finalize`, the pipeline has already applied
|
|
296
313
|
* the verdict by the time the event arrives.
|
|
297
314
|
*/
|
|
298
|
-
supervisor?: Supervisor |
|
|
315
|
+
supervisor?: Supervisor | boolean;
|
|
299
316
|
/**
|
|
300
317
|
* In-product **task plan** — live checklist emitted as `task_plan` SSE
|
|
301
318
|
* events and (for `planOnly` runs) returned on the terminal `result`.
|
|
@@ -434,6 +451,8 @@ export type ToolBudgets = Record<string, ToolBudget>;
|
|
|
434
451
|
export interface Supervisor {
|
|
435
452
|
/** LLM calls (`completeTurn` invocations) between supervisor reviews. */
|
|
436
453
|
interval?: number;
|
|
454
|
+
/** Model the supervisor reviews with; defaults to the platform judge model. */
|
|
455
|
+
modelId?: string;
|
|
437
456
|
/** Mid-turn reasoning trigger, or `false` to disable. */
|
|
438
457
|
reasoningTrigger?: ReasoningTrigger | false;
|
|
439
458
|
}
|
|
@@ -1144,6 +1163,8 @@ export declare class AgentSession {
|
|
|
1144
1163
|
*/
|
|
1145
1164
|
reasoningLevel?: ReasoningLevel;
|
|
1146
1165
|
openRouterProvider?: OpenRouterProviderPreferences;
|
|
1166
|
+
/** Override the execution mode for this message; omission inherits the session default. */
|
|
1167
|
+
newLoop?: boolean;
|
|
1147
1168
|
/**
|
|
1148
1169
|
* Per-message override for `outputSchema`. Applies only to this run
|
|
1149
1170
|
* and does not mutate the session's stored value.
|
|
@@ -1165,7 +1186,7 @@ export declare class AgentSession {
|
|
|
1165
1186
|
* and does not mutate the session's stored value. Pass `false` to
|
|
1166
1187
|
* disable the platform judge for this single turn.
|
|
1167
1188
|
*/
|
|
1168
|
-
supervisor?: Supervisor |
|
|
1189
|
+
supervisor?: Supervisor | boolean;
|
|
1169
1190
|
/**
|
|
1170
1191
|
* Per-message override for `plan`. Applies only to this run and does
|
|
1171
1192
|
* not mutate the session's stored value. See {@link AgentSpecBase.plan}.
|
|
@@ -1187,10 +1208,12 @@ export declare class AgentSession {
|
|
|
1187
1208
|
metadata?: Record<string, string>;
|
|
1188
1209
|
reasoningLevel?: ReasoningLevel;
|
|
1189
1210
|
openRouterProvider?: OpenRouterProviderPreferences;
|
|
1211
|
+
/** Override the execution mode for this message; omission inherits the session default. */
|
|
1212
|
+
newLoop?: boolean;
|
|
1190
1213
|
outputSchema?: OutputSchema;
|
|
1191
1214
|
loopDetection?: LoopDetection | false;
|
|
1192
1215
|
toolBudgets?: ToolBudgets;
|
|
1193
|
-
supervisor?: Supervisor |
|
|
1216
|
+
supervisor?: Supervisor | boolean;
|
|
1194
1217
|
plan?: PlanSpec;
|
|
1195
1218
|
turnInstructions?: string;
|
|
1196
1219
|
turnInstructionsAuthority?: TurnInstructionsAuthority;
|
|
@@ -1205,10 +1228,12 @@ export declare class AgentSession {
|
|
|
1205
1228
|
metadata?: Record<string, string>;
|
|
1206
1229
|
reasoningLevel?: ReasoningLevel;
|
|
1207
1230
|
openRouterProvider?: OpenRouterProviderPreferences;
|
|
1231
|
+
/** Override the execution mode for this message; omission inherits the session default. */
|
|
1232
|
+
newLoop?: boolean;
|
|
1208
1233
|
outputSchema?: OutputSchema;
|
|
1209
1234
|
loopDetection?: LoopDetection | false;
|
|
1210
1235
|
toolBudgets?: ToolBudgets;
|
|
1211
|
-
supervisor?: Supervisor |
|
|
1236
|
+
supervisor?: Supervisor | boolean;
|
|
1212
1237
|
steps?: string[];
|
|
1213
1238
|
brief?: string;
|
|
1214
1239
|
}): Promise<RunResult>;
|
package/dist/computer-use.d.ts
CHANGED
|
@@ -86,7 +86,7 @@ export interface DefineComputerUseToolsOptions {
|
|
|
86
86
|
*/
|
|
87
87
|
requestConfirmation?: boolean;
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
89
|
+
* Operator confirmation gate invoked by the `request_confirmation` tool. Return
|
|
90
90
|
* `true` to allow the model to continue with the action it described.
|
|
91
91
|
*/
|
|
92
92
|
confirm?: (reason: string) => boolean | Promise<boolean>;
|
|
@@ -108,7 +108,7 @@ export interface ComputerUseSystemPromptOptions {
|
|
|
108
108
|
/**
|
|
109
109
|
* Build the system prompt that drives the loop: it teaches the model the
|
|
110
110
|
* screenshot-per-step protocol, the 0-1000 coordinate grid, the one-action-per-turn
|
|
111
|
-
* discipline, when to stop, and the
|
|
111
|
+
* discipline, when to stop, and the operator-confirmation safety rules.
|
|
112
112
|
*/
|
|
113
113
|
export declare function buildComputerUseSystemPrompt(opts?: ComputerUseSystemPromptOptions): string;
|
|
114
114
|
/** One action the model invoked on a turn (derived from `local_tool_call` events). */
|
|
@@ -144,11 +144,12 @@ export interface RunComputerUseOptions {
|
|
|
144
144
|
systemPromptOptions?: ComputerUseSystemPromptOptions;
|
|
145
145
|
/** Actions to omit from the tool surface. */
|
|
146
146
|
excludeActions?: ComputerUseAction[];
|
|
147
|
-
/**
|
|
147
|
+
/** Operator confirmation gate for `request_confirmation`. Omit to disable confirmations. */
|
|
148
148
|
confirm?: (reason: string) => boolean | Promise<boolean>;
|
|
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
|
}
|
|
@@ -1718,19 +1720,28 @@ var TOOL_BUDGETS_MAX_ENTRIES = 32;
|
|
|
1718
1720
|
var TOOL_BUDGET_MAX_NAME_LEN = 120;
|
|
1719
1721
|
var TOOL_BUDGET_MAX_CALLS = 1e3;
|
|
1720
1722
|
var SUPERVISOR_INTERVAL_MAX = 100;
|
|
1723
|
+
var SUPERVISOR_MODEL_ID_MAX = 512;
|
|
1721
1724
|
var SUPERVISOR_REASONING_CHARS_MAX = 5e4;
|
|
1722
1725
|
var SUPERVISOR_REASONING_MS_MAX = 6e5;
|
|
1723
1726
|
function normalizeSupervisor(value) {
|
|
1724
|
-
if (value === false) return
|
|
1727
|
+
if (value === true || value === false) return value;
|
|
1725
1728
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
1726
1729
|
throw new MantyxError(
|
|
1727
|
-
`supervisor must be
|
|
1730
|
+
`supervisor must be a boolean or an object, got ${JSON.stringify(value)}`
|
|
1728
1731
|
);
|
|
1729
1732
|
}
|
|
1730
1733
|
const out = {};
|
|
1731
1734
|
if (value.interval !== void 0) {
|
|
1732
1735
|
out.interval = assertThreshold("supervisor.interval", value.interval, 1, SUPERVISOR_INTERVAL_MAX);
|
|
1733
1736
|
}
|
|
1737
|
+
if (value.modelId !== void 0) {
|
|
1738
|
+
if (typeof value.modelId !== "string" || value.modelId.length < 1 || value.modelId.length > SUPERVISOR_MODEL_ID_MAX) {
|
|
1739
|
+
throw new MantyxError(
|
|
1740
|
+
`supervisor.modelId must be a 1..${SUPERVISOR_MODEL_ID_MAX}-char string, got ${JSON.stringify(value.modelId)}`
|
|
1741
|
+
);
|
|
1742
|
+
}
|
|
1743
|
+
out.modelId = value.modelId;
|
|
1744
|
+
}
|
|
1734
1745
|
if (value.reasoningTrigger !== void 0) {
|
|
1735
1746
|
if (value.reasoningTrigger === false) {
|
|
1736
1747
|
out.reasoningTrigger = false;
|
|
@@ -2560,6 +2571,7 @@ async function runComputerUse(opts) {
|
|
|
2560
2571
|
systemPrompt,
|
|
2561
2572
|
...opts.model ? { modelId: opts.model } : {},
|
|
2562
2573
|
tools,
|
|
2574
|
+
...opts.newLoop !== void 0 ? { newLoop: opts.newLoop } : {},
|
|
2563
2575
|
...opts.reasoningLevel !== void 0 ? { reasoningLevel: opts.reasoningLevel } : {},
|
|
2564
2576
|
...opts.metadata ? { metadata: opts.metadata } : {}
|
|
2565
2577
|
});
|
|
@@ -2599,7 +2611,7 @@ async function runComputerUse(opts) {
|
|
|
2599
2611
|
}
|
|
2600
2612
|
|
|
2601
2613
|
// src/version.ts
|
|
2602
|
-
var SDK_VERSION = "2026.11.
|
|
2614
|
+
var SDK_VERSION = "2026.11.11";
|
|
2603
2615
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2604
2616
|
0 && (module.exports = {
|
|
2605
2617
|
AgentSession,
|
package/dist/index.d.ts
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
*/
|
|
36
36
|
export type { DecisionContent, DecisionQuestion, DecisionRequest, DecisionAnswer, DecisionResult, DecisionModelInfo, DecisionRunSummary, DecisionRunDetail, DecisionRunList } from "./decisions.js";
|
|
37
37
|
export { MantyxClient, AgentSession, DEFAULT_BASE_URL, parseRunOutput, planOnly, taskPlanFromEventData, inputFileAttachment, inputFileUrlAttachment, } from "./client.js";
|
|
38
|
-
export type { MantyxClientOptions, ModelInfo, ModelCatalog, AgentSpecBase, RunSpec, SessionSpec, OutputSchema, OutputSchemaValue, LoopDetection, ToolBudget, ToolBudgets, Supervisor, SupervisorAction, SupervisorPhase, ReasoningTrigger, PlanOptions, PlanMode, PlanSpec, TaskPlan, TaskPlanStep, TaskPlanStepStatus, TaskPlanTransition, RunResult, RunTokenUsage, RunModelInfo, RunEvent, RunEventBase, AssistantDeltaEvent, ThinkingDeltaEvent, AssistantMessageEvent, ModelFallbackEvent, UserMessageEvent, InputFileAttachment, InputFileUrlAttachment, MessageAttachment, InputFileAttachmentMetadata, InputFileUrlAttachmentMetadata, AttachmentMetadata, ConversationMessage, ServerToolResultEvent, LocalToolCallEvent, LocalToolResultInEvent, LoopDetectedEvent, ToolBudgetExceededEvent, SupervisorEvent, TaskPlanEvent, ResultEvent, ErrorEvent, CancelledEvent, SessionInfo, SessionSummary, SessionListResult, SessionEventsPage, LocalHandlers, RunFeedbackVerdict, TurnInstructionsAuthority, RunFeedbackInput, RunFeedbackResult, } from "./client.js";
|
|
38
|
+
export type { MantyxClientOptions, ModelInfo, ModelCatalog, AgentSpecBase, RunSpec, SessionSpec, OutputSchema, OutputSchemaValue, LoopDetection, ToolBudget, ToolBudgets, Supervisor, SupervisorAction, SupervisorPhase, ReasoningTrigger, PlanOptions, PlanMode, PlanSpec, TaskPlan, TaskPlanStep, TaskPlanStepStatus, TaskPlanTransition, RunResult, RunTokenUsage, RunModelInfo, RunEvent, RunEventBase, AssistantDeltaEvent, ThinkingDeltaEvent, AssistantMessageEvent, ModelFallbackEvent, UserMessageEvent, InputFileAttachment, InputFileUrlAttachment, MessageAttachment, InputFileAttachmentMetadata, InputFileUrlAttachmentMetadata, AttachmentMetadata, ConversationMessage, ToolInteraction, ServerToolResultEvent, LocalToolCallEvent, LocalToolResultInEvent, LoopDetectedEvent, ToolBudgetExceededEvent, SupervisorEvent, TaskPlanEvent, ResultEvent, ErrorEvent, CancelledEvent, SessionInfo, SessionSummary, SessionListResult, SessionEventsPage, LocalHandlers, RunFeedbackVerdict, TurnInstructionsAuthority, RunFeedbackInput, RunFeedbackResult, } from "./client.js";
|
|
39
39
|
export { defineLocalTool, mantyxA2A, defineLocalA2A, mantyxMcp, defineLocalMcp, isLocalTool, isLocalA2ATool, isLocalMcpServer, } from "./tools.js";
|
|
40
40
|
export type { LocalTool, LocalToolResult, LocalToolOutput, ToolResultFile, ToolRef, ZodLikeObject, DefineLocalToolOptions, ReasoningLevel, A2AToolRef, LocalA2ATool, McpToolRef, LocalMcpServer, LocalMcpHttpTransport, LocalMcpStdioTransport, MantyxA2AOptions, DefineLocalA2AOptions, MantyxMcpOptions, DefineLocalMcpOptions, } from "./tools.js";
|
|
41
41
|
export { MantyxError, MantyxAuthError, MantyxNetworkError, MantyxParseError, MantyxScopeError, MantyxToolError, MantyxRunError, } from "./errors.js";
|
package/dist/index.js
CHANGED
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
taskPlanFromEventData,
|
|
26
26
|
toToolParametersWire,
|
|
27
27
|
zodToJsonSchema
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-KPAGE6FD.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.
|
|
605
|
+
var SDK_VERSION = "2026.11.11";
|
|
605
606
|
export {
|
|
606
607
|
AgentSession,
|
|
607
608
|
COMPUTER_USE_ACTIONS,
|
package/dist/version.d.ts
CHANGED
|
@@ -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",
|
|
@@ -458,7 +459,7 @@ selector grammar as `modelId`. TypeScript uses `fallbackModelId`, Python uses
|
|
|
458
459
|
`fallback_model_id`, and Go uses `FallbackModelID`. The fallback must resolve
|
|
459
460
|
to a different provider/model pair from the primary.
|
|
460
461
|
|
|
461
|
-
During agent execution (including
|
|
462
|
+
During agent execution (including resumes after a worker shutdown), after normal
|
|
462
463
|
retries are exhausted, MANTYX switches the failed model invocation
|
|
463
464
|
for retryable overload, provider server, unreachable-provider, or upstream
|
|
464
465
|
timeout errors. It does not switch for authentication, invalid requests, quota
|
|
@@ -558,8 +559,8 @@ Rules:
|
|
|
558
559
|
- They stay in effect for the whole run: context compaction that drops or
|
|
559
560
|
summarizes the run's user message keeps the instructions, and they count
|
|
560
561
|
toward the context budget.
|
|
561
|
-
- A run that resumes after
|
|
562
|
-
|
|
562
|
+
- A run that resumes after a worker shutdown keeps the instructions it
|
|
563
|
+
started with, in the same placement.
|
|
563
564
|
- File attachments on the user message are unaffected.
|
|
564
565
|
|
|
565
566
|
SDKs: TypeScript `turnInstructions` / `turnInstructionsAuthority` (run spec,
|
|
@@ -828,7 +829,7 @@ For direct OpenAI reasoning runs, MANTYX keeps `store: false` and carries the
|
|
|
828
829
|
Responses API's encrypted reasoning items across tool turns. Long-running
|
|
829
830
|
OpenAI contexts can additionally use provider-native compaction, which replaces
|
|
830
831
|
the earlier in-run prefix with an opaque retained-context item instead of
|
|
831
|
-
silently dropping it. These opaque items survive
|
|
832
|
+
silently dropping it. These opaque items survive shutdown checkpoints,
|
|
832
833
|
but are intentionally not persisted into the next separate user message.
|
|
833
834
|
OpenRouter, Grok, and generic OpenAI-compatible providers do not receive these
|
|
834
835
|
OpenAI-specific request fields.
|
|
@@ -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`
|
|
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,70 @@ 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 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
|
+
Explicit guard settings and maximum tool-turn limits remain in force. This mode does not introduce a code workbench, persistent
|
|
964
|
+
specialist sessions, or provider-native history across separate user messages.
|
|
965
|
+
Provider-native compaction retains its separate explicit setting.
|
|
966
|
+
Completion verification still depends on the host's guard and available evidence;
|
|
967
|
+
the loop does not independently prove that every requested task is complete.
|
|
968
|
+
The deterministic regression harness is documented in `docs/harness-testing.md`
|
|
969
|
+
in the repository.
|
|
970
|
+
|
|
971
|
+
TypeScript: `client.runAgent({ systemPrompt: "Help", prompt: "Do the task", newLoop: true })`.
|
|
972
|
+
Python: `client.run_agent(system_prompt="Help", prompt="Do the task", new_loop=True)`.
|
|
973
|
+
Go: set `RunSpec.NewLoop` / `SessionSpec.NewLoop` to a boolean pointer, or use
|
|
974
|
+
`WithNewLoop(true)` on a session message. The internal runtime accepts
|
|
975
|
+
`RunAgentOptions.newLoop` as well.
|
|
976
|
+
|
|
912
977
|
### 4.5 `outputSchema` (structured final reply)
|
|
913
978
|
|
|
914
979
|
`outputSchema` constrains the model's **final assistant text** to a JSON
|
|
@@ -1387,6 +1452,20 @@ spec, plus the cost-attribution triple `tokens` / `turns` / `model` —
|
|
|
1387
1452
|
see §7.1) without subscribing to live events. Useful for polling long
|
|
1388
1453
|
runs or attributing spend after the SSE stream was already consumed.
|
|
1389
1454
|
|
|
1455
|
+
A run's `status` is one of:
|
|
1456
|
+
|
|
1457
|
+
| Status | Meaning |
|
|
1458
|
+
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1459
|
+
| `queued` | Accepted, waiting for a worker. |
|
|
1460
|
+
| `running` | A worker is executing the agent loop. |
|
|
1461
|
+
| `awaiting_local_tool` | Suspended until the client posts the result of a client-resolved tool (§8). The SSE stream stays open, and the run continues on the same stream as soon as `POST .../tool-results` arrives. Not terminal: keep reading the stream. |
|
|
1462
|
+
| `succeeded` | Terminal: the stream ended with a `result` event. |
|
|
1463
|
+
| `failed` | Terminal: the stream ended with an `error` event (or a non-success `result`). |
|
|
1464
|
+
| `cancelled` | Terminal: the stream ended with a `cancelled` event. |
|
|
1465
|
+
|
|
1466
|
+
Clients should treat unknown status values as non-terminal and keep
|
|
1467
|
+
following the stream.
|
|
1468
|
+
|
|
1390
1469
|
## 6. Sessions
|
|
1391
1470
|
|
|
1392
1471
|
```
|
|
@@ -1564,8 +1643,7 @@ data: <utf-8 JSON>
|
|
|
1564
1643
|
{ "seq": 4, "type": "tool_call", "data": { "toolUseId": "...", "name": "...", "input": {...} } }
|
|
1565
1644
|
{ "seq": 5, "type": "tool_result", "data": { "toolUseId": "...", "name": "...", "ok": true, "summary": "..." } }
|
|
1566
1645
|
|
|
1567
|
-
// files a server-
|
|
1568
|
-
// `storageKey` → fetch via the admin download route; inline base64 `data` (dev fallback) is redacted from the stream.
|
|
1646
|
+
// historical only (replays of old runs): files a removed server-executed tool produced; no longer emitted.
|
|
1569
1647
|
{ "seq": 5, "type": "tool_files", "data": { "name": "render_chart", "files": [ { "filename": "chart.png", "mimeType": "image/png", "sizeBytes": 20480, "storageKey": "chat-attachments/<tenant>/tool-results/<tool>/<uuid>.png" } ] } }
|
|
1570
1648
|
|
|
1571
1649
|
// LOCAL tool call — SDK MUST POST a tool-result for the same toolUseId.
|
|
@@ -1770,6 +1848,11 @@ Content-Type: application/json
|
|
|
1770
1848
|
already satisfied, or the run has terminated. `409 run_terminal` if the run
|
|
1771
1849
|
has already produced a `result` event.
|
|
1772
1850
|
|
|
1851
|
+
While a `local_tool_call` is unanswered the run reports status
|
|
1852
|
+
`awaiting_local_tool`. The SSE stream stays open (only `: ping` keep-alive
|
|
1853
|
+
comments arrive meanwhile) and the run continues on the same stream once the
|
|
1854
|
+
result is posted; there is no separate resume call.
|
|
1855
|
+
|
|
1773
1856
|
`result` MUST be a string; SDKs serialize structured outputs as JSON before
|
|
1774
1857
|
posting. Errors are surfaced to the model as a tool-error response.
|
|
1775
1858
|
|
|
@@ -1842,9 +1925,12 @@ listing has no `agentId` or `targetKinds` filter.
|
|
|
1842
1925
|
|
|
1843
1926
|
Developer API requests use fixed 60-second sliding windows keyed by workspace
|
|
1844
1927
|
and credential. New run starts have their own bucket (default 120/min);
|
|
1845
|
-
tool
|
|
1928
|
+
local-tool results have their own (default 6,000/min, never below the
|
|
1929
|
+
workspace's lifecycle value); feedback and cancellation use the lifecycle
|
|
1846
1930
|
bucket (default 600/min); other mutations default to 120/min. Platform
|
|
1847
|
-
operators can override
|
|
1931
|
+
operators can override the run-start, lifecycle and mutation maxima per
|
|
1932
|
+
workspace. The SDKs retry a tool result that gets a 429 with backoff; a
|
|
1933
|
+
result that never lands leaves the run waiting until the local-tool timeout. Reads, status checks,
|
|
1848
1934
|
and SSE opens/reconnects use a separate high transport limit and never consume
|
|
1849
1935
|
run-start capacity.
|
|
1850
1936
|
|
package/docs/wire-protocol.md
CHANGED
|
@@ -426,13 +426,13 @@ The vocabulary (`EphemeralEventType` in `bus.ts`):
|
|
|
426
426
|
| `assistant_delta` | M → SDK | Many | Streamed assistant text token / chunk. |
|
|
427
427
|
| `thinking_delta` | M → SDK | Many (iff `reasoningLevel > 0`) | Streamed extended-thinking text (provider redacts when policy requires). |
|
|
428
428
|
| `tool_result` | M → SDK | Per server-resolved tool call | Informational — tells the SDK that MANTYX ran a server-resolved tool (`a2a`, `mcp`) and got a result. The SDK does not need to act on it. |
|
|
429
|
-
| `tool_files` | M → SDK |
|
|
429
|
+
| `tool_files` | M → SDK | Historical: no longer emitted | Only in replays of old runs (see §4.2.1): file metadata a removed server-executed tool kind produced. Inline bytes are redacted from the stream; download via the admin route. SDKs may ignore it. |
|
|
430
430
|
| `local_tool_call` | M → SDK | Per client-resolved tool call | **Action required.** SDK must POST a tool-result. |
|
|
431
431
|
| `local_tool_result_in` | M → SDK | Per client-resolved tool call | Informational mirror of the tool-result the SDK just posted, persisted for observability. Re-emitted to late subscribers so they can replay the conversation. Any `files` carry only metadata on the wire (base64 `data` is redacted). |
|
|
432
432
|
| `loop_detected` | M → SDK | 0–2× per run (soft nudge + optional hard cutoff) | Observability for the loop-detection guard (see §8). The server already substituted the synthetic skip + steering nudge — SDK clients render a status note (`looping — nudged` / `looping — gave up`) and otherwise leave the run alone. |
|
|
433
433
|
| `tool_budget_exceeded` | M → SDK | Per intercepted tool call | Observability for per-tool call budgets (see §8). The synthetic `tool_result` carrying the "budget exceeded — pivot or finalize" body lands on the normal tool-result channel; this event is purely so SDK clients can surface a UI banner. |
|
|
434
434
|
| `supervisor` | M → SDK | 0–N× per run (every `interval` LLM calls) | Run-supervisor check (see §4.7 / §8.4). Fired on **every** review — including `on_track` — so SDK clients can render supervisor activity. When the judge steers the run (`redirect` / `finalize`), the pipeline has already injected the steering message or forced a tools-disabled finalize turn. |
|
|
435
|
-
| `task_plan` | M → SDK | 0–N× per run (iff `plan` set) | Observability for the task plan (see §4.9 / §8.5). Emitted
|
|
435
|
+
| `task_plan` | M → SDK | 0–N× per run (iff `plan` set) | Observability for the task plan (see §4.9 / §8.5). Emitted when the plan is created (caller-supplied, agent-created, or classified for `planOnly`), then again whenever the agent's `update_task_plan` call changes step statuses. **Non-terminal.** For `planOnly` runs the final plan also rides on the terminal `result` under `data.plan`. |
|
|
436
436
|
| `assistant_message` | M → SDK | 1× per turn | Final assistant message for the turn (concatenated, persistence-ready). |
|
|
437
437
|
| `result` | M → SDK | 1× terminal | Successful completion. Carries the final assistant text and run summary. |
|
|
438
438
|
| `error` | M → SDK | 1× terminal | Failure. Carries `error` (message), `code` / `errorClass` (category), `finishReason`, and an optional `partialText` salvage payload. See §4.7. |
|
|
@@ -469,14 +469,13 @@ progress text — it's not part of the canonical assistant response.
|
|
|
469
469
|
|
|
470
470
|
Purely informational. The SDK does not respond.
|
|
471
471
|
|
|
472
|
-
### 4.2.1 `tool_files` (
|
|
472
|
+
### 4.2.1 `tool_files` (historical)
|
|
473
473
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
and
|
|
479
|
-
`tool_result` summary and shares its display `name`.
|
|
474
|
+
No current tool kind emits this event. It appears only when replaying runs
|
|
475
|
+
recorded while server-executed workspace tools existed: file metadata for files
|
|
476
|
+
such a tool produced, preceding the matching `tool_result` summary and sharing
|
|
477
|
+
its display `name`. It was purely for observability (the Calls dashboard lists
|
|
478
|
+
and downloads the files); SDK clients may ignore it.
|
|
480
479
|
|
|
481
480
|
```jsonc
|
|
482
481
|
{
|
|
@@ -949,7 +948,7 @@ non-breaking since those return types were already objects).
|
|
|
949
948
|
{ "title": "Compute deltas by segment", "status": "pending" },
|
|
950
949
|
{ "title": "Summarize the top drivers", "status": "pending" } ] } }
|
|
951
950
|
|
|
952
|
-
//
|
|
951
|
+
// Plan update — emitted whenever step statuses change during the run.
|
|
953
952
|
{ "seq": 18, "type": "task_plan",
|
|
954
953
|
"data": { "brief": "Compare Q3 vs Q4 revenue and summarize drivers.",
|
|
955
954
|
"steps": [ { "title": "Pull Q3 and Q4 revenue", "status": "done" },
|
|
@@ -1006,10 +1005,13 @@ Server response codes:
|
|
|
1006
1005
|
| `404` | `unknown_tool_use` — `toolUseId` doesn't match any pending call (already answered or unknown id). |
|
|
1007
1006
|
| `409` | `run_terminal` — the run already finished (success, failure, cancel, or local-tool timeout). The result is dropped. |
|
|
1008
1007
|
|
|
1009
|
-
The runner
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1008
|
+
The runner waits a few seconds in process for a result; after that the
|
|
1009
|
+
run is suspended (`awaiting_local_tool`) and resumes once every pending
|
|
1010
|
+
call has a posted result. A call with no result within the local-tool
|
|
1011
|
+
timeout (default 5 minutes) is resumed as a
|
|
1012
|
+
"Timed out waiting for local tool result" tool error. A `409` for a
|
|
1013
|
+
tool-result POST means the run already ended (for example it was
|
|
1014
|
+
cancelled).
|
|
1013
1015
|
|
|
1014
1016
|
---
|
|
1015
1017
|
|
|
@@ -1235,8 +1237,8 @@ banners without re-parsing tool-result bodies:
|
|
|
1235
1237
|
- `tool_budget_exceeded` — fired each time a call is intercepted. See §4.6.
|
|
1236
1238
|
- `supervisor` — fired on every run-supervisor review (`on_track`,
|
|
1237
1239
|
`redirect`, or `finalize`). See §4.7.
|
|
1238
|
-
- `task_plan` — fired when a run carries a `plan` spec field:
|
|
1239
|
-
|
|
1240
|
+
- `task_plan` — fired when a run carries a `plan` spec field: when the
|
|
1241
|
+
plan is created, then on each accepted `update_task_plan` change. See §4.9 / §8.5.
|
|
1240
1242
|
|
|
1241
1243
|
Both guard events (`loop_detected`, `tool_budget_exceeded`) are
|
|
1242
1244
|
observability-only: the server has already substituted the synthetic
|
|
@@ -1378,8 +1380,8 @@ When the classifier declines in plan-only mode, `data.plan.steps` is `[]` and
|
|
|
1378
1380
|
`data.text` explains that no multi-step plan was warranted. Plan-only runs do
|
|
1379
1381
|
**not** append an assistant turn to a session (the plan is not the answer).
|
|
1380
1382
|
|
|
1381
|
-
Planner LLM usage (the
|
|
1382
|
-
|
|
1383
|
+
Planner LLM usage (the plan-only classifier) is metered under the
|
|
1384
|
+
`task_planning` usage surface for cost attribution.
|
|
1383
1385
|
|
|
1384
1386
|
### 8.6 Session inheritance
|
|
1385
1387
|
|
|
@@ -1401,11 +1403,11 @@ POST /api/v1/workspaces/{slug}/agent-runs/{runId}/cancel
|
|
|
1401
1403
|
Authorization: Bearer <api-key>
|
|
1402
1404
|
```
|
|
1403
1405
|
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1406
|
+
Marks the run `cancelled`, appends the terminal `cancelled` event, and
|
|
1407
|
+
publishes a Valkey signal. The runner stops at once (the in-flight model
|
|
1408
|
+
call is torn down and pending local-tool waits end) and writes nothing
|
|
1409
|
+
more: no `result` or `error` follows `cancelled`. Results posted for
|
|
1410
|
+
outstanding `local_tool_call`s are refused with `409`.
|
|
1409
1411
|
|
|
1410
1412
|
---
|
|
1411
1413
|
|
|
@@ -1414,9 +1416,8 @@ terminal event.
|
|
|
1414
1416
|
- Every event has a monotonically-increasing `seq` per run, persisted to
|
|
1415
1417
|
`EphemeralAgentRunEvent`. Reopen with `Last-Event-ID: <seq>` to resume.
|
|
1416
1418
|
- The Valkey pub/sub is best-effort; the persisted log is the source of
|
|
1417
|
-
truth.
|
|
1418
|
-
|
|
1419
|
-
runner.
|
|
1419
|
+
truth. A run waiting on local tool results reads them from the
|
|
1420
|
+
database when it resumes, so a missed publish never loses a result.
|
|
1420
1421
|
- `local_tool_result_in` is persisted in addition to the live publish, so
|
|
1421
1422
|
late-joining viewers can replay the SDK's response.
|
|
1422
1423
|
- Tool-result POSTs are idempotent on `toolUseId`: a second POST for the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mantyx/sdk",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.11",
|
|
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.
|
|
65
|
+
"vitest": "^5.1.1"
|
|
66
66
|
},
|
|
67
67
|
"keywords": [
|
|
68
68
|
"mantyx",
|