Repository navigation
Conversation
The explicit model-config scan only read ~/.pi/agent/models.json, so providers connected through `pi /login` (for example DeepSeek or a Z.AI coding plan) never appeared in the Pi group. Their keys live in auth.json and their endpoint/model metadata lives in Pi's cached models-store.json. Read both files and pair each API-key provider with its largest coherent endpoint group. OAuth/subscription grants stay in Pi, `!command` keys are never executed or stored, and models.json remains authoritative when both files describe a provider. A key in auth.json also fills a models.json provider whose `env:`/`$VAR` reference cannot resolve in Desktop. Tests cover the cached-catalog pairing, OAuth/command exclusion, endpoint selection, and the scanner merge.
The explicit MCP scan covered Claude, Codex, Cursor, opencode, and the ChatGPT placeholder, but not Pi. A user with servers configured in ~/.pi/agent/mcp.json saw an empty import list even though Pi connected to those servers. Scan the user-level Pi mcp.json with the existing JSON mcpServers reader, report it as its own source, and label the group in every shipped locale. Project-level .pi/mcp.json stays out of scope because Pi only loads it after project trust.
Keep the ADR ending consistent with the repository's whitespace checks.
|
补充: |
|
Reviewed in an isolated worktree (head What I checked beyond "it runs": MCP side is a clean reuse: Model side has the right precedence and the right secret boundary:
Two non-blocking notes:
Nothing blocking from my side. |
|
Thanks for the careful review. Both notes are accurate and intentional:
No code change made for the non-blocking notes. Thanks again for checking the precedence and secret boundary. |
|
本 PR 新增了可见的 PI agent 导入来源/标签,并改动导入面板和多语言文案,属于界面改动,不符合本轮“只合入无界面改动 fix”的条件,因此这次不合入。 另外,当前 head 基于 |
修复内容
PI-Desktop 的显式导入扫描漏掉了 PI agent 的两类配置:
~/.pi/agent/models.json,不读auth.json,因此通过pi /login连接的 provider(例如 DeepSeek、Z.AI Coding CN)不会出现在 Pi 分组里。~/.pi/agent/mcp.json,因此 PI 里已经配置好的 MCP server 全部不显示。实现
parsePiAuthModelConfig():把auth.json的 API key 与 Pi 缓存的models-store.json目录配对。models.json仍然优先;OAuth/订阅凭据跳过;!command不执行也不保存;models.json的env:/$VAR在 Desktop 进程里解析不到时,用auth.json的 key 补齐。pi源,读取用户级~/.pi/agent/mcp.json的mcpServers。项目级.pi/mcp.json需要项目信任,本次不扫描。验证
pnpm --filter @pi-desktop/shared test→ 98 files / 1280 tests passednode --test apps/desktop/test/model-config-import.test.mjs apps/desktop/electron/test/agent-mcp-scan.test.mjs→ 17 passedpnpm --filter @pi-desktop/i18n test→ 30 passedpnpm --filter @pi-desktop/desktop typecheck→ passedpnpm lint:biome→ 124 files checked, no fixespnpm test:e2e:settings-inline-import→ passed(candidatee3b150e,base42fb8b7)pnpm check:pr-base→ passed兼容性与安全
!command不执行、不作为字面量密钥保存。auth.json的 provider 需要 Pi 已经写出models-store.json(Pi 刷新过模型目录)。没有缓存目录时,只会为models.json里已有的 provider 补齐 key,不会凭空生成 endpoint/model 列表。