@usefragments/core 1.11.0 → 2.0.0

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.
Files changed (39) hide show
  1. package/dist/{chunk-RPSEABY3.js → chunk-BMPYIUZE.js} +23 -33
  2. package/dist/chunk-BMPYIUZE.js.map +1 -0
  3. package/dist/{chunk-3LLRNCPX.js → chunk-MZ2FS7U4.js} +1 -1
  4. package/dist/chunk-MZ2FS7U4.js.map +1 -0
  5. package/dist/codes/index.d.ts +1 -1
  6. package/dist/codes/index.js +1 -1
  7. package/dist/compiled-types/index.d.ts +1 -1
  8. package/dist/generate/index.d.ts +1 -1
  9. package/dist/{governance-BAsy1k2H.d.ts → governance-hOPXGbbs.d.ts} +3 -3
  10. package/dist/index.d.ts +133 -6026
  11. package/dist/index.js +179 -806
  12. package/dist/index.js.map +1 -1
  13. package/dist/preview-runtime.d.ts +1 -1
  14. package/dist/react-types.d.ts +1 -1
  15. package/dist/schemas/index.js +1 -1
  16. package/dist/storyAdapter.d.ts +1 -1
  17. package/dist/test-utils.d.ts +1 -1
  18. package/dist/topology/index.d.ts +1 -1
  19. package/dist/topology/index.js +1 -1
  20. package/package.json +1 -1
  21. package/src/approved-contract-tokens.test.ts +39 -0
  22. package/src/approved-contract-tokens.ts +18 -0
  23. package/src/codes/__tests__/codes.test.ts +4 -0
  24. package/src/codes/codes.ts +10 -0
  25. package/src/domain-ids.test.ts +9 -26
  26. package/src/domain-ids.ts +0 -45
  27. package/src/evaluation/evaluate.ts +17 -7
  28. package/src/evaluation/evaluation-v2-receipt-v1.test.ts +20 -8
  29. package/src/evaluation/index.ts +1 -1
  30. package/src/governance.ts +18 -0
  31. package/src/index.ts +10 -79
  32. package/src/topology/resolve-area.ts +1 -1
  33. package/src/types.ts +0 -3
  34. package/dist/chunk-3LLRNCPX.js.map +0 -1
  35. package/dist/chunk-RPSEABY3.js.map +0 -1
  36. package/src/feature-plan/digest.ts +0 -217
  37. package/src/feature-plan/feature-plan-v1.test.ts +0 -529
  38. package/src/feature-plan/index.ts +0 -65
  39. package/src/feature-plan/types.ts +0 -628
package/dist/index.js CHANGED
@@ -66,7 +66,7 @@ import {
66
66
  } from "./chunk-SH4KPIYH.js";
67
67
  import {
68
68
  resolveArea
69
- } from "./chunk-3LLRNCPX.js";
69
+ } from "./chunk-MZ2FS7U4.js";
70
70
  import {
71
71
  generateContext
72
72
  } from "./chunk-X34IA4LR.js";
