Skip to content

Commit 4ef0d72

Browse files
authored
Merge pull request #110 from ssdeanx/develop
feat: add animated SVG components for enhanced UI
2 parents 0a5f9c6 + 8e28f18 commit 4ef0d72

267 files changed

Lines changed: 4496 additions & 359538 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# TASK-001: Chat Streaming Fixes
2+
3+
**Status**: IN PROGRESS
4+
**Priority**: CRITICAL
5+
**Created**: 2026-02-16
6+
7+
## Problem Statement
8+
9+
1. **Blank screen during reasoning**: Agent thinks but shows nothing until text arrives
10+
2. **Token counter broken**: Already exists in UI but shows 0 - backend sends `usage.reasoningTokens=262` but UI doesn't parse it
11+
3. **Reasoning not displayed**: Backend sends `providerOptions.google.thoughtSignature` but UI doesn't render it
12+
13+
## Root Causes
14+
15+
### 1. Token Counter Not Working
16+
17+
- Backend sends in `step-finish` or `finish` parts
18+
- UI doesn't extract from these part types
19+
- File: `chat-context.tsx` - need to parse `step-finish` parts for usage
20+
21+
### 2. Reasoning Not Displayed
22+
23+
- Backend: `providerOptions.google.thoughtSignature` (base64 encoded)
24+
- UI checks: `ReasoningUIPart.type === 'reasoning'`
25+
- Mismatch: Google sends reasoning via providerMetadata, not as ReasoningUIPart
26+
- File: `chat-context.tsx` lines 262-277 `streamingReasoning` useMemo
27+
28+
### 3. Blank During Reasoning
29+
30+
- `streamingContent` is empty during reasoning-only phase
31+
- Loading indicator shows "Thinking..." but no reasoning content
32+
- Need: Show `AgentReasoning` component when `streamingReasoning` has content but `streamingContent` is empty
33+
34+
## Backend Evidence (from logs)
35+
36+
```json
37+
{
38+
"usage": {
39+
"inputTokens": 12305,
40+
"outputTokens": 908,
41+
"totalTokens": 13213,
42+
"reasoningTokens": 262
43+
},
44+
"providerOptions": {
45+
"google": {
46+
"thoughtSignature": "Es4ICssIAb4+9vsk+5nPbMKwgqEFaoK3BzttVElSqYCQ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dEBVh40oUNH72ZG4an00KgGZv772IJHOeF1buH55gKUnI+ukbkaMKe6Vc8t2+mSHQ4nGED9KV84eGYYMztjI2LtKOWLdifD/l5VYrO1GQwRRnkeAq1ns774nkYFvxMqxM/+NgCW6XOVew63f4B6XJlaIygdV5rMUVP4ZLVACqHYoRIpcWZVNNV2nv00ouCrzLABRFIIUwvIWyr5VTtNdXTGqny5e/1klcUpY0zZ8vP/QpSdzAeykdZw69wi0G0uBL5NjBnmAVSyLlO2TGoCOuIJa1MBrk8XZ37McNpzeDXYiYK+KsdfeRBQCLDkLnehFMX4QT+tIxg=="
47+
}
48+
}
49+
}
50+
```
51+
52+
## Key Files to Modify
53+
54+
| File | Lines | What to Fix |
55+
| ------------------- | --------- | ------------------------------------------------------ |
56+
| `chat-context.tsx` | 262-277 | `streamingReasoning` - add thoughtSignature extraction |
57+
| `chat-context.tsx` | ??? | Add usage extraction from `step-finish` parts |
58+
| `chat-messages.tsx` | 1697-1735 | Show `AgentReasoning` during reasoning-only streaming |
59+
60+
## AI SDK v6 Types Needed
61+
62+
```typescript
63+
import {
64+
// Type guards
65+
isReasoningUIPart,
66+
isTextUIPart,
67+
isStepStartUIPart,
68+
isDataUIPart,
69+
70+
// Part types
71+
ReasoningUIPart,
72+
TextUIPart,
73+
StepStartUIPart,
74+
75+
// Usage types
76+
FinishReason,
77+
StepResult,
78+
} from 'ai'
79+
```
80+
81+
## Implementation Plan
82+
83+
### Step 1: Fix streamingReasoning Extraction
84+
85+
```typescript
86+
const streamingReasoning = useMemo(() => {
87+
const lastMessage = messages[messages.length - 1]
88+
if (lastMessage?.role === 'assistant') {
89+
// 1. Check for ReasoningUIPart
90+
const reasoningPart = lastMessage.parts?.find(
91+
(p): p is ReasoningUIPart => p.type === 'reasoning'
92+
)
93+
if (reasoningPart?.text) return reasoningPart.text
94+
95+
// 2. Check providerMetadata.google.thoughtSignature
96+
for (const part of lastMessage.parts ?? []) {
97+
const pm = (part as any).providerMetadata
98+
if (pm?.google?.thoughtSignature) {
99+
// thoughtSignature is base64 encoded
100+
try {
101+
return atob(pm.google.thoughtSignature)
102+
} catch {
103+
return pm.google.thoughtSignature
104+
}
105+
}
106+
}
107+
108+
// 3. Fallback to extractThoughtSummaryFromParts
109+
return extractThoughtSummaryFromParts(lastMessage.parts)
110+
}
111+
return ''
112+
}, [messages])
113+
```
114+
115+
### Step 2: Fix Usage Extraction from step-finish
116+
117+
```typescript
118+
const usage: TokenUsage | null = useMemo(() => {
119+
for (const message of messages) {
120+
if (message.role === 'assistant') {
121+
for (const part of message.parts ?? []) {
122+
if (part.type === 'step-finish' || part.type === 'finish') {
123+
const usageData = (part as any).usage
124+
if (usageData) {
125+
return {
126+
inputTokens:
127+
usageData.promptTokens ??
128+
usageData.inputTokens ??
129+
0,
130+
outputTokens:
131+
usageData.completionTokens ??
132+
usageData.outputTokens ??
133+
0,
134+
totalTokens: usageData.totalTokens ?? 0,
135+
inputTokenDetails: {
136+
cacheReadTokens:
137+
usageData.inputTokenDetails?.cacheRead ?? 0,
138+
cacheWriteTokens:
139+
usageData.inputTokenDetails?.cacheWrite ??
140+
0,
141+
noCacheTokens:
142+
usageData.inputTokenDetails?.noCache ?? 0,
143+
},
144+
outputTokenDetails: {
145+
textTokens:
146+
usageData.outputTokenDetails?.text ?? 0,
147+
reasoningTokens:
148+
usageData.outputTokenDetails?.reasoning ??
149+
0,
150+
},
151+
}
152+
}
153+
}
154+
}
155+
}
156+
}
157+
return null
158+
}, [messages])
159+
```
160+
161+
### Step 3: Fix Blank During Reasoning
162+
163+
In chat-messages.tsx, add condition to show AgentReasoning when:
164+
165+
- `status === 'streaming'`
166+
- `streamingReasoning` has content
167+
- `streamingContent` is empty
168+
169+
## Notes
170+
171+
- Don't add token display - it EXISTS, just FIX the extraction
172+
- Don't modify selectAgent - just needs to match agentId string
173+
- Focus on extraction logic in chat-context.tsx

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,8 @@ src/mastra/public/storage/key_value_stores/default/SDK_SESSION_POOL_STATE.json
148148
src/mastra/public/storage/key_value_stores/default/SDK_CRAWLER_STATISTICS_0.json
149149
thoughts/ledgers/CONTINUITY_ses_399c.md
150150
thoughts/ledgers/CONTINUITY_ses_3997.md
151+
thoughts/ledgers/CONTINUITY_ses_394b.md
152+
thoughts/ledgers/CONTINUITY_ses_394d.md
153+
thoughts/ledgers/CONTINUITY_ses_394f.md
154+
thoughts/ledgers/CONTINUITY_ses_3943.md
155+
thoughts/ledgers/CONTINUITY_ses_3944.md

