@mrclrchtr/supi-prompt-suggestions 2.0.1 → 2.0.3
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.
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type { Model } from "@earendil-works/pi-ai";
|
|
10
|
+
import type { Model } from "@earendil-works/pi-ai/compat";
|
|
11
11
|
import { type ExtensionContext, SettingsManager } from "@earendil-works/pi-coding-agent";
|
|
12
12
|
|
|
13
13
|
// ── Types ──────────────────────────────────────────────────────────────────
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrclrchtr/supi-prompt-suggestions",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Advisory ghost-text prompt suggestions for the pi coding agent",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@earendil-works/pi-ai": "*",
|
|
50
50
|
"@earendil-works/pi-coding-agent": "*",
|
|
51
51
|
"@earendil-works/pi-tui": "*",
|
|
52
|
-
"@mrclrchtr/supi-core": "2.0.
|
|
52
|
+
"@mrclrchtr/supi-core": "2.0.3"
|
|
53
53
|
},
|
|
54
54
|
"bundledDependencies": [
|
|
55
55
|
"@mrclrchtr/supi-core"
|
package/src/generation/client.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { completeSimple } from "@earendil-works/pi-ai";
|
|
10
|
+
import { completeSimple } from "@earendil-works/pi-ai/compat";
|
|
11
11
|
|
|
12
12
|
// ── Constants ──────────────────────────────────────────────────────────
|
|
13
13
|
|
|
@@ -114,7 +114,7 @@ export async function callSuggestionModel(
|
|
|
114
114
|
|
|
115
115
|
if (!textContent) {
|
|
116
116
|
const contentTypes = response.content.map((c: { type: string }) => c.type);
|
|
117
|
-
const message = `Suggestion model returned no text (content types: [${contentTypes.join(", ")}])`;
|
|
117
|
+
const message = `Suggestion model returned no text (stopReason: ${response.stopReason ?? "undefined"}, content types: [${contentTypes.join(", ") || "none"}])`;
|
|
118
118
|
return { ok: false, message };
|
|
119
119
|
}
|
|
120
120
|
|
|
@@ -124,7 +124,7 @@ export class SuggestionGenerator {
|
|
|
124
124
|
category: "generation.start",
|
|
125
125
|
message: "Prompt suggestion generation started",
|
|
126
126
|
cwd: ctx.cwd,
|
|
127
|
-
data: { tailLength: tail.length },
|
|
127
|
+
data: { modelId: opts.modelId, tailLength: tail.length },
|
|
128
128
|
});
|
|
129
129
|
|
|
130
130
|
try {
|
|
@@ -162,7 +162,7 @@ export class SuggestionGenerator {
|
|
|
162
162
|
signal: combinedSignal,
|
|
163
163
|
});
|
|
164
164
|
|
|
165
|
-
this.#handleResponse(response, id, ctx.cwd, callbacks);
|
|
165
|
+
this.#handleResponse(response, id, ctx.cwd, callbacks, opts.modelId);
|
|
166
166
|
} finally {
|
|
167
167
|
cleanupTimeout();
|
|
168
168
|
}
|
|
@@ -185,15 +185,25 @@ export class SuggestionGenerator {
|
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
+
// biome-ignore lint/complexity/useMaxParams: private method, params are orthogonal
|
|
188
189
|
#handleResponse(
|
|
189
190
|
response: SuggestionClientOutput,
|
|
190
191
|
id: number,
|
|
191
192
|
cwd: string,
|
|
192
193
|
callbacks: SuggestionCallbacks,
|
|
194
|
+
modelId: string,
|
|
193
195
|
): void {
|
|
194
196
|
if (id !== this.generationId) return;
|
|
195
197
|
|
|
196
198
|
if (!response.ok) {
|
|
199
|
+
recordDebugEvent({
|
|
200
|
+
source: "prompt-suggestions",
|
|
201
|
+
level: "warning",
|
|
202
|
+
category: "generation.model-error",
|
|
203
|
+
message: response.message,
|
|
204
|
+
cwd,
|
|
205
|
+
data: { modelId },
|
|
206
|
+
});
|
|
197
207
|
callbacks.onStatus({ kind: "error", message: response.message });
|
|
198
208
|
return;
|
|
199
209
|
}
|