1000 Commits

Author SHA1 Message Date
0xmrpeter
1b59e80977 fix: address code review critical and important issues
- Use closure core variable instead of args.coreAccess in command handlers
- Remove pendingResumes state machine from resume.ts
- Replace silent fallback with delegated in command-registry
- Fix plugin template signatures for registerMenuItem and registerAssistantSection
- Add delegated type to CommandResponse docs in plugin template
- Update test to match silent->delegated change

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 18:48:46 +07:00
0xmrpeter
24fbd3e670 docs: update plugin template for new registries, final cleanup
Add registerMenuItem/unregisterMenuItem and registerAssistantSection/unregisterAssistantSection
to PluginContext API docs in claude-md.ts and plugin-guide.ts templates.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 18:22:51 +07:00
0xmrpeter
288114bb61 refactor: simplify Telegram adapter, registry-based menu, remove assistant state and interactive flows
- Delete action-detect.ts and its tests (action detection removed)
- Remove interactive new-session flows (PendingNewSession, showAgentPicker, workspace/confirm steps)
- Remove handlePendingResumeInput from resume.ts
- Delete setupCommands() from commands/index.ts
- Remove assistant state (assistantSession, assistantInitializing) from adapter
- Replace spawnAssistant() with core.assistantManager.spawn()
- All topics (including assistant) now route through core.handleMessage()
- Replace hardcoded buildMenuKeyboard with MenuRegistry-based version
- Replace broad m: switch/case handler with generic MenuRegistry dispatch
- Clean up assistant.ts: remove spawnAssistant, buildAssistantSystemPrompt, handleAssistantMessage
- Remove action detection from DraftManager
- Update tests to match new behavior

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 18:21:01 +07:00
0xmrpeter
d1365f16e4 feat: replace silent command handlers with real implementations
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 18:10:11 +07:00
0xmrpeter
dd83647b91 refactor: simplify SessionBridge with cleanup array and extracted methods
Replace 5 optional handler fields with a single cleanupFns array and listen() helper.
Inline wire*() methods into connect(). Extract dispatchAgentEvent(), resolvePermission(),
checkAutoApprove(), and emitAfterResolve() as clear helper methods.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 18:07:38 +07:00
0xmrpeter
4fbf164f2b feat: wire MenuRegistry, AssistantRegistry, AssistantManager into core
Integrates new registries into OpenACPCore constructor, registers them
as services, adds connectSessionBridge method, exposes plugin context
methods for menu/assistant extension, and exports from core index.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 18:05:03 +07:00
0xmrpeter
8441db7a91 feat: add delegated CommandResponse type for assistant delegation 2026-04-01 18:01:32 +07:00
0xmrpeter
83df3996c1 feat: add AssistantManager for core assistant lifecycle
Adds isAssistant field to Session, creates AssistantManager class with
spawn/respawn/get/isAssistant/waitReady methods, and exports from assistant index.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 18:00:52 +07:00
0xmrpeter
e057264434 feat: add AssistantRegistry with plugin-extensible system prompt and core sections
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 17:59:01 +07:00
0xmrpeter
806d255b76 feat: add default core menu items registration 2026-04-01 17:56:48 +07:00
0xmrpeter
6e13574155 feat: add MenuRegistry with plugin-extensible menu items
Adds MenuItem type to plugin/types.ts and a MenuRegistry class for managing
plugin-registered menu items with priority sorting and visibility filtering.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 17:55:51 +07:00
0xmrpeter
a809524f5a fix: address plan review issues
- Task 9: add full code for each command handler (/new, /cancel, /status, etc.)
- Task 10: fix broken build — remove adapter imports of deleted functions before committing
- Task 7: add connectSessionBridge() method to OpenACPCore
- Task 11: fix placeholder for assistantTopicId in menu callback handler

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 17:47:41 +07:00
0xmrpeter
bf6a4d9de3 plan: add command & assistant architecture refactor implementation plan
13-task plan covering MenuRegistry, AssistantRegistry, AssistantManager,
SessionBridge simplification, command handler migration, and Telegram
adapter cleanup. TDD approach with tests before implementation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 17:36:55 +07:00
0xmrpeter
86bd6e10bf chore: bump version to 2026.401.7
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v2026.401.7
2026-04-01 17:26:33 +07:00
0xmrpeter
26ca0caa08 Add command & assistant architecture refactor spec
Design doc for refactoring the three intertwined systems (command dispatch,
assistant session management, bot/chat flows) into clean, separated concerns
with plugin extensibility for assistant context and menu items.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 17:25:19 +07:00
0xmrpeter
dae1bfdebc feat: add testing entry and path mapping for TypeScript configuration
- Added a new entry for 'testing' in tsup.config.ts to include src/testing.ts.
- Updated tsconfig.json in the plugin-sdk package to include a path mapping for '@openacp/cli/testing' pointing to the generated testing type definition.
2026-04-01 17:25:11 +07:00
0xmrpeter
357f5ac5a1 chore: bump version to 2026.401.6
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v2026.401.6
2026-04-01 17:05:51 +07:00
0xmrpeter
a1472b28d5 fix: update fastify-type-provider-zod version and improve session error handling
- Changed fastify-type-provider-zod version from ^6.1.0 to ~5.1.0 in package.json and pnpm-lock.yaml for compatibility.
- Enhanced the fail method in the Session class to be idempotent, preventing multiple transitions to the error state.
- Updated tests to reflect the new behavior of the fail method, ensuring it does not throw on repeated calls.
2026-04-01 17:05:21 +07:00
0xmrpeter
4b6231c6ea chore: bump version to 2026.401.5
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v2026.401.5
2026-04-01 16:30:52 +07:00
0xmrpeter
c25734f6c6 Enhance URL and query handling in display spec and message formatter
Updated the buildTitle function in display-spec-builder.ts to handle "fetch" and "web" kinds, returning truncated URLs or queries if they exceed 60 characters. Modified message-formatter.ts to ensure URLs and queries are checked for "undefined" before processing, improving robustness in tool summary and title formatting.
2026-04-01 16:30:02 +07:00
0xmrpeter
fb9c410626 Enhance DebugTracer to handle circular references in log data
Updated the DebugTracer class to prevent circular reference issues when logging data. Introduced a WeakSet to track seen objects and replace circular references with a placeholder string "[Circular]" during JSON serialization. This change ensures that logging does not crash the application due to circular structures.
2026-04-01 16:22:34 +07:00
0xmrpeter
36895eacd0 Remove dead handleEnableDangerous/handleDisableDangerous functions
Clean up all remaining references to /enable_bypass and /disable_bypass:
- Remove handleEnableDangerous and handleDisableDangerous from admin.ts
- Update product-guide.ts to use /bypass_permissions
- Update help text in menu.ts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 16:21:44 +07:00
0xmrpeter
758dba53ba Rename /bypass to /bypass_permissions, remove legacy enable/disable commands
- Rename command from /bypass to /bypass_permissions for clarity
- Remove /enable_bypass and /disable_bypass bot commands (replaced by
  /bypass_permissions on|off which handles ACP + client-side fallback)
