@mcpjam/cli 5.5.0 → 5.5.2

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
@@ -27,7 +27,7 @@ import { PostHog } from 'posthog-node';
27
27
 
28
28
  // package.json
29
29
  var package_default = {
30
- version: "5.5.0"};
30
+ version: "5.5.2"};
31
31
  function conformanceExitCode(result) {
32
32
  if (result.outcome === "incomplete") return 3;
33
33
  if (result.outcome === "failed") return 1;
@@ -4819,6 +4819,26 @@ async function assertModelOverridesSupported(options, timeoutMs, args) {
4819
4819
  );
4820
4820
  }
4821
4821
  }
4822
+ async function assertSecretGrantsSupported(options, timeoutMs, args) {
4823
+ if (!args.supplied) return;
4824
+ const result = await runPlatformOperation(
4825
+ options,
4826
+ timeoutMs,
4827
+ ({ client, signal }) => getEnvironmentCapabilitiesOperation.execute(
4828
+ { project: args.project },
4829
+ { client, signal }
4830
+ ),
4831
+ { announce: false }
4832
+ );
4833
+ if (result.capabilities.secretGrants !== true) {
4834
+ throw usageError(
4835
+ 'This MCPJam deployment does not support environment secret grants. Upgrade the platform, or omit --secret / "secretSelection".'
4836
+ );
4837
+ }
4838
+ }
4839
+ function suppliesSecretSelection(body) {
4840
+ return "secretSelection" in body;
4841
+ }
4822
4842
  function resolveEnvironmentProject(options, body = {}) {
4823
4843
  if (body.project !== void 0 && typeof body.project !== "string") {
4824
4844
  throw usageError(
@@ -4942,7 +4962,7 @@ function registerEnvironmentsCommands(program) {
4942
4962
  "Project-shared sandbox image (see `mcpjam cloud images`) to pin: eval runs boot a fresh sandbox from it"
4943
4963
  ).option(
4944
4964
  "--file <path>",
4945
- "Environment JSON file with any of name/hostId/description/serverAttachmentId/modelId/skillSelection/pluginVersionIds/sandboxImageId (or - for stdin)"
4965
+ "Environment JSON file with any of name/hostId/description/serverAttachmentId/modelId/skillSelection/secretSelection/pluginVersionIds/sandboxImageId (or - for stdin)"
4946
4966
  ).option("--json <json>", "Inline environment JSON (or @file, or -)").action(
4947
4967
  async (options, command) => {
4948
4968
  const globalOptions = getGlobalOptions(command);
@@ -4957,6 +4977,14 @@ function registerEnvironmentsCommands(program) {
4957
4977
  ...project
4958
4978
  }
4959
4979
  );
4980
+ await assertSecretGrantsSupported(
4981
+ platformOptionsOf(command),
4982
+ globalOptions.timeout,
4983
+ {
4984
+ supplied: suppliesSecretSelection(body),
4985
+ ...project
4986
+ }
4987
+ );
4960
4988
  const input = validateInput(createEnvironmentOperation, {
4961
4989
  ...body,
4962
4990
  ...project,
@@ -4992,17 +5020,29 @@ function registerEnvironmentsCommands(program) {
4992
5020
  ).option(
4993
5021
  "--skill <id...>",
4994
5022
  "Project-shared skill IDs to pin on the composed stack"
5023
+ ).option(
5024
+ "--secret <id...>",
5025
+ "Project SECRET IDs the composed stack grants to its runs. Without one a composed stack carries no credential \u2014 list them with `mcpjam secrets list`."
4995
5026
  ).action(
4996
5027
  async (options, command) => {
4997
5028
  const globalOptions = getGlobalOptions(command);
4998
5029
  const resolved = resolveEnvironmentProject(options);
5030
+ await assertSecretGrantsSupported(
5031
+ platformOptionsOf(command),
5032
+ globalOptions.timeout,
5033
+ {
5034
+ supplied: (options.secret?.length ?? 0) > 0,
5035
+ ...projectFields(resolved)
5036
+ }
5037
+ );
4999
5038
  const input = validateInput(ensureAdhocEnvironmentOperation, {
5000
5039
  ...projectFields(resolved),
5001
5040
  host: options.host,
5002
5041
  ...options.serverGroup !== void 0 ? { serverGroup: options.serverGroup } : {},
5003
5042
  ...options.model !== void 0 ? { model: options.model } : {},
5004
5043
  ...options.computer !== void 0 ? { computer: options.computer } : {},
5005
- ...options.skill?.length ? { skills: { mode: "explicit", skillIds: options.skill } } : {}
5044
+ ...options.skill?.length ? { skills: { mode: "explicit", skillIds: options.skill } } : {},
5045
+ ...options.secret?.length ? { secrets: { mode: "explicit", secretIds: options.secret } } : {}
5006
5046
  });
5007
5047
  const result = await runPlatformOperation(
5008
5048
  platformOptionsOf(command),
@@ -5042,7 +5082,7 @@ function registerEnvironmentsCommands(program) {
5042
5082
  }
5043
5083
  );
5044
5084
  environments.command("update").description(
5045
- "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"
5085
+ "Edit an environment. Only the fields you pass change; use --clear-model, or --file/--json with a null value, to clear serverAttachmentId, modelId, skillSelection, secretSelection, pluginVersionIds, or sandboxImageId"
5046
5086
  ).requiredOption("--environment <id-or-name>", "Environment name or ID").requiredOption(
5047
5087
  "--expected-revision <n>",
5048
5088
  "The revision you last read (from `environments get`); a stale value is rejected instead of overwriting a concurrent edit"
@@ -5078,6 +5118,14 @@ function registerEnvironmentsCommands(program) {
5078
5118
  ...project
5079
5119
  }
5080
5120
  );
5121
+ await assertSecretGrantsSupported(
5122
+ platformOptionsOf(command),
5123
+ globalOptions.timeout,
5124
+ {
5125
+ supplied: suppliesSecretSelection(body),
5126
+ ...project
5127
+ }
5128
+ );
5081
5129
  const input = validateInput(updateEnvironmentOperation, {
5082
5130
  ...body,
5083
5131
  ...project,
@@ -7635,7 +7683,7 @@ function selectorField(singular, plural, values) {
7635
7683
  }
7636
7684
  function composeField(options) {
7637
7685
  const models = Array.isArray(options.composeModel) ? options.composeModel : options.composeModel ? [options.composeModel] : void 0;
7638
- const refinements = options.composeComputer !== void 0 || models !== void 0 || (options.composeServer?.length ?? 0) > 0 || options.composeServerGroup !== void 0 || options.composeHostServers === true || (options.composeSkill?.length ?? 0) > 0 || options.withClientDefault === true || options.saveTargets === true;
7686
+ const refinements = options.composeComputer !== void 0 || models !== void 0 || (options.composeServer?.length ?? 0) > 0 || options.composeServerGroup !== void 0 || options.composeHostServers === true || (options.composeSkill?.length ?? 0) > 0 || (options.composeSecret?.length ?? 0) > 0 || options.withClientDefault === true || options.saveTargets === true;
7639
7687
  if (!options.composeHost) {
7640
7688
  if (refinements) {
7641
7689
  throw usageError(
@@ -7675,6 +7723,15 @@ function composeField(options) {
7675
7723
  mode: "explicit",
7676
7724
  skillIds: options.composeSkill
7677
7725
  }
7726
+ } : {},
7727
+ // The credential axis. Absent means the composed cells grant NOTHING —
7728
+ // the environment is the grant boundary, so a run that needs a token
7729
+ // used to have no choice but a named environment.
7730
+ ...options.composeSecret?.length ? {
7731
+ secrets: {
7732
+ mode: "explicit",
7733
+ secretIds: options.composeSecret
7734
+ }
7678
7735
  } : {}
7679
7736
  }
7680
7737
  };
@@ -9311,6 +9368,9 @@ function registerEvalCommands(program) {
9311
9368
  ).option(
9312
9369
  "--compose-skill <id...>",
9313
9370
  "Project-shared skill IDs to pin on the composed stack"
9371
+ ).option(
9372
+ "--compose-secret <id...>",
9373
+ "Project SECRET IDs the composed stack grants to its runs. Without one a composed stack carries no credential \u2014 list them with `mcpjam secrets list`."
9314
9374
  ).option(
9315
9375
  "--allow-approximated <case...>",
9316
9376
  "Approve an `approximated` imported case for THIS RUN ONLY (authored case id). Repeatable. --file only, and requires --approval-reason."
@@ -10433,6 +10493,9 @@ function registerEvalCommands(program) {
10433
10493
  ).option(
10434
10494
  "--compose-skill <id...>",
10435
10495
  "Project-shared skill IDs to pin on the composed stack"
10496
+ ).option(
10497
+ "--compose-secret <id...>",
10498
+ "Project SECRET IDs the composed stack grants to its runs. Without one a composed stack carries no credential \u2014 list them with `mcpjam secrets list`."
10436
10499
  ).action(
10437
10500
  async (options, command) => {
10438
10501
  if (options.repetitions !== void 0 && options.iterations !== void 0) {
@@ -12327,13 +12390,16 @@ function registerSessionsCommands(program) {
12327
12390
  "Stable key for THIS turn's intent. Reuse it when retrying: a retry with the same key replays the completed turn instead of running and billing it again. Do NOT generate a fresh key per attempt."
12328
12391
  ).option(
12329
12392
  "--session <sessionId>",
12330
- "Continue this session instead of starting one. Configuration is fixed at the first turn, so the flags below are refused with a session."
12393
+ "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."
12331
12394
  ).option(
12332
12395
  "--model <modelId>",
12333
12396
  'Provider-prefixed model id, e.g. "anthropic/claude-sonnet-5". Required to start a session; a bare id is rejected rather than guessed.'
12397
+ ).option(
12398
+ "--client <hostId>",
12399
+ "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."
12334
12400
  ).option(
12335
12401
  "--environment <environmentId>",
12336
- "Run against this environment's servers (mutually exclusive with --server)"
12402
+ "Run against this environment's servers (mutually exclusive with --server). An environment pins its own host, so a harness environment runs its harness on every turn, continuations included."
12337
12403
  ).option(
12338
12404
  "--server <serverId...>",
12339
12405
  "Run against these project servers (mutually exclusive with --environment)"
@@ -12352,6 +12418,7 @@ function registerSessionsCommands(program) {
12352
12418
  project: options.project,
12353
12419
  sessionId: options.session,
12354
12420
  modelId: options.model,
12421
+ hostId: options.client,
12355
12422
  environmentId: options.environment,
12356
12423
  serverIds: options.server,
12357
12424
  systemPrompt: options.systemPrompt,