personal-bot 0.2.6 → 0.2.8

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.
Files changed (69) hide show
  1. package/README.md +47 -13
  2. package/README.zh-CN.md +46 -12
  3. package/docs/README.md +4 -2
  4. package/docs/agent-collaboration.md +4 -4
  5. package/docs/capability-design.md +12 -6
  6. package/docs/dsh-implementation-plan.md +9 -7
  7. package/docs/dsh-support-proposal.md +6 -22
  8. package/docs/dsh.en.md +333 -0
  9. package/docs/dsh.md +346 -48
  10. package/docs/file-storage.md +1 -1
  11. package/docs/history.md +2 -0
  12. package/docs/installation-design.md +7 -4
  13. package/docs/model-context.md +60 -0
  14. package/docs/model-instruction-guidelines.md +51 -0
  15. package/docs/release.md +10 -6
  16. package/docs/subagent-upgrade-proposal.md +1 -1
  17. package/docs/technical-design.md +21 -15
  18. package/docs/validation.md +64 -7
  19. package/lib/dsh.js +4 -0
  20. package/lib/extension/dsh/agent-events.js +1 -1
  21. package/lib/extension/dsh/agent-runtime.js +8 -5
  22. package/lib/integrations/dsh/resources.d.ts +1 -1
  23. package/lib/integrations/dsh/resources.js +14 -14
  24. package/lib/integrations/dsh/session.js +1 -0
  25. package/lib/integrations/installation/pi-bridge.js +9 -9
  26. package/lib/integrations/team-context.js +7 -3
  27. package/lib/services/agents/agent-notices.js +2 -2
  28. package/lib/services/agents/team-service.js +1 -1
  29. package/lib/tools/agents/contract.d.ts +1 -1
  30. package/lib/tools/agents/contract.js +7 -7
  31. package/lib/tools/agents/dsh-contract.js +4 -4
  32. package/lib/tools/history/contract.d.ts +1 -1
  33. package/lib/tools/history/contract.js +2 -2
  34. package/lib/tools/teams/contract.d.ts +2 -2
  35. package/lib/tools/teams/contract.js +11 -11
  36. package/npm-shrinkwrap.json +30 -25
  37. package/package.json +28 -25
  38. package/python/README.md +1 -1
  39. package/resources/agents/coordinator.md +5 -33
  40. package/resources/agents/general-purpose.md +3 -15
  41. package/resources/prompts/history-summary.md +1 -1
  42. package/resources/prompts/team-member.md +7 -0
  43. package/resources/prompts/workspace.md +13 -24
  44. package/resources/references/compute-finance.md +22 -0
  45. package/resources/references/compute.md +11 -88
  46. package/resources/references/task-conductor.md +20 -15
  47. package/resources/skills/project-maintenance/SKILL.md +9 -11
  48. package/resources/skills/provider-connections/SKILL.md +7 -7
  49. package/scripts/README.md +1 -1
  50. package/src/dsh.ts +4 -0
  51. package/src/extension/agent-events.ts +17 -4
  52. package/src/extension/command.ts +1 -1
  53. package/src/extension/dsh/agent-events.ts +1 -1
  54. package/src/extension/dsh/agent-runtime.ts +7 -6
  55. package/src/extension/events.ts +14 -9
  56. package/src/extension/subagent-entry.ts +24 -16
  57. package/src/integrations/dsh/resources.ts +17 -14
  58. package/src/integrations/dsh/session.ts +2 -0
  59. package/src/integrations/installation/pi-bridge.ts +9 -7
  60. package/src/integrations/pi/agent-context.ts +1 -1
  61. package/src/integrations/team-context.ts +7 -3
  62. package/src/services/agents/agent-notices.ts +2 -2
  63. package/src/services/agents/team-service.ts +1 -1
  64. package/src/tools/agents/contract.ts +7 -7
  65. package/src/tools/agents/dsh-contract.ts +4 -4
  66. package/src/tools/history/contract.ts +2 -2
  67. package/src/tools/register.ts +1 -7
  68. package/src/tools/teams/contract.ts +11 -11
  69. package/resources/prompts/tool-guidelines.md +0 -3
@@ -1,17 +1,17 @@
1
1
  import { Type } from "typebox";
2
- export const agentDescription = "独立专家会话,不继承父聊天历史。start 完成启动后返回,不等待工作完成;未提供 message/prompts/files 时只启动待命会话,不调用模型。完成自动通知,无需轮询。团队占用期间不能私人 send。send 继续对话,rename 改名,status/list 查看状态,status 返回最近周期且不读取报告正文。read 非阻塞读取报告;读取已结束周期会领取该周期的完成通知(包括部分读取),后续不再重复通知。nextOffset 非空时以返回的 cycle.cycleId 固定周期续读。state 是执行状态,cycle.state 是工作结果,queued 仅表示入队。stop 停止并保留历史,resume 携新 message 恢复,不重放旧工作。独立复核须 start 新上下文。子会话使用原生 CLI/MCP,按委派范围工作,不递归委派。每个父会话最多 50 个存活子会话,空闲也计入。";
2
+ export const agentDescription = "委派专家并继续对话。start 启动后即返回,完成自动通知,无需轮询;省略初始输入时待命。send 继续对话,团队占用期间不可私人 send。status 查看状态,read 读取报告;读取已结束周期即领取其通知,包括部分读取。续读固定 cycle.cycleId 并使用 nextOffset。state 表示执行状态,cycle.state 表示工作结果,queued 只表示入队。stop 保留历史,resume 携新 message 继续。每个父会话最多 50 个存活专家,空闲也计入。";
3
3
  const id = Type.String({ minLength: 1, maxLength: 128 });
4
- const message = Type.String({ minLength: 1, maxLength: 24000, description: "本次目标、交付要求、资料依据与约束。" });
4
+ const message = Type.String({ minLength: 1, maxLength: 24000, description: "本次目标、相关资料、约束和交付要求。" });
5
5
  const name = Type.String({ minLength: 1, maxLength: 64, pattern: "^[^\\r\\n\\x00-\\x1f]+$" });
