How ashark-ai-05/opencanvas works
OpenCanvas is a local-first AI canvas: a user prompt is handled either by the model-free instant-intent path or by a provider-backed agent, which creates typed widgets that appear and persist on an interactive canvas. The README also documents conversation memory/search, MCP sources, extensible widgets, and REST/SSE control. The supplied excerpts show selected backend, indexing, and search internals; several frontend and backend routes are represented only by tree paths or README capability statements, so those links are cited to the README rather than inferred from names.
Main entry points: chat.ts Chat route · useFastLane.ts Instant intent · Canvas.tsx Canvas and widgets · orchestrator.ts Knowledge indexing
Components 25
Canvas interface
- Application shell
app/src/App.tsx - Chat interface
app/src/components/ChatTabs.tsx - Instant intent
app/src/hooks/useFastLane.ts - Intent parsing
app/src/intent - Canvas and widgets
app/src/canvas/Canvas.tsx - Widget renderers
app/src/canvas/shapes
Agent and widgets
- Provider factory
src/providers/index.ts - Model providers
src/providers - Agent tools
src/agent/tools - Widget stream bus
src/agent/widget-stream-bus.ts - Widget registry
src/backend/widget-registry.ts
Backend services
- HTTP and SSE API
src/backend/server.ts - Chat route
src/backend/routes/chat.ts - Backend state
src/backend/state.ts - Notebook store
src/backend/notebook-store.ts
Knowledge and integrations
- MCP sources
src/mcp/source.ts - MCP transport
src/mcp/transport.ts - Knowledge indexing
src/indexer/orchestrator.ts - QA enrichment
src/indexer/qa-enricher.ts - Embedding providers
src/core/embedding-provider.ts - Search route
src/backend/routes/search.ts - Hybrid search
src/search/service.ts - SQLite knowledge store
src/storage/store.ts
Other components
- User
- Configured services
Connections 29
- User → Application shell: uses
README.md - Application shell → Chat interface: renders
app/src/App.tsx - Application shell → Canvas and widgets: renders
app/src/App.tsx - Chat interface → Instant intent: checks intent
app/src/hooks/useFastLane.ts - Instant intent → Intent parsing: classifies prompt
app/src/hooks/useFastLane.ts - User → Instant intent: types prompt
README.md - Instant intent → Canvas and widgets: places widgets
README.md - Chat interface → HTTP and SSE API: sends turns
README.md - HTTP and SSE API → Chat route: routes requests
src/backend/server.ts - Chat route → Backend state: uses state
src/backend/state.ts - Backend state → Provider factory: creates provider
src/backend/state.ts - Provider factory → Model providers: selects adapter
src/providers/index.ts - Chat route → Canvas and widgets: streams widgets
- Agent tools → Widget registry: registers widget kinds
src/agent/tools/_shared.ts - Agent tools → Notebook store: reads and writes
src/agent/tools/_shared.ts - Chat route → Widget stream bus: streams widget updates
- Canvas and widgets → Widget renderers: renders shapes
README.md - User → MCP sources: configures sources
README.md - MCP transport → MCP sources: connects sources
src/backend/server.ts - Configured services → MCP transport: provides MCP
README.md - Knowledge indexing → QA enrichment: enriches chunks
src/indexer/orchestrator.ts - Knowledge indexing → Embedding providers: embeds chunks
src/indexer/orchestrator.ts - Knowledge indexing → SQLite knowledge store: writes chunks
src/indexer/orchestrator.ts - User → Search route: searches memory
README.md - Search route → Hybrid search: runs search
src/backend/routes/search.ts - Hybrid search → Embedding providers: embeds query
src/search/service.ts - Hybrid search → SQLite knowledge store: queries index
src/search/service.ts - Configured services → Model providers: supplies model API
README.md - Configured services → Embedding providers: supplies embeddings