oh-pi 0.1.39 → 0.1.40
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/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
|
};
|