oh-pi 0.1.39 → 0.1.41
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.fr.md +23 -0
- package/README.md +23 -0
- package/README.zh.md +23 -0
- package/package.json +1 -1
- package/pi-package/extensions/ant-colony/index.ts +24 -2
package/README.fr.md
CHANGED
|
@@ -123,6 +123,29 @@ Arrêt forcé → À maxTurns+1 : SIGTERM → SIGKILL si nécessaire
|
|
|
123
123
|
|
|
124
124
|
Éclaireuse : 8 tours · Ouvrière : 15 tours · Soldat : 8 tours
|
|
125
125
|
|
|
126
|
+
### Sélection des modèles
|
|
127
|
+
|
|
128
|
+
La colonie détecte automatiquement les modèles disponibles et laisse le LLM choisir le meilleur par rôle :
|
|
129
|
+
|
|
130
|
+
| Rôle | Stratégie | Exemple |
|
|
131
|
+
|------|-----------|---------|
|
|
132
|
+
| Éclaireuse | Rapide & économique — lecture seule | `claude-haiku-4-5`, `gpt-4o-mini` |
|
|
133
|
+
| Ouvrière | Capable — modifie le code | `claude-sonnet-4-0`, `gpt-4o` |
|
|
134
|
+
| Soldat | Même que ouvrière ou légèrement moins cher | `claude-sonnet-4-0` |
|
|
135
|
+
|
|
136
|
+
Remplacement manuel si nécessaire :
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
ant_colony({
|
|
140
|
+
goal: "Migrer vers ESM",
|
|
141
|
+
scoutModel: "claude-haiku-4-5",
|
|
142
|
+
workerModel: "claude-sonnet-4-0",
|
|
143
|
+
soldierModel: "claude-sonnet-4-0"
|
|
144
|
+
})
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Omettez les trois pour utiliser le modèle de session actuel pour chaque fourmi.
|
|
148
|
+
|
|
126
149
|
### Rapport de coûts
|
|
127
150
|
|
|
128
151
|
La colonie suit le coût par fourmi et le total, rapporté dans le résumé final. **Le coût n'interrompt jamais l'exécution** — les limites de tours et le contrôle de concurrence gèrent les ressources.
|
package/README.md
CHANGED
|
@@ -123,6 +123,29 @@ Hard kill → At maxTurns+1: SIGTERM → SIGKILL if needed
|
|
|
123
123
|
|
|
124
124
|
Scout: 8 turns · Worker: 15 turns · Soldier: 8 turns
|
|
125
125
|
|
|
126
|
+
### Model Selection
|
|
127
|
+
|
|
128
|
+
The colony auto-detects available models and lets the LLM pick the best fit per role:
|
|
129
|
+
|
|
130
|
+
| Role | Strategy | Example |
|
|
131
|
+
|------|----------|---------|
|
|
132
|
+
| Scout | Fast & cheap — only reads, no edits | `claude-haiku-4-5`, `gpt-4o-mini` |
|
|
133
|
+
| Worker | Capable — makes code changes | `claude-sonnet-4-0`, `gpt-4o` |
|
|
134
|
+
| Soldier | Same as worker or slightly cheaper | `claude-sonnet-4-0` |
|
|
135
|
+
|
|
136
|
+
Override manually if needed:
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
ant_colony({
|
|
140
|
+
goal: "Migrate to ESM",
|
|
141
|
+
scoutModel: "claude-haiku-4-5",
|
|
142
|
+
workerModel: "claude-sonnet-4-0",
|
|
143
|
+
soldierModel: "claude-sonnet-4-0"
|
|
144
|
+
})
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Omit all three to use the current session model for every ant.
|
|
148
|
+
|
|
126
149
|
### Cost Reporting
|
|
127
150
|
|
|
128
151
|
The colony tracks cost per ant and total spend, reported in the final summary. **Cost never interrupts execution** — turn limits and concurrency control handle resource management.
|
package/README.zh.md
CHANGED
|
@@ -123,6 +123,29 @@ oh-pi:
|
|
|
123
123
|
|
|
124
124
|
侦察蚁:8 轮 · 工蚁:15 轮 · 兵蚁:8 轮
|
|
125
125
|
|
|
126
|
+
### 模型选择
|
|
127
|
+
|
|
128
|
+
蚁群自动检测可用模型,让 LLM 按角色选择最优模型:
|
|
129
|
+
|
|
130
|
+
| 角色 | 策略 | 示例 |
|
|
131
|
+
|------|------|------|
|
|
132
|
+
| 侦察蚁 | 快速便宜 — 只读不改 | `claude-haiku-4-5`, `gpt-4o-mini` |
|
|
133
|
+
| 工蚁 | 能力强 — 执行代码修改 | `claude-sonnet-4-0`, `gpt-4o` |
|
|
134
|
+
| 兵蚁 | 与工蚁相同或稍便宜 | `claude-sonnet-4-0` |
|
|
135
|
+
|
|
136
|
+
手动覆盖:
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
ant_colony({
|
|
140
|
+
goal: "迁移到 ESM",
|
|
141
|
+
scoutModel: "claude-haiku-4-5",
|
|
142
|
+
workerModel: "claude-sonnet-4-0",
|
|
143
|
+
soldierModel: "claude-sonnet-4-0"
|
|
144
|
+
})
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
不指定则默认使用当前会话模型。
|
|
148
|
+
|
|
126
149
|
### 成本报告
|
|
127
150
|
|
|
128
151
|
蚁群追踪每只蚂蚁和总花费,在最终报告中汇总。**成本不会中断执行** —— 轮次限制和并发控制负责资源管理。
|
package/package.json
CHANGED
|
@@ -79,7 +79,19 @@ function phasePipeline(status: string, theme: any): string {
|
|
|
79
79
|
export default function antColonyExtension(pi: ExtensionAPI) {
|
|
80
80
|
|
|
81
81
|
// ═══ Auto-trigger: 注入蚁群意识,LLM 自动判断何时启动 ═══
|
|
82
|
-
pi.on("before_agent_start", async () => {
|
|
82
|
+
pi.on("before_agent_start", async (ctx) => {
|
|
83
|
+
// 获取可用模型列表
|
|
84
|
+
let modelList = "";
|
|
85
|
+
try {
|
|
86
|
+
const { execSync } = await import("node:child_process");
|
|
87
|
+
const output = execSync("pi --list-models 2>/dev/null", { encoding: "utf-8", timeout: 5000 });
|
|
88
|
+
const models = output.trim().split("\n").slice(1) // skip header
|
|
89
|
+
.map(l => l.trim().split(/\s+/))
|
|
90
|
+
.filter(p => p.length >= 2)
|
|
91
|
+
.map(p => `${p[0]}/${p[1]}`);
|
|
92
|
+
if (models.length > 0) modelList = models.join(", ");
|
|
93
|
+
} catch { /* ignore */ }
|
|
94
|
+
|
|
83
95
|
return {
|
|
84
96
|
message: {
|
|
85
97
|
customType: "ant-colony-context",
|
|
@@ -90,7 +102,17 @@ You have the ant_colony tool. Use it automatically when:
|
|
|
90
102
|
- Task is complex enough that serial execution is inefficient
|
|
91
103
|
|
|
92
104
|
Do NOT ask for confirmation. Call ant_colony directly with a clear goal.
|
|
93
|
-
For simple single-file tasks, work directly without the colony
|
|
105
|
+
For simple single-file tasks, work directly without the colony.
|
|
106
|
+
${modelList ? `
|
|
107
|
+
[COLONY MODEL SELECTION]
|
|
108
|
+
Available models: ${modelList}
|
|
109
|
+
|
|
110
|
+
Strategy for choosing per-caste models:
|
|
111
|
+
- scoutModel: Use a fast/cheap model (e.g. haiku, flash, gpt-4o-mini). Scouts only read, no edits.
|
|
112
|
+
- workerModel: Use a capable model (e.g. sonnet, opus, gpt-4o). Workers make code changes.
|
|
113
|
+
- soldierModel: Use same as worker or slightly cheaper. Soldiers review but don't edit.
|
|
114
|
+
- If unsure, omit all three — defaults to current session model.
|
|
115
|
+
- Prefer latest model versions for best quality.` : ""}`,
|
|
94
116
|
display: false,
|
|
95
117
|
},
|
|
96
118
|
};
|