iterate-kernel 0.1.0-draft.1

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 (49) hide show
  1. package/README.md +56 -0
  2. package/dist/canonical-json.d.ts +21 -0
  3. package/dist/canonical-json.d.ts.map +1 -0
  4. package/dist/canonical-json.js +31 -0
  5. package/dist/canonical-json.js.map +1 -0
  6. package/dist/decision-log-entry.d.ts +34 -0
  7. package/dist/decision-log-entry.d.ts.map +1 -0
  8. package/dist/decision-log-entry.js +17 -0
  9. package/dist/decision-log-entry.js.map +1 -0
  10. package/dist/decision-log.d.ts +142 -0
  11. package/dist/decision-log.d.ts.map +1 -0
  12. package/dist/decision-log.js +288 -0
  13. package/dist/decision-log.js.map +1 -0
  14. package/dist/dimension-context.d.ts +402 -0
  15. package/dist/dimension-context.d.ts.map +1 -0
  16. package/dist/dimension-context.js +226 -0
  17. package/dist/dimension-context.js.map +1 -0
  18. package/dist/errors.d.ts +15 -0
  19. package/dist/errors.d.ts.map +1 -0
  20. package/dist/errors.js +18 -0
  21. package/dist/errors.js.map +1 -0
  22. package/dist/evidence-decision.d.ts +44 -0
  23. package/dist/evidence-decision.d.ts.map +1 -0
  24. package/dist/evidence-decision.js +88 -0
  25. package/dist/evidence-decision.js.map +1 -0
  26. package/dist/evidence-pack.d.ts +1884 -0
  27. package/dist/evidence-pack.d.ts.map +1 -0
  28. package/dist/evidence-pack.js +243 -0
  29. package/dist/evidence-pack.js.map +1 -0
  30. package/dist/index.d.ts +19 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +19 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/parse.d.ts +22 -0
  35. package/dist/parse.d.ts.map +1 -0
  36. package/dist/parse.js +53 -0
  37. package/dist/parse.js.map +1 -0
  38. package/dist/recipe-config.d.ts +48 -0
  39. package/dist/recipe-config.d.ts.map +1 -0
  40. package/dist/recipe-config.js +20 -0
  41. package/dist/recipe-config.js.map +1 -0
  42. package/dist/schemas.d.ts +11 -0
  43. package/dist/schemas.d.ts.map +1 -0
  44. package/dist/schemas.js +19 -0
  45. package/dist/schemas.js.map +1 -0
  46. package/package.json +84 -0
  47. package/schemas/decision-log-entry.schema.json +45 -0
  48. package/schemas/evidence-pack.schema.json +359 -0
  49. package/schemas/recipe-config.schema.json +36 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence-pack.d.ts","sourceRoot":"","sources":["../src/evidence-pack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,mFAAmF;AACnF,eAAO,MAAM,oBAAoB,QAAgC,CAAC;AAElE,gFAAgF;AAChF,eAAO,MAAM,kBAAkB,QAAkD,CAAC;AAElF,mFAAmF;AACnF,eAAO,MAAM,mBAAmB,QAAmB,CAAC;AAEpD,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC,eAAO,MAAM,uBAAuB,EAAG,wBAAiC,CAAC;AAEzE;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,EAAG,8BAAuC,CAAC;AAEtF,eAAO,MAAM,sBAAsB,uCAAqC,CAAC;AACzE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,yBAAyB,aAAiC,CAAC;AACxE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,cAAc;;;;;;;;;;;;EAIzB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,YAAY,yFAQvB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD,eAAO,MAAM,uBAAuB,6DAMlC,CAAC;AACH,MAAM,MAAM,iBA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AAC;AAkF9D;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAGlC,CAAC"}
