oneie 3.6.38 → 3.6.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/agent-frontend.md +48 -0
- package/.claude/hooks/.last-news-context +1 -1
- package/README.md +28 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -1
- package/one/things/plans/ai-elements-integration.md +483 -0
- package/one/things/plans/video-frontend.md +146 -88
- package/package.json +3 -2
|
@@ -837,6 +837,54 @@ await logEvent({
|
|
|
837
837
|
const results = await provider.search(query);
|
|
838
838
|
```
|
|
839
839
|
|
|
840
|
+
## Sidebar Collapse Pattern
|
|
841
|
+
|
|
842
|
+
**When pages need a collapsed sidebar (showing icons only):**
|
|
843
|
+
|
|
844
|
+
The Layout component includes a built-in sidebar that can be collapsed to show only icons. This is useful for full-width pages like chat interfaces, dashboards, or editors.
|
|
845
|
+
|
|
846
|
+
**Pattern:**
|
|
847
|
+
```astro
|
|
848
|
+
---
|
|
849
|
+
// Pass sidebarInitialCollapsed={true} to Layout
|
|
850
|
+
import Layout from '@/layouts/Layout.astro';
|
|
851
|
+
|
|
852
|
+
const title = 'Your Page Title';
|
|
853
|
+
---
|
|
854
|
+
|
|
855
|
+
<Layout title={title} sidebarInitialCollapsed={true}>
|
|
856
|
+
<!-- Your page content -->
|
|
857
|
+
</Layout>
|
|
858
|
+
```
|
|
859
|
+
|
|
860
|
+
**When to use:**
|
|
861
|
+
- Chat interfaces (maximize chat area)
|
|
862
|
+
- Full-width editors
|
|
863
|
+
- Canvas/drawing apps
|
|
864
|
+
- Data visualization dashboards
|
|
865
|
+
- Any page that needs maximum horizontal space
|
|
866
|
+
|
|
867
|
+
**Sidebar behavior:**
|
|
868
|
+
- Collapsed: Shows only icons (80px width)
|
|
869
|
+
- Users can hover to temporarily expand
|
|
870
|
+
- Desktop toggle button still works
|
|
871
|
+
- Mobile menu works normally
|
|
872
|
+
|
|
873
|
+
**Example - Chat Page:**
|
|
874
|
+
```astro
|
|
875
|
+
---
|
|
876
|
+
// web/src/pages/chat/index.astro
|
|
877
|
+
import Layout from '@/layouts/Layout.astro';
|
|
878
|
+
import { ChatClient } from '@/components/ai/ChatClient';
|
|
879
|
+
|
|
880
|
+
const title = 'AI Chat';
|
|
881
|
+
---
|
|
882
|
+
|
|
883
|
+
<Layout title={title} sidebarInitialCollapsed={true}>
|
|
884
|
+
<ChatClient client:only="react" />
|
|
885
|
+
</Layout>
|
|
886
|
+
```
|
|
887
|
+
|
|
840
888
|
## shadcn/ui Component Usage
|
|
841
889
|
|
|
842
890
|
Always use shadcn components for UI. **All custom components must be `.tsx` files:**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/var/folders/ll/3vb8ckfd47dc_pcl31s65xg40000gn/T/tmp.
|
|
1
|
+
/var/folders/ll/3vb8ckfd47dc_pcl31s65xg40000gn/T/tmp.UXEfrShTxV
|
package/README.md
CHANGED
|
@@ -56,6 +56,18 @@ cd web/
|
|
|
56
56
|
bun test # All tests
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 🎬 Demo
|
|
62
|
+
|
|
63
|
+
See ONE in action:
|
|
64
|
+
|
|
65
|
+
**Video Demo:** [Watch on one.ie](https://media.one.ie/ONE-demo.mp4)
|
|
66
|
+
|
|
67
|
+
A complete walkthrough showing how to build AI agents, applications, and your audience using the 6-dimension ontology.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
59
71
|
# ONE
|
|
60
72
|
|
|
61
73
|
Make your ideas real
|
|
@@ -887,6 +899,22 @@ Tags, chunks, embeddings, and relationships give AI agents context to act intell
|
|
|
887
899
|
|
|
888
900
|
---
|
|
889
901
|
|
|
902
|
+
## 🎧 Learn More
|
|
903
|
+
|
|
904
|
+
### Featured Podcast: Understanding the ONE Ontology
|
|
905
|
+
|
|
906
|
+
**Listen:** [ONE Ontology Explained](https://one.ie/podcasts/one-ontology)
|
|
907
|
+
|
|
908
|
+
A deep dive into how the 6-dimension ontology models reality and enables AI agents to understand who owns what, who can do what, what happened, and what it all means.
|
|
909
|
+
|
|
910
|
+
**Topics covered:**
|
|
911
|
+
- Why every intelligent system needs a coherent model of reality
|
|
912
|
+
- How the 6 dimensions (groups, people, things, connections, events, knowledge) work together
|
|
913
|
+
- Real-world examples from lemonade stands to Fortune 500 companies
|
|
914
|
+
- How AI agents use the ontology to make intelligent decisions
|
|
915
|
+
|
|
916
|
+
---
|
|
917
|
+
|
|
890
918
|
## 🔗 Quick Links
|
|
891
919
|
|
|
892
920
|
### Core Documentation
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,23 @@ import { isAgentEnvironment, showAgentModeMessage, } from "./lib/agent-detection
|
|
|
16
16
|
async function main() {
|
|
17
17
|
// Check for command line arguments
|
|
18
18
|
const args = process.argv.slice(2);
|
|
19
|
+
// Handle passthrough commands (dev, build, deploy, etc.)
|
|
20
|
+
if (args[0] === "dev" || args[0] === "build" || args[0] === "deploy") {
|
|
21
|
+
const { execSync } = await import("child_process");
|
|
22
|
+
const command = args[0];
|
|
23
|
+
const commandArgs = args.slice(1).join(" ");
|
|
24
|
+
try {
|
|
25
|
+
// Pass through to bun run <command>
|
|
26
|
+
execSync(`cd web && bun run ${command} ${commandArgs}`, {
|
|
27
|
+
stdio: "inherit",
|
|
28
|
+
cwd: process.cwd(),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
19
36
|
// Handle commands
|
|
20
37
|
if (args[0] === "agent") {
|
|
21
38
|
// Agent command (non-interactive)
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAA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C;AACxD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
# AI Elements Integration Plan
|
|
2
|
+
|
|
3
|
+
**Version:** 1.0.0
|
|
4
|
+
**Status:** Planning
|
|
5
|
+
**Created:** 2025-01-12
|
|
6
|
+
**Owner:** builder
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Plan to integrate AI SDK Elements into the chat interface (`/pages/chat/index`), replacing custom components with production-ready AI SDK components for enhanced functionality and better developer experience.
|
|
11
|
+
|
|
12
|
+
## Current State
|
|
13
|
+
|
|
14
|
+
### Existing Components
|
|
15
|
+
|
|
16
|
+
**Chat Page:** `/web/src/pages/chat/index.astro`
|
|
17
|
+
- Uses `ChatClient` component with `client:only="react"`
|
|
18
|
+
- Full-screen layout with fixed header and input
|
|
19
|
+
|
|
20
|
+
**Current Custom Components:**
|
|
21
|
+
1. **PromptInput** (`/web/src/components/ai/PromptInput.tsx`)
|
|
22
|
+
- Simple textarea + button
|
|
23
|
+
- Enter to submit, Shift+Enter for new line
|
|
24
|
+
- Basic loading state
|
|
25
|
+
- Props: `value`, `onChange`, `onSubmit`, `isLoading`, `placeholder`
|
|
26
|
+
|
|
27
|
+
2. **ChatClient** (`/web/src/components/ai/ChatClient.tsx`)
|
|
28
|
+
- Full chat interface with messages, input, settings
|
|
29
|
+
- Model selection (Gemini Flash Lite, GPT-4, Claude, etc.)
|
|
30
|
+
- API key management (localStorage)
|
|
31
|
+
- Premium features: reasoning, tool calls, generative UI
|
|
32
|
+
- Demo mode for showcasing features
|
|
33
|
+
|
|
34
|
+
**AI SDK Elements Available:**
|
|
35
|
+
- **PromptInput** (`/web/src/components/ai/elements/prompt-input.tsx`)
|
|
36
|
+
- Advanced textarea with attachments
|
|
37
|
+
- File upload (drag & drop, paste, click)
|
|
38
|
+
- Speech-to-text button
|
|
39
|
+
- Model selector integration
|
|
40
|
+
- Action menu with extensibility
|
|
41
|
+
- Provider pattern for global state
|
|
42
|
+
- Validation (maxFiles, maxFileSize, accept)
|
|
43
|
+
|
|
44
|
+
## Integration Goals
|
|
45
|
+
|
|
46
|
+
### Phase 1: Replace PromptInput (Immediate Win)
|
|
47
|
+
|
|
48
|
+
**Goal:** Replace custom `PromptInput` with AI SDK `PromptInput` element
|
|
49
|
+
|
|
50
|
+
**Benefits:**
|
|
51
|
+
- File attachments (images, PDFs, docs)
|
|
52
|
+
- Drag & drop support
|
|
53
|
+
- Paste images from clipboard
|
|
54
|
+
- Speech-to-text (browser API)
|
|
55
|
+
- Better keyboard shortcuts
|
|
56
|
+
- Professional UX out-of-the-box
|
|
57
|
+
|
|
58
|
+
**Implementation Steps:**
|
|
59
|
+
|
|
60
|
+
1. **Update ChatClient to use AI SDK PromptInput**
|
|
61
|
+
- Import AI SDK components
|
|
62
|
+
- Replace custom `<PromptInput>` with AI SDK version
|
|
63
|
+
- Adapt state management for attachments
|
|
64
|
+
- Handle file conversion (blob → data URL)
|
|
65
|
+
|
|
66
|
+
2. **Add File Preview**
|
|
67
|
+
- Use `<PromptInputAttachments>` to show uploaded files
|
|
68
|
+
- Use `<PromptInputAttachment>` for individual file cards
|
|
69
|
+
- Implement remove functionality
|
|
70
|
+
|
|
71
|
+
3. **Enable Speech-to-Text**
|
|
72
|
+
- Add `<PromptInputSpeechButton>` to footer
|
|
73
|
+
- Connect to textarea ref
|
|
74
|
+
- Handle transcription updates
|
|
75
|
+
|
|
76
|
+
4. **Add Action Menu (Optional Features)**
|
|
77
|
+
- Add `<PromptInputActionMenu>` with dropdown
|
|
78
|
+
- Include `<PromptInputActionAddAttachments>` for file upload
|
|
79
|
+
- Add future actions (code blocks, templates, etc.)
|
|
80
|
+
|
|
81
|
+
### Phase 2: Advanced Features (Enhanced UX)
|
|
82
|
+
|
|
83
|
+
**Goal:** Leverage full AI SDK Elements ecosystem
|
|
84
|
+
|
|
85
|
+
**Features to Add:**
|
|
86
|
+
|
|
87
|
+
1. **Model Selector Integration**
|
|
88
|
+
- Use `<PromptInputSelect>` in footer or header
|
|
89
|
+
- Replace custom dropdown with SDK component
|
|
90
|
+
- Sync with OpenRouter model selection
|
|
91
|
+
|
|
92
|
+
2. **Attachment Validation**
|
|
93
|
+
- Set `accept="image/*"` for image-only mode
|
|
94
|
+
- Set `maxFiles={5}` to limit attachments
|
|
95
|
+
- Set `maxFileSize={10 * 1024 * 1024}` (10MB limit)
|
|
96
|
+
- Handle `onError` with toast notifications
|
|
97
|
+
|
|
98
|
+
3. **Global Drop Zone**
|
|
99
|
+
- Enable `globalDrop={true}` for document-level drop
|
|
100
|
+
- Add visual feedback for drag-over state
|
|
101
|
+
|
|
102
|
+
4. **Provider Pattern (Multi-Component State)**
|
|
103
|
+
- Wrap chat in `<PromptInputProvider>`
|
|
104
|
+
- Share input state across header/footer/sidebar
|
|
105
|
+
- Enable external components to control input
|
|
106
|
+
|
|
107
|
+
### Phase 3: Premium Elements (Future Work)
|
|
108
|
+
|
|
109
|
+
**Goal:** Integrate advanced AI SDK Elements for rich experiences
|
|
110
|
+
|
|
111
|
+
**Components to Explore:**
|
|
112
|
+
|
|
113
|
+
1. **Message Components**
|
|
114
|
+
- `<Message>` - Advanced message rendering
|
|
115
|
+
- `<Reasoning>` - Chain-of-thought visualization
|
|
116
|
+
- `<Tool>` - Tool call display with collapsible details
|
|
117
|
+
- `<CodeBlock>` - Syntax-highlighted code with copy
|
|
118
|
+
|
|
119
|
+
2. **Conversation Components**
|
|
120
|
+
- `<Conversation>` - Thread management
|
|
121
|
+
- `<Controls>` - Message actions (edit, regenerate, branch)
|
|
122
|
+
- `<Canvas>` - Visual workspace for generative UI
|
|
123
|
+
|
|
124
|
+
3. **Specialized Elements**
|
|
125
|
+
- `<Artifact>` - Isolated code execution preview
|
|
126
|
+
- `<WebPreview>` - Live iframe rendering
|
|
127
|
+
- `<Sources>` - Citation and reference display
|
|
128
|
+
- `<Checkpoint>` - Save/restore conversation state
|
|
129
|
+
|
|
130
|
+
## Implementation Example
|
|
131
|
+
|
|
132
|
+
### Before (Custom PromptInput)
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
// ChatClient.tsx - Current Implementation
|
|
136
|
+
<PromptInput
|
|
137
|
+
value={input}
|
|
138
|
+
onChange={setInput}
|
|
139
|
+
onSubmit={handleSubmit}
|
|
140
|
+
isLoading={isLoading}
|
|
141
|
+
placeholder="Type your message..."
|
|
142
|
+
/>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### After (AI SDK PromptInput)
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
// ChatClient.tsx - AI SDK Implementation
|
|
149
|
+
import {
|
|
150
|
+
PromptInput,
|
|
151
|
+
PromptInputBody,
|
|
152
|
+
PromptInputTextarea,
|
|
153
|
+
PromptInputFooter,
|
|
154
|
+
PromptInputTools,
|
|
155
|
+
PromptInputButton,
|
|
156
|
+
PromptInputSubmit,
|
|
157
|
+
PromptInputSpeechButton,
|
|
158
|
+
PromptInputAttachments,
|
|
159
|
+
PromptInputAttachment,
|
|
160
|
+
PromptInputActionMenu,
|
|
161
|
+
PromptInputActionMenuTrigger,
|
|
162
|
+
PromptInputActionMenuContent,
|
|
163
|
+
PromptInputActionAddAttachments,
|
|
164
|
+
} from '@/components/ai/elements/prompt-input';
|
|
165
|
+
|
|
166
|
+
// In ChatClient component
|
|
167
|
+
<PromptInput
|
|
168
|
+
accept="image/*"
|
|
169
|
+
multiple
|
|
170
|
+
maxFiles={5}
|
|
171
|
+
maxFileSize={10 * 1024 * 1024}
|
|
172
|
+
onError={(err) => toast.error(err.message)}
|
|
173
|
+
onSubmit={(message, event) => {
|
|
174
|
+
// message.text - user input text
|
|
175
|
+
// message.files - FileUIPart[] with images/attachments
|
|
176
|
+
handleSubmit(message.text, message.files);
|
|
177
|
+
}}
|
|
178
|
+
>
|
|
179
|
+
<PromptInputBody>
|
|
180
|
+
{/* File attachments preview */}
|
|
181
|
+
<PromptInputAttachments>
|
|
182
|
+
{(attachment) => (
|
|
183
|
+
<PromptInputAttachment data={attachment} />
|
|
184
|
+
)}
|
|
185
|
+
</PromptInputAttachments>
|
|
186
|
+
|
|
187
|
+
{/* Main textarea */}
|
|
188
|
+
<PromptInputTextarea
|
|
189
|
+
placeholder="Ask me anything with premium features..."
|
|
190
|
+
/>
|
|
191
|
+
|
|
192
|
+
{/* Footer with tools and submit */}
|
|
193
|
+
<PromptInputFooter>
|
|
194
|
+
<PromptInputTools>
|
|
195
|
+
{/* Action menu for additional features */}
|
|
196
|
+
<PromptInputActionMenu>
|
|
197
|
+
<PromptInputActionMenuTrigger />
|
|
198
|
+
<PromptInputActionMenuContent>
|
|
199
|
+
<PromptInputActionAddAttachments />
|
|
200
|
+
</PromptInputActionMenuContent>
|
|
201
|
+
</PromptInputActionMenu>
|
|
202
|
+
|
|
203
|
+
{/* Speech-to-text */}
|
|
204
|
+
<PromptInputSpeechButton />
|
|
205
|
+
</PromptInputTools>
|
|
206
|
+
|
|
207
|
+
{/* Submit button with loading state */}
|
|
208
|
+
<PromptInputSubmit
|
|
209
|
+
status={isLoading ? 'submitted' : 'idle'}
|
|
210
|
+
/>
|
|
211
|
+
</PromptInputFooter>
|
|
212
|
+
</PromptInputBody>
|
|
213
|
+
</PromptInput>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Technical Specifications
|
|
217
|
+
|
|
218
|
+
### File Handling
|
|
219
|
+
|
|
220
|
+
**Current:** No file upload support
|
|
221
|
+
|
|
222
|
+
**New Capabilities:**
|
|
223
|
+
- **Drag & Drop:** Drop files anywhere in form
|
|
224
|
+
- **Paste:** Paste images from clipboard (Ctrl+V)
|
|
225
|
+
- **Click:** Click to open file picker
|
|
226
|
+
- **Validation:** Accept filter, max files, max size
|
|
227
|
+
- **Preview:** Thumbnail for images, filename for others
|
|
228
|
+
- **Removal:** Click X on attachment to remove
|
|
229
|
+
|
|
230
|
+
**Data Flow:**
|
|
231
|
+
```
|
|
232
|
+
User uploads file
|
|
233
|
+
↓
|
|
234
|
+
Browser creates blob URL
|
|
235
|
+
↓
|
|
236
|
+
PromptInput stores as FileUIPart[] with id
|
|
237
|
+
↓
|
|
238
|
+
On submit: Convert blob → data URL
|
|
239
|
+
↓
|
|
240
|
+
Pass to onSubmit({ text, files })
|
|
241
|
+
↓
|
|
242
|
+
ChatClient sends to API with base64 data
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### State Management
|
|
246
|
+
|
|
247
|
+
**Current:** Component-level state (`useState`)
|
|
248
|
+
|
|
249
|
+
**Provider Pattern (Optional):**
|
|
250
|
+
```tsx
|
|
251
|
+
// Wrap entire chat in provider
|
|
252
|
+
<PromptInputProvider initialInput="">
|
|
253
|
+
<ChatHeader />
|
|
254
|
+
<MessageList />
|
|
255
|
+
<PromptInput onSubmit={handleSubmit}>
|
|
256
|
+
{/* Components auto-sync via provider */}
|
|
257
|
+
</PromptInput>
|
|
258
|
+
</PromptInputProvider>
|
|
259
|
+
|
|
260
|
+
// External components can access/control input
|
|
261
|
+
import { usePromptInputController } from '@/components/ai/elements/prompt-input';
|
|
262
|
+
|
|
263
|
+
function ChatHeader() {
|
|
264
|
+
const { textInput, attachments } = usePromptInputController();
|
|
265
|
+
|
|
266
|
+
return (
|
|
267
|
+
<div>
|
|
268
|
+
Current input: {textInput.value}
|
|
269
|
+
Attachments: {attachments.files.length}
|
|
270
|
+
</div>
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### API Integration
|
|
276
|
+
|
|
277
|
+
**Current API Endpoint:** `/api/chat` (POST)
|
|
278
|
+
|
|
279
|
+
**Request Body:**
|
|
280
|
+
```json
|
|
281
|
+
{
|
|
282
|
+
"messages": [
|
|
283
|
+
{ "role": "user", "content": "Hello" }
|
|
284
|
+
],
|
|
285
|
+
"apiKey": "sk-or-v1-...",
|
|
286
|
+
"model": "google/gemini-2.5-flash-lite",
|
|
287
|
+
"premium": true
|
|
288
|
+
}
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**Enhanced with Files:**
|
|
292
|
+
```json
|
|
293
|
+
{
|
|
294
|
+
"messages": [
|
|
295
|
+
{
|
|
296
|
+
"role": "user",
|
|
297
|
+
"content": [
|
|
298
|
+
{ "type": "text", "text": "What's in this image?" },
|
|
299
|
+
{
|
|
300
|
+
"type": "image",
|
|
301
|
+
"url": "data:image/png;base64,iVBORw0KG..."
|
|
302
|
+
}
|
|
303
|
+
]
|
|
304
|
+
}
|
|
305
|
+
],
|
|
306
|
+
"apiKey": "sk-or-v1-...",
|
|
307
|
+
"model": "google/gemini-2.5-flash-lite",
|
|
308
|
+
"premium": true
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
**Server-Side Changes:**
|
|
313
|
+
- Parse multimodal content (text + images)
|
|
314
|
+
- Pass to OpenRouter with vision-capable models
|
|
315
|
+
- Handle file type validation server-side
|
|
316
|
+
|
|
317
|
+
## Migration Checklist
|
|
318
|
+
|
|
319
|
+
### Phase 1: PromptInput Replacement
|
|
320
|
+
|
|
321
|
+
- [ ] Install AI SDK Elements dependencies (if not installed)
|
|
322
|
+
- [ ] Import AI SDK PromptInput components
|
|
323
|
+
- [ ] Replace custom PromptInput in ChatClient
|
|
324
|
+
- [ ] Add file attachment preview UI
|
|
325
|
+
- [ ] Implement file-to-data-URL conversion
|
|
326
|
+
- [ ] Update API endpoint to handle multimodal content
|
|
327
|
+
- [ ] Test file upload (drag & drop, paste, click)
|
|
328
|
+
- [ ] Test speech-to-text (browser support)
|
|
329
|
+
- [ ] Add error handling for file validation
|
|
330
|
+
- [ ] Update placeholder text and UX copy
|
|
331
|
+
|
|
332
|
+
### Phase 2: Advanced Features
|
|
333
|
+
|
|
334
|
+
- [ ] Add PromptInputProvider wrapper
|
|
335
|
+
- [ ] Integrate model selector into footer
|
|
336
|
+
- [ ] Enable global drop zone
|
|
337
|
+
- [ ] Add toast notifications for errors
|
|
338
|
+
- [ ] Implement file size/type validation UI
|
|
339
|
+
- [ ] Add keyboard shortcuts documentation
|
|
340
|
+
- [ ] Test across browsers (Chrome, Firefox, Safari)
|
|
341
|
+
- [ ] Test mobile experience (touch, camera upload)
|
|
342
|
+
|
|
343
|
+
### Phase 3: Premium Elements
|
|
344
|
+
|
|
345
|
+
- [ ] Evaluate Message component for better rendering
|
|
346
|
+
- [ ] Consider Reasoning component for chain-of-thought
|
|
347
|
+
- [ ] Explore Tool component for tool call display
|
|
348
|
+
- [ ] Test CodeBlock for syntax highlighting
|
|
349
|
+
- [ ] Research Artifact/WebPreview for generative UI
|
|
350
|
+
- [ ] Consider Conversation for thread management
|
|
351
|
+
|
|
352
|
+
## Breaking Changes
|
|
353
|
+
|
|
354
|
+
**None - Backward Compatible**
|
|
355
|
+
|
|
356
|
+
The AI SDK PromptInput is designed to be a drop-in replacement. Existing API structure remains the same, with files as an optional addition.
|
|
357
|
+
|
|
358
|
+
**Migration Path:**
|
|
359
|
+
1. Replace component import
|
|
360
|
+
2. Update JSX structure
|
|
361
|
+
3. Add file handling logic
|
|
362
|
+
4. Test and iterate
|
|
363
|
+
|
|
364
|
+
## Performance Considerations
|
|
365
|
+
|
|
366
|
+
**Bundle Size:**
|
|
367
|
+
- AI SDK PromptInput: ~15KB gzipped
|
|
368
|
+
- Additional features (speech, attachments): +10KB
|
|
369
|
+
- Total impact: ~25KB (acceptable for chat feature)
|
|
370
|
+
|
|
371
|
+
**Runtime Performance:**
|
|
372
|
+
- File preview: Use blob URLs (no re-encoding)
|
|
373
|
+
- Convert to data URL only on submit (async)
|
|
374
|
+
- Cleanup blob URLs on unmount (memory management)
|
|
375
|
+
|
|
376
|
+
**Optimization:**
|
|
377
|
+
- Use `client:load` for PromptInput (critical interactivity)
|
|
378
|
+
- Lazy load speech recognition (only when button clicked)
|
|
379
|
+
- Optimize attachment preview rendering (virtual list for 10+ files)
|
|
380
|
+
|
|
381
|
+
## Success Metrics
|
|
382
|
+
|
|
383
|
+
**User Experience:**
|
|
384
|
+
- File upload success rate > 95%
|
|
385
|
+
- Speech-to-text accuracy > 80% (browser-dependent)
|
|
386
|
+
- Time to first input < 500ms
|
|
387
|
+
- Zero layout shifts during file upload
|
|
388
|
+
|
|
389
|
+
**Developer Experience:**
|
|
390
|
+
- Lines of code reduced by 40%
|
|
391
|
+
- Maintenance burden reduced (using SDK components)
|
|
392
|
+
- Feature parity with ChatGPT/Claude interfaces
|
|
393
|
+
- Easier to add new input features
|
|
394
|
+
|
|
395
|
+
## Future Enhancements
|
|
396
|
+
|
|
397
|
+
**Potential Add-Ons:**
|
|
398
|
+
1. **Template Messages** - Pre-filled prompts with variables
|
|
399
|
+
2. **Slash Commands** - `/image`, `/code`, `/summarize`
|
|
400
|
+
3. **Context Menu** - Right-click for additional actions
|
|
401
|
+
4. **Voice Output** - Text-to-speech for responses
|
|
402
|
+
5. **Collaborative Editing** - Real-time co-editing of prompts
|
|
403
|
+
6. **History Search** - Search and reuse previous prompts
|
|
404
|
+
|
|
405
|
+
## Resources
|
|
406
|
+
|
|
407
|
+
**Documentation:**
|
|
408
|
+
- AI SDK Elements: https://ai-sdk.dev/elements
|
|
409
|
+
- PromptInput Component: https://ai-sdk.dev/elements/components/prompt-input
|
|
410
|
+
- File Handling: https://ai-sdk.dev/elements/guides/file-handling
|
|
411
|
+
- Speech-to-Text: https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API
|
|
412
|
+
|
|
413
|
+
**Examples:**
|
|
414
|
+
- ChatGPT Clone: `/web/src/components/ai/examples/demo-chatgpt.tsx`
|
|
415
|
+
- Claude Clone: `/web/src/components/ai/examples/demo-claude.tsx`
|
|
416
|
+
- PromptInput Demo: `/web/src/components/ai/examples/prompt-input.tsx`
|
|
417
|
+
|
|
418
|
+
## Ontology Mapping
|
|
419
|
+
|
|
420
|
+
**Dimension:** Things (AI Chat Feature)
|
|
421
|
+
|
|
422
|
+
**Thing Type:** `ai_chat_interface`
|
|
423
|
+
|
|
424
|
+
**Properties:**
|
|
425
|
+
```json
|
|
426
|
+
{
|
|
427
|
+
"name": "AI Chat with Elements",
|
|
428
|
+
"type": "ai_chat_interface",
|
|
429
|
+
"properties": {
|
|
430
|
+
"supports_attachments": true,
|
|
431
|
+
"supports_speech": true,
|
|
432
|
+
"supports_multimodal": true,
|
|
433
|
+
"max_files": 5,
|
|
434
|
+
"max_file_size": 10485760,
|
|
435
|
+
"accepted_file_types": ["image/*"],
|
|
436
|
+
"models": [
|
|
437
|
+
"google/gemini-2.5-flash-lite",
|
|
438
|
+
"openai/gpt-4",
|
|
439
|
+
"anthropic/claude-3-opus"
|
|
440
|
+
]
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
**Events to Log:**
|
|
446
|
+
- `ai_chat_message_sent` - User sends message
|
|
447
|
+
- `ai_chat_file_uploaded` - User uploads file
|
|
448
|
+
- `ai_chat_speech_used` - User uses speech-to-text
|
|
449
|
+
- `ai_chat_model_changed` - User changes model
|
|
450
|
+
- `ai_chat_error_occurred` - Validation or API error
|
|
451
|
+
|
|
452
|
+
## Decision Log
|
|
453
|
+
|
|
454
|
+
**2025-01-12: Approved AI SDK PromptInput Integration**
|
|
455
|
+
- **Decision:** Replace custom PromptInput with AI SDK version
|
|
456
|
+
- **Rationale:** Better UX, more features, less maintenance
|
|
457
|
+
- **Trade-off:** Bundle size +25KB vs. custom 5KB (acceptable)
|
|
458
|
+
|
|
459
|
+
**2025-01-12: File Upload Enabled**
|
|
460
|
+
- **Decision:** Enable file attachments (images only initially)
|
|
461
|
+
- **Rationale:** Essential for modern AI chat (ChatGPT has it)
|
|
462
|
+
- **Trade-off:** Server-side vision model required (Gemini supports it)
|
|
463
|
+
|
|
464
|
+
**2025-01-12: Speech-to-Text Included**
|
|
465
|
+
- **Decision:** Add speech-to-text button (browser API)
|
|
466
|
+
- **Rationale:** Accessibility + mobile UX improvement
|
|
467
|
+
- **Trade-off:** Browser support varies (graceful degradation)
|
|
468
|
+
|
|
469
|
+
## Next Steps
|
|
470
|
+
|
|
471
|
+
1. **Create Feature Branch:** `feature/ai-elements-integration`
|
|
472
|
+
2. **Implement Phase 1:** Replace PromptInput with AI SDK version
|
|
473
|
+
3. **Test File Upload:** Verify drag & drop, paste, validation
|
|
474
|
+
4. **Update API Endpoint:** Handle multimodal content
|
|
475
|
+
5. **Deploy to Staging:** Test in production-like environment
|
|
476
|
+
6. **Gather Feedback:** User testing for UX improvements
|
|
477
|
+
7. **Document Changes:** Update `/one/events/` with deployment notes
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
**End of Plan**
|
|
482
|
+
|
|
483
|
+
This plan provides a clear roadmap for integrating AI SDK Elements into the chat interface, starting with PromptInput replacement and expanding to advanced features over time.
|
|
@@ -32,35 +32,32 @@ Build working video player functionality on the frontend WITHOUT requiring backe
|
|
|
32
32
|
|
|
33
33
|
---
|
|
34
34
|
|
|
35
|
-
## Dependencies
|
|
35
|
+
## Dependencies
|
|
36
36
|
|
|
37
37
|
### Required Dependencies
|
|
38
38
|
```json
|
|
39
39
|
{
|
|
40
|
-
"@astro-community/astro-embed-youtube": "^0.5.
|
|
41
|
-
"@
|
|
42
|
-
"
|
|
43
|
-
"react
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"react": "^
|
|
47
|
-
"react-dom": "^18.3.1"
|
|
40
|
+
"@astro-community/astro-embed-youtube": "^0.5.7",
|
|
41
|
+
"@mux/mux-player-react": "^3.8.0",
|
|
42
|
+
"react-h5-audio-player": "^3.10.1",
|
|
43
|
+
"lucide-react": "^0.546.0",
|
|
44
|
+
"zod": "^4.1.12",
|
|
45
|
+
"react": "^19.1.1",
|
|
46
|
+
"react-dom": "^19.1.1"
|
|
48
47
|
}
|
|
49
48
|
```
|
|
50
49
|
|
|
51
50
|
### Already Installed in web/package.json
|
|
52
|
-
- `astro`: ✅ (5.
|
|
53
|
-
- `react`: ✅ (
|
|
54
|
-
- `react-dom`: ✅ (
|
|
55
|
-
- `lucide-react`: ✅
|
|
56
|
-
- `zod`: ✅
|
|
57
|
-
- `@
|
|
51
|
+
- `astro`: ✅ (5.14.1)
|
|
52
|
+
- `react`: ✅ (19.1.1)
|
|
53
|
+
- `react-dom`: ✅ (19.1.1)
|
|
54
|
+
- `lucide-react`: ✅ (0.546.0)
|
|
55
|
+
- `zod`: ✅ (4.1.12)
|
|
56
|
+
- `@astro-community/astro-embed-youtube`: ✅ (0.5.7)
|
|
57
|
+
- `react-h5-audio-player`: ✅ (3.10.1)
|
|
58
58
|
|
|
59
59
|
### Need to Install
|
|
60
|
-
- `@
|
|
61
|
-
- `@vidstack/react`: ❌ (advanced video player)
|
|
62
|
-
- `vidstack`: ❌ (player core)
|
|
63
|
-
- `react-h5-audio-player`: ❌ (audio player for podcasts)
|
|
60
|
+
- `@mux/mux-player-react`: ❌ (Mux video player - official, production-ready)
|
|
64
61
|
|
|
65
62
|
---
|
|
66
63
|
|
|
@@ -72,22 +69,23 @@ Build working video player functionality on the frontend WITHOUT requiring backe
|
|
|
72
69
|
**Agent:** agent-frontend
|
|
73
70
|
|
|
74
71
|
✓ **Cycle 1:** Install dependencies
|
|
75
|
-
- Run `cd web && bun add @
|
|
76
|
-
- Verify
|
|
72
|
+
- Run `cd web && bun add @mux/mux-player-react`
|
|
73
|
+
- Verify installation in package.json
|
|
77
74
|
- Test imports in a simple component
|
|
78
75
|
|
|
79
76
|
✓ **Cycle 2:** Create content collection schema
|
|
80
77
|
- Create `web/src/content/videos/` directory
|
|
81
|
-
- Define Zod schema for video metadata (title, description, youtubeId, thumbnail, duration)
|
|
82
|
-
- Create sample video entries (3-4 videos
|
|
78
|
+
- Define Zod schema for video metadata (title, description, playbackId, muxAssetId, youtubeId, thumbnail, duration)
|
|
79
|
+
- Create sample video entries (3-4 videos)
|
|
83
80
|
|
|
84
81
|
### Cycle 3-6: Core Components (4 cycles)
|
|
85
82
|
**Agent:** agent-frontend
|
|
86
83
|
|
|
87
|
-
✓ **Cycle 3:**
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
-
|
|
84
|
+
✓ **Cycle 3:** Create VideoPlayer component
|
|
85
|
+
- Create `web/src/components/media/VideoPlayer.tsx` using @mux/mux-player-react
|
|
86
|
+
- Support both Mux (playbackId) and YouTube (youtubeId) sources
|
|
87
|
+
- Add metadata tracking (video_id, video_title, viewer_user_id)
|
|
88
|
+
- Test with sample playbackId
|
|
91
89
|
|
|
92
90
|
✓ **Cycle 4:** Port VideoEmbed component
|
|
93
91
|
- Copy `apps/bullfm/src/components/lessons/VideoEmbed.tsx` → `web/src/components/media/VideoEmbed.tsx`
|
|
@@ -140,14 +138,14 @@ Build working video player functionality on the frontend WITHOUT requiring backe
|
|
|
140
138
|
**Agent:** agent-frontend
|
|
141
139
|
**Deliverable:** Dependencies installed, content collection configured
|
|
142
140
|
|
|
143
|
-
- Cycle 1: Install
|
|
141
|
+
- Cycle 1: Install Mux player dependency (others already installed)
|
|
144
142
|
- Cycle 2: Create content collection schema + sample data
|
|
145
143
|
|
|
146
144
|
### Phase 2: Core Components (Cycles 3-6)
|
|
147
145
|
**Agent:** agent-frontend
|
|
148
146
|
**Deliverable:** Reusable video components
|
|
149
147
|
|
|
150
|
-
- Cycle 3:
|
|
148
|
+
- Cycle 3: Create VideoPlayer (Mux + YouTube support)
|
|
151
149
|
- Cycle 4: Port VideoEmbed (SSR YouTube embeds)
|
|
152
150
|
- Cycle 5: Create VideoCard (thumbnail + metadata)
|
|
153
151
|
- Cycle 6: Create VideoGallery (grid layout)
|
|
@@ -193,37 +191,41 @@ Build working video player functionality on the frontend WITHOUT requiring backe
|
|
|
193
191
|
|
|
194
192
|
---
|
|
195
193
|
|
|
196
|
-
## Component
|
|
194
|
+
## Component Structure
|
|
197
195
|
|
|
198
|
-
###
|
|
196
|
+
### New Components to Create
|
|
199
197
|
|
|
200
198
|
**Video Components:**
|
|
201
199
|
```
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
200
|
+
web/src/components/media/VideoPlayer.tsx
|
|
201
|
+
- Uses @mux/mux-player-react for Mux-hosted videos
|
|
202
|
+
- Falls back to YouTube embeds for youtubeId
|
|
203
|
+
- Metadata tracking for analytics
|
|
205
204
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
205
|
+
web/src/components/media/VideoEmbed.tsx
|
|
206
|
+
- SSR YouTube embeds using @astro-community/astro-embed-youtube
|
|
207
|
+
- Lightweight for marketing pages
|
|
209
208
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
209
|
+
web/src/components/media/VideoCard.tsx
|
|
210
|
+
- Thumbnail card with metadata
|
|
211
|
+
- Links to video detail page
|
|
212
|
+
|
|
213
|
+
web/src/components/media/VideoGallery.tsx
|
|
214
|
+
- Grid layout for video browsing
|
|
213
215
|
```
|
|
214
216
|
|
|
215
217
|
**Audio Components:**
|
|
216
218
|
```
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
219
|
+
web/src/components/media/AudioPlayer.tsx
|
|
220
|
+
- Uses react-h5-audio-player
|
|
221
|
+
- Support for podcast episodes
|
|
220
222
|
```
|
|
221
223
|
|
|
222
224
|
**Content Collections:**
|
|
223
225
|
```
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
226
|
+
web/src/content/config.ts
|
|
227
|
+
- Add videos collection schema
|
|
228
|
+
- Add podcasts collection schema
|
|
227
229
|
```
|
|
228
230
|
|
|
229
231
|
---
|
|
@@ -240,10 +242,12 @@ const videosCollection = defineCollection({
|
|
|
240
242
|
schema: z.object({
|
|
241
243
|
title: z.string(),
|
|
242
244
|
description: z.string(),
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
playbackId: z.string().optional(), // Mux playback ID (primary)
|
|
246
|
+
muxAssetId: z.string().optional(), // Mux asset ID for metadata
|
|
247
|
+
youtubeId: z.string().optional(), // YouTube fallback
|
|
248
|
+
videoUrl: z.string().optional(), // Direct URL fallback
|
|
249
|
+
thumbnail: z.string(), // Image URL or path
|
|
250
|
+
duration: z.number(), // Seconds
|
|
247
251
|
publishedAt: z.date(),
|
|
248
252
|
author: z.string().optional(),
|
|
249
253
|
categories: z.array(z.string()).default([]),
|
|
@@ -256,22 +260,43 @@ export const collections = {
|
|
|
256
260
|
};
|
|
257
261
|
```
|
|
258
262
|
|
|
259
|
-
### Sample Video
|
|
263
|
+
### Sample Video Entries
|
|
264
|
+
|
|
265
|
+
**Mux-hosted video:**
|
|
260
266
|
```markdown
|
|
261
267
|
---
|
|
262
|
-
# web/src/content/videos/
|
|
263
|
-
title: "
|
|
264
|
-
description: "
|
|
268
|
+
# web/src/content/videos/mux-example.md
|
|
269
|
+
title: "Mux Video Example"
|
|
270
|
+
description: "Example video hosted on Mux"
|
|
271
|
+
playbackId: "a4nOgmxGWg6gULfcBbAa00gXyfcwPnAFldF8RdsNyk8M"
|
|
272
|
+
muxAssetId: "video-123"
|
|
273
|
+
thumbnail: "/images/videos/mux-example-thumb.jpg"
|
|
274
|
+
duration: 300
|
|
275
|
+
publishedAt: 2025-01-15
|
|
276
|
+
author: "ONE Platform"
|
|
277
|
+
categories: ["tutorial"]
|
|
278
|
+
tags: ["mux", "video"]
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
Example video demonstrating Mux player integration...
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
**YouTube fallback:**
|
|
285
|
+
```markdown
|
|
286
|
+
---
|
|
287
|
+
# web/src/content/videos/youtube-example.md
|
|
288
|
+
title: "YouTube Video Example"
|
|
289
|
+
description: "Example video from YouTube"
|
|
265
290
|
youtubeId: "dQw4w9WgXcQ"
|
|
266
|
-
thumbnail: "/images/videos/
|
|
291
|
+
thumbnail: "/images/videos/youtube-thumb.jpg"
|
|
267
292
|
duration: 420
|
|
268
293
|
publishedAt: 2025-01-15
|
|
269
|
-
author: "
|
|
270
|
-
categories: ["
|
|
271
|
-
tags: ["
|
|
294
|
+
author: "ONE Platform"
|
|
295
|
+
categories: ["demo"]
|
|
296
|
+
tags: ["youtube"]
|
|
272
297
|
---
|
|
273
298
|
|
|
274
|
-
|
|
299
|
+
Example video using YouTube embed...
|
|
275
300
|
```
|
|
276
301
|
|
|
277
302
|
---
|
|
@@ -279,17 +304,17 @@ Deep dive into Sui's gaming capabilities...
|
|
|
279
304
|
## Technology Stack
|
|
280
305
|
|
|
281
306
|
### Frontend
|
|
282
|
-
- **Framework:** Astro 5 + React 19
|
|
283
|
-
- **Styling:** Tailwind v4
|
|
284
|
-
- **Video Player:** @
|
|
285
|
-
- **Audio Player:** react-h5-audio-player
|
|
286
|
-
- **Icons:** lucide-react
|
|
287
|
-
- **Validation:** Zod
|
|
307
|
+
- **Framework:** Astro 5.14.1 + React 19.1.1
|
|
308
|
+
- **Styling:** Tailwind v4.1.13
|
|
309
|
+
- **Video Player:** @mux/mux-player-react 3.8.0 (primary) + @astro-community/astro-embed-youtube 0.5.7 (fallback)
|
|
310
|
+
- **Audio Player:** react-h5-audio-player 3.10.1
|
|
311
|
+
- **Icons:** lucide-react 0.546.0
|
|
312
|
+
- **Validation:** Zod 4.1.12
|
|
288
313
|
|
|
289
314
|
### Deployment
|
|
290
315
|
- **Frontend:** Cloudflare Pages (web.one.ie)
|
|
291
316
|
- **Assets:** Static files in `/public/`
|
|
292
|
-
- **
|
|
317
|
+
- **Video Hosting:** Mux (production-ready CDN) or YouTube (zero cost fallback)
|
|
293
318
|
|
|
294
319
|
### No Backend Required
|
|
295
320
|
- ❌ No Convex (deferred to video-backend.md)
|
|
@@ -373,8 +398,8 @@ When ready to add multi-tenancy, analytics, and user features:
|
|
|
373
398
|
# 1. Review this plan
|
|
374
399
|
cat /Users/toc/Server/ONE/one/things/plans/video-frontend.md
|
|
375
400
|
|
|
376
|
-
# 2. Start Cycle 1
|
|
377
|
-
cd web && bun add @
|
|
401
|
+
# 2. Start Cycle 1 (most dependencies already installed!)
|
|
402
|
+
cd web && bun add @mux/mux-player-react
|
|
378
403
|
|
|
379
404
|
# 3. Execute cycles sequentially
|
|
380
405
|
/next # Advance to next cycle
|
|
@@ -402,27 +427,60 @@ cd web && bun add @astro-community/astro-embed-youtube @vidstack/react vidstack
|
|
|
402
427
|
|
|
403
428
|
---
|
|
404
429
|
|
|
405
|
-
## Appendix:
|
|
406
|
-
|
|
407
|
-
**
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
-
|
|
411
|
-
-
|
|
412
|
-
- `
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
430
|
+
## Appendix: Dependencies
|
|
431
|
+
|
|
432
|
+
**Already Installed:**
|
|
433
|
+
- `@astro-community/astro-embed-youtube`: "^0.5.7" (YouTube embeds) ✅
|
|
434
|
+
- `react-h5-audio-player`: "^3.10.1" (podcast player) ✅
|
|
435
|
+
- `lucide-react`: "^0.546.0" (icons) ✅
|
|
436
|
+
- `zod`: "^4.1.12" (validation) ✅
|
|
437
|
+
- `astro`: "^5.14.1" (static site generator) ✅
|
|
438
|
+
- `react`: "^19.1.1" (UI library - React 19!) ✅
|
|
439
|
+
- `react-dom`: "^19.1.1" (React renderer) ✅
|
|
440
|
+
|
|
441
|
+
**Need to Install:**
|
|
442
|
+
- `@mux/mux-player-react`: "^3.8.0" (Mux video player - official package) ❌
|
|
443
|
+
|
|
444
|
+
## Mux Player Features
|
|
445
|
+
|
|
446
|
+
**Official Package:** https://www.npmjs.com/package/@mux/mux-player-react
|
|
447
|
+
|
|
448
|
+
**Key Features:**
|
|
449
|
+
- Production-ready player with built-in controls
|
|
450
|
+
- Automatic quality selection and adaptive streaming
|
|
451
|
+
- Built-in metadata tracking for analytics
|
|
452
|
+
- Lazy loading support for performance
|
|
453
|
+
- Works with Mux Video CDN
|
|
454
|
+
- Fallback poster/placeholder images
|
|
455
|
+
|
|
456
|
+
**Basic Usage:**
|
|
457
|
+
```tsx
|
|
458
|
+
import MuxPlayer from '@mux/mux-player-react';
|
|
459
|
+
|
|
460
|
+
<MuxPlayer
|
|
461
|
+
playbackId="a4nOgmxGWg6gULfcBbAa00gXyfcwPnAFldF8RdsNyk8M"
|
|
462
|
+
metadata={{
|
|
463
|
+
video_id: "video-123",
|
|
464
|
+
video_title: "Example Video",
|
|
465
|
+
viewer_user_id: "user-456"
|
|
466
|
+
}}
|
|
467
|
+
/>
|
|
468
|
+
```
|
|
421
469
|
|
|
422
|
-
**
|
|
423
|
-
|
|
424
|
-
-
|
|
425
|
-
|
|
470
|
+
**Lazy Loading:**
|
|
471
|
+
```tsx
|
|
472
|
+
import MuxPlayer from '@mux/mux-player-react/lazy';
|
|
473
|
+
|
|
474
|
+
<MuxPlayer
|
|
475
|
+
loading="viewport"
|
|
476
|
+
playbackId="DS00Spx1CV902MCtPj5WknGlR102V5HFkDe"
|
|
477
|
+
metadata={{
|
|
478
|
+
video_id: 'video-id-123456',
|
|
479
|
+
video_title: 'Big Buck Bunny',
|
|
480
|
+
viewer_user_id: 'user-id-bc-789'
|
|
481
|
+
}}
|
|
482
|
+
/>
|
|
483
|
+
```
|
|
426
484
|
|
|
427
485
|
---
|
|
428
486
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oneie",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.39",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Build apps, websites, and AI agents in English. Zero-interaction setup for AI agents (Claude Code, Cursor, Windsurf). Download to your computer, run in the cloud, deploy to the edge. Open source and free forever.",
|
|
6
6
|
"bin": {
|
|
7
|
-
"oneie": "./dist/index.js"
|
|
7
|
+
"oneie": "./dist/index.js",
|
|
8
|
+
"one": "./dist/index.js"
|
|
8
9
|
},
|
|
9
10
|
"scripts": {
|
|
10
11
|
"build": "tsc",
|