@cavelon/cli 0.2.16 → 0.2.18

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.
@@ -40,7 +40,8 @@ export const AGENTS_BLOCK = [
40
40
  "",
41
41
  "This folder is a Cavelon solution (`cavelon.yaml`): edit `package/`, `tests/` and `env/`, then run `cavelon validate` and `cavelon apply`.",
42
42
  "Use the Cavelon skills (cavelon-loop, cavelon-authoring, cavelon-testing, cavelon-long-running); without them, `cavelon --help` and `cavelon docs search <query>` lead on.",
43
- "`cavelon apply` only previews; show a preview that reaches an active solution or `env/prod` to a person before `cavelon apply --confirm <id>`.",
43
+ "Before instance work, discover this session's Cavelon tools and call `whoami`. If unavailable, tell the person with a repair step; announce CLI fallback and check `cavelon whoami --json` before using it. An intentionally CLI-only client starts with that CLI check directly. Loaded skills alone do not prove a connection. Local authoring may continue.",
44
+ "`cavelon apply` normally previews: follow `show_to_person`, `needs_person` and its exact confirmation instructions. Review routine previews yourself; critical changes need one native approval or the person's own terminal. Person-enabled YOLO may execute eligible routine changes in one call.",
44
45
  "`cavelon status` shows the instance, tenant and open previews, and `.cavelon/inventory.md` the tenant's solutions, knowledge bases and tools. A person runs `cavelon login`; never handle a token.",
45
46
  ].join("\n");
46
47
  const GITIGNORE_BLOCK = ["# Local cavelon state (inventory, previews); never committed.", `${STATE_DIR}/`].join("\n");
@@ -699,7 +700,7 @@ async function runInit(ctx, input) {
699
700
  result = await importPackage(ctx, project, from, imported, boolOption(input, "force"));
700
701
  if (packageHarness && !project.harness && !stringOption(input, "harness"))
701
702
  await setProjectKey(project, "harness", packageHarness);
702
- next.unshift(`Check it offline: ${folderCommand("validate")}`, `Preview it on the instance: ${harness ? folderCommand("apply", "--env", "test") : folderCommand("apply", "--harness", fill("name or slug"))}`);
703
+ next.unshift(`Check the package: ${folderCommand("validate")}`, `Preview it on the instance: ${harness ? folderCommand("apply", "--env", "test") : folderCommand("apply", "--harness", fill("name or slug"))}`);
703
704
  }
