776 Commits

Author SHA1 Message Date
0xmrpeter
16e0884354 fix(output-mode): wire outputViewerLink, fix verbosity callback key, update docs
- DisplaySpecBuilder: add TunnelServiceInterface constructor injection, implement
  outputViewerLink/outputFallbackContent for long output (>15 lines or >800 chars)
- DisplaySpecBuilder: fix buildThoughtSpec indicator to "Thinking..."
- ActivityTracker: store and pass tunnelService to DisplaySpecBuilder, pass sessionContext
  to all buildToolSpec calls
- setupVerbosityCallbacks: write outputMode instead of deprecated displayVerbosity key
- /verbosity static command description updated to note deprecation
- Docs: update displayVerbosity → outputMode across configuration, chat-commands,
  troubleshooting, and architecture docs; add /outputmode command reference
2026-03-30 01:52:51 +07:00
0xmrpeter
646c2d8812 fix(output-mode): fix verbosity callback toast text to say output mode 2026-03-30 01:38:22 +07:00
0xmrpeter
617b94b865 feat(output-mode): add /outputmode command with session-level override
Adds /outputmode [low|medium|high] for adapter-level config and /outputmode session [low|medium|high|reset] for per-session override. Deprecates /verbosity as an alias that forwards to /outputmode. Prefixes unused verbosity params in adapter.ts with underscore to suppress TS warnings.
2026-03-30 01:35:10 +07:00
0xmrpeter
72b675d85f feat(output-mode): filter before serial queue, OutputModeResolver cascade, pass content through tool updates
- Add OutputModeResolver field to TelegramAdapter; resolve mode per-call in handleToolCall, handleToolUpdate, handleThought, handleText, handlePlan instead of forwarding raw DisplayVerbosity
- Update getOrCreateTracker signature from verbosity: DisplayVerbosity to outputMode: OutputMode; pass tunnelService and sessionContext to ActivityTracker constructor
- Pass content, rawInput, and diffStats through onToolUpdate calls so ActivityTracker receives full update payload
2026-03-30 01:30:44 +07:00
0xmrpeter
7bc6215825 fix(tests): update old tool-card-state tests to use new updateFromSpec API
Replace addTool/updateTool/verbosity calls with updateFromSpec(ToolDisplaySpec),
update snapshot field references (entries→specs, hidden→isHidden, visibleCount→totalVisible),
and remove the verbosity config param that was removed from ToolCardStateConfig.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 01:27:18 +07:00
0xmrpeter
210c4927ed fix(output-mode): add sessionContext param to ActivityTracker constructor
Adds sessionContext field and constructor parameter to ActivityTracker,
renames _tunnelService to tunnelService for clarity.
2026-03-30 01:24:33 +07:00
0xmrpeter
515f68791e feat(output-mode): integrate ToolStateMap + DisplaySpecBuilder into ActivityTracker
Rewrites activity.ts to use ToolStateMap for tool state tracking and
DisplaySpecBuilder for spec-driven rendering, removing all @ts-ignore
suppressions and as-any casts added in Task 7. Updates activity.test.ts
to match the new API (updateFromSpec instead of addTool/updateTool,
onThought takes a text param, ToolCard constructor drops verbosity arg).
Also fixes adapter.ts to pass thought text to onThought().
2026-03-30 01:21:27 +07:00
0xmrpeter
69797b1b05 feat(output-mode): update renderToolCard for ToolDisplaySpec[], fix splitToolCardText overflow bug
Replaces the old entries-based renderToolCard implementation with one that
reads from snap.specs (ToolDisplaySpec[]), rendering icon, title, description,
command, outputSummary, outputContent, diffStats, and viewer links per spec.
Fixes splitToolCardText to truncate single sections larger than 4096 chars
instead of passing them through untruncated. Updates formatting-extended tests
to use the new ToolDisplaySpec/specs API.
2026-03-30 01:14:26 +07:00
0xmrpeter
f302d3ee7c feat(output-mode): refactor ToolCardState to store ToolDisplaySpec[] via updateFromSpec()
Replaces ToolCardEntry[]/addTool/updateTool with ToolDisplaySpec[]/updateFromSpec.
Updates primitives/index.ts to export ToolDisplaySpec instead of removed ToolCardEntry.
Adds @ts-ignore suppressions in activity.ts and formatting.ts as temporary bridge until Tasks 8/9.
2026-03-30 01:06:23 +07:00
0xmrpeter
28c1745cae feat(output-mode): add ViewerStore output type, /output/:id route, tunnel outputUrl
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 01:01:00 +07:00
0xmrpeter
7b44367570 feat(output-mode): compute diffStats in enrichWithViewerLinks
Adds net line count change (added/removed) to metadata.diffStats when
a diff is stored, so consumers can display file change statistics.
2026-03-30 00:57:35 +07:00
0xmrpeter
b228b81ab7 fix(output-mode): validate OutputMode values, add missing sessionManager test 2026-03-30 00:56:25 +07:00
0xmrpeter
7bad063f25 feat(output-mode): add OutputModeResolver (cascade global → adapter → session) 2026-03-30 00:54:50 +07:00
0xmrpeter
2386dbeaad fix(output-mode): add TODO for deferred viewer links, add boundary tests 2026-03-30 00:53:19 +07:00
0xmrpeter
3e4033727a feat(output-mode): add DisplaySpecBuilder with ToolDisplaySpec computation
Implements DisplaySpecBuilder that derives ToolDisplaySpec and ThoughtDisplaySpec
from a ToolEntry + OutputMode. Controls title logic per kind, output inlining
threshold (≤15 lines AND ≤800 chars for high mode only), noise hiding, and
diffStats pass-through. 14 tests, all green.
2026-03-30 00:51:05 +07:00
0xmrpeter
99ca58ae6b fix(output-mode): merge returns undefined for out-of-order, fix test helper 2026-03-30 00:48:53 +07:00
0xmrpeter
0f199c9948 feat(output-mode): add StreamAccumulator (ToolStateMap + ThoughtBuffer)
Implements ToolStateMap for accumulating ACP tool_call/tool_call_update
events with out-of-order delivery support, and ThoughtBuffer for
streaming thought chunk accumulation across turns.
2026-03-30 00:46:04 +07:00
0xmrpeter
f5b52d6166 fix: use top-level import type for OutputMode in types.ts 2026-03-30 00:43:58 +07:00
0xmrpeter
a354b15bf8 feat(output-mode): add OutputMode type, SessionRecord field, config schema + migration
Add OutputMode type as the new standard output mode type (replacing DisplayVerbosity
usage pattern). Maintain DisplayVerbosity as deprecated alias for backward compatibility.
Add outputMode to SessionRecord, channel config schema, and global config schema.
Add migration to auto-migrate displayVerbosity to outputMode in channel configs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 00:39:10 +07:00
0xmrpeter
5394aeca77 chore: ignore .worktrees/ directory 2026-03-30 00:37:13 +07:00
0xmrpeter
7c8c10f51b feat: add OPENACP_DEBUG trace logging (3 JSONL files per session)
When OPENACP_DEBUG=true, writes per-session trace files to <workingDir>/.log/:
- <sessionId>_acp.jsonl — raw ACP JSON-RPC protocol (stdin/stdout)
- <sessionId>_core.jsonl — core event pipeline (agent_event → middleware → transform → dispatch)
- <sessionId>_telegram.jsonl — all Telegram UI actions (handlers, tracker, tool card, draft, API calls)

