@coder/ai-sdk-agent 0.4.3 → 0.6.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.
package/README.md CHANGED
@@ -286,6 +286,79 @@ with a 4xx — bad/expired token, or an older Coder server without the endpoint
286
286
  `watchChatEvents({ baseUrl, token, signal, webSocketFactory })` export provides
287
287
  the same stream without a `CoderChatClient`.
288
288
 
289
+ ## Observability
290
+
291
+ `onTransportEvent` receives typed transport events — HTTP exchanges, the
292
+ per‑chat stream's WebSocket lifecycle, and turn‑segment boundaries — so timing
293
+ and tracing need no `fetch`/`webSocketFactory` wrapping and no re‑parsing of
294
+ stream frames. Pass it on `CoderAgentSettings` (it reaches both the client and
295
+ the model), on `CoderChatClientOptions`, or on `CoderLanguageModelConfig`:
296
+
297
+ ```ts
298
+ import { CoderAgent, type CoderTransportEvent } from "@coder/ai-sdk-agent";
299
+
300
+ const events: CoderTransportEvent[] = [];
301
+ const agent = new CoderAgent({
302
+ baseUrl,
303
+ token,
304
+ organizationId,
305
+ onTransportEvent: (ev) => events.push(ev),
306
+ });
307
+
308
+ await agent.generate({ prompt: "…" });
309
+
310
+ // e.g. attribute where the turn spent its time:
311
+ for (const ev of events) {
312
+ if (ev.type === "http:response")
313
+ console.log(`${ev.method} ${ev.path} → ${ev.status} in ${ev.durationMs.toFixed(0)}ms`);
314
+ if (ev.type === "ws:event" && ev.event.type === "action_required")
315
+ console.log(`tool calls arrived at +${ev.timestamp - events[0]!.timestamp}ms`);
316
+ if (ev.type === "segment:settle")
317
+ console.log(`segment ${ev.segment}: ${ev.status} in ${ev.durationMs.toFixed(0)}ms`);
318
+ }
319
+ ```
320
+
321
+ `CoderTransportEvent` is a discriminated union on `type`. Every event carries
322
+ `timestamp` (`Date.now()` at observation — comparable to server‑side timestamps
323
+ such as a message's `created_at`, for delivery‑lag measurements):
324
+
325
+ | event | when | payload (besides `timestamp`) |
326
+ | ---------------- | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
327
+ | `http:request` | a REST request is sent | `id` (correlates the pair), `method`, `path` |
328
+ | `http:response` | response headers arrive (incl. non‑2xx, `ok:false`) | `id`, `method`, `path`, `status`, `ok`, `durationMs` |
329
+ | `http:error` | the fetch itself rejects (network failure, abort) | `id`, `method`, `path`, `message`, `durationMs` |
330
+ | `ws:dial` | a stream connection attempt starts | `chatId`, `attempt` (1‑based, increments per redial), `url` |
331
+ | `ws:open` | the WebSocket handshake completes | `chatId`, `attempt` |
332
+ | `ws:event` | a decoded stream event arrives | `chatId`, `attempt`, `event` (the decoded `ChatStreamEvent`, by reference — don't mutate) |
333
+ | `ws:close` | the connection ends (exactly one per dial) | `chatId`, `attempt`, `code`/`reason` when the server/network closed it; absent when the reader closed it (settle, teardown, redial) |
334
+ | `ws:error` | a socket error or unparseable frame | `chatId`, `attempt`, `message` |
335
+ | `ws:redial` | a dropped connection is about to be redialed | `chatId`, `attempt` (the ended connection), `consecutiveFailures`, `maxConsecutiveFailures`, `backoffMs` |
336
+ | `segment:start` | a turn segment (one model round‑trip) starts | `segment` (1‑based per model instance), `chatId` (absent before the first turn creates the chat) |
337
+ | `segment:settle` | the segment ends (exactly one per start) | `segment`, `chatId`, and: `status` + `finishReason` on a clean settle, `error` (`{name, message}`, plus `status` if the run still settled terminally) on failure, neither on a teardown |
338
+
339
+ Semantics worth knowing:
340
+
341
+ - **Isolation** — exceptions thrown by the handler are swallowed; they can never
342
+ alter transport behavior or a turn's outcome.
343
+ - **Zero overhead** — without a handler, no event objects are allocated and no
344
+ extra socket listeners are registered.
345
+ - **No secrets** — events carry no headers and no tokens (auth travels in the
346
+ `Coder-Session-Token` header, which is deliberately excluded); `path`/`url`
347
+ never contain credentials.
348
+ - `ws:event` fires at arrival, **before** replay dedup: after a redial, chatd's
349
+ replay of the in‑progress episode is visible here (correlate with `attempt`)
350
+ even though the reader suppresses the duplicates it forwards to the turn.
351
+ - A multi‑step turn that drives client tools emits one `segment:start`/
352
+ `segment:settle` pair per round‑trip, all riding **one** `ws:dial`ed
353
+ connection — the stream is retained across `requires_action` pauses. A pause
354
+ settles with `status: "requires_action"`, `finishReason: "tool-calls"`; the
355
+ final settle carries the terminal status (`waiting`/`completed`/`error`).
356
+ - `ws:*` events cover the per‑chat `/stream` reader (turn transport). The
357
+ `watchChats` subscription is not instrumented.
358
+ - With a pre‑built `client` in `CoderAgentSettings`, HTTP/WS events come from
359
+ the hook given to **that client's** options; the agent‑level hook then only
360
+ receives `segment:*` events.
361
+
289
362
  ## Timeouts & cancellation
290
363
 
291
364
  Pass an `abortSignal` to `generate()`/`stream()` to cancel a turn. Aborting
@@ -624,6 +697,7 @@ running many agents at once:
624
697
  | `stopWhen` | AI SDK stop condition(s); default `stepCountIs(64)` |
625
698
  | `maxRetries` | default `0` — SDK retries can duplicate server‑side turns; override with care |
626
699
  | `requestTimeoutMs` | per‑turn time budget (ms); interrupts the run and rejects (`kind: "timeout"`) instead of hanging |
700
+ | `onTransportEvent` | observability hook for typed transport events (see [Observability](#observability)) |
627
701
  | `settleDeadlineMs` | overall deadline for bounded cleanup (`archive()` 409 retries, disposal); default 15 000 |
628
702
  | `settleRetryDelayMs` | pause between `archive()` retries while the chat settles; default 1000 |
629
703
  | `chatId` | resume an existing chat |
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { FilePart, ToolSet, Agent, SystemModelMessage, ToolLoopAgentSettings, ToolChoice, StopCondition, ToolLoopAgent, UIMessage } from 'ai';
2
- import { SharedV4FileData, LanguageModelV4, LanguageModelV4CallOptions, LanguageModelV4StreamResult, LanguageModelV4GenerateResult, LanguageModelV4StreamPart, LanguageModelV4Message, LanguageModelV4Prompt, APICallError } from '@ai-sdk/provider';
2
+ import { SharedV4FileData, LanguageModelV4FinishReason, LanguageModelV4, LanguageModelV4CallOptions, LanguageModelV4StreamResult, LanguageModelV4GenerateResult, LanguageModelV4StreamPart, LanguageModelV4Message, LanguageModelV4Prompt, APICallError } from '@ai-sdk/provider';
3
3
 
4
4
  /**
5
5
  * Bytes to upload, in any convenient shape.
@@ -317,6 +317,174 @@ interface ChatWatchEvent {
317
317
  tool_calls?: ChatStreamToolCall[];
318
318
  }
319
319
 
320
+ /**
321
+ * Typed transport observability events (issue #45).
322
+ *
323
+ * A single optional `onTransportEvent` hook — on {@link CoderChatClientOptions},
324
+ * {@link CoderLanguageModelConfig}, and {@link CoderAgentSettings} — receives
325
+ * these events so consumers can build traces and timings from a stable event
326
+ * vocabulary instead of wrapping `fetch`/`webSocketFactory` and re-parsing
327
+ * every stream frame.
328
+ *
329
+ * Contract:
330
+ * - **Isolation** — exceptions thrown by a subscriber are swallowed; they can
331
+ * never alter transport behavior or a turn's outcome.
332
+ * - **Zero overhead** — without a subscriber, no event objects are allocated
333
+ * and no extra listeners are registered.
334
+ * - **No secrets** — events carry no headers and no tokens. Authentication
335
+ * travels exclusively in the `Coder-Session-Token` request header, which is
336
+ * deliberately excluded; the `path`/`url` fields never contain credentials.
337
+ * - **Observation, not interception** — events are emitted synchronously at
338
+ * observation time (`timestamp` is `Date.now()`, comparable to server-side
339
+ * timestamps such as a message's `created_at`); handlers cannot modify what
340
+ * the transport does. Payloads referenced by an event (`ws:event`'s decoded
341
+ * stream event) are shared with the pipeline — treat them as read-only.
342
+ */
343
+ interface TransportEventBase {
344
+ /** Wall-clock observation time in ms since epoch (`Date.now()`). */
345
+ timestamp: number;
346
+ }
347
+ interface HttpTransportEventBase extends TransportEventBase {
348
+ /**
349
+ * Correlates a request with its response/error. Monotonically increasing
350
+ * per client instance.
351
+ */
352
+ id: number;
353
+ /** HTTP method, e.g. `POST`. */
354
+ method: string;
355
+ /**
356
+ * Path + query relative to the client's `baseUrl`, e.g.
357
+ * `/api/experimental/chats/{id}/tool-results`. Never carries credentials.
358
+ */
359
+ path: string;
360
+ }
361
+ /** A request is about to be sent. */
362
+ interface HttpRequestTransportEvent extends HttpTransportEventBase {
363
+ type: "http:request";
364
+ }
365
+ /**
366
+ * Response headers arrived (before the body is read). Emitted for every
367
+ * completed exchange, including non-2xx responses (`ok: false`) that the
368
+ * client subsequently surfaces as a `CoderApiError`.
369
+ */
370
+ interface HttpResponseTransportEvent extends HttpTransportEventBase {
371
+ type: "http:response";
372
+ status: number;
373
+ ok: boolean;
374
+ /** Time from request start to response headers, in milliseconds. */
375
+ durationMs: number;
376
+ }
377
+ /** The fetch itself rejected (network failure, abort) — no response arrived. */
378
+ interface HttpErrorTransportEvent extends HttpTransportEventBase {
379
+ type: "http:error";
380
+ message: string;
381
+ durationMs: number;
382
+ }
383
+ interface StreamTransportEventBase extends TransportEventBase {
384
+ chatId: string;
385
+ /**
386
+ * 1-based connection attempt within one reader (`streamChatEvents` call —
387
+ * with stream retention (#44), one per turn). Increments on every redial.
388
+ */
389
+ attempt: number;
390
+ }
391
+ /** A connection attempt is starting (socket constructed). */
392
+ interface StreamDialTransportEvent extends StreamTransportEventBase {
393
+ type: "ws:dial";
394
+ /** The `wss://…/stream[?after_id=N]` URL. Never carries credentials. */
395
+ url: string;
396
+ }
397
+ /** The WebSocket handshake completed. */
398
+ interface StreamOpenTransportEvent extends StreamTransportEventBase {
399
+ type: "ws:open";
400
+ }
401
+ /**
402
+ * A decoded stream event arrived on the wire. Emitted at arrival time for
403
+ * every event in a frame batch, BEFORE replay dedup — after a redial, chatd's
404
+ * replay of the in-progress episode is visible here even though the reader
405
+ * suppresses the duplicates it forwards. `event` is the decoded object by
406
+ * reference (no copy): do not mutate it.
407
+ */
408
+ interface StreamEventTransportEvent extends StreamTransportEventBase {
409
+ type: "ws:event";
410
+ event: ChatStreamEvent;
411
+ }
412
+ /**
413
+ * The connection ended. Exactly one per dial: carries `code`/`reason` when
414
+ * the server or network closed the socket; both are absent when the reader
415
+ * tore the connection down itself (turn settled, redial teardown, abort).
416
+ */
417
+ interface StreamCloseTransportEvent extends StreamTransportEventBase {
418
+ type: "ws:close";
419
+ code?: number;
420
+ reason?: string;
421
+ }
422
+ /**
423
+ * An error was observed on the connection: a socket `error` event (including
424
+ * rejected upgrades) or an unparseable frame. The reader's own terminal
425
+ * classification still surfaces through the turn (see `segment:settle`).
426
+ */
427
+ interface StreamErrorTransportEvent extends StreamTransportEventBase {
428
+ type: "ws:error";
429
+ message: string;
430
+ }
431
+ /**
432
+ * A dropped connection is about to be redialed after `backoffMs`. Carries the
433
+ * redial budget state: the reader gives up (failing the turn) when
434
+ * `consecutiveFailures` — connection endings without forward progress —
435
+ * reaches `maxConsecutiveFailures`; any forward progress resets the count.
436
+ * `attempt` is the connection that just ended; the next dial is `attempt + 1`.
437
+ */
438
+ interface StreamRedialTransportEvent extends StreamTransportEventBase {
439
+ type: "ws:redial";
440
+ consecutiveFailures: number;
441
+ maxConsecutiveFailures: number;
442
+ backoffMs: number;
443
+ }
444
+ interface SegmentTransportEventBase extends TransportEventBase {
445
+ /** 1-based segment counter per model instance. */
446
+ segment: number;
447
+ /** Undefined on a first turn's start until the chat is created. */
448
+ chatId?: string;
449
+ }
450
+ /**
451
+ * A segment (one model round-trip: submission plus the server run until it
452
+ * settles or pauses for a client tool) started. A turn that drives client
453
+ * tools spans several segments.
454
+ */
455
+ interface SegmentStartTransportEvent extends SegmentTransportEventBase {
456
+ type: "segment:start";
457
+ }
458
+ /**
459
+ * The segment ended. Exactly one per start:
460
+ * - settled cleanly → `status` is the turn's terminal chat status and
461
+ * `finishReason` the unified AI SDK finish reason (`tool-calls` marks a
462
+ * client-tool pause; the turn continues with a resume segment);
463
+ * - failed (abort, timeout, transport failure, server error) → `error`,
464
+ * plus `status` when the server run itself still settled terminally
465
+ * (e.g. `status: "error"` streamed alongside the error);
466
+ * - torn down before settling (consumer canceled the stream) → neither.
467
+ */
468
+ interface SegmentSettleTransportEvent extends SegmentTransportEventBase {
469
+ type: "segment:settle";
470
+ status?: ChatStatus;
471
+ finishReason?: LanguageModelV4FinishReason["unified"];
472
+ error?: {
473
+ name: string;
474
+ message: string;
475
+ };
476
+ durationMs: number;
477
+ }
478
+ /** Every transport observability event, discriminated on `type`. */
479
+ type CoderTransportEvent = HttpRequestTransportEvent | HttpResponseTransportEvent | HttpErrorTransportEvent | StreamDialTransportEvent | StreamOpenTransportEvent | StreamEventTransportEvent | StreamCloseTransportEvent | StreamErrorTransportEvent | StreamRedialTransportEvent | SegmentStartTransportEvent | SegmentSettleTransportEvent;
480
+ /**
481
+ * Subscriber for {@link CoderTransportEvent}s. Exceptions are swallowed —
482
+ * including an `async` handler's rejection (a function returning a promise is
483
+ * assignable to this void-returning signature, and its rejection must not
484
+ * become an unhandled rejection either).
485
+ */
486
+ type TransportEventHandler = (event: CoderTransportEvent) => void;
487
+
320
488
  /**
321
489
  * A minimal WebSocket factory abstraction so the stream reader can run on
322
490
  * Node (via the `ws` package, with header auth) or in environments that
@@ -356,6 +524,13 @@ interface StreamChatEventsOptions {
356
524
  afterId?: number;
357
525
  signal?: AbortSignal;
358
526
  webSocketFactory?: WebSocketFactory;
527
+ /**
528
+ * Observability hook: receives the reader's `ws:*` transport events (dial,
529
+ * open, decoded events, close, error, redial). Exceptions it throws are
530
+ * swallowed; without it, no event objects are allocated and no extra socket
531
+ * listeners are registered. See {@link CoderTransportEvent}.
532
+ */
533
+ onTransportEvent?: TransportEventHandler;
359
534
  }
360
535
  /**
361
536
  * Opens the chatd `/stream` WebSocket and yields decoded {@link ChatStreamEvent}s
@@ -439,6 +614,13 @@ interface CoderChatClientOptions {
439
614
  fetch?: typeof globalThis.fetch;
440
615
  /** Custom WebSocket factory (defaults to the `ws` package on Node). */
441
616
  webSocketFactory?: WebSocketFactory;
617
+ /**
618
+ * Observability hook: receives typed transport events (HTTP request/response
619
+ * timings, per-chat stream WebSocket lifecycle). Exceptions it throws are
620
+ * swallowed; without it, no event objects are allocated. See
621
+ * {@link CoderTransportEvent}.
622
+ */
623
+ onTransportEvent?: TransportEventHandler;
442
624
  }
443
625
  /**
444
626
  * A thin, typed client for Coder's experimental `chatd` API. This is a
@@ -613,6 +795,17 @@ interface CoderAgentSettings<TOOLS extends ToolSet = {}> {
613
795
  token?: string;
614
796
  fetch?: CoderChatClientOptions["fetch"];
615
797
  webSocketFactory?: CoderChatClientOptions["webSocketFactory"];
798
+ /**
799
+ * Observability hook: receives typed transport events — HTTP request/
800
+ * response timings, the per-chat stream's WebSocket lifecycle (dial/open/
801
+ * events/close/redial), and turn-segment start/settle — so timing and
802
+ * tracing need no `fetch`/`webSocketFactory` wrapping. Exceptions it throws
803
+ * are swallowed; without it, no event objects are allocated. NOTE: when a
804
+ * pre-built `client` is supplied, its own `onTransportEvent` (set at client
805
+ * construction) emits the HTTP/WebSocket events — this setting then only
806
+ * receives the `segment:*` events. See {@link CoderTransportEvent}.
807
+ */
808
+ onTransportEvent?: TransportEventHandler;
616
809
  /** Organization UUID that owns the chat (required). */
617
810
  organizationId: string;
618
811
  /** Model hint: UUID, `provider:model`, model id, or display-name substring. */
@@ -857,6 +1050,15 @@ interface CoderLanguageModelConfig {
857
1050
  * `abortSignal: AbortSignal.timeout(ms)`. Unset or non-positive means no limit.
858
1051
  */
859
1052
  requestTimeoutMs?: number;
1053
+ /**
1054
+ * Observability hook: receives this model's `segment:*` transport events
1055
+ * (turn-segment start/settle with terminal status and timing). HTTP and
1056
+ * WebSocket events are emitted by the {@link CoderChatClient} — pass the
1057
+ * hook to its options too (CoderAgent wires both from one setting).
1058
+ * Exceptions it throws are swallowed; without it, no event objects are
1059
+ * allocated. See {@link CoderTransportEvent}.
1060
+ */
1061
+ onTransportEvent?: TransportEventHandler;
860
1062
  }
861
1063
  /**
862
1064
  * A {@link LanguageModelV4} that is backed by a remote Coder `chatd` agent
@@ -873,6 +1075,15 @@ interface CoderLanguageModelConfig {
873
1075
  *
874
1076
  * NOTE: a single model instance is single-flight — do not run concurrent
875
1077
  * generations against the same instance/session.
1078
+ *
1079
+ * The session retains ONE event stream per turn (issue #44): a segment that
1080
+ * pauses for client tools leaves the WebSocket open, and the tool-result
1081
+ * resume segment keeps reading it — no re-dial per tool round trip. The
1082
+ * socket closes when its segment ends any other way (terminal settle, error,
1083
+ * abort, timeout), when the next turn replaces it, or on session teardown
1084
+ * (`resetSession()` / `[Symbol.asyncDispose]()`). A turn that pauses for
1085
+ * client tools but never resumes leaves the socket open until teardown, so
1086
+ * dispose or reset sessions you abandon mid-turn.
876
1087
  */
877
1088
  declare class CoderLanguageModel implements LanguageModelV4 {
878
1089
  #private;
@@ -882,8 +1093,32 @@ declare class CoderLanguageModel implements LanguageModelV4 {
882
1093
  readonly supportedUrls: Record<string, RegExp[]>;
883
1094
  constructor(config: CoderLanguageModelConfig);
884
1095
  get chatId(): string | undefined;
885
- /** Drops the current session so the next turn creates a fresh chat. */
1096
+ /**
1097
+ * Drops the current session so the next turn creates a fresh chat. Also
1098
+ * closes the retained event stream, if any (fire-and-forget — a sync reset
1099
+ * must not wait on socket teardown, and `close()` never rejects).
1100
+ */
886
1101
  resetSession(): void;
1102
+ /**
1103
+ * Closes the retained event stream, if any. The stream otherwise closes
1104
+ * when its turn settles or fails, or when the next turn replaces it — but a
1105
+ * turn that pauses for client tools and never resumes (e.g. the caller
1106
+ * stopped the tool loop, or aborted between segments) leaves the socket
1107
+ * open, so dispose (`await using`) or {@link resetSession} sessions you
1108
+ * abandon mid-turn.
1109
+ */
1110
+ [Symbol.asyncDispose](): Promise<void>;
1111
+ /**
1112
+ * Closes a stream retained by a client-tool pause. Called on explicit
1113
+ * interrupts ({@link CoderAgent.interrupt}): an interrupted pause is dead —
1114
+ * its buffer would otherwise collect the interrupt's own settle events,
1115
+ * which a later tool-result resume would consume as if they were the
1116
+ * resumed generation's (truncating the turn), and if the tool loop never
1117
+ * resumes the socket would outlive the explicit interrupt. A stream a
1118
+ * segment is actively reading is left alone: that segment observes the
1119
+ * settle the interrupt produces and closes the stream itself.
1120
+ */
1121
+ closePausedStream(): Promise<void>;
887
1122
  doStream(options: LanguageModelV4CallOptions): Promise<LanguageModelV4StreamResult>;
888
1123
  doGenerate(options: LanguageModelV4CallOptions): Promise<LanguageModelV4GenerateResult>;
889
1124
  }
@@ -911,6 +1146,15 @@ declare class TurnTranslator {
911
1146
  constructor(opts: {
912
1147
  dynamicToolNames: ReadonlySet<string>;
913
1148
  turnCursor?: number;
1149
+ /**
1150
+ * Tool-call ids whose results the session already submitted. With the
1151
+ * stream retained across segments (and redialed with the turn's original
1152
+ * cursor), a reconnect can replay a previous segment's `action_required`
1153
+ * snapshot; re-emitting an already-answered call would make the AI SDK
1154
+ * execute the tool a second time. A live reference — the set grows as
1155
+ * later segments submit results.
1156
+ */
1157
+ submittedToolCallIds?: ReadonlySet<string>;
914
1158
  });
915
1159
  get terminalStatus(): ChatStatus | undefined;
916
1160
  /** Whether a client (custom) tool call has been emitted this turn. */
@@ -1075,4 +1319,4 @@ declare class CoderChatError extends CoderAgentError {
1075
1319
  constructor(payload: ChatErrorPayload);
1076
1320
  }
1077
1321
 
1078
- export { CHAT_ATTACHMENT_MEDIA_TYPES, CODER_PROVIDER_OPTIONS, type Chat, type ChatAttachment, type ChatAttachmentMediaType, type ChatBusyBehavior, type ChatClientType, type ChatErrorPayload, type ChatFileInput, type ChatInputPart, type ChatInputPartType, type ChatMessage, type ChatMessagePart, type ChatMessagePartType, type ChatMessageRole, type ChatMessageUsage, type ChatMessagesResponse, type ChatMessagesToUIMessagesOptions, type ChatModelConfig, type ChatPlanMode, type ChatQueuedMessage, type ChatStatus, type ChatStreamActionRequired, type ChatStreamEvent, type ChatStreamEventType, type ChatStreamMessagePart, type ChatStreamRetry, type ChatStreamStatus, type ChatStreamToolCall, type ChatWatchEvent, type ChatWatchEventKind, CoderAgent, CoderAgentError, type CoderAgentSettings, CoderApiError, CoderChatClient, type CoderChatClientOptions, CoderChatError, type CoderFileProviderOptions, CoderLanguageModel, type CoderLanguageModelConfig, CoderStreamError, type CreateChatMessageRequest, type CreateChatMessageResponse, type CreateChatRequest, type DynamicTool, type FileContent, type FilePartUploader, MAX_CHAT_FILE_SIZE_BYTES, type PreviewShareLevel, type ResolvedFile, type SharePreviewOptions, type SharedWorkspacePreview, type SubmitToolResultsRequest, TERMINAL_STATUSES, type ToolResult, type TurnAction, TurnTranslator, type UpdateChatRequest, type UploadChatFileResponse, type UploadedChatFile, type UserContent, type WatchChatEventsOptions, type WebSocketFactory, type WebSocketLike, type WorkspaceFileStore, type WorkspacePlacement, type WorkspacePreview, type WorkspacePreviewOptions, chatMessagesToUIMessages, classifyTurnAction, dataContentToFileContent, dynamicToolNames, extractSystemPrompt, resolveFileContent, streamChatEvents, toolsToDynamicTools, userContentToInputParts, watchChatEvents };
1322
+ export { CHAT_ATTACHMENT_MEDIA_TYPES, CODER_PROVIDER_OPTIONS, type Chat, type ChatAttachment, type ChatAttachmentMediaType, type ChatBusyBehavior, type ChatClientType, type ChatErrorPayload, type ChatFileInput, type ChatInputPart, type ChatInputPartType, type ChatMessage, type ChatMessagePart, type ChatMessagePartType, type ChatMessageRole, type ChatMessageUsage, type ChatMessagesResponse, type ChatMessagesToUIMessagesOptions, type ChatModelConfig, type ChatPlanMode, type ChatQueuedMessage, type ChatStatus, type ChatStreamActionRequired, type ChatStreamEvent, type ChatStreamEventType, type ChatStreamMessagePart, type ChatStreamRetry, type ChatStreamStatus, type ChatStreamToolCall, type ChatWatchEvent, type ChatWatchEventKind, CoderAgent, CoderAgentError, type CoderAgentSettings, CoderApiError, CoderChatClient, type CoderChatClientOptions, CoderChatError, type CoderFileProviderOptions, CoderLanguageModel, type CoderLanguageModelConfig, CoderStreamError, type CoderTransportEvent, type CreateChatMessageRequest, type CreateChatMessageResponse, type CreateChatRequest, type DynamicTool, type FileContent, type FilePartUploader, type HttpErrorTransportEvent, type HttpRequestTransportEvent, type HttpResponseTransportEvent, MAX_CHAT_FILE_SIZE_BYTES, type PreviewShareLevel, type ResolvedFile, type SegmentSettleTransportEvent, type SegmentStartTransportEvent, type SharePreviewOptions, type SharedWorkspacePreview, type StreamCloseTransportEvent, type StreamDialTransportEvent, type StreamErrorTransportEvent, type StreamEventTransportEvent, type StreamOpenTransportEvent, type StreamRedialTransportEvent, type SubmitToolResultsRequest, TERMINAL_STATUSES, type ToolResult, type TransportEventHandler, type TurnAction, TurnTranslator, type UpdateChatRequest, type UploadChatFileResponse, type UploadedChatFile, type UserContent, type WatchChatEventsOptions, type WebSocketFactory, type WebSocketLike, type WorkspaceFileStore, type WorkspacePlacement, type WorkspacePreview, type WorkspacePreviewOptions, chatMessagesToUIMessages, classifyTurnAction, dataContentToFileContent, dynamicToolNames, extractSystemPrompt, resolveFileContent, streamChatEvents, toolsToDynamicTools, userContentToInputParts, watchChatEvents };