59 Commits

Author SHA1 Message Date
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
dylan
6bc887f3fd feat(config-editor): add tunnel configuration UI
Support configuring tunnel provider (cloudflare, ngrok, bore, tailscale),
port, auth, and provider-specific options via openacp config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: ab23c769533a
2026-03-20 17:09:03 +07:00
Mr.Peter
0c3a83b9fe
Merge pull request #20 from Zysd836/develop
fix: improve error logging and message formatting in session creation
2026-03-20 17:04:57 +07:00
hoangnv
8a99e551fb fix: improve error logging and message formatting in session creation 2026-03-20 17:00:18 +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
dylan
84b7890623 fix(api): wire API sessions to Telegram adapter and fix warmup status
- API sessions now create Telegram topics and wire events (like /new command)
- Fix warmup() not setting status to 'active' after completion
- Auto-approve permissions for headless sessions (no adapter fallback)
- Support positional workspace arg: openacp runtime new [agent] [workspace]
- Add auto-update check, bot admin validation, and improved autostart

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 7c2ecfa24084
2026-03-20 16:53:05 +07:00
lngdao
1eb74cf899 feat(setup): pre-download cloudflared during onboarding wizard 2026-03-20 16:42:48 +07:00
lngdao
2832e351d7 feat(tunnel): auto-install cloudflared binary if not present 2026-03-20 16:34:12 +07:00
dylan
4b2bba9205 fix(api): warmup API sessions and include workspace in responses
- Call session.warmup() after API session creation so sessions progress
  from 'initializing' to 'active'
- Include workspace path in session creation and list responses
- Show workspace in CLI runtime new output

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 2500863c4b70
2026-03-20 16:23:57 +07:00
0xmrpeter
7f0c386071 Fix node 24 2026-03-20 16:17:48 +07:00
0xmrpeter
6b5fd7a4b1 Fix node 24 build production 2026-03-20 16:16:53 +07:00
lngdao
3fae34b90e fix(setup): enable tunnel by default in setup wizard 2026-03-20 15:59:40 +07:00
dylan
2f164e08de feat(exports): add ApiServer export
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 359d05b0260a
2026-03-20 15:59:29 +07:00
dylan
6a51e69cdd feat(config-editor): add API port configuration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 32f9c8606d30
2026-03-20 15:58:34 +07:00
dylan
ffb9f23691 feat(main): integrate API server into daemon lifecycle
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 9569dae83511
2026-03-20 15:58:15 +07:00
Leo Agent
14cad86629 fix: pass keyboard to finalize() to avoid 429 rate limit
- MessageDraft.finalize() accepts optional InlineKeyboard param
- Keyboard attached to last chunk in single API call
- finalizeDraft() detects action before finalize, passes keyboard directly
- Add finalizeDraft() call before usage event

Entire-Checkpoint: 989dc8ff346a
2026-03-20 15:56:23 +07:00
dylan
a770460e04 feat(cli): add runtime subcommand for session and agent management
Adds api-client module with readApiPort/removeStalePortFile/apiCall utilities,
and a runtime CLI subcommand to interact with a running daemon via HTTP API.
Also fixes setup.ts to include the api config field required by the schema.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 94b35b0575cf
2026-03-20 15:56:20 +07:00
dylan
b359c35339 feat(api): add HTTP API server with session and agent endpoints
Implements ApiServer class with 4 REST endpoints (POST/GET/DELETE /api/sessions, GET /api/agents), port file management at ~/.openacp/api.port, EADDRINUSE graceful degradation, and max concurrent session enforcement.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: b01e13e8cb74
2026-03-20 15:50:50 +07:00
dylan
eda322e115 feat(config): add api section with port and host defaults
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 8d075f40d25a
2026-03-20 15:47:58 +07:00
dylan
52f32a77c2 fix(cli): auto-start daemon after onboarding when user chooses daemon mode
Previously, setup always started the server in foreground regardless of
the run mode chosen during onboarding. Now the CLI runs setup first,
then falls through to the normal runMode check to spawn daemon or
start foreground accordingly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 7391299a39f7
2026-03-20 14:56:54 +07:00
dylan
f5f4afc7fb fix: add missing config load in editor, remove dead setTimeout in stopDaemon
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 27b0c1a1d6f4
2026-03-20 14:47:46 +07:00
dylan
94b2552545 feat(main): clean up PID file on daemon shutdown
Also export daemon, autostart, config-editor from public API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 4751282668d2
2026-03-20 14:44:16 +07:00
dylan
642ab6aad2 feat(setup): add run mode step to onboarding wizard
Adds [3/3] Run Mode step to the setup flow, letting users choose between
foreground and daemon mode with optional auto-start on boot. Renumbers
Group Chat (formerly step 2) into the Telegram Bot step, and Workspace
moves to step 2. Fixes integration test to mock getUpdates for chat
auto-detection and the new select call for run mode.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 2e15bb94b299
2026-03-20 14:43:09 +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
00f62cb898 feat(cli): add start/stop/status/logs/config commands and daemon mode
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: c042c0ab4609
2026-03-20 14:38:38 +07:00
dylan
acf564b1ce feat(config-editor): add menu-based interactive config editor
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 653daf9aea4d
2026-03-20 14:34:53 +07:00
Leo Agent
f7e356beb3 feat(action-detect): add callback handler for action confirm/dismiss buttons 2026-03-20 14:31:33 +07:00
dylan
85a9722b5c feat(autostart): add launchd and systemd auto-start support
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 256402728875
2026-03-20 14:31:19 +07:00
Leo Agent
e36d659f02 feat(adapter): add post-finalize action detection for assistant messages
Entire-Checkpoint: ac5e3ce7c1fd
2026-03-20 14:30:39 +07:00
dylan
24e2bbe601 feat(daemon): add PID management and daemon spawn/stop
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: de899dd62459
2026-03-20 14:29:05 +07:00
Leo Agent
0df61a9ac0 refactor(commands): extract executeNewSession and executeCancelSession 2026-03-20 14:28:52 +07:00
Leo Agent
64b7b1676e refactor(commands): extract executeNewSession and executeCancelSession
Entire-Checkpoint: 5abec487f97e
2026-03-20 14:28:27 +07:00
dylan
f66c53b6b6 feat(config): add runMode and autoStart fields to schema
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 383f30e6dd44
2026-03-20 14:26:50 +07:00
Leo Agent
638c425f29 merge upstream/develop: integrate tunnel/viewer features with session persistence 2026-03-20 13:16:43 +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
lngdao
24edd9c269 feat: add tunnel service with file/code viewer
Tunnel Service:
- Pluggable TunnelProvider interface with Cloudflare built-in
- Local HTTP server (Hono) on configurable port (default 3100)
- In-memory ViewerStore with TTL, path validation, 1MB limit
- Optional auth (Bearer token)
- Opt-in via config: tunnel.enabled (default: false)
- Env overrides: OPENACP_TUNNEL_ENABLED, OPENACP_TUNNEL_PORT,
  OPENACP_TUNNEL_PROVIDER

