@mantyx/sdk 2026.11.10 → 2026.11.12

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/client.d.ts CHANGED
@@ -69,11 +69,25 @@ export interface InputFileUrlAttachmentMetadata {
69
69
  }
70
70
  /** Attachment metadata on session-event `user_message` replay frames. */
71
71
  export type AttachmentMetadata = InputFileAttachmentMetadata | InputFileUrlAttachmentMetadata;
72
+ /**
73
+ * A retained tool call and its result, carried on a prior `assistant`
74
+ * message. The server replays it to the model as a `tool_use` +
75
+ * `tool_result` pair. Session history returns these for `retain: true`
76
+ * tools; one-shot runs can send them to seed replayable history.
77
+ */
78
+ export interface ToolInteraction {
79
+ toolUseId: string;
80
+ name: string;
81
+ args?: Record<string, unknown>;
82
+ content: string;
83
+ }
72
84
  /** One entry in a multi-role `messages` array. */
73
85
  export interface ConversationMessage {
74
86
  role: "user" | "assistant" | "system";
75
87
  content: string;
76
88
  attachments?: MessageAttachment[];
89
+ /** Retained tool interactions on an `assistant` message. */
90
+ toolInteractions?: ToolInteraction[];
77
91
  }
78
92
  /** Build an inline file attachment for the last user message in a run. */
