@mcpjam/cli 3.26.0 → 3.27.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,18 +2,20 @@
2
2
  import { Command, CommanderError } from 'commander';
3
3
  import { realpathSync, mkdirSync, writeFileSync, readFileSync, existsSync, statSync, closeSync, renameSync, openSync } from 'fs';
4
4
  import { pathToFileURL } from 'url';
5
- import { probeMcpServer, redactForTelemetry, runServerDoctor, collectServerSnapshot, serializeStableServerSnapshot, serializeServerSnapshot, buildServerDiffReport, classifyMcpHeader, validateToolCallResult, isCallToolResultError, buildToolCallValidationReport, listResources, readResource, SubscriptionCoordinator, listTools, listPrompts, getPrompt, MCPAppsConformanceTest, scoreFromAppsResult, MCPAppsConformanceSuite, MCPTasksConformanceTest, scoreFromTasksResult, runOAuthLogin, OAuthConformanceTest, scoreFromOAuthResult, OAuthConformanceSuite, runXaaFlow, MCPConformanceTest, scoreFromProtocolResult, MCPConformanceSuite, openUrlInBrowser, withEphemeralClient, diffServerSnapshots, ServerSnapshotFormatError, renderStructuredRunJUnitXml, renderStructuredRunJson, DEFAULT_SUBSCRIPTION_RECONNECT_POLICY, isKnownProtocolVersion, describeConformanceScore, toConformanceReport, renderConformanceReportJUnitXml, renderConformanceReportJson, formatOAuthConformanceHuman, formatOAuthConformanceSuiteHuman, fetchOAuthMetadata, executeOAuthProxy, executeDebugOAuthProxy, normalizeRegistrationStrategy, normalizeXaaClientAuth, normalizeIdentityAssertionFormat, IDENTITY_ASSERTION_FORMATS, XAA_CONFIDENTIAL_CIMD_ORIGIN, getLocalConfidentialCimdProvider, MCP_PROTOCOL_VERSIONS, generateRandomString, generateCodeChallenge, createInteractiveAuthorizationSession, formatGateReport, detectFlakyCases, evaluateCompareGates, buildRunCompareReport, buildCorpus, HostedOnlyCaseError, verifyCorpusLock, MCPClientManager, 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, evaluateGates, gateInputFromPlatformRun, calculateLatencyStats, CORPUS_LOCK_VERSION, TaskLifecycleEngine, driveTaskToTerminal, extensionTaskToObservation, legacyTaskToObservation, passRateFractionFromPercent, isUnknownTaskError, isMCPTasksWireError, LEGACY_TASK_STATUSES } from '@mcpjam/sdk';
5
+ import { probeMcpServer, redactForTelemetry, runServerDoctor, collectServerSnapshot, serializeStableServerSnapshot, serializeServerSnapshot, buildServerDiffReport, classifyMcpHeader, validateToolCallResult, isCallToolResultError, buildToolCallValidationReport, listResources, readResource, SubscriptionCoordinator, listTools, listPrompts, getPrompt, MCPAppsConformanceTest, scoreFromAppsResult, MCPAppsConformanceSuite, MCPTasksConformanceTest, scoreFromTasksResult, runOAuthLogin, OAuthConformanceTest, scoreFromOAuthResult, OAuthConformanceSuite, runXaaFlow, MCPConformanceTest, scoreFromProtocolResult, MCPConformanceSuite, openUrlInBrowser, withEphemeralClient, diffServerSnapshots, ServerSnapshotFormatError, renderStructuredRunJUnitXml, renderStructuredRunJson, DEFAULT_SUBSCRIPTION_RECONNECT_POLICY, isKnownProtocolVersion, describeConformanceScore, toConformanceReport, renderConformanceReportJUnitXml, renderConformanceReportJson, formatOAuthConformanceHuman, formatOAuthConformanceSuiteHuman, fetchOAuthMetadata, executeOAuthProxy, executeDebugOAuthProxy, normalizeRegistrationStrategy, normalizeXaaClientAuth, normalizeIdentityAssertionFormat, IDENTITY_ASSERTION_FORMATS, XAA_CONFIDENTIAL_CIMD_ORIGIN, getLocalConfidentialCimdProvider, MCP_PROTOCOL_VERSIONS, generateRandomString, generateCodeChallenge, createInteractiveAuthorizationSession, formatGateReport, detectFlakyCases, evaluateCompareGates, buildRunCompareReport, loadEvalSuiteFile, formatSuiteFileFindings, serializeEvalSuiteFile, MAX_SUITE_FILE_BYTES, buildCorpus, HostedOnlyCaseError, verifyCorpusLock, MCPClientManager, 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, evaluateGates, gateInputFromPlatformRun, calculateLatencyStats, CORPUS_LOCK_VERSION, TaskLifecycleEngine, driveTaskToTerminal, extensionTaskToObservation, legacyTaskToObservation, passRateFractionFromPercent, suiteFilePointer, isUnknownTaskError, isMCPTasksWireError, LEGACY_TASK_STATUSES } from '@mcpjam/sdk';
6
6
  import { mkdir, writeFile, readFile, chmod, rename, rm, open, unlink } from 'fs/promises';
7
7
  import path2, { dirname, join, basename } from 'path';
8
8
  import { randomUUID, randomBytes } from 'crypto';
9
9
  import { spawn } from 'child_process';
10
10
  import { createRequire } from 'module';
11
11
  import os, { homedir } from 'os';
12
- import { createProjectOperation, updateProjectOperation, deleteProjectOperation, connectProjectServerOperation, getProjectServerConnectionStatusOperation, listEvalSuiteRunsOperation, cancelEvalRunOperation, listEvalRunIterationsOperation, getEvalIterationTraceOperation, getEvalRunStepsOperation, getEvalSuiteOperation, updateEvalSuiteOperation, deleteEvalSuiteOperation, setEvalSuiteScheduleOperation, setEvalSuiteEnvironmentsOperation, listEvalCasesOperation, getEvalCaseOperation, runEvalCaseOperation, createEvalCaseOperation, updateEvalCaseOperation, deleteEvalCaseOperation, generateEvalCasesOperation, listChatSessionsOperation, createHostOperation, updateHostOperation, setHostServersOperation, duplicateHostOperation, createEnvironmentOperation, updateEnvironmentOperation, createImageOperation, validateImageBlueprintOperation, updateImageOperation, createTunnelOperation, DEFAULT_PLATFORM_API_BASE_URL, PlatformApiClient, isPlatformApiError, PlatformApiError, listOrganizationsOperation, listProjectsOperation, listProjectServersOperation, createProjectServerOperation, getProjectServerOperation, updateProjectServerOperation, deleteProjectServerOperation, showServersOperation, createEvalSuiteOperation, listEvalSuitesOperation, runEvalSuiteOperation, getEvalRunOperation, resolveProject, listHostsOperation, getHostOperation, deleteHostOperation, listEnvironmentsOperation, getEnvironmentOperation, resolveEnvironmentOperation, getEnvironmentCapabilitiesOperation, archiveEnvironmentOperation, restoreEnvironmentOperation, listJourneysOperation, listJourneyRunsOperation, getJourneyRunOperation, launchJourneyRunOperation, cancelJourneyRunOperation, listJourneyRunSessionsOperation, listScenariosOperation, getScenarioOperation, publishScenarioOperation, unpublishScenarioOperation, listImagesOperation, getImageOperation, buildImageOperation, listImageBuildsOperation, useImageOperation, resetComputerOperation, promoteImageOperation, deleteImageOperation, getCapabilitiesOperation, listPersonasOperation, getPersonaOperation, createPersonaOperation, updatePersonaOperation, deletePersonaOperation, generatePersonasOperation, getJourneyOperation, createJourneyOperation, updateJourneyOperation, archiveJourneyOperation, generateJourneysOperation, getSwarmOverviewOperation, getJourneyRunScorecardOperation, listSwarmFindingsOperation, dismissSwarmFindingOperation, undismissSwarmFindingOperation, getWaveInsightsOperation, requestWaveInsightsOperation, cancelWaveInsightsOperation, listSwarmsOperation, getSwarmOperation, createSwarmOperation, updateSwarmOperation, archiveSwarmOperation, getUserTestingScenarioOperation, listUserTestingSessionsOperation, getUserTestingSessionOperation, getUserTestingMetricsOperation, getUserTestingUsageOperation, listUserTestingFindingsOperation, getUserTestingSignalsOperation, getUserTestingInsightsOperation, requestUserTestingInsightsOperation, cancelUserTestingInsightsOperation, dismissUserTestingFindingOperation, undismissUserTestingFindingOperation, updateUserTestingScenarioOperation, setUserTestingGuestExecutionOperation, rotateUserTestingLinkOperation, upsertUserTestingMemberOperation, removeUserTestingMemberOperation, rebindUserTestingScenarioOperation, searchSessionsOperation } from '@mcpjam/sdk/platform';
12
+ import { createProjectOperation, updateProjectOperation, deleteProjectOperation, connectProjectServerOperation, getProjectServerConnectionStatusOperation, listEvalSuiteRunsOperation, cancelEvalRunOperation, requestEvalRunJudgeOperation, listEvalCheckReposOperation, connectEvalCheckRepoOperation, listEvalRunIterationsOperation, getEvalIterationTraceOperation, getEvalRunStepsOperation, getEvalSuiteOperation, updateEvalSuiteOperation, deleteEvalSuiteOperation, setEvalSuiteScheduleOperation, setEvalSuiteEnvironmentsOperation, listEvalCasesOperation, getEvalCaseOperation, runEvalCaseOperation, createEvalCaseOperation, updateEvalCaseOperation, deleteEvalCaseOperation, generateEvalCasesOperation, listChatSessionsOperation, createHostOperation, updateHostOperation, setHostServersOperation, duplicateHostOperation, createEnvironmentOperation, ensureAdhocEnvironmentOperation, nameEnvironmentOperation, updateEnvironmentOperation, createImageOperation, validateImageBlueprintOperation, updateImageOperation, createTunnelOperation, DEFAULT_PLATFORM_API_BASE_URL, PlatformApiClient, isPlatformApiError, PlatformApiError, listOrganizationsOperation, listProjectsOperation, listProjectServersOperation, createProjectServerOperation, getProjectServerOperation, updateProjectServerOperation, deleteProjectServerOperation, showServersOperation, createEvalSuiteOperation, listEvalSuitesOperation, runEvalSuiteOperation, getEvalRunOperation, resolveProject, listHostsOperation, getHostOperation, deleteHostOperation, listEnvironmentsOperation, getEnvironmentOperation, resolveEnvironmentOperation, getEnvironmentCapabilitiesOperation, archiveEnvironmentOperation, restoreEnvironmentOperation, listJourneysOperation, listJourneyRunsOperation, getJourneyRunOperation, launchJourneyRunOperation, cancelJourneyRunOperation, listJourneyRunSessionsOperation, listScenariosOperation, getScenarioOperation, publishScenarioOperation, unpublishScenarioOperation, listImagesOperation, getImageOperation, buildImageOperation, listImageBuildsOperation, useImageOperation, resetComputerOperation, promoteImageOperation, deleteImageOperation, getCapabilitiesOperation, listPersonasOperation, getPersonaOperation, createPersonaOperation, updatePersonaOperation, deletePersonaOperation, generatePersonasOperation, getJourneyOperation, createJourneyOperation, updateJourneyOperation, archiveJourneyOperation, generateJourneysOperation, getSwarmOverviewOperation, getJourneyRunScorecardOperation, listSwarmFindingsOperation, dismissSwarmFindingOperation, undismissSwarmFindingOperation, getWaveInsightsOperation, requestWaveInsightsOperation, cancelWaveInsightsOperation, listSwarmsOperation, getSwarmOperation, createSwarmOperation, updateSwarmOperation, archiveSwarmOperation, getUserTestingScenarioOperation, listUserTestingSessionsOperation, getUserTestingSessionOperation, getUserTestingMetricsOperation, getUserTestingUsageOperation, listUserTestingFindingsOperation, getUserTestingSignalsOperation, getUserTestingInsightsOperation, requestUserTestingInsightsOperation, cancelUserTestingInsightsOperation, dismissUserTestingFindingOperation, undismissUserTestingFindingOperation, updateUserTestingScenarioOperation, setUserTestingGuestExecutionOperation, rotateUserTestingLinkOperation, upsertUserTestingMemberOperation, removeUserTestingMemberOperation, rebindUserTestingScenarioOperation, searchSessionsOperation } from '@mcpjam/sdk/platform';
13
13
  import { buildHostProfilesFromCatalog, buildMarketHostProfiles, scanWidgetUsage, evaluateMarketHosts, fetchHostCompatCatalog } from '@mcpjam/sdk/host-compat';
