loopforge 3.2.1 → 3.7.0
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 +74 -71
- package/dist/audit.d.ts.map +1 -1
- package/dist/audit.js +6 -38
- package/dist/audit.js.map +1 -1
- package/dist/canonical-state.d.ts +71 -6
- package/dist/canonical-state.d.ts.map +1 -1
- package/dist/canonical-state.js +176 -29
- package/dist/canonical-state.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +16 -26
- package/dist/cli.js.map +1 -1
- package/dist/cognitive-facts.d.ts +17 -0
- package/dist/cognitive-facts.d.ts.map +1 -0
- package/dist/cognitive-facts.js +99 -0
- package/dist/cognitive-facts.js.map +1 -0
- package/dist/cognitive-governance.d.ts +0 -1
- package/dist/cognitive-governance.d.ts.map +1 -1
- package/dist/cognitive-governance.js +1 -4
- package/dist/cognitive-governance.js.map +1 -1
- package/dist/committed-round.d.ts +100 -0
- package/dist/committed-round.d.ts.map +1 -0
- package/dist/committed-round.js +349 -0
- package/dist/committed-round.js.map +1 -0
- package/dist/enforcement-gate.d.ts +4 -2
- package/dist/enforcement-gate.d.ts.map +1 -1
- package/dist/enforcement-gate.js +385 -357
- package/dist/enforcement-gate.js.map +1 -1
- package/dist/engine.d.ts +16 -4
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +65 -16
- package/dist/engine.js.map +1 -1
- package/dist/evidence-claims.d.ts.map +1 -1
- package/dist/evidence-claims.js +15 -39
- package/dist/evidence-claims.js.map +1 -1
- package/dist/evidence-provider.d.ts +35 -17
- package/dist/evidence-provider.d.ts.map +1 -1
- package/dist/evidence-provider.js +105 -108
- package/dist/evidence-provider.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/loop-compiler.d.ts +21 -10
- package/dist/loop-compiler.d.ts.map +1 -1
- package/dist/loop-compiler.js +232 -276
- package/dist/loop-compiler.js.map +1 -1
- package/dist/loop-projection.d.ts +5 -25
- package/dist/loop-projection.d.ts.map +1 -1
- package/dist/loop-projection.js +18 -134
- package/dist/loop-projection.js.map +1 -1
- package/dist/loop-store.d.ts +16 -18
- package/dist/loop-store.d.ts.map +1 -1
- package/dist/loop-store.js +21 -63
- package/dist/loop-store.js.map +1 -1
- package/dist/mcp/round-lifecycle.d.ts +13 -10
- package/dist/mcp/round-lifecycle.d.ts.map +1 -1
- package/dist/mcp/round-lifecycle.js +95 -68
- package/dist/mcp/round-lifecycle.js.map +1 -1
- package/dist/mcp/server.js +3 -3
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/session.d.ts +17 -5
- package/dist/mcp/session.d.ts.map +1 -1
- package/dist/mcp/session.js +177 -54
- package/dist/mcp/session.js.map +1 -1
- package/dist/mcp/tools.d.ts +12 -0
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +161 -53
- package/dist/mcp/tools.js.map +1 -1
- package/dist/policy-metrics.d.ts +0 -7
- package/dist/policy-metrics.d.ts.map +1 -1
- package/dist/policy-metrics.js +15 -55
- package/dist/policy-metrics.js.map +1 -1
- package/dist/policy.d.ts +22 -31
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +24 -42
- package/dist/policy.js.map +1 -1
- package/dist/prompt-assembler.d.ts +0 -3
- package/dist/prompt-assembler.d.ts.map +1 -1
- package/dist/prompt-assembler.js +124 -191
- package/dist/prompt-assembler.js.map +1 -1
- package/dist/protocol.d.ts +61 -46
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +2 -18
- package/dist/protocol.js.map +1 -1
- package/dist/replay.d.ts.map +1 -1
- package/dist/replay.js +21 -22
- package/dist/replay.js.map +1 -1
- package/dist/round-contract.d.ts +64 -0
- package/dist/round-contract.d.ts.map +1 -0
- package/dist/round-contract.js +80 -0
- package/dist/round-contract.js.map +1 -0
- package/dist/round-coordinator.d.ts +5 -3
- package/dist/round-coordinator.d.ts.map +1 -1
- package/dist/round-coordinator.js +34 -29
- package/dist/round-coordinator.js.map +1 -1
- package/dist/round-driver.d.ts +0 -4
- package/dist/round-driver.d.ts.map +1 -1
- package/dist/round-driver.js +1 -11
- package/dist/round-driver.js.map +1 -1
- package/dist/round-transaction.d.ts +0 -1
- package/dist/round-transaction.d.ts.map +1 -1
- package/dist/round-transaction.js +0 -1
- package/dist/round-transaction.js.map +1 -1
- package/dist/self-eval.d.ts +29 -34
- package/dist/self-eval.d.ts.map +1 -1
- package/dist/self-eval.js +112 -148
- package/dist/self-eval.js.map +1 -1
- package/dist/token-utils.d.ts +7 -3
- package/dist/token-utils.d.ts.map +1 -1
- package/dist/token-utils.js +18 -3
- package/dist/token-utils.js.map +1 -1
- package/dist/verification-gate.d.ts +72 -21
- package/dist/verification-gate.d.ts.map +1 -1
- package/dist/verification-gate.js +544 -157
- package/dist/verification-gate.js.map +1 -1
- package/dist/workspace.d.ts +29 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +61 -0
- package/dist/workspace.js.map +1 -0
- package/loop_policy.json +5 -17
- package/package.json +2 -2
- package/skills/perception/SKILL.md +137 -136
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { DerivedGate, GateActionDescriptor } from "./protocol.js";
|
|
10
10
|
import type { VaultEntry } from "./loop-store.js";
|
|
11
|
-
export declare function entryRound(entry: VaultEntry): number;
|
|
12
11
|
/** Stable gate ID from canonicalized gate text (gate- + sha256 slice 12). */
|
|
13
12
|
export declare function deriveGateId(text: string): string;
|
|
14
13
|
/** Stable todo item ID (todo- + sha256 slice 8) for the LoopProjection. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cognitive-governance.d.ts","sourceRoot":"","sources":["../src/cognitive-governance.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"cognitive-governance.d.ts","sourceRoot":"","sources":["../src/cognitive-governance.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAYlD,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;qDACqD;AACrD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAQ3E;AAED;+EAC+E;AAC/E,wBAAgB,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAEnE;AAED,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,oBAAoB,GAC3B;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,CAwBvD;AAED;;sDAEsD;AACtD,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,GAAG,oBAAoB,EACrC,KAAK,GAAE,MAAM,EAAO,GACnB;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAkBxD;AAED;;iDAEiD;AACjD,wBAAgB,UAAU,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,CA0B9D"}
|
|
@@ -8,10 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
10
10
|
import { computeGoalTextHash } from "./loop-compiler.js";
|
|
11
|
-
import { entryRound
|
|
12
|
-
export function entryRound(entry) {
|
|
13
|
-
return sharedEntryRound(entry);
|
|
14
|
-
}
|
|
11
|
+
import { entryRound } from "./token-utils.js";
|
|
15
12
|
/** Effects that always require human authorization. */
|
|
16
13
|
const USER_EFFECTS = new Set([
|
|
17
14
|
"production", "credentials", "data_migration", "public_api", "publish",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cognitive-governance.js","sourceRoot":"","sources":["../src/cognitive-governance.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"cognitive-governance.js","sourceRoot":"","sources":["../src/cognitive-governance.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,uDAAuD;AACvD,MAAM,YAAY,GAAG,IAAI,GAAG,CAA0C;IACpE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS;IACtE,SAAS,EAAE,wBAAwB;CACpC,CAAC,CAAC;AAEH,4CAA4C;AAC5C,MAAM,SAAS,GAAG,4LAA4L,CAAC;AAE/M,6EAA6E;AAC7E,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,OAAO,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1D,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,OAAO,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC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AC,OAAO,IAAI,KAAK,CAAC,EAAE,IAAI,EAAE;YAC/B,KAAK,CAAC,OAAO,IAAI,EAAE;YACnB,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;SACpE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAChE,OAAO,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC5D,CAAC,CAAC;SACD,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/** Canonical read model for committed rounds.
|
|
2
|
+
*
|
|
3
|
+
* Durable documents remain the source of truth. This module is the only
|
|
4
|
+
* place that interprets their transaction envelope or the compiler's merged
|
|
5
|
+
* lineage representation. Consumers receive one stable, read-only view.
|
|
6
|
+
*/
|
|
7
|
+
import type { ProviderSnapshot } from "./evidence-provider.js";
|
|
8
|
+
import type { VaultEntry } from "./loop-store.js";
|
|
9
|
+
import type { ExecutionEvidence, PromptArtifact, RoundContract, RoundOutcome, SelfEvaluation, VerificationFlag } from "./protocol.js";
|
|
10
|
+
import type { RoundProcessResult } from "./round-coordinator.js";
|
|
11
|
+
export type CommittedAction = "continue" | "stop" | "backtrack";
|
|
12
|
+
export interface CommittedRoundView {
|
|
13
|
+
readonly source: "feedback" | "merged";
|
|
14
|
+
readonly sourceEntry: VaultEntry | Record<string, unknown>;
|
|
15
|
+
readonly loopId: string;
|
|
16
|
+
readonly round: number;
|
|
17
|
+
readonly roundId: string;
|
|
18
|
+
readonly sequence?: number;
|
|
19
|
+
readonly attempt: number;
|
|
20
|
+
readonly promptArtifact: PromptArtifact | null;
|
|
21
|
+
readonly evaluation: SelfEvaluation | null;
|
|
22
|
+
readonly executionEvidence: ExecutionEvidence | null;
|
|
23
|
+
readonly verificationFlags: VerificationFlag[];
|
|
24
|
+
readonly result: RoundProcessResult | null;
|
|
25
|
+
readonly action: CommittedAction;
|
|
26
|
+
readonly success: boolean;
|
|
27
|
+
readonly outcome: RoundOutcome | null;
|
|
28
|
+
readonly contractProposal: RoundContract | null;
|
|
29
|
+
readonly beforeEvidence: ProviderSnapshot[];
|
|
30
|
+
readonly afterEvidence: ProviderSnapshot[];
|
|
31
|
+
readonly roundEvidence: ProviderSnapshot[];
|
|
32
|
+
/** Normalized round-level declarations used by compiler projections. */
|
|
33
|
+
readonly outputSummary?: string;
|
|
34
|
+
readonly constraintViolations?: string[];
|
|
35
|
+
readonly discoveredConstraints?: string[];
|
|
36
|
+
readonly activeConstraints?: string[];
|
|
37
|
+
readonly retractedConstraints?: string[];
|
|
38
|
+
readonly emergedSubtasks?: string[];
|
|
39
|
+
readonly completedSubtasks?: string[];
|
|
40
|
+
readonly blockedSubtasks?: string[];
|
|
41
|
+
readonly canceledSubtasks?: string[];
|
|
42
|
+
}
|
|
43
|
+
/** Decode a durable :feedback entry. Reject/terminate/in-flight envelopes are
|
|
44
|
+
* not committed history and therefore do not produce a view. */
|
|
45
|
+
export declare function decodeCommittedRound(entry: VaultEntry): CommittedRoundView | null;
|
|
46
|
+
/** Decode an in-memory lineage entry after the engine merged its committed
|
|
47
|
+
* feedback. The merged shape is intentionally accepted only when stamped
|
|
48
|
+
* with committed_action. */
|
|
49
|
+
export declare function decodeMergedRound(entry: unknown): CommittedRoundView | null;
|
|
50
|
+
/** Normalize committed history: rollback directives disappear, later records
|
|
51
|
+
* replace earlier records for the same logical round, and output is ascending. */
|
|
52
|
+
/** Decode a committed round from either representation: an engine-hydrated
|
|
53
|
+
* merged lineage entry first (decodeMergedRound), then a durable :feedback
|
|
54
|
+
* entry. Compile-side callers used to inline this chain as a private
|
|
55
|
+
* `committedView` helper. */
|
|
56
|
+
export declare function decodeRound(entry: unknown): CommittedRoundView | null;
|
|
57
|
+
/** Lineage sub-object of an entry (`loop_lineage`; v3.7: the legacy
|
|
58
|
+
* top-level `lineage` alias was removed), or {} when absent. */
|
|
59
|
+
export declare function entryLineage(entry: unknown): Record<string, unknown>;
|
|
60
|
+
/** Extract execution_evidence from an entry, handling both direct-field and
|
|
61
|
+
* lineage-nested shapes. The decoded committed view wins when the entry is
|
|
62
|
+
* a committed round. Returns null when absent. Moved from loop-compiler so
|
|
63
|
+
* field-shape interpretation lives in this module only. */
|
|
64
|
+
export declare function entryExecutionEvidence(entry: unknown): Record<string, unknown> | null;
|
|
65
|
+
/** Read success_criteria_met from an entry's execution_evidence. */
|
|
66
|
+
export declare function entryCriteriaMet(entry: unknown): string[];
|
|
67
|
+
/** Read success_criteria_remaining from an entry's execution_evidence. */
|
|
68
|
+
export declare function entryCriteriaRemaining(entry: unknown): string[];
|
|
69
|
+
/** Read constraints_active from an entry's lineage. */
|
|
70
|
+
export declare function entryActiveConstraints(entry: unknown): string[];
|
|
71
|
+
/** Read retracted_constraints from an entry (direct field, else nested in
|
|
72
|
+
* the lineage). */
|
|
73
|
+
export declare function entryRetractedConstraints(entry: unknown): string[];
|
|
74
|
+
/** Read progress_estimate from an entry's execution_evidence (0 when
|
|
75
|
+
* absent). */
|
|
76
|
+
export declare function entryProgressEstimate(entry: unknown): number;
|
|
77
|
+
/** Read emerged_subtasks from an entry (handles direct + lineage nesting). */
|
|
78
|
+
export declare function entryEmergedSubtasks(entry: unknown): string[];
|
|
79
|
+
/** Read constraint_violations from an entry (entry-level, stored from the
|
|
80
|
+
* previous round's last_round_result at persist time — distinct from the
|
|
81
|
+
* evaluation-level violations on the committed view). Moved from
|
|
82
|
+
* verification-gate so lineage-shape reads live in this module only. */
|
|
83
|
+
export declare function entryViolations(entry: unknown): string[];
|
|
84
|
+
export declare function historyRounds(views: Iterable<CommittedRoundView | null>, beforeRound?: number): CommittedRoundView[];
|
|
85
|
+
export declare function committedRoundsFromEntries(entries: VaultEntry[], beforeRound?: number): CommittedRoundView[];
|
|
86
|
+
/** The machine-evidence set that best represents a committed round: the
|
|
87
|
+
* after-phase evidence (captured post-execution), else the round's committed
|
|
88
|
+
* diff evidence, else the pre-round baseline. Shared selector for the
|
|
89
|
+
* evidence-fallback chains that audit, claims, and backtrack-restore each
|
|
90
|
+
* used to inline with subtly different tiers — the enforcement-gate variant
|
|
91
|
+
* previously skipped roundEvidence entirely. Distinct from
|
|
92
|
+
* machineGitMotionSeries, which deliberately reads roundEvidence alone for
|
|
93
|
+
* the diffed motion signal. */
|
|
94
|
+
export declare function machineEvidenceForRound(view: CommittedRoundView): ProviderSnapshot[];
|
|
95
|
+
export declare function mergedRoundsFromEntries(entries: unknown[], beforeRound?: number): CommittedRoundView[];
|
|
96
|
+
/** Machine-observed git motion for the most recent contiguous window.
|
|
97
|
+
* Consumers must decode durable or hydrated entries before calling this;
|
|
98
|
+
* transaction-envelope interpretation stays confined to this module. */
|
|
99
|
+
export declare function machineGitMotionSeries(rounds: ReadonlyArray<CommittedRoundView>, currentRound: number, lookback: number): boolean[] | null;
|
|
100
|
+
//# sourceMappingURL=committed-round.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"committed-round.d.ts","sourceRoot":"","sources":["../src/committed-round.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,cAAc,EACd,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,O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AM,EAAE,CAK/D;AAED;oBACoB;AACpB,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CASlE;AAED;eACe;AACf,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAK5D;AAED,8EAA8E;AAC9E,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAS7D;AAED;;;yEAGyE;AACzE,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAKxD;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,QAAQ,CAAC,kBAAkB,GAAG,IAAI,CAAC,EAC1C,WAAW,SAA2B,GACrC,kBAAkB,EAAE,CAOtB;AAED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,UAAU,EAAE,EACrB,WAAW,SAA2B,GACrC,kBAAkB,EAAE,CAEtB;AAED;;;;;;;gCAOgC;AAChC,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,kBAAkB,GACvB,gBAAgB,EAAE,CAIpB;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,OAAO,EAAE,EAClB,WAAW,SAA2B,GACrC,kBAAkB,EAAE,CAEtB;AAED;;wEAEwE;AACxE,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,aAAa,CAAC,kBAAkB,CAAC,EACzC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,GACf,OAAO,EAAE,GAAG,IAAI,CAYlB"}
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
/** Canonical read model for committed rounds.
|
|
2
|
+
*
|
|
3
|
+
* Durable documents remain the source of truth. This module is the only
|
|
4
|
+
* place that interprets their transaction envelope or the compiler's merged
|
|
5
|
+
* lineage representation. Consumers receive one stable, read-only view.
|
|
6
|
+
*/
|
|
7
|
+
import { parseRoundTransactionSnapshot } from "./round-transaction.js";
|
|
8
|
+
import { effectiveOutcome, parseRoundContract } from "./self-eval.js";
|
|
9
|
+
import { entryRound, isRecord } from "./token-utils.js";
|
|
10
|
+
function committedAction(value) {
|
|
11
|
+
return value === "continue" || value === "stop" || value === "backtrack"
|
|
12
|
+
? value
|
|
13
|
+
: null;
|
|
14
|
+
}
|
|
15
|
+
function snapshots(value) {
|
|
16
|
+
return Array.isArray(value) ? value : [];
|
|
17
|
+
}
|
|
18
|
+
function flags(value) {
|
|
19
|
+
return Array.isArray(value) ? value : [];
|
|
20
|
+
}
|
|
21
|
+
function roundOutcome(value) {
|
|
22
|
+
return value === "success" || value === "partial" ||
|
|
23
|
+
value === "failed" || value === "blocked"
|
|
24
|
+
? value
|
|
25
|
+
: null;
|
|
26
|
+
}
|
|
27
|
+
function strings(value) {
|
|
28
|
+
return Array.isArray(value)
|
|
29
|
+
? value.filter((item) => typeof item === "string")
|
|
30
|
+
: [];
|
|
31
|
+
}
|
|
32
|
+
/** Decode a durable :feedback entry. Reject/terminate/in-flight envelopes are
|
|
33
|
+
* not committed history and therefore do not produce a view. */
|
|
34
|
+
export function decodeCommittedRound(entry) {
|
|
35
|
+
if (!String(entry.task_id ?? "").endsWith(":feedback"))
|
|
36
|
+
return null;
|
|
37
|
+
const lineage = isRecord(entry.loop_lineage) ? entry.loop_lineage : null;
|
|
38
|
+
const transaction = lineage && isRecord(lineage.round_transaction)
|
|
39
|
+
? lineage.round_transaction
|
|
40
|
+
: null;
|
|
41
|
+
if (!transaction)
|
|
42
|
+
return null;
|
|
43
|
+
const snapshot = parseRoundTransactionSnapshot(transaction.snapshot);
|
|
44
|
+
if (snapshot && snapshot.phase !== "committed")
|
|
45
|
+
return null;
|
|
46
|
+
const resultValue = isRecord(transaction.result)
|
|
47
|
+
? transaction.result
|
|
48
|
+
: snapshot?.result;
|
|
49
|
+
if (!isRecord(resultValue))
|
|
50
|
+
return null;
|
|
51
|
+
const action = committedAction(resultValue.action);
|
|
52
|
+
if (!action)
|
|
53
|
+
return null;
|
|
54
|
+
const result = resultValue;
|
|
55
|
+
const round = snapshot?.round ?? entryRound(entry);
|
|
56
|
+
const loopId = snapshot?.loopId ?? String(entry.loop_id ?? lineage?.loop_id ?? "");
|
|
57
|
+
if (round < 1 || !loopId)
|
|
58
|
+
return null;
|
|
59
|
+
const evaluation = snapshot?.evaluation ?? null;
|
|
60
|
+
const outcome = evaluation ? effectiveOutcome(evaluation) : null;
|
|
61
|
+
const sequence = typeof entry.sequence === "number" ? entry.sequence : undefined;
|
|
62
|
+
return {
|
|
63
|
+
source: "feedback",
|
|
64
|
+
sourceEntry: entry,
|
|
65
|
+
loopId,
|
|
66
|
+
round,
|
|
67
|
+
roundId: snapshot?.roundId ?? String(transaction.round_id ?? `loop:${loopId}:round:${round}`),
|
|
68
|
+
sequence,
|
|
69
|
+
attempt: snapshot?.attempt ?? 1,
|
|
70
|
+
promptArtifact: snapshot?.promptArtifact ?? null,
|
|
71
|
+
evaluation,
|
|
72
|
+
executionEvidence: evaluation?.execution_evidence ?? null,
|
|
73
|
+
verificationFlags: flags(result.verificationFlags),
|
|
74
|
+
result,
|
|
75
|
+
action,
|
|
76
|
+
success: result.roundSuccess === true,
|
|
77
|
+
outcome,
|
|
78
|
+
contractProposal: evaluation?.round_contract
|
|
79
|
+
? parseRoundContract(evaluation.round_contract) ?? null
|
|
80
|
+
: null,
|
|
81
|
+
beforeEvidence: snapshots(snapshot?.beforeEvidence),
|
|
82
|
+
afterEvidence: snapshots(snapshot?.afterEvidence),
|
|
83
|
+
roundEvidence: snapshots(snapshot?.roundEvidence),
|
|
84
|
+
outputSummary: evaluation?.output_summary,
|
|
85
|
+
constraintViolations: strings(evaluation?.constraint_violations),
|
|
86
|
+
discoveredConstraints: strings(evaluation?.discovered_constraints),
|
|
87
|
+
activeConstraints: strings(lineage?.constraints_active),
|
|
88
|
+
retractedConstraints: strings(evaluation?.retracted_constraints),
|
|
89
|
+
emergedSubtasks: strings(evaluation?.emerged_subtasks),
|
|
90
|
+
completedSubtasks: strings(evaluation?.completed_subtasks),
|
|
91
|
+
blockedSubtasks: strings(evaluation?.blocked_subtasks),
|
|
92
|
+
canceledSubtasks: strings(evaluation?.canceled_subtasks),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/** Decode an in-memory lineage entry after the engine merged its committed
|
|
96
|
+
* feedback. The merged shape is intentionally accepted only when stamped
|
|
97
|
+
* with committed_action. */
|
|
98
|
+
export function decodeMergedRound(entry) {
|
|
99
|
+
if (!isRecord(entry))
|
|
100
|
+
return null;
|
|
101
|
+
const raw = entry;
|
|
102
|
+
// v3.7: the legacy top-level `lineage` alias was removed — committed
|
|
103
|
+
// entries always carry `loop_lineage`.
|
|
104
|
+
const lineage = isRecord(raw.loop_lineage) ? raw.loop_lineage : {};
|
|
105
|
+
const action = committedAction(lineage.committed_action ?? raw.committed_action);
|
|
106
|
+
if (!action)
|
|
107
|
+
return null;
|
|
108
|
+
const round = entryRound(raw);
|
|
109
|
+
if (round < 1)
|
|
110
|
+
return null;
|
|
111
|
+
const loopId = typeof raw.loop_id === "string"
|
|
112
|
+
? raw.loop_id
|
|
113
|
+
: typeof lineage.loop_id === "string" ? lineage.loop_id : "";
|
|
114
|
+
const roundId = typeof lineage.round_id === "string"
|
|
115
|
+
? lineage.round_id
|
|
116
|
+
: `loop:${loopId}:round:${round}`;
|
|
117
|
+
const evaluationRaw = {};
|
|
118
|
+
const evaluationKeys = [
|
|
119
|
+
"success", "output_summary", "constraint_violations", "should_continue",
|
|
120
|
+
"discovered_constraints", "objective_refinement", "emerged_subtasks",
|
|
121
|
+
"execution_evidence", "retracted_constraints", "revised_success_criteria",
|
|
122
|
+
"wrong_assumptions", "worker_results", "compression_checkpoint",
|
|
123
|
+
"checkpoint_label", "next_action", "completed_subtasks", "blocked_subtasks",
|
|
124
|
+
"canceled_subtasks", "stop_reason", "outcome", "blocker",
|
|
125
|
+
"retroactiveClaims", "no_change_reason", "drift_clarification",
|
|
126
|
+
"prompt_requests", "round_contract",
|
|
127
|
+
];
|
|
128
|
+
let hasEvaluation = false;
|
|
129
|
+
for (const key of evaluationKeys) {
|
|
130
|
+
const value = raw[key] ?? lineage[key];
|
|
131
|
+
if (value !== undefined) {
|
|
132
|
+
evaluationRaw[key] = value;
|
|
133
|
+
hasEvaluation = true;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const evaluation = hasEvaluation
|
|
137
|
+
? evaluationRaw
|
|
138
|
+
: null;
|
|
139
|
+
const resultRaw = isRecord(lineage.result) ? lineage.result : null;
|
|
140
|
+
const result = resultRaw ? resultRaw : null;
|
|
141
|
+
const outcome = roundOutcome(evaluationRaw.outcome) ??
|
|
142
|
+
(typeof evaluationRaw.success === "boolean"
|
|
143
|
+
? evaluationRaw.success ? "success" : "failed"
|
|
144
|
+
: null);
|
|
145
|
+
const proposal = parseRoundContract(evaluationRaw.round_contract) ?? null;
|
|
146
|
+
const executionEvidence = isRecord(evaluationRaw.execution_evidence)
|
|
147
|
+
? evaluationRaw.execution_evidence
|
|
148
|
+
: null;
|
|
149
|
+
return {
|
|
150
|
+
source: "merged",
|
|
151
|
+
sourceEntry: raw,
|
|
152
|
+
loopId,
|
|
153
|
+
round,
|
|
154
|
+
roundId,
|
|
155
|
+
sequence: typeof lineage.sequence === "number" ? lineage.sequence : undefined,
|
|
156
|
+
attempt: typeof lineage.attempt === "number" ? lineage.attempt : 1,
|
|
157
|
+
promptArtifact: isRecord(lineage.prompt_artifact)
|
|
158
|
+
? lineage.prompt_artifact
|
|
159
|
+
: null,
|
|
160
|
+
evaluation,
|
|
161
|
+
executionEvidence,
|
|
162
|
+
verificationFlags: flags(raw.verification_flags ?? lineage.verification_flags),
|
|
163
|
+
result,
|
|
164
|
+
action,
|
|
165
|
+
success: typeof raw.success === "boolean"
|
|
166
|
+
? raw.success
|
|
167
|
+
: typeof lineage.success === "boolean" ? lineage.success : false,
|
|
168
|
+
outcome,
|
|
169
|
+
contractProposal: proposal,
|
|
170
|
+
beforeEvidence: snapshots(lineage.before_evidence),
|
|
171
|
+
afterEvidence: snapshots(lineage.after_evidence),
|
|
172
|
+
roundEvidence: snapshots(lineage.round_evidence),
|
|
173
|
+
outputSummary: typeof evaluationRaw.output_summary === "string"
|
|
174
|
+
? evaluationRaw.output_summary
|
|
175
|
+
: undefined,
|
|
176
|
+
constraintViolations: strings(evaluationRaw.constraint_violations),
|
|
177
|
+
discoveredConstraints: strings(evaluationRaw.discovered_constraints),
|
|
178
|
+
activeConstraints: strings(raw.constraints_active ?? lineage.constraints_active),
|
|
179
|
+
retractedConstraints: strings(evaluationRaw.retracted_constraints),
|
|
180
|
+
emergedSubtasks: strings(evaluationRaw.emerged_subtasks),
|
|
181
|
+
completedSubtasks: strings(evaluationRaw.completed_subtasks),
|
|
182
|
+
blockedSubtasks: strings(evaluationRaw.blocked_subtasks),
|
|
183
|
+
canceledSubtasks: strings(evaluationRaw.canceled_subtasks),
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
/** Normalize committed history: rollback directives disappear, later records
|
|
187
|
+
* replace earlier records for the same logical round, and output is ascending. */
|
|
188
|
+
/** Decode a committed round from either representation: an engine-hydrated
|
|
189
|
+
* merged lineage entry first (decodeMergedRound), then a durable :feedback
|
|
190
|
+
* entry. Compile-side callers used to inline this chain as a private
|
|
191
|
+
* `committedView` helper. */
|
|
192
|
+
export function decodeRound(entry) {
|
|
193
|
+
return decodeMergedRound(entry) ?? decodeCommittedRound(entry);
|
|
194
|
+
}
|
|
195
|
+
/** Lineage sub-object of an entry (`loop_lineage`; v3.7: the legacy
|
|
196
|
+
* top-level `lineage` alias was removed), or {} when absent. */
|
|
197
|
+
export function entryLineage(entry) {
|
|
198
|
+
if (!isRecord(entry))
|
|
199
|
+
return {};
|
|
200
|
+
const value = entry.loop_lineage;
|
|
201
|
+
return isRecord(value) ? value : {};
|
|
202
|
+
}
|
|
203
|
+
/** Extract execution_evidence from an entry, handling both direct-field and
|
|
204
|
+
* lineage-nested shapes. The decoded committed view wins when the entry is
|
|
205
|
+
* a committed round. Returns null when absent. Moved from loop-compiler so
|
|
206
|
+
* field-shape interpretation lives in this module only. */
|
|
207
|
+
export function entryExecutionEvidence(entry) {
|
|
208
|
+
const view = decodeRound(entry);
|
|
209
|
+
if (view)
|
|
210
|
+
return view.executionEvidence;
|
|
211
|
+
const record = isRecord(entry) ? entry : {};
|
|
212
|
+
const direct = record.execution_evidence;
|
|
213
|
+
if (isRecord(direct))
|
|
214
|
+
return direct;
|
|
215
|
+
const nested = entryLineage(entry).execution_evidence;
|
|
216
|
+
return isRecord(nested) ? nested : null;
|
|
217
|
+
}
|
|
218
|
+
/** Read success_criteria_met from an entry's execution_evidence. */
|
|
219
|
+
export function entryCriteriaMet(entry) {
|
|
220
|
+
const view = decodeRound(entry);
|
|
221
|
+
if (view)
|
|
222
|
+
return view.executionEvidence?.success_criteria_met
|
|
223
|
+
?.filter((value) => typeof value === "string") ?? [];
|
|
224
|
+
const ev = entryExecutionEvidence(entry);
|
|
225
|
+
if (!ev)
|
|
226
|
+
return [];
|
|
227
|
+
const arr = ev.success_criteria_met;
|
|
228
|
+
return Array.isArray(arr) ? arr.filter((v) => typeof v === "string") : [];
|
|
229
|
+
}
|
|
230
|
+
/** Read success_criteria_remaining from an entry's execution_evidence. */
|
|
231
|
+
export function entryCriteriaRemaining(entry) {
|
|
232
|
+
const view = decodeRound(entry);
|
|
233
|
+
if (view)
|
|
234
|
+
return view.executionEvidence?.success_criteria_remaining
|
|
235
|
+
?.filter((value) => typeof value === "string") ?? [];
|
|
236
|
+
const ev = entryExecutionEvidence(entry);
|
|
237
|
+
if (!ev)
|
|
238
|
+
return [];
|
|
239
|
+
const arr = ev.success_criteria_remaining;
|
|
240
|
+
return Array.isArray(arr) ? arr.filter((v) => typeof v === "string") : [];
|
|
241
|
+
}
|
|
242
|
+
/** Read constraints_active from an entry's lineage. */
|
|
243
|
+
export function entryActiveConstraints(entry) {
|
|
244
|
+
const view = decodeRound(entry);
|
|
245
|
+
if (view)
|
|
246
|
+
return view.activeConstraints ?? [];
|
|
247
|
+
const arr = entryLineage(entry).constraints_active;
|
|
248
|
+
return Array.isArray(arr) ? arr.filter((v) => typeof v === "string") : [];
|
|
249
|
+
}
|
|
250
|
+
/** Read retracted_constraints from an entry (direct field, else nested in
|
|
251
|
+
* the lineage). */
|
|
252
|
+
export function entryRetractedConstraints(entry) {
|
|
253
|
+
const view = decodeRound(entry);
|
|
254
|
+
if (view)
|
|
255
|
+
return view.retractedConstraints ?? [];
|
|
256
|
+
const record = isRecord(entry) ? entry : {};
|
|
257
|
+
const direct = record.retracted_constraints;
|
|
258
|
+
if (Array.isArray(direct))
|
|
259
|
+
return direct.filter((v) => typeof v === "string");
|
|
260
|
+
const nested = entryLineage(entry).retracted_constraints;
|
|
261
|
+
if (Array.isArray(nested))
|
|
262
|
+
return nested.filter((v) => typeof v === "string");
|
|
263
|
+
return [];
|
|
264
|
+
}
|
|
265
|
+
/** Read progress_estimate from an entry's execution_evidence (0 when
|
|
266
|
+
* absent). */
|
|
267
|
+
export function entryProgressEstimate(entry) {
|
|
268
|
+
const ev = entryExecutionEvidence(entry);
|
|
269
|
+
if (!ev)
|
|
270
|
+
return 0;
|
|
271
|
+
const pe = ev.progress_estimate;
|
|
272
|
+
return typeof pe === "number" ? pe : 0;
|
|
273
|
+
}
|
|
274
|
+
/** Read emerged_subtasks from an entry (handles direct + lineage nesting). */
|
|
275
|
+
export function entryEmergedSubtasks(entry) {
|
|
276
|
+
const view = decodeRound(entry);
|
|
277
|
+
if (view)
|
|
278
|
+
return view.emergedSubtasks ?? [];
|
|
279
|
+
const record = isRecord(entry) ? entry : {};
|
|
280
|
+
const direct = record.emerged_subtasks;
|
|
281
|
+
if (Array.isArray(direct))
|
|
282
|
+
return direct.filter((v) => typeof v === "string");
|
|
283
|
+
const nested = entryLineage(entry).emerged_subtasks;
|
|
284
|
+
if (Array.isArray(nested))
|
|
285
|
+
return nested.filter((v) => typeof v === "string");
|
|
286
|
+
return [];
|
|
287
|
+
}
|
|
288
|
+
/** Read constraint_violations from an entry (entry-level, stored from the
|
|
289
|
+
* previous round's last_round_result at persist time — distinct from the
|
|
290
|
+
* evaluation-level violations on the committed view). Moved from
|
|
291
|
+
* verification-gate so lineage-shape reads live in this module only. */
|
|
292
|
+
export function entryViolations(entry) {
|
|
293
|
+
const record = isRecord(entry) ? entry : {};
|
|
294
|
+
const viols = record.constraint_violations;
|
|
295
|
+
if (Array.isArray(viols))
|
|
296
|
+
return viols.filter((v) => typeof v === "string");
|
|
297
|
+
return [];
|
|
298
|
+
}
|
|
299
|
+
export function historyRounds(views, beforeRound = Number.POSITIVE_INFINITY) {
|
|
300
|
+
const byRound = new Map();
|
|
301
|
+
for (const view of views) {
|
|
302
|
+
if (!view || view.action === "backtrack" || view.round >= beforeRound)
|
|
303
|
+
continue;
|
|
304
|
+
byRound.set(view.round, view);
|
|
305
|
+
}
|
|
306
|
+
return [...byRound.values()].sort((a, b) => a.round - b.round);
|
|
307
|
+
}
|
|
308
|
+
export function committedRoundsFromEntries(entries, beforeRound = Number.POSITIVE_INFINITY) {
|
|
309
|
+
return historyRounds(entries.map(decodeCommittedRound), beforeRound);
|
|
310
|
+
}
|
|
311
|
+
/** The machine-evidence set that best represents a committed round: the
|
|
312
|
+
* after-phase evidence (captured post-execution), else the round's committed
|
|
313
|
+
* diff evidence, else the pre-round baseline. Shared selector for the
|
|
314
|
+
* evidence-fallback chains that audit, claims, and backtrack-restore each
|
|
315
|
+
* used to inline with subtly different tiers — the enforcement-gate variant
|
|
316
|
+
* previously skipped roundEvidence entirely. Distinct from
|
|
317
|
+
* machineGitMotionSeries, which deliberately reads roundEvidence alone for
|
|
318
|
+
* the diffed motion signal. */
|
|
319
|
+
export function machineEvidenceForRound(view) {
|
|
320
|
+
if (view.afterEvidence.length > 0)
|
|
321
|
+
return view.afterEvidence;
|
|
322
|
+
if (view.roundEvidence.length > 0)
|
|
323
|
+
return view.roundEvidence;
|
|
324
|
+
return view.beforeEvidence;
|
|
325
|
+
}
|
|
326
|
+
export function mergedRoundsFromEntries(entries, beforeRound = Number.POSITIVE_INFINITY) {
|
|
327
|
+
return historyRounds(entries.map(decodeMergedRound), beforeRound);
|
|
328
|
+
}
|
|
329
|
+
/** Machine-observed git motion for the most recent contiguous window.
|
|
330
|
+
* Consumers must decode durable or hydrated entries before calling this;
|
|
331
|
+
* transaction-envelope interpretation stays confined to this module. */
|
|
332
|
+
export function machineGitMotionSeries(rounds, currentRound, lookback) {
|
|
333
|
+
const byRound = new Map();
|
|
334
|
+
for (const round of rounds) {
|
|
335
|
+
if (round.round < 1 || round.round >= currentRound)
|
|
336
|
+
continue;
|
|
337
|
+
const git = round.roundEvidence.find((snapshot) => snapshot.provider === "git");
|
|
338
|
+
if (!git)
|
|
339
|
+
continue;
|
|
340
|
+
byRound.set(round.round, Array.isArray(git.files) && git.files.length > 0);
|
|
341
|
+
}
|
|
342
|
+
if (byRound.size < lookback)
|
|
343
|
+
return null;
|
|
344
|
+
const recent = [...byRound.keys()].sort((a, b) => a - b).slice(-lookback);
|
|
345
|
+
if (recent[0] < currentRound - lookback)
|
|
346
|
+
return null;
|
|
347
|
+
return recent.map((round) => byRound.get(round));
|
|
348
|
+
}
|
|
349
|
+
//# sourceMappingURL=committed-round.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"committed-round.js","sourceRoot":"","sources":["../src/committed-round.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAoCxD,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,KAAK,KAAK,UAAU,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,WAAW;QACtE,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED,SAAS,SAAS,CAAC,K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CAAC,KAAK,CAAE,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -45,7 +45,9 @@ gitHead?: string): string;
|
|
|
45
45
|
/** Enforce round-boundary rules based on the verification gate's findings
|
|
46
46
|
* and the agent's self-evaluation integrity.
|
|
47
47
|
*
|
|
48
|
-
* Rules run in priority order
|
|
48
|
+
* Rules run in priority order — the rules array below IS the priority
|
|
49
|
+
* order; numeric IDs (R1–R9, R-EVID) reflect insertion history, not
|
|
50
|
+
* priority. The first rule that fires wins.
|
|
49
51
|
*
|
|
50
52
|
* @param selfEval The agent's self-evaluation for the current round.
|
|
51
53
|
* @param verifyResult The verification gate's output (from verifySelfEvaluation).
|
|
@@ -54,7 +56,7 @@ gitHead?: string): string;
|
|
|
54
56
|
* @param consecutiveRejections How many consecutive rounds have already been rejected.
|
|
55
57
|
* Starts at 0; increments on each reject; resets on accept.
|
|
56
58
|
*/
|
|
57
|
-
export declare function enforceRound(selfEval: SelfEvaluation, verifyResult: VerificationResult, currentRound: number, vaultEntries: VaultEntry[], consecutiveRejections?: number,
|
|
59
|
+
export declare function enforceRound(selfEval: SelfEvaluation, verifyResult: VerificationResult, currentRound: number, vaultEntries: VaultEntry[], consecutiveRejections?: number,
|
|
58
60
|
/** v2.12: Current clarification streak for R7 escalation. */
|
|
59
61
|
driftClarificationStreak?: number): EnforcementResult;
|
|
60
62
|
/** Build a rejection prompt for the agent.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enforcement-gate.d.ts","sourceRoot":"","sources":["../src/enforcement-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"enforcement-gate.d.ts","sourceRoot":"","sources":["../src/enforcement-gate.ts"],"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