@diegopetrucci/pi-oracle 0.1.9 → 0.1.10
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 +8 -16
- package/package.json +10 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.76.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
|
|
|
@@ -668,7 +668,7 @@ function appendThinkingLevelClampReason(
|
|
|
668
668
|
}
|
|
669
669
|
|
|
670
670
|
async function findAvailableModel(
|
|
671
|
-
ctx: { model?: PiModel; modelRegistry: { getAvailable(): Promise<PiModel[]> } },
|
|
671
|
+
ctx: { model?: PiModel; modelRegistry: { getAvailable(): PiModel[] | Promise<PiModel[]> } },
|
|
672
672
|
modelRef: string,
|
|
673
673
|
): Promise<PiModel | undefined> {
|
|
674
674
|
const available = await ctx.modelRegistry.getAvailable();
|
|
@@ -696,7 +696,7 @@ async function findAvailableModel(
|
|
|
696
696
|
}
|
|
697
697
|
|
|
698
698
|
async function selectOracleModel(
|
|
699
|
-
ctx: { model?: PiModel; modelRegistry: { getAvailable(): Promise<PiModel[]> } },
|
|
699
|
+
ctx: { model?: PiModel; modelRegistry: { getAvailable(): PiModel[] | Promise<PiModel[]> } },
|
|
700
700
|
thinkingLevelOverride?: ThinkingLevel,
|
|
701
701
|
): Promise<{ ok: true; selection: OracleSelection } | { ok: false; error: string }> {
|
|
702
702
|
const available = await ctx.modelRegistry.getAvailable();
|
|
@@ -752,14 +752,7 @@ async function selectOracleModel(
|
|
|
752
752
|
};
|
|
753
753
|
}
|
|
754
754
|
|
|
755
|
-
function updateOracleUi(ctx:
|
|
756
|
-
args: any,
|
|
757
|
-
ctx: infer T,
|
|
758
|
-
) => any
|
|
759
|
-
? T
|
|
760
|
-
: never,
|
|
761
|
-
activeRuns: Map<string, OracleUiRun>,
|
|
762
|
-
): void {
|
|
755
|
+
function updateOracleUi(ctx: ExtensionContext, activeRuns: Map<string, OracleUiRun>): void {
|
|
763
756
|
if (!ctx.hasUI) return;
|
|
764
757
|
const theme = ctx.ui.theme;
|
|
765
758
|
if (activeRuns.size === 0) {
|
|
@@ -1193,7 +1186,6 @@ export default function oracleExtension(pi: ExtensionAPI) {
|
|
|
1193
1186
|
durationMs: 0,
|
|
1194
1187
|
cwd: params.cwd ?? ctx.cwd,
|
|
1195
1188
|
},
|
|
1196
|
-
isError: true,
|
|
1197
1189
|
};
|
|
1198
1190
|
}
|
|
1199
1191
|
selection = selectionResult.selection;
|
|
@@ -1213,7 +1205,6 @@ export default function oracleExtension(pi: ExtensionAPI) {
|
|
|
1213
1205
|
return {
|
|
1214
1206
|
content: [{ type: "text", text: result.error }],
|
|
1215
1207
|
details: result.details,
|
|
1216
|
-
isError: true,
|
|
1217
1208
|
};
|
|
1218
1209
|
}
|
|
1219
1210
|
|
|
@@ -1244,7 +1235,8 @@ export default function oracleExtension(pi: ExtensionAPI) {
|
|
|
1244
1235
|
const body = result.content[0]?.type === "text" ? result.content[0].text : "(no output)";
|
|
1245
1236
|
if (!details) return new Text(body, 0, 0);
|
|
1246
1237
|
|
|
1247
|
-
const
|
|
1238
|
+
const isError = (details.exitCode ?? 0) !== 0;
|
|
1239
|
+
const icon = isError ? theme.fg("error", "✗") : theme.fg("success", "✓");
|
|
1248
1240
|
const header = `${icon} ${theme.fg("toolTitle", theme.bold("oracle "))}${theme.fg("accent", details.modelRef || "(auto)")}`;
|
|
1249
1241
|
const subheader = [
|
|
1250
1242
|
details.thinkingLevel !== "off" ? details.thinkingLevel : undefined,
|
|
@@ -1260,7 +1252,7 @@ export default function oracleExtension(pi: ExtensionAPI) {
|
|
|
1260
1252
|
if (subheader) text += `\n${theme.fg("dim", subheader)}`;
|
|
1261
1253
|
text += `\n\n${theme.fg("toolOutput", renderCollapsedText(body))}`;
|
|
1262
1254
|
if (usage) text += `\n\n${theme.fg("dim", usage)}`;
|
|
1263
|
-
if (
|
|
1255
|
+
if (isError && details.stderr) text += `\n${theme.fg("error", renderCollapsedText(details.stderr, 4))}`;
|
|
1264
1256
|
text += `\n${theme.fg("muted", "(Ctrl+O to expand)")}`;
|
|
1265
1257
|
return new Text(text, 0, 0);
|
|
1266
1258
|
}
|
|
@@ -1283,7 +1275,7 @@ export default function oracleExtension(pi: ExtensionAPI) {
|
|
|
1283
1275
|
container.addChild(new Spacer(1));
|
|
1284
1276
|
container.addChild(new Text(theme.fg("muted", "stderr"), 0, 0));
|
|
1285
1277
|
container.addChild(
|
|
1286
|
-
new Text(
|
|
1278
|
+
new Text(isError ? theme.fg("error", details.stderr) : theme.fg("dim", details.stderr), 0, 0),
|
|
1287
1279
|
);
|
|
1288
1280
|
}
|
|
1289
1281
|
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.10",
|
|
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"
|