@@ -113,12 +113,6 @@ import {
113
113
  factEvidenceSchema,
114
114
  factId,
115
115
  factLocationSchema,
116
- featurePlanIdFromEntropy,
117
- featurePlanIdSchema,
118
- featurePlanIdStringSchema,
119
- featureRevisionIdFromDigest,
120
- featureRevisionIdSchema,
121
- featureRevisionIdStringSchema,
122
116
  findingFixSchema,
123
117
  findingReplaceClassTokenFixSchema,
124
118
  findingReplaceComponentFixSchema,
@@ -194,10 +188,9 @@ import {
194
188
  ownedImportMatchesRoot,
195
189
  ownedImportsEqual,
196
190
  parseAnalysisPlanId,
191
+ parseComponentGovernancePolicyJson,
197
192
  parseDigestHex,
198
193
  parseEvaluationReceiptId,
199
- parseFeaturePlanId,
200
- parseFeatureRevisionId,
201
194
  policyExcludeMatchesPath,
202
195
  policyExcludeSchema,
203
196
  projectSupersededImportPathPreferences,
@@ -208,7 +201,7 @@ import {
208
201
  suppressionDirectiveSchema,
209
202
  validatorResultSchema,
210
203
  violationSchema
211
- } from "./chunk-RPSEABY3.js";
204
+ } from "./chunk-BMPYIUZE.js";
212
205
  import {
213
206
  isPortableRepoPath,
214
207
  normalizeConfigPath,
@@ -1346,14 +1339,14 @@ function rgbToLab(rgb) {
1346
1339
  b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
1347
1340
  let x = (r * 0.4124564 + g2 * 0.3575761 + b * 0.1804375) / 0.95047;
1348
1341
  let y = r * 0.2126729 + g2 * 0.7151522 + b * 0.072175;
1349
- let z12 = (r * 0.0193339 + g2 * 0.119192 + b * 0.9503041) / 1.08883;
1342
+ let z11 = (r * 0.0193339 + g2 * 0.119192 + b * 0.9503041) / 1.08883;
1350
1343
  x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
1351
1344
  y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
1352
- z12 = z12 > 8856e-6 ? Math.pow(z12, 1 / 3) : 7.787 * z12 + 16 / 116;
1345
+ z11 = z11 > 8856e-6 ? Math.pow(z11, 1 / 3) : 7.787 * z11 + 16 / 116;
1353
1346
  return {
1354
1347
  l: 116 * y - 16,
1355
1348
  a: 500 * (x - y),
1356
- b: 200 * (y - z12)
1349
+ b: 200 * (y - z11)
1357
1350
  };
1358
1351
  }
1359
1352
 
@@ -9389,11 +9382,11 @@ function collectPassthroughRecordValues(authored, path, allowed, diagnostics) {
9389
9382
  }
9390
9383
  }
9391
9384
  function stableConfigDiagnostics(diagnostics) {
9392
- const unique3 = /* @__PURE__ */ new Map();
9385
+ const unique2 = /* @__PURE__ */ new Map();
9393
9386
  for (const diagnostic of diagnostics) {
9394
- unique3.set(`${diagnostic.code}\0${diagnostic.path}`, diagnostic);
9387
+ unique2.set(`${diagnostic.code}\0${diagnostic.path}`, diagnostic);
9395
9388
  }
9396
- return [...unique3.values()].sort(
9389
+ return [...unique2.values()].sort(
9397
9390
  (left, right) => left.path.localeCompare(right.path) || left.code.localeCompare(right.code) || left.message.localeCompare(right.message)
9398
9391
  );
9399
9392
  }
@@ -10889,607 +10882,12 @@ function coverageArtifactDigestV1(rawPlan, rawCoverage) {
10889
10882
  );
10890
10883
  }
10891
10884
 
10892
- // src/feature-plan/types.ts
10893
- import { z as z10 } from "zod";
10894
- var FEATURE_PLAN_MAX_EVIDENCE_REFS_V1 = 200;
10895
- var FEATURE_PLAN_MAX_USES_PER_KIND_V1 = 100;
10896
- var FEATURE_PLAN_MAX_GAPS_V1 = 50;
10897
- var FEATURE_PLAN_MAX_DECISIONS_V1 = 50;
10898
- var FEATURE_PLAN_MAX_SCENARIOS_V1 = 50;
10899
- var FEATURE_PLAN_MAX_ACCEPTANCE_ITEMS_V1 = 100;
10900
- var FEATURE_PLAN_MAX_TEXT_BYTES_V1 = 32 * 1024;
10901
- var AGENT_FEATURE_CONTEXT_MAX_BYTES_V1 = 64 * 1024;
10902
- var utf8Length2 = (value) => new TextEncoder().encode(value).byteLength;
10903
- var boundedString2 = (maxBytes = FEATURE_PLAN_MAX_TEXT_BYTES_V1) => z10.string().min(1).refine((value) => utf8Length2(value) <= maxBytes, `Value exceeds ${maxBytes} UTF-8 bytes`);
10904
- var shortString = () => boundedString2(4096);
10905
- var unique = (values) => new Set(values).size === values.length;
10906
- var uniqueIdArray = (max = FEATURE_PLAN_MAX_EVIDENCE_REFS_V1) => z10.array(shortString()).max(max).refine(unique, "ID references must be unique");
10907
- var evidenceRefV1Schema = z10.object({
10908
- evidenceId: shortString(),
10909
- kind: z10.enum(["user_intent", "image", "source", "contract", "pattern", "model"]),
10910
- authority: z10.enum(["user_asserted", "source_observed", "contract_approved", "model_inferred"]),
10911
- ref: boundedString2(),
10912
- digest: digestHexStringSchema
10913
- }).strict();
10914
- var placementDecisionV1Schema = z10.object({
10915
- targetKind: z10.enum(["page", "section"]),
10916
- targetRef: shortString(),
10917
- routeRef: shortString().optional(),
10918
- parentSlotRef: shortString(),
10919
- evidenceRefIds: uniqueIdArray()
10920
- }).strict();
10921
- var propValueSchema = z10.union([boundedString2(), z10.number().finite(), z10.boolean(), z10.null()]);
10922
- var componentUseDecisionV1Schema = z10.object({
10923
- useId: shortString(),
10924
- componentId: shortString(),
10925
- importPath: shortString(),
10926
- purpose: boundedString2(),
10927
- props: z10.record(shortString(), propValueSchema).refine((props) => Object.keys(props).length <= 100, "Component props exceed V1 limit"),
10928
- evidenceRefIds: uniqueIdArray()
10929
- }).strict();
10930
- var tokenUseDecisionV1Schema = z10.object({
10931
- useId: shortString(),
10932
- tokenId: shortString(),
10933
- role: shortString(),
10934
- evidenceRefIds: uniqueIdArray()
10935
- }).strict();
10936
- var patternStatusV1Schema = z10.enum([
10937
- "observed",
10938
- "candidate",
10939
- "approved_guidance",
10940
- "contract_canonical",
10941
- "deprecated"
10942
- ]);
10943
- var patternUseDecisionV1Schema = z10.object({
10944
- useId: shortString(),
10945
- patternId: shortString(),
10946
- patternRevisionDigest: digestHexStringSchema,
10947
- status: patternStatusV1Schema,
10948
- disposition: z10.enum(["reuse", "reference", "reject"]),
10949
- evidenceRefIds: uniqueIdArray()
10950
- }).strict().superRefine((pattern, context) => {
10951
- if (pattern.disposition === "reuse" && pattern.status !== "approved_guidance" && pattern.status !== "contract_canonical") {
10952
- context.addIssue({
10953
- code: z10.ZodIssueCode.custom,
10954
- path: ["disposition"],
10955
- message: "Only approved-guidance or contract-canonical patterns may be reused"
10956
- });
10957
- }
10958
- });
10959
- var layoutConcernV1Schema = z10.enum([
10960
- "outer_inline_spacing",
10961
- "outer_block_spacing",
10962
- "inner_padding",
10963
- "child_gap",
10964
- "max_inline_size",
10965
- "scroll_x",
10966
- "scroll_y",
10967
- "sticky_offset",
10968
- "breakpoint_switching"
10969
- ]);
10970
- var layoutConcernOwnerV1Schema = z10.object({
10971
- concern: layoutConcernV1Schema,
10972
- ownerLayer: z10.enum([
10973
- "application_shell",
10974
- "route_shell",
10975
- "page",
10976
- "section",
10977
- "pattern",
10978
- "primitive"
10979
- ]),
10980
- ownerRef: shortString(),
10981
- childAction: z10.enum(["consume", "own", "override"]),
10982
- tokenRef: shortString().optional(),
10983
- breakpointRef: shortString().optional(),
10984
- evidenceRefIds: uniqueIdArray(),
10985
- overrideDecisionId: shortString().optional()
10986
- }).strict().superRefine((row, context) => {
10987
- if (row.childAction === "override" && !row.overrideDecisionId) {
10988
- context.addIssue({
10989
- code: z10.ZodIssueCode.custom,
10990
- path: ["overrideDecisionId"],
10991
- message: "A layout override must reference an approved decision"
10992
- });
10993
- }
10994
- if (row.childAction !== "override" && row.overrideDecisionId) {
10995
- context.addIssue({
10996
- code: z10.ZodIssueCode.custom,
10997
- path: ["overrideDecisionId"],
10998
- message: "Only an override may reference an override decision"
10999
- });
11000
- }
11001
- });
11002
- var layoutOwnershipV1Schema = z10.object({
11003
- concerns: z10.array(layoutConcernOwnerV1Schema).max(32).refine(
11004
- (rows) => new Set(rows.map((row) => row.concern)).size === rows.length,
11005
- "Each layout concern must have exactly one owner"
11006
- )
11007
- }).strict();
11008
- var responsiveDecisionV1Schema = z10.object({
11009
- decisionId: shortString(),
11010
- source: z10.enum(["contract", "observed", "desktop_only"]),
11011
- breakpointRef: shortString().optional(),
11012
- behavior: boundedString2(),
11013
- evidenceRefIds: uniqueIdArray()
11014
- }).strict().superRefine((decision, context) => {
11015
- if (decision.source !== "desktop_only" && !decision.breakpointRef) {
11016
- context.addIssue({
11017
- code: z10.ZodIssueCode.custom,
11018
- path: ["breakpointRef"],
11019
- message: "Responsive contract/observed decisions must pin a breakpoint"
11020
- });
11021
- }
11022
- });
11023
- var scenarioRequirementV1Schema = z10.object({
11024
- scenarioId: shortString(),
11025
- viewportRef: shortString().optional(),
11026
- themeRef: shortString().optional(),
11027
- actorRole: shortString().optional(),
11028
- dataState: z10.enum(["default", "loading", "empty", "partial", "error"]),
11029
- interactionState: z10.enum(["pristine", "dirty", "validating", "saving", "saved", "disabled"]).optional(),
11030
- acceptanceIds: uniqueIdArray(FEATURE_PLAN_MAX_ACCEPTANCE_ITEMS_V1)
11031
- }).strict();
11032
- var gapDispositionV1Schema = z10.enum([
11033
- "canonical_reuse",
11034
- "approved_pattern",
11035
- "local_composition",
11036
- "intentional_one_off",
11037
- "proposed_contract_addition",
11038
- "unresolved"
11039
- ]);
11040
- var capabilityGapV1Schema = z10.object({
11041
- gapId: shortString(),
11042
- capability: boundedString2(),
11043
- required: z10.boolean(),
11044
- disposition: gapDispositionV1Schema,
11045
- reason: boundedString2(),
11046
- evidenceRefIds: uniqueIdArray(),
11047
- proposedContractCandidateId: shortString().optional()
11048
- }).strict().superRefine((gap, context) => {
11049
- if (gap.disposition === "proposed_contract_addition" && !gap.proposedContractCandidateId) {
11050
- context.addIssue({
11051
- code: z10.ZodIssueCode.custom,
11052
- path: ["proposedContractCandidateId"],
11053
- message: "A proposed contract addition must pin its candidate"
11054
- });
11055
- }
11056
- if (gap.disposition !== "proposed_contract_addition" && gap.proposedContractCandidateId) {
11057
- context.addIssue({
11058
- code: z10.ZodIssueCode.custom,
11059
- path: ["proposedContractCandidateId"],
11060
- message: "Only a proposed contract addition may carry a candidate ID"
11061
- });
11062
- }
11063
- });
11064
- var featureAcceptanceItemV1Schema = z10.object({
11065
- acceptanceId: shortString(),
11066
- statement: boundedString2(),
11067
- proof: z10.enum(["unit", "integration", "browser", "governance", "manual"]),
11068
- required: z10.boolean(),
11069
- evidenceRefIds: uniqueIdArray()
11070
- }).strict();
11071
- var decisionOptionV1Schema = z10.object({ optionId: shortString(), label: boundedString2(), consequence: boundedString2() }).strict();
11072
- var decisionRequestV1Schema = z10.object({
11073
- decisionId: shortString(),
11074
- kind: z10.enum(["placement", "reuse", "gap", "layout_override", "responsive", "scope"]),
11075
- question: boundedString2(),
11076
- options: z10.array(decisionOptionV1Schema).min(2).max(20).refine(
11077
- (options) => new Set(options.map((option) => option.optionId)).size === options.length,
11078
- "Decision option IDs must be unique"
11079
- ),
11080
- recommendedOptionId: shortString().optional(),
11081
- required: z10.boolean(),
11082
- evidenceRefIds: uniqueIdArray()
11083
- }).strict().superRefine((decision, context) => {
11084
- if (decision.recommendedOptionId && !decision.options.some((option) => option.optionId === decision.recommendedOptionId)) {
11085
- context.addIssue({
11086
- code: z10.ZodIssueCode.custom,
11087
- path: ["recommendedOptionId"],
11088
- message: "Recommended option must resolve inside the decision"
11089
- });
11090
- }
11091
- });
11092
- var decisionResolutionV1Schema = z10.object({ decisionId: shortString(), selectedOptionId: shortString() }).strict();
11093
- var featurePinsV1Schema = z10.object({
11094
- bindingId: shortString(),
11095
- grounding: z10.object({
11096
- sourceCommitId: shortString(),
11097
- analysisPlanDigest: digestHexStringSchema,
11098
- contextSliceDigest: digestHexStringSchema
11099
- }).strict(),
11100
- authority: z10.object({
11101
- fcid: digestHexStringSchema,
11102
- contractArtifactDigest: digestHexStringSchema,
11103
- analysisObligationsDigest: digestHexStringSchema
11104
- }).strict(),
11105
- evidenceDigest: digestHexStringSchema
11106
- }).strict();
11107
- var commonRevisionShape = {
11108
- pins: featurePinsV1Schema,
11109
- placement: placementDecisionV1Schema,
11110
- componentUses: z10.array(componentUseDecisionV1Schema).max(FEATURE_PLAN_MAX_USES_PER_KIND_V1),
11111
- tokenUses: z10.array(tokenUseDecisionV1Schema).max(FEATURE_PLAN_MAX_USES_PER_KIND_V1),
11112
- patternUses: z10.array(patternUseDecisionV1Schema).max(FEATURE_PLAN_MAX_USES_PER_KIND_V1),
11113
- layout: layoutOwnershipV1Schema,
11114
- responsive: z10.array(responsiveDecisionV1Schema).max(FEATURE_PLAN_MAX_DECISIONS_V1),
11115
- scenarios: z10.array(scenarioRequirementV1Schema).max(FEATURE_PLAN_MAX_SCENARIOS_V1),
11116
- gaps: z10.array(capabilityGapV1Schema).max(FEATURE_PLAN_MAX_GAPS_V1),
11117
- acceptance: z10.array(featureAcceptanceItemV1Schema).max(FEATURE_PLAN_MAX_ACCEPTANCE_ITEMS_V1),
11118
- evidenceRefs: z10.array(evidenceRefV1Schema).max(FEATURE_PLAN_MAX_EVIDENCE_REFS_V1)
11119
- };
11120
- function addUniqueIdIssue(rows, key, path, context) {
11121
- const values = rows.map((row) => row[key]).filter((value) => typeof value === "string");
11122
- if (new Set(values).size !== values.length) {
11123
- context.addIssue({
11124
- code: z10.ZodIssueCode.custom,
11125
- path: [path],
11126
- message: `${path} IDs must be unique`
11127
- });
11128
- }
11129
- }
11130
- function validateCommonGraph(graph, context, decisionIds) {
11131
- addUniqueIdIssue(graph.evidenceRefs, "evidenceId", "evidenceRefs", context);
11132
- addUniqueIdIssue(graph.componentUses, "useId", "componentUses", context);
11133
- addUniqueIdIssue(graph.tokenUses, "useId", "tokenUses", context);
11134
- addUniqueIdIssue(graph.patternUses, "useId", "patternUses", context);
11135
- addUniqueIdIssue(graph.responsive, "decisionId", "responsive", context);
11136
- addUniqueIdIssue(graph.scenarios, "scenarioId", "scenarios", context);
11137
- addUniqueIdIssue(graph.gaps, "gapId", "gaps", context);
11138
- addUniqueIdIssue(graph.acceptance, "acceptanceId", "acceptance", context);
11139
- const evidenceIds = new Set(graph.evidenceRefs.map((evidence) => evidence.evidenceId));
11140
- const acceptanceIds = new Set(graph.acceptance.map((acceptance) => acceptance.acceptanceId));
11141
- const evidenceReferences = [
11142
- [graph.placement.evidenceRefIds, "placement.evidenceRefIds"],
11143
- ...graph.componentUses.map(
11144
- (row, index) => [row.evidenceRefIds, `componentUses.${index}.evidenceRefIds`]
11145
- ),
11146
- ...graph.tokenUses.map(
11147
- (row, index) => [row.evidenceRefIds, `tokenUses.${index}.evidenceRefIds`]
11148
- ),
11149
- ...graph.patternUses.map(
11150
- (row, index) => [row.evidenceRefIds, `patternUses.${index}.evidenceRefIds`]
11151
- ),
11152
- ...graph.layout.concerns.map(
11153
- (row, index) => [row.evidenceRefIds, `layout.concerns.${index}.evidenceRefIds`]
11154
- ),
11155
- ...graph.responsive.map(
11156
- (row, index) => [row.evidenceRefIds, `responsive.${index}.evidenceRefIds`]
11157
- ),
11158
- ...graph.gaps.map(
11159
- (row, index) => [row.evidenceRefIds, `gaps.${index}.evidenceRefIds`]
11160
- ),
11161
- ...graph.acceptance.map(
11162
- (row, index) => [row.evidenceRefIds, `acceptance.${index}.evidenceRefIds`]
11163
- )
11164
- ];
11165
- for (const [references, path] of evidenceReferences) {
11166
- for (const reference of references) {
11167
- if (!evidenceIds.has(reference)) {
11168
- context.addIssue({
11169
- code: z10.ZodIssueCode.custom,
11170
- path: path.split("."),
11171
- message: `Unknown evidence reference: ${reference}`
11172
- });
11173
- }
11174
- }
11175
- }
11176
- for (const [index, scenario] of graph.scenarios.entries()) {
11177
- for (const acceptanceId of scenario.acceptanceIds) {
11178
- if (!acceptanceIds.has(acceptanceId)) {
11179
- context.addIssue({
11180
- code: z10.ZodIssueCode.custom,
11181
- path: ["scenarios", index, "acceptanceIds"],
11182
- message: `Unknown acceptance reference: ${acceptanceId}`
11183
- });
11184
- }
11185
- }
11186
- }
11187
- for (const [index, row] of graph.layout.concerns.entries()) {
11188
- if (row.overrideDecisionId && !decisionIds.has(row.overrideDecisionId)) {
11189
- context.addIssue({
11190
- code: z10.ZodIssueCode.custom,
11191
- path: ["layout", "concerns", index, "overrideDecisionId"],
11192
- message: `Unknown decision reference: ${row.overrideDecisionId}`
11193
- });
11194
- }
11195
- }
11196
- }
11197
- var proposalInputShape = {
11198
- schemaVersion: z10.literal(1),
11199
- kind: z10.literal("proposal"),
11200
- planId: featurePlanIdStringSchema,
11201
- parentRevisionDigest: digestHexStringSchema.optional(),
11202
- ...commonRevisionShape,
11203
- questions: z10.array(decisionRequestV1Schema).max(FEATURE_PLAN_MAX_DECISIONS_V1)
11204
- };
11205
- function validateProposal(proposal, context) {
11206
- addUniqueIdIssue(proposal.questions, "decisionId", "questions", context);
11207
- const decisionIds = new Set(proposal.questions.map((question) => question.decisionId));
11208
- validateCommonGraph(proposal, context, decisionIds);
11209
- const evidenceIds = new Set(proposal.evidenceRefs.map((evidence) => evidence.evidenceId));
11210
- for (const [index, question] of proposal.questions.entries()) {
11211
- for (const reference of question.evidenceRefIds) {
11212
- if (!evidenceIds.has(reference)) {
11213
- context.addIssue({
11214
- code: z10.ZodIssueCode.custom,
11215
- path: ["questions", index, "evidenceRefIds"],
11216
- message: `Unknown evidence reference: ${reference}`
11217
- });
11218
- }
11219
- }
11220
- }
11221
- }
11222
- var featureProposalInputV1Schema = z10.object(proposalInputShape).strict().superRefine(validateProposal);
11223
- var featureProposalV1Schema = z10.object({
11224
- ...proposalInputShape,
11225
- revisionId: featureRevisionIdStringSchema,
11226
- revisionDigest: digestHexStringSchema
11227
- }).strict().superRefine(validateProposal);
11228
- var manifestInputShape = {
11229
- schemaVersion: z10.literal(1),
11230
- kind: z10.literal("approved_manifest"),
11231
- planId: featurePlanIdStringSchema,
11232
- parentRevisionDigest: digestHexStringSchema,
11233
- proposalRevisionDigest: digestHexStringSchema,
11234
- ...commonRevisionShape,
11235
- validatedGrounding: z10.object({
11236
- sourceCommitId: shortString(),
11237
- analysisPlanDigest: digestHexStringSchema,
11238
- contextSliceDigest: digestHexStringSchema
11239
- }).strict(),
11240
- decisions: z10.array(decisionResolutionV1Schema).max(FEATURE_PLAN_MAX_DECISIONS_V1),
11241
- approval: z10.object({
11242
- approverUserId: shortString(),
11243
- decisionDigest: digestHexStringSchema,
11244
- approvedAt: z10.string().datetime({ offset: true }),
11245
- expiresAt: z10.string().datetime({ offset: true }).optional()
11246
- }).strict()
11247
- };
11248
- var portableRepositoryPathSchema = shortString().refine(
11249
- (value) => !value.startsWith("/") && !value.includes("\\") && !value.split("/").includes(".."),
11250
- "Expected a portable repository-relative path"
11251
- );
11252
- function validateManifest(manifest, context) {
11253
- addUniqueIdIssue(manifest.decisions, "decisionId", "decisions", context);
11254
- validateCommonGraph(manifest, context, new Set(manifest.decisions.map((row) => row.decisionId)));
11255
- if (manifest.validatedGrounding.contextSliceDigest !== manifest.pins.grounding.contextSliceDigest) {
11256
- context.addIssue({
11257
- code: z10.ZodIssueCode.custom,
11258
- path: ["validatedGrounding", "contextSliceDigest"],
11259
- message: "Validated material context must match the pinned proposal context"
11260
- });
11261
- }
11262
- for (const [index, gap] of manifest.gaps.entries()) {
11263
- if (gap.required && (gap.disposition === "unresolved" || gap.disposition === "proposed_contract_addition")) {
11264
- context.addIssue({
11265
- code: z10.ZodIssueCode.custom,
11266
- path: ["gaps", index, "disposition"],
11267
- message: "A required unresolved or proposed-contract gap blocks approval until it is resolved"
11268
- });
11269
- }
11270
- }
11271
- }
11272
- var approvedFeatureManifestInputV1Schema = z10.object(manifestInputShape).strict().superRefine(validateManifest);
11273
- var approvedFeatureManifestV1Schema = z10.object({
11274
- ...manifestInputShape,
11275
- revisionId: featureRevisionIdStringSchema,
11276
- revisionDigest: digestHexStringSchema
11277
- }).strict().superRefine(validateManifest);
11278
- var agentFeatureContextV1Schema = z10.object({
11279
- schemaVersion: z10.literal(1),
11280
- planId: featurePlanIdStringSchema,
11281
- manifestDigest: digestHexStringSchema,
11282
- pins: featurePinsV1Schema,
11283
- validatedGrounding: manifestInputShape.validatedGrounding,
11284
- target: placementDecisionV1Schema,
11285
- componentUses: commonRevisionShape.componentUses,
11286
- tokenUses: commonRevisionShape.tokenUses,
11287
- patternUses: commonRevisionShape.patternUses,
11288
- layout: layoutOwnershipV1Schema,
11289
- responsive: commonRevisionShape.responsive,
11290
- scenarios: commonRevisionShape.scenarios,
11291
- acceptedGaps: commonRevisionShape.gaps,
11292
- acceptance: commonRevisionShape.acceptance,
11293
- decisions: manifestInputShape.decisions,
11294
- relevantFiles: z10.array(portableRepositoryPathSchema).max(500).refine(unique, "relevantFiles must be unique"),
11295
- commands: z10.array(boundedString2()).max(100)
11296
- }).strict().superRefine((contextValue, context) => {
11297
- const graph = {
11298
- pins: contextValue.pins,
11299
- placement: contextValue.target,
11300
- componentUses: contextValue.componentUses,
11301
- tokenUses: contextValue.tokenUses,
11302
- patternUses: contextValue.patternUses,
11303
- layout: contextValue.layout,
11304
- responsive: contextValue.responsive,
11305
- scenarios: contextValue.scenarios,
11306
- gaps: contextValue.acceptedGaps,
11307
- acceptance: contextValue.acceptance,
11308
- evidenceRefs: []
11309
- };
11310
- addUniqueIdIssue(contextValue.decisions, "decisionId", "decisions", context);
11311
- addUniqueIdIssue(graph.componentUses, "useId", "componentUses", context);
11312
- addUniqueIdIssue(graph.tokenUses, "useId", "tokenUses", context);
11313
- addUniqueIdIssue(graph.patternUses, "useId", "patternUses", context);
11314
- addUniqueIdIssue(graph.scenarios, "scenarioId", "scenarios", context);
11315
- addUniqueIdIssue(graph.acceptance, "acceptanceId", "acceptance", context);
11316
- const decisions = new Set(contextValue.decisions.map((row) => row.decisionId));
11317
- for (const [index, row] of contextValue.layout.concerns.entries()) {
11318
- if (row.overrideDecisionId && !decisions.has(row.overrideDecisionId)) {
11319
- context.addIssue({
11320
- code: z10.ZodIssueCode.custom,
11321
- path: ["layout", "concerns", index, "overrideDecisionId"],
11322
- message: `Unknown decision reference: ${row.overrideDecisionId}`
11323
- });
11324
- }
11325
- }
11326
- for (const [index, gap] of contextValue.acceptedGaps.entries()) {
11327
- if (gap.required && (gap.disposition === "unresolved" || gap.disposition === "proposed_contract_addition")) {
11328
- context.addIssue({
11329
- code: z10.ZodIssueCode.custom,
11330
- path: ["acceptedGaps", index],
11331
- message: "Agent context cannot contain a required unresolved or proposed-contract gap"
11332
- });
11333
- }
11334
- }
11335
- });
11336
-
11337
- // src/feature-plan/digest.ts
11338
- var sortedUnique2 = (values) => [...new Set(values)].sort();
11339
- function normalizeEvidenceRefs(row) {
11340
- return { ...row, evidenceRefIds: sortedUnique2(row.evidenceRefIds) };
11341
- }
11342
- function normalizeCommon(value) {
11343
- return {
11344
- ...value,
11345
- placement: normalizeEvidenceRefs(value.placement),
11346
- componentUses: value.componentUses.map(normalizeEvidenceRefs).sort((left, right) => compareCanonicalStrings(left.useId, right.useId)),
11347
- tokenUses: value.tokenUses.map(normalizeEvidenceRefs).sort((left, right) => compareCanonicalStrings(left.useId, right.useId)),
11348
- patternUses: value.patternUses.map(normalizeEvidenceRefs).sort((left, right) => compareCanonicalStrings(left.useId, right.useId)),
11349
- layout: {
11350
- concerns: value.layout.concerns.map(normalizeEvidenceRefs).sort((left, right) => compareCanonicalStrings(left.concern, right.concern))
11351
- },
11352
- responsive: value.responsive.map(normalizeEvidenceRefs).sort((left, right) => compareCanonicalStrings(left.decisionId, right.decisionId)),
11353
- scenarios: value.scenarios.map((scenario) => ({ ...scenario, acceptanceIds: sortedUnique2(scenario.acceptanceIds) })).sort((left, right) => compareCanonicalStrings(left.scenarioId, right.scenarioId)),
11354
- gaps: value.gaps.map(normalizeEvidenceRefs).sort((left, right) => compareCanonicalStrings(left.gapId, right.gapId)),
11355
- acceptance: value.acceptance.map(normalizeEvidenceRefs).sort((left, right) => compareCanonicalStrings(left.acceptanceId, right.acceptanceId)),
11356
- evidenceRefs: [...value.evidenceRefs].sort(
11357
- (left, right) => compareCanonicalStrings(left.evidenceId, right.evidenceId)
11358
- )
11359
- };
11360
- }
11361
- function normalizeFeatureProposalInputV1(value) {
11362
- const parsed = featureProposalInputV1Schema.parse(value);
11363
- return normalizeCommon({
11364
- ...parsed,
11365
- questions: parsed.questions.map((question) => ({ ...normalizeEvidenceRefs(question), options: [...question.options] })).sort((left, right) => compareCanonicalStrings(left.decisionId, right.decisionId))
11366
- });
11367
- }
11368
- function proposalProjection(proposal) {
11369
- return {
11370
- schema: "feature-revision.v1",
11371
- kind: proposal.kind,
11372
- planId: proposal.planId,
11373
- parentRevisionDigest: proposal.parentRevisionDigest,
11374
- pins: proposal.pins,
11375
- placement: proposal.placement,
11376
- componentUses: proposal.componentUses,
11377
- tokenUses: proposal.tokenUses,
11378
- patternUses: proposal.patternUses,
11379
- layout: proposal.layout,
11380
- responsive: proposal.responsive,
11381
- scenarios: proposal.scenarios,
11382
- gaps: proposal.gaps,
11383
- acceptance: proposal.acceptance,
11384
- questions: proposal.questions,
11385
- evidenceRefs: proposal.evidenceRefs
11386
- };
11387
- }
11388
- function featureProposalRevisionDigestV1(value) {
11389
- const proposal = normalizeFeatureProposalInputV1(value);
11390
- return sha256Hex(canonicalPreimage(proposalProjection(proposal)));
11391
- }
11392
- function buildFeatureProposalV1(value) {
11393
- const proposal = normalizeFeatureProposalInputV1(value);
11394
- const revisionDigest = sha256Hex(canonicalPreimage(proposalProjection(proposal)));
11395
- return featureProposalV1Schema.parse({
11396
- ...proposal,
11397
- revisionId: featureRevisionIdFromDigest(revisionDigest),
11398
- revisionDigest
11399
- });
11400
- }
11401
- function parseFeatureProposalV1(value) {
11402
- const parsed = featureProposalV1Schema.parse(value);
11403
- const { revisionId, revisionDigest, ...input } = parsed;
11404
- const rebuilt = buildFeatureProposalV1(input);
11405
- if (revisionId !== rebuilt.revisionId || revisionDigest !== rebuilt.revisionDigest) {
11406
- throw new TypeError("Feature proposal derived identity does not match its semantic projection");
11407
- }
11408
- return rebuilt;
11409
- }
11410
- function normalizeApprovedFeatureManifestInputV1(value) {
11411
- const parsed = approvedFeatureManifestInputV1Schema.parse(value);
11412
- return normalizeCommon({
11413
- ...parsed,
11414
- decisions: [...parsed.decisions].sort(
11415
- (left, right) => compareCanonicalStrings(left.decisionId, right.decisionId)
11416
- ),
11417
- approval: { ...parsed.approval },
11418
- validatedGrounding: { ...parsed.validatedGrounding }
11419
- });
11420
- }
11421
- function manifestProjection(manifest) {
11422
- return {
11423
- schema: "feature-revision.v1",
11424
- kind: manifest.kind,
11425
- planId: manifest.planId,
11426
- parentRevisionDigest: manifest.parentRevisionDigest,
11427
- proposalRevisionDigest: manifest.proposalRevisionDigest,
11428
- pins: manifest.pins,
11429
- validatedGrounding: manifest.validatedGrounding,
11430
- placement: manifest.placement,
11431
- componentUses: manifest.componentUses,
11432
- tokenUses: manifest.tokenUses,
11433
- patternUses: manifest.patternUses,
11434
- layout: manifest.layout,
11435
- responsive: manifest.responsive,
11436
- scenarios: manifest.scenarios,
11437
- gaps: manifest.gaps,
11438
- acceptance: manifest.acceptance,
11439
- evidenceRefs: manifest.evidenceRefs,
11440
- decisions: manifest.decisions,
11441
- approval: {
11442
- approverUserId: manifest.approval.approverUserId,
11443
- decisionDigest: manifest.approval.decisionDigest,
11444
- expiresAt: manifest.approval.expiresAt
11445
- }
11446
- };
11447
- }
11448
- function approvedFeatureManifestRevisionDigestV1(value) {
11449
- const manifest = normalizeApprovedFeatureManifestInputV1(value);
11450
- return sha256Hex(canonicalPreimage(manifestProjection(manifest)));
11451
- }
11452
- function buildApprovedFeatureManifestV1(value) {
11453
- const manifest = normalizeApprovedFeatureManifestInputV1(value);
11454
- const revisionDigest = sha256Hex(canonicalPreimage(manifestProjection(manifest)));
11455
- return approvedFeatureManifestV1Schema.parse({
11456
- ...manifest,
11457
- revisionId: featureRevisionIdFromDigest(revisionDigest),
11458
- revisionDigest
11459
- });
11460
- }
11461
- function parseApprovedFeatureManifestV1(value) {
11462
- const parsed = approvedFeatureManifestV1Schema.parse(value);
11463
- const { revisionId, revisionDigest, ...input } = parsed;
11464
- const rebuilt = buildApprovedFeatureManifestV1(input);
11465
- if (revisionId !== rebuilt.revisionId || revisionDigest !== rebuilt.revisionDigest) {
11466
- throw new TypeError(
11467
- "Approved manifest derived identity does not match its semantic projection"
11468
- );
11469
- }
11470
- return rebuilt;
11471
- }
11472
- var agentFeatureContextV1Schema2 = agentFeatureContextV1Schema.superRefine(
11473
- (value, context) => {
11474
- const bytes = new TextEncoder().encode(canonicalPreimage(value)).byteLength;
11475
- if (bytes > AGENT_FEATURE_CONTEXT_MAX_BYTES_V1) {
11476
- context.addIssue({
11477
- code: "custom",
11478
- message: `Agent feature context exceeds ${AGENT_FEATURE_CONTEXT_MAX_BYTES_V1} UTF-8 bytes`
11479
- });
11480
- }
11481
- }
11482
- );
11483
- function parseAgentFeatureContextV1(value) {
11484
- return agentFeatureContextV1Schema2.parse(value);
11485
- }
11486
-
11487
10885
  // src/evaluation/types.ts
11488
10886
  var EVALUATOR_VERSION = "evaluation-kernel:v1";
11489
10887
  var EVALUATOR_VERSION_V2 = "evaluation-kernel:v2";
11490
10888
 
11491
10889
  // src/evaluation/receipt.ts
11492
- import { z as z11 } from "zod";
10890
+ import { z as z10 } from "zod";
11493
10891
  var EVALUATION_MAX_WAIVERS_V2 = 1e3;
11494
10892
  var EVALUATION_MAX_WAIVER_MATCHES_V2 = 1e4;
11495
10893
  var EVALUATION_MAX_FINDINGS_V2 = 1e4;
@@ -11497,112 +10895,112 @@ var EVALUATION_MAX_REASON_CODES_V2 = 64;
11497
10895
  var EVALUATION_MAX_MAP_ENTRIES_V2 = 1e5;
11498
10896
  var EVALUATION_MAX_POLICY_RULES_V2 = 1e4;
11499
10897
  var EVALUATION_RECEIPT_STRING_MAX_BYTES_V1 = 4096;
11500
- var utf8Length3 = (value) => new TextEncoder().encode(value).byteLength;
11501
- var boundedString3 = (maxBytes = EVALUATION_RECEIPT_STRING_MAX_BYTES_V1) => z11.string().min(1).refine((value) => utf8Length3(value) <= maxBytes, `Value exceeds ${maxBytes} UTF-8 bytes`);
11502
- var unique2 = (values) => new Set(values).size === values.length;
11503
- var contractPreimageV1Schema = z11.object({
11504
- schema: z11.literal(CONTRACT_PREIMAGE_SCHEMA),
11505
- domains: z11.object({
10898
+ var utf8Length2 = (value) => new TextEncoder().encode(value).byteLength;
10899
+ var boundedString2 = (maxBytes = EVALUATION_RECEIPT_STRING_MAX_BYTES_V1) => z10.string().min(1).refine((value) => utf8Length2(value) <= maxBytes, `Value exceeds ${maxBytes} UTF-8 bytes`);
10900
+ var unique = (values) => new Set(values).size === values.length;
10901
+ var contractPreimageV1Schema = z10.object({
10902
+ schema: z10.literal(CONTRACT_PREIMAGE_SCHEMA),
10903
+ domains: z10.object({
11506
10904
  components: digestHexStringSchema,
11507
10905
  tokens: digestHexStringSchema,
11508
10906
  canonicalMap: digestHexStringSchema,
11509
10907
  policy: digestHexStringSchema
11510
10908
  }).strict()
11511
10909
  }).strict();
11512
- var effectiveRulePolicySchema = z11.object({ trust: z11.enum(["canonical", "evidence", "none"]).optional() }).strict();
11513
- var effectivePolicySchema = z11.object({
11514
- failOnWarnings: z11.boolean(),
11515
- failOnInert: z11.boolean().optional(),
11516
- rules: z11.record(boundedString3(), effectiveRulePolicySchema).refine(
10910
+ var effectiveRulePolicySchema = z10.object({ trust: z10.enum(["canonical", "evidence", "none"]).optional() }).strict();
10911
+ var effectivePolicySchema = z10.object({
10912
+ failOnWarnings: z10.boolean(),
10913
+ failOnInert: z10.boolean().optional(),
10914
+ rules: z10.record(boundedString2(), effectiveRulePolicySchema).refine(
11517
10915
  (rules) => Object.keys(rules).length <= EVALUATION_MAX_POLICY_RULES_V2,
11518
10916
  "Policy rule map exceeds the V2 limit"
11519
10917
  ).optional()
11520
10918
  }).strict();
11521
- var evaluationTrustSchema = z11.object({
11522
- source: z11.enum(["verified", "unverified", "unknown"]),
11523
- sources: z11.record(boundedString3(), z11.enum(["verified", "unverified", "unknown"])).refine(
10919
+ var evaluationTrustSchema = z10.object({
10920
+ source: z10.enum(["verified", "unverified", "unknown"]),
10921
+ sources: z10.record(boundedString2(), z10.enum(["verified", "unverified", "unknown"])).refine(
11524
10922
  (sources) => Object.keys(sources).length <= EVALUATION_MAX_MAP_ENTRIES_V2,
11525
10923
  "Source trust map exceeds the V2 limit"
11526
10924
  ).optional(),
11527
- mappings: z11.record(boundedString3(), z11.enum(["confirmed", "unconfirmed", "unknown"])).refine(
10925
+ mappings: z10.record(boundedString2(), z10.enum(["confirmed", "unconfirmed", "unknown"])).refine(
11528
10926
  (mappings) => Object.keys(mappings).length <= EVALUATION_MAX_MAP_ENTRIES_V2,
11529
10927
  "Mapping trust map exceeds the V2 limit"
11530
10928
  )
11531
10929
  }).strict();
11532
- var waiverScopeSchema = z11.discriminatedUnion("kind", [
11533
- z11.object({ kind: z11.literal("finding"), fingerprint: boundedString3() }).strict(),
11534
- z11.object({ kind: z11.literal("rule"), ruleId: boundedString3() }).strict(),
11535
- z11.object({ kind: z11.literal("path"), pathPattern: boundedString3() }).strict(),
11536
- z11.object({ kind: z11.literal("rule_path"), ruleId: boundedString3(), pathPattern: boundedString3() }).strict()
10930
+ var waiverScopeSchema = z10.discriminatedUnion("kind", [
10931
+ z10.object({ kind: z10.literal("finding"), fingerprint: boundedString2() }).strict(),
10932
+ z10.object({ kind: z10.literal("rule"), ruleId: boundedString2() }).strict(),
10933
+ z10.object({ kind: z10.literal("path"), pathPattern: boundedString2() }).strict(),
10934
+ z10.object({ kind: z10.literal("rule_path"), ruleId: boundedString2(), pathPattern: boundedString2() }).strict()
11537
10935
  ]);
11538
- var effectiveEvaluationWaiverV2Schema = z11.object({
11539
- waiverId: boundedString3(),
10936
+ var effectiveEvaluationWaiverV2Schema = z10.object({
10937
+ waiverId: boundedString2(),
11540
10938
  scope: waiverScopeSchema,
11541
- matchedFindingFingerprints: z11.array(boundedString3()).min(1).max(EVALUATION_MAX_WAIVER_MATCHES_V2).refine(unique2, "matched finding fingerprints must be unique"),
11542
- reason: boundedString3(),
11543
- expiresAt: z11.number().finite().optional()
10939
+ matchedFindingFingerprints: z10.array(boundedString2()).min(1).max(EVALUATION_MAX_WAIVER_MATCHES_V2).refine(unique, "matched finding fingerprints must be unique"),
10940
+ reason: boundedString2(),
10941
+ expiresAt: z10.number().finite().optional()
11544
10942
  }).strict();
11545
- var evaluationIntegrityInputV2Schema = z11.object({
11546
- governance: z11.enum(["healthy", "inert"]),
11547
- inertConfigDiagnosticCount: z11.number().int().nonnegative(),
11548
- profile: z11.discriminatedUnion("state", [
11549
- z11.object({
11550
- state: z11.literal("known"),
11551
- profileId: boundedString3(),
11552
- profileVersion: boundedString3()
10943
+ var evaluationIntegrityInputV2Schema = z10.object({
10944
+ governance: z10.enum(["healthy", "inert"]),
10945
+ inertConfigDiagnosticCount: z10.number().int().nonnegative(),
10946
+ profile: z10.discriminatedUnion("state", [
10947
+ z10.object({
10948
+ state: z10.literal("known"),
10949
+ profileId: boundedString2(),
10950
+ profileVersion: boundedString2()
11553
10951
  }).strict(),
11554
- z11.object({
11555
- state: z11.literal("unknown"),
11556
- profileId: boundedString3(),
11557
- profileVersion: boundedString3().optional()
10952
+ z10.object({
10953
+ state: z10.literal("unknown"),
10954
+ profileId: boundedString2(),
10955
+ profileVersion: boundedString2().optional()
11558
10956
  }).strict()
11559
10957
  ]),
11560
10958
  facts: canonicalFactIntegrityV1Schema
11561
10959
  }).strict();
11562
- var baselineSchema = z11.object({
11563
- identity: z11.object({
10960
+ var baselineSchema = z10.object({
10961
+ identity: z10.object({
11564
10962
  bindingDigest: digestHexStringSchema,
11565
- repositoryExternalId: boundedString3(),
10963
+ repositoryExternalId: boundedString2(),
11566
10964
  fcid: digestHexStringSchema,
11567
- sourceCommitId: boundedString3(),
11568
- generationId: boundedString3()
10965
+ sourceCommitId: boundedString2(),
10966
+ generationId: boundedString2()
11569
10967
  }).strict(),
11570
- findingStates: z11.record(boundedString3(), z11.enum(["introduced", "existing", "unknown"])).refine(
10968
+ findingStates: z10.record(boundedString2(), z10.enum(["introduced", "existing", "unknown"])).refine(
11571
10969
  (states) => Object.keys(states).length <= EVALUATION_MAX_MAP_ENTRIES_V2,
11572
10970
  "Baseline finding-state map exceeds the V2 limit"
11573
10971
  )
11574
10972
  }).strict();
11575
- var evaluationInputV2RawSchema = z11.object({
11576
- schemaVersion: z11.literal(2),
10973
+ var evaluationInputV2RawSchema = z10.object({
10974
+ schemaVersion: z10.literal(2),
11577
10975
  binding: repositoryBindingKeyV1Schema,
11578
10976
  analysisPlan: analysisPlanV1Schema,
11579
- contract: z11.object({
10977
+ contract: z10.object({
11580
10978
  fcid: digestHexStringSchema,
11581
10979
  preimage: contractPreimageV1Schema,
11582
- active: z11.boolean()
10980
+ active: z10.boolean()
11583
10981
  }).strict(),
11584
- factSchemaVersion: boundedString3(256),
11585
- facts: z11.instanceof(FactIndex),
10982
+ factSchemaVersion: boundedString2(256),
10983
+ facts: z10.instanceof(FactIndex),
11586
10984
  factsDigest: digestHexStringSchema,
11587
- coverage: z11.array(coverageRegionV1Schema).max(1e3),
10985
+ coverage: z10.array(coverageRegionV1Schema).max(1e3),
11588
10986
  policy: effectivePolicySchema,
11589
10987
  baseline: baselineSchema.optional(),
11590
- adoption: z11.union([z11.literal("unavailable"), z11.object({ regressed: z11.boolean() }).strict()]).optional(),
10988
+ adoption: z10.union([z10.literal("unavailable"), z10.object({ regressed: z10.boolean() }).strict()]).optional(),
11591
10989
  trust: evaluationTrustSchema.optional(),
11592
- waivers: z11.array(effectiveEvaluationWaiverV2Schema).max(EVALUATION_MAX_WAIVERS_V2).refine(
10990
+ waivers: z10.array(effectiveEvaluationWaiverV2Schema).max(EVALUATION_MAX_WAIVERS_V2).refine(
11593
10991
  (waivers) => new Set(waivers.map((waiver) => waiver.waiverId)).size === waivers.length,
11594
10992
  "waiver IDs must be unique"
11595
10993
  ),
11596
10994
  integrity: evaluationIntegrityInputV2Schema,
11597
- evaluatedAt: z11.number().finite(),
11598
- evaluatorVersion: boundedString3(256)
10995
+ evaluatedAt: z10.number().finite(),
10996
+ evaluatorVersion: boundedString2(256)
11599
10997
  }).strict().superRefine((input, context) => {
11600
10998
  let plan;
11601
10999
  try {
11602
11000
  plan = parseAnalysisPlanV1(input.analysisPlan);
11603
11001
  } catch (error) {
11604
11002
  context.addIssue({
11605
- code: z11.ZodIssueCode.custom,
11003
+ code: z10.ZodIssueCode.custom,
11606
11004
  path: ["analysisPlan"],
11607
11005
  message: error instanceof Error ? error.message : "Invalid analysis plan identity"
11608
11006
  });
@@ -11610,35 +11008,35 @@ var evaluationInputV2RawSchema = z11.object({
11610
11008
  }
11611
11009
  if (repositoryBindingDigestV1(plan.binding) !== repositoryBindingDigestV1(input.binding)) {
11612
11010
  context.addIssue({
11613
- code: z11.ZodIssueCode.custom,
11011
+ code: z10.ZodIssueCode.custom,
11614
11012
  path: ["binding"],
11615
11013
  message: "Evaluation binding does not match the analysis plan binding"
11616
11014
  });
11617
11015
  }
11618
11016
  if (plan.contract.fcid !== input.contract.fcid) {
11619
11017
  context.addIssue({
11620
- code: z11.ZodIssueCode.custom,
11018
+ code: z10.ZodIssueCode.custom,
11621
11019
  path: ["contract", "fcid"],
11622
11020
  message: "Evaluation FCID does not match the analysis plan"
11623
11021
  });
11624
11022
  }
11625
11023
  if (contractHash(input.contract.preimage) !== input.contract.fcid) {
11626
11024
  context.addIssue({
11627
- code: z11.ZodIssueCode.custom,
11025
+ code: z10.ZodIssueCode.custom,
11628
11026
  path: ["contract", "preimage"],
11629
11027
  message: "Contract preimage does not reproduce the pinned FCID"
11630
11028
  });
11631
11029
  }
11632
11030
  if (plan.evaluatorVersion !== input.evaluatorVersion) {
11633
11031
  context.addIssue({
11634
- code: z11.ZodIssueCode.custom,
11032
+ code: z10.ZodIssueCode.custom,
11635
11033
  path: ["evaluatorVersion"],
11636
11034
  message: "Evaluator version does not match the analysis plan"
11637
11035
  });
11638
11036
  }
11639
11037
  if (input.integrity.profile.state === "known" && (input.integrity.profile.profileId !== plan.profile.id || input.integrity.profile.profileVersion !== plan.profile.version)) {
11640
11038
  context.addIssue({
11641
- code: z11.ZodIssueCode.custom,
11039
+ code: z10.ZodIssueCode.custom,
11642
11040
  path: ["integrity", "profile"],
11643
11041
  message: "Known profile identity does not match the analysis plan"
11644
11042
  });
@@ -11647,7 +11045,7 @@ var evaluationInputV2RawSchema = z11.object({
11647
11045
  const expectedBindingDigest = repositoryBindingDigestV1(input.binding);
11648
11046
  if (input.baseline.identity.bindingDigest !== expectedBindingDigest || input.baseline.identity.repositoryExternalId !== input.binding.repositoryExternalId || input.baseline.identity.fcid !== input.contract.fcid) {
11649
11047
  context.addIssue({
11650
- code: z11.ZodIssueCode.custom,
11048
+ code: z10.ZodIssueCode.custom,
11651
11049
  path: ["baseline", "identity"],
11652
11050
  message: "Baseline identity does not match the evaluation binding and FCID"
11653
11051
  });
@@ -11655,7 +11053,7 @@ var evaluationInputV2RawSchema = z11.object({
11655
11053
  }
11656
11054
  if (input.facts.size() > plan.limits.maxFacts) {
11657
11055
  context.addIssue({
11658
- code: z11.ZodIssueCode.custom,
11056
+ code: z10.ZodIssueCode.custom,
11659
11057
  path: ["facts"],
11660
11058
  message: "Fact count exceeds the analysis-plan limit"
11661
11059
  });
@@ -11664,7 +11062,7 @@ var evaluationInputV2RawSchema = z11.object({
11664
11062
  deriveCoverageSummaryV1(plan, input.coverage);
11665
11063
  } catch (error) {
11666
11064
  context.addIssue({
11667
- code: z11.ZodIssueCode.custom,
11065
+ code: z10.ZodIssueCode.custom,
11668
11066
  path: ["coverage"],
11669
11067
  message: error instanceof Error ? error.message : "Coverage does not match the plan"
11670
11068
  });
@@ -11677,7 +11075,7 @@ var evaluationInputV2Schema = evaluationInputV2RawSchema.transform(
11677
11075
  analysisPlan: parseAnalysisPlanV1(input.analysisPlan)
11678
11076
  })
11679
11077
  );
11680
- var evaluationReasonV2Schema = z11.enum([
11078
+ var evaluationReasonV2Schema = z10.enum([
11681
11079
  "zeroFileScan",
11682
11080
  "governanceInert",
11683
11081
  "contractUnpinned",
@@ -11696,33 +11094,33 @@ var evaluationReasonV2Schema = z11.enum([
11696
11094
  "factConflict",
11697
11095
  "unknownAnalysisProfile"
11698
11096
  ]);
11699
- var evaluationResultV2Schema = z11.object({
11700
- schemaVersion: z11.literal(2),
11701
- verdict: z11.enum(["pass", "block", "indeterminate"]),
11702
- reasons: z11.array(evaluationReasonV2Schema).max(EVALUATION_MAX_REASON_CODES_V2).refine(unique2, "Evaluation reason codes must be unique"),
11703
- findings: z11.array(
11704
- z11.object({
11705
- fingerprint: boundedString3(),
11706
- ruleId: boundedString3(),
11707
- severity: z11.enum(["error", "warn", "info"]),
11708
- state: z11.enum(["blocked", "advisory", "pending_cloud_trust"]),
11709
- stateReasons: z11.array(boundedString3()).max(256)
11097
+ var evaluationResultV2Schema = z10.object({
11098
+ schemaVersion: z10.literal(2),
11099
+ verdict: z10.enum(["pass", "block", "indeterminate"]),
11100
+ reasons: z10.array(evaluationReasonV2Schema).max(EVALUATION_MAX_REASON_CODES_V2).refine(unique, "Evaluation reason codes must be unique"),
11101
+ findings: z10.array(
11102
+ z10.object({
11103
+ fingerprint: boundedString2(),
11104
+ ruleId: boundedString2(),
11105
+ severity: z10.enum(["error", "warn", "info"]),
11106
+ state: z10.enum(["blocked", "advisory", "pending_cloud_trust"]),
11107
+ stateReasons: z10.array(boundedString2()).max(256)
11710
11108
  }).strict()
11711
11109
  ).max(EVALUATION_MAX_FINDINGS_V2),
11712
- counts: z11.object({
11713
- blocked: z11.number().int().nonnegative().max(EVALUATION_MAX_FINDINGS_V2),
11714
- advisory: z11.number().int().nonnegative().max(EVALUATION_MAX_FINDINGS_V2),
11715
- pendingCloudTrust: z11.number().int().nonnegative().max(EVALUATION_MAX_FINDINGS_V2)
11110
+ counts: z10.object({
11111
+ blocked: z10.number().int().nonnegative().max(EVALUATION_MAX_FINDINGS_V2),
11112
+ advisory: z10.number().int().nonnegative().max(EVALUATION_MAX_FINDINGS_V2),
11113
+ pendingCloudTrust: z10.number().int().nonnegative().max(EVALUATION_MAX_FINDINGS_V2)
11716
11114
  }).strict(),
11717
- derived: z11.object({ warnPresent: z11.boolean(), gatingFindingsPresent: z11.boolean() }).strict(),
11115
+ derived: z10.object({ warnPresent: z10.boolean(), gatingFindingsPresent: z10.boolean() }).strict(),
11718
11116
  coverageSummary: coverageSummaryV1Schema,
11719
- integrity: z11.object({
11720
- fcidVerified: z11.boolean(),
11721
- analysisPlanVerified: z11.boolean(),
11722
- factIntegrity: z11.enum(["healthy", "conflict"]),
11723
- requiredCoverage: z11.enum(["complete", "incomplete", "no_required_regions"]),
11724
- governance: z11.enum(["healthy", "inert"]),
11725
- profile: z11.enum(["known", "unknown"])
11117
+ integrity: z10.object({
11118
+ fcidVerified: z10.boolean(),
11119
+ analysisPlanVerified: z10.boolean(),
11120
+ factIntegrity: z10.enum(["healthy", "conflict"]),
11121
+ requiredCoverage: z10.enum(["complete", "incomplete", "no_required_regions"]),
11122
+ governance: z10.enum(["healthy", "inert"]),
11123
+ profile: z10.enum(["known", "unknown"])
11726
11124
  }).strict(),
11727
11125
  inputDigest: digestHexStringSchema,
11728
11126
  resultDigest: digestHexStringSchema
@@ -11736,7 +11134,7 @@ var evaluationResultV2Schema = z11.object({
11736
11134
  if (finding.severity === "warn") emittedWarnPresent = true;
11737
11135
  if (new Set(finding.stateReasons).size !== finding.stateReasons.length) {
11738
11136
  context.addIssue({
11739
- code: z11.ZodIssueCode.custom,
11137
+ code: z10.ZodIssueCode.custom,
11740
11138
  path: ["findings", index, "stateReasons"],
11741
11139
  message: "Finding state reasons must be unique"
11742
11140
  });
@@ -11744,7 +11142,7 @@ var evaluationResultV2Schema = z11.object({
11744
11142
  }
11745
11143
  if (new Set(result.findings.map((finding) => finding.fingerprint)).size !== result.findings.length) {
11746
11144
  context.addIssue({
11747
- code: z11.ZodIssueCode.custom,
11145
+ code: z10.ZodIssueCode.custom,
11748
11146
  path: ["findings"],
11749
11147
  message: "Evaluation finding fingerprints must be unique"
11750
11148
  });
@@ -11752,7 +11150,7 @@ var evaluationResultV2Schema = z11.object({
11752
11150
  for (const key of ["blocked", "advisory", "pendingCloudTrust"]) {
11753
11151
  if (result.counts[key] !== expectedCounts[key]) {
11754
11152
  context.addIssue({
11755
- code: z11.ZodIssueCode.custom,
11153
+ code: z10.ZodIssueCode.custom,
11756
11154
  path: ["counts", key],
11757
11155
  message: `Evaluation ${key} count must match findings`
11758
11156
  });
@@ -11760,14 +11158,14 @@ var evaluationResultV2Schema = z11.object({
11760
11158
  }
11761
11159
  if (emittedWarnPresent && !result.derived.warnPresent) {
11762
11160
  context.addIssue({
11763
- code: z11.ZodIssueCode.custom,
11161
+ code: z10.ZodIssueCode.custom,
11764
11162
  path: ["derived", "warnPresent"],
11765
11163
  message: "An emitted warning finding requires warnPresent"
11766
11164
  });
11767
11165
  }
11768
11166
  if (result.derived.gatingFindingsPresent !== expectedCounts.blocked > 0) {
11769
11167
  context.addIssue({
11770
- code: z11.ZodIssueCode.custom,
11168
+ code: z10.ZodIssueCode.custom,
11771
11169
  path: ["derived", "gatingFindingsPresent"],
11772
11170
  message: "gatingFindingsPresent must match blocked findings"
11773
11171
  });
@@ -11789,14 +11187,14 @@ var evaluationResultV2Schema = z11.object({
11789
11187
  );
11790
11188
  if (requiredCount !== result.coverageSummary.requiredRegions || requiredCount + optionalCount !== result.coverageSummary.observedRegions || result.coverageSummary.observedRegions !== result.coverageSummary.plannedRegions) {
11791
11189
  context.addIssue({
11792
- code: z11.ZodIssueCode.custom,
11190
+ code: z10.ZodIssueCode.custom,
11793
11191
  path: ["coverageSummary"],
11794
11192
  message: "Coverage summary counts must reconcile with planned and observed regions"
11795
11193
  });
11796
11194
  }
11797
11195
  if (result.coverageSummary.analyzedFiles > result.coverageSummary.eligibleFiles) {
11798
11196
  context.addIssue({
11799
- code: z11.ZodIssueCode.custom,
11197
+ code: z10.ZodIssueCode.custom,
11800
11198
  path: ["coverageSummary", "analyzedFiles"],
11801
11199
  message: "Analyzed files cannot exceed eligible files"
11802
11200
  });
@@ -11804,7 +11202,7 @@ var evaluationResultV2Schema = z11.object({
11804
11202
  const expectedRequiredCoverage = result.coverageSummary.requiredRegions === 0 ? "no_required_regions" : result.coverageSummary.requiredByState.analyzed === result.coverageSummary.requiredRegions ? "complete" : "incomplete";
11805
11203
  if (result.integrity.requiredCoverage !== expectedRequiredCoverage) {
11806
11204
  context.addIssue({
11807
- code: z11.ZodIssueCode.custom,
11205
+ code: z10.ZodIssueCode.custom,
11808
11206
  path: ["integrity", "requiredCoverage"],
11809
11207
  message: "Required coverage integrity must match the derived coverage summary"
11810
11208
  });
@@ -11813,7 +11211,7 @@ var evaluationResultV2Schema = z11.object({
11813
11211
  const requireReason = (reason, required, path) => {
11814
11212
  if (reasons.has(reason) !== required) {
11815
11213
  context.addIssue({
11816
- code: z11.ZodIssueCode.custom,
11214
+ code: z10.ZodIssueCode.custom,
11817
11215
  path,
11818
11216
  message: `${reason} must match the evaluation result`
11819
11217
  });
@@ -11861,76 +11259,76 @@ var evaluationResultV2Schema = z11.object({
11861
11259
  const expectedVerdict = !integrityHealthy || result.reasons.some((reason) => integrityReasons.has(reason)) ? "indeterminate" : result.reasons.some((reason) => blockingReasons.has(reason)) ? "block" : result.reasons.length > 0 ? "indeterminate" : "pass";
11862
11260
  if (result.verdict !== expectedVerdict) {
11863
11261
  context.addIssue({
11864
- code: z11.ZodIssueCode.custom,
11262
+ code: z10.ZodIssueCode.custom,
11865
11263
  path: ["verdict"],
11866
11264
  message: `Evaluation verdict must be ${expectedVerdict} for its reasons and integrity`
11867
11265
  });
11868
11266
  }
11869
11267
  });
11870
- var providerProofSemanticV1Schema = z11.object({
11871
- schemaVersion: z11.literal(1),
11872
- adapterId: boundedString3(),
11873
- adapterVersion: boundedString3(),
11874
- providerInstanceId: boundedString3(),
11268
+ var providerProofSemanticV1Schema = z10.object({
11269
+ schemaVersion: z10.literal(1),
11270
+ adapterId: boundedString2(),
11271
+ adapterVersion: boundedString2(),
11272
+ providerInstanceId: boundedString2(),
11875
11273
  bindingDigest: digestHexStringSchema,
11876
- repositoryExternalId: boundedString3(),
11877
- sourceCommitId: boundedString3(),
11878
- eventExternalId: boundedString3(),
11879
- changeExternalId: boundedString3().optional(),
11880
- publisherExternalId: boundedString3()
11274
+ repositoryExternalId: boundedString2(),
11275
+ sourceCommitId: boundedString2(),
11276
+ eventExternalId: boundedString2(),
11277
+ changeExternalId: boundedString2().optional(),
11278
+ publisherExternalId: boundedString2()
11881
11279
  }).strict();
11882
11280
  function providerProofDigestV1(value) {
11883
11281
  const proof = providerProofSemanticV1Schema.parse(value);
11884
11282
  return sha256Hex(canonicalPreimage({ schema: "provider-proof.v1", ...proof }));
11885
11283
  }
11886
- var providerProofV1Schema = z11.object({
11887
- schemaVersion: z11.literal(1),
11888
- adapterId: boundedString3(),
11889
- adapterVersion: boundedString3(),
11890
- providerInstanceId: boundedString3(),
11284
+ var providerProofV1Schema = z10.object({
11285
+ schemaVersion: z10.literal(1),
11286
+ adapterId: boundedString2(),
11287
+ adapterVersion: boundedString2(),
11288
+ providerInstanceId: boundedString2(),
11891
11289
  bindingDigest: digestHexStringSchema,
11892
- repositoryExternalId: boundedString3(),
11893
- sourceCommitId: boundedString3(),
11894
- eventExternalId: boundedString3(),
11895
- changeExternalId: boundedString3().optional(),
11896
- publisherExternalId: boundedString3(),
11290
+ repositoryExternalId: boundedString2(),
11291
+ sourceCommitId: boundedString2(),
11292
+ eventExternalId: boundedString2(),
11293
+ changeExternalId: boundedString2().optional(),
11294
+ publisherExternalId: boundedString2(),
11897
11295
  proofDigest: digestHexStringSchema
11898
11296
  }).strict().superRefine((proof, context) => {
11899
11297
  const { proofDigest, ...semantic } = proof;
11900
11298
  if (providerProofDigestV1(semantic) !== proofDigest) {
11901
11299
  context.addIssue({
11902
- code: z11.ZodIssueCode.custom,
11300
+ code: z10.ZodIssueCode.custom,
11903
11301
  path: ["proofDigest"],
11904
11302
  message: "Provider proof digest mismatch"
11905
11303
  });
11906
11304
  }
11907
11305
  });
11908
11306
  var receiptSemanticShape = {
11909
- schemaVersion: z11.literal(1),
11910
- trust: z11.enum(["source_verified", "ci_attested", "local", "unknown"]),
11911
- authority: z11.enum(["advisory", "enforcement_eligible"]),
11307
+ schemaVersion: z10.literal(1),
11308
+ trust: z10.enum(["source_verified", "ci_attested", "local", "unknown"]),
11309
+ authority: z10.enum(["advisory", "enforcement_eligible"]),
11912
11310
  binding: repositoryBindingKeyV1Schema,
11913
- sourceCommitId: boundedString3(),
11311
+ sourceCommitId: boundedString2(),
11914
11312
  fcid: digestHexStringSchema,
11915
11313
  analysisPlanDigest: digestHexStringSchema,
11916
11314
  factsDigest: digestHexStringSchema,
11917
11315
  inputDigest: digestHexStringSchema,
11918
11316
  resultDigest: digestHexStringSchema,
11919
- evaluatorVersion: boundedString3(),
11317
+ evaluatorVersion: boundedString2(),
11920
11318
  providerProof: providerProofV1Schema.optional()
11921
11319
  };
11922
11320
  function validateReceiptSemantics(receipt, context) {
11923
11321
  if (receipt.authority === "enforcement_eligible") {
11924
11322
  if (receipt.trust !== "source_verified") {
11925
11323
  context.addIssue({
11926
- code: z11.ZodIssueCode.custom,
11324
+ code: z10.ZodIssueCode.custom,
11927
11325
  path: ["authority"],
11928
11326
  message: "Only source-verified evidence can enforce"
11929
11327
  });
11930
11328
  }
11931
11329
  if (!receipt.providerProof) {
11932
11330
  context.addIssue({
11933
- code: z11.ZodIssueCode.custom,
11331
+ code: z10.ZodIssueCode.custom,
11934
11332
  path: ["providerProof"],
11935
11333
  message: "Source-verified enforcement requires provider proof"
11936
11334
  });
@@ -11938,14 +11336,14 @@ function validateReceiptSemantics(receipt, context) {
11938
11336
  }
11939
11337
  if (receipt.trust === "source_verified" && !receipt.providerProof) {
11940
11338
  context.addIssue({
11941
- code: z11.ZodIssueCode.custom,
11339
+ code: z10.ZodIssueCode.custom,
11942
11340
  path: ["providerProof"],
11943
11341
  message: "Source-verified trust requires provider proof"
11944
11342
  });
11945
11343
  }
11946
11344
  if (receipt.trust !== "source_verified" && receipt.providerProof) {
11947
11345
  context.addIssue({
11948
- code: z11.ZodIssueCode.custom,
11346
+ code: z10.ZodIssueCode.custom,
11949
11347
  path: ["providerProof"],
11950
11348
  message: "Provider proof is reserved for source-verified trust"
11951
11349
  });
@@ -11955,34 +11353,34 @@ function validateReceiptSemantics(receipt, context) {
11955
11353
  const binding = normalizeRepositoryBindingKeyV1(receipt.binding);
11956
11354
  if (proof.bindingDigest !== repositoryBindingDigestV1(binding)) {
11957
11355
  context.addIssue({
11958
- code: z11.ZodIssueCode.custom,
11356
+ code: z10.ZodIssueCode.custom,
11959
11357
  path: ["providerProof", "bindingDigest"],
11960
11358
  message: "Provider proof binding mismatch"
11961
11359
  });
11962
11360
  }
11963
11361
  if (proof.providerInstanceId !== binding.providerInstanceId) {
11964
11362
  context.addIssue({
11965
- code: z11.ZodIssueCode.custom,
11363
+ code: z10.ZodIssueCode.custom,
11966
11364
  path: ["providerProof", "providerInstanceId"],
11967
11365
  message: "Provider proof instance mismatch"
11968
11366
  });
11969
11367
  }
11970
11368
  if (proof.repositoryExternalId !== binding.repositoryExternalId) {
11971
11369
  context.addIssue({
11972
- code: z11.ZodIssueCode.custom,
11370
+ code: z10.ZodIssueCode.custom,
11973
11371
  path: ["providerProof", "repositoryExternalId"],
11974
11372
  message: "Provider proof repository mismatch"
11975
11373
  });
11976
11374
  }
11977
11375
  if (proof.sourceCommitId !== receipt.sourceCommitId) {
11978
11376
  context.addIssue({
11979
- code: z11.ZodIssueCode.custom,
11377
+ code: z10.ZodIssueCode.custom,
11980
11378
  path: ["providerProof", "sourceCommitId"],
11981
11379
  message: "Provider proof source mismatch"
11982
11380
  });
11983
11381
  }
11984
11382
  }
11985
- var evaluationReceiptSemanticV1Schema = z11.object(receiptSemanticShape).strict().superRefine(validateReceiptSemantics);
11383
+ var evaluationReceiptSemanticV1Schema = z10.object(receiptSemanticShape).strict().superRefine(validateReceiptSemantics);
11986
11384
  function evaluationReceiptDigestV1(value) {
11987
11385
  const receipt = evaluationReceiptSemanticV1Schema.parse(value);
11988
11386
  return sha256Hex(
@@ -12002,10 +11400,10 @@ function evaluationReceiptDigestV1(value) {
12002
11400
  })
12003
11401
  );
12004
11402
  }
12005
- var evaluationReceiptV1Schema = z11.object({
11403
+ var evaluationReceiptV1Schema = z10.object({
12006
11404
  receiptId: evaluationReceiptIdStringSchema,
12007
11405
  ...receiptSemanticShape,
12008
- mintedAt: z11.string().datetime({ offset: true }),
11406
+ mintedAt: z10.string().datetime({ offset: true }),
12009
11407
  digest: digestHexStringSchema
12010
11408
  }).strict().superRefine((receipt, context) => {
12011
11409
  validateReceiptSemantics(receipt, context);
@@ -12015,21 +11413,21 @@ var evaluationReceiptV1Schema = z11.object({
12015
11413
  digest = evaluationReceiptDigestV1(semantic);
12016
11414
  } catch (error) {
12017
11415
  context.addIssue({
12018
- code: z11.ZodIssueCode.custom,
11416
+ code: z10.ZodIssueCode.custom,
12019
11417
  message: error instanceof Error ? error.message : "Invalid receipt semantics"
12020
11418
  });
12021
11419
  return;
12022
11420
  }
12023
11421
  if (digest !== receipt.digest) {
12024
11422
  context.addIssue({
12025
- code: z11.ZodIssueCode.custom,
11423
+ code: z10.ZodIssueCode.custom,
12026
11424
  path: ["digest"],
12027
11425
  message: "Receipt digest mismatch"
12028
11426
  });
12029
11427
  }
12030
11428
  if (evaluationReceiptIdFromDigest(digest) !== receipt.receiptId) {
12031
11429
  context.addIssue({
12032
- code: z11.ZodIssueCode.custom,
11430
+ code: z10.ZodIssueCode.custom,
12033
11431
  path: ["receiptId"],
12034
11432
  message: "Receipt ID mismatch"
12035
11433
  });
@@ -12038,17 +11436,17 @@ var evaluationReceiptV1Schema = z11.object({
12038
11436
  function parseEvaluationReceiptV1(value) {
12039
11437
  return evaluationReceiptV1Schema.parse(value);
12040
11438
  }
12041
- var evaluationReceiptMintInputV1Schema = z11.object({
12042
- schemaVersion: z11.literal(1),
12043
- trust: z11.enum(["ci_attested", "local", "unknown"]),
11439
+ var evaluationReceiptMintInputV1Schema = z10.object({
11440
+ schemaVersion: z10.literal(1),
11441
+ trust: z10.enum(["ci_attested", "local", "unknown"]),
12044
11442
  binding: repositoryBindingKeyV1Schema,
12045
- sourceCommitId: boundedString3(),
11443
+ sourceCommitId: boundedString2(),
12046
11444
  fcid: digestHexStringSchema,
12047
11445
  analysisPlanDigest: digestHexStringSchema,
12048
11446
  factsDigest: digestHexStringSchema,
12049
11447
  inputDigest: digestHexStringSchema,
12050
11448
  resultDigest: digestHexStringSchema,
12051
- evaluatorVersion: boundedString3()
11449
+ evaluatorVersion: boundedString2()
12052
11450
  }).strict();
12053
11451
 
12054
11452
  // src/evaluation/evaluate.ts
@@ -12247,9 +11645,7 @@ function evaluateV2(rawInput) {
12247
11645
  if (orderedReasons.some((reason) => V2_INTEGRITY_REASONS.has(reason))) {
12248
11646
  verdict = "indeterminate";
12249
11647
  }
12250
- const inputDigest = sha256Hex(
12251
- canonicalPreimage(normalizeInputV2ForDigest(input, coverageSummary))
12252
- );
11648
+ const inputDigest = evaluationInputDigestV2(input);
12253
11649
  const partial = {
12254
11650
  schemaVersion: 2,
12255
11651
  verdict,
@@ -12263,11 +11659,19 @@ function evaluateV2(rawInput) {
12263
11659
  coverageSummary,
12264
11660
  integrity
12265
11661
  };
12266
- const resultDigest = sha256Hex(
12267
- canonicalPreimage({ schema: "evaluation-result:v2", ...partial, inputDigest })
12268
- );
11662
+ const resultDigest = evaluationResultDigestV2({ ...partial, inputDigest });
12269
11663
  return evaluationResultV2Schema.parse({ ...partial, inputDigest, resultDigest });
12270
11664
  }
11665
+ function evaluationInputDigestV2(input) {
11666
+ return sha256Hex(
11667
+ canonicalPreimage(
11668
+ normalizeInputV2ForDigest(input, deriveCoverageSummaryV1(input.analysisPlan, input.coverage))
11669
+ )
11670
+ );
11671
+ }
11672
+ function evaluationResultDigestV2(result) {
11673
+ return sha256Hex(canonicalPreimage({ schema: "evaluation-result:v2", ...result }));
11674
+ }
12271
11675
  function normalizeInputV2ForDigest(input, coverageSummary) {
12272
11676
  const {
12273
11677
  analysisPlanId: _analysisPlanId,
@@ -12475,14 +11879,24 @@ function canonicalWaivers(waivers) {
12475
11879
  (waiver, index) => index === 0 || waiver.fingerprint !== sorted[index - 1].fingerprint || expiryOf(waiver) !== expiryOf(sorted[index - 1])
12476
11880
  );
12477
11881
  }
11882
+
11883
+ // src/approved-contract-tokens.ts
11884
+ var APPROVED_CONTRACT_TOKEN_MAX_NAMES = 1e4;
11885
+ var APPROVED_CONTRACT_TOKEN_MAX_NAME_LENGTH = 512;
11886
+ function isApprovedContractTokenNames(value) {
11887
+ return Array.isArray(value) && value.length <= APPROVED_CONTRACT_TOKEN_MAX_NAMES && value.every(
11888
+ (name) => typeof name === "string" && name.startsWith("--") && name.length > 2 && name.length <= APPROVED_CONTRACT_TOKEN_MAX_NAME_LENGTH
11889
+ );
11890
+ }
12478
11891
  export {
12479
11892
  AGENT_CONTEXT_RELATIVE_PATH,
12480
- AGENT_FEATURE_CONTEXT_MAX_BYTES_V1,
12481
11893
  AGENT_FORMAT_SCHEMA_VERSION,
12482
11894
  ANALYSIS_LIMIT_CEILINGS_V1,
12483
11895
  ANALYSIS_PLAN_MAX_CAPABILITIES_V1,
12484
11896
  ANALYSIS_PLAN_MAX_DIALECTS_PER_REGION_V1,
12485
11897
  ANALYSIS_PLAN_MAX_REGIONS_V1,
11898
+ APPROVED_CONTRACT_TOKEN_MAX_NAMES,
11899
+ APPROVED_CONTRACT_TOKEN_MAX_NAME_LENGTH,
12486
11900
  BLOCKING_RULE_ALLOWLIST,
12487
11901
  BRAND,
12488
11902
  CANONICAL_FACT_MAX_CONFLICTS_V1,
@@ -12514,13 +11928,6 @@ export {
12514
11928
  EVALUATOR_VERSION_V2,
12515
11929
  EVIDENCE_ORDER,
12516
11930
  EXPLAIN_URL_BASE,
12517
- FEATURE_PLAN_MAX_ACCEPTANCE_ITEMS_V1,
12518
- FEATURE_PLAN_MAX_DECISIONS_V1,
12519
- FEATURE_PLAN_MAX_EVIDENCE_REFS_V1,
12520
- FEATURE_PLAN_MAX_GAPS_V1,
12521
- FEATURE_PLAN_MAX_SCENARIOS_V1,
12522
- FEATURE_PLAN_MAX_TEXT_BYTES_V1,
12523
- FEATURE_PLAN_MAX_USES_PER_KIND_V1,
12524
11931
  FRAGMENTS_INTERNAL_RULE_IDS,
12525
11932
  FRAGMENTS_MANIFEST_FILENAME,
12526
11933
  FRAGMENTS_MANIFEST_SCHEMA_VERSION,
@@ -12555,7 +11962,6 @@ export {
12555
11962
  SEVERITY_RANK,
12556
11963
  SEVERITY_WEIGHTS,
12557
11964
  agentErrorEnvelopeSchema,
12558
- agentFeatureContextV1Schema2 as agentFeatureContextV1Schema,
12559
11965
  agentFormatSchema,
12560
11966
  agentIntegritySchema,
12561
11967
  agentOutputSchema,
@@ -12570,9 +11976,6 @@ export {
12570
11976
  analysisPlanV1Schema,
12571
11977
  analysisRegionV1Schema,
12572
11978
  analyzeComposition,
12573
- approvedFeatureManifestInputV1Schema,
12574
- approvedFeatureManifestRevisionDigestV1,
12575
- approvedFeatureManifestV1Schema,
12576
11979
  artifactContentHash,
12577
11980
  asComponentId,
12578
11981
  assembleRegistryArtifact,
@@ -12585,9 +11988,7 @@ export {
12585
11988
  budgetBar,
12586
11989
  buildAgentFormat,
12587
11990
  buildAnalysisPlanV1,
12588
- buildApprovedFeatureManifestV1,
12589
11991
  buildComponentKey,
12590
- buildFeatureProposalV1,
12591
11992
  buildRegistryArtifact,
12592
11993
  buildRegistryFile,
12593
11994
  buildRegistryInstallPlan,
@@ -12618,7 +12019,6 @@ export {
12618
12019
  canonicalizeOwnedComponentId,
12619
12020
  canonicalizeOwnedImport,
12620
12021
  capConfiguredSeverity,
12621
- capabilityGapV1Schema,
12622
12022
  catalogFixtureA,
12623
12023
  catalogFixtureAContractPayload,
12624
12024
  catalogFixtureATokensDtcg,
@@ -12646,7 +12046,6 @@ export {
12646
12046
  componentGovernanceRecordsSchema,
12647
12047
  componentId,
12648
12048
  componentRelationSchema,
12649
- componentUseDecisionV1Schema,
12650
12049
  compositionAuthoringEntrySchema,
12651
12050
  compositionMetadataSchema,
12652
12051
  compositionPatternSchema,
@@ -12665,8 +12064,6 @@ export {
12665
12064
  coverageStateV1Schema,
12666
12065
  coverageSummaryV1Schema,
12667
12066
  customerDefaultRuleStates,
12668
- decisionRequestV1Schema,
12669
- decisionResolutionV1Schema,
12670
12067
  defaultRegistryShardPath,
12671
12068
  defineBlock,
12672
12069
  defineConfig,
@@ -12687,6 +12084,7 @@ export {
12687
12084
  emptyVocabularyConfigFile,
12688
12085
  evaluate2 as evaluate,
12689
12086
  evaluateGovernanceIntegrity,
12087
+ evaluationInputDigestV2,
12690
12088
  evaluationInputV2Schema,
12691
12089
  evaluationReceiptDigestV1,
12692
12090
  evaluationReceiptIdFromDigest,
@@ -12694,8 +12092,8 @@ export {
12694
12092
  evaluationReceiptIdStringSchema,
12695
12093
  evaluationReceiptMintInputV1Schema,
12696
12094
  evaluationReceiptV1Schema,
12095
+ evaluationResultDigestV2,
12697
12096
  evaluationResultV2Schema,
12698
- evidenceRefV1Schema,
12699
12097
  excludeGlobToRegExp,
12700
12098
  expandRegistryComponentClosure,
12701
12099
  explainUrlForCode,
@@ -12703,17 +12101,6 @@ export {
12703
12101
  factId,
12704
12102
  factLocationSchema,
12705
12103
  familyDistance,
12706
- featureAcceptanceItemV1Schema,
12707
- featurePinsV1Schema,
12708
- featurePlanIdFromEntropy,
12709
- featurePlanIdSchema,
12710
- featurePlanIdStringSchema,
12711
- featureProposalInputV1Schema,
12712
- featureProposalRevisionDigestV1,
12713
- featureProposalV1Schema,
12714
- featureRevisionIdFromDigest,
12715
- featureRevisionIdSchema,
12716
- featureRevisionIdStringSchema,
12717
12104
  figma,
12718
12105
  figmaPropMappingSchema,
12719
12106
  finalizeRegistryManifest,
@@ -12758,7 +12145,6 @@ export {
12758
12145
  fragmentsManifestSchema,
12759
12146
  fragmentsPresetRuleStates,
12760
12147
  g,
12761
- gapDispositionV1Schema,
12762
12148
  gatesCi,
12763
12149
  generateCSSCustomProperties,
12764
12150
  generateContext,
@@ -12783,6 +12169,7 @@ export {
12783
12169
  indexComponentIdentityUsage,
12784
12170
  inferTokenCategory,
12785
12171
  inferTokenGroup,
12172
+ isApprovedContractTokenNames,
12786
12173
  isColorLike,
12787
12174
  isCompositionPattern,
12788
12175
  isContractFile,
@@ -12797,8 +12184,6 @@ export {
12797
12184
  isRawHtmlAdvisoryTier,
12798
12185
  isReactComponent,
12799
12186
  isRuleFamilyId,
12800
- layoutConcernV1Schema,
12801
- layoutOwnershipV1Schema,
12802
12187
  localCanonicalContractMappings,
12803
12188
  lowerCompositionContract,
12804
12189
  makeA11yNameRequiredFact,
@@ -12870,12 +12255,10 @@ export {
12870
12255
  nearestByDeltaE,
12871
12256
  nearestSignedScaleValue,
12872
12257
  normalizeAnalysisPlanInputV1,
12873
- normalizeApprovedFeatureManifestInputV1,
12874
12258
  normalizeCanonicalFactIntegrityV1,
12875
12259
  normalizeColor,
12876
12260
  normalizeConfigPath,
12877
12261
  normalizeExcludePath,
12878
- normalizeFeatureProposalInputV1,
12879
12262
  normalizeFinding,
12880
12263
  normalizeGovernanceConfig,
12881
12264
  normalizePolicyExcludes,
@@ -12889,14 +12272,13 @@ export {
12889
12272
  normalizeViolation,
12890
12273
  overriddenRecordSeverityDiagnostic,
12891
12274
  ownedImportEquivalents,
12892
- parseAgentFeatureContextV1,
12893
12275
  parseAnalysisPlanId,
12894
12276
  parseAnalysisPlanV1,
12895
- parseApprovedFeatureManifestV1,
12896
12277
  parseColor,
12897
12278
  parseColorToRgb,
12898
12279
  parseCompiledFragmentsFile,
12899
12280
  parseComponentContract,
12281
+ parseComponentGovernancePolicyJson,
12900
12282
  parseContractStamp,
12901
12283
  parseCssTokens,
12902
12284
  parseDtcgTokens as parseDTCGFile,
@@ -12905,9 +12287,6 @@ export {
12905
12287
  parseDtcgTokens,
12906
12288
  parseEvaluationReceiptId,
12907
12289
  parseEvaluationReceiptV1,
12908
- parseFeaturePlanId,
12909
- parseFeatureProposalV1,
12910
- parseFeatureRevisionId,
12911
12290
  parseFragmentsManifest,
12912
12291
  parseRgb,
12913
12292
  parseScssTokens,
@@ -12915,9 +12294,6 @@ export {
12915
12294
  parseTailwindV4Theme,
12916
12295
  parseTokenFile,
12917
12296
  parseTokens,
12918
- patternStatusV1Schema,
12919
- patternUseDecisionV1Schema,
12920
- placementDecisionV1Schema,
12921
12297
  policyExcludeMatchesPath,
12922
12298
  policyExcludeSchema,
12923
12299
  portableRepoPathError,
@@ -12977,7 +12353,6 @@ export {
12977
12353
  resolveRegistryInstallSources,
12978
12354
  resolveSpacingValue,
12979
12355
  resolveTokenValue,
12980
- responsiveDecisionV1Schema,
12981
12356
  rgbToHex,
12982
12357
  ruleA11yRequiredAccessibleName,
12983
12358
  ruleA11yStandard,
@@ -13003,7 +12378,6 @@ export {
13003
12378
  ruleTokensRequireDualFallback,
13004
12379
  runRules,
13005
12380
  scaleGovernanceRecordSchema,
13006
- scenarioRequirementV1Schema,
13007
12381
  serializeContractStamp,
13008
12382
  severityLevel,
13009
12383
  severitySchema,
@@ -13014,7 +12388,6 @@ export {
13014
12388
  suppressionDirectiveSchema,
13015
12389
  tierFor,
13016
12390
  tokenIncludesFromConfig,
13017
- tokenUseDecisionV1Schema,
13018
12391
  topologyBase,
13019
12392
  validatorResultSchema,
13020
12393
  verifiedContractPreimageFromPin,