18 Commits
Author SHA1 Message Date
B Harper accdbdc602 Fix tool call timeout by implementing chunked response with keepalive
- Added special handling for HumanAgent_Chat tool calls to prevent Node.js undici 5-minute timeout
- Send HTTP headers immediately with Transfer-Encoding: chunked to stop headersTimeout
- Implement 4-minute keepalive mechanism writing space character to reset bodyTimeout
- Allows indefinite wait times for human responses in tool calls
- Tested successfully with 35+ minute wait time without timeout

Resolves issue where VS Code MCP client would cancel tool calls after ~5-6 minutes
with error 'The user cancelled the tool call' due to undici hardcoded timeouts.
2025-11-19 15:32:59 +11:00
B Harper c2129cb3ed v0.0.12: Add quick replies, remove timeout feature, keep textarea enabled, improve error handling 2025-11-18 13:34:39 +11:00
B Harper ea62ebfbf3 Add tab notification features and timeout improvements 2025-11-01 17:37:01 +11:00
B Harper 464f4e0bf4 Add GitHub Actions workflow for automated publishing and clean up unnecessary files 2025-10-26 18:14:13 +11:00
B Harper 8777d3b928 Add GPL-3.0 LICENSE and add untracked README files 2025-10-26 17:48:36 +11:00
B Harper 94d004338a Implement version-based cache invalidation for MCP tool definitions
- Added serverVersion property to McpServerDefinitionProvider that updates on override reloads
- VS Code now refreshes cached tool definitions when server version changes
- Fixed tool override caching issue where old descriptions persisted
- Removed unnecessary delay in notification system
- Added debug endpoint /debug/tools for inspecting server-side tool definitions

Progress: Startup override loading now works correctly, investigating override reload hang in VS Code
2025-10-26 16:40:44 +11:00
B Harper 60ea857b54 Fix SSE connection conflicts between webview and extension
- Added separate /mcp-tools endpoint for VS Code extension MCP protocol
- Maintained /mcp endpoint for webview SSE connections (heartbeats, messages)
- Eliminated competing SSE connections that caused message delivery failures
- Enhanced SSE connection health monitoring with detailed diagnostics
- Added connection state management to prevent race conditions
- Fixed sendToSession() to use proper health checking instead of raw writes
- Improved logging to track connection conflicts and message delivery
- Maintains proper session separation between different VS Code workspaces

This resolves the issue where VS Code webview received heartbeats but not
tool call messages due to competing SSE connections overwriting each other.
2025-10-26 15:36:26 +11:00
B Harper 2de7ad2db1 Add comprehensive documentation - README.md and ReadMeDev.md
- README.md: Clean user-facing documentation with truthful feature descriptions
- ReadMeDev.md: Technical developer documentation with architecture details
- No exaggeration or marketing fluff - just what we actually built
- Covers real features: VS Code interface, MCP server, tool overrides, web interface
- Includes honest installation, configuration, and troubleshooting sections
2025-10-25 11:52:58 +11:00
B Harper d846f0895b Implement VS Code native MCP event system for automatic tool refreshing
- Added HumanAgentMcpProvider class with onDidChangeMcpServerDefinitions event
- Registered MCP provider with VS Code lm.registerMcpServerDefinitionProvider
- Added mcpServerDefinitionProviders contribution point to package.json
- Implemented startup event firing when override files exist
- Fixed session name loading timing by moving after server startup with retry
- Chat webview now fires MCP events when override files are reloaded
- VS Code Configure Tools will now automatically refresh tool descriptions
2025-10-25 11:29:05 +11:00
B Harper 59be50e9d9 Fix VS Code MCP tool override descriptions by adding sessionId to URL
- Modified mcpConfigManager.ts to include sessionId in MCP URL configuration
- Fixed server.ts URL parsing to handle query parameters properly
- Enhanced reloadOverrideFile to trigger MCP notifications
- VS Code now shows custom tool descriptions from HumanAgentOverride.json
2025-10-24 20:06:49 +11:00
B Harper 068e745460 Fix web interface JavaScript error and complete message formatting
- Fixed JavaScript syntax error in escapeHtml comment that was breaking web interface
- Completed message formatting fix with CSS white-space: pre-wrap
- Fixed VS Code chat history synchronization by removing local message arrays
- Added unified message loading via server API for both VS Code and web
- Fixed display labels to show 'You (VS Code)' and 'You (Web)' consistently
- Implemented autoAppendEnabled logic to properly respect enable/disable setting
- Added default auto-append text for HumanAgent_Chat tool in templates
- Enhanced auto-append formatting with period + space and 'Appended:' prefix
- Added MCP tool notification method for dynamic tool discovery
- All web interface and VS Code chat functionality now working correctly
2025-10-24 18:39:50 +11:00
B Harper a0333d2dbf Add session name persistence using VS Code globalState
EXACTLY as requested - persist session names same way as session IDs:

 Session names saved to context.globalState when user names chat in VS Code
 Session names restored on startup and sent to server automatically
 Uses same workspace-based key system as session ID persistence
 Web interface will now show friendly names after VS Code restart

Workflow: VS Code 'Name This Chat' → persist to globalState → restore on startup → web shows friendly name

No web interface changes needed - server already has name display logic
2025-10-24 13:52:18 +11:00
B Harper 100508581e Implement clean request state management system
MAJOR IMPROVEMENT: Replace confusing 'human-agent-request' event with clean 'request-state-change' SSE system

 NEW: request-state-change events for both web and VS Code interfaces
 CLEAN: Separate message display (via ChatManager) from input control (via request state)
 CONSISTENT: Both interfaces get same state updates via SSE
 ELIMINATED: Duplicate message display issues
 PROPER: Input enabling/disabling and 'waiting for response' indicators

States: 'waiting_for_response' → 'completed'
Benefits: Clean separation of concerns, no more mixed event types causing confusion

Ready for testing: VS Code input should enable when AI asks questions, disable when complete
2025-10-24 13:40:34 +11:00
B Harper cac8d40b66 SUCCESSFUL: Complete message synchronization between web and VS Code
 FIXED: AI messages now stored in ChatManager when HumanAgent_Chat tool is called
 FIXED: User messages stored with source tracking (web vs vscode)
 FIXED: Eliminated redundant /chat endpoint - only /response endpoint needed
 CONFIRMED: API shows correct message flow: AI → User → AI with proper storage

Key insight: AI communicates BY calling HumanAgent_Chat tool, not via responses afterward.

Message storage working perfectly. Only remaining issue: web interface display showing duplicates (storage is correct per curl verification)
2025-10-24 13:26:57 +11:00
B Harper bab4f4138a Fix AI response storage and add message source tracking
Key changes:
- Fixed sessionId detection in HumanAgent_Chat tool (use sessionToUse instead of params.sessionId)
- Added source field to ChatMessage interface for tracking web vs vscode origin
- Updated web interface to show message source in headers
- Removed incorrect storage of human responses as assistant messages
- AI responses need proper capture mechanism (not human answers stored as AI responses)

Issue: Still need to eliminate redundant /chat endpoint causing potential duplicates
2025-10-24 13:16:37 +11:00
B Harper b5d0190474 Debug AI response storage issue
Found root cause: HumanAgent_Chat tool only stores AI responses when params.sessionId exists,
but sessionId detection may be failing. Only user messages are being stored in ChatManager,
causing web interface to show incomplete conversation history.

Next: Fix sessionId detection and add message source tracking.
2025-10-24 11:55:42 +11:00
B Harper 0fcc0a7b0e Eliminate duplicate pendingHumanRequests system - use ChatManager only
- Removed pendingHumanRequests Map completely
- Added findPendingRequest() method to ChatManager for cross-session lookups
- Created minimal requestResolvers Map only for Promise resolve/reject functions
- Replaced all 9 calls to old system with ChatManager equivalents:
  * /response endpoint now uses ChatManager.findPendingRequest()
  * Timeout cleanup uses ChatManager.removePendingRequest()
  * Request storage uses ChatManager.addPendingRequest() only
  * respondToHumanRequest() and resolvePendingRequest() updated
- No more duplicate data storage - single source of truth in ChatManager
- All functionality preserved, cleaner architecture
2025-10-24 11:44:38 +11:00
B Harper dc1ee54ecd Fix session ID mapping: VS Code conversation IDs now map to registered sessions
- Added conversationToSession mapping to link VS Code conversation IDs to registered session IDs
- Updated handleToolCall to extract session ID from _meta.vscode.conversationId
- Auto-maps VS Code conversations to first available registered session
- Both VS Code and web interface now use same registered session ID
- Fixes 'No pending AI request found' error in web interface
2025-10-24 11:17:46 +11:00