319 Commits

Author SHA1 Message Date
dylan
79fc71b33c feat(discord): add formatting, send queue, and streaming modules
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 10:48:32 +07:00
Leo Agent
b027d0189b feat(api): add optional token authentication with localhost bypass
Add token-based auth to API server: when api.token is set and host is not
127.0.0.1/localhost, all /api/* routes require Bearer token or ?token query param.
SSE supports query param since EventSource cannot set headers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 22c5ab501afc
2026-03-23 10:47:14 +07:00
Leo Agent
dd92dade05 feat(api): add SSE endpoint for real-time event streaming
Adds GET /api/events that streams EventBus events to dashboard clients
with optional ?sessionId= filter for session-scoped event subscriptions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 3290361e05d2
2026-03-23 10:44:20 +07:00
dylan
1973e52393 feat(discord): add foundation types, config, and discord.js dependency
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 10:43:44 +07:00
Leo Agent
7cae46d26e feat(api): add permission resolution endpoint
Add POST /api/sessions/:id/permission to allow dashboard to resolve pending permission requests. Returns 404 for unknown sessions, 400 when no matching pending permission gate.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: d80059abc1c2
2026-03-23 10:40:05 +07:00
Leo Agent
168148780d fix(api): cancel session properly and extend list response
- handleCancelSession now calls sessionManager.cancelSession() instead of
  session.abortPrompt() directly, ensuring status transitions to cancelled
- handleListSessions returns extended fields: createdAt, dangerousMode,
  queueDepth, promptRunning, lastActiveAt for dashboard use
- Add getSessionRecord and cancelSession to sessionManager mock
- Update existing list test to use toMatchObject for forward compatibility

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 9b2db4989d74
2026-03-23 10:38:17 +07:00
dylan
9fc5b0ae36 docs: add Discord adapter implementation plan
16 tasks covering full feature parity with Telegram adapter.
Fixed critical API mismatches found during review:
- sessionManager.listSessions() not getAllSessions()
- agentManager.getAvailableAgents() not getInstalledAgents()
- core.handleNewSession() positional args not object
- configManager.save() nested objects not dot-paths
- Channel-aware platform storage for Discord snowflakes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: f43825efdb0d
2026-03-23 10:37:23 +07:00
Leo Agent
328b2394d9 feat(core): wire EventBus into SessionBridge, SessionManager, and OpenACPCore
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 429f53d2e4d6
2026-03-23 10:35:10 +07:00
Leo Agent
8be80f7054 feat(core): add EventBus for system-wide event broadcasting
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: f7a2031e57bd
2026-03-23 10:31:33 +07:00
dylan
3b0c9f5f27 Merge branch 'worktree-fix-critical-issues-21' into develop 2026-03-23 10:27:58 +07:00
dylan
39eeb377bc fix(security): add file-based token authentication to API server (issue #21)
Generate a random 64-char hex secret on first start, store at ~/.openacp/api-secret
with 0600 permissions. Validate Bearer token on every request except GET /api/health
and GET /api/version. Update api-client to auto-attach the token, and fix the adopt
command in commands.ts to use apiCall instead of raw fetch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 10:24:27 +07:00
dylan
3709b76c2c fix: wait for process exit before removing PID file in stopDaemon (issue #21)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 10:18:34 +07:00
dylan
02743e4d1e fix(security): escape XML and systemd injection in autostart.ts (issue #21)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 10:15:46 +07:00
dylan
9438eaf829 fix: remove unused createRequire import in version.ts
The createRequire import from 'node:module' was unused since the code
was refactored to use readFileSync instead of require() in ESM.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 10:13:22 +07:00
dylan
38fa354888 docs: update Discord adapter spec with review fixes
Address all critical and important issues from spec review:
- Document MessageContent as privileged intent
- Add stop() and deleteSessionThread() methods
- Fix main.ts integration (registerAdapter call)
- Detail setup.ts multi-channel flow
- Address TopicManager Telegram coupling
- Add /handoff command, assistantInitializing suppression
- Specify deep link format, DiscordPlatformData location
- Add sendSkillCommands behavior, doctor check
- Wire env overrides into applyEnvOverrides()
- Detail DiscordSendQueue.onRateLimited()
- Handle DMs, thread auto-archive, slash command propagation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 3d69b7d07f79
2026-03-23 10:12:25 +07:00
dylan
05f1e9138a docs: add implementation plan for critical fixes (issue #21)
5 tasks: unused import, injection escaping, PID race condition,
API authentication, final verification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 10:10:30 +07:00
dylan
72c7f7c4bb docs: add Discord adapter design spec
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: b1f4b3c7d650
2026-03-23 10:08:39 +07:00
Leo Agent
8027e06e4b docs: add UI dashboard design specification
Spec for embedded React + Vite dashboard served from OpenACP API server.
Covers architecture, SSE real-time updates, 5 pages (dashboard, sessions,
agents, config, topics), auth, EventBus design, and error handling.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 10:06:03 +07:00
dylan
8a1a9d8dc0 docs: address spec review round 2 feedback
Specify crypto.timingSafeEqual(), clarify systemd double-quote
escaping, add EPERM stale PID recovery guidance.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 0ff0b9d5220d
2026-03-23 09:56:13 +07:00
dylan
ac92a2cc08 docs: update spec with reviewer feedback
Address 9 issues from spec review: explicit file paths for API client,
exempt health/version routes, systemd % escaping, ESRCH vs EPERM
handling in PID polling, token rotation guidance.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 09:47:18 +07:00
dylan
e7580f18fe docs: add design spec for critical fixes (issue #21)
Covers 4 critical items: API auth, XML injection, unused import,
PID file race condition.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 311eb3d4083f
2026-03-23 09:44:47 +07:00
dylan
1ea4b0e5f3 merge: sync upstream/develop into develop
Resolve README.md conflicts by adopting upstream's new content
(screenshots, supported agents table, setup wizard details, agent
management CLI) while preserving local additions (daemon mode,
CLI runtime, config editor features).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 38ccedede76e
2026-03-23 09:34:42 +07:00
0xmrpeter
77704bf671 test: add edge case coverage for formatting, action-detect, config-registry, agent-store, permission-gate, session-store
Add 6 new test files (~120 test cases) covering previously untested
functions and edge cases:
- formatting.ts: escapeHtml, markdownToTelegramHtml, formatToolCall,
  formatToolUpdate, formatPlan, splitMessage (code block boundary handling)
- action-detect.ts: storeAction/getAction/removeAction lifecycle,
  buildActionKeyboard for both action types
- config-registry.ts: getConfigValue nested paths, resolveOptions
  with static and dynamic options
- agent-store.ts: exists, hasAgent, corrupted/invalid JSON handling,
  atomic write persistence
- permission-gate.ts: requestId lifecycle, reject defaults, concurrent
  setPending, resolve-then-reject idempotency, custom timeouts
- session-store.ts: findByAgentSessionId with originalAgentSessionId
  fallback, corrupted file handling, concurrent saves, TTL preservation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 02:03:40 +07:00
0xmrpeter
6dba173fce test: add comprehensive test coverage for untested modules
Add 16 new test files (~290 test cases) covering previously untested
modules: StderrCapture, streams, NotificationManager, SessionManager,
ViewerStore, extractFileInfo, version utils, ToolCallTracker,
DraftManager, Session lifecycle, ConfigManager (workspace/env/hot-reload),
OpenACPCore orchestrator, AgentManager, PromptQueue edge cases,
SkillCommandManager, and MessageTransformer tunnel integration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 01:50:48 +07:00
0xmrpeter
519e2055d4 feat(handoff): generic bi-directional handoff for all agents
Replace Claude-only handoff with data-driven integration engine:
- Add AgentIntegrationSpec to define hooks, settings paths, output formats per agent
- Extend AGENT_CAPABILITIES with resume commands for 7 agents (Claude, Cursor, Gemini, Cline, Codex, Kilo, Amp)
- Add integration specs for 4 agents with hooks systems (Claude, Cursor, Gemini, Cline)
- Rewrite integrate.ts as generic engine: generates scripts, merges settings based on spec data
- Support both settings_json (Claude/Gemini/Cline) and hooks_json (Cursor) config formats
- Support both markdown commands (Claude) and skills (Cursor) for handoff triggers
- Auto-integrate handoff on agent install (CLI + Telegram bot)
- Auto-unintegrate on agent uninstall
- Backward compat: Claude keeps CLAUDE_SESSION_ID/CLAUDE_WORKING_DIR variable names

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 01:31:24 +07:00
0xmrpeter
a3c5f5c647 feat(cli): add typo suggestions with fuzzy matching across all CLI commands
Add "Did you mean: X?" suggestions when users mistype commands, agent
names, config keys, or flags. Uses fastest-levenshtein with prefix and
substring matching for comprehensive typo detection across 7 integration
points: top-level commands, api subcommands, agents subcommands, agent
name lookups, integrate command, config set keys, and doctor flags.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 01:19:06 +07:00
0xmrpeter
72248d18ad feat(agents): enhance setup instructions with copyable commands
Updated the agent installation process to display setup steps with tap-to-copy commands in Telegram. Introduced a new function to format setup steps, ensuring commands are easily accessible. Adjusted CLI examples for clarity and consistency, emphasizing first-run instructions for certain agents.
2026-03-23 00:02:49 +07:00
0xmrpeter
a2370e93f2 feat(agents): enrich installed agents with registry data
Added a new method to enhance installed agents by updating their properties based on registry information. This includes fixing names, versions, registry IDs, and distributions for agents that were migrated with generic or unknown values. Logs a message when changes are made to the installed agents.
2026-03-22 23:32:12 +07:00
0xmrpeter
1af2156a51 refactor(cli): enhance command handling by passing args to all commands
Updated CLI command functions to accept and utilize arguments, improving flexibility and usability. Added help messages for install, uninstall, and plugins commands. Enhanced API command help for better user guidance. Improved agent installation logic to ensure the latest package versions are used.
2026-03-22 23:25:24 +07:00
0xmrpeter
2941956fd7 fix(agents): improve ACP flag stripping in agents run command
Handle edge cases: factory-droid's "exec --output-format acp" pair,
qwen-code's --experimental-skills flag. Verified correct stripping
for all 28 agents in the registry.
2026-03-22 22:43:54 +07:00
0xmrpeter
df7404baec fix(agents): include agent base args in agents run command
The agents run command was only passing user args, missing the agent's
own args (e.g., package name for npx). Now includes base args while
stripping ACP-specific flags (--acp, acp) so the interactive CLI works.
2026-03-22 22:42:14 +07:00
0xmrpeter
f00ec6ac99 Merge branch 'develop' 2026-03-22 22:40:31 +07:00
0xmrpeter
95928b869d feat(agents): add comprehensive setup guide, CLI improvements, and post-install instructions
- Add per-agent setup info for 20+ agents (login commands, API keys, env vars)
- Create docs/guide/agents.md with detailed setup instructions for every agent
- Show setup steps automatically after agent installation (CLI + Telegram)
- Add `openacp agents run` command to execute agent CLI for login/config
- Rewrite CLI help with clear sections and examples
- Update assistant system prompt to use AgentCatalog for agent discovery
- Update product guide with agent management, registry info, and troubleshooting
2026-03-22 22:40:13 +07:00
0xmrpeter
66a6cf84c9 feat(docs): update development guide with new CLI commands and architecture details
- Added 'pnpm test:watch' command for watch mode in testing.
- Expanded file structure documentation to include new core and adapter modules.
- Introduced sections on message flow and session state machine for better understanding of architecture.
- Updated CLI commands section with detailed usage for daemon management, configuration, agents, plugins, integrations, diagnostics, and API.
2026-03-22 22:12:30 +07:00
0xmrpeter
ddd237274d chore: bump version to 0.5.0 v0.5.0 2026-03-22 21:55:50 +07:00
Mr.Peter
0dd24b8e5a
Merge pull request #30 from Open-ACP/develop
feat: ACP Registry integration for agent discovery and installation
2026-03-22 21:55:29 +07:00
0xmrpeter
aae01af109 feat(registry): improve agent UX with pagination, descriptions, and deduplication
- Add pagination to /agents in Telegram (6 per page, prev/next buttons)
- Show agent descriptions from ACP Registry in both CLI and Telegram
- Deduplicate agent picker logic (handleNew + startInteractiveNewSession)
- Improve CLI install progress with visual progress bar
- Add supported agents table and ACP Registry attribution to README
- Add social links and keywords to package.json and publish script
2026-03-22 21:53:18 +07:00
0xmrpeter
2300a21dfc fix: remove duplicate handleAgents from menu.ts, cleanup imports
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 20:53:57 +07:00
0xmrpeter
ccc44194e7 fix(registry): address code review findings
- Fix na: callback to use topic-first pattern (prevent race condition)
- Add zip-slip protection for binary archive extraction
- Remove duplicate escapeHtml, import from formatting.ts
- Consolidate commandExists into single shared function

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 20:07:04 +07:00
0xmrpeter
34a8ce36f9 feat(registry): integrate ACP Registry for agent discovery and installation
Add AgentCatalog service layer that fetches agents from the official ACP
Registry CDN, supports 3 distribution types (npx, uvx, binary), and
manages installed agents in ~/.openacp/agents.json.

- New core modules: agent-catalog, agent-store, agent-installer, agent-dependencies
- Bundle registry snapshot for offline fallback
- Auto-migrate existing config.agents to new agent store on startup
- CLI: openacp agents list/install/uninstall/refresh/info
- Telegram: /agents browser, /install command, per-session agent picker
- Setup flow rewritten to use registry with multi-select
- 28 agents available from registry (Claude, Gemini, Cursor, Copilot, etc.)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 19:52:05 +07:00
0xmrpeter
a3f9df358f chore: update README with npm version badge 2026-03-22 17:24:02 +07:00
0xmrpeter
9ec6cb59ad chore: bump version to 0.4.11
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 17:04:50 +07:00
0xmrpeter
b71a74b50c feat(telegram): add system diagnostics command and enhance README
- Introduced a new 'doctor' command in the CLI for running system diagnostics, including a dry-run option.
- Updated the Telegram adapter to integrate the 'doctor' command into the command structure and menu.
- Enhanced the README with a new section for screenshots showcasing the application interface.
2026-03-22 17:04:50 +07:00
0xmrpeter
c19b9a183d chore: add MIT license and update package metadata
- Introduced a new LICENSE file with the MIT License.
- Updated package.json to specify the license as MIT.
- Modified README.md to reflect the change in license from AGPL-3.0 to MIT.
2026-03-22 17:04:50 +07:00
0xmrpeter
607317b85a feat(telegram): enhance session management and configuration commands
- Updated the CLI configuration command to support setting values directly via arguments.
- Refactored session management to utilize a unified session creation pipeline, improving code organization and maintainability.
- Introduced new API endpoints for editable configuration fields and improved handling of session state changes.
- Enhanced the Telegram adapter to streamline session creation and management, including better integration with the command structure.
- Added tests for new session creation and configuration updates to ensure reliability.
2026-03-22 17:04:50 +07:00
0xmrpeter
eefe48a818 chore: bump version to 0.4.10
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 17:04:50 +07:00
0xmrpeter
098be57c6c refactor(telegram): split commands.ts into commands/ directory
Extract the 1400-line monolithic commands.ts into 6 domain-specific files:
- commands/admin.ts — restart, update, dangerous mode
- commands/menu.ts — menu keyboard, help, agents, clear, buildSkillMessages
- commands/integrate.ts — integrate flow + callbacks
- commands/session.ts — cancel, status, topics, cleanup
- commands/new-session.ts — new session creation flow + state
- commands/index.ts — setupCommands, setupAllCallbacks, re-exports

Each file registers its own grammY callback handlers with distinct prefixes.
External API preserved via re-exports from index.ts.
2026-03-22 17:04:50 +07:00
0xmrpeter
61dbd1851b refactor(telegram): add CommandsAssistantContext to types 2026-03-22 17:04:19 +07:00
0xmrpeter
90903a5935 feat(telegram): improve message handling and user interaction
- Updated the Telegram adapter to minimize API calls by refining terminal status checks.
- Enhanced user experience with additional "Cancel" options in command prompts.
- Improved message chunking logic to better handle long messages and prevent HTML tag breaks.
- Introduced a mechanism to track message truncation for more accurate message management.
2026-03-22 17:04:19 +07:00
0xmrpeter
d976e37516 chore: bump version to 0.4.9
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 17:04:19 +07:00