project-tiny-context-harness 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/README.md +40 -32
  2. package/assets/README.md +141 -60
  3. package/assets/README.zh-CN.md +48 -40
  4. package/assets/agents/AGENTS_CORE.md +16 -12
  5. package/assets/context_templates/architecture.md +5 -5
  6. package/assets/context_templates/area.md +5 -5
  7. package/assets/context_templates/global.md +6 -6
  8. package/assets/context_templates/screen-contract.md +18 -18
  9. package/assets/github/harness.yml +2 -2
  10. package/assets/skills/context_development_engineer/SKILL.md +7 -5
  11. package/assets/skills/context_full_project_export/SKILL.md +42 -42
  12. package/assets/skills/context_uiux_design/SKILL.md +27 -13
  13. package/assets/skills/design-resource-authoring/SKILL.md +7 -7
  14. package/assets/skills/design-resource-authoring/references/downstream-handoff.md +12 -12
  15. package/assets/skills/design-resource-authoring/references/open-design-provider.md +21 -21
  16. package/assets/skills/design-resource-authoring/references/resource-selection.md +3 -3
  17. package/assets/skills/long-task-workflow/SKILL.md +17 -17
  18. package/assets/skills/long-task-workflow/agents/openai.yaml +4 -4
  19. package/assets/skills/long-task-workflow/references/authority-lifecycle.md +11 -9
  20. package/assets/skills/long-task-workflow/references/contract-authoring.md +19 -15
  21. package/assets/skills/long-task-workflow/references/evidence-design.md +18 -17
  22. package/assets/skills/long-task-workflow/references/source-authoring.md +15 -12
  23. package/assets/skills/normal-long-task/SKILL.md +12 -12
  24. package/dist/commands/design-resource.js +2 -2
  25. package/dist/commands/index.js +26 -26
  26. package/dist/commands/long-task-authoring.js +83 -9
  27. package/dist/commands/long-task.js +15 -15
  28. package/dist/lib/context-graph-snapshot.js +7 -0
  29. package/dist/lib/design-md.js +5 -4
  30. package/dist/lib/design-resource-handoff-shape-evidence.js +3 -0
  31. package/dist/lib/design-resource-handoff-shape-primitives.js +1 -3
  32. package/dist/lib/design-resource-handoff-types.d.ts +2 -0
  33. package/dist/lib/design-resource-handoff-validation-coverage.js +1 -0
  34. package/dist/lib/design-resource-handoff-validation-structure.js +2 -0
  35. package/dist/lib/doctor.js +2 -2
  36. package/dist/lib/execution-target-capabilities.d.ts +2 -0
  37. package/dist/lib/execution-target-capabilities.js +31 -0
  38. package/dist/lib/long-task-acceptance-shape.js +81 -20
  39. package/dist/lib/long-task-applicability-shape.d.ts +4 -0
  40. package/dist/lib/long-task-applicability-shape.js +54 -0
  41. package/dist/lib/long-task-assertions-v2.js +8 -0
  42. package/dist/lib/long-task-authoring-preflight-diagnostics.js +5 -0
  43. package/dist/lib/long-task-authoring-preflight-repair-order.js +3 -0
  44. package/dist/lib/long-task-authoring-preflight.js +12 -8
  45. package/dist/lib/long-task-authority-materials.js +46 -4
  46. package/dist/lib/long-task-authority-policy.d.ts +54 -0
  47. package/dist/lib/long-task-authority-policy.js +61 -0
  48. package/dist/lib/long-task-authority-types.d.ts +12 -2
  49. package/dist/lib/long-task-authority.js +9 -2
  50. package/dist/lib/long-task-check-shape.js +6 -1
  51. package/dist/lib/long-task-claim-definitions.js +27 -42
  52. package/dist/lib/long-task-claims.js +275 -146
  53. package/dist/lib/long-task-contract-types.d.ts +42 -8
  54. package/dist/lib/long-task-control-fields.d.ts +12 -0
  55. package/dist/lib/long-task-control-fields.js +66 -0
  56. package/dist/lib/long-task-control-types.d.ts +1 -0
  57. package/dist/lib/long-task-control-types.js +1 -0
  58. package/dist/lib/long-task-counterfactual-claim-policy.js +7 -0
  59. package/dist/lib/long-task-counterfactual-sandbox.js +1 -2
  60. package/dist/lib/long-task-counterfactual-types.d.ts +12 -0
  61. package/dist/lib/long-task-delivery-compiler.js +1 -0
  62. package/dist/lib/long-task-delivery-preflight.js +24 -0
  63. package/dist/lib/long-task-delivery-shape.d.ts +1 -0
  64. package/dist/lib/long-task-delivery-shape.js +1 -0
  65. package/dist/lib/long-task-delivery-types.d.ts +1 -0
  66. package/dist/lib/long-task-delivery-types.js +1 -0
  67. package/dist/lib/long-task-delivery-validation.js +46 -0
  68. package/dist/lib/long-task-design-resource-handoff.js +48 -7
  69. package/dist/lib/long-task-evidence-capability-codec.js +37 -0
  70. package/dist/lib/long-task-evidence-capability-policy.js +80 -38
  71. package/dist/lib/long-task-evidence-capability-runtime.js +36 -0
  72. package/dist/lib/long-task-evidence-capability-types.d.ts +13 -1
  73. package/dist/lib/long-task-evidence-findings.js +3 -0
  74. package/dist/lib/long-task-evidence-sensitivity-policy.js +38 -0
  75. package/dist/lib/long-task-evidence-v2.js +7 -1
  76. package/dist/lib/long-task-final-integrity.d.ts +16 -0
  77. package/dist/lib/long-task-final-integrity.js +98 -0
  78. package/dist/lib/long-task-final-v2.js +17 -34
  79. package/dist/lib/long-task-outcome-parser.js +22 -4
  80. package/dist/lib/long-task-playwright-case-evidence.d.ts +2 -0
  81. package/dist/lib/long-task-playwright-case-evidence.js +10 -2
  82. package/dist/lib/long-task-playwright-evidence.d.ts +1 -0
  83. package/dist/lib/long-task-playwright-evidence.js +32 -0
  84. package/dist/lib/long-task-product-shape.d.ts +3 -1
  85. package/dist/lib/long-task-product-shape.js +100 -4
  86. package/dist/lib/long-task-requirement-shape.js +3 -0
  87. package/dist/lib/long-task-root-shape.js +12 -6
  88. package/dist/lib/long-task-runner-freeze.js +16 -0
  89. package/dist/lib/long-task-runtime-types.d.ts +11 -2
  90. package/dist/lib/long-task-semantic-assurance-policy.d.ts +4 -0
  91. package/dist/lib/long-task-semantic-assurance-policy.js +52 -0
  92. package/dist/lib/long-task-semantic-contract-types.d.ts +18 -1
  93. package/dist/lib/long-task-semantic-drift-migration.js +33 -2
  94. package/dist/lib/long-task-semantic-mutation.d.ts +7 -0
  95. package/dist/lib/long-task-semantic-mutation.js +81 -0
  96. package/dist/lib/long-task-shape-primitives.d.ts +1 -1
  97. package/dist/lib/long-task-shape-primitives.js +1 -0
  98. package/dist/lib/long-task-source-authority-types.d.ts +2 -0
  99. package/dist/lib/long-task-source-item-parser.d.ts +1 -1
  100. package/dist/lib/long-task-source-item-parser.js +150 -104
  101. package/dist/lib/long-task-source-markers.d.ts +12 -0
  102. package/dist/lib/long-task-source-markers.js +146 -0
  103. package/dist/lib/long-task-source-target-continuity.d.ts +1 -1
  104. package/dist/lib/long-task-source-target-continuity.js +80 -55
  105. package/dist/lib/long-task-source-target-index.js +7 -29
  106. package/dist/lib/long-task-status-v2.d.ts +1 -0
  107. package/dist/lib/long-task-status-v2.js +2 -2
  108. package/dist/lib/long-task-target-policy.js +20 -0
  109. package/dist/lib/long-task-ui-design-policy.js +27 -1
  110. package/dist/lib/long-task-ui-surface-shape.js +21 -1
  111. package/dist/lib/long-task-ui-surface-types.d.ts +7 -0
  112. package/dist/lib/long-task-verification-preview.d.ts +10 -0
  113. package/dist/lib/long-task-verifier-dependency-closure.d.ts +3 -0
  114. package/dist/lib/long-task-verifier-dependency-closure.js +179 -0
  115. package/dist/lib/long-task-verifier-v2.js +12 -2
  116. package/dist/lib/long-task-workspace.js +5 -1
  117. package/dist/schemas/long-task-delivery-v2/long-task-delivery-v2.schema.json +99 -25
  118. package/migrations/README.md +8 -8
  119. package/package.json +84 -84
