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
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { dirname, join, resolve } from "node:path";
|
|
2
3
|
import type { RequestPermissionRequest } from "@agentclientprotocol/sdk";
|
|
3
|
-
import { AgentFiles, descriptor, launch, status } from "
|
|
4
|
-
import { acpModelState, acpReference } from "
|
|
5
|
-
import type { AcpModelSelection, AcpSessionReference } from "
|
|
6
|
-
import { AcpAgentRun } from "
|
|
7
|
-
import { openAcp } from "
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
4
|
+
import { AgentFiles, descriptor, launch, status } from "../../storage/agent-files.js";
|
|
5
|
+
import { acpModelState, acpReference } from "../../storage/acp-files.js";
|
|
6
|
+
import type { AcpModelSelection, AcpSessionReference } from "../../model/acp.js";
|
|
7
|
+
import { AcpAgentRun } from "../../services/agents/acp-run.js";
|
|
8
|
+
import { openAcp } from "../../integrations/acp/connection.js";
|
|
9
|
+
import { acpExecutable } from "../../integrations/acp/executable.js";
|
|
10
|
+
import { acpContent } from "../../integrations/acp/input.js";
|
|
11
|
+
import { toAcpMcpServers } from "../../integrations/acp/mcp.js";
|
|
12
|
+
import { resolveAcpHarness } from "../../integrations/acp/registry.js";
|
|
13
|
+
import { loadWorkspaceContext } from "../../integrations/agent-resources.js";
|
|
14
|
+
import { readWorkspaceConfig, workspaceFeatures } from "../../services/workspace/workspace-config.js";
|
|
15
|
+
import { readWorkspaceMcpConfig, resolveWorkspaceMcpServers } from "../../services/workspace/workspace-mcp.js";
|
|
16
|
+
import { discoverWorkspaceSkills } from "../../services/workspace/workspace-skills.js";
|
|
17
|
+
import { object } from "../../common/json.js";
|
|
18
|
+
import { resourceRoot } from "../../common/paths.js";
|
|
19
|
+
import { requireThat } from "../../common/validation.js";
|
|
20
|
+
import { packageVersion, releaseLine } from "../../common/version.js";
|
|
19
21
|
|
|
20
22
|
const errorMessage = (error: unknown) => error instanceof Error ? error.message : String(error);
|
|
21
23
|
|
|
@@ -252,6 +254,118 @@ async function runWorker(args: string[]) {
|
|
|
252
254
|
}
|
|
253
255
|
}
|
|
254
256
|
|
|
257
|
+
async function runOneShotPrompt() {
|
|
258
|
+
const lifetime = new AbortController();
|
|
259
|
+
const stop = () => lifetime.abort(new Error("ACP 摘要任务已取消。"));
|
|
260
|
+
process.on("SIGTERM", stop);
|
|
261
|
+
process.on("SIGINT", stop);
|
|
262
|
+
try {
|
|
263
|
+
const payload = await new Promise<{
|
|
264
|
+
reference: AcpSessionReference;
|
|
265
|
+
cwd: string;
|
|
266
|
+
system: string;
|
|
267
|
+
prompt: string;
|
|
268
|
+
model?: string;
|
|
269
|
+
thinking?: string;
|
|
270
|
+
}>((resolvePayload, rejectPayload) => {
|
|
271
|
+
const timer = setTimeout(() => rejectPayload(new Error("缺少 ACP 摘要任务参数。")), 5000);
|
|
272
|
+
process.once("message", (value: unknown) => {
|
|
273
|
+
clearTimeout(timer);
|
|
274
|
+
if (!object(value)) { rejectPayload(new Error("ACP 摘要任务参数必须是对象。")); return; }
|
|
275
|
+
resolvePayload(value as {
|
|
276
|
+
reference: AcpSessionReference;
|
|
277
|
+
cwd: string;
|
|
278
|
+
system: string;
|
|
279
|
+
prompt: string;
|
|
280
|
+
model?: string;
|
|
281
|
+
thinking?: string;
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
process.once("disconnect", () => { clearTimeout(timer); rejectPayload(new Error("ACP 摘要任务通道已断开。")); });
|
|
285
|
+
});
|
|
286
|
+
const reference = acpReference(payload.reference);
|
|
287
|
+
requireThat(typeof payload.cwd === "string" && payload.cwd.length > 0, "缺少 ACP 摘要工作目录。");
|
|
288
|
+
requireThat(typeof payload.prompt === "string" && payload.prompt.trim().length > 0, "缺少 ACP 摘要输入内容。");
|
|
289
|
+
const harness = resolveAcpHarness(reference.backend);
|
|
290
|
+
const packageRoot = resolve(resourceRoot, "..");
|
|
291
|
+
// Mark as managed subagent so no host (Pi, dsh, Claude, Antigravity) ever records raw history for summary runs.
|
|
292
|
+
const env: NodeJS.ProcessEnv = {
|
|
293
|
+
...process.env,
|
|
294
|
+
...(reference.env ?? {}),
|
|
295
|
+
PBOT_SUBAGENT_RUN_ID: "pbot-summary-" + randomUUID(),
|
|
296
|
+
...(reference.backend === "pi" ? {
|
|
297
|
+
PBOT_SUMMARY_WORKER: "1",
|
|
298
|
+
PI_OFFLINE: "1",
|
|
299
|
+
PBOT_ACP_PI_COMMAND: process.env.PI_ACP_PI_COMMAND ?? acpExecutable("pi", "pi"),
|
|
300
|
+
PI_ACP_PI_COMMAND: join(packageRoot, "bin/pbot-pi-acp.mjs"),
|
|
301
|
+
} : {}),
|
|
302
|
+
};
|
|
303
|
+
let collecting = false;
|
|
304
|
+
let text = "";
|
|
305
|
+
const connection = await openAcp(
|
|
306
|
+
reference,
|
|
307
|
+
payload.cwd,
|
|
308
|
+
env,
|
|
309
|
+
{
|
|
310
|
+
update(update) {
|
|
311
|
+
if (collecting && update.sessionUpdate === "agent_message_chunk" && update.content.type === "text") {
|
|
312
|
+
text += update.content.text;
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
async permission() {
|
|
316
|
+
return { outcome: { outcome: "cancelled" } };
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
lifetime.signal,
|
|
320
|
+
{
|
|
321
|
+
harness,
|
|
322
|
+
...(payload.system ? { systemPrompt: payload.system } : {}),
|
|
323
|
+
},
|
|
324
|
+
);
|
|
325
|
+
try {
|
|
326
|
+
if (payload.model || payload.thinking) {
|
|
327
|
+
const parsedModel = payload.model
|
|
328
|
+
? (harness.parseModelValue ? harness.parseModelValue(payload.model) : { model: payload.model })
|
|
329
|
+
: undefined;
|
|
330
|
+
await connection.configure({
|
|
331
|
+
...(parsedModel?.provider ? { provider: parsedModel.provider } : {}),
|
|
332
|
+
...(parsedModel?.model ? { model: parsedModel.model } : {}),
|
|
333
|
+
...(payload.thinking ? { thinking: payload.thinking } : {}),
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
const promptText = !connection.systemPrompt && payload.system
|
|
337
|
+
? `${payload.system}\n\n---\n\n${payload.prompt}`
|
|
338
|
+
: payload.prompt;
|
|
339
|
+
collecting = true;
|
|
340
|
+
await connection.prompt([{ type: "text", text: promptText }]);
|
|
341
|
+
let cleaned = text;
|
|
342
|
+
if (connection.startupInfo) {
|
|
343
|
+
if (cleaned.startsWith(connection.startupInfo)) {
|
|
344
|
+
cleaned = cleaned.slice(connection.startupInfo.length);
|
|
345
|
+
} else {
|
|
346
|
+
const trimmedInfo = connection.startupInfo.trim();
|
|
347
|
+
const trimmedText = cleaned.trimStart();
|
|
348
|
+
if (trimmedInfo && trimmedText.startsWith(trimmedInfo)) {
|
|
349
|
+
cleaned = trimmedText.slice(trimmedInfo.length);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
const answer = cleaned.trim();
|
|
354
|
+
requireThat(answer.length > 0, "ACP 摘要返回为空。");
|
|
355
|
+
await sendIpc({ type: "answer", text: answer });
|
|
356
|
+
} finally {
|
|
357
|
+
await connection.close();
|
|
358
|
+
}
|
|
359
|
+
} catch (error) {
|
|
360
|
+
await sendIpc({ type: "error", error: errorMessage(error) });
|
|
361
|
+
process.exitCode = 1;
|
|
362
|
+
} finally {
|
|
363
|
+
lifetime.abort();
|
|
364
|
+
if (process.connected) process.disconnect();
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
255
368
|
const args = process.argv.slice(2);
|
|
256
369
|
if (args.includes("--probe")) await runProbe();
|
|
370
|
+
else if (args.includes("--prompt")) await runOneShotPrompt();
|
|
257
371
|
else await runWorker(args);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { requireThat } from "../../common/validation.js";
|
|
2
|
+
import { createAcpHistorySummarizer } from "../../integrations/acp/history-summary.js";
|
|
3
|
+
import type { SummaryRunProgress } from "../../model/history.js";
|
|
4
|
+
import { migrateWorkspaceHistory } from "../../services/history/history-migrate.js";
|
|
5
|
+
import { parseHistoryCommand, type ParsedHistoryCommand } from "../../services/history/summary-command.js";
|
|
6
|
+
import { listSummaryDimensions } from "../../services/history/summary-registry.js";
|
|
7
|
+
import { inspectWorkspaceSummaries, runWorkspaceSummaries } from "../../services/history/summary-runner.js";
|
|
8
|
+
import { readWorkspaceConfig, readWorkspaceHistoryLayoutSync, workspaceDisabledMessage, workspaceFeatures, workspaceSummaryConfig } from "../../services/workspace/workspace-config.js";
|
|
9
|
+
import { executeHistory } from "../../tools/history/actions.js";
|
|
10
|
+
import { historyInput } from "../../tools/history/contract.js";
|
|
11
|
+
|
|
12
|
+
interface CommandContext {
|
|
13
|
+
root: string;
|
|
14
|
+
features: { history: boolean };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export async function runHistoryCommand(
|
|
18
|
+
workspace: CommandContext,
|
|
19
|
+
argument: string | ParsedHistoryCommand,
|
|
20
|
+
signal: AbortSignal,
|
|
21
|
+
progress?: { start(backend: string): void; update(event: SummaryRunProgress): void; finish?(): void },
|
|
22
|
+
) {
|
|
23
|
+
const { root } = workspace;
|
|
24
|
+
signal.throwIfAborted();
|
|
25
|
+
requireThat(workspace.features.history, "当前工作区已停用历史功能(features.history: false)。");
|
|
26
|
+
const command = typeof argument === "string" ? parseHistoryCommand(argument) : argument;
|
|
27
|
+
switch (command.kind) {
|
|
28
|
+
case "status":
|
|
29
|
+
return inspectWorkspaceSummaries(root);
|
|
30
|
+
case "list": {
|
|
31
|
+
const layout = readWorkspaceHistoryLayoutSync(root);
|
|
32
|
+
const dimensions = listSummaryDimensions(layout).map(({ id, title, description }) => ({ id, title, description }));
|
|
33
|
+
return { layout, dimensions };
|
|
34
|
+
}
|
|
35
|
+
case "migrate":
|
|
36
|
+
return migrateWorkspaceHistory(root, { dryRun: command.dryRun });
|
|
37
|
+
case "query":
|
|
38
|
+
return executeHistory(root, historyInput(command.input), signal);
|
|
39
|
+
case "summary": {
|
|
40
|
+
const config = await readWorkspaceConfig(root);
|
|
41
|
+
requireThat(config.enabled && !config.error, workspaceDisabledMessage(config));
|
|
42
|
+
requireThat(workspaceFeatures(config).history, "当前工作区已停用历史功能(features.history: false)。");
|
|
43
|
+
const defaults = workspaceSummaryConfig(config);
|
|
44
|
+
const backend = command.backend ?? defaults.backend;
|
|
45
|
+
const model = command.model ?? defaults.model;
|
|
46
|
+
const thinking = command.thinking ?? defaults.thinking;
|
|
47
|
+
const summarizer = createAcpHistorySummarizer({
|
|
48
|
+
cwd: root, backend,
|
|
49
|
+
...(config.acp ? { commands: config.acp } : {}),
|
|
50
|
+
...(model ? { model } : {}),
|
|
51
|
+
...(thinking ? { thinking } : {}),
|
|
52
|
+
});
|
|
53
|
+
progress?.start(backend);
|
|
54
|
+
try {
|
|
55
|
+
const report = await runWorkspaceSummaries({
|
|
56
|
+
root, summarizer, signal,
|
|
57
|
+
force: command.force,
|
|
58
|
+
concurrency: defaults.concurrency,
|
|
59
|
+
...(command.dimensions ? { dimensions: command.dimensions } : {}),
|
|
60
|
+
...(progress ? { onProgress: progress.update } : {}),
|
|
61
|
+
});
|
|
62
|
+
return { backend, ...(model ? { model } : {}), ...report };
|
|
63
|
+
} finally {
|
|
64
|
+
progress?.finish?.();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
2
|
+
import { registerHooks } from "node:module";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
|
+
|
|
5
|
+
// Keep normal dsh profile resolution. A standalone plugin cache has no SDK
|
|
6
|
+
// peers of its own, so resolve missing peers from the running dsh installation.
|
|
7
|
+
const memberLib = new URL("../../../", import.meta.url).href;
|
|
8
|
+
const peers = registerHooks({
|
|
9
|
+
resolve(specifier, context, nextResolve) {
|
|
10
|
+
if (specifier.startsWith("@deepseek-ai/") && context.parentURL?.startsWith(memberLib)) {
|
|
11
|
+
try { return nextResolve(specifier, context); }
|
|
12
|
+
catch (error) {
|
|
13
|
+
if ((error as NodeJS.ErrnoException).code !== "ERR_MODULE_NOT_FOUND" || !process.argv[1]) throw error;
|
|
14
|
+
return nextResolve(specifier, { ...context, parentURL: pathToFileURL(realpathSync(process.argv[1])).href });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return nextResolve(specifier, context);
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const { name, inject, apply } = await import("./acp-member.js").finally(() => peers.deregister());
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { Context } from "@deepseek-ai/cordis";
|
|
2
2
|
import * as McpClient from "@deepseek-ai/dsh-mcp-client";
|
|
3
|
-
import type { AcpInput } from "
|
|
4
|
-
import { acpMember } from "
|
|
5
|
-
import { rootAgents } from "
|
|
6
|
-
import { dshResources, dshExpertTools } from "
|
|
7
|
-
import { registerDshSkills } from "
|
|
8
|
-
import { toDshMcpConfig } from "
|
|
9
|
-
import { finalDshAnswer } from "
|
|
10
|
-
import {
|
|
3
|
+
import type { AcpInput } from "../../../model/acp.js";
|
|
4
|
+
import { acpMember } from "../../acp/member.js";
|
|
5
|
+
import { rootAgents } from "../../../integrations/hosts/dsh/root-agents.js";
|
|
6
|
+
import { dshResources, dshExpertTools } from "../../../integrations/hosts/dsh/resources.js";
|
|
7
|
+
import { registerDshSkills } from "../../../integrations/hosts/dsh/skills.js";
|
|
8
|
+
import { toDshMcpConfig } from "../../../integrations/hosts/dsh/mcp.js";
|
|
9
|
+
import { finalDshAnswer } from "../../../integrations/hosts/dsh/messages.js";
|
|
10
|
+
import { loadNativeWorkspaceServers } from "../workspace-mcp.js";
|
|
11
11
|
import { registerDshFileEvents } from "./files.js";
|
|
12
|
-
import { requireThat } from "
|
|
12
|
+
import { requireThat } from "../../../common/validation.js";
|
|
13
13
|
|
|
14
14
|
export const name = "pbot-acp-member";
|
|
15
15
|
export const inject = ["agents", "sessions", "llm", "tools", "systemPrompt", "skills", "fs", "workingDirectory", "approval"];
|
|
@@ -29,20 +29,9 @@ export async function apply(ctx: Context) {
|
|
|
29
29
|
await agent.ctx.plugin({ name: "pbot-acp-expert", inject, apply: async scope => {
|
|
30
30
|
if (member.features.skills) registerDshSkills(scope, agent, { workspaceRoot: member.d.workspace });
|
|
31
31
|
if (member.features.mcp && process.env.PBOT_ACP_VALIDATE !== "1") {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} else {
|
|
36
|
-
for (const [serverName, server] of Object.entries(mcpConfig.servers)) {
|
|
37
|
-
if (server.enabled === false) continue;
|
|
38
|
-
try {
|
|
39
|
-
const resolved = resolveWorkspaceMcpServer(member.d.workspace, serverName, server);
|
|
40
|
-
await scope.plugin(McpClient, toDshMcpConfig(resolved));
|
|
41
|
-
} catch (error) {
|
|
42
|
-
ctx.logger.warn(error instanceof Error ? error.message : String(error));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
32
|
+
await loadNativeWorkspaceServers(member.d.workspace, async server => {
|
|
33
|
+
await scope.plugin(McpClient, toDshMcpConfig(server));
|
|
34
|
+
}, { warn: message => ctx.logger.warn(message) });
|
|
46
35
|
}
|
|
47
36
|
dshExpertTools(scope, agent, member.d.options);
|
|
48
37
|
if (member.features.prompts) await dshResources(scope, agent, member.d.workspace, "general-purpose", member.check);
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import type { Context } from "@deepseek-ai/cordis";
|
|
2
2
|
import type {} from "@deepseek-ai/dsh-commands";
|
|
3
|
-
import {
|
|
4
|
-
import { requireThat } from "../../common/validation.js";
|
|
5
|
-
import { dshWorkspaceStatus, type PbotManagement } from "./management.js";
|
|
3
|
+
import { dshWorkspaceStatus } from "./management.js";
|
|
6
4
|
import type { DshWorkspaces } from "./workspace.js";
|
|
7
|
-
import {
|
|
5
|
+
import { runHistoryCommand } from "../../history/command.js";
|
|
6
|
+
import { parseWorkerCommand } from "../../mcp/workers.js";
|
|
8
7
|
|
|
9
|
-
const usage = '用法:/pbot status | init | worker [overview|status|backends|models|create|request|response|output|close] [JSON]
|
|
8
|
+
const usage = '用法:/pbot status | init | history [summary [维度] [--force] [--backend <acp>] [--model <model>] | migrate [--dry-run] | status | list | {"action":…}] | worker [overview|status|backends|models|create|request|response|output|close] [JSON]';
|
|
10
9
|
|
|
11
|
-
export function registerDshCommand(ctx: Context, workspaces: DshWorkspaces
|
|
10
|
+
export function registerDshCommand(ctx: Context, workspaces: DshWorkspaces) {
|
|
12
11
|
ctx.commands.register({
|
|
13
12
|
name: "pbot",
|
|
14
|
-
description: "Personal Bot
|
|
13
|
+
description: "Personal Bot 工作区、历史摘要与跨 Harness worker 管理",
|
|
15
14
|
recordInput: false,
|
|
16
|
-
input: { hint: "status | init |
|
|
15
|
+
input: { hint: "status | init | history ... | worker ...", attachments: false },
|
|
17
16
|
async handler({ agent, rawInput, signal }) {
|
|
18
17
|
signal.throwIfAborted();
|
|
19
18
|
const command = rawInput.trim(), split = command.search(/\s/);
|
|
@@ -38,10 +37,9 @@ export function registerDshCommand(ctx: Context, workspaces: DshWorkspaces, mana
|
|
|
38
37
|
break;
|
|
39
38
|
}
|
|
40
39
|
case "history": {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
result = await management.history({ parentSessionId: agent.id, input: json(input) }, signal);
|
|
40
|
+
const active = AbortSignal.any([signal, workspace.lifetime.signal]);
|
|
41
|
+
result = await runHistoryCommand(workspace, rest, active);
|
|
42
|
+
active.throwIfAborted();
|
|
45
43
|
break;
|
|
46
44
|
}
|
|
47
45
|
default:
|
|
@@ -4,9 +4,9 @@ import type { Agent } from "@deepseek-ai/dsh-agent";
|
|
|
4
4
|
import type { ToolExecution, ToolExecutionToken } from "@deepseek-ai/dsh-tools";
|
|
5
5
|
import { parsePatch } from "@deepseek-ai/dsh-fs-patch";
|
|
6
6
|
import type {} from "@deepseek-ai/dsh-user-approval";
|
|
7
|
-
import { object } from "
|
|
8
|
-
import { requireThat } from "
|
|
9
|
-
import { mutationScope } from "
|
|
7
|
+
import { object } from "../../../common/json.js";
|
|
8
|
+
import { requireThat } from "../../../common/validation.js";
|
|
9
|
+
import { mutationScope } from "../../../services/workspace/workspace-files.js";
|
|
10
10
|
|
|
11
11
|
/** Native filesystem mutations share the original workspace's confirmation rule.
|
|
12
12
|
* This does not confine Bash, Python, MCP, or other extensions. */
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import type { Agent } from "@deepseek-ai/dsh-agent";
|
|
3
|
+
import type { SessionEvent } from "@deepseek-ai/dsh-session";
|
|
4
|
+
import { recordHistoryCapture } from "../../../services/history/history-capture.js";
|
|
5
|
+
import { finalDshAnswer } from "../../../integrations/hosts/dsh/messages.js";
|
|
6
|
+
|
|
7
|
+
type Question = Extract<SessionEvent, { type: "user/message" }>;
|
|
8
|
+
|
|
9
|
+
function userMessageText(content: Question["data"]["content"]): string {
|
|
10
|
+
return content.flatMap(block => block.type === "text" ? [block.text] :
|
|
11
|
+
block.type === "image" ? ["[图片 " + (block.attachment.name ?? block.attachment.attachmentId) + "]"] :
|
|
12
|
+
block.type === "file" ? ["[附件 " + (block.attachment.name ?? block.attachment.attachmentId) + "]"] : []).join("\n");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Capture root-session raw Q&A exchanges into .pbot/history/raw/. Summaries run on explicit trigger. */
|
|
16
|
+
export function registerDshHistoryEvents(ctx: Context, agent: Agent, root: string) {
|
|
17
|
+
let final = false;
|
|
18
|
+
let lastAnswer = "";
|
|
19
|
+
let lastAnswerTime: string | undefined;
|
|
20
|
+
|
|
21
|
+
ctx.on("session/event", (session, event) => {
|
|
22
|
+
if (session !== agent.session) return;
|
|
23
|
+
if (event.type === "turn/start") {
|
|
24
|
+
final = false;
|
|
25
|
+
lastAnswer = "";
|
|
26
|
+
lastAnswerTime = undefined;
|
|
27
|
+
}
|
|
28
|
+
if (event.type === "user/message" && event.data.source.kind === "user") {
|
|
29
|
+
const text = userMessageText(event.data.content).trim();
|
|
30
|
+
if (text) {
|
|
31
|
+
try {
|
|
32
|
+
recordHistoryCapture(root, "dsh", {
|
|
33
|
+
kind: "input",
|
|
34
|
+
sessionId: agent.id,
|
|
35
|
+
text,
|
|
36
|
+
timestamp: new Date(event.time).toISOString(),
|
|
37
|
+
});
|
|
38
|
+
} catch { /* Never block a user turn if history persistence fails. */ }
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (event.type === "assistant/message") {
|
|
42
|
+
const completeText = finalDshAnswer(event).trim();
|
|
43
|
+
final = Boolean(completeText);
|
|
44
|
+
const body = completeText || event.data.message.content.filter(block => block.type === "text").map(block => block.text).join("\n").trim();
|
|
45
|
+
if (body) {
|
|
46
|
+
lastAnswer = body;
|
|
47
|
+
lastAnswerTime = new Date(event.time).toISOString();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (event.type === "turn/end") {
|
|
51
|
+
const completed = event.data.reason.kind === "completed" && final;
|
|
52
|
+
if (lastAnswer) {
|
|
53
|
+
try {
|
|
54
|
+
recordHistoryCapture(root, "dsh", {
|
|
55
|
+
kind: "answer",
|
|
56
|
+
sessionId: agent.id,
|
|
57
|
+
assistantText: lastAnswer,
|
|
58
|
+
completed,
|
|
59
|
+
...(lastAnswerTime ? { timestamp: lastAnswerTime } : {}),
|
|
60
|
+
});
|
|
61
|
+
} catch { /* Never block turn completion if history persistence fails. */ }
|
|
62
|
+
}
|
|
63
|
+
lastAnswer = "";
|
|
64
|
+
lastAnswerTime = undefined;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
@@ -4,13 +4,14 @@ import { Remote, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
|
4
4
|
import type {} from "@deepseek-ai/dsh-typert-registry";
|
|
5
5
|
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
6
6
|
import { Type, type Static } from "typebox";
|
|
7
|
-
import { json, type Json } from "
|
|
8
|
-
import { requireThat } from "
|
|
9
|
-
import { schema } from "
|
|
10
|
-
import { packageVersion } from "
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
7
|
+
import { json, type Json } from "../../../common/json.js";
|
|
8
|
+
import { requireThat } from "../../../common/validation.js";
|
|
9
|
+
import { schema } from "../../../common/schema.js";
|
|
10
|
+
import { packageVersion } from "../../../common/version.js";
|
|
11
|
+
import { inspectWorkspaceSummaries } from "../../../services/history/summary-runner.js";
|
|
12
|
+
import { historyInput } from "../../../tools/history/contract.js";
|
|
13
|
+
import { executeHistory } from "../../../tools/history/actions.js";
|
|
14
|
+
import { pbotReadRemote } from "../../../ui/dsh/remote.js";
|
|
14
15
|
import type { DshWorkspaces, DshWorkspace } from "./workspace.js";
|
|
15
16
|
|
|
16
17
|
const requestSchema = Type.Object({ parentSessionId: Type.String({ minLength: 1 }), input: Type.Optional(Type.Unknown()) }, { additionalProperties: false });
|
|
@@ -26,7 +27,7 @@ export function dshStatus(workspace: DshWorkspace): Json {
|
|
|
26
27
|
workspaceRoot: workspace.root,
|
|
27
28
|
sessionId: workspace.agent.id,
|
|
28
29
|
model: workspace.agent.model.current() ?? null,
|
|
29
|
-
history: workspace.history.
|
|
30
|
+
history: workspace.features.history ? inspectWorkspaceSummaries(workspace.root) : null,
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -79,7 +80,8 @@ export class PbotManagement extends TypertRemoteService {
|
|
|
79
80
|
@Remote
|
|
80
81
|
async history(request: Json, signal: AbortSignal): Promise<Json> {
|
|
81
82
|
const current = await this.workspace(request, signal), { workspace, input } = current;
|
|
82
|
-
|
|
83
|
+
requireThat(workspace.features.history, "当前工作区已停用历史功能(features.history: false)。");
|
|
84
|
+
const result = executeHistory(workspace.root, historyInput(input), current.signal);
|
|
83
85
|
workspace.check(); current.signal.throwIfAborted(); return json(result);
|
|
84
86
|
}
|
|
85
87
|
}
|