feat: improve the event system to emit more data and conventionalize … #239
main fromrefs/pull/239/head·merged by AlemTuzlak View on GitHubImproves the event system and adds new features to the devtools for improved observability!
🎯 Changes#
✅ Checklist#
- I have followed the steps in the Contributing guide.
- I have tested this code locally with
pnpm run test:pr.
🚀 Release Impact#
- This change affects published code, and I have generated a changeset.
- This change is docs/CI/dev-only (no release).
Summary by CodeRabbit#
New Features
- Expanded observability: structured events for text, tools, image, speech, transcription, and video
- New Activity Events tab and image/speech/transcription/video tabs with pulse indicators
- Conversation UI: JSON-rendered assistant content, model options and system prompts collapsibles, and per-message tool duration display
Documentation
- Added observability guide with event naming, examples, and chat-replay instructions
- README updated to highlight structured, typed event support
- 1
View your CI Pipeline Execution ↗ for commit 3d46c8490916b1f0a66ed7086d3d4278956bf007
Command Status Duration Result nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded 2m 54s View ↗ nx run-many --targets=build --exclude=examples/**✅ Succeeded 1m 9s View ↗
☁️ Nx Cloud last updated this comment at
2026-01-20 13:06:17UTC@tanstack/ai
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai@239@tanstack/ai-anthropic
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-anthropic@239@tanstack/ai-client
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-client@239@tanstack/ai-devtools-core
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-devtools-core@239@tanstack/ai-gemini
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-gemini@239@tanstack/ai-grok
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-grok@239@tanstack/ai-ollama
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-ollama@239@tanstack/ai-openai
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-openai@239@tanstack/ai-openrouter
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-openrouter@239@tanstack/ai-preact
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-preact@239@tanstack/ai-react
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-react@239@tanstack/ai-react-ui
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-react-ui@239@tanstack/ai-solid
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-solid@239@tanstack/ai-solid-ui
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-solid-ui@239@tanstack/ai-svelte
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-svelte@239@tanstack/ai-vue
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vue@239@tanstack/ai-vue-ui
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vue-ui@239@tanstack/preact-ai-devtools
npm i https://pkg.pr.new/TanStack/ai/@tanstack/preact-ai-devtools@239@tanstack/react-ai-devtools
npm i https://pkg.pr.new/TanStack/ai/@tanstack/react-ai-devtools@239@tanstack/solid-ai-devtools
npm i https://pkg.pr.new/TanStack/ai/@tanstack/solid-ai-devtools@239commit:
3d46c84Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
packages/typescript/ai-devtools/src/components/conversation/ConversationTabs.tsx (1)
107-110: Non-reactive early return may hide tabs that appear later.The
if (visibleTabCount() <= 1) return nullcheck runs only during initial component execution. In SolidJS, if the conversation's events load asynchronously, this check won't re-evaluate, and the tabs will remain hidden even when they should appear.🐛 Wrap in Show for reactive rendering
- // Don't render tabs if only one tab would be visible - if (visibleTabCount() <= 1) { - return null - } - - return ( + return ( + <Show when={visibleTabCount() > 1}> <div class={styles().conversationDetails.tabsContainer}> {/* ... tab buttons ... */} </div> + </Show> )testing/panel/src/lib/recording.ts (1)
77-77: SharedchunkIndexcauses incorrect indices when multiple streams are active.chunkIndexis shared across all active streams. If multiple streams are being recorded simultaneously, chunk indices will be interleaved incorrectly, resulting in non-sequential indices within each stream's recording.Move the chunk index into the per-stream state:
🐛 Proposed fix
Add
chunkIndexto the stream state (around line 68):toolCalls: Map<string, RecordedToolCall> finishReason: string | null traceId?: string + chunkIndex: number } >() - - let chunkIndex = 0Initialize it when creating stream state (around line 224):
toolCalls: new Map<string, RecordedToolCall>(), finishReason: null, traceId: undefined, + chunkIndex: 0, })Then update all usages to reference
stream.chunkIndexinstead of the shared variable, incrementing after use.packages/typescript/ai/src/event-client.ts (1)
8-22: Remove duplicate type definitions and import from./typesinstead.ToolCallStateandToolResultStateare duplicated betweenevent-client.tsandtypes.ts. Import and re-export them from./typesto maintain a single source of truth:Suggested change
-export type ToolCallState = - | 'awaiting-input' // Received start but no arguments yet - | 'input-streaming' // Partial arguments received - | 'input-complete' // All arguments received - | 'approval-requested' // Waiting for user approval - | 'approval-responded' // User has approved/denied - -export type ToolResultState = - | 'streaming' // Placeholder for future streamed output - | 'complete' // Result is complete - | 'error' // Error occurred +import type { ToolCallState, ToolResultState } from './types' +export type { ToolCallState, ToolResultState }packages/typescript/ai/src/activities/generateVideo/index.ts (1)
214-286: Emit a completion event whengetVideoStatusthrows. Ifadapter.getVideoStatusrejects, you emitvideo:request:startedwithout a matching completion event, which leaves traces incomplete and skews observability.🔧 Proposed fix
- const statusResult = await adapter.getVideoStatus(jobId) + let statusResult: VideoStatusResult + try { + statusResult = await adapter.getVideoStatus(jobId) + } catch (error) { + aiEventClient.emit('video:request:completed', { + requestId, + provider: adapter.name, + model: adapter.model, + requestType: 'status', + jobId, + status: 'failed', + error: error instanceof Error ? error.message : 'Failed to get video status', + duration: Date.now() - startTime, + timestamp: Date.now(), + }) + throw error + }🤖 Fix all issues with AI agents
In `@docs/guides/observability.md`: - Line 30: Docs list an event (`transcription:usage`) that isn't emitted; update either the code or the docs. Option A: remove `transcription:usage` from the docs so the listed events match actual emissions (`transcription:request:started` and `transcription:request:completed`). Option B: implement emission of TranscriptionUsageEvent inside the generateTranscription function (emit `transcription:usage` with the defined TranscriptionUsageEvent payload at the point you calculate usage/cost after transcription completes) and ensure any listeners/tests are updated to expect this new event. In `@packages/typescript/ai-client/src/events.ts`: - Line 219: The implementation signature of emitEvent uses data?: Record<string, any> which mismatches the abstract declaration data?: Record<string, unknown>; update the concrete method emitEvent(eventName: string, data?: Record<string, unknown>): void to use Record<string, unknown> so the types align and preserve type safety (ensure any other references to emitEvent in this class use the same signature). In `@packages/typescript/ai/src/activities/chat/index.ts`: - Around line 929-932: The getContentString function currently stringifies null into "null"; change it to explicitly handle null by returning an empty string (or appropriate sentinel) when ModelMessage['content'] === null, keeping the existing behavior for strings (return as-is) and for Array<ContentPart> (JSON.stringify). Update the getContentString implementation to first check for content === null and return '' before the typeof/string and JSON.stringify branches, and adjust any callers/tests if they relied on the former "null" string. In `@packages/typescript/ai/src/activities/generateSpeech/index.ts`: - Around line 111-133: The speech event payloads currently emit sensitive fields unconditionally; change aiEventClient.emit for 'speech:request:started' and 'speech:request:completed' to gate inclusion of raw content behind an explicit opt-in flag (e.g., emitSensitiveSpeechPayloads or allowTelemetrySensitiveData) and otherwise redact/truncate: replace rest.text with a redacted or short textSnippet (e.g., first N chars + "[REDACTED]") and replace result.audio/result.audio (base64) with either audioLength or truncatedBase64/placeholder; ensure modelOptions and other potentially sensitive fields are also sanitized prior to emitting and that the opt-in flag is checked (read from config/context) before including full fields. In `@packages/typescript/ai/src/event-client.ts`: - Around line 391-429: The client event interfaces are missing the BaseEventContext/source property which other events use; update ClientLoadingChangedEvent, ClientErrorChangedEvent, ClientMessagesClearedEvent, ClientReloadedEvent, and ClientStoppedEvent to extend BaseEventContext (or add source?: 'client' | 'server') so their shapes match DefaultChatClientEventEmitter emissions and tests; modify the interface declarations (e.g., "export interface ClientLoadingChangedEvent extends BaseEventContext { ... }") for each listed interface and keep existing fields unchanged. In `@testing/panel/src/lib/recording.ts`: - Around line 134-146: normalizeFinishReason currently maps any unrecognized value (including null) to 'stop', losing the null semantic; update normalizeFinishReason so that if the incoming finishReason parameter is null it returns null (preserving FinishReason|null), otherwise validate against the allowed literals ('stop'|'length'|'content_filter'|'tool_calls') and return the matching string or fallback to 'stop' for unknown strings; ensure the function signature and the FinishReason type remain consistent and reference the normalizeFinishReason and FinishReason symbols when making the change.🧹 Nitpick comments (19)
packages/typescript/ai-devtools/src/components/conversation/MessageCard.tsx (2)
47-53: Minor simplification possible.The
|| 0default followed by filtering> 0is slightly redundant. Consider simplifying:♻️ Optional simplification
const toolDuration = () => { - const durations = msg() - .toolCalls?.map((tool) => tool.duration || 0) - .filter((duration) => duration > 0) - if (!durations || durations.length === 0) return 0 - return durations.reduce((total, duration) => total + duration, 0) + const durations = msg().toolCalls?.map((tool) => tool.duration).filter(Boolean) as number[] | undefined + if (!durations?.length) return 0 + return durations.reduce((total, duration) => total + duration, 0) }
143-154: MemoizeparseJsonContentto avoid parsing JSON twice.In SolidJS,
parseJsonContent()is computed twice per render cycle—once in thewhencondition (line 144) and again in the render body (line 152). For large JSON payloads, this is inefficient. Additionally, the non-null assertion!could be avoided with memoization.♻️ Memoize with createMemo
Update the function definition to use
createMemo:import { For, Show, createMemo } from 'solid-js'-const parseJsonContent = () => { +const parsedJsonContent = createMemo(() => { const content = msg().content if (typeof content !== 'string') return null const trimmed = content.trim() if (!trimmed.startsWith('{') && !trimmed.startsWith('[')) return null try { return JSON.parse(trimmed) as Record<string, unknown> | Array<unknown> } catch { return null } -} +})Then update the usage:
<Show - when={msg().role === 'tool' && parseJsonContent() !== null} + when={msg().role === 'tool' && parsedJsonContent() !== null} fallback={ <div class={styles().conversationDetails.messageContent}> {msg().content} </div> } > <div class={styles().conversationDetails.toolJsonContainer}> - <JsonTree value={parseJsonContent()!} /> + <JsonTree value={parsedJsonContent()!} /> </div> </Show>packages/typescript/ai-devtools/src/styles/use-styles.ts (1)
742-756: Respect reduced-motion preferences for the pulsing animation. Consider disabling the pulse when users request reduced motion.♿ Suggested tweak
tabButtonPulse: css` position: relative; animation: activityPulse 1.4s ease-in-out infinite; + `@media` (prefers-reduced-motion: reduce) { + animation: none; + } `@keyframes` activityPulse { 0% { box-shadow: 0 0 0 0 ${colors.pink[400]}55; } 70% { box-shadow: 0 0 0 8px ${colors.pink[400]}00; } 100% { box-shadow: 0 0 0 0 ${colors.pink[400]}00; } } `,packages/typescript/ai-devtools/src/store/ai-context.tsx (1)
1617-1899: Consider extracting a helper for activity event handlers.The image, speech, transcription, and video event handlers follow an identical pattern: resolve conversation ID, create conversation if needed, then add activity event. This could be simplified with a shared helper function.
♻️ Suggested helper extraction
function handleActivityEvent( e: { payload: { requestId: string; clientId?: string; timestamp: number } }, activityType: 'image' | 'speech' | 'transcription' | 'video', eventName: string, ) { const { requestId, clientId, timestamp } = e.payload const eventKey = `${activityType}Events` as const let conversationId = clientId if (!conversationId || !state.conversations[conversationId]) { conversationId = `${activityType}-${requestId}` getOrCreateConversation( conversationId, 'server', `${activityType.charAt(0).toUpperCase() + activityType.slice(1)} (${requestId.substring(0, 8)})`, ) } addActivityEvent(conversationId, eventKey, { id: requestId, name: eventName, timestamp, payload: e.payload, }) }Then each handler becomes:
aiEventClient.on('image:request:started', (e) => { handleActivityEvent(e, 'image', 'image:request:started') })packages/typescript/ai-devtools/src/components/conversation/ConversationTabs.tsx (1)
45-80: Previous count trackers may lose state on component re-render.The
previousImageCount,previousSpeechCount, etc. variables are declared withletoutside the component's reactive scope. If the component re-renders (e.g., due to parent re-render), these will reset to 0, potentially causing unexpected pulse animations.Consider using
createSignalor a ref pattern for these trackers if re-render behavior needs to be preserved.♻️ Alternative using refs
- let previousImageCount = 0 - let previousSpeechCount = 0 - let previousTranscriptionCount = 0 - let previousVideoCount = 0 + const previousCounts = { image: 0, speech: 0, transcription: 0, video: 0 } createEffect(() => { const count = imageCount() - if (count > 0 && previousImageCount === 0) { + if (count > 0 && previousCounts.image === 0) { triggerPulse(setImagePulse) } - previousImageCount = count + previousCounts.image = count })packages/typescript/ai-devtools/src/components/conversation/ActivityEventsTab.tsx (1)
47-49: Consider handling large payloads in JSON preview.JSON.stringify(event.payload, null, 2)will render the entire payload regardless of size. For events with large payloads, this could impact rendering performance or create an unwieldy UI.Consider truncating large payloads or adding a "show more" pattern for payloads exceeding a certain size.
packages/typescript/ai-devtools/src/components/ConversationDetails.tsx (1)
27-91: Tab selection logic has redundant checks.The conditions like
conv.hasImage || (conv.imageEvents && conv.imageEvents.length > 0)duplicate logic already present inConversationTabs.tsx'shasImage()function. Consider extracting these checks to a shared utility or the Conversation type to maintain consistency.testing/panel/src/lib/recording.ts (3)
197-208: Type casting workaround should be replaced with proper package exports.The local
DevtoolsEventClienttype definition and cast bypass the actual type ofbaseAiEventClient. This appears to be a workaround for the missing type exports flagged earlier.Once
AIDevtoolsEventMapis properly exported from the package, consider using the native types from the package rather than casting.
423-436: Consolidate duplicatetext:request:completedsubscriptions.Two separate handlers subscribe to
text:request:completed:- Lines 424-436: Updates
accumulatedContentandfinishReason - Lines 465-510: Saves the recording to file
While JavaScript's event loop ordering should ensure the first handler completes its synchronous work before the second handler runs, having two subscriptions for the same event is confusing and fragile. Consolidate into a single handler:
♻️ Proposed consolidation
- // Subscribe to text:request:completed to get final tool calls - const unsubscribeChatCompleted = aiEventClient.on( - 'text:request:completed', - (event) => { - const { streamId, content, finishReason } = event.payload - if (!shouldRecord(streamId)) return - const stream = activeStreams.get(streamId) - if (stream) { - stream.accumulatedContent = content - stream.finishReason = finishReason || null - } - }, - { withEventTarget: false }, - ) - - // Subscribe to text:request:completed to save recording - const unsubscribeStreamEnded = aiEventClient.on( + // Subscribe to text:request:completed to finalize and save recording + const unsubscribeStreamEnded = aiEventClient.on( 'text:request:completed', async (event) => { - const { streamId } = event.payload + const { streamId, content, finishReason } = event.payload if (!shouldRecord(streamId)) return const stream = activeStreams.get(streamId) if (!stream) { return } + + // Update final content and finishReason + stream.accumulatedContent = content + stream.finishReason = finishReason || null try { // ... rest of save logicAlso remove
unsubscribeChatCompleted()from thestop()cleanup.Also applies to: 464-510
3-5: ImportAIDevtoolsEventMapfrom the public package API instead of the internal source path.Line 4 imports from an internal source path (
../../../../packages/typescript/ai/src/event-client) while line 3 correctly uses the published package path (@tanstack/ai/event-client). This inconsistency creates unnecessary coupling to internal file structure when the type is available through the public API.Change the import to:
import { aiEventClient as baseAiEventClient } from '@tanstack/ai/event-client' -import type { AIDevtoolsEventMap } from '../../../../packages/typescript/ai/src/event-client' +import type { AIDevtoolsEventMap } from '@tanstack/ai/event-client' import type { StreamChunk } from '@tanstack/ai'packages/typescript/ai/src/activities/generateTranscription/index.ts (2)
65-67: Consider extractingcreateIdto a shared utility.This helper is duplicated verbatim in
chat/index.ts(line 941-943) andgenerateImage/index.ts(line 86-88). Extracting it to a shared module (e.g.,../../utils.js) would reduce duplication and ensure consistent ID generation across all activities.
126-140: Consider emitting a failure event on error for observability completeness.If
adapter.transcribe()throws, atranscription:request:startedevent will be orphaned without a corresponding completion or failure event. For robust telemetry, wrap in try/catch and emittranscription:request:failedon error.Suggested pattern
+ try { const result = await adapter.transcribe({ ...rest, model }) const duration = Date.now() - startTime aiEventClient.emit('transcription:request:completed', { requestId, provider: adapter.name, model, text: result.text, language: result.language, duration, modelOptions: rest.modelOptions as Record<string, unknown> | undefined, timestamp: Date.now(), }) return result + } catch (error) { + aiEventClient.emit('transcription:request:failed', { + requestId, + provider: adapter.name, + model, + error: error instanceof Error ? error.message : String(error), + duration: Date.now() - startTime, + timestamp: Date.now(), + }) + throw error + }packages/typescript/ai/src/activities/generateImage/index.ts (1)
158-185: Consider using async/await for consistency and easier error handling.This function uses
.then()chaining whilegenerateTranscriptionusesasync/await. Usingasync/awaitwould be more consistent across activities and make it easier to add error handling (e.g., emittingimage:request:failedon rejection).Suggested refactor
- return adapter.generateImages({ ...rest, model }).then((result) => { - const duration = Date.now() - startTime - - aiEventClient.emit('image:request:completed', { - requestId, - provider: adapter.name, - model, - images: result.images.map((image) => ({ - url: image.url, - b64Json: image.b64Json, - })), - duration, - modelOptions: rest.modelOptions as Record<string, unknown> | undefined, - timestamp: Date.now(), - }) - - if (result.usage) { - aiEventClient.emit('image:usage', { - requestId, - model, - usage: result.usage, - modelOptions: rest.modelOptions as Record<string, unknown> | undefined, - timestamp: Date.now(), - }) - } - - return result - }) + const result = await adapter.generateImages({ ...rest, model }) + const duration = Date.now() - startTime + + aiEventClient.emit('image:request:completed', { + requestId, + provider: adapter.name, + model, + images: result.images.map((image) => ({ + url: image.url, + b64Json: image.b64Json, + })), + duration, + modelOptions: rest.modelOptions as Record<string, unknown> | undefined, + timestamp: Date.now(), + }) + + if (result.usage) { + aiEventClient.emit('image:usage', { + requestId, + model, + usage: result.usage, + modelOptions: rest.modelOptions as Record<string, unknown> | undefined, + timestamp: Date.now(), + }) + } + + return resultpackages/typescript/ai-client/src/chat-client.ts (1)
163-172: Consider the empty string fallback for messageId.When
this.currentMessageIdis null, the code passes an empty string toapprovalRequested. If the event consumer expects a valid message ID for correlation, this could cause issues. Consider whether the guard should also check forcurrentMessageId:- if (this.currentStreamId) { + if (this.currentStreamId && this.currentMessageId) { this.events.approvalRequested( this.currentStreamId, - this.currentMessageId || '', + this.currentMessageId, args.toolCallId,Alternatively, if an empty messageId is intentional, document this behavior.
packages/typescript/ai/src/activities/summarize/index.ts (1)
222-265: Consider emitting events for streaming summarization.The streaming path (
runStreamingSummarize) doesn't emitsummarize:request:startedorsummarize:request:completedevents, while the non-streaming path does. This inconsistency could make it harder to track streaming summarization requests in devtools.If intentional (e.g., events are emitted differently for streams), a comment clarifying this would be helpful.
packages/typescript/ai/src/activities/generateVideo/index.ts (1)
40-42: Consider centralizing request ID generation.createIdduplicates the helper used inactivities/chat/index.ts; extracting a shared utility would prevent drift and keep IDs consistent across activities.packages/typescript/ai/tests/ai-text.test.ts (1)
145-145: Differentiate duplicate test titles for clearer failures. Both tests share the same name, which makes failure output ambiguous.💡 Possible rename
- it('should emit text:request:started event with correct data', async () => { + it('should emit text:request:started event with correct data (messages/tools)', async () => { @@ - it('should emit text:request:started event with correct data', async () => { + it('should emit text:request:started event with provider/model', async () => {Also applies to: 175-175
packages/typescript/ai/src/activities/generateSpeech/index.ts (2)
65-67: Consider centralizing request-id generation.There’s already similar
createIdlogic in other activities (e.g., chat). Extracting a shared helper avoids drift in format/collision behavior across activities.
111-139: Emit a failure event to complete the lifecycle.If
adapter.generateSpeechrejects,speech:request:startedis emitted but no terminal event is produced, leaving incomplete traces in observability tooling. Consider emitting a failure event in acatchblock (naming aligned with your event conventions).✅ Suggested fix (add failure emission)
- return adapter.generateSpeech({ ...rest, model }).then((result) => { - const duration = Date.now() - startTime - - aiEventClient.emit('speech:request:completed', { - requestId, - provider: adapter.name, - model, - audio: result.audio, - format: result.format, - audioDuration: result.duration, - contentType: result.contentType, - duration, - modelOptions: rest.modelOptions as Record<string, unknown> | undefined, - timestamp: Date.now(), - }) - - return result - }) + try { + const result = await adapter.generateSpeech({ ...rest, model }) + const duration = Date.now() - startTime + + aiEventClient.emit('speech:request:completed', { + requestId, + provider: adapter.name, + model, + audio: result.audio, + format: result.format, + audioDuration: result.duration, + contentType: result.contentType, + duration, + modelOptions: rest.modelOptions as Record<string, unknown> | undefined, + timestamp: Date.now(), + }) + + return result + } catch (error) { + const duration = Date.now() - startTime + aiEventClient.emit('speech:request:failed', { + requestId, + provider: adapter.name, + model, + duration, + error: error instanceof Error ? error.message : String(error), + timestamp: Date.now(), + }) + throw error + }@@ -18,3 +18,13 @@1818 This will not only emit to the event bus (which is not present in production), but to the current eventTarget that1919 you will be able to listen to.202021+## Event naming scheme22+23+Events follow the format `<system-part>:<what-it-does>`.24+25+- Text: `text:request:started`, `text:message:created`, `text:chunk:content`, `text:usage`26+- Tools: `tools:approval:requested`, `tools:call:completed`, `tools:result:added`27+- Summarize: `summarize:request:started`, `summarize:usage`28+- Image: `image:request:started`, `image:usage`29+- Speech: `speech:request:started`, `speech:usage`30+- Transcription: `transcription:request:started`, `transcription:usage`⚠️ Potential issue | 🟡 Minor
🧩 Analysis chain
🏁 Script executed:
rg -n "transcription:usage" --type=tsRepository: TanStack/ai
Length of output: 389
🏁 Script executed:
rg -n "emit.*transcription:usage|transcription:usage.*emit|dispatch.*transcription:usage" --type=ts -B 2 -A 2Repository: TanStack/ai
Length of output: 37
🏁 Script executed:
rg -n "transcription.*usage" packages/typescript/ai/src --type=ts -B 2 -A 2Repository: TanStack/ai
Length of output: 952
🏁 Script executed:
fd -e ts -e tsx | xargs grep -l "generateTranscription" | head -5Repository: TanStack/ai
Length of output: 338
🏁 Script executed:
rg -n "generateTranscription" packages/typescript/ai/src --type=ts -lRepository: TanStack/ai
Length of output: 206
🏁 Script executed:
cat -n packages/typescript/ai/src/activities/generateTranscription/index.tsRepository: TanStack/ai
Length of output: 5970
🏁 Script executed:
sed -n '25,35p' docs/guides/observability.mdRepository: TanStack/ai
Length of output: 740
Remove
transcription:usagefrom documentation or implement the event emission.The documentation on line 30 lists
transcription:usageas an available event, butgenerateTranscriptiononly emitstranscription:request:startedandtranscription:request:completed. TheTranscriptionUsageEventtype is defined but never emitted. Either implement the usage event in the activity or update the documentation to match the actual implementation.🤖 Prompt for AI Agents
In `@docs/guides/observability.md` at line 30, Docs list an event (`transcription:usage`) that isn't emitted; update either the code or the docs. Option A: remove `transcription:usage` from the docs so the listed events match actual emissions (`transcription:request:started` and `transcription:request:completed`). Option B: implement emission of TranscriptionUsageEvent inside the generateTranscription function (emit `transcription:usage` with the defined TranscriptionUsageEvent payload at the point you calculate usage/cost after transcription completes) and ensure any listeners/tests are updated to expect this new event.@@ -235,2 +218,2 @@235218 */236219 protected emitEvent(eventName: string, data?: Record<string, any>): void {⚠️ Potential issue | 🟡 Minor
Type mismatch between abstract and implementation signatures.
The abstract
emitEventmethod (line 18-21) declaresdata?: Record<string, unknown>, but the implementation (line 219) usesdata?: Record<string, any>. Align both toRecord<string, unknown>for type safety.Suggested fix
- protected emitEvent(eventName: string, data?: Record<string, any>): void { + protected emitEvent(eventName: string, data?: Record<string, unknown>): void {📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
Suggested change219- protected emitEvent(eventName: string, data?: Record<string, any>): void {219+ protected emitEvent(eventName: string, data?: Record<string, unknown>): void {🤖 Prompt for AI Agents
In `@packages/typescript/ai-client/src/events.ts` at line 219, The implementation signature of emitEvent uses data?: Record<string, any> which mismatches the abstract declaration data?: Record<string, unknown>; update the concrete method emitEvent(eventName: string, data?: Record<string, unknown>): void to use Record<string, unknown> so the types align and preserve type safety (ensure any other references to emitEvent in this class use the same signature).@@ -898,0 +912,21 @@912+ provider: this.adapter.name,913+ model: this.params.model,914+ clientId: this.params.conversationId,915+ source: 'server',916+ systemPrompts:917+ this.systemPrompts.length > 0 ? this.systemPrompts : undefined,918+ toolNames: this.eventToolNames,919+ options: this.eventOptions,920+ modelOptions: this.params.modelOptions as921+ | Record<string, unknown>922+ | undefined,923+ messageCount: this.initialMessageCount,924+ hasTools: this.tools.length > 0,925+ streaming: true,926+ }927+ }928+929+ private getContentString(content: ModelMessage['content']): string {930+ if (typeof content === 'string') return content931+ return JSON.stringify(content)932+ }⚠️ Potential issue | 🟡 Minor
Handle
nullcontent explicitly.ModelMessage['content']can bestring | null | Array<ContentPart>. Currently,nullcontent will be stringified to"null", which may not be the intended behavior.Suggested fix
private getContentString(content: ModelMessage['content']): string { + if (content === null) return '' if (typeof content === 'string') return content return JSON.stringify(content) }📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
Suggested change929+ private getContentString(content: ModelMessage['content']): string {930+ if (content === null) return ''931+ if (typeof content === 'string') return content932+ return JSON.stringify(content)933+ }🤖 Prompt for AI Agents
In `@packages/typescript/ai/src/activities/chat/index.ts` around lines 929 - 932, The getContentString function currently stringifies null into "null"; change it to explicitly handle null by returning an empty string (or appropriate sentinel) when ModelMessage['content'] === null, keeping the existing behavior for strings (return as-is) and for Array<ContentPart> (JSON.stringify). Update the getContentString implementation to first check for content === null and return '' before the typeof/string and JSON.stringify branches, and adjust any callers/tests if they relied on the former "null" string.@@ -102,0 +113,21 @@113+ provider: adapter.name,114+ model,115+ text: rest.text,116+ voice: rest.voice,117+ format: rest.format,118+ speed: rest.speed,119+ modelOptions: rest.modelOptions as Record<string, unknown> | undefined,120+ timestamp: startTime,121+ })122+123+ return adapter.generateSpeech({ ...rest, model }).then((result) => {124+ const duration = Date.now() - startTime125+126+ aiEventClient.emit('speech:request:completed', {127+ requestId,128+ provider: adapter.name,129+ model,130+ audio: result.audio,131+ format: result.format,132+ audioDuration: result.duration,133+ contentType: result.contentType,⚠️ Potential issue | 🟠 Major
🧩 Analysis chain
🏁 Script executed:
# First, let's explore the file structure and find the complete function find packages/typescript/ai/src -type f -name "*.ts" | grep -E "(generateSpeech|event)" | head -20Repository: TanStack/ai
Length of output: 223
🏁 Script executed:
# Read the complete generateSpeech function with more context cat -n packages/typescript/ai/src/activities/generateSpeech/index.tsRepository: TanStack/ai
Length of output: 5472
🏁 Script executed:
# Find aiEventClient implementation find packages -type f \( -name "*.ts" -o -name "*.tsx" \) | xargs grep -l "aiEventClient" | head -10Repository: TanStack/ai
Length of output: 624
🏁 Script executed:
# Search for event emission configuration and gating mechanisms rg "emit.*speech:request" -t ts -t tsx -A 3 -B 3Repository: TanStack/ai
Length of output: 82
🏁 Script executed:
# Read the event-client implementation cat -n packages/typescript/ai/src/event-client.tsRepository: TanStack/ai
Length of output: 17108
🏁 Script executed:
# Search for event listeners and how events are consumed rg "\.on\(|addEventListener|emit\(" packages/typescript/ai-client -t ts -A 2 -B 1 | head -100Repository: TanStack/ai
Length of output: 1038
🏁 Script executed:
# Look for telemetry or event gating configuration rg "telemetry|gate|guard|filter.*event" packages/typescript -t ts -i | head -30Repository: TanStack/ai
Length of output: 3231
🏁 Script executed:
# Check if there's any documentation about event handling find packages -type f \( -name "README.md" -o -name "*.md" \) | xargs grep -l "event" -i | head -5Repository: TanStack/ai
Length of output: 266
🏁 Script executed:
# Check if there's any EventClient configuration or consumer setup rg "EventClient|devtools-event-client" packages/typescript -t ts -A 3 -B 1 | head -100Repository: TanStack/ai
Length of output: 7204
🏁 Script executed:
# Search for any guards, gates, or configuration around event emission rg "emit.*speech|speech.*emit" packages/typescript/ai/src -t ts -B 5 -A 3Repository: TanStack/ai
Length of output: 1651
🏁 Script executed:
# Look for any telemetry or privacy configuration rg "telemetry|privacy|TELEMETRY|PRIVACY" packages/typescript -t ts -t json | head -30Repository: TanStack/ai
Length of output: 37
🏁 Script executed:
# Check the package.json for devtools-event-client and see if there's documentation cat packages/typescript/ai/package.json | grep -A 5 -B 5 "devtools"Repository: TanStack/ai
Length of output: 301
🏁 Script executed:
# Search for any event filtering or redaction utilities rg "redact|filter.*event|sanitize" packages/typescript -t ts -i | head -20Repository: TanStack/ai
Length of output: 653
🏁 Script executed:
# Search for event listener setup or consumers that might send to external services rg "addEventListener|on\(.*speech|listener.*event|consumer" packages/typescript -t ts | head -30Repository: TanStack/ai
Length of output: 842
🏁 Script executed:
# Look for any integration with external analytics or telemetry services rg "analytics|telemetry|sentry|datadog|mixpanel|segment" packages/typescript -i | head -20Repository: TanStack/ai
Length of output: 2757
🏁 Script executed:
# Check the ai-devtools package to see how it consumes these events find packages/typescript/ai-devtools/src -name "*.ts" -o -name "*.tsx" | head -10Repository: TanStack/ai
Length of output: 796
🏁 Script executed:
# Look for any devtools event setup or middleware rg "aiEventClient|EventClient" packages/typescript/ai-devtools -t ts -t tsx | head -30Repository: TanStack/ai
Length of output: 82
🏁 Script executed:
# Search for documentation about the event system's intended use find packages/typescript/ai -name "README.md" -o -name "*.md" | xargs grep -l "event" 2>/dev/nullRepository: TanStack/ai
Length of output: 90
🏁 Script executed:
# Examine the ai-devtools context to see how events are consumed and stored cat -n packages/typescript/ai-devtools/src/store/ai-context.tsx | head -200Repository: TanStack/ai
Length of output: 7074
🏁 Script executed:
# Check if there's any persistence or external transmission of events rg "localStorage|sessionStorage|IndexedDB|fetch|axios|http" packages/typescript/ai-devtools/src -t ts -i | head -20Repository: TanStack/ai
Length of output: 37
🏁 Script executed:
# Look at the full ai-context file focusing on speech event handling sed -n '1,400p' packages/typescript/ai-devtools/src/store/ai-context.tsxRepository: TanStack/ai
Length of output: 11858
🏁 Script executed:
# Search for state management and storage in devtools rg "speech:request|speech:completed" packages/typescript/ai-devtools/src -B 3 -A 5Repository: TanStack/ai
Length of output: 3118
🏁 Script executed:
# Check if events include any warnings or privacy notes in code comments rg "TODO|FIXME|privacy|sensitive|PII|redact|sanitize|compliance" packages/typescript/ai/src/activities/generateSpeech -iRepository: TanStack/ai
Length of output: 37
🏁 Script executed:
# Look at the full ai-context speech event handling to see what's stored rg "addActivityEvent.*speech|speechEvents" packages/typescript/ai-devtools/src/store/ai-context.tsx -B 5 -A 10Repository: TanStack/ai
Length of output: 2797
🏁 Script executed:
# Check if there are any utilities to truncate or limit audio/text in events find packages/typescript/ai/src -name "*.ts" | xargs grep -l "truncate\|slice.*audio\|limit.*size\|maxLength" | head -10Repository: TanStack/ai
Length of output: 147
🏁 Script executed:
# Verify the event interfaces again - check if audio field has any size limitations or truncation rg "audio.*:.*string|audio:.*" packages/typescript/ai/src/event-client.ts -A 2Repository: TanStack/ai
Length of output: 106
🏁 Script executed:
# Look for any documentation comments about event system privacy/usage rg -B 5 "AIEventClient|eventClient" packages/typescript/ai/src/event-client.ts | head -40Repository: TanStack/ai
Length of output: 37
🏁 Script executed:
# Search for any privacy, security, or design documentation find packages/typescript/ai -name "*.md" -exec grep -l "event\|privacy\|security\|sensitive" {} \;Repository: TanStack/ai
Length of output: 90
🏁 Script executed:
# Check if EventClient base class from devtools package has any built-in filtering rg "devtools-event-client" packages -A 10 -B 2 | head -50Repository: TanStack/ai
Length of output: 1575
🏁 Script executed:
# Verify if audio field could be optional/redacted at source rg "SpeechRequestCompletedEvent|SpeechRequestStartedEvent" packages/typescript/ai/src/event-client.ts -A 10Repository: TanStack/ai
Length of output: 1188
Add gating and redaction for sensitive event payloads.
The
speech:request:startedandspeech:request:completedevents emit rawtextand fullaudio(base64) payloads unconditionally. If events are persisted, serialized, or extended to external telemetry, this poses privacy and compliance risks (PII, user content, payload size). Either gate event emission behind an explicit opt-in flag or redact/truncate sensitive fields by default.🤖 Prompt for AI Agents
In `@packages/typescript/ai/src/activities/generateSpeech/index.ts` around lines 111 - 133, The speech event payloads currently emit sensitive fields unconditionally; change aiEventClient.emit for 'speech:request:started' and 'speech:request:completed' to gate inclusion of raw content behind an explicit opt-in flag (e.g., emitSensitiveSpeechPayloads or allowTelemetrySensitiveData) and otherwise redact/truncate: replace rest.text with a redacted or short textSnippet (e.g., first N chars + "[REDACTED]") and replace result.audio/result.audio (base64) with either audioLength or truncatedBase64/placeholder; ensure modelOptions and other potentially sensitive fields are also sanitized prior to emitting and that the opt-in flag is checked (read from config/context) before including full fields.@@ -22,0 +409,21 @@409+ timestamp: number410+}411+412+/** Emitted when client messages are cleared. */413+export interface ClientMessagesClearedEvent {414+ clientId: string415+ timestamp: number416+}417+418+/** Emitted when client is reloaded. */419+export interface ClientReloadedEvent {420+ clientId: string421+ fromMessageIndex: number422+ timestamp: number423+}424+425+/** Emitted when client stops. */426+export interface ClientStoppedEvent {427+ clientId: string428+ timestamp: number429+}⚠️ Potential issue | 🟡 Minor
🧩 Analysis chain
🏁 Script executed:
# First, let's look at the event-client.ts file around the mentioned lines cat -n packages/typescript/ai/src/event-client.ts | sed -n '380,440p'Repository: TanStack/ai
Length of output: 2216
🏁 Script executed:
# Search for BaseEventContext definition to understand the base interface rg -n "interface BaseEventContext" --type=ts -A10Repository: TanStack/ai
Length of output: 827
🏁 Script executed:
# Find the test file mentioned and look for expectations on client events fd "events.test.ts" --type fRepository: TanStack/ai
Length of output: 105
🏁 Script executed:
# Look at the test file to see what it expects for client events cat -n packages/typescript/ai-client/tests/events.test.ts | head -200Repository: TanStack/ai
Length of output: 7047
🏁 Script executed:
# Search for how client events are emitted to see if source is added at emit time rg -n "emit\(" packages/typescript/ai-client/src --type=ts -B2 -A5 | grep -A7 "client:" | head -50Repository: TanStack/ai
Length of output: 37
🏁 Script executed:
# Check how other event types (that extend BaseEventContext) compare to client events rg -n "export interface.*Event.*extends BaseEventContext" packages/typescript/ai/src/event-client.ts | head -10Repository: TanStack/ai
Length of output: 752
🏁 Script executed:
# Check the actual implementation of the event emitter to see how source is added cat -n packages/typescript/ai-client/src/events.ts | head -150Repository: TanStack/ai
Length of output: 4201
🏁 Script executed:
# Look at how clientCreated and other client events are emitted rg -n "clientCreated\|loadingChanged\|errorChanged" packages/typescript/ai-client/src/events.ts -A3 -B2Repository: TanStack/ai
Length of output: 37
🏁 Script executed:
# Find the DefaultChatClientEventEmitter implementation rg -n "class DefaultChatClientEventEmitter" packages/typescript/ai-client/src -A40Repository: TanStack/ai
Length of output: 2095
🏁 Script executed:
# Check if there are more implementations of ChatClientEventEmitter rg -n "extends ChatClientEventEmitter" packages/typescript/ai-client/src -A30Repository: TanStack/ai
Length of output: 2095
Client event interfaces should extend
BaseEventContextor include thesourcefield.The client event interfaces (lines 391-429) lack the
sourcefield, butDefaultChatClientEventEmitteraddssource: 'client'at emit time, and the test suite expects it. Since other event interfaces in the same file extendBaseEventContext(which includessource?: 'client' | 'server'), these client events should do the same for type consistency and accuracy.🔧 Suggested fix
/** Emitted when a client is created. */ -export interface ClientCreatedEvent { +export interface ClientCreatedEvent extends BaseEventContext { clientId: string initialMessageCount: number timestamp: number }Apply the same pattern to
ClientLoadingChangedEvent,ClientErrorChangedEvent,ClientMessagesClearedEvent,ClientReloadedEvent, andClientStoppedEvent.🤖 Prompt for AI Agents
In `@packages/typescript/ai/src/event-client.ts` around lines 391 - 429, The client event interfaces are missing the BaseEventContext/source property which other events use; update ClientLoadingChangedEvent, ClientErrorChangedEvent, ClientMessagesClearedEvent, ClientReloadedEvent, and ClientStoppedEvent to extend BaseEventContext (or add source?: 'client' | 'server') so their shapes match DefaultChatClientEventEmitter emissions and tests; modify the interface declarations (e.g., "export interface ClientLoadingChangedEvent extends BaseEventContext { ... }") for each listed interface and keep existing fields unchanged.@@ -103,5 +126,21 @@103126 type: 'tool_result',104127 toolCallId,105128 content: result,129+ model,130+ timestamp,131+ id,106132 })107133134+ type FinishReason = 'stop' | 'length' | 'content_filter' | 'tool_calls' | null135+136+ const normalizeFinishReason = (finishReason: string | null): FinishReason => {137+ if (138+ finishReason === 'stop' ||139+ finishReason === 'length' ||140+ finishReason === 'content_filter' ||141+ finishReason === 'tool_calls'142+ ) {143+ return finishReason144+ }145+ return 'stop'146+ }⚠️ Potential issue | 🟡 Minor
normalizeFinishReasonsilently convertsnullto'stop', losing semantic meaning.The
FinishReasontype includesnull, but the function always returns'stop'for any unrecognized value includingnull. This loses the distinction between "stream completed normally" ('stop') and "no finish reason provided" (null).🐛 Proposed fix
const normalizeFinishReason = (finishReason: string | null): FinishReason => { + if (finishReason === null) { + return null + } if ( finishReason === 'stop' || finishReason === 'length' || finishReason === 'content_filter' || finishReason === 'tool_calls' ) { return finishReason } return 'stop' }📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
Suggested change134- type FinishReason = 'stop' | 'length' | 'content_filter' | 'tool_calls' | null135-136- const normalizeFinishReason = (finishReason: string | null): FinishReason => {137- if (138- finishReason === 'stop' ||139- finishReason === 'length' ||140- finishReason === 'content_filter' ||141- finishReason === 'tool_calls'142- ) {143- return finishReason144- }145- return 'stop'146- }134+ type FinishReason = 'stop' | 'length' | 'content_filter' | 'tool_calls' | null135+136+ const normalizeFinishReason = (finishReason: string | null): FinishReason => {137+ if (finishReason === null) {138+ return null139+ }140+ if (141+ finishReason === 'stop' ||142+ finishReason === 'length' ||143+ finishReason === 'content_filter' ||144+ finishReason === 'tool_calls'145+ ) {146+ return finishReason147+ }148+ return 'stop'149+ }🤖 Prompt for AI Agents
In `@testing/panel/src/lib/recording.ts` around lines 134 - 146, normalizeFinishReason currently maps any unrecognized value (including null) to 'stop', losing the null semantic; update normalizeFinishReason so that if the incoming finishReason parameter is null it returns null (preserving FinishReason|null), otherwise validate against the allowed literals ('stop'|'length'|'content_filter'|'tool_calls') and return the matching string or fallback to 'stop' for unknown strings; ensure the function signature and the FinishReason type remain consistent and reference the normalizeFinishReason and FinishReason symbols when making the change.- Lines 424-436: Updates
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/typescript/ai/src/activities/chat/index.ts (1)
372-384: Avoid duplicatetext:message:createdfor the same assistantmessageId. Line 377 emits a created event, and Line 685 emits another created event for the samemessageIdwhen tool calls are added. If consumers assumemessage:createdis unique per message, this will double-count. Consider emitting an update event instead, or removing the later created emission.🛠️ Minimal diff to avoid duplicate “created” emission
- aiEventClient.emit('text:message:created', { - ...this.buildTextEventContext(), - messageId, - role: 'assistant', - content: this.accumulatedContent || '', - toolCalls, - timestamp: Date.now(), - })Also applies to: 675-692
🤖 Fix all issues with AI agents
In `@packages/typescript/ai/src/activities/chat/index.ts`: - Around line 929-935: getContentString currently strips non-text parts and can return an empty string for multi-modal ModelMessage['content']; update getContentString to first collect text parts as it does, but if the resulting text is empty and content is non-string, return a JSON-serialized representation of the full content (or a clear fallback string containing non-text part metadata) so non-text data is preserved for consumers; update the logic inside getContentString (referenced symbol: getContentString and ModelMessage['content']) to perform the text-join-then-fallback-to-JSON behavior.@@ -898,0 +915,21 @@915+ source: 'server',916+ systemPrompts:917+ this.systemPrompts.length > 0 ? this.systemPrompts : undefined,918+ toolNames: this.eventToolNames,919+ options: this.eventOptions,920+ modelOptions: this.params.modelOptions as921+ | Record<string, unknown>922+ | undefined,923+ messageCount: this.initialMessageCount,924+ hasTools: this.tools.length > 0,925+ streaming: true,926+ }927+ }928+929+ private getContentString(content: ModelMessage['content']): string {930+ if (typeof content === 'string') return content931+ const text =932+ content933+ ?.map((part) => (part.type === 'text' ? part.content : ''))934+ .join('') || ''935+ return text⚠️ Potential issue | 🟡 Minor
Preserve non-text content in
getContentString. For multi-modal messages, this currently drops non-text parts and can emit empty strings. If event consumers need full fidelity, consider falling back to JSON when no text parts exist.🐛 Suggested fallback for non-text content
private getContentString(content: ModelMessage['content']): string { - if (typeof content === 'string') return content - const text = - content - ?.map((part) => (part.type === 'text' ? part.content : '')) - .join('') || '' - return text + if (content === null) return '' + if (typeof content === 'string') return content + const text = content.map((part) => (part.type === 'text' ? part.content : '')).join('') + return text || JSON.stringify(content) }🤖 Prompt for AI Agents
In `@packages/typescript/ai/src/activities/chat/index.ts` around lines 929 - 935, getContentString currently strips non-text parts and can return an empty string for multi-modal ModelMessage['content']; update getContentString to first collect text parts as it does, but if the resulting text is empty and content is non-string, return a JSON-serialized representation of the full content (or a clear fallback string containing non-text part metadata) so non-text data is preserved for consumers; update the logic inside getContentString (referenced symbol: getContentString and ModelMessage['content']) to perform the text-join-then-fallback-to-JSON behavior.jherr approved these changes
LGTM. Nice job!
AlemTuzlak merged this14c7905
AlemTuzlak closed this
Sign in to join this conversation.
📝 Walkthrough
Walkthrough#
Introduces a structured observability/event system: renames and types events (text:, tools:, image:, speech:, transcription:, video:, client:), adds streamId/context to emissions, emits lifecycle events for media generation, expands devtools store/UI to show activity events, and updates tests and docs.
Changes#
README.md,docs/guides/observability.mdpackages/typescript/ai/src/event-client.ts,packages/typescript/ai/src/index.ts,packages/typescript/ai-client/src/events.ts,packages/typescript/ai-client/src/chat-client.tsRecord<string, unknown>and added/propagatedstreamId,source,clientId, and stricter types.packages/typescript/ai/src/activities/chat/index.ts,.../generateImage/index.ts,.../generateSpeech/index.ts,.../generateTranscription/index.ts,.../generateVideo/index.ts,.../summarize/index.tspackages/typescript/ai-devtools/src/store/ai-context.tsxthinkingmessage part, modelOptions, systemPrompts, hasImage/hasSpeech/hasTranscription/hasVideo flags and event arrays; added isClientTool on chunks.packages/typescript/ai-devtools/src/components/conversation/ActivityEventsTab.tsx,ConversationDetails.tsx,ConversationTabs.tsx,ConversationHeader.tsx,MessageCard.tsx,.../index.tspackages/typescript/ai-devtools/src/styles/use-styles.tspackages/typescript/ai-client/tests/*.ts,packages/typescript/ai/tests/ai-text.test.tsstreamId,clientId,source), and consolidated emits.testing/panel/src/lib/recording.tsexamples/ts-react-chat/src/routes/api.tanchat.tsopenrouter/autotoopenai/gpt-5.1and addedreasoning: { effort: 'medium' }to modelOptions.Sequence Diagram(s)#
Estimated code review effort#
🎯 4 (Complex) | ⏱️ ~60 minutes
Possibly related PRs#
text:chunk:thinkingevents.Suggested reviewers#
Poem#
🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share