iterate-kernel 0.1.3 → 0.1.5
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.
- package/README.md +15 -6
- package/dist/convergence.d.ts +90 -0
- package/dist/convergence.d.ts.map +1 -0
- package/dist/convergence.js +97 -0
- package/dist/convergence.js.map +1 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +7 -0
- package/dist/errors.js.map +1 -1
- package/dist/evidence-pack.d.ts +19 -19
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/invariant-report.d.ts +271 -0
- package/dist/invariant-report.d.ts.map +1 -0
- package/dist/invariant-report.js +145 -0
- package/dist/invariant-report.js.map +1 -0
- package/dist/parse.d.ts +9 -0
- package/dist/parse.d.ts.map +1 -1
- package/dist/parse.js +22 -10
- package/dist/parse.js.map +1 -1
- package/dist/provider-registration.d.ts +132 -0
- package/dist/provider-registration.d.ts.map +1 -0
- package/dist/provider-registration.js +119 -0
- package/dist/provider-registration.js.map +1 -0
- package/dist/run-plan.d.ts +142 -0
- package/dist/run-plan.d.ts.map +1 -0
- package/dist/run-plan.js +92 -0
- package/dist/run-plan.js.map +1 -0
- package/dist/schemas.d.ts +10 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +10 -0
- package/dist/schemas.js.map +1 -1
- package/fixtures/convergence.ok-01.json +252 -0
- package/fixtures/invariant-report.ok-01.json +306 -0
- package/fixtures/provider-registration.ok-01.json +309 -0
- package/fixtures/run-plan.ok-01.json +152 -0
- package/package.json +17 -1
- package/schemas/convergence-round-state.schema.json +37 -0
- package/schemas/invariant-report.schema.json +108 -0
- package/schemas/provider-registration.schema.json +63 -0
- package/schemas/reverification-request.schema.json +89 -0
- package/schemas/run-plan.schema.json +60 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* The AE-provider registration contract (5.7 R40 scenario 5): a judgement producer
|
|
4
|
+
* registers once, and both harnesses consume it through the same shape.
|
|
5
|
+
*
|
|
6
|
+
* Why this is in the kernel rather than in each product: the alternative is two
|
|
7
|
+
* registries that describe the same provider differently, and the first time they
|
|
8
|
+
* disagree the run keeps going with whichever one happened to be consulted. The
|
|
9
|
+
* registration is metadata — who provides what, and what they need to do it — never
|
|
10
|
+
* the judgement itself, which stays in the engine and the reviewers.
|
|
11
|
+
*/
|
|
12
|
+
export declare const PROVIDER_SCHEMA_VERSION: "iterate.provider/0.1";
|
|
13
|
+
export declare const PROVIDER_ID_PATTERN: RegExp;
|
|
14
|
+
export declare const PROVIDER_ID_MAX_LENGTH = 64;
|
|
15
|
+
export declare const PROVIDER_METHOD_MAX = 32;
|
|
16
|
+
export declare const ProviderKindSchema: z.ZodEnum<["ae-diagnosis", "report-render", "evidence-source"]>;
|
|
17
|
+
export type ProviderKind = z.infer<typeof ProviderKindSchema>;
|
|
18
|
+
export declare const ProviderMethodSchema: z.ZodObject<{
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
/**
|
|
21
|
+
* What this method needs to run: capability names, not booleans per capability,
|
|
22
|
+
* so adding one does not require widening a schema on both sides. An empty list
|
|
23
|
+
* means "no prerequisites", which is a claim the provider has to make.
|
|
24
|
+
*/
|
|
25
|
+
requires: z.ZodArray<z.ZodString, "many">;
|
|
26
|
+
}, "strict", z.ZodTypeAny, {
|
|
27
|
+
name: string;
|
|
28
|
+
requires: string[];
|
|
29
|
+
}, {
|
|
30
|
+
name: string;
|
|
31
|
+
requires: string[];
|
|
32
|
+
}>;
|
|
33
|
+
export type ProviderMethod = z.infer<typeof ProviderMethodSchema>;
|
|
34
|
+
export declare const ProviderRegistrationSchema: z.ZodEffects<z.ZodObject<{
|
|
35
|
+
schemaVersion: z.ZodLiteral<"iterate.provider/0.1">;
|
|
36
|
+
id: z.ZodString;
|
|
37
|
+
kind: z.ZodEnum<["ae-diagnosis", "report-render", "evidence-source"]>;
|
|
38
|
+
version: z.ZodString;
|
|
39
|
+
/** Where it came from, so a consumer can tell first-party from installed. */
|
|
40
|
+
origin: z.ZodOptional<z.ZodEnum<["kernel", "glasspane", "iterate", "plugin"]>>;
|
|
41
|
+
methods: z.ZodArray<z.ZodObject<{
|
|
42
|
+
name: z.ZodString;
|
|
43
|
+
/**
|
|
44
|
+
* What this method needs to run: capability names, not booleans per capability,
|
|
45
|
+
* so adding one does not require widening a schema on both sides. An empty list
|
|
46
|
+
* means "no prerequisites", which is a claim the provider has to make.
|
|
47
|
+
*/
|
|
48
|
+
requires: z.ZodArray<z.ZodString, "many">;
|
|
49
|
+
}, "strict", z.ZodTypeAny, {
|
|
50
|
+
name: string;
|
|
51
|
+
requires: string[];
|
|
52
|
+
}, {
|
|
53
|
+
name: string;
|
|
54
|
+
requires: string[];
|
|
55
|
+
}>, "many">;
|
|
56
|
+
}, "strict", z.ZodTypeAny, {
|
|
57
|
+
schemaVersion: "iterate.provider/0.1";
|
|
58
|
+
kind: "ae-diagnosis" | "report-render" | "evidence-source";
|
|
59
|
+
id: string;
|
|
60
|
+
version: string;
|
|
61
|
+
methods: {
|
|
62
|
+
name: string;
|
|
63
|
+
requires: string[];
|
|
64
|
+
}[];
|
|
65
|
+
origin?: "kernel" | "glasspane" | "iterate" | "plugin" | undefined;
|
|
66
|
+
}, {
|
|
67
|
+
schemaVersion: "iterate.provider/0.1";
|
|
68
|
+
kind: "ae-diagnosis" | "report-render" | "evidence-source";
|
|
69
|
+
id: string;
|
|
70
|
+
version: string;
|
|
71
|
+
methods: {
|
|
72
|
+
name: string;
|
|
73
|
+
requires: string[];
|
|
74
|
+
}[];
|
|
75
|
+
origin?: "kernel" | "glasspane" | "iterate" | "plugin" | undefined;
|
|
76
|
+
}>, {
|
|
77
|
+
schemaVersion: "iterate.provider/0.1";
|
|
78
|
+
kind: "ae-diagnosis" | "report-render" | "evidence-source";
|
|
79
|
+
id: string;
|
|
80
|
+
version: string;
|
|
81
|
+
methods: {
|
|
82
|
+
name: string;
|
|
83
|
+
requires: string[];
|
|
84
|
+
}[];
|
|
85
|
+
origin?: "kernel" | "glasspane" | "iterate" | "plugin" | undefined;
|
|
86
|
+
}, {
|
|
87
|
+
schemaVersion: "iterate.provider/0.1";
|
|
88
|
+
kind: "ae-diagnosis" | "report-render" | "evidence-source";
|
|
89
|
+
id: string;
|
|
90
|
+
version: string;
|
|
91
|
+
methods: {
|
|
92
|
+
name: string;
|
|
93
|
+
requires: string[];
|
|
94
|
+
}[];
|
|
95
|
+
origin?: "kernel" | "glasspane" | "iterate" | "plugin" | undefined;
|
|
96
|
+
}>;
|
|
97
|
+
export type ProviderRegistration = z.infer<typeof ProviderRegistrationSchema>;
|
|
98
|
+
export declare const PROVIDER_CODES: {
|
|
99
|
+
readonly duplicateId: "KERNEL_E_PROVIDER_DUPLICATE";
|
|
100
|
+
readonly unknown: "KERNEL_E_PROVIDER_UNKNOWN";
|
|
101
|
+
readonly missingMethod: "KERNEL_E_PROVIDER_METHOD";
|
|
102
|
+
};
|
|
103
|
+
export type KernelProviderCode = (typeof PROVIDER_CODES)[keyof typeof PROVIDER_CODES];
|
|
104
|
+
export declare class KernelProviderError extends Error {
|
|
105
|
+
readonly code: KernelProviderCode;
|
|
106
|
+
readonly providerId: string;
|
|
107
|
+
readonly remedy: string;
|
|
108
|
+
constructor(code: KernelProviderCode, providerId: string, message: string, remedy: string);
|
|
109
|
+
}
|
|
110
|
+
export type ProviderRegistry = Readonly<Record<string, ProviderRegistration>>;
|
|
111
|
+
export declare function emptyProviderRegistry(): ProviderRegistry;
|
|
112
|
+
/**
|
|
113
|
+
* Add a provider, refusing to overwrite one.
|
|
114
|
+
*
|
|
115
|
+
* Returns a new registry rather than mutating: a half-applied registration (added to
|
|
116
|
+
* one map, rejected by the next) is how a provider disappears between two shells.
|
|
117
|
+
* Overwriting is refused rather than last-write-wins, because in a two-harness
|
|
118
|
+
* ecosystem a silent override means one product runs a provider the other never saw.
|
|
119
|
+
*/
|
|
120
|
+
export declare function registerProvider(registry: ProviderRegistry, provider: ProviderRegistration): ProviderRegistry;
|
|
121
|
+
/** Look a provider up. No default, no fuzzy match, no "the only one registered". */
|
|
122
|
+
export declare function resolveProvider(registry: ProviderRegistry, id: string): ProviderRegistration;
|
|
123
|
+
export declare function requireMethod(registry: ProviderRegistry, id: string, method: string): ProviderMethod;
|
|
124
|
+
/**
|
|
125
|
+
* Assert two registries do not shadow each other.
|
|
126
|
+
*
|
|
127
|
+
* Each harness keeps its own providers; what must not happen is the same id meaning
|
|
128
|
+
* two different things across the boundary, because then "the AE provider" names a
|
|
129
|
+
* different judgement in each product while both look satisfied.
|
|
130
|
+
*/
|
|
131
|
+
export declare function providerIdsInCommon(a: ProviderRegistry, b: ProviderRegistry): string[];
|
|
132
|
+
//# sourceMappingURL=provider-registration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-registration.d.ts","sourceRoot":"","sources":["../src/provider-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,EAAG,sBAA+B,CAAC;AAEvE,eAAO,MAAM,mBAAmB,QAA+B,CAAC;AAChE,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,eAAO,MAAM,kBAAkB,iEAA+D,CAAC;AAC/F,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,oBAAoB;;IAE/B;;;;OAIG;;;;;;;;EAEH,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,0BAA0B;;;;;IAMnC,6EAA6E;;;;QAf/E;;;;WAIG;;;;;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rorFrom } from "./errors.js";
|
|
3
|
+
/**
|
|
4
|
+
* The AE-provider registration contract (5.7 R40 scenario 5): a judgement producer
|
|
5
|
+
* registers once, and both harnesses consume it through the same shape.
|
|
6
|
+
*
|
|
7
|
+
* Why this is in the kernel rather than in each product: the alternative is two
|
|
8
|
+
* registries that describe the same provider differently, and the first time they
|
|
9
|
+
* disagree the run keeps going with whichever one happened to be consulted. The
|
|
10
|
+
* registration is metadata — who provides what, and what they need to do it — never
|
|
11
|
+
* the judgement itself, which stays in the engine and the reviewers.
|
|
12
|
+
*/
|
|
13
|
+
export const PROVIDER_SCHEMA_VERSION = "iterate.provider/0.1";
|
|
14
|
+
export const PROVIDER_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
15
|
+
export const PROVIDER_ID_MAX_LENGTH = 64;
|
|
16
|
+
export const PROVIDER_METHOD_MAX = 32;
|
|
17
|
+
export const ProviderKindSchema = z.enum(["ae-diagnosis", "report-render", "evidence-source"]);
|
|
18
|
+
export const ProviderMethodSchema = z.strictObject({
|
|
19
|
+
name: z.string().regex(PROVIDER_ID_PATTERN).max(PROVIDER_ID_MAX_LENGTH),
|
|
20
|
+
/**
|
|
21
|
+
* What this method needs to run: capability names, not booleans per capability,
|
|
22
|
+
* so adding one does not require widening a schema on both sides. An empty list
|
|
23
|
+
* means "no prerequisites", which is a claim the provider has to make.
|
|
24
|
+
*/
|
|
25
|
+
requires: z.array(z.string().regex(PROVIDER_ID_PATTERN).max(PROVIDER_ID_MAX_LENGTH)).max(16)
|
|
26
|
+
});
|
|
27
|
+
export const ProviderRegistrationSchema = z
|
|
28
|
+
.strictObject({
|
|
29
|
+
schemaVersion: z.literal(PROVIDER_SCHEMA_VERSION),
|
|
30
|
+
id: z.string().regex(PROVIDER_ID_PATTERN).max(PROVIDER_ID_MAX_LENGTH),
|
|
31
|
+
kind: ProviderKindSchema,
|
|
32
|
+
version: z.string().min(1).max(64),
|
|
33
|
+
/** Where it came from, so a consumer can tell first-party from installed. */
|
|
34
|
+
origin: z.enum(["kernel", "glasspane", "iterate", "plugin"]).optional(),
|
|
35
|
+
methods: z.array(ProviderMethodSchema).min(1).max(PROVIDER_METHOD_MAX)
|
|
36
|
+
})
|
|
37
|
+
.superRefine((provider, ctx) => {
|
|
38
|
+
const seen = new Set();
|
|
39
|
+
provider.methods.forEach((method, index) => {
|
|
40
|
+
if (seen.has(method.name)) {
|
|
41
|
+
ctx.addIssue({
|
|
42
|
+
code: z.ZodIssueCode.custom,
|
|
43
|
+
path: ["methods", index, "name"],
|
|
44
|
+
message: `method "${method.name}" is declared twice; a second declaration cannot override the first silently`
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
seen.add(method.name);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
export const PROVIDER_CODES = {
|
|
51
|
+
duplicateId: "KERNEL_E_PROVIDER_DUPLICATE",
|
|
52
|
+
unknown: "KERNEL_E_PROVIDER_UNKNOWN",
|
|
53
|
+
missingMethod: "KERNEL_E_PROVIDER_METHOD"
|
|
54
|
+
};
|
|
55
|
+
export class KernelProviderError extends Error {
|
|
56
|
+
code;
|
|
57
|
+
providerId;
|
|
58
|
+
remedy;
|
|
59
|
+
constructor(code, providerId, message, remedy) {
|
|
60
|
+
super(`${code}: ${message}`);
|
|
61
|
+
this.name = "KernelProviderError";
|
|
62
|
+
this.code = code;
|
|
63
|
+
this.providerId = providerId;
|
|
64
|
+
this.remedy = remedy;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export function emptyProviderRegistry() {
|
|
68
|
+
return {};
|
|
69
|
+
}
|
|
70
|
+
function registeredIds(registry) {
|
|
71
|
+
const ids = Object.keys(registry).sort();
|
|
72
|
+
return ids.length > 0 ? ids.join(", ") : "(none registered)";
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Add a provider, refusing to overwrite one.
|
|
76
|
+
*
|
|
77
|
+
* Returns a new registry rather than mutating: a half-applied registration (added to
|
|
78
|
+
* one map, rejected by the next) is how a provider disappears between two shells.
|
|
79
|
+
* Overwriting is refused rather than last-write-wins, because in a two-harness
|
|
80
|
+
* ecosystem a silent override means one product runs a provider the other never saw.
|
|
81
|
+
*/
|
|
82
|
+
export function registerProvider(registry, provider) {
|
|
83
|
+
const checked = ProviderRegistrationSchema.safeParse(provider);
|
|
84
|
+
if (!checked.success) {
|
|
85
|
+
throw schemaErrorFrom("provider registration", checked.error);
|
|
86
|
+
}
|
|
87
|
+
const parsed = checked.data;
|
|
88
|
+
if (Object.prototype.hasOwnProperty.call(registry, parsed.id)) {
|
|
89
|
+
throw new KernelProviderError(PROVIDER_CODES.duplicateId, parsed.id, `provider "${parsed.id}" is already registered`, "choose a distinct id, or replace the registration explicitly rather than by order of appearance");
|
|
90
|
+
}
|
|
91
|
+
return { ...registry, [parsed.id]: parsed };
|
|
92
|
+
}
|
|
93
|
+
/** Look a provider up. No default, no fuzzy match, no "the only one registered". */
|
|
94
|
+
export function resolveProvider(registry, id) {
|
|
95
|
+
const provider = registry[id];
|
|
96
|
+
if (!provider) {
|
|
97
|
+
throw new KernelProviderError(PROVIDER_CODES.unknown, id, `no provider registered under "${id}"`, `registered: ${registeredIds(registry)}`);
|
|
98
|
+
}
|
|
99
|
+
return provider;
|
|
100
|
+
}
|
|
101
|
+
export function requireMethod(registry, id, method) {
|
|
102
|
+
const provider = resolveProvider(registry, id);
|
|
103
|
+
const found = provider.methods.find((entry) => entry.name === method);
|
|
104
|
+
if (!found) {
|
|
105
|
+
throw new KernelProviderError(PROVIDER_CODES.missingMethod, id, `provider "${id}" does not offer "${method}"`, `it offers: ${provider.methods.map((entry) => entry.name).join(", ")}`);
|
|
106
|
+
}
|
|
107
|
+
return found;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Assert two registries do not shadow each other.
|
|
111
|
+
*
|
|
112
|
+
* Each harness keeps its own providers; what must not happen is the same id meaning
|
|
113
|
+
* two different things across the boundary, because then "the AE provider" names a
|
|
114
|
+
* different judgement in each product while both look satisfied.
|
|
115
|
+
*/
|
|
116
|
+
export function providerIdsInCommon(a, b) {
|
|
117
|
+
return Object.keys(a).filter((id) => Object.prototype.hasOwnProperty.call(b, id)).sort();
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=provider-registration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-registration.js","sourceRoot":"","sources":["../src/provider-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,sBAA+B,CAAC;AAEvE,MAAM,CAAC,MAAM,mBAAmB,GAAG,4BAA4B,CAAC;AAChE,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AACzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAEtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,eAAe,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAG/F,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,YAAY,CAAC;IACjD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,sBAAsB,CAAC;IACvE;;;;OAIG;IACH,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;CAC7F,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC;KACxC,YAAY,CAAC;IACZ,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC;IACjD,E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AAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC3F,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type PlannedDimension } from "./dimension-context.js";
|
|
3
|
+
/**
|
|
4
|
+
* The run plan: which review dimensions this run intends to cover, in what order,
|
|
5
|
+
* with what focus each was asked for.
|
|
6
|
+
*
|
|
7
|
+
* WHY THIS EXISTS. The dimension-coverage contract (`dimension-context`) accounts
|
|
8
|
+
* a plan against what was recorded, and it refuses to invent the plan — that is
|
|
9
|
+
* correct for an accountant and useless without a source. Today the plan exists
|
|
10
|
+
* only inside `iterate.config.yaml` on one side and nowhere on the other: the
|
|
11
|
+
* GlassPane harness renders a coverage line from `planned: []`, which reads as
|
|
12
|
+
* "nothing was verified" forever. So the plan gets its own contract, and whoever
|
|
13
|
+
* configures a run writes it while whoever renders it reads it.
|
|
14
|
+
*
|
|
15
|
+
* THE DIRECTION RULE, STATED SO IT DOES NOT ROT: nothing here reads a config file,
|
|
16
|
+
* a session, or an environment variable. This module validates and digests a value
|
|
17
|
+
* somebody else produced. Pulling `iterate.config.yaml` (or a recipe) in here would
|
|
18
|
+
* weld one consumer's file format into the shared layer, which is the dependency
|
|
19
|
+
* direction the kernel exists to forbid.
|
|
20
|
+
*/
|
|
21
|
+
export declare const RUN_PLAN_SCHEMA_VERSION: "iterate.run-plan/0.1";
|
|
22
|
+
/**
|
|
23
|
+
* Not `-draft`, unlike the recipe and decision-entry contracts. Those carry a draft
|
|
24
|
+
* label because archived bytes predate the freeze and must stay distinguishable;
|
|
25
|
+
* a brand-new contract has no such archive, and a draft label on it would only
|
|
26
|
+
* become a compatibility burden with nothing yet to be compatible with.
|
|
27
|
+
*/
|
|
28
|
+
export declare const RUN_PLAN_SOURCES: readonly ["config", "recipe", "session", "manual"];
|
|
29
|
+
export declare const RunPlanSourceKindSchema: z.ZodEnum<["config", "recipe", "session", "manual"]>;
|
|
30
|
+
export type RunPlanSourceKind = z.infer<typeof RunPlanSourceKindSchema>;
|
|
31
|
+
export declare const RunPlanSourceSchema: z.ZodObject<{
|
|
32
|
+
kind: z.ZodEnum<["config", "recipe", "session", "manual"]>;
|
|
33
|
+
/**
|
|
34
|
+
* What produced the plan — a config path, a recipe name, a session id. Optional:
|
|
35
|
+
* the rendering must never invent one, and an honest "source kind only" beats a
|
|
36
|
+
* guessed filename.
|
|
37
|
+
*/
|
|
38
|
+
name: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, "strict", z.ZodTypeAny, {
|
|
40
|
+
kind: "config" | "recipe" | "session" | "manual";
|
|
41
|
+
name?: string | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
kind: "config" | "recipe" | "session" | "manual";
|
|
44
|
+
name?: string | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
export type RunPlanSource = z.infer<typeof RunPlanSourceSchema>;
|
|
47
|
+
export declare const RunPlanSchema: z.ZodEffects<z.ZodObject<{
|
|
48
|
+
schemaVersion: z.ZodLiteral<"iterate.run-plan/0.1">;
|
|
49
|
+
dimensions: z.ZodArray<z.ZodObject<{
|
|
50
|
+
id: z.ZodString;
|
|
51
|
+
label: z.ZodOptional<z.ZodString>;
|
|
52
|
+
focus: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, "strict", z.ZodTypeAny, {
|
|
54
|
+
id: string;
|
|
55
|
+
label?: string | undefined;
|
|
56
|
+
focus?: string | undefined;
|
|
57
|
+
}, {
|
|
58
|
+
id: string;
|
|
59
|
+
label?: string | undefined;
|
|
60
|
+
focus?: string | undefined;
|
|
61
|
+
}>, "many">;
|
|
62
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
63
|
+
kind: z.ZodEnum<["config", "recipe", "session", "manual"]>;
|
|
64
|
+
/**
|
|
65
|
+
* What produced the plan — a config path, a recipe name, a session id. Optional:
|
|
66
|
+
* the rendering must never invent one, and an honest "source kind only" beats a
|
|
67
|
+
* guessed filename.
|
|
68
|
+
*/
|
|
69
|
+
name: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}, "strict", z.ZodTypeAny, {
|
|
71
|
+
kind: "config" | "recipe" | "session" | "manual";
|
|
72
|
+
name?: string | undefined;
|
|
73
|
+
}, {
|
|
74
|
+
kind: "config" | "recipe" | "session" | "manual";
|
|
75
|
+
name?: string | undefined;
|
|
76
|
+
}>>;
|
|
77
|
+
}, "strict", z.ZodTypeAny, {
|
|
78
|
+
schemaVersion: "iterate.run-plan/0.1";
|
|
79
|
+
dimensions: {
|
|
80
|
+
id: string;
|
|
81
|
+
label?: string | undefined;
|
|
82
|
+
focus?: string | undefined;
|
|
83
|
+
}[];
|
|
84
|
+
source?: {
|
|
85
|
+
kind: "config" | "recipe" | "session" | "manual";
|
|
86
|
+
name?: string | undefined;
|
|
87
|
+
} | undefined;
|
|
88
|
+
}, {
|
|
89
|
+
schemaVersion: "iterate.run-plan/0.1";
|
|
90
|
+
dimensions: {
|
|
91
|
+
id: string;
|
|
92
|
+
label?: string | undefined;
|
|
93
|
+
focus?: string | undefined;
|
|
94
|
+
}[];
|
|
95
|
+
source?: {
|
|
96
|
+
kind: "config" | "recipe" | "session" | "manual";
|
|
97
|
+
name?: string | undefined;
|
|
98
|
+
} | undefined;
|
|
99
|
+
}>, {
|
|
100
|
+
schemaVersion: "iterate.run-plan/0.1";
|
|
101
|
+
dimensions: {
|
|
102
|
+
id: string;
|
|
103
|
+
label?: string | undefined;
|
|
104
|
+
focus?: string | undefined;
|
|
105
|
+
}[];
|
|
106
|
+
source?: {
|
|
107
|
+
kind: "config" | "recipe" | "session" | "manual";
|
|
108
|
+
name?: string | undefined;
|
|
109
|
+
} | undefined;
|
|
110
|
+
}, {
|
|
111
|
+
schemaVersion: "iterate.run-plan/0.1";
|
|
112
|
+
dimensions: {
|
|
113
|
+
id: string;
|
|
114
|
+
label?: string | undefined;
|
|
115
|
+
focus?: string | undefined;
|
|
116
|
+
}[];
|
|
117
|
+
source?: {
|
|
118
|
+
kind: "config" | "recipe" | "session" | "manual";
|
|
119
|
+
name?: string | undefined;
|
|
120
|
+
} | undefined;
|
|
121
|
+
}>;
|
|
122
|
+
export type RunPlan = z.infer<typeof RunPlanSchema>;
|
|
123
|
+
/** The plan's ids, in planned order. Order is the caller's, never sorted. */
|
|
124
|
+
export declare function plannedIds(plan: RunPlan): string[];
|
|
125
|
+
/**
|
|
126
|
+
* Feed a plan to the dimension-coverage contract without the caller re-shaping it.
|
|
127
|
+
* Kept as one function because the two contracts must not be allowed to develop
|
|
128
|
+
* private conversions between them.
|
|
129
|
+
*/
|
|
130
|
+
export declare function plannedDimensionsOf(plan: RunPlan): PlannedDimension[];
|
|
131
|
+
/**
|
|
132
|
+
* A digest of the plan, so a ledger line can say which plan a run was held to —
|
|
133
|
+
* and a reader can notice the plan changed mid-run.
|
|
134
|
+
*
|
|
135
|
+
* `rp_` + sha256 over the canonical form (keys sorted, no insignificant
|
|
136
|
+
* whitespace), so two producers that serialise differently still agree on the
|
|
137
|
+
* digest. Numbers are rendered by the host's shortest roundtrip form, which is
|
|
138
|
+
* why the same rules live in the engine and in the Python half rather than in a
|
|
139
|
+
* format string here.
|
|
140
|
+
*/
|
|
141
|
+
export declare function runPlanDigest(plan: RunPlan): string;
|
|
142
|
+
//# sourceMappingURL=run-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-plan.d.ts","sourceRoot":"","sources":["../src/run-plan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,uBAAuB,EAAG,sBAA+B,CAAC;AAEvE;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,oDAAqD,CAAC;AAEnF,eAAO,MAAM,uBAAuB,sDAA2B,CAAC;AAChE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,mBAAmB;;IAE9B;;;;OAIG;;;;;;;;EAEH,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;QATxB;;;;WAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCD,CAAC;AACL,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,EAAE,CAElD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,gBAAgB,EAAE,CAErE;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAEnD"}
|
package/dist/run-plan.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { canonicalJson } from "./canonical-json.js";
|
|
4
|
+
import { DIMENSION_MAX_PLANNED, DIMENSION_MIN_PLANNED, PlannedDimensionSchema } from "./dimension-context.js";
|
|
5
|
+
/**
|
|
6
|
+
* The run plan: which review dimensions this run intends to cover, in what order,
|
|
7
|
+
* with what focus each was asked for.
|
|
8
|
+
*
|
|
9
|
+
* WHY THIS EXISTS. The dimension-coverage contract (`dimension-context`) accounts
|
|
10
|
+
* a plan against what was recorded, and it refuses to invent the plan — that is
|
|
11
|
+
* correct for an accountant and useless without a source. Today the plan exists
|
|
12
|
+
* only inside `iterate.config.yaml` on one side and nowhere on the other: the
|
|
13
|
+
* GlassPane harness renders a coverage line from `planned: []`, which reads as
|
|
14
|
+
* "nothing was verified" forever. So the plan gets its own contract, and whoever
|
|
15
|
+
* configures a run writes it while whoever renders it reads it.
|
|
16
|
+
*
|
|
17
|
+
* THE DIRECTION RULE, STATED SO IT DOES NOT ROT: nothing here reads a config file,
|
|
18
|
+
* a session, or an environment variable. This module validates and digests a value
|
|
19
|
+
* somebody else produced. Pulling `iterate.config.yaml` (or a recipe) in here would
|
|
20
|
+
* weld one consumer's file format into the shared layer, which is the dependency
|
|
21
|
+
* direction the kernel exists to forbid.
|
|
22
|
+
*/
|
|
23
|
+
export const RUN_PLAN_SCHEMA_VERSION = "iterate.run-plan/0.1";
|
|
24
|
+
/**
|
|
25
|
+
* Not `-draft`, unlike the recipe and decision-entry contracts. Those carry a draft
|
|
26
|
+
* label because archived bytes predate the freeze and must stay distinguishable;
|
|
27
|
+
* a brand-new contract has no such archive, and a draft label on it would only
|
|
28
|
+
* become a compatibility burden with nothing yet to be compatible with.
|
|
29
|
+
*/
|
|
30
|
+
export const RUN_PLAN_SOURCES = ["config", "recipe", "session", "manual"];
|
|
31
|
+
export const RunPlanSourceKindSchema = z.enum(RUN_PLAN_SOURCES);
|
|
32
|
+
export const RunPlanSourceSchema = z.strictObject({
|
|
33
|
+
kind: RunPlanSourceKindSchema,
|
|
34
|
+
/**
|
|
35
|
+
* What produced the plan — a config path, a recipe name, a session id. Optional:
|
|
36
|
+
* the rendering must never invent one, and an honest "source kind only" beats a
|
|
37
|
+
* guessed filename.
|
|
38
|
+
*/
|
|
39
|
+
name: z.string().min(1).max(512).optional()
|
|
40
|
+
});
|
|
41
|
+
export const RunPlanSchema = z
|
|
42
|
+
.strictObject({
|
|
43
|
+
schemaVersion: z.literal(RUN_PLAN_SCHEMA_VERSION),
|
|
44
|
+
// `PlannedDimensionSchema` is reused rather than re-specified: id shape, label and
|
|
45
|
+
// focus limits belong to the dimension contract, and a second copy of them is a
|
|
46
|
+
// second place to disagree.
|
|
47
|
+
dimensions: z.array(PlannedDimensionSchema).min(DIMENSION_MIN_PLANNED).max(DIMENSION_MAX_PLANNED),
|
|
48
|
+
source: RunPlanSourceSchema.optional()
|
|
49
|
+
})
|
|
50
|
+
.superRefine((plan, ctx) => {
|
|
51
|
+
// Duplicate ids are refused, not collapsed. JSON Schema cannot express id-level
|
|
52
|
+
// uniqueness (`uniqueItems` compares whole objects, so `{id:"security"}` twice with
|
|
53
|
+
// different focus passes it), which makes this the documented place where the zod
|
|
54
|
+
// side is *stricter* than the published schema — not a drift to be fixed later.
|
|
55
|
+
const seen = new Set();
|
|
56
|
+
plan.dimensions.forEach((dimension, index) => {
|
|
57
|
+
if (seen.has(dimension.id)) {
|
|
58
|
+
ctx.addIssue({
|
|
59
|
+
code: z.ZodIssueCode.custom,
|
|
60
|
+
path: ["dimensions", index, "id"],
|
|
61
|
+
message: `duplicate planned dimension "${dimension.id}" (first seen at index ${plan.dimensions.findIndex((other) => other.id === dimension.id)}); a plan that names a dimension twice has two different intents, and this contract cannot tell them apart`
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
seen.add(dimension.id);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
/** The plan's ids, in planned order. Order is the caller's, never sorted. */
|
|
68
|
+
export function plannedIds(plan) {
|
|
69
|
+
return plan.dimensions.map((dimension) => dimension.id);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Feed a plan to the dimension-coverage contract without the caller re-shaping it.
|
|
73
|
+
* Kept as one function because the two contracts must not be allowed to develop
|
|
74
|
+
* private conversions between them.
|
|
75
|
+
*/
|
|
76
|
+
export function plannedDimensionsOf(plan) {
|
|
77
|
+
return plan.dimensions;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* A digest of the plan, so a ledger line can say which plan a run was held to —
|
|
81
|
+
* and a reader can notice the plan changed mid-run.
|
|
82
|
+
*
|
|
83
|
+
* `rp_` + sha256 over the canonical form (keys sorted, no insignificant
|
|
84
|
+
* whitespace), so two producers that serialise differently still agree on the
|
|
85
|
+
* digest. Numbers are rendered by the host's shortest roundtrip form, which is
|
|
86
|
+
* why the same rules live in the engine and in the Python half rather than in a
|
|
87
|
+
* format string here.
|
|
88
|
+
*/
|
|
89
|
+
export function runPlanDigest(plan) {
|
|
90
|
+
return `rp_${createHash("sha256").update(canonicalJson(plan)).digest("hex")}`;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=run-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-plan.js","sourceRoot":"","sources":["../src/run-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EAEvB,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,sBAA+B,CAAC;AAEvE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAU,CAAC;AAEnF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;AAGhE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,YAAY,CAAC;IAChD,IAAI,EAAE,uBAAuB;IAC7B;;;;OAIG;IACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;CAC5C,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KAC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AAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAa;IAC/C,OAAO,IAAI,CAAC,UAAU,CAAC;AACzB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,IAAa;IACzC,OAAO,MAAM,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AAChF,CAAC"}
|
package/dist/schemas.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export declare const EVIDENCE_PACK_SCHEMA_ID: "https://schemas.iterate.dev/evidence-pack-0.1.json";
|
|
2
2
|
export declare const DECISION_LOG_ENTRY_SCHEMA_ID: "https://schemas.iterate.dev/decision-log-entry-0.1-draft.json";
|
|
3
3
|
export declare const RECIPE_CONFIG_SCHEMA_ID: "https://schemas.iterate.dev/recipe-config-0.1-draft.json";
|
|
4
|
+
export declare const RUN_PLAN_SCHEMA_ID: "https://schemas.iterate.dev/run-plan-0.1.json";
|
|
5
|
+
export declare const INVARIANT_REPORT_SCHEMA_ID: "https://schemas.iterate.dev/invariant-report-0.1.json";
|
|
6
|
+
export declare const REVERIFICATION_REQUEST_SCHEMA_ID: "https://schemas.iterate.dev/reverification-request-0.1.json";
|
|
7
|
+
export declare const CONVERGENCE_ROUND_STATE_SCHEMA_ID: "https://schemas.iterate.dev/convergence-round-state-0.1.json";
|
|
8
|
+
export declare const PROVIDER_REGISTRATION_SCHEMA_ID: "https://schemas.iterate.dev/provider-registration-0.1.json";
|
|
4
9
|
export interface JsonSchemaObject {
|
|
5
10
|
readonly $id: string;
|
|
6
11
|
readonly [key: string]: unknown;
|
|
@@ -8,4 +13,9 @@ export interface JsonSchemaObject {
|
|
|
8
13
|
export declare const EVIDENCE_PACK_JSON_SCHEMA: JsonSchemaObject;
|
|
9
14
|
export declare const DECISION_LOG_ENTRY_JSON_SCHEMA: JsonSchemaObject;
|
|
10
15
|
export declare const RECIPE_CONFIG_JSON_SCHEMA: JsonSchemaObject;
|
|
16
|
+
export declare const RUN_PLAN_JSON_SCHEMA: JsonSchemaObject;
|
|
17
|
+
export declare const INVARIANT_REPORT_JSON_SCHEMA: JsonSchemaObject;
|
|
18
|
+
export declare const REVERIFICATION_REQUEST_JSON_SCHEMA: JsonSchemaObject;
|
|
19
|
+
export declare const CONVERGENCE_ROUND_STATE_JSON_SCHEMA: JsonSchemaObject;
|
|
20
|
+
export declare const PROVIDER_REGISTRATION_JSON_SCHEMA: JsonSchemaObject;
|
|
11
21
|
//# sourceMappingURL=schemas.d.ts.map
|
package/dist/schemas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,uBAAuB,EAClC,oDAA6D,CAAC;AAChE,eAAO,MAAM,4BAA4B,EACvC,+DAAwE,CAAC;AAC3E,eAAO,MAAM,uBAAuB,EAClC,0DAAmE,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,uBAAuB,EAClC,oDAA6D,CAAC;AAChE,eAAO,MAAM,4BAA4B,EACvC,+DAAwE,CAAC;AAC3E,eAAO,MAAM,uBAAuB,EAClC,0DAAmE,CAAC;AACtE,eAAO,MAAM,kBAAkB,EAC7B,+CAAwD,CAAC;AAC3D,eAAO,MAAM,0BAA0B,EACrC,uDAAgE,CAAC;AACnE,eAAO,MAAM,gCAAgC,EAC3C,6DAAsE,CAAC;AACzE,eAAO,MAAM,iCAAiC,EAC5C,8DAAuE,CAAC;AAC1E,eAAO,MAAM,+BAA+B,EAC1C,4DAAqE,CAAC;AAExE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC;AAMD,eAAO,MAAM,yBAAyB,EAAE,gBAEvC,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,gBAE5C,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,gBAEvC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,gBAElC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,gBAE1C,CAAC;AAEF,eAAO,MAAM,kCAAkC,EAAE,gBAEhD,CAAC;AAEF,eAAO,MAAM,mCAAmC,EAAE,gBAEjD,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,gBAE/C,CAAC"}
|
package/dist/schemas.js
CHANGED
|
@@ -10,10 +10,20 @@ const nodeRequire = createRequire(import.meta.url);
|
|
|
10
10
|
export const EVIDENCE_PACK_SCHEMA_ID = "https://schemas.iterate.dev/evidence-pack-0.1.json";
|
|
11
11
|
export const DECISION_LOG_ENTRY_SCHEMA_ID = "https://schemas.iterate.dev/decision-log-entry-0.1-draft.json";
|
|
12
12
|
export const RECIPE_CONFIG_SCHEMA_ID = "https://schemas.iterate.dev/recipe-config-0.1-draft.json";
|
|
13
|
+
export const RUN_PLAN_SCHEMA_ID = "https://schemas.iterate.dev/run-plan-0.1.json";
|
|
14
|
+
export const INVARIANT_REPORT_SCHEMA_ID = "https://schemas.iterate.dev/invariant-report-0.1.json";
|
|
15
|
+
export const REVERIFICATION_REQUEST_SCHEMA_ID = "https://schemas.iterate.dev/reverification-request-0.1.json";
|
|
16
|
+
export const CONVERGENCE_ROUND_STATE_SCHEMA_ID = "https://schemas.iterate.dev/convergence-round-state-0.1.json";
|
|
17
|
+
export const PROVIDER_REGISTRATION_SCHEMA_ID = "https://schemas.iterate.dev/provider-registration-0.1.json";
|
|
13
18
|
function loadSchema(relativePath) {
|
|
14
19
|
return nodeRequire(relativePath);
|
|
15
20
|
}
|
|
16
21
|
export const EVIDENCE_PACK_JSON_SCHEMA = loadSchema("../schemas/evidence-pack.schema.json");
|
|
17
22
|
export const DECISION_LOG_ENTRY_JSON_SCHEMA = loadSchema("../schemas/decision-log-entry.schema.json");
|
|
18
23
|
export const RECIPE_CONFIG_JSON_SCHEMA = loadSchema("../schemas/recipe-config.schema.json");
|
|
24
|
+
export const RUN_PLAN_JSON_SCHEMA = loadSchema("../schemas/run-plan.schema.json");
|
|
25
|
+
export const INVARIANT_REPORT_JSON_SCHEMA = loadSchema("../schemas/invariant-report.schema.json");
|
|
26
|
+
export const REVERIFICATION_REQUEST_JSON_SCHEMA = loadSchema("../schemas/reverification-request.schema.json");
|
|
27
|
+
export const CONVERGENCE_ROUND_STATE_JSON_SCHEMA = loadSchema("../schemas/convergence-round-state.schema.json");
|
|
28
|
+
export const PROVIDER_REGISTRATION_JSON_SCHEMA = loadSchema("../schemas/provider-registration.schema.json");
|
|
19
29
|
//# sourceMappingURL=schemas.js.map
|
package/dist/schemas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEnD,MAAM,CAAC,MAAM,uBAAuB,GAClC,oDAA6D,CAAC;AAChE,MAAM,CAAC,MAAM,4BAA4B,GACvC,+DAAwE,CAAC;AAC3E,MAAM,CAAC,MAAM,uBAAuB,GAClC,0DAAmE,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEnD,MAAM,CAAC,MAAM,uBAAuB,GAClC,oDAA6D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