AGENTS.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,3 +469,21 @@ If you need more details for a subdirectory, open the folder-specific `AGENTS.md
469469
---
470470

471471
Last updated: 2025-12-15
472+
473+
---
474+
475+
## Recent Implementation Notes (2026-02-17)
476+
477+
- Public component SVG professionalization completed in `app/components/**`:
478+
- Added 3 new GSAP SVG variants (`AnimatedShieldMatrix`, `AnimatedQuantumLattice`, `AnimatedTokenStream`)
479+
- Expanded `landing-svg-lab.tsx` to 13 options
480+
- Upgraded `PublicPageHero` accent stage sizing/framing and added optional `accentCaption`
481+
- Propagated captions across all public hero-accent components and remapped key pages to new variants (Privacy/Tools/Changelog)
482+
- Increased global SVG sizing clamps in `app/globals.css` for better visual balance
483+
- Landing section full pass completed across all `landing-*` components with consistent SVG accent staging and visual polish
484+
- Added 5 additional GSAP SVG variants (`AnimatedAegisCore`, `AnimatedFractalBeacon`, `AnimatedOrbitShards`, `AnimatedWaveInterference`, `AnimatedPacketBurst`)
485+
- Expanded `landing-svg-lab.tsx` again to 18 options total
486+
- Dashboard strict typing hardening in progress:
487+
- `app/dashboard/workflows/page.tsx` now uses JSON-safe result typing for workflow run responses.
488+
- `app/dashboard/observability/page.tsx` now uses JSON-safe result typing for scoring responses.
489+
- Scope note: current fixes are focused on dashboard/chat/GSAP stabilization and do not introduce backend-wired catalogs on public landing pages in this step.

AI_ELEMENTS_INTEGRATION_TODO.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@
4141

4242
### TASK 002: Update chat-messages.tsx - Add Attachments Integration
4343

44-
**Status:** NOT STARTED
44+
**Status:** COMPLETED ✓
4545
**File:** `app/chat/components/chat-messages.tsx`
4646
**Lines:** ~895-903 (fileParts rendering)
4747

4848
**Sub-tasks:**
4949

50-
- [ ] 002a: Import Attachments components from '@/src/components/ai-elements/attachments'
51-
- [ ] 002b: Locate current fileParts rendering code (lines 895-903)
52-
- [ ] 002c: Replace custom Badge-based file rendering with Attachments component
53-
- [ ] 002d: Map FileUIPart[] to AttachmentData[] format
54-
- [ ] 002e: Ensure type imports from 'ai' (FileUIPart, isFileUIPart) are used
55-
- [ ] 002f: Test TypeScript compilation
50+
- [x] 002a: Import Attachments components from '@/src/components/ai-elements/attachments'
51+
- [x] 002b: Locate current fileParts rendering code (lines 895-903)
52+
- [x] 002c: Replace custom Badge-based file rendering with Attachments component
53+
- [x] 002d: Map FileUIPart[] to AttachmentData[] format
54+
- [x] 002e: Ensure type imports from 'ai' (FileUIPart, isFileUIPart) are used
55+
- [x] 002f: Test TypeScript compilation
5656

5757
**Components to integrate:**
5858

@@ -62,16 +62,16 @@
6262

6363
### TASK 003: Update chat-messages.tsx - Add AudioPlayer Integration
6464

65-
**Status:** NOT STARTED
65+
**Status:** COMPLETED ✓
6666
**File:** `app/chat/components/chat-messages.tsx`
6767

6868
**Sub-tasks:**
6969

70-
- [ ] 003a: Import AudioPlayer from '@/src/components/ai-elements/audio-player'
71-
- [ ] 003b: Identify where audio FileUIPart messages are rendered
72-
- [ ] 003c: Add conditional rendering for audio mediaType files
73-
- [ ] 003d: Integrate AudioPlayer for audio file parts
74-
- [ ] 003e: Test TypeScript compilation
70+
- [x] 003a: Import AudioPlayer from '@/src/components/ai-elements/audio-player'
71+
- [x] 003b: Identify where audio FileUIPart messages are rendered
72+
- [x] 003c: Add conditional rendering for audio mediaType files
73+
- [x] 003d: Integrate AudioPlayer for audio file parts
74+
- [x] 003e: Test TypeScript compilation
7575

7676
**Components to integrate:**
7777

@@ -81,15 +81,15 @@
8181

8282
### TASK 004: Update chat-messages.tsx - Add Transcription Integration
8383

84-
**Status:** NOT STARTED
84+
**Status:** COMPLETED ✓
8585
**File:** `app/chat/components/chat-messages.tsx`
8686

8787
**Sub-tasks:**
8888

89-
- [ ] 004a: Import Transcription from '@/src/components/ai-elements/transcription'
90-
- [ ] 004b: Import Experimental_SpeechResult type from 'ai'
91-
- [ ] 004c: Add Transcription component for speech-to-text display
92-
- [ ] 004d: Test TypeScript compilation
89+
- [x] 004a: Import Transcription from '@/src/components/ai-elements/transcription'
90+
- [x] 004b: Import Experimental_SpeechResult type from 'ai'
91+
- [x] 004c: Add Transcription component for speech-to-text display
92+
- [x] 004d: Test TypeScript compilation
9393

9494
**Components to integrate:**
9595

@@ -99,13 +99,13 @@
9999

100100
### TASK 005: Verify and Leverage 'ai' Package Type Imports
101101

102-
**Status:** NOT STARTED
102+
**Status:** COMPLETED ✓
103103
**Files:** `app/chat/components/chat-messages.tsx`, `app/chat/components/chat-input.tsx`
104104

105105
**Sub-tasks:**
106106

107-
- [ ] 005a: List all imported types from 'ai' in chat-messages.tsx
108-
- [ ] 005b: Identify which types are NOT actively used for type narrowing
107+
- [x] 005a: List all imported types from 'ai' in chat-messages.tsx
108+
- [] 005b: Identify which types are NOT actively used for type narrowing
109109
- [ ] 005c: Add active type narrowing using isFileUIPart, isTextUIPart, etc.
110110
- [ ] 005d: Replace any 'as' type assertions with proper type guards
111111
- [ ] 005e: Verify all unused imports serve a purpose (keep them as requested)
@@ -121,10 +121,10 @@
121121

122122
| Task | Status | File | Started | Completed |
123123
| ---- | ----------- | ----------------- | ------- | --------- |
124-
| 001 | NOT STARTED | chat-input.tsx | - | - |
125-
| 002 | NOT STARTED | chat-messages.tsx | - | - |
126-
| 003 | NOT STARTED | chat-messages.tsx | - | - |
127-
| 004 | NOT STARTED | chat-messages.tsx | - | - |
124+
| 001 | COMPLETED ✓ | chat-input.tsx | - | - |
125+
| 002 | COMPLETED ✓ | chat-messages.tsx | - | - |
126+
| 003 | COMPLETED ✓ | chat-messages.tsx | - | - |
127+
| 004 | COMPLETED ✓ | chat-messages.tsx | - | - |
128128
| 005 | NOT STARTED | both | - | - |
129129

130130
---

0 commit comments

Comments
 (0)