6
6
  export const agentStartOptions = {
7
7
  name: Type.Optional(name), message: Type.Optional(message),
8
8
  files: Type.Optional(Type.Array(Type.String({ minLength: 1 }), { maxItems: 32, description: "随初始消息读取的文件;相对路径基于原工作区根目录。" })),
9
- prompts: Type.Optional(Type.Array(message, { maxItems: 32, description: "与 message 按顺序合并为同一初始消息,不是多个执行轮次。" })),
9
+ prompts: Type.Optional(Type.Array(message, { maxItems: 32, description: "与 message 按顺序合并为同一初始消息。" })),
10
10
  provider: Type.Optional(Type.String({ ...id, description: "Pi 模型提供方,默认继承主会话。" })),
11
- model: Type.Optional(Type.String({ ...id, description: "子进程可用的 Pi 模型 ID,默认继承主会话。" })),
11
+ model: Type.Optional(Type.String({ ...id, description: "Pi 模型 ID,默认继承主会话。" })),
12
12
  thinking: Type.Optional(Type.Union([Type.Literal("off"), Type.Literal("minimal"), Type.Literal("low"), Type.Literal("medium"), Type.Literal("high"), Type.Literal("xhigh"), Type.Literal("max")], { description: "默认继承主会话思考级别。" })),
13
13
  cwd: Type.Optional(Type.String({ minLength: 1, description: "执行目录,相对原工作区根目录;省略时使用工作区根目录。" })),
14
- tools: Type.Optional(Type.Array(id, { minItems: 1, description: "按 Pi 原生规则选择工具,省略时沿用原生默认工具;MCP 工具遵循原生暴露设置。不提供递归委派;这不是宿主隔离。" })),
14
+ tools: Type.Optional(Type.Array(id, { minItems: 1, description: "按 Pi 规则选择工具,省略时使用默认工具;MCP 工具按当前配置提供。" })),
15
15
  noExtensions: Type.Optional(Type.Boolean({ description: "默认 true,不发现其他扩展。" })),
16
16
  noSkills: Type.Optional(Type.Boolean({ description: "关闭技能发现,默认 false。" })),
17
17
  noPromptTemplates: Type.Optional(Type.Boolean({ description: "关闭提示模板发现,默认 false。" })),
@@ -39,7 +39,7 @@ export const agentActionSchema = Type.Union([
39
39
  Type.Object({ action: Type.Literal("read"), agentId: id, ...page }, { additionalProperties: false }),
40
40
  ]);
41
41
  const cycle = Type.Object({ cycleId: Type.String(), startedAt: Type.Number(), finishedAt: Type.Optional(Type.Number()),
42
- state: Type.Union([Type.Literal("running"), Type.Literal("completed"), Type.Literal("failed"), Type.Literal("cancelled"), Type.Literal("interrupted")], { description: "本周期的工作结果;completed 仍须核验实际交付。" }),
42
+ state: Type.Union([Type.Literal("running"), Type.Literal("completed"), Type.Literal("failed"), Type.Literal("cancelled"), Type.Literal("interrupted")], { description: "本周期的工作结果,正文用 read 读取。" }),
43
43
  requestIds: Type.Array(Type.String()),
44
44
  source: Type.Union([Type.Literal("parent"), Type.Literal("interactive"), Type.Literal("mixed")]), error: Type.Optional(Type.String()),
45
45
  }, { additionalProperties: false });
@@ -49,7 +49,7 @@ export const agentViewSchema = Type.Object({ agentId: Type.String(), name: Type.
49
49
  activity: Type.String(), cycle: Type.Optional(cycle), error: Type.Optional(Type.String()),
50
50
  requestId: Type.Optional(Type.String()), messageStatus: Type.Optional(Type.Literal("queued", { description: "消息已入队,不代表模型已阅读或完成。" })),
51
51
  cycles: Type.Optional(Type.Array(Type.Object({ cycleId: Type.String(), state: Type.String() }), { description: "仅 read 返回:可读取的周期索引。" })),
52
- report: Type.Optional(Type.String({ description: "仅 read 返回:选定周期的报告正文片段。已结束周期的读取结果持久化后领取该周期通知,即使本页未读完。" })),
52
+ report: Type.Optional(Type.String({ description: "仅 read 返回:选定周期的报告正文片段。" })),
53
53
  totalLength: Type.Optional(Type.Integer({ description: "仅 read 返回:完整报告的 UTF-16 字符数。" })),
54
54
  nextOffset: Type.Optional(Type.Union([Type.Integer(), Type.Null()], { description: "仅 read 返回:null 表示本报告已读完;否则以相同 agentId、cycle.cycleId 和此 offset 继续。" })),
55
55
  }, { additionalProperties: false });
@@ -4,10 +4,10 @@ const options = Type.Omit(Type.Object(agentStartOptions), ["provider", "model",
4
4
  const native = {
5
5
  provider: Type.Optional(Type.String({ minLength: 1, maxLength: 128, description: "dsh 原生 provider route,默认继承父会话。" })),
6
6
  model: Type.Optional(Type.String({ minLength: 1, maxLength: 128, description: "该 dsh provider 的模型 ID,默认继承父会话。" })),
7
- thinking: Type.Optional(Type.String({ minLength: 1, maxLength: 128, description: "该 dsh 模型的原生 reasoning effort ID,默认继承父会话;不转换 Pi 思考等级。" })),
8
- files: Type.Optional(Type.Array(Type.String({ minLength: 1 }), { maxItems: 32, description: "作为原生附件保存的文件;相对原工作区根目录。图片遵循宿主准入规则,其他文件保留原始字节供模型读取。" })),
9
- tools: Type.Optional(Type.Array(Type.String({ minLength: 1 }), { minItems: 1, description: "原生能力工具名;不填写 run_code 传输名,不支持递归委派。省略时使用原生工具和 pbot_team_message。" })),
10
- noSkills: Type.Optional(Type.Boolean({ description: "关闭该专家的模型技能目录和原生 skill 工具;不改变其他会话的技能配置。" })),
7
+ thinking: Type.Optional(Type.String({ minLength: 1, maxLength: 128, description: "该 dsh 模型的 reasoning effort ID,默认继承父会话。" })),
8
+ files: Type.Optional(Type.Array(Type.String({ minLength: 1 }), { maxItems: 32, description: "附给专家的文件;相对原工作区根目录。图片大小与格式遵循 dsh 限制。" })),
9
+ tools: Type.Optional(Type.Array(Type.String({ minLength: 1 }), { minItems: 1, description: "能力工具名,不填写 run_code;省略时使用原生工具和 pbot_team_message。" })),
10
+ noSkills: Type.Optional(Type.Boolean({ description: "关闭该专家的技能目录和 skill 工具。" })),
11
11
  };
12
12
  const omitted = ["noExtensions", "noPromptTemplates", "noContextFiles", "provider", "model", "thinking", "files", "tools", "noSkills"];
13
13
  export const dshAgentParametersSchema = Type.Object({ ...Type.Omit(agentParametersSchema, omitted).properties, ...native }, { additionalProperties: false });
@@ -64,7 +64,7 @@ export declare const historyResultSchema: Type.TObject<{
64
64
  }>>;
65
65
  warnings: Type.TArray<Type.TString>;
66
66
  }>;
67
- export declare const historyDescription = "\u67E5\u8BE2\u5F53\u524D\u5DE5\u4F5C\u533A\u7684 Pi \u4E0E dsh \u5386\u53F2\u5F52\u6863\uFF0C\u53EF\u7528 host \u7B5B\u9009\u6765\u6E90\u3002search \u5BF9\u95EE\u7B54\u539F\u6587\u548C\u5404\u5C42\u6458\u8981\u505A\u4E0D\u533A\u5206\u5927\u5C0F\u5199\u7684\u8FDE\u7EED\u6587\u672C\u5339\u914D\uFF1B\u7701\u7565 query \u5217\u51FA\u4F1A\u8BDD\u3002\u5FD8\u8BB0\u539F\u8BCD\u65F6\u6362\u51E0\u7EC4\u8BCD\u67E5\u8BE2\u3002read \u8BFB\u53D6\u547D\u4E2D\u8282\u70B9\u5E76\u8FD4\u56DE\u7236\u5B50\u8282\u70B9\uFF1B\u6CBF parents/children \u7684 id \u5C55\u5F00\uFF0CnextOffset \u7EED\u8BFB\u6B63\u6587\uFF0CnextChildrenOffset \u7EED\u8BFB\u5B50\u8282\u70B9\u3002\u6458\u8981\u662F\u68C0\u7D22\u7EBF\u7D22\uFF0C\u91CD\u8981\u7ED3\u8BBA\u56DE\u5230 exchange \u539F\u6587\u6838\u5BF9\u3002\u5171\u4EAB\u524D\u7F00\u53EF\u80FD\u6709\u591A\u4E2A\u7236\u8282\u70B9\u3002\u67E5\u8BE2\u4E0D\u8C03\u7528\u6A21\u578B\uFF0C\u4E0D\u6062\u590D\u6216\u91CD\u653E\u65E7\u4EFB\u52A1\uFF1B\u53EA\u66F4\u65B0\u5F53\u524D\u5BBF\u4E3B\u7684\u539F\u751F\u5386\u53F2\u7D22\u5F15\u3002\u95EE\u7B54\u5F52\u6863\u4E0D\u4EE3\u66FF\u4E13\u5BB6\u7684\u5B8C\u6574\u5DE5\u5177\u65E5\u5FD7\u3002";
67
+ export declare const historyDescription = "\u67E5\u8BE2\u5F53\u524D\u5DE5\u4F5C\u533A\u7684 Pi/dsh \u95EE\u7B54\u5F52\u6863\uFF0Chost \u53EF\u7B5B\u9009\u6765\u6E90\u3002search \u6309\u4E0D\u533A\u5206\u5927\u5C0F\u5199\u7684\u8FDE\u7EED\u6587\u672C\u5339\u914D\u539F\u6587\u548C\u6458\u8981\uFF1B\u65E0\u5339\u914D\u65F6\u6362\u8BCD\uFF0C\u7701\u7565 query \u5217\u4F1A\u8BDD\u3002read \u6309 parents/children \u7684 id \u5C55\u5F00\uFF0CnextOffset \u7EED\u8BFB\u6B63\u6587\uFF0CnextChildrenOffset \u7EED\u8BFB\u5B50\u8282\u70B9\u3002\u9700\u8981\u5BF9\u8BDD\u7EC6\u8282\u65F6\u8BFB\u53D6 exchange \u539F\u6587\uFF1B\u9700\u8981\u5DE5\u5177\u65E5\u5FD7\u65F6\u67E5\u6240\u5C5E\u5BBF\u4E3B\u7684\u539F\u59CB\u4F1A\u8BDD\u3002";
68
68
  export declare const historyParameters: Type.TObject<{
69
69
  action: Type.TUnion<[Type.TLiteral<"search">, Type.TLiteral<"read">]>;
70
70
  host: Type.TOptional<Type.TUnion<[Type.TLiteral<"pi">, Type.TLiteral<"dsh">]>>;
@@ -9,10 +9,10 @@ export const historyResultSchema = Type.Object({
9
9
  total: Type.Optional(Type.Integer()), nextOffset: Type.Optional(nullableOffset),
10
10
  node: Type.Optional(Type.Object({ ...node.properties, text: Type.String(), totalLength: Type.Integer(), nextOffset: nullableOffset,
11
11
  parents: Type.Array(node), children: Type.Array(node), nextChildrenOffset: nullableOffset,
12
- source: Type.Object({ host, sessionId: Type.String({ description: "原始宿主会话 ID;来源不保存文件路径。" }), entryIds: Type.Array(Type.String()) }), warnings: Type.Array(Type.String()) })),
12
+ source: Type.Object({ host, sessionId: Type.String({ description: "原始宿主会话 ID。" }), entryIds: Type.Array(Type.String()) }), warnings: Type.Array(Type.String()) })),
13
13
  warnings: Type.Array(Type.String()),
14
14
  });
