@avantf/dsh-mem 0.4.1 → 0.6.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.
Files changed (52) hide show
  1. package/README.md +19 -1
  2. package/lib/client.js +40 -9
  3. package/lib/engine/mem/config/config_files.d.ts +1 -1
  4. package/lib/engine/mem/db/dao/chunks.d.ts +20 -1
  5. package/lib/engine/mem/db/dao/entities.d.ts +35 -11
  6. package/lib/engine/mem/db/dao/fact_sources.d.ts +53 -0
  7. package/lib/engine/mem/db/dao/facts.d.ts +127 -12
  8. package/lib/engine/mem/db/invariants.d.ts +26 -0
  9. package/lib/engine/mem/db/tokenizer.d.ts +23 -0
  10. package/lib/engine/mem/db/vectors.d.ts +40 -8
  11. package/lib/engine/mem/entities/extract.d.ts +1 -1
  12. package/lib/engine/mem/eval/derive.d.ts +120 -0
  13. package/lib/engine/mem/eval/derived_runner.d.ts +88 -0
  14. package/lib/engine/mem/eval/metrics.d.ts +24 -0
  15. package/lib/engine/mem/eval/runner.d.ts +8 -1
  16. package/lib/engine/mem/index.d.ts +1 -1
  17. package/lib/engine/mem/modelBootstrap.d.ts +2 -2
  18. package/lib/engine/mem/runtime.d.ts +1 -1
  19. package/lib/engine/mem/store/common.d.ts +33 -11
  20. package/lib/engine/mem/store/entity_leg.d.ts +95 -0
  21. package/lib/engine/mem/store/floors.d.ts +63 -31
  22. package/lib/engine/mem/store/hybrid.d.ts +21 -26
  23. package/lib/engine/mem/store/knowledge.d.ts +18 -9
  24. package/lib/engine/mem/store/lexical.d.ts +44 -0
  25. package/lib/engine/mem/store/memory.d.ts +151 -24
  26. package/lib/engine/mem/store/secret_guard.d.ts +34 -0
  27. package/lib/engine/mem/store/time_window.d.ts +74 -0
  28. package/lib/engine/mem-contract/config.d.ts +9 -16
  29. package/lib/engine/mem-contract/family.d.ts +1 -1
  30. package/lib/engine/mem-contract/tools.d.ts +10 -0
  31. package/lib/engine/mem-contract/types.d.ts +164 -9
  32. package/lib/engine/mem-retrieval/adapters/local_bge.d.ts +37 -7
  33. package/lib/engine/mem-retrieval/fusion.d.ts +14 -1
  34. package/lib/engine/mem-retrieval/index.d.ts +1 -3
  35. package/lib/engine/mem-retrieval/interfaces.d.ts +38 -14
  36. package/lib/engine/mem-retrieval/registry.d.ts +2 -4
  37. package/lib/engine/mem-retrieval/representation.d.ts +50 -0
  38. package/lib/engine/mem-retrieval/stats.d.ts +1 -3
  39. package/lib/index.js +2003 -565
  40. package/lib/types/client/index.d.ts.map +1 -1
  41. package/lib/types/index.d.ts +1 -1
  42. package/lib/types/index.d.ts.map +1 -1
  43. package/lib/types/prompt.d.ts +7 -0
  44. package/lib/types/prompt.d.ts.map +1 -1
  45. package/lib/types/remote.d.ts +12 -6
  46. package/lib/types/remote.d.ts.map +1 -1
  47. package/lib/types/vectorMigration.d.ts +44 -0
  48. package/lib/types/vectorMigration.d.ts.map +1 -0
  49. package/package.json +5 -5
  50. package/lib/engine/mem-retrieval/adapters/local_reranker.d.ts +0 -52
  51. package/lib/engine/mem-retrieval/adapters/none_reranker.d.ts +0 -10
  52. package/lib/engine/mem-retrieval/rerank.d.ts +0 -13
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAwGA,wDAAwD;AACxD,UAAU,aAAa;IACrB,KAAK,EAAE;QACL,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAA;QAChD,QAAQ,CACN,OAAO,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,MAAM,CAAA;SAAE,EACzE,SAAS,EAAE,MAAM,OAAO,GACvB,IAAI,CAAA;KACR,CAAA;IACD,MAAM,EAAE;QACN,wEAAwE;QACxE,MAAM,CAAC,YAAY,EAAE,OAAO,GAAG,O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seListing, type OpenOutcome, type RecallResult, type RemoteEnv
21
21
  export declare const name = "avantf-mem";
22
22
  export { inject } from './inject.js';
23
23
  export { KNOWLEDGE_PROMPT_SECTION, MEMORY_PROMPT_SECTION } from './prompt.js';
