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
|
@@ -4,11 +4,12 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
// src/extension/acp
|
|
8
|
-
import {
|
|
7
|
+
// src/extension/acp/worker.ts
|
|
8
|
+
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
9
|
+
import { dirname as dirname4, join as join11, resolve as resolve5 } from "node:path";
|
|
9
10
|
|
|
10
11
|
// src/storage/agent-files.ts
|
|
11
|
-
import { existsSync, mkdirSync as
|
|
12
|
+
import { existsSync, mkdirSync as mkdirSync3, readdirSync, rmSync } from "node:fs";
|
|
12
13
|
import { join as join3 } from "node:path";
|
|
13
14
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
14
15
|
|
|
@@ -34,6 +35,9 @@ function isAcpBackend(value) {
|
|
|
34
35
|
function requireThat(condition, message2) {
|
|
35
36
|
if (!condition) throw new Error(message2);
|
|
36
37
|
}
|
|
38
|
+
function isOneOf(value, choices) {
|
|
39
|
+
return typeof value === "string" && choices.includes(value);
|
|
40
|
+
}
|
|
37
41
|
|
|
38
42
|
// src/storage/atomic-json.ts
|
|
39
43
|
import {
|
|
@@ -43,16 +47,18 @@ import {
|
|
|
43
47
|
fsyncSync,
|
|
44
48
|
linkSync,
|
|
45
49
|
lstatSync,
|
|
50
|
+
mkdirSync,
|
|
46
51
|
openSync,
|
|
47
52
|
readFileSync,
|
|
48
53
|
realpathSync,
|
|
49
54
|
renameSync,
|
|
55
|
+
rmdirSync,
|
|
50
56
|
unlinkSync,
|
|
51
57
|
writeFileSync
|
|
52
58
|
} from "node:fs";
|
|
53
59
|
import { dirname, join } from "node:path";
|
|
54
60
|
import { randomUUID } from "node:crypto";
|
|
55
|
-
function internalPath(directory, relative) {
|
|
61
|
+
function internalPath(directory, relative, allowMissingParents = false) {
|
|
56
62
|
const parts = relative.split("/");
|
|
57
63
|
requireThat(parts.every((part) => part && part !== "." && part !== ".." && !/[\\\x00-\x1f]/.test(part)), "\u5185\u90E8\u72B6\u6001\u8DEF\u5F84\u65E0\u6548\u3002");
|
|
58
64
|
const info = lstatSync(directory);
|
|
@@ -64,7 +70,7 @@ function internalPath(directory, relative) {
|
|
|
64
70
|
const info2 = lstatSync(path);
|
|
65
71
|
requireThat(!info2.isSymbolicLink() && (index === parts.length - 1 ? info2.isFile() : info2.isDirectory()), "\u5185\u90E8\u72B6\u6001\u4E0D\u80FD\u4F7F\u7528\u7B26\u53F7\u94FE\u63A5\u6216\u7279\u6B8A\u6587\u4EF6\u3002");
|
|
66
72
|
} catch (error2) {
|
|
67
|
-
if (error2.code !== "ENOENT" || index !== parts.length - 1) throw error2;
|
|
73
|
+
if (error2.code !== "ENOENT" || !allowMissingParents && index !== parts.length - 1) throw error2;
|
|
68
74
|
}
|
|
69
75
|
}
|
|
70
76
|
return path;
|
|
@@ -129,7 +135,7 @@ function writeJsonFile(directory, relative, value, validate2, createOnly = false
|
|
|
129
135
|
}
|
|
130
136
|
|
|
131
137
|
// src/storage/file-access.ts
|
|
132
|
-
import { lstatSync as lstatSync2, mkdirSync } from "node:fs";
|
|
138
|
+
import { lstatSync as lstatSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
133
139
|
import { join as join2 } from "node:path";
|
|
134
140
|
function fileId(id) {
|
|
135
141
|
requireThat(/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/.test(id), "\u5185\u90E8\u8BB0\u5F55 ID \u65E0\u6548\u3002");
|
|
@@ -142,7 +148,7 @@ function privateDirectory(root, relative) {
|
|
|
142
148
|
fileId(part);
|
|
143
149
|
const path = join2(parent, part);
|
|
144
150
|
try {
|
|
145
|
-
|
|
151
|
+
mkdirSync2(path, { mode: 448 });
|
|
146
152
|
syncDirectory(parent);
|
|
147
153
|
} catch (error2) {
|
|
148
154
|
if (error2.code !== "EEXIST") throw error2;
|
|
@@ -152,15 +158,31 @@ function privateDirectory(root, relative) {
|
|
|
152
158
|
}
|
|
153
159
|
}
|
|
154
160
|
|
|
161
|
+
// src/model/agent.ts
|
|
162
|
+
var messageDeliveries = ["steer", "followUp"];
|
|
163
|
+
var cycleStates = ["running", "completed", "failed", "cancelled", "interrupted"];
|
|
164
|
+
var cycleSources = ["parent", "interactive", "mixed"];
|
|
165
|
+
var agentStates = ["starting", "busy", "idle", "stopping", "stopped", "error"];
|
|
166
|
+
|
|
155
167
|
// src/storage/acp-files.ts
|
|
156
168
|
import { isAbsolute } from "node:path";
|
|
169
|
+
|
|
170
|
+
// src/model/acp.ts
|
|
171
|
+
var acpPermissionPolicies = ["ask", "allow", "deny"];
|
|
172
|
+
var acpAnswerStates = ["completed", "failed", "cancelled"];
|
|
173
|
+
var acpElicitationActions = ["accept", "decline", "cancel"];
|
|
174
|
+
function isAcpElicitationValue(value) {
|
|
175
|
+
return typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value) || Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// src/storage/acp-files.ts
|
|
157
179
|
var text = (value) => typeof value === "string" && value.length > 0 && !value.includes("\0");
|
|
158
180
|
function acpReference(value) {
|
|
159
181
|
requireThat(object(value) && value.host === "acp" && isAcpBackend(value.backend) && text(value.command) && isAbsolute(value.command) && Array.isArray(value.args) && value.args.every((arg) => typeof arg === "string" && !arg.includes("\0")) && (value.sessionId === null || text(value.sessionId)), "ACP \u4F1A\u8BDD\u5F15\u7528\u65E0\u6548\u3002");
|
|
160
182
|
if (value.env !== void 0) {
|
|
161
183
|
requireThat(object(value.env) && Object.entries(value.env).every(([k, v]) => text(k) && typeof v === "string" && !v.includes("\0")), "ACP \u73AF\u5883\u53D8\u91CF\u914D\u7F6E\u65E0\u6548\u3002");
|
|
162
184
|
}
|
|
163
|
-
requireThat(value.permission === void 0 ||
|
|
185
|
+
requireThat(value.permission === void 0 || isOneOf(value.permission, acpPermissionPolicies), "ACP \u6743\u9650\u7B56\u7565\u65E0\u6548\u3002");
|
|
164
186
|
const capabilities = value.capabilities;
|
|
165
187
|
if (capabilities !== void 0) requireThat(object(capabilities) && ["resume", "load", "close"].every((key) => typeof capabilities[key] === "boolean"), "ACP \u4F1A\u8BDD\u80FD\u529B\u65E0\u6548\u3002");
|
|
166
188
|
return value;
|
|
@@ -176,7 +198,7 @@ function acpInput(value) {
|
|
|
176
198
|
}
|
|
177
199
|
function acpAnswer(value) {
|
|
178
200
|
acpInput(value);
|
|
179
|
-
requireThat(object(value) && typeof value.answer === "string" &&
|
|
201
|
+
requireThat(object(value) && typeof value.answer === "string" && isOneOf(value.state, acpAnswerStates) && (value.error === void 0 || typeof value.error === "string"), "ACP \u6700\u7EC8\u56DE\u7B54\u65E0\u6548\u3002");
|
|
180
202
|
return value;
|
|
181
203
|
}
|
|
182
204
|
function acpReport(value) {
|
|
@@ -186,7 +208,7 @@ function acpReport(value) {
|
|
|
186
208
|
}
|
|
187
209
|
function acpPermission(value) {
|
|
188
210
|
acpInput(value);
|
|
189
|
-
requireThat(object(value) && typeof value.description === "string" && Array.isArray(value.options) && value.options.every((option) => object(option) && text(option.optionId) && text(option.name) && ["allow_once", "allow_always", "reject_once", "reject_always"]
|
|
211
|
+
requireThat(object(value) && typeof value.description === "string" && Array.isArray(value.options) && value.options.every((option) => object(option) && text(option.optionId) && text(option.name) && isOneOf(option.kind, ["allow_once", "allow_always", "reject_once", "reject_always"])), "ACP \u786E\u8BA4\u8BF7\u6C42\u65E0\u6548\u3002");
|
|
190
212
|
return value;
|
|
191
213
|
}
|
|
192
214
|
function acpPermissionReply(value) {
|
|
@@ -194,9 +216,6 @@ function acpPermissionReply(value) {
|
|
|
194
216
|
requireThat(object(value) && (value.optionId === null || text(value.optionId)), "ACP \u786E\u8BA4\u7B54\u590D\u65E0\u6548\u3002");
|
|
195
217
|
return value;
|
|
196
218
|
}
|
|
197
|
-
function elicitationValue(value) {
|
|
198
|
-
return typeof value === "string" || typeof value === "number" && Number.isFinite(value) || typeof value === "boolean" || Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
199
|
-
}
|
|
200
219
|
function acpElicitation(value) {
|
|
201
220
|
acpInput(value);
|
|
202
221
|
requireThat(object(value) && (value.mode === "form" || value.mode === "url") && typeof value.message === "string", "ACP \u4EA4\u4E92\u8BF7\u6C42\u65E0\u6548\u3002");
|
|
@@ -209,9 +228,9 @@ function acpElicitation(value) {
|
|
|
209
228
|
}
|
|
210
229
|
function acpElicitationReply(value) {
|
|
211
230
|
acpInput(value);
|
|
212
|
-
requireThat(object(value) &&
|
|
231
|
+
requireThat(object(value) && isOneOf(value.action, acpElicitationActions), "ACP \u4EA4\u4E92\u7B54\u590D\u65E0\u6548\u3002");
|
|
213
232
|
if (value.content !== void 0) {
|
|
214
|
-
requireThat(value.action === "accept" && object(value.content) && Object.values(value.content).every(
|
|
233
|
+
requireThat(value.action === "accept" && object(value.content) && Object.values(value.content).every(isAcpElicitationValue), "ACP \u8868\u5355\u7B54\u590D content \u65E0\u6548\u3002");
|
|
215
234
|
}
|
|
216
235
|
return value;
|
|
217
236
|
}
|
|
@@ -229,15 +248,15 @@ function launch(v) {
|
|
|
229
248
|
return v;
|
|
230
249
|
}
|
|
231
250
|
function message(v) {
|
|
232
|
-
requireThat(object(v) && text2(v.requestId) && text2(v.generation) && Number.isSafeInteger(v.sequence) && typeof v.message === "string" &&
|
|
251
|
+
requireThat(object(v) && text2(v.requestId) && text2(v.generation) && Number.isSafeInteger(v.sequence) && typeof v.message === "string" && isOneOf(v.delivery, messageDeliveries) && Array.isArray(v.files) && v.files.every(text2), "\u5B50\u4F1A\u8BDD\u6D88\u606F\u65E0\u6548\u3002");
|
|
233
252
|
return v;
|
|
234
253
|
}
|
|
235
254
|
function cycle(v) {
|
|
236
|
-
requireThat(object(v) && text2(v.cycleId) && text2(v.generation) && number(v.startedAt) &&
|
|
255
|
+
requireThat(object(v) && text2(v.cycleId) && text2(v.generation) && number(v.startedAt) && isOneOf(v.state, cycleStates) && (v.leaf === null || text2(v.leaf)) && Array.isArray(v.requestIds) && v.requestIds.every(text2) && isOneOf(v.source, cycleSources) && (v.finishedAt === void 0 || number(v.finishedAt)), "\u5B50\u4F1A\u8BDD\u5468\u671F\u65E0\u6548\u3002");
|
|
237
256
|
return v;
|
|
238
257
|
}
|
|
239
258
|
function status(v) {
|
|
240
|
-
requireThat(object(v) && text2(v.generation) &&
|
|
259
|
+
requireThat(object(v) && text2(v.generation) && isOneOf(v.state, agentStates) && typeof v.activity === "string" && number(v.updatedAt), "\u5B50\u4F1A\u8BDD\u72B6\u6001\u65E0\u6548\u3002");
|
|
241
260
|
if (v.cycle) cycle(v.cycle);
|
|
242
261
|
return v;
|
|
243
262
|
}
|
|
@@ -281,8 +300,8 @@ var AgentFiles = class {
|
|
|
281
300
|
create(value, run, acp) {
|
|
282
301
|
this.check();
|
|
283
302
|
acpReference(acp);
|
|
284
|
-
|
|
285
|
-
|
|
303
|
+
mkdirSync3(this.root, { recursive: true, mode: 448 });
|
|
304
|
+
mkdirSync3(this.directory(value.agentId), { mode: 448 });
|
|
286
305
|
for (const dir of ["inbox", "completions", "reports", "permissions", "elicitations"]) privateDirectory(this.directory(value.agentId), dir);
|
|
287
306
|
this.write(value.agentId, "descriptor.json", value, descriptor, true);
|
|
288
307
|
this.write(value.agentId, "launch.json", run, launch, true);
|
|
@@ -324,10 +343,10 @@ var AgentFiles = class {
|
|
|
324
343
|
/** Short controller edits are serialized; an abandoned lock fails closed. */
|
|
325
344
|
control(work) {
|
|
326
345
|
this.check();
|
|
327
|
-
|
|
346
|
+
mkdirSync3(this.root, { recursive: true, mode: 448 });
|
|
328
347
|
const path = join3(this.root, ".control");
|
|
329
348
|
try {
|
|
330
|
-
|
|
349
|
+
mkdirSync3(path, { mode: 448 });
|
|
331
350
|
} catch (error2) {
|
|
332
351
|
if (error2.code !== "EEXIST") throw error2;
|
|
333
352
|
throw Object.assign(new Error("\u5B50\u4F1A\u8BDD\u63A7\u5236\u6B63\u5728\u8FDB\u884C\uFF1B\u7A0D\u540E\u91CD\u8BD5\u3002\u5D29\u6E83\u9057\u7559\u7684 .control \u9700\u505C\u6B62\u76F8\u5173\u6267\u884C\u5B9E\u4F8B\u540E\u624B\u52A8\u79FB\u9664\u3002"), { code: "PBOT_CONTROL_BUSY" });
|
|
@@ -10335,7 +10354,7 @@ requireThat(object(manifest) && typeof manifest.version === "string", "pbot \u53
|
|
|
10335
10354
|
var packageVersion = manifest.version;
|
|
10336
10355
|
releaseLine(packageVersion);
|
|
10337
10356
|
|
|
10338
|
-
// src/integrations/acp/claude.ts
|
|
10357
|
+
// src/integrations/acp/claude-settings.ts
|
|
10339
10358
|
import { createRequire } from "node:module";
|
|
10340
10359
|
import { pathToFileURL } from "node:url";
|
|
10341
10360
|
import { basename, join as join4, resolve } from "node:path";
|
|
@@ -10344,7 +10363,7 @@ import { basename, join as join4, resolve } from "node:path";
|
|
|
10344
10363
|
import { fileURLToPath } from "node:url";
|
|
10345
10364
|
var resourceRoot = fileURLToPath(new URL("../../resources/", import.meta.url));
|
|
10346
10365
|
|
|
10347
|
-
// src/integrations/acp/claude.ts
|
|
10366
|
+
// src/integrations/acp/claude-settings.ts
|
|
10348
10367
|
var levels = ["low", "medium", "high", "xhigh", "max"];
|
|
10349
10368
|
async function claudeOptions(command, cwd, supplied, includeSkills = true) {
|
|
10350
10369
|
const normalized = supplied?.trim().toLowerCase().replace(/[^a-z0-9]+/g, "");
|
|
@@ -10476,7 +10495,7 @@ var dshAcpHarness = {
|
|
|
10476
10495
|
const patch = join5(context.directory, "acp-dsh-patch.json");
|
|
10477
10496
|
await writeFile(
|
|
10478
10497
|
patch,
|
|
10479
|
-
JSON.stringify([{ insert: [{ id: "pbot-acp-member", name: join5(context.packageRoot, "lib/extension/dsh/acp-
|
|
10498
|
+
JSON.stringify([{ insert: [{ id: "pbot-acp-member", name: join5(context.packageRoot, "lib/extension/hosts/dsh/acp-entry.js") }] }]) + "\n",
|
|
10480
10499
|
{ mode: 384 }
|
|
10481
10500
|
);
|
|
10482
10501
|
return {
|
|
@@ -10575,6 +10594,14 @@ var standardAcpPresets = [
|
|
|
10575
10594
|
configureHint: "\u8FD0\u884C agy \u5B8C\u6210\u767B\u5F55\u4E0E\u9ED8\u8BA4\u6A21\u578B\u914D\u7F6E\u3002",
|
|
10576
10595
|
nativeWorkspaceSkills: true
|
|
10577
10596
|
}),
|
|
10597
|
+
createGenericAcpHarness("qoder", {
|
|
10598
|
+
label: "Qoder CLI",
|
|
10599
|
+
aliases: ["qodercli", "qoder-cli"],
|
|
10600
|
+
nativeWorkspaceSkills: true,
|
|
10601
|
+
defaultCommand: { command: "qodercli", args: ["--acp"] },
|
|
10602
|
+
installHint: "\u5B89\u88C5 Qoder CLI\uFF08qodercli\uFF09",
|
|
10603
|
+
configureHint: "\u8FD0\u884C qodercli login \u5B8C\u6210\u767B\u5F55\u3002"
|
|
10604
|
+
}),
|
|
10578
10605
|
createGenericAcpHarness("codex", {
|
|
10579
10606
|
label: "OpenAI Codex",
|
|
10580
10607
|
aliases: ["openai-codex", "codex-cli"],
|
|
@@ -10866,10 +10893,14 @@ async function openAcp(reference, cwd, env, callbacks, signal, openOptions = {})
|
|
|
10866
10893
|
systemPrompt: { mode: "append", content: [{ type: "text", text: openOptions.systemPrompt }] }
|
|
10867
10894
|
} : {}
|
|
10868
10895
|
};
|
|
10896
|
+
let startupInfo;
|
|
10869
10897
|
if (reference.sessionId === null) {
|
|
10870
10898
|
const created = await connection.agent.request(methods.agent.session.new, setup, { cancellationSignal: AbortSignal.any([cancel, AbortSignal.timeout(3e4)]), stopWaitingOnCancel: true });
|
|
10871
10899
|
sessionId = created.sessionId;
|
|
10872
10900
|
options = created.configOptions ?? [];
|
|
10901
|
+
if (object(created._meta) && object(created._meta.piAcp) && typeof created._meta.piAcp.startupInfo === "string") {
|
|
10902
|
+
startupInfo = created._meta.piAcp.startupInfo;
|
|
10903
|
+
}
|
|
10873
10904
|
} else {
|
|
10874
10905
|
requireThat(capabilities.resume || capabilities.load, "\u76EE\u6807 ACP \u540E\u7AEF\u4E0D\u652F\u6301\u6062\u590D\u5DF2\u6709\u4F1A\u8BDD\uFF0C\u8BF7\u65B0\u5EFA worker\u3002");
|
|
10875
10906
|
const restored = capabilities.resume ? await connection.agent.request(methods.agent.session.resume, { ...setup, sessionId: reference.sessionId }, { cancellationSignal: AbortSignal.any([cancel, AbortSignal.timeout(3e4)]), stopWaitingOnCancel: true }) : await connection.agent.request(methods.agent.session.load, { ...setup, sessionId: reference.sessionId }, { cancellationSignal: AbortSignal.any([cancel, AbortSignal.timeout(3e4)]), stopWaitingOnCancel: true });
|
|
@@ -10885,6 +10916,7 @@ async function openAcp(reference, cwd, env, callbacks, signal, openOptions = {})
|
|
|
10885
10916
|
close,
|
|
10886
10917
|
images: advertised?.promptCapabilities?.image === true,
|
|
10887
10918
|
systemPrompt: Boolean(advertised?.sessionCapabilities?.systemPrompt),
|
|
10919
|
+
...startupInfo ? { startupInfo } : {},
|
|
10888
10920
|
selection,
|
|
10889
10921
|
choices: () => acpChoices(options),
|
|
10890
10922
|
async configure(requested) {
|
|
@@ -10992,7 +11024,7 @@ async function agentText(agent, root, coordinatorPrompt = "plugin-coordinator.md
|
|
|
10992
11024
|
function formatWorkspaceSkills(skills) {
|
|
10993
11025
|
if (!skills.length) return "";
|
|
10994
11026
|
const lines = skills.map((skill) => `- **${skill.name}**\uFF08\`${skill.path}\`\uFF09\uFF1A${skill.description}`);
|
|
10995
|
-
return "## \u5DE5\u4F5C\u533A\u6280\u80FD\n\n\
|
|
11027
|
+
return "## \u5DE5\u4F5C\u533A\u6280\u80FD\n\n\u5339\u914D\u4EFB\u52A1\u65F6\u6309\u9700\u8BFB\u53D6\u5BF9\u5E94 `SKILL.md` \u6B63\u6587\uFF1A\n" + lines.join("\n");
|
|
10996
11028
|
}
|
|
10997
11029
|
async function loadWorkspaceContext(options) {
|
|
10998
11030
|
const {
|
|
@@ -11003,7 +11035,8 @@ async function loadWorkspaceContext(options) {
|
|
|
11003
11035
|
includePrompts = true,
|
|
11004
11036
|
includeRootAgents = false,
|
|
11005
11037
|
localRoleOnly = false,
|
|
11006
|
-
workspaceSkills = []
|
|
11038
|
+
workspaceSkills = [],
|
|
11039
|
+
notices = []
|
|
11007
11040
|
} = options;
|
|
11008
11041
|
const [workspace, roleText, rootAgents] = includePrompts ? await Promise.all([
|
|
11009
11042
|
readFile(join7(resourceRoot, "prompts/workspace.md"), "utf8"),
|
|
@@ -11011,12 +11044,14 @@ async function loadWorkspaceContext(options) {
|
|
|
11011
11044
|
includeRootAgents ? readOptionalFile(join7(root, "AGENTS.md")) : Promise.resolve("")
|
|
11012
11045
|
]) : ["", "", ""];
|
|
11013
11046
|
const skillsSection = formatWorkspaceSkills(workspaceSkills);
|
|
11047
|
+
const noticesSection = notices.length ? "## \u542F\u52A8\u63D0\u793A\n\n" + notices.map((item) => `- ${item}`).join("\n") : "";
|
|
11014
11048
|
const environment = { host, workspaceRoot: root, resourceRoot };
|
|
11015
11049
|
const text3 = [
|
|
11016
11050
|
workspace,
|
|
11017
11051
|
roleText,
|
|
11018
11052
|
rootAgents,
|
|
11019
11053
|
skillsSection,
|
|
11054
|
+
noticesSection,
|
|
11020
11055
|
"## \u73AF\u5883\n\n" + JSON.stringify(environment)
|
|
11021
11056
|
].filter(Boolean).join("\n\n");
|
|
11022
11057
|
return { workspace, role: roleText, rootAgents, workspaceSkills: [...workspaceSkills], environment, text: text3 };
|
|
@@ -11025,14 +11060,25 @@ async function loadWorkspaceContext(options) {
|
|
|
11025
11060
|
// src/services/workspace/workspace-config.ts
|
|
11026
11061
|
import { mkdir, readFile as readFile2 } from "node:fs/promises";
|
|
11027
11062
|
import { dirname as dirname2, join as join8 } from "node:path";
|
|
11028
|
-
|
|
11063
|
+
|
|
11064
|
+
// src/model/workspace-config.ts
|
|
11065
|
+
var summaryConcurrency = { default: 3, max: 8 };
|
|
11066
|
+
var historyLayouts = ["monthly", "flat"];
|
|
11067
|
+
|
|
11068
|
+
// src/services/workspace/workspace-config.ts
|
|
11069
|
+
var featureKeys = ["prompts", "skills", "mcp", "history"];
|
|
11070
|
+
var summaryKeys = ["backend", "model", "thinking", "concurrency"];
|
|
11071
|
+
var historyKeys = ["layout"];
|
|
11072
|
+
function nonEmptyString(value) {
|
|
11073
|
+
return typeof value === "string" && value.trim().length > 0 && !value.includes("\0");
|
|
11074
|
+
}
|
|
11029
11075
|
function config2(value) {
|
|
11030
11076
|
if (!object(value) || value.enabled !== void 0 && typeof value.enabled !== "boolean") {
|
|
11031
11077
|
throw new Error("\u914D\u7F6E\u5FC5\u987B\u662F JSON \u5BF9\u8C61\uFF0Cenabled \u5FC5\u987B\u662F\u5E03\u5C14\u503C\u3002");
|
|
11032
11078
|
}
|
|
11033
11079
|
if (value.features !== void 0) {
|
|
11034
11080
|
if (!object(value.features) || Object.entries(value.features).some(([key, entry]) => !featureKeys.includes(key) || entry !== void 0 && typeof entry !== "boolean")) {
|
|
11035
|
-
throw new Error("features \u5FC5\u987B\u662F JSON \u5BF9\u8C61\uFF0C\u4EC5\u652F\u6301 prompts\u3001skills\u3001mcp \u5E03\u5C14\u5F00\u5173\u3002");
|
|
11081
|
+
throw new Error("features \u5FC5\u987B\u662F JSON \u5BF9\u8C61\uFF0C\u4EC5\u652F\u6301 prompts\u3001skills\u3001mcp\u3001history \u5E03\u5C14\u5F00\u5173\u3002");
|
|
11036
11082
|
}
|
|
11037
11083
|
}
|
|
11038
11084
|
if (value.acp !== void 0) {
|
|
@@ -11041,11 +11087,36 @@ function config2(value) {
|
|
|
11041
11087
|
}
|
|
11042
11088
|
for (const command of Object.values(value.acp)) {
|
|
11043
11089
|
const launch2 = !object(command) ? false : command.command === void 0 ? command.args === void 0 : typeof command.command === "string" && command.command.trim() && !command.command.includes("\0") && (command.args === void 0 || Array.isArray(command.args) && command.args.every((arg) => typeof arg === "string" && !arg.includes("\0")));
|
|
11044
|
-
if (!object(command) || !launch2 || command.env !== void 0 && (!object(command.env) || Object.entries(command.env).some(([k, v]) => !k || k.includes("\0") || typeof v !== "string" || v.includes("\0"))) || command.permission !== void 0 && !
|
|
11090
|
+
if (!object(command) || !launch2 || command.env !== void 0 && (!object(command.env) || Object.entries(command.env).some(([k, v]) => !k || k.includes("\0") || typeof v !== "string" || v.includes("\0"))) || command.permission !== void 0 && !isOneOf(command.permission, acpPermissionPolicies) || Object.keys(command).some((key) => !["command", "args", "env", "permission"].includes(key))) {
|
|
11045
11091
|
throw new Error("ACP \u914D\u7F6E\u9700\u8981 command\uFF08\u5185\u7F6E\u76EE\u6807\u53EF\u7701\u7565\uFF09\u53CA\u53EF\u9009 args \u5B57\u7B26\u4E32\u6570\u7EC4\u3001env \u5B57\u7B26\u4E32\u6620\u5C04\u3001permission\uFF08ask\u3001allow \u6216 deny\uFF09\u3002");
|
|
11046
11092
|
}
|
|
11047
11093
|
}
|
|
11048
11094
|
}
|
|
11095
|
+
if (value.summary !== void 0) {
|
|
11096
|
+
if (!object(value.summary) || Object.keys(value.summary).some((key) => !summaryKeys.includes(key))) {
|
|
11097
|
+
throw new Error("summary \u5FC5\u987B\u662F JSON \u5BF9\u8C61\uFF0C\u4EC5\u652F\u6301 backend\u3001model\u3001thinking\u3001concurrency\u3002");
|
|
11098
|
+
}
|
|
11099
|
+
if (value.summary.backend !== void 0 && !isAcpBackend(value.summary.backend)) {
|
|
11100
|
+
throw new Error("summary.backend \u5FC5\u987B\u4E3A\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u548C\u8FDE\u5B57\u7B26\uFF081\u201364 \u5B57\u7B26\uFF09\u3002");
|
|
11101
|
+
}
|
|
11102
|
+
if (value.summary.model !== void 0 && !nonEmptyString(value.summary.model)) {
|
|
11103
|
+
throw new Error("summary.model \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32\u3002");
|
|
11104
|
+
}
|
|
11105
|
+
if (value.summary.thinking !== void 0 && !nonEmptyString(value.summary.thinking)) {
|
|
11106
|
+
throw new Error("summary.thinking \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32\u3002");
|
|
11107
|
+
}
|
|
11108
|
+
if (value.summary.concurrency !== void 0 && (typeof value.summary.concurrency !== "number" || !Number.isInteger(value.summary.concurrency) || value.summary.concurrency < 1 || value.summary.concurrency > summaryConcurrency.max)) {
|
|
11109
|
+
throw new Error(`summary.concurrency \u5FC5\u987B\u662F 1 \u5230 ${summaryConcurrency.max} \u4E4B\u95F4\u7684\u6574\u6570\u3002`);
|
|
11110
|
+
}
|
|
11111
|
+
}
|
|
11112
|
+
if (value.history !== void 0) {
|
|
11113
|
+
if (!object(value.history) || Object.keys(value.history).some((key) => !historyKeys.includes(key))) {
|
|
11114
|
+
throw new Error("history \u5FC5\u987B\u662F JSON \u5BF9\u8C61\uFF0C\u4EC5\u652F\u6301 layout\u3002");
|
|
11115
|
+
}
|
|
11116
|
+
if (value.history.layout !== void 0 && !isOneOf(value.history.layout, historyLayouts)) {
|
|
11117
|
+
throw new Error('history.layout \u5FC5\u987B\u662F "monthly" \u6216 "flat"\u3002');
|
|
11118
|
+
}
|
|
11119
|
+
}
|
|
11049
11120
|
return value;
|
|
11050
11121
|
}
|
|
11051
11122
|
function workspaceFeatures(configuration) {
|
|
@@ -11053,7 +11124,8 @@ function workspaceFeatures(configuration) {
|
|
|
11053
11124
|
return {
|
|
11054
11125
|
prompts: raw?.prompts !== false,
|
|
11055
11126
|
skills: raw?.skills !== false,
|
|
11056
|
-
mcp: raw?.mcp !== false
|
|
11127
|
+
mcp: raw?.mcp !== false,
|
|
11128
|
+
history: raw?.history !== false
|
|
11057
11129
|
};
|
|
11058
11130
|
}
|
|
11059
11131
|
function workspaceConfigPath(root) {
|
|
@@ -11076,7 +11148,9 @@ async function readWorkspaceConfig(root) {
|
|
|
11076
11148
|
present: true,
|
|
11077
11149
|
enabled: settings.enabled === true,
|
|
11078
11150
|
...settings.features ? { features: settings.features } : {},
|
|
11079
|
-
...settings.acp ? { acp: settings.acp } : {}
|
|
11151
|
+
...settings.acp ? { acp: settings.acp } : {},
|
|
11152
|
+
...settings.summary ? { summary: settings.summary } : {},
|
|
11153
|
+
...settings.history ? { history: settings.history } : {}
|
|
11080
11154
|
};
|
|
11081
11155
|
} catch (error2) {
|
|
11082
11156
|
return { path, present: true, enabled: false, error: `\u5DE5\u4F5C\u533A\u914D\u7F6E\u65E0\u6548 ${path}: ${String(error2)}` };
|
|
@@ -11097,15 +11171,13 @@ function isWorkspaceMcpHttpServer(server) {
|
|
|
11097
11171
|
}
|
|
11098
11172
|
function validateStringRecord(value, label) {
|
|
11099
11173
|
requireThat(object(value), `${label} \u5FC5\u987B\u662F\u5B57\u7B26\u4E32\u6620\u5C04\u3002`);
|
|
11100
|
-
|
|
11101
|
-
for (const [key, entry] of Object.entries(value)) {
|
|
11174
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => {
|
|
11102
11175
|
requireThat(
|
|
11103
11176
|
key.length > 0 && !key.includes("\0") && typeof entry === "string" && !entry.includes("\0"),
|
|
11104
11177
|
`${label}.${key} \u5FC5\u987B\u662F\u975E\u7A7A\u952E\u4E0E\u65E0\u7A7A\u5B57\u8282\u5B57\u7B26\u4E32\u503C\u3002`
|
|
11105
11178
|
);
|
|
11106
|
-
|
|
11107
|
-
}
|
|
11108
|
-
return result;
|
|
11179
|
+
return [key, entry];
|
|
11180
|
+
}));
|
|
11109
11181
|
}
|
|
11110
11182
|
function validateWorkspaceMcpServer(name, value) {
|
|
11111
11183
|
requireThat(serverNamePattern.test(name), `MCP \u670D\u52A1\u540D\u65E0\u6548\uFF1A${name}\uFF08\u9700\u5339\u914D [A-Za-z0-9][A-Za-z0-9_-]{0,31}\uFF09\u3002`);
|
|
@@ -11194,7 +11266,7 @@ function validateMcpFile(value) {
|
|
|
11194
11266
|
for (const [name, entry] of Object.entries(rawServers)) {
|
|
11195
11267
|
servers[name] = validateWorkspaceMcpServer(name, entry);
|
|
11196
11268
|
}
|
|
11197
|
-
return { mcpServers: servers };
|
|
11269
|
+
return { ...value, mcpServers: servers };
|
|
11198
11270
|
}
|
|
11199
11271
|
function workspaceMcpPath(root) {
|
|
11200
11272
|
return join9(root, ".pbot", "mcp.json");
|
|
@@ -11222,37 +11294,32 @@ function expandEnvTemplate(value, env, context) {
|
|
|
11222
11294
|
return resolved;
|
|
11223
11295
|
});
|
|
11224
11296
|
}
|
|
11297
|
+
function expandEnvRecord(values2, env, context) {
|
|
11298
|
+
return Object.fromEntries(Object.entries(values2 ?? {}).map(([key, value]) => [key, expandEnvTemplate(value, env, `${context}.${key}`)]));
|
|
11299
|
+
}
|
|
11225
11300
|
function resolveWorkspaceMcpServer(root, name, server, env = process.env) {
|
|
11226
11301
|
const timeout = server.timeout ?? defaultTimeoutSeconds;
|
|
11227
11302
|
if (isWorkspaceMcpHttpServer(server)) {
|
|
11228
11303
|
const url2 = expandEnvTemplate(server.url, env, `MCP \u670D\u52A1 "${name}" \u7684 url`);
|
|
11229
11304
|
requireThat(/^https?:\/\/.+/.test(url2), `MCP \u670D\u52A1 "${name}" \u5C55\u5F00\u540E\u7684 url \u5FC5\u987B\u4EE5 http:// \u6216 https:// \u5F00\u5934\u3002`);
|
|
11230
|
-
const headers = {};
|
|
11231
|
-
for (const [key, value] of Object.entries(server.headers ?? {})) {
|
|
11232
|
-
headers[key] = expandEnvTemplate(value, env, `MCP \u670D\u52A1 "${name}" \u7684 headers.${key}`);
|
|
11233
|
-
}
|
|
11234
11305
|
return {
|
|
11235
11306
|
transport: "http",
|
|
11236
11307
|
name,
|
|
11237
11308
|
url: url2,
|
|
11238
|
-
headers,
|
|
11309
|
+
headers: expandEnvRecord(server.headers, env, `MCP \u670D\u52A1 "${name}" \u7684 headers`),
|
|
11239
11310
|
...server.description ? { description: server.description } : {},
|
|
11240
11311
|
timeout
|
|
11241
11312
|
};
|
|
11242
11313
|
}
|
|
11243
11314
|
const command = expandEnvTemplate(server.command, env, `MCP \u670D\u52A1 "${name}" \u7684 command`);
|
|
11244
11315
|
const args2 = (server.args ?? []).map((arg, index) => expandEnvTemplate(arg, env, `MCP \u670D\u52A1 "${name}" \u7684 args[${index}]`));
|
|
11245
|
-
const resolvedEnv = {};
|
|
11246
|
-
for (const [key, value] of Object.entries(server.env ?? {})) {
|
|
11247
|
-
resolvedEnv[key] = expandEnvTemplate(value, env, `MCP \u670D\u52A1 "${name}" \u7684 env.${key}`);
|
|
11248
|
-
}
|
|
11249
11316
|
const cwd = server.cwd ? resolve4(root, expandEnvTemplate(server.cwd, env, `MCP \u670D\u52A1 "${name}" \u7684 cwd`)) : root;
|
|
11250
11317
|
return {
|
|
11251
11318
|
transport: "stdio",
|
|
11252
11319
|
name,
|
|
11253
11320
|
command,
|
|
11254
11321
|
args: args2,
|
|
11255
|
-
env:
|
|
11322
|
+
env: expandEnvRecord(server.env, env, `MCP \u670D\u52A1 "${name}" \u7684 env`),
|
|
11256
11323
|
cwd,
|
|
11257
11324
|
...server.description ? { description: server.description } : {},
|
|
11258
11325
|
timeout
|
|
@@ -11318,7 +11385,9 @@ function parseSkillFrontmatter(content) {
|
|
|
11318
11385
|
};
|
|
11319
11386
|
}
|
|
11320
11387
|
async function discoverWorkspaceSkills(root) {
|
|
11321
|
-
|
|
11388
|
+
return discoverSkills(join10(root, ".agents", "skills"), ".agents/skills");
|
|
11389
|
+
}
|
|
11390
|
+
async function discoverSkills(skillsDir, indexPath) {
|
|
11322
11391
|
let entries;
|
|
11323
11392
|
try {
|
|
11324
11393
|
entries = await readdir(skillsDir, { withFileTypes: true });
|
|
@@ -11341,14 +11410,14 @@ async function discoverWorkspaceSkills(root) {
|
|
|
11341
11410
|
results.push({
|
|
11342
11411
|
name: meta2.name,
|
|
11343
11412
|
description: meta2.description,
|
|
11344
|
-
path:
|
|
11413
|
+
path: join10(indexPath, entry.name, "SKILL.md")
|
|
11345
11414
|
});
|
|
11346
11415
|
}
|
|
11347
11416
|
results.sort((a, b) => a.name.localeCompare(b.name));
|
|
11348
11417
|
return results;
|
|
11349
11418
|
}
|
|
11350
11419
|
|
|
11351
|
-
// src/extension/acp
|
|
11420
|
+
// src/extension/acp/worker.ts
|
|
11352
11421
|
var errorMessage = (error2) => error2 instanceof Error ? error2.message : String(error2);
|
|
11353
11422
|
function sendIpc(message2) {
|
|
11354
11423
|
return new Promise((resolveSend) => {
|
|
@@ -11592,6 +11661,108 @@ async function runWorker(args2) {
|
|
|
11592
11661
|
if (process.connected) process.disconnect();
|
|
11593
11662
|
}
|
|
11594
11663
|
}
|
|
11664
|
+
async function runOneShotPrompt() {
|
|
11665
|
+
const lifetime = new AbortController();
|
|
11666
|
+
const stop = () => lifetime.abort(new Error("ACP \u6458\u8981\u4EFB\u52A1\u5DF2\u53D6\u6D88\u3002"));
|
|
11667
|
+
process.on("SIGTERM", stop);
|
|
11668
|
+
process.on("SIGINT", stop);
|
|
11669
|
+
try {
|
|
11670
|
+
const payload = await new Promise((resolvePayload, rejectPayload) => {
|
|
11671
|
+
const timer = setTimeout(() => rejectPayload(new Error("\u7F3A\u5C11 ACP \u6458\u8981\u4EFB\u52A1\u53C2\u6570\u3002")), 5e3);
|
|
11672
|
+
process.once("message", (value) => {
|
|
11673
|
+
clearTimeout(timer);
|
|
11674
|
+
if (!object(value)) {
|
|
11675
|
+
rejectPayload(new Error("ACP \u6458\u8981\u4EFB\u52A1\u53C2\u6570\u5FC5\u987B\u662F\u5BF9\u8C61\u3002"));
|
|
11676
|
+
return;
|
|
11677
|
+
}
|
|
11678
|
+
resolvePayload(value);
|
|
11679
|
+
});
|
|
11680
|
+
process.once("disconnect", () => {
|
|
11681
|
+
clearTimeout(timer);
|
|
11682
|
+
rejectPayload(new Error("ACP \u6458\u8981\u4EFB\u52A1\u901A\u9053\u5DF2\u65AD\u5F00\u3002"));
|
|
11683
|
+
});
|
|
11684
|
+
});
|
|
11685
|
+
const reference = acpReference(payload.reference);
|
|
11686
|
+
requireThat(typeof payload.cwd === "string" && payload.cwd.length > 0, "\u7F3A\u5C11 ACP \u6458\u8981\u5DE5\u4F5C\u76EE\u5F55\u3002");
|
|
11687
|
+
requireThat(typeof payload.prompt === "string" && payload.prompt.trim().length > 0, "\u7F3A\u5C11 ACP \u6458\u8981\u8F93\u5165\u5185\u5BB9\u3002");
|
|
11688
|
+
const harness = resolveAcpHarness(reference.backend);
|
|
11689
|
+
const packageRoot = resolve5(resourceRoot, "..");
|
|
11690
|
+
const env = {
|
|
11691
|
+
...process.env,
|
|
11692
|
+
...reference.env ?? {},
|
|
11693
|
+
PBOT_SUBAGENT_RUN_ID: "pbot-summary-" + randomUUID5(),
|
|
11694
|
+
...reference.backend === "pi" ? {
|
|
11695
|
+
PBOT_SUMMARY_WORKER: "1",
|
|
11696
|
+
PI_OFFLINE: "1",
|
|
11697
|
+
PBOT_ACP_PI_COMMAND: process.env.PI_ACP_PI_COMMAND ?? acpExecutable("pi", "pi"),
|
|
11698
|
+
PI_ACP_PI_COMMAND: join11(packageRoot, "bin/pbot-pi-acp.mjs")
|
|
11699
|
+
} : {}
|
|
11700
|
+
};
|
|
11701
|
+
let collecting = false;
|
|
11702
|
+
let text3 = "";
|
|
11703
|
+
const connection = await openAcp(
|
|
11704
|
+
reference,
|
|
11705
|
+
payload.cwd,
|
|
11706
|
+
env,
|
|
11707
|
+
{
|
|
11708
|
+
update(update) {
|
|
11709
|
+
if (collecting && update.sessionUpdate === "agent_message_chunk" && update.content.type === "text") {
|
|
11710
|
+
text3 += update.content.text;
|
|
11711
|
+
}
|
|
11712
|
+
},
|
|
11713
|
+
async permission() {
|
|
11714
|
+
return { outcome: { outcome: "cancelled" } };
|
|
11715
|
+
}
|
|
11716
|
+
},
|
|
11717
|
+
lifetime.signal,
|
|
11718
|
+
{
|
|
11719
|
+
harness,
|
|
11720
|
+
...payload.system ? { systemPrompt: payload.system } : {}
|
|
11721
|
+
}
|
|
11722
|
+
);
|
|
11723
|
+
try {
|
|
11724
|
+
if (payload.model || payload.thinking) {
|
|
11725
|
+
const parsedModel = payload.model ? harness.parseModelValue ? harness.parseModelValue(payload.model) : { model: payload.model } : void 0;
|
|
11726
|
+
await connection.configure({
|
|
11727
|
+
...parsedModel?.provider ? { provider: parsedModel.provider } : {},
|
|
11728
|
+
...parsedModel?.model ? { model: parsedModel.model } : {},
|
|
11729
|
+
...payload.thinking ? { thinking: payload.thinking } : {}
|
|
11730
|
+
});
|
|
11731
|
+
}
|
|
11732
|
+
const promptText = !connection.systemPrompt && payload.system ? `${payload.system}
|
|
11733
|
+
|
|
11734
|
+
---
|
|
11735
|
+
|
|
11736
|
+
${payload.prompt}` : payload.prompt;
|
|
11737
|
+
collecting = true;
|
|
11738
|
+
await connection.prompt([{ type: "text", text: promptText }]);
|
|
11739
|
+
let cleaned = text3;
|
|
11740
|
+
if (connection.startupInfo) {
|
|
11741
|
+
if (cleaned.startsWith(connection.startupInfo)) {
|
|
11742
|
+
cleaned = cleaned.slice(connection.startupInfo.length);
|
|
11743
|
+
} else {
|
|
11744
|
+
const trimmedInfo = connection.startupInfo.trim();
|
|
11745
|
+
const trimmedText = cleaned.trimStart();
|
|
11746
|
+
if (trimmedInfo && trimmedText.startsWith(trimmedInfo)) {
|
|
11747
|
+
cleaned = trimmedText.slice(trimmedInfo.length);
|
|
11748
|
+
}
|
|
11749
|
+
}
|
|
11750
|
+
}
|
|
11751
|
+
const answer = cleaned.trim();
|
|
11752
|
+
requireThat(answer.length > 0, "ACP \u6458\u8981\u8FD4\u56DE\u4E3A\u7A7A\u3002");
|
|
11753
|
+
await sendIpc({ type: "answer", text: answer });
|
|
11754
|
+
} finally {
|
|
11755
|
+
await connection.close();
|
|
11756
|
+
}
|
|
11757
|
+
} catch (error2) {
|
|
11758
|
+
await sendIpc({ type: "error", error: errorMessage(error2) });
|
|
11759
|
+
process.exitCode = 1;
|
|
11760
|
+
} finally {
|
|
11761
|
+
lifetime.abort();
|
|
11762
|
+
if (process.connected) process.disconnect();
|
|
11763
|
+
}
|
|
11764
|
+
}
|
|
11595
11765
|
var args = process.argv.slice(2);
|
|
11596
11766
|
if (args.includes("--probe")) await runProbe();
|
|
11767
|
+
else if (args.includes("--prompt")) await runOneShotPrompt();
|
|
11597
11768
|
else await runWorker(args);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const name: string, inject: string[], apply: typeof import("./acp-member.js").apply;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
2
|
+
import { registerHooks } from "node:module";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
|
+
// Keep normal dsh profile resolution. A standalone plugin cache has no SDK
|
|
5
|
+
// peers of its own, so resolve missing peers from the running dsh installation.
|
|
6
|
+
const memberLib = new URL("../../../", import.meta.url).href;
|
|
7
|
+
const peers = registerHooks({
|
|
8
|
+
resolve(specifier, context, nextResolve) {
|
|
9
|
+
if (specifier.startsWith("@deepseek-ai/") && context.parentURL?.startsWith(memberLib)) {
|
|
10
|
+
try {
|
|
11
|
+
return nextResolve(specifier, context);
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
if (error.code !== "ERR_MODULE_NOT_FOUND" || !process.argv[1])
|
|
15
|
+
throw error;
|
|
16
|
+
return nextResolve(specifier, { ...context, parentURL: pathToFileURL(realpathSync(process.argv[1])).href });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return nextResolve(specifier, context);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
export const { name, inject, apply } = await import("./acp-member.js").finally(() => peers.deregister());
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as McpClient from "@deepseek-ai/dsh-mcp-client";
|
|
2
|
-
import { acpMember } from "
|
|
3
|
-
import { rootAgents } from "
|
|
4
|
-
import { dshResources, dshExpertTools } from "
|
|
5
|
-
import { registerDshSkills } from "
|
|
6
|
-
import { toDshMcpConfig } from "
|
|
7
|
-
import { finalDshAnswer } from "
|
|
8
|
-
import {
|
|
2
|
+
import { acpMember } from "../../acp/member.js";
|
|
3
|
+
import { rootAgents } from "../../../integrations/hosts/dsh/root-agents.js";
|
|
4
|
+
import { dshResources, dshExpertTools } from "../../../integrations/hosts/dsh/resources.js";
|
|
5
|
+
import { registerDshSkills } from "../../../integrations/hosts/dsh/skills.js";
|
|
6
|
+
import { toDshMcpConfig } from "../../../integrations/hosts/dsh/mcp.js";
|
|
7
|
+
import { finalDshAnswer } from "../../../integrations/hosts/dsh/messages.js";
|
|
8
|
+
import { loadNativeWorkspaceServers } from "../workspace-mcp.js";
|
|
9
9
|
import { registerDshFileEvents } from "./files.js";
|
|
10
|
-
import { requireThat } from "
|
|
10
|
+
import { requireThat } from "../../../common/validation.js";
|
|
11
11
|
export const name = "pbot-acp-member";
|
|
12
12
|
export const inject = ["agents", "sessions", "llm", "tools", "systemPrompt", "skills", "fs", "workingDirectory", "approval"];
|
|
13
13
|
export async function apply(ctx) {
|
|
@@ -30,23 +30,9 @@ export async function apply(ctx) {
|
|
|
30
30
|
if (member.features.skills)
|
|
31
31
|
registerDshSkills(scope, agent, { workspaceRoot: member.d.workspace });
|
|
32
32
|
if (member.features.mcp && process.env.PBOT_ACP_VALIDATE !== "1") {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
for (const [serverName, server] of Object.entries(mcpConfig.servers)) {
|
|
39
|
-
if (server.enabled === false)
|
|
40
|
-
continue;
|
|
41
|
-
try {
|
|
42
|
-
const resolved = resolveWorkspaceMcpServer(member.d.workspace, serverName, server);
|
|
43
|
-
await scope.plugin(McpClient, toDshMcpConfig(resolved));
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
ctx.logger.warn(error instanceof Error ? error.message : String(error));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
33
|
+
await loadNativeWorkspaceServers(member.d.workspace, async (server) => {
|
|
34
|
+
await scope.plugin(McpClient, toDshMcpConfig(server));
|
|
35
|
+
}, { warn: message => ctx.logger.warn(message) });
|
|
50
36
|
}
|
|
51
37
|
dshExpertTools(scope, agent, member.d.options);
|
|
52
38
|
if (member.features.prompts)
|