personal-bot 0.2.14 → 0.2.16
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 +10 -11
- package/README.zh-CN.md +10 -11
- package/docs/README.md +2 -2
- package/docs/adr/0001-claude-skill-discovery.md +1 -1
- package/docs/agent-collaboration.md +8 -9
- package/docs/architecture-guidelines.md +1 -1
- package/docs/capability-design.md +2 -2
- package/docs/claude-code-design.md +10 -11
- package/docs/claude-code.md +8 -15
- package/docs/dsh.md +18 -19
- package/docs/file-storage.md +2 -3
- package/docs/installation-design.md +4 -5
- package/docs/interaction-design.md +1 -1
- package/docs/model-context.md +9 -10
- package/docs/release.md +5 -5
- package/docs/technical-design.md +16 -21
- package/docs/workspace-configuration.md +5 -8
- package/hooks/hooks.json +1 -4
- package/lib/client.js +3 -15
- package/lib/common/schema.d.ts +2 -0
- package/lib/common/schema.js +9 -0
- package/lib/extension/acp-member.js +1 -3
- package/lib/extension/acp-worker.js +3 -22
- package/lib/extension/claude-hooks.d.ts +0 -6
- package/lib/extension/claude-hooks.js +5 -31
- package/lib/extension/dsh/acp-member.js +1 -2
- package/lib/extension/dsh/command.js +13 -23
- package/lib/extension/dsh/management.d.ts +1 -1
- package/lib/extension/dsh/management.js +3 -3
- package/lib/extension/dsh/workspace.d.ts +1 -9
- package/lib/extension/dsh/workspace.js +4 -31
- package/lib/extension/setup-cli.js +4 -4
- package/lib/integrations/dsh/dsh-agents.d.ts +1 -2
- package/lib/integrations/dsh/dsh-agents.js +0 -4
- package/lib/integrations/dsh/resources.d.ts +1 -5
- package/lib/integrations/dsh/resources.js +2 -5
- package/lib/integrations/installation/processes.js +0 -15
- package/lib/model/agent.d.ts +0 -1
- package/lib/services/agents/agent-notices.js +1 -1
- package/lib/services/agents/agent-service.js +3 -2
- package/lib/services/agents/start-options.d.ts +4 -0
- package/lib/services/agents/start-options.js +20 -0
- package/lib/tools/agents/actions.d.ts +1 -5
- package/lib/tools/agents/actions.js +12 -1
- package/lib/tools/agents/contract.d.ts +50 -77
- package/lib/tools/agents/contract.js +54 -32
- package/lib/tools/agents/dsh-tool.js +6 -11
- package/lib/tools/history/contract.d.ts +28 -11
- package/lib/tools/history/contract.js +18 -12
- package/lib/tools/input.d.ts +11 -0
- package/lib/tools/input.js +23 -0
- package/lib/tools/teams/actions.d.ts +3 -4
- package/lib/tools/teams/actions.js +7 -5
- package/lib/tools/teams/contract.d.ts +56 -87
- package/lib/tools/teams/contract.js +55 -31
- package/lib/tools/teams/dsh-tool.js +7 -18
- package/lib/ui/dsh/management.js +1 -9
- package/lib/ui/dsh/styles.d.ts +1 -1
- package/lib/ui/dsh/styles.js +2 -2
- package/lib/ui/presentation.js +1 -1
- package/package.json +1 -4
- package/resources/claude/skills/pbot/SKILL.md +2 -3
- package/resources/prompts/native-coordinator.md +1 -1
- package/resources/prompts/workspace.md +1 -1
- package/resources/references/compute.md +6 -8
- package/scripts/README.md +2 -6
- package/src/common/schema.ts +10 -0
- package/src/extension/acp-member.ts +1 -3
- package/src/extension/acp-worker.ts +3 -12
- package/src/extension/agent-events.ts +1 -1
- package/src/extension/claude-hooks.ts +5 -25
- package/src/extension/command.ts +7 -16
- package/src/extension/dsh/acp-member.ts +1 -2
- package/src/extension/dsh/command.ts +14 -23
- package/src/extension/dsh/management.ts +3 -3
- package/src/extension/dsh/workspace.ts +5 -26
- package/src/extension/events.ts +2 -11
- package/src/extension/lifecycle.ts +8 -23
- package/src/extension/setup-cli.ts +4 -4
- package/src/extension/subagent-entry.ts +6 -12
- package/src/integrations/dsh/dsh-agents.ts +1 -4
- package/src/integrations/dsh/resources.ts +2 -5
- package/src/integrations/installation/processes.ts +0 -13
- package/src/integrations/pi/pi-agents.ts +12 -5
- package/src/model/agent.ts +1 -1
- package/src/pbot.ts +1 -2
- package/src/services/agents/agent-notices.ts +1 -1
- package/src/services/agents/agent-service.ts +4 -2
- package/src/services/agents/start-options.ts +19 -0
- package/src/tools/agents/actions.ts +18 -10
- package/src/tools/agents/contract.ts +68 -33
- package/src/tools/agents/dsh-tool.ts +7 -12
- package/src/tools/agents/tool.ts +2 -8
- package/src/tools/history/actions.ts +1 -1
- package/src/tools/history/contract.ts +27 -14
- package/src/tools/input.ts +29 -0
- package/src/tools/teams/actions.ts +10 -14
- package/src/tools/teams/contract.ts +71 -33
- package/src/tools/teams/dsh-tool.ts +7 -18
- package/src/tools/teams/tool.ts +3 -13
- package/src/ui/dsh/management.ts +2 -8
- package/src/ui/dsh/styles.ts +2 -2
- package/src/ui/presentation.ts +1 -1
- package/lib/integrations/process.d.ts +0 -14
- package/lib/integrations/process.js +0 -48
- package/lib/integrations/python-activation.d.ts +0 -2
- package/lib/integrations/python-activation.js +0 -29
- package/lib/services/workspace/python-environment-service.d.ts +0 -21
- package/lib/services/workspace/python-environment-service.js +0 -66
- package/lib/tools/agents/dsh-contract.d.ts +0 -45
- package/lib/tools/agents/dsh-contract.js +0 -19
- package/python/README.md +0 -72
- package/python/requirements.lock +0 -38
- package/scripts/setup-python.py +0 -170
- package/src/integrations/process.ts +0 -40
- package/src/integrations/python-activation.ts +0 -23
- package/src/services/workspace/python-environment-service.ts +0 -61
- package/src/tools/agents/dsh-contract.ts +0 -20
|
@@ -1,77 +1,69 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
|
-
export declare const teamDescription = "\u7EC4\u7EC7\u56FA\u5B9A\u6210\u5458\u534F\u4F5C\u3002create \u5EFA\u7ACB\u56E2\u961F\uFF0Crun \u5F00\u59CB\u4E00\u6279\u8BA8\u8BBA\u3002\u8FD0\u884C\u65F6\u5360\u7528\u6210\u5458\uFF1Bpause \u505C\u6B62\u65B0\u5B89\u6392\uFF0C\u5141\u8BB8\u5728\u9014\u5DE5\u4F5C\u6536\u5C3E\uFF0C\u4E4B\u540E\u53EF\u79C1\u4EBA send\uFF1B\u4E2D\u6B62\u6210\u5458\u7528 pbot_agent stop\u3002close \u4FDD\u7559\u6210\u5458\u548C\u5386\u53F2\uFF1B\u6362\u6210\u5458\u987B\u5173\u95ED\u65E7\u56E2\u961F\u518D\u521B\u5EFA\u3002\u7EE7\u7EED\u8BA8\u8BBA\u7528 run \u63D0\u4EA4\u65B0\u8981\u6C42\u3002\
|
|
2
|
+
export declare const teamDescription = "\u7EC4\u7EC7\u56FA\u5B9A\u6210\u5458\u534F\u4F5C\u3002create \u5EFA\u7ACB\u56E2\u961F\uFF0Crun \u5F00\u59CB\u4E00\u6279\u8BA8\u8BBA\u3002\u8FD0\u884C\u65F6\u5360\u7528\u6210\u5458\uFF1Bpause \u505C\u6B62\u65B0\u5B89\u6392\uFF0C\u5141\u8BB8\u5728\u9014\u5DE5\u4F5C\u6536\u5C3E\uFF0C\u4E4B\u540E\u53EF\u79C1\u4EBA send\uFF1B\u4E2D\u6B62\u6210\u5458\u7528 pbot_agent stop\u3002close \u4FDD\u7559\u6210\u5458\u548C\u5386\u53F2\uFF1B\u6362\u6210\u5458\u987B\u5173\u95ED\u65E7\u56E2\u961F\u518D\u521B\u5EFA\u3002\u7EE7\u7EED\u8BA8\u8BBA\u7528 run \u63D0\u4EA4\u65B0\u8981\u6C42\u3002\u56E2\u961F\u72B6\u6001\u4E0E\u6279\u6B21\u7528 status\uFF1B\u516C\u5171\u539F\u6587\u7528 pbot_team_message read/post\u3002";
|
|
3
3
|
export declare const teamMessageDescription = "\u8BFB\u5199\u56E2\u961F\u516C\u5171\u539F\u6587\u3002post \u5411\u5168\u4F53\u6210\u5458\u53D1\u5E03\u4FE1\u606F\uFF0C\u9700\u8981\u5B89\u6392\u56DE\u7B54\u65F6\u7531\u4E3B\u4F1A\u8BDD\u8C03\u7528 pbot_team run\uFF1B\u6210\u5458\u53EA\u80FD\u5728\u81EA\u5DF1\u7684\u56E2\u961F\u5DE5\u4F5C\u4E2D post\u3002read \u7528 afterSeq \u7FFB\u9875\uFF0C\u957F\u6B63\u6587\u6309 seq/offset \u7EED\u8BFB\uFF0C\u5148\u8865\u5B8C nextOffset \u975E\u7A7A\u7684\u6D88\u606F\u3002";
|
|
4
4
|
export declare const teamParametersSchema: Type.TObject<{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
instruction: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
6
|
+
mode: Type.TOptional<Type.TUnion<[Type.TUnion<[Type.TLiteral<"roundRobin">, Type.TLiteral<"parallel">]>, Type.TNull]>>;
|
|
7
|
+
rounds: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
8
|
+
maxConcurrent: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
9
|
+
timeoutSeconds: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
9
10
|
action: Type.TUnion<Type.TLiteral<string>[]>;
|
|
10
|
-
teamId: Type.TOptional<Type.TString
|
|
11
|
-
name: Type.TOptional<Type.TString
|
|
12
|
-
brief: Type.TOptional<Type.TString
|
|
13
|
-
members: Type.TOptional<Type.TArray<Type.TObject<{
|
|
11
|
+
teamId: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
12
|
+
name: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
13
|
+
brief: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
14
|
+
members: Type.TOptional<Type.TUnion<[Type.TArray<Type.TObject<{
|
|
14
15
|
agentId: Type.TString;
|
|
15
16
|
role: Type.TString;
|
|
16
|
-
}
|
|
17
|
-
instruction: Type.TOptional<Type.TString>;
|
|
18
|
-
mode: Type.TOptional<Type.TUnion<[Type.TLiteral<"roundRobin">, Type.TLiteral<"parallel">]>>;
|
|
19
|
-
rounds: Type.TOptional<Type.TInteger>;
|
|
20
|
-
maxConcurrent: Type.TOptional<Type.TInteger>;
|
|
21
|
-
timeoutSeconds: Type.TOptional<Type.TInteger>;
|
|
17
|
+
}>>, Type.TNull]>>;
|
|
22
18
|
}>;
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
offset: Type.TOptional<Type.TInteger>;
|
|
48
|
-
limit: Type.TOptional<Type.TInteger>;
|
|
49
|
-
action: Type.TLiteral<"read">;
|
|
50
|
-
teamId: Type.TString;
|
|
51
|
-
}>]>;
|
|
19
|
+
export type TeamMember = {
|
|
20
|
+
agentId: string;
|
|
21
|
+
role: string;
|
|
22
|
+
};
|
|
23
|
+
export type TeamInput = {
|
|
24
|
+
action: "create";
|
|
25
|
+
name: string;
|
|
26
|
+
brief: string;
|
|
27
|
+
members: TeamMember[];
|
|
28
|
+
} | {
|
|
29
|
+
action: "list";
|
|
30
|
+
} | {
|
|
31
|
+
action: "status" | "pause" | "close";
|
|
32
|
+
teamId: string;
|
|
33
|
+
} | {
|
|
34
|
+
action: "run";
|
|
35
|
+
teamId: string;
|
|
36
|
+
instruction: string;
|
|
37
|
+
mode: "roundRobin" | "parallel";
|
|
38
|
+
rounds?: number;
|
|
39
|
+
maxConcurrent?: number;
|
|
40
|
+
timeoutSeconds?: number;
|
|
41
|
+
};
|
|
42
|
+
export declare function teamInput(value: unknown): TeamInput;
|
|
52
43
|
export declare const teamMessageParametersSchema: Type.TObject<{
|
|
53
|
-
afterSeq: Type.TOptional<Type.TInteger
|
|
54
|
-
seq: Type.TOptional<Type.TInteger
|
|
55
|
-
offset: Type.TOptional<Type.TInteger
|
|
56
|
-
limit: Type.TOptional<Type.TInteger
|
|
44
|
+
afterSeq: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
45
|
+
seq: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
46
|
+
offset: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
47
|
+
limit: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
57
48
|
action: Type.TUnion<[Type.TLiteral<"read">, Type.TLiteral<"post">]>;
|
|
58
|
-
teamId: Type.TString
|
|
59
|
-
text: Type.TOptional<Type.TString
|
|
60
|
-
replyTo: Type.TOptional<Type.TInteger
|
|
49
|
+
teamId: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
50
|
+
text: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
51
|
+
replyTo: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
61
52
|
}>;
|
|
62
|
-
export
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
action:
|
|
71
|
-
teamId:
|
|
72
|
-
text:
|
|
73
|
-
replyTo
|
|
74
|
-
}
|
|
53
|
+
export type TeamMessageInput = {
|
|
54
|
+
action: "read";
|
|
55
|
+
teamId: string;
|
|
56
|
+
afterSeq?: number;
|
|
57
|
+
seq?: number;
|
|
58
|
+
offset?: number;
|
|
59
|
+
limit?: number;
|
|
60
|
+
} | {
|
|
61
|
+
action: "post";
|
|
62
|
+
teamId: string;
|
|
63
|
+
text: string;
|
|
64
|
+
replyTo?: number;
|
|
65
|
+
};
|
|
66
|
+
export declare function teamMessageInput(value: unknown): TeamMessageInput;
|
|
75
67
|
export declare const teamPageSchema: Type.TObject<{
|
|
76
68
|
teamId: Type.TString;
|
|
77
69
|
messages: Type.TArray<Type.TObject<{
|
|
@@ -178,29 +170,6 @@ export declare const teamResultSchema: Type.TUnion<[Type.TUnion<[Type.TObject<{
|
|
|
178
170
|
closed: Type.TBoolean;
|
|
179
171
|
owned: Type.TLiteral<false>;
|
|
180
172
|
}>]>>;
|
|
181
|
-
}>, Type.TObject<{
|
|
182
|
-
teamId: Type.TString;
|
|
183
|
-
messages: Type.TArray<Type.TObject<{
|
|
184
|
-
seq: Type.TInteger;
|
|
185
|
-
operationId: Type.TString;
|
|
186
|
-
author: Type.TObject<{
|
|
187
|
-
kind: Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"coordinator">, Type.TLiteral<"member">]>;
|
|
188
|
-
agentId: Type.TOptional<Type.TString>;
|
|
189
|
-
name: Type.TString;
|
|
190
|
-
}>;
|
|
191
|
-
text: Type.TString;
|
|
192
|
-
replyTo: Type.TOptional<Type.TInteger>;
|
|
193
|
-
runId: Type.TOptional<Type.TString>;
|
|
194
|
-
source: Type.TOptional<Type.TObject<{
|
|
195
|
-
requestId: Type.TString;
|
|
196
|
-
cycleId: Type.TString;
|
|
197
|
-
}>>;
|
|
198
|
-
offset: Type.TInteger;
|
|
199
|
-
totalLength: Type.TInteger;
|
|
200
|
-
nextOffset: Type.TUnion<[Type.TInteger, Type.TNull]>;
|
|
201
|
-
}>>;
|
|
202
|
-
lastSeq: Type.TInteger;
|
|
203
|
-
nextAfterSeq: Type.TUnion<[Type.TInteger, Type.TNull]>;
|
|
204
173
|
}>]>;
|
|
205
174
|
export declare const teamMessageResultSchema: Type.TUnion<[Type.TObject<{
|
|
206
175
|
teamId: Type.TString;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Type } from "../../common/typebox.js";
|
|
2
|
-
|
|
2
|
+
import { schema } from "../../common/schema.js";
|
|
3
|
+
import { inputObject, need, nullable, pick } from "../input.js";
|
|
4
|
+
export const teamDescription = "组织固定成员协作。create 建立团队,run 开始一批讨论。运行时占用成员;pause 停止新安排,允许在途工作收尾,之后可私人 send;中止成员用 pbot_agent stop。close 保留成员和历史;换成员须关闭旧团队再创建。继续讨论用 run 提交新要求。团队状态与批次用 status;公共原文用 pbot_team_message read/post。";
|
|
3
5
|
export const teamMessageDescription = "读写团队公共原文。post 向全体成员发布信息,需要安排回答时由主会话调用 pbot_team run;成员只能在自己的团队工作中 post。read 用 afterSeq 翻页,长正文按 seq/offset 续读,先补完 nextOffset 非空的消息。";
|
|
4
6
|
const id = Type.String({ minLength: 1, maxLength: 128 });
|
|
5
7
|
const text = Type.String({ minLength: 1, maxLength: 24000 });
|
|
@@ -8,43 +10,65 @@ const mode = Type.Union([Type.Literal("roundRobin"), Type.Literal("parallel")],
|
|
|
8
10
|
const members = Type.Array(Type.Object({ agentId: id, role: Type.String({ minLength: 1, maxLength: 4000 }) }, { additionalProperties: false }), {
|
|
9
11
|
minItems: 1, maxItems: 50, description: "仅 create,必填:当前分支中的固定成员及职责;成员须版本兼容且未加入其他未关闭团队。",
|
|
10
12
|
});
|
|
11
|
-
const
|
|
12
|
-
instruction: Type.String({ ...text, description: "仅 run,必填:本批次的任务、约束与交付要求。" }),
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
const page = {
|
|
18
|
-
afterSeq: Type.Optional(Type.Integer({ minimum: 0, description: "仅 read:读取序号大于此值的消息,默认 0,不得超过 lastSeq。返回 nextAfterSeq 用于继续消息列表;单条续读使用 seq/offset,省略 afterSeq。先补完被截断的正文,再继续列表。" })),
|
|
19
|
-
seq: Type.Optional(Type.Integer({ minimum: 1, description: "仅 read:指定一条消息,配合该消息的 nextOffset 续读。未指定时从 afterSeq 后顺序读取。" })),
|
|
20
|
-
offset: Type.Optional(Type.Integer({ minimum: 0, description: "仅 read:指定 seq 的正文 UTF-16 字符偏移,默认 0;非零时必须同时提供 seq。" })),
|
|
21
|
-
limit: Type.Optional(Type.Integer({ minimum: 1, maximum: 16000, description: "仅 read:本页所有消息正文合计的 UTF-16 字符上限,默认 16000,不是消息条数或 token 数;不含元数据和 Markdown 格式开销。" })),
|
|
13
|
+
const runFields = {
|
|
14
|
+
instruction: nullable(Type.String({ ...text, description: "仅 run,必填:本批次的任务、约束与交付要求。" })),
|
|
15
|
+
mode: nullable(mode),
|
|
16
|
+
rounds: nullable(Type.Integer({ minimum: 1, maximum: 10, description: "仅 run:每位成员的轮数,默认 2。" })),
|
|
17
|
+
maxConcurrent: nullable(Type.Integer({ minimum: 1, maximum: 50, description: "仅 run:roundRobin 默认且只允许 1;parallel 默认 min(2, 成员数)。不得超过成员数;待处理和执行中的发言都计入上限。" })),
|
|
18
|
+
timeoutSeconds: nullable(Type.Integer({ minimum: 1, maximum: 86400, description: "仅 run:整批期限,默认 900 秒,包含所有轮次和等待。到期停止安排并尝试中止尚未人工接管的工作,之后仍须核对实际状态;pause 则允许在途工作收尾。" })),
|
|
22
19
|
};
|
|
23
20
|
const object = (fields) => Type.Object(fields, { additionalProperties: false });
|
|
24
21
|
export const teamParametersSchema = object({
|
|
25
|
-
action: Type.Union(["create", "list", "status", "
|
|
26
|
-
description: "create 必填 name/brief/members;list
|
|
22
|
+
action: Type.Union(["create", "list", "status", "run", "pause", "close"].map(value => Type.Literal(value)), {
|
|
23
|
+
description: "create 必填 name/brief/members;list 只需 action;status/pause/close 必填 teamId;run 必填 teamId/instruction/mode,可选 rounds/maxConcurrent/timeoutSeconds。动作只读取自己的字段;其他已声明字段忽略。run 前须确认所有成员存活、idle、可参与团队且无待处理私人输入,团队未关闭,也无运行批次或在途工作。close 前先暂停并等待在途工作结束。",
|
|
27
24
|
}),
|
|
28
|
-
teamId:
|
|
29
|
-
instruction: Type.Optional(run.instruction), mode: Type.Optional(mode), rounds: run.rounds, maxConcurrent: run.maxConcurrent, timeoutSeconds: run.timeoutSeconds, ...page,
|
|
25
|
+
teamId: nullable(id), name: nullable(name), brief: nullable(text), members: nullable(members), ...runFields,
|
|
30
26
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
const validTeam = schema(teamParametersSchema);
|
|
28
|
+
export function teamInput(value) {
|
|
29
|
+
const args = inputObject(value, validTeam, "团队参数格式无效");
|
|
30
|
+
const action = args.action;
|
|
31
|
+
switch (action) {
|
|
32
|
+
case "create":
|
|
33
|
+
return { action, name: need("create", args, "name"), brief: need("create", args, "brief"), members: need("create", args, "members") };
|
|
34
|
+
case "list":
|
|
35
|
+
return { action };
|
|
36
|
+
case "status":
|
|
37
|
+
case "pause":
|
|
38
|
+
case "close":
|
|
39
|
+
return { action, teamId: need(action, args, "teamId") };
|
|
40
|
+
case "run":
|
|
41
|
+
return { action, teamId: need("run", args, "teamId"), instruction: need("run", args, "instruction"), mode: need("run", args, "mode"),
|
|
42
|
+
...(args.rounds === undefined ? {} : { rounds: args.rounds }),
|
|
43
|
+
...(args.maxConcurrent === undefined ? {} : { maxConcurrent: args.maxConcurrent }),
|
|
44
|
+
...(args.timeoutSeconds === undefined ? {} : { timeoutSeconds: args.timeoutSeconds }) };
|
|
45
|
+
default:
|
|
46
|
+
throw new Error("未知的团队 action。");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const page = {
|
|
50
|
+
afterSeq: nullable(Type.Integer({ minimum: 0, description: "仅 read:读取序号大于此值的消息,默认 0,不得超过 lastSeq。返回 nextAfterSeq 用于继续消息列表;单条续读使用 seq/offset,省略 afterSeq。先补完被截断的正文,再继续列表。" })),
|
|
51
|
+
seq: nullable(Type.Integer({ minimum: 1, description: "仅 read:指定一条消息,配合该消息的 nextOffset 续读。未指定时从 afterSeq 后顺序读取。" })),
|
|
52
|
+
offset: nullable(Type.Integer({ minimum: 0, description: "仅 read:指定 seq 的正文 UTF-16 字符偏移,默认 0;非零时必须同时提供 seq。" })),
|
|
53
|
+
limit: nullable(Type.Integer({ minimum: 1, maximum: 16000, description: "仅 read:本页所有消息正文合计的 UTF-16 字符上限,默认 16000,不是消息条数或 token 数;不含元数据和 Markdown 格式开销。" })),
|
|
54
|
+
};
|
|
38
55
|
export const teamMessageParametersSchema = object({
|
|
39
56
|
action: Type.Union([Type.Literal("read"), Type.Literal("post")], {
|
|
40
|
-
description: "read 必填 teamId
|
|
41
|
-
}), teamId: id, text:
|
|
42
|
-
replyTo:
|
|
57
|
+
description: "read 必填 teamId,可选 afterSeq/seq/offset/limit;post 必填 teamId/text,可选 replyTo。动作只读取自己的字段;其他已声明字段忽略。",
|
|
58
|
+
}), teamId: nullable(id), text: nullable(Type.String({ ...text, description: "仅 post,必填:向全体成员公开的原文。" })),
|
|
59
|
+
replyTo: nullable(Type.Integer({ minimum: 1, description: "仅 post:回复已有消息的 seq。" })), ...page,
|
|
43
60
|
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
61
|
+
const validMessage = schema(teamMessageParametersSchema);
|
|
62
|
+
export function teamMessageInput(value) {
|
|
63
|
+
const args = inputObject(value, validMessage, "团队消息参数格式无效");
|
|
64
|
+
if (args.action === "read")
|
|
65
|
+
return { action: "read", teamId: need("read", args, "teamId"),
|
|
66
|
+
...pick(args, ["afterSeq", "seq", "offset", "limit"]) };
|
|
67
|
+
if (args.action === "post")
|
|
68
|
+
return { action: "post", teamId: need("post", args, "teamId"), text: need("post", args, "text"),
|
|
69
|
+
...(args.replyTo === undefined ? {} : { replyTo: args.replyTo }) };
|
|
70
|
+
throw new Error("未知的团队消息 action。");
|
|
71
|
+
}
|
|
48
72
|
const message = object({ seq: Type.Integer(), operationId: Type.String(),
|
|
49
73
|
author: object({ kind: Type.Union([Type.Literal("user"), Type.Literal("coordinator"), Type.Literal("member")]), agentId: Type.Optional(id), name: Type.String() }),
|
|
50
74
|
text: Type.String(), replyTo: Type.Optional(Type.Integer()), runId: Type.Optional(id),
|
|
@@ -63,5 +87,5 @@ const ownedView = object({ teamId: id, name: Type.String(), brief: Type.String()
|
|
|
63
87
|
run: Type.Optional(object({ runId: id, instruction: Type.String(), mode, state: Type.Union([Type.Literal("running"), Type.Literal("paused"), Type.Literal("finished")]),
|
|
64
88
|
rounds: Type.Integer(), maxConcurrent: Type.Integer(), deadlineAt: Type.Number(), scheduled: Type.Integer(), published: Type.Integer(), reason: Type.Optional(Type.String()) })) });
|
|
65
89
|
const view = Type.Union([ownedView, object({ teamId: id, name: Type.String(), closed: Type.Boolean(), owned: Type.Literal(false) })]);
|
|
66
|
-
export const teamResultSchema = Type.Union([view, object({ teams: Type.Array(view) })
|
|
90
|
+
export const teamResultSchema = Type.Union([view, object({ teams: Type.Array(view) })]);
|
|
67
91
|
export const teamMessageResultSchema = Type.Union([teamPageSchema, object({ teamId: id, seq: Type.Integer(), status: Type.Literal("stored") })]);
|
|
@@ -5,30 +5,22 @@ import { schema } from "../../common/schema.js";
|
|
|
5
5
|
import { markdownFields } from "../../common/markdown.js";
|
|
6
6
|
import { teamMessagesMarkdown } from "../../integrations/team-context.js";
|
|
7
7
|
import { executeTeam, executeTeamMessage } from "./actions.js";
|
|
8
|
-
import { teamDescription, teamMessageDescription,
|
|
8
|
+
import { teamDescription, teamMessageDescription, teamInput, teamMessageInput, teamParametersSchema, teamResultSchema, teamMessageParametersSchema, teamMessageResultSchema } from "./contract.js";
|
|
9
9
|
export function registerDshTeamTool(ctx, agent, service, agents, owner, check) {
|
|
10
|
-
const validators = new Map(teamActionSchema.anyOf.map(row => [row.properties.action.const, schema(row)]));
|
|
11
10
|
const validOutput = schema(teamResultSchema);
|
|
12
11
|
ctx.tools.register({ name: "pbot_team", description: teamDescription, parameters: dshParameters(teamParametersSchema),
|
|
13
|
-
output: {
|
|
14
|
-
schema: dshOutputSchema(teamResultSchema),
|
|
15
|
-
render: (args, value) => [{ type: "text", text: object(args) && args.action === "read"
|
|
16
|
-
? teamMessagesMarkdown(value) : "# 团队\n\n" + markdownFields(value) }],
|
|
17
|
-
},
|
|
12
|
+
output: { schema: dshOutputSchema(teamResultSchema), render: (_args, value) => [{ type: "text", text: "# 团队\n\n" + markdownFields(value) }] },
|
|
18
13
|
async execute(args, exec) {
|
|
19
14
|
check();
|
|
20
15
|
exec.signal.throwIfAborted();
|
|
21
|
-
requireThat(exec.agent === agent
|
|
22
|
-
const
|
|
23
|
-
requireThat(valid && valid(args), "团队参数无效。");
|
|
24
|
-
const value = executeTeam(service, agents, args, owner).structuredContent;
|
|
16
|
+
requireThat(exec.agent === agent, "团队工具不属于当前会话。");
|
|
17
|
+
const value = executeTeam(service, agents, teamInput(args), owner).structuredContent;
|
|
25
18
|
requireThat(validOutput(value), "团队输出不符合契约。");
|
|
26
19
|
return value;
|
|
27
20
|
},
|
|
28
21
|
});
|
|
29
22
|
}
|
|
30
23
|
export function registerDshTeamMessageTool(ctx, agent, service, actor, check) {
|
|
31
|
-
const validators = new Map(teamMessageActionSchema.anyOf.map(row => [row.properties.action.const, schema(row)]));
|
|
32
24
|
const validOutput = schema(teamMessageResultSchema);
|
|
33
25
|
ctx.tools.register({ name: "pbot_team_message", description: teamMessageDescription, parameters: dshParameters(teamMessageParametersSchema),
|
|
34
26
|
output: {
|
|
@@ -39,12 +31,9 @@ export function registerDshTeamMessageTool(ctx, agent, service, actor, check) {
|
|
|
39
31
|
async execute(args, exec) {
|
|
40
32
|
check();
|
|
41
33
|
exec.signal.throwIfAborted();
|
|
42
|
-
requireThat(exec.agent === agent
|
|
43
|
-
const
|
|
44
|
-
requireThat(valid && valid(args), "团队消息参数无效。");
|
|
45
|
-
const value = executeTeamMessage(service, args, actor(), exec.callId).structuredContent;
|
|
34
|
+
requireThat(exec.agent === agent, "团队消息工具不属于当前会话。");
|
|
35
|
+
const value = executeTeamMessage(service, teamMessageInput(args), actor(), exec.callId).structuredContent;
|
|
46
36
|
requireThat(validOutput(value), "团队消息输出不符合契约。");
|
|
47
37
|
return value;
|
|
48
|
-
},
|
|
49
|
-
});
|
|
38
|
+
}, });
|
|
50
39
|
}
|
package/lib/ui/dsh/management.js
CHANGED
|
@@ -160,8 +160,6 @@ export function showManagement(ctx, parentSessionId) {
|
|
|
160
160
|
const materials = group(status, "pbot-setting");
|
|
161
161
|
materials.append(element("h3", "资料目录"));
|
|
162
162
|
const initializeButton = button(materials, "准备目录", async () => { await command("init", undefined, "工作区已初始化并启用。"); });
|
|
163
|
-
const pythonCard = group(status, "pbot-setting"), pythonInfo = group(pythonCard);
|
|
164
|
-
const pythonButton = button(pythonCard, "准备 Python", async () => { await command("python setup", undefined, "Python 准备完成。"); });
|
|
165
163
|
const diagnostic = details(status, "环境详情"), statusBody = block("");
|
|
166
164
|
statusBody.classList.add("pbot-raw");
|
|
167
165
|
diagnostic.append(statusBody);
|
|
@@ -643,13 +641,11 @@ export function showManagement(ctx, parentSessionId) {
|
|
|
643
641
|
const configuration = record(snapshot.configuration);
|
|
644
642
|
counts.textContent = configuration.error ? "Personal Bot 配置错误" : "Personal Bot 未启用";
|
|
645
643
|
workspaceInfo.replaceChildren(facts([["状态", configuration.error ? "配置错误" : "未启用"], ["工作区", snapshot.workspaceRoot], ["配置文件", configuration.path]]), note(configuration.error ? "修复配置文件后执行 /pbot init。" : "执行 /pbot init,或点击下方按钮初始化并启用。"));
|
|
646
|
-
pythonInfo.replaceChildren(note("启用工作区后自动准备共享 Python 环境。"));
|
|
647
644
|
materials.hidden = false;
|
|
648
645
|
initializeButton.textContent = "初始化并启用";
|
|
649
646
|
enabled(initializeButton, !configuration.error);
|
|
650
647
|
for (const [id, control] of tabs)
|
|
651
648
|
enabled(control, id === "status");
|
|
652
|
-
enabled(pythonButton, false);
|
|
653
649
|
activate("status");
|
|
654
650
|
statusBody.textContent = JSON.stringify(snapshot, null, 2);
|
|
655
651
|
if (configuration.error)
|
|
@@ -661,7 +657,7 @@ export function showManagement(ctx, parentSessionId) {
|
|
|
661
657
|
materials.hidden = false;
|
|
662
658
|
initializeButton.textContent = "准备目录";
|
|
663
659
|
enabled(initializeButton, true);
|
|
664
|
-
const agents = rows(snapshot.agents), teams = rows(snapshot.teams),
|
|
660
|
+
const agents = rows(snapshot.agents), teams = rows(snapshot.teams), history = record(snapshot.history);
|
|
665
661
|
tabCounts.get("experts").textContent = text(agents.length);
|
|
666
662
|
tabCounts.get("teams").textContent = text(teams.length);
|
|
667
663
|
const active = agents.filter(agent => ["starting", "busy", "stopping"].includes(text(agent.state))).length;
|
|
@@ -669,10 +665,6 @@ export function showManagement(ctx, parentSessionId) {
|
|
|
669
665
|
const model = object(snapshot.model) ? snapshot.model : {};
|
|
670
666
|
workspaceInfo.replaceChildren(facts([["状态", "已启动"], ["工作区", snapshot.workspaceRoot], ["配置文件", record(snapshot.configuration).path], ["模型", model.model || "尚未选择"], ["Provider", model.provider || "—"],
|
|
671
667
|
["历史", history.organizing ? "整理中" : history.pending === null ? "查询时更新索引" : `${history.pending} 项待整理`]]));
|
|
672
|
-
pythonInfo.replaceChildren(element("h3", "Python"), badge(python.state));
|
|
673
|
-
if (python.error)
|
|
674
|
-
pythonInfo.append(element("p", text(python.error), "pbot-warning"));
|
|
675
|
-
enabled(pythonButton, python.state !== "preparing");
|
|
676
668
|
const { agents: _agents, teams: _teams, ...summary } = snapshot;
|
|
677
669
|
statusBody.textContent = JSON.stringify(summary, null, 2);
|
|
678
670
|
const pending = rows(snapshot.permissions), nextPermissionKey = pending.map(request => text(request.agentId) + ":" + text(request.requestId)).join(",");
|
package/lib/ui/dsh/styles.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const managementStyles = "\n.pbot-management {\n --pbot-bg: var(--dsw-alias-bg-base, #f8f9fb);\n --pbot-surface: var(--dsw-alias-bg-layer-1, #fff);\n --pbot-ink: var(--dsw-alias-label-primary, #20232b);\n --pbot-muted: var(--dsw-alias-label-secondary, #696e79);\n --pbot-line: var(--dsw-alias-border-l2, #e3e5eb);\n --pbot-accent: var(--dsw-alias-brand-primary, #4d6bfe);\n --pbot-tint: color-mix(in srgb, var(--pbot-accent) 9%, var(--pbot-surface));\n --pbot-danger: var(--dsw-alias-state-error-primary, #c93535);\n width: min(1180px, calc(100vw - 48px)); height: min(820px, calc(100dvh - 64px));\n max-width: none; max-height: none; padding: 0; margin: auto; overflow: hidden;\n border: 1px solid var(--pbot-line); border-radius: 12px; color: var(--pbot-ink); background: var(--pbot-surface);\n box-shadow: 0 12px 40px #0002; font: 14px/1.55 var(--dsw-font-family, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif);\n}\n.pbot-management::backdrop { background: #10182866; }\n.pbot-management *, .pbot-management *::before, .pbot-management *::after { box-sizing: border-box; }\n.pbot-management [hidden] { display: none !important; }\n.pbot-management h2, .pbot-management h3, .pbot-management h4, .pbot-management p { margin: 0; }\n.pbot-management h2 { font-size: 21px; font-weight: 600; }\n.pbot-management h3 { font-size: 16px; font-weight: 600; }\n.pbot-management h4 { font-size: 14px; font-weight: 600; }\n.pbot-management button, .pbot-management input, .pbot-management textarea, .pbot-management select { font: inherit; color: inherit; }\n.pbot-management button { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 7px 13px; border: 1px solid var(--pbot-line); border-radius: 8px; background: var(--pbot-surface); cursor: pointer; line-height: 1.4; }\n.pbot-management button:hover:not(:disabled) { background: var(--pbot-tint); border-color: color-mix(in srgb, var(--pbot-accent) 40%, var(--pbot-line)); }\n.pbot-management button:disabled { opacity: .45; cursor: not-allowed; }\n.pbot-management :is(button, input, textarea, select, summary):focus-visible { outline: 2px solid var(--pbot-accent); outline-offset: 3px; }\n.pbot-management button.pbot-primary { background: var(--pbot-accent); border-color: var(--pbot-accent); color: var(--pbot-surface); font-weight: 600; }\n.pbot-management button.pbot-primary:hover:not(:disabled) { filter: brightness(.94); background: var(--pbot-accent); }\n.pbot-management button.pbot-quiet { border-color: transparent; background: transparent; }\n.pbot-management button.pbot-danger { color: var(--pbot-danger); }\n.pbot-management button[data-busy=true]::after { content: \"\u2026\"; }\n.pbot-shell { height: 100%; display: grid; grid-template-columns: 178px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }\n.pbot-header { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--pbot-line); }\n.pbot-brand { font-size: 16px; font-weight: 650; letter-spacing: -.3px; }\n.pbot-location { color: var(--pbot-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; max-width: 65vw; }\n.pbot-header-copy { min-width: 0; flex: 1; }\n.pbot-management .pbot-close { width: 34px; padding: 0; font-size: 22px; }\n.pbot-nav { display: flex; flex-direction: column; gap: 6px; padding: 22px 12px; background: var(--pbot-bg); border-right: 1px solid var(--pbot-line); }\n.pbot-nav button { text-align: left; justify-content: space-between; border-color: transparent; background: transparent; padding: 11px 12px; color: var(--pbot-muted); }\n.pbot-nav button[aria-selected=true] { color: var(--pbot-accent); background: var(--pbot-tint); font-weight: 600; }\n.pbot-nav small { font-size: 11px; font-variant-numeric: tabular-nums; opacity: .8; }\n.pbot-main { min-width: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 26px 28px; }\n.pbot-page-title { margin-bottom: 22px; display: grid; gap: 5px; }\n.pbot-muted { color: var(--pbot-muted); font-size: 13px; overflow-wrap: anywhere; }\n.pbot-footer { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 10px 22px; border-top: 1px solid var(--pbot-line); color: var(--pbot-muted); font-size: 12px; }\n.pbot-footer > span { flex: 1; }\n.pbot-footer button { min-height: 28px; padding: 4px 9px; font-size: 12px; }\n.pbot-notice { position: sticky; top: -26px; z-index: 2; padding: 12px 14px; margin: -6px 0 18px; border: 1px solid var(--pbot-line); border-left: 3px solid var(--pbot-accent); background: var(--pbot-surface); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow-y: auto; }\n.pbot-notice[data-tone=error] { border-left-color: var(--pbot-danger); }\n.pbot-notice:empty { display: none; }\n.pbot-stack { display: grid; gap: 16px; }\n.pbot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }\n.pbot-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }\n.pbot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }\n.pbot-counts { margin: -8px 0 20px !important; }\n.pbot-setting { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 0; border-top: 1px solid var(--pbot-line); }\n.pbot-setting > div { min-width: 0; }\n.pbot-setting h3 { margin-bottom: 8px; }\n.pbot-setting > button { flex-shrink: 0; }\n.pbot-card { padding: 18px; border: 1px solid var(--pbot-line); border-radius: 12px; background: var(--pbot-surface); min-width: 0; }\n.pbot-card > :is(h3, .pbot-between) { margin-bottom: 12px; }\n.pbot-badge { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; color: var(--pbot-muted); background: var(--pbot-bg); padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; }\n.pbot-badge::before { content: \"\"; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }\n.pbot-badge:is([data-state=busy],[data-state=running],[data-state=starting],[data-state=preparing]) { color: var(--pbot-accent); background: var(--pbot-tint); }\n.pbot-badge:is([data-state=error],[data-state=failed]) { color: var(--pbot-danger); }\n.pbot-badge:is([data-state=ready],[data-state=completed]) { color: var(--dsw-alias-state-success-primary, #26834b); }\n.pbot-badge:is([data-state=paused],[data-state=stopping]) { color: var(--dsw-alias-state-warn-label, #9a6500); }\n.pbot-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 18px; margin: 12px 0; font-size: 13px; }\n.pbot-facts dt { color: var(--pbot-muted); }\n.pbot-facts dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }\n.pbot-disclosure { margin: 16px 0; padding: 12px 14px; border: 1px solid var(--pbot-line); border-radius: 10px; }\n.pbot-disclosure > summary { cursor: pointer; font-size: 13px; font-weight: 550; }\n.pbot-disclosure[open] > summary { margin-bottom: 16px; }\n.pbot-disclosure .pbot-disclosure { background: var(--pbot-bg); }\n.pbot-field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; font-size: 13px; }\n.pbot-field > span { font-weight: 500; }\n.pbot-field :is(input,textarea,select) { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--pbot-line); border-radius: 7px; background: var(--pbot-surface); line-height: 1.5; }\n.pbot-field input[type=file] { padding: 7px; font-size: 12px; }\n.pbot-field input::file-selector-button { border: 0; padding: 5px 8px; margin-right: 10px; border-radius: 4px; background: var(--pbot-tint); color: var(--pbot-ink); cursor: pointer; }\n.pbot-field textarea { resize: vertical; min-height: 84px; }\n.pbot-field input::placeholder, .pbot-field textarea::placeholder { color: var(--pbot-muted); opacity: .8; }\n.pbot-split { display: grid; grid-template-columns: minmax(180px, 230px) minmax(0, 1fr); gap: 22px; align-items: start; }\n.pbot-list { display: grid; align-content: start; grid-auto-rows: max-content; gap: 6px; max-height: 470px; overflow-y: auto; padding: 3px; }\n.pbot-management .pbot-list-item { display: block; width: 100%; text-align: left; padding: 12px; border: 1px solid transparent; min-width: 0; }\n.pbot-list-item[aria-pressed=true] { background: var(--pbot-tint); border-color: color-mix(in srgb, var(--pbot-accent) 40%, var(--pbot-line)); }\n.pbot-list-item strong { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }\n.pbot-list-item .pbot-muted { margin-top: 7px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }\n.pbot-empty { padding: 38px 20px; border: 1px dashed var(--pbot-line); border-radius: 12px; text-align: center; display: grid; gap: 8px; }\n.pbot-empty h3 { font-weight: 550; }\n.pbot-empty button { justify-self: center; margin-top: 10px; }\n.pbot-detail { min-width: 0; display: grid; gap: 18px; }\n.pbot-detail-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }\n.pbot-prose { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin: 10px 0; line-height: 1.7; }\n.pbot-raw { font: 12px/1.6 ui-monospace, SFMono-Regular, monospace; max-height: 340px; overflow: auto; }\n.pbot-transcript { margin-top: 14px; }\n.pbot-event { border-left: 2px solid var(--pbot-line); padding: 0 0 0 14px; margin: 18px 0; }\n.pbot-event .pbot-prose { font-size: 13px; }\n.pbot-event .pbot-row, .pbot-message .pbot-row { justify-content: space-between; }\n.pbot-management .pbot-pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0; color: var(--pbot-muted); font-size: 12px; }\n.pbot-pagination button { font-size: 12px; min-height: 30px; padding: 5px 9px; }\n.pbot-message { padding: 16px 0; border-bottom: 1px solid var(--pbot-line); }\n.pbot-message:last-child { border-bottom: 0; }\n.pbot-message .pbot-prose { font-size: 13px; }\n.pbot-search { display: grid; grid-template-columns: minmax(0, 1fr) 130px auto; gap: 12px; align-items: end; }\n.pbot-search .pbot-field { margin: 0; }\n.pbot-search > button { margin-bottom: 2px; }\n.pbot-history-results { display: grid; gap: 10px; margin: 18px 0; }\n.pbot-history-results article { border: 1px solid var(--pbot-line); border-radius: 10px; padding: 16px; }\n.pbot-history-results article[aria-current=true] { border-color: var(--pbot-accent); }\n.pbot-warning { border-left: 3px solid var(--dsw-alias-state-warn-primary, #ab7a15); padding: 8px 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }\n@media (max-width: 800px) {\n .pbot-management { width: calc(100vw - 24px); height: calc(100dvh - 32px); border-radius: 12px; }\n .pbot-shell { grid-template-columns: 1fr; grid-template-rows: auto auto minmax(0, 1fr) auto; }\n .pbot-nav { flex-direction: row; padding: 8px 14px; border-right: 0; border-bottom: 1px solid var(--pbot-line); }\n .pbot-nav button { flex: 1; justify-content: center; padding: 8px; }\n .pbot-nav small { display: none; }\n .pbot-main { padding: 22px 18px; }\n .pbot-notice { top: -22px; }\n .pbot-header { padding: 14px 18px; }\n .pbot-split { grid-template-columns: minmax(150px, 190px) minmax(0, 1fr); gap: 16px; }\n}\n@media (max-width: 600px) {\n .pbot-management { width: calc(100vw - 12px); height: calc(100dvh - 16px); }\n .pbot-grid, .pbot-split { grid-template-columns: minmax(0, 1fr); }\n .pbot-list { max-height: 215px; }\n .pbot-search { grid-template-columns: minmax(0, 1fr) 110px; }\n .pbot-search > button { grid-column: 1 / -1; }\n .pbot-footer { padding: 8px 14px; }\n .pbot-location { max-width: 68vw; }\n}\n";
|
|
1
|
+
export declare const managementStyles = "\n.pbot-management {\n --pbot-bg: var(--dsw-alias-bg-base, #f8f9fb);\n --pbot-surface: var(--dsw-alias-bg-layer-1, #fff);\n --pbot-ink: var(--dsw-alias-label-primary, #20232b);\n --pbot-muted: var(--dsw-alias-label-secondary, #696e79);\n --pbot-line: var(--dsw-alias-border-l2, #e3e5eb);\n --pbot-accent: var(--dsw-alias-brand-primary, #4d6bfe);\n --pbot-tint: color-mix(in srgb, var(--pbot-accent) 9%, var(--pbot-surface));\n --pbot-danger: var(--dsw-alias-state-error-primary, #c93535);\n width: min(1180px, calc(100vw - 48px)); height: min(820px, calc(100dvh - 64px));\n max-width: none; max-height: none; padding: 0; margin: auto; overflow: hidden;\n border: 1px solid var(--pbot-line); border-radius: 12px; color: var(--pbot-ink); background: var(--pbot-surface);\n box-shadow: 0 12px 40px #0002; font: 14px/1.55 var(--dsw-font-family, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif);\n}\n.pbot-management::backdrop { background: #10182866; }\n.pbot-management *, .pbot-management *::before, .pbot-management *::after { box-sizing: border-box; }\n.pbot-management [hidden] { display: none !important; }\n.pbot-management h2, .pbot-management h3, .pbot-management h4, .pbot-management p { margin: 0; }\n.pbot-management h2 { font-size: 21px; font-weight: 600; }\n.pbot-management h3 { font-size: 16px; font-weight: 600; }\n.pbot-management h4 { font-size: 14px; font-weight: 600; }\n.pbot-management button, .pbot-management input, .pbot-management textarea, .pbot-management select { font: inherit; color: inherit; }\n.pbot-management button { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 7px 13px; border: 1px solid var(--pbot-line); border-radius: 8px; background: var(--pbot-surface); cursor: pointer; line-height: 1.4; }\n.pbot-management button:hover:not(:disabled) { background: var(--pbot-tint); border-color: color-mix(in srgb, var(--pbot-accent) 40%, var(--pbot-line)); }\n.pbot-management button:disabled { opacity: .45; cursor: not-allowed; }\n.pbot-management :is(button, input, textarea, select, summary):focus-visible { outline: 2px solid var(--pbot-accent); outline-offset: 3px; }\n.pbot-management button.pbot-primary { background: var(--pbot-accent); border-color: var(--pbot-accent); color: var(--pbot-surface); font-weight: 600; }\n.pbot-management button.pbot-primary:hover:not(:disabled) { filter: brightness(.94); background: var(--pbot-accent); }\n.pbot-management button.pbot-quiet { border-color: transparent; background: transparent; }\n.pbot-management button.pbot-danger { color: var(--pbot-danger); }\n.pbot-management button[data-busy=true]::after { content: \"\u2026\"; }\n.pbot-shell { height: 100%; display: grid; grid-template-columns: 178px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }\n.pbot-header { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--pbot-line); }\n.pbot-brand { font-size: 16px; font-weight: 650; letter-spacing: -.3px; }\n.pbot-location { color: var(--pbot-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; max-width: 65vw; }\n.pbot-header-copy { min-width: 0; flex: 1; }\n.pbot-management .pbot-close { width: 34px; padding: 0; font-size: 22px; }\n.pbot-nav { display: flex; flex-direction: column; gap: 6px; padding: 22px 12px; background: var(--pbot-bg); border-right: 1px solid var(--pbot-line); }\n.pbot-nav button { text-align: left; justify-content: space-between; border-color: transparent; background: transparent; padding: 11px 12px; color: var(--pbot-muted); }\n.pbot-nav button[aria-selected=true] { color: var(--pbot-accent); background: var(--pbot-tint); font-weight: 600; }\n.pbot-nav small { font-size: 11px; font-variant-numeric: tabular-nums; opacity: .8; }\n.pbot-main { min-width: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 26px 28px; }\n.pbot-page-title { margin-bottom: 22px; display: grid; gap: 5px; }\n.pbot-muted { color: var(--pbot-muted); font-size: 13px; overflow-wrap: anywhere; }\n.pbot-footer { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 10px 22px; border-top: 1px solid var(--pbot-line); color: var(--pbot-muted); font-size: 12px; }\n.pbot-footer > span { flex: 1; }\n.pbot-footer button { min-height: 28px; padding: 4px 9px; font-size: 12px; }\n.pbot-notice { position: sticky; top: -26px; z-index: 2; padding: 12px 14px; margin: -6px 0 18px; border: 1px solid var(--pbot-line); border-left: 3px solid var(--pbot-accent); background: var(--pbot-surface); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow-y: auto; }\n.pbot-notice[data-tone=error] { border-left-color: var(--pbot-danger); }\n.pbot-notice:empty { display: none; }\n.pbot-stack { display: grid; gap: 16px; }\n.pbot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }\n.pbot-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }\n.pbot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }\n.pbot-counts { margin: -8px 0 20px !important; }\n.pbot-setting { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 0; border-top: 1px solid var(--pbot-line); }\n.pbot-setting > div { min-width: 0; }\n.pbot-setting h3 { margin-bottom: 8px; }\n.pbot-setting > button { flex-shrink: 0; }\n.pbot-card { padding: 18px; border: 1px solid var(--pbot-line); border-radius: 12px; background: var(--pbot-surface); min-width: 0; }\n.pbot-card > :is(h3, .pbot-between) { margin-bottom: 12px; }\n.pbot-badge { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; color: var(--pbot-muted); background: var(--pbot-bg); padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; }\n.pbot-badge::before { content: \"\"; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }\n.pbot-badge:is([data-state=busy],[data-state=running],[data-state=starting]) { color: var(--pbot-accent); background: var(--pbot-tint); }\n.pbot-badge:is([data-state=error],[data-state=failed]) { color: var(--pbot-danger); }\n.pbot-badge[data-state=completed] { color: var(--dsw-alias-state-success-primary, #26834b); }\n.pbot-badge:is([data-state=paused],[data-state=stopping]) { color: var(--dsw-alias-state-warn-label, #9a6500); }\n.pbot-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 18px; margin: 12px 0; font-size: 13px; }\n.pbot-facts dt { color: var(--pbot-muted); }\n.pbot-facts dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }\n.pbot-disclosure { margin: 16px 0; padding: 12px 14px; border: 1px solid var(--pbot-line); border-radius: 10px; }\n.pbot-disclosure > summary { cursor: pointer; font-size: 13px; font-weight: 550; }\n.pbot-disclosure[open] > summary { margin-bottom: 16px; }\n.pbot-disclosure .pbot-disclosure { background: var(--pbot-bg); }\n.pbot-field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; font-size: 13px; }\n.pbot-field > span { font-weight: 500; }\n.pbot-field :is(input,textarea,select) { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--pbot-line); border-radius: 7px; background: var(--pbot-surface); line-height: 1.5; }\n.pbot-field input[type=file] { padding: 7px; font-size: 12px; }\n.pbot-field input::file-selector-button { border: 0; padding: 5px 8px; margin-right: 10px; border-radius: 4px; background: var(--pbot-tint); color: var(--pbot-ink); cursor: pointer; }\n.pbot-field textarea { resize: vertical; min-height: 84px; }\n.pbot-field input::placeholder, .pbot-field textarea::placeholder { color: var(--pbot-muted); opacity: .8; }\n.pbot-split { display: grid; grid-template-columns: minmax(180px, 230px) minmax(0, 1fr); gap: 22px; align-items: start; }\n.pbot-list { display: grid; align-content: start; grid-auto-rows: max-content; gap: 6px; max-height: 470px; overflow-y: auto; padding: 3px; }\n.pbot-management .pbot-list-item { display: block; width: 100%; text-align: left; padding: 12px; border: 1px solid transparent; min-width: 0; }\n.pbot-list-item[aria-pressed=true] { background: var(--pbot-tint); border-color: color-mix(in srgb, var(--pbot-accent) 40%, var(--pbot-line)); }\n.pbot-list-item strong { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }\n.pbot-list-item .pbot-muted { margin-top: 7px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }\n.pbot-empty { padding: 38px 20px; border: 1px dashed var(--pbot-line); border-radius: 12px; text-align: center; display: grid; gap: 8px; }\n.pbot-empty h3 { font-weight: 550; }\n.pbot-empty button { justify-self: center; margin-top: 10px; }\n.pbot-detail { min-width: 0; display: grid; gap: 18px; }\n.pbot-detail-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }\n.pbot-prose { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin: 10px 0; line-height: 1.7; }\n.pbot-raw { font: 12px/1.6 ui-monospace, SFMono-Regular, monospace; max-height: 340px; overflow: auto; }\n.pbot-transcript { margin-top: 14px; }\n.pbot-event { border-left: 2px solid var(--pbot-line); padding: 0 0 0 14px; margin: 18px 0; }\n.pbot-event .pbot-prose { font-size: 13px; }\n.pbot-event .pbot-row, .pbot-message .pbot-row { justify-content: space-between; }\n.pbot-management .pbot-pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0; color: var(--pbot-muted); font-size: 12px; }\n.pbot-pagination button { font-size: 12px; min-height: 30px; padding: 5px 9px; }\n.pbot-message { padding: 16px 0; border-bottom: 1px solid var(--pbot-line); }\n.pbot-message:last-child { border-bottom: 0; }\n.pbot-message .pbot-prose { font-size: 13px; }\n.pbot-search { display: grid; grid-template-columns: minmax(0, 1fr) 130px auto; gap: 12px; align-items: end; }\n.pbot-search .pbot-field { margin: 0; }\n.pbot-search > button { margin-bottom: 2px; }\n.pbot-history-results { display: grid; gap: 10px; margin: 18px 0; }\n.pbot-history-results article { border: 1px solid var(--pbot-line); border-radius: 10px; padding: 16px; }\n.pbot-history-results article[aria-current=true] { border-color: var(--pbot-accent); }\n.pbot-warning { border-left: 3px solid var(--dsw-alias-state-warn-primary, #ab7a15); padding: 8px 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }\n@media (max-width: 800px) {\n .pbot-management { width: calc(100vw - 24px); height: calc(100dvh - 32px); border-radius: 12px; }\n .pbot-shell { grid-template-columns: 1fr; grid-template-rows: auto auto minmax(0, 1fr) auto; }\n .pbot-nav { flex-direction: row; padding: 8px 14px; border-right: 0; border-bottom: 1px solid var(--pbot-line); }\n .pbot-nav button { flex: 1; justify-content: center; padding: 8px; }\n .pbot-nav small { display: none; }\n .pbot-main { padding: 22px 18px; }\n .pbot-notice { top: -22px; }\n .pbot-header { padding: 14px 18px; }\n .pbot-split { grid-template-columns: minmax(150px, 190px) minmax(0, 1fr); gap: 16px; }\n}\n@media (max-width: 600px) {\n .pbot-management { width: calc(100vw - 12px); height: calc(100dvh - 16px); }\n .pbot-grid, .pbot-split { grid-template-columns: minmax(0, 1fr); }\n .pbot-list { max-height: 215px; }\n .pbot-search { grid-template-columns: minmax(0, 1fr) 110px; }\n .pbot-search > button { grid-column: 1 / -1; }\n .pbot-footer { padding: 8px 14px; }\n .pbot-location { max-width: 68vw; }\n}\n";
|
package/lib/ui/dsh/styles.js
CHANGED
|
@@ -62,9 +62,9 @@ export const managementStyles = `
|
|
|
62
62
|
.pbot-card > :is(h3, .pbot-between) { margin-bottom: 12px; }
|
|
63
63
|
.pbot-badge { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; color: var(--pbot-muted); background: var(--pbot-bg); padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; }
|
|
64
64
|
.pbot-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
|
|
65
|
-
.pbot-badge:is([data-state=busy],[data-state=running],[data-state=starting]
|
|
65
|
+
.pbot-badge:is([data-state=busy],[data-state=running],[data-state=starting]) { color: var(--pbot-accent); background: var(--pbot-tint); }
|
|
66
66
|
.pbot-badge:is([data-state=error],[data-state=failed]) { color: var(--pbot-danger); }
|
|
67
|
-
.pbot-badge
|
|
67
|
+
.pbot-badge[data-state=completed] { color: var(--dsw-alias-state-success-primary, #26834b); }
|
|
68
68
|
.pbot-badge:is([data-state=paused],[data-state=stopping]) { color: var(--dsw-alias-state-warn-label, #9a6500); }
|
|
69
69
|
.pbot-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 18px; margin: 12px 0; font-size: 13px; }
|
|
70
70
|
.pbot-facts dt { color: var(--pbot-muted); }
|
package/lib/ui/presentation.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const states = {
|
|
2
2
|
starting: "启动中", busy: "执行中", idle: "待命", stopping: "停止中", stopped: "已停止", error: "需要处理",
|
|
3
3
|
running: "进行中", paused: "已暂停", finished: "已结束", completed: "已完成", failed: "失败",
|
|
4
|
-
cancelled: "已取消", interrupted: "已中断",
|
|
4
|
+
cancelled: "已取消", interrupted: "已中断",
|
|
5
5
|
open: "待安排", closed: "已关闭",
|
|
6
6
|
};
|
|
7
7
|
export const stateLabel = (state) => states[String(state)] ?? String(state ?? "未知");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "personal-bot",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/realqiyan/personal-bot.git"
|
|
@@ -62,10 +62,7 @@
|
|
|
62
62
|
".claude-plugin/plugin.json",
|
|
63
63
|
".claude-plugin/marketplace.json",
|
|
64
64
|
"hooks/hooks.json",
|
|
65
|
-
"scripts/setup-python.py",
|
|
66
65
|
"scripts/README.md",
|
|
67
|
-
"python/requirements.lock",
|
|
68
|
-
"python/README.md",
|
|
69
66
|
"README.md",
|
|
70
67
|
"README.zh-CN.md",
|
|
71
68
|
"CONTEXT.md",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pbot
|
|
3
|
-
description: 初始化 Personal Bot
|
|
3
|
+
description: 初始化 Personal Bot 工作区或查看状态。
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -11,7 +11,6 @@ disable-model-invocation: true
|
|
|
11
11
|
```sh
|
|
12
12
|
node "${CLAUDE_SKILL_DIR}/../../../../lib/claude.js" init
|
|
13
13
|
node "${CLAUDE_SKILL_DIR}/../../../../lib/claude.js" status
|
|
14
|
-
node "${CLAUDE_SKILL_DIR}/../../../../lib/claude.js" python setup
|
|
15
14
|
```
|
|
16
15
|
|
|
17
|
-
根据用户参数选择一条:`init` 补建资料并启用工作区,`status`
|
|
16
|
+
根据用户参数选择一条:`init` 补建资料并启用工作区,`status` 只查看工作区及当前配置状态。省略参数时查看状态。返回命令的实际结果和需要处理的错误。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
需要专家协助时用 pbot_agent
|
|
1
|
+
需要专家协助时用 pbot_agent;团队组织与批次用 pbot_team,团队公共原文用 pbot_team_message read/post。回溯旧讨论用 pbot_history。
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
|
|
26
26
|
保存有后续用途的结论、方法、决策和产物;普通问答不逐轮存档。保存前查找同主题正文,直接修订,合并重复内容并替换过时说明。必要的实现细节放入对应技术资料,排查过程和测试流水不逐次追加到正文。更新或整理时使用 project-maintenance。可再次查询的数据按记录的口径获取。保留用户资料、历史记录和备份。
|
|
27
27
|
|
|
28
|
-
环境上下文中的 `workspaceRoot` 是资料工作区根目录,`resourceRoot`
|
|
28
|
+
环境上下文中的 `workspaceRoot` 是资料工作区根目录,`resourceRoot` 是包内资料根目录。资料路径相对工作区根目录,命令与文件工具按实际 cwd 解析路径。需要 Python 计算时读取包内 `references/compute.md`;计算、项目构建和测试遵循项目声明的环境。
|
|
29
29
|
|
|
30
30
|
答复先给结论,按需补充说明和产物路径。自然语言说明直接回答当前问题,不惯常追加否定式限定或免责声明,也不设想用户未提出的推论再逐一否定。必要的未知、条件和风险清楚说明一次。数值注明影响理解的对象、期间、单位与口径。任务要求、操作权限、必要确认和规定的输出格式照常遵循。
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
# Python 计算
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## 环境异常
|
|
3
|
+
## 按项目运行
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
使用当前宿主的原生 Bash,沿用项目声明的解释器、依赖、工作目录、脚本或模块入口、输入参数与输出位置。尚无约定时,先检查可用解释器及本次计算需要的库,再选择运行方式。依赖和 Python 版本以项目及所选库的要求为准。
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
包内相对导入通常使用项目根目录下的 `python -m 包.模块`,不为绕过导入错误随意改 `sys.path`。相对数据路径取决于 cwd 或脚本自身的处理;交付时提供实际产物路径,并检查结果。
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
解释器或依赖异常时,检查实际路径、导入错误及项目配置,继续不受影响的工作。专家需要主会话协助时交回具体阻碍和所需条件。
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
## 第三方库
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
按任务选择当前环境中可用的库,并查阅所用版本的原生 API:NumPy、pandas 用于数组和表格,SciPy、statsmodels、scikit-learn(导入名 sklearn)用于数值分析、统计和建模,Matplotlib、seaborn、Bokeh 用于绘图,openpyxl、PyArrow 用于文件读写。
|
|
16
14
|
|
|
17
15
|
- 无图形界面的绘图:在导入 pyplot/seaborn 前选择 Matplotlib 的 Agg 后端,保存文件并关闭 figure。
|
|
18
16
|
- Excel、Parquet、Feather:按格式选择 openpyxl 或 pyarrow;核对读写后的字段类型、时间单位与时区。Excel 不直接保存带时区的 datetime,转换前明确目标时区。
|
package/scripts/README.md
CHANGED
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
| --- | --- | --- |
|
|
20
20
|
| `node scripts/check-consumer.mjs <tarball>` | 独立 CLI、Pi 扩展、技能、工具与资料初始化;安装 Pi 前核对消费根和包内均未安装宿主依赖 | CI 使用 Node.js 22.19.0,脚本安装锁定的 Pi SDK |
|
|
21
21
|
| `node scripts/check-dsh-consumer.mjs <tarball>` | dsh 原生插件安装、独立 CLI 与 Host 导入;检查无需单独安装 TypeBox 或宿主 SDK | Node.js 24.9+、仓库开发依赖和 PATH 中的 pnpm |
|
|
22
|
-
| `node scripts/check-claude-consumer.mjs <tarball>` | 实际 tarball 安装与原生 plugin validate;另在直接解包且没有 node_modules 的目录执行 hook、CLI 和资料读取 | Node.js 22.19+、
|
|
22
|
+
| `node scripts/check-claude-consumer.mjs <tarball>` | 实际 tarball 安装与原生 plugin validate;另在直接解包且没有 node_modules 的目录执行 hook、CLI 和资料读取 | Node.js 22.19+、Claude Code 2.1.325+;PBOT_CLAUDE_COMMAND 可指定 CLI |
|
|
23
23
|
|
|
24
|
-
上述脚本使用隔离用户目录、宿主配置与工作目录,结束后清理临时目录,不调用模型。Pi
|
|
24
|
+
上述脚本使用隔离用户目录、宿主配置与工作目录,结束后清理临时目录,不调用模型。Pi 检查扩展加载与资料初始化,dsh 通过原生 schema 收集导入 Host。Claude 在独立 npm 消费目录安装实际 tarball,核对版本、原生资源与 hook 参数;再从直接解包目录运行未启用工作区的 hook/status,以及已启用工作区的专家资料读取,覆盖原生 marketplace 不安装 npm 依赖的缓存目录。不访问日常会话或凭据。
|
|
25
25
|
|
|
26
26
|
Claude 包内路径包括 `.claude-plugin/plugin.json`、marketplace、`hooks/hooks.json`、`lib/claude.js`、`resources/claude/skills/pbot/SKILL.md`、原生 Markdown agent、共享资料与工作方法技能。`resources/skills/.claude-plugin/plugin.json` 保留给 Pi/dsh 的 Claude ACP 目标。可对实际安装包执行原生校验:
|
|
27
27
|
|
|
@@ -44,7 +44,3 @@ Claude 的实际首任务上下文、`/personal-bot:pbot` 技能调用、工作
|
|
|
44
44
|
在明确批准、单独准备 Pi/dsh/Claude 模型与测试认证的环境执行 `npm run test:e2e:acp`。该命令在临时工作区调用三个真实后端,省略 model、thinking 和 provider 验证默认值;另测 Claude 显式 low 覆盖原生环境 max。检查文件结果、报告分页、停止耗时,并对照 Claude 原生请求中的模型与思考等级。它单独运行,不进入 `npm test`,属于 Pi/dsh 的 ACP 目标验证。
|
|
45
45
|
|
|
46
46
|
入口默认从 PATH 查找。可用 `PBOT_ACP_E2E_PI_COMMAND`、`PBOT_ACP_E2E_DSH_COMMAND`、`PBOT_ACP_E2E_CLAUDE_COMMAND` 指定已有可执行文件路径;dsh 仍使用 acp profile。`PBOT_ACP_E2E_OUTPUT_DIR` 指定输出目录,默认使用临时目录;每个工作区保留 input.json、output.json、report.txt 和 result.json;Claude 用例还保留仅含模型与等级的 native-requests.json。
|
|
47
|
-
|
|
48
|
-
## Python 准备
|
|
49
|
-
|
|
50
|
-
setup-python.py 按 python/requirements.lock 准备用户共享 venv。工作区启用后自动调用,也可运行独立脚本。Pi/dsh 使用 `/pbot python setup` 重试;Claude 使用原生 `/personal-bot:pbot python setup` 技能或 `node <plugin>/lib/claude.js python setup`。路径、依赖与排障见 [Python 说明](../python/README.md)。
|
package/src/common/schema.ts
CHANGED
|
@@ -9,3 +9,13 @@ export function schema(value: unknown): ValidateFunction {
|
|
|
9
9
|
addFormats.default(ajv);
|
|
10
10
|
return ajv.compile(value);
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
/** Name the concrete shape violation so the caller can correct the same field. */
|
|
14
|
+
export function schemaDetail(validate: ValidateFunction): string {
|
|
15
|
+
return (validate.errors ?? []).map(error => {
|
|
16
|
+
const params = error.params as Record<string, unknown>;
|
|
17
|
+
const field = typeof params.additionalProperty === "string" ? params.additionalProperty
|
|
18
|
+
: error.instancePath ? error.instancePath.slice(1).replaceAll("/", ".") : "参数";
|
|
19
|
+
return field + " " + (error.message ?? "不符合 schema");
|
|
20
|
+
}).join(";") || "不符合 schema";
|
|
21
|
+
}
|
|
@@ -26,9 +26,7 @@ export async function acpMember() {
|
|
|
26
26
|
};
|
|
27
27
|
const context = async () => {
|
|
28
28
|
const [workspace, role] = await Promise.all([readFile(join(resourceRoot, "prompts/workspace.md"), "utf8"), agentText("general-purpose", d.workspace)]);
|
|
29
|
-
|
|
30
|
-
const python = state === "ready" && process.env.VIRTUAL_ENV ? { state, directory: process.env.VIRTUAL_ENV } : { state };
|
|
31
|
-
return { workspace, role, environment: JSON.stringify({ workspaceRoot: d.workspace, resourceRoot, python }) };
|
|
29
|
+
return { workspace, role, environment: JSON.stringify({ workspaceRoot: d.workspace, resourceRoot }) };
|
|
32
30
|
};
|
|
33
31
|
return { files, d, id, generation, check, context,
|
|
34
32
|
input() {
|