mirror of
https://github.com/esengine/DeepSeek-Reasonix.git
synced 2026-11-07 10:45:59 -10:00
internal/ was 141 packages side by side, so nothing but a reader's memory
said which were foundations and which assembled the rest. Each now sits in a
layer directory, and the directory is the declaration:
base L0 foundation with no domain in it
contract L1 types and interfaces the layers above agree on
model, tools, safety, ext, state, platform
L2 subsystems, peers of one another
runtime L3 the turn engine
session L4 the controller
assembly L5 the composition root
frontend L6 cli, serve, acp and the host adapters
Only paths change: package names, code and behaviour do not. Imports,
repolint and coverage baselines, sensitive paths, CI package lists and docs
follow the new paths; release notes keep the paths they were written with,
and sample paths inside tests and fixtures keep theirs.
repolint gains layer-order: a package may import its own layer and those
below it, read from where it lives. The 47 imports that point upward today
are recorded as that rule's opening debt (-allow-widen, a new rule's first
baseline) and can only go down. Most of it is config, which still reaches
into eight subsystems and is the next thing to take apart; the rest is
event, history and a few tools reaching into runtime for types that belong
in contract.
35 lines
1.5 KiB
Go
35 lines
1.5 KiB
Go
package agent
|
|
|
|
// A fold reads the working view — frozen projection body, then
|
|
// canonical[priorCovered:] — but records its boundary canonically. The two
|
|
// systems agree only past the body: its digest stands for a range no index names.
|
|
|
|
// foldBoundary is one fold's landing point once expressed canonically.
|
|
type foldBoundary struct {
|
|
// Covered is the canonical prefix the new projection claims. It never moves
|
|
// backwards: history a digest already folded stays folded.
|
|
Covered int
|
|
// BodySuffixFrom indexes the frozen body remainder the new projection must
|
|
// carry forward, as body[BodySuffixFrom:]. It equals the body length when
|
|
// nothing survives, so an empty suffix needs no second field to say so.
|
|
BodySuffixFrom int
|
|
}
|
|
|
|
// mapFoldBoundary translates a working-view boundary into canonical
|
|
// coordinates. projected decides: false means the view is the transcript and
|
|
// bodyLen/priorCovered are ignored, so a stale pair cannot contradict it. At or
|
|
// inside the body, coverage stays at priorCovered — those indices name no
|
|
// canonical message — and the remainder the digest left behind stays frozen.
|
|
func mapFoldBoundary(start, bodyLen, priorCovered int, projected bool) foldBoundary {
|
|
start = max(start, 0)
|
|
if !projected {
|
|
return foldBoundary{Covered: start}
|
|
}
|
|
bodyLen = max(bodyLen, 0)
|
|
priorCovered = max(priorCovered, 0)
|
|
if start < bodyLen {
|
|
return foldBoundary{Covered: priorCovered, BodySuffixFrom: start}
|
|
}
|
|
return foldBoundary{Covered: priorCovered + (start - bodyLen), BodySuffixFrom: bodyLen}
|
|
}
|