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.
This commit is contained in:
Бородин Роман 2026-09-26 00:13:56 +03:00
parent e4ae5ff997
commit a5dda163ea
1 changed files with 4 additions and 1 deletions

View File

@ -5,7 +5,10 @@ import { SessionManager } from "./session-manager.js"
import { loadConfig } from "./config-loader.js"
import { log } from "./logger.js"
const PLUGIN_DATA_DIR = fs.mkdtempSync(`${os.homedir()}/.opencode-matrix-plugin-`)
const PLUGIN_DATA_DIR = `${os.homedir()}/.opencode-matrix-plugin`
if (!fs.existsSync(PLUGIN_DATA_DIR)) {
fs.mkdirSync(PLUGIN_DATA_DIR, { recursive: true })
}
const LOG_FILE = `${PLUGIN_DATA_DIR}/plugin.log`
const SETUP_STARTED_LOG = `${PLUGIN_DATA_DIR}/setup-started.log`
const SETUP_ERROR_LOG = `${PLUGIN_DATA_DIR}/setup-error.log`