personal-bot 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +2 -1
- package/DISCLAIMER.md +17 -0
- package/LICENSE +21 -0
- package/README.md +15 -5
- package/README.zh-CN.md +15 -5
- package/bin/pbot-pi-acp.mjs +1 -1
- package/bin/pbot.mjs +22 -2
- package/docs/README.md +2 -0
- package/docs/architecture/design.md +16 -16
- package/docs/architecture/extensibility.md +8 -2
- package/docs/architecture/model-context.md +3 -2
- package/docs/architecture/principles.md +2 -2
- package/docs/guides/capabilities.md +1 -1
- package/docs/guides/cross-harness-workers.md +3 -1
- package/docs/guides/history.md +30 -7
- package/docs/guides/workspace-configuration.md +7 -3
- package/docs/hosts/antigravity.md +1 -1
- package/docs/hosts/claude-code.md +1 -1
- package/docs/hosts/codex-qoder.md +63 -0
- package/docs/maintainers/architecture-governance.md +78 -0
- package/lib/antigravity-plugin/DISCLAIMER.md +17 -0
- package/lib/antigravity-plugin/LICENSE +21 -0
- package/lib/antigravity-plugin/bin/pbot-pi-acp.mjs +36 -0
- package/lib/antigravity-plugin/lib/common/files.d.ts +2 -0
- package/lib/antigravity-plugin/lib/common/files.js +44 -0
- package/lib/antigravity-plugin/lib/common/validation.d.ts +4 -0
- package/lib/antigravity-plugin/lib/common/validation.js +8 -0
- package/lib/antigravity-plugin/lib/extension/acp/member.d.ts +18 -0
- package/lib/antigravity-plugin/lib/extension/acp/member.js +44 -0
- package/lib/antigravity-plugin/lib/extension/acp-worker.js +71 -45
- package/lib/antigravity-plugin/lib/extension/hosts/dsh/acp-entry.d.ts +1 -0
- package/lib/antigravity-plugin/lib/extension/hosts/dsh/acp-entry.js +22 -0
- package/lib/antigravity-plugin/lib/extension/hosts/dsh/acp-member.d.ts +4 -0
- package/lib/antigravity-plugin/lib/extension/hosts/dsh/acp-member.js +58 -0
- package/lib/antigravity-plugin/lib/extension/hosts/dsh/files.d.ts +5 -0
- package/lib/antigravity-plugin/lib/extension/hosts/dsh/files.js +67 -0
- package/lib/antigravity-plugin/lib/extension/hosts/pi/acp-member.d.ts +3 -0
- package/lib/antigravity-plugin/lib/extension/hosts/pi/acp-member.js +100 -0
- package/lib/antigravity-plugin/lib/extension/hosts/plugin-runtime.d.ts +3 -1
- package/lib/antigravity-plugin/lib/extension/hosts/plugin-runtime.js +31 -23
- package/lib/antigravity-plugin/lib/extension/hosts/workspace-mcp.d.ts +6 -0
- package/lib/antigravity-plugin/lib/extension/hosts/workspace-mcp.js +21 -0
- package/lib/antigravity-plugin/lib/extension/mcp.js +2577 -2255
- package/lib/antigravity-plugin/lib/extension/workspace-cli.js +20127 -0
- package/lib/antigravity-plugin/lib/integrations/agent-resources.js +1 -1
- package/lib/antigravity-plugin/lib/integrations/hosts/claude/adapter.js +7 -59
- package/lib/antigravity-plugin/lib/integrations/hosts/codex/adapter.d.ts +2 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/codex/adapter.js +14 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/mcp.d.ts +4 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/mcp.js +28 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/messages.d.ts +36 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/messages.js +11 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/resources.d.ts +6 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/resources.js +47 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/root-agents.d.ts +4 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/root-agents.js +3 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/skills.d.ts +8 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/skills.js +31 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/pi/agent-tools.d.ts +3 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/pi/agent-tools.js +32 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/pi/mcp.d.ts +4 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/pi/mcp.js +23 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/plugin-registry.d.ts +1 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/plugin-registry.js +8 -1
- package/lib/antigravity-plugin/lib/integrations/hosts/prompt-hooks.d.ts +76 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/prompt-hooks.js +76 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/qoder/adapter.d.ts +2 -0
- package/lib/antigravity-plugin/lib/integrations/hosts/qoder/adapter.js +16 -0
- package/lib/antigravity-plugin/lib/model/acp.d.ts +7 -3
- package/lib/antigravity-plugin/lib/model/acp.js +8 -0
- package/lib/antigravity-plugin/lib/model/agent.d.ts +121 -0
- package/lib/antigravity-plugin/lib/model/agent.js +4 -0
- package/lib/antigravity-plugin/lib/model/history.d.ts +10 -0
- package/lib/antigravity-plugin/lib/model/history.js +4 -1
- package/lib/antigravity-plugin/lib/model/plugin-host.d.ts +5 -0
- package/lib/antigravity-plugin/lib/model/workspace-config.d.ts +8 -12
- package/lib/antigravity-plugin/lib/model/workspace-config.js +2 -1
- package/lib/antigravity-plugin/lib/plugin.d.ts +2 -1
- package/lib/antigravity-plugin/lib/plugin.js +2 -2
- package/lib/antigravity-plugin/lib/services/history/history-capture.js +34 -22
- package/lib/antigravity-plugin/lib/services/history/summary-registry.js +2 -3
- package/lib/antigravity-plugin/lib/services/history/summary-runner.d.ts +2 -5
- package/lib/antigravity-plugin/lib/services/history/summary-runner.js +72 -74
- package/lib/antigravity-plugin/lib/services/history/workspace-history.d.ts +3 -0
- package/lib/antigravity-plugin/lib/services/history/workspace-history.js +6 -0
- package/lib/antigravity-plugin/lib/services/workspace/plugin-releases.d.ts +3 -0
- package/lib/antigravity-plugin/lib/services/workspace/plugin-releases.js +78 -0
- package/lib/antigravity-plugin/lib/services/workspace/workspace-config.js +9 -8
- package/lib/antigravity-plugin/lib/services/workspace/workspace-files.d.ts +2 -0
- package/lib/antigravity-plugin/lib/services/workspace/workspace-files.js +17 -0
- package/lib/antigravity-plugin/lib/services/workspace/workspace-mcp.d.ts +14 -0
- package/lib/antigravity-plugin/lib/services/workspace/workspace-mcp.js +193 -0
- package/lib/antigravity-plugin/lib/services/workspace/workspace-skills.d.ts +1 -0
- package/lib/antigravity-plugin/lib/services/workspace/workspace-skills.js +4 -2
- package/lib/antigravity-plugin/lib/storage/acp-files.d.ts +11 -0
- package/lib/antigravity-plugin/lib/storage/acp-files.js +75 -0
- package/lib/antigravity-plugin/lib/storage/agent-files.d.ts +31 -0
- package/lib/antigravity-plugin/lib/storage/agent-files.js +159 -0
- package/lib/antigravity-plugin/lib/storage/atomic-json.d.ts +3 -1
- package/lib/antigravity-plugin/lib/storage/atomic-json.js +43 -3
- package/lib/antigravity-plugin/lib/storage/history-files.d.ts +2 -1
- package/lib/antigravity-plugin/lib/storage/history-files.js +21 -15
- package/lib/antigravity-plugin/lib/storage/history-format.d.ts +2 -3
- package/lib/antigravity-plugin/lib/storage/history-format.js +5 -7
- package/lib/antigravity-plugin/package.json +1 -1
- package/lib/antigravity-plugin/plugin.json +1 -1
- package/lib/antigravity-plugin/resources/prompts/history-monthly-summary.md +13 -0
- package/lib/antigravity-plugin/resources/prompts/history-summary.md +13 -0
- package/lib/antigravity-plugin/resources/prompts/plugin-coordinator.md +1 -0
- package/lib/antigravity-plugin/resources/skills/.claude-plugin/plugin.json +4 -0
- package/lib/antigravity-plugin/resources/skills/project-maintenance/SKILL.md +35 -0
- package/lib/antigravity-plugin/resources/skills/provider-connections/SKILL.md +52 -0
- package/lib/antigravity-plugin/skills/pbot/SKILL.md +11 -1
- package/lib/client.js +22 -50
- package/lib/codex-marketplace/.agents/plugins/marketplace.json +17 -0
- package/lib/codex-marketplace/plugins/personal-bot/.codex-plugin/plugin.json +7 -0
- package/lib/codex-marketplace/plugins/personal-bot/.mcp.json +17 -0
- package/lib/codex-marketplace/plugins/personal-bot/DISCLAIMER.md +17 -0
- package/lib/codex-marketplace/plugins/personal-bot/LICENSE +21 -0
- package/lib/codex-marketplace/plugins/personal-bot/hooks/hooks.json +37 -0
- package/lib/codex-marketplace/plugins/personal-bot/skills/pbot/SKILL.md +9 -0
- package/lib/codex-marketplace/plugins/personal-bot/skills/pbot/agents/openai.yaml +2 -0
- package/lib/common/validation.d.ts +4 -0
- package/lib/common/validation.js +8 -0
- package/lib/dsh.js +2 -2
- package/lib/extension/acp/member.d.ts +1 -1
- package/lib/extension/acp-worker.js +71 -45
- package/lib/extension/history/command.d.ts +37 -0
- package/lib/extension/history/command.js +57 -0
- package/lib/extension/hosts/dsh/acp-entry.d.ts +1 -0
- package/lib/extension/hosts/dsh/acp-entry.js +22 -0
- package/lib/extension/hosts/dsh/acp-member.js +4 -18
- package/lib/extension/hosts/dsh/command.d.ts +1 -2
- package/lib/extension/hosts/dsh/command.js +5 -49
- package/lib/extension/hosts/dsh/workspace.js +13 -44
- package/lib/extension/hosts/pi/acp-member.d.ts +3 -0
- package/lib/extension/hosts/pi/acp-member.js +100 -0
- package/lib/extension/hosts/plugin-runtime.d.ts +3 -1
- package/lib/extension/hosts/plugin-runtime.js +31 -23
- package/lib/extension/hosts/workspace-mcp.d.ts +6 -0
- package/lib/extension/hosts/workspace-mcp.js +21 -0
- package/lib/extension/mcp/bridge.d.ts +6 -8
- package/lib/extension/mcp/bridge.js +66 -84
- package/lib/extension/mcp/tool-contract.d.ts +735 -0
- package/lib/extension/mcp/tool-contract.js +441 -0
- package/lib/extension/mcp/workers.d.ts +29 -742
- package/lib/extension/mcp/workers.js +75 -525
- package/lib/extension/mcp.js +2577 -2255
- package/lib/extension/setup/cli.js +3 -0
- package/lib/extension/workspace-cli.js +20127 -0
- package/lib/integrations/acp/agents.d.ts +2 -3
- package/lib/integrations/acp/harnesses/dsh.js +1 -1
- package/lib/integrations/acp/harnesses/presets.js +8 -0
- package/lib/integrations/acp/history-summary.js +2 -1
- package/lib/integrations/acp/launch.d.ts +2 -2
- package/lib/integrations/agent-resources.js +1 -1
- package/lib/integrations/hosts/claude/adapter.js +7 -59
- package/lib/integrations/hosts/codex/adapter.d.ts +2 -0
- package/lib/integrations/hosts/codex/adapter.js +14 -0
- package/lib/integrations/hosts/pi/agent-tools.d.ts +3 -0
- package/lib/integrations/hosts/pi/agent-tools.js +32 -0
- package/lib/integrations/hosts/pi/mcp.d.ts +4 -0
- package/lib/integrations/hosts/pi/mcp.js +23 -0
- package/lib/integrations/hosts/plugin-registry.d.ts +1 -0
- package/lib/integrations/hosts/plugin-registry.js +8 -1
- package/lib/integrations/hosts/prompt-hooks.d.ts +76 -0
- package/lib/integrations/hosts/prompt-hooks.js +76 -0
- package/lib/integrations/hosts/qoder/adapter.d.ts +2 -0
- package/lib/integrations/hosts/qoder/adapter.js +16 -0
- package/lib/model/acp.d.ts +7 -3
- package/lib/model/acp.js +8 -0
- package/lib/model/agent.d.ts +18 -4
- package/lib/model/agent.js +4 -1
- package/lib/model/history.d.ts +10 -0
- package/lib/model/history.js +4 -1
- package/lib/model/installation.js +1 -0
- package/lib/model/plugin-host.d.ts +5 -0
- package/lib/model/workspace-config.d.ts +8 -12
- package/lib/model/workspace-config.js +2 -1
- package/lib/plugin.d.ts +2 -1
- package/lib/plugin.js +2 -2
- package/lib/qoder-plugin/.mcp.json +17 -0
- package/lib/qoder-plugin/.qoder-plugin/plugin.json +7 -0
- package/lib/qoder-plugin/DISCLAIMER.md +17 -0
- package/lib/qoder-plugin/LICENSE +21 -0
- package/lib/qoder-plugin/hooks/hooks.json +37 -0
- package/lib/qoder-plugin/skills/pbot/SKILL.md +9 -0
- package/lib/services/agents/agent-service.d.ts +15 -45
- package/lib/services/agents/agent-service.js +22 -3
- package/lib/services/history/history-capture.js +34 -22
- package/lib/services/history/history-migrate.js +26 -60
- package/lib/services/history/history-query.js +38 -57
- package/lib/services/history/summary-command.d.ts +1 -1
- package/lib/services/history/summary-command.js +8 -7
- package/lib/services/history/summary-registry.js +2 -3
- package/lib/services/history/summary-runner.d.ts +2 -5
- package/lib/services/history/summary-runner.js +72 -74
- package/lib/services/history/workspace-history.d.ts +3 -0
- package/lib/services/history/workspace-history.js +6 -0
- package/lib/services/workspace/plugin-releases.d.ts +3 -0
- package/lib/services/workspace/plugin-releases.js +78 -0
- package/lib/services/workspace/workspace-config.js +9 -8
- package/lib/services/workspace/workspace-mcp.js +22 -29
- package/lib/services/workspace/workspace-skills.d.ts +1 -0
- package/lib/services/workspace/workspace-skills.js +4 -2
- package/lib/storage/acp-files.js +7 -12
- package/lib/storage/agent-files.js +6 -5
- package/lib/storage/atomic-json.d.ts +3 -1
- package/lib/storage/atomic-json.js +43 -3
- package/lib/storage/history-files.d.ts +2 -1
- package/lib/storage/history-files.js +21 -15
- package/lib/storage/history-format.d.ts +2 -3
- package/lib/storage/history-format.js +5 -7
- package/lib/tools/history/contract.d.ts +3 -11
- package/lib/tools/history/contract.js +8 -7
- package/lib/ui/dsh/elements.d.ts +2 -5
- package/lib/ui/dsh/elements.js +3 -16
- package/lib/ui/dsh/management.js +9 -9
- package/lib/ui/dsh/styles.d.ts +1 -1
- package/lib/ui/dsh/styles.js +5 -33
- package/package.json +4 -1
- package/resources/antigravity/skills/pbot/SKILL.md +11 -1
- package/resources/claude/skills/pbot/SKILL.md +11 -1
- package/resources/plugin/skills/pbot/SKILL.md +9 -0
- package/resources/prompts/history-coordinator.md +1 -0
- package/resources/prompts/plugin-coordinator.md +1 -0
- package/scripts/README.md +3 -2
- package/src/common/validation.ts +10 -0
- package/src/dsh.ts +2 -2
- package/src/extension/history/command.ts +68 -0
- package/src/extension/hosts/dsh/acp-entry.ts +21 -0
- package/src/extension/hosts/dsh/acp-member.ts +4 -15
- package/src/extension/hosts/dsh/command.ts +6 -46
- package/src/extension/hosts/dsh/workspace.ts +12 -38
- package/src/extension/hosts/pi/acp-member.ts +4 -10
- package/src/extension/hosts/pi/command.ts +14 -63
- package/src/extension/hosts/pi/events.ts +2 -8
- package/src/extension/hosts/pi/lifecycle.ts +3 -2
- package/src/extension/hosts/plugin-runtime.ts +32 -19
- package/src/extension/hosts/workspace-mcp.ts +25 -0
- package/src/extension/mcp/bridge.ts +80 -80
- package/src/extension/mcp/tool-contract.ts +462 -0
- package/src/extension/mcp/workers.ts +81 -551
- package/src/extension/setup/cli.ts +4 -1
- package/src/extension/setup/workspace-cli.ts +159 -0
- package/src/integrations/acp/agents.ts +2 -3
- package/src/integrations/acp/harnesses/dsh.ts +1 -1
- package/src/integrations/acp/harnesses/presets.ts +8 -0
- package/src/integrations/acp/history-summary.ts +2 -1
- package/src/integrations/agent-resources.ts +1 -1
- package/src/integrations/hosts/claude/adapter.ts +7 -53
- package/src/integrations/hosts/codex/adapter.ts +16 -0
- package/src/integrations/hosts/plugin-registry.ts +9 -1
- package/src/integrations/hosts/prompt-hooks.ts +72 -0
- package/src/integrations/hosts/qoder/adapter.ts +19 -0
- package/src/integrations/installation/cli-update.ts +116 -0
- package/src/integrations/installation/pi-bridge.ts +1 -1
- package/src/integrations/installation/pi-setup.ts +1 -1
- package/src/integrations/installation/processes.ts +1 -1
- package/src/model/acp.ts +11 -3
- package/src/model/agent.ts +20 -4
- package/src/model/history.ts +5 -0
- package/src/model/installation.ts +41 -0
- package/src/model/plugin-host.ts +5 -1
- package/src/model/workspace-config.ts +6 -12
- package/src/pbot.ts +13 -32
- package/src/plugin.ts +3 -3
- package/src/services/agents/agent-service.ts +29 -17
- package/src/services/history/history-capture.ts +30 -22
- package/src/services/history/history-migrate.ts +23 -50
- package/src/services/history/history-query.ts +34 -48
- package/src/services/history/summary-command.ts +9 -8
- package/src/services/history/summary-registry.ts +2 -3
- package/src/services/history/summary-runner.ts +72 -81
- package/src/services/history/workspace-history.ts +8 -0
- package/src/services/installation/setup-service.ts +2 -41
- package/src/services/workspace/plugin-releases.ts +68 -0
- package/src/services/workspace/workspace-config.ts +9 -8
- package/src/services/workspace/workspace-mcp.ts +23 -28
- package/src/services/workspace/workspace-skills.ts +5 -2
- package/src/storage/acp-files.ts +7 -12
- package/src/storage/agent-files.ts +6 -5
- package/src/storage/atomic-json.ts +31 -4
- package/src/storage/history-files.ts +22 -15
- package/src/storage/history-format.ts +6 -8
- package/src/tools/history/contract.ts +9 -9
- package/src/tools/history/pi-tool.ts +6 -4
- package/src/ui/dsh/elements.ts +5 -12
- package/src/ui/dsh/management.ts +10 -10
- package/src/ui/dsh/styles.ts +5 -33
- package/lib/antigravity-plugin/lib/services/history/history-migrate.d.ts +0 -12
- package/lib/antigravity-plugin/lib/services/history/history-migrate.js +0 -88
- package/lib/ui/presentation.d.ts +0 -3
- package/lib/ui/presentation.js +0 -12
- package/src/tools/access.ts +0 -7
- package/src/tools/register.ts +0 -21
- package/src/ui/presentation.ts +0 -12
package/src/ui/dsh/management.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Context } from "@deepseek-ai/cordis";
|
|
2
2
|
import type {} from "@deepseek-ai/dsh-api-remotes/client";
|
|
3
3
|
import type { SessionId } from "@deepseek-ai/dsh-session/types";
|
|
4
|
+
import { historyPageLimits } from "../../model/history.js";
|
|
4
5
|
import { object, json } from "../../common/json.js";
|
|
5
6
|
import { block, details, element, empty, facts, field, group, note, pageTitle, record, rows, select, text, time } from "./elements.js";
|
|
6
7
|
import { managementStyles } from "./styles.js";
|
|
@@ -72,29 +73,28 @@ export function showManagement(ctx: Context, parentSessionId: SessionId) {
|
|
|
72
73
|
if (!result.ok) throw new Error(result.error.message);
|
|
73
74
|
lifetime.signal.throwIfAborted(); return record(result.value);
|
|
74
75
|
}
|
|
75
|
-
async function
|
|
76
|
-
const result = await ctx.remote.commands.execute(parentSessionId, "/pbot "
|
|
76
|
+
async function initializeWorkspace() {
|
|
77
|
+
const result = await ctx.remote.commands.execute(parentSessionId, "/pbot init", []);
|
|
77
78
|
if (!result.ok) throw new Error(result.error.message + ";如连接中断,请先刷新记录确认操作是否已接纳。");
|
|
78
79
|
if (!result.value) throw new Error("管理命令未被接纳。");
|
|
79
80
|
if (result.value.result.kind === "error") throw new Error(result.value.result.text);
|
|
80
|
-
inform(
|
|
81
|
+
inform("工作区已初始化并启用。");
|
|
81
82
|
if (!closed) { try { await refresh(); } catch (error) { inform("操作已接纳;刷新状态未成功:" + String(error), "error"); } }
|
|
82
|
-
return result.value.result.text ?? "";
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
const status = section("status", "工作区"); pageTitle(status, "工作区"
|
|
85
|
+
const status = section("status", "工作区"); pageTitle(status, "工作区");
|
|
86
86
|
const counts = note(""), workspaceInfo = group(status); status.querySelector("header")!.after(counts); counts.classList.add("pbot-counts");
|
|
87
87
|
const materials = group(status, "pbot-setting"); materials.append(element("h3", "资料目录"));
|
|
88
|
-
const initializeButton = button(materials, "准备目录",
|
|
88
|
+
const initializeButton = button(materials, "准备目录", initializeWorkspace);
|
|
89
89
|
const diagnostic = details(status, "环境详情"), statusBody = block(""); statusBody.classList.add("pbot-raw"); diagnostic.append(statusBody);
|
|
90
90
|
|
|
91
|
-
const history = section("history", "历史"); pageTitle(history, "历史"
|
|
91
|
+
const history = section("history", "历史"); pageTitle(history, "历史");
|
|
92
92
|
const searchForm = form(history); searchForm.className = "pbot-search";
|
|
93
|
-
const historyQuery = field(searchForm, "关键词"), host = select(searchForm, "来源", [["", "全部"], ["pi", "Pi"], ["dsh", "dsh"], ["claude", "Claude Code"], ["antigravity", "Antigravity"]]);
|
|
93
|
+
const historyQuery = field(searchForm, "关键词"), host = select(searchForm, "来源", [["", "全部"], ["pi", "Pi"], ["dsh", "dsh"], ["claude", "Claude Code"], ["antigravity", "Antigravity"], ["codex", "Codex"], ["qoder", "Qoder CLI"]]);
|
|
94
94
|
historyQuery.placeholder = "留空查看最近会话"; submit(searchForm, "查询", () => searchHistory());
|
|
95
95
|
const dateFilters = details(history, "时间范围"), dateGrid = group(dateFilters, "pbot-grid");
|
|
96
96
|
const historyFrom = field(dateGrid, "开始时间"), historyTo = field(dateGrid, "结束时间");
|
|
97
|
-
for (const input of [historyFrom, historyTo])
|
|
97
|
+
for (const input of [historyFrom, historyTo]) input.type = "datetime-local";
|
|
98
98
|
const historyBody = group(history, "pbot-history-results"), historyPaging = group(history, "pbot-pagination"), historyNode = group(history, "pbot-card"); historyNode.hidden = true;
|
|
99
99
|
historyBody.append(empty("查询历史", "输入关键词,或留空查看最近会话。"));
|
|
100
100
|
let historySearch: Record<string, unknown> = {};
|
|
@@ -119,7 +119,7 @@ export function showManagement(ctx: Context, parentSessionId: SessionId) {
|
|
|
119
119
|
button(item, "读取", () => readHistory(text(match.id), text(match.host)), "pbot-quiet"); historyBody.append(item);
|
|
120
120
|
}
|
|
121
121
|
if (!rows(data.matches).length) historyBody.append(empty("没有找到匹配内容", "试试更短的关键词,或调整来源和时间范围。"));
|
|
122
|
-
if (offset) button(historyPaging, "上一页", () => searchHistory(Math.max(0, offset -
|
|
122
|
+
if (offset) button(historyPaging, "上一页", () => searchHistory(Math.max(0, offset - historyPageLimits.search.default), true));
|
|
123
123
|
if (typeof data.nextOffset === "number") button(historyPaging, "下一页", () => searchHistory(data.nextOffset as number, true));
|
|
124
124
|
}
|
|
125
125
|
async function readHistory(id: string, source: string, offset = 0, childrenOffset = 0) {
|
package/src/ui/dsh/styles.ts
CHANGED
|
@@ -20,15 +20,14 @@ export const managementStyles = `
|
|
|
20
20
|
.pbot-management h2 { font-size: 21px; font-weight: 600; }
|
|
21
21
|
.pbot-management h3 { font-size: 16px; font-weight: 600; }
|
|
22
22
|
.pbot-management h4 { font-size: 14px; font-weight: 600; }
|
|
23
|
-
.pbot-management button, .pbot-management input, .pbot-management
|
|
23
|
+
.pbot-management button, .pbot-management input, .pbot-management select { font: inherit; color: inherit; }
|
|
24
24
|
.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; }
|
|
25
25
|
.pbot-management button:hover:not(:disabled) { background: var(--pbot-tint); border-color: color-mix(in srgb, var(--pbot-accent) 40%, var(--pbot-line)); }
|
|
26
26
|
.pbot-management button:disabled { opacity: .45; cursor: not-allowed; }
|
|
27
|
-
.pbot-management :is(button, input,
|
|
27
|
+
.pbot-management :is(button, input, select, summary):focus-visible { outline: 2px solid var(--pbot-accent); outline-offset: 3px; }
|
|
28
28
|
.pbot-management button.pbot-primary { background: var(--pbot-accent); border-color: var(--pbot-accent); color: var(--pbot-surface); font-weight: 600; }
|
|
29
29
|
.pbot-management button.pbot-primary:hover:not(:disabled) { filter: brightness(.94); background: var(--pbot-accent); }
|
|
30
30
|
.pbot-management button.pbot-quiet { border-color: transparent; background: transparent; }
|
|
31
|
-
.pbot-management button.pbot-danger { color: var(--pbot-danger); }
|
|
32
31
|
.pbot-management button[data-busy=true]::after { content: "…"; }
|
|
33
32
|
.pbot-shell { height: 100%; display: grid; grid-template-columns: 178px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
|
|
34
33
|
.pbot-header { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--pbot-line); }
|
|
@@ -39,7 +38,6 @@ export const managementStyles = `
|
|
|
39
38
|
.pbot-nav { display: flex; flex-direction: column; gap: 6px; padding: 22px 12px; background: var(--pbot-bg); border-right: 1px solid var(--pbot-line); }
|
|
40
39
|
.pbot-nav button { text-align: left; justify-content: space-between; border-color: transparent; background: transparent; padding: 11px 12px; color: var(--pbot-muted); }
|
|
41
40
|
.pbot-nav button[aria-selected=true] { color: var(--pbot-accent); background: var(--pbot-tint); font-weight: 600; }
|
|
42
|
-
.pbot-nav small { font-size: 11px; font-variant-numeric: tabular-nums; opacity: .8; }
|
|
43
41
|
.pbot-main { min-width: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 26px 28px; }
|
|
44
42
|
.pbot-page-title { margin-bottom: 22px; display: grid; gap: 5px; }
|
|
45
43
|
.pbot-muted { color: var(--pbot-muted); font-size: 13px; overflow-wrap: anywhere; }
|
|
@@ -50,7 +48,6 @@ export const managementStyles = `
|
|
|
50
48
|
.pbot-notice[data-tone=error] { border-left-color: var(--pbot-danger); }
|
|
51
49
|
.pbot-notice:empty { display: none; }
|
|
52
50
|
.pbot-stack { display: grid; gap: 16px; }
|
|
53
|
-
.pbot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
|
54
51
|
.pbot-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
|
|
55
52
|
.pbot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
|
|
56
53
|
.pbot-counts { margin: -8px 0 20px !important; }
|
|
@@ -62,10 +59,6 @@ export const managementStyles = `
|
|
|
62
59
|
.pbot-card > :is(h3, .pbot-between) { margin-bottom: 12px; }
|
|
63
60
|
.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
61
|
.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]) { color: var(--pbot-accent); background: var(--pbot-tint); }
|
|
66
|
-
.pbot-badge:is([data-state=error],[data-state=failed]) { color: var(--pbot-danger); }
|
|
67
|
-
.pbot-badge[data-state=completed] { color: var(--dsw-alias-state-success-primary, #26834b); }
|
|
68
|
-
.pbot-badge:is([data-state=paused],[data-state=stopping]) { color: var(--dsw-alias-state-warn-label, #9a6500); }
|
|
69
62
|
.pbot-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 18px; margin: 12px 0; font-size: 13px; }
|
|
70
63
|
.pbot-facts dt { color: var(--pbot-muted); }
|
|
71
64
|
.pbot-facts dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
|
|
@@ -75,33 +68,15 @@ export const managementStyles = `
|
|
|
75
68
|
.pbot-disclosure .pbot-disclosure { background: var(--pbot-bg); }
|
|
76
69
|
.pbot-field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; font-size: 13px; }
|
|
77
70
|
.pbot-field > span { font-weight: 500; }
|
|
78
|
-
.pbot-field :is(input,
|
|
79
|
-
.pbot-field input
|
|
80
|
-
.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; }
|
|
81
|
-
.pbot-field textarea { resize: vertical; min-height: 84px; }
|
|
82
|
-
.pbot-field input::placeholder, .pbot-field textarea::placeholder { color: var(--pbot-muted); opacity: .8; }
|
|
83
|
-
.pbot-split { display: grid; grid-template-columns: minmax(180px, 230px) minmax(0, 1fr); gap: 22px; align-items: start; }
|
|
84
|
-
.pbot-list { display: grid; align-content: start; grid-auto-rows: max-content; gap: 6px; max-height: 470px; overflow-y: auto; padding: 3px; }
|
|
85
|
-
.pbot-management .pbot-list-item { display: block; width: 100%; text-align: left; padding: 12px; border: 1px solid transparent; min-width: 0; }
|
|
86
|
-
.pbot-list-item[aria-pressed=true] { background: var(--pbot-tint); border-color: color-mix(in srgb, var(--pbot-accent) 40%, var(--pbot-line)); }
|
|
87
|
-
.pbot-list-item strong { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
|
|
88
|
-
.pbot-list-item .pbot-muted { margin-top: 7px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
|
71
|
+
.pbot-field :is(input,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; }
|
|
72
|
+
.pbot-field input::placeholder { color: var(--pbot-muted); opacity: .8; }
|
|
89
73
|
.pbot-empty { padding: 38px 20px; border: 1px dashed var(--pbot-line); border-radius: 12px; text-align: center; display: grid; gap: 8px; }
|
|
90
74
|
.pbot-empty h3 { font-weight: 550; }
|
|
91
75
|
.pbot-empty button { justify-self: center; margin-top: 10px; }
|
|
92
|
-
.pbot-detail { min-width: 0; display: grid; gap: 18px; }
|
|
93
|
-
.pbot-detail-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
|
|
94
76
|
.pbot-prose { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin: 10px 0; line-height: 1.7; }
|
|
95
77
|
.pbot-raw { font: 12px/1.6 ui-monospace, SFMono-Regular, monospace; max-height: 340px; overflow: auto; }
|
|
96
|
-
.pbot-transcript { margin-top: 14px; }
|
|
97
|
-
.pbot-event { border-left: 2px solid var(--pbot-line); padding: 0 0 0 14px; margin: 18px 0; }
|
|
98
|
-
.pbot-event .pbot-prose { font-size: 13px; }
|
|
99
|
-
.pbot-event .pbot-row, .pbot-message .pbot-row { justify-content: space-between; }
|
|
100
78
|
.pbot-management .pbot-pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0; color: var(--pbot-muted); font-size: 12px; }
|
|
101
79
|
.pbot-pagination button { font-size: 12px; min-height: 30px; padding: 5px 9px; }
|
|
102
|
-
.pbot-message { padding: 16px 0; border-bottom: 1px solid var(--pbot-line); }
|
|
103
|
-
.pbot-message:last-child { border-bottom: 0; }
|
|
104
|
-
.pbot-message .pbot-prose { font-size: 13px; }
|
|
105
80
|
.pbot-search { display: grid; grid-template-columns: minmax(0, 1fr) 130px auto; gap: 12px; align-items: end; }
|
|
106
81
|
.pbot-search .pbot-field { margin: 0; }
|
|
107
82
|
.pbot-search > button { margin-bottom: 2px; }
|
|
@@ -114,16 +89,13 @@ export const managementStyles = `
|
|
|
114
89
|
.pbot-shell { grid-template-columns: 1fr; grid-template-rows: auto auto minmax(0, 1fr) auto; }
|
|
115
90
|
.pbot-nav { flex-direction: row; padding: 8px 14px; border-right: 0; border-bottom: 1px solid var(--pbot-line); }
|
|
116
91
|
.pbot-nav button { flex: 1; justify-content: center; padding: 8px; }
|
|
117
|
-
.pbot-nav small { display: none; }
|
|
118
92
|
.pbot-main { padding: 22px 18px; }
|
|
119
93
|
.pbot-notice { top: -22px; }
|
|
120
94
|
.pbot-header { padding: 14px 18px; }
|
|
121
|
-
.pbot-split { grid-template-columns: minmax(150px, 190px) minmax(0, 1fr); gap: 16px; }
|
|
122
95
|
}
|
|
123
96
|
@media (max-width: 600px) {
|
|
124
97
|
.pbot-management { width: calc(100vw - 12px); height: calc(100dvh - 16px); }
|
|
125
|
-
.pbot-grid
|
|
126
|
-
.pbot-list { max-height: 215px; }
|
|
98
|
+
.pbot-grid { grid-template-columns: minmax(0, 1fr); }
|
|
127
99
|
.pbot-search { grid-template-columns: minmax(0, 1fr) 110px; }
|
|
128
100
|
.pbot-search > button { grid-column: 1 / -1; }
|
|
129
101
|
.pbot-footer { padding: 8px 14px; }
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { HistoryMigrationReport } from "../../model/history.js";
|
|
2
|
-
export interface MigrateHistoryOptions {
|
|
3
|
-
dryRun?: boolean;
|
|
4
|
-
}
|
|
5
|
-
/** Read-only check for unmigrated flat history files when running under monthly layout. */
|
|
6
|
-
export declare function checkHistoryMigrationNotice(root: string): string | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* Explicitly migrate flat .pbot/history/raw/*.json and .pbot/history/summaries/<dim>/*.json
|
|
9
|
-
* into UTC YYYY/MM/ (or unknown/) buckets. Moves files directly without keeping duplicates
|
|
10
|
-
* and never modifies .pbot/config.json or overwrites existing destinations.
|
|
11
|
-
*/
|
|
12
|
-
export declare function migrateWorkspaceHistory(root: string, options?: MigrateHistoryOptions): HistoryMigrationReport;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { lstatSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { requireThat } from "../../common/validation.js";
|
|
4
|
-
import { HistoryFiles, rawHistoryBucket, summaryArtifactBucket } from "../../storage/history-files.js";
|
|
5
|
-
import { readWorkspaceHistoryLayoutSync } from "../workspace/workspace-config.js";
|
|
6
|
-
/** Read-only check for unmigrated flat history files when running under monthly layout. */
|
|
7
|
-
export function checkHistoryMigrationNotice(root) {
|
|
8
|
-
const layout = readWorkspaceHistoryLayoutSync(root);
|
|
9
|
-
if (layout !== "monthly")
|
|
10
|
-
return undefined;
|
|
11
|
-
const files = new HistoryFiles(join(root, ".pbot/history"), "pi", layout);
|
|
12
|
-
return files.detectFlatFiles().message;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Explicitly migrate flat .pbot/history/raw/*.json and .pbot/history/summaries/<dim>/*.json
|
|
16
|
-
* into UTC YYYY/MM/ (or unknown/) buckets. Moves files directly without keeping duplicates
|
|
17
|
-
* and never modifies .pbot/config.json or overwrites existing destinations.
|
|
18
|
-
*/
|
|
19
|
-
export function migrateWorkspaceHistory(root, options = {}) {
|
|
20
|
-
const layout = readWorkspaceHistoryLayoutSync(root);
|
|
21
|
-
requireThat(layout === "monthly", '当前工作区配置为平铺布局(history.layout: "flat"),无需迁移到年月目录;如需迁移,请先在 .pbot/config.json 中将 history.layout 设为 "monthly" 或移除该配置项。');
|
|
22
|
-
const dryRun = Boolean(options.dryRun);
|
|
23
|
-
const files = new HistoryFiles(join(root, ".pbot/history"), "pi", "monthly");
|
|
24
|
-
const moved = [];
|
|
25
|
-
const skipped = [];
|
|
26
|
-
const errors = [];
|
|
27
|
-
const run = () => {
|
|
28
|
-
for (const name of files.listFlatRawFiles()) {
|
|
29
|
-
const from = `raw/${name}`;
|
|
30
|
-
try {
|
|
31
|
-
const raw = files.readFlatRawFile(name);
|
|
32
|
-
const bucket = rawHistoryBucket(raw);
|
|
33
|
-
const to = `raw/${bucket}/${name}`;
|
|
34
|
-
if (dryRun) {
|
|
35
|
-
if (lstatSync(join(files.directory, to), { throwIfNoEntry: false })) {
|
|
36
|
-
skipped.push({ kind: "raw", from, to, reason: "目标路径已存在同名文件。" });
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
moved.push({ kind: "raw", id: raw.id, from, to });
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
const outcome = files.moveHistoryFile(from, to);
|
|
44
|
-
if (outcome === "moved")
|
|
45
|
-
moved.push({ kind: "raw", id: raw.id, from, to });
|
|
46
|
-
else
|
|
47
|
-
skipped.push({ kind: "raw", from, to, reason: "目标路径已存在同名文件。" });
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
errors.push({ path: join(files.directory, from), error: error instanceof Error ? error.message : String(error) });
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
for (const dimension of files.listDimensions()) {
|
|
55
|
-
for (const name of files.listFlatSummaryFiles(dimension)) {
|
|
56
|
-
const from = `summaries/${dimension}/${name}`;
|
|
57
|
-
try {
|
|
58
|
-
const artifact = files.readFlatSummaryFile(dimension, name);
|
|
59
|
-
const bucket = summaryArtifactBucket(artifact);
|
|
60
|
-
const to = `summaries/${dimension}/${bucket}/${name}`;
|
|
61
|
-
if (dryRun) {
|
|
62
|
-
if (lstatSync(join(files.directory, to), { throwIfNoEntry: false })) {
|
|
63
|
-
skipped.push({ kind: "summary", dimension, from, to, reason: "目标路径已存在同名文件。" });
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
moved.push({ kind: "summary", dimension, id: artifact.id, from, to });
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
const outcome = files.moveHistoryFile(from, to);
|
|
71
|
-
if (outcome === "moved")
|
|
72
|
-
moved.push({ kind: "summary", dimension, id: artifact.id, from, to });
|
|
73
|
-
else
|
|
74
|
-
skipped.push({ kind: "summary", dimension, from, to, reason: "目标路径已存在同名文件。" });
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
catch (error) {
|
|
78
|
-
errors.push({ path: join(files.directory, from), error: error instanceof Error ? error.message : String(error) });
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
if (dryRun)
|
|
84
|
-
run();
|
|
85
|
-
else
|
|
86
|
-
files.controlMigration(run);
|
|
87
|
-
return { layout, dryRun, moved, skipped, errors };
|
|
88
|
-
}
|
package/lib/ui/presentation.d.ts
DELETED
package/lib/ui/presentation.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const states = {
|
|
2
|
-
starting: "启动中", busy: "执行中", idle: "待命", stopping: "停止中", stopped: "已停止", error: "需要处理",
|
|
3
|
-
running: "进行中", paused: "已暂停", finished: "已结束", completed: "已完成", failed: "失败",
|
|
4
|
-
cancelled: "已取消", interrupted: "已中断",
|
|
5
|
-
open: "待安排", closed: "已关闭",
|
|
6
|
-
};
|
|
7
|
-
export const stateLabel = (state) => states[String(state)] ?? String(state ?? "未知");
|
|
8
|
-
export const oneLine = (value) => value.replace(/\s+/g, " ").trim();
|
|
9
|
-
export function duration(milliseconds) {
|
|
10
|
-
const seconds = Math.max(0, Math.floor(milliseconds / 1000));
|
|
11
|
-
return seconds < 60 ? `${seconds} 秒` : seconds < 3600 ? `${Math.floor(seconds / 60)} 分钟` : `${Math.floor(seconds / 3600)} 小时 ${Math.floor(seconds % 3600 / 60)} 分钟`;
|
|
12
|
-
}
|
package/src/tools/access.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/** Each tool is bound to one workspace instance, not a mutable global lookup. */
|
|
3
|
-
export interface CallAccess {
|
|
4
|
-
check(): void;
|
|
5
|
-
signal(signal?: AbortSignal): AbortSignal;
|
|
6
|
-
authorizeFile(path: string, change: unknown, confirm: (value: unknown) => Promise<boolean>, signal: AbortSignal): Promise<void>;
|
|
7
|
-
}
|
package/src/tools/register.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ExtensionAPI, ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import type { CallAccess } from "./access.js";
|
|
3
|
-
import { historyTool } from "./history/pi-tool.js";
|
|
4
|
-
|
|
5
|
-
export function mainTools(root: string, access: CallAccess): ToolDefinition[] {
|
|
6
|
-
return [historyTool(root, access)];
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export class ToolRegistry {
|
|
10
|
-
readonly #registered = new Map<string, ToolDefinition>();
|
|
11
|
-
constructor(private readonly pi: ExtensionAPI) {}
|
|
12
|
-
register(tools: ToolDefinition[]) {
|
|
13
|
-
for (const definition of tools) {
|
|
14
|
-
const tool = { ...definition, namespace: { name: "pbot", description: "工作区历史查询。" } };
|
|
15
|
-
this.#registered.set(tool.name, tool); this.pi.registerTool(tool);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
hide() {
|
|
19
|
-
for (const tool of this.#registered.values()) this.pi.registerTool({ ...tool, exposure: "hidden" });
|
|
20
|
-
}
|
|
21
|
-
}
|
package/src/ui/presentation.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const states: Record<string, string> = {
|
|
2
|
-
starting: "启动中", busy: "执行中", idle: "待命", stopping: "停止中", stopped: "已停止", error: "需要处理",
|
|
3
|
-
running: "进行中", paused: "已暂停", finished: "已结束", completed: "已完成", failed: "失败",
|
|
4
|
-
cancelled: "已取消", interrupted: "已中断",
|
|
5
|
-
open: "待安排", closed: "已关闭",
|
|
6
|
-
};
|
|
7
|
-
export const stateLabel = (state: unknown) => states[String(state)] ?? String(state ?? "未知");
|
|
8
|
-
export const oneLine = (value: string) => value.replace(/\s+/g, " ").trim();
|
|
9
|
-
export function duration(milliseconds: number) {
|
|
10
|
-
const seconds = Math.max(0, Math.floor(milliseconds / 1000));
|
|
11
|
-
return seconds < 60 ? `${seconds} 秒` : seconds < 3600 ? `${Math.floor(seconds / 60)} 分钟` : `${Math.floor(seconds / 3600)} 小时 ${Math.floor(seconds % 3600 / 60)} 分钟`;
|
|
12
|
-
}
|