@standardagents/spec 0.14.1 → 0.15.1

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { z, ZodString, ZodNumber, ZodBoolean, ZodNull, ZodLiteral, ZodEnum, ZodOptional, ZodNullable, ZodDefault, ZodArray, ZodObject, ZodRecord, ZodUnion, ZodTypeAny } from 'zod';
1
+ import { z, ZodString, ZodNumber, ZodBoolean, ZodNull, ZodLiteral, ZodUnknown, ZodEnum, ZodOptional, ZodNullable, ZodDefault, ZodArray, ZodObject, ZodRecord, ZodUnion, ZodTypeAny } from 'zod';
2
2
 
3
3
  /**
4
4
  * Global namespace for Standard Agent Specification types.
@@ -97,11 +97,21 @@ declare global {
97
97
  * Union of all tool names, or string when registry is empty.
98
98
  */
99
99
  type Tools = keyof ToolRegistry extends never ? string : keyof ToolRegistry;
100
+ /**
101
+ * Provider-executed tool reference stored by AgentBuilder prompts.
102
+ */
103
+ type ProviderCallable = `provider:${string}`;
104
+ /**
105
+ * MCP tool reference stored by AgentBuilder prompts.
106
+ */
107
+ type McpCallable = `mcp:${string}`;
100
108
  /**
101
109
  * Union of all callable names, or string when registry is empty.
102
110
  * Callables include prompts, agents, and tools that can be used as tools.
111
+ * Provider and MCP tool references use reserved prefixes and remain valid
112
+ * even when generated project registries are populated.
103
113
  */
104
- type Callables = keyof CallableRegistry extends never ? string : keyof CallableRegistry;
114
+ type Callables = keyof CallableRegistry extends never ? string : keyof CallableRegistry | ProviderCallable | McpCallable;
105
115
  /**
106
116
  * Union of all hook IDs, or string when registry is empty.
107
117
  * Hook IDs are the unique identifiers defined in agents/hooks/ files.
@@ -115,7 +125,7 @@ declare global {
115
125
  *
116
126
  * Effects are scheduled operations that run outside the tool execution context.
117
127
  * They enable implementation-specific side effects with optional delay support,
118
- * leveraging the runtime's scheduling mechanism (e.g., Cloudflare Durable Object alarms).
128
+ * leveraging whichever scheduling mechanism the runtime provides.
119
129
  *
120
130
  * Unlike tools, effects:
121
131
  * - Do not return results to the LLM
@@ -288,7 +298,9 @@ interface Message {
288
298
  * Custom metadata.
289
299
  *
290
300
  * Runtimes may attach lifecycle metadata for synthesized status messages
291
- * (for example: `status_kind`, `subagent_event`).
301
+ * (for example: `status_kind`, `subagent_event`). Message APIs may also
302
+ * mark send-message and durable queue entries with `queued: true` until
303
+ * they are injected into stored history.
292
304
  */
293
305
  metadata?: Record<string, unknown>;
294
306
  /** Message processing status */
@@ -462,6 +474,221 @@ interface FileChunk {
462
474
  /** Whether this is the final chunk */
463
475
  isLast: boolean;
464
476
  }