14
14
  import { HOST_TEMPLATES as HOST_TEMPLATES$1, HOST_TEMPLATE_IDS, seedHostTemplate } from '@mcpjam/sdk/host-config/templates';
15
15
  import { applyVisibilityPolicyAndCountSignals, isAppOnlyTool, extractHostExecutionPolicy, hostConnectionProfile } from '@mcpjam/sdk/host-config/internal';
16
16
  import * as readline from 'readline/promises';
17
+ import { isDeepStrictEqual } from 'util';
18
+ import { evalSuiteFileSchema, isOpaqueId } from '@mcpjam/sdk/contract';
17
19
  import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
18
20
  import { McpServer } from '@modelcontextprotocol/server';
19
21
  import { z } from 'zod';
@@ -25,7 +27,7 @@ import { WebSocket } from 'ws';
25
27
 
26
28
  // package.json
27
29
  var package_default = {
28
- version: "3.26.0"};
30
+ version: "3.27.0"};
29
31
  function conformanceExitCode(result) {
30
32
  if (result.outcome === "incomplete") return 3;
31
33
  if (result.outcome === "failed") return 1;
@@ -762,7 +764,7 @@ function isAccessTokenUsable(contents, now) {
762
764
  }
763
765
  return Date.parse(contents.expiresAt) - now.getTime() > ACCESS_TOKEN_EXPIRY_SKEW_MS;
764
766
  }