File/Code Viewer:
- Monaco Editor (VS Code engine) loaded from CDN
- Syntax highlighting for all languages
- Line numbers, minimap, word wrap, dark/light theme
- Line range highlighting via URL hash (#L42-L55)
- Copy button, file path breadcrumb

Diff Viewer:
- Monaco diff editor with side-by-side + inline toggle
- +/- change stats
- Dark/light theme

Integration:
- Core enriches tool_call/tool_update with viewerLinks metadata
- Telegram adapter renders clickable View file/View diff links
- ViewerLinks persist across tool updates (carried forward)
- File info extraction handles ACP diff content format
2026-03-20 12:26:25 +07:00
Leo Agent
9e59331158 test: add integration tests for session persistence and lazy resume 2026-03-20 12:20:18 +07:00
Leo Agent
4207509961 feat(telegram): persist topicId in session store for lazy resume
Entire-Checkpoint: 98f62d373a43
2026-03-20 12:19:38 +07:00
Leo Agent
1b8c6ba034 feat(core): add lazy resume with store status updates on session_end/error
Entire-Checkpoint: 50e741d4722f
2026-03-20 12:18:35 +07:00
Leo Agent
6e04d7f4bf feat(agent-instance): add resume() method with fallback to newSession
Entire-Checkpoint: 26699f7d6aad
2026-03-20 12:16:15 +07:00
Leo Agent
d8a995a72d feat(session-manager): integrate SessionStore for persistence
Entire-Checkpoint: 97a35cc408f1
2026-03-20 12:15:44 +07:00
Leo Agent
057774e284 feat(session-store): add JsonFileSessionStore with auto-cleanup
Entire-Checkpoint: af64d46e784e
2026-03-20 12:13:22 +07:00
Leo Agent
145b85e5fc feat(session): add agentSessionId field for resume support
Entire-Checkpoint: 9af6bd13426c
2026-03-20 12:10:00 +07:00
Leo Agent
ffc3cd1e1c feat(config): add sessionStore.ttlDays option (default 30)
Entire-Checkpoint: 59b2745cb184
2026-03-20 12:09:57 +07:00
Leo Agent
7116af864d feat(types): add SessionRecord and TelegramPlatformData types
Entire-Checkpoint: 36c1062c2553
2026-03-20 12:09:35 +07:00
dylan
69b4e74bd1 Update setup 2026-03-20 11:04:40 +07:00
dylan
70c9e618c3 feat(setup): improve onboarding UI with colors, auto-detect group chat, and supergroup guide
- Add ANSI colored output for success/warning/error messages
- Auto-detect group chat ID via getUpdates polling (press 'm' for manual entry)
- Add inline guide for creating a Telegram supergroup
- Strip quotes from workspace path input
- Clean up verbose output, show only essential info

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 2d9b6b0b7549
2026-03-20 10:55:34 +07:00
dylan
0e815c042d fix: update test imports for new project structure
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 832c6f31e5db
2026-03-20 10:27:02 +07:00
0xmrpeter
4cb124174f fix(telegram): update command autocomplete to include agent name
- Modified the updateCommandAutocomplete method to accept the agent name as a parameter, ensuring that command descriptions are prefixed with the agent's name for better context.
- Removed the static command reset in cleanupSkillCommands to maintain existing command context during cleanup.
2026-03-20 09:59:43 +07:00