personal-bot 0.3.7 → 0.4.1
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 +3 -3
- package/.claude-plugin/plugin.json +2 -2
- package/README.md +5 -8
- package/README.zh-CN.md +5 -8
- package/bin/pbot-pi-acp.mjs +1 -1
- package/docs/architecture/design.md +2 -2
- package/docs/architecture/extensibility.md +4 -4
- package/docs/architecture/model-context.md +6 -3
- package/docs/guides/cross-harness-workers.md +5 -5
- package/docs/guides/history.md +1 -3
- package/docs/guides/workspace-configuration.md +5 -5
- package/docs/hosts/claude-code.md +3 -3
- package/docs/hosts/codex-qoder.md +4 -2
- package/hooks/hooks.json +3 -0
- package/lib/antigravity-plugin/bin/pbot-pi-acp.mjs +1 -1
- package/lib/antigravity-plugin/lib/extension/acp/member.d.ts +1 -1
- package/lib/antigravity-plugin/lib/extension/acp/member.js +11 -10
- package/lib/antigravity-plugin/lib/extension/acp-worker.js +349 -204
- package/lib/antigravity-plugin/lib/extension/cli.js +596 -572
- package/lib/antigravity-plugin/lib/extension/hosts/dsh/acp-member.js +1 -1
- package/lib/antigravity-plugin/lib/extension/hosts/pi/acp-member.js +3 -4
- package/lib/antigravity-plugin/lib/extension/hosts/plugin-runtime.js +1 -12
- package/lib/antigravity-plugin/lib/extension/mcp.js +463 -379
- package/lib/antigravity-plugin/lib/integrations/agent-resources.d.ts +2 -2
- package/lib/antigravity-plugin/lib/integrations/agent-resources.js +3 -3
- package/lib/antigravity-plugin/lib/integrations/hosts/antigravity/adapter.js +0 -1
- package/lib/antigravity-plugin/lib/integrations/hosts/claude/adapter.js +1 -2
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/resources.d.ts +1 -1
- package/lib/antigravity-plugin/lib/integrations/hosts/prompt-hooks.js +4 -7
- package/lib/antigravity-plugin/lib/model/acp.d.ts +29 -35
- package/lib/antigravity-plugin/lib/model/agent.d.ts +33 -17
- package/lib/antigravity-plugin/lib/model/agent.js +0 -1
- package/lib/antigravity-plugin/lib/services/history/summary-dimensions/monthly.js +1 -1
- package/lib/antigravity-plugin/lib/services/history/summary-dimensions/session.js +6 -3
- package/lib/antigravity-plugin/lib/services/history/summary-runner.js +3 -3
- package/lib/antigravity-plugin/lib/storage/acp-files.d.ts +5 -8
- package/lib/antigravity-plugin/lib/storage/acp-files.js +34 -40
- package/lib/antigravity-plugin/lib/storage/agent-files.d.ts +19 -10
- package/lib/antigravity-plugin/lib/storage/agent-files.js +147 -43
- package/lib/antigravity-plugin/lib/storage/history-files.js +3 -2
- package/lib/antigravity-plugin/package.json +1 -1
- package/lib/antigravity-plugin/plugin.json +2 -2
- package/lib/antigravity-plugin/resources/agents/coordinator.md +2 -4
- package/lib/antigravity-plugin/resources/agents/general-purpose.md +2 -4
- package/lib/antigravity-plugin/resources/prompts/history-monthly-summary.md +6 -11
- package/lib/antigravity-plugin/resources/prompts/history-summary.md +6 -11
- package/lib/antigravity-plugin/resources/prompts/plugin-coordinator.md +1 -1
- package/lib/antigravity-plugin/resources/prompts/workspace.md +16 -23
- package/lib/antigravity-plugin/resources/skills/project-maintenance/SKILL.md +14 -21
- package/lib/antigravity-plugin/resources/skills/provider-connections/SKILL.md +23 -36
- package/lib/antigravity-plugin/resources/templates/workspace-agents.md +5 -13
- package/lib/antigravity-plugin/skills/pbot/SKILL.md +6 -23
- package/lib/antigravity-plugin/skills/project-maintenance/SKILL.md +14 -21
- package/lib/antigravity-plugin/skills/provider-connections/SKILL.md +23 -36
- package/lib/codex-marketplace/plugins/personal-bot/.codex-plugin/plugin.json +2 -2
- package/lib/codex-marketplace/plugins/personal-bot/.mcp.json +2 -2
- package/lib/codex-marketplace/plugins/personal-bot/hooks/hooks.json +3 -3
- package/lib/codex-marketplace/plugins/personal-bot/skills/pbot/SKILL.md +11 -3
- package/lib/extension/acp/member.d.ts +1 -1
- package/lib/extension/acp/member.js +11 -10
- package/lib/extension/acp/worker.js +34 -33
- package/lib/extension/acp-worker.js +349 -204
- package/lib/extension/cli.js +596 -572
- package/lib/extension/hosts/dsh/acp-member.js +1 -1
- package/lib/extension/hosts/dsh/command.js +2 -2
- package/lib/extension/hosts/dsh/workspace.js +5 -5
- package/lib/extension/hosts/pi/acp-member.js +3 -4
- package/lib/extension/hosts/plugin-runtime.js +1 -12
- package/lib/extension/mcp/tool-contract.d.ts +8 -50
- package/lib/extension/mcp/tool-contract.js +61 -107
- package/lib/extension/mcp/workers.d.ts +7 -27
- package/lib/extension/mcp/workers.js +40 -24
- package/lib/extension/mcp.js +463 -379
- package/lib/integrations/acp/agents.d.ts +2 -3
- package/lib/integrations/acp/agents.js +22 -22
- package/lib/integrations/acp/harnesses/claude.js +1 -1
- package/lib/integrations/agent-resources.d.ts +2 -2
- package/lib/integrations/agent-resources.js +3 -3
- package/lib/integrations/hosts/antigravity/adapter.js +0 -1
- package/lib/integrations/hosts/claude/adapter.js +1 -2
- package/lib/integrations/hosts/dsh/resources.d.ts +1 -1
- package/lib/integrations/hosts/prompt-hooks.js +4 -7
- package/lib/model/acp.d.ts +29 -35
- package/lib/model/agent.d.ts +33 -17
- package/lib/model/agent.js +0 -1
- package/lib/qoder-plugin/.mcp.json +2 -2
- package/lib/qoder-plugin/.qoder-plugin/plugin.json +2 -2
- package/lib/qoder-plugin/hooks/hooks.json +3 -3
- package/lib/qoder-plugin/skills/pbot/SKILL.md +11 -3
- package/lib/services/agents/acp-run.d.ts +6 -4
- package/lib/services/agents/acp-run.js +62 -43
- package/lib/services/agents/agent-run.d.ts +10 -6
- package/lib/services/agents/agent-run.js +142 -65
- package/lib/services/agents/agent-service.d.ts +3 -21
- package/lib/services/agents/agent-service.js +182 -128
- package/lib/services/history/summary-dimensions/monthly.js +1 -1
- package/lib/services/history/summary-dimensions/session.js +6 -3
- package/lib/services/history/summary-runner.js +3 -3
- package/lib/storage/acp-files.d.ts +5 -8
- package/lib/storage/acp-files.js +34 -40
- package/lib/storage/agent-files.d.ts +19 -10
- package/lib/storage/agent-files.js +147 -43
- package/lib/storage/history-files.js +3 -2
- package/lib/tools/history/contract.d.ts +1 -1
- package/lib/tools/history/contract.js +14 -16
- package/package.json +2 -2
- package/resources/agents/coordinator.md +2 -4
- package/resources/agents/general-purpose.md +2 -4
- package/resources/antigravity/skills/pbot/SKILL.md +6 -23
- package/resources/claude/skills/pbot/SKILL.md +6 -23
- package/resources/plugin/skills/pbot/SKILL.md +11 -3
- package/resources/prompts/history-coordinator.md +1 -1
- package/resources/prompts/history-monthly-summary.md +6 -11
- package/resources/prompts/history-summary.md +6 -11
- package/resources/prompts/plugin-coordinator.md +1 -1
- package/resources/prompts/workspace.md +16 -23
- package/resources/skills/project-maintenance/SKILL.md +14 -21
- package/resources/skills/provider-connections/SKILL.md +23 -36
- package/resources/templates/workspace-agents.md +5 -13
- package/src/extension/acp/member.ts +14 -11
- package/src/extension/acp/worker.ts +31 -28
- package/src/extension/cli/commands/mcp.ts +1 -1
- package/src/extension/cli/commands/upgrade.ts +8 -36
- package/src/extension/cli/commands/workspace.ts +3 -8
- package/src/extension/cli/index.ts +1 -2
- package/src/extension/hosts/dsh/acp-member.ts +1 -1
- package/src/extension/hosts/dsh/command.ts +2 -2
- package/src/extension/hosts/dsh/workspace.ts +5 -4
- package/src/extension/hosts/pi/acp-member.ts +3 -4
- package/src/extension/hosts/pi/command.ts +2 -2
- package/src/extension/hosts/pi/events.ts +1 -1
- package/src/extension/hosts/pi/lifecycle.ts +0 -2
- package/src/extension/hosts/plugin-runtime.ts +1 -11
- package/src/extension/mcp/tool-contract.ts +61 -108
- package/src/extension/mcp/workers.ts +39 -24
- package/src/integrations/acp/agents.ts +28 -27
- package/src/integrations/acp/harnesses/claude.ts +1 -1
- package/src/integrations/agent-resources.ts +5 -5
- package/src/integrations/hosts/antigravity/adapter.ts +0 -1
- package/src/integrations/hosts/claude/adapter.ts +1 -2
- package/src/integrations/hosts/dsh/resources.ts +1 -1
- package/src/integrations/hosts/dsh/session.ts +2 -2
- package/src/integrations/hosts/prompt-hooks.ts +3 -6
- package/src/integrations/installation/cli-update.ts +2 -2
- package/src/integrations/installation/installers/claude.ts +4 -4
- package/src/integrations/installation/installers/qoder.ts +5 -5
- package/src/integrations/installation/upgraders/antigravity.ts +57 -15
- package/src/integrations/installation/upgraders/claude.ts +1 -4
- package/src/integrations/installation/upgraders/codex.ts +85 -15
- package/src/integrations/installation/upgraders/dsh.ts +46 -24
- package/src/integrations/installation/upgraders/pi.ts +18 -11
- package/src/integrations/installation/upgraders/qoder.ts +95 -20
- package/src/model/acp.ts +27 -29
- package/src/model/agent.ts +80 -16
- package/src/model/installation.ts +0 -2
- package/src/pbot.ts +3 -3
- package/src/services/agents/acp-run.ts +81 -49
- package/src/services/agents/agent-run.ts +154 -56
- package/src/services/agents/agent-service.ts +206 -135
- package/src/services/history/summary-dimensions/monthly.ts +1 -1
- package/src/services/history/summary-dimensions/session.ts +6 -3
- package/src/services/history/summary-runner.ts +3 -3
- package/src/services/installation/upgrade-service.ts +1 -5
- package/src/storage/acp-files.ts +50 -45
- package/src/storage/agent-files.ts +159 -46
- package/src/storage/history-files.ts +3 -2
- package/src/tools/history/contract.ts +14 -16
- package/lib/antigravity-plugin/lib/services/workspace/plugin-releases.d.ts +0 -15
- package/lib/antigravity-plugin/lib/services/workspace/plugin-releases.js +0 -126
- package/lib/services/workspace/plugin-releases.d.ts +0 -15
- package/lib/services/workspace/plugin-releases.js +0 -126
- package/src/services/workspace/plugin-releases.ts +0 -121
package/lib/storage/acp-files.js
CHANGED
|
@@ -4,27 +4,24 @@ import { isAcpBackend, isOneOf, requireThat } from "../common/validation.js";
|
|
|
4
4
|
import { fileId } from "./file-access.js";
|
|
5
5
|
import { acpAnswerStates, acpElicitationActions, acpPermissionPolicies, isAcpElicitationValue } from "../model/acp.js";
|
|
6
6
|
const text = (value) => typeof value === "string" && value.length > 0 && !value.includes("\0");
|
|
7
|
-
export function
|
|
8
|
-
requireThat(object(value) &&
|
|
9
|
-
text(value.command) && isAbsolute(value.command) &&
|
|
10
|
-
(value.
|
|
7
|
+
export function acpConfig(value) {
|
|
8
|
+
requireThat(object(value) && isAcpBackend(value.backend) &&
|
|
9
|
+
text(value.command) && isAbsolute(value.command) &&
|
|
10
|
+
Array.isArray(value.args) && value.args.every(arg => typeof arg === "string" && !arg.includes("\0")), "ACP 启动配置无效。");
|
|
11
11
|
if (value.env !== undefined) {
|
|
12
12
|
requireThat(object(value.env) && Object.entries(value.env).every(([k, v]) => text(k) && typeof v === "string" && !v.includes("\0")), "ACP 环境变量配置无效。");
|
|
13
13
|
}
|
|
14
14
|
requireThat(value.permission === undefined || isOneOf(value.permission, acpPermissionPolicies), "ACP 权限策略无效。");
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
export function acpReference(value) {
|
|
18
|
+
requireThat(object(value) && value.host === "acp" && (value.sessionId === null || text(value.sessionId)), "ACP 会话引用无效。");
|
|
19
|
+
acpConfig(value);
|
|
15
20
|
const capabilities = value.capabilities;
|
|
16
|
-
if (capabilities !== undefined)
|
|
21
|
+
if (capabilities !== undefined) {
|
|
17
22
|
requireThat(object(capabilities) &&
|
|
18
23
|
["resume", "load", "close"].every(key => typeof capabilities[key] === "boolean"), "ACP 会话能力无效。");
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
export function acpModelState(value) {
|
|
22
|
-
requireThat(object(value) && text(value.generation) && ["provider", "model", "resolvedModel", "thinking"].every(key => value[key] === undefined || text(value[key])), "ACP 模型选择无效。");
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
export function acpProcess(value) {
|
|
26
|
-
requireThat(object(value) && text(value.generation) && Number.isSafeInteger(value.pid) && Number(value.pid) > 1 &&
|
|
27
|
-
typeof value.startedAt === "number" && Number.isFinite(value.startedAt), "ACP 进程记录无效。");
|
|
24
|
+
}
|
|
28
25
|
return value;
|
|
29
26
|
}
|
|
30
27
|
export function acpInput(value) {
|
|
@@ -38,38 +35,35 @@ export function acpAnswer(value) {
|
|
|
38
35
|
(value.error === undefined || typeof value.error === "string"), "ACP 最终回答无效。");
|
|
39
36
|
return value;
|
|
40
37
|
}
|
|
41
|
-
export function
|
|
42
|
-
requireThat(object(value) && text(value.generation) && text(value.cycleId) && typeof value.text === "string", "ACP 周期报告无效。");
|
|
43
|
-
fileId(value.cycleId);
|
|
44
|
-
return value;
|
|
45
|
-
}
|
|
46
|
-
export function acpPermission(value) {
|
|
47
|
-
acpInput(value);
|
|
48
|
-
requireThat(object(value) && typeof value.description === "string" && Array.isArray(value.options) && value.options.every(option => object(option) && text(option.optionId) && text(option.name) && isOneOf(option.kind, ["allow_once", "allow_always", "reject_once", "reject_always"])), "ACP 确认请求无效。");
|
|
49
|
-
return value;
|
|
50
|
-
}
|
|
51
|
-
export function acpPermissionReply(value) {
|
|
38
|
+
export function acpInteraction(value) {
|
|
52
39
|
acpInput(value);
|
|
53
|
-
requireThat(object(value)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
acpInput(value);
|
|
58
|
-
requireThat(object(value) && (value.mode === "form" || value.mode === "url") && typeof value.message === "string", "ACP 交互请求无效。");
|
|
59
|
-
if (value.mode === "form") {
|
|
60
|
-
requireThat(object(value.schema) && value.url === undefined, "ACP 表单交互请求缺少有效 schema。");
|
|
40
|
+
requireThat(object(value), "ACP 交互请求无效。");
|
|
41
|
+
if (value.kind === "permission") {
|
|
42
|
+
requireThat(typeof value.description === "string" && Array.isArray(value.options) && value.options.every(option => object(option) && text(option.optionId) && text(option.name) && isOneOf(option.kind, ["allow_once", "allow_always", "reject_once", "reject_always"])), "ACP 确认请求无效。");
|
|
43
|
+
return value;
|
|
61
44
|
}
|
|
62
|
-
|
|
63
|
-
requireThat(
|
|
45
|
+
if (value.kind === "form") {
|
|
46
|
+
requireThat(typeof value.message === "string" && object(value.schema), "ACP 表单交互请求缺少有效 schema。");
|
|
47
|
+
return value;
|
|
64
48
|
}
|
|
49
|
+
requireThat(value.kind === "url" && typeof value.message === "string" && text(value.url), "ACP URL 交互请求无效。");
|
|
65
50
|
return value;
|
|
66
51
|
}
|
|
67
|
-
export function
|
|
52
|
+
export function acpInteractionReply(value) {
|
|
68
53
|
acpInput(value);
|
|
69
|
-
requireThat(object(value)
|
|
70
|
-
if (value.
|
|
71
|
-
requireThat(value.
|
|
72
|
-
|
|
54
|
+
requireThat(object(value), "ACP 交互答复无效。");
|
|
55
|
+
if (value.kind === "permission") {
|
|
56
|
+
requireThat(value.optionId === null || text(value.optionId), "ACP 确认答复无效。");
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
if (value.kind === "form") {
|
|
60
|
+
requireThat(isOneOf(value.action, acpElicitationActions), "ACP 表单答复 action 无效。");
|
|
61
|
+
if (value.content !== undefined) {
|
|
62
|
+
requireThat(value.action === "accept" && object(value.content) &&
|
|
63
|
+
Object.values(value.content).every(isAcpElicitationValue), "ACP 表单答复 content 无效。");
|
|
64
|
+
}
|
|
65
|
+
return value;
|
|
73
66
|
}
|
|
67
|
+
requireThat(value.kind === "url" && isOneOf(value.action, acpElicitationActions), "ACP URL 交互答复无效。");
|
|
74
68
|
return value;
|
|
75
69
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AgentCycle, AgentDescriptor, AgentMessage, AgentOutput, AgentSessionReference, AgentStatus, AgentWorkerRecord } from "../model/agent.js";
|
|
2
2
|
import type { AcpSessionReference } from "../model/acp.js";
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function launch(v: unknown): AgentLaunch;
|
|
3
|
+
export declare function workerRecord(v: unknown): AgentWorkerRecord;
|
|
5
4
|
export declare function message(v: unknown): AgentMessage;
|
|
6
5
|
export declare function cycle(v: unknown): AgentCycle;
|
|
7
6
|
export declare function status(v: unknown): AgentStatus;
|
|
7
|
+
export declare function outputRecord(v: unknown): AgentOutput;
|
|
8
|
+
export declare function toDescriptor(record: AgentWorkerRecord): AgentDescriptor;
|
|
8
9
|
export declare class AgentFiles {
|
|
9
10
|
#private;
|
|
10
11
|
readonly root: string;
|
|
@@ -15,14 +16,22 @@ export declare class AgentFiles {
|
|
|
15
16
|
read<T>(id: string, path: string, parse: (v: unknown) => T): T;
|
|
16
17
|
optional<T>(id: string, path: string, parse: (v: unknown) => T): T | undefined;
|
|
17
18
|
write<T>(id: string, path: string, value: T, parse: (v: unknown) => T, create?: boolean): void;
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
remove(id: string, path: string): void;
|
|
20
|
+
create(value: AgentDescriptor, run: {
|
|
21
|
+
generation: string;
|
|
22
|
+
sequence: number;
|
|
23
|
+
stop: boolean;
|
|
24
|
+
startedAt: number;
|
|
25
|
+
}, acp: AcpSessionReference): void;
|
|
26
|
+
worker(id: string): AgentWorkerRecord;
|
|
27
|
+
list(): AgentWorkerRecord[];
|
|
20
28
|
messages(id: string): AgentMessage[];
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
removeMessage(id: string, requestId: string): void;
|
|
30
|
+
output(id: string): AgentOutput | undefined;
|
|
31
|
+
pendingInteractions(id: string, generation: string): import("../model/acp.js").AcpInteraction[];
|
|
32
|
+
removeInteraction(id: string, requestId: string): void;
|
|
33
|
+
clearTransient(id: string): void;
|
|
34
|
+
removeWorker(id: string): void;
|
|
26
35
|
ensureSubdirectory(id: string, name: string): void;
|
|
27
36
|
reference(id: string): AgentSessionReference;
|
|
28
37
|
/** Short controller edits are serialized; an abandoned lock fails closed. */
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readdirSync, rmSync } from "node:fs";
|
|
1
|
+
import { existsSync, mkdirSync, readdirSync, rmdirSync, rmSync, unlinkSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { canonical, object } from "../common/json.js";
|
|
5
5
|
import { isOneOf, requireThat } from "../common/validation.js";
|
|
6
6
|
import { readJsonFile, writeJsonFile } from "./atomic-json.js";
|
|
7
7
|
import { fileId, privateDirectory } from "./file-access.js";
|
|
8
|
-
import { agentStates,
|
|
9
|
-
import {
|
|
8
|
+
import { agentStates, cycleStates, messageDeliveries } from "../model/agent.js";
|
|
9
|
+
import { acpConfig, acpInteraction, acpReference } from "./acp-files.js";
|
|
10
10
|
const text = (v) => typeof v === "string" && v.length > 0;
|
|
11
11
|
const number = (v) => typeof v === "number" && Number.isFinite(v);
|
|
12
|
-
export function
|
|
13
|
-
requireThat(object(v) && text(v.agentId) && text(v.release) && text(v.workspace) && text(v.
|
|
14
|
-
(v.
|
|
12
|
+
export function workerRecord(v) {
|
|
13
|
+
requireThat(object(v) && text(v.agentId) && text(v.release) && text(v.workspace) && text(v.parentSessionId) &&
|
|
14
|
+
text(v.generation) && Number.isSafeInteger(v.sequence) && typeof v.stop === "boolean" && number(v.startedAt) &&
|
|
15
|
+
(v.pid === undefined || (Number.isSafeInteger(v.pid) && Number(v.pid) > 1)) &&
|
|
16
|
+
(v.options === undefined || object(v.options)), "worker 控制记录无效。");
|
|
15
17
|
fileId(v.agentId);
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
export function launch(v) {
|
|
19
|
-
requireThat(object(v) && text(v.generation) && text(v.name) && Number.isSafeInteger(v.sequence) && typeof v.stop === "boolean" && number(v.startedAt), "子会话启动状态无效。");
|
|
18
|
+
acpConfig(v.acp);
|
|
20
19
|
return v;
|
|
21
20
|
}
|
|
22
21
|
export function message(v) {
|
|
@@ -26,18 +25,72 @@ export function message(v) {
|
|
|
26
25
|
}
|
|
27
26
|
export function cycle(v) {
|
|
28
27
|
requireThat(object(v) && text(v.cycleId) && text(v.generation) && number(v.startedAt) &&
|
|
29
|
-
isOneOf(v.state, cycleStates) &&
|
|
30
|
-
(v.
|
|
31
|
-
|
|
28
|
+
isOneOf(v.state, cycleStates) && Array.isArray(v.requestIds) && v.requestIds.every(text) &&
|
|
29
|
+
(v.finishedAt === undefined || number(v.finishedAt)) &&
|
|
30
|
+
(v.error === undefined || typeof v.error === "string"), "子会话周期无效。");
|
|
32
31
|
return v;
|
|
33
32
|
}
|
|
34
33
|
export function status(v) {
|
|
35
34
|
requireThat(object(v) && text(v.generation) && isOneOf(v.state, agentStates) &&
|
|
36
35
|
typeof v.activity === "string" && number(v.updatedAt), "子会话状态无效。");
|
|
37
|
-
if (v.
|
|
36
|
+
if (v.sessionId !== undefined)
|
|
37
|
+
requireThat(v.sessionId === null || text(v.sessionId), "ACP 会话 ID 无效。");
|
|
38
|
+
if (v.capabilities !== undefined) {
|
|
39
|
+
requireThat(object(v.capabilities) &&
|
|
40
|
+
["resume", "load", "close"].every(key => typeof v.capabilities[key] === "boolean"), "ACP 会话能力无效。");
|
|
41
|
+
}
|
|
42
|
+
if (v.selection !== undefined) {
|
|
43
|
+
requireThat(object(v.selection) &&
|
|
44
|
+
["provider", "model", "resolvedModel", "thinking"].every(key => v.selection[key] === undefined || text(v.selection[key])), "ACP 模型选择无效。");
|
|
45
|
+
}
|
|
46
|
+
if (v.activeRequestId !== undefined) {
|
|
47
|
+
requireThat(text(v.activeRequestId), "ACP 输入关联无效。");
|
|
48
|
+
fileId(v.activeRequestId);
|
|
49
|
+
}
|
|
50
|
+
if (v.accepted !== undefined)
|
|
51
|
+
requireThat(Array.isArray(v.accepted) && v.accepted.every(text), "已领取请求列表无效。");
|
|
52
|
+
if (v.cycle !== undefined)
|
|
38
53
|
cycle(v.cycle);
|
|
54
|
+
if (v.error !== undefined)
|
|
55
|
+
requireThat(typeof v.error === "string", "子会话错误信息无效。");
|
|
56
|
+
return v;
|
|
57
|
+
}
|
|
58
|
+
export function outputRecord(v) {
|
|
59
|
+
requireThat(object(v) && text(v.cycleId) && text(v.generation) && number(v.startedAt) && number(v.finishedAt) &&
|
|
60
|
+
isOneOf(v.state, ["completed", "failed", "cancelled", "interrupted"]) &&
|
|
61
|
+
Array.isArray(v.requestIds) && v.requestIds.every(text) &&
|
|
62
|
+
typeof v.text === "string" && (v.error === undefined || typeof v.error === "string"), "子会话输出记录无效。");
|
|
63
|
+
fileId(v.cycleId);
|
|
39
64
|
return v;
|
|
40
65
|
}
|
|
66
|
+
export function toDescriptor(record) {
|
|
67
|
+
return {
|
|
68
|
+
agentId: record.agentId,
|
|
69
|
+
release: record.release,
|
|
70
|
+
workspace: record.workspace,
|
|
71
|
+
parentSessionId: record.parentSessionId,
|
|
72
|
+
options: record.options ?? {},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function tryUnlink(path) {
|
|
76
|
+
try {
|
|
77
|
+
unlinkSync(path);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
if (error.code !== "ENOENT")
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function tryRmdir(path) {
|
|
85
|
+
try {
|
|
86
|
+
rmdirSync(path);
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
const code = error.code;
|
|
90
|
+
if (code !== "ENOENT" && code !== "ENOTEMPTY" && code !== "EEXIST")
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
41
94
|
export class AgentFiles {
|
|
42
95
|
root;
|
|
43
96
|
#failure;
|
|
@@ -72,56 +125,105 @@ export class AgentFiles {
|
|
|
72
125
|
}
|
|
73
126
|
requireThat(published, "子会话文件已存在。");
|
|
74
127
|
}
|
|
128
|
+
remove(id, path) {
|
|
129
|
+
tryUnlink(join(this.directory(id), path));
|
|
130
|
+
}
|
|
75
131
|
create(value, run, acp) {
|
|
76
132
|
this.check();
|
|
77
133
|
acpReference(acp);
|
|
78
134
|
mkdirSync(this.root, { recursive: true, mode: 0o700 });
|
|
79
135
|
mkdirSync(this.directory(value.agentId), { mode: 0o700 });
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
136
|
+
const hasOptions = Object.keys(value.options).length > 0;
|
|
137
|
+
const record = {
|
|
138
|
+
agentId: value.agentId,
|
|
139
|
+
release: value.release,
|
|
140
|
+
workspace: value.workspace,
|
|
141
|
+
parentSessionId: value.parentSessionId,
|
|
142
|
+
generation: run.generation,
|
|
143
|
+
sequence: run.sequence,
|
|
144
|
+
stop: run.stop,
|
|
145
|
+
startedAt: run.startedAt,
|
|
146
|
+
acp: {
|
|
147
|
+
backend: acp.backend,
|
|
148
|
+
command: acp.command,
|
|
149
|
+
args: acp.args,
|
|
150
|
+
...(acp.env ? { env: acp.env } : {}),
|
|
151
|
+
...(acp.permission ? { permission: acp.permission } : {}),
|
|
152
|
+
},
|
|
153
|
+
...(hasOptions ? { options: value.options } : {}),
|
|
154
|
+
};
|
|
155
|
+
this.write(value.agentId, "worker.json", record, workerRecord, true);
|
|
156
|
+
}
|
|
157
|
+
worker(id) {
|
|
158
|
+
return this.read(id, "worker.json", workerRecord);
|
|
85
159
|
}
|
|
86
160
|
list() {
|
|
87
161
|
if (!existsSync(this.root))
|
|
88
162
|
return [];
|
|
89
163
|
return readdirSync(this.root, { withFileTypes: true }).filter(e => e.isDirectory() && !e.name.startsWith(".")).flatMap(e => {
|
|
90
|
-
const
|
|
91
|
-
return
|
|
164
|
+
const record = this.optional(e.name, "worker.json", workerRecord);
|
|
165
|
+
return record ? [record] : [];
|
|
92
166
|
});
|
|
93
167
|
}
|
|
94
168
|
messages(id) {
|
|
95
|
-
|
|
169
|
+
const dir = join(this.directory(id), "inbox");
|
|
170
|
+
if (!existsSync(dir))
|
|
171
|
+
return [];
|
|
172
|
+
return readdirSync(dir).filter(n => n.endsWith(".json"))
|
|
96
173
|
.map(n => this.read(id, "inbox/" + n, message)).sort((a, b) => a.sequence - b.sequence);
|
|
97
174
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
175
|
+
removeMessage(id, requestId) {
|
|
176
|
+
fileId(requestId);
|
|
177
|
+
const dir = join(this.directory(id), "inbox");
|
|
178
|
+
tryUnlink(join(dir, requestId + ".json"));
|
|
179
|
+
tryRmdir(dir);
|
|
101
180
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const dir = join(this.directory(id), "permissions");
|
|
105
|
-
if (!existsSync(dir))
|
|
106
|
-
return [];
|
|
107
|
-
const names = readdirSync(dir);
|
|
108
|
-
return names.filter(n => n.endsWith(".json") && !n.endsWith("-reply.json") && !names.includes(n.slice(0, -5) + "-reply.json"))
|
|
109
|
-
.map(n => this.read(id, "permissions/" + n, acpPermission)).filter(item => item.generation === generation);
|
|
181
|
+
output(id) {
|
|
182
|
+
return this.optional(id, "output.json", outputRecord);
|
|
110
183
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const dir = join(this.directory(id), "elicitations");
|
|
184
|
+
pendingInteractions(id, generation) {
|
|
185
|
+
const dir = join(this.directory(id), "interactions");
|
|
114
186
|
if (!existsSync(dir))
|
|
115
187
|
return [];
|
|
116
188
|
const names = readdirSync(dir);
|
|
117
189
|
return names.filter(n => n.endsWith(".json") && !n.endsWith("-reply.json") && !names.includes(n.slice(0, -5) + "-reply.json"))
|
|
118
|
-
.map(n => this.read(id, "
|
|
190
|
+
.map(n => this.read(id, "interactions/" + n, acpInteraction)).filter(item => item.generation === generation);
|
|
191
|
+
}
|
|
192
|
+
removeInteraction(id, requestId) {
|
|
193
|
+
fileId(requestId);
|
|
194
|
+
const dir = join(this.directory(id), "interactions");
|
|
195
|
+
tryUnlink(join(dir, requestId + ".json"));
|
|
196
|
+
tryUnlink(join(dir, requestId + "-reply.json"));
|
|
197
|
+
tryRmdir(dir);
|
|
198
|
+
}
|
|
199
|
+
clearTransient(id) {
|
|
200
|
+
const base = this.directory(id);
|
|
201
|
+
if (!existsSync(base))
|
|
202
|
+
return;
|
|
203
|
+
rmSync(join(base, "inbox"), { recursive: true, force: true });
|
|
204
|
+
rmSync(join(base, "interactions"), { recursive: true, force: true });
|
|
205
|
+
tryUnlink(join(base, "acp-answer.json"));
|
|
206
|
+
}
|
|
207
|
+
removeWorker(id) {
|
|
208
|
+
rmSync(this.directory(id), { recursive: true, force: true });
|
|
209
|
+
tryRmdir(this.root);
|
|
119
210
|
}
|
|
120
211
|
ensureSubdirectory(id, name) {
|
|
121
212
|
privateDirectory(this.directory(id), name);
|
|
122
213
|
}
|
|
123
214
|
reference(id) {
|
|
124
|
-
|
|
215
|
+
const w = this.worker(id);
|
|
216
|
+
const saved = this.optional(id, "state.json", status);
|
|
217
|
+
return {
|
|
218
|
+
host: "acp",
|
|
219
|
+
backend: w.acp.backend,
|
|
220
|
+
command: w.acp.command,
|
|
221
|
+
args: w.acp.args,
|
|
222
|
+
...(w.acp.env ? { env: w.acp.env } : {}),
|
|
223
|
+
...(w.acp.permission ? { permission: w.acp.permission } : {}),
|
|
224
|
+
sessionId: saved?.sessionId ?? null,
|
|
225
|
+
...(saved?.capabilities ? { capabilities: saved.capabilities } : {}),
|
|
226
|
+
};
|
|
125
227
|
}
|
|
126
228
|
/** Short controller edits are serialized; an abandoned lock fails closed. */
|
|
127
229
|
control(work) {
|
|
@@ -145,14 +247,16 @@ export class AgentFiles {
|
|
|
145
247
|
}
|
|
146
248
|
enqueue(id, text, delivery, files = [], requestId = randomUUID()) {
|
|
147
249
|
fileId(requestId);
|
|
148
|
-
const
|
|
250
|
+
const w = this.worker(id);
|
|
251
|
+
const previous = this.optional(id, "inbox/" + requestId + ".json", message);
|
|
149
252
|
if (previous) {
|
|
150
|
-
requireThat(previous.generation ===
|
|
253
|
+
requireThat(previous.generation === w.generation && previous.message === text && previous.delivery === delivery && canonical(previous.files) === canonical(files), "请求 ID 已被不同输入使用。");
|
|
151
254
|
return previous;
|
|
152
255
|
}
|
|
153
|
-
|
|
154
|
-
this.write(id, "
|
|
155
|
-
|
|
256
|
+
w.sequence++;
|
|
257
|
+
this.write(id, "worker.json", w, workerRecord);
|
|
258
|
+
this.ensureSubdirectory(id, "inbox");
|
|
259
|
+
const value = { requestId, generation: w.generation, sequence: w.sequence, message: text, delivery, files };
|
|
156
260
|
this.write(id, "inbox/" + value.requestId + ".json", value, message, true);
|
|
157
261
|
return value;
|
|
158
262
|
}
|
|
@@ -296,8 +296,9 @@ export class HistoryFiles {
|
|
|
296
296
|
rawCount,
|
|
297
297
|
summaryCount,
|
|
298
298
|
total,
|
|
299
|
-
message:
|
|
300
|
-
|
|
299
|
+
message: `当前按年月读取历史,平铺目录中的 ${rawCount} 份原文和 ${summaryCount} 份摘要尚未纳入检索。` +
|
|
300
|
+
"可在工作区根目录用 pbot history migrate --dry-run 预览,用 pbot history migrate 执行(Pi、dsh 可用 /pbot history migrate)。" +
|
|
301
|
+
'要继续使用平铺目录,可在 .pbot/config.json 中设置 "history": { "layout": "flat" }。',
|
|
301
302
|
};
|
|
302
303
|
}
|
|
303
304
|
listFlatRawFiles() {
|
|
@@ -70,7 +70,7 @@ export declare const historyResultSchema: Type.TObject<{
|
|
|
70
70
|
}>>;
|
|
71
71
|
warnings: Type.TArray<Type.TString>;
|
|
72
72
|
}>;
|
|
73
|
-
export declare const historyDescription
|
|
73
|
+
export declare const historyDescription = "\u67E5\u627E\u5DE5\u4F5C\u533A\u5404\u5BBF\u4E3B\u5F52\u6863\u7684\u95EE\u7B54\u548C\u6458\u8981\u3002\u6CBF\u5B50\u8282\u70B9\u53EF\u4ECE\u6708\u5EA6\u6C47\u603B\u67E5\u5230\u4F1A\u8BDD\u6458\u8981\u548C\u539F\u59CB\u95EE\u7B54\u3002";
|
|
74
74
|
export declare const historyParameters: Type.TObject<{
|
|
75
75
|
action: Type.TUnion<[Type.TLiteral<"search">, Type.TLiteral<"read">]>;
|
|
76
76
|
host: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
@@ -9,7 +9,7 @@ const node = Type.Object({
|
|
|
9
9
|
host: identifier,
|
|
10
10
|
id: Type.String(),
|
|
11
11
|
kind: Type.Union([Type.Literal("session"), Type.Literal("exchange"), Type.Literal("summary")], {
|
|
12
|
-
description: "session
|
|
12
|
+
description: "session 为会话,summary 为摘要,exchange 为单轮问答原文。",
|
|
13
13
|
}),
|
|
14
14
|
dimension: Type.Optional(identifier),
|
|
15
15
|
sessionId: Type.String(),
|
|
@@ -18,7 +18,7 @@ const node = Type.Object({
|
|
|
18
18
|
from: Type.String(),
|
|
19
19
|
to: Type.String(),
|
|
20
20
|
ready: Type.Boolean({ description: "正文或摘要是否已生成。" }),
|
|
21
|
-
completed: Type.Boolean({ description: "
|
|
21
|
+
completed: Type.Boolean({ description: "false 表示会话或问答中断或未完成。" }),
|
|
22
22
|
});
|
|
23
23
|
export const historyResultSchema = Type.Object({
|
|
24
24
|
matches: Type.Optional(Type.Array(Type.Object({
|
|
@@ -46,23 +46,21 @@ export const historyResultSchema = Type.Object({
|
|
|
46
46
|
})),
|
|
47
47
|
warnings: Type.Array(Type.String()),
|
|
48
48
|
});
|
|
49
|
-
export const historyDescription = "
|
|
50
|
-
"search 按不区分大小写的连续关键词匹配原文与摘要,省略 query 列出各会话或指定维度摘要;" +
|
|
51
|
-
"read 按 id 读取正文与上下级(可从 monthly 汇总下钻至 session 摘要和 exchange 原文),用 nextOffset 与 nextChildrenOffset 分页续读。";
|
|
49
|
+
export const historyDescription = "查找工作区各宿主归档的问答和摘要。沿子节点可从月度汇总查到会话摘要和原始问答。";
|
|
52
50
|
export const historyParameters = Type.Object({
|
|
53
51
|
action: Type.Union([Type.Literal("search"), Type.Literal("read")], {
|
|
54
|
-
description: "search
|
|
52
|
+
description: "search 搜索或列出记录,read 按 id 读取正文和上下级。",
|
|
55
53
|
}),
|
|
56
|
-
host: nullable(Type.String({ pattern: historyIdentifierPattern.source, description: "
|
|
57
|
-
dimension: nullable(Type.String({ pattern: historyIdentifierPattern.source, description: "
|
|
58
|
-
query: nullable(Type.String({ description: "
|
|
59
|
-
sessionId: nullable(Type.String({ description: "
|
|
60
|
-
from: nullable(Type.String({ description: "
|
|
61
|
-
to: nullable(Type.String({ description: "
|
|
62
|
-
id: nullable(Type.String({ description: "
|
|
63
|
-
offset: nullable(Type.Integer({ minimum: 0, description: "search
|
|
64
|
-
limit: nullable(Type.Integer({ minimum: 1, maximum: historyPageLimits.read.max, description: `search
|
|
65
|
-
childrenOffset: nullable(Type.Integer({ minimum: 0, description: "
|
|
54
|
+
host: nullable(Type.String({ pattern: historyIdentifierPattern.source, description: "来源宿主,如 pi 或 claude。可筛选搜索结果或区分重名节点。" })),
|
|
55
|
+
dimension: nullable(Type.String({ pattern: historyIdentifierPattern.source, description: "search 的范围。raw 为原始问答,session、monthly 等为摘要维度。关键词搜索默认查全部。" })),
|
|
56
|
+
query: nullable(Type.String({ description: "search 匹配连续文本,忽略大小写。省略时列会话,指定摘要维度则列该维度的摘要。" })),
|
|
57
|
+
sessionId: nullable(Type.String({ description: "search 按原始会话 ID 筛选。" })),
|
|
58
|
+
from: nullable(Type.String({ description: "search 时间区间起点(含),用 ISO 日期或时间。" })),
|
|
59
|
+
to: nullable(Type.String({ description: "search 时间区间终点(含),仅填日期表示该日 UTC 零点。" })),
|
|
60
|
+
id: nullable(Type.String({ description: "read 必填。使用搜索结果、父节点或子节点的 id。" })),
|
|
61
|
+
offset: nullable(Type.Integer({ minimum: 0, description: "翻页传上页的 nextOffset。search 按条目,read 按正文字符,默认从 0 开始。" })),
|
|
62
|
+
limit: nullable(Type.Integer({ minimum: 1, maximum: historyPageLimits.read.max, description: `search 每页默认 ${historyPageLimits.search.default} 条,最多 ${historyPageLimits.search.max} 条。read 每页默认 ${historyPageLimits.read.default} 个字符。` })),
|
|
63
|
+
childrenOffset: nullable(Type.Integer({ minimum: 0, description: "read 的子节点起点,默认 0。翻页传上页的 nextChildrenOffset。" })),
|
|
66
64
|
}, { additionalProperties: false });
|
|
67
65
|
const valid = schema(historyParameters);
|
|
68
66
|
export function historyInput(value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "personal-bot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"registry": "https://registry.npmjs.org/",
|
|
12
12
|
"tag": "latest"
|
|
13
13
|
},
|
|
14
|
-
"description": "
|
|
14
|
+
"description": "Organize workspace files, search past conversations, use shared MCP tools, and delegate tasks to other assistants.",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"bin": {
|
|
17
17
|
"pbot": "./bin/pbot.mjs"
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# 协调者
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
委派时明确交付物和修改范围。并行协作时,同一文件由一人修改。另请助手独立复核时,把资料和问题交给新会话。
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
失败或中断后说明已完成部分、剩余工作与阻碍;需要用户决定的事项由你汇总提出。
|
|
5
|
+
由你整合结果。结论冲突时核对依据和口径,指出未决分歧。普通问答直接回复,可复用的结论和产物归入项目。
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# 通用专家
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
完成主会话交给你的任务。复核时独立核查,在回复中给出结论、依据位置和未能确认的问题。委派要求改文件时,直接修改指定范围并交回产物路径。其余正式资料由主会话整合。
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
可自主排查工具和环境问题;受阻且需要主会话或用户协助时,交回已有结果与具体阻碍。不递归委派其他助手;需要额外协作者时向主会话建议。
|
|
5
|
+
遇到工具或环境问题,先自行排查。需要协助或其他专家时,把已有结果、具体阻碍和所需帮助交回主会话,由主会话安排协作。
|
|
@@ -1,34 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pbot
|
|
3
|
-
description:
|
|
3
|
+
description: 初始化或检查 Personal Bot 工作区,检索、汇总或迁移历史归档。
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
用 `run_command` 从当前 Antigravity 工作区根目录执行用户选择的命令。将本技能路径末尾的 `/skills/pbot/SKILL.md` 去掉,即得 `<plugin-root>`。无参数时执行 `status`。
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
```sh
|
|
14
|
-
node "<plugin-root>/lib/plugin.js" antigravity init
|
|
15
|
-
node "<plugin-root>/lib/plugin.js" antigravity status
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
`init` 补建资料目录与根 `AGENTS.md` 并启用工作区,`status` 查看工作区及配置状态;省略参数时执行 `status`。
|
|
19
|
-
|
|
20
|
-
## 历史管理与检索
|
|
21
|
-
|
|
22
|
-
`--workspace` 传入当前会话的 `workspaceRoot`(工作区未启用时使用当前工作区根目录)。支持 `history status|list|summary|migrate|search|read`,保留用户指定参数(迁移预览加 `--dry-run`):
|
|
23
|
-
|
|
24
|
-
```sh
|
|
25
|
-
pbot history summary --workspace "<workspaceRoot>"
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
未安装全局 `pbot` 或版本不匹配时,直接运行随插件打包的 CLI:
|
|
9
|
+
- 查看状态用 `node "<plugin-root>/lib/plugin.js" antigravity status`。
|
|
10
|
+
- 初始化用同一命令将 `status` 换成 `init`。它会启用工作区,补建缺失的资料目录和根 `AGENTS.md`。
|
|
11
|
+
- 历史操作使用随插件提供的 CLI,保留用户指定的参数。`summary` 更新各维度,`summary monthly` 汇总已有会话摘要。迁移预览用 `migrate --dry-run`,其他用法见 `history --help`。
|
|
29
12
|
|
|
30
13
|
```sh
|
|
31
14
|
node "<plugin-root>/lib/extension/cli.js" history summary --workspace "<workspaceRoot>"
|
|
32
15
|
```
|
|
33
16
|
|
|
34
|
-
|
|
17
|
+
`<workspaceRoot>` 取当前会话的工作区根目录。
|
|
@@ -1,34 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pbot
|
|
3
|
-
description:
|
|
3
|
+
description: 初始化或检查 Personal Bot 工作区,检索、汇总或迁移历史归档。
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
从当前 Claude 工作区根目录用 Bash 执行用户选择的命令。无参数时执行 `status`。
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
```sh
|
|
14
|
-
node "${CLAUDE_SKILL_DIR}/../../../../lib/claude.js" init
|
|
15
|
-
node "${CLAUDE_SKILL_DIR}/../../../../lib/claude.js" status
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
`init` 补建资料目录与根 `AGENTS.md` 并启用工作区,`status` 查看工作区及配置状态;省略参数时执行 `status`。
|
|
19
|
-
|
|
20
|
-
## 历史管理与检索
|
|
21
|
-
|
|
22
|
-
`--workspace` 传入当前会话的 `workspaceRoot`(工作区未启用时使用当前工作区根目录)。支持 `history status|list|summary|migrate|search|read`,保留用户指定参数(迁移预览加 `--dry-run`):
|
|
23
|
-
|
|
24
|
-
```sh
|
|
25
|
-
pbot history summary --workspace "<workspaceRoot>"
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
未安装全局 `pbot` 或版本不匹配时,直接运行随插件打包的 CLI:
|
|
9
|
+
- 查看状态用 `node "${CLAUDE_SKILL_DIR}/../../../../lib/claude.js" status`。
|
|
10
|
+
- 初始化用同一命令将 `status` 换成 `init`。它会启用工作区,补建缺失的资料目录和根 `AGENTS.md`。
|
|
11
|
+
- 历史操作使用随插件提供的 CLI,保留用户指定的参数。`summary` 更新各维度,`summary monthly` 汇总已有会话摘要。迁移预览用 `migrate --dry-run`,其他用法见 `history --help`。
|
|
29
12
|
|
|
30
13
|
```sh
|
|
31
14
|
node "${CLAUDE_SKILL_DIR}/../../../../lib/extension/cli.js" history summary --workspace "<workspaceRoot>"
|
|
32
15
|
```
|
|
33
16
|
|
|
34
|
-
|
|
17
|
+
`<workspaceRoot>` 取当前会话的工作区根目录。
|