@raidou/pi-pm-subagents 0.1.2 → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Weirong Xu <weirongxu.raidou@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the "Software"),
7
+ to deal in the Software without restriction, including without limitation
8
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
9
+ and/or sell copies of the Software, and to permit persons to whom the
10
+ Software is furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included
13
+ in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
19
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
21
+ OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raidou/pi-pm-subagents",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Coordinator mode for pi: a read-only coordinator agent that drives isolated subagents, including a planner role.",
5
5
  "keywords": [
6
6
  "pi",
@@ -12,12 +12,23 @@
12
12
  "coordinator"
13
13
  ],
14
14
  "license": "MIT",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/weirongxu/pi-pm-subagents.git"
18
+ },
15
19
  "type": "module",
16
20
  "pi": {
17
21
  "extensions": [
18
22
  "./src/index.ts"
19
23
  ]
20
24
  },
25
+ "files": [
26
+ "src",
27
+ "agents",
28
+ "README.zh-CN.md",
29
+ "example-prompts",
30
+ "pm-subagents-prompts"
31
+ ],
21
32
  "scripts": {
22
33
  "test": "pnpm test:types && pnpm test:lint && pnpm test:unit",
23
34
  "test:types": "tsc --noEmit",
@@ -145,6 +145,37 @@ describe('MessageBatcher', () => {
145
145
  expect(firstFlush?.[1]).toContain('Subagent activity update')
146
146
  })
147
147
 
148
+ it('formats plan items with reviewed-by-user tag', () => {
149
+ vi.useFakeTimers()
150
+ const flushed: string[][] = []
151
+ const batcher = new MessageBatcher((items) => flushed.push(items), 100)
152
+ const subagent = makeSubagent(1, 'plan-1', 'done')
153
+
154
+ batcher.add(subagent, 'plan', 'The implementation plan')
155
+ batcher.flushNow()
156
+
157
+ expect(flushed).toHaveLength(1)
158
+ const item = flushed[0]?.[0]
159
+ expect(item).toContain('<subagent-plan>')
160
+ expect(item).toContain('</subagent-plan>')
161
+ expect(item).toContain('<type>plan</type>')
162
+ expect(item).toContain('<reviewed-by-user>true</reviewed-by-user>')
163
+ expect(item).toContain('<message>The implementation plan</message>')
164
+ })
165
+
166
+ it('does not add reviewed-by-user tag to non-plan items', () => {
167
+ vi.useFakeTimers()
168
+ const flushed: string[][] = []
169
+ const batcher = new MessageBatcher((items) => flushed.push(items), 100)
170
+ const subagent = makeSubagent(1, 'task-1', 'done')
171
+
172
+ batcher.add(subagent, 'done', 'Task completed')
173
+ batcher.flushNow()
174
+
175
+ const item = flushed[0]?.[0]
176
+ expect(item).not.toContain('reviewed-by-user')
177
+ })
178
+
148
179
  it('resets timer on each add', () => {
149
180
  vi.useFakeTimers()
150
181
  const flushed: string[][] = []
@@ -1,5 +1,11 @@
1
1
  import { formatSubagentSummary, type LiveSubagent } from './manager.js'
2
2
 
3
+ const TAG_NAMES: Record<string, string> = {
4
+ done: 'subagent-done',
5
+ plan: 'subagent-plan',
6
+ notify: 'subagent-notify',
7
+ }
8
+
3
9
  export class MessageBatcher {
4
10
  private items: string[] = []
5
11
  private timer: ReturnType<typeof setTimeout> | undefined
@@ -14,14 +20,15 @@ export class MessageBatcher {
14
20
  }
15
21
 
16
22
  add(subagent: LiveSubagent, type: string, message: string): void {
17
- const tagName = type === 'done' ? 'subagent-done' : 'subagent-notify'
18
- const item = [
19
- `<${tagName}>`,
20
- `<type>${type}</type>`,
23
+ const tagName = TAG_NAMES[type] ?? 'subagent-notify'
24
+ const lines = [`<${tagName}>`, `<type>${type}</type>`]
25
+ if (type === 'plan') lines.push('<reviewed-by-user>true</reviewed-by-user>')
26
+ lines.push(
21
27
  `<job>${formatSubagentSummary(subagent)}</job>`,
22
28
  `<message>${message}</message>`,
23
29
  `</${tagName}>`,
24
- ].join('\n')
30
+ )
31
+ const item = lines.join('\n')
25
32
  this.items.push(item)
26
33
  if (this.timer !== undefined) clearTimeout(this.timer)
27
34
  this.timer = setTimeout(() => {
@@ -181,7 +181,7 @@ export function registerSubagentTools(
181
181
  id: 'send-to-coordinator',
182
182
  label: 'Send plan to coordinator',
183
183
  action: () => {
184
- batcher.add(subagent, 'done', lastMessage)
184
+ batcher.add(subagent, 'plan', lastMessage)
185
185
  },
186
186
  },
187
187
  {
package/.prettierrc DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "singleQuote": true,
3
- "trailingComma": "all",
4
- "arrowParens": "always",
5
- "semi": false,
6
- "printWidth": 80
7
- }
package/AGENTS.md DELETED
@@ -1 +0,0 @@
1
- - use `pnpm test` to check and fix after edit, always test types, lint, and unit (if have)
package/eslint.config.mjs DELETED
@@ -1,14 +0,0 @@
1
- // @ts-check
2
- import { tsconfig } from '@raidou/eslint-config-base'
3
- import { defineConfig } from 'eslint/config'
4
- export default defineConfig([
5
- {
6
- files: [
7
- 'src/**/*.{mjs,ts,tsx,js,jsx}',
8
- 'app/*.{mjs,ts,tsx,js,jsx}',
9
- 'app/src/**/*.{mjs,ts,tsx,js,jsx}',
10
- '*.{mjs,ts,tsx,js,jsx}',
11
- ],
12
- extends: [tsconfig],
13
- },
14
- ])
@@ -1,5 +0,0 @@
1
- allowBuilds:
2
- '@google/genai': false
3
- protobufjs: false
4
- minimumReleaseAgeExclude:
5
- - typebox@1.3.9
package/tsconfig.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "outDir": "dist",
4
- "jsx": "react-jsx",
5
- "declaration": false,
6
- "allowJs": true,
7
- "lib": ["DOM", "ES2022"],
8
- "target": "ES2022",
9
- "module": "nodenext",
10
- "stripInternal": true,
11
- "resolveJsonModule": true,
12
- "moduleResolution": "nodenext",
13
- "esModuleInterop": true,
14
- "sourceMap": true,
15
- "strict": true,
16
- "allowImportingTsExtensions": true,
17
- "rewriteRelativeImportExtensions": true,
18
- "forceConsistentCasingInFileNames": true,
19
- "noUncheckedIndexedAccess": true,
20
- "verbatimModuleSyntax": true,
21
- "skipLibCheck": true
22
- },
23
- "include": ["src", "*.ts", "*.tsx", "*.js", "*.jsx", "*.mjs"]
24
- }
package/vitest.config.ts DELETED
@@ -1,8 +0,0 @@
1
- import { defineConfig } from 'vitest/config'
2
-
3
- export default defineConfig({
4
- test: {
5
- globals: false,
6
- include: ['src/**/*.test.ts'],
7
- },
8
- })