pi-brainstorm 0.3.1 → 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/README.md CHANGED
@@ -10,7 +10,7 @@ The plugin stores each participant's full contribution in a local meeting blackb
10
10
 
11
11
  ## Features
12
12
 
13
- - Multi-model brainstorming with configurable participants (default: GPT, DeepSeek, MiniMax).
13
+ - Multi-model brainstorming with configurable participants (default: GPT, DeepSeek, MiniMax, GLM).
14
14
  - Debate / battle mode where agents prosecute, stress-test, and challenge positions.
15
15
  - Configuration-driven: add, remove, or customize participants via YAML.
16
16
  - Round-by-round summaries focused on consensus, disagreement, and next questions.
@@ -21,7 +21,13 @@ The plugin stores each participant's full contribution in a local meeting blackb
21
21
 
22
22
  ## Install
23
23
 
24
- From npm:
24
+ Recommended one-line install:
25
+
26
+ ```bash
27
+ pi install npm:@narumitw/pi-subagents && pi install npm:pi-brainstorm
28
+ ```
29
+
30
+ Install only this package from npm:
25
31
 
26
32
  ```bash
27
33
  pi install npm:pi-brainstorm
@@ -30,7 +36,7 @@ pi install npm:pi-brainstorm
30
36
  From GitHub:
31
37
 
32
38
  ```bash
33
- pi install git:github.com/Jarcis-cy/pi-brainstorm@v0.3.1
39
+ pi install git:github.com/Jarcis-cy/pi-brainstorm@v0.4.1
34
40
  ```
35
41
 
36
42
  For local development:
@@ -39,6 +45,26 @@ For local development:
39
45
  pi install /Users/jarcis/Project/pi-brainstorm
40
46
  ```
41
47
 
48
+ ## Prerequisites
49
+
50
+ `pi-brainstorm` orchestrates participants through Pi's `subagent` tool. Install the `subagent` tool separately before using `/brainstorm` or `/debate`:
51
+
52
+ ```bash
53
+ pi install npm:@narumitw/pi-subagents
54
+ ```
55
+
56
+ `@narumitw/pi-subagents` registers the `subagent` tool used by this package to run participant agents in isolated Pi subprocesses. It is a runtime prerequisite, not bundled inside `pi-brainstorm`.
57
+
58
+ For reference, Pi's coding-agent distribution also includes an example implementation at:
59
+
60
+ ```text
61
+ /opt/homebrew/lib/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/
62
+ ```
63
+
64
+ `pi-brainstorm` also needs participant agents such as `gpt-brainstormer`, `deepseek-brainstormer`, `minimax-brainstormer`, and `glm-brainstormer`. On first use, the extension can create or update managed user-level agent files from its YAML configuration. Existing unmanaged agent files are left untouched.
65
+
66
+ `@narumitw/pi-subagents` applies a hard subprocess timeout. If `timeoutMs` is not set, it uses `PI_SUBAGENT_TIMEOUT_MS`, or `600000` milliseconds (10 minutes) when that environment variable is unset. Long participant output is not itself a timeout condition, but generating very long output can take longer and may hit that wall-clock timeout. Participant full text is written to `.pi-meetings/...`; the main chat should only receive short `WROTE_ENTRY` summaries and facilitator synthesis.
67
+
42
68
  ## Configuration
43
69
 
44
70
  Participants are defined in YAML. The extension loads config in this order (later overrides earlier):
package/README.zh-CN.md CHANGED
@@ -10,7 +10,7 @@ English README: [README.md](./README.md).
10
10
 
11
11
  ## 功能
12
12
 
13
- - 多模型头脑风暴:参与者可配置(默认:GPT、DeepSeek、MiniMax)。
13
+ - 多模型头脑风暴:参与者可配置(默认:GPT、DeepSeek、MiniMax、GLM)。
14
14
  - 辩论 / battle 模式:Agent 会攻击、审视、反驳彼此的观点。
15
15
  - 配置驱动:通过 YAML 添加、删除或自定义参与者。
16
16
  - 每轮输出聚焦共识、分歧、关键问题和下一步方向。
@@ -21,7 +21,13 @@ English README: [README.md](./README.md).
21
21
 
22
22
  ## 安装
23
23
 
24
- 通过 npm 安装:
24
+ 推荐一行安装:
25
+
26
+ ```bash
27
+ pi install npm:@narumitw/pi-subagents && pi install npm:pi-brainstorm
28
+ ```
29
+
30
+ 只安装本包:
25
31
 
26
32
  ```bash
27
33
  pi install npm:pi-brainstorm
@@ -30,7 +36,7 @@ pi install npm:pi-brainstorm
30
36
  通过 GitHub 安装:
31
37
 
32
38
  ```bash
