@mcpjam/cli 5.16.1 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@ import { spawn } from 'child_process';
10
10
  import { createRequire } from 'module';
11
11
  import os, { homedir, tmpdir } from 'os';
12
12
  import { RUN_LAUNCH_HEADERS, getRegistryDirectoryServerOperation, isPlatformApiError, resolveProject, listOrganizationsOperation, listProjectsOperation, createProjectOperation, updateProjectOperation, deleteProjectOperation, connectProjectServerOperation, getProjectServerConnectionStatusOperation, cancelProjectServerConnectionOperation, listChatSessionsOperation, sendChatMessageOperation, createTunnelOperation, listEvalSuiteRunsOperation, listEvalSuiteRevisionsOperation, runEvalSuiteOperation, getEvalRunOperation, getEvalRunRouteFactsOperation, getEvalRunServerFactsOperation, proposeEvalDescriptionRewriteOperation, startEvalDescriptionExperimentOperation, getEvalDescriptionExperimentOperation, cancelEvalRunOperation, backtestEvalRunJudgeOperation, backtestEvalRunOperation, requestEvalRunJudgeOperation, listEvalRunIterationsOperation, getEvalIterationTraceOperation, getEvalRunStepsOperation, getEvalSuiteOperation, updateEvalSuiteOperation, deleteEvalSuiteOperation, setEvalSuiteScheduleOperation, setEvalSuiteEnvironmentsOperation, listEvalCasesOperation, getEvalCaseOperation, createEvalCaseOperation, updateEvalCaseOperation, deleteEvalCaseOperation, generateEvalCasesOperation, importEvalCasesOperation, createClientOperation, updateClientOperation, setClientServersOperation, duplicateClientOperation, createEnvironmentOperation, ensureAdhocEnvironmentOperation, nameEnvironmentOperation, updateEnvironmentOperation, createSecretOperation, updateSecretOperation, createImageOperation, validateImageBlueprintOperation, updateImageOperation, listTraceDestinationsOperation, getTraceDestinationOperation, createTraceDestinationOperation, updateTraceDestinationOperation, deleteTraceDestinationOperation, testTraceDestinationOperation, pauseTraceDestinationOperation, resumeTraceDestinationOperation, backfillTraceDestinationOperation, listTraceDestinationBackfillsOperation, runOperationWithPermalinks, withPermalinkEnvelope, PlatformApiError, installRegistryServerOperation, installRegistryDirectoryServerOperation, getProjectServerOperation, DEFAULT_PLATFORM_API_BASE_URL, PlatformApiClient, projectResolutionError, listProjectServersOperation, createProjectServerOperation, updateProjectServerOperation, deleteProjectServerOperation, showServersOperation, driveChatSessionBrowserOperation, observeChatSessionBrowserOperation, describePlatformRefusal, platformRefusalHint, createEvalSuiteOperation, listEvalSuitesOperation, buildAppPermalink, listEvalSuiteStageAnalyticsOperation, getEvalRunStageAnalyticsOperation, listEvalGithubReposOperation, connectEvalGithubRepoOperation, resolveEnvironmentOperation, listClientsOperation, getClientOperation, deleteClientOperation, listEnvironmentsOperation, getEnvironmentOperation, getEnvironmentCapabilitiesOperation, archiveEnvironmentOperation, restoreEnvironmentOperation, listSecretsOperation, getSecretOperation, deleteSecretOperation, listImagesOperation, getImageOperation, buildImageOperation, listImageBuildsOperation, useImageOperation, resetComputerOperation, promoteImageOperation, deleteImageOperation, listProjectSkillsOperation, getProjectSkillOperation, listGoalsOperation, listGoalRunsOperation, getGoalRunOperation, launchGoalRunOperation, cancelGoalRunOperation, listGoalRunSessionsOperation, platformBrowserToolPolicySchema, listServerToolsOperation, runEvalCaseOperation, sendFeedbackOperation, getCapabilitiesOperation, getStudyOperation, listStudySessionsOperation, getStudySessionOperation, getStudyMetricsOperation, getStudyUsageOperation, listStudyFindingsOperation, getStudySignalsOperation, getStudyInsightsOperation, requestStudyInsightsOperation, cancelStudyInsightsOperation, dismissStudyFindingOperation, undismissStudyFindingOperation, updateStudyOperation, setStudyGuestExecutionOperation, rotateStudyLinkOperation, upsertStudyMemberOperation, removeStudyMemberOperation, rebindStudyOperation, listStudiesOperation, publishStudyOperation, unpublishStudyOperation, searchSessionsOperation, getChatSessionOperation, getChatSessionTraceOperation, listPersonasOperation, getPersonaOperation, createPersonaOperation, updatePersonaOperation, deletePersonaOperation, generatePersonasOperation, getGoalOperation, createGoalOperation, updateGoalOperation, archiveGoalOperation, generateGoalsOperation, getSwarmOverviewOperation, getGoalRunScorecardOperation, listSwarmFindingsOperation, dismissSwarmFindingOperation, undismissSwarmFindingOperation, getSwarmRunInsightsOperation, requestSwarmRunInsightsOperation, cancelSwarmRunInsightsOperation, listSwarmsOperation, getSwarmOperation, createSwarmOperation, updateSwarmOperation, archiveSwarmOperation, startClaudeReadinessRunOperation, startOpenAIReadinessRunOperation, startMuseReadinessRunOperation, getReadinessRunOperation, listReadinessRunsOperation, cancelReadinessRunOperation, getReadinessReportOperation, listRegistryDirectorySourcesOperation, searchRegistryDirectoryOperation, listRegistryServersOperation, listRegistryConnectionsOperation, uninstallRegistryServerOperation } from '@mcpjam/sdk/platform';