704
705
  else if (!(await hasPackageFiles(root, project.layout.package))) {
705
706
  const choices = chosenHarness?.choices ?? [];
@@ -3,7 +3,7 @@ import { positional } from "../command.js";
3
3
  import { CavelonError, ExitCode, usageError } from "../errors.js";
4
4
  import { confirmation, PERSON_CONFIRMS_HELP } from "../confirm-token.js";
5
5
  import { callOperation, openapiOrWarn, workflowOperation } from "../invoke.js";
6
- import { changedBy, docsPage, formatValue, isOperatorChange, LIMIT_ABOVE_CEILING, limitRef, quotaSetting, readLimits, } from "../limits.js";
6
+ import { changedBy, docsPage, formatValue, isOperatorChange, LIMIT_ABOVE_CEILING, limitRef, NO_LIMIT, quotaSetting, readLimits, } from "../limits.js";
7
7
  import { deref, jsonBodySchema, operationForPath, validateBody } from "../openapi.js";
8
8
  import { readGlobalRole, readPrincipal } from "../principal.js";
9
9
  import { cavelonCommand } from "../printed.js";
@@ -18,8 +18,10 @@ const UNIT_WORDS = {
18
18
  const TRUE_WORDS = new Set(["true", "on", "yes", "enabled"]);
19
19
  const FALSE_WORDS = new Set(["false", "off", "no", "disabled"]);
20
20
  const CLEAR_WORDS = new Set(["none", "null"]);
21
+ const NO_LIMIT_WORDS = new Set(["unlimited", "no-limit", "no_limit", "nolimit"]);
21
22
  const RUN_CAPS_PAGE = "Platform › Operations › Rate limits › Run caps";
22
23
  const TENANT_LIMITS_PAGE = "the tenant's Limits section (Concurrent Agent Runs)";
24
+ const CAPACITY_PAGE = "the tenant's Limits section (Capacity)";
23
25
  const FEATURE_FLAGS_PAGE = "Configure › Feature Flags";
24
26
  function notPublished(message, hint, details = {}) {
25
27
  return new CavelonError(ExitCode.failure, { code: "operation_unavailable", message, hint, details: { ...details, sent: false } });
@@ -173,14 +175,19 @@ function bareExtension(word) {
173
175
  start++;
174
176
  return word.slice(start);
175
177
  }
178
+ function liftsLimit(target) {
179
+ return target.change.null_means === NO_LIMIT;
180
+ }
176
181
  function clears(target) {
177
182
  if (target.flag)
178
183
  return false;
179
- return target.kind === "limit" || Boolean(target.quota);
184
+ return target.kind === "limit" || Boolean(target.quota) || liftsLimit(target);
180
185
  }
181
186
  function parseValue(raw, kind, target) {
182
187
  const word = raw.trim();
183
188
  const lower = word.toLowerCase();
189
+ if (liftsLimit(target) && NO_LIMIT_WORDS.has(lower))
190
+ return null;
184
191
  if (CLEAR_WORDS.has(lower)) {
185
192
  if (!clears(target)) {
186
193
  throw usageError(target.flag
@@ -206,8 +213,9 @@ function parseValue(raw, kind, target) {
206
213
  const { digits, rest } = splitNumber(word, kind === "number");
207
214
  const unit = target.limit?.unit ?? target.quota?.unit ?? "count";
208
215
  const units = unit === "count" || unit === "processing_steps" ? "" : ` of ${unit}`;
216
+ const clearWith = liftsLimit(target) ? ", or none for no limit (0 allows none)" : clears(target) ? ", or none to clear it" : "";
209
217
  if (!digits)
210
- throw usageError(`${target.key} takes a ${kind === "number" ? "number" : "whole number"}${units}${clears(target) ? ", or none to clear it" : ""}; got "${raw}".`);
218
+ throw usageError(`${target.key} takes a ${kind === "number" ? "number" : "whole number"}${units}${clearWith}; got "${raw}".`);
211
219
  if (rest && !(UNIT_WORDS[unit] ?? []).includes(rest)) {
212
220
  throw usageError(`${target.key} is in ${unit}; "${raw}" is not. Give the number of ${unit}${UNIT_WORDS[unit] ? ` (e.g. ${digits} or ${digits}${UNIT_WORDS[unit][0]})` : ""}.`);
213
221
  }
@@ -270,6 +278,8 @@ function anyOf(names, none = "a permission the instance does not name") {
270
278
  function adminPage(target) {
271
279
  if (target.flag)
272
280
  return FEATURE_FLAGS_PAGE;
281
+ if (liftsLimit(target))
282
+ return CAPACITY_PAGE;
273
283
  if (target.change.field.startsWith("max_database_"))
274
284
  return "the tenant's Limits section (Database connections and Database queries)";
275
285
  return target.scope === "one_tenant" ? TENANT_LIMITS_PAGE : RUN_CAPS_PAGE;
@@ -368,6 +378,12 @@ async function pathParams(ctx, change, principal) {
368
378
  function valueText(target, value, kind) {
369
379
  if (value === undefined)
370
380
  return "not published";
381
+ if (liftsLimit(target)) {
382
+ if (value === null)
383
+ return "no limit";
384
+ if (value === 0)
385
+ return "0 (none allowed)";
386
+ }
371
387
  if (value === null) {
372
388
  if (target.quota)
373
389
  return "none (no cap)";
@@ -420,7 +436,9 @@ function noChange(target, previous, value, from) {
420
436
  return previous === value ? `${target.key} is already ${from} (${target.flag.setting})` : undefined;
421
437
  if (target.kind === "quota") {
422
438
  const wanted = target.quota ? capValue(value) : value;
423
- return previous !== undefined && sameValue(previous, wanted) ? `${target.key} is already ${from}` : undefined;
439
+ if (previous !== undefined && sameValue(previous, wanted))
440
+ return `${target.key} is already ${from}${target.scope === "one_tenant" ? " for this tenant" : ""}`;
441
+ return undefined;
424
442
  }
425
443
  const limit = target.limit;
426
444
  if (target.scope === "one_tenant") {
@@ -478,6 +496,8 @@ export const limitsSet = {
478
496
  description: "Reads the limit's published change (operation, body field, bounds, permissions, roles) and checks the value against it\n" +
479
497
  "before sending. Without --confirm, shows the old and new value, the operation and who may run it, and changes nothing.\n" +
480
498
  "Also changes the tenant quotas in tenant_quotas.changes (the inference budget, the monthly Processing Step cap).\n" +
499
+ "An operator sets a tenant's capacity limits (max_agents, max_tools, max_knowledge_bases, max_documents_per_kb,\n" +
500
+ "max_storage_bytes) where the instance publishes them: none lifts one (no limit), 0 allows none.\n" +
481
501
  "An operator's change (a run cap) is sent only with a personal access token in Platform mode of a role it names, without\n" +
482
502
  "X-Tenant-Id; --tenant <id|slug> then sets one tenant's override, including database connection/query caps. An environment or licence limit, a value out of bounds,\n" +
483
503
  "an instance that does not publish how to change the limit, and a credential without the permission or the role are refused\n" +
@@ -491,7 +511,8 @@ export const limitsSet = {
491
511
  { name: "key", description: "The limit's key, as `cavelon limits` lists it (e.g. kb_upload_max_file_size_mb).", required: true },
492
512
  {
493
513
  name: "value",
494
- description: "The new value in the limit's unit (50 or 50MB), a comma-separated list of file types, true/false, or none to clear the tenant's own value.",
514
+ description: "The new value in the limit's unit (50 or 50MB), a comma-separated list of file types, true/false, or none to clear the tenant's own value " +
515
+ "(on a capacity limit, none is no limit and 0 allows none).",
495
516
  required: true,
496
517
  },
497
518
  ],
@@ -507,6 +528,7 @@ export const limitsSet = {
507
528
  "cavelon limits set monthly_processing_step_cap none --confirm",
508
529
  "cavelon limits set max_concurrent_agent_runs_global 150 --confirm",
509
530
  "cavelon limits set max_concurrent_agent_runs_per_tenant 6 --tenant acme --confirm",
531
+ "cavelon limits set max_agents none --tenant acme --confirm",
510
532
  ],
511
533
  async run(ctx, input) {
512
534
  const key = positional(input, "key").trim();
@@ -3,7 +3,7 @@ import { listOption, stringOption } from "../command.js";
3
3
  import { CavelonError, ExitCode } from "../errors.js";
4
4
  import { table } from "../format.js";
5
5
  import { branchConcurrency, branchConcurrencyText } from "../branches.js";
6
- import { bindsNow, bindsWhenText, changedBy, docsPage, formatQuota, formatQuotaValue, formatValue, isOperatorChange, readLimits, readQuotas, } from "../limits.js";
6
+ import { bindsNow, bindsWhenText, changedBy, docsPage, formatQuota, formatQuotaValue, formatValue, isOperatorChange, NO_LIMIT, quotaLimitText, readLimits, readQuotas, } from "../limits.js";
7
7
  import { cavelonCommand, fill } from "../printed.js";
8
8
  import { databaseLimitsText, readDatabaseLimits } from "../database-limits.js";
9
9
  const SOURCE_ORDER = ["tenant", "platform", "licence"];
@@ -30,8 +30,14 @@ function periodText(quota) {
30
30
  function quotaUse(quota) {
31
31
  if (quota.current !== null || quota.limit !== null)
32
32
  return formatQuota(quota);
33
- const numbers = Object.entries(quota.details).filter(([, v]) => typeof v === "number");
34
- return numbers.length ? numbers.map(([k, v]) => `${k} ${String(v)}`).join(", ") : "-";
33
+ const isLimit = (k) => k.startsWith("limit");
34
+ const shown = Object.entries(quota.details).filter(([k, v]) => typeof v === "number" || (v === null && isLimit(k)));
35
+ const text = (k, v) => {
36
+ if (!isLimit(k) || (typeof v === "number" && !(v === 0 && quota.none_allowed_at_zero)))
37
+ return String(v);
38
+ return quotaLimitText(v, quota.none_allowed_at_zero);
39
+ };
40
+ return shown.length ? shown.map(([k, v]) => `${k} ${text(k, v)}`).join(", ") : "-";
35
41
  }
36
42
  export const limits = {
37
43
  name: "limits",
@@ -129,7 +135,10 @@ export const limits = {
129
135
  text += `\n\nClose to a quota: ${near.map((q) => q.text).join("; ")}`;
130
136
  const quotaChanges = keys.length || source ? [] : (published.tenantQuotas?.changes ?? []);
131
137
  const tenantChangeable = [...values.filter((v) => v.change && !isOperatorChange(v.change)).map((v) => v.key), ...quotaChanges.filter((c) => !isOperatorChange(c)).map((c) => c.key)];
132
- const operatorChangeable = values.filter((v) => [v.change, v.tenant_change].some((c) => c && isOperatorChange(c))).map((v) => v.key);
138
+ const operatorChangeable = [
139
+ ...values.filter((v) => [v.change, v.tenant_change].some((c) => c && isOperatorChange(c))).map((v) => v.key),
140
+ ...quotaChanges.filter((c) => isOperatorChange(c)).map((c) => c.key),
141
+ ];
133
142
  if (tenantChangeable.length) {
134
143
  const owner = quotaValues.filter((q) => q.changeable_by === "tenant_owner" && tenantChangeable.includes(q.key)).map((q) => q.key);
135
144
  text += `\n\nA tenant admin changes ${tenantChangeable.length === 1 ? "it" : "these"} with: ${cavelonCommand("limits", "set", fill("key"), fill("value"))} (shows the change; --confirm sends it)`;
@@ -138,6 +147,9 @@ export const limits = {
138
147
  }
139
148
  if (operatorChangeable.length) {
140
149
  text += `\n\nAn operator changes ${operatorChangeable.join(", ")} with the same command and a personal access token in Platform mode of the role the change names; --tenant <id|slug> selects one tenant's override or flag.`;
150
+ const liftable = quotaChanges.filter((c) => c.null_means === NO_LIMIT).map((c) => c.key);
151
+ if (liftable.length)
152
+ text += ` For ${liftable.join(", ")}, none lifts the limit (no limit) and 0 allows none.`;
141
153
  }
142
154
  const pages = [...new Set(values.map((v) => docsPage(v.docs)).filter(Boolean))];
143
155
  if (pages.length)
@@ -420,6 +420,7 @@ async function runCheck(ctx, input) {
420
420
  for (const probe of probes) {
421
421
  lines.push(`${mark(probe.ok)}The Cavelon tools start: ${probe.command}${probe.ok ? (probe.server ? ` (${probe.server})` : "") : ` (${probe.error})`}`);
422
422
  }
423
+ lines.push("This checks a separately started server, not the current coding-agent session. In Claude Code, open /mcp and call Cavelon's whoami tool to verify that session.");
423
424
  lines.push(loginCheck.ok
424
425
  ? `${mark(true)}Logged in to ${loginCheck.instance}${loginCheck.who ? ` as ${loginCheck.who}` : ""}${loginCheck.tenant ? `, tenant ${loginCheck.tenant}` : ""}`
425
426
  : `${mark(false)}Login: ${loginCheck.problem}`);
@@ -428,6 +429,7 @@ async function runCheck(ctx, input) {
428
429
  return {
429
430
  data: {
430
431
  ok,
432
+ session_connection: "not_checked",
431
433
  agents: checks.map(({ servers: _servers, ...c }) => c),
432
434
  server: probes,
433
435
  login: loginCheck,
@@ -502,7 +504,8 @@ export const setup = {
502
504
  "and the skills in their user skills folder. It touches nothing else in those files and\n" +
503
505
  "records what it did, so --remove undoes exactly that. Then it logs in if needed, choosing the tenant by name as `login` does.\n" +
504
506
  "The server starts as `cavelon mcp` when cavelon is installed, otherwise through npx. --check reports what is set up and\n" +
505
- "working: each agent's entry, the MCP server starting, and the login. An agent found but never set up for Cavelon is\n" +
507
+ "working: each agent's entry, a separately started MCP server, and the login. It does not verify the current agent session's connection.\n" +
508
+ "An agent found but never set up for Cavelon is\n" +
506
509
  "reported and skipped (exit 0 when the rest works); --strict, or naming it with --agents, counts it.\n" +
507
510
  "--update refreshes plugins and owned skills, including the current solution's generated setup, and keeps your login.\n" +
508
511
  "--mcp-mode saves a personal startup choice; restart your coding agent to apply it. Critical changes still need approval.\n" +
@@ -409,7 +409,7 @@ function schemaUsedLine(used, ttlSeconds) {
409
409
  }
410
410
  export const validate = {
411
411
  name: "validate",
412
- summary: "Check the package files against the instance's package schema, offline.",
412
+ summary: "Check the package files against the instance's published package schema.",
413
413
  description: "Uses the schema and error catalog cached by init, pull or apply; fetches them only when none is cached or a development\n" +
414
414
  "build's copy is past its time-to-live, and never with --offline. A development build keeps one version while its schema\n" +
415
415
  "changes, so its copy is read again after a minute (CAVELON_CONTRACT_TTL_SECONDS), or checked with the ETag the instance\n" +
@@ -1051,8 +1051,8 @@ export const apply = {
1051
1051
  "secrets (`cavelon secrets set <name>`, or in the Admin where the instance lets no token set one), never the agent.\n" +
1052
1052
  "Where the instance says this credential cannot import (needs_a_person), it still previews but prints no confirm\n" +
1053
1053
  "command: a person imports in the Admin or with their own personal access token. --confirm refuses before sending (exit 5).\n" +
1054
- "Show a preview that reaches an active solution or env/prod to a person before confirming. Such a preview (show_to_person:\n" +
1055
- "tenant-wide sections, an active solution, deletions, env/prod, or database query writes) a coding agent cannot confirm.\n" +
1054
+ "Follow the preview's show_to_person and needs_person requirements. Routine isolated-draft previews may be confirmed within the requested work.\n" +
1055
+ "Tenant-wide changes, active effects without explicit draft isolation, deletions, env/prod and database query writes need a person.\n" +
1056
1056
  "Over MCP the client asks the person; from an agent's shell the person runs the confirm in their own terminal. A stale preview exits 4 and\n" +
1057
1057
  "imports nothing: one whose target changed on the instance since, one whose package files changed since (what they\n" +
1058
1058
  "hold, not their formatting; --allow-stale imports what the preview showed anyway), and one older than a day. So does\n" +
@@ -9,7 +9,7 @@ import { confirmation } from "../confirm-token.js";
9
9
  import { confinedPath } from "../paths.js";
10
10
  import { clip, keyValues, moreHint, table } from "../format.js";
11
11
  import { callOperation, callStable, workflowOperation } from "../invoke.js";
12
- import { deref } from "../openapi.js";
12
+ import { deref, jsonBodySchema } from "../openapi.js";
13
13
  import { bindsNow, changedBy, limitError, limitsOrWarn, readLimits } from "../limits.js";
14
14
  import { getOperation } from "../operations.js";
15
15
  import { caseCounts, caseLabel, countsText, failedCase, caseKnowledgeOutcomes, NOT_PASSED, runVerdict } from "../results.js";
@@ -653,16 +653,45 @@ function votesNot(suite) {
653
653
  const tags = Array.isArray(suite.tags) ? suite.tags : [];
654
654
  return tags.includes(ENGAGEMENT_TAG) && tags.some((t) => typeof t === "string" && t.startsWith(RULE_TAG_PREFIX) && t.length > RULE_TAG_PREFIX.length);
655
655
  }
656
- function skippedView(suite) {
657
- return { suite: suite.name, suite_id: suite.id, ...(suite.purpose ? { purpose: suite.purpose } : {}), reason: "not_in_readiness" };
656
+ function isQuestionCheck(suite) {
657
+ if (suite.purpose)
658
+ return suite.purpose === "engagement_check";
659
+ const tags = Array.isArray(suite.tags) ? suite.tags : [];
660
+ return tags.includes(ENGAGEMENT_TAG);
661
+ }
662
+ function skippedView(suite, reason = "not_in_readiness") {
663
+ return { suite: suite.name, suite_id: suite.id, ...(suite.purpose ? { purpose: suite.purpose } : {}), reason };
658
664
  }
659
665
  function skippedText(skipped) {
660
666
  if (!skipped.length)
661
667
  return "";
662
668
  const names = skipped.map((s) => `"${s.name}"`).join(", ");
663
- return (`Skipped ${skipped.length === 1 ? "1 suite that does" : `${skipped.length} suites that do`} not vote in readiness (campaign question checks): ${names}. ` +
669
+ const why = skipped.every(isQuestionCheck) ? " (campaign question checks)" : "";
670
+ return (`Skipped ${skipped.length === 1 ? "1 suite that does" : `${skipped.length} suites that do`} not vote in readiness${why}: ${names}. ` +
664
671
  `Run one with: ${cavelonCommand("test", "run", "--suite", skipped[0].name)}`);
665
672
  }
673
+ function withoutProfileText(skipped, profile) {
674
+ if (!skipped.length)
675
+ return "";
676
+ const names = skipped.map((s) => `"${s.name}"`).join(", ");
677
+ return `Skipped ${skipped.length === 1 ? "1 suite" : `${skipped.length} suites`} without the run profile "${profile}": ${names}.`;
678
+ }
679
+ function hasProfile(suite, profile) {
680
+ return Array.isArray(suite.profiles) ? suite.profiles.includes(profile) : undefined;
681
+ }
682
+ async function requireRunField(ctx, field) {
683
+ const { doc, op } = await workflowOperation(ctx, "POST", "/api/v1/test-suites/{suite_id}/runs", "test runs");
684
+ const schema = doc ? jsonBodySchema(op) : undefined;
685
+ const properties = doc && schema ? deref(doc, schema)?.properties : undefined;
686
+ if (properties && field in properties)
687
+ return;
688
+ throw new CavelonError(ExitCode.failure, {
689
+ code: "operation_unavailable",
690
+ message: `This instance's OpenAPI does not establish support for ${field} in test runs (POST /api/v1/test-suites/{suite_id}/runs), so nothing was sent.`,
691
+ hint: `The instance may be older than run profiles or its request schema unavailable. Restore its published contract, or run the whole suite instead. \`${cavelonCommand("status")}\` shows its version.`,
692
+ details: { sent: false },
693
+ });
694
+ }
666
695
  function summaryText(summary) {
667
696
  const verdict = runVerdict(summary);
668
697
  const shown = ["passed", "failed", "errors"].filter((k) => k in summary).map((k) => k + " " + String(summary[k]));
@@ -676,6 +705,10 @@ function summaryText(summary) {
676
705
  }
677
706
  return shown.join(" ");
678
707
  }
708
+ function skippedData(skipped, withoutProfile) {
709
+ const all = [...skipped.map((s) => skippedView(s)), ...withoutProfile.map((s) => skippedView(s, "no_profile"))];
710
+ return all.length ? { skipped: all } : {};
711
+ }
679
712
  function resumeCommand(pending, timeout) {
680
713
  return cavelonCommand("wait", ...pending, ...(timeout ? ["--timeout", timeout] : []));
681
714
  }
@@ -684,6 +717,10 @@ export const testRun = {
684
717
  summary: "Start test-suite runs; returns operation ids.",
685
718
  description: "Without --suite, runs every suite of the solution (--harness, or cavelon.yaml's harness), except suites that never\n" +
686
719
  "vote in readiness, such as a campaign's question checks: they are listed as skipped, and --suite runs one.\n" +
720
+ "--profile runs one of each suite's run profiles, by its key, in place of the whole suite: without --suite, every\n" +
721
+ "suite that has it, the others listed as skipped. Where a suite's gate names a profile, only a run of that profile\n" +
722
+ "counts for publishing. --tags runs the cases carrying one of the tags. An instance older than run profiles refuses\n" +
723
+ "both before anything is sent. An unavailable request schema also refuses both; whole-suite runs keep their fallback.\n" +
687
724
  "With --wait, exits 1 when a case failed or a run measured nothing comparable (cases not run, technical errors),\n" +
688
725
  "5 when answers wait for a manual verdict or a value a case needs.\n" +
689
726
  "--as-chat-user chooses a Chat User reader for these runs only, for knowledge and identity-bound database queries;\n" +
@@ -699,13 +736,27 @@ export const testRun = {
699
736
  suite: { type: "string", multiple: true, value: "<suite>", description: "Suite name or id." },
700
737
  harness: { type: "string", value: "<harness>", description: "The solution to run against: its name, slug or id." },
701
738
  "as-chat-user": AS_CHAT_USER_OPTION,
739
+ profile: { type: "string", value: "<profile>", description: "Run this run profile of each suite (its key), in place of the whole suite." },
740
+ tags: { type: "string", multiple: true, value: "<tag>", description: "Run only the cases carrying one of these tags." },
702
741
  wait: WAIT_OPTION,
703
742
  timeout: TIMEOUT_OPTION,
704
743
  "idempotency-key": { type: "string", value: "<key>", description: "Send an Idempotency-Key with each start." },
705
744
  },
706
- examples: ["cavelon test run --suite smoke --wait --timeout 10m", "cavelon test run --harness support --json"],
745
+ examples: [
746
+ "cavelon test run --suite smoke --wait --timeout 10m",
747
+ "cavelon test run --harness support --json",
748
+ "cavelon test run --profile s0 --wait",
749
+ ],
707
750
  async run(ctx, input) {
708
751
  const session = await ctx.session();
752
+ const profile = stringOption(input, "profile");
753
+ const tags = listOption(input, "tags");
754
+ if (profile !== undefined && tags.length)
755
+ throw usageError("Give --profile or --tags, not both.");
756
+ if (profile !== undefined)
757
+ await requireRunField(ctx, "profile");
758
+ if (tags.length)
759
+ await requireRunField(ctx, "tags");
709
760
  const reader = await chatUserReader(ctx, input, "/api/v1/test-suites/{suite_id}/runs");
710
761
  const harnessRef = stringOption(input, "harness") ?? session.project?.harness;
711
762
  const harnessId = harnessRef ? await resolveHarnessId(ctx, harnessRef) : undefined;
@@ -715,6 +766,7 @@ export const testRun = {
715
766
  const wanted = listOption(input, "suite");
716
767
  let chosen;
717
768
  let skipped = [];
769
+ let withoutProfile = [];
718
770
  if (wanted.length) {
719
771
  chosen = wanted.map((ref) => {
720
772
  const hit = suites.find((s) => s.id === ref) ?? suites.filter((s) => s.name.toLowerCase() === ref.toLowerCase());
@@ -729,11 +781,30 @@ export const testRun = {
729
781
  }
730
782
  return hit;
731
783
  });
784
+ const lacking = profile === undefined ? undefined : chosen.find((s) => hasProfile(s, profile) === false);
785
+ if (lacking) {
786
+ throw new CavelonError(ExitCode.failure, {
787
+ code: "profile_unknown",
788
+ message: `The suite "${lacking.name}" has no run profile "${profile}", so nothing was sent.`,
789
+ hint: `\`${cavelonCommand("api", "list_suites")}\` lists each suite's profiles.`,
790
+ details: { sent: false },
791
+ });
792
+ }
732
793
  }
733
794
  else {
734
795
  const current = suites.filter((s) => !s.archived_at);
735
796
  skipped = current.filter(votesNot);
736
797
  chosen = current.filter((s) => !votesNot(s));
798
+ if (profile !== undefined) {
799
+ withoutProfile = chosen.filter((s) => hasProfile(s, profile) === false);
800
+ chosen = chosen.filter((s) => hasProfile(s, profile) !== false);
801
+ }
802
+ if (chosen.length === 0 && withoutProfile.length) {
803
+ throw new CavelonError(ExitCode.failure, {
804
+ code: "no_suites",
805
+ message: `${harnessRef ? `${harnessRef} has no test suites` : "This tenant has no test suites"} with the run profile "${profile}". ${withoutProfileText(withoutProfile, profile)}`,
806
+ });
807
+ }
737
808
  if (chosen.length === 0) {
738
809
  throw new CavelonError(ExitCode.failure, {
739
810
  code: "no_suites",
@@ -748,6 +819,10 @@ export const testRun = {
748
819
  const body = { ...reader };
749
820
  if (harnessId)
750
821
  body.harness_id = harnessId;
822
+ if (profile !== undefined)
823
+ body.profile = profile;
824
+ if (tags.length)
825
+ body.tags = tags;
751
826
  runs.push(await callStable(ctx, "POST", "/api/v1/test-suites/{suite_id}/runs", "test runs", {
752
827
  params: { suite_id: [suite.id] },
753
828
  body,
@@ -782,19 +857,21 @@ export const testRun = {
782
857
  "",
783
858
  ...results.map((r) => `${r.suite}: ${r.status} ${summaryText(r.summary)}`),
784
859
  ...(skipped.length ? ["", skippedText(skipped)] : []),
860
+ ...(withoutProfile.length ? ["", withoutProfileText(withoutProfile, profile)] : []),
785
861
  ...(resume ? ["", `${waited.why} after the timeout; the runs go on. Resume: ${resume}`] : []),
786
862
  ].join("\n");
787
863
  return {
788
- data: { runs: results, failed_cases: failedCases, ...waited.data, ...reader, ...(skipped.length ? { skipped: skipped.map(skippedView) } : {}), ...(resume ? { resume } : {}) },
864
+ data: { runs: results, failed_cases: failedCases, ...waited.data, ...reader, ...skippedData(skipped, withoutProfile), ...(resume ? { resume } : {}) },
789
865
  text: reader ? `Reading as Chat User ${reader.reader_chat_user_id} for these runs only.\n${text}` : text,
790
866
  exitCode,
791
867
  };
792
868
  }
793
869
  return {
794
- data: { runs: started, operation_ids: operationIds, ...reader, ...(skipped.length ? { skipped: skipped.map(skippedView) } : {}) },
870
+ data: { runs: started, operation_ids: operationIds, ...reader, ...skippedData(skipped, withoutProfile) },
795
871
  text: (reader ? `Reading as Chat User ${reader.reader_chat_user_id} for these runs only.\n` : "") +
796
872
  table(started, ["suite", "run_id", "status", "operation_id"]) +
797
873
  (skipped.length ? `\n\n${skippedText(skipped)}` : "") +
874
+ (withoutProfile.length ? `\n\n${withoutProfileText(withoutProfile, profile)}` : "") +
798
875
  (operationIds.length ? `\n\nWait with: ${cavelonCommand("wait", ...operationIds)}` : ""),
799
876
  };
800
877
  },
package/dist/kit-codes.js CHANGED
@@ -87,6 +87,7 @@ export const KIT_ERROR_CODES = [
87
87
  { code: "model_not_found", area: "cli", message: "The tenant's Model Registry has no row by that name or id.", hint: "`cavelon models list` shows its rows by model_id and id." },
88
88
  { code: "variable_not_set", area: "cli", message: "The tenant has no variable by that name.", hint: "`cavelon variables list` shows them; `cavelon variables set <name> <value>` sets one." },
89
89
  { code: "no_suites", area: "cli", message: "The solution (or tenant) has no test suites.", hint: "Write one in tests/ and apply it; the cavelon-testing skill shows how." },
90
+ { code: "profile_unknown", area: "cli", message: "A suite named with --suite has no run profile of that key; nothing was sent.", hint: "`cavelon api list_suites` lists each suite's profiles; a suite defines them under settings.profiles." },
90
91
  { code: "no_result", area: "cli", message: "The operation has no result yet.", hint: "`cavelon wait <op_id>` waits for it." },
91
92
  { code: "no_trace", area: "cli", message: "The operation's result has no trace.", hint: "Trace a run, test run or conversation id instead." },
92
93
  { code: "run_not_found", area: "cli", message: "No run, test run or conversation with that id in this tenant.", hint: "Check the id and the tenant (`cavelon whoami`); --kind names what the id is." },
package/dist/limits.js CHANGED
@@ -2,6 +2,13 @@ import { CavelonError, ExitCode } from "./errors.js";
2
2
  import { readPrincipal } from "./principal.js";
3
3
  import { cavelonCommand } from "./printed.js";
4
4
  const NEAR = 0.8;
5
+ const NONE_ALLOWED = "none_allowed";
6
+ export const NO_LIMIT = "no_limit";
7
+ export function quotaLimitText(limit, noneAllowedAtZero) {
8
+ if (limit === null || (typeof limit === "number" && limit <= 0 && !(noneAllowedAtZero && limit === 0)))
9
+ return "no limit";
10
+ return limit === 0 ? "0 (none allowed)" : String(limit);
11
+ }
5
12
  export function changedBy(limit) {
6
13
  if (limit.changeable_by === "tenant_admin")
7
14
  return "a tenant admin";
@@ -109,6 +116,7 @@ export function parseChange(raw) {
109
116
  const maximumSetting = text(entry.maximum_setting);
110
117
  const roles = Array.isArray(entry.requires_role) ? entry.requires_role.filter((r) => typeof r === "string" && r !== "") : [];
111
118
  const mode = text(entry.mode);
119
+ const nullMeans = text(entry.null_means);
112
120
  return {
113
121
  operation,
114
122
  method,
@@ -120,6 +128,7 @@ export function parseChange(raw) {
120
128
  ...(maximumSetting ? { maximum_setting: maximumSetting } : {}),
121
129
  ...(roles.length ? { requires_role: roles } : {}),
122
130
  ...(mode ? { mode } : {}),
131
+ ...(nullMeans ? { null_means: nullMeans } : {}),
123
132
  };
124
133
  }
125
134
  export function isOperatorChange(change) {
@@ -233,11 +242,23 @@ export async function limitsOrWarn(ctx) {
233
242
  function quotaOf(key, raw) {
234
243
  const current = typeof raw.current === "number" ? raw.current : null;
235
244
  const limit = typeof raw.limit === "number" ? raw.limit : null;
236
- const ratio = current !== null && limit !== null && limit > 0 ? current / limit : null;
245
+ const noneAllowedAtZero = raw.zero_means === NONE_ALLOWED;
246
+ const full = noneAllowedAtZero && limit === 0 && current !== null;
247
+ const ratio = full ? 1 : current !== null && limit !== null && limit > 0 ? current / limit : null;
237
248
  const warning = typeof raw.warning_ratio === "number" && raw.warning_ratio > 0 ? raw.warning_ratio : NEAR;
238
249
  const link = raw.change;
239
250
  const change = link && typeof link.key === "string" && typeof link.field === "string" ? { key: link.key, field: link.field } : undefined;
240
- return { key, current, limit, ratio, warning_ratio: warning, near: ratio !== null && ratio >= warning, details: raw, ...(change ? { change } : {}) };
251
+ return {
252
+ key,
253
+ current,
254
+ limit,
255
+ ratio,
256
+ warning_ratio: warning,
257
+ near: ratio !== null && ratio >= warning,
258
+ details: raw,
259
+ ...(change ? { change } : {}),
260
+ none_allowed_at_zero: noneAllowedAtZero,
261
+ };
241
262
  }
242
263
  export async function readQuotas(ctx, limits) {
243
264
  const link = limits.tenantQuotas;
@@ -301,6 +322,8 @@ export function formatQuota(quota) {
301
322
  if (quota.current === null && quota.limit === null)
302
323
  return "-";
303
324
  const used = quota.current === null ? "?" : String(quota.current);
325
+ if (quota.limit === 0 && quota.none_allowed_at_zero)
326
+ return `${used} of 0 (none allowed)`;
304
327
  if (quota.limit === null || quota.limit <= 0)
305
328
  return `${used} (no limit)`;
306
329
  return `${used} of ${quota.limit}${quota.ratio === null ? "" : ` (${Math.round(quota.ratio * 100)}%)`}`;
package/dist/mcp.js CHANGED
@@ -33,8 +33,8 @@ const INSTRUCTIONS = "Tools for one Cavelon instance, acting with the token a pe
33
33
  "kb_upload names files that match an active document of the knowledge base; with replace it replaces them, and where the " +
34
34
  "instance's upload cannot, it returns what it would deactivate and uploads nothing without its confirm_token. " +
35
35
  "init, pull and fmt change nothing on the instance (pull only reads it); they write files in the solution folder without confirm " +
36
- "(pull refuses to replace a package file that changed since the last pull or apply and is not committed, unless force), " +
37
- "and the other changing tools act at once. api refuses, even with confirm, an operation the instance marks for a person " +
36
+ "(pull refuses to replace a package file that changed since the last pull or apply and is not committed, unless force). " +
37
+ "Other changing tools follow their declared preview and confirmation rules. api refuses, even with confirm, an operation the instance marks for a person " +
38
38
  "(x-cavelon-person-only; its reason is in the error), or on an instance that marks none, one that changes a secret, " +
39
39
  "creates or revokes a credential (tokens, API keys, sign-in) or decides an approval; it also refuses a body that sets a field " +
40
40
  "the instance marks as a secret value (x-cavelon-secret): leave the field out and let a person enter the value. " +
@@ -1,4 +1,4 @@
1
- @modelcontextprotocol/sdk 1.32.1
1
+ @modelcontextprotocol/sdk 1.32.2
2
2
  MIT License
3
3
 
4
4
  Copyright (c) 2024 Anthropic, PBC
@@ -129,7 +129,7 @@ SOFTWARE.
129
129
 
130
130
  ---
131
131
 
132
- fast-uri 3.1.8
132
+ fast-uri 3.1.9
133
133
  Copyright (c) 2011-2021, Gary Court until https://github.com/garycourt/uri-js/commit/a1acf730b4bba3f1097c9f52e7d9d3aba8cdcaae
134
134
  Copyright (c) 2021-present The Fastify team <https://github.com/fastify/fastify#team>
135
135
  All rights reserved.
@@ -277,7 +277,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
277
277
 
278
278
  ---
279
279
 
280
- typebox 1.4.2
280
+ typebox 1.4.3
281
281
  TypeBox
282
282
 
283
283
  The MIT License (MIT)