@mcpjam/cli 5.12.2 → 5.14.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/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { Command, CommanderError, Option } from 'commander';
3
3
  import { realpathSync, readFileSync, existsSync, mkdirSync, writeFileSync, unlinkSync, statSync, closeSync, renameSync, lstatSync, openSync } from 'fs';
4
4
  import { pathToFileURL } from 'url';
5
- import { loadEvalSuiteFile, createSuiteFileRunner, runSuiteFile, SuiteFileRunError, formatLocalEvalRunSummary, renderStructuredRunJson, probeMcpServer, redactForTelemetry, runServerDoctor, collectServerSnapshot, serializeStableServerSnapshot, serializeServerSnapshot, buildServerDiffReport, classifyMcpHeader, validateToolCallResult, isCallToolResultError, buildToolCallValidationReport, listResources, readResource, listServerSkillCatalog, getVerifiedServerSkill, isServerSkillRefusalError, readVerifiedServerSkillFile, SubscriptionCoordinator, listTools, listPrompts, getPrompt, MCPAppsConformanceTest, scoreFromAppsResult, MCPAppsConformanceSuite, MCPTasksConformanceTest, scoreFromTasksResult, runOAuthLogin, OAuthConformanceTest, scoreFromOAuthResult, OAuthConformanceSuite, runXaaFlow, MCPConformanceTest, scoreFromProtocolResult, MCPConformanceSuite, runConformance, isConformanceReportingConfigured, reportConformanceRun, reportConformanceRunSafely, OPENAI_SUBMISSION_MODES, renderStructuredRunJUnitXml, renderStructuredRunHtml, withEphemeralClient, diffServerSnapshots, ServerSnapshotFormatError, DEFAULT_SUBSCRIPTION_RECONNECT_POLICY, isKnownProtocolVersion, describeConformanceScore, toConformanceReport, buildConformanceRunReport, renderConformanceReportJUnitXml, renderConformanceReportJson, formatOAuthConformanceHuman, formatOAuthConformanceSuiteHuman, fetchOAuthMetadata, executeOAuthProxy, executeDebugOAuthProxy, normalizeRegistrationStrategy, normalizeXaaClientAuth, normalizeIdentityAssertionFormat, IDENTITY_ASSERTION_FORMATS, XAA_CONFIDENTIAL_CIMD_ORIGIN, getLocalConfidentialCimdProvider, MCP_PROTOCOL_VERSIONS, gatherClaudeReadinessEvidence, gradeClaudeReadiness, gatherOpenAIReadinessEvidence, xmldomParseXml, gradeOpenAIReadiness, openUrlInBrowser, buildEvalRunReport, GATE_WAIVER_MAX_REASON_LENGTH, GATE_WAIVER_REASON_NOTICE, MCPClientManager, withSkillsExtensionCapability, detectCiMetadata, MCP_SKILLS_EXTENSION_ID, decodeMcpHeaderValue, canDeclareTasksExtension, createStrictElicitationContentValidator, MCP_APPS_CHECK_CATEGORIES, MCP_APPS_CHECK_IDS, MCP_TASKS_CHECK_CATEGORIES, MCP_TASKS_CHECK_IDS, OAuthProxyError, isLoopbackHost, MCP_CHECK_CATEGORIES, MCP_CHECK_IDS, OPENAI_SUBMISSION_MODE_SHAPES, createDirectoryPluginFileSource, collectZipArchiveObservations, createZipPluginFileSource, generateRandomString, generateCodeChallenge, createInteractiveAuthorizationSession, declareEvalSuiteFileValidity, formatEvalRunDecisionSummary, gateOutcomeVerdict, applyGateWaiver, formatGateReport, formatGateWaiverLine, detectFlakyCases, evaluateCompareGates, buildRunCompareReport, formatSuiteFileFindings, serializeEvalSuiteFile, MAX_SUITE_FILE_BYTES, buildCorpus, HostedOnlyCaseError, verifyCorpusLock, TaskLifecycleEngine, driveTaskToTerminal, extensionTaskToObservation, legacyTaskToObservation, canonicalDigest, readEvalRunDecisionSummary as readEvalRunDecisionSummary$1, buildEvalRunDecisionSummary, evaluateGates, gateInputFromPlatformRun, isGateWaiverInForce, calculateLatencyStats, CORPUS_LOCK_VERSION, suiteFilePointer, passRateFractionFromPercent, DEFAULT_MIN_EFFECT_SIZE, DEFAULT_MIN_SAMPLE_SIZE, planPlatformSuiteGradingUpdate, isUnknownTaskError, isMCPTasksWireError, LEGACY_TASK_STATUSES } from '@mcpjam/sdk';
5
+ import { MODEL_REASONING_EFFORTS, loadEvalSuiteFile, createSuiteFileRunner, runSuiteFile, SuiteFileRunError, formatLocalEvalRunSummary, renderStructuredRunJson, probeMcpServer, redactForTelemetry, runServerDoctor, collectServerSnapshot, serializeStableServerSnapshot, serializeServerSnapshot, buildServerDiffReport, classifyMcpHeader, validateToolCallResult, isCallToolResultError, buildToolCallValidationReport, listResources, readResource, listServerSkillCatalog, getVerifiedServerSkill, isServerSkillRefusalError, readVerifiedServerSkillFile, SubscriptionCoordinator, listTools, listPrompts, getPrompt, MCPAppsConformanceTest, scoreFromAppsResult, MCPAppsConformanceSuite, MCPTasksConformanceTest, scoreFromTasksResult, runOAuthLogin, OAuthConformanceTest, scoreFromOAuthResult, OAuthConformanceSuite, runXaaFlow, MCPConformanceTest, scoreFromProtocolResult, MCPConformanceSuite, runConformance, isConformanceReportingConfigured, reportConformanceRun, reportConformanceRunSafely, OPENAI_SUBMISSION_MODES, renderStructuredRunJUnitXml, renderStructuredRunHtml, withEphemeralClient, diffServerSnapshots, ServerSnapshotFormatError, DEFAULT_SUBSCRIPTION_RECONNECT_POLICY, isKnownProtocolVersion, describeConformanceScore, toConformanceReport, buildConformanceRunReport, renderConformanceReportJUnitXml, renderConformanceReportJson, formatOAuthConformanceHuman, formatOAuthConformanceSuiteHuman, fetchOAuthMetadata, executeOAuthProxy, executeDebugOAuthProxy, normalizeRegistrationStrategy, normalizeXaaClientAuth, normalizeIdentityAssertionFormat, IDENTITY_ASSERTION_FORMATS, XAA_CONFIDENTIAL_CIMD_ORIGIN, getLocalConfidentialCimdProvider, MCP_PROTOCOL_VERSIONS, gatherClaudeReadinessEvidence, gradeClaudeReadiness, gatherOpenAIReadinessEvidence, xmldomParseXml, gradeOpenAIReadiness, openUrlInBrowser, buildEvalRunReport, GATE_WAIVER_MAX_REASON_LENGTH, GATE_WAIVER_REASON_NOTICE, MCPClientManager, withSkillsExtensionCapability, detectCiMetadata, MCP_SKILLS_EXTENSION_ID, decodeMcpHeaderValue, canDeclareTasksExtension, createStrictElicitationContentValidator, MCP_APPS_CHECK_CATEGORIES, MCP_APPS_CHECK_IDS, MCP_TASKS_CHECK_CATEGORIES, MCP_TASKS_CHECK_IDS, OAuthProxyError, isLoopbackHost, MCP_CHECK_CATEGORIES, MCP_CHECK_IDS, OPENAI_SUBMISSION_MODE_SHAPES, createDirectoryPluginFileSource, collectZipArchiveObservations, createZipPluginFileSource, generateRandomString, generateCodeChallenge, createInteractiveAuthorizationSession, declareEvalSuiteFileValidity, formatEvalRunDecisionSummary, gateOutcomeVerdict, applyGateWaiver, formatGateReport, formatGateWaiverLine, detectFlakyCases, evaluateCompareGates, buildRunCompareReport, formatSuiteFileFindings, serializeEvalSuiteFile, MAX_SUITE_FILE_BYTES, buildCorpus, HostedOnlyCaseError, verifyCorpusLock, TaskLifecycleEngine, driveTaskToTerminal, extensionTaskToObservation, legacyTaskToObservation, canonicalDigest, readEvalRunDecisionSummary as readEvalRunDecisionSummary$1, buildEvalRunDecisionSummary, evaluateGates, gateInputFromPlatformRun, isGateWaiverInForce, calculateLatencyStats, CORPUS_LOCK_VERSION, suiteFilePointer, passRateFractionFromPercent, DEFAULT_MIN_EFFECT_SIZE, DEFAULT_MIN_SAMPLE_SIZE, planPlatformSuiteGradingUpdate, isUnknownTaskError, isMCPTasksWireError, LEGACY_TASK_STATUSES } from '@mcpjam/sdk';
6
6
  import path7, { join, dirname, basename, resolve } from 'path';