DebugTracer utility with lazy dir creation, appendFileSync writes, zero overhead when disabled.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 21:29:09 +07:00
0xmrpeter
e318bcba46 fix: tool card display issues — serial dispatch, overflow editing, thinking cleanup
- Serialize per-session message dispatch to prevent out-of-order event processing
  (tool_update arriving before tool_call due to concurrent fire-and-forget dispatch)
- Buffer tool updates that arrive before their tool_call and apply on addTool
- Allow post-finalize tool updates to flush immediately (late completion after seal)
- Track overflow message IDs and edit them instead of only sending once
- Forward tool updates to previous sealed card for late completions
- Count failed/error tools as done in header (Tools N/N ✅)
- Stop deleting thinking indicator messages to reduce Telegram API calls

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 19:50:15 +07:00
0xmrpeter
c7913ff67b fix: remove phantom @openacp/usage registration and guard readdirSync
- Remove @openacp/usage from builtin plugin lists (plugin was extracted
  but registration entries remained, causing silent failures on first boot)
- Guard fs.readdirSync(nodeModulesDir) with existsSync check to prevent
  crash when community plugins are registered but node_modules/ missing
- Clean up onboard.ts: remove redundant duplicate imports and local constants

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 17:47:14 +07:00
0xmrpeter
10a7bd8c73 merge: integrate fix/setup-wizard-plugin-init into develop
Combines setup wizard fixes (settingsManager/pluginRegistry passing,
ESM plugin resolution, path centralization) with develop's shell
injection validation and community adapter flow. Adds error handling
and tests for importFromDir.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 17:42:42 +07:00
0xmrpeter
e190ff64a2 fix: add error handling and tests for importFromDir
Wrap package.json parsing with descriptive error messages and validate
entry point exists before importing. Add 7 unit tests covering all
resolution paths and error cases.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 17:40:09 +07:00
0xmrpeter
a56120d114 chore: bump version to 2026.328.2 v2026.328.2 2026-03-28 07:48:55 +07:00
0xmrpeter
428e343ea8 Merge branch 'develop' 2026-03-28 07:44:40 +07:00
0xmrpeter
cafd8947f4 chore: bump version to 2026.328.1 v2026.328.1 2026-03-28 07:44:10 +07:00
0xmrpeter
ca20290c63 Merge branch 'fix/codebase-logic-review' into develop 2026-03-28 07:43:59 +07:00
0xmrpeter
08bbc6b134 revert: remove usage plugin (extracted to external package) 2026-03-28 01:39:24 +07:00
0xmrpeter
c60a320c18 fix: address code review feedback
- Remove redundant threadId assignment in lazy resume (already set via createSession param)
- Wrap patchRecord in archive with try-catch (topic already recreated, store update is best-effort)
- Add edge case comment in stripPattern for slow TTS synthesis
2026-03-28 01:38:08 +07:00
0xmrpeter
8987822032 docs: update review findings with fix status 2026-03-28 01:28:52 +07:00
0xmrpeter
0bc34ca93e feat: usage tracking plugin and tunnel command improvements
Usage plugin (F18):
- Create src/plugins/usage/ with UsageStore, UsageBudget
- Listen to usage:recorded events, buffer with debounced flush
- Budget checking with warning/exceeded notifications (dedup)
- /usage command showing monthly spending summary
- 26 tests for store and budget logic
- Registered in core-plugins

