@camelai/agent-runtime 0.4.0 → 0.5.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.
@@ -4,12 +4,63 @@ import { Type, type TSchema, type Static } from "typebox";
4
4
  import { type RequestMethod, type SessionCredentials, type SessionState } from "../shared/client-protocol.ts";
5
5
  export { Type as schema };
6
6
  export type { SessionCredentials, SessionState };
7
+ /**
8
+ * Who a tool call is for, as the runtime says: from its signed identity token when the tools are
9
+ * served over HTTP (`serveTools`), or from the call itself when they are attached to the agent.
10
+ * Authorize as `user`, within `tenant` and `context`.
11
+ */
12
+ export interface RuntimeIdentity {
13
+ /** Who is acting: the turn's actor (a prompt's `actor`, or its `from.id`), else the agent's subject. */
14
+ user: string;
15
+ /** Whom the agent acts for, as its creator set it (`createAgent({ subject })`); the agent's id if none. */
16
+ subject: string;
17
+ /** Who is acting in this turn, if the prompt named someone. */
18
+ actor?: string;
19
+ /** The runtime tenant that owns the agent. */
20
+ tenant: string;
21
+ agent: string;
22
+ definition?: string;
23
+ /** Claims the agent's creator attached (`createAgent({ context })`), e.g. `{ org, workspace }`. */
24
+ context: Record<string, unknown>;
25
+ /** Where the turn came from, e.g. `{ channel, conversationId, sender }` for a channel message. */
26
+ origin?: Record<string, unknown>;
27
+ /** The call was approved by a person: which input, who (their ids), and when. */
28
+ approval?: {
29
+ input: string;
30
+ by: Record<string, unknown>;
31
+ at: number;
32
+ };
33
+ }
34
+ /** A runtime identity from its claims (a verified token's payload, or an attached call's `_meta`). */
35
+ export declare function identityFromClaims(claims: Record<string, any>): RuntimeIdentity;
7
36
  export interface ToolContext {
8
37
  signal: AbortSignal;
9
38
  callId: string;
10
39
  toolCallId?: string;
11
40
  /** Set by the runtime, e.g. `{ channel, conversationId, sender }` for a turn a channel message started. */
12
41
  origin?: Record<string, unknown>;
42
+ /** Who the call is for: always set by `serveTools`; set for attached tools by runtimes that send it. */
43
+ identity?: RuntimeIdentity;
44
+ /**
45
+ * Ask the user, and get their answer. The call ends here and the agent's turn waits, for days if need
46
+ * be; once they answer, the runtime calls the tool again with the same arguments, and this returns
47
+ * the answer. So everything before an ask runs again on that call: ask first, act after.
48
+ * `confirm`: whether they said yes. `ask`: what they filled in (a flat object schema), or undefined
49
+ * if they declined. `requireUrl`: whether they say they have done what the https page asks.
50
+ */
51
+ confirm(message: string): Promise<boolean>;
52
+ ask<T extends Record<string, unknown> = Record<string, unknown>>(message: string, schema: Record<string, unknown>): Promise<T | undefined>;
53
+ requireUrl(url: string, message: string): Promise<boolean>;
54
+ }
55
+ /** Thrown by a ToolContext's asks: the call answers MCP's `input_required`, and runs again once the user answers. */
56
+ export declare class InputRequired extends Error {
57
+ readonly inputRequests: Record<string, {
58
+ method: string;
59
+ params: Record<string, unknown>;
60
+ }>;
61
+ /** The answers so far, which the runtime hands back on the next call (MCP's `requestState`). */
62
+ readonly requestState?: string;
63
+ constructor(inputRequests: InputRequired["inputRequests"], requestState?: string);
13
64
  }