765
- var readTextFile = (path7, encoding) => readFileSync(path7, encoding);
767
+ var readTextFile = (path8, encoding) => readFileSync(path8, encoding);
766
768
  var JsonInputContext = class {
767
769
  constructor(readFile2 = readTextFile) {
768
770
  this.readFile = readFile2;
@@ -1580,7 +1582,7 @@ var InspectorApiClient = class {
1580
1582
  }
1581
1583
  throw operationalError("Inspector command response was invalid.", payload);
1582
1584
  }
1583
- async request(path7, init = {}) {
1585
+ async request(path8, init = {}) {
1584
1586
  const fetchRequest = async () => {
1585
1587
  const token = await fetchInspectorSessionToken(this.baseUrl);
1586
1588
  const { body: initBody, timeoutMs, ...fetchInit } = init;
@@ -1591,7 +1593,7 @@ var InspectorApiClient = class {
1591
1593
  headers.set("Content-Type", "application/json");
1592
1594
  body = JSON.stringify(initBody);
1593
1595
  }
1594
- return await fetch(`${this.baseUrl}${path7}`, {
1596
+ return await fetch(`${this.baseUrl}${path8}`, {
1595
1597
  ...fetchInit,
1596
1598
  signal: fetchInit.signal ?? AbortSignal.timeout(timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS),
1597
1599
  headers,
@@ -1614,7 +1616,7 @@ var InspectorApiClient = class {
1614
1616
  const payload = await readResponsePayload(response);
1615
1617
  if (!response.ok) {
1616
1618
  throw operationalError(
1617
- getErrorMessage(payload) ?? `Inspector request ${path7} failed with ${response.status}.`,
1619
+ getErrorMessage(payload) ?? `Inspector request ${path8} failed with ${response.status}.`,
1618
1620
  payload
1619
1621
  );
1620
1622
  }
@@ -4780,6 +4782,72 @@ function registerEnvironmentsCommands(program) {
4780
4782
  writeResult(result, globalOptions.format);
4781
4783
  }
4782
4784
  );
4785
+ addPlatformOptions3(
4786
+ environments.command("ensure-adhoc").description(
4787
+ "Get or create an UNNAMED environment for a composed stack. Deduplicated by content: the same stack always returns the same environment"
4788
+ ).requiredOption(
4789
+ "--host <id-or-name>",
4790
+ "Host the composed stack runs as \u2014 the client whose configuration a run is stamped with"
4791
+ ).option("--project <id-or-name>", "Project name or ID").option(
4792
+ "--server-group <id>",
4793
+ "Standalone server group to pin (omit to use the host's own servers)"
4794
+ ).option(
4795
+ "--model <id>",
4796
+ "Model to run instead of the host's pinned one (stored verbatim)"
4797
+ ).option(
4798
+ "--computer <id-or-name>",
4799
+ "Project-shared sandbox image to pin, so runs boot a fresh computer from it"
4800
+ ).option(
4801
+ "--skill <id...>",
4802
+ "Project-shared skill IDs to pin on the composed stack"
4803
+ )
4804
+ ).action(
4805
+ async (options, command) => {
4806
+ const globalOptions = getGlobalOptions(command);
4807
+ const input = validateInput2(ensureAdhocEnvironmentOperation, {
4808
+ ...options.project !== void 0 ? { project: options.project } : {},
4809
+ host: options.host,
4810
+ ...options.serverGroup !== void 0 ? { serverGroup: options.serverGroup } : {},
4811
+ ...options.model !== void 0 ? { model: options.model } : {},
4812
+ ...options.computer !== void 0 ? { computer: options.computer } : {},
4813
+ ...options.skill?.length ? { skills: { mode: "explicit", skillIds: options.skill } } : {}
4814
+ });
4815
+ const result = await runPlatformCommand3(
4816
+ options,
4817
+ globalOptions.timeout,
4818
+ ({ client, signal }) => ensureAdhocEnvironmentOperation.execute(input, { client, signal })
4819
+ );
4820
+ writeResult(result, globalOptions.format);
4821
+ }
4822
+ );
4823
+ addPlatformOptions3(
4824
+ environments.command("name").description(
4825
+ "Promote an UNNAMED (ad-hoc) environment to a named one, in place \u2014 the same id every existing run points at"
4826
+ ).requiredOption(
4827
+ "--environment <id>",
4828
+ "The ad-hoc environment to promote, by ID (an unnamed environment has no name to select it by)"
4829
+ ).requiredOption("--name <name>", "Display name for the promoted environment").requiredOption(
4830
+ "--expected-revision <n>",
4831
+ "The revision you last read; a stale value is rejected instead of overwriting a concurrent edit"
4832
+ ).option("--project <id-or-name>", "Project name or ID").option("--description <text>", "Optional description")
4833
+ ).action(
4834
+ async (options, command) => {
4835
+ const globalOptions = getGlobalOptions(command);
4836
+ const input = validateInput2(nameEnvironmentOperation, {
4837
+ ...options.project !== void 0 ? { project: options.project } : {},
4838
+ environment: options.environment,
4839
+ name: options.name,
4840
+ expectedRevision: parseRevision(options.expectedRevision),
4841
+ ...options.description !== void 0 ? { description: options.description } : {}
4842
+ });
4843
+ const result = await runPlatformCommand3(
4844
+ options,
4845
+ globalOptions.timeout,
4846
+ ({ client, signal }) => nameEnvironmentOperation.execute(input, { client, signal })
4847
+ );
4848
+ writeResult(result, globalOptions.format);
4849
+ }
4850
+ );
4783
4851
  addPlatformOptions3(
4784
4852
  environments.command("update").description(
4785
4853
  "Edit an environment. Only the fields you pass change; use --clear-model, or --file/--json with a null value, to clear serverAttachmentId, modelId, skillSelection, pluginVersionIds, or sandboxImageId"
@@ -6154,6 +6222,483 @@ function screenshotFilename(shot, index) {
6154
6222
  const suffix = shot.toolCallId ? shot.toolCallId.replace(/[^a-zA-Z0-9_-]+/g, "-") : String(index + 1);
6155
6223
  return `${tool}-${suffix}.png`;
6156
6224
  }
6225
+ async function writeFileAtomic(destinationPath, body, options = {}) {
6226
+ const resolved = path2.resolve(process.cwd(), destinationPath);
6227
+ const temporary = `${resolved}.${process.pid}-${randomBytes(6).toString(
6228
+ "hex"
6229
+ )}.tmp`;
6230
+ let renamed = false;
6231
+ try {
6232
+ if (options.createParents) {
6233
+ await mkdir(path2.dirname(resolved), { recursive: true });
6234
+ }
6235
+ await writeFile(temporary, body, {
6236
+ encoding: "utf8",
6237
+ mode: options.mode ?? 420
6238
+ });
6239
+ const handle = await open(temporary, "r+");
6240
+ try {
6241
+ await handle.sync();
6242
+ } finally {
6243
+ await handle.close();
6244
+ }
6245
+ await rename(temporary, resolved);
6246
+ renamed = true;
6247
+ await syncDirectory(path2.dirname(resolved));
6248
+ } catch (error) {
6249
+ if (!renamed) {
6250
+ await unlink(temporary).catch(() => {
6251
+ });
6252
+ }
6253
+ throw error;
6254
+ }
6255
+ return resolved;
6256
+ }
6257
+ async function syncDirectory(directoryPath) {
6258
+ if (process.platform === "win32") return;
6259
+ const handle = await open(directoryPath, "r");
6260
+ try {
6261
+ await handle.sync();
6262
+ } finally {
6263
+ await handle.close();
6264
+ }
6265
+ }
6266
+ var UNSUPPORTED_SUITE_EXPORT = "UNSUPPORTED_SUITE_EXPORT";
6267
+ function unsupported(path8, message) {
6268
+ return {
6269
+ code: UNSUPPORTED_SUITE_EXPORT,
6270
+ path: path8,
6271
+ pointer: suiteFilePointer(path8),
6272
+ message
6273
+ };
6274
+ }
6275
+ function suiteFileTooLarge(bytes, limit) {
6276
+ return unsupported(
6277
+ [],
6278
+ `the suite serializes to ${bytes} bytes, over the ${limit}-byte limit a suite file may be. Nothing was written. Split the suite into smaller ones and export each \u2014 this never truncates.`
6279
+ );
6280
+ }
6281
+ function percentToFraction(percent) {
6282
+ if (!Number.isFinite(percent)) return null;
6283
+ const text = plainDecimal(percent);
6284
+ const match = /^(-?)(\d+)(?:\.(\d+))?$/.exec(text);
6285
+ if (!match) return null;
6286
+ const [, sign, whole, decimals = ""] = match;
6287
+ const digits = `${whole}${decimals}`;
6288
+ const pointAt = whole.length - 2;
6289
+ const shifted = pointAt <= 0 ? `0.${"0".repeat(-pointAt)}${digits}` : `${digits.slice(0, pointAt)}.${digits.slice(pointAt)}`;
6290
+ const normalized = `${sign}${shifted}`.replace(/\.?0+$/, "");
6291
+ const value = Number(
6292
+ normalized === "" || normalized === "-" ? "0" : normalized
6293
+ );
6294
+ if (!Number.isFinite(value)) return null;
6295
+ return plainDecimal(value) === normalized ? value : null;
6296
+ }
6297
+ function plainDecimal(value) {
6298
+ const text = value.toString();
6299
+ const match = /^(-?)(\d)(?:\.(\d+))?e-(\d+)$/.exec(text);
6300
+ if (!match) return text;
6301
+ const [, sign, lead, rest = "", exponent] = match;
6302
+ return `${sign}0.${"0".repeat(Number(exponent) - 1)}${lead}${rest}`;
6303
+ }
6304
+ var NEUTRAL_MATCH_OPTIONS = {
6305
+ toolCallOrder: "any",
6306
+ extraToolCalls: "unlimited",
6307
+ arguments: "partial"
6308
+ };
6309
+ function isNeutralMatchOptions(options) {
6310
+ if (!options) return true;
6311
+ const order = options.toolCallOrder ?? NEUTRAL_MATCH_OPTIONS.toolCallOrder;
6312
+ const extras = options.extraToolCalls ?? NEUTRAL_MATCH_OPTIONS.extraToolCalls;
6313
+ const args = options.arguments ?? NEUTRAL_MATCH_OPTIONS.arguments;
6314
+ return order === NEUTRAL_MATCH_OPTIONS.toolCallOrder && extras === NEUTRAL_MATCH_OPTIONS.extraToolCalls && args === NEUTRAL_MATCH_OPTIONS.arguments;
6315
+ }
6316
+ function exportedCaseId(evalCase, index) {
6317
+ const declared = evalCase.declaredId?.trim();
6318
+ if (declared && isOpaqueId(declared)) return { id: declared };
6319
+ if (isOpaqueId(evalCase.id)) return { id: evalCase.id };
6320
+ return {
6321
+ finding: unsupported(
6322
+ ["cases", index, "id"],
6323
+ `case "${evalCase.title}" has neither a declared id nor a platform id that satisfies the opaque-id rule, and this exporter never mints one \u2014 a fresh id on every export forks the case's history. Give the case a declared id in the dashboard and export again.`
6324
+ )
6325
+ };
6326
+ }
6327
+ function suiteLevelFindings(detail, cases) {
6328
+ const findings = [];
6329
+ const settings = detail.settings;
6330
+ if (!isOpaqueId(detail.id)) {
6331
+ findings.push(
6332
+ unsupported(
6333
+ ["id"],
6334
+ `suite id ${JSON.stringify(detail.id)} is not an opaque id (1-128 of A-Z a-z 0-9 _ -), so it cannot be written to a file`
6335
+ )
6336
+ );
6337
+ }
6338
+ const name = detail.name?.trim() ?? "";
6339
+ if (name === "") {
6340
+ findings.push(
6341
+ unsupported(
6342
+ ["name"],
6343
+ "suite has no name; a suite file requires one. Name the suite in the dashboard and export again."
6344
+ )
6345
+ );
6346
+ }
6347
+ const legacyServers = detail.environment?.servers ?? [];
6348
+ const environmentIds = detail.environmentIds ?? [];
6349
+ if (legacyServers.length > 0 && environmentIds.length > 0) {
6350
+ findings.push(
6351
+ unsupported(
6352
+ ["environmentIds"],
6353
+ `suite has both a legacy server selection (${legacyServers.length}) and ${environmentIds.length} attached project environment(s). Which one a run uses is a platform decision the file cannot record, and choosing one here would change what runs.`
6354
+ )
6355
+ );
6356
+ } else if (environmentIds.length > 0) {
6357
+ findings.push(
6358
+ unsupported(
6359
+ ["environmentIds"],
6360
+ `suite runs against ${environmentIds.length} attached project environment(s). A suite file names an environment, and this command resolves an id to a name only from what it already fetched \u2014 it makes no second call \u2014 so the name is not available here.`
6361
+ )
6362
+ );
6363
+ } else if (legacyServers.length === 0) {
6364
+ findings.push(
6365
+ unsupported(
6366
+ ["environment", "servers"],
6367
+ "suite selects no servers; a suite file requires at least one"
6368
+ )
6369
+ );
6370
+ }
6371
+ if (detail.environment?.computerEnvironment) {
6372
+ findings.push(
6373
+ unsupported(
6374
+ ["environment", "computerEnvironment"],
6375
+ `suite pins the sandbox image "${detail.environment.computerEnvironment.name ?? detail.environment.computerEnvironment.id}", which a suite file has no field for. Dropping it would boot runs from a different image than the dashboard does.`
6376
+ )
6377
+ );
6378
+ }
6379
+ const execution = detail.executionConfig;
6380
+ if (execution === null || execution === void 0) {
6381
+ findings.push(
6382
+ unsupported(
6383
+ ["executionConfig"],
6384
+ "suite pins no execution model, and `defaults.model` is required in a suite file. There is no way to say 'no default model', and inventing one changes what runs. Set the suite's model and export again."
6385
+ )
6386
+ );
6387
+ } else {
6388
+ const systemPrompt = execution.systemPrompt;
6389
+ if (typeof systemPrompt === "string" && systemPrompt.trim() !== "") {
6390
+ findings.push(
6391
+ unsupported(
6392
+ ["executionConfig", "systemPrompt"],
6393
+ "suite pins an execution system prompt, which a suite file has no field for. Dropping it would run every case without the instructions the dashboard gives them."
6394
+ )
6395
+ );
6396
+ }
6397
+ const temperature = execution.temperature;
6398
+ if (typeof temperature === "number") {
6399
+ findings.push(
6400
+ unsupported(
6401
+ ["executionConfig", "temperature"],
6402
+ `suite pins execution temperature ${temperature}, which a suite file has no field for. There is no provider-independent "neutral" temperature to compare it against, so it cannot be dropped as a no-op.`
6403
+ )
6404
+ );
6405
+ }
6406
+ }
6407
+ const hosts = detail.hosts ?? [];
6408
+ if (hosts.length > 0) {
6409
+ findings.push(
6410
+ unsupported(
6411
+ ["hosts"],
6412
+ `suite has ${hosts.length} host attachment(s) (${hosts.map((host) => host.name || host.id).join(", ")}), which a suite file has no field for. Dropping them changes what runs.`
6413
+ )
6414
+ );
6415
+ }
6416
+ if (settings.minimumAccuracy === null || settings.minimumAccuracy === void 0) {
6417
+ findings.push(
6418
+ unsupported(
6419
+ ["settings", "minimumAccuracy"],
6420
+ "suite sets no minimum accuracy, and `defaults.passThreshold` is required in a suite file. Set one and export again."
6421
+ )
6422
+ );
6423
+ } else if (settings.minimumAccuracy < 0 || settings.minimumAccuracy > 100 || percentToFraction(settings.minimumAccuracy) === null) {
6424
+ findings.push(
6425
+ unsupported(
6426
+ ["settings", "minimumAccuracy"],
6427
+ `minimum accuracy ${settings.minimumAccuracy} does not convert to a fraction in [0,1] without losing a digit; a suite file's \`passThreshold\` is a fraction, never a percent`
6428
+ )
6429
+ );
6430
+ }
6431
+ const floor = settings.minimumIterations;
6432
+ if (typeof floor === "number") {
6433
+ const raised = cases.filter((entry) => (entry.iterations ?? 0) < floor);
6434
+ if (raised.length > 0) {
6435
+ findings.push(
6436
+ unsupported(
6437
+ ["settings", "minimumIterations"],
6438
+ `suite floors per-case iterations at ${floor}, raising ${raised.length} case(s) above their own count. A suite file has no floor, so those cases would run fewer times from the file than they do hosted.`
6439
+ )
6440
+ );
6441
+ }
6442
+ }
6443
+ if (!isNeutralMatchOptions(settings.matchOptions)) {
6444
+ findings.push(
6445
+ unsupported(
6446
+ ["settings", "matchOptions"],
6447
+ `suite pins non-default match options (${JSON.stringify(
6448
+ settings.matchOptions
6449
+ )}), which a suite file has no field for and which no predicate reproduces exactly`
6450
+ )
6451
+ );
6452
+ }
6453
+ if (settings.judge?.enabled === true || settings.judge?.autoRun === true) {
6454
+ findings.push(
6455
+ unsupported(
6456
+ ["settings", "judge"],
6457
+ "suite has LLM-as-judge grading available or automatic, and a suite file has no judge vocabulary. Exporting it would produce a file that grades with deterministic assertions alone."
6458
+ )
6459
+ );
6460
+ }
6461
+ return findings;
6462
+ }
6463
+ function caseLevelFindings(evalCase, index, suiteChecks) {
6464
+ const findings = [];
6465
+ const models = evalCase.models ?? [];
6466
+ const steps = evalCase.steps ?? [];
6467
+ if (models.length > 1) {
6468
+ findings.push(
6469
+ unsupported(
6470
+ ["cases", index, "models"],
6471
+ `case "${evalCase.title}" runs against ${models.length} models (${models.map((entry) => entry.model).join(", ")}); a suite file's \`model\` is one id, and a compare-across-models case has no single-model representation`
6472
+ )
6473
+ );
6474
+ }
6475
+ if (evalCase.scenario !== void 0 && evalCase.scenario !== null) {
6476
+ findings.push(
6477
+ unsupported(
6478
+ ["cases", index, "scenario"],
6479
+ `case "${evalCase.title}" is bound to scenario "${evalCase.scenario}", which a suite file has no field for`
6480
+ )
6481
+ );
6482
+ }
6483
+ if (!isNeutralMatchOptions(evalCase.matchOptions)) {
6484
+ findings.push(
6485
+ unsupported(
6486
+ ["cases", index, "matchOptions"],
6487
+ `case "${evalCase.title}" pins non-default match options (${JSON.stringify(
6488
+ evalCase.matchOptions
6489
+ )}), which a suite file has no field for and which no predicate reproduces exactly`
6490
+ )
6491
+ );
6492
+ }
6493
+ const checks = evalCase.checks;
6494
+ const checkList = checks?.list ?? [];
6495
+ if (checks && checks.mode !== "inherit") {
6496
+ findings.push(
6497
+ unsupported(
6498
+ ["cases", index, "checks"],
6499
+ `case "${evalCase.title}" ${checks.mode}s the suite's checks. A suite file has no inheritance vocabulary: every case carries its own flat \`assertions\`, so there is nothing for a "${checks.mode}" to mean.`
6500
+ )
6501
+ );
6502
+ } else if (checks && checks.mode === "inherit" && checkList.length > 0) {
6503
+ findings.push(
6504
+ unsupported(
6505
+ ["cases", index, "checks", "list"],
6506
+ `case "${evalCase.title}" inherits the suite's checks but also carries ${checkList.length} of its own. The hosted run ignores them; a file would have to drop them outright, which this refuses to do silently.`
6507
+ )
6508
+ );
6509
+ }
6510
+ if (steps.length === 0) {
6511
+ findings.push(
6512
+ unsupported(
6513
+ ["cases", index, "steps"],
6514
+ `case "${evalCase.title}" has no steps; a suite-file case requires at least one`
6515
+ )
6516
+ );
6517
+ }
6518
+ suiteChecks.forEach((check, ordinal) => {
6519
+ if (check && typeof check === "object" && !Array.isArray(check)) return;
6520
+ findings.push(
6521
+ unsupported(
6522
+ ["cases", index, "assertions", ordinal],
6523
+ `the suite's check at position ${ordinal} is not an object, so it cannot be written as an assertion on case "${evalCase.title}"`
6524
+ )
6525
+ );
6526
+ });
6527
+ return findings;
6528
+ }
6529
+ function modalRepetitions(counts) {
6530
+ if (counts.length === 0) return 1;
6531
+ const tally = /* @__PURE__ */ new Map();
6532
+ for (const count of counts) {
6533
+ tally.set(count, (tally.get(count) ?? 0) + 1);
6534
+ }
6535
+ let best = counts[0];
6536
+ let bestSeen = 0;
6537
+ for (const [value, seen] of [...tally.entries()].sort(
6538
+ (a, b) => a[0] - b[0]
6539
+ )) {
6540
+ if (seen > bestSeen) {
6541
+ best = value;
6542
+ bestSeen = seen;
6543
+ }
6544
+ }
6545
+ return best;
6546
+ }
6547
+ function hoistProvider(cases) {
6548
+ const declared = cases.map((entry, index) => ({
6549
+ index,
6550
+ provider: entry.models?.[0]?.provider,
6551
+ declares: (entry.models ?? []).length > 0
6552
+ })).filter((row) => row.declares);
6553
+ if (declared.length === 0) return { ok: true };
6554
+ const distinct = [...new Set(declared.map((row) => row.provider))];
6555
+ if (distinct.length <= 1) {
6556
+ const [only] = distinct;
6557
+ return only === void 0 || only === "" ? { ok: true } : { ok: true, provider: only };
6558
+ }
6559
+ const disagreeing = declared.find(
6560
+ (row) => row.provider !== declared[0].provider
6561
+ );
6562
+ return {
6563
+ ok: false,
6564
+ finding: unsupported(
6565
+ ["cases", disagreeing?.index ?? 0, "models", 0, "provider"],
6566
+ `cases disagree about their model provider (${distinct.map((value) => JSON.stringify(value ?? null)).join(", ")}), and a suite file carries one suite-level provider`
6567
+ )
6568
+ };
6569
+ }
6570
+ function differences(expected, actual, path8 = [], out = []) {
6571
+ if (isDeepStrictEqual(expected, actual)) return out;
6572
+ const before = out.length;
6573
+ if (Array.isArray(expected) && Array.isArray(actual)) {
6574
+ const length = Math.max(expected.length, actual.length);
6575
+ for (let index = 0; index < length; index += 1) {
6576
+ differences(expected[index], actual[index], [...path8, index], out);
6577
+ }
6578
+ if (out.length === before) out.push(path8);
6579
+ return out;
6580
+ }
6581
+ const bothObjects = expected !== null && actual !== null && typeof expected === "object" && typeof actual === "object" && !Array.isArray(expected) && !Array.isArray(actual);
6582
+ if (bothObjects) {
6583
+ const keys = [
6584
+ .../* @__PURE__ */ new Set([
6585
+ ...Object.keys(expected),
6586
+ ...Object.keys(actual)
6587
+ ])
6588
+ ].sort();
6589
+ for (const key of keys) {
6590
+ differences(
6591
+ expected[key],
6592
+ actual[key],
6593
+ [...path8, key],
6594
+ out
6595
+ );
6596
+ }
6597
+ if (out.length === before) out.push(path8);
6598
+ return out;
6599
+ }
6600
+ out.push(path8);
6601
+ return out;
6602
+ }
6603
+ function buildSuiteFileFromPlatform(input) {
6604
+ const { detail, cases } = input;
6605
+ const suiteChecks = detail.settings.checks ?? [];
6606
+ const findings = suiteLevelFindings(detail, cases);
6607
+ cases.forEach((evalCase, index) => {
6608
+ findings.push(...caseLevelFindings(evalCase, index, suiteChecks));
6609
+ });
6610
+ if (cases.length === 0) {
6611
+ findings.push(
6612
+ unsupported(
6613
+ ["cases"],
6614
+ "suite has no cases; a suite file requires at least one"
6615
+ )
6616
+ );
6617
+ }
6618
+ const provider = hoistProvider(cases);
6619
+ const hoistedProvider = provider.ok ? provider.provider : void 0;
6620
+ if (!provider.ok) findings.push(provider.finding);
6621
+ const caseIds = [];
6622
+ cases.forEach((evalCase, index) => {
6623
+ const resolved = exportedCaseId(evalCase, index);
6624
+ if ("finding" in resolved) {
6625
+ findings.push(resolved.finding);
6626
+ return;
6627
+ }
6628
+ caseIds.push(resolved.id);
6629
+ });
6630
+ if (findings.length > 0) return { ok: false, findings };
6631
+ const repetitions = modalRepetitions(cases.map((entry) => entry.iterations));
6632
+ const suiteModel = detail.executionConfig?.model;
6633
+ const assertions = suiteChecks;
6634
+ const candidate = {
6635
+ schemaVersion: "1",
6636
+ mode: "agentWorkflow",
6637
+ reportingMode: "standard",
6638
+ suite: {
6639
+ id: detail.id,
6640
+ name: (detail.name ?? "").trim(),
6641
+ ...detail.description === null || detail.description === void 0 ? {} : { description: detail.description }
6642
+ },
6643
+ target: {
6644
+ servers: (detail.environment?.servers ?? []).map((name) => ({ name }))
6645
+ },
6646
+ defaults: {
6647
+ model: suiteModel,
6648
+ ...hoistedProvider === void 0 ? {} : { provider: hoistedProvider },
6649
+ repetitions,
6650
+ passThreshold: percentToFraction(
6651
+ detail.settings.minimumAccuracy
6652
+ ),
6653
+ // `{}`, not the resolved defaults: the contract documents them and the
6654
+ // loader applies them, and writing them here would put values nobody
6655
+ // authored into the file (`sdk/src/contract/suite-file.ts:12-17`).
6656
+ validity: {}
6657
+ },
6658
+ // `provenance` and `cases[].import` are NEVER written by export. This is a
6659
+ // hosted READ, not a conversion from a foreign format, and claiming an
6660
+ // import status for it would assert a faithfulness claim about a mapping
6661
+ // that never happened.
6662
+ cases: cases.map((evalCase, index) => ({
6663
+ id: caseIds[index],
6664
+ title: evalCase.title,
6665
+ ...evalCase.iterations === repetitions ? {} : { repetitions: evalCase.iterations },
6666
+ ...evalCase.isNegative ? { isNegativeTest: true } : {},
6667
+ ...evalCase.expectedOutput === void 0 || evalCase.expectedOutput === null ? {} : { expectedOutput: evalCase.expectedOutput },
6668
+ ...evalCase.models?.[0]?.model === void 0 || evalCase.models[0].model === suiteModel ? {} : { model: evalCase.models[0].model },
6669
+ steps: evalCase.steps,
6670
+ ...assertions && assertions.length > 0 ? { assertions } : {}
6671
+ }))
6672
+ };
6673
+ const parsed = evalSuiteFileSchema.safeParse(candidate);
6674
+ if (!parsed.success) {
6675
+ return {
6676
+ ok: false,
6677
+ findings: parsed.error.issues.map(
6678
+ (issue) => unsupported(
6679
+ [...issue.path],
6680
+ `the exported suite file would be invalid: ${issue.message}`
6681
+ )
6682
+ )
6683
+ };
6684
+ }
6685
+ const lost = differences(candidate, parsed.data);
6686
+ if (lost.length > 0) {
6687
+ return {
6688
+ ok: false,
6689
+ findings: lost.map(
6690
+ (path8) => unsupported(
6691
+ path8,
6692
+ `the suite file contract does not carry this value, so exporting would drop it. Nothing was written.`
6693
+ )
6694
+ )
6695
+ };
6696
+ }
6697
+ return { ok: true, file: parsed.data };
6698
+ }
6699
+ function defaultSuiteFilePath(suiteId) {
6700
+ return `.mcpjam/evals/${suiteId}.yaml`;
6701
+ }
6157
6702
  var DEFAULT_CORPUS_LOCK_PATH = "mcpjam-evals.lock.json";
6158
6703
  var CORPUS_DRIFT_EXIT_CODE = 1;
6159
6704
  var CORPUS_INCOMPLETE_EXIT_CODE = 3;
@@ -6292,30 +6837,17 @@ async function readCorpusLock(lockPath) {
6292
6837
  }
6293
6838
  async function writeCorpusLockAtomic(lockPath, lock) {
6294
6839
  const resolved = path2.resolve(process.cwd(), lockPath);
6295
- const temporary = `${resolved}.${process.pid}-${randomBytes(6).toString(
6296
- "hex"
6297
- )}.tmp`;
6298
6840
  try {
6299
6841
  const body = `${JSON.stringify(lock, null, 2)}
6300
6842
  `;
6301
- await writeFile(temporary, body, { encoding: "utf8", mode: 420 });
6302
- const handle = await open(temporary, "r+");
6303
- try {
6304
- await handle.sync();
6305
- } finally {
6306
- await handle.close();
6307
- }
6308
- await rename(temporary, resolved);
6843
+ return await writeFileAtomic(resolved, body);
6309
6844
  } catch (error) {
6310
- await unlink(temporary).catch(() => {
6311
- });
6312
6845
  throw incomplete(
6313
6846
  "CORPUS_LOCK_WRITE_FAILED",
6314
6847
  `Failed to write the corpus lock to "${resolved}". The previous lock, if any, is unchanged.`,
6315
6848
  { source: error instanceof Error ? error.message : String(error) }
6316
6849
  );
6317
6850
  }
6318
- return resolved;
6319
6851
  }
6320
6852
  var DRIFT_LABELS = {
6321
6853
  caseAdded: "added ",
@@ -6637,6 +7169,94 @@ function addPlatformOptions7(command) {
6637
7169
  "MCPJam API base URL (defaults to https://app.mcpjam.com/api/v1)"
6638
7170
  );
6639
7171
  }
7172
+ function selectorField(singular, plural, values) {
7173
+ if (!values?.length) return {};
7174
+ return values.length === 1 ? { [singular]: values[0] } : { [plural]: values };
7175
+ }
7176
+ function composeField(options) {
7177
+ const refinements = options.composeComputer !== void 0 || options.composeModel !== void 0 || options.composeServerGroup !== void 0 || (options.composeSkill?.length ?? 0) > 0;
7178
+ if (!options.composeHost) {
7179
+ if (refinements) {
7180
+ throw usageError(
7181
+ "--compose-* flags need --compose-host: the host is what the composed stack runs as, and the others only refine it."
7182
+ );
7183
+ }
7184
+ return {};
7185
+ }
7186
+ return {
7187
+ compose: {
7188
+ host: options.composeHost,
7189
+ ...options.composeServerGroup !== void 0 ? { serverGroup: options.composeServerGroup } : {},
7190
+ ...options.composeModel !== void 0 ? { model: options.composeModel } : {},
7191
+ ...options.composeComputer !== void 0 ? { computer: options.composeComputer } : {},
7192
+ ...options.composeSkill?.length ? {
7193
+ skills: {
7194
+ mode: "explicit",
7195
+ skillIds: options.composeSkill
7196
+ }
7197
+ } : {}
7198
+ }
7199
+ };
7200
+ }
7201
+ function parseIntOption(raw, flag) {
7202
+ if (raw.trim() === "") {
7203
+ throw usageError(`${flag} requires a value.`);
7204
+ }
7205
+ const parsed = Number(raw);
7206
+ if (!Number.isInteger(parsed)) {
7207
+ throw usageError(`${flag} must be a whole number (got "${raw}").`);
7208
+ }
7209
+ return parsed;
7210
+ }
7211
+ function parseNumberOption(raw, flag) {
7212
+ if (raw.trim() === "") {
7213
+ throw usageError(`${flag} requires a value.`);
7214
+ }
7215
+ const parsed = Number(raw);
7216
+ if (!Number.isFinite(parsed)) {
7217
+ throw usageError(`${flag} must be a number (got "${raw}").`);
7218
+ }
7219
+ return parsed;
7220
+ }
7221
+ function parseMatchOptionsOption(raw) {
7222
+ let parsed;
7223
+ try {
7224
+ parsed = JSON.parse(raw);
7225
+ } catch (error) {
7226
+ throw usageError(
7227
+ `--match-options must be valid JSON: ${error instanceof Error ? error.message : String(error)}`
7228
+ );
7229
+ }
7230
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
7231
+ throw usageError("--match-options must be a JSON object.");
7232
+ }
7233
+ return parsed;
7234
+ }
7235
+ function writeRunGroupSummary(format, webOrigin, result) {
7236
+ if (format !== "human") return;
7237
+ for (const target of result.targets) {
7238
+ if (target.status !== "started") continue;
7239
+ writeRunLink(format, webOrigin, {
7240
+ projectId: result.project.id,
7241
+ suiteId: result.suite.id,
7242
+ runId: target.runId
7243
+ });
7244
+ }
7245
+ const total = result.startedCount + result.failedCount;
7246
+ if (total > 1) {
7247
+ process.stdout.write(
7248
+ `Started ${result.startedCount}/${total} runs` + (result.runGroupId ? ` (group ${result.runGroupId})` : "") + "\n"
7249
+ );
7250
+ }
7251
+ for (const target of result.targets) {
7252
+ if (target.status !== "failed") continue;
7253
+ const label = target.host?.name ?? target.host?.id ?? target.environment?.name ?? target.environment?.id ?? "target";
7254
+ process.stderr.write(
7255
+ `Failed: ${label} \u2014 ${target.error.code}: ${target.error.message}
7256
+ `
7257
+ );
7258
+ }
7259
+ }
6640
7260
  function writeRunLink(format, webOrigin, run) {
6641
7261
  if (format !== "human") return;
6642
7262
  const suiteId = run.suiteId?.trim();
@@ -6650,6 +7270,38 @@ function writeRunLink(format, webOrigin, run) {
6650
7270
  `
6651
7271
  );
6652
7272
  }
7273
+ var JUDGE_LABELS = [
7274
+ ["goalCompletion", "goal completion"],
7275
+ ["groundedness", "groundedness"]
7276
+ ];
7277
+ function writeJudgeSummary(format, judges) {
7278
+ if (format !== "human" || !judges || typeof judges !== "object") return;
7279
+ for (const [key, label] of JUDGE_LABELS) {
7280
+ const judge = judges[key];
7281
+ const status = judge?.status;
7282
+ if (!status) continue;
7283
+ if (status !== "completed") {
7284
+ const code = typeof judge.errorCode === "string" ? ` (${judge.errorCode})` : "";
7285
+ process.stdout.write(`Judge ${label}: ${status}${code}
7286
+ `);
7287
+ continue;
7288
+ }
7289
+ const cases = Array.isArray(judge.cases) ? judge.cases : [];
7290
+ if (cases.length === 0) {
7291
+ const why = typeof judge.summary === "string" ? judge.summary : "nothing graded";
7292
+ process.stdout.write(`Judge ${label}: ${why}
7293
+ `);
7294
+ continue;
7295
+ }
7296
+ const passed = cases.filter((c) => c?.passed === true).length;
7297
+ const at = typeof judge.threshold === "number" ? ` at threshold ${judge.threshold}` : "";
7298
+ const model = typeof judge.modelUsed === "string" ? ` \u2014 ${judge.modelUsed}` : "";
7299
+ process.stdout.write(
7300
+ `Judge ${label}: ${passed}/${cases.length} passed${at}${model}
7301
+ `
7302
+ );
7303
+ }
7304
+ }
6653
7305
  async function runPlatformCommand7(options, timeoutMs, execute) {
6654
7306
  const controller = new AbortController();
6655
7307
  const timeoutHandle = setTimeout(() => {
@@ -6783,6 +7435,14 @@ function buildSuiteUpdateInput(options) {
6783
7435
  ...input.environment ?? {},
6784
7436
  servers: options.server
6785
7437
  };
7438
+ if (options.computerImage !== void 0) {
7439
+ input.environment = {
7440
+ ...input.environment ?? {},
7441
+ // NULL, not undefined — `off` has to reach the wire as an explicit
7442
+ // clear, and omitting the servers alongside it preserves them.
7443
+ computerEnvironment: options.computerImage === "off" ? null : options.computerImage
7444
+ };
7445
+ }
6786
7446
  if (options.host !== void 0)
6787
7447
  input.hosts = options.host.map((host) => ({ host }));
6788
7448
  const exec = { ...input.executionConfig ?? {} };
@@ -6795,6 +7455,19 @@ function buildSuiteUpdateInput(options) {
6795
7455
  const settings = { ...input.settings ?? {} };
6796
7456
  if (options.minAccuracy !== void 0)
6797
7457
  settings.minimumAccuracy = Number(options.minAccuracy);
7458
+ if (options.minIterations !== void 0) {
7459
+ if (options.minIterations === "off") {
7460
+ settings.minimumIterations = null;
7461
+ } else {
7462
+ const iterations = Number(options.minIterations);
7463
+ if (!Number.isInteger(iterations) || iterations < 1 || iterations > 10) {
7464
+ throw usageError(
7465
+ '--min-iterations must be a whole number from 1 to 10, or "off".'
7466
+ );
7467
+ }
7468
+ settings.minimumIterations = iterations;
7469
+ }
7470
+ }
6798
7471
  const mo = { ...settings.matchOptions ?? {} };
6799
7472
  if (options.toolCallOrder !== void 0)
6800
7473
  mo.toolCallOrder = options.toolCallOrder;
@@ -6808,12 +7481,30 @@ function buildSuiteUpdateInput(options) {
6808
7481
  throw usageError('--judge must be "on" or "off".');
6809
7482
  }
6810
7483
  judge.enabled = options.judge === "on";
7484
+ judge.autoRun = options.judge === "on";
6811
7485
  }
6812
7486
  if (options.judgeModel !== void 0) judge.model = options.judgeModel;
7487
+ if (options.judgeThreshold !== void 0) {
7488
+ judge.threshold = parseJudgeThreshold(options.judgeThreshold);
7489
+ }
6813
7490
  if (Object.keys(judge).length > 0) settings.judge = judge;
6814
7491
  if (Object.keys(settings).length > 0) input.settings = settings;
6815
7492
  return input;
6816
7493
  }
7494
+ function parseJudgeThreshold(raw) {
7495
+ const normalized = raw.trim();
7496
+ const threshold = normalized === "" ? Number.NaN : Number(normalized);
7497
+ if (!Number.isFinite(threshold) || threshold < 0 || threshold > 1) {
7498
+ throw usageError("--judge-threshold must be a number between 0 and 1.");
7499
+ }
7500
+ return threshold;
7501
+ }
7502
+ var OUTAGE_POLICY_BY_FLAG = /* @__PURE__ */ new Map([
7503
+ ["fail-open", "fail_open"],
7504
+ ["fail-closed", "fail_closed"],
7505
+ ["fail_open", "fail_open"],
7506
+ ["fail_closed", "fail_closed"]
7507
+ ]);
6817
7508
  function buildCaseInput(options, opts) {
6818
7509
  const input = { ...loadBodyObject(options) };
6819
7510
  if (options.project !== void 0) input.project = options.project;
@@ -7274,6 +7965,149 @@ async function writeCompareResult(args, structured) {
7274
7965
  args.format
7275
7966
  );
7276
7967
  }
7968
+ var SUITE_FILE_INVALID_EXIT_CODE = 1;
7969
+ var SUITE_FILE_USAGE_EXIT_CODE = 2;
7970
+ function readSuiteFileInput(value) {
7971
+ try {
7972
+ const buffer = value === "-" ? readFileSync(0) : readFileSync(value);
7973
+ return { text: buffer.toString("utf8"), bytes: buffer.byteLength };
7974
+ } catch (error) {
7975
+ throw usageError(
7976
+ value === "-" ? "Failed to read the suite file from stdin." : `Failed to read the suite file "${value}".`,
7977
+ { source: error instanceof Error ? error.message : String(error) }
7978
+ );
7979
+ }
7980
+ }
7981
+ function runEvalValidate(options, command) {
7982
+ const globalOptions = getGlobalOptions(command);
7983
+ const source = readSuiteFileInput(options.file);
7984
+ const label = options.file === "-" ? "<stdin>" : options.file;
7985
+ const loaded = loadEvalSuiteFile(source.text, { byteLength: source.bytes });
7986
+ if (loaded.ok) {
7987
+ const result2 = {
7988
+ valid: true,
7989
+ file: label,
7990
+ suite: {
7991
+ id: loaded.authored.suite.id,
7992
+ name: loaded.authored.suite.name,
7993
+ cases: loaded.resolved.cases.length,
7994
+ enabledCases: loaded.resolved.enabledCases.length
7995
+ },
7996
+ findings: []
7997
+ };
7998
+ if (globalOptions.format === "human") {
7999
+ const total = result2.suite?.cases ?? 0;
8000
+ process.stdout.write(
8001
+ `${label}: valid \u2014 suite ${result2.suite?.id} (${total} ${total === 1 ? "case" : "cases"}, ${result2.suite?.enabledCases} enabled)
8002
+ `
8003
+ );
8004
+ return;
8005
+ }
8006
+ writeResult(result2, globalOptions.format);
8007
+ return;
8008
+ }
8009
+ const result = {
8010
+ valid: false,
8011
+ file: label,
8012
+ stage: loaded.stage,
8013
+ findings: [...loaded.findings]
8014
+ };
8015
+ if (globalOptions.format === "human") {
8016
+ process.stdout.write(
8017
+ `${label}: invalid (${loaded.findings.length} ${loaded.findings.length === 1 ? "finding" : "findings"})
8018
+ ${formatSuiteFileFindings(loaded.findings)}
8019
+ `
8020
+ );
8021
+ } else {
8022
+ writeResult(result, globalOptions.format);
8023
+ }
8024
+ setProcessExitCode(
8025
+ loaded.stage === "contract" ? SUITE_FILE_INVALID_EXIT_CODE : SUITE_FILE_USAGE_EXIT_CODE
8026
+ );
8027
+ }
8028
+ async function runEvalExport(options, command) {
8029
+ const globalOptions = getGlobalOptions(command);
8030
+ if (options.out !== void 0) {
8031
+ refuseToOverwrite(options.out, options.force === true);
8032
+ }
8033
+ const fetched = await runPlatformCommand7(
8034
+ options,
8035
+ globalOptions.timeout,
8036
+ async ({ client, signal }) => {
8037
+ const selector = {
8038
+ ...options.project ? { project: options.project } : {},
8039
+ suite: options.suite
8040
+ };
8041
+ const [detail, page] = await Promise.all([
8042
+ getEvalSuiteOperation.execute(selector, { client, signal }),
8043
+ listEvalCasesOperation.execute(selector, { client, signal })
8044
+ ]);
8045
+ if (page.nextCursor) {
8046
+ throw cliError(
8047
+ "SUITE_FILE_TRUNCATED",
8048
+ `Suite "${options.suite}" returned more cases than one page and this CLI cannot follow the cursor. Upgrade @mcpjam/cli.`,
8049
+ SUITE_FILE_USAGE_EXIT_CODE
8050
+ );
8051
+ }
8052
+ return { detail, cases: page.items };
8053
+ }
8054
+ );
8055
+ const built = buildSuiteFileFromPlatform(fetched);
8056
+ if (!built.ok) {
8057
+ writeExportRefusal(built.findings, globalOptions.format);
8058
+ return;
8059
+ }
8060
+ const text = serializeEvalSuiteFile(built.file);
8061
+ const bytes = Buffer.byteLength(text, "utf8");
8062
+ if (bytes > MAX_SUITE_FILE_BYTES) {
8063
+ writeExportRefusal(
8064
+ [suiteFileTooLarge(bytes, MAX_SUITE_FILE_BYTES)],
8065
+ globalOptions.format
8066
+ );
8067
+ return;
8068
+ }
8069
+ const reloaded = loadEvalSuiteFile(text, { byteLength: bytes });
8070
+ if (!reloaded.ok || !isDeepStrictEqual(reloaded.authored, built.file)) {
8071
+ throw operationalError(
8072
+ `The suite file written for "${built.file.suite.id}" does not read back identically, so nothing was written. This is a bug in @mcpjam/cli \u2014 please report it.`,
8073
+ reloaded.ok ? void 0 : { findings: reloaded.findings }
8074
+ );
8075
+ }
8076
+ const outPath = options.out ?? defaultSuiteFilePath(built.file.suite.id);
8077
+ if (options.out === void 0) {
8078
+ refuseToOverwrite(outPath, options.force === true);
8079
+ }
8080
+ const written = await writeFileAtomic(outPath, text, { createParents: true });
8081
+ writeResult(
8082
+ {
8083
+ exported: true,
8084
+ path: written,
8085
+ suite: { id: built.file.suite.id, name: built.file.suite.name },
8086
+ cases: built.file.cases.length,
8087
+ bytes
8088
+ },
8089
+ globalOptions.format
8090
+ );
8091
+ }
8092
+ function refuseToOverwrite(outPath, force) {
8093
+ if (force || !existsSync(outPath)) return;
8094
+ throw usageError(
8095
+ `"${outPath}" already exists. Pass --force to replace it, or --out to write somewhere else.`
8096
+ );
8097
+ }
8098
+ function writeExportRefusal(findings, format) {
8099
+ if (format === "human") {
8100
+ process.stdout.write(
8101
+ `Nothing was written: this suite cannot be represented as a suite file (${findings.length} ${findings.length === 1 ? "reason" : "reasons"}).
8102
+ ` + findings.map(
8103
+ (entry) => entry.pointer === "" ? ` ${entry.code} ${entry.message}` : ` ${entry.code} ${entry.pointer}: ${entry.message}`
8104
+ ).join("\n") + "\n"
8105
+ );
8106
+ } else {
8107
+ writeResult({ exported: false, path: null, findings }, format);
8108
+ }
8109
+ setProcessExitCode(SUITE_FILE_INVALID_EXIT_CODE);
8110
+ }
7277
8111
  function registerEvalCommands(program) {
7278
8112
  const evals = program.command("eval").description("Author and run eval suites in your hosted MCPJam projects");
7279
8113
  addPlatformOptions7(
@@ -7352,8 +8186,52 @@ function registerEvalCommands(program) {
7352
8186
  "--server <id-or-name...>",
7353
8187
  "Override the suite's saved server selection (HTTP servers only)"
7354
8188
  ).option(
7355
- "--environment <id-or-name>",
7356
- "Project environment to run against (must be attached to the suite; optional when it has exactly one)"
8189
+ "--environment <id-or-name...>",
8190
+ "Attached project environment(s) to run. Several values start one PAID RUN each."
8191
+ ).option(
8192
+ "--host <id-or-name...>",
8193
+ "Attached host(s) to run, so the run is stamped with that host's config. Several values start one PAID RUN each."
8194
+ ).option(
8195
+ "--all-targets",
8196
+ "Run EVERY attached environment (or, if none, every attached host) \u2014 one PAID RUN per target"
8197
+ ).option(
8198
+ "--iterations <n>",
8199
+ "Run each case this many times (1-10)",
8200
+ (v) => parseIntOption(v, "--iterations")
8201
+ ).option(
8202
+ "--case <id-or-title...>",
8203
+ "Run only these cases instead of the whole suite"
8204
+ ).option(
8205
+ "--exclude-skills",
8206
+ "Run the 'without skills' arm: no skills are pinned, and the run is labelled as excluded"
8207
+ ).option(
8208
+ "--refresh-snapshot",
8209
+ "PERSISTS a new host-config snapshot on the suite, changing every future run of it. Single-target runs only."
8210
+ ).option("--notes <text>", "Free-text note stored on the run").option(
8211
+ "--min-pass-rate <n>",
8212
+ "Pass threshold for this run (0-100)",
8213
+ (v) => parseNumberOption(v, "--min-pass-rate")
8214
+ ).option(
8215
+ "--match-options <json>",
8216
+ `Tool-call match options for this run, e.g. '{"toolCallOrder":"exact"}'`
8217
+ ).option(
8218
+ "--idempotency-key <key>",
8219
+ "Retry-safety key: repeating the call returns the run it already started"
8220
+ ).option(
8221
+ "--compose-host <id-or-name>",
8222
+ "Compose a stack to run instead of naming a saved environment: the host it runs as. APPENDS the composed environment to the suite."
8223
+ ).option(
8224
+ "--compose-computer <id-or-name>",
8225
+ "Sandbox image to pin on the composed stack"
8226
+ ).option(
8227
+ "--compose-model <id>",
8228
+ "Model to run on the composed stack, instead of the host's"
8229
+ ).option(
8230
+ "--compose-server-group <id>",
8231
+ "Standalone server group to pin on the composed stack"
8232
+ ).option(
8233
+ "--compose-skill <id...>",
8234
+ "Project-shared skill IDs to pin on the composed stack"
7357
8235
  )
7358
8236
  ).action(
7359
8237
  async (options, command) => {
@@ -7369,18 +8247,31 @@ function registerEvalCommands(program) {
7369
8247
  project: options.project,
7370
8248
  suite: options.suite,
7371
8249
  ...options.server ? { servers: options.server } : {},
7372
- ...options.environment ? { environment: options.environment } : {}
8250
+ // ONE value maps to the singular field, several to the plural:
8251
+ // the op rejects sending both, and the singular carries the
8252
+ // long-standing description a caller may already rely on.
8253
+ ...selectorField("environment", "environments", options.environment),
8254
+ ...selectorField("host", "hosts", options.host),
8255
+ ...options.allTargets ? { allAttached: true } : {},
8256
+ ...options.iterations !== void 0 ? { iterations: options.iterations } : {},
8257
+ ...options.case?.length ? { cases: options.case } : {},
8258
+ ...options.excludeSkills ? { excludeSkills: true } : {},
8259
+ ...options.refreshSnapshot ? { refreshSnapshot: true } : {},
8260
+ ...options.notes !== void 0 ? { notes: options.notes } : {},
8261
+ ...options.minPassRate !== void 0 ? { minPassRate: options.minPassRate } : {},
8262
+ ...options.matchOptions ? { matchOptions: parseMatchOptionsOption(options.matchOptions) } : {},
8263
+ ...options.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {},
8264
+ ...composeField(options)
7373
8265
  },
7374
8266
  { client: context.client, signal: context.signal }
7375
8267
  );
7376
8268
  }
7377
8269
  );
7378
8270
  writeResult(result, globalOptions.format);
7379
- writeRunLink(globalOptions.format, webOrigin, {
7380
- projectId: result.project.id,
7381
- suiteId: result.suite.id,
7382
- runId: result.runId
7383
- });
8271
+ writeRunGroupSummary(globalOptions.format, webOrigin, result);
8272
+ if (result.outcome !== "started") {
8273
+ setProcessExitCode(1);
8274
+ }
7384
8275
  }
7385
8276
  );
7386
8277
  addPlatformOptions7(
@@ -7401,6 +8292,7 @@ function registerEvalCommands(program) {
7401
8292
  }
7402
8293
  );
7403
8294
  writeResult(result, globalOptions.format);
8295
+ writeJudgeSummary(globalOptions.format, result.run.judges);
7404
8296
  writeRunLink(globalOptions.format, webOrigin, {
7405
8297
  projectId: result.project.id,
7406
8298
  suiteId: result.run.suiteId,
@@ -7422,7 +8314,65 @@ function registerEvalCommands(program) {
7422
8314
  );
7423
8315
  }
7424
8316
  );
8317
+ addPlatformOptions7(
8318
+ evals.command("judge").description(
8319
+ "Grade a finished eval run with LLM as Judge (SPENDS your model budget)"
8320
+ ).requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption("--project <id-or-name>", "Project name or ID").option("--force", "Re-grade a run that already has a judge result").option(
8321
+ "--enable",
8322
+ "Grade this run even though the judge was off when it ran"
8323
+ ).option("--judge-model <id>", "Judge model for this run only").option("--judge-threshold <0-1>", "Pass threshold for this run only")
8324
+ ).action(
8325
+ async (options, command) => {
8326
+ const threshold = options.judgeThreshold !== void 0 ? parseJudgeThreshold(options.judgeThreshold) : void 0;
8327
+ const input = validateOpInput2(requestEvalRunJudgeOperation, {
8328
+ project: options.project,
8329
+ runId: options.run,
8330
+ ...options.force ? { force: true } : {},
8331
+ ...options.enable ? { enable: true } : {},
8332
+ ...options.judgeModel !== void 0 ? { model: options.judgeModel } : {},
8333
+ ...threshold !== void 0 ? { threshold } : {}
8334
+ });
8335
+ await executeOp2(requestEvalRunJudgeOperation, input, options, command);
8336
+ }
8337
+ );
7425
8338
  const PROJECT_OPT = "Project name or ID (defaults to most recently updated)";
8339
+ const checks = evals.command("checks").description("Run an eval suite on a repository's pull requests");
8340
+ addPlatformOptions7(
8341
+ checks.command("list").description(
8342
+ "List the repositories running an eval suite on their pull requests"
8343
+ ).option("--project <id-or-name>", PROJECT_OPT)
8344
+ ).action(async (options, command) => {
8345
+ await executeOp2(
8346
+ listEvalCheckReposOperation,
8347
+ { project: options.project },
8348
+ options,
8349
+ command
8350
+ );
8351
+ });
8352
+ addPlatformOptions7(
8353
+ checks.command("connect").description(
8354
+ "Run this suite on every pull request to a repository (affects everyone who opens one)"
8355
+ ).requiredOption("--suite <id-or-name>", "Eval suite name or ID").requiredOption("--repo <owner/repo>", "Repository to connect").requiredOption(
8356
+ "--outage-policy <fail-open|fail-closed>",
8357
+ "What the check reports when MCPJam cannot conclude"
8358
+ ).option("--project <id-or-name>", PROJECT_OPT)
8359
+ ).action(
8360
+ async (options, command) => {
8361
+ const policy = OUTAGE_POLICY_BY_FLAG.get(options.outagePolicy);
8362
+ if (!policy) {
8363
+ throw usageError(
8364
+ '--outage-policy must be "fail-open" or "fail-closed". fail-closed blocks merges while MCPJam cannot conclude; fail-open lets an unverified change through.'
8365
+ );
8366
+ }
8367
+ const input = validateOpInput2(connectEvalCheckRepoOperation, {
8368
+ project: options.project,
8369
+ suite: options.suite,
8370
+ repo: options.repo,
8371
+ outagePolicy: policy
8372
+ });
8373
+ await executeOp2(connectEvalCheckRepoOperation, input, options, command);
8374
+ }
8375
+ );
7426
8376
  addPlatformOptions7(
7427
8377
  evals.command("iterations").description(
7428
8378
  "List per-iteration results for an eval run (pass/fail, tool calls, tokens, latency)"
@@ -7505,9 +8455,35 @@ function registerEvalCommands(program) {
7505
8455
  await runEvalCompare(options, command);
7506
8456
  }
7507
8457
  );
8458
+ evals.command("validate").description(
8459
+ "Validate a local eval suite file offline \u2014 no auth, no network (0 valid, 1 contract-invalid, 2 unreadable/oversize/malformed)"
8460
+ ).requiredOption(
8461
+ "--file <path>",
8462
+ "Suite file to validate, .yaml or .json (or - for stdin)"
8463
+ ).action((options, command) => {
8464
+ runEvalValidate(options, command);
8465
+ });
8466
+ addPlatformOptions7(
8467
+ evals.command("export").description(
8468
+ "Write a hosted eval suite to a local suite file, refusing anything it cannot represent losslessly"
8469
+ ).requiredOption(
8470
+ "--suite <id-or-name>",
8471
+ "Eval suite to export (name or ID)"
8472
+ ).option(
8473
+ "--project <id-or-name>",
8474
+ "Project the suite belongs to (defaults to the most recently updated project)"
8475
+ ).option(
8476
+ "--out <path>",
8477
+ "Where to write (default .mcpjam/evals/<suite-id>.yaml)"
8478
+ ).option("--force", "Replace an existing file at the output path")
8479
+ ).action(
8480
+ async (options, command) => {
8481
+ await runEvalExport(options, command);
8482
+ }
8483
+ );
7508
8484
  addPlatformOptions7(
7509
8485
  evals.command("pull").description(
7510
- "Materialize a hosted eval suite into a local corpus lock (0 clean, 1 drift under --frozen, 2 usage, 3 incomplete)"
8486
+ "LEGACY: materialize a hosted eval suite into a corpus lock for @mcpjam/vitest \u2014 new work should use `eval export` (0 clean, 1 drift under --frozen, 2 usage, 3 incomplete)"
7511
8487
  ).requiredOption("--suite <id-or-name>", "Eval suite to pull (name or ID)").option(
7512
8488
  "--project <id-or-name>",
7513
8489
  "Project the suite belongs to (defaults to the most recently updated project)"
@@ -7626,15 +8602,15 @@ function registerEvalCommands(program) {
7626
8602
  shot.screenshotUrl,
7627
8603
  globalOptions.timeout
7628
8604
  );
7629
- const path7 = resolveScreenshotPath(
8605
+ const path8 = resolveScreenshotPath(
7630
8606
  options.out,
7631
8607
  shot,
7632
8608
  i,
7633
8609
  shots.length
7634
8610
  );
7635
- mkdirSync(dirname(path7), { recursive: true });
7636
- writeFileSync(path7, bytes);
7637
- saved.push({ ...shot, savedTo: path7 });
8611
+ mkdirSync(dirname(path8), { recursive: true });
8612
+ writeFileSync(path8, bytes);
8613
+ saved.push({ ...shot, savedTo: path8 });
7638
8614
  }
7639
8615
  if (isJson) {
7640
8616
  writeResult({ ...base, items: saved });
@@ -7691,7 +8667,10 @@ function registerEvalCommands(program) {
7691
8667
  ).requiredOption(
7692
8668
  "--project <id-or-name>",
7693
8669
  "Project the run belongs to (name or ID)"
7694
- ).option("--out <path>", "Download the .webm to this file instead of printing the URL")
8670
+ ).option(
8671
+ "--out <path>",
8672
+ "Download the .webm to this file instead of printing the URL"
8673
+ )
7695
8674
  ).action(
7696
8675
  async (options, command) => {
7697
8676
  const globalOptions = getGlobalOptions(command);
@@ -7764,7 +8743,16 @@ function registerEvalCommands(program) {
7764
8743
  ).requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT).option("--file <path>", "Suite-update JSON body (or - for stdin)").option("--json <json>", "Inline suite-update JSON (or @file, or -)").option("--name <name>", "Rename the suite").option("--description <text>", "Suite description").option(
7765
8744
  "--server <name...>",
7766
8745
  "Replace the suite's server selection (project server names)"
7767
- ).option("--host <name...>", "Replace host attachments (by name/ID)").option("--model <id>", "Execution model id").option("--system-prompt <text>", "Execution system prompt").option("--temperature <n>", "Execution temperature").option("--min-accuracy <pct>", "Minimum accuracy, 0\u2013100").option("--tool-call-order <any|in-order|exact>", "Tool call order").option("--arguments <ignore|partial|exact>", "Argument matching").option("--extra-tool-calls <unlimited|N>", "Allowed extra tool calls").option("--judge <on|off>", "Enable/disable LLM-as-judge grading").option("--judge-model <id>", "Judge model id")
8746
+ ).option(
8747
+ "--computer-image <name-or-id|off>",
8748
+ "Sandbox image eval runs boot from (see `mcpjam images list`); off uses the default base image"
8749
+ ).option("--host <name...>", "Replace host attachments (by name/ID)").option("--model <id>", "Execution model id").option("--system-prompt <text>", "Execution system prompt").option("--temperature <n>", "Execution temperature").option("--min-accuracy <pct>", "Minimum accuracy, 0\u2013100").option(
8750
+ "--min-iterations <1-10|off>",
8751
+ "Floor on per-case iterations; off removes the floor"
8752
+ ).option("--tool-call-order <any|in-order|exact>", "Tool call order").option("--arguments <ignore|partial|exact>", "Argument matching").option("--extra-tool-calls <unlimited|N>", "Allowed extra tool calls").option(
8753
+ "--judge <on|off>",
8754
+ "Turn LLM-as-judge grading on/off (grades every run as it completes)"
8755
+ ).option("--judge-model <id>", "Judge model id").option("--judge-threshold <0-1>", "Judge pass threshold, 0\u20131")
7768
8756
  ).action(async (options, command) => {
7769
8757
  const input = validateOpInput2(
7770
8758
  updateEvalSuiteOperation,
@@ -7883,6 +8871,31 @@ function registerEvalCommands(program) {
7883
8871
  ).option(
7884
8872
  "--environment <id-or-name>",
7885
8873
  "Project environment to run against (must be attached to the suite)"
8874
+ ).option(
8875
+ "--host <id-or-name>",
8876
+ "Attached host to run against, so the run is stamped with that host's config"
8877
+ ).option(
8878
+ "--iterations <n>",
8879
+ "Run the case this many times (1-10)",
8880
+ (v) => parseIntOption(v, "--iterations")
8881
+ ).option(
8882
+ "--idempotency-key <key>",
8883
+ "Retry-safety key: repeating the call returns the run it already started"
8884
+ ).option(
8885
+ "--compose-host <id-or-name>",
8886
+ "Compose a stack to run instead of naming a saved environment: the host it runs as. APPENDS the composed environment to the suite."
8887
+ ).option(
8888
+ "--compose-computer <id-or-name>",
8889
+ "Sandbox image to pin on the composed stack"
8890
+ ).option(
8891
+ "--compose-model <id>",
8892
+ "Model to run on the composed stack, instead of the host's"
8893
+ ).option(
8894
+ "--compose-server-group <id>",
8895
+ "Standalone server group to pin on the composed stack"
8896
+ ).option(
8897
+ "--compose-skill <id...>",
8898
+ "Project-shared skill IDs to pin on the composed stack"
7886
8899
  )
7887
8900
  ).action(
7888
8901
  async (options, command) => {
@@ -7893,7 +8906,11 @@ function registerEvalCommands(program) {
7893
8906
  suite: options.suite,
7894
8907
  case: options.case,
7895
8908
  ...options.server?.length ? { servers: options.server } : {},
7896
- ...options.environment ? { environment: options.environment } : {}
8909
+ ...options.environment ? { environment: options.environment } : {},
8910
+ ...options.host ? { host: options.host } : {},
8911
+ ...options.iterations !== void 0 ? { iterations: options.iterations } : {},
8912
+ ...options.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {},
8913
+ ...composeField(options)
7897
8914
  },
7898
8915
  options,
7899
8916
  command