@mutagent/cli 0.1.151 → 0.1.152

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/bin/cli.js CHANGED
@@ -839,9 +839,10 @@ class SDKClientWrapper {
839
839
  maxIterations: config?.maxIterations ?? 1,
840
840
  targetScore: config?.targetScore ?? 0.8,
841
841
  patience: config?.patience,
842
- model: config?.model,
843
- ...config?.optimizerModel ? { optimizationModel: config.optimizerModel } : {},
842
+ ...config?.execModel ? { executionModel: config.execModel } : {},
843
+ ...config?.model ? { model: config.model } : {},
844
844
  ...config?.evalModel ? { evaluationModel: config.evalModel } : {},
845
+ ...config?.optModel ? { optimizationModel: config.optModel } : {},
845
846
  ...config?.providerId ? { executionProviderId: config.providerId } : {},
846
847
  ...config?.evalProviderId ? { evaluationProviderId: config.evalProviderId } : {},
847
848
  ...config?.optProviderId ? { optimizationProviderId: config.optProviderId } : {}
@@ -1107,6 +1108,17 @@ class SDKClientWrapper {
1107
1108
  this.handleError(error);
1108
1109
  }
1109
1110
  }
1111
+ async getModelsCatalog() {
1112
+ try {
1113
+ const wsId = this.workspaceId;
1114
+ if (!wsId)
1115
+ return { models: [] };
1116
+ const qs = `?workspaceId=${encodeURIComponent(wsId)}`;
1117
+ return await this.request(`/api/providers/catalog${qs}`);
1118
+ } catch {
1119
+ return { models: [] };
1120
+ }
1121
+ }
1110
1122
  getCurrentWorkspaceId() {
1111
1123
  return this.workspaceId;
1112
1124
  }
@@ -6010,6 +6022,40 @@ ${chalk15.dim('Jobs with status "completed" or "cancelled" cannot be cancelled a
6010
6022
  });
6011
6023
  }
6012
6024
 
6025
+ // src/lib/optimizer-whitelist.ts
6026
+ var ALLOWED_OPTIMIZATION_MODELS = [
6027
+ "gpt-5.2",
6028
+ "gpt-5.4",
6029
+ "claude-sonnet-4-6",
6030
+ "claude-sonnet-4-6[1m]",
6031
+ "claude-opus-4-6",
6032
+ "claude-opus-4-6[1m]",
6033
+ "anthropic.claude-sonnet-4-6",
6034
+ "anthropic.claude-opus-4-6",
6035
+ "anthropic.claude-opus-4-6-v1",
6036
+ "anthropic.claude-sonnet-4-5-20250929-v1:0",
6037
+ "claude-opus-4-5",
6038
+ "anthropic.claude-opus-4-5-20251101-v1:0",
6039
+ "gemini-3.1-pro-preview",
6040
+ "gemini-3-flash-preview"
6041
+ ];
6042
+ var WHITELIST_BY_PROVIDER = {
6043
+ openai: ALLOWED_OPTIMIZATION_MODELS.filter((m) => m.startsWith("gpt-")),
6044
+ anthropic: ALLOWED_OPTIMIZATION_MODELS.filter((m) => m.startsWith("claude-")),
6045
+ bedrock: ALLOWED_OPTIMIZATION_MODELS.filter((m) => m.startsWith("anthropic.")),
6046
+ google: ALLOWED_OPTIMIZATION_MODELS.filter((m) => m.startsWith("gemini-"))
6047
+ };
6048
+ function validateOptimizerModel(model) {
6049
+ if (ALLOWED_OPTIMIZATION_MODELS.includes(model))
6050
+ return;
6051
+ const grouped = Object.entries(WHITELIST_BY_PROVIDER).filter(([, models]) => models.length > 0).map(([provider, models]) => ` ${provider}: ${models.join(", ")}`).join(`
6052
+ `);
6053
+ throw new Error(`Model "${model}" is not allowed for the optimization slot.
6054
+ ` + `Allowed optimization models by provider:
6055
+ ${grouped}
6056
+ ` + `Note: --exec-model and --eval-model are unrestricted.`);
6057
+ }
6058
+
6013
6059
  // src/commands/prompts/optimize.ts