33
- pi install git:github.com/Jarcis-cy/pi-brainstorm@v0.3.1
39
+ pi install git:github.com/Jarcis-cy/pi-brainstorm@v0.4.1
34
40
  ```
35
41
 
36
42
  本地开发安装:
@@ -83,10 +89,26 @@ participants:
83
89
 
84
90
  ## 前置条件
85
91
 
86
- 该扩展依赖 pi 中已有的 `subagent` 工具。命令处理器会先创建本地会议记录,然后让主 Agent 调用配置中定义的参与者(默认:`gpt-brainstormer`、`deepseek-brainstormer`、`minimax-brainstormer`)。
92
+ `pi-brainstorm` 通过 Pi 的 `subagent` 工具来调用各个参与者。使用 `/brainstorm` 或 `/debate` 前,请先单独安装提供 `subagent` 工具的包:
93
+
94
+ ```bash
95
+ pi install npm:@narumitw/pi-subagents
96
+ ```
97
+
98
+ `@narumitw/pi-subagents` 会注册 `subagent` 工具,让 `pi-brainstorm` 能把参与者作为隔离的 Pi 子进程运行。它是运行时前置条件,不随 `pi-brainstorm` 打包。
99
+
100
+ 作为参考,Pi coding-agent 发行包中也包含一个 example implementation,通常位于:
101
+
102
+ ```text
103
+ /opt/homebrew/lib/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/
104
+ ```
105
+
106
+ 命令处理器会先创建本地会议记录,然后让主 Agent 通过 `subagent` 调用配置中定义的参与者(默认:`gpt-brainstormer`、`deepseek-brainstormer`、`minimax-brainstormer`、`glm-brainstormer`)。
87
107
 
88
108
  第一次使用时,如果这些用户级 agent 不存在,扩展会询问是否写入内置默认定义。已有同名且不含托管标记的文件不会被覆盖。
89
109
 
110
+ `@narumitw/pi-subagents` 对每个子进程有 hard timeout。未设置 `timeoutMs` 时,会使用环境变量 `PI_SUBAGENT_TIMEOUT_MS`;如果环境变量也没设置,默认是 `600000` 毫秒(10 分钟)。子 agent 输出很长本身不会被判定为 timeout,但生成超长输出会增加运行时间,如果超过这个 wall-clock timeout,就会被 `subagent` 工具标记为超时。参与者全文应写入 `.pi-meetings/...`,主会话只应看到短的 `WROTE_ENTRY` 摘要和主持人综合。
111
+
90
112
  ## 命令
91
113
 
92
114
  ```text
@@ -26,7 +26,7 @@ participants:
26
26
  - displayName: DeepSeek
27
27
  agentName: deepseek-brainstormer
28
28
  description: DeepSeek brainstorming consultant. Meticulous systems thinker for multi-model discussion sessions.
29
- model: deepseek/deepseek-v4-pro:xhigh
29
+ model: opencode-go/deepseek-v4-pro:xhigh
30
30
  roleTitle: Meticulous Systems Thinker
31
31
  rolePrompt: |
32
32
  你是多模型头脑风暴中的系统思考者。分析结构、依赖、扩展上限和失败模式。用中文回答。
@@ -56,3 +56,21 @@ participants:
56
56
  prompt: |
57
57
  DEBATE MODE. You are THE CONTRARIAN. Take the opposite position from the dominant view. Expose groupthink. Propose radical alternatives. Challenge the fundamental premise if needed. Use Chinese.
58
58
  brainstormRole: Creative lateral thinker