24
- export { registerSemanticBackend, registerReranker, registerVectorStore, type Reranker, type SemanticBackend, type VectorStore, } from '../engine/mem/index.js';
24
+ export { registerSemanticBackend, registerVectorStore, type SemanticBackend, type VectorStore, } from '../engine/mem/index.js';
25
25
  export interface Config {
26
26
  mode?: 'cordis' | 'mcp';
27
27
  dataHome?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAQlD,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAExC,OAAO,EAAE,mBAAmB,EAAU,MAAM,kCAAkC,CAAA;AAE9E,OAAO,EAQL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,WAAW,EAEhB,KAAK,WAAW,EACjB,MAAM,aAAa,CAAA;AACpB,OAAO,EAeL,KAAK,aAAa,EAClB,KAAK,WAAW,EAEhB,KAAK,YAAY,EACjB,KAAK,cAAc,EAEnB,KAAK,oBAAoB,EAG1B,MAAM,sBAAsB,CAAA;AAoB7B,eAAO,MAAM,IAAI,eAAe,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGpC,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAQ7E,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,WAAW,GACjB,MAAM,aAAa,CAAA;AAEpB,MAAM,WAAW,MAAM;IACrB,IAAI,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAA;IACvB,QAAQ,CAAC,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AI,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC,CAAC;IAUpG;;;;;OAKG;IAEG,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;CAiBpE;AAiID,wBAAsB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAuYvE"}
@@ -36,6 +36,13 @@ import type { LoadedPromptText, PromptFileSpec } from '@avantf/dsh-plugin-base';
36
36
  * lives here, in DESIGN §10 and in the CHANGELOG — not in the prompt, where it costs tokens on
37
37
  * every step and does not change the action.
38
38
  *
39
+ * P-04 added three behavioural clauses to the MEMORY section: remembered text is a record of the
40
+ * past and never an instruction for the current task; a verified-stale fact is corrected with
41
+ * `update` plus the verification basis; and `recall` output is not written straight back as a new
42
+ * fact. Because the FILE version wins over this built-in fallback, users who already customised
43
+ * `mem-memory-usage.md` do NOT get them automatically — the upgrade note in
44
+ * `docs/PENDING-RELEASE-NOTES.md` carries the pasteable text for exactly that case.
45
+ *
39
46
  * Kept in its own module — not in `index.ts` — so the text can be read and checked without the
40
47
  * plugin entry's `@deepseek-ai/*` runtime imports, which resolve only in a harness workspace.
41
48
  */
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAEnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,qBAAqB;;;;CAWA,CAAA;AAElC;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;;;CAOH,CAAA;AAElC;;;;;;;;;GASG;AACH,eAAO,MA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IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,kGAAkG;IAClG,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAC5D;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,YAAY,EAAE,SAAS,eAAe,EAIlD,CAAA;AAED,qGAAqG;AACrG,wBAAgB,eAAe,IAAI,cAAc,EAAE,CAElD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,GAAG,aAAa,EAAE,CAOxF;AAED,0FAA0F;AAC1F,eAAO,MAAM,kBAAkB,MAAM,CAAA;AAKrC;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,EAAE,CAmB/E"}
@@ -24,11 +24,13 @@ export declare const clientContribution: TypertRemoteContribution;
24
24
  * guarantee, stamped in the one place every method already goes through (`wireOk`/`wireErr`).
25
25
  *
26
26
  * BUMP RULE. Bump on every added/removed `@Remote` method — the number tracks the SET of methods the
27
- * face publishes, not the shape of one payload. Do NOT bump for a new optional FIELD: a
28
- * `.default(...)`-carrying schema (and the `acceptsUndefined` parameters) already absorb that across
29
- * the gap. When you add a method, also declare `export const <NAME>_WIRE_VERSION = <new value>`
30
- * beside this constant and gate the client call on it (`client/wire.ts` `hostSupports` /
31
- * `staleHostText`), exactly as mission's `EXECUTOR_LOOKUP_WIRE_VERSION` does.
27
+ * face publishes. Do NOT bump for a new optional FIELD: a `.default(...)`-carrying schema (and the
28
+ * `acceptsUndefined` parameters) already absorb that across the gap. DO bump for a REMOVED payload
29
+ * field that the other half dereferences — nothing absorbs a removal, and an old client still reading
30
+ * it would render garbage (see revision 2). When you add a method, also declare
31
+ * `export const <NAME>_WIRE_VERSION = <new value>` beside this constant and gate the client call on it
32
+ * (`client/wire.ts` `hostSupports` / `staleHostText`), exactly as mission's
33
+ * `EXECUTOR_LOOKUP_WIRE_VERSION` does.
32
34
  *
33
35
  * ABSENT MEANS OLD. An old host sends no `wire` at all; the client must treat that as "older than the
34
36
  * marker", never as a decode failure — the answer is still readable.
@@ -38,8 +40,12 @@ export declare const clientContribution: TypertRemoteContribution;
38
40
  * (remember / recall / admin / kb / query + openDoc / classifySource / browseDir / kbDomains /
39
41
  * kbAddDomain), all of which predate the marker — so nothing is gated on revision 1; the mechanism
40
42
  * exists for the NEXT method.
43
+ * - 2: the rerank capability was removed (0.5.0). This changed NO `@Remote` method, but it removed the
44
+ * `rerank_used` / `rerank_fallback` / `rerank_truncated` fields from the retrieval-health payload
45
+ * that `admin.stats` answers — fields the client half dereferenced. A rebuilt client talking to an
46
+ * old host (or the reverse) therefore has to be reported as skew, not silently render `NaN`.
41
47
  */
42
- export declare const WIRE_VERSION = 1;
48
+ export declare const WIRE_VERSION = 2;
43
49
  /**
44
50
  * The successful application envelope, with the wire revision stamped on.
45
51
  *
@@ -1 +1 @@
1
- {"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../src/remote.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EACV,oBAAoB,EAGpB,wBAAwB,EACzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAA;AAGhF,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AA6E/D,eAAO,MAAM,WAAW,EAAE,SAAS,oBAAoB,EA2GtD,CAAA;AAED,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB,EAAE,wBAGhC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,YAAY,IAAI,CAAA;AAE7B;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,SAAS,CAEnE;AA8BD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,EAAE,kBA0C9B,CAAA"}
1
+ {"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../src/remote.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EACV,oBAAoB,EAGpB,wBAAwB,EACzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAA;AAGhF,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AA6E/D,eAAO,MAAM,WAAW,EAAE,SAAS,oBAAoB,EA0HtD,CAAA;AAED,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB,EAAE,wBAGhC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,YAAY,IAAI,CAAA;AAE7B;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,SAAS,CAEnE;AA8BD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,EAAE,kBA0C9B,CAAA"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * The plugin's driver for the bounded, resumable background migration of persisted vectors into the
3
+ * current embedding space.
4
+ *
5
+ * Changing the embedding space (default model, width, pooling, normalization) is a DATA MIGRATION,
6
+ * not a config tweak: every persisted vector still decodes, but in another model's coordinates, so
7
+ * the semantic leg must not serve it. Measured on the real library after the 512→768 default-model
8
+ * swap, 78 of 80 ACTIVE facts fell out of the semantic leg and retrieval degraded to lexical+entity
9
+ * with no error anywhere — the store's open-time warning now says so, and this module is what
10
+ * repairs it without the operator having to know `vectors --fix` exists.
11
+ *
12
+ * It sits BEHIND the startup gate (`awaitStartupGate`, see index.ts): the model warm and this first
13
+ * batch must not land in the boot window (DESIGN §20.14), and the tokenizer/model are the expensive
14
+ * resources the gate exists to move out. The loop itself lives in the store
15
+ * (`MemoryStore.migrateVectors`), which owns the batch size, the per-batch error handling and the
16
+ * event-loop yield; this module owns the LOGGING (start / progress / end) and the lifecycle
17
+ * (`shouldStop` = plugin disposed or runtime closed).
18
+ *
19
+ * Deliberately no new state in this file: what still needs migrating is derived from the database on
20
+ * every pass, which is exactly what makes the migration resumable across a restart.
21
+ */
22
+ import { type AvantfRuntime } from '../engine/mem/index.js';
23
+ import type { AvantfLogger } from '../engine/mem-contract/index.js';
24
+ export interface VectorMigrationHandle {
25
+ /**
26
+ * Run one migration pass. Quiet no-op when the store is already current, when a pass is already
27
+ * running, or after {@link stop}. Failures never escape: they are logged and left for the next
28
+ * heartbeat to retry.
29
+ */
30
+ start(): void;
31
+ /** Stop a running pass at its next batch boundary; later `start()` calls are no-ops. */
32
+ stop(): void;
33
+ /** `true` while a pass is in flight. */
34
+ readonly running: boolean;
35
+ }
36
+ export declare function createVectorMigration(opts: {
37
+ rt: AvantfRuntime;
38
+ logger: AvantfLogger;
39
+ /** False once the plugin's fiber is disposed (profile reload / unload). */
40
+ isActive: () => boolean;
41
+ /** Rows per batch; the store's `DEFAULT_VECTOR_MIGRATION_BATCH` when omitted. */
42
+ batchSize?: number;
43
+ }): VectorMigrationHandle;
44
+ //# sourceMappingURL=vectorMigration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vectorMigration.d.ts","sourceRoot":"","sources":["../../src/vectorMigration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,KAAK,IAAI,IAAI,CAAA;IACb,wFAAwF;IACxF,IAAI,IAAI,IAAI,CAAA;IACZ,wCAAwC;IACxC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC1B;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,EAAE,EAAE,aAAa,CAAA;IACjB,MAAM,EAAE,YAAY,CAAA;IACpB,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,OAAO,CAAA;IACvB,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,qBAAqB,CAuExB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avantf/dsh-mem",
3
- "version": "0.4.1",
3
+ "version": "0.6.0",
4
4
  "description": "avantf-mem DSH native Cordis plugin: host service + tools + RPC + client tabs 记忆/知识",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -78,10 +78,10 @@
78
78
  },