6014
6060
  var MODEL_FAMILIES = [
6015
6061
  {
@@ -6030,7 +6076,7 @@ var MODEL_FAMILIES = [
6030
6076
  {
6031
6077
  providerTypes: ["google"],
6032
6078
  prefixes: ["gemini-"],
6033
- examples: ["gemini-3.1-pro-preview", "gemini-3-flash-preview", "gemini-3.1-flash-lite-preview"]
6079
+ examples: ["gemini-2.5-pro", "gemini-3.1-pro-preview", "gemini-3-flash-preview", "gemini-3.1-flash-lite-preview"]
6034
6080
  },
6035
6081
  {
6036
6082
  providerTypes: ["deepseek"],
@@ -6060,7 +6106,7 @@ ${chalk16.bold("Hit a bug or unexpected result?")}
6060
6106
  optimize.help();
6061
6107
  });
6062
6108
  prompts.addCommand(optimize);
6063
- optimize.command("start").description("Start prompt optimization").argument("<prompt-id>", "Prompt ID (from: mutagent prompts list)").requiredOption("-d, --dataset <id>", "Dataset ID for optimization (from: mutagent prompts dataset list <prompt-id>)").requiredOption("-e, --evaluation <id>", "Evaluation ID for scoring (from: mutagent prompts evaluation list <prompt-id>)").option("--max-iterations <n>", "Max optimization iterations (default: 1)").option("--target-score <n>", "Target accuracy 0-1 (default: 0.8)").option("--patience <n>", "Iterations without improvement before stopping").option("--model <model-id>", 'Target LLM model (e.g., "claude-sonnet-4-5-20250929")').option("--eval-model <model-id>", "Evaluation model (defaults to target model)").option("--optimizer-model <model-id>", "Optimization/mutation model (defaults to eval model)").option("--provider-id <id>", "Provider config ID for the execution slot (provider-id-first routing)").option("--eval-provider-id <id>", "Provider config ID for the evaluation slot").option("--opt-provider-id <id>", "Provider config ID for the optimization slot").option("--watch", "Watch live progress with stage cards", false).addHelpText("after", `
6109
+ optimize.command("start").description("Start prompt optimization").argument("<prompt-id>", "Prompt ID (from: mutagent prompts list)").requiredOption("-d, --dataset <id>", "Dataset ID for optimization (from: mutagent prompts dataset list <prompt-id>)").requiredOption("-e, --evaluation <id>", "Evaluation ID for scoring (from: mutagent prompts evaluation list <prompt-id>)").option("--max-iterations <n>", "Max optimization iterations (default: 1)").option("--target-score <n>", "Target accuracy 0-1 (default: 0.8)").option("--patience <n>", "Iterations without improvement before stopping").option("--model <model-id>", 'Execution model (e.g., "claude-sonnet-4-5-20250929")').option("--exec-model <model-id>", "Execution model — alias for --model; takes precedence if both provided").option("--eval-model <model-id>", "Evaluation model — unrestricted (defaults to exec model)").option("--opt-model <model-id>", "Optimizer model — must be on the optimizer whitelist").option("--optimizer-model <model-id>", "[deprecated] Alias for --opt-model. Use --opt-model instead.").option("--provider-id <id>", "Provider config ID for the execution slot (provider-id-first routing)").option("--eval-provider-id <id>", "Provider config ID for the evaluation slot").option("--opt-provider-id <id>", "Provider config ID for the optimization slot").option("--watch", "Watch live progress with stage cards", false).addHelpText("after", `
6064
6110
  Examples:
6065
6111
  ${chalk16.dim("$")} mutagent prompts optimize start <prompt-id> --dataset <dataset-id> --evaluation <eval-id>
6066
6112
  ${chalk16.dim("$")} mutagent prompts optimize start <prompt-id> --dataset <dataset-id> --evaluation <eval-id> --max-iterations 5
@@ -6096,10 +6142,19 @@ ${chalk16.bold("Hit a bug or unexpected result?")}
6096
6142
  try {
6097
6143
  await checkProviderConfigured();
6098
6144
  const client = await getSDKClient();
6099
- if (!options.model && !isJson) {
6145
+ if (options.optimizerModel) {
6146
+ if (!isJson)
6147
+ output.warn("--optimizer-model is deprecated, use --opt-model");
6148
+ options.optModel = options.optModel ?? options.optimizerModel;
6149
+ }
6150
+ if (options.optModel) {
6151
+ validateOptimizerModel(options.optModel);
6152
+ }
6153
+ const execModel = options.execModel ?? options.model;
6154
+ if (!execModel && !isJson) {
6100
6155
  output.warn("No --model specified. Server will use default. Pass --model <id> to control costs.");
6101
6156
  }
6102
- if (options.model) {
6157
+ if (execModel) {
6103
6158
  try {
6104
6159
  const providers = await client.listProviders();
6105
6160
  if (providers.data && providers.data.length > 0) {
@@ -6112,11 +6167,11 @@ ${chalk16.bold("Hit a bug or unexpected result?")}
6112
6167
  }
6113
6168
  } else {
6114
6169
  const modelFamilies = getModelFamiliesForProviderTypes(configuredTypes);
6115
- const modelLower = options.model.toLowerCase();
6170
+ const modelLower = execModel.toLowerCase();
6116
6171
  const matchedFamily = modelFamilies.find(({ prefixes }) => prefixes.some((prefix) => modelLower.startsWith(prefix)));
6117
6172
  if (!matchedFamily) {
6118
6173
  const supportedModels = modelFamilies.flatMap((f) => f.examples).join(", ");
6119
- const errorMsg = `Model '${options.model}' is not supported by any configured provider. ` + `Your providers: [${configuredTypes.join(", ")}]. ` + `Supported models: ${supportedModels || "(unknown — check mutagent providers list --json)"}. ` + `Run: mutagent providers list --json`;
6174
+ const errorMsg = `Model '${execModel}' is not supported by any configured provider. ` + `Your providers: [${configuredTypes.join(", ")}]. ` + `Supported models: ${supportedModels || "(unknown — check mutagent providers list --json)"}. ` + `Run: mutagent providers list --json`;
6120
6175
  if (isJson) {
6121
6176
  output.output({ success: false, error: errorMsg, code: "MODEL_NOT_SUPPORTED" });
6122
6177
  return;
@@ -6280,9 +6335,10 @@ ${chalk16.bold("Hit a bug or unexpected result?")}
6280
6335
  maxIterations: options.maxIterations ? parseInt(options.maxIterations, 10) : 1,
6281
6336
  targetScore: options.targetScore ? parseFloat(options.targetScore) : undefined,
6282
6337
  patience: options.patience ? parseInt(options.patience, 10) : undefined,
6283
- model: options.model,
6338
+ model: options.execModel ? undefined : options.model,
6339
+ execModel: options.execModel,
6284
6340
  evalModel: options.evalModel,
6285
- optimizerModel: options.optimizerModel,
6341
+ optModel: options.optModel,
6286
6342
  providerId: options.providerId,
6287
6343
  evalProviderId: options.evalProviderId,
6288
6344
  optProviderId: options.optProviderId
@@ -8810,11 +8866,15 @@ Provider Types:
8810
8866
 
8811
8867
  Subcommands:
8812
8868
  list, get, add, update, delete, test
8869
+
8870
+ Tip:
8871
+ Use --models on list to see available models per provider.
8813
8872
  `);
8814
- providers.command("list").description("List all providers").option("-l, --limit <n>", "Limit results", "50").option("-o, --offset <n>", "Offset for pagination").option("-t, --type <type>", "Filter by provider type").addHelpText("after", `
8873
+ providers.command("list").description("List all providers").option("-l, --limit <n>", "Limit results", "50").option("-o, --offset <n>", "Offset for pagination").option("-t, --type <type>", "Filter by provider type").option("-m, --models", "Show available models per provider (calls /providers/catalog)").addHelpText("after", `
8815
8874
  Examples:
8816
8875
  ${chalk33.dim("$")} mutagent providers list
8817
8876
  ${chalk33.dim("$")} mutagent providers list --type openai
8877
+ ${chalk33.dim("$")} mutagent providers list --models
8818
8878
  ${chalk33.dim("$")} mutagent providers list --json
8819
8879
  `).action(async (options) => {
8820
8880
  const isJson = getJsonFlag(providers);
@@ -8831,6 +8891,26 @@ Examples:
8831
8891
  filters.type = validateProviderType(options.type);
8832
8892
  }
8833
8893
  const result = await client.listProviders(filters);
8894
+ let catalogByKind = {};
8895
+ if (options.models) {
8896
+ try {
8897
+ const catalog = await client.getModelsCatalog();
8898
+ for (const entry of catalog.models) {
8899
+ const kind = entry.provider.kind;
8900
+ if (!catalogByKind[kind])
8901
+ catalogByKind[kind] = [];
8902
+ catalogByKind[kind].push(entry.id);
8903
+ }
8904
+ } catch {}
8905
+ }
8906
+ const formatModels = (kind) => {
8907
+ const models = catalogByKind[kind] ?? [];
8908
+ if (models.length === 0)
8909
+ return "—";
8910
+ if (models.length <= 3)
8911
+ return models.join(", ");
8912
+ return `${models.slice(0, 3).join(", ")} +${models.length - 3} more`;
8913
+ };
8834
8914
  if (isJson) {
8835
8915
  const withLinks = result.data.map((p) => ({
8836
8916
  id: p.id,
@@ -8838,6 +8918,7 @@ Examples:
8838
8918
  type: p.type,
8839
8919
  isActive: p.isActive,
8840
8920
  updatedAt: p.updatedAt,
8921
+ ...options.models ? { models: catalogByKind[p.type] ?? [] } : {},
8841
8922
  _links: providerLinks(p.id)
8842
8923
  }));
8843
8924
  output.output({ ...result, data: withLinks });
@@ -8853,6 +8934,7 @@ Examples:
8853
8934
  baseUrl: p.baseUrl ?? "default",
8854
8935
  active: p.isActive ? "Yes" : "No",
8855
8936
  updated: p.updatedAt ? new Date(p.updatedAt).toLocaleDateString() : "N/A",
8937
+ ...options.models ? { models: formatModels(p.type) } : {},
8856
8938
  url: providerLink(p.id)
8857
8939
  }));
8858
8940
  output.output(formatted);
@@ -9544,6 +9626,7 @@ description: |
9544
9626
  3. **NEVER auto-generate eval criteria — collect from user.** Ask the user for each rubric field. See [concepts/eval-criteria.md](./concepts/eval-criteria.md) for the 3-tier format.
9545
9627
  4. **Explore-before-modify.** Run \`mutagent explore --json\` before any write operation. Present findings, get user confirmation. Never mutate without discovery first.
9546
9628
  5. **Cost transparency before \`optimize start\`.** Run \`mutagent usage --json\` and show the result to the user. Get explicit confirmation before any optimization job.
9629
+ 6. **Before optimizing, run \`mutagent providers list --models\` to verify available models.** This calls \`/providers/catalog\` and shows which models are available per provider. Use the output to pick valid \`--exec-model\` and \`--eval-model\` values.
9547
9630
 
9548
9631
  ---
9549
9632
 
@@ -9559,6 +9642,7 @@ Match the user's first request. Load ONLY the matching subfile. Do NOT preload t
9559
9642
  | \`AgentExecutor\`, \`StateGraph\`, \`createReactAgent\`, \`tool_calls\`, \`@tool\`, \`langgraph\`, \`crewai\`, \`autogen\`, \`openai/agents\`, multi-turn | [workflows/agents.md](./workflows/agents.md) | WIP path — surface partnership link |
9560
9643
  | "how do variables work", "single vs double braces", delimiter | [concepts/prompt-variables.md](./concepts/prompt-variables.md) | Delimiter inference contract |
9561
9644
  | "what makes a good eval", "rubric", "evaluation criteria" | [concepts/eval-criteria.md](./concepts/eval-criteria.md) | INPUT MVC + OUTPUT Standards |
9645
+ | "check models", "what models", "available models", "which models" | run \`mutagent providers list --models --json\` | Discovery: shows catalog per provider before model selection |
9562
9646
  | Unclear / first time | run \`mutagent explore --json\` first, then reroute | Discovery before action |
9563
9647
 
9564
9648
  ---
@@ -12150,6 +12234,9 @@ ${chalk39.yellow("Command Navigation:")}
12150
12234
  mutagent prompts evaluation create <id> --guided --json ${chalk39.dim("Guided eval workflow")}
12151
12235
  mutagent prompts evaluation list <id> --json ${chalk39.dim("List evaluations")}
12152
12236
 
12237
+ mutagent providers list --json ${chalk39.dim("List configured BYOK providers")}
12238
+ mutagent providers list --models ${chalk39.dim("see available models per provider")}
12239
+
12153
12240
  mutagent prompts optimize start --help ${chalk39.dim("Run optimization (read help first!)")}
12154
12241
  mutagent prompts optimize status <job-id> ${chalk39.dim("Poll progress")}
12155
12242
  mutagent prompts optimize results <job-id> ${chalk39.dim("View scorecard")}
@@ -12292,5 +12379,5 @@ if (isInteractive && !isSkillCommand) {
12292
12379
  }
12293
12380
  program.parse();
12294
12381
 
12295
- //# debugId=2FD2902EDF36086764756E2164756E21
12382
+ //# debugId=EE09049CBBE922DA64756E2164756E21
12296
12383
  //# sourceMappingURL=cli.js.map