@cognipeer/agent-sdk 0.10.6 → 0.13.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/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { ZodError, ZodSchema, z, ZodTypeAny } from 'zod';
2
2
  import { JSONSchema7 } from 'json-schema';
3
+ import { P as ProviderType, M as ModelRuleLearnedEvent, E as EmbeddingRequest, a as EmbeddingResponse, C as ChatCompletionRequest, b as ChatCompletionResponse, c as ChatCompletionChunk, J as JevProviderConfig, O as OpenAICompatibleProviderConfig, d as OpenAIProviderConfig, R as RulePatch, U as UnifiedMessage, T as ToolDefinition, e as TokenUsage, A as AnthropicProviderConfig, f as AzureProviderConfig, B as BedrockProviderConfig, V as VertexProviderConfig, g as ReasoningRequestConfig, h as ProviderConfig, i as ProviderError } from './model-rules-Bg9nSqyN.js';
4
+ export { a4 as AudioContent, I as EffortMapping, a0 as EmbeddingInputType, $ as EmbeddingUsage, a3 as FileContent, Z as FinishReason, a2 as ImageContent, v as MAX_ADJUSTMENTS, k as MODEL_RULES, W as MaxTokensParam, D as ModelRule, F as ModelRules, Q as OffMechanism, Y as ParsedModelError, _ as ProviderResponseFields, a5 as ProviderToolCall, a6 as ProviderTransportConfig, H as ReasoningEffort, N as ReasoningStyle, G as ResolvedModelRule, K as RuleFamily, L as RuleSource, X as SamplingField, S as TemperatureRule, a1 as TextContent, n as allowsSampling, o as applyDropParams, u as asModelRequestError, z as clearLearnedModelRules, p as effortBudget, j as emptyUsage, x as getLearnedModelRulePatch, w as listLearnedModelRules, m as mapReasoningEffort, q as mergeRulePatch, l as modelIdCandidates, s as parseModelError, y as rememberModelRulePatch, r as resolveModelRule, t as runWithModelAdjustments } from './model-rules-Bg9nSqyN.js';
3
5
 
4
6
  /** Describes what a model/provider natively supports. */
5
7
  type ModelCapabilities = {
@@ -72,6 +74,7 @@ interface BaseChatMessage {
72
74
  name: string;
73
75
  arguments: string;
74
76
  };
77
+ thoughtSignature?: string;
75
78
  }>;
76
79
  tool_call_id?: string;
77
80
  usage?: any;
@@ -241,7 +244,7 @@ declare function describeContentPart(part: unknown): string | undefined;
241
244
  * `content`, else its JSON).
242
245
  */
243
246
  declare function contentPartToText(part: unknown, fallback?: (part: unknown) => string): string;
244
- declare function contentToString(content: string | ContentPart$1[] | any): string;
247
+ declare function contentToString(content: string | ContentPart[] | any): string;
245
248
  declare function extractMessageText(message: any): string;
246
249
  /**
247
250
  * The text a hook should reason about: the text parts only, joined.
@@ -251,7 +254,7 @@ declare function extractMessageText(message: any): string;
251
254
  * that string would be scoring the SDK's own placeholder text, and a redactor
252
255
  * rewriting it would bake the placeholder into the message.
253
256
  */
254
- declare function textFromContent(content: string | ContentPart$1[] | unknown): string;
257
+ declare function textFromContent(content: string | ContentPart[] | unknown): string;
255
258
  /**
256
259
  * Rewrite the text of a message's content, leaving every other part exactly as
257
260
  * it was — same objects, same order.
@@ -260,7 +263,7 @@ declare function textFromContent(content: string | ContentPart$1[] | unknown): s
260
263
  * string over a multi-part `content` is the silent version of this operation:
261
264
  * the run still answers, it just answers without the image the user attached.
262
265
  */
263
- declare function mapTextParts(content: string | ContentPart$1[] | unknown, fn: (text: string) => string): string | ContentPart$1[] | unknown;
266
+ declare function mapTextParts(content: string | ContentPart[] | unknown, fn: (text: string) => string): string | ContentPart[] | unknown;
264
267
  /**
265
268
  * Put a whole replacement text back into a multi-part content.
266
269
  *
@@ -271,9 +274,9 @@ declare function mapTextParts(content: string | ContentPart$1[] | unknown, fn: (
271
274
  * plugin that needs exact multi-part fidelity should return `content` instead,
272
275
  * which is why that field exists.
273
276
  */
274
- declare function replaceTextContent(content: string | ContentPart$1[] | unknown, text: string): string | ContentPart$1[] | unknown;
277
+ declare function replaceTextContent(content: string | ContentPart[] | unknown, text: string): string | ContentPart[] | unknown;
275
278
  /** Every non-text part of a message, normalized for policy code. */
276
- declare function collectAttachments(content: string | ContentPart$1[] | unknown): MediaAttachment[];
279
+ declare function collectAttachments(content: string | ContentPart[] | unknown): MediaAttachment[];
277
280
 
278
281
  /**
279
282
  * Plugin layer — type surface.
@@ -381,7 +384,7 @@ interface HookMap {
381
384
  /** Concatenated text parts. Empty string for a media-only turn. */
382
385
  text: string;
383
386
  /** The full content, string or parts. Return `content` to rewrite it exactly. */
384
- content: string | ContentPart$1[];
387
+ content: string | ContentPart[];
385
388
  /** Every non-text part, normalized across the unified and legacy shapes. */
386
389
  attachments: MediaAttachment[];
387
390
  message: Message;
