Commit Graph

6088 Commits

Author SHA1 Message Date
Artur Do Lago f5ddded1ee feat(tui): add system monitor lights for internet and LLM providers
Add health status indicators to the TUI footer:
- Internet connectivity (◉ NET) with green/red/muted states
- Connected LLM providers count (◈ N LLM)

Also update CLAUDE.md to document both installation methods
(bun global install and manual ~/bin/agent-core).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 13:28:25 +01:00
Artur Do Lago 5564f506c6 feat(build): use package.json version as fallback for builds
Read version from packages/agent-core/package.json instead of
generating dynamic timestamp versions. This allows setting a
permanent version by editing package.json.

Priority order:
1. AGENT_CORE_VERSION env var
2. OPENCODE_VERSION env var
3. package.json version (new)
4. Dynamic timestamp version

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 13:28:25 +01:00
Artur Do Lago f597efc368 fix(types): resolve AI SDK v6 type compatibility issues
- Use permissive types for provider factories (multiple @ai-sdk/provider versions)
- Add @ts-expect-error for LanguageModel/LanguageModelV3 mismatches
- Fix tool type comparisons for "provider-defined" at runtime
- Filter out tool-approval-request/response from content arrays
- Add proper inputTokenDetails/outputTokenDetails to test fixtures
- Cast Model types for SDK compatibility in share-next
- Fix PromiseLike.catch usage in prompt.ts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 13:28:25 +01:00
Artur Do Lago ae5c70b56c fix(test): update tests for AI SDK v6 and .agent-core rename
- Make toModelMessage async to handle AI SDK v6's async convertToModelMessages
- Update config tests to use .agent-core instead of .opencode
- Update tool registry tests to use .agent-core instead of .opencode
- Update all callers of toModelMessage to await the result

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 13:27:31 +01:00
Artur Do Lago bd33d5de0f cleanup: remove legacy daemon stack and trim docs 2026-01-20 13:27:31 +01:00
Artur Do Lago 0c68cd0da6 Fix agent routing and versioning 2026-01-20 13:27:31 +01:00
Artur Do Lago f9e43164b6 Fix npm OTP args 2026-01-20 13:27:31 +01:00
Artur Do Lago 21750a53a5 Prefer AGENT_CORE env vars 2026-01-20 13:27:31 +01:00
Artur Do Lago 02ef35b3e2 Allow npm publish OTP 2026-01-20 13:27:02 +01:00
Artur Do Lago b876e28717 Support scoped npm publishing 2026-01-20 13:27:02 +01:00
Artur Do Lago 59b6130c2e Auto-start daemon from TUI 2026-01-20 13:26:01 +01:00
Artur Do Lago b5cf8d33c5 build: default to linux-x64 and darwin-arm64 2026-01-20 13:26:01 +01:00
Artur Do Lago ecef68f109 docs: refresh release docs and prune roadmaps 2026-01-20 13:26:01 +01:00
Artur Do Lago 56044851b2 fix: align autocomplete reopen trigger 2026-01-20 13:26:01 +01:00
Artur Do Lago 412fec6e03 chore: fix web workspace dependency 2026-01-20 13:25:08 +01:00
Artur Do Lago 8003fcbb59 chore: apply local updates after upstream merge 2026-01-20 13:22:15 +01:00
Artur Do Lago f41759ce4d bundle agent-core assets and config in dist 2026-01-20 13:17:39 +01:00
Artur Do Lago 98713328d4 rename build targets env var 2026-01-20 13:17:38 +01:00
Artur Do Lago 9b9d259b45 bundle tiara and stanley deps 2026-01-20 13:17:38 +01:00
Artur Do Lago cd3e70cbb3 bundle stanley runtime for cli 2026-01-20 13:17:38 +01:00
Artur Do Lago aea51d232c feat: bundle stanley python deps 2026-01-20 13:17:38 +01:00
Artur Do Lago e1cc72500e feat: bundle zee deps in cli builds 2026-01-20 13:17:38 +01:00
Artur Do Lago 914681478d chore: ignore dist in typecheck 2026-01-20 13:17:38 +01:00
Artur Do Lago 722317bd32 fix: bundle personas from repo root 2026-01-20 13:17:38 +01:00
Artur Do Lago b4d8ea0033 feat: bundle personas in cli installs 2026-01-20 13:17:38 +01:00
Artur Do Lago 2091f6cc2c fix: align jsonc parse error typing 2026-01-20 13:16:31 +01:00
Artur Do Lago 06ddafce1c fix: align diagnostics cli with yargs 2026-01-20 13:16:31 +01:00
Artur Do Lago c1cce80b0b feat: implement alpha diagnostics (Phase 4.1-4.3)
Phase 4.1 - Enhanced Health Checks:
- CheckEngine with timeout and auto-fix support
- Runtime checks: Bun version, directories, disk, memory
- Config checks: schema validation, deprecated options, env vars
- Provider checks: internet, Anthropic, OpenAI, Gemini, Ollama
- Integrity checks: stale locks, orphan processes, corrupt sessions
- Interactive, JSON, and minimal reporters
- CLI: agent-core check --full --fix --json

