personal-bot 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +2 -2
- package/docs/architecture/extensibility.md +3 -3
- package/docs/architecture/model-context.md +6 -3
- package/docs/guides/cross-harness-workers.md +1 -1
- package/docs/guides/workspace-configuration.md +1 -1
- package/docs/hosts/claude-code.md +1 -1
- package/docs/hosts/codex-qoder.md +3 -1
- package/hooks/hooks.json +3 -0
- package/lib/antigravity-plugin/lib/extension/acp-worker.js +3 -3
- package/lib/antigravity-plugin/lib/extension/cli.js +33 -34
- package/lib/antigravity-plugin/lib/extension/hosts/plugin-runtime.js +1 -1
- package/lib/antigravity-plugin/lib/extension/mcp.js +70 -105
- package/lib/antigravity-plugin/lib/integrations/agent-resources.d.ts +2 -2
- package/lib/antigravity-plugin/lib/integrations/agent-resources.js +3 -3
- package/lib/antigravity-plugin/lib/integrations/hosts/antigravity/adapter.js +0 -1
- package/lib/antigravity-plugin/lib/integrations/hosts/claude/adapter.js +1 -2
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/resources.d.ts +1 -1
- package/lib/antigravity-plugin/lib/integrations/hosts/prompt-hooks.js +4 -7
- package/lib/antigravity-plugin/lib/services/history/summary-dimensions/monthly.js +1 -1
- package/lib/antigravity-plugin/lib/services/history/summary-dimensions/session.js +6 -3
- package/lib/antigravity-plugin/lib/services/history/summary-runner.js +3 -3
- package/lib/antigravity-plugin/lib/storage/history-files.js +3 -2
- package/lib/antigravity-plugin/package.json +1 -1
- package/lib/antigravity-plugin/plugin.json +2 -2
- package/lib/antigravity-plugin/resources/agents/coordinator.md +2 -4
- package/lib/antigravity-plugin/resources/agents/general-purpose.md +2 -4
- package/lib/antigravity-plugin/resources/prompts/history-monthly-summary.md +6 -11
- package/lib/antigravity-plugin/resources/prompts/history-summary.md +6 -11
- package/lib/antigravity-plugin/resources/prompts/plugin-coordinator.md +1 -1
- package/lib/antigravity-plugin/resources/prompts/workspace.md +16 -23
- package/lib/antigravity-plugin/resources/skills/project-maintenance/SKILL.md +14 -21
- package/lib/antigravity-plugin/resources/skills/provider-connections/SKILL.md +23 -36
- package/lib/antigravity-plugin/resources/templates/workspace-agents.md +5 -13
- package/lib/antigravity-plugin/skills/pbot/SKILL.md +6 -23
- package/lib/antigravity-plugin/skills/project-maintenance/SKILL.md +14 -21
- package/lib/antigravity-plugin/skills/provider-connections/SKILL.md +23 -36
- package/lib/codex-marketplace/plugins/personal-bot/.codex-plugin/plugin.json +2 -2
- package/lib/codex-marketplace/plugins/personal-bot/.mcp.json +2 -2
- package/lib/codex-marketplace/plugins/personal-bot/hooks/hooks.json +3 -3
- package/lib/codex-marketplace/plugins/personal-bot/skills/pbot/SKILL.md +11 -3
- package/lib/extension/acp-worker.js +3 -3
- package/lib/extension/cli.js +33 -34
- package/lib/extension/hosts/dsh/command.js +1 -1
- package/lib/extension/hosts/dsh/workspace.js +4 -2
- package/lib/extension/hosts/plugin-runtime.js +1 -1
- package/lib/extension/mcp/tool-contract.js +61 -99
- package/lib/extension/mcp/workers.js +5 -7
- package/lib/extension/mcp.js +70 -105
- package/lib/integrations/agent-resources.d.ts +2 -2
- package/lib/integrations/agent-resources.js +3 -3
- package/lib/integrations/hosts/antigravity/adapter.js +0 -1
- package/lib/integrations/hosts/claude/adapter.js +1 -2
- package/lib/integrations/hosts/dsh/resources.d.ts +1 -1
- package/lib/integrations/hosts/prompt-hooks.js +4 -7
- package/lib/qoder-plugin/.mcp.json +2 -2
- package/lib/qoder-plugin/.qoder-plugin/plugin.json +2 -2
- package/lib/qoder-plugin/hooks/hooks.json +3 -3
- package/lib/qoder-plugin/skills/pbot/SKILL.md +11 -3
- package/lib/services/agents/agent-service.js +2 -2
- package/lib/services/history/summary-dimensions/monthly.js +1 -1
- package/lib/services/history/summary-dimensions/session.js +6 -3
- package/lib/services/history/summary-runner.js +3 -3
- package/lib/storage/history-files.js +3 -2
- package/lib/tools/history/contract.d.ts +1 -1
- package/lib/tools/history/contract.js +14 -16
- package/package.json +2 -2
- package/resources/agents/coordinator.md +2 -4
- package/resources/agents/general-purpose.md +2 -4
- package/resources/antigravity/skills/pbot/SKILL.md +6 -23
- package/resources/claude/skills/pbot/SKILL.md +6 -23
- package/resources/plugin/skills/pbot/SKILL.md +11 -3
- package/resources/prompts/history-coordinator.md +1 -1
- package/resources/prompts/history-monthly-summary.md +6 -11
- package/resources/prompts/history-summary.md +6 -11
- package/resources/prompts/plugin-coordinator.md +1 -1
- package/resources/prompts/workspace.md +16 -23
- package/resources/skills/project-maintenance/SKILL.md +14 -21
- package/resources/skills/provider-connections/SKILL.md +23 -36
- package/resources/templates/workspace-agents.md +5 -13
- package/src/extension/cli/commands/mcp.ts +1 -1
- package/src/extension/hosts/dsh/command.ts +1 -1
- package/src/extension/hosts/dsh/workspace.ts +4 -1
- package/src/extension/hosts/pi/command.ts +1 -1
- package/src/extension/hosts/pi/events.ts +1 -1
- package/src/extension/hosts/plugin-runtime.ts +1 -1
- package/src/extension/mcp/tool-contract.ts +61 -100
- package/src/extension/mcp/workers.ts +5 -7
- package/src/integrations/agent-resources.ts +5 -5
- package/src/integrations/hosts/antigravity/adapter.ts +0 -1
- package/src/integrations/hosts/claude/adapter.ts +1 -2
- package/src/integrations/hosts/dsh/resources.ts +1 -1
- package/src/integrations/hosts/prompt-hooks.ts +3 -6
- package/src/pbot.ts +2 -2
- package/src/services/agents/agent-service.ts +2 -2
- package/src/services/history/summary-dimensions/monthly.ts +1 -1
- package/src/services/history/summary-dimensions/session.ts +6 -3
- package/src/services/history/summary-runner.ts +3 -3
- package/src/storage/history-files.ts +3 -2
- package/src/tools/history/contract.ts +14 -16
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"plugins": [
|
|
7
7
|
{
|
|
8
8
|
"name": "personal-bot",
|
|
9
|
-
"version": "0.4.
|
|
10
|
-
"description": "
|
|
9
|
+
"version": "0.4.1",
|
|
10
|
+
"description": "Organize workspace files, search past conversations, use shared MCP tools, and delegate tasks to other assistants.",
|
|
11
11
|
"source": {
|
|
12
12
|
"source": "npm",
|
|
13
13
|
"package": "personal-bot",
|
|
14
|
-
"version": "0.4.
|
|
14
|
+
"version": "0.4.1"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
]
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "personal-bot",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "Organize workspace files, search past conversations, use shared MCP tools, and delegate tasks to other assistants.",
|
|
6
6
|
"skills": [
|
|
7
7
|
"./resources/skills",
|
|
8
8
|
"./resources/claude/skills"
|
|
@@ -24,7 +24,7 @@ src/extension/hosts/plugin-runtime.ts (唯一核心逻辑:init/status/hook 引
|
|
|
24
24
|
- `nativeRootAgents: boolean`:宿主是否原生加载工作区根 `AGENTS.md`(为 `false` 时由上下文拼装附带)。
|
|
25
25
|
- `nativeWorkspaceSkills?: boolean`:宿主是否原生扫描 `.agents/skills/`(为 `false` 或省略时,在 `features.skills` 开启下由上下文拼装附带技能元数据索引)。
|
|
26
26
|
- `indexBundledSkills?: boolean`:宿主只注册管理技能时,通过 hook 按工作区的 `features.skills` 提供包内方法索引。Codex 与 Qoder CLI 使用此方式,其原生技能发现负责工作区自有技能。
|
|
27
|
-
- `coordinatorPrompt?: string
|
|
27
|
+
- `coordinatorPrompt?: string` 可指定主会话协调者的补充提示。省略时,仅在历史功能开启时加载 `plugin-coordinator.md` 中的摘要命令。
|
|
28
28
|
- `resolveRoot(cwd, rawPayload)`:从宿主环境变量或 hook 载荷解析绑定工作区根目录。
|
|
29
29
|
- 宿主通过环境变量绑定工作区时,`boundWorkspaceRoot?()` 向命令、hook 与 stdio MCP 提供同一根目录。Qoder CLI 优先使用 `QODER_PROJECT_DIR`。
|
|
30
30
|
- `parseEvent(payload)` 将宿主原生 hook 映射为 `ignore`、`inject-context`、`record-history` 或 `check-skill`。宿主负责原生子代理的生命周期。
|
|
@@ -36,11 +36,11 @@ src/extension/hosts/plugin-runtime.ts (唯一核心逻辑:init/status/hook 引
|
|
|
36
36
|
| --- | --- | --- |
|
|
37
37
|
| 工作区根目录 | `CLAUDE_PROJECT_DIR`(回退 `cwd`) | `workspacePaths[0]`(回退 `cwd`) |
|
|
38
38
|
| 根 `AGENTS.md` | 拼装附带(`nativeRootAgents: false`) | 宿主原生加载(`nativeRootAgents: true`) |
|
|
39
|
-
| 协调者上下文 | `
|
|
39
|
+
| 协调者上下文 | 新主会话的 `SessionStart` → `hookSpecificOutput.additionalContext` | `SessionStart` → `injectSteps[].systemMessage` |
|
|
40
40
|
| 未启用技能门控 | `PreToolUse(Skill)` 与 `UserPromptExpansion` 拦截工作方法,放行 `pbot` | `PreToolUse(read_file)` 拦截插件工作方法技能,放行 `pbot`;其余返回 `{ decision: "allow" }` |
|
|
41
41
|
| 原生 subagent | 完全不拦截、不提供覆盖性静态 agent | 完全不拦截、不提供覆盖性静态 agent |
|
|
42
42
|
|
|
43
|
-
Codex 与 Qoder CLI
|
|
43
|
+
Claude Code、Codex 与 Qoder CLI 共用启动、提交和结束事件的解析。新主会话在 `SessionStart` 接收上下文和适用的历史提醒。`UserPromptSubmit` 和 `Stop` 归档问答。Codex 通过回合 ID 关联同一回合的追加输入与最终回复。安装与工作区配置见[宿主指南](../hosts/codex-qoder.md)。
|
|
44
44
|
|
|
45
45
|
### 接入新插件宿主的步骤
|
|
46
46
|
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
| --- | --- |
|
|
9
9
|
| 公共约定与资料目录用途 | `resources/prompts/workspace.md`,已启用主会话与 ACP worker 加载 |
|
|
10
10
|
| 协调者 / 通用专家职责 | `resources/agents/coordinator.md`、`general-purpose.md`,叠加工作区 `agents/<role>.md` |
|
|
11
|
-
|
|
|
11
|
+
| 协调者的摘要命令 | 内置宿主在 `features.prompts` 和 `features.history` 都开启时加载。Pi/dsh 使用 `resources/prompts/history-coordinator.md`,插件宿主使用 `resources/prompts/plugin-coordinator.md` |
|
|
12
|
+
| MCP 服务、工具与参数说明 | stdio 服务在 `initialize` 中说明当前可用能力,在 `tools/list` 中提供操作和参数。Pi/dsh 的原生历史工具使用 `src/tools/history/contract.ts` |
|
|
12
13
|
| 工作区自有技能 | `<workspace>/.agents/skills/*/SKILL.md`,Pi/dsh/Antigravity/Codex/Qoder CLI 原生发现;Claude Code 与未声明原生发现的 ACP worker 按需注入元数据索引(受 `features.skills` 控制) |
|
|
13
14
|
| 专业方法技能 | `resources/skills/`(`project-maintenance`、`provider-connections`),只暴露元数据,按任务读取正文(受 `features.skills` 控制) |
|
|
14
15
|
| 历史摘要专用提示 | `resources/prompts/history-summary.md`、`history-monthly-summary.md`,仅用于独立历史摘要调用,不注入普通对话会话 |
|
|
@@ -19,9 +20,11 @@
|
|
|
19
20
|
| --- | --- | --- | --- |
|
|
20
21
|
| **Pi** | `before_agent_start` 刷新 section;`resources_discover` 提供包内技能路径;`registerMcpServer` 挂载 `worker_*` | Pi 原生加载与去重 | 不干预 |
|
|
21
22
|
| **dsh** | `system-prompt/assemble` 当次刷新 section;技能 provider 仅注册到启用主会话;`dsh-mcp-client` 挂载 `mcp__pbot__worker_*` | dsh 原生加载与去重 | 不干预原生 `subagent`/`subagent_fork` |
|
|
22
|
-
| **Claude Code** | `
|
|
23
|
+
| **Claude Code** | 新主会话在 `SessionStart` 接收上下文。`PreToolUse(Skill)` / `UserPromptExpansion` 检查技能开关。`.mcp.json` 挂载 `worker_*` | 由启动 hook 加载 | 含 `agent_id` 的事件跳过角色注入 |
|
|
23
24
|
| **Antigravity** | `SessionStart` 通过 `injectSteps` 一次性注入;`PreToolUse(read_file)` 门控未启用技能;`mcp_config.json` 挂载 `worker_*` | Antigravity 原生加载与去重 | 不拦截 `invoke_subagent`,不覆盖 Prompt |
|
|
24
|
-
| **Codex / Qoder CLI** | `SessionStart`
|
|
25
|
+
| **Codex / Qoder CLI** | 新主会话在 `SessionStart` 接收协调者上下文、包内方法索引和适用的历史提醒。插件挂载 `pbot mcp` | 宿主原生加载 | 含 `agent_id` 的子代理事件直接放行 |
|
|
26
|
+
|
|
27
|
+
Claude Code、Codex 和 Qoder CLI 在恢复会话或压缩上下文时跳过启动注入。`UserPromptSubmit` 和 `Stop` 分别用于记录用户输入和助手回复。
|
|
25
28
|
|
|
26
29
|
所有宿主在 `PBOT_SUBAGENT_RUN_ID` 存在时(作为 ACP worker 运行)自动跳过主会话上下文注入,避免重复叠加。
|
|
27
30
|
|
|
@@ -21,7 +21,7 @@ Personal Bot 将跨 Harness 专家调度统一为单一的 stdio MCP 服务(`l
|
|
|
21
21
|
|
|
22
22
|
## 6 个 MCP 工具契约
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
`initialize` 的 `instructions` 说明当前可用能力及适用场景。一组工具的操作和参数见 `tools/list`。其中 `worker_create` 列出本机可用的预设及工作区 `.pbot/config.json` 中配置的可用助手。各工具提供独立的参数 Schema 和 MCP `annotations`(读写与破坏性标记)。
|
|
25
25
|
|
|
26
26
|
| 工具 | 读写属性 | 必填参数 | 可选参数 | 职责与行为 |
|
|
27
27
|
| --- | --- | --- | --- | --- |
|
|
@@ -140,5 +140,5 @@ pbot update [--workspace <目录>]
|
|
|
140
140
|
| --- | --- |
|
|
141
141
|
| Pi | 执行 `/reload` 或重启 Pi |
|
|
142
142
|
| dsh | 重启 dsh 服务或桌面应用 |
|
|
143
|
-
| Claude Code |
|
|
143
|
+
| Claude Code、Codex、Qoder CLI | 新主会话在 `SessionStart` 加载角色提示和技能索引。历史 hook 与 CLI/MCP 调用各自读取当前配置 |
|
|
144
144
|
| Antigravity | 新会话 `SessionStart`、后续 `PreToolUse` 及 CLI/MCP 调用直接读取当前文件 |
|
|
@@ -28,7 +28,7 @@ node /absolute/path/to/personal-bot/lib/claude.js status
|
|
|
28
28
|
|
|
29
29
|
## 资料、技能与互补协作
|
|
30
30
|
|
|
31
|
-
-
|
|
31
|
+
- 新主会话在 `SessionStart` 按 `features` 开关加载公共约定、协调者职责、根 `AGENTS.md`、工作区 `agents/coordinator.md`、工作区技能索引和环境路径。在已有会话中执行 `init` 或修改角色文件后,新开会话即可加载。
|
|
32
32
|
- **技能门控与共享技能**:包内声明 `project-maintenance` 与 `provider-connections`;未启用工作区或 `features.skills: false` 时 `PreToolUse(Skill)` 与 `UserPromptExpansion` 拦截工作方法调用,始终放行 `/personal-bot:pbot`。工作区自有技能统一维护在 `.agents/skills/<name>/SKILL.md`(由上下文元数据索引按需加载,跨所有宿主通用)。
|
|
33
33
|
- **工作区统一 MCP**:`.pbot/mcp.json` 注册的跨宿主 MCP 经 [.mcp.json](../../.mcp.json) 挂载的 `pbot` MCP(`workspace_mcp_discover` / `workspace_mcp_call`)直接调用,可与 Claude 原生 `.mcp.json` 同时使用。
|
|
34
34
|
- **同宿主 vs 跨 Harness 互补**:
|
|
@@ -40,7 +40,9 @@ pbot plugin qoder status
|
|
|
40
40
|
|
|
41
41
|
两个宿主共用一份 `.pbot/config.json`,同一目录初始化一次即可。Codex hook 使用事件的 `cwd`。Qoder 的 hook、管理命令和 MCP 共用 `QODER_PROJECT_DIR`,缺失时依次使用 `PBOT_WORKSPACE_ROOT` 与工作目录。
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
新主会话在 `SessionStart` 按配置加载协调者上下文和包内方法技能索引。在已有会话中执行 `init` 或修改角色文件后,新开会话即可加载。
|
|
44
|
+
|
|
45
|
+
启用历史后,启动时还会提示旧布局或待更新的摘要。可在工作区执行 `pbot history migrate --dry-run` 预览迁移,或用 `pbot history summary` 生成摘要。`UserPromptSubmit` 和 `Stop` 记录主会话问答。Codex 按会话和回合 ID 关联追加输入及回复。原始记录的来源分别为 `codex` 和 `qoder`。
|
|
44
46
|
|
|
45
47
|
宿主原生发现根 `AGENTS.md` 与 `.agents/skills/`。包内方法按 `features.skills` 提供,管理技能可由用户显式调用。
|
|
46
48
|
|
package/hooks/hooks.json
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"hooks": {
|
|
3
|
+
"SessionStart": [
|
|
4
|
+
{ "hooks": [{ "type": "command", "command": "node", "args": ["${CLAUDE_PLUGIN_ROOT}/lib/claude.js", "hook"], "timeout": 30 }] }
|
|
5
|
+
],
|
|
3
6
|
"UserPromptSubmit": [
|
|
4
7
|
{ "hooks": [{ "type": "command", "command": "node", "args": ["${CLAUDE_PLUGIN_ROOT}/lib/claude.js", "hook"], "timeout": 30 }] }
|
|
5
8
|
],
|
|
@@ -11158,7 +11158,7 @@ async function readLocalRole(agent, root) {
|
|
|
11158
11158
|
async function agentText(agent, root, coordinatorPrompt = "plugin-coordinator.md") {
|
|
11159
11159
|
requireThat(agent === "coordinator" || agent === "general-purpose", "\u672A\u77E5\u804C\u8D23\u3002");
|
|
11160
11160
|
let text3 = await readFile(join7(resourceRoot, "agents", agent + ".md"), "utf8");
|
|
11161
|
-
if (agent === "coordinator") {
|
|
11161
|
+
if (agent === "coordinator" && coordinatorPrompt) {
|
|
11162
11162
|
text3 += "\n\n" + await readFile(join7(resourceRoot, "prompts", coordinatorPrompt), "utf8");
|
|
11163
11163
|
}
|
|
11164
11164
|
const local = await readLocalRole(agent, root);
|
|
@@ -11169,7 +11169,7 @@ async function agentText(agent, root, coordinatorPrompt = "plugin-coordinator.md
|
|
|
11169
11169
|
function formatWorkspaceSkills(skills) {
|
|
11170
11170
|
if (!skills.length) return "";
|
|
11171
11171
|
const lines = skills.map((skill) => `- **${skill.name}**\uFF08\`${skill.path}\`\uFF09\uFF1A${skill.description}`);
|
|
11172
|
-
return "## \
|
|
11172
|
+
return "## \u6309\u9700\u8BFB\u53D6\u7684\u6280\u80FD\n\n" + lines.join("\n");
|
|
11173
11173
|
}
|
|
11174
11174
|
async function loadWorkspaceContext(options) {
|
|
11175
11175
|
const {
|
|
@@ -11189,7 +11189,7 @@ async function loadWorkspaceContext(options) {
|
|
|
11189
11189
|
includeRootAgents ? readOptionalFile(join7(root, "AGENTS.md")) : Promise.resolve("")
|
|
11190
11190
|
]) : ["", "", ""];
|
|
11191
11191
|
const skillsSection = formatWorkspaceSkills(workspaceSkills);
|
|
11192
|
-
const noticesSection = notices.length ? "## \
|
|
11192
|
+
const noticesSection = notices.length ? "## \u7EF4\u62A4\u63D0\u9192\n\n\u544A\u77E5\u7528\u6237\uFF0C\u6309\u7528\u6237\u8981\u6C42\u6267\u884C\u3002\n\n" + notices.map((item) => `- ${item}`).join("\n") : "";
|
|
11193
11193
|
const environment = { host, workspaceRoot: root, resourceRoot };
|
|
11194
11194
|
const text3 = [
|
|
11195
11195
|
workspace,
|
|
@@ -3310,7 +3310,7 @@ var init_history_files = __esm({
|
|
|
3310
3310
|
rawCount,
|
|
3311
3311
|
summaryCount,
|
|
3312
3312
|
total,
|
|
3313
|
-
message: `\
|
|
3313
|
+
message: `\u5F53\u524D\u6309\u5E74\u6708\u8BFB\u53D6\u5386\u53F2\uFF0C\u5E73\u94FA\u76EE\u5F55\u4E2D\u7684 ${rawCount} \u4EFD\u539F\u6587\u548C ${summaryCount} \u4EFD\u6458\u8981\u5C1A\u672A\u7EB3\u5165\u68C0\u7D22\u3002\u53EF\u5728\u5DE5\u4F5C\u533A\u6839\u76EE\u5F55\u7528 pbot history migrate --dry-run \u9884\u89C8\uFF0C\u7528 pbot history migrate \u6267\u884C\uFF08Pi\u3001dsh \u53EF\u7528 /pbot history migrate\uFF09\u3002\u8981\u7EE7\u7EED\u4F7F\u7528\u5E73\u94FA\u76EE\u5F55\uFF0C\u53EF\u5728 .pbot/config.json \u4E2D\u8BBE\u7F6E "history": { "layout": "flat" }\u3002`
|
|
3314
3314
|
};
|
|
3315
3315
|
}
|
|
3316
3316
|
listFlatRawFiles() {
|
|
@@ -3571,7 +3571,7 @@ var init_monthly = __esm({
|
|
|
3571
3571
|
monthlySummaryDimension = {
|
|
3572
3572
|
id: "monthly",
|
|
3573
3573
|
title: "\u6708\u5EA6\u5386\u53F2\u6C47\u603B",
|
|
3574
|
-
description: "\u6309\
|
|
3574
|
+
description: "\u6309\u4F1A\u8BDD\u5F00\u59CB\u7684 UTC \u6708\u4EFD\u6C47\u603B\u4F1A\u8BDD\u6458\u8981\uFF0C\u53EF\u4ECE\u6708\u5EA6\u7ED3\u679C\u67E5\u56DE\u5404\u4F1A\u8BDD\u3002",
|
|
3575
3575
|
requiresMonthlyLayout: true,
|
|
3576
3576
|
plan(_raws, existing, options = {}) {
|
|
3577
3577
|
const force = Boolean(options.force);
|
|
@@ -3780,7 +3780,7 @@ var init_session = __esm({
|
|
|
3780
3780
|
sessionSummaryDimension = {
|
|
3781
3781
|
id: "session",
|
|
3782
3782
|
title: "\u4F1A\u8BDD\u4EFB\u52A1\u6458\u8981",
|
|
3783
|
-
description: "\
|
|
3783
|
+
description: "\u6C47\u603B\u5355\u6B21\u4F1A\u8BDD\u7684\u76EE\u6807\u3001\u51B3\u5B9A\u3001\u7ED3\u679C\u548C\u672A\u51B3\u4E8B\u9879\u3002",
|
|
3784
3784
|
plan(raws, existing, options = {}) {
|
|
3785
3785
|
const force = Boolean(options.force);
|
|
3786
3786
|
const tasks = [];
|
|
@@ -3841,10 +3841,13 @@ var init_session = __esm({
|
|
|
3841
3841
|
`\u3010\u5DF2\u6709\u6458\u8981\uFF08${task.existing.from} \u2014 ${task.existing.to}\uFF09\u3011
|
|
3842
3842
|
${task.existing.text}`,
|
|
3843
3843
|
`\u3010\u65B0\u589E\u5BF9\u8BDD\u3011
|
|
3844
|
-
${formatExchanges(task.addedExchanges)}
|
|
3845
|
-
"\u5728\u5DF2\u6709\u6458\u8981\u57FA\u7840\u4E0A\u5408\u5E76\u65B0\u589E\u5BF9\u8BDD\uFF0C\u8F93\u51FA\u66F4\u65B0\u540E\u7684\u5B8C\u6574\u6458\u8981\uFF1A\u4FDD\u7559\u4ECD\u6709\u6548\u7684\u4E8B\u5B9E\uFF0C\u7528\u65B0\u51B3\u5B9A\u8986\u76D6\u65E7\u51B3\u5B9A\uFF0C\u53BB\u91CD\u5E76\u4FDD\u6301\u7B80\u6D01\u3002"
|
|
3844
|
+
${formatExchanges(task.addedExchanges)}`
|
|
3846
3845
|
].join("\n\n");
|
|
3847
|
-
return {
|
|
3846
|
+
return {
|
|
3847
|
+
system: system + "\n\u5408\u5E76\u5DF2\u6709\u6458\u8981\u4E0E\u65B0\u589E\u5BF9\u8BDD\uFF0C\u8F93\u51FA\u5B8C\u6574\u6458\u8981\u3002\u4FDD\u7559\u4ECD\u6709\u6548\u7684\u4E8B\u5B9E\uFF0C\u7528\u540E\u7EED\u660E\u786E\u7684\u51B3\u5B9A\u66F4\u65B0\u76F8\u5E94\u7ED3\u8BBA\u3002",
|
|
3848
|
+
prompt: prompt2,
|
|
3849
|
+
maxTokens: 2048
|
|
3850
|
+
};
|
|
3848
3851
|
}
|
|
3849
3852
|
const prompt = [
|
|
3850
3853
|
...heading,
|
|
@@ -3956,7 +3959,8 @@ function evaluateSummaryReminder(raws, allSummaries, pendingCount, options = {})
|
|
|
3956
3959
|
if (latestSummaryMs !== void 0 && nowMs - latestSummaryMs < thresholdMs) return void 0;
|
|
3957
3960
|
const rawAgeDays = Math.floor((nowMs - oldestRawMs) / dayMs);
|
|
3958
3961
|
const daysSinceLastSummary = latestSummaryMs === void 0 ? void 0 : Math.floor((nowMs - latestSummaryMs) / dayMs);
|
|
3959
|
-
const
|
|
3962
|
+
const lastUpdate = daysSinceLastSummary === void 0 ? "\u5C1A\u65E0\u6458\u8981" : `\u4E0A\u6B21\u66F4\u65B0\u6458\u8981\u5728 ${daysSinceLastSummary} \u5929\u524D`;
|
|
3963
|
+
const message = `\u5DE5\u4F5C\u533A\u5DF2\u79EF\u7D2F ${rawAgeDays} \u5929\u7684\u5386\u53F2\uFF0C${lastUpdate}\uFF0C${pendingCount} \u9879\u5F85\u6458\u8981\u3002\u53EF\u5728\u5DE5\u4F5C\u533A\u6839\u76EE\u5F55\u8FD0\u884C pbot history summary\uFF0C\u6216\u5728 Pi\u3001dsh \u4F1A\u8BDD\u4E2D\u8F93\u5165 /pbot history summary\u3002`;
|
|
3960
3964
|
return {
|
|
3961
3965
|
rawCount: raws.length,
|
|
3962
3966
|
pendingCount,
|
|
@@ -19382,7 +19386,7 @@ var init_contract = __esm({
|
|
|
19382
19386
|
host: identifier,
|
|
19383
19387
|
id: typebox_exports.String(),
|
|
19384
19388
|
kind: typebox_exports.Union([typebox_exports.Literal("session"), typebox_exports.Literal("exchange"), typebox_exports.Literal("summary")], {
|
|
19385
|
-
description: "session
|
|
19389
|
+
description: "session \u4E3A\u4F1A\u8BDD\uFF0Csummary \u4E3A\u6458\u8981\uFF0Cexchange \u4E3A\u5355\u8F6E\u95EE\u7B54\u539F\u6587\u3002"
|
|
19386
19390
|
}),
|
|
19387
19391
|
dimension: typebox_exports.Optional(identifier),
|
|
19388
19392
|
sessionId: typebox_exports.String(),
|
|
@@ -19391,7 +19395,7 @@ var init_contract = __esm({
|
|
|
19391
19395
|
from: typebox_exports.String(),
|
|
19392
19396
|
to: typebox_exports.String(),
|
|
19393
19397
|
ready: typebox_exports.Boolean({ description: "\u6B63\u6587\u6216\u6458\u8981\u662F\u5426\u5DF2\u751F\u6210\u3002" }),
|
|
19394
|
-
completed: typebox_exports.Boolean({ description: "\
|
|
19398
|
+
completed: typebox_exports.Boolean({ description: "false \u8868\u793A\u4F1A\u8BDD\u6216\u95EE\u7B54\u4E2D\u65AD\u6216\u672A\u5B8C\u6210\u3002" })
|
|
19395
19399
|
});
|
|
19396
19400
|
historyResultSchema = typebox_exports.Object({
|
|
19397
19401
|
matches: typebox_exports.Optional(typebox_exports.Array(typebox_exports.Object({
|
|
@@ -19421,18 +19425,18 @@ var init_contract = __esm({
|
|
|
19421
19425
|
});
|
|
19422
19426
|
historyParameters = typebox_exports.Object({
|
|
19423
19427
|
action: typebox_exports.Union([typebox_exports.Literal("search"), typebox_exports.Literal("read")], {
|
|
19424
|
-
description: "search \u641C\u7D22\u6216\u5217\
|
|
19428
|
+
description: "search \u641C\u7D22\u6216\u5217\u51FA\u8BB0\u5F55\uFF0Cread \u6309 id \u8BFB\u53D6\u6B63\u6587\u548C\u4E0A\u4E0B\u7EA7\u3002"
|
|
19425
19429
|
}),
|
|
19426
|
-
host: nullable(typebox_exports.String({ pattern: historyIdentifierPattern.source, description: "\u6765\u6E90\u5BBF\u4E3B\
|
|
19427
|
-
dimension: nullable(typebox_exports.String({ pattern: historyIdentifierPattern.source, description: "
|
|
19428
|
-
query: nullable(typebox_exports.String({ description: "
|
|
19429
|
-
sessionId: nullable(typebox_exports.String({ description: "
|
|
19430
|
-
from: nullable(typebox_exports.String({ description: "
|
|
19431
|
-
to: nullable(typebox_exports.String({ description: "\u4EC5
|
|
19432
|
-
id: nullable(typebox_exports.String({ description: "
|
|
19433
|
-
offset: nullable(typebox_exports.Integer({ minimum: 0, description: "
|
|
19434
|
-
limit: nullable(typebox_exports.Integer({ minimum: 1, maximum: historyPageLimits.read.max, description: `search\
|
|
19435
|
-
childrenOffset: nullable(typebox_exports.Integer({ minimum: 0, description: "
|
|
19430
|
+
host: nullable(typebox_exports.String({ pattern: historyIdentifierPattern.source, description: "\u6765\u6E90\u5BBF\u4E3B\uFF0C\u5982 pi \u6216 claude\u3002\u53EF\u7B5B\u9009\u641C\u7D22\u7ED3\u679C\u6216\u533A\u5206\u91CD\u540D\u8282\u70B9\u3002" })),
|
|
19431
|
+
dimension: nullable(typebox_exports.String({ pattern: historyIdentifierPattern.source, description: "search \u7684\u8303\u56F4\u3002raw \u4E3A\u539F\u59CB\u95EE\u7B54\uFF0Csession\u3001monthly \u7B49\u4E3A\u6458\u8981\u7EF4\u5EA6\u3002\u5173\u952E\u8BCD\u641C\u7D22\u9ED8\u8BA4\u67E5\u5168\u90E8\u3002" })),
|
|
19432
|
+
query: nullable(typebox_exports.String({ description: "search \u5339\u914D\u8FDE\u7EED\u6587\u672C\uFF0C\u5FFD\u7565\u5927\u5C0F\u5199\u3002\u7701\u7565\u65F6\u5217\u4F1A\u8BDD\uFF0C\u6307\u5B9A\u6458\u8981\u7EF4\u5EA6\u5219\u5217\u8BE5\u7EF4\u5EA6\u7684\u6458\u8981\u3002" })),
|
|
19433
|
+
sessionId: nullable(typebox_exports.String({ description: "search \u6309\u539F\u59CB\u4F1A\u8BDD ID \u7B5B\u9009\u3002" })),
|
|
19434
|
+
from: nullable(typebox_exports.String({ description: "search \u65F6\u95F4\u533A\u95F4\u8D77\u70B9\uFF08\u542B\uFF09\uFF0C\u7528 ISO \u65E5\u671F\u6216\u65F6\u95F4\u3002" })),
|
|
19435
|
+
to: nullable(typebox_exports.String({ description: "search \u65F6\u95F4\u533A\u95F4\u7EC8\u70B9\uFF08\u542B\uFF09\uFF0C\u4EC5\u586B\u65E5\u671F\u8868\u793A\u8BE5\u65E5 UTC \u96F6\u70B9\u3002" })),
|
|
19436
|
+
id: nullable(typebox_exports.String({ description: "read \u5FC5\u586B\u3002\u4F7F\u7528\u641C\u7D22\u7ED3\u679C\u3001\u7236\u8282\u70B9\u6216\u5B50\u8282\u70B9\u7684 id\u3002" })),
|
|
19437
|
+
offset: nullable(typebox_exports.Integer({ minimum: 0, description: "\u7FFB\u9875\u4F20\u4E0A\u9875\u7684 nextOffset\u3002search \u6309\u6761\u76EE\uFF0Cread \u6309\u6B63\u6587\u5B57\u7B26\uFF0C\u9ED8\u8BA4\u4ECE 0 \u5F00\u59CB\u3002" })),
|
|
19438
|
+
limit: nullable(typebox_exports.Integer({ minimum: 1, maximum: historyPageLimits.read.max, description: `search \u6BCF\u9875\u9ED8\u8BA4 ${historyPageLimits.search.default} \u6761\uFF0C\u6700\u591A ${historyPageLimits.search.max} \u6761\u3002read \u6BCF\u9875\u9ED8\u8BA4 ${historyPageLimits.read.default} \u4E2A\u5B57\u7B26\u3002` })),
|
|
19439
|
+
childrenOffset: nullable(typebox_exports.Integer({ minimum: 0, description: "read \u7684\u5B50\u8282\u70B9\u8D77\u70B9\uFF0C\u9ED8\u8BA4 0\u3002\u7FFB\u9875\u4F20\u4E0A\u9875\u7684 nextChildrenOffset\u3002" }))
|
|
19436
19440
|
}, { additionalProperties: false });
|
|
19437
19441
|
valid2 = schema(historyParameters);
|
|
19438
19442
|
}
|
|
@@ -20478,7 +20482,6 @@ var antigravityAdapter = {
|
|
|
20478
20482
|
host: "antigravity",
|
|
20479
20483
|
nativeRootAgents: true,
|
|
20480
20484
|
nativeWorkspaceSkills: true,
|
|
20481
|
-
coordinatorPrompt: "plugin-coordinator.md",
|
|
20482
20485
|
initCommandHint: "/pbot init",
|
|
20483
20486
|
usage: "\u7528\u6CD5\uFF1Anode <\u63D2\u4EF6\u76EE\u5F55>/lib/plugin.js antigravity init|status",
|
|
20484
20487
|
resolveRoot(cwd, rawPayload) {
|
|
@@ -20559,12 +20562,9 @@ function parsePromptEvent(value) {
|
|
|
20559
20562
|
if (name !== "Stop" && name !== "UserPromptSubmit" && name !== "SessionStart") return { kind: "ignore" };
|
|
20560
20563
|
if (typeof value.agent_id === "string") return { kind: "ignore" };
|
|
20561
20564
|
requireThat(typeof value.cwd === "string", "\u63D2\u4EF6 hook \u7F3A\u5C11\u5DE5\u4F5C\u76EE\u5F55\u3002");
|
|
20562
|
-
if (name
|
|
20563
|
-
if (
|
|
20564
|
-
|
|
20565
|
-
return { kind: "inject-context", role: "coordinator", isSessionStart: true, noticesOnly: true, cwd: value.cwd, raw: value };
|
|
20566
|
-
}
|
|
20567
|
-
return { kind: "inject-context", role: "coordinator", cwd: value.cwd, raw: value };
|
|
20565
|
+
if (name !== "SessionStart") return { kind: "record-history", cwd: value.cwd, raw: value };
|
|
20566
|
+
if (value.source === "resume" || value.source === "compact") return { kind: "ignore" };
|
|
20567
|
+
return { kind: "inject-context", role: "coordinator", isSessionStart: true, cwd: value.cwd, raw: value };
|
|
20568
20568
|
}
|
|
20569
20569
|
var promptHooks = {
|
|
20570
20570
|
async extractHistory(event) {
|
|
@@ -20610,7 +20610,7 @@ var promptHooks = {
|
|
|
20610
20610
|
};
|
|
20611
20611
|
|
|
20612
20612
|
// src/integrations/hosts/claude/adapter.ts
|
|
20613
|
-
var supportedEvents2 = ["UserPromptSubmit", "PreToolUse", "UserPromptExpansion", "Stop"];
|
|
20613
|
+
var supportedEvents2 = ["SessionStart", "UserPromptSubmit", "PreToolUse", "UserPromptExpansion", "Stop"];
|
|
20614
20614
|
var boundWorkspaceRoot = () => process.env.CLAUDE_PROJECT_DIR;
|
|
20615
20615
|
async function claudeWorkspaceRoot(cwd, projectDirectory = boundWorkspaceRoot()) {
|
|
20616
20616
|
return pluginWorkspaceRoot(projectDirectory || cwd);
|
|
@@ -20619,7 +20619,6 @@ var claudeAdapter = {
|
|
|
20619
20619
|
host: "claude",
|
|
20620
20620
|
nativeRootAgents: false,
|
|
20621
20621
|
nativeWorkspaceSkills: false,
|
|
20622
|
-
coordinatorPrompt: "plugin-coordinator.md",
|
|
20623
20622
|
initCommandHint: "/personal-bot:pbot init",
|
|
20624
20623
|
usage: "\u7528\u6CD5\uFF1Anode <\u63D2\u4EF6\u76EE\u5F55>/lib/claude.js init|status",
|
|
20625
20624
|
boundWorkspaceRoot,
|
|
@@ -20865,7 +20864,7 @@ async function removeWorkspaceMcpServer(root, name) {
|
|
|
20865
20864
|
}
|
|
20866
20865
|
|
|
20867
20866
|
// src/extension/cli/commands/mcp.ts
|
|
20868
|
-
var mcpUsage = "\u7528\u6CD5\uFF1A\n pbot mcp\n pbot mcp list [--workspace <\u76EE\u5F55>] [--json]\n pbot mcp add <name> --url <url> [--header K=V]... [--description <\u8BF4\u660E>] [--timeout <\u79D2>] [--disabled] [--workspace <\u76EE\u5F55>]\n pbot mcp add <name> [--env K=V]... [--cwd <\u76EE\u5F55>] [--description <\u8BF4\u660E>] [--timeout <\u79D2>] [--disabled] [--workspace <\u76EE\u5F55>] -- <command> [args...]\n pbot mcp remove <name> [--workspace <\u76EE\u5F55>]\n\n\
|
|
20867
|
+
var mcpUsage = "\u7528\u6CD5\uFF1A\n pbot mcp\n pbot mcp list [--workspace <\u76EE\u5F55>] [--json]\n pbot mcp add <name> --url <url> [--header K=V]... [--description <\u8BF4\u660E>] [--timeout <\u79D2>] [--disabled] [--workspace <\u76EE\u5F55>]\n pbot mcp add <name> [--env K=V]... [--cwd <\u76EE\u5F55>] [--description <\u8BF4\u660E>] [--timeout <\u79D2>] [--disabled] [--workspace <\u76EE\u5F55>] -- <command> [args...]\n pbot mcp remove <name> [--workspace <\u76EE\u5F55>]\n\n\u4E0D\u5E26\u5B50\u547D\u4EE4\u65F6\u542F\u52A8 stdio MCP \u670D\u52A1\u3002\u7528 list\u3001add\u3001remove \u7BA1\u7406\u5DE5\u4F5C\u533A\u7684 .pbot/mcp.json\u3002";
|
|
20869
20868
|
async function runMcpServer() {
|
|
20870
20869
|
const entry = join19(packageRoot, "lib/extension/mcp.js");
|
|
20871
20870
|
if (!existsSync2(entry)) {
|
|
@@ -21044,7 +21043,7 @@ async function readLocalRole(agent, root) {
|
|
|
21044
21043
|
async function agentText(agent, root, coordinatorPrompt = "plugin-coordinator.md") {
|
|
21045
21044
|
requireThat(agent === "coordinator" || agent === "general-purpose", "\u672A\u77E5\u804C\u8D23\u3002");
|
|
21046
21045
|
let text = await readFile8(join20(resourceRoot, "agents", agent + ".md"), "utf8");
|
|
21047
|
-
if (agent === "coordinator") {
|
|
21046
|
+
if (agent === "coordinator" && coordinatorPrompt) {
|
|
21048
21047
|
text += "\n\n" + await readFile8(join20(resourceRoot, "prompts", coordinatorPrompt), "utf8");
|
|
21049
21048
|
}
|
|
21050
21049
|
const local = await readLocalRole(agent, root);
|
|
@@ -21055,7 +21054,7 @@ async function agentText(agent, root, coordinatorPrompt = "plugin-coordinator.md
|
|
|
21055
21054
|
function formatWorkspaceSkills(skills) {
|
|
21056
21055
|
if (!skills.length) return "";
|
|
21057
21056
|
const lines = skills.map((skill) => `- **${skill.name}**\uFF08\`${skill.path}\`\uFF09\uFF1A${skill.description}`);
|
|
21058
|
-
return "## \
|
|
21057
|
+
return "## \u6309\u9700\u8BFB\u53D6\u7684\u6280\u80FD\n\n" + lines.join("\n");
|
|
21059
21058
|
}
|
|
21060
21059
|
async function loadWorkspaceContext(options) {
|
|
21061
21060
|
const {
|
|
@@ -21075,7 +21074,7 @@ async function loadWorkspaceContext(options) {
|
|
|
21075
21074
|
includeRootAgents ? readOptionalFile(join20(root, "AGENTS.md")) : Promise.resolve("")
|
|
21076
21075
|
]) : ["", "", ""];
|
|
21077
21076
|
const skillsSection = formatWorkspaceSkills(workspaceSkills);
|
|
21078
|
-
const noticesSection = notices.length ? "## \
|
|
21077
|
+
const noticesSection = notices.length ? "## \u7EF4\u62A4\u63D0\u9192\n\n\u544A\u77E5\u7528\u6237\uFF0C\u6309\u7528\u6237\u8981\u6C42\u6267\u884C\u3002\n\n" + notices.map((item) => `- ${item}`).join("\n") : "";
|
|
21079
21078
|
const environment = { host, workspaceRoot: root, resourceRoot };
|
|
21080
21079
|
const text = [
|
|
21081
21080
|
workspace,
|
|
@@ -21354,7 +21353,7 @@ async function pluginHook(adapter, payload, replay) {
|
|
|
21354
21353
|
host: adapter.host,
|
|
21355
21354
|
root,
|
|
21356
21355
|
role: event.role,
|
|
21357
|
-
|
|
21356
|
+
coordinatorPrompt: adapter.coordinatorPrompt ?? (features.history ? "plugin-coordinator.md" : null),
|
|
21358
21357
|
includePrompts,
|
|
21359
21358
|
includeRootAgents: includePrompts && !adapter.nativeRootAgents,
|
|
21360
21359
|
...event.localRoleOnly ? { localRoleOnly: true } : {},
|
|
@@ -86,7 +86,7 @@ export async function pluginHook(adapter, payload, replay) {
|
|
|
86
86
|
host: adapter.host,
|
|
87
87
|
root,
|
|
88
88
|
role: event.role,
|
|
89
|
-
|
|
89
|
+
coordinatorPrompt: adapter.coordinatorPrompt ?? (features.history ? "plugin-coordinator.md" : null),
|
|
90
90
|
includePrompts,
|
|
91
91
|
includeRootAgents: includePrompts && !adapter.nativeRootAgents,
|
|
92
92
|
...(event.localRoleOnly ? { localRoleOnly: true } : {}),
|