@@ -10,25 +10,32 @@ export function parseCounterfactuals(value, label) {
10
10
  "check_key",
11
11
  "mutation",
12
12
  "expected_assertion_failures",
13
+ ], ["preserved_assertions"]);
14
+ const mutation = object(row.mutation, `${itemLabel}.mutation`, ["type"], [
15
+ "paths",
16
+ "path",
17
+ "fixture_path",
18
+ "pointer",
19
+ "value",
20
+ "match",
21
+ "replacement",
13
22
  ]);
14
- const mutation = object(row.mutation, `${itemLabel}.mutation`, ["type"], ["paths", "path", "fixture_path"]);
15
- const type = literal(mutation.type, ["remove_paths", "replace_file"], `${itemLabel}.mutation.type`);
23
+ const type = literal(mutation.type, [
24
+ "remove_paths",
25
+ "replace_file",
26
+ "replace_json_value",
27
+ "replace_text",
28
+ ], `${itemLabel}.mutation.type`);
16
29
  return {
17
30
  key: key(row.key, `${itemLabel}.key`),
18
31
  binding_key: key(row.binding_key, `${itemLabel}.binding_key`),
19
32
  claims: strings(row.claims, `${itemLabel}.claims`),
20
33
  check_key: key(row.check_key, `${itemLabel}.check_key`),
21
- mutation: type === "remove_paths"
22
- ? {
23
- type,
24
- paths: repositoryFiles(mutation.paths, `${itemLabel}.mutation.paths`),
25
- }
26
- : {
27
- type,
28
- path: repositoryFile(mutation.path, `${itemLabel}.mutation.path`),
29
- fixture_path: repositoryFile(mutation.fixture_path, `${itemLabel}.mutation.fixture_path`),
30
- },
34
+ mutation: parseCounterfactualMutation(row.mutation, `${itemLabel}.mutation`),
31
35
  expected_assertion_failures: strings(row.expected_assertion_failures, `${itemLabel}.expected_assertion_failures`).map((item, assertionIndex) => key(item, `${itemLabel}.expected_assertion_failures[${assertionIndex}]`)),
36
+ preserved_assertions: Object.hasOwn(row, "preserved_assertions")
37
+ ? strings(row.preserved_assertions, `${itemLabel}.preserved_assertions`).map((item, assertionIndex) => key(item, `${itemLabel}.preserved_assertions[${assertionIndex}]`))
38
+ : [],
32
39
  };
