Plausible plan for Harness. We’ll fix the details later — this is the shape of it, not the final wiring. The editor + chat you see now are local-only toys.
Real files on disk, not the files{} object in this page. Tabs, gutter, and highlight stay β they just read/write via API.
One server endpoint that talks to the model, streams tokens, and enforces cost caps. Browser never holds the API key.
Parse every file for symbols, chunk it, embed it. That’s how @Deno / @file and “Chat with your codebase” actually work.
Conversations, proposed diffs, Accept/Reject. Composer applies a diff as one transaction, not one replace() at a time.
Users, projects, API keys, usage limits. So your APP_H5 isn’t everyone’s APP_H5.
Sandboxed run for βΆ Run and Go Live. No eval() on the client, no shell on the server without a sandbox.
/api/*. WebSocket for live edits + streaming chat.GET /api/files lists the tree, GET /api/file?path= reads, POST /api/file writes. Every write goes through git or a backup copy.GET /api/index/search?q= powers βK + @ context.POST /api/chat packs context (open tabs + @ + recent files) + prompt, streams back, saves the thread.POST /api/composer/apply takes a diff, validates it, applies it, returns the new file. Reject just drops it.POST /api/run runs in a sandbox with timeout + no network unless you allow it, streams stdout back.| Piece | Files | Plausible effort |
|---|---|---|
| Server + file API | server.ts, routes/files.ts | ~2β3 hrs |
| Index + embeddings | index.ts, embed.ts | ~3β4 hrs |
| Chat + streaming | routes/chat.ts | ~2β3 hrs |
| Composer diffs | routes/composer.ts | ~2 hrs |
| Auth + projects + caps | auth.ts, db/* | ~3 hrs |
| Run sandbox + preview | routes/run.ts | ~2β3 hrs |
| Total | ~12 files | ~2β3 weekends |
CREATE TABLE users (id TEXT PRIMARY KEY, email TEXT, created_at DATETIME); CREATE TABLE projects (id TEXT PRIMARY KEY, owner_id TEXT, name TEXT, path TEXT); CREATE TABLE files (id INTEGER PRIMARY KEY, project_id TEXT, path TEXT, hash TEXT); CREATE TABLE chats (id TEXT PRIMARY KEY, project_id TEXT, title TEXT, created_at DATETIME); CREATE TABLE messages (id INTEGER PRIMARY KEY, chat_id TEXT, role TEXT, content TEXT, created_at DATETIME); CREATE TABLE embeddings (file_id INTEGER, chunk TEXT, vec BLOB); -- or pgvector CREATE TABLE runs (id TEXT PRIMARY KEY, project_id TEXT, cmd TEXT, status TEXT, log TEXT);
GET /api/files?project=APP_H5 -> tree
GET /api/file?path=src/filters/vfilters.js -> content
POST /api/file {path, content} -> 200 {hash} | 409 CONFLICT
GET /api/index/search?q=formatDate -> [{file, symbol, snippet}]
POST /api/chat {project, messages, context} -> stream (SSE)
POST /api/composer/apply {file, diff} -> 200 {newContent} | 422 BAD_DIFF
POST /api/run {project, cmd} -> stream stdout, timeout 30s
βΆ Run safely? What’s the per-user cost cap? None decided β modal is the placeholder until we pick.Template only β editor + chat above are still local-only until this is wired.