79
93
  export declare function inputFileAttachment(opts: {
@@ -208,6 +222,27 @@ export interface AgentSpecBase {
208
222
  /** Alternate model for provider outages; remains active for the session after switching. */
209
223
  fallbackModelId?: string;
210
224
  tools?: ToolRef[];
225
+ /**
226
+ * Opt in to **tool search**: tools not marked `alwaysLoaded` are deferred
227
+ * and the model searches for the ones it needs, instead of every tool
228
+ * definition going into every request. Native on direct OpenAI (Responses,
229
+ * GPT-5.4 and later), the Anthropic API, and Gemini 3 and later; other
230
+ * providers receive every tool as usual. Off by default.
231
+ *
232
+ * Pair it with `alwaysLoaded: true` on the few tools the agent uses on most
233
+ * turns, and with `namespace` (plus {@link toolNamespaces}) to group tools
234
+ * the search can find together. With tool search on, MCP tools default to
235
+ * their server's name as namespace.
236
+ */
237
+ toolSearch?: boolean;
238
+ /**
239
+ * Model-facing descriptions of the namespaces the tools use (the
240
+ * `namespace` option on every tool helper). Optional: a namespace without
241
+ * a description is described by its tool names. `name` must match
242
+ * `^[a-zA-Z0-9_]{1,64}$`, `description` is 1–2000 characters, at most 64
243
+ * entries.
244
+ */
245
+ toolNamespaces?: ToolNamespace[];
211
246
  /**
212
247
  * Provider thinking strength: a string anchor (`"off" | "low" | "medium" |
213
248
  * "high"`) or an integer in `0..100` (where `0` explicitly disables provider
@@ -286,8 +321,9 @@ export interface AgentSpecBase {
286
321
  * Run-supervisor (platform LLM judge). Periodically reviews the agent's
287
322
  * transcript and may steer the run (`on_track`, `redirect`, `finalize`).
288
323
  *
289
- * Pass an object to override the review interval, or `false` to explicitly
290
- * disable the platform judge for this run / session. When omitted on
324
+ * Pass an object to override the review interval or judge model, `true` to
325
+ * enable it with defaults, or `false` to explicitly disable the platform
326
+ * judge for this run / session. When omitted on
291
327
  * ephemeral API runs, MANTYX enables the supervisor (default interval `5`).
292
328
  * SDK-only runs (`runAgent` without the HTTP API) keep the supervisor off
293
329
  * unless you pass a value here. See `docs/agent-runs-protocol.md` §4.8.
@@ -297,10 +333,33 @@ export interface AgentSpecBase {
297
333
  * `action` is `redirect` or `finalize`, the pipeline has already applied
298
334
  * the verdict by the time the event arrives.
299
335
  */
300
- supervisor?: Supervisor | false;
336
+ supervisor?: Supervisor | boolean;
337
+ /**
338
+ * Sub-agents. When enabled the agent gets a built-in `spawn_subagent`
339
+ * tool: each call starts a child run with a fresh context that works on
340
+ * the task it was handed and reports back; the parent waits until its
341
+ * children have reported. Sub-agents cannot spawn sub-agents.
342
+ *
343
+ * - `true` — the agent may start copies of itself (`{ self: true }`).
344
+ * - `{ agents: [...] }` — named sub-agents ({@link SubagentDefinition}),
345
+ * each with its own instructions, model and tools (the copy of itself is
346
+ * off unless `self` is set).
347
+ * - `{ self, agents, maxPerRun, maxConcurrent }` — both, with limits.
348
+ * - `false` / omitted — no sub-agents.
349
+ *
350
+ * Accepted on runs and session creation (not on individual session
351
+ * messages). Local tools declared in `agents[].tools` are registered as
352
+ * local handlers like top-level ones. The parent stream carries
353
+ * `subagent_started` / `subagent_result` events
354
+ * ({@link SubagentStartedEvent}, {@link SubagentResultEvent}); a
355
+ * sub-agent's local tool calls arrive on it as ordinary `local_tool_call`
356
+ * events tagged with `subagentRunId`, and the SDK runs your handler and
357
+ * posts the result as usual.
358
+ */
359
+ subagents?: Subagents | boolean;
301
360
  /**
302
361
  * In-product **task plan** — live checklist emitted as `task_plan` SSE
303
- * events and (for `planOnly` runs) returned on the terminal `result`.
362
+ * events.
304
363
  * Opt-in: exposes the host `update_task_plan` tool so the executing agent
305
364
  * owns the checklist (no separate classifier/tracker LLM on executed runs).
306
365
  *
@@ -308,13 +367,9 @@ export interface AgentSpecBase {
308
367
  * - `"required"` — agent must initialize a plan before substantive tools.
309
368
  * - `{ mode?, steps?, brief? }` — caller-seeded checklist (`mode` defaults
310
369
  * to `"auto"`; use `"required"` to enforce).
311
- * - `{ planOnly: true, steps?, brief? }` — produce the plan and **stop**
312
- * without executing the agent loop; read the final checklist from
313
- * {@link RunResult.plan}.
314
370
  * - `"off"` / `false` — no planning (default when omitted).
315
371
  *
316
- * See `docs/agent-runs-protocol.md` §4.9. Prefer {@link MantyxClient.runPlan}
317
- * for plan-only runs.
372
+ * See `docs/agent-runs-protocol.md` §4.9.
318
373
  */
319
374
  plan?: PlanSpec;
320
375
  /**
@@ -357,6 +412,13 @@ export interface RunSpec extends AgentSpecBase {
357
412
  signal?: AbortSignal;
358
413
  }
359
414
  export type SessionSpec = AgentSpecBase;
415
+ /** A model-facing namespace description. See {@link AgentSpecBase.toolNamespaces}. */
416
+ export interface ToolNamespace {
417
+ /** Namespace name, as used on the tools' `namespace`. Must match `^[a-zA-Z0-9_]{1,64}$`. */
418
+ name: string;
419
+ /** What the namespace's tools are for, as the model should read it (1–2000 characters). */
420
+ description: string;
421
+ }
360
422
  /**
361
423
  * Either a Zod schema (auto-converted to JSON Schema by the SDK) or a
362
424
  * pre-shaped JSON Schema object. Mirrors {@link LocalToolSchemaInput} and
@@ -436,9 +498,73 @@ export type ToolBudgets = Record<string, ToolBudget>;
436
498
  export interface Supervisor {
437
499
  /** LLM calls (`completeTurn` invocations) between supervisor reviews. */
438
500
  interval?: number;
501
+ /** Model the supervisor reviews with; defaults to the platform judge model. */
502
+ modelId?: string;
439
503
  /** Mid-turn reasoning trigger, or `false` to disable. */
440
504
  reasoningTrigger?: ReasoningTrigger | false;
441
505
  }
506
+ /**
507
+ * Sub-agent configuration. See {@link AgentSpecBase.subagents} for the full
508
+ * semantics. Every field is optional; omitted ones use the MANTYX defaults.
509
+ */
510
+ export interface Subagents {
511
+ /**
512
+ * The agent's copy of itself: `true`, `false`, or overrides. Default: on
513
+ * when `agents` is omitted or empty, off otherwise.
514
+ */
515
+ self?: SubagentSelf | boolean;
516
+ /** Named sub-agents the parent can delegate to (at most 20). */
517
+ agents?: SubagentDefinition[];
518
+ /** Sub-agents one run may spawn over its lifetime. Default `10`, range `1..50`. */
519
+ maxPerRun?: number;
520
+ /** Sub-agents that may run at the same time. Default `5`, range `1..20`. */
521
+ maxConcurrent?: number;
522
+ }
523
+ /** Overrides for the agent's copy of itself ({@link Subagents.self}). */
524
+ export interface SubagentSelf {
525
+ /** Model the copy runs on. Defaults to the parent's model. */
526
+ modelId?: string;
527
+ /** Reasoning level of the copy. Defaults to the parent's. */
528
+ reasoningLevel?: ReasoningLevel;
529
+ /** Tool-turn cap of the copy. Defaults to the parent's `budgets.maxToolTurns`; range `1..200`. */
530
+ maxToolTurns?: number;
531
+ /**
532
+ * Names of the parent's tools the copy may use (default: all of them). An
533
+ * empty list gives the copy no tools.
534
+ */
535
+ tools?: string[];
536
+ /** Extra instructions appended to the copy's system prompt (≤ 8000 chars). */
537
+ instructions?: string;
538
+ }
539
+ /**
540
+ * A named sub-agent ({@link Subagents.agents}): its own instructions, model
541
+ * and tools. The parent model picks it by `name`, guided by `description`.
542
+ */
543
+ export interface SubagentDefinition {
544
+ /** Unique name matching `/^[a-zA-Z0-9_-]{1,64}$/`; `"self"` is reserved. */
545
+ name: string;
546
+ /** When to use this sub-agent (shown to the parent model, 1..1000 chars). */
547
+ description: string;
548
+ /** The sub-agent's system prompt (1..64000 chars). */
549
+ systemPrompt: string;
550
+ modelId?: string;
551
+ fallbackModelId?: string;
552
+ reasoningLevel?: ReasoningLevel;
553
+ /**
554
+ * A string names one of the parent's tools (reused as declared there); a
555
+ * tool object is a tool of the sub-agent's own. Local tools declared here
556
+ * run in this process like top-level ones.
557
+ */
558
+ tools?: Array<string | ToolRef>;
559
+ budgets?: {
560
+ maxToolTurns?: number;
561
+ };
562
+ toolBudgets?: ToolBudgets;
563
+ /** Constrains the sub-agent's report to a JSON document. */
564
+ outputSchema?: OutputSchema;
565
+ }
566
+ /** Final status of a sub-agent run, reported on {@link SubagentResultEvent}. */
567
+ export type SubagentStatus = "succeeded" | "failed" | "cancelled";
442
568
  /** Mid-turn supervisor review trigger (reasoning span length / duration). */
443
569
  export interface ReasoningTrigger {
444
570
  /** Reasoning characters per span before review. Default `3000`, max `50000`. */
@@ -462,8 +588,8 @@ export interface TaskPlanStep {
462
588
  status: TaskPlanStepStatus;
463
589
  }
464
590
  /**
465
- * Structured task plan surfaced on `task_plan` events and (for plan-only runs)
466
- * on {@link RunResult.plan}. See `docs/agent-runs-protocol.md` §4.9.
591
+ * Structured task plan surfaced on `task_plan` events. See
592
+ * `docs/agent-runs-protocol.md` §4.9.
467
593
  */
468
594
  export interface TaskPlan {
469
595
  /** Wire format version (`2` on agent-owned plans). */
@@ -492,8 +618,6 @@ export interface TaskPlanTransition {
492
618
  export interface PlanOptions {
493
619
  /** `off` | `auto` | `required`. Defaults to `auto`. */
494
620
  mode?: PlanMode;
495
- /** When `true`, produce the plan and terminate without executing the agent loop. */
496
- planOnly?: boolean;
497
621
  /** One-line objective for a caller-provided plan. Clamped server-side. */
498
622
  brief?: string;
499
623
  /** Caller-provided checklist titles. */
@@ -501,14 +625,6 @@ export interface PlanOptions {
501
625
  }
502
626
  /** `"off"` | `"auto"` | `"required"` | `true`/`false` aliases | options object. */
503
627
  export type PlanSpec = boolean | PlanMode | PlanOptions;
504
- /**
505
- * Build a {@link PlanSpec} for plan-only runs. Equivalent to
506
- * `{ planOnly: true, steps?, brief? }`.
507
- */
508
- export declare function planOnly(options?: {
509
- steps?: string[];
510
- brief?: string;
511
- }): PlanOptions;
512
628
  /**
513
629
  * Per-run token totals attached to terminal `result` / `error` events
514
630
  * (and to the `GET /agent-runs/:runId` snapshot) by MANTYX ≥ 2026-09.
@@ -607,12 +723,6 @@ export interface RunResult {
607
723
  model?: RunModelInfo;
608
724
  /** Structured-output enforcement metadata, when reported by the server. */
609
725
  structuredOutput?: StructuredOutputInfo;
610
- /**
611
- * Final structured checklist for `planOnly` runs. Undefined for normal
612
- * executed runs (use `task_plan` events for live progress). See
613
- * `docs/agent-runs-protocol.md` §4.9.
614
- */
615
- plan?: TaskPlan;
616
726
  }
617
727
  export interface RunEventBase {
618
728
  seq: number;
@@ -660,6 +770,11 @@ export interface AssistantMessageEvent extends RunEventBase {
660
770
  name: string;
661
771
  input: Record<string, unknown>;
662
772
  }>;
773
+ /**
774
+ * Tokens of this one LLM call, so live views can add up usage before the
775
+ * terminal event carries the run's total. Omitted by older servers.
776
+ */
777
+ usage?: RunTokenUsage;
663
778
  }
664
779
  export interface ServerToolResultEvent extends RunEventBase {
665
780
  type: "tool_result";
@@ -716,6 +831,13 @@ export interface LocalToolCallEvent extends RunEventBase {
716
831
  version?: string;
717
832
  [k: string]: unknown;
718
833
  };
834
+ /**
835
+ * Set when the call was made by a sub-agent of this run (its run id) and
836
+ * mirrored onto this stream. The SDK dispatches it to the same local
837
+ * handler and posts the result to the run it is streaming; the server
838
+ * forwards it to the sub-agent.
839
+ */
840
+ subagentRunId?: string;
719
841
  }
720
842
  export interface LocalToolResultInEvent extends RunEventBase {
721
843
  type: "local_tool_result_in";
@@ -790,6 +912,50 @@ export interface SupervisorEvent extends RunEventBase {
790
912
  */
791
913
  phase?: SupervisorPhase;
792
914
  }
915
+ /**
916
+ * A sub-agent started (the parent's `spawn_subagent` call `toolUseId`).
917
+ * Non-terminal. See {@link AgentSpecBase.subagents}.
918
+ */
919
+ export interface SubagentStartedEvent extends RunEventBase {
920
+ type: "subagent_started";
921
+ /** The parent's `spawn_subagent` tool call this sub-agent answers. */
922
+ toolUseId: string;
923
+ /** The sub-agent's own run id. */
924
+ runId: string;
925
+ /** Which sub-agent: `"self"` (a copy of the agent) or a {@link SubagentDefinition.name}. */
926
+ agent?: string;
927
+ /** Short description of the task the parent handed the sub-agent. */
928
+ description: string;
929
+ /**
930
+ * `true` when the parent model passed an `outputSchema` for the report, so
931
+ * the sub-agent's result is a JSON document matching it.
932
+ */
933
+ structured?: boolean;
934
+ }
935
+ /**
936
+ * A sub-agent finished and reported back to the parent. Non-terminal: the
937
+ * parent resumes once every sub-agent it waits for has reported.
938
+ */
939
+ export interface SubagentResultEvent extends RunEventBase {
940
+ type: "subagent_result";
941
+ /** The parent's `spawn_subagent` tool call this sub-agent answered. */
942
+ toolUseId: string;
943
+ /** The sub-agent's own run id. */
944
+ runId: string;
945
+ status: SubagentStatus;
946
+ /** The sub-agent's final report (on `succeeded`). */
947
+ result?: string;
948
+ /** Failure or cancellation message. */
949
+ error?: string;
950
+ /** The sub-agent's token totals. */
951
+ tokens?: RunTokenUsage;
952
+ /** Model invocations the sub-agent made. */
953
+ turns?: number;
954
+ /** Model the sub-agent ran on. */
955
+ model?: RunModelInfo;
956
+ /** Wall-clock duration of the sub-agent run. */
957
+ durationMs?: number;
958
+ }
793
959
  /**
794
960
  * Live checklist update for an in-product task plan. Non-terminal — the run
795
961
  * continues until `result` / `error` / `cancelled`. See §4.9.
@@ -817,8 +983,6 @@ export interface ResultEvent extends RunEventBase {
817
983
  subtype: string;
818
984
  text?: string;
819
985
  error?: string;
820
- /** Present on plan-only terminal results. See {@link RunResult.plan}. */
821
- plan?: TaskPlan;
822
986
  /**
823
987
  * Per-run token totals. Present against MANTYX ≥ 2026-09 — see
824
988
  * {@link RunTokenUsage} and `docs/agent-runs-protocol.md` §7.1.
@@ -910,7 +1074,7 @@ export interface ModelFallbackEvent extends RunEventBase {
910
1074
  primaryModelId?: string | null;
911
1075
  fallbackModelId: string;
912
1076
  }
913
- export type RunEvent = AssistantDeltaEvent | ThinkingDeltaEvent | AssistantMessageEvent | ModelFallbackEvent | UserMessageEvent | ServerToolResultEvent | LocalToolCallEvent | LocalToolResultInEvent | LoopDetectedEvent | ToolBudgetExceededEvent | SupervisorEvent | TaskPlanEvent | ResultEvent | ErrorEvent | CancelledEvent | (RunEventBase & {
1077
+ export type RunEvent = AssistantDeltaEvent | ThinkingDeltaEvent | AssistantMessageEvent | ModelFallbackEvent | UserMessageEvent | ServerToolResultEvent | LocalToolCallEvent | LocalToolResultInEvent | LoopDetectedEvent | ToolBudgetExceededEvent | SupervisorEvent | SubagentStartedEvent | SubagentResultEvent | TaskPlanEvent | ResultEvent | ErrorEvent | CancelledEvent | (RunEventBase & {
914
1078
  type: string;
915
1079
  [key: string]: unknown;
916
1080
  });
@@ -949,6 +1113,98 @@ export interface SessionListResult {
949
1113
  nextCursor?: string | null;
950
1114
  sessions: SessionSummary[];
951
1115
  }
1116
+ /**
1117
+ * Run lifecycle status. `succeeded`, `failed` and `cancelled` are terminal;
1118
+ * treat unknown values as non-terminal.
1119
+ */
1120
+ export type RunStatus = "queued" | "running" | "awaiting_local_tool" | "succeeded" | "failed" | "cancelled";
1121
+ /** Full run snapshot returned by {@link MantyxClient.getRun}. */
1122
+ export interface RunInfo {
1123
+ id: string;
1124
+ /** Session the run belongs to, `null` for a one-shot run. */
1125
+ sessionId: string | null;
1126
+ status: RunStatus | (string & {});
1127
+ /** The agent spec the run executed with. */
1128
+ agentSpec: Record<string, unknown> | null;
1129
+ prompt: string | null;
1130
+ /** Final assistant text, once the run finished. */
1131
+ finalText: string | null;
1132
+ error: string | null;
1133
+ failureReason: string | null;
1134
+ /** Token totals, `null` until the run finished. */
1135
+ tokens: RunTokenUsage | null;
1136
+ turns: number | null;
1137
+ model: RunModelInfo | null;
1138
+ /** Sequence number of the last event in the run's stream. */
1139
+ lastSeq: number;
1140
+ metadata: Record<string, string>;
1141
+ /** The run whose `spawn_subagent` call started this one; `null` for a top-level run. */
1142
+ parentRunId: string | null;
1143
+ /** The parent's `spawn_subagent` tool call this run answers. */
1144
+ parentToolUseId: string | null;
1145
+ /** Short task label the parent model gave the sub-agent. */
1146
+ subagentLabel: string | null;
1147
+ /** `"self"` or the name of a {@link SubagentDefinition}. */
1148
+ subagentAgent: string | null;
1149
+ /** Sub-agents this run started (list them with {@link MantyxClient.listSubagents}). */
1150
+ subagentCount: number;
1151
+ createdAt: string;
1152
+ updatedAt: string;
1153
+ startedAt: string | null;
1154
+ completedAt: string | null;
1155
+ }
1156
+ /** One compact row from {@link MantyxClient.listRuns}. */
1157
+ export interface RunSummary {
1158
+ id: string;
1159
+ sessionId: string | null;
1160
+ status: RunStatus | (string & {});
1161
+ specName: string | null;
1162
+ modelId: string | null;
1163
+ /** Truncated input; fetch the run with {@link MantyxClient.getRun} for the full prompt. */
1164
+ inputPreview: string | null;
1165
+ /** Truncated final text (at most 500 characters). */
1166
+ outputPreview: string | null;
1167
+ /** Truncated error (at most 500 characters). */
1168
+ error: string | null;
1169
+ tokens: RunTokenUsage | null;
1170
+ turns: number | null;
1171
+ durationMs: number | null;
1172
+ toolCallCount: number;
1173
+ metadata: Record<string, string>;
1174
+ parentRunId: string | null;
1175
+ subagentLabel: string | null;
1176
+ subagentAgent: string | null;
1177
+ subagentCount: number;
1178
+ createdAt: string;
1179
+ completedAt: string | null;
1180
+ }
1181
+ /** Filters and paging for {@link MantyxClient.listRuns}. */
1182
+ export interface ListRunsOptions {
1183
+ /** Page size (server default 50, max 200). */
1184
+ limit?: number;
1185
+ /** Opaque `nextCursor` returned by the previous page. */
1186
+ cursor?: string;
1187
+ status?: RunStatus;
1188
+ modelId?: string;
1189
+ /** Only runs whose metadata contains every key/value pair (AND-combined). */
1190
+ metadata?: Record<string, string>;
1191
+ /**
1192
+ * List the sub-agent runs this run started. Without it only top-level runs
1193
+ * are listed.
1194
+ */
1195
+ parentRunId?: string;
1196
+ /** Ask the server for the exact `total` (otherwise `null`). */
1197
+ includeTotal?: boolean;
1198
+ }
1199
+ /** Paginated result of {@link MantyxClient.listRuns}. */
1200
+ export interface RunListResult {
1201
+ /** Exact count when `includeTotal` was set, otherwise `null`. */
1202
+ total: number | null;
1203
+ limit: number;
1204
+ /** Pass back as `cursor` for the next page; `null` on the last page. */
1205
+ nextCursor: string | null;
1206
+ runs: RunSummary[];
1207
+ }
952
1208
  /** One bounded page from {@link MantyxClient.getSessionEventsPage}. */
953
1209
  export interface SessionEventsPage {
954
1210
  sessionId: string;
@@ -1000,18 +1256,6 @@ export declare class MantyxClient {
1000
1256
  deleteDecisionRun(runId: string): Promise<void>;
1001
1257
  listModels(): Promise<ModelCatalog>;
1002
1258
  runAgent(spec: RunSpec): Promise<RunResult>;
1003
- /**
1004
- * Plan-only run: classify (or accept caller `steps`) and return the
1005
- * structured checklist without executing the agent loop. Sugar for
1006
- * `runAgent({ ..., plan: planOnly({ steps, brief }) })`.
1007
- *
1008
- * The final checklist is on {@link RunResult.plan}; intermediate
1009
- * progress is available via `task_plan` events when streaming.
1010
- */
1011
- runPlan(spec: Omit<RunSpec, "plan"> & {
1012
- steps?: string[];
1013
- brief?: string;
1014
- }): Promise<RunResult>;
1015
1259
  streamAgent(spec: RunSpec): AsyncGenerator<RunEvent, void, void>;
1016
1260
  /**
1017
1261
  * Internal registry of client-resolved tool handlers. Exposed for callers
@@ -1075,6 +1319,22 @@ export declare class MantyxClient {
1075
1319
  error?: string;
1076
1320
  files?: ToolResultFile[];
1077
1321
  }): Promise<void>;
1322
+ /**
1323
+ * Fetch a run's snapshot: status, final text, token totals, model, and
1324
+ * for a sub-agent run its parent (`parentRunId`, `parentToolUseId`).
1325
+ */
1326
+ getRun(runId: string): Promise<RunInfo>;
1327
+ /**
1328
+ * List runs, newest first, one page at a time (follow `nextCursor`).
1329
+ * Without `parentRunId` only top-level runs are listed; with it, the
1330
+ * sub-agent runs that run started.
1331
+ */
1332
+ listRuns(opts?: ListRunsOptions): Promise<RunListResult>;
1333
+ /**
1334
+ * Every sub-agent run the given run started, newest first. Pages through
1335
+ * {@link listRuns} with `parentRunId` until the last page.
1336
+ */
1337
+ listSubagents(runId: string): Promise<RunSummary[]>;
1078
1338
  cancelRun(runId: string): Promise<void>;
1079
1339
  /**
1080
1340
  * Record thumbs up/down feedback on a run. Requires the `feedback:write`
@@ -1124,7 +1384,10 @@ export declare class AgentSession {
1124
1384
  readonly client: MantyxClient;
1125
1385
  private readonly handlers;
1126
1386
  private readonly tools;
1127
- constructor(client: MantyxClient, id: string, handlers: LocalHandlers, tools?: ToolRef[]);
1387
+ private readonly ownedTools;
1388
+ constructor(client: MantyxClient, id: string, handlers: LocalHandlers, tools?: ToolRef[],
1389
+ /** Every ref the session resolved (its tools plus sub-agent tools); closed by {@link end}. */
1390
+ ownedTools?: ToolRef[]);
1128
1391
  send(promptOrMessages: string | ConversationMessage[], opts?: {
1129
1392
  onAssistantDelta?: (s: string) => void;
1130
1393
  signal?: AbortSignal;
@@ -1169,7 +1432,7 @@ export declare class AgentSession {
1169
1432
  * and does not mutate the session's stored value. Pass `false` to
1170
1433
  * disable the platform judge for this single turn.
1171
1434
  */
1172
- supervisor?: Supervisor | false;
1435
+ supervisor?: Supervisor | boolean;
1173
1436
  /**
1174
1437
  * Per-message override for `plan`. Applies only to this run and does
1175
1438
  * not mutate the session's stored value. See {@link AgentSpecBase.plan}.
@@ -1196,30 +1459,12 @@ export declare class AgentSession {
1196
1459
  outputSchema?: OutputSchema;
1197
1460
  loopDetection?: LoopDetection | false;
1198
1461
  toolBudgets?: ToolBudgets;
1199
- supervisor?: Supervisor | false;
1462
+ supervisor?: Supervisor | boolean;
1200
1463
  plan?: PlanSpec;
1201
1464
  turnInstructions?: string;
1202
1465
  turnInstructionsAuthority?: TurnInstructionsAuthority;
1203
1466
  }): AsyncGenerator<RunEvent, void, void>;
1204
1467
  private buildSessionMessageBody;
1205
- /**
1206
- * Plan-only session turn. Sugar for `send(prompt, { plan: planOnly(...) })`.
1207
- */
1208
- runPlan(promptOrMessages: string | ConversationMessage[], opts?: {
1209
- onAssistantDelta?: (s: string) => void;
1210
- signal?: AbortSignal;
1211
- metadata?: Record<string, string>;
1212
- reasoningLevel?: ReasoningLevel;
1213
- openRouterProvider?: OpenRouterProviderPreferences;
1214
- /** Override the execution mode for this message; omission inherits the session default. */
1215
- newLoop?: boolean;
1216
- outputSchema?: OutputSchema;
1217
- loopDetection?: LoopDetection | false;
1218
- toolBudgets?: ToolBudgets;
1219
- supervisor?: Supervisor | false;
1220
- steps?: string[];
1221
- brief?: string;
1222
- }): Promise<RunResult>;
1223
1468
  history(): Promise<ConversationMessage[]>;
1224
1469
  info(): Promise<SessionInfo>;
1225
1470
  events(opts?: {
@@ -86,7 +86,7 @@ export interface DefineComputerUseToolsOptions {
86
86
  */
87
87
  requestConfirmation?: boolean;
88
88
  /**
89
- * Human-in-the-loop gate invoked by the `request_confirmation` tool. Return
89
+ * Operator confirmation gate invoked by the `request_confirmation` tool. Return
90
90
  * `true` to allow the model to continue with the action it described.
91
91
  */
92
92
  confirm?: (reason: string) => boolean | Promise<boolean>;
@@ -108,7 +108,7 @@ export interface ComputerUseSystemPromptOptions {
108
108
  /**
109
109
  * Build the system prompt that drives the loop: it teaches the model the
110
110
  * screenshot-per-step protocol, the 0-1000 coordinate grid, the one-action-per-turn
111
- * discipline, when to stop, and the human-in-the-loop safety rules.
111
+ * discipline, when to stop, and the operator-confirmation safety rules.
112
112
  */
113
113
  export declare function buildComputerUseSystemPrompt(opts?: ComputerUseSystemPromptOptions): string;
114
114
  /** One action the model invoked on a turn (derived from `local_tool_call` events). */
@@ -144,7 +144,7 @@ export interface RunComputerUseOptions {
144
144
  systemPromptOptions?: ComputerUseSystemPromptOptions;
145
145
  /** Actions to omit from the tool surface. */
146
146
  excludeActions?: ComputerUseAction[];
147
- /** Human-in-the-loop gate for `request_confirmation`. Omit to disable confirmations. */
147
+ /** Operator confirmation gate for `request_confirmation`. Omit to disable confirmations. */
148
148
  confirm?: (reason: string) => boolean | Promise<boolean>;
149
149
  /** Disable the `request_confirmation` tool entirely. Default false (it is included). */
150
150
  disableConfirmation?: boolean;