{"_id":"@adamcjm/pi-subagent","_rev":"5-4a165221981277033b6e44a5d77d31fe","name":"@adamcjm/pi-subagent","dist-tags":{"latest":"1.1.3"},"versions":{"1.0.0":{"name":"@adamcjm/pi-subagent","version":"1.0.0","keywords":["pi-package","pi","subagent","agent","delegation","orchestration"],"license":"MIT","_id":"@adamcjm/pi-subagent@1.0.0","maintainers":[{"name":"adamcjm","email":"adamcjm@163.com"}],"homepage":"https://github.com/adamcjm/pi-subagent","bugs":{"url":"https://github.com/adamcjm/pi-subagent/issues"},"pi":{"extensions":["./extensions/subagent"]},"dist":{"shasum":"dda5a6224d917fb67ea31aa0dbb7433e9753d96c","tarball":"https://registry.npmjs.org/@adamcjm/pi-subagent/-/pi-subagent-1.0.0.tgz","fileCount":6,"integrity":"sha512-IZFr4vnd0Talg1No326XcSH+qwUHiMUaL2IEhNZvk6d5PFazUaxFU79LVmuQK4eduM7IWdYoWBOW9SUzrg83Ow==","signatures":[{"sig":"MEUCIQCybt6d81AIglcmZF/6qOVT712Gh4S5L5nU5CAGZ3cQ6QIgLsXR3xQ6wYzFNknvA9OKKxag/Hn/7qzFZVmBHIiFQp0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":48217},"gitHead":"d3966d208dccd668e2fbdf427ca602c977264166","_npmUser":{"name":"adamcjm","email":"adamcjm@163.com"},"repository":{"url":"git+https://github.com/adamcjm/pi-subagent.git","type":"git"},"_npmVersion":"10.9.8","description":"Subagent tool for pi: delegate tasks to specialized agents with isolated context windows (single, parallel, chain modes) with streaming output, plan-mode propagation and parent-model inheritance","directories":{},"_nodeVersion":"22.23.1","_hasShrinkwrap":false,"peerDependencies":{"@earendil-works/pi-ai":"*","@earendil-works/pi-tui":"*","@earendil-works/pi-agent-core":"*","@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-subagent_1.0.0_1789033784566_0.015551330615099168","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@adamcjm/pi-subagent","version":"1.1.0","keywords":["pi-package","pi","subagent","agent","delegation","orchestration"],"license":"MIT","_id":"@adamcjm/pi-subagent@1.1.0","maintainers":[{"name":"adamcjm","email":"adamcjm@163.com"}],"homepage":"https://github.com/adamcjm/pi-subagent","bugs":{"url":"https://github.com/adamcjm/pi-subagent/issues"},"pi":{"extensions":["./extensions/subagent"]},"dist":{"shasum":"96c4f74d5c694ee2bc7e00cbcf5514f8ab85f127","tarball":"https://registry.npmjs.org/@adamcjm/pi-subagent/-/pi-subagent-1.1.0.tgz","fileCount":6,"integrity":"sha512-XVmHyPojsRkrM1tCrSpaUx9TaueEzPkJo277IQLnmtSjKZ5pAxHU/I/pRYouySEbvK/h23QYskBfXU46VYg+vQ==","signatures":[{"sig":"MEYCIQDAR6J8eFLpuNnQW4Z16aI7aMFtDHNpHoP6jCbg3ExCSQIhAICf7Lj6gcHRknNmJcItkqVaTgGQAEdKFmuBTr7v9cOy","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":50908},"gitHead":"0fbdc9acd583d45a573387b911fd5ccdc8e383bc","_npmUser":{"name":"adamcjm","email":"adamcjm@163.com"},"repository":{"url":"git+https://github.com/adamcjm/pi-subagent.git","type":"git"},"_npmVersion":"10.9.8","description":"Subagent tool for pi: delegate tasks to specialized agents with isolated context windows (single, parallel, chain modes) with streaming output, plan-mode propagation and parent-model inheritance","directories":{},"_nodeVersion":"22.23.1","_hasShrinkwrap":false,"peerDependencies":{"@earendil-works/pi-ai":"*","@earendil-works/pi-tui":"*","@earendil-works/pi-agent-core":"*","@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-subagent_1.1.0_1789095137270_0.6464114218592159","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@adamcjm/pi-subagent","version":"1.1.1","keywords":["pi-package","pi","subagent","agent","delegation","orchestration"],"license":"MIT","_id":"@adamcjm/pi-subagent@1.1.1","maintainers":[{"name":"adamcjm","email":"adamcjm@163.com"}],"homepage":"https://github.com/adamcjm/pi-subagent","bugs":{"url":"https://github.com/adamcjm/pi-subagent/issues"},"pi":{"extensions":["./extensions/subagent"]},"dist":{"shasum":"e7f42e6dfa83241ed14dbd29f1cb71fe49150e70","tarball":"https://registry.npmjs.org/@adamcjm/pi-subagent/-/pi-subagent-1.1.1.tgz","fileCount":6,"integrity":"sha512-4Fb3ae9/+HKCY9tCZPOEPbU87gbDw885pKsfm6Gq1lbQmdweqswx2wpMkroPvd32Y8ndH8ejxdbMMYMvo7DV2Q==","signatures":[{"sig":"MEYCIQDtdtuzygmZuzPDUzOWxm63Aw/WYh2axLKkCvPGCZVExAIhAJmeZYIrhaWEBIj3cMvOVImu5W2fKKSuXhys1aPjkdlw","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":52702},"gitHead":"4c58d1a8522429051f4153dee70c51cac8198a71","_npmUser":{"name":"adamcjm","email":"adamcjm@163.com"},"repository":{"url":"git+https://github.com/adamcjm/pi-subagent.git","type":"git"},"_npmVersion":"10.9.8","description":"Subagent tool for pi: delegate tasks to specialized agents with isolated context windows (single, parallel, chain modes) with streaming output, plan-mode propagation and parent-model inheritance","directories":{},"_nodeVersion":"22.23.1","_hasShrinkwrap":false,"peerDependencies":{"@earendil-works/pi-ai":"*","@earendil-works/pi-tui":"*","@earendil-works/pi-agent-core":"*","@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-subagent_1.1.1_1789624213428_0.4859809516002014","host":"s3://npm-registry-packages-npm-production"}},"1.1.2":{"name":"@adamcjm/pi-subagent","version":"1.1.2","keywords":["pi-package","pi","subagent","agent","delegation","orchestration"],"license":"MIT","_id":"@adamcjm/pi-subagent@1.1.2","maintainers":[{"name":"adamcjm","email":"adamcjm@163.com"}],"homepage":"https://github.com/adamcjm/pi-subagent","bugs":{"url":"https://github.com/adamcjm/pi-subagent/issues"},"pi":{"extensions":["./extensions/subagent"]},"dist":{"shasum":"2f9ddc0f23cfd9c9ded1c13628bdf8b7324206de","tarball":"https://registry.npmjs.org/@adamcjm/pi-subagent/-/pi-subagent-1.1.2.tgz","fileCount":6,"integrity":"sha512-81fKZYsRlMkLUP1s/kIBV7kQDS+Gz+LKvrYwCOqVqcF09CwX34DXLgxjexlj/6pWDMIiphQVcQpLLTTCpetO0A==","signatures":[{"sig":"MEUCIHoSAPiKtO/0mtO/XmvBmJORqU3yxm/u06/UlnVAC916AiEA8jLhXB0CB7H+cpaC3RLh6oI1tpZfMzOLApZH4dc4vtA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":53596},"gitHead":"028b3d5fc2df200f8e3ee1f143c5c887109abfaa","_npmUser":{"name":"adamcjm","email":"adamcjm@163.com"},"repository":{"url":"git+https://github.com/adamcjm/pi-subagent.git","type":"git"},"_npmVersion":"10.9.8","description":"Subagent tool for pi: delegate tasks to specialized agents with isolated context windows (single, parallel, chain modes) with streaming output, plan-mode propagation and parent-model inheritance","directories":{},"_nodeVersion":"22.23.1","_hasShrinkwrap":false,"peerDependencies":{"@earendil-works/pi-ai":"*","@earendil-works/pi-tui":"*","@earendil-works/pi-agent-core":"*","@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-subagent_1.1.2_1789626811157_0.32776232781763426","host":"s3://npm-registry-packages-npm-production"}},"1.1.3":{"pi":{"extensions":["./extensions/subagent"]},"_id":"@adamcjm/pi-subagent@1.1.3","bugs":{"url":"https://github.com/adamcjm/pi-subagent/issues"},"dist":{"shasum":"5201a0738b1d0142ef74397d985bff6ffec5108e","tarball":"https://registry.npmjs.org/@adamcjm/pi-subagent/-/pi-subagent-1.1.3.tgz","fileCount":6,"integrity":"sha512-j5U05IanuyY73eBGhc+UA/CuD18gOmVO4aTb/nJ8AvDlNajKQBZOfYVHN/ZqZMR94t4oJtCQrb3UqMu0qqcJig==","signatures":[{"sig":"MEUCIFuCOX4Mu54Rcb7MFKgZKJAhSlR3mtPDZEwMqvrv+TxuAiEAlKhQZCRceevJlLfqyrYoZAPGrCr3G0+JSFgareawzxk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCID+LzMkskbaIJqSEVFowiGoXJPj305Q2UI7SKIR3cYRrAiATza1Xk+gJOmi+wLQ9bIvb9OjQrR4hUuJ6ylvaBmWxTA=="}],"unpackedSize":53574},"name":"@adamcjm/pi-subagent","gitHead":"73f0db9dddd4cadd6ab032715520fe918b1ddb7d","license":"MIT","version":"1.1.3","_npmUser":{"name":"adamcjm","email":"adamcjm@163.com"},"homepage":"https://github.com/adamcjm/pi-subagent","keywords":["pi-package","pi","subagent","agent","delegation","orchestration"],"repository":{"url":"git+https://github.com/adamcjm/pi-subagent.git","type":"git"},"_npmVersion":"10.9.8","description":"Subagent tool for pi: delegate tasks to specialized agents with isolated context windows (single, parallel, chain modes) with streaming output, plan-mode propagation and parent-model inheritance","directories":{},"maintainers":[{"name":"adamcjm","email":"adamcjm@163.com"}],"_nodeVersion":"22.23.1","_hasShrinkwrap":false,"peerDependencies":{"@earendil-works/pi-ai":"*","@earendil-works/pi-tui":"*","@earendil-works/pi-agent-core":"*","@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-subagent_1.1.3_1790937087528_0.6738912044731187"}}},"time":{"created":"2026-09-10T09:49:44.404Z","modified":"2026-10-02T10:31:27.832Z","1.0.0":"2026-09-10T09:49:44.711Z","1.1.0":"2026-09-11T02:52:17.403Z","1.1.1":"2026-09-17T05:50:13.571Z","1.1.2":"2026-09-17T06:33:31.289Z","1.1.3":"2026-10-02T10:31:27.598Z"},"bugs":{"url":"https://github.com/adamcjm/pi-subagent/issues"},"license":"MIT","homepage":"https://github.com/adamcjm/pi-subagent","keywords":["pi-package","pi","subagent","agent","delegation","orchestration"],"repository":{"url":"git+https://github.com/adamcjm/pi-subagent.git","type":"git"},"description":"Subagent tool for pi: delegate tasks to specialized agents with isolated context windows (single, parallel, chain modes) with streaming output, plan-mode propagation and parent-model inheritance","maintainers":[{"name":"adamcjm","email":"adamcjm@163.com"}],"readme":"# pi-subagent\n\n[pi](https://github.com/earendil-works/pi) 的子代理工具：把任务委派给专用 agent，每个 agent 运行在**独立上下文窗口**中。\n\n主 agent 调用 `subagent`，子 `pi` 进程干活，只有最终结果返回主会话——主上下文保持干净。\n\n[English](README.md)\n\n## 特性\n\n- **上下文隔离** —— 每个子代理运行在独立 `pi` 进程中，拥有自己的上下文窗口\n- **三种模式**：\n  - `single` —— 单个 agent、单个任务\n  - `parallel` —— 最多 8 个任务、最多 4 个并发，全部同时流式输出\n  - `chain` —— 顺序执行，后续任务可用 `{previous}` 引用上一步输出\n- **流式输出** —— 工具调用与进度实时渲染，最终结果按 markdown 渲染\n- **用量统计** —— 每个子代理的轮数、token、费用和上下文占用\n- **中止支持** —— Ctrl+C 会传播并终止子代理进程\n- **Plan 模式传播** —— 主会话处于 plan mode 时（读取 [pi-plan-mode](https://github.com/adamcjm/pi-plan-mode) 的会话状态），子进程以 `--plan` 启动；嵌套子代理通过 `PI_SUBAGENT=1` 继承\n- **模型与思考级别继承** —— agent 未固定 `model` 时，继承父会话当前模型与 thinking level\n- **项目信任感知** —— 项目已信任时，不再弹出项目级 agent 确认\n- **工具描述列出 agent** —— 可用 agent 列表写入工具描述，便于模型选择\n- **Agent 发现** —— 用户级 `~/.pi/agent/agents` 与项目级 `.pi/agents`\n- **Frontmatter 支持** —— agent markdown 支持 `name`、`description`、`tools`、`model`\n\n## 安装\n\n```bash\npi install npm:@adamcjm/pi-subagent\n```\n\n仅当前运行使用：\n\n```bash\npi -e npm:@adamcjm/pi-subagent\n```\n\n> **安全提示：** 扩展以完整系统权限执行任意代码，安装前请审阅源码。\n\n## 使用\n\n主 agent 自行判断何时委派，也可以直接要求，例如：\n\n> 用子代理 review 一下这个 diff。\n\n工具参数：\n\n| 参数 | 说明 |\n|---|---|\n| `agent` | agent 名称（single 模式） |\n| `task` | 任务文本（single 模式） |\n| `tasks` | `[{agent, task}, ...]`，并行执行 |\n| `chain` | `[{agent, task}, ...]`，顺序执行；后续任务可用 `{previous}` |\n| `agentScope` | `user`（默认）、`project` 或 `both` |\n| `confirmProjectAgents` | 运行项目级 agent 前是否确认（默认 `true`） |\n| `cwd` | 子进程工作目录（single 模式） |\n\n## Agent 定义\n\nAgent 是带 frontmatter 的 markdown 文件：\n\n```markdown\n---\nname: code-reviewer\ndescription: 资深代码评审员……\ntools: read, bash, grep, glob\nmodel: anthropic/claude-sonnet-4-5   # 可选；省略时继承父会话模型\n---\n\n正文即该 agent 的 system prompt。\n```\n\n- **用户级 agent**：`~/.pi/agent/agents/*.md`（始终可用）\n- **项目级 agent**：`.pi/agents/*.md`（需 `agentScope: \"project\"` 或 `\"both\"` 启用）\n\n同名时，`both` 作用域下项目级 agent 覆盖用户级 agent。\n\n## 说明\n\n基于 pi 官方 `subagent` 示例扩展（pi 0.85.1）构建：`agents.ts` 与官方保持逐字节一致；`index.ts` 保留官方实现（dispatch 默认值、thinking level 继承、YAML frontmatter 解析、项目信任处理），并增加：\n\n- **plan 模式传播** —— 主会话处于 plan mode 时，子进程以 `--plan` 启动；嵌套子代理通过 `PI_SUBAGENT=1` 继承\n- **agent 列表注入** —— 把可用 agent 列表写入工具描述\n\n官方示例 agent 与 workflow 提示（scout/planner/reviewer/worker、implement 系列）位于 pi 仓库的 `examples/extensions/subagent/`。\n","readmeFilename":"README.zh-CN.md"}