Tunnel commands (F24):
- /tunnel <port> [label] creates user tunnels
- /tunnel stop <port> stops user tunnels
- /tunnels lists all active tunnels with details

Resume (F7):
- Added TODO for over-budget interactive selection
2026-03-28 01:28:00 +07:00
0xmrpeter
18c590d719 fix: archive topic recreation and tts_strip event
Archive rewrite (F3+F4):
- Archive now keeps agent alive and recreates topic instead of killing session
- Flow: delete old topic → create new topic → rewire session.threadId
- Session stays in memory and store with updated topicId
- Validates session state (must be active, not initializing)
- Rejects non-session topics with guidance message
- Tests updated to verify new behavior

TTS strip (F10):
- Add tts_strip AgentEvent type
- Emit tts_strip after successful TTS synthesis
- SessionBridge dispatches to adapter.stripTTSBlock()
- Telegram DraftManager retains finalized drafts for post-finalize strip
- [TTS]...[/TTS] block removed from visible message after audio sent
2026-03-28 01:20:58 +07:00
0xmrpeter
270ab52ba2 fix: TTS voiceMode, ThinkingIndicator cleanup, settings validation
TTS fixes (F11+F12):
- /tts command now sets session voiceMode via kernel:access
- /tts on/off/next all work across adapters (not just Telegram)
- ttsProvider read from plugin config instead of hardcoded edge-tts

