Skip to content

ci: Version Packages#591

Merged
AlemTuzlak merged 1 commit into
mainfrom
changeset-release/main
May 19, 2026
Merged

ci: Version Packages#591
AlemTuzlak merged 1 commit into
mainfrom
changeset-release/main

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@tanstack/ai@0.20.0

Minor Changes

  • feat(ai): systemPrompts accept { content, metadata } with adapter-inferred metadata typing (#575)

    chat({ systemPrompts }) now accepts either a plain string (the existing
    shape — fully backward compatible) or { content, metadata }. The metadata
    field's type is inferred from the adapter via a new
    TSystemPromptMetadata generic on TextAdapter / BaseTextAdapter:

    • @tanstack/ai-anthropic declares AnthropicSystemPromptMetadata
      users get cache_control autocomplete and type-checking on
      systemPrompts[i].metadata for Anthropic chats.
    • Adapters with no per-prompt metadata (OpenAI, Gemini, Ollama,
      OpenRouter, openai-base) inherit the default never, which means the
      metadata field carries no meaningful value at the call site —
      TypeScript only accepts undefined there. Provider-foreign metadata
      that reaches an adapter via JS / as any is silently dropped, never
      written to the wire.
    import { chat } from '@tanstack/ai'
    import { anthropicText } from '@tanstack/ai-anthropic'
    
    // Anthropic — `cache_control` is autocompleted, no `satisfies` needed.
    chat({
      adapter: anthropicText({ apiKey }, 'claude-sonnet-4-6'),
      systemPrompts: [
        {
          content: 'Stable instructions — cache me.',
          metadata: { cache_control: { type: 'ephemeral' } },
        },
        'Volatile per-request instruction.',
      ],
    })
    
    // OpenAI — `metadata` is `never`; only `undefined` is assignable, so the
    // field is effectively unusable. The object form without `metadata` still
    // works for portability.
    chat({
      adapter: openaiText({ apiKey }, 'gpt-4o-mini'),
      systemPrompts: [
        'Plain string.',
        { content: 'Object form without metadata is allowed.' },
      ],
    })

    New exports:

    • @tanstack/ai: SystemPrompt, NormalizedSystemPrompt types and the
      normalizeSystemPrompts() helper adapters use to normalize the wide
      input shape to { content, metadata? } before consumption.
    • @tanstack/ai-anthropic: AnthropicSystemPromptMetadata interface
      (currently exposes cache_control for prompt caching).

    Internal:

    • New TSystemPromptMetadata = never generic on TextAdapter /
      BaseTextAdapter, surfaced via '~types'['systemPromptMetadata']
      for inference at the chat() call site.
    • Anthropic adapter reads metadata.cache_control and attaches it to
      the corresponding TextBlockParam.
    • All other text adapters call normalizeSystemPrompts() and join
      .content for their respective instructions / system /
      systemInstruction fields. Foreign metadata that reaches them via JS
      / as any is dropped (never written to the wire).
    • normalizeSystemPrompts() is the public API boundary and throws
      TypeError (naming the offending index) for object-form entries whose
      content isn't a string — preventing literal "undefined" from
      reaching the model on stale call sites.
    • OpenTelemetry middleware attaches per-prompt metadata as the
      tanstack.ai.system_prompt.metadata JSON span attribute when
      captureContent: true and at least one entry carries metadata, so
      observability backends can distinguish cache hit/miss for Anthropic.
    • @tanstack/ai-event-client mirrors the SystemPrompt shape locally
      (avoids a circular import) and projects metadata away on the devtools
      wire — devtools UI still receives Array<string>.

Patch Changes

  • Updated dependencies [496db9c]:
    • @tanstack/ai-event-client@0.3.5

@tanstack/ai-anthropic@0.10.0

Minor Changes

  • feat(ai): systemPrompts accept { content, metadata } with adapter-inferred metadata typing (#575)

    chat({ systemPrompts }) now accepts either a plain string (the existing
    shape — fully backward compatible) or { content, metadata }. The metadata
    field's type is inferred from the adapter via a new
    TSystemPromptMetadata generic on TextAdapter / BaseTextAdapter:

    • @tanstack/ai-anthropic declares AnthropicSystemPromptMetadata
      users get cache_control autocomplete and type-checking on
      systemPrompts[i].metadata for Anthropic chats.
    • Adapters with no per-prompt metadata (OpenAI, Gemini, Ollama,
      OpenRouter, openai-base) inherit the default never, which means the
      metadata field carries no meaningful value at the call site —
      TypeScript only accepts undefined there. Provider-foreign metadata
      that reaches an adapter via JS / as any is silently dropped, never
      written to the wire.
    import { chat } from '@tanstack/ai'
    import { anthropicText } from '@tanstack/ai-anthropic'
    
    // Anthropic — `cache_control` is autocompleted, no `satisfies` needed.
    chat({
      adapter: anthropicText({ apiKey }, 'claude-sonnet-4-6'),
      systemPrompts: [
        {
          content: 'Stable instructions — cache me.',
          metadata: { cache_control: { type: 'ephemeral' } },
        },
        'Volatile per-request instruction.',
      ],
    })
    
    // OpenAI — `metadata` is `never`; only `undefined` is assignable, so the
    // field is effectively unusable. The object form without `metadata` still
    // works for portability.
    chat({
      adapter: openaiText({ apiKey }, 'gpt-4o-mini'),
      systemPrompts: [
        'Plain string.',
        { content: 'Object form without metadata is allowed.' },
      ],
    })

    New exports:

    • @tanstack/ai: SystemPrompt, NormalizedSystemPrompt types and the
      normalizeSystemPrompts() helper adapters use to normalize the wide
      input shape to { content, metadata? } before consumption.
    • @tanstack/ai-anthropic: AnthropicSystemPromptMetadata interface
      (currently exposes cache_control for prompt caching).

    Internal:

    • New TSystemPromptMetadata = never generic on TextAdapter /
      BaseTextAdapter, surfaced via '~types'['systemPromptMetadata']
      for inference at the chat() call site.
    • Anthropic adapter reads metadata.cache_control and attaches it to
      the corresponding TextBlockParam.
    • All other text adapters call normalizeSystemPrompts() and join
      .content for their respective instructions / system /
      systemInstruction fields. Foreign metadata that reaches them via JS
      / as any is dropped (never written to the wire).
    • normalizeSystemPrompts() is the public API boundary and throws
      TypeError (naming the offending index) for object-form entries whose
      content isn't a string — preventing literal "undefined" from
      reaching the model on stale call sites.
    • OpenTelemetry middleware attaches per-prompt metadata as the
      tanstack.ai.system_prompt.metadata JSON span attribute when
      captureContent: true and at least one entry carries metadata, so
      observability backends can distinguish cache hit/miss for Anthropic.
    • @tanstack/ai-event-client mirrors the SystemPrompt shape locally
      (avoids a circular import) and projects metadata away on the devtools
      wire — devtools UI still receives Array<string>.

Patch Changes

  • Updated dependencies [496db9c]:
    • @tanstack/ai@0.20.0

@tanstack/ai-client@0.11.2

Patch Changes

  • Updated dependencies [496db9c]:
    • @tanstack/ai@0.20.0
    • @tanstack/ai-event-client@0.3.5

@tanstack/ai-code-mode@0.1.15

Patch Changes

  • Updated dependencies [496db9c]:
    • @tanstack/ai@0.20.0

@tanstack/ai-code-mode-skills@0.1.15

Patch Changes

  • Updated dependencies [496db9c]:
    • @tanstack/ai@0.20.0
    • @tanstack/ai-code-mode@0.1.15

@tanstack/ai-devtools-core@0.3.32

Patch Changes

  • Updated dependencies [496db9c]:
    • @tanstack/ai@0.20.0
    • @tanstack/ai-event-client@0.3.5

@tanstack/ai-elevenlabs@0.2.7

Patch Changes

  • Updated dependencies [496db9c]:
    • @tanstack/ai@0.20.0
    • @tanstack/ai-client@0.11.2

@tanstack/ai-event-client@0.3.5

Patch Changes

  • feat(ai): systemPrompts accept { content, metadata } with adapter-inferred metadata typing (#575)

    chat({ systemPrompts }) now accepts either a plain string (the existing
    shape — fully backward compatible) or { content, metadata }. The metadata
    field's type is inferred from the adapter via a new
    TSystemPromptMetadata generic on TextAdapter / BaseTextAdapter:

    • @tanstack/ai-anthropic declares AnthropicSystemPromptMetadata
      users get cache_control autocomplete and type-checking on
      systemPrompts[i].metadata for Anthropic chats.
    • Adapters with no per-prompt metadata (OpenAI, Gemini, Ollama,
      OpenRouter, openai-base) inherit the default never, which means the
      metadata field carries no meaningful value at the call site —
      TypeScript only accepts undefined there. Provider-foreign metadata
      that reaches an adapter via JS / as any is silently dropped, never
      written to the wire.
    import { chat } from '@tanstack/ai'
    import { anthropicText } from '@tanstack/ai-anthropic'
    
    // Anthropic — `cache_control` is autocompleted, no `satisfies` needed.
    chat({
      adapter: anthropicText({ apiKey }, 'claude-sonnet-4-6'),
      systemPrompts: [
        {
          content: 'Stable instructions — cache me.',
          metadata: { cache_control: { type: 'ephemeral' } },
        },
        'Volatile per-request instruction.',
      ],
    })
    
    // OpenAI — `metadata` is `never`; only `undefined` is assignable, so the
    // field is effectively unusable. The object form without `metadata` still
    // works for portability.
    chat({
      adapter: openaiText({ apiKey }, 'gpt-4o-mini'),
      systemPrompts: [
        'Plain string.',
        { content: 'Object form without metadata is allowed.' },
      ],
    })

    New exports:

    • @tanstack/ai: SystemPrompt, NormalizedSystemPrompt types and the
      normalizeSystemPrompts() helper adapters use to normalize the wide
      input shape to { content, metadata? } before consumption.
    • @tanstack/ai-anthropic: AnthropicSystemPromptMetadata interface
      (currently exposes cache_control for prompt caching).

    Internal:

    • New TSystemPromptMetadata = never generic on TextAdapter /
      BaseTextAdapter, surfaced via '~types'['systemPromptMetadata']
      for inference at the chat() call site.
    • Anthropic adapter reads metadata.cache_control and attaches it to
      the corresponding TextBlockParam.
    • All other text adapters call normalizeSystemPrompts() and join
      .content for their respective instructions / system /
      systemInstruction fields. Foreign metadata that reaches them via JS
      / as any is dropped (never written to the wire).
    • normalizeSystemPrompts() is the public API boundary and throws
      TypeError (naming the offending index) for object-form entries whose
      content isn't a string — preventing literal "undefined" from
      reaching the model on stale call sites.
    • OpenTelemetry middleware attaches per-prompt metadata as the
      tanstack.ai.system_prompt.metadata JSON span attribute when
      captureContent: true and at least one entry carries metadata, so
      observability backends can distinguish cache hit/miss for Anthropic.
    • @tanstack/ai-event-client mirrors the SystemPrompt shape locally
      (avoids a circular import) and projects metadata away on the devtools
      wire — devtools UI still receives Array<string>.
  • Updated dependencies [496db9c]:

    • @tanstack/ai@0.20.0

@tanstack/ai-fal@0.7.8

Patch Changes

  • Updated dependencies [496db9c]:
    • @tanstack/ai@0.20.0

@tanstack/ai-gemini@0.10.7

Patch Changes

  • feat(ai): systemPrompts accept { content, metadata } with adapter-inferred metadata typing (#575)

    chat({ systemPrompts }) now accepts either a plain string (the existing
    shape — fully backward compatible) or { content, metadata }. The metadata
    field's type is inferred from the adapter via a new
    TSystemPromptMetadata generic on TextAdapter / BaseTextAdapter:

    • @tanstack/ai-anthropic declares AnthropicSystemPromptMetadata
      users get cache_control autocomplete and type-checking on
      systemPrompts[i].metadata for Anthropic chats.
    • Adapters with no per-prompt metadata (OpenAI, Gemini, Ollama,
      OpenRouter, openai-base) inherit the default never, which means the
      metadata field carries no meaningful value at the call site —
      TypeScript only accepts undefined there. Provider-foreign metadata
      that reaches an adapter via JS / as any is silently dropped, never
      written to the wire.
    import { chat } from '@tanstack/ai'
    import { anthropicText } from '@tanstack/ai-anthropic'
    
    // Anthropic — `cache_control` is autocompleted, no `satisfies` needed.
    chat({
      adapter: anthropicText({ apiKey }, 'claude-sonnet-4-6'),
      systemPrompts: [
        {
          content: 'Stable instructions — cache me.',
          metadata: { cache_control: { type: 'ephemeral' } },
        },
        'Volatile per-request instruction.',
      ],
    })
    
    // OpenAI — `metadata` is `never`; only `undefined` is assignable, so the
    // field is effectively unusable. The object form without `metadata` still
    // works for portability.
    chat({
      adapter: openaiText({ apiKey }, 'gpt-4o-mini'),
      systemPrompts: [
        'Plain string.',
        { content: 'Object form without metadata is allowed.' },
      ],
    })

    New exports:

    • @tanstack/ai: SystemPrompt, NormalizedSystemPrompt types and the
      normalizeSystemPrompts() helper adapters use to normalize the wide
      input shape to { content, metadata? } before consumption.
    • @tanstack/ai-anthropic: AnthropicSystemPromptMetadata interface
      (currently exposes cache_control for prompt caching).

    Internal:

    • New TSystemPromptMetadata = never generic on TextAdapter /
      BaseTextAdapter, surfaced via '~types'['systemPromptMetadata']
      for inference at the chat() call site.
    • Anthropic adapter reads metadata.cache_control and attaches it to
      the corresponding TextBlockParam.
    • All other text adapters call normalizeSystemPrompts() and join
      .content for their respective instructions / system /
      systemInstruction fields. Foreign metadata that reaches them via JS
      / as any is dropped (never written to the wire).
    • normalizeSystemPrompts() is the public API boundary and throws
      TypeError (naming the offending index) for object-form entries whose
      content isn't a string — preventing literal "undefined" from
      reaching the model on stale call sites.
    • OpenTelemetry middleware attaches per-prompt metadata as the
      tanstack.ai.system_prompt.metadata JSON span attribute when
      captureContent: true and at least one entry carries metadata, so
      observability backends can distinguish cache hit/miss for Anthropic.
    • @tanstack/ai-event-client mirrors the SystemPrompt shape locally
      (avoids a circular import) and projects metadata away on the devtools
      wire — devtools UI still receives Array<string>.
  • Updated dependencies [496db9c]:

    • @tanstack/ai@0.20.0

@tanstack/ai-grok@0.8.4

Patch Changes

  • Updated dependencies [496db9c]:
    • @tanstack/ai@0.20.0
    • @tanstack/openai-base@0.3.3

@tanstack/ai-groq@0.2.3

Patch Changes

  • Updated dependencies [496db9c]:
    • @tanstack/ai@0.20.0
    • @tanstack/openai-base@0.3.3

@tanstack/ai-isolate-cloudflare@0.2.6

Patch Changes

  • Updated dependencies []:
    • @tanstack/ai-code-mode@0.1.15

@tanstack/ai-isolate-node@0.1.15

Patch Changes

  • Updated dependencies []:
    • @tanstack/ai-code-mode@0.1.15

@tanstack/ai-isolate-quickjs@0.1.15

Patch Changes

  • Updated dependencies []:
    • @tanstack/ai-code-mode@0.1.15

@tanstack/ai-ollama@0.6.18

Patch Changes

  • feat(ai): systemPrompts accept { content, metadata } with adapter-inferred metadata typing (#575)

    chat({ systemPrompts }) now accepts either a plain string (the existing
    shape — fully backward compatible) or { content, metadata }. The metadata
    field's type is inferred from the adapter via a new
    TSystemPromptMetadata generic on TextAdapter / BaseTextAdapter:

    • @tanstack/ai-anthropic declares AnthropicSystemPromptMetadata
      users get cache_control autocomplete and type-checking on
      systemPrompts[i].metadata for Anthropic chats.
    • Adapters with no per-prompt metadata (OpenAI, Gemini, Ollama,
      OpenRouter, openai-base) inherit the default never, which means the
      metadata field carries no meaningful value at the call site —
      TypeScript only accepts undefined there. Provider-foreign metadata
      that reaches an adapter via JS / as any is silently dropped, never
      written to the wire.
    import { chat } from '@tanstack/ai'
    import { anthropicText } from '@tanstack/ai-anthropic'
    
    // Anthropic — `cache_control` is autocompleted, no `satisfies` needed.
    chat({
      adapter: anthropicText({ apiKey }, 'claude-sonnet-4-6'),
      systemPrompts: [
        {
          content: 'Stable instructions — cache me.',
          metadata: { cache_control: { type: 'ephemeral' } },
        },
        'Volatile per-request instruction.',
      ],
    })
    
    // OpenAI — `metadata` is `never`; only `undefined` is assignable, so the
    // field is effectively unusable. The object form without `metadata` still
    // works for portability.
    chat({
      adapter: openaiText({ apiKey }, 'gpt-4o-mini'),
      systemPrompts: [
        'Plain string.',
        { content: 'Object form without metadata is allowed.' },
      ],
    })

    New exports:

    • @tanstack/ai: SystemPrompt, NormalizedSystemPrompt types and the
      normalizeSystemPrompts() helper adapters use to normalize the wide
      input shape to { content, metadata? } before consumption.
    • @tanstack/ai-anthropic: AnthropicSystemPromptMetadata interface
      (currently exposes cache_control for prompt caching).

    Internal:

    • New TSystemPromptMetadata = never generic on TextAdapter /
      BaseTextAdapter, surfaced via '~types'['systemPromptMetadata']
      for inference at the chat() call site.
    • Anthropic adapter reads metadata.cache_control and attaches it to
      the corresponding TextBlockParam.
    • All other text adapters call normalizeSystemPrompts() and join
      .content for their respective instructions / system /
      systemInstruction fields. Foreign metadata that reaches them via JS
      / as any is dropped (never written to the wire).
    • normalizeSystemPrompts() is the public API boundary and throws
      TypeError (naming the offending index) for object-form entries whose
      content isn't a string — preventing literal "undefined" from
      reaching the model on stale call sites.
    • OpenTelemetry middleware attaches per-prompt metadata as the
      tanstack.ai.system_prompt.metadata JSON span attribute when
      captureContent: true and at least one entry carries metadata, so
      observability backends can distinguish cache hit/miss for Anthropic.
    • @tanstack/ai-event-client mirrors the SystemPrompt shape locally
      (avoids a circular import) and projects metadata away on the devtools
      wire — devtools UI still receives Array<string>.
  • Updated dependencies [496db9c]:

    • @tanstack/ai@0.20.0

@tanstack/ai-openai@0.9.4

Patch Changes

  • feat(ai): systemPrompts accept { content, metadata } with adapter-inferred metadata typing (#575)

    chat({ systemPrompts }) now accepts either a plain string (the existing
    shape — fully backward compatible) or { content, metadata }. The metadata
    field's type is inferred from the adapter via a new
    TSystemPromptMetadata generic on TextAdapter / BaseTextAdapter:

    • @tanstack/ai-anthropic declares AnthropicSystemPromptMetadata
      users get cache_control autocomplete and type-checking on
      systemPrompts[i].metadata for Anthropic chats.
    • Adapters with no per-prompt metadata (OpenAI, Gemini, Ollama,
      OpenRouter, openai-base) inherit the default never, which means the
      metadata field carries no meaningful value at the call site —
      TypeScript only accepts undefined there. Provider-foreign metadata
      that reaches an adapter via JS / as any is silently dropped, never
      written to the wire.
    import { chat } from '@tanstack/ai'
    import { anthropicText } from '@tanstack/ai-anthropic'
    
    // Anthropic — `cache_control` is autocompleted, no `satisfies` needed.
    chat({
      adapter: anthropicText({ apiKey }, 'claude-sonnet-4-6'),
      systemPrompts: [
        {
          content: 'Stable instructions — cache me.',
          metadata: { cache_control: { type: 'ephemeral' } },
        },
        'Volatile per-request instruction.',
      ],
    })
    
    // OpenAI — `metadata` is `never`; only `undefined` is assignable, so the
    // field is effectively unusable. The object form without `metadata` still
    // works for portability.
    chat({
      adapter: openaiText({ apiKey }, 'gpt-4o-mini'),
      systemPrompts: [
        'Plain string.',
        { content: 'Object form without metadata is allowed.' },
      ],
    })

    New exports:

    • @tanstack/ai: SystemPrompt, NormalizedSystemPrompt types and the
      normalizeSystemPrompts() helper adapters use to normalize the wide
      input shape to { content, metadata? } before consumption.
    • @tanstack/ai-anthropic: AnthropicSystemPromptMetadata interface
      (currently exposes cache_control for prompt caching).

    Internal:

    • New TSystemPromptMetadata = never generic on TextAdapter /
      BaseTextAdapter, surfaced via '~types'['systemPromptMetadata']
      for inference at the chat() call site.
    • Anthropic adapter reads metadata.cache_control and attaches it to
      the corresponding TextBlockParam.
    • All other text adapters call normalizeSystemPrompts() and join
      .content for their respective instructions / system /
      systemInstruction fields. Foreign metadata that reaches them via JS
      / as any is dropped (never written to the wire).
    • normalizeSystemPrompts() is the public API boundary and throws
      TypeError (naming the offending index) for object-form entries whose
      content isn't a string — preventing literal "undefined" from
      reaching the model on stale call sites.
    • OpenTelemetry middleware attaches per-prompt metadata as the
      tanstack.ai.system_prompt.metadata JSON span attribute when
      captureContent: true and at least one entry carries metadata, so
      observability backends can distinguish cache hit/miss for Anthropic.
    • @tanstack/ai-event-client mirrors the SystemPrompt shape locally
      (avoids a circular import) and projects metadata away on the devtools
      wire — devtools UI still receives Array<string>.
  • Updated dependencies [496db9c]:

    • @tanstack/ai@0.20.0
    • @tanstack/openai-base@0.3.3
    • @tanstack/ai-client@0.11.2

@tanstack/ai-openrouter@0.9.4

Patch Changes

  • feat(ai): systemPrompts accept { content, metadata } with adapter-inferred metadata typing (#575)

    chat({ systemPrompts }) now accepts either a plain string (the existing
    shape — fully backward compatible) or { content, metadata }. The metadata
    field's type is inferred from the adapter via a new
    TSystemPromptMetadata generic on TextAdapter / BaseTextAdapter:

    • @tanstack/ai-anthropic declares AnthropicSystemPromptMetadata
      users get cache_control autocomplete and type-checking on
      systemPrompts[i].metadata for Anthropic chats.
    • Adapters with no per-prompt metadata (OpenAI, Gemini, Ollama,
      OpenRouter, openai-base) inherit the default never, which means the
      metadata field carries no meaningful value at the call site —
      TypeScript only accepts undefined there. Provider-foreign metadata
      that reaches an adapter via JS / as any is silently dropped, never
      written to the wire.
    import { chat } from '@tanstack/ai'
    import { anthropicText } from '@tanstack/ai-anthropic'
    
    // Anthropic — `cache_control` is autocompleted, no `satisfies` needed.
    chat({
      adapter: anthropicText({ apiKey }, 'claude-sonnet-4-6'),
      systemPrompts: [
        {
          content: 'Stable instructions — cache me.',
          metadata: { cache_control: { type: 'ephemeral' } },
        },
        'Volatile per-request instruction.',
      ],
    })
    
    // OpenAI — `metadata` is `never`; only `undefined` is assignable, so the
    // field is effectively unusable. The object form without `metadata` still
    // works for portability.
    chat({
      adapter: openaiText({ apiKey }, 'gpt-4o-mini'),
      systemPrompts: [
        'Plain string.',
        { content: 'Object form without metadata is allowed.' },
      ],
    })

    New exports:

    • @tanstack/ai: SystemPrompt, NormalizedSystemPrompt types and the
      normalizeSystemPrompts() helper adapters use to normalize the wide
      input shape to { content, metadata? } before consumption.
    • @tanstack/ai-anthropic: AnthropicSystemPromptMetadata interface
      (currently exposes cache_control for prompt caching).

    Internal:

    • New TSystemPromptMetadata = never generic on TextAdapter /
      BaseTextAdapter, surfaced via '~types'['systemPromptMetadata']
      for inference at the chat() call site.
    • Anthropic adapter reads metadata.cache_control and attaches it to
      the corresponding TextBlockParam.
    • All other text adapters call normalizeSystemPrompts() and join
      .content for their respective instructions / system /
      systemInstruction fields. Foreign metadata that reaches them via JS
      / as any is dropped (never written to the wire).
    • normalizeSystemPrompts() is the public API boundary and throws
      TypeError (naming the offending index) for object-form entries whose
      content isn't a string — preventing literal "undefined" from
      reaching the model on stale call sites.
    • OpenTelemetry middleware attaches per-prompt metadata as the
      tanstack.ai.system_prompt.metadata JSON span attribute when
      captureContent: true and at least one entry carries metadata, so
      observability backends can distinguish cache hit/miss for Anthropic.
    • @tanstack/ai-event-client mirrors the SystemPrompt shape locally
      (avoids a circular import) and projects metadata away on the devtools
      wire — devtools UI still receives Array<string>.
  • Updated dependencies [496db9c]:

    • @tanstack/ai@0.20.0

@tanstack/ai-preact@0.6.27

Patch Changes

  • Updated dependencies [496db9c]:
    • @tanstack/ai@0.20.0
    • @tanstack/ai-client@0.11.2

@tanstack/ai-react@0.11.2

Patch Changes

  • Updated dependencies [496db9c]:
    • @tanstack/ai@0.20.0
    • @tanstack/ai-client@0.11.2

@tanstack/ai-solid@0.10.2

Patch Changes

  • Updated dependencies [496db9c]:
    • @tanstack/ai@0.20.0
    • @tanstack/ai-client@0.11.2

@tanstack/ai-svelte@0.10.2

Patch Changes

  • Updated dependencies [496db9c]:
    • @tanstack/ai@0.20.0
    • @tanstack/ai-client@0.11.2

@tanstack/ai-vue@0.10.3

Patch Changes

  • Updated dependencies [496db9c]:
    • @tanstack/ai@0.20.0
    • @tanstack/ai-client@0.11.2

@tanstack/ai-vue-ui@0.1.39

Patch Changes

  • Updated dependencies []:
    • @tanstack/ai-vue@0.10.3

@tanstack/openai-base@0.3.3

Patch Changes

  • feat(ai): systemPrompts accept { content, metadata } with adapter-inferred metadata typing (#575)

    chat({ systemPrompts }) now accepts either a plain string (the existing
    shape — fully backward compatible) or { content, metadata }. The metadata
    field's type is inferred from the adapter via a new
    TSystemPromptMetadata generic on TextAdapter / BaseTextAdapter:

    • @tanstack/ai-anthropic declares AnthropicSystemPromptMetadata
      users get cache_control autocomplete and type-checking on
      systemPrompts[i].metadata for Anthropic chats.
    • Adapters with no per-prompt metadata (OpenAI, Gemini, Ollama,
      OpenRouter, openai-base) inherit the default never, which means the
      metadata field carries no meaningful value at the call site —
      TypeScript only accepts undefined there. Provider-foreign metadata
      that reaches an adapter via JS / as any is silently dropped, never
      written to the wire.
    import { chat } from '@tanstack/ai'
    import { anthropicText } from '@tanstack/ai-anthropic'
    
    // Anthropic — `cache_control` is autocompleted, no `satisfies` needed.
    chat({
      adapter: anthropicText({ apiKey }, 'claude-sonnet-4-6'),
      systemPrompts: [
        {
          content: 'Stable instructions — cache me.',
          metadata: { cache_control: { type: 'ephemeral' } },
        },
        'Volatile per-request instruction.',
      ],
    })
    
    // OpenAI — `metadata` is `never`; only `undefined` is assignable, so the
    // field is effectively unusable. The object form without `metadata` still
    // works for portability.
    chat({
      adapter: openaiText({ apiKey }, 'gpt-4o-mini'),
      systemPrompts: [
        'Plain string.',
        { content: 'Object form without metadata is allowed.' },
      ],
    })

    New exports:

    • @tanstack/ai: SystemPrompt, NormalizedSystemPrompt types and the
      normalizeSystemPrompts() helper adapters use to normalize the wide
      input shape to { content, metadata? } before consumption.
    • @tanstack/ai-anthropic: AnthropicSystemPromptMetadata interface
      (currently exposes cache_control for prompt caching).

    Internal:

    • New TSystemPromptMetadata = never generic on TextAdapter /
      BaseTextAdapter, surfaced via '~types'['systemPromptMetadata']
      for inference at the chat() call site.
    • Anthropic adapter reads metadata.cache_control and attaches it to
      the corresponding TextBlockParam.
    • All other text adapters call normalizeSystemPrompts() and join
      .content for their respective instructions / system /
      systemInstruction fields. Foreign metadata that reaches them via JS
      / as any is dropped (never written to the wire).
    • normalizeSystemPrompts() is the public API boundary and throws
      TypeError (naming the offending index) for object-form entries whose
      content isn't a string — preventing literal "undefined" from
      reaching the model on stale call sites.
    • OpenTelemetry middleware attaches per-prompt metadata as the
      tanstack.ai.system_prompt.metadata JSON span attribute when
      captureContent: true and at least one entry carries metadata, so
      observability backends can distinguish cache hit/miss for Anthropic.
    • @tanstack/ai-event-client mirrors the SystemPrompt shape locally
      (avoids a circular import) and projects metadata away on the devtools
      wire — devtools UI still receives Array<string>.
  • Updated dependencies [496db9c]:

    • @tanstack/ai@0.20.0

@tanstack/preact-ai-devtools@0.1.36

Patch Changes

  • Updated dependencies []:
    • @tanstack/ai-devtools-core@0.3.32

@tanstack/react-ai-devtools@0.2.36

Patch Changes

  • Updated dependencies []:
    • @tanstack/ai-devtools-core@0.3.32

@tanstack/solid-ai-devtools@0.2.36

Patch Changes

  • Updated dependencies []:
    • @tanstack/ai-devtools-core@0.3.32

@github-actions github-actions Bot force-pushed the changeset-release/main branch from b6240e3 to a496c17 Compare May 19, 2026 22:01
@AlemTuzlak AlemTuzlak merged commit 144e090 into main May 19, 2026
2 checks passed
@AlemTuzlak AlemTuzlak deleted the changeset-release/main branch May 19, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant