Commit Graph

33 Commits

Author SHA1 Message Date
Artur Do Lago d211f20333 fix: MCP reconnection, type safety, and bug fixes
- Add MCP reconnection functionality (isHealthy, reconnect, reconnectAll, healthCheckAndReconnect)
- Add auto-reconnect on MCP tool fetch failure
- Add MCP reconnection API endpoints (/mcp/:name/reconnect, /mcp/reconnect-all, /mcp/health-check)
- Fix EventEmitter memory leak warning in GlobalBus
- Fix silent error swallowing in cache cleanup
- Fix type safety issues in processor.ts, transform.ts, prompt.ts
- Add debug status command (agent-core debug status)
- Add reload.sh script for daemon management
- Add comprehensive docs (OPS.md, BUGS.md)
- Update CLAUDE.md with ops warning
2026-01-20 13:12:09 +01:00
Artur Do Lago ab9e90fcea chore: cleanup unused and debug files
Removed:
- packages/enterprise/test-debug.ts (debug script)
- packages/agent-core/src/util/scrap.ts (unused utility)
- .agent-core/tool/*.txt (tool outputs)

Added:
- docs/ALPHA_ROLLBACK_PLAN.md (launch documentation)
- docs/ENVIRONMENT_VARIABLES.md (configuration docs)
- docs/LOGGING.md (logging documentation)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 13:10:48 +01:00
Artur Do Lago da5c60ba9d docs: archive outdated tech debt documents
These documents from Jan 11 don't reflect fixes applied:
- share.ts event subscription leak: fixed
- canvas-tool.ts error logging: fixed
- @ts-ignore claims (40+): actual count is 19
- console.log in core: mostly appropriate for CLI/MCP

Move to docs/archive/ to prevent chasing resolved issues.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 13:09:32 +01:00
Artur Do Lago 1a13f85092 chore: pre-alpha release preparation v0.1.20250112
Stability:
- Fix share.ts multiple initialization race condition
- SSE keepalives already properly tied to connection lifecycle
- Gateway supervisor has proper shutdown handling

Branding:
- Replace "OpenCode" with "agent-core" in user-facing CLI messages
- Update uninstall, permission dialogs, and upgrade notifications

Release:
- Version bump to 0.1.20250112 across all packages
- Remove unused devDependencies (@babel/core, why-is-node-running)
- Remove duplicate dependencies (zod-to-json-schema, @standard-schema/spec)
- Update ALPHA_TEST_STATUS.md (690/691 tests passing)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 13:09:32 +01:00
Artur Do Lago bc57ddff43 security: comprehensive pre-alpha and beta security fixes
Pre-Alpha Fixes (10 items):
- Fix credential file permissions in calendar.ts (mode: 0o600)
- Add socket close handler in ipc-server.ts (memory leak prevention)
- Add event unsubscribe in daemon.stop() (memory leak prevention)
- Wrap Qdrant init with retry logic and graceful degradation
- Fix ALWAYS-ON-PERSONAS.md gateway architecture documentation
- Remove legacy spawn('claude') in tiara executor-sdk.ts
- Filter environment variables via safe-env.ts utility
- Add error boundary around IPC socket writes
- Update tiara README.md and INDEX.md version references
- Create zee gateway external-gateway.md documentation

Beta Security Fixes (6 items):
- CRITICAL: Fix command injection via persona parameter validation
- HIGH: Fix terminal escape sequence injection in setPaneTitle
- HIGH: Fix command escaping in sendCommand and canvas manager
- HIGH: Add secret redaction for copilot auth logging
- MEDIUM: Fix echo -e ANSI escape injection in status display
- MEDIUM: Strengthen prompt injection defense in fact-extractor

New Utilities:
- src/util/safe-env.ts: Environment variable filtering for child processes
- src/util/shell-escape.ts: Shell escaping, persona validation, secret redaction

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:57:47 +01:00
Artur Do Lago 8c06aa3707 fix: technical debt cleanup (Sprints 6-10)
Sprint 6 - Gateway Stability:
- Add exponential backoff to Telegram poll loop
- Fix process timeout with SIGKILL
- Add fetch timeouts with AbortController to all HTTP calls
- Fix WhatsApp init race condition
- Add WhatsApp event listener cleanup tracking

Sprint 7 - Error Visibility:
- Fix silent error catches in share, canvas-tool, council, qdrant
- Replace console.log with structured logging across surface, browser, mcp
- Add JSON validation with zod for config and API responses

Sprint 8 - Type Safety:
- Define LogMeta type to replace Record<string, any>
- Add WhatsApp type guards (isChatMessage, isValidPersona)
- Create util/net.ts with shared helpers

Sprint 9 - Test Coverage:
- Create WhatsApp API mock for testing
- Add WhatsApp gateway tests (13 tests passing)
- Export mocks from test/mock/index

Sprint 10 - Debug Ergonomics:
- Fix fact extraction getSessionContent to retrieve actual messages
- Enhance debug memory search with semantic search
- Add debug errors command with follow mode

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:41:11 +01:00
Artur Do Lago 16f52f9b2f docs: mark plugin marketplace as complete in roadmap
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:39:20 +01:00
Artur Do Lago da907e3749 docs: mark voice output (TTS) as complete in roadmap
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:39:20 +01:00
Artur Do Lago 8a2440d640 feat(canvas): add visual reasoning canvas types
Add three new canvas kinds for visual reasoning in WezTerm:
- diagram: flowcharts, architecture diagrams with box/diamond/oval nodes
- graph: nodes and edges with colors and weights (knowledge graphs)
- mindmap: hierarchical tree view for thinking/planning

Canvas features:
- ASCII art rendering with ANSI colors
- Works alongside nvim/LSP in WezTerm panes
- 67% width ratio (Claude:Canvas = 1:2)
- Reusable pane management

Updated tools with new kinds and config documentation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:39:20 +01:00
Artur Do Lago d627583dc4 docs: mark technical debt items as complete in roadmap
All Phase 7 technical debt items completed:
- opencode references consolidated
- Type safety for persona configs
- Provider transform tests verified (3200+ lines)
- Auth E2E tests added (44 tests)
- Auth storage paths consolidated

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:39:20 +01:00
Artur Do Lago a3ff063bcc feat(api): complete Phase 6 cross-platform integration
Add comprehensive cross-platform APIs for web/mobile integration:

Server endpoints:
- GET /sync?since=<ts> - Delta sync for offline clients
- GET /personas - List personas with capabilities and gateway status
- GET /themes - List available themes (built-in + persona-specific)
- GET /preferences/theme - Get current theme
- PATCH /preferences/theme - Set theme

Telegram gateway:
- Add voice note transcription support via configurable CLI
- Download voice/audio files from Telegram API
- Transcribe using {{MediaPath}} template command

Documentation:
- Update CROSS-PLATFORM.md with all new API endpoints
- Mark Phase 6 as complete in ROADMAP.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:39:20 +01:00
Artur Do Lago 3cb5fe1f6f feat(api): add cross-platform integration APIs for Phase 6
- Add SSE endpoints for real-time session sync:
  - GET /events - global event stream for all sessions
  - GET /session/:id/events - per-session event stream
  - Events: session.created/updated/deleted, message.updated, todo.updated, status changes
  - 30-second keepalive heartbeat

- Add session handoff API:
  - POST /session/:id/handoff - prepare session for transfer to another platform
  - Returns session context, last message, todos, and deep link URL
  - Supports: mobile, web, cli, telegram, whatsapp targets

- Add unified notification endpoint:
  - POST /notify - send notifications across platforms
  - Supports Telegram and WhatsApp broadcast
  - Includes deep linking to sessions

- Add docs/CROSS-PLATFORM.md with:
  - Architecture overview
  - API documentation
  - Integration patterns for mobile/web
  - Deep linking scheme (agentcore://)
  - Offline support guidance

- Update ROADMAP.md marking Phase 6.2 as complete

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:37:35 +01:00
Artur Do Lago 4e08a34ff1 feat(sync): complete Phase 5 upstream sync infrastructure
- Add .github/workflows/upstream-sync.yml for weekly upstream checks
  - Scheduled weekly on Mondays
  - Manual trigger with optional PR creation
  - Conflict detection in workflow summary
- Add scripts/validate-sync.sh for post-merge validation
  - Checks critical persona files exist
  - Validates agent-core naming preserved
  - Verifies persona themes registered
  - TypeScript compilation check
- Update ROADMAP.md marking Phase 5 as complete
- Remove Electron/browser extension from backlog (TUI is our desktop app)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:34:57 +01:00
Artur Do Lago 58c09c52c4 feat(sync): add upstream sync infrastructure for Phase 5
- Add scripts/check-upstream.sh for tracking upstream OpenCode releases
- Add scripts/sync-upstream.sh for merging/rebasing upstream changes
- Create patches/agent-core/ structure for documenting divergences
- Add docs/UPSTREAM-SYNC.md with comprehensive sync guide
- Update ROADMAP.md with Phase 5.1 progress and Phase 6 cross-platform plan

Currently 82 commits ahead, 23 behind upstream (sst/opencode dev branch).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:34:57 +01:00
Artur Do Lago f87be4c23e docs: mark Phase 4 TUI Improvements as complete
All Phase 4 items implemented:
- 4.1 Model Selection: favorites, recents, auth indicators, cost display
- 4.2 Agent Experience: themes, persistent state, delegation
- 4.3 Conversation: compaction, branching, export

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:34:57 +01:00
Artur Do Lago 983e17b985 feat(tui): add visual branch tree and breadcrumb navigation
- Add Branches section to sidebar showing parent/siblings/children
- Clickable branch items to navigate between related sessions
- Add breadcrumb trail in header showing session ancestry
- Clickable ancestors to jump up the session tree

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:34:57 +01:00
Artur Do Lago 3b8d35c021 feat(tui): add agent-specific themes and delegation command
- Add `theme` field to agent schema for per-persona themes
- Auto-switch theme when changing agents
- Configure persona themes: Zee (cobalt2), Stanley (matrix), Johny (rosepine)
- Add "Delegate to persona" command (<leader>d) to prepend @persona to prompt
- Create DialogDelegation component for persona selection

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:33:03 +01:00
Artur Do Lago 44ecdde80c feat(tui): add provider auth status indicators to model dialog
Shows ✗ for expired and △ for expiring tokens next to provider names
in favorites, recent, and all providers sections.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:31:57 +01:00
Artur Do Lago 86269991b8 docs: add configuration consolidation architecture
Document the shared configuration architecture between agent-core and zee:

- Shared primitives in src/config/shared.ts
- Architecture overview showing ownership patterns
- Key patterns for config, browser, memory, and sessions
- Migration path for zee to import shared types
- Current status and future work

This serves as a reference for the consolidation work and guides
future development on the shared configuration layer.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:30:39 +01:00
Artur Do Lago 02de27f7f2 docs(roadmap): update Phase 4 status
Mark existing TUI improvements as complete:
- Favorites system in model selector
- Recently used models tracking
- Cost display (Free badge)
- Persistent agent state via ContinuityManager
- Better compaction summaries via continuity.ts

Remaining Phase 4 items:
- Provider status indicators
- Agent-specific themes/colors
- Agent handoff
- Conversation branching/export

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:30:39 +01:00
Artur Do Lago 35b5d7a311 docs(roadmap): update Phase 3 status - infrastructure mostly complete
Mark Phase 3.1 Memory System as COMPLETE:
- Qdrant vector storage with full CRUD
- MemoryStore high-level API
- BGE-M3 embeddings via vLLM
- ContinuityManager for session persistence
- Cross-persona memory sharing with namespaces

Mark Phase 3.2 Orchestration as COMPLETE:
- Orchestrator with full worker lifecycle
- WezTerm pane management
- Tiara/SPARC integration
- DroneWaiter for async completion
- Fact extraction hooks

Remaining: MCP servers for external tool exposure

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:30:39 +01:00
Artur Do Lago ed54ff5801 feat(johny): add domain tools and update roadmap
Add Johny learning system domain tools:
- johny:study - Study session management
- johny:knowledge - Knowledge graph operations
- johny:mastery - Mastery level tracking
- johny:review - Spaced repetition reviews
- johny:practice - Practice problem management

Tools bridge to Python CLI via spawnSync for:
- Knowledge graph (topic DAG with prerequisites)
- Mastery tracking (6 levels: Unknown → Fluent)
- Spaced repetition (Ebbinghaus decay)
- FIRe (Fractional Implicit Repetition)

Update roadmap to mark Phase 2.3 Johny as COMPLETE.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:30:39 +01:00
Artur Do Lago 91263c6c78 docs: add project roadmap
Covers:
- Phase 1: Foundation (providers, config)
- Phase 2: Personas (Zee, Stanley, Johny features)
- Phase 3: Shared infrastructure (Qdrant, orchestration)
- Phase 4: TUI improvements
- Phase 5: Upstream sync

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:30:39 +01:00
Artur Do Lago a02bfd2c10 fix(config): consolidate providers and agent definitions
- Disable google-vertex and google-vertex-anthropic (redundant with Antigravity)
- Remove non-working antigravity provider config
- Use built-in antigravity-* models from provider.ts
- Add zee, stanley, johny agent definitions
- Update compaction to use google/antigravity-gemini-3-flash
- Update johny.md to use google/antigravity-claude-opus-4-5-thinking
- Remove top_p from agent files (handled by ProviderTransform)
- Add docs/PROVIDERS.md with provider setup documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:30:39 +01:00
Artur Do Lago 5f046fcaeb docs: add naming convention - never use 'opencode' in new code
Users must be able to run both agent-core and OpenCode without
confusion. All new code, docs, and user-facing text should use
'agent-core' naming instead of 'opencode'.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:26:58 +01:00
Artur Do Lago 862a3c1961 feat(gateway): add WhatsApp gateway for remote access
- New WhatsApp gateway using whatsapp-web.js
- QR code authentication on first run
- Session persistence across restarts
- Intent-based persona routing (same as Telegram)
- Phone number allowlist support
- Integrated into daemon with --whatsapp flag

Usage:
  opencode daemon --whatsapp --port 4567

Note: Requires whatsapp-web.js and qrcode-terminal packages.
Dynamic imports allow graceful failure if not installed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:26:58 +01:00
Artur Do Lago 38fd95f15b feat(tui): add startup check for pending todos across sessions
Phase 0.3 completion:
- Show toast on TUI startup if any sessions have incomplete todos
- Display count: "◐ N pending todos in M sessions"
- Update roadmap: mark Phase 0 as Complete

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:26:58 +01:00
Artur Do Lago 40670f7cff feat(tui): improve prompt hint for incomplete todos
- Filter out cancelled todos (consistency with other implementations)
- Update display to use ◐ symbol: "◐ N pending · task..."
- Mark Phase 0.2 TUI Integration as complete in roadmap

The prompt hint was already implemented, this commit improves it
for consistency with the session list indicator.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:26:58 +01:00
Artur Do Lago 2cc1a2df88 docs: mark backend todo reminder as complete in roadmap
The todo continuation reminder was already implemented in prompt.ts
at insertReminders() (lines 1180-1219). Updates roadmap to reflect this.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:26:58 +01:00
Artur Do Lago 1b815538be feat(tui): add toast notification for incomplete todos when switching sessions
When switching between sessions in the TUI:
- Shows toast warning with count of incomplete todos
- Session list displays ◐{count} indicator for sessions with pending work

This helps users track unfinished tasks across sessions.

Updates roadmap Phase 0.2 TUI Integration status.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:26:58 +01:00
Artur Do Lago 47d3e7ef9a feat(branding): rename package to agent-core and configure personas
- Rename packages/opencode to packages/agent-core
- Update bin entry from opencode to agent-core
- Set default_agent to "zee" for persona-first UX
- Update terminal title to show current persona name
- Fix persona colors:
  - Zee: #2563EB (blue)
  - Stanley: #059669 (emerald green)
  - Johny: #DC2626 (red)
- Update all documentation and build script references
- Update root package.json name and dev script

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:05:26 +01:00
Artur Do Lago 240e989e8f feat(daemon): add lifecycle hooks and WezTerm orchestration (Phase 4-5)
Phase 4: Tiara Hook Integration
- Add lifecycle hooks module (src/hooks/lifecycle.ts)
- Daemon lifecycle hooks: start, ready, shutdown
- Session lifecycle hooks: start, restore, end, transfer
- Todo lifecycle hooks: continuation, completed, blocked
- Integrate hooks with daemon startup/shutdown
- Integrate hooks with Telegram gateway for session events

Phase 5: WezTerm Visual Orchestration
- Add WezTerm orchestration module (src/orchestration/wezterm.ts)
- Display detection (X11 via DISPLAY, Wayland via WAYLAND_DISPLAY)
- Status pane showing daemon health, services, sessions
- Session pane management API (create/close/focus)
- Graceful degradation when no display available
- CLI options: --wezterm, --wezterm-layout
- Integration with lifecycle hooks for auto-updates

Also includes:
- Session persistence module (src/session/persistence.ts)
- Telegram gateway (src/gateway/telegram.ts)
- Daemon CLI command (src/cli/cmd/daemon.ts)
- Systemd service files (scripts/systemd/)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 11:54:24 +01:00
Artur Do Lago bb5857fb3b feat(todo-continuation): integrate todo continuation into TUI
Phase 0.2 of Always-On Personas architecture:

- Add toast notification on session switch when incomplete todos exist
  (routes/session/index.tsx)
- Inject system reminder into LLM context for incomplete tasks
  (session/prompt.ts)
- Add visual hint in prompt area showing current todo progress
  (component/prompt/index.tsx)
- Create architecture roadmap for Always-On Personas system
  (docs/architecture/ALWAYS-ON-PERSONAS.md)

This enables automatic continuation of incomplete tasks when:
1. Switching to a session with pending todos (toast + hint)
2. Sending any prompt in a session with incomplete tasks (system reminder)

Part of the headless agent infrastructure for remote access via Zee.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 11:54:09 +01:00