@diegopetrucci/pi-oracle 0.1.9 → 0.1.11
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 -0
- package/index.ts +16 -16
- package/package.json +10 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.78.0
|
package/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { existsSync } from "node:fs";
|
|
|
3
3
|
import * as fs from "node:fs/promises";
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
import { StringEnum } from "@earendil-works/pi-ai";
|
|
6
|
-
import { getAgentDir, getMarkdownTheme, type ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
6
|
+
import { getAgentDir, getMarkdownTheme, type ExtensionAPI, type ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
7
7
|
import { Container, Markdown, Spacer, Text } from "@earendil-works/pi-tui";
|
|
8
8
|
import { Type } from "typebox";
|
|
9
9
|
|
|
@@ -75,6 +75,7 @@ const ORACLE_CONFIG_FILE = "oracle.json";
|
|
|
75
75
|
|
|
76
76
|
const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
|
|
77
77
|
"amazon-bedrock": [
|
|
78
|
+
"claude-opus-4-8",
|
|
78
79
|
"claude-opus-4-7",
|
|
79
80
|
"claude-opus-4-6",
|
|
80
81
|
"claude-opus-4-5",
|
|
@@ -91,6 +92,8 @@ const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
|
|
|
91
92
|
"zai.glm-5",
|
|
92
93
|
],
|
|
93
94
|
anthropic: [
|
|
95
|
+
"claude-opus-4-8",
|
|
96
|
+
"claude-opus-4.8",
|
|
94
97
|
"claude-opus-4-7",
|
|
95
98
|
"claude-opus-4.7",
|
|
96
99
|
"claude-opus-4-6",
|
|
@@ -156,6 +159,7 @@ const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
|
|
|
156
159
|
"accounts/fireworks/models/gpt-oss-120b",
|
|
157
160
|
],
|
|
158
161
|
"github-copilot": [
|
|
162
|
+
"claude-opus-4.8",
|
|
159
163
|
"claude-opus-4.7",
|
|
160
164
|
"claude-opus-4.6",
|
|
161
165
|
"claude-opus-4.5",
|
|
@@ -257,6 +261,7 @@ const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
|
|
|
257
261
|
"gpt-5.5",
|
|
258
262
|
"gpt-5.4-pro",
|
|
259
263
|
"gpt-5.4",
|
|
264
|
+
"claude-opus-4-8",
|
|
260
265
|
"claude-opus-4-7",
|
|
261
266
|
"claude-opus-4-6",
|
|
262
267
|
"claude-opus-4-5",
|
|
@@ -284,6 +289,8 @@ const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
|
|
|
284
289
|
"kimi-k2.5",
|
|
285
290
|
],
|
|
286
291
|
openrouter: [
|
|
292
|
+
"anthropic/claude-opus-4.8",
|
|
293
|
+
"anthropic/claude-opus-4.8-fast",
|
|
287
294
|
"anthropic/claude-opus-4.7",
|
|
288
295
|
"anthropic/claude-opus-4.6-fast",
|
|
289
296
|
"anthropic/claude-opus-4.6",
|
|
@@ -320,6 +327,7 @@ const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
|
|
|
320
327
|
"MiniMaxAI/MiniMax-M2.5",
|
|
321
328
|
],
|
|
322
329
|
"vercel-ai-gateway": [
|
|
330
|
+
"anthropic/claude-opus-4.8",
|
|
323
331
|
"anthropic/claude-opus-4.7",
|
|
324
332
|
"anthropic/claude-opus-4.6",
|
|
325
333
|
"anthropic/claude-opus-4.5",
|
|
@@ -668,7 +676,7 @@ function appendThinkingLevelClampReason(
|
|
|
668
676
|
}
|
|
669
677
|
|
|
670
678
|
async function findAvailableModel(
|
|
671
|
-
ctx: { model?: PiModel; modelRegistry: { getAvailable(): Promise<PiModel[]> } },
|
|
679
|
+
ctx: { model?: PiModel; modelRegistry: { getAvailable(): PiModel[] | Promise<PiModel[]> } },
|
|
672
680
|
modelRef: string,
|
|
673
681
|
): Promise<PiModel | undefined> {
|
|
674
682
|
const available = await ctx.modelRegistry.getAvailable();
|
|
@@ -696,7 +704,7 @@ async function findAvailableModel(
|
|
|
696
704
|
}
|
|
697
705
|
|
|
698
706
|
async function selectOracleModel(
|
|
699
|
-
ctx: { model?: PiModel; modelRegistry: { getAvailable(): Promise<PiModel[]> } },
|
|
707
|
+
ctx: { model?: PiModel; modelRegistry: { getAvailable(): PiModel[] | Promise<PiModel[]> } },
|
|
700
708
|
thinkingLevelOverride?: ThinkingLevel,
|
|
701
709
|
): Promise<{ ok: true; selection: OracleSelection } | { ok: false; error: string }> {
|
|
702
710
|
const available = await ctx.modelRegistry.getAvailable();
|
|
@@ -752,14 +760,7 @@ async function selectOracleModel(
|
|
|
752
760
|
};
|
|
753
761
|
}
|
|
754
762
|
|
|
755
|
-
function updateOracleUi(ctx:
|
|
756
|
-
args: any,
|
|
757
|
-
ctx: infer T,
|
|
758
|
-
) => any
|
|
759
|
-
? T
|
|
760
|
-
: never,
|
|
761
|
-
activeRuns: Map<string, OracleUiRun>,
|
|
762
|
-
): void {
|
|
763
|
+
function updateOracleUi(ctx: ExtensionContext, activeRuns: Map<string, OracleUiRun>): void {
|
|
763
764
|
if (!ctx.hasUI) return;
|
|
764
765
|
const theme = ctx.ui.theme;
|
|
765
766
|
if (activeRuns.size === 0) {
|
|
@@ -1193,7 +1194,6 @@ export default function oracleExtension(pi: ExtensionAPI) {
|
|
|
1193
1194
|
durationMs: 0,
|
|
1194
1195
|
cwd: params.cwd ?? ctx.cwd,
|
|
1195
1196
|
},
|
|
1196
|
-
isError: true,
|
|
1197
1197
|
};
|
|
1198
1198
|
}
|
|
1199
1199
|
selection = selectionResult.selection;
|
|
@@ -1213,7 +1213,6 @@ export default function oracleExtension(pi: ExtensionAPI) {
|
|
|
1213
1213
|
return {
|
|
1214
1214
|
content: [{ type: "text", text: result.error }],
|
|
1215
1215
|
details: result.details,
|
|
1216
|
-
isError: true,
|
|
1217
1216
|
};
|
|
1218
1217
|
}
|
|
1219
1218
|
|
|
@@ -1244,7 +1243,8 @@ export default function oracleExtension(pi: ExtensionAPI) {
|
|
|
1244
1243
|
const body = result.content[0]?.type === "text" ? result.content[0].text : "(no output)";
|
|
1245
1244
|
if (!details) return new Text(body, 0, 0);
|
|
1246
1245
|
|
|
1247
|
-
const
|
|
1246
|
+
const isError = (details.exitCode ?? 0) !== 0;
|
|
1247
|
+
const icon = isError ? theme.fg("error", "✗") : theme.fg("success", "✓");
|
|
1248
1248
|
const header = `${icon} ${theme.fg("toolTitle", theme.bold("oracle "))}${theme.fg("accent", details.modelRef || "(auto)")}`;
|
|
1249
1249
|
const subheader = [
|
|
1250
1250
|
details.thinkingLevel !== "off" ? details.thinkingLevel : undefined,
|
|
@@ -1260,7 +1260,7 @@ export default function oracleExtension(pi: ExtensionAPI) {
|
|
|
1260
1260
|
if (subheader) text += `\n${theme.fg("dim", subheader)}`;
|
|
1261
1261
|
text += `\n\n${theme.fg("toolOutput", renderCollapsedText(body))}`;
|
|
1262
1262
|
if (usage) text += `\n\n${theme.fg("dim", usage)}`;
|
|
1263
|
-
if (
|
|
1263
|
+
if (isError && details.stderr) text += `\n${theme.fg("error", renderCollapsedText(details.stderr, 4))}`;
|
|
1264
1264
|
text += `\n${theme.fg("muted", "(Ctrl+O to expand)")}`;
|
|
1265
1265
|
return new Text(text, 0, 0);
|
|
1266
1266
|
}
|
|
@@ -1283,7 +1283,7 @@ export default function oracleExtension(pi: ExtensionAPI) {
|
|
|
1283
1283
|
container.addChild(new Spacer(1));
|
|
1284
1284
|
container.addChild(new Text(theme.fg("muted", "stderr"), 0, 0));
|
|
1285
1285
|
container.addChild(
|
|
1286
|
-
new Text(
|
|
1286
|
+
new Text(isError ? theme.fg("error", details.stderr) : theme.fg("dim", details.stderr), 0, 0),
|
|
1287
1287
|
);
|
|
1288
1288
|
}
|
|
1289
1289
|
return container;
|
package/package.json
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diegopetrucci/pi-oracle",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "An Amp-style oracle extension for pi that consults the strongest reasoning model on your current provider.",
|
|
5
|
-
"keywords": [
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pi-package",
|
|
7
|
+
"pi",
|
|
8
|
+
"oracle",
|
|
9
|
+
"reasoning",
|
|
10
|
+
"subagent"
|
|
11
|
+
],
|
|
6
12
|
"license": "MIT",
|
|
7
13
|
"repository": {
|
|
8
14
|
"type": "git",
|
|
@@ -11,7 +17,8 @@
|
|
|
11
17
|
},
|
|
12
18
|
"files": [
|
|
13
19
|
"index.ts",
|
|
14
|
-
"README.md"
|
|
20
|
+
"README.md",
|
|
21
|
+
".pi-fleet-tested-version"
|
|
15
22
|
],
|
|
16
23
|
"publishConfig": {
|
|
17
24
|
"access": "public"
|