Loading workspace insights... Statistics interval
7 days30 daysLatest CI Pipeline Executions
2d57f841 refactor(adapters): address PR review — jsdoc, casts, zod, finishReason
Apply review feedback from PR #545:
- Restore JSDoc removed during the openai-base media/summarize refactor
(26 blocks across ai-openai, ai-grok, ai-anthropic, ai-gemini,
ai-openrouter adapters). Only restore where the documented symbol still
exists post-refactor; skip JSDoc tied to removed classes / provider-
options interfaces.
- Drop `as` casts on stream chunks in ai-openrouter (responses-text.ts
output_item.{added,done} handlers, response.completed handler) by typing
`NormalizedStreamEvent.item` as the SDK's `OutputItems` discriminated
union and `.response` as `Partial<OpenResponsesResult>`. Discriminated-
union narrowing now works without bypass.
- Drop request-builder casts in ai-openrouter/{text,responses-text}.ts:
`as InputsItem`, `as ChatMessages`, `as ChatContentItems`,
`as ResponsesRequest['tools' | 'text' | 'input']`,
`as Omit<ChatRequest, 'stream'>`, `as Record<string, any>` on
modelOptions spread.
- Drop SDK-return casts `as AsyncIterable<StreamEvents>` /
`as AsyncIterable<ChatStreamChunk>` — `EventStream<T>` already is
`AsyncIterable<T>`.
- Drop `tool as Tool` in the webSearchTool guard — `Tool<any, any, any>`
is assignable to `Tool` directly.
- Remove `'function_call'` from RunFinishedEvent.finishReason union.
Normalize OpenAI's legacy v1 function_call termination to `tool_calls`
inside chat-completions-text — the SDK-vocabulary value no longer leaks
into the public AG-UI type.
- Drop redundant `satisfies StreamChunk` from yield/array-element sites
across adapters and ai-client tests. The contextual type from
`AsyncIterable<StreamChunk>` / `Array<StreamChunk>` already validates
every emission; the suffix added no extra safety.
- Annotate the `ev.*` builders in ai/tests/test-utils.ts with explicit
return types (RunStartedEvent, TextMessageStartEvent, …) instead of
`satisfies StreamChunk`. Each builder now returns the precise event
variant rather than the wide union.
- Drop zod from ai-openrouter peerDependencies — no source imports zod;
it's only used in tests, where it stays as a devDep. (OpenRouter SDK
already declares zod as a regular dep, so transitive consumers aren't
affected.)
- Clean up mid-PR rename leftovers: stale "openai-compatible adapters"
jsdoc in ai-openai/utils/client.ts, and `'openai-compatible'` /
`'openai-compatible-responses'` default-name strings in the
openai-base test subclasses (now `openai-base` / `openai-base-responses`).