Бородин Роман
bee794204b
simplify logger: fixed path ~/.opencode-matrix-plugin/, no fallback
...
logger.ts теперь всегда пишет в ~/.opencode-matrix-plugin/plugin.log.
setLogDir() стал no-op, удалён из index.ts.
Нет больше /tmp и fallback-файлов.
2026-09-26 00:33:00 +03:00
Бородин Роман
b5bc06e722
fix: call setLogDir() before loadConfig() so all logs go to storagePath
...
loadConfig() вызывал log() до setLogDir() — писался в /tmp.
Теперь setLogDir() вызывается в v2Setup() до loadConfig().
2026-09-26 00:30:23 +03:00
Бородин Роман
e30bdd50e7
fix: move 'Plugin module loaded' log inside runPlugin
...
Раньше log() вызывался на уровне модуля, до setLogDir() — писался в /tmp.
Теперь лог внутри runPlugin() — после setLogDir(), только в storagePath.
2026-09-26 00:25:31 +03:00
Бородин Роман
a43f4838ef
fix: move plugin.log to storagePath via setLogDir()
...
logger.ts теперь поддерживает настраиваемый каталог логов.
runPlugin() вызывает setLogDir(dataDir) при старте.
Лог больше не пишется в /tmp.
2026-09-26 00:22:32 +03:00
Бородин Роман
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
Бородин Роман
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