44 Commits

Author SHA1 Message Date
0xmrpeter
c29dd3af48 docs: add codebase refactor spec and implementation plan 2026-03-24 00:42:33 +07:00
Leo Agent
47b7a063d9 merge: resolve conflicts with upstream/develop
Keep both sides: our EventBus/SSEManager/StaticServer/auth/security additions
and upstream's speech module (SpeechService, GroqSTT, SpeechSchema) additions.
- config.ts: add speech schema alongside integrations field
- core.ts: add speech.* hot-reload handler alongside logging.level handler
- index.ts: add SpeechService/GroqSTT exports + speech type exports
- api-server.ts: add intermediate object creation for new config paths (speech)
- test files: add speech config to mock config objects

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 20b626ae9a6b
2026-03-23 22:53:23 +07:00
Leo Agent
07c6e7e185 merge: resolve conflicts with upstream/develop (usage tracking feature)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 21:42:36 +07:00
0xmrpeter
de9893f4c9 Merge branch 'develop' of github.com:Open-ACP/OpenACP into feat/speech-module 2026-03-23 21:41:35 +07:00
Peter Parker
8639966e1d
Feature/cost tracking budget planning (#29)
* docs: add cost tracking & budget limits design spec

New feature spec for session-level usage tracking with JSON file
persistence, configurable monthly budget warnings, and Telegram
/usage command for on-demand reporting.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: add cost tracking & budget limits implementation plan

8-task TDD plan covering UsageStore, UsageBudget, config schema,
core wiring, formatting helpers, and /usage Telegram command.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(core): implement session cost tracking & budget limits

- Add UsageStore with JSON persistence, calendar-month queries, and retention cleanup
- Add UsageBudget with threshold checking, de-duplication, and injectable date provider
- Add UsageSchema to config (derived UsageConfig type as single source of truth)
- Wire usage event tracking and budget warnings into OpenACPCore
- Add /usage Telegram command with formatUsageReport helper
- Add 25 tests covering store, budget, and formatting
- Update implementation plan per review feedback (#1-6)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address review feedback on cost tracking implementation

🔴 Must fix:
- destroy() now calls flushSync() before cleanup to prevent data loss

🟡 Should fix:
- usageStore/usageBudget marked readonly to prevent accidental reassignment
- Replace inline import type with top-level import in formatting.ts

â„šī¸ Nits:
- Rename usage-command.test.ts → usage-formatting.test.ts (tests formatUsageReport, not command)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: peter <peter@lab3.asia>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 18:12:12 +07:00
Leo Agent
556025bb1b merge upstream/develop: adopt file-based auth, keep UI dashboard features
Resolve conflicts between upstream's file-based API authentication (PR #34)
and our UI dashboard backend features. Key decisions:
- Use upstream's loadOrCreateSecret() + authenticate() with file-based secret
- Drop our checkAuth() + api.token config approach
- Add query param support to authenticate() for SSE EventSource
- Exempt non-/api/ routes (static files) from auth
- Keep SSEManager, StaticServer, permission endpoint, extended list response
- Remove api.token from config schema
- Update tests to use file-based auth pattern

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 17:49:43 +07:00
Peter Parker
0ca7f35d0f
feat(telegram): /archive command for session topics (#44)
* docs: add /clear session topic design spec and implementation plan

- Design spec covers topic recreation approach, confirmation flow, error handling
- Implementation plan with 6 TDD tasks: store update, topic helpers, adapter method, command expansion, tests, verification
- Extends existing /clear (assistant-only) to work in session topics

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: update /archive spec and plan per review feedback

- Rename /clear → /archive (user-friendly, aligns with Gmail/Slack patterns)
- Separate from existing /clear (assistant-only stays untouched)
- Add core archiveSession() + API endpoint (POST /sessions/:id/archive)
- Add assistant guidance when /archive used in wrong topic
- Use patchRecord() instead of new updatePlatformData method
- Fix: setupMenuCallbacks alias, chatId access, missing vi import in tests
- Fix: handleArchiveConfirm tests for success/cancel/error paths

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: address review feedback on /archive spec and plan

1. Fix API response type: use newThreadId (string) consistently
2. Add try/catch for orphan recovery between topic delete and create
3. Spread existing platform data in patchRecord to preserve skillMsgId
4. Add session.archiving flag to buffer events during transition
5. Rewrite core tests with full mock flow (adapter delegation, error paths)
6. Add explicit escapeHtml import line in session.ts
7. Strip existing 🔄 prefix to prevent emoji stacking on repeated archives

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: implement /archive command for session topics

- Add archiveSession() to OpenACPCore with validation and error handling
- Add archiveSessionTopic() to ChannelAdapter base (no-op default)
- Implement Telegram adapter: topic delete → create → rewire with orphan recovery
- Add /archive command with confirmation flow (ar: callback prefix)
- Add POST /api/sessions/:id/archive endpoint
- Strip 🔄 prefix on repeated archives to prevent emoji stacking
- Spread existing platform data in patchRecord to preserve skillMsgId
- 13 tests covering command, confirm, cancel, error, and core integration

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(test): fix setup-integration timeout by mocking cloudflared download

- Mock ensureCloudflared to avoid real network download during test
- Increase test timeout to 15s for setup wizard flow

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address 4 review findings on /archive implementation

1. Add session.archiving flag to Session class, set during topic
   recreation, guard sendMessage to drop events during transition
2. Fix skillMsgId cleanup: use delete instead of undefined assignment
3. Add /archive to handleHelp text in menu.ts
4. Guard non-active sessions (finished/cancelled/error) in handleArchive
   with early return instead of showing doomed confirmation dialog

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: peter <peter@lab3.asia>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 17:48:20 +07:00
0xmrpeter
5a3c32ce41 feat(speech): implement speech module with STT/TTS capabilities
- Added a new speech module to OpenACP, featuring a pluggable architecture for Speech-to-Text (STT) and Text-to-Speech (TTS) functionalities.
- Created interfaces for STT and TTS providers, along with a SpeechService orchestrator to manage provider interactions.
- Integrated Groq Whisper as the default STT provider, allowing for automatic transcription of voice messages.
- Updated configuration schemas to support speech settings and added environment variable overrides.
- Enhanced session processing to utilize the new speech capabilities, ensuring seamless integration with existing message flows.
- Included comprehensive tests for the SpeechService and its providers to ensure reliability and functionality.
2026-03-23 17:02:13 +07:00
dylan
adc2057d30 docs: add Discord media support implementation plan
4-task plan: media helpers + tests, incoming media handling,
outgoing attachment support, full verification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: dcddb00f7cd9
2026-03-23 14:45:32 +07:00
dylan
a5d463c3a9 merge: sync upstream/develop into develop
Resolves conflicts in package.json (keep both discord.js and
fastest-levenshtein) and pnpm-lock.yaml (regenerated).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: d7e8e9299f36
2026-03-23 14:18:29 +07:00
Leo Agent
272bcf041c merge: resolve conflicts with upstream/develop (file-service feature) 2026-03-23 13:46:52 +07:00
0xmrpeter
d595a91cf6 feat: add file, image, and audio support via adapters
- Add FileService for saving/resolving files in ~/.openacp/files/<sessionId>/
- Support OGG→WAV voice conversion using ogg-opus-decoder + node-wav
- Extend ACP prompt to send image/audio as base64 when agent supports it,
  fallback to file path when not
- Handle agent→user image/audio content events via SessionBridge
- Telegram adapter: incoming photo, document, voice, audio, video_note handlers
- Telegram adapter: outgoing attachment sending (photo/voice/document)
- Add Attachment type, extend IncomingMessage/OutgoingMessage/AgentEvent
- Log agent prompt capabilities on init for debugging
- Fix agent-installer test to match version-stripping behavior

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 13:34:58 +07:00
Leo Agent
f19eaa99cb docs: add implementation plans for UI dashboard backend and scaffold
Entire-Checkpoint: 1f8a6b980840
2026-03-23 12:28:53 +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
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
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
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
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
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
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
bd917c20ba feat(telegram): enhance session management with interactive flow and command updates
- Introduced an interactive flow for creating new sessions, allowing users to select agents and workspaces conversationally.
- Updated the assistant system prompt to include product references and improved guidelines for user interactions.
- Added a new command to clear assistant history and improved error handling during session creation.
- Enhanced workspace input handling to support relative paths and ensure user-friendly prompts.
2026-03-22 17:04:19 +07:00
0xmrpeter
593e357a6f feat: implement session handoff and CLI integration for Claude
- Added commands for session handoff between Claude CLI and Telegram, allowing users to transfer sessions seamlessly.
- Introduced `adopt` and `integrate` commands in the CLI for managing agent sessions and integrations.
- Enhanced API server to support session adoption and improved agent capabilities reporting.
- Updated documentation to reflect new features and usage instructions for session handoff.
2026-03-22 17:04:19 +07:00
0xmrpeter
6d7262186b feat(api): implement HTTP control API and CLI commands for session and topic management
- Added an HTTP API to the OpenACP daemon for managing sessions and topics.
- Introduced `openacp api` CLI commands for creating, canceling, and querying sessions, as well as managing topics.
- Updated the API server to handle new endpoints for session details, health checks, and configuration management.
- Enhanced topic management with cleanup and deletion capabilities.
- Refactored existing CLI commands to align with the new API structure.

This update improves user interaction by allowing session and topic management directly from the command line, enhancing the overall functionality of OpenACP.
2026-03-22 17:04:19 +07:00
0xmrpeter
0a7ca0c6a7 refactor: rename /new_chat command to /newchat for easier mobile typing
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 17:04:18 +07:00
0xmrpeter
f7c1a4895f docs: add activity tracker spec and implementation plan
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-20 23:30:21 +07:00
0xmrpeter
498c4530f7 feat(session): implement session name persistence and skillMsgId handling
- Added `getSessionRecord` method to `SessionManager` for retrieving session data.
- Introduced `skillMsgId` field in `TelegramPlatformData` to persist message IDs across sessions.
- Updated `TelegramAdapter` to restore and persist `skillMsgId` during command handling and cleanup.
- Enhanced session name persistence to ensure it is retained after bot restarts.
- Included verification steps for manual testing of new functionality.
2026-03-20 21:48:08 +07:00
0xmrpeter
f1b02dc22a feat(telegram): update grammY to v1.41.1 and remove outdated Telegram streaming redesign documents
- Upgraded grammY dependency from v1.30.0 to v1.41.1 in package.json and pnpm-lock.yaml.
- Deleted obsolete Telegram streaming redesign implementation and specification documents as they are no longer relevant.
2026-03-20 20:36:55 +07:00
0xmrpeter
41289a83ca Merge branch 'develop' of github.com-peter:Open-ACP/OpenACP into develop 2026-03-20 17:40:34 +07:00
0xmrpeter
8a3ad9b970 docs: add telegram streaming redesign spec and plan
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 17:18:45 +07:00
Mr.Peter
0d43630cff
Merge pull request #19 from dylan-112/develop
Feat: Update cli for full handling function
2026-03-20 17:11:39 +07:00
0xmrpeter
c4da1f0cea Merge branch 'develop' of github.com-peter:Open-ACP/OpenACP into develop 2026-03-20 17:00:42 +07:00
0xmrpeter
37a08b821f Telegram streaming 2026-03-20 16:58:54 +07:00
Mr.Peter
9a79b1b59a
Merge pull request #17 from rex-qa-bot/develop
feat: assistant action detection with inline confirm buttons
2026-03-20 16:58:14 +07:00
dylan
daa1385206 merge: sync upstream/develop into develop
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 16:57:31 +07:00
Leo Agent
831105bece docs: add assistant action detection spec and implementation plan
Entire-Checkpoint: b76f7ff5852f
2026-03-20 16:04:50 +07:00
dylan
917f2e2628 docs: add runtime API & CLI implementation plan
7-task plan for HTTP control API + openacp runtime CLI subcommand.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: ee8edb8efaa5
2026-03-20 15:40:31 +07:00
lngdao
82d271c513 feat(tunnel): add ngrok, bore, tailscale providers + config auto-migration
Providers:
- ngrok: supports authtoken, domain, region options
- bore: supports server, port, secret options (default: bore.pub)
- tailscale: Funnel provider, resolves hostname via tailscale status

Config backward compatibility:
- Auto-migrate: existing configs without tunnel section get it added
  to the file with enabled=true and cloudflare as default provider
- Zod default remains enabled=false for safety
- DEFAULT_CONFIG includes tunnel section for new installations

Resilience:
- EADDRINUSE on tunnel HTTP server warns instead of crashing
- Unknown provider falls back to cloudflare with warning

Docs:
- Tunnel service design spec
- Implementation plan
2026-03-20 14:39:41 +07:00
dylan
cb30c0d6ef docs: add implementation plan for config editor and daemon mode
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 1f78b07f974a
2026-03-20 14:20:35 +07:00
Leo Agent
038f3bae46 refactor: code review fixes and add design docs
- Extract shared spawn logic into spawnSubprocess() helper
- Remove signal handler leak in JsonFileSessionStore.destroy()
- Replace sessionStore! assertion with local variable capture
- Restore debug log for resolved agent command
- Fix IPv4-only networking (setDefaultAutoSelectFamily)
- Fix native fetch for grammY (client: { fetch })
- Add session persistence spec and implementation plan

Entire-Checkpoint: d3283b6c39ce
2026-03-20 12:54:26 +07:00
0xmrpeter
29130a8ae7 feat(telegram): implement dynamic skill command handling and autocomplete
- Added support for dynamic skill commands in the Telegram adapter, allowing for real-time command updates based on user interactions.
- Implemented methods to send and clean up skill commands, enhancing user experience with pinned messages and command autocomplete.
- Updated command handling to include skill-specific callbacks and keyboard generation for better interaction.
- Refactored existing command setup to accommodate new skill command features.
2026-03-19 23:46:21 +07:00
0xmrpeter
c82e2b98ed refactor: enhance logging and project structure for improved clarity and maintainability
- Updated logging system to use Pino for structured logging, including session-specific loggers.
- Refactored project structure in CLAUDE.md for better organization and clarity.
- Added new build scripts and commands in README.md for easier usage.
- Improved error handling and logging in core components and Telegram adapter.
- Introduced session log retention and cleanup functionality.
- Updated package.json and pnpm-lock.yaml to include new logging dependencies.
2026-03-19 21:32:18 +07:00
dylan
37794db457 feat: interactive CLI onboarding setup wizard
- Auto-detect agents from PATH and node_modules/.bin (prefer claude-agent-acp)
- Validate Telegram bot token and chat ID against API
- Streamlined 3-step setup: Telegram, Agents, Workspace
- Auto-save config and auto-start after setup
- Fix bin entry to use cli.js for proper command routing
- Update setup-guide.md and README.md to match new flow
- Security defaults applied automatically (editable in config)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 605d217b3192
2026-03-19 18:26:29 +07:00
0xmrpeter
d19032d779 Enhance OpenACP setup by adding support for plugin adapters and improving configuration management. Update .gitignore to exclude dist-publish, modify package.json to include versioning and new build scripts, and expand README with installation and plugin instructions. Refactor config schema to support dynamic channel configurations and improve main execution flow for better adapter registration. 2026-03-19 17:29:37 +07:00