Commit Graph

7064 Commits

Author SHA1 Message Date
Artur Do Lago 04f053fe4e 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-11 02:45:07 +01:00
Artur Do Lago 99194a8a8d 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-11 02:37:01 +01:00
Artur Do Lago 20ea7708b7 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-11 02:34:31 +01:00
Artur Do Lago 1ff18e7e3f 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-11 02:26:45 +01:00
Artur Do Lago dc9ce08ee8 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-11 02:26:03 +01:00
Artur Do Lago d887ab6093 feat(tui): add custom persona themes with exact brand colors
Create dedicated themes for each persona using their defined colors:
- Zee: #2563EB (blue) - primary, accent, borders
- Stanley: #059669 (green) - primary, success, diff colors
- Johny: #DC2626 (red) - primary, error, diff removed

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 02:20:04 +01:00
Artur Do Lago e6a8c14922 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-11 02:16:48 +01:00
Artur Do Lago d17e489f4b 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-11 01:54:24 +01:00
Artur Do Lago 8e5947edfa feat(memory): upgrade to Qwen3-Embedding-8B via Nebius API
- Add VoyageEmbeddingProvider for Voyage AI embeddings
- Add MemoryStore with high-level store/search/list API
- Configure Nebius cloud API for Qwen3-Embedding-8B (#1 on MTEB)
- Fix LocalEmbeddingProvider to support both /v1/embeddings and /embeddings
- Fix QdrantVectorStorage to set collection on existing collections

Model: Qwen3-Embedding-8B (70.58 MTEB score, 99% zero-shot, 4096 dims)
Provider: Nebius API (https://api.tokenfactory.nebius.com/v1)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 01:45:08 +01:00
Artur Do Lago 015d23bd02 fix(serve): use SDK-compatible server startup message
Change serve command output from "agent-core server listening" to
"opencode server listening" for compatibility with @opencode-ai/sdk.

The SDK parses stdout looking for "opencode server listening" to
determine when the server is ready.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 01:09:50 +01:00
Artur Do Lago 9f7d2dea76 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-10 23:22:53 +01:00
Artur Do Lago 424a0a1e54 refactor(config): add session entry primitives to shared types
Add additional shared primitives for session management:
- SessionChatType: direct | group | room
- MessagingProvider: whatsapp | telegram | discord | slack | signal | imessage | webchat
- GroupActivation: mention | always
- SendPolicy: allow | deny

These complement the existing SessionScope and enable zee to import
session-related types from agent-core's shared config module.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 23:21:44 +01:00
Artur Do Lago b4ddd137a6 refactor(config): extract shared config primitives
Create shared.ts with common configuration types that can be used
across agent-core and zee gateway:

- Session primitives: SessionScope, ReplyMode, TypingMode, ReplyToMode
- Policy types: DmPolicy, GroupPolicy
- Logging: LogLevel, ConsoleStyle, LoggingConfig
- Network: RetryConfig, BindMode
- Model/Provider: ModelApi, ModelDefinition, ProviderDefinition
- Processing: ThinkingLevel, QueueMode, QueueDropPolicy

Update types.ts to use shared primitives:
- GeneralSettings.logLevel now uses shared LogLevel
- WhatsAppConfig extended with dmPolicy, groupPolicy, allowFrom, retry
- TelegramConfig extended with dmPolicy, groupPolicy, allowFrom, retry

This is the first step toward config consolidation between agent-core
and zee gateway, enabling type-safe sharing of common configuration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 23:20:45 +01:00
Artur Do Lago 1054687a1d fix(mcp): use bun instead of npx tsx for MCP servers
- bun run works more reliably for spawning child processes
- npx tsx has PATH issues when spawned as subprocess
- Enable all persona MCP servers by default

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 22:54:15 +01:00
Artur Do Lago 8f5177390b feat(mcp): add persona MCP servers for memory, calendar, and portfolio
Implements three MCP servers that expose persona capabilities to external
tools via the Model Context Protocol:

- personas-memory: Qdrant-backed semantic memory (store, search, list, delete, stats)
- personas-calendar: Google Calendar integration (events, create, update, delete, free slots, quick add)
- personas-portfolio: Financial tools bridging to Stanley CLI (portfolio, market data, SEC filings, research, backtest)

Each server uses @modelcontextprotocol/sdk with Zod schemas for type-safe
tool definitions and stdio transport for local process communication.

Config entries added (disabled by default):
- "personas-memory": npx tsx src/mcp/servers/memory.ts
- "personas-calendar": npx tsx src/mcp/servers/calendar.ts
- "personas-portfolio": npx tsx src/mcp/servers/portfolio.ts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 22:49:48 +01:00
Artur Do Lago 53bc2853e6 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-10 22:31:02 +01:00
Artur Do Lago bb2d45d88d 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-10 22:30:11 +01:00
Artur Do Lago 2c0b910464 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-10 22:28:39 +01:00
Artur Do Lago a8e039dbac feat(auth): add proactive OAuth token refresh
- Add Auth.refreshToken() to refresh a specific provider's token
- Add Auth.refreshAllExpiring() to refresh all tokens expiring within 10 min
- Add Auth.status() to get token validity info for all providers
- Add Auth.isExpiringSoon() and Auth.isExpired() helpers
- Call refreshAllExpiring() during provider initialization

Supported providers: anthropic, openai
Note: google/antigravity uses plugin-handled custom flow

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 17:49:00 +01:00
Artur Do Lago 0a44f13f78 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-10 17:45:26 +01:00
Artur Do Lago e9225af4b0 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-10 17:34:35 +01:00
Artur Do Lago 277bcbfc38 docs: add repo location and run-from-anywhere instructions 2026-01-10 16:45:30 +01:00
Artur Do Lago 029401af53 fix(provider): add topP 0.95 for Claude thinking models via Antigravity
- Add topP: 0.95 to antigravity Claude thinking model definitions
- Add topP check in transform.ts for claude+thinking models
- Wrap plugin fetch to remove x-goog-api-key header (conflicts with OAuth)
- Add createEffect to properly initialize agent selection on load
- Update CLAUDE.md with binary update process documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 16:42:34 +01:00
Artur Do Lago 4706a5c04b chore: update tiara submodule with security fixes
Merged Snyk PRs:
- PR #9: node 25.2.1-bullseye-slim → 25.2.1-trixie-slim
- PR #4: node 20-slim → 20.19.6-trixie-slim
- PR #3: node 20 → 20.19.6-trixie-slim

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 11:21:59 +01:00
Artur Do Lago 8e5b5b17c3 fix(sdk): add mode_toggle keybind to SDK types
Add mode_toggle to KeybindsConfig type to support the custom
hold/release mode toggle keybind.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 10:23:24 +01:00
Artur Do Lago 14a5698012 fix(tui): add favorites support to model selector
Add favorite property to model store and favorite() method required
by dialog-model.tsx after upstream merge.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 10:18:34 +01:00
Artur Do Lago 838b5388d2 feat(gateway): add multi-bot Telegram support
- Each Telegram bot is tied to a specific persona (Stanley or Johny)
- Remove persona detection patterns - each bot only responds as its persona
- Support separate bot tokens via --telegram-stanley-token and --telegram-johny-token
- Update namespace to manage multiple bot instances
- Add persona-specific welcome messages and descriptions

Bots:
- @triad_stanley_bot - Investing & Trading Assistant
- @triad_johny_bot - Learning & Study Assistant

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 10:17:22 +01:00
Artur Do Lago 857da07568 fix(provider): remove redundant google-antigravity, keep auth passthrough
The google-antigravity provider was redundant - the opencode-antigravity-auth
plugin already handles OAuth, request transformation, and API calls through
the standard 'google' provider.

Testing confirmed google/gemini-2.5-flash works via the plugin:
  bun run ./src/index.ts run --model google/gemini-2.5-flash "Say hello"

Changes:
- Remove google-antigravity custom loader and provider definition
- Remove antigravity.ts token refresh helper (unused)
- Keep auth OAuth passthrough for extra fields like projectId, email

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 10:02:56 +01:00
Artur Do Lago ebdc43b5a7 fix(gateway): fix Telegram message API format and agent routing
- Fix API message format: use `parts` array instead of `content`
- Add `agent` parameter to route messages to correct persona
- Add `x-opencode-directory` header for proper session handling
- Same fixes as WhatsApp gateway

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 09:55:33 +01:00
Artur Do Lago 6e42b21162 fix(provider): persist model selection and add google-antigravity provider
- Fix model selection not persisting across restarts by saving/loading
  the model field in model.json (was only saving recent and variant)
- Call save() on every model change, not just when adding to recents
- Add google-antigravity provider for free Gemini access via OAuth
- Create antigravity.ts helper for token refresh via antigravity proxy
- Provider inherits all Google models but marks them as free (cost: 0)
- Auto-refresh tokens with 5-minute buffer before expiry

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 09:53:43 +01:00
Artur Do Lago 42ea5398c5 feat(gateway): simplify WhatsApp to Zee-only channel
- WhatsApp is exclusively Zee's channel using GLM 4.7 via Z.ai (cerebras)
- Remove persona detection patterns (Stanley/Johny use Telegram instead)
- Fix API message format: use `parts` array instead of `content`
- Add `agent` parameter to route messages to correct persona
- Add `x-opencode-directory` header for proper session handling

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 09:53:25 +01:00
Artur Do Lago ae8a564dbb chore: update bun.lock
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 09:41:17 +01:00
Artur Do Lago 02e1c8645b fix(gateway): save WhatsApp QR code as PNG file for reliable scanning
Terminal QR codes can be distorted by font size/line height. Save QR as
PNG file that can be opened with an image viewer for reliable scanning.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 09:36:18 +01:00
Artur Do Lago 5251c8cd0a refactor(cli): rename opencode references to agent-core for global installation
Update CLI to use agent-core naming consistently so it can be installed
and run globally without confusion with upstream opencode project.

- Update yargs scriptName to agent-core
- Add AGENT_CORE env var (keep OPENCODE for backwards compat)
- Update build to output agent-core binary
- Update bin shim to find both agent-core-* and opencode-* packages
- Update all command descriptions to use agent-core

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 09:35:22 +01:00
Artur Do Lago 9fc8931fc5 fix(web): update workspace dependency from opencode to agent-core
The web package still referenced the old "opencode" workspace name,
causing bun install to fail with "Workspace dependency not found".

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 09:26:23 +01:00
Artur Do Lago 1cfc5b92a4 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-10 09:03:59 +01:00
Artur Do Lago a2a96dbfad 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-10 08:58:24 +01:00
Artur Do Lago 9fe6659aaf chore: update tiara submodule
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 08:47:51 +01:00
Artur Do Lago dfd0d77d13 fix(tui): load todos directly from storage for startup check
sync.data.todo is only populated when sessions are opened, so the
startup check was always finding zero todos. Now uses Todo.get()
to read directly from storage for each session.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 08:45:50 +01:00
Artur Do Lago 14b0564280 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-10 08:42:48 +01:00
Artur Do Lago e8248dfa8f 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-10 08:22:23 +01:00
Artur Do Lago 77fa5760d3 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-10 08:20:19 +01:00
Artur Do Lago be2a0abf09 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-10 08:18:36 +01:00
Artur Do Lago f89e6269f8 refactor(ui): replace emojis with sober UTF-8 unicode symbols
Replace all emoji characters with standard Unicode symbols that render
correctly in terminals with UTF-8 support.

Persona icons:
- Zee: 🧠💜🤖 → ★ (U+2605 Black Star)
- Stanley: 📈 → ♦ (U+2666 Black Diamond)
- Johny: 📚🎓🧠 → ◎ (U+25CE Bullseye)

Status indicators:
- Working: ↻ → ⟳ (wider rotating arrow)
- Pending: ◔ → ◐ (wider half circle)
- Completed: ✓ → ✔ (heavier check)
- Hold mode: ◆ → ▣ (square with inner square)
- Release mode: ◇ → ▢ (rounded square)

Other changes:
- Status headers: 🔺📊 → ◆◈
- Calendar indicator: 📅 → ▦
- Make persona parameter required in createSessionPane()
- Fix keybind conflicts: mode_toggle → <leader>h,
  messages_toggle_conceal → <leader>/, tips_toggle → <leader>?
- Add persistent hold/release indicator in prompt

All symbols are in the Basic Multilingual Plane (BMP) for maximum
terminal compatibility.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 08:13:32 +01:00
Github Action 7cba1ff793 Update Nix flake.lock and hashes 2026-01-10 03:10:45 +00:00
Adam 8c3cc0d447 chore: prep 2026-01-09 21:09:26 -06:00
Adam e30562d5f4 chore: prep 2026-01-09 20:18:42 -06:00
GitHub Action 7c06ef2477 chore: generate 2026-01-10 02:07:24 +00:00
Adam 58eccf7f53 chore: prep 2026-01-09 19:53:04 -06:00
Adam 6da60bd5d9 fix(app): more defensive dom access 2026-01-09 19:53:03 -06:00