personal-bot 0.3.2 → 0.3.4
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 +29 -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 +20 -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 +37 -22
- 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 +20171 -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 +15 -0
- package/lib/antigravity-plugin/lib/services/workspace/plugin-releases.js +126 -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 +37 -22
- 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 +15 -0
- package/lib/extension/setup/upgrade.js +153 -0
- package/lib/extension/workspace-cli.js +20171 -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/integrations/installation/cli-update.js +146 -0
- package/lib/integrations/installation/upgraders/antigravity.js +67 -0
- package/lib/integrations/installation/upgraders/claude.js +123 -0
- package/lib/integrations/installation/upgraders/codex.js +73 -0
- package/lib/integrations/installation/upgraders/dsh.js +62 -0
- package/lib/integrations/installation/upgraders/pi.js +90 -0
- package/lib/integrations/installation/upgraders/qoder.js +67 -0
- package/lib/integrations/installation/upgraders/registry.js +40 -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/installation/setup-service.js +4 -1
- package/lib/services/installation/upgrade-service.js +95 -0
- package/lib/services/workspace/plugin-releases.d.ts +15 -0
- package/lib/services/workspace/plugin-releases.js +126 -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 +39 -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 +11 -1
- package/src/extension/setup/upgrade.ts +158 -0
- package/src/extension/setup/workspace-cli.ts +167 -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 +144 -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/integrations/installation/upgraders/antigravity.ts +68 -0
- package/src/integrations/installation/upgraders/claude.ts +123 -0
- package/src/integrations/installation/upgraders/codex.ts +73 -0
- package/src/integrations/installation/upgraders/dsh.ts +63 -0
- package/src/integrations/installation/upgraders/pi.ts +87 -0
- package/src/integrations/installation/upgraders/qoder.ts +68 -0
- package/src/integrations/installation/upgraders/registry.ts +48 -0
- 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 +86 -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 +9 -43
- package/src/services/installation/upgrade-service.ts +127 -0
- package/src/services/workspace/plugin-releases.ts +121 -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
|
@@ -2,10 +2,10 @@ import { spawnSync } from "node:child_process";
|
|
|
2
2
|
import { linkSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync, rmdirSync, unlinkSync } from "node:fs";
|
|
3
3
|
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
4
4
|
import { isDeepStrictEqual } from "node:util";
|
|
5
|
-
import { requireThat } from "../common/validation.js";
|
|
5
|
+
import { isHistoryIdentifier, requireThat } from "../common/validation.js";
|
|
6
6
|
import { internalPath, readJsonFile, syncDirectory, writeJsonFile } from "./atomic-json.js";
|
|
7
7
|
import { fileId, privateDirectory } from "./file-access.js";
|
|
8
|
-
import {
|
|
8
|
+
import { matchIdentity, rawHistory, summaryArtifact } from "./history-format.js";
|
|
9
9
|
const yearPattern = /^\d{4}$/;
|
|
10
10
|
const monthPattern = /^(?:0[1-9]|1[0-2])$/;
|
|
11
11
|
const monthlyIdPattern = /^(\d{4})-(0[1-9]|1[0-2])$/;
|
|
@@ -233,14 +233,14 @@ export class HistoryFiles {
|
|
|
233
233
|
this.directory = directory;
|
|
234
234
|
this.host = host;
|
|
235
235
|
this.layout = layout;
|
|
236
|
-
requireThat(
|
|
236
|
+
requireThat(isHistoryIdentifier(host), "历史来源无效。");
|
|
237
237
|
}
|
|
238
238
|
get warnings() { return this.#warnings; }
|
|
239
239
|
get rawWarnings() { return this.#rawWarnings; }
|
|
240
240
|
get rawDirectory() { return join(this.directory, "raw"); }
|
|
241
241
|
get summariesDirectory() { return join(this.directory, "summaries"); }
|
|
242
242
|
summaryDirectory(dimension) {
|
|
243
|
-
requireThat(
|
|
243
|
+
requireThat(isHistoryIdentifier(dimension), "历史摘要维度无效:" + dimension);
|
|
244
244
|
return join(this.summariesDirectory, dimension);
|
|
245
245
|
}
|
|
246
246
|
withLock(lockName, label, operation) {
|
|
@@ -268,13 +268,16 @@ export class HistoryFiles {
|
|
|
268
268
|
}
|
|
269
269
|
/** Synchronous dimension write lock for derived summary files. */
|
|
270
270
|
controlSummary(dimension, operation) {
|
|
271
|
-
requireThat(
|
|
271
|
+
requireThat(isHistoryIdentifier(dimension), "历史摘要维度无效:" + dimension);
|
|
272
272
|
return this.withLock(".write-summary-" + dimension, "summary:" + dimension, operation);
|
|
273
273
|
}
|
|
274
274
|
/** Synchronous migration lock for explicit layout migration. */
|
|
275
275
|
controlMigration(operation) {
|
|
276
276
|
return this.withLock(".write-migrate", "migrate", operation);
|
|
277
277
|
}
|
|
278
|
+
migrationNotice() {
|
|
279
|
+
return this.layout === "monthly" ? this.detectFlatFiles().message : undefined;
|
|
280
|
+
}
|
|
278
281
|
/** Detect unmigrated top-level flat JSON files when running under monthly layout. */
|
|
279
282
|
detectFlatFiles() {
|
|
280
283
|
if (!sharedDirectory(this.directory))
|
|
@@ -294,7 +297,7 @@ export class HistoryFiles {
|
|
|
294
297
|
summaryCount,
|
|
295
298
|
total,
|
|
296
299
|
message: `检测到 ${total} 个未迁移的平铺历史文件(raw ${rawCount},summaries ${summaryCount});当前为年月目录布局(history.layout: monthly),未迁移文件不会被读取。` +
|
|
297
|
-
|
|
300
|
+
`请在终端运行 pbot history migrate 整理到 YYYY/MM/ 目录(Pi/dsh 可用 /pbot history migrate),或在 .pbot/config.json 中设置 "history": { "layout": "flat" } 切回平铺布局。`,
|
|
298
301
|
};
|
|
299
302
|
}
|
|
300
303
|
listFlatRawFiles() {
|
|
@@ -303,7 +306,7 @@ export class HistoryFiles {
|
|
|
303
306
|
return topLevelJsonNames(this.rawDirectory);
|
|
304
307
|
}
|
|
305
308
|
listFlatSummaryFiles(dimension) {
|
|
306
|
-
requireThat(
|
|
309
|
+
requireThat(isHistoryIdentifier(dimension), "历史摘要维度无效:" + dimension);
|
|
307
310
|
const dir = this.summaryDirectory(dimension);
|
|
308
311
|
if (!sharedDirectory(this.directory) || !ordinaryDirectory(this.summariesDirectory) || !ordinaryDirectory(dir))
|
|
309
312
|
return [];
|
|
@@ -313,13 +316,16 @@ export class HistoryFiles {
|
|
|
313
316
|
return readJsonFile(this.directory, "raw/" + name, value => namedRaw(value, name));
|
|
314
317
|
}
|
|
315
318
|
readFlatSummaryFile(dimension, name) {
|
|
316
|
-
requireThat(
|
|
319
|
+
requireThat(isHistoryIdentifier(dimension), "历史摘要维度无效:" + dimension);
|
|
317
320
|
return readJsonFile(this.directory, `summaries/${dimension}/${name}`, value => namedSummary(value, name, dimension));
|
|
318
321
|
}
|
|
319
322
|
/** Atomically move a file within .pbot/history/ without ever overwriting an existing destination. */
|
|
320
|
-
moveHistoryFile(fromRelative, toRelative) {
|
|
321
|
-
ensureDirectory(this.directory);
|
|
323
|
+
moveHistoryFile(fromRelative, toRelative, dryRun = false) {
|
|
322
324
|
const src = internalPath(this.directory, fromRelative);
|
|
325
|
+
if (dryRun) {
|
|
326
|
+
const target = internalPath(this.directory, toRelative, true);
|
|
327
|
+
return ordinaryFile(target) ? "conflict" : "moved";
|
|
328
|
+
}
|
|
323
329
|
const dstParentRel = dirname(toRelative);
|
|
324
330
|
if (dstParentRel && dstParentRel !== ".") {
|
|
325
331
|
privateDirectory(this.directory, dstParentRel);
|
|
@@ -333,8 +339,8 @@ export class HistoryFiles {
|
|
|
333
339
|
return "conflict";
|
|
334
340
|
throw error;
|
|
335
341
|
}
|
|
336
|
-
unlinkSync(src);
|
|
337
342
|
syncDirectory(dirname(dst));
|
|
343
|
+
unlinkSync(src);
|
|
338
344
|
syncDirectory(dirname(src));
|
|
339
345
|
return "moved";
|
|
340
346
|
}
|
|
@@ -373,7 +379,7 @@ export class HistoryFiles {
|
|
|
373
379
|
return optional(() => readJsonFile(this.directory, "raw/" + rel, value => namedRaw(value, rel)));
|
|
374
380
|
}
|
|
375
381
|
saveRaw(raw) {
|
|
376
|
-
requireThat(
|
|
382
|
+
requireThat(isHistoryIdentifier(raw.host) && raw.host === this.host, "历史归档只允许所属来源写入。");
|
|
377
383
|
rawHistory(raw);
|
|
378
384
|
ensureDirectory(this.directory);
|
|
379
385
|
const name = filename(raw.id);
|
|
@@ -398,7 +404,7 @@ export class HistoryFiles {
|
|
|
398
404
|
return [];
|
|
399
405
|
const entries = readdirSync(this.summariesDirectory, { withFileTypes: true });
|
|
400
406
|
return entries
|
|
401
|
-
.filter(entry => entry.isDirectory() && !entry.isSymbolicLink() &&
|
|
407
|
+
.filter(entry => entry.isDirectory() && !entry.isSymbolicLink() && isHistoryIdentifier(entry.name))
|
|
402
408
|
.map(entry => entry.name)
|
|
403
409
|
.sort();
|
|
404
410
|
}
|
|
@@ -406,7 +412,7 @@ export class HistoryFiles {
|
|
|
406
412
|
return dimension === "monthly" ? "year" : "month";
|
|
407
413
|
}
|
|
408
414
|
listSummaries(dimension, onlyFiles) {
|
|
409
|
-
requireThat(
|
|
415
|
+
requireThat(isHistoryIdentifier(dimension), "历史摘要维度无效:" + dimension);
|
|
410
416
|
const dir = this.summaryDirectory(dimension);
|
|
411
417
|
if (!sharedDirectory(this.directory) || !ordinaryDirectory(this.summariesDirectory) || !ordinaryDirectory(dir))
|
|
412
418
|
return [];
|
|
@@ -426,7 +432,7 @@ export class HistoryFiles {
|
|
|
426
432
|
return results;
|
|
427
433
|
}
|
|
428
434
|
readSummary(dimension, id) {
|
|
429
|
-
requireThat(
|
|
435
|
+
requireThat(isHistoryIdentifier(dimension), "历史摘要维度无效:" + dimension);
|
|
430
436
|
const dir = this.summaryDirectory(dimension);
|
|
431
437
|
if (!sharedDirectory(this.directory) || !ordinaryDirectory(this.summariesDirectory) || !ordinaryDirectory(dir))
|
|
432
438
|
return undefined;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export
|
|
3
|
-
export declare const isSummaryDimension: (value: unknown) => value is string;
|
|
1
|
+
import type { HistoryIdentity, RawHistory, SummaryArtifact } from "../model/history.js";
|
|
2
|
+
export { isHistoryIdentifier as isHistoryHost, isHistoryIdentifier as isSummaryDimension } from "../common/validation.js";
|
|
4
3
|
export declare function matchIdentity(value: HistoryIdentity, expected: HistoryIdentity): void;
|
|
5
4
|
export declare function rawHistory(value: unknown): RawHistory;
|
|
6
5
|
export declare function summaryArtifact(value: unknown, expectedDimension?: string): SummaryArtifact;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { object } from "../common/json.js";
|
|
2
|
-
import { requireThat } from "../common/validation.js";
|
|
2
|
+
import { isHistoryIdentifier, requireThat } from "../common/validation.js";
|
|
3
3
|
import { fileId } from "./file-access.js";
|
|
4
4
|
const strings = (value) => Array.isArray(value) && value.every(item => typeof item === "string");
|
|
5
5
|
const fields = (value, names) => Object.keys(value).every(key => names.includes(key));
|
|
@@ -7,11 +7,9 @@ const rawFields = ["host", "id", "sessionId", "name", "exchanges", "branches"];
|
|
|
7
7
|
const exchangeFields = ["id", "entryIds", "text", "from", "to", "completed"];
|
|
8
8
|
const summaryArtifactFields = ["id", "dimension", "host", "sessionId", "title", "text", "from", "to", "updatedAt", "source"];
|
|
9
9
|
const summarySourceFields = ["rawIds", "exchangeIds", "fingerprint"];
|
|
10
|
-
|
|
11
|
-
export const isHistoryHost = (value) => typeof value === "string" && identifierPattern.test(value);
|
|
12
|
-
export const isSummaryDimension = (value) => typeof value === "string" && identifierPattern.test(value);
|
|
10
|
+
export { isHistoryIdentifier as isHistoryHost, isHistoryIdentifier as isSummaryDimension } from "../common/validation.js";
|
|
13
11
|
function identity(value) {
|
|
14
|
-
requireThat(object(value) &&
|
|
12
|
+
requireThat(object(value) && isHistoryIdentifier(value.host) && typeof value.id === "string" &&
|
|
15
13
|
typeof value.sessionId === "string" && value.sessionId.length > 0, "历史归档身份无效。");
|
|
16
14
|
fileId(value.id);
|
|
17
15
|
}
|
|
@@ -43,12 +41,12 @@ export function summaryArtifact(value, expectedDimension) {
|
|
|
43
41
|
requireThat(object(value) && fields(value, summaryArtifactFields), "历史摘要产物格式无效。");
|
|
44
42
|
requireThat(typeof value.id === "string" && value.id.length > 0, "历史摘要 ID 无效。");
|
|
45
43
|
fileId(value.id);
|
|
46
|
-
requireThat(
|
|
44
|
+
requireThat(isHistoryIdentifier(value.dimension), "历史摘要维度无效。");
|
|
47
45
|
if (expectedDimension !== undefined) {
|
|
48
46
|
requireThat(value.dimension === expectedDimension, `历史摘要维度不匹配,预期 ${expectedDimension},实际 ${value.dimension}。`);
|
|
49
47
|
}
|
|
50
48
|
if (value.host !== undefined)
|
|
51
|
-
requireThat(
|
|
49
|
+
requireThat(isHistoryIdentifier(value.host), "历史摘要来源 host 无效。");
|
|
52
50
|
if (value.sessionId !== undefined)
|
|
53
51
|
requireThat(typeof value.sessionId === "string" && value.sessionId.length > 0, "历史摘要 sessionId 无效。");
|
|
54
52
|
requireThat(typeof value.title === "string" && typeof value.text === "string" && value.text.trim().length > 0 &&
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
|
-
import type
|
|
2
|
+
import { type HistoryHost, type HistoryQuery } from "../../model/history.js";
|
|
3
3
|
export declare const historyResultSchema: Type.TObject<{
|
|
4
4
|
matches: Type.TOptional<Type.TArray<Type.TObject<{
|
|
5
5
|
snippet: Type.TString;
|
|
@@ -84,17 +84,9 @@ export declare const historyParameters: Type.TObject<{
|
|
|
84
84
|
limit: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
85
85
|
childrenOffset: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
86
86
|
}>;
|
|
87
|
-
export type HistoryInput = {
|
|
87
|
+
export type HistoryInput = ({
|
|
88
88
|
action: "search";
|
|
89
|
-
|
|
90
|
-
dimension?: string;
|
|
91
|
-
query?: string;
|
|
92
|
-
sessionId?: string;
|
|
93
|
-
from?: string;
|
|
94
|
-
to?: string;
|
|
95
|
-
offset?: number;
|
|
96
|
-
limit?: number;
|
|
97
|
-
} | {
|
|
89
|
+
} & HistoryQuery) | {
|
|
98
90
|
action: "read";
|
|
99
91
|
id: string;
|
|
100
92
|
host?: HistoryHost;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Type } from "../../common/typebox.js";
|
|
2
|
-
import {
|
|
2
|
+
import { historyPageLimits } from "../../model/history.js";
|
|
3
|
+
import { historyIdentifierPattern, requireThat } from "../../common/validation.js";
|
|
3
4
|
import { schema } from "../../common/schema.js";
|
|
4
5
|
import { inputObject, need, nullable, pick } from "../input.js";
|
|
5
|
-
const identifier = Type.String({ pattern:
|
|
6
|
+
const identifier = Type.String({ pattern: historyIdentifierPattern.source });
|
|
6
7
|
const nullableOffset = Type.Union([Type.Integer(), Type.Null()]);
|
|
7
8
|
const node = Type.Object({
|
|
8
9
|
host: identifier,
|
|
@@ -52,23 +53,23 @@ export const historyParameters = Type.Object({
|
|
|
52
53
|
action: Type.Union([Type.Literal("search"), Type.Literal("read")], {
|
|
53
54
|
description: "search 搜索或列会话;read 读取指定节点正文与上下级。各动作仅读取自身字段,其余字段忽略。",
|
|
54
55
|
}),
|
|
55
|
-
host: nullable(Type.String({ pattern:
|
|
56
|
-
dimension: nullable(Type.String({ pattern:
|
|
56
|
+
host: nullable(Type.String({ pattern: historyIdentifierPattern.source, description: "可选来源筛选(如 pi、dsh、claude、antigravity)。" })),
|
|
57
|
+
dimension: nullable(Type.String({ pattern: historyIdentifierPattern.source, description: "仅 search:可选范围筛选(raw 表示仅原文,或指定摘要维度如 monthly、session;省略查全部)。" })),
|
|
57
58
|
query: nullable(Type.String({ description: "仅 search:不区分大小写的连续关键词;省略时列出各会话(或指定维度摘要)。" })),
|
|
58
59
|
sessionId: nullable(Type.String({ description: "仅 search:限定在指定会话 ID 内搜索。" })),
|
|
59
60
|
from: nullable(Type.String({ description: "仅 search:ISO 日期或时间下界。" })),
|
|
60
61
|
to: nullable(Type.String({ description: "仅 search:ISO 日期或时间上界。" })),
|
|
61
62
|
id: nullable(Type.String({ description: "仅 read,必填:search 或上下级返回的节点 id。" })),
|
|
62
63
|
offset: nullable(Type.Integer({ minimum: 0, description: "search:匹配结果偏移;read:正文字符偏移。默认 0。" })),
|
|
63
|
-
limit: nullable(Type.Integer({ minimum: 1, maximum:
|
|
64
|
+
limit: nullable(Type.Integer({ minimum: 1, maximum: historyPageLimits.read.max, description: `search:最多返回条数(默认 ${historyPageLimits.search.default},上限 ${historyPageLimits.search.max});read:正文字符数(默认 ${historyPageLimits.read.default})。` })),
|
|
64
65
|
childrenOffset: nullable(Type.Integer({ minimum: 0, description: "仅 read:子节点列表偏移,默认 0;续读传上页 nextChildrenOffset。" })),
|
|
65
66
|
}, { additionalProperties: false });
|
|
66
67
|
const valid = schema(historyParameters);
|
|
67
68
|
export function historyInput(value) {
|
|
68
69
|
const args = inputObject(value, valid, "历史参数格式无效");
|
|
69
70
|
if (args.action === "search") {
|
|
70
|
-
const limit = args.limit === undefined ?
|
|
71
|
-
requireThat(limit <=
|
|
71
|
+
const limit = args.limit === undefined ? historyPageLimits.search.default : args.limit;
|
|
72
|
+
requireThat(limit <= historyPageLimits.search.max, `search 的 limit 最多 ${historyPageLimits.search.max}。`);
|
|
72
73
|
return {
|
|
73
74
|
action: "search",
|
|
74
75
|
...pick(args, ["host", "dimension", "query", "sessionId", "from", "to", "offset", "limit"]),
|
package/lib/ui/dsh/elements.d.ts
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
export declare const record: (value: unknown) => Record<string, unknown>;
|
|
2
2
|
export declare const rows: (value: unknown) => Record<string, unknown>[];
|
|
3
3
|
export declare const text: (value: unknown) => string;
|
|
4
|
-
export declare const objectInput: (value: string) => Record<string, unknown>;
|
|
5
|
-
export declare const lines: (value: string) => string[];
|
|
6
4
|
export declare function element<K extends keyof HTMLElementTagNameMap>(tag: K, content?: string, className?: string): HTMLElementTagNameMap[K];
|
|
7
5
|
export declare function block(value: unknown): HTMLPreElement;
|
|
8
6
|
export declare function note(value: string): HTMLParagraphElement;
|
|
9
7
|
export declare function group(parent: HTMLElement, className?: string): HTMLDivElement;
|
|
10
8
|
export declare function details(parent: HTMLElement, title: string): HTMLDetailsElement;
|
|
11
|
-
export declare function field(parent: HTMLElement, label: string
|
|
9
|
+
export declare function field(parent: HTMLElement, label: string): HTMLInputElement;
|
|
12
10
|
export declare function select(parent: HTMLElement, label: string, values: [string, string][]): HTMLSelectElement;
|
|
13
|
-
export declare function badge(state: unknown): HTMLSpanElement;
|
|
14
11
|
export declare function facts(values: [string, unknown][]): HTMLDListElement;
|
|
15
12
|
export declare function empty(title: string, description: string): HTMLDivElement;
|
|
16
|
-
export declare function pageTitle(parent: HTMLElement, title: string
|
|
13
|
+
export declare function pageTitle(parent: HTMLElement, title: string): HTMLElement;
|
|
17
14
|
export declare function time(value: unknown): string;
|
package/lib/ui/dsh/elements.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { object } from "../../common/json.js";
|
|
2
|
-
import { stateLabel } from "../presentation.js";
|
|
3
2
|
export const record = (value) => { if (!object(value))
|
|
4
3
|
throw new Error("管理数据无效。"); return value; };
|
|
5
4
|
export const rows = (value) => Array.isArray(value) ? value.map(record) : [];
|
|
6
5
|
export const text = (value) => value === null || value === undefined ? "" : String(value);
|
|
7
|
-
export const objectInput = (value) => record(JSON.parse(value || "{}"));
|
|
8
|
-
export const lines = (value) => value.split(/\r?\n/).map(item => item.trim()).filter(Boolean);
|
|
9
6
|
export function element(tag, content = "", className = "") {
|
|
10
7
|
const node = document.createElement(tag);
|
|
11
8
|
node.textContent = content;
|
|
@@ -25,13 +22,10 @@ export function details(parent, title) {
|
|
|
25
22
|
parent.append(node);
|
|
26
23
|
return node;
|
|
27
24
|
}
|
|
28
|
-
export function field(parent, label
|
|
29
|
-
const wrapper = element("label", "", "pbot-field"), input =
|
|
25
|
+
export function field(parent, label) {
|
|
26
|
+
const wrapper = element("label", "", "pbot-field"), input = element("input");
|
|
30
27
|
wrapper.append(element("span", label));
|
|
31
|
-
input.value = value;
|
|
32
28
|
input.setAttribute("aria-label", label);
|
|
33
|
-
if (input instanceof HTMLTextAreaElement)
|
|
34
|
-
input.rows = 3;
|
|
35
29
|
wrapper.append(input);
|
|
36
30
|
parent.append(wrapper);
|
|
37
31
|
return input;
|
|
@@ -49,11 +43,6 @@ export function select(parent, label, values) {
|
|
|
49
43
|
parent.append(wrapper);
|
|
50
44
|
return input;
|
|
51
45
|
}
|
|
52
|
-
export function badge(state) {
|
|
53
|
-
const node = element("span", stateLabel(state), "pbot-badge");
|
|
54
|
-
node.dataset.state = text(state);
|
|
55
|
-
return node;
|
|
56
|
-
}
|
|
57
46
|
export function facts(values) {
|
|
58
47
|
const node = element("dl", "", "pbot-facts");
|
|
59
48
|
for (const [label, value] of values)
|
|
@@ -65,11 +54,9 @@ export function empty(title, description) {
|
|
|
65
54
|
node.append(element("h3", title), note(description));
|
|
66
55
|
return node;
|
|
67
56
|
}
|
|
68
|
-
export function pageTitle(parent, title
|
|
57
|
+
export function pageTitle(parent, title) {
|
|
69
58
|
const node = element("header", "", "pbot-page-title");
|
|
70
59
|
node.append(element("h2", title));
|
|
71
|
-
if (description)
|
|
72
|
-
node.append(note(description));
|
|
73
60
|
parent.append(node);
|
|
74
61
|
return node;
|
|
75
62
|
}
|
package/lib/ui/dsh/management.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { historyPageLimits } from "../../model/history.js";
|
|
1
2
|
import { object, json } from "../../common/json.js";
|
|
2
3
|
import { block, details, element, empty, facts, field, group, note, pageTitle, record, rows, select, text, time } from "./elements.js";
|
|
3
4
|
import { managementStyles } from "./styles.js";
|
|
@@ -125,15 +126,15 @@ export function showManagement(ctx, parentSessionId) {
|
|
|
125
126
|
lifetime.signal.throwIfAborted();
|
|
126
127
|
return record(result.value);
|
|
127
128
|
}
|
|
128
|
-
async function
|
|
129
|
-
const result = await ctx.remote.commands.execute(parentSessionId, "/pbot "
|
|
129
|
+
async function initializeWorkspace() {
|
|
130
|
+
const result = await ctx.remote.commands.execute(parentSessionId, "/pbot init", []);
|
|
130
131
|
if (!result.ok)
|
|
131
132
|
throw new Error(result.error.message + ";如连接中断,请先刷新记录确认操作是否已接纳。");
|
|
132
133
|
if (!result.value)
|
|
133
134
|
throw new Error("管理命令未被接纳。");
|
|
134
135
|
if (result.value.result.kind === "error")
|
|
135
136
|
throw new Error(result.value.result.text);
|
|
136
|
-
inform(
|
|
137
|
+
inform("工作区已初始化并启用。");
|
|
137
138
|
if (!closed) {
|
|
138
139
|
try {
|
|
139
140
|
await refresh();
|
|
@@ -142,24 +143,23 @@ export function showManagement(ctx, parentSessionId) {
|
|
|
142
143
|
inform("操作已接纳;刷新状态未成功:" + String(error), "error");
|
|
143
144
|
}
|
|
144
145
|
}
|
|
145
|
-
return result.value.result.text ?? "";
|
|
146
146
|
}
|
|
147
147
|
const status = section("status", "工作区");
|
|
148
|
-
pageTitle(status, "工作区"
|
|
148
|
+
pageTitle(status, "工作区");
|
|
149
149
|
const counts = note(""), workspaceInfo = group(status);
|
|
150
150
|
status.querySelector("header").after(counts);
|
|
151
151
|
counts.classList.add("pbot-counts");
|
|
152
152
|
const materials = group(status, "pbot-setting");
|
|
153
153
|
materials.append(element("h3", "资料目录"));
|
|
154
|
-
const initializeButton = button(materials, "准备目录",
|
|
154
|
+
const initializeButton = button(materials, "准备目录", initializeWorkspace);
|
|
155
155
|
const diagnostic = details(status, "环境详情"), statusBody = block("");
|
|
156
156
|
statusBody.classList.add("pbot-raw");
|
|
157
157
|
diagnostic.append(statusBody);
|
|
158
158
|
const history = section("history", "历史");
|
|
159
|
-
pageTitle(history, "历史"
|
|
159
|
+
pageTitle(history, "历史");
|
|
160
160
|
const searchForm = form(history);
|
|
161
161
|
searchForm.className = "pbot-search";
|
|
162
|
-
const historyQuery = field(searchForm, "关键词"), host = select(searchForm, "来源", [["", "全部"], ["pi", "Pi"], ["dsh", "dsh"], ["claude", "Claude Code"], ["antigravity", "Antigravity"]]);
|
|
162
|
+
const historyQuery = field(searchForm, "关键词"), host = select(searchForm, "来源", [["", "全部"], ["pi", "Pi"], ["dsh", "dsh"], ["claude", "Claude Code"], ["antigravity", "Antigravity"], ["codex", "Codex"], ["qoder", "Qoder CLI"]]);
|
|
163
163
|
historyQuery.placeholder = "留空查看最近会话";
|
|
164
164
|
submit(searchForm, "查询", () => searchHistory());
|
|
165
165
|
const dateFilters = details(history, "时间范围"), dateGrid = group(dateFilters, "pbot-grid");
|
|
@@ -204,7 +204,7 @@ export function showManagement(ctx, parentSessionId) {
|
|
|
204
204
|
if (!rows(data.matches).length)
|
|
205
205
|
historyBody.append(empty("没有找到匹配内容", "试试更短的关键词,或调整来源和时间范围。"));
|
|
206
206
|
if (offset)
|
|
207
|
-
button(historyPaging, "上一页", () => searchHistory(Math.max(0, offset -
|
|
207
|
+
button(historyPaging, "上一页", () => searchHistory(Math.max(0, offset - historyPageLimits.search.default), true));
|
|
208
208
|
if (typeof data.nextOffset === "number")
|
|
209
209
|
button(historyPaging, "下一页", () => searchHistory(data.nextOffset, true));
|
|
210
210
|
}
|
package/lib/ui/dsh/styles.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const managementStyles = "\n.pbot-management {\n --pbot-bg: var(--dsw-alias-bg-base, #f8f9fb);\n --pbot-surface: var(--dsw-alias-bg-layer-1, #fff);\n --pbot-ink: var(--dsw-alias-label-primary, #20232b);\n --pbot-muted: var(--dsw-alias-label-secondary, #696e79);\n --pbot-line: var(--dsw-alias-border-l2, #e3e5eb);\n --pbot-accent: var(--dsw-alias-brand-primary, #4d6bfe);\n --pbot-tint: color-mix(in srgb, var(--pbot-accent) 9%, var(--pbot-surface));\n --pbot-danger: var(--dsw-alias-state-error-primary, #c93535);\n width: min(1180px, calc(100vw - 48px)); height: min(820px, calc(100dvh - 64px));\n max-width: none; max-height: none; padding: 0; margin: auto; overflow: hidden;\n border: 1px solid var(--pbot-line); border-radius: 12px; color: var(--pbot-ink); background: var(--pbot-surface);\n box-shadow: 0 12px 40px #0002; font: 14px/1.55 var(--dsw-font-family, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif);\n}\n.pbot-management::backdrop { background: #10182866; }\n.pbot-management *, .pbot-management *::before, .pbot-management *::after { box-sizing: border-box; }\n.pbot-management [hidden] { display: none !important; }\n.pbot-management h2, .pbot-management h3, .pbot-management h4, .pbot-management p { margin: 0; }\n.pbot-management h2 { font-size: 21px; font-weight: 600; }\n.pbot-management h3 { font-size: 16px; font-weight: 600; }\n.pbot-management h4 { font-size: 14px; font-weight: 600; }\n.pbot-management button, .pbot-management input, .pbot-management textarea, .pbot-management select { font: inherit; color: inherit; }\n.pbot-management button { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 7px 13px; border: 1px solid var(--pbot-line); border-radius: 8px; background: var(--pbot-surface); cursor: pointer; line-height: 1.4; }\n.pbot-management button:hover:not(:disabled) { background: var(--pbot-tint); border-color: color-mix(in srgb, var(--pbot-accent) 40%, var(--pbot-line)); }\n.pbot-management button:disabled { opacity: .45; cursor: not-allowed; }\n.pbot-management :is(button, input, textarea, select, summary):focus-visible { outline: 2px solid var(--pbot-accent); outline-offset: 3px; }\n.pbot-management button.pbot-primary { background: var(--pbot-accent); border-color: var(--pbot-accent); color: var(--pbot-surface); font-weight: 600; }\n.pbot-management button.pbot-primary:hover:not(:disabled) { filter: brightness(.94); background: var(--pbot-accent); }\n.pbot-management button.pbot-quiet { border-color: transparent; background: transparent; }\n.pbot-management button.pbot-danger { color: var(--pbot-danger); }\n.pbot-management button[data-busy=true]::after { content: \"\u2026\"; }\n.pbot-shell { height: 100%; display: grid; grid-template-columns: 178px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }\n.pbot-header { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--pbot-line); }\n.pbot-brand { font-size: 16px; font-weight: 650; letter-spacing: -.3px; }\n.pbot-location { color: var(--pbot-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; max-width: 65vw; }\n.pbot-header-copy { min-width: 0; flex: 1; }\n.pbot-management .pbot-close { width: 34px; padding: 0; font-size: 22px; }\n.pbot-nav { display: flex; flex-direction: column; gap: 6px; padding: 22px 12px; background: var(--pbot-bg); border-right: 1px solid var(--pbot-line); }\n.pbot-nav button { text-align: left; justify-content: space-between; border-color: transparent; background: transparent; padding: 11px 12px; color: var(--pbot-muted); }\n.pbot-nav button[aria-selected=true] { color: var(--pbot-accent); background: var(--pbot-tint); font-weight: 600; }\n.pbot-nav small { font-size: 11px; font-variant-numeric: tabular-nums; opacity: .8; }\n.pbot-main { min-width: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 26px 28px; }\n.pbot-page-title { margin-bottom: 22px; display: grid; gap: 5px; }\n.pbot-muted { color: var(--pbot-muted); font-size: 13px; overflow-wrap: anywhere; }\n.pbot-footer { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 10px 22px; border-top: 1px solid var(--pbot-line); color: var(--pbot-muted); font-size: 12px; }\n.pbot-footer > span { flex: 1; }\n.pbot-footer button { min-height: 28px; padding: 4px 9px; font-size: 12px; }\n.pbot-notice { position: sticky; top: -26px; z-index: 2; padding: 12px 14px; margin: -6px 0 18px; border: 1px solid var(--pbot-line); border-left: 3px solid var(--pbot-accent); background: var(--pbot-surface); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow-y: auto; }\n.pbot-notice[data-tone=error] { border-left-color: var(--pbot-danger); }\n.pbot-notice:empty { display: none; }\n.pbot-stack { display: grid; gap: 16px; }\n.pbot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }\n.pbot-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }\n.pbot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }\n.pbot-counts { margin: -8px 0 20px !important; }\n.pbot-setting { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 0; border-top: 1px solid var(--pbot-line); }\n.pbot-setting > div { min-width: 0; }\n.pbot-setting h3 { margin-bottom: 8px; }\n.pbot-setting > button { flex-shrink: 0; }\n.pbot-card { padding: 18px; border: 1px solid var(--pbot-line); border-radius: 12px; background: var(--pbot-surface); min-width: 0; }\n.pbot-card > :is(h3, .pbot-between) { margin-bottom: 12px; }\n.pbot-badge { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; color: var(--pbot-muted); background: var(--pbot-bg); padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; }\n.pbot-badge::before { content: \"\"; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }\n.pbot-badge:is([data-state=busy],[data-state=running],[data-state=starting]) { 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";
|
|
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 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, 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[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-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-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-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,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::placeholder { color: var(--pbot-muted); opacity: .8; }\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-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-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-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-main { padding: 22px 18px; }\n .pbot-notice { top: -22px; }\n .pbot-header { padding: 14px 18px; }\n}\n@media (max-width: 600px) {\n .pbot-management { width: calc(100vw - 12px); height: calc(100dvh - 16px); }\n .pbot-grid { grid-template-columns: minmax(0, 1fr); }\n .pbot-search { grid-template-columns: minmax(0, 1fr) 110px; }\n .pbot-search > button { grid-column: 1 / -1; }\n .pbot-footer { padding: 8px 14px; }\n .pbot-location { max-width: 68vw; }\n}\n";
|
package/lib/ui/dsh/styles.js
CHANGED
|
@@ -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; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "personal-bot",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
|
+
"license": "MIT",
|
|
4
5
|
"repository": {
|
|
5
6
|
"type": "git",
|
|
6
7
|
"url": "git+https://github.com/realqiyan/personal-bot.git"
|
|
@@ -63,6 +64,8 @@
|
|
|
63
64
|
".mcp.json",
|
|
64
65
|
"hooks/hooks.json",
|
|
65
66
|
"scripts/README.md",
|
|
67
|
+
"LICENSE",
|
|
68
|
+
"DISCLAIMER.md",
|
|
66
69
|
"README.md",
|
|
67
70
|
"README.zh-CN.md",
|
|
68
71
|
"CONTEXT.md",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pbot
|
|
3
|
-
description: 初始化 Personal Bot
|
|
3
|
+
description: 初始化 Personal Bot 工作区、查看状态、搜索归档或生成历史摘要。
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -14,3 +14,13 @@ node "<plugin-root>/lib/plugin.js" antigravity status
|
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
根据用户参数选择一条:`init` 补建资料目录与根 `AGENTS.md` 并启用工作区,`status` 只查看工作区及当前配置状态。省略参数时查看状态。返回命令的实际结果和需要处理的错误。
|
|
17
|
+
|
|
18
|
+
用户要求整理历史时,在当前工作区执行 `pbot history summary --workspace "<workspaceRoot>"`。检查待处理数量用 `history status`,列维度用 `history list`,搜索与读取用 `history search`、`history read`,迁移预览用 `history migrate --dry-run`。保留用户指定的参数。
|
|
19
|
+
|
|
20
|
+
首次使用或全局 CLI 缺少该子命令时,可直接运行随插件安装的 CLI:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
node "<plugin-root>/lib/extension/workspace-cli.js" history summary --workspace "<workspaceRoot>"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
也可读取 `<plugin-root>/package.json` 的 `version`,运行 `npx --yes personal-bot@<version> history summary --workspace "<workspaceRoot>"`。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pbot
|
|
3
|
-
description: 初始化 Personal Bot
|
|
3
|
+
description: 初始化 Personal Bot 工作区、查看状态、搜索归档或生成历史摘要。
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -14,3 +14,13 @@ node "${CLAUDE_SKILL_DIR}/../../../../lib/claude.js" status
|
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
根据用户参数选择一条:`init` 补建资料并启用工作区,`status` 只查看工作区及当前配置状态。省略参数时查看状态。返回命令的实际结果和需要处理的错误。
|
|
17
|
+
|
|
18
|
+
用户要求整理历史时,在当前工作区执行 `pbot history summary --workspace "<workspaceRoot>"`。检查待处理数量用 `history status`,列维度用 `history list`,搜索与读取用 `history search`、`history read`,迁移预览用 `history migrate --dry-run`。保留用户指定的参数。
|
|
19
|
+
|
|
20
|
+
首次使用或全局 CLI 缺少该子命令时,可直接运行随插件安装的 CLI:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
node "${CLAUDE_SKILL_DIR}/../../../../lib/extension/workspace-cli.js" history summary --workspace "<workspaceRoot>"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
也可读取 `${CLAUDE_SKILL_DIR}/../../../../package.json` 的 `version`,运行 `npx --yes personal-bot@<version> history summary --workspace "<workspaceRoot>"`。
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pbot
|
|
3
|
+
description: 初始化 Personal Bot 工作区、查看状态、搜索归档或生成历史摘要。
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
使用当前会话的 `workspaceRoot` 作为 `--workspace`。省略子命令时使用 `status`。可执行 `init`、`status`、`history status|list|summary|migrate|search|read`。保留用户指定的维度、模型和筛选参数。
|
|
8
|
+
|
|
9
|
+
运行 `npx --yes personal-bot@<release> <子命令> --workspace "<workspaceRoot>"`。如果 `pbot --at-least <release>` 返回 0,也可以用 `pbot` 执行同一条命令。返回实际结果。
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
未指定其他程序时,默认由当前宿主直接处理或使用当前宿主原生子代理。需要委派其他程序(或按工作区 `AGENTS.md`、`agents/coordinator.md` 分工约定)时,使用 `pbot` MCP 的 `worker_*` 工具(先 `worker_create` 再 `worker_request`)。工作区 `.pbot/mcp.json` 注册的 MCP 由当前宿主原生挂载,直接调用对应原生工具即可。回溯旧讨论用 `pbot_history`。
|
|
2
|
+
用户要求更新工作区历史摘要时,运行 `pbot history summary --workspace "<workspaceRoot>"`。需要按当前版本调用时,读取 `resourceRoot/../package.json` 的 `version`,用 `npx --yes personal-bot@<version>` 替换命令中的 `pbot`。
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
未指定其他程序时,默认由当前宿主直接处理或使用当前宿主原生子代理。需要委派其他程序(或按工作区 `AGENTS.md`、`agents/coordinator.md` 分工约定)时,使用 `pbot` MCP 的 `worker_*` 工具(先 `worker_create` 再 `worker_request`),并传入当前 `workspaceRoot` 作为 `workspace`。调用 `.pbot/mcp.json` 中统一注册的工作区 MCP 时,使用 `workspace_mcp_discover` 与 `workspace_mcp_call`(可与宿主原生 MCP 同时使用)。
|
|
2
|
+
用户要求更新工作区历史摘要时,运行 `pbot history summary --workspace "<workspaceRoot>"`。需要按当前版本调用时,读取 `resourceRoot/../package.json` 的 `version`,用 `npx --yes personal-bot@<version>` 替换命令中的 `pbot`。
|