@mantyx/sdk 0.25.0 → 2026.9.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/LICENSE +201 -0
  3. package/README.md +20 -7
  4. package/dist/a2a-server.cjs +2 -1
  5. package/dist/a2a-server.d.ts +2 -1
  6. package/dist/a2a-server.js +3 -2
  7. package/dist/{chunk-4EJRV6KZ.js → chunk-XMNAWLMF.js} +36 -2
  8. package/dist/client.d.ts +40 -1
  9. package/dist/computer-use.d.ts +0 -1
  10. package/dist/errors.d.ts +0 -1
  11. package/dist/index.cjs +37 -3
  12. package/dist/index.d.ts +1 -2
  13. package/dist/index.js +2 -3
  14. package/dist/local-resolver.d.ts +0 -1
  15. package/dist/oauth.d.ts +0 -1
  16. package/dist/playwright.cjs +0 -1
  17. package/dist/playwright.d.ts +0 -1
  18. package/dist/playwright.js +0 -1
  19. package/dist/sse.d.ts +0 -1
  20. package/dist/structured-output.d.ts +0 -1
  21. package/dist/tools.d.ts +0 -1
  22. package/dist/version.d.ts +2 -3
  23. package/dist/zod-to-json-schema.d.ts +0 -1
  24. package/docs/agent-runs-protocol.md +69 -4
  25. package/package.json +17 -18
  26. package/CONTRIBUTING.md +0 -72
  27. package/EXTRACT.md +0 -70
  28. package/dist/a2a-server.cjs.map +0 -1
  29. package/dist/a2a-server.d.ts.map +0 -1
  30. package/dist/a2a-server.js.map +0 -1
  31. package/dist/chunk-4EJRV6KZ.js.map +0 -1
  32. package/dist/client.d.ts.map +0 -1
  33. package/dist/computer-use.d.ts.map +0 -1
  34. package/dist/errors.d.ts.map +0 -1
  35. package/dist/index.cjs.map +0 -1
  36. package/dist/index.d.ts.map +0 -1
  37. package/dist/index.js.map +0 -1
  38. package/dist/local-resolver.d.ts.map +0 -1
  39. package/dist/oauth.d.ts.map +0 -1
  40. package/dist/playwright.cjs.map +0 -1
  41. package/dist/playwright.d.ts.map +0 -1
  42. package/dist/playwright.js.map +0 -1
  43. package/dist/sse.d.ts.map +0 -1
  44. package/dist/structured-output.d.ts.map +0 -1
  45. package/dist/tools.d.ts.map +0 -1
  46. package/dist/version.d.ts.map +0 -1
  47. package/dist/zod-to-json-schema.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,7 +1,26 @@
1
1
  # Changelog
2
2
 