@@ -0,0 +1,243 @@
1
+ import { z } from "zod";
2
+ /** Crockford base32 (excludes I, L, O, U). 26 chars = 10 timestamp + 16 random. */
3
+ export const OPERATION_ID_PATTERN = /^op_[0-9A-HJKMNP-TV-Z]{26}$/;
4
+ /** ISO-8601 UTC with fixed millisecond precision, as emitted by both codecs. */
5
+ export const ISO_MILLIS_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
6
+ /** SHA-256 truncated to the first 16 bytes, lowercase hex (tree digest format). */
7
+ export const TREE_DIGEST_PATTERN = /^[0-9a-f]{32}$/;
8
+ export const SELECTOR_MAX_LENGTH = 512;
9
+ export const EVIDENCE_SCHEMA_VERSION = "glasspane.evidence/0.1";
10
+ /**
11
+ * The schema label used before the Phase B freeze. P0 spec §4 keeps it
12
+ * read-compatible for ever ("冻结前历史值 0.1-draft 只读兼容"): packs archived
13
+ * under it carry the frozen body field for field — the frozen schema's own
14
+ * description still calls itself "schema v0.1-draft" — so the read path folds
15
+ * this label onto the frozen const instead of refusing them. Nothing on the
16
+ * write side may ever stamp it again.
17
+ */
18
+ export const LEGACY_EVIDENCE_SCHEMA_VERSION = "glasspane.evidence/0.1-draft";
19
+ export const AttributionLevelSchema = z.enum(["soft", "strong", "weak"]);
20
+ export const CircuitBreakerLevelSchema = z.number().int().min(0).max(3);
21
+ export const SelectorSchema = z.strictObject({
22
+ role: z.string().max(SELECTOR_MAX_LENGTH),
23
+ title: z.string().max(SELECTOR_MAX_LENGTH).optional(),
24
+ identifier: z.string().max(SELECTOR_MAX_LENGTH).optional(),
25
+ });
26
+ export const ActionSchema = z.enum([
27
+ "press",
28
+ "increment",
29
+ "decrement",
30
+ "showMenu",
31
+ "confirm",
32
+ "cancel",
33
+ "pick"
34
+ ]);
35
+ export const AssertionPropertySchema = z.enum([
36
+ "title",
37
+ "value",
38
+ "role",
39
+ "enabled",
40
+ "focused"
41
+ ]);
42
+ export const StringOrBoolSchema = z.union([z.string(), z.boolean()]);
43
+ export const BoundsSchema = z.strictObject({
44
+ x: z.number(),
45
+ y: z.number(),
46
+ width: z.number(),
47
+ height: z.number()
48
+ });
49
+ export const AxEventSignalSchema = z.strictObject({
50
+ treeDigestBefore: z.string().regex(TREE_DIGEST_PATTERN),
51
+ treeDigestAfter: z.string().regex(TREE_DIGEST_PATTERN),
52
+ nodeCount: z.number().int().min(0),
53
+ axChanged: z.boolean(),
54
+ latencyMs: z.number().min(0)
55
+ });
56
+ export const PixelDiffSignalSchema = z.strictObject({
57
+ changedPixelRatio: z.number().min(0).max(1),
58
+ bounds: z.union([BoundsSchema, z.null()]),
59
+ windowId: z.number().int().min(0)
60
+ });
61
+ export const ResponsivenessSignalSchema = z.strictObject({
62
+ responsive: z.boolean(),
63
+ pingMs: z.number().min(0)
64
+ });
65
+ export const CrashSignalSchema = z.strictObject({
66
+ processAliveBefore: z.boolean(),
67
+ processAliveAfter: z.boolean()
68
+ });
69
+ export const ActSignalSchema = z.strictObject({
70
+ selector: SelectorSchema,
71
+ action: ActionSchema,
72
+ actConfirmed: z.boolean()
73
+ });
74
+ /** P6 §3.1: Z1 handler probe signal — present iff a probe connection served
75
+ * the act window; null stays the honest absence marker (Z5-only form). */
76
+ export const HandlerRefSchema = z.strictObject({
77
+ file: z.string().min(1).max(512),
78
+ line: z.number().int().min(0)
79
+ });
80
+ export const HandlerProbeSignalSchema = z.strictObject({
81
+ probeVersion: z.string().min(1).max(64),
82
+ hitCount: z.number().int().min(0),
83
+ handlers: z.array(HandlerRefSchema).max(32),
84
+ lateCount: z.number().int().min(0)
85
+ });
86
+ export const StateEntrySchema = z.strictObject({
87
+ key: z.string().min(1).max(512),
88
+ before: z.string().max(1024),
89
+ after: z.string().max(1024)
90
+ });
91
+ export const StateDiffSignalSchema = z.strictObject({
92
+ source: z.enum(["z1-macro", "z2-mirror", "z3-kvc"]),
93
+ changed: z.boolean(),
94
+ entries: z.array(StateEntrySchema).max(64)
95
+ });
96
+ export const SignalsSchema = z.strictObject({
97
+ act: ActSignalSchema,
98
+ axEvent: AxEventSignalSchema.optional(),
99
+ // Z5 channel has no in-process probes: explicit null is the honest boundary;
100
+ // P6 §3.1 opens the object alternative once a GlassPaneProbe connects.
101
+ handlerProbe: z.union([HandlerProbeSignalSchema, z.null()]),
102
+ stateDiff: z.union([StateDiffSignalSchema, z.null()]),
103
+ pixelDiff: PixelDiffSignalSchema.optional(),
104
+ responsiveness: ResponsivenessSignalSchema.optional(),
105
+ crash: CrashSignalSchema.optional()
106
+ });
107
+ export const AttributionSchema = z.strictObject({
108
+ level: AttributionLevelSchema,
109
+ contaminated: z.boolean()
110
+ });
111
+ export const CircuitBreakerSchema = z.strictObject({
112
+ level: CircuitBreakerLevelSchema,
113
+ reason: z.string().optional()
114
+ });
115
+ export const AssertionSchema = z.strictObject({
116
+ kind: z.literal("element_property"),
117
+ selector: SelectorSchema,
118
+ property: AssertionPropertySchema,
119
+ expected: StringOrBoolSchema,
120
+ actual: StringOrBoolSchema,
121
+ passed: z.boolean()
122
+ });
123
+ export const DiagnosisClassSchema = z.enum([
124
+ "T0",
125
+ "T1",
126
+ "T2",
127
+ "T3",
128
+ "T4",
129
+ "T5",
130
+ "T6",
131
+ "T7",
132
+ "T8",
133
+ "T9",
134
+ "NO_ANOMALY",
135
+ "INCONCLUSIVE"
136
+ ]);
137
+ export const DiagnosisReportSchema = z.strictObject({
138
+ path: z.string(),
139
+ anomaly: z.string(),
140
+ evidence: z.string(),
141
+ next: z.string()
142
+ });
143
+ export const DiagnosisSchema = z.strictObject({
144
+ class: DiagnosisClassSchema,
145
+ report: DiagnosisReportSchema
146
+ });
147
+ export const EvidencePackSchema = z.strictObject({
148
+ schemaVersion: z.literal(EVIDENCE_SCHEMA_VERSION),
149
+ operationId: z.string().regex(OPERATION_ID_PATTERN),
150
+ createdAt: z.string().regex(ISO_MILLIS_PATTERN),
151
+ attribution: AttributionSchema,
152
+ circuitBreaker: CircuitBreakerSchema,
153
+ signals: SignalsSchema,
154
+ assertion: z.union([AssertionSchema, z.null()]).optional(),
155
+ diagnosis: z.union([DiagnosisSchema, z.null()]).optional()
156
+ });
157
+ /* ------------------------------------------------------------------ *
158
+ * READ side only. The strict schema above stays the single write
159
+ * contract (nothing may be archived in a legacy shape), but a reader that
160
+ * applies it to the archives on a real machine refuses packs the engine
161
+ * itself produced, which makes the audit trail unreadable.
162
+ *
163
+ * What `normalizeEvidencePackForRead` folds, exhaustively — two shapes, each
164
+ * into a value the frozen schema already accepts, and every one of them only
165
+ * on a copy of the caller's object:
166
+ *
167
+ * 1. `schemaVersion` exactly equal to `LEGACY_EVIDENCE_SCHEMA_VERSION`
168
+ * ("glasspane.evidence/0.1-draft"), the pre-freeze label, onto the frozen
169
+ * const. Third labels — `glasspane.evidence/0.9-next`, a bare "0.1", a
170
+ * non-string — are *not* folded and are refused. The fold is a validation
171
+ * device only: it does not certify that the archive carried the frozen
172
+ * label, so a consumer that renders the version must render the measured
173
+ * label with the reading (mcp-shell's `gp_export_evidence` prints
174
+ * `0.1-draft (read as glasspane.evidence/0.1)`), and the bytes on disk stay
175
+ * untouched for `gp_last_evidence` to hand back verbatim.
176
+ * 2. `signals.pixelDiff` with the `bounds` *key absent*, which fills with
177
+ * `null`. Only absence is repaired: `"bounds": 0`, `"bounds": "x"`, a
178
+ * partial bounds object, and the same absence anywhere else (e.g.
179
+ * `signals.handlerProbe`, `attribution.reason`) are refused — the frozen
180
+ * contract keeps that key and allows null (§4.2) because the daemon's
181
+ * synthesized Swift encoder used to drop the key whenever bounds was nil,
182
+ * which is the commonest outcome of all ("no pixel changed"). The engine
183
+ * now encodes explicit null; archives written before that still have to
184
+ * read.
185
+ *
186
+ * Nothing else is tolerated: unknown keys, missing keys, patterns, enums and
187
+ * ranges all run through `EvidencePackSchema` unchanged.
188
+ *
189
+ * One known difference this read path cannot fix, because it is a producer bug
190
+ * and refusing is the honest outcome: the length rules count *different units*
191
+ * on the two sides. `z.string().max(n)` counts UTF-16 code units, while the
192
+ * Swift writer counts `Character`s and never bounds these fields at all
193
+ * (`StateEntry.key`/`before`/`after` and `HandlerRef.file` have no length rule
194
+ * in `EvidenceModels`), and the probe clamps at 1024 *characters*. For text
195
+ * outside the BMP — an emoji in a state value, a CJK-heavy handler name — the
196
+ * producer's count is smaller than zod's, so an archive the engine legitimately
197
+ * wrote is rejected here and surfaces as "engine and kernel schema drifted".
198
+ * The fix belongs where the bytes are made: `StateEntry`/`HandlerRef` on the
199
+ * Swift side and the probe's clamp must bound by the same unit the schema
200
+ * counts (UTF-16 code units, or UTF-8 bytes if the JSON Schema's `maxLength` is
201
+ * restated in bytes), not by grapheme clusters. Until then a pack carrying a
202
+ * multi-unit value over the cap fails closed here, which is a refusal to read,
203
+ * never a wrong reading.
204
+ * ------------------------------------------------------------------ */
205
+ function isObjectRecord(value) {
206
+ return typeof value === "object" && value !== null && !Array.isArray(value);
207
+ }
208
+ /**
209
+ * Brings a legacy-shaped pack into the frozen contract's shape so the strict
210
+ * schema can validate it unchanged. Pure: the caller's value is never mutated,
211
+ * and a pack that needs no repair is returned as-is.
212
+ */
213
+ function normalizeEvidencePackForRead(input) {
214
+ if (!isObjectRecord(input)) {
215
+ return input;
216
+ }
217
+ const foldsLegacyVersion = input.schemaVersion === LEGACY_EVIDENCE_SCHEMA_VERSION;
218
+ const signals = isObjectRecord(input.signals) ? input.signals : undefined;
219
+ const pixelDiff = signals === undefined ? undefined : signals.pixelDiff;
220
+ const fillsBounds = isObjectRecord(pixelDiff) && signals !== undefined && !("bounds" in pixelDiff);
221
+ if (!foldsLegacyVersion && !fillsBounds) {
222
+ return input;
223
+ }
224
+ const next = { ...input };
225
+ if (foldsLegacyVersion) {
226
+ next.schemaVersion = EVIDENCE_SCHEMA_VERSION;
227
+ }
228
+ if (fillsBounds && signals !== undefined && isObjectRecord(pixelDiff)) {
229
+ next.signals = { ...signals, pixelDiff: { ...pixelDiff, bounds: null } };
230
+ }
231
+ return next;
232
+ }
233
+ /**
234
+ * Read-side contract: `EvidencePackSchema` behind the legacy normalisations
235
+ * documented above. The parsed value always matches the write-side shape, so
236
+ * consumers that *compare* packs (the audit session, signal predicates) never
237
+ * have to model the historical encodings — and consumers that *print* the label
238
+ * must print the one the archive carried alongside this reading, because the
239
+ * fold is not a claim that the bytes said so. Never use this to write a pack —
240
+ * use `EvidencePackSchema`.
241
+ */
242
+ export const EvidencePackReadSchema = z.preprocess(normalizeEvidencePackForRead, EvidencePackSchema);
243
+ //# sourceMappingURL=evidence-pack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence-pack.js","sourceRoot":"","sources":["../src/evidence-pack.ts"],"names":[],"mappings":"AAA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CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IACxE,MAAM,WAAW,GACf,cAAc,CAAC,SAAS,CAAC,IAAI,OAAO,KAAK,SAAS,IAAI,CAAC,CAAC,QAAQ,IAAI,SAAS,CAAC,CAAC;IACjF,IAAI,CAAC,kBAAkB,IAAI,CAAC,WAAW,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,IAAI,GAA4B,EAAE,GAAG,KAAK,EAAE,CAAC;IACnD,IAAI,kBAAkB,EAAE,CAAC;QACvB,IAAI,CAAC,aAAa,GAAG,uBAAuB,CAAC;IAC/C,CAAC;IACD,IAAI,WAAW,IAAI,OAAO,KAAK,SAAS,IAAI,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC;QACtE,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC;IAC3E,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,UAAU,CAChD,4BAA4B,EAC5B,kBAAkB,CACnB,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * iterate-kernel — Phase A
3
+ *
4
+ * Shared kernel of the iterate ecosystem, temporarily hosted in the
5
+ * GlassPane repository (5.8 R43). The JSON Schema files under schemas/ are
6
+ * the single source of truth; the zod mirrors in src/ must stay in sync
7
+ * with them via the shared truth fixtures (assertion C35).
8
+ */
9
+ export { EVIDENCE_PACK_SCHEMA_ID, DECISION_LOG_ENTRY_SCHEMA_ID, RECIPE_CONFIG_SCHEMA_ID, EVIDENCE_PACK_JSON_SCHEMA, DECISION_LOG_ENTRY_JSON_SCHEMA, RECIPE_CONFIG_JSON_SCHEMA, type JsonSchemaObject } from "./schemas.js";
10
+ export { EVIDENCE_SCHEMA_VERSION, OPERATION_ID_PATTERN, ISO_MILLIS_PATTERN, TREE_DIGEST_PATTERN, SELECTOR_MAX_LENGTH, AttributionLevelSchema, CircuitBreakerLevelSchema, SelectorSchema, ActionSchema, AssertionPropertySchema, StringOrBoolSchema, BoundsSchema, AxEventSignalSchema, PixelDiffSignalSchema, ResponsivenessSignalSchema, CrashSignalSchema, ActSignalSchema, HandlerRefSchema, HandlerProbeSignalSchema, StateEntrySchema, StateDiffSignalSchema, SignalsSchema, AttributionSchema, CircuitBreakerSchema, AssertionSchema, DiagnosisClassSchema, DiagnosisReportSchema, DiagnosisSchema, EvidencePackSchema, EvidencePackReadSchema, type AttributionLevel, type CircuitBreakerLevel, type Selector, type Action, type AssertionProperty, type StringOrBool, type Bounds, type AxEventSignal, type PixelDiffSignal, type ResponsivenessSignal, type CrashSignal, type ActSignal, type HandlerRef, type HandlerProbeSignal, type StateEntry, type StateDiffSignal, type Signals, type Attribution, type CircuitBreaker, type Assertion, type DiagnosisClass, type DiagnosisReport, type Diagnosis, type EvidencePack } from "./evidence-pack.js";
11
+ export { DECISION_ENTRY_ID_PATTERN, PREV_ENTRY_HASH_PATTERN, SUMMARY_MAX_LENGTH, DecisionOutcomeSchema, DecisionLogEntrySchema, type DecisionOutcome, type DecisionLogEntry } from "./decision-log-entry.js";
12
+ export { RECIPE_SCHEMA_VERSION, RECIPE_NAME_MAX_LENGTH, RECIPE_MIN_STEPS, RECIPE_MAX_STEPS, RecipeStepKindSchema, RecipeStepSchema, RecipeConfigSchema, type RecipeStepKind, type RecipeStep, type RecipeConfig } from "./recipe-config.js";
13
+ export { DIMENSION_ID_PATTERN, DIMENSION_ID_MAX_LENGTH, DIMENSION_LABEL_MAX_LENGTH, DIMENSION_FOCUS_MAX_LENGTH, DIMENSION_MIN_PLANNED, DIMENSION_MAX_PLANNED, DIMENSION_MAX_OPERATION_IDS, DIMENSION_CONTEXT_CODES, PlannedDimensionSchema, DimensionEvidenceSchema, DimensionStatusSchema, DimensionContextEntrySchema, DimensionContextTotalsSchema, DimensionContextSchema, DimensionContextInputSchema, KernelDimensionError, dimensionContext, formatDimensionContext, type DimensionEvidence, type DimensionStatus, type DimensionContextEntry, type DimensionContextTotals, type DimensionContext, type DimensionContextInput, type KernelDimensionCode } from "./dimension-context.js";
14
+ export { parseEvidencePack, parseEvidencePackRead, parseDecisionLogEntry, parseRecipeConfig, parseDimensionContext, parseDimensionContextInput } from "./parse.js";
15
+ export { canonicalJson } from "./canonical-json.js";
16
+ export { decisionOutcomeFromEvidence, decisionSummaryFromEvidence } from "./evidence-decision.js";
17
+ export { DECISION_LOG_CODES, DecisionLogDraftSchema, KernelDecisionLogError, appendDecisionLogEntry, buildDecisionLogEntry, decisionLogEntryHash, decisionLogHead, newDecisionEntryId, readDecisionLog, serializeDecisionLogEntry, verifyDecisionLogText, type AppendedDecisionLogEntry, type DecisionLogDraft, type DecisionLogVerification, type KernelDecisionLogCode } from "./decision-log.js";
18
+ export { KernelSchemaError, type KernelSchemaIssue } from "./errors.js";
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,uBAAuB,EACvB,4BAA4B,EAC5B,uBAAuB,EACvB,yBAAyB,EACzB,8BAA8B,EAC9B,yBAAyB,EACzB,KAAK,gBAAgB,EACtB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,yBAAyB,EACzB,cAAc,EACd,YAAY,EACZ,uBAAuB,EACvB,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,EAC1B,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,iBAAiB,EACjB,oBA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B,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACzB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAElG,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,yBAAyB,EACzB,qBAAqB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC3B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * iterate-kernel — Phase A
3
+ *
4
+ * Shared kernel of the iterate ecosystem, temporarily hosted in the
5
+ * GlassPane repository (5.8 R43). The JSON Schema files under schemas/ are
6
+ * the single source of truth; the zod mirrors in src/ must stay in sync
7
+ * with them via the shared truth fixtures (assertion C35).
8
+ */
9
+ export { EVIDENCE_PACK_SCHEMA_ID, DECISION_LOG_ENTRY_SCHEMA_ID, RECIPE_CONFIG_SCHEMA_ID, EVIDENCE_PACK_JSON_SCHEMA, DECISION_LOG_ENTRY_JSON_SCHEMA, RECIPE_CONFIG_JSON_SCHEMA } from "./schemas.js";
10
+ export { EVIDENCE_SCHEMA_VERSION, OPERATION_ID_PATTERN, ISO_MILLIS_PATTERN, TREE_DIGEST_PATTERN, SELECTOR_MAX_LENGTH, AttributionLevelSchema, CircuitBreakerLevelSchema, SelectorSchema, ActionSchema, AssertionPropertySchema, StringOrBoolSchema, BoundsSchema, AxEventSignalSchema, PixelDiffSignalSchema, ResponsivenessSignalSchema, CrashSignalSchema, ActSignalSchema, HandlerRefSchema, HandlerProbeSignalSchema, StateEntrySchema, StateDiffSignalSchema, SignalsSchema, AttributionSchema, CircuitBreakerSchema, AssertionSchema, DiagnosisClassSchema, DiagnosisReportSchema, DiagnosisSchema, EvidencePackSchema, EvidencePackReadSchema } from "./evidence-pack.js";
11
+ export { DECISION_ENTRY_ID_PATTERN, PREV_ENTRY_HASH_PATTERN, SUMMARY_MAX_LENGTH, DecisionOutcomeSchema, DecisionLogEntrySchema } from "./decision-log-entry.js";
12
+ export { RECIPE_SCHEMA_VERSION, RECIPE_NAME_MAX_LENGTH, RECIPE_MIN_STEPS, RECIPE_MAX_STEPS, RecipeStepKindSchema, RecipeStepSchema, RecipeConfigSchema } from "./recipe-config.js";
13
+ export { DIMENSION_ID_PATTERN, DIMENSION_ID_MAX_LENGTH, DIMENSION_LABEL_MAX_LENGTH, DIMENSION_FOCUS_MAX_LENGTH, DIMENSION_MIN_PLANNED, DIMENSION_MAX_PLANNED, DIMENSION_MAX_OPERATION_IDS, DIMENSION_CONTEXT_CODES, PlannedDimensionSchema, DimensionEvidenceSchema, DimensionStatusSchema, DimensionContextEntrySchema, DimensionContextTotalsSchema, DimensionContextSchema, DimensionContextInputSchema, KernelDimensionError, dimensionContext, formatDimensionContext } from "./dimension-context.js";
14
+ export { parseEvidencePack, parseEvidencePackRead, parseDecisionLogEntry, parseRecipeConfig, parseDimensionContext, parseDimensionContextInput } from "./parse.js";
15
+ export { canonicalJson } from "./canonical-json.js";
16
+ export { decisionOutcomeFromEvidence, decisionSummaryFromEvidence } from "./evidence-decision.js";
17
+ export { DECISION_LOG_CODES, DecisionLogDraftSchema, KernelDecisionLogError, appendDecisionLogEntry, buildDecisionLogEntry, decisionLogEntryHash, decisionLogHead, newDecisionEntryId, readDecisionLog, serializeDecisionLogEntry, verifyDecisionLogText } from "./decision-log.js";
18
+ export { KernelSchemaError } from "./errors.js";
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,uBAAuB,EACvB,4BAA4B,EAC5B,uBAAuB,EACvB,yBAAyB,EACzB,8BAA8B,EAC9B,yBAAyB,EAE1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,yBAAyB,EACzB,cAAc,EACd,YAAY,EACZ,uBAAuB,EACvB,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,EAC1B,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EAyBvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EAGvB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAInB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,EACrB,2BAA2B,EAC3B,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,2BAA2B,EAC3B,4BAA4B,EAC5B,sBAAsB,EACtB,2BAA2B,EAC3B,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EAQvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAElG,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,yBAAyB,EACzB,qBAAqB,EAKtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,iBAAiB,EAA0B,MAAM,aAAa,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { type EvidencePack } from "./evidence-pack.js";
2
+ import { type DecisionLogEntry } from "./decision-log-entry.js";
3
+ import { type DimensionContext, type DimensionContextInput } from "./dimension-context.js";
4
+ import { type RecipeConfig } from "./recipe-config.js";
5
+ export declare function parseEvidencePack(input: unknown): EvidencePack;
6
+ /**
7
+ * Reads an evidence pack produced by the engine, tolerating only the two
8
+ * legacy shapes documented on `EvidencePackReadSchema` (pre-freeze
9
+ * `0.1-draft` label, `pixelDiff.bounds` key omitted by the older encoder).
10
+ * The result always matches the write-side contract, so a caller can hand it
11
+ * to anything typed against `EvidencePack` — which also means the pre-freeze
12
+ * label comes back as the frozen const. Only this derived value is folded: the
13
+ * archived bytes, and the frame a consumer passes straight through, keep their
14
+ * own label. Use `parseEvidencePack` for anything being written: it refuses
15
+ * both legacy shapes.
16
+ */
17
+ export declare function parseEvidencePackRead(input: unknown): EvidencePack;
18
+ export declare function parseDecisionLogEntry(input: unknown): DecisionLogEntry;
19
+ export declare function parseRecipeConfig(input: unknown): RecipeConfig;
20
+ export declare function parseDimensionContext(input: unknown): DimensionContext;
21
+ export declare function parseDimensionContextInput(input: unknown): DimensionContextInput;
22
+ //# sourceMappingURL=parse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACxF,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAkB3E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAE9D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAMlE;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAEtE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAE9D;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAEtE;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,CAEhF"}
package/dist/parse.js ADDED
@@ -0,0 +1,53 @@
1
+ import { KernelSchemaError } from "./errors.js";
2
+ import { EvidencePackReadSchema, EvidencePackSchema } from "./evidence-pack.js";
3
+ import { DecisionLogEntrySchema } from "./decision-log-entry.js";
4
+ import { DimensionContextInputSchema, DimensionContextSchema } from "./dimension-context.js";
5
+ import { RecipeConfigSchema } from "./recipe-config.js";
6
+ function schemaError(label, error) {
7
+ const issues = error.issues.map((issue) => ({
8
+ path: issue.path.map((segment) => String(segment)).join("."),
9
+ message: issue.message
10
+ }));
11
+ return new KernelSchemaError(label, issues);
12
+ }
13
+ function parseOrThrow(schema, input, label) {
14
+ const result = schema.safeParse(input);
15
+ if (result.success) {
16
+ return result.data;
17
+ }
18
+ throw schemaError(label, result.error);
19
+ }
20
+ export function parseEvidencePack(input) {
21
+ return parseOrThrow(EvidencePackSchema, input, "evidence pack");
22
+ }
23
+ /**
24
+ * Reads an evidence pack produced by the engine, tolerating only the two
25
+ * legacy shapes documented on `EvidencePackReadSchema` (pre-freeze
26
+ * `0.1-draft` label, `pixelDiff.bounds` key omitted by the older encoder).
27
+ * The result always matches the write-side contract, so a caller can hand it
28
+ * to anything typed against `EvidencePack` — which also means the pre-freeze
29
+ * label comes back as the frozen const. Only this derived value is folded: the
30
+ * archived bytes, and the frame a consumer passes straight through, keep their
31
+ * own label. Use `parseEvidencePack` for anything being written: it refuses
32
+ * both legacy shapes.
33
+ */
34
+ export function parseEvidencePackRead(input) {
35
+ const result = EvidencePackReadSchema.safeParse(input);
36
+ if (result.success) {
37
+ return result.data;
38
+ }
39
+ throw schemaError("evidence pack", result.error);
40
+ }
41
+ export function parseDecisionLogEntry(input) {
42
+ return parseOrThrow(DecisionLogEntrySchema, input, "decision log entry");
43
+ }
44
+ export function parseRecipeConfig(input) {
45
+ return parseOrThrow(RecipeConfigSchema, input, "recipe config");
46
+ }
47
+ export function parseDimensionContext(input) {
48
+ return parseOrThrow(DimensionContextSchema, input, "dimension context");
49
+ }
50
+ export function parseDimensionContextInput(input) {
51
+ return parseOrThrow(DimensionContextInputSchema, input, "dimension context input");
52
+ }
53
+ //# sourceMappingURL=parse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAEnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAyB,MAAM,yBAAyB,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AAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,OAAO,YAAY,CAAC,sBAAsB,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,YAAY,CAAC,kBAAkB,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,OAAO,YAAY,CAAC,sBAAsB,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,KAAc;IACvD,OAAO,YAAY,CAAC,2BAA2B,EAAE,KAAK,EAAE,yBAAyB,CAAC,CAAC;AACrF,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { z } from "zod";
2
+ export declare const RECIPE_SCHEMA_VERSION: "glasspane.recipe/0.1-draft";
3
+ export declare const RECIPE_NAME_MAX_LENGTH = 256;
4
+ export declare const RECIPE_MIN_STEPS = 1;
5
+ export declare const RECIPE_MAX_STEPS = 64;
6
+ export declare const RecipeStepKindSchema: z.ZodEnum<["act", "observe", "assert", "diagnose"]>;
7
+ export type RecipeStepKind = z.infer<typeof RecipeStepKindSchema>;
8
+ export declare const RecipeStepSchema: z.ZodObject<{
9
+ kind: z.ZodEnum<["act", "observe", "assert", "diagnose"]>;
10
+ params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
11
+ }, "strict", z.ZodTypeAny, {
12
+ params: Record<string, unknown>;
13
+ kind: "act" | "observe" | "assert" | "diagnose";
14
+ }, {
15
+ params: Record<string, unknown>;
16
+ kind: "act" | "observe" | "assert" | "diagnose";
17
+ }>;
18
+ export type RecipeStep = z.infer<typeof RecipeStepSchema>;
19
+ export declare const RecipeConfigSchema: z.ZodObject<{
20
+ schemaVersion: z.ZodLiteral<"glasspane.recipe/0.1-draft">;
21
+ name: z.ZodString;
22
+ steps: z.ZodArray<z.ZodObject<{
23
+ kind: z.ZodEnum<["act", "observe", "assert", "diagnose"]>;
24
+ params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
25
+ }, "strict", z.ZodTypeAny, {
26
+ params: Record<string, unknown>;
27
+ kind: "act" | "observe" | "assert" | "diagnose";
28
+ }, {
29
+ params: Record<string, unknown>;
30
+ kind: "act" | "observe" | "assert" | "diagnose";
31
+ }>, "many">;
32
+ }, "strict", z.ZodTypeAny, {
33
+ schemaVersion: "glasspane.recipe/0.1-draft";
34
+ name: string;
35
+ steps: {
36
+ params: Record<string, unknown>;
37
+ kind: "act" | "observe" | "assert" | "diagnose";
38
+ }[];
39
+ }, {
40
+ schemaVersion: "glasspane.recipe/0.1-draft";
41
+ name: string;
42
+ steps: {
43
+ params: Record<string, unknown>;
44
+ kind: "act" | "observe" | "assert" | "diagnose";
45
+ }[];
46
+ }>;
47
+ export type RecipeConfig = z.infer<typeof RecipeConfigSchema>;
48
+ //# sourceMappingURL=recipe-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recipe-config.d.ts","sourceRoot":"","sources":["../src/recipe-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,qBAAqB,EAAG,4BAAqC,CAAC;AAE3E,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAClC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,eAAO,MAAM,oBAAoB,qDAAmD,CAAC;AACrF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,gBAAgB;;;;;;;;;EAO3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ export const RECIPE_SCHEMA_VERSION = "glasspane.recipe/0.1-draft";
3
+ export const RECIPE_NAME_MAX_LENGTH = 256;
4
+ export const RECIPE_MIN_STEPS = 1;
5
+ export const RECIPE_MAX_STEPS = 64;
6
+ export const RecipeStepKindSchema = z.enum(["act", "observe", "assert", "diagnose"]);
7
+ export const RecipeStepSchema = z.strictObject({
8
+ kind: RecipeStepKindSchema,
9
+ // Two-argument `z.record`: valid on the zod 3 this package pins *and* on zod 4,
10
+ // which made the key type mandatory. The fork of opencode runs zod 4, and its
11
+ // typecheck caught this as `TS2554: Expected 2-3 arguments, but got 1` — a
12
+ // latent break waiting for the day this package's zod is bumped.
13
+ params: z.record(z.string(), z.unknown())
14
+ });
15
+ export const RecipeConfigSchema = z.strictObject({
16
+ schemaVersion: z.literal(RECIPE_SCHEMA_VERSION),
17
+ name: z.string().max(RECIPE_NAME_MAX_LENGTH),
18
+ steps: z.array(RecipeStepSchema).min(RECIPE_MIN_STEPS).max(RECIPE_MAX_STEPS)
19
+ });
20
+ //# sourceMappingURL=recipe-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recipe-config.js","sourceRoot":"","sources":["../src/recipe-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,qBAAqB,GAAG,4BAAqC,CAAC;AAE3E,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAC1C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAClC,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AAGrF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,YAAY,CAAC;IAC7C,IAAI,EAAE,oBAAoB;IAC1B,gFAAgF;IAChF,8EAA8E;IAC9E,2EAA2E;IAC3E,iEAAiE;IACjE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;CAC1C,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,YAAY,CAAC;IAC/C,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC;IAC/C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,sBAAsB,CAAC;IAC5C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,gBAAgB,CAAC;CAC7E,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare const EVIDENCE_PACK_SCHEMA_ID: "https://schemas.iterate.dev/evidence-pack-0.1.json";
2
+ export declare const DECISION_LOG_ENTRY_SCHEMA_ID: "https://schemas.iterate.dev/decision-log-entry-0.1-draft.json";
3
+ export declare const RECIPE_CONFIG_SCHEMA_ID: "https://schemas.iterate.dev/recipe-config-0.1-draft.json";
4
+ export interface JsonSchemaObject {
5
+ readonly $id: string;
6
+ readonly [key: string]: unknown;
7
+ }
8
+ export declare const EVIDENCE_PACK_JSON_SCHEMA: JsonSchemaObject;
9
+ export declare const DECISION_LOG_ENTRY_JSON_SCHEMA: JsonSchemaObject;
10
+ export declare const RECIPE_CONFIG_JSON_SCHEMA: JsonSchemaObject;
11
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +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;AAEtE,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"}
@@ -0,0 +1,19 @@
1
+ import { createRequire } from "node:module";
2
+ /**
3
+ * The JSON Schema files under schemas/ are the single source of truth for the
4
+ * C35 dual-language contract. They are loaded at module init from the
5
+ * package-local schemas/ directory so that consumers of iterate-kernel
6
+ * always see the same schema objects that the engine-side tests validate
7
+ * against (never an embedded copy).
8
+ */
9
+ const nodeRequire = createRequire(import.meta.url);
10
+ export const EVIDENCE_PACK_SCHEMA_ID = "https://schemas.iterate.dev/evidence-pack-0.1.json";
11
+ export const DECISION_LOG_ENTRY_SCHEMA_ID = "https://schemas.iterate.dev/decision-log-entry-0.1-draft.json";
12
+ export const RECIPE_CONFIG_SCHEMA_ID = "https://schemas.iterate.dev/recipe-config-0.1-draft.json";
13
+ function loadSchema(relativePath) {
14
+ return nodeRequire(relativePath);
15
+ }
16
+ export const EVIDENCE_PACK_JSON_SCHEMA = loadSchema("../schemas/evidence-pack.schema.json");
17
+ export const DECISION_LOG_ENTRY_JSON_SCHEMA = loadSchema("../schemas/decision-log-entry.schema.json");
18
+ export const RECIPE_CONFIG_JSON_SCHEMA = loadSchema("../schemas/recipe-config.schema.json");
19
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +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;AAOtE,SAAS,UAAU,CAAC,YAAoB;IACtC,OAAO,WAAW,CAAC,YAAY,CAAqB,CAAC;AACvD,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAqB,UAAU,CACnE,sCAAsC,CACvC,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAqB,UAAU,CACxE,2CAA2C,CAC5C,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAqB,UAAU,CACnE,sCAAsC,CACvC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "iterate-kernel",
3
+ "version": "0.1.0-draft.1",
4
+ "private": false,
5
+ "description": "iterate ecosystem shared kernel: schemas, the evidence->decision transcription, the decision-log audit chain and public validators. Verification reasoning stays in the engine; this layer transcribes.",
6
+ "type": "module",
7
+ "engines": {
8
+ "node": ">=18"
9
+ },
10
+ "main": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ "./canonical-json": {
14
+ "types": "./dist/canonical-json.d.ts",
15
+ "default": "./dist/canonical-json.js"
16
+ },
17
+ "./decision-log": {
18
+ "types": "./dist/decision-log.d.ts",
19
+ "default": "./dist/decision-log.js"
20
+ },
21
+ "./decision-log-entry": {
22
+ "types": "./dist/decision-log-entry.d.ts",
23
+ "default": "./dist/decision-log-entry.js"
24
+ },
25
+ "./dimension-context": {
26
+ "types": "./dist/dimension-context.d.ts",
27
+ "default": "./dist/dimension-context.js"
28
+ },
29
+ "./errors": {
30
+ "types": "./dist/errors.d.ts",
31
+ "default": "./dist/errors.js"
32
+ },
33
+ "./evidence-decision": {
34
+ "types": "./dist/evidence-decision.d.ts",
35
+ "default": "./dist/evidence-decision.js"
36
+ },
37
+ "./evidence-pack": {
38
+ "types": "./dist/evidence-pack.d.ts",
39
+ "default": "./dist/evidence-pack.js"
40
+ },
41
+ "./index": {
42
+ "types": "./dist/index.d.ts",
43
+ "default": "./dist/index.js"
44
+ },
45
+ "./parse": {
46
+ "types": "./dist/parse.d.ts",
47
+ "default": "./dist/parse.js"
48
+ },
49
+ "./recipe-config": {
50
+ "types": "./dist/recipe-config.d.ts",
51
+ "default": "./dist/recipe-config.js"
52
+ },
53
+ "./schemas": {
54
+ "types": "./dist/schemas.d.ts",
55
+ "default": "./dist/schemas.js"
56
+ },
57
+ ".": {
58
+ "types": "./dist/index.d.ts",
59
+ "default": "./dist/index.js"
60
+ }
61
+ },
62
+ "files": [
63
+ "dist",
64
+ "schemas",
65
+ "README.md"
66
+ ],
67
+ "scripts": {
68
+ "build": "tsc -p tsconfig.json",
69
+ "test": "npm run build && node --test test/*.test.mjs",
70
+ "prepublishOnly": "npm run build"
71
+ },
72
+ "dependencies": {
73
+ "zod": ">=3.25.76 <5"
74
+ },
75
+ "devDependencies": {
76
+ "@types/node": "26.5.1",
77
+ "ajv": "8.20.0",
78
+ "typescript": "5.9.3"
79
+ },
80
+ "license": "MIT",
81
+ "publishConfig": {
82
+ "access": "public"
83
+ }
84
+ }