@cognipeer/agent-sdk 0.19.0 → 0.22.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.cts CHANGED
@@ -1,7 +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--welxWDw.cjs';
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--welxWDw.cjs';
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, e as ReasoningBlock, T as ToolDefinition, f as TokenUsage, A as AnthropicProviderConfig, g as AzureProviderConfig, B as BedrockProviderConfig, h as PromptCachingConfig, V as VertexProviderConfig, i as ReasoningRequestConfig, j as ProviderConfig, k as ProviderError } from './model-rules-D6teB4rU.cjs';
4
+ export { a6 as AudioContent, L as EffortMapping, a2 as EmbeddingInputType, a1 as EmbeddingUsage, a5 as FileContent, $ as FinishReason, a4 as ImageContent, x as MAX_ADJUSTMENTS, m as MODEL_RULES, Y as MaxTokensParam, G as ModelRule, H as ModelRules, W as OffMechanism, _ as ParsedModelError, a0 as ProviderResponseFields, a7 as ProviderToolCall, a8 as ProviderTransportConfig, K as ReasoningEffort, S as ReasoningStyle, I as ResolvedModelRule, N as RuleFamily, Q as RuleSource, Z as SamplingField, X as TemperatureRule, a3 as TextContent, p as allowsSampling, q as applyDropParams, w as asModelRequestError, F as clearLearnedModelRules, s as effortBudget, l as emptyUsage, z as getLearnedModelRulePatch, y as listLearnedModelRules, n as mapReasoningEffort, t as mergeRulePatch, o as modelIdCandidates, u as parseModelError, D as rememberModelRulePatch, r as resolveModelRule, v as runWithModelAdjustments } from './model-rules-D6teB4rU.cjs';
5
5
 
6
6
  /** Describes what a model/provider natively supports. */
7
7
  type ModelCapabilities = {
@@ -274,6 +274,9 @@ declare function mapTextParts(content: string | ContentPart[] | unknown, fn: (te
274
274
  * and the rest are dropped — media parts keep their positions either way. A
275
275
  * plugin that needs exact multi-part fidelity should return `content` instead,
276
276
  * which is why that field exists.
277
+ *
278
+ * A prompt-cache breakpoint is not lost with a merged-away part: when the first
279
+ * text part carries none, it takes the last one the dropped parts carried.
277
280
  */
278
281
  declare function replaceTextContent(content: string | ContentPart[] | unknown, text: string): string | ContentPart[] | unknown;
279
282
  /** Every non-text part of a message, normalized for policy code. */
@@ -933,11 +936,19 @@ type ContextBuilder = {
933
936
  defaultMessages: Message[];
934
937
  }, ctx: HookContext): MaybePromise<Message[]>;
935
938
  };
939
+ /**
940
+ * USD cost of one model call. `inputTokens` is INCLUSIVE: uncached + cache read +
941
+ * cache write. `cachedInputTokens` (cache read) and `cacheWriteTokens` (cache
942
+ * write) are subsets of it, `reasoningTokens` is a subset of `outputTokens`, so
943
+ * a price table bills `(input - cached - cacheWrite) * in + cached * read +
944
+ * cacheWrite * write + output * out`.
945
+ */
936
946
  type CostEstimator = (args: {
937
947
  modelName?: string;
938
948
  inputTokens: number;
939
949
  outputTokens: number;
940
950
  cachedInputTokens?: number;
951
+ cacheWriteTokens?: number;
941
952
  reasoningTokens?: number;
942
953
  }) => number;
943
954
  /**
@@ -1431,6 +1442,10 @@ type ImageURL = {
1431
1442
  type ContentPart = {
1432
1443
  type: 'text';
1433
1444
  text: string;
1445
+ cacheControl?: {
1446
+ type: 'ephemeral';
1447
+ ttl?: '5m' | '1h';
1448
+ };
1434
1449
  } | {
1435
1450
  type: 'image_url';
1436
1451
  image_url: ImageURL;
@@ -1677,12 +1692,15 @@ type AgentOptions = {
1677
1692
  * Pluggable cost estimator: returns USD cost for a single model call's
1678
1693
  * usage. Used by the `maxCostUsd` budget limit. When omitted the SDK has
1679
1694
  * no built-in pricing table and the cost limit is a no-op.
1695
+ * `inputTokens` is inclusive (uncached + cache read + cache write);
1696
+ * `cachedInputTokens` and `cacheWriteTokens` are subsets of it.
1680
1697
  */
1681
1698
  costEstimator?: (args: {
1682
1699
  modelName?: string;
1683
1700
  inputTokens: number;
1684
1701
  outputTokens: number;
1685
1702
  cachedInputTokens?: number;
1703
+ cacheWriteTokens?: number;
1686
1704
  reasoningTokens?: number;
1687
1705
  }) => number;
1688
1706
  /**
@@ -1920,6 +1938,19 @@ type SmartAgentSummarizationConfig = {
1920
1938
  * rendered to every later turn as "still in force — follow them".
1921
1939
  */
1922
1940
  groundDirectives?: boolean;
1941
+ /**
1942
+ * Output-token cap of the summarizer call (default 8192; `0` sends no cap). The
1943
+ * summary is a bounded JSON document; a cap far below it cuts the reply off and
1944
+ * the pass is skipped (see `status: "fallback"`), while no cap leaves the provider
1945
+ * default, which on some providers is a few hundred tokens.
1946
+ */
1947
+ outputMaxTokens?: number;
1948
+ /**
1949
+ * Reasoning effort of the summarizer call (default `"none"`). Summarizing is
1950
+ * compression, not problem solving, and reasoning tokens spend the same output
1951
+ * budget as the summary itself. Set a level to let a reasoning model think first.
1952
+ */
1953
+ reasoningEffort?: NonNullable<NativeReasoningConfig["effort"]>;
1923
1954
  };