3
3
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
4
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4
+ and new releases use calendar versions (`YYYY.M.RELEASE`). Historical versions retain their original identifiers.
5
+
6
+ ## [Unreleased]
7
+
8
+ ### Added
9
+
10
+ - Cursor-based session pagination and bounded session event pages (SDK PR #9).
11
+ - Explicit new-loop opt-in for runs, sessions, session turns, evals and A2A server wrappers.
12
+
13
+ ### Changed
14
+
15
+ - Calendar versioning with automatic SDK publication after successful deployments when SDK code or build inputs change.
16
+ - Develop and release SDKs from the private MANTYX platform repository.
17
+ - Export `SessionEventsPage`; wait for eval local tool callbacks; reject null output schemas.
18
+
19
+ ## [0.25.0] — 2026-08-01
20
+
21
+ ### Added
22
+
23
+ - Expose structured output enforcement
5
24
 
6
25
  ## [0.24.0] — 2026-07-24
7
26
 
@@ -181,6 +200,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
181
200
 
182
201
  ## [0.1.0] — 2026-05-02
183
202
 
203
+ [0.25.0]: https://github.com/mantyx-io/mantyx-sdk/compare/v0.24.0..v0.25.0
184
204
  [0.24.0]: https://github.com/mantyx-io/mantyx-sdk/compare/v0.23.0..v0.24.0
185
205
  [0.23.0]: https://github.com/mantyx-io/mantyx-sdk/compare/v0.22.1..v0.23.0
186
206
  [0.22.1]: https://github.com/mantyx-io/mantyx-sdk/compare/v0.22.0..v0.22.1
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 MANTYX
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -24,6 +24,10 @@ and the messaging-layer reference in [`docs/wire-protocol.md`](./docs/wire-proto
24
24
  resolved data structures (`a2a_local` Agent Card, `mcp_local` `Tool[]`)
25
25
  that this SDK ships.
26
26
 
27
+ ## Harness loop selection
28
+
29
+ Pass `newLoop: true` when running an agent, creating a session, or starting an eval to opt into the reviewed harness loop. Omission keeps external runs on the existing loop. Session turns inherit the session setting; an explicit false overrides it for that turn. Use `session.send(prompt, { newLoop: false })`.
30
+
27
31
  ## Install
28
32
 
29
33
  ```bash
@@ -501,12 +505,14 @@ live stream.
501
505
 
502
506
  ```ts
503
507
  // Find sessions by your own identifiers (AND-combined server-side)
504
- const { sessions, total } = await client.listSessions({
508
+ const { sessions, total, nextCursor } = await client.listSessions({
505
509
  metadata: { customer: "acme" },
506
510
  status: "active", // optional: "active" | "ended"
507
511
  limit: 50, // optional pagination
508
- offset: 0,
509
512
  });
513
+ const nextPage = nextCursor
514
+ ? await client.listSessions({ limit: 50, cursor: nextCursor })
515
+ : null;
510
516
  // Each row: { sessionId, creationDate, lastInteractionDate, summary, metadata, status }
511
517
 
512
518
  // Replay a session as realtime-style frames so a UI can rebuild the thread.
@@ -517,6 +523,14 @@ const events = await client.getSessionEvents(sessions[0].sessionId);
517
523
  const recent = await client.getSessionEvents(sessions[0].sessionId, {
518
524
  lastMessages: 10,
519
525
  });
526
+
527
+ // For bounded backward paging, use the page response metadata:
528
+ const page = await client.getSessionEventsPage(sessions[0].sessionId);
529
+ const older = page.nextBeforeSeq
530
+ ? await client.getSessionEventsPage(sessions[0].sessionId, {
531
+ beforeSeq: page.nextBeforeSeq,
532
+ })
533
+ : null;
520
534
  ```
521
535
 
522
536
  Resuming a session from a different process re-binds your local tool
@@ -563,8 +577,9 @@ Opt-in multi-step checklists. Pass `plan: true` (auto-classify + live tracking)
563
577
  | `streamAgent(spec)` | `AsyncIterable<RunEvent>` |
564
578
  | `createSession(spec)` | `Promise<AgentSession>` |
565
579
  | `resumeSession(sessionId, { tools? })` | `Promise<AgentSession>` |
566
- | `listSessions({ metadata?, status?, limit?, offset? })` | `Promise<SessionListResult>` |
580
+ | `listSessions({ metadata?, status?, limit?, offset?, cursor? })` | `Promise<SessionListResult>` |
567
581
  | `getSessionEvents(sessionId, { full?, lastMessages? })` | `Promise<RunEvent[]>` |
582
+ | `getSessionEventsPage(sessionId, { lastMessages?, beforeSeq? })` | `Promise<SessionEventsPage>` |
568
583
  | `endSession(sessionId)` | `Promise<void>` |
569
584
  | `cancelRun(runId)` | `Promise<void>` |
570
585
 
@@ -694,10 +709,8 @@ pnpm build # emits dist/ (ESM + CJS + d.ts)
694
709
  The SDK has zero internal `workspace:*` dependencies. `pnpm build` produces a
695
710
  self-contained `dist/` ready for `npm publish`.
696
711
 
697
- See [`CONTRIBUTING.md`](./CONTRIBUTING.md) for the contribution flow and
698
- [`EXTRACT.md`](./EXTRACT.md) for the (very small) steps to lift this folder
699
- into its own public repository.
712
+ See [`CONTRIBUTING.md`](./CONTRIBUTING.md) for development and the shared release guide in the private repository for publishing.
700
713
 
701
714
  ## License
702
715
 
703
- [Apache-2.0](../LICENSE)
716
+ [Apache-2.0](./LICENSE)
@@ -348,6 +348,7 @@ function specForRun(spec) {
348
348
  if (spec.systemPrompt) out.systemPrompt = spec.systemPrompt;
349
349
  if (spec.modelId) out.modelId = spec.modelId;
350
350
  if (spec.tools) out.tools = spec.tools;
351
+ if (spec.newLoop !== void 0) out.newLoop = spec.newLoop;
351
352
  if (spec.reasoningLevel !== void 0) out.reasoningLevel = spec.reasoningLevel;
352
353
  if (spec.outputSchema !== void 0) out.outputSchema = spec.outputSchema;
353
354
  if (spec.metadata) out.metadata = spec.metadata;
@@ -361,6 +362,7 @@ function specForSession(spec, contextId) {
361
362
  if (spec.systemPrompt) out.systemPrompt = spec.systemPrompt;
362
363
  if (spec.modelId) out.modelId = spec.modelId;
363
364
  if (spec.tools) out.tools = spec.tools;
365
+ if (spec.newLoop !== void 0) out.newLoop = spec.newLoop;
364
366
  if (spec.reasoningLevel !== void 0) out.reasoningLevel = spec.reasoningLevel;
365
367
  if (spec.outputSchema !== void 0) out.outputSchema = spec.outputSchema;
366
368
  const meta = { ...spec.metadata ?? {} };
@@ -436,4 +438,3 @@ async function loadServerSdk() {
436
438
  MantyxAgentExecutor,
437
439
  serveAgentOverA2A
438
440
  });
439
- //# sourceMappingURL=a2a-server.cjs.map
@@ -58,6 +58,8 @@ export interface MantyxAgentSpec {
58
58
  systemPrompt?: string;
59
59
  modelId?: string;
60
60
  tools?: ToolRef[];
61
+ /** Opt into the verified loop; omission preserves legacy behavior or session inheritance. */
62
+ newLoop?: boolean;
61
63
  reasoningLevel?: ReasoningLevel;
62
64
  /**
63
65
  * Constrains the model's final assistant text to a JSON document matching
@@ -170,4 +172,3 @@ export declare class MantyxAgentExecutor implements AgentExecutor {
170
172
  export declare function serveAgentOverA2A(options: ServeAgentOverA2AOptions): Promise<ServeAgentOverA2AHandle>;
171
173
  export type { AgentCard, Message, MessageSendParams, Task, TaskArtifactUpdateEvent, TaskStatusUpdateEvent, } from "@a2a-js/sdk";
172
174
  export type { AgentExecutor, ExecutionEventBus, RequestContext } from "@a2a-js/sdk/server";
173
- //# sourceMappingURL=a2a-server.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MantyxError,
3
3
  MantyxRunError
4
- } from "./chunk-4EJRV6KZ.js";
4
+ } from "./chunk-XMNAWLMF.js";
5
5
 
6
6
  // src/a2a-server.ts
7
7
  var MantyxAgentExecutor = class {
@@ -256,6 +256,7 @@ function specForRun(spec) {
256
256
  if (spec.systemPrompt) out.systemPrompt = spec.systemPrompt;
257
257
  if (spec.modelId) out.modelId = spec.modelId;
258
258
  if (spec.tools) out.tools = spec.tools;
259
+ if (spec.newLoop !== void 0) out.newLoop = spec.newLoop;
259
260
  if (spec.reasoningLevel !== void 0) out.reasoningLevel = spec.reasoningLevel;
260
261
  if (spec.outputSchema !== void 0) out.outputSchema = spec.outputSchema;
261
262
  if (spec.metadata) out.metadata = spec.metadata;
@@ -269,6 +270,7 @@ function specForSession(spec, contextId) {
269
270
  if (spec.systemPrompt) out.systemPrompt = spec.systemPrompt;
270
271
  if (spec.modelId) out.modelId = spec.modelId;
271
272
  if (spec.tools) out.tools = spec.tools;
273
+ if (spec.newLoop !== void 0) out.newLoop = spec.newLoop;
272
274
  if (spec.reasoningLevel !== void 0) out.reasoningLevel = spec.reasoningLevel;
273
275
  if (spec.outputSchema !== void 0) out.outputSchema = spec.outputSchema;
274
276
  const meta = { ...spec.metadata ?? {} };
@@ -343,4 +345,3 @@ export {
343
345
  MantyxAgentExecutor,
344
346
  serveAgentOverA2A
345
347
  };
346
- //# sourceMappingURL=a2a-server.js.map
@@ -871,6 +871,7 @@ var MantyxClient = class {
871
871
  if (opts.status) query.status = opts.status;
872
872
  if (typeof opts.limit === "number") query.limit = opts.limit;
873
873
  if (typeof opts.offset === "number") query.offset = opts.offset;
874
+ if (opts.cursor) query.cursor = opts.cursor;
874
875
  return this.request({
875
876
  method: "GET",
876
877
  path: "/agent-sessions",
@@ -897,6 +898,28 @@ var MantyxClient = class {
897
898
  });
898
899
  return res.events ?? [];
899
900
  }
901
+ /**
902
+ * Fetch one bounded page of session events. Pages are returned in ascending
903
+ * sequence order; follow `nextBeforeSeq` to walk backward through history.
904
+ */
905
+ async getSessionEventsPage(sessionId, opts = {}) {
906
+ const query = {
907
+ lastMessages: opts.lastMessages ?? 100,
908
+ beforeSeq: opts.beforeSeq
909
+ };
910
+ const res = await this.request({
911
+ method: "GET",
912
+ path: `/agent-sessions/${encodeURIComponent(sessionId)}/events`,
913
+ query
914
+ });
915
+ return {
916
+ sessionId: res.sessionId,
917
+ total: res.total,
918
+ events: res.events ?? [],
919
+ nextBeforeSeq: res.nextBeforeSeq ?? null,
920
+ truncated: res.truncated ?? false
921
+ };
922
+ }
900
923
  // ----------------------------------------------------------- Internals
901
924
  /** Drive an existing run to completion (collect events, dispatch local tools). */
902
925
  async driveRun(runId, handlers, opts = {}) {
@@ -1216,7 +1239,7 @@ var MantyxClient = class {
1216
1239
  const agentRunId = typeof record.agentRunId === "string" ? record.agentRunId : typeof nested?.agentRunId === "string" ? nested.agentRunId : "";
1217
1240
  if (agentRunId) {
1218
1241
  const localEv = evalEventToLocalToolCall(ev);
1219
- void this.dispatchLocalTool(agentRunId, localEv, handlers).catch(() => void 0);
1242
+ await this.dispatchLocalTool(agentRunId, localEv, handlers);
1220
1243
  }
1221
1244
  }
1222
1245
  options.onEvent?.(ev);
@@ -1404,6 +1427,7 @@ var AgentSession = class {
1404
1427
  }
1405
1428
  if (this.tools.length > 0) body.tools = serializeToolRefs(this.tools);
1406
1429
  if (opts.metadata && Object.keys(opts.metadata).length > 0) body.metadata = opts.metadata;
1430
+ if (opts.newLoop !== void 0) body.newLoop = opts.newLoop;
1407
1431
  if (opts.reasoningLevel !== void 0) {
1408
1432
  body.reasoningLevel = normalizeReasoningLevel(opts.reasoningLevel);
1409
1433
  }
@@ -1444,6 +1468,12 @@ var AgentSession = class {
1444
1468
  async info() {
1445
1469
  return this.client.getSessionInfo(this.id);
1446
1470
  }
1471
+ async events(opts = {}) {
1472
+ return this.client.getSessionEvents(this.id, opts);
1473
+ }
1474
+ async eventsPage(opts = {}) {
1475
+ return this.client.getSessionEventsPage(this.id, opts);
1476
+ }
1447
1477
  async end() {
1448
1478
  try {
1449
1479
  await this.client.endSession(this.id);
@@ -1483,6 +1513,7 @@ function serializeAgentSpec(spec, extra = {}) {
1483
1513
  if (spec.agentId) body.agentId = spec.agentId;
1484
1514
  if (spec.name) body.name = spec.name;
1485
1515
  if (spec.modelId) body.modelId = spec.modelId;
1516
+ if (spec.newLoop !== void 0) body.newLoop = spec.newLoop;
1486
1517
  if (spec.reasoningLevel !== void 0) {
1487
1518
  body.reasoningLevel = normalizeReasoningLevel(spec.reasoningLevel);
1488
1519
  }
@@ -1522,6 +1553,7 @@ function serializeCreateEvalRunRequest(spec) {
1522
1553
  throw new MantyxError("createEvalRun accepts only one of `agentId` or `agent`");
1523
1554
  }
1524
1555
  const body = {};
1556
+ if (spec.newLoop !== void 0) body.newLoop = spec.newLoop;
1525
1557
  if (spec.datasetId) body.datasetId = spec.datasetId;
1526
1558
  if (spec.dataset) body.dataset = spec.dataset;
1527
1559
  if (spec.agentId) body.agentId = spec.agentId;
@@ -1687,6 +1719,9 @@ function normalizeOutputSchema(value) {
1687
1719
  }
1688
1720
  out.enforcement = value.enforcement;
1689
1721
  }
1722
+ if (value.schema == null) {
1723
+ throw new MantyxError("outputSchema.schema must be a Zod schema or a non-null JSON object");
1724
+ }
1690
1725
  const schema = toToolParametersWire(
1691
1726
  value.schema
1692
1727
  );
@@ -2094,4 +2129,3 @@ export {
2094
2129
  taskPlanFromEventData,
2095
2130
  parseRunOutput
2096
2131
  };
2097
- //# sourceMappingURL=chunk-4EJRV6KZ.js.map
package/dist/client.d.ts CHANGED
@@ -102,6 +102,7 @@ export interface AgentEvalOverrides {
102
102
  }
103
103
  /** Body for `POST /eval-runs`. Exactly one of `datasetId`/`dataset` and `agentId`/`agent`. */
104
104
  export interface CreateEvalRunRequest {
105
+ newLoop?: boolean;
105
106
  datasetId?: string;
106
107
  dataset?: InlineEvalDatasetSpec;
107
108
  agentId?: string;
@@ -342,6 +343,8 @@ export interface AgentSpecBase {
342
343
  systemPrompt?: string;
343
344
  modelId?: string;
344
345
  tools?: ToolRef[];
346
+ /** Opt into the verified loop; omission preserves legacy behavior or session inheritance. */
347
+ newLoop?: boolean;
345
348
  /**
346
349
  * Provider thinking strength: a string anchor (`"off" | "low" | "medium" |
347
350
  * "high"`) or an integer in `0..100` (where `0` explicitly disables provider
@@ -1054,8 +1057,21 @@ export interface SessionListResult {
1054
1057
  total: number;
1055
1058
  limit: number;
1056
1059
  offset: number;
1060
+ /** Opaque cursor for the next page. Absent on older MANTYX servers. */
1061
+ nextCursor?: string | null;
1057
1062
  sessions: SessionSummary[];
1058
1063
  }
1064
+ /** One bounded page from {@link MantyxClient.getSessionEventsPage}. */
1065
+ export interface SessionEventsPage {
1066
+ sessionId: string;
1067
+ /** Total messages in the session, not just this page. */
1068
+ total: number;
1069
+ events: RunEvent[];
1070
+ /** Pass this value back as `beforeSeq` to fetch the preceding page. */
1071
+ nextBeforeSeq: number | null;
1072
+ /** True when older messages remain before this page. */
1073
+ truncated: boolean;
1074
+ }
1059
1075
  export declare class MantyxClient {
1060
1076
  readonly options: Required<Pick<MantyxClientOptions, "workspaceSlug" | "baseUrl">> & {
1061
1077
  /**
@@ -1123,6 +1139,8 @@ export declare class MantyxClient {
1123
1139
  status?: "active" | "ended";
1124
1140
  limit?: number;
1125
1141
  offset?: number;
1142
+ /** Opaque `nextCursor` returned by the previous page. */
1143
+ cursor?: string;
1126
1144
  }): Promise<SessionListResult>;
1127
1145
  /**
1128
1146
  * Fetch a session's conversation as realtime-style event frames so a UI can
@@ -1135,6 +1153,14 @@ export declare class MantyxClient {
1135
1153
  full?: boolean;
1136
1154
  lastMessages?: number;
1137
1155
  }): Promise<RunEvent[]>;
1156
+ /**
1157
+ * Fetch one bounded page of session events. Pages are returned in ascending
1158
+ * sequence order; follow `nextBeforeSeq` to walk backward through history.
1159
+ */
1160
+ getSessionEventsPage(sessionId: string, opts?: {
1161
+ lastMessages?: number;
1162
+ beforeSeq?: number;
1163
+ }): Promise<SessionEventsPage>;
1138
1164
  /** Drive an existing run to completion (collect events, dispatch local tools). */
1139
1165
  driveRun(runId: string, handlers: LocalHandlers, opts?: {
1140
1166
  onAssistantDelta?: (delta: string) => void;
@@ -1233,6 +1259,8 @@ export declare class AgentSession {
1233
1259
  * Per-message override for `reasoningLevel`. Applies only to this run
1234
1260
  * and does not mutate the session's stored value.
1235
1261
  */
1262
+ /** Opt into the verified loop; omission preserves legacy behavior or session inheritance. */
1263
+ newLoop?: boolean;
1236
1264
  reasoningLevel?: ReasoningLevel;
1237
1265
  /**
1238
1266
  * Per-message override for `outputSchema`. Applies only to this run
@@ -1266,6 +1294,8 @@ export declare class AgentSession {
1266
1294
  signal?: AbortSignal;
1267
1295
  attachments?: MessageAttachment[];
1268
1296
  metadata?: Record<string, string>;
1297
+ /** Opt into the verified loop; omission preserves legacy behavior or session inheritance. */
1298
+ newLoop?: boolean;
1269
1299
  reasoningLevel?: ReasoningLevel;
1270
1300
  outputSchema?: OutputSchema;
1271
1301
  loopDetection?: LoopDetection | false;
@@ -1281,6 +1311,8 @@ export declare class AgentSession {
1281
1311
  onAssistantDelta?: (s: string) => void;
1282
1312
  signal?: AbortSignal;
1283
1313
  metadata?: Record<string, string>;
1314
+ /** Opt into the verified loop; omission preserves legacy behavior or session inheritance. */
1315
+ newLoop?: boolean;
1284
1316
  reasoningLevel?: ReasoningLevel;
1285
1317
  outputSchema?: OutputSchema;
1286
1318
  loopDetection?: LoopDetection | false;
@@ -1291,6 +1323,14 @@ export declare class AgentSession {
1291
1323
  }): Promise<RunResult>;
1292
1324
  history(): Promise<ConversationMessage[]>;
1293
1325
  info(): Promise<SessionInfo>;
1326
+ events(opts?: {
1327
+ full?: boolean;
1328
+ lastMessages?: number;
1329
+ }): Promise<RunEvent[]>;
1330
+ eventsPage(opts?: {
1331
+ lastMessages?: number;
1332
+ beforeSeq?: number;
1333
+ }): Promise<SessionEventsPage>;
1294
1334
  end(): Promise<void>;
1295
1335
  }
1296
1336
  /** Internal registry of client-resolved handlers, indexed by `kind`. */
@@ -1334,4 +1374,3 @@ export declare function taskPlanFromEventData(data: Record<string, unknown>): Ta
1334
1374
  * ```
1335
1375
  */
1336
1376
  export declare function parseRunOutput<T = unknown>(result: RunResult, validator?: (value: unknown) => T): T;
1337
- //# sourceMappingURL=client.d.ts.map
@@ -189,4 +189,3 @@ export declare function extractActions(result: RunResult): ComputerUseActionCall
189
189
  * console.log(out.finalText);
190
190
  */
191
191
  export declare function runComputerUse(opts: RunComputerUseOptions): Promise<ComputerUseResult>;
192
- //# sourceMappingURL=computer-use.d.ts.map
package/dist/errors.d.ts CHANGED
@@ -163,4 +163,3 @@ export declare class MantyxParseError extends MantyxError {
163
163
  cause?: unknown;
164
164
  });
165
165
  }
166
- //# sourceMappingURL=errors.d.ts.map