loopforge 3.7.1 → 3.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -130
- package/dist/audit.d.ts +53 -1
- package/dist/audit.d.ts.map +1 -1
- package/dist/audit.js +106 -22
- package/dist/audit.js.map +1 -1
- package/dist/canonical-state.d.ts +52 -67
- package/dist/canonical-state.d.ts.map +1 -1
- package/dist/canonical-state.js +134 -147
- package/dist/canonical-state.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +103 -4
- package/dist/cli.js.map +1 -1
- package/dist/cognitive-facts.d.ts +13 -0
- package/dist/cognitive-facts.d.ts.map +1 -1
- package/dist/cognitive-facts.js +28 -13
- package/dist/cognitive-facts.js.map +1 -1
- package/dist/committed-round.d.ts +103 -21
- package/dist/committed-round.d.ts.map +1 -1
- package/dist/committed-round.js +188 -45
- package/dist/committed-round.js.map +1 -1
- package/dist/contract-items.d.ts +55 -0
- package/dist/contract-items.d.ts.map +1 -0
- package/dist/contract-items.js +180 -0
- package/dist/contract-items.js.map +1 -0
- package/dist/enforcement-gate.d.ts +20 -2
- package/dist/enforcement-gate.d.ts.map +1 -1
- package/dist/enforcement-gate.js +197 -386
- package/dist/enforcement-gate.js.map +1 -1
- package/dist/engine.d.ts +1 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +53 -38
- package/dist/engine.js.map +1 -1
- package/dist/evidence-claims.d.ts +4 -4
- package/dist/evidence-claims.d.ts.map +1 -1
- package/dist/evidence-claims.js +16 -14
- package/dist/evidence-claims.js.map +1 -1
- package/dist/evidence-provider.d.ts +85 -89
- package/dist/evidence-provider.d.ts.map +1 -1
- package/dist/evidence-provider.js +328 -184
- package/dist/evidence-provider.js.map +1 -1
- package/dist/explain.d.ts +76 -0
- package/dist/explain.d.ts.map +1 -0
- package/dist/explain.js +127 -0
- package/dist/explain.js.map +1 -0
- package/dist/generate-schema.js +152 -16
- package/dist/generate-schema.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/loop-compiler.d.ts +40 -53
- package/dist/loop-compiler.d.ts.map +1 -1
- package/dist/loop-compiler.js +229 -553
- package/dist/loop-compiler.js.map +1 -1
- package/dist/loop-extras-parser.d.ts +0 -1
- package/dist/loop-extras-parser.d.ts.map +1 -1
- package/dist/loop-extras-parser.js +0 -4
- package/dist/loop-extras-parser.js.map +1 -1
- package/dist/loop-projection.d.ts.map +1 -1
- package/dist/loop-projection.js +3 -1
- package/dist/loop-projection.js.map +1 -1
- package/dist/mcp/round-lifecycle.d.ts +30 -21
- package/dist/mcp/round-lifecycle.d.ts.map +1 -1
- package/dist/mcp/round-lifecycle.js +47 -103
- package/dist/mcp/round-lifecycle.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +51 -7
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/session.d.ts +39 -23
- package/dist/mcp/session.d.ts.map +1 -1
- package/dist/mcp/session.js +148 -163
- package/dist/mcp/session.js.map +1 -1
- package/dist/mcp/submission-boundary.d.ts +89 -0
- package/dist/mcp/submission-boundary.d.ts.map +1 -0
- package/dist/mcp/submission-boundary.js +203 -0
- package/dist/mcp/submission-boundary.js.map +1 -0
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +249 -128
- package/dist/mcp/tools.js.map +1 -1
- package/dist/policy-metrics.js +2 -2
- package/dist/policy-metrics.js.map +1 -1
- package/dist/policy.d.ts +55 -93
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +149 -38
- package/dist/policy.js.map +1 -1
- package/dist/prompt-assembler.d.ts +1 -32
- package/dist/prompt-assembler.d.ts.map +1 -1
- package/dist/prompt-assembler.js +282 -435
- package/dist/prompt-assembler.js.map +1 -1
- package/dist/prompt-policy.d.ts +1 -4
- package/dist/prompt-policy.d.ts.map +1 -1
- package/dist/prompt-policy.js +6 -7
- package/dist/prompt-policy.js.map +1 -1
- package/dist/protocol.d.ts +365 -142
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +21 -66
- package/dist/protocol.js.map +1 -1
- package/dist/replay.js +2 -2
- package/dist/replay.js.map +1 -1
- package/dist/round-contract.d.ts +69 -57
- package/dist/round-contract.d.ts.map +1 -1
- package/dist/round-contract.js +104 -64
- package/dist/round-contract.js.map +1 -1
- package/dist/round-coordinator.d.ts +36 -16
- package/dist/round-coordinator.d.ts.map +1 -1
- package/dist/round-coordinator.js +166 -102
- package/dist/round-coordinator.js.map +1 -1
- package/dist/round-driver.d.ts +3 -5
- package/dist/round-driver.d.ts.map +1 -1
- package/dist/round-driver.js +0 -1
- package/dist/round-driver.js.map +1 -1
- package/dist/round-facts.d.ts +96 -0
- package/dist/round-facts.d.ts.map +1 -0
- package/dist/round-facts.js +216 -0
- package/dist/round-facts.js.map +1 -0
- package/dist/round-transaction.d.ts +19 -9
- package/dist/round-transaction.d.ts.map +1 -1
- package/dist/round-transaction.js +90 -22
- package/dist/round-transaction.js.map +1 -1
- package/dist/self-eval.d.ts +87 -9
- package/dist/self-eval.d.ts.map +1 -1
- package/dist/self-eval.js +396 -27
- package/dist/self-eval.js.map +1 -1
- package/dist/subgoal-state.d.ts +77 -0
- package/dist/subgoal-state.d.ts.map +1 -0
- package/dist/subgoal-state.js +198 -0
- package/dist/subgoal-state.js.map +1 -0
- package/dist/token-utils.d.ts +52 -19
- package/dist/token-utils.d.ts.map +1 -1
- package/dist/token-utils.js +83 -72
- package/dist/token-utils.js.map +1 -1
- package/dist/verification-gate.d.ts +14 -31
- package/dist/verification-gate.d.ts.map +1 -1
- package/dist/verification-gate.js +178 -496
- package/dist/verification-gate.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/workspace.d.ts +9 -0
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +17 -0
- package/dist/workspace.js.map +1 -1
- package/loop_policy.json +59 -83
- package/package.json +67 -67
- package/skills/perception/SKILL.md +218 -204
package/dist/round-contract.js
CHANGED
|
@@ -1,80 +1,120 @@
|
|
|
1
|
-
|
|
1
|
+
/** Round Contract derivation — the ACTIVE contract a round executes under.
|
|
2
|
+
*
|
|
3
|
+
* A submission's `round_contract` is a PROPOSAL for the next round. It
|
|
4
|
+
* becomes ACTIVE only after the declaring round commits; the active contract
|
|
5
|
+
* is then derived from committed rounds on every compile path (retry,
|
|
6
|
+
* resume, backtrack). It closes when every item is machine-verified, or when
|
|
7
|
+
* the agent reports `outcome: "blocked"`; while it is open a different
|
|
8
|
+
* proposal is ignored.
|
|
9
|
+
*
|
|
10
|
+
* v3.8 identity: `rc-` / `rci-` are derived from CONTENT ONLY (loop id +
|
|
11
|
+
* canonical proposal), so restating an unchanged contract keeps the same
|
|
12
|
+
* identity and the item ids the agent already cited. This is deliberately
|
|
13
|
+
* the opposite of a SubGoal, whose id includes its declaration round.
|
|
14
|
+
*/
|
|
15
|
+
import { canonicalContractText, deriveContractId, deriveContractItemIds, } from "./token-utils.js";
|
|
16
|
+
import { deriveContractItemStatuses } from "./contract-items.js";
|
|
2
17
|
import { getPolicy } from "./policy.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
18
|
+
/** v3.8: Build the derived active contract from a committed proposal plus the
|
|
19
|
+
* binding the runtime stamped when that round committed. */
|
|
20
|
+
export function activateContract(proposal, declaredAtRound, binding, loopId) {
|
|
21
|
+
const itemIds = deriveContractItemIds(proposal.items);
|
|
22
|
+
return {
|
|
23
|
+
id: deriveContractId(loopId, proposal),
|
|
24
|
+
declared_at_round: declaredAtRound,
|
|
25
|
+
work_item: proposal.work_item,
|
|
26
|
+
scope: [...proposal.scope],
|
|
27
|
+
items: proposal.items.map((item, index) => ({
|
|
28
|
+
description: item.description,
|
|
29
|
+
criterion_refs: [...item.criterion_refs],
|
|
30
|
+
subgoal_refs: [...item.subgoal_refs],
|
|
31
|
+
verify_with: [...item.verify_with],
|
|
32
|
+
id: itemIds[index],
|
|
33
|
+
})),
|
|
34
|
+
config_hash_by_command: { ...(binding?.config_hash_by_command ?? {}) },
|
|
35
|
+
};
|
|
13
36
|
}
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (aIsId && bIsId)
|
|
20
|
-
return a === b;
|
|
21
|
-
if (aIsId)
|
|
22
|
-
return a === deriveCriterionId(b);
|
|
23
|
-
if (bIsId)
|
|
24
|
-
return deriveCriterionId(a) === b;
|
|
25
|
-
return jaccardSimilarity(a, b) >= getPolicy().evolution.criteria_dedup_threshold;
|
|
37
|
+
/** v3.8: Content equality — restating a contract unchanged is the same
|
|
38
|
+
* contract. Never compare by id (8 hex = 32 bits; a collision must not merge
|
|
39
|
+
* two different contracts). */
|
|
40
|
+
export function sameContract(left, right) {
|
|
41
|
+
return canonicalContractText(left) === canonicalContractText(right);
|
|
26
42
|
}
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
* round_underspecified at declaration; they close at the first eval
|
|
30
|
-
* committed while active). */
|
|
31
|
-
export function contractDoneWhenSatisfied(contract, met) {
|
|
32
|
-
if (contract.done_when.length === 0)
|
|
33
|
-
return true;
|
|
34
|
-
return contract.done_when.every((item) => met.some((claim) => contractItemMatches(item, claim)));
|
|
35
|
-
}
|
|
36
|
-
/** Walk committed evals (ASCENDING by round; the caller already restricts
|
|
37
|
-
* them to rounds earlier than the compile/verify round) and return the
|
|
38
|
-
* ACTIVE contract for the round after the last committed one — null means
|
|
39
|
-
* the Current Task falls back to the original task text.
|
|
40
|
-
*
|
|
41
|
-
* State machine per committed eval r, with `active` the contract carried
|
|
42
|
-
* into r (null = whole-task round):
|
|
43
|
-
* - active && r.outcome === "blocked" → active = r.proposal
|
|
44
|
-
* - active && all done_when in r.met → active = r.proposal
|
|
45
|
-
* - active && neither → active unchanged (r's
|
|
46
|
-
* different proposal is a premature replacement and is ignored)
|
|
47
|
-
* - !active → active = r.proposal
|
|
48
|
-
* (a proposal never activates on its own declaration round — it becomes
|
|
49
|
-
* active only for the rounds that follow the commit). */
|
|
50
|
-
export function deriveActiveRoundContract(committed) {
|
|
43
|
+
/** v3.8: The active contract after replaying committed rounds in order. */
|
|
44
|
+
export function deriveActiveRoundContract(rounds, commands = getPolicy().evidence.commands ?? []) {
|
|
51
45
|
let active = null;
|
|
52
|
-
for (
|
|
46
|
+
for (let index = 0; index < rounds.length; index++) {
|
|
47
|
+
const round = rounds[index];
|
|
48
|
+
const proposal = round.contractProposal;
|
|
49
|
+
const activate = () => proposal
|
|
50
|
+
? activateContract(proposal, round.round, round.contractBinding, round.loopId)
|
|
51
|
+
: null;
|
|
53
52
|
if (active === null) {
|
|
54
|
-
active =
|
|
53
|
+
active = activate();
|
|
55
54
|
continue;
|
|
56
55
|
}
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
// A blocked round closes the active contract (existing semantics), and a
|
|
57
|
+
// fully verified one does too. Order matters: blocked is checked first,
|
|
58
|
+
// mirroring the historical walker.
|
|
59
|
+
if (round.outcome === "blocked") {
|
|
60
|
+
active = activate();
|
|
59
61
|
continue;
|
|
60
62
|
}
|
|
61
|
-
|
|
62
|
-
active
|
|
63
|
+
const statuses = deriveContractItemStatuses({
|
|
64
|
+
contract: active,
|
|
65
|
+
rounds: rounds.slice(0, index + 1),
|
|
66
|
+
currentRound: round.round + 1,
|
|
67
|
+
currentReport: null,
|
|
68
|
+
currentObservations: [],
|
|
69
|
+
commands,
|
|
70
|
+
});
|
|
71
|
+
if (statuses.closure === "verified") {
|
|
72
|
+
active = activate();
|
|
63
73
|
continue;
|
|
64
74
|
}
|
|
65
|
-
//
|
|
66
|
-
// is a premature replacement and is ignored.
|
|
75
|
+
// Otherwise the active contract stays; a different proposal is ignored.
|
|
67
76
|
}
|
|
68
77
|
return active;
|
|
69
78
|
}
|
|
70
|
-
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
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
|
+
/** v3.8: The contract a round EXECUTED under, plus every item's status as of
|
|
91
|
+
* that round — the ONE derivation the live coordinator, explain and audit
|
|
92
|
+
* share, so the three can never disagree about what a round ran under.
|
|
93
|
+
*
|
|
94
|
+
* Two things make this different from "derive from every round up to and
|
|
95
|
+
* including this one":
|
|
96
|
+
*
|
|
97
|
+
* - The executed contract comes from the rounds BEFORE this one. A proposal
|
|
98
|
+
* declared in round R becomes active in R+1, and a contract round R CLOSES
|
|
99
|
+
* must still be reported as round R's contract — folding R's own proposal
|
|
100
|
+
* into the walker would hand the round the successor (or nothing).
|
|
101
|
+
* - The round's own report and observations enter as the in-flight slice, so
|
|
102
|
+
* its claims and its bound commands are judged with the same reducer the
|
|
103
|
+
* coordinator uses before the round commits. */
|
|
104
|
+
export function deriveRoundContractView(input) {
|
|
105
|
+
const prior = input.rounds.filter((candidate) => candidate.round < input.round);
|
|
106
|
+
const contract = deriveActiveRoundContract(prior, input.commands);
|
|
107
|
+
return {
|
|
108
|
+
contract,
|
|
109
|
+
statuses: deriveContractItemStatuses({
|
|
110
|
+
contract,
|
|
111
|
+
rounds: prior,
|
|
112
|
+
currentRound: input.round,
|
|
113
|
+
currentReport: input.report,
|
|
114
|
+
currentObservations: input.observations,
|
|
115
|
+
currentOutcome: input.outcome,
|
|
116
|
+
commands: input.commands,
|
|
117
|
+
}),
|
|
118
|
+
};
|
|
79
119
|
}
|
|
80
120
|
//# sourceMappingURL=round-contract.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"round-contract.js","sourceRoot":"","sources":["../src/round-contract.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"round-contract.js","sourceRoot":"","sources":["../src/round-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAUH,OAAO,EACL,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;AAqBxC;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,QAAQ,CAAC,KAAK,CAAC;QAC1B,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;YAC1C,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,cAAc,EAAE,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC;YACxC,YAAY,EAAE,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC;YACpC,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC;YAClC,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC;SACnB,CAAC,CAAC;QACH,sBAAsB,EAAE,EAAE,G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AAK,CAAC,QAAQ;SACzB,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -17,9 +17,9 @@
|
|
|
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 } from "./loop-store.js";
|
|
21
|
-
import type {
|
|
22
|
-
import type { SelfEvaluation, StopReason, VerificationFlag } from "./protocol.js";
|
|
20
|
+
import type { LoopStore, VaultEntry } from "./loop-store.js";
|
|
21
|
+
import type { MachineObservation } from "./protocol.js";
|
|
22
|
+
import type { SelfEvaluation, RoundVerificationStatus, StopReason, VerificationFlag } from "./protocol.js";
|
|
23
23
|
/** Input to a single round processing step. */
|
|
24
24
|
export interface RoundProcessInput {
|
|
25
25
|
loopId: string;
|
|
@@ -36,7 +36,7 @@ export interface RoundProcessInput {
|
|
|
36
36
|
* escalation rows act on their own streak, not an unrelated one. */
|
|
37
37
|
lastRejectionCheck?: string;
|
|
38
38
|
/** v1.18: Evidence snapshots from configured providers. */
|
|
39
|
-
evidenceSnapshots?:
|
|
39
|
+
evidenceSnapshots?: MachineObservation[];
|
|
40
40
|
/** Success values from already committed rounds. */
|
|
41
41
|
successTrajectory?: boolean[];
|
|
42
42
|
/** v2.13: Files from skipped backtrack rounds. Passed to verification
|
|
@@ -88,6 +88,11 @@ export interface RoundProcessResult {
|
|
|
88
88
|
roundSuccess: boolean;
|
|
89
89
|
/** Whether the verification gate returned "contradicted". */
|
|
90
90
|
gateContradicted: boolean;
|
|
91
|
+
/** v3.8: The round-level verification posture, derived from the ACTIVE
|
|
92
|
+
* contract's item statuses and this round's claims: `trusted` (everything
|
|
93
|
+
* claimed is machine-backed), `insufficient` (claims unbacked, nothing
|
|
94
|
+
* contradicted), `contradicted` (a machine fact denies a claim). */
|
|
95
|
+
verificationStatus: RoundVerificationStatus;
|
|
91
96
|
/** Updated consecutiveRejections count — caller must persist. */
|
|
92
97
|
newConsecutiveRejections: number;
|
|
93
98
|
/** Which enforcement check fired (set when action is "reject" or "terminate").
|
|
@@ -99,13 +104,6 @@ export interface RoundProcessResult {
|
|
|
99
104
|
/** Whether the caller should push roundSuccess onto the success trajectory.
|
|
100
105
|
* false when gateContradicted or when action is "reject". */
|
|
101
106
|
shouldPushSuccessTrajectory: boolean;
|
|
102
|
-
/** v2.12: True when this round's intent_drift was waived via substantive
|
|
103
|
-
* drift_clarification. The caller uses this to track clarification streaks.
|
|
104
|
-
* v3.3.1: false when R7 itself rejected/terminated on a weak or missing
|
|
105
|
-
* clarification (the caller increments the streak); undefined when R7 did
|
|
106
|
-
* not participate in the decision — a higher-priority rule's rejection
|
|
107
|
-
* must never touch the streak. */
|
|
108
|
-
clarificationAccepted?: boolean;
|
|
109
107
|
/** v2.13: Git HEAD commit hash of the backtrack target round.
|
|
110
108
|
* Set when action is "backtrack". The verification gate uses this
|
|
111
109
|
* to check that the agent restored the workspace before working. */
|
|
@@ -115,6 +113,31 @@ export interface RoundProcessResult {
|
|
|
115
113
|
* not still dirty (agent must restore workspace first). */
|
|
116
114
|
backtrackSkippedFiles?: string[];
|
|
117
115
|
}
|
|
116
|
+
/** v3.8.1: The rolled-back branch's facts — the ONE derivation of which rounds
|
|
117
|
+
* failed, which approaches must not be repeated, which assumptions were
|
|
118
|
+
* falsified, and which files (with their failed-round git fingerprints) the
|
|
119
|
+
* agent must restore.
|
|
120
|
+
*
|
|
121
|
+
* Sources are COMMITTED rounds above the restore point; rejected attempts are
|
|
122
|
+
* not durable history and never become a source. The in-flight attempt that
|
|
123
|
+
* triggered the rollback is the one exception — its evaluation lives in this
|
|
124
|
+
* process, not in committed history.
|
|
125
|
+
*
|
|
126
|
+
* Extracted from the coordinator's inline walk so it is unit-testable without
|
|
127
|
+
* driving a whole rollback, and so the prompt, the state file and the
|
|
128
|
+
* committed decision all describe one event. */
|
|
129
|
+
export declare function deriveBacktrackRecoveryFacts(input: {
|
|
130
|
+
currentRound: number;
|
|
131
|
+
restoreRound: number;
|
|
132
|
+
vaultEntries: VaultEntry[];
|
|
133
|
+
selfEval: SelfEvaluation;
|
|
134
|
+
}): {
|
|
135
|
+
skippedFiles: string[];
|
|
136
|
+
skippedFingerprints: Record<string, string>;
|
|
137
|
+
failedRounds: number[];
|
|
138
|
+
approaches: string[];
|
|
139
|
+
wrongAssumptions: string[];
|
|
140
|
+
};
|
|
118
141
|
export declare class RoundCoordinator {
|
|
119
142
|
private store;
|
|
120
143
|
constructor(store?: LoopStore);
|
|
@@ -127,10 +150,7 @@ export declare class RoundCoordinator {
|
|
|
127
150
|
* - Managing heartbeat / signal handlers (runtime only)
|
|
128
151
|
* - Memory injection (both paths, before calling processRound)
|
|
129
152
|
* - Transactional feedback commit (accepted rounds only)
|
|
130
|
-
* - State file I/O (both paths, after compiling)
|
|
131
|
-
|
|
132
|
-
* @param driftClarificationStreak v2.12: Current clarification streak
|
|
133
|
-
* from session state. Passed through to enforceRound for R7 escalation. */
|
|
134
|
-
processRound(input: RoundProcessInput, driftClarificationStreak?: number): RoundProcessResult;
|
|
153
|
+
* - State file I/O (both paths, after compiling) */
|
|
154
|
+
processRound(input: RoundProcessInput): RoundProcessResult;
|
|
135
155
|
}
|
|
136
156
|
//# sourceMappingURL=round-coordinator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"round-coordinator.d.ts","sourceRoot":"","sources":["../src/round-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"round-coordinator.d.ts","sourceRoot":"","sources":["../src/round-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAEV,cAAc,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