personal-bot 0.3.1 → 0.3.3
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +2 -1
- package/DISCLAIMER.md +17 -0
- package/LICENSE +21 -0
- package/README.md +15 -5
- package/README.zh-CN.md +15 -5
- package/bin/pbot-pi-acp.mjs +27 -11
- package/bin/pbot.mjs +22 -2
- package/docs/README.md +3 -1
- package/docs/architecture/design.md +37 -24
- package/docs/architecture/extensibility.md +27 -19
- package/docs/architecture/model-context.md +4 -3
- package/docs/architecture/principles.md +5 -4
- package/docs/guides/capabilities.md +4 -4
- package/docs/guides/cross-harness-workers.md +3 -1
- package/docs/guides/history.md +73 -16
- package/docs/guides/workspace-configuration.md +35 -6
- package/docs/hosts/antigravity.md +2 -0
- package/docs/hosts/claude-code.md +1 -1
- package/docs/hosts/codex-qoder.md +63 -0
- package/docs/hosts/dsh.md +1 -1
- package/docs/hosts/pi.md +1 -1
- package/docs/maintainers/architecture-governance.md +78 -0
- package/hooks/hooks.json +3 -0
- package/lib/antigravity-plugin/DISCLAIMER.md +17 -0
- package/lib/antigravity-plugin/LICENSE +21 -0
- package/lib/antigravity-plugin/bin/pbot-pi-acp.mjs +36 -0
- package/lib/antigravity-plugin/hooks.json +7 -0
- package/lib/antigravity-plugin/lib/claude.js +2 -2
- package/lib/antigravity-plugin/lib/common/files.d.ts +2 -0
- package/lib/antigravity-plugin/lib/common/files.js +44 -0
- package/lib/antigravity-plugin/lib/common/validation.d.ts +4 -0
- package/lib/antigravity-plugin/lib/common/validation.js +8 -0
- package/lib/{extension/acp-member.d.ts → antigravity-plugin/lib/extension/acp/member.d.ts} +5 -5
- package/lib/{extension/acp-member.js → antigravity-plugin/lib/extension/acp/member.js} +6 -6
- package/lib/antigravity-plugin/lib/extension/acp-worker.js +222 -51
- package/lib/antigravity-plugin/lib/extension/hosts/dsh/acp-entry.d.ts +1 -0
- package/lib/antigravity-plugin/lib/extension/hosts/dsh/acp-entry.js +22 -0
- package/lib/{extension → antigravity-plugin/lib/extension/hosts}/dsh/acp-member.js +11 -25
- package/lib/{extension → antigravity-plugin/lib/extension/hosts}/dsh/files.js +3 -3
- package/lib/antigravity-plugin/lib/extension/hosts/pi/acp-member.d.ts +3 -0
- package/lib/antigravity-plugin/lib/extension/hosts/pi/acp-member.js +100 -0
- package/lib/antigravity-plugin/lib/extension/hosts/plugin-runtime.d.ts +12 -0
- package/lib/antigravity-plugin/lib/extension/hosts/plugin-runtime.js +101 -0
- package/lib/antigravity-plugin/lib/extension/hosts/workspace-mcp.d.ts +6 -0
- package/lib/antigravity-plugin/lib/extension/hosts/workspace-mcp.js +21 -0
- package/lib/antigravity-plugin/lib/extension/mcp.js +2705 -1348
- package/lib/antigravity-plugin/lib/extension/workspace-cli.js +20127 -0
- package/lib/antigravity-plugin/lib/integrations/agent-resources.d.ts +1 -0
- package/lib/antigravity-plugin/lib/integrations/agent-resources.js +6 -2
- package/lib/antigravity-plugin/lib/integrations/hosts/antigravity/adapter.d.ts +6 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/antigravity/adapter.js +171 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/{claude.d.ts → claude/adapter.d.ts} +1 -1
- package/lib/antigravity-plugin/lib/integrations/hosts/claude/adapter.js +36 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/codex/adapter.d.ts +2 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/codex/adapter.js +14 -0
- package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/mcp.d.ts +1 -1
- package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/resources.d.ts +1 -1
- package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/resources.js +4 -4
- package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/skills.js +1 -1
- package/lib/antigravity-plugin/lib/integrations/hosts/pi/agent-tools.d.ts +3 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/pi/agent-tools.js +32 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/pi/mcp.d.ts +4 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/pi/mcp.js +23 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/{registry.d.ts → plugin-registry.d.ts} +1 -0
- package/lib/{integrations/hosts/registry.js → antigravity-plugin/lib/integrations/hosts/plugin-registry.js} +10 -3
- package/lib/antigravity-plugin/lib/integrations/hosts/prompt-hooks.d.ts +76 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/prompt-hooks.js +76 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/qoder/adapter.d.ts +2 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/qoder/adapter.js +16 -0
- package/lib/antigravity-plugin/lib/model/acp.d.ts +7 -3
- package/lib/antigravity-plugin/lib/model/acp.js +8 -0
- package/lib/antigravity-plugin/lib/model/agent.d.ts +121 -0
- package/lib/antigravity-plugin/lib/model/agent.js +4 -0
- package/lib/antigravity-plugin/lib/model/history.d.ts +179 -0
- package/lib/antigravity-plugin/lib/model/history.js +4 -0
- package/lib/antigravity-plugin/lib/model/plugin-host.d.ts +31 -0
- package/lib/antigravity-plugin/lib/model/workspace-config.d.ts +28 -7
- package/lib/antigravity-plugin/lib/model/workspace-config.js +2 -1
- package/lib/antigravity-plugin/lib/plugin.d.ts +2 -1
- package/lib/antigravity-plugin/lib/plugin.js +4 -4
- package/lib/antigravity-plugin/lib/services/history/history-capture.d.ts +4 -0
- package/lib/antigravity-plugin/lib/services/history/history-capture.js +98 -0
- package/lib/antigravity-plugin/lib/services/history/history-index.d.ts +17 -0
- package/lib/antigravity-plugin/lib/services/history/history-index.js +112 -0
- package/lib/antigravity-plugin/lib/services/history/summary-dimensions/monthly.d.ts +7 -0
- package/lib/antigravity-plugin/lib/services/history/summary-dimensions/monthly.js +121 -0
- package/lib/antigravity-plugin/lib/services/history/summary-dimensions/session.d.ts +7 -0
- package/lib/antigravity-plugin/lib/services/history/summary-dimensions/session.js +124 -0
- package/lib/antigravity-plugin/lib/services/history/summary-registry.d.ts +7 -0
- package/lib/antigravity-plugin/lib/services/history/summary-registry.js +35 -0
- package/lib/antigravity-plugin/lib/services/history/summary-runner.d.ts +34 -0
- package/lib/antigravity-plugin/lib/services/history/summary-runner.js +299 -0
- package/lib/antigravity-plugin/lib/services/history/workspace-history.d.ts +3 -0
- package/lib/antigravity-plugin/lib/services/history/workspace-history.js +6 -0
- package/lib/antigravity-plugin/lib/services/workspace/plugin-releases.d.ts +3 -0
- package/lib/antigravity-plugin/lib/services/workspace/plugin-releases.js +78 -0
- package/lib/antigravity-plugin/lib/services/workspace/workspace-config.d.ts +5 -1
- package/lib/antigravity-plugin/lib/services/workspace/workspace-config.js +77 -7
- package/lib/antigravity-plugin/lib/services/workspace/workspace-files.d.ts +2 -0
- package/lib/antigravity-plugin/lib/services/workspace/workspace-files.js +17 -0
- package/lib/antigravity-plugin/lib/services/workspace/workspace-mcp.d.ts +14 -0
- package/lib/antigravity-plugin/lib/services/workspace/workspace-mcp.js +193 -0
- package/lib/antigravity-plugin/lib/services/workspace/workspace-skills.d.ts +1 -0
- package/lib/antigravity-plugin/lib/services/workspace/workspace-skills.js +4 -2
- package/lib/antigravity-plugin/lib/storage/acp-files.d.ts +11 -0
- package/lib/antigravity-plugin/lib/storage/acp-files.js +75 -0
- package/lib/antigravity-plugin/lib/storage/agent-files.d.ts +31 -0
- package/lib/antigravity-plugin/lib/storage/agent-files.js +159 -0
- package/lib/antigravity-plugin/lib/storage/atomic-json.d.ts +3 -1
- package/lib/antigravity-plugin/lib/storage/atomic-json.js +43 -3
- package/lib/antigravity-plugin/lib/storage/file-access.d.ts +2 -0
- package/lib/antigravity-plugin/lib/storage/file-access.js +26 -0
- package/lib/antigravity-plugin/lib/storage/history-files.d.ts +55 -0
- package/lib/antigravity-plugin/lib/storage/history-files.js +473 -0
- package/lib/antigravity-plugin/lib/storage/history-format.d.ts +5 -0
- package/lib/antigravity-plugin/lib/storage/history-format.js +60 -0
- package/lib/antigravity-plugin/package.json +1 -1
- package/lib/antigravity-plugin/plugin.json +1 -1
- package/lib/antigravity-plugin/resources/prompts/history-monthly-summary.md +13 -0
- package/lib/antigravity-plugin/resources/prompts/history-summary.md +13 -0
- package/lib/antigravity-plugin/resources/prompts/plugin-coordinator.md +1 -0
- package/lib/antigravity-plugin/resources/skills/.claude-plugin/plugin.json +4 -0
- package/lib/antigravity-plugin/resources/skills/project-maintenance/SKILL.md +35 -0
- package/lib/antigravity-plugin/resources/skills/provider-connections/SKILL.md +52 -0
- package/lib/antigravity-plugin/skills/pbot/SKILL.md +11 -1
- package/lib/antigravity-plugin/skills/provider-connections/SKILL.md +22 -12
- package/lib/claude.js +2 -2
- package/lib/client.js +42 -60
- package/lib/codex-marketplace/.agents/plugins/marketplace.json +17 -0
- package/lib/codex-marketplace/plugins/personal-bot/.codex-plugin/plugin.json +7 -0
- package/lib/codex-marketplace/plugins/personal-bot/.mcp.json +17 -0
- package/lib/codex-marketplace/plugins/personal-bot/DISCLAIMER.md +17 -0
- package/lib/codex-marketplace/plugins/personal-bot/LICENSE +21 -0
- package/lib/codex-marketplace/plugins/personal-bot/hooks/hooks.json +37 -0
- package/lib/codex-marketplace/plugins/personal-bot/skills/pbot/SKILL.md +9 -0
- package/lib/codex-marketplace/plugins/personal-bot/skills/pbot/agents/openai.yaml +2 -0
- package/lib/common/validation.d.ts +4 -0
- package/lib/common/validation.js +8 -0
- package/lib/dsh.js +6 -6
- package/lib/extension/acp/member.d.ts +18 -0
- package/lib/extension/acp/member.js +44 -0
- package/lib/extension/acp/worker.js +384 -0
- package/lib/extension/acp-worker.js +222 -51
- package/lib/extension/history/command.d.ts +37 -0
- package/lib/extension/history/command.js +57 -0
- package/lib/extension/hosts/dsh/acp-entry.d.ts +1 -0
- package/lib/extension/hosts/dsh/acp-entry.js +22 -0
- package/lib/extension/hosts/dsh/acp-member.d.ts +4 -0
- package/lib/extension/hosts/dsh/acp-member.js +58 -0
- package/lib/extension/{dsh → hosts/dsh}/command.d.ts +1 -2
- package/lib/extension/{dsh → hosts/dsh}/command.js +9 -11
- package/lib/extension/hosts/dsh/files.d.ts +5 -0
- package/lib/extension/hosts/dsh/files.js +67 -0
- package/lib/extension/hosts/dsh/history.d.ts +4 -0
- package/lib/extension/hosts/dsh/history.js +62 -0
- package/lib/extension/{dsh → hosts/dsh}/management.d.ts +1 -1
- package/lib/extension/{dsh → hosts/dsh}/management.js +12 -10
- package/lib/extension/{dsh → hosts/dsh}/workspace.d.ts +3 -9
- package/lib/extension/{dsh → hosts/dsh}/workspace.js +30 -99
- package/lib/extension/hosts/pi/acp-member.d.ts +3 -0
- package/lib/extension/hosts/pi/acp-member.js +100 -0
- package/lib/extension/hosts/plugin-runtime.d.ts +12 -0
- package/lib/extension/hosts/plugin-runtime.js +101 -0
- package/lib/extension/hosts/workspace-mcp.d.ts +6 -0
- package/lib/extension/hosts/workspace-mcp.js +21 -0
- package/lib/extension/{mcp-bridge.d.ts → mcp/bridge.d.ts} +7 -9
- package/lib/extension/{mcp-bridge.js → mcp/bridge.js} +70 -88
- package/lib/extension/{mcp-workers.d.ts → mcp/tool-contract.d.ts} +129 -374
- package/lib/extension/mcp/tool-contract.js +441 -0
- package/lib/extension/mcp/workers.d.ts +487 -0
- package/lib/extension/mcp/workers.js +598 -0
- package/lib/extension/mcp.js +2705 -1348
- package/lib/extension/{setup-cli.js → setup/cli.js} +12 -9
- package/lib/extension/workspace-cli.js +20127 -0
- package/lib/integrations/acp/agents.d.ts +2 -3
- package/lib/integrations/acp/connection.d.ts +11 -10
- package/lib/integrations/acp/connection.js +6 -0
- package/lib/integrations/acp/harnesses/claude.js +1 -1
- package/lib/integrations/acp/harnesses/dsh.js +1 -1
- package/lib/integrations/acp/harnesses/presets.js +8 -0
- package/lib/integrations/acp/history-summary.d.ts +17 -0
- package/lib/integrations/acp/history-summary.js +101 -0
- package/lib/integrations/acp/launch.d.ts +2 -2
- package/lib/integrations/agent-resources.d.ts +1 -0
- package/lib/integrations/agent-resources.js +6 -2
- package/lib/integrations/hosts/antigravity/adapter.d.ts +6 -0
- package/lib/integrations/hosts/antigravity/adapter.js +171 -0
- package/lib/integrations/hosts/{claude.d.ts → claude/adapter.d.ts} +1 -1
- package/lib/integrations/hosts/claude/adapter.js +36 -0
- package/lib/integrations/hosts/codex/adapter.d.ts +2 -0
- package/lib/integrations/hosts/codex/adapter.js +14 -0
- package/lib/integrations/hosts/dsh/mcp.d.ts +4 -0
- package/lib/integrations/hosts/dsh/mcp.js +28 -0
- package/lib/integrations/hosts/dsh/messages.d.ts +36 -0
- package/lib/integrations/hosts/dsh/messages.js +11 -0
- package/lib/integrations/hosts/dsh/resources.d.ts +6 -0
- package/lib/integrations/hosts/dsh/resources.js +47 -0
- package/lib/integrations/hosts/dsh/root-agents.d.ts +4 -0
- package/lib/integrations/hosts/dsh/root-agents.js +3 -0
- package/lib/integrations/{dsh → hosts/dsh}/schema.js +1 -1
- package/lib/integrations/hosts/dsh/skills.d.ts +8 -0
- package/lib/integrations/hosts/dsh/skills.js +31 -0
- package/lib/integrations/hosts/pi/agent-tools.d.ts +3 -0
- package/lib/integrations/hosts/pi/agent-tools.js +32 -0
- package/lib/integrations/hosts/pi/mcp.d.ts +4 -0
- package/lib/integrations/hosts/pi/mcp.js +23 -0
- package/lib/integrations/hosts/{registry.d.ts → plugin-registry.d.ts} +1 -0
- package/lib/{antigravity-plugin/lib/integrations/hosts/registry.js → integrations/hosts/plugin-registry.js} +10 -3
- package/lib/integrations/hosts/prompt-hooks.d.ts +76 -0
- package/lib/integrations/hosts/prompt-hooks.js +76 -0
- package/lib/integrations/hosts/qoder/adapter.d.ts +2 -0
- package/lib/integrations/hosts/qoder/adapter.js +16 -0
- package/lib/integrations/installation/pi-setup.js +1 -1
- package/lib/model/acp.d.ts +7 -3
- package/lib/model/acp.js +8 -0
- package/lib/model/agent.d.ts +18 -4
- package/lib/model/agent.js +4 -1
- package/lib/model/history.d.ts +143 -34
- package/lib/model/history.js +4 -1
- package/lib/model/installation.js +1 -0
- package/lib/model/plugin-host.d.ts +31 -0
- package/lib/model/workspace-config.d.ts +28 -7
- package/lib/model/workspace-config.js +2 -1
- package/lib/plugin.d.ts +2 -1
- package/lib/plugin.js +4 -4
- package/lib/qoder-plugin/.mcp.json +17 -0
- package/lib/qoder-plugin/.qoder-plugin/plugin.json +7 -0
- package/lib/qoder-plugin/DISCLAIMER.md +17 -0
- package/lib/qoder-plugin/LICENSE +21 -0
- package/lib/qoder-plugin/hooks/hooks.json +37 -0
- package/lib/qoder-plugin/skills/pbot/SKILL.md +9 -0
- package/lib/services/agents/agent-run.d.ts +1 -1
- package/lib/services/agents/agent-service.d.ts +15 -45
- package/lib/services/agents/agent-service.js +22 -3
- package/lib/services/history/history-capture.d.ts +4 -0
- package/lib/services/history/history-capture.js +98 -0
- package/lib/services/history/history-index.d.ts +16 -7
- package/lib/services/history/history-index.js +48 -70
- package/lib/services/history/history-migrate.d.ts +12 -0
- package/lib/services/history/history-migrate.js +54 -0
- package/lib/services/history/history-query.d.ts +51 -0
- package/lib/services/history/history-query.js +352 -0
- package/lib/services/history/summary-command.d.ts +20 -0
- package/lib/services/history/summary-command.js +69 -0
- package/lib/services/history/summary-dimensions/monthly.d.ts +7 -0
- package/lib/services/history/summary-dimensions/monthly.js +121 -0
- package/lib/services/history/summary-dimensions/session.d.ts +7 -0
- package/lib/services/history/summary-dimensions/session.js +124 -0
- package/lib/services/history/summary-registry.d.ts +7 -0
- package/lib/services/history/summary-registry.js +35 -0
- package/lib/services/history/summary-runner.d.ts +34 -0
- package/lib/services/history/summary-runner.js +299 -0
- package/lib/services/history/workspace-history.d.ts +3 -0
- package/lib/services/history/workspace-history.js +6 -0
- package/lib/services/workspace/plugin-releases.d.ts +3 -0
- package/lib/services/workspace/plugin-releases.js +78 -0
- package/lib/services/workspace/workspace-config.d.ts +5 -1
- package/lib/services/workspace/workspace-config.js +77 -7
- package/lib/services/workspace/workspace-mcp.js +22 -29
- package/lib/services/workspace/workspace-skills.d.ts +1 -0
- package/lib/services/workspace/workspace-skills.js +4 -2
- package/lib/storage/acp-files.js +7 -12
- package/lib/storage/agent-files.js +6 -5
- package/lib/storage/atomic-json.d.ts +3 -1
- package/lib/storage/atomic-json.js +43 -3
- package/lib/storage/history-files.d.ts +46 -9
- package/lib/storage/history-files.js +382 -250
- package/lib/storage/history-format.d.ts +3 -13
- package/lib/storage/history-format.js +26 -52
- package/lib/tools/history/actions.d.ts +3 -68
- package/lib/tools/history/actions.js +7 -5
- package/lib/tools/history/contract.d.ts +16 -17
- package/lib/tools/history/contract.js +63 -22
- package/lib/tools/history/dsh-tool.d.ts +1 -2
- package/lib/tools/history/dsh-tool.js +11 -5
- package/lib/ui/dsh/elements.d.ts +2 -5
- package/lib/ui/dsh/elements.js +3 -16
- package/lib/ui/dsh/management.js +26 -13
- package/lib/ui/dsh/styles.d.ts +1 -1
- package/lib/ui/dsh/styles.js +5 -33
- package/package.json +4 -1
- package/resources/antigravity/skills/pbot/SKILL.md +11 -1
- package/resources/claude/skills/pbot/SKILL.md +11 -1
- package/resources/plugin/skills/pbot/SKILL.md +9 -0
- package/resources/prompts/history-coordinator.md +2 -1
- package/resources/prompts/history-monthly-summary.md +13 -0
- package/resources/prompts/history-summary.md +10 -4
- package/resources/prompts/plugin-coordinator.md +1 -0
- package/resources/skills/provider-connections/SKILL.md +22 -12
- package/scripts/README.md +3 -2
- package/src/claude.ts +2 -2
- package/src/common/validation.ts +10 -0
- package/src/dsh.ts +6 -6
- package/src/extension/{acp-member.ts → acp/member.ts} +7 -7
- package/src/extension/{acp-worker.ts → acp/worker.ts} +131 -17
- package/src/extension/history/command.ts +68 -0
- package/src/extension/hosts/dsh/acp-entry.ts +21 -0
- package/src/extension/{dsh → hosts/dsh}/acp-member.ts +12 -23
- package/src/extension/{dsh → hosts/dsh}/command.ts +10 -12
- package/src/extension/{dsh → hosts/dsh}/files.ts +3 -3
- package/src/extension/hosts/dsh/history.ts +67 -0
- package/src/extension/{dsh → hosts/dsh}/management.ts +11 -9
- package/src/extension/{dsh → hosts/dsh}/workspace.ts +31 -76
- package/src/extension/{pi-acp-member.ts → hosts/pi/acp-member.ts} +12 -18
- package/src/extension/{command.ts → hosts/pi/command.ts} +44 -11
- package/src/extension/{events.ts → hosts/pi/events.ts} +8 -4
- package/src/extension/hosts/pi/history.ts +45 -0
- package/src/extension/{lifecycle.ts → hosts/pi/lifecycle.ts} +9 -12
- package/src/extension/hosts/plugin-runtime.ts +96 -0
- package/src/extension/hosts/workspace-mcp.ts +25 -0
- package/src/extension/{mcp-bridge.ts → mcp/bridge.ts} +85 -85
- package/src/extension/mcp/tool-contract.ts +462 -0
- package/src/extension/{mcp-workers.ts → mcp/workers.ts} +151 -448
- package/src/extension/{setup-cli.ts → setup/cli.ts} +14 -11
- package/src/extension/setup/workspace-cli.ts +159 -0
- package/src/integrations/acp/agents.ts +2 -3
- package/src/integrations/acp/connection.ts +6 -0
- package/src/integrations/acp/harnesses/claude.ts +1 -1
- package/src/integrations/acp/harnesses/dsh.ts +1 -1
- package/src/integrations/acp/harnesses/presets.ts +8 -0
- package/src/integrations/acp/history-summary.ts +109 -0
- package/src/integrations/agent-resources.ts +7 -1
- package/src/integrations/hosts/antigravity/adapter.ts +161 -0
- package/src/integrations/hosts/claude/adapter.ts +39 -0
- package/src/integrations/hosts/codex/adapter.ts +16 -0
- package/src/integrations/{dsh → hosts/dsh}/mcp.ts +1 -1
- package/src/integrations/{dsh → hosts/dsh}/resources.ts +5 -5
- package/src/integrations/{dsh → hosts/dsh}/schema.ts +1 -1
- package/src/integrations/{dsh → hosts/dsh}/session.ts +2 -2
- package/src/integrations/{dsh → hosts/dsh}/skills.ts +1 -1
- package/src/integrations/{pi → hosts/pi}/mcp.ts +1 -1
- package/src/integrations/{pi → hosts/pi}/skills.ts +1 -1
- package/src/integrations/hosts/{registry.ts → plugin-registry.ts} +11 -3
- package/src/integrations/hosts/prompt-hooks.ts +72 -0
- package/src/integrations/hosts/qoder/adapter.ts +19 -0
- package/src/integrations/installation/cli-update.ts +116 -0
- package/src/integrations/installation/pi-bridge.ts +1 -1
- package/src/integrations/installation/pi-setup.ts +2 -2
- package/src/integrations/installation/processes.ts +1 -1
- package/src/mcp.ts +1 -1
- package/src/model/acp.ts +11 -3
- package/src/model/agent.ts +20 -4
- package/src/model/history.ts +156 -26
- package/src/model/installation.ts +41 -0
- package/src/model/plugin-host.ts +30 -2
- package/src/model/workspace-config.ts +31 -7
- package/src/pbot.ts +22 -50
- package/src/plugin.ts +4 -4
- package/src/services/agents/agent-service.ts +29 -17
- package/src/services/history/history-capture.ts +91 -0
- package/src/services/history/history-index.ts +48 -62
- package/src/services/history/history-migrate.ts +62 -0
- package/src/services/history/history-query.ts +401 -0
- package/src/services/history/summary-command.ts +70 -0
- package/src/services/history/summary-dimensions/monthly.ts +139 -0
- package/src/services/history/summary-dimensions/session.ts +149 -0
- package/src/services/history/summary-registry.ts +43 -0
- package/src/services/history/summary-runner.ts +343 -0
- package/src/services/history/workspace-history.ts +8 -0
- package/src/services/installation/setup-service.ts +2 -41
- package/src/services/workspace/plugin-releases.ts +68 -0
- package/src/services/workspace/workspace-config.ts +95 -8
- package/src/services/workspace/workspace-mcp.ts +23 -28
- package/src/services/workspace/workspace-skills.ts +5 -2
- package/src/storage/acp-files.ts +7 -12
- package/src/storage/agent-files.ts +6 -5
- package/src/storage/atomic-json.ts +31 -4
- package/src/storage/history-files.ts +416 -189
- package/src/storage/history-format.ts +45 -61
- package/src/tools/history/actions.ts +8 -6
- package/src/tools/history/contract.ts +70 -25
- package/src/tools/history/dsh-tool.ts +17 -8
- package/src/tools/history/pi-tool.ts +23 -0
- package/src/ui/dsh/elements.ts +5 -12
- package/src/ui/dsh/management.ts +36 -20
- package/src/ui/dsh/styles.ts +5 -33
- package/src/ui/{confirmation.ts → pi/confirmation.ts} +1 -1
- package/lib/antigravity-plugin/lib/extension/plugin-runtime.d.ts +0 -10
- package/lib/antigravity-plugin/lib/extension/plugin-runtime.js +0 -67
- package/lib/antigravity-plugin/lib/integrations/hosts/antigravity.d.ts +0 -4
- package/lib/antigravity-plugin/lib/integrations/hosts/antigravity.js +0 -79
- package/lib/antigravity-plugin/lib/integrations/hosts/claude.js +0 -60
- package/lib/extension/dsh/history.d.ts +0 -15
- package/lib/extension/dsh/history.js +0 -87
- package/lib/extension/mcp-workers.js +0 -882
- package/lib/extension/plugin-runtime.d.ts +0 -10
- package/lib/extension/plugin-runtime.js +0 -67
- package/lib/integrations/dsh/history-summary.d.ts +0 -11
- package/lib/integrations/dsh/history-summary.js +0 -36
- package/lib/integrations/dsh/history.d.ts +0 -16
- package/lib/integrations/dsh/history.js +0 -167
- package/lib/integrations/history-summary.d.ts +0 -4
- package/lib/integrations/history-summary.js +0 -32
- package/lib/integrations/hosts/antigravity.d.ts +0 -4
- package/lib/integrations/hosts/antigravity.js +0 -79
- package/lib/integrations/hosts/claude.js +0 -60
- package/lib/services/history/history-service.d.ts +0 -106
- package/lib/services/history/history-service.js +0 -242
- package/lib/storage/acp-history.d.ts +0 -10
- package/lib/storage/acp-history.js +0 -57
- package/lib/ui/presentation.d.ts +0 -3
- package/lib/ui/presentation.js +0 -12
- package/src/extension/dsh/history.ts +0 -74
- package/src/extension/history.ts +0 -26
- package/src/extension/plugin-runtime.ts +0 -63
- package/src/integrations/dsh/history-summary.ts +0 -39
- package/src/integrations/dsh/history.ts +0 -84
- package/src/integrations/history-summary.ts +0 -30
- package/src/integrations/hosts/antigravity.ts +0 -83
- package/src/integrations/hosts/claude.ts +0 -62
- package/src/integrations/pi/history.ts +0 -99
- package/src/services/history/history-service.ts +0 -195
- package/src/storage/acp-history.ts +0 -49
- package/src/tools/access.ts +0 -7
- package/src/tools/history/tool.ts +0 -19
- package/src/tools/register.ts +0 -22
- package/src/ui/presentation.ts +0 -12
- /package/lib/{extension → antigravity-plugin/lib/extension/hosts}/dsh/acp-member.d.ts +0 -0
- /package/lib/{extension → antigravity-plugin/lib/extension/hosts}/dsh/files.d.ts +0 -0
- /package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/mcp.js +0 -0
- /package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/messages.d.ts +0 -0
- /package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/messages.js +0 -0
- /package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/root-agents.d.ts +0 -0
- /package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/root-agents.js +0 -0
- /package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/skills.d.ts +0 -0
- /package/lib/extension/{acp-worker.d.ts → acp/worker.d.ts} +0 -0
- /package/lib/extension/{setup-guard.js → setup/guard.js} +0 -0
- /package/lib/integrations/acp/{claude.d.ts → claude-settings.d.ts} +0 -0
- /package/lib/integrations/acp/{claude.js → claude-settings.js} +0 -0
- /package/lib/integrations/{dsh → hosts/dsh}/schema.d.ts +0 -0
- /package/src/extension/{setup-guard.ts → setup/guard.ts} +0 -0
- /package/src/integrations/acp/{claude.ts → claude-settings.ts} +0 -0
- /package/src/integrations/{dsh → hosts/dsh}/messages.ts +0 -0
- /package/src/integrations/{dsh → hosts/dsh}/root-agents.ts +0 -0
- /package/src/integrations/{pi → hosts/pi}/agent-tools.ts +0 -0
package/docs/guides/history.md
CHANGED
|
@@ -1,25 +1,82 @@
|
|
|
1
1
|
# 历史对话
|
|
2
2
|
|
|
3
|
-
Pi
|
|
3
|
+
所有宿主(Pi、dsh、Claude Code、Antigravity 及自定义插件宿主)共用工作区 `.pbot/history/` 归档原始问答与多维度摘要:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- **统一 RAW 采集**:各宿主在主会话输入与回合结束时直接写入 `.pbot/history/raw/`(默认按会话开始时间 UTC `YYYY/MM/` 分层),工具调用、推理与子会话均不写入历史。
|
|
6
|
+
- **独立 Worker 摘要生成**:所有宿主均可通过 `pbot history summary`(Pi / dsh 也提供 `/pbot history summary`)主动扫描 `.pbot/history/raw/`,为每个待摘要项启动**独立的临时 ACP worker**(默认 `backend: "pi"`,使用 Pi 当前默认模型;带 `PBOT_SUBAGENT_RUN_ID` 隔离,绝不写回 `raw/`,不挂载工作区 MCP/技能,跑完即销毁)。可在 `.pbot/config.json` 的 `summary` 字段中设置 `backend`、`model`、`thinking` 与 `concurrency`;命令行可覆盖前三项。
|
|
7
|
+
- **独立只读搜索**:Pi 与 dsh 提供原生 `pbot_history` 工具(dsh 另提供 Web 工作台“历史”页与 `/pbot history {"action":...}` 命令);Claude Code、Antigravity 与其他插件宿主通过 `pbot` MCP 提供的 `history_search` / `history_read` 检索全部宿主的原始问答与各维度摘要。
|
|
8
|
+
- **开关控制**:在 `.pbot/config.json` 中设置 `features.history: false` 可关闭当前工作区的历史采集、摘要生成与查询入口(默认 `true`)。
|
|
9
|
+
- **启动提醒**:会话启动时自动探测历史目录;当存在未迁移的旧平铺文件(`monthly` 布局下)或原始历史累计满 7 天且近 7 天未更新摘要时,给出一次性轻量提示。
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
## 所有宿主共用的 CLI
|
|
12
|
+
|
|
13
|
+
全局安装用 `npm install -g personal-bot`,然后运行 `pbot`。临时运行用 `npx --yes personal-bot@<插件的确切版本>` 替换命令中的 `pbot`。CLI 支持 Linux/macOS、Node.js 22.19+ 和 npm;摘要还需要所选 ACP 后端已安装并完成认证。
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
pbot init --workspace ~/notes
|
|
17
|
+
pbot status --workspace ~/notes --json
|
|
18
|
+
pbot history status --workspace ~/notes
|
|
19
|
+
pbot history summary --workspace ~/notes
|
|
20
|
+
pbot history search "评审决定" --dimension session --limit 10 --workspace ~/notes --json
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
每个命令只处理 `--workspace` 指定的根目录,省略时使用进程启动目录。相对路径相对于启动目录。宿主从会话取得根目录后显式传入。工作区未启用、配置损坏或 `features.history: false` 时,历史命令返回错误;只有显式 `init` 才初始化工作区。
|
|
24
|
+
|
|
25
|
+
| 命令 | 作用 |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| `pbot init` / `pbot status` | 初始化共享资料并启用工作区,或只读查看根目录、运行版本、各宿主登记的版本和配置 |
|
|
28
|
+
| `pbot history status` / `list` | 查看布局、会话数与各维度已就绪、待处理数量,或列出可用维度 |
|
|
29
|
+
| `pbot history summary [维度...] [--force] [--backend <acp>] [--model <模型>] [--thinking <级别>]` | 默认增量整理;`--force` 强制重建。默认年月布局依次整理会话和月度摘要 |
|
|
30
|
+
| `pbot history migrate [--dry-run]` | 预览或显式迁移旧平铺文件;保留冲突目标,报告逐项结果 |
|
|
31
|
+
| `pbot history search [关键词]` | 省略关键词列会话,支持 `--host`、`--dimension`、`--session-id`、`--from`、`--to`、`--offset` 和 `--limit` |
|
|
32
|
+
| `pbot history read <节点ID>` | 按搜索结果 ID 读取正文及上下级,支持 `--host`、`--offset`、`--limit` 与 `--children-offset` |
|
|
33
|
+
|
|
34
|
+
CLI 默认输出缩进 JSON;`--json` 输出单行 JSON 到 stdout,生成进度和诊断进入 stderr。摘要有失败项、迁移有错误或目标冲突时,退出码非零,逐项报告仍在 stdout。按 Ctrl-C 取消,已发布的摘要可供下次增量运行复用。Pi 和 dsh 保留原有 `/pbot history` 命令和 JSON 查询语法。
|
|
35
|
+
|
|
36
|
+
### CLI 版本选择
|
|
11
37
|
|
|
12
|
-
|
|
13
|
-
- 查询只刷新当前 Pi/dsh 来源的原生索引并读取其他来源的现成归档,不调用模型、不恢复会话。
|
|
38
|
+
显式运行 `init` 或在已启用的工作区执行命令时,CLI 从目标根目录的 npm、Pi 本地安装清单和宿主登记的插件中取最高版本。配置缺失、停用或损坏时,`status` 用当前 CLI 报告配置,`plugins` 为空对象,`minimumCliVersion` 为 `null`。关闭 `features.history` 后,历史命令直接报告功能已停用。`pbot --version` 显示当前 CLI 的版本,`pbot --at-least <版本>` 在本地比较版本,满足要求时返回 0。
|
|
14
39
|
|
|
15
|
-
|
|
40
|
+
宿主按用户、规范化工作区路径和宿主名,将插件绑定保存在 `~/.pbot/workspaces/`。目录只读时宿主仍可运行。CLI 重读可访问的绑定和安装清单,跳过已移除的清单。只提供发布版本的轻插件在下次绑定时刷新记录。宿主也可通过 `PBOT_PLUGIN_VERSION` 传入其确切版本。
|
|
41
|
+
|
|
42
|
+
满足最低版本时直接运行。版本不足时,npm 管理的全局安装会原位更新到所需版本,再按原参数和工作目录执行。项目依赖、npm link、npx 安装以及另一个进程正在更新或无法加锁的全局前缀,使用 npm 的版本缓存自动安装或复用所需版本,保留项目依赖与锁文件。更新失败时返回非零,原操作停止。已有 0.3.2 及更早的全局启动器需要先安装一次带升级功能的版本,或直接使用新版插件给出的精确版本 npx 命令。
|
|
43
|
+
|
|
44
|
+
## 可选历史与摘要配置(`.pbot/config.json`)
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"enabled": true,
|
|
49
|
+
"history": {
|
|
50
|
+
"layout": "monthly"
|
|
51
|
+
},
|
|
52
|
+
"summary": {
|
|
53
|
+
"backend": "pi",
|
|
54
|
+
"model": "provider/model",
|
|
55
|
+
"thinking": "low",
|
|
56
|
+
"concurrency": 3
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- `history.layout` 可选 `"monthly"`(默认,按 UTC 年月分层)或 `"flat"`(平铺目录);省略时默认为 `"monthly"`。读写与检索严格按当前配置布局执行,不混读两种布局。
|
|
62
|
+
- 已有平铺工作区在未迁移前运行于默认 `monthly` 布局时,启动提醒、`/pbot status` / `/pbot history status` 与 `pbot_history` 的 `warnings` 会提示运行 `/pbot history migrate` 或切回 `history.layout: "flat"`。
|
|
63
|
+
- `summary` 全部字段可选:省略 `summary` 或 `summary.backend` 时默认使用 `pi`;省略 `summary.model` 时使用目标 harness 的默认模型。
|
|
64
|
+
|
|
65
|
+
## 查询契约
|
|
66
|
+
|
|
67
|
+
| 能力 | 原生 `pbot_history` / MCP 工具 | 可选字段与默认值 |
|
|
68
|
+
| --- | --- | --- |
|
|
69
|
+
| 搜索 / 列会话 | `action: "search"` / `history_search` | `host`(如 `pi`、`dsh`、`claude`、`antigravity`,省略查全部)、`dimension`(`raw` 仅原文,或具体摘要维度如 `monthly`、`session`,省略查全部)、`query`(连续文本,不区分大小写;省略列会话或指定维度摘要)、`sessionId`、`from`、`to`(含时区 ISO 时间)、`offset=0`、`limit=20`(1–50) |
|
|
70
|
+
| 读取节点 | `action: "read"` / `history_read`(必填 `id`) | `host`、`offset=0`、`limit=12000`(1–24000 UTF-16 单元)、`childrenOffset=0`(每页固定 20 个子节点) |
|
|
16
71
|
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
- **既有 Claude 归档**:保留 `host: "claude"` 只读查询,不再扫描 Claude transcript。
|
|
72
|
+
- 搜索链路与写入/摘要生产完全隔离:关键词检索优先使用 `rg` 预过滤当前布局内的候选 JSON 文件(未安装 `rg` 或含特殊转义字符时自动回退到 Node 文本扫描),再对命中文件精确解析与分页。
|
|
73
|
+
- `read` 支持逐层下钻:月度汇总(`summary:monthly:<YYYY-MM>`)→ 单会话摘要(`summary:session:<rawId>`)→ 会话根(`<rawId>`)→ 单轮问答原文(`<rawId>:0:<entryId>`)。
|
|
20
74
|
|
|
21
|
-
##
|
|
75
|
+
## 存储布局与多维度扩展
|
|
22
76
|
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
77
|
+
- **默认年月分层(`history.layout: "monthly"`)**:
|
|
78
|
+
- `.pbot/history/raw/<YYYY>/<MM>/<id>.json`(缺失有效时间戳时落入 `raw/unknown/<id>.json`):全宿主原始问答与已知分支,固定按会话开始时间(最早 `from` 的 UTC 年月)落桶,后续跨月追加消息不移动目录。
|
|
79
|
+
- `.pbot/history/summaries/<dimension>/<YYYY>/<MM>/<id>.json`(兜底 `unknown/`):按维度存放的单会话级派生摘要产物(如 `session`);月度汇总维度按年分目录存放为 `.pbot/history/summaries/monthly/<YYYY>/<YYYY-MM>.json`。
|
|
80
|
+
- **平铺布局(`history.layout: "flat"`)**:
|
|
81
|
+
- `.pbot/history/raw/<id>.json` 与 `.pbot/history/summaries/<dimension>/<id>.json`;不启用 `monthly` 维度。
|
|
82
|
+
- 派生摘要按 `.write-summary-<dimension>` 短锁写入,记录来源指纹 `source.fingerprint` 以实现精确去重与增量更新,可随时删目录重算,损坏或缺失不影响原始问答查询;开发者可通过 `SummaryRegistry`(`registerSummaryDimension`)注册更多维度。
|
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
| 宿主 | 初始化 | 状态 |
|
|
8
8
|
| --- | --- | --- |
|
|
9
|
+
| 所有宿主 / 终端 | `pbot init [--workspace <目录>]` | `pbot status [--workspace <目录>]` |
|
|
9
10
|
| Pi | `/pbot init` | `/pbot status` |
|
|
10
11
|
| dsh | `/pbot init` 或 Web 工作区页按钮 | `/pbot status` 或 Web 工作区页 |
|
|
11
12
|
| Claude Code | `/personal-bot:pbot init`(或 `lib/claude.js init`) | `/personal-bot:pbot status` |
|
|
13
|
+
| Codex / Qoder CLI | `pbot plugin <codex或qoder> init` | `pbot plugin <codex或qoder> status` |
|
|
12
14
|
| Antigravity | `/pbot init`(或 `lib/plugin.js antigravity init`) | `/pbot status` |
|
|
13
15
|
|
|
14
|
-
`init` 先补建资料目录(`areas/`、`projects/`、`knowledge/`、`providers/`、`scratch/`、`agents/`)和缺失的根 `AGENTS.md`,再将 `.pbot/config.json` 中的 `enabled` 设为 `true` 并显式写入 `features`(`prompts`、`skills`、`mcp`,未设置项默认 `true`),保留已有资料、宿主自有文件(如 `CLAUDE.md
|
|
16
|
+
`init` 先补建资料目录(`areas/`、`projects/`、`knowledge/`、`providers/`、`scratch/`、`agents/`)和缺失的根 `AGENTS.md`,再将 `.pbot/config.json` 中的 `enabled` 设为 `true` 并显式写入 `features`(`prompts`、`skills`、`mcp`、`history`,未设置项默认 `true`)与 `summary`(`backend: "pi"`、`concurrency: 3`),保留已有资料、宿主自有文件(如 `CLAUDE.md`)、已设置的开关/摘要配置及其他未知配置字段;配置文件损坏时先报错而不覆写。
|
|
15
17
|
|
|
16
18
|
## 启用、模块开关(`features`)与停用规则
|
|
17
19
|
|
|
@@ -21,7 +23,8 @@
|
|
|
21
23
|
"features": {
|
|
22
24
|
"prompts": true,
|
|
23
25
|
"skills": true,
|
|
24
|
-
"mcp": true
|
|
26
|
+
"mcp": true,
|
|
27
|
+
"history": true
|
|
25
28
|
}
|
|
26
29
|
}
|
|
27
30
|
```
|
|
@@ -32,10 +35,11 @@
|
|
|
32
35
|
| `features.prompts: false` | 关闭工作区提示词与角色上下文注入 |
|
|
33
36
|
| `features.skills: false` | 关闭工作区与内置技能注册、技能门控及 `.agents/skills/` 索引注入 |
|
|
34
37
|
| `features.mcp: false` | 关闭 `.pbot/mcp.json` 统一 MCP 挂载、`workspace_mcp_*` 桥接与 ACP `mcpServers` 透传 |
|
|
38
|
+
| `features.history: false` | 关闭跨宿主历史归档采集、摘要生成及历史查询工具(`pbot_history` / `history_search` / `history_read`) |
|
|
35
39
|
| 文件不存在、缺少 `enabled` 或 `enabled: false` | 保持未启用,仅保留状态与初始化入口,宿主原生能力不受影响 |
|
|
36
40
|
| JSON 损坏、字段类型错误或不可读 | 保持未启用并报告具体错误,修复后重新启用 |
|
|
37
41
|
|
|
38
|
-
将 `features`
|
|
42
|
+
将 `features` 全部设为 `false` 时,可仅使用跨 Harness `worker_*` 调度能力而不注入任何工作区提示词、技能、统一 MCP 或历史功能。只检查当前绑定的工作区根目录,不向父目录继承,也不自动迁移历史配置。
|
|
39
43
|
|
|
40
44
|
## 统一工作区 MCP 配置(`.pbot/mcp.json`)
|
|
41
45
|
|
|
@@ -59,9 +63,11 @@
|
|
|
59
63
|
}
|
|
60
64
|
```
|
|
61
65
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
`pbot mcp list` 读取配置。`add` 与 `remove` 使用短时目录锁 `.pbot/mcp.json.lock` 串行更新服务项。若进程异常退出并遗留锁,先确认操作该文件的命令都已结束,再用 `rmdir .pbot/mcp.json.lock` 清理空锁目录。
|
|
67
|
+
|
|
68
|
+
启用 `features.mcp`(默认)后,原生挂载与桥接工具二选一,避免同一服务重复暴露:
|
|
69
|
+
- Pi 与 dsh 直接通过原生 API 挂载 `.pbot/mcp.json` 中的服务(不再暴露 `workspace_mcp_*` 桥接工具);
|
|
70
|
+
- 轻插件宿主(Claude Code、Antigravity)及其他 MCP 宿主通过 `pbot` MCP 提供的 `workspace_mcp_discover` / `workspace_mcp_call` 动态发现并调用(修改 `.pbot/mcp.json` 即改即生效);
|
|
65
71
|
- 跨 Harness ACP worker 自动通过 ACP v1 `mcpServers`(或 Pi/dsh 受管成员原生挂载)获得同一组服务。
|
|
66
72
|
|
|
67
73
|
## ACP Harness 配置(`acp`)
|
|
@@ -92,6 +98,29 @@
|
|
|
92
98
|
- 命令不经过 shell 展开;参数中的相对路径按 worker 的 `cwd` 解析。凭据与模型认证由目标宿主自行管理,不写入此文件。
|
|
93
99
|
- 新建 worker 时固定解析后的可执行路径、参数与权限策略;修改 `.pbot/config.json` 后,MCP 下次 `worker_discover` / `worker_create` 调用自动读取最新 `acp` 配置。
|
|
94
100
|
|
|
101
|
+
## 历史目录布局与摘要配置(`history` / `summary`)
|
|
102
|
+
|
|
103
|
+
历史配置决定存储布局,以及 `pbot history summary` 使用的 ACP 后端、模型与并发度。Pi 和 dsh 的 `/pbot history summary` 读取同一配置。默认布局为 `monthly`,默认后端为 `pi`,模型沿用后端默认值。
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"enabled": true,
|
|
108
|
+
"history": {
|
|
109
|
+
"layout": "monthly"
|
|
110
|
+
},
|
|
111
|
+
"summary": {
|
|
112
|
+
"backend": "pi",
|
|
113
|
+
"model": "provider/model",
|
|
114
|
+
"thinking": "low",
|
|
115
|
+
"concurrency": 3
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
- `history.layout` 可选 `"monthly"`(默认,按 UTC `YYYY/MM/` 分层并启用 `monthly` 月度汇总)或 `"flat"`(平铺布局,不生成月度汇总)。已有平铺工作区可手工执行 `/pbot history migrate` 整理历史文件,不会自动修改此文件或静默迁移数据。
|
|
121
|
+
- 每个待摘要项独立启动一个临时 ACP worker(附带 `PBOT_SUBAGENT_RUN_ID`,绝不写回 `raw/`),完成后立即销毁。
|
|
122
|
+
- 修改后下次执行 `pbot history summary` 即生效,也可用 `--backend`、`--model`、`--thinking` 临时覆盖。
|
|
123
|
+
|
|
95
124
|
## 手工修改生效方式
|
|
96
125
|
|
|
97
126
|
| 宿主 | 应用方式 |
|
|
@@ -41,6 +41,8 @@ node /path/to/installed/personal-bot/lib/plugin.js antigravity status
|
|
|
41
41
|
- 同宿主子任务与多成员协作直接使用 Antigravity 原生 `invoke_subagent`(`self`、`research` 等)与 `/swarm`,Personal Bot 不注入自定义静态 agent 也不改写 `invoke_subagent` 参数;
|
|
42
42
|
- 跨 Harness 调度(调用 `claude`、`codex`、`pi`、`dsh` 或自定义 ACP 目标)通过插件内置 `mcp_config.json` 挂载的 `pbot` stdio MCP 服务(`worker_*` 工具集)完成,详见[跨 Harness 专家调度](../guides/cross-harness-workers.md)。
|
|
43
43
|
|
|
44
|
+
- **历史归档**使用 `Stop` hook 将主会话问答写入 `.pbot/history/raw/`。运行 `pbot history summary` 生成摘要,用 MCP 工具 `history_search` 和 `history_read` 检索各宿主的归档。`features.history: false` 可关闭历史功能。详见[历史与 CLI 指南](../guides/history.md)。
|
|
45
|
+
|
|
44
46
|
## MCP 与开发校验
|
|
45
47
|
|
|
46
48
|
- 工作区共享 MCP 统一写入 `.pbot/mcp.json`(通过 `pbot mcp add|remove|list` 管理),经内置 `pbot` MCP 的 `workspace_mcp_discover` / `workspace_mcp_call` 在当前工作区按需调用;全局或需交互式 OAuth 的 MCP 使用原生 `agy mcp add|remove|list`(管理 `~/.gemini/config/mcp_config.json`),两者可同时使用。
|
|
@@ -34,7 +34,7 @@ node /absolute/path/to/personal-bot/lib/claude.js status
|
|
|
34
34
|
- **同宿主 vs 跨 Harness 互补**:
|
|
35
35
|
- 同宿主任务与团队协作直接使用 Claude 原生 `Agent` 及原生团队(用户自行管理 `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`);
|
|
36
36
|
- 跨 Harness 调度(调用 `antigravity`、`codex`、`pi`、`dsh` 或自定义 ACP 目标)通过 [.mcp.json](../../.mcp.json) 自动挂载的 `pbot` stdio MCP 服务(`worker_*` 工具集)完成,详见[跨 Harness 专家调度](../guides/cross-harness-workers.md)。
|
|
37
|
-
-
|
|
37
|
+
- **历史归档**使用 `UserPromptSubmit` 与 `Stop` hook 将主会话问答写入 `.pbot/history/raw/`,跳过带 `agent_id` 的原生子代理。运行 `pbot history summary` 生成摘要,用 MCP 工具 `history_search` 和 `history_read` 检索各宿主的归档。`features.history: false` 可关闭历史功能。详见[历史与 CLI 指南](../guides/history.md)。
|
|
38
38
|
|
|
39
39
|
## 本地开发与校验
|
|
40
40
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Codex 与 Qoder CLI
|
|
2
|
+
|
|
3
|
+
两个原生插件共用 npm 包提供的 `pbot` 命令。宿主启动环境需要 Node.js 22.19+ 和 npm。PATH 中有 0.3.3 或更新的 CLI 时,插件交由 CLI 检查目标工作区是否启用,再决定是否升级。缺少此启动器时,插件通过 npx 安装或复用自身指定的版本。下面的安装流程适用于 Linux 和 macOS,已用 Codex CLI 0.172.0 和 Qoder CLI 1.1.100 校验。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
在本仓库使用 Node.js 24.9+ 构建并安装当前工作树的包。
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm ci --ignore-scripts
|
|
11
|
+
npm install --global "$(npm pack --silent | tail -1)"
|
|
12
|
+
pbot --version
|
|
13
|
+
pbot_lib="$(npm root --global)/personal-bot/lib"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
按使用的宿主执行对应命令。Codex 通过本地 marketplace 安装。安装后在 Codex 的 `/hooks` 中检查并信任 Personal Bot 的 `SessionStart`、`UserPromptSubmit` 和 `Stop` 命令,再开始会话。更新后若 hook 定义变化,需要重新检查。详见 [Codex 插件 hook 说明](https://developers.openai.com/plugins/build/plugins)。
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
codex plugin marketplace add "$pbot_lib/codex-marketplace"
|
|
20
|
+
codex plugin add personal-bot@pbot-local
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Qoder CLI 支持直接从本地插件目录安装。清单和组件目录格式见 [Qoder 插件参考](https://docs.qoder.com/cli/plugins-reference)。
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
qodercli plugin install "$pbot_lib/qoder-plugin"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 工作区与工具
|
|
30
|
+
|
|
31
|
+
在目标工作区根目录执行下列命令,或在宿主中调用插件的 `pbot` 管理技能,传入 `init`、`status` 或 `history` 子命令。
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
pbot plugin codex init
|
|
35
|
+
pbot plugin codex status
|
|
36
|
+
# Qoder CLI
|
|
37
|
+
pbot plugin qoder init
|
|
38
|
+
pbot plugin qoder status
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
两个宿主共用一份 `.pbot/config.json`,同一目录初始化一次即可。Codex hook 使用事件的 `cwd`。Qoder 的 hook、管理命令和 MCP 共用 `QODER_PROJECT_DIR`,缺失时依次使用 `PBOT_WORKSPACE_ROOT` 与工作目录。
|
|
42
|
+
|
|
43
|
+
启用历史后,新会话的 `SessionStart` 会提示旧布局或待更新的摘要。需要处理提醒时,在当前工作区执行 `pbot history migrate --dry-run` 预览迁移,或用 `pbot history summary` 生成摘要。提交提示时按配置注入协调者上下文和包内方法技能索引,`Stop` 配合提交事件记录主会话问答。Codex 按会话和回合 ID 关联追加输入及回复。原始记录的来源分别为 `codex` 和 `qoder`。
|
|
44
|
+
|
|
45
|
+
宿主原生发现根 `AGENTS.md` 与 `.agents/skills/`。包内方法按 `features.skills` 提供,管理技能可由用户显式调用。
|
|
46
|
+
|
|
47
|
+
插件的 `.mcp.json` 启动 `pbot mcp`。在启用的工作区可通过 `worker_discover` 查询后端、使用 `worker_create` 指定目标,并通过 `worker_request` 派发任务。调用时使用上下文给出的 `workspaceRoot` 作为 `workspace`。原生子代理由宿主管理。
|
|
48
|
+
|
|
49
|
+
作为 ACP 目标使用时,`codex` 需要单独安装 `@agentclientprotocol/codex-acp`,`qoder` 使用 `qodercli --acp`(也接受 `qodercli` 和 `qoder-cli` 后端别名)。模型调用沿用目标程序的登录配置。安装原生宿主插件和配置 ACP 后端可以分别进行。
|
|
50
|
+
|
|
51
|
+
## Codex 转发工作区 MCP 所需的环境变量
|
|
52
|
+
|
|
53
|
+
如果 `.pbot/mcp.json` 使用 `${INTERNAL_MCP_TOKEN}` 等变量,先在启动 Codex 的环境中设置值,再在 Codex 的用户配置或受信任项目的 `.codex/config.toml` 中按名称转发。以下同名服务配置覆盖插件的默认启动配置。
|
|
54
|
+
|
|
55
|
+
```toml
|
|
56
|
+
[mcp_servers.pbot]
|
|
57
|
+
command = "pbot"
|
|
58
|
+
args = ["mcp"]
|
|
59
|
+
env = { PBOT_HOST = "codex" }
|
|
60
|
+
env_vars = ["INTERNAL_MCP_TOKEN"]
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
将示例变量名替换为工作区实际引用的名称,值留在宿主环境中。重启 Codex 后,可用 `codex mcp list --json` 核对 `pbot.transport.env_vars`,并用 `workspace_mcp_discover` 指定服务名验证连接。同一环境也供 ACP worker 解析共享 MCP 配置。详见 [Codex MCP 配置](https://developers.openai.com/codex/mcp)。
|
package/docs/hosts/dsh.md
CHANGED
|
@@ -61,7 +61,7 @@ dsh plugin --profile pbot add /absolute/path/to/personal-bot-<version>.tgz
|
|
|
61
61
|
|
|
62
62
|
已启用主会话中,模型工具包括:
|
|
63
63
|
- **dsh 原生 `subagent` / `subagent_fork`**:同宿主轻量委派,Personal Bot 不拦截也不覆盖。
|
|
64
|
-
- **MCP 工具 `mcp__pbot__worker_
|
|
64
|
+
- **MCP 工具 `mcp__pbot__worker_*`**:通过 `@deepseek-ai/dsh-mcp-client` 自动挂载 `lib/extension/mcp.js`,暴露跨 Harness 专家调度工具;启用 `features.mcp`(默认)时直接将 `.pbot/mcp.json` 中的服务通过原生 `@deepseek-ai/dsh-mcp-client` 挂载到当前工作区会话(不再重复暴露 `workspace_mcp_*` 桥接工具;与 dsh profile 原生 MCP 单点归属、不重复注册)。
|
|
65
65
|
- **原生工具 `pbot_history`**:跨来源搜索与读取历史问答及摘要,详见[历史对话](../guides/history.md)。
|
|
66
66
|
|
|
67
67
|
主会话通过原生 `write`/`edit`/`apply_patch` 修改工作区外文件时触发一次原生批准。Web 工作台只读查询通过原生 Typert Remote(`snapshot`、`history`)完成,不启动额外 HTTP 服务。
|
package/docs/hosts/pi.md
CHANGED
|
@@ -44,6 +44,6 @@ pi
|
|
|
44
44
|
|
|
45
45
|
## 原生 MCP、统一 MCP 与技能
|
|
46
46
|
|
|
47
|
-
- 工作区共享 MCP 统一写入 `.pbot/mcp.json`(`pbot mcp add|remove|list`),Pi 启用 `features.mcp`(默认)时自动通过 `pi.registerMcpServer`
|
|
47
|
+
- 工作区共享 MCP 统一写入 `.pbot/mcp.json`(`pbot mcp add|remove|list`),Pi 启用 `features.mcp`(默认)时自动通过 `pi.registerMcpServer` 直接原生挂载(不再重复暴露 `workspace_mcp_*` 桥接工具);全局工具、需交互式 OAuth 或宿主私有的 MCP 仍可用 `pi mcp add [--local] <server> ...`(写入 `~/.pi/agent/mcp.json` 或 `.pi/mcp.json`)并与之单点归属、互不重复注册,用 `/mcp` 查看状态。
|
|
48
48
|
- 工作区自有技能统一放在 `.agents/skills/<name>/SKILL.md`;包内技能遵守 Pi 原生 `--no-skills`、包级过滤及 `.pbot/config.json` 的 `features.skills`。
|
|
49
49
|
- 修改工作区外文件时,Pi 通过安全确认队列提示人工确认。
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# 架构治理工作台
|
|
2
|
+
|
|
3
|
+
## 范围与验证入口
|
|
4
|
+
|
|
5
|
+
依赖图按当前 checkout 生成。运行 `npm exec -- depcruise --include-only '^src/' --config .dependency-cruiser.cjs -T dot src > dependencies.dot` 生成逐模块依赖图,使用 `npm run check` 检查环、解析失败与越层依赖。源码权责见[技术设计](../architecture/design.md),工作区、控制记录及历史文件的路径以该文的存储表为准。
|
|
6
|
+
|
|
7
|
+
| 概念 | 状态所有者与流向 | 变更或验证入口 |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| 宿主装配与上下文 | Pi Lifecycle、dsh DshWorkspaces 随会话持有实例;无状态 hook 每次解析绑定根和配置 | hosts 适配器、plugin-registry、各宿主集成测试 |
|
|
10
|
+
| Web 与 TUI | dsh 管理页持有显示状态,经 Typert 调用宿主;Pi 原生通知和确认队列绑定当前实例 | ui/dsh、ui/pi、tests/dsh、tests/ui |
|
|
11
|
+
| 工具与协议 | 模型工具输入经适配器校验,服务实施查询和控制;MCP stdio 负责请求、响应与进度通知 | tools/history、extension/mcp、tests/tools、tests/mcp |
|
|
12
|
+
| 工作区配置 | workspace-config 校验 opt-in、功能、摘要和 ACP 配置;workspace-mcp 校验、展开并写共享服务定义 | tests/workspace/config、tests/integration/workspace-config |
|
|
13
|
+
| 原始历史与派生状态 | 宿主采集 → history-capture → HistoryFiles;维度规划、锁、指纹与摘要执行由 summary-runner 协调 | tests/history、tests/storage、tests/dsh/history |
|
|
14
|
+
| Worker 与交互 | AgentService 管理 owner、生命周期和请求;AgentFiles 管理 generation 与队列;ACP 子进程交换模型选择、权限、表单及输出 | services/agents、integrations/acp、extension/acp、tests/agents |
|
|
15
|
+
| 连接与缓存 | 每个 MCP runtime 持有工作区服务实例与下游连接;退出时释放。原生挂载由宿主 SDK 释放 | extension/mcp/bridge、Pi、dsh、tests/mcp/workspace-bridge |
|
|
16
|
+
| 权限与凭据 | 工作区外写入交宿主确认,worker 的权限和 elicitation 由 ACP 会话处理,环境与认证由接入方提供 | workspace-files、ui/pi/confirmation、integrations/acp/input |
|
|
17
|
+
| 异常、重试与观测 | 存储写锁返回可辨识的 busy 错误;协议边界把异常转成相应传输结果;宿主负责日志、进度与取消 | storage、services/history、extension/mcp、各宿主边界 |
|
|
18
|
+
| 安装与分发 | package.json 管理发布版本;锁文件固定依赖;CLI、dsh、插件构建按序生成消费者产物 | scripts、smoke、CI 的 npm 包消费者检查 |
|
|
19
|
+
|
|
20
|
+
## 当前任务池
|
|
21
|
+
|
|
22
|
+
| 状态 | 证据与行动 |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| 已治理 | Pi、dsh 和独立 CLI 共用 `src/extension/history/command.ts` 执行历史命令。dsh 聊天命令直接使用已验证的工作区,Web 继续通过 Typert。宿主持有取消信号和进度展示。 |
|
|
25
|
+
| 已治理 | MCP 调用字段从 tool-contract 的公开 schema 提取,十份手写字段表已删除。工具名联合类型使执行分派具备编译期穷尽检查。 |
|
|
26
|
+
| 已治理 | bridge 以同一记录持有握手与就绪连接。新配置立即建立连接;旧配置的调用完成后释放旧会话。双 HTTP 端点测试在握手期间切换配置并验证各自的身份与清理。 |
|
|
27
|
+
| 已治理 | runtime.nativeServer 从已创建实例取得 worker 控制目录与会话 ID,生成 Pi/dsh 的挂载参数;两个宿主各自管理 SDK 注册、超时单位与环境继承。 |
|
|
28
|
+
| 已治理 | 工作区 MCP 配置写入在文件锁内读取最新值并原子发布,仅更新 mcpServers,保留用户顶层扩展字段和未展开的模板。CLI 并发新增与删除均由真实进程覆盖。 |
|
|
29
|
+
| 已治理 | AgentHost 与安装器能力类型在 model 定义。服务与适配器都依赖这些类型,dependency-cruiser 同时检查类型边和运行时边,限制 Pi/dsh SDK 的直接导入位置。 |
|
|
30
|
+
| 已治理 | historyPageLimits 与历史标识语法供服务、原生工具、MCP 和 Web 使用。MCP 编排无需再从存储模块导入标识校验。 |
|
|
31
|
+
| 已治理 | 历史列表、全文检索和节点回读使用同一摘要身份,Web 可使用返回的 host 打开跨宿主月度摘要。 |
|
|
32
|
+
| 已治理 | 工作区历史访问统一解析布局。状态与启动提醒共用只读维度规划,提醒继续在历史较新时提前返回;三个宿主入口共用启动通知。 |
|
|
33
|
+
| 已治理 | 历史迁移对两类文件使用同一条路径生成和报告流程。存储检查预览与实际目的路径,在删除原文件前同步目标目录。 |
|
|
34
|
+
| 已治理 | dsh Web 的历史与工作区两页保留正在使用的输入、来源标记与布局;已移除旧 worker 面板的状态映射、控件和样式。 |
|
|
35
|
+
| 已治理 | Pi 只暴露一个原生历史工具。其注册函数随实例返回隐藏操作,已删除通用工具注册表及历史工具用不到的文件写入权限接口。 |
|
|
36
|
+
| 已治理 | 工作区权限、历史布局、worker 状态和回复动作由数据契约声明可选值;配置和控制记录按实际 JSON 类型校验。摘要默认并发数与上限由模型常量提供。 |
|
|
37
|
+
| 已治理 | MCP 完成配置读取后再次检查运行时是否关闭。历史与外部服务请求独立执行,只有 worker 调用建立 AgentService。同一实例的重复关闭共用清理结果。 |
|
|
38
|
+
| 已治理 | Pi/dsh 主会话与 ACP 成员共用原生 MCP 加载流程,个别服务失败只影响该项;ACP 协议透传继续严格校验整份配置。 |
|
|
39
|
+
| 已治理 | build:plugins 编译一次独立运行时,再将同一份文件放入 npm 与 Antigravity 包。三个构建入口共用锁定的 TypeScript 编译器。 |
|
|
40
|
+
| 已治理 | 摘要在锁外生成,锁内核对规划时的产物。并发任务使用相同来源时复用已发布结果,来源冲突进入该项失败报告;下游月度任务读取已发布的会话摘要。 |
|
|
41
|
+
| 已治理 | worker 命令直接解析公开工具名和短名。AgentService 在一次状态读取中匹配代次、请求与周期;MCP 轮询只负责等待和呈现,私有字段阻止其再访问消息存储。 |
|
|
42
|
+
| 已验收 | 全库扫描覆盖 115 个源码模块、415 条内部依赖。当前任务池中可安全独立实施的项目均已提交,余项见下方验收边界。 |
|
|
43
|
+
|
|
44
|
+
## 决策记录
|
|
45
|
+
|
|
46
|
+
| 主题 | 采用的方案与取舍 | 防回归入口 |
|
|
47
|
+
| --- | --- | --- |
|
|
48
|
+
| 历史命令 | 共用编排函数解析和执行。Pi 与 dsh 各自保留会话校验、取消及结果展示。将 SDK 调用下沉到服务会引入宿主依赖,各宿主独立执行则需要同步修改业务分支。 | 宿主集成测试、services 依赖规则 |
|
|
49
|
+
| 工具契约 | 工具定义提供字段名和公开描述,执行层检查具体值、授权与功能开关。服务端可以独立分发。原生工具的 TypeBox 与 MCP 的 JSON Schema 各自满足其宿主加载约定。 | 工具契约与 stdio 测试、TypeScript 穷尽检查、安装包检查 |
|
|
50
|
+
| 下游连接 | 一个运行时管理握手、已就绪连接和仍被请求使用的旧连接。切换配置时为新调用建立新连接,完成旧请求后释放。全局串行会让一个慢服务阻塞其他请求。 | 双 HTTP 端点测试、关闭时仍在读取配置的请求测试 |
|
|
51
|
+
| 配置发布 | 进程在短目录锁内重读并原子替换 JSON。原子替换单独只能保证文件完整,无法保留并发编辑。锁超时提示操作者核实持有进程。 | 12 个独立 CLI 进程增删、用户元数据回读、原子文件测试 |
|
|
52
|
+
| 摘要发布 | 模型工作在锁外进行,发布时核对同一产物的规划基线。相同来源复用先发布的结果,来源冲突保留当前文件并报告任务失败。长时间持锁会阻塞同维度的无关摘要。 | 两次相互交叠的真实文件写入、增量和强制重建测试 |
|
|
53
|
+
| 原生挂载 | 共享工作区服务的解析和逐项加载,Pi 与 dsh 各自持有 SDK 注册和释放。ACP 透传以整份会话配置为单位校验。三种接口的超时单位、错误范围和生命周期仍由各自契约规定。 | 原生 Pi/dsh 工具发现、ACP 成员与传输测试 |
|
|
54
|
+
| 分发 | 在独立临时目录编译一次插件运行时,再分别组装 npm 与 Antigravity 产物。从整个 lib 复制会把同目录的 dsh 和 CLI 专用产物带入插件。 | 包内真实宿主加载、解包后独立执行、原生清单校验 |
|
|
55
|
+
|
|
56
|
+
## 技术方案与保留边界
|
|
57
|
+
|
|
58
|
+
- Pi 原生扩展、dsh Cordis 与 Typert、无 SDK 的轻插件 hook 分别对应三类宿主加载契约。Pi 使用原生 TUI,dsh Web 使用宿主组件与样式。新增轻插件通过 PluginHostRegistry 扩展。
|
|
59
|
+
- 跨宿主调度采用 stdio MCP 与 ACP v1。下游 MCP 同时支持 stdio 和 Streamable HTTP,各自负责进程或 HTTP 会话。模型选择、环境变量及身份凭据由接入方提供。
|
|
60
|
+
- JSON 文件承担工作区与进程间的持久化。原始历史是摘要输入,摘要按来源指纹派生。原始记录、worker 控制代次、跨宿主历史标识、平铺读取和显式迁移分别有现行消费者。
|
|
61
|
+
- 开发与发布使用锁定的 TypeScript、esbuild、Node 测试与原生插件校验器。维护脚本说明运行版本、命令和独立安装检查。详见[维护脚本](../../scripts/README.md)。
|
|
62
|
+
|
|
63
|
+
## 待确认与验收边界
|
|
64
|
+
|
|
65
|
+
| 事项 | 当前行为与再次开启的条件 |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| 写入进程异常退出后的遗留锁 | 超时后报告锁路径,由操作者核实。跨进程自动接管需要先确定如何可靠识别仍存活的持有者。 |
|
|
68
|
+
| 真实模型端到端验收 | 普通回归使用本地文件、协议进程和宿主 SDK。模型账号下的行为按仓库约定在获准的专用环境单独验收。 |
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## 本批验收
|
|
72
|
+
|
|
73
|
+
| 验收面 | 结果 |
|
|
74
|
+
| --- | --- |
|
|
75
|
+
| 依赖方向 | TypeScript 和 dependency-cruiser 通过。依赖图包含 115 个源码模块,检测到 0 个环、0 项规则违规。临时违规导入验证了 services 类型依赖与 Pi、dsh SDK 所有权规则。 |
|
|
76
|
+
| 公开协议 | 从基线提交 `9d4fcc2` 独立构建 stdio MCP,在工作区绑定、功能开关、原生挂载的四组配置下对比初始化和工具发现,全部响应内容一致。 |
|
|
77
|
+
| 本地回归 | Node 24.22.2 上全量构建,134 项测试通过。覆盖真实文件、隔离进程、并发写入、跨宿主历史与原生加载。 |
|
|
78
|
+
| 分发与宿主 | 同一 npm 包在 Node 22.19.0 通过 Pi 和 Claude 消费者检查,在 Node 24.22.2 通过 dsh 消费者检查。Claude、Antigravity、Qoder 原生校验均通过。Claude 提示缺少作者、图标;Antigravity 提示使用通用图标。 |
|
package/hooks/hooks.json
CHANGED
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
],
|
|
9
9
|
"UserPromptExpansion": [
|
|
10
10
|
{ "matcher": "personal-bot:.*", "hooks": [{ "type": "command", "command": "node", "args": ["${CLAUDE_PLUGIN_ROOT}/lib/claude.js", "hook"], "timeout": 10 }] }
|
|
11
|
+
],
|
|
12
|
+
"Stop": [
|
|
13
|
+
{ "hooks": [{ "type": "command", "command": "node", "args": ["${CLAUDE_PLUGIN_ROOT}/lib/claude.js", "hook"], "timeout": 10 }] }
|
|
11
14
|
]
|
|
12
15
|
}
|
|
13
16
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Disclaimer / 免责声明
|
|
2
|
+
|
|
3
|
+
## English
|
|
4
|
+
|
|
5
|
+
AI models can produce incorrect answers, commands, and code. Verify information before relying on it. Review proposed changes before applying them to important files or systems.
|
|
6
|
+
|
|
7
|
+
Workers and MCP tools may read or change files, run commands, or send workspace data to services you configure. Check which data and credentials a worker or service can access when granting permissions. Third-party providers may charge for requests and process data under their own terms and privacy policies.
|
|
8
|
+
|
|
9
|
+
Personal Bot is provided “as is”. Its warranty disclaimer and limitation of liability are set out in the project license. Third-party software is subject to its own licenses. [MIT License](LICENSE)
|
|
10
|
+
|
|
11
|
+
## 中文
|
|
12
|
+
|
|
13
|
+
AI 模型生成的回答、命令和代码可能有误。请在据此作出决定前核实关键信息,在将更改应用到重要文件或系统前审查具体内容。
|
|
14
|
+
|
|
15
|
+
Worker 和 MCP 工具可能读取或修改文件、执行命令,或将工作区数据发送给你配置的服务。授予权限时,请确认对方能够访问哪些数据和凭据。第三方服务可能按请求收费,并按各自的条款和隐私政策处理数据。
|
|
16
|
+
|
|
17
|
+
Personal Bot 按现状提供,担保免责和责任限制条款见项目许可证。第三方软件适用其各自的许可证。[MIT 许可证全文](LICENSE)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Personal Bot contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
|
|
7
|
+
if (!process.env.PBOT_ACP_PI_COMMAND) throw new Error("Missing Personal Bot Pi ACP launch context");
|
|
8
|
+
|
|
9
|
+
let args;
|
|
10
|
+
if (process.env.PBOT_SUMMARY_WORKER === "1") {
|
|
11
|
+
// Minimal pure-text Pi runtime for history summarization: no tools, extensions, skills, templates, or AGENTS.md.
|
|
12
|
+
args = [
|
|
13
|
+
...process.argv.slice(2),
|
|
14
|
+
"--no-tools",
|
|
15
|
+
"--no-extensions",
|
|
16
|
+
"--no-skills",
|
|
17
|
+
"--no-prompt-templates",
|
|
18
|
+
"--no-context-files",
|
|
19
|
+
];
|
|
20
|
+
} else {
|
|
21
|
+
// pi-acp supplies RPC arguments. Add the managed member's native resource options.
|
|
22
|
+
const directory = process.env.PBOT_SUBAGENT_DIR;
|
|
23
|
+
if (!directory) throw new Error("Missing Personal Bot Pi ACP launch context");
|
|
24
|
+
const { options } = JSON.parse(readFileSync(join(directory, "descriptor.json"), "utf8"));
|
|
25
|
+
args = [...process.argv.slice(2), "--extension", fileURLToPath(new URL("../lib/extension/hosts/pi/acp-member.js", import.meta.url))];
|
|
26
|
+
if (options.noExtensions !== false) args.push("--no-extensions", "--extension", "builtin:mcp", "--extension", "builtin:codemode", "--extension", "builtin:tool-search");
|
|
27
|
+
if (options.noSkills) args.push("--no-skills");
|
|
28
|
+
if (options.noPromptTemplates) args.push("--no-prompt-templates");
|
|
29
|
+
if (options.noContextFiles) args.push("--no-context-files");
|
|
30
|
+
if (options.tools) args.push("--tools", options.tools.join(","));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const child = spawn(process.env.PBOT_ACP_PI_COMMAND, args, { stdio: "inherit", env: process.env });
|
|
34
|
+
child.on("error", error => { console.error(error.message); process.exitCode = 1; });
|
|
35
|
+
for (const termination of ["SIGINT", "SIGTERM"]) process.on(termination, () => child.kill(termination));
|
|
36
|
+
child.on("exit", (code, termination) => { process.exitCode = termination ? 1 : code ?? 1; });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { realpathSync } from "node:fs";
|
|
2
2
|
import { pathToFileURL } from "node:url";
|
|
3
|
-
import { runPluginHost } from "./extension/plugin-runtime.js";
|
|
4
|
-
import { claudeAdapter } from "./integrations/hosts/claude.js";
|
|
3
|
+
import { runPluginHost } from "./extension/hosts/plugin-runtime.js";
|
|
4
|
+
import { claudeAdapter } from "./integrations/hosts/claude/adapter.js";
|
|
5
5
|
export function main(args) {
|
|
6
6
|
return runPluginHost(claudeAdapter, args);
|
|
7
7
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { open, realpath, rename, unlink, link } from "node:fs/promises";
|
|
2
|
+
import { join, dirname, basename } from "node:path";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
import { requireThat } from "./validation.js";
|
|
5
|
+
export async function atomicFile(path, content, exclusive = false) {
|
|
6
|
+
const temp = path + "." + randomUUID();
|
|
7
|
+
const handle = await open(temp, "wx", 0o600);
|
|
8
|
+
try {
|
|
9
|
+
await handle.writeFile(content);
|
|
10
|
+
await handle.sync();
|
|
11
|
+
}
|
|
12
|
+
finally {
|
|
13
|
+
await handle.close();
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
if (exclusive)
|
|
17
|
+
await link(temp, path);
|
|
18
|
+
else
|
|
19
|
+
await rename(temp, path);
|
|
20
|
+
const directory = await open(dirname(path), "r");
|
|
21
|
+
try {
|
|
22
|
+
await directory.sync();
|
|
23
|
+
}
|
|
24
|
+
finally {
|
|
25
|
+
await directory.close();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
await unlink(temp).catch(error => { if (error.code !== "ENOENT")
|
|
30
|
+
throw error; });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export async function mutationTarget(path) {
|
|
34
|
+
try {
|
|
35
|
+
return await realpath(path);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
if (error.code !== "ENOENT")
|
|
39
|
+
throw error;
|
|
40
|
+
const parent = dirname(path);
|
|
41
|
+
requireThat(parent !== path, "无法定位目标路径。");
|
|
42
|
+
return join(await mutationTarget(parent), basename(path));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export declare const acpBackendPattern: RegExp;
|
|
2
2
|
export declare function isAcpBackend(value: unknown): value is string;
|
|
3
3
|
export declare function requireThat(condition: unknown, message: string): asserts condition;
|
|
4
|
+
/** Shared grammar for host and dimension identifiers in history archives and queries. */
|
|
5
|
+
export declare const historyIdentifierPattern: RegExp;
|
|
6
|
+
export declare function isHistoryIdentifier(value: unknown): value is string;
|
|
7
|
+
export declare function isOneOf<T extends string>(value: unknown, choices: readonly T[]): value is T;
|
|
@@ -6,3 +6,11 @@ export function requireThat(condition, message) {
|
|
|
6
6
|
if (!condition)
|
|
7
7
|
throw new Error(message);
|
|
8
8
|
}
|
|
9
|
+
/** Shared grammar for host and dimension identifiers in history archives and queries. */
|
|
10
|
+
export const historyIdentifierPattern = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
11
|
+
export function isHistoryIdentifier(value) {
|
|
12
|
+
return typeof value === "string" && historyIdentifierPattern.test(value);
|
|
13
|
+
}
|
|
14
|
+
export function isOneOf(value, choices) {
|
|
15
|
+
return typeof value === "string" && choices.includes(value);
|
|
16
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { AgentFiles } from "
|
|
2
|
-
import type { AcpInput, AcpAnswer } from "
|
|
1
|
+
import { AgentFiles } from "../../storage/agent-files.js";
|
|
2
|
+
import type { AcpInput, AcpAnswer } from "../../model/acp.js";
|
|
3
3
|
export declare function acpMember(): Promise<{
|
|
4
4
|
files: AgentFiles;
|
|
5
|
-
d: import("
|
|
5
|
+
d: import("../../model/agent.js").AgentDescriptor;
|
|
6
6
|
id: string;
|
|
7
7
|
generation: string;
|
|
8
|
-
configuration: import("
|
|
9
|
-
features: import("
|
|
8
|
+
configuration: import("../../model/workspace-config.js").WorkspaceConfiguration;
|
|
9
|
+
features: Readonly<Required<import("../../model/workspace-config.js").WorkspaceFeatures>>;
|
|
10
10
|
check: () => void;
|
|
11
11
|
context: () => Promise<{
|
|
12
12
|
workspace: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { dirname } from "node:path";
|
|
2
2
|
import { realpathSync } from "node:fs";
|
|
3
|
-
import { AgentFiles, descriptor, launch } from "
|
|
4
|
-
import { acpInput, acpAnswer } from "
|
|
5
|
-
import { requireThat } from "
|
|
6
|
-
import { packageVersion, releaseLine } from "
|
|
7
|
-
import { loadWorkspaceContext } from "
|
|
8
|
-
import { readWorkspaceConfig, workspaceDisabledMessage, workspaceFeatures } from "
|
|
3
|
+
import { AgentFiles, descriptor, launch } from "../../storage/agent-files.js";
|
|
4
|
+
import { acpInput, acpAnswer } from "../../storage/acp-files.js";
|
|
5
|
+
import { requireThat } from "../../common/validation.js";
|
|
6
|
+
import { packageVersion, releaseLine } from "../../common/version.js";
|
|
7
|
+
import { loadWorkspaceContext } from "../../integrations/agent-resources.js";
|
|
8
|
+
import { readWorkspaceConfig, workspaceDisabledMessage, workspaceFeatures } from "../../services/workspace/workspace-config.js";
|
|
9
9
|
export async function acpMember() {
|
|
10
10
|
const id = process.env.PBOT_SUBAGENT_RUN_ID, directory = process.env.PBOT_SUBAGENT_DIR, generation = process.env.PBOT_SUBAGENT_GENERATION;
|
|
11
11
|
requireThat(id && directory && generation, "缺少 ACP 成员启动身份。");
|