@henryqw/pi-task-models 0.3.0 → 0.4.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/CONTEXT.md +1 -1
- package/README.md +7 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +24 -14
- package/package.json +1 -1
package/CONTEXT.md
CHANGED
|
@@ -5,7 +5,7 @@ Pi Task Models stores shared task profiles and task-to-profile assignments for H
|
|
|
5
5
|
## Language
|
|
6
6
|
|
|
7
7
|
**Task Profile**:
|
|
8
|
-
Named shared route set (`fast`, `balanced`, or `
|
|
8
|
+
Named shared route set (`fast`, `balanced`, `frontier`, or `fav`) with a required primary route and optional fallback route (`fav` has no fallback).
|
|
9
9
|
_Avoid_: package-owned model picker, per-extension model catalog
|
|
10
10
|
|
|
11
11
|
**Task Route**:
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `@henryqw/pi-task-models`
|
|
2
2
|
|
|
3
|
-
Shared `fast`, `balanced`, and `
|
|
3
|
+
Shared `fast`, `balanced`, `frontier`, and `fav` model profiles for HenryQW Pi extensions.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -14,6 +14,7 @@ pi install npm:@henryqw/pi-task-models
|
|
|
14
14
|
| --- | --- |
|
|
15
15
|
| `@henryqw/pi-auto-compact` | Consumer. Compaction defaults to the `fast` profile. |
|
|
16
16
|
| `@henryqw/pi-auto-dag` | Consumer. Implement uses `balanced`; review uses `frontier`. |
|
|
17
|
+
| `@henryqw/pi-herdr-btw` | Consumer. Side-thread launch uses the `fast` profile. |
|
|
17
18
|
| `@henryqw/pi-herdr-rename` | Consumer. Rename uses the `fast` profile. |
|
|
18
19
|
| `@henryqw/pi-subagent` | Consumer. Delegation defaults to `balanced`; caller may override it. |
|
|
19
20
|
| `@henryqw/pi-multi-codex` | Improves. Numbered Codex slots dedupe to one route. |
|
|
@@ -26,7 +27,7 @@ pi install npm:@henryqw/pi-task-models
|
|
|
26
27
|
|
|
27
28
|
Selecting a profile sets primary model, primary thinking, optional fallback model, then fallback thinking. One completed flow writes the whole profile. Selecting a task changes its assignment.
|
|
28
29
|
|
|
29
|
-
Menus and resolution use the current session's `ctx.scopedModels`, including pinned thinking. Empty scope uses Pi's full available model registry. Numbered Codex account aliases are deduplicated. Fallback choices exclude the selected primary. Hidden task assignments stay stored when a package is disabled.
|
|
30
|
+
Menus and resolution use the current session's `ctx.scopedModels`, including pinned thinking. Empty scope uses Pi's full available model registry. Numbered Codex account aliases are deduplicated. Fallback choices exclude the selected primary. Hidden task assignments stay stored when a package is disabled. BTW selects the first authenticated viable route before pane launch.
|
|
30
31
|
|
|
31
32
|
Package also exports config and route-resolution helpers for consumers.
|
|
32
33
|
|
|
@@ -46,9 +47,13 @@ Package also exports config and route-resolution helpers for consumers.
|
|
|
46
47
|
},
|
|
47
48
|
"frontier": {
|
|
48
49
|
"primary": { "model": "openai-codex/gpt-frontier", "thinkingLevel": "max" }
|
|
50
|
+
},
|
|
51
|
+
"fav": {
|
|
52
|
+
"primary": { "model": "openai-codex/gpt-favorite", "thinkingLevel": "high" }
|
|
49
53
|
}
|
|
50
54
|
},
|
|
51
55
|
"tasks": {
|
|
56
|
+
"pi-herdr-btw/btw": "fast",
|
|
52
57
|
"pi-herdr-rename/rename": "fast",
|
|
53
58
|
"pi-auto-compact/autoCompact": "fast",
|
|
54
59
|
"pi-subagent/delegateTask": "balanced",
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type ExtensionAPI, type ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
export declare const PROFILE_NAMES: readonly ["fast", "balanced", "frontier"];
|
|
2
|
+
export declare const PROFILE_NAMES: readonly ["fast", "balanced", "frontier", "fav"];
|
|
3
3
|
export type ProfileName = (typeof PROFILE_NAMES)[number];
|
|
4
4
|
export declare const THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
5
5
|
export type ThinkingLevel = (typeof THINKING_LEVELS)[number];
|
|
6
6
|
export declare const DEFAULT_TASK_ASSIGNMENTS: {
|
|
7
|
+
readonly "pi-herdr-btw/btw": "fast";
|
|
7
8
|
readonly "pi-herdr-rename/rename": "fast";
|
|
8
9
|
readonly "pi-auto-compact/autoCompact": "fast";
|
|
9
10
|
readonly "pi-subagent/delegateTask": "balanced";
|
package/dist/index.js
CHANGED
|
@@ -2,9 +2,10 @@ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
3
|
import { getSupportedThinkingLevels } from "@earendil-works/pi-ai";
|
|
4
4
|
import { getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
5
|
-
export const PROFILE_NAMES = ["fast", "balanced", "frontier"];
|
|
5
|
+
export const PROFILE_NAMES = ["fast", "balanced", "frontier", "fav"];
|
|
6
6
|
export const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
7
7
|
export const DEFAULT_TASK_ASSIGNMENTS = {
|
|
8
|
+
"pi-herdr-btw/btw": "fast",
|
|
8
9
|
"pi-herdr-rename/rename": "fast",
|
|
9
10
|
"pi-auto-compact/autoCompact": "fast",
|
|
10
11
|
"pi-subagent/delegateTask": "balanced",
|
|
@@ -82,6 +83,8 @@ function parseConfig(value) {
|
|
|
82
83
|
if (!isTaskProfile(profile))
|
|
83
84
|
throw new Error(`${name} profile is invalid.`);
|
|
84
85
|
const profileName = name;
|
|
86
|
+
if (profileName === "fav" && profile.fallback)
|
|
87
|
+
throw new Error("fav profile has no fallback.");
|
|
85
88
|
profiles[profileName] = {
|
|
86
89
|
primary: normalizeRoute(profile.primary),
|
|
87
90
|
...(profile.fallback ? { fallback: normalizeRoute(profile.fallback) } : {}),
|
|
@@ -113,6 +116,8 @@ export function readTaskModelsConfig(agentDir = getAgentDir()) {
|
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
118
|
export function writeTaskModelsConfig(config, agentDir = getAgentDir()) {
|
|
119
|
+
if (config.profiles.fav?.fallback)
|
|
120
|
+
throw new Error("fav profile has no fallback.");
|
|
116
121
|
const file = configPath(agentDir);
|
|
117
122
|
mkdirSync(dirname(file), { recursive: true });
|
|
118
123
|
writeFileSync(file, `${JSON.stringify(normalizeConfig(config), null, 2)}\n`);
|
|
@@ -303,19 +308,24 @@ export function createTaskModelsExtension(pi, options) {
|
|
|
303
308
|
const primary = await selectRoute(ctx, `Profile ${profile} primary`, models);
|
|
304
309
|
if (!primary)
|
|
305
310
|
return;
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
311
|
+
if (profile === "fav") {
|
|
312
|
+
config.profiles[profile] = { primary };
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
const fallbackModels = models.filter((model) => canonicalModelReference(model) !== primary.model);
|
|
316
|
+
const fallbackModel = await ctx.ui.select(`Profile ${profile} fallback`, [
|
|
317
|
+
"None",
|
|
318
|
+
...fallbackModels.map((model) => modelReference(model)),
|
|
319
|
+
]);
|
|
320
|
+
if (!fallbackModel)
|
|
321
|
+
return;
|
|
322
|
+
const fallback = fallbackModel === "None"
|
|
323
|
+
? undefined
|
|
324
|
+
: await selectThinkingLevel(ctx, `Profile ${profile} fallback`, fallbackModels, fallbackModel);
|
|
325
|
+
if (fallbackModel !== "None" && !fallback)
|
|
326
|
+
return;
|
|
327
|
+
config.profiles[profile] = { primary, ...(fallback ? { fallback } : {}) };
|
|
328
|
+
}
|
|
319
329
|
if (!save())
|
|
320
330
|
return;
|
|
321
331
|
ctx.ui.notify(`${profile} profile saved.`, "info");
|