@mantyx/sdk 2026.11.1 → 2026.11.2
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/dist/a2a-server.cjs +2 -0
- package/dist/a2a-server.d.ts +2 -0
- package/dist/a2a-server.js +3 -1
- package/dist/{chunk-FDIMGXOL.js → chunk-RT44KYDO.js} +2 -0
- package/dist/client.d.ts +39 -0
- package/dist/index.cjs +3 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/version.d.ts +1 -1
- package/docs/agent-runs-protocol.md +60 -0
- package/package.json +1 -1
package/dist/a2a-server.cjs
CHANGED
|
@@ -323,6 +323,7 @@ function specForRun(spec) {
|
|
|
323
323
|
if (spec.systemPrompt) out.systemPrompt = spec.systemPrompt;
|
|
324
324
|
if (spec.modelId) out.modelId = spec.modelId;
|
|
325
325
|
if (spec.tools) out.tools = spec.tools;
|
|
326
|
+
if (spec.openRouterProvider !== void 0) out.openRouterProvider = spec.openRouterProvider;
|
|
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.systemPrompt) out.systemPrompt = spec.systemPrompt;
|
|
337
338
|
if (spec.modelId) out.modelId = spec.modelId;
|
|
338
339
|
if (spec.tools) out.tools = spec.tools;
|
|
340
|
+
if (spec.openRouterProvider !== void 0) out.openRouterProvider = spec.openRouterProvider;
|
|
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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { OpenRouterProviderPreferences } from "./client.js";
|
|
1
2
|
/**
|
|
2
3
|
* Expose a MANTYX agent over the [Agent2Agent (A2A)](https://google-a2a.github.io/A2A/)
|
|
3
4
|
* protocol so other agents can talk to it as a peer.
|
|
@@ -59,6 +60,7 @@ export interface MantyxAgentSpec {
|
|
|
59
60
|
modelId?: string;
|
|
60
61
|
tools?: ToolRef[];
|
|
61
62
|
reasoningLevel?: ReasoningLevel;
|
|
63
|
+
openRouterProvider?: OpenRouterProviderPreferences;
|
|
62
64
|
/**
|
|
63
65
|
* Constrains the model's final assistant text to a JSON document matching
|
|
64
66
|
* a JSON Schema (or Zod schema, auto-converted). See
|
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-RT44KYDO.js";
|
|
5
5
|
|
|
6
6
|
// src/a2a-server.ts
|
|
7
7
|
import {
|
|
@@ -239,6 +239,7 @@ function specForRun(spec) {
|
|
|
239
239
|
if (spec.systemPrompt) out.systemPrompt = spec.systemPrompt;
|
|
240
240
|
if (spec.modelId) out.modelId = spec.modelId;
|
|
241
241
|
if (spec.tools) out.tools = spec.tools;
|
|
242
|
+
if (spec.openRouterProvider !== void 0) out.openRouterProvider = spec.openRouterProvider;
|
|
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.systemPrompt) out.systemPrompt = spec.systemPrompt;
|
|
253
254
|
if (spec.modelId) out.modelId = spec.modelId;
|
|
254
255
|
if (spec.tools) out.tools = spec.tools;
|
|
256
|
+
if (spec.openRouterProvider !== void 0) out.openRouterProvider = spec.openRouterProvider;
|
|
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 ?? {} };
|
|
@@ -1444,6 +1444,7 @@ var AgentSession = class {
|
|
|
1444
1444
|
}
|
|
1445
1445
|
if (this.tools.length > 0) body.tools = serializeToolRefs(this.tools);
|
|
1446
1446
|
if (opts.metadata && Object.keys(opts.metadata).length > 0) body.metadata = opts.metadata;
|
|
1447
|
+
if (opts.openRouterProvider !== void 0) body.openRouterProvider = opts.openRouterProvider;
|
|
1447
1448
|
if (opts.reasoningLevel !== void 0) {
|
|
1448
1449
|
body.reasoningLevel = normalizeReasoningLevel(opts.reasoningLevel);
|
|
1449
1450
|
}
|
|
@@ -1530,6 +1531,7 @@ function serializeAgentSpec(spec, extra = {}) {
|
|
|
1530
1531
|
if (spec.name) body.name = spec.name;
|
|
1531
1532
|
if (spec.modelId) body.modelId = spec.modelId;
|
|
1532
1533
|
if (spec.fallbackModelId) body.fallbackModelId = spec.fallbackModelId;
|
|
1534
|
+
if (spec.openRouterProvider !== void 0) body.openRouterProvider = spec.openRouterProvider;
|
|
1533
1535
|
if (spec.reasoningLevel !== void 0) {
|
|
1534
1536
|
body.reasoningLevel = normalizeReasoningLevel(spec.reasoningLevel);
|
|
1535
1537
|
}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
/** OpenRouter provider-routing wire preferences (snake_case). */
|
|
2
|
+
export interface OpenRouterProviderPreferences {
|
|
3
|
+
order?: string[] | null;
|
|
4
|
+
allow_fallbacks?: boolean | null;
|
|
5
|
+
require_parameters?: boolean | null;
|
|
6
|
+
data_collection?: "allow" | "deny" | null;
|
|
7
|
+
zdr?: boolean | null;
|
|
8
|
+
enforce_distillable_text?: boolean | null;
|
|
9
|
+
only?: string[] | null;
|
|
10
|
+
ignore?: string[] | null;
|
|
11
|
+
quantizations?: ("int4" | "int8" | "fp4" | "mxfp4" | "nvfp4" | "fp6" | "fp8" | "mxfp8" | "fp16" | "bf16" | "fp32" | "unknown")[] | null;
|
|
12
|
+
sort?: "price" | "throughput" | "latency" | "exacto" | {
|
|
13
|
+
by?: "price" | "throughput" | "latency" | "exacto" | null;
|
|
14
|
+
partition?: "model" | "none" | null;
|
|
15
|
+
} | null;
|
|
16
|
+
preferred_min_throughput?: number | {
|
|
17
|
+
p50?: number;
|
|
18
|
+
p75?: number;
|
|
19
|
+
p90?: number;
|
|
20
|
+
p99?: number;
|
|
21
|
+
} | null;
|
|
22
|
+
preferred_max_latency?: number | {
|
|
23
|
+
p50?: number;
|
|
24
|
+
p75?: number;
|
|
25
|
+
p90?: number;
|
|
26
|
+
p99?: number;
|
|
27
|
+
} | null;
|
|
28
|
+
max_price?: {
|
|
29
|
+
prompt?: number | string;
|
|
30
|
+
completion?: number | string;
|
|
31
|
+
image?: number | string;
|
|
32
|
+
audio?: number | string;
|
|
33
|
+
request?: number | string;
|
|
34
|
+
} | null;
|
|
35
|
+
}
|
|
1
36
|
import type { TokenSource } from "./oauth.js";
|
|
2
37
|
import type { OutputSchemaEnforcement, StructuredOutputInfo } from "./structured-output.js";
|
|
3
38
|
import type { LocalA2ATool, LocalMcpServer, LocalTool, LocalToolSchemaInput, ReasoningLevel, ToolRef, ToolResultFile } from "./tools.js";
|
|
@@ -354,6 +389,7 @@ export interface AgentSpecBase {
|
|
|
354
389
|
* overrides on `session.send` apply to that single run.
|
|
355
390
|
*/
|
|
356
391
|
reasoningLevel?: ReasoningLevel;
|
|
392
|
+
openRouterProvider?: OpenRouterProviderPreferences;
|
|
357
393
|
budgets?: {
|
|
358
394
|
maxToolTurns?: number;
|
|
359
395
|
};
|
|
@@ -1283,6 +1319,7 @@ export declare class AgentSession {
|
|
|
1283
1319
|
* and does not mutate the session's stored value.
|
|
1284
1320
|
*/
|
|
1285
1321
|
reasoningLevel?: ReasoningLevel;
|
|
1322
|
+
openRouterProvider?: OpenRouterProviderPreferences;
|
|
1286
1323
|
/**
|
|
1287
1324
|
* Per-message override for `outputSchema`. Applies only to this run
|
|
1288
1325
|
* and does not mutate the session's stored value.
|
|
@@ -1316,6 +1353,7 @@ export declare class AgentSession {
|
|
|
1316
1353
|
attachments?: MessageAttachment[];
|
|
1317
1354
|
metadata?: Record<string, string>;
|
|
1318
1355
|
reasoningLevel?: ReasoningLevel;
|
|
1356
|
+
openRouterProvider?: OpenRouterProviderPreferences;
|
|
1319
1357
|
outputSchema?: OutputSchema;
|
|
1320
1358
|
loopDetection?: LoopDetection | false;
|
|
1321
1359
|
toolBudgets?: ToolBudgets;
|
|
@@ -1331,6 +1369,7 @@ export declare class AgentSession {
|
|
|
1331
1369
|
signal?: AbortSignal;
|
|
1332
1370
|
metadata?: Record<string, string>;
|
|
1333
1371
|
reasoningLevel?: ReasoningLevel;
|
|
1372
|
+
openRouterProvider?: OpenRouterProviderPreferences;
|
|
1334
1373
|
outputSchema?: OutputSchema;
|
|
1335
1374
|
loopDetection?: LoopDetection | false;
|
|
1336
1375
|
toolBudgets?: ToolBudgets;
|
package/dist/index.cjs
CHANGED
|
@@ -1518,6 +1518,7 @@ var AgentSession = class {
|
|
|
1518
1518
|
}
|
|
1519
1519
|
if (this.tools.length > 0) body.tools = serializeToolRefs(this.tools);
|
|
1520
1520
|
if (opts.metadata && Object.keys(opts.metadata).length > 0) body.metadata = opts.metadata;
|
|
1521
|
+
if (opts.openRouterProvider !== void 0) body.openRouterProvider = opts.openRouterProvider;
|
|
1521
1522
|
if (opts.reasoningLevel !== void 0) {
|
|
1522
1523
|
body.reasoningLevel = normalizeReasoningLevel(opts.reasoningLevel);
|
|
1523
1524
|
}
|
|
@@ -1604,6 +1605,7 @@ function serializeAgentSpec(spec, extra = {}) {
|
|
|
1604
1605
|
if (spec.name) body.name = spec.name;
|
|
1605
1606
|
if (spec.modelId) body.modelId = spec.modelId;
|
|
1606
1607
|
if (spec.fallbackModelId) body.fallbackModelId = spec.fallbackModelId;
|
|
1608
|
+
if (spec.openRouterProvider !== void 0) body.openRouterProvider = spec.openRouterProvider;
|
|
1607
1609
|
if (spec.reasoningLevel !== void 0) {
|
|
1608
1610
|
body.reasoningLevel = normalizeReasoningLevel(spec.reasoningLevel);
|
|
1609
1611
|
}
|
|
@@ -2762,7 +2764,7 @@ async function runComputerUse(opts) {
|
|
|
2762
2764
|
}
|
|
2763
2765
|
|
|
2764
2766
|
// src/version.ts
|
|
2765
|
-
var SDK_VERSION = "2026.11.
|
|
2767
|
+
var SDK_VERSION = "2026.11.2";
|
|
2766
2768
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2767
2769
|
0 && (module.exports = {
|
|
2768
2770
|
AgentSession,
|
package/dist/index.d.ts
CHANGED
|
@@ -49,3 +49,4 @@ export { zodToJsonSchema, toToolParametersWire } from "./zod-to-json-schema.js";
|
|
|
49
49
|
export { readSseStream } from "./sse.js";
|
|
50
50
|
export type { SseEvent, SseStreamOptions } from "./sse.js";
|
|
51
51
|
export { SDK_VERSION } from "./version.js";
|
|
52
|
+
export type { OpenRouterProviderPreferences } from "./client.js";
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
taskPlanFromEventData,
|
|
28
28
|
toToolParametersWire,
|
|
29
29
|
zodToJsonSchema
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-RT44KYDO.js";
|
|
31
31
|
|
|
32
32
|
// src/oauth.ts
|
|
33
33
|
var DEFAULT_OAUTH_BASE_URL = "https://app.mantyx.io";
|
|
@@ -603,7 +603,7 @@ async function runComputerUse(opts) {
|
|
|
603
603
|
}
|
|
604
604
|
|
|
605
605
|
// src/version.ts
|
|
606
|
-
var SDK_VERSION = "2026.11.
|
|
606
|
+
var SDK_VERSION = "2026.11.2";
|
|
607
607
|
export {
|
|
608
608
|
AgentSession,
|
|
609
609
|
COMPUTER_USE_ACTIONS,
|
package/dist/version.d.ts
CHANGED
|
@@ -777,6 +777,66 @@ For session-scoped runs the inheritance rules are:
|
|
|
777
777
|
per-message override; applies to that one run only and does not mutate
|
|
778
778
|
the session's stored value.
|
|
779
779
|
|
|
780
|
+
### 4.4.1 `openRouterProvider` (OpenRouter provider routing)
|
|
781
|
+
|
|
782
|
+
Run creation accepts an optional `openRouterProvider` JSON object. It uses
|
|
783
|
+
[OpenRouter's provider-routing wire format](https://openrouter.ai/docs/guides/routing/provider-selection),
|
|
784
|
+
including snake_case field names. MANTYX forwards the effective object as
|
|
785
|
+
`provider` on OpenRouter Responses API requests (streaming and non-streaming).
|
|
786
|
+
|
|
787
|
+
```json
|
|
788
|
+
{"openRouterProvider":{"order":["anthropic"],"allow_fallbacks":false}}
|
|
789
|
+
```
|
|
790
|
+
|
|
791
|
+
All top-level fields are optional and nullable (`null` means unset):
|
|
792
|
+
|
|
793
|
+
| Field | Accepted value |
|
|
794
|
+
| --- | --- |
|
|
795
|
+
| `order`, `only`, `ignore` | Arrays of provider slugs, including variant/region suffixes such as `deepinfra/turbo` or `google-vertex/us-east5` |
|
|
796
|
+
| `allow_fallbacks`, `require_parameters`, `zdr`, `enforce_distillable_text` | Boolean |
|
|
797
|
+
| `data_collection` | `"allow"` or `"deny"` |
|
|
798
|
+
| `quantizations` | Array of `int4`, `int8`, `fp4`, `mxfp4`, `nvfp4`, `fp6`, `fp8`, `mxfp8`, `fp16`, `bf16`, `fp32`, `unknown` |
|
|
799
|
+
| `sort` | `"price"`, `"throughput"`, `"latency"`, `"exacto"`, or `{ "by"?: <same enum> or null, "partition"?: "model" or "none" or null }` |
|
|
800
|
+
| `preferred_min_throughput` | Number (tokens/sec), or an object with optional numeric `p50`, `p75`, `p90`, `p99` |
|
|
801
|
+
| `preferred_max_latency` | Number (seconds), or the same percentile object |
|
|
802
|
+
| `max_price` | Object with optional `prompt`, `completion`, `image`, `audio`, `request` prices (USD), each a number or string |
|
|
803
|
+
|
|
804
|
+
Provider create (`POST /api/llm-providers`, including marketplace connections
|
|
805
|
+
and BYOK duplication) accepts `openRouterProvider` as a stored default on the
|
|
806
|
+
workspace provider. Provider update (`PATCH /api/llm-providers/:id`) also accepts
|
|
807
|
+
`null` to clear the default. Provider responses return the object or `null`.
|
|
808
|
+
Changing a stored default requires a workspace admin; a `PATCH` that resubmits
|
|
809
|
+
the stored value unchanged does not.
|
|
810
|
+
|
|
811
|
+
Effective routing is a shallow per-key merge:
|
|
812
|
+
`{ ...providerDefault, ...runOverride }`. Arrays and nested objects in the
|
|
813
|
+
run override replace the corresponding default value entirely. A null field in
|
|
814
|
+
the override removes that inherited key; null fields in stored defaults are
|
|
815
|
+
dropped. Nullable `sort` members are also omitted upstream. An empty object
|
|
816
|
+
preserves defaults; absent or empty effective preferences are omitted from the
|
|
817
|
+
upstream request. The entire run-level `openRouterProvider` object cannot be null.
|
|
818
|
+
|
|
819
|
+
Stored privacy controls are the exception: when the provider default sets
|
|
820
|
+
`data_collection: "deny"` or `zdr: true`, a run, session or message override
|
|
821
|
+
can tighten privacy but cannot loosen or remove those values (a `"allow"`,
|
|
822
|
+
`false` or `null` override is ignored for that key).
|
|
823
|
+
|
|
824
|
+
Sessions accept the same field as a session default. A per-message value on
|
|
825
|
+
`POST /agent-sessions/:id/messages` replaces the session override for that one
|
|
826
|
+
run, without changing the stored session; provider defaults still merge beneath it.
|
|
827
|
+
|
|
828
|
+
Unknown keys (including nested keys) and invalid values return HTTP 400.
|
|
829
|
+
Setting routing on a non-OpenRouter provider, or creating a run whose effective
|
|
830
|
+
model uses another provider, returns HTTP 400 with a clear error before queueing.
|
|
831
|
+
An explicitly configured fallback model must also use OpenRouter when a run
|
|
832
|
+
routing override is present. No routing configuration is stored on platform
|
|
833
|
+
catalog offerings themselves.
|
|
834
|
+
|
|
835
|
+
MANTYX-hosted OpenRouter models are billed at the cost OpenRouter reports for
|
|
836
|
+
each request (`usage.cost`), so a pinned provider or `sort` is billed at what
|
|
837
|
+
it actually cost. The catalog's per-token prices are a reference estimate and
|
|
838
|
+
are used only when OpenRouter does not report a cost.
|
|
839
|
+
|
|
780
840
|
### 4.5 `outputSchema` (structured final reply)
|
|
781
841
|
|
|
782
842
|
`outputSchema` constrains the model's **final assistant text** to a JSON
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mantyx/sdk",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.2",
|
|
4
4
|
"description": "MANTYX as a hosted agent runtime: define ephemeral agents, mix server-side MANTYX tools with locally-executed tools, run them remotely.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|