@mantyx/sdk 0.22.0 → 0.23.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/a2a-server.cjs.map +1 -1
  3. package/dist/a2a-server.d.ts +13 -16
  4. package/dist/a2a-server.d.ts.map +1 -0
  5. package/dist/a2a-server.js +1 -1
  6. package/dist/{chunk-5NKXV5XZ.js → chunk-OUK6ZZ5H.js} +87 -14
  7. package/dist/chunk-OUK6ZZ5H.js.map +1 -0
  8. package/dist/{client-C7TzTpNW.d.ts → client.d.ts} +131 -840
  9. package/dist/client.d.ts.map +1 -0
  10. package/dist/{computer-use-4QzI3lGU.d.ts → computer-use.d.ts} +21 -22
  11. package/dist/computer-use.d.ts.map +1 -0
  12. package/dist/errors.d.ts +153 -0
  13. package/dist/errors.d.ts.map +1 -0
  14. package/dist/index.cjs +88 -14
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.ts +44 -55
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +4 -2
  19. package/dist/index.js.map +1 -1
  20. package/dist/local-resolver.d.ts +49 -0
  21. package/dist/local-resolver.d.ts.map +1 -0
  22. package/dist/oauth.d.ts +189 -0
  23. package/dist/oauth.d.ts.map +1 -0
  24. package/dist/playwright.d.ts +6 -11
  25. package/dist/playwright.d.ts.map +1 -0
  26. package/dist/sse.d.ts +27 -0
  27. package/dist/sse.d.ts.map +1 -0
  28. package/dist/tools.d.ts +426 -0
  29. package/dist/tools.d.ts.map +1 -0
  30. package/dist/version.d.ts +5 -0
  31. package/dist/version.d.ts.map +1 -0
  32. package/dist/zod-to-json-schema.d.ts +25 -0
  33. package/dist/zod-to-json-schema.d.ts.map +1 -0
  34. package/docs/agent-runs-protocol.md +52 -16
  35. package/package.json +11 -11
  36. package/dist/a2a-server.d.cts +0 -176
  37. package/dist/chunk-5NKXV5XZ.js.map +0 -1
  38. package/dist/client-C7TzTpNW.d.cts +0 -2033
  39. package/dist/computer-use-1m6E_VIl.d.cts +0 -193
  40. package/dist/index.d.cts +0 -61
  41. package/dist/playwright.d.cts +0 -88
