personal-bot 0.3.2 → 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 +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 +8 -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 +7 -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 +31 -23
- 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 +20127 -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 +3 -0
- package/lib/antigravity-plugin/lib/services/workspace/plugin-releases.js +78 -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 +31 -23
- 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 +3 -0
- package/lib/extension/workspace-cli.js +20127 -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/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/workspace/plugin-releases.d.ts +3 -0
- package/lib/services/workspace/plugin-releases.js +78 -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 +32 -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 +4 -1
- package/src/extension/setup/workspace-cli.ts +159 -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 +116 -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/model/acp.ts +11 -3
- package/src/model/agent.ts +20 -4
- package/src/model/history.ts +5 -0
- package/src/model/installation.ts +41 -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 +2 -41
- package/src/services/workspace/plugin-releases.ts +68 -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
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { AgentHost } from "../../
|
|
2
|
-
import type { AgentDescriptor, AgentOptions, AgentSessionReference } from "../../model/agent.js";
|
|
1
|
+
import type { AgentHost, AgentDescriptor, AgentOptions, AgentSessionReference } from "../../model/agent.js";
|
|
3
2
|
import type { AcpBackend, AcpCommands, AcpModelsResult } from "../../model/acp.js";
|
|
4
3
|
import { AgentFiles } from "../../storage/agent-files.js";
|
|
5
4
|
/** Pure ACP v1 worker host; spawns isolated acp-worker child processes for any registered or custom harness. */
|
|
6
5
|
export declare class AcpWorkerHost implements AgentHost {
|
|
7
|
-
|
|
6
|
+
commands: AcpCommands;
|
|
8
7
|
readonly files: AgentFiles;
|
|
9
8
|
readonly worker: string;
|
|
10
9
|
constructor(directory: string, commands?: AcpCommands);
|
|
@@ -16,7 +16,7 @@ export const dshAcpHarness = {
|
|
|
16
16
|
async prepareLaunch(context) {
|
|
17
17
|
const base = defaultPrepareLaunch(context);
|
|
18
18
|
const patch = join(context.directory, "acp-dsh-patch.json");
|
|
19
|
-
await writeFile(patch, JSON.stringify([{ insert: [{ id: "pbot-acp-member", name: join(context.packageRoot, "lib/extension/hosts/dsh/acp-
|
|
19
|
+
await writeFile(patch, JSON.stringify([{ insert: [{ id: "pbot-acp-member", name: join(context.packageRoot, "lib/extension/hosts/dsh/acp-entry.js") }] }]) + "\n", { mode: 0o600 });
|
|
20
20
|
return {
|
|
21
21
|
...base,
|
|
22
22
|
command: { ...base.command, args: [...base.command.args, "--patch", patch] },
|
|
@@ -9,6 +9,14 @@ export const standardAcpPresets = [
|
|
|
9
9
|
configureHint: "运行 agy 完成登录与默认模型配置。",
|
|
10
10
|
nativeWorkspaceSkills: true,
|
|
11
11
|
}),
|
|
12
|
+
createGenericAcpHarness("qoder", {
|
|
13
|
+
label: "Qoder CLI",
|
|
14
|
+
aliases: ["qodercli", "qoder-cli"],
|
|
15
|
+
nativeWorkspaceSkills: true,
|
|
16
|
+
defaultCommand: { command: "qodercli", args: ["--acp"] },
|
|
17
|
+
installHint: "安装 Qoder CLI(qodercli)",
|
|
18
|
+
configureHint: "运行 qodercli login 完成登录。",
|
|
19
|
+
}),
|
|
12
20
|
createGenericAcpHarness("codex", {
|
|
13
21
|
label: "OpenAI Codex",
|
|
14
22
|
aliases: ["openai-codex", "codex-cli"],
|
|
@@ -17,10 +17,11 @@ export function createAcpHistorySummarizer(options) {
|
|
|
17
17
|
requireThat(existsSync(workerPath), "缺少 ACP worker 构建产物;请先运行 npm run build。");
|
|
18
18
|
const commands = options.commands ?? {};
|
|
19
19
|
const backend = canonicalAcpBackend(options.backend ?? "pi", commands);
|
|
20
|
-
|
|
20
|
+
let resolvedReference;
|
|
21
21
|
const timeoutMs = options.timeoutMs ?? defaultTimeoutMs;
|
|
22
22
|
return async (request, signal) => {
|
|
23
23
|
signal.throwIfAborted();
|
|
24
|
+
const reference = (resolvedReference ??= acpLaunch(backend, commands, {}));
|
|
24
25
|
return await new Promise((resolveAnswer, reject) => {
|
|
25
26
|
const child = fork(workerPath, ["--prompt"], {
|
|
26
27
|
cwd: options.cwd,
|
|
@@ -11,7 +11,7 @@ export declare function inspectAcpBackends(commands?: AcpCommands): ({
|
|
|
11
11
|
available: boolean;
|
|
12
12
|
builtin: boolean;
|
|
13
13
|
configured: boolean;
|
|
14
|
-
permission:
|
|
14
|
+
permission: "ask" | "allow" | "deny";
|
|
15
15
|
command: string;
|
|
16
16
|
args: string[];
|
|
17
17
|
aliases?: string[];
|
|
@@ -22,7 +22,7 @@ export declare function inspectAcpBackends(commands?: AcpCommands): ({
|
|
|
22
22
|
available: boolean;
|
|
23
23
|
builtin: boolean;
|
|
24
24
|
configured: boolean;
|
|
25
|
-
permission:
|
|
25
|
+
permission: "ask" | "allow" | "deny";
|
|
26
26
|
command: string;
|
|
27
27
|
args: string[];
|
|
28
28
|
aliases?: string[];
|
|
@@ -32,7 +32,7 @@ export function formatWorkspaceSkills(skills) {
|
|
|
32
32
|
if (!skills.length)
|
|
33
33
|
return "";
|
|
34
34
|
const lines = skills.map(skill => `- **${skill.name}**(\`${skill.path}\`):${skill.description}`);
|
|
35
|
-
return "## 工作区技能\n\n
|
|
35
|
+
return "## 工作区技能\n\n匹配任务时按需读取对应 `SKILL.md` 正文:\n" + lines.join("\n");
|
|
36
36
|
}
|
|
37
37
|
export async function loadWorkspaceContext(options) {
|
|
38
38
|
const { host, root, role, coordinatorPrompt, includePrompts = true, includeRootAgents = false, localRoleOnly = false, workspaceSkills = [], notices = [], } = options;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { realpath, stat } from "node:fs/promises";
|
|
2
|
-
import { isAbsolute } from "node:path";
|
|
3
1
|
import { object } from "../../../common/json.js";
|
|
4
2
|
import { requireThat } from "../../../common/validation.js";
|
|
3
|
+
import { parsePromptEvent, pluginWorkspaceRoot, promptHooks } from "../prompt-hooks.js";
|
|
5
4
|
const supportedEvents = ["UserPromptSubmit", "PreToolUse", "UserPromptExpansion", "Stop"];
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const root = await realpath(directory);
|
|
10
|
-
requireThat((await stat(root)).isDirectory(), "Claude 工作区需要目录。");
|
|
11
|
-
return root;
|
|
5
|
+
const boundWorkspaceRoot = () => process.env.CLAUDE_PROJECT_DIR;
|
|
6
|
+
export async function claudeWorkspaceRoot(cwd, projectDirectory = boundWorkspaceRoot()) {
|
|
7
|
+
return pluginWorkspaceRoot(projectDirectory || cwd);
|
|
12
8
|
}
|
|
13
9
|
export const claudeAdapter = {
|
|
14
10
|
host: "claude",
|
|
@@ -17,6 +13,7 @@ export const claudeAdapter = {
|
|
|
17
13
|
coordinatorPrompt: "plugin-coordinator.md",
|
|
18
14
|
initCommandHint: "/personal-bot:pbot init",
|
|
19
15
|
usage: "用法:node <插件目录>/lib/claude.js init|status",
|
|
16
|
+
boundWorkspaceRoot,
|
|
20
17
|
resolveRoot(cwd) {
|
|
21
18
|
return claudeWorkspaceRoot(cwd);
|
|
22
19
|
},
|
|
@@ -33,56 +30,7 @@ export const claudeAdapter = {
|
|
|
33
30
|
requireThat(typeof value.cwd === "string", "Claude hook 缺少工作目录。");
|
|
34
31
|
return { kind: "check-skill", skill, cwd: value.cwd, raw: value };
|
|
35
32
|
}
|
|
36
|
-
|
|
37
|
-
if (typeof value.agent_id === "string")
|
|
38
|
-
return { kind: "ignore" };
|
|
39
|
-
requireThat(typeof value.cwd === "string", "Claude hook 缺少工作目录。");
|
|
40
|
-
if (event === "Stop")
|
|
41
|
-
return { kind: "record-history", cwd: value.cwd, raw: value };
|
|
42
|
-
return { kind: "inject-context", role: "coordinator", cwd: value.cwd, raw: value };
|
|
43
|
-
},
|
|
44
|
-
async extractHistory(event) {
|
|
45
|
-
if (!object(event.raw))
|
|
46
|
-
return undefined;
|
|
47
|
-
const sessionId = typeof event.raw.session_id === "string" ? event.raw.session_id.trim() : "";
|
|
48
|
-
if (!sessionId)
|
|
49
|
-
return undefined;
|
|
50
|
-
if (event.raw.hook_event_name === "UserPromptSubmit") {
|
|
51
|
-
const text = typeof event.raw.prompt === "string" ? event.raw.prompt.trim() : "";
|
|
52
|
-
if (!text)
|
|
53
|
-
return undefined;
|
|
54
|
-
return { kind: "input", sessionId, text };
|
|
55
|
-
}
|
|
56
|
-
if (event.raw.hook_event_name === "Stop") {
|
|
57
|
-
const assistantText = typeof event.raw.last_assistant_message === "string" ? event.raw.last_assistant_message.trim() : "";
|
|
58
|
-
if (!assistantText)
|
|
59
|
-
return undefined;
|
|
60
|
-
return {
|
|
61
|
-
kind: "answer",
|
|
62
|
-
sessionId,
|
|
63
|
-
assistantText,
|
|
64
|
-
completed: true,
|
|
65
|
-
...(event.raw.stop_hook_active === true ? { isContinuation: true } : {}),
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
return undefined;
|
|
69
|
-
},
|
|
70
|
-
formatPass() {
|
|
71
|
-
return {};
|
|
72
|
-
},
|
|
73
|
-
formatContext(event, context) {
|
|
74
|
-
const raw = event.raw;
|
|
75
|
-
return {
|
|
76
|
-
hookSpecificOutput: {
|
|
77
|
-
hookEventName: raw.hook_event_name,
|
|
78
|
-
additionalContext: context.text,
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
},
|
|
82
|
-
formatDeny(event, reason) {
|
|
83
|
-
const raw = event.raw;
|
|
84
|
-
return raw.hook_event_name === "UserPromptExpansion"
|
|
85
|
-
? { decision: "block", reason }
|
|
86
|
-
: { hookSpecificOutput: { hookEventName: raw.hook_event_name, permissionDecision: "deny", permissionDecisionReason: reason } };
|
|
33
|
+
return parsePromptEvent(value);
|
|
87
34
|
},
|
|
35
|
+
...promptHooks,
|
|
88
36
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { parsePromptEvent, pluginWorkspaceRoot, promptHooks } from "../prompt-hooks.js";
|
|
2
|
+
export const codexAdapter = {
|
|
3
|
+
host: "codex",
|
|
4
|
+
nativeRootAgents: true,
|
|
5
|
+
nativeWorkspaceSkills: true,
|
|
6
|
+
indexBundledSkills: true,
|
|
7
|
+
initCommandHint: "pbot plugin codex init",
|
|
8
|
+
usage: "用法:pbot plugin codex init|status",
|
|
9
|
+
resolveRoot(cwd) {
|
|
10
|
+
return pluginWorkspaceRoot(cwd);
|
|
11
|
+
},
|
|
12
|
+
parseEvent: parsePromptEvent,
|
|
13
|
+
...promptHooks,
|
|
14
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
/** Native tools still own parsing, mutation queues and results; authorize at the actual file write. */
|
|
3
|
+
export declare function agentFileTools(root: string, signal: AbortSignal, authorize: (path: string, change: unknown, signal: AbortSignal) => Promise<void>): ToolDefinition[];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { access as fileAccess, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { constants } from "node:fs";
|
|
3
|
+
import { dirname } from "node:path";
|
|
4
|
+
import { defineTool, createWriteToolDefinition, createEditToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
5
|
+
/** Native tools still own parsing, mutation queues and results; authorize at the actual file write. */
|
|
6
|
+
export function agentFileTools(root, signal, authorize) {
|
|
7
|
+
const guardedWrite = (cancel, parameters) => async (path, content) => {
|
|
8
|
+
await authorize(path, { parameters, content }, cancel);
|
|
9
|
+
await mkdir(dirname(path), { recursive: true });
|
|
10
|
+
cancel.throwIfAborted();
|
|
11
|
+
await writeFile(path, content, "utf8");
|
|
12
|
+
};
|
|
13
|
+
return [
|
|
14
|
+
defineTool({ ...createWriteToolDefinition(root),
|
|
15
|
+
execute(id, args, inner, update, child) {
|
|
16
|
+
const cancel = AbortSignal.any([signal, ...(inner ? [inner] : [])]);
|
|
17
|
+
return createWriteToolDefinition(root, { operations: {
|
|
18
|
+
// Directory creation belongs to guardedWrite, after authorization.
|
|
19
|
+
mkdir: async () => { }, writeFile: guardedWrite(cancel, args),
|
|
20
|
+
} }).execute(id, args, cancel, update, child);
|
|
21
|
+
},
|
|
22
|
+
}),
|
|
23
|
+
defineTool({ ...createEditToolDefinition(root),
|
|
24
|
+
execute(id, args, inner, update, child) {
|
|
25
|
+
const cancel = AbortSignal.any([signal, ...(inner ? [inner] : [])]);
|
|
26
|
+
return createEditToolDefinition(root, { operations: {
|
|
27
|
+
readFile, access: path => fileAccess(path, constants.R_OK | constants.W_OK), writeFile: guardedWrite(cancel, args),
|
|
28
|
+
} }).execute(id, args, cancel, update, child);
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
];
|
|
32
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { McpServerConfig } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type { ResolvedWorkspaceMcpServer } from "../../../model/workspace-mcp.js";
|
|
3
|
+
/** Translate a resolved workspace MCP entry into Pi's native `registerMcpServer` config. */
|
|
4
|
+
export declare function toPiMcpConfig(server: ResolvedWorkspaceMcpServer): McpServerConfig;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Translate a resolved workspace MCP entry into Pi's native `registerMcpServer` config. */
|
|
2
|
+
export function toPiMcpConfig(server) {
|
|
3
|
+
if (server.transport === "http") {
|
|
4
|
+
return {
|
|
5
|
+
type: "http",
|
|
6
|
+
url: server.url,
|
|
7
|
+
...(Object.keys(server.headers).length ? { headers: { ...server.headers } } : {}),
|
|
8
|
+
exposure: "direct",
|
|
9
|
+
timeout: server.timeout,
|
|
10
|
+
...(server.description ? { description: server.description } : {}),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
type: "stdio",
|
|
15
|
+
command: server.command,
|
|
16
|
+
args: [...server.args],
|
|
17
|
+
...(Object.keys(server.env).length ? { env: { ...server.env } } : {}),
|
|
18
|
+
cwd: server.cwd,
|
|
19
|
+
exposure: "direct",
|
|
20
|
+
timeout: server.timeout,
|
|
21
|
+
...(server.description ? { description: server.description } : {}),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -13,3 +13,4 @@ export declare const pluginHosts: PluginHostRegistry;
|
|
|
13
13
|
export declare const registerPluginHost: (adapter: PluginHostAdapter) => PluginHostRegistry;
|
|
14
14
|
export declare const getPluginHost: (host: PluginHostId) => PluginHostAdapter | undefined;
|
|
15
15
|
export declare const listPluginHosts: () => string[];
|
|
16
|
+
export declare function pluginMcpWorkspaceRoot(): string | undefined;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { requireThat } from "../../common/validation.js";
|
|
2
2
|
import { antigravityAdapter } from "./antigravity/adapter.js";
|
|
3
3
|
import { claudeAdapter } from "./claude/adapter.js";
|
|
4
|
+
import { codexAdapter } from "./codex/adapter.js";
|
|
5
|
+
import { qoderAdapter } from "./qoder/adapter.js";
|
|
4
6
|
/** Extensible registry of hook-based plugin host adapters; runtime never branches on host IDs. */
|
|
5
7
|
export class PluginHostRegistry {
|
|
6
8
|
#adapters = new Map();
|
|
@@ -28,7 +30,12 @@ export class PluginHostRegistry {
|
|
|
28
30
|
return [...this.#adapters.keys()];
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
|
-
export const pluginHosts = new PluginHostRegistry([claudeAdapter, antigravityAdapter]);
|
|
33
|
+
export const pluginHosts = new PluginHostRegistry([claudeAdapter, antigravityAdapter, codexAdapter, qoderAdapter]);
|
|
32
34
|
export const registerPluginHost = (adapter) => pluginHosts.register(adapter);
|
|
33
35
|
export const getPluginHost = (host) => pluginHosts.get(host);
|
|
34
36
|
export const listPluginHosts = () => pluginHosts.list();
|
|
37
|
+
export function pluginMcpWorkspaceRoot() {
|
|
38
|
+
// Older standalone Claude mounts supply the project directory without PBOT_HOST.
|
|
39
|
+
const adapter = process.env.PBOT_HOST ? pluginHosts.get(process.env.PBOT_HOST) : claudeAdapter;
|
|
40
|
+
return adapter?.boundWorkspaceRoot?.() || process.env.PBOT_WORKSPACE_ROOT;
|
|
41
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { HostEvent } from "../../model/plugin-host.js";
|
|
2
|
+
/** Shared stdin/stdout contract for hosts with Claude-compatible prompt and stop hooks. */
|
|
3
|
+
export declare function pluginWorkspaceRoot(directory: string): Promise<string>;
|
|
4
|
+
export declare function parsePromptEvent(value: unknown): HostEvent;
|
|
5
|
+
export declare const promptHooks: {
|
|
6
|
+
extractHistory(event: {
|
|
7
|
+
kind: "inject-context";
|
|
8
|
+
role: import("../../model/plugin-host.js").WorkspaceRole;
|
|
9
|
+
localRoleOnly?: boolean;
|
|
10
|
+
isSessionStart?: boolean;
|
|
11
|
+
noticesOnly?: boolean;
|
|
12
|
+
cwd: string;
|
|
13
|
+
raw: unknown;
|
|
14
|
+
} | {
|
|
15
|
+
kind: "record-history";
|
|
16
|
+
cwd: string;
|
|
17
|
+
raw: unknown;
|
|
18
|
+
}): Promise<{
|
|
19
|
+
text: string;
|
|
20
|
+
sessionId: string;
|
|
21
|
+
turnId: string;
|
|
22
|
+
kind: "input";
|
|
23
|
+
} | {
|
|
24
|
+
text: string;
|
|
25
|
+
sessionId: string;
|
|
26
|
+
turnId?: never;
|
|
27
|
+
kind: "input";
|
|
28
|
+
} | {
|
|
29
|
+
isContinuation?: true;
|
|
30
|
+
assistantText: string;
|
|
31
|
+
completed: true;
|
|
32
|
+
sessionId: string;
|
|
33
|
+
turnId: string;
|
|
34
|
+
kind: "answer";
|
|
35
|
+
} | {
|
|
36
|
+
isContinuation?: true;
|
|
37
|
+
assistantText: string;
|
|
38
|
+
completed: true;
|
|
39
|
+
sessionId: string;
|
|
40
|
+
turnId?: never;
|
|
41
|
+
kind: "answer";
|
|
42
|
+
} | undefined>;
|
|
43
|
+
formatPass(): {};
|
|
44
|
+
formatContext(event: {
|
|
45
|
+
kind: "inject-context";
|
|
46
|
+
role: import("../../model/plugin-host.js").WorkspaceRole;
|
|
47
|
+
localRoleOnly?: boolean;
|
|
48
|
+
isSessionStart?: boolean;
|
|
49
|
+
noticesOnly?: boolean;
|
|
50
|
+
cwd: string;
|
|
51
|
+
raw: unknown;
|
|
52
|
+
}, context: import("../../model/plugin-host.js").WorkspaceContext): {
|
|
53
|
+
hookSpecificOutput: {
|
|
54
|
+
hookEventName: string;
|
|
55
|
+
additionalContext: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
formatDeny(event: {
|
|
59
|
+
kind: "check-skill";
|
|
60
|
+
skill: string;
|
|
61
|
+
cwd: string;
|
|
62
|
+
raw: unknown;
|
|
63
|
+
}, reason: string): {
|
|
64
|
+
decision: string;
|
|
65
|
+
reason: string;
|
|
66
|
+
hookSpecificOutput?: never;
|
|
67
|
+
} | {
|
|
68
|
+
hookSpecificOutput: {
|
|
69
|
+
hookEventName: string;
|
|
70
|
+
permissionDecision: string;
|
|
71
|
+
permissionDecisionReason: string;
|
|
72
|
+
};
|
|
73
|
+
decision?: never;
|
|
74
|
+
reason?: never;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { realpath, stat } from "node:fs/promises";
|
|
2
|
+
import { isAbsolute } from "node:path";
|
|
3
|
+
import { object } from "../../common/json.js";
|
|
4
|
+
import { requireThat } from "../../common/validation.js";
|
|
5
|
+
/** Shared stdin/stdout contract for hosts with Claude-compatible prompt and stop hooks. */
|
|
6
|
+
export async function pluginWorkspaceRoot(directory) {
|
|
7
|
+
requireThat(isAbsolute(directory), "插件工作区需要绝对路径。");
|
|
8
|
+
const root = await realpath(directory);
|
|
9
|
+
requireThat((await stat(root)).isDirectory(), "插件工作区需要目录。");
|
|
10
|
+
return root;
|
|
11
|
+
}
|
|
12
|
+
export function parsePromptEvent(value) {
|
|
13
|
+
requireThat(object(value), "插件 hook 输入无效。");
|
|
14
|
+
const name = value.hook_event_name;
|
|
15
|
+
if (name !== "Stop" && name !== "UserPromptSubmit" && name !== "SessionStart")
|
|
16
|
+
return { kind: "ignore" };
|
|
17
|
+
if (typeof value.agent_id === "string")
|
|
18
|
+
return { kind: "ignore" };
|
|
19
|
+
requireThat(typeof value.cwd === "string", "插件 hook 缺少工作目录。");
|
|
20
|
+
if (name === "Stop")
|
|
21
|
+
return { kind: "record-history", cwd: value.cwd, raw: value };
|
|
22
|
+
if (name === "SessionStart") {
|
|
23
|
+
if (value.source === "resume" || value.source === "compact")
|
|
24
|
+
return { kind: "ignore" };
|
|
25
|
+
return { kind: "inject-context", role: "coordinator", isSessionStart: true, noticesOnly: true, cwd: value.cwd, raw: value };
|
|
26
|
+
}
|
|
27
|
+
return { kind: "inject-context", role: "coordinator", cwd: value.cwd, raw: value };
|
|
28
|
+
}
|
|
29
|
+
export const promptHooks = {
|
|
30
|
+
async extractHistory(event) {
|
|
31
|
+
if (!object(event.raw))
|
|
32
|
+
return undefined;
|
|
33
|
+
const sessionId = typeof event.raw.session_id === "string" ? event.raw.session_id.trim() : "";
|
|
34
|
+
if (!sessionId)
|
|
35
|
+
return undefined;
|
|
36
|
+
const turnId = typeof event.raw.turn_id === "string" ? event.raw.turn_id.trim() : "";
|
|
37
|
+
const identity = turnId ? { sessionId, turnId } : { sessionId };
|
|
38
|
+
if (event.raw.hook_event_name === "UserPromptSubmit") {
|
|
39
|
+
const text = typeof event.raw.prompt === "string" ? event.raw.prompt.trim() : "";
|
|
40
|
+
if (!text && !turnId)
|
|
41
|
+
return undefined;
|
|
42
|
+
return { kind: "input", ...identity, text };
|
|
43
|
+
}
|
|
44
|
+
if (event.raw.hook_event_name === "Stop") {
|
|
45
|
+
const assistantText = typeof event.raw.last_assistant_message === "string" ? event.raw.last_assistant_message.trim() : "";
|
|
46
|
+
if (!assistantText)
|
|
47
|
+
return undefined;
|
|
48
|
+
return {
|
|
49
|
+
kind: "answer",
|
|
50
|
+
...identity,
|
|
51
|
+
assistantText,
|
|
52
|
+
completed: true,
|
|
53
|
+
...(event.raw.stop_hook_active === true ? { isContinuation: true } : {}),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
},
|
|
58
|
+
formatPass() {
|
|
59
|
+
return {};
|
|
60
|
+
},
|
|
61
|
+
formatContext(event, context) {
|
|
62
|
+
const raw = event.raw;
|
|
63
|
+
return {
|
|
64
|
+
hookSpecificOutput: {
|
|
65
|
+
hookEventName: raw.hook_event_name,
|
|
66
|
+
additionalContext: context.text,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
formatDeny(event, reason) {
|
|
71
|
+
const raw = event.raw;
|
|
72
|
+
return raw.hook_event_name === "UserPromptExpansion"
|
|
73
|
+
? { decision: "block", reason }
|
|
74
|
+
: { hookSpecificOutput: { hookEventName: raw.hook_event_name, permissionDecision: "deny", permissionDecisionReason: reason } };
|
|
75
|
+
},
|
|
76
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { parsePromptEvent, pluginWorkspaceRoot, promptHooks } from "../prompt-hooks.js";
|
|
2
|
+
const boundWorkspaceRoot = () => process.env.QODER_PROJECT_DIR || process.env.PBOT_WORKSPACE_ROOT;
|
|
3
|
+
export const qoderAdapter = {
|
|
4
|
+
host: "qoder",
|
|
5
|
+
nativeRootAgents: true,
|
|
6
|
+
nativeWorkspaceSkills: true,
|
|
7
|
+
indexBundledSkills: true,
|
|
8
|
+
initCommandHint: "pbot plugin qoder init",
|
|
9
|
+
usage: "用法:pbot plugin qoder init|status",
|
|
10
|
+
boundWorkspaceRoot,
|
|
11
|
+
resolveRoot(cwd) {
|
|
12
|
+
return pluginWorkspaceRoot(boundWorkspaceRoot() || cwd);
|
|
13
|
+
},
|
|
14
|
+
parseEvent: parsePromptEvent,
|
|
15
|
+
...promptHooks,
|
|
16
|
+
};
|
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 {};
|
|
@@ -19,11 +19,13 @@ export interface WorkspaceContext {
|
|
|
19
19
|
export type HistoryCapture = {
|
|
20
20
|
kind: "input";
|
|
21
21
|
sessionId: string;
|
|
22
|
+
turnId?: string;
|
|
22
23
|
text: string;
|
|
23
24
|
timestamp?: string;
|
|
24
25
|
} | {
|
|
25
26
|
kind: "answer";
|
|
26
27
|
sessionId: string;
|
|
28
|
+
turnId?: string;
|
|
27
29
|
userText?: string;
|
|
28
30
|
assistantText: string;
|
|
29
31
|
completed: boolean;
|
|
@@ -40,6 +42,7 @@ export type HostEvent = {
|
|
|
40
42
|
role: WorkspaceRole;
|
|
41
43
|
localRoleOnly?: boolean;
|
|
42
44
|
isSessionStart?: boolean;
|
|
45
|
+
noticesOnly?: boolean;
|
|
43
46
|
cwd: string;
|
|
44
47
|
raw: unknown;
|
|
45
48
|
} | {
|
|
@@ -55,10 +58,12 @@ export type HostEvent = {
|
|
|
55
58
|
export interface PluginHostAdapter {
|
|
56
59
|
readonly host: PluginHostId;
|
|
57
60
|
readonly nativeRootAgents: boolean;
|
|
61
|
+
readonly indexBundledSkills?: boolean;
|
|
58
62
|
readonly nativeWorkspaceSkills?: boolean;
|
|
59
63
|
readonly coordinatorPrompt?: string;
|
|
60
64
|
readonly initCommandHint: string;
|
|
61
65
|
readonly usage: string;
|
|
66
|
+
boundWorkspaceRoot?(): string | undefined;
|
|
62
67
|
resolveRoot(cwd: string, rawPayload?: unknown): Promise<string>;
|
|
63
68
|
parseEvent(payload: unknown): HostEvent;
|
|
64
69
|
extractHistory?(event: Extract<HostEvent, {
|