59
+
60
+ - displayName: GLM
61
+ agentName: glm-brainstormer
62
+ description: GLM-5.2 brainstorming consultant. Pragmatic implementer who grounds ideas in feasibility, cost, and real-world constraints.
63
+ model: opencode-go/glm-5.2:xhigh
64
+ roleTitle: Pragmatic Implementer
65
+ rolePrompt: |
66
+ 你是多模型头脑风暴中的务实执行者。当别人谈愿景、讲架构、玩创意时,你负责问:「这到底能不能做出来?」「需要多少资源?」「有什么更简单的方案?」你的价值在于把讨论拉回现实。用中文回答。
67
+ whatYouDo:
68
+ - 从可行性、成本、时间和资源角度审视每个提案
69
+ - 指出不切实际的想法——诚实、直接
70
+ - 提出更简单的替代方案,避免过度设计
71
+ - 关注执行路径和最小可行版本
72
+ debatePersona:
73
+ label: THE PRAGMATIST
74
+ prompt: |
75
+ DEBATE MODE. You are THE PRAGMATIST. Challenge every proposal on feasibility, cost, and real-world constraints. Expose impractical ideas. Push for simpler, cheaper, faster solutions. Use Chinese.
76
+ brainstormRole: Pragmatic implementer
@@ -546,6 +546,36 @@ function buildBrainstormPrompt(
546
546
  "",
547
547
  "After Round 3, present the complete structural overview and ask whether to write the final conclusion. Only write conclusion.md after the user confirms.",
548
548
  "",
549
+ "## FAILURE HANDLING",
550
+ "Subagent calls can fail (timeout, API error, model unavailable, crash). You MUST detect and handle failures:",
551
+ "",
552
+ "### Detecting failure",
553
+ "A subagent call has FAILED if:",
554
+ "- The tool result contains error text (\"error\", \"failed\", \"timeout\", \"unavailable\", \"connection\", etc.)",
555
+ "- The subagent returns no output or empty output",
556
+ "- The subagent output does NOT contain \"WROTE_ENTRY:\" (the expected success marker)",
557
+ "- The subagent produced no meeting_append_entry call (check with meeting_read_index after the parallel batch)",
558
+ "",
559
+ "### Retry strategy",
560
+ "When you detect a failure:",
561
+ "1. Wait 5-10 seconds before retrying (API rate limits may have triggered the failure)",
562
+ "2. Retry the SAME consultant with the SAME task up to 2 more times (3 attempts total)",
563
+ "3. On retry, add to the task: \"PREVIOUS ATTEMPT FAILED. This is retry N of 2. Focus only on completing your contribution and writing WROTE_ENTRY.\"",
564
+ "4. If the consultant succeeds on retry, proceed normally",
565
+ "5. If ALL retries are exhausted, treat this consultant as UNAVAILABLE for this round",
566
+ "",
567
+ "### When a consultant is UNAVAILABLE",
568
+ "- Do NOT wait indefinitely or freeze the session",
569
+ "- Proceed with the remaining consultants who succeeded",
570
+ "- In your structural overview, clearly mark the failed participant as: \"[displayName] ([agentName]): 本轮未响应 / did not respond\"",
571
+ "- Continue to the next round normally — do NOT skip the consultant in future rounds (they may recover)",
572
+ "- If the same consultant fails in 2 consecutive rounds, warn the user with the real display name, e.g.: \"DeepSeek 连续两轮失败,建议检查该模型是否可用\"",
573
+ "",
574
+ "### NEVER do this",
575
+ "- Do NOT fabricate or simulate a consultant's response",
576
+ "- Do NOT impose an extra manual timeout beyond the subagent tool's timeout; if the tool reports timeout, treat that attempt as failed",
577
+ "- Do NOT abort the entire session because one consultant failed",
578
+ "",
549
579
  "## IMPORTANT",
550
580
  "- All responses in Chinese (中文).",
551
581
  "- Save transcript.md and (after user confirms) conclusion.md per the MEETING OUTPUT PROTOCOL.",
@@ -634,6 +664,37 @@ function buildDebatePrompt(
634
664
  "- If NOT converged: run another cycle. Keep going.",
635
665
  "- If converged: present synthesis to me.",
636
666
  "",
667
+ "## FAILURE HANDLING",
668
+ "Subagent calls can fail (timeout, API error, model unavailable, crash). You MUST detect and handle failures:",
669
+ "",
670
+ "### Detecting failure",
671
+ "A subagent call has FAILED if:",
672
+ "- The tool result contains error text (\"error\", \"failed\", \"timeout\", \"unavailable\", \"connection\", etc.)",
673
+ "- The subagent returns no output or empty output",
674
+ "- The subagent output does NOT contain \"WROTE_ENTRY:\" (the expected success marker)",
675
+ "- The subagent produced no meeting_append_entry call (check with meeting_read_index after the chain step)",
676
+ "",
677
+ "### Retry strategy",
678
+ "When you detect a failure in a chain step:",
679
+ "1. Wait 5-10 seconds before retrying (API rate limits may have triggered the failure)",
680
+ "2. Retry the SAME debater with the SAME task up to 2 more times (3 attempts total)",
681
+ "3. On retry, add to the task: \"PREVIOUS ATTEMPT FAILED. This is retry N of 2. Focus only on completing your argument and writing WROTE_ENTRY.\"",
682
+ "4. If the debater succeeds on retry, proceed to the next debater in the chain",
683
+ "5. If ALL retries are exhausted, SKIP this debater for this cycle and move to the next debater",
684
+ "",
685
+ "### When a debater is UNAVAILABLE",
686
+ "- Do NOT wait indefinitely or freeze the session",
687
+ "- Skip to the next debater in the cycle",
688
+ "- In your structural overview, clearly mark the failed participant as: \"[displayName] ([agentName]): 本轮未响应 / did not respond\"",
689
+ "- Continue the debate with remaining debaters — do NOT abort the whole debate",
690
+ "- If the same debater fails in 2 consecutive cycles, warn the user with the real display name, e.g.: \"DeepSeek 连续两轮失败,建议检查该模型是否可用\"",
691
+ "",
692
+ "### NEVER do this",
693
+ "- Do NOT fabricate or simulate a debater's argument",
694
+ "- Do NOT impose an extra manual timeout beyond the subagent tool's timeout; if the tool reports timeout, treat that attempt as failed",
695
+ "- Do NOT abort the entire debate because one debater failed",
696
+ "- Do NOT get stuck in an infinite retry loop — 3 attempts max per debater per cycle",
697
+ "",
637
698
  "## Rules",
638
699
  "- NEVER stop at a predetermined count. Only convergence or user intervention ends this debate.",
639
700
  "- All responses in Chinese (中文).",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-brainstorm",
3
- "version": "0.3.1",
3
+ "version": "0.4.1",
4
4
  "description": "Multi-model brainstorming and debate sessions for pi subagents.",
5
5
  "type": "module",
6
6
  "keywords": [