79
79
  "devDependencies": {
80
80
  "@avantf/dsh-plugin-base": ">=0.3.0 <1.0.0",
81
- "@avantf/mem": "0.4.1",
82
- "@avantf/mem-contract": "0.4.1",
83
- "@avantf/mem-convert": "0.4.1",
84
- "@avantf/mem-provision": "0.4.1",
81
+ "@avantf/mem": "0.6.0",
82
+ "@avantf/mem-contract": "0.6.0",
83
+ "@avantf/mem-convert": "0.6.0",
84
+ "@avantf/mem-provision": "0.6.0",
85
85
  "@types/node": "^22.0.0",
86
86
  "@types/react": "^18.3.0",
87
87
  "lightningcss": "^1.32.0",
@@ -1,52 +0,0 @@
1
- import type { Reranker } from '../interfaces.js';
2
- import { type ModelEnv } from './local_bge.js';
3
- /** One text-classification result: transformers.js yields `{label, score}`; tolerate a raw `{data}` tensor too. */
4
- type ClassifyResult = {
5
- label?: string;
6
- score?: number;
7
- data?: number[];
8
- };
9
- /** The injected pipeline surface: a batch of (query, document) pairs in, scores out. */
10
- export type ClassifyFn = (inputs: [string, string][], opts?: Record<string, unknown>) => Promise<ClassifyResult[]>;
11
- /** Injectable seam: tests supply a fake classifier instead of the transformers.js import. */
12
- export type RerankerPipeFactory = (model: string, env: ModelEnv) => Promise<ClassifyFn>;
13
- /** Never hand the classifier a degenerate document; below this the score is meaningless. */
14
- export declare const MIN_DOC_TOKENS = 16;
15
- /**
16
- * Local cross-encoder reranker via `@huggingface/transformers` (`bge-reranker`).
17
- * Lazily imported; `warmUp()` configures the mirror/cache and triggers a load.
18
- * Degrades to identity order when the package/model is not available.
19
- *
20
- * Like {@link LocalBgeBackend}, a failed warmup is retryable through
21
- * `ensureWarm()` rather than being final until the next restart.
22
- */
23
- export declare class LocalReranker implements Reranker {
24
- readonly name = "bge_reranker";
25
- private _available;
26
- private _pipe;
27
- private _warming;
28
- private _lengthWarned;
29
- private _window;
30
- private readonly configuredMax;
31
- private readonly model;
32
- private readonly env;
33
- private readonly pipeFactory;
34
- private readonly gate;
35
- constructor(model: string, env?: Partial<ModelEnv>, pipeFactory?: RerankerPipeFactory);
36
- isAvailable(): boolean;
37
- /** Fire-and-forget retry for call sites that only observe availability (see `warm_gate.ts`). */
38
- ensureWarm(): void;
39
- warmUp(): Promise<void>;
40
- private _doWarmup;
41
- private window;
42
- /**
43
- * Bound one document for a pair, given how much of the window the query already spends.
44
- * Returns the document text unchanged when it fits.
45
- */
46
- private boundDocument;
47
- rerank(query: string, candidates: {
48
- id: number;
49
- text: string;
50
- }[]): Promise<number[]>;
51
- }
52
- export {};
@@ -1,10 +0,0 @@
1
- import type { Reranker } from '../interfaces.js';
2
- /** `none` — reranking disabled (the default). Reports unavailable so callers skip the rerank pass entirely. */
3
- export declare class NoneReranker implements Reranker {
4
- readonly name = "none";
5
- isAvailable(): boolean;
6
- rerank(_query: string, candidates: {
7
- id: number;
8
- text: string;
9
- }[]): Promise<number[]>;
10
- }
@@ -1,13 +0,0 @@
1
- import type { Reranker } from './interfaces.js';
2
- /**
3
- * The one rerank-and-reorder pass shared by every retrieval leg (memory search,
4
- * knowledge search — the blocks were byte-identical and had already drifted once
5
- * on the miss-sort sentinel).
6
- *
7
- * Contract: `reranker.rerank` returns candidate ids best-first; ids it omits sort
8
- * last with their fused order preserved (stable sort). A disabled/unavailable
9
- * reranker is a pass-through.
10
- */
11
- export declare function rerankHits<T extends {
12
- id: number;
13
- }>(reranker: Reranker, query: string, hits: T[], textOf: (id: number) => string): Promise<T[]>;