Phase 4.2 - Structured Logging:
- Logger with level methods and sensitive data redaction
- AsyncLocalStorage context for correlation IDs
- Console, File, and RotatingFile transports
- JSON and Pretty formatters
- Middleware helpers for session/tool/provider logging

Phase 4.3 - Crash Report Generator:
- Privacy redactor with 20+ patterns (API keys, credentials, PII)
- System, config, logs, session, diagnostics collectors
- TAR.GZ archive creation with README
- CLI: agent-core bug-report --include-session
2026-01-20 13:16:31 +01:00
Artur Do Lago 0aa693ba3f refactor: remove hardcoded paths and add upstream merge protection
Code changes:
- Add Global.Path.source getter with AGENT_CORE_SOURCE env var support
- Update status.ts to use Global.Path.source for script paths
- Update setup.ts to use Global.Path.source for docker-compose lookup

Documentation updates:
- Remove hardcoded ~/.local/src/agent-core paths from all docs
- Use generic or relative path references throughout
- README.md, CLAUDE.md, OPS.md, USER_GUIDE.md, PROVIDERS.md updated

Upstream merge protection:
- Add .gitattributes with merge=ours for fork-specific files
- Configure ours merge driver
- Protects: README.md, CONTRIBUTING.md, CLAUDE.md, language READMEs, docs

Deleted (fork cleanup):
- README.zh-CN.md (Chinese Simplified)
- README.zh-TW.md (Chinese Traditional)
- CONTRIBUTING.md
2026-01-20 13:16:31 +01:00
Artur Do Lago b5c520556e feat: implement comprehensive diagnostics and telemetry 2026-01-20 13:15:51 +01:00
Artur Do Lago 51b65b85af feat: add bug checking and reporting CLI tools, update TUI and config 2026-01-20 13:15:51 +01:00
Artur Do Lago 6fadec9712 fix: resolve type errors and import paths 2026-01-20 13:15:51 +01:00
Artur Do Lago aaf72adfb2 refactor(server): split monolithic server.ts into modular routes to fix TS2589
- Extracted routes to packages/agent-core/src/server/route/
- Created packages/agent-core/src/server/state.ts
- Updated server.ts to use modular routes
- Resolved TS2589 (excessive type instantiation depth)
- Fixed Instance.provide signature usage
2026-01-20 13:14:15 +01:00
Artur Do Lago 7b504ea8dd docs: convert 13 TODO comments to proper documentation
Converted ambiguous TODOs to semantic comment types:
- NOTE: Explains design decisions (bash naming, pricing, copilot)
- FUTURE: Planned improvements (tool centralization, auth status, permissions)
- WORKAROUND: Temporary fixes with upstream refs (bun proxy cache)
- LIMITATION: Intentional constraints (task tool input)
- KNOWN_ISSUE: Documented problems (server.ts type inference)
- STUB: Placeholder implementations (dialog endpoint)
- IMPORTANT: Critical constraints (max_tokens with reasoningEffort)

Remaining TODOs are in vendored SDK code (upstream responsibility)
2026-01-20 13:13:23 +01:00
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 904e8a7e10 chore: bump all packages to version 0.1.20260112
- Update agent-core and all workspace packages to 0.1.20260112
- Update tiara submodule with version bump
- Update bun.lock for version changes

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 0734051b08 style: format codebase with prettier and enforce lint
- Run prettier --write across all 17 packages
- Update lint scripts to use prettier --check
- Exclude dist/build directories from lint (app, sdk, console/app)
- Add missing scripts to console packages (typecheck, lint, test)
- All 55 turbo check tasks now pass

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 13:07:40 +01:00
Artur Do Lago 6b56e9d552 fix(security): symlink escape, command escaping, standardize CI pipeline
Security fixes:
- Add containsResolved() to resolve symlinks before path containment check
- Add shellEscapeSingleQuote() and shellEscapeAnsiC() for WezTerm commands
- Update File.read() and File.list() to use symlink-safe containment

CI/Pipeline fixes:
- Fix turbo.json: rename opencode#test → test, add lint task, add unified check task
- Remove fake scripts from agent-core (lint was running tests, not linting)
- Standardize all 11 packages with typecheck, lint, test scripts

Test fixes:
- Fix cache version mismatch in test preload (write version "16")
- Fix model ID filtering to use undated IDs in provider tests

All 43 turbo tasks pass, 690 tests pass.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:59:11 +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 f3685962f3 fix: critical bugs from code review round 2
Neural pattern trainer (tiara.ts):
- Fix searchMemories() -> search() API call
- Fix storeMemory() -> save() API call
- Use correct Memory class interface

Memory expiration (unified.ts):
- Store expiresAt field (createdAt + ttl) for efficient filtering
- Fix deleteExpired() filter operators ($lt/$gt)

