@gate-forge/core 0.1.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 (242) hide show
  1. package/LICENSE +202 -0
  2. package/dist/baselines/adoption.d.ts +76 -0
  3. package/dist/baselines/adoption.d.ts.map +1 -0
  4. package/dist/baselines/adoption.js +163 -0
  5. package/dist/baselines/adoption.js.map +1 -0
  6. package/dist/baselines/index.d.ts +102 -0
  7. package/dist/baselines/index.d.ts.map +1 -0
  8. package/dist/baselines/index.js +186 -0
  9. package/dist/baselines/index.js.map +1 -0
  10. package/dist/canonical-json.d.ts +51 -0
  11. package/dist/canonical-json.d.ts.map +1 -0
  12. package/dist/canonical-json.js +112 -0
  13. package/dist/canonical-json.js.map +1 -0
  14. package/dist/classifier/bind.d.ts +64 -0
  15. package/dist/classifier/bind.d.ts.map +1 -0
  16. package/dist/classifier/bind.js +188 -0
  17. package/dist/classifier/bind.js.map +1 -0
  18. package/dist/classifier/classify.d.ts +154 -0
  19. package/dist/classifier/classify.d.ts.map +1 -0
  20. package/dist/classifier/classify.js +1207 -0
  21. package/dist/classifier/classify.js.map +1 -0
  22. package/dist/classifier/glob.d.ts +48 -0
  23. package/dist/classifier/glob.d.ts.map +1 -0
  24. package/dist/classifier/glob.js +104 -0
  25. package/dist/classifier/glob.js.map +1 -0
  26. package/dist/classifier/index.d.ts +10 -0
  27. package/dist/classifier/index.d.ts.map +1 -0
  28. package/dist/classifier/index.js +21 -0
  29. package/dist/classifier/index.js.map +1 -0
  30. package/dist/classifier/schema.d.ts +150 -0
  31. package/dist/classifier/schema.d.ts.map +1 -0
  32. package/dist/classifier/schema.js +139 -0
  33. package/dist/classifier/schema.js.map +1 -0
  34. package/dist/config/index.d.ts +259 -0
  35. package/dist/config/index.d.ts.map +1 -0
  36. package/dist/config/index.js +523 -0
  37. package/dist/config/index.js.map +1 -0
  38. package/dist/fingerprints.d.ts +56 -0
  39. package/dist/fingerprints.d.ts.map +1 -0
  40. package/dist/fingerprints.js +59 -0
  41. package/dist/fingerprints.js.map +1 -0
  42. package/dist/graph/build.d.ts +16 -0
  43. package/dist/graph/build.d.ts.map +1 -0
  44. package/dist/graph/build.js +423 -0
  45. package/dist/graph/build.js.map +1 -0
  46. package/dist/graph/index.d.ts +12 -0
  47. package/dist/graph/index.d.ts.map +1 -0
  48. package/dist/graph/index.js +10 -0
  49. package/dist/graph/index.js.map +1 -0
  50. package/dist/graph/schema.d.ts +448 -0
  51. package/dist/graph/schema.d.ts.map +1 -0
  52. package/dist/graph/schema.js +237 -0
  53. package/dist/graph/schema.js.map +1 -0
  54. package/dist/graph/symbols.d.ts +129 -0
  55. package/dist/graph/symbols.d.ts.map +1 -0
  56. package/dist/graph/symbols.js +177 -0
  57. package/dist/graph/symbols.js.map +1 -0
  58. package/dist/graph/util.d.ts +40 -0
  59. package/dist/graph/util.d.ts.map +1 -0
  60. package/dist/graph/util.js +41 -0
  61. package/dist/graph/util.js.map +1 -0
  62. package/dist/index.d.ts +683 -0
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +563 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/mapping/resolve.d.ts +177 -0
  67. package/dist/mapping/resolve.d.ts.map +1 -0
  68. package/dist/mapping/resolve.js +523 -0
  69. package/dist/mapping/resolve.js.map +1 -0
  70. package/dist/policy/coverage.d.ts +79 -0
  71. package/dist/policy/coverage.d.ts.map +1 -0
  72. package/dist/policy/coverage.js +119 -0
  73. package/dist/policy/coverage.js.map +1 -0
  74. package/dist/policy/evaluate.d.ts +275 -0
  75. package/dist/policy/evaluate.d.ts.map +1 -0
  76. package/dist/policy/evaluate.js +382 -0
  77. package/dist/policy/evaluate.js.map +1 -0
  78. package/dist/policy/index.d.ts +15 -0
  79. package/dist/policy/index.d.ts.map +1 -0
  80. package/dist/policy/index.js +14 -0
  81. package/dist/policy/index.js.map +1 -0
  82. package/dist/policy/trusted.d.ts +59 -0
  83. package/dist/policy/trusted.d.ts.map +1 -0
  84. package/dist/policy/trusted.js +96 -0
  85. package/dist/policy/trusted.js.map +1 -0
  86. package/dist/provenance.d.ts +170 -0
  87. package/dist/provenance.d.ts.map +1 -0
  88. package/dist/provenance.js +306 -0
  89. package/dist/provenance.js.map +1 -0
  90. package/dist/receipt/index.d.ts +74 -0
  91. package/dist/receipt/index.d.ts.map +1 -0
  92. package/dist/receipt/index.js +154 -0
  93. package/dist/receipt/index.js.map +1 -0
  94. package/dist/report/index.d.ts +100 -0
  95. package/dist/report/index.d.ts.map +1 -0
  96. package/dist/report/index.js +355 -0
  97. package/dist/report/index.js.map +1 -0
  98. package/dist/schemas/adoption.d.ts +40 -0
  99. package/dist/schemas/adoption.d.ts.map +1 -0
  100. package/dist/schemas/adoption.js +87 -0
  101. package/dist/schemas/adoption.js.map +1 -0
  102. package/dist/schemas/baseline.d.ts +19 -0
  103. package/dist/schemas/baseline.d.ts.map +1 -0
  104. package/dist/schemas/baseline.js +45 -0
  105. package/dist/schemas/baseline.js.map +1 -0
  106. package/dist/schemas/claim.d.ts +32 -0
  107. package/dist/schemas/claim.d.ts.map +1 -0
  108. package/dist/schemas/claim.js +34 -0
  109. package/dist/schemas/claim.js.map +1 -0
  110. package/dist/schemas/classification-policy.d.ts +84 -0
  111. package/dist/schemas/classification-policy.d.ts.map +1 -0
  112. package/dist/schemas/classification-policy.js +130 -0
  113. package/dist/schemas/classification-policy.js.map +1 -0
  114. package/dist/schemas/classification-signal.d.ts +125 -0
  115. package/dist/schemas/classification-signal.d.ts.map +1 -0
  116. package/dist/schemas/classification-signal.js +126 -0
  117. package/dist/schemas/classification-signal.js.map +1 -0
  118. package/dist/schemas/classification.d.ts +120 -0
  119. package/dist/schemas/classification.d.ts.map +1 -0
  120. package/dist/schemas/classification.js +154 -0
  121. package/dist/schemas/classification.js.map +1 -0
  122. package/dist/schemas/common.d.ts +73 -0
  123. package/dist/schemas/common.d.ts.map +1 -0
  124. package/dist/schemas/common.js +60 -0
  125. package/dist/schemas/common.js.map +1 -0
  126. package/dist/schemas/coverage-policy.d.ts +89 -0
  127. package/dist/schemas/coverage-policy.d.ts.map +1 -0
  128. package/dist/schemas/coverage-policy.js +81 -0
  129. package/dist/schemas/coverage-policy.js.map +1 -0
  130. package/dist/schemas/evidence.d.ts +65 -0
  131. package/dist/schemas/evidence.d.ts.map +1 -0
  132. package/dist/schemas/evidence.js +64 -0
  133. package/dist/schemas/evidence.js.map +1 -0
  134. package/dist/schemas/execution-result.d.ts +214 -0
  135. package/dist/schemas/execution-result.d.ts.map +1 -0
  136. package/dist/schemas/execution-result.js +240 -0
  137. package/dist/schemas/execution-result.js.map +1 -0
  138. package/dist/schemas/gate-receipt.d.ts +86 -0
  139. package/dist/schemas/gate-receipt.d.ts.map +1 -0
  140. package/dist/schemas/gate-receipt.js +193 -0
  141. package/dist/schemas/gate-receipt.js.map +1 -0
  142. package/dist/schemas/index.d.ts +22 -0
  143. package/dist/schemas/index.d.ts.map +1 -0
  144. package/dist/schemas/index.js +22 -0
  145. package/dist/schemas/index.js.map +1 -0
  146. package/dist/schemas/obligation.d.ts +37 -0
  147. package/dist/schemas/obligation.d.ts.map +1 -0
  148. package/dist/schemas/obligation.js +46 -0
  149. package/dist/schemas/obligation.js.map +1 -0
  150. package/dist/schemas/plugin.d.ts +19 -0
  151. package/dist/schemas/plugin.d.ts.map +1 -0
  152. package/dist/schemas/plugin.js +20 -0
  153. package/dist/schemas/plugin.js.map +1 -0
  154. package/dist/schemas/policy.d.ts +73 -0
  155. package/dist/schemas/policy.d.ts.map +1 -0
  156. package/dist/schemas/policy.js +46 -0
  157. package/dist/schemas/policy.js.map +1 -0
  158. package/dist/schemas/resource.d.ts +26 -0
  159. package/dist/schemas/resource.d.ts.map +1 -0
  160. package/dist/schemas/resource.js +29 -0
  161. package/dist/schemas/resource.js.map +1 -0
  162. package/dist/schemas/run-manifest.d.ts +72 -0
  163. package/dist/schemas/run-manifest.d.ts.map +1 -0
  164. package/dist/schemas/run-manifest.js +125 -0
  165. package/dist/schemas/run-manifest.js.map +1 -0
  166. package/dist/schemas/runner-adapter.d.ts +169 -0
  167. package/dist/schemas/runner-adapter.d.ts.map +1 -0
  168. package/dist/schemas/runner-adapter.js +2 -0
  169. package/dist/schemas/runner-adapter.js.map +1 -0
  170. package/dist/schemas/test-catalog.d.ts +472 -0
  171. package/dist/schemas/test-catalog.d.ts.map +1 -0
  172. package/dist/schemas/test-catalog.js +311 -0
  173. package/dist/schemas/test-catalog.js.map +1 -0
  174. package/dist/schemas/test-map.d.ts +99 -0
  175. package/dist/schemas/test-map.d.ts.map +1 -0
  176. package/dist/schemas/test-map.js +103 -0
  177. package/dist/schemas/test-map.js.map +1 -0
  178. package/dist/schemas/verdict.d.ts +73 -0
  179. package/dist/schemas/verdict.d.ts.map +1 -0
  180. package/dist/schemas/verdict.js +92 -0
  181. package/dist/schemas/verdict.js.map +1 -0
  182. package/dist/schemas/waiver.d.ts +36 -0
  183. package/dist/schemas/waiver.d.ts.map +1 -0
  184. package/dist/schemas/waiver.js +42 -0
  185. package/dist/schemas/waiver.js.map +1 -0
  186. package/dist/supervision/index.d.ts +170 -0
  187. package/dist/supervision/index.d.ts.map +1 -0
  188. package/dist/supervision/index.js +354 -0
  189. package/dist/supervision/index.js.map +1 -0
  190. package/dist/testing/clock.d.ts +50 -0
  191. package/dist/testing/clock.d.ts.map +1 -0
  192. package/dist/testing/clock.js +75 -0
  193. package/dist/testing/clock.js.map +1 -0
  194. package/dist/testing/env.d.ts +66 -0
  195. package/dist/testing/env.d.ts.map +1 -0
  196. package/dist/testing/env.js +106 -0
  197. package/dist/testing/env.js.map +1 -0
  198. package/dist/testing/gate-runner.d.ts +141 -0
  199. package/dist/testing/gate-runner.d.ts.map +1 -0
  200. package/dist/testing/gate-runner.js +173 -0
  201. package/dist/testing/gate-runner.js.map +1 -0
  202. package/dist/testing/gf19.d.ts +106 -0
  203. package/dist/testing/gf19.d.ts.map +1 -0
  204. package/dist/testing/gf19.js +282 -0
  205. package/dist/testing/gf19.js.map +1 -0
  206. package/dist/testing/index.d.ts +20 -0
  207. package/dist/testing/index.d.ts.map +1 -0
  208. package/dist/testing/index.js +14 -0
  209. package/dist/testing/index.js.map +1 -0
  210. package/dist/testing/red-probe.d.ts +138 -0
  211. package/dist/testing/red-probe.d.ts.map +1 -0
  212. package/dist/testing/red-probe.js +251 -0
  213. package/dist/testing/red-probe.js.map +1 -0
  214. package/dist/testing/temp-repo.d.ts +126 -0
  215. package/dist/testing/temp-repo.d.ts.map +1 -0
  216. package/dist/testing/temp-repo.js +214 -0
  217. package/dist/testing/temp-repo.js.map +1 -0
  218. package/dist/verdict/cause.d.ts +99 -0
  219. package/dist/verdict/cause.d.ts.map +1 -0
  220. package/dist/verdict/cause.js +206 -0
  221. package/dist/verdict/cause.js.map +1 -0
  222. package/dist/verdict/evaluate.d.ts +135 -0
  223. package/dist/verdict/evaluate.d.ts.map +1 -0
  224. package/dist/verdict/evaluate.js +1513 -0
  225. package/dist/verdict/evaluate.js.map +1 -0
  226. package/dist/verdict/index.d.ts +21 -0
  227. package/dist/verdict/index.d.ts.map +1 -0
  228. package/dist/verdict/index.js +20 -0
  229. package/dist/verdict/index.js.map +1 -0
  230. package/dist/verdict/pack-verifiers.d.ts +97 -0
  231. package/dist/verdict/pack-verifiers.d.ts.map +1 -0
  232. package/dist/verdict/pack-verifiers.js +763 -0
  233. package/dist/verdict/pack-verifiers.js.map +1 -0
  234. package/dist/verdict/registry.d.ts +180 -0
  235. package/dist/verdict/registry.d.ts.map +1 -0
  236. package/dist/verdict/registry.js +67 -0
  237. package/dist/verdict/registry.js.map +1 -0
  238. package/dist/waivers/index.d.ts +103 -0
  239. package/dist/waivers/index.d.ts.map +1 -0
  240. package/dist/waivers/index.js +192 -0
  241. package/dist/waivers/index.js.map +1 -0
  242. package/package.json +40 -0
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Adoption record schema (phase 8 workstream C): the loud, one-time
3
+ * record of `gateforge adopt` — the ONLY sanctioned bulk-add of baseline
4
+ * fingerprints a repo will ever get. Lives beside the baseline as
5
+ * `.gateforge/baselines/adoption.json`.
6
+ *
7
+ * Sibling-FILE decision (deliberate, vs. an `adoptedAt` field on the
8
+ * baseline document): the baseline stays a pure
9
+ * `{schemaVersion, fingerprints}` set. Folding adoption metadata into it
10
+ * would (a) force every shrink — `baseline update` builds fresh
11
+ * documents via `updateBaseline` — to carry adoption fields forward,
12
+ * risking silent loss of the record on the first shrink, and (b) make
13
+ * the invariant "the bulk-add happened exactly once" rest on a field a
14
+ * hand-edit can delete to re-arm a second bulk-add. A separate record
15
+ * inverts that: the check gate honors a baseline ONLY when its adoption
16
+ * record is present and valid, so an unrecorded (or record-stripped)
17
+ * baseline forgives nothing — fail closed. Absent file = pre-adoption
18
+ * baseline (backward compatible with every repo initialized before this
19
+ * schema existed, including empty init skeletons).
20
+ */
21
+ import { z } from 'zod';
22
+ /**
23
+ * The classification layer's id list shape, NON-optional: the record
24
+ * field wraps this in `.optional()` (absent = pre-layer receipt), while
25
+ * the capture/shrink helpers validate against THIS schema so a present
26
+ * list is always a sorted, duplicate-free, non-empty-string array.
27
+ */
28
+ export declare const ClassificationBlockedIdsSchema: z.ZodArray<z.ZodString>;
29
+ /** The adoption record: who forgave how much, when, on what commit. */
30
+ export declare const AdoptionRecordSchema: z.ZodObject<{
31
+ schemaVersion: z.ZodLiteral<1>;
32
+ adoptedAt: z.ZodISODateTime;
33
+ gitSha: z.ZodNullable<z.ZodString>;
34
+ adopted: z.ZodNumber;
35
+ proven: z.ZodNumber;
36
+ classificationBlocked: z.ZodOptional<z.ZodArray<z.ZodString>>;
37
+ }, z.core.$strict>;
38
+ /** Inferred adoption-record shape. */
39
+ export type AdoptionRecord = z.infer<typeof AdoptionRecordSchema>;
40
+ //# sourceMappingURL=adoption.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adoption.d.ts","sourceRoot":"","sources":["../../src/schemas/adoption.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,yBAA6B,CAAC;AAEzE,uEAAuE;AACvE,eAAO,MAAM,oBAAoB;;;;;;;kBAuD7B,CAAC;AAEL,sCAAsC;AACtC,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Adoption record schema (phase 8 workstream C): the loud, one-time
3
+ * record of `gateforge adopt` — the ONLY sanctioned bulk-add of baseline
4
+ * fingerprints a repo will ever get. Lives beside the baseline as
5
+ * `.gateforge/baselines/adoption.json`.
6
+ *
7
+ * Sibling-FILE decision (deliberate, vs. an `adoptedAt` field on the
8
+ * baseline document): the baseline stays a pure
9
+ * `{schemaVersion, fingerprints}` set. Folding adoption metadata into it
10
+ * would (a) force every shrink — `baseline update` builds fresh
11
+ * documents via `updateBaseline` — to carry adoption fields forward,
12
+ * risking silent loss of the record on the first shrink, and (b) make
13
+ * the invariant "the bulk-add happened exactly once" rest on a field a
14
+ * hand-edit can delete to re-arm a second bulk-add. A separate record
15
+ * inverts that: the check gate honors a baseline ONLY when its adoption
16
+ * record is present and valid, so an unrecorded (or record-stripped)
17
+ * baseline forgives nothing — fail closed. Absent file = pre-adoption
18
+ * baseline (backward compatible with every repo initialized before this
19
+ * schema existed, including empty init skeletons).
20
+ */
21
+ import { z } from 'zod';
22
+ import { SchemaVersionField } from './common.js';
23
+ /**
24
+ * The classification layer's id list shape, NON-optional: the record
25
+ * field wraps this in `.optional()` (absent = pre-layer receipt), while
26
+ * the capture/shrink helpers validate against THIS schema so a present
27
+ * list is always a sorted, duplicate-free, non-empty-string array.
28
+ */
29
+ export const ClassificationBlockedIdsSchema = z.array(z.string().min(1));
30
+ /** The adoption record: who forgave how much, when, on what commit. */
31
+ export const AdoptionRecordSchema = z
32
+ .object({
33
+ schemaVersion: SchemaVersionField,
34
+ /** Adoption instant, ISO-8601, from the run's injected clock. */
35
+ adoptedAt: z.iso.datetime(),
36
+ /** HEAD sha of the adopting commit, or null outside a git repo. */
37
+ gitSha: z
38
+ .string()
39
+ .regex(/^[0-9a-f]{40}$/, 'gitSha must be a 40-char lowercase sha1 hex')
40
+ .nullable(),
41
+ /** Fingerprints written into the baseline as forgiven (bulk-add size). */
42
+ adopted: z.number().int().min(0),
43
+ /** Obligations already satisfied/waived at adoption time (context). */
44
+ proven: z.number().int().min(0),
45
+ /**
46
+ * The classification layer (two-layer adoption): resource ids that
47
+ * were classification-blocked ([classification] entries with a
48
+ * derived resource id — e.g. PLANE_UNRESOLVED) at adoption time and
49
+ * are adopted as the sanctioned starting point. OPTIONAL for
50
+ * backward compatibility: a receipt without the field was written by
51
+ * a pre-layer engine and is simply NOT ADOPTED for this layer — the
52
+ * check forgives nothing classification-shaped without it (fail
53
+ * closed). Present or absent, the set is SHRINK-ONLY: a resource
54
+ * leaves only through the explicit `baseline update` path once it
55
+ * carries a real classification; NEW blocked resources never enter.
56
+ */
57
+ classificationBlocked: ClassificationBlockedIdsSchema.optional(),
58
+ })
59
+ .strict()
60
+ .superRefine((record, ctx) => {
61
+ const ids = record.classificationBlocked;
62
+ if (ids === undefined)
63
+ return;
64
+ const sorted = [...ids].sort();
65
+ for (let index = 0; index < ids.length; index += 1) {
66
+ const current = ids[index];
67
+ const expected = sorted[index];
68
+ if (current !== expected) {
69
+ ctx.addIssue({
70
+ code: 'custom',
71
+ path: ['classificationBlocked', index],
72
+ message: "classificationBlocked must be sorted; expected '" + expected +
73
+ "' at index " + index + ", got '" + current + "'",
74
+ });
75
+ break;
76
+ }
77
+ if (index > 0 && current === ids[index - 1]) {
78
+ ctx.addIssue({
79
+ code: 'custom',
80
+ path: ['classificationBlocked', index],
81
+ message: `duplicate classification-blocked resource id '${current}'`,
82
+ });
83
+ break;
84
+ }
85
+ }
86
+ });
87
+ //# sourceMappingURL=adoption.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adoption.js","sourceRoot":"","sources":["../../src/schemas/adoption.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzE,uEAAuE;AACvE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAClC,MAAM,CAAC;IACN,aAAa,EAAE,kBAAkB;IACjC,iEAAiE;IACjE,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;IAC3B,mEAAmE;IACnE,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,KAAK,CAAC,gBAAgB,EAAE,6CAA6C,CAAC;SACtE,QAAQ,EAAE;IACb,0EAA0E;IAC1E,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,uEAAuE;IACvE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/B;;;;;;;;;;;OAWG;IACH,qBAAqB,EAAE,8BAA8B,CAAC,QAAQ,EAAE;CACjE,CAAC;KACD,MAAM,EAAE;KACR,WAAW,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;IAC3B,MAAM,GAAG,GAAG,MAAM,CAAC,qBAAqB,CAAC;IACzC,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO;IAC9B,MAAM,MAAM,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACnD,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;QAC3B,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/B,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;YACzB,GAAG,CAAC,QAAQ,CAAC;gBACX,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,uBAAuB,EAAE,KAAK,CAAC;gBACtC,OAAO,EACL,kDAAkD,GAAG,QAAQ;oBAC7D,aAAa,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,GAAG;aACpD,CAAC,CAAC;YACH,MAAM;QACR,CAAC;QACD,IAAI,KAAK,GAAG,CAAC,IAAI,OAAO,KAAK,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;YAC5C,GAAG,CAAC,QAAQ,CAAC;gBACX,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,uBAAuB,EAAE,KAAK,CAAC;gBACtC,OAAO,EAAE,iDAAiD,OAAO,GAAG;aACrE,CAAC,CAAC;YACH,MAAM;QACR,CAAC;IACH,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Baseline schema (pin #3): `.gateforge/baselines/obligations.json`.
3
+ * Baselines store obligation fingerprints (pin #2) and may only ever
4
+ * SHRINK to a strict subset (invariant 4) — the update command enforces
5
+ * that; this schema enforces the on-disk shape and ordering.
6
+ */
7
+ import { z } from 'zod';
8
+ /** A single obligation fingerprint: 64-char lowercase sha256 hex. */
9
+ export declare const FingerprintHexSchema: z.ZodString;
10
+ /** Inferred fingerprint-hex shape. */
11
+ export type FingerprintHex = z.infer<typeof FingerprintHexSchema>;
12
+ /** The baseline document: known-forgiven obligation fingerprints. */
13
+ export declare const BaselineSchema: z.ZodObject<{
14
+ schemaVersion: z.ZodLiteral<1>;
15
+ fingerprints: z.ZodArray<z.ZodString>;
16
+ }, z.core.$strict>;
17
+ /** Inferred baseline-document shape. */
18
+ export type Baseline = z.infer<typeof BaselineSchema>;
19
+ //# sourceMappingURL=baseline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline.d.ts","sourceRoot":"","sources":["../../src/schemas/baseline.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,qEAAqE;AACrE,eAAO,MAAM,oBAAoB,aAE+C,CAAC;AAEjF,sCAAsC;AACtC,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,qEAAqE;AACrE,eAAO,MAAM,cAAc;;;kBA+BvB,CAAC;AAEL,wCAAwC;AACxC,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Baseline schema (pin #3): `.gateforge/baselines/obligations.json`.
3
+ * Baselines store obligation fingerprints (pin #2) and may only ever
4
+ * SHRINK to a strict subset (invariant 4) — the update command enforces
5
+ * that; this schema enforces the on-disk shape and ordering.
6
+ */
7
+ import { z } from 'zod';
8
+ import { SchemaVersionField } from './common.js';
9
+ /** A single obligation fingerprint: 64-char lowercase sha256 hex. */
10
+ export const FingerprintHexSchema = z
11
+ .string()
12
+ .regex(/^[0-9a-f]{64}$/, 'fingerprint must be a 64-char lowercase sha256 hex');
13
+ /** The baseline document: known-forgiven obligation fingerprints. */
14
+ export const BaselineSchema = z
15
+ .object({
16
+ schemaVersion: SchemaVersionField,
17
+ /** Sorted, duplicate-free fingerprint list. */
18
+ fingerprints: z.array(FingerprintHexSchema),
19
+ })
20
+ .strict()
21
+ .superRefine((baseline, ctx) => {
22
+ const sorted = [...baseline.fingerprints].sort();
23
+ for (let index = 0; index < baseline.fingerprints.length; index += 1) {
24
+ const current = baseline.fingerprints[index];
25
+ const expected = sorted[index];
26
+ if (current !== expected) {
27
+ ctx.addIssue({
28
+ code: 'custom',
29
+ path: ['fingerprints', index],
30
+ message: "fingerprints must be sorted; expected '" + expected +
31
+ "' at index " + index + ", got '" + current + "'",
32
+ });
33
+ break;
34
+ }
35
+ if (index > 0 && current === baseline.fingerprints[index - 1]) {
36
+ ctx.addIssue({
37
+ code: 'custom',
38
+ path: ['fingerprints', index],
39
+ message: `duplicate fingerprint '${current}'`,
40
+ });
41
+ break;
42
+ }
43
+ }
44
+ });
45
+ //# sourceMappingURL=baseline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline.js","sourceRoot":"","sources":["../../src/schemas/baseline.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,qEAAqE;AACrE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAClC,MAAM,EAAE;KACR,KAAK,CAAC,gBAAgB,EAAE,oDAAoD,CAAC,CAAC;AAKjF,qEAAqE;AACrE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC;KAC5B,MAAM,CAAC;IACN,aAAa,EAAE,kBAAkB;IACjC,+CAA+C;IAC/C,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;CAC5C,CAAC;KACD,MAAM,EAAE;KACR,WAAW,CAAC,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE;IAC7B,MAAM,MAAM,GAAG,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE,CAAC;IACjD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACrE,MAAM,OAAO,GAAG,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAC7C,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/B,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;YACzB,GAAG,CAAC,QAAQ,CAAC;gBACX,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,cAAc,EAAE,KAAK,CAAC;gBAC7B,OAAO,EACL,yCAAyC,GAAG,QAAQ;oBACpD,aAAa,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,GAAG;aACpD,CAAC,CAAC;YACH,MAAM;QACR,CAAC;QACD,IAAI,KAAK,GAAG,CAAC,IAAI,OAAO,KAAK,QAAQ,CAAC,YAAY,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;YAC9D,GAAG,CAAC,QAAQ,CAAC;gBACX,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,cAAc,EAAE,KAAK,CAAC;gBAC7B,OAAO,EAAE,0BAA0B,OAAO,GAAG;aAC9C,CAAC,CAAC;YACH,MAAM;QACR,CAAC;IACH,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Claim schema (plan §4.6): a test's declaration that it covers an
3
+ * obligation, expressed via native framework metadata (e.g. a Playwright
4
+ * annotation `{type: 'gateforge', description: '<obligation id>'}`).
5
+ *
6
+ * A claim is NOT proof (invariant 2) — it only links a test to an
7
+ * obligation so the verifier knows which evidence to gather.
8
+ */
9
+ import { z } from 'zod';
10
+ /**
11
+ * Obligation reference `<resourceId>:<contract>`: resourceId carries no
12
+ * colon, contract may (e.g. `crud:update`), so the id splits at the
13
+ * FIRST colon.
14
+ */
15
+ export declare const ObligationIdSchema: z.ZodString;
16
+ /** Inferred obligation-id shape. */
17
+ export type ObligationId = z.infer<typeof ObligationIdSchema>;
18
+ /** A test's declared coverage of one obligation. */
19
+ export declare const ClaimSchema: z.ZodObject<{
20
+ schemaVersion: z.ZodLiteral<1>;
21
+ obligationId: z.ZodString;
22
+ testId: z.ZodString;
23
+ testFile: z.ZodOptional<z.ZodString>;
24
+ location: z.ZodOptional<z.ZodObject<{
25
+ file: z.ZodString;
26
+ line: z.ZodNumber;
27
+ col: z.ZodNumber;
28
+ }, z.core.$strict>>;
29
+ }, z.core.$strict>;
30
+ /** Inferred claim shape. */
31
+ export type Claim = z.infer<typeof ClaimSchema>;
32
+ //# sourceMappingURL=claim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim.d.ts","sourceRoot":"","sources":["../../src/schemas/claim.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,aAM5B,CAAC;AAEJ,oCAAoC;AACpC,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,oDAAoD;AACpD,eAAO,MAAM,WAAW;;;;;;;;;;kBAYb,CAAC;AAEZ,4BAA4B;AAC5B,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Claim schema (plan §4.6): a test's declaration that it covers an
3
+ * obligation, expressed via native framework metadata (e.g. a Playwright
4
+ * annotation `{type: 'gateforge', description: '<obligation id>'}`).
5
+ *
6
+ * A claim is NOT proof (invariant 2) — it only links a test to an
7
+ * obligation so the verifier knows which evidence to gather.
8
+ */
9
+ import { z } from 'zod';
10
+ import { LocationSchema, SchemaVersionField } from './common.js';
11
+ /**
12
+ * Obligation reference `<resourceId>:<contract>`: resourceId carries no
13
+ * colon, contract may (e.g. `crud:update`), so the id splits at the
14
+ * FIRST colon.
15
+ */
16
+ export const ObligationIdSchema = z
17
+ .string()
18
+ .min(1)
19
+ .regex(/^[^:]+:.+$/, "obligation id must match '<resourceId>:<contract>' (split at the first colon)");
20
+ /** A test's declared coverage of one obligation. */
21
+ export const ClaimSchema = z
22
+ .object({
23
+ schemaVersion: SchemaVersionField,
24
+ /** The obligation this test claims to cover. */
25
+ obligationId: ObligationIdSchema,
26
+ /** Stable test identifier (framework test id or full title). */
27
+ testId: z.string().min(1),
28
+ /** File the test lives in, when the framework provides it. */
29
+ testFile: z.string().min(1).optional(),
30
+ /** Source location of the test declaration, when available. */
31
+ location: LocationSchema.optional(),
32
+ })
33
+ .strict();
34
+ //# sourceMappingURL=claim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim.js","sourceRoot":"","sources":["../../src/schemas/claim.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjE;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,KAAK,CACJ,YAAY,EACZ,+EAA+E,CAChF,CAAC;AAKJ,oDAAoD;AACpD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC;KACzB,MAAM,CAAC;IACN,aAAa,EAAE,kBAAkB;IACjC,gDAAgD;IAChD,YAAY,EAAE,kBAAkB;IAChC,gEAAgE;IAChE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,8DAA8D;IAC9D,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACtC,+DAA+D;IAC/D,QAAQ,EAAE,cAAc,CAAC,QAAQ,EAAE;CACpC,CAAC;KACD,MAAM,EAAE,CAAC"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * `classification-policy.yml` schema (ADR 0003 D5): the repository-wide
3
+ * deterministic rules replacing hand-authored per-resource
4
+ * classifications. The policy never decides anything by itself — it is
5
+ * one INPUT to the classifier lattice, and organization internal rules
6
+ * are certificate-checked like declarations (a matching name rule alone
7
+ * NEVER proves internality, ADR 0003 D2 exposure rule 3).
8
+ */
9
+ import { z } from 'zod';
10
+ /** One trusted internal entry-point category (worker, migration, …). */
11
+ export declare const InternalEntryPointCategorySchema: z.ZodObject<{
12
+ category: z.ZodString;
13
+ patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
14
+ detector: z.ZodOptional<z.ZodString>;
15
+ }, z.core.$strict>;
16
+ /** Inferred internal entry-point category shape. */
17
+ export type InternalEntryPointCategory = z.infer<typeof InternalEntryPointCategorySchema>;
18
+ /** Match keys an organization internal rule can scope itself by. */
19
+ export declare const InternalRuleMatchSchema: z.ZodObject<{
20
+ resourceName: z.ZodOptional<z.ZodString>;
21
+ resourceKind: z.ZodOptional<z.ZodString>;
22
+ }, z.core.$strict>;
23
+ /** Inferred internal-rule match shape. */
24
+ export type InternalRuleMatch = z.infer<typeof InternalRuleMatchSchema>;
25
+ /** One organization internal rule — an input to the certificate, not an override. */
26
+ export declare const InternalRuleSchema: z.ZodObject<{
27
+ match: z.ZodObject<{
28
+ resourceName: z.ZodOptional<z.ZodString>;
29
+ resourceKind: z.ZodOptional<z.ZodString>;
30
+ }, z.core.$strict>;
31
+ reason: z.ZodString;
32
+ }, z.core.$strict>;
33
+ /** Inferred internal-rule shape. */
34
+ export type InternalRule = z.infer<typeof InternalRuleSchema>;
35
+ /**
36
+ * One coverage requirement (red-team round 3): the named detector must
37
+ * report examining every applicable file for a scan to count as COMPLETE.
38
+ * Coverage is per-detector by capability — never a flattened union
39
+ * (a detector that cannot see routes reading a file proves nothing about
40
+ * route coverage). A rule naming a detector that is not configured, or
41
+ * that does not report coverage, fails the attestation — so removing a
42
+ * required detector from the config cannot silently pass a closed-world
43
+ * proof.
44
+ */
45
+ export declare const CoverageRuleSchema: z.ZodObject<{
46
+ capability: z.ZodString;
47
+ detector: z.ZodString;
48
+ appliesTo: z.ZodArray<z.ZodString>;
49
+ exhaustive: z.ZodOptional<z.ZodBoolean>;
50
+ }, z.core.$strict>;
51
+ /** Inferred coverage-rule shape. */
52
+ export type CoverageRule = z.infer<typeof CoverageRuleSchema>;
53
+ /**
54
+ * The classification-policy document: scan roots (complete-scan scope),
55
+ * trusted internal entry-point categories, organization internal rules,
56
+ * the supported source declaration syntax, and volatile fields.
57
+ */
58
+ export declare const ClassificationPolicySchema: z.ZodObject<{
59
+ schemaVersion: z.ZodLiteral<1>;
60
+ scanRoots: z.ZodArray<z.ZodString>;
61
+ trustedInternalEntryPoints: z.ZodArray<z.ZodObject<{
62
+ category: z.ZodString;
63
+ patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
64
+ detector: z.ZodOptional<z.ZodString>;
65
+ }, z.core.$strict>>;
66
+ internalRules: z.ZodArray<z.ZodObject<{
67
+ match: z.ZodObject<{
68
+ resourceName: z.ZodOptional<z.ZodString>;
69
+ resourceKind: z.ZodOptional<z.ZodString>;
70
+ }, z.core.$strict>;
71
+ reason: z.ZodString;
72
+ }, z.core.$strict>>;
73
+ coverage: z.ZodOptional<z.ZodArray<z.ZodObject<{
74
+ capability: z.ZodString;
75
+ detector: z.ZodString;
76
+ appliesTo: z.ZodArray<z.ZodString>;
77
+ exhaustive: z.ZodOptional<z.ZodBoolean>;
78
+ }, z.core.$strict>>>;
79
+ declarations: z.ZodRecord<z.ZodString, z.ZodString>;
80
+ volatileFields: z.ZodArray<z.ZodString>;
81
+ }, z.core.$strict>;
82
+ /** Inferred classification-policy shape. */
83
+ export type ClassificationPolicy = z.infer<typeof ClassificationPolicySchema>;
84
+ //# sourceMappingURL=classification-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classification-policy.d.ts","sourceRoot":"","sources":["../../src/schemas/classification-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,wEAAwE;AACxE,eAAO,MAAM,gCAAgC;;;;kBAmBlC,CAAC;AAEZ,oDAAoD;AACpD,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAE1F,oEAAoE;AACpE,eAAO,MAAM,uBAAuB;;;kBAUhC,CAAC;AAEL,0CAA0C;AAC1C,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,qFAAqF;AACrF,eAAO,MAAM,kBAAkB;;;;;;kBAOpB,CAAC;AAEZ,oCAAoC;AACpC,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB;;;;;kBAyBpB,CAAC;AAEZ,oCAAoC;AACpC,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;kBAmC5B,CAAC;AAEZ,4CAA4C;AAC5C,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * `classification-policy.yml` schema (ADR 0003 D5): the repository-wide
3
+ * deterministic rules replacing hand-authored per-resource
4
+ * classifications. The policy never decides anything by itself — it is
5
+ * one INPUT to the classifier lattice, and organization internal rules
6
+ * are certificate-checked like declarations (a matching name rule alone
7
+ * NEVER proves internality, ADR 0003 D2 exposure rule 3).
8
+ */
9
+ import { z } from 'zod';
10
+ import { SchemaVersionField } from './common.js';
11
+ /** One trusted internal entry-point category (worker, migration, …). */
12
+ export const InternalEntryPointCategorySchema = z
13
+ .object({
14
+ /** Stable category name signals assert, e.g. `worker`. */
15
+ category: z.string().min(1),
16
+ /**
17
+ * Repo-root-relative glob patterns files of this category live in
18
+ * (advisory; detectors categorize, the classifier checks the name).
19
+ */
20
+ patterns: z.array(z.string().min(1)).optional(),
21
+ /**
22
+ * The ONLY bundled detector allowed to assert this category's
23
+ * reachability (red-team round 5). Reachability evidence is
24
+ * load-bearing for the internality certificate — suppressive in
25
+ * effect — so it is accepted only from this detector, only at
26
+ * locations the detector's own coverage report includes. Absent ⇒
27
+ * no plugin may assert the category (reachability unavailable).
28
+ */
29
+ detector: z.string().min(1).optional(),
30
+ })
31
+ .strict();
32
+ /** Match keys an organization internal rule can scope itself by. */
33
+ export const InternalRuleMatchSchema = z
34
+ .object({
35
+ /** Glob over the bare resource name (e.g. `*_audit`). Name rules alone are NOT proof. */
36
+ resourceName: z.string().min(1).optional(),
37
+ /** Exact detector kind the rule applies to (e.g. `sqlalchemy.table`). */
38
+ resourceKind: z.string().min(1).optional(),
39
+ })
40
+ .strict()
41
+ .refine((match) => match.resourceName !== undefined || match.resourceKind !== undefined, {
42
+ message: 'internal rule must match on at least one of resourceName / resourceKind',
43
+ });
44
+ /** One organization internal rule — an input to the certificate, not an override. */
45
+ export const InternalRuleSchema = z
46
+ .object({
47
+ /** What the rule matches. */
48
+ match: InternalRuleMatchSchema,
49
+ /** Why the organization classifies these resources internal (rendered in traces). */
50
+ reason: z.string().min(1),
51
+ })
52
+ .strict();
53
+ /**
54
+ * One coverage requirement (red-team round 3): the named detector must
55
+ * report examining every applicable file for a scan to count as COMPLETE.
56
+ * Coverage is per-detector by capability — never a flattened union
57
+ * (a detector that cannot see routes reading a file proves nothing about
58
+ * route coverage). A rule naming a detector that is not configured, or
59
+ * that does not report coverage, fails the attestation — so removing a
60
+ * required detector from the config cannot silently pass a closed-world
61
+ * proof.
62
+ */
63
+ export const CoverageRuleSchema = z
64
+ .object({
65
+ /**
66
+ * The capability this rule grants over its files, e.g.
67
+ * `exposure.http`. Negative proofs are capability-scoped: a
68
+ * closed-world EXPOSURE proof requires every requested file to be
69
+ * covered by an `exposure.*` rule. A rule without an exposure
70
+ * capability (model discovery, task linkage, …) can never serve an
71
+ * exposure negative proof, whatever it scanned.
72
+ */
73
+ capability: z.string().min(1),
74
+ /** Plugin id of the detector whose coverage is required. */
75
+ detector: z.string().min(1),
76
+ /** Repo-root-relative globs: the files this detector must examine. */
77
+ appliesTo: z.array(z.string().min(1)).min(1),
78
+ /**
79
+ * Declares the detector an EXHAUSTIVE parser for the capability over
80
+ * these files — an organization assertion the engine enforces as
81
+ * written (bundled detector, reported coverage). Only exhaustive
82
+ * rules may serve negative proofs. A regex heuristic must NOT be
83
+ * declared exhaustive; without an exhaustive exposure rule, internality
84
+ * stays unavailable for the scope (red-team round 6).
85
+ */
86
+ exhaustive: z.boolean().optional(),
87
+ })
88
+ .strict();
89
+ /**
90
+ * The classification-policy document: scan roots (complete-scan scope),
91
+ * trusted internal entry-point categories, organization internal rules,
92
+ * the supported source declaration syntax, and volatile fields.
93
+ */
94
+ export const ClassificationPolicySchema = z
95
+ .object({
96
+ schemaVersion: SchemaVersionField,
97
+ /**
98
+ * Repo-root-relative globs defining the scope a closed-world proof
99
+ * must cover. A non-empty list is the prerequisite of every
100
+ * complete-scan attestation (ADR 0003 D4); findings or unresolved
101
+ * entries inside these roots invalidate the attestation.
102
+ */
103
+ scanRoots: z.array(z.string().min(1)).min(1),
104
+ /** Entry-point categories counted as trusted-internal reachability. */
105
+ trustedInternalEntryPoints: z.array(InternalEntryPointCategorySchema),
106
+ /** Organization internal rules — certificate inputs, never overrides. */
107
+ internalRules: z.array(InternalRuleSchema),
108
+ /**
109
+ * Coverage requirements for COMPLETE-scan proofs (ADR 0003 D4). A
110
+ * closed-world attestation holds only when every rule's detector is
111
+ * configured, reports coverage, and covers every applicable requested
112
+ * file. Declaring none means no scan is provably complete — closed-
113
+ * world proofs stay unavailable (fail closed).
114
+ */
115
+ coverage: z.array(CoverageRuleSchema).optional(),
116
+ /**
117
+ * Supported source declaration syntax: the machine-readable keys
118
+ * detectors may translate into declaration signals (e.g.
119
+ * `internality: 'gateforge:internal'`). Declarations are assertions
120
+ * consumed by the classifier — contradictory code signals still block.
121
+ */
122
+ declarations: z.record(z.string(), z.string().min(1)),
123
+ /**
124
+ * Bookkeeping columns that never satisfy an update by themselves
125
+ * (mirrors the verdict engine's `updateableFields` fail-closed rule).
126
+ */
127
+ volatileFields: z.array(z.string().min(1)),
128
+ })
129
+ .strict();
130
+ //# sourceMappingURL=classification-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classification-policy.js","sourceRoot":"","sources":["../../src/schemas/classification-policy.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Classification-signal schemas (ADR 0003 D1): the framework-neutral
3
+ * evidence contract detectors emit so core can classify resources
4
+ * automatically. A signal is a FACT — source-located, detector-versioned,
5
+ * basis-typed — never a classification and never authoritative. Core's
6
+ * deterministic rule lattice (ADR 0003 D2) turns signals into decisions.
7
+ *
8
+ * Anti-pattern guards encoded here:
9
+ * - no confidence score field (a signal has a `basis`, not a probability);
10
+ * - every signal must carry a `Location` and a detector identity;
11
+ * - `code-negative-closed-world` names the only basis allowed to
12
+ * suppress, and the classifier additionally demands a complete-scan
13
+ * attestation before honoring it.
14
+ */
15
+ import { z } from 'zod';
16
+ /** What a signal addresses: bare name, plane-qualified id, or symbol. */
17
+ export declare const SignalTargetSchema: z.ZodObject<{
18
+ resourceName: z.ZodOptional<z.ZodString>;
19
+ resourceId: z.ZodOptional<z.ZodString>;
20
+ symbol: z.ZodOptional<z.ZodString>;
21
+ }, z.core.$strict>;
22
+ /** Inferred signal-target shape. */
23
+ export type SignalTarget = z.infer<typeof SignalTargetSchema>;
24
+ /** Every classification dimension a signal can speak about. */
25
+ export declare const SIGNAL_DIMENSIONS: readonly ["exposure", "plane", "identity", "lifecycle.create", "lifecycle.read", "lifecycle.update", "lifecycle.delete", "delete-semantics", "archive-state", "adapter-binding", "internality"];
26
+ /** Union of signal dimensions. */
27
+ export type SignalDimension = (typeof SIGNAL_DIMENSIONS)[number];
28
+ export declare const SignalDimensionSchema: z.ZodEnum<{
29
+ exposure: "exposure";
30
+ plane: "plane";
31
+ identity: "identity";
32
+ "lifecycle.create": "lifecycle.create";
33
+ "lifecycle.read": "lifecycle.read";
34
+ "lifecycle.update": "lifecycle.update";
35
+ "lifecycle.delete": "lifecycle.delete";
36
+ "delete-semantics": "delete-semantics";
37
+ "archive-state": "archive-state";
38
+ "adapter-binding": "adapter-binding";
39
+ internality: "internality";
40
+ }>;
41
+ /**
42
+ * The evidence basis of a signal (ADR 0003 D1). Only
43
+ * `code-negative-closed-world` may ever suppress obligations, and only
44
+ * when the classifier's complete-scan attestation holds.
45
+ */
46
+ export declare const SignalBasisSchema: z.ZodEnum<{
47
+ "code-positive": "code-positive";
48
+ "code-negative-closed-world": "code-negative-closed-world";
49
+ declaration: "declaration";
50
+ "organization-policy": "organization-policy";
51
+ }>;
52
+ /** Inferred signal-basis type. */
53
+ export type SignalBasis = z.infer<typeof SignalBasisSchema>;
54
+ /**
55
+ * Dimension-typed assertion payload: `exposure`/`internality` carry a
56
+ * boolean or category string, `plane` a plane name, `identity` the
57
+ * ORDERED primary-key columns, `delete-semantics` `hard|archive`,
58
+ * `archive-state` the owner-owned archived field values, lifecycle
59
+ * dimensions a boolean.
60
+ */
61
+ export declare const SignalAssertionSchema: z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>;
62
+ /** Inferred signal-assertion type. */
63
+ export type SignalAssertion = z.infer<typeof SignalAssertionSchema>;
64
+ /**
65
+ * One classification signal (ADR 0003 D1). Strict: unknown fields are
66
+ * detector bugs and must fail validation, not ride along.
67
+ */
68
+ export declare const ClassificationSignalSchema: z.ZodObject<{
69
+ schemaVersion: z.ZodLiteral<1>;
70
+ target: z.ZodObject<{
71
+ resourceName: z.ZodOptional<z.ZodString>;
72
+ resourceId: z.ZodOptional<z.ZodString>;
73
+ symbol: z.ZodOptional<z.ZodString>;
74
+ }, z.core.$strict>;
75
+ dimension: z.ZodEnum<{
76
+ exposure: "exposure";
77
+ plane: "plane";
78
+ identity: "identity";
79
+ "lifecycle.create": "lifecycle.create";
80
+ "lifecycle.read": "lifecycle.read";
81
+ "lifecycle.update": "lifecycle.update";
82
+ "lifecycle.delete": "lifecycle.delete";
83
+ "delete-semantics": "delete-semantics";
84
+ "archive-state": "archive-state";
85
+ "adapter-binding": "adapter-binding";
86
+ internality: "internality";
87
+ }>;
88
+ assertion: z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>;
89
+ basis: z.ZodEnum<{
90
+ "code-positive": "code-positive";
91
+ "code-negative-closed-world": "code-negative-closed-world";
92
+ declaration: "declaration";
93
+ "organization-policy": "organization-policy";
94
+ }>;
95
+ source: z.ZodString;
96
+ location: z.ZodObject<{
97
+ file: z.ZodString;
98
+ line: z.ZodNumber;
99
+ col: z.ZodNumber;
100
+ }, z.core.$strict>;
101
+ detector: z.ZodObject<{
102
+ id: z.ZodString;
103
+ version: z.ZodString;
104
+ }, z.core.$strict>;
105
+ }, z.core.$strict>;
106
+ /** Inferred classification-signal shape. */
107
+ export type ClassificationSignal = z.infer<typeof ClassificationSignalSchema>;
108
+ /**
109
+ * Canonical signal identity (ADR 0003 D1): sha256 over the GF-canonical
110
+ * JSON of the full signal document. Any change of location, assertion,
111
+ * basis, or detector version changes the id — which is what makes
112
+ * `decisionFingerprint`s stale-aware (plan goal 8).
113
+ *
114
+ * Args:
115
+ * signal: a validated classification signal.
116
+ *
117
+ * Returns:
118
+ * string: 64-char lowercase sha256 hex.
119
+ */
120
+ export declare function signalId(signal: ClassificationSignal): string;
121
+ /**
122
+ * The plane-assertion payload narrowed, for signals that assert a plane.
123
+ */
124
+ export declare function planeAssertion(signal: ClassificationSignal): string | null;
125
+ //# sourceMappingURL=classification-signal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classification-signal.d.ts","sourceRoot":"","sources":["../../src/schemas/classification-signal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,yEAAyE;AACzE,eAAO,MAAM,kBAAkB;;;;kBASpB,CAAC;AAEZ,oCAAoC;AACpC,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,+DAA+D;AAC/D,eAAO,MAAM,iBAAiB,iMAYpB,CAAC;AAEX,kCAAkC;AAClC,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAA4B,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;EAK5B,CAAC;AAEH,kCAAkC;AAClC,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,oKAKhC,CAAC;AAEH,sCAAsC;AACtC,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA6B5B,CAAC;AAEZ,4CAA4C;AAC5C,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAE7D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,GAAG,IAAI,CAI1E"}