33
40
  });
34
41
  }
@@ -42,7 +49,7 @@ export function parseGlobalCounterfactuals(value, label) {
42
49
  "check_key",
43
50
  "mutation",
44
51
  "expected_assertion_failures",
45
- ]);
52
+ ], ["preserved_assertions"]);
46
53
  const bindingRef = string(row.binding_ref, `${itemLabel}.binding_ref`);
47
54
  if (!/^[a-z0-9][a-z0-9-]*\.[a-z0-9][a-z0-9-]*$/u.test(bindingRef))
48
55
  fail(`${itemLabel}.binding_ref`, "must be <outcome-key>.<binding-key>");
@@ -59,39 +66,93 @@ export function parseGlobalCounterfactuals(value, label) {
59
66
  check_key: key(row.check_key, `${itemLabel}.check_key`),
60
67
  mutation: parseCounterfactualMutation(row.mutation, `${itemLabel}.mutation`),
61
68
  expected_assertion_failures: failures,
69
+ preserved_assertions: Object.hasOwn(row, "preserved_assertions")
70
+ ? strings(row.preserved_assertions, `${itemLabel}.preserved_assertions`).map((entry, assertionIndex) => key(entry, `${itemLabel}.preserved_assertions[${assertionIndex}]`))
71
+ : [],
62
72
  };
63
73
  });
64
74
  }
