@mantyx/sdk 2026.11.10 → 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 +12 -0
- package/dist/a2a-server.js +1 -1
- package/dist/{chunk-LISLOB7S.js → chunk-KPAGE6FD.js} +11 -2
- package/dist/client.d.ts +23 -6
- package/dist/computer-use.d.ts +3 -3
- package/dist/index.cjs +12 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/version.d.ts +1 -1
- package/docs/agent-runs-protocol.md +31 -11
- package/docs/wire-protocol.md +27 -26
- package/package.json +1 -1
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
|
package/dist/a2a-server.js
CHANGED
|
@@ -1648,19 +1648,28 @@ var TOOL_BUDGETS_MAX_ENTRIES = 32;
|
|
|
1648
1648
|
var TOOL_BUDGET_MAX_NAME_LEN = 120;
|
|
1649
1649
|
var TOOL_BUDGET_MAX_CALLS = 1e3;
|
|
1650
1650
|
var SUPERVISOR_INTERVAL_MAX = 100;
|
|
1651
|
+
var SUPERVISOR_MODEL_ID_MAX = 512;
|
|
1651
1652
|
var SUPERVISOR_REASONING_CHARS_MAX = 5e4;
|
|
1652
1653
|
var SUPERVISOR_REASONING_MS_MAX = 6e5;
|
|
1653
1654
|
function normalizeSupervisor(value) {
|
|
1654
|
-
if (value === false) return
|
|
1655
|
+
if (value === true || value === false) return value;
|
|
1655
1656
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
1656
1657
|
throw new MantyxError(
|
|
1657
|
-
`supervisor must be
|
|
1658
|
+
`supervisor must be a boolean or an object, got ${JSON.stringify(value)}`
|
|
1658
1659
|
);
|
|
1659
1660
|
}
|
|
1660
1661
|
const out = {};
|
|
1661
1662
|
if (value.interval !== void 0) {
|
|
1662
1663
|
out.interval = assertThreshold("supervisor.interval", value.interval, 1, SUPERVISOR_INTERVAL_MAX);
|
|
1663
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
|
+
}
|
|
1664
1673
|
if (value.reasoningTrigger !== void 0) {
|
|
1665
1674
|
if (value.reasoningTrigger === false) {
|
|
1666
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: {
|
|
@@ -286,8 +300,9 @@ export interface AgentSpecBase {
|
|
|
286
300
|
* Run-supervisor (platform LLM judge). Periodically reviews the agent's
|
|
287
301
|
* transcript and may steer the run (`on_track`, `redirect`, `finalize`).
|
|
288
302
|
*
|
|
289
|
-
* Pass an object to override the review interval
|
|
290
|
-
*
|
|
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
|
|
291
306
|
* ephemeral API runs, MANTYX enables the supervisor (default interval `5`).
|
|
292
307
|
* SDK-only runs (`runAgent` without the HTTP API) keep the supervisor off
|
|
293
308
|
* unless you pass a value here. See `docs/agent-runs-protocol.md` §4.8.
|
|
@@ -297,7 +312,7 @@ export interface AgentSpecBase {
|
|
|
297
312
|
* `action` is `redirect` or `finalize`, the pipeline has already applied
|
|
298
313
|
* the verdict by the time the event arrives.
|
|
299
314
|
*/
|
|
300
|
-
supervisor?: Supervisor |
|
|
315
|
+
supervisor?: Supervisor | boolean;
|
|
301
316
|
/**
|
|
302
317
|
* In-product **task plan** — live checklist emitted as `task_plan` SSE
|
|
303
318
|
* events and (for `planOnly` runs) returned on the terminal `result`.
|
|
@@ -436,6 +451,8 @@ export type ToolBudgets = Record<string, ToolBudget>;
|
|
|
436
451
|
export interface Supervisor {
|
|
437
452
|
/** LLM calls (`completeTurn` invocations) between supervisor reviews. */
|
|
438
453
|
interval?: number;
|
|
454
|
+
/** Model the supervisor reviews with; defaults to the platform judge model. */
|
|
455
|
+
modelId?: string;
|
|
439
456
|
/** Mid-turn reasoning trigger, or `false` to disable. */
|
|
440
457
|
reasoningTrigger?: ReasoningTrigger | false;
|
|
441
458
|
}
|
|
@@ -1169,7 +1186,7 @@ export declare class AgentSession {
|
|
|
1169
1186
|
* and does not mutate the session's stored value. Pass `false` to
|
|
1170
1187
|
* disable the platform judge for this single turn.
|
|
1171
1188
|
*/
|
|
1172
|
-
supervisor?: Supervisor |
|
|
1189
|
+
supervisor?: Supervisor | boolean;
|
|
1173
1190
|
/**
|
|
1174
1191
|
* Per-message override for `plan`. Applies only to this run and does
|
|
1175
1192
|
* not mutate the session's stored value. See {@link AgentSpecBase.plan}.
|
|
@@ -1196,7 +1213,7 @@ export declare class AgentSession {
|
|
|
1196
1213
|
outputSchema?: OutputSchema;
|
|
1197
1214
|
loopDetection?: LoopDetection | false;
|
|
1198
1215
|
toolBudgets?: ToolBudgets;
|
|
1199
|
-
supervisor?: Supervisor |
|
|
1216
|
+
supervisor?: Supervisor | boolean;
|
|
1200
1217
|
plan?: PlanSpec;
|
|
1201
1218
|
turnInstructions?: string;
|
|
1202
1219
|
turnInstructionsAuthority?: TurnInstructionsAuthority;
|
|
@@ -1216,7 +1233,7 @@ export declare class AgentSession {
|
|
|
1216
1233
|
outputSchema?: OutputSchema;
|
|
1217
1234
|
loopDetection?: LoopDetection | false;
|
|
1218
1235
|
toolBudgets?: ToolBudgets;
|
|
1219
|
-
supervisor?: Supervisor |
|
|
1236
|
+
supervisor?: Supervisor | boolean;
|
|
1220
1237
|
steps?: string[];
|
|
1221
1238
|
brief?: string;
|
|
1222
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,7 +144,7 @@ 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;
|
package/dist/index.cjs
CHANGED
|
@@ -1720,19 +1720,28 @@ var TOOL_BUDGETS_MAX_ENTRIES = 32;
|
|
|
1720
1720
|
var TOOL_BUDGET_MAX_NAME_LEN = 120;
|
|
1721
1721
|
var TOOL_BUDGET_MAX_CALLS = 1e3;
|
|
1722
1722
|
var SUPERVISOR_INTERVAL_MAX = 100;
|
|
1723
|
+
var SUPERVISOR_MODEL_ID_MAX = 512;
|
|
1723
1724
|
var SUPERVISOR_REASONING_CHARS_MAX = 5e4;
|
|
1724
1725
|
var SUPERVISOR_REASONING_MS_MAX = 6e5;
|
|
1725
1726
|
function normalizeSupervisor(value) {
|
|
1726
|
-
if (value === false) return
|
|
1727
|
+
if (value === true || value === false) return value;
|
|
1727
1728
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
1728
1729
|
throw new MantyxError(
|
|
1729
|
-
`supervisor must be
|
|
1730
|
+
`supervisor must be a boolean or an object, got ${JSON.stringify(value)}`
|
|
1730
1731
|
);
|
|
1731
1732
|
}
|
|
1732
1733
|
const out = {};
|
|
1733
1734
|
if (value.interval !== void 0) {
|
|
1734
1735
|
out.interval = assertThreshold("supervisor.interval", value.interval, 1, SUPERVISOR_INTERVAL_MAX);
|
|
1735
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
|
+
}
|
|
1736
1745
|
if (value.reasoningTrigger !== void 0) {
|
|
1737
1746
|
if (value.reasoningTrigger === false) {
|
|
1738
1747
|
out.reasoningTrigger = false;
|
|
@@ -2602,7 +2611,7 @@ async function runComputerUse(opts) {
|
|
|
2602
2611
|
}
|
|
2603
2612
|
|
|
2604
2613
|
// src/version.ts
|
|
2605
|
-
var SDK_VERSION = "2026.11.
|
|
2614
|
+
var SDK_VERSION = "2026.11.11";
|
|
2606
2615
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2607
2616
|
0 && (module.exports = {
|
|
2608
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";
|
|
@@ -602,7 +602,7 @@ async function runComputerUse(opts) {
|
|
|
602
602
|
}
|
|
603
603
|
|
|
604
604
|
// src/version.ts
|
|
605
|
-
var SDK_VERSION = "2026.11.
|
|
605
|
+
var SDK_VERSION = "2026.11.11";
|
|
606
606
|
export {
|
|
607
607
|
AgentSession,
|
|
608
608
|
COMPUTER_USE_ACTIONS,
|
package/dist/version.d.ts
CHANGED
|
@@ -459,7 +459,7 @@ selector grammar as `modelId`. TypeScript uses `fallbackModelId`, Python uses
|
|
|
459
459
|
`fallback_model_id`, and Go uses `FallbackModelID`. The fallback must resolve
|
|
460
460
|
to a different provider/model pair from the primary.
|
|
461
461
|
|
|
462
|
-
During agent execution (including
|
|
462
|
+
During agent execution (including resumes after a worker shutdown), after normal
|
|
463
463
|
retries are exhausted, MANTYX switches the failed model invocation
|
|
464
464
|
for retryable overload, provider server, unreachable-provider, or upstream
|
|
465
465
|
timeout errors. It does not switch for authentication, invalid requests, quota
|
|
@@ -559,8 +559,8 @@ Rules:
|
|
|
559
559
|
- They stay in effect for the whole run: context compaction that drops or
|
|
560
560
|
summarizes the run's user message keeps the instructions, and they count
|
|
561
561
|
toward the context budget.
|
|
562
|
-
- A run that resumes after
|
|
563
|
-
|
|
562
|
+
- A run that resumes after a worker shutdown keeps the instructions it
|
|
563
|
+
started with, in the same placement.
|
|
564
564
|
- File attachments on the user message are unaffected.
|
|
565
565
|
|
|
566
566
|
SDKs: TypeScript `turnInstructions` / `turnInstructionsAuthority` (run spec,
|
|
@@ -829,7 +829,7 @@ For direct OpenAI reasoning runs, MANTYX keeps `store: false` and carries the
|
|
|
829
829
|
Responses API's encrypted reasoning items across tool turns. Long-running
|
|
830
830
|
OpenAI contexts can additionally use provider-native compaction, which replaces
|
|
831
831
|
the earlier in-run prefix with an opaque retained-context item instead of
|
|
832
|
-
silently dropping it. These opaque items survive
|
|
832
|
+
silently dropping it. These opaque items survive shutdown checkpoints,
|
|
833
833
|
but are intentionally not persisted into the next separate user message.
|
|
834
834
|
OpenRouter, Grok, and generic OpenAI-compatible providers do not receive these
|
|
835
835
|
OpenAI-specific request fields.
|
|
@@ -915,7 +915,7 @@ are used only when OpenRouter does not report a cost.
|
|
|
915
915
|
`newLoop` is an optional boolean on run creation, session creation, and session
|
|
916
916
|
message requests. Omission keeps the legacy loop for new runs/sessions. A message
|
|
917
917
|
inherits its session's setting; an explicit `false` overrides it for that message
|
|
918
|
-
only. Checkpoints retain the selected mode through
|
|
918
|
+
only. Checkpoints retain the selected mode through worker restarts.
|
|
919
919
|
The chat `/api/chat` and `/api/chat/stream` request bodies also accept this flag
|
|
920
920
|
per message (multipart accepts the strings `"true"` and `"false"`).
|
|
921
921
|
|
|
@@ -960,8 +960,7 @@ With `newLoop: true`:
|
|
|
960
960
|
- Recovery from an empty assistant turn allows further tool work instead of
|
|
961
961
|
instructing the model to finalize immediately.
|
|
962
962
|
|
|
963
|
-
|
|
964
|
-
remain in force. This mode does not introduce a code workbench, persistent
|
|
963
|
+
Explicit guard settings and maximum tool-turn limits remain in force. This mode does not introduce a code workbench, persistent
|
|
965
964
|
specialist sessions, or provider-native history across separate user messages.
|
|
966
965
|
Provider-native compaction retains its separate explicit setting.
|
|
967
966
|
Completion verification still depends on the host's guard and available evidence;
|
|
@@ -1453,6 +1452,20 @@ spec, plus the cost-attribution triple `tokens` / `turns` / `model` —
|
|
|
1453
1452
|
see §7.1) without subscribing to live events. Useful for polling long
|
|
1454
1453
|
runs or attributing spend after the SSE stream was already consumed.
|
|
1455
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
|
+
|
|
1456
1469
|
## 6. Sessions
|
|
1457
1470
|
|
|
1458
1471
|
```
|
|
@@ -1630,8 +1643,7 @@ data: <utf-8 JSON>
|
|
|
1630
1643
|
{ "seq": 4, "type": "tool_call", "data": { "toolUseId": "...", "name": "...", "input": {...} } }
|
|
1631
1644
|
{ "seq": 5, "type": "tool_result", "data": { "toolUseId": "...", "name": "...", "ok": true, "summary": "..." } }
|
|
1632
1645
|
|
|
1633
|
-
// files a server-
|
|
1634
|
-
// `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.
|
|
1635
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" } ] } }
|
|
1636
1648
|
|
|
1637
1649
|
// LOCAL tool call — SDK MUST POST a tool-result for the same toolUseId.
|
|
@@ -1836,6 +1848,11 @@ Content-Type: application/json
|
|
|
1836
1848
|
already satisfied, or the run has terminated. `409 run_terminal` if the run
|
|
1837
1849
|
has already produced a `result` event.
|
|
1838
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
|
+
|
|
1839
1856
|
`result` MUST be a string; SDKs serialize structured outputs as JSON before
|
|
1840
1857
|
posting. Errors are surfaced to the model as a tool-error response.
|
|
1841
1858
|
|
|
@@ -1908,9 +1925,12 @@ listing has no `agentId` or `targetKinds` filter.
|
|
|
1908
1925
|
|
|
1909
1926
|
Developer API requests use fixed 60-second sliding windows keyed by workspace
|
|
1910
1927
|
and credential. New run starts have their own bucket (default 120/min);
|
|
1911
|
-
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
|
|
1912
1930
|
bucket (default 600/min); other mutations default to 120/min. Platform
|
|
1913
|
-
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,
|
|
1914
1934
|
and SSE opens/reconnects use a separate high transport limit and never consume
|
|
1915
1935
|
run-start capacity.
|
|
1916
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",
|