7
7
  import { randomUUID, randomBytes, createHash } from 'crypto';
8
8
  import { mkdir, writeFile, readFile, chmod, rename, rm, open, unlink, stat } from 'fs/promises';
@@ -29,7 +29,7 @@ import { selectPluginMcpServerMap, detectPluginMcpTransport } from '@mcpjam/sdk/
29
29
 
30
30
  // package.json
31
31
  var package_default = {
32
- version: "5.12.2"};
32
+ version: "5.14.0"};
33
33
  function conformanceExitCode(result) {
34
34
  if (result.outcome === "incomplete") return 3;
35
35
  if (result.outcome === "failed") return 1;
@@ -4939,6 +4939,34 @@ function registerCloudLinkCommands(cloud) {
4939
4939
  }
4940
4940
  );
4941
4941
  }
4942
+ var EFFORT_LEVELS_NOTE = `(${MODEL_REASONING_EFFORTS.join(
4943
+ " | "
4944
+ )}). Which levels a model accepts is \`supportedReasoningEfforts\` in \`mcpjam models list\`; one the route cannot apply is refused, never dropped.`;
4945
+ var EFFORT_FLAG_DESCRIPTION = `Set the reasoning effort ${EFFORT_LEVELS_NOTE} Only edits the effort on an existing model selection (refused when there is none); use --model-selection to set a model and effort together.`;
4946
+ var REQUEST_EFFORT_FLAG_DESCRIPTION = `Reasoning effort ${EFFORT_LEVELS_NOTE}`;
4947
+ function parseEffortFlag(value, flag = "--effort") {
4948
+ const effort = value.trim().toLowerCase();
4949
+ if (!MODEL_REASONING_EFFORTS.includes(effort)) {
4950
+ throw usageError(
4951
+ `${flag} expects one of ${MODEL_REASONING_EFFORTS.join(
4952
+ ", "
4953
+ )}, got "${value}".`
4954
+ );
4955
+ }
4956
+ return effort;
4957
+ }
4958
+ function effortShorthand(options) {
4959
+ if (options.effort !== void 0 && options.clearEffort) {
4960
+ throw usageError("Provide either --effort or --clear-effort, not both.");
4961
+ }
4962
+ if (options.clearEffort) return null;
4963
+ return options.effort !== void 0 ? parseEffortFlag(options.effort) : void 0;
4964
+ }
4965
+ function parseModelSelectionFlag(value, flag = "--model-selection") {
4966
+ return parseJsonInputRecord(value, flag);
4967
+ }
4968
+
4969
+ // src/commands/environments.ts
4942
4970
  function validateInput(op, raw) {
4943
4971
  const parsed = op.inputSchema.safeParse(raw);
4944
4972
  if (!parsed.success) {
@@ -5103,12 +5131,15 @@ function registerEnvironmentsCommands(program) {
5103
5131
  ).option("--project <id-or-name>", "Project name or ID").option("--name <name>", "Display name for the new environment").option("--host-id <id>", "ID of the host this environment runs against").option("--description <text>", "Optional description").option(
5104
5132
  "--model <id>",
5105
5133
  "Model this environment runs, overriding the model pinned on its host. Omit to inherit the host's. Stored verbatim \u2014 pass exactly the id the provider request should carry"
5134
+ ).option(
5135
+ "--model-selection <json>",
5136
+ "Whole saved model selection behind the override (source, connection, settings.reasoningEffort), as JSON (or @file, or -). Must be for the model named; sent alone it pins its own model."
5106
5137
  ).option(
5107
5138
  "--sandbox-image <id>",
5108
5139
  "Project-shared sandbox image (see `mcpjam cloud images`) to pin: eval runs boot a fresh sandbox from it"
5109
5140
  ).option(
5110
5141
  "--file <path>",
5111
- "Environment JSON file with any of name/hostId/description/serverAttachmentId/modelId/skillSelection/secretSelection/pluginVersionIds/sandboxImageId (or - for stdin)"
5142
+ "Environment JSON file with any of name/hostId/description/serverAttachmentId/modelId/modelSelection/skillSelection/secretSelection/pluginVersionIds/sandboxImageId (or - for stdin)"
5112
5143
  ).option("--json <json>", "Inline environment JSON (or @file, or -)").action(
5113
5144
  async (options, command) => {
5114
5145
  const globalOptions = getGlobalOptions(command);
@@ -5138,6 +5169,7 @@ function registerEnvironmentsCommands(program) {
5138
5169
  ...options.hostId !== void 0 ? { hostId: options.hostId } : {},
5139
5170
  ...options.description !== void 0 ? { description: options.description } : {},
5140
5171
  ...options.model !== void 0 ? { modelId: options.model } : {},
5172
+ ...options.modelSelection !== void 0 ? { modelSelection: parseModelSelectionFlag(options.modelSelection) } : {},
5141
5173
  ...options.sandboxImage !== void 0 ? { sandboxImageId: options.sandboxImage } : {}
5142
5174
  });
5143
5175
  const result = await runPlatformOperation(
@@ -5160,6 +5192,9 @@ function registerEnvironmentsCommands(program) {
5160
5192
  ).option(
5161
5193
  "--model <id>",
5162
5194
  "Model to run instead of the host's pinned one (stored verbatim)"
5195
+ ).option(
5196
+ "--model-selection <json>",
5197
+ "Whole saved model selection (source, connection, settings.reasoningEffort), as JSON (or @file, or -). Different efforts of one model are different environments."
5163
5198
  ).option(
5164
5199
  "--computer <id-or-name>",
5165
5200
  "Project-shared sandbox image to pin, so runs boot a fresh computer from it"
@@ -5186,6 +5221,7 @@ function registerEnvironmentsCommands(program) {
5186
5221
  host: options.host,
5187
5222
  ...options.serverGroup !== void 0 ? { serverGroup: options.serverGroup } : {},
5188
5223
  ...options.model !== void 0 ? { model: options.model } : {},
5224
+ ...options.modelSelection !== void 0 ? { modelSelection: parseModelSelectionFlag(options.modelSelection) } : {},
5189
5225
  ...options.computer !== void 0 ? { computer: options.computer } : {},
5190
5226
  ...options.skill?.length ? { skills: { mode: "explicit", skillIds: options.skill } } : {},
5191
5227
  ...options.secret?.length ? { secrets: { mode: "explicit", secretIds: options.secret } } : {}
@@ -5241,6 +5277,12 @@ function registerEnvironmentsCommands(program) {
5241
5277
  ).option(
5242
5278
  "--clear-model",
5243
5279
  "Clear the model override so the environment inherits its host's model again"
5280
+ ).option(
5281
+ "--model-selection <json>",
5282
+ "Whole saved model selection for the override (source, connection, settings.reasoningEffort), as JSON (or @file, or -). Must be for the model named."
5283
+ ).option("--effort <level>", EFFORT_FLAG_DESCRIPTION).option(
5284
+ "--clear-effort",
5285
+ "Remove the reasoning effort from the environment's model selection"
5244
5286
  ).option(
5245
5287
  "--sandbox-image <id>",
5246
5288
  `New sandbox-image pin (clear via --json '{"sandboxImageId": null}')`
@@ -5251,6 +5293,7 @@ function registerEnvironmentsCommands(program) {
5251
5293
  async (options, command) => {
5252
5294
  const globalOptions = getGlobalOptions(command);
5253
5295
  const body = loadJsonObject(options) ?? {};
5296
+ const reasoningEffort = effortShorthand(options);
5254
5297
  if (options.model !== void 0 && options.clearModel) {
5255
5298
  throw usageError("Provide either --model or --clear-model, not both.");
5256
5299
  }
@@ -5284,6 +5327,8 @@ function registerEnvironmentsCommands(program) {
5284
5327
  // both this command and the API already accept; neither is removed.
5285
5328
  ...options.clearModel ? { modelId: null } : {},
5286
5329
  ...options.model !== void 0 ? { modelId: options.model } : {},
5330
+ ...options.modelSelection !== void 0 ? { modelSelection: parseModelSelectionFlag(options.modelSelection) } : {},
5331
+ ...reasoningEffort !== void 0 ? { reasoningEffort } : {},
5287
5332
  ...options.sandboxImage !== void 0 ? { sandboxImageId: options.sandboxImage } : {}
5288
5333
  });
5289
5334
  const result = await runPlatformOperation(
@@ -7426,7 +7471,11 @@ function compareGateInputFrom(compare, latency = {}) {
7426
7471
  }
7427
7472
  function flakyInputFrom(iterations) {
7428
7473
  return iterations.filter(
7429
- (iteration) => iteration.result === "passed" || iteration.result === "failed"
7474
+ (iteration) => (
7475
+ // An infra-failed trial (`infraError`) is stored `failed` but
7476
+ // measured nothing; counting it would fabricate a flake.
7477
+ !iteration.infraError && (iteration.result === "passed" || iteration.result === "failed")
7478
+ )
7430
7479
  ).map((iteration) => ({
7431
7480
  // Falls back to the iteration's own id, never a shared literal: a
7432
7481
  // single "unknown" bucket would pool unrelated iterations, and one pass
@@ -8119,7 +8168,13 @@ function composeField(options) {
8119
8168
  const composeClient = options.composeClient ?? options.composeHost;
8120
8169
  const clientFlag = options.composeHost !== void 0 ? "--compose-host" : "--compose-client";
8121
8170
  const models = Array.isArray(options.composeModel) ? options.composeModel : options.composeModel ? [options.composeModel] : void 0;
8122
- const refinements = options.composeComputer !== void 0 || models !== void 0 || (options.composeServer?.length ?? 0) > 0 || options.composeServerGroup !== void 0 || options.composeHostServers === true || (options.composeSkill?.length ?? 0) > 0 || (options.composeSecret?.length ?? 0) > 0 || options.withClientDefault === true || options.saveTargets === true;
8171
+ const modelSelections = (Array.isArray(options.composeModelSelection) ? options.composeModelSelection : options.composeModelSelection !== void 0 ? [options.composeModelSelection] : []).map(
8172
+ (raw) => (
8173
+ // The server validates the selection; the flag parser only guarantees JSON.
8174
+ parseModelSelectionFlag(raw, "--compose-model-selection")
8175
+ )
8176
+ );
8177
+ const refinements = options.composeComputer !== void 0 || models !== void 0 || modelSelections.length > 0 || (options.composeServer?.length ?? 0) > 0 || options.composeServerGroup !== void 0 || options.composeHostServers === true || (options.composeSkill?.length ?? 0) > 0 || (options.composeSecret?.length ?? 0) > 0 || options.withClientDefault === true || options.saveTargets === true;
8123
8178
  if (!composeClient) {
8124
8179
  if (refinements) {
8125
8180
  throw usageError(
@@ -8150,6 +8205,7 @@ function composeField(options) {
8150
8205
  ...options.composeServerGroup !== void 0 ? { serverGroup: options.composeServerGroup } : {},
8151
8206
  ...selectorField("server", "servers", options.composeServer),
8152
8207
  ...models !== void 0 ? { models } : {},
8208
+ ...modelSelections.length > 0 ? { modelSelections } : {},
8153
8209
  ...options.withClientDefault === true ? { includeClientDefault: true } : {},
8154
8210
  ...options.saveTargets === true ? { saveTargets: true } : {},
8155
8211
  ...options.composeComputer !== void 0 ? { computer: options.composeComputer } : {},
@@ -8572,6 +8628,10 @@ function buildSuiteUpdateInput(options) {
8572
8628
  exec.systemPrompt = options.systemPrompt;
8573
8629
  if (options.temperature !== void 0)
8574
8630
  exec.temperature = Number(options.temperature);
8631
+ if (options.modelSelection !== void 0)
8632
+ exec.modelSelection = parseModelSelectionFlag(options.modelSelection);
8633
+ const reasoningEffort = effortShorthand(options);
8634
+ if (reasoningEffort !== void 0) exec.reasoningEffort = reasoningEffort;
8575
8635
  if (Object.keys(exec).length > 0) input.executionConfig = exec;
8576
8636
  const settings = { ...input.settings ?? {} };
8577
8637
  const edit = applyGradingFlags(options, settings);
@@ -10004,6 +10064,9 @@ function registerEvalCommands(program) {
10004
10064
  ).option(
10005
10065
  "--compose-model <id...>",
10006
10066
  "Model(s) to run on the composed stack. Replaces the client default unless --with-client-default is set."
10067
+ ).option(
10068
+ "--compose-model-selection <json...>",
10069
+ "A whole saved model selection (source, connection, settings.reasoningEffort) as JSON (or @file, or -): one cell for its model, at its effort. Alongside --compose-model. Repeat it to add several selections for one model (e.g. at low and at high) \u2014 each distinct selection is its own cell."
10007
10070
  ).option(
10008
10071
  "--with-client-default",
10009
10072
  "Also launch an inherit cell that uses each client's pinned model, alongside --compose-model"
@@ -10682,6 +10745,147 @@ function registerEvalCommands(program) {
10682
10745
  );
10683
10746
  }
10684
10747
  );
10748
+ addProjectOption(
10749
+ evals.command("rerun").description(
10750
+ "Rerun a finished eval run's failed cases as a new run. The platform picks the cases: any with a trial that did not complete and pass (cancelled and skipped trials do not count)"
10751
+ ).argument("<run-id>", "Eval run ID to rerun (from `eval run`)").option(
10752
+ "--failed",
10753
+ "Rerun only the cases that did not pass (required; the only rerun scope)"
10754
+ ).option(
10755
+ "--dry-run",
10756
+ "Show which cases would rerun, and why, without starting anything"
10757
+ ).option("--notes <text>", "Free-text note stored on the new run").option(
10758
+ "--idempotency-key <key>",
10759
+ "Retry-safety key: repeating the call returns the run it already started"
10760
+ ).option("--wait", "Wait for the rerun to reach a terminal status").option(
10761
+ "--wait-timeout <ms>",
10762
+ "Maximum time to wait for completion (default 2100000; a run held for its judge gets up to 31 more minutes unless this flag is set)"
10763
+ ).option("--json", "Print machine-readable JSON (same as --format json)")
10764
+ ).action(
10765
+ async (runId, options, command) => {
10766
+ if (!options.failed) {
10767
+ throw usageError(
10768
+ "Pass --failed: rerunning the cases that did not pass is the only rerun scope."
10769
+ );
10770
+ }
10771
+ if (options.waitTimeout !== void 0 && !options.wait) {
10772
+ throw usageError("--wait-timeout requires --wait.");
10773
+ }
10774
+ if (options.dryRun && options.wait) {
10775
+ throw usageError("--dry-run starts nothing, so it cannot --wait.");
10776
+ }
10777
+ const globalOptions = getGlobalOptions(command);
10778
+ const format = options.json ? "json" : globalOptions.format;
10779
+ const waitTimeoutMs = options.waitTimeout !== void 0 ? parsePositiveInteger(options.waitTimeout, "--wait-timeout") : DEFAULT_RUN_WAIT_TIMEOUT_MS;
10780
+ const gradingExtensionMs = options.waitTimeout !== void 0 ? 0 : GRADING_WAIT_EXTENSION_MS;
10781
+ const resolved = resolveCloudProjectArgs(options);
10782
+ let webOrigin = DEFAULT_PLATFORM_ORIGIN;
10783
+ let outcome;
10784
+ try {
10785
+ outcome = await runPlatformOperation(
10786
+ platformOptionsOf(command),
10787
+ options.wait ? Math.max(
10788
+ globalOptions.timeout,
10789
+ waitTimeoutMs + gradingExtensionMs
10790
+ ) : globalOptions.timeout,
10791
+ async (context) => {
10792
+ webOrigin = context.webOrigin;
10793
+ const { client, signal } = context;
10794
+ const projects = await client.listProjects({}, { signal });
10795
+ const resolution = resolveProject(projects.items, resolved.project);
10796
+ if (!resolution.ok) {
10797
+ throw usageError(
10798
+ appendProjectLinkHint(resolution.message, resolved.projectScope)
10799
+ );
10800
+ }
10801
+ const projectId = resolution.project.id;
10802
+ if (options.dryRun) {
10803
+ const preview = await client.getEvalRunRerunPreview(
10804
+ { projectId, runId },
10805
+ { signal }
10806
+ );
10807
+ return { projectId, preview };
10808
+ }
10809
+ const rerun2 = await client.rerunEvalRun(
10810
+ {
10811
+ projectId,
10812
+ runId,
10813
+ scope: "failed_cases",
10814
+ ...options.notes !== void 0 ? { notes: options.notes } : {},
10815
+ ...options.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {}
10816
+ },
10817
+ { signal }
10818
+ );
10819
+ if (!options.wait) return { projectId, rerun: rerun2 };
10820
+ try {
10821
+ const run2 = await waitForEvalRun(
10822
+ client,
10823
+ signal,
10824
+ projectId,
10825
+ rerun2.runId,
10826
+ Date.now() + waitTimeoutMs,
10827
+ gradingExtensionMs
10828
+ );
10829
+ return { projectId, rerun: rerun2, run: run2 };
10830
+ } catch (error) {
10831
+ return {
10832
+ projectId,
10833
+ rerun: rerun2,
10834
+ waitError: {
10835
+ message: error instanceof Error ? error.message : String(error),
10836
+ ...isPlatformApiError(error) ? { errorCode: error.code } : {}
10837
+ }
10838
+ };
10839
+ }
10840
+ },
10841
+ { projectScope: resolved.projectScope, quiet: globalOptions.quiet }
10842
+ );
10843
+ } catch (error) {
10844
+ if (options.wait && error instanceof CliError && error.exitCode !== 2) {
10845
+ throw new CliError(
10846
+ error.code,
10847
+ error.message,
10848
+ classifyLaunchErrorExitCode(error.code, error.details),
10849
+ error.details
10850
+ );
10851
+ }
10852
+ throw error;
10853
+ }
10854
+ if ("preview" in outcome) {
10855
+ writeResult({ preview: outcome.preview }, format);
10856
+ if (outcome.preview?.rerunnable !== true) setProcessExitCode(1);
10857
+ return;
10858
+ }
10859
+ const { rerun } = outcome;
10860
+ const run = "run" in outcome ? outcome.run : void 0;
10861
+ const waitError = "waitError" in outcome ? outcome.waitError : void 0;
10862
+ writeResult(
10863
+ { rerun, ...run ? { run } : {}, ...waitError ? { waitError } : {} },
10864
+ format
10865
+ );
10866
+ writeRunLink(format, webOrigin, {
10867
+ projectId: outcome.projectId,
10868
+ suiteId: rerun.suiteId,
10869
+ runId: rerun.runId
10870
+ });
10871
+ if (waitError) {
10872
+ throw cliError(
10873
+ "OPERATIONAL_ERROR",
10874
+ `Did not observe completion for: ${rerun.runId}. ${waitError.message}`,
10875
+ classifyWaitErrorExitCode(waitError.errorCode)
10876
+ );
10877
+ }
10878
+ if (run) {
10879
+ setProcessExitCode(
10880
+ evalRunWaitExitCode({
10881
+ launchOutcome: "started",
10882
+ runs: [{ status: run.status, result: run.result }],
10883
+ waitErrors: []
10884
+ })
10885
+ );
10886
+ }
10887
+ }
10888
+ );
10685
10889
  addProjectOption(
10686
10890
  evals.command("judge-backtest").description(
10687
10891
  "Preview draft grading instructions on recorded evidence (uses credits)"
@@ -11318,7 +11522,13 @@ ${summary}
11318
11522
  ).option(
11319
11523
  "--client <id-or-name...>",
11320
11524
  "Replace client attachments (by name or ID)"
11321
- ).option("--host <id-or-name...>", "Deprecated alias for --client").option("--model <id>", "Execution model id").option("--system-prompt <text>", "Execution system prompt").option("--temperature <n>", "Execution temperature").option(
11525
+ ).option("--host <id-or-name...>", "Deprecated alias for --client").option("--model <id>", "Execution model id").option(
11526
+ "--model-selection <json>",
11527
+ "Whole saved model selection for the suite (source, connection, settings.reasoningEffort), as JSON (or @file, or -). Must be for --model when both are given."
11528
+ ).option("--effort <level>", EFFORT_FLAG_DESCRIPTION).option(
11529
+ "--clear-effort",
11530
+ "Remove the reasoning effort from the suite's model selection"
11531
+ ).option("--system-prompt <text>", "Execution system prompt").option("--temperature <n>", "Execution temperature").option(
11322
11532
  "--min-accuracy <pct>",
11323
11533
  "Suite accuracy threshold: one percentage, 0\u2013100, over the whole run"
11324
11534
  ).option(
@@ -11516,6 +11726,9 @@ ${summary}
11516
11726
  ).option(
11517
11727
  "--compose-model <id>",
11518
11728
  "One model to run this case on. A matrix of models is suite-level (`eval run`) only."
11729
+ ).option(
11730
+ "--compose-model-selection <json>",
11731
+ "One whole saved model selection (source, connection, settings.reasoningEffort) as JSON (or @file, or -) to run this case on, at its effort."
11519
11732
  ).option(
11520
11733
  "--compose-server <id-or-name...>",
11521
11734
  "Server(s) to pin on the composed stack. Snapshots them into a server group, so the run keeps testing these servers even if the host's own server list changes later. Mutually exclusive with --compose-server-group."
@@ -11822,6 +12035,10 @@ var SETTABLE_FIELDS = {
11822
12035
  unsettable: false,
11823
12036
  note: "a client cannot be edited into one that pins no model"
11824
12037
  },
12038
+ // A whole selection as JSON (source, connection, settings.reasoningEffort).
12039
+ // `--unset modelSelection` drops the saved selection and keeps the bare
12040
+ // `modelId`. For just the effort on an existing selection use --effort.
12041
+ modelSelection: { kind: "json", unsettable: true },
11825
12042
  // Required-resettable: --unset resets to the canonical default.
11826
12043
  systemPrompt: { kind: "string", unsettable: true },
11827
12044
  temperature: { kind: "number", unsettable: true },
@@ -12000,6 +12217,9 @@ function registerClientsCommands(program) {
12000
12217
  ).option(
12001
12218
  "--unset <key...>",
12002
12219
  "Clear an optional field to absent, or reset a required one to its default. Repeatable"
12220
+ ).option("--effort <level>", EFFORT_FLAG_DESCRIPTION).option(
12221
+ "--clear-effort",
12222
+ "Remove the reasoning effort from the client's model selection"
12003
12223
  ).option(
12004
12224
  "--file <path>",
12005
12225
  "Replacement client config v2 JSON (or - for stdin)"
@@ -12011,6 +12231,7 @@ function registerClientsCommands(program) {
12011
12231
  const globalOptions = getGlobalOptions(command);
12012
12232
  const config = loadConfigObject(options);
12013
12233
  const set = buildSetBlock(options.set, options.unset);
12234
+ const reasoningEffort = effortShorthand(options);
12014
12235
  if (config !== void 0 && set !== void 0) {
12015
12236
  throw usageError(
12016
12237
  "Use either --set/--unset (named fields) or --file/--json (whole-config replacement), not both."
@@ -12023,7 +12244,8 @@ function registerClientsCommands(program) {
12023
12244
  ...options.expectedName !== void 0 ? { expectedName: options.expectedName } : {},
12024
12245
  ...options.expectedConfigId !== void 0 ? { expectedConfigId: options.expectedConfigId } : {},
12025
12246
  ...config !== void 0 ? { config } : {},
12026
- ...set !== void 0 ? { set } : {}
12247
+ ...set !== void 0 ? { set } : {},
12248
+ ...reasoningEffort !== void 0 ? { reasoningEffort } : {}
12027
12249
  });
12028
12250
  const result = await runPlatformOperation(
12029
12251
  platformOptionsOf(command),
@@ -14124,7 +14346,10 @@ function registerSessionsCommands(program) {
14124
14346
  ).option("--max-steps <n>", "Maximum engine steps this turn (1-16)").option(
14125
14347
  "--max-tool-calls <n>",
14126
14348
  "Cap the tool calls this turn may make. 0 answers without tools."
14127
- ).option("--temperature <n>", "Sampling temperature (0-2)")
14349
+ ).option("--temperature <n>", "Sampling temperature (0-2)").option(
14350
+ "--effort <level>",
14351
+ `${REQUEST_EFFORT_FLAG_DESCRIPTION} First turn only: pinned to the session, refused on a continuation. Replaces the temperature, so it cannot be combined with --temperature.`
14352
+ )
14128
14353
  )
14129
14354
  ),
14130
14355
  {
@@ -14155,7 +14380,8 @@ function registerSessionsCommands(program) {
14155
14380
  "--max-tool-calls",
14156
14381
  { min: 0, max: 16 }
14157
14382
  ),
14158
- temperature: parseFloatOption(options.temperature)
14383
+ temperature: parseFloatOption(options.temperature),
14384
+ reasoningEffort: options.effort !== void 0 ? parseEffortFlag(options.effort) : void 0
14159
14385
  }),
14160
14386
  // A Playground turn runs a model, and often tools with it. The 30s program
14161
14387
  // default expired mid-turn while the turn kept running and spending, which