- Remove from STATIC_COMMANDS and bot.command() registration
- Update all references in admin.ts button callback and tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 16:20:06 +07:00
0xmrpeter
41f8912ee8 Register /mode, /model, /thought, /bypass in Telegram command menu
These commands already worked via the generic CommandRegistry
dispatcher but were missing from STATIC_COMMANDS, so they didn't
appear in Telegram's command autocomplete menu.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 16:15:06 +07:00
0xmrpeter
da313e2a1a Fix bypass detection: dont_ask and skip are deny modes, not bypass
"Don't Ask" denies unknown permissions (opposite of bypass which
auto-approves). Removed dontask, dont_ask, skip from BYPASS_KEYWORDS.

Remaining bypass keywords: bypass, dangerous, auto_accept

Updated tests in config-commands, session-bridge-autoapprove, and
control-message to reflect correct bypass semantics.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 16:13:20 +07:00
0xmrpeter
b389b3b786 Add tests for control message updates and bypass sync
39 tests covering:
- isBypassActive: agent mode keywords, clientOverrides, both, neither
- buildSessionStatusText: unified bypass display, model/mode/thinking
- buildSessionControlKeyboard: button labels for bypass/TTS states
- Platform data merge: controlMsgId persists without overwriting
  topicId or skillMsgId (documents the overwrite bug that was fixed)