65
75
  function parseCounterfactualMutation(value, label) {
66
- const mutation = object(value, label, ["type"], ["paths", "path", "fixture_path"]);
67
- const type = literal(mutation.type, ["remove_paths", "replace_file"], `${label}.type`);
68
- return type === "remove_paths"
69
- ? {
76
+ const mutation = object(value, label, ["type"], [
77
+ "paths",
78
+ "path",
79
+ "fixture_path",
80
+ "pointer",
81
+ "value",
82
+ "match",
83
+ "replacement",
84
+ ]);
85
+ const type = literal(mutation.type, [
86
+ "remove_paths",
87
+ "replace_file",
88
+ "replace_json_value",
89
+ "replace_text",
90
+ ], `${label}.type`);
91
+ if (type === "remove_paths")
92
+ return {
70
93
  type,
71
94
  paths: repositoryFiles(mutation.paths, `${label}.paths`),
72
- }
73
- : {
95
+ };
96
+ const target = repositoryFile(mutation.path, `${label}.path`);
97
+ if (type === "replace_file")
98
+ return {
74
99
  type,
75
- path: repositoryFile(mutation.path, `${label}.path`),
100
+ path: target,
76
101
  fixture_path: repositoryFile(mutation.fixture_path, `${label}.fixture_path`),
77
102
  };
103
+ if (type === "replace_json_value") {
104
+ const pointer = string(mutation.pointer, `${label}.pointer`);
105
+ if (!/^\/(?:[^~/]|~[01])+(?:\/(?:[^~/]|~[01])+)*$/u.test(pointer))
106
+ fail(`${label}.pointer`, "must be a non-root RFC 6901 JSON pointer");
107
+ if (!Object.hasOwn(mutation, "value"))
108
+ fail(`${label}.value`, "must be present");
109
+ assertJsonValue(mutation.value, `${label}.value`);
110
+ return { type, path: target, pointer, value: mutation.value };
111
+ }
112
+ const match = string(mutation.match, `${label}.match`);
113
+ const replacement = typeof mutation.replacement === "string"
114
+ ? mutation.replacement
115
+ : fail(`${label}.replacement`, "must be a string");
116
+ if (match === replacement)
117
+ fail(`${label}.replacement`, "must differ from match");
118
+ return { type, path: target, match, replacement };
119
+ }
120
+ function assertJsonValue(value, label) {
121
+ if (value === undefined ||
122
+ typeof value === "function" ||
123
+ typeof value === "symbol" ||
124
+ typeof value === "bigint")
125
+ fail(label, "must be JSON-compatible");
126
+ try {
127
+ const encoded = JSON.stringify(value);
128
+ if (encoded === undefined)
129
+ fail(label, "must be JSON-compatible");
130
+ JSON.parse(encoded);
131
+ }
132
+ catch {
133
+ fail(label, "must be JSON-compatible");
134
+ }
78
135
  }
79
136
  export function parsePopulation(value, label) {
80
137
  const row = object(value, label, [
81
138
  "check_key",
139
+ "universe_binding_key",
82
140
  "claims",
83
141
  "observations",
84
142
  "exclusion_rules",
85
143
  ]);
86
144
  const observations = object(row.observations, `${label}.observations`, [
145
+ "universe_ids",
87
146
  "eligible_ids",
88
147
  "observed_ids",
89
148
  "excluded_items",
90
149
  ]);
91
150
  return {
92
151
  check_key: key(row.check_key, `${label}.check_key`),
152
+ universe_binding_key: key(row.universe_binding_key, `${label}.universe_binding_key`),
93
153
  claims: strings(row.claims, `${label}.claims`),
94
154
  observations: {
155
+ universe_ids: string(observations.universe_ids, `${label}.observations.universe_ids`),
95
156
  eligible_ids: string(observations.eligible_ids, `${label}.observations.eligible_ids`),
96
157
  observed_ids: string(observations.observed_ids, `${label}.observations.observed_ids`),
97
158
  excluded_items: string(observations.excluded_items, `${label}.observations.excluded_items`),
@@ -0,0 +1,4 @@
1
+ import type { ApplicableKeyedStatementV2, ClaimApplicabilityV2 } from "./long-task-semantic-contract-types.js";
2
+ export declare function parseClaimApplicability(value: unknown, label: string): ClaimApplicabilityV2[];
3
+ export declare function parseApplicableKeyedStatements(value: unknown, label: string): ApplicableKeyedStatementV2[];
4
+ export declare function parseKeyRefs(value: unknown, label: string): string[];
@@ -0,0 +1,54 @@
1
+ import { array, key, literal, object, string, strings, } from "./long-task-shape-primitives.js";
2
+ const JOURNEY_ROLES = [
3
+ "success",
4
+ "degradation",
5
+ "recovery",
6
+ "stage_gate",
7
+ "conformance",
8
+ ];
9
+ export function parseClaimApplicability(value, label) {
10
+ return array(value, label).map((item, index) => {
11
+ const itemLabel = `${label}[${index}]`;
12
+ const row = object(item, itemLabel, [
13
+ "key",
14
+ "target_ref",
15
+ "journey_role",
16
+ "dimensions",
17
+ "given_refs",
18
+ "when_refs",
19
+ ]);
20
+ return {
21
+ key: key(row.key, `${itemLabel}.key`),
22
+ target_ref: key(row.target_ref, `${itemLabel}.target_ref`),
23
+ journey_role: literal(row.journey_role, JOURNEY_ROLES, `${itemLabel}.journey_role`),
24
+ dimensions: array(row.dimensions, `${itemLabel}.dimensions`).map((dimension, dimensionIndex) => {
25
+ const dimensionLabel = `${itemLabel}.dimensions[${dimensionIndex}]`;
26
+ const entry = object(dimension, dimensionLabel, ["key", "value"]);
27
+ return {
28
+ key: key(entry.key, `${dimensionLabel}.key`),
29
+ value: key(entry.value, `${dimensionLabel}.value`),
30
+ };
31
+ }),
32
+ given_refs: parseKeyRefs(row.given_refs, `${itemLabel}.given_refs`),
33
+ when_refs: parseKeyRefs(row.when_refs, `${itemLabel}.when_refs`),
34
+ };
35
+ });
36
+ }
37
+ export function parseApplicableKeyedStatements(value, label) {
38
+ return array(value, label).map((item, index) => {
39
+ const itemLabel = `${label}[${index}]`;
40
+ const row = object(item, itemLabel, [
41
+ "key",
42
+ "statement",
43
+ "applicability_refs",
44
+ ]);
45
+ return {
46
+ key: key(row.key, `${itemLabel}.key`),
47
+ statement: string(row.statement, `${itemLabel}.statement`),
48
+ applicability_refs: parseKeyRefs(row.applicability_refs, `${itemLabel}.applicability_refs`),
49
+ };
50
+ });
51
+ }
52
+ export function parseKeyRefs(value, label) {
53
+ return strings(value, label).map((item, index) => key(item, `${label}[${index}]`));
54
+ }
@@ -77,14 +77,18 @@ export function evaluateDeliveryAssertionDetailed(assertion, observations) {
77
77
  return result(comparison.passed, expected, value);
78
78
  }
79
79
  export function evaluatePopulation(requirement, observations) {
80
+ const universe = observationValue(observations, requirement.observations.universe_ids).value;
80
81
  const eligible = observationValue(observations, requirement.observations.eligible_ids).value;
81
82
  const observed = observationValue(observations, requirement.observations.observed_ids).value;
82
83
  const excluded = observationValue(observations, requirement.observations.excluded_items).value;
83
84
  const actual = {
85
+ universe_ids: universe,
84
86
  eligible_ids: eligible,
85
87
  observed_ids: observed,
86
88
  excluded_items: excluded,
87
89
  };
90
+ if (!validIds(universe))
91
+ return failure(actual, "universe_ids_invalid");
88
92
  if (!validIds(eligible))
89
93
  return failure(actual, "eligible_ids_invalid");
90
94
  if (!validIds(observed))
@@ -92,6 +96,10 @@ export function evaluatePopulation(requirement, observations) {
92
96
  if (!Array.isArray(excluded))
93
97
  return failure(actual, "excluded_items_invalid");
94
98
  const eligibleSet = new Set(eligible);
99
+ const universeSet = new Set(universe);
100
+ if (universeSet.size !== eligibleSet.size ||
101
+ [...universeSet].some((id) => !eligibleSet.has(id)))
102
+ return failure(actual, "eligible_universe_mismatch");
95
103
  const observedSet = new Set(observed);
96
104
  const excludedIds = [];
97
105
  const rules = new Set(requirement.exclusion_rules.map((item) => item.key));
@@ -147,6 +147,10 @@ function diagnosticRefs(code, message) {
147
147
  case "global_claim_uncovered":
148
148
  case "source_claim_decision_required":
149
149
  return payload.flatMap((value) => value.split(",")).filter(Boolean);
150
+ case "product_claim_required_surfaces_missing":
151
+ return payload.length >= 2
152
+ ? [`${payload[0]}.${payload[1]}`, ...payload.slice(2)]
153
+ : payload;
150
154
  case "assertion_criterion_required":
151
155
  return payload.length ? [payload.join(":")] : [];
152
156
  default:
@@ -166,6 +170,7 @@ function diagnosticRepairHint(code) {
166
170
  case "forbidden_shortcut_key_duplicate":
167
171
  return "Remove an accidental duplicate or assign distinct stable keys while preserving each distinct semantic item.";
168
172
  case "product_claim_uncovered":
173
+ case "product_claim_required_surfaces_missing":
169
174
  case "global_claim_uncovered":
170
175
  return "Add claim-bearing Assertion coverage for every required proof surface or correct the Claim mapping; do not weaken or delete the uncovered Claim.";
171
176
  case "assertion_criterion_required":
@@ -7,6 +7,7 @@ const STRUCTURAL_BLOCKERS = new Set([
7
7
  ]);
8
8
  const COVERAGE_FOLLOW_UPS = new Set([
9
9
  "product_claim_uncovered",
10
+ "product_claim_required_surfaces_missing",
10
11
  "global_claim_uncovered",
11
12
  ]);
12
13
  /**
@@ -83,6 +84,8 @@ function repairEntity(diagnostic) {
83
84
  return scopedClaim(refs, "forbidden_shortcut");
84
85
  case "product_claim_uncovered":
85
86
  return refs.length === 1 ? refs[0] : null;
87
+ case "product_claim_required_surfaces_missing":
88
+ return (refs.find((ref) => /^[a-z0-9][a-z0-9-]*\.(?:result|requirement\.|control\.|control_relation\.|non_completing\.|obligation\.|forbidden_shortcut\.)/u.test(ref)) ?? null);
86
89
  case "global_claim_uncovered":
87
90
  return refs.length === 1 ? refs[0] : null;
88
91
  default:
@@ -22,14 +22,18 @@ export async function preflightDeliveryContract(workdirInput, projectRootInput =
22
22
  }
23
23
  const contract = parsed.contract;
24
24
  addAuthoringDiagnostics(contract, parsed, diagnostics);
25
- const validation = await validateContractForActivation({
26
- repository,
27
- workdir,
28
- contract,
29
- mode: "collect",
30
- diagnostics,
31
- });
32
- const active = await loadAuthoringActiveAuthority(repository, workdir, diagnostics);
25
+ const activeDiagnostics = [];
26
+ const [validation, active] = await Promise.all([
27
+ validateContractForActivation({
28
+ repository,
29
+ workdir,
30
+ contract,
31
+ mode: "collect",
32
+ diagnostics,
33
+ }),
34
+ loadAuthoringActiveAuthority(repository, workdir, activeDiagnostics),
35
+ ]);
36
+ diagnostics.push(...activeDiagnostics);
33
37
  if (validation.workspace)
34
38
  try {
35
39
  const changedPaths = active?.workdir === workdir
@@ -31,12 +31,20 @@ export function projectProductSemantics(contract) {
31
31
  target_profile: contract.task.target_profile,
32
32
  execution_targets: [...contract.task.execution_targets].sort(keyOrder),
33
33
  stages: [...contract.stages].sort(keyOrder),
34
- global_non_goals: keyedStatements(contract.global.product.non_goals),
34
+ global_non_goals: applicableStatements(contract.global.product.non_goals),
35
35
  outcomes: [...contract.outcomes].sort(keyOrder).map((outcome) => ({
36
36
  key: outcome.key,
37
37
  title: outcome.title,
38
38
  stage: outcome.stage,
39
+ applicability: [...outcome.applicability].sort(keyOrder).map((item) => ({
40
+ ...item,
41
+ given_refs: [...item.given_refs],
42
+ when_refs: [...item.when_refs],
43
+ })),
39
44
  observable_result: outcome.product.observable_result,
45
+ result_applicability_refs: [
46
+ ...outcome.product.result_applicability_refs,
47
+ ].sort(),
40
48
  success_path_required: outcome.product.success_path_required,
41
49
  degradation_path_required: outcome.product.degradation_path_required,
42
50
  owner: {
@@ -51,6 +59,7 @@ export function projectProductSemantics(contract) {
51
59
  required_proof_surfaces: [
52
60
  ...requirement.required_proof_surfaces,
53
61
  ].sort(),
62
+ applicability_refs: [...requirement.applicability_refs].sort(),
54
63
  })),
55
64
  controls: [...outcome.product.controls].sort(keyOrder).map((control) => ({
56
65
  key: control.key,
@@ -76,6 +85,20 @@ export function projectProductSemantics(contract) {
76
85
  permission: control.permission,
77
86
  feedback: control.feedback,
78
87
  accessibility: control.accessibility,
88
+ field_coverage: [...control.field_coverage].map((entry) => ({
89
+ ...entry,
90
+ fields: [...entry.fields].sort(),
91
+ applicability_refs: [...entry.applicability_refs].sort(),
92
+ })),
93
+ })),
94
+ control_relation_closure: outcome.product.control_relation_closure,
95
+ control_relations: [...outcome.product.control_relations]
96
+ .sort(keyOrder)
97
+ .map((relation) => ({
98
+ ...relation,
99
+ control_refs: [...relation.control_refs].sort(),
100
+ required_proof_surfaces: [...relation.required_proof_surfaces].sort(),
101
+ applicability_refs: [...relation.applicability_refs].sort(),
79
102
  })),
80
103
  surface_bindings: [...(outcome.product.surface_bindings ?? [])]
81
104
  .sort(keyOrder)
@@ -96,16 +119,26 @@ export function projectProductSemantics(contract) {
96
119
  .map((blocker) => ({
97
120
  ...blocker,
98
121
  refs: [...blocker.refs].sort(),
122
+ source_item_refs: [...blocker.source_item_refs].sort(),
123
+ verification_methods: [...blocker.verification_methods].sort(),
124
+ required_capabilities: [...blocker.required_capabilities].sort(),
99
125
  })),
100
126
  })),
101
- non_completing_outcomes: keyedStatements(outcome.product.non_completing_outcomes),
127
+ non_completing_outcomes: applicableStatements(outcome.product.non_completing_outcomes),
102
128
  })),
103
129
  };
104
130
  }
105
131
  export function projectGlobalSemantics(contract) {
106
132
  return {
107
- constraints: keyedStatements(contract.global.technical.constraints),
108
- forbidden_shortcuts: keyedStatements(contract.global.technical.forbidden_shortcuts),
133
+ applicability: [...contract.global.applicability]
134
+ .sort(keyOrder)
135
+ .map((item) => ({
136
+ ...item,
137
+ given_refs: [...item.given_refs],
138
+ when_refs: [...item.when_refs],
139
+ })),
140
+ constraints: applicableStatements(contract.global.technical.constraints),
141
+ forbidden_shortcuts: applicableStatements(contract.global.technical.forbidden_shortcuts),
109
142
  };
110
143
  }
111
144
  function keyedStatements(values) {
@@ -113,6 +146,15 @@ function keyedStatements(values) {
113
146
  .sort(keyOrder)
114
147
  .map(({ key, statement }) => ({ key, statement }));
115
148
  }
149
+ function applicableStatements(values) {
150
+ return [...values]
151
+ .sort(keyOrder)
152
+ .map(({ key, statement, applicability_refs }) => ({
153
+ key,
154
+ statement,
155
+ applicability_refs: [...applicability_refs].sort(),
156
+ }));
157
+ }
116
158
  function keyOrder(left, right) {
117
159
  return left.key.localeCompare(right.key);
118
160
  }
@@ -35,6 +35,12 @@ export declare const AUTHORITY_FIELD_POLICY_REGISTRIES: {
35
35
  requested_level: "semantic_user_review";
36
36
  facts: "semantic_user_review";
37
37
  };
38
+ readonly global: {
39
+ applicability: "semantic_user_review";
40
+ product: "semantic_user_review";
41
+ technical: "semantic_user_review";
42
+ acceptance: "proof_additive";
43
+ };
38
44
  readonly global_product: {
39
45
  non_goals: "semantic_user_review";
40
46
  };
@@ -53,18 +59,35 @@ export declare const AUTHORITY_FIELD_POLICY_REGISTRIES: {
53
59
  title: "descriptive_non_authoritative";
54
60
  stage: "semantic_user_review";
55
61
  depends_on: "readiness_only";
62
+ applicability: "semantic_user_review";
56
63
  product: "semantic_user_review";
57
64
  technical: "semantic_user_review";
58
65
  acceptance: "proof_additive";
59
66
  };
67
+ readonly claim_applicability: {
68
+ key: "identity";
69
+ target_ref: "semantic_user_review";
70
+ journey_role: "semantic_user_review";
71
+ dimensions: "semantic_user_review";
72
+ given_refs: "semantic_user_review";
73
+ when_refs: "semantic_user_review";
74
+ };
75
+ readonly applicable_statement: {
76
+ key: "identity";
77
+ statement: "semantic_user_review";
78
+ applicability_refs: "semantic_user_review";
79
+ };
60
80
  readonly outcome_product: {
61
81
  observable_result: "semantic_user_review";
82
+ result_applicability_refs: "semantic_user_review";
62
83
  success_path_required: "semantic_user_review";
63
84
  degradation_path_required: "semantic_user_review";
64
85
  owner: "semantic_user_review";
65
86
  requirements: "semantic_user_review";
66
87
  owner_surfaces: "semantic_user_review";
67
88
  controls: "semantic_user_review";
89
+ control_relation_closure: "semantic_user_review";
90
+ control_relations: "semantic_user_review";
68
91
  surface_bindings: "semantic_user_review";
69
92
  non_completing_outcomes: "semantic_user_review";
70
93
  };
@@ -72,6 +95,7 @@ export declare const AUTHORITY_FIELD_POLICY_REGISTRIES: {
72
95
  key: "identity";
73
96
  statement: "semantic_user_review";
74
97
  required_proof_surfaces: "proof_additive";
98
+ applicability_refs: "semantic_user_review";
75
99
  };
76
100
  readonly owner: {
77
101
  label: "identity";
@@ -102,6 +126,25 @@ export declare const AUTHORITY_FIELD_POLICY_REGISTRIES: {
102
126
  permission: "semantic_user_review";
103
127
  feedback: "semantic_user_review";
104
128
  accessibility: "semantic_user_review";
129
+ field_coverage: "semantic_user_review";
130
+ };
131
+ readonly control_field_coverage: {
132
+ fields: "semantic_user_review";
133
+ state: "semantic_user_review";
134
+ statement: "semantic_user_review";
135
+ applicability_refs: "semantic_user_review";
136
+ };
137
+ readonly control_relation_closure: {
138
+ state: "semantic_user_review";
139
+ statement: "semantic_user_review";
140
+ applicability_refs: "semantic_user_review";
141
+ };
142
+ readonly control_relation: {
143
+ key: "identity";
144
+ statement: "semantic_user_review";
145
+ applicability_refs: "semantic_user_review";
146
+ control_refs: "semantic_user_review";
147
+ required_proof_surfaces: "proof_additive";
105
148
  };
106
149
  readonly surface_binding: {
107
150
  key: "identity";
@@ -127,12 +170,18 @@ export declare const AUTHORITY_FIELD_POLICY_REGISTRIES: {
127
170
  actual_artifact_path: "output_requirement";
128
171
  comparison_artifact_path: "output_requirement";
129
172
  };
173
+ readonly design_verification_binding: {
174
+ method: "proof_additive";
175
+ assertion_ref: "proof_additive";
176
+ evidence_artifacts: "output_requirement";
177
+ };
130
178
  readonly design_blocker: {
131
179
  key: "identity";
132
180
  status: "semantic_user_review";
133
181
  refs: "semantic_user_review";
134
182
  source_item_refs: "semantic_user_review";
135
183
  verification_methods: "proof_additive";
184
+ required_capabilities: "semantic_user_review";
136
185
  rationale: "semantic_user_review";
137
186
  };
138
187
  readonly outcome_technical: {
@@ -148,6 +197,7 @@ export declare const AUTHORITY_FIELD_POLICY_REGISTRIES: {
148
197
  key: "identity";
149
198
  statement: "semantic_user_review";
150
199
  required_proof_surfaces: "proof_additive";
200
+ applicability_refs: "semantic_user_review";
151
201
  };
152
202
  readonly binding: {
153
203
  key: "identity";
@@ -186,6 +236,7 @@ export declare const AUTHORITY_FIELD_POLICY_REGISTRIES: {
186
236
  key: "identity";
187
237
  criterion: "semantic_user_review";
188
238
  claims: "proof_additive";
239
+ applicability_ref: "proof_additive";
189
240
  observation: "proof_additive";
190
241
  evidence_capabilities: "proof_additive";
191
242
  operator: "proof_additive";
@@ -203,6 +254,7 @@ export declare const AUTHORITY_FIELD_POLICY_REGISTRIES: {
203
254
  };
204
255
  readonly population: {
205
256
  check_key: "proof_additive";
257
+ universe_binding_key: "proof_additive";
206
258
  claims: "proof_additive";
207
259
  observations: "proof_additive";
208
260
  exclusion_rules: "proof_additive";
@@ -214,6 +266,7 @@ export declare const AUTHORITY_FIELD_POLICY_REGISTRIES: {
214
266
  check_key: "proof_additive";
215
267
  mutation: "proof_additive";
216
268
  expected_assertion_failures: "proof_additive";
269
+ preserved_assertions: "proof_additive";
217
270
  };
218
271
  readonly global_counterfactual: {
219
272
  key: "identity";
@@ -222,6 +275,7 @@ export declare const AUTHORITY_FIELD_POLICY_REGISTRIES: {
222
275
  check_key: "proof_additive";
223
276
  mutation: "proof_additive";
224
277
  expected_assertion_failures: "proof_additive";
278
+ preserved_assertions: "proof_additive";
225
279
  };
226
280
  };
227
281
  export declare function projectFieldsByPolicy<T extends object>(value: T, policy: Record<keyof T, AuthorityFieldPolicy>, included: ReadonlySet<AuthorityFieldPolicy>): Partial<T>;