@gamaze/hicortex 0.20.9 → 0.21.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/README.md +8 -0
- package/assets/dashboard.html +4174 -835
- package/dist/calibration.d.ts +119 -0
- package/dist/calibration.js +149 -1
- package/dist/capture-health.d.ts +87 -0
- package/dist/capture-health.js +106 -0
- package/dist/capture-pause.d.ts +86 -0
- package/dist/capture-pause.js +127 -0
- package/dist/capture.d.ts +9 -0
- package/dist/capture.js +2 -1
- package/dist/cli.js +36 -0
- package/dist/consolidate.d.ts +35 -0
- package/dist/consolidate.js +85 -9
- package/dist/dashboard.d.ts +322 -3
- package/dist/dashboard.js +592 -7
- package/dist/db.js +105 -0
- package/dist/eval/importance-eval.d.ts +85 -0
- package/dist/eval/importance-eval.js +286 -0
- package/dist/eval/planted-fixtures.d.ts +1 -1
- package/dist/eval/ranking-battery.d.ts +78 -0
- package/dist/eval/ranking-battery.js +181 -0
- package/dist/eval/ranking-eval.d.ts +41 -0
- package/dist/eval/ranking-eval.js +391 -0
- package/dist/eval/ranking-fixtures.d.ts +77 -0
- package/dist/eval/ranking-fixtures.js +226 -0
- package/dist/identity-store.d.ts +21 -0
- package/dist/identity-store.js +49 -0
- package/dist/init.d.ts +14 -0
- package/dist/init.js +32 -0
- package/dist/mcp-server.d.ts +12 -0
- package/dist/mcp-server.js +184 -3
- package/dist/nightly.d.ts +9 -1
- package/dist/nightly.js +59 -7
- package/dist/prompts.d.ts +10 -0
- package/dist/prompts.js +28 -5
- package/dist/reconsolidation.d.ts +59 -30
- package/dist/reconsolidation.js +526 -296
- package/dist/rescore-importance.d.ts +80 -0
- package/dist/rescore-importance.js +236 -0
- package/dist/retrieval.d.ts +12 -0
- package/dist/retrieval.js +30 -1
- package/dist/stages.d.ts +37 -0
- package/dist/stages.js +51 -0
- package/dist/state.d.ts +32 -6
- package/dist/storage.d.ts +34 -2
- package/dist/storage.js +63 -6
- package/dist/types.d.ts +48 -0
- package/package.json +3 -1
|
@@ -42,13 +42,32 @@
|
|
|
42
42
|
* NOTHING else: no status change, no rewrite, no merge queue; both records
|
|
43
43
|
* stay live so the consumer sees both truths. Both merge paths (the zone's
|
|
44
44
|
* planDedup and the judged mergeMemoryIds) refuse to blend a conflicts-linked
|
|
45
|
-
* pair, counted as conflict_skipped. The zone therefore runs AFTER the
|
|
46
|
-
*
|
|
45
|
+
* pair, counted as conflict_skipped. The zone therefore runs AFTER the scan —
|
|
46
|
+
* with the zone first, a >=0.92 conflict pair was blended
|
|
47
47
|
* before the judge ever saw it (the planted-eval harm: canonical=older, the
|
|
48
48
|
* newer truth erased); running it last means verdicts/marks/binds land first
|
|
49
49
|
* and the zone merges only what no verdict claimed — a conflicts bind set by
|
|
50
50
|
* this run's scan guards the SAME run's zone.
|
|
51
51
|
*
|
|
52
|
+
* #439 apply-on-confirm — confirmed merges and rewrite groups apply at the
|
|
53
|
+
* candidate BOUNDARY (the end of the scan iteration that confirmed them), not
|
|
54
|
+
* in post-scan phases. The old end-of-run batch was a completion assumption
|
|
55
|
+
* written when nightlies finished in an hour; under #405 budget pressure it
|
|
56
|
+
* became a days-long queue where confirmed work never landed and every night
|
|
57
|
+
* re-paid the judgment cost (cursor held below un-applied groups, pairs
|
|
58
|
+
* re-detected, re-judged). Now each judged-merge pair applies via
|
|
59
|
+
* mergeMemoryIds in its OWN transaction at confirmation time, each rewrite
|
|
60
|
+
* group via its own rewrite call + applyRewriteGroup transaction; the cursor
|
|
61
|
+
* advances per APPLIED candidate, so a deferral holds it below exactly ONE
|
|
62
|
+
* candidate's pairs. One pre-merge backup per run (lazy, before the first
|
|
63
|
+
* application); the capture lock is taken per boundary batch with a same-run
|
|
64
|
+
* retry list + a final drain. A shared trigger IS the current candidate, so
|
|
65
|
+
* the multi-target keep rule resolves across the boundary's groups (any keep
|
|
66
|
+
* keeps). A target corrected by two different candidates takes two sequential
|
|
67
|
+
* rewrites — the second composes the already-corrected story — instead of one
|
|
68
|
+
* grouped call (the ONE-call grouping was a cost optimization, not a
|
|
69
|
+
* correctness invariant; accepted semantics change).
|
|
70
|
+
*
|
|
52
71
|
* Status vocabulary (code-defined, extensible — deliberately NOT config):
|
|
53
72
|
* NULL/'active' default | 'superseded' + 'retracted' demote in ranking |
|
|
54
73
|
* 'corrected' = rewritten, never demotes (demoting it would bury the
|
|
@@ -129,9 +148,9 @@ export interface ReconsolidationOptions {
|
|
|
129
148
|
*/
|
|
130
149
|
deadline?: RunDeadline;
|
|
131
150
|
/**
|
|
132
|
-
* Capture-lock acquirer override (tests) — the deterministic zone and
|
|
133
|
-
* judged-merge
|
|
134
|
-
* capture.ts lock. DedupOptions.acquireLock pattern.
|
|
151
|
+
* Capture-lock acquirer override (tests) — the deterministic zone and each
|
|
152
|
+
* #439 boundary's judged-merge batch hold a short lock window. Defaults to
|
|
153
|
+
* the real capture.ts lock. DedupOptions.acquireLock pattern.
|
|
135
154
|
*/
|
|
136
155
|
acquireLock?: typeof acquireCaptureLock;
|
|
137
156
|
}
|
|
@@ -329,16 +348,18 @@ export declare function buildResolutionBands(floor: number, ceiling: number): Re
|
|
|
329
348
|
*/
|
|
330
349
|
export declare function bandForCosine(bands: ResolutionBand[], cosine: number): ResolutionBand | null;
|
|
331
350
|
/**
|
|
332
|
-
* Nightly reconsolidation stage (#384, #392 — THE unified resolution stage
|
|
351
|
+
* Nightly reconsolidation stage (#384, #392 — THE unified resolution stage;
|
|
352
|
+
* #439 apply-on-confirm).
|
|
333
353
|
*
|
|
334
354
|
* Phase order (#393 guard-C): the deterministic merge zone (pairs >= the
|
|
335
|
-
* ceiling) runs LAST — after the scan
|
|
336
|
-
* rewrite
|
|
337
|
-
* and binds land first and the zone merges only what no
|
|
338
|
-
* the zone first, a >=0.92 genuine-conflict pair was
|
|
339
|
-
* ever saw it (the planted-eval harm); running it
|
|
340
|
-
* bind set by this run's scan guards the SAME run's
|
|
341
|
-
* (lock, backup, deadline, persistBand, fail-soft) are
|
|
355
|
+
* ceiling) runs LAST — after the scan (which now includes every judged-merge
|
|
356
|
+
* application and rewrite, #439). Judgment outranks the deterministic sweep:
|
|
357
|
+
* verdicts, marks, and binds land first and the zone merges only what no
|
|
358
|
+
* verdict claimed. With the zone first, a >=0.92 genuine-conflict pair was
|
|
359
|
+
* blended before the judge ever saw it (the planted-eval harm); running it
|
|
360
|
+
* last means a `conflicts` bind set by this run's scan guards the SAME run's
|
|
361
|
+
* zone. Zone internals (lock, backup, deadline, persistBand, fail-soft) are
|
|
362
|
+
* unchanged.
|
|
342
363
|
*
|
|
343
364
|
* Scan: every memory with rowid > reconsolidationCursor (no shape filter;
|
|
344
365
|
* absorbed candidates are skipped — invisible memories are not re-judged).
|
|
@@ -349,25 +370,33 @@ export declare function bandForCosine(bands: ResolutionBand[], cosine: number):
|
|
|
349
370
|
* judged) plus the scout's FTS hits for correction-shaped memories (same
|
|
350
371
|
* verdict loop, NO similarity gate; guard-C: a scout hit whose KNN twin sits
|
|
351
372
|
* at/above the ceiling is re-tagged scout so the pair IS judged instead of
|
|
352
|
-
* being left for the zone to blend). Confirmed
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
* nothing else (both live); everything else is mark-only.
|
|
373
|
+
* being left for the zone to blend). Confirmed `corrects` pairs above the
|
|
374
|
+
* confidence gate on fact-shaped targets group by target; a `conflicts`
|
|
375
|
+
* verdict writes the conflicts link and nothing else (both live); everything
|
|
376
|
+
* else is mark-only.
|
|
357
377
|
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
*
|
|
378
|
+
* #439 BOUNDARY apply: at the END of each candidate iteration everything it
|
|
379
|
+
* confirmed applies IMMEDIATELY — merges first (each judged-merge pair via
|
|
380
|
+
* mergeMemoryIds in its own transaction, under the boundary's short lock
|
|
381
|
+
* window; ONE lazy pre-merge backup per run), then the iteration's rewrite
|
|
382
|
+
* groups (one rewrite LLM call + one applyRewriteGroup transaction each;
|
|
383
|
+
* dispositions resolved ACROSS the boundary's groups — the multi-target keep
|
|
384
|
+
* rule: a trigger absorbed only if every group's contract says absorb). A
|
|
385
|
+
* busy capture lock pushes the boundary's merges onto a same-run retry list
|
|
386
|
+
* (retried at the next boundary and once in a final drain after the scan);
|
|
387
|
+
* a deadline, a backup failure, or a rewrite-call refusal/infra error defers
|
|
388
|
+
* the remaining work and holds the cursor.
|
|
362
389
|
*
|
|
363
|
-
* Cursor discipline
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
390
|
+
* Cursor discipline: the cursor advances past a candidate only when its
|
|
391
|
+
* iteration's confirmed work has LANDED (or was refused-with-verdict-rendered:
|
|
392
|
+
* metadata mismatch, conflict-linked, mark-only fallback). A deferral holds
|
|
393
|
+
* the cursor BELOW the current candidate — bounded to ONE candidate's pairs,
|
|
394
|
+
* re-detected and re-judged next run (dup-over-loss — a confirmed resolution
|
|
395
|
+
* must never be silently dropped by the cursor passing it). The separate
|
|
396
|
+
* scan high-water (state.reconsolidationScannedRowid) records the max
|
|
397
|
+
* candidate rowid ENTERED and is never held back, so the report can split
|
|
398
|
+
* verdict calls into pairs_reevaluated (at/below the prior high-water) vs
|
|
399
|
+
* pairs_new — the convergence measurement.
|
|
371
400
|
*
|
|
372
401
|
* Dry-run: the zone's discovery + the free idempotency check only — zero LLM
|
|
373
402
|
* calls, zero writes, no cursor or band-stats persistence. Gate discovery is
|