agentgui 1.0.456 → 1.0.457

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.
Files changed (2) hide show
  1. package/.prd +0 -428
  2. package/package.json +1 -1
package/.prd CHANGED
@@ -1,428 +0,0 @@
1
- # Tool Installation Status Management System - PRD
2
-
3
- ## OVERVIEW
4
- Replace automatic ACP startup with visual status display and one-click install/update system for gm-oc, gm-gc, gm-kilo, and gm-cc tools.
5
-
6
- ## PHASE 1: DATABASE SCHEMA CHANGES
7
- **BLOCKING**: Required before any API or UI work
8
- **DEPENDENCIES**: None
9
- **EDGE CASES**: Duplicate tool entries, concurrent install tracking, migration from existing state
10
-
11
- **1.1 Add tool_installations table**
12
- - Track each tool's installation status and metadata
13
- - Columns: id (PK), tool_id, version, installed_at, status (installed|installing|failed|not_installed), last_check_at, error_message, update_available, latest_version
14
- - Create indices on tool_id, status, last_check_at
15
- - EDGE CASE: Handle concurrent install attempts (locked row during install)
16
- - EDGE CASE: Partial failures (tool binary exists but config not found)
17
- - BOUNDARY: Support null values for tools not yet discovered
18
-
19
- **1.2 Add tool_install_history table**
20
- - Track install/update attempts for debugging
21
- - Columns: id (PK), tool_id, action (install|update|uninstall), started_at, completed_at, status (success|failed|timeout), error_message
22
- - Create index on tool_id, completed_at
23
- - EDGE CASE: Long-running installs timeout after 5 minutes
24
- - BOUNDARY: Keep last 100 records per tool
25
-
26
- ## PHASE 2: TOOL MANAGER SERVICE
27
- **BLOCKING**: Required before API endpoints work
28
- **DEPENDENCIES**: Phase 1 (schema)
29
- **LOCATION**: lib/tool-manager.js
30
- **EDGE CASES**: Network failures, npm registry timeouts, concurrent install race conditions, Windows vs Unix paths
31
-
32
- **2.1 Tool Registry**
33
- - Tracks gm-oc (opencode), gm-gc (gemini), gm-kilo (kilo), gm-cc (claude-code)
34
- - For each tool: npm package name, binary name, marker path (config dir), install command
35
- - Methods: getToolConfig(toolId), getAllTools()
36
-
37
- **2.2 Installation Status Detection**
38
- - checkToolStatus(toolId): Runs synchronously, returns {installed, version, hasConfig}
39
- - Uses fs.existsSync for binary and marker path
40
- - Fallback: Try which <binary> command to detect in PATH
41
- - EDGE CASE: Binary exists but config missing = partial install
42
- - EDGE CASE: Config exists but binary missing = orphaned config
43
- - Returns: {toolId, installed: bool, version: string|null, hasConfig: bool, timestamp}
44
-
45
- **2.3 Version Detection**
46
- - detectVersion(toolId): Runs <binary> --version or <binary> -v with 3s timeout
47
- - Parses semantic version from output (regex: \d+\.\d+\.\d+)
48
- - EDGE CASE: Tool responds slowly, timeout returns null
49
- - BOUNDARY: Caches version for 1 hour
50
-
51
- **2.4 Update Availability Check**
52
- - checkForUpdates(toolId, currentVersion): Uses npm API
53
- - Hits https://registry.npmjs.org/<pkg-name> to get latest version
54
- - EDGE CASE: Registry unreachable, network timeout (5s), returns false
55
- - EDGE CASE: Tool not published, edge releases, pre-releases skipped
56
- - Returns: {hasUpdate: bool, latestVersion: string, changelog: string|null}
57
-
58
- **2.5 Installation Execution**
59
- - install(toolId, onProgress): Executes npx --yes <pkg-name> with timeout 300s
60
- - Streams stdout/stderr to onProgress callback
61
- - Validates installation after completion:
62
- * Binary exists and is executable
63
- * Marker path (config) created
64
- * Version detectable
65
- - EDGE CASE: Partial success (binary installed but config missing) = FAILED
66
- - EDGE CASE: Process killed by timeout, cleanup child process
67
- - EDGE CASE: Concurrent install attempt on same tool, queue/lock, reject second
68
- - Returns: {success: bool, error: string|null, version: string|null}
69
-
70
- **2.6 Update Execution**
71
- - update(toolId, targetVersion, onProgress): Same as install but targets version
72
- - Validates that newer version is available before attempting
73
- - EDGE CASE: Downgrade attempts rejected
74
- - EDGE CASE: Partial downtime acceptable (old binary available during update)
75
- - Returns: {success: bool, error: string|null, version: string|null}
76
-
77
- **2.7 Database Integration**
78
- - After every status check: update tool_installations row
79
- - After every install/update: insert tool_install_history row
80
- - Clean up history to keep only 100 records per tool
81
- - EDGE CASE: Database locked (multiple processes), retry with backoff (3 tries, 100ms each)
82
- - BOUNDARY: Transaction isolation prevents dirty reads during install
83
-
84
- ## PHASE 3: API ENDPOINTS
85
- **BLOCKING**: Required before UI can function
86
- **DEPENDENCIES**: Phase 2 (tool manager)
87
- **EDGE CASES**: Race conditions on concurrent requests, timeout handling, partial failures
88
-
89
- **3.1 GET /api/tools**
90
- - Returns list of all managed tools with current status
91
- - Response: [{toolId, name, installed, version, hasConfig, hasUpdate, latestVersion, lastCheck, installing}]
92
- - No input parameters
93
- - Calls checkToolStatus() for each tool (cached, max age 5 min)
94
- - EDGE CASE: One tool check fails, return partial data with error flag for that tool
95
- - BOUNDARY: Response cached for 1 min, server-side cache
96
-
97
- **3.2 GET /api/tools/:toolId/status**
98
- - Get detailed status for single tool
99
- - Performs fresh check (no cache)
100
- - Response: {toolId, installed, version, hasConfig, hasUpdate, latestVersion, lastCheck, error}
101
- - EDGE CASE: Tool not recognized, return 404
102
- - BOUNDARY: Max 1 fresh check per tool per 5 seconds (rate limit)
103
-
104
- **3.3 POST /api/tools/:toolId/install**
105
- - Initiate tool installation
106
- - Body: {} (no input needed)
107
- - Validates: tool recognized, not already installing
108
- - Transitions tool to "installing" status in DB
109
- - Spawns install process (backgrounded, returns immediately)
110
- - Returns: {success: true, installing: true, estimatedTime: 60000}
111
- - WebSocket broadcasts: tool_install_started, then periodic tool_install_progress, then tool_install_complete/tool_install_failed
112
- - EDGE CASE: Tool already installing, return 409 Conflict
113
- - EDGE CASE: Previous install failed, allow retry
114
- - EDGE CASE: Installation fails, broadcast error, do NOT retry automatically
115
-
116
- **3.4 POST /api/tools/:toolId/update**
117
- - Initiate tool update
118
- - Body: {targetVersion: "1.2.3"} (optional, defaults to latest)
119
- - Validates: tool installed, not already installing, update available or overrideable
120
- - Transitions to "updating" status
121
- - Same background execution as install
122
- - Returns: {success: true, updating: true}
123
- - WebSocket broadcasts: tool_update_started, periodic progress, then complete/failed
124
- - EDGE CASE: Target version not available, return 400 Bad Request
125
- - BOUNDARY: Prevent concurrent update/install on same tool
126
-
127
- **3.5 POST /api/tools/refresh-all**
128
- - Force refresh status for all tools (skip cache)
129
- - Body: {}
130
- - Returns immediately, refreshes happen in background
131
- - WebSocket broadcasts: tools_refresh_started, then tools_refresh_complete with results
132
- - Response: {refreshing: true, toolCount: 4}
133
- - EDGE CASE: Multiple refresh requests collapse into single refresh batch
134
-
135
- **3.6 GET /api/tools/:toolId/history**
136
- - Get install/update history for tool
137
- - Query params: limit (default 20, max 100), offset (default 0)
138
- - Returns: [{action, status, startedAt, completedAt, error}]
139
- - EDGE CASE: Tool has no history, return empty array
140
-
141
- ## PHASE 4: UI COMPONENTS
142
- **BLOCKING**: Required before visual display works
143
- **DEPENDENCIES**: Phase 3 (API endpoints)
144
- **LOCATION**: static/js/tool-status.js
145
- **EDGE CASES**: Network failures during install, tool status state transitions, concurrent tool installs
146
-
147
- **4.1 Tool Status Component Structure**
148
- - Render per-tool block: icon + status text + action buttons
149
- - Icon: tool-specific (Claude Code, OpenCode, Gemini, Kilo logo)
150
- - Status text: "Installed v1.2.3" | "Update available v1.3.0" | "Not installed" | "Installing..." | "Failed"
151
- - Action buttons: based on state
152
- * Not installed: [Install] button
153
- * Installed, no update: [Check Updates] button
154
- * Update available: [Update] button
155
- * Installing/Updating: [Cancel] button (grayed out) + progress bar
156
- * Failed: [Retry] + [Details] buttons
157
-
158
- **4.2 Tool Status Display**
159
- - Location: Agent selector panel or dedicated "Tools" tab
160
- - Grid layout: 2x2 or 1x4 depending on viewport
161
- - Each tool card: 120x120px, icon center, status below, clickable for details
162
- - Color coding: green (installed), yellow (update available), red (failed), gray (not installed), blue (installing)
163
- - EDGE CASE: Tool list changes, reflect immediately
164
- - BOUNDARY: Responsive design, stack on mobile
165
-
166
- **4.3 Tool Status Modal/Dropdown**
167
- - Click tool card to expand details
168
- - Shows: current version, latest version, last check time, install history (last 3)
169
- - Changelog preview (if available from NPM)
170
- - Action buttons based on state
171
- - EDGE CASE: Modal closes when install completes
172
- - BOUNDARY: Auto-refresh status every 5 sec while modal open
173
-
174
- **4.4 Progress Indicator**
175
- - During install/update: progress bar + percentage + estimated time
176
- - Updates every 500ms via WebSocket
177
- - Shows: bytes downloaded, install speed, ETA
178
- - EDGE CASE: Slow network, ETA adjusts as data comes in
179
- - EDGE CASE: Network interrupted, show "Connection lost, retrying..."
180
-
181
- **4.5 Error Display**
182
- - Failed install shows error message (last 200 chars)
183
- - Link to full error log (tool_install_history)
184
- - "Report to plugforge" button opens GitHub issue template
185
- - EDGE CASE: Very long error, truncate with "Show full"
186
-
187
- **4.6 WebSocket Integration**
188
- - Subscribe to tool_install_started, tool_install_progress, tool_install_complete, tool_install_failed
189
- - Update component state in real-time
190
- - Broadcast messages: {type, toolId, data: {progress, status, error}}
191
- - EDGE CASE: WebSocket disconnects during install, UI shows "Offline", re-checks on reconnect
192
-
193
- ## PHASE 5: STARTUP & INITIALIZATION
194
- **BLOCKING**: Required before server starts
195
- **DEPENDENCIES**: Phase 1 (schema), Phase 2 (tool manager)
196
- **EDGE CASES**: First startup, corrupted DB, missing tools
197
-
198
- **5.1 Database Migration**
199
- - On server startup, run initializeToolInstallations()
200
- - Creates tool_installations table if not exists
201
- - For each tool (oc, gc, kilo, cc): insert or update row with current status
202
- - Sets initial last_check_at to now
203
- - EDGE CASE: Database locked, retry with backoff
204
- - BOUNDARY: No blocking waits, async init
205
-
206
- **5.2 Initial Status Check**
207
- - After DB migration, check status of all tools
208
- - Populates installed, version, hasConfig for each
209
- - Updates DB rows
210
- - This happens on server startup, doesn't block listener
211
- - EDGE CASE: One tool check fails, continue with others
212
-
213
- **5.3 Disable Auto-Startup**
214
- - Modify acp-manager.js: comment out or remove call to startAll()
215
- - acp-manager.js still loads, still provides ensureRunning() for on-demand
216
- - ACP tools start only when user creates conversation with that agent
217
- - EDGE CASE: User never installs ACP tool, ensureRunning() returns null gracefully
218
-
219
- **5.4 Agent Discovery (unchanged)**
220
- - Continues to scan agents as before (claude-code, gemini, opencode, kilo, custom)
221
- - Agent icons/names display even if not installed
222
- - On-demand startup via claude-runner still works
223
- - BOUNDARY: Fallback graceful if tool not installed
224
-
225
- ## PHASE 6: PLUGFORGE INTEGRATION
226
- **BLOCKING**: Only needed if install fails
227
- **DEPENDENCIES**: Phase 4 (error display)
228
- **EDGE CASES**: Network offline, GitHub API rate limited, issue template rendering
229
-
230
- **6.1 Issue Template Generation**
231
- - On install failure, "Report to plugforge" button opens issue
232
- - Template includes:
233
- * Tool name (gm-oc, gm-gc, etc.)
234
- * AgentGUI version (from package.json)
235
- * System info (OS, Node version)
236
- * Error message (full text)
237
- * Install attempt timestamp
238
- * Steps to reproduce (npm install <pkg>)
239
- - Opens: https://github.com/Anthropic-Engineering/plugforge/issues/new?title=...&body=...
240
-
241
- **6.2 GH Actions Monitoring (Future)**
242
- - Not implemented in Phase 1
243
- - Placeholder for future: monitor plugforge + affected repos for CI/CD status
244
- - Notify user when fix deployed
245
-
246
- ## PHASE 7: DISABLE CURRENT AUTO-STARTUP
247
- **BLOCKING**: Required to avoid conflicts
248
- **DEPENDENCIES**: Phase 3 (API endpoints work)
249
-
250
- **7.1 Modify server.js**
251
- - Remove or comment out: await startACPTools()
252
- - Keep: ACP_TOOL_CONFIGS export, getACPStatus(), queryACPModels() (used by on-demand start)
253
- - ACP managers can still be started on-demand via ensureRunning()
254
-
255
- **7.2 Modify acp-manager.js startAll()**
256
- - Currently starts health check timer
257
- - Change to just set up timer without starting processes
258
- - Processes start only when ensureRunning() called
259
- - Processes auto-stop after 2 min idle (existing behavior)
260
-
261
- ## EDGE CASES & ERROR CONDITIONS
262
-
263
- **Network Failures**
264
- - Install timeout (5 min): kill process, mark as FAILED, show "timeout" error
265
- - Registry unreachable: mark update check as failed, retry next day
266
- - Mid-install network loss: show "lost connection", allow retry
267
-
268
- **Concurrent Operations**
269
- - Two install requests same tool: queue second, reject with 409
270
- - Install + update simultaneously: prevent, return 409
271
- - Install + agent startup: allow, both run independently
272
-
273
- **Partial Failures**
274
- - Binary installed but config missing: FAILED (must have both)
275
- - Config installed but binary missing: FAILED
276
- - Version check fails but binary exists: mark as INSTALLED with version=null
277
-
278
- **System Limits**
279
- - Disk full during install: capture error, cleanup, mark FAILED
280
- - Process limit exceeded: mark FAILED, suggest restart
281
- - Permission denied: mark FAILED, suggest sudo/admin
282
-
283
- **Recovery Paths**
284
- - Failed install: user can click Retry immediately
285
- - Failed update: user can click Retry, falls back to previous version if timeout
286
- - Orphaned config: fresh install overwrites or removes
287
- - Tool uninstalled externally: next status check catches, UI updates
288
-
289
- **Race Conditions**
290
- - Tool deleted while "Installing": install completes but binary gone, next check catches mismatch
291
- - Database locked during install: retry with exponential backoff
292
- - Concurrent status checks: served from cache, skip if check in progress
293
-
294
- ## VERIFICATION & TESTING
295
-
296
- **Success Paths (to verify with real execution)**
297
- - [ ] Tool not installed initially
298
- * Call GET /api/tools, see installed=false
299
- * Click Install button
300
- * See progress 0%
301
- * Wait for completion
302
- * See installed=true, version detected
303
- * Verify binary exists in PATH
304
- * Verify config marker created
305
-
306
- - [ ] Tool update available
307
- * Have old version installed (or mock it)
308
- * Call GET /api/tools/:toolId/status
309
- * See hasUpdate=true, latestVersion > version
310
- * Click Update button
311
- * See progress tracking
312
- * Completion, verify new version
313
- * Verify old binary replaced
314
-
315
- - [ ] Multiple tools install concurrently
316
- * Initiate install of 4 tools simultaneously
317
- * See all show "Installing"
318
- * See all complete (in any order)
319
- * Verify all installed correctly
320
-
321
- **Failure Scenarios (to verify)**
322
- - [ ] Install timeout
323
- * Mock slow install (delay response)
324
- * Wait 5 min
325
- * See status: FAILED with "timeout"
326
- * Click Retry, succeeds
327
-
328
- - [ ] Install fails (NPM error)
329
- * Install non-existent package (npm --yes @fake/package)
330
- * See FAILED status with error message
331
- * Error message shows "not found" or NPM error
332
-
333
- - [ ] Concurrent install same tool
334
- * Send POST /api/tools/gm-oc/install twice rapidly
335
- * First returns 200
336
- * Second returns 409 Conflict
337
- * Only one process runs, not two
338
-
339
- - [ ] Network offline during install
340
- * Start install
341
- * Kill network
342
- * See connection error in progress
343
- * Retry, succeeds (if network restored)
344
-
345
- **Edge Cases**
346
- - [ ] Binary exists, config missing (partial install)
347
- * Manually create binary in PATH, delete config
348
- * Refresh status
349
- * See installed=false (because hasConfig=false)
350
- * Install again, succeeds
351
-
352
- - [ ] Very long error message
353
- * Trigger error with 1000+ char message
354
- * UI truncates to 200 chars
355
- * "Show full" link available
356
- * Click shows complete error
357
-
358
- - [ ] Installation interrupted (user closes app)
359
- * Start install
360
- * Restart server while installing
361
- * Server recovers, shows FAILED or resume state
362
-
363
- ## BOUNDARY CONDITIONS
364
-
365
- - Max file size for tool_install_history: keep 100 records per tool, auto-prune oldest
366
- - Max time for install: 300 seconds, timeout and mark FAILED
367
- - Max time for version check: 3 seconds, timeout returns null
368
- - Max time for update check (registry): 5 seconds, timeout returns {hasUpdate: false}
369
- - Cache validity: status 5 min, version 1 hour, updates 1 day
370
- - Concurrent installs per tool: 1 (serialize others)
371
- - History retention: 100 per tool, then prune oldest
372
- - Error message max length: 1000 chars (truncate in DB)
373
-
374
- ## INTEGRATION POINTS
375
-
376
- - server.js: Register 5 new API endpoints, disable startACPTools()
377
- - database.js: Add schema migrations for 2 new tables
378
- - acp-manager.js: Lazy-load ACP tools, keep on-demand support
379
- - static/js/client.js: Initialize tool-status component, listen to WebSocket events
380
- - static/index.html: Add Tools tab or panel
381
- - lib/tool-manager.js: NEW, handles all tool logic
382
-
383
- ## SUCCESS CRITERIA
384
-
385
- 1. All 5 endpoints working, tested with real installations
386
- 2. UI displays all 4 tools with correct status
387
- 3. Install button works, validates completion with version check
388
- 4. Update detection works (at least one tool has update available to test)
389
- 5. Error handling shows meaningful messages
390
- 6. WebSocket broadcasts progress in real-time
391
- 7. No auto-startup of ACP tools on server start
392
- 8. ACP tools start on-demand when user creates conversation
393
- 9. All edge cases tested: timeouts, failures, concurrent ops
394
- 10. Database schema migrations run on first startup
395
- 11. All code under 200 lines per file
396
- 12. No mocks, no test files, all real execution testing
397
-
398
- ## DEPENDENCIES & BLOCKING
399
-
400
- - Phase 1 blocks everything else (schema must exist)
401
- - Phase 2 blocks phases 3, 5 (tool manager must work)
402
- - Phase 3 blocks phase 4 (API must be ready before UI)
403
- - Phase 5 must complete before server starts accepting traffic
404
- - Phase 6 is independent, can be last
405
- - Phase 7 must happen after Phase 3 (ensure API works before disabling auto-start)
406
-
407
- ## TIMELINE ESTIMATE
408
-
409
- - Phase 1 (schema): 5-10 min
410
- - Phase 2 (tool manager): 20-30 min
411
- - Phase 3 (API): 15-20 min
412
- - Phase 4 (UI): 20-30 min
413
- - Phase 5 (startup): 10-15 min
414
- - Phase 6 (plugforge): 5-10 min
415
- - Phase 7 (disable auto-startup): 5 min
416
- - Testing & validation: 20-30 min
417
- - Total: ~100-150 min
418
-
419
- ## DELIVERABLES
420
-
421
- 1. lib/tool-manager.js - Tool status, install, update logic
422
- 2. Modified database.js - New schema migrations
423
- 3. Modified server.js - New API endpoints, disabled auto-startup
424
- 4. Modified acp-manager.js - Lazy-load support
425
- 5. Modified static/index.html - Tools tab/panel added
426
- 6. static/js/tool-status.js - UI component
427
- 7. Modified static/js/client.js - Integration
428
- 8. All tested with real execution, witnessed working
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.456",
3
+ "version": "1.0.457",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",