System Topology and Layers
System Topology and Layers
หัวข้อที่มีชื่อว่า “System Topology and Layers”Layered Architecture
หัวข้อที่มีชื่อว่า “Layered Architecture”flowchart TB
subgraph L1[Presentation Layer]
R[App Router /chat]
UCV[UnifiedChatView]
CP[ChatPane]
DCL[DynamicCanvasLoader]
end
subgraph L2[Client Orchestration Layer]
PVD[Auth/Project/Kobi/Thread Providers]
CCTX[AgentState + Action + ChatState Context]
HK[useUnifiedChat* / useChat* hooks]
ZS[Zustand Stores]
end
subgraph L3[Client Service Layer]
UCS[unifiedChatService]
SSS[sessionStartService]
CS[canvasService]
MS[mapService]
DS[dashboardService]
end
subgraph L4[BFF/API Layer]
SESSION["Session start API"]
AI["/api/ai/(all)"]
CHAT["/api/chat/(all)"]
CANVAS["/api/canvas/(all)"]
MAPS["/api/maps/(all)"]
DASH["/api/dashboard/(all)"]
INTERNAL["/api/internal/(all)"]
end
R --> UCV
UCV --> CP
UCV --> DCL
CP --> PVD
DCL --> PVD
PVD --> CCTX
CCTX --> HK
HK --> ZS
HK --> SSS
HK --> UCS
HK --> CS
HK --> MS
HK --> DS
SSS --> SESSION
SESSION --> CHAT
SESSION --> DASH
UCS --> AI
UCS --> CHAT
CS --> CANVAS
MS --> MAPS
DS --> DASH
AI --> INTERNAL
Provider Chain (Runtime Order)
หัวข้อที่มีชื่อว่า “Provider Chain (Runtime Order)”flowchart LR A[AuthProvider] --> B[ProjectProvider] --> C[KobiProvider] --> D[ThreadProvider] --> E[AgentStateProvider] --> F[ActionProvider] --> G[ChatStateProvider] --> H[IdeaProvider]
ลำดับนี้สะท้อน dependency จริง: identity/project -> mode bootstrap -> thread scope -> action/chat state -> workspace-specific coordination
Core Orchestration Responsibilities
หัวข้อที่มีชื่อว่า “Core Orchestration Responsibilities”UnifiedChatView
- parse route/query/share scope
- sync active agent จาก thread/share context
- derive workspace scope
- bootstrap thread/realtime/canvas props
ChatPane
- new chat bootstrap ผ่าน session start API
- send message และ thread pre-creation fallback
- history + thread switching
- action approve/reject/batch resume
- analytics readiness gate
DynamicCanvasLoader
- resolve workspace จาก
modeId/workspaceId - mount component จาก registry และส่ง scope props ให้ถูกต้อง
Practical Invariants
หัวข้อที่มีชื่อว่า “Practical Invariants”- Specialized modes ต้องมี canonical scope key ที่สอดคล้องกับ endpoint
- New chat path ควรได้
threadId+canonicalPathจาก session start ก่อน route transition - URL/state ต้องถูก canonicalize เสมอเมื่อ resolve scope ได้จาก thread metadata
- BFF เป็นจุดสุดท้ายที่ตรวจสอบ field allowlist, scope matching และ metadata normalization