loopforge 3.7.1 → 3.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -130
- package/dist/audit.d.ts +53 -1
- package/dist/audit.d.ts.map +1 -1
- package/dist/audit.js +106 -22
- package/dist/audit.js.map +1 -1
- package/dist/canonical-state.d.ts +52 -67
- package/dist/canonical-state.d.ts.map +1 -1
- package/dist/canonical-state.js +134 -147
- package/dist/canonical-state.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +103 -4
- package/dist/cli.js.map +1 -1
- package/dist/cognitive-facts.d.ts +13 -0
- package/dist/cognitive-facts.d.ts.map +1 -1
- package/dist/cognitive-facts.js +28 -13
- package/dist/cognitive-facts.js.map +1 -1
- package/dist/committed-round.d.ts +103 -21
- package/dist/committed-round.d.ts.map +1 -1
- package/dist/committed-round.js +188 -45
- package/dist/committed-round.js.map +1 -1
- package/dist/contract-items.d.ts +55 -0
- package/dist/contract-items.d.ts.map +1 -0
- package/dist/contract-items.js +180 -0
- package/dist/contract-items.js.map +1 -0
- package/dist/enforcement-gate.d.ts +20 -2
- package/dist/enforcement-gate.d.ts.map +1 -1
- package/dist/enforcement-gate.js +197 -386
- package/dist/enforcement-gate.js.map +1 -1
- package/dist/engine.d.ts +1 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +53 -38
- package/dist/engine.js.map +1 -1
- package/dist/evidence-claims.d.ts +4 -4
- package/dist/evidence-claims.d.ts.map +1 -1
- package/dist/evidence-claims.js +16 -14
- package/dist/evidence-claims.js.map +1 -1
- package/dist/evidence-provider.d.ts +85 -89
- package/dist/evidence-provider.d.ts.map +1 -1
- package/dist/evidence-provider.js +328 -184
- package/dist/evidence-provider.js.map +1 -1
- package/dist/explain.d.ts +76 -0
- package/dist/explain.d.ts.map +1 -0
- package/dist/explain.js +127 -0
- package/dist/explain.js.map +1 -0
- package/dist/generate-schema.js +152 -16
- package/dist/generate-schema.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/loop-compiler.d.ts +40 -53
- package/dist/loop-compiler.d.ts.map +1 -1
- package/dist/loop-compiler.js +229 -553
- package/dist/loop-compiler.js.map +1 -1
- package/dist/loop-extras-parser.d.ts +0 -1
- package/dist/loop-extras-parser.d.ts.map +1 -1
- package/dist/loop-extras-parser.js +0 -4
- package/dist/loop-extras-parser.js.map +1 -1
- package/dist/loop-projection.d.ts.map +1 -1
- package/dist/loop-projection.js +3 -1
- package/dist/loop-projection.js.map +1 -1
- package/dist/mcp/round-lifecycle.d.ts +30 -21
- package/dist/mcp/round-lifecycle.d.ts.map +1 -1
- package/dist/mcp/round-lifecycle.js +47 -103
- package/dist/mcp/round-lifecycle.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +51 -7
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/session.d.ts +39 -23
- package/dist/mcp/session.d.ts.map +1 -1
- package/dist/mcp/session.js +148 -163
- package/dist/mcp/session.js.map +1 -1
- package/dist/mcp/submission-boundary.d.ts +89 -0
- package/dist/mcp/submission-boundary.d.ts.map +1 -0
- package/dist/mcp/submission-boundary.js +203 -0
- package/dist/mcp/submission-boundary.js.map +1 -0
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +249 -128
- package/dist/mcp/tools.js.map +1 -1
- package/dist/policy-metrics.js +2 -2
- package/dist/policy-metrics.js.map +1 -1
- package/dist/policy.d.ts +55 -93
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +149 -38
- package/dist/policy.js.map +1 -1
- package/dist/prompt-assembler.d.ts +1 -32
- package/dist/prompt-assembler.d.ts.map +1 -1
- package/dist/prompt-assembler.js +282 -435
- package/dist/prompt-assembler.js.map +1 -1
- package/dist/prompt-policy.d.ts +1 -4
- package/dist/prompt-policy.d.ts.map +1 -1
- package/dist/prompt-policy.js +6 -7
- package/dist/prompt-policy.js.map +1 -1
- package/dist/protocol.d.ts +365 -142
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +21 -66
- package/dist/protocol.js.map +1 -1
- package/dist/replay.js +2 -2
- package/dist/replay.js.map +1 -1
- package/dist/round-contract.d.ts +69 -57
- package/dist/round-contract.d.ts.map +1 -1
- package/dist/round-contract.js +104 -64
- package/dist/round-contract.js.map +1 -1
- package/dist/round-coordinator.d.ts +36 -16
- package/dist/round-coordinator.d.ts.map +1 -1
- package/dist/round-coordinator.js +166 -102
- package/dist/round-coordinator.js.map +1 -1
- package/dist/round-driver.d.ts +3 -5
- package/dist/round-driver.d.ts.map +1 -1
- package/dist/round-driver.js +0 -1
- package/dist/round-driver.js.map +1 -1
- package/dist/round-facts.d.ts +96 -0
- package/dist/round-facts.d.ts.map +1 -0
- package/dist/round-facts.js +216 -0
- package/dist/round-facts.js.map +1 -0
- package/dist/round-transaction.d.ts +19 -9
- package/dist/round-transaction.d.ts.map +1 -1
- package/dist/round-transaction.js +90 -22
- package/dist/round-transaction.js.map +1 -1
- package/dist/self-eval.d.ts +87 -9
- package/dist/self-eval.d.ts.map +1 -1
- package/dist/self-eval.js +396 -27
- package/dist/self-eval.js.map +1 -1
- package/dist/subgoal-state.d.ts +77 -0
- package/dist/subgoal-state.d.ts.map +1 -0
- package/dist/subgoal-state.js +198 -0
- package/dist/subgoal-state.js.map +1 -0
- package/dist/token-utils.d.ts +52 -19
- package/dist/token-utils.d.ts.map +1 -1
- package/dist/token-utils.js +83 -72
- package/dist/token-utils.js.map +1 -1
- package/dist/verification-gate.d.ts +14 -31
- package/dist/verification-gate.d.ts.map +1 -1
- package/dist/verification-gate.js +178 -496
- package/dist/verification-gate.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/workspace.d.ts +9 -0
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +17 -0
- package/dist/workspace.js.map +1 -1
- package/loop_policy.json +59 -83
- package/package.json +67 -67
- package/skills/perception/SKILL.md +218 -204
package/README.md
CHANGED
|
@@ -1,168 +1,122 @@
|
|
|
1
|
-
# LoopForge
|
|
1
|
+
# LoopForge package
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The `loopforge` package is the TypeScript runtime behind LoopForge. It keeps
|
|
4
|
+
round state durable, collects machine evidence, verifies submitted claims, and
|
|
5
|
+
compiles the next prompt. The external coding Agent still owns planning, file
|
|
6
|
+
changes, tool use, and execution.
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
For the product model and the contract mental model, read the
|
|
9
|
+
[root README](../README.md) or [中文说明](../README.zh-CN.md). This document is
|
|
10
|
+
the package and integration reference.
|
|
7
11
|
|
|
8
|
-
|
|
12
|
+
**Requirements:** Node.js >= 18. Zero runtime dependencies. The package version
|
|
13
|
+
is defined only by the `version` field in `package.json`.
|
|
9
14
|
|
|
10
|
-
##
|
|
15
|
+
## Install and run
|
|
11
16
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
### Problem 2: Self-correction doesn't work
|
|
19
|
-
|
|
20
|
-
Models cannot reliably improve themselves through introspection — they talk themselves out of correct answers. Effective recovery requires an **external verifier** — an independent observer that doesn't share the agent's context, doesn't participate in its reasoning, and only looks at inputs and outputs.
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g loopforge
|
|
19
|
+
loopforge init --client claude
|
|
20
|
+
claude mcp add loopforge -- npx loopforge mcp
|
|
21
|
+
```
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
The CLI provides the following entry points:
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
```text
|
|
26
|
+
loopforge mcp
|
|
27
|
+
loopforge init --client claude|codex|generic [--target DIR] [--force]
|
|
28
|
+
loopforge doctor [--json]
|
|
29
|
+
loopforge inspect LOOP_ID [--round N] [--prompt] [--json]
|
|
30
|
+
loopforge explain LOOP_ID [--round N] [--json]
|
|
31
|
+
```
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
`loopforge mcp` starts the synchronous MCP server. `init` installs the client
|
|
34
|
+
configuration, `doctor` reports local readiness, `inspect` reads persisted loop
|
|
35
|
+
state, and `explain` shows why a committed round received its disposition.
|
|
27
36
|
|
|
28
|
-
|
|
37
|
+
## MCP integration
|
|
29
38
|
|
|
30
|
-
|
|
39
|
+
The MCP server exposes nine tools:
|
|
31
40
|
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
- `loopforge_start` creates a session and returns the first prompt.
|
|
42
|
+
- `loopforge_next` submits the structured evaluation for the held round.
|
|
43
|
+
- `loopforge_status` returns session, loop, audit, or explain views.
|
|
44
|
+
- `loopforge_stop` intentionally stops a session.
|
|
45
|
+
- `loopforge_pause` pauses a session at a round boundary.
|
|
46
|
+
- `loopforge_resume` reconstructs a durable session.
|
|
47
|
+
- `loopforge_replay` reads the committed timeline and round diffs.
|
|
48
|
+
- `loopforge_gate_check` preflights a high-risk action.
|
|
49
|
+
- `loopforge_gate_resolve` records the decision for an opened user gate.
|
|
34
50
|
|
|
35
|
-
|
|
36
|
-
|
|
51
|
+
The two gate tools are opt-in through `policy.gate.enabled` and are hidden from
|
|
52
|
+
`tools/list` when disabled. A gate decision is an auditable process record. It
|
|
53
|
+
does not prove that a human was present because the Agent submits the resolve
|
|
54
|
+
call.
|
|
37
55
|
|
|
38
|
-
`loopforge_next`
|
|
39
|
-
`output_summary`, `constraint_violations`, and
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
a
|
|
56
|
+
Every `loopforge_next` submission must include the four strict evaluation
|
|
57
|
+
fields: `success`, `output_summary`, `constraint_violations`, and
|
|
58
|
+
`should_continue`. `round_contract`, `subgoal_updates`, and
|
|
59
|
+
`execution_report.contract_item_claims` are also strict structural boundaries.
|
|
60
|
+
Malformed payloads return a retryable error for the same `roundId` without
|
|
61
|
+
writing session state, a round, gate records, rejection counters, or metrics.
|
|
62
|
+
Agent reports remain claims. Only independent observations can support a
|
|
63
|
+
verified fact.
|
|
43
64
|
|
|
44
|
-
|
|
45
|
-
organized into four domains (evaluation consistency, evidence integrity, plan
|
|
46
|
-
& contract, progress & recovery), and an enforcement gate driven by one
|
|
47
|
-
ordered strategy table across four action classes (evidence contradiction,
|
|
48
|
-
contract & scope, plan drift, progress recovery). Only an allowed round joins
|
|
49
|
-
committed history. The shared internal `CommittedRoundView` gives Replay,
|
|
50
|
-
Audit, Metrics, contracts, the compiler, and gate history one decoder and one
|
|
51
|
-
filtering policy. It does not create another storage format.
|
|
65
|
+
## TypeScript API
|
|
52
66
|
|
|
53
|
-
The
|
|
54
|
-
focus, todo, phase, delegation, and handoff for prompts and status views. The
|
|
55
|
-
next prompt therefore comes from typed cognitive state, not from a summary of
|
|
56
|
-
the previous prompt.
|
|
67
|
+
The package exports the runtime in separate entry points:
|
|
57
68
|
|
|
58
69
|
```text
|
|
59
|
-
|
|
60
|
-
|
|
70
|
+
loopforge protocol types, policy, store, compiler, engine, evidence,
|
|
71
|
+
transactions, metrics, and MCP classes
|
|
72
|
+
loopforge/compiler compiler helpers
|
|
73
|
+
loopforge/replay ReplayBackend
|
|
74
|
+
loopforge/mcp MCP server entry point
|
|
61
75
|
```
|
|
62
76
|
|
|
63
|
-
The
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## What LoopForge is not
|
|
77
|
+
The main exports include `createEngine` and `LoopForgeEngine` for an in-process
|
|
78
|
+
engine, `FileLoopStore` for durable JSON storage, `compileLoop` for compiling a
|
|
79
|
+
prompt from committed facts, `ReplayBackend` for read-only history queries,
|
|
80
|
+
`McpServer` for the MCP transport, and `SessionManager` for durable MCP
|
|
81
|
+
sessions. Type declarations are emitted alongside the runtime in `dist/`.
|
|
72
82
|
|
|
73
|
-
|
|
74
|
-
rounds hold facts, and Canonical State supplies runtime cognition.
|
|
75
|
-
- **Not a context compressor.** It recompiles prompts from typed state instead
|
|
76
|
-
of compressing the prior prompt.
|
|
77
|
-
- **Not a constraint tracker.** Constraints are one input to external judgment.
|
|
78
|
-
- **Not an agent or unattended executor.** The external agent owns planning,
|
|
79
|
-
code changes, and tool use. LoopForge governs round transitions.
|
|
83
|
+
Example import:
|
|
80
84
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
## Install
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
npm install -g loopforge
|
|
87
|
-
loopforge init --client claude
|
|
88
|
-
claude mcp add loopforge -- npx loopforge mcp
|
|
85
|
+
```ts
|
|
86
|
+
import { createEngine, FileLoopStore, compileLoop } from "loopforge";
|
|
89
87
|
```
|
|
90
88
|
|
|
91
|
-
|
|
89
|
+
Use the generated `.d.ts` files in `dist/` for the exact signatures and input
|
|
90
|
+
types. The public protocol constructors and types are exported from the main
|
|
91
|
+
entry point.
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
the full cognitive infrastructure: verification gate, enforcement gate,
|
|
95
|
-
backtrack, evidence collection, and crash recovery. The engine is also
|
|
96
|
-
available as a library for custom integrations.
|
|
93
|
+
## Persistence and policy
|
|
97
94
|
|
|
98
|
-
|
|
95
|
+
LoopForge stores durable loop data under `.loopforge/loops/` and derived human
|
|
96
|
+
state under `.loopforge/state/`. Committed typed round documents are the source
|
|
97
|
+
of truth. The state file can be regenerated and must not be treated as a second
|
|
98
|
+
history.
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
External agent
|
|
104
|
-
-> structured evaluation
|
|
105
|
-
-> evidence / verification / enforcement
|
|
106
|
-
-> accept, reject, backtrack, or terminate
|
|
107
|
-
reject / terminate: no round commit
|
|
108
|
-
accept / stop / backtrack: commit transaction decision
|
|
109
|
-
-> committed round documents [factual source]
|
|
110
|
-
-> CommittedRoundView [shared read model]
|
|
111
|
-
-> Replay [what happened]
|
|
112
|
-
-> Audit / Metrics [evidence and diagnostics]
|
|
113
|
-
-> Canonical State [cognitive source]
|
|
114
|
-
-> DerivedCognitiveFacts
|
|
115
|
-
-> prompt / state file / status
|
|
116
|
-
-> external agent, next round
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## Key capabilities
|
|
122
|
-
|
|
123
|
-
- Structured evaluation with strict core fields, lenient optional normalization,
|
|
124
|
-
and retryable `evaluation_invalid` responses.
|
|
125
|
-
- One committed-round history for the compiler, contracts, gates, Replay,
|
|
126
|
-
Audit, and Metrics.
|
|
127
|
-
- One Canonical State for prompts, the optional state file, and current-status
|
|
128
|
-
cognition.
|
|
129
|
-
- Evidence-backed accept, reject, backtrack, and terminate decisions, including
|
|
130
|
-
Round Contract and workspace-restore checks. A backtrack carries a derived
|
|
131
|
-
Recovery Brief — trigger rule, restore point, redo round ID, failed
|
|
132
|
-
approaches, and falsified assumptions — sourced from committed rounds plus
|
|
133
|
-
the in-flight attempt (never rejected payloads); the redo reuses the round
|
|
134
|
-
ID and its commit retires the brief.
|
|
135
|
-
- L0, L1, and L2 prompt density, five-state sub-goals with explicit
|
|
136
|
-
`subgoal_updates` transitions (active `sg-` IDs only; done/canceled are
|
|
137
|
-
terminal), constraint lifecycle, milestones, and agent-requested emphasis or
|
|
138
|
-
confusion points. Prompts and the state file render active sub-goals only,
|
|
139
|
-
capped by policy; the state file is grouped into Current / Recent /
|
|
140
|
-
Historical Summary tiers with derived metadata (round, attempt, state hash)
|
|
141
|
-
and is byte-identical when regenerated from the Vault.
|
|
142
|
-
- Separate Replay and Audit views. Replay answers what happened; Audit checks
|
|
143
|
-
evidence and completeness.
|
|
144
|
-
- Durable sessions with atomic round documents, sequence checks, owned locks,
|
|
145
|
-
renewable leases, pause, resume, and idempotent recovery.
|
|
146
|
-
- Nine MCP tools: `start`, `next`, `status`, `stop`, `pause`, `resume`, `replay`,
|
|
147
|
-
`gate_check`, and `gate_resolve`. The two gate tools are opt-in
|
|
148
|
-
(`policy.gate.enabled`, default false): hidden from `tools/list`, structured
|
|
149
|
-
preflight via `gate_check`, round-blocking on unapproved `gate_ids`
|
|
150
|
-
citations.
|
|
151
|
-
- Zero runtime dependencies. Policy controls thresholds, budgets, and intervals.
|
|
152
|
-
|
|
153
|
-
---
|
|
100
|
+
Runtime behavior is controlled by `loop_policy.json`. Evidence commands are
|
|
101
|
+
explicitly configured, run without a shell, and restricted to the workspace.
|
|
102
|
+
The default policy keeps the optional user gate disabled.
|
|
154
103
|
|
|
155
104
|
## Development
|
|
156
105
|
|
|
106
|
+
Run these commands from this directory:
|
|
107
|
+
|
|
157
108
|
```bash
|
|
158
109
|
npm run check
|
|
110
|
+
npm run build
|
|
159
111
|
npm test
|
|
160
112
|
npm pack --dry-run --json
|
|
113
|
+
npm run verify:artifacts
|
|
114
|
+
git diff --check
|
|
161
115
|
```
|
|
162
116
|
|
|
163
|
-
The
|
|
164
|
-
|
|
165
|
-
|
|
117
|
+
The build generates `../loopforge-protocol.json` and `dist/`. Change protocol
|
|
118
|
+
types in `src/protocol.ts` first, then run the build. Do not edit generated
|
|
119
|
+
artifacts by hand.
|
|
166
120
|
|
|
167
121
|
## License
|
|
168
122
|
|
package/dist/audit.d.ts
CHANGED
|
@@ -4,21 +4,39 @@
|
|
|
4
4
|
* happened per round); audit is the assessment layer (which claims are
|
|
5
5
|
* machine-verified, which gates were decided, is the sequence intact).
|
|
6
6
|
* Everything is derived from committed vault entries — audit never writes.
|
|
7
|
+
*
|
|
8
|
+
* v3.8: the CONTRACT ITEM axis is the primary completion basis. The criterion
|
|
9
|
+
* claims stay as an advisory second view — a criterion claim is an agent
|
|
10
|
+
* statement whose machine backing is mediated by the contract items, so it
|
|
11
|
+
* cannot be the completion signal. Both axes read the same committed-round
|
|
12
|
+
* model and the same item reducer the coordinator and explain use.
|
|
7
13
|
*/
|
|
8
14
|
import type { LoopStore } from "./loop-store.js";
|
|
9
15
|
import type { VaultEntry } from "./loop-store.js";
|
|
16
|
+
import type { ContractItemStatus } from "./protocol.js";
|
|
10
17
|
export interface AuditRound {
|
|
11
18
|
round: number;
|
|
12
19
|
outcome: string;
|
|
13
20
|
claims: Array<{
|
|
14
21
|
text: string;
|
|
15
|
-
status: "verified" | "unverified"
|
|
22
|
+
status: "verified" | "unverified";
|
|
16
23
|
}>;
|
|
17
24
|
checks: Array<{
|
|
18
25
|
check: string;
|
|
19
26
|
severity: string;
|
|
20
27
|
verdict: "failed" | "warn" | "info";
|
|
21
28
|
}>;
|
|
29
|
+
/** v3.8: the contract this round EXECUTED under and each item's status as of
|
|
30
|
+
* this round — the same derivation `explain` renders. */
|
|
31
|
+
contract: {
|
|
32
|
+
id: string;
|
|
33
|
+
declared_at_round: number;
|
|
34
|
+
closure: string;
|
|
35
|
+
items: Array<{
|
|
36
|
+
itemId: string;
|
|
37
|
+
status: ContractItemStatus;
|
|
38
|
+
}>;
|
|
39
|
+
} | null;
|
|
22
40
|
}
|
|
23
41
|
export interface AuditGate {
|
|
24
42
|
gateId: string;
|
|
@@ -28,12 +46,42 @@ export interface AuditGate {
|
|
|
28
46
|
decidedAt: string;
|
|
29
47
|
round: number;
|
|
30
48
|
}
|
|
49
|
+
/** v3.8: One contract's outcome over the loaned loop, keyed by its content-
|
|
50
|
+
* addressed id. Re-declaring the same contract later extends the same entry —
|
|
51
|
+
* the identity says it IS the same contract. */
|
|
52
|
+
export interface AuditContract {
|
|
53
|
+
contract_id: string;
|
|
54
|
+
declared_at_round: number;
|
|
55
|
+
first_active_round: number;
|
|
56
|
+
last_active_round: number;
|
|
57
|
+
closure: "open" | "verified" | "blocked";
|
|
58
|
+
closed_at_round: number | null;
|
|
59
|
+
/** Item statuses as of the last round the contract was execution-relevant. */
|
|
60
|
+
items: Array<{
|
|
61
|
+
itemId: string;
|
|
62
|
+
description: string;
|
|
63
|
+
status: ContractItemStatus;
|
|
64
|
+
}>;
|
|
65
|
+
}
|
|
66
|
+
export interface AuditContractSummary {
|
|
67
|
+
contracts: AuditContract[];
|
|
68
|
+
/** Contracts whose final closure is still `open`. */
|
|
69
|
+
open: number;
|
|
70
|
+
verifiedItems: number;
|
|
71
|
+
insufficientItems: number;
|
|
72
|
+
contradictedItems: number;
|
|
73
|
+
pendingItems: number;
|
|
74
|
+
}
|
|
31
75
|
export interface AuditResult {
|
|
32
76
|
loopId: string;
|
|
33
77
|
verdict: "passed" | "incomplete" | "contradicted";
|
|
34
78
|
rounds: AuditRound[];
|
|
35
79
|
gates: AuditGate[];
|
|
36
80
|
unresolvedUserGates: string[];
|
|
81
|
+
/** v3.8: the verification skeleton — the primary completion basis. */
|
|
82
|
+
contracts: AuditContractSummary;
|
|
83
|
+
/** Advisory second axis: criterion claims, not the completion signal.
|
|
84
|
+
* `declared` and `evidenced` are both DISTINCT-id counts, so they compare. */
|
|
37
85
|
criteria: {
|
|
38
86
|
declared: number;
|
|
39
87
|
evidenced: number;
|
|
@@ -42,6 +90,10 @@ export interface AuditResult {
|
|
|
42
90
|
sequenceComplete: boolean;
|
|
43
91
|
/** False when no LoopStore was provided (sequence/provenance degraded). */
|
|
44
92
|
provenanceAvailable: boolean;
|
|
93
|
+
/** v3.8: rounds whose persisted transaction carries a legacy schema
|
|
94
|
+
* version. They are NOT part of history (the version break is hard) — this
|
|
95
|
+
* list makes the loss visible instead of letting the loop look complete. */
|
|
96
|
+
legacyRounds: number[];
|
|
45
97
|
}
|
|
46
98
|
/** Build the audit from committed vault entries. Pure, read-only.
|
|
47
99
|
* @param store Optional LoopStore — when provided, sequence integrity is
|
package/dist/audit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIjD,OAAO,KAAK,EAAE,UAAU,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AAK,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,kBAAkB,CAAA;KAAE,CAAC,CAAC;CACnF;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,QAAQ,GAAG,YAAY,GAAG,cAAc,CAAC;IAClD,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,sEAAsE;IACtE,SAAS,EAAE,oBAAoB,CAAC;IAChC;mFAC+E;IAC/E,QAAQ,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,gBAAgB,EAAE,OAAO,CAAC;IAC1B,2EAA2E;IAC3E,mBAAmB,EAAE,OAAO,CAAC;IAC7B;;iFAE6E;IAC7E,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;oDAEoD;AACpD,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,UAAU,EAAE,EACrB,KAAK,CAAC,EAAE,SAAS,GAChB,WAAW,CA6Lb"}
|
package/dist/audit.js
CHANGED
|
@@ -4,36 +4,63 @@
|
|
|
4
4
|
* happened per round); audit is the assessment layer (which claims are
|
|
5
5
|
* machine-verified, which gates were decided, is the sequence intact).
|
|
6
6
|
* Everything is derived from committed vault entries — audit never writes.
|
|
7
|
+
*
|
|
8
|
+
* v3.8: the CONTRACT ITEM axis is the primary completion basis. The criterion
|
|
9
|
+
* claims stay as an advisory second view — a criterion claim is an agent
|
|
10
|
+
* statement whose machine backing is mediated by the contract items, so it
|
|
11
|
+
* cannot be the completion signal. Both axes read the same committed-round
|
|
12
|
+
* model and the same item reducer the coordinator and explain use.
|
|
7
13
|
*/
|
|
8
14
|
import { eventSequence, StorageCorruptionError } from "./loop-store.js";
|
|
9
15
|
import { auditOrder, deriveGate } from "./cognitive-governance.js";
|
|
10
16
|
import { rederiveClaimViewWithFlags, listVerifiedClaims } from "./evidence-claims.js";
|
|
11
17
|
import { isRecord, entryRound } from "./token-utils.js";
|
|
12
|
-
import {
|
|
18
|
+
import { legacyTransactionRounds, machineEvidenceForRound, readOnlyRounds, } from "./committed-round.js";
|
|
19
|
+
import { deriveRoundContractView } from "./round-contract.js";
|
|
20
|
+
import { getPolicy } from "./policy.js";
|
|
13
21
|
/** Build the audit from committed vault entries. Pure, read-only.
|
|
14
22
|
* @param store Optional LoopStore — when provided, sequence integrity is
|
|
15
23
|
* checked and provenanceAvailable becomes true. */
|
|
16
24
|
export function buildAudit(loopId, entries, store) {
|
|
17
25
|
const ordered = auditOrder(entries);
|
|
26
|
+
// v3.8: the shared committed-round read model — ordering, dedup and rollback
|
|
27
|
+
// exclusion come from it, not from a private rule. v3.8.1: the READ-ONLY
|
|
28
|
+
// window, which additionally applies the session frontier while a committed
|
|
29
|
+
// rollback directive is in effect, so a backtracked branch is not audited as
|
|
30
|
+
// this branch's history.
|
|
31
|
+
const views = readOnlyRounds(entries).filter((view) => view.loopId === loopId);
|
|
32
|
+
const commands = getPolicy().evidence.commands ?? [];
|
|
33
|
+
// The executed contract per round, through the ONE derivation explain and
|
|
34
|
+
// the live coordinator also call. Re-derived per round rather than walked
|
|
35
|
+
// incrementally on purpose: a private incremental walker would be a second
|
|
36
|
+
// history interpretation, which is exactly what this project forbids.
|
|
37
|
+
const contractByRound = new Map();
|
|
38
|
+
for (const view of views) {
|
|
39
|
+
contractByRound.set(view.round, deriveRoundContractView({
|
|
40
|
+
rounds: views,
|
|
41
|
+
round: view.round,
|
|
42
|
+
report: view.executionReport,
|
|
43
|
+
observations: view.observationDelta,
|
|
44
|
+
outcome: view.outcome,
|
|
45
|
+
commands,
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
18
48
|
// ── Rounds: per-round claims + checks from committed snapshots ─────────
|
|
49
|
+
//
|
|
50
|
+
// v3.8.1: the list is built from the SAME window the contract axis below
|
|
51
|
+
// reads. Scanning the raw entries here applied a second, weaker history
|
|
52
|
+
// rule — no replacement of a round by a later record of the same logical
|
|
53
|
+
// round — so a superseded record was listed twice and could still flip the
|
|
54
|
+
// verdict to `contradicted`, while explain (which reads only the window)
|
|
55
|
+
// reported a different loop. Rollback exclusion comes from the window too.
|
|
19
56
|
const rounds = [];
|
|
20
|
-
for (const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (!committed)
|
|
26
|
-
continue;
|
|
27
|
-
// v2.14: rounds committed with action="backtrack" were rolled back —
|
|
28
|
-
// they are not part of the loop's final history. Counting them would
|
|
29
|
-
// inflate the round list and let their error flags flip the verdict.
|
|
30
|
-
if (committed.action === "backtrack")
|
|
31
|
-
continue;
|
|
32
|
-
const round = entryRound(entry);
|
|
33
|
-
const outcome = committed.outcome ?? "unknown";
|
|
34
|
-
const claimView = committed.evaluation
|
|
35
|
-
? rederiveClaimViewWithFlags(committed.evaluation, machineEvidenceForRound(committed), committed.verificationFlags)
|
|
57
|
+
for (const view of views) {
|
|
58
|
+
const round = view.round;
|
|
59
|
+
const outcome = view.outcome ?? "unknown";
|
|
60
|
+
const claimView = view.evaluation
|
|
61
|
+
? rederiveClaimViewWithFlags(view.evaluation, machineEvidenceForRound(view), view.verificationFlags)
|
|
36
62
|
: null;
|
|
63
|
+
const executed = contractByRound.get(round);
|
|
37
64
|
rounds.push({
|
|
38
65
|
round,
|
|
39
66
|
outcome,
|
|
@@ -43,13 +70,57 @@ export function buildAudit(loopId, entries, store) {
|
|
|
43
70
|
status: claim.status === "verified" ? "verified" : "unverified",
|
|
44
71
|
}))
|
|
45
72
|
: [],
|
|
46
|
-
checks:
|
|
73
|
+
checks: view.verificationFlags.map((flag) => ({
|
|
47
74
|
check: flag.check,
|
|
48
75
|
severity: flag.severity,
|
|
49
76
|
verdict: flag.severity === "error" ? "failed" : flag.severity,
|
|
50
77
|
})),
|
|
78
|
+
contract: executed?.contract && executed.statuses.contractId
|
|
79
|
+
? {
|
|
80
|
+
id: executed.statuses.contractId,
|
|
81
|
+
declared_at_round: executed.contract.declared_at_round,
|
|
82
|
+
closure: executed.statuses.closure,
|
|
83
|
+
items: executed.statuses.items.map((item) => ({
|
|
84
|
+
itemId: item.itemId,
|
|
85
|
+
status: item.status,
|
|
86
|
+
})),
|
|
87
|
+
}
|
|
88
|
+
: null,
|
|
51
89
|
});
|
|
52
90
|
}
|
|
91
|
+
// ── Contract item axis — the verification skeleton ─────────────────────
|
|
92
|
+
const contractsById = new Map();
|
|
93
|
+
for (const view of views) {
|
|
94
|
+
const executed = contractByRound.get(view.round);
|
|
95
|
+
if (!executed?.contract || !executed.statuses.contractId)
|
|
96
|
+
continue;
|
|
97
|
+
const id = executed.statuses.contractId;
|
|
98
|
+
const existing = contractsById.get(id);
|
|
99
|
+
contractsById.set(id, {
|
|
100
|
+
contract_id: id,
|
|
101
|
+
declared_at_round: existing?.declared_at_round ?? executed.contract.declared_at_round,
|
|
102
|
+
first_active_round: existing?.first_active_round ?? view.round,
|
|
103
|
+
last_active_round: view.round,
|
|
104
|
+
closure: executed.statuses.closure,
|
|
105
|
+
closed_at_round: executed.statuses.closed_at_round,
|
|
106
|
+
items: executed.statuses.items.map((item) => ({
|
|
107
|
+
itemId: item.itemId,
|
|
108
|
+
description: item.description,
|
|
109
|
+
status: item.status,
|
|
110
|
+
})),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const contracts = [...contractsById.values()]
|
|
114
|
+
.sort((a, b) => a.first_active_round - b.first_active_round || a.contract_id.localeCompare(b.contract_id));
|
|
115
|
+
const flatItems = contracts.flatMap((contract) => contract.items);
|
|
116
|
+
const contractsSummary = {
|
|
117
|
+
contracts,
|
|
118
|
+
open: contracts.filter((contract) => contract.closure === "open").length,
|
|
119
|
+
verifiedItems: flatItems.filter((item) => item.status === "verified").length,
|
|
120
|
+
insufficientItems: flatItems.filter((item) => item.status === "insufficient").length,
|
|
121
|
+
contradictedItems: flatItems.filter((item) => item.status === "contradicted").length,
|
|
122
|
+
pendingItems: flatItems.filter((item) => item.status === "pending").length,
|
|
123
|
+
};
|
|
53
124
|
// ── Gates: latest decision wins; opened-without-decision stays open ────
|
|
54
125
|
const decisionsByGate = new Map();
|
|
55
126
|
const openedGates = new Map();
|
|
@@ -101,15 +172,26 @@ export function buildAudit(loopId, entries, store) {
|
|
|
101
172
|
throw error;
|
|
102
173
|
}
|
|
103
174
|
}
|
|
104
|
-
// ── Criteria accounting + verdict
|
|
175
|
+
// ── Criteria accounting (advisory second axis) + verdict ───────────────
|
|
176
|
+
//
|
|
177
|
+
// v3.8 fix: `declared` used to be a PER-ROUND SUM while `evidenced` was a
|
|
178
|
+
// DEDUPLICATED count — a criterion claimed in three rounds read as three
|
|
179
|
+
// declared against one evidenced, so `missing` was fiction. Both sides are
|
|
180
|
+
// now distinct-id counts over the same history and compare directly.
|
|
105
181
|
const verified = listVerifiedClaims(entries, loopId);
|
|
106
|
-
const
|
|
182
|
+
const declaredIds = new Set(rounds.flatMap((round) => round.claims.map((claim) => claim.text)));
|
|
183
|
+
const declared = declaredIds.size;
|
|
107
184
|
const evidenced = verified.length;
|
|
185
|
+
// v3.8: the contract item axis decides completion. A contradicted item is a
|
|
186
|
+
// machine denial; an open contract is unfinished verification; the claim
|
|
187
|
+
// axis only speaks when no contract item exists to speak for it.
|
|
108
188
|
let verdict = "passed";
|
|
109
|
-
if (rounds.some((round) => round.checks.some((check) => check.verdict === "failed"))
|
|
189
|
+
if (rounds.some((round) => round.checks.some((check) => check.verdict === "failed")) ||
|
|
190
|
+
contractsSummary.contradictedItems > 0) {
|
|
110
191
|
verdict = "contradicted";
|
|
111
192
|
}
|
|
112
|
-
else if (unresolvedUserGates.length > 0 ||
|
|
193
|
+
else if (unresolvedUserGates.length > 0 || contractsSummary.open > 0 ||
|
|
194
|
+
(declared > 0 && evidenced === 0)) {
|
|
113
195
|
verdict = "incomplete";
|
|
114
196
|
}
|
|
115
197
|
return {
|
|
@@ -118,9 +200,11 @@ export function buildAudit(loopId, entries, store) {
|
|
|
118
200
|
rounds,
|
|
119
201
|
gates,
|
|
120
202
|
unresolvedUserGates,
|
|
203
|
+
contracts: contractsSummary,
|
|
121
204
|
criteria: { declared, evidenced, missing: Math.max(0, declared - evidenced) },
|
|
122
205
|
sequenceComplete,
|
|
123
206
|
provenanceAvailable,
|
|
207
|
+
legacyRounds: legacyTransactionRounds(entries).map((item) => item.round),
|
|
124
208
|
};
|
|
125
209
|
}
|
|
126
210
|
//# sourceMappingURL=audit.js.map
|
package/dist/audit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAEtF,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,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