personal-bot 0.2.14 → 0.2.15

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 (75) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/.claude-plugin/plugin.json +2 -2
  3. package/README.md +10 -11
  4. package/README.zh-CN.md +10 -11
  5. package/docs/README.md +2 -2
  6. package/docs/adr/0001-claude-skill-discovery.md +1 -1
  7. package/docs/agent-collaboration.md +3 -3
  8. package/docs/architecture-guidelines.md +1 -1
  9. package/docs/capability-design.md +2 -2
  10. package/docs/claude-code-design.md +10 -11
  11. package/docs/claude-code.md +8 -15
  12. package/docs/dsh.md +7 -8
  13. package/docs/file-storage.md +2 -3
  14. package/docs/installation-design.md +4 -5
  15. package/docs/interaction-design.md +1 -1
  16. package/docs/model-context.md +9 -10
  17. package/docs/release.md +5 -5
  18. package/docs/technical-design.md +16 -21
  19. package/docs/workspace-configuration.md +5 -8
  20. package/hooks/hooks.json +1 -4
  21. package/lib/client.js +3 -15
  22. package/lib/extension/acp-member.js +1 -3
  23. package/lib/extension/acp-worker.js +3 -22
  24. package/lib/extension/claude-hooks.d.ts +0 -6
  25. package/lib/extension/claude-hooks.js +5 -31
  26. package/lib/extension/dsh/acp-member.js +1 -2
  27. package/lib/extension/dsh/command.js +2 -7
  28. package/lib/extension/dsh/management.d.ts +1 -1
  29. package/lib/extension/dsh/management.js +3 -3
  30. package/lib/extension/dsh/workspace.d.ts +1 -9
  31. package/lib/extension/dsh/workspace.js +4 -29
  32. package/lib/extension/setup-cli.js +4 -4
  33. package/lib/integrations/dsh/resources.d.ts +1 -5
  34. package/lib/integrations/dsh/resources.js +2 -5
  35. package/lib/integrations/installation/processes.js +0 -15
  36. package/lib/ui/dsh/management.js +1 -9
  37. package/lib/ui/dsh/styles.d.ts +1 -1
  38. package/lib/ui/dsh/styles.js +2 -2
  39. package/lib/ui/presentation.js +1 -1
  40. package/package.json +1 -4
  41. package/resources/claude/skills/pbot/SKILL.md +2 -3
  42. package/resources/prompts/workspace.md +1 -1
  43. package/resources/references/compute.md +6 -8
  44. package/scripts/README.md +2 -6
  45. package/src/extension/acp-member.ts +1 -3
  46. package/src/extension/acp-worker.ts +3 -12
  47. package/src/extension/claude-hooks.ts +5 -25
  48. package/src/extension/command.ts +7 -16
  49. package/src/extension/dsh/acp-member.ts +1 -2
  50. package/src/extension/dsh/command.ts +2 -6
  51. package/src/extension/dsh/management.ts +3 -3
  52. package/src/extension/dsh/workspace.ts +5 -25
  53. package/src/extension/events.ts +2 -11
  54. package/src/extension/lifecycle.ts +8 -23
  55. package/src/extension/setup-cli.ts +4 -4
  56. package/src/extension/subagent-entry.ts +6 -12
  57. package/src/integrations/dsh/resources.ts +2 -5
  58. package/src/integrations/installation/processes.ts +0 -13
  59. package/src/integrations/pi/pi-agents.ts +12 -5
  60. package/src/pbot.ts +1 -2
  61. package/src/ui/dsh/management.ts +2 -8
  62. package/src/ui/dsh/styles.ts +2 -2
  63. package/src/ui/presentation.ts +1 -1
  64. package/lib/integrations/process.d.ts +0 -14
  65. package/lib/integrations/process.js +0 -48
  66. package/lib/integrations/python-activation.d.ts +0 -2
  67. package/lib/integrations/python-activation.js +0 -29
  68. package/lib/services/workspace/python-environment-service.d.ts +0 -21
  69. package/lib/services/workspace/python-environment-service.js +0 -66
  70. package/python/README.md +0 -72
  71. package/python/requirements.lock +0 -38
  72. package/scripts/setup-python.py +0 -170
  73. package/src/integrations/process.ts +0 -40
  74. package/src/integrations/python-activation.ts +0 -23
  75. package/src/services/workspace/python-environment-service.ts +0 -61
