daftari 1.18.0 → 1.20.0
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/CHANGELOG.md +93 -0
- package/dist/curation/edges.d.ts +57 -0
- package/dist/curation/edges.d.ts.map +1 -0
- package/dist/curation/edges.js +410 -0
- package/dist/curation/edges.js.map +1 -0
- package/dist/curation/staged-actions.d.ts +0 -1
- package/dist/curation/staged-actions.d.ts.map +1 -1
- package/dist/curation/staged-actions.js +7 -11
- package/dist/curation/staged-actions.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/search/reindex.d.ts.map +1 -1
- package/dist/search/reindex.js +4 -0
- package/dist/search/reindex.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +2 -0
- package/dist/server.js.map +1 -1
- package/dist/storage/index-db.d.ts +13 -0
- package/dist/storage/index-db.d.ts.map +1 -1
- package/dist/storage/index-db.js +43 -1
- package/dist/storage/index-db.js.map +1 -1
- package/dist/tools/edges.d.ts +17 -0
- package/dist/tools/edges.d.ts.map +1 -0
- package/dist/tools/edges.js +347 -0
- package/dist/tools/edges.js.map +1 -0
- package/dist/tools/staged-actions.d.ts +0 -1
- package/dist/tools/staged-actions.d.ts.map +1 -1
- package/dist/tools/staged-actions.js +92 -49
- package/dist/tools/staged-actions.js.map +1 -1
- package/dist/tools/write.d.ts +4 -1
- package/dist/tools/write.d.ts.map +1 -1
- package/dist/tools/write.js +522 -0
- package/dist/tools/write.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,99 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.20.0] - 2026-06-11
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Cortex §11.3: `derives_from` edge store with earned strength.** The
|
|
15
|
+
re-derivation graph the consolidation loop's strength model rests on — edges
|
|
16
|
+
are earned through independent re-derivations, never declared into trust.
|
|
17
|
+
- **Store** — append-only canonical log at `.daftari/edges.jsonl` (observe +
|
|
18
|
+
contest records) collapsed to current edge state; a derived
|
|
19
|
+
`derives_from_edges` table in the index (`from_path, to_path, strength,
|
|
20
|
+
k_survived, first_observed, last_rederived, last_age_decay, status`) is
|
|
21
|
+
rebuilt on reindex and materialized at startup for the future loop's
|
|
22
|
+
concurrent traversal reads.
|
|
23
|
+
- **Strength model** — the first observation seeds a zero-strength
|
|
24
|
+
`candidate` (birth is not a survival); only blind observations that vary a
|
|
25
|
+
recorded axis (prompt | input-neighborhood | model) count as independent
|
|
26
|
+
votes (`k_survived`, cap 5); a replayed (observer, axis) attestation counts
|
|
27
|
+
again only after a one-day gap, so a single caller cannot pump strength in
|
|
28
|
+
one sitting while the loop's later re-derivations still restore it;
|
|
29
|
+
strength ages by half-life (90 days) since the last qualifying
|
|
30
|
+
re-derivation, so an un-retested edge drops out of `trigger-bearing`
|
|
31
|
+
(floor 0.5) on its own — entrenchment is structurally impossible.
|
|
32
|
+
Constants are provisional pending calibration.
|
|
33
|
+
- **Tools** — `vault_edge_observe` (producer, exposed for the future loop
|
|
34
|
+
and testing), `vault_edge_contest` (case-2 contest-and-revoke; logs a
|
|
35
|
+
tension first so a contest can never be a silent decrement, reusing an
|
|
36
|
+
unresolved same-title tension so retries never stack duplicates; a revoked
|
|
37
|
+
edge is re-earned only through fresh observations), `vault_edges` (read,
|
|
38
|
+
live aged strength, endpoint/status filters). All caller paths are
|
|
39
|
+
canonicalized, so aliased inputs (`./a.md`, `b/../a.md`) cannot split an
|
|
40
|
+
edge's votes or slip a self-edge past the guard.
|
|
41
|
+
- `.daftari/edges.jsonl` and the previously-missed
|
|
42
|
+
`.daftari/staged-actions.jsonl` are now git-ignored (local curation state,
|
|
43
|
+
like the provenance log).
|
|
44
|
+
|
|
45
|
+
- **Cortex §11.4: `vault_supersede`, `vault_merge`, `vault_set_confidence`
|
|
46
|
+
write tools, wired into `vault_ratify`.** Completes the staged-action queue's
|
|
47
|
+
apply path — every action type the queue accepts (`promote`, `deprecate`,
|
|
48
|
+
`supersede`, `merge`, `confidence-up`) now applies on ratification instead of
|
|
49
|
+
punting to a `ratified-pending-tool` status.
|
|
50
|
+
- **`vault_set_confidence`** — change only a document's `confidence` (a
|
|
51
|
+
reason is required and recorded); rejects a no-op change already at the
|
|
52
|
+
target.
|
|
53
|
+
- **`vault_supersede`** — mark a document `superseded` by a named successor
|
|
54
|
+
that must already exist. Distinct from `vault_deprecate` (which sets
|
|
55
|
+
`deprecated` with an optional successor).
|
|
56
|
+
- **`vault_merge`** — combine two source docs into a target and supersede
|
|
57
|
+
both sources to point at it, all in one git commit (modeled on the backfill
|
|
58
|
+
multi-file commit, not single-file `performWrite`). The merged body is
|
|
59
|
+
supplied by the caller; the tool never synthesizes prose. `target_path` may
|
|
60
|
+
equal `path_a` (fold B into A) or be a new path; the target's frontmatter
|
|
61
|
+
inherits `path_a`'s with `provenance: synthesized` unless overridden.
|
|
62
|
+
- **`vault_ratify` dispatch** now covers all five action types; a malformed
|
|
63
|
+
`proposed_diff` leaves the action pending rather than recording a decision.
|
|
64
|
+
|
|
65
|
+
## [1.19.0] - 2026-06-10
|
|
66
|
+
|
|
67
|
+
### Added
|
|
68
|
+
|
|
69
|
+
- **Code coherence: doc-to-code bindings across the audit and eval** ([#117],
|
|
70
|
+
[#118], [#119], [#120], [#121]). Vault docs can now declare which code they
|
|
71
|
+
document, and the audit can verify those bindings still hold.
|
|
72
|
+
- **`describes` frontmatter field** ([#117]) — a built-in optional string
|
|
73
|
+
array of doc-to-code bindings, each `repo:path` or `repo:path::symbol` (a
|
|
74
|
+
bare `path` resolves against the doc's own repo; the `::symbol` suffix is
|
|
75
|
+
retained but resolved at file level in v1). A first-class relationship like
|
|
76
|
+
`sources` / `superseded_by`; defaults to `[]`.
|
|
77
|
+
- **`type: docs | code` repo discriminant for the audit** ([#118]) — code
|
|
78
|
+
repos join the coherence audit as reference targets, indexed by path only
|
|
79
|
+
(no frontmatter parsing, no content read) and excluded from staleness.
|
|
80
|
+
Adds the `--code-repo` flag; a code repo's glob defaults to `**/*`.
|
|
81
|
+
- **Doc-to-code reference integrity** ([#119]) — the audit classifies
|
|
82
|
+
`describes` entries as cross-repo edges and flags any whose target file is
|
|
83
|
+
missing, in a new report section with a `brokenDescribes` total and a
|
|
84
|
+
`fail_on.broken_describes` threshold (default 1).
|
|
85
|
+
- **`--semantic` drift check** ([#120]) — opt-in LLM pass that reads each
|
|
86
|
+
resolvable binding's doc and code and judges whether the doc still
|
|
87
|
+
accurately describes the code (`coherent` / `drifted` / `contradicted` /
|
|
88
|
+
`skipped`). `--auto-tension` logs drift as a tension in the docs vault;
|
|
89
|
+
`--max-semantic` caps LLM calls. Every non-markdown read is guarded (size
|
|
90
|
+
cap, binary sniff, strict UTF-8). Advisory — does not gate the exit code,
|
|
91
|
+
and the default audit needs no API key and makes no network calls.
|
|
92
|
+
- **`describes` as a subgraph edge kind in eval** ([#121]) — the cortex
|
|
93
|
+
quality sampler records doc-to-code edges and loads vault-resident code as
|
|
94
|
+
separate, non-citable context nodes (the answerer is never asked to
|
|
95
|
+
retrieve code). External-repo code-content loading in eval is deferred.
|
|
96
|
+
|
|
97
|
+
[#117]: https://github.com/mavaali/daftari/issues/117
|
|
98
|
+
[#118]: https://github.com/mavaali/daftari/issues/118
|
|
99
|
+
[#119]: https://github.com/mavaali/daftari/issues/119
|
|
100
|
+
[#120]: https://github.com/mavaali/daftari/issues/120
|
|
101
|
+
[#121]: https://github.com/mavaali/daftari/issues/121
|
|
102
|
+
|
|
10
103
|
## [1.18.0] - 2026-06-09
|
|
11
104
|
|
|
12
105
|
### Added
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type Result } from "../frontmatter/types.js";
|
|
2
|
+
import { type IndexDb } from "../storage/index-db.js";
|
|
3
|
+
export declare const EDGE_K_CAP = 5;
|
|
4
|
+
export declare const EDGE_HALF_LIFE_DAYS = 90;
|
|
5
|
+
export declare const EDGE_TRIGGER_STRENGTH = 0.5;
|
|
6
|
+
export declare const EDGE_REPLAY_GAP_DAYS = 1;
|
|
7
|
+
export declare const EDGE_AXES: readonly ["prompt", "input-neighborhood", "model"];
|
|
8
|
+
export type EdgeAxis = (typeof EDGE_AXES)[number];
|
|
9
|
+
export declare const EDGE_STATUSES: readonly ["candidate", "trigger-bearing", "revoked"];
|
|
10
|
+
export type EdgeStatus = (typeof EDGE_STATUSES)[number];
|
|
11
|
+
export interface DerivesFromEdge {
|
|
12
|
+
fromPath: string;
|
|
13
|
+
toPath: string;
|
|
14
|
+
strength: number;
|
|
15
|
+
kSurvived: number;
|
|
16
|
+
firstObserved: string;
|
|
17
|
+
lastRederived: string;
|
|
18
|
+
status: EdgeStatus;
|
|
19
|
+
observations: number;
|
|
20
|
+
contestedAt: string | null;
|
|
21
|
+
contestReason: string | null;
|
|
22
|
+
}
|
|
23
|
+
export interface ObserveEdgeInput {
|
|
24
|
+
fromPath: string;
|
|
25
|
+
toPath: string;
|
|
26
|
+
observedBy: string;
|
|
27
|
+
blind: boolean;
|
|
28
|
+
axis?: EdgeAxis;
|
|
29
|
+
note?: string;
|
|
30
|
+
at?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface ContestEdgeInput {
|
|
33
|
+
fromPath: string;
|
|
34
|
+
toPath: string;
|
|
35
|
+
contestedBy: string;
|
|
36
|
+
reason: string;
|
|
37
|
+
at?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare function edgesPath(vaultRoot: string): string;
|
|
40
|
+
export declare function edgeNowISO(): string;
|
|
41
|
+
export declare function agedStrength(kSurvived: number, lastRederived: string, now: Date): number;
|
|
42
|
+
export declare function observeEdge(vaultRoot: string, input: ObserveEdgeInput): Promise<Result<DerivesFromEdge, Error>>;
|
|
43
|
+
export declare function contestEdge(vaultRoot: string, input: ContestEdgeInput): Promise<Result<DerivesFromEdge, Error>>;
|
|
44
|
+
export interface ListEdgesFilter {
|
|
45
|
+
fromPath?: string;
|
|
46
|
+
toPath?: string;
|
|
47
|
+
status?: EdgeStatus;
|
|
48
|
+
}
|
|
49
|
+
export declare function listEdges(vaultRoot: string, filter?: ListEdgesFilter, now?: Date): Promise<Result<DerivesFromEdge[], Error>>;
|
|
50
|
+
export declare function getEdge(vaultRoot: string, fromPath: string, toPath: string, now?: Date): Promise<Result<DerivesFromEdge | null, Error>>;
|
|
51
|
+
export declare function rebuildEdgesIndex(db: IndexDb, vaultRoot: string, now?: Date): Result<{
|
|
52
|
+
count: number;
|
|
53
|
+
}, Error>;
|
|
54
|
+
export declare function materializeEdges(vaultRoot: string): Result<{
|
|
55
|
+
count: number;
|
|
56
|
+
}, Error>;
|
|
57
|
+
//# sourceMappingURL=edges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edges.d.ts","sourceRoot":"","sources":["../../src/curation/edges.ts"],"names":[],"mappings":"AA2CA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAGL,KAAK,OAAO,EAGb,MAAM,wBAAwB,CAAC;AAWhC,eAAO,MAAM,UAAU,IAAI,CAAC;AAK5B,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAKtC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAOzC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAGtC,eAAO,MAAM,SAAS,oDAAqD,CAAC;AAC5E,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAElD,eAAO,MAAM,aAAa,sDAAuD,CAAC;AAClF,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAOxD,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QA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IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAID,wBAAsB,SAAS,CAC7B,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,eAAoB,EAC5B,GAAG,GAAE,IAAiB,GACrB,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,EAAE,KAAK,CAAC,CAAC,CAiB3C;AAED,wBAAsB,OAAO,CAC3B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,GAAG,GAAE,IAAiB,GACrB,OAAO,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC,CAQhD;AASD,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,OAAO,EACX,SAAS,EAAE,MAAM,EACjB,GAAG,GAAE,IAAiB,GACrB,MAAM,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,CAAC,CAwBlC;AAKD,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,CAAC,CASpF"}
|
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
// derives_from edge store — the earned re-derivation graph (spec §11.3).
|
|
2
|
+
//
|
|
3
|
+
// An edge `from --derives_from--> to` asserts that `from`'s content derives
|
|
4
|
+
// from `to`. Edges are never declared into trust: they are *earned* through
|
|
5
|
+
// independent re-derivations (design doc §3.5 / §5.2). An edge's strength is
|
|
6
|
+
// recomputed from its observation trail, never kept as a mutable counter
|
|
7
|
+
// (strength-Q2), and it ages with time since the last independent re-test
|
|
8
|
+
// (§5.3.1(b)) so entrenchment is structurally impossible.
|
|
9
|
+
//
|
|
10
|
+
// Two stores, mirroring the staged-action queue:
|
|
11
|
+
//
|
|
12
|
+
// - Canonical: .daftari/edges.jsonl — append-only, one JSON record per
|
|
13
|
+
// line. An `observe` record is a (re-)derivation sighting the edge; a
|
|
14
|
+
// `contest` record is a case-2 contradiction (re-derivation failed with
|
|
15
|
+
// no upstream change → contest-and-revoke, strength-Q4). Collapsing the
|
|
16
|
+
// log to current edge state is this module's job.
|
|
17
|
+
//
|
|
18
|
+
// - Index: the `derives_from_edges` table in .daftari/index.db — a derived
|
|
19
|
+
// cache rebuilt from the jsonl on reindex (rebuildEdgesIndex /
|
|
20
|
+
// materializeEdges). It exists for the future loop's traversal engine,
|
|
21
|
+
// which wants concurrent SQL reads; v1 read paths read the jsonl
|
|
22
|
+
// directly, the same posture staged actions take.
|
|
23
|
+
//
|
|
24
|
+
// Collapse rules (the strength model, locked Q1–Q4 + §5.3.1):
|
|
25
|
+
// - The first observe in a cycle SEEDS the edge: k_survived = 0. Birth is
|
|
26
|
+
// not a survival — the graph is earned into existence, not free.
|
|
27
|
+
// - A later observe is a qualifying vote iff blind === true AND it varied
|
|
28
|
+
// at least one Q3 axis (prompt | input-neighborhood | model), recorded.
|
|
29
|
+
// Qualifying: k_survived += 1 (cap K_CAP) and the aging clock resets. A
|
|
30
|
+
// vote at cap still resets the clock — a real independent re-test
|
|
31
|
+
// refreshes freshness even when k is saturated.
|
|
32
|
+
// - A non-qualifying observe is kept in the trail but moves nothing:
|
|
33
|
+
// correlated sightings must not keep an edge warm (anti-cramming, C-Q4).
|
|
34
|
+
// - A contest revokes the edge; the caller logs a tension (surface, don't
|
|
35
|
+
// silently decrement). An observe AFTER a contest re-seeds a fresh cycle
|
|
36
|
+
// — revocation is reversible by re-derivation only.
|
|
37
|
+
//
|
|
38
|
+
// All file I/O is synchronous on purpose, like staged-actions: append runs in
|
|
39
|
+
// one critical section with no intervening await. The guarantee is
|
|
40
|
+
// per-process, which suffices under the one-daftari-per-vault process lock.
|
|
41
|
+
import { appendFileSync, mkdirSync, readFileSync } from "node:fs";
|
|
42
|
+
import { join } from "node:path";
|
|
43
|
+
import { err, ok } from "../frontmatter/types.js";
|
|
44
|
+
import { getProvider } from "../search/vector.js";
|
|
45
|
+
import { clearDerivesFromEdges, openIndexDb, upsertDerivesFromEdge, } from "../storage/index-db.js";
|
|
46
|
+
// --- calibration constants (provisional — open decision §12/#8) -------------
|
|
47
|
+
//
|
|
48
|
+
// These three numbers are the v1 defaults of the strength model, exported so
|
|
49
|
+
// the future scheduler reads the same values the store does. They are
|
|
50
|
+
// PROVISIONAL pending compute-budget calibration; changing them re-derives
|
|
51
|
+
// every edge's strength/status on the next collapse (nothing is baked into
|
|
52
|
+
// the log).
|
|
53
|
+
// Q2: flat independent-vote count, capped.
|
|
54
|
+
export const EDGE_K_CAP = 5;
|
|
55
|
+
// §5.3.1(b): strength halves per this many days since the last qualifying
|
|
56
|
+
// re-derivation. Gentle by design — aging asserts only "the last test is
|
|
57
|
+
// old", never "the edge is wrong".
|
|
58
|
+
export const EDGE_HALF_LIFE_DAYS = 90;
|
|
59
|
+
// An edge bears triggers (C may propagate through it) while its aged strength
|
|
60
|
+
// is at or above this floor. With the defaults, k=1 holds for one half-life
|
|
61
|
+
// (~90d) and k=5 for ~300d — nothing stays trusted forever without re-test.
|
|
62
|
+
export const EDGE_TRIGGER_STRENGTH = 0.5;
|
|
63
|
+
// Minimum gap before the SAME (observer, axis) attestation counts as a fresh
|
|
64
|
+
// vote (C-Q4: the inter-session gap is what makes a repeat re-derivation an
|
|
65
|
+
// independent vote; a same-sitting replay is cramming). A new (observer, axis)
|
|
66
|
+
// pair counts immediately — two different models voting in one sitting ARE
|
|
67
|
+
// independent.
|
|
68
|
+
export const EDGE_REPLAY_GAP_DAYS = 1;
|
|
69
|
+
// Q3: the axes a re-derivation can vary to count as an independent vote.
|
|
70
|
+
export const EDGE_AXES = ["prompt", "input-neighborhood", "model"];
|
|
71
|
+
export const EDGE_STATUSES = ["candidate", "trigger-bearing", "revoked"];
|
|
72
|
+
export function edgesPath(vaultRoot) {
|
|
73
|
+
return join(vaultRoot, ".daftari", "edges.jsonl");
|
|
74
|
+
}
|
|
75
|
+
// --- time helpers ------------------------------------------------------------
|
|
76
|
+
// Second-resolution ISO, the same record format staged-actions uses.
|
|
77
|
+
function toSecondISO(d) {
|
|
78
|
+
return d.toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
79
|
+
}
|
|
80
|
+
export function edgeNowISO() {
|
|
81
|
+
return toSecondISO(new Date());
|
|
82
|
+
}
|
|
83
|
+
// Fractional days between two instants; negative if `iso` is in the future.
|
|
84
|
+
function daysBetween(iso, now) {
|
|
85
|
+
return (now.getTime() - Date.parse(iso)) / 86_400_000;
|
|
86
|
+
}
|
|
87
|
+
// §5.3.1(b): aged strength. Exported so the scheduler and the lint surface
|
|
88
|
+
// compute the exact same value the store materializes.
|
|
89
|
+
export function agedStrength(kSurvived, lastRederived, now) {
|
|
90
|
+
const k = Math.min(Math.max(kSurvived, 0), EDGE_K_CAP);
|
|
91
|
+
if (k === 0)
|
|
92
|
+
return 0;
|
|
93
|
+
const age = Math.max(0, daysBetween(lastRederived, now));
|
|
94
|
+
return k * 0.5 ** (age / EDGE_HALF_LIFE_DAYS);
|
|
95
|
+
}
|
|
96
|
+
function readRawRecords(vaultRoot) {
|
|
97
|
+
let raw;
|
|
98
|
+
try {
|
|
99
|
+
raw = readFileSync(edgesPath(vaultRoot), "utf-8");
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
if (e.code === "ENOENT")
|
|
103
|
+
return [];
|
|
104
|
+
throw e;
|
|
105
|
+
}
|
|
106
|
+
const records = [];
|
|
107
|
+
for (const line of raw.split("\n")) {
|
|
108
|
+
const trimmed = line.trim();
|
|
109
|
+
if (!trimmed)
|
|
110
|
+
continue;
|
|
111
|
+
try {
|
|
112
|
+
const rec = JSON.parse(trimmed);
|
|
113
|
+
// `at` must parse to a real instant: an unparseable timestamp would turn
|
|
114
|
+
// into NaN strength downstream (Date.parse → NaN → 0.5 ** NaN), silently
|
|
115
|
+
// poisoning the materialized row and the sort. Such a line is corrupt,
|
|
116
|
+
// same as bad JSON — skip it.
|
|
117
|
+
if ((rec.kind === "observe" || rec.kind === "contest") &&
|
|
118
|
+
typeof rec.from === "string" &&
|
|
119
|
+
typeof rec.to === "string" &&
|
|
120
|
+
typeof rec.at === "string" &&
|
|
121
|
+
Number.isFinite(Date.parse(rec.at))) {
|
|
122
|
+
records.push(rec);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
// Skip a corrupt line; the log is append-only and best-effort.
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return records;
|
|
130
|
+
}
|
|
131
|
+
function edgeKey(from, to) {
|
|
132
|
+
// Paths are vault-relative and never contain a newline; "\n" cannot collide.
|
|
133
|
+
return `${from}\n${to}`;
|
|
134
|
+
}
|
|
135
|
+
// Collapses the append-only log to one current state per (from, to), applying
|
|
136
|
+
// the strength-model rules in FILE order (the order events were appended —
|
|
137
|
+
// the tools only ever append at the current instant, so file order is time
|
|
138
|
+
// order; an out-of-order `at` is only reachable through the test-only
|
|
139
|
+
// override). Strength and status are derived afterward (deriveEdge) so they
|
|
140
|
+
// are always recomputed, never carried.
|
|
141
|
+
//
|
|
142
|
+
// Trust boundary: `blind` and `axis` are unverifiable attestations — the
|
|
143
|
+
// store cannot check that a pass really was blind or really varied the axis
|
|
144
|
+
// it claims. Enforcement of genuine independence (and §10.5's multi-pass
|
|
145
|
+
// agreement for contests) is the LOOP's job, not the store's. What the store
|
|
146
|
+
// does guard, mechanically (the §5.2 hazard: correlated re-derivations
|
|
147
|
+
// defeating both gates): a REPLAYED attestation — the same (observer, axis)
|
|
148
|
+
// pair voting again — counts only after EDGE_REPLAY_GAP_DAYS since the last
|
|
149
|
+
// counted vote, so a single caller cannot pump k to the cap in one sitting,
|
|
150
|
+
// while a genuine later re-derivation by the same pass (the quarterly loop)
|
|
151
|
+
// still restores aged strength (§5.3.1 reversibility). A new (observer, axis)
|
|
152
|
+
// pair counts immediately.
|
|
153
|
+
function collapse(records) {
|
|
154
|
+
const byKey = new Map();
|
|
155
|
+
for (const rec of records) {
|
|
156
|
+
const from = rec.from;
|
|
157
|
+
const to = rec.to;
|
|
158
|
+
const at = rec.at;
|
|
159
|
+
const key = edgeKey(from, to);
|
|
160
|
+
const existing = byKey.get(key);
|
|
161
|
+
if (rec.kind === "contest") {
|
|
162
|
+
// A contest of an edge that was never observed cannot stand alone.
|
|
163
|
+
if (!existing || existing.revoked)
|
|
164
|
+
continue;
|
|
165
|
+
existing.revoked = true;
|
|
166
|
+
existing.contestedAt = at;
|
|
167
|
+
existing.contestReason = rec.reason ?? null;
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
// observe
|
|
171
|
+
if (!existing || existing.revoked) {
|
|
172
|
+
// Seed (or re-seed after a contest): a fresh earning cycle. Birth is not
|
|
173
|
+
// a survival, so k starts at 0; the aging clock starts at birth. The
|
|
174
|
+
// seed's own (observer, axis) attestation IS registered, so the seeder
|
|
175
|
+
// repeating the identical claim a second later is a replay (gap-gated),
|
|
176
|
+
// not an instant first vote — otherwise one caller could reach
|
|
177
|
+
// trigger-bearing in a single sitting with one repeated assertion.
|
|
178
|
+
const seedPair = rec.blind === true &&
|
|
179
|
+
typeof rec.axis === "string" &&
|
|
180
|
+
EDGE_AXES.includes(rec.axis) &&
|
|
181
|
+
typeof rec.by === "string" &&
|
|
182
|
+
rec.by.length > 0
|
|
183
|
+
? [`${rec.by}\n${rec.axis}`]
|
|
184
|
+
: [];
|
|
185
|
+
byKey.set(key, {
|
|
186
|
+
fromPath: from,
|
|
187
|
+
toPath: to,
|
|
188
|
+
kSurvived: 0,
|
|
189
|
+
firstObserved: at,
|
|
190
|
+
lastRederived: at,
|
|
191
|
+
observations: 1,
|
|
192
|
+
revoked: false,
|
|
193
|
+
contestedAt: null,
|
|
194
|
+
contestReason: null,
|
|
195
|
+
votedPairs: new Set(seedPair),
|
|
196
|
+
});
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
existing.observations += 1;
|
|
200
|
+
const qualifying = rec.blind === true &&
|
|
201
|
+
typeof rec.axis === "string" &&
|
|
202
|
+
EDGE_AXES.includes(rec.axis) &&
|
|
203
|
+
typeof rec.by === "string" &&
|
|
204
|
+
rec.by.length > 0;
|
|
205
|
+
if (qualifying) {
|
|
206
|
+
const pair = `${rec.by}\n${rec.axis}`;
|
|
207
|
+
const isReplay = existing.votedPairs.has(pair);
|
|
208
|
+
const gapDays = (Date.parse(at) - Date.parse(existing.lastRederived)) / 86_400_000;
|
|
209
|
+
if (!isReplay || gapDays >= EDGE_REPLAY_GAP_DAYS) {
|
|
210
|
+
existing.votedPairs.add(pair);
|
|
211
|
+
existing.kSurvived = Math.min(existing.kSurvived + 1, EDGE_K_CAP);
|
|
212
|
+
// A counted vote at cap still refreshes the clock: it is a real
|
|
213
|
+
// independent re-test even when k is saturated.
|
|
214
|
+
existing.lastRederived = at;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
// Non-qualifying and same-sitting-replayed observes move nothing —
|
|
218
|
+
// correlated sightings must not keep an edge warm.
|
|
219
|
+
}
|
|
220
|
+
return byKey;
|
|
221
|
+
}
|
|
222
|
+
function deriveEdge(state, now) {
|
|
223
|
+
const strength = state.revoked ? 0 : agedStrength(state.kSurvived, state.lastRederived, now);
|
|
224
|
+
const status = state.revoked
|
|
225
|
+
? "revoked"
|
|
226
|
+
: strength >= EDGE_TRIGGER_STRENGTH
|
|
227
|
+
? "trigger-bearing"
|
|
228
|
+
: "candidate";
|
|
229
|
+
return {
|
|
230
|
+
fromPath: state.fromPath,
|
|
231
|
+
toPath: state.toPath,
|
|
232
|
+
strength,
|
|
233
|
+
kSurvived: state.kSurvived,
|
|
234
|
+
firstObserved: state.firstObserved,
|
|
235
|
+
lastRederived: state.lastRederived,
|
|
236
|
+
status,
|
|
237
|
+
observations: state.observations,
|
|
238
|
+
contestedAt: state.contestedAt,
|
|
239
|
+
contestReason: state.contestReason,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
// --- producer / consumer -----------------------------------------------------
|
|
243
|
+
// Records a (re-)derivation observation. Validation is defensive — the tool
|
|
244
|
+
// layer validates too — but this is the durable boundary, so it re-checks.
|
|
245
|
+
export async function observeEdge(vaultRoot, input) {
|
|
246
|
+
for (const field of ["fromPath", "toPath", "observedBy"]) {
|
|
247
|
+
const v = input[field];
|
|
248
|
+
if (typeof v !== "string" || v.trim().length === 0) {
|
|
249
|
+
return err(new Error(`observeEdge requires a non-empty '${field}'`));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if (input.fromPath.trim() === input.toPath.trim()) {
|
|
253
|
+
return err(new Error("observeEdge: a document cannot derive from itself"));
|
|
254
|
+
}
|
|
255
|
+
if (typeof input.blind !== "boolean") {
|
|
256
|
+
return err(new Error("observeEdge requires a boolean 'blind'"));
|
|
257
|
+
}
|
|
258
|
+
if (input.axis !== undefined && !EDGE_AXES.includes(input.axis)) {
|
|
259
|
+
return err(new Error(`observeEdge 'axis' must be one of: ${EDGE_AXES.join(", ")}`));
|
|
260
|
+
}
|
|
261
|
+
if (input.at !== undefined && !Number.isFinite(Date.parse(input.at))) {
|
|
262
|
+
return err(new Error("observeEdge 'at' must be a parseable timestamp"));
|
|
263
|
+
}
|
|
264
|
+
const record = {
|
|
265
|
+
kind: "observe",
|
|
266
|
+
from: input.fromPath.trim(),
|
|
267
|
+
to: input.toPath.trim(),
|
|
268
|
+
at: input.at ?? edgeNowISO(),
|
|
269
|
+
by: input.observedBy.trim(),
|
|
270
|
+
blind: input.blind,
|
|
271
|
+
axis: input.axis ?? null,
|
|
272
|
+
...(input.note ? { note: input.note } : {}),
|
|
273
|
+
};
|
|
274
|
+
try {
|
|
275
|
+
mkdirSync(join(vaultRoot, ".daftari"), { recursive: true });
|
|
276
|
+
appendFileSync(edgesPath(vaultRoot), `${JSON.stringify(record)}\n`);
|
|
277
|
+
}
|
|
278
|
+
catch (e) {
|
|
279
|
+
const reason = e instanceof Error ? e.message : String(e);
|
|
280
|
+
return err(new Error(`cannot record edge observation: ${reason}`));
|
|
281
|
+
}
|
|
282
|
+
const after = collapse(readRawRecords(vaultRoot)).get(edgeKey(record.from, record.to));
|
|
283
|
+
if (!after)
|
|
284
|
+
return err(new Error("edge not found after write"));
|
|
285
|
+
return ok(deriveEdge(after, new Date()));
|
|
286
|
+
}
|
|
287
|
+
// Records a case-2 contest (re-derivation failed with no upstream change):
|
|
288
|
+
// the edge drops to `revoked`. The TOOL layer pairs this with a tension entry
|
|
289
|
+
// (surface, don't silently decrement) — the store records what happened, the
|
|
290
|
+
// tension log says so out loud.
|
|
291
|
+
export async function contestEdge(vaultRoot, input) {
|
|
292
|
+
for (const field of ["fromPath", "toPath", "contestedBy", "reason"]) {
|
|
293
|
+
const v = input[field];
|
|
294
|
+
if (typeof v !== "string" || v.trim().length === 0) {
|
|
295
|
+
return err(new Error(`contestEdge requires a non-empty '${field}'`));
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (input.at !== undefined && !Number.isFinite(Date.parse(input.at))) {
|
|
299
|
+
return err(new Error("contestEdge 'at' must be a parseable timestamp"));
|
|
300
|
+
}
|
|
301
|
+
const from = input.fromPath.trim();
|
|
302
|
+
const to = input.toPath.trim();
|
|
303
|
+
const current = collapse(readRawRecords(vaultRoot)).get(edgeKey(from, to));
|
|
304
|
+
if (!current) {
|
|
305
|
+
return err(new Error(`contestEdge: no such edge: ${from} derives_from ${to}`));
|
|
306
|
+
}
|
|
307
|
+
if (current.revoked) {
|
|
308
|
+
return err(new Error(`contestEdge: edge already revoked: ${from} derives_from ${to}`));
|
|
309
|
+
}
|
|
310
|
+
const record = {
|
|
311
|
+
kind: "contest",
|
|
312
|
+
from,
|
|
313
|
+
to,
|
|
314
|
+
at: input.at ?? edgeNowISO(),
|
|
315
|
+
by: input.contestedBy.trim(),
|
|
316
|
+
reason: input.reason.trim(),
|
|
317
|
+
};
|
|
318
|
+
try {
|
|
319
|
+
mkdirSync(join(vaultRoot, ".daftari"), { recursive: true });
|
|
320
|
+
appendFileSync(edgesPath(vaultRoot), `${JSON.stringify(record)}\n`);
|
|
321
|
+
}
|
|
322
|
+
catch (e) {
|
|
323
|
+
const reason = e instanceof Error ? e.message : String(e);
|
|
324
|
+
return err(new Error(`cannot record edge contest: ${reason}`));
|
|
325
|
+
}
|
|
326
|
+
const after = collapse(readRawRecords(vaultRoot)).get(edgeKey(from, to));
|
|
327
|
+
if (!after)
|
|
328
|
+
return err(new Error("edge not found after write"));
|
|
329
|
+
return ok(deriveEdge(after, new Date()));
|
|
330
|
+
}
|
|
331
|
+
// Collapsed edges with live aged strength, strongest first (ties by key for a
|
|
332
|
+
// stable order). A missing log is not an error — nothing has been observed.
|
|
333
|
+
export async function listEdges(vaultRoot, filter = {}, now = new Date()) {
|
|
334
|
+
try {
|
|
335
|
+
let edges = [...collapse(readRawRecords(vaultRoot)).values()].map((s) => deriveEdge(s, now));
|
|
336
|
+
if (filter.fromPath)
|
|
337
|
+
edges = edges.filter((e) => e.fromPath === filter.fromPath);
|
|
338
|
+
if (filter.toPath)
|
|
339
|
+
edges = edges.filter((e) => e.toPath === filter.toPath);
|
|
340
|
+
if (filter.status)
|
|
341
|
+
edges = edges.filter((e) => e.status === filter.status);
|
|
342
|
+
edges.sort((a, b) => b.strength - a.strength ||
|
|
343
|
+
a.fromPath.localeCompare(b.fromPath) ||
|
|
344
|
+
a.toPath.localeCompare(b.toPath));
|
|
345
|
+
return ok(edges);
|
|
346
|
+
}
|
|
347
|
+
catch (e) {
|
|
348
|
+
const reason = e instanceof Error ? e.message : String(e);
|
|
349
|
+
return err(new Error(`cannot read edges: ${reason}`));
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
export async function getEdge(vaultRoot, fromPath, toPath, now = new Date()) {
|
|
353
|
+
try {
|
|
354
|
+
const state = collapse(readRawRecords(vaultRoot)).get(edgeKey(fromPath, toPath));
|
|
355
|
+
return ok(state ? deriveEdge(state, now) : null);
|
|
356
|
+
}
|
|
357
|
+
catch (e) {
|
|
358
|
+
const reason = e instanceof Error ? e.message : String(e);
|
|
359
|
+
return err(new Error(`cannot read edge: ${reason}`));
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
// --- sqlite index rebuild ----------------------------------------------------
|
|
363
|
+
// Collapses the jsonl and repopulates the `derives_from_edges` table from
|
|
364
|
+
// scratch. `strength` and `status` are materialized as of `now`, and
|
|
365
|
+
// `last_age_decay` records that instant — the row's strength is exact as of
|
|
366
|
+
// that timestamp and ages from there (live readers recompute via
|
|
367
|
+
// agedStrength). One transaction, so a mid-rebuild failure rolls back.
|
|
368
|
+
export function rebuildEdgesIndex(db, vaultRoot, now = new Date()) {
|
|
369
|
+
try {
|
|
370
|
+
const edges = [...collapse(readRawRecords(vaultRoot)).values()].map((s) => deriveEdge(s, now));
|
|
371
|
+
const at = toSecondISO(now);
|
|
372
|
+
const rows = edges.map((e) => ({
|
|
373
|
+
from_path: e.fromPath,
|
|
374
|
+
to_path: e.toPath,
|
|
375
|
+
strength: e.strength,
|
|
376
|
+
k_survived: e.kSurvived,
|
|
377
|
+
first_observed: e.firstObserved,
|
|
378
|
+
last_rederived: e.lastRederived,
|
|
379
|
+
last_age_decay: at,
|
|
380
|
+
status: e.status,
|
|
381
|
+
}));
|
|
382
|
+
const write = db.transaction(() => {
|
|
383
|
+
clearDerivesFromEdges(db);
|
|
384
|
+
for (const row of rows)
|
|
385
|
+
upsertDerivesFromEdge(db, row);
|
|
386
|
+
});
|
|
387
|
+
write();
|
|
388
|
+
return ok({ count: rows.length });
|
|
389
|
+
}
|
|
390
|
+
catch (e) {
|
|
391
|
+
const reason = e instanceof Error ? e.message : String(e);
|
|
392
|
+
return err(new Error(`cannot rebuild derives_from index: ${reason}`));
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
// Opens the index db at the active provider's dim, rebuilds the
|
|
396
|
+
// derives_from_edges table, and closes. Startup path when no reindex is
|
|
397
|
+
// otherwise running; the reindex path calls rebuildEdgesIndex directly.
|
|
398
|
+
export function materializeEdges(vaultRoot) {
|
|
399
|
+
const opened = openIndexDb(vaultRoot, getProvider().dim);
|
|
400
|
+
if (!opened.ok)
|
|
401
|
+
return opened;
|
|
402
|
+
const db = opened.value;
|
|
403
|
+
try {
|
|
404
|
+
return rebuildEdgesIndex(db, vaultRoot);
|
|
405
|
+
}
|
|
406
|
+
finally {
|
|
407
|
+
db.close();
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
//# sourceMappingURL=edges.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edges.js","sourceRoot":"","sources":["../../src/curation/edges.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,6EAA6E;AAC7E,yEAAyE;AACzE,0EAA0E;AAC1E,0DAA0D;AAC1D,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,yEAAyE;AACzE,0EAA0E;AAC1E,4EAA4E;AAC5E,4EAA4E;AAC5E,sDAAsD;AACtD,EAAE;AACF,6EAA6E;AAC7E,mEAAmE;AACnE,2EAA2E;AAC3E,qEAAqE;AACrE,sDAAsD;AACtD,EAAE;AACF,8DAA8D;AAC9D,4EAA4E;AAC5E,qEAAqE;AACrE,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAC5E,sEAAsE;AACtE,oDAAoD;AACpD,uEAAuE;AACvE,6EAA6E;AAC7E,4EAA4E;AAC5E,6EAA6E;AAC7E,wDAAwD;AACxD,EAAE;AACF,8EAA8E;AAC9E,mEAAmE;AACnE,4EAA4E;AAE5E,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAe,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,E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AAC;QACX,MAAM,MAAM,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC1D,OAAO,GAAG,CAAC,IAAI,KAAK,CAAC,sCAAsC,MAAM,EAAE,CAAC,CAAC,CAAC;IACxE,CAAC;AACH,CAAC;AAED,gEAAgE;AAChE,wEAAwE;AACxE,wEAAwE;AACxE,MAAM,UAAU,gBAAgB,CAAC,SAAiB;IAChD,MAAM,MAAM,GAAG,WAAW,CAAC,SAAS,EAAE,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC;IACzD,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,OAAO,MAAM,CAAC;IAC9B,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC;IACxB,IAAI,CAAC;QACH,OAAO,iBAAiB,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IAC1C,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -2,7 +2,6 @@ import { type Result } from "../frontmatter/types.js";
|
|
|
2
2
|
import { type IndexDb } from "../storage/index-db.js";
|
|
3
3
|
export declare const STAGED_ACTION_TYPES: readonly ["promote", "deprecate", "supersede", "merge", "confidence-up"];
|
|
4
4
|
export type StagedActionType = (typeof STAGED_ACTION_TYPES)[number];
|
|
5
|
-
export declare const DEFERRED_ACTION_TYPES: readonly StagedActionType[];
|
|
6
5
|
export declare const DEFAULT_TTL_DAYS = 14;
|
|
7
6
|
export declare const STAGED_ACTION_STATUSES: readonly ["pending", "ratified", "rejected", "expired", "ratified-pending-tool"];
|
|
8
7
|
export type StagedActionStatus = (typeof STAGED_ACTION_STATUSES)[number];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staged-actions.d.ts","sourceRoot":"","sources":["../../src/curation/staged-actions.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAW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