@mantyx/sdk 2026.11.5 → 2026.11.7

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.
@@ -37,12 +37,12 @@ looks like for `mcp_local`, you're in the right place.
37
37
 
38
38
  | Term | Meaning |
39
39
  | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
40
- | **MANTYX** | The agent operating system server (this repo). Owns LLM orchestration, tool execution for server-resolved tools, persistence. |
40
+ | **MANTYX** | The MANTYX server (this repo). Owns LLM orchestration, tool execution for server-resolved tools, persistence. |
41
41
  | **SDK** | Anything calling the public agent-runs API — typically `@mantyx/ts-sdk`, but also other-language SDKs and direct HTTP clients. |
42
42
  | **Agent run** | A single LLM execution. Streams events; ends with a terminal `result` / `error` / `cancelled`. |
43
43
  | **Spec** | The JSON object describing what the run does — model, prompt, tools, budgets, optional `reasoningLevel`. Sent in the `POST /agent-runs` (or `.../messages`) body. |
44
44
  | **Tool ref** | One entry in `spec.tools[]`. A discriminated union keyed by `kind`. |
45
- | **Server-resolved** | A tool MANTYX executes itself (`mantyx`, `mantyx_plugin`, `a2a`, `mcp`). The SDK only sees informational `tool_result` events. |
45
+ | **Server-resolved** | A tool MANTYX executes itself (`a2a`, `mcp`). The SDK only sees informational `tool_result` events. |
46
46
  | **Client-resolved** | A tool the SDK executes (`local`, `a2a_local`, `mcp_local`). MANTYX emits `local_tool_call`, the SDK does the work, the SDK posts back to `.../tool-results`. |
47
47
  | **Resolution** | The act of turning an external resource (A2A peer, MCP server) into a self-contained JSON document the model can reason about. For `*_local` kinds, resolution is the **SDK's** responsibility. |
48
48
 
@@ -100,8 +100,8 @@ The lifecycle has three logical stages:
100
100
 
101
101
  `POST /api/v1/workspaces/{slug}/agent-runs` accepts the spec body. Only the
102
102
  new wire-protocol additions are documented in detail here; for the full
103
- spec body shape (system prompt, tool budgets, sessions, `agentId`
104
- short-circuit, etc.) see `agent-runs-protocol.md` §4.
103
+ spec body shape (system prompt, tool budgets, sessions, etc.) see
104
+ `agent-runs-protocol.md` §4.
105
105
 
106
106
  ### 2.1 Spec body (top-level shape)
107
107
 
@@ -130,15 +130,14 @@ short-circuit, etc.) see `agent-runs-protocol.md` §4.
130
130
  },
131
131
  "toolBudgets": {
132
132
  // optional; see §8
133
- "recall": { "maxCalls": 4 },
134
- "hive_consult_ontology": { "maxCalls": 4 },
133
+ "search_docs": { "maxCalls": 4 },
135
134
  },
136
135
  "supervisor": {
137
136
  // optional; see §8.4 — platform LLM judge on ephemeral runs
138
137
  "interval": 5,
139
138
  "modelId": "platform:demo",
140
139
  },
141
- "plan": true, // optional; see §8.5 — in-product task plan (opt-in)
140
+ "plan": true, // optional; see §8.5 — task plan (opt-in)
142
141
  "metadata": { "customer": "acme" }, // optional, free-form k/v
143
142
  }
