@codelia/core 0.1.83 → 0.1.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/dist/index.cjs +3461 -2382
  2. package/dist/index.d.ts +295 -154
  3. package/dist/index.js +3452 -2380
  4. package/package.json +4 -3
package/dist/index.d.ts CHANGED
@@ -1,51 +1,17 @@
1
1
  import * as _codelia_shared_types from '@codelia/shared-types';
2
- import { LlmCallTiming, ProviderName, ModelFastMode, AgentEvent, SessionStateSummary as SessionStateSummary$1, ModelReasoningLevel } from '@codelia/shared-types';
3
- export { AgentEvent, FinalResponseEvent, LlmRetryEvent, LlmStatusEvent, ReasoningEvent, StepCompleteEvent, StepStartEvent, TextEvent, ToolCallEvent, ToolResultEvent } from '@codelia/shared-types';
2
+ import { ContentPart, TextPart, LlmCallTiming, ProviderName, ImagePart, ModelFastMode, AgentEvent, RunErrorInfo, SessionStateSummary as SessionStateSummary$1, ContextUsage, ModelReasoningLevel } from '@codelia/shared-types';
3
+ export { AgentEvent, AttachmentRefPart, ContentPart, FinalResponseEvent, HiddenUserMessageEvent, LlmRetryEvent, LlmStatusEvent, ReasoningDeltaEvent, ReasoningEvent, SteerAppliedEvent, StepCompleteEvent, StepStartEvent, TextDeltaEvent, TextEvent, ToolCallEvent, ToolResultEvent } from '@codelia/shared-types';
4
4
  import { JSONSchema7 } from 'json-schema';
5
5
  import { ZodSchema } from 'zod';
6
6
  import { Logger } from 'openai/client';
7
7
  import Anthropic from '@anthropic-ai/sdk';
8
8
  import { MessageCreateParamsNonStreaming, OutputConfig } from '@anthropic-ai/sdk/resources/messages/messages';
9
+ import { ResponsesProviderConfig } from '@codelia/config';
10
+ import { ResponseCreateParamsBase, ResponsesClientEvent, ResponseTextConfig } from 'openai/resources/responses/responses';
11
+ import { GoogleGenAI } from '@google/genai';
9
12
  import OpenAI, { ClientOptions } from 'openai';
10
- import { ResponsesClientEvent, ResponseCreateParamsBase, ResponseTextConfig } from 'openai/resources/responses/responses';
11
13
  import { ResponsesWS } from 'openai/resources/responses/ws';
12
14
  import { ReasoningEffort } from 'openai/resources/shared';
13
- import { ResponsesProviderConfig } from '@codelia/config';
14
-
15
- /**
16
- * Message Content Parts
17
- */
18
- type ImageRefPart = {
19
- type: "image_ref";
20
- image_ref: _codelia_shared_types.ImageArtifactRef;
21
- detail?: "auto" | "low" | "high";
22
- };
23
- type TextPart = {
24
- type: "text";
25
- text: string;
26
- };
27
- type ImagePart = {
28
- type: "image_url";
29
- image_url: {
30
- url: string;
31
- detail?: "auto" | "low" | "high";
32
- media_type?: "image/png" | "image/jpeg" | "image/webp" | "image/gif";
33
- };
34
- };
35
- type DocumentPart = {
36
- type: "document";
37
- source: {
38
- data: string;
39
- media_type: "application/pdf";
40
- };
41
- };
42
- type OtherPart = {
43
- type: "other";
44
- provider: string;
45
- kind: string;
46
- payload: unknown;
47
- };
48
- type ContentPart = TextPart | ImagePart | ImageRefPart | DocumentPart | OtherPart;
49
15
 
