loopforge 3.9.2 → 4.0.7
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 +236 -112
- package/dist/audit.d.ts +73 -15
- package/dist/audit.d.ts.map +1 -1
- package/dist/audit.js +131 -61
- package/dist/audit.js.map +1 -1
- package/dist/canonical-state.d.ts +152 -40
- package/dist/canonical-state.d.ts.map +1 -1
- package/dist/canonical-state.js +382 -206
- package/dist/canonical-state.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +41 -12
- package/dist/cli.js.map +1 -1
- package/dist/cognitive-governance.d.ts +0 -2
- package/dist/cognitive-governance.d.ts.map +1 -1
- package/dist/cognitive-governance.js +0 -4
- package/dist/cognitive-governance.js.map +1 -1
- package/dist/committed-round.d.ts +105 -141
- package/dist/committed-round.d.ts.map +1 -1
- package/dist/committed-round.js +249 -372
- package/dist/committed-round.js.map +1 -1
- package/dist/constraint-lifecycle.d.ts +73 -0
- package/dist/constraint-lifecycle.d.ts.map +1 -0
- package/dist/constraint-lifecycle.js +174 -0
- package/dist/constraint-lifecycle.js.map +1 -0
- package/dist/context-boundary.d.ts +83 -0
- package/dist/context-boundary.d.ts.map +1 -0
- package/dist/context-boundary.js +101 -0
- package/dist/context-boundary.js.map +1 -0
- package/dist/contract-items.d.ts +12 -8
- package/dist/contract-items.d.ts.map +1 -1
- package/dist/contract-items.js +31 -26
- package/dist/contract-items.js.map +1 -1
- package/dist/contract-requirement.d.ts +47 -0
- package/dist/contract-requirement.d.ts.map +1 -0
- package/dist/contract-requirement.js +51 -0
- package/dist/contract-requirement.js.map +1 -0
- package/dist/criterion-status.d.ts +35 -0
- package/dist/criterion-status.d.ts.map +1 -0
- package/dist/criterion-status.js +89 -0
- package/dist/criterion-status.js.map +1 -0
- package/dist/enforcement-gate.d.ts +32 -67
- package/dist/enforcement-gate.d.ts.map +1 -1
- package/dist/enforcement-gate.js +203 -439
- package/dist/enforcement-gate.js.map +1 -1
- package/dist/engine.d.ts +9 -103
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +28 -887
- package/dist/engine.js.map +1 -1
- package/dist/errors.d.ts +41 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +69 -0
- package/dist/errors.js.map +1 -0
- package/dist/evidence-claims.d.ts +33 -31
- package/dist/evidence-claims.d.ts.map +1 -1
- package/dist/evidence-claims.js +58 -72
- package/dist/evidence-claims.js.map +1 -1
- package/dist/evidence-posture-view.d.ts +19 -0
- package/dist/evidence-posture-view.d.ts.map +1 -0
- package/dist/evidence-posture-view.js +116 -0
- package/dist/evidence-posture-view.js.map +1 -0
- package/dist/evidence-posture.d.ts +73 -0
- package/dist/evidence-posture.d.ts.map +1 -0
- package/dist/evidence-posture.js +281 -0
- package/dist/evidence-posture.js.map +1 -0
- package/dist/evidence-provider.d.ts +55 -37
- package/dist/evidence-provider.d.ts.map +1 -1
- package/dist/evidence-provider.js +182 -332
- package/dist/evidence-provider.js.map +1 -1
- package/dist/explain.d.ts +167 -27
- package/dist/explain.d.ts.map +1 -1
- package/dist/explain.js +373 -58
- package/dist/explain.js.map +1 -1
- package/dist/field-accounting.d.ts.map +1 -1
- package/dist/field-accounting.js +3 -22
- package/dist/field-accounting.js.map +1 -1
- package/dist/generate-schema.js +13 -8
- package/dist/generate-schema.js.map +1 -1
- package/dist/git-boundary.d.ts +128 -0
- package/dist/git-boundary.d.ts.map +1 -0
- package/dist/git-boundary.js +625 -0
- package/dist/git-boundary.js.map +1 -0
- package/dist/git-facts.d.ts +22 -0
- package/dist/git-facts.d.ts.map +1 -0
- package/dist/git-facts.js +29 -0
- package/dist/git-facts.js.map +1 -0
- package/dist/git-motion.d.ts +37 -0
- package/dist/git-motion.d.ts.map +1 -0
- package/dist/git-motion.js +59 -0
- package/dist/git-motion.js.map +1 -0
- package/dist/history.d.ts +44 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +77 -0
- package/dist/history.js.map +1 -0
- package/dist/index.d.ts +19 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +16 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +80 -14
- package/dist/init.js.map +1 -1
- package/dist/loop-compiler.d.ts +51 -19
- package/dist/loop-compiler.d.ts.map +1 -1
- package/dist/loop-compiler.js +423 -507
- package/dist/loop-compiler.js.map +1 -1
- package/dist/loop-store.d.ts +6 -5
- package/dist/loop-store.d.ts.map +1 -1
- package/dist/loop-store.js +153 -35
- package/dist/loop-store.js.map +1 -1
- package/dist/mcp/round-lifecycle.d.ts +285 -81
- package/dist/mcp/round-lifecycle.d.ts.map +1 -1
- package/dist/mcp/round-lifecycle.js +1629 -574
- package/dist/mcp/round-lifecycle.js.map +1 -1
- package/dist/mcp/server.d.ts +5 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +61 -19
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/session.d.ts +81 -39
- package/dist/mcp/session.d.ts.map +1 -1
- package/dist/mcp/session.js +963 -271
- package/dist/mcp/session.js.map +1 -1
- package/dist/mcp/submission-boundary.d.ts +23 -31
- package/dist/mcp/submission-boundary.d.ts.map +1 -1
- package/dist/mcp/submission-boundary.js +242 -82
- package/dist/mcp/submission-boundary.js.map +1 -1
- package/dist/mcp/submission-handle.d.ts +66 -0
- package/dist/mcp/submission-handle.d.ts.map +1 -0
- package/dist/mcp/submission-handle.js +173 -0
- package/dist/mcp/submission-handle.js.map +1 -0
- package/dist/mcp/tools.d.ts +17 -7
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +763 -244
- package/dist/mcp/tools.js.map +1 -1
- package/dist/open-question.d.ts +7 -0
- package/dist/open-question.d.ts.map +1 -0
- package/dist/open-question.js +14 -0
- package/dist/open-question.js.map +1 -0
- package/dist/policy-metrics.d.ts +31 -21
- package/dist/policy-metrics.d.ts.map +1 -1
- package/dist/policy-metrics.js +117 -64
- package/dist/policy-metrics.js.map +1 -1
- package/dist/policy.d.ts +15 -40
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +13 -13
- package/dist/policy.js.map +1 -1
- package/dist/progress.d.ts +45 -0
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +136 -0
- package/dist/progress.js.map +1 -0
- package/dist/prompt-assembler.d.ts +28 -9
- package/dist/prompt-assembler.d.ts.map +1 -1
- package/dist/prompt-assembler.js +592 -603
- package/dist/prompt-assembler.js.map +1 -1
- package/dist/prompt-coverage.d.ts +39 -0
- package/dist/prompt-coverage.d.ts.map +1 -0
- package/dist/prompt-coverage.js +80 -0
- package/dist/prompt-coverage.js.map +1 -0
- package/dist/prompt-freshness.d.ts +25 -0
- package/dist/prompt-freshness.d.ts.map +1 -0
- package/dist/prompt-freshness.js +88 -0
- package/dist/prompt-freshness.js.map +1 -0
- package/dist/prompt-policy.d.ts +14 -4
- package/dist/prompt-policy.d.ts.map +1 -1
- package/dist/prompt-policy.js +29 -10
- package/dist/prompt-policy.js.map +1 -1
- package/dist/protocol.d.ts +875 -419
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +73 -99
- package/dist/protocol.js.map +1 -1
- package/dist/recovery-guidance.d.ts +13 -0
- package/dist/recovery-guidance.d.ts.map +1 -0
- package/dist/recovery-guidance.js +15 -0
- package/dist/recovery-guidance.js.map +1 -0
- package/dist/recovery.d.ts +68 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +234 -0
- package/dist/recovery.js.map +1 -0
- package/dist/replay.d.ts +42 -8
- package/dist/replay.d.ts.map +1 -1
- package/dist/replay.js +311 -84
- package/dist/replay.js.map +1 -1
- package/dist/result-facts.d.ts +45 -0
- package/dist/result-facts.d.ts.map +1 -0
- package/dist/result-facts.js +86 -0
- package/dist/result-facts.js.map +1 -0
- package/dist/round-contract.d.ts +38 -8
- package/dist/round-contract.d.ts.map +1 -1
- package/dist/round-contract.js +71 -31
- package/dist/round-contract.js.map +1 -1
- package/dist/round-coordinator.d.ts +45 -91
- package/dist/round-coordinator.d.ts.map +1 -1
- package/dist/round-coordinator.js +254 -271
- package/dist/round-coordinator.js.map +1 -1
- package/dist/round-driver.d.ts +56 -16
- package/dist/round-driver.d.ts.map +1 -1
- package/dist/round-driver.js +225 -39
- package/dist/round-driver.js.map +1 -1
- package/dist/round-facts.d.ts +33 -52
- package/dist/round-facts.d.ts.map +1 -1
- package/dist/round-facts.js +54 -157
- package/dist/round-facts.js.map +1 -1
- package/dist/round-guidance.d.ts +56 -0
- package/dist/round-guidance.d.ts.map +1 -0
- package/dist/round-guidance.js +161 -0
- package/dist/round-guidance.js.map +1 -0
- package/dist/round-outcome.d.ts +21 -0
- package/dist/round-outcome.d.ts.map +1 -0
- package/dist/round-outcome.js +31 -0
- package/dist/round-outcome.js.map +1 -0
- package/dist/round-transaction.d.ts +168 -21
- package/dist/round-transaction.d.ts.map +1 -1
- package/dist/round-transaction.js +856 -39
- package/dist/round-transaction.js.map +1 -1
- package/dist/self-eval.d.ts +40 -60
- package/dist/self-eval.d.ts.map +1 -1
- package/dist/self-eval.js +455 -384
- package/dist/self-eval.js.map +1 -1
- package/dist/storage.d.ts +16 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +54 -4
- package/dist/storage.js.map +1 -1
- package/dist/subgoal-state.d.ts +2 -3
- package/dist/subgoal-state.d.ts.map +1 -1
- package/dist/subgoal-state.js +2 -3
- package/dist/subgoal-state.js.map +1 -1
- package/dist/submission-guidance.d.ts +43 -21
- package/dist/submission-guidance.d.ts.map +1 -1
- package/dist/submission-guidance.js +368 -262
- package/dist/submission-guidance.js.map +1 -1
- package/dist/submission-receipt.d.ts +16 -8
- package/dist/submission-receipt.d.ts.map +1 -1
- package/dist/submission-receipt.js +146 -51
- package/dist/submission-receipt.js.map +1 -1
- package/dist/token-utils.d.ts +47 -7
- package/dist/token-utils.d.ts.map +1 -1
- package/dist/token-utils.js +66 -15
- package/dist/token-utils.js.map +1 -1
- package/dist/transaction-identity.d.ts +9 -0
- package/dist/transaction-identity.d.ts.map +1 -0
- package/dist/transaction-identity.js +69 -0
- package/dist/transaction-identity.js.map +1 -0
- package/dist/verification-actions.d.ts +13 -0
- package/dist/verification-actions.d.ts.map +1 -0
- package/dist/verification-actions.js +44 -0
- package/dist/verification-actions.js.map +1 -0
- package/dist/verification-gate.d.ts +26 -46
- package/dist/verification-gate.d.ts.map +1 -1
- package/dist/verification-gate.js +218 -427
- package/dist/verification-gate.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/working-memory.d.ts +187 -0
- package/dist/working-memory.d.ts.map +1 -0
- package/dist/working-memory.js +767 -0
- package/dist/working-memory.js.map +1 -0
- package/dist/workspace-checkpoint.d.ts +88 -0
- package/dist/workspace-checkpoint.d.ts.map +1 -0
- package/dist/workspace-checkpoint.js +326 -0
- package/dist/workspace-checkpoint.js.map +1 -0
- package/dist/workspace-restore.d.ts +68 -0
- package/dist/workspace-restore.d.ts.map +1 -0
- package/dist/workspace-restore.js +604 -0
- package/dist/workspace-restore.js.map +1 -0
- package/dist/workspace.d.ts +0 -9
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +0 -17
- package/dist/workspace.js.map +1 -1
- package/loop_policy.json +5 -19
- package/package.json +2 -2
- package/skills/forge/SKILL.md +212 -0
- package/skills/forge/references/evidence-and-contracts.md +204 -0
- package/skills/forge/references/recovery-and-views.md +188 -0
- package/dist/cognitive-facts.d.ts +0 -30
- package/dist/cognitive-facts.d.ts.map +0 -1
- package/dist/cognitive-facts.js +0 -113
- package/dist/cognitive-facts.js.map +0 -1
- package/dist/loop-extras-parser.d.ts +0 -81
- package/dist/loop-extras-parser.d.ts.map +0 -1
- package/dist/loop-extras-parser.js +0 -213
- package/dist/loop-extras-parser.js.map +0 -1
- package/dist/loop-projection.d.ts +0 -6
- package/dist/loop-projection.d.ts.map +0 -1
- package/dist/loop-projection.js +0 -28
- package/dist/loop-projection.js.map +0 -1
- package/skills/perception/SKILL.md +0 -370
package/dist/token-utils.d.ts
CHANGED
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
*/
|
|
10
10
|
/** Filter null/undefined/empty strings, trim, and deduplicate via Set. */
|
|
11
11
|
export declare function unique(values: Array<string | null | undefined>): string[];
|
|
12
|
+
/** v3.9.4: deduplicate by the SAME normalized-exact identity the stable ID
|
|
13
|
+
* derivation uses. `unique` is trim-only, so "Tests pass" and "tests pass"
|
|
14
|
+
* survived as two entries with one `cr-*` id. The first spelling wins. */
|
|
15
|
+
export declare function uniqueNormalized(values: Array<string | null | undefined>): string[];
|
|
12
16
|
/** Narrow `unknown` to a non-array object. Used across storage, MCP, and
|
|
13
17
|
* transaction modules to validate JSON-deserialized data before field access. */
|
|
14
18
|
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
@@ -35,6 +39,10 @@ export declare const STABLE_ID_RE: RegExp;
|
|
|
35
39
|
* cycle. `loop-compiler.ts` re-exports it, so its public surface is
|
|
36
40
|
* unchanged. */
|
|
37
41
|
export declare function deriveCriterionId(text: string): string;
|
|
42
|
+
/** v2.11/v3.9.7: Derive a stable constraint ID from its text hash
|
|
43
|
+
* (c-XXXXXXXX). Moved here so the constraint lifecycle resolver can use the
|
|
44
|
+
* one identity helper without importing the compiler. */
|
|
45
|
+
export declare function deriveConstraintId(text: string): string;
|
|
38
46
|
/** The cr-XXXXXXXX shape — the ONE predicate every criterion-reference reader
|
|
39
47
|
* uses (round-contract.ts kept an inline copy before v3.8.1). */
|
|
40
48
|
export declare function isCriterionId(ref: string): boolean;
|
|
@@ -45,6 +53,24 @@ export declare function criterionRefMatches(ref: string, criterion: string | {
|
|
|
45
53
|
id?: string;
|
|
46
54
|
text: string;
|
|
47
55
|
}): boolean;
|
|
56
|
+
/** v3.9.4: the stable identity of one machine finding for prompt coverage.
|
|
57
|
+
* It is a DERIVED audit key — never persisted as a second finding source and
|
|
58
|
+
* never read by compile/decision code. `(check, field, ref)` is the same
|
|
59
|
+
* subject vocabulary `RecurringFlag` groups on; JSON encoding keeps it
|
|
60
|
+
* unambiguous and deterministic. */
|
|
61
|
+
export declare function findingKey(flag: {
|
|
62
|
+
check: string;
|
|
63
|
+
field: string;
|
|
64
|
+
ref?: string;
|
|
65
|
+
}): string;
|
|
66
|
+
/** v3.9.7: the stable, user-referenceable id of one current machine finding.
|
|
67
|
+
* The JSON `findingKey` remains the internal grouping key; `f-` is the id the
|
|
68
|
+
* prompt renders for the Agent. */
|
|
69
|
+
export declare function deriveFindingId(flag: {
|
|
70
|
+
check: string;
|
|
71
|
+
field: string;
|
|
72
|
+
ref?: string;
|
|
73
|
+
}): string;
|
|
48
74
|
/** Normalize one contract text field for identity purposes. */
|
|
49
75
|
export declare function normalizeText(text: string): string;
|
|
50
76
|
/** The contract-item fields that participate in rci-/rc- identity. Structural
|
|
@@ -52,17 +78,26 @@ export declare function normalizeText(text: string): string;
|
|
|
52
78
|
* position alongside the other pure token helpers. */
|
|
53
79
|
export interface ContractIdentityItem {
|
|
54
80
|
description: string;
|
|
55
|
-
|
|
56
|
-
|
|
81
|
+
/** v4.0.6: optional (defaults to `[]`), matching the runtime and schema. */
|
|
82
|
+
criterion_refs?: string[];
|
|
57
83
|
verify_with: string[];
|
|
58
84
|
}
|
|
59
|
-
/** v3.8: Canonical form of a contract proposal. Identity is CONTENT
|
|
60
|
-
* restating an unchanged contract keeps the same rc-/rci- ids, unlike
|
|
61
|
-
* SubGoal whose id includes its declaration round. Array order is part of
|
|
62
|
-
* the identity.
|
|
85
|
+
/** v3.8 / v4.0.6: Canonical form of a contract proposal. Identity is CONTENT
|
|
86
|
+
* only — restating an unchanged contract keeps the same rc-/rci- ids, unlike
|
|
87
|
+
* a SubGoal whose id includes its declaration round. Array order is part of
|
|
88
|
+
* the identity.
|
|
89
|
+
*
|
|
90
|
+
* v3.9.5: `work_item` is the slice's deliverable label (optional in this
|
|
91
|
+
* legacy-readable type); the item list is the acceptance surface.
|
|
92
|
+
*
|
|
93
|
+
* v4.0.6: `scope` and `supersedes` are report-only modifiers and are NOT
|
|
94
|
+
* part of `rc-` identity — changing either keeps the same contract id.
|
|
95
|
+
* Structural (not imported from protocol.ts) so this module keeps its
|
|
96
|
+
* zero-dependency position. */
|
|
63
97
|
export declare function canonicalContractText(contract: {
|
|
64
98
|
work_item?: string;
|
|
65
|
-
scope
|
|
99
|
+
scope?: string[];
|
|
100
|
+
supersedes?: unknown;
|
|
66
101
|
items: ContractIdentityItem[];
|
|
67
102
|
}): string;
|
|
68
103
|
/** v3.8: rc-XXXXXXXX — loopId + canonical content. */
|
|
@@ -71,6 +106,11 @@ export declare function deriveContractId(loopId: string, contract: Parameters<ty
|
|
|
71
106
|
* Deliberately independent of the contract id: editing `work_item` or
|
|
72
107
|
* `scope` must not invalidate every item id the agent already cited. */
|
|
73
108
|
export declare function deriveContractItemId(item: ContractIdentityItem, duplicateOrdinal: number): string;
|
|
109
|
+
/** v3.9.4: the normalized content identity of ONE contract item (without the
|
|
110
|
+
* duplicate ordinal). Used by the strict declaration boundary to reject two
|
|
111
|
+
* semantically identical items, so an `rci-*` citation can never be
|
|
112
|
+
* ambiguous between restatements. */
|
|
113
|
+
export declare function canonicalContractItemText(item: ContractIdentityItem): string;
|
|
74
114
|
/** v3.8: Assign ids to a proposal's items in declaration order. Items with
|
|
75
115
|
* identical normalized content get distinct ids through their duplicate
|
|
76
116
|
* ordinal. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-utils.d.ts","sourceRoot":"","sources":["../src/token-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,0EAA0E;AAC1E,wBAAgB,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,MAAM,EAAE,CAKzE;AAID;kFACkF;AAClF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EA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gC;AAChC,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,oBAAoB,EAAE,CAAC;CAC/B,GAAG,MAAM,CAUT;AAED,sDAAsD;AACtD,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC,CAAC,GACpD,MAAM,CAER;AAED;;yEAEyE;AACzE,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,oBAAoB,EAC1B,gBAAgB,EAAE,MAAM,GACvB,MAAM,CAQR;AAED;;;sCAGsC;AACtC,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,oBAAoB,GAAG,MAAM,CAM5E;AAED;;eAEe;AACf,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,aAAa,CAAC,oBAAoB,CAAC,GACzC,MAAM,EAAE,CAQV;AASD;;yEAEyE;AACzE,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAI5D"}
|
package/dist/token-utils.js
CHANGED
|
@@ -16,6 +16,26 @@ export function unique(values) {
|
|
|
16
16
|
.map((value) => value.trim())
|
|
17
17
|
.filter(Boolean))];
|
|
18
18
|
}
|
|
19
|
+
/** v3.9.4: deduplicate by the SAME normalized-exact identity the stable ID
|
|
20
|
+
* derivation uses. `unique` is trim-only, so "Tests pass" and "tests pass"
|
|
21
|
+
* survived as two entries with one `cr-*` id. The first spelling wins. */
|
|
22
|
+
export function uniqueNormalized(values) {
|
|
23
|
+
const seen = new Set();
|
|
24
|
+
const out = [];
|
|
25
|
+
for (const value of values) {
|
|
26
|
+
if (typeof value !== "string")
|
|
27
|
+
continue;
|
|
28
|
+
const text = value.trim();
|
|
29
|
+
if (!text)
|
|
30
|
+
continue;
|
|
31
|
+
const key = normalizeText(text);
|
|
32
|
+
if (seen.has(key))
|
|
33
|
+
continue;
|
|
34
|
+
seen.add(key);
|
|
35
|
+
out.push(text);
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
19
39
|
// ── Type guard ──────────────────────────────────────────────────────────────
|
|
20
40
|
/** Narrow `unknown` to a non-array object. Used across storage, MCP, and
|
|
21
41
|
* transaction modules to validate JSON-deserialized data before field access. */
|
|
@@ -59,6 +79,12 @@ export const STABLE_ID_RE = /^(c|cr|sg|rc|rci)-[a-f0-9]{8}$/;
|
|
|
59
79
|
export function deriveCriterionId(text) {
|
|
60
80
|
return "cr-" + deriveItemId(text);
|
|
61
81
|
}
|
|
82
|
+
/** v2.11/v3.9.7: Derive a stable constraint ID from its text hash
|
|
83
|
+
* (c-XXXXXXXX). Moved here so the constraint lifecycle resolver can use the
|
|
84
|
+
* one identity helper without importing the compiler. */
|
|
85
|
+
export function deriveConstraintId(text) {
|
|
86
|
+
return "c-" + deriveItemId(text);
|
|
87
|
+
}
|
|
62
88
|
/** The cr-XXXXXXXX shape — the ONE predicate every criterion-reference reader
|
|
63
89
|
* uses (round-contract.ts kept an inline copy before v3.8.1). */
|
|
64
90
|
export function isCriterionId(ref) {
|
|
@@ -79,23 +105,43 @@ export function criterionRefMatches(ref, criterion) {
|
|
|
79
105
|
return deriveCriterionId(ref) === text;
|
|
80
106
|
return normalizeText(ref) === normalizeText(text);
|
|
81
107
|
}
|
|
108
|
+
/** v3.9.4: the stable identity of one machine finding for prompt coverage.
|
|
109
|
+
* It is a DERIVED audit key — never persisted as a second finding source and
|
|
110
|
+
* never read by compile/decision code. `(check, field, ref)` is the same
|
|
111
|
+
* subject vocabulary `RecurringFlag` groups on; JSON encoding keeps it
|
|
112
|
+
* unambiguous and deterministic. */
|
|
113
|
+
export function findingKey(flag) {
|
|
114
|
+
return JSON.stringify([flag.check, flag.field, flag.ref ?? ""]);
|
|
115
|
+
}
|
|
116
|
+
/** v3.9.7: the stable, user-referenceable id of one current machine finding.
|
|
117
|
+
* The JSON `findingKey` remains the internal grouping key; `f-` is the id the
|
|
118
|
+
* prompt renders for the Agent. */
|
|
119
|
+
export function deriveFindingId(flag) {
|
|
120
|
+
return "f-" + deriveItemId(findingKey(flag));
|
|
121
|
+
}
|
|
82
122
|
// ── v3.8: Contract identity (content-addressed, round-independent) ──────────
|
|
83
123
|
/** Normalize one contract text field for identity purposes. */
|
|
84
124
|
export function normalizeText(text) {
|
|
85
125
|
return text.trim().replace(/\s+/g, " ").toLowerCase();
|
|
86
126
|
}
|
|
87
|
-
/** v3.8: Canonical form of a contract proposal. Identity is CONTENT
|
|
88
|
-
* restating an unchanged contract keeps the same rc-/rci- ids, unlike
|
|
89
|
-
* SubGoal whose id includes its declaration round. Array order is part of
|
|
90
|
-
* the identity.
|
|
127
|
+
/** v3.8 / v4.0.6: Canonical form of a contract proposal. Identity is CONTENT
|
|
128
|
+
* only — restating an unchanged contract keeps the same rc-/rci- ids, unlike
|
|
129
|
+
* a SubGoal whose id includes its declaration round. Array order is part of
|
|
130
|
+
* the identity.
|
|
131
|
+
*
|
|
132
|
+
* v3.9.5: `work_item` is the slice's deliverable label (optional in this
|
|
133
|
+
* legacy-readable type); the item list is the acceptance surface.
|
|
134
|
+
*
|
|
135
|
+
* v4.0.6: `scope` and `supersedes` are report-only modifiers and are NOT
|
|
136
|
+
* part of `rc-` identity — changing either keeps the same contract id.
|
|
137
|
+
* Structural (not imported from protocol.ts) so this module keeps its
|
|
138
|
+
* zero-dependency position. */
|
|
91
139
|
export function canonicalContractText(contract) {
|
|
92
140
|
const canonical = {
|
|
93
141
|
work_item: normalizeText(contract.work_item ?? ""),
|
|
94
|
-
scope: contract.scope.map(normalizeText),
|
|
95
142
|
items: contract.items.map((item) => ({
|
|
96
143
|
description: normalizeText(item.description),
|
|
97
|
-
criterion_refs: item.criterion_refs.map(normalizeText),
|
|
98
|
-
subgoal_refs: item.subgoal_refs.map(normalizeText),
|
|
144
|
+
criterion_refs: (item.criterion_refs ?? []).map(normalizeText),
|
|
99
145
|
verify_with: item.verify_with.map(normalizeText),
|
|
100
146
|
})),
|
|
101
147
|
};
|
|
@@ -111,25 +157,30 @@ export function deriveContractId(loopId, contract) {
|
|
|
111
157
|
export function deriveContractItemId(item, duplicateOrdinal) {
|
|
112
158
|
const canonical = JSON.stringify({
|
|
113
159
|
description: normalizeText(item.description),
|
|
114
|
-
criterion_refs: item.criterion_refs.map(normalizeText),
|
|
115
|
-
subgoal_refs: item.subgoal_refs.map(normalizeText),
|
|
160
|
+
criterion_refs: (item.criterion_refs ?? []).map(normalizeText),
|
|
116
161
|
verify_with: item.verify_with.map(normalizeText),
|
|
117
162
|
duplicate_ordinal: duplicateOrdinal,
|
|
118
163
|
});
|
|
119
164
|
return `rci-${deriveItemId(canonical)}`;
|
|
120
165
|
}
|
|
166
|
+
/** v3.9.4: the normalized content identity of ONE contract item (without the
|
|
167
|
+
* duplicate ordinal). Used by the strict declaration boundary to reject two
|
|
168
|
+
* semantically identical items, so an `rci-*` citation can never be
|
|
169
|
+
* ambiguous between restatements. */
|
|
170
|
+
export function canonicalContractItemText(item) {
|
|
171
|
+
return JSON.stringify({
|
|
172
|
+
description: normalizeText(item.description),
|
|
173
|
+
criterion_refs: (item.criterion_refs ?? []).map(normalizeText),
|
|
174
|
+
verify_with: item.verify_with.map(normalizeText),
|
|
175
|
+
});
|
|
176
|
+
}
|
|
121
177
|
/** v3.8: Assign ids to a proposal's items in declaration order. Items with
|
|
122
178
|
* identical normalized content get distinct ids through their duplicate
|
|
123
179
|
* ordinal. */
|
|
124
180
|
export function deriveContractItemIds(items) {
|
|
125
181
|
const seen = new Map();
|
|
126
182
|
return items.map((item) => {
|
|
127
|
-
const key =
|
|
128
|
-
description: normalizeText(item.description),
|
|
129
|
-
criterion_refs: item.criterion_refs.map(normalizeText),
|
|
130
|
-
subgoal_refs: item.subgoal_refs.map(normalizeText),
|
|
131
|
-
verify_with: item.verify_with.map(normalizeText),
|
|
132
|
-
});
|
|
183
|
+
const key = canonicalContractItemText(item);
|
|
133
184
|
const ordinal = seen.get(key) ?? 0;
|
|
134
185
|
seen.set(key, ordinal + 1);
|
|
135
186
|
return deriveContractItemId(item, ordinal);
|
package/dist/token-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-utils.js","sourceRoot":"","sources":["../src/token-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,8EAA8E;AAE9E,0EAA0E;AAC1E,MAAM,UAAU,MAAM,CAAC,MAAwC;IAC7D,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM;aACtB,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;aAC7D,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;aAC5B,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC;AAED,+EAA+E;AAE/E;kFACkF;AAClF,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,8EAA8E;AAE9E;;8DAE8D;AAC9D,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5C,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,YAAY,IAAI,EAAE,CAA4B,CAAC;IACnE,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC;IACtB,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,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ChD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3E,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface TransactionIdentityExpectation {
|
|
2
|
+
loopId: string;
|
|
3
|
+
round: number;
|
|
4
|
+
schemaVersion?: number;
|
|
5
|
+
transactionId?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Validate that a stored transaction belongs to its containing Vault entry. */
|
|
8
|
+
export declare function transactionIdentityIssue(entry: unknown, expected?: TransactionIdentityExpectation): string | null;
|
|
9
|
+
//# sourceMappingURL=transaction-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-identity.d.ts","sourceRoot":"","sources":["../src/transaction-identity.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,8BAA8B;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,gFAAgF;AAChF,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,EACd,QAAQ,CAAC,EAAE,8BAA8B,GACxC,MAAM,GAAG,IAAI,CAkEf"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { isRecord } from "./token-utils.js";
|
|
2
|
+
/** Validate that a stored transaction belongs to its containing Vault entry. */
|
|
3
|
+
export function transactionIdentityIssue(entry, expected) {
|
|
4
|
+
if (!isRecord(entry) || !isRecord(entry.loop_lineage) ||
|
|
5
|
+
!isRecord(entry.loop_lineage.round_transaction)) {
|
|
6
|
+
return "round transaction envelope is missing";
|
|
7
|
+
}
|
|
8
|
+
const lineage = entry.loop_lineage;
|
|
9
|
+
const envelope = lineage.round_transaction;
|
|
10
|
+
if (!isRecord(envelope))
|
|
11
|
+
return "round transaction envelope is malformed";
|
|
12
|
+
const snapshot = envelope.snapshot;
|
|
13
|
+
if (!isRecord(snapshot))
|
|
14
|
+
return "round transaction snapshot is missing";
|
|
15
|
+
if (typeof snapshot.loopId !== "string" ||
|
|
16
|
+
!Number.isInteger(snapshot.round) ||
|
|
17
|
+
typeof snapshot.roundId !== "string" ||
|
|
18
|
+
typeof snapshot.transactionId !== "string" ||
|
|
19
|
+
(snapshot.kind !== "evaluation" && snapshot.kind !== "rollback")) {
|
|
20
|
+
return "round transaction snapshot identity is malformed";
|
|
21
|
+
}
|
|
22
|
+
const loopId = snapshot.loopId;
|
|
23
|
+
const round = snapshot.round;
|
|
24
|
+
const roundId = `loop:${loopId}:round:${round}`;
|
|
25
|
+
if (round < 1 || snapshot.roundId !== roundId) {
|
|
26
|
+
return "round transaction snapshot round identity is inconsistent";
|
|
27
|
+
}
|
|
28
|
+
if (envelope.schema_version !== snapshot.schemaVersion ||
|
|
29
|
+
envelope.round_id !== snapshot.roundId) {
|
|
30
|
+
return "round transaction envelope identity does not match its snapshot";
|
|
31
|
+
}
|
|
32
|
+
if (typeof entry.loop_id !== "string" || entry.loop_id !== loopId) {
|
|
33
|
+
return "Vault entry loop_id does not match its transaction snapshot";
|
|
34
|
+
}
|
|
35
|
+
if (lineage.round !== round ||
|
|
36
|
+
(lineage.round_id !== undefined && lineage.round_id !== roundId)) {
|
|
37
|
+
return "Vault entry round lineage does not match its transaction snapshot";
|
|
38
|
+
}
|
|
39
|
+
const expectedTaskType = snapshot.kind === "evaluation"
|
|
40
|
+
? "feedback"
|
|
41
|
+
: "rollback_directive";
|
|
42
|
+
const expectedTaskId = snapshot.kind === "evaluation"
|
|
43
|
+
? `loop:${loopId}:r${round}:feedback`
|
|
44
|
+
: `loop:${loopId}:r${round}:rollback:${snapshot.transactionId}`;
|
|
45
|
+
if (entry.task_type !== expectedTaskType ||
|
|
46
|
+
entry.task_id !== expectedTaskId) {
|
|
47
|
+
return "Vault entry task identity does not match its transaction snapshot";
|
|
48
|
+
}
|
|
49
|
+
if (snapshot.kind === "rollback" &&
|
|
50
|
+
(!isRecord(snapshot.recovery) ||
|
|
51
|
+
snapshot.recovery.transaction_id !== snapshot.transactionId)) {
|
|
52
|
+
return "rollback directive identity does not match its transaction snapshot";
|
|
53
|
+
}
|
|
54
|
+
if (expected) {
|
|
55
|
+
if (loopId !== expected.loopId || round !== expected.round) {
|
|
56
|
+
return "transaction snapshot does not match its target loop and round";
|
|
57
|
+
}
|
|
58
|
+
if (expected.schemaVersion !== undefined &&
|
|
59
|
+
snapshot.schemaVersion !== expected.schemaVersion) {
|
|
60
|
+
return "transaction snapshot schema does not match the active schema";
|
|
61
|
+
}
|
|
62
|
+
if (expected.transactionId !== undefined &&
|
|
63
|
+
snapshot.transactionId !== expected.transactionId) {
|
|
64
|
+
return "transaction snapshot does not match its target transaction";
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=transaction-identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-identity.js","sourceRoot":"","sources":["../src/transaction-identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAS5C,gFAAgF;AAChF,MAAM,UAAU,wBAAwB,CACtC,KAAc,EACd,QAAyC;IAEzC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC;QACjD,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACpD,OAAO,uCAAuC,CAAC;IACjD,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC,YAAY,CAAC;IACnC,MAAM,QAAQ,GAAG,OAA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|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** The ONE actionable instruction table for verification checks.
|
|
2
|
+
*
|
|
3
|
+
* Kept separate from the prompt assembler so the evaluation-field guidance
|
|
4
|
+
* can quote the same action without depending on a renderer. Keys are the
|
|
5
|
+
* plain check-name strings (NOT imported from verification-gate.ts — it
|
|
6
|
+
* already imports loop-compiler, which imports the prompt layer, so
|
|
7
|
+
* importing back would cycle). Full coverage of every CHECK_* constant is
|
|
8
|
+
* enforced by a test that iterates the verification-gate module's CHECK_
|
|
9
|
+
* exports; a new constant can never silently lack an action entry.
|
|
10
|
+
*/
|
|
11
|
+
export declare const VERIFICATION_ACTIONS: Readonly<Record<string, string>>;
|
|
12
|
+
export declare function verificationActionFor(check: string): string;
|
|
13
|
+
//# sourceMappingURL=verification-actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verification-actions.d.ts","sourceRoot":"","sources":["../src/verification-actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA6CjE,CAAC;AAMF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3D"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** The ONE actionable instruction table for verification checks.
|
|
2
|
+
*
|
|
3
|
+
* Kept separate from the prompt assembler so the evaluation-field guidance
|
|
4
|
+
* can quote the same action without depending on a renderer. Keys are the
|
|
5
|
+
* plain check-name strings (NOT imported from verification-gate.ts — it
|
|
6
|
+
* already imports loop-compiler, which imports the prompt layer, so
|
|
7
|
+
* importing back would cycle). Full coverage of every CHECK_* constant is
|
|
8
|
+
* enforced by a test that iterates the verification-gate module's CHECK_
|
|
9
|
+
* exports; a new constant can never silently lack an action entry.
|
|
10
|
+
*/
|
|
11
|
+
export const VERIFICATION_ACTIONS = {
|
|
12
|
+
success_with_remaining_criteria: "Complete the remaining criteria before declaring outcome=success, or declare partial/failed and report what remains.",
|
|
13
|
+
success_without_verified_evidence: "Back the success claim with machine-observable evidence (a passed after-phase command). no_change_reason is honored only when no enabled verification command is configured.",
|
|
14
|
+
retroactive_claim_bad_round: "Correct the referenced round number, or withdraw the retroactive claim.",
|
|
15
|
+
retroactive_claim_unverified: "Provide evidence for the retroactive claim, or withdraw it.",
|
|
16
|
+
duplicate_constraint_discovery: "Update the existing constraint entry instead of duplicating it.",
|
|
17
|
+
recurring_violation: "The same violation was reported in three consecutive committed rounds. The finding clears when a committed evaluation no longer reports it, or when the round declares outcome blocked with a blocker. LoopForge does not prescribe a strategy.",
|
|
18
|
+
retract_fresh_constraint: "The target was discovered in the previous round. Retraction is resolved against the active Agent-discovered set; the report remains in the committed record.",
|
|
19
|
+
// 3.9.3: the reported-vs-observed fix is spelled out. The committed flag
|
|
20
|
+
// already carries the `unreported` / `unconfirmed` path sets; this is the
|
|
21
|
+
// action that turns the receipt's mismatch into a correct next report.
|
|
22
|
+
evidence_integrity: "Report only the net boundary change: add every machine-observed path you omitted, remove every path the machine did not observe, and include deletions.",
|
|
23
|
+
required_command_failed: "Re-run the required verification command and report its actual output before claiming success.",
|
|
24
|
+
criteria_claims_unverified: "Provide evidence for each claimed success criterion.",
|
|
25
|
+
// v3.3 — Round Contract checks (and the three v3.3 checks that predated
|
|
26
|
+
// this table entry and fell back to the generic action).
|
|
27
|
+
verification_entrypoint_modified: "Restore each entrypoint file to its round-start state (remove a file created this round), or use recovery/rollback so it is part of the starting state. Re-running on a rewritten entrypoint cannot verify this round.",
|
|
28
|
+
test_files_modified: "Re-run the verification command after the test-file changes and report the fresh output.",
|
|
29
|
+
round_scope_drift: "Report only — drift does not block the round. If the active slice is no longer the right route, add round_contract.supersedes with the successor contract; otherwise treat this as an audit signal and continue.",
|
|
30
|
+
// v3.8 — item model: claimed-but-unverified debt
|
|
31
|
+
contract_items_unverified: "Run the bound command(s) for each claimed item so they are observed passing, or report the item as remaining (or declare outcome=\"blocked\").",
|
|
32
|
+
contract_premature: "The ACTIVE contract is still open — omit round_contract to continue it unchanged, or add round_contract.supersedes with the active rc- id and different acceptance items to replace the slice.",
|
|
33
|
+
// v4.0.6 — contract coverage
|
|
34
|
+
contract_required: "With an after-capable verification command configured, a continuing round must leave an active contract for the next round. Submit round_contract with a work_item and at least one acceptance item bound to a configured command.",
|
|
35
|
+
contract_successor_unchanged: "A closed contract's successor must bring NEW acceptance items; changing only work_item or scope re-verifies the old slice. Declare different items, or omit round_contract.",
|
|
36
|
+
// v3.7.1 — opt-in gate layer: cited gates need an approved human decision
|
|
37
|
+
user_gate_unresolved: "The round cites a high-risk action without an approved human decision. Run loopforge_gate_check, present the approval question, call loopforge_gate_resolve after the human decides, and resubmit with the approved gate id in evaluation.gate_ids.",
|
|
38
|
+
};
|
|
39
|
+
/** Fallback for unmapped check names (forward-compat with future checks). */
|
|
40
|
+
const VERIFICATION_ACTION_FALLBACK = "Re-examine the flagged claim and correct your evaluation before resubmitting.";
|
|
41
|
+
export function verificationActionFor(check) {
|
|
42
|
+
return VERIFICATION_ACTIONS[check] ?? VERIFICATION_ACTION_FALLBACK;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=verification-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verification-actions.js","sourceRoot":"","sources":["../src/verification-actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAqC;IACpE,+BAA+B,EAC7B,sHAAsH;IACxH,iCAAiC,EAC/B,8KAA8K;IAChL,2BAA2B,EACzB,yEAAyE;IAC3E,4BAA4B,EAC1B,6DAA6D;IAC/D,8BAA8B,EAC5B,iEAAiE;IACnE,mBAAmB,EACjB,iPAAiP;IACnP,wBAAwB,EACtB,8JAA8J;IAChK,yEAAyE;IACzE,0EAA0E;IAC1E,uEAAuE;IACvE,kBAAkB,EAChB,yJAAyJ;IAC3J,uBAAuB,EACrB,gGAAgG;IAClG,0BAA0B,EACxB,sDAAsD;IACxD,wEAAwE;IACxE,yDAAyD;IACzD,gCAAgC,EAC9B,wNAAwN;IAC1N,mBAAmB,EACjB,0FAA0F;IAC5F,iBAAiB,EACf,kNAAkN;IACpN,iDAAiD;IACjD,yBAAyB,EACvB,gJAAgJ;IAClJ,kBAAkB,EAChB,gMAAgM;IAClM,6BAA6B;IAC7B,iBAAiB,EACf,oOAAoO;IACtO,4BAA4B,EAC1B,6KAA6K;IAC/K,0EAA0E;IAC1E,oBAAoB,EAClB,qPAAqP;CACxP,CAAC;AAEF,6EAA6E;AAC7E,MAAM,4BAA4B,GAChC,+EAA+E,CAAC;AAElF,MAAM,UAAU,qBAAqB,CAAC,KAAa;IACjD,OAAO,oBAAoB,CAAC,KAAK,CAAC,IAAI,4BAA4B,CAAC;AACrE,CAAC"}
|
|
@@ -19,15 +19,13 @@
|
|
|
19
19
|
* framed as declaration / execution / closure stages in their doc comments.
|
|
20
20
|
*/
|
|
21
21
|
import type { VaultEntry } from "./loop-store.js";
|
|
22
|
-
import type { MachineObservation } from "./protocol.js";
|
|
23
22
|
import type { GitDeltaState, ObservationDelta } from "./evidence-provider.js";
|
|
24
23
|
import type { EntrypointDrift } from "./evidence-provider.js";
|
|
25
24
|
import type { SelfEvaluation, VerificationResult } from "./protocol.js";
|
|
26
25
|
import { type ActiveContractView } from "./round-contract.js";
|
|
26
|
+
import { type RoundFacts } from "./round-facts.js";
|
|
27
27
|
export declare const CHECK_SUCCESS_WITH_REMAINING_CRITERIA = "success_with_remaining_criteria";
|
|
28
28
|
export declare const CHECK_SUCCESS_WITHOUT_VERIFIED_EVIDENCE = "success_without_verified_evidence";
|
|
29
|
-
export declare const CHECK_OUTCOME_SUCCESS_CONTRADICTION = "outcome_success_contradiction";
|
|
30
|
-
export declare const CHECK_BLOCKED_WITHOUT_BLOCKER = "blocked_without_blocker";
|
|
31
29
|
export declare const CHECK_RETROACTIVE_CLAIM_BAD_ROUND = "retroactive_claim_bad_round";
|
|
32
30
|
export declare const CHECK_RETROACTIVE_CLAIM_UNVERIFIED = "retroactive_claim_unverified";
|
|
33
31
|
export declare const CHECK_DUPLICATE_CONSTRAINT_DISCOVERY = "duplicate_constraint_discovery";
|
|
@@ -35,7 +33,6 @@ export declare const CHECK_RECURRING_VIOLATION = "recurring_violation";
|
|
|
35
33
|
export declare const CHECK_RETRACT_FRESH_CONSTRAINT = "retract_fresh_constraint";
|
|
36
34
|
export declare const CHECK_EVIDENCE_INTEGRITY = "evidence_integrity";
|
|
37
35
|
export declare const CHECK_REQUIRED_COMMAND_FAILED = "required_command_failed";
|
|
38
|
-
export declare const CHECK_COMMAND_EVIDENCE_MISMATCH = "command_evidence_mismatch";
|
|
39
36
|
/** v3.3: Verification domain integrity — a command entrypoint (run-tests.sh,
|
|
40
37
|
* package.json, …) changed in the same round the command ran. The runtime
|
|
41
38
|
* executed a script the agent just rewrote, so the observation has no
|
|
@@ -45,7 +42,6 @@ export declare const CHECK_VERIFICATION_ENTRYPOINT_MODIFIED = "verification_entr
|
|
|
45
42
|
/** v3.3: Test files changed in the same round a verification command passed.
|
|
46
43
|
* Warn-only — the command result stays usable. */
|
|
47
44
|
export declare const CHECK_TEST_FILES_MODIFIED = "test_files_modified";
|
|
48
|
-
export declare const CHECK_BACKTRACK_WORKSPACE_NOT_RESTORED = "backtrack_workspace_not_restored";
|
|
49
45
|
export declare const CHECK_CRITERIA_CLAIMS_UNVERIFIED = "criteria_claims_unverified";
|
|
50
46
|
/** v3.8: Contract items claimed met but not machine-verified this round.
|
|
51
47
|
* The round commits; the debt is surfaced and the enforcement gate's
|
|
@@ -55,11 +51,19 @@ export declare const CHECK_CONTRACT_ITEMS_UNVERIFIED = "contract_items_unverifie
|
|
|
55
51
|
* contract's declared scope. Warn; v3.8: not waivable by explanation — the
|
|
56
52
|
* enforcement gate rejects, and repeated drift terminates. */
|
|
57
53
|
export declare const CHECK_ROUND_SCOPE_DRIFT = "round_scope_drift";
|
|
58
|
-
/** v3.5: The ACTIVE contract is still open (not completed, not
|
|
59
|
-
* while a different contract was proposed
|
|
60
|
-
*
|
|
61
|
-
*
|
|
54
|
+
/** v3.5/v4.0.6: The ACTIVE contract is still open (not completed, not
|
|
55
|
+
* blocked) while a different contract was proposed WITHOUT `supersedes`.
|
|
56
|
+
* Error: a different slice is never silently saved and ignored. To replace
|
|
57
|
+
* the active slice, add `round_contract.supersedes` naming it. */
|
|
62
58
|
export declare const CHECK_CONTRACT_PREMATURE = "contract_premature";
|
|
59
|
+
/** v4.0.6: A continuing round with contract capability and a successor
|
|
60
|
+
* available would leave the next round without an active contract. The final
|
|
61
|
+
* configured round has no successor consumer and is exempt. */
|
|
62
|
+
export declare const CHECK_CONTRACT_REQUIRED = "contract_required";
|
|
63
|
+
/** v4.0.6: A successor proposal repeats the closed contract's ACCEPTANCE ITEMS
|
|
64
|
+
* verbatim (only work_item/scope changed). Error: a successor must bring
|
|
65
|
+
* genuinely new acceptance conditions, or it would re-verify the old slice. */
|
|
66
|
+
export declare const CHECK_CONTRACT_SUCCESSOR_UNCHANGED = "contract_successor_unchanged";
|
|
63
67
|
/** v3.7.1: A cited gate (evaluation.gate_ids) is not approved. Opt-in:
|
|
64
68
|
* checked ONLY when policy.gate.enabled — citations are meaningless when
|
|
65
69
|
* the gate layer is off. Error → enforcement rejects the round. */
|
|
@@ -92,38 +96,16 @@ export declare function collectOutOfScopeFiles(files: string[], scope: string[])
|
|
|
92
96
|
export interface EvidenceStatus {
|
|
93
97
|
/** Whether this round produced a machine-verified observation. */
|
|
94
98
|
providerStatus: "verified" | "unavailable" | "absent";
|
|
95
|
-
/** The Git boundary was observed and its change set is known. */
|
|
96
|
-
gitObserved: boolean;
|
|
97
99
|
/** Applicability vs observability of the Git change set. */
|
|
98
100
|
gitChangeState: GitDeltaState["state"];
|
|
99
101
|
/** A passed after-phase command snapshot exists. */
|
|
100
102
|
commandVerified: boolean;
|
|
101
|
-
/** Agent-reported tests_reported agree with a passed command's parsed stdout. */
|
|
102
|
-
testsMachineBacked: boolean;
|
|
103
103
|
}
|
|
104
104
|
/** v3.2: Derive the machine-verification status of a round. The verification
|
|
105
105
|
* capability is modeled explicitly (verified / unavailable / absent) instead
|
|
106
106
|
* of letting evidence-dependent checks silently disappear when snapshots are
|
|
107
107
|
* missing — the fix for the "weakest when it matters most" gap. */
|
|
108
108
|
export declare function deriveEvidenceStatus(selfEval: SelfEvaluation, evidenceDeltas: ReadonlyArray<ObservationDelta>): EvidenceStatus;
|
|
109
|
-
/** Per-round machine progress over decoded committed history. */
|
|
110
|
-
export declare function machineProgressSeries(vaultEntries: VaultEntry[], currentRound: number, lookback: number): boolean[] | null;
|
|
111
|
-
interface ParsedTestCounts {
|
|
112
|
-
passed: number;
|
|
113
|
-
failed: number;
|
|
114
|
-
skipped: number;
|
|
115
|
-
total: number;
|
|
116
|
-
}
|
|
117
|
-
/** Best-effort parse of test counts from common test-runner output formats.
|
|
118
|
-
*
|
|
119
|
-
* Scans the last 2000 characters of stdout (where summary lines typically
|
|
120
|
-
* appear) and tries patterns in descending specificity order. Returns null
|
|
121
|
-
* when the output format is unrecognized, stdout is empty, or a confident
|
|
122
|
-
* parse cannot be made.
|
|
123
|
-
*
|
|
124
|
-
* Recognized formats: Jest verbose/compact, Mocha, pytest/unittest, Go test,
|
|
125
|
-
* and PHPUnit OK summaries. */
|
|
126
|
-
export declare function parseTestOutput(stdout: string): ParsedTestCounts | null;
|
|
127
109
|
/** v3.8.3: The round's out-of-scope files — the ONE derivation, shared by the
|
|
128
110
|
* drift check below and the blocked-waiver test in RoundCoordinator. The two
|
|
129
111
|
* must agree on the set, or a round could be waived for a drift the gate
|
|
@@ -134,25 +116,23 @@ export declare function parseTestOutput(stdout: string): ParsedTestCounts | null
|
|
|
134
116
|
* scope, or no git observation (cannot observe → fail open). */
|
|
135
117
|
export declare function roundDriftFiles(activeContract: ActiveContractView | null, evidenceDeltas: ReadonlyArray<ObservationDelta>): string[] | null;
|
|
136
118
|
export declare function verifySelfEvaluation(selfEval: SelfEvaluation, currentRound: number, vaultEntries: VaultEntry[], prevSelfEval?: SelfEvaluation | null, evidenceDeltas?: ReadonlyArray<ObservationDelta>,
|
|
137
|
-
/**
|
|
138
|
-
*
|
|
139
|
-
* was not properly restored before working. */
|
|
140
|
-
backtrackSkippedFiles?: string[],
|
|
141
|
-
/** M3 (v3.7.x): skipped-file git fingerprints at their failed rounds —
|
|
142
|
-
* machine proof of "untouched since the rollback" for the restore check. */
|
|
143
|
-
backtrackSkippedFingerprints?: Record<string, string>,
|
|
144
|
-
/** v2.12: Git HEAD commit of the backtrack restore point. When set, the
|
|
145
|
-
* current git snapshot must sit at this commit — otherwise the workspace
|
|
146
|
-
* was not restored and the round cannot be accepted. */
|
|
147
|
-
backtrackTargetGitHead?: string,
|
|
119
|
+
/** v3.7.1: gate records (task_type gate_opened / gate_decision) live
|
|
120
|
+
* outside the round prefix — the caller passes them in explicitly. */
|
|
148
121
|
/** v3.7.1: gate records (task_type gate_opened / gate_decision) live
|
|
149
122
|
* outside the round prefix — the caller passes them in explicitly. */
|
|
150
123
|
gateEntries?: VaultEntry[],
|
|
151
124
|
/** v3.8.3: entrypoint files that no longer match the trusted round-start
|
|
152
125
|
* baseline. Derived by the caller (it needs the in-flight trust map and
|
|
153
126
|
* filesystem access); this function stays a pure function of its inputs. */
|
|
154
|
-
entrypointDrift?: EntrypointDrift[],
|
|
155
|
-
/** v3.9: the
|
|
156
|
-
|
|
157
|
-
|
|
127
|
+
entrypointDrift?: EntrypointDrift[],
|
|
128
|
+
/** v3.9.4: whether the raw submission attempted
|
|
129
|
+
* `execution_report.files_changed` (from the persisted submittedFields
|
|
130
|
+
* manifest). Undefined falls back to "an execution report exists". */
|
|
131
|
+
filesReported?: boolean,
|
|
132
|
+
/** v4.0.3: the ONE `RoundFacts` bundle the coordinator derived before
|
|
133
|
+
* verification. When supplied, the gate consumes it instead of deriving
|
|
134
|
+
* the active contract / item statuses a second time. The fallback exists
|
|
135
|
+
* for direct library callers and unit tests; it calls the same derivation
|
|
136
|
+
* function, so there is still exactly one rule. */
|
|
137
|
+
facts?: RoundFacts, maxRounds?: number): VerificationResult;
|
|
158
138
|
//# sourceMappingURL=verification-gate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verification-gate.d.ts","sourceRoot":"","sources":["../src/verification-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"verification-gate.d.ts","sourceRoot":"","sources":["../src/verification-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAGV,cAAc,EAEd,kBAAkB,EACnB,MAAM,eAAe,CAAC;AAcvB,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAsBrE,eAAO,MAAM,qCAAqC,oCAAoC,CAAC;AACvF,eAAO,MAAM,uCAAuC,sCAAsC,CAAC;AAC3F,eAAO,MAAM,iCAAiC,gCAAgC,CAAC;AAC/E,eAAO,MAAM,kCAAkC,iCAAiC,CAAC;AACjF,eAAO,MAAM,oCAAoC,mCAAmC,CAAC;AACrF,eAAO,MAAM,yBAAyB,wBAAwB,CAAC;AAC/D,eAAO,MAAM,8BAA8B,6BAA6B,CAAC;AACzE,eAAO,MAAM,wBAAwB,uBAAuB,CAAC;AAC7D,eAAO,MAAM,6BAA6B,4BAA4B,CAAC;AACvE;;;;gDAIgD;AA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