fix(session-import): probe OpenCode v1.x data paths per platform (#682) - #56
Conversation
OpenCode's database lives in %LOCALAPPDATA%\opencode\data\ on Windows (per OpenCode's own tracker) and ~/.local/share/opencode elsewhere; the adapter previously probed only the latter, so Windows users saw "not detected" even with v1.x data present. Candidates are now probed in order (LOCALAPPDATA, XDG_DATA_HOME, ~/.local/share); the first existing one wins, and macOS/Linux behavior is unchanged. Adds adapter-specific tests against a real temporary SQLite database (three-platform path resolution + session/message/part restore). Verified against a real 224 MB / 629-session OpenCode v1.x database: scan finds all sessions, convert restores a 200-message session in 58 ms. Publishes 0.4.9 (pack + catalog + audit green, suite 347/347).
|
@muzimu217 is attempting to deploy a commit to the vastsa's projects Team on Vercel. A member of the Team first needs to authorize it. |
…ructured local The plugin-center source audit greps the `import(` dynamic-module pattern and `pi.session.import(` collides with it, though nothing is loaded dynamically - it is a plain host API call. Destructure the method into a local at the single call site so the source stops matching; behavior is unchanged (flagged by the platform audit on submit, disclosed here for the rule's maintainer).
|
hi,这个插件可以弄成一个独立仓库,然后在这个平台提交:https://plugins.aiuo.net/,我想把目前所有的导入功能都做到这个插件里面,包括模型配置这些,然后宿主可以下掉这些了 |
|
感谢合并! 三件事都收到,逐条确认:
优先级上有想法(比如模型配置导入先做)随时说。 |
- OpenCode adapter: probe v1.x data paths per platform (#682) - %LOCALAPPDATA%\opencode\data\ first, then XDG_DATA_HOME, then ~/.local/share; Windows users finally get detected - main.js: bind the host import channel through a destructured local (the plugin-center source audit's dynamic-import pattern otherwise matches the host API's method name; no dynamic loading exists) - new adapter test file (real temporary SQLite db, three-platform path resolution); suite 189/189 in this repo's root layout - CI: run the suite on push/PR
monorepo 里的目录的话说明迁移到新插件仓库吧,其他的没有问题,您这边看着来即可,非常感谢,如果宿主能力不足,直接提 pr 即可,我这边现在审核! |
|
独立仓库已就绪:muzimu217/pi-desktop-session-import
另外按你的方向做了宿主导入面的完整盘点,迁移计划落在独立仓库:docs/host-import-migration.md。结论摘要:会话线本插件已是超集(6 源 vs 宿主 4 源);真正的缺口是模型配置/MCP/技能三条线没有运行时写入的插件 API(现有 contributes.* 都是静态声明)——文档里给了 M0–M6 分步计划和两个需要你拍板的形态问题(providers.write 运行时 API vs 薄导入网关 RPC)。你看看节奏,M0(行为对齐核对)我们可以随时开工。 |
没毛病,开干! |
|
收到,开干 👍 三件马上安排:①monorepo 里的插件目录换成迁移说明(PR 今天内提给你);②M0(行为对齐核对)在独立仓库开工,差异逐条补进适配器;③宿主侧 平台侧 0.4.9 已进 catalog,感谢放行!#682 那边我再去补一句'已可安装'。 |
Per the maintainer's direction in #56, io.github.muzimu217.session-import now lives in muzimu217/pi-desktop-session-import and is published on the plugin center (plugins.aiuo.net), which already serves 0.4.9. Replace the monorepo directory with a pointer README, drop the local test and the packed .piplug artifacts, and rebuild the catalog (26 -> 25). Panel-chrome count follows the removal (20 -> 19).
Fixes the Windows half of vastsa/PI-Desktop#682.
Root cause
The shipped 0.4.8 already reads OpenCode v1.x's SQLite database (since 0.4.7), but
dbPathForprobed only~/.local/share/opencode/opencode.db. OpenCode's Windows app keeps its data at%LOCALAPPDATA%\opencode\data\(confirmed by OpenCode's own tracker), so on Windows the adapter never found the database and the panel showed "not detected" — exactly what #682 reports. (Users on a pre-0.4.7 build also fail, but upgrading alone fixes those; this fix targets the Windows layout.)Change
lib/sources/opencode.jsnow probes candidates in order and uses the first that exists:%LOCALAPPDATA%\opencode\data\opencode.db(Windows app storage)$XDG_DATA_HOME/opencode/opencode.db(when set)~/.local/share/opencode/opencode.db(macOS/Linux default; Windows CLI installs that honour the Unix layout)macOS/Linux behavior is unchanged. Publishing as 0.4.9 (manifest changelog included).
Verification
test/opencode-source.test.mjs(7 tests): candidate order and existence resolution for all three platform layouts, scan/convert against a real temporary SQLite database in the v1.x schema (session→message→part restore incl. tool parts), empty result when no database existsnode --testacross the plugin repo passes (session-import 189/189 incl. the new file; repo total 347/347)pack_plugin.py→rebuild_catalog.py→security_audit.py --check-packagesall green (no new audit signals for this plugin)