15
- export const historyDescription = "查询当前工作区的 Pi 与 dsh 历史归档,可用 host 筛选来源。search 对问答原文和各层摘要做不区分大小写的连续文本匹配;省略 query 列出会话。忘记原词时换几组词查询。read 读取命中节点并返回父子节点;沿 parents/children 的 id 展开,nextOffset 续读正文,nextChildrenOffset 续读子节点。摘要是检索线索,重要结论回到 exchange 原文核对。共享前缀可能有多个父节点。查询不调用模型,不恢复或重放旧任务;只更新当前宿主的原生历史索引。问答归档不代替专家的完整工具日志。";
15
+ export const historyDescription = "查询当前工作区的 Pi/dsh 问答归档,host 可筛选来源。search 按不区分大小写的连续文本匹配原文和摘要;无匹配时换词,省略 query 列会话。read 按 parents/children 的 id 展开,nextOffset 续读正文,nextChildrenOffset 续读子节点。需要对话细节时读取 exchange 原文;需要工具日志时查所属宿主的原始会话。";
16
16
  export const historyParameters = Type.Object({ action: Type.Union([Type.Literal("search"), Type.Literal("read")]),
17
17
  host: Type.Optional(host), query: Type.Optional(Type.String()), sessionId: Type.Optional(Type.String()),
18
18
  from: Type.Optional(Type.String({ description: "search:ISO 日期或时间,下界。" })),
@@ -1,6 +1,6 @@
1
1
  import { Type } from "typebox";
2
- export declare const teamDescription = "\u4E3B\u4F1A\u8BDD\u7BA1\u7406\u56FA\u5B9A\u6210\u5458\u56E2\u961F\u3002create \u4E0D\u542F\u52A8\u6A21\u578B\uFF1Brun \u5F00\u5C55\u6709\u9650 roundRobin \u8F6E\u6D41\u8BA8\u8BBA\u6216 parallel \u5E76\u884C\u8F6E\u6B21\uFF0C\u9ED8\u8BA4 2 \u8F6E\u3001\u6574\u6279 15 \u5206\u949F\uFF0C\u6210\u5458\u76F4\u63A5\u53D6\u5F97\u516C\u5171\u539F\u6587\u3002\u56E2\u961F\u8FD0\u884C\u65F6\u5360\u7528\u6210\u5458\uFF1Bpause \u505C\u6B62\u65B0\u5B89\u6392\u548C\u9886\u53D6\uFF0C\u5141\u8BB8\u5728\u9014\u5DE5\u4F5C\u6536\u5C3E\uFF0C\u4E4B\u540E\u53EF\u79C1\u4EBA send\uFF1B\u9700\u8981\u4E2D\u6B62\u6210\u5458\u7528 pbot_agent stop\u3002\u5230\u671F\u65F6\u5B50\u5165\u53E3\u5C3D\u529B\u4E2D\u6B62\u672A\u88AB\u4EBA\u5DE5\u63A5\u7BA1\u7684\u56E2\u961F\u5DE5\u4F5C\u3002close \u4FDD\u7559\u6210\u5458\u4F1A\u8BDD\u548C\u5386\u53F2\uFF1B\u6362\u6210\u5458\u987B\u5173\u95ED\u65E7\u56E2\u961F\u518D\u521B\u5EFA\u3002\u7EE7\u7EED\u987B\u660E\u786E run \u65B0\u6279\u6B21\uFF0C\u4E0D\u91CD\u653E\u65E7\u8BF7\u6C42\u3002\u5B8C\u6210\u4ECD\u9700\u4E1A\u52A1\u9A8C\u6536\u3002";
3
- export declare const teamMessageDescription = "\u76F4\u63A5\u8BFB\u53D6/\u53D1\u5E03\u56E2\u961F\u516C\u5171\u539F\u6587\u3002post \u4E0D\u5524\u9192\u6A21\u578B\u3001\u4E0D\u589E\u52A0\u8F6E\u6B21\uFF0C\u6240\u6709\u6210\u5458\u53EF\u89C1\uFF0C\u4E0D\u63D0\u4F9B\u79C1\u4FE1\u6216\u9012\u5F52\u59D4\u6D3E\u3002\u6210\u5458\u53EA\u80FD\u5728\u81EA\u5DF1\u7684\u56E2\u961F\u5DE5\u4F5C\u4E2D post\u3002read \u7528 afterSeq \u5206\u9875\uFF1B\u957F\u6D88\u606F\u7528 seq/offset/limit \u7EE7\u7EED\uFF0CnextOffset \u975E\u7A7A\u8868\u793A\u8BE5\u6761\u6B63\u6587\u4E0D\u5B8C\u6574\u3002\u4FDD\u5B58\u6210\u529F\u4E0D\u662F\u6A21\u578B\u5DF2\u8BFB\u6216\u4E1A\u52A1\u5B8C\u6210\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\u6210\u5458\u6700\u7EC8\u7B54\u590D\u5411\u56E2\u961F\u516C\u5F00\u3002";
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
5
  afterSeq: Type.TOptional<Type.TInteger>;
6
6
  seq: Type.TOptional<Type.TInteger>;
@@ -1,18 +1,18 @@
1
1
  import { Type } from "typebox";
2
- export const teamDescription = "主会话管理固定成员团队。create 不启动模型;run 开展有限 roundRobin 轮流讨论或 parallel 并行轮次,默认 2 轮、整批 15 分钟,成员直接取得公共原文。团队运行时占用成员;pause 停止新安排和领取,允许在途工作收尾,之后可私人 send;需要中止成员用 pbot_agent stop。到期时子入口尽力中止未被人工接管的团队工作。close 保留成员会话和历史;换成员须关闭旧团队再创建。继续须明确 run 新批次,不重放旧请求。完成仍需业务验收。";
3
- export const teamMessageDescription = "直接读取/发布团队公共原文。post 不唤醒模型、不增加轮次,所有成员可见,不提供私信或递归委派。成员只能在自己的团队工作中 post。read 用 afterSeq 分页;长消息用 seq/offset/limit 继续,nextOffset 非空表示该条正文不完整。保存成功不是模型已读或业务完成。";
2
+ export const teamDescription = "组织固定成员协作。create 建立团队,run 开始一批讨论。运行时占用成员;pause 停止新安排,允许在途工作收尾,之后可私人 send;中止成员用 pbot_agent stop。close 保留成员和历史;换成员须关闭旧团队再创建。继续讨论用 run 提交新要求。成员最终答复向团队公开。";
3
+ export const teamMessageDescription = "读写团队公共原文。post 向全体成员发布信息,需要安排回答时由主会话调用 pbot_team run;成员只能在自己的团队工作中 post。read 用 afterSeq 翻页,长正文按 seq/offset 续读,先补完 nextOffset 非空的消息。";
4
4
  const id = Type.String({ minLength: 1, maxLength: 128 });
5
5
  const text = Type.String({ minLength: 1, maxLength: 24000 });
6
6
  const name = Type.String({ minLength: 1, maxLength: 64, pattern: "^[^\\r\\n\\x00-\\x1f]+$" });
7
7
  const mode = Type.Union([Type.Literal("roundRobin"), Type.Literal("parallel")], { description: "run 必填:roundRobin 按成员顺序轮流发言;parallel 在并发上限内发言,全员本轮完成后才进入下一轮。" });
8
8
  const members = Type.Array(Type.Object({ agentId: id, role: Type.String({ minLength: 1, maxLength: 4000 }) }, { additionalProperties: false }), {
9
- minItems: 1, maxItems: 50, description: "仅 create,必填:固定成员及职责。成员须属于当前父会话分支、版本兼容且未加入其他未关闭团队。create 不启动模型,也不等待成员就绪。",
9
+ minItems: 1, maxItems: 50, description: "仅 create,必填:当前分支中的固定成员及职责;成员须版本兼容且未加入其他未关闭团队。",
10
10
  });
11
11
  const run = {
12
- instruction: Type.String({ ...text, description: "仅 run,必填:本次新批次的明确任务与交付要求;不恢复或重放旧批次。" }), mode,
12
+ instruction: Type.String({ ...text, description: "仅 run,必填:本批次的任务、约束与交付要求。" }), mode,
13
13
  rounds: Type.Optional(Type.Integer({ minimum: 1, maximum: 10, description: "仅 run:每位成员的轮数,默认 2。" })),
14
- maxConcurrent: Type.Optional(Type.Integer({ minimum: 1, maximum: 50, description: "仅 run:roundRobin 默认且只允许 1;parallel 默认 min(2, 成员数)。不得超过成员数;已排队但未完成的请求也占用并发名额。" })),
15
- timeoutSeconds: Type.Optional(Type.Integer({ minimum: 1, maximum: 86400, description: "仅 run:整批期限,默认 900 秒,包含所有轮次和等待。到期停止新安排和领取,子入口尽力中止未被人工接管的在途工作;pause 则允许在途工作收尾。" })),
14
+ maxConcurrent: Type.Optional(Type.Integer({ minimum: 1, maximum: 50, description: "仅 run:roundRobin 默认且只允许 1;parallel 默认 min(2, 成员数)。不得超过成员数;待处理和执行中的发言都计入上限。" })),
15
+ timeoutSeconds: Type.Optional(Type.Integer({ minimum: 1, maximum: 86400, description: "仅 run:整批期限,默认 900 秒,包含所有轮次和等待。到期停止安排并尝试中止尚未人工接管的工作,之后仍须核对实际状态;pause 则允许在途工作收尾。" })),
16
16
  };
17
17
  const page = {
18
18
  afterSeq: Type.Optional(Type.Integer({ minimum: 0, description: "仅 read:读取序号大于此值的消息,默认 0,不得超过 lastSeq。返回 nextAfterSeq 用于继续消息列表;单条续读使用 seq/offset,省略 afterSeq。先补完被截断的正文,再继续列表。" })),
@@ -23,7 +23,7 @@ const page = {
23
23
  const object = (fields) => Type.Object(fields, { additionalProperties: false });
24
24
  export const teamParametersSchema = object({
25
25
  action: Type.Union(["create", "list", "status", "read", "run", "pause", "close"].map(v => Type.Literal(v)), {
26
- description: "create 只接受并必填 name/brief/members;list 只接受 action;status/pause/close 只接受并必填 teamId;read 必填 teamId,可选 afterSeq/seq/offset/limit;run 必填 teamId/instruction/mode,可选 rounds/maxConcurrent/timeoutSeconds。禁止携带其他 action 的字段。run 要求所有成员存活、idle、当前代次团队接入就绪、无待处理私人输入,且团队未关闭、无运行批次或在途工作。pause 仅停止新安排和未领取请求;close 要求先暂停并等待在途工作结束,不停止成员会话。",
26
+ description: "create 必填 name/brief/members;list 只接受 action;status/pause/close 必填 teamId;read 必填 teamId,可选 afterSeq/seq/offset/limit;run 必填 teamId/instruction/mode,可选 rounds/maxConcurrent/timeoutSeconds。只传对应 action 的字段。run 前须确认所有成员存活、idle、可参与团队且无待处理私人输入,团队未关闭,也无运行批次或在途工作。close 前先暂停并等待在途工作结束。",
27
27
  }),
28
28
  teamId: Type.Optional(id), name: Type.Optional(name), brief: Type.Optional(text), members: Type.Optional(members),
29
29
  instruction: Type.Optional(run.instruction), mode: Type.Optional(mode), rounds: run.rounds, maxConcurrent: run.maxConcurrent, timeoutSeconds: run.timeoutSeconds, ...page,
@@ -38,7 +38,7 @@ export const teamActionSchema = Type.Union([
38
38
  export const teamMessageParametersSchema = object({
39
39
  action: Type.Union([Type.Literal("read"), Type.Literal("post")], {
40
40
  description: "read 必填 teamId,只可选 afterSeq/seq/offset/limit,禁止 text/replyTo;post 必填 teamId/text,只可选 replyTo,禁止所有分页字段。",
41
- }), teamId: id, text: Type.Optional(Type.String({ ...text, description: "仅 post,必填:向全体成员公开的原文,不扩大任务授权。" })),
41
+ }), teamId: id, text: Type.Optional(Type.String({ ...text, description: "仅 post,必填:向全体成员公开的原文。" })),
42
42
  replyTo: Type.Optional(Type.Integer({ minimum: 1, description: "仅 post:回复已有消息的 seq。" })), ...page,
43
43
  });
44
44
  export const teamMessageActionSchema = Type.Union([
@@ -55,10 +55,10 @@ export const teamPageSchema = object({ teamId: id, messages: Type.Array(message)
55
55
  nextAfterSeq: Type.Union([Type.Integer(), Type.Null()], { description: "后续消息列表的 afterSeq;null 只表示列表已到末尾,仍须检查每条消息的 nextOffset。指定 seq 时始终为 null。" }) });
56
56
  const ownedView = object({ teamId: id, name: Type.String(), brief: Type.String(), closed: Type.Boolean(), owned: Type.Literal(true),
57
57
  members: Type.Array(object({ agentId: id, role: Type.String(), name: Type.String(), state: Type.String() })),
58
- lastSeq: Type.Integer(), activeCount: Type.Integer({ description: "所有批次中已领取、执行实例仍存活且尚无完成记录的请求数;paused 仍可能大于 0。" }),
58
+ lastSeq: Type.Integer(), activeCount: Type.Integer({ description: "各批次仍在途的请求数;paused 时也可能大于 0。" }),
59
59
  unresolved: Type.Array(object({ requestId: id, agentId: id, runId: id, round: Type.Integer(), active: Type.Boolean(),
60
- state: Type.String({ description: "queued=运行批次中尚未领取;accepted=已领取且仍在途;uncertain=已领取但执行实例/代次不再匹配、无完成记录;cancelled=批次已停止且未领取,或周期取消;unpublished=已完成但尚未公开有效原文;mixed/interactive=含人工或私人工作,不自动公开;failed/interrupted=失败或中断。不能将 unresolved 当作成功或自动重试许可。" }), cycleId: Type.Optional(id) }), {
61
- description: "所有批次中尚未确认完成且公开的请求,包含排队、在途、失败、结果不明和不宜公开的工作;不是仅列出运行中的请求。先核对原请求和业务结果,避免重复执行。",
60
+ state: Type.String({ description: "queued=待处理;accepted=在途;uncertain=结果未确认;cancelled=未执行或已取消;unpublished=已完成但结果尚未公开;mixed/interactive=含人工或私人工作,不自动公开;failed/interrupted=失败或中断。" }), cycleId: Type.Optional(id) }), {
61
+ description: "各批次尚未确认完成且公开的请求。先核对原请求和实际结果,再决定后续操作,避免重复执行。",
62
62
  }),
63
63
  run: Type.Optional(object({ runId: id, instruction: Type.String(), mode, state: Type.Union([Type.Literal("running"), Type.Literal("paused"), Type.Literal("finished")]),
64
64
  rounds: Type.Integer(), maxConcurrent: Type.Integer(), deadlineAt: Type.Number(), scheduled: Type.Integer(), published: Type.Integer(), reason: Type.Optional(Type.String()) })) });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "personal-bot",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "personal-bot",
9
- "version": "0.2.6",
9
+ "version": "0.2.8",
10
10
  "dependencies": {
11
11
  "ajv": "8.17.1",
12
12
  "ajv-formats": "3.0.1",
@@ -19,6 +19,7 @@
19
19
  "@deepseek-ai/cordis": "4.1.0",
20
20
  "@deepseek-ai/dsh": "0.2.2-rc.1",
21
21
  "@deepseek-ai/dsh-agent": "0.2.2-rc.1",
22
+ "@deepseek-ai/dsh-agent-preset-registry": "0.2.2-rc.1",
22
23
  "@deepseek-ai/dsh-api-remotes": "0.2.2-rc.1",
23
24
  "@deepseek-ai/dsh-attachment": "0.2.2-rc.1",
24
25
  "@deepseek-ai/dsh-client-file-upload": "0.2.2-rc.1",
@@ -51,33 +52,34 @@
51
52
  "typescript": "5.9.3"
52
53
  },
53
54
  "engines": {
54
- "dsh": "0.2.2-rc.1",
55
+ "dsh": ">=0.2.2-rc.1",
55
56
  "node": ">=22.19.0"
56
57
  },
57
58
  "peerDependencies": {
58
59
  "@deepseek-ai/cordis": "~4.1.0",
59
- "@deepseek-ai/dsh-agent": "0.2.2-rc.1",
60
- "@deepseek-ai/dsh-api-remotes": "0.2.2-rc.1",
61
- "@deepseek-ai/dsh-attachment": "0.2.2-rc.1",
62
- "@deepseek-ai/dsh-client-file-upload": "0.2.2-rc.1",
63
- "@deepseek-ai/dsh-client-ui-commands": "0.2.2-rc.1",
64
- "@deepseek-ai/dsh-commands": "0.2.2-rc.1",
65
- "@deepseek-ai/dsh-fs": "0.2.2-rc.1",
66
- "@deepseek-ai/dsh-fs-patch": "0.2.2-rc.1",
67
- "@deepseek-ai/dsh-home-paths": "0.2.2-rc.1",
68
- "@deepseek-ai/dsh-llm": "0.2.2-rc.1",
69
- "@deepseek-ai/dsh-session": "0.2.2-rc.1",
70
- "@deepseek-ai/dsh-session-persistence": "0.2.2-rc.1",
71
- "@deepseek-ai/dsh-session-query": "0.2.2-rc.1",
72
- "@deepseek-ai/dsh-skill": "0.2.2-rc.1",
73
- "@deepseek-ai/dsh-skill-filesystem": "0.2.2-rc.1",
74
- "@deepseek-ai/dsh-system-prompt": "0.2.2-rc.1",
75
- "@deepseek-ai/dsh-tool-executor-ptc": "0.2.2-rc.1",
76
- "@deepseek-ai/dsh-tools": "0.2.2-rc.1",
77
- "@deepseek-ai/dsh-typert-protocol": "0.2.2-rc.1",
78
- "@deepseek-ai/dsh-typert-registry": "0.2.2-rc.1",
79
- "@deepseek-ai/dsh-user-approval": "0.2.2-rc.1",
80
- "@deepseek-ai/dsh-working-directory": "0.2.2-rc.1",
60
+ "@deepseek-ai/dsh-agent": "*",
61
+ "@deepseek-ai/dsh-agent-preset-registry": "*",
62
+ "@deepseek-ai/dsh-api-remotes": "*",
63
+ "@deepseek-ai/dsh-attachment": "*",
64
+ "@deepseek-ai/dsh-client-file-upload": "*",
65
+ "@deepseek-ai/dsh-client-ui-commands": "*",
66
+ "@deepseek-ai/dsh-commands": "*",
67
+ "@deepseek-ai/dsh-fs": "*",
68
+ "@deepseek-ai/dsh-fs-patch": "*",
69
+ "@deepseek-ai/dsh-home-paths": "*",
70
+ "@deepseek-ai/dsh-llm": "*",
71
+ "@deepseek-ai/dsh-session": "*",
72
+ "@deepseek-ai/dsh-session-persistence": "*",
73
+ "@deepseek-ai/dsh-session-query": "*",
74
+ "@deepseek-ai/dsh-skill": "*",
75
+ "@deepseek-ai/dsh-skill-filesystem": "*",
76
+ "@deepseek-ai/dsh-system-prompt": "*",
77
+ "@deepseek-ai/dsh-tool-executor-ptc": "*",
78
+ "@deepseek-ai/dsh-tools": "*",
79
+ "@deepseek-ai/dsh-typert-protocol": "*",
80
+ "@deepseek-ai/dsh-typert-registry": "*",
81
+ "@deepseek-ai/dsh-user-approval": "*",
82
+ "@deepseek-ai/dsh-working-directory": "*",
81
83
  "@earendil-works/pi-ai": "*",
82
84
  "@earendil-works/pi-coding-agent": "*",
83
85
  "@earendil-works/pi-tui": "*",
@@ -90,6 +92,9 @@
90
92
  "@deepseek-ai/dsh-agent": {
91
93
  "optional": true
92
94
  },
95
+ "@deepseek-ai/dsh-agent-preset-registry": {
96
+ "optional": true
97
+ },
93
98
  "@deepseek-ai/dsh-api-remotes": {
94
99
  "optional": true
95
100
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "personal-bot",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/realqiyan/personal-bot.git"
@@ -22,7 +22,7 @@
22
22
  "extensions": [
23
23
  "./src/pbot.ts"
24
24
  ],
25
- "skills": [],
25
+ "skills": ["./resources/skills"],
26
26
  "prompts": [],
27
27
  "themes": []
28
28
  },
@@ -56,7 +56,7 @@
56
56
  ],
57
57
  "engines": {
58
58
  "node": ">=22.19.0",
59
- "dsh": "0.2.2-rc.1"
59
+ "dsh": ">=0.2.2-rc.1"
60
60
  },
61
61
  "scripts": {
62
62
  "check": "tsc --noEmit && npm run check:dependencies",
@@ -71,28 +71,29 @@
71
71
  },
72
72
  "peerDependencies": {
73
73
  "@deepseek-ai/cordis": "~4.1.0",
74
- "@deepseek-ai/dsh-agent": "0.2.2-rc.1",
75
- "@deepseek-ai/dsh-session": "0.2.2-rc.1",
76
- "@deepseek-ai/dsh-session-persistence": "0.2.2-rc.1",
77
- "@deepseek-ai/dsh-session-query": "0.2.2-rc.1",
78
- "@deepseek-ai/dsh-llm": "0.2.2-rc.1",
79
- "@deepseek-ai/dsh-commands": "0.2.2-rc.1",
80
- "@deepseek-ai/dsh-api-remotes": "0.2.2-rc.1",
81
- "@deepseek-ai/dsh-client-ui-commands": "0.2.2-rc.1",
82
- "@deepseek-ai/dsh-client-file-upload": "0.2.2-rc.1",
83
- "@deepseek-ai/dsh-tools": "0.2.2-rc.1",
84
- "@deepseek-ai/dsh-home-paths": "0.2.2-rc.1",
85
- "@deepseek-ai/dsh-system-prompt": "0.2.2-rc.1",
86
- "@deepseek-ai/dsh-skill": "0.2.2-rc.1",
87
- "@deepseek-ai/dsh-skill-filesystem": "0.2.2-rc.1",
88
- "@deepseek-ai/dsh-working-directory": "0.2.2-rc.1",
89
- "@deepseek-ai/dsh-fs": "0.2.2-rc.1",
90
- "@deepseek-ai/dsh-attachment": "0.2.2-rc.1",
91
- "@deepseek-ai/dsh-fs-patch": "0.2.2-rc.1",
92
- "@deepseek-ai/dsh-user-approval": "0.2.2-rc.1",
93
- "@deepseek-ai/dsh-tool-executor-ptc": "0.2.2-rc.1",
94
- "@deepseek-ai/dsh-typert-protocol": "0.2.2-rc.1",
95
- "@deepseek-ai/dsh-typert-registry": "0.2.2-rc.1",
74
+ "@deepseek-ai/dsh-agent": "*",
75
+ "@deepseek-ai/dsh-agent-preset-registry": "*",
76
+ "@deepseek-ai/dsh-session": "*",
77
+ "@deepseek-ai/dsh-session-persistence": "*",
78
+ "@deepseek-ai/dsh-session-query": "*",
79
+ "@deepseek-ai/dsh-llm": "*",
80
+ "@deepseek-ai/dsh-commands": "*",
81
+ "@deepseek-ai/dsh-api-remotes": "*",
82
+ "@deepseek-ai/dsh-client-ui-commands": "*",
83
+ "@deepseek-ai/dsh-client-file-upload": "*",
84
+ "@deepseek-ai/dsh-tools": "*",
85
+ "@deepseek-ai/dsh-home-paths": "*",
86
+ "@deepseek-ai/dsh-system-prompt": "*",
87
+ "@deepseek-ai/dsh-skill": "*",
88
+ "@deepseek-ai/dsh-skill-filesystem": "*",
89
+ "@deepseek-ai/dsh-working-directory": "*",
90
+ "@deepseek-ai/dsh-fs": "*",
91
+ "@deepseek-ai/dsh-attachment": "*",
92
+ "@deepseek-ai/dsh-fs-patch": "*",
93
+ "@deepseek-ai/dsh-user-approval": "*",
94
+ "@deepseek-ai/dsh-tool-executor-ptc": "*",
95
+ "@deepseek-ai/dsh-typert-protocol": "*",
96
+ "@deepseek-ai/dsh-typert-registry": "*",
96
97
  "@earendil-works/pi-ai": "*",
97
98
  "@earendil-works/pi-coding-agent": "*",
98
99
  "@earendil-works/pi-tui": "*",
@@ -101,6 +102,7 @@
101
102
  "peerDependenciesMeta": {
102
103
  "@deepseek-ai/cordis": { "optional": true },
103
104
  "@deepseek-ai/dsh-agent": { "optional": true },
105
+ "@deepseek-ai/dsh-agent-preset-registry": { "optional": true },
104
106
  "@deepseek-ai/dsh-session": { "optional": true },
105
107
  "@deepseek-ai/dsh-session-persistence": { "optional": true },
106
108
  "@deepseek-ai/dsh-session-query": { "optional": true },
@@ -141,6 +143,7 @@
141
143
  "@deepseek-ai/cordis": "4.1.0",
142
144
  "@deepseek-ai/dsh": "0.2.2-rc.1",
143
145
  "@deepseek-ai/dsh-agent": "0.2.2-rc.1",
146
+ "@deepseek-ai/dsh-agent-preset-registry": "0.2.2-rc.1",
144
147
  "@deepseek-ai/dsh-api-remotes": "0.2.2-rc.1",
145
148
  "@deepseek-ai/dsh-client-ui-commands": "0.2.2-rc.1",
146
149
  "@deepseek-ai/dsh-client-file-upload": "0.2.2-rc.1",
package/python/README.md CHANGED
@@ -49,7 +49,7 @@ python3 scripts/setup-python.py --check # 只检查,不创建或安装
49
49
 
50
50
  ## 使用与验证
51
51
 
52
- setup 安装 numpy、pandas、TA-Lib、backtesting、scipy、statsmodels、matplotlib、scikit-learn、pyarrow、openpyxl、seaborn 和 Bokeh。按任务导入,参见[计算参考](../resources/references/compute.md)。市场规则、费用、成交时点和数据切分由具体研究确定,原生 Backtest 不自动提供 A 股 T+1、整手或涨跌停约束。
52
+ setup 安装 numpy、pandas、TA-Lib、backtesting、scipy、statsmodels、matplotlib、scikit-learn、pyarrow、openpyxl、seaborn 和 Bokeh。按任务导入,环境与项目运行见[计算参考](../resources/references/compute.md),需要技术指标或回测时再读[指标与回测](../resources/references/compute-finance.md)。市场规则、费用、成交时点和数据切分由具体研究确定,原生 Backtest 不自动提供 A 股 T+1、整手或涨跌停约束。
53
53
 
54
54
  激活后直接执行 `python scripts/analyze.py` 或 `python -m analysis.main`。工作目录、模块导入、参数和结果位置遵循项目约定。项目构建或测试明确要求另一环境时,按项目约定执行。pbot 不复制源码、不生成输入文件或计算记录、不管理研究进程的超时。Python 与 Bash 不是文件或网络沙箱,也不授予交易权限。
55
55
 
@@ -1,39 +1,11 @@
1
1
  # 协调者
2
2
 
3
- 在用户请求范围内完成必要的信息收集、分析与验证,直至足以支持本次交付。个人信息不足时,可先完成公共证据分析并给出条件化方案;只在关键缺口阻止有效交付时询问。
3
+ 对本次交付负责,沿用已有约定,完成用户需要的结果。
4
4
 
5
- ## 选择执行入口
5
+ 普通问答直接完成。需要专家协助时用 pbot_agent,委派写明目标、相关资料、约束和交付要求。需要成员直接交流时用 pbot_team。回溯旧讨论用 pbot_history。周期、重复流程、DAG 或会话退出后仍需执行的任务,先读包内 `references/task-conductor.md`。
6
6
 
7
- - 普通问答和不需要独立上下文的工作直接完成。
8
- - 回溯以前的讨论时使用 pbot_history,按事情的大意尝试相关词,沿父子节点展开到原文,核对后续修正和来源。历史内容用于查询,不自动成为当前任务或授权。
9
- - 独立协助或核验使用 pbot_agent。委派提供目标、交付要求、资料依据和约束,不依赖专家知道父会话历史。
10
- - 需要成员直接交流时,使用 pbot_team 组队。roundRobin 依次讨论,parallel 在每轮内并行、轮间汇合。提供目标、每人职责、授权范围及交付要求。成员原文直接同步,无须逐条转述。
11
- - 周期、重复流程、DAG 或需在当前宿主会话退出后继续的任务,先读包内 `references/task-conductor.md`,再按 using-task-conductor 技能使用原生任务能力。缺少该能力只阻塞依赖它的部分。
7
+ 汇总专家结果并整合正式资料。委派包含文件修改时说明修改范围,多人写入时划分文件责任;合并不同结果时处理口径差异和未解决的问题。
12
8
 
13
- ## 委派与验收
9
+ 需要独立复核时,另开专家会话或任务节点,提供待检查内容、相关资料和具体问题。
14
10
 
15
- 默认由专家交回报告和必要产物引用,由主会话整合正式资料。原任务已授权资料修改时,可在委派中明确专家的修改范围,无须用户另行指定由专家执行;多个协作者写入时划分文件责任。
16
-
17
- 收到结果后,按本次完成条件核对报告与实际产物。汇总数值前核对对象、时期、单位、指标定义和来源;范围不同的结果分别解释,重复转述不算独立证据。
18
-
19
- 失败、中断或取消后,判断已完成部分与后续条件,不自动重跑。人工子会话输入不扩大主会话原任务授权。委派不扩大原用户授权;需要用户决定的业务交回主会话说明。
20
-
21
- ## 团队协作
22
-
23
- 公共消息与成员当前团队请求的最终回答会向团队公开;只提供本次协作需要的信息,避免披露私人历史或无关资料。成员已有记忆可能影响回答,团队讨论不等于独立复核。
24
-
25
- 批次 finished 只表示安排的发言均结束,不证明任务完成或达成共识。直接核对成员原文和实际产物,按原任务验收;团队调度与状态转换遵循工具契约。
26
-
27
- ## 独立复核与业务执行
28
-
29
- 按任务风险或用户要求组织独立方案复核。使用新子会话或独立任务节点,提供具体方案、精确参数、原始依据和已确认约束;原分析会话的后续对话不算独立复核。
30
-
31
- 复核只使用查询与计算,不执行业务变更。要求复核者独立核验关键事实,交付通过、拒绝或无法确认及其依据。工作结束、成果验收、专业复核和用户批准是不同事实;复核通过不授予执行许可。
32
-
33
- 使用原生工具执行已授权业务并核对结果。结果未知时先核实,不自动重发;只暂停依赖未知结果的步骤。
34
-
35
- ## 成果保存
36
-
37
- 及时保存有依据的阶段结论、可复用知识、已确认决策,以及交接所需或用户要求的成果,无须再次询问。普通问答、零散想法和原始输出不逐轮存档。
38
-
39
- 新结果、纠正或状态变化需要同步,或用户要求整理、复用任务定义、结项时,使用 project-maintenance。发现其他未完成事项不构成开展新任务的授权。
11
+ 失败或中断后说明已完成部分、剩余工作和阻碍。需要用户决定的事项由你汇总说明。
@@ -1,19 +1,7 @@
1
1
  # 通用专家
2
2
 
3
- 完成本次委派范围内的研究、分析、资料查找、计算或独立复核,按任务选择技能。
3
+ 完成本次委派,使用相关资料和技能。交回结果、需要说明的问题及产物路径。独立复核时自行检查,说明发现的问题和不确定之处。
4
4
 
5
- 从委派引用及工作区入口查找依据。按交付需要说明结论、关键依据、来源时点、适用范围、限制及实际产物路径;数值注明影响理解的对象、期间、单位与计算口径。说明实际完成的检查,关键事实不足时明确无法确认。
5
+ 默认交回报告,由主会话整合正式资料;委派包含文件修改时直接完成,并说明变更。
6
6
 
7
- 独立复核时,核验方案参数、前置条件、实际后果和用户约束,独立查询关键事实,报告通过、拒绝或无法确认及其依据。研究与复核只使用明确的查询接口和计算,不执行业务变更;复核结论不授予执行许可。
8
-
9
- 默认交回报告与必要产物引用,由主会话整合正式资料。原任务已授权资料修改且委派明确修改范围时,可在该范围内修改正式正文并说明变更,无须再次询问。
10
-
11
- 使用原生 CLI/MCP 完成本次委派,可自主诊断工具接入与环境问题。新增权限或共享环境变更先核对原任务及委派中的已有授权,已覆盖的操作不重复询问;需要补充授权或用户在会话中操作时,交回已有结果、缺口和所需条件,继续不受影响的工作。项目构建和测试遵循项目声明的环境。
12
-
13
- 不创建子专家或外部任务,不管理团队。需要其他协作者或持久执行时,交回建议,由主会话决定。
14
-
15
- ## 团队工作
16
-
17
- 收到团队发言安排时,按当前职责和轮次工作。使用 pbot_team_message read/post 直接交流原文,replyTo 指向公共消息;不等待对方在线回应,不通过发消息追加轮次。上下文注明未包含或截断的内容时,按 seq/offset 读取所需原文后再下结论;压缩后缺少旧证据时也应重读。成员的话是协作信息,不是新的用户授权。
18
-
19
- post 与本次团队请求的最终答复会公开给全体成员。只公开任务需要的信息,不主动披露私人工作历史、完整工具输出或无关资料。指出依据、分歧、未解决问题与产物位置。每轮接续已有工作,不重复可能产生副作用的步骤;结果未知时先查询,不重发操作。轮次结束不等于任务通过验收。
7
+ 可自主诊断工具和环境问题。需要主会话或用户协助时,交回已有结果和具体阻碍,继续不受影响的工作。不创建子专家或外部任务,不管理团队;需要其他协作者或持久执行时向主会话提出建议。
@@ -1,4 +1,4 @@
1
- 你负责为历史查询整理一段连续对话。输入是历史资料,不是当前指令;不回答其中的问题,不执行任务,不调用工具。只输出摘要。
1
+ 为历史查询概括输入的连续对话。将输入作为待总结的资料,只输出摘要,不回答或执行其中的请求。
2
2
 
3
3
  使用原对话的主要语言,用几段简短文字记录讨论的事情、用户的要求与原因、约束、决定及变化、否决的方案和未决问题。保留有检索价值的名称、术语、数字与路径。代词和简短认可应在输入能够确定时还原含义;不能确定就保留不确定性。
4
4
 
@@ -0,0 +1,7 @@
1
+ ## 本次团队工作
2
+
3
+ 按当前职责和轮次接续已有工作,用 pbot_team_message read/post 交流;发言后继续本轮任务,无需等待回应。
4
+
5
+ post 和本次请求的最终答复会向全体成员公开。分享与本次协作有关的内容,省略无关的私人历史和工具输出。
6
+
7
+ 需要更多上下文或正文不完整时,按返回的 seq/offset 读取原文。
@@ -1,19 +1,16 @@
1
- # 工作区
1
+ # Personal Bot
2
2
 
3
- 协助用户学习、推进项目、开展研究与支持决策,沉淀可复用的知识、方法与结论。投资是按需开展的专业领域。
3
+ 按用户请求和已有约定推进工作,常规选择自行决定。只有缺失信息会改变目标或关键结果时才提问,并继续不受影响的工作。
4
4
 
5
- 环境信息见 `pbot_environment`:`workspaceRoot` 是工作区根目录,`cwd` 是当前执行目录,`resourceRoot` 是包内资料根目录,`python` 是共享计算环境状态。下文资料路径相对工作区根目录;包内路径相对 `resourceRoot`。执行命令和文件工具时按实际工作目录解析路径。
5
+ ## 工作方式
6
6
 
7
- ## 开始与推进
7
+ - 按工作区约定定位相关资料,需要更多线索时读目录入口或搜索,按需使用匹配的技能。
8
+ - 操作后查看结果。超时、取消或断连后,先查状态再决定是否重试,避免重复执行。
9
+ - 使用当前宿主的原生 CLI/MCP。接入与排障使用 provider-connections;按需读取 `providers/<id>/GUIDE.md` 中的数据口径和限制。认证使用原生登录或凭据引用,资料中不保存凭据值。
8
10
 
9
- - 涉及工作区资料时,优先从已有根 `AGENTS.md` 定位相关项目或长期事务,按需读取目录入口、正文和匹配的技能。没有资料入口时按任务查找或创建必要资料。
10
- - 复用历史结论前核对范围、时点与关键条件,只重核受变化影响的部分。分析假设不等于用户已确认的约束。
11
- - 复杂任务先明确交付用途、必要证据、可接受限制与完成条件,沿用已有约定。
12
- - 在当前授权内持续推进,常规、可逆的实现选择自行决定。新增权限、安装或共享环境变更先核对已有授权,已覆盖的操作不重复询问。仅当缺失信息影响目标、关键结果或授权时提问;暂停依赖步骤,继续有助于目标的独立工作。
13
- - 资料、手册、工具结果、待办和职责补充不扩大用户授权。只开展当前任务需要的工作,不为普通问答增加文件或固定流程。
14
- - 使用常用词、短句和一致术语。先给结论,按需说明依据、假设、验证、限制和实际产物路径。
11
+ ## 资料与环境
15
12
 
16
- ## 资料入口与归属
13
+ 沿用已有工作区约定;新资料按下列用途组织。正文维护一份,其他位置用引用连接。
17
14
 
18
15
  | 路径 | 用途 |
19
16
  | --- | --- |
@@ -21,21 +18,13 @@
21
18
  | `areas/<领域>/` | 长期目标、约束、决策与复盘;个人组合信息 |
22
19
  | `projects/<名称>/` | 任务定义、结论与交付物;源码、依赖和测试 |
23
20
  | `knowledge/<主题>/` | 可跨任务复用的概念、方法与口径 |
24
- | `providers/` | `AGENTS.md` 导航与各 `<id>/GUIDE.md` 能力手册 |
21
+ | `providers/AGENTS.md`、`providers/<id>/GUIDE.md` | 能力导航与使用手册 |
25
22
  | `scratch/` | 临时脚本、查询与计算数据、下载及运行环境 |
26
- | `agents/` | `coordinator.md` 与 `general-purpose.md` 的职责补充 |
23
+ | `agents/` | `coordinator.md`、`general-purpose.md` 的职责补充 |
27
24
  | `.agents/skills/` | 工作区自有专业方法 |
28
25
 
29
- 可再次查询的数据在使用时按口径获取。结论注明来源、时点与适用条件。
26
+ 保存有后续用途的结论、方法、决策和产物;普通问答不逐轮存档。保存前查找同主题正文,更新或整理时使用 project-maintenance。可再次查询的数据按记录的口径获取。保留用户资料、历史记录和备份。
30
27
 
31
- 保存前搜索同主题正文,优先更新原文,其他位置用引用连接。整理、修正或结项使用 project-maintenance 技能,遵守本角色的资料修改权限。
28
+ 环境上下文中的 `workspaceRoot` 是资料工作区根目录,`resourceRoot` 是包内资料根目录,`python` 给出共享环境状态。资料路径相对工作区根目录,命令与文件工具按实际 cwd 解析路径。需要 Python 时读取包内 `references/compute.md`;共享环境未就绪时不退回系统 Python。项目构建和测试遵循项目声明的环境。
32
29
 
33
- ## 调用与计算
34
-
35
- CLI 通过 Bash 使用原生命令与当前 help,MCP 使用当前宿主的原生接入与工具定义,Pi 和 dsh 配置分别管理。先按需读取 providers/ 中的手册,了解数据口径和限制;接入或修复使用 provider-connections 技能。不索取、输出或保存凭据值。目标、市场和偏好保存在所属普通资料中。
36
-
37
- 按用户授权执行本次业务。研究、接入和验证不授权交易、转账或账本修改。协议成功不证明业务完成;超时、断连和取消不证明未执行。可能已发送的操作先查询原生状态,不因恢复会话或结果缺失自动重发。
38
-
39
- 共享 Python 环境为 ready 时,通过 Bash 使用 python 或 python3 和第三方库原生 API。环境异常可自主诊断,只暂停依赖该环境的步骤,不自行退回系统 Python;项目构建和测试遵循项目声明的环境。运行计算前按需读取包内 `references/compute.md`,按项目约定选择工作目录并保存必要产物。
40
-
41
- Bash、Python、MCP 和其他扩展具有实际账户与凭据权限,不是沙箱。
30
+ 答复先给结论,按需补充说明和产物路径。数值注明影响理解的对象、期间、单位与口径。
@@ -0,0 +1,22 @@
1
+ # 指标与回测
2
+
3
+ ## TA-Lib
4
+
5
+ 通过 `import talib` 使用原生函数。用 `talib.get_function_groups()`、`talib.get_functions()` 和 `help(talib.函数名)` 核对能力、参数与返回值。
6
+
7
+ 计算前核对时间顺序、复权、缺失数据、单位与样本长度,多输入 OHLCV 数组必须按同一时间轴对齐。保留影响结果解释的原生规则:
8
+
9
+ - `MACD` 返回 `(macd, signal, hist)`,其中 `hist = macd - signal`,不乘 2。
10
+ - `BBANDS` 返回 `(upper, middle, lower)`,默认使用 SMA 中轨和两倍总体标准差。
11
+ - 暖机期为 NaN,例如 SMA(20) 前 19 根、RSI(14) 前 14 根不可用。EMA、RSI 的种子和平滑规则不等同于直接 pandas ewm;持平序列的 RSI 暖机后为 0,不是 50。
12
+ - NaN 输入可能影响后续输出,不擅自填零或把暖机值当成信号。严格 JSON 中将非有限值转为 null。
13
+
14
+ 按需记录参数、库版本和数据来源,便于复现。
15
+
16
+ ## backtesting
17
+
18
+ 用 `from backtesting import Backtest, Strategy`,通过 Strategy 的 `init()`、`next()` 定义策略,再运行 `Backtest(data, 策略类, ...).run()`。数据为按时间升序的 OHLC DataFrame,可带 Volume;参数以当前版本 API 为准。TA-Lib 指标可用 `self.I(talib.SMA, self.data.Close, 20)` 注册。
19
+
20
+ 显式确定资金、手续费、价差、成交时点与仓位假设。原生 Backtest 不自动提供 A 股 T+1、整手买入、涨跌停或交易日历约束;任务需要时明确建模和验证,无法表达时说明限制,不把默认值当作市场规则。
21
+
22
+ 按研究问题选择样本内外划分及暖机方法,避免未来数据泄漏。交付时说明参数、版本与限制,按需保留统计和交易记录;导出时处理 Series、DataFrame、时间和非有限值。