@henryqw/pi-task-models 1.0.0 → 1.0.1

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/dist/index.d.ts CHANGED
@@ -45,7 +45,6 @@ export declare function modelReference(model: {
45
45
  }): string;
46
46
  export declare function dedupeAvailableModels(models: readonly AvailableModel[], preferredProvider?: string): AvailableModel[];
47
47
  export declare function resolveAvailableModel(models: readonly AvailableModel[], reference: string, preferredProvider?: string): AvailableModel | undefined;
48
- export declare function supportedThinkingLevels(model: AvailableModel): ThinkingLevel[];
49
48
  export declare function availableTaskModels(ctx: ExtensionContext): AvailableModel[];
50
49
  export declare function taskThinkingLevels(ctx: ExtensionContext, model: AvailableModel): ThinkingLevel[];
51
50
  export declare function resolveTaskModelRoute(ctx: ExtensionContext, route: TaskModelRoute, agentDir?: string, thinking?: ThinkingLevel): ResolvedTaskRoute | undefined;
package/dist/index.js CHANGED
@@ -14,7 +14,6 @@ export const DEFAULT_TASK_ASSIGNMENTS = {
14
14
  };
15
15
  const CODEX_ALIAS = /^openai-codex-(?:[2-9]|[1-9]\d+)$/;
16
16
  const CONFIG_FILE = "pi-task-models.json";
17
- const defaultTaskAssignments = () => ({ ...DEFAULT_TASK_ASSIGNMENTS });
18
17
  export const configPath = (agentDir = getAgentDir()) => join(agentDir, "config", CONFIG_FILE);
19
18
  function isCodexProvider(provider) {
20
19
  return provider === "openai-codex" || Boolean(provider && CODEX_ALIAS.test(provider));
@@ -72,7 +71,7 @@ function parseConfig(value) {
72
71
  if (!hasOnlyKeys(record, ["profiles", "tasks"]))
73
72
  throw new Error("Config contains unknown settings.");
74
73
  const profiles = {};
75
- const tasks = defaultTaskAssignments();
74
+ const tasks = { ...DEFAULT_TASK_ASSIGNMENTS };
76
75
  if (record.profiles !== undefined) {
77
76
  if (!record.profiles || typeof record.profiles !== "object" || Array.isArray(record.profiles)) {
78
77
  throw new Error("profiles must be an object.");
@@ -110,7 +109,7 @@ export function readTaskModelsConfig(agentDir = getAgentDir()) {
110
109
  }
111
110
  catch (error) {
112
111
  if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
113
- return { profiles: {}, tasks: defaultTaskAssignments() };
112
+ return { profiles: {}, tasks: { ...DEFAULT_TASK_ASSIGNMENTS } };
114
113
  }
115
114
  throw error;
116
115
  }
@@ -176,16 +175,13 @@ export function resolveAvailableModel(models, reference, preferredProvider) {
176
175
  ?? models.find((model) => CODEX_ALIAS.test(model.provider) && model.id === id)
177
176
  ?? models.find((model) => model.provider === "openai-codex" && model.id === id);
178
177
  }
179
- export function supportedThinkingLevels(model) {
180
- return getSupportedThinkingLevels(model);
181
- }
182
178
  export function availableTaskModels(ctx) {
183
179
  const scopedModels = ctx.scopedModels ?? [];
184
180
  return dedupeAvailableModels((scopedModels.length ? scopedModels.map(({ model }) => model) : ctx.modelRegistry.getAvailable())
185
181
  .filter((model) => model.input.includes("text")), ctx.model?.provider);
186
182
  }
187
183
  export function taskThinkingLevels(ctx, model) {
188
- const supported = supportedThinkingLevels(model);
184
+ const supported = getSupportedThinkingLevels(model);
189
185
  const pinned = (ctx.scopedModels ?? []).find(({ model: scoped }) => scoped.provider === model.provider && scoped.id === model.id)?.thinkingLevel;
190
186
  if (!pinned)
191
187
  return supported;
@@ -1,4 +1 @@
1
- export {
2
- createTaskModelsExtension as default,
3
- createTaskModelsExtension as registerTaskModelsExtension,
4
- } from "@henryqw/pi-task-models";
1
+ export { createTaskModelsExtension as default } from "@henryqw/pi-task-models";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@henryqw/pi-task-models",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Shared task model profiles and routing for HenryQW Pi extensions.",
5
5
  "keywords": [
6
6
  "pi-package",