@graphorin/memory 0.5.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 +15 -0
- package/LICENSE +21 -0
- package/README.md +401 -0
- package/dist/conflict/index.d.ts +3 -0
- package/dist/conflict/index.js +7 -0
- package/dist/conflict/locale-packs/en.js +262 -0
- package/dist/conflict/locale-packs/en.js.map +1 -0
- package/dist/conflict/locale-packs/index.js +4 -0
- package/dist/conflict/locale-packs/types.d.ts +103 -0
- package/dist/conflict/locale-packs/types.d.ts.map +1 -0
- package/dist/conflict/locale-packs/types.js +55 -0
- package/dist/conflict/locale-packs/types.js.map +1 -0
- package/dist/conflict/pipeline.d.ts +35 -0
- package/dist/conflict/pipeline.d.ts.map +1 -0
- package/dist/conflict/pipeline.js +257 -0
- package/dist/conflict/pipeline.js.map +1 -0
- package/dist/conflict/stages/helpers.js +66 -0
- package/dist/conflict/stages/helpers.js.map +1 -0
- package/dist/conflict/stages/stage1-exact-dedup.js +21 -0
- package/dist/conflict/stages/stage1-exact-dedup.js.map +1 -0
- package/dist/conflict/stages/stage2-embedding-three-zone.js +37 -0
- package/dist/conflict/stages/stage2-embedding-three-zone.js.map +1 -0
- package/dist/conflict/stages/stage3-heuristic-regex.js +45 -0
- package/dist/conflict/stages/stage3-heuristic-regex.js.map +1 -0
- package/dist/conflict/stages/stage4-subject-predicate.js +31 -0
- package/dist/conflict/stages/stage4-subject-predicate.js.map +1 -0
- package/dist/conflict/stages/stage5-defer-to-deep.js +22 -0
- package/dist/conflict/stages/stage5-defer-to-deep.js.map +1 -0
- package/dist/conflict/types.d.ts +222 -0
- package/dist/conflict/types.d.ts.map +1 -0
- package/dist/conflict/types.js +50 -0
- package/dist/conflict/types.js.map +1 -0
- package/dist/consolidator/budget.d.ts +1 -0
- package/dist/consolidator/budget.js +214 -0
- package/dist/consolidator/budget.js.map +1 -0
- package/dist/consolidator/decay.d.ts +35 -0
- package/dist/consolidator/decay.d.ts.map +1 -0
- package/dist/consolidator/decay.js +91 -0
- package/dist/consolidator/decay.js.map +1 -0
- package/dist/consolidator/dlq.js +58 -0
- package/dist/consolidator/dlq.js.map +1 -0
- package/dist/consolidator/errors.d.ts +54 -0
- package/dist/consolidator/errors.d.ts.map +1 -0
- package/dist/consolidator/errors.js +67 -0
- package/dist/consolidator/errors.js.map +1 -0
- package/dist/consolidator/idempotency.d.ts +1 -0
- package/dist/consolidator/idempotency.js +22 -0
- package/dist/consolidator/idempotency.js.map +1 -0
- package/dist/consolidator/index.d.ts +34 -0
- package/dist/consolidator/index.d.ts.map +1 -0
- package/dist/consolidator/index.js +163 -0
- package/dist/consolidator/index.js.map +1 -0
- package/dist/consolidator/lock.d.ts +2 -0
- package/dist/consolidator/lock.js +89 -0
- package/dist/consolidator/lock.js.map +1 -0
- package/dist/consolidator/noise-filter.d.ts +2 -0
- package/dist/consolidator/noise-filter.js +173 -0
- package/dist/consolidator/noise-filter.js.map +1 -0
- package/dist/consolidator/phases/deep.d.ts +4 -0
- package/dist/consolidator/phases/deep.js +198 -0
- package/dist/consolidator/phases/deep.js.map +1 -0
- package/dist/consolidator/phases/induce.d.ts +154 -0
- package/dist/consolidator/phases/induce.d.ts.map +1 -0
- package/dist/consolidator/phases/induce.js +253 -0
- package/dist/consolidator/phases/induce.js.map +1 -0
- package/dist/consolidator/phases/light.d.ts +4 -0
- package/dist/consolidator/phases/light.js +99 -0
- package/dist/consolidator/phases/light.js.map +1 -0
- package/dist/consolidator/phases/reflect.js +287 -0
- package/dist/consolidator/phases/reflect.js.map +1 -0
- package/dist/consolidator/phases/standard.d.ts +8 -0
- package/dist/consolidator/phases/standard.js +499 -0
- package/dist/consolidator/phases/standard.js.map +1 -0
- package/dist/consolidator/reconcile.js +192 -0
- package/dist/consolidator/reconcile.js.map +1 -0
- package/dist/consolidator/runtime.d.ts +62 -0
- package/dist/consolidator/runtime.d.ts.map +1 -0
- package/dist/consolidator/runtime.js +580 -0
- package/dist/consolidator/runtime.js.map +1 -0
- package/dist/consolidator/scheduler.d.ts +111 -0
- package/dist/consolidator/scheduler.d.ts.map +1 -0
- package/dist/consolidator/scheduler.js +71 -0
- package/dist/consolidator/scheduler.js.map +1 -0
- package/dist/consolidator/triggers.d.ts +40 -0
- package/dist/consolidator/triggers.d.ts.map +1 -0
- package/dist/consolidator/triggers.js +94 -0
- package/dist/consolidator/triggers.js.map +1 -0
- package/dist/consolidator/types.d.ts +397 -0
- package/dist/consolidator/types.d.ts.map +1 -0
- package/dist/consolidator/types.js +117 -0
- package/dist/consolidator/types.js.map +1 -0
- package/dist/context-engine/annotations.d.ts +118 -0
- package/dist/context-engine/annotations.d.ts.map +1 -0
- package/dist/context-engine/annotations.js +102 -0
- package/dist/context-engine/annotations.js.map +1 -0
- package/dist/context-engine/auto-recall.d.ts +52 -0
- package/dist/context-engine/auto-recall.d.ts.map +1 -0
- package/dist/context-engine/auto-recall.js +41 -0
- package/dist/context-engine/auto-recall.js.map +1 -0
- package/dist/context-engine/compaction/clear-tool-results.d.ts +55 -0
- package/dist/context-engine/compaction/clear-tool-results.d.ts.map +1 -0
- package/dist/context-engine/compaction/clear-tool-results.js +97 -0
- package/dist/context-engine/compaction/clear-tool-results.js.map +1 -0
- package/dist/context-engine/compaction/compactor.d.ts +52 -0
- package/dist/context-engine/compaction/compactor.d.ts.map +1 -0
- package/dist/context-engine/compaction/compactor.js +196 -0
- package/dist/context-engine/compaction/compactor.js.map +1 -0
- package/dist/context-engine/compaction/hooks/reanchor-persona-block.d.ts +15 -0
- package/dist/context-engine/compaction/hooks/reanchor-persona-block.d.ts.map +1 -0
- package/dist/context-engine/compaction/hooks/reanchor-persona-block.js +27 -0
- package/dist/context-engine/compaction/hooks/reanchor-persona-block.js.map +1 -0
- package/dist/context-engine/compaction/hooks/reanchor-pinned-facts.d.ts +18 -0
- package/dist/context-engine/compaction/hooks/reanchor-pinned-facts.d.ts.map +1 -0
- package/dist/context-engine/compaction/hooks/reanchor-pinned-facts.js +47 -0
- package/dist/context-engine/compaction/hooks/reanchor-pinned-facts.js.map +1 -0
- package/dist/context-engine/compaction/hooks/reanchor-project-rules.d.ts +15 -0
- package/dist/context-engine/compaction/hooks/reanchor-project-rules.d.ts.map +1 -0
- package/dist/context-engine/compaction/hooks/reanchor-project-rules.js +32 -0
- package/dist/context-engine/compaction/hooks/reanchor-project-rules.js.map +1 -0
- package/dist/context-engine/compaction/hooks/types.d.ts +42 -0
- package/dist/context-engine/compaction/hooks/types.d.ts.map +1 -0
- package/dist/context-engine/compaction/index.d.ts +9 -0
- package/dist/context-engine/compaction/index.js +9 -0
- package/dist/context-engine/compaction/templates/summary-9-section.d.ts +84 -0
- package/dist/context-engine/compaction/templates/summary-9-section.d.ts.map +1 -0
- package/dist/context-engine/compaction/templates/summary-9-section.js +84 -0
- package/dist/context-engine/compaction/templates/summary-9-section.js.map +1 -0
- package/dist/context-engine/compaction/thresholds.d.ts +68 -0
- package/dist/context-engine/compaction/thresholds.d.ts.map +1 -0
- package/dist/context-engine/compaction/thresholds.js +63 -0
- package/dist/context-engine/compaction/thresholds.js.map +1 -0
- package/dist/context-engine/compaction/types.d.ts +202 -0
- package/dist/context-engine/compaction/types.d.ts.map +1 -0
- package/dist/context-engine/engine.d.ts +258 -0
- package/dist/context-engine/engine.d.ts.map +1 -0
- package/dist/context-engine/engine.js +424 -0
- package/dist/context-engine/engine.js.map +1 -0
- package/dist/context-engine/index.d.ts +68 -0
- package/dist/context-engine/index.d.ts.map +1 -0
- package/dist/context-engine/index.js +24 -0
- package/dist/context-engine/locale-packs/en.d.ts +14 -0
- package/dist/context-engine/locale-packs/en.d.ts.map +1 -0
- package/dist/context-engine/locale-packs/en.js +87 -0
- package/dist/context-engine/locale-packs/en.js.map +1 -0
- package/dist/context-engine/locale-packs/index.js +4 -0
- package/dist/context-engine/locale-packs/resolver.d.ts +41 -0
- package/dist/context-engine/locale-packs/resolver.d.ts.map +1 -0
- package/dist/context-engine/locale-packs/resolver.js +119 -0
- package/dist/context-engine/locale-packs/resolver.js.map +1 -0
- package/dist/context-engine/locale-packs/types.d.ts +119 -0
- package/dist/context-engine/locale-packs/types.d.ts.map +1 -0
- package/dist/context-engine/locale-packs/types.js +24 -0
- package/dist/context-engine/locale-packs/types.js.map +1 -0
- package/dist/context-engine/metadata.d.ts +40 -0
- package/dist/context-engine/metadata.d.ts.map +1 -0
- package/dist/context-engine/metadata.js +66 -0
- package/dist/context-engine/metadata.js.map +1 -0
- package/dist/context-engine/preambles/inbound-en.d.ts +20 -0
- package/dist/context-engine/preambles/inbound-en.d.ts.map +1 -0
- package/dist/context-engine/preambles/inbound-en.js +23 -0
- package/dist/context-engine/preambles/inbound-en.js.map +1 -0
- package/dist/context-engine/privacy-filter.d.ts +108 -0
- package/dist/context-engine/privacy-filter.d.ts.map +1 -0
- package/dist/context-engine/privacy-filter.js +113 -0
- package/dist/context-engine/privacy-filter.js.map +1 -0
- package/dist/context-engine/templates/base-en.d.ts +19 -0
- package/dist/context-engine/templates/base-en.d.ts.map +1 -0
- package/dist/context-engine/templates/base-en.js +22 -0
- package/dist/context-engine/templates/base-en.js.map +1 -0
- package/dist/context-engine/templates/composer.d.ts +55 -0
- package/dist/context-engine/templates/composer.d.ts.map +1 -0
- package/dist/context-engine/templates/composer.js +51 -0
- package/dist/context-engine/templates/composer.js.map +1 -0
- package/dist/context-engine/token-budget.d.ts +99 -0
- package/dist/context-engine/token-budget.d.ts.map +1 -0
- package/dist/context-engine/token-budget.js +211 -0
- package/dist/context-engine/token-budget.js.map +1 -0
- package/dist/context-engine/token-counter.d.ts +54 -0
- package/dist/context-engine/token-counter.d.ts.map +1 -0
- package/dist/context-engine/token-counter.js +81 -0
- package/dist/context-engine/token-counter.js.map +1 -0
- package/dist/errors/index.d.ts +171 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +206 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/facade.d.ts +278 -0
- package/dist/facade.d.ts.map +1 -0
- package/dist/facade.js +265 -0
- package/dist/facade.js.map +1 -0
- package/dist/graph/entity-resolver.d.ts +135 -0
- package/dist/graph/entity-resolver.d.ts.map +1 -0
- package/dist/graph/entity-resolver.js +202 -0
- package/dist/graph/entity-resolver.js.map +1 -0
- package/dist/graph/index.d.ts +1 -0
- package/dist/index.d.ts +103 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/contextualize.d.ts +14 -0
- package/dist/internal/contextualize.d.ts.map +1 -0
- package/dist/internal/contextualize.js +110 -0
- package/dist/internal/contextualize.js.map +1 -0
- package/dist/internal/embedder-binding.js +50 -0
- package/dist/internal/embedder-binding.js.map +1 -0
- package/dist/internal/id.js +24 -0
- package/dist/internal/id.js.map +1 -0
- package/dist/internal/injection-heuristics.js +64 -0
- package/dist/internal/injection-heuristics.js.map +1 -0
- package/dist/internal/spans.js +35 -0
- package/dist/internal/spans.js.map +1 -0
- package/dist/internal/storage-adapter.d.ts +742 -0
- package/dist/internal/storage-adapter.d.ts.map +1 -0
- package/dist/migration/embedder-migration.d.ts +124 -0
- package/dist/migration/embedder-migration.d.ts.map +1 -0
- package/dist/migration/embedder-migration.js +109 -0
- package/dist/migration/embedder-migration.js.map +1 -0
- package/dist/migration/index.d.ts +2 -0
- package/dist/migration/index.js +3 -0
- package/dist/search/explain.d.ts +74 -0
- package/dist/search/explain.d.ts.map +1 -0
- package/dist/search/explain.js +50 -0
- package/dist/search/explain.js.map +1 -0
- package/dist/search/index.d.ts +6 -0
- package/dist/search/index.js +6 -0
- package/dist/search/iterative.d.ts +223 -0
- package/dist/search/iterative.d.ts.map +1 -0
- package/dist/search/iterative.js +330 -0
- package/dist/search/iterative.js.map +1 -0
- package/dist/search/query-transform.d.ts +112 -0
- package/dist/search/query-transform.d.ts.map +1 -0
- package/dist/search/query-transform.js +184 -0
- package/dist/search/query-transform.js.map +1 -0
- package/dist/search/rrf.d.ts +95 -0
- package/dist/search/rrf.d.ts.map +1 -0
- package/dist/search/rrf.js +166 -0
- package/dist/search/rrf.js.map +1 -0
- package/dist/search/types.d.ts +50 -0
- package/dist/search/types.d.ts.map +1 -0
- package/dist/tiers/episodic-memory.d.ts +142 -0
- package/dist/tiers/episodic-memory.d.ts.map +1 -0
- package/dist/tiers/episodic-memory.js +254 -0
- package/dist/tiers/episodic-memory.js.map +1 -0
- package/dist/tiers/index.d.ts +8 -0
- package/dist/tiers/index.js +9 -0
- package/dist/tiers/insight-memory.d.ts +71 -0
- package/dist/tiers/insight-memory.d.ts.map +1 -0
- package/dist/tiers/insight-memory.js +133 -0
- package/dist/tiers/insight-memory.js.map +1 -0
- package/dist/tiers/procedural-memory.d.ts +147 -0
- package/dist/tiers/procedural-memory.d.ts.map +1 -0
- package/dist/tiers/procedural-memory.js +267 -0
- package/dist/tiers/procedural-memory.js.map +1 -0
- package/dist/tiers/semantic-memory.d.ts +461 -0
- package/dist/tiers/semantic-memory.d.ts.map +1 -0
- package/dist/tiers/semantic-memory.js +631 -0
- package/dist/tiers/semantic-memory.js.map +1 -0
- package/dist/tiers/session-memory.d.ts +117 -0
- package/dist/tiers/session-memory.d.ts.map +1 -0
- package/dist/tiers/session-memory.js +163 -0
- package/dist/tiers/session-memory.js.map +1 -0
- package/dist/tiers/shared-memory.d.ts +29 -0
- package/dist/tiers/shared-memory.d.ts.map +1 -0
- package/dist/tiers/shared-memory.js +58 -0
- package/dist/tiers/shared-memory.js.map +1 -0
- package/dist/tiers/working-memory.d.ts +129 -0
- package/dist/tiers/working-memory.d.ts.map +1 -0
- package/dist/tiers/working-memory.js +229 -0
- package/dist/tiers/working-memory.js.map +1 -0
- package/dist/tools/block-tools.d.ts +98 -0
- package/dist/tools/block-tools.d.ts.map +1 -0
- package/dist/tools/block-tools.js +114 -0
- package/dist/tools/block-tools.js.map +1 -0
- package/dist/tools/fact-tools.d.ts +294 -0
- package/dist/tools/fact-tools.d.ts.map +1 -0
- package/dist/tools/fact-tools.js +293 -0
- package/dist/tools/fact-tools.js.map +1 -0
- package/dist/tools/index.d.ts +35 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +36 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/recall-tools.d.ts +209 -0
- package/dist/tools/recall-tools.d.ts.map +1 -0
- package/dist/tools/recall-tools.js +170 -0
- package/dist/tools/recall-tools.js.map +1 -0
- package/dist/tools/types.d.ts +40 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/package.json +119 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-adapter.d.ts","names":[],"sources":["../../src/internal/storage-adapter.ts"],"sourcesContent":[],"mappings":";;;;;;AAgCA;AAqBA;;;;;;;AAW2B,UAhCV,oBAAA,CAgCU;EAAd,SAAA,SAAA,CAAA,EAAA;IAAR,SAAA,UAAA,EAAA,MAAA;IAEoC,SAAA,MAAA,EA/BpB,YA+BoB;EAQ9B,CAAA;EAGgB;;;;;;EAWI,SAAA,SAAA,CAAA,EAAA,MAAA;;;AAU/B;;;;;;AAiBqC,UA9DpB,sBAAA,SAA+B,mBA8DX,CAAA;EAAV,gBAAA,EAAA,OAAA,EA7DE,SA6DF,EAAA,OAAA,EA7DoB,oBA6DpB,CAAA,EA7D2C,OA6D3C,CAAA,IAAA,CAAA;EAAd,YAAA,EAAA,KAAA,EA3DF,cA2DE,EAAA,SAAA,EA1DE,YA0DF,EAAA,UAAA,EAAA,MAAA,EAAA,IAAA,EAAA,MAAA,EAAR;EAEuB,IAAA,CAAA,EAAA,MAAA,EAAR;EASiB,kBAAA,CAAA,EAAA,OAAA,CAAA,EA9DhC,OA8DgC,CA9DxB,aA8DwB,CA9DV,SA8DU,CA9DA,SA8DA,CAAA,CAAA,CAAA;EAAgC;EAMrD,OAAA,EAAA,EAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EAAA,MAAA,CAAA,EAlEyB,OAkEzB,CAAA,IAAA,CAAA;EAAe;;;;;;EAlCiB,UAAA,EAAA,KAAA,EAxBrC,cAwBq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B,gCAAgC;;;;;;;;8BAQnC;;;UAIb,iBAAA;;;;;;oBAMG;;;;;;;;UASH,mBAAA,SAA4B;mBAC1B;;;;UAKF,iBAAA;;;;;;;;;;UAWA,sBAAA;;;;;;;;;;;;;;;;;;;;;;;;UAyBA,mBAAA;;sBAEK,uBAAqB,oBAAoB;;yDAEN,aAAa;;sBAG3D;;;MAEN,QAAQ,cAAc;;;;;;;;qCAShB,yCAEN,QAAQ;;mBAEM,6BAA2B,QAAQ;;0BAE5B,6BAA2B;;uBAG1C,kEAIN;;uBAEkB,8CAA4C;;oBAGxD;;MAEN,QAAQ,cAAc;;sBAGhB,6BACM,8BACN,yBACN,QAAQ,cAAc;;;;;;;;;;;;;;UAeV,kBAAA,SACP,KAAK;oBACK;qBACC;qBACA,yBAAyB,QAAQ;uBAC/B;;;;;;;;uBAQA;;;;;;;;0BAQG;;;;;;;;sBAQJ;;;;;;;;mBAQH"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { EmbeddingMetaRegistryLike } from "../internal/storage-adapter.js";
|
|
2
|
+
import { EmbedderProvider } from "@graphorin/core";
|
|
3
|
+
|
|
4
|
+
//#region src/migration/embedder-migration.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Coexistence policy for embedder swaps.
|
|
8
|
+
*
|
|
9
|
+
* - `'lock-on-first'` (default) — refuses to register a second active
|
|
10
|
+
* embedder; surfaces an actionable error pointing at the planned
|
|
11
|
+
* migration runner.
|
|
12
|
+
* - `'multi-active'` — keeps both embedders alive (read union, write
|
|
13
|
+
* to active); used while a long migration is in flight.
|
|
14
|
+
* - `'auto-migrate'` — re-embeds existing rows in resumable batches
|
|
15
|
+
* until the source embedder has zero rows, then retires it.
|
|
16
|
+
*
|
|
17
|
+
* @stable
|
|
18
|
+
*/
|
|
19
|
+
type EmbedderMigrationStrategy = 'lock-on-first' | 'multi-active' | 'auto-migrate';
|
|
20
|
+
/**
|
|
21
|
+
* Per-iteration progress snapshot yielded by {@link migrateEmbedder}.
|
|
22
|
+
*
|
|
23
|
+
* @stable
|
|
24
|
+
*/
|
|
25
|
+
interface MigrationProgress {
|
|
26
|
+
/** `'fact'`, `'episode'`, or `'message'` — which entity is being migrated. */
|
|
27
|
+
readonly kind: 'fact' | 'episode' | 'message';
|
|
28
|
+
/** Number of records processed so far. */
|
|
29
|
+
readonly processed: number;
|
|
30
|
+
/** Total records expected for this entity (when known). */
|
|
31
|
+
readonly total: number;
|
|
32
|
+
/** Identifier of the source embedder (`'<adapter>:<model>@<dim>'`). */
|
|
33
|
+
readonly source: string;
|
|
34
|
+
/** Identifier of the target embedder. */
|
|
35
|
+
readonly target: string;
|
|
36
|
+
/**
|
|
37
|
+
* Identifier for this migration run. MST-12: this is an in-memory id for
|
|
38
|
+
* the current run — there is no persisted `migration_state` cursor today, so
|
|
39
|
+
* a migration does not resume across processes.
|
|
40
|
+
*/
|
|
41
|
+
readonly migrationId: string;
|
|
42
|
+
/** Phase discriminator. */
|
|
43
|
+
readonly phase: 'planning' | 'running' | 'paused' | 'committed' | 'aborted';
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Options accepted by {@link migrateEmbedder}.
|
|
47
|
+
*
|
|
48
|
+
* @stable
|
|
49
|
+
*/
|
|
50
|
+
interface MigrateEmbedderOptions {
|
|
51
|
+
/** Source embedder (currently active). */
|
|
52
|
+
readonly source: EmbedderProvider;
|
|
53
|
+
/** Target embedder (becomes active when migration commits). */
|
|
54
|
+
readonly target: EmbedderProvider;
|
|
55
|
+
/** Storage layer's embedder registry. */
|
|
56
|
+
readonly embeddings: EmbeddingMetaRegistryLike;
|
|
57
|
+
/** Strategy applied per `embedding_meta` row. Default `'lock-on-first'`. */
|
|
58
|
+
readonly strategy?: EmbedderMigrationStrategy;
|
|
59
|
+
/**
|
|
60
|
+
* Threshold for `auto-migrate`. The runner streams source rows in
|
|
61
|
+
* batches of `batchSize` (default `512`) and yields progress after
|
|
62
|
+
* each batch.
|
|
63
|
+
*/
|
|
64
|
+
readonly batchSize?: number;
|
|
65
|
+
/** Optional cap on the number of rows to migrate per kind. */
|
|
66
|
+
readonly maxRecordsPerKind?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Hook that returns the next batch of rows to re-embed for a given kind.
|
|
69
|
+
* MST-12: this is **caller-supplied** — there is no store-side helper that
|
|
70
|
+
* auto-wires it today, and `auto-migrate` throws without it. Pass a paging
|
|
71
|
+
* function over your source rows to drive the migration.
|
|
72
|
+
*/
|
|
73
|
+
readonly nextBatch?: NextBatchHook;
|
|
74
|
+
/** Optional abort signal — aborting yields one final progress event. */
|
|
75
|
+
readonly signal?: AbortSignal;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Per-batch loader. Returns up to `batchSize` rows for the supplied
|
|
79
|
+
* `kind` whose `embedder_id` is the source embedder. Returning an
|
|
80
|
+
* empty array signals end-of-stream.
|
|
81
|
+
*
|
|
82
|
+
* @stable
|
|
83
|
+
*/
|
|
84
|
+
type NextBatchHook = (args: {
|
|
85
|
+
readonly kind: 'fact' | 'episode' | 'message';
|
|
86
|
+
readonly source: string;
|
|
87
|
+
readonly target: string;
|
|
88
|
+
readonly batchSize: number;
|
|
89
|
+
readonly cursor: string | null;
|
|
90
|
+
}) => Promise<{
|
|
91
|
+
readonly rows: ReadonlyArray<MigrationRow>;
|
|
92
|
+
readonly nextCursor: string | null;
|
|
93
|
+
}>;
|
|
94
|
+
/**
|
|
95
|
+
* Single row exposed to the migration runner. The runner re-embeds
|
|
96
|
+
* `text` with the target embedder; the storage adapter is responsible
|
|
97
|
+
* for committing the new vector + updating `embedder_id`.
|
|
98
|
+
*
|
|
99
|
+
* @stable
|
|
100
|
+
*/
|
|
101
|
+
interface MigrationRow {
|
|
102
|
+
readonly id: string;
|
|
103
|
+
readonly text: string;
|
|
104
|
+
readonly write: (vector: Float32Array) => Promise<void>;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Stream embedder migrations as `AsyncIterable<MigrationProgress>`.
|
|
108
|
+
*
|
|
109
|
+
* The function is the universal entry point for every migration
|
|
110
|
+
* strategy:
|
|
111
|
+
*
|
|
112
|
+
* - `'lock-on-first'`: surfaces the locked error eagerly so the
|
|
113
|
+
* operator can act before any work happens.
|
|
114
|
+
* - `'multi-active'`: registers the target alongside the source and
|
|
115
|
+
* yields a single `'committed'` progress event.
|
|
116
|
+
* - `'auto-migrate'`: streams batches until the source is fully
|
|
117
|
+
* drained, then retires the source row.
|
|
118
|
+
*
|
|
119
|
+
* @stable
|
|
120
|
+
*/
|
|
121
|
+
declare function migrateEmbedder(options: MigrateEmbedderOptions): AsyncGenerator<MigrationProgress, void, unknown>;
|
|
122
|
+
//#endregion
|
|
123
|
+
export { EmbedderMigrationStrategy, MigrateEmbedderOptions, MigrationProgress, migrateEmbedder };
|
|
124
|
+
//# sourceMappingURL=embedder-migration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedder-migration.d.ts","names":[],"sources":["../../src/migration/embedder-migration.ts"],"sourcesContent":[],"mappings":";;;;;;;AAsBA;AAOA;AA0BA;;;;;;;;AAmCA;AAM6C,KA1EjC,yBAAA,GA0EiC,eAAA,GAAA,cAAA,GAAA,cAAA;;;;AAS7C;AAqBA;AACW,UAlGM,iBAAA,CAkGN;EACO;EAAf,SAAA,IAAA,EAAA,MAAA,GAAA,SAAA,GAAA,SAAA;EAAc;;;;;;;;;;;;;;;;;;;;;;UAzEA,sBAAA;;mBAEE;;mBAEA;;uBAEI;;sBAED;;;;;;;;;;;;;;;uBAeC;;oBAEH;;;;;;;;;KAUR,aAAA;;;;;;MAMN;iBAAyB,cAAc;;;;;;;;;;UAS5B,YAAA;;;2BAGU,iBAAiB;;;;;;;;;;;;;;;;;iBAkBrB,eAAA,UACZ,yBACR,eAAe"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { EmbedderMigrationAbortedError, EmbedderMigrationLockedError, EmbedderMigrationStateError } from "../errors/index.js";
|
|
2
|
+
import { bindEmbedder } from "../internal/embedder-binding.js";
|
|
3
|
+
|
|
4
|
+
//#region src/migration/embedder-migration.ts
|
|
5
|
+
/**
|
|
6
|
+
* Stream embedder migrations as `AsyncIterable<MigrationProgress>`.
|
|
7
|
+
*
|
|
8
|
+
* The function is the universal entry point for every migration
|
|
9
|
+
* strategy:
|
|
10
|
+
*
|
|
11
|
+
* - `'lock-on-first'`: surfaces the locked error eagerly so the
|
|
12
|
+
* operator can act before any work happens.
|
|
13
|
+
* - `'multi-active'`: registers the target alongside the source and
|
|
14
|
+
* yields a single `'committed'` progress event.
|
|
15
|
+
* - `'auto-migrate'`: streams batches until the source is fully
|
|
16
|
+
* drained, then retires the source row.
|
|
17
|
+
*
|
|
18
|
+
* @stable
|
|
19
|
+
*/
|
|
20
|
+
async function* migrateEmbedder(options) {
|
|
21
|
+
const { source, target, embeddings } = options;
|
|
22
|
+
const strategy = options.strategy ?? "lock-on-first";
|
|
23
|
+
const sourceId = source.id();
|
|
24
|
+
const targetId = target.id();
|
|
25
|
+
const migrationId = `migration_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 7)}`;
|
|
26
|
+
if (sourceId === targetId) throw new EmbedderMigrationStateError(`source and target embedders must differ; both resolved to '${sourceId}'.`);
|
|
27
|
+
if (embeddings.get(sourceId) === null) throw new EmbedderMigrationStateError(`source embedder '${sourceId}' is not registered. Run createMemory({ embedder: source }) first.`);
|
|
28
|
+
if (strategy === "lock-on-first") throw new EmbedderMigrationLockedError(sourceId, targetId);
|
|
29
|
+
bindEmbedder(target, embeddings);
|
|
30
|
+
if (strategy === "multi-active") {
|
|
31
|
+
yield {
|
|
32
|
+
kind: "fact",
|
|
33
|
+
processed: 0,
|
|
34
|
+
total: 0,
|
|
35
|
+
source: sourceId,
|
|
36
|
+
target: targetId,
|
|
37
|
+
migrationId,
|
|
38
|
+
phase: "committed"
|
|
39
|
+
};
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (options.nextBatch === void 0) throw new EmbedderMigrationStateError("'auto-migrate' requires a `nextBatch` hook supplied by the storage adapter.");
|
|
43
|
+
const batchSize = options.batchSize ?? 512;
|
|
44
|
+
const cap = options.maxRecordsPerKind ?? Number.POSITIVE_INFINITY;
|
|
45
|
+
for (const kind of [
|
|
46
|
+
"fact",
|
|
47
|
+
"episode",
|
|
48
|
+
"message"
|
|
49
|
+
]) {
|
|
50
|
+
let cursor = null;
|
|
51
|
+
let processed = 0;
|
|
52
|
+
while (processed < cap) {
|
|
53
|
+
if (options.signal?.aborted === true) {
|
|
54
|
+
yield {
|
|
55
|
+
kind,
|
|
56
|
+
processed,
|
|
57
|
+
total: processed,
|
|
58
|
+
source: sourceId,
|
|
59
|
+
target: targetId,
|
|
60
|
+
migrationId,
|
|
61
|
+
phase: "aborted"
|
|
62
|
+
};
|
|
63
|
+
throw new EmbedderMigrationAbortedError(migrationId);
|
|
64
|
+
}
|
|
65
|
+
const batch = await options.nextBatch({
|
|
66
|
+
kind,
|
|
67
|
+
source: sourceId,
|
|
68
|
+
target: targetId,
|
|
69
|
+
batchSize,
|
|
70
|
+
cursor
|
|
71
|
+
});
|
|
72
|
+
if (batch.rows.length === 0) break;
|
|
73
|
+
const texts = batch.rows.map((r) => r.text);
|
|
74
|
+
const vectors = await target.embed(texts, { ...options.signal !== void 0 ? { signal: options.signal } : {} });
|
|
75
|
+
for (let i = 0; i < batch.rows.length; i++) {
|
|
76
|
+
const row = batch.rows[i];
|
|
77
|
+
const vector = vectors[i];
|
|
78
|
+
if (row === void 0 || vector === void 0) continue;
|
|
79
|
+
await row.write(vector);
|
|
80
|
+
}
|
|
81
|
+
processed += batch.rows.length;
|
|
82
|
+
cursor = batch.nextCursor;
|
|
83
|
+
yield {
|
|
84
|
+
kind,
|
|
85
|
+
processed,
|
|
86
|
+
total: processed,
|
|
87
|
+
source: sourceId,
|
|
88
|
+
target: targetId,
|
|
89
|
+
migrationId,
|
|
90
|
+
phase: "running"
|
|
91
|
+
};
|
|
92
|
+
if (cursor === null) break;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
embeddings.retire(sourceId);
|
|
96
|
+
yield {
|
|
97
|
+
kind: "fact",
|
|
98
|
+
processed: 0,
|
|
99
|
+
total: 0,
|
|
100
|
+
source: sourceId,
|
|
101
|
+
target: targetId,
|
|
102
|
+
migrationId,
|
|
103
|
+
phase: "committed"
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
//#endregion
|
|
108
|
+
export { migrateEmbedder };
|
|
109
|
+
//# sourceMappingURL=embedder-migration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedder-migration.js","names":["cursor: string | null"],"sources":["../../src/migration/embedder-migration.ts"],"sourcesContent":["import type { EmbedderProvider } from '@graphorin/core';\nimport {\n EmbedderMigrationAbortedError,\n EmbedderMigrationLockedError,\n EmbedderMigrationStateError,\n} from '../errors/index.js';\nimport { bindEmbedder } from '../internal/embedder-binding.js';\nimport type { EmbeddingMetaRegistryLike } from '../internal/storage-adapter.js';\n\n/**\n * Coexistence policy for embedder swaps.\n *\n * - `'lock-on-first'` (default) — refuses to register a second active\n * embedder; surfaces an actionable error pointing at the planned\n * migration runner.\n * - `'multi-active'` — keeps both embedders alive (read union, write\n * to active); used while a long migration is in flight.\n * - `'auto-migrate'` — re-embeds existing rows in resumable batches\n * until the source embedder has zero rows, then retires it.\n *\n * @stable\n */\nexport type EmbedderMigrationStrategy = 'lock-on-first' | 'multi-active' | 'auto-migrate';\n\n/**\n * Per-iteration progress snapshot yielded by {@link migrateEmbedder}.\n *\n * @stable\n */\nexport interface MigrationProgress {\n /** `'fact'`, `'episode'`, or `'message'` — which entity is being migrated. */\n readonly kind: 'fact' | 'episode' | 'message';\n /** Number of records processed so far. */\n readonly processed: number;\n /** Total records expected for this entity (when known). */\n readonly total: number;\n /** Identifier of the source embedder (`'<adapter>:<model>@<dim>'`). */\n readonly source: string;\n /** Identifier of the target embedder. */\n readonly target: string;\n /**\n * Identifier for this migration run. MST-12: this is an in-memory id for\n * the current run — there is no persisted `migration_state` cursor today, so\n * a migration does not resume across processes.\n */\n readonly migrationId: string;\n /** Phase discriminator. */\n readonly phase: 'planning' | 'running' | 'paused' | 'committed' | 'aborted';\n}\n\n/**\n * Options accepted by {@link migrateEmbedder}.\n *\n * @stable\n */\nexport interface MigrateEmbedderOptions {\n /** Source embedder (currently active). */\n readonly source: EmbedderProvider;\n /** Target embedder (becomes active when migration commits). */\n readonly target: EmbedderProvider;\n /** Storage layer's embedder registry. */\n readonly embeddings: EmbeddingMetaRegistryLike;\n /** Strategy applied per `embedding_meta` row. Default `'lock-on-first'`. */\n readonly strategy?: EmbedderMigrationStrategy;\n /**\n * Threshold for `auto-migrate`. The runner streams source rows in\n * batches of `batchSize` (default `512`) and yields progress after\n * each batch.\n */\n readonly batchSize?: number;\n /** Optional cap on the number of rows to migrate per kind. */\n readonly maxRecordsPerKind?: number;\n /**\n * Hook that returns the next batch of rows to re-embed for a given kind.\n * MST-12: this is **caller-supplied** — there is no store-side helper that\n * auto-wires it today, and `auto-migrate` throws without it. Pass a paging\n * function over your source rows to drive the migration.\n */\n readonly nextBatch?: NextBatchHook;\n /** Optional abort signal — aborting yields one final progress event. */\n readonly signal?: AbortSignal;\n}\n\n/**\n * Per-batch loader. Returns up to `batchSize` rows for the supplied\n * `kind` whose `embedder_id` is the source embedder. Returning an\n * empty array signals end-of-stream.\n *\n * @stable\n */\nexport type NextBatchHook = (args: {\n readonly kind: 'fact' | 'episode' | 'message';\n readonly source: string;\n readonly target: string;\n readonly batchSize: number;\n readonly cursor: string | null;\n}) => Promise<{ readonly rows: ReadonlyArray<MigrationRow>; readonly nextCursor: string | null }>;\n\n/**\n * Single row exposed to the migration runner. The runner re-embeds\n * `text` with the target embedder; the storage adapter is responsible\n * for committing the new vector + updating `embedder_id`.\n *\n * @stable\n */\nexport interface MigrationRow {\n readonly id: string;\n readonly text: string;\n readonly write: (vector: Float32Array) => Promise<void>;\n}\n\n/**\n * Stream embedder migrations as `AsyncIterable<MigrationProgress>`.\n *\n * The function is the universal entry point for every migration\n * strategy:\n *\n * - `'lock-on-first'`: surfaces the locked error eagerly so the\n * operator can act before any work happens.\n * - `'multi-active'`: registers the target alongside the source and\n * yields a single `'committed'` progress event.\n * - `'auto-migrate'`: streams batches until the source is fully\n * drained, then retires the source row.\n *\n * @stable\n */\nexport async function* migrateEmbedder(\n options: MigrateEmbedderOptions,\n): AsyncGenerator<MigrationProgress, void, unknown> {\n const { source, target, embeddings } = options;\n const strategy = options.strategy ?? 'lock-on-first';\n const sourceId = source.id();\n const targetId = target.id();\n const migrationId = `migration_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 7)}`;\n\n if (sourceId === targetId) {\n throw new EmbedderMigrationStateError(\n `source and target embedders must differ; both resolved to '${sourceId}'.`,\n );\n }\n\n const sourceMeta = embeddings.get(sourceId);\n if (sourceMeta === null) {\n throw new EmbedderMigrationStateError(\n `source embedder '${sourceId}' is not registered. Run createMemory({ embedder: source }) first.`,\n );\n }\n\n if (strategy === 'lock-on-first') {\n throw new EmbedderMigrationLockedError(sourceId, targetId);\n }\n\n bindEmbedder(target, embeddings);\n\n if (strategy === 'multi-active') {\n yield {\n kind: 'fact',\n processed: 0,\n total: 0,\n source: sourceId,\n target: targetId,\n migrationId,\n phase: 'committed',\n };\n return;\n }\n\n // strategy === 'auto-migrate'\n if (options.nextBatch === undefined) {\n throw new EmbedderMigrationStateError(\n \"'auto-migrate' requires a `nextBatch` hook supplied by the storage adapter.\",\n );\n }\n\n const batchSize = options.batchSize ?? 512;\n const cap = options.maxRecordsPerKind ?? Number.POSITIVE_INFINITY;\n\n for (const kind of ['fact', 'episode', 'message'] as const) {\n let cursor: string | null = null;\n let processed = 0;\n while (processed < cap) {\n if (options.signal?.aborted === true) {\n yield {\n kind,\n processed,\n total: processed,\n source: sourceId,\n target: targetId,\n migrationId,\n phase: 'aborted',\n };\n throw new EmbedderMigrationAbortedError(migrationId);\n }\n const batch = await options.nextBatch({\n kind,\n source: sourceId,\n target: targetId,\n batchSize,\n cursor,\n });\n if (batch.rows.length === 0) break;\n const texts = batch.rows.map((r) => r.text);\n const vectors = await target.embed(texts, {\n ...(options.signal !== undefined ? { signal: options.signal } : {}),\n });\n for (let i = 0; i < batch.rows.length; i++) {\n const row = batch.rows[i];\n const vector = vectors[i];\n if (row === undefined || vector === undefined) continue;\n await row.write(vector);\n }\n processed += batch.rows.length;\n cursor = batch.nextCursor;\n yield {\n kind,\n processed,\n total: processed,\n source: sourceId,\n target: targetId,\n migrationId,\n phase: 'running',\n };\n if (cursor === null) break;\n }\n }\n\n embeddings.retire(sourceId);\n yield {\n kind: 'fact',\n processed: 0,\n total: 0,\n source: sourceId,\n target: targetId,\n migrationId,\n phase: 'committed',\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8HA,gBAAuB,gBACrB,SACkD;CAClD,MAAM,EAAE,QAAQ,QAAQ,eAAe;CACvC,MAAM,WAAW,QAAQ,YAAY;CACrC,MAAM,WAAW,OAAO,IAAI;CAC5B,MAAM,WAAW,OAAO,IAAI;CAC5B,MAAM,cAAc,aAAa,KAAK,KAAK,CAAC,SAAS,GAAG,CAAC,GAAG,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE;AAElG,KAAI,aAAa,SACf,OAAM,IAAI,4BACR,8DAA8D,SAAS,IACxE;AAIH,KADmB,WAAW,IAAI,SAAS,KACxB,KACjB,OAAM,IAAI,4BACR,oBAAoB,SAAS,oEAC9B;AAGH,KAAI,aAAa,gBACf,OAAM,IAAI,6BAA6B,UAAU,SAAS;AAG5D,cAAa,QAAQ,WAAW;AAEhC,KAAI,aAAa,gBAAgB;AAC/B,QAAM;GACJ,MAAM;GACN,WAAW;GACX,OAAO;GACP,QAAQ;GACR,QAAQ;GACR;GACA,OAAO;GACR;AACD;;AAIF,KAAI,QAAQ,cAAc,OACxB,OAAM,IAAI,4BACR,8EACD;CAGH,MAA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
5
|
+
/**
|
|
6
|
+
* Per-memory contribution breakdown for one recalled record: the
|
|
7
|
+
* decomposed signals the hybrid pipeline summed into the final score,
|
|
8
|
+
* plus the record's final rank. Surfaces *why* a single memory was
|
|
9
|
+
* recalled and how it ranked relative to its siblings.
|
|
10
|
+
*
|
|
11
|
+
* @stable
|
|
12
|
+
*/
|
|
13
|
+
interface RecalledMemoryExplanation {
|
|
14
|
+
/** Record id (fact / episode / insight / …). */
|
|
15
|
+
readonly id: string;
|
|
16
|
+
/** Memory kind of the recalled record. */
|
|
17
|
+
readonly kind: MemoryKind;
|
|
18
|
+
/** 1-based position in the final fused + decayed ranking. */
|
|
19
|
+
readonly rank: number;
|
|
20
|
+
/** Final score after fusion and (optional) decay. */
|
|
21
|
+
readonly score: number;
|
|
22
|
+
/**
|
|
23
|
+
* Raw per-signal scores contributing to `score`, exactly as the
|
|
24
|
+
* pipeline recorded them on the hit: FTS (`bm25`), vector similarity
|
|
25
|
+
* (`vector`), the fused reciprocal-rank terms (`rrf` + per-list
|
|
26
|
+
* `rrf.list_N`), and the decay multiplier (`decay`) when decay ran.
|
|
27
|
+
*/
|
|
28
|
+
readonly signals: Readonly<Record<string, number>>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Structured "why was this recalled?" explanation for one
|
|
32
|
+
* {@link SemanticMemory.search} call: the query, the reranker that
|
|
33
|
+
* fused the candidate lists, and the per-memory signal breakdown in
|
|
34
|
+
* final-rank order. Pure data — safe to attach to a span, log, or
|
|
35
|
+
* render. X-3.
|
|
36
|
+
*
|
|
37
|
+
* @stable
|
|
38
|
+
*/
|
|
39
|
+
interface RecallExplanation {
|
|
40
|
+
/** The query the recall ran for. */
|
|
41
|
+
readonly query: string;
|
|
42
|
+
/** Stable id of the reranker that fused the candidate lists. */
|
|
43
|
+
readonly rerankerId: string;
|
|
44
|
+
/** Number of recalled memories explained. */
|
|
45
|
+
readonly count: number;
|
|
46
|
+
/** Per-memory breakdown, in final-rank order (rank 1 first). */
|
|
47
|
+
readonly results: ReadonlyArray<RecalledMemoryExplanation>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Build a {@link RecallExplanation} from a ranked hit list. Pure and
|
|
51
|
+
* deterministic: it surfaces whatever per-signal scores the hybrid
|
|
52
|
+
* pipeline left on each {@link MemoryHit.signals} (FTS, vector, RRF,
|
|
53
|
+
* decay, future graph-hop terms) without re-deriving them, so the
|
|
54
|
+
* explanation always matches what actually drove the ranking. Hits are
|
|
55
|
+
* assumed to be in final-rank order (as returned by `search`).
|
|
56
|
+
*
|
|
57
|
+
* @stable
|
|
58
|
+
*/
|
|
59
|
+
declare function explainRecall<TRecord extends MemoryRecord>(hits: ReadonlyArray<MemoryHit<TRecord>>, opts: {
|
|
60
|
+
readonly query: string;
|
|
61
|
+
readonly rerankerId: string;
|
|
62
|
+
}): RecallExplanation;
|
|
63
|
+
/**
|
|
64
|
+
* Render a {@link RecallExplanation} as a compact ASCII block — a
|
|
65
|
+
* header line plus one line per recalled memory with its signal
|
|
66
|
+
* breakdown. Pure (returns a string, no I/O); used by operator tooling
|
|
67
|
+
* and trace inspectors.
|
|
68
|
+
*
|
|
69
|
+
* @stable
|
|
70
|
+
*/
|
|
71
|
+
declare function formatRecallExplanation(explanation: RecallExplanation): string;
|
|
72
|
+
//#endregion
|
|
73
|
+
export { RecallExplanation, RecalledMemoryExplanation, explainRecall, formatRecallExplanation };
|
|
74
|
+
//# sourceMappingURL=explain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explain.d.ts","names":[],"sources":["../../src/search/explain.ts"],"sourcesContent":[],"mappings":";;;;AAwGA;;;;;;;;UA9EiB,yBAAA;;;;iBAIA;;;;;;;;;;;oBAWG,SAAS;;;;;;;;;;;UAYZ,iBAAA;;;;;;;;oBAQG,cAAc;;;;;;;;;;;;iBAalB,8BAA8B,oBACtC,cAAc,UAAU;;;IAE7B;;;;;;;;;iBA2Ba,uBAAA,cAAqC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//#region src/search/explain.ts
|
|
2
|
+
/**
|
|
3
|
+
* Build a {@link RecallExplanation} from a ranked hit list. Pure and
|
|
4
|
+
* deterministic: it surfaces whatever per-signal scores the hybrid
|
|
5
|
+
* pipeline left on each {@link MemoryHit.signals} (FTS, vector, RRF,
|
|
6
|
+
* decay, future graph-hop terms) without re-deriving them, so the
|
|
7
|
+
* explanation always matches what actually drove the ranking. Hits are
|
|
8
|
+
* assumed to be in final-rank order (as returned by `search`).
|
|
9
|
+
*
|
|
10
|
+
* @stable
|
|
11
|
+
*/
|
|
12
|
+
function explainRecall(hits, opts) {
|
|
13
|
+
const results = hits.map((hit, idx) => Object.freeze({
|
|
14
|
+
id: hit.record.id,
|
|
15
|
+
kind: hit.record.kind,
|
|
16
|
+
rank: idx + 1,
|
|
17
|
+
score: hit.score,
|
|
18
|
+
signals: Object.freeze({ ...hit.signals ?? {} })
|
|
19
|
+
}));
|
|
20
|
+
return Object.freeze({
|
|
21
|
+
query: opts.query,
|
|
22
|
+
rerankerId: opts.rerankerId,
|
|
23
|
+
count: results.length,
|
|
24
|
+
results: Object.freeze(results)
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Render a {@link RecallExplanation} as a compact ASCII block — a
|
|
29
|
+
* header line plus one line per recalled memory with its signal
|
|
30
|
+
* breakdown. Pure (returns a string, no I/O); used by operator tooling
|
|
31
|
+
* and trace inspectors.
|
|
32
|
+
*
|
|
33
|
+
* @stable
|
|
34
|
+
*/
|
|
35
|
+
function formatRecallExplanation(explanation) {
|
|
36
|
+
const header = `recall ${JSON.stringify(explanation.query)} via ${explanation.rerankerId} -> ${explanation.count} result(s)`;
|
|
37
|
+
if (explanation.results.length === 0) return header;
|
|
38
|
+
return [header, ...explanation.results.map((r) => {
|
|
39
|
+
const signals = Object.entries(r.signals).map(([key, value]) => `${key}=${formatScore(value)}`).join(" ");
|
|
40
|
+
const suffix = signals === "" ? "" : ` (${signals})`;
|
|
41
|
+
return ` #${r.rank} ${r.id} [${r.kind}] score=${formatScore(r.score)}${suffix}`;
|
|
42
|
+
})].join("\n");
|
|
43
|
+
}
|
|
44
|
+
function formatScore(value) {
|
|
45
|
+
return Number.isFinite(value) ? value.toFixed(4) : String(value);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { explainRecall, formatRecallExplanation };
|
|
50
|
+
//# sourceMappingURL=explain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explain.js","names":[],"sources":["../../src/search/explain.ts"],"sourcesContent":["/**\n * Recall explainability for `@graphorin/memory` — \"why was this\n * recalled?\" (X-3). Turns the per-signal scores the hybrid pipeline\n * already records on each {@link MemoryHit} (FTS `bm25`, vector\n * similarity, the fused reciprocal-rank term, the decay multiplier,\n * future graph-hop terms) into a structured, renderable explanation.\n *\n * Pure data: the builder re-uses whatever {@link MemoryHit.signals} the\n * pipeline left behind rather than re-deriving them, so the explanation\n * always matches the ranking that actually happened. The renderer\n * returns a string and performs no I/O, so the explanation can be\n * attached to a span, logged, or surfaced by operator tooling.\n *\n * @packageDocumentation\n */\n\nimport type { MemoryHit, MemoryKind, MemoryRecord } from '@graphorin/core';\n\n/**\n * Per-memory contribution breakdown for one recalled record: the\n * decomposed signals the hybrid pipeline summed into the final score,\n * plus the record's final rank. Surfaces *why* a single memory was\n * recalled and how it ranked relative to its siblings.\n *\n * @stable\n */\nexport interface RecalledMemoryExplanation {\n /** Record id (fact / episode / insight / …). */\n readonly id: string;\n /** Memory kind of the recalled record. */\n readonly kind: MemoryKind;\n /** 1-based position in the final fused + decayed ranking. */\n readonly rank: number;\n /** Final score after fusion and (optional) decay. */\n readonly score: number;\n /**\n * Raw per-signal scores contributing to `score`, exactly as the\n * pipeline recorded them on the hit: FTS (`bm25`), vector similarity\n * (`vector`), the fused reciprocal-rank terms (`rrf` + per-list\n * `rrf.list_N`), and the decay multiplier (`decay`) when decay ran.\n */\n readonly signals: Readonly<Record<string, number>>;\n}\n\n/**\n * Structured \"why was this recalled?\" explanation for one\n * {@link SemanticMemory.search} call: the query, the reranker that\n * fused the candidate lists, and the per-memory signal breakdown in\n * final-rank order. Pure data — safe to attach to a span, log, or\n * render. X-3.\n *\n * @stable\n */\nexport interface RecallExplanation {\n /** The query the recall ran for. */\n readonly query: string;\n /** Stable id of the reranker that fused the candidate lists. */\n readonly rerankerId: string;\n /** Number of recalled memories explained. */\n readonly count: number;\n /** Per-memory breakdown, in final-rank order (rank 1 first). */\n readonly results: ReadonlyArray<RecalledMemoryExplanation>;\n}\n\n/**\n * Build a {@link RecallExplanation} from a ranked hit list. Pure and\n * deterministic: it surfaces whatever per-signal scores the hybrid\n * pipeline left on each {@link MemoryHit.signals} (FTS, vector, RRF,\n * decay, future graph-hop terms) without re-deriving them, so the\n * explanation always matches what actually drove the ranking. Hits are\n * assumed to be in final-rank order (as returned by `search`).\n *\n * @stable\n */\nexport function explainRecall<TRecord extends MemoryRecord>(\n hits: ReadonlyArray<MemoryHit<TRecord>>,\n opts: { readonly query: string; readonly rerankerId: string },\n): RecallExplanation {\n const results = hits.map(\n (hit, idx): RecalledMemoryExplanation =>\n Object.freeze({\n id: hit.record.id,\n kind: hit.record.kind,\n rank: idx + 1,\n score: hit.score,\n signals: Object.freeze({ ...(hit.signals ?? {}) }),\n }),\n );\n return Object.freeze({\n query: opts.query,\n rerankerId: opts.rerankerId,\n count: results.length,\n results: Object.freeze(results),\n });\n}\n\n/**\n * Render a {@link RecallExplanation} as a compact ASCII block — a\n * header line plus one line per recalled memory with its signal\n * breakdown. Pure (returns a string, no I/O); used by operator tooling\n * and trace inspectors.\n *\n * @stable\n */\nexport function formatRecallExplanation(explanation: RecallExplanation): string {\n const header = `recall ${JSON.stringify(explanation.query)} via ${explanation.rerankerId} -> ${explanation.count} result(s)`;\n if (explanation.results.length === 0) return header;\n const lines = explanation.results.map((r) => {\n const signals = Object.entries(r.signals)\n .map(([key, value]) => `${key}=${formatScore(value)}`)\n .join(' ');\n const suffix = signals === '' ? '' : ` (${signals})`;\n return ` #${r.rank} ${r.id} [${r.kind}] score=${formatScore(r.score)}${suffix}`;\n });\n return [header, ...lines].join('\\n');\n}\n\nfunction formatScore(value: number): string {\n return Number.isFinite(value) ? value.toFixed(4) : String(value);\n}\n"],"mappings":";;;;;;;;;;;AA0EA,SAAgB,cACd,MACA,MACmB;CACnB,MAAM,UAAU,KAAK,KAClB,KAAK,QACJ,OAAO,OAAO;EACZ,IAAI,IAAI,OAAO;EACf,MAAM,IAAI,OAAO;EACjB,MAAM,MAAM;EACZ,OAAO,IAAI;EACX,SAAS,OAAO,OAAO,EAAE,GAAI,IAAI,WAAW,EAAE,EAAG,CAAC;EACnD,CAAC,CACL;AACD,QAAO,OAAO,OAAO;EACnB,OAAO,KAAK;EACZ,YAAY,KAAK;EACjB,OAAO,QAAQ;EACf,SAAS,OAAO,OAAO,QAAQ;EAChC,CAAC;;;;;;;;;;AAWJ,SAAgB,wBAAwB,aAAwC;CAC9E,MAAM,SAAS,UAAU,KAAK,UAAU,YAAY,MAAM,CAAC,OAAO,YAAY,WAAW,MAAM,YAAY,MAAM;AACjH,KAAI,YAAY,QAAQ,WAAW,EAAG,QAAO;AAQ7C,QAAO,CAAC,QAAQ,GAPF,YAAY,QAAQ,KAAK,MAAM;EAC3C,MAAM,UAAU,OAAO,QAAQ,EAAE,QAAQ,CACtC,KAAK,CAAC,KAAK,WAAW,GAAG,IAAI,GAAG,YAAY,MAAM,GAAG,CACrD,KAAK,IAAI;EACZ,MAAM,SAAS,YAAY,KAAK,KAAK,KAAK,QAAQ;AAClD,SAAO,MAAM,EAAE,KAAK,GAAG,EAAE,GAAG,IAAI,EAAE,KAAK,UAAU,YAAY,EAAE,MAAM,GAAG;GACxE,CACuB,CAAC,KAAK,KAAK;;AAGtC,SAAS,YAAY,OAAuB;AAC1C,QAAO,OAAO,SAAS,MAAM,GAAG,MAAM,QAAQ,EAAE,GAAG,OAAO,MAAM"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DEFAULT_DIFFICULTY_THRESHOLD, DEFAULT_MAX_ITERATIONS, DifficultyAssessment, DifficultyGateOptions, IterativeRetrievalDeps, IterativeRetrievalOptions, IterativeRetrievalResult, MAX_ITERATIONS_CEILING, RETRIEVAL_GRADE_SYSTEM_PROMPT, RetrievalGrade, RetrievalGradeOptions, RetrievalGrader, assessQueryDifficulty, buildGradeRequest, createProviderRetrievalGrader, parseGrade, runIterativeRetrieval } from "./iterative.js";
|
|
2
|
+
import { DEFAULT_MAX_QUERY_VARIANTS, HYDE_SYSTEM_PROMPT, QUERY_EXPANSION_SYSTEM_PROMPT, QueryTransformOptions, QueryTransformer, buildExpansionRequest, buildHydeRequest, createProviderQueryTransformer, parseHypothetical, parseQueryVariants } from "./query-transform.js";
|
|
3
|
+
import { ReRankOptions, ReRanker } from "./types.js";
|
|
4
|
+
import { RecallExplanation, RecalledMemoryExplanation, explainRecall, formatRecallExplanation } from "./explain.js";
|
|
5
|
+
import { RRFReranker, RRF_DEFAULT_K, WeightedRRFReranker, fuseRrf, fuseWeighted } from "./rrf.js";
|
|
6
|
+
export { DEFAULT_DIFFICULTY_THRESHOLD, DEFAULT_MAX_ITERATIONS, DEFAULT_MAX_QUERY_VARIANTS, type DifficultyAssessment, type DifficultyGateOptions, HYDE_SYSTEM_PROMPT, type IterativeRetrievalDeps, type IterativeRetrievalOptions, type IterativeRetrievalResult, MAX_ITERATIONS_CEILING, QUERY_EXPANSION_SYSTEM_PROMPT, type QueryTransformOptions, type QueryTransformer, RETRIEVAL_GRADE_SYSTEM_PROMPT, RRFReranker, RRF_DEFAULT_K, type ReRankOptions, type ReRanker, type RecallExplanation, type RecalledMemoryExplanation, type RetrievalGrade, type RetrievalGradeOptions, type RetrievalGrader, WeightedRRFReranker, assessQueryDifficulty, buildExpansionRequest, buildGradeRequest, buildHydeRequest, createProviderQueryTransformer, createProviderRetrievalGrader, explainRecall, formatRecallExplanation, fuseRrf, fuseWeighted, parseGrade, parseHypothetical, parseQueryVariants, runIterativeRetrieval };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DEFAULT_DIFFICULTY_THRESHOLD, DEFAULT_MAX_ITERATIONS, MAX_ITERATIONS_CEILING, RETRIEVAL_GRADE_SYSTEM_PROMPT, assessQueryDifficulty, buildGradeRequest, createProviderRetrievalGrader, parseGrade, runIterativeRetrieval } from "./iterative.js";
|
|
2
|
+
import { DEFAULT_MAX_QUERY_VARIANTS, HYDE_SYSTEM_PROMPT, QUERY_EXPANSION_SYSTEM_PROMPT, buildExpansionRequest, buildHydeRequest, createProviderQueryTransformer, parseHypothetical, parseQueryVariants } from "./query-transform.js";
|
|
3
|
+
import { RRFReranker, RRF_DEFAULT_K, WeightedRRFReranker, fuseRrf, fuseWeighted } from "./rrf.js";
|
|
4
|
+
import { explainRecall, formatRecallExplanation } from "./explain.js";
|
|
5
|
+
|
|
6
|
+
export { DEFAULT_DIFFICULTY_THRESHOLD, DEFAULT_MAX_ITERATIONS, DEFAULT_MAX_QUERY_VARIANTS, HYDE_SYSTEM_PROMPT, MAX_ITERATIONS_CEILING, QUERY_EXPANSION_SYSTEM_PROMPT, RETRIEVAL_GRADE_SYSTEM_PROMPT, RRFReranker, RRF_DEFAULT_K, WeightedRRFReranker, assessQueryDifficulty, buildExpansionRequest, buildGradeRequest, buildHydeRequest, createProviderQueryTransformer, createProviderRetrievalGrader, explainRecall, formatRecallExplanation, fuseRrf, fuseWeighted, parseGrade, parseHypothetical, parseQueryVariants, runIterativeRetrieval };
|