@@ -0,0 +1,426 @@
1
+ /**
2
+ * Public tool helpers for the MANTYX SDK.
3
+ *
4
+ * Server-resolved (executed by MANTYX):
5
+ * mantyxTool(id) → existing workspace `Tool` row by id
6
+ * mantyxPluginTool(name) → built-in plugin tool by `@plugin/tool` name
7
+ * mantyxA2A({...}) → remote Agent2Agent peer, dialed by MANTYX
8
+ * mantyxMcp({...}) → remote MCP server (Streamable HTTP), proxied by MANTYX
9
+ *
10
+ * Client-resolved (executed in this process; the SDK shuttles inputs and
11
+ * outputs over the agent loop):
12
+ * defineLocalTool({...}) → generic local tool with a Zod parameter schema
13
+ * defineLocalA2A({...}) → A2A peer the SDK can reach but MANTYX cannot —
14
+ * pass an `agentCardUrl`; the SDK fetches the
15
+ * Agent Card and speaks A2A `message/send` for you.
16
+ * defineLocalMcp({...}) → MCP server the SDK manages — pass either a
17
+ * Streamable HTTP `url` or a stdio
18
+ * `command`; the SDK runs `Initialize` +
19
+ * `tools/list` and forwards `tools/call` for you.
20
+ *
21
+ * The server emits a `local_tool_call` event for every client-resolved
22
+ * invocation. The event carries a `kind` discriminator (`"local"` is implied
23
+ * when omitted, `"a2a_local"` and `"mcp_local"` are explicit) so the SDK can
24
+ * dispatch to the right handler.
25
+ */
26
+ import type { z } from "zod";
27
+ export type ZodLikeObject = z.ZodType<Record<string, unknown>> & {
28
+ _def?: unknown;
29
+ parse?: (value: unknown) => unknown;
30
+ };
31
+ /**
32
+ * Provider-thinking knob, mapped server-side onto each LLM's native dial:
33
+ * `reasoning.effort` (OpenAI), `thinkingConfig.thinkingLevel` / `thinkingBudget`
34
+ * (Gemini), or extended-thinking budget (Anthropic / Bedrock-Anthropic).
35
+ *
36
+ * Pass either a string anchor (`"off" | "low" | "medium" | "high"`) or an
37
+ * integer in `0..100` (where `0` explicitly disables provider thinking).
38
+ */
39
+ export type ReasoningLevel = "off" | "low" | "medium" | "high" | number;
40
+ /**
41
+ * A file produced by a client-resolved tool, returned alongside the textual
42
+ * `result`. The bytes are surfaced to the model on the next turn as native
43
+ * file parts (Anthropic / Gemini / Bedrock inside the `tool_result`; OpenAI
44
+ * as a synthetic follow-up user turn) — the same pipeline used by
45
+ * server-resolved tools that return files.
46
+ *
47
+ * Limits (enforced server-side): up to 20 files per result, `mimeType` must
48
+ * be an allowed attachment type, and the combined decoded size is capped
49
+ * (currently 5 MB). Files over the inline threshold are persisted to object
50
+ * storage and forwarded by reference. For larger artifacts, upload them out
51
+ * of band and reference a URL in `result` instead. See
52
+ * `docs/agent-runs-protocol.md` §8 and `docs/wire-protocol.md` §4.
53
+ */
54
+ export interface ToolResultFile {
55
+ /** Display filename surfaced to the model (e.g. `"chart.png"`). */
56
+ filename: string;
57
+ /** Allowed attachment MIME type (e.g. `"image/png"`, `"text/plain"`). */
58
+ mimeType: string;
59
+ /** Base64-encoded file bytes — **no** `data:` URL prefix. */
60
+ data: string;
61
+ }
62
+ /**
63
+ * Rich return value for a {@link LocalTool}'s `execute`. Return this (instead
64
+ * of a bare string) when the tool needs to hand files back to the model in
65
+ * addition to — or instead of — its textual result.
66
+ *
67
+ * `result` is the same string a tool would normally return; omit it (or pass
68
+ * the empty string) when the files are the whole payload. `files` is ignored
69
+ * when the tool throws — errors are surfaced to the model as a tool-error
70
+ * response with no attachments.
71
+ */
72
+ export interface LocalToolResult {
73
+ /** Textual result. Optional when `files` carries the payload. */
74
+ result?: string;
75
+ /** Files to surface to the model on the next turn. */
76
+ files?: ToolResultFile[];
77
+ }
78
+ /**
79
+ * What a {@link LocalTool}'s `execute` may return: a bare string (the common
80
+ * case) or a {@link LocalToolResult} carrying files. Non-string, non-result
81
+ * values are JSON-serialized by the SDK before being posted back.
82
+ */
83
+ export type LocalToolOutput = string | LocalToolResult;
84
+ /**
85
+ * Either a Zod schema (auto-converted to JSON Schema by the SDK) or a
86
+ * pre-shaped JSON Schema object. Used for both `parameters` and the new
87
+ * `outputSchema` field — same conversion path either way.
88
+ */
89
+ export type LocalToolSchemaInput = ZodLikeObject | Record<string, unknown>;
90
+ export interface LocalTool<TArgs = Record<string, unknown>> {
91
+ readonly kind: "local";
92
+ readonly name: string;
93
+ readonly description: string;
94
+ readonly parameters: ZodLikeObject | undefined;
95
+ /**
96
+ * Optional JSON Schema (or Zod schema, auto-converted) describing the
97
+ * tool's structured return value. Forwarded to providers with per-tool
98
+ * response schemas (Gemini's `responseJsonSchema` on the
99
+ * FunctionDeclaration); other engines surface it through the description
100
+ * and rely on host-side validation. The model uses it to plan follow-up
101
+ * arguments more reliably. See `docs/wire-protocol.md` §3.1.
102
+ */
103
+ readonly outputSchema: LocalToolSchemaInput | undefined;
104
+ /**
105
+ * When `true`, MANTYX appends a stable hint to the model-facing
106
+ * description telling the model not to re-issue calls while a previous
107
+ * invocation is still pending. Useful for tools that may yield a
108
+ * `pending` / status response and the SDK polls on its own; without the
109
+ * hint, models routinely fire repeat calls and waste turns. Pure
110
+ * declarative — MANTYX does not change scheduling.
111
+ */
112
+ readonly longRunning: boolean;
113
+ /**
114
+ * When `true`, this tool may run **in parallel** with other read-only
115
+ * tools the model emits in the same turn: MANTYX publishes every such
116
+ * `local_tool_call` concurrently and resolves them together instead of
117
+ * one-at-a-time in model-emit order. Set this only for side-effect-free
118
+ * tools whose results don't depend on each other. Mutating tools (the
119
+ * default, `false`) stay strictly sequential. See
120
+ * `docs/agent-runs-protocol.md` §4.1.1.
121
+ */
122
+ readonly readOnly: boolean;
123
+ /**
124
+ * When `true`, the tool's result is **persisted with the session and
125
+ * replayed to the model on later turns** — reconstructed as a
126
+ * `tool_use` + `tool_result` pair in its original place in the
127
+ * transcript. Only meaningful for session-scoped runs. Keep outputs
128
+ * small (text only, ~8 KB cap). See `docs/agent-runs-protocol.md`
129
+ * §4.1.1.
130
+ */
131
+ readonly retain: boolean;
132
+ readonly execute: (args: TArgs) => Promise<LocalToolOutput> | LocalToolOutput;
133
+ }
134
+ export interface DefineLocalToolOptions<T extends ZodLikeObject | undefined> {
135
+ /** Lowercase alphanumeric + underscore, max 64 chars. */
136
+ name: string;
137
+ description?: string;
138
+ parameters?: T;
139
+ /**
140
+ * Optional JSON Schema (or Zod schema) describing the tool's return
141
+ * value. See {@link LocalTool.outputSchema}.
142
+ */
143
+ outputSchema?: LocalToolSchemaInput;
144
+ /**
145
+ * Annotate the tool as long-running so the model doesn't double-call
146
+ * while a previous invocation is still pending. See
147
+ * {@link LocalTool.longRunning}.
148
+ */
149
+ longRunning?: boolean;
150
+ /**
151
+ * Mark the tool as read-only so MANTYX may run it in parallel with other
152
+ * read-only tools the model emits in the same turn. See
153
+ * {@link LocalTool.readOnly}.
154
+ */
155
+ readOnly?: boolean;
156
+ /**
157
+ * Persist the tool result across session turns so follow-ups can
158
+ * reference values the model can no longer recompute. See
159
+ * {@link LocalTool.retain}.
160
+ */
161
+ retain?: boolean;
162
+ execute: (args: T extends ZodLikeObject ? z.infer<T> : Record<string, unknown>) => Promise<LocalToolOutput> | LocalToolOutput;
163
+ }
164
+ export declare function defineLocalTool<T extends ZodLikeObject | undefined>(opts: DefineLocalToolOptions<T>): LocalTool;
165
+ export interface MantyxToolRef {
166
+ readonly kind: "mantyx";
167
+ readonly id: string;
168
+ }
169
+ export interface MantyxPluginToolRef {
170
+ readonly kind: "mantyx_plugin";
171
+ readonly name: string;
172
+ }
173
+ export declare function mantyxTool(id: string): MantyxToolRef;
174
+ export declare function mantyxPluginTool(name: string): MantyxPluginToolRef;
175
+ /**
176
+ * Reference to a remote Agent2Agent peer reachable from MANTYX (server-resolved).
177
+ * MANTYX dials `agentCardUrl` over A2A's `message/send` RPC and forwards the
178
+ * remote agent's reply as the tool result.
179
+ */
180
+ export interface A2AToolRef {
181
+ readonly kind: "a2a";
182
+ readonly name: string;
183
+ readonly description?: string;
184
+ readonly agentCardUrl: string;
185
+ readonly headers?: Record<string, string>;
186
+ readonly contextId?: string;
187
+ }
188
+ export interface MantyxA2AOptions {
189
+ /** Tool name surfaced to the model; must match `^[a-zA-Z0-9_]{1,64}$`. */
190
+ name: string;
191
+ description?: string;
192
+ /** Remote Agent Card URL (`/.well-known/agent-card.json`) or JSON-RPC root. */
193
+ agentCardUrl: string;
194
+ /** Per-request HTTP headers (typically `Authorization`). */
195
+ headers?: Record<string, string>;
196
+ /** Optional A2A `contextId` to thread multiple delegations. */
197
+ contextId?: string;
198
+ }
199
+ export declare function mantyxA2A(opts: MantyxA2AOptions): A2AToolRef;
200
+ /**
201
+ * Local A2A peer — the SDK fetches the Agent Card from `agentCardUrl` on
202
+ * the first run, ships the resolved card with the spec, and speaks A2A
203
+ * `message/send` to `agentCard.url` whenever MANTYX emits a
204
+ * `local_tool_call` for this tool. You only supply the URL.
205
+ *
206
+ * The model addresses this tool by `name` and always passes
207
+ * `{ message: string }` as arguments.
208
+ *
209
+ * Resolution is lazy: the card is fetched on the first `runAgent` /
210
+ * `streamAgent` / `createSession` (or `session.send`) call and cached on
211
+ * the tool ref for the rest of the process lifetime. Re-construct the ref
212
+ * to force a refetch.
213
+ */
214
+ export interface LocalA2ATool {
215
+ readonly kind: "a2a_local";
216
+ readonly name: string;
217
+ /** Where the SDK fetches the Agent Card from. Cached after the first hit. */
218
+ readonly agentCardUrl: string;
219
+ /**
220
+ * Headers used for **both** the card fetch and every `message/send` POST
221
+ * (typically `Authorization` for intranet peers).
222
+ */
223
+ readonly headers: Record<string, string> | undefined;
224
+ /**
225
+ * Internal cache of the resolved Agent Card. Populated lazily by the
226
+ * client on the first run; not part of the user contract.
227
+ * @internal
228
+ */
229
+ _resolvedCard?: ResolvedAgentCard;
230
+ }
231
+ /** Internal: the snapshot of a resolved A2A Agent Card. */
232
+ export interface ResolvedAgentCard {
233
+ /** Required by the A2A spec; used for the synthesized tool description. */
234
+ readonly name: string;
235
+ /** Peer's A2A endpoint — where the SDK POSTs `message/send`. */
236
+ readonly url?: string;
237
+ /** Anything else the peer publishes; forwarded verbatim onto the wire. */
238
+ readonly [k: string]: unknown;
239
+ }
240
+ export interface DefineLocalA2AOptions {
241
+ /** Tool name surfaced to the model. Must match `^[a-zA-Z0-9_]{1,64}$`. */
242
+ name: string;
243
+ /**
244
+ * URL of the peer's Agent Card (`/.well-known/agent-card.json` is the
245
+ * conventional path). The SDK fetches this on the first run, parses it,
246
+ * and ships the resolved card with the spec. The resolved card's `url`
247
+ * field is then used as the `message/send` target.
248
+ */
249
+ agentCardUrl: string;
250
+ /**
251
+ * Headers attached to **both** the card fetch and every `message/send`
252
+ * POST (typically `Authorization` for intranet peers).
253
+ */
254
+ headers?: Record<string, string>;
255
+ }
256
+ export declare function defineLocalA2A(opts: DefineLocalA2AOptions): LocalA2ATool;
257
+ /**
258
+ * Reference to a remote MCP server (Streamable HTTP) discovered + proxied by
259
+ * MANTYX. Each tool in the catalog is exposed to the model as `<name>_<tool>`.
260
+ */
261
+ export interface McpToolRef {
262
+ readonly kind: "mcp";
263
+ readonly name: string;
264
+ readonly url: string;
265
+ readonly headers?: Record<string, string>;
266
+ readonly toolFilter?: string[];
267
+ }
268
+ export interface MantyxMcpOptions {
269
+ /** Server label; used to prefix every discovered tool. */
270
+ name: string;
271
+ /** Streamable HTTP MCP endpoint. */
272
+ url: string;
273
+ headers?: Record<string, string>;
274
+ /** Optional allowlist of MCP tool names. */
275
+ toolFilter?: string[];
276
+ }
277
+ export declare function mantyxMcp(opts: MantyxMcpOptions): McpToolRef;
278
+ /**
279
+ * Streamable HTTP transport spec for {@link defineLocalMcp}.
280
+ */
281
+ export interface LocalMcpHttpTransport {
282
+ /** Streamable HTTP MCP endpoint (e.g. `http://localhost:8080/mcp`). */
283
+ url: string;
284
+ /** HTTP headers sent on every MCP request (typically `Authorization`). */
285
+ headers?: Record<string, string>;
286
+ }
287
+ /**
288
+ * stdio transport spec for {@link defineLocalMcp}. The SDK spawns the
289
+ * specified executable with the given arguments and speaks JSON-RPC over
290
+ * its stdin/stdout streams.
291
+ */
292
+ export interface LocalMcpStdioTransport {
293
+ /** Executable to launch (e.g. `mcp-server-filesystem`, `node`, `uvx`). */
294
+ command: string;
295
+ /** Arguments passed verbatim. */
296
+ args?: string[];
297
+ /** Environment variables for the child process. Inherited if undefined. */
298
+ env?: Record<string, string>;
299
+ /** Working directory for the child process. */
300
+ cwd?: string;
301
+ }
302
+ /**
303
+ * Local MCP server — the SDK manages the entire MCP lifecycle for you.
304
+ *
305
+ * Pass either a Streamable HTTP `url` or an stdio `command` (mutually
306
+ * exclusive). On the first run, the SDK opens the transport, runs MCP's
307
+ * `Initialize` (capturing the `Implementation` block) and `tools/list`
308
+ * (capturing the catalog), and ships both inline as part of the spec. On
309
+ * every `local_tool_call` with `kind: "mcp_local"` the SDK forwards the
310
+ * call to MCP `tools/call` on the cached connection and POSTs the
311
+ * flattened text response back to MANTYX.
312
+ *
313
+ * Connections are reused across runs and across messages within a session
314
+ * and closed on `runAgent` completion / `session.end()`.
315
+ */
316
+ export interface LocalMcpServer {
317
+ readonly kind: "mcp_local";
318
+ readonly name: string;
319
+ /** One-of with {@link stdio} — the transport spec is mutually exclusive. */
320
+ readonly http: LocalMcpHttpTransport | undefined;
321
+ /** One-of with {@link http} — the transport spec is mutually exclusive. */
322
+ readonly stdio: LocalMcpStdioTransport | undefined;
323
+ /**
324
+ * Internal cache of the resolved MCP client + catalog. Populated lazily
325
+ * by the run driver on the first run; not part of the user contract.
326
+ * @internal
327
+ */
328
+ _resolved?: ResolvedMcpServer;
329
+ }
330
+ /**
331
+ * Internal: the live MCP client + the snapshot the SDK ships on the wire.
332
+ */
333
+ export interface ResolvedMcpServer {
334
+ /** The MCP `Implementation` block from `Initialize`. */
335
+ readonly serverInfo: {
336
+ name: string;
337
+ version?: string;
338
+ [k: string]: unknown;
339
+ };
340
+ /** Verbatim `tools/list` output. */
341
+ readonly tools: ReadonlyArray<{
342
+ readonly name: string;
343
+ readonly description?: string;
344
+ readonly inputSchema: Record<string, unknown>;
345
+ readonly annotations?: Record<string, unknown>;
346
+ readonly [k: string]: unknown;
347
+ }>;
348
+ /**
349
+ * The live MCP client. Used by the run driver to call `tools/call`. The
350
+ * concrete type depends on the transport — kept loose so this header
351
+ * file doesn't have to import the MCP SDK type.
352
+ */
353
+ readonly client: McpClientLike;
354
+ /** Closes the MCP transport (idempotent). */
355
+ readonly close: () => Promise<void>;
356
+ }
357
+ /** Minimal interface this SDK uses against an MCP client. */
358
+ export interface McpClientLike {
359
+ callTool(params: {
360
+ name: string;
361
+ arguments?: Record<string, unknown>;
362
+ }): Promise<{
363
+ content?: Array<{
364
+ type: string;
365
+ text?: string;
366
+ [k: string]: unknown;
367
+ }>;
368
+ isError?: boolean;
369
+ [k: string]: unknown;
370
+ }>;
371
+ }
372
+ export interface DefineLocalMcpOptions {
373
+ /**
374
+ * Server label echoed back as `mcpServer` on every `local_tool_call`. The
375
+ * SDK auto-prefixes each discovered tool's wire-level `name` with
376
+ * `<this>_` so the model sees a non-colliding `<server>_<tool>` surface
377
+ * — mirroring how MANTYX prefixes for `kind: "mcp"`.
378
+ */
379
+ name: string;
380
+ /**
381
+ * Streamable HTTP transport. Mutually exclusive with {@link command}.
382
+ */
383
+ url?: string;
384
+ /**
385
+ * Headers attached to every MCP request when using the HTTP transport.
386
+ */
387
+ headers?: Record<string, string>;
388
+ /**
389
+ * stdio transport: executable to launch. Mutually exclusive with
390
+ * {@link url}.
391
+ */
392
+ command?: string;
393
+ /** Arguments for the stdio child process. */
394
+ args?: string[];
395
+ /** Environment variables for the stdio child process. */
396
+ env?: Record<string, string>;
397
+ /** Working directory for the stdio child process. */
398
+ cwd?: string;
399
+ }
400
+ export declare function defineLocalMcp(opts: DefineLocalMcpOptions): LocalMcpServer;
401
+ export type ToolRef = MantyxToolRef | MantyxPluginToolRef | LocalTool | A2AToolRef | LocalA2ATool | McpToolRef | LocalMcpServer;
402
+ export declare function isLocalTool(t: ToolRef): t is LocalTool;
403
+ export declare function isLocalA2ATool(t: ToolRef): t is LocalA2ATool;
404
+ export declare function isLocalMcpServer(t: ToolRef): t is LocalMcpServer;
405
+ /**
406
+ * Compose the wire-level (model-facing) tool name for a `mcp_local` entry.
407
+ * The SDK auto-prefixes every discovered tool's bare name with the server
408
+ * label so the model surface stays `<server>_<tool>`.
409
+ */
410
+ export declare function prefixedMcpToolName(serverName: string, toolName: string): string;
411
+ /**
412
+ * Coerce whatever a local tool's `execute` returned into the wire-level
413
+ * `{ result, files }` pair the SDK POSTs back:
414
+ *
415
+ * - `string` → `{ result }`
416
+ * - `{ result?, files? }` → forwarded as-is (files validated)
417
+ * - any other value → `{ result: JSON.stringify(value) }`
418
+ *
419
+ * The third case preserves the long-standing "non-string returns are
420
+ * JSON-serialized" contract for handlers that return plain objects.
421
+ */
422
+ export declare function normalizeLocalToolOutput(out: unknown): {
423
+ result: string;
424
+ files?: ToolResultFile[];
425
+ };
426
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG;IAC/D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;CACrC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAIxE;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,cAAc;IAC7B,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,QAAQ,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,IAAI,EAAE,MA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o root VERSION (`npm run sync-version`).
3
+ */
4
+ export declare const SDK_VERSION = "0.23.0";
5
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,WAAW,WAAW,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Lightweight Zod → JSON Schema converter for tool parameter definitions.
3
+ *
4
+ * Resolution order:
5
+ * 1. `schema.toJSONSchema()` on the instance (Zod v4; works across package
6
+ * copies when the user's `zod` and the SDK's `zod` are different installs)
7
+ * 2. `z.toJSONSchema(schema)` from the SDK's `zod` import (Zod v4, same copy)
8
+ * 3. Hand-rolled walker for Zod v3 `typeName` and Zod v4 `_def.type`
9
+ *
10
+ * The output is a JSON-Schema-shaped object with `type: "object"`, `properties`,
11
+ * and `required`. The MANTYX server feeds this to LLM providers verbatim, so
12
+ * unsupported zod features (effects, transforms, intersections) degrade to a
13
+ * permissive `"object"` description rather than failing.
14
+ */
15
+ import { z } from "zod";
16
+ type JsonSchema = Record<string, unknown>;
17
+ export declare function zodToJsonSchema(schema: z.ZodType<unknown>): JsonSchema;
18
+ /**
19
+ * Coerce a JSON-Schema-shaped value into a wire object suitable for the
20
+ * MANTYX local-tool definition payload. Accepts either a Zod schema or an
21
+ * already-shaped JSON Schema object.
22
+ */
23
+ export declare function toToolParametersWire(parameters: z.ZodType<unknown> | JsonSchema | undefined): JsonSchema;
24
+ export {};
25
+ //# sourceMappingURL=zod-to-json-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod-to-json-schema.d.ts","sourceRoot":"","sources":["../src/zod-to-json-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAqD1C,wBAAgB,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,UAAU,CAqBtE;AA+FD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,UAAU,GAAG,SAAS,GACtD,UAAU,CAMZ"}
@@ -993,12 +993,17 @@ the verdict by the time the event arrives.
993
993
 
