- resolveInstanceRoot() already exists in instance-context.ts (sync)
- Add new async resolveRunningInstance() instead of replacing
- Reuse checkHealth() from instance-discovery.ts
- Reuse findPackageRoot() walk-up pattern from agent-instance.ts
- Note that adopt.ts is the only CLI command missing instanceRoot
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When multiple instances run on the same machine, handoff should
route to the nearest running instance by walking up the directory
tree from the agent's CWD, instead of always targeting global.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Introduced a new specification for Telegram Topics UX, addressing user confusion when prerequisites are not met.
- Implemented user-friendly terminology changes, replacing "supergroup" with "group with Topics enabled."
- Enhanced installation flow with warnings and actionable instructions if Topics are disabled or the bot lacks necessary permissions.
- Added runtime checks to ensure prerequisites are met before full initialization, with clear messaging for users during setup.
- Updated documentation to reflect these changes and improve clarity for users.
- setup-channels: call plugin.install() for first-time setup, plugin.configure()
for existing channels (was always calling configure())
- setup-channels: add CHANNEL_PLUGIN_NAME map so discord correctly imports
@openacp/discord-adapter instead of bare 'discord'
- setup-channels: fix delete action to call clear() instead of updatePluginSettings({})
which was a no-op
- setup-channels: guard SSE channel with early return to prevent failed import
- setup-channels: fix null guard before accessing plugin.name
- setup-channels: fix disable/delete to use correct plugin name per adapter
- Normalize all discord/slack adapter plugin references to canonical names:
@openacp/discord-adapter and @openacp/slack-adapter
- status.ts: use explicit pluginName→channelId map instead of string replace
- lifecycle-manager: remove stale legacy aliases for old discord/slack names
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(speech): STT not working when plugin settings missing groqApiKey
Fixes two bugs reported in #198 where STT feature does not work despite
being marked as configured.
Bug 1: speech plugin setup() now falls back to reading the API key from
legacy config.json (ctx.config) when groqApiKey is absent from plugin
settings. This handles users who upgraded OpenACP without reinstalling
the speech plugin, so the install() migration was never triggered. A
warn log is emitted to guide permanent migration via
`openacp plugin configure @openacp/speech`.
Bug 2: createConfigSection now uses SpeechService.isSTTAvailable() from
the ServiceRegistry to determine STT status, rather than reading from the
legacy config.json field. This ensures the assistant status snapshot
reflects actual runtime state instead of showing a false positive.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: add config legacy removal design spec
Spec for two-phase removal of legacy config sections from ConfigSchema,
env var deduplication, and plugin self-declaring editable fields.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* refactor: remove legacy sections from ConfigSchema
Remove channels, agents, security, api, tunnel, usage, speech sections.
These now live exclusively in plugin settings files.
BaseChannelSchema, AgentSchema, TunnelSchema, UsageSchema, SpeechSchema
and their exported types are deleted.
DEFAULT_CONFIG simplified to core-only fields.
* fix: update all files referencing removed ConfigSchema fields
Replace config.agents/security/api/tunnel/speech/channels references
with agents.json reads or plugin settings reads. Fixes TypeScript errors
from ConfigSchema cleanup in previous commit.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* refactor: remove legacy config migrations
Keep only add-instance-name migration (needed for new installs).
Delete plugin-config-migration.ts (unused scaffolding, never integrated).
* refactor: remove plugin-mapped fields from config-registry
Remove: channels.telegram.outputMode, channels.discord.outputMode,
tunnel.enabled, security.maxConcurrentSessions, security.sessionTimeoutMinutes,
speech.stt.provider, speech.stt.apiKey.
Remove plugin? field from ConfigFieldDef — plugins self-declare via
registerEditableFields() in Phase 2.
Remove getFieldValueAsync, slim setFieldValueAsync to 3 params.
* refactor: config-editor reads/writes plugin fields via settings only
Drop config.json fallback in editTelegram, editSecurity, editApi, editTunnel.
These functions now exclusively use SettingsManager for plugin-owned fields.
* test: remove legacy config test cases
Delete: config-env-overrides.test.ts (channel token env overrides),
config-registry-plugin.test.ts (getFieldValueAsync, plugin-mapped setFieldValueAsync)
Trim: config-migrations.test.ts (keep only add-instance-name),
config-registry.test.ts (remove tunnel/channels assertions),
install-context.test.ts and plugin-setup-integration.test.ts
(remove legacyConfig test cases).
Also trim pre-existing failures from Phase 1 schema changes:
config-schema.test.ts (remove channels/api/security refs),
config-workspace.test.ts (remove channels/security/tunnel env override tests),
api-server.test.ts (update mock config, 429 test, PATCH config test),
routes-sessions.test.ts (fix 429 via lifecycleManager.settingsManager mock),
setup-integration.test.ts (remove channels/agents/security assertions),
helpers.test.ts and setup-channels.test.ts (remove legacy config.channels tests),
config-section.test.ts (remove legacy speech provider tests),
multi-instance-plumbing.test.ts (remove migrate-agents-to-store test).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: add FieldDef type and registerEditableFields to PluginContext
Plugins can now declare their editable settings fields in setup():
ctx.registerEditableFields([
{ key: 'botToken', displayName: 'Bot Token', type: 'string', scope: 'sensitive' },
])
Fields are stored in PluginFieldRegistry (service: 'field-registry').
Requires 'commands:register' permission.
* refactor: remove legacyConfig from InstallContext
Plugin install() hooks no longer receive legacy config.json data.
Interactive setup is the only install path going forward.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* refactor: remove legacyConfig from telegram, security, speech plugins
Each plugin's install() now has only the interactive setup path.
Added registerEditableFields() calls in each plugin's setup() hook.
Remove speech legacy config fallback (config.speech no longer exists).
Also export FieldDef from @openacp/cli public API and add
registerEditableFields() no-op stub to createTestContext() in plugin-sdk.
Remove speech-plugin-setup test case for legacy config fallback path.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* refactor: remove legacyConfig from tunnel, api-server, file-service plugins
Completes legacyConfig removal from all plugins.
Added registerEditableFields() to each plugin's setup() hook.
Added commands:register permission to api-server and file-service plugins
to satisfy registerEditableFields() permission requirement.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: export FieldDef from plugin-sdk
Plugin authors can import FieldDef from @openacp/plugin-sdk to type
their registerEditableFields() calls.
* fix: add commands:register to telegram, clean up dead legacyConfig in main.ts, update plugin template
- Add missing commands:register permission to telegram plugin (required by registerEditableFields)
- Remove dead legacyConfig variable from autoRegisterBuiltinPlugins in main.ts
- Remove legacyConfig documentation from plugin template (field removed from InstallContext)
* test: add missing coverage for config legacy removal
- config-registry: exact 5-field count, removed plugin fields absent,
setFieldValueAsync 3-arg API with return values and validation
- config-schema: removed fields (channels, security, tunnel) are stripped,
outputMode and agentSwitch core fields work correctly
- plugin-context: registerEditableFields permission guard and registry wiring
- install-context: assert legacyConfig absent from context
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* test: add Discord and Slack env var override tests for applyEnvToPluginSettings
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Two-phase plan covering ConfigSchema cleanup, env var deduplication,
config-editor migration, PluginFieldRegistry, and legacyConfig removal
from all 6 affected plugins.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Spec for two-phase removal of legacy config sections from ConfigSchema,
env var deduplication, and plugin self-declaring editable fields.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
SSE /events stream now receives input messages from external adapters (Telegram, Discord)
with full metadata and queue lifecycle state so app can display conversation history
and accurate typing indicators.
- Add message:queued EventBus event emitted in core.handleMessage() after enqueue
(skipped for sse/api sources — app already knows its own messages)
- Add message:processing EventBus event emitted via session-bridge turn_started listener
- Generate turnId at enqueue time so both events share the same ID for client pairing
- Pass pre-generated turnId through queue → createTurnContext() to avoid ID mismatch
- SSEManager subscribes to both new events and filters them by sessionId
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sessions become global with per-session multi-bridge architecture.
Any adapter can attach/detach from sessions via explicit action.
Turn-based response routing with sealed TurnContext per event.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Updated the `setConfigOption` method in the `Session` class to optimistically update the current value for select options when legacy agents return empty configOptions.
- Introduced a new method `applySpawnResponse` in the `Session` class to handle both native and legacy configOptions formats.
- Improved error logging in the `setConfigOption` method for better debugging.
- Added tests to ensure correct behavior for legacy fallback scenarios in the `Session` class and `AgentInstance` methods.
This change improves compatibility with legacy agents and enhances the overall robustness of session configuration management.
- Implement Zod schemas for strict input validation on notify, tunnel, and topic routes.
- Block absolute workspace paths in CreateSession to prevent path injection.
- Validate scope strings and enforce limits on token lifetime and command strings.
- Sanitize output in file-viewer template to prevent XSS attacks.
- Adjust CORS settings and apply rate limiting for unauthenticated requests.
- Cap SSE connections and prompt body size to mitigate DoS risks.
- Restrict public health endpoint information to enhance security.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Updated CLI to register `instances` in `noInstanceCommands` map, allowing access without an existing instance root.
- Refactored instance creation to use `generateSlug` instead of `slugify`.
- Added `POST /exchange` route in the API server for exchanging one-time codes for JWTs, ensuring proper authentication bypass handling.
- Improved error handling for port detection in the API server, simplifying retry logic for available ports.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers: instances list/create commands, start --json extension,
POST /auth/exchange endpoint, GET /api/v1/workspace route.
TDD with vitest, step-by-step with exact code and commands.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Clarify instances list vs status --all distinction
- Fix --from flag convention (parent dir, not .openacp subdir)
- Extend start --json output spec to include name/directory/port
- Clarify --json on onboarding: controls output format, not interactivity
- Fix CLI registration files: src/cli.ts + src/cli/commands/index.ts
- Add note on backward compat: keep dir field in start --json output
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Spec for two core additions supporting the Add Workspace app feature:
- `openacp instances list/create` CLI subcommands with --json output
- Auth code exchange endpoints (POST /auth/codes, POST /auth/exchange)
- GET /api/v1/workspace endpoint for workspace identity info
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Workspace paths use numeric cache IDs instead of base64 in callback
data (Telegram 64-byte limit)
- Clarify that m: handler must call ns: logic directly since grammY
cannot re-dispatch callbacks
- Add explicit callback case handling for both s:settings and ns:start
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Addresses broken menu buttons (Settings, Update, Doctor), degraded UX
(Sessions, Agents, Help), and adds button-driven New Session flow.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- 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>
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>
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>
Added Section 6 covering Telegram/Discord/Slack button rendering,
command response format, and agent-initiated notification handling.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- B4: Remove createThread:false override from createFullSession callback
- B5: Add createThread to createFullSession type signature
- B6: Fix createSessionWithContext to pick fields, not spread params
- B2: Use optional chaining for middleware, preserve original semantics
- I2: Note handleNewChat as dead code
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Phase 1d: Move 4 loose instance-* files into core/instance/ directory.
All belong to multi-instance management domain.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>