14
65
  export interface Tool<T = any> {
15
66
  description: string;
@@ -18,6 +69,11 @@ export interface Tool<T = any> {
18
69
  executionMode?: "sequential" | "parallel";
19
70
  input: Record<string, unknown>;
20
71
  execute: (args: T, context: ToolContext) => unknown | Promise<unknown>;
72
+ /**
73
+ * Ask the user to approve each call before it runs (or only the calls this says need it). The runtime
74
+ * shows them the real call; the tool is declared to the model directly, as code cannot wait for a person.
75
+ */
76
+ needsApproval?: boolean | ((args: T, context: ToolContext) => boolean | Promise<boolean>);
21
77
  }
22
78
  /** Infer callback arguments from the schema; no manually duplicated argument type. */
23
79
  export declare function tool<S extends TSchema>(definition: Omit<Tool<Static<S>>, "input"> & {
@@ -33,12 +89,21 @@ export interface McpTool {
33
89
  annotations?: Record<string, unknown>;
34
90
  _meta?: Record<string, unknown>;
35
91
  }
36
- /** An MCP `tools/call` result. */
37
- export interface CallToolResult {
92
+ /** An MCP `tools/call` result: complete, or (MCP's multi round-trip requests) asking for input to retry with. */
93
+ export type CallToolResult = {
38
94
  content: Array<Record<string, unknown>>;
39
95
  structuredContent?: Record<string, unknown>;
40
96
  isError?: boolean;
41
- }
97
+ resultType?: "complete";
98
+ } | {
99
+ resultType: "input_required";
100
+ inputRequests?: Record<string, {
101
+ method: string;
102
+ params?: Record<string, unknown>;
103
+ }>;
104
+ requestState?: string;
105
+ content?: never;
106
+ };
42
107
  /**
43
108
  * The MCP server an application attaches to its agent: the SDK relays the runtime's
44
109
  * `tools/list` and `tools/call` to it over the agent's connection. Throw from `callTool`
@@ -48,6 +113,26 @@ export interface ToolServer {
48
113
  listTools(): McpTool[] | Promise<McpTool[]>;
49
114
  callTool(name: string, args: Record<string, unknown>, context: ToolContext): Promise<CallToolResult>;
50
115
  }
116
+ /**
117
+ * A call's context from its params: ids, origin, and the identity the runtime sent in `_meta` (or
118
+ * `identity`, from a verified token); its asks answer from the retry's `inputResponses`, by position.
119
+ */
120
+ export declare function toolContext(params: Record<string, any>, fallbackId: string, signal: AbortSignal, identity?: RuntimeIdentity): ToolContext;
121
+ /**
122
+ * Answer one MCP JSON-RPC request as a tool server: initialize, ping, tools/list and tools/call.
123
+ * Both an attached server (answering over the agent's connection) and `serveTools` (over HTTP) use it.
124
+ */
125
+ export declare function answerMcp(message: Record<string, any>, server: ToolServer, context: (params: Record<string, any>) => ToolContext, info?: {
126
+ name: string;
127
+ version: string;
128
+ }): Promise<{
129
+ result: unknown;
130
+ } | {
131
+ error: {
132
+ code: number;
133
+ message: string;
134
+ };
135
+ }>;
51
136
  /** `tool({...})` definitions as an attached MCP server: JSON results become a text block (and structured content for objects). */
52
137
  export declare function toolServer(tools: Tools): ToolServer;
53
138
  export interface RuntimeOptions {
@@ -57,6 +142,10 @@ export interface RuntimeOptions {
57
142
  journalStore?: JournalStore;
58
143
  /** Injectable for tests, observability, or an application's HTTP stack. */
59
144
  fetch?: typeof globalThis.fetch;
145
+ /** Opens a local file to attach by its path; set by the Node entry (`@camelai/agent-runtime/node`). */
146
+ openFile?: (path: string) => Promise<Blob>;
147
+ /** How often a request still waiting for its result asks for its status, in case the result's event was lost. Default 30 s. */
148
+ pollMs?: number;
60
149
  }
61
150
  export interface AgentOptions {
62
151
  /** The application's tools, served to the agent as an attached MCP server. */
@@ -64,9 +153,47 @@ export interface AgentOptions {
64
153
  /** Or an MCP server of the application's own (see `clients/mcp.ts` for MCP SDK servers). */
65
154
  mcp?: ToolServer;
66
155
  onEvent?: (event: any, requestId?: string) => unknown | Promise<unknown>;
156
+ /**
157
+ * A question, approval or setup step the agent's turn now waits on. Return an answer to give it
158
+ * at once, or nothing to answer later with `agent.answer` (from any process, via connectAgent).
159
+ */
160
+ onInput?: (input: AgentInput, requestId?: string) => InputAnswer | void | Promise<InputAnswer | void>;
67
161
  onConnection?: (connected: boolean) => void;
68
162
  onError?: (error: Error) => void;
69
163
  }
164
+ /**
165
+ * Human input a suspended turn waits on (its run ends with `stopped: "input_required"` and these in
166
+ * `inputs`): the model's questions (ask_user), approvals, and a tool's form or URL step.
167
+ */
168
+ export interface AgentInput {
169
+ id: string;
170
+ agent: string;
171
+ requestId: string;
172
+ toolCallId: string;
173
+ kind: "question" | "approval" | "form" | "url";
174
+ message: string;
175
+ /** question: { questions }; approval: { tool, source, arguments, argumentsHash }; form: { requestedSchema }; url: { url, origin }. */
176
+ detail: Record<string, any>;
177
+ responders: {
178
+ audience?: string[];
179
+ };
180
+ state: "pending" | "answered" | "declined" | "cancelled" | "expired" | "superseded";
181
+ answer?: {
182
+ action: string;
183
+ content?: unknown;
184
+ by: Record<string, unknown>;
185
+ at: number;
186
+ };
187
+ createdAt: number;
188
+ expiresAt: number;
189
+ }
190
+ /** An answer. `content`: for a question, { answers: { "<question>": "<label>" | ["<label>"] | "<own words>" } }; for a form, its fields. `from`/`actor`: who answers, checked against who may. */
191
+ export interface InputAnswer {
192
+ action: "accept" | "decline" | "cancel";
193
+ content?: unknown;
194
+ from?: Sender;
195
+ actor?: string;
196
+ }
70
197
  export type { ThinkingLevel };
71
198
  export interface CreateAgentOptions extends AgentOptions {
72
199
  idempotencyKey?: string;
@@ -78,6 +205,10 @@ export interface CreateAgentOptions extends AgentOptions {
78
205
  definition?: string;
79
206
  /** Agent lifetime in seconds (60 to 366 days), or null to keep the agent until it is deleted. Default one day. */
80
207
  ttlSeconds?: number | null;
208
+ /** Who the agent acts for (a user id in your app): `sub` in the identity tokens its tool servers get. Set only at creation. */
209
+ subject?: string;
210
+ /** Claims your tool servers need (org, workspace, thread…): `ctx` in its identity tokens. Set only at creation. */
211
+ context?: Record<string, unknown>;
81
212
  systemPrompt?: string;
82
213
  name?: string;
83
214
  type?: string;
@@ -93,6 +224,83 @@ export interface CreateAgentOptions extends AgentOptions {
93
224
  mounts?: Mount[];
94
225
  }
95
226
  /** A volume the agent's file tools see at `path`; `notify` prompts the agent when others change files there. */
227
+ /** How a tool source is authenticated: a stored bearer token, or identity tokens the runtime signs for each request. */
228
+ export type SourceAuth = {
229
+ type: "bearer";
230
+ token: string;
231
+ } | {
232
+ type: "runtime";
233
+ };
234
+ /** Options every tool source takes. `exposure` defaults to both for a source of up to 10 tools, else codemode. */
235
+ interface SourceOptions {
236
+ name: string;
237
+ headers?: Record<string, string>;
238
+ auth?: SourceAuth;
239
+ audience?: string;
240
+ allowTools?: string[];
241
+ denyTools?: string[];
242
+ exposure?: "direct" | "codemode" | "both";
243
+ timeoutMs?: number;
244
+ }
245
+ export interface DefinitionInput {
246
+ name: string;
247
+ model?: string;
248
+ systemPrompt?: string;
249
+ thinkingLevel?: ThinkingLevel;
250
+ limits?: {
251
+ ttlSeconds?: number | null;
252
+ };
253
+ mounts?: unknown[];
254
+ builtins?: ("web_fetch" | "web_search" | "schedule")[];
255
+ /** The search providers web_search tries, in order, instead of the runtime's. */
256
+ webSearch?: {
257
+ providers: ("exa" | "brave" | "parallel")[];
258
+ };
259
+ mcpServers?: (SourceOptions & {
260
+ url: string;
261
+ })[];
262
+ openApi?: (SourceOptions & {
263
+ spec?: string | Record<string, unknown>;
264
+ baseUrl?: string;
265
+ })[];
266
+ }
267
+ /** What applying a definition's revision did to one agent; poll a queued one's request for its outcome. */
268
+ export interface ApplyResult {
269
+ agent: string;
270
+ requestId: string;
271
+ status: "updated" | "queued" | "failed";
272
+ error?: string;
273
+ }
274
+ /** A definition as the runtime returns it: credentials are never included. */
275
+ export interface Definition extends Omit<DefinitionInput, "mcpServers" | "openApi"> {
276
+ id: string;
277
+ revision: number;
278
+ createdAt: number;
279
+ updatedAt: number;
280
+ mcpServers?: Record<string, unknown>[];
281
+ openApi?: Record<string, unknown>[];
282
+ applied?: ApplyResult[];
283
+ }
284
+ /** One source of an agent's tools; `excluded` says why the model does not get a tool, when it does not. */
285
+ export interface ToolSource {
286
+ kind: "channel" | "application" | "files" | "builtin" | "mcp" | "openapi";
287
+ name: string;
288
+ /** unlisted: an MCP server the runtime has not listed yet; error: listing it failed. */
289
+ status: "listed" | "unlisted" | "error";
290
+ error?: string;
291
+ listedAt?: number;
292
+ connected?: boolean;
293
+ url?: string;
294
+ exposure?: "direct" | "codemode" | "both";
295
+ tools: {
296
+ name: string;
297
+ description: string;
298
+ exposure?: "direct" | "codemode" | "both";
299
+ executionMode?: "sequential" | "parallel";
300
+ parameters?: Record<string, unknown>;
301
+ excluded?: string;
302
+ }[];
303
+ }
96
304
  export interface Mount {
97
305
  volumeId: string;
98
306
  path: string;
@@ -119,6 +327,7 @@ export interface VolumeFile {
119
327
  size: number;
120
328
  updatedAt: number;
121
329
  by?: string;
330
+ contentType: string;
122
331
  }
123
332
  export interface VolumeSnapshot {
124
333
  id: string;
@@ -142,9 +351,46 @@ export interface VolumeChanges {
142
351
  }[];
143
352
  gap?: boolean;
144
353
  }
354
+ /** A signed URL for one file: send `method` to `url` with no Authorization header, until `expiresAt`. */
355
+ export interface FileLink {
356
+ url: string;
357
+ method: "GET" | "PUT";
358
+ path: string;
359
+ expiresAt: number;
360
+ maxBytes?: number;
361
+ contentType?: string;
362
+ }
363
+ /** A link's options: `expiresIn` seconds (default 900, at most 86400); for PUT, the largest upload and its content type. */
364
+ export interface LinkOptions {
365
+ method?: "GET" | "PUT";
366
+ expiresIn?: number;
367
+ maxBytes?: number;
368
+ contentType?: string;
369
+ }
145
370
  export interface AgentHistory {
146
371
  messages: AgentMessage[];
147
372
  }
373
+ /**
374
+ * A file to attach to a message: bytes or a Blob (a File keeps its name and type), `{ name, data,
375
+ * contentType? }`, a local path (Node entry), or `{ path }` for a file already in the agent's mounts.
376
+ * The SDK uploads each to the agent's workspace (uploads/<request>/<name>) before sending the message.
377
+ */
378
+ export type Attachment = Uint8Array | Blob | string | {
379
+ name?: string;
380
+ data: Uint8Array | Blob;
381
+ contentType?: string;
382
+ } | {
383
+ path: string;
384
+ };
385
+ /** A file in the agent's mounts, at the path the agent sees it. */
386
+ export interface AgentFile {
387
+ path: string;
388
+ version: number;
389
+ size: number;
390
+ updatedAt: number;
391
+ by?: string;
392
+ contentType: string;
393
+ }
148
394
  export interface Schedule {
149
395
  id: string;
150
396
  agent: string;
@@ -158,6 +404,12 @@ export interface RequestOptions {
158
404
  idempotencyKey?: string;
159
405
  timeoutMs?: number;
160
406
  }
407
+ /** Who sent a message: `id` is yours and the model may rely on it; the names are the sender's own. */
408
+ export interface Sender {
409
+ id: string;
410
+ name?: string;
411
+ username?: string;
412
+ }
161
413
  export declare class AgentError extends Error {
162
414
  status: number;
163
415
  requestId?: string;
@@ -170,12 +422,16 @@ declare class Transport {
170
422
  readonly fetcher: typeof globalThis.fetch;
171
423
  constructor(options: RuntimeOptions);
172
424
  json(path: string, token: string, method?: string, body?: unknown, retry?: boolean, headers?: Record<string, string>): Promise<any>;
173
- /** A request with a raw body or response (volume file contents). */
425
+ /**
426
+ * A request with a raw body or response (file contents). It fails once nothing arrives for 30 s
427
+ * (an upload has the runtime's 15 minutes to be sent), so a stalled transfer never hangs its caller.
428
+ */
174
429
  raw(path: string, token: string, init?: {
175
430
  method?: string;
176
- body?: Uint8Array;
431
+ body?: Uint8Array | Blob;
177
432
  headers?: Record<string, string>;
178
433
  }): Promise<Response>;
434
+ private transfer;
179
435
  }
180
436
  /** Trusted-backend SDK. Only createAgent needs the operator key. */
181
437
  export declare class AgentRuntime {
@@ -191,9 +447,34 @@ export declare class AgentRuntime {
191
447
  listVolumes(): Promise<Volume[]>;
192
448
  /** A handle on one volume's files, snapshots and forks. */
193
449
  volume(id: string): VolumeHandle;
450
+ /**
451
+ * Definitions: reusable agent configurations with their tool sources (MCP servers, OpenAPI
452
+ * specs, built-ins). Make agents from one with `createAgent({ definition: id })`.
453
+ */
454
+ createDefinition(input: DefinitionInput): Promise<Definition>;
455
+ /** Replace the fields given (null removes one); `apply: "all"` also reconfigures its live agents between their turns. */
456
+ updateDefinition(id: string, input: Partial<DefinitionInput> & {
457
+ revision?: number;
458
+ apply?: "all";
459
+ }): Promise<Definition>;
460
+ definition(id: string): Promise<Definition>;
461
+ definitions(): Promise<Definition[]>;
462
+ deleteDefinition(id: string): Promise<{
463
+ deleted: boolean;
464
+ }>;
194
465
  mounts(agentId: string): Promise<Mount[]>;
195
466
  /** Replace an agent's mounts; an idle agent restarts so its tools describe them. */
196
467
  setMounts(agentId: string, mounts: Mount[]): Promise<Mount[]>;
468
+ /**
469
+ * Every source of an agent's tools (its application, file tools, built-ins, MCP servers, OpenAPI
470
+ * specs) and what each offers the model. `schemas` includes input schemas; `refresh` lists MCP servers now.
471
+ */
472
+ /** Inputs waiting on someone across all the tenant's agents (`pending` ones, say), newest first. */
473
+ inbox(state?: AgentInput["state"]): Promise<AgentInput[]>;
474
+ toolSources(agentId: string, options?: {
475
+ schemas?: boolean;
476
+ refresh?: boolean;
477
+ }): Promise<ToolSource[]>;
197
478
  }
198
479
  /** Files are versioned: pass `version` to write or remove only if nobody changed the file since (0: must not exist). */
199
480
  export declare class VolumeHandle {
@@ -225,8 +506,10 @@ export declare class VolumeHandle {
225
506
  files: VolumeFile[];
226
507
  next?: string;
227
508
  }>;
509
+ /** Without `contentType`, the runtime sniffs it from the file's first bytes and name. */
228
510
  write(path: string, data: string | Uint8Array, options?: {
229
511
  version?: number;
512
+ contentType?: string;
230
513
  }): Promise<VolumeFile>;
231
514
  /** A file's bytes, or `range` of them ([start, end) in bytes). */
232
515
  read(path: string, options?: {
@@ -234,8 +517,11 @@ export declare class VolumeHandle {
234
517
  }): Promise<{
235
518
  data: Uint8Array;
236
519
  version: number;
520
+ contentType: string;
237
521
  }>;
238
522
  readText(path: string): Promise<string>;
523
+ /** A signed URL to download (GET) or upload (PUT) one file without a token. */
524
+ link(path: string, options?: LinkOptions): Promise<FileLink>;
239
525
  remove(path: string, options?: {
240
526
  version?: number;
241
527
  }): Promise<any>;
@@ -251,6 +537,37 @@ export interface JournalStore {
251
537
  save(sessionId: string, journal: Journal): Promise<void>;
252
538
  }
253
539
  export declare function memoryJournalStore(): JournalStore;
540
+ /**
541
+ * The agent's files, at the paths it sees them (`/workspace/report.pdf`), with the agent's own
542
+ * token: what it wrote during a run (a run's outcome lists `files`), and links to hand them on.
543
+ */
544
+ export declare class AgentFiles {
545
+ private readonly transport;
546
+ private readonly token;
547
+ private readonly base;
548
+ constructor(transport: Transport, token: string, base: string);
549
+ /** Files under `path` (default: the first mount), in path order, a page at a time. */
550
+ list(options?: {
551
+ path?: string;
552
+ glob?: string;
553
+ after?: string;
554
+ limit?: number;
555
+ }): Promise<{
556
+ files: AgentFile[];
557
+ next?: string;
558
+ }>;
559
+ download(path: string): Promise<{
560
+ data: Uint8Array;
561
+ contentType: string;
562
+ version: number;
563
+ }>;
564
+ /** Write a file into a writable mount; without `contentType` the runtime sniffs it. */
565
+ upload(path: string, data: Uint8Array | Blob | string, options?: {
566
+ contentType?: string;
567
+ }): Promise<AgentFile>;
568
+ /** A signed URL to download (GET) or upload (PUT) one file without a token, e.g. for a browser or another service. */
569
+ link(path: string, options?: LinkOptions): Promise<FileLink>;
570
+ }
254
571
  export declare class AgentClient {
255
572
  readonly session: SessionCredentials;
256
573
  readonly tools: Tools;
@@ -261,6 +578,10 @@ export declare class AgentClient {
261
578
  private loaded?;
262
579
  private saving;
263
580
  private readonly options;
581
+ private readonly openFile?;
582
+ private readonly pollMs;
583
+ /** The agent's files: list, download, upload and link. */
584
+ readonly files: AgentFiles;
264
585
  private readonly pending;
265
586
  /** Tool calls running, by JSON-RPC id, so the runtime can cancel them. */
266
587
  private readonly active;
@@ -286,6 +607,11 @@ export declare class AgentClient {
286
607
  }): Promise<any>;
287
608
  private receive;
288
609
  private settle;
610
+ /**
611
+ * A request's result arrives as an event; a reconnect also settles from /state. As a last resort,
612
+ * ask for its status now and then, so an event lost on the way can never strand the caller.
613
+ */
614
+ private outcome;
289
615
  private sync;
290
616
  /**
291
617
  * Answer the runtime's JSON-RPC messages as the agent's attached MCP server: initialize,
@@ -298,13 +624,34 @@ export declare class AgentClient {
298
624
  waitForRequest(id: string, options?: {
299
625
  timeoutMs?: number;
300
626
  }): Promise<any>;
627
+ /**
628
+ * `from` says who sent the message: the model sees it in a block only the runtime can write, and
629
+ * `from.id` is the turn's actor. `actor` names someone else acting (`act` in identity tokens) without telling the model.
630
+ */
301
631
  prompt(text: string, options?: RequestOptions & {
632
+ files?: Attachment[];
302
633
  images?: ImageContent[];
634
+ actor?: string;
635
+ from?: Sender;
303
636
  }): Promise<any>;
637
+ /**
638
+ * Send a message with its files: each is uploaded to the agent's workspace under the request's
639
+ * id first, then attached by path. `images` (base64 blocks) are sent inline and saved as files.
640
+ */
641
+ private message;
642
+ private attach;
304
643
  history(): Promise<AgentHistory>;
305
- continue(options?: RequestOptions): Promise<any>;
306
- steer(text: string): Promise<any>;
307
- followUp(text: string): Promise<any>;
644
+ continue(options?: RequestOptions & {
645
+ actor?: string;
646
+ }): Promise<any>;
647
+ steer(text: string, options?: {
648
+ from?: Sender;
649
+ files?: Attachment[];
650
+ }): Promise<any>;
651
+ followUp(text: string, options?: {
652
+ from?: Sender;
653
+ files?: Attachment[];
654
+ }): Promise<any>;
308
655
  /** Change the prompt, thinking level, tools, or model ("provider/model-id") between runs. */
309
656
  configure(options: {
310
657
  systemPrompt?: string;
@@ -316,6 +663,7 @@ export declare class AgentClient {
316
663
  execute(code: string, options?: RequestOptions & {
317
664
  timeoutMs?: number;
318
665
  executionTimeoutMs?: number;
666
+ actor?: string;
319
667
  }): Promise<any>;
320
668
  /**
321
669
  * Wake this agent later: with `text` it gets a prompt, with `code` it runs sandboxed
@@ -333,6 +681,13 @@ export declare class AgentClient {
333
681
  status(): Promise<any>;
334
682
  abort(): Promise<any>;
335
683
  requestStatus(id: string): Promise<any>;
684
+ /** Answer an input the agent waits on. `request` is the run resuming its turn, once its last input is answered. */
685
+ answer(inputId: string, answer: InputAnswer): Promise<{
686
+ input: AgentInput;
687
+ request: any | null;
688
+ }>;
689
+ /** The agent's inputs, newest first: `pending` ones, say. */
690
+ inputs(state?: AgentInput["state"]): Promise<AgentInput[]>;
336
691
  outcomes(): Promise<SessionState>;
337
692
  close(): Promise<void>;
338
693
  destroy(): Promise<void>;