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/round-facts.d.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
/** v3.8.1: THE contract-fact derivation.
|
|
2
2
|
*
|
|
3
|
-
* The contract walker, the item reducer
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* about what the machine had verified — and nothing stopped a third caller
|
|
8
|
-
* from picking a third window.
|
|
3
|
+
* The contract walker, the item reducer and the criterion machine facts are
|
|
4
|
+
* one pass over one history window. Every caller passes
|
|
5
|
+
* `derivationRounds(entries, currentRound)` (the shared window from
|
|
6
|
+
* committed-round.ts) and receives the same bundle.
|
|
9
7
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* v4.0.1: the sub-goal verification link (`subgoal_refs`,
|
|
9
|
+
* `VerifiedSubGoalFact`, verification debt) was removed. It never rendered in
|
|
10
|
+
* a prompt or state file; it only fed stateHash. Sub-goals remain the Agent's
|
|
11
|
+
* plan report, not a machine acceptance surface.
|
|
13
12
|
*/
|
|
14
13
|
import type { CommittedRoundView } from "./committed-round.js";
|
|
15
14
|
import type { ContractItemStatusView } from "./contract-items.js";
|
|
16
15
|
import type { ObservationDelta } from "./evidence-provider.js";
|
|
17
16
|
import type { CommandEvidencePolicy } from "./policy.js";
|
|
18
|
-
import type { ContractItemStatus,
|
|
17
|
+
import type { ContractItemStatus, ContractSupersede, ExecutionReport } from "./protocol.js";
|
|
19
18
|
import type { ActiveContractView } from "./round-contract.js";
|
|
20
19
|
export interface RoundFacts {
|
|
21
20
|
/** The contract the NEXT round executes under — derived from committed
|
|
@@ -23,24 +22,21 @@ export interface RoundFacts {
|
|
|
23
22
|
activeContract: ActiveContractView | null;
|
|
24
23
|
/** Per-item status of `activeContract`. */
|
|
25
24
|
itemStatuses: ContractItemStatusView;
|
|
26
|
-
/** v3.8: machine-verified sub-goals. Never writes `SubGoal.status`. */
|
|
27
|
-
verifiedSubGoals: VerifiedSubGoalFact[];
|
|
28
|
-
/** `done` sub-goals no verified item backs, plus `insufficient` items. */
|
|
29
|
-
verificationDebt: string[];
|
|
30
25
|
/** v3.8.1: the machine fact about each criterion a contract item referenced,
|
|
31
|
-
* over the WHOLE committed history
|
|
32
|
-
* `verifiedSubGoals`, and read by the same callers. */
|
|
26
|
+
* over the WHOLE committed history. */
|
|
33
27
|
criterionFacts: CriterionMachineFact[];
|
|
34
28
|
}
|
|
35
29
|
/** v3.8.1: ONE criterion's machine fact. `status` is absent while every item
|
|
36
30
|
* referencing the criterion is still `pending` — "no claim yet" says nothing
|
|
37
|
-
* about the criterion, so the criterion keeps its claim-derived status.
|
|
38
|
-
*
|
|
39
|
-
*
|
|
31
|
+
* about the criterion, so the criterion keeps its claim-derived status.
|
|
32
|
+
*
|
|
33
|
+
* v4.0.3: `status_at_round` is the round the CURRENT status was first
|
|
34
|
+
* reached (not the claim round). It is a machine fact, so a later
|
|
35
|
+
* verification can supersede an earlier contradiction. */
|
|
40
36
|
export interface CriterionMachineFact {
|
|
41
37
|
criterion_id: string;
|
|
42
38
|
status?: Exclude<ContractItemStatus, "pending">;
|
|
43
|
-
|
|
39
|
+
status_at_round?: number;
|
|
44
40
|
}
|
|
45
41
|
/** The in-flight slice of a round that is being decided but is not yet
|
|
46
42
|
* committed. A pure committed-history replay passes null / [] — the reducer
|
|
@@ -49,8 +45,13 @@ export interface CriterionMachineFact {
|
|
|
49
45
|
export interface InFlightRoundSlice {
|
|
50
46
|
currentReport: ExecutionReport | null;
|
|
51
47
|
currentDeltas: ReadonlyArray<ObservationDelta>;
|
|
52
|
-
/** The in-flight round's own
|
|
53
|
-
* contract, so closure cannot be derived from committed slices alone. */
|
|
48
|
+
/** The in-flight round's own blocked declaration. A `blocked` round CLOSES
|
|
49
|
+
* its contract, so closure cannot be derived from committed slices alone. */
|
|
50
|
+
currentBlocked?: boolean;
|
|
51
|
+
/** v3.9.9/v4.0.6: the in-flight round's explicit contract redirect
|
|
52
|
+
* (`round_contract.supersedes`). */
|
|
53
|
+
currentRedirect?: ContractSupersede | null;
|
|
54
|
+
/** Legacy shape accepted by library callers; `blocked` wins when present. */
|
|
54
55
|
currentOutcome?: string | null;
|
|
55
56
|
}
|
|
56
57
|
export declare const NO_IN_FLIGHT_ROUND: InFlightRoundSlice;
|
|
@@ -59,39 +60,19 @@ export declare function deriveRoundFacts(input: {
|
|
|
59
60
|
rounds: ReadonlyArray<CommittedRoundView>;
|
|
60
61
|
currentRound: number;
|
|
61
62
|
inFlight: InFlightRoundSlice;
|
|
62
|
-
subGoals: ReadonlyArray<SubGoal>;
|
|
63
63
|
commands: ReadonlyArray<CommandEvidencePolicy>;
|
|
64
64
|
}): RoundFacts;
|
|
65
|
-
/** v3.8:
|
|
66
|
-
*
|
|
67
|
-
* is the machine's separate statement about it.
|
|
68
|
-
*
|
|
69
|
-
* Derived from the WHOLE committed history, not from the currently-open
|
|
70
|
-
* contract. A verified item is machine history — once proven, it stays
|
|
71
|
-
* proven — while the active contract necessarily disappears the moment its
|
|
72
|
-
* last item verifies. Deriving from the active contract alone made the fact
|
|
73
|
-
* vanish at exactly the moment it became fully true, and turned the
|
|
74
|
-
* verification-debt view into a false accusation ("agent reported done,
|
|
75
|
-
* machine verification absent") against a sub-goal the machine had just
|
|
76
|
-
* verified. Each round is read through `deriveRoundContractView`, the same
|
|
77
|
-
* derivation the coordinator, explain and audit use — one history
|
|
78
|
-
* interpretation, no second read model. That re-derivation is quadratic in the
|
|
79
|
-
* round count (≈40ms at 120 rounds) and is deliberately bought: an incremental
|
|
80
|
-
* walker would be a second implementation of the closure rule, which is the
|
|
81
|
-
* one thing this module must never grow.
|
|
65
|
+
/** v3.8.1/v4.0.3: criterion → machine status, derived over the WHOLE committed
|
|
66
|
+
* history exactly like the contract walk.
|
|
82
67
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
/** Committed rounds (rollback-excluded), ascending. */
|
|
68
|
+
* Within one round the strongest item fact wins (contradicted > verified >
|
|
69
|
+
* insufficient); a `pending` item contributes nothing. Across rounds the
|
|
70
|
+
* LATEST authoritative fact wins: a later `verified` or `contradicted` may
|
|
71
|
+
* supersede an earlier one (so a contradiction can be re-verified), while an
|
|
72
|
+
* `insufficient` round never erases an existing verified/contradicted fact.
|
|
73
|
+
* `status_at_round` records when the current status was first reached. */
|
|
74
|
+
export declare function deriveCriterionFacts(input: {
|
|
91
75
|
rounds: ReadonlyArray<CommittedRoundView>;
|
|
92
76
|
commands: ReadonlyArray<CommandEvidencePolicy>;
|
|
93
|
-
}):
|
|
94
|
-
/** v3.8: Sub-goals the agent declared `done` that no verified contract item
|
|
95
|
-
* backs — verification debt, surfaced in the handoff's open risks. */
|
|
96
|
-
export declare function deriveVerificationDebt(subGoals: ReadonlyArray<SubGoal>, verified: ReadonlyArray<VerifiedSubGoalFact>, statuses: ContractItemStatusView): string[];
|
|
77
|
+
}): CriterionMachineFact[];
|
|
97
78
|
//# sourceMappingURL=round-facts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"round-facts.d.ts","sourceRoot":"","sources":["../src/round-facts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"round-facts.d.ts","sourceRoot":"","sources":["../src/round-facts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EAChB,MAAM,eAAe,CAAC;AACvB,OAA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oB,EAAE,CA+CzB"}
|
package/dist/round-facts.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
/** v3.8.1: THE contract-fact derivation.
|
|
2
2
|
*
|
|
3
|
-
* The contract walker, the item reducer
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* about what the machine had verified — and nothing stopped a third caller
|
|
8
|
-
* from picking a third window.
|
|
3
|
+
* The contract walker, the item reducer and the criterion machine facts are
|
|
4
|
+
* one pass over one history window. Every caller passes
|
|
5
|
+
* `derivationRounds(entries, currentRound)` (the shared window from
|
|
6
|
+
* committed-round.ts) and receives the same bundle.
|
|
9
7
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* v4.0.1: the sub-goal verification link (`subgoal_refs`,
|
|
9
|
+
* `VerifiedSubGoalFact`, verification debt) was removed. It never rendered in
|
|
10
|
+
* a prompt or state file; it only fed stateHash. Sub-goals remain the Agent's
|
|
11
|
+
* plan report, not a machine acceptance surface.
|
|
13
12
|
*/
|
|
14
13
|
import { deriveContractItemStatuses } from "./contract-items.js";
|
|
15
|
-
import { deriveActiveRoundContract, deriveRoundContractView } from "./round-contract.js";
|
|
16
|
-
import {
|
|
14
|
+
import { committedRoundFacts, deriveActiveRoundContract, deriveRoundContractView, } from "./round-contract.js";
|
|
15
|
+
import { isCriterionId } from "./token-utils.js";
|
|
17
16
|
export const NO_IN_FLIGHT_ROUND = {
|
|
18
17
|
currentReport: null,
|
|
19
18
|
currentDeltas: [],
|
|
19
|
+
currentBlocked: false,
|
|
20
|
+
currentRedirect: null,
|
|
20
21
|
currentOutcome: null,
|
|
21
22
|
};
|
|
22
23
|
export function deriveRoundFacts(input) {
|
|
@@ -27,93 +28,75 @@ export function deriveRoundFacts(input) {
|
|
|
27
28
|
currentRound: input.currentRound,
|
|
28
29
|
currentReport: input.inFlight.currentReport,
|
|
29
30
|
currentDeltas: input.inFlight.currentDeltas,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const verifiedSubGoals = deriveVerifiedSubGoals({
|
|
34
|
-
subGoals: input.subGoals,
|
|
35
|
-
rounds: input.rounds,
|
|
31
|
+
currentBlocked: input.inFlight.currentBlocked ??
|
|
32
|
+
input.inFlight.currentOutcome === "blocked",
|
|
33
|
+
currentRedirect: input.inFlight.currentRedirect ?? null,
|
|
36
34
|
commands: input.commands,
|
|
37
35
|
});
|
|
38
36
|
return {
|
|
39
37
|
activeContract,
|
|
40
38
|
itemStatuses,
|
|
41
|
-
verifiedSubGoals,
|
|
42
|
-
verificationDebt: deriveVerificationDebt(input.subGoals, verifiedSubGoals, itemStatuses),
|
|
43
39
|
criterionFacts: deriveCriterionFacts({
|
|
44
|
-
activeContract,
|
|
45
40
|
rounds: input.rounds,
|
|
46
41
|
commands: input.commands,
|
|
47
42
|
}),
|
|
48
43
|
};
|
|
49
44
|
}
|
|
50
|
-
/** v3.8.1: criterion → machine status
|
|
51
|
-
*
|
|
52
|
-
* and for the same reason: a verified item is machine history that survives
|
|
53
|
-
* its contract closing. Reading only the ACTIVE contract made the criterion's
|
|
54
|
-
* machine status vanish at the moment the contract became fully true — the
|
|
55
|
-
* state file's Goal → Criteria row fell from ✅ back to 🟡 and its
|
|
56
|
-
* `(related: sg-…)` links disappeared, while the sub-goal side of the same
|
|
57
|
-
* fact correctly survived.
|
|
45
|
+
/** v3.8.1/v4.0.3: criterion → machine status, derived over the WHOLE committed
|
|
46
|
+
* history exactly like the contract walk.
|
|
58
47
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
|
|
48
|
+
* Within one round the strongest item fact wins (contradicted > verified >
|
|
49
|
+
* insufficient); a `pending` item contributes nothing. Across rounds the
|
|
50
|
+
* LATEST authoritative fact wins: a later `verified` or `contradicted` may
|
|
51
|
+
* supersede an earlier one (so a contradiction can be re-verified), while an
|
|
52
|
+
* `insufficient` round never erases an existing verified/contradicted fact.
|
|
53
|
+
* `status_at_round` records when the current status was first reached. */
|
|
54
|
+
export function deriveCriterionFacts(input) {
|
|
63
55
|
const byCriterion = new Map();
|
|
64
|
-
// Seed with the active contract's items: links are declarations, so they do
|
|
65
|
-
// not need a round to have executed under the contract. Statuses are only
|
|
66
|
-
// ever machine facts from the history walk below (`pending` says nothing).
|
|
67
|
-
for (const item of input.activeContract?.items ?? []) {
|
|
68
|
-
for (const ref of item.criterion_refs) {
|
|
69
|
-
const criterionId = isCriterionId(ref) ? ref : deriveCriterionId(ref);
|
|
70
|
-
const existing = byCriterion.get(criterionId);
|
|
71
|
-
const links = existing?.related_subgoal_ids ?? [];
|
|
72
|
-
for (const subgoalId of item.subgoal_refs) {
|
|
73
|
-
if (!links.includes(subgoalId))
|
|
74
|
-
links.push(subgoalId);
|
|
75
|
-
}
|
|
76
|
-
byCriterion.set(criterionId, {
|
|
77
|
-
criterion_id: criterionId,
|
|
78
|
-
...(existing?.status ? { status: existing.status } : {}),
|
|
79
|
-
related_subgoal_ids: links,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
56
|
for (const round of input.rounds) {
|
|
84
57
|
const { contract, statuses } = deriveRoundContractView({
|
|
85
58
|
rounds: input.rounds,
|
|
86
59
|
round: round.round,
|
|
87
|
-
|
|
88
|
-
deltas: round.observationDelta,
|
|
89
|
-
outcome: round.outcome,
|
|
60
|
+
current: committedRoundFacts(round),
|
|
90
61
|
commands: input.commands,
|
|
91
62
|
});
|
|
92
63
|
if (!contract)
|
|
93
64
|
continue;
|
|
94
65
|
const statusByItem = new Map(statuses.items.map((item) => [item.itemId, item.status]));
|
|
66
|
+
// One round can reference a criterion from several items; fold them to
|
|
67
|
+
// the strongest fact THIS round states.
|
|
68
|
+
const roundBest = new Map();
|
|
95
69
|
for (const item of contract.items) {
|
|
96
70
|
const itemStatus = statusByItem.get(item.id);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
byCriterion.set(
|
|
109
|
-
|
|
110
|
-
...(machineStatus ? { status: machineStatus } : {}),
|
|
111
|
-
related_subgoal_ids: links,
|
|
112
|
-
});
|
|
71
|
+
if (!itemStatus || itemStatus === "pending")
|
|
72
|
+
continue;
|
|
73
|
+
for (const ref of item.criterion_refs ?? []) {
|
|
74
|
+
if (!isCriterionId(ref))
|
|
75
|
+
continue;
|
|
76
|
+
roundBest.set(ref, strongestStatus(roundBest.get(ref), itemStatus));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
for (const [ref, status] of roundBest) {
|
|
80
|
+
const existing = byCriterion.get(ref);
|
|
81
|
+
if (!existing) {
|
|
82
|
+
byCriterion.set(ref, { status, status_at_round: round.round });
|
|
83
|
+
continue;
|
|
113
84
|
}
|
|
85
|
+
// A later insufficient observation is not a new conclusion; it cannot
|
|
86
|
+
// erase a machine-supported status. The same status keeps its first
|
|
87
|
+
// round.
|
|
88
|
+
if (status === "insufficient" || existing.status === status)
|
|
89
|
+
continue;
|
|
90
|
+
byCriterion.set(ref, { status, status_at_round: round.round });
|
|
114
91
|
}
|
|
115
92
|
}
|
|
116
|
-
return [...byCriterion.
|
|
93
|
+
return [...byCriterion.entries()]
|
|
94
|
+
.sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0))
|
|
95
|
+
.map(([criterion_id, fact]) => ({
|
|
96
|
+
criterion_id,
|
|
97
|
+
status: fact.status,
|
|
98
|
+
status_at_round: fact.status_at_round,
|
|
99
|
+
}));
|
|
117
100
|
}
|
|
118
101
|
/** Rank item statuses so the strongest machine fact wins when several items
|
|
119
102
|
* reference the same criterion. */
|
|
@@ -127,90 +110,4 @@ function strongestStatus(left, right) {
|
|
|
127
110
|
return right;
|
|
128
111
|
return rank[right] > rank[left] ? right : left;
|
|
129
112
|
}
|
|
130
|
-
/** v3.8: Machine-verified sub-goal facts. DERIVED, never persisted. It never
|
|
131
|
-
* writes `SubGoal.status`: `done` stays the agent's declaration, and the fact
|
|
132
|
-
* is the machine's separate statement about it.
|
|
133
|
-
*
|
|
134
|
-
* Derived from the WHOLE committed history, not from the currently-open
|
|
135
|
-
* contract. A verified item is machine history — once proven, it stays
|
|
136
|
-
* proven — while the active contract necessarily disappears the moment its
|
|
137
|
-
* last item verifies. Deriving from the active contract alone made the fact
|
|
138
|
-
* vanish at exactly the moment it became fully true, and turned the
|
|
139
|
-
* verification-debt view into a false accusation ("agent reported done,
|
|
140
|
-
* machine verification absent") against a sub-goal the machine had just
|
|
141
|
-
* verified. Each round is read through `deriveRoundContractView`, the same
|
|
142
|
-
* derivation the coordinator, explain and audit use — one history
|
|
143
|
-
* interpretation, no second read model. That re-derivation is quadratic in the
|
|
144
|
-
* round count (≈40ms at 120 rounds) and is deliberately bought: an incremental
|
|
145
|
-
* walker would be a second implementation of the closure rule, which is the
|
|
146
|
-
* one thing this module must never grow.
|
|
147
|
-
*
|
|
148
|
-
* Attribution is per ITEM (`ContractItemProposal.subgoal_refs`), not per
|
|
149
|
-
* contract: an item backs exactly the sub-goals it references, so a contract
|
|
150
|
-
* whose item A verifies SubGoal 1 and whose item B verifies SubGoal 2 yields
|
|
151
|
-
* two facts with disjoint `contract_item_ids` instead of both sub-goals
|
|
152
|
-
* claiming every verified item. */
|
|
153
|
-
export function deriveVerifiedSubGoals(input) {
|
|
154
|
-
const known = new Set(input.subGoals.map((subGoal) => subGoal.id));
|
|
155
|
-
if (known.size === 0)
|
|
156
|
-
return [];
|
|
157
|
-
// First-reference order across the history — deterministic, and independent
|
|
158
|
-
// of which item happened to verify first.
|
|
159
|
-
const order = [];
|
|
160
|
-
const itemIdsBySubGoal = new Map();
|
|
161
|
-
const verifiedAt = new Map();
|
|
162
|
-
for (const round of input.rounds) {
|
|
163
|
-
const { contract, statuses } = deriveRoundContractView({
|
|
164
|
-
rounds: input.rounds,
|
|
165
|
-
round: round.round,
|
|
166
|
-
report: round.executionReport,
|
|
167
|
-
deltas: round.observationDelta,
|
|
168
|
-
outcome: round.outcome,
|
|
169
|
-
commands: input.commands,
|
|
170
|
-
});
|
|
171
|
-
if (!contract)
|
|
172
|
-
continue;
|
|
173
|
-
const statusAt = new Map(statuses.items.map((item) => [item.itemId, item]));
|
|
174
|
-
for (const item of contract.items) {
|
|
175
|
-
if (statusAt.get(item.id)?.status !== "verified")
|
|
176
|
-
continue;
|
|
177
|
-
for (const ref of item.subgoal_refs) {
|
|
178
|
-
if (!known.has(ref))
|
|
179
|
-
continue;
|
|
180
|
-
const itemIds = itemIdsBySubGoal.get(ref) ?? [];
|
|
181
|
-
if (!itemIds.includes(item.id))
|
|
182
|
-
itemIds.push(item.id);
|
|
183
|
-
itemIdsBySubGoal.set(ref, itemIds);
|
|
184
|
-
if (!order.includes(ref))
|
|
185
|
-
order.push(ref);
|
|
186
|
-
const at = statusAt.get(item.id)?.status_at_round ?? round.round;
|
|
187
|
-
verifiedAt.set(ref, Math.max(verifiedAt.get(ref) ?? 0, at));
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
return order.map((subgoalId) => ({
|
|
192
|
-
subgoal_id: subgoalId,
|
|
193
|
-
contract_item_ids: itemIdsBySubGoal.get(subgoalId) ?? [],
|
|
194
|
-
verified_at_round: verifiedAt.get(subgoalId) ?? 0,
|
|
195
|
-
}));
|
|
196
|
-
}
|
|
197
|
-
/** v3.8: Sub-goals the agent declared `done` that no verified contract item
|
|
198
|
-
* backs — verification debt, surfaced in the handoff's open risks. */
|
|
199
|
-
export function deriveVerificationDebt(subGoals, verified, statuses) {
|
|
200
|
-
const debt = [];
|
|
201
|
-
const verifiedIds = new Set(verified.map((fact) => fact.subgoal_id));
|
|
202
|
-
for (const subGoal of subGoals) {
|
|
203
|
-
if (subGoal.status !== "done" || verifiedIds.has(subGoal.id))
|
|
204
|
-
continue;
|
|
205
|
-
debt.push(`sub-goal ${subGoal.id} "${subGoal.description.slice(0, 120)}": ` +
|
|
206
|
-
"agent reported done, machine verification absent");
|
|
207
|
-
}
|
|
208
|
-
for (const item of statuses.items) {
|
|
209
|
-
if (item.status !== "insufficient")
|
|
210
|
-
continue;
|
|
211
|
-
debt.push(`contract item ${item.itemId}: claimed met but not machine-verified` +
|
|
212
|
-
(item.reasons.length > 0 ? ` (${item.reasons[0]})` : ""));
|
|
213
|
-
}
|
|
214
|
-
return debt;
|
|
215
|
-
}
|
|
216
113
|
//# sourceMappingURL=round-facts.js.map
|
package/dist/round-facts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"round-facts.js","sourceRoot":"","sources":["../src/round-facts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"round-facts.js","sourceRoot":"","sources":["../src/round-facts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AASjE,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AA2CjD,MAAM,CAAC,MAAM,kBAAkB,GAAuB;IACpD,aAAa,EAAE,IAAI;IACnB,aAAa,EAAE,EAAE;IACjB,cAAc,EAAE,KAAK;IACrB,eAAe,EAAE,IAAI;IACrB,cAAc,EAAE,IAAI;CACrB,CAAC;AAEF,MAAM,UAAU,gBAAgB,CAAC,KAMhC;IACC,MAAM,cAAc,GAAG,yBAAyB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC/E,MAAM,YAAY,GAAG,0BAA0B,CAAC;QAC9C,QAAQ,EAAE,cAAc;QACxB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,aAAa,EAAE,KAAK,CAAC,QAAQ,CAAC,aAAa;QAC3C,aAAa,EAAE,KA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AG,CAAC,CAAC,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QAC9B,YAAY;QACZ,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,eAAe,EAAE,IAAI,CAAC,eAAe;KACtC,CAAC,CAAC,CAAC;AACR,CAAC;AAED;oCACoC;AACpC,SAAS,eAAe,CACtB,IAAwD,EACxD,KAA6C;IAE7C,MAAM,IAAI,GAA2D;QACnE,YAAY,EAAE,CAAC;QACf,QAAQ,EAAE,CAAC;QACX,YAAY,EAAE,CAAC;KAChB,CAAC;IACF,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** v4.0.4 / v4.0.7: the ONE runtime source of round-boundary and
|
|
2
|
+
* context-continuity guidance.
|
|
3
|
+
*
|
|
4
|
+
* The compiled prompt footer, the MCP server instructions, the tools/list
|
|
5
|
+
* `contextMode` description, the state file and the Explain view read these
|
|
6
|
+
* constants. The Forge skill keeps only the definitions and a pointer; it
|
|
7
|
+
* must not grow a second copy of the executable sizing rules.
|
|
8
|
+
*
|
|
9
|
+
* `HOST_INVOCATION_CONTRACT` is server-density prose only: the per-round
|
|
10
|
+
* prompt footer carries the Agent action surface, not the host runtime
|
|
11
|
+
* contract. `CONTEXT_MODE_DESCRIPTION` is the ONE tools/list description.
|
|
12
|
+
*
|
|
13
|
+
* This module is pure: no I/O, no policy, no time, no randomness.
|
|
14
|
+
*/
|
|
15
|
+
import type { PromptContextMode, PromptContextReason } from "./protocol.js";
|
|
16
|
+
export declare const ROUND_BOUNDARY_PRINCIPLE: string;
|
|
17
|
+
export declare const ROUND_BOUNDARY_SIZING = "Keep coupled work together; split when unsafe to verify.";
|
|
18
|
+
export declare const ROUND_BOUNDARY_SUBMISSION: string;
|
|
19
|
+
export declare const ROUND_BOUNDARY_NON_BOUNDARIES: string;
|
|
20
|
+
/** v4.0.5: the ONE routing sentence for a lost in-context retry invocation.
|
|
21
|
+
* The prompt footer and the short retry guidance read it. LoopForge — not
|
|
22
|
+
* the Agent — recompiles the same round/attempt in clean context. */
|
|
23
|
+
export declare const ROUND_BOUNDARY_INVOCATION_LOST: string;
|
|
24
|
+
/** v4.0.7: the ONE host invocation contract. It separates the cleared model
|
|
25
|
+
* conversation from the warm host runtime and states what LoopForge does not
|
|
26
|
+
* manage. It is rendered at server density only; the per-round prompt footer
|
|
27
|
+
* does not repeat it. */
|
|
28
|
+
export declare const HOST_INVOCATION_CONTRACT: string;
|
|
29
|
+
/** v4.0.7: the ONE tools/list description of PromptContextMode. tools.ts
|
|
30
|
+
* imports it so the wire description and the runtime prose cannot drift. */
|
|
31
|
+
export declare const CONTEXT_MODE_DESCRIPTION: string;
|
|
32
|
+
/** The host execution contract. It names the four context strategies instead
|
|
33
|
+
* of asking the host to reinterpret an enum value:
|
|
34
|
+
* clean context, in-context repair, clean-context repair, recovery redo. */
|
|
35
|
+
export declare const CONTEXT_CONTINUITY_RULES: string;
|
|
36
|
+
export type GuidanceDensity = "prompt" | "server";
|
|
37
|
+
/** Render the runtime guidance.
|
|
38
|
+
*
|
|
39
|
+
* - `prompt` renders the boundary principle, sizing, submission and
|
|
40
|
+
* non-boundary rules. A `same_round_retry` already explained its single
|
|
41
|
+
* logical round in the retry section, so only submission and non-boundary
|
|
42
|
+
* rules are repeated. The fresh body is kept under ~480 characters so the
|
|
43
|
+
* L0 footer does not force a policy-budget change.
|
|
44
|
+
* - `server` renders the same rules plus the host context-continuity
|
|
45
|
+
* contract. */
|
|
46
|
+
export declare function renderRoundGuidance(density: GuidanceDensity, contextMode?: PromptContextMode): string;
|
|
47
|
+
/** Human-readable strategy label for one context boundary. JSON/artifacts keep
|
|
48
|
+
* the enum values; every human surface uses this ONE mapping.
|
|
49
|
+
*
|
|
50
|
+
* `recoveryBoundary` means a committed rollback directive governs this
|
|
51
|
+
* compile. A repeated rejection can escalate a retried redo; the label must
|
|
52
|
+
* keep the recovery-lesson fact instead of dropping it. */
|
|
53
|
+
export declare function formatContextBoundaryLabel(mode: PromptContextMode, reason: PromptContextReason, options?: {
|
|
54
|
+
recoveryBoundary?: boolean;
|
|
55
|
+
}): string;
|
|
56
|
+
//# sourceMappingURL=round-guidance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"round-guidance.d.ts","sourceRoot":"","sources":["../src/round-guidance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAEvB,eAAO,MAAM,wBAAwB,QAE3B,CAAC;AAEX,eAAO,MAAM,qBAAqB,6DAC0B,CAAC;AAE7D,eAAO,MAAM,yBAAyB,QAGyB,CAAC;AAEhE,eAAO,MAAM,6BAA6B,QAEO,CAAC;AAElD;;sEAEsE;AACtE,eAAO,MAAM,8BAA8B,QAIO,CAAC;AAEnD;;;0BAG0B;AAC1B,eAAO,MAAM,wBAAwB,QAaZ,CAAC;AAE1B;6EAC6E;AAC7E,eAAO,MAAM,wBAAwB,QAYgB,CAAC;AAEtD;;6EAE6E;AAC7E,eAAO,MAAM,wBAAwB,QAsBgC,CAAC;AAEtE,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElD;;;;;;;;kBAQkB;AAClB,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,eAAe,EACxB,WAAW,CAAC,EAAE,iBAAiB,GAC9B,MAAM,CAuBR;AAED;;;;;4DAK4D;AAC5D,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAE,mBAAmB,EAC3B,OAAO,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAO,GAC3C,MAAM,CAmCR"}
|