iterate-kernel 0.1.0-draft.1 → 0.1.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.
- package/README.md +47 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,8 +35,55 @@ APIs it actually uses.
|
|
|
35
35
|
| `evidence-pack` / `parse` | the evidence pack shape, and parsing/validating one |
|
|
36
36
|
| `evidence-decision` | the **transcription**: evidence (attribution level, circuit-breaker level, pass/fail/inconclusive) → a decision outcome and a human summary. It reads fields the engine already decided; it never infers. |
|
|
37
37
|
| `decision-log-entry` / `decision-log` | the append-only decision-log entry and the `opID ↔ entry` hash chain that makes it auditable |
|
|
38
|
+
| `dimension-context` / `parse` | the dimension-coverage transcription: a plan plus what the engine actually recorded → verified / unverified / unplanned, and one line to put in a summary. It validates id *shape*, never which ids exist — that list belongs to whoever configured the run. |
|
|
38
39
|
| `errors` / `schemas` / `canonical-json` / `recipe-config` | `KernelSchemaError`, the JSON Schemas, canonical serialisation, recipe validation |
|
|
39
40
|
|
|
41
|
+
## A runnable example
|
|
42
|
+
|
|
43
|
+
This is the whole surface in one file, and it is the shape the API actually wants. Two details
|
|
44
|
+
cost real time to discover, so they are written out here rather than left to the error messages:
|
|
45
|
+
|
|
46
|
+
- **the ledger path is a first argument, not a field.** There is no default location, on purpose:
|
|
47
|
+
a durable audit chain should not be created wherever a process happened to start.
|
|
48
|
+
- **`entryId` and `createdAt` are yours to supply** (`sequence` and `prevEntryHash` are derived
|
|
49
|
+
from the ledger and must *not* be sent). `newDecisionEntryId()` mints one in the required
|
|
50
|
+
`dl_<26 Crockford>` form.
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { decisionOutcomeFromEvidence, decisionSummaryFromEvidence } from "iterate-kernel/evidence-decision"
|
|
54
|
+
import { appendDecisionLogEntry, newDecisionEntryId } from "iterate-kernel/decision-log"
|
|
55
|
+
import { parseEvidencePack, parseDimensionContextInput } from "iterate-kernel/parse"
|
|
56
|
+
import { dimensionContext, formatDimensionContext } from "iterate-kernel/dimension-context"
|
|
57
|
+
import { resolve } from "node:path"
|
|
58
|
+
|
|
59
|
+
const pack = parseEvidencePack(await readFile("evidence.json", "utf8").then(JSON.parse))
|
|
60
|
+
const outcome = decisionOutcomeFromEvidence(pack)
|
|
61
|
+
|
|
62
|
+
// the transcription — never an inference; it reads what the engine already decided
|
|
63
|
+
console.log(outcome, decisionSummaryFromEvidence(pack))
|
|
64
|
+
|
|
65
|
+
// the audit chain — refuses to append onto a tail it cannot re-hash
|
|
66
|
+
appendDecisionLogEntry(resolve("ledger.jsonl"), {
|
|
67
|
+
entryId: newDecisionEntryId(),
|
|
68
|
+
createdAt: new Date().toISOString(),
|
|
69
|
+
operationId: pack.operationId,
|
|
70
|
+
outcome,
|
|
71
|
+
summary: decisionSummaryFromEvidence(pack),
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
// dimension coverage — `recorded` is what the engine logged, not what you hoped it would
|
|
75
|
+
const input = parseDimensionContextInput({
|
|
76
|
+
planned: [{ id: "correctness" }, { id: "security" }, { id: "ui-ux" }],
|
|
77
|
+
recorded: { security: { decisions: 3, operationIds: [pack.operationId] } },
|
|
78
|
+
})
|
|
79
|
+
// -> "1/3 dimensions verified, 2 unverified (correctness, ui-ux), 3 decisions"
|
|
80
|
+
console.log(formatDimensionContext(dimensionContext(input)))
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`parseDimensionContextInput` returns the *validated input*; `dimensionContext` computes the
|
|
84
|
+
context; `formatDimensionContext` renders the line. Anything recorded but never planned shows up
|
|
85
|
+
as `unplanned` — a reporter that quietly dropped it would be the failure this exists to prevent.
|
|
86
|
+
|
|
40
87
|
## Versioning
|
|
41
88
|
|
|
42
89
|
`0.1.x` is pre-stable. The schemas and the transcription rules are the contract every
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iterate-kernel",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"private": false,
|
|
5
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
6
|
"type": "module",
|