agent-inspect 6.31.0 → 6.31.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.
@@ -8738,11 +8738,33 @@ function contractFailFinding(ruleId, message, evidence, expected, actual) {
8738
8738
  evidence: [...evidence]
8739
8739
  };
8740
8740
  }
8741
+ function parseAllowedStatus(status) {
8742
+ return ALLOWED_STATUS_ALIASES[status];
8743
+ }
8741
8744
  function normalizeStatus(status) {
8742
- if (status === "ok" || status === "error" || status === "running") return status;
8743
- if (status === "success") return "ok";
8744
- if (status === "failed") return "error";
8745
- return "error";
8745
+ const parsed = parseAllowedStatus(status);
8746
+ if (parsed === void 0) {
8747
+ throw new TypeError(
8748
+ `Unknown run status ${JSON.stringify(status)}. Allowed: ok, error, running (aliases: success, failed).`
8749
+ );
8750
+ }
8751
+ return parsed;
8752
+ }
8753
+ function validateAllowedStatusesShape(allowedStatuses, pathPrefix = "run.allowedStatuses") {
8754
+ if (!allowedStatuses?.length) return [];
8755
+ const out = [];
8756
+ for (let i = 0; i < allowedStatuses.length; i++) {
8757
+ const status = allowedStatuses[i];
8758
+ if (parseAllowedStatus(status) === void 0) {
8759
+ out.push({
8760
+ code: "contract.run.allowedStatuses.unknown",
8761
+ severity: "error",
8762
+ message: `${pathPrefix}[${i}] has unknown status ${JSON.stringify(status)}. Allowed: ok, error, running (aliases: success, failed).`,
8763
+ path: `${pathPrefix}[${i}]`
8764
+ });
8765
+ }
8766
+ }
8767
+ return out;
8746
8768
  }
8747
8769
  function cloneBody(body) {
8748
8770
  return {
@@ -9407,6 +9429,7 @@ function evaluateBody(input3, body, options = {}) {
9407
9429
  }
9408
9430
  function defineTraceContract(input3) {
9409
9431
  const shapeErrors = [
9432
+ ...validateAllowedStatusesShape(input3.run?.allowedStatuses),
9410
9433
  ...validateAlternativesShape(input3.alternatives),
9411
9434
  ...validateScopeShape(input3.scope),
9412
9435
  ...validateProvenanceShape(input3.observations)
@@ -9437,6 +9460,7 @@ function defineTraceContract(input3) {
9437
9460
  }
9438
9461
  function evaluateTraceContract(input3, contract, options = {}) {
9439
9462
  const shapeErrors = [
9463
+ ...validateAllowedStatusesShape(contract.run?.allowedStatuses),
9440
9464
  ...validateAlternativesShape(contract.alternatives),
9441
9465
  ...validateScopeShape(contract.scope),
9442
9466
  ...validateProvenanceShape(contract.observations)
@@ -9572,7 +9596,7 @@ function evaluateTraceContract(input3, contract, options = {}) {
9572
9596
  [...scopeFinding ? [scopeFinding] : [], noneFinding, ...prefixedBranchFindings]
9573
9597
  );
9574
9598
  }
9575
- var MAX_EVIDENCE_EVENT_IDS, METHOD_VOCABULARY;
9599
+ var ALLOWED_STATUS_ALIASES, MAX_EVIDENCE_EVENT_IDS, METHOD_VOCABULARY;
9576
9600
  var init_contract = __esm({
9577
9601
  "packages/core/src/checks/contract.ts"() {
9578
9602
  init_checks2();
@@ -9585,6 +9609,13 @@ var init_contract = __esm({
9585
9609
  init_outcomes();
9586
9610
  init_contract_scope();
9587
9611
  init_tool_arguments();
9612
+ ALLOWED_STATUS_ALIASES = {
9613
+ ok: "ok",
9614
+ error: "error",
9615
+ running: "running",
9616
+ success: "ok",
9617
+ failed: "error"
9618
+ };
9588
9619
  MAX_EVIDENCE_EVENT_IDS = 16;
9589
9620
  METHOD_VOCABULARY = new Set(OBSERVED_OUTCOME_METHODS);
9590
9621
  }
@@ -16122,7 +16153,7 @@ var init_src = __esm({
16122
16153
  });
16123
16154
 
16124
16155
  // package.json
16125
- var version = "6.31.0";
16156
+ var version = "6.31.1";
16126
16157
 
16127
16158
  // packages/cli/src/list.ts
16128
16159
  init_advanced();
@@ -23494,10 +23525,21 @@ function parseContractRunSection(value, pathPrefix = "contract.run") {
23494
23525
  );
23495
23526
  }
23496
23527
  if (record.allowedStatuses !== void 0) {
23497
- out.allowedStatuses = requireBoundedStringArray(
23528
+ const statuses = requireBoundedStringArray(
23498
23529
  record.allowedStatuses,
23499
23530
  `${pathPrefix}.allowedStatuses`
23500
23531
  );
23532
+ const allowed = /* @__PURE__ */ new Set(["ok", "error", "running", "success", "failed"]);
23533
+ for (let i = 0; i < statuses.length; i++) {
23534
+ const status = statuses[i];
23535
+ if (!allowed.has(status)) {
23536
+ throw new CheckConfigError(
23537
+ "AI_CHECK_CONFIG_INVALID_VALUE",
23538
+ `${pathPrefix}.allowedStatuses[${i}] must be one of: ok, error, running (aliases: success, failed); got ${JSON.stringify(status)}.`
23539
+ );
23540
+ }
23541
+ }
23542
+ out.allowedStatuses = statuses;
23501
23543
  }
23502
23544
  if (record.maxDurationMs !== void 0) {
23503
23545
  out.maxDurationMs = requireNonNegativeNumber(