@henryqw/pi-herdr-rename 4.1.2 → 5.0.0
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/extensions/rename.ts +11 -27
- package/package.json +6 -3
package/extensions/rename.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
} from "@earendil-works/pi-coding-agent";
|
|
6
6
|
import { createHerdrClient, withWorktreeLock } from "@henryqw/pi-herdr";
|
|
7
7
|
import {
|
|
8
|
+
executeTaskRoutes,
|
|
8
9
|
loadTaskModelsConfig,
|
|
9
10
|
registerModelTask,
|
|
10
11
|
resolveConfiguredTaskRoutes,
|
|
@@ -152,26 +153,9 @@ async function generateTitle(text: string, ctx: ExtensionContext, signal: AbortS
|
|
|
152
153
|
messages: [{ role: "user" as const, content: text.slice(0, MAX_CONTEXT_CHARS), timestamp: Date.now() }],
|
|
153
154
|
};
|
|
154
155
|
const complete = async (route: ResolvedTaskRoute) => {
|
|
155
|
-
let auth;
|
|
156
|
-
try {
|
|
157
|
-
auth = await ctx.modelRegistry.getApiKeyAndHeaders(route.model);
|
|
158
|
-
} catch (error) {
|
|
159
|
-
if (signal.aborted) throw error;
|
|
160
|
-
throw new RenameModelError("Couldn't authenticate rename task model.");
|
|
161
|
-
}
|
|
162
|
-
if (!auth.ok) throw new RenameModelError("Couldn't authenticate rename task model.");
|
|
163
|
-
|
|
164
|
-
const provider = ctx.modelRegistry.getProvider(route.model.provider);
|
|
165
|
-
if (!provider) throw new RenameModelError("Rename task model provider is unavailable.");
|
|
166
|
-
const model = auth.baseUrl ? { ...route.model, baseUrl: auth.baseUrl } : route.model;
|
|
167
|
-
|
|
168
156
|
let response;
|
|
169
157
|
try {
|
|
170
|
-
|
|
171
|
-
response = await provider.streamSimple(model, completionContext, {
|
|
172
|
-
apiKey: auth.apiKey,
|
|
173
|
-
headers: auth.headers,
|
|
174
|
-
env: auth.env,
|
|
158
|
+
response = await ctx.modelRegistry.streamSimple(route.model, completionContext, {
|
|
175
159
|
signal,
|
|
176
160
|
maxRetries: 0,
|
|
177
161
|
...(route.thinkingLevel === "off" ? {} : { reasoning: route.thinkingLevel }),
|
|
@@ -185,9 +169,9 @@ async function generateTitle(text: string, ctx: ExtensionContext, signal: AbortS
|
|
|
185
169
|
return response;
|
|
186
170
|
};
|
|
187
171
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
172
|
+
return executeTaskRoutes(
|
|
173
|
+
configuredRenameRoutes(ctx),
|
|
174
|
+
async (route) => {
|
|
191
175
|
const response = await complete(route);
|
|
192
176
|
const title = response.content
|
|
193
177
|
.filter((part) => part.type === "text")
|
|
@@ -199,12 +183,12 @@ async function generateTitle(text: string, ctx: ExtensionContext, signal: AbortS
|
|
|
199
183
|
const generated = parseGeneratedTitle(title);
|
|
200
184
|
if (!generated) throw new RenameModelError("Rename task model returned an invalid title.");
|
|
201
185
|
return generated;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
signal,
|
|
189
|
+
shouldFallback: (error) => error instanceof RenameModelError,
|
|
190
|
+
},
|
|
191
|
+
);
|
|
208
192
|
}
|
|
209
193
|
|
|
210
194
|
export default function herdrRenameExtension(pi: ExtensionAPI): void {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@henryqw/pi-herdr-rename",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Generate short Pi display titles and rename the current Herdr location.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"pack:check": "npm pack --dry-run"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
28
|
+
"@earendil-works/pi-coding-agent": "^0.86.0"
|
|
29
29
|
},
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
@@ -45,6 +45,9 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@henryqw/pi-herdr": "^0.4.1",
|
|
48
|
-
"@henryqw/pi-task-models": "^
|
|
48
|
+
"@henryqw/pi-task-models": "^7.0.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@earendil-works/pi-coding-agent": "0.86.0"
|
|
49
52
|
}
|
|
50
53
|
}
|