Tiara resource leaks (load-balancer.ts):
- Add stop() methods for LoadBalancer and RequestQueue
- Store interval references to prevent memory leaks
- Use .unref() to not block process exit

Misc:
- Remove package.json description (use GitHub instead)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:53:02 +01:00
Artur Do Lago 5f65802558 fix: code review fixes and documentation updates
Critical fixes:
- Fix broken imports from deleted store.ts (scripts/store-ruth-memories.ts, zee-memory.ts)
- Create model-catalog.ts stub for council coordinator
- Fix council-coordinator.ts import path
- Add error handling for daemon shutdown

Reliability:
- Add tsconfig excludes for tiara dist/examples/tests
- Fix tiara swarm-coordinator null check
- Fix tiara SDK missing .js extensions

Documentation:
- Update README with personas system overview and credits
- Add package.json description

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:53:02 +01:00
Artur Do Lago 74820949d1 feat(daemon): integrate zee gateway with auto-supervision
- Remove built-in WhatsApp/Telegram gateways from agent-core
- Add GatewaySupervisor to spawn zee gateway as child process
- Auto-restart gateway on crash (up to 5 times per minute)
- Add --gateway flag to daemon command (default: true)
- Update systemd service for headless operation
- Gateway logs forwarded to agent-core journal

Messaging is now handled exclusively by external zee gateway,
keeping agent-core clean for upstream compatibility.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:51:55 +01:00
Artur Do Lago 5732556bd6 Fix retry abort handling and preserve file whitespace 2026-01-20 12:45:39 +01:00
Artur Do Lago 3e9fbfa5ef refactor(memory): unify memory abstraction into single Memory class
Consolidate 4-layer memory abstraction into unified Memory class:
- MemoryStore, QdrantMemoryStore, QdrantMemoryBridge, ContinuityManager
  are now consolidated into a single src/memory/unified.ts

Single Qdrant collection with type field for discrimination:
- type: "memory" - facts, preferences, decisions
- type: "state" - personas orchestration state
- type: "conversation" - conversation continuity
- type: "session_chain" - session chain index

Key changes:
- New Memory class with save/search/get/delete for memories
- State persistence (saveState/loadState)
- Conversation continuity (startSession, processMessages, etc.)
- Cross-session memory injection for personas bootstrap
- Updated tiara.ts to use Memory instead of QdrantMemoryBridge
- Added bootstrap/personas.ts for lifecycle hooks

Legacy APIs preserved for backwards compatibility.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:45:39 +01:00
Artur Do Lago c06374265b fix(config): remove hardcoded ports and URLs
- Unify server port to use DEFAULT_API_PORT (3456) constant
- Make Qdrant URL configurable via QDRANT_URL env var in debug commands
- Fix plugin baseUrl to derive from Server.url() instead of hardcoded
- Update CLI help text to show correct default port
- Fix MDNS service name from opencode to agent-core

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:45:39 +01:00
Artur Do Lago 5095bc0dff fix(interfaces): resolve 8 critical bugs across web/tiara/persona layers
P0 Critical Fixes:
- Fix import ./tiara → ./claude-flow in plugin/builtin/index.ts
- Create AgentOrchestrator type bridge for council/tiara integration (src/tiara.ts)
- Fix hardcoded state ID in memory-bridge.ts (was causing cross-persona data loss)

P1 Core Functionality:
- Add persona isolation to memory bridge namespace (personas now have private memory)
- Load SKILL.md content into drone prompts (skills now available to drones)
- Inject persona-specific tools from AGENT_CONFIGS into drone prompts

P2 API Consistency:
- Standardize error response format in server.ts (MCP & gateway endpoints)
- WebSocket param validation already in place (verified)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:45:39 +01:00
Artur Do Lago 3936b15dbf fix(naming): replace opencode with agent-core in user-facing text
- scripts/systemd/install.sh: fix help text CLI commands
- cli/cmd/pr.ts: fix spawned command and messages
- cli/error.ts: fix MCP and model error messages
- cli/cmd/uninstall.ts: also detect "# agent-core" in shell profiles

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:45:39 +01:00
Artur Do Lago d61b2cfa60 fix(types): resolve TypeScript errors blocking pre-push hook
- LogMeta: change to Record<string, any> for flexibility
- WhatsApp: add WhatsAppChat interface with sendStateTyping
- debug/index.ts: fix FlagsCommand to work without ALL_FLAGS
- debug/memory.ts: fix Qdrant property names and import path
- footer.tsx: remove incomplete provider_auth_status feature
- dialog-model.tsx: remove incomplete auth status feature
- thread.ts: fix Error handling in log calls
- session/index.ts: fix Error handling in log call
- llm-provider.ts: define types inline (SDK no longer exports)
- memory/store.ts: ensure required Qdrant config fields
- whatsapp.test.ts: simplify disconnect test assertion

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 12:45:39 +01:00