oneie 3.6.33 → 3.6.37

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.
@@ -0,0 +1,263 @@
1
+ ---
2
+ title: AI SDK Integration Plan
3
+ dimension: things
4
+ category: plans
5
+ tags: ai, ai-sdk, agent, architecture, integration
6
+ related_dimensions: connections, events, knowledge
7
+ scope: global
8
+ created: 2025-11-10
9
+ updated: 2025-11-10
10
+ version: 1.0.0
11
+ ai_context: |
12
+ This document is part of the things dimension in the plans category.
13
+ Location: one/things/plans/ai-integration-plan.md
14
+ Purpose: Master integration plan for AI SDK + AI Elements
15
+ Related dimensions: connections, events, knowledge
16
+ For AI agents: Read this to understand the AI integration strategy
17
+ ---
18
+
19
+ # AI SDK Integration Plan: Complete Codebase Integration Map
20
+
21
+ **Version:** 1.0.0
22
+ **Status:** Planning
23
+ **Created:** 2025-11-10
24
+ **Stack:** Vercel AI SDK 5 + AI Elements + Effect.ts + Convex + 6-Dimension Ontology
25
+
26
+ ---
27
+
28
+ ## Executive Summary
29
+
30
+ This document maps the complete integration of **Vercel AI SDK** and **AI Elements** across the ONE Platform codebase. It provides a comprehensive file-by-file integration map for implementing AI capabilities with the 6-dimension ontology.
31
+
32
+ **Integration Goals:**
33
+ 1. Provider-agnostic AI (OpenAI, Anthropic, Google, etc.)
34
+ 2. Production-ready UI (AI Elements)
35
+ 3. Effect.ts service layer
36
+ 4. Convex real-time backend
37
+ 5. 6-dimension ontology alignment
38
+ 6. Multi-tenant agent system
39
+ 7. AG-UI protocol (CopilotKit-inspired)
40
+
41
+ ---
42
+
43
+ ## Part 1: Codebase Analysis Summary
44
+
45
+ ### Search Results Overview
46
+
47
+ **Todo Files (216):** Including one/things/todo-ai.md with 100-cycle roadmap
48
+ **Project Files (423):** Including web/src/pages/projects/ and templates
49
+ **Agent Files (50+):** Complete agent system with specifications
50
+ **Services (15):** All following ontology patterns
51
+ **AI Documentation:** Comprehensive plans for AI SDK, Elements, Tools, CopilotKit
52
+
53
+ ---
54
+
55
+ ## Part 2: File Integration Map (96 Total Files)
56
+
57
+ ### Backend Files (35 files)
58
+
59
+ **New Files to Create:**
60
+ ```
61
+ backend/convex/schema.ts (modify - add AI tables)
62
+ backend/convex/ai/config.ts
63
+ backend/convex/ai/models.ts
64
+ backend/convex/ai/tools.ts
65
+ backend/convex/services/llm-service.ts
66
+ backend/convex/services/agent-ui-service.ts
67
+ backend/convex/services/rag-service.ts
68
+ backend/convex/services/agent-orchestrator.ts
69
+ backend/convex/protocols/agent-ui.ts
70
+ backend/convex/mutations/ai/generate.ts
71
+ backend/convex/mutations/ai/stream.ts
72
+ backend/convex/mutations/ai/threads.ts
73
+ backend/convex/mutations/ai/agents.ts
74
+ backend/convex/queries/ai/calls.ts
75
+ backend/convex/queries/ai/threads.ts
76
+ backend/convex/queries/ai/agents.ts
77
+ + 10 test files
78
+ + 5 tool files
79
+ ```
80
+
81
+ ### Frontend Files (48 files)
82
+
83
+ **New Files to Create:**
84
+ ```
85
+ web/src/components/ai/Chatbot.tsx
86
+ web/src/components/ai/Message.tsx
87
+ web/src/components/ai/PromptInput.tsx
88
+ web/src/components/ai/MessageList.tsx
89
+ web/src/components/ai/AgentMessage.tsx
90
+ web/src/components/ai/CodeBlock.tsx
91
+ web/src/components/ai/Reasoning.tsx
92
+ web/src/components/ai/ToolCall.tsx
93
+ web/src/components/ai/LoadingIndicator.tsx
94
+ web/src/components/ai/Suggestions.tsx
95
+
96
+ web/src/components/generative-ui/GenerativeUIRenderer.tsx
97
+ web/src/components/generative-ui/DynamicChart.tsx
98
+ web/src/components/generative-ui/DynamicTable.tsx
99
+ web/src/components/generative-ui/DynamicCard.tsx
100
+ web/src/components/generative-ui/DynamicForm.tsx
101
+ web/src/components/generative-ui/DynamicList.tsx
102
+ web/src/components/generative-ui/DynamicTimeline.tsx
103
+
104
+ web/src/hooks/ai/useAIChat.ts
105
+ web/src/hooks/ai/useCompleteChatFlow.ts
106
+ web/src/hooks/ai/useAgentContext.ts
107
+ web/src/hooks/ai/useTokenUsage.ts
108
+ web/src/hooks/ai/useAgentActions.ts
109
+ web/src/hooks/ai/useGenerativeUI.ts
110
+
111
+ web/src/pages/chat/index.astro
112
+ web/src/pages/chat/[threadId].astro
113
+ web/src/pages/agents/index.astro
114
+ web/src/pages/agents/[agentId].astro
115
+ web/src/pages/dashboard/ai-usage.astro
116
+
117
+ + 15 test files
118
+ ```
119
+
120
+ **Files to Modify:**
121
+ ```
122
+ web/src/services/ThingService.ts (add agent methods)
123
+ web/src/services/EventService.ts (add AI events)
124
+ web/src/services/KnowledgeService.ts (add RAG search)
125
+ ```
126
+
127
+ ### Configuration Files (5 files)
128
+
129
+ ```
130
+ web/package.json (add: ai, @ai-sdk/*, zod, recharts)
131
+ backend/convex/package.json (add: ai, @ai-sdk/*, effect)
132
+ web/.env.local (PUBLIC_CONVEX_URL)
133
+ backend/.env.local (AI API keys)
134
+ .github/workflows/ai-tests.yml (CI/CD)
135
+ ```
136
+
137
+ ### Documentation Files (8 files)
138
+
139
+ ```
140
+ one/knowledge/ai-sdk-implementation.md
141
+ one/knowledge/ag-ui-protocol.md
142
+ one/knowledge/generative-ui-patterns.md
143
+ one/events/ai-integration-complete.md
144
+ one/events/ai-integration-lessons-learned.md
145
+ README-AI.md
146
+ docs/AI-QUICKSTART.md
147
+ docs/AI-API-REFERENCE.md
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Part 3: Integration Roadmap
153
+
154
+ ### Phase 1: Backend (Cycles 1-30) - agent-backend
155
+ - Install AI SDK dependencies
156
+ - Extend schema with AI tables
157
+ - Implement Effect.ts services (LLM, AgentUI, RAG)
158
+ - Create AG-UI protocol types
159
+ - Build mutations and queries
160
+ - Write backend tests
161
+
162
+ ### Phase 2: Frontend (Cycles 31-60) - agent-frontend
163
+ - Install AI Elements
164
+ - Create AI component library (10 components)
165
+ - Build generative UI components (7 components)
166
+ - Implement React hooks (6 hooks)
167
+ - Build Astro pages (5 pages)
168
+ - Style with Tailwind v4
169
+ - Write frontend tests
170
+
171
+ ### Phase 3: Integration (Cycles 61-90) - agent-integrator + agent-quality
172
+ - Integrate existing services
173
+ - Test end-to-end flows
174
+ - Performance optimization
175
+ - Security audit
176
+ - Integration tests
177
+
178
+ ### Phase 4: Deployment (Cycles 91-100) - agent-documenter + agent-ops
179
+ - Complete documentation
180
+ - Configure CI/CD
181
+ - Production deployment
182
+ - Monitoring setup
183
+
184
+ ---
185
+
186
+ ## Part 4: Ontology Mapping
187
+
188
+ ### Things Dimension
189
+ - `ai_agent` - Agent entities with model config
190
+ - `ai_thread` - Conversation containers
191
+ - `ai_message` - Individual messages
192
+
193
+ ### Connections Dimension
194
+ - `user_interacts_with_agent`
195
+ - `agent_owns_tool`
196
+ - `agent_trained_on_knowledge`
197
+ - `agent_collaborates_with_agent`
198
+
199
+ ### Events Dimension
200
+ - `ai_generation_completed`
201
+ - `ai_error_occurred`
202
+ - `ai_tool_called`
203
+ - `ai_thread_created`
204
+ - `ai_message_added`
205
+
206
+ ### Knowledge Dimension
207
+ - Vector embeddings for RAG
208
+ - Similarity search
209
+ - Citation tracking
210
+
211
+ ### Groups Dimension
212
+ - Per-group quotas
213
+ - Per-group model preferences
214
+ - Per-group rate limits
215
+
216
+ ### People Dimension
217
+ - platform_owner: Full AI access
218
+ - org_owner: Org AI management
219
+ - org_user: Use org agents
220
+ - customer: Limited access
221
+
222
+ ---
223
+
224
+ ## Part 5: Success Metrics
225
+
226
+ **Technical:**
227
+ - 96 files created/modified
228
+ - 100% type safety
229
+ - >85% test coverage
230
+ - <3s response latency
231
+
232
+ **Functional:**
233
+ - End-to-end chat works
234
+ - Generative UI renders correctly
235
+ - Multi-agent orchestration functional
236
+ - Context sharing bidirectional
237
+
238
+ **Ontology:**
239
+ - All 6 dimensions mapped
240
+ - Events logged for all operations
241
+ - Connections tracked correctly
242
+ - Multi-tenancy enforced
243
+
244
+ ---
245
+
246
+ ## Appendix: Agent Responsibilities
247
+
248
+ | Specialist | Phase | Files | Cycles |
249
+ |------------|-------|-------|--------|
250
+ | agent-backend | 1 | 35 | 1-30 |
251
+ | agent-frontend | 2 | 48 | 31-60 |
252
+ | agent-integrator | 3 | 10 | 61-75 |
253
+ | agent-quality | 3 | 20 | 61-90 |
254
+ | agent-documenter | 4 | 8 | 91-100 |
255
+ | agent-ops | 4 | 5 | 91-100 |
256
+ | agent-director | All | - | 1-100 |
257
+
258
+ ---
259
+
260
+ **Status:** Ready for execution
261
+ **Next Action:** Agent director assigns specialists and kicks off Phase 1
262
+
263
+ _Master integration plan for AI SDK + AI Elements across ONE Platform_