loki-mode 6.40.0 → 6.42.0

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/SKILL.md CHANGED
@@ -3,7 +3,7 @@ name: loki-mode
3
3
  description: Multi-agent autonomous startup system. Triggers on "Loki Mode". Takes PRD to deployed product with minimal human intervention. Requires --dangerously-skip-permissions flag.
4
4
  ---
5
5
 
6
- # Loki Mode v6.40.0
6
+ # Loki Mode v6.42.0
7
7
 
8
8
  **You are an autonomous agent. You make decisions. You do not ask questions. You do not stop.**
9
9
 
@@ -267,4 +267,4 @@ The following features are documented in skill modules but not yet fully automat
267
267
  | Quality gates 3-reviewer system | Implemented (v5.35.0) | 5 specialist reviewers in `skills/quality-gates.md`; execution in run.sh |
268
268
  | Benchmarks (HumanEval, SWE-bench) | Infrastructure only | Runner scripts and datasets exist in `benchmarks/`; no published results |
269
269
 
270
- **v6.40.0 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
270
+ **v6.42.0 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
package/VERSION CHANGED
@@ -1 +1 @@
1
- 6.40.0
1
+ 6.42.0
package/autonomy/loki CHANGED
@@ -3171,6 +3171,13 @@ cmd_web_stop() {
3171
3171
  local port
3172
3172
  port=$(cat "${LOKI_DIR}/purple-lab/port" 2>/dev/null || echo "$PURPLE_LAB_DEFAULT_PORT")
3173
3173
 
3174
+ # Gracefully stop any active session before killing Purple Lab
3175
+ curl -s --max-time 3 -X POST "http://127.0.0.1:${port}/api/session/stop" >/dev/null 2>&1 || true
3176
+ sleep 1
3177
+
3178
+ # Kill any orphaned loki-run processes (belt-and-suspenders)
3179
+ pkill -f "loki-run-" 2>/dev/null || true
3180
+
3174
3181
  # Try PID file first
3175
3182
  if [ -f "$PURPLE_LAB_PID_FILE" ]; then
3176
3183
  local pid
@@ -7,7 +7,7 @@ Modules:
7
7
  control: Session control API (start/stop/pause/resume)
8
8
  """
9
9
 
10
- __version__ = "6.40.0"
10
+ __version__ = "6.42.0"
11
11
 
12
12
  # Expose the control app for easy import
13
13
  try:
@@ -2,7 +2,7 @@
2
2
 
3
3
  The flagship product of [Autonomi](https://www.autonomi.dev/). Complete installation instructions for all platforms and use cases.
4
4
 
5
- **Version:** v6.40.0
5
+ **Version:** v6.42.0
6
6
 
7
7
  ---
8
8
 
@@ -0,0 +1,152 @@
1
+ # PRD: Purple Lab Full IDE Experience
2
+
3
+ ## Overview
4
+
5
+ Transform Purple Lab from a basic file viewer into a production-grade fullstack IDE comparable to Replit, Lovable, and Bolt. Users should be able to build a project via PRD, then immediately browse, edit, preview, and iterate on the output -- all within the browser.
6
+
7
+ ## Target Users
8
+
9
+ - Developers using Loki Mode to generate projects from PRDs
10
+ - Non-technical founders using Purple Lab as their primary development environment
11
+ - Teams evaluating Loki Mode for autonomous development workflows
12
+
13
+ ## Current State (v6.39.0)
14
+
15
+ - React Router with `/project/:sessionId` URLs
16
+ - File tree sidebar with collapsible directories
17
+ - Code viewer with line numbers (read-only)
18
+ - Live preview via iframe serving real files with correct MIME types
19
+ - Session state persists across refresh
20
+ - WebSocket real-time log streaming during builds
21
+
22
+ ## Requirements
23
+
24
+ ### P0 -- Must Have
25
+
26
+ #### Monaco Editor Integration
27
+ - Replace the read-only code viewer with Monaco Editor (VS Code's editor)
28
+ - Syntax highlighting for all major languages (JS, TS, Python, HTML, CSS, JSON, MD, Go, Rust)
29
+ - Read-only mode by default, editable when user clicks "Edit" button
30
+ - File save via `PUT /api/sessions/:id/file?path=` endpoint
31
+ - Keyboard shortcut: Cmd/Ctrl+S to save
32
+ - Show unsaved changes indicator (dot on tab)
33
+
34
+ #### Resizable Split Panes
35
+ - Three-pane layout: file tree | editor | preview
36
+ - Drag handles between panes to resize
37
+ - Pane sizes persist to localStorage
38
+ - Collapse/expand each pane via toggle buttons
39
+ - Minimum widths: file tree 180px, editor 300px, preview 300px
40
+
41
+ #### Integrated Terminal
42
+ - xterm.js terminal emulator in a bottom panel
43
+ - WebSocket-connected to backend for real-time output
44
+ - Resizable height (drag handle)
45
+ - Support for ANSI color codes
46
+ - Show build output, loki logs, and allow running commands in project directory
47
+ - Toggle with Cmd/Ctrl+` keyboard shortcut
48
+
49
+ #### File Operations
50
+ - Create new file (right-click context menu or button)
51
+ - Create new directory
52
+ - Rename file/directory (inline edit)
53
+ - Delete file/directory (with confirmation)
54
+ - All operations via REST API with path traversal protection
55
+
56
+ ### P1 -- Should Have
57
+
58
+ #### Tab System
59
+ - Open multiple files in tabs
60
+ - Close tabs (with unsaved changes warning)
61
+ - Tab reordering via drag
62
+ - "Close All" and "Close Others" context menu
63
+ - Active tab highlighted
64
+
65
+ #### Search
66
+ - Cmd/Ctrl+P: fuzzy file search (like VS Code quick open)
67
+ - Cmd/Ctrl+Shift+F: search across all files in project
68
+ - Search results panel with file + line previews
69
+ - Click result to open file at line
70
+
71
+ #### Preview Enhancements
72
+ - URL bar showing current preview path
73
+ - Back/forward navigation buttons
74
+ - Refresh button
75
+ - Open in new tab button
76
+ - Console panel showing preview JS errors (via postMessage from sandboxed iframe)
77
+ - Auto-refresh on file save
78
+
79
+ ### P2 -- Nice to Have
80
+
81
+ #### Git Integration
82
+ - Show git status in file tree (modified, added, untracked)
83
+ - Diff view for modified files
84
+ - Commit from UI
85
+ - Branch indicator in header
86
+
87
+ #### AI Chat Panel
88
+ - Side panel for chat with Claude about the project
89
+ - Context-aware: knows which file is open, what project is about
90
+ - "Fix this" button on error highlights
91
+ - "Explain" button on selected code
92
+
93
+ #### Deployment
94
+ - "Deploy" button that runs loki deploy
95
+ - Deploy status indicator
96
+ - Preview deployed URL
97
+
98
+ ## Technical Architecture
99
+
100
+ ### Frontend
101
+ - React 19 + TypeScript + Tailwind CSS (existing stack)
102
+ - Monaco Editor: `@monaco-editor/react` package
103
+ - xterm.js: `@xterm/xterm` + `@xterm/addon-fit` + `@xterm/addon-web-links`
104
+ - Split panes: custom implementation with CSS resize or `react-resizable-panels`
105
+ - File operations: REST API calls to new CRUD endpoints
106
+
107
+ ### Backend (web-app/server.py)
108
+ - `PUT /api/sessions/:id/file?path=` -- save file content
109
+ - `POST /api/sessions/:id/file` -- create new file
110
+ - `DELETE /api/sessions/:id/file?path=` -- delete file
111
+ - `POST /api/sessions/:id/directory` -- create directory
112
+ - `POST /api/sessions/:id/rename` -- rename file/directory
113
+ - `GET /api/sessions/:id/search?q=&glob=` -- search files
114
+ - WebSocket terminal: `/ws/terminal/:id` -- PTY-backed terminal session
115
+
116
+ ### Security
117
+ - All file operations scoped to project directory (path traversal protection)
118
+ - File size limits on saves (1MB)
119
+ - Rate limiting on file operations
120
+ - No shell injection in terminal (PTY spawns bash in project dir only)
121
+ - Preview iframe sandboxed
122
+
123
+ ## Success Criteria
124
+
125
+ - User can build a project via PRD, then immediately edit files and see preview update
126
+ - Preview loads all relative assets (CSS, JS, images) correctly
127
+ - Terminal shows real-time build output and allows running commands
128
+ - All operations work without page refresh
129
+ - Performance: file tree renders 1000+ files without freezing
130
+ - Mobile: graceful degradation (single-pane view)
131
+
132
+ ## Non-Goals
133
+
134
+ - Multi-user collaboration (Google Docs style)
135
+ - Version control UI beyond basic git status
136
+ - Package manager integration (npm/pip install from UI)
137
+ - Database management UI
138
+ - Cloud deployment orchestration
139
+
140
+ ## Timeline
141
+
142
+ - P0: 2-3 days focused development
143
+ - P1: 2 days
144
+ - P2: Future sprints
145
+
146
+ ## References
147
+
148
+ - Replit: https://replit.com
149
+ - Lovable: https://lovable.dev
150
+ - Bolt: https://bolt.new
151
+ - Monaco Editor: https://microsoft.github.io/monaco-editor/
152
+ - xterm.js: https://xtermjs.org/
@@ -0,0 +1,223 @@
1
+ # PRD: Purple Lab Platform v2 -- Hosted Autonomous Development IDE
2
+ ## Post-Feedback Final Plan (3 review loops completed)
3
+
4
+ ---
5
+
6
+ ## Feedback Applied
7
+
8
+ Three review loops identified these critical gaps in v1 of this PRD:
9
+ 1. **Product review:** Missing deployment, secrets, import project, issue-driven workflow; `loki plan` should be default; timeline unrealistic
10
+ 2. **Engineering review:** Only 2 pages exist today; sidebar/navigation is the foundational gap; Phase 1 needs auth to work as hosted platform
11
+ 3. **Competitive review:** Bottom activity panel is on wrong page; AI Chat is missing entirely; platform feels 40% done -- needs structural work before features
12
+
13
+ ---
14
+
15
+ ## Current State (v6.41.0) -- Honest Assessment
16
+
17
+ **Working:**
18
+ - Monaco editor with syntax highlighting (17+ languages)
19
+ - File tree with CRUD (create, save, delete files/dirs)
20
+ - Tabs with unsaved indicator, Cmd+S save
21
+ - Quick Open (Cmd+P) fuzzy file search
22
+ - Live preview iframe with auto-refresh on save
23
+ - Resizable split panes
24
+ - URL routing (/project/:id persists on refresh)
25
+ - Session history with status detection
26
+ - WebSocket real-time streaming during builds
27
+ - Error boundaries on all panels
28
+
29
+ **Not working / missing:**
30
+ - NO sidebar navigation (users stuck in IDE, can't browse projects)
31
+ - NO projects list page
32
+ - NO templates gallery page
33
+ - NO settings page
34
+ - NO AI chat (can't iterate by talking to agents)
35
+ - Bottom activity panel (agents, quality gates, build output) only on HomePage, NOT in IDE workspace
36
+ - NO deployment capability
37
+ - NO secrets management
38
+ - NO import project flow
39
+ - Preview has no URL bar, back/forward, or open-in-new-tab
40
+
41
+ ---
42
+
43
+ ## Revised Architecture
44
+
45
+ ### Phase 1: Platform Shell + Navigation (buildable now)
46
+ **Goal:** Make Purple Lab feel like a real platform, not a disconnected prototype.
47
+
48
+ **1a. Global Sidebar (all pages)**
49
+ - Logo + "Purple Lab" branding
50
+ - Nav items: Home, Projects, Templates, Settings
51
+ - Active page highlight
52
+ - Connection status indicator
53
+ - Bottom: Docs link, version
54
+
55
+ **1b. Projects Page (/projects)**
56
+ - Card grid from `/api/sessions/history` (already returns status, file count, PRD snippet)
57
+ - Search bar, status filter (completed/started/empty)
58
+ - Actions per card: Open, Delete, Export as zip
59
+ - Empty state: "No projects yet. Start building."
60
+
61
+ **1c. Templates Gallery (/templates)**
62
+ - Card grid from `/api/templates` (22 templates, already served)
63
+ - Category badges: Simple (green), Standard (blue), Complex (orange)
64
+ - Click -> pre-fills PRD on home page, user confirms and builds
65
+ - Template preview (show first 10 lines of PRD content)
66
+
67
+ **1d. Fix Workspace Navigation**
68
+ - Add sidebar to ProjectPage (same sidebar as all pages)
69
+ - Add breadcrumb: Projects > project-name
70
+ - Back button navigates to /projects (not just /)
71
+
72
+ **Files to create/modify:**
73
+ - NEW: `web-app/src/components/Sidebar.tsx`
74
+ - NEW: `web-app/src/pages/ProjectsPage.tsx`
75
+ - NEW: `web-app/src/pages/TemplatesPage.tsx`
76
+ - NEW: `web-app/src/pages/SettingsPage.tsx` (shell)
77
+ - MODIFY: `web-app/src/App.tsx` (add routes, wrap in sidebar layout)
78
+ - MODIFY: `web-app/src/pages/ProjectPage.tsx` (add sidebar)
79
+
80
+ ---
81
+
82
+ ### Phase 2: Enhanced Workspace (buildable now)
83
+ **Goal:** Bring the monitoring panels into the IDE and add AI chat.
84
+
85
+ **2a. Bottom Activity Panel in ProjectWorkspace**
86
+ Tabbed panel below the editor (collapsible, resizable height):
87
+ - **Build Log:** Real-time loki output (WebSocket, already works on HomePage)
88
+ - **Agents:** Active agent cards with status (already built as AgentDashboard)
89
+ - **Quality Gates:** 9-gate display (already built as QualityGatesPanel)
90
+ - **AI Chat:** NEW -- text input that sends prompts to iterate on the project
91
+
92
+ **2b. AI Chat (key differentiator)**
93
+ - Input at bottom: "Make the header blue" or "Add user authentication"
94
+ - Backend: `POST /api/sessions/:id/chat` which runs `loki quick "<prompt>"` in the project directory
95
+ - Output streams to Build Log tab
96
+ - File tree refreshes after completion
97
+ - Preview auto-refreshes
98
+
99
+ **2c. Mode Selector**
100
+ In workspace header toolbar:
101
+ - Quick (fast, 3 iterations) -- `loki quick`
102
+ - Standard (full RARV, 5 iterations) -- `loki start`
103
+ - Max (extended, 8+ iterations) -- `loki start --complexity complex`
104
+
105
+ **2d. Plan Before Build**
106
+ Default behavior: when user submits a PRD, run `loki plan` first.
107
+ Show: complexity tier, estimated cost, iteration count, phases.
108
+ User confirms "Build" or adjusts.
109
+
110
+ **2e. Preview Toolbar**
111
+ URL bar showing current preview path, Refresh button, Open in New Tab button.
112
+
113
+ **Files to create/modify:**
114
+ - NEW: `web-app/src/components/ActivityPanel.tsx` (bottom tabs: Build Log, Agents, Quality, Chat)
115
+ - NEW: `web-app/src/components/AIChatPanel.tsx`
116
+ - NEW: `web-app/src/components/PreviewToolbar.tsx`
117
+ - MODIFY: `web-app/src/components/ProjectWorkspace.tsx` (add bottom panel, mode selector)
118
+ - MODIFY: `web-app/server.py` (add POST /api/sessions/:id/chat endpoint)
119
+
120
+ ---
121
+
122
+ ### Phase 3: Import + Deploy + Secrets (needs backend work)
123
+ **Goal:** Close the loop -- users can bring code in and ship code out.
124
+
125
+ **3a. Import Project**
126
+ - "Import from GitHub" button on Projects page
127
+ - Backend: clone repo, run `loki onboard` to analyze, generate CLAUDE.md
128
+ - User lands in IDE with file tree populated
129
+ - Uses `loki explain` to show architecture summary on first open
130
+
131
+ **3b. Deploy to Public URL**
132
+ - "Deploy" button in workspace header
133
+ - Backend: build the project (npm build / python build), serve on a public URL
134
+ - URL format: `{project-id}.purplelab.dev` (or subdomain on autonomi.dev)
135
+ - Show deployment status and live URL
136
+ - Uses Docker container already present in workspace
137
+
138
+ **3c. Secrets / Environment Variables**
139
+ - Per-project secrets pane in workspace settings
140
+ - Stored encrypted, injected into build container as env vars
141
+ - UI: key-value editor with show/hide toggle
142
+ - Uses existing `loki secrets` CLI command
143
+
144
+ **3d. Cost Tracking**
145
+ - Visible in workspace header: current session cost estimate
146
+ - Uses existing `/api/cost` and `/api/budget` endpoints
147
+ - Budget limit warning when approaching threshold
148
+
149
+ ---
150
+
151
+ ### Phase 4: Hosted Infrastructure (requires infra work)
152
+ **Goal:** Multi-tenant hosted platform with user isolation.
153
+
154
+ - Per-user container orchestration (Docker or Firecracker)
155
+ - Persistent storage per workspace
156
+ - User auth (email + OAuth via existing OIDC support)
157
+ - Usage metering and billing
158
+ - Custom preview domains
159
+ - Provider failover (`loki failover`) for platform uptime
160
+
161
+ ---
162
+
163
+ ## What to Cut from v1
164
+
165
+ Based on feedback:
166
+ - Memory System Viewer (power-user debug tool, not customer-facing)
167
+ - Full Integrations page (keep GitHub only, defer Jira/Linear/Slack/Teams)
168
+ - 41-agent grid (most sessions have 1-3 agents active; show compact list instead)
169
+ - Code Review panel (let quality gates surface findings inline)
170
+ - Collaboration/multiplayer (acknowledged as future need, not v1)
171
+ - Database provisioning (out of scope for v1)
172
+
173
+ ---
174
+
175
+ ## What to Fix Before Building (bugs from competitive review)
176
+
177
+ 1. Preview only auto-refreshes on HTML/CSS/JS saves (not .py or .json)
178
+ 2. Quick Open should show all results with scrolling (remove slice(0,20) limit)
179
+ 3. File creation should optimistically update tree (no wait for API)
180
+ 4. ProjectWorkspace should be read-only for completed sessions
181
+ 5. No-HTML projects should show helpful message instead of blank preview
182
+
183
+ ---
184
+
185
+ ## Loki Features to Surface (under-leveraged)
186
+
187
+ | Feature | Where in UI | Backend |
188
+ |---------|-------------|---------|
189
+ | `loki plan` | Plan step before every build | Exists |
190
+ | `loki run <issue>` | "Import from Issue" on Home page | Exists |
191
+ | `loki review` | Right-click file -> "Review this file" | Exists |
192
+ | `loki test` | Right-click file -> "Generate tests" | Exists |
193
+ | `loki explain` | "Explain Project" button in workspace | Exists |
194
+ | `loki onboard` | Import project flow | Exists |
195
+ | `loki failover` | Auto-provider switching | Exists |
196
+ | `loki trigger` | Scheduled builds (cron) | Exists |
197
+ | `loki ci` | Quality checks on save | Exists |
198
+ | `--budget` | Cost display in header | Exists |
199
+ | `--compliance` | Compliance preset selector | Exists |
200
+
201
+ ---
202
+
203
+ ## Realistic Timeline
204
+
205
+ - **Phase 1 (Platform Shell):** 3-4 days -- sidebar, projects page, templates page, settings shell, workspace nav fix
206
+ - **Phase 2 (Enhanced Workspace):** 5-7 days -- activity panel, AI chat, mode selector, plan-before-build, preview toolbar
207
+ - **Phase 3 (Import + Deploy + Secrets):** 2-3 weeks -- needs backend work for GitHub import, deploy pipeline, secrets encryption
208
+ - **Phase 4 (Hosted Infra):** 2-3 months -- container orchestration, auth, billing, custom domains
209
+
210
+ **MVP milestone (Phase 1 + 2): ~2 weeks**
211
+
212
+ ---
213
+
214
+ ## Success Criteria (revised)
215
+
216
+ - User can go from prompt to working preview in under 3 minutes
217
+ - User can iterate via AI chat without starting a new session
218
+ - Page refresh at any point preserves full state
219
+ - User can browse all past projects and templates from sidebar
220
+ - Plan step shows cost estimate before every build
221
+ - Preview renders all relative assets correctly
222
+ - Quality gates visible during builds
223
+ - Cost tracking visible in workspace header