loopforge 3.9.4 → 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 +114 -40
- package/dist/canonical-state.d.ts.map +1 -1
- package/dist/canonical-state.js +276 -182
- 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 +97 -156
- package/dist/committed-round.d.ts.map +1 -1
- package/dist/committed-round.js +223 -419
- 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 +26 -38
- package/dist/enforcement-gate.d.ts.map +1 -1
- package/dist/enforcement-gate.js +196 -319
- 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 +27 -897
- 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 +166 -27
- package/dist/explain.d.ts.map +1 -1
- package/dist/explain.js +372 -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 +39 -23
- package/dist/loop-compiler.d.ts.map +1 -1
- package/dist/loop-compiler.js +368 -565
- 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 +255 -81
- package/dist/mcp/round-lifecycle.d.ts.map +1 -1
- package/dist/mcp/round-lifecycle.js +1552 -539
- package/dist/mcp/round-lifecycle.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +42 -18
- 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 +956 -282
- 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 -92
- 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 +707 -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 +11 -39
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +12 -12
- 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 +20 -6
- package/dist/prompt-assembler.d.ts.map +1 -1
- package/dist/prompt-assembler.js +475 -479
- package/dist/prompt-assembler.js.map +1 -1
- package/dist/prompt-coverage.d.ts +0 -6
- package/dist/prompt-coverage.d.ts.map +1 -1
- package/dist/prompt-coverage.js +4 -8
- package/dist/prompt-coverage.js.map +1 -1
- package/dist/prompt-freshness.d.ts +6 -17
- package/dist/prompt-freshness.d.ts.map +1 -1
- package/dist/prompt-freshness.js +27 -22
- package/dist/prompt-freshness.js.map +1 -1
- package/dist/prompt-policy.d.ts +14 -7
- package/dist/prompt-policy.d.ts.map +1 -1
- package/dist/prompt-policy.js +21 -5
- package/dist/prompt-policy.js.map +1 -1
- package/dist/protocol.d.ts +843 -424
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +73 -102
- 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 +41 -89
- package/dist/round-coordinator.d.ts.map +1 -1
- package/dist/round-coordinator.js +250 -267
- 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 +51 -160
- 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 +837 -38
- package/dist/round-transaction.js.map +1 -1
- package/dist/self-eval.d.ts +37 -61
- package/dist/self-eval.d.ts.map +1 -1
- package/dist/self-eval.js +413 -392
- 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 +29 -21
- package/dist/submission-guidance.d.ts.map +1 -1
- package/dist/submission-guidance.js +308 -260
- 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 +145 -51
- package/dist/submission-receipt.js.map +1 -1
- package/dist/token-utils.d.ts +28 -7
- package/dist/token-utils.d.ts.map +1 -1
- package/dist/token-utils.js +27 -11
- 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.map +1 -1
- package/dist/verification-actions.js +10 -11
- package/dist/verification-actions.js.map +1 -1
- package/dist/verification-gate.d.ts +23 -47
- package/dist/verification-gate.d.ts.map +1 -1
- package/dist/verification-gate.js +202 -423
- 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 +4 -18
- package/package.json +68 -68
- 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 -389
package/dist/round-contract.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
/** Round Contract derivation — the ACTIVE contract a round executes under.
|
|
2
|
+
*
|
|
3
|
+
* v3.9.5 semantics: `work_item` is the bounded deliverable this slice
|
|
4
|
+
* produces (an outcome, not an activity); `items[]` are acceptance
|
|
5
|
+
* conditions inside that slice; each item binds its own `verify_with`
|
|
6
|
+
* commands. The contract is verified only when every item is verified, so
|
|
7
|
+
* there is no work_item-level claim. A command may back several conditions.
|
|
2
8
|
*
|
|
3
9
|
* A submission's `round_contract` is a PROPOSAL for the next round. It
|
|
4
10
|
* becomes ACTIVE only after the declaring round commits; the active contract
|
|
@@ -9,10 +15,11 @@
|
|
|
9
15
|
*
|
|
10
16
|
* v3.8 identity: `rc-` / `rci-` are derived from CONTENT ONLY (loop id +
|
|
11
17
|
* canonical proposal), so restating an unchanged contract keeps the same
|
|
12
|
-
* identity and the item ids the agent already cited.
|
|
18
|
+
* identity and the item ids the agent already cited. `rci-` is deliberately
|
|
19
|
+
* independent of `work_item`/`scope`, which stay slice-level labels. This is
|
|
13
20
|
* the opposite of a SubGoal, whose id includes its declaration round.
|
|
14
21
|
*/
|
|
15
|
-
import type { ContractItemProposal, ExecutionReport, RoundContractProposal } from "./protocol.js";
|
|
22
|
+
import type { ContractItemProposal, ContractSupersede, ExecutionReport, RoundContractProposal } from "./protocol.js";
|
|
16
23
|
import type { ObservationDelta } from "./evidence-provider.js";
|
|
17
24
|
import type { CommittedRoundView } from "./committed-round.js";
|
|
18
25
|
import type { CommandEvidencePolicy } from "./policy.js";
|
|
@@ -27,7 +34,11 @@ export interface ActiveContractView {
|
|
|
27
34
|
/** The round that declared the proposal that became active (a fact, not
|
|
28
35
|
* part of the identity hash). */
|
|
29
36
|
declared_at_round: number;
|
|
37
|
+
/** The bounded deliverable label. Optional only for legacy committed
|
|
38
|
+
* contracts; new declarations require it at the strict boundary. */
|
|
30
39
|
work_item?: string;
|
|
40
|
+
/** Report-only intended files/directories for this slice. It grants no
|
|
41
|
+
* permission and is never enforced; drift is an info fact. */
|
|
31
42
|
scope: string[];
|
|
32
43
|
items: ActiveContractItem[];
|
|
33
44
|
/** The command configuration in force at declaration (machine-stamped at
|
|
@@ -43,10 +54,31 @@ export declare function activateContract(proposal: RoundContractProposal, declar
|
|
|
43
54
|
* contract. Never compare by id (8 hex = 32 bits; a collision must not merge
|
|
44
55
|
* two different contracts). */
|
|
45
56
|
export declare function sameContract(left: RoundContractProposal, right: RoundContractProposal): boolean;
|
|
57
|
+
/** v3.9.9 / v4.0.6: the ONE current-round fact bundle for contract
|
|
58
|
+
* derivations. Every caller passes report/deltas/blocked/redirect together,
|
|
59
|
+
* so a consumer can no longer forget the round's blocked declaration or its
|
|
60
|
+
* explicit redirect while another consumer sees them. */
|
|
61
|
+
export interface CurrentRoundFacts {
|
|
62
|
+
report: ExecutionReport | null;
|
|
63
|
+
deltas: ReadonlyArray<ObservationDelta>;
|
|
64
|
+
/** The round's ONE blocked declaration (`outcome: "blocked"`). */
|
|
65
|
+
blocked: boolean;
|
|
66
|
+
/** The round's explicit contract redirect, if it declared one
|
|
67
|
+
* (`round_contract.supersedes`). */
|
|
68
|
+
redirect: ContractSupersede | null;
|
|
69
|
+
}
|
|
70
|
+
export declare const NO_CURRENT_ROUND_FACTS: CurrentRoundFacts;
|
|
71
|
+
/** Read a committed view's current-round facts. Read views (audit/explain/
|
|
72
|
+
* receipt/round-facts) use this instead of hand-building `outcome`-only
|
|
73
|
+
* blocked flags. */
|
|
74
|
+
export declare function committedRoundFacts(view: CommittedRoundView): CurrentRoundFacts;
|
|
75
|
+
/** v4.0.6: The successor's acceptance CONTENT must actually change. A new
|
|
76
|
+
* work_item or scope label alone is not a new slice. Exported because the
|
|
77
|
+
* verification gate's `contract_successor_unchanged` check uses the SAME
|
|
78
|
+
* content identity. */
|
|
79
|
+
export declare function acceptanceItemsDiffer(proposal: RoundContractProposal, active: ActiveContractView): boolean;
|
|
46
80
|
/** v3.8: The active contract after replaying committed rounds in order. */
|
|
47
81
|
export declare function deriveActiveRoundContract(rounds: ReadonlyArray<CommittedRoundView>, commands?: ReadonlyArray<CommandEvidencePolicy>): ActiveContractView | null;
|
|
48
|
-
/** v3.8: Every criterion id referenced by the contract's items. */
|
|
49
|
-
export declare function contractCriterionIds(contract: ActiveContractView): string[];
|
|
50
82
|
/** v3.8: The contract a round EXECUTED under, plus every item's status as of
|
|
51
83
|
* that round — the ONE derivation the live coordinator, explain and audit
|
|
52
84
|
* share, so the three can never disagree about what a round ran under.
|
|
@@ -65,10 +97,8 @@ export declare function deriveRoundContractView(input: {
|
|
|
65
97
|
/** Committed rounds (rollback-excluded), ascending. */
|
|
66
98
|
rounds: ReadonlyArray<CommittedRoundView>;
|
|
67
99
|
round: number;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
/** The round's committed/effective outcome — `blocked` closes its contract. */
|
|
71
|
-
outcome: string | null;
|
|
100
|
+
/** The single bundle for the round being evaluated. */
|
|
101
|
+
current: CurrentRoundFacts;
|
|
72
102
|
commands: ReadonlyArray<CommandEvidencePolicy>;
|
|
73
103
|
}): {
|
|
74
104
|
contract: ActiveContractView | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"round-contract.d.ts","sourceRoot":"","sources":["../src/round-contract.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"round-contract.d.ts","sourceRoot":"","sources":["../src/round-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACtB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAQzD,OAAO,KAAK,E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,CACnC,QAAQ,EAAE,qBAAqB,EAC/B,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAUT;AAED,2EAA2E;AAC3E,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,aAAa,CAAC,kBAAkB,CAAC,EACzC,QAAQ,GAAE,aAAa,CAAC,qBAAqB,CAAuC,GACnF,kBAAkB,GAAG,IAAI,CA4C3B;AAED;;;;;;;;;;;;;mDAamD;AACnD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,uDAAuD;IACvD,MAAM,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,QAAQ,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;CAChD,GAAG;IAAE,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,sBAAsB,CAAA;CAAE,CAgB5E"}
|
package/dist/round-contract.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
/** Round Contract derivation — the ACTIVE contract a round executes under.
|
|
2
|
+
*
|
|
3
|
+
* v3.9.5 semantics: `work_item` is the bounded deliverable this slice
|
|
4
|
+
* produces (an outcome, not an activity); `items[]` are acceptance
|
|
5
|
+
* conditions inside that slice; each item binds its own `verify_with`
|
|
6
|
+
* commands. The contract is verified only when every item is verified, so
|
|
7
|
+
* there is no work_item-level claim. A command may back several conditions.
|
|
2
8
|
*
|
|
3
9
|
* A submission's `round_contract` is a PROPOSAL for the next round. It
|
|
4
10
|
* becomes ACTIVE only after the declaring round commits; the active contract
|
|
@@ -9,12 +15,14 @@
|
|
|
9
15
|
*
|
|
10
16
|
* v3.8 identity: `rc-` / `rci-` are derived from CONTENT ONLY (loop id +
|
|
11
17
|
* canonical proposal), so restating an unchanged contract keeps the same
|
|
12
|
-
* identity and the item ids the agent already cited.
|
|
18
|
+
* identity and the item ids the agent already cited. `rci-` is deliberately
|
|
19
|
+
* independent of `work_item`/`scope`, which stay slice-level labels. This is
|
|
13
20
|
* the opposite of a SubGoal, whose id includes its declaration round.
|
|
14
21
|
*/
|
|
15
|
-
import { canonicalContractText, deriveContractId, deriveContractItemIds, } from "./token-utils.js";
|
|
22
|
+
import { canonicalContractItemText, canonicalContractText, deriveContractId, deriveContractItemIds, } from "./token-utils.js";
|
|
16
23
|
import { deriveContractItemStatuses } from "./contract-items.js";
|
|
17
24
|
import { getPolicy } from "./policy.js";
|
|
25
|
+
import { declaresBlocked } from "./round-outcome.js";
|
|
18
26
|
/** v3.8: Build the derived active contract from a committed proposal plus the
|
|
19
27
|
* binding the runtime stamped when that round committed. */
|
|
20
28
|
export function activateContract(proposal, declaredAtRound, binding, loopId) {
|
|
@@ -23,11 +31,10 @@ export function activateContract(proposal, declaredAtRound, binding, loopId) {
|
|
|
23
31
|
id: deriveContractId(loopId, proposal),
|
|
24
32
|
declared_at_round: declaredAtRound,
|
|
25
33
|
work_item: proposal.work_item,
|
|
26
|
-
scope: [...proposal.scope],
|
|
34
|
+
scope: [...(proposal.scope ?? [])],
|
|
27
35
|
items: proposal.items.map((item, index) => ({
|
|
28
36
|
description: item.description,
|
|
29
|
-
criterion_refs: [...item.criterion_refs],
|
|
30
|
-
subgoal_refs: [...item.subgoal_refs],
|
|
37
|
+
criterion_refs: [...(item.criterion_refs ?? [])],
|
|
31
38
|
verify_with: [...item.verify_with],
|
|
32
39
|
id: itemIds[index],
|
|
33
40
|
})),
|
|
@@ -40,6 +47,40 @@ export function activateContract(proposal, declaredAtRound, binding, loopId) {
|
|
|
40
47
|
export function sameContract(left, right) {
|
|
41
48
|
return canonicalContractText(left) === canonicalContractText(right);
|
|
42
49
|
}
|
|
50
|
+
export const NO_CURRENT_ROUND_FACTS = {
|
|
51
|
+
report: null,
|
|
52
|
+
deltas: [],
|
|
53
|
+
blocked: false,
|
|
54
|
+
redirect: null,
|
|
55
|
+
};
|
|
56
|
+
/** Read a committed view's current-round facts. Read views (audit/explain/
|
|
57
|
+
* receipt/round-facts) use this instead of hand-building `outcome`-only
|
|
58
|
+
* blocked flags. */
|
|
59
|
+
export function committedRoundFacts(view) {
|
|
60
|
+
return {
|
|
61
|
+
report: view.executionReport,
|
|
62
|
+
deltas: view.observationDelta,
|
|
63
|
+
blocked: view.evaluation
|
|
64
|
+
? declaresBlocked(view.evaluation)
|
|
65
|
+
: view.agentOutcome === "blocked",
|
|
66
|
+
redirect: view.contractRedirect,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/** v4.0.6: The successor's acceptance CONTENT must actually change. A new
|
|
70
|
+
* work_item or scope label alone is not a new slice. Exported because the
|
|
71
|
+
* verification gate's `contract_successor_unchanged` check uses the SAME
|
|
72
|
+
* content identity. */
|
|
73
|
+
export function acceptanceItemsDiffer(proposal, active) {
|
|
74
|
+
const next = new Set(proposal.items.map((item) => canonicalContractItemText(item)));
|
|
75
|
+
const current = new Set(active.items.map((item) => canonicalContractItemText(item)));
|
|
76
|
+
if (next.size !== current.size)
|
|
77
|
+
return true;
|
|
78
|
+
for (const identity of next) {
|
|
79
|
+
if (!current.has(identity))
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
43
84
|
/** v3.8: The active contract after replaying committed rounds in order. */
|
|
44
85
|
export function deriveActiveRoundContract(rounds, commands = getPolicy().evidence.commands ?? []) {
|
|
45
86
|
let active = null;
|
|
@@ -53,40 +94,38 @@ export function deriveActiveRoundContract(rounds, commands = getPolicy().evidenc
|
|
|
53
94
|
active = activate();
|
|
54
95
|
continue;
|
|
55
96
|
}
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
if (round.outcome === "blocked") {
|
|
60
|
-
active = activate();
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
97
|
+
// The round's item closure under the same reducer every other consumer
|
|
98
|
+
// uses. The current slice is this committed round's own facts, so a
|
|
99
|
+
// blocked/superseded closure is attributed to the round that caused it.
|
|
63
100
|
const statuses = deriveContractItemStatuses({
|
|
64
101
|
contract: active,
|
|
65
|
-
rounds: rounds.slice(0, index
|
|
66
|
-
currentRound: round.round
|
|
67
|
-
currentReport:
|
|
68
|
-
currentDeltas:
|
|
102
|
+
rounds: rounds.slice(0, index),
|
|
103
|
+
currentRound: round.round,
|
|
104
|
+
currentReport: round.executionReport,
|
|
105
|
+
currentDeltas: round.observationDelta,
|
|
106
|
+
currentBlocked: round.evaluation
|
|
107
|
+
? declaresBlocked(round.evaluation)
|
|
108
|
+
: round.agentOutcome === "blocked",
|
|
109
|
+
currentRedirect: round.contractRedirect,
|
|
69
110
|
commands,
|
|
70
111
|
});
|
|
71
|
-
if (statuses.closure === "verified") {
|
|
112
|
+
if (statuses.closure === "blocked" || statuses.closure === "verified") {
|
|
72
113
|
active = activate();
|
|
73
114
|
continue;
|
|
74
115
|
}
|
|
116
|
+
if (statuses.closure === "superseded") {
|
|
117
|
+
// The reducer already matched the transition target to THIS contract.
|
|
118
|
+
// Activate only a real successor with different acceptance content;
|
|
119
|
+
// abnormal data keeps the original active contract rather than losing it.
|
|
120
|
+
if (proposal && acceptanceItemsDiffer(proposal, active)) {
|
|
121
|
+
active = activate();
|
|
122
|
+
}
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
75
125
|
// Otherwise the active contract stays; a different proposal is ignored.
|
|
76
126
|
}
|
|
77
127
|
return active;
|
|
78
128
|
}
|
|
79
|
-
/** v3.8: Every criterion id referenced by the contract's items. */
|
|
80
|
-
export function contractCriterionIds(contract) {
|
|
81
|
-
const ids = new Set();
|
|
82
|
-
for (const item of contract.items) {
|
|
83
|
-
for (const ref of item.criterion_refs) {
|
|
84
|
-
if (/^cr-[a-f0-9]{8}$/.test(ref))
|
|
85
|
-
ids.add(ref);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return [...ids];
|
|
89
|
-
}
|
|
90
129
|
/** v3.8: The contract a round EXECUTED under, plus every item's status as of
|
|
91
130
|
* that round — the ONE derivation the live coordinator, explain and audit
|
|
92
131
|
* share, so the three can never disagree about what a round ran under.
|
|
@@ -110,9 +149,10 @@ export function deriveRoundContractView(input) {
|
|
|
110
149
|
contract,
|
|
111
150
|
rounds: prior,
|
|
112
151
|
currentRound: input.round,
|
|
113
|
-
currentReport: input.report,
|
|
114
|
-
currentDeltas: input.deltas,
|
|
115
|
-
|
|
152
|
+
currentReport: input.current.report,
|
|
153
|
+
currentDeltas: input.current.deltas,
|
|
154
|
+
currentBlocked: input.current.blocked,
|
|
155
|
+
currentRedirect: input.current.redirect,
|
|
116
156
|
commands: input.commands,
|
|
117
157
|
}),
|
|
118
158
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"round-contract.js","sourceRoot":"","sources":["../src/round-contract.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"round-contract.js","sourceRoot":"","sources":["../src/round-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAWH,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAyBrD;6DAC6D;AAC7D,MAAM,UAAU,gBAAgB,CAC9B,QAA+B,EAC/B,eAAuB,EACvB,OAAkE,EAClE,MAAc;IAEd,MAAM,OAAO,GAAG,qBAAqB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,OAAO;QACL,EAAE,EAAE,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC;QACtC,iBAAiB,EAAE,eAAe;QAClC,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,KAAK,EAAE,CAAC,GAAG,CAAC,QAAQ,CAA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AAQ;QACR,QAAQ,EAAE,0BAA0B,CAAC;YACnC,QAAQ;YACR,MAAM,EAAE,KAAK;YACb,YAAY,EAAE,KAAK,CAAC,KAAK;YACzB,aAAa,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM;YACnC,aAAa,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM;YACnC,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO;YACrC,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ;YACvC,QAAQ,EAAE,KAAK,CAAC,QAAQ;SACzB,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -17,21 +17,23 @@
|
|
|
17
17
|
* Persistence is owned by round-transaction.ts so reject paths remain
|
|
18
18
|
* side-effect free and accepted decisions can be replayed idempotently.
|
|
19
19
|
*/
|
|
20
|
-
import type { LoopStore
|
|
20
|
+
import type { LoopStore } from "./loop-store.js";
|
|
21
|
+
import { type CommittedHistory } from "./history.js";
|
|
21
22
|
import type { MachineObservation } from "./protocol.js";
|
|
22
23
|
import type { ObservationDelta } from "./evidence-provider.js";
|
|
23
|
-
import type {
|
|
24
|
-
import {
|
|
24
|
+
import type { CheckpointRef, ContractSupersede, EvidencePosture, RoundOutcome, SelfEvaluation, StopReason, VerificationFlag, WorkspaceCheckpointManifest } from "./protocol.js";
|
|
25
|
+
import type { ContractItemStatusView } from "./contract-items.js";
|
|
25
26
|
/** Input to a single round processing step. */
|
|
26
27
|
export interface RoundProcessInput {
|
|
27
28
|
loopId: string;
|
|
28
29
|
task: string;
|
|
29
30
|
currentRound: number;
|
|
30
31
|
maxRounds: number;
|
|
32
|
+
/** v4.0.1: the pre-commit history loaded once by the advance path. When
|
|
33
|
+
* absent, this coordinator loads it itself (direct/library callers). */
|
|
34
|
+
history?: CommittedHistory;
|
|
31
35
|
/** The agent's self-evaluation for this round. */
|
|
32
36
|
selfEval: SelfEvaluation;
|
|
33
|
-
/** The previous round's validated SelfEvaluation (null for round 1). */
|
|
34
|
-
lastSelfEval?: SelfEvaluation;
|
|
35
37
|
/** How many consecutive rounds have been rejected by enforcement. */
|
|
36
38
|
consecutiveRejections: number;
|
|
37
39
|
/** L4 (v3.7.x): which check rejected the previous round — lets uniform
|
|
@@ -41,21 +43,16 @@ export interface RoundProcessInput {
|
|
|
41
43
|
evidenceDeltas?: ObservationDelta[];
|
|
42
44
|
/** Full round-start observations for post-backtrack restore validation. */
|
|
43
45
|
beforeEvidence?: MachineObservation[];
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
*
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
* checks the workspace returns to this commit before accepting work. */
|
|
55
|
-
backtrackTargetGitHead?: string;
|
|
56
|
-
/** v3.9: files already dirty at that restore point (undefined = never
|
|
57
|
-
* observed, so only HEAD can be judged). */
|
|
58
|
-
backtrackTargetDirty?: string[];
|
|
46
|
+
/** The current in-flight transaction's automatic before-image (machine
|
|
47
|
+
* backtrack target mapping only; never a cognitive input). */
|
|
48
|
+
beforeCheckpoint?: CheckpointRef;
|
|
49
|
+
/** This submission's after observations, used to derive abandoned-file
|
|
50
|
+
* report facts. */
|
|
51
|
+
afterEvidence?: MachineObservation[];
|
|
52
|
+
/** Reads the target checkpoint manifest for machine backtrack target
|
|
53
|
+
* eligibility and skipped-file derivation. Provided by the transaction
|
|
54
|
+
* layer's checkpoint store. */
|
|
55
|
+
resolveCheckpointManifest?: (ref: CheckpointRef) => WorkspaceCheckpointManifest | null;
|
|
59
56
|
/** v3.8.3: the trusted round-start fingerprint of every configured
|
|
60
57
|
* command's entrypoint files, captured when this round was prepared. Only
|
|
61
58
|
* the in-flight round has one — a round whose preparation predates the
|
|
@@ -70,67 +67,44 @@ export interface RoundProcessInput {
|
|
|
70
67
|
/** Result of processing a round through the coordinator. */
|
|
71
68
|
export interface RoundProcessResult {
|
|
72
69
|
/** What the caller should do next. */
|
|
73
|
-
action: "continue" | "stop" | "reject" | "terminate" | "backtrack";
|
|
70
|
+
action: "continue" | "stop" | "reject" | "terminate" | "backtrack" | "recovery";
|
|
71
|
+
/** v3.9.6: who produced the disposition. Evaluations are ordinary work;
|
|
72
|
+
* machine/agent recoveries are rollback directives. */
|
|
73
|
+
origin?: "evaluation" | "machine" | "agent";
|
|
74
|
+
/** v3.9.6: machine failure reason or agent recovery reason. */
|
|
75
|
+
reason?: string;
|
|
76
|
+
/** v3.9.6: committed rollback directive facts. */
|
|
77
|
+
recovery?: import("./protocol.js").RecoveryDirective;
|
|
74
78
|
/** Reason for stop (set when action is "stop" or "terminate"). */
|
|
75
79
|
stopReason?: StopReason;
|
|
76
80
|
/** Rejection prompt (set when action is "reject"). */
|
|
77
81
|
rejectionPrompt?: string;
|
|
78
|
-
/** v2.10: Round to restore state from (set when action is "backtrack"). */
|
|
79
|
-
backtrackTarget?: number;
|
|
80
|
-
/** v2.10: Discovered constraints from skipped rounds to preserve. */
|
|
81
|
-
backtrackSkippedDiscoveries?: string[];
|
|
82
|
-
/** v2.10: Which enforcement rule triggered the backtrack. */
|
|
83
|
-
backtrackTriggerRule?: string;
|
|
84
|
-
/** v3.7.1: Rounds rolled back (exclusive range above the restore point).
|
|
85
|
-
* Derived from committed facts + the in-flight attempt — rejected
|
|
86
|
-
* payloads are not durable history and never become a source. */
|
|
87
|
-
backtrackFailedRounds?: number[];
|
|
88
|
-
/** v3.7.1: One approach per failed round (committed output_summary or the
|
|
89
|
-
* in-flight attempt's), truncated — what must NOT be repeated. */
|
|
90
|
-
backtrackApproaches?: string[];
|
|
91
|
-
/** v3.7.1: Falsified assumptions from the failed rounds. */
|
|
92
|
-
backtrackWrongAssumptions?: string[];
|
|
93
|
-
/** M3 (v3.7.x): per-file git fingerprint at the failed round — lets the
|
|
94
|
-
* restore check prove a skipped file was never touched since the rollback. */
|
|
95
|
-
backtrackSkippedFingerprints?: Record<string, string>;
|
|
96
82
|
/** Verification flags from this round (for injection into next prompt). */
|
|
97
83
|
verificationFlags: VerificationFlag[];
|
|
98
84
|
/** Enforcement action for observability. */
|
|
99
|
-
enforcementAction?: "accept" | "reject" | "terminate" | "backtrack";
|
|
85
|
+
enforcementAction?: "accept" | "reject" | "terminate" | "backtrack" | "recovery";
|
|
100
86
|
/** Enforcement reason (set when rejected or terminated). */
|
|
101
87
|
enforcementReason?: string;
|
|
102
|
-
/**
|
|
103
|
-
|
|
88
|
+
/** v4.0.3/v4.0.6: the Agent's success claim — a derived projection of
|
|
89
|
+
* `outcome === "success"`, never a machine verdict and never an input
|
|
90
|
+
* field. */
|
|
91
|
+
agentSuccessClaim: boolean;
|
|
92
|
+
/** v4.0.6: the Agent-declared outcome; null only for a rollback directive. */
|
|
93
|
+
agentOutcome: RoundOutcome | null;
|
|
104
94
|
/** Whether the verification gate returned "contradicted". */
|
|
105
95
|
gateContradicted: boolean;
|
|
106
|
-
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
|
|
110
|
-
verificationStatus: RoundVerificationStatus;
|
|
96
|
+
/** v4.0.3: the ONE evidence posture, derived once per round and persisted
|
|
97
|
+
* with the accepted transaction. Rejected/terminated attempts carry a
|
|
98
|
+
* transient posture that never enters the Vault. */
|
|
99
|
+
evidencePosture: EvidencePosture;
|
|
111
100
|
/** Updated consecutiveRejections count — caller must persist. */
|
|
112
101
|
newConsecutiveRejections: number;
|
|
113
102
|
/** Which enforcement check fired (set when action is "reject" or "terminate").
|
|
114
103
|
* Used by callers to track per-rule rejection counters. */
|
|
115
104
|
rejectionCheck?: string;
|
|
116
|
-
/**
|
|
117
|
-
* (undefined when action is "reject" — caller should NOT update). */
|
|
118
|
-
newLastSelfEval?: SelfEvaluation;
|
|
119
|
-
/** Whether the caller should push roundSuccess onto the success trajectory.
|
|
105
|
+
/** Whether the caller should push agentSuccessClaim onto the success trajectory.
|
|
120
106
|
* false when gateContradicted or when action is "reject". */
|
|
121
107
|
shouldPushSuccessTrajectory: boolean;
|
|
122
|
-
/** v2.13: Git HEAD commit hash of the backtrack target round.
|
|
123
|
-
* Set when action is "backtrack". The verification gate uses this
|
|
124
|
-
* to check that the agent restored the workspace before working. */
|
|
125
|
-
backtrackTargetGitHead?: string;
|
|
126
|
-
/** v3.9: Files already dirty at the backtrack target round. The restore
|
|
127
|
-
* check requires the workspace's dirty set to be a subset of this
|
|
128
|
-
* baseline — unrelated work in progress is not a failed restore. */
|
|
129
|
-
backtrackTargetDirty?: string[];
|
|
130
|
-
/** v2.13: Files changed in skipped rounds during backtrack.
|
|
131
|
-
* The next round's verification gate checks that these files are
|
|
132
|
-
* not still dirty (agent must restore workspace first). */
|
|
133
|
-
backtrackSkippedFiles?: string[];
|
|
134
108
|
}
|
|
135
109
|
/** v3.8.3: Completion truth as a guard, not a convention.
|
|
136
110
|
*
|
|
@@ -155,35 +129,13 @@ export interface RoundProcessResult {
|
|
|
155
129
|
export declare function finalizeStopReason(
|
|
156
130
|
/** `undefined` when the disposition named no terminal reason at all (the
|
|
157
131
|
* callers fall back to their own default) — there is nothing to guard. */
|
|
158
|
-
reason: StopReason | undefined, selfEval: SelfEvaluation, contractStatuses?: ContractItemStatusView | null
|
|
132
|
+
reason: StopReason | undefined, selfEval: SelfEvaluation, contractStatuses?: ContractItemStatusView | null,
|
|
133
|
+
/** v3.9.9/v4.0.6: the current round's redirect. A committed redirect can
|
|
134
|
+
* never produce `completed` even if the old items were all verified. */
|
|
135
|
+
redirect?: ContractSupersede | null): {
|
|
159
136
|
reason: StopReason | undefined;
|
|
160
137
|
flags: VerificationFlag[];
|
|
161
138
|
};
|
|
162
|
-
/** v3.8.1: The rolled-back branch's facts — the ONE derivation of which rounds
|
|
163
|
-
* failed, which approaches must not be repeated, which assumptions were
|
|
164
|
-
* falsified, and which files (with their failed-round git fingerprints) the
|
|
165
|
-
* agent must restore.
|
|
166
|
-
*
|
|
167
|
-
* Sources are COMMITTED rounds above the restore point; rejected attempts are
|
|
168
|
-
* not durable history and never become a source. The in-flight attempt that
|
|
169
|
-
* triggered the rollback is the one exception — its evaluation lives in this
|
|
170
|
-
* process, not in committed history.
|
|
171
|
-
*
|
|
172
|
-
* Extracted from the coordinator's inline walk so it is unit-testable without
|
|
173
|
-
* driving a whole rollback, and so the prompt, the state file and the
|
|
174
|
-
* committed decision all describe one event. */
|
|
175
|
-
export declare function deriveBacktrackRecoveryFacts(input: {
|
|
176
|
-
currentRound: number;
|
|
177
|
-
restoreRound: number;
|
|
178
|
-
vaultEntries: VaultEntry[];
|
|
179
|
-
selfEval: SelfEvaluation;
|
|
180
|
-
}): {
|
|
181
|
-
skippedFiles: string[];
|
|
182
|
-
skippedFingerprints: Record<string, string>;
|
|
183
|
-
failedRounds: number[];
|
|
184
|
-
approaches: string[];
|
|
185
|
-
wrongAssumptions: string[];
|
|
186
|
-
};
|
|
187
139
|
export declare class RoundCoordinator {
|
|
188
140
|
private store;
|
|
189
141
|
constructor(store?: LoopStore);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"round-coordinator.d.ts","sourceRoot":"","sources":["../src/round-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,"file":"round-coordinator.d.ts","sourceRoot":"","sources":["../src/round-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EAEjB,eAAe,EACf,YAAY,EACZ,cAAc,EACd,UAAU,EACV,gBAAgB,EAEhB,2BAA2B,EAC5B,MAAM,eAAe,CAAC;AA0BvB,OAAO,KAAK,EAAE,sBAAsB,EAAE,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