477
+ /**
478
+ * Options passed to {@link ThreadState.runCode}.
479
+ *
480
+ * Code execution is strictly capability-based: the sandbox starts with no
481
+ * ambient capabilities (no `fs`, no `fetch`, no `console`, no host globals).
482
+ * Every capability the sandbox needs must be bridged in explicitly through
483
+ * `imports` or `globals`.
484
+ *
485
+ * Deadlines are **not** an option. Callers impose their own by calling
486
+ * `handle.terminate()` on the returned {@link CodeExecution}.
487
+ *
488
+ * See the [Code Execution specification](https://standardagentspec.com/0.1.0/specification/threads/code-execution)
489
+ * for the full contract.
490
+ */
491
+ interface CodeExecutionOptions {
492
+ /**
493
+ * Export to execute from the evaluated module and arguments to pass.
494
+ *
495
+ * By default, runtimes execute the module's `default` export with no
496
+ * arguments. If the selected export is a function, it is called with
497
+ * `args` and the returned value or promise is used as the run result. If the
498
+ * selected export is not a function, `args` MUST be omitted or empty and the
499
+ * export value itself becomes the result.
500
+ *
501
+ * @default { fn: 'default', args: [] }
502
+ *
503
+ * @example
504
+ * ```ts
505
+ * execute: { fn: 'increment', args: [100] }
506
+ * ```
507
+ */
508
+ execute?: {
509
+ /** Export name to execute. Use `'default'` for the default export. */
510
+ fn?: string;
511
+ /** Arguments passed to the selected export when it is a function. */
512
+ args?: unknown[];
513
+ };
514
+ /**
515
+ * Map of bare module specifier → named exports exposed to the sandbox.
516
+ *
517
+ * Only bare specifiers resolve from `imports` (e.g., `'fs'`,
518
+ * `'@scope/pkg'`). Relative specifiers resolve only from `modules`; URL
519
+ * (`'https://…'`) imports MUST fail at link time.
520
+ *
521
+ * The key `default` within a namespace becomes that module's default export.
522
+ *
523
+ * @example
524
+ * ```ts
525
+ * imports: {
526
+ * fs: { readFile: (path) => state.readFile(path) },
527
+ * supervisor: { report: (payload) => telemetry.push(payload) },
528
+ * }
529
+ * ```
530
+ */
531
+ imports?: Record<string, Record<string, unknown>>;
532
+ /**
533
+ * Additional relative ES modules available to the sandbox.
534
+ *
535
+ * Keys are relative module specifiers from the module graph root, such as
536
+ * `'./helpers.js'` or `'./lib/math.js'`. Entry source imports resolve from
537
+ * `filename` when one is supplied. Entry and module source may import sibling
538
+ * or parent modules with `./` and `../` specifiers when those imports resolve
539
+ * within the supplied module graph. Values are JavaScript or TypeScript module
540
+ * source. Use this when a caller wants the entry source to import local files
541
+ * while still keeping all modules inside the sandbox.
542
+ */
543
+ modules?: Record<string, string>;
544
+ /**
545
+ * Map of identifier → value installed on the sandbox's module scope.
546
+ *
547
+ * These identifiers are resolvable as free variables inside the sandbox
548
+ * but MUST NOT appear on `globalThis`.
549
+ *
550
+ * @example
551
+ * ```ts
552
+ * globals: {
553
+ * console: { log: (...args) => logger.info(...args) },
554
+ * getMessage: async () => '...',
555
+ * }
556
+ * ```
557
+ */
558
+ globals?: Record<string, unknown>;
559
+ /**
560
+ * Source language. TypeScript source has its types erased before evaluation;
561
+ * no type checking is performed.
562
+ *
563
+ * @default 'typescript'
564
+ */
565
+ language?: 'javascript' | 'typescript';
566
+ /**
567
+ * Maximum sandbox heap in bytes. Exceeding this settles the handle with
568
+ * `status: 'memory'`. Runtime default is implementation-defined and
569
+ * documented per runtime.
570
+ */
571
+ memoryLimitBytes?: number;
572
+ /**
573
+ * Label used in stack traces and error `specifier` fields.
574
+ *
575
+ * @default '<runCode>'
576
+ */
577
+ filename?: string;
578
+ /**
579
+ * Optional host-side sink for the built-in `report` bridge.
580
+ *
581
+ * When provided, the runtime installs a `report` global that forwards values
582
+ * to this callback. Reported values are also appended to the live
583
+ * {@link CodeExecution.reports} view and to the final
584
+ * {@link CodeExecutionResult.reports}.
585
+ */
586
+ report?: (value: unknown) => void;
587
+ }
588
+ /**
589
+ * Handle returned by {@link ThreadState.runCode}.
590
+ *
591
+ * `CodeExecution` is a `PromiseLike<CodeExecutionResult>` — `await` the handle
592
+ * to get the final result. The handle also exposes controls that only make
593
+ * sense while the run is in flight: caller-initiated termination and a live
594
+ * view of values emitted via the `report` bridge.
595
+ */
596
+ interface CodeExecution extends PromiseLike<CodeExecutionResult> {
597
+ /**
598
+ * Stop the run. Idempotent: subsequent calls are no-ops.
599
+ *
600
+ * Settles the handle with `status: 'terminated'` at the next ECMAScript
601
+ * yield point (microtask boundary, async operation, or runtime interrupt).
602
+ * Typically a few milliseconds and SHOULD be ≤ 50 ms under normal host load;
603
+ * a pure-synchronous tight loop may run until the runtime's own safety cap
604
+ * fires. When `reason` is provided, it surfaces in `error.message`.
605
+ */
606
+ terminate(reason?: string): void;
607
+ /** `true` until the handle settles. */
608
+ readonly running: boolean;
609
+ /**
610
+ * Snapshot of values emitted via the `report` bridge so far, in call order.
611
+ * The same values appear in {@link CodeExecutionResult.reports} once the
612
+ * run ends.
613
+ */
614
+ readonly reports: readonly unknown[];
615
+ }
616
+ /**
617
+ * Outcome classification for {@link CodeExecutionResult.status}.
618
+ *
619
+ * - `success` — Module evaluated and the configured export resolved.
620
+ * - `error` — Uncaught runtime error inside the sandbox.
621
+ * - `memory` — `memoryLimitBytes` exceeded.
622
+ * - `terminated` — Caller called `handle.terminate()`, or the runtime's own
623
+ * safety cap fired. `error.message` distinguishes the two (including any
624
+ * `reason` the caller passed).
625
+ * - `link_error` — Module graph failed to link (unknown specifier, missing
626
+ * named export, parse error).
627
+ */
628
+ type CodeExecutionStatus = 'success' | 'error' | 'memory' | 'terminated' | 'link_error';
629
+ /**
630
+ * A single captured `console.*` call from inside the sandbox.
631
+ *
632
+ * Only populated when the runtime installs a capturing `console` (typically
633
+ * when the caller does not provide one via `options.globals`).
634
+ */
635
+ interface CodeExecutionLog {
636
+ level: 'log' | 'info' | 'warn' | 'error' | 'debug';
637
+ /** Marshaled argument values, deep-cloned from the sandbox. */
638
+ args: unknown[];
639
+ /** Millisecond timestamp when the call occurred. */
640
+ timestamp: number;
641
+ }
642
+ /**
643
+ * Error surfaced when a {@link CodeExecutionResult} does not have
644
+ * `status: 'success'`.
645
+ *
646
+ * Host-side stack frames MUST NOT leak into this object — only sandbox
647
+ * frames are included.
648
+ */
649
+ interface CodeExecutionError {
650
+ name: string;
651
+ message: string;
652
+ stack?: string;
653
+ /** Module specifier that failed to link (for `link_error`). */
654
+ specifier?: string;
655
+ /** Source filename associated with `line` and `column`, when available. */
656
+ filename?: string;
657
+ /** 1-based line number in source, when available. */
658
+ line?: number;
659
+ /** 1-based column number in source, when available. */
660
+ column?: number;
661
+ }
662
+ /**
663
+ * Result of a {@link ThreadState.runCode} call.
664
+ *
665
+ * The sandbox has two result channels and both may be used in the same run:
666
+ * - **Configured export** → marshaled into `result` on success.
667
+ * - **Bridge reports** → appended to `reports` in call order as they are emitted.
668
+ */
669
+ interface CodeExecutionResult {
670
+ /** Outcome classification — see {@link CodeExecutionStatus}. */
671
+ status: CodeExecutionStatus;
672
+ /**
673
+ * Resolved configured export (after awaiting top-level promises).
674
+ * Omitted when `status !== 'success'`. `undefined` is a valid success result
675
+ * when the configured export resolves to `undefined`.
676
+ */
677
+ result?: unknown;
678
+ /**
679
+ * Values emitted through the built-in `report` bridge when
680
+ * `options.report` is supplied, in call order. Empty when unused.
681
+ */
682
+ reports: unknown[];
683
+ /** Captured `console.*` calls (see {@link CodeExecutionLog}). Empty when the caller supplies its own `console`. */
684
+ logs: CodeExecutionLog[];
685
+ /** Error detail. Present iff `status` is not `'success'`. */
686
+ error?: CodeExecutionError;
687
+ /** Wall-clock execution time in milliseconds. */
688
+ durationMs: number;
689
+ /** Peak sandbox heap in bytes, when the engine can measure it. */
690
+ memoryUsedBytes?: number;
691
+ }
465
692
  /**
466
693
  * Execution-specific state available during agent execution.
467
694
  *
@@ -520,6 +747,24 @@ interface ExecutionState {
520
747
  */
521
748
  readonly promptPath: string[];
522
749
  }
750
+ /**
751
+ * Display/redaction classification for thread-scoped environment values.
752
+ *
753
+ * `secret` values should be redacted from tool output and logs. `text` values
754
+ * may be displayed.
755
+ */
756
+ type EnvValueType = 'text' | 'secret';
757
+ /**
758
+ * Options for {@link ThreadState.setEnv}.
759
+ */
760
+ interface SetEnvOptions {
761
+ /**
762
+ * Display/redaction classification for this value.
763
+ *
764
+ * Defaults to the existing type for that key, or `secret` for new keys.
765
+ */
766
+ type?: EnvValueType;
767
+ }
523
768
  /**
524
769
  * The unified interface for all thread operations.
525
770
  *
@@ -554,10 +799,10 @@ interface ExecutionState {
554
799
  * @example
555
800
  * ```typescript
556
801
  * // In an endpoint
557
- * export default defineThreadEndpoint(async (req, state) => {
802
+ * export default defineThreadEndpoint(async (req, state, params) => {
558
803
  * // state.execution is null (not executing)
559
804
  * const { messages } = await state.getMessages({ limit: 50 });
560
- * return Response.json({ messages });
805
+ * return Response.json({ messages, params });
561
806
  * });
562
807
  * ```
563
808
  */
