Loading workspace insights... Statistics interval
7 days30 daysLatest CI Pipeline Executions
d999f7e9 fix(ai, ai-client): replace removed StreamChunk casts with typed event data
Follow-up to the cast removals: where the old `as unknown as StreamChunk`
casts were hiding real data-shape issues, fix the data instead of
re-introducing the bypass.
Source:
- ai-client/src/connection-adapters.ts: synth RUN_FINISHED chunk now
includes `threadId` (the cast had been hiding the missing required
field). Use `EventType.RUN_FINISHED` / `EventType.RUN_ERROR` literals.
Test helpers (`chunk()` / `makeChunk()` / `sc()`):
- Replace string-typed `(type: string, fields) => StreamChunk` (which
needed `as unknown as StreamChunk` to lie) with a generic
`<T extends StreamChunk['type']>(type: T, fields?) =>
Extract<StreamChunk, { type: T }>`. One typed cast remains inside
each helper at the boundary; no `as unknown` casts.
- `sc()` retyped as a typed identity (`<T extends StreamChunk>(c: T) => T`)
so inline literal narrowing flows from the `type` discriminant.
Inline literals + missing fields fixed at call sites:
- All `chunk('X', ...)` → `chunk(EventType.X, ...)` across
stream-processor.test.ts (42), strip-to-spec-middleware.test.ts (4),
chat.test.ts (1).
- All `type: 'X'` inside test object literals → `type: EventType.X`
across stream-to-response, custom-events-integration, extend-adapter,
stream-processor (the four MESSAGES_SNAPSHOT inline literals).
- extend-adapter mock RUN_FINISHED gained `threadId`.
- custom-events-integration TOOL_CALL_START gained `toolCallName`
(the cast had been hiding the missing required field).
- stream-processor MESSAGES_SNAPSHOT bodies (the two whose casts were
removed) converted from TanStack `UIMessage` shape (parts/createdAt)
to AG-UI `Message` shape (id/role/content) — the processor casts
internally, but the upstream MessagesSnapshotEvent.messages field
requires AG-UI Message.
types.ts is untouched.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> d999f7e9 fix(ai, ai-client): replace removed StreamChunk casts with typed event data
Follow-up to the cast removals: where the old `as unknown as StreamChunk`
casts were hiding real data-shape issues, fix the data instead of
re-introducing the bypass.
Source:
- ai-client/src/connection-adapters.ts: synth RUN_FINISHED chunk now
includes `threadId` (the cast had been hiding the missing required
field). Use `EventType.RUN_FINISHED` / `EventType.RUN_ERROR` literals.
Test helpers (`chunk()` / `makeChunk()` / `sc()`):
- Replace string-typed `(type: string, fields) => StreamChunk` (which
needed `as unknown as StreamChunk` to lie) with a generic
`<T extends StreamChunk['type']>(type: T, fields?) =>
Extract<StreamChunk, { type: T }>`. One typed cast remains inside
each helper at the boundary; no `as unknown` casts.
- `sc()` retyped as a typed identity (`<T extends StreamChunk>(c: T) => T`)
so inline literal narrowing flows from the `type` discriminant.
Inline literals + missing fields fixed at call sites:
- All `chunk('X', ...)` → `chunk(EventType.X, ...)` across
stream-processor.test.ts (42), strip-to-spec-middleware.test.ts (4),
chat.test.ts (1).
- All `type: 'X'` inside test object literals → `type: EventType.X`
across stream-to-response, custom-events-integration, extend-adapter,
stream-processor (the four MESSAGES_SNAPSHOT inline literals).
- extend-adapter mock RUN_FINISHED gained `threadId`.
- custom-events-integration TOOL_CALL_START gained `toolCallName`
(the cast had been hiding the missing required field).
- stream-processor MESSAGES_SNAPSHOT bodies (the two whose casts were
removed) converted from TanStack `UIMessage` shape (parts/createdAt)
to AG-UI `Message` shape (id/role/content) — the processor casts
internally, but the upstream MessagesSnapshotEvent.messages field
requires AG-UI Message.
types.ts is untouched.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> 4117bb1c fix(ai): revert summarize TProviderOptions constraint to extends object
6d99fad8 tightened the constraint from `extends object` to `extends
Record<string, unknown>` alongside aligning the default. The default
change was correct; the constraint change broke vite build / DTS emit
for ai-openai, ai-anthropic, ai-gemini, ai-grok, ai-ollama. Their
summarize factories instantiate `ChatStreamSummarizeAdapter<TModel,
InferTextProviderOptions<XTextAdapter<TModel>>>`, and the inferred
per-model option shapes (`OpenAIBaseOptions & OpenAIReasoningOptions &
...` etc.) are typed interfaces with named optional fields and no
string index signature — TS won't assign them to
`Record<string, unknown>`.
Revert just the constraint to `extends object`, keep the default at
`Record<string, unknown>`. Restores the pattern `BaseSummarizeAdapter`
already had on main, now applied uniformly across all four
declarations. The 7 activity-layer `<string, Record<string, unknown>>`
instantiations in summarize/index.ts revert to `<string, object>`, and
the two `summarizeOptions: SummarizationOptions = {...}` literals are
explicitly annotated `SummarizationOptions<object>` so the
modelOptions: object | undefined destructured from the activity-layer
options assigns correctly.
Changeset paragraph 5 amended to describe what actually shipped
(default-aligned, constraint preserved).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> a069706b docs(openai-base): rewrite README; consolidate summarize changeset
README:
- Drop the broken "Renamed from" note (referenced an outdated state).
- Drop the Vercel `@ai-sdk/openai-compatible` industry-term paragraph and
the surrounding "Why this package exists" rationale that explained the
prior rename — package is back to `openai-base`, that history is moot.
- Reframe TL;DR around the actual current contract: "providers that drive
the official `openai` SDK against a different `baseURL`" (only
ai-openai, ai-grok, ai-groq remain on the base after this PR).
- Remove ai-openrouter from subclass lists and the architecture diagram —
it was decoupled in this PR and now extends `BaseTextAdapter` directly.
- Rewrite the hooks section: the old `callChatCompletion(Stream)` /
`callResponse(Stream)` abstract methods were removed in 7aff8b18; the
base now takes a pre-built `OpenAI` client and calls
`client.chat.completions.create` / `client.responses.create` itself.
Document `convertMessage`, `mapOptionsToRequest`, `extractReasoning`,
`transformStructuredOutput`, `makeStructuredOutputCompatible`,
`processStreamChunks`, `extractTextFromResponse` as the real surface.
- Update "build a new provider" example to point at ai-grok / ai-groq.
Changesets:
- Replace the narrow `summarize-tighten-provider-options-generic.md`
(which only covered 6d99fad8) with a comprehensive
`summarize-unify-on-chat-stream-wrapper.md` that also covers e0dcb778
(provider summarize unification on `ChatStreamSummarizeAdapter`,
`modelOptions` plumbing fix in the activity layer, new
`InferTextProviderOptions<TAdapter>` helper, and removal of the
bespoke `*SummarizeProviderOptions` interfaces from 6 provider
packages). Adds patch bumps for ai-anthropic / ai-gemini / ai-ollama
which were previously uncovered.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> a069706b docs(openai-base): rewrite README; consolidate summarize changeset
README:
- Drop the broken "Renamed from" note (referenced an outdated state).
- Drop the Vercel `@ai-sdk/openai-compatible` industry-term paragraph and
the surrounding "Why this package exists" rationale that explained the
prior rename — package is back to `openai-base`, that history is moot.
- Reframe TL;DR around the actual current contract: "providers that drive
the official `openai` SDK against a different `baseURL`" (only
ai-openai, ai-grok, ai-groq remain on the base after this PR).
- Remove ai-openrouter from subclass lists and the architecture diagram —
it was decoupled in this PR and now extends `BaseTextAdapter` directly.
- Rewrite the hooks section: the old `callChatCompletion(Stream)` /
`callResponse(Stream)` abstract methods were removed in 7aff8b18; the
base now takes a pre-built `OpenAI` client and calls
`client.chat.completions.create` / `client.responses.create` itself.
Document `convertMessage`, `mapOptionsToRequest`, `extractReasoning`,
`transformStructuredOutput`, `makeStructuredOutputCompatible`,
`processStreamChunks`, `extractTextFromResponse` as the real surface.
- Update "build a new provider" example to point at ai-grok / ai-groq.
Changesets:
- Replace the narrow `summarize-tighten-provider-options-generic.md`
(which only covered 6d99fad8) with a comprehensive
`summarize-unify-on-chat-stream-wrapper.md` that also covers e0dcb778
(provider summarize unification on `ChatStreamSummarizeAdapter`,
`modelOptions` plumbing fix in the activity layer, new
`InferTextProviderOptions<TAdapter>` helper, and removal of the
bespoke `*SummarizeProviderOptions` interfaces from 6 provider
packages). Adds patch bumps for ai-anthropic / ai-gemini / ai-ollama
which were previously uncovered.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> 02a092ec refactor(ai): tighten summarize TProviderOptions to Record<string, unknown>
Unify the generic constraint and default across the summarize surface:
- `SummarizationOptions`: `extends object = Record<string, any>` →
`extends Record<string, unknown> = Record<string, unknown>`
- `SummarizeAdapter` / `BaseSummarizeAdapter`: constraint tightened from
`extends object` to `extends Record<string, unknown>` (default was
already `Record<string, unknown>`)
- `ChatStreamSummarizeAdapter`: `extends object = Record<string, any>` →
`extends Record<string, unknown> = Record<string, unknown>`
- `activities/summarize/index.ts` instantiation sites: literal
`<string, object>` → `<string, Record<string, unknown>>`
Removes the three-way default split (`object` / `Record<string, any>` /
`Record<string, unknown>`) that lived inside the summarize folder, and
forces unparameterised consumers to narrow before indexed access.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> 02a092ec refactor(ai): tighten summarize TProviderOptions to Record<string, unknown>
Unify the generic constraint and default across the summarize surface:
- `SummarizationOptions`: `extends object = Record<string, any>` →
`extends Record<string, unknown> = Record<string, unknown>`
- `SummarizeAdapter` / `BaseSummarizeAdapter`: constraint tightened from
`extends object` to `extends Record<string, unknown>` (default was
already `Record<string, unknown>`)
- `ChatStreamSummarizeAdapter`: `extends object = Record<string, any>` →
`extends Record<string, unknown> = Record<string, unknown>`
- `activities/summarize/index.ts` instantiation sites: literal
`<string, object>` → `<string, Record<string, unknown>>`
Removes the three-way default split (`object` / `Record<string, any>` /
`Record<string, unknown>`) that lived inside the summarize folder, and
forces unparameterised consumers to narrow before indexed access.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>