Commit Graph

4 Commits

Author SHA1 Message Date
Бородин Роман 4294e30f76 fix: move all imports to dynamic to defer matrix-bot-sdk loading
ES modules evaluate ALL static imports before any code executes.
ensureNativeBinary() was called but matrix-bot-sdk was already
loaded by the time it ran.

Solution: all imports are now dynamic (await import()). The setup
function calls ensureNativeBinary() first, then dynamically loads
everything else including matrix-bot-sdk transitively.

Changes:
- Remove all static imports from index.ts
- Move ensureNativeBinary() into async setup()
- Pass log/logError as parameters to runPlugin
- Make parseCodeModeTools async for dynamic acorn imports
- Add import type for MatrixEventContext (erased at compile time)
2026-09-30 22:41:29 +03:00
Бородин Роман 8dae9656b8 fix: use dynamic imports for matrix-bot-sdk to defer loading
ES modules hoist all static imports before any code executes, so
matrix-bot-sdk was loaded BEFORE ensureNativeBinary() could download
the native binary. Using dynamic imports inside runPlugin ensures
the binary is downloaded first.
2026-09-30 22:08:26 +03:00
Бородин Роман 04a12d6f3e fix: download native crypto binary at plugin startup
Add bootstrap-native.ts that downloads @matrix-org/matrix-sdk-crypto-nodejs
native binary before loading matrix-bot-sdk. This is needed because
opencode's npm doesn't run postinstall scripts, and the binary is required
for the Matrix SDK to work.
2026-09-30 22:01:17 +03:00
Бородин Роман 4c0ad70e47 fix: compile TS to JS and set main to dist/index.js for git plugin installation
- Set noEmit to false in tsconfig.json
- Change main entry point from index.ts to dist/index.js
- Add files field to package.json
- Pre-compile TypeScript to JavaScript
2026-09-30 21:39:03 +03:00