- session:configChanged event emission for /model, /mode, /bypass
- patchRecord merge safety: shallow merge pitfalls and correct pattern

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 16:08:16 +07:00
0xmrpeter
93c06f6c62 Fix platform data overwrite in storeControlMsgId and duplicate patchRecord calls
storeControlMsgId had two bugs:
- Called itself recursively instead of this.controlMsgIds.set()
- patchRecord with { platform: { controlMsgId } } replaced entire
  platform object, wiping topicId and skillMsgId

Also removed duplicate patchRecord calls in new-session.ts and
resume.ts that ran after onControlMessage and overwrote controlMsgId.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 16:04:26 +07:00
0xmrpeter
4ef0e2a382 chore: bump version to 2026.401.4
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v2026.401.4
2026-04-01 15:56:43 +07:00
0xmrpeter
8ffbdd0644 refactor: adjust argument indexing in CLI commands for consistency
Updated argument indexing across multiple CLI command files to ensure the first argument is consistently used for the primary command. This change affects the `adopt`, `agents`, `api`, `config`, `install`, `integrate`, `tunnel`, and `uninstall` commands, improving usability and reducing confusion in command usage.

- Changed argument references from `args[1]` to `args[0]` for primary commands.
- Adjusted subsequent argument references accordingly to maintain correct functionality.
2026-04-01 15:56:03 +07:00
0xmrpeter
ff9c6028bb fix: dev-loop, config command, instance-context and startup improvements
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v2026.401.3
2026-04-01 15:48:43 +07:00
0xmrpeter
5b317264c1 Persist controlMsgId for control message updates across restarts
The in-memory controlMsgIds Map was lost on daemon restart, causing
updateControlMessage to silently fail for /model, /mode changes. Now
controlMsgId is persisted in the session record (same pattern as
skillMsgId) and hydrated from the record on first access.

- Add controlMsgId back to TelegramPlatformData (optional, for persist)
- Add storeControlMsgId helper: writes to Map + persists to record
- Add getControlMsgId helper: reads Map with fallback to session record
- updateControlMessage uses getControlMsgId for reliable message lookup

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 15:39:55 +07:00
0xmrpeter
881cbba08d Sync bypass button with ACP config and unify bypass display
The Enable Bypass button now delegates to the /bypass command (via
CommandRegistry) instead of directly mutating clientOverrides — so the
agent is informed via ACP setConfigOption when it supports a native
bypass mode, with client-side fallback when it doesn't.

Display is unified: both ACP-mode bypass and clientOverrides bypass now
show as "Mode: ☠️ Bypass Permissions enabled" (merged into the Mode
line) instead of a separate status line.

- Add isBypassActive(session) helper: checks agent mode + clientOverrides
- setupDangerousModeCallbacks: use registry.execute("/bypass on|off")
- buildSessionStatusText: merge bypass into Mode line
- setupTTSCallbacks + updateControlMessage: use isBypassActive

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 15:27:07 +07:00
0xmrpeter
2d583fd779 Fix control message updates when config changes via commands
Move Telegram-specific message ID storage from core to adapter, emit
session:configChanged events when /model, /mode, or /bypass commands
execute, and update both text and buttons inline when config changes.

