personal-bot 0.3.2 → 0.3.4
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 +1 -1
- package/bin/pbot.mjs +22 -2
- package/docs/README.md +2 -0
- package/docs/architecture/design.md +16 -16
- package/docs/architecture/extensibility.md +29 -2
- package/docs/architecture/model-context.md +3 -2
- package/docs/architecture/principles.md +2 -2
- package/docs/guides/capabilities.md +1 -1
- package/docs/guides/cross-harness-workers.md +3 -1
- package/docs/guides/history.md +30 -7
- package/docs/guides/workspace-configuration.md +20 -3
- package/docs/hosts/antigravity.md +1 -1
- package/docs/hosts/claude-code.md +1 -1
- package/docs/hosts/codex-qoder.md +63 -0
- package/docs/maintainers/architecture-governance.md +78 -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/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/antigravity-plugin/lib/extension/acp/member.d.ts +18 -0
- package/lib/antigravity-plugin/lib/extension/acp/member.js +44 -0
- package/lib/antigravity-plugin/lib/extension/acp-worker.js +71 -45
- 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/antigravity-plugin/lib/extension/hosts/dsh/acp-member.d.ts +4 -0
- package/lib/antigravity-plugin/lib/extension/hosts/dsh/acp-member.js +58 -0
- package/lib/antigravity-plugin/lib/extension/hosts/dsh/files.d.ts +5 -0
- package/lib/antigravity-plugin/lib/extension/hosts/dsh/files.js +67 -0
- 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 +3 -1
- package/lib/antigravity-plugin/lib/extension/hosts/plugin-runtime.js +37 -22
- 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 +2577 -2255
- package/lib/antigravity-plugin/lib/extension/workspace-cli.js +20171 -0
- package/lib/antigravity-plugin/lib/integrations/agent-resources.js +1 -1
- package/lib/antigravity-plugin/lib/integrations/hosts/claude/adapter.js +7 -59
- 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/antigravity-plugin/lib/integrations/hosts/dsh/mcp.d.ts +4 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/mcp.js +28 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/messages.d.ts +36 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/messages.js +11 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/resources.d.ts +6 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/resources.js +47 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/root-agents.d.ts +4 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/root-agents.js +3 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/skills.d.ts +8 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/skills.js +31 -0
- 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/plugin-registry.d.ts +1 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/plugin-registry.js +8 -1
- 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 +10 -0
- package/lib/antigravity-plugin/lib/model/history.js +4 -1
- package/lib/antigravity-plugin/lib/model/plugin-host.d.ts +5 -0
- package/lib/antigravity-plugin/lib/model/workspace-config.d.ts +8 -12
- 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 +2 -2
- package/lib/antigravity-plugin/lib/services/history/history-capture.js +34 -22
- package/lib/antigravity-plugin/lib/services/history/summary-registry.js +2 -3
- package/lib/antigravity-plugin/lib/services/history/summary-runner.d.ts +2 -5
- package/lib/antigravity-plugin/lib/services/history/summary-runner.js +72 -74
- 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 +15 -0
- package/lib/antigravity-plugin/lib/services/workspace/plugin-releases.js +126 -0
- package/lib/antigravity-plugin/lib/services/workspace/workspace-config.js +9 -8
- 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/history-files.d.ts +2 -1
- package/lib/antigravity-plugin/lib/storage/history-files.js +21 -15
- package/lib/antigravity-plugin/lib/storage/history-format.d.ts +2 -3
- package/lib/antigravity-plugin/lib/storage/history-format.js +5 -7
- 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/client.js +22 -50
- 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 +2 -2
- package/lib/extension/acp/member.d.ts +1 -1
- package/lib/extension/acp-worker.js +71 -45
- 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.js +4 -18
- package/lib/extension/hosts/dsh/command.d.ts +1 -2
- package/lib/extension/hosts/dsh/command.js +5 -49
- package/lib/extension/hosts/dsh/workspace.js +13 -44
- 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 +3 -1
- package/lib/extension/hosts/plugin-runtime.js +37 -22
- 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 +6 -8
- package/lib/extension/mcp/bridge.js +66 -84
- package/lib/extension/mcp/tool-contract.d.ts +735 -0
- package/lib/extension/mcp/tool-contract.js +441 -0
- package/lib/extension/mcp/workers.d.ts +29 -742
- package/lib/extension/mcp/workers.js +75 -525
- package/lib/extension/mcp.js +2577 -2255
- package/lib/extension/setup/cli.js +15 -0
- package/lib/extension/setup/upgrade.js +153 -0
- package/lib/extension/workspace-cli.js +20171 -0
- package/lib/integrations/acp/agents.d.ts +2 -3
- package/lib/integrations/acp/harnesses/dsh.js +1 -1
- package/lib/integrations/acp/harnesses/presets.js +8 -0
- package/lib/integrations/acp/history-summary.js +2 -1
- package/lib/integrations/acp/launch.d.ts +2 -2
- package/lib/integrations/agent-resources.js +1 -1
- package/lib/integrations/hosts/claude/adapter.js +7 -59
- package/lib/integrations/hosts/codex/adapter.d.ts +2 -0
- package/lib/integrations/hosts/codex/adapter.js +14 -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/plugin-registry.d.ts +1 -0
- package/lib/integrations/hosts/plugin-registry.js +8 -1
- 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/cli-update.js +146 -0
- package/lib/integrations/installation/upgraders/antigravity.js +67 -0
- package/lib/integrations/installation/upgraders/claude.js +123 -0
- package/lib/integrations/installation/upgraders/codex.js +73 -0
- package/lib/integrations/installation/upgraders/dsh.js +62 -0
- package/lib/integrations/installation/upgraders/pi.js +90 -0
- package/lib/integrations/installation/upgraders/qoder.js +67 -0
- package/lib/integrations/installation/upgraders/registry.js +40 -0
- 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 +10 -0
- package/lib/model/history.js +4 -1
- package/lib/model/installation.js +1 -0
- package/lib/model/plugin-host.d.ts +5 -0
- package/lib/model/workspace-config.d.ts +8 -12
- package/lib/model/workspace-config.js +2 -1
- package/lib/plugin.d.ts +2 -1
- package/lib/plugin.js +2 -2
- 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-service.d.ts +15 -45
- package/lib/services/agents/agent-service.js +22 -3
- package/lib/services/history/history-capture.js +34 -22
- package/lib/services/history/history-migrate.js +26 -60
- package/lib/services/history/history-query.js +38 -57
- package/lib/services/history/summary-command.d.ts +1 -1
- package/lib/services/history/summary-command.js +8 -7
- package/lib/services/history/summary-registry.js +2 -3
- package/lib/services/history/summary-runner.d.ts +2 -5
- package/lib/services/history/summary-runner.js +72 -74
- package/lib/services/history/workspace-history.d.ts +3 -0
- package/lib/services/history/workspace-history.js +6 -0
- package/lib/services/installation/setup-service.js +4 -1
- package/lib/services/installation/upgrade-service.js +95 -0
- package/lib/services/workspace/plugin-releases.d.ts +15 -0
- package/lib/services/workspace/plugin-releases.js +126 -0
- package/lib/services/workspace/workspace-config.js +9 -8
- 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 +2 -1
- package/lib/storage/history-files.js +21 -15
- package/lib/storage/history-format.d.ts +2 -3
- package/lib/storage/history-format.js +5 -7
- package/lib/tools/history/contract.d.ts +3 -11
- package/lib/tools/history/contract.js +8 -7
- package/lib/ui/dsh/elements.d.ts +2 -5
- package/lib/ui/dsh/elements.js +3 -16
- package/lib/ui/dsh/management.js +9 -9
- 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 +1 -0
- package/resources/prompts/plugin-coordinator.md +1 -0
- package/scripts/README.md +3 -2
- package/src/common/validation.ts +10 -0
- package/src/dsh.ts +2 -2
- package/src/extension/history/command.ts +68 -0
- package/src/extension/hosts/dsh/acp-entry.ts +21 -0
- package/src/extension/hosts/dsh/acp-member.ts +4 -15
- package/src/extension/hosts/dsh/command.ts +6 -46
- package/src/extension/hosts/dsh/workspace.ts +12 -38
- package/src/extension/hosts/pi/acp-member.ts +4 -10
- package/src/extension/hosts/pi/command.ts +14 -63
- package/src/extension/hosts/pi/events.ts +2 -8
- package/src/extension/hosts/pi/lifecycle.ts +3 -2
- package/src/extension/hosts/plugin-runtime.ts +39 -19
- package/src/extension/hosts/workspace-mcp.ts +25 -0
- package/src/extension/mcp/bridge.ts +80 -80
- package/src/extension/mcp/tool-contract.ts +462 -0
- package/src/extension/mcp/workers.ts +81 -551
- package/src/extension/setup/cli.ts +11 -1
- package/src/extension/setup/upgrade.ts +158 -0
- package/src/extension/setup/workspace-cli.ts +167 -0
- package/src/integrations/acp/agents.ts +2 -3
- 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 +2 -1
- package/src/integrations/agent-resources.ts +1 -1
- package/src/integrations/hosts/claude/adapter.ts +7 -53
- package/src/integrations/hosts/codex/adapter.ts +16 -0
- package/src/integrations/hosts/plugin-registry.ts +9 -1
- 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 +144 -0
- package/src/integrations/installation/pi-bridge.ts +1 -1
- package/src/integrations/installation/pi-setup.ts +1 -1
- package/src/integrations/installation/processes.ts +1 -1
- package/src/integrations/installation/upgraders/antigravity.ts +68 -0
- package/src/integrations/installation/upgraders/claude.ts +123 -0
- package/src/integrations/installation/upgraders/codex.ts +73 -0
- package/src/integrations/installation/upgraders/dsh.ts +63 -0
- package/src/integrations/installation/upgraders/pi.ts +87 -0
- package/src/integrations/installation/upgraders/qoder.ts +68 -0
- package/src/integrations/installation/upgraders/registry.ts +48 -0
- package/src/model/acp.ts +11 -3
- package/src/model/agent.ts +20 -4
- package/src/model/history.ts +5 -0
- package/src/model/installation.ts +86 -0
- package/src/model/plugin-host.ts +5 -1
- package/src/model/workspace-config.ts +6 -12
- package/src/pbot.ts +13 -32
- package/src/plugin.ts +3 -3
- package/src/services/agents/agent-service.ts +29 -17
- package/src/services/history/history-capture.ts +30 -22
- package/src/services/history/history-migrate.ts +23 -50
- package/src/services/history/history-query.ts +34 -48
- package/src/services/history/summary-command.ts +9 -8
- package/src/services/history/summary-registry.ts +2 -3
- package/src/services/history/summary-runner.ts +72 -81
- package/src/services/history/workspace-history.ts +8 -0
- package/src/services/installation/setup-service.ts +9 -43
- package/src/services/installation/upgrade-service.ts +127 -0
- package/src/services/workspace/plugin-releases.ts +121 -0
- package/src/services/workspace/workspace-config.ts +9 -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 +22 -15
- package/src/storage/history-format.ts +6 -8
- package/src/tools/history/contract.ts +9 -9
- package/src/tools/history/pi-tool.ts +6 -4
- package/src/ui/dsh/elements.ts +5 -12
- package/src/ui/dsh/management.ts +10 -10
- package/src/ui/dsh/styles.ts +5 -33
- package/lib/antigravity-plugin/lib/services/history/history-migrate.d.ts +0 -12
- package/lib/antigravity-plugin/lib/services/history/history-migrate.js +0 -88
- package/lib/ui/presentation.d.ts +0 -3
- package/lib/ui/presentation.js +0 -12
- package/src/tools/access.ts +0 -7
- package/src/tools/register.ts +0 -21
- package/src/ui/presentation.ts +0 -12
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { gte, lt, valid } from "semver";
|
|
4
|
+
import { object } from "../../../common/json.js";
|
|
5
|
+
async function readManifestVersion(path) {
|
|
6
|
+
try {
|
|
7
|
+
const data = JSON.parse(await readFile(path, "utf8"));
|
|
8
|
+
return object(data) && typeof data.version === "string" && valid(data.version) ? data.version : undefined;
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
if (error.code === "ENOENT")
|
|
12
|
+
return undefined;
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export const antigravityUpgrader = {
|
|
17
|
+
host: "antigravity",
|
|
18
|
+
async upgrade(context) {
|
|
19
|
+
if (context.currentVersion && valid(context.currentVersion) && gte(context.currentVersion, context.targetVersion)) {
|
|
20
|
+
return {
|
|
21
|
+
host: this.host,
|
|
22
|
+
state: "up-to-date",
|
|
23
|
+
previousVersion: context.currentVersion,
|
|
24
|
+
version: context.currentVersion,
|
|
25
|
+
scope: "user",
|
|
26
|
+
detail: "已是最新版本。",
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const pluginDir = join(context.packageRoot, "lib", "antigravity-plugin");
|
|
30
|
+
const bundledVersion = await readManifestVersion(join(pluginDir, "plugin.json"));
|
|
31
|
+
if (!bundledVersion) {
|
|
32
|
+
return {
|
|
33
|
+
host: this.host,
|
|
34
|
+
state: "skipped",
|
|
35
|
+
...(context.currentVersion ? { previousVersion: context.currentVersion } : {}),
|
|
36
|
+
detail: `缺少 Antigravity 插件构建产物:${pluginDir}`,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (lt(bundledVersion, context.targetVersion)) {
|
|
40
|
+
return {
|
|
41
|
+
host: this.host,
|
|
42
|
+
state: "skipped",
|
|
43
|
+
...(context.currentVersion ? { previousVersion: context.currentVersion } : {}),
|
|
44
|
+
detail: `当前本地包产物版本为 ${bundledVersion},低于目标版本 ${context.targetVersion};请先更新全局 personal-bot 包。`,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const agy = context.env.PBOT_AGY_COMMAND || await context.findExecutable("agy");
|
|
48
|
+
if (!agy) {
|
|
49
|
+
return {
|
|
50
|
+
host: this.host,
|
|
51
|
+
state: "skipped",
|
|
52
|
+
...(context.currentVersion ? { previousVersion: context.currentVersion } : {}),
|
|
53
|
+
detail: "未找到 Antigravity CLI(agy),已跳过。",
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
await context.run(agy, ["plugin", "install", pluginDir], context.workspace);
|
|
57
|
+
return {
|
|
58
|
+
host: this.host,
|
|
59
|
+
state: "updated",
|
|
60
|
+
...(context.currentVersion ? { previousVersion: context.currentVersion } : {}),
|
|
61
|
+
version: bundledVersion,
|
|
62
|
+
scope: "user",
|
|
63
|
+
detail: `已通过 agy plugin install 更新到 ${bundledVersion}。`,
|
|
64
|
+
nextStep: "重启 Antigravity 会话使新版本生效。",
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { realpath } from "node:fs/promises";
|
|
2
|
+
import { gte, valid } from "semver";
|
|
3
|
+
import { object } from "../../../common/json.js";
|
|
4
|
+
function parsePluginList(raw) {
|
|
5
|
+
const parsed = JSON.parse(raw);
|
|
6
|
+
const items = Array.isArray(parsed)
|
|
7
|
+
? parsed
|
|
8
|
+
: object(parsed) && Array.isArray(parsed.plugins)
|
|
9
|
+
? parsed.plugins
|
|
10
|
+
: [];
|
|
11
|
+
const entries = [];
|
|
12
|
+
for (const item of items) {
|
|
13
|
+
if (!object(item))
|
|
14
|
+
continue;
|
|
15
|
+
const id = typeof item.id === "string" ? item.id : typeof item.name === "string" ? item.name : undefined;
|
|
16
|
+
if (!id)
|
|
17
|
+
continue;
|
|
18
|
+
entries.push({
|
|
19
|
+
id,
|
|
20
|
+
...(typeof item.version === "string" ? { version: item.version } : {}),
|
|
21
|
+
...(typeof item.scope === "string" ? { scope: item.scope } : {}),
|
|
22
|
+
...(typeof item.projectPath === "string" ? { projectPath: item.projectPath } : {}),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return entries;
|
|
26
|
+
}
|
|
27
|
+
async function resolvePathSafe(value) {
|
|
28
|
+
try {
|
|
29
|
+
return await realpath(value);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async function selectMatchingEntry(entries, workspace) {
|
|
36
|
+
const canonicalWorkspace = await resolvePathSafe(workspace);
|
|
37
|
+
const candidates = entries.filter(entry => entry.id === "personal-bot" || entry.id.startsWith("personal-bot@"));
|
|
38
|
+
if (!candidates.length)
|
|
39
|
+
return undefined;
|
|
40
|
+
const scopedMatches = [];
|
|
41
|
+
for (const entry of candidates) {
|
|
42
|
+
if (!entry.projectPath) {
|
|
43
|
+
scopedMatches.push(entry);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (await resolvePathSafe(entry.projectPath) === canonicalWorkspace)
|
|
47
|
+
scopedMatches.push(entry);
|
|
48
|
+
}
|
|
49
|
+
const priority = new Map([["local", 0], ["project", 1], ["user", 2]]);
|
|
50
|
+
scopedMatches.sort((a, b) => (priority.get(a.scope ?? "") ?? 9) - (priority.get(b.scope ?? "") ?? 9));
|
|
51
|
+
return scopedMatches[0];
|
|
52
|
+
}
|
|
53
|
+
export const claudeUpgrader = {
|
|
54
|
+
host: "claude",
|
|
55
|
+
async upgrade(context) {
|
|
56
|
+
const claude = context.env.PBOT_CLAUDE_COMMAND || await context.findExecutable("claude");
|
|
57
|
+
if (!claude) {
|
|
58
|
+
return {
|
|
59
|
+
host: this.host,
|
|
60
|
+
state: "skipped",
|
|
61
|
+
...(context.currentVersion ? { previousVersion: context.currentVersion } : {}),
|
|
62
|
+
detail: "未找到 Claude Code CLI(claude),已跳过。",
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
let entries;
|
|
66
|
+
try {
|
|
67
|
+
const raw = await context.run(claude, ["plugin", "list", "--json"], context.workspace);
|
|
68
|
+
entries = parsePluginList(raw);
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
return {
|
|
72
|
+
host: this.host,
|
|
73
|
+
state: "failed",
|
|
74
|
+
...(context.currentVersion ? { previousVersion: context.currentVersion } : {}),
|
|
75
|
+
detail: `查询 Claude 插件列表失败:${error instanceof Error ? error.message : String(error)}`,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
const entry = await selectMatchingEntry(entries, context.workspace);
|
|
79
|
+
if (!entry) {
|
|
80
|
+
return {
|
|
81
|
+
host: this.host,
|
|
82
|
+
state: "skipped",
|
|
83
|
+
...(context.currentVersion ? { previousVersion: context.currentVersion } : {}),
|
|
84
|
+
detail: "未在 Claude 插件列表中找到 personal-bot(可能通过 --plugin-dir 本地加载),已跳过。",
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const installedVersion = entry.version ?? context.currentVersion;
|
|
88
|
+
const scope = entry.scope ?? "user";
|
|
89
|
+
if (installedVersion && valid(installedVersion) && gte(installedVersion, context.targetVersion)) {
|
|
90
|
+
return {
|
|
91
|
+
host: this.host,
|
|
92
|
+
state: "up-to-date",
|
|
93
|
+
previousVersion: installedVersion,
|
|
94
|
+
version: installedVersion,
|
|
95
|
+
scope,
|
|
96
|
+
detail: "已是最新版本。",
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const atIndex = entry.id.indexOf("@");
|
|
100
|
+
const marketplace = atIndex > 0 ? entry.id.slice(atIndex + 1) : undefined;
|
|
101
|
+
if (marketplace) {
|
|
102
|
+
try {
|
|
103
|
+
await context.run(claude, ["plugin", "marketplace", "update", marketplace], context.workspace);
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
// Continue to plugin update even if marketplace refresh is unsupported or cached.
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const updateArgs = ["plugin", "update", entry.id, "--yes"];
|
|
110
|
+
if (entry.scope)
|
|
111
|
+
updateArgs.push("--scope", entry.scope);
|
|
112
|
+
await context.run(claude, updateArgs, context.workspace);
|
|
113
|
+
return {
|
|
114
|
+
host: this.host,
|
|
115
|
+
state: "updated",
|
|
116
|
+
...(installedVersion ? { previousVersion: installedVersion } : {}),
|
|
117
|
+
version: context.targetVersion,
|
|
118
|
+
scope,
|
|
119
|
+
detail: `已按原有作用域(${scope})更新 ${entry.id}。`,
|
|
120
|
+
nextStep: "重启 Claude Code 会话使新版本生效。",
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { gte, lt, valid } from "semver";
|
|
4
|
+
import { object } from "../../../common/json.js";
|
|
5
|
+
async function readManifestVersion(path) {
|
|
6
|
+
try {
|
|
7
|
+
const data = JSON.parse(await readFile(path, "utf8"));
|
|
8
|
+
return object(data) && typeof data.version === "string" && valid(data.version) ? data.version : undefined;
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
if (error.code === "ENOENT")
|
|
12
|
+
return undefined;
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export const codexUpgrader = {
|
|
17
|
+
host: "codex",
|
|
18
|
+
async upgrade(context) {
|
|
19
|
+
if (context.currentVersion && valid(context.currentVersion) && gte(context.currentVersion, context.targetVersion)) {
|
|
20
|
+
return {
|
|
21
|
+
host: this.host,
|
|
22
|
+
state: "up-to-date",
|
|
23
|
+
previousVersion: context.currentVersion,
|
|
24
|
+
version: context.currentVersion,
|
|
25
|
+
scope: "user",
|
|
26
|
+
detail: "已是最新版本。",
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const marketplaceDir = join(context.packageRoot, "lib", "codex-marketplace");
|
|
30
|
+
const bundledVersion = await readManifestVersion(join(marketplaceDir, "plugins", "personal-bot", ".codex-plugin", "plugin.json"));
|
|
31
|
+
if (!bundledVersion) {
|
|
32
|
+
return {
|
|
33
|
+
host: this.host,
|
|
34
|
+
state: "skipped",
|
|
35
|
+
...(context.currentVersion ? { previousVersion: context.currentVersion } : {}),
|
|
36
|
+
detail: `缺少 Codex 插件构建产物:${marketplaceDir}`,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (lt(bundledVersion, context.targetVersion)) {
|
|
40
|
+
return {
|
|
41
|
+
host: this.host,
|
|
42
|
+
state: "skipped",
|
|
43
|
+
...(context.currentVersion ? { previousVersion: context.currentVersion } : {}),
|
|
44
|
+
detail: `当前本地包产物版本为 ${bundledVersion},低于目标版本 ${context.targetVersion};请先更新全局 personal-bot 包。`,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const codex = context.env.PBOT_CODEX_COMMAND || await context.findExecutable("codex");
|
|
48
|
+
if (!codex) {
|
|
49
|
+
return {
|
|
50
|
+
host: this.host,
|
|
51
|
+
state: "skipped",
|
|
52
|
+
...(context.currentVersion ? { previousVersion: context.currentVersion } : {}),
|
|
53
|
+
detail: "未找到 Codex CLI(codex),已跳过。",
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
await context.run(codex, ["plugin", "marketplace", "add", marketplaceDir], context.workspace);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// Marketplace may already be registered; proceed to re-install the plugin from it.
|
|
61
|
+
}
|
|
62
|
+
await context.run(codex, ["plugin", "add", "personal-bot@pbot-local"], context.workspace);
|
|
63
|
+
return {
|
|
64
|
+
host: this.host,
|
|
65
|
+
state: "updated",
|
|
66
|
+
...(context.currentVersion ? { previousVersion: context.currentVersion } : {}),
|
|
67
|
+
version: bundledVersion,
|
|
68
|
+
scope: "user",
|
|
69
|
+
detail: `已通过 codex plugin add 更新到 ${bundledVersion}。`,
|
|
70
|
+
nextStep: "重启 Codex 会话;若 hooks 有变化,请在 Codex /hooks 中重新核对信任。",
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { gte, valid } from "semver";
|
|
2
|
+
export function inferDshProfile(bindingPath) {
|
|
3
|
+
if (!bindingPath)
|
|
4
|
+
return undefined;
|
|
5
|
+
const normalized = bindingPath.replaceAll("\\", "/");
|
|
6
|
+
const match = /\/profiles\/([^/]+)\/node_modules\/personal-bot\/package\.json$/.exec(normalized);
|
|
7
|
+
return match?.[1];
|
|
8
|
+
}
|
|
9
|
+
export const dshUpgrader = {
|
|
10
|
+
host: "dsh",
|
|
11
|
+
async upgrade(context) {
|
|
12
|
+
if (context.currentVersion && valid(context.currentVersion) && gte(context.currentVersion, context.targetVersion)) {
|
|
13
|
+
return {
|
|
14
|
+
host: this.host,
|
|
15
|
+
state: "up-to-date",
|
|
16
|
+
previousVersion: context.currentVersion,
|
|
17
|
+
version: context.currentVersion,
|
|
18
|
+
detail: "已是最新版本。",
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const profile = context.options.dshProfile || inferDshProfile(context.bindingPath);
|
|
22
|
+
if (!profile) {
|
|
23
|
+
return {
|
|
24
|
+
host: this.host,
|
|
25
|
+
state: "skipped",
|
|
26
|
+
...(context.currentVersion ? { previousVersion: context.currentVersion } : {}),
|
|
27
|
+
detail: "无法自动识别 dsh profile;请传入 --dsh-profile <名称> 或手动执行:dsh plugin --profile <名称> update personal-bot --latest",
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const dsh = context.env.PBOT_DSH_COMMAND || await context.findExecutable("dsh");
|
|
31
|
+
if (!dsh) {
|
|
32
|
+
return {
|
|
33
|
+
host: this.host,
|
|
34
|
+
state: "skipped",
|
|
35
|
+
...(context.currentVersion ? { previousVersion: context.currentVersion } : {}),
|
|
36
|
+
scope: `profile:${profile}`,
|
|
37
|
+
detail: "未找到 dsh CLI(dsh),已跳过。",
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
await context.run(dsh, ["plugin", "--profile", profile, "update", "personal-bot", "--latest"], context.workspace);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
return {
|
|
45
|
+
host: this.host,
|
|
46
|
+
state: "failed",
|
|
47
|
+
...(context.currentVersion ? { previousVersion: context.currentVersion } : {}),
|
|
48
|
+
scope: `profile:${profile}`,
|
|
49
|
+
detail: `${error instanceof Error ? error.message : String(error)}(提示:更新 dsh 插件前需先停止对应 profile 的 dsh 服务)`,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
host: this.host,
|
|
54
|
+
state: "updated",
|
|
55
|
+
...(context.currentVersion ? { previousVersion: context.currentVersion } : {}),
|
|
56
|
+
version: context.targetVersion,
|
|
57
|
+
scope: `profile:${profile}`,
|
|
58
|
+
detail: `已更新 dsh profile "${profile}" 中的 personal-bot。`,
|
|
59
|
+
nextStep: `重新启动 dsh --profile ${profile} 使新版本生效。`,
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { gte, valid } from "semver";
|
|
4
|
+
import { object } from "../../../common/json.js";
|
|
5
|
+
import { npmName } from "../../../common/package-source.js";
|
|
6
|
+
function packageSource(entry) {
|
|
7
|
+
if (typeof entry === "string")
|
|
8
|
+
return entry;
|
|
9
|
+
if (object(entry) && typeof entry.source === "string")
|
|
10
|
+
return entry.source;
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
async function hasCustomOnlySource(workspace) {
|
|
14
|
+
const settingsPath = join(workspace, ".pi", "settings.json");
|
|
15
|
+
try {
|
|
16
|
+
const data = JSON.parse(await readFile(settingsPath, "utf8"));
|
|
17
|
+
if (!object(data) || !Array.isArray(data.packages))
|
|
18
|
+
return false;
|
|
19
|
+
const sources = data.packages.map(packageSource).filter((value) => value !== undefined);
|
|
20
|
+
const matches = sources.filter(source => source.includes("personal-bot"));
|
|
21
|
+
if (!matches.length)
|
|
22
|
+
return false;
|
|
23
|
+
return matches.every(source => npmName(source) !== "personal-bot");
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
if (error.code === "ENOENT")
|
|
27
|
+
return false;
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async function readLocalPiVersion(workspace) {
|
|
32
|
+
const manifestPath = join(workspace, ".pi", "npm", "node_modules", "personal-bot", "package.json");
|
|
33
|
+
try {
|
|
34
|
+
const data = JSON.parse(await readFile(manifestPath, "utf8"));
|
|
35
|
+
return object(data) && data.name === "personal-bot" && typeof data.version === "string" && valid(data.version)
|
|
36
|
+
? data.version
|
|
37
|
+
: undefined;
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (error.code === "ENOENT")
|
|
41
|
+
return undefined;
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export const piUpgrader = {
|
|
46
|
+
host: "pi",
|
|
47
|
+
async upgrade(context) {
|
|
48
|
+
const current = await readLocalPiVersion(context.workspace) ?? context.currentVersion;
|
|
49
|
+
if (current && valid(current) && gte(current, context.targetVersion)) {
|
|
50
|
+
return {
|
|
51
|
+
host: this.host,
|
|
52
|
+
state: "up-to-date",
|
|
53
|
+
previousVersion: current,
|
|
54
|
+
version: current,
|
|
55
|
+
scope: "local",
|
|
56
|
+
detail: "已是最新版本。",
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (await hasCustomOnlySource(context.workspace)) {
|
|
60
|
+
return {
|
|
61
|
+
host: this.host,
|
|
62
|
+
state: "skipped",
|
|
63
|
+
...(current ? { previousVersion: current } : {}),
|
|
64
|
+
scope: "local",
|
|
65
|
+
detail: "工作区 Pi 配置中的 personal-bot 使用非 npm 自定义来源,已保留当前配置。",
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const pi = context.env.PBOT_PI_COMMAND || await context.findExecutable("pi");
|
|
69
|
+
if (!pi) {
|
|
70
|
+
return {
|
|
71
|
+
host: this.host,
|
|
72
|
+
state: "skipped",
|
|
73
|
+
...(current ? { previousVersion: current } : {}),
|
|
74
|
+
scope: "local",
|
|
75
|
+
detail: "未找到 Pi CLI(pi),已跳过。",
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
await context.run(pi, ["install", "--local", `npm:personal-bot@${context.targetVersion}`], context.workspace);
|
|
79
|
+
const installed = await readLocalPiVersion(context.workspace) ?? context.targetVersion;
|
|
80
|
+
return {
|
|
81
|
+
host: this.host,
|
|
82
|
+
state: "updated",
|
|
83
|
+
...(current ? { previousVersion: current } : {}),
|
|
84
|
+
version: installed,
|
|
85
|
+
scope: "local",
|
|
86
|
+
detail: `已通过 pi install --local 更新工作区 personal-bot 到 ${installed}。`,
|
|
87
|
+
nextStep: "在 Pi 中执行 /reload 或重启 Pi 使新版本生效。",
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { gte, lt, valid } from "semver";
|
|
4
|
+
import { object } from "../../../common/json.js";
|
|
5
|
+
async function readManifestVersion(path) {
|
|
6
|
+
try {
|
|
7
|
+
const data = JSON.parse(await readFile(path, "utf8"));
|
|
8
|
+
return object(data) && typeof data.version === "string" && valid(data.version) ? data.version : undefined;
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
if (error.code === "ENOENT")
|
|
12
|
+
return undefined;
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export const qoderUpgrader = {
|
|
17
|
+
host: "qoder",
|
|
18
|
+
async upgrade(context) {
|
|
19
|
+
if (context.currentVersion && valid(context.currentVersion) && gte(context.currentVersion, context.targetVersion)) {
|
|
20
|
+
return {
|
|
21
|
+
host: this.host,
|
|
22
|
+
state: "up-to-date",
|
|
23
|
+
previousVersion: context.currentVersion,
|
|
24
|
+
version: context.currentVersion,
|
|
25
|
+
scope: "user",
|
|
26
|
+
detail: "已是最新版本。",
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const pluginDir = join(context.packageRoot, "lib", "qoder-plugin");
|
|
30
|
+
const bundledVersion = await readManifestVersion(join(pluginDir, ".qoder-plugin", "plugin.json"));
|
|
31
|
+
if (!bundledVersion) {
|
|
32
|
+
return {
|
|
33
|
+
host: this.host,
|
|
34
|
+
state: "skipped",
|
|
35
|
+
...(context.currentVersion ? { previousVersion: context.currentVersion } : {}),
|
|
36
|
+
detail: `缺少 Qoder CLI 插件构建产物:${pluginDir}`,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (lt(bundledVersion, context.targetVersion)) {
|
|
40
|
+
return {
|
|
41
|
+
host: this.host,
|
|
42
|
+
state: "skipped",
|
|
43
|
+
...(context.currentVersion ? { previousVersion: context.currentVersion } : {}),
|
|
44
|
+
detail: `当前本地包产物版本为 ${bundledVersion},低于目标版本 ${context.targetVersion};请先更新全局 personal-bot 包。`,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const qodercli = context.env.PBOT_QODER_COMMAND || await context.findExecutable("qodercli");
|
|
48
|
+
if (!qodercli) {
|
|
49
|
+
return {
|
|
50
|
+
host: this.host,
|
|
51
|
+
state: "skipped",
|
|
52
|
+
...(context.currentVersion ? { previousVersion: context.currentVersion } : {}),
|
|
53
|
+
detail: "未找到 Qoder CLI(qodercli),已跳过。",
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
await context.run(qodercli, ["plugin", "install", pluginDir], context.workspace);
|
|
57
|
+
return {
|
|
58
|
+
host: this.host,
|
|
59
|
+
state: "updated",
|
|
60
|
+
...(context.currentVersion ? { previousVersion: context.currentVersion } : {}),
|
|
61
|
+
version: bundledVersion,
|
|
62
|
+
scope: "user",
|
|
63
|
+
detail: `已通过 qodercli plugin install 更新到 ${bundledVersion}。`,
|
|
64
|
+
nextStep: "重启 Qoder CLI 会话使新版本生效。",
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { requireThat } from "../../../common/validation.js";
|
|
2
|
+
import { antigravityUpgrader } from "./antigravity.js";
|
|
3
|
+
import { claudeUpgrader } from "./claude.js";
|
|
4
|
+
import { codexUpgrader } from "./codex.js";
|
|
5
|
+
import { dshUpgrader } from "./dsh.js";
|
|
6
|
+
import { piUpgrader } from "./pi.js";
|
|
7
|
+
import { qoderUpgrader } from "./qoder.js";
|
|
8
|
+
/** Extensible registry of per-host plugin upgraders; core upgrade orchestration never branches on host IDs. */
|
|
9
|
+
export class HostUpgraderRegistry {
|
|
10
|
+
#upgraders = new Map();
|
|
11
|
+
constructor(initial = []) {
|
|
12
|
+
for (const upgrader of initial)
|
|
13
|
+
this.register(upgrader);
|
|
14
|
+
}
|
|
15
|
+
register(upgrader) {
|
|
16
|
+
requireThat(typeof upgrader.host === "string" && upgrader.host.length > 0, "宿主升级适配器标识无效。");
|
|
17
|
+
this.#upgraders.set(upgrader.host, upgrader);
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
unregister(host) {
|
|
21
|
+
return this.#upgraders.delete(host);
|
|
22
|
+
}
|
|
23
|
+
get(host) {
|
|
24
|
+
return this.#upgraders.get(host);
|
|
25
|
+
}
|
|
26
|
+
list() {
|
|
27
|
+
return [...this.#upgraders.keys()];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export const hostUpgraders = new HostUpgraderRegistry([
|
|
31
|
+
piUpgrader,
|
|
32
|
+
claudeUpgrader,
|
|
33
|
+
antigravityUpgrader,
|
|
34
|
+
codexUpgrader,
|
|
35
|
+
qoderUpgrader,
|
|
36
|
+
dshUpgrader,
|
|
37
|
+
]);
|
|
38
|
+
export const registerHostUpgrader = (upgrader) => hostUpgraders.register(upgrader);
|
|
39
|
+
export const getHostUpgrader = (host) => hostUpgraders.get(host);
|
|
40
|
+
export const listHostUpgraders = () => hostUpgraders.list();
|
package/lib/model/acp.d.ts
CHANGED
|
@@ -8,7 +8,8 @@ export interface AcpCommand {
|
|
|
8
8
|
env?: Record<string, string>;
|
|
9
9
|
}
|
|
10
10
|
/** ask: forward target permission requests to the parent session; allow/deny: answer them automatically. */
|
|
11
|
-
export
|
|
11
|
+
export declare const acpPermissionPolicies: readonly ["ask", "allow", "deny"];
|
|
12
|
+
export type AcpPermissionPolicy = typeof acpPermissionPolicies[number];
|
|
12
13
|
/** Workspace `acp.<name>` entry; omitting `command` keeps a registered harness's default command. */
|
|
13
14
|
export interface AcpHarnessConfig {
|
|
14
15
|
command?: string;
|
|
@@ -59,9 +60,10 @@ export interface AcpInput {
|
|
|
59
60
|
generation: string;
|
|
60
61
|
requestId: string;
|
|
61
62
|
}
|
|
63
|
+
export declare const acpAnswerStates: readonly ["completed", "failed", "cancelled"];
|
|
62
64
|
export interface AcpAnswer extends AcpInput {
|
|
63
65
|
answer: string;
|
|
64
|
-
state:
|
|
66
|
+
state: typeof acpAnswerStates[number];
|
|
65
67
|
error?: string;
|
|
66
68
|
}
|
|
67
69
|
export interface AcpReport {
|
|
@@ -84,8 +86,10 @@ export interface AcpPermissionReply {
|
|
|
84
86
|
requestId: string;
|
|
85
87
|
optionId: string | null;
|
|
86
88
|
}
|
|
87
|
-
export
|
|
89
|
+
export declare const acpElicitationActions: readonly ["accept", "decline", "cancel"];
|
|
90
|
+
export type AcpElicitationAction = typeof acpElicitationActions[number];
|
|
88
91
|
export type AcpElicitationValue = string | number | boolean | string[];
|
|
92
|
+
export declare function isAcpElicitationValue(value: unknown): value is AcpElicitationValue;
|
|
89
93
|
export type AcpElicitationContent = Record<string, AcpElicitationValue>;
|
|
90
94
|
export interface AcpElicitation {
|
|
91
95
|
generation: string;
|
package/lib/model/acp.js
CHANGED
|
@@ -10,3 +10,11 @@ export function isMcpWorkerTool(name) {
|
|
|
10
10
|
const bare = name.startsWith("mcp__pbot__") ? name.slice("mcp__pbot__".length) : name;
|
|
11
11
|
return bare === "pbot_worker" || mcpWorkerToolNames.includes(bare);
|
|
12
12
|
}
|
|
13
|
+
/** ask: forward target permission requests to the parent session; allow/deny: answer them automatically. */
|
|
14
|
+
export const acpPermissionPolicies = ["ask", "allow", "deny"];
|
|
15
|
+
export const acpAnswerStates = ["completed", "failed", "cancelled"];
|
|
16
|
+
export const acpElicitationActions = ["accept", "decline", "cancel"];
|
|
17
|
+
export function isAcpElicitationValue(value) {
|
|
18
|
+
return typeof value === "string" || typeof value === "boolean" || (typeof value === "number" && Number.isFinite(value))
|
|
19
|
+
|| (Array.isArray(value) && value.every(item => typeof item === "string"));
|
|
20
|
+
}
|
package/lib/model/agent.d.ts
CHANGED
|
@@ -26,12 +26,16 @@ export interface AgentLaunch {
|
|
|
26
26
|
stop: boolean;
|
|
27
27
|
startedAt: number;
|
|
28
28
|
}
|
|
29
|
+
export declare const messageDeliveries: readonly ["steer", "followUp"];
|
|
30
|
+
export declare const cycleStates: readonly ["running", "completed", "failed", "cancelled", "interrupted"];
|
|
31
|
+
export declare const cycleSources: readonly ["parent", "interactive", "mixed"];
|
|
32
|
+
export declare const agentStates: readonly ["starting", "busy", "idle", "stopping", "stopped", "error"];
|
|
29
33
|
export interface AgentMessage {
|
|
30
34
|
requestId: string;
|
|
31
35
|
generation: string;
|
|
32
36
|
sequence: number;
|
|
33
37
|
message: string;
|
|
34
|
-
delivery:
|
|
38
|
+
delivery: typeof messageDeliveries[number];
|
|
35
39
|
files: string[];
|
|
36
40
|
}
|
|
37
41
|
export interface AgentCycle {
|
|
@@ -39,15 +43,15 @@ export interface AgentCycle {
|
|
|
39
43
|
generation: string;
|
|
40
44
|
startedAt: number;
|
|
41
45
|
finishedAt?: number;
|
|
42
|
-
state:
|
|
46
|
+
state: typeof cycleStates[number];
|
|
43
47
|
leaf: string | null;
|
|
44
48
|
requestIds: string[];
|
|
45
|
-
source:
|
|
49
|
+
source: typeof cycleSources[number];
|
|
46
50
|
error?: string;
|
|
47
51
|
}
|
|
48
52
|
export interface AgentStatus {
|
|
49
53
|
generation: string;
|
|
50
|
-
state:
|
|
54
|
+
state: typeof agentStates[number];
|
|
51
55
|
activity: string;
|
|
52
56
|
updatedAt: number;
|
|
53
57
|
accepted?: string[];
|
|
@@ -105,3 +109,13 @@ export interface AgentCompletion {
|
|
|
105
109
|
cycle: AgentCycle;
|
|
106
110
|
report: string;
|
|
107
111
|
}
|
|
112
|
+
export interface AgentHost {
|
|
113
|
+
available(backend: AcpBackend): void;
|
|
114
|
+
filterOptions?(backend: AcpBackend, options: AgentOptions): AgentOptions;
|
|
115
|
+
prepare(backend: AcpBackend, options: AgentOptions): AcpSessionReference;
|
|
116
|
+
alive(id: string): boolean;
|
|
117
|
+
validateSession(value: AgentDescriptor, reference: AgentSessionReference): void | Promise<void>;
|
|
118
|
+
launch(value: AgentDescriptor, directory: string, generation: string, reference: AgentSessionReference, resume: boolean, signal: AbortSignal): void | Promise<void>;
|
|
119
|
+
release(id: string, generation: string): void | Promise<void>;
|
|
120
|
+
report(value: AgentDescriptor, reference: AgentSessionReference, leaf: string): string | Promise<string>;
|
|
121
|
+
}
|
package/lib/model/agent.js
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const messageDeliveries = ["steer", "followUp"];
|
|
2
|
+
export const cycleStates = ["running", "completed", "failed", "cancelled", "interrupted"];
|
|
3
|
+
export const cycleSources = ["parent", "interactive", "mixed"];
|
|
4
|
+
export const agentStates = ["starting", "busy", "idle", "stopping", "stopped", "error"];
|
package/lib/model/history.d.ts
CHANGED
|
@@ -157,6 +157,16 @@ export interface SummaryRunReport {
|
|
|
157
157
|
durationMs: number;
|
|
158
158
|
warnings: string[];
|
|
159
159
|
}
|
|
160
|
+
export declare const historyPageLimits: {
|
|
161
|
+
readonly search: {
|
|
162
|
+
readonly default: 20;
|
|
163
|
+
readonly max: 50;
|
|
164
|
+
};
|
|
165
|
+
readonly read: {
|
|
166
|
+
readonly default: 12000;
|
|
167
|
+
readonly max: 24000;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
160
170
|
export interface HistoryQuery {
|
|
161
171
|
host?: HistoryHost;
|
|
162
172
|
query?: string;
|
package/lib/model/history.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|