ThinkingIndicator fixes (F13+C17):
- dismiss() now deletes the Telegram message instead of just clearing state
- show() deletes just-sent message if dismissed during SendQueue wait

Plugin system (F22):
- Settings validation against settingsSchema enforced at boot
- Invalid settings prevent plugin from booting (marked as failed)
2026-03-28 01:16:01 +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
1a2c267fa2 Merge branch 'develop' of github.com:Open-ACP/OpenACP into develop 2026-03-27 23:53:44 +07:00
0xmrpeter
8df3e764c6 refactor: enhance session management and message formatting in Telegram plugin
- Updated session management to persist session state without terminating agent subprocesses.
- Renamed `destroyAll` to `shutdownAll` for clarity in session handling.
- Improved message formatting in the Telegram plugin to split tool card text into manageable chunks.
- Adjusted usage reporting to send as a separate message rather than appending to tool cards.
- Updated tests to reflect changes in usage handling and message formatting.
2026-03-27 23:52:43 +07:00
0xmrpeter
291d8c8899 fix: enhance session management and error handling across components
- Implemented logic to ensure sessions are properly removed from memory upon cancellation.
- Updated session lifecycle to auto-activate from cancelled or error states when processing prompts.
- Improved error handling in `SessionBridge` for message sending and agent event processing.
- Added cleanup functionality in `FileService` to remove old session files on startup.
- Enhanced `ConfigManager` to return a clone of the configuration object, preventing unintended mutations.
- Refined command unregistration to ensure both short and qualified names are removed.
- Introduced tests for new functionalities and improved existing test coverage.
2026-03-27 23:09:50 +07:00
Mr.Peter
988caae265
Merge pull request #100 from Open-ACP/fix/codebase-logic-review
Fix/codebase logic review
2026-03-27 22:44:24 +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
c49d7ec397 chore: bump version to 2026.0327.6 v2026.0327.6 2026-03-27 21:32:08 +07:00
Mr.Peter
cf67b9cfa4
Merge pull request #98 from Open-ACP/redesign/microkernel-plugin-architecture
feat: microkernel plugin architecture redesign
2026-03-27 21:30:38 +07:00
0xmrpeter
3c753fcad8 fix: persist plugin registry in wizard and use static metadata for plugin discovery
- Save community plugin registrations after setup wizard loop
- Replace dynamic import-based plugin name matching with static
  openacp.pluginName field lookup in package.json (no code execution)
2026-03-27 21:29:47 +07:00
Mr.Peter
a42ea1f069
Merge pull request #97 from EthanMiller0x/feat/extract-slack-plugin
feat: extract Slack adapter to standalone plugin
2026-03-27 21:26:23 +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
EthanMiller0x
a048dd637d fix: register failed community plugins as disabled instead of enabled
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 20:53:16 +07:00
EthanMiller0x
e560f3a5c8 chore: remove plan file from PR (working artifact with local paths)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 19:55:50 +07:00
EthanMiller0x
6698661812 fix: address code review feedback (security, consistency, cleanup)
- Replace execSync with execFileSync to prevent command injection
- Filter plugin scan by keywords/scope before importing to avoid executing arbitrary code
- Fix basePath inconsistency in setup-channels.ts (use plugins/data)
- Remove dangling Slack references from admin menu and ADAPTER_SCOPES
- Log warning instead of silently swallowing errors in configureViaPlugin
- Remove duplicate imports in onboard.ts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 19:55:16 +07:00
EthanMiller0x
68ca2e4c78 fix: community plugin loading, settings path, and onboard init
- Load community plugins from registry on startup (main.ts)
- Fix path resolution for local and npm plugins (absolute paths, ESM entry point)
- Scan node_modules when plugin name differs from npm package name
- Align settings basePath to ~/.openacp/plugins/data/ across all CLI commands
- Initialize plugin system in onboard command
- Add debug logging for settings resolution in lifecycle-manager

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 19:14:56 +07:00