144
143
  ```
@@ -190,7 +189,7 @@ created with.
190
189
 
191
190
  ## 3. Tool ref taxonomy
192
191
 
193
- Every entry in `spec.tools[]` is one of the seven shapes below. The
192
+ Every entry in `spec.tools[]` is one of the five shapes below. The
194
193
  _resolution column_ is the contract that drives everything else: **server**
195
194
  means MANTYX runs the tool itself and the SDK only ever sees a
196
195
  `tool_result` event; **client** means MANTYX is a transport and the SDK
@@ -198,8 +197,6 @@ must answer `local_tool_call` events.
198
197
 
199
198
  | Kind | Resolution | Wire-payload contract |
200
199
  | --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
201
- | `mantyx` | server | `{ id }` reference to a workspace `Tool` row. |
202
- | `mantyx_plugin` | server | `{ name }` reference to a platform plugin tool. |
203
200
  | `local` | client | `{ name, description?, parameters?, outputSchema?, longRunning? }` — `parameters` is **JSON Schema** (object schema with `properties`/`required`); forwarded verbatim to the LLM provider and validated against incoming tool-call args before execution. `outputSchema` (optional) is JSON Schema for the tool's structured return value, surfaced to providers that accept per-tool response schemas. `longRunning` (optional, default `false`) annotates the model-facing description with a "don't double-call while pending" hint so every provider treats the tool as long-running. |
204
201
  | `a2a` | server | `{ name, agentCardUrl, headers?, contextId?, description? }`. |
205
202
  | `a2a_local` | client | `{ name, agentCard }` — **resolved A2A Agent Card JSON content**. |
@@ -428,14 +425,14 @@ The vocabulary (`EphemeralEventType` in `bus.ts`):
428
425
  | ---------------------- | --------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
429
426
  | `assistant_delta` | M → SDK | Many | Streamed assistant text token / chunk. |
430
427
  | `thinking_delta` | M → SDK | Many (iff `reasoningLevel > 0`) | Streamed extended-thinking text (provider redacts when policy requires). |
431
- | `tool_result` | M → SDK | Per server-resolved tool call | Informational — tells the SDK that MANTYX ran a server-resolved tool (`mantyx`, `mantyx_plugin`, `a2a`, `mcp`) and got a result. The SDK does not need to act on it. |
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. |
432
429
  | `tool_files` | M → SDK | Per server-resolved tool call that returns files | Informational metadata for files a server-resolved tool produced (see §4.2.1). Precedes the matching `tool_result`. Inline bytes are redacted from the stream; download via the admin route. |
433
430
  | `local_tool_call` | M → SDK | Per client-resolved tool call | **Action required.** SDK must POST a tool-result. |
434
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). |
435
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. |
436
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. |
437
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. |
438
- | `task_plan` | M → SDK | 0–N× per run (iff `plan` set) | Observability for the in-product task plan (see §4.9 / §8.5). Emitted once after classify / caller-supplied plan, then again whenever the tracker advances step statuses. **Non-terminal.** For `planOnly` runs the final plan also rides on the terminal `result` under `data.plan`. |
435
+ | `task_plan` | M → SDK | 0–N× per run (iff `plan` set) | Observability for the task plan (see §4.9 / §8.5). Emitted once after classify / caller-supplied plan, then again whenever the tracker advances step statuses. **Non-terminal.** For `planOnly` runs the final plan also rides on the terminal `result` under `data.plan`. |
439
436
  | `assistant_message` | M → SDK | 1× per turn | Final assistant message for the turn (concatenated, persistence-ready). |
440
437
  | `result` | M → SDK | 1× terminal | Successful completion. Carries the final assistant text and run summary. |
441
438
  | `error` | M → SDK | 1× terminal | Failure. Carries `error` (message), `code` / `errorClass` (category), `finishReason`, and an optional `partialText` salvage payload. See §4.7. |
@@ -475,7 +472,7 @@ Purely informational. The SDK does not respond.
475
472
  ### 4.2.1 `tool_files` (server-resolved tool outputs)
476
473
 
477
474
  Emitted when a **server-resolved** tool returns files alongside (or instead of)
478
- text — e.g. a `mantyx` tool that renders a chart or exports a PDF. The bytes also
475
+ text — e.g. an `mcp` tool that renders a chart or exports a PDF. The bytes also
479
476
  reach the model natively (as file parts), so this event is purely for
480
477
  observability: it lets the Calls dashboard (and any SDK client that cares) list
481
478
  and download a run's produced artifacts. It always precedes the matching
@@ -682,11 +679,11 @@ without depending on event ordering.
682
679
  ```jsonc
683
680
  // soft nudge — pipeline injected a "finalize OR change strategy" user message
684
681
  { "seq": 13, "type": "loop_detected",
685
- "data": { "consecutiveCount": 3, "hardCutoff": false, "tools": ["recall"] } }
682
+ "data": { "consecutiveCount": 3, "hardCutoff": false, "tools": ["search_docs"] } }
686
683
 
687
684
  // hard cutoff — pipeline forced a tools-disabled finalise turn
688
685
  { "seq": 27, "type": "loop_detected",
689
- "data": { "consecutiveCount": 6, "hardCutoff": true, "tools": ["recall"] } }
686
+ "data": { "consecutiveCount": 6, "hardCutoff": true, "tools": ["search_docs"] } }
690
687
  ```
691
688
 
692
689
  | Field | Type | Notes |
@@ -709,7 +706,7 @@ See §8 for the wire-spec field that controls thresholds.
709
706
  {
710
707
  "seq": 14,
711
708
  "type": "tool_budget_exceeded",
712
- "data": { "tool": "recall", "maxCalls": 4, "callIndex": 5 },
709
+ "data": { "tool": "search_docs", "maxCalls": 4, "callIndex": 5 },
713
710
  }
714
711
  ```