- Remove controlMsgId/menuMsgId from TelegramPlatformData (core types)
- Store control message IDs in adapter Map<sessionId, msgId>
- Add session:configChanged event emission in config command handlers
- Update control message (text + buttons) when config changes
- Thread onControlMessage callback through new-session/resume commands
- Pass callback in all command and callback handler invocations

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-01 14:49:35 +07:00
0xmrpeter
d9d3fab470 fix: correct date format in version validation comment in install script 2026-04-01 13:58:03 +07:00
0xmrpeter
1909c179b6 chore: bump version to 2026.401.2
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v2026.401.2
2026-04-01 13:56:46 +07:00
0xmrpeter
998fbf806a chore: bump version to 2026.41.5
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v2026.41.5
2026-04-01 13:44:29 +07:00
0xmrpeter
5199709c43 feat: unify bypass UX messages across Telegram and Discord
Consistent phrasing: "Bypass enabled/disabled", shorter button labels,
clearer explanations. Matches core /bypass command style.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v2026.41.4
2026-04-01 13:37:43 +07:00
0xmrpeter
a733b1b257 feat: improve config command UX with friendlier messages
- Menu titles now show context: "Choose session mode (current: Code)"
- Success messages: "Mode switched to **Architect**."
- Better errors: "This agent does not support switching modes."
- Already-set check: "Already using **Code**." (no redundant agent call)
- Bypass status: descriptive sentences with emojis
- Already-in-state check: "Bypass is already enabled/disabled."
- Client-side bypass explains why with italic note

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 13:35:47 +07:00
0xmrpeter
448c8c11bc fix: update config command tests for improved UX messages
Update config-commands.test.ts to match renamed /bypass command (was /dangerous),
new menu titles, "switched to"/"Already using" messages, "Unknown option" errors,
already-in-desired-state checks, and direct configOptions assignment. Also fix
assistant-prompt.test.ts to expect "Bypass" instead of "Dangerous".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 13:35:18 +07:00
0xmrpeter
914fc013d6 refactor: rename 'dangerous mode' to 'bypass permissions' across documentation and code
- Updated all references from 'dangerous mode' to 'bypass permissions' in CLI commands, API documentation, and internal logic.
- Adjusted command usage and descriptions to reflect the new terminology for clarity and consistency.
- Removed warmup functionality from session management as part of the refactor.
2026-04-01 13:28:08 +07:00
0xmrpeter
e720f84dd0 fix(cli): correct plugin subcommand arg indexing and add local dir install docs
Args were off-by-one (args[2] instead of args[1]) after refactoring
the CLI dispatch. Also added help text for local directory install.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v2026.41.3
2026-04-01 13:09:32 +07:00
0xmrpeter
d1850da198 refactor: rename 'label' to 'name' in config options for consistency
- Updated the ConfigSelectChoice interface to replace 'label' with 'name'.
- Adjusted related code in API commands and tests to reflect this change.
- Ensured consistency across configuration options and improved clarity in the codebase.
2026-04-01 12:42:53 +07:00
0xmrpeter
8e9f371875 chore: bump version to 2026.41.2
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v2026.41.2
2026-04-01 12:42:01 +07:00
0xmrpeter
de583cdfed fix: improve error logging and update permissions in API server and SSE adapter
- Added detailed error logging for plugin setup failures in the LifecycleManager.
- Updated API server and SSE adapter permissions to include 'services:use' for enhanced functionality.
- Enhanced logging during API server setup and system readiness events for better traceability.
2026-04-01 12:23:57 +07:00
0xmrpeter
55da9d5497 fix: enhance error handling and logging in API server and Telegram adapter
- Added error message handling in OpenACPCore to notify users of inactive sessions.
- Improved logging in the API server setup and startup process for better traceability.
- Updated Telegram adapter to use getOrResumeSession for session management, ensuring consistent session retrieval across commands.
- Enhanced retry logic in the API server to handle port conflicts more gracefully.
2026-04-01 12:07:36 +07:00
0xmrpeter
6f8b524076 fix: check shuttingDown in retry catch block to prevent post-shutdown retries
When a retry was already in-flight before shutdown set the flag, the
catch block would schedule another retry after shutdown killed the
process. Add shuttingDown guard in the catch path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 11:56:09 +07:00
0xmrpeter
cd18504f0d fix: spawn tunnel processes detached to prevent SIGINT propagation
When user presses Ctrl+C, SIGINT is sent to the entire process group.
cloudflared receives it directly, does graceful shutdown (reconnects to
edge), exits before our shutdown code runs, and triggers onExit retry.
Spawning with detached:true puts tunnels in their own process group so
only our code controls their lifecycle via stop().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 11:52:16 +07:00
0xmrpeter
c44f11ac6c fix: update CLAUDE.md marker for local OpenACP workspace
Changed the marker in CLAUDE.md from '.openacp/' to '## Local OpenACP Workspace' to better reflect the current workspace terminology and improve clarity for users.
2026-04-01 11:06:14 +07:00
0xmrpeter
a9a8111ae1 Merge branch 'develop' of github.com-peter:Open-ACP/OpenACP into develop 2026-04-01 10:59:11 +07:00
0xmrpeter
3b689734da Merge branch 'develop' of github.com:Open-ACP/OpenACP into develop 2026-04-01 10:58:46 +07:00