@@ -690,14 +935,27 @@ interface ThreadState {
690
935
  *
691
936
  * Resolution order:
692
937
  * 1. Thread
693
- * 2. User account
694
- * 3. AgentBuilder instance
695
- * 4. Agent definition
696
- * 5. Prompt definition
938
+ * 2. Agent definition
939
+ * 3. Prompt definition
940
+ * 4. User account
941
+ * 5. AgentBuilder instance
697
942
  *
698
943
  * @throws If the variable is not defined in any source
699
944
  */
700
945
  env(propertyName: string): Promise<string>;
946
+ /**
947
+ * Resolve the display/redaction type for an environment value.
948
+ *
949
+ * Resolution follows the same order as `env()`:
950
+ * thread, agent definition, prompt definition, user account, AgentBuilder instance.
951
+ * User-account and AgentBuilder-instance env stores may persist per-key
952
+ * `text` / `secret` metadata; agent/prompt defaults remain `secret` unless
953
+ * overridden by thread state.
954
+ *
955
+ * Values marked `secret` should be redacted from tool output and logs.
956
+ * Values marked `text` may be shown. Unknown values default to `secret`.
957
+ */
958
+ envType(propertyName: string): Promise<EnvValueType>;
701
959
  /**
702
960
  * Set a thread-scoped environment variable.
703
961
  *
@@ -707,8 +965,9 @@ interface ThreadState {
707
965
  *
708
966
  * @param propertyName - Environment variable name
709
967
  * @param value - Environment variable value
968
+ * @param options - Optional display/redaction classification for this value
710
969
  */
711
- setEnv(propertyName: string, value: string): Promise<void>;
970
+ setEnv(propertyName: string, value: string, options?: SetEnvOptions): Promise<void>;
712
971
  /**
713
972
  * Queue a silent message to this thread's parent, if one exists.
714
973
  *
@@ -787,13 +1046,14 @@ interface ThreadState {
787
1046
  */
788
1047
  getScheduledEffects(name?: string): Promise<ScheduledEffect[]>;
789
1048
  /**
790
- * Remove a scheduled effect.
1049
+ * Cancel a scheduled effect.
791
1050
  *
792
- * Cancels a pending effect before it executes. Has no effect if the
793
- * effect has already executed or doesn't exist.
1051
+ * Cancels a pending effect before it executes. Has no effect if the effect
1052
+ * has already executed, was already canceled, or doesn't exist. Runtimes may
1053
+ * retain canceled effects in inspection history.
794
1054
  *
795
1055
  * @param id - The effect ID returned by scheduleEffect
796
- * @returns true if the effect was found and removed, false otherwise
1056
+ * @returns true if the effect was found and canceled, false otherwise
797
1057
  */
798
1058
  removeScheduledEffect(id: string): Promise<boolean>;
799
1059
  /**
@@ -837,10 +1097,47 @@ interface ThreadState {
837
1097
  * Key-value storage for custom data scoped to this thread.
838
1098
  *
839
1099
  * Context data persists across tool calls within a single execution.
840
- * For persistent storage across executions, use messages or external
841
- * storage.
1100
+ * For persistent storage across executions, use {@link ThreadState.getValue}
1101
+ * and {@link ThreadState.setValue}, the file system, or external storage.
842
1102
  */
843
1103
  context: Record<string, unknown>;
1104
+ /**
1105
+ * Read a value from the thread's durable key-value store.
1106
+ *
1107
+ * Values written with {@link ThreadState.setValue} persist across executions,
1108
+ * tool calls, hook invocations, and endpoint requests for the lifetime of
1109
+ * the thread. The key-value store is one of two ways to store persistent
1110
+ * data on a thread, alongside the file system.
1111
+ *
1112
+ * Returns `null` when no value has been set for the given key. Values are
1113
+ * returned exactly as they were stored; runtimes MUST preserve JSON-equivalent
1114
+ * structure (objects, arrays, strings, numbers, booleans, `null`).
1115
+ *
1116
+ * @param key - The key to read
1117
+ * @returns The stored value, or `null` if the key has no value
1118
+ *
1119
+ * @example
1120
+ * ```typescript
1121
+ * const count = (await state.getValue<number>('invocation_count')) ?? 0;
1122
+ * await state.setValue('invocation_count', count + 1);
1123
+ * ```
1124
+ */
1125
+ getValue<T = unknown>(key: string): Promise<T | null>;
1126
+ /**
1127
+ * Write a value to the thread's durable key-value store.
1128
+ *
1129
+ * The value persists across executions for the lifetime of the thread.
1130
+ * Passing `null` or `undefined` deletes the key. Values MUST be
1131
+ * JSON-serializable; implementations MAY reject non-serializable values.
1132
+ *
1133
+ * Durable values are **not** automatically copied between threads when
1134
+ * subagents are spawned — each thread maintains its own key-value store.
1135
+ *
1136
+ * @param key - The key to write
1137
+ * @param value - The value to store (JSON-serializable), or `null`/`undefined`
1138
+ * to delete the key
1139
+ */
1140
+ setValue(key: string, value: unknown): Promise<void>;
844
1141
  /**
845
1142
  * Write a file to the thread's file system.
846
1143
  *
@@ -954,11 +1251,79 @@ interface ThreadState {
954
1251
  * Use this to access step counts, force turns, or stop execution.
955
1252
  */
956
1253
  execution: ExecutionState | null;
1254
+ /**
1255
+ * Execute JavaScript or TypeScript source in an isolated sandbox.
1256
+ *
1257
+ * The sandbox has **no ambient capabilities**: no filesystem, no network,
1258
+ * no timers, no host globals, no access to `state` itself. Every capability
1259
+ * the sandbox needs must be bridged in explicitly via `options.imports`,
1260
+ * `options.modules`, or `options.globals`.
1261
+ *
1262
+ * Returns a {@link CodeExecution} handle that is a
1263
+ * `PromiseLike<CodeExecutionResult>` — `await` it for the final result — and
1264
+ * also exposes `terminate()` for caller-initiated cancellation. The spec
1265
+ * does not impose a wall-clock timeout; callers layer their own deadline
1266
+ * using a timer plus `handle.terminate()`.
1267
+ *
1268
+ * Results flow back through either:
1269
+ * - the module export selected by `options.execute` (marshaled into
1270
+ * `result.result`; defaults to the `default` export with no arguments; if
1271
+ * the selected export is a function, it is called with `execute.args` and
1272
+ * any returned promise is awaited before marshaling), or
1273
+ * - the built-in `report` bridge (accumulated into `result.reports` and
1274
+ * visible live on `handle.reports`), or
1275
+ * - caller-installed bridge callbacks that the caller owns.
1276
+ *
1277
+ * See the [Code Execution specification](https://standardagentspec.com/0.1.0/specification/threads/code-execution)
1278
+ * for isolation guarantees, module resolution rules, value marshaling, and
1279
+ * conformance requirements.
1280
+ *
1281
+ * @param source - JavaScript or TypeScript source, evaluated as an ES module.
1282
+ * @param options - Export selection, imports, globals, memory cap, and language hints.
1283
+ * @returns A handle that settles with the execution result and can be
1284
+ * terminated at any time before settlement.
1285
+ *
1286
+ * @example
1287
+ * ```typescript
1288
+ * const run = state.runCode(
1289
+ * `
1290
+ * import { readFile } from 'fs';
1291
+ * import { report } from 'supervisor';
1292
+ *
1293
+ * const message = await getMessage();
1294
+ * if (/username/.test(message)) {
1295
+ * report({ topic: 'username', message });
1296
+ * }
1297
+ * export default async () => ({ scanned: true });
1298
+ * `,
1299
+ * {
1300
+ * imports: {
1301
+ * fs: { readFile: (p) => state.readFile(p) },
1302
+ * supervisor: { report: (payload) => flagged.push(payload) },
1303
+ * },
1304
+ * globals: {
1305
+ * console: { log: (...a) => {} },
1306
+ * getMessage: async () => 'latest user message',
1307
+ * },
1308
+ * },
1309
+ * );
1310
+ *
1311
+ * const deadline = setTimeout(() => run.terminate('5s budget'), 5_000);
1312
+ * const result = await run;
1313
+ * clearTimeout(deadline);
1314
+ *
1315
+ * if (result.status === 'success') {
1316
+ * // result.result === { scanned: true }
1317
+ * }
1318
+ * ```
1319
+ */
1320
+ runCode(source: string, options?: CodeExecutionOptions): CodeExecution;
957
1321
  /**
958
1322
  * Runtime-specific context that cannot be packed or shared.
959
1323
  *
960
- * This property allows runtime implementations to inject non-portable
961
- * context (e.g., Cloudflare env bindings, database connections).
1324
+ * This property lets runtime implementations inject non-portable context —
1325
+ * typically host bindings, database connections, or other
1326
+ * platform-specific handles the runtime chooses to expose.
962
1327
  *
963
1328
  * WARNING: Tools using this property cannot be packed, shared, or
964
1329
  * published as they depend on runtime-specific context.
@@ -1089,10 +1454,12 @@ type Dec<N extends number> = N extends 10 ? 9 : N extends 9 ? 8 : N extends 8 ?
1089
1454
  * This is the single source of truth for which Zod types can be used
1090
1455
  * in tool argument schemas. The depth parameter limits recursion to
1091
1456
  * prevent infinite type expansion.
1457
+ * Use ZodUnknown for arbitrary JSON slots, such as array items that can
1458
+ * be strings, numbers, booleans, null, arrays, or objects.
1092
1459
  *
1093
1460
  * @template D - Maximum nesting depth (default: 7)
1094
1461
  */
1095
- type ToolArgsNode<D extends number = 7> = ZodString | ZodNumber | ZodBoolean | ZodNull | ZodLiteral<string | number | boolean | null> | ZodEnum<Readonly<Record<string, string>>> | (D extends 0 ? never : ZodOptional<ToolArgsNode<Dec<D>>>) | (D extends 0 ? never : ZodNullable<ToolArgsNode<Dec<D>>>) | (D extends 0 ? never : ZodDefault<ToolArgsNode<Dec<D>>>) | (D extends 0 ? never : ZodArray<ToolArgsNode<Dec<D>>>) | (D extends 0 ? never : ZodObject<Record<string, ToolArgsNode<Dec<D>>>>) | (D extends 0 ? never : ZodRecord<ZodString, ToolArgsNode<Dec<D>>>) | (D extends 0 ? never : ZodUnion<[
1462
+ type ToolArgsNode<D extends number = 7> = ZodString | ZodNumber | ZodBoolean | ZodNull | ZodLiteral<string | number | boolean | null> | ZodUnknown | ZodEnum<Readonly<Record<string, string>>> | (D extends 0 ? never : ZodOptional<ToolArgsNode<Dec<D>>>) | (D extends 0 ? never : ZodNullable<ToolArgsNode<Dec<D>>>) | (D extends 0 ? never : ZodDefault<ToolArgsNode<Dec<D>>>) | (D extends 0 ? never : ZodArray<ToolArgsNode<Dec<D>>>) | (D extends 0 ? never : ZodObject<Record<string, ToolArgsNode<Dec<D>>>>) | (D extends 0 ? never : ZodRecord<ZodString, ToolArgsNode<Dec<D>>>) | (D extends 0 ? never : ZodUnion<readonly [
1096
1463
  ToolArgsNode<Dec<D>>,
1097
1464
  ToolArgsNode<Dec<D>>,
1098
1465
  ...ToolArgsNode<Dec<D>>[]
@@ -1477,6 +1844,16 @@ interface ProviderModelInfo {
1477
1844
  iconId?: string;
1478
1845
  /** Optional slug for additional lookups (e.g., OpenRouter endpoint queries) */
1479
1846
  slug?: string;
1847
+ /**
1848
+ * Optional capability hints surfaced from the provider's listing
1849
+ * payload. Populated when the provider can derive support flags
1850
+ * (vision / tool calls / streaming / JSON mode) without an
1851
+ * additional per-model probe — lets UIs render the capability
1852
+ * matrix on every row in the picker. Omit when the provider
1853
+ * doesn't expose enough metadata; consumers must tolerate
1854
+ * undefined.
1855
+ */
1856
+ capabilities?: ModelCapabilities;
1480
1857
  }
1481
1858
  /**
1482
1859
  * Query params for provider-backed model discovery.
@@ -1546,7 +1923,11 @@ interface LLMProviderInterface {
1546
1923
  /**
1547
1924
  * Get tools embedded in this provider.
1548
1925
  * Optional - providers may implement this to expose built-in tools
1549
- * (e.g., OpenAI's web_search, file_search, code_interpreter).
1926
+ * (e.g., OpenAI's web_search or xAI's x_search).
1927
+ *
1928
+ * Tool names are provider-defined capability names. Standard Agents defines
1929
+ * discovery, selection, execution ownership, and result reporting; providers
1930
+ * define their own native request mapping.
1550
1931
  *
1551
1932
  * These tools are defined using defineTool() with optional variable requirements.
1552
1933
  * Tools returned here can be referenced by name in model/prompt definitions.
@@ -1753,6 +2134,12 @@ interface ProviderToolCallPart {
1753
2134
  id: string;
1754
2135
  name: string;
1755
2136
  arguments: Record<string, unknown>;
2137
+ /**
2138
+ * Provider-specific metadata that must round-trip with the tool call.
2139
+ * For example, Gemini tool calls can include a thought signature that must
2140
+ * be echoed back on the next turn for tool calling to continue working.
2141
+ */
2142
+ extraContent?: Record<string, unknown>;
1756
2143
  }
1757
2144
  type ProviderToolResultContent = string | {
1758
2145
  type: 'text';
@@ -1767,6 +2154,14 @@ interface ProviderResponse {
1767
2154
  reasoningDetails?: ProviderReasoningDetail[];
1768
2155
  toolCalls?: ProviderToolCallPart[];
1769
2156
  images?: ProviderGeneratedImage[];
2157
+ /**
2158
+ * Provider-executed tool calls surfaced for logging and inspection.
2159
+ *
2160
+ * Providers should populate this when the upstream provider executed a
2161
+ * built-in/native tool server-side. These entries are informational for
2162
+ * Standard Agents and must not be re-executed locally.
2163
+ */
2164
+ providerTools?: ProviderExecutedToolResult[];
1770
2165
  finishReason: ProviderFinishReason;
1771
2166
  usage: ProviderUsage;
1772
2167
  metadata?: Record<string, unknown>;
@@ -1821,6 +2216,57 @@ interface ProviderWebSearchResult {
1821
2216
  }>;
1822
2217
  }>;
1823
2218
  }
2219
+ /**
2220
+ * Provider-executed tool call surfaced for logging.
2221
+ *
2222
+ * Providers use this when the upstream model provider executes a native tool
2223
+ * server-side and Standard Agents should record the call without attempting to
2224
+ * execute it locally.
2225
+ */
2226
+ interface ProviderExecutedToolResult {
2227
+ /** Provider-facing tool name, such as "web_search" or "x_search" */
2228
+ name: string;
2229
+ /**
2230
+ * Legacy alias for `name`, retained for persisted log compatibility.
2231
+ * New provider implementations should set `name`; runtimes may mirror it
2232
+ * into `type` when serializing logs for older UIs.
2233
+ */
2234
+ type?: string;
2235
+ /** Provider that executed the tool, such as "openai" or "xai" */
2236
+ provider?: string;
2237
+ /** Unique ID of the provider tool call */
2238
+ id: string;
2239
+ /** Execution status */
2240
+ status: 'completed' | 'failed' | 'in_progress';
2241
+ /** Optional provider-specific result or argument summary */
2242
+ result?: {
2243
+ actions?: Array<{
2244
+ type: string;
2245
+ query?: string;
2246
+ url?: string;
2247
+ pattern?: string;
2248
+ sources?: Array<{
2249
+ type?: string;
2250
+ url: string;
2251
+ title?: string;
2252
+ }>;
2253
+ }>;
2254
+ input?: Record<string, unknown>;
2255
+ output?: string;
2256
+ results?: unknown[];
2257
+ artifacts?: Array<{
2258
+ type: string;
2259
+ id?: string;
2260
+ mediaType?: string;
2261
+ url?: string;
2262
+ path?: string;
2263
+ title?: string;
2264
+ metadata?: Record<string, unknown>;
2265
+ }>;
2266
+ };
2267
+ /** Provider-specific structured details that should stay JSON-serializable */
2268
+ metadata?: Record<string, unknown>;
2269
+ }
1824
2270
  type ProviderStreamChunk = {
1825
2271
  type: 'content-delta';
1826
2272
  delta: string;
@@ -1835,6 +2281,7 @@ type ProviderStreamChunk = {
1835
2281
  type: 'tool-call-start';
1836
2282
  id: string;
1837
2283
  name: string;
2284
+ extraContent?: Record<string, unknown>;
1838
2285
  } | {
1839
2286
  type: 'tool-call-delta';
1840
2287
  id: string;
@@ -1843,6 +2290,7 @@ type ProviderStreamChunk = {
1843
2290
  type: 'tool-call-done';
1844
2291
  id: string;
1845
2292
  arguments: Record<string, unknown>;
2293
+ extraContent?: Record<string, unknown>;
1846
2294
  } | {
1847
2295
  type: 'image-delta';
1848
2296
  index: number;
@@ -1854,6 +2302,9 @@ type ProviderStreamChunk = {
1854
2302
  } | {
1855
2303
  type: 'web-search-done';
1856
2304
  result: ProviderWebSearchResult;
2305
+ } | {
2306
+ type: 'provider-tool-done';
2307
+ tool: ProviderExecutedToolResult;
1857
2308
  } | {
1858
2309
  type: 'finish';
1859
2310
  finishReason: ProviderFinishReason;
@@ -1916,7 +2367,7 @@ interface ProviderInstance {
1916
2367
  getModelsPage?(query?: ProviderModelsQuery): Promise<ProviderModelsPage>;
1917
2368
  /** Fetch capabilities for a specific model */
1918
2369
  getModelCapabilities?(modelId: string): Promise<ModelCapabilities | null>;
1919
- /** Get provider-specific tools available for a model */
2370
+ /** Get provider-defined built-in tools available for a model */
1920
2371
  getTools?(modelId?: string): Record<string, ToolDefinition<unknown, ToolArgs | null, ToolTenvs | null>> | Promise<Record<string, ToolDefinition<unknown, ToolArgs | null, ToolTenvs | null>>>;
1921
2372
  /** Get the icon URL for this provider or a specific model */
1922
2373
  getIcon?(modelId?: string): string | undefined;
@@ -2190,9 +2641,10 @@ interface ModelDefinition<N extends string = string, P extends ProviderFactoryWi
2190
2641
  * Provider tools available for this model.
2191
2642
  * References tool names from provider.getTools().
2192
2643
  *
2193
- * Provider tools are built-in tools offered by the provider (e.g., OpenAI's
2194
- * web_search, file_search, code_interpreter, image_generation). These tools
2195
- * can be used in prompts alongside custom tools.
2644
+ * Provider tools are built-in tools offered by the provider. Tool names are
2645
+ * provider-defined capability names, not Standard Agents global names. These
2646
+ * tools can be used in prompts alongside custom tools and are executed by
2647
+ * the upstream provider.
2196
2648
  *
2197
2649
  * @example
2198
2650
  * ```typescript
@@ -2432,7 +2884,9 @@ interface PromptToolConfig {
2432
2884
  * Non-resumable subagents behave like normal tool calls.
2433
2885
  * Resumable subagents are created/messaged through runtime-injected lifecycle
2434
2886
  * tools (for example `subagent_create` and `subagent_message`) and tracked in
2435
- * the parent thread registry.
2887
+ * the parent thread registry. The injected `subagent_create` tool MUST require
2888
+ * a non-empty human-readable `name` argument and runtimes SHOULD persist it as
2889
+ * a child thread display name.
2436
2890
  *
2437
2891
  * @example
2438
2892
  * ```typescript
@@ -2713,7 +3167,8 @@ interface PromptDefinition<N extends string = string, S extends ToolArgs = ToolA
2713
3167
  tools?: (StandardAgentSpec.Callables | SubpromptConfig | PromptToolConfig | SubagentToolConfig)[];
2714
3168
  /**
2715
3169
  * Environment values provided by this prompt.
2716
- * Prompt values are the lowest-precedence source in runtime resolution.
3170
+ * Prompt values override user-account and AgentBuilder-instance defaults.
3171
+ * Agent and thread values override prompt values.
2717
3172
  */
2718
3173
  env?: Record<string, string>;
2719
3174
  /**
@@ -2816,12 +3271,16 @@ declare function definePrompt<N extends string, S extends ToolArgs = never>(opti
2816
3271
  *
2817
3272
  * @example
2818
3273
  * ```typescript
2819
- * const hook = defineHook('filter_messages', async (state, messages) => {
2820
- * console.log(`Thread: ${state.threadId}`);
2821
- * if (state.execution) {
2822
- * console.log(`Turn: ${state.execution.turnCount}`);
2823
- * }
2824
- * return messages.slice(-10);
3274
+ * const hook = defineHook({
3275
+ * hook: 'filter_messages',
3276
+ * id: 'keep_recent',
3277
+ * execute: async (state, messages) => {
3278
+ * console.log(`Thread: ${state.threadId}`);
3279
+ * if (state.execution) {
3280
+ * console.log(`Step: ${state.execution.stepCount}`);
3281
+ * }
3282
+ * return messages.slice(-10);
3283
+ * },
2825
3284
  * });
2826
3285
  * ```
2827
3286
  */
@@ -2908,6 +3367,38 @@ interface LLMMessage {
2908
3367
  * @template ToolResult - The tool result type (defaults to HookToolResult)
2909
3368
  */
2910
3369
  interface HookSignatures<State = ThreadState, Msg = HookMessage, ToolCall = HookToolCall, ToolResult = HookToolResult> {
3370
+ /**
3371
+ * Called after a thread is created, before initial message processing or LLM
3372
+ * requests for that thread.
3373
+ *
3374
+ * Only ThreadState is passed. Use for initializing durable thread values,
3375
+ * env placeholders, files, or side-effect instrumentation.
3376
+ *
3377
+ * @param state - Created thread state
3378
+ */
3379
+ after_thread_created: (state: State) => Promise<void>;
3380
+ /**
3381
+ * Called on the parent thread immediately after a subagent child thread is
3382
+ * created.
3383
+ *
3384
+ * Receives parent ThreadState and child ThreadState. Use for copying or
3385
+ * linking metadata, bookkeeping, or side-effect instrumentation.
3386
+ *
3387
+ * @param state - Parent thread state
3388
+ * @param childState - Created child thread state
3389
+ */
3390
+ after_subagent_created: (state: State, childState: State) => Promise<void>;
3391
+ /**
3392
+ * Called after the prompt system message is rendered for a model request.
3393
+ *
3394
+ * Return a string to replace the rendered system message. Return null or
3395
+ * undefined to keep the original message.
3396
+ *
3397
+ * @param state - Thread state
3398
+ * @param systemMessage - Rendered system message for this request
3399
+ * @returns Replacement system message, or null/undefined for no change
3400
+ */
3401
+ after_system_message: (state: State, systemMessage: string) => string | Promise<string | null | undefined> | null | undefined;
2911
3402
  /**
2912
3403
  * Called before messages are filtered and sent to the LLM.
2913
3404
  *
@@ -2920,9 +3411,10 @@ interface HookSignatures<State = ThreadState, Msg = HookMessage, ToolCall = Hook
2920
3411
  *
2921
3412
  * @example
2922
3413
  * ```typescript
2923
- * defineHook('filter_messages', async (state, messages) => {
2924
- * // Only include messages from last 10 turns
2925
- * return messages.slice(-10);
3414
+ * defineHook({
3415
+ * hook: 'filter_messages',
3416
+ * id: 'limit_to_10',
3417
+ * execute: async (state, messages) => messages.slice(-10),
2926
3418
  * });
2927
3419
  * ```
2928
3420
  */
@@ -2939,9 +3431,10 @@ interface HookSignatures<State = ThreadState, Msg = HookMessage, ToolCall = Hook
2939
3431
  *
2940
3432
  * @example
2941
3433
  * ```typescript
2942
- * defineHook('prefilter_llm_history', async (state, messages) => {
2943
- * // Add a reminder to the last user message
2944
- * return messages;
3434
+ * defineHook({
3435
+ * hook: 'prefilter_llm_history',
3436
+ * id: 'add_reminder',
3437
+ * execute: async (state, messages) => messages,
2945
3438
  * });
2946
3439
  * ```
2947
3440
  */
@@ -3006,8 +3499,13 @@ interface HookSignatures<State = ThreadState, Msg = HookMessage, ToolCall = Hook
3006
3499
  *
3007
3500
  * @example
3008
3501
  * ```typescript
3009
- * defineHook('before_update_message', async (state, messageId, updates) => {
3010
- * return { ...updates, updated_at: Date.now() };
3502
+ * defineHook({
3503
+ * hook: 'before_update_message',
3504
+ * id: 'stamp_updated_at',
3505
+ * execute: async (state, messageId, updates) => ({
3506
+ * ...updates,
3507
+ * updated_at: Date.now(),
3508
+ * }),
3011
3509
  * });
3012
3510
  * ```
3013
3511
  */
@@ -3023,8 +3521,12 @@ interface HookSignatures<State = ThreadState, Msg = HookMessage, ToolCall = Hook
3023
3521
  *
3024
3522
  * @example
3025
3523
  * ```typescript
3026
- * defineHook('after_update_message', async (state, message) => {
3027
- * console.log(`Message updated: ${message.id}`);
3524
+ * defineHook({
3525
+ * hook: 'after_update_message',
3526
+ * id: 'log_update',
3527
+ * execute: async (state, message) => {
3528
+ * console.log(`Message updated: ${message.id}`);
3529
+ * },
3028
3530
  * });
3029
3531
  * ```
3030
3532
  */
@@ -3071,9 +3573,13 @@ interface HookSignatures<State = ThreadState, Msg = HookMessage, ToolCall = Hook
3071
3573
  *
3072
3574
  * @example
3073
3575
  * ```typescript
3074
- * defineHook('after_tool_call_success', async (state, toolCall, toolResult) => {
3075
- * console.log(`Tool ${toolCall.function.name} succeeded`);
3076
- * return null; // Use original result
3576
+ * defineHook({
3577
+ * hook: 'after_tool_call_success',
3578
+ * id: 'log_success',
3579
+ * execute: async (state, toolCall, toolResult) => {
3580
+ * console.log(`Tool ${toolCall.function.name} succeeded`);
3581
+ * return null; // use original result
3582
+ * },
3077
3583
  * });
3078
3584
  * ```
3079
3585
  */
@@ -3092,9 +3598,13 @@ interface HookSignatures<State = ThreadState, Msg = HookMessage, ToolCall = Hook
3092
3598
  *
3093
3599
  * @example
3094
3600
  * ```typescript
3095
- * defineHook('after_tool_call_failure', async (state, toolCall, toolResult) => {
3096
- * console.error(`Tool ${toolCall.function.name} failed: ${toolResult.error}`);
3097
- * return null; // Use original error
3601
+ * defineHook({
3602
+ * hook: 'after_tool_call_failure',
3603
+ * id: 'log_failure',
3604
+ * execute: async (state, toolCall, toolResult) => {
3605
+ * console.error(`Tool ${toolCall.function.name} failed: ${toolResult.error}`);
3606
+ * return null; // use original error
3607
+ * },
3098
3608
  * });
3099
3609
  * ```
3100
3610
  */
@@ -3602,8 +4112,9 @@ type VirtualModuleRegistry<T> = Record<string, VirtualModuleLoader<T>>;
3602
4112
  * and optionally the virtual module registries injected at runtime.
3603
4113
  *
3604
4114
  * Note: The `env` property contains implementation-specific bindings.
3605
- * Cloudflare implementations may include Durable Object namespaces,
3606
- * KV namespaces, etc. Other implementations may provide different bindings.
4115
+ * Its shape is defined by the runtime — typical surfaces include handles
4116
+ * to storage, queues, key-value stores, or other platform resources the
4117
+ * runtime chooses to expose.
3607
4118
  */
3608
4119
  interface ControllerContext {
3609
4120
  /** The incoming HTTP request */
@@ -3615,7 +4126,8 @@ interface ControllerContext {
3615
4126
  /**
3616
4127
  * Environment bindings (implementation-specific).
3617
4128
  *
3618
- * Contains platform-specific bindings like Durable Objects, KV, etc.
4129
+ * Contains platform-specific bindings handles to storage,
4130
+ * queues, key-value stores, or other resources the runtime exposes.
3619
4131
  * The exact contents depend on the runtime implementation.
3620
4132
  */
3621
4133
  env: Record<string, unknown>;
@@ -3663,9 +4175,19 @@ type Controller = (context: ControllerContext) => ControllerReturn;
3663
4175
  * Thread endpoint handler function.
3664
4176
  *
3665
4177
  * Receives the HTTP request and the ThreadState for the requested thread.
3666
- * The thread is automatically looked up by ID from URL parameters.
4178
+ * The supplied ThreadState includes the standard thread surface, including
4179
+ * `runCode`. The thread is automatically looked up by ID from URL parameters. Route
4180
+ * parameters are derived from the endpoint file path. For a dynamic segment
4181
+ * such as `[id].ts`, `params.id` contains the matched segment. For a catch-all
4182
+ * segment `[*].ts`, `params['*']` contains the unmatched path suffix,
4183
+ * including `/` separators when the match spans multiple segments.
4184
+ *
4185
+ * Thread endpoint routes are scoped beneath the runtime's thread ID prefix.
4186
+ * A request under that prefix that does not match any local or packed thread
4187
+ * endpoint route MUST return HTTP 404.
3667
4188
  */
3668
- type ThreadEndpointHandler = (req: Request, state: ThreadState) => Response | Promise<Response>;
4189
+ type ThreadEndpointRouteParams = Record<string, string>;
4190
+ type ThreadEndpointHandler = (req: Request, state: ThreadState, params: ThreadEndpointRouteParams) => Response | Promise<Response>;
3669
4191
  /**
3670
4192
  * Define a standard HTTP controller.
3671
4193
  *
@@ -3704,12 +4226,15 @@ declare function defineController(controller: Controller): Controller;
3704
4226
  * ThreadState with messages, logs, resource loading, event emission,
3705
4227
  * and (when executing) execution state.
3706
4228
  *
3707
- * @param handler - The handler function receiving request and ThreadState
4229
+ * Runtimes MUST return HTTP 404 for requests beneath the thread endpoint
4230
+ * prefix that do not match any local or packed thread endpoint route.
4231
+ *
4232
+ * @param handler - The handler function receiving request, ThreadState, and route params
3708
4233
  * @returns A Controller that can be used with the router
3709
4234
  *
3710
4235
  * @example
3711
4236
  * ```typescript
3712
- * // agents/api/threads/[id]/status.get.ts
4237
+ * // agents/api/status.ts
3713
4238
  * import { defineThreadEndpoint } from '@standardagents/spec';
3714
4239
  *
3715
4240
  * export default defineThreadEndpoint(async (req, state) => {
@@ -3724,7 +4249,7 @@ declare function defineController(controller: Controller): Controller;
3724
4249
  *
3725
4250
  * @example
3726
4251
  * ```typescript
3727
- * // agents/api/threads/[id]/export.get.ts
4252
+ * // agents/api/export.ts
3728
4253
  * import { defineThreadEndpoint } from '@standardagents/spec';
3729
4254
  *
3730
4255
  * export default defineThreadEndpoint(async (req, state) => {
@@ -3743,7 +4268,7 @@ declare function defineController(controller: Controller): Controller;
3743
4268
  *
3744
4269
  * @example
3745
4270
  * ```typescript
3746
- * // agents/api/threads/[id]/invoke.post.ts
4271
+ * // agents/api/invoke.post.ts
3747
4272
  * import { defineThreadEndpoint } from '@standardagents/spec';
3748
4273
  *
3749
4274
  * export default defineThreadEndpoint(async (req, state) => {
@@ -3755,6 +4280,17 @@ declare function defineController(controller: Controller): Controller;
3755
4280
  * return Response.json({ queued: true });
3756
4281
  * });
3757
4282
  * ```
4283
+ *
4284
+ * @example
4285
+ * ```typescript
4286
+ * // agents/api/files/[id].ts
4287
+ * import { defineThreadEndpoint } from '@standardagents/spec';
4288
+ *
4289
+ * export default defineThreadEndpoint(async (req, state, params) => {
4290
+ * const file = await state.readFile(`/files/${params.id}.json`);
4291
+ * return Response.json({ exists: !!file });
4292
+ * });
4293
+ * ```
3758
4294
  */
3759
4295
  declare function defineThreadEndpoint(handler: ThreadEndpointHandler): MarkedThreadEndpoint;
3760
4296
 
@@ -3952,8 +4488,10 @@ interface PackedExports {
3952
4488
  /**
3953
4489
  * Thread endpoint handlers, keyed by packed route key (for example, `status.get`).
3954
4490
  *
3955
- * Runtimes typically mount these under a package namespace (for example:
3956
- * `/api/packages/:packageId/threads/:id/...`) to avoid collisions.
4491
+ * Runtimes mount these beneath the same thread ID prefix as local thread
4492
+ * endpoints, using the packed route key to derive the endpoint path.
4493
+ * Requests beneath that prefix that do not match any local or packed thread
4494
+ * endpoint route MUST return HTTP 404.
3957
4495
  *
3958
4496
  * Optional for backward compatibility with previously packed packages.
3959
4497
  */
@@ -3962,4 +4500,4 @@ interface PackedExports {
3962
4500
  __meta: PackedMeta;
3963
4501
  }
3964
4502
 
3965
- export { type AgentDefinition, type AgentType, type AttachmentRef, type ContentPart, type Controller, type ControllerContext, type ControllerReturn, type DefineToolOptions, type DefinitionLoader, type Effect, type EffectDefinition, type EmptyUsesState, type ExecutionState, type FileChunk, type FilePart, type FileRecord, type FileStats, type FileStorage, type FindResult, type GetMessagesOptions, type GlobalNamespaceContext, type GrepResult, type HookContext, type HookDefinition, type HookDefinitionOptions, type HookDefinitionResult, type HookMessage, type HookName, type HookSignatures, type HookToolCall, type HookToolResult, type ImageContent, type ImagePart, type ImageUrlPart, type InferProviderOptions, type InjectMessageInput, type InspectedRequest, type LLMMessage, type LLMProviderInterface, type MarkedThreadEndpoint, type Message, type MessageUpdates, type MessagesResult, type ModelCapabilities, type ModelDefinition, type ModelProvider, type NamespaceContext, type PackageSignature, type PackedExports, type PackedMeta, type PackedMetadata, type PackedNamespaceContext, type PromptContent, type PromptDefinition, type PromptEnvPart, type PromptIncludePart, type PromptInput, type PromptPart, type PromptTextPart, type PromptToolConfig, type ProviderAssistantMessage, type ProviderAttachment, ProviderError, type ProviderErrorCode, type ProviderFactory, type ProviderFactoryConfig, type ProviderFactoryWithOptions, type ProviderFinishReason, type ProviderGeneratedImage, type ProviderInstance, type ProviderMessage, type ProviderMessageContent, type ProviderModelInfo, type ProviderModelsPage, type ProviderModelsQuery, type ProviderReasoningDetail, type ProviderRequest, type ProviderResponse, type ProviderStreamChunk, type ProviderSystemMessage, type ProviderTool, type ProviderToolCallPart, type ProviderToolMessage, type ProviderToolResultContent, type ProviderUsage, type ProviderUserMessage, type ProviderWebSearchResult, type QueueMessageInput, type ReadFileStreamOptions, type ReaddirResult, type ReasoningConfig, type ResolveUsesState, type ResponseSummary, type ScheduledEffect, type SessionToolBinding, type SessionToolConfig, type SideConfig, type StructuredPrompt, type SubagentRegistryEntry, type SubagentToolConfig, type SubpromptConfig, THREAD_ENDPOINT_SYMBOL, type TenvRawShape, type TextContent, type TextPart, type ThreadEndpointHandler, type ThreadMetadata, type ThreadState, type Tool, type ToolArgs, type ToolArgsNode, type ToolArgsRawShape, type ToolAttachment, type ToolConfig, type ToolContent, type ToolDefinition, type ToolResult, type ToolTenvs, type ToolVariables, type UsesAwareExecute, type UsesConstrainedState, type VariableDefinition, type VariableType, type VirtualModuleLoader, type VirtualModuleRegistry, type WriteFileOptions, belongsToPackage, defineAgent, defineController, defineEffect, defineHook, defineModel, definePrompt, defineThreadEndpoint, defineTool, isPacked, isThreadEndpoint, isVisibleInNamespace, mapReasoningLevel, validateToolName };
4503
+ export { type AgentDefinition, type AgentType, type AttachmentRef, type CodeExecution, type CodeExecutionError, type CodeExecutionLog, type CodeExecutionOptions, type CodeExecutionResult, type CodeExecutionStatus, type ContentPart, type Controller, type ControllerContext, type ControllerReturn, type DefineToolOptions, type DefinitionLoader, type Effect, type EffectDefinition, type EmptyUsesState, type EnvValueType, type ExecutionState, type FileChunk, type FilePart, type FileRecord, type FileStats, type FileStorage, type FindResult, type GetMessagesOptions, type GlobalNamespaceContext, type GrepResult, type HookContext, type HookDefinition, type HookDefinitionOptions, type HookDefinitionResult, type HookMessage, type HookName, type HookSignatures, type HookToolCall, type HookToolResult, type ImageContent, type ImagePart, type ImageUrlPart, type InferProviderOptions, type InjectMessageInput, type InspectedRequest, type LLMMessage, type LLMProviderInterface, type MarkedThreadEndpoint, type Message, type MessageUpdates, type MessagesResult, type ModelCapabilities, type ModelDefinition, type ModelProvider, type NamespaceContext, type PackageSignature, type PackedExports, type PackedMeta, type PackedMetadata, type PackedNamespaceContext, type PromptContent, type PromptDefinition, type PromptEnvPart, type PromptIncludePart, type PromptInput, type PromptPart, type PromptTextPart, type PromptToolConfig, type ProviderAssistantMessage, type ProviderAttachment, ProviderError, type ProviderErrorCode, type ProviderExecutedToolResult, type ProviderFactory, type ProviderFactoryConfig, type ProviderFactoryWithOptions, type ProviderFinishReason, type ProviderGeneratedImage, type ProviderInstance, type ProviderMessage, type ProviderMessageContent, type ProviderModelInfo, type ProviderModelsPage, type ProviderModelsQuery, type ProviderReasoningDetail, type ProviderRequest, type ProviderResponse, type ProviderStreamChunk, type ProviderSystemMessage, type ProviderTool, type ProviderToolCallPart, type ProviderToolMessage, type ProviderToolResultContent, type ProviderUsage, type ProviderUserMessage, type ProviderWebSearchResult, type QueueMessageInput, type ReadFileStreamOptions, type ReaddirResult, type ReasoningConfig, type ResolveUsesState, type ResponseSummary, type ScheduledEffect, type SessionToolBinding, type SessionToolConfig, type SetEnvOptions, type SideConfig, type StructuredPrompt, type SubagentRegistryEntry, type SubagentToolConfig, type SubpromptConfig, THREAD_ENDPOINT_SYMBOL, type TenvRawShape, type TextContent, type TextPart, type ThreadEndpointHandler, type ThreadEndpointRouteParams, type ThreadMetadata, type ThreadState, type Tool, type ToolArgs, type ToolArgsNode, type ToolArgsRawShape, type ToolAttachment, type ToolConfig, type ToolContent, type ToolDefinition, type ToolResult, type ToolTenvs, type ToolVariables, type UsesAwareExecute, type UsesConstrainedState, type VariableDefinition, type VariableType, type VirtualModuleLoader, type VirtualModuleRegistry, type WriteFileOptions, belongsToPackage, defineAgent, defineController, defineEffect, defineHook, defineModel, definePrompt, defineThreadEndpoint, defineTool, isPacked, isThreadEndpoint, isVisibleInNamespace, mapReasoningLevel, validateToolName };