@@ -12,8 +12,6 @@ import { DshAgentEvents } from "./agent-events.js";
12
12
  import { registerDshFileEvents } from "./files.js";
13
13
  import { DshHistoryWork, registerDshHistoryEvents } from "./history.js";
14
14
  import { registerDshHistoryTool } from "../../tools/history/dsh-tool.js";
15
- import { activatePython } from "../../integrations/python-activation.js";
16
- import { PythonEnvironmentService } from "../../services/workspace/python-environment-service.js";
17
15
  import { requireThat } from "../../common/validation.js";
18
16
  import { registerDshSkills } from "../../integrations/dsh/skills.js";
19
17
  import { readWorkspaceConfig, workspaceDisabledMessage } from "../../services/workspace/workspace-config.js";
@@ -23,7 +21,6 @@ export class DshWorkspace {
23
21
  ctx;
24
22
  root;
25
23
  agent;
26
- python;
27
24
  component;
28
25
  historyWork;
29
26
  releaseHistory;
@@ -37,11 +34,10 @@ export class DshWorkspace {
37
34
  #scope;
38
35
  #events;
39
36
  #closing;
40
- constructor(ctx, root, agent, python, component, historyWork, releaseHistory, acp) {
37
+ constructor(ctx, root, agent, component, historyWork, releaseHistory, acp) {
41
38
  this.ctx = ctx;
42
39
  this.root = root;
43
40
  this.agent = agent;
44
- this.python = python;
45
41
  this.component = component;
46
42
  this.historyWork = historyWork;
47
43
  this.releaseHistory = releaseHistory;
@@ -57,7 +53,7 @@ export class DshWorkspace {
57
53
  scope.effect(() => () => { if (this.#experts.get(d.agentId) === runtime)
58
54
  this.#experts.delete(d.agentId); });
59
55
  registerDshSkills(scope, child);
60
- await dshResources(scope, child, root, "general-purpose", () => python.status, runtime.check);
56
+ await dshResources(scope, child, root, "general-purpose", runtime.check);
61
57
  const teamTool = dshExpertTools(scope, child, d.options);
62
58
  if (teamTool)
63
59
  registerDshTeamMessageTool(scope, child, this.teams, runtime.actor, runtime.check);
@@ -84,7 +80,7 @@ export class DshWorkspace {
84
80
  this.check();
85
81
  this.#scope = await this.agent.ctx.plugin({ name: "pbot-coordinator", inject: dshDependencies, apply: async (ctx) => {
86
82
  registerDshSkills(ctx, this.agent);
87
- await dshResources(ctx, this.agent, this.root, "coordinator", () => this.python.status, this.check);
83
+ await dshResources(ctx, this.agent, this.root, "coordinator", this.check);
88
84
  registerDshFileEvents(ctx, this.agent, this.root, false, this.check);
89
85
  registerDshAgentTool(ctx, this.agent, this.agents, this.owner, this.check);
90
86
  registerDshTeamTool(ctx, this.agent, this.teams, this.agents, this.owner, this.check);
@@ -170,18 +166,14 @@ export class DshWorkspace {
170
166
  return this.#closing;
171
167
  }
172
168
  }
173
- /** The execution component owns Python; closing one Session must not undo its activation. */
174
169
  export class DshWorkspaces {
175
170
  ctx;
176
- python = new PythonEnvironmentService(process.cwd());
177
171
  #parents = new Map();
178
172
  #initializing = new Map();
179
173
  #configurations = new Map();
180
174
  #parentEffects = new Map();
181
175
  #histories = new Map();
182
176
  #lifetime = new AbortController();
183
- #restorePython;
184
- #preparing;
185
177
  #closing;
186
178
  constructor(ctx) {
187
179
  this.ctx = ctx;
@@ -244,7 +236,7 @@ export class DshWorkspaces {
244
236
  const history = await this.history(root);
245
237
  let workspace;
246
238
  try {
247
- workspace = new DshWorkspace(this.ctx, root, agent, this.python, this.#lifetime.signal, history.work, history.release, configuration.acp);
239
+ workspace = new DshWorkspace(this.ctx, root, agent, this.#lifetime.signal, history.work, history.release, configuration.acp);
248
240
  const owned = workspace;
249
241
  const dispose = agent.ctx.effect(() => async () => {
250
242
  this.#parents.delete(agent);
@@ -255,7 +247,6 @@ export class DshWorkspaces {
255
247
  this.#parentEffects.set(agent, dispose);
256
248
  await workspace.open();
257
249
  this.#lifetime.signal.throwIfAborted();
258
- void this.preparePython().catch(error => this.ctx.logger.warn(String(error)));
259
250
  return workspace;
260
251
  }
261
252
  catch (error) {
@@ -332,19 +323,6 @@ export class DshWorkspaces {
332
323
  }
333
324
  return this.get(agent);
334
325
  }
335
- preparePython() {
336
- this.#lifetime.signal.throwIfAborted();
337
- if (this.#preparing)
338
- return this.#preparing;
339
- this.#preparing = (async () => {
340
- const result = await this.python.setup(this.#lifetime.signal);
341
- this.#lifetime.signal.throwIfAborted();
342
- if (!this.#restorePython)
343
- this.#restorePython = activatePython(result.directory);
344
- return result;
345
- })().finally(() => { this.#preparing = undefined; });
346
- return this.#preparing;
347
- }
348
326
  close() {
349
327
  if (this.#closing)
350
328
  return this.#closing;
@@ -356,7 +334,6 @@ export class DshWorkspaces {
356
334
  const closed = await Promise.allSettled(opened.flatMap(value => value.status === "fulfilled" && value.value ? [value.value.close()] : []));
357
335
  const effects = await Promise.allSettled([...this.#parentEffects.values()].map(dispose => dispose()));
358
336
  const histories = await Promise.allSettled([...this.#histories.values()].map(value => value.work.close()));
359
- await this.python.close();
360
337
  const errors = [...new Set([...closed, ...effects, ...histories].flatMap(value => value.status === "rejected" ? [value.reason] : []))];
361
338
  if (errors.length)
362
339
  throw new AggregateError(errors, "部分 dsh 工作区未能完成关闭。");
@@ -366,8 +343,6 @@ export class DshWorkspaces {
366
343
  this.#configurations.clear();
367
344
  this.#parentEffects.clear();
368
345
  this.#histories.clear();
369
- this.#restorePython?.();
370
- this.#restorePython = undefined;
371
346
  }
372
347
  })();
373
348
  return this.#closing;
@@ -26,7 +26,7 @@ export async function main(args) {
26
26
  if (options.action === "help") {
27
27
  console.log("Personal Bot " + manifest.version + "\n\n用法:pbot setup [--workspace <目录>]\n" +
28
28
  " npx personal-bot@latest setup\n\nsetup 安装或升级 Pi、pbot 和选中的插件,然后启动 Pi 执行 /pbot init。\n" +
29
- "支持 Linux/macOS,需要 Node.js 22.19+、npm 和 Python 3.11+。\n--help 显示帮助;--version 显示安装器版本。");
29
+ "支持 Linux/macOS,需要 Node.js 22.19+ 和 npm。\n--help 显示帮助;--version 显示安装器版本。");
30
30
  return 0;
31
31
  }
32
32
  if (!process.stdin.isTTY || !process.stdout.isTTY) {
@@ -40,7 +40,7 @@ export async function main(args) {
40
40
  const ui = new SetupUI(controller), processes = new SetupProcesses(controller.signal);
41
41
  try {
42
42
  const cwd = process.cwd();
43
- ui.text("Personal Bot " + manifest.version + " — 安装与升级\n正在检查 Node/npm、Python 和 tmux…");
43
+ ui.text("Personal Bot " + manifest.version + " — 安装与升级\n正在检查 Node/npm 和 tmux…");
44
44
  const system = await inspectSystem(processes, cwd);
45
45
  const supplied = options.workspace ?? await ui.ask("工作区目录(当前、已有或新建目录)", cwd);
46
46
  const workspace = await resolveWorkspace(supplied, cwd, homedir());
@@ -104,7 +104,7 @@ export async function main(args) {
104
104
  const blocking = choices.find(choice => choice.required && choice.error);
105
105
  if (blocking)
106
106
  throw new Error(blocking.error);
107
- ui.text("升级前请停止活动 pbot 子会话和相关 Python 脚本。Pi 为当前用户共用,插件只处理此工作区。");
107
+ ui.text("升级前请停止活动 pbot 子会话。Pi 为当前用户共用,插件只处理此工作区。");
108
108
  if (!await ui.confirm("执行以上计划"))
109
109
  return 130;
110
110
  await mkdir(workspace, { recursive: true });
@@ -114,7 +114,7 @@ export async function main(args) {
114
114
  const failed = result.results.some(item => item.state === "failed");
115
115
  if (!result.pi)
116
116
  return 1;
117
- ui.text("\n软件安装阶段结束。初始化、Python 环境和外部服务的状态由 Pi/pbot/插件分别报告。");
117
+ ui.text("\n软件安装阶段结束。工作区初始化和外部服务的状态由 Pi/pbot/插件分别报告。");
118
118
  if (await ui.confirm(failed ? "部分插件失败,是否仍启动 Pi 并初始化启用工作区" : "启动 Pi 并初始化启用工作区", !failed)) {
119
119
  process.stdin.pause();
120
120
  await host.start(result.pi, workspace);
@@ -1,10 +1,6 @@
1
1
  import type { Context } from "@deepseek-ai/cordis";
2
2
  import type { Agent } from "@deepseek-ai/dsh-agent";
3
3
  import type { AgentOptions } from "../../model/agent.js";
4
- export declare function dshResources(ctx: Context, _agent: Agent, root: string, role: "coordinator" | "general-purpose", python: () => {
5
- state: string;
6
- directory?: string;
7
- error?: string;
8
- }, check: () => void): Promise<void>;
4
+ export declare function dshResources(ctx: Context, _agent: Agent, root: string, role: "coordinator" | "general-purpose", check: () => void): Promise<void>;
9
5
  /** Map the expert's native loadout; this is not isolation from Bash, CLI, or MCP. */
10
6
  export declare function dshExpertTools(ctx: Context, agent: Agent, options: AgentOptions): boolean;
@@ -3,17 +3,14 @@ import { join } from "node:path";
3
3
  import { agentText } from "../agent-resources.js";
4
4
  import { resourceRoot } from "../../common/paths.js";
5
5
  import { requireThat } from "../../common/validation.js";
6
- export async function dshResources(ctx, _agent, root, role, python, check) {
6
+ export async function dshResources(ctx, _agent, root, role, check) {
7
7
  const read = () => Promise.all([agentText(role, root), readFile(join(resourceRoot, "prompts/workspace.md"), "utf8")]);
8
8
  const [text, workspace] = await read();
9
9
  check();
10
10
  ctx.systemPrompt.section({ name: "pbot:role", order: 1, text, interpolate: false });
11
11
  ctx.systemPrompt.section({ name: "pbot:workspace", order: 2, text: workspace, interpolate: false });
12
12
  ctx.systemPrompt.context({ name: "pbot:environment", order: 300, required: true, interpolate: false,
13
- text: () => {
14
- const { state, directory } = python();
15
- return JSON.stringify({ workspaceRoot: root, resourceRoot, python: { state, ...(directory ? { directory } : {}) } });
16
- } });
13
+ text: JSON.stringify({ workspaceRoot: root, resourceRoot }) });
17
14
  ctx.on("system-prompt/assemble", async (_assembly, _context, next) => {
18
15
  check();
19
16
  const [roleText, workspaceText] = await read();
@@ -127,21 +127,6 @@ export async function inspectSystem(processes, cwd) {
127
127
  const npm = await findExecutable("npm", processes.env);
128
128
  if (!npm)
129
129
  throw new Error("未找到 npm。请先安装 Node.js/npm。");
130
- const python = await findExecutable("python3", processes.env) ?? await findExecutable("python", processes.env);
131
- if (!python)
132
- throw new Error("需要 Python 3.11+ 和 venv/ensurepip。请先安装后重试。");
133
- try {
134
- await processes.run(python, ["-I", "-B", "-c", [
135
- "import sys, tempfile, venv, ensurepip",
136
- "assert sys.version_info >= (3, 11), 'Python 3.11+ required'",
137
- "with tempfile.TemporaryDirectory(prefix='pbot-python-check-') as path:",
138
- " venv.EnvBuilder(with_pip=True).create(path)",
139
- ].join("\n")], cwd);
140
- }
141
- catch (error) {
142
- processes.signal.throwIfAborted();
143
- throw new Error("基础 Python 检查失败。需要 Python 3.11+ 和 venv/ensurepip;Debian/Ubuntu 还需 python3-venv。\n" + String(error));
144
- }
145
130
  const tmux = await findExecutable("tmux", processes.env);
146
131
  if (tmux) {
147
132
  await processes.run(tmux, ["-V"], cwd);
@@ -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), python = record(snapshot.python), history = record(snapshot.history);
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(",");
@@ -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";
@@ -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],[data-state=preparing]) { color: var(--pbot-accent); background: var(--pbot-tint); }
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:is([data-state=ready],[data-state=completed]) { color: var(--dsw-alias-state-success-primary, #26834b); }
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); }
@@ -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: "已中断", ready: "已就绪", preparing: "准备中", unprepared: "未准备",
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.14",
3
+ "version": "0.2.15",
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 工作区,查看状态,或准备共享 Python 环境。
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` 只查看当前配置和 Python 状态,`python setup` 为已启用工作区准备或修复共享 Python。省略参数时查看状态。返回命令的实际结果和需要处理的错误。
16
+ 根据用户参数选择一条:`init` 补建资料并启用工作区,`status` 只查看工作区及当前配置状态。省略参数时查看状态。返回命令的实际结果和需要处理的错误。
@@ -25,6 +25,6 @@
25
25
 
26
26
  保存有后续用途的结论、方法、决策和产物;普通问答不逐轮存档。保存前查找同主题正文,直接修订,合并重复内容并替换过时说明。必要的实现细节放入对应技术资料,排查过程和测试流水不逐次追加到正文。更新或整理时使用 project-maintenance。可再次查询的数据按记录的口径获取。保留用户资料、历史记录和备份。
27
27
 
28
- 环境上下文中的 `workspaceRoot` 是资料工作区根目录,`resourceRoot` 是包内资料根目录,`python` 给出共享环境状态。提供 `python.executable` 时使用该完整解释器路径,否则在 ready 状态使用 `python` 或 `python3`。资料路径相对工作区根目录,命令与文件工具按实际 cwd 解析路径。需要 Python 时读取包内 `references/compute.md`;共享环境未就绪时不退回系统 Python。项目构建和测试遵循项目声明的环境。
28
+ 环境上下文中的 `workspaceRoot` 是资料工作区根目录,`resourceRoot` 是包内资料根目录。资料路径相对工作区根目录,命令与文件工具按实际 cwd 解析路径。需要 Python 计算时读取包内 `references/compute.md`;计算、项目构建和测试遵循项目声明的环境。
29
29
 
30
30
  答复先给结论,按需补充说明和产物路径。自然语言说明直接回答当前问题,不惯常追加否定式限定或免责声明,也不设想用户未提出的推论再逐一否定。必要的未知、条件和风险清楚说明一次。数值注明影响理解的对象、期间、单位与口径。任务要求、操作权限、必要确认和规定的输出格式照常遵循。
@@ -1,18 +1,16 @@
1
1
  # Python 计算
2
2
 
3
- 环境上下文的 `python.state` 是当前共享环境状态。ready 时通过 Bash 使用 `python.executable` 给出的完整解释器路径;未提供该字段时使用 `python` 或 `python3`,直接导入第三方库。项目构建和测试使用项目声明的环境。
4
-
5
- ## 环境异常
3
+ ## 按项目运行
6
4
 
7
- 未就绪或依赖异常时可自主诊断,只暂停依赖该环境的计算,不退回系统 Python,不删除或重建共享环境。Pi/dsh 用 `/pbot status` 查看错误并用 `/pbot python setup` 重试;Claude 从当次 hook 或准备命令结果查看错误,用 `/personal-bot:pbot status` 检查当前环境,`/personal-bot:pbot python setup` 重试,或直接执行插件 `lib/claude.js` 的同名 Node 命令;需要用户执行会话操作时说明入口,专家向主会话交回所需条件。
5
+ 使用当前宿主的原生 Bash,沿用项目声明的解释器、依赖、工作目录、脚本或模块入口、输入参数与输出位置。尚无约定时,先检查可用解释器及本次计算需要的库,再选择运行方式。依赖和 Python 版本以项目及所选库的要求为准。
8
6
 
9
- 所有 pbot 工作区共用该环境。更改依赖会影响其他工作区,停止相关计算后再更新。安装与许可信息见 [Python 说明](../../python/README.md)。
7
+ 包内相对导入通常使用项目根目录下的 `python -m 包.模块`,不为绕过导入错误随意改 `sys.path`。相对数据路径取决于 cwd 或脚本自身的处理;交付时提供实际产物路径,并检查结果。
10
8
 
11
- ## 按项目运行
9
+ 解释器或依赖异常时,检查实际路径、导入错误及项目配置,继续不受影响的工作。专家需要主会话协助时交回具体阻碍和所需条件。
12
10
 
13
- 沿用项目的工作目录、脚本或模块入口、输入参数与输出位置。包内相对导入通常使用项目根目录下的 `python -m 包.模块`,不为绕过导入错误随意改 `sys.path`。相对数据路径取决于 cwd 或脚本自身的处理;交付时提供实际产物路径,并检查结果。
11
+ ## 第三方库
14
12
 
15
- 预装库包括 NumPy、pandas、SciPy、statsmodels、scikit-learn(导入名 sklearn)、Matplotlib、seaborn、Bokeh、openpyxl、PyArrow、TA-Lib 和 backtesting。按任务查阅当前版本的原生 API。
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+、Python 3.11+、Claude Code 2.1.325+;PBOT_CLAUDE_COMMAND 可指定 CLI |
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 使用预置故障目录跳过 Python 下载,dsh 通过原生 schema 收集导入 Host。Claude 在独立 npm 消费目录安装实际 tarball,核对版本、原生资源与 hook 参数;再从直接解包目录运行未启用工作区的 hook/status,以及已启用工作区的专家资料与 Python 只读检查,覆盖原生 marketplace 不安装 npm 依赖的缓存目录。不访问日常会话或凭据。
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)。
@@ -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
- const state = process.env.PBOT_ACP_PYTHON_STATE ?? "unavailable";
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() {
@@ -9,8 +9,6 @@ import { acpExecutable } from "../integrations/acp/launch.js";
9
9
  import { claudeOptions } from "../integrations/acp/claude.js";
10
10
  import { acpContent } from "../integrations/acp/input.js";
11
11
  import { agentText } from "../integrations/agent-resources.js";
12
- import { activatePython } from "../integrations/python-activation.js";
13
- import { PythonEnvironmentService } from "../services/workspace/python-environment-service.js";
14
12
  import { resourceRoot } from "../common/paths.js";
15
13
  import { requireThat } from "../common/validation.js";
16
14
  import { packageVersion, releaseLine } from "../common/version.js";
@@ -25,18 +23,13 @@ requireThat(files.directory(id) === directory, "ACP worker 目录不匹配。");
25
23
  const d = files.read(id, "descriptor.json", descriptor), reference = files.read(id, "acp-session.json", acpReference);
26
24
  requireThat(d.agentId === id && releaseLine(d.release) === releaseLine(packageVersion), "ACP worker 身份或版本不匹配。");
27
25
  const validating = args.includes("--validate"), lifetime = new AbortController();
28
- let execution: AcpAgentRun | undefined, restorePython: (() => void) | undefined;
29
- const python = new PythonEnvironmentService(d.workspace);
26
+ let execution: AcpAgentRun | undefined;
30
27
  const stop = () => { void execution?.stop().catch(error => lifetime.abort(error)); if (!execution) lifetime.abort(); };
31
28
  process.on("SIGTERM", stop); process.on("SIGINT", stop);
32
29
 
33
30
  async function main() {
34
31
  requireThat(files.read(id!, "launch.json", launch).generation === generation, "ACP worker 启动代次已失效。");
35
- if (!validating) {
36
- try { const prepared = await python.setup(lifetime.signal); restorePython = activatePython(prepared.directory); }
37
- catch { lifetime.signal.throwIfAborted(); }
38
- }
39
- const env = { ...process.env, PBOT_ACP_PYTHON_STATE: validating ? "unavailable" : python.status.state, PBOT_SUBAGENT_RUN_ID: id!, PBOT_SUBAGENT_DIR: directory!, PBOT_SUBAGENT_GENERATION: generation!,
32
+ const env = { ...process.env, PBOT_SUBAGENT_RUN_ID: id!, PBOT_SUBAGENT_DIR: directory!, PBOT_SUBAGENT_GENERATION: generation!,
40
33
  ...(validating ? { PBOT_ACP_VALIDATE: "1" } : {}) };
41
34
  const command = { ...reference, args: [...reference.args] };
42
35
  const packageRoot = resolve(resourceRoot, "..");
@@ -52,8 +45,7 @@ async function main() {
52
45
  let prompt: string | undefined;
53
46
  if (reference.backend === "claude") {
54
47
  prompt = [await readFile(join(resourceRoot, "prompts/workspace.md"), "utf8"), await agentText("general-purpose", d.workspace),
55
- JSON.stringify({ workspaceRoot: d.workspace, resourceRoot, python: python.status.state === "ready"
56
- ? { state: "ready", directory: process.env.VIRTUAL_ENV } : { state: python.status.state } })].join("\n\n");
48
+ JSON.stringify({ workspaceRoot: d.workspace, resourceRoot })].join("\n\n");
57
49
  }
58
50
  const saveSelection = (selection: AcpModelSelection) => {
59
51
  if (validating) return;
@@ -118,7 +110,6 @@ try {
118
110
  process.exitCode = 1;
119
111
  } finally {
120
112
  lifetime.abort();
121
- try { await python.close(); } finally { restorePython?.(); }
122
113
  if (process.connected) process.disconnect();
123
114
  // Keep child processes in this worker's process group so forced release covers descendants.
124
115
  }
@@ -5,7 +5,6 @@ import { resourceRoot } from "../common/paths.js";
5
5
  import { packageVersion } from "../common/version.js";
6
6
  import { requireThat } from "../common/validation.js";
7
7
  import { agentText } from "../integrations/agent-resources.js";
8
- import { PythonEnvironmentService } from "../services/workspace/python-environment-service.js";
9
8
  import { readWorkspaceConfig } from "../services/workspace/workspace-config.js";
10
9
  import { initializeWorkspace } from "../services/workspace/workspace-preparation.js";
11
10
 
@@ -17,20 +16,6 @@ export async function claudeWorkspaceRoot(cwd: string, projectDirectory = proces
17
16
  return root;
18
17
  }
19
18
 
20
- async function pythonStatus(root: string, prepare: boolean, force = false) {
21
- const python = new PythonEnvironmentService(root);
22
- try {
23
- if (force) await python.setup();
24
- else {
25
- const current = await python.inspect();
26
- if (prepare && current.state === "unprepared") await python.setup();
27
- }
28
- } catch { /* The service retains the preparation or inspection error for status. */ }
29
- finally { await python.close(); }
30
- const status = python.status;
31
- return { ...status, ...(status.state === "ready" ? { executable: join(status.directory!, "bin/python") } : {}) };
32
- }
33
-
34
19
  function disabled(configuration: Awaited<ReturnType<typeof readWorkspaceConfig>>) {
35
20
  return configuration.error ?? "Personal Bot 未在此工作区启用。运行 /personal-bot:pbot init;配置文件:" + configuration.path;
36
21
  }
@@ -38,12 +23,10 @@ function disabled(configuration: Awaited<ReturnType<typeof readWorkspaceConfig>>
38
23
  export async function claudeCommand(args: readonly string[], cwd: string) {
39
24
  const root = await claudeWorkspaceRoot(cwd);
40
25
  const action = args.join(" ");
41
- requireThat(["init", "status", "python setup"].includes(action), "用法:node <插件目录>/lib/claude.js init|status|python setup");
26
+ requireThat(["init", "status"].includes(action), "用法:node <插件目录>/lib/claude.js init|status");
42
27
  if (action === "init") await initializeWorkspace(root);
43
28
  const configuration = await readWorkspaceConfig(root);
44
- if (action === "python setup") requireThat(configuration.enabled, disabled(configuration));
45
- return { version: packageVersion, workspaceRoot: root, resourceRoot, configuration,
46
- python: configuration.enabled ? await pythonStatus(root, action !== "status", action === "python setup") : { state: "unprepared" as const } };
29
+ return { version: packageVersion, workspaceRoot: root, resourceRoot, configuration };
47
30
  }
48
31
 
49
32
  /** Standard command hooks consume documented stdin fields; native sessions remain entirely host-owned. */
@@ -51,7 +34,7 @@ export async function claudeHook(value: unknown): Promise<Record<string, unknown
51
34
  requireThat(object(value) && typeof value.hook_event_name === "string", "Claude hook 输入无效。");
52
35
  if (process.env.PBOT_SUBAGENT_RUN_ID) return {};
53
36
  const event = value.hook_event_name;
54
- requireThat(["SessionStart", "UserPromptSubmit", "SubagentStart", "PreToolUse", "UserPromptExpansion"].includes(event), "Claude hook 事件未支持。");
37
+ requireThat(["UserPromptSubmit", "SubagentStart", "PreToolUse", "UserPromptExpansion"].includes(event), "Claude hook 事件未支持。");
55
38
  const skillCheck = event === "PreToolUse" || event === "UserPromptExpansion";
56
39
  if (skillCheck) {
57
40
  const skill = event === "UserPromptExpansion"
@@ -72,8 +55,6 @@ export async function claudeHook(value: unknown): Promise<Record<string, unknown
72
55
  hookSpecificOutput: { hookEventName: event, additionalContext: disabled(configuration) },
73
56
  };
74
57
  if (event === "SubagentStart" && value.agent_type !== "personal-bot:general-purpose") return {};
75
- const python = await pythonStatus(root, event === "SessionStart" || event === "UserPromptSubmit");
76
- if (event === "SessionStart") return python.state === "error" ? { systemMessage: python.error } : {};
77
58
  const member = event === "SubagentStart" || typeof value.agent_id === "string";
78
59
  const role = event === "SubagentStart" ? readFile(join(root, "agents/general-purpose.md"), "utf8").catch(error => {
79
60
  if ((error as NodeJS.ErrnoException).code === "ENOENT") return "";
@@ -87,8 +68,7 @@ export async function claudeHook(value: unknown): Promise<Record<string, unknown
87
68
  throw error;
88
69
  }),
89
70
  ]);
90
- return { ...(python.state === "error" ? { systemMessage: python.error } : {}),
91
- hookSpecificOutput: { hookEventName: event, additionalContext: [
92
- workspace, duties, agents, JSON.stringify({ workspaceRoot: root, resourceRoot, python }),
71
+ return { hookSpecificOutput: { hookEventName: event, additionalContext: [
72
+ workspace, duties, agents, JSON.stringify({ workspaceRoot: root, resourceRoot }),
93
73
  ].filter(Boolean).join("\n\n") } };
94
74
  }