@telora/daemon 0.18.55 → 0.18.61
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/build-info.json +6 -3
- package/dist/ai-inspection-context.d.ts.map +1 -1
- package/dist/ai-inspection-context.js +11 -1
- package/dist/ai-inspection-context.js.map +1 -1
- package/dist/ai-inspection-runner.d.ts.map +1 -1
- package/dist/ai-inspection-runner.js +0 -1
- package/dist/ai-inspection-runner.js.map +1 -1
- package/dist/audit-phase.d.ts.map +1 -1
- package/dist/audit-phase.js +4 -0
- package/dist/audit-phase.js.map +1 -1
- package/dist/cascade-restatement.d.ts +14 -5
- package/dist/cascade-restatement.d.ts.map +1 -1
- package/dist/cascade-restatement.js +35 -6
- package/dist/cascade-restatement.js.map +1 -1
- package/dist/cli/connect.d.ts +15 -11
- package/dist/cli/connect.d.ts.map +1 -1
- package/dist/cli/connect.js +20 -24
- package/dist/cli/connect.js.map +1 -1
- package/dist/completion/review-exit-phase.d.ts.map +1 -1
- package/dist/completion/review-exit-phase.js +37 -10
- package/dist/completion/review-exit-phase.js.map +1 -1
- package/dist/de-restatement.d.ts.map +1 -1
- package/dist/de-restatement.js +0 -1
- package/dist/de-restatement.js.map +1 -1
- package/dist/delivery-reconciler.d.ts +21 -1
- package/dist/delivery-reconciler.d.ts.map +1 -1
- package/dist/delivery-reconciler.js +21 -3
- package/dist/delivery-reconciler.js.map +1 -1
- package/dist/directive/close-loop-stage.d.ts.map +1 -1
- package/dist/directive/close-loop-stage.js +10 -2
- package/dist/directive/close-loop-stage.js.map +1 -1
- package/dist/focus-executor.d.ts +6 -0
- package/dist/focus-executor.d.ts.map +1 -1
- package/dist/focus-executor.js +10 -2
- package/dist/focus-executor.js.map +1 -1
- package/dist/focus-lifecycle.js +1 -1
- package/dist/focus-lifecycle.js.map +1 -1
- package/dist/focus-provisioning.js +1 -1
- package/dist/focus-provisioning.js.map +1 -1
- package/dist/negative-branch.d.ts +32 -1
- package/dist/negative-branch.d.ts.map +1 -1
- package/dist/negative-branch.js +55 -9
- package/dist/negative-branch.js.map +1 -1
- package/dist/prompt-sections/persona-sections.d.ts +19 -0
- package/dist/prompt-sections/persona-sections.d.ts.map +1 -1
- package/dist/prompt-sections/persona-sections.js +55 -0
- package/dist/prompt-sections/persona-sections.js.map +1 -1
- package/dist/queries/verification.d.ts +132 -0
- package/dist/queries/verification.d.ts.map +1 -1
- package/dist/queries/verification.js +271 -0
- package/dist/queries/verification.js.map +1 -1
- package/dist/reality-writeback.d.ts +257 -0
- package/dist/reality-writeback.d.ts.map +1 -0
- package/dist/reality-writeback.js +179 -0
- package/dist/reality-writeback.js.map +1 -0
- package/dist/resolvers/shared/reality-tree.d.ts +39 -1
- package/dist/resolvers/shared/reality-tree.d.ts.map +1 -1
- package/dist/resolvers/shared/reality-tree.js +51 -1
- package/dist/resolvers/shared/reality-tree.js.map +1 -1
- package/dist/review-defect-detector.d.ts +33 -0
- package/dist/review-defect-detector.d.ts.map +1 -1
- package/dist/review-defect-detector.js +53 -0
- package/dist/review-defect-detector.js.map +1 -1
- package/dist/team-prompt-base.d.ts +1 -1
- package/dist/team-prompt-base.d.ts.map +1 -1
- package/dist/team-prompt-base.js +1 -1
- package/dist/team-prompt-base.js.map +1 -1
- package/dist/unified-init.d.ts.map +1 -1
- package/dist/unified-init.js +0 -2
- package/dist/unified-init.js.map +1 -1
- package/dist/unified-shell.d.ts.map +1 -1
- package/dist/unified-shell.js +0 -2
- package/dist/unified-shell.js.map +1 -1
- package/dist/verification-engine.d.ts +10 -0
- package/dist/verification-engine.d.ts.map +1 -1
- package/dist/verification-engine.js +32 -1
- package/dist/verification-engine.js.map +1 -1
- package/dist/verify-restatement.d.ts +16 -0
- package/dist/verify-restatement.d.ts.map +1 -1
- package/dist/verify-restatement.js +7 -0
- package/dist/verify-restatement.js.map +1 -1
- package/dist/worktree.d.ts +5 -2
- package/dist/worktree.d.ts.map +1 -1
- package/dist/worktree.js +6 -5
- package/dist/worktree.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reality-tree writeback: decide the per-node verify classification a landing
|
|
3
|
+
* stamps onto the nodes an injection owns.
|
|
4
|
+
*
|
|
5
|
+
* The differential problem this closes: a confident-but-wrong tree stays wrong
|
|
6
|
+
* because reality never writes back. When a delivery lands, the injection it
|
|
7
|
+
* materialized is flipped to `verified`, but the *targeted* UDE nodes are not
|
|
8
|
+
* told whether the asserted desired effect actually held. So a mistaken claim
|
|
9
|
+
* is frozen, not corrected. This module computes -- deterministically, from a
|
|
10
|
+
* small typed landing signal -- what status each targeted node should carry so
|
|
11
|
+
* a later reader can see which claims actually realized.
|
|
12
|
+
*
|
|
13
|
+
* Reuses the EXISTING node verify-classification model (no new status
|
|
14
|
+
* machinery, no migration):
|
|
15
|
+
* - `classification`: 'match' | 'legitimate_divergence' | 'shortfall'
|
|
16
|
+
* (mirrors reality_tree_nodes.verify_classification)
|
|
17
|
+
* - `evidence`: rationale for a clean realization (-> node.evidence)
|
|
18
|
+
* - `verifyDivergenceReason`: why the achieved effect differs
|
|
19
|
+
* (-> node.verify_divergence_reason)
|
|
20
|
+
*
|
|
21
|
+
* The function is PURE: no DB, no I/O, no clock. The dispatcher (close-loop
|
|
22
|
+
* landing path) supplies the landing signal and applies the result via the
|
|
23
|
+
* existing callApi verify / node-update seam. Nothing here is destructive --
|
|
24
|
+
* the output only stamps status + evidence/reason on nodes the injection owns.
|
|
25
|
+
*
|
|
26
|
+
* @module reality-writeback
|
|
27
|
+
*/
|
|
28
|
+
/** The three verify outcomes a node can carry. Mirrors VerifyClassification
|
|
29
|
+
* in src/types/reality-tree.ts -- duplicated here only because the daemon
|
|
30
|
+
* cannot import the Vite app's types. */
|
|
31
|
+
export type WritebackClassification = 'match' | 'legitimate_divergence' | 'shortfall';
|
|
32
|
+
/**
|
|
33
|
+
* One node the injection targets, as seen at landing. Intentionally minimal --
|
|
34
|
+
* just enough to identify the node and, optionally, observe whether its UDE
|
|
35
|
+
* flipped and how the achieved effect compares to what was declared. We model
|
|
36
|
+
* the landing observation per-node so a partially-divergent landing (one UDE
|
|
37
|
+
* flipped, another did not) stamps each node correctly.
|
|
38
|
+
*/
|
|
39
|
+
export interface TargetedNodeLanding {
|
|
40
|
+
/** reality_tree_nodes.id of the UDE this injection targeted. */
|
|
41
|
+
nodeId: string;
|
|
42
|
+
/**
|
|
43
|
+
* The node's ACHIEVED desired-effect prose. For a clean `match`, this is the
|
|
44
|
+
* declared desired effect carried forward unchanged (achieved == declared).
|
|
45
|
+
* Carried into the writeback's `statement` so the apply step has non-empty
|
|
46
|
+
* prose -- the verify edge only stamps a node's classification when the
|
|
47
|
+
* restatement carries a non-empty statement (an empty statement is dropped
|
|
48
|
+
* whole, classification included). Optional: omit when no prose is available
|
|
49
|
+
* and the apply step will fall back to leaving the node un-stamped.
|
|
50
|
+
*/
|
|
51
|
+
achievedStatement?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Did the FRT cascade actually flip this targeted UDE (UDE -> DE)? A clean
|
|
54
|
+
* landing flips it; a divergent landing leaves it unflipped. Optional so a
|
|
55
|
+
* caller that only has a focus-wide clean/divergent signal can omit it and
|
|
56
|
+
* fall back to the landing-level `cascadeFlipped`.
|
|
57
|
+
*/
|
|
58
|
+
flipped?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Whether the achieved effect (what reality delivered) differs from the
|
|
61
|
+
* declared desired effect even though the UDE flipped. A flipped-but-different
|
|
62
|
+
* landing is a `legitimate_divergence`, not a `match`.
|
|
63
|
+
*/
|
|
64
|
+
achievedDiffersFromDeclared?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Free-text reason describing the divergence or shortfall. Carried verbatim
|
|
67
|
+
* into verifyDivergenceReason. Ignored for a clean match.
|
|
68
|
+
*/
|
|
69
|
+
divergenceReason?: string;
|
|
70
|
+
/**
|
|
71
|
+
* The node's ORIGINAL claim -- its declared desired-effect prose
|
|
72
|
+
* (frt_statement, else statement) AS IT STOOD BEFORE this landing. Distinct
|
|
73
|
+
* from `achievedStatement` (what reality delivered). Carried onto the
|
|
74
|
+
* writeback so the inward-drift detector can frame the contradiction as the
|
|
75
|
+
* tree's claim (observedState) vs what reality showed (proposedCorrection).
|
|
76
|
+
* A confident-but-wrong assertion is corrected by surfacing the CLAIM the
|
|
77
|
+
* ratifier must reconsider, not the reality that already happened. Optional:
|
|
78
|
+
* absent, the inward detector falls back to a deterministic placeholder.
|
|
79
|
+
*/
|
|
80
|
+
originalClaim?: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The landing signal for one injection. Deliberately NOT coupled to a live
|
|
84
|
+
* derive_frt run -- the caller distills derive_frt (or a simpler delivery
|
|
85
|
+
* close) into this typed shape and hands it in.
|
|
86
|
+
*/
|
|
87
|
+
export interface InjectionLanding {
|
|
88
|
+
/** reality_tree_nodes.id of the injection node that landed. */
|
|
89
|
+
injectionId: string;
|
|
90
|
+
/** The nodes this injection targets (the UDEs it claimed to dissolve). */
|
|
91
|
+
targetedNodes: readonly TargetedNodeLanding[];
|
|
92
|
+
/**
|
|
93
|
+
* Landing-wide flip signal: did the cascade flip the targeted UDEs as a
|
|
94
|
+
* whole? Used as the fallback when a `TargetedNodeLanding` does not carry its
|
|
95
|
+
* own per-node `flipped`. A clean landing is `true`; a divergent landing is
|
|
96
|
+
* `false`.
|
|
97
|
+
*/
|
|
98
|
+
cascadeFlipped: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Did the injection deliver its effect at all? When false, the gap means the
|
|
101
|
+
* injection did not produce the intended change and the targeted nodes are
|
|
102
|
+
* stamped `shortfall` rather than `legitimate_divergence`. Defaults to true
|
|
103
|
+
* (the injection delivered something) when omitted.
|
|
104
|
+
*/
|
|
105
|
+
delivered?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Evidence text for a clean realization. Cited verbatim on each matched
|
|
108
|
+
* node's evidence field so an audit read can trace why the claim was
|
|
109
|
+
* accepted. Optional -- absent, the match carries no evidence string.
|
|
110
|
+
*/
|
|
111
|
+
evidence?: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Per-node writeback decision. Shaped to feed straight into the existing
|
|
115
|
+
* verify/node-update seam:
|
|
116
|
+
* - match -> stamp evidence (the achieved effect held)
|
|
117
|
+
* - legitimate_divergence | shortfall -> stamp verifyDivergenceReason
|
|
118
|
+
*/
|
|
119
|
+
export interface NodeWriteback {
|
|
120
|
+
nodeId: string;
|
|
121
|
+
classification: WritebackClassification;
|
|
122
|
+
/**
|
|
123
|
+
* The achieved desired-effect prose to stamp on the node alongside the
|
|
124
|
+
* classification, carried from the landing's `achievedStatement`. Required
|
|
125
|
+
* by the apply step for the classification to land (the verify edge drops a
|
|
126
|
+
* restatement with an empty statement). Absent when the landing supplied no
|
|
127
|
+
* prose -- the apply step then skips the node.
|
|
128
|
+
*/
|
|
129
|
+
statement?: string;
|
|
130
|
+
/** Set only for `match`; the rationale the claim held. */
|
|
131
|
+
evidence?: string;
|
|
132
|
+
/** Set only for divergence/shortfall; why the achieved effect differs. */
|
|
133
|
+
verifyDivergenceReason?: string;
|
|
134
|
+
/**
|
|
135
|
+
* The node's ORIGINAL claim (declared desired-effect prose before this
|
|
136
|
+
* landing), carried from the landing's `originalClaim`. Distinct from
|
|
137
|
+
* `statement` (the ACHIEVED prose). Threaded so a contradicted node's inward
|
|
138
|
+
* drift proposal frames the tree's claim (observedState), not the reality
|
|
139
|
+
* that already happened. Absent when the landing supplied no original claim.
|
|
140
|
+
*/
|
|
141
|
+
originalClaim?: string;
|
|
142
|
+
/**
|
|
143
|
+
* TEL-6: an `assumed` match is a clean landing that carries NO evidence.
|
|
144
|
+
* Recording it as a `verified` (`match`) stamp would assert an UNEARNED
|
|
145
|
+
* certainty -- the exact disease this writeback fights. So an unevidenced
|
|
146
|
+
* match is flagged `assumed` and the apply step does NOT persist a
|
|
147
|
+
* `verify_classification='match'` for it (it stays unstamped until grounded).
|
|
148
|
+
* Only ever true on a `match`.
|
|
149
|
+
*/
|
|
150
|
+
assumed?: boolean;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Pure decision: given one injection's landing signal, decide the per-node
|
|
154
|
+
* writeback for each targeted node.
|
|
155
|
+
*
|
|
156
|
+
* Rules (deterministic, evaluated per node):
|
|
157
|
+
* 1. Empty target set -> empty output.
|
|
158
|
+
* 2. Injection did not deliver -> EVERY node 'shortfall' + reason.
|
|
159
|
+
* (delivered === false; the gap means the injection produced nothing.)
|
|
160
|
+
* 3. Node flipped AND achieved == declared -> 'match' (+ evidence if any).
|
|
161
|
+
* Flip is the node's own `flipped` when present, else the landing's
|
|
162
|
+
* `cascadeFlipped`.
|
|
163
|
+
* 4. Node flipped BUT achieved differs -> 'legitimate_divergence'
|
|
164
|
+
* (+ verifyDivergenceReason).
|
|
165
|
+
* 5. Node did NOT flip -> 'legitimate_divergence'
|
|
166
|
+
* (+ verifyDivergenceReason) -- the targeted UDE did not move as claimed,
|
|
167
|
+
* but the injection still delivered (rule 2 already handled non-delivery).
|
|
168
|
+
*
|
|
169
|
+
* No side effects. The caller applies the result via callApi.
|
|
170
|
+
*/
|
|
171
|
+
export declare function decideNodeWriteback(landing: InjectionLanding): NodeWriteback[];
|
|
172
|
+
/**
|
|
173
|
+
* True iff the landing realized cleanly: every targeted node matched. An
|
|
174
|
+
* empty target set is vacuously clean. Convenience predicate for callers that
|
|
175
|
+
* need a single clean/divergent bit (e.g. to choose whether to short-circuit
|
|
176
|
+
* the flip), derived from the same pure decision so the two never disagree.
|
|
177
|
+
*/
|
|
178
|
+
export declare function isCleanLanding(landing: InjectionLanding): boolean;
|
|
179
|
+
/**
|
|
180
|
+
* One node's stamped verify status as the inward detector sees it. Mirrors the
|
|
181
|
+
* columns the writeback persists onto reality_tree_nodes
|
|
182
|
+
* (`verify_classification` / `verify_divergence_reason`) plus the node's own
|
|
183
|
+
* claim prose, so the detector can frame the contradiction as
|
|
184
|
+
* observedState (the claim) vs proposedCorrection (what reality showed).
|
|
185
|
+
*
|
|
186
|
+
* Deliberately decoupled from `NodeWriteback`: any caller with a stamped node
|
|
187
|
+
* row (a fresh DB read, or the writeback's own output) can satisfy this shape.
|
|
188
|
+
*/
|
|
189
|
+
export interface StampedNode {
|
|
190
|
+
/** reality_tree_nodes.id of the stamped node. */
|
|
191
|
+
nodeId: string;
|
|
192
|
+
/**
|
|
193
|
+
* The node's stamped verify classification. `null`/`undefined` = unstamped
|
|
194
|
+
* (reality has not written back yet) -> no inward proposal.
|
|
195
|
+
*/
|
|
196
|
+
verifyClassification?: WritebackClassification | null;
|
|
197
|
+
/** The recorded reason the achieved effect diverged. */
|
|
198
|
+
verifyDivergenceReason?: string | null;
|
|
199
|
+
/**
|
|
200
|
+
* The tree's CLAIM about this node -- its declared desired-effect prose
|
|
201
|
+
* (frt_statement, else statement). Carried into the proposal's observedState
|
|
202
|
+
* as the assertion reality contradicted. Optional: absent, a deterministic
|
|
203
|
+
* placeholder is used so the proposal still frames the contradiction.
|
|
204
|
+
*/
|
|
205
|
+
claimStatement?: string | null;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* The inward drift-proposal payload, shaped to feed straight into the existing
|
|
209
|
+
* `crt_drift_proposal_create` edge action (snake-cased by the caller / edge).
|
|
210
|
+
* `proposalKind` is always `update_statement` -- a contradicted claim is a
|
|
211
|
+
* claim whose statement reality showed to be wrong; the human ratifier decides
|
|
212
|
+
* the actual correction. `proposedMetadata.inward` flags it as INWARD drift
|
|
213
|
+
* (vs outward audit drift) and `sourceNodeId` records the stamped node that
|
|
214
|
+
* produced it.
|
|
215
|
+
*/
|
|
216
|
+
export interface InwardDriftProposal {
|
|
217
|
+
nodeId: string;
|
|
218
|
+
proposalKind: 'update_statement';
|
|
219
|
+
/** The tree's claim about the node -- the assertion reality contradicted. */
|
|
220
|
+
observedState: string;
|
|
221
|
+
/** What realized reality showed (the divergence reason) -- the correction. */
|
|
222
|
+
proposedCorrection: string;
|
|
223
|
+
proposedMetadata: {
|
|
224
|
+
/** Distinguishes inward (reality-contradicts-tree) from outward audit drift. */
|
|
225
|
+
inward: true;
|
|
226
|
+
/** The stamped node id that produced this proposal. */
|
|
227
|
+
sourceNodeId: string;
|
|
228
|
+
/** The stamped classification that triggered it (legitimate_divergence | shortfall). */
|
|
229
|
+
verifyClassification: 'legitimate_divergence' | 'shortfall';
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Pure inward-drift detector.
|
|
234
|
+
*
|
|
235
|
+
* Detection rule (deterministic): a node whose `verifyClassification` is
|
|
236
|
+
* `legitimate_divergence` or `shortfall` is a CONTRADICTED claim -- realized
|
|
237
|
+
* reality did not match what the tree asserted. It maps to one inward
|
|
238
|
+
* `update_statement` drift proposal carrying:
|
|
239
|
+
* - observedState = the tree's claim (claimStatement, else a placeholder)
|
|
240
|
+
* - proposedCorrection = what reality showed (verifyDivergenceReason, else a
|
|
241
|
+
* placeholder)
|
|
242
|
+
* - proposedMetadata = { inward:true, sourceNodeId, verifyClassification }
|
|
243
|
+
*
|
|
244
|
+
* A node stamped `match` produces NO proposal (reality confirmed the claim).
|
|
245
|
+
* An unstamped node (null/undefined classification) produces NO proposal
|
|
246
|
+
* (reality has not written back yet, so there is nothing to contradict).
|
|
247
|
+
*
|
|
248
|
+
* No side effects. The caller surfaces the result via crt_drift_proposal_create
|
|
249
|
+
* -- never auto-applies it.
|
|
250
|
+
*/
|
|
251
|
+
export declare function detectInwardDrift(node: StampedNode): InwardDriftProposal | null;
|
|
252
|
+
/**
|
|
253
|
+
* Batch convenience: run `detectInwardDrift` over many stamped nodes, dropping
|
|
254
|
+
* the nulls. Order-preserving; pure.
|
|
255
|
+
*/
|
|
256
|
+
export declare function detectInwardDriftForNodes(nodes: readonly StampedNode[]): InwardDriftProposal[];
|
|
257
|
+
//# sourceMappingURL=reality-writeback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reality-writeback.d.ts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;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,EAAE,CAyE9E;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAEjE;AAqBD;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW;IAC1B,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,oBAAoB,CAAC,EAAE,uBAAuB,GAAG,IAAI,CAAC;IACtD,wDAAwD;IACxD,sBAAsB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,kBAAkB,CAAC;IACjC,6EAA6E;IAC7E,aAAa,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE;QAChB,gFAAgF;QAChF,MAAM,EAAE,IAAI,CAAC;QACb,uDAAuD;QACvD,YAAY,EAAE,MAAM,CAAC;QACrB,wFAAwF;QACxF,oBAAoB,EAAE,uBAAuB,GAAG,WAAW,CAAC;KAC7D,CAAC;CACH;AAOD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,mBAAmB,GAAG,IAAI,CA2B/E;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,WAAW,EAAE,GAC5B,mBAAmB,EAAE,CAOvB"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reality-tree writeback: decide the per-node verify classification a landing
|
|
3
|
+
* stamps onto the nodes an injection owns.
|
|
4
|
+
*
|
|
5
|
+
* The differential problem this closes: a confident-but-wrong tree stays wrong
|
|
6
|
+
* because reality never writes back. When a delivery lands, the injection it
|
|
7
|
+
* materialized is flipped to `verified`, but the *targeted* UDE nodes are not
|
|
8
|
+
* told whether the asserted desired effect actually held. So a mistaken claim
|
|
9
|
+
* is frozen, not corrected. This module computes -- deterministically, from a
|
|
10
|
+
* small typed landing signal -- what status each targeted node should carry so
|
|
11
|
+
* a later reader can see which claims actually realized.
|
|
12
|
+
*
|
|
13
|
+
* Reuses the EXISTING node verify-classification model (no new status
|
|
14
|
+
* machinery, no migration):
|
|
15
|
+
* - `classification`: 'match' | 'legitimate_divergence' | 'shortfall'
|
|
16
|
+
* (mirrors reality_tree_nodes.verify_classification)
|
|
17
|
+
* - `evidence`: rationale for a clean realization (-> node.evidence)
|
|
18
|
+
* - `verifyDivergenceReason`: why the achieved effect differs
|
|
19
|
+
* (-> node.verify_divergence_reason)
|
|
20
|
+
*
|
|
21
|
+
* The function is PURE: no DB, no I/O, no clock. The dispatcher (close-loop
|
|
22
|
+
* landing path) supplies the landing signal and applies the result via the
|
|
23
|
+
* existing callApi verify / node-update seam. Nothing here is destructive --
|
|
24
|
+
* the output only stamps status + evidence/reason on nodes the injection owns.
|
|
25
|
+
*
|
|
26
|
+
* @module reality-writeback
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Default reason text used when a divergent/short landing carries no per-node
|
|
30
|
+
* reason. Deterministic so the output is stable for tests and audits.
|
|
31
|
+
*/
|
|
32
|
+
const DEFAULT_DIVERGENCE_REASON = 'Targeted effect did not flip cleanly on landing; recorded as divergence pending review.';
|
|
33
|
+
const DEFAULT_SHORTFALL_REASON = 'Injection did not deliver its intended effect on landing; targeted UDE remains.';
|
|
34
|
+
/**
|
|
35
|
+
* Pure decision: given one injection's landing signal, decide the per-node
|
|
36
|
+
* writeback for each targeted node.
|
|
37
|
+
*
|
|
38
|
+
* Rules (deterministic, evaluated per node):
|
|
39
|
+
* 1. Empty target set -> empty output.
|
|
40
|
+
* 2. Injection did not deliver -> EVERY node 'shortfall' + reason.
|
|
41
|
+
* (delivered === false; the gap means the injection produced nothing.)
|
|
42
|
+
* 3. Node flipped AND achieved == declared -> 'match' (+ evidence if any).
|
|
43
|
+
* Flip is the node's own `flipped` when present, else the landing's
|
|
44
|
+
* `cascadeFlipped`.
|
|
45
|
+
* 4. Node flipped BUT achieved differs -> 'legitimate_divergence'
|
|
46
|
+
* (+ verifyDivergenceReason).
|
|
47
|
+
* 5. Node did NOT flip -> 'legitimate_divergence'
|
|
48
|
+
* (+ verifyDivergenceReason) -- the targeted UDE did not move as claimed,
|
|
49
|
+
* but the injection still delivered (rule 2 already handled non-delivery).
|
|
50
|
+
*
|
|
51
|
+
* No side effects. The caller applies the result via callApi.
|
|
52
|
+
*/
|
|
53
|
+
export function decideNodeWriteback(landing) {
|
|
54
|
+
const nodes = landing.targetedNodes;
|
|
55
|
+
if (nodes.length === 0)
|
|
56
|
+
return [];
|
|
57
|
+
const delivered = landing.delivered ?? true;
|
|
58
|
+
const withStatement = (out, node) => {
|
|
59
|
+
if (typeof node.achievedStatement === 'string' && node.achievedStatement.trim().length > 0) {
|
|
60
|
+
out.statement = node.achievedStatement;
|
|
61
|
+
}
|
|
62
|
+
// Carry the node's ORIGINAL claim (pre-landing prose) so a contradicted
|
|
63
|
+
// node's inward drift proposal can frame the tree's claim, not the achieved
|
|
64
|
+
// reality. Absent -> the inward detector uses a deterministic placeholder.
|
|
65
|
+
if (typeof node.originalClaim === 'string' && node.originalClaim.trim().length > 0) {
|
|
66
|
+
out.originalClaim = node.originalClaim;
|
|
67
|
+
}
|
|
68
|
+
return out;
|
|
69
|
+
};
|
|
70
|
+
return nodes.map((node) => {
|
|
71
|
+
// Rule 2: the injection delivered nothing -> shortfall for every node.
|
|
72
|
+
if (!delivered) {
|
|
73
|
+
return withStatement({
|
|
74
|
+
nodeId: node.nodeId,
|
|
75
|
+
classification: 'shortfall',
|
|
76
|
+
verifyDivergenceReason: node.divergenceReason ?? DEFAULT_SHORTFALL_REASON,
|
|
77
|
+
}, node);
|
|
78
|
+
}
|
|
79
|
+
const flipped = node.flipped ?? landing.cascadeFlipped;
|
|
80
|
+
// Rule 5: the targeted UDE did not flip -> legitimate divergence.
|
|
81
|
+
if (!flipped) {
|
|
82
|
+
return withStatement({
|
|
83
|
+
nodeId: node.nodeId,
|
|
84
|
+
classification: 'legitimate_divergence',
|
|
85
|
+
verifyDivergenceReason: node.divergenceReason ?? DEFAULT_DIVERGENCE_REASON,
|
|
86
|
+
}, node);
|
|
87
|
+
}
|
|
88
|
+
// Rule 4: flipped, but the achieved effect differs from declared.
|
|
89
|
+
if (node.achievedDiffersFromDeclared === true) {
|
|
90
|
+
return withStatement({
|
|
91
|
+
nodeId: node.nodeId,
|
|
92
|
+
classification: 'legitimate_divergence',
|
|
93
|
+
verifyDivergenceReason: node.divergenceReason ?? DEFAULT_DIVERGENCE_REASON,
|
|
94
|
+
}, node);
|
|
95
|
+
}
|
|
96
|
+
// Rule 3: clean match.
|
|
97
|
+
const out = { nodeId: node.nodeId, classification: 'match' };
|
|
98
|
+
const hasEvidence = typeof landing.evidence === 'string' && landing.evidence.trim().length > 0;
|
|
99
|
+
if (hasEvidence) {
|
|
100
|
+
out.evidence = landing.evidence;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
// TEL-6: a match with NO evidence is an UNEARNED 'verified' claim. Flag it
|
|
104
|
+
// `assumed` so the apply step does not persist verify_classification='match'
|
|
105
|
+
// -- we never record an unevidenced "verified" stamp (the disease this
|
|
106
|
+
// writeback fights). The node stays unstamped until grounded by evidence.
|
|
107
|
+
out.assumed = true;
|
|
108
|
+
}
|
|
109
|
+
return withStatement(out, node);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* True iff the landing realized cleanly: every targeted node matched. An
|
|
114
|
+
* empty target set is vacuously clean. Convenience predicate for callers that
|
|
115
|
+
* need a single clean/divergent bit (e.g. to choose whether to short-circuit
|
|
116
|
+
* the flip), derived from the same pure decision so the two never disagree.
|
|
117
|
+
*/
|
|
118
|
+
export function isCleanLanding(landing) {
|
|
119
|
+
return decideNodeWriteback(landing).every((w) => w.classification === 'match');
|
|
120
|
+
}
|
|
121
|
+
const INWARD_OBSERVED_PLACEHOLDER = "The tree's claim for this node (statement not captured at detection time).";
|
|
122
|
+
const INWARD_CORRECTION_PLACEHOLDER = 'Realized reality diverged from this claim on landing; reason not recorded.';
|
|
123
|
+
/**
|
|
124
|
+
* Pure inward-drift detector.
|
|
125
|
+
*
|
|
126
|
+
* Detection rule (deterministic): a node whose `verifyClassification` is
|
|
127
|
+
* `legitimate_divergence` or `shortfall` is a CONTRADICTED claim -- realized
|
|
128
|
+
* reality did not match what the tree asserted. It maps to one inward
|
|
129
|
+
* `update_statement` drift proposal carrying:
|
|
130
|
+
* - observedState = the tree's claim (claimStatement, else a placeholder)
|
|
131
|
+
* - proposedCorrection = what reality showed (verifyDivergenceReason, else a
|
|
132
|
+
* placeholder)
|
|
133
|
+
* - proposedMetadata = { inward:true, sourceNodeId, verifyClassification }
|
|
134
|
+
*
|
|
135
|
+
* A node stamped `match` produces NO proposal (reality confirmed the claim).
|
|
136
|
+
* An unstamped node (null/undefined classification) produces NO proposal
|
|
137
|
+
* (reality has not written back yet, so there is nothing to contradict).
|
|
138
|
+
*
|
|
139
|
+
* No side effects. The caller surfaces the result via crt_drift_proposal_create
|
|
140
|
+
* -- never auto-applies it.
|
|
141
|
+
*/
|
|
142
|
+
export function detectInwardDrift(node) {
|
|
143
|
+
const classification = node.verifyClassification;
|
|
144
|
+
if (classification !== 'legitimate_divergence' && classification !== 'shortfall') {
|
|
145
|
+
// 'match', null, undefined -> no contradiction to correct.
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
const claim = typeof node.claimStatement === 'string' && node.claimStatement.trim().length > 0
|
|
149
|
+
? node.claimStatement
|
|
150
|
+
: INWARD_OBSERVED_PLACEHOLDER;
|
|
151
|
+
const correction = typeof node.verifyDivergenceReason === 'string' && node.verifyDivergenceReason.trim().length > 0
|
|
152
|
+
? node.verifyDivergenceReason
|
|
153
|
+
: INWARD_CORRECTION_PLACEHOLDER;
|
|
154
|
+
return {
|
|
155
|
+
nodeId: node.nodeId,
|
|
156
|
+
proposalKind: 'update_statement',
|
|
157
|
+
observedState: claim,
|
|
158
|
+
proposedCorrection: correction,
|
|
159
|
+
proposedMetadata: {
|
|
160
|
+
inward: true,
|
|
161
|
+
sourceNodeId: node.nodeId,
|
|
162
|
+
verifyClassification: classification,
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Batch convenience: run `detectInwardDrift` over many stamped nodes, dropping
|
|
168
|
+
* the nulls. Order-preserving; pure.
|
|
169
|
+
*/
|
|
170
|
+
export function detectInwardDriftForNodes(nodes) {
|
|
171
|
+
const out = [];
|
|
172
|
+
for (const node of nodes) {
|
|
173
|
+
const proposal = detectInwardDrift(node);
|
|
174
|
+
if (proposal)
|
|
175
|
+
out.push(proposal);
|
|
176
|
+
}
|
|
177
|
+
return out;
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=reality-writeback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reality-writeback.js","sourceRoot":"","sources":["../src/reality-writeback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAkIH;;;GAGG;AACH,MAAM,yBAAyB,GAC7B,yFAAyF,CAAC;AAC5F,MAAM,wBAAwB,GAC5B,iFAAiF,CAAC;AAEpF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAyB;IAC3D,MAAM,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC;IACpC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAElC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC;IAE5C,MAAM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,CAAC;IAED,MAAM,KAAK,GACT,OAAO,IAAI,CAAC,cAAc,KAAK,QAAQ,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QAC9E,CAAC,CAAC,IAAI,CAAC,cAAc;QACrB,CAAC,CAAC,2BAA2B,CAAC;IAClC,MAAM,UAAU,GACd,OAAO,IAAI,CAAC,sBAAsB,KAAK,QAAQ,IAAI,IAAI,CAAC,sBAAsB,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QAC9F,CAAC,CAAC,IAAI,CAAC,sBAAsB;QAC7B,CAAC,CAAC,6BAA6B,CAAC;IAEpC,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,YAAY,EAAE,kBAAkB;QAChC,aAAa,EAAE,KAAK;QACpB,kBAAkB,EAAE,UAAU;QAC9B,gBAAgB,EAAE;YAChB,MAAM,EAAE,IAAI;YACZ,YAAY,EAAE,IAAI,CAAC,MAAM;YACzB,oBAAoB,EAAE,cAAc;SACrC;KACF,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,KAA6B;IAE7B,MAAM,GAAG,GAA0B,EAAE,CAAC;IACtC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,QAAQ;YAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -43,6 +43,13 @@ export interface RealityNodeRow {
|
|
|
43
43
|
injectionStatus: 'proposed' | 'in_progress' | 'realized' | 'verified' | null;
|
|
44
44
|
dissolvesObstacle: string | null;
|
|
45
45
|
enablesNodeId: string | null;
|
|
46
|
+
/**
|
|
47
|
+
* When a negative-branch reservation pass last completed for this injection
|
|
48
|
+
* node. null = never run (a surfaced doubt); set = a pass completed (clean or
|
|
49
|
+
* with candidates). Optional for back-compat with payloads predating the
|
|
50
|
+
* column. Only meaningful on injection nodes.
|
|
51
|
+
*/
|
|
52
|
+
negativeBranchPassRanAt?: string | null;
|
|
46
53
|
evidence: string | null;
|
|
47
54
|
}
|
|
48
55
|
export interface RealityEdgeRow {
|
|
@@ -61,6 +68,37 @@ export interface EdgeListResponse {
|
|
|
61
68
|
totalCount: number;
|
|
62
69
|
}
|
|
63
70
|
export declare const CRT_DUMP_BUDGET_CHARS = 10000;
|
|
64
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Deterministic presentability check (connectivity gate), daemon-local mirror
|
|
73
|
+
* of the canonical `validateTreeIntegrity` in src/lib/reality-tree/tree-integrity.ts.
|
|
74
|
+
*
|
|
75
|
+
* The daemon cannot import the canonical validator (it lives in the Vite
|
|
76
|
+
* workspace; the Deno `_shared` copy is generated, not importable from Node), so
|
|
77
|
+
* the SAME rule is inlined here: a node is an ORPHAN -- and the tree is NOT
|
|
78
|
+
* presentable -- when it has zero edges of ANY type touching it AND no evidence.
|
|
79
|
+
* A non-empty `evidence` string folds the node into its own basis. Only ACTIVE
|
|
80
|
+
* wiring counts: callers pass already-active nodes, and any edge whose endpoint
|
|
81
|
+
* is not in the active node set is ignored (it cannot rescue a node).
|
|
82
|
+
*
|
|
83
|
+
* Pure and order-independent. Returns the orphan seqs (ascending) so a refusal
|
|
84
|
+
* notice can name them, and `presentable` (no orphans).
|
|
85
|
+
*/
|
|
86
|
+
export declare function computeTreePresentability(nodes: RealityNodeRow[], edges: RealityEdgeRow[]): {
|
|
87
|
+
presentable: boolean;
|
|
88
|
+
orphanSeqs: number[];
|
|
89
|
+
};
|
|
90
|
+
export interface RenderRealityTreeDumpOptions {
|
|
91
|
+
/**
|
|
92
|
+
* When true, the connectivity gate is ENFORCED MECHANICALLY: a tree carrying
|
|
93
|
+
* an orphan (not presentable) is WITHHELD -- the node/edge body is replaced
|
|
94
|
+
* with a refusal notice naming the orphan seqs. Use this at a downstream
|
|
95
|
+
* DECISION seam (e.g. the ai_inspection runner) where a non-presentable tree
|
|
96
|
+
* must not silently become reasoning context. Default false: authoring /
|
|
97
|
+
* inspection surfaces render the full tree (with doubt surfaced) so an author
|
|
98
|
+
* can SEE the orphans and fix them -- the gate must never wedge editing.
|
|
99
|
+
*/
|
|
100
|
+
enforcePresentable?: boolean;
|
|
101
|
+
}
|
|
102
|
+
export declare function renderRealityTreeDump(tree: RealityTreeRow, nodes: RealityNodeRow[], edges: RealityEdgeRow[], budgetChars: number, opts?: RenderRealityTreeDumpOptions): string;
|
|
65
103
|
export declare const FOCUS_REALITY_TREE_EMPTY_STATE: string;
|
|
66
104
|
//# sourceMappingURL=reality-tree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reality-tree.d.ts","sourceRoot":"","sources":["../../../src/resolvers/shared/reality-tree.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAC;CAC/B;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,QAAQ,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,WAAW,CAAC;IACzE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,oBAAoB,CAAC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CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,YAAY,GAAG,KAAK,GAAG,cAAc,GAAG,SAAS,CAAC;CAC7D;AAED,MAAM,WAAW,gBAAgB;IAAG,KAAK,EAAE,cAAc,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE;AACjF,MAAM,WAAW,gBAAgB;IAAG,KAAK,EAAE,cAAc,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE;AAEjF,eAAO,MAAM,qBAAqB,QAAS,CAAC;AA2D5C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,cAAc,EAAE,EACvB,KAAK,EAAE,cAAc,EAAE,GACtB;IAAE,WAAW,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAiBhD;AAED,MAAM,WAAW,4BAA4B;IAC3C;;;;;;;;OAQG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,cAAc,EAAE,EACvB,KAAK,EAAE,cAAc,EAAE,EACvB,WAAW,EAAE,MAAM,EACnB,IAAI,GAAE,4BAAiC,GACtC,MAAM,CAyFR;AAED,eAAO,MAAM,8BAA8B,QAG0C,CAAC"}
|
|
@@ -50,9 +50,59 @@ function renderEdgeLine(e, nodeBySeq) {
|
|
|
50
50
|
const toRef = to ? `#${to.seq}` : '?';
|
|
51
51
|
return `- ${fromRef} →[${e.edgeType}]→ ${toRef}`;
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Deterministic presentability check (connectivity gate), daemon-local mirror
|
|
55
|
+
* of the canonical `validateTreeIntegrity` in src/lib/reality-tree/tree-integrity.ts.
|
|
56
|
+
*
|
|
57
|
+
* The daemon cannot import the canonical validator (it lives in the Vite
|
|
58
|
+
* workspace; the Deno `_shared` copy is generated, not importable from Node), so
|
|
59
|
+
* the SAME rule is inlined here: a node is an ORPHAN -- and the tree is NOT
|
|
60
|
+
* presentable -- when it has zero edges of ANY type touching it AND no evidence.
|
|
61
|
+
* A non-empty `evidence` string folds the node into its own basis. Only ACTIVE
|
|
62
|
+
* wiring counts: callers pass already-active nodes, and any edge whose endpoint
|
|
63
|
+
* is not in the active node set is ignored (it cannot rescue a node).
|
|
64
|
+
*
|
|
65
|
+
* Pure and order-independent. Returns the orphan seqs (ascending) so a refusal
|
|
66
|
+
* notice can name them, and `presentable` (no orphans).
|
|
67
|
+
*/
|
|
68
|
+
export function computeTreePresentability(nodes, edges) {
|
|
69
|
+
const activeIds = new Set(nodes.map((n) => n.id));
|
|
70
|
+
const touched = new Set();
|
|
71
|
+
for (const e of edges) {
|
|
72
|
+
// Only edges between two active nodes count as a real "touch".
|
|
73
|
+
if (activeIds.has(e.fromNodeId) && activeIds.has(e.toNodeId)) {
|
|
74
|
+
touched.add(e.fromNodeId);
|
|
75
|
+
touched.add(e.toNodeId);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const orphanSeqs = [];
|
|
79
|
+
for (const n of nodes) {
|
|
80
|
+
const grounded = typeof n.evidence === 'string' && n.evidence.trim().length > 0;
|
|
81
|
+
if (!touched.has(n.id) && !grounded)
|
|
82
|
+
orphanSeqs.push(n.seq);
|
|
83
|
+
}
|
|
84
|
+
orphanSeqs.sort((a, b) => a - b);
|
|
85
|
+
return { presentable: orphanSeqs.length === 0, orphanSeqs };
|
|
86
|
+
}
|
|
87
|
+
export function renderRealityTreeDump(tree, nodes, edges, budgetChars, opts = {}) {
|
|
54
88
|
if (nodes.length === 0)
|
|
55
89
|
return '';
|
|
90
|
+
// Mechanical connectivity gate at the downstream-decision seam: a
|
|
91
|
+
// non-presentable tree is REFUSED (withheld), not handed to a consumer with a
|
|
92
|
+
// prose warning it might ignore. This is code-branch enforcement, not advice.
|
|
93
|
+
if (opts.enforcePresentable) {
|
|
94
|
+
const { presentable, orphanSeqs } = computeTreePresentability(nodes, edges);
|
|
95
|
+
if (!presentable) {
|
|
96
|
+
const seqList = orphanSeqs.map((s) => '#' + s).join(', ');
|
|
97
|
+
return (`### Tree: ${tree.name}\n\n` +
|
|
98
|
+
`_NOT PRESENTABLE -- withheld._ This tree carries ${orphanSeqs.length} ` +
|
|
99
|
+
`orphan node(s) (${seqList}): each floats with zero active edges and no ` +
|
|
100
|
+
`evidence. A tree with unwired, unevidenced claims is reality with ` +
|
|
101
|
+
`nothing to measure it against; it is not safe to use as reasoning ` +
|
|
102
|
+
`context until every node is wired into the causal graph or grounded in ` +
|
|
103
|
+
`evidence.`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
56
106
|
const nodeById = new Map();
|
|
57
107
|
for (const n of nodes)
|
|
58
108
|
nodeById.set(n.id, n);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reality-tree.js","sourceRoot":"","sources":["../../../src/resolvers/shared/reality-tree.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"reality-tree.js","sourceRoot":"","sources":["../../../src/resolvers/shared/reality-tree.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAE5C,MAAM,kBAAkB,GAA+C;IACrE,MAAM,EAAE,UAAU;IAClB,gBAAgB,EAAE,0BAA0B;IAC5C,cAAc,EAAE,uBAAuB;IACvC,SAAS,EAAE,kBAAkB;CAC9B,CAAC;AAEF,MAAM,eAAe,GAAiC;IACpD,QAAQ;IACR,kBAAkB;IAClB,gBAAgB;IAChB,WAAW;CACZ,CAAC;AAIF,MAAM,sBAAsB,GAAsB;IAChD,UAAU;IACV,aAAa;IACb,UAAU;IACV,UAAU;CACX,CAAC;AAEF,MAAM,yBAAyB,GAAoC;IACjE,QAAQ,EAAE,uBAAuB;IACjC,WAAW,EAAE,0B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filterReviewFiledIssues(issues: FocusIssueInfo[], review
|
|
|
46
46
|
* since the most recent review pass.
|
|
47
47
|
*/
|
|
48
48
|
export declare function reviewFiledIssueExists(issues: FocusIssueInfo[], reviewRequestedAt: string | null): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Whether a priority label is an explicit, low (deferrable) severity. Null,
|
|
51
|
+
* empty, P0, and P1 are all NOT deferrable.
|
|
52
|
+
*/
|
|
53
|
+
export declare function isLowPriority(priority: string | null | undefined): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Whether an issue is a DEFERRABLE review note: a review-filed, still-open
|
|
56
|
+
* issue (per isReviewFiledIssue) whose priority is an explicit low severity
|
|
57
|
+
* (P2/P3). A deferrable note must NOT route a verify delivery to verify_failed
|
|
58
|
+
* -- the review should converge (approve) and leave the note tracked.
|
|
59
|
+
*
|
|
60
|
+
* Anything that is review-filed but P0/P1 or unprioritized is BLOCKING, and any
|
|
61
|
+
* open work that is NOT review-filed (e.g. pre-existing coding work) is also
|
|
62
|
+
* blocking. Deferrability is a property of low-severity review triage notes
|
|
63
|
+
* only.
|
|
64
|
+
*/
|
|
65
|
+
export declare function isDeferrableReviewNote(issue: Pick<FocusIssueInfo, 'createdByRoleId' | 'createdAt' | 'status' | 'priority'>, reviewRequestedAt: string | null): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Filter a focus's issues to the open, review-filed notes that are deferrable
|
|
68
|
+
* (low severity). The caller uses the ids to mark the matching reconciler
|
|
69
|
+
* issues as `deferrable` so the verify-routing reconciler does not treat them
|
|
70
|
+
* as blocking open work.
|
|
71
|
+
*/
|
|
72
|
+
export declare function filterDeferrableReviewNotes(issues: FocusIssueInfo[], reviewRequestedAt: string | null): FocusIssueInfo[];
|
|
73
|
+
/**
|
|
74
|
+
* Returns true when there is at least one BLOCKING review-filed issue since the
|
|
75
|
+
* most recent review pass -- a review-filed, still-open issue that is NOT a
|
|
76
|
+
* deferrable low-severity note (i.e. P0/P1 or unprioritized). This is the gate
|
|
77
|
+
* for the review_missing_report notice: a review that filed ONLY deferrable
|
|
78
|
+
* notes converged cleanly and must not raise the "review skipped its outcome"
|
|
79
|
+
* escalation.
|
|
80
|
+
*/
|
|
81
|
+
export declare function blockingReviewFiledIssueExists(issues: FocusIssueInfo[], reviewRequestedAt: string | null): boolean;
|
|
49
82
|
//# sourceMappingURL=review-defect-detector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-defect-detector.d.ts","sourceRoot":"","sources":["../src/review-defect-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAMjD;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,MACU,CAAC;AAYlD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAIlE;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE5D;AAED,wCAAwC;AACxC,wBAAgB,iCAAiC,IAAI,IAAI,CAExD;AAID;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,iBAAiB,GAAG,WAAW,GAAG,QAAQ,CAAC,EACvE,iBAAiB,EAAE,MAAM,GAAG,IAAI,GAC/B,OAAO,CAMT;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,cAAc,EAAE,EACxB,iBAAiB,EAAE,MAAM,GAAG,IAAI,GAC/B,cAAc,EAAE,CAElB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,cAAc,EAAE,EACxB,iBAAiB,EAAE,MAAM,GAAG,IAAI,GAC/B,OAAO,CAUT"}
|
|
1
|
+
{"version":3,"file":"review-defect-detector.d.ts","sourceRoot":"","sources":["../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