Commit Graph

16 Commits

Author SHA1 Message Date
Бородин Роман fff0213666 fix: keep lock file after cleanup so client always skips
Server holds the lock even after cleanup. Client always sees the lock
and skips bot startup. On crash, stale PID is detected and lock is
cleaned up automatically.
2026-09-26 00:20:51 +03:00
Бородин Роман bf61b1ef1f feat: use storagePath config for plugin data directory
All plugin files (lock, logs) now live under the configured storage
path (default ~/.local/share/opencode-matrix-bot/plugin-data),
matching matrix-client.ts behavior. No extra directories created.
2026-09-26 00:17:33 +03:00
Бородин Роман a5dda163ea fix: use fixed plugin data dir so mutex lock is shared across instances
mkdtemp creates unique dirs per process, breaking the mutex.
Use a fixed path ~/.opencode-matrix-plugin/ instead.
2026-09-26 00:13:56 +03:00
Бородин Роман e4ae5ff997 chore: move plugin files from /tmp to home directory
Replace /tmp/opencode-matrix-plugin/* with ~/.opencode-matrix-plugin-*
to support systems without /tmp (e.g. Termux on Android).
2026-09-26 00:12:27 +03:00
Бородин Роман f981998ab8 fix: prevent double Matrix bot startup (server + client)
OpenCode V2 loads plugins in both the background server and the client.
Add a file-based mutex (/tmp/opencode-matrix-plugin.lock) so only the
first instance (server) starts the Matrix bot. The second instance
(client) detects the lock and returns a no-op cleanup.
2026-09-26 00:09:28 +03:00
Бородин Роман 51b98e02a5 refactor: remove V1 code, plugin is V2-only now
- Remove isV2Context() detection and all V1 branches
- Remove sdkClient parameter and V1 SDK polling logic
- Remove extractContent/formatMessage helpers (V1-only)
- Remove sentMessageIds dedup map (V1-only)
- Remove v1Server() entry point and server() export
- Remove encodeSessionId() from session-manager
- Remove crypto dependency
- Simplify help text (no mode info)
- Session ID now uses roomId:threadRootId directly
2026-09-25 23:24:12 +03:00
Бородин Роман 2f17001f2a chore: exclude plugins/ from git — symlinks only needed for local dev 2026-09-25 23:18:10 +03:00
Бородин Роман 6199f75c4e fix: restore plugins/matrix-plugin/ path structure for OpenCode V2 plugin loading
- Add plugins/matrix-plugin/ directory with symlinks to root files
  (OpenCode V2 resolver appends path suffix after symlink resolution)
- Rename plugin id from 'opencode-matrix' to 'matrix-plugin'
2026-09-25 23:15:29 +03:00
Бородин Роман 5fdb2510b4 правильная организация директории плагина 2026-09-25 22:16:45 +03:00
Бородин Роман 26e28361cc feat: separate reasoning blocks in responses
- Extract reasoning/thinking parts from response parts
- Wrap reasoning in Markdown details/summary collapsible
- Add horizontal divider between reasoning and main text
- Log part types for debugging
2026-09-25 18:03:53 +03:00
Бородин Роман cae866fec6 docs: add config comments to example, update README with ignoreRooms/ignoreUsers
- Add inline comments to matrix.json.example
- Add ignoreRooms and ignoreUsers to config table
- Add config priority section
- Add example config usage instructions
2026-09-25 17:34:32 +03:00
Бородин Роман 267f60a55c docs: update README with V1/V2 support, trigger behavior, session management 2026-09-25 16:18:13 +03:00
Бородин Роман ce4ee83ca2 fix: respect triggerPatterns config, allow all messages when empty
- Check all trigger patterns, not just first one
- When triggerPatterns is empty, intercept all messages
- When configured, only process trigger/mention/thread-reply messages
- Remove DM auto-intercept when triggers are set
2026-09-25 16:15:18 +03:00
Бородин Роман 7db5bc6989 refactor: remove session expiry, add syncWithOpenCode
- Remove expireInactive and startExpiryLoop
- Add syncWithOpenCode() to prune orphaned sessions
- Add logging for session map file path and load count
2026-09-25 15:44:33 +03:00
Бородин Роман 01bf23543a docs: add example config files 2026-09-25 15:23:24 +03:00
Бородин Роман 63853de81f feat: add matrix plugin with V1/V2 SDK support
- Dual V1/V2 plugin export pattern
- Session persistence via ~/.opencode-matrix-sessions.json
- Thread-to-session mapping with deterministic IDs
- Matrix bot integration with E2EE support
- Config from matrix.json or environment variables
2026-09-25 15:22:20 +03:00