@@ -397,7 +400,7 @@ interface HookMap {
397
400
  */
398
401
  text?: string;
399
402
  /** Full control over the parts: reorder, drop an attachment, rewrite per part. */
400
- content?: string | ContentPart$1[];
403
+ content?: string | ContentPart[];
401
404
  /** Extra system-level context appended for this turn only. */
402
405
  additionalContext?: string;
403
406
  decision?: "allow" | "deny";
@@ -1127,7 +1130,7 @@ type ImageURL = {
1127
1130
  media_type?: string;
1128
1131
  detail?: 'auto' | 'low' | 'high';
1129
1132
  } | string;
1130
- type ContentPart$1 = {
1133
+ type ContentPart = {
1131
1134
  type: 'text';
1132
1135
  text: string;
1133
1136
  } | {
@@ -1187,7 +1190,7 @@ type RunnableConfig = {
1187
1190
  type BaseMessage = {
1188
1191
  role: string;
1189
1192
  name?: string;
1190
- content: string | ContentPart$1[];
1193
+ content: string | ContentPart[];
1191
1194
  tool_calls?: any;
1192
1195
  tool_call_id?: string;
1193
1196
  [key: string]: any;
@@ -1466,7 +1469,7 @@ type ReflectionConfig = {
1466
1469
  };
1467
1470
  type NativeReasoningConfig = {
1468
1471
  /** `none` is OFF — a value that gets SENT. See ReasoningEffort in providers/types.ts. */
1469
- effort?: "none" | "minimal" | "low" | "medium" | "high";
1472
+ effort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
1470
1473
  budgetTokens?: number;
1471
1474
  includeThoughts?: boolean;
1472
1475
  providerExtras?: Record<string, any>;
@@ -2402,6 +2405,11 @@ type StreamEvent = {
2402
2405
  text: string;
2403
2406
  isFinal?: boolean;
2404
2407
  };
2408
+ /** Incremental model reasoning text (providers that expose it while streaming). */
2409
+ type ReasoningEvent = {
2410
+ type: "reasoning";
2411
+ text: string;
2412
+ };
2405
2413
  type CancelledEvent = {
2406
2414
  type: "cancelled";
2407
2415
  stage?: string;
@@ -2580,7 +2588,7 @@ type DelegationEventStamp = {
2580
2588
  /** Name of the `asTool` child agent this forwarded event came from. */
2581
2589
  delegatedTo?: string;
2582
2590
  };
2583
- type SmartAgentEvent = (ToolCallEvent | ToolApprovalEvent | UserQuestionEvent | PlanEvent | SummarizationEvent | FinalAnswerEvent | MetadataEvent | HandoffEvent | GuardrailEvent | ProgressEvent | StreamEvent | CancelledEvent | SubagentEvent | ReflectionEvent | PluginEvent) & DelegationEventStamp;
2591
+ type SmartAgentEvent = (ToolCallEvent | ToolApprovalEvent | UserQuestionEvent | PlanEvent | SummarizationEvent | FinalAnswerEvent | MetadataEvent | HandoffEvent | GuardrailEvent | ProgressEvent | StreamEvent | ReasoningEvent | CancelledEvent | SubagentEvent | ReflectionEvent | PluginEvent) & DelegationEventStamp;
2584
2592
  type ReflectionEvent = {
2585
2593
  type: "reflection";
2586
2594
  id: string;
@@ -3302,345 +3310,6 @@ type CreateGuardrailOptions = {
3302
3310
  };
3303
3311
  declare function createGuardrail(options: CreateGuardrailOptions): ConversationGuardrail;
3304
3312
 
3305
- type MessageRole = "system" | "user" | "assistant" | "tool";
3306
- type TextContent = {
3307
- type: "text";
3308
- text: string;
3309
- };
3310
- type ImageContent = {
3311
- type: "image";
3312
- source: {
3313
- type: "base64";
3314
- mediaType: string;
3315
- data: string;
3316
- } | {
3317
- type: "url";
3318
- url: string;
3319
- mediaType?: string;
3320
- };
3321
- };
3322
- /**
3323
- * A document attachment (PDF, DOCX, CSV, …). Providers map this to their
3324
- * native document blocks: Gemini `inlineData`/`fileData`, Anthropic
3325
- * `document`, OpenAI Chat Completions `file` / Responses `input_file`,
3326
- * Bedrock Converse `document`. Providers without document support degrade
3327
- * to a text placeholder referencing the file name/URL.
3328
- */
3329
- type FileContent = {
3330
- type: "file";
3331
- source: {
3332
- type: "base64";
3333
- mediaType: string;
3334
- data: string;
3335
- } | {
3336
- type: "url";
3337
- url: string;
3338
- mediaType?: string;
3339
- };
3340
- /** Original file name, when known (required by some providers, e.g. Bedrock). */
3341
- fileName?: string;
3342
- };
3343
- /**
3344
- * An audio attachment. Gemini accepts it as `inlineData`/`fileData`; OpenAI
3345
- * audio-capable models as `input_audio`. Providers without audio support
3346
- * degrade to a text placeholder.
3347
- */
3348
- type AudioContent = {
3349
- type: "audio";
3350
- source: {
3351
- type: "base64";
3352
- mediaType: string;
3353
- data: string;
3354
- } | {
3355
- type: "url";
3356
- url: string;
3357
- mediaType?: string;
3358
- };
3359
- };
3360
- type ContentPart = TextContent | ImageContent | FileContent | AudioContent;
3361
- type ToolCall = {
3362
- id: string;
3363
- name: string;
3364
- arguments: string;
3365
- };
3366
- /**
3367
- * A provider-native reasoning/thinking block. Captured from the model response
3368
- * and replayed verbatim on subsequent turns (required by Anthropic extended
3369
- * thinking when tools are involved — the `signature` must round-trip intact).
3370
- */
3371
- type ReasoningBlock = {
3372
- type: "thinking" | "redacted_thinking";
3373
- /** Plain-text thinking content (absent for redacted blocks). */
3374
- text?: string;
3375
- /** Cryptographic signature Anthropic requires to be echoed back verbatim. */
3376
- signature?: string;
3377
- /** Opaque payload for redacted_thinking blocks. */
3378
- data?: string;
3379
- };
3380
- /** Captured reasoning payload attached to assistant turns / responses. */
3381
- type ReasoningPayload = {
3382
- /** Verbatim provider blocks to replay on the next turn. */
3383
- blocks?: ReasoningBlock[];
3384
- /** Human-readable reasoning summary, when the provider exposes one. */
3385
- summary?: string;
3386
- };
3387
- type UnifiedMessage = {
3388
- role: MessageRole;
3389
- content: string | ContentPart[];
3390
- name?: string;
3391
- toolCalls?: ToolCall[];
3392
- toolCallId?: string;
3393
- /** Native reasoning blocks to replay verbatim (Anthropic/Bedrock thinking). */
3394
- reasoning?: ReasoningPayload;
3395
- };
3396
- type ToolDefinition = {
3397
- name: string;
3398
- description: string;
3399
- parameters: Record<string, any>;
3400
- strict?: boolean;
3401
- };
3402
- type ChatCompletionRequest = {
3403
- model: string;
3404
- messages: UnifiedMessage[];
3405
- temperature?: number;
3406
- maxTokens?: number;
3407
- topP?: number;
3408
- stop?: string[];
3409
- tools?: ToolDefinition[];
3410
- toolChoice?: "auto" | "required" | "none" | {
3411
- name: string;
3412
- };
3413
- responseFormat?: {
3414
- type: "json_schema" | "json_object" | "text";
3415
- schema?: Record<string, any>;
3416
- name?: string;
3417
- };
3418
- stream?: boolean;
3419
- extra?: Record<string, any>;
3420
- /**
3421
- * Unified native-reasoning request config. Each provider maps this to its
3422
- * own shape:
3423
- * - OpenAI o-series: body.reasoning_effort = effort
3424
- * - OpenAI Responses: body.reasoning = { effort }
3425
- * - Anthropic: body.thinking = { type: "enabled", budget_tokens }
3426
- * - Google / Vertex: body.generationConfig.thinkingConfig = { thinkingBudget, includeThoughts }
3427
- *
3428
- * Providers silently ignore unsupported fields.
3429
- */
3430
- reasoning?: ReasoningRequestConfig;
3431
- /**
3432
- * Cancels the HTTP request (and an in-flight stream) when it aborts. The agent
3433
- * loop sets it from the run's cancellation token / abort signal; a caller using
3434
- * a provider directly can pass its own. It is never serialised into the body.
3435
- */
3436
- signal?: AbortSignal;
3437
- };
3438
- /**
3439
- * `none` is OFF, and it is a value rather than the absence of one.
3440
- *
3441
- * On a thinking-by-default model — every Qwen3 under vLLM, gpt-5.1 and newer on
3442
- * OpenAI — sending no reasoning field leaves the model thinking. So "do not
3443
- * think" is an instruction that has to travel: `reasoning_effort:"none"` on
3444
- * OpenAI, `thinkingBudget:0` on Gemini, and no thinking block at all on
3445
- * Anthropic (where thinking is opt-in and the absence IS off). Omitting
3446
- * `effort` still means "say nothing about reasoning", which is the different
3447
- * and equally necessary state.
3448
- */
3449
- type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high";
3450
- type ReasoningRequestConfig = {
3451
- /** Qualitative effort hint (mapped per-provider). */
3452
- effort?: ReasoningEffort;
3453
- /** Explicit per-call token budget for reasoning/thinking. */
3454
- budgetTokens?: number;
3455
- /** Whether the provider should expose its reasoning/thought summary to the caller. Default false. */
3456
- includeThoughts?: boolean;
3457
- /** Provider-specific passthrough merged on top of the mapped shape. */
3458
- providerExtras?: Record<string, any>;
3459
- };
3460
- type TokenUsage = {
3461
- inputTokens: number;
3462
- outputTokens: number;
3463
- totalTokens: number;
3464
- cachedInputTokens: number;
3465
- cachedWriteTokens: number;
3466
- cachedOutputTokens: number;
3467
- reasoningTokens: number;
3468
- };
3469
- declare function emptyUsage(): TokenUsage;
3470
- type FinishReason = "stop" | "tool_calls" | "length" | "content_filter" | "error";
3471
- type ChatCompletionResponse = {
3472
- id: string;
3473
- model: string;
3474
- content: string | null;
3475
- toolCalls: ToolCall[];
3476
- usage: TokenUsage;
3477
- finishReason: FinishReason;
3478
- /** Native reasoning blocks + summary captured from the response, if any. */
3479
- reasoning?: ReasoningPayload;
3480
- raw: any;
3481
- };
3482
- type ChatCompletionChunk = {
3483
- id: string;
3484
- model: string;
3485
- delta: {
3486
- content?: string;
3487
- toolCalls?: Partial<ToolCall>[];
3488
- /** Incremental reasoning text / signature deltas (Anthropic thinking). */
3489
- reasoning?: ReasoningPayload;
3490
- };
3491
- usage?: TokenUsage;
3492
- finishReason?: FinishReason;
3493
- };
3494
- type ProviderRetryConfig = {
3495
- /** Maximum retries on 429/5xx (default 3). */
3496
- maxRetries?: number;
3497
- /** Initial delay between retries in ms (default 500, doubled each attempt). */
3498
- baseDelayMs?: number;
3499
- /** Hard cap on a single retry delay in ms (default 8000). */
3500
- maxDelayMs?: number;
3501
- /** Custom predicate to opt in/out of a specific retry. */
3502
- shouldRetry?: (error: any, attempt: number) => boolean;
3503
- };
3504
- type OpenAIProviderConfig = {
3505
- provider: "openai";
3506
- apiKey: string;
3507
- baseURL?: string;
3508
- organization?: string;
3509
- defaultModel?: string;
3510
- defaultHeaders?: Record<string, string>;
3511
- retry?: ProviderRetryConfig;
3512
- /**
3513
- * WHICH API a reasoning-carrying request is addressed to.
3514
- *
3515
- * auto (default, and today's behaviour) route to the Responses API when
3516
- * the request carries `reasoning` AND the model name looks like an
3517
- * o-series/gpt-5 reasoning model.
3518
- * never always Chat Completions. `reasoning` is still mapped, as
3519
- * `reasoning_effort` plus any `providerExtras`.
3520
- * always always Responses, whatever the model is called.
3521
- *
3522
- * `auto` is a name-based guess, and it decides far more than where reasoning
3523
- * goes: Responses is a different request shape (`input` not `messages`,
3524
- * `text.format` not `response_format`, flat tool objects) and a different
3525
- * response parse. A caller with its own measurements of the Chat Completions
3526
- * body — a gateway, a proxy, an on-prem server that serves one and not the
3527
- * other, or anything that has tuned `extra` — must be able to say so, rather
3528
- * than discover that asking for less thinking silently changed the transport.
3529
- *
3530
- * Applies to any OpenAI-shaped endpoint, which is also why the guess is weak
3531
- * where it matters most: a self-hosted model is named by whoever served it.
3532
- */
3533
- responsesApi?: "auto" | "never" | "always";
3534
- /**
3535
- * Models that go to the Responses API, named explicitly. Opt-in; unset by
3536
- * default, and nothing here is inferred from a model name.
3537
- *
3538
- * A string matches the request's model (or `defaultModel`) exactly; a RegExp
3539
- * is tested against it. A match routes the request to Responses whether or
3540
- * not it carries `reasoning` — the case this exists for is a model that
3541
- * reasons by default and rejects function tools on Chat Completions, where
3542
- * sending no reasoning field does not help. `responsesApi: "never"` still
3543
- * wins; under `"always"` the routing is unchanged.
3544
- *
3545
- * Requests for a matched model also get, on the Responses body only:
3546
- * - Chat Completions spellings arriving through `extra`, which /responses
3547
- * rejects with a 400, re-spelled with their values unchanged:
3548
- * `reasoning_effort` → `reasoning.effort` (a request `reasoning` effort
3549
- * still wins), `max_tokens` / `max_completion_tokens` →
3550
- * `max_output_tokens`, `response_format` → `text.format`, and
3551
- * `stream_options.include_usage` dropped.
3552
- * - real SSE streaming, when `responsesStreaming` is also true.
3553
- *
3554
- * Honoured by `OpenAIProvider` itself only; `AzureProvider` and
3555
- * `OpenAICompatibleProvider` ignore it.
3556
- */
3557
- responsesApiModels?: Array<string | RegExp>;
3558
- /**
3559
- * Stream Responses API output as it arrives (text and tool-call argument
3560
- * deltas) for models in `responsesApiModels`. Default false, which keeps the
3561
- * existing behaviour: one non-streaming Responses call, emitted as a single
3562
- * chunk. Has no effect on any other request.
3563
- */
3564
- responsesStreaming?: boolean;
3565
- };
3566
- type AnthropicProviderConfig = {
3567
- provider: "anthropic";
3568
- apiKey: string;
3569
- baseURL?: string;
3570
- defaultModel?: string;
3571
- defaultHeaders?: Record<string, string>;
3572
- anthropicVersion?: string;
3573
- retry?: ProviderRetryConfig;
3574
- /**
3575
- * Prompt caching configuration. When enabled, places cache_control:
3576
- * ephemeral breakpoints on the system prompt and the final tool definition,
3577
- * which is the recommended Anthropic recipe for static system + tools.
3578
- */
3579
- prompt_caching?: {
3580
- enabled: boolean;
3581
- };
3582
- };
3583
- type AzureProviderConfig = {
3584
- provider: "azure";
3585
- apiKey: string;
3586
- endpoint: string;
3587
- apiVersion?: string;
3588
- deploymentName?: string;
3589
- defaultModel?: string;
3590
- defaultHeaders?: Record<string, string>;
3591
- };
3592
- type OpenAICompatibleProviderConfig = {
3593
- provider: "openai-compatible";
3594
- apiKey: string;
3595
- baseURL: string;
3596
- defaultModel?: string;
3597
- defaultHeaders?: Record<string, string>;
3598
- };
3599
- type BedrockProviderConfig = {
3600
- provider: "bedrock";
3601
- region: string;
3602
- accessKeyId?: string;
3603
- secretAccessKey?: string;
3604
- sessionToken?: string;
3605
- defaultModel?: string;
3606
- defaultHeaders?: Record<string, string>;
3607
- retry?: ProviderRetryConfig;
3608
- /**
3609
- * Insert Bedrock Converse `cachePoint` blocks at the end of the system
3610
- * prompt and tools list. Only supported by models that implement Converse
3611
- * prompt caching (most Anthropic Claude variants on Bedrock).
3612
- */
3613
- prompt_caching?: {
3614
- enabled: boolean;
3615
- };
3616
- };
3617
- type VertexProviderConfig = {
3618
- provider: "vertex";
3619
- projectId: string;
3620
- location?: string;
3621
- accessToken?: string;
3622
- serviceAccountJson?: string | Record<string, any>;
3623
- defaultModel?: string;
3624
- defaultHeaders?: Record<string, string>;
3625
- };
3626
- type JevProviderConfig = {
3627
- provider: "jev";
3628
- apiKey: string;
3629
- /** Defaults to https://api.typesafe.ai. */
3630
- baseURL?: string;
3631
- defaultModel?: string;
3632
- defaultHeaders?: Record<string, string>;
3633
- retry?: ProviderRetryConfig;
3634
- };
3635
- type ProviderConfig = OpenAIProviderConfig | AnthropicProviderConfig | AzureProviderConfig | OpenAICompatibleProviderConfig | BedrockProviderConfig | VertexProviderConfig | JevProviderConfig;
3636
- type ProviderType = ProviderConfig["provider"];
3637
- declare class ProviderError extends Error {
3638
- readonly provider: string;
3639
- readonly statusCode?: number | undefined;
3640
- readonly responseBody?: any | undefined;
3641
- constructor(message: string, provider: string, statusCode?: number | undefined, responseBody?: any | undefined);
3642
- }
3643
-
3644
3313
  type ProviderRetryPolicy = {
3645
3314
  /** Maximum number of retries on 429/5xx responses. Default: 3. */
3646
3315
  maxRetries?: number;
@@ -3657,6 +3326,33 @@ type ProviderRetryPolicy = {
3657
3326
  declare abstract class BaseProvider {
3658
3327
  abstract readonly providerName: ProviderType;
3659
3328
  protected retryPolicy: ProviderRetryPolicy;
3329
+ /** Injected `fetch` (config.fetch); falls back to the global one at call time. */
3330
+ protected fetchImpl?: typeof fetch;
3331
+ /** Per-request timeout in ms (config.timeoutMs). Undefined = no timeout. */
3332
+ protected timeoutMs?: number;
3333
+ /** Called when a 400 taught the provider a per-model adjustment (config.onModelRuleLearned). */
3334
+ protected onModelRuleLearned?: (event: ModelRuleLearnedEvent) => void;
3335
+ /** Applies the transport options shared by every provider config. */
3336
+ protected configureTransport(config: {
3337
+ fetch?: typeof fetch;
3338
+ timeoutMs?: number;
3339
+ onModelRuleLearned?: (event: ModelRuleLearnedEvent) => void;
3340
+ }): void;
3341
+ /**
3342
+ * The single HTTP entry point for every provider call site. Uses the
3343
+ * configured `fetch` and applies `timeoutMs`: the timer covers the time until
3344
+ * the response HEADERS arrive and is cleared after that, so a long-running
3345
+ * stream is never cut by it (use the request `signal` to cancel a stream).
3346
+ * A timeout surfaces as a `ProviderError` with status 408. The caller's
3347
+ * `signal` still aborts the request as before.
3348
+ */
3349
+ protected httpFetch(url: string, init?: RequestInit): Promise<Response>;
3350
+ /**
3351
+ * Embeds `request.input`. Implemented by the providers that have an
3352
+ * embeddings endpoint (OpenAI, Azure, openai-compatible, Bedrock, Vertex);
3353
+ * the others reject with a 400 ProviderError.
3354
+ */
3355
+ embed(_request: EmbeddingRequest): Promise<EmbeddingResponse>;
3660
3356
  /** Non-streaming completion */
3661
3357
  abstract complete(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
3662
3358
  /** Streaming completion – yields incremental chunks */
@@ -5674,6 +5370,9 @@ declare function buildResponseFormatSection(responseFormat: Record<string, any>
5674
5370
  */
5675
5371
  declare function startStreamingSession(session: TraceSessionRuntime | undefined, agentRuntime?: AgentRuntimeConfig): Promise<void>;
5676
5372
 
5373
+ /** True when the model's rule uses `thinking:{type:"adaptive"}` + `output_config.effort` (Claude 4.6+ / 5.x). */
5374
+ declare function supportsAdaptiveThinking(model: unknown): boolean;
5375
+
5677
5376
  declare class OpenAIProvider extends BaseProvider {
5678
5377
  readonly providerName: ProviderType;
5679
5378
  protected readonly apiKey: string;
@@ -5683,6 +5382,11 @@ declare class OpenAIProvider extends BaseProvider {
5683
5382
  protected readonly responsesApi: "auto" | "never" | "always";
5684
5383
  private readonly responsesApiModels;
5685
5384
  private readonly responsesStreaming;
5385
+ private readonly apiExplicitChat;
5386
+ private readonly apiExplicitResponses;
5387
+ /** `api: "responses"` was passed (the legacy `responsesApi: "always"` keeps its old single-call behaviour). */
5388
+ private readonly apiResponsesNative;
5389
+ protected readonly maxTokensParam: "auto" | "max_tokens" | "max_completion_tokens";
5686
5390
  constructor(config: OpenAIProviderConfig);
5687
5391
  /** True when the caller listed this request's model in `responsesApiModels`. */
5688
5392
  private isResponsesApiModel;
@@ -5701,7 +5405,14 @@ declare class OpenAIProvider extends BaseProvider {
5701
5405
  protected useResponsesApi(request: ChatCompletionRequest): boolean;
5702
5406
  complete(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
5703
5407
  completeStream(request: ChatCompletionRequest): AsyncGenerator<ChatCompletionChunk, void, unknown>;
5704
- protected buildRequestBody(request: ChatCompletionRequest, stream: boolean): Record<string, any>;
5408
+ /** POST /embeddings, batched (default 2048 inputs per request, the OpenAI cap). */
5409
+ embed(request: EmbeddingRequest): Promise<EmbeddingResponse>;
5410
+ protected embeddingsFetch(body: Record<string, any>, signal?: AbortSignal): Promise<Response>;
5411
+ /** Chat Completions call that corrects itself from the provider's own 400s (see models/adjust.ts). */
5412
+ private fetchChat;
5413
+ /** Same for the Responses API. */
5414
+ private fetchResponses;
5415
+ protected buildRequestBody(request: ChatCompletionRequest, stream: boolean, overlay?: RulePatch): Record<string, any>;
5705
5416
  protected completeResponses(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
5706
5417
  /** Real Responses SSE streaming, for models opted in through
5707
5418
  * `responsesApiModels` with `responsesStreaming` on. Emits the same chunk
@@ -5711,7 +5422,7 @@ declare class OpenAIProvider extends BaseProvider {
5711
5422
  * (taken from the completed response, exactly as the non-streaming parse
5712
5423
  * reads it). */
5713
5424
  private streamResponses;
5714
- protected buildResponsesBody(request: ChatCompletionRequest): Record<string, any>;
5425
+ protected buildResponsesBody(request: ChatCompletionRequest, overlay?: RulePatch): Record<string, any>;
5715
5426
  /** Maps a unified message to a Responses API `input` item. */
5716
5427
  protected toResponsesInput(m: UnifiedMessage): Record<string, any>;
5717
5428
  protected responsesFetch(body: Record<string, any>, signal?: AbortSignal): Promise<Response>;
@@ -5731,6 +5442,7 @@ declare class AnthropicProvider extends BaseProvider {
5731
5442
  private readonly defaultHeaders;
5732
5443
  private readonly anthropicVersion;
5733
5444
  private readonly promptCachingEnabled;
5445
+ private readonly thinkingMode;
5734
5446
  constructor(config: AnthropicProviderConfig);
5735
5447
  complete(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
5736
5448
  completeStream(request: ChatCompletionRequest): AsyncGenerator<ChatCompletionChunk, void, unknown>;
@@ -5750,6 +5462,9 @@ declare class AnthropicProvider extends BaseProvider {
5750
5462
  private toAnthropicToolResult;
5751
5463
  private toAnthropicMessage;
5752
5464
  private toAnthropicTool;
5465
+ /** Builds and sends the request; retries once with the other thinking form
5466
+ * when the upstream rejects the one we picked. */
5467
+ private send;
5753
5468
  private doFetch;
5754
5469
  private parseResponse;
5755
5470
  }
@@ -5762,6 +5477,9 @@ declare class AzureProvider extends OpenAIProvider {
5762
5477
  private readonly azureApiKey;
5763
5478
  constructor(config: AzureProviderConfig);
5764
5479
  protected doFetch(body: Record<string, any>, signal?: AbortSignal): Promise<Response>;
5480
+ /** Azure embeddings: the deployment named by the request's model (falling back
5481
+ * to the configured deployment) in the path, api-key auth. */
5482
+ protected embeddingsFetch(body: Record<string, any>, signal?: AbortSignal): Promise<Response>;
5765
5483
  /** Azure exposes the Responses API at /openai/responses with api-key auth.
5766
5484
  * Reasoning summaries require a preview api-version; callers can override via
5767
5485
  * the `apiVersion` config. */
@@ -5780,9 +5498,28 @@ declare class BedrockProvider extends BaseProvider {
5780
5498
  private readonly defaultModel;
5781
5499
  private readonly defaultHeaders;
5782
5500
  private readonly promptCachingEnabled;
5501
+ private readonly thinkingMode;
5783
5502
  constructor(config: BedrockProviderConfig);
5784
5503
  complete(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
5504
+ /**
5505
+ * Real streaming over ConverseStream. The response is an AWS event-stream
5506
+ * (binary frames); each frame carries one JSON event: messageStart,
5507
+ * contentBlockStart/Delta/Stop (text, toolUse, reasoningContent),
5508
+ * messageStop and, last, metadata (usage). Text, tool-call argument and
5509
+ * reasoning deltas are yielded as they arrive; one closing chunk carries the
5510
+ * finish reason, usage and the signed reasoning blocks.
5511
+ */
5785
5512
  completeStream(request: ChatCompletionRequest): AsyncGenerator<ChatCompletionChunk, void, unknown>;
5513
+ /**
5514
+ * InvokeModel embeddings. Supported families (by model id, inference-profile
5515
+ * prefixes such as `us.` allowed):
5516
+ * - Amazon Titan Text Embeddings (v1, v2): one text per call, `dimensions`
5517
+ * (v2: 256/512/1024) and `normalize` via `extra`.
5518
+ * - Cohere Embed (v3, v4): a batch of texts per call (default 96), `inputType`
5519
+ * maps to `input_type`, `dimensions` to `output_dimension` (v4).
5520
+ */
5521
+ embed(request: EmbeddingRequest): Promise<EmbeddingResponse>;
5522
+ private invokeModel;
5786
5523
  private buildConverseBody;
5787
5524
  private splitSystemMessages;
5788
5525
  /**
@@ -5800,6 +5537,9 @@ declare class BedrockProvider extends BaseProvider {
5800
5537
  private toBedrockToolResult;
5801
5538
  private toBedrockMessage;
5802
5539
  private toBedrockTool;
5540
+ /** Sends the Converse call; retries once with toolChoice auto when the
5541
+ * model rejects forced tool use. */
5542
+ private converseFetch;
5803
5543
  private doFetch;
5804
5544
  private parseResponse;
5805
5545
  }
@@ -5816,6 +5556,13 @@ declare class VertexProvider extends BaseProvider {
5816
5556
  constructor(config: VertexProviderConfig);
5817
5557
  complete(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
5818
5558
  completeStream(request: ChatCompletionRequest): AsyncGenerator<ChatCompletionChunk, void, unknown>;
5559
+ /**
5560
+ * Vertex `:predict` embeddings (text-embedding-00x, text-multilingual-embedding,
5561
+ * gemini-embedding-001). `inputType` maps to the task type; `dimensions` to
5562
+ * `outputDimensionality`. gemini-embedding takes one instance per request, the
5563
+ * text-embedding models up to `batchSize` (default 100).
5564
+ */
5565
+ embed(request: EmbeddingRequest): Promise<EmbeddingResponse>;
5819
5566
  private buildUrl;
5820
5567
  private buildGeminiBody;
5821
5568
  private buildContents;
@@ -5840,7 +5587,50 @@ type NativeModelOptions = {
5840
5587
  extra?: Record<string, any>;
5841
5588
  /** Unified native reasoning config applied by default (per-call overrides supported). */
5842
5589
  reasoning?: ReasoningRequestConfig;
5590
+ /** Default nucleus sampling. */
5591
+ topP?: number;
5592
+ /** Default stop sequences. */
5593
+ stop?: string[];
5594
+ /** Default presence penalty (OpenAI-family only). */
5595
+ presencePenalty?: number;
5596
+ /** Default frequency penalty (OpenAI-family only). */
5597
+ frequencyPenalty?: number;
5598
+ /**
5599
+ * Last-mile hook: receives the fully built request (tools, response format,
5600
+ * reasoning already applied) right before it goes to the provider. Mutate it
5601
+ * in place or return a replacement. Use it for model-specific rules the
5602
+ * unified request cannot express (e.g. force `reasoning` off when tools are bound).
5603
+ */
5604
+ transformRequest?: (request: ChatCompletionRequest) => ChatCompletionRequest | void | Promise<ChatCompletionRequest | void>;
5605
+ };
5606
+ /**
5607
+ * The ONE usage shape carried on every assistant message produced by a native
5608
+ * provider (`message.usage`, and mirrored on `response_metadata.token_usage`):
5609
+ *
5610
+ * ```
5611
+ * {
5612
+ * prompt_tokens, completion_tokens, total_tokens,
5613
+ * prompt_tokens_details: { cached_tokens, cache_write_tokens },
5614
+ * completion_tokens_details: { reasoning_tokens },
5615
+ * }
5616
+ * ```
5617
+ * `completion_tokens` INCLUDES `reasoning_tokens`; `prompt_tokens` INCLUDES
5618
+ * `cached_tokens`. `response_metadata.token_usage` additionally keeps the flat
5619
+ * legacy `cached_tokens` / `cache_write_tokens` keys.
5620
+ */
5621
+ type MessageUsage = {
5622
+ prompt_tokens: number;
5623
+ completion_tokens: number;
5624
+ total_tokens: number;
5625
+ prompt_tokens_details: {
5626
+ cached_tokens: number;
5627
+ cache_write_tokens: number;
5628
+ };
5629
+ completion_tokens_details: {
5630
+ reasoning_tokens: number;
5631
+ };
5843
5632
  };
5633
+ declare function toMessageUsage(u: TokenUsage): MessageUsage;
5844
5634
  /**
5845
5635
  * Creates a BaseChatModel from a native provider.
5846
5636
  *
@@ -5877,4 +5667,26 @@ declare function fromNativeProvider(provider: BaseProvider, options?: NativeMode
5877
5667
  */
5878
5668
  declare function createProvider(config: ProviderConfig): BaseProvider;
5879
5669
 
5880
- export { type AIMessage, ASK_USER_TOOL_NAME, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentPlugin, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, type AnthropicProviderConfig, type ApprovalTransport, type AudioContent, type AuditEntry, type AuditLogConfig, type AzureContentSafetyConfig, AzureProvider, type AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, type BedrockGuardrailConfig, BedrockProvider, type BedrockProviderConfig, type BudgetGuardConfig, type BuildChildConfig, type BuiltInRuntimeProfile, CCRStore, CONSOLE_HOOK_MAP, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, type CancellationTokenLike, type CancelledEvent, type CapabilityStatus, type ChatCompletionChunk, type ChatCompletionRequest, type ChatCompletionResponse, type CheckpointPluginConfig, type CheckpointStore, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type CognipeerGuardrailConfig, type CompressToolOutputParams, type ContextBuilder, type ContextPilotCCRConfig, type ContextPilotCacheAlignmentConfig, type ContextPilotCompressionConfig, type ContextPilotCompressionStats, type ContextPilotCompressorKind, type ContextPilotConfig, type ContextPilotDedupConfig, type ContextPilotDiffCompressionConfig, type ContextPilotJsonCompressionConfig, type ContextPilotLogCompressionConfig, type ContextPilotResult, type ContextPilotRuntime, type ContextPilotSearchCompressionConfig, type ContextPilotTextCompressionConfig, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type ConversationPluginConfig, type ConversationStore, type CostEstimator, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, type DelegationEventStamp, type DelegationMode, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FileContent, type FinalAnswerEvent, type FinishReason, type GateResult, type GuardrailCallContext, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailJudgeEngine, type GuardrailOutcome, GuardrailPhase, type GuardrailPhaseName, type GuardrailPluginOptions, type GuardrailRequest, type GuardrailRule, type GuardrailRuleResult, type GuardrailTransport, type GuardrailVerdict, type GuardrailViolation, HOOK_CONTRACT_VERSION, HOOK_NAMES, type HandoffDescriptor, type HandoffEvent, type HookContext, type HookDecision, type HookHandler, type HookMap, type HookName, type HookRegistrations, HookTimeoutError, type HttpGuardrailOptions, type HumanInTheLoopAskUserConfig, type HumanInTheLoopOptions, type HumanInTheLoopRuntimeConfig, type ImageContent, InMemoryMemoryStore, type InjectionScan, type InvokeConfig, type JevClientLike, type JevEngineOptions, type JevNoulAnswer, JevProvider, type JevProviderConfig, type JevQuestion, type JevSystemOneRequest, type JevSystemOneResult, type JsonGuardrailOptions, type JsonSchemaRuleOptions, type LangfuseBuildContext, type LangfuseEvent, type LangfuseEventKind, type LangfuseTracingConfig, type LanguageGuardConfig, type LoadSkillsOptions, type MaybePromise, type McpConfig, type McpConnection, type MediaAttachment, type MediaKind$1 as MediaKind, type MediaPolicyConfig, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MetadataEvent, type ModelCapabilities, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, type OpenAICompatibleProviderConfig, type OpenAIModerationConfig, OpenAIProvider, type OpenAIProviderConfig, type OtelTracingConfig, type OutputGuardConfig, PREOPEN_TOOL_CALL_PREFIX, type PendingToolApproval, type PendingUserQuestion, type PiiDetector, type PiiEntity, type PiiRedactionConfig, type PlanEvent, type PlanStepRecord, type PlanningMode, type PluginContributions, type PluginEvent, type PluginFailureMode, type PluginHost, type PluginHostOptions, type PluginLogger, type PluginProvides, type PluginRunHost, type PluginSetupContext, type PortkeyGatewayConfig, type PortkeyGuardrailConfig, type PreopenSkillsResult, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type PromptHooks, type PromptInjectionFamily, type PromptInjectionGuardConfig, type PromptSource, type ProviderConfig, ProviderError, type ToolCall as ProviderToolCall, type ToolDefinition as ProviderToolDefinition, type ProviderType, type RateLimitConfig, type ReasoningConfig, type ReasoningLevel, type RedactionResult, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionHookContext, type ReflectionRecord, type RegexGuardrailConfig, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedContextPilotConfig, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type ResponseCacheConfig, type RestoreSnapshotOptions, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SdkCapabilities, type SerializableSmartState, type SessionMetrics, type SessionMetricsConfig, type Skill, type SkillDisclosure, type SkillExecutionContext, type SkillFrontmatter, type SkillFs, type SkillModelTier, type SkillPolicy, type SkillRegistryRef, type SkillSource, type SkillToolDeps, type SkillToolHeader, type SlotName, type SmartAgentBudgetConfig, type SmartAgentContextConfig, type SmartAgentCustomProfileConfig, type SmartAgentDelegationConfig, type SmartAgentEvent, type SmartAgentInstance, type SmartAgentLimits, type SmartAgentMemoryConfig, type SmartAgentOptions, type SmartAgentPlanningConfig, type SmartAgentSummarizationConfig, type SmartAgentToolResponseConfig, type SmartAgentTracingConfig, type SmartModel, type SmartState, type SmartToolFn, type SnapshotOptions, type SnapshotRuntimeHint, type StreamChunk, type StreamEvent, type StrictRestorers, type StrictTransform, type StructuredOutputError, type StructuredOutputFieldError, StructuredOutputManager, type StructuredOutputManagerConfig, type StructuredOutputResult, type StructuredOutputStrategy, type StructuredSummary, type SubagentDef, type SubagentEvent, type SubagentMode, type SubagentPendingRecord, type SubagentPolicy, type SubagentRegistryRef, type SubagentResult, type SubagentToolDeps, type SubagentToolNames, type SummarizationEvent, type SummarizationMode, type SummarizerInput, type SummarizerResult, type SummarizerStrategy, type SummaryFactItem, type SummaryIntegrityCheck, TOOL_INPUT_DIGEST_KEY, type TextContent, type TokenCounter, type TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallEvent, type ToolInputDigestOptions, type ToolInputDigestResult, type ToolInputRetentionPolicy, type ToolInterface, type ToolPolicyConfig, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetentionDeclarations, type ToolRetentionSpec, type ToolRetryPolicy, type ToolRule, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessagePart, type TraceMessageSection, type TraceMetadataSection, type TraceSessionConfigSnapshot, type TraceSessionFile, type TraceSessionStatus, type TraceSessionSummary, type TraceSinkCognipeerConfig, type TraceSinkConfig, type TraceSinkCustomConfig, type TraceSinkFileConfig, type TraceSinkHttpConfig, type TraceSinkOtlpConfig, type TraceSinkSnapshot, type TraceSummarySection, type TraceToolCallSection, type TraceToolDefinition, type TraceToolDefinitionsSection, type TraceToolDetails, type TraceToolResponseSection, type TraceToolResultSection, type TracingConfig, type TracingMode, type UnifiedMessage, type UserQuestionAnswer, type UserQuestionAnswerSet, type UserQuestionEvent, type UserQuestionItem, type UserQuestionOption, type UserQuestionResolution, type UserQuestionStatus, VertexProvider, type VertexProviderConfig, type VolatileContentFinding, type VolatileContentPattern, type WebhookApprovalConfig, agentVerdictRule, appendBoundTools, auditLog, azureContentSafety, bedrockGuardrail, budgetGuard, buildHandoffTools, buildResponseFormatSection, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, buildToolDefinitionsSection, canOpenSkill, canSpawn, captureSnapshot, checkpointing, codePresenceRule, coerceToolArgs, cognipeerGuardrail, cognipeerSink, collectAttachments, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, contentPartToText, contentToString, conversationHistory, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createGuardrailPlugin, createJsonGuardrail, createManageTodoListAliasTool, createManageTodoTool, createOpenSkillTool, createParallelTool, createPluginHost, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customGuardrail, customSink, dedupeToolsByName, defaultTokenCounter, defineHook, definePlugin, describeContentPart, detectLanguage, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, emptyUsage, evaluateGuardrails, extractLatestUserQuery, extractMessageText, fileCheckpointStore, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasMediaPart, hasToolResponseRecoveryReference, httpGuardrail, httpSink, inMemoryCheckpointStore, inMemoryConversationStore, isHookImplemented, isOpenAIHostedEndpoint, isSmartModel, isValidIban, isValidLuhn, isValidTckn, jsonSchemaRule, defaultBuildPayload as langfuseDefaultPayload, langfuseTracing, languageGuard, loadSkillsFromDisk, mapConsoleHookVerdict, mapTextParts, mcp, mediaKindOf, mediaPolicy, normalizeSmartAgentOptions, normalizeVerdicts, openAIModeration, otelTracing, otlpSink, outputGuard, parseApprovalDecision, parseSkillFrontmatter, pathSandbox, piiRedaction, pluginCapabilities, portkeyGateway, portkeyGuardrail, preopenSkills, preopenToolCallId, prepareStrictToolMenu, promptInjectionGuard, rateLimit, readMemoryFacts, redactText, regexGuardrail, regexRule, replaceTextContent, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, responseCache, restoreSnapshot, restoreToolCalls, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, sessionMetrics, setTokenCounter, startStreamingSession, summarizeObject, textFromContent, toStrictCompatible, toStrictToolSchema, tokenize, toolPolicy, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, webhookApproval, withTools, withinDepth, writeSummaryFactsToMemory };
5670
+ type ModelRequestErrorCode = "unsupported_parameter" | "unsupported_value" | "model_request_invalid";
5671
+ type ModelRequestErrorInit = {
5672
+ status?: number;
5673
+ code: ModelRequestErrorCode;
5674
+ param?: string;
5675
+ value?: unknown;
5676
+ supportedValues?: string[];
5677
+ provider: string;
5678
+ model: string;
5679
+ message: string;
5680
+ responseBody?: unknown;
5681
+ };
5682
+ declare class ModelRequestError extends ProviderError {
5683
+ readonly status: number;
5684
+ readonly code: ModelRequestErrorCode;
5685
+ readonly param?: string;
5686
+ readonly value?: unknown;
5687
+ readonly supportedValues?: string[];
5688
+ readonly model: string;
5689
+ constructor(init: ModelRequestErrorInit);
5690
+ }
5691
+
5692
+ export { type AIMessage, ASK_USER_TOOL_NAME, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentPlugin, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, AnthropicProviderConfig, type ApprovalTransport, type AuditEntry, type AuditLogConfig, type AzureContentSafetyConfig, AzureProvider, AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, type BedrockGuardrailConfig, BedrockProvider, BedrockProviderConfig, type BudgetGuardConfig, type BuildChildConfig, type BuiltInRuntimeProfile, CCRStore, CONSOLE_HOOK_MAP, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, type CancellationTokenLike, type CancelledEvent, type CapabilityStatus, ChatCompletionChunk, ChatCompletionRequest, ChatCompletionResponse, type CheckpointPluginConfig, type CheckpointStore, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type CognipeerGuardrailConfig, type CompressToolOutputParams, type ContextBuilder, type ContextPilotCCRConfig, type ContextPilotCacheAlignmentConfig, type ContextPilotCompressionConfig, type ContextPilotCompressionStats, type ContextPilotCompressorKind, type ContextPilotConfig, type ContextPilotDedupConfig, type ContextPilotDiffCompressionConfig, type ContextPilotJsonCompressionConfig, type ContextPilotLogCompressionConfig, type ContextPilotResult, type ContextPilotRuntime, type ContextPilotSearchCompressionConfig, type ContextPilotTextCompressionConfig, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type ConversationPluginConfig, type ConversationStore, type CostEstimator, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, type DelegationEventStamp, type DelegationMode, EmbeddingRequest, EmbeddingResponse, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FinalAnswerEvent, type GateResult, type GuardrailCallContext, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailJudgeEngine, type GuardrailOutcome, GuardrailPhase, type GuardrailPhaseName, type GuardrailPluginOptions, type GuardrailRequest, type GuardrailRule, type GuardrailRuleResult, type GuardrailTransport, type GuardrailVerdict, type GuardrailViolation, HOOK_CONTRACT_VERSION, HOOK_NAMES, type HandoffDescriptor, type HandoffEvent, type HookContext, type HookDecision, type HookHandler, type HookMap, type HookName, type HookRegistrations, HookTimeoutError, type HttpGuardrailOptions, type HumanInTheLoopAskUserConfig, type HumanInTheLoopOptions, type HumanInTheLoopRuntimeConfig, InMemoryMemoryStore, type InjectionScan, type InvokeConfig, type JevClientLike, type JevEngineOptions, type JevNoulAnswer, JevProvider, JevProviderConfig, type JevQuestion, type JevSystemOneRequest, type JevSystemOneResult, type JsonGuardrailOptions, type JsonSchemaRuleOptions, type LangfuseBuildContext, type LangfuseEvent, type LangfuseEventKind, type LangfuseTracingConfig, type LanguageGuardConfig, type LoadSkillsOptions, type MaybePromise, type McpConfig, type McpConnection, type MediaAttachment, type MediaKind$1 as MediaKind, type MediaPolicyConfig, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MessageUsage, type MetadataEvent, type ModelCapabilities, ModelRequestError, type ModelRequestErrorCode, type ModelRequestErrorInit, ModelRuleLearnedEvent, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, OpenAICompatibleProviderConfig, type OpenAIModerationConfig, OpenAIProvider, OpenAIProviderConfig, type OtelTracingConfig, type OutputGuardConfig, PREOPEN_TOOL_CALL_PREFIX, type PendingToolApproval, type PendingUserQuestion, type PiiDetector, type PiiEntity, type PiiRedactionConfig, type PlanEvent, type PlanStepRecord, type PlanningMode, type PluginContributions, type PluginEvent, type PluginFailureMode, type PluginHost, type PluginHostOptions, type PluginLogger, type PluginProvides, type PluginRunHost, type PluginSetupContext, type PortkeyGatewayConfig, type PortkeyGuardrailConfig, type PreopenSkillsResult, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type PromptHooks, type PromptInjectionFamily, type PromptInjectionGuardConfig, type PromptSource, ProviderConfig, ProviderError, ToolDefinition as ProviderToolDefinition, ProviderType, type RateLimitConfig, type ReasoningConfig, type ReasoningLevel, type RedactionResult, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionHookContext, type ReflectionRecord, type RegexGuardrailConfig, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedContextPilotConfig, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type ResponseCacheConfig, type RestoreSnapshotOptions, RulePatch, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SdkCapabilities, type SerializableSmartState, type SessionMetrics, type SessionMetricsConfig, type Skill, type SkillDisclosure, type SkillExecutionContext, type SkillFrontmatter, type SkillFs, type SkillModelTier, type SkillPolicy, type SkillRegistryRef, type SkillSource, type SkillToolDeps, type SkillToolHeader, type SlotName, type SmartAgentBudgetConfig, type SmartAgentContextConfig, type SmartAgentCustomProfileConfig, type SmartAgentDelegationConfig, type SmartAgentEvent, type SmartAgentInstance, type SmartAgentLimits, type SmartAgentMemoryConfig, type SmartAgentOptions, type SmartAgentPlanningConfig, type SmartAgentSummarizationConfig, type SmartAgentToolResponseConfig, type SmartAgentTracingConfig, type SmartModel, type SmartState, type SmartToolFn, type SnapshotOptions, type SnapshotRuntimeHint, type StreamChunk, type StreamEvent, type StrictRestorers, type StrictTransform, type StructuredOutputError, type StructuredOutputFieldError, StructuredOutputManager, type StructuredOutputManagerConfig, type StructuredOutputResult, type StructuredOutputStrategy, type StructuredSummary, type SubagentDef, type SubagentEvent, type SubagentMode, type SubagentPendingRecord, type SubagentPolicy, type SubagentRegistryRef, type SubagentResult, type SubagentToolDeps, type SubagentToolNames, type SummarizationEvent, type SummarizationMode, type SummarizerInput, type SummarizerResult, type SummarizerStrategy, type SummaryFactItem, type SummaryIntegrityCheck, TOOL_INPUT_DIGEST_KEY, type TokenCounter, TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallEvent, type ToolInputDigestOptions, type ToolInputDigestResult, type ToolInputRetentionPolicy, type ToolInterface, type ToolPolicyConfig, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetentionDeclarations, type ToolRetentionSpec, type ToolRetryPolicy, type ToolRule, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessagePart, type TraceMessageSection, type TraceMetadataSection, type TraceSessionConfigSnapshot, type TraceSessionFile, type TraceSessionStatus, type TraceSessionSummary, type TraceSinkCognipeerConfig, type TraceSinkConfig, type TraceSinkCustomConfig, type TraceSinkFileConfig, type TraceSinkHttpConfig, type TraceSinkOtlpConfig, type TraceSinkSnapshot, type TraceSummarySection, type TraceToolCallSection, type TraceToolDefinition, type TraceToolDefinitionsSection, type TraceToolDetails, type TraceToolResponseSection, type TraceToolResultSection, type TracingConfig, type TracingMode, UnifiedMessage, type UserQuestionAnswer, type UserQuestionAnswerSet, type UserQuestionEvent, type UserQuestionItem, type UserQuestionOption, type UserQuestionResolution, type UserQuestionStatus, VertexProvider, VertexProviderConfig, type VolatileContentFinding, type VolatileContentPattern, type WebhookApprovalConfig, agentVerdictRule, appendBoundTools, auditLog, azureContentSafety, bedrockGuardrail, budgetGuard, buildHandoffTools, buildResponseFormatSection, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, buildToolDefinitionsSection, canOpenSkill, canSpawn, captureSnapshot, checkpointing, codePresenceRule, coerceToolArgs, cognipeerGuardrail, cognipeerSink, collectAttachments, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, contentPartToText, contentToString, conversationHistory, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createGuardrailPlugin, createJsonGuardrail, createManageTodoListAliasTool, createManageTodoTool, createOpenSkillTool, createParallelTool, createPluginHost, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customGuardrail, customSink, dedupeToolsByName, defaultTokenCounter, defineHook, definePlugin, describeContentPart, detectLanguage, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, evaluateGuardrails, extractLatestUserQuery, extractMessageText, fileCheckpointStore, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasMediaPart, hasToolResponseRecoveryReference, httpGuardrail, httpSink, inMemoryCheckpointStore, inMemoryConversationStore, isHookImplemented, isOpenAIHostedEndpoint, isSmartModel, isValidIban, isValidLuhn, isValidTckn, jsonSchemaRule, defaultBuildPayload as langfuseDefaultPayload, langfuseTracing, languageGuard, loadSkillsFromDisk, mapConsoleHookVerdict, mapTextParts, mcp, mediaKindOf, mediaPolicy, normalizeSmartAgentOptions, normalizeVerdicts, openAIModeration, otelTracing, otlpSink, outputGuard, parseApprovalDecision, parseSkillFrontmatter, pathSandbox, piiRedaction, pluginCapabilities, portkeyGateway, portkeyGuardrail, preopenSkills, preopenToolCallId, prepareStrictToolMenu, promptInjectionGuard, rateLimit, readMemoryFacts, redactText, regexGuardrail, regexRule, replaceTextContent, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, responseCache, restoreSnapshot, restoreToolCalls, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, sessionMetrics, setTokenCounter, startStreamingSession, summarizeObject, supportsAdaptiveThinking, textFromContent, toMessageUsage, toStrictCompatible, toStrictToolSchema, tokenize, toolPolicy, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, webhookApproval, withTools, withinDepth, writeSummaryFactsToMemory };