994
994
  `plan` turns on the in-product **task plan** — the same live-checklist engine
995
995
  that powers MANTYX chat / Hive Mind. It is **opt-in** on API/ephemeral runs,
996
- same as `supervisor` (§4.8), because both features add extra LLM calls.
996
+ same as `supervisor` (§4.8). Active plans are owned by the executing agent
997
+ through the host `update_task_plan` tool; there is no pre-flight classifier or
998
+ separate tracker LLM call.
997
999
 
998
1000
  ```jsonc
999
- "plan": true // auto: classify, emit a task_plan event, track during the run
1001
+ "plan": true // compatibility alias for "auto"
1002
+ "plan": "auto" // agent decides during its normal first turn
1003
+ "plan": "required" // agent must initialize a plan before substantive tools
1000
1004
 
1001
1005
  "plan": { // caller-provided checklist — skips the classifier
1006
+ "mode": "required",
1002
1007
  "brief": "Migrate the billing tables and backfill", // optional
1003
1008
  "steps": ["Snapshot current schema", "Apply migration", "Backfill rows", "Verify counts"]
1004
1009
  }
@@ -1012,19 +1017,22 @@ same as `supervisor` (§4.8), because both features add extra LLM calls.
1012
1017
  | Form | Behavior |
1013
1018
  | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1014
1019
  | omitted / `false` | No planning. Default. |
1015
- | `true` | Pre-flight classifier decides whether a multi-step plan is warranted. If so, a `task_plan` event is emitted (see §7), the checklist is injected into the user turn, and step statuses are tracked (advancing on tool activity and supervisor reviews) until the run ends. If it declines, the run proceeds with no plan. |
1016
- | `{ steps, brief? }` | Caller-provided checklist used verbatim — **skips** the classifier (and its `MIN_STEPS` gate). Injected + tracked like the auto case. |
1020
+ | `true` / `"auto"` | Exposes `update_task_plan`; the executing agent decides during its normal first turn whether multi-step tracking is useful. No separate planning LLM call. |
1021
+ | `"required"` | Requires `update_task_plan` before substantive tools and rejects premature final answers while required steps remain unfinished (bounded continuation guard). |
1022
+ | `{ mode?, steps, brief? }` | Seeds an authoritative checklist. `mode` defaults to `auto`; use `required` to enforce initialization/execution. |
1017
1023
  | `{ planOnly: true, steps? }` | Produce the plan (classifier when `steps` omitted, otherwise the provided checklist) and **terminate without executing the agent loop**. The terminal `result` carries `data.plan` (see §7). |
1018
1024
 
1019
1025
  | Field | Type | Required | Notes |
1020
1026
  | ---------- | -------- | -------- | ---------------------------------------------------------------------------------------------------- |
1021
1027
  | `planOnly` | boolean | no | When `true`, the run stops after producing the plan. |
1028
+ | `mode` | string | no | `off`, `auto`, or `required`. Defaults to `auto`. |
1022
1029
  | `brief` | string | no | One-line objective for a caller-provided plan. Clamped server-side. |
1023
1030
  | `steps` | string[] | no | Caller-provided checklist titles. Empty/omitted ⇒ auto-classify. Count + per-step length clamped server-side. |
1024
1031
 
1025
1032
  Plan-only runs do **not** append an assistant turn to a session (the plan is
1026
- not the answer). Planner LLM usage (classifier + per-run tracker) is metered
1027
- under the `task_planning` usage surface.
1033
+ not the answer). When no steps are supplied, this compatibility-only path
1034
+ still uses the one-shot planner and meters it under `task_planning`; executed
1035
+ runs do not use the classifier/tracker path.
1028
1036
 
1029
1037
  **Inheritance for sessions.**
1030
1038
 
@@ -1293,10 +1301,37 @@ data: <utf-8 JSON>
1293
1301
  // mid-turn reasoning review (phase: "reasoning") — fired while the agent was still thinking
1294
1302
  { "seq": 6, "type": "supervisor", "data": { "action": "redirect", "phase": "reasoning", "reason": "Overthinking a simple case.", "redirect": "Commit and answer.", "llmCalls": 4 } }
1295
1303
 
1296
- // in-product task plan (see §4.9). Emitted only when the run carries a `plan` spec
1297
- // field: once after classify / caller-supplied plan, then on each tracker advance.
1298
- // Non-terminal — render as a live checklist. status ∈ "pending" | "in_progress" | "done".
1299
- { "seq": 4, "type": "task_plan", "data": { "brief": "Compare Q3 vs Q4 revenue.", "steps": [ { "title": "Pull revenue", "status": "in_progress" }, { "title": "Compute deltas", "status": "pending" } ] } }
1304
+ // Agent-owned task plan (see §4.9). Every transition carries the canonical
1305
+ // post-transition snapshot. `revision` is monotonic per plan; run-event `seq`
1306
+ // orders multiple transitions in one accepted update. `brief` and `steps`
1307
+ // remain mirrored at the top level for pre-v2 SDK clients.
1308
+ // status ∈ pending | in_progress | done | blocked | skipped.
1309
+ { "seq": 4, "type": "task_plan", "data": {
1310
+ "v": 2,
1311
+ "planId": "3b5f...",
1312
+ "revision": 2,
1313
+ "mode": "required",
1314
+ "source": "agent",
1315
+ "transition": { "kind": "step_completed", "stepId": "step-1" },
1316
+ "transitionIndex": 0,
1317
+ "transitionCount": 2,
1318
+ "brief": "Compare Q3 vs Q4 revenue.",
1319
+ "steps": [
1320
+ { "id": "step-1", "title": "Pull revenue", "status": "done" },
1321
+ { "id": "step-2", "title": "Compute deltas", "status": "in_progress" }
1322
+ ],
1323
+ "plan": {
1324
+ "v": 2,
1325
+ "planId": "3b5f...",
1326
+ "revision": 2,
1327
+ "mode": "required",
1328
+ "brief": "Compare Q3 vs Q4 revenue.",
1329
+ "steps": [
1330
+ { "id": "step-1", "title": "Pull revenue", "status": "done" },
1331
+ { "id": "step-2", "title": "Compute deltas", "status": "in_progress" }
1332
+ ]
1333
+ }
1334
+ } }
1300
1335
 
1301
1336
  // terminal event
1302
1337
  // Every terminal `result` event also carries `tokens`, `turns`, and `model`
@@ -1604,18 +1639,19 @@ A reference SDK should:
1604
1639
  defaults; passing `loopDetection: false` opts out; passing `toolBudgets: {}`
1605
1640
  clears the defaults. `supervisor` and `plan` are opt-in — omitting them
1606
1641
  keeps both off; pass `supervisor: true` / `{}` / `{ interval?, modelId? }`
1607
- or `plan: true` / `{ … }` to enable.
1642
+ or `plan: "auto"` / `"required"` / `{ … }` to enable.
1608
1643
  - Treat `loop_detected`, `tool_budget_exceeded`, and `supervisor` SSE
1609
1644
  events as observability-only — the server already substituted synthetic
1610
1645
  tool-results / steering nudges / supervisor verdicts where applicable, so
1611
1646
  the SDK's job is just to surface the event to the caller (status banner,
1612
1647
  log line, telemetry). Do **not** abort the run on these events; the run
1613
1648
  continues through `result` / `error` / `cancelled` as usual.
1614
- - Accept `plan` from the caller (`true` | `{ steps?, brief?, planOnly? }` |
1615
- `false`) and pass it through unchanged (see §4.9). It is opt-in — omitting
1616
- it (or `false`) means no planning. Render `task_plan` events as a live,
1617
- non-terminal checklist; for `planOnly` runs read the final checklist from
1618
- the terminal `result.data.plan`.
1649
+ - Accept `plan` from the caller (`off` / `auto` / `required`, the boolean
1650
+ compatibility aliases, or `{ mode?, steps?, brief?, planOnly? }`) and pass
1651
+ it through unchanged (see §4.9). Render `task_plan.data.plan` as the
1652
+ canonical checklist. Apply snapshots idempotently by `planId` + `revision`
1653
+ and use run-event `seq` to order multiple transitions in one revision.
1654
+ For `planOnly` runs read the final checklist from `result.data.plan`.
1619
1655
  - On terminal `result`, resolve the call. On `error` subtype, throw.
1620
1656
  4. Re-emit assistant deltas/events as a stream/iterator for callers who care
1621
1657
  about live output.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mantyx/sdk",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
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",
@@ -33,7 +33,7 @@
33
33
  ],
34
34
  "scripts": {
35
35
  "sync-version": "node ../scripts/sync-version.mjs",
36
- "build": "tsup --config tsup.config.ts",
36
+ "build": "tsup --config tsup.config.ts && tsc -p tsconfig.build.json",
37
37
  "dev": "tsup --config tsup.config.ts --watch",
38
38
  "typecheck": "tsc --noEmit",
39
39
  "test": "vitest run",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@modelcontextprotocol/sdk": "^1.29.0",
48
- "zod": "^3.23.8"
48
+ "zod": "^4.4.3"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@a2a-js/sdk": "^0.3.0",
@@ -64,14 +64,14 @@
64
64
  }
65
65
  },
66
66
  "devDependencies": {
67
- "@a2a-js/sdk": "^0.3.0",
68
- "@types/express": "^5.0.0",
69
- "@types/node": "^22.0.0",
70
- "express": "^5.0.0",
71
- "playwright": "^1.48.0",
72
- "tsup": "^8.3.0",
73
- "typescript": "^5.6.0",
74
- "vitest": "^2.1.0"
67
+ "@a2a-js/sdk": "^0.3.14",
68
+ "@types/express": "^5.0.6",
69
+ "@types/node": "^26.1.1",
70
+ "express": "^5.2.1",
71
+ "playwright": "^1.61.1",
72
+ "tsup": "^8.5.1",
73
+ "typescript": "^7.0.2",
74
+ "vitest": "^4.1.10"
75
75
  },
76
76
  "keywords": [
77
77
  "mantyx",