@mantyx/sdk 0.23.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
4
4
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## [0.24.0] — 2026-07-24
7
+
8
+ ### Documentation
9
+
10
+ - Add audio attachment support_(protocol)_
11
+
12
+ ## [0.23.0] — 2026-07-15
13
+
14
+ ### Added
15
+
16
+ - Align SDKs with agent-owned task plan protocol
17
+
18
+ ### Fixed
19
+
20
+ - Extend mock task_plan event type for v2 fields
21
+
6
22
  ## [0.22.1] — 2026-07-14
7
23
 
8
24
  ## [0.22.0] — 2026-07-06
@@ -165,6 +181,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
165
181
 
166
182
  ## [0.1.0] — 2026-05-02
167
183
 
184
+ [0.24.0]: https://github.com/mantyx-io/mantyx-sdk/compare/v0.23.0..v0.24.0
185
+ [0.23.0]: https://github.com/mantyx-io/mantyx-sdk/compare/v0.22.1..v0.23.0
168
186
  [0.22.1]: https://github.com/mantyx-io/mantyx-sdk/compare/v0.22.0..v0.22.1
169
187
  [0.22.0]: https://github.com/mantyx-io/mantyx-sdk/compare/v0.21.0..v0.22.0
170
188
  [0.21.0]: https://github.com/mantyx-io/mantyx-sdk/compare/v0.20.0..v0.21.0
package/README.md CHANGED
@@ -306,10 +306,10 @@ inherits from the session and can be overridden per `session.send`.
306
306
 
307
307
  ## Structured output (`outputSchema`)
308
308
 
309
- Constrain the assistant's **final reply** to a JSON document matching a
310
- JSON Schema. The wire still ships the reply as `text: string`, but that
311
- string is guaranteed-parseable JSON. Pair with `parseRunOutput` for a
312
- typed value with a clean error path:
309
+ Ask the provider to constrain the assistant's **final reply** to a JSON
310
+ document matching a JSON Schema. The wire still ships the reply as
311
+ `text: string`. Set `enforcement: "strict"` when an unsupported schema or
312
+ unconstrained fallback must fail, and pair it with `parseRunOutput`:
313
313
 
314
314
  ```ts
315
315
  import { z } from "zod";
@@ -329,7 +329,11 @@ const WeatherJsonSchema = {
329
329
  const result = await client.runAgent({
330
330
  systemPrompt: "Return the weather as JSON.",
331
331
  prompt: "What's the weather in San Francisco right now?",
332
- outputSchema: { name: "weather_report", schema: WeatherJsonSchema },
332
+ outputSchema: {
333
+ name: "weather_report",
334
+ schema: WeatherJsonSchema,
335
+ enforcement: "strict",
336
+ },
333
337
  });
334
338
 
335
339
  const report = parseRunOutput(result, (v) => Weather.parse(v));
@@ -342,6 +346,12 @@ typed `MantyxError` up front instead of a server round-trip rejection.
342
346
  On parse failure (rare; bad model output), `parseRunOutput` throws
343
347
  `MantyxParseError` with the original `text` preserved.
344
348
 
349
+ On success, `result.structuredOutput` reports whether enforcement actually
350
+ occurred, its `native_schema` / `synthetic_tool` mechanism, and whether a
351
+ best-effort unconstrained fallback occurred. Strict provider rejection raises
352
+ `MantyxRunError` with `errorClass === "structured_output_schema_rejected"` and
353
+ preserves `apiStatus`, `apiCode`, and the provider message.
354
+
345
355
  `outputSchema` is independent of `reasoningLevel` — combine them for
346
356
  deep-reasoning JSON outputs. On sessions it inherits from
347
357
  `createSession({ outputSchema })` and can be overridden per
@@ -65,6 +65,12 @@ var MantyxRunError = class extends MantyxError {
65
65
  turns;
66
66
  /** See {@link MantyxRunErrorInit.model}. */
67
67
  model;
68
+ /** Provider HTTP status associated with the failure, when available. */
69
+ apiStatus;
70
+ /** Provider-specific error code associated with the failure, when available. */
71
+ apiCode;
72
+ /** Structured-output enforcement metadata, when reported by the server. */
73
+ structuredOutput;
68
74
  constructor(runId, subtype, message, init = {}) {
69
75
  super(message, { code: subtype });
70
76
  this.name = "MantyxRunError";
@@ -77,6 +83,9 @@ var MantyxRunError = class extends MantyxError {
77
83
  this.tokens = init.tokens;
78
84
  this.turns = init.turns;
79
85
  this.model = init.model;
86
+ this.apiStatus = init.apiStatus;
87
+ this.apiCode = init.apiCode;
88
+ this.structuredOutput = init.structuredOutput;
80
89
  }
81
90
  };
82
91