13
+ import { getAuthFilePath, readStoredAuth, clearStoredAuth, getOAuthAccessToken as getOAuthAccessToken$1, exchangePlatformToken, writeStoredAuth as writeStoredAuth$1 } from '@mcpjam/sdk/platform-auth';
13
14
  import { isDeepStrictEqual } from 'util';
14
15
  import { swarmVerdictLabel, composeSuiteGateWithBaseReport, EVAL_SUITE_SCHEMA_VERSION, EVAL_SUITE_SCHEMA_VERSIONS, MAX_BATCH_CREATE_CASES, filterSuppressedSuiteAssertions, DEFAULT_SUITE_WIDE_THRESHOLD_PERCENT, evalSuiteFileSchema, MAX_IMPORT_NOTE_CHARS, isOpaqueId } from '@mcpjam/sdk/contract';
15
16
  import { HOST_TEMPLATES, HOST_TEMPLATE_IDS, seedHostTemplate } from '@mcpjam/sdk/host-config/templates';
@@ -29,7 +30,7 @@ import { selectPluginMcpServerMap, detectPluginMcpTransport } from '@mcpjam/sdk/
29
30
 
30
31
  // package.json
31
32
  var package_default = {
32
- version: "5.16.1"};
33
+ version: "6.0.1"};
33
34
  function conformanceExitCode(result) {
34
35
  if (result.outcome === "incomplete") return 3;
35
36
  if (result.outcome === "failed") return 1;
@@ -155,6 +156,32 @@ function writeError(error, format = DEFAULT_OUTPUT_FORMAT) {
155
156
  `);
156
157
  return payload;
157
158
  }
159
+ var activeConsoleRoutes = 0;
160
+ var savedConsoleMethods;
161
+ function routeConsoleToStderr() {
162
+ if (activeConsoleRoutes === 0) {
163
+ savedConsoleMethods = {
164
+ log: console.log,
165
+ info: console.info,
166
+ debug: console.debug
167
+ };
168
+ const toStderr = (...args) => console.error(...args);
169
+ console.log = toStderr;
170
+ console.info = toStderr;
171
+ console.debug = toStderr;
172
+ }
173
+ activeConsoleRoutes += 1;
174
+ let released = false;
175
+ return () => {
176
+ if (released) return;
177
+ released = true;
178
+ activeConsoleRoutes -= 1;
179
+ if (activeConsoleRoutes === 0 && savedConsoleMethods) {
180
+ Object.assign(console, savedConsoleMethods);
181
+ savedConsoleMethods = void 0;
182
+ }
183
+ };
184
+ }
158
185
  function parseOutputFormat(value) {
159
186
  if (value === "json" || value === "human") {
160
187
  return value;
@@ -3720,93 +3747,20 @@ function appendProjectLinkHint(message, scope) {
3720
3747
  return `${message}
3721
3748
  Selector came from ${scope.linkPath} \u2014 re-run \`mcpjam cloud link\`.`;
3722
3749
  }
3723
- var AUTH_STORE_VERSION = 1;
3724
- function getAuthFilePath(options = {}) {
3725
- const env = options.env ?? process.env;
3726
- const platform = options.platform ?? process.platform;
3727
- const homeDirectory = options.homeDirectory ?? homedir();
3728
- if (env.MCPJAM_AUTH_FILE) {
3729
- return env.MCPJAM_AUTH_FILE;
3730
- }
3731
- if (platform === "win32") {
3732
- return join(
3733
- env.APPDATA || join(homeDirectory, "AppData", "Roaming"),
3734
- "mcpjam",
3735
- "auth.json"
3736
- );
3737
- }
3738
- return join(
3739
- env.XDG_CONFIG_HOME || join(homeDirectory, ".config"),
3740
- "mcpjam",
3741
- "auth.json"
3742
- );
3743
- }
3744
- function readStoredAuth(filePath) {
3745
- let raw;
3746
- try {
3747
- raw = readFileSync(filePath, "utf8");
3748
- } catch {
3749
- return null;
3750
- }
3751
- let parsed;
3752
- try {
3753
- parsed = JSON.parse(raw);
3754
- } catch {
3755
- return null;
3756
- }
3757
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
3758
- return null;
3759
- }
3760
- const record = parsed;
3761
- if (record.version !== AUTH_STORE_VERSION || typeof record.issuer !== "string" || typeof record.clientId !== "string" || typeof record.tokenEndpoint !== "string" || typeof record.accessToken !== "string") {
3762
- return null;
3763
- }
3764
- return {
3765
- version: AUTH_STORE_VERSION,
3766
- issuer: record.issuer,
3767
- clientId: record.clientId,
3768
- tokenEndpoint: record.tokenEndpoint,
3769
- accessToken: record.accessToken,
3770
- // Hand-edited files may hold a non-URL; dropping it here means readers
3771
- // fall back to the default base URL instead of producing broken requests.
3772
- ...typeof record.apiUrl === "string" && URL.canParse(record.apiUrl) ? { apiUrl: record.apiUrl } : {},
3773
- ...typeof record.refreshToken === "string" ? { refreshToken: record.refreshToken } : {},
3774
- ...typeof record.expiresAt === "number" ? { expiresAt: record.expiresAt } : {},
3775
- ...typeof record.email === "string" && record.email.trim() ? { email: record.email.trim() } : {},
3776
- ...typeof record.plan === "string" && record.plan.trim() ? { plan: record.plan.trim() } : {}
3777
- };
3778
- }
3779
3750
  async function writeStoredAuth(contents, filePath) {
3780
- const directory = dirname(filePath);
3781
- const temporaryPath = join(
3782
- directory,
3783
- `.${basename(filePath)}.${randomUUID()}.tmp`
3784
- );
3785
3751
  try {
3786
- await mkdir(directory, { recursive: true });
3787
- await writeFile(temporaryPath, `${JSON.stringify(contents, null, 2)}
3788
- `, {
3789
- encoding: "utf8",
3790
- mode: 384
3791
- });
3792
- await chmod(temporaryPath, 384);
3793
- await rename(temporaryPath, filePath);
3752
+ return await writeStoredAuth$1(contents, filePath);
3794
3753
  } catch (error) {
3795
- await rm(temporaryPath, { force: true }).catch(() => void 0);
3796
- throw operationalError(`Failed to write credentials to "${filePath}".`, {
3797
- source: error instanceof Error ? error.message : String(error)
3798
- });
3754
+ throw operationalError(
3755
+ error instanceof Error ? error.message : String(error),
3756
+ {
3757
+ source: error instanceof Error && error.cause instanceof Error ? error.cause.message : String(error)
3758
+ }
3759
+ );
3799
3760
  }
3800
- return filePath;
3801
- }
3802
- async function clearStoredAuth(filePath) {
3803
- const existed = readStoredAuth(filePath) !== null;
3804
- await rm(filePath, { force: true });
3805
- return existed;
3806
3761
  }
