137 Commits

Author SHA1 Message Date
0xmrpeter
e05745075f docs: fix spec after code review
- 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>
2026-04-08 22:18:58 +07:00
0xmrpeter
5f39e6403e docs: add handoff instance resolution design spec
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>
2026-04-08 22:14:29 +07:00
0xmrpeter
eb07e68aa4 docs: add spec for telegram custom path wizard (no-AI path input) 2026-04-07 15:19:12 +07:00
0xmrpeter
d9e0a90be7 docs: add persistent assistant session design spec
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 01:04:17 +07:00
0xmrpeter
12e7af8da2 feat(telegram): add comprehensive UX improvements for Topics setup
- 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.
2026-04-05 22:37:35 +07:00
0xmrpeter
faf6286e12 fix(onboard): fix channel setup flow and normalize adapter plugin names
- 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>
2026-04-05 21:32:56 +07:00
Mr.Peter
179f36442d
refactor: remove legacy config sections and add plugin field declaration API (#208)
* 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>
2026-04-05 16:58:27 +07:00
0xmrpeter
9ea46457de feat: emit message:queued and message:processing events for cross-adapter input visibility
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>
2026-04-04 01:08:26 +07:00
0xmrpeter
69d73c981b docs: add file attachment API spec and implementation plan 2026-04-04 00:09:42 +07:00
0xmrpeter
e3f017e05d docs: add session list history spec and plan 2026-04-03 23:00:16 +07:00
0xmrpeter
1f0297cce5 Add multi-adapter session routing design spec
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>
2026-04-03 21:51:04 +07:00
0xmrpeter
0dbaa518cf fix: enhance session configuration handling and legacy support
- 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.
2026-04-03 19:03:04 +07:00
0xmrpeter
637d326ea8 fix(api): enhance input validation and security measures across routes
- 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>
2026-04-03 13:22:26 +07:00
0xmrpeter
ed3256a283 feat(conversation-history): implement conversation history tracking with middleware and type definitions 2026-04-03 09:54:37 +07:00
0xmrpeter
81d2184f4d docs: add plugins API spec and implementation plan
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 00:12:35 +07:00
0xmrpeter
3a01a50949 feat: enhance CLI instance commands and add POST /exchange route
- 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>
2026-04-02 21:46:31 +07:00
0xmrpeter
56e79875fe Merge branch 'develop' of github.com:Open-ACP/OpenACP into develop 2026-04-02 16:25:20 +07:00
0xmrpeter
9c74a3e9e0 docs: revise instances CLI and auth codes spec
- 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>
2026-04-02 16:22:35 +07:00
0xmrpeter
7b768c717d docs: add spec for instances CLI and auth code exchange
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>
2026-04-02 16:17:16 +07:00
0xmrpeter
943f8ab26c chore: move spec and plan to docs/superpowers/ 2026-04-02 15:27:55 +07:00
0xmrpeter
5dfac08605 Fix spec: callback data size limit, ns: dispatch flow
- 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>
2026-04-02 14:35:53 +07:00
0xmrpeter
2caeb4f750 Add spec: menu button & command dispatch fix
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>
2026-04-02 14:32:12 +07:00
0xmrpeter
7d53337f7a docs: add spec and implementation plan for tunnel + auth updates
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 20:22:57 +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
b8efcbca3f docs: add platform UI rendering section to config options spec
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>
2026-04-01 09:24:24 +07:00
0xmrpeter
227a3e0295 docs: add session config options design spec
Unified ACP config options to replace separate mode/model/dangerous fields.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 09:19:19 +07:00
0xmrpeter
2c335c0af9 docs: add instance directory grouping to core refactor spec
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>
2026-03-31 23:36:57 +07:00
0xmrpeter
57f1db002a docs: fix 5 issues found in core refactor spec self-review
- Phase 1b: Move lazyResume to SessionFactory (not SessionManager) to avoid circular dep
- Phase 1c: Keep adoptSession in core.ts — it's orchestration, not factory logic
- Phase 2a: Detail event-driven TTS approach — middleware + EventBus listener pattern
- Phase 3b: Security fails closed (deny all) when securityGuard missing, not open
- Phase 3c: Tunnel cleanup via session:afterDestroy middleware, not wireSideEffects

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 23:33:45 +07:00
0xmrpeter
8beddd18b5 docs: add core module refactor design spec
3-phase incremental refactor plan for src/core/:
- Phase 1: Split core.ts (929→350 lines) — extract AgentSwitchHandler, move lazy resume to SessionManager, move session creation variants to SessionFactory
- Phase 2: Clean session.ts (569→400 lines) — extract TTS/voice into speech plugin middleware
- Phase 3: Decouple plugin services — remove tunnel awareness from MessageTransformer, graceful service degradation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 23:31:08 +07:00
0xmrpeter
de2eebd35a docs: add startup UX design spec and implementation plan
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 18:14:29 +07:00
0xmrpeter
77daa3c8bc Merge remote-tracking branch 'origin/develop' into feat/api-server-redesign 2026-03-31 10:00:59 +07:00
0xmrpeter
6f99baba2a Merge remote-tracking branch 'origin/main' into feat/api-server-redesign 2026-03-31 10:00:21 +07:00
lngdao
55e0611249
docs: add one-liner install script spec and implementation plan (#105) 2026-03-31 09:58:44 +07:00
0xmrpeter
45ef9beda9 docs: add API server redesign specs and implementation plans
4 specs: API Server Core, Auth System, SSE Adapter, App Connectivity
4 plans: detailed TDD implementation plans for each spec
2026-03-31 01:26:23 +07:00
0xmrpeter
ab89febcae Slim down instance registry to minimal index
Registry only stores id + root path. All details (name, ports,
channels, mode, PID) are read from each instance's own config and
state files. This avoids stale data and keeps the registry simple.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 22:26:40 +07:00
0xmrpeter
f3d69229d1 Update spec: show parent directory in status, clarify port columns
- Status table Directory column shows parent path without .openacp suffix
- API and Tunnel port columns clearly labeled with actual port numbers
- Mode column shows daemon/fg/— for clarity

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 22:23:02 +07:00
0xmrpeter
dd849125eb Update spec: instance naming, copy progress, path UX improvements
- Add instance id (slug) and name to InstanceContext and Registry
- Paths in flags use parent dir, system appends .openacp internally
- Copy from any existing setup, not just global
- Show step-by-step progress with spinner during copy
- Status table includes id, name, mode, channels columns
- Add --name flag, status --id subcommand
- Clearer user-facing language throughout

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 22:22:20 +07:00
0xmrpeter
e5cf9ffa73 Update multi-instance spec: clone artifacts, source selection, full paths
- Clone now includes plugins/node_modules, agents/, bin/ directories
- Clone source can be any existing instance, not just global
- Add --from <path> CLI flag to specify clone source
- All prompts show full paths for clarity
- Show equivalent CLI command as tip after interactive selection

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 22:14:30 +07:00
0xmrpeter
9b3d26943d Add multi-instance support design spec
Defines architecture for running multiple OpenACP instances on the same
machine with independent config, sessions, ports, and lifecycle.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 22:04:56 +07:00
0xmrpeter
66eed520ce docs: add agent switch feature design spec
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 18:02:23 +07:00
0xmrpeter
e55307fa11 feat(diff): enhance line diff computation and update display specifications
- Introduced a new function `computeLineDiff` to accurately calculate line-level diffs by stripping common prefixes and suffixes, improving diff accuracy.
- Updated `MessageTransformer` to utilize the new diff computation for better metadata extraction.
- Enhanced `DisplaySpecBuilder` to include `inputContent` in the display specifications, allowing for inline display of raw input in high verbosity mode.
- Refined title generation logic to improve clarity and consistency in displayed titles across different contexts.
- Adjusted formatting functions to ensure proper display of input content and viewer links in tool cards.
2026-03-30 12:27:30 +07:00
0xmrpeter
81f9587a8c refactor(logging): streamline logging in agent-instance and activity tracker
- Refined logging in agent-instance to reduce verbosity by removing debug logs for raw input/output.
- Enhanced activity tracker logging to include viewer links for improved traceability.
- Updated .gitignore to exclude .log files from version control.
2026-03-30 09:56:04 +07:00
0xmrpeter
4114359f02 chore: update .gitignore and refine logging in agent-instance and activity tracker
- Added .log to .gitignore to exclude log files from version control.
- Removed debug logging for raw input/output in agent-instance to reduce verbosity.
- Enhanced logging in activity tracker to include viewer links for better traceability.
2026-03-30 09:52:42 +07:00
0xmrpeter
8987822032 docs: update review findings with fix status 2026-03-28 01:28:52 +07:00
0xmrpeter
9038102d46 fix: critical code fixes from codebase logic review
Session state machine:
- Guard processPrompt for finished state (prevents double-throw crash)
- Add cancelled to valid transitions from error state
- Wrap abortPrompt in try-catch in cancelSession (agent may be dead)
- Set session.threadId before createSession in lazy resume
- Skip cancelled sessions in lazy resume (spawn fresh instead)
- Backup corrupt sessions.json as .bak before starting empty

Error handling & stability:
- Validate config before writing to disk (prevents bricking on restart)
- Close session logger file descriptors on destroy
- Clean up spinner/logger on plugin boot failure
- Catch sendMessage middleware errors (prevent unhandled rejections)
- Unref permission gate timeout timer (unblock graceful shutdown)

Adapter primitives:
- Remove thinking indicator on maxThinkingDuration exceeded
- Remove draft from map after finalize in shared DraftManager
- ToolCardState appendUsage uses scheduleFlush instead of immediate flush
- Node stream adapters: add close/cancel/abort handlers

CLI/API field fixes:
- Fix CLI api session field access (.session wrapper + correct field names)
- Fix CLI api health field access (uptime in ms, memory.rss, tunnel object)
- Use AgentCatalog.resolve() in API sessions route instead of config.agents

TTS:
- Move voiceMode "next" reset after successful prompt (preserve on error)
2026-03-28 01:10:21 +07:00
0xmrpeter
7f00232681 refactor: improve command unregistration and enhance error handling in agent events
- Updated `unregister` method to simplify command removal logic.
- Enhanced error handling in `AgentInstance` for event processing and subprocess termination.
- Added sorting of middleware handlers upon registration in `MiddlewareChain`.
- Improved `PermissionGate` to reject previous pending requests when a new one is set.
- Enhanced `NotificationManager` to handle notification failures gracefully without crashing the caller.
2026-03-27 22:39:54 +07:00
0xmrpeter
c3691909b8 refactor(speech): remove Edge TTS integration and related tests; update TTS provider handling
- Removed the Edge TTS provider implementation and its associated tests.
- Updated the SpeechService to support dynamic registration and unregistration of TTS providers.
- Enhanced the speech plugin to install the Edge TTS plugin dynamically if not already available.
- Adjusted configuration to exclude specific test directories and removed unnecessary dependencies from package.json.
2026-03-27 21:24:39 +07:00
Rex DEV
ce15c30d2b
fix(formatting): always show plan regardless of verbosity (#81)
* fix(formatting): wire rawInput + display* fields through both adapters

- Add rawInput, displaySummary, displayTitle, displayKind to Discord
  adapter tool call/update meta construction (were missing after reset)
- Add displaySummary, displayTitle, displayKind to Telegram adapter
  (rawInput was already present)
- Update existing tests to pass "high" for full-detail assertions
  (default changed to "medium" which returns compact output)

Entire-Checkpoint: e0737b6c7432

* fix(formatting): preserve display* on tool edit, cleanup duplication

- Store displaySummary/displayTitle/displayKind in ToolCallState
  so they survive from tool_call to tool_call_update edit
- Merge with ?? fallback: update fields take precedence over stored
- Telegram formatToolUpdate delegates to formatToolCall (like Discord)
- Remove unused STATUS_ICONS/KIND_ICONS imports from platform formatters

Entire-Checkpoint: 5afc4b23e3ed

* fix(formatting): always show plan regardless of verbosity level

Plan messages were hidden when displayVerbosity was set to "low".
Removed "plan" from HIDDEN_ON_LOW set and added low verbosity
handling in Discord/Telegram formatPlan to show summary count.

Entire-Checkpoint: 25f61b05a8f3

* fix(telegram): handle low verbosity in PlanCard formatPlanCard

PlanCard uses its own formatPlanCard() instead of the shared
formatPlan() from formatting.ts. The low verbosity case was
missing, causing it to fall through to high detail mode.

Entire-Checkpoint: ad8701fddbdc

* fix(formatting): plan always shows full entries regardless of verbosity

Remove verbosity branching from formatPlan — plan always renders
the full entry list with status icons. Previously low/medium showed
only a summary count. Also fix Telegram PlanCard formatPlanCard
which had the same issue.

Entire-Checkpoint: ec946aa88fa1

* docs: add consolidated tool card design spec

Entire-Checkpoint: 41ede6b49d70

* docs: update tool card spec with review decisions (v2)

Entire-Checkpoint: c49386e3cfc2

* docs: update tool card verbosity tiers — full list on all levels (v3)

Entire-Checkpoint: 075290d470e5

* docs: viewer links shown on all verbosity levels (v4)

Entire-Checkpoint: cbc26f5db2c4

* docs: add grep to noise filter rules

Entire-Checkpoint: 2b8dbb47e518

* docs: add consolidated tool card implementation plan

Entire-Checkpoint: 2baf2ed990bc

* feat(formatting): add grep to noise filter, change glob to hide

Entire-Checkpoint: 5d880ff51b85

* feat: add ToolCardState for consolidated tool card

Entire-Checkpoint: 31469436e6e5

* feat(discord): add renderToolCard formatter

Entire-Checkpoint: 1c21fec9dc31

* feat(telegram): add renderToolCard formatter

Add renderToolCard() to Telegram formatting that renders tool card snapshots
as HTML (bold headers, escaped labels, anchor viewer links, plan section,
usage footer). Add corresponding tests covering all output behaviors.

Entire-Checkpoint: 643c26444277

* feat(discord): wire ToolCard into ActivityTracker

Entire-Checkpoint: 018413b14f8d

* feat(telegram): wire ToolCard into ActivityTracker

Entire-Checkpoint: 22d59ca7c6f5

* refactor: delete deprecated platform ToolCallTrackers

Entire-Checkpoint: c5c4b3ac6239

* docs: update message format reference for consolidated tool card

Entire-Checkpoint: f211f739e728

* fix(tool-card): guard empty render, fix falsy usage check, make destroy terminal

- Skip send/edit when renderToolCard returns empty string (prevents API
  errors for sessions that end with no tool calls)
- Fix tokensUsed check from falsy to != null in both Discord and Telegram
  renderToolCard so tokensUsed=0 is not silently hidden
- Set finalized=true in ToolCardState.destroy() to make it terminal and
  prevent post-destroy mutations

Entire-Checkpoint: de056e6643c9

* fix(tool-card): put viewer links on new line for better readability

Entire-Checkpoint: 4ce2b139ecbd

* fix(tool-card): always show usage stats, use formatUsage with verbosity

- sendUsage() no longer skips when no tool content — standalone usage
  message is sent for text-only responses
- renderToolCard uses formatUsage() so progress bar and cost appear
  according to verbosity (high verbosity shows progress bar + %)
- Separator line only rendered when there are tool entries above it
- Update test to assert standalone usage message behavior

Entire-Checkpoint: b55f5bc768c0

* fix(telegram): edit thinking message instead of sending new ones

Entire-Checkpoint: 4f47ffddcdb4

* fix(formatting): recognize Terminal tool name, show command in summary

Entire-Checkpoint: 1c66813043ae

* fix(formatting): show play icon for Terminal tool with no command

Entire-Checkpoint: 46c93d01eee8

---------

Co-authored-by: Leo Agent <bigbearman078@mgail.com>
2026-03-27 18:30:31 +07:00
dylan-112
1cb9b38388
feat: extract Discord plugin to standalone package
* fix(api): respect channel param in POST /api/sessions (#76)

Session creation always used the first registered adapter. Add optional
`channel` field so callers can target a specific platform (e.g. discord).
Falls back to first-adapter behavior when omitted for backward compat.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(api): wire --channel flag in CLI and assistant prompts (#76)

The API endpoint accepted `channel` but the CLI `openacp api new` didn't
pass it through. Add --channel flag to CLI and update Discord/Telegram
assistant prompts to include --channel so sessions are created on the
correct platform.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 27c1f141d0c1

* docs: add session cleanup feature design spec

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 8de760ac911e

* docs: address spec review feedback for session cleanup

- Reference existing TopicManager and archiveSession() instead of reimplementing
- Add parseDuration utility for --older-than flag
- Fix API route collision (/api/cleanup/ instead of /api/sessions/cleanable)
- Add CleanupFlowState for Telegram selection state with TTL
- Clarify default filter excludes active/initializing
- Add archiving flag edge case to test plan

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 98610f1a27c8

* docs: add design spec for extracting Discord plugin to standalone package

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 10f437186acf

* docs: address spec review feedback for Discord plugin extraction

- Fix npm scope to @openacp (not @open-acp) for consistency
- Fix peerDependency version to match date-based versioning
- Move misclassified exports to "Need to add" section
- Add ConfigManager, AgentCatalog, requestRestart to SDK exports list
- Add essential: false, pluginDependencies notes
- Add tsconfig.json template
- Add exports field and .npmignore to package.json
- Add runAdapterConformanceTests to SDK testing exports
- Add legacy migration map update for backward compat
- Add boot order note for pluginDependencies

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: c5db89eae6aa

* docs: add implementation plan for extracting Discord plugin

9 tasks: extend CLI exports, extend SDK, migration map, scaffold
project, copy+refactor source, verify build, remove from OpenACP,
update README, push repos.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: a54a5510736a

* feat(core): export format-utils, message-formatter, CommandRegistry, Doctor, PRODUCT_GUIDE for plugin SDK

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 27b04551e9a7

* feat(plugin-sdk): export all symbols needed by adapter plugins

Entire-Checkpoint: a1ed33612eb6

* fix(plugin): add @openacp/plugin-discord migration alias for backward compat

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: a9db7beb2975

* fix(sdk): add missing adapter-primitive exports and testing entry point

- Add MessagingAdapterConfig, IRenderer, RenderedMessage type exports to src/core/index.ts
- Add DisplayVerbosity, ToolCallMeta, ToolUpdateMeta, ViewerLinks type exports
- Add STATUS_ICONS, KIND_ICONS, progressBar, formatTokens, truncateContent, stripCodeFences, splitMessage exports
- Add extractContentText, formatToolSummary, formatToolTitle, resolveToolIcon exports
- Create src/testing.ts as a separate entry point exporting runAdapterConformanceTests
- Add ./testing export map to @openacp/cli package.json
- Fix @openacp/plugin-sdk/testing.ts to import from @openacp/cli/testing
- Fix version strings to use valid semver (2026.326.4 not 2026.0326.4)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: restore original version format YYYY.MMDD.patch

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: remove built-in Discord plugin (now available as @openacp/plugin-discord)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(plugin): resolve 3 bugs preventing dev plugins from loading

- lifecycle-manager: include already-loaded plugins in dependency resolution
  so late-booted dev plugins aren't cascade-skipped
- dev-loader: use URL query string for ESM cache busting instead of copying
  to temp dir, which broke relative imports (e.g., './adapter.js')
- adapter-primitives: remove runAdapterConformanceTests from main barrel
  to prevent vitest from leaking into runtime bundle

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 64f604573bb7

* fix(review): address PR #80 code review feedback

- Remove core→plugin-discord import in config-editor (architecture violation):
  inline Discord token validation using REST API /users/@me instead of
  importing from @openacp/plugin-discord/validators
- Mark legacyMap in lifecycle-manager as @deprecated with migration notes
- Remove 98 planning artifacts from docs/superpowers/ (72k+ lines)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: cdeeaa98a4f1

* Revert "fix(plugin): resolve 3 bugs preventing dev plugins from loading"

This reverts commit 031464640560628dd8c093a4d8d30895c775ef98.

Entire-Checkpoint: 6ed1a02a0cb5

* Reapply "fix(plugin): resolve 3 bugs preventing dev plugins from loading"

This reverts commit 5707bf1c240f52baab277d21333cd7d92c191fac.

Entire-Checkpoint: bfaaa263a765

* revert: restore docs/superpowers/ plans and specs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 9195220e9172

* fix(review): revert unrelated changes and organize SDK sub-paths

- Revert --channel flag, assistant prompt changes, and session route
  changes that don't belong in Discord extraction PR (#82)
- Add SDK sub-path exports: @openacp/plugin-sdk/formatting,
  @openacp/plugin-sdk/config (alongside existing /testing) (#83)
- Mark SDK exports as @stable vs @experimental
- Fix plugin count test (10 → 9 after Discord removal)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 9bd5c44d98c4

* fix(review): address round 2 feedback on PR #80

- Rename @openacp/plugin-discord → @openacp/adapter-discord in all refs
  (setup-channels, wizard, lifecycle-manager, docs)
- Keep @openacp/plugin-discord as legacy alias in lifecycle-manager
- Remove unrelated session-cleanup-design.md spec from PR
- SDK: deduplicate main barrel by re-exporting from sub-path modules

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 4454289e400f

* fix(review): remove remaining Discord references from core

- Remove Discord doctor check from core (plugin registers its own)
- Dynamic adapter discovery via ServiceRegistry instead of hardcoded list
- Remove @openacp/discord from auto-register built-in plugins list

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: c15c5fbf08c8

* fix(config): auto-install Discord plugin when enabling via config editor

When user enables or configures Discord through `openacp config` (not
onboarding), check if @openacp/adapter-discord is installed. If not,
prompt to install it automatically via npm.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: dd218c585ae3

* fix(review): round 3 cleanup — extensible ChannelId, update CLAUDE.md

- Change ChannelId from fixed union to string for extensibility
- Remove discord/ from CLAUDE.md project layout (now external plugin)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 66d8d185cda7

* fix(review): resolve all remaining Discord coupling in core

- Remove DiscordPlatformData from core types (plugin defines its own)
- Remove DiscordPlatformData from SDK re-exports
- Config editor: delegate Discord config to plugin configure() instead
  of 100+ lines of inline Discord logic
- Update integrate.ts help text to be adapter-agnostic
- Clean absolute local paths from planning docs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 094cc484aaae

* fix: replace execSync npm install with async utility

Extract installNpmPlugin() into a shared utility that uses async exec
instead of execSync, preventing event loop blocking. Used by both
config-editor.ts and wizard.ts instead of inline execSync calls.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: 0xmrpeter <0xmrpeter@gmail.com>
2026-03-27 16:05:50 +07:00
0xmrpeter
14fb687172 docs: convert remaining docs to English
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 10:58:35 +07:00