50
16
  /**
51
17
  * Tool Call
@@ -154,6 +120,7 @@ type ToolMessage = {
154
120
  tool_call_id: string;
155
121
  tool_name: string;
156
122
  content: string | ContentPart[];
123
+ display_content?: string;
157
124
  is_error?: boolean;
158
125
  output_ref?: ToolOutputRef;
159
126
  trimmed?: boolean;
@@ -179,6 +146,114 @@ type ChatInvokeCompletion = {
179
146
  provider_meta?: unknown;
180
147
  };
181
148
 
149
+ type ProviderFailureKind = "rate_limit" | "overloaded" | "timeout" | "network" | "hard_quota" | "auth" | "permission" | "validation" | "provider" | "cancelled";
150
+ type RetryDelaySource = "retry-after" | "reset-header" | "provider-body" | "backoff";
151
+ type ProviderFailure = {
152
+ provider: ProviderName;
153
+ kind: ProviderFailureKind;
154
+ retryable: boolean;
155
+ safeMessage: string;
156
+ /** Explicit safe context only, never a raw provider message. */
157
+ detail?: string;
158
+ status?: number;
159
+ code?: string;
160
+ retryAfterMs?: number;
161
+ delaySource?: Exclude<RetryDelaySource, "backoff">;
162
+ delivery?: "none" | "buffered" | "committed";
163
+ };
164
+ type ProviderFailureClassifier = (error: unknown) => ProviderFailure | null;
165
+ declare class ProviderFailureError extends Error {
166
+ readonly failure: ProviderFailure;
167
+ readonly attempts: number;
168
+ readonly maxAttempts: number;
169
+ constructor(failure: ProviderFailure, options?: {
170
+ attempts?: number;
171
+ maxAttempts?: number;
172
+ cause?: unknown;
173
+ });
174
+ }
175
+ declare const isProviderFailureError: (error: unknown) => error is ProviderFailureError;
176
+
177
+ type ImageTokenInput = {
178
+ width?: number;
179
+ height?: number;
180
+ detail?: "auto" | "low" | "high";
181
+ };
182
+ type ImageTokenEstimate = {
183
+ tokens: number;
184
+ method: "patch" | "tile" | "fallback";
185
+ };
186
+
187
+ type LlmRetryPolicy = {
188
+ maxRetries: number;
189
+ baseDelayMs: number;
190
+ maxDelayMs: number;
191
+ maxRetryAfterMs: number;
192
+ retryWindowMs: number;
193
+ };
194
+
195
+ /**
196
+ * One provisional chunk of streamed model output. `index` numbers the streamed
197
+ * blocks of one kind in this response, in order of their first delta. It is a
198
+ * grouping key for provisional display, not a position in the completion.
199
+ */
200
+ type ChatStreamDelta = {
201
+ kind: "text" | "reasoning";
202
+ index: number;
203
+ delta: string;
204
+ };
205
+ /** Per-attempt sink for streamed deltas. Providers that do not stream ignore it. */
206
+ type ChatStreamDeltaSink = (delta: ChatStreamDelta) => void;
207
+ type ChatInvokeInput = {
208
+ messages: BaseMessage[];
209
+ model?: string;
210
+ tools?: ToolDefinition[] | null;
211
+ toolChoice?: ToolChoice | null;
212
+ signal?: AbortSignal;
213
+ /** Optional, per-attempt. Absent means providers keep their non-delta path unchanged. */
214
+ onDelta?: ChatStreamDeltaSink;
215
+ };
216
+ type ChatInvokeContext = {
217
+ sessionKey?: string;
218
+ /** One user turn; distinct from a durable session key. */
219
+ turnKey?: string;
220
+ onProviderStatus?: (event: _codelia_shared_types.LlmStatusEvent) => void;
221
+ };
222
+ interface BaseChatModel<P extends ProviderName = ProviderName, O = unknown> {
223
+ readonly provider: P;
224
+ readonly model: string;
225
+ ainvoke(input: ChatInvokeInput & {
226
+ options?: O;
227
+ }, context?: ChatInvokeContext): Promise<ChatInvokeCompletion>;
228
+ classifyFailure?: ProviderFailureClassifier;
229
+ /** Endpoint-owned retry policy takes precedence over Agent defaults. */
230
+ readonly retryPolicy?: Partial<LlmRetryPolicy>;
231
+ /** Optional model-specific vision estimate; never a billing usage report. */
232
+ estimateImageTokens?(image: ImageTokenInput): ImageTokenEstimate;
233
+ onHistoryCompacted?(context?: ChatInvokeContext): void | Promise<void>;
234
+ }
235
+
236
+ declare const responseDetails: {
237
+ readonly invalid_event: "The response stream contained an invalid event.";
238
+ readonly invalid_completion: "The provider returned an incomplete or invalid completion record.";
239
+ readonly after_completion: "The provider emitted output after completion.";
240
+ readonly invalid_step_index: "The response stream contained an invalid step index.";
241
+ readonly invalid_step: "The response contained a duplicate or invalid step.";
242
+ readonly out_of_order: "The response stream contained an out-of-order step.";
243
+ readonly invalid_tool_arguments: "The response contained incomplete or invalid tool arguments.";
244
+ readonly unsupported_event: "The response stream contained an unsupported event type.";
245
+ readonly invalid_delta: "The response contained an invalid output delta.";
246
+ readonly unsupported_content: "The response contained unsupported content.";
247
+ readonly unsupported_delta: "The response contained an unsupported output delta type.";
248
+ readonly incomplete: "The response stream ended before completion.";
249
+ readonly missing_step: "The response stream omitted a required step.";
250
+ readonly invalid_output: "The response contained invalid model output.";
251
+ readonly nonterminal: "The provider response did not complete in a valid terminal state.";
252
+ readonly empty: "The provider returned no model output.";
253
+ };
254
+ /** Explicitly trusted local diagnostics; never accept a provider message/body here. */
255
+ declare const createProviderResponseError: (provider: ProviderName, reason: keyof typeof responseDetails) => ProviderFailureError;
256
+
182
257
  type ToolOutputCacheRecord = {
183
258
  tool_call_id: string;
184
259
  tool_name: string;
@@ -224,6 +299,8 @@ type ModelLimits = {
224
299
  };
225
300
  type ModelCapabilities = {
226
301
  supportsFast?: boolean;
302
+ supportsVision?: boolean;
303
+ supportsTools?: boolean;
227
304
  };
228
305
  type ModelEntry = {
229
306
  provider: string;
@@ -243,8 +320,11 @@ interface ModelMetadataService {
243
320
  getAllModelEntries(): Promise<Record<string, Record<string, ModelEntry>>>;
244
321
  }
245
322
 
323
+ type ResolveImage = (ref: _codelia_shared_types.ImageArtifactRef, signal?: AbortSignal) => Promise<ImagePart>;
246
324
  type AgentServices = {
247
- resolveImage?: (ref: _codelia_shared_types.ImageArtifactRef, signal?: AbortSignal) => Promise<ImagePart>;
325
+ resolveImage?: ResolveImage;
326
+ /** Undefined shares the existing image store. Null disables copied-image resolution. */
327
+ resolveAttachmentImage?: ResolveImage | null;
248
328
  modelMetadata?: ModelMetadataService;
249
329
  toolOutputCacheStore?: ToolOutputCacheStore | null;
250
330
  monotonicNowMs?: () => number;
@@ -253,77 +333,6 @@ type AgentServices = {
253
333
  llmRetrySleep?: (delayMs: number, signal?: AbortSignal) => Promise<void>;
254
334
  };
255
335
 
256
- type ProviderFailureKind = "rate_limit" | "overloaded" | "timeout" | "network" | "hard_quota" | "auth" | "permission" | "validation" | "provider" | "cancelled";
257
- type RetryDelaySource = "retry-after" | "reset-header" | "provider-body" | "backoff";
258
- type ProviderFailure = {
259
- provider: ProviderName;
260
- kind: ProviderFailureKind;
261
- retryable: boolean;
262
- safeMessage: string;
263
- status?: number;
264
- code?: string;
265
- retryAfterMs?: number;
266
- delaySource?: Exclude<RetryDelaySource, "backoff">;
267
- delivery?: "none" | "buffered" | "committed";
268
- };
269
- type ProviderFailureClassifier = (error: unknown) => ProviderFailure | null;
270
- declare class ProviderFailureError extends Error {
271
- readonly failure: ProviderFailure;
272
- readonly attempts: number;
273
- readonly maxAttempts: number;
274
- constructor(failure: ProviderFailure, options?: {
275
- attempts?: number;
276
- maxAttempts?: number;
277
- cause?: unknown;
278
- });
279
- }
280
- declare const isProviderFailureError: (error: unknown) => error is ProviderFailureError;
281
-
282
- type LlmRetryPolicy = {
283
- maxRetries: number;
284
- baseDelayMs: number;
285
- maxDelayMs: number;
286
- maxRetryAfterMs: number;
287
- retryWindowMs: number;
288
- };
289
-
290
- type ImageTokenInput = {
291
- width?: number;
292
- height?: number;
293
- detail?: "auto" | "low" | "high";
294
- };
295
- type ImageTokenEstimate = {
296
- tokens: number;
297
- method: "patch" | "tile" | "fallback";
298
- };
299
-
300
- type ChatInvokeInput = {
301
- messages: BaseMessage[];
302
- model?: string;
303
- tools?: ToolDefinition[] | null;
304
- toolChoice?: ToolChoice | null;
305
- signal?: AbortSignal;
306
- };
307
- type ChatInvokeContext = {
308
- sessionKey?: string;
309
- /** One user turn; distinct from a durable session key. */
310
- turnKey?: string;
311
- onProviderStatus?: (event: _codelia_shared_types.LlmStatusEvent) => void;
312
- };
313
- interface BaseChatModel<P extends ProviderName = ProviderName, O = unknown> {
314
- readonly provider: P;
315
- readonly model: string;
316
- ainvoke(input: ChatInvokeInput & {
317
- options?: O;
318
- }, context?: ChatInvokeContext): Promise<ChatInvokeCompletion>;
319
- classifyFailure?: ProviderFailureClassifier;
320
- /** Endpoint-owned retry policy takes precedence over Agent defaults. */
321
- readonly retryPolicy?: Partial<LlmRetryPolicy>;
322
- /** Optional model-specific vision estimate; never a billing usage report. */
323
- estimateImageTokens?(image: ImageTokenInput): ImageTokenEstimate;
324
- onHistoryCompacted?(context?: ChatInvokeContext): void | Promise<void>;
325
- }
326
-
327
336
  type ModelSpec = {
328
337
  id: string;
329
338
  provider: ProviderName;
@@ -424,12 +433,15 @@ type ToolContext = {
424
433
  type DefineToolOptions<TInput, TResult extends ToolReturn = ToolReturn> = {
425
434
  name: string;
426
435
  description: string;
436
+ /** Optional transcript/diagnostic substitute for sensitive model-facing results. */
437
+ displayResult?: string;
427
438
  input: ZodSchema<TInput>;
428
439
  execute: (input: TInput, ctx: ToolContext) => Promise<TResult> | TResult;
429
440
  };
430
441
  type Tool = {
431
442
  name: string;
432
443
  description: string;
444
+ displayResult?: string;
433
445
  definition: ToolDefinition;
434
446
  executeRaw: (rawArgsJson: string, ctx: ToolContext) => Promise<ToolResult>;
435
447
  };
@@ -562,6 +574,16 @@ type LlmResponseRecord = {
562
574
  };
563
575
  meta?: Record<string, unknown>;
564
576
  };
577
+ /** Compact accounting only; never includes messages or opaque provider payloads. */
578
+ type LlmUsageRecord = {
579
+ type: "llm.usage";
580
+ run_id: string;
581
+ session_id?: string;
582
+ ts: string;
583
+ seq: number;
584
+ model?: LlmRequestRecord["model"];
585
+ output: Pick<LlmResponseRecord["output"], "usage" | "timing" | "stop_reason">;
586
+ };
565
587
  type RunStatusRecord = {
566
588
  type: "run.status";
567
589
  run_id: string;
@@ -574,16 +596,9 @@ type RunErrorRecord = {
574
596
  type: "run.error";
575
597
  run_id: string;
576
598
  ts: string;
577
- error: {
578
- name: string;
579
- message: string;
599
+ error: RunErrorInfo & {
580
600
  stack?: string;
581
- provider?: ProviderName;
582
601
  kind?: ProviderFailureKind;
583
- status?: number;
584
- code?: string;
585
- attempts?: number;
586
- max_attempts?: number;
587
602
  };
588
603
  meta?: Record<string, unknown>;
589
604
  };
@@ -595,7 +610,7 @@ type RunEndRecord = {
595
610
  final?: string;
596
611
  meta?: Record<string, unknown>;
597
612
  };
598
- type SessionRecord = SessionHeader | RunStartRecord | RunContextRecord | AgentEventRecord | ToolOutputRecord | LlmRequestRecord | LlmResponseRecord | RunStatusRecord | RunErrorRecord | RunEndRecord;
613
+ type SessionRecord = SessionHeader | RunStartRecord | RunContextRecord | AgentEventRecord | ToolOutputRecord | LlmRequestRecord | LlmResponseRecord | LlmUsageRecord | RunStatusRecord | RunErrorRecord | RunEndRecord;
599
614
  type SessionStore = {
600
615
  filePath?: string;
601
616
  append: (record: SessionRecord) => Promise<void> | void;
@@ -617,10 +632,36 @@ type SessionState = {
617
632
  meta?: Record<string, unknown>;
618
633
  };
619
634
  type SessionStateSummary = SessionStateSummary$1;
635
+ type ConversationMessage = {
636
+ id: string;
637
+ role: BaseMessage["role"];
638
+ text: string;
639
+ truncated: boolean;
640
+ next_offset?: number;
641
+ };
642
+ type ConversationSearchResult = {
643
+ matches: ConversationMessage[];
644
+ next_cursor?: string;
645
+ };
620
646
  type SessionStateStore = {
621
647
  load: (sessionId: string) => Promise<SessionState | null>;
622
648
  save: (state: SessionState) => Promise<void>;
623
649
  list: () => Promise<SessionStateSummary[]>;
650
+ appendMessages?: (sessionId: string, messages: BaseMessage[]) => Promise<void>;
651
+ searchMessages?: (sessionId: string, options: {
652
+ query: string;
653
+ cursor?: string;
654
+ limit?: number;
655
+ }) => Promise<ConversationSearchResult>;
656
+ readMessage?: (sessionId: string, options: {
657
+ id: string;
658
+ offset?: number;
659
+ limit?: number;
660
+ }) => Promise<ConversationMessage | null>;
661
+ updateMetadata?: (sessionId: string, patch: {
662
+ pinned?: boolean;
663
+ archived?: boolean;
664
+ }) => Promise<SessionStateSummary>;
624
665
  };
625
666
  type AgentSession = {
626
667
  run_id: string;
@@ -628,16 +669,28 @@ type AgentSession = {
628
669
  invoke_seq?: number;
629
670
  on_error?: (error: unknown, record: SessionRecord) => void;
630
671
  append: (record: SessionRecord) => void;
672
+ /** Await durable originals before admitting messages or discarding context. */
673
+ recordMessages?: (messages: BaseMessage[]) => Promise<void>;
631
674
  };
632
675
 
676
+ type PolledMessage = string | {
677
+ kind: "hidden" | "steer";
678
+ content: string | ContentPart[];
679
+ steer_id?: string;
680
+ };
633
681
  type AgentRunOptions = {
634
682
  /** Untrusted messages polled only between model/tool batches; never starts a nested run. */
635
- pollMessages?: () => Promise<string[]>;
683
+ pollMessages?: () => Promise<PolledMessage[]>;
636
684
  session?: AgentSession;
637
685
  signal?: AbortSignal;
638
686
  forceCompaction?: boolean;
639
687
  tools?: Tool[];
640
688
  toolChoice?: ToolChoice;
689
+ /**
690
+ * Opt-in: also yield provisional `text.delta` / `reasoning.delta` events while a
691
+ * model step streams. Complete `text` / `reasoning` / `final` events are unchanged.
692
+ */
693
+ streamDeltas?: boolean;
641
694
  };
642
695
  type AgentOptions = {
643
696
  llm: BaseChatModel;
@@ -677,11 +730,18 @@ declare class Agent {
677
730
  private readonly llmRetryDependencies;
678
731
  private history;
679
732
  private usageService;
733
+ /** Tool definitions of the latest model call (includes per-run client tools). */
734
+ private lastToolDefinitions;
680
735
  private imageUsageBaseline?;
681
736
  constructor(options: AgentOptions);
682
737
  getUsageSummary(): UsageSummary;
683
738
  getContextLeftPercent(): number | null;
739
+ /** Last provider-reported usage; a new object per completed model call. */
740
+ getLastUsage(): ChatInvokeUsage | null;
741
+ /** Context window usage with an estimated per-category breakdown. */
742
+ getContextUsage(): ContextUsage;
684
743
  getHistoryMessages(): BaseMessage[];
744
+ private recordOriginals;
685
745
  replaceHistoryMessages(messages: BaseMessage[]): void;
686
746
  private checkAndCompact;
687
747
  private trimToolOutputs;
@@ -692,6 +752,8 @@ declare class Agent {
692
752
  private recordLlmResponse;
693
753
  private invokeModelWithRetry;
694
754
  run(message: string | ContentPart[], options?: AgentRunOptions): Promise<string>;
755
+ canUseVisualAttachments(): boolean;
756
+ private get attachmentImageResolver();
695
757
  runStream(message: string | ContentPart[], options?: AgentRunOptions): AsyncGenerator<AgentEvent>;
696
758
  private generateFinalResponse;
697
759
  }
@@ -769,6 +831,87 @@ declare class ChatAnthropic implements BaseChatModel<typeof PROVIDER_NAME$5, Ant
769
831
  private debugResponseIfEnabled;
770
832
  }
771
833
 
834
+ type ResponsesInvokeOptions = {
835
+ reasoningEffort?: ModelReasoningLevel;
836
+ maxOutputTokens?: number;
837
+ text?: ResponseCreateParamsBase["text"];
838
+ };
839
+ /** Stateless HTTP Responses transport, independently named and authenticated. */
840
+ declare class ChatResponses implements BaseChatModel<string, ResponsesInvokeOptions> {
841
+ readonly provider: string;
842
+ readonly model: string;
843
+ readonly retryPolicy: {
844
+ baseDelayMs?: number | undefined;
845
+ maxRetries: number;
846
+ };
847
+ private readonly client;
848
+ private readonly endpoint;
849
+ private readonly reasoningEffort?;
850
+ private readonly textVerbosity?;
851
+ constructor(options: {
852
+ provider: string;
853
+ model: string;
854
+ endpoint: ResponsesProviderConfig;
855
+ apiKey: string;
856
+ reasoningEffort?: ModelReasoningLevel;
857
+ textVerbosity?: "low" | "medium" | "high";
858
+ fetch?: typeof fetch;
859
+ });
860
+ readonly classifyFailure: (error: unknown) => ProviderFailure;
861
+ ainvoke(input: ChatInvokeInput & {
862
+ options?: ResponsesInvokeOptions;
863
+ }, context?: ChatInvokeContext): Promise<ChatInvokeCompletion>;
864
+ }
865
+
866
+ /** Official stateless Responses endpoint with independent API-key authentication. */
867
+ declare class ChatDeepSeek implements BaseChatModel<"deepseek", ResponsesInvokeOptions> {
868
+ readonly provider: "deepseek";
869
+ readonly model: string;
870
+ readonly retryPolicy: {
871
+ baseDelayMs?: number | undefined;
872
+ maxRetries: number;
873
+ };
874
+ private readonly transport;
875
+ private readonly requestedEffort;
876
+ constructor(options: {
877
+ apiKey: string;
878
+ model?: string;
879
+ reasoningEffort?: ModelReasoningLevel;
880
+ fetch?: typeof fetch;
881
+ });
882
+ readonly classifyFailure: (error: unknown) => ProviderFailure;
883
+ ainvoke(input: ChatInvokeInput & {
884
+ options?: ResponsesInvokeOptions;
885
+ }, context?: ChatInvokeContext): Promise<{
886
+ provider_meta: {
887
+ reasoning_requested: "low" | "high" | "medium" | "xhigh" | "max";
888
+ reasoning_applied: "low" | "high" | "max";
889
+ reasoning_effort: "low" | "high" | "max";
890
+ reasoning_fallback: boolean;
891
+ };
892
+ usage?: ChatInvokeUsage | null;
893
+ messages: BaseMessage[];
894
+ timing?: _codelia_shared_types.LlmCallTiming;
895
+ stop_reason?: string | null;
896
+ }>;
897
+ }
898
+
899
+ type ChatGoogleOptions = {
900
+ apiKey: string;
901
+ model?: string;
902
+ thinkingLevel?: "low" | "medium" | "high" | "xhigh";
903
+ client?: GoogleGenAI;
904
+ };
905
+ declare class ChatGoogle implements BaseChatModel<"google"> {
906
+ readonly provider: "google";
907
+ readonly classifyFailure: (error: unknown) => ProviderFailure;
908
+ readonly model: string;
909
+ private readonly client;
910
+ private readonly thinkingLevel?;
911
+ constructor(options: ChatGoogleOptions);
912
+ ainvoke(input: ChatInvokeInput): Promise<ChatInvokeCompletion>;
913
+ }
914
+
772
915
  declare const PROVIDER_NAME$4: "moonshot";
773
916
  type MoonshotInvokeOptions = {
774
917
  max_completion_tokens?: number;
@@ -1013,6 +1156,36 @@ declare class ChatZai implements BaseChatModel<typeof PROVIDER_NAME, ZaiInvokeOp
1013
1156
  declare const ANTHROPIC_DEFAULT_MODEL = "claude-sonnet-4-5";
1014
1157
  declare const ANTHROPIC_MODELS: ModelSpec[];
1015
1158
 
1159
+ declare const DEEPSEEK_DEFAULT_MODEL = "deepseek-flash";
1160
+ declare const DEEPSEEK_MODELS: ({
1161
+ id: string;
1162
+ provider: string;
1163
+ aliases: string[];
1164
+ contextWindow: number;
1165
+ maxInputTokens: number;
1166
+ maxOutputTokens: number;
1167
+ supportsTools: true;
1168
+ supportsReasoning: true;
1169
+ supportsJsonSchema: true;
1170
+ supportsVision: true;
1171
+ supportsFast: false;
1172
+ } | {
1173
+ id: string;
1174
+ provider: string;
1175
+ contextWindow: number;
1176
+ maxInputTokens: number;
1177
+ maxOutputTokens: number;
1178
+ supportsTools: true;
1179
+ supportsReasoning: true;
1180
+ supportsJsonSchema: true;
1181
+ supportsVision: false;
1182
+ supportsFast: false;
1183
+ aliases?: undefined;
1184
+ })[];
1185
+ /** DeepSeek documents medium/xhigh as aliases of high. */
1186
+ declare const resolveDeepSeekEffort: (requested: ModelReasoningLevel) => "low" | "high" | "max";
1187
+
1188
+ declare const GOOGLE_DEFAULT_MODEL = "gemini-3.8-flash";
1016
1189
  declare const GOOGLE_MODELS: ModelSpec[];
1017
1190
 
1018
1191
  declare const MOONSHOT_DEFAULT_MODEL = "kimi-k3";
@@ -1042,36 +1215,4 @@ declare class TaskComplete extends Error {
1042
1215
  constructor(finalMessage?: string);
1043
1216
  }
1044
1217
 
1045
- type ResponsesInvokeOptions = {
1046
- reasoningEffort?: ModelReasoningLevel;
1047
- maxOutputTokens?: number;
1048
- text?: ResponseCreateParamsBase["text"];
1049
- };
1050
- /** Stateless HTTP Responses transport, independently named and authenticated. */
1051
- declare class ChatResponses implements BaseChatModel<string, ResponsesInvokeOptions> {
1052
- readonly provider: string;
1053
- readonly model: string;
1054
- readonly retryPolicy: {
1055
- baseDelayMs?: number | undefined;
1056
- maxRetries: number;
1057
- };
1058
- private readonly client;
1059
- private readonly endpoint;
1060
- private readonly reasoningEffort?;
1061
- private readonly textVerbosity?;
1062
- constructor(options: {
1063
- provider: string;
1064
- model: string;
1065
- endpoint: ResponsesProviderConfig;
1066
- apiKey: string;
1067
- reasoningEffort?: ModelReasoningLevel;
1068
- textVerbosity?: "low" | "medium" | "high";
1069
- fetch?: typeof fetch;
1070
- });
1071
- readonly classifyFailure: (error: unknown) => ProviderFailure;
1072
- ainvoke(input: ChatInvokeInput & {
1073
- options?: ResponsesInvokeOptions;
1074
- }, context?: ChatInvokeContext): Promise<ChatInvokeCompletion>;
1075
- }
1076
-
1077
- export { ANTHROPIC_DEFAULT_MODEL, ANTHROPIC_MODELS, Agent, type AgentEventRecord, type AgentOptions, type AgentRunOptions, type AgentServices, type AgentSession, type BaseChatModel, type BaseMessage, ChatAnthropic, type ChatInvokeContext, type ChatInvokeInput, ChatMoonshot, ChatOpenAI, ChatOpenRouter, ChatResponses, ChatXai, ChatZai, type ContentPart, DEFAULT_MODEL_REGISTRY, type DependencyKey, GOOGLE_MODELS, type ImageTokenEstimate, type ImageTokenInput, type LlmRequestRecord, type LlmResponseRecord, MOONSHOT_DEFAULT_MODEL, MOONSHOT_K3_1_MODELS, MOONSHOT_MODELS, type ModelCapabilities, type ModelCost, type ModelEntry, type ModelLimits, type ModelMetadataIndex, type ModelMetadataService, type ModelRegistry, type ModelSpec, OPENAI_DEFAULT_MODEL, OPENAI_DEFAULT_REASONING_EFFORT, OPENAI_MODELS, type ProviderFailure, type ProviderFailureClassifier, ProviderFailureError, type ProviderFailureKind, type ResolveStorageOptions, type ResponsesInvokeOptions, type RetryDelaySource, type RunContextRecord, type RunEndRecord, type RunErrorRecord, type RunEventStoreFactory, type RunEventStoreInit, type RunStartRecord, type RunStatusRecord, type SessionHeader, type SessionRecord, type SessionState, type SessionStateStore, type SessionStateSummary, type SessionStore, type StorageLayout, type StoragePathService, type StoragePaths, type StringifyContentMode, type StringifyContentOptions, TaskComplete, type Tool, type ToolChoice, type ToolContext, type ToolDefinition, type ToolExecution, type ToolOutputCacheConfig, type ToolOutputCacheReadOptions, type ToolOutputCacheRecord, type ToolOutputCacheSearchOptions, ToolOutputCacheService, type ToolOutputCacheStore, type ToolOutputRecord, type ToolOutputRef, type ToolPermissionDecision, ToolPermissionDenied, type ToolPermissionHook, type ToolResult, XAI_DEFAULT_MODEL, XAI_DEFAULT_REASONING_EFFORT, XAI_MODELS, ZAI_DEFAULT_MODEL, ZAI_MODELS, ZAI_REASONING_EFFORT_MODELS, applyModelMetadata, createModelRegistry, defineTool, getDefaultSystemPromptPath, isProviderFailureError, isUsableModelSpec, listModels, registerModels, resolveModel, resolveProviderModelId, stringifyContent, stringifyContentParts, supportsFastMode };
1218
+ export { ANTHROPIC_DEFAULT_MODEL, ANTHROPIC_MODELS, Agent, type AgentEventRecord, type AgentOptions, type AgentRunOptions, type AgentServices, type AgentSession, type BaseChatModel, type BaseMessage, ChatAnthropic, ChatDeepSeek, ChatGoogle, type ChatInvokeContext, type ChatInvokeInput, ChatMoonshot, ChatOpenAI, ChatOpenRouter, ChatResponses, type ChatStreamDelta, type ChatStreamDeltaSink, ChatXai, ChatZai, type ConversationMessage, type ConversationSearchResult, DEEPSEEK_DEFAULT_MODEL, DEEPSEEK_MODELS, DEFAULT_MODEL_REGISTRY, type DependencyKey, GOOGLE_DEFAULT_MODEL, GOOGLE_MODELS, type ImageTokenEstimate, type ImageTokenInput, type LlmRequestRecord, type LlmResponseRecord, type LlmUsageRecord, MOONSHOT_DEFAULT_MODEL, MOONSHOT_K3_1_MODELS, MOONSHOT_MODELS, type ModelCapabilities, type ModelCost, type ModelEntry, type ModelLimits, type ModelMetadataIndex, type ModelMetadataService, type ModelRegistry, type ModelSpec, OPENAI_DEFAULT_MODEL, OPENAI_DEFAULT_REASONING_EFFORT, OPENAI_MODELS, type PolledMessage, type ProviderFailure, type ProviderFailureClassifier, ProviderFailureError, type ProviderFailureKind, type ResolveStorageOptions, type ResponsesInvokeOptions, type RetryDelaySource, type RunContextRecord, type RunEndRecord, type RunErrorRecord, type RunEventStoreFactory, type RunEventStoreInit, type RunStartRecord, type RunStatusRecord, type SessionHeader, type SessionRecord, type SessionState, type SessionStateStore, type SessionStateSummary, type SessionStore, type StorageLayout, type StoragePathService, type StoragePaths, type StringifyContentMode, type StringifyContentOptions, TaskComplete, type Tool, type ToolChoice, type ToolContext, type ToolDefinition, type ToolExecution, type ToolOutputCacheConfig, type ToolOutputCacheReadOptions, type ToolOutputCacheRecord, type ToolOutputCacheSearchOptions, ToolOutputCacheService, type ToolOutputCacheStore, type ToolOutputRecord, type ToolOutputRef, type ToolPermissionDecision, ToolPermissionDenied, type ToolPermissionHook, type ToolResult, XAI_DEFAULT_MODEL, XAI_DEFAULT_REASONING_EFFORT, XAI_MODELS, ZAI_DEFAULT_MODEL, ZAI_MODELS, ZAI_REASONING_EFFORT_MODELS, applyModelMetadata, createModelRegistry, createProviderResponseError, defineTool, getDefaultSystemPromptPath, isProviderFailureError, isUsableModelSpec, listModels, registerModels, resolveDeepSeekEffort, resolveModel, resolveProviderModelId, stringifyContent, stringifyContentParts, supportsFastMode };