@diegopetrucci/pi-contrarian 0.1.1 → 0.1.2
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/.pi-fleet-tested-version +1 -1
- package/index.ts +35 -3
- package/package.json +1 -1
package/.pi-fleet-tested-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.80.3
|
package/index.ts
CHANGED
|
@@ -72,7 +72,20 @@ const COLLAPSED_LINE_LIMIT = 8;
|
|
|
72
72
|
const CONTRARIAN_STATUS_ID = "contrarian";
|
|
73
73
|
const CONTRARIAN_WIDGET_ID = "contrarian";
|
|
74
74
|
const CONTRARIAN_CONFIG_FILE = "contrarian.json";
|
|
75
|
-
const CONTRARIAN_MODEL_PREFERENCES = [
|
|
75
|
+
const CONTRARIAN_MODEL_PREFERENCES = [
|
|
76
|
+
"gpt-5.5",
|
|
77
|
+
"claude-opus-4-8",
|
|
78
|
+
"claude-opus-4.8",
|
|
79
|
+
"claude-sonnet-5-0",
|
|
80
|
+
"claude-sonnet-5.0",
|
|
81
|
+
"claude-sonnet-5",
|
|
82
|
+
"claude-sonnet-4-6",
|
|
83
|
+
"claude-sonnet-4.6",
|
|
84
|
+
"claude-sonnet-4-5",
|
|
85
|
+
"claude-sonnet-4.5",
|
|
86
|
+
"claude-sonnet-4-0",
|
|
87
|
+
"claude-sonnet-4",
|
|
88
|
+
];
|
|
76
89
|
|
|
77
90
|
const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
|
|
78
91
|
"amazon-bedrock": [
|
|
@@ -83,6 +96,7 @@ const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
|
|
|
83
96
|
"claude-opus-4-5",
|
|
84
97
|
"claude-opus-4-1",
|
|
85
98
|
"claude-opus-4",
|
|
99
|
+
"claude-sonnet-5",
|
|
86
100
|
"claude-sonnet-4-6",
|
|
87
101
|
"claude-sonnet-4-5",
|
|
88
102
|
"claude-sonnet-4",
|
|
@@ -107,6 +121,9 @@ const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
|
|
|
107
121
|
"claude-opus-4.1",
|
|
108
122
|
"claude-opus-4-0",
|
|
109
123
|
"claude-opus-4",
|
|
124
|
+
"claude-sonnet-5-0",
|
|
125
|
+
"claude-sonnet-5.0",
|
|
126
|
+
"claude-sonnet-5",
|
|
110
127
|
"claude-sonnet-4-6",
|
|
111
128
|
"claude-sonnet-4.6",
|
|
112
129
|
"claude-sonnet-4-5",
|
|
@@ -185,6 +202,8 @@ const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
|
|
|
185
202
|
"gpt-5",
|
|
186
203
|
"gemini-3.1-pro-preview",
|
|
187
204
|
"gemini-3-pro-preview",
|
|
205
|
+
"claude-sonnet-5.0",
|
|
206
|
+
"claude-sonnet-5",
|
|
188
207
|
"claude-sonnet-4.6",
|
|
189
208
|
"claude-sonnet-4.5",
|
|
190
209
|
"gemini-2.5-pro",
|
|
@@ -360,6 +379,8 @@ const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
|
|
|
360
379
|
"anthropic/claude-opus-4.6",
|
|
361
380
|
"anthropic/claude-opus-4.5",
|
|
362
381
|
"anthropic/claude-opus-4.1",
|
|
382
|
+
"anthropic/claude-sonnet-5.0",
|
|
383
|
+
"anthropic/claude-sonnet-5",
|
|
363
384
|
"anthropic/claude-sonnet-4.6",
|
|
364
385
|
"openai/gpt-5.5-pro",
|
|
365
386
|
"openai/gpt-5.5",
|
|
@@ -1184,6 +1205,13 @@ function renderCollapsedText(text: string, lineLimit = COLLAPSED_LINE_LIMIT): st
|
|
|
1184
1205
|
return [...lines.slice(0, lineLimit), `... (${lines.length - lineLimit} more lines)`].join("\n");
|
|
1185
1206
|
}
|
|
1186
1207
|
|
|
1208
|
+
export const __test__ = {
|
|
1209
|
+
findAvailableModel,
|
|
1210
|
+
parseModelPreference,
|
|
1211
|
+
resolveThinkingLevel,
|
|
1212
|
+
selectContrarianModel,
|
|
1213
|
+
};
|
|
1214
|
+
|
|
1187
1215
|
export default function contrarianExtension(pi: ExtensionAPI) {
|
|
1188
1216
|
const activeRuns = new Map<string, ContrarianUiRun>();
|
|
1189
1217
|
let preferences: ContrarianPreferences = {};
|
|
@@ -1347,13 +1375,17 @@ export default function contrarianExtension(pi: ExtensionAPI) {
|
|
|
1347
1375
|
parameters: ContrarianParams,
|
|
1348
1376
|
|
|
1349
1377
|
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
1378
|
+
const rawTask = (params as { task?: unknown }).task;
|
|
1379
|
+
const task = typeof rawTask === "string" ? rawTask.trim() : "";
|
|
1380
|
+
if (!task) throw new Error("Invalid parameters: expected task to be a non-empty string.");
|
|
1381
|
+
|
|
1350
1382
|
const explicitModel = parseModelPreference(params.model);
|
|
1351
1383
|
const defaultModel = parseModelPreference(preferences.model);
|
|
1352
1384
|
const configuredModel = explicitModel.model ?? defaultModel.model;
|
|
1353
1385
|
const configuredThinkingLevel =
|
|
1354
1386
|
params.thinkingLevel ?? explicitModel.thinkingLevel ?? preferences.thinkingLevel ?? defaultModel.thinkingLevel;
|
|
1355
1387
|
const uiRun: ContrarianUiRun = {
|
|
1356
|
-
task
|
|
1388
|
+
task,
|
|
1357
1389
|
includeBash: params.includeBash ?? false,
|
|
1358
1390
|
startedAt: Date.now(),
|
|
1359
1391
|
};
|
|
@@ -1445,7 +1477,7 @@ export default function contrarianExtension(pi: ExtensionAPI) {
|
|
|
1445
1477
|
uiRun.selection = attempt;
|
|
1446
1478
|
updateContrarianUi(ctx, activeRuns);
|
|
1447
1479
|
|
|
1448
|
-
const result = await runContrarian(attempt, params, signal, handleUpdate, ctx.cwd);
|
|
1480
|
+
const result = await runContrarian(attempt, { ...params, task }, signal, handleUpdate, ctx.cwd);
|
|
1449
1481
|
if (result.ok) {
|
|
1450
1482
|
return {
|
|
1451
1483
|
content: [{ type: "text", text: result.output }],
|
package/package.json
CHANGED