@herbertgao/pi-extensions 2026.9.20 → 2026.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -8
- package/THIRD_PARTY_NOTICES.md +29 -3
- package/node_modules/@herbertgao/pi-bark/README.md +39 -3
- package/node_modules/@herbertgao/pi-bark/package.json +1 -1
- package/node_modules/@herbertgao/pi-bark/src/index.ts +275 -15
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +50 -50
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +7 -7
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +25 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +24 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +7 -4
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer.ts +47 -5
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/mcp-chip.ts +136 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +56 -11
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +36 -4
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +11 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/codemode.ts +303 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-header.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-highlight.ts +36 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-presentation.ts +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-write-render.ts +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/index.ts +88 -34
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/line-width-safety.ts +6 -5
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/write-execution.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +31 -6
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/message-display.ts +3 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/names.ts +3 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/result.ts +173 -36
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/ansi-text.ts +1 -0
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +6 -4
- package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
- package/node_modules/@herbertgao/pi-subagents/package.json +1 -1
- package/node_modules/@herbertgao/pi-subagents/src/mention-clone.ts +3 -2
- package/node_modules/@herbertgao/sol-pi/CONTRIBUTING.md +22 -0
- package/node_modules/@herbertgao/sol-pi/README.md +36 -17
- package/node_modules/@herbertgao/sol-pi/THIRD_PARTY_NOTICES.md +10 -6
- package/node_modules/@herbertgao/sol-pi/agents-install.md +15 -12
- package/node_modules/@herbertgao/sol-pi/docs/compatibility.md +24 -8
- package/node_modules/@herbertgao/sol-pi/docs/configuration.md +2 -2
- package/node_modules/@herbertgao/sol-pi/docs/star-history.md +18 -0
- package/node_modules/@herbertgao/sol-pi/package.json +4 -2
- package/node_modules/@herbertgao/sol-pi/scripts/check-sol-pi-config.mjs +1 -1
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/config.ts +1 -1
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/action-fusion/file-queue.ts +23 -4
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/action-fusion/index.ts +32 -1
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/action-fusion/then-run.ts +3 -2
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/observation-pack/observation.ts +1 -1
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/economics.ts +27 -7
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/extension.ts +137 -41
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/index.ts +1 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/plan.ts +2 -1
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/projection.ts +58 -0
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/state.ts +28 -6
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/tools.ts +2 -1
- package/node_modules/@herbertgao/sol-pi/src/sol-pi/runtime-paths.ts +15 -2
- package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +2 -2
- package/node_modules/@pi-plugins/fast-mode/README.md +7 -1
- package/node_modules/@pi-plugins/fast-mode/dist/index.d.mts.map +1 -1
- package/node_modules/@pi-plugins/fast-mode/dist/index.mjs +7 -1
- package/node_modules/@pi-plugins/fast-mode/dist/index.mjs.map +1 -1
- package/node_modules/@pi-plugins/fast-mode/package.json +5 -5
- package/node_modules/pi-antigravity/README.md +3 -0
- package/node_modules/pi-antigravity/package.json +8 -8
- package/node_modules/pi-antigravity/src/auth/oauth.ts +6 -3
- package/node_modules/pi-antigravity/src/index.ts +114 -110
- package/node_modules/pi-antigravity/src/stream/stream.ts +1 -1
- package/node_modules/pi-antigravity/src/utils/util.ts +18 -1
- package/node_modules/pi-multi-account/CHANGELOG.md +20 -0
- package/node_modules/pi-multi-account/README.md +46 -8
- package/node_modules/pi-multi-account/config-file-transaction.ts +42 -0
- package/node_modules/pi-multi-account/index.ts +255 -269
- package/node_modules/pi-multi-account/model-pins.ts +36 -0
- package/node_modules/pi-multi-account/package.json +9 -7
- package/node_modules/pi-multi-account/slot-proxy-auth.ts +12 -2
- package/node_modules/pi-multi-account/slot-proxy.ts +27 -5
- package/node_modules/pi-web-access/CHANGELOG.md +17 -0
- package/node_modules/pi-web-access/README.md +6 -3
- package/node_modules/pi-web-access/brave-rate-limit.ts +170 -0
- package/node_modules/pi-web-access/brave.ts +28 -11
- package/node_modules/pi-web-access/dist/index.js +202 -33
- package/node_modules/pi-web-access/gemini-search.ts +2 -5
- package/node_modules/pi-web-access/index.ts +13 -7
- package/node_modules/pi-web-access/openai-search.ts +24 -10
- package/node_modules/pi-web-access/package.json +1 -1
- package/node_modules/pi-web-access/summary-review.ts +8 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/README.md +16 -12
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/adapter.d.ts +0 -5
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/adapter.js +2 -3
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/contract.d.ts +2 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/reader.d.ts +3 -0
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/reader.js +27 -15
- package/node_modules/{@herbertgao/resume-from/dist/adapters/pi → resume-from/dist/adapters/claude-code}/redaction.js +16 -3
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/writer.d.ts +2 -4
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/writer.js +1 -1
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/contract.d.ts +2 -4
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/index.js +1 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/read.d.ts +16 -0
- package/node_modules/resume-from/dist/adapters/codex/read.js +723 -0
- package/node_modules/{@herbertgao/resume-from/dist/adapters/claude-code → resume-from/dist/adapters/codex}/redaction.js +16 -3
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/rollout.d.ts +44 -4
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/rollout.js +88 -4
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/write.d.ts +2 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/write.js +2 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/contract.d.ts +5 -1
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/adapter.js +10 -6
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/contract.d.ts +2 -2
- package/node_modules/{@herbertgao/resume-from/dist/adapters/codex → resume-from/dist/adapters/pi}/redaction.js +16 -3
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/serialize.d.ts +2 -4
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/serialize.js +2 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/render.d.ts +1 -1
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/render.js +4 -4
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/runner.js +2 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/contract.d.ts +2 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/command.js +31 -8
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/wiring.d.ts +1 -1
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/wiring.js +1 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/confirmation.d.ts +4 -1
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/confirmation.js +2 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/contract.d.ts +8 -6
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/contract.d.ts +10 -5
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/finder.d.ts +2 -1
- package/node_modules/resume-from/dist/import/discovery/finder.js +269 -0
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/contract.d.ts +3 -3
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/lander.js +3 -3
- package/node_modules/resume-from/dist/import/pipeline.d.ts +28 -0
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/pipeline.js +31 -11
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/builder.d.ts +2 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/builder.js +9 -5
- package/node_modules/resume-from/dist/import/preview/warnings.d.ts +14 -0
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/warnings.js +26 -20
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/wiring.js +12 -2
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/contract.d.ts +9 -3
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/git.d.ts +4 -4
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/git.js +7 -4
- package/node_modules/resume-from/dist/platform/repo/reader.d.ts +3 -0
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/reader.js +60 -20
- package/node_modules/{@herbertgao/resume-from → resume-from}/dist/session/contract.d.ts +8 -1
- package/node_modules/{@herbertgao/resume-from → resume-from}/package.json +19 -32
- package/node_modules/{@herbertgao/resume-from → resume-from}/shims/pi/extensions/resume-from.js +2 -2
- package/package.json +17 -17
- package/node_modules/@herbertgao/resume-from/dist/adapters/codex/read.js +0 -270
- package/node_modules/@herbertgao/resume-from/dist/import/discovery/finder.js +0 -129
- package/node_modules/@herbertgao/resume-from/dist/import/pipeline.d.ts +0 -17
- package/node_modules/@herbertgao/resume-from/dist/import/preview/warnings.d.ts +0 -11
- package/node_modules/@herbertgao/resume-from/dist/platform/repo/reader.d.ts +0 -8
- /package/node_modules/{@herbertgao/resume-from → resume-from}/LICENSE +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/entries.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/entries.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/layout.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/layout.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/readback.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/readback.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/redaction.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/validation.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/validation.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/readback.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/readback.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/redaction.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/validation.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/validation.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/adapter.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/format.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/format.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/parse.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/parse.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/redaction.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/validate.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/validate.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/bin.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/bin.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/contract.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/agents.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/agents.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/args.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/args.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/contract.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/presentation.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/presentation.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/runner.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/entry.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/entry.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/command.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/contract.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/picker.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/picker.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/presentation.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/presentation.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/register.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/register.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/ui.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/ui.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/profile.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/profile.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/registry.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/registry.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/errors.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/errors.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/homes.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/homes.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/ordering.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/ordering.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/errors.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/errors.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/errors.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/errors.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/handover.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/handover.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/lander.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/marker.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/marker.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/contract.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/format.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/format.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/transfer/contract.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/transfer/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/transfer/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/transfer/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/transfer/rules.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/transfer/rules.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/wiring.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/contract.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/defaults.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/defaults.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/errors.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/errors.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/loader.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/loader.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/paths.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/paths.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/validate.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/validate.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/store/contract.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/store/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/store/file-committer.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/store/file-committer.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/store/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/store/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/tokens/contract.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/tokens/contract.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/tokens/estimator.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/tokens/estimator.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/tokens/index.d.ts +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/tokens/index.js +0 -0
- /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/session/contract.js +0 -0
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
## Preview
|
|
10
10
|
|
|
11
|
-
<a href="https://github.com/user-attachments/assets/6c858000-fdad-43f9-957f-4d0278648498"><img src="
|
|
11
|
+
<a href="https://github.com/user-attachments/assets/6c858000-fdad-43f9-957f-4d0278648498"><img src="https://raw.githubusercontent.com/HerbertGao/pi-extensions/master/packages/pi-cc-extensions/assets/readme/preview.webp" alt="pi-cc-extensions UI preview" width="100%"></a>
|
|
12
12
|
|
|
13
13
|
Click the cover to play the demo video
|
|
14
14
|
|
|
@@ -25,16 +25,16 @@ Run `/reload` after installation.
|
|
|
25
25
|
|
|
26
26
|
## Features
|
|
27
27
|
|
|
28
|
-
| Feature | Description
|
|
29
|
-
| --------------------------- |
|
|
30
|
-
| Claude Code UI | Tool summaries, expand/collapse, rich edit/write diffs, and `on` / `compact` / `off` modes
|
|
31
|
-
| Markdown enhancements | Mermaid diagrams, admonitions, URL linking, and more
|
|
32
|
-
| Fullscreen mode | Tool card/group expand and collapse on click, previews, hover highlight, and a back-to-bottom button
|
|
33
|
-
| Settings panel | `Style / Features / UI / Diff / Thinking / Footer` tabs
|
|
34
|
-
| Context inspection | Usage breakdown and previews for the system prompt, memory, skills, tools definition, and messages
|
|
35
|
-
| Session/Subagent references | Search and inject effective context from previous Sessions or existing SubAgents
|
|
28
|
+
| Feature | Description | Entry point |
|
|
29
|
+
| --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
|
|
30
|
+
| Claude Code UI | Tool summaries, expand/collapse, rich edit/write diffs, and `on` / `compact` / `off` modes | `/ccstyle` |
|
|
31
|
+
| Markdown enhancements | Mermaid diagrams, admonitions, URL linking, and more | Automatic |
|
|
32
|
+
| Fullscreen mode | Tool card/group expand and collapse on click, previews, hover highlight, and a back-to-bottom button | `TUIMODE=fullscreen` or `--tui-mode fullscreen` |
|
|
33
|
+
| Settings panel | `Style / Features / UI / Diff / Thinking / Footer` tabs | `/ccstyle` |
|
|
34
|
+
| Context inspection | Usage breakdown and previews for the system prompt, memory, skills, tools definition, and messages | `/context` |
|
|
35
|
+
| Session/Subagent references | Search and inject effective context from previous Sessions or existing SubAgents | `@` |
|
|
36
36
|
| Status bar | Shows model, context, cache, cost, and git; also works with `@narumitw/pi-usage` for live quota. Git/cache Nerd Font icons can be turned off | `/ccstyle` |
|
|
37
|
-
| Theme | Bundled CC Dark and CC Light themes
|
|
37
|
+
| Theme | Bundled CC Dark and CC Light themes | `/theme` |
|
|
38
38
|
|
|
39
39
|
Renderer snapshots for `on` / `compact` modes: [default](./docs/tool-render-examples-default.md) · [compact](./docs/tool-render-examples-compact.md)
|
|
40
40
|
|
|
@@ -45,51 +45,52 @@ Renderer snapshots for `on` / `compact` modes: [default](./docs/tool-render-exam
|
|
|
45
45
|
```jsonc
|
|
46
46
|
{
|
|
47
47
|
// style
|
|
48
|
-
"mode": "on",
|
|
49
|
-
"excludeRenderers": [],
|
|
48
|
+
"mode": "on", // on / compact / off
|
|
49
|
+
"excludeRenderers": [], // tools keeping the native renderer; Agent always keeps its dedicated renderer
|
|
50
50
|
|
|
51
51
|
// features
|
|
52
|
-
"enableSessionReference": true,
|
|
53
|
-
"enableSubagentAutocomplete": true,
|
|
54
|
-
"enableContextCommand": true,
|
|
55
|
-
"enableAgentSummary": true,
|
|
56
|
-
"enableWorkingMessage": true,
|
|
57
|
-
"enableAliases": true,
|
|
52
|
+
"enableSessionReference": true, // @ session references
|
|
53
|
+
"enableSubagentAutocomplete": true, // @subagent:[name] completion and delegation hints
|
|
54
|
+
"enableContextCommand": true, // /context usage check
|
|
55
|
+
"enableAgentSummary": true, // per-turn tool summary
|
|
56
|
+
"enableWorkingMessage": true, // Working... bottom token/elapsed
|
|
57
|
+
"enableAliases": true, // /clear, /exit aliases
|
|
58
58
|
|
|
59
59
|
// ui
|
|
60
|
-
"expandedInputMaxLines": 5,
|
|
61
|
-
"expandedOutputMaxLines": 10,
|
|
62
|
-
"expandedPreviewMaxLines": 40,
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
60
|
+
"expandedInputMaxLines": 5, // expanded tool Input lines; overflow shows a footer hint
|
|
61
|
+
"expandedOutputMaxLines": 10, // expanded tool Output lines; overflow shows a footer hint
|
|
62
|
+
"expandedPreviewMaxLines": 40, // max lines for expanded TaskList bodies (expanded diffs always show all)
|
|
63
|
+
"expandedCardBackground": "userMessageBg", // expanded card background slot: userMessageBg (same as user prompts) / toolPendingBg (neutral) etc.
|
|
64
|
+
"inputClip": 0, // tool summary path/command clip length; 0 = fit width
|
|
65
|
+
"showStartupHeader": true, // startup header (logo + tips) toggle
|
|
66
|
+
"scrollStepLines": 3, // fullscreen wheel scroll step
|
|
66
67
|
|
|
67
68
|
// diff
|
|
68
|
-
"diffViewMode": "auto",
|
|
69
|
-
"diffIndicatorMode": "bars",
|
|
70
|
-
"diffSplitMinWidth": 120,
|
|
71
|
-
"editDiffCollapsedLines": 24,
|
|
72
|
-
"writeDiffCollapsedLines": 0,
|
|
73
|
-
"diffWordWrap": true,
|
|
69
|
+
"diffViewMode": "auto", // layout: auto / split / unified
|
|
70
|
+
"diffIndicatorMode": "bars", // change indicators: bars / classic / none
|
|
71
|
+
"diffSplitMinWidth": 120, // min terminal width for side-by-side columns
|
|
72
|
+
"editDiffCollapsedLines": 24, // Edit collapse lines; beyond that shows the expand hint
|
|
73
|
+
"writeDiffCollapsedLines": 0, // write collapse lines; 0 = creation summary only
|
|
74
|
+
"diffWordWrap": true, // wrap long diff lines
|
|
74
75
|
|
|
75
76
|
// thinking
|
|
76
77
|
"useSummaryTitlesAsThinkingTitle": true, // use latest summary as thinking title
|
|
77
|
-
"previewLines": 3,
|
|
78
|
-
"animationIntervalMs": 90,
|
|
79
|
-
"dimThinkingText": false,
|
|
78
|
+
"previewLines": 3, // preview lines; 0 hides
|
|
79
|
+
"animationIntervalMs": 90, // title animation interval (ms)
|
|
80
|
+
"dimThinkingText": false, // dim thinking body text
|
|
80
81
|
|
|
81
82
|
// footer
|
|
82
|
-
"enableCustomFooter": true,
|
|
83
|
-
"footerNerdIcons": true,
|
|
84
|
-
"footerHiddenKeys": [],
|
|
85
|
-
"footerLine1Keys": ["pi-usage"],
|
|
86
|
-
"footerLine2Keys": [],
|
|
87
|
-
"footerLine3Keys": []
|
|
83
|
+
"enableCustomFooter": true, // custom status bar
|
|
84
|
+
"footerNerdIcons": true, // Nerd Font glyphs for git/cache; false = plain text
|
|
85
|
+
"footerHiddenKeys": [], // hidden plugin chip keys
|
|
86
|
+
"footerLine1Keys": ["pi-usage"], // line1 plugin chip order; pi-usage is shown by default, data from @narumitw/pi-usage
|
|
87
|
+
"footerLine2Keys": [], // line2 plugin chip order (after cwd/git)
|
|
88
|
+
"footerLine3Keys": [], // line3 overflow slot; painted only when a chip is visible
|
|
88
89
|
}
|
|
89
90
|
```
|
|
90
91
|
|
|
91
92
|
> [!TIP]
|
|
92
|
-
> **Fullscreen**: click `click to show more` to expand tool cards, thinking, Skill, and compact summaries. An expanded diff always shows every line; when expanded Input/Output exceeds the line cap, the footer `… +N more lines
|
|
93
|
+
> **Fullscreen**: click `click to show more` to expand tool cards, thinking, Skill, and compact summaries. An expanded diff always shows every line; when expanded Input/Output exceeds the line cap, the footer `… +N more lines · click to show more` opens a full preview. Click to collapse (dragging inside the card selects text).
|
|
93
94
|
|
|
94
95
|
> [!NOTE]
|
|
95
96
|
> **Mermaid rendering**: set `markdown.mermaid` to `final` via `~/.pi/agent/settings.json` or the Mermaid diagrams option in `/settings`. Default `streaming` redraws per frame; `final` renders once at completion.
|
|
@@ -99,23 +100,22 @@ Renderer snapshots for `on` / `compact` modes: [default](./docs/tool-render-exam
|
|
|
99
100
|
```bash
|
|
100
101
|
npm test
|
|
101
102
|
npm run typecheck
|
|
102
|
-
./test.
|
|
103
|
+
./test.sh # macOS/Linux: load the local checkout for one run, then restore
|
|
104
|
+
test.bat # Windows: same (calls test.ps1)
|
|
105
|
+
# one-off run without touching settings: pi -e .
|
|
103
106
|
```
|
|
104
107
|
|
|
105
108
|
## Compatibility
|
|
106
109
|
|
|
107
|
-
- Node.js `>=
|
|
110
|
+
- Node.js `>=24`; the monorepo uses Pi `1.0.4`, with published Pi peer versions kept at `*`.
|
|
108
111
|
|
|
109
112
|
## Recommended companions
|
|
110
113
|
|
|
111
|
-
| Extension
|
|
112
|
-
|
|
|
113
|
-
| `npm:@
|
|
114
|
-
| `npm
|
|
115
|
-
| `npm
|
|
116
|
-
| `npm:@ff-labs/pi-fff` | FFF-powered fuzzy file and content search (fffind / ffgrep) |
|
|
117
|
-
| `npm:pi-web-access` | Web search, URL fetching, GitHub cloning, PDF/video parsing |
|
|
118
|
-
| `npm:@narumitw/pi-usage` | Current-account usage for Codex / Copilot / OpenRouter |
|
|
114
|
+
| Extension | Purpose |
|
|
115
|
+
| ------------------------ | ----------------------------------------------------------- |
|
|
116
|
+
| `npm:@ff-labs/pi-fff` | FFF-powered fuzzy file and content search (fffind / ffgrep) |
|
|
117
|
+
| `npm:pi-web-access` | Web search, URL fetching, GitHub cloning, PDF/video parsing |
|
|
118
|
+
| `npm:@narumitw/pi-usage` | Current-account usage for Codex / Copilot / OpenRouter |
|
|
119
119
|
|
|
120
120
|
## Credits
|
|
121
121
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
## 界面预览
|
|
10
10
|
|
|
11
|
-
<a href="https://github.com/user-attachments/assets/6c858000-fdad-43f9-957f-4d0278648498"><img src="
|
|
11
|
+
<a href="https://github.com/user-attachments/assets/6c858000-fdad-43f9-957f-4d0278648498"><img src="https://raw.githubusercontent.com/HerbertGao/pi-extensions/master/packages/pi-cc-extensions/assets/readme/preview.webp" alt="pi-cc-extensions 界面预览" width="100%"></a>
|
|
12
12
|
|
|
13
13
|
点击封面播放演示视频
|
|
14
14
|
|
|
@@ -60,6 +60,7 @@ pi install git:github.com/HerbertGao/pi-extensions
|
|
|
60
60
|
"expandedInputMaxLines": 5, // 展开工具卡 Input 可见行数,超出在末行显示展开提示
|
|
61
61
|
"expandedOutputMaxLines": 10, // 展开工具卡 Output 可见行数,超出在末行显示展开提示
|
|
62
62
|
"expandedPreviewMaxLines": 40, // 展开 TaskList 正文最大行数(展开 diff 始终全量)
|
|
63
|
+
"expandedCardBackground": "userMessageBg", // 展开卡背景槽位;userMessageBg 与用户消息同色,toolPendingBg 为中性灰
|
|
63
64
|
"inputClip": 0, // 工具摘要 path/command 折叠字符数;0 = 按可用宽度
|
|
64
65
|
"showStartupHeader": true, // 启动头(logo + tips)开关
|
|
65
66
|
"scrollStepLines": 3, // fullscreen 滚轮步进
|
|
@@ -89,7 +90,7 @@ pi install git:github.com/HerbertGao/pi-extensions
|
|
|
89
90
|
```
|
|
90
91
|
|
|
91
92
|
> [!TIP]
|
|
92
|
-
> **全屏模式**:单击 `click to show more` 展开工具卡、思考、Skill 和 compact 摘要;工具卡展开态 diff 全量显示,Input/Output 超行时末行 `… +N more lines
|
|
93
|
+
> **全屏模式**:单击 `click to show more` 展开工具卡、思考、Skill 和 compact 摘要;工具卡展开态 diff 全量显示,Input/Output 超行时末行 `… +N more lines · click to show more` 打开全量预览,单击收起(卡内拖动为选中文本)。
|
|
93
94
|
|
|
94
95
|
> [!NOTE]
|
|
95
96
|
> **Mermaid 渲染**:建议把 `markdown.mermaid` 设为 `final`(`~/.pi/agent/settings.json` 或 `/settings` 面板的 Mermaid diagrams 选项)。默认 `streaming` 逐帧重绘,`final` 渲染最终版更稳定。
|
|
@@ -99,20 +100,19 @@ pi install git:github.com/HerbertGao/pi-extensions
|
|
|
99
100
|
```bash
|
|
100
101
|
npm test
|
|
101
102
|
npm run typecheck
|
|
102
|
-
./test.
|
|
103
|
+
./test.sh # macOS/Linux:临时加载本地检出,退出后还原
|
|
104
|
+
test.bat # Windows:同上(调用 test.ps1)
|
|
105
|
+
# 只想跑一次、不改配置:pi -e .
|
|
103
106
|
```
|
|
104
107
|
|
|
105
108
|
## 兼容性
|
|
106
109
|
|
|
107
|
-
- Node.js `>=
|
|
110
|
+
- Node.js `>=24`;monorepo 使用 Pi `1.0.4`,发布包的 Pi peer 版本保持 `*`。
|
|
108
111
|
|
|
109
112
|
## 推荐搭配
|
|
110
113
|
|
|
111
114
|
| 扩展 | 用途 |
|
|
112
115
|
| ---------------------------------------- | ------------------------------------------------ |
|
|
113
|
-
| `npm:@tintinweb/pi-subagents` | 并行 SubAgent、后台任务与工作树隔离 |
|
|
114
|
-
| `npm:@tintinweb/pi-tasks` | Claude Code 风格任务跟踪与协调 |
|
|
115
|
-
| `npm:pi-mcp-adapter` | 按需发现 MCP 工具,减少上下文占用 |
|
|
116
116
|
| `npm:@ff-labs/pi-fff` | 模糊文件与内容检索(fffind / ffgrep) |
|
|
117
117
|
| `npm:pi-web-access` | 网页搜索、URL 抓取、GitHub 克隆、PDF/视频解析 |
|
|
118
118
|
| `npm:@narumitw/pi-usage` | 查看当前账号用量(Codex / Copilot / OpenRouter) |
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ThemeBg } from "@earendil-works/pi-coding-agent";
|
|
1
2
|
import type { CompactThinkingConfig } from "../feature/compact-thinking.ts";
|
|
2
3
|
import {
|
|
3
4
|
DEFAULT_FOOTER_CHIP_LAYOUT,
|
|
@@ -18,7 +19,7 @@ export interface ToolDisplayConfig {
|
|
|
18
19
|
diffIndicatorMode: DiffIndicatorMode;
|
|
19
20
|
diffSplitMinWidth: number;
|
|
20
21
|
editDiffCollapsedLines: number;
|
|
21
|
-
/** Write-only collapsed body lines. 0 = `↳ created
|
|
22
|
+
/** Write-only collapsed body lines. 0 = `↳ created · click to show more`. */
|
|
22
23
|
writeDiffCollapsedLines: number;
|
|
23
24
|
diffWordWrap: boolean;
|
|
24
25
|
expandedPreviewMaxLines: number;
|
|
@@ -32,7 +33,7 @@ export const DEFAULT_TOOL_DISPLAY_CONFIG: ToolDisplayConfig = {
|
|
|
32
33
|
editDiffCollapsedLines: 24,
|
|
33
34
|
/**
|
|
34
35
|
* Write create/overwrite collapsed body.
|
|
35
|
-
* 0 = `↳ created
|
|
36
|
+
* 0 = `↳ created · click to show more` (stats stay on the title).
|
|
36
37
|
*/
|
|
37
38
|
writeDiffCollapsedLines: 0,
|
|
38
39
|
diffWordWrap: true,
|
|
@@ -53,6 +54,7 @@ export type Config = {
|
|
|
53
54
|
writeDiffCollapsedLines: number;
|
|
54
55
|
diffWordWrap: boolean;
|
|
55
56
|
expandedPreviewMaxLines: number;
|
|
57
|
+
expandedCardBackground: ThemeBg;
|
|
56
58
|
expandedInputMaxLines: number;
|
|
57
59
|
expandedOutputMaxLines: number;
|
|
58
60
|
inputClip: number;
|
|
@@ -88,6 +90,20 @@ export const DIFF_COLLAPSED_LINES_VALUES = ["12", "24", "36", "48", "80", "120"]
|
|
|
88
90
|
export const WRITE_DIFF_COLLAPSED_LINES_VALUES = ["0", "4", "8", "12", "24", "36"];
|
|
89
91
|
/** Presets for expanded body height — keep low options first so cycling stays TUI-friendly. */
|
|
90
92
|
export const EXPANDED_PREVIEW_MAX_LINES_VALUES = ["40", "60", "80", "120", "200", "500", "2000"];
|
|
93
|
+
/**
|
|
94
|
+
* 展开卡可用的主题背景槽位。theme.bg/getBgAnsi 只认这些 token,
|
|
95
|
+
* 别的名字会抛 Unknown theme color,所以按白名单校验;
|
|
96
|
+
* 面板顺序把 userMessageBg(默认)和 toolPendingBg(内置主题的中性灰)放最前。
|
|
97
|
+
*/
|
|
98
|
+
export const EXPANDED_CARD_BACKGROUND_SLOTS: readonly ThemeBg[] = [
|
|
99
|
+
"userMessageBg",
|
|
100
|
+
"toolPendingBg",
|
|
101
|
+
"customMessageBg",
|
|
102
|
+
"selectedBg",
|
|
103
|
+
"searchMatchBg",
|
|
104
|
+
"toolSuccessBg",
|
|
105
|
+
"toolErrorBg",
|
|
106
|
+
];
|
|
91
107
|
/** 展开工具卡 Input 可见行数预设。 */
|
|
92
108
|
export const EXPANDED_INPUT_MAX_LINES_VALUES = ["5", "10", "20", "40", "80"];
|
|
93
109
|
/** 展开工具卡 Output 可见行数预设。 */
|
|
@@ -122,6 +138,8 @@ export const DEFAULT_CONFIG: Config = {
|
|
|
122
138
|
writeDiffCollapsedLines: DEFAULT_TOOL_DISPLAY_CONFIG.writeDiffCollapsedLines,
|
|
123
139
|
diffWordWrap: DEFAULT_TOOL_DISPLAY_CONFIG.diffWordWrap,
|
|
124
140
|
expandedPreviewMaxLines: DEFAULT_TOOL_DISPLAY_CONFIG.expandedPreviewMaxLines,
|
|
141
|
+
/** 展开卡背景。userMessageBg 与用户消息同色(ccstyle 原约定)。 */
|
|
142
|
+
expandedCardBackground: "userMessageBg",
|
|
125
143
|
expandedInputMaxLines: 5,
|
|
126
144
|
expandedOutputMaxLines: 10,
|
|
127
145
|
inputClip: 0,
|
|
@@ -211,6 +229,11 @@ export function normalizeConfig(input: unknown): Config {
|
|
|
211
229
|
10,
|
|
212
230
|
50_000,
|
|
213
231
|
),
|
|
232
|
+
expandedCardBackground: pickEnum(
|
|
233
|
+
source.expandedCardBackground,
|
|
234
|
+
EXPANDED_CARD_BACKGROUND_SLOTS,
|
|
235
|
+
DEFAULT_CONFIG.expandedCardBackground,
|
|
236
|
+
),
|
|
214
237
|
expandedInputMaxLines: pickPositiveInt(
|
|
215
238
|
source.expandedInputMaxLines,
|
|
216
239
|
DEFAULT_CONFIG.expandedInputMaxLines,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* 渲染副作用(applyStyleMode / refreshCurrentTranscript)由 renderer 经
|
|
5
5
|
* CcstylePanelHooks 注入,避免 config → renderer 循环依赖。
|
|
6
6
|
*/
|
|
7
|
-
import { getSettingsListTheme } from "@earendil-works/pi-coding-agent";
|
|
7
|
+
import { getSettingsListTheme, type ThemeBg } from "@earendil-works/pi-coding-agent";
|
|
8
8
|
import { Input, SettingsList, matchesKey, truncateToWidth } from "@earendil-works/pi-tui";
|
|
9
9
|
import type { CompactThinkingController } from "../feature/compact-thinking.ts";
|
|
10
10
|
import {
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
DIFF_SPLIT_MIN_WIDTH_VALUES,
|
|
34
34
|
DIFF_VIEW_MODES,
|
|
35
35
|
EXCLUDE_RENDERER_CANDIDATES,
|
|
36
|
+
EXPANDED_CARD_BACKGROUND_SLOTS,
|
|
36
37
|
EXPANDED_INPUT_MAX_LINES_VALUES,
|
|
37
38
|
EXPANDED_OUTPUT_MAX_LINES_VALUES,
|
|
38
39
|
EXPANDED_PREVIEW_MAX_LINES_VALUES,
|
|
@@ -201,6 +202,14 @@ function diffIndicatorDescription(mode: DiffIndicatorMode): string {
|
|
|
201
202
|
return "Vertical bar indicators on changed lines (default).";
|
|
202
203
|
}
|
|
203
204
|
|
|
205
|
+
function expandedCardBackgroundDescription(slot: ThemeBg): string {
|
|
206
|
+
if (slot === "userMessageBg") {
|
|
207
|
+
return "Expanded cards share the user message background. Pick another slot to tell them apart.";
|
|
208
|
+
}
|
|
209
|
+
if (slot === "toolPendingBg") return "Expanded cards use the theme's neutral tool background.";
|
|
210
|
+
return `Expanded cards use the theme's ${slot} background.`;
|
|
211
|
+
}
|
|
212
|
+
|
|
204
213
|
/** 额外功能开关项:on/off 二值,描述随状态切换;切换后需重启生效。 */
|
|
205
214
|
function featureToggleSetting(
|
|
206
215
|
id: string,
|
|
@@ -492,6 +501,13 @@ export async function showCcstylePanel(
|
|
|
492
501
|
submenu: (_current: string, closeSubmenu: (selected?: string) => void) =>
|
|
493
502
|
buildNumberInputSubmenu(theme, expandedMaxSetting, closeSubmenu),
|
|
494
503
|
};
|
|
504
|
+
const expandedCardBgSetting = {
|
|
505
|
+
id: "expandedCardBackground",
|
|
506
|
+
label: "Expanded card bg",
|
|
507
|
+
description: expandedCardBackgroundDescription(config.expandedCardBackground),
|
|
508
|
+
currentValue: config.expandedCardBackground,
|
|
509
|
+
values: [...EXPANDED_CARD_BACKGROUND_SLOTS],
|
|
510
|
+
};
|
|
495
511
|
const thinkingTitleSetting = {
|
|
496
512
|
id: "useSummaryTitlesAsThinkingTitle",
|
|
497
513
|
label: "Summary title",
|
|
@@ -759,6 +775,12 @@ export async function showCcstylePanel(
|
|
|
759
775
|
});
|
|
760
776
|
expandedMaxSetting.currentValue = String(config.expandedPreviewMaxLines);
|
|
761
777
|
break;
|
|
778
|
+
case "expandedCardBackground":
|
|
779
|
+
updateConfig({ expandedCardBackground: value as ThemeBg });
|
|
780
|
+
expandedCardBgSetting.description = expandedCardBackgroundDescription(
|
|
781
|
+
config.expandedCardBackground,
|
|
782
|
+
);
|
|
783
|
+
break;
|
|
762
784
|
case "useSummaryTitlesAsThinkingTitle":
|
|
763
785
|
updateConfig({ useSummaryTitlesAsThinkingTitle: value === "on" });
|
|
764
786
|
break;
|
|
@@ -827,6 +849,7 @@ export async function showCcstylePanel(
|
|
|
827
849
|
expandedInputSetting,
|
|
828
850
|
expandedOutputSetting,
|
|
829
851
|
expandedMaxSetting,
|
|
852
|
+
expandedCardBgSetting,
|
|
830
853
|
inputClipSetting,
|
|
831
854
|
startupHeaderSetting,
|
|
832
855
|
scrollStepSetting,
|
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
wrapTextWithAnsi,
|
|
19
19
|
} from "@earendil-works/pi-tui";
|
|
20
20
|
import { Box, Markdown, Spacer, Text, type Component } from "@earendil-works/pi-tui";
|
|
21
|
+
// 展开卡背景是 ccstyle 的渲染约定,不随上游 CompactThinkingConfig 走,直接读全局配置。
|
|
22
|
+
import { config as styleConfig } from "../config/config.ts";
|
|
21
23
|
import { isToolTuiFullscreen } from "../renderer/tool/show-more-hint.ts";
|
|
22
24
|
import {
|
|
23
25
|
animateCompactThinkingText,
|
|
@@ -309,14 +311,15 @@ function hiddenPreviewHint(
|
|
|
309
311
|
const action = thinkingExpandAction() ?? "";
|
|
310
312
|
if (hiddenLines > 0) {
|
|
311
313
|
const noun = hiddenLines === 1 ? "line" : "lines";
|
|
314
|
+
// 与其它提示同一套写法:小圆点连接,不用逗号和括号
|
|
312
315
|
return {
|
|
313
|
-
prefix: `
|
|
316
|
+
prefix: ` · ${hiddenLines} more ${noun}${action ? " · " : ""}`,
|
|
314
317
|
action,
|
|
315
|
-
suffix: "
|
|
318
|
+
suffix: "",
|
|
316
319
|
};
|
|
317
320
|
}
|
|
318
321
|
if (forceExpandHint && isToolTuiFullscreen()) {
|
|
319
|
-
return { prefix: "
|
|
322
|
+
return { prefix: " · ", action: "click to show more", suffix: "" };
|
|
320
323
|
}
|
|
321
324
|
return undefined;
|
|
322
325
|
}
|
|
@@ -432,7 +435,7 @@ export class ThinkingPreviewBlock implements Component {
|
|
|
432
435
|
: heading;
|
|
433
436
|
const bgFn =
|
|
434
437
|
this.theme && typeof this.theme.bg === "function"
|
|
435
|
-
? (text: string) => this.theme!.bg(
|
|
438
|
+
? (text: string) => this.theme!.bg(styleConfig.expandedCardBackground, text)
|
|
436
439
|
: undefined;
|
|
437
440
|
const box = new Box(1, 1, bgFn);
|
|
438
441
|
box.addChild({
|
|
@@ -28,18 +28,24 @@ import {
|
|
|
28
28
|
visibleFooterPluginTexts,
|
|
29
29
|
type FooterChipLayout,
|
|
30
30
|
} from "./footer-layout.ts";
|
|
31
|
+
import { MCP_STATUS_KEY, buildMcpChip } from "./mcp-chip.ts";
|
|
31
32
|
|
|
32
33
|
const GIT_REFRESH_INTERVAL_MS = 10_000;
|
|
33
34
|
const USAGE_REFRESH_INTERVAL_MS = 5 * 60 * 1000;
|
|
35
|
+
// 后台连接 MCP 服务器不会触发 footer 重绘,靠这个兜底轮询把芯片刷出来
|
|
36
|
+
const MCP_REFRESH_INTERVAL_MS = 5_000;
|
|
34
37
|
const USAGE_TIMEOUT_MS = 15_000;
|
|
35
38
|
// zentui NERD_DEFAULT_ICONS:git / cacheHit。无 Nerd Font 时留空,只保留文字。
|
|
36
39
|
export const FOOTER_NERD_ICON_GIT = "";
|
|
37
40
|
export const FOOTER_NERD_ICON_CACHE = "";
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
// md power-plug:MCP 服务器连接数
|
|
43
|
+
export const FOOTER_NERD_ICON_MCP = "\u{f06a5}";
|
|
44
|
+
|
|
45
|
+
export function footerGlyphs(nerdIcons: boolean): { git: string; cache: string; mcp: string } {
|
|
40
46
|
return nerdIcons
|
|
41
|
-
? { git: FOOTER_NERD_ICON_GIT, cache: FOOTER_NERD_ICON_CACHE }
|
|
42
|
-
: { git: "", cache: "" };
|
|
47
|
+
? { git: FOOTER_NERD_ICON_GIT, cache: FOOTER_NERD_ICON_CACHE, mcp: FOOTER_NERD_ICON_MCP }
|
|
48
|
+
: { git: "", cache: "", mcp: "" };
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
type GitStats = { add: number; del: number };
|
|
@@ -97,8 +103,15 @@ export function formatXaiFooterChip(report: XaiFooterReport): string | undefined
|
|
|
97
103
|
|
|
98
104
|
const cachedExtensionStatuses = new Map<string, string>();
|
|
99
105
|
let cachedLocalUsageText = "";
|
|
106
|
+
/** 本包推算的内置 MCP 芯片(含 nerd 图标);空字符串表示不显示。 */
|
|
107
|
+
let cachedMcpChip = "";
|
|
108
|
+
|
|
109
|
+
/** 别的扩展(pi-mcp-adapter)自己写了 mcp 状态时不画,避免两个芯片。 */
|
|
110
|
+
function ownMcpChip(): string {
|
|
111
|
+
return cachedMcpChip && !cachedExtensionStatuses.has(MCP_STATUS_KEY) ? cachedMcpChip : "";
|
|
112
|
+
}
|
|
100
113
|
|
|
101
|
-
/** 面板用:当前 setStatus 文案 + 本包 pi-usage(无文案时为空字符串)。 */
|
|
114
|
+
/** 面板用:当前 setStatus 文案 + 本包 pi-usage / MCP(无文案时为空字符串)。 */
|
|
102
115
|
export function getFooterStatusSnapshot(): Map<string, string> {
|
|
103
116
|
const out = new Map<string, string>();
|
|
104
117
|
for (const [key, text] of cachedExtensionStatuses) {
|
|
@@ -106,6 +119,8 @@ export function getFooterStatusSnapshot(): Map<string, string> {
|
|
|
106
119
|
out.set(key, text);
|
|
107
120
|
}
|
|
108
121
|
out.set(PI_USAGE_KEY, cachedLocalUsageText);
|
|
122
|
+
const mcpChip = ownMcpChip();
|
|
123
|
+
if (mcpChip) out.set(MCP_STATUS_KEY, mcpChip);
|
|
109
124
|
return out;
|
|
110
125
|
}
|
|
111
126
|
|
|
@@ -167,6 +182,9 @@ function colorUsageChip(theme: any, text: string): string {
|
|
|
167
182
|
let currentTui: any = undefined;
|
|
168
183
|
let refreshCurrentGitStats: (() => void) | undefined;
|
|
169
184
|
let refreshCurrentUsage: (() => void) | undefined;
|
|
185
|
+
let refreshCurrentMcpChip: (() => void) | undefined;
|
|
186
|
+
/** 工具/命令列表在 pi API 上,而 footer 工厂只拿得到 ctx,加载时记下来。 */
|
|
187
|
+
let extensionApi: Pick<ExtensionAPI, "getAllTools" | "getCommands"> | undefined;
|
|
170
188
|
|
|
171
189
|
const createCustomFooterFactory =
|
|
172
190
|
(ctx: ExtensionContext) => (tui: any, theme: any, footerData: any) => {
|
|
@@ -281,6 +299,21 @@ const createCustomFooterFactory =
|
|
|
281
299
|
const usageRefreshTimer = setInterval(refreshUsage, USAGE_REFRESH_INTERVAL_MS);
|
|
282
300
|
usageRefreshTimer.unref?.();
|
|
283
301
|
|
|
302
|
+
// 内置 MCP 的状态不经 setStatus 暴露,只能轮询 pi API 与 mcp.json 推算
|
|
303
|
+
const refreshMcp = () => {
|
|
304
|
+
if (disposed) return;
|
|
305
|
+
const chip = buildMcpChip(ctx, extensionApi);
|
|
306
|
+
const glyph = footerGlyphs(config.footerNerdIcons).mcp;
|
|
307
|
+
const next = chip ? `${glyph ? `${glyph} ` : ""}${chip}` : "";
|
|
308
|
+
if (cachedMcpChip === next) return;
|
|
309
|
+
cachedMcpChip = next;
|
|
310
|
+
tui.requestRender();
|
|
311
|
+
};
|
|
312
|
+
refreshCurrentMcpChip = refreshMcp;
|
|
313
|
+
refreshMcp();
|
|
314
|
+
const mcpRefreshTimer = setInterval(refreshMcp, MCP_REFRESH_INTERVAL_MS);
|
|
315
|
+
mcpRefreshTimer.unref?.();
|
|
316
|
+
|
|
284
317
|
// 分支变化时同步更新分支名和相对 HEAD 的统计。
|
|
285
318
|
const unsubBranch = footerData.onBranchChange(() => {
|
|
286
319
|
refreshGitStats();
|
|
@@ -359,6 +392,8 @@ const createCustomFooterFactory =
|
|
|
359
392
|
footerData.getExtensionStatuses().entries() as Iterable<[string, string]>,
|
|
360
393
|
);
|
|
361
394
|
const pluginTexts = pluginTextsForRender(localUsageChip);
|
|
395
|
+
const mcpChip = ownMcpChip();
|
|
396
|
+
if (mcpChip) pluginTexts.set(MCP_STATUS_KEY, mcpChip);
|
|
362
397
|
const layout = resolveFooterChipLayout(layoutFromConfig(), [...pluginTexts.keys()]);
|
|
363
398
|
const dimPlugin = (text: string) => colorUsageChip(theme, text);
|
|
364
399
|
const line1Plugins = visibleFooterPluginTexts(
|
|
@@ -436,11 +471,13 @@ const createCustomFooterFactory =
|
|
|
436
471
|
usageAbort = undefined;
|
|
437
472
|
clearInterval(gitRefreshTimer);
|
|
438
473
|
clearInterval(usageRefreshTimer);
|
|
474
|
+
clearInterval(mcpRefreshTimer);
|
|
439
475
|
unsubBranch();
|
|
440
476
|
if (currentTui === tui) {
|
|
441
477
|
currentTui = undefined;
|
|
442
478
|
refreshCurrentGitStats = undefined;
|
|
443
479
|
refreshCurrentUsage = undefined;
|
|
480
|
+
refreshCurrentMcpChip = undefined;
|
|
444
481
|
}
|
|
445
482
|
},
|
|
446
483
|
};
|
|
@@ -463,6 +500,7 @@ export function clearCustomFooter(ctx: ExtensionContext): void {
|
|
|
463
500
|
}
|
|
464
501
|
|
|
465
502
|
export default function (pi: ExtensionAPI) {
|
|
503
|
+
extensionApi = pi;
|
|
466
504
|
// 模型/思考级别变化时强制重渲染(自定义 footer 不会被内置 invalidate() 触达)
|
|
467
505
|
pi.on("model_select", () => {
|
|
468
506
|
currentTui?.requestRender();
|
|
@@ -470,7 +508,11 @@ export default function (pi: ExtensionAPI) {
|
|
|
470
508
|
});
|
|
471
509
|
pi.on("thinking_level_select", () => currentTui?.requestRender());
|
|
472
510
|
// 工具执行完成后立即刷新;定时器只负责兜底捕获外部文件变化。
|
|
473
|
-
pi.on("tool_execution_end", () =>
|
|
511
|
+
pi.on("tool_execution_end", () => {
|
|
512
|
+
refreshCurrentGitStats?.();
|
|
513
|
+
// 懒连接的 MCP 服务器可能刚被调用过
|
|
514
|
+
refreshCurrentMcpChip?.();
|
|
515
|
+
});
|
|
474
516
|
|
|
475
517
|
// 启动 / /reload / 新建会话 时按配置恢复
|
|
476
518
|
pi.on("session_start", (_event, ctx) => {
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 内置 MCP 的状态栏芯片。
|
|
3
|
+
*
|
|
4
|
+
* pi 的内置 MCP 不写 setStatus:连接状态只在 `/mcp` 菜单里,扩展读不到。这里用公开数据推算
|
|
5
|
+
* 「已连接/已配置」,并在别的扩展接管 `/mcp` 时让位(pi-mcp-adapter 这类扩展自己会写 "mcp" 状态)。
|
|
6
|
+
*
|
|
7
|
+
* - 已连接:`pi.getAllTools()` 里来源是 builtin:mcp、曝光非 hidden 的工具,按 namespace 去重。
|
|
8
|
+
* 断线后工具仍在、0 个工具的服务器连上也看不见,needs-auth / failed 与 connecting 也分不开,
|
|
9
|
+
* 所以这只是近似值。
|
|
10
|
+
* - 已配置:mcp.json 里 enabled !== false 的条目(项目级要已 trust)。
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { readFileSync, statSync } from "node:fs";
|
|
14
|
+
import { homedir } from "node:os";
|
|
15
|
+
import { join } from "node:path";
|
|
16
|
+
|
|
17
|
+
/** 与 pi-mcp-adapter 共用同一个 status key;它写了 key 时本扩展不画。 */
|
|
18
|
+
export const MCP_STATUS_KEY = "mcp";
|
|
19
|
+
/** 内置 MCP 扩展的资源路径。 */
|
|
20
|
+
export const BUILTIN_MCP_SOURCE = "builtin:mcp";
|
|
21
|
+
const MCP_NAMESPACE_PREFIX = "mcp__";
|
|
22
|
+
|
|
23
|
+
type McpConfigCacheEntry = { mtimeMs: number; names: string[] };
|
|
24
|
+
|
|
25
|
+
const configCache = new Map<string, McpConfigCacheEntry>();
|
|
26
|
+
|
|
27
|
+
export function mcpAgentDir(): string {
|
|
28
|
+
return process.env.PI_CODING_AGENT_DIR ?? join(homedir(), ".pi", "agent");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** pi 把 `-` 与 `_` 视作同一个服务器名(`mcpNamespace` 只把 `-` 换成 `_`)。 */
|
|
32
|
+
export function normalizeMcpServerName(name: string): string {
|
|
33
|
+
return name.trim().replace(/-/g, "_");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** `mcp__<server>` → `<server>`;不是 MCP 命名空间返回 undefined。 */
|
|
37
|
+
export function mcpNamespaceServer(namespace: string): string | undefined {
|
|
38
|
+
if (!namespace.startsWith(MCP_NAMESPACE_PREFIX)) return undefined;
|
|
39
|
+
const server = namespace.slice(MCP_NAMESPACE_PREFIX.length);
|
|
40
|
+
return server || undefined;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** 已连接的服务器名(按 namespace 去重,返回规范化名字)。 */
|
|
44
|
+
export function connectedMcpServers(tools: readonly any[]): string[] {
|
|
45
|
+
const fromBuiltin = new Set<string>();
|
|
46
|
+
const fromNamespace = new Set<string>();
|
|
47
|
+
for (const tool of tools ?? []) {
|
|
48
|
+
if (tool?.exposure === "hidden") continue;
|
|
49
|
+
const server = mcpNamespaceServer(String(tool?.namespace?.name ?? ""));
|
|
50
|
+
if (!server) continue;
|
|
51
|
+
const name = normalizeMcpServerName(server);
|
|
52
|
+
if (tool?.sourceInfo?.path === BUILTIN_MCP_SOURCE) fromBuiltin.add(name);
|
|
53
|
+
else fromNamespace.add(name);
|
|
54
|
+
}
|
|
55
|
+
// 版本漂移兜底:来源路径对不上时按 namespace 认(接管 /mcp 的扩展已在此之前排除)
|
|
56
|
+
return [...(fromBuiltin.size > 0 ? fromBuiltin : fromNamespace)];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** `MCP 2/3`:已连接/(已连接 ∪ 已配置)。两边都空时不显示。 */
|
|
60
|
+
export function formatMcpChip(
|
|
61
|
+
connected: readonly string[],
|
|
62
|
+
configured: readonly string[],
|
|
63
|
+
): string | undefined {
|
|
64
|
+
const connectedNames = new Set(connected.map(normalizeMcpServerName).filter(Boolean));
|
|
65
|
+
const configuredNames = new Set(configured.map(normalizeMcpServerName).filter(Boolean));
|
|
66
|
+
const total = new Set([...connectedNames, ...configuredNames]).size;
|
|
67
|
+
if (total === 0) return undefined;
|
|
68
|
+
return `MCP ${connectedNames.size}/${total}`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** 读一个 mcp.json 里启用中的服务器名;文件缺失或损坏返回 undefined。 */
|
|
72
|
+
function readMcpConfigNames(path: string): string[] | undefined {
|
|
73
|
+
try {
|
|
74
|
+
const { mtimeMs } = statSync(path);
|
|
75
|
+
const cached = configCache.get(path);
|
|
76
|
+
if (cached && cached.mtimeMs === mtimeMs) return cached.names;
|
|
77
|
+
const parsed = JSON.parse(readFileSync(path, "utf8")) as { mcpServers?: unknown };
|
|
78
|
+
const servers = parsed?.mcpServers;
|
|
79
|
+
const names: string[] = [];
|
|
80
|
+
if (servers && typeof servers === "object" && !Array.isArray(servers)) {
|
|
81
|
+
for (const [name, entry] of Object.entries(servers as Record<string, unknown>)) {
|
|
82
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) continue;
|
|
83
|
+
if ((entry as { enabled?: unknown }).enabled === false) continue;
|
|
84
|
+
names.push(name);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
configCache.set(path, { mtimeMs, names });
|
|
88
|
+
return names;
|
|
89
|
+
} catch {
|
|
90
|
+
configCache.delete(path);
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** mcp.json 里启用中的服务器名:用户级,加上已信任时的项目级(同名以项目为准,计数时去重)。 */
|
|
96
|
+
export function configuredMcpServers(options: {
|
|
97
|
+
agentDir: string;
|
|
98
|
+
cwd: string;
|
|
99
|
+
projectTrusted: boolean;
|
|
100
|
+
}): string[] {
|
|
101
|
+
const names = [...(readMcpConfigNames(join(options.agentDir, "mcp.json")) ?? [])];
|
|
102
|
+
if (options.projectTrusted) {
|
|
103
|
+
names.push(...(readMcpConfigNames(join(options.cwd, ".pi", "mcp.json")) ?? []));
|
|
104
|
+
}
|
|
105
|
+
return names;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** 注册了 `/mcp` 的都是内置 MCP;别的扩展接管时它自己会写状态芯片。 */
|
|
109
|
+
export function builtinMcpOwnsCommand(commands: readonly any[]): boolean {
|
|
110
|
+
const mcpCommands = (commands ?? []).filter((command) => command?.name === MCP_STATUS_KEY);
|
|
111
|
+
return (
|
|
112
|
+
mcpCommands.length > 0 &&
|
|
113
|
+
mcpCommands.every((command) => command?.sourceInfo?.path === BUILTIN_MCP_SOURCE)
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** footer 渲染用:当前芯片文案(不含 nerd 图标),不适用时返回 undefined。 */
|
|
118
|
+
export function buildMcpChip(ctx: any, api: any): string | undefined {
|
|
119
|
+
try {
|
|
120
|
+
// 工具与命令列表在 pi API 上,ctx 只提供 cwd / trust
|
|
121
|
+
if (!builtinMcpOwnsCommand(api?.getCommands?.() ?? [])) return undefined;
|
|
122
|
+
const tools = api?.getAllTools?.();
|
|
123
|
+
if (!Array.isArray(tools)) return undefined;
|
|
124
|
+
return formatMcpChip(
|
|
125
|
+
connectedMcpServers(tools),
|
|
126
|
+
configuredMcpServers({
|
|
127
|
+
agentDir: mcpAgentDir(),
|
|
128
|
+
cwd: String(ctx?.cwd ?? process.cwd()),
|
|
129
|
+
projectTrusted: ctx?.isProjectTrusted?.() === true,
|
|
130
|
+
}),
|
|
131
|
+
);
|
|
132
|
+
} catch {
|
|
133
|
+
// footer 不能因为读配置或读工具列表失败而中断渲染
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
}
|