@primitive.ai/prim 0.1.0-alpha.109 → 0.1.0-alpha.110

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.
@@ -17609,7 +17609,7 @@ function validate57(data, { instancePath = "", parentData, parentDataProperty, r
17609
17609
  return errors === 0;
17610
17610
  }
17611
17611
  validate57.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
17612
- var schema107 = { "type": "object", "properties": { "protocolVersion": { "type": "number", "const": 3 }, "checkId": { "type": "string", "pattern": "^[A-Za-z0-9._:-]{1,128}$" }, "verdict": { "type": "string", "enum": ["allow", "warn", "ask", "block", "unavailable"] }, "reasonCode": { "type": "string" }, "message": { "type": "string" }, "conflicts": { "type": "array", "items": { "type": "object", "properties": { "decisionId": { "type": "string" }, "shortId": { "type": "string" } }, "required": ["decisionId"], "additionalProperties": {} } }, "bypassed": { "type": "array", "items": { "type": "object", "properties": { "decisionId": { "type": "string" }, "bypassId": { "type": "string" }, "shortId": { "type": "string" } }, "required": ["decisionId"], "additionalProperties": {} } }, "decisionDisclosures": { "minItems": 1, "maxItems": 16, "type": "array", "items": { "type": "object", "properties": { "decisionId": { "type": "string" }, "shortId": { "type": "string" }, "participation": { "type": "string", "enum": ["candidate", "reconcile_bypass"] } }, "required": ["decisionId", "shortId", "participation"], "additionalProperties": false } } }, "required": ["protocolVersion", "verdict", "reasonCode", "message", "conflicts", "bypassed"], "additionalProperties": {} };
17612
+ var schema107 = { "type": "object", "properties": { "protocolVersion": { "type": "number", "const": 3 }, "checkId": { "type": "string", "pattern": "^[A-Za-z0-9._:-]{1,128}$" }, "verdict": { "type": "string", "enum": ["allow", "warn", "ask", "block", "unavailable"] }, "reasonCode": { "type": "string" }, "message": { "type": "string" }, "conflicts": { "type": "array", "items": { "type": "object", "properties": { "decisionId": { "type": "string" }, "shortId": { "type": "string" }, "title": { "type": "string" } }, "required": ["decisionId"], "additionalProperties": {} } }, "bypassed": { "type": "array", "items": { "type": "object", "properties": { "decisionId": { "type": "string" }, "bypassId": { "type": "string" }, "shortId": { "type": "string" } }, "required": ["decisionId"], "additionalProperties": {} } }, "evaluationCoverage": { "type": "object", "properties": { "candidateCount": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "submittedCount": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "evaluatedCount": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "status": { "type": "string", "enum": ["completed", "partial", "unavailable", "not_run", "unknown"] }, "semanticBatchCount": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "completedSemanticBatchCount": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "selectionOmissions": { "type": "array", "items": { "type": "object", "properties": { "source": { "type": "string", "enum": ["exact_scope", "location_scope", "organization_scope", "candidate_scan", "candidate_limit", "bypass_scan"] }, "reason": { "type": "string", "enum": ["scan_limit", "candidate_limit", "bucket_limit"] }, "omittedCountLowerBound": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": ["source", "reason", "omittedCountLowerBound"], "additionalProperties": false } }, "evidenceOmissions": { "type": "array", "items": { "type": "object", "properties": { "decisionId": { "type": "string" }, "reason": { "type": "string", "enum": ["prompt_budget", "batch_limit", "evaluation_failed", "evaluation_deadline"] } }, "required": ["decisionId", "reason"], "additionalProperties": false } } }, "required": ["candidateCount", "submittedCount", "evaluatedCount", "status", "semanticBatchCount", "completedSemanticBatchCount", "selectionOmissions", "evidenceOmissions"], "additionalProperties": false }, "decisionDisclosures": { "minItems": 1, "maxItems": 16, "type": "array", "items": { "type": "object", "properties": { "decisionId": { "type": "string" }, "shortId": { "type": "string" }, "participation": { "type": "string", "enum": ["candidate", "reconcile_bypass"] } }, "required": ["decisionId", "shortId", "participation"], "additionalProperties": false } } }, "required": ["protocolVersion", "verdict", "reasonCode", "message", "conflicts", "bypassed"], "additionalProperties": {} };
17613
17613
  function validate58(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
17614
17614
  ;
17615
17615
  let vErrors = null;
@@ -17740,6 +17740,18 @@ function validate58(data, { instancePath = "", parentData, parentDataProperty, r
17740
17740
  } else {
17741
17741
  var valid3 = true;
17742
17742
  }
17743
+ if (valid3) {
17744
+ if (data6.title !== void 0) {
17745
+ const _errs22 = errors;
17746
+ if (typeof data6.title !== "string") {
17747
+ validate58.errors = [{ instancePath: instancePath + "/conflicts/" + i0 + "/title", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/conflicts/items/properties/title/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
17748
+ return false;
17749
+ }
17750
+ var valid3 = _errs22 === errors;
17751
+ } else {
17752
+ var valid3 = true;
17753
+ }
17754
+ }
17743
17755
  }
17744
17756
  }
17745
17757
  } else {
@@ -17763,51 +17775,51 @@ function validate58(data, { instancePath = "", parentData, parentDataProperty, r
17763
17775
  }
17764
17776
  if (valid1) {
17765
17777
  if (data.bypassed !== void 0) {
17766
- let data9 = data.bypassed;
17767
- const _errs22 = errors;
17768
- if (errors === _errs22) {
17769
- if (Array.isArray(data9)) {
17778
+ let data10 = data.bypassed;
17779
+ const _errs24 = errors;
17780
+ if (errors === _errs24) {
17781
+ if (Array.isArray(data10)) {
17770
17782
  var valid4 = true;
17771
- const len1 = data9.length;
17783
+ const len1 = data10.length;
17772
17784
  for (let i1 = 0; i1 < len1; i1++) {
17773
- let data10 = data9[i1];
17774
- const _errs24 = errors;
17775
- if (errors === _errs24) {
17776
- if (data10 && typeof data10 == "object" && !Array.isArray(data10)) {
17785
+ let data11 = data10[i1];
17786
+ const _errs26 = errors;
17787
+ if (errors === _errs26) {
17788
+ if (data11 && typeof data11 == "object" && !Array.isArray(data11)) {
17777
17789
  let missing2;
17778
- if (data10.decisionId === void 0 && (missing2 = "decisionId")) {
17790
+ if (data11.decisionId === void 0 && (missing2 = "decisionId")) {
17779
17791
  validate58.errors = [{ instancePath: instancePath + "/bypassed/" + i1, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/bypassed/items/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" }];
17780
17792
  return false;
17781
17793
  } else {
17782
- if (data10.decisionId !== void 0) {
17783
- const _errs27 = errors;
17784
- if (typeof data10.decisionId !== "string") {
17794
+ if (data11.decisionId !== void 0) {
17795
+ const _errs29 = errors;
17796
+ if (typeof data11.decisionId !== "string") {
17785
17797
  validate58.errors = [{ instancePath: instancePath + "/bypassed/" + i1 + "/decisionId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/bypassed/items/properties/decisionId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
17786
17798
  return false;
17787
17799
  }
17788
- var valid5 = _errs27 === errors;
17800
+ var valid5 = _errs29 === errors;
17789
17801
  } else {
17790
17802
  var valid5 = true;
17791
17803
  }
17792
17804
  if (valid5) {
17793
- if (data10.bypassId !== void 0) {
17794
- const _errs29 = errors;
17795
- if (typeof data10.bypassId !== "string") {
17805
+ if (data11.bypassId !== void 0) {
17806
+ const _errs31 = errors;
17807
+ if (typeof data11.bypassId !== "string") {
17796
17808
  validate58.errors = [{ instancePath: instancePath + "/bypassed/" + i1 + "/bypassId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/bypassed/items/properties/bypassId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
17797
17809
  return false;
17798
17810
  }
17799
- var valid5 = _errs29 === errors;
17811
+ var valid5 = _errs31 === errors;
17800
17812
  } else {
17801
17813
  var valid5 = true;
17802
17814
  }
17803
17815
  if (valid5) {
17804
- if (data10.shortId !== void 0) {
17805
- const _errs31 = errors;
17806
- if (typeof data10.shortId !== "string") {
17816
+ if (data11.shortId !== void 0) {
17817
+ const _errs33 = errors;
17818
+ if (typeof data11.shortId !== "string") {
17807
17819
  validate58.errors = [{ instancePath: instancePath + "/bypassed/" + i1 + "/shortId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/bypassed/items/properties/shortId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
17808
17820
  return false;
17809
17821
  }
17810
- var valid5 = _errs31 === errors;
17822
+ var valid5 = _errs33 === errors;
17811
17823
  } else {
17812
17824
  var valid5 = true;
17813
17825
  }
@@ -17819,7 +17831,7 @@ function validate58(data, { instancePath = "", parentData, parentDataProperty, r
17819
17831
  return false;
17820
17832
  }
17821
17833
  }
17822
- var valid4 = _errs24 === errors;
17834
+ var valid4 = _errs26 === errors;
17823
17835
  if (!valid4) {
17824
17836
  break;
17825
17837
  }
@@ -17829,107 +17841,467 @@ function validate58(data, { instancePath = "", parentData, parentDataProperty, r
17829
17841
  return false;
17830
17842
  }
17831
17843
  }
17832
- var valid1 = _errs22 === errors;
17844
+ var valid1 = _errs24 === errors;
17833
17845
  } else {
17834
17846
  var valid1 = true;
17835
17847
  }
17836
17848
  if (valid1) {
17837
- if (data.decisionDisclosures !== void 0) {
17838
- let data14 = data.decisionDisclosures;
17839
- const _errs33 = errors;
17840
- if (errors === _errs33) {
17841
- if (Array.isArray(data14)) {
17842
- if (data14.length > 16) {
17843
- validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/maxItems", keyword: "maxItems", params: { limit: 16 }, message: "must NOT have more than 16 items" }];
17849
+ if (data.evaluationCoverage !== void 0) {
17850
+ let data15 = data.evaluationCoverage;
17851
+ const _errs35 = errors;
17852
+ if (errors === _errs35) {
17853
+ if (data15 && typeof data15 == "object" && !Array.isArray(data15)) {
17854
+ let missing3;
17855
+ if (data15.candidateCount === void 0 && (missing3 = "candidateCount") || data15.submittedCount === void 0 && (missing3 = "submittedCount") || data15.evaluatedCount === void 0 && (missing3 = "evaluatedCount") || data15.status === void 0 && (missing3 = "status") || data15.semanticBatchCount === void 0 && (missing3 = "semanticBatchCount") || data15.completedSemanticBatchCount === void 0 && (missing3 = "completedSemanticBatchCount") || data15.selectionOmissions === void 0 && (missing3 = "selectionOmissions") || data15.evidenceOmissions === void 0 && (missing3 = "evidenceOmissions")) {
17856
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/required", keyword: "required", params: { missingProperty: missing3 }, message: "must have required property '" + missing3 + "'" }];
17844
17857
  return false;
17845
17858
  } else {
17846
- if (data14.length < 1) {
17847
- validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" }];
17848
- return false;
17849
- } else {
17850
- var valid6 = true;
17851
- const len2 = data14.length;
17852
- for (let i2 = 0; i2 < len2; i2++) {
17853
- let data15 = data14[i2];
17854
- const _errs35 = errors;
17855
- if (errors === _errs35) {
17856
- if (data15 && typeof data15 == "object" && !Array.isArray(data15)) {
17857
- let missing3;
17858
- if (data15.decisionId === void 0 && (missing3 = "decisionId") || data15.shortId === void 0 && (missing3 = "shortId") || data15.participation === void 0 && (missing3 = "participation")) {
17859
- validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures/" + i2, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/items/required", keyword: "required", params: { missingProperty: missing3 }, message: "must have required property '" + missing3 + "'" }];
17859
+ const _errs37 = errors;
17860
+ for (const key0 in data15) {
17861
+ if (!(key0 === "candidateCount" || key0 === "submittedCount" || key0 === "evaluatedCount" || key0 === "status" || key0 === "semanticBatchCount" || key0 === "completedSemanticBatchCount" || key0 === "selectionOmissions" || key0 === "evidenceOmissions")) {
17862
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
17863
+ return false;
17864
+ break;
17865
+ }
17866
+ }
17867
+ if (_errs37 === errors) {
17868
+ if (data15.candidateCount !== void 0) {
17869
+ let data16 = data15.candidateCount;
17870
+ const _errs38 = errors;
17871
+ if (!(typeof data16 == "number" && (!(data16 % 1) && !isNaN(data16)) && isFinite(data16))) {
17872
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/candidateCount", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/candidateCount/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
17873
+ return false;
17874
+ }
17875
+ if (errors === _errs38) {
17876
+ if (typeof data16 == "number" && isFinite(data16)) {
17877
+ if (data16 > 9007199254740991 || isNaN(data16)) {
17878
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/candidateCount", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/candidateCount/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" }];
17860
17879
  return false;
17861
17880
  } else {
17862
- const _errs37 = errors;
17863
- for (const key0 in data15) {
17864
- if (!(key0 === "decisionId" || key0 === "shortId" || key0 === "participation")) {
17865
- validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures/" + i2, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/items/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
17881
+ if (data16 < 0 || isNaN(data16)) {
17882
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/candidateCount", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/candidateCount/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
17883
+ return false;
17884
+ }
17885
+ }
17886
+ }
17887
+ }
17888
+ var valid6 = _errs38 === errors;
17889
+ } else {
17890
+ var valid6 = true;
17891
+ }
17892
+ if (valid6) {
17893
+ if (data15.submittedCount !== void 0) {
17894
+ let data17 = data15.submittedCount;
17895
+ const _errs40 = errors;
17896
+ if (!(typeof data17 == "number" && (!(data17 % 1) && !isNaN(data17)) && isFinite(data17))) {
17897
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/submittedCount", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/submittedCount/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
17898
+ return false;
17899
+ }
17900
+ if (errors === _errs40) {
17901
+ if (typeof data17 == "number" && isFinite(data17)) {
17902
+ if (data17 > 9007199254740991 || isNaN(data17)) {
17903
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/submittedCount", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/submittedCount/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" }];
17904
+ return false;
17905
+ } else {
17906
+ if (data17 < 0 || isNaN(data17)) {
17907
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/submittedCount", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/submittedCount/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
17866
17908
  return false;
17867
- break;
17868
17909
  }
17869
17910
  }
17870
- if (_errs37 === errors) {
17871
- if (data15.decisionId !== void 0) {
17872
- const _errs38 = errors;
17873
- if (typeof data15.decisionId !== "string") {
17874
- validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures/" + i2 + "/decisionId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/items/properties/decisionId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
17911
+ }
17912
+ }
17913
+ var valid6 = _errs40 === errors;
17914
+ } else {
17915
+ var valid6 = true;
17916
+ }
17917
+ if (valid6) {
17918
+ if (data15.evaluatedCount !== void 0) {
17919
+ let data18 = data15.evaluatedCount;
17920
+ const _errs42 = errors;
17921
+ if (!(typeof data18 == "number" && (!(data18 % 1) && !isNaN(data18)) && isFinite(data18))) {
17922
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/evaluatedCount", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/evaluatedCount/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
17923
+ return false;
17924
+ }
17925
+ if (errors === _errs42) {
17926
+ if (typeof data18 == "number" && isFinite(data18)) {
17927
+ if (data18 > 9007199254740991 || isNaN(data18)) {
17928
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/evaluatedCount", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/evaluatedCount/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" }];
17929
+ return false;
17930
+ } else {
17931
+ if (data18 < 0 || isNaN(data18)) {
17932
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/evaluatedCount", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/evaluatedCount/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
17875
17933
  return false;
17876
17934
  }
17877
- var valid7 = _errs38 === errors;
17878
- } else {
17879
- var valid7 = true;
17880
17935
  }
17881
- if (valid7) {
17882
- if (data15.shortId !== void 0) {
17883
- const _errs40 = errors;
17884
- if (typeof data15.shortId !== "string") {
17885
- validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures/" + i2 + "/shortId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/items/properties/shortId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
17936
+ }
17937
+ }
17938
+ var valid6 = _errs42 === errors;
17939
+ } else {
17940
+ var valid6 = true;
17941
+ }
17942
+ if (valid6) {
17943
+ if (data15.status !== void 0) {
17944
+ let data19 = data15.status;
17945
+ const _errs44 = errors;
17946
+ if (typeof data19 !== "string") {
17947
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/status", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/status/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
17948
+ return false;
17949
+ }
17950
+ if (!(data19 === "completed" || data19 === "partial" || data19 === "unavailable" || data19 === "not_run" || data19 === "unknown")) {
17951
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/status", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/status/enum", keyword: "enum", params: { allowedValues: schema107.properties.evaluationCoverage.properties.status.enum }, message: "must be equal to one of the allowed values" }];
17952
+ return false;
17953
+ }
17954
+ var valid6 = _errs44 === errors;
17955
+ } else {
17956
+ var valid6 = true;
17957
+ }
17958
+ if (valid6) {
17959
+ if (data15.semanticBatchCount !== void 0) {
17960
+ let data20 = data15.semanticBatchCount;
17961
+ const _errs46 = errors;
17962
+ if (!(typeof data20 == "number" && (!(data20 % 1) && !isNaN(data20)) && isFinite(data20))) {
17963
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/semanticBatchCount", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/semanticBatchCount/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
17964
+ return false;
17965
+ }
17966
+ if (errors === _errs46) {
17967
+ if (typeof data20 == "number" && isFinite(data20)) {
17968
+ if (data20 > 9007199254740991 || isNaN(data20)) {
17969
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/semanticBatchCount", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/semanticBatchCount/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" }];
17886
17970
  return false;
17971
+ } else {
17972
+ if (data20 < 0 || isNaN(data20)) {
17973
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/semanticBatchCount", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/semanticBatchCount/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
17974
+ return false;
17975
+ }
17887
17976
  }
17888
- var valid7 = _errs40 === errors;
17889
- } else {
17890
- var valid7 = true;
17891
17977
  }
17892
- if (valid7) {
17893
- if (data15.participation !== void 0) {
17894
- let data18 = data15.participation;
17895
- const _errs42 = errors;
17896
- if (typeof data18 !== "string") {
17897
- validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures/" + i2 + "/participation", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/items/properties/participation/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
17978
+ }
17979
+ var valid6 = _errs46 === errors;
17980
+ } else {
17981
+ var valid6 = true;
17982
+ }
17983
+ if (valid6) {
17984
+ if (data15.completedSemanticBatchCount !== void 0) {
17985
+ let data21 = data15.completedSemanticBatchCount;
17986
+ const _errs48 = errors;
17987
+ if (!(typeof data21 == "number" && (!(data21 % 1) && !isNaN(data21)) && isFinite(data21))) {
17988
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/completedSemanticBatchCount", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/completedSemanticBatchCount/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
17989
+ return false;
17990
+ }
17991
+ if (errors === _errs48) {
17992
+ if (typeof data21 == "number" && isFinite(data21)) {
17993
+ if (data21 > 9007199254740991 || isNaN(data21)) {
17994
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/completedSemanticBatchCount", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/completedSemanticBatchCount/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" }];
17898
17995
  return false;
17996
+ } else {
17997
+ if (data21 < 0 || isNaN(data21)) {
17998
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/completedSemanticBatchCount", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/completedSemanticBatchCount/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
17999
+ return false;
18000
+ }
17899
18001
  }
17900
- if (!(data18 === "candidate" || data18 === "reconcile_bypass")) {
17901
- validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures/" + i2 + "/participation", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/items/properties/participation/enum", keyword: "enum", params: { allowedValues: schema107.properties.decisionDisclosures.items.properties.participation.enum }, message: "must be equal to one of the allowed values" }];
18002
+ }
18003
+ }
18004
+ var valid6 = _errs48 === errors;
18005
+ } else {
18006
+ var valid6 = true;
18007
+ }
18008
+ if (valid6) {
18009
+ if (data15.selectionOmissions !== void 0) {
18010
+ let data22 = data15.selectionOmissions;
18011
+ const _errs50 = errors;
18012
+ if (errors === _errs50) {
18013
+ if (Array.isArray(data22)) {
18014
+ var valid7 = true;
18015
+ const len2 = data22.length;
18016
+ for (let i2 = 0; i2 < len2; i2++) {
18017
+ let data23 = data22[i2];
18018
+ const _errs52 = errors;
18019
+ if (errors === _errs52) {
18020
+ if (data23 && typeof data23 == "object" && !Array.isArray(data23)) {
18021
+ let missing4;
18022
+ if (data23.source === void 0 && (missing4 = "source") || data23.reason === void 0 && (missing4 = "reason") || data23.omittedCountLowerBound === void 0 && (missing4 = "omittedCountLowerBound")) {
18023
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/selectionOmissions/" + i2, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/selectionOmissions/items/required", keyword: "required", params: { missingProperty: missing4 }, message: "must have required property '" + missing4 + "'" }];
18024
+ return false;
18025
+ } else {
18026
+ const _errs54 = errors;
18027
+ for (const key1 in data23) {
18028
+ if (!(key1 === "source" || key1 === "reason" || key1 === "omittedCountLowerBound")) {
18029
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/selectionOmissions/" + i2, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/selectionOmissions/items/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" }];
18030
+ return false;
18031
+ break;
18032
+ }
18033
+ }
18034
+ if (_errs54 === errors) {
18035
+ if (data23.source !== void 0) {
18036
+ let data24 = data23.source;
18037
+ const _errs55 = errors;
18038
+ if (typeof data24 !== "string") {
18039
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/selectionOmissions/" + i2 + "/source", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/selectionOmissions/items/properties/source/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
18040
+ return false;
18041
+ }
18042
+ if (!(data24 === "exact_scope" || data24 === "location_scope" || data24 === "organization_scope" || data24 === "candidate_scan" || data24 === "candidate_limit" || data24 === "bypass_scan")) {
18043
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/selectionOmissions/" + i2 + "/source", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/selectionOmissions/items/properties/source/enum", keyword: "enum", params: { allowedValues: schema107.properties.evaluationCoverage.properties.selectionOmissions.items.properties.source.enum }, message: "must be equal to one of the allowed values" }];
18044
+ return false;
18045
+ }
18046
+ var valid8 = _errs55 === errors;
18047
+ } else {
18048
+ var valid8 = true;
18049
+ }
18050
+ if (valid8) {
18051
+ if (data23.reason !== void 0) {
18052
+ let data25 = data23.reason;
18053
+ const _errs57 = errors;
18054
+ if (typeof data25 !== "string") {
18055
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/selectionOmissions/" + i2 + "/reason", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/selectionOmissions/items/properties/reason/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
18056
+ return false;
18057
+ }
18058
+ if (!(data25 === "scan_limit" || data25 === "candidate_limit" || data25 === "bucket_limit")) {
18059
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/selectionOmissions/" + i2 + "/reason", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/selectionOmissions/items/properties/reason/enum", keyword: "enum", params: { allowedValues: schema107.properties.evaluationCoverage.properties.selectionOmissions.items.properties.reason.enum }, message: "must be equal to one of the allowed values" }];
18060
+ return false;
18061
+ }
18062
+ var valid8 = _errs57 === errors;
18063
+ } else {
18064
+ var valid8 = true;
18065
+ }
18066
+ if (valid8) {
18067
+ if (data23.omittedCountLowerBound !== void 0) {
18068
+ let data26 = data23.omittedCountLowerBound;
18069
+ const _errs59 = errors;
18070
+ if (!(typeof data26 == "number" && (!(data26 % 1) && !isNaN(data26)) && isFinite(data26))) {
18071
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/selectionOmissions/" + i2 + "/omittedCountLowerBound", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/selectionOmissions/items/properties/omittedCountLowerBound/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
18072
+ return false;
18073
+ }
18074
+ if (errors === _errs59) {
18075
+ if (typeof data26 == "number" && isFinite(data26)) {
18076
+ if (data26 > 9007199254740991 || isNaN(data26)) {
18077
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/selectionOmissions/" + i2 + "/omittedCountLowerBound", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/selectionOmissions/items/properties/omittedCountLowerBound/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" }];
18078
+ return false;
18079
+ } else {
18080
+ if (data26 < 0 || isNaN(data26)) {
18081
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/selectionOmissions/" + i2 + "/omittedCountLowerBound", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/selectionOmissions/items/properties/omittedCountLowerBound/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
18082
+ return false;
18083
+ }
18084
+ }
18085
+ }
18086
+ }
18087
+ var valid8 = _errs59 === errors;
18088
+ } else {
18089
+ var valid8 = true;
18090
+ }
18091
+ }
18092
+ }
18093
+ }
18094
+ }
18095
+ } else {
18096
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/selectionOmissions/" + i2, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/selectionOmissions/items/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
18097
+ return false;
18098
+ }
18099
+ }
18100
+ var valid7 = _errs52 === errors;
18101
+ if (!valid7) {
18102
+ break;
18103
+ }
18104
+ }
18105
+ } else {
18106
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/selectionOmissions", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/selectionOmissions/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
17902
18107
  return false;
17903
18108
  }
17904
- var valid7 = _errs42 === errors;
18109
+ }
18110
+ var valid6 = _errs50 === errors;
18111
+ } else {
18112
+ var valid6 = true;
18113
+ }
18114
+ if (valid6) {
18115
+ if (data15.evidenceOmissions !== void 0) {
18116
+ let data27 = data15.evidenceOmissions;
18117
+ const _errs61 = errors;
18118
+ if (errors === _errs61) {
18119
+ if (Array.isArray(data27)) {
18120
+ var valid9 = true;
18121
+ const len3 = data27.length;
18122
+ for (let i3 = 0; i3 < len3; i3++) {
18123
+ let data28 = data27[i3];
18124
+ const _errs63 = errors;
18125
+ if (errors === _errs63) {
18126
+ if (data28 && typeof data28 == "object" && !Array.isArray(data28)) {
18127
+ let missing5;
18128
+ if (data28.decisionId === void 0 && (missing5 = "decisionId") || data28.reason === void 0 && (missing5 = "reason")) {
18129
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/evidenceOmissions/" + i3, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/evidenceOmissions/items/required", keyword: "required", params: { missingProperty: missing5 }, message: "must have required property '" + missing5 + "'" }];
18130
+ return false;
18131
+ } else {
18132
+ const _errs65 = errors;
18133
+ for (const key2 in data28) {
18134
+ if (!(key2 === "decisionId" || key2 === "reason")) {
18135
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/evidenceOmissions/" + i3, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/evidenceOmissions/items/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key2 }, message: "must NOT have additional properties" }];
18136
+ return false;
18137
+ break;
18138
+ }
18139
+ }
18140
+ if (_errs65 === errors) {
18141
+ if (data28.decisionId !== void 0) {
18142
+ const _errs66 = errors;
18143
+ if (typeof data28.decisionId !== "string") {
18144
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/evidenceOmissions/" + i3 + "/decisionId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/evidenceOmissions/items/properties/decisionId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
18145
+ return false;
18146
+ }
18147
+ var valid10 = _errs66 === errors;
18148
+ } else {
18149
+ var valid10 = true;
18150
+ }
18151
+ if (valid10) {
18152
+ if (data28.reason !== void 0) {
18153
+ let data30 = data28.reason;
18154
+ const _errs68 = errors;
18155
+ if (typeof data30 !== "string") {
18156
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/evidenceOmissions/" + i3 + "/reason", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/evidenceOmissions/items/properties/reason/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
18157
+ return false;
18158
+ }
18159
+ if (!(data30 === "prompt_budget" || data30 === "batch_limit" || data30 === "evaluation_failed" || data30 === "evaluation_deadline")) {
18160
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/evidenceOmissions/" + i3 + "/reason", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/evidenceOmissions/items/properties/reason/enum", keyword: "enum", params: { allowedValues: schema107.properties.evaluationCoverage.properties.evidenceOmissions.items.properties.reason.enum }, message: "must be equal to one of the allowed values" }];
18161
+ return false;
18162
+ }
18163
+ var valid10 = _errs68 === errors;
18164
+ } else {
18165
+ var valid10 = true;
18166
+ }
18167
+ }
18168
+ }
18169
+ }
18170
+ } else {
18171
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/evidenceOmissions/" + i3, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/evidenceOmissions/items/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
18172
+ return false;
18173
+ }
18174
+ }
18175
+ var valid9 = _errs63 === errors;
18176
+ if (!valid9) {
18177
+ break;
18178
+ }
18179
+ }
18180
+ } else {
18181
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage/evidenceOmissions", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/properties/evidenceOmissions/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
18182
+ return false;
18183
+ }
18184
+ }
18185
+ var valid6 = _errs61 === errors;
17905
18186
  } else {
17906
- var valid7 = true;
18187
+ var valid6 = true;
17907
18188
  }
17908
18189
  }
17909
18190
  }
17910
18191
  }
17911
18192
  }
17912
- } else {
17913
- validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures/" + i2, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/items/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
17914
- return false;
17915
18193
  }
17916
18194
  }
17917
- var valid6 = _errs35 === errors;
17918
- if (!valid6) {
17919
- break;
17920
- }
17921
18195
  }
17922
18196
  }
17923
18197
  }
17924
18198
  } else {
17925
- validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
18199
+ validate58.errors = [{ instancePath: instancePath + "/evaluationCoverage", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/evaluationCoverage/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
17926
18200
  return false;
17927
18201
  }
17928
18202
  }
17929
- var valid1 = _errs33 === errors;
18203
+ var valid1 = _errs35 === errors;
17930
18204
  } else {
17931
18205
  var valid1 = true;
17932
18206
  }
18207
+ if (valid1) {
18208
+ if (data.decisionDisclosures !== void 0) {
18209
+ let data31 = data.decisionDisclosures;
18210
+ const _errs70 = errors;
18211
+ if (errors === _errs70) {
18212
+ if (Array.isArray(data31)) {
18213
+ if (data31.length > 16) {
18214
+ validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/maxItems", keyword: "maxItems", params: { limit: 16 }, message: "must NOT have more than 16 items" }];
18215
+ return false;
18216
+ } else {
18217
+ if (data31.length < 1) {
18218
+ validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" }];
18219
+ return false;
18220
+ } else {
18221
+ var valid11 = true;
18222
+ const len4 = data31.length;
18223
+ for (let i4 = 0; i4 < len4; i4++) {
18224
+ let data32 = data31[i4];
18225
+ const _errs72 = errors;
18226
+ if (errors === _errs72) {
18227
+ if (data32 && typeof data32 == "object" && !Array.isArray(data32)) {
18228
+ let missing6;
18229
+ if (data32.decisionId === void 0 && (missing6 = "decisionId") || data32.shortId === void 0 && (missing6 = "shortId") || data32.participation === void 0 && (missing6 = "participation")) {
18230
+ validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures/" + i4, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/items/required", keyword: "required", params: { missingProperty: missing6 }, message: "must have required property '" + missing6 + "'" }];
18231
+ return false;
18232
+ } else {
18233
+ const _errs74 = errors;
18234
+ for (const key3 in data32) {
18235
+ if (!(key3 === "decisionId" || key3 === "shortId" || key3 === "participation")) {
18236
+ validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures/" + i4, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/items/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" }];
18237
+ return false;
18238
+ break;
18239
+ }
18240
+ }
18241
+ if (_errs74 === errors) {
18242
+ if (data32.decisionId !== void 0) {
18243
+ const _errs75 = errors;
18244
+ if (typeof data32.decisionId !== "string") {
18245
+ validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures/" + i4 + "/decisionId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/items/properties/decisionId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
18246
+ return false;
18247
+ }
18248
+ var valid12 = _errs75 === errors;
18249
+ } else {
18250
+ var valid12 = true;
18251
+ }
18252
+ if (valid12) {
18253
+ if (data32.shortId !== void 0) {
18254
+ const _errs77 = errors;
18255
+ if (typeof data32.shortId !== "string") {
18256
+ validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures/" + i4 + "/shortId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/items/properties/shortId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
18257
+ return false;
18258
+ }
18259
+ var valid12 = _errs77 === errors;
18260
+ } else {
18261
+ var valid12 = true;
18262
+ }
18263
+ if (valid12) {
18264
+ if (data32.participation !== void 0) {
18265
+ let data35 = data32.participation;
18266
+ const _errs79 = errors;
18267
+ if (typeof data35 !== "string") {
18268
+ validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures/" + i4 + "/participation", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/items/properties/participation/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
18269
+ return false;
18270
+ }
18271
+ if (!(data35 === "candidate" || data35 === "reconcile_bypass")) {
18272
+ validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures/" + i4 + "/participation", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/items/properties/participation/enum", keyword: "enum", params: { allowedValues: schema107.properties.decisionDisclosures.items.properties.participation.enum }, message: "must be equal to one of the allowed values" }];
18273
+ return false;
18274
+ }
18275
+ var valid12 = _errs79 === errors;
18276
+ } else {
18277
+ var valid12 = true;
18278
+ }
18279
+ }
18280
+ }
18281
+ }
18282
+ }
18283
+ } else {
18284
+ validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures/" + i4, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/items/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
18285
+ return false;
18286
+ }
18287
+ }
18288
+ var valid11 = _errs72 === errors;
18289
+ if (!valid11) {
18290
+ break;
18291
+ }
18292
+ }
18293
+ }
18294
+ }
18295
+ } else {
18296
+ validate58.errors = [{ instancePath: instancePath + "/decisionDisclosures", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/PreflightResponseV3/properties/decisionDisclosures/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
18297
+ return false;
18298
+ }
18299
+ }
18300
+ var valid1 = _errs70 === errors;
18301
+ } else {
18302
+ var valid1 = true;
18303
+ }
18304
+ }
17933
18305
  }
17934
18306
  }
17935
18307
  }
@@ -21598,71 +21970,277 @@ function timeAdmits(policy, now) {
21598
21970
  function directoryAdmits(directory, path) {
21599
21971
  return isScopeDirectoryPrefix(directory) && path.startsWith(`${directory}/`);
21600
21972
  }
21601
- function pathAdmits(policy, path) {
21602
- return hasSelectors(policy.directories) && policy.directories.some((directory) => directoryAdmits(directory, path)) || hasSelectors(policy.globs) && policy.globs.some((glob) => matchesScopeGlob(glob, path));
21973
+ function pathAdmits(policy, path) {
21974
+ return hasSelectors(policy.directories) && policy.directories.some((directory) => directoryAdmits(directory, path)) || hasSelectors(policy.globs) && policy.globs.some((glob) => matchesScopeGlob(glob, path));
21975
+ }
21976
+ function userScopeAdmits(policy, facts) {
21977
+ if (!hasSelectors(policy.users)) return true;
21978
+ const agentIncluded = policy.users.some(
21979
+ (member) => member.kind === "agent" && member.agent === facts.agent
21980
+ );
21981
+ const hasNonAgentMember = policy.users.some((member) => member.kind !== "agent");
21982
+ if (!hasNonAgentMember) return agentIncluded;
21983
+ return facts.callerIncluded === true || agentIncluded;
21984
+ }
21985
+ function collectScopeAdmits(policy, facts) {
21986
+ if (policy === null || policy === void 0) return true;
21987
+ if (hasSelectors(policy.repositories) && !repositoryAdmits(policy.repositories, facts.repository)) {
21988
+ return false;
21989
+ }
21990
+ if (hasSelectors(policy.branches) && !branchAdmits(policy.branches, facts.branch)) {
21991
+ return false;
21992
+ }
21993
+ if (!timeAdmits(policy, facts.now ?? Date.now())) return false;
21994
+ if (!userScopeAdmits(policy, facts)) return false;
21995
+ const hasPathSelectors = hasSelectors(policy.directories) || hasSelectors(policy.globs);
21996
+ if (!hasPathSelectors || facts.paths === void 0) return true;
21997
+ if (facts.pathsComplete !== true || facts.paths.length === 0) return false;
21998
+ return facts.paths.every((path) => pathAdmits(policy, path));
21999
+ }
22000
+ function cachedCollectScopeAdmits(cwd, facts) {
22001
+ const cached = readCachedCollectScope(cwd);
22002
+ if (cached.kind === "invalid") return false;
22003
+ return collectScopeAdmits(
22004
+ cached.kind === "policy" ? cached.policy : null,
22005
+ cached.kind === "policy" && cached.callerIncluded !== void 0 ? { ...facts, callerIncluded: cached.callerIncluded } : facts
22006
+ );
22007
+ }
22008
+
22009
+ // src/hooks/agent.ts
22010
+ function parseAgent(argv) {
22011
+ const i = argv.indexOf("--agent");
22012
+ const value = i !== -1 ? argv[i + 1] : void 0;
22013
+ if (value === "codex" || value === "cursor" || value === "hermes") {
22014
+ return value;
22015
+ }
22016
+ return "claude_code";
22017
+ }
22018
+
22019
+ // src/hooks/redact.ts
22020
+ import { existsSync as existsSync9, readFileSync as readFileSync9, statSync as statSync3 } from "fs";
22021
+ import { join as join11 } from "path";
22022
+ import { Worker } from "worker_threads";
22023
+
22024
+ // src/lib/ansi.ts
22025
+ var MAX_HEALTH_ERROR_LENGTH = 240;
22026
+ function boundedHealthError(value) {
22027
+ if (!value) return void 0;
22028
+ const clean = terminalSafeLine(value);
22029
+ if (!clean) return void 0;
22030
+ return clean.length <= MAX_HEALTH_ERROR_LENGTH ? clean : `${clean.slice(0, MAX_HEALTH_ERROR_LENGTH - 1)}\u2026`;
22031
+ }
22032
+
22033
+ // src/hooks/redact.ts
22034
+ var USER_HOME_RULES = [
22035
+ {
22036
+ pattern: /\/Users\/[^/\\\s"'`]+/g,
22037
+ reason: "user-home-path",
22038
+ replacement: "/Users/__redacted_user__"
22039
+ },
22040
+ {
22041
+ pattern: /\/home\/[^/\\\s"'`]+/g,
22042
+ reason: "user-home-path",
22043
+ replacement: "/home/__redacted_user__"
22044
+ },
22045
+ {
22046
+ pattern: /([A-Za-z]:\\Users\\)[^/\\\s"'`]+/gi,
22047
+ reason: "user-home-path",
22048
+ replacement: "$1__redacted_user__"
22049
+ },
22050
+ {
22051
+ pattern: /\/root(?=\/|$)/g,
22052
+ reason: "user-home-path",
22053
+ replacement: "/__redacted_user__"
22054
+ }
22055
+ ];
22056
+ var DEFAULT_RULES = [
22057
+ { pattern: /Bearer\s+[A-Za-z0-9._~+/=-]+/gi, reason: "bearer-token" },
22058
+ {
22059
+ pattern: /\bsk-(?:(?:ant|proj)-)?[A-Za-z0-9_-]{16,}(?![A-Za-z0-9_-])/g,
22060
+ reason: "sk-api-key"
22061
+ },
22062
+ {
22063
+ pattern: /-----BEGIN [A-Z ]+PRIVATE KEY-----[\s\S]+?-----END [A-Z ]+PRIVATE KEY-----/g,
22064
+ reason: "private-key"
22065
+ },
22066
+ { pattern: /xox[abprs]-[A-Za-z0-9-]{10,}/g, reason: "slack-token" },
22067
+ {
22068
+ pattern: /\b(?:gh[pousr]_[A-Za-z0-9]{36,}|github_pat_[A-Za-z0-9_]{50,})\b/g,
22069
+ reason: "github-pat"
22070
+ },
22071
+ { pattern: /\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/g, reason: "aws-access-key" },
22072
+ {
22073
+ pattern: /\bAWS_(?:SECRET_ACCESS_KEY|SESSION_TOKEN)"?\s*[:=]\s*["']?[A-Za-z0-9/+=]{20,}["']?/gi,
22074
+ reason: "aws-secret"
22075
+ },
22076
+ { pattern: /\bAIza[0-9A-Za-z_-]{35}(?![0-9A-Za-z_-])/g, reason: "gcp-api-key" },
22077
+ {
22078
+ pattern: /\bya29\.[0-9A-Za-z_-]{20,}(?![0-9A-Za-z_-])/g,
22079
+ reason: "gcp-oauth-token"
22080
+ },
22081
+ {
22082
+ pattern: /\beyJ[A-Za-z0-9_-]*\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*(?![A-Za-z0-9_-])/g,
22083
+ reason: "jwt"
22084
+ },
22085
+ { pattern: /\bBasic\s+[A-Za-z0-9+/]+={0,2}/gi, reason: "basic-auth" },
22086
+ { pattern: /\bhttps?:\/\/[^/\s:@]+:[^/\s@]+@/gi, reason: "basic-auth" },
22087
+ ...USER_HOME_RULES
22088
+ ];
22089
+ var MAX_SCRUB_LEN = 256e3;
22090
+ var MAX_WORKSPACE_CONFIG_BYTES = 64 * 1024;
22091
+ function applyRules(input, rules) {
22092
+ if (input.length > MAX_SCRUB_LEN) return "<REDACTED:oversized>";
22093
+ let out = input;
22094
+ for (const rule of rules) {
22095
+ out = out.replace(rule.pattern, rule.replacement ?? `<REDACTED:${rule.reason}>`);
22096
+ }
22097
+ return out;
22098
+ }
22099
+ var REDACTED_OBJECT_KEY = "<REDACTED:object-key>";
22100
+ function redactedObjectKey(input, transform) {
22101
+ return transform(input) === input ? input : REDACTED_OBJECT_KEY;
22102
+ }
22103
+ function uniqueObjectKey(output, key) {
22104
+ let candidate = key;
22105
+ let suffix = 2;
22106
+ while (Object.hasOwn(output, candidate)) candidate = `${key}_${suffix++}`;
22107
+ return candidate;
22108
+ }
22109
+ function mapStrings(value, transform) {
22110
+ if (typeof value === "string") return transform(value);
22111
+ if (Array.isArray(value)) return value.map((item) => mapStrings(item, transform));
22112
+ if (value && typeof value === "object") {
22113
+ const out = /* @__PURE__ */ Object.create(null);
22114
+ for (const [key, item] of Object.entries(value)) {
22115
+ out[uniqueObjectKey(out, redactedObjectKey(key, transform))] = mapStrings(item, transform);
22116
+ }
22117
+ return out;
22118
+ }
22119
+ return value;
21603
22120
  }
21604
- function userScopeAdmits(policy, facts) {
21605
- if (!hasSelectors(policy.users)) return true;
21606
- const agentIncluded = policy.users.some(
21607
- (member) => member.kind === "agent" && member.agent === facts.agent
21608
- );
21609
- const hasNonAgentMember = policy.users.some((member) => member.kind !== "agent");
21610
- if (!hasNonAgentMember) return agentIncluded;
21611
- return facts.callerIncluded === true || agentIncluded;
22121
+ function scrub(value, rules = DEFAULT_RULES) {
22122
+ return mapStrings(value, (input) => applyRules(input, rules));
21612
22123
  }
21613
- function collectScopeAdmits(policy, facts) {
21614
- if (policy === null || policy === void 0) return true;
21615
- if (hasSelectors(policy.repositories) && !repositoryAdmits(policy.repositories, facts.repository)) {
21616
- return false;
22124
+ var WORKSPACE_REDACTION_WORKER = String.raw`
22125
+ const { parentPort, workerData } = require("node:worker_threads");
22126
+ const REDACTED_OBJECT_KEY = "<REDACTED:object-key>";
22127
+ const rules = workerData.rules.map((rule) => ({
22128
+ pattern: new RegExp(rule.source, rule.flags),
22129
+ reason: rule.reason,
22130
+ }));
22131
+ function redact(input) {
22132
+ let output = input;
22133
+ for (const rule of rules) {
22134
+ output = output.replace(rule.pattern, "<REDACTED:" + rule.reason + ">");
22135
+ }
22136
+ return output;
21617
22137
  }
21618
- if (hasSelectors(policy.branches) && !branchAdmits(policy.branches, facts.branch)) {
21619
- return false;
22138
+ function objectKey(input) {
22139
+ return redact(input) === input ? input : REDACTED_OBJECT_KEY;
21620
22140
  }
21621
- if (!timeAdmits(policy, facts.now ?? Date.now())) return false;
21622
- if (!userScopeAdmits(policy, facts)) return false;
21623
- const hasPathSelectors = hasSelectors(policy.directories) || hasSelectors(policy.globs);
21624
- if (!hasPathSelectors || facts.paths === void 0) return true;
21625
- if (facts.pathsComplete !== true || facts.paths.length === 0) return false;
21626
- return facts.paths.every((path) => pathAdmits(policy, path));
21627
- }
21628
- function cachedCollectScopeAdmits(cwd, facts) {
21629
- const cached = readCachedCollectScope(cwd);
21630
- if (cached.kind === "invalid") return false;
21631
- return collectScopeAdmits(
21632
- cached.kind === "policy" ? cached.policy : null,
21633
- cached.kind === "policy" && cached.callerIncluded !== void 0 ? { ...facts, callerIncluded: cached.callerIncluded } : facts
22141
+ function uniqueKey(output, key) {
22142
+ let candidate = key;
22143
+ let suffix = 2;
22144
+ while (Object.hasOwn(output, candidate)) candidate = key + "_" + suffix++;
22145
+ return candidate;
22146
+ }
22147
+ function walk(value) {
22148
+ if (typeof value === "string") {
22149
+ return redact(value);
22150
+ }
22151
+ if (Array.isArray(value)) return value.map(walk);
22152
+ if (value && typeof value === "object") {
22153
+ const output = Object.create(null);
22154
+ for (const [key, item] of Object.entries(value)) {
22155
+ output[uniqueKey(output, objectKey(key))] = walk(item);
22156
+ }
22157
+ return output;
22158
+ }
22159
+ return value;
22160
+ }
22161
+ parentPort.postMessage(walk(workerData.value));
22162
+ `;
22163
+
22164
+ // src/hooks/approval-copy.ts
22165
+ var MAX_EXCERPT_CHARS = 80;
22166
+ var MAX_TITLE_CHARS = 140;
22167
+ var MAX_PATH_CHARS = 120;
22168
+ var MAX_VISIBLE_CONFLICTS = 3;
22169
+ var SAFE_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/u;
22170
+ function displayText(value, maxChars) {
22171
+ const redacted = scrub(value, DEFAULT_RULES);
22172
+ const clean = terminalSafeLine(typeof redacted === "string" ? redacted : "");
22173
+ const characters = Array.from(clean);
22174
+ return characters.length > maxChars ? `${characters.slice(0, maxChars - 1).join("")}\u2026` : clean;
22175
+ }
22176
+ function targetLabel(paths) {
22177
+ const shown = paths.slice(0, 2).map((path) => `\u201C${displayText(path, MAX_PATH_CHARS)}\u201D`);
22178
+ if (shown.length === 0) return "the requested change";
22179
+ const remaining = paths.length - shown.length;
22180
+ return `${shown.join(" and ")}${remaining > 0 ? ` and ${remaining} more file(s)` : ""}`;
22181
+ }
22182
+ function editPreview(toolName, toolInput, paths) {
22183
+ const input = toolInput && typeof toolInput === "object" ? toolInput : {};
22184
+ const targets = targetLabel(paths);
22185
+ if (toolName === "Edit") {
22186
+ const before = typeof input.old_string === "string" ? displayText(input.old_string, MAX_EXCERPT_CHARS) : "";
22187
+ const after = typeof input.new_string === "string" ? displayText(input.new_string, MAX_EXCERPT_CHARS) : "";
22188
+ return before && after ? `Edit ${targets}:
22189
+ Current text: \u201C${before}\u201D
22190
+ Proposed replacement: \u201C${after}\u201D` : `Edit ${targets}.`;
22191
+ }
22192
+ if (toolName === "Write" || toolName === "NotebookEdit") return `Write ${targets}.`;
22193
+ if (toolName === "Bash" || toolName === "Shell") return `Run a command affecting ${targets}.`;
22194
+ return `Change ${targets}.`;
22195
+ }
22196
+ function decisionLabel(conflict) {
22197
+ const id = typeof conflict.shortId === "string" && SAFE_ID.test(conflict.shortId) ? `dec_${conflict.shortId}` : typeof conflict.decisionId === "string" && SAFE_ID.test(conflict.decisionId) ? conflict.decisionId : "unknown";
22198
+ const title = typeof conflict.title === "string" ? displayText(conflict.title, MAX_TITLE_CHARS) : "";
22199
+ return title ? `Decision ${id}: \u201C${title}\u201D.` : `Decision ${id}: details unavailable; inspect it before approving.`;
22200
+ }
22201
+ function incomplete(evidence) {
22202
+ const coverage = evidence.evaluationCoverage;
22203
+ return Array.isArray(coverage?.selectionOmissions) && coverage.selectionOmissions.length > 0 || Array.isArray(coverage?.evidenceOmissions) && coverage.evidenceOmissions.length > 0 || coverage?.status !== void 0 && coverage.status !== "completed" || ["candidate_set_truncated", "evidence_incomplete", "coverage_unverified"].includes(
22204
+ evidence.reasonCode
21634
22205
  );
21635
22206
  }
21636
-
21637
- // src/hooks/agent.ts
21638
- function parseAgent(argv) {
21639
- const i = argv.indexOf("--agent");
21640
- const value = i !== -1 ? argv[i + 1] : void 0;
21641
- if (value === "codex" || value === "cursor" || value === "hermes") {
21642
- return value;
22207
+ function approvalSummary(evidence, preview) {
22208
+ const lines = [preview];
22209
+ if (evidence.conflicts.length > 0) {
22210
+ lines.push("Primitive found a conflict with an existing decision.");
22211
+ lines.push(...evidence.conflicts.slice(0, MAX_VISIBLE_CONFLICTS).map(decisionLabel));
22212
+ const remaining = evidence.conflicts.length - MAX_VISIBLE_CONFLICTS;
22213
+ if (remaining > 0) lines.push(`${remaining} more conflicting decision(s) need inspection.`);
22214
+ } else {
22215
+ lines.push(
22216
+ displayText(evidence.message || "Primitive requires review before this change.", 180)
22217
+ );
21643
22218
  }
21644
- return "claude_code";
22219
+ if (incomplete(evidence)) {
22220
+ lines.push("Some potentially applicable decisions were not fully checked.");
22221
+ }
22222
+ return lines.filter(Boolean).join("\n");
21645
22223
  }
21646
22224
 
21647
22225
  // src/hooks/codex-context.ts
21648
22226
  import { createHash as createHash7, randomBytes as randomBytes5 } from "crypto";
21649
22227
  import {
21650
22228
  chmodSync as chmodSync4,
21651
- existsSync as existsSync9,
22229
+ existsSync as existsSync10,
21652
22230
  mkdirSync as mkdirSync5,
21653
- readFileSync as readFileSync9,
22231
+ readFileSync as readFileSync10,
21654
22232
  readdirSync as readdirSync3,
21655
22233
  renameSync as renameSync3,
21656
22234
  rmSync as rmSync5,
21657
- statSync as statSync3,
22235
+ statSync as statSync4,
21658
22236
  unlinkSync,
21659
22237
  writeFileSync as writeFileSync4
21660
22238
  } from "fs";
21661
- import { join as join12 } from "path";
22239
+ import { join as join13 } from "path";
21662
22240
 
21663
22241
  // src/daemon/client.ts
21664
22242
  import { createConnection } from "net";
21665
- import { join as join11 } from "path";
22243
+ import { join as join12 } from "path";
21666
22244
 
21667
22245
  // src/daemon/principal.ts
21668
22246
  import { createHash as createHash6 } from "crypto";
@@ -21712,7 +22290,7 @@ function parseDaemonResponseEnvelope(value) {
21712
22290
  }
21713
22291
 
21714
22292
  // src/daemon/client.ts
21715
- var SOCK_PATH = join11(primConfigDirectory(), "sock");
22293
+ var SOCK_PATH = join12(primConfigDirectory(), "sock");
21716
22294
  var DEFAULT_TIMEOUT_MS2 = 250;
21717
22295
  var nextRequestId = 1;
21718
22296
  function daemonRequest(method, params = {}, opts = {}) {
@@ -21812,15 +22390,6 @@ function isActionablePrivateDraft(row) {
21812
22390
  return typeof candidate.id === "string" && SAFE_PRIVATE_DRAFT_ID.test(candidate.id) && typeof candidate.intent === "string" && candidate.authorIsSelf === true && candidate.stage === "draft" && (candidate.intentKind === void 0 || candidate.intentKind === "change");
21813
22391
  }
21814
22392
 
21815
- // src/lib/ansi.ts
21816
- var MAX_HEALTH_ERROR_LENGTH = 240;
21817
- function boundedHealthError(value) {
21818
- if (!value) return void 0;
21819
- const clean = terminalSafeLine(value);
21820
- if (!clean) return void 0;
21821
- return clean.length <= MAX_HEALTH_ERROR_LENGTH ? clean : `${clean.slice(0, MAX_HEALTH_ERROR_LENGTH - 1)}\u2026`;
21822
- }
21823
-
21824
22393
  // src/lib/delivery-backlog.ts
21825
22394
  var MS_PER_SECOND = 1e3;
21826
22395
  var MS_PER_MINUTE = 60 * MS_PER_SECOND;
@@ -21989,10 +22558,10 @@ function appendCodexContext(output, context) {
21989
22558
  return next;
21990
22559
  }
21991
22560
  function stateRoot(namespace) {
21992
- return join12(primConfigDirectory(), namespace, "decision-digests");
22561
+ return join13(primConfigDirectory(), namespace, "decision-digests");
21993
22562
  }
21994
22563
  function draftStateRoot(namespace) {
21995
- return join12(primConfigDirectory(), namespace, "decision-draft-deliveries");
22564
+ return join13(primConfigDirectory(), namespace, "decision-draft-deliveries");
21996
22565
  }
21997
22566
  function workspaceFor(cwd) {
21998
22567
  try {
@@ -22004,12 +22573,12 @@ function workspaceFor(cwd) {
22004
22573
  function statePath(args) {
22005
22574
  const identity = `${args.siteUrl}\0${workspaceFor(args.cwd)}\0${args.sessionId}`;
22006
22575
  const key = createHash7("sha256").update(identity).digest("hex");
22007
- return join12(stateRoot(args.namespace), `${key}.json`);
22576
+ return join13(stateRoot(args.namespace), `${key}.json`);
22008
22577
  }
22009
22578
  function draftStatePath(args) {
22010
22579
  const identity = `${args.siteUrl}\0${workspaceFor(args.cwd)}\0${args.sessionId}\0${args.principalId}\0${args.organizationId}\0${args.credentialFingerprint}`;
22011
22580
  const key = createHash7("sha256").update(identity).digest("hex");
22012
- return join12(draftStateRoot(args.namespace), `${key}.json`);
22581
+ return join13(draftStateRoot(args.namespace), `${key}.json`);
22013
22582
  }
22014
22583
  function parseState(value) {
22015
22584
  if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
@@ -22048,17 +22617,17 @@ function parseDraftState(value) {
22048
22617
  };
22049
22618
  }
22050
22619
  function readState(path) {
22051
- if (!existsSync9(path)) return void 0;
22620
+ if (!existsSync10(path)) return void 0;
22052
22621
  try {
22053
- return parseState(JSON.parse(readFileSync9(path, "utf8")));
22622
+ return parseState(JSON.parse(readFileSync10(path, "utf8")));
22054
22623
  } catch {
22055
22624
  return void 0;
22056
22625
  }
22057
22626
  }
22058
22627
  function readDraftState(path) {
22059
- if (!existsSync9(path)) return void 0;
22628
+ if (!existsSync10(path)) return void 0;
22060
22629
  try {
22061
- return parseDraftState(JSON.parse(readFileSync9(path, "utf8")));
22630
+ return parseDraftState(JSON.parse(readFileSync10(path, "utf8")));
22062
22631
  } catch {
22063
22632
  return void 0;
22064
22633
  }
@@ -22066,7 +22635,7 @@ function readDraftState(path) {
22066
22635
  function writeStateFile(path, directory, state) {
22067
22636
  mkdirSync5(directory, { recursive: true, mode: 448 });
22068
22637
  chmodSync4(directory, 448);
22069
- const temporary = join12(
22638
+ const temporary = join13(
22070
22639
  directory,
22071
22640
  `.${path.slice(directory.length + 1)}.tmp-${process.pid}-${randomBytes5(8).toString("hex")}`
22072
22641
  );
@@ -22087,7 +22656,7 @@ function writeStateFile(path, directory, state) {
22087
22656
  }
22088
22657
  }
22089
22658
  function cleanupStateFiles(directory, now) {
22090
- if (!existsSync9(directory)) return;
22659
+ if (!existsSync10(directory)) return;
22091
22660
  let names;
22092
22661
  try {
22093
22662
  names = readdirSync3(directory);
@@ -22097,9 +22666,9 @@ function cleanupStateFiles(directory, now) {
22097
22666
  const files = [];
22098
22667
  const residue = [];
22099
22668
  for (const name of names) {
22100
- const path = join12(directory, name);
22669
+ const path = join13(directory, name);
22101
22670
  try {
22102
- const mtimeMs = statSync3(path).mtimeMs;
22671
+ const mtimeMs = statSync4(path).mtimeMs;
22103
22672
  if (name.endsWith(".json")) {
22104
22673
  files.push({ path, mtimeMs });
22105
22674
  } else if ((name.includes(".json.tmp-") || name.endsWith(".json.lock")) && now - mtimeMs > CODEX_DIGEST_STATE_RETENTION_MS) {
@@ -22118,7 +22687,7 @@ function cleanupStateFiles(directory, now) {
22118
22687
  }
22119
22688
  for (const path of residue) {
22120
22689
  try {
22121
- if (now - statSync3(path).mtimeMs > CODEX_DIGEST_STATE_RETENTION_MS) {
22690
+ if (now - statSync4(path).mtimeMs > CODEX_DIGEST_STATE_RETENTION_MS) {
22122
22691
  rmSync5(path, { recursive: true, force: true });
22123
22692
  }
22124
22693
  } catch {
@@ -22402,14 +22971,14 @@ async function prepareCodexContext(options) {
22402
22971
  }
22403
22972
 
22404
22973
  // src/commands/cursor-install.ts
22405
- import { existsSync as existsSync11, readFileSync as readFileSync11 } from "fs";
22974
+ import { existsSync as existsSync12, readFileSync as readFileSync12 } from "fs";
22406
22975
  import { homedir as homedir4 } from "os";
22407
- import { isAbsolute as isAbsolute5, join as join14 } from "path";
22976
+ import { isAbsolute as isAbsolute5, join as join15 } from "path";
22408
22977
 
22409
22978
  // src/commands/claude-install.ts
22410
- import { existsSync as existsSync10, readFileSync as readFileSync10 } from "fs";
22979
+ import { existsSync as existsSync11, readFileSync as readFileSync11 } from "fs";
22411
22980
  import { homedir as homedir3 } from "os";
22412
- import { join as join13 } from "path";
22981
+ import { join as join14 } from "path";
22413
22982
  var CAPTURE_BIN = "prim-hook";
22414
22983
  var GATE_BIN = "prim-pre-tool-use";
22415
22984
  var POST_TOOL_USE_BIN = "prim-post-tool-use";
@@ -22418,7 +22987,7 @@ var SESSION_END_BIN = "prim-session-end";
22418
22987
  var STATUSLINE_BIN = "prim-statusline";
22419
22988
  var STATUSLINE_ARGS = "";
22420
22989
  var STATUSLINE_COMMAND = stableHookCommand(STATUSLINE_BIN, STATUSLINE_ARGS);
22421
- var USER_SCOPE_PATH = join13(homedir3(), ".claude", "settings.json");
22990
+ var USER_SCOPE_PATH = join14(homedir3(), ".claude", "settings.json");
22422
22991
  function projectRoot() {
22423
22992
  return gitToplevel() ?? process.cwd();
22424
22993
  }
@@ -22497,20 +23066,20 @@ function cursorConfigDirectory(env = process.env, home = homedir4(), platform =
22497
23066
  const explicit = env.CURSOR_CONFIG_DIR?.trim();
22498
23067
  if (explicit && isAbsolute5(explicit)) return explicit;
22499
23068
  const xdg = env.XDG_CONFIG_HOME?.trim();
22500
- if (platform !== "darwin" && xdg && isAbsolute5(xdg)) return join14(xdg, "cursor");
22501
- return join14(home, ".cursor");
23069
+ if (platform !== "darwin" && xdg && isAbsolute5(xdg)) return join15(xdg, "cursor");
23070
+ return join15(home, ".cursor");
22502
23071
  }
22503
23072
  function cursorHooksPath(scope, root = projectRoot()) {
22504
- return scope === "user" ? join14(cursorConfigDirectory(), "hooks.json") : join14(root, ".cursor", "hooks.json");
23073
+ return scope === "user" ? join15(cursorConfigDirectory(), "hooks.json") : join15(root, ".cursor", "hooks.json");
22505
23074
  }
22506
23075
  function plainObject(value) {
22507
23076
  return typeof value === "object" && value !== null && !Array.isArray(value);
22508
23077
  }
22509
23078
  function readCursorHooks(path) {
22510
- if (!existsSync11(path)) return {};
23079
+ if (!existsSync12(path)) return {};
22511
23080
  let parsed;
22512
23081
  try {
22513
- parsed = JSON.parse(readFileSync11(path, "utf8"));
23082
+ parsed = JSON.parse(readFileSync12(path, "utf8"));
22514
23083
  } catch {
22515
23084
  throw new Error(`invalid Cursor hooks JSON at ${path}`);
22516
23085
  }
@@ -22831,6 +23400,18 @@ function blockingReason(results) {
22831
23400
  const parts = results.filter((result) => result.verdict === "ask" || result.verdict === "deny").flatMap((result) => [result.reason, result.additionalContext]).filter((value) => value.length > 0);
22832
23401
  return [...new Set(parts)].join("\n\n") || "[primitive] conflict detected (no detail available)";
22833
23402
  }
23403
+ function approvalReason(results) {
23404
+ const summaries = results.filter((result) => result.verdict === "ask" || result.verdict === "deny").map((result) => result.reason).filter(Boolean);
23405
+ return [
23406
+ ...new Set(summaries),
23407
+ "Approve runs this edit once; it does not change these decisions."
23408
+ ].join("\n");
23409
+ }
23410
+ function agentContext(results) {
23411
+ return [...new Set(results.map((result) => result.additionalContext).filter(Boolean))].join(
23412
+ "\n\n"
23413
+ );
23414
+ }
22834
23415
  function advisoryNote(aggregate, results) {
22835
23416
  const details = results.flatMap((result) => [
22836
23417
  ...aggregate === "warn" ? [result.reason] : [],
@@ -22840,7 +23421,18 @@ function advisoryNote(aggregate, results) {
22840
23421
  return [...new Set(details.filter((value) => value.length > 0))].join("\n\n");
22841
23422
  }
22842
23423
  function buildHookOutput(aggregate, results) {
22843
- if (aggregate === "deny" || aggregate === "ask") {
23424
+ if (aggregate === "ask") {
23425
+ const context = agentContext(results);
23426
+ return {
23427
+ hookSpecificOutput: {
23428
+ hookEventName: "PreToolUse",
23429
+ permissionDecision: "ask",
23430
+ permissionDecisionReason: approvalReason(results),
23431
+ ...context ? { additionalContext: context } : {}
23432
+ }
23433
+ };
23434
+ }
23435
+ if (aggregate === "deny") {
22844
23436
  return {
22845
23437
  hookSpecificOutput: {
22846
23438
  hookEventName: "PreToolUse",
@@ -23046,140 +23638,6 @@ function demoteForMode(verdict, mode) {
23046
23638
  // src/hooks/preflight-v3.ts
23047
23639
  import { Buffer as Buffer2 } from "buffer";
23048
23640
 
23049
- // src/hooks/redact.ts
23050
- import { existsSync as existsSync12, readFileSync as readFileSync12, statSync as statSync4 } from "fs";
23051
- import { join as join15 } from "path";
23052
- import { Worker } from "worker_threads";
23053
- var USER_HOME_RULES = [
23054
- {
23055
- pattern: /\/Users\/[^/\\\s"'`]+/g,
23056
- reason: "user-home-path",
23057
- replacement: "/Users/__redacted_user__"
23058
- },
23059
- {
23060
- pattern: /\/home\/[^/\\\s"'`]+/g,
23061
- reason: "user-home-path",
23062
- replacement: "/home/__redacted_user__"
23063
- },
23064
- {
23065
- pattern: /([A-Za-z]:\\Users\\)[^/\\\s"'`]+/gi,
23066
- reason: "user-home-path",
23067
- replacement: "$1__redacted_user__"
23068
- },
23069
- {
23070
- pattern: /\/root(?=\/|$)/g,
23071
- reason: "user-home-path",
23072
- replacement: "/__redacted_user__"
23073
- }
23074
- ];
23075
- var DEFAULT_RULES = [
23076
- { pattern: /Bearer\s+[A-Za-z0-9._~+/=-]+/gi, reason: "bearer-token" },
23077
- {
23078
- pattern: /\bsk-(?:(?:ant|proj)-)?[A-Za-z0-9_-]{16,}(?![A-Za-z0-9_-])/g,
23079
- reason: "sk-api-key"
23080
- },
23081
- {
23082
- pattern: /-----BEGIN [A-Z ]+PRIVATE KEY-----[\s\S]+?-----END [A-Z ]+PRIVATE KEY-----/g,
23083
- reason: "private-key"
23084
- },
23085
- { pattern: /xox[abprs]-[A-Za-z0-9-]{10,}/g, reason: "slack-token" },
23086
- {
23087
- pattern: /\b(?:gh[pousr]_[A-Za-z0-9]{36,}|github_pat_[A-Za-z0-9_]{50,})\b/g,
23088
- reason: "github-pat"
23089
- },
23090
- { pattern: /\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/g, reason: "aws-access-key" },
23091
- {
23092
- pattern: /\bAWS_(?:SECRET_ACCESS_KEY|SESSION_TOKEN)"?\s*[:=]\s*["']?[A-Za-z0-9/+=]{20,}["']?/gi,
23093
- reason: "aws-secret"
23094
- },
23095
- { pattern: /\bAIza[0-9A-Za-z_-]{35}(?![0-9A-Za-z_-])/g, reason: "gcp-api-key" },
23096
- {
23097
- pattern: /\bya29\.[0-9A-Za-z_-]{20,}(?![0-9A-Za-z_-])/g,
23098
- reason: "gcp-oauth-token"
23099
- },
23100
- {
23101
- pattern: /\beyJ[A-Za-z0-9_-]*\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*(?![A-Za-z0-9_-])/g,
23102
- reason: "jwt"
23103
- },
23104
- { pattern: /\bBasic\s+[A-Za-z0-9+/]+={0,2}/gi, reason: "basic-auth" },
23105
- { pattern: /\bhttps?:\/\/[^/\s:@]+:[^/\s@]+@/gi, reason: "basic-auth" },
23106
- ...USER_HOME_RULES
23107
- ];
23108
- var MAX_SCRUB_LEN = 256e3;
23109
- var MAX_WORKSPACE_CONFIG_BYTES = 64 * 1024;
23110
- function applyRules(input, rules) {
23111
- if (input.length > MAX_SCRUB_LEN) return "<REDACTED:oversized>";
23112
- let out = input;
23113
- for (const rule of rules) {
23114
- out = out.replace(rule.pattern, rule.replacement ?? `<REDACTED:${rule.reason}>`);
23115
- }
23116
- return out;
23117
- }
23118
- var REDACTED_OBJECT_KEY = "<REDACTED:object-key>";
23119
- function redactedObjectKey(input, transform) {
23120
- return transform(input) === input ? input : REDACTED_OBJECT_KEY;
23121
- }
23122
- function uniqueObjectKey(output, key) {
23123
- let candidate = key;
23124
- let suffix = 2;
23125
- while (Object.hasOwn(output, candidate)) candidate = `${key}_${suffix++}`;
23126
- return candidate;
23127
- }
23128
- function mapStrings(value, transform) {
23129
- if (typeof value === "string") return transform(value);
23130
- if (Array.isArray(value)) return value.map((item) => mapStrings(item, transform));
23131
- if (value && typeof value === "object") {
23132
- const out = /* @__PURE__ */ Object.create(null);
23133
- for (const [key, item] of Object.entries(value)) {
23134
- out[uniqueObjectKey(out, redactedObjectKey(key, transform))] = mapStrings(item, transform);
23135
- }
23136
- return out;
23137
- }
23138
- return value;
23139
- }
23140
- function scrub(value, rules = DEFAULT_RULES) {
23141
- return mapStrings(value, (input) => applyRules(input, rules));
23142
- }
23143
- var WORKSPACE_REDACTION_WORKER = String.raw`
23144
- const { parentPort, workerData } = require("node:worker_threads");
23145
- const REDACTED_OBJECT_KEY = "<REDACTED:object-key>";
23146
- const rules = workerData.rules.map((rule) => ({
23147
- pattern: new RegExp(rule.source, rule.flags),
23148
- reason: rule.reason,
23149
- }));
23150
- function redact(input) {
23151
- let output = input;
23152
- for (const rule of rules) {
23153
- output = output.replace(rule.pattern, "<REDACTED:" + rule.reason + ">");
23154
- }
23155
- return output;
23156
- }
23157
- function objectKey(input) {
23158
- return redact(input) === input ? input : REDACTED_OBJECT_KEY;
23159
- }
23160
- function uniqueKey(output, key) {
23161
- let candidate = key;
23162
- let suffix = 2;
23163
- while (Object.hasOwn(output, candidate)) candidate = key + "_" + suffix++;
23164
- return candidate;
23165
- }
23166
- function walk(value) {
23167
- if (typeof value === "string") {
23168
- return redact(value);
23169
- }
23170
- if (Array.isArray(value)) return value.map(walk);
23171
- if (value && typeof value === "object") {
23172
- const output = Object.create(null);
23173
- for (const [key, item] of Object.entries(value)) {
23174
- output[uniqueKey(output, objectKey(key))] = walk(item);
23175
- }
23176
- return output;
23177
- }
23178
- return value;
23179
- }
23180
- parentPort.postMessage(walk(workerData.value));
23181
- `;
23182
-
23183
23641
  // node_modules/.pnpm/unbash@4.0.3/node_modules/unbash/dist/chars.js
23184
23642
  var CH_TAB = 9;
23185
23643
  var CH_NL = 10;
@@ -27708,7 +28166,7 @@ async function requestPreflight(request2, signal = AbortSignal.timeout(PREFLIGHT
27708
28166
  });
27709
28167
  return parsePreflightResponse(response);
27710
28168
  }
27711
- function resultForPreflight(response) {
28169
+ function resultForPreflight(response, preview = "Review the requested change.") {
27712
28170
  const verdict = response.verdict === "block" ? "deny" : response.verdict;
27713
28171
  const message = boundedHealthError(response.message) ?? "";
27714
28172
  const unavailable = message || boundedHealthError(response.reasonCode);
@@ -27725,7 +28183,16 @@ function resultForPreflight(response) {
27725
28183
  ] : []
27726
28184
  ];
27727
28185
  });
27728
- const reason = [message, ...new Set(directives)].filter(Boolean).join("\n");
28186
+ const guidance = [message, ...new Set(directives)].filter(Boolean).join("\n");
28187
+ const reason = response.conflicts.length > 0 || response.verdict === "ask" || response.verdict === "block" ? approvalSummary(
28188
+ {
28189
+ conflicts: response.conflicts,
28190
+ message,
28191
+ reasonCode: response.reasonCode,
28192
+ evaluationCoverage: response.evaluationCoverage
28193
+ },
28194
+ preview
28195
+ ) : message;
27729
28196
  const disclosureContext = decisionDisclosureContext(response);
27730
28197
  return {
27731
28198
  verdict,
@@ -27733,7 +28200,7 @@ function resultForPreflight(response) {
27733
28200
  reason,
27734
28201
  additionalContext: [
27735
28202
  disclosureContext,
27736
- ["warn", "ask", "block"].includes(response.verdict) ? reason : ""
28203
+ ["warn", "ask", "block"].includes(response.verdict) ? guidance : ""
27737
28204
  ].filter(Boolean).join("\n"),
27738
28205
  truncated: false,
27739
28206
  unavailable: response.verdict === "unavailable" ? unavailable : void 0
@@ -27924,7 +28391,10 @@ async function main() {
27924
28391
  await emitUnverified("enforcement service returned an incompatible response", envelope);
27925
28392
  return;
27926
28393
  }
27927
- result = resultForPreflight(response);
28394
+ result = resultForPreflight(
28395
+ response,
28396
+ editPreview(toolName, envelope.tool_input, targets.paths)
28397
+ );
27928
28398
  } catch (error) {
27929
28399
  await emitUnverified(preflightFailure(error), envelope);
27930
28400
  return;