Agents like claude-acp and codex-acp wrap external CLIs (claude, codex)
and have an npx/binary distribution in the registry. Previously, missing
external CLIs caused available: false, hiding the Install button entirely
— even though the agent package itself CAN be installed independently.
agent-catalog: for uninstalled agents, available = dist !== null
Availability now means 'has a distribution to install', not 'all deps
met'. Missing deps are still surfaced via missingDeps for the UI.
agent-installer: remove hard dep-check block before installation
Installation proceeds even when external CLIs are absent. The required
setup steps (e.g. 'npm install -g @anthropic-ai/claude-code') are
returned in the result so callers can guide the user post-install.
The uvx runtime check is kept as it is a true hard requirement.
Without selective, Telegram automatically opens the reply compose box
in private chats when bot sends a force_reply message.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
API-sourced prompts (from the App) were bypassing MESSAGE_QUEUED and
MESSAGE_PROCESSING emission, so only the sending App window showed the
user message. Other connected windows only saw the AI response.
- routes/sessions.ts: generate turnId, emit MESSAGE_QUEUED before
enqueuePrompt, return turnId in response body
- session-bridge.ts: remove 'api' exclusion from MESSAGE_PROCESSING
so all connected SSE clients receive the streaming stub event
Add Remote Access section to `openacp --help` output with all supported
flags. Add `core:remote` assistant section so the AI agent knows how to
generate remote access links, explain roles, tunnel vs local links, and
QR code behavior.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Top-level extractInstanceFlags strips these flags before passing args
to cmdInstances, so cmdInstancesCreate never receives them. Re-inject
parent flags into subArgs when dispatching to create subcommand.
Workspace path handling:
- Add `allowExternalWorkspaces` config flag (default: true) to allow workspace
paths outside baseDir; external paths must exist on disk (no auto-create)
- Remove absolute path restriction from WorkspaceNameSchema so agents can pass
full paths directly to the API
- API route wraps resolveWorkspace() in try/catch and throws BadRequestError
(HTTP 400 with INVALID_WORKSPACE code) instead of leaking 500 errors
- CLI extractApiError() helper properly extracts .message from structured error
objects, preventing "[object Object]" display
File attachment handling:
- Add AVIF, HEIC, HEIF to SUPPORTED_IMAGE_MIMES (Claude API supports them)
- Remove filename regex restriction from AttachmentInputSchema (was blocking
filenames with spaces and unicode)
- Extract attachment logic to attachment-blocks.ts for testability
Security / allowedPaths:
- Propagate config.workspace.security.allowedPaths through AgentManager.spawn()
and AgentManager.resume() to PathGuard in AgentInstance
Bug fix — agent relay wiring:
- Convert Session.agentInstance to getter/setter so wireAgentRelay() and
wireCommandsBuffer() are called automatically on any assignment, not just
via switchAgent(). Fixes 4 pre-existing test failures in session-bridge-switch.
- Fix closure capture bug: wireAgentRelay/wireCommandsBuffer now capture the
agent instance by value (const instance = this._agentInstance) instead of
via getter, preventing cleanup from running on the wrong instance when the
setter assigns a new agent before calling the cleanup.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Merge sourceAdapterId into routing before enqueue so middleware hooks
(e.g. history recorder) receive it via the agent:beforePrompt payload.
Store sourceAdapterId on user turns in history for downstream use.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Updated the documentation to indicate the total number of middleware hooks has increased from 18 to 19.
- Adjusted references in the getting-started-plugin guide to ensure consistency with the updated middleware hook count.
- Corrected the middleware hooks section in the plugin template to reflect the accurate total.
- Replaced string literals in event emissions and middleware executions with BusEvent constants across various modules, enhancing consistency and maintainability.
- Updated event handling in session management, agent switching, and plugin lifecycle to utilize the new BusEvent structure.
- Improved clarity in event-driven architecture by centralizing event definitions.
- Introduced event handling for agent events, status changes, and prompt count updates directly in headless sessions, previously managed by SessionBridge.
- Updated session creation and event emission to exclude assistant sessions from certain notifications.
- Refactored agent event relay wiring to ensure proper event handling across all session types, including headless sessions.
listSessions(), listAllSessions(), and listRecords() now exclude sessions
and records with isAssistant=true so they never appear in user-facing listings.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add isAssistant parameter to SessionCreateParams and createSession method,
then pass it through to the patchRecord call so it gets persisted in the
session record store.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Added findAssistant() method to SessionStore interface and JsonFileSessionStore implementation
to retrieve the assistant session for a given channel. Updated cleanup() logic to preserve
assistant sessions regardless of TTL expiration.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PermissionHandler.setupCallbackHandler() used bot.on('callback_query:data')
without calling next() for non-p: prefixed data, silently consuming all
callback queries and preventing m:, ns:, ar:, c/ handlers from ever firing.
Fix: pass next middleware function and call return next() for unrecognized
callback data so the handler chain continues to the correct handler.
Also add a warn log when a menu item ID is not found in the registry.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Before topics are initialized, this.assistantTopicId is 0. A non-command
message arriving before initTopicDependentFeatures() completes would
generate an invalid redirect URL (t.me/c/.../0).
Add _topicsInitialized guard to the message:text handler in setupRoutes(),
matching the existing guard on the command dispatcher, so messages received
during startup get a clear "still setting up" reply instead of a broken link.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Verifies that all grammY handlers (setupAllCallbacks, setupRoutes) are
registered BEFORE bot.start() is called. The MockBot throws if any handler
registration is attempted after start(), mirroring grammY's real behavior.
This catches the regression where initTopicDependentFeatures() called
setupMenuCallbacks/setupRoutes after bot.start(), causing the bot to silently
fail on startup with grammY's "cannot augment composer after the fact" error.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
grammY throws "cannot augment the composer after the fact" when bot.use()
is called after bot.start(). setupMenuCallbacks and setupRoutes were being
called inside initTopicDependentFeatures(), which runs after bot.start().
Fix: move all handler registration (setupMenuCallbacks, setupRoutes) to
before bot.start() in the start() method. Topic IDs are passed via a
mutable _systemTopicIds ref that is updated in-place by
initTopicDependentFeatures() once topics are ready — callbacks close over
this reference and see correct IDs at invocation time.
Also adds detailed diagnostic logging to validators.ts and adapter.ts
to trace the prerequisite check and topic initialization flow.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Correct conflict resolution: keep @openacp/discord-adapter and
@openacp/slack-adapter as normalized in faf6286, not the old
@openacp/discord and @openacp/slack names from the refactor branch.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- POST /agents/reload now requires agents:write instead of agents:read
to better reflect its side-effectful nature
- Extract loadAndListAgents() helper to eliminate code duplication
between GET /agents and POST /agents/reload
- Add agents:write to KNOWN_SCOPES and operator role in roles.ts
- Add clarifying comment on per-request I/O trade-off
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Merge feat/api-permission-feedback-prompt
- Add optional `feedback` field to PermissionResponseBodySchema
- When feedback provided with permission deny, abort current turn then queue
feedback as next prompt (sequential, race-free)
- Broadcast `permission:resolved` event via SSE manager so desktop app and
other adapters can dismiss permission UI when resolved from another adapter
- Route feedback prompt with correct sourceAdapterId (api/sse)
- Tests covering feedback flow, abort-before-enqueue ordering, and no-op cases
- Await abortPrompt() before enqueuePrompt() to eliminate the race condition
where enqueued feedback could be cleared by the concurrent queue.clear() call
- Log abortPrompt failures via request.log.warn instead of silently swallowing
- Pass sourceAdapterId routing to enqueuePrompt (api/sse) so agent responses
are routed correctly
- Add tests for feedback flow in both api-server and sse-adapter route handlers,
verifying abort-before-enqueue ordering, correct routing, and no-op when no
feedback is provided
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extends POST /sessions/:id/prompt (REST + SSE) to accept an optional
`attachments` array of base64-encoded files. Attachments are decoded
server-side and persisted via FileService, which handles naming,
storage under ~/.openacp/files/{sessionId}/, and PathGuard whitelisting
so agents can read uploaded files without manual path configuration.
Fixes from code review:
- Restore sourceAdapterId/responseAdapterId routing args in enqueuePrompt
(both REST and SSE routes were dropping them from the original PR)
- Extract shared resolveAttachments() utility to eliminate duplication
between api-server and sse-adapter routes
- Return 503 with FILE_SERVICE_UNAVAILABLE when file-service plugin is
not loaded, instead of an unhandled internal error
- Clean up already-written files on partial save failure to avoid orphans
- Validate fileName against safe-char regex at schema level so raw value
forwarded to agent cannot contain path traversal characters
- Validate mimeType against type/subtype regex to prevent malformed MIME
values from reaching agent processing
- Raise per-route bodyLimit to 115 MB to make the 10-attachment cap
reachable (Fastify default 1 MB would reject payloads before schema
validation otherwise)
- Add .DS_Store to .gitignore
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add idempotent guard to initTopicDependentFeatures() to prevent multiple initializations
- Update retry message from specific interval to more accurate description
- Add network error test case to validateBotAdmin to verify error handling
Add a new exported function checkTopicsPrerequisites(token, chatId) that validates all 3 runtime prerequisites for the Telegram adapter:
1. Topics enabled on the group (is_forum === true)
2. Bot is admin
3. Bot has can_manage_topics permission
Returns { ok: true } if all checks pass, or { ok: false; issues: string[] } with human-readable issue messages.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>