@henryqw/pi-task-models 0.2.0 → 0.3.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/README.md +6 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +23 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ pi install npm:@henryqw/pi-task-models
|
|
|
13
13
|
| Package | Why |
|
|
14
14
|
| --- | --- |
|
|
15
15
|
| `@henryqw/pi-auto-compact` | Consumer. Compaction defaults to the `fast` profile. |
|
|
16
|
+
| `@henryqw/pi-auto-dag` | Consumer. Implement uses `balanced`; review uses `frontier`. |
|
|
16
17
|
| `@henryqw/pi-herdr-rename` | Consumer. Rename uses the `fast` profile. |
|
|
17
18
|
| `@henryqw/pi-subagent` | Consumer. Delegation defaults to `balanced`; caller may override it. |
|
|
18
19
|
| `@henryqw/pi-multi-codex` | Improves. Numbered Codex slots dedupe to one route. |
|
|
@@ -50,7 +51,9 @@ Package also exports config and route-resolution helpers for consumers.
|
|
|
50
51
|
"tasks": {
|
|
51
52
|
"pi-herdr-rename/rename": "fast",
|
|
52
53
|
"pi-auto-compact/autoCompact": "fast",
|
|
53
|
-
"pi-subagent/delegateTask": "balanced"
|
|
54
|
+
"pi-subagent/delegateTask": "balanced",
|
|
55
|
+
"pi-auto-dag/implement": "balanced",
|
|
56
|
+
"pi-auto-dag/review": "frontier"
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
59
|
```
|
|
@@ -59,6 +62,8 @@ Each configured profile needs one primary model and thinking level. Fallback is
|
|
|
59
62
|
|
|
60
63
|
Reads are strict. Malformed or unknown values fail visibly and never rewrite the file. Only explicit `/task-models` actions write config.
|
|
61
64
|
|
|
65
|
+
Consumers can call `resolveConfiguredTaskRoute(ctx, taskId)` to read strict shared config, choose usable primary or fallback route, and fail with `/task-models` guidance when assignment, profile, or route is unavailable.
|
|
66
|
+
|
|
62
67
|
## Remove
|
|
63
68
|
|
|
64
69
|
```bash
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export declare const DEFAULT_TASK_ASSIGNMENTS: {
|
|
|
7
7
|
readonly "pi-herdr-rename/rename": "fast";
|
|
8
8
|
readonly "pi-auto-compact/autoCompact": "fast";
|
|
9
9
|
readonly "pi-subagent/delegateTask": "balanced";
|
|
10
|
+
readonly "pi-auto-dag/implement": "balanced";
|
|
11
|
+
readonly "pi-auto-dag/review": "frontier";
|
|
10
12
|
};
|
|
11
13
|
export type TaskModelRoute = {
|
|
12
14
|
model: string;
|
|
@@ -46,6 +48,7 @@ export declare function supportedThinkingLevels(model: AvailableModel): Thinking
|
|
|
46
48
|
export declare function availableTaskModels(ctx: ExtensionContext): AvailableModel[];
|
|
47
49
|
export declare function taskThinkingLevels(ctx: ExtensionContext, model: AvailableModel): ThinkingLevel[];
|
|
48
50
|
export declare function resolveTaskModelRoute(ctx: ExtensionContext, route: TaskModelRoute): ResolvedTaskRoute | undefined;
|
|
51
|
+
export declare function resolveConfiguredTaskRoute(ctx: ExtensionContext, task: string, agentDir?: string): ResolvedTaskRoute;
|
|
49
52
|
export declare function orderedProfileRoutes(profile: TaskModelProfile): TaskModelRoute[];
|
|
50
53
|
export declare function activeTaskPackages(pi: Pick<ExtensionAPI, "getCommands" | "getAllTools">, tasks?: Readonly<Record<string, ProfileName>>): ActiveTaskPackage[];
|
|
51
54
|
export declare function createTaskModelsExtension(pi: ExtensionAPI, options?: {
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,8 @@ export const DEFAULT_TASK_ASSIGNMENTS = {
|
|
|
8
8
|
"pi-herdr-rename/rename": "fast",
|
|
9
9
|
"pi-auto-compact/autoCompact": "fast",
|
|
10
10
|
"pi-subagent/delegateTask": "balanced",
|
|
11
|
+
"pi-auto-dag/implement": "balanced",
|
|
12
|
+
"pi-auto-dag/review": "frontier",
|
|
11
13
|
};
|
|
12
14
|
const CODEX_ALIAS = /^openai-codex-(?:[2-9]|[1-9]\d+)$/;
|
|
13
15
|
const CONFIG_FILE = "pi-task-models.json";
|
|
@@ -190,6 +192,27 @@ export function resolveTaskModelRoute(ctx, route) {
|
|
|
190
192
|
? { model, thinkingLevel: route.thinkingLevel }
|
|
191
193
|
: undefined;
|
|
192
194
|
}
|
|
195
|
+
export function resolveConfiguredTaskRoute(ctx, task, agentDir = getAgentDir()) {
|
|
196
|
+
let config;
|
|
197
|
+
try {
|
|
198
|
+
config = readTaskModelsConfig(agentDir);
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
throw new Error("Couldn't read task model config. Run /task-models.");
|
|
202
|
+
}
|
|
203
|
+
const profileName = config.tasks[task];
|
|
204
|
+
if (!profileName)
|
|
205
|
+
throw new Error(`Task ${task} is not assigned to a profile. Run /task-models.`);
|
|
206
|
+
const profile = config.profiles[profileName];
|
|
207
|
+
if (!profile)
|
|
208
|
+
throw new Error(`Task ${task} profile ${profileName} is not configured. Run /task-models.`);
|
|
209
|
+
for (const route of orderedProfileRoutes(profile)) {
|
|
210
|
+
const resolved = resolveTaskModelRoute(ctx, route);
|
|
211
|
+
if (resolved)
|
|
212
|
+
return resolved;
|
|
213
|
+
}
|
|
214
|
+
throw new Error(`Task ${task} profile ${profileName} has no available route. Run /task-models.`);
|
|
215
|
+
}
|
|
193
216
|
export function orderedProfileRoutes(profile) {
|
|
194
217
|
return profile.fallback ? [profile.primary, profile.fallback] : [profile.primary];
|
|
195
218
|
}
|