@prestyj/ai 5.28.1 → 5.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -186,8 +186,24 @@ interface Usage {
186
186
  webFetchRequests?: number;
187
187
  };
188
188
  }
189
+ interface PreparedContext {
190
+ /** Read-only observation after generic sanitization/image limiting, before provider encoding.
191
+ * Do not log or retain these messages: they may contain secrets and image data. */
192
+ messages: readonly Message[];
193
+ tools: readonly {
194
+ name: string;
195
+ description: string;
196
+ parameters: Record<string, unknown>;
197
+ }[];
198
+ imagesBefore: number;
199
+ imagesAfter: number;
200
+ /** First message whose images were removed for this request, or null. */
201
+ firstImageDropMessage: number | null;
202
+ }
189
203
  interface StreamOptions {
190
204
  provider: Provider;
205
+ /** Optional, synchronous diagnostics observer. Exceptions cannot fail a model request. */
206
+ onContextPrepared?: (context: PreparedContext) => void;
191
207
  model: string;
192
208
  messages: Message[];
193
209
  tools?: Tool[];
@@ -207,6 +223,15 @@ interface StreamOptions {
207
223
  promptCacheKey?: string;
208
224
  /** OpenAI service tier for latency-sensitive requests. Only sent to first-party OpenAI API calls. */
209
225
  serviceTier?: "auto" | "default" | "flex" | "priority";
226
+ /** Codex endpoint only: send the Responses-Lite request shape (lite header,
227
+ * `parallel_tool_calls: false`, all-turns reasoning context). Unset follows
228
+ * the model family (on for gpt-5.6/gpt-6 models). Lite allows only one tool
229
+ * call per response, so turning it off lets the model batch calls. */
230
+ responsesLite?: boolean;
231
+ /** OpenAI only (Codex and API-key routes): send tools with strict
232
+ * (grammar-constrained) schemas. Default true. Strict calls carry every
233
+ * optional field as null, which costs output tokens and latency per call. */
234
+ strictTools?: boolean;
210
235
  /** OpenAI ChatGPT account ID (from OAuth JWT) for codex endpoint */
211
236
  accountId?: string;
212
237
  /** Stable conversation identity for Codex transport headers. This is distinct from
@@ -245,6 +270,14 @@ interface StreamOptions {
245
270
  * stalls — broken SSE connections (transient CDN / proxy issues) often
246
271
  * recover when the same request is issued over a plain HTTP request/response. */
247
272
  streaming?: boolean;
273
+ /** Cache prewarm (Anthropic only; other providers ignore it). Sends the exact
274
+ * same request prefix (system, tools, messages, thinking, betas) with
275
+ * `max_tokens: 1` over a non-streaming request so the prompt cache is written
276
+ * before the user's next real turn. If the configured thinking mode cannot be
277
+ * kept identical at `max_tokens: 1` (budget thinking requires
278
+ * budget_tokens < max_tokens), no request is sent and the response has
279
+ * zero usage with stopReason "end_turn". */
280
+ prewarm?: boolean;
248
281
  /** Override the User-Agent sent with OAuth-authenticated Anthropic requests.
249
282
  * Anthropic's OAuth edge rejects requests whose claude-cli version lags too
250
283
  * far behind the real Claude Code release; callers that track the live
@@ -570,18 +603,85 @@ type JsonSchema = Record<string, unknown>;
570
603
  /**
571
604
  * Resolve a tool's JSON Schema for provider tool definitions: prefer the
572
605
  * tool's pre-built `rawInputSchema`, otherwise convert its Zod `parameters`.
606
+ *
607
+ * A no-argument tool may declare a bare `{ "type": "object" }` root (common
608
+ * for MCP servers). OpenAI rejects that root with HTTP 400 "object schema
609
+ * missing properties", failing the whole request, so an object root without
610
+ * `properties` gets an explicit empty one. JSON Schema meaning is unchanged.
573
611
  */
574
612
  declare function resolveToolSchema(tool: Tool): JsonSchema;
575
613
 
576
614
  /**
577
- * Cap historical images before provider dispatch, removing the oldest first.
615
+ * Cap historical images before provider dispatch, removing the oldest first, in batches so the
616
+ * cached conversation prefix stays byte-identical between requests.
578
617
  * The persisted/live conversation is never mutated; only modified messages and
579
618
  * tool results are cloned for the outgoing request.
580
619
  */
581
620
  declare function clampProviderContextImages(messages: Message[], provider: Provider, supportsImages: boolean | undefined): Message[];
621
+ /**
622
+ * What a provider accepts as a replayed tool-call name. `pattern` already
623
+ * encodes the length limit where the provider documents one; `maxLength` is
624
+ * checked separately so the generic rule can cap length without a charset.
625
+ */
626
+ interface ToolCallNameRule {
627
+ /** Short identifier, for diagnostics and tests. */
628
+ id: "anthropic" | "openai-chat" | "openai-responses" | "gemini" | "generic";
629
+ maxLength: number;
630
+ pattern?: RegExp;
631
+ }
632
+ /**
633
+ * Per-transport tool-name rules. A legitimate call always carries the name of a
634
+ * tool we declared, and tool declarations are validated against these same
635
+ * rules, so only model-invented names (blank, invocation text stuffed into the
636
+ * name slot, …) can fail them.
637
+ */
638
+ declare const TOOL_CALL_NAME_RULES: Record<ToolCallNameRule["id"], ToolCallNameRule>;
639
+ /** True when `name` is a tool-call name the provider described by `rule` will accept. */
640
+ declare function isValidToolCallName(name: unknown, rule: ToolCallNameRule): boolean;
641
+ /**
642
+ * Pick the tool-name rule for the transport a request will actually use. Mirrors
643
+ * the routing in `stream.ts`: `openai` with an `accountId` is the Codex
644
+ * (Responses) endpoint, MiniMax rides the Anthropic transport but is a third
645
+ * party, and an `openai` pointed at a custom baseUrl is an unknown compatible
646
+ * server.
647
+ */
648
+ declare function toolCallNameRuleFor(provider: Provider | string, options?: {
649
+ accountId?: string;
650
+ baseUrl?: string;
651
+ }): ToolCallNameRule;
652
+ /**
653
+ * Drop assistant tool calls whose name (or id) the target provider rejects,
654
+ * together with the tool results that answer them.
655
+ *
656
+ * One malformed call — a blank name, a whole invocation string written into the
657
+ * name slot, a name over the provider's length limit — would otherwise sit in
658
+ * history and 400 every later request (`tool_use.name: String should match
659
+ * pattern`, `string_above_max_length`, …), wedging the session.
660
+ *
661
+ * Pairing is positional per window: each assistant turn opens a window, and its
662
+ * results (role `tool`) are matched FIFO per id until the next assistant or user
663
+ * message, so a reused id never consumes another turn's result. Valid sibling
664
+ * calls, text and thinking are kept in place. An assistant turn left with
665
+ * nothing replayable is removed whole, as is a tool message left empty — every
666
+ * transport accepts the resulting adjacent user turns (the Anthropic API
667
+ * combines consecutive same-role turns). A Codex reasoning item orphaned by the
668
+ * drop is removed too. If the drop would leave the request ENDING on that
669
+ * pruned assistant turn (its only call was the bad one, so no results follow),
670
+ * the turn is removed as well: a trailing assistant message is an assistant
671
+ * prefill, which current Claude models reject and other APIs treat as a
672
+ * continuation rather than a fresh turn.
673
+ *
674
+ * Returns the input array untouched when nothing is malformed.
675
+ */
676
+ declare function dropInvalidToolCalls(messages: Message[], rule: ToolCallNameRule): Message[];
582
677
  declare function toAnthropicMessages(messages: Message[], cacheControl?: {
583
678
  type: "ephemeral";
584
679
  ttl?: "1h";
680
+ }, options?: {
681
+ /** Replay server-side refusal `fallback` blocks in place. Only set when the
682
+ * request carries the server-side-fallback beta; otherwise they are
683
+ * stripped (after applying the replay rules). Default false. */
684
+ fallbackBlocks?: boolean;
585
685
  }): {
586
686
  system: Anthropic.TextBlockParam[] | undefined;
587
687
  messages: Anthropic.MessageParam[];
@@ -594,6 +694,8 @@ declare function toOpenAIMessages(messages: Message[], options?: {
594
694
  reasoningField?: string;
595
695
  }): OpenAI.ChatCompletionMessageParam[];
596
696
 
697
+ declare function usesResponsesLite(model: string): boolean;
698
+
597
699
  /**
598
700
  * Fire a minimal `max_tokens: 1` request that populates the Anthropic prompt
599
701
  * cache with the system prompt + tools prefix, so the first real user turn is
@@ -685,4 +787,4 @@ interface PalsuProviderConfig {
685
787
  */
686
788
  declare function registerPalsuProvider(config?: PalsuProviderConfig): PalsuProviderHandle;
687
789
 
688
- export { type AssistantMessage, type CacheRetention, type ContentPart, type DoneEvent, EZCoderAIError, type ErrorEvent, type ErrorSource, EventStream, type FormattedError, type ImageContent, type Message, type MessageProvenance, type MessageProvenanceKind, type MessageProvenanceSource, type MessageProvenanceVisibility, type PalsuModelConfig, type PalsuModelHandle, type PalsuProviderConfig, type PalsuProviderHandle, type PalsuProviderState, type PalsuResponse, type PalsuResponseFactory, type Provider, type ProviderDiagnosticFn, type ProviderEntry, ProviderError, type ProviderStreamFn, REDACTED as REDACTION_MARKER, type RawContent, type RedactionOptions, type ServerToolCall, type ServerToolCallEvent, type ServerToolDefinition, type ServerToolResult, type ServerToolResultEvent, type StopReason, type StreamEvent, type StreamOptions, type StreamResponse, StreamResult, type SystemMessage, type TextContent, type TextDeltaEvent, type ThinkingContent, type ThinkingDeltaEvent, type ThinkingLevel, type Tool, type ToolCall, type ToolCallDeltaEvent, type ToolCallDoneEvent, type ToolChoice, type ToolResult, type ToolResultContent, type ToolResultMessage, type Usage, type UserMessage, type VideoContent, clampProviderContextImages, classifyProviderError, environmentSecrets, formatError, formatErrorForDisplay, hasLoneSurrogate, isHardBillingMessage, isUsageLimitError, localWireModelId, palsuAssistantMessage, palsuText, palsuThinking, palsuToolCall, prewarmAnthropicCache, providerRegistry, redactText, redactValue, registerPalsuProvider, resolveToolSchema, sanitizeMessagesForWire, setProviderDiagnostic, sliceHead, sliceTail, stream, toAnthropicMessages, toOpenAIMessages, toWellFormedText };
790
+ export { type AssistantMessage, type CacheRetention, type ContentPart, type DoneEvent, EZCoderAIError, type ErrorEvent, type ErrorSource, EventStream, type FormattedError, type ImageContent, type Message, type MessageProvenance, type MessageProvenanceKind, type MessageProvenanceSource, type MessageProvenanceVisibility, type PalsuModelConfig, type PalsuModelHandle, type PalsuProviderConfig, type PalsuProviderHandle, type PalsuProviderState, type PalsuResponse, type PalsuResponseFactory, type PreparedContext, type Provider, type ProviderDiagnosticFn, type ProviderEntry, ProviderError, type ProviderStreamFn, REDACTED as REDACTION_MARKER, type RawContent, type RedactionOptions, type ServerToolCall, type ServerToolCallEvent, type ServerToolDefinition, type ServerToolResult, type ServerToolResultEvent, type StopReason, type StreamEvent, type StreamOptions, type StreamResponse, StreamResult, type SystemMessage, TOOL_CALL_NAME_RULES, type TextContent, type TextDeltaEvent, type ThinkingContent, type ThinkingDeltaEvent, type ThinkingLevel, type Tool, type ToolCall, type ToolCallDeltaEvent, type ToolCallDoneEvent, type ToolCallNameRule, type ToolChoice, type ToolResult, type ToolResultContent, type ToolResultMessage, type Usage, type UserMessage, type VideoContent, clampProviderContextImages, classifyProviderError, dropInvalidToolCalls, environmentSecrets, formatError, formatErrorForDisplay, hasLoneSurrogate, isHardBillingMessage, isUsageLimitError, isValidToolCallName, localWireModelId, palsuAssistantMessage, palsuText, palsuThinking, palsuToolCall, prewarmAnthropicCache, providerRegistry, redactText, redactValue, registerPalsuProvider, resolveToolSchema, sanitizeMessagesForWire, setProviderDiagnostic, sliceHead, sliceTail, stream, toAnthropicMessages, toOpenAIMessages, toWellFormedText, toolCallNameRuleFor, usesResponsesLite };
package/dist/index.d.ts CHANGED
@@ -186,8 +186,24 @@ interface Usage {
186
186
  webFetchRequests?: number;
187
187
  };
188
188
  }
189
+ interface PreparedContext {
190
+ /** Read-only observation after generic sanitization/image limiting, before provider encoding.
191
+ * Do not log or retain these messages: they may contain secrets and image data. */
192
+ messages: readonly Message[];
193
+ tools: readonly {
194
+ name: string;
195
+ description: string;
196
+ parameters: Record<string, unknown>;
197
+ }[];
198
+ imagesBefore: number;
199
+ imagesAfter: number;
200
+ /** First message whose images were removed for this request, or null. */
201
+ firstImageDropMessage: number | null;
202
+ }
189
203
  interface StreamOptions {
190
204
  provider: Provider;
205
+ /** Optional, synchronous diagnostics observer. Exceptions cannot fail a model request. */
206
+ onContextPrepared?: (context: PreparedContext) => void;
191
207
  model: string;
192
208
  messages: Message[];
193
209
  tools?: Tool[];
@@ -207,6 +223,15 @@ interface StreamOptions {
207
223
  promptCacheKey?: string;
208
224
  /** OpenAI service tier for latency-sensitive requests. Only sent to first-party OpenAI API calls. */
209
225
  serviceTier?: "auto" | "default" | "flex" | "priority";
226
+ /** Codex endpoint only: send the Responses-Lite request shape (lite header,
227
+ * `parallel_tool_calls: false`, all-turns reasoning context). Unset follows
228
+ * the model family (on for gpt-5.6/gpt-6 models). Lite allows only one tool
229
+ * call per response, so turning it off lets the model batch calls. */
230
+ responsesLite?: boolean;
231
+ /** OpenAI only (Codex and API-key routes): send tools with strict
232
+ * (grammar-constrained) schemas. Default true. Strict calls carry every
233
+ * optional field as null, which costs output tokens and latency per call. */
234
+ strictTools?: boolean;
210
235
  /** OpenAI ChatGPT account ID (from OAuth JWT) for codex endpoint */
211
236
  accountId?: string;
212
237
  /** Stable conversation identity for Codex transport headers. This is distinct from
@@ -245,6 +270,14 @@ interface StreamOptions {
245
270
  * stalls — broken SSE connections (transient CDN / proxy issues) often
246
271
  * recover when the same request is issued over a plain HTTP request/response. */
247
272
  streaming?: boolean;
273
+ /** Cache prewarm (Anthropic only; other providers ignore it). Sends the exact
274
+ * same request prefix (system, tools, messages, thinking, betas) with
275
+ * `max_tokens: 1` over a non-streaming request so the prompt cache is written
276
+ * before the user's next real turn. If the configured thinking mode cannot be
277
+ * kept identical at `max_tokens: 1` (budget thinking requires
278
+ * budget_tokens < max_tokens), no request is sent and the response has
279
+ * zero usage with stopReason "end_turn". */
280
+ prewarm?: boolean;
248
281
  /** Override the User-Agent sent with OAuth-authenticated Anthropic requests.
249
282
  * Anthropic's OAuth edge rejects requests whose claude-cli version lags too
250
283
  * far behind the real Claude Code release; callers that track the live
@@ -570,18 +603,85 @@ type JsonSchema = Record<string, unknown>;
570
603
  /**
571
604
  * Resolve a tool's JSON Schema for provider tool definitions: prefer the
572
605
  * tool's pre-built `rawInputSchema`, otherwise convert its Zod `parameters`.
606
+ *
607
+ * A no-argument tool may declare a bare `{ "type": "object" }` root (common
608
+ * for MCP servers). OpenAI rejects that root with HTTP 400 "object schema
609
+ * missing properties", failing the whole request, so an object root without
610
+ * `properties` gets an explicit empty one. JSON Schema meaning is unchanged.
573
611
  */
574
612
  declare function resolveToolSchema(tool: Tool): JsonSchema;
575
613
 
576
614
  /**
577
- * Cap historical images before provider dispatch, removing the oldest first.
615
+ * Cap historical images before provider dispatch, removing the oldest first, in batches so the
616
+ * cached conversation prefix stays byte-identical between requests.
578
617
  * The persisted/live conversation is never mutated; only modified messages and
579
618
  * tool results are cloned for the outgoing request.
580
619
  */
581
620
  declare function clampProviderContextImages(messages: Message[], provider: Provider, supportsImages: boolean | undefined): Message[];
621
+ /**
622
+ * What a provider accepts as a replayed tool-call name. `pattern` already
623
+ * encodes the length limit where the provider documents one; `maxLength` is
624
+ * checked separately so the generic rule can cap length without a charset.
625
+ */
626
+ interface ToolCallNameRule {
627
+ /** Short identifier, for diagnostics and tests. */
628
+ id: "anthropic" | "openai-chat" | "openai-responses" | "gemini" | "generic";
629
+ maxLength: number;
630
+ pattern?: RegExp;
631
+ }
632
+ /**
633
+ * Per-transport tool-name rules. A legitimate call always carries the name of a
634
+ * tool we declared, and tool declarations are validated against these same
635
+ * rules, so only model-invented names (blank, invocation text stuffed into the
636
+ * name slot, …) can fail them.
637
+ */
638
+ declare const TOOL_CALL_NAME_RULES: Record<ToolCallNameRule["id"], ToolCallNameRule>;
639
+ /** True when `name` is a tool-call name the provider described by `rule` will accept. */
640
+ declare function isValidToolCallName(name: unknown, rule: ToolCallNameRule): boolean;
641
+ /**
642
+ * Pick the tool-name rule for the transport a request will actually use. Mirrors
643
+ * the routing in `stream.ts`: `openai` with an `accountId` is the Codex
644
+ * (Responses) endpoint, MiniMax rides the Anthropic transport but is a third
645
+ * party, and an `openai` pointed at a custom baseUrl is an unknown compatible
646
+ * server.
647
+ */
648
+ declare function toolCallNameRuleFor(provider: Provider | string, options?: {
649
+ accountId?: string;
650
+ baseUrl?: string;
651
+ }): ToolCallNameRule;
652
+ /**
653
+ * Drop assistant tool calls whose name (or id) the target provider rejects,
654
+ * together with the tool results that answer them.
655
+ *
656
+ * One malformed call — a blank name, a whole invocation string written into the
657
+ * name slot, a name over the provider's length limit — would otherwise sit in
658
+ * history and 400 every later request (`tool_use.name: String should match
659
+ * pattern`, `string_above_max_length`, …), wedging the session.
660
+ *
661
+ * Pairing is positional per window: each assistant turn opens a window, and its
662
+ * results (role `tool`) are matched FIFO per id until the next assistant or user
663
+ * message, so a reused id never consumes another turn's result. Valid sibling
664
+ * calls, text and thinking are kept in place. An assistant turn left with
665
+ * nothing replayable is removed whole, as is a tool message left empty — every
666
+ * transport accepts the resulting adjacent user turns (the Anthropic API
667
+ * combines consecutive same-role turns). A Codex reasoning item orphaned by the
668
+ * drop is removed too. If the drop would leave the request ENDING on that
669
+ * pruned assistant turn (its only call was the bad one, so no results follow),
670
+ * the turn is removed as well: a trailing assistant message is an assistant
671
+ * prefill, which current Claude models reject and other APIs treat as a
672
+ * continuation rather than a fresh turn.
673
+ *
674
+ * Returns the input array untouched when nothing is malformed.
675
+ */
676
+ declare function dropInvalidToolCalls(messages: Message[], rule: ToolCallNameRule): Message[];
582
677
  declare function toAnthropicMessages(messages: Message[], cacheControl?: {
583
678
  type: "ephemeral";
584
679
  ttl?: "1h";
680
+ }, options?: {
681
+ /** Replay server-side refusal `fallback` blocks in place. Only set when the
682
+ * request carries the server-side-fallback beta; otherwise they are
683
+ * stripped (after applying the replay rules). Default false. */
684
+ fallbackBlocks?: boolean;
585
685
  }): {
586
686
  system: Anthropic.TextBlockParam[] | undefined;
587
687
  messages: Anthropic.MessageParam[];
@@ -594,6 +694,8 @@ declare function toOpenAIMessages(messages: Message[], options?: {
594
694
  reasoningField?: string;
595
695
  }): OpenAI.ChatCompletionMessageParam[];
596
696
 
697
+ declare function usesResponsesLite(model: string): boolean;
698
+
597
699
  /**
598
700
  * Fire a minimal `max_tokens: 1` request that populates the Anthropic prompt
599
701
  * cache with the system prompt + tools prefix, so the first real user turn is
@@ -685,4 +787,4 @@ interface PalsuProviderConfig {
685
787
  */
686
788
  declare function registerPalsuProvider(config?: PalsuProviderConfig): PalsuProviderHandle;
687
789
 
688
- export { type AssistantMessage, type CacheRetention, type ContentPart, type DoneEvent, EZCoderAIError, type ErrorEvent, type ErrorSource, EventStream, type FormattedError, type ImageContent, type Message, type MessageProvenance, type MessageProvenanceKind, type MessageProvenanceSource, type MessageProvenanceVisibility, type PalsuModelConfig, type PalsuModelHandle, type PalsuProviderConfig, type PalsuProviderHandle, type PalsuProviderState, type PalsuResponse, type PalsuResponseFactory, type Provider, type ProviderDiagnosticFn, type ProviderEntry, ProviderError, type ProviderStreamFn, REDACTED as REDACTION_MARKER, type RawContent, type RedactionOptions, type ServerToolCall, type ServerToolCallEvent, type ServerToolDefinition, type ServerToolResult, type ServerToolResultEvent, type StopReason, type StreamEvent, type StreamOptions, type StreamResponse, StreamResult, type SystemMessage, type TextContent, type TextDeltaEvent, type ThinkingContent, type ThinkingDeltaEvent, type ThinkingLevel, type Tool, type ToolCall, type ToolCallDeltaEvent, type ToolCallDoneEvent, type ToolChoice, type ToolResult, type ToolResultContent, type ToolResultMessage, type Usage, type UserMessage, type VideoContent, clampProviderContextImages, classifyProviderError, environmentSecrets, formatError, formatErrorForDisplay, hasLoneSurrogate, isHardBillingMessage, isUsageLimitError, localWireModelId, palsuAssistantMessage, palsuText, palsuThinking, palsuToolCall, prewarmAnthropicCache, providerRegistry, redactText, redactValue, registerPalsuProvider, resolveToolSchema, sanitizeMessagesForWire, setProviderDiagnostic, sliceHead, sliceTail, stream, toAnthropicMessages, toOpenAIMessages, toWellFormedText };
790
+ export { type AssistantMessage, type CacheRetention, type ContentPart, type DoneEvent, EZCoderAIError, type ErrorEvent, type ErrorSource, EventStream, type FormattedError, type ImageContent, type Message, type MessageProvenance, type MessageProvenanceKind, type MessageProvenanceSource, type MessageProvenanceVisibility, type PalsuModelConfig, type PalsuModelHandle, type PalsuProviderConfig, type PalsuProviderHandle, type PalsuProviderState, type PalsuResponse, type PalsuResponseFactory, type PreparedContext, type Provider, type ProviderDiagnosticFn, type ProviderEntry, ProviderError, type ProviderStreamFn, REDACTED as REDACTION_MARKER, type RawContent, type RedactionOptions, type ServerToolCall, type ServerToolCallEvent, type ServerToolDefinition, type ServerToolResult, type ServerToolResultEvent, type StopReason, type StreamEvent, type StreamOptions, type StreamResponse, StreamResult, type SystemMessage, TOOL_CALL_NAME_RULES, type TextContent, type TextDeltaEvent, type ThinkingContent, type ThinkingDeltaEvent, type ThinkingLevel, type Tool, type ToolCall, type ToolCallDeltaEvent, type ToolCallDoneEvent, type ToolCallNameRule, type ToolChoice, type ToolResult, type ToolResultContent, type ToolResultMessage, type Usage, type UserMessage, type VideoContent, clampProviderContextImages, classifyProviderError, dropInvalidToolCalls, environmentSecrets, formatError, formatErrorForDisplay, hasLoneSurrogate, isHardBillingMessage, isUsageLimitError, isValidToolCallName, localWireModelId, palsuAssistantMessage, palsuText, palsuThinking, palsuToolCall, prewarmAnthropicCache, providerRegistry, redactText, redactValue, registerPalsuProvider, resolveToolSchema, sanitizeMessagesForWire, setProviderDiagnostic, sliceHead, sliceTail, stream, toAnthropicMessages, toOpenAIMessages, toWellFormedText, toolCallNameRuleFor, usesResponsesLite };