3807
3762
  var DEFAULT_PLATFORM_ORIGIN = "https://app.mcpjam.com";
3808
3763
  var LEGACY_API_KEY_PREFIX = "mcpjam_";
3809
- var TOKEN_REFRESH_SKEW_MS = 6e4;
3810
3764
  var DEFAULT_LOGIN_TIMEOUT_MS = 5 * 6e4;
3811
3765
  var LEGACY_KEY_REMEDY = "Legacy mcpjam_ API keys are not supported by platform commands. Create an sk_ key at https://app.mcpjam.com/settings/api-keys or run `mcpjam cloud login`.";
3812
3766
  function inspectExplicitApiKey(value) {
@@ -3848,42 +3802,11 @@ function resolvePlatformCredential(options, deps = {}) {
3848
3802
  };
3849
3803
  }
3850
3804
  async function getOAuthAccessToken(deps) {
3851
- const stored = readStoredAuth(deps.authFilePath);
3852
- if (!stored) {
3853
- throw operationalError(MISSING_CLOUD_CREDENTIAL_MESSAGE);
3854
- }
3855
- const now = deps.now ?? Date.now;
3856
- const expiresSoon = stored.expiresAt !== void 0 && stored.expiresAt - now() <= TOKEN_REFRESH_SKEW_MS;
3857
- if (!expiresSoon) {
3858
- return stored.accessToken;
3859
- }
3860
- if (!stored.refreshToken) {
3861
- throw operationalError("Login expired. Run `mcpjam cloud login` again.");
3805
+ try {
3806
+ return await getOAuthAccessToken$1(deps);
3807
+ } catch (error) {
3808
+ throw operationalError(error instanceof Error ? error.message : String(error));
3862
3809
  }
3863
- const refreshed = await refreshStoredAuth(stored, deps);
3864
- return refreshed.accessToken;
3865
- }
3866
- async function refreshStoredAuth(stored, deps) {
3867
- const tokens = await exchangeToken(
3868
- stored.tokenEndpoint,
3869
- {
3870
- grant_type: "refresh_token",
3871
- client_id: stored.clientId,
3872
- refresh_token: stored.refreshToken
3873
- },
3874
- deps.fetchFn ?? fetch,
3875
- "Token refresh failed. Run `mcpjam cloud login` again.",
3876
- deps.now
3877
- );
3878
- const refreshed = {
3879
- ...stored,
3880
- accessToken: tokens.accessToken,
3881
- // AuthKit rotates refresh tokens; keep the old one only if none returned.
3882
- ...tokens.refreshToken ? { refreshToken: tokens.refreshToken } : {},
3883
- ...tokens.expiresAt !== void 0 ? { expiresAt: tokens.expiresAt } : {}
3884
- };
3885
- await writeStoredAuth(refreshed, deps.authFilePath);
3886
- return refreshed;
3887
3810
  }
3888
3811
  async function runPlatformLogin(target, deps = {}) {
3889
3812
  const fetchFn = deps.fetchFn ?? fetch;
@@ -4042,29 +3965,12 @@ async function fetchCliAuthConfig(platformOrigin, fetchFn) {
4042
3965
  redirectUri: body.redirectUri
4043
3966
  };
4044
3967
  }
4045
- async function exchangeToken(tokenEndpoint, params, fetchFn, failureMessage, now = Date.now) {
4046
- let response;
3968
+ async function exchangeToken(...args) {
4047
3969
  try {
4048
- response = await fetchFn(tokenEndpoint, {
4049
- method: "POST",
4050
- headers: { "content-type": "application/x-www-form-urlencoded" },
4051
- body: new URLSearchParams(params).toString()
4052
- });
3970
+ return await exchangePlatformToken(...args);
4053
3971
  } catch (error) {
4054
- throw operationalError(
4055
- `${failureMessage} Could not reach ${tokenEndpoint}: ${error instanceof Error ? error.message : String(error)}`
4056
- );
3972
+ throw operationalError(error instanceof Error ? error.message : String(error));
4057
3973
  }
4058
- const body = await response.json().catch(() => null);
4059
- if (!response.ok || typeof body?.access_token !== "string") {
4060
- const detail = typeof body?.error_description === "string" ? body.error_description : typeof body?.error === "string" ? body.error : `HTTP ${response.status}`;
4061
- throw operationalError(`${failureMessage} (${detail})`);
4062
- }
4063
- return {
4064
- accessToken: body.access_token,
4065
- ...typeof body.refresh_token === "string" ? { refreshToken: body.refresh_token } : {},
4066
- ...typeof body.expires_in === "number" && Number.isFinite(body.expires_in) ? { expiresAt: now() + body.expires_in * 1e3 } : {}
4067
- };
4068
3974
  }
4069
3975
  function readGithubEvent(env) {
4070
3976
  if (!env.GITHUB_EVENT_PATH) return void 0;
@@ -14365,7 +14271,7 @@ function registerSessionsCommands(program) {
14365
14271
  "Continue this session instead of starting one. Configuration is fixed at the first turn, so the config flags below are refused with a session. The per-turn flags are not: --client, --max-steps and --max-tool-calls apply to whichever turn sends them, and --client in particular must be RE-SENT on every turn of a host-bound conversation \u2014 a session started with --client alone refuses a continuation that omits it."
14366
14272
  ).option(
14367
14273
  "--model <modelId>",
14368
- 'Provider-prefixed model id, e.g. "anthropic/claude-sonnet-5". Required to start a session; a bare id is rejected rather than guessed.'
14274
+ 'Provider-prefixed model id, e.g. "anthropic/claude-sonnet-5". Omit it on the first turn to use the environment or client model; the resolved model stays pinned. A bare id is rejected rather than guessed.'
14369
14275
  ).option(
14370
14276
  "--client <hostId>",
14371
14277
  "Client ID (from `mcpjam cloud clients list`) to run the turn AS. A client that declares an agent harness (Claude Code, Codex, Cursor CLI) runs the REAL runtime; without one the turn runs MCPJam's emulated engine. Per-turn, NOT pinned to the session \u2014 pass it on every turn, and check the printed `engine` to see what ran. Continuing a session you started with --client alone REQUIRES it: without it the turn is refused rather than answered by the emulated engine. Alongside --environment it only asserts which host you expect (a mismatch is refused). It cannot be combined with --server: --client cannot be pinned beside a pinned server set, so a later turn that omitted it would run the emulated engine on a session established on the harness. Use --environment, or --client alone (which connects the client's own servers). A harness turn needs --tool-mode auto with no --max-tool-calls."
@@ -14375,7 +14281,7 @@ function registerSessionsCommands(program) {
14375
14281
  ).option(
14376
14282
  "--server <serverId...>",
14377
14283
  "Run against these project servers (mutually exclusive with --environment)"
14378
- ).option("--system-prompt <text>", "System prompt for the session").option(
14284
+ ).option("--no-servers", "Start with no MCP servers; the empty selection stays pinned.").option("--system-prompt <text>", "System prompt for the session").option(
14379
14285
  "--tool-mode <mode>",
14380
14286
  "read_only (default) advertises only tools annotated readOnlyHint:true. auto advertises everything and MAY CAUSE REAL SIDE EFFECTS."
14381
14287
  ).option("--max-steps <n>", "Maximum engine steps this turn (1-16)").option(
@@ -14403,7 +14309,7 @@ function registerSessionsCommands(program) {
14403
14309
  modelId: options.model,
14404
14310
  hostId: options.client,
14405
14311
  environmentId: options.environment,
14406
- serverIds: options.server,
14312
+ serverIds: sendServerIds(options),
14407
14313
  systemPrompt: options.systemPrompt,
14408
14314
  toolMode: options.toolMode,
14409
14315
  maxSteps: parseIntegerOption(options.maxSteps, "--max-steps", {
@@ -14469,6 +14375,11 @@ function registerSessionsCommands(program) {
14469
14375
  })
14470
14376
  );
14471
14377
  }
14378
+ function sendServerIds(options) {
14379
+ if (options.servers !== false) return options.server;
14380
+ if (options.server !== void 0) throw usageError("Use either --server or --no-servers.");
14381
+ return [];
14382
+ }
14472
14383
  function parseFloatOption(value) {
14473
14384
  if (value === void 0) return void 0;
14474
14385
  if (value.trim() === "") {
@@ -17372,6 +17283,7 @@ var SKILLS_EXTENSION_ID = "io.modelcontextprotocol/skills";
17372
17283
  var SKILLS_EXTENSION_CAPABILITY = {
17373
17284
  [SKILLS_EXTENSION_ID]: {}
17374
17285
  };
17286
+ var SKILLS_LIST_TTL_MS = 0;
17375
17287
  var SKILLS_LIST_CACHE_SCOPE = "public";
17376
17288
  var INVALID_PARAMS = -32602;
17377
17289
  var InvalidSkillParamsError = class extends Error {
@@ -17396,6 +17308,26 @@ function entryFor(uri) {
17396
17308
  }
17397
17309
  return entry;
17398
17310
  }
17311
+ function resourceMetadataFor(uri) {
17312
+ const entry = SKILLS_BUNDLE_ENTRIES.find(
17313
+ (skill) => skill.resources.some((resource) => resource.uri === uri)
17314
+ );
17315
+ if (!entry) {
17316
+ return { name: uri, description: "Agent Skill file served over MCP." };
17317
+ }
17318
+ const skillName = String(entry.frontmatter.name);
17319
+ if (uri === entry.uri) {
17320
+ return {
17321
+ name: skillName,
17322
+ description: String(entry.frontmatter.description)
17323
+ };
17324
+ }
17325
+ const root = entry.uri.slice(0, -"/SKILL.md".length);
17326
+ return {
17327
+ name: uri.slice(root.length + 1),
17328
+ description: `Supporting file of the "${skillName}" skill, served over MCP.`
17329
+ };
17330
+ }
17399
17331
  function registerSkillsSurface(server) {
17400
17332
  server.server.setRequestHandler(
17401
17333
  "skills/list",
@@ -17408,6 +17340,7 @@ function registerSkillsSurface(server) {
17408
17340
  }
17409
17341
  return {
17410
17342
  skills: SKILLS_BUNDLE_ENTRIES,
17343
+ ttlMs: SKILLS_LIST_TTL_MS,
17411
17344
  cacheScope: SKILLS_LIST_CACHE_SCOPE
17412
17345
  };
17413
17346
  }
@@ -17415,17 +17348,21 @@ function registerSkillsSurface(server) {
17415
17348
  server.server.setRequestHandler(
17416
17349
  "skills/get",
17417
17350
  { params: getParamsSchema, result: looseResult },
17418
- async (params) => ({ skill: entryFor(params.uri) })
17351
+ // The SDK fills `ttlMs` / `cacheScope` only on the base protocol's
17352
+ // cacheable methods, so an extension method has to carry its own.
17353
+ async (params) => ({
17354
+ skill: entryFor(params.uri),
17355
+ ttlMs: SKILLS_LIST_TTL_MS,
17356
+ cacheScope: SKILLS_LIST_CACHE_SCOPE
17357
+ })
17419
17358
  );
17420
17359
  for (const [uri, text] of Object.entries(SKILLS_BUNDLE_CONTENTS)) {
17421
17360
  const mimeType = mimeTypeFor(uri);
17361
+ const { name, description } = resourceMetadataFor(uri);
17422
17362
  server.registerResource(
17363
+ name,
17423
17364
  uri,
17424
- uri,
17425
- {
17426
- mimeType,
17427
- description: "Agent Skill file served over MCP (SEP-2640)."
17428
- },
17365
+ { mimeType, description },
17429
17366
  // The SAME `mimeType` on the content, not only the registration — a
17430
17367
  // reader takes the type from `contents[0]`, and MCPJam's own loader
17431
17368
  // names it in the refusal for a non-text read.
@@ -23702,6 +23639,15 @@ function createMcpjamConnectionResolver(options, deps) {
23702
23639
  message
23703
23640
  );
23704
23641
  };
23642
+ const selectedKey = options.apiKey ?? deps.env.MCPJAM_API_KEY;
23643
+ if (selectedKey !== void 0 && !selectedKey.trim().startsWith("sk_")) {
23644
+ throw new SuiteFileRunError({
23645
+ code: "CREDENTIALS_REJECTED",
23646
+ phase: "setup",
23647
+ category: "credentials",
23648
+ message: "This MCPJam API key is invalid or retired. Create an sk_ key or run `mcpjam cloud login`."
23649
+ });
23650
+ }
23705
23651
  const credentialDeps = {
23706
23652
  env: deps.env,
23707
23653
  warn,
@@ -24206,10 +24152,19 @@ function readSuiteFile(filePath, cwd) {
24206
24152
  throw usageError(`Suite file ${resolvedPath} is not valid UTF-8.`);
24207
24153
  }
24208
24154
  }
24209
- function progressWriter(quiet) {
24155
+ function progressWriter(quiet, credentialSource) {
24210
24156
  return (event) => {
24211
24157
  if (quiet) return;
24212
24158
  switch (event.type) {
24159
+ case "identity":
24160
+ process.stderr.write(
24161
+ `MCPJam identity: ${credentialSource}; organization ${event.organizationId}; project ${event.projectId}.
24162
+ `
24163
+ );
24164
+ process.stderr.write(
24165
+ "Run start recorded. Planned iterations are not completed usage. Results remain local.\n"
24166
+ );
24167
+ return;
24213
24168
  case "setup":
24214
24169
  if (event.stage === "connect" && event.server) {
24215
24170
  process.stderr.write(`Connecting to ${event.server}\u2026
@@ -24376,6 +24331,8 @@ Received ${signal}; stopping and writing the partial report\u2026
24376
24331
  }
24377
24332
  }
24378
24333
  const runOptions = {
24334
+ surface: "cli",
24335
+ clientVersion: program.version(),
24379
24336
  servers,
24380
24337
  ...caseIds ? { caseIds } : {},
24381
24338
  inference: {
@@ -24404,7 +24361,10 @@ Received ${signal}; stopping and writing the partial report\u2026
24404
24361
  setupTimeoutMs: globalOptions.timeout,
24405
24362
  signal: controller.signal,
24406
24363
  // Progress is always stderr, so stdout stays one document.
24407
- onProgress: progressWriter(globalOptions.quiet)
24364
+ onProgress: progressWriter(
24365
+ globalOptions.quiet,
24366
+ describeCloudCredential(options, { env }).credential.source
24367
+ )
24408
24368
  };
24409
24369
  const runner = dependencies.runtime ? createSuiteFileRunner(dependencies.runtime) : { run: runSuiteFile };
24410
24370
  try {
@@ -25560,7 +25520,12 @@ async function main(argv = process.argv, dependencies = {}) {
25560
25520
  };
25561
25521
  }
25562
25522
  try {
25563
- await program.parseAsync(argv);
25523
+ const restoreConsole = routeConsoleToStderr();
25524
+ try {
25525
+ await program.parseAsync(argv);
25526
+ } finally {
25527
+ restoreConsole();
25528
+ }
25564
25529
  const normalizedExitCode = typeof process.exitCode === "number" ? process.exitCode : 0;
25565
25530
  captureCommandEvent(
25566
25531
  normalizedExitCode,