1924
1955
  type SmartAgentBudgetConfig = {
1925
1956
  systemReserveTokens?: number;
@@ -2025,7 +2056,7 @@ type SmartAgentCustomProfileConfig = {
2025
2056
  };
2026
2057
  type ProfileConfig = {
2027
2058
  limits: Required<AgentLimits>;
2028
- summarization: Required<SmartAgentSummarizationConfig>;
2059
+ summarization: Required<Omit<SmartAgentSummarizationConfig, "outputMaxTokens" | "reasoningEffort">> & Pick<SmartAgentSummarizationConfig, "outputMaxTokens" | "reasoningEffort">;
2029
2060
  context: Required<SmartAgentContextConfig> & {
2030
2061
  budget: Required<SmartAgentBudgetConfig>;
2031
2062
  };
@@ -2687,6 +2718,7 @@ type AgentState = {
2687
2718
  timestamp: string;
2688
2719
  turn: number;
2689
2720
  cachedInput?: number;
2721
+ cacheWrite?: number;
2690
2722
  /** Present when a sub-agent made this call; it was merged in from the child's run. */
2691
2723
  subagent?: {
2692
2724
  name: string;
@@ -2699,6 +2731,7 @@ type AgentState = {
2699
2731
  output: number;
2700
2732
  total: number;
2701
2733
  cachedInput: number;
2734
+ cacheWriteInput?: number;
2702
2735
  }>;
2703
2736
  };
2704
2737
  guardrailResult?: GuardrailOutcome;
@@ -2784,9 +2817,60 @@ type PlanEvent = {
2784
2817
  todoList?: PlanStepRecord[];
2785
2818
  version?: number;
2786
2819
  adherenceScore?: number;
2820
+ /** Number of steps in the snapshot. */
2821
+ count?: number;
2822
+ /**
2823
+ * The model tool call that produced this snapshot, so a consumer can place the
2824
+ * plan in the transcript next to the call. Per call, not per tool object: two
2825
+ * plan calls in one turn each carry their own id.
2826
+ */
2827
+ toolCallId?: string;
2787
2828
  };
2788
2829
  type SummarizationEvent = {
2789
2830
  type: "summarization";
2831
+ /**
2832
+ * The identity of the pass: its synthetic `summarize_context` tool-call id
2833
+ * (`call_summary_<ts>_<suffix>`, unique to the pass), the same id the
2834
+ * transcript marker message carries. Shared by the `start` and the terminal
2835
+ * event of one pass, so a consumer pairs events by `id` (not by `pass`).
2836
+ */
2837
+ id?: string;
2838
+ /**
2839
+ * `start` is emitted just before the summarizer model call, `done` when the pass
2840
+ * replaced context, `skipped` when a pass that started ended without replacing
2841
+ * anything (or failed, see `status`). Absent means `done` (events from before
2842
+ * this field existed). A consumer that counts passes must count only
2843
+ * `done`/absent.
2844
+ */
2845
+ phase?: "start" | "done" | "skipped";
2846
+ /**
2847
+ * Summaries so far + 1 (1-based). A pass that ends `skipped` makes no summary,
2848
+ * so the next pass has the same number: `pass` is for display, `id` is the
2849
+ * identity.
2850
+ */
2851
+ pass?: number;
2852
+ /** Where in the run loop the pass was triggered. */
2853
+ trigger?: "pre_leg" | "mid_leg" | "post_tools";
2854
+ /**
2855
+ * `ok`; `fallback` when the summarizer failed and a deterministic fallback
2856
+ * summary was used, or, on a `skipped` pass, when its reply was unusable (cut off
2857
+ * at its output limit, empty, JSON with no summary in it): nothing was replaced and
2858
+ * the previous summary stays the latest; `error` when the pass itself failed
2859
+ * unexpectedly (not the model call) and ended `skipped` just before the failure was
2860
+ * rethrown.
2861
+ */
2862
+ status?: "ok" | "fallback" | "error";
2863
+ /**
2864
+ * The failure's message when `status` is `fallback` or `error`, clipped to 300
2865
+ * characters. It is provider text for operators and logs, not for end users;
2866
+ * the trace keeps the whole message.
2867
+ */
2868
+ error?: string;
2869
+ /** The tool results THIS pass replaced (not those of earlier passes). */
2870
+ compactedTools?: Array<{
2871
+ toolCallId: string;
2872
+ toolName: string;
2873
+ }>;
2790
2874
  summary: string;
2791
2875
  /** Number of messages that were compressed/summarized */
2792
2876
  messagesCompressed?: number;
@@ -3346,6 +3430,12 @@ declare function createToolLimitFinalizeNode(_opts: SmartAgentOptions): (state:
3346
3430
 
3347
3431
  /** ctx key: the last pass's model call, read (and removed) by the smart driver for `postCompact`. */
3348
3432
  declare const LAST_SUMMARIZATION_CALL_KEY = "__lastSummarizationCall";
3433
+ /**
3434
+ * ctx key the smart driver sets, on the state it hands the node, to say where in
3435
+ * the run loop the pass was triggered. It is input only: the driver removes it
3436
+ * from the ctx the node returns, so it never reaches persisted state.
3437
+ */
3438
+ declare const SUMMARIZATION_TRIGGER_KEY = "__summarizationTrigger";
3349
3439
  /**
3350
3440
  * Creates the summarization node.
3351
3441
  *
@@ -3882,6 +3972,20 @@ type CreateGuardrailOptions = {
3882
3972
  };
3883
3973
  declare function createGuardrail(options: CreateGuardrailOptions): ConversationGuardrail;
3884
3974
 
3975
+ /**
3976
+ * How a set of usage counters counts tokens. `usageBasisOf` answers it for a
3977
+ * provider's native `TokenUsage`; on a wire message it describes the numbers
3978
+ * the message carries. `fromNativeProvider` converts to the inclusive shape, so
3979
+ * the messages it makes declare no basis (an empty `{}` is "no claim"); a
3980
+ * hand-built or LangChain message can still declare one.
3981
+ */
3982
+ type WireUsageBasis = {
3983
+ /** `inputTokens` leaves out the cache read / write tokens (Anthropic, Bedrock). */
3984
+ inputExcludesCache?: true;
3985
+ /** `outputTokens` leaves out the reasoning tokens (Vertex). */
3986
+ outputExcludesReasoning?: true;
3987
+ };
3988
+
3885
3989
  type ProviderRetryPolicy = {
3886
3990
  /** Maximum number of retries on 429/5xx responses. Default: 3. */
3887
3991
  maxRetries?: number;
@@ -3897,6 +4001,16 @@ type ProviderRetryPolicy = {
3897
4001
  };
3898
4002
  declare abstract class BaseProvider {
3899
4003
  abstract readonly providerName: ProviderType;
4004
+ /**
4005
+ * How this provider's `TokenUsage` counts tokens. Unset = derive it from
4006
+ * `providerName` (`usageBasisOf`: Anthropic / Bedrock `inputTokens` leave out the
4007
+ * cache read + write, Vertex `outputTokens` leaves out the reasoning). An
4008
+ * explicit `{}` = already inclusive: a gateway or wrapper that normalised the
4009
+ * usage itself. `fromNativeProvider` converts to the inclusive `MessageUsage`
4010
+ * with this basis, so a provider that reports inclusive counts under a
4011
+ * provider name that is exclusive by default must declare `{}`.
4012
+ */
4013
+ readonly usageBasis?: WireUsageBasis;
3900
4014
  protected retryPolicy: ProviderRetryPolicy;
3901
4015
  /** Injected `fetch` (config.fetch); falls back to the global one at call time. */
3902
4016
  protected fetchImpl?: typeof fetch;
@@ -6231,6 +6345,42 @@ declare const GENAI_SEMCONV_COMMIT = "547934a";
6231
6345
  /** True when the model's rule uses `thinking:{type:"adaptive"}` + `output_config.effort` (Claude 4.6+ / 5.x). */
6232
6346
  declare function supportsAdaptiveThinking(model: unknown): boolean;
6233
6347
 
6348
+ /** A Responses `reasoning` output item, as far as this file reads it. */
6349
+ type ResponsesReasoningItem = {
6350
+ type?: string;
6351
+ id?: string;
6352
+ summary?: Array<{
6353
+ type?: string;
6354
+ text?: string;
6355
+ }>;
6356
+ content?: unknown[] | null;
6357
+ encrypted_content?: string | null;
6358
+ [key: string]: unknown;
6359
+ };
6360
+ /**
6361
+ * A Responses reasoning item kept on `reasoning.blocks` so the next call of the
6362
+ * same tool loop can hand it back (see `captureReasoningBlocks`). It is typed
6363
+ * `thinking` with no `signature`, which Anthropic / Bedrock replay skips, and
6364
+ * carries the item under `openaiResponses`:
6365
+ * - `item` the output item as the API returned it (`encrypted_content` is what makes it replayable)
6366
+ * - `origin` provider | endpoint | model that produced it; the blob only decrypts for that account
6367
+ * - `next` what followed it in the output (`"message"`, or `call:<call_id>`): it must go back right before that item
6368
+ * - `nextId` the `id` of that function call item (`fc_…`), for an endpoint that wants the pair back with its ids (Azure)
6369
+ */
6370
+ type ResponsesReasoningBlock = ReasoningBlock & {
6371
+ openaiResponses: {
6372
+ item: ResponsesReasoningItem;
6373
+ origin: string;
6374
+ next: string;
6375
+ nextId?: string;
6376
+ };
6377
+ };
6378
+ /** What `toResponsesInput` hands `expandResponsesInput` for a replayed reasoning item (`nextId`: see `ResponsesReasoningBlock`). */
6379
+ type ReplayedReasoning = {
6380
+ next: string;
6381
+ item: Record<string, any>;
6382
+ nextId?: string;
6383
+ };
6234
6384
  declare class OpenAIProvider extends BaseProvider {
6235
6385
  readonly providerName: ProviderType;
6236
6386
  protected readonly apiKey: string;
@@ -6245,6 +6395,8 @@ declare class OpenAIProvider extends BaseProvider {
6245
6395
  /** `api: "responses"` was passed (the legacy `responsesApi: "always"` keeps its old single-call behaviour). */
6246
6396
  private readonly apiResponsesNative;
6247
6397
  protected readonly maxTokensParam: "auto" | "max_tokens" | "max_completion_tokens";
6398
+ /** Origins (see `responsesOrigin`) whose endpoint refused a replayed reasoning item: not replayed again by this instance. */
6399
+ private readonly reasoningReplayRefused;
6248
6400
  constructor(config: OpenAIProviderConfig);
6249
6401
  /** True when the caller listed this request's model in `responsesApiModels`. */
6250
6402
  private isResponsesApiModel;
@@ -6268,7 +6420,12 @@ declare class OpenAIProvider extends BaseProvider {
6268
6420
  protected embeddingsFetch(body: Record<string, any>, signal?: AbortSignal): Promise<Response>;
6269
6421
  /** Chat Completions call that corrects itself from the provider's own 400s (see models/adjust.ts). */
6270
6422
  private fetchChat;
6271
- /** Same for the Responses API. */
6423
+ /**
6424
+ * Same for the Responses API. Replaying reasoning items is an optimisation and
6425
+ * must never break a call: when the endpoint answers a request that carries
6426
+ * them with a 400 no model adjustment explains, the request goes out once more
6427
+ * without them, and when that one succeeds they are not replayed to that origin again.
6428
+ */
6272
6429
  private fetchResponses;
6273
6430
  protected buildRequestBody(request: ChatCompletionRequest, stream: boolean, overlay?: RulePatch): Record<string, any>;
6274
6431
  protected completeResponses(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
@@ -6276,13 +6433,56 @@ declare class OpenAIProvider extends BaseProvider {
6276
6433
  * `responsesApiModels` with `responsesStreaming` on. Emits the same chunk
6277
6434
  * shapes as the Chat Completions stream: text deltas as they arrive, a tool
6278
6435
  * call's id + name when it opens and its argument fragments under that id,
6279
- * then one final chunk with usage, finish reason and any reasoning summary
6280
- * (taken from the completed response, exactly as the non-streaming parse
6281
- * reads it). */
6436
+ * then one final chunk with usage, finish reason, any reasoning summary and
6437
+ * the reasoning blocks to replay (taken from the completed response, exactly
6438
+ * as the non-streaming parse reads them). A stream that ends without
6439
+ * `response.completed` is an error, not a clean stop. */
6282
6440
  private streamResponses;
6283
- protected buildResponsesBody(request: ChatCompletionRequest, overlay?: RulePatch): Record<string, any>;
6284
- /** Maps a unified message to a Responses API `input` item. */
6285
- protected toResponsesInput(m: UnifiedMessage): Record<string, any>;
6441
+ protected buildResponsesBody(request: ChatCompletionRequest, overlay?: RulePatch, opts?: {
6442
+ replayReasoning?: boolean;
6443
+ }): Record<string, any>;
6444
+ /** Whether the Responses endpoint takes `include: ["reasoning.encrypted_content"]`. Azure's older dated api-versions do not. */
6445
+ protected acceptsEncryptedReasoningInclude(): boolean;
6446
+ /**
6447
+ * Who a reasoning item was produced for. `encrypted_content` only decrypts for
6448
+ * the account that minted it, so an item goes back only to the same provider,
6449
+ * endpoint and model. Azure overrides the endpoint part.
6450
+ */
6451
+ protected responsesOrigin(model: string): string;
6452
+ /**
6453
+ * The reasoning items of an assistant turn that are safe to hand back: those
6454
+ * this origin produced and that carry `encrypted_content` (the opaque payload
6455
+ * is the whole point; an item without it is only a reference to stored state
6456
+ * that may be gone). Blocks from another provider are skipped.
6457
+ */
6458
+ protected replayableReasoning(m: UnifiedMessage, origin: string): ReplayedReasoning[];
6459
+ /**
6460
+ * Whether a replayed reasoning item, and the function call it preceded, go back with the ids
6461
+ * the API gave them. No by default: the id is a pointer into the server's storage, a stored
6462
+ * item must then be followed by the exact item that followed it ("Item 'rs_…' of type
6463
+ * 'reasoning' was provided without its required following item") and can have expired,
6464
+ * while `encrypted_content` is self-contained. AzureProvider says yes: its docs replay the
6465
+ * items with their ids, and it is reported to answer one without its `id` with 400 `invalid_payload`.
6466
+ */
6467
+ protected replaysItemIds(): boolean;
6468
+ /**
6469
+ * A captured reasoning item as it goes back in `input`: type, summary and
6470
+ * `encrypted_content` (plus the reasoning text when the server gave it), never the
6471
+ * `status`; the `id` only when `replaysItemIds()`. Undefined when the item cannot
6472
+ * go back in that shape (an id is required and the item has none).
6473
+ */
6474
+ protected reasoningInputItem(item: ResponsesReasoningItem): Record<string, any> | undefined;
6475
+ /**
6476
+ * The reasoning items of a Responses output worth keeping on `reasoning.blocks`
6477
+ * for the next call of the same tool loop. Only a turn that calls functions
6478
+ * continues (a final answer has nothing to hand back), and only an item with
6479
+ * `encrypted_content` followed by a message or a function call can go back as
6480
+ * it came, right before that item.
6481
+ */
6482
+ protected captureReasoningBlocks(output: unknown, model: string): ResponsesReasoningBlock[];
6483
+ /** Maps a unified message to a Responses API `input` item. `replayOrigin` is set for the
6484
+ * assistant turns of the tool loop in progress: their reasoning items go back in. */
6485
+ protected toResponsesInput(m: UnifiedMessage, replayOrigin?: string): Record<string, any>;
6286
6486
  protected responsesFetch(body: Record<string, any>, signal?: AbortSignal): Promise<Response>;
6287
6487
  protected parseResponsesResponse(json: any, modelId: string): ChatCompletionResponse;
6288
6488
  protected toOpenAIMessage(m: UnifiedMessage): Record<string, any>;
@@ -6299,13 +6499,40 @@ declare class AnthropicProvider extends BaseProvider {
6299
6499
  private readonly defaultModel;
6300
6500
  private readonly defaultHeaders;
6301
6501
  private readonly anthropicVersion;
6502
+ /** Provider name the model rules are looked up under (the Messages wire shape). */
6503
+ protected readonly rulesProvider: string;
6504
+ /** Keeps what a 400 taught apart from the direct API's (same model id, other backend). */
6505
+ protected readonly rulesScope?: string;
6506
+ /** Names the API in error messages: "<apiName> API error 400: ...". */
6507
+ protected readonly apiName: string;
6302
6508
  private readonly promptCachingEnabled;
6509
+ private readonly promptCaching;
6303
6510
  private readonly thinkingMode;
6304
6511
  constructor(config: AnthropicProviderConfig);
6305
6512
  complete(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
6306
6513
  completeStream(request: ChatCompletionRequest): AsyncGenerator<ChatCompletionChunk, void, unknown>;
6307
6514
  private buildRequestBody;
6308
- private splitSystemMessages;
6515
+ /**
6516
+ * Settles the cache breakpoints of a finished body so a request never carries
6517
+ * more than the 4 the API accepts (a 5th is a 400). In order:
6518
+ * 1. The caller's own come first: the `cacheControl` of text parts and any
6519
+ * `cache_control` in `extra`. Over the limit, the earliest ones made from parts
6520
+ * are dropped (a later breakpoint covers a longer prefix); a raw `extra` one
6521
+ * is never touched.
6522
+ * 2. The SDK's own, only while a slot is free and only on blocks it built: the
6523
+ * end of the static system prompt, the last tool, then top-level automatic
6524
+ * caching (it takes one slot, on the last cacheable block). A breakpoint the
6525
+ * caller already put on that block counts as the SDK's. Automatic caching is
6526
+ * left out when the request's last block carries a breakpoint of another
6527
+ * lifetime: it would land on that block, a 400 (the caller asked for 1h on the
6528
+ * tail, the provider default is 5m). At the same lifetime it is a no-op, and sent.
6529
+ * 3. A longer lifetime may not come after a shorter one (the API answers 400): a
6530
+ * 1h breakpoint after a 5m one, in the order tools, system, messages, is sent as
6531
+ * 5m. Only the ones the SDK made (from parts, or its own) are changed.
6532
+ */
6533
+ private settleCacheBreakpoints;
6534
+ /** `ttl` is sent only for 1h; the 5-minute default is the API's own. */
6535
+ private cacheControl;
6309
6536
  /**
6310
6537
  * Converts unified messages to Anthropic format, coalescing consecutive
6311
6538
  * tool-result messages into a single `user` turn.
@@ -6323,6 +6550,18 @@ declare class AnthropicProvider extends BaseProvider {
6323
6550
  /** Builds and sends the request; retries once with the other thinking form
6324
6551
  * when the upstream rejects the one we picked. */
6325
6552
  private send;
6553
+ /** The URL a request for `model` is posted to. */
6554
+ protected requestUrl(_model: string, _stream: boolean): string;
6555
+ /** Auth and version headers, plus the configured `defaultHeaders`. Called once per request, before any retry. */
6556
+ protected requestHeaders(): Promise<Record<string, string>>;
6557
+ /**
6558
+ * The JSON that goes on the wire for a built request body (the body itself is left as
6559
+ * it is). A backend that can never take part of the body throws a non-retryable
6560
+ * `ProviderError` here, before anything is sent.
6561
+ */
6562
+ protected wireBody(body: Record<string, any>): Record<string, any>;
6563
+ /** Puts the usage counters on the basis this provider reports. The default keeps the Messages API's own. */
6564
+ protected normalizeUsage(usage: TokenUsage): TokenUsage;
6326
6565
  private doFetch;
6327
6566
  private parseResponse;
6328
6567
  }
@@ -6334,19 +6573,48 @@ declare class AzureProvider extends OpenAIProvider {
6334
6573
  private readonly deploymentName?;
6335
6574
  private readonly azureApiKey;
6336
6575
  constructor(config: AzureProviderConfig);
6576
+ /** `apiVersion: "v1"` selects Azure's versionless v1 route, which this provider uses for the Responses API only. */
6577
+ private get usesV1Route();
6578
+ /** The `api-version` of the deployment routes (chat, embeddings): the v1 route has none, so under `"v1"` a dated one stands in. */
6579
+ private get datedApiVersion();
6580
+ /** Reasoning items only decrypt for the resource that minted them: the Azure endpoint, not the dummy OpenAI base URL, is the scope. */
6581
+ protected responsesOrigin(model: string): string;
6582
+ /** Azure's docs replay the output items as they came, so the reasoning item and the function call it preceded go
6583
+ * back with their ids; a reasoning item without its `id` is reported to be refused (400 `invalid_payload`). */
6584
+ protected replaysItemIds(): boolean;
6337
6585
  protected doFetch(body: Record<string, any>, signal?: AbortSignal): Promise<Response>;
6338
6586
  /** Azure embeddings: the deployment named by the request's model (falling back
6339
6587
  * to the configured deployment) in the path, api-key auth. */
6340
6588
  protected embeddingsFetch(body: Record<string, any>, signal?: AbortSignal): Promise<Response>;
6589
+ /**
6590
+ * Encrypted reasoning items are new in api-version 2025-04-01-preview (2025-03-01-preview
6591
+ * is the first Responses version), so a dated version before that gets no `include`
6592
+ * for them. The v1 route, `preview` and `latest` have them; a version that cannot be read is left out.
6593
+ */
6594
+ protected acceptsEncryptedReasoningInclude(): boolean;
6341
6595
  /** Azure exposes the Responses API at /openai/responses with api-key auth.
6342
6596
  * Reasoning summaries require a preview api-version; callers can override via
6343
- * the `apiVersion` config. */
6597
+ * the `apiVersion` config. `apiVersion: "v1"` uses the versionless v1 route
6598
+ * (`/openai/v1/responses`, no `api-version` query); chat and embeddings keep
6599
+ * their dated deployment routes, so under "v1" v1 is Responses-only. */
6344
6600
  protected responsesFetch(body: Record<string, any>, signal?: AbortSignal): Promise<Response>;
6345
6601
  }
6346
6602
 
6347
6603
  declare class OpenAICompatibleProvider extends OpenAIProvider {
6348
6604
  readonly providerName: ProviderType;
6605
+ private readonly promptCachingEnabled;
6606
+ private readonly promptCaching;
6607
+ private readonly replayReasoningContent;
6349
6608
  constructor(config: OpenAICompatibleProviderConfig);
6609
+ /** Adds this provider's cache markers (when `prompt_caching` is on) before the body is built. */
6610
+ protected buildRequestBody(request: ChatCompletionRequest, stream: boolean, overlay?: RulePatch): Record<string, any>;
6611
+ /**
6612
+ * Chat Completions message with what only a compatible server takes:
6613
+ * `cache_control` on text parts the caller (or `prompt_caching`) marked, and,
6614
+ * with `replayReasoningContent`, the assistant's reasoning text as
6615
+ * `reasoning_content`. OpenAI and Azure never get either field.
6616
+ */
6617
+ protected toOpenAIMessage(m: UnifiedMessage): Record<string, any>;
6350
6618
  }
6351
6619
 
6352
6620
  declare class BedrockProvider extends BaseProvider {
@@ -6356,6 +6624,7 @@ declare class BedrockProvider extends BaseProvider {
6356
6624
  private readonly defaultModel;
6357
6625
  private readonly defaultHeaders;
6358
6626
  private readonly promptCachingEnabled;
6627
+ private readonly promptCaching;
6359
6628
  private readonly thinkingMode;
6360
6629
  constructor(config: BedrockProviderConfig);
6361
6630
  complete(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
@@ -6379,7 +6648,31 @@ declare class BedrockProvider extends BaseProvider {
6379
6648
  embed(request: EmbeddingRequest): Promise<EmbeddingResponse>;
6380
6649
  private invokeModel;
6381
6650
  private buildConverseBody;
6382
- private splitSystemMessages;
6651
+ /**
6652
+ * The `system` blocks of a group of system messages: one text block per message
6653
+ * (blank text has no block: Converse rejects it), cut after each text part the
6654
+ * caller marked for caching, which gets a checkpoint right after it.
6655
+ */
6656
+ private toBedrockSystem;
6657
+ /**
6658
+ * Settles the cache checkpoints of a finished body so a request never carries more
6659
+ * than the 4 Converse accepts. In order:
6660
+ * 1. The caller's own come first: the `cacheControl` of text parts and any
6661
+ * `cachePoint` in `extra`. Over the limit, the earliest ones made from parts are
6662
+ * dropped (a later checkpoint covers a longer prefix); a raw `extra` one is
6663
+ * never touched. They are sent whether or not `prompt_caching` is enabled: that
6664
+ * switch is for the SDK's own, and a marker is an explicit request.
6665
+ * 2. The SDK's own, only while a slot is free (`prompt_caching.enabled`) and only on
6666
+ * blocks it built: after the static system prompt, after the tools (not on Nova,
6667
+ * which takes none there) and, with strategy `auto`, at the end of the last user
6668
+ * message: a rolling breakpoint, each request writes at the new tail and reads
6669
+ * the previous prefix (Bedrock looks back ~20 content blocks). A checkpoint the
6670
+ * caller already put at that spot counts as the SDK's.
6671
+ * 3. A longer lifetime may not come after a shorter one: in the order Bedrock reads
6672
+ * them (tools, system, messages) a 1h checkpoint after a 5m one is sent as 5m.
6673
+ * Only the ones the SDK made (from parts, or its own) are changed.
6674
+ */
6675
+ private settleCheckpoints;
6383
6676
  /**
6384
6677
  * Converts unified messages to Bedrock Converse format, coalescing
6385
6678
  * consecutive tool-result messages into a single `user` turn.
@@ -6392,6 +6685,12 @@ declare class BedrockProvider extends BaseProvider {
6392
6685
  * blocks at messages.N.content for the following Ids: ...".
6393
6686
  */
6394
6687
  private toBedrockMessages;
6688
+ /**
6689
+ * One tool result: the `toolResult` block (`status` "error" when the host flagged the
6690
+ * result as one, which Converse documents for Nova and Claude), then a checkpoint
6691
+ * when a text part of the result carried the caller's `cacheControl`: a toolResult
6692
+ * has no cachePoint member of its own, so it goes after the whole block.
6693
+ */
6395
6694
  private toBedrockToolResult;
6396
6695
  private toBedrockMessage;
6397
6696
  private toBedrockTool;
@@ -6402,18 +6701,62 @@ declare class BedrockProvider extends BaseProvider {
6402
6701
  private parseResponse;
6403
6702
  }
6404
6703
 
6704
+ /**
6705
+ * Options of the Claude path, accepted next to the usual Vertex config.
6706
+ * They have no effect on Gemini models.
6707
+ */
6708
+ type VertexClaudeOptions = {
6709
+ /**
6710
+ * Prompt caching for Claude models: same shape and meaning as on
6711
+ * `AnthropicProviderConfig.prompt_caching` (explicit breakpoints on the system
6712
+ * prompt and the last tool, plus top-level automatic caching with the default
6713
+ * `strategy: "auto"`). Off unless `enabled: true`.
6714
+ */
6715
+ prompt_caching?: PromptCachingConfig;
6716
+ /** Thinking request shape for Claude models, as on `AnthropicProviderConfig.thinkingMode`. */
6717
+ thinkingMode?: "auto" | "adaptive" | "budget";
6718
+ };
6719
+
6720
+ /** How Google credentials are obtained, accepted next to the usual Vertex config. */
6721
+ type VertexAuthOptions = {
6722
+ /**
6723
+ * How long the `gcloud auth print-access-token` fallback (no `accessToken` and no
6724
+ * `serviceAccountJson`) may run before it is killed. Default 30000. A slow
6725
+ * first call (cold CLI, credential refresh) is not a failure.
6726
+ */
6727
+ gcloudTimeoutMs?: number;
6728
+ };
6405
6729
  declare class VertexProvider extends BaseProvider {
6406
6730
  readonly providerName: ProviderType;
6407
6731
  private readonly projectId;
6408
6732
  private readonly location;
6733
+ /** Where Claude models are called: the configured `location`, or `global` when none was set. */
6734
+ private readonly claudeLocation;
6409
6735
  private readonly defaultModel;
6410
6736
  private readonly defaultHeaders;
6737
+ /** An explicit `accessToken`, or the token the gcloud fallback produced. Service-account tokens live in a module-level cache instead. */
6411
6738
  private accessToken?;
6412
6739
  private serviceAccountJson?;
6413
6740
  private tokenExpiry;
6414
- constructor(config: VertexProviderConfig);
6741
+ private gcloudRefresh?;
6742
+ private readonly gcloudTimeoutMs;
6743
+ private readonly claudeConfig;
6744
+ private claude?;
6745
+ /**
6746
+ * A model id that starts with `claude` (or `publishers/anthropic/models/claude...`)
6747
+ * is served by the Claude publisher: same project, location and credentials,
6748
+ * `:rawPredict` / `:streamRawPredict`. `prompt_caching` and `thinkingMode` apply to those.
6749
+ *
6750
+ * `location` defaults to `us-central1` for Gemini. That region does not serve the
6751
+ * newer Claude models (they need `global` or the `us` / `eu` multi-regions), so a
6752
+ * Claude call made with no explicit `location` goes to `global`; an explicit
6753
+ * `location` is always used as given.
6754
+ */
6755
+ constructor(config: VertexProviderConfig & VertexClaudeOptions & VertexAuthOptions);
6415
6756
  complete(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
6416
6757
  completeStream(request: ChatCompletionRequest): AsyncGenerator<ChatCompletionChunk, void, unknown>;
6758
+ /** The Claude-on-Vertex path, made on first use and sharing this provider's token handling. */
6759
+ private claudeProvider;
6417
6760
  /**
6418
6761
  * Vertex `:predict` embeddings (text-embedding-00x, text-multilingual-embedding,
6419
6762
  * gemini-embedding-001). `inputType` maps to the task type; `dimensions` to
@@ -6428,6 +6771,13 @@ declare class VertexProvider extends BaseProvider {
6428
6771
  private toGeminiContent;
6429
6772
  private toGeminiTool;
6430
6773
  private getAccessToken;
6774
+ /**
6775
+ * Cached per (service account, scope, key) at module level, so a provider built
6776
+ * per call does not sign a JWT and hit the token endpoint every time. Callers
6777
+ * arriving while a refresh runs await the same request; a failed refresh is
6778
+ * not cached.
6779
+ */
6780
+ private getServiceAccountToken;
6431
6781
  private getTokenFromServiceAccount;
6432
6782
  private doFetch;
6433
6783
  private parseResponse;
@@ -6472,9 +6822,14 @@ type NativeModelOptions = {
6472
6822
  * completion_tokens_details: { reasoning_tokens },
6473
6823
  * }
6474
6824
  * ```
6475
- * `completion_tokens` INCLUDES `reasoning_tokens`; `prompt_tokens` INCLUDES
6476
- * `cached_tokens`. `response_metadata.token_usage` additionally keeps the flat
6477
- * legacy `cached_tokens` / `cache_write_tokens` keys.
6825
+ * The shape is INCLUSIVE, and the adapter enforces it: `prompt_tokens` INCLUDES
6826
+ * `cached_tokens` and `cache_write_tokens`, `completion_tokens` INCLUDES
6827
+ * `reasoning_tokens`, and `total_tokens = prompt_tokens + completion_tokens`
6828
+ * (cached tokens are never added on top). The providers' own `TokenUsage` keeps
6829
+ * its native basis (Anthropic / Bedrock `inputTokens` exclude the cache, Vertex
6830
+ * `outputTokens` excludes the reasoning); `fromNativeProvider` converts it.
6831
+ * `response_metadata.token_usage` additionally keeps the flat legacy
6832
+ * `cached_tokens` / `cache_write_tokens` keys.
6478
6833
  */
6479
6834
  type MessageUsage = {
6480
6835
  prompt_tokens: number;
@@ -6488,7 +6843,16 @@ type MessageUsage = {
6488
6843
  reasoning_tokens: number;
6489
6844
  };
6490
6845
  };
6491
- declare function toMessageUsage(u: TokenUsage): MessageUsage;
6846
+ /**
6847
+ * Converts a provider `TokenUsage` to the inclusive `MessageUsage`. `basis` says
6848
+ * how `u` counts tokens: `inputExcludesCache` adds the cache read + write to
6849
+ * the prompt, `outputExcludesReasoning` adds the reasoning to the completion.
6850
+ * Omitted (or `{}`) = `u` is already inclusive and is copied as it is. When a
6851
+ * basis adjusts anything the total is recomputed as prompt + completion (the
6852
+ * provider's own total is not trusted to include the same parts); otherwise the
6853
+ * provider's total is kept.
6854
+ */
6855
+ declare function toMessageUsage(u: TokenUsage, basis?: WireUsageBasis): MessageUsage;
6492
6856
  /**
6493
6857
  * Creates a BaseChatModel from a native provider.
6494
6858
  *
@@ -6525,13 +6889,15 @@ declare function fromNativeProvider(provider: BaseProvider, options?: NativeMode
6525
6889
  */
6526
6890
  declare function createProvider(config: ProviderConfig): BaseProvider;
6527
6891
 
6528
- type ModelRequestErrorCode = "unsupported_parameter" | "unsupported_value" | "model_request_invalid";
6892
+ type ModelRequestErrorCode = "unsupported_parameter" | "unsupported_value" | "max_tokens_too_large" | "model_request_invalid";
6529
6893
  type ModelRequestErrorInit = {
6530
6894
  status?: number;
6531
6895
  code: ModelRequestErrorCode;
6532
6896
  param?: string;
6533
6897
  value?: unknown;
6534
6898
  supportedValues?: string[];
6899
+ /** `max_tokens_too_large` only: the most completion tokens the server says it accepts, when its message states one. */
6900
+ maxAllowed?: number;
6535
6901
  provider: string;
6536
6902
  model: string;
6537
6903
  message: string;
@@ -6543,8 +6909,10 @@ declare class ModelRequestError extends ProviderError {
6543
6909
  readonly param?: string;
6544
6910
  readonly value?: unknown;
6545
6911
  readonly supportedValues?: string[];
6912
+ /** `code: "max_tokens_too_large"` only: the largest completion size the server states it takes (a retry with it is the caller's call). */
6913
+ readonly maxAllowed?: number;
6546
6914
  readonly model: string;
6547
6915
  constructor(init: ModelRequestErrorInit);
6548
6916
  }
6549
6917
 
6550
- 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 DeferredTraceEvent, type DelegationEventStamp, type DelegationMode, type DroppedDirective, EmbeddingRequest, EmbeddingResponse, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FinalAnswerEvent, GENAI_SEMCONV_COMMIT, 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, LAST_SUMMARIZATION_CALL_KEY, 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 OtlpContentField, type OtlpContentOptions, type OtlpContentRedactInfo, type OtlpExportOptions, type OtlpExportResult, type OtlpExportTraceServiceRequest, type OtlpExporter, type OtlpProtocol, type OtlpRetryOptions, type OtlpSemconv, 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 SubagentStatus, type SubagentToolDeps, type SubagentToolNames, type SubagentUsage, 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 ToolCallContext, 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 TraceContinuation, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessagePart, type TraceMessageSection, type TraceMetadataSection, type TraceParent, type TraceParentInput, 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, closeTraceContinuation, 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, createOtlpExporter, 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, foldSupersededSpans, formatTraceparent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasMediaPart, hasToolResponseRecoveryReference, httpGuardrail, httpSink, inMemoryCheckpointStore, inMemoryConversationStore, isHookImplemented, isOpenAIHostedEndpoint, isSmartModel, isTraceSessionOpen, isValidIban, isValidLuhn, isValidTckn, jsonSchemaRule, defaultBuildPayload as langfuseDefaultPayload, langfuseTracing, languageGuard, loadSkillsFromDisk, mapConsoleHookVerdict, mapTextParts, mcp, mediaKindOf, mediaPolicy, normalizeSmartAgentOptions, normalizeVerdicts, openAIModeration, otelTracing, otlpSink, outputGuard, parseApprovalDecision, parseSkillFrontmatter, parseTraceparent, pathSandbox, piiRedaction, pluginCapabilities, portkeyGateway, portkeyGuardrail, preopenSkills, preopenToolCallId, prepareStrictToolMenu, promptInjectionGuard, rateLimit, readMemoryFacts, readTraceContinuation, recordOrDeferTraceEvent, redactText, regexGuardrail, regexRule, replaceTextContent, replayDeferredTraceEvents, 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, toModelResult, toStrictCompatible, toStrictToolSchema, tokenize, toolPolicy, traceContinuationOf, traceSectionsFromMessages, traceSessionToOtlp, traceparentOf, validateReasoningConfig, validateToolArgs, webhookApproval, withTools, withinDepth, writeSummaryFactsToMemory };
6918
+ 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 DeferredTraceEvent, type DelegationEventStamp, type DelegationMode, type DroppedDirective, EmbeddingRequest, EmbeddingResponse, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FinalAnswerEvent, GENAI_SEMCONV_COMMIT, 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, LAST_SUMMARIZATION_CALL_KEY, 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 OtlpContentField, type OtlpContentOptions, type OtlpContentRedactInfo, type OtlpExportOptions, type OtlpExportResult, type OtlpExportTraceServiceRequest, type OtlpExporter, type OtlpProtocol, type OtlpRetryOptions, type OtlpSemconv, 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, PromptCachingConfig, 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, SUMMARIZATION_TRIGGER_KEY, 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 SubagentStatus, type SubagentToolDeps, type SubagentToolNames, type SubagentUsage, 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 ToolCallContext, 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 TraceContinuation, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessagePart, type TraceMessageSection, type TraceMetadataSection, type TraceParent, type TraceParentInput, 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, closeTraceContinuation, 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, createOtlpExporter, 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, foldSupersededSpans, formatTraceparent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasMediaPart, hasToolResponseRecoveryReference, httpGuardrail, httpSink, inMemoryCheckpointStore, inMemoryConversationStore, isHookImplemented, isOpenAIHostedEndpoint, isSmartModel, isTraceSessionOpen, isValidIban, isValidLuhn, isValidTckn, jsonSchemaRule, defaultBuildPayload as langfuseDefaultPayload, langfuseTracing, languageGuard, loadSkillsFromDisk, mapConsoleHookVerdict, mapTextParts, mcp, mediaKindOf, mediaPolicy, normalizeSmartAgentOptions, normalizeVerdicts, openAIModeration, otelTracing, otlpSink, outputGuard, parseApprovalDecision, parseSkillFrontmatter, parseTraceparent, pathSandbox, piiRedaction, pluginCapabilities, portkeyGateway, portkeyGuardrail, preopenSkills, preopenToolCallId, prepareStrictToolMenu, promptInjectionGuard, rateLimit, readMemoryFacts, readTraceContinuation, recordOrDeferTraceEvent, redactText, regexGuardrail, regexRule, replaceTextContent, replayDeferredTraceEvents, 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, toModelResult, toStrictCompatible, toStrictToolSchema, tokenize, toolPolicy, traceContinuationOf, traceSectionsFromMessages, traceSessionToOtlp, traceparentOf, validateReasoningConfig, validateToolArgs, webhookApproval, withTools, withinDepth, writeSummaryFactsToMemory };