715
712
 
@@ -722,7 +719,7 @@ See §8 for the wire-spec field that controls thresholds.
722
719
  Observability only: the synthetic "budget exceeded — pivot or finalize"
723
720
  tool-result lands on the normal `tool_result` channel before this event
724
721
  fires, so the model already has the directive to pivot. SDK clients use
725
- this event to render UI banners (`memory budget exhausted`, etc.) without
722
+ this event to render UI banners (`search budget exhausted`, etc.) without
726
723
  re-parsing tool-result bodies.
727
724
 
728
725
  See §8 for the wire-spec field that defines budgets.
@@ -933,14 +930,6 @@ counts toward `turns` even when the engine throws. The terminal event
933
930
  carries cumulative totals only; per-turn observability lives on
934
931
  `assistant_message` events.
935
932
 
936
- **A2A exposure.** The MANTYX-hosted A2A endpoint
937
- (`POST /api/a2a/{workspaceSlug}/agents/{agentSlug}`) returns the same
938
- triple under `result.metadata.mantyx`. The block is omitted entirely
939
- against legacy runners that haven't implemented the optional
940
- `runWithUsage` method on `AgentRunner` (see
941
- `packages/ts-sdk/src/a2a/adapter.ts`); cross-platform A2A clients
942
- should treat its absence as "no usage data" rather than as zero usage.
943
-
944
933
  **SDK return-value exposure.** The TS SDK exposes the same triple via
945
934
  the opt-in `runAgentWithUsage` (returning a `RunAgentResult` with
946
935
  `text`, `tokens`, `turns`, `model`). The legacy `runAgent` still
@@ -973,7 +962,7 @@ non-breaking since those return types were already objects).
973
962
  | `brief` | string | Optional one-line summary of the overall objective. |
974
963
  | `steps` | array | Ordered checklist. Each `{ title, status }` where `status` is `"pending" \| "in_progress" \| "done"`. |
975
964
 
976
- Observability for the in-product **task plan** (see §8.5). Emitted only when
965
+ Observability for the **task plan** (see §8.5). Emitted only when
977
966
  the run carries a `plan` spec field. **Non-terminal** — SDK clients render a
978
967
  live checklist that advances as the run progresses; the terminal `result`
979
968
  stays text-only for executed runs. For `planOnly` runs the run terminates
@@ -1031,7 +1020,7 @@ input shapes are accepted; both map to a numeric `0–100` internally.
1031
1020
 
1032
1021
  | Form | Values | Notes |
1033
1022
  | ---------- | -------------------------------------- | ---------------------------------------------------------- |
1034
- | **String** | `"off"`, `"low"`, `"medium"`, `"high"` | Snaps to `0`, `30`, `50`, `80` (matches the web composer). |
1023
+ | **String** | `"off"`, `"low"`, `"medium"`, `"high"` | Snaps to `0`, `30`, `50`, `80`. |
1035
1024
  | **Number** | integer `0`–`100` | Pass-through. `0` explicitly disables provider thinking. |
1036
1025
 
1037
1026
  Per provider:
@@ -1152,10 +1141,8 @@ schema-conformant reply. Surfacing it (as a "truncated reply — JSON
1152
1141
  likely incomplete" status note) is the recommended pattern; silently
1153
1142
  falling back to it as the answer is not.
1154
1143
 
1155
- `outputSchema` works for both ephemeral runs (`systemPrompt`-defined) and
1156
- `agentId`-backed runs — the runner applies the schema to whichever
1157
- `AgentSpec` it built. `outputSchema` is independent of `reasoningLevel`:
1158
- the model can think extensively _and_ emit JSON.
1144
+ `outputSchema` is independent of `reasoningLevel`: the model can think
1145
+ extensively _and_ emit JSON.
1159
1146
 
1160
1147
  ---
1161
1148
 
@@ -1198,8 +1185,7 @@ thresholds capped at `100`; `hardCutoffThreshold` must exceed
1198
1185
  `consecutiveThreshold`.
1199
1186
 
1200
1187
  The runtime default — applied when the field is omitted — is
1201
- `{ consecutiveThreshold: 3, hardCutoffThreshold: 6 }`. SDK-driven runs and
1202
- platform-driven runs inherit identical defaults.
1188
+ `{ consecutiveThreshold: 3, hardCutoffThreshold: 6 }`.
1203
1189
 
1204
1190
  ### 8.2 `toolBudgets`
1205
1191
 
@@ -1211,10 +1197,9 @@ loop and either changes strategy or finalises.
1211
1197
 
1212
1198
  ```jsonc
1213
1199
  "toolBudgets": {
1214
- "recall": { "maxCalls": 4 },
1215
- "hive_consult_ontology": { "maxCalls": 4 },
1216
- "traverse": { "maxCalls": 3 },
1217
- "scary_tool": { "maxCalls": 0 } // disables the tool for this run
1200
+ "search_docs": { "maxCalls": 4 },
1201
+ "fetch_page": { "maxCalls": 3 },
1202
+ "scary_tool": { "maxCalls": 0 } // disables the tool for this run
1218
1203
  }
1219
1204
  ```
1220
1205
 
@@ -1223,8 +1208,8 @@ loop and either changes strategy or finalises.
1223
1208
  | `<key>` | string (1–120 chars) | Logical tool name as the model sees it (`ResolvedTool.name`). The SDK + pipeline handle internal sanitisation. |
1224
1209
  | `maxCalls` | integer ≥ 0 | Hard cap. `0` disables the tool entirely (the first attempt returns the synthetic body). |
1225
1210
 
1226
- Budgets are **per-tool, not pooled** — `hive_search_deals: { maxCalls: 5 }`
1227
- and `hive_search_meetings: { maxCalls: 5 }` give the agent five of each,
1211
+ Budgets are **per-tool, not pooled** — `search_docs: { maxCalls: 5 }`
1212
+ and `search_tickets: { maxCalls: 5 }` give the agent five of each,
1228
1213
  not five between them.
1229
1214
 
1230
1215
  Validation (server-side, `400 invalid_request` on violation):
@@ -1235,21 +1220,10 @@ Validation (server-side, `400 invalid_request` on violation):
1235
1220
  | `<key>` length | `1..120` |
1236
1221
  | `maxCalls` upper bound | `1000` (functionally unlimited; `maxToolTurns: 100` fires first) |
1237
1222
 
1238
- **Default budgets** (applied when the field is omitted; caller-provided
1239
- entries are layered on top so per-run overrides win):
1240
-
1241
- | Tool | Default `maxCalls` |
1242
- | ---------------------------------------------------------------------------------------- | ------------------ |
1243
- | `recall` (workspace memory hybrid search) | `4` |
1244
- | `traverse` (memory graph BFS) | `3` |
1245
- | `hive_consult_ontology` (per-hive ontology read; same name across both active hives) | `4` |
1246
- | `hive_search_deals` / `_meetings` / `_companies` / `_people` (Sales Hive general search) | `5` |
1247
- | `hive_search_tickets` / `_conversations` / `_accounts` (Customer Hive general search) | `5` |
1248
-
1249
- Pass `"toolBudgets": {}` to start from a clean slate (no defaults applied
1250
- on top — useful for runs that intentionally want unbounded research). When
1251
- both the caller and the runtime defaults specify a budget for the same
1252
- tool, **the caller's value wins**.
1223
+ **Default budgets.** No tool is capped by default: when the field is
1224
+ omitted, only the budgets you send apply (`loopDetection` still guards
1225
+ against repeated identical batches). `"toolBudgets": {}` is accepted and is
1226
+ equivalent to sending no budgets.
1253
1227
 
1254
1228
  ### 8.3 Observability
1255
1229
 
@@ -1324,14 +1298,13 @@ Reviews fire on two triggers:
1324
1298
  **Model resolution.** When the supervisor is enabled, the judge model is chosen in order:
1325
1299
 
1326
1300
  1. `supervisor.modelId` on this run (if set)
1327
- 2. Workspace `defaultSupervisorModelId` (Settings → Workspace → General)
1301
+ 2. Workspace `defaultSupervisorModelId`
1328
1302
  3. Workspace default model (same as omitting top-level `modelId`)
1329
1303
 
1330
1304
  **Defaults.** When `supervisor` is **omitted** (or `false`), MANTYX does **not**
1331
1305
  run the platform LLM judge on ephemeral API runs — same opt-in semantics as
1332
1306
  `plan` (§8.5). Pass `"supervisor": true`, `"supervisor": {}`, or a config
1333
- object to enable. Web chat enables the supervisor separately via the chat
1334
- runner.
1307
+ object to enable.
1335
1308
 
1336
1309
  **SDK-only runs.** When a caller uses `@mantyx/ts-sdk` directly (not via
1337
1310
  `POST /agent-runs`), the supervisor is **off unless explicitly configured**:
@@ -1344,10 +1317,9 @@ recorded under the `supervisor` usage surface for cost attribution.
1344
1317
 
1345
1318
  ### 8.5 `plan` (task plan / plan-only)
1346
1319
 
1347
- The optional `plan` field turns on the in-product **task plan** — the same
1348
- engine that drives the live checklist in MANTYX chat / Hive Mind. It is
1349
- **opt-in** on ephemeral runs, same as `supervisor` (§8.4), because both
1350
- features add extra LLM calls.
1320
+ The optional `plan` field turns on the **task plan**, a live checklist the
1321
+ agent maintains as it works. It is **opt-in** on ephemeral runs, same as
1322
+ `supervisor` (§8.4), because both features add extra LLM calls.
1351
1323
 
1352
1324
  ```jsonc
1353
1325
  "plan": true // auto: pre-flight classify, emit task_plan, track during the run
@@ -1589,10 +1561,10 @@ A reference SDK should:
1589
1561
  JSON shape via the provider, but transient model errors can still
1590
1562
  produce strings that fail to parse in rare cases.
1591
1563
  - [ ] Accept `loopDetection`, `toolBudgets`, and `supervisor` from the caller
1592
- and pass them through unchanged (see §8). `loopDetection` and
1593
- `toolBudgets` are additive — omitting them keeps the runtime defaults;
1594
- passing `loopDetection: false` opts out; passing `toolBudgets: {}`
1595
- clears the defaults. `supervisor` and `plan` are opt-in — omitting them
1564
+ and pass them through unchanged (see §8). Omitting `loopDetection`
1565
+ keeps the runtime defaults and `loopDetection: false` opts out;
1566
+ `toolBudgets` caps only the tools it names (omitted or `{}` means no
1567
+ caps). `supervisor` and `plan` are opt-in — omitting them
1596
1568
  keeps both off; pass `supervisor: true` / `{}` / `{ interval?, modelId? }`
1597
1569
  or `plan: true` / `{ … }` to enable. Do **not** translate to
1598
1570
  vendor-specific knobs.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mantyx/sdk",
3
- "version": "2026.11.5",
4
- "description": "MANTYX as a hosted agent runtime: define ephemeral agents, mix server-side MANTYX tools with locally-executed tools, run them remotely.",
3
+ "version": "2026.11.7",
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",
7
7
  "module": "./dist/index.js",
@@ -34,7 +34,7 @@
34
34
  "node": ">=18.17.0"
35
35
  },
36
36
  "dependencies": {
37
- "@modelcontextprotocol/sdk": "^1.32.1",
37
+ "@modelcontextprotocol/sdk": "^1.32.2",
38
38
  "zod": "^4.6.7"
39
39
  },
40
40
  "peerDependencies": {
@@ -56,12 +56,13 @@
56
56
  "devDependencies": {
57
57
  "@a2a-js/sdk": "^1.3.0",
58
58
  "@types/express": "^5.0.6",
59
- "@types/node": "^26.6.5",
59
+ "@types/node": "^26.6.6",
60
60
  "express": "^5.3.0",
61
- "playwright": "^1.64.1",
61
+ "playwright": "^1.65.1",
62
+ "tsrs": "0.25.0-ts7.1.0-beta",
62
63
  "tsup": "^9.0.0",
63
64
  "typescript": "~7.0.2",
64
- "vitest": "^5.0.5"
65
+ "vitest": "^5.1.0"
65
66
  },
66
67
  "keywords": [
67
68
  "mantyx",
@@ -79,9 +80,9 @@
79
80
  "homepage": "https://mantyx-io.github.io/mantyx-sdk/",
80
81
  "scripts": {
81
82
  "sync-version": "node ../scripts/sync-version.mjs",
82
- "build": "tsup --config tsup.config.ts && tsc -p tsconfig.build.json",
83
+ "build": "tsup --config tsup.config.ts && tsrs -p tsconfig.build.json",
83
84
  "dev": "tsup --config tsup.config.ts --watch",
84
- "typecheck": "tsc --noEmit",
85
+ "typecheck": "tsrs --noEmit",
85
86
  "test": "vitest run",
86
87
  "test:watch": "vitest"
87
88
  }