@avantf/dsh-mem 0.3.1 → 0.4.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 +89 -28
- package/cordis.patch.yml +17 -0
- package/lib/client.js +155 -14
- package/lib/engine/mem/config/config_files.d.ts +26 -0
- package/lib/engine/mem/config/domains.d.ts +20 -0
- package/lib/engine/mem/config/loader.d.ts +35 -0
- package/lib/engine/mem/config/paths.d.ts +53 -0
- package/lib/engine/mem/db/chunk.d.ts +26 -0
- package/lib/engine/mem/db/conn.d.ts +13 -0
- package/lib/engine/mem/db/dao/chunks.d.ts +150 -0
- package/lib/engine/mem/db/dao/contradictions.d.ts +98 -0
- package/lib/engine/mem/db/dao/documents.d.ts +51 -0
- package/lib/engine/mem/db/dao/entities.d.ts +67 -0
- package/lib/engine/mem/db/dao/facts.d.ts +472 -0
- package/lib/engine/mem/db/dao/stats.d.ts +14 -0
- package/lib/engine/mem/db/dao/triples.d.ts +80 -0
- package/lib/engine/mem/db/hash.d.ts +2 -0
- package/lib/engine/mem/db/knowledge.d.ts +17 -0
- package/lib/engine/mem/db/migrations.d.ts +71 -0
- package/lib/engine/mem/db/port.d.ts +57 -0
- package/lib/engine/mem/db/schema.d.ts +26 -0
- package/lib/engine/mem/db/sqlite.d.ts +89 -0
- package/lib/engine/mem/db/store.d.ts +35 -0
- package/lib/engine/mem/db/tokenizer.d.ts +61 -0
- package/lib/engine/mem/db/vectors.d.ts +50 -0
- package/lib/engine/mem/dispatch.d.ts +51 -0
- package/lib/engine/mem/entities/extract.d.ts +84 -0
- package/lib/engine/mem/eval/loader.d.ts +19 -0
- package/lib/engine/mem/eval/metrics.d.ts +25 -0
- package/lib/engine/mem/eval/runner.d.ts +10 -0
- package/lib/engine/mem/eval/write_metrics.d.ts +88 -0
- package/lib/engine/mem/git.d.ts +73 -0
- package/lib/engine/mem/hrr/algebra.d.ts +30 -0
- package/lib/engine/mem/hrr/atoms.d.ts +22 -0
- package/lib/engine/mem/hrr/encode.d.ts +32 -0
- package/lib/engine/mem/hrr/index.d.ts +3 -0
- package/lib/engine/mem/index.d.ts +27 -0
- package/lib/engine/mem/lifecycle/contradiction.d.ts +156 -0
- package/lib/engine/mem/lifecycle/index.d.ts +5 -0
- package/lib/engine/mem/lifecycle/maintenance.d.ts +48 -0
- package/lib/engine/mem/lifecycle/presence.d.ts +29 -0
- package/lib/engine/mem/lifecycle/tick.d.ts +43 -0
- package/lib/engine/mem/lifecycle/trust.d.ts +90 -0
- package/lib/engine/mem/modelBootstrap.d.ts +207 -0
- package/lib/engine/mem/router.d.ts +51 -0
- package/lib/engine/mem/runtime.d.ts +232 -0
- package/lib/engine/mem/store/common.d.ts +82 -0
- package/lib/engine/mem/store/doc_files.d.ts +125 -0
- package/lib/engine/mem/store/document_text.d.ts +47 -0
- package/lib/engine/mem/store/floors.d.ts +191 -0
- package/lib/engine/mem/store/hybrid.d.ts +232 -0
- package/lib/engine/mem/store/ingest_guard.d.ts +25 -0
- package/lib/engine/mem/store/knowledge.d.ts +483 -0
- package/lib/engine/mem/store/lexical.d.ts +67 -0
- package/lib/engine/mem/store/memory.d.ts +543 -0
- package/lib/engine/mem/store/source_picker.d.ts +43 -0
- package/lib/engine/mem-contract/config.d.ts +129 -0
- package/lib/engine/mem-contract/env.d.ts +31 -0
- package/lib/engine/mem-contract/family.d.ts +25 -0
- package/lib/engine/mem-contract/index.d.ts +8 -0
- package/lib/engine/mem-contract/log.d.ts +29 -0
- package/lib/engine/mem-contract/remote.d.ts +80 -0
- package/lib/engine/mem-contract/text.d.ts +92 -0
- package/lib/engine/mem-contract/tools.d.ts +284 -0
- package/lib/engine/mem-contract/types.d.ts +615 -0
- package/lib/engine/mem-retrieval/adapters/auto_vstore.d.ts +47 -0
- package/lib/engine/mem-retrieval/adapters/hnswlib.d.ts +174 -0
- package/lib/engine/mem-retrieval/adapters/local_bge.d.ts +121 -0
- package/lib/engine/mem-retrieval/adapters/local_numpy.d.ts +28 -0
- package/lib/engine/mem-retrieval/adapters/local_reranker.d.ts +52 -0
- package/lib/engine/mem-retrieval/adapters/none_reranker.d.ts +10 -0
- package/lib/engine/mem-retrieval/adapters/warm_gate.d.ts +46 -0
- package/lib/engine/mem-retrieval/budget.d.ts +30 -0
- package/lib/engine/mem-retrieval/fusion.d.ts +53 -0
- package/lib/engine/mem-retrieval/index.d.ts +14 -0
- package/lib/engine/mem-retrieval/interfaces.d.ts +82 -0
- package/lib/engine/mem-retrieval/log.d.ts +11 -0
- package/lib/engine/mem-retrieval/registry.d.ts +23 -0
- package/lib/engine/mem-retrieval/rerank.d.ts +13 -0
- package/lib/engine/mem-retrieval/stats.d.ts +64 -0
- package/lib/engine/mem-retrieval/text_budget.d.ts +52 -0
- package/lib/index.js +1773 -473
- package/lib/interface-version.json +2 -2
- package/lib/types/client/domains.d.ts +5 -4
- package/lib/types/client/domains.d.ts.map +1 -1
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/ingest.d.ts +1 -1
- package/lib/types/client/wire.d.ts +36 -0
- package/lib/types/client/wire.d.ts.map +1 -0
- package/lib/types/envinit-bootstrap.d.ts +3 -2
- package/lib/types/envinit.d.ts +2 -19
- package/lib/types/envinit.d.ts.map +1 -1
- package/lib/types/hints.d.ts +1 -1
- package/lib/types/index.d.ts +8 -3
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/open.d.ts +61 -11
- package/lib/types/open.d.ts.map +1 -1
- package/lib/types/prompt.d.ts +19 -1
- package/lib/types/prompt.d.ts.map +1 -1
- package/lib/types/provision.d.ts +1 -1
- package/lib/types/provision.d.ts.map +1 -1
- package/lib/types/reconcile.d.ts +64 -0
- package/lib/types/reconcile.d.ts.map +1 -0
- package/lib/types/remote.d.ts +53 -0
- package/lib/types/remote.d.ts.map +1 -1
- package/lib/types/render.d.ts +35 -0
- package/lib/types/render.d.ts.map +1 -0
- package/lib/types/tool_schema.d.ts +3 -13
- package/lib/types/tool_schema.d.ts.map +1 -1
- package/package.json +24 -15
- package/lib/client.js.map +0 -1
- package/lib/types/client/domains.js +0 -25
- package/lib/types/client/domains.js.map +0 -1
- package/lib/types/client/index.js +0 -1371
- package/lib/types/client/index.js.map +0 -1
- package/lib/types/client/ingest.js +0 -30
- package/lib/types/client/ingest.js.map +0 -1
- package/lib/types/client/paging.js +0 -36
- package/lib/types/client/paging.js.map +0 -1
- package/lib/types/client/summarize.js +0 -79
- package/lib/types/client/summarize.js.map +0 -1
- package/lib/types/data_home.js +0 -26
- package/lib/types/data_home.js.map +0 -1
- package/lib/types/envinit-bootstrap.js +0 -333
- package/lib/types/envinit.js +0 -402
- package/lib/types/envinit.js.map +0 -1
- package/lib/types/hints.js +0 -53
- package/lib/types/hints.js.map +0 -1
- package/lib/types/index.js +0 -755
- package/lib/types/index.js.map +0 -1
- package/lib/types/inject.js +0 -14
- package/lib/types/inject.js.map +0 -1
- package/lib/types/interface_gate.js +0 -84
- package/lib/types/interface_gate.js.map +0 -1
- package/lib/types/open.js +0 -133
- package/lib/types/open.js.map +0 -1
- package/lib/types/prompt.js +0 -148
- package/lib/types/prompt.js.map +0 -1
- package/lib/types/provision.js +0 -177
- package/lib/types/provision.js.map +0 -1
- package/lib/types/remote.js +0 -247
- package/lib/types/remote.js.map +0 -1
- package/lib/types/tool_schema.js +0 -149
- package/lib/types/tool_schema.js.map +0 -1
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
* `restricted` mirrors "the allowlist is non-empty" — then the control is a closed `<select>` and
|
|
8
8
|
* a new domain is a config change, not a second spelling of an existing one. An explicitly empty
|
|
9
9
|
* allowlist means no restriction, so the control stays a free input.
|
|
10
|
+
*
|
|
11
|
+
* `DomainCatalog` itself is the CONTRACT's type (type-only import, erased from the bundle): the
|
|
12
|
+
* host store's `domainCatalog()` return and this picker name the same declaration, so the shape
|
|
13
|
+
* cannot be copied wrong on one half.
|
|
10
14
|
*/
|
|
11
|
-
|
|
12
|
-
domains: string[];
|
|
13
|
-
restricted: boolean;
|
|
14
|
-
}
|
|
15
|
+
import type { DomainCatalog } from '../../engine/mem-contract/index.js';
|
|
15
16
|
/** One `<option>`: `value` is what the form sends, `label` is what the user reads. */
|
|
16
17
|
export interface DomainOption {
|
|
17
18
|
value: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../../../src/client/domains.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../../../src/client/domains.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEzD,sFAAsF;AACtF,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,GAAG,YAAY,EAAE,CAG/F;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,GAAG,QAAQ,GAAG,OAAO,CAElF;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAEjC,8EAA8E;AAC9E,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,cAAc,CAOvF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"
|
|
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,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;KAC5D,CAAA;IACD;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;CAC3B;AA8gDD,2DAA2D;AAC3D,eAAO,MAAM,IAAI,sBAAsB,CAAA;AAEvC;;;;GAIG;AACH,eAAO,MAAM,MAAM,UAAsB,CAAA;AAEzC,mGAAmG;AACnG,wBAAsB,KAAK,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAoC7D"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* The confirm text is capped at 8 documents: a directory import that collides with the whole
|
|
11
11
|
* library must produce a readable question, not a wall. The counts say what the rest are.
|
|
12
12
|
*/
|
|
13
|
-
import type { KbConflictReport } from '
|
|
13
|
+
import type { KbConflictReport } from '../../engine/mem-contract/index.js';
|
|
14
14
|
/**
|
|
15
15
|
* The host's collision report, or `null` for any other payload.
|
|
16
16
|
*
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The version-skew note for a host's reported revision, or `undefined` when the two halves agree.
|
|
3
|
+
*
|
|
4
|
+
* A NOTE, not a throw: an unrecognized revision usually still carries the fields the panels render,
|
|
5
|
+
* and blanking them is exactly the degradation the marker exists to avoid. `hostWire` is read off
|
|
6
|
+
* the DECODED envelope (`unwrapRemoteEnvelope`), so `undefined` means "an older host that predates
|
|
7
|
+
* the marker", never a decode failure.
|
|
8
|
+
*/
|
|
9
|
+
export declare function hostSkew(hostWire: unknown): string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Whether a host reporting `hostWire` can have registered a method introduced at `required`.
|
|
12
|
+
*
|
|
13
|
+
* `undefined` is "no revision observed yet", and is reported as NOT supported by this predicate —
|
|
14
|
+
* the caller decides whether "unknown" means "refuse" (see the gate in `client/index.ts`, which only
|
|
15
|
+
* refuses when it has actually SEEN an older revision).
|
|
16
|
+
*/
|
|
17
|
+
export declare function hostSupports(hostWire: number | undefined, required: number): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The sentence for a call this client refuses to SEND because the host's REPORTED revision predates
|
|
20
|
+
* the method.
|
|
21
|
+
*
|
|
22
|
+
* The call is never sent, so this must not read as a transport failure: the host's own revision says
|
|
23
|
+
* the method does not exist, and the remedy (restart dsh web) is specific. Only called with a known
|
|
24
|
+
* revision — an unobserved one is sent and diagnosed by {@link transportHint} instead.
|
|
25
|
+
*/
|
|
26
|
+
export declare function staleHostText(hostWire: number, required: number, what: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Name a transport failure that is really a VERSION SKEW.
|
|
29
|
+
*
|
|
30
|
+
* A gateway answers a method the host never published with an HTTP 404, which reads exactly like
|
|
31
|
+
* "the record or the file is gone". The sentence therefore names the missing REGISTRATION (an older
|
|
32
|
+
* host, or one never restarted) rather than only repeating the transport text; anything that is not
|
|
33
|
+
* a 404 is returned verbatim, because then the transport's own words are the useful ones.
|
|
34
|
+
*/
|
|
35
|
+
export declare function transportHint(cause: unknown): string;
|
|
36
|
+
//# sourceMappingURL=wire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../../src/client/wire.ts"],"names":[],"mappings":"AAkBA;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAQ9D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEpF;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAGtF;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKpD"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @module bootstrap
|
|
4
4
|
*/
|
|
5
5
|
/** The bootstrap version; the resolved framework must satisfy {@link supportedRange}. */
|
|
6
|
-
export declare const VERSION = "0.
|
|
6
|
+
export declare const VERSION = "0.4.0";
|
|
7
7
|
/**
|
|
8
8
|
* The framework interval this bootstrap can launch.
|
|
9
9
|
*
|
|
@@ -13,7 +13,8 @@ export declare const VERSION = "0.3.1";
|
|
|
13
13
|
* compatibility promise — `>=0.3.0 <1.0.0` admits every 0.x base this generation of plugins can
|
|
14
14
|
* consume, and stops at the major that invented a new interface generation. The interface itself is
|
|
15
15
|
* the separate, runtime axis: a base inside this interval whose `INTERFACE_VERSION` differs is judged
|
|
16
|
-
* by the base's own gate (INTERFACE.md §1, §3)
|
|
16
|
+
* by the base's own gate (INTERFACE.md §1, §3) — an OLDER base degrades, a NEWER one is `ok` + a
|
|
17
|
+
* warning (generations are additive), and neither ever refuses the mount.
|
|
17
18
|
*/
|
|
18
19
|
export declare const supportedRange = ">=0.3.0 <1.0.0";
|
|
19
20
|
/** Sink for the warnings that replace a throw. */
|
package/lib/types/envinit.d.ts
CHANGED
|
@@ -8,25 +8,8 @@ type EnvinitModule = typeof import('@avantf/dsh-plugin-base');
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const PANDOC_ITEM = "mem:pandoc";
|
|
10
10
|
export declare const MODEL_ITEM = "mem:model";
|
|
11
|
-
/**
|
|
12
|
-
* The default ONNX embedding repository — the one `semantic.local_model` defaults to and the one
|
|
13
|
-
* {@link MODEL_FILES} describes. A DIFFERENT repo is a different file set, which is why the item
|
|
14
|
-
* omits `spec.files` for it (see {@link managedModelSpec}).
|
|
15
|
-
*/
|
|
16
|
-
export declare const DEFAULT_MODEL_REPO = "Xenova/bge-small-zh-v1.5";
|
|
17
|
-
/**
|
|
18
|
-
* The files the local embedding runtime actually requests for the DEFAULT ONNX model.
|
|
19
|
-
*
|
|
20
|
-
* Measured, not guessed: with an empty cache, `@huggingface/transformers@4.x` resolving
|
|
21
|
-
* `feature-extraction` for `Xenova/bge-small-zh-v1.5` fetches exactly these four — `config.json`,
|
|
22
|
-
* `tokenizer.json`, `tokenizer_config.json` and the fp32 `onnx/model.onnx`. The repo ALSO carries
|
|
23
|
-
* `special_tokens_map.json`, `vocab.txt` and seven other ONNX quantisations the default run never
|
|
24
|
-
* opens; declaring them would download hundreds of megabytes of dead weight. The list stays narrow
|
|
25
|
-
* to what is read.
|
|
26
|
-
*/
|
|
27
|
-
export declare const MODEL_FILES: readonly string[];
|
|
28
11
|
/** The logging surface this module needs — `AvantfLogger` satisfies it. */
|
|
29
|
-
|
|
12
|
+
interface EnvinitLogger {
|
|
30
13
|
info(message: string): void;
|
|
31
14
|
warn(message: string): void;
|
|
32
15
|
error(message: string): void;
|
|
@@ -118,7 +101,7 @@ export interface EnvinitRuntime {
|
|
|
118
101
|
dispose(): void;
|
|
119
102
|
}
|
|
120
103
|
/** Options for {@link loadEnvinit}. */
|
|
121
|
-
|
|
104
|
+
interface EnvinitLoadOptions {
|
|
122
105
|
readonly log?: EnvinitLogger;
|
|
123
106
|
/** The family root; default `$AVANTF_HOME`, else `~/.avantf/env` (framework DESIGN §6.3). */
|
|
124
107
|
readonly home?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envinit.d.ts","sourceRoot":"","sources":["../../src/envinit.ts"],"names":[],"mappings":"AAoDA,OAAO,KAAK,EAAiB,oBAAoB,EAAe,MAAM,yBAAyB,CAAA;AAG/F,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAA;AAKvB,4FAA4F;AAC5F,KAAK,aAAa,GAAG,cAAc,yBAAyB,CAAC,CAAA;AAK7D;;;GAGG;AACH,eAAO,MAAM,WAAW,eAAe,CAAA;AACvC,eAAO,MAAM,UAAU,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"envinit.d.ts","sourceRoot":"","sources":["../../src/envinit.ts"],"names":[],"mappings":"AAoDA,OAAO,KAAK,EAAiB,oBAAoB,EAAe,MAAM,yBAAyB,CAAA;AAG/F,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAA;AAKvB,4FAA4F;AAC5F,KAAK,aAAa,GAAG,cAAc,yBAAyB,CAAC,CAAA;AAK7D;;;GAGG;AACH,eAAO,MAAM,WAAW,eAAe,CAAA;AACvC,eAAO,MAAM,UAAU,cAAc,CAAA;AAiDrC,2EAA2E;AAC3E,UAAU,aAAa;IACrB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,8FAA8F;IAC9F,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAA;IAC1C;;;;;;;;OAQG;IACH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FAA6F;IAC7F,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,mHAAmH;IACnH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;IAC/B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,yFAAyF;IACzF,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,CAAA;IAClC,0FAA0F;IAC1F,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAA;CACrC;AA6HD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAkBvG"}
|
package/lib/types/hints.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RelevanceHit } from '
|
|
1
|
+
import type { RelevanceHit } from '../engine/mem/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* The plugin's CONDITIONAL hint: ONE line, contributed only when either store already holds
|
|
4
4
|
* something relevant to the message the user just sent (DESIGN §12).
|
package/lib/types/index.d.ts
CHANGED
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
import type { Context } from '@deepseek-ai/cordis';
|
|
17
17
|
import z from '@deepseek-ai/schemastery';
|
|
18
18
|
import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
19
|
-
import { type AvantfRuntime, type KnowledgeStore, type MemoryStore, type StoreResult } from '
|
|
20
|
-
import { type BrowseListing, type RecallResult, type RemoteEnvelope, type SourceClassification } from '
|
|
21
|
-
import { type OpenOutcome } from './open.js';
|
|
19
|
+
import { type AvantfRuntime, type KnowledgeStore, type MemoryStore, type StoreResult } from '../engine/mem/index.js';
|
|
20
|
+
import { type BrowseListing, type OpenOutcome, type RecallResult, type RemoteEnvelope, type SourceClassification } from '../engine/mem-contract/index.js';
|
|
22
21
|
export declare const name = "avantf-mem";
|
|
23
22
|
export { inject } from './inject.js';
|
|
24
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';
|
|
25
25
|
export interface Config {
|
|
26
26
|
mode?: 'cordis' | 'mcp';
|
|
27
27
|
dataHome?: string;
|
|
@@ -33,6 +33,11 @@ type WireArgs = Record<string, unknown>;
|
|
|
33
33
|
* re-validated with the contract zod union before dispatch (same guarantee the
|
|
34
34
|
* tools give the model), and results are wrapped in the contract's
|
|
35
35
|
* `{ok:true,value}` / `{ok:false,error,violations}` RemoteEnvelope the client decodes.
|
|
36
|
+
*
|
|
37
|
+
* Every envelope — success and failure, tool-backed and UI-only — is built through `wireOk`/`wireErr`
|
|
38
|
+
* so it carries this build's `WIRE_VERSION`. That is what lets a freshly reloaded browser half tell
|
|
39
|
+
* whether the host process predates a method it is about to call, instead of reading the gateway's
|
|
40
|
+
* 404 as "the record is gone" (see `remote.ts`).
|
|
36
41
|
*/
|
|
37
42
|
export declare class AvantfMemGateway extends TypertRemoteService {
|
|
38
43
|
private readonly rt;
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -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,
|
|
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,mBAA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,CAAC,CAAC;IAMnF,KAAK,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IAKhF;;;;;OAKG;IAEH,EAAE,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAOpD,KAAK,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;IAI5D;;;;OAIG;IAEG,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC;IAUnF,qFAAqF;IAE/E,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;IAUvE;;;;OAIG;IAEG,SAAS,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC;IAQvG;;;;OAIG;IAEG,WAAW,CAAC,IAAI,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,CA4WvE"}
|
package/lib/types/open.d.ts
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export type OpenTarget = 'file' | 'dir';
|
|
3
|
-
/** What was launched, for the UI's status line. */
|
|
4
|
-
export interface OpenOutcome {
|
|
5
|
-
path: string;
|
|
6
|
-
target: OpenTarget;
|
|
7
|
-
/** The command that was actually used (`code`, `explorer.exe`, …). */
|
|
8
|
-
opener: string;
|
|
9
|
-
}
|
|
1
|
+
import type { OpenOutcome, OpenTarget } from '../engine/mem-contract/index.js';
|
|
10
2
|
/**
|
|
11
3
|
* The file names one command can have on PATH.
|
|
12
4
|
*
|
|
@@ -14,14 +6,72 @@ export interface OpenOutcome {
|
|
|
14
6
|
* bare name silently loses the editor and falls back to the OS default application. `PATHEXT` is
|
|
15
7
|
* what the shell itself uses; the default list is the fallback when it is not exported.
|
|
16
8
|
*/
|
|
17
|
-
export declare function commandFileNames(command: string, platform?: NodeJS.Platform): string[];
|
|
9
|
+
export declare function commandFileNames(command: string, platform?: NodeJS.Platform, pathext?: string | undefined): string[];
|
|
10
|
+
/**
|
|
11
|
+
* The file name of `command` that actually exists on `env.PATH`, or `undefined`.
|
|
12
|
+
*
|
|
13
|
+
* Returning the NAME (not a boolean) is what lets the launcher see `code.cmd` and know it holds a
|
|
14
|
+
* batch shim. `[win]` — the win32 form is asserted from Linux with an injected platform/env.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveOnPath(command: string, platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): string | undefined;
|
|
17
|
+
/** True for a Windows batch shim — the one shape Node will not spawn without a shell. */
|
|
18
|
+
export declare function isWindowsBatchShim(command: string, platform?: NodeJS.Platform): boolean;
|
|
19
|
+
/** Why a launch failed: the editor is not here (fall through) or the launch was refused (report). */
|
|
20
|
+
type LaunchFailure = 'missing' | 'refused';
|
|
21
|
+
/**
|
|
22
|
+
* Classify a synchronous spawn failure.
|
|
23
|
+
*
|
|
24
|
+
* `ENOENT` means the command is not there after all — the documented priority order just moves on,
|
|
25
|
+
* with no warning. Everything else (the `EINVAL` a `.cmd` gets without a shell, `EACCES`, a bad
|
|
26
|
+
* argument) is a wiring defect, and swallowing it is exactly how "open in VS Code" disappeared.
|
|
27
|
+
*/
|
|
28
|
+
export declare function classifyLaunchFailure(error: unknown): LaunchFailure;
|
|
29
|
+
/** The options the launch hands to `spawn`. */
|
|
30
|
+
export interface LaunchOptions {
|
|
31
|
+
detached: boolean;
|
|
32
|
+
stdio: 'ignore';
|
|
33
|
+
/** Required on Windows for a `.cmd`/`.bat` shim (CVE-2024-27980 forbids a shell-less spawn). */
|
|
34
|
+
shell?: boolean;
|
|
35
|
+
}
|
|
36
|
+
/** What to hand to `spawn` for one candidate. */
|
|
37
|
+
interface LaunchPlan {
|
|
38
|
+
command: string;
|
|
39
|
+
args: string[];
|
|
40
|
+
options: LaunchOptions;
|
|
41
|
+
}
|
|
42
|
+
/** The slice of `child_process.spawn` this module uses — narrow so a test can inject a fake. */
|
|
43
|
+
export type SpawnLike = (command: string, args: string[], options: LaunchOptions) => {
|
|
44
|
+
unref: () => void;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The concrete spawn shape for one candidate on `platform`.
|
|
48
|
+
*
|
|
49
|
+
* TWO Windows-only rules, both from the same root cause (CVE-2024-27980): a `.cmd`/`.bat` shim is
|
|
50
|
+
* spawned through `shell: true`; and the last-resort fallback is `cmd /c start`, whose quoted path
|
|
51
|
+
* must follow its own title argument or cmd treats the path AS the title. The plan is pure and
|
|
52
|
+
* takes the platform, so the win32 shapes are asserted on Linux (`[win]`, real-machine re-check
|
|
53
|
+
* still owed).
|
|
54
|
+
*/
|
|
55
|
+
export declare function launchPlan(command: string, arg: string, platform?: NodeJS.Platform): LaunchPlan;
|
|
56
|
+
/** Where a refused launch is reported; injectable so both failure paths are assertable. */
|
|
57
|
+
type WarnSink = (message: string) => void;
|
|
58
|
+
/** Host facts and side effects a caller (or a test) may replace. */
|
|
59
|
+
interface OpenDeps {
|
|
60
|
+
platform?: NodeJS.Platform;
|
|
61
|
+
env?: NodeJS.ProcessEnv;
|
|
62
|
+
spawn?: SpawnLike;
|
|
63
|
+
/** Defaults to `console.warn` (stderr): a refused launch must leave a trace. */
|
|
64
|
+
warn?: WarnSink;
|
|
65
|
+
}
|
|
18
66
|
/**
|
|
19
67
|
* Launch the configured/detected tool on one document path.
|
|
20
68
|
*
|
|
21
69
|
* @param documentPath - the managed `.md` path.
|
|
22
70
|
* @param target - `file` opens the document, `dir` opens the directory that holds it.
|
|
23
71
|
* @param configured - `knowledge.open.editor` from config (empty ⇒ auto-detect).
|
|
72
|
+
* @param deps - platform / env / spawn / warning sink, for tests.
|
|
24
73
|
* @throws when no candidate is available or every one of them fails to start.
|
|
25
74
|
*/
|
|
26
|
-
export declare function openDocumentPath(documentPath: string, target: OpenTarget, configured: string): OpenOutcome;
|
|
75
|
+
export declare function openDocumentPath(documentPath: string, target: OpenTarget, configured: string, deps?: OpenDeps): OpenOutcome;
|
|
76
|
+
export {};
|
|
27
77
|
//# sourceMappingURL=open.d.ts.map
|
package/lib/types/open.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../../src/open.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../../src/open.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEnE;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAC5C,OAAO,GAAE,MAAM,GAAG,SAAkC,GACnD,MAAM,EAAE,CAIV;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAC5C,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,MAAM,GAAG,SAAS,CAepB;AAED,yFAAyF;AACzF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAAG,OAAO,CAEzG;AAED,qGAAqG;AACrG,KAAK,aAAa,GAAG,SAAS,GAAG,SAAS,CAAA;AAE1C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_SECTION: {
|
|
|
69
69
|
readonly order: 3020;
|
|
70
70
|
readonly text: string;
|
|
71
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* This plugin's file-name prefix inside the SHARED family prompt directory — the `mem` in
|
|
74
|
+
* `mem-*.md`.
|
|
75
|
+
*
|
|
76
|
+
* It is handed to the base's `PromptFiles` as its `namespace` (interface v3), which then REFUSES to
|
|
77
|
+
* read or write any spec whose `file` is not `<namespace>-…` or is not a bare file name: the
|
|
78
|
+
* `mem-*` / `mission-*` split used to be a convention with no machine check, so a mistyped prefix
|
|
79
|
+
* could silently read or overwrite another plugin's user-edited file. The value is the SAME token
|
|
80
|
+
* {@link PROMPT_FILES} names its files with — one source for both, so the two cannot drift — and it
|
|
81
|
+
* is OPTIONAL at the base: a caller that omits it (or a base older than v3) gets the pre-v3
|
|
82
|
+
* behaviour, which is why passing it never degrades a mount.
|
|
83
|
+
*/
|
|
84
|
+
export declare const PROMPT_NAMESPACE = "mem";
|
|
72
85
|
/** One section and the file its text may be edited in; the file name is the loader's handle. */
|
|
73
86
|
export interface PromptFileEntry {
|
|
74
87
|
readonly file: string;
|
|
@@ -82,10 +95,15 @@ export interface PromptFileEntry {
|
|
|
82
95
|
* directory (`<data_home>/prompts`, see {@link PromptFiles}).
|
|
83
96
|
*
|
|
84
97
|
* Every avantf plugin writes its prompts into that one directory and owns a prefix — `mem-*` here,
|
|
85
|
-
* `
|
|
98
|
+
* `mission-*` in the mission engine — so a deployment can find and diff all of its model-facing text in
|
|
86
99
|
* one place without any plugin having to guess which files belong to it. This manifest is that
|
|
87
100
|
* ownership: a `.md` it does not list is ignored (never read, never written, never deleted).
|
|
88
101
|
*
|
|
102
|
+
* Since interface v3 the prefix is machine-checked, not a convention: every `file` below is a bare
|
|
103
|
+
* name starting with `mem-`, and the loader is built with `namespace: 'mem'`
|
|
104
|
+
* ({@link PROMPT_NAMESPACE}), so the base refuses — with a warning, without touching disk — any spec
|
|
105
|
+
* that names a file outside this plugin's prefix.
|
|
106
|
+
*
|
|
89
107
|
* The FILE owns the text; the CODE keeps the identity. Mapping a file name to a section HERE is what
|
|
90
108
|
* makes that true: no edit to the directory can move a section to a different point in the prompt
|
|
91
109
|
* (order) or change the name the harness dedupes on — and no file another plugin owns can be
|
|
@@ -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;;;;
|
|
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,MAAM,sBAAsB;;;;CAMD,CAAA;AAElC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,QAAQ,CAAA;AAErC,gGAAgG;AAChG,MAAM,WAAW,eAAe;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"}
|
package/lib/types/provision.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ export interface CompatRuntime {
|
|
|
63
63
|
readonly schemaNames: readonly string[];
|
|
64
64
|
}
|
|
65
65
|
/** The gate's outcome. */
|
|
66
|
-
|
|
66
|
+
interface CompatRun {
|
|
67
67
|
/** The verdict `apply` branches on. Plain data — the engine's provisioning guard reads it too. */
|
|
68
68
|
readonly verdict: CompatVerdict;
|
|
69
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provision.d.ts","sourceRoot":"","sources":["../../src/provision.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,YAAY,EACZ,UAAU,EACV,aAAa,EACb,eAAe,EAChB,MAAM,yBAAyB,CAAA;AAIhC,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,CAAA;AAE7C,wEAAwE;AACxE,MAAM,MAAM,YAAY,GAAG,cAAc,yBAAyB,CAAC,CAAA;AAEnE,mFAAmF;AACnF,eAAO,MAAM,cAAc,4BAA4B,CAAA;AAEvD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,eAAe,EAMvD,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAA6C,CAAA;AAE1F,uFAAuF;AACvF,eAAO,MAAM,g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AAE,CAAA;CACxC;AAED,0BAA0B;AAC1B,UAAU,SAAS;IACjB,kGAAkG;IAClG,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAA;CAChC;AAED,sDAAsD;AACtD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE/C;AAED,2EAA2E;AAC3E,wBAAgB,IAAI,CAAC,GAAG,EAAE,YAAY,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAMzE;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,CAyBrE;AAoBD;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CACvB,GAAG,EAAE,aAAa,EAClB,GAAG,EAAE,YAAY,EACjB,MAAM,EAAE,aAAa,EACrB,IAAI,GAAE,UAAwB,GAC7B,SAAS,CAqBX;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,aAAa,EACtB,GAAG,EAAE,YAAY,EACjB,MAAM,EAAE,aAAa,GACpB,IAAI,CAaN;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAA;IAC3B,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAA;IACrC,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;CAC/B,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAQ1C"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Corpus reconciliation: the throttled "did anything under `knowledge.docs.dir` change?" sweep behind
|
|
3
|
+
* `tools/result`.
|
|
4
|
+
*
|
|
5
|
+
* WHY IT IS ITS OWN MODULE. The plugin reaches the corpus through tool calls, so a finished tool call
|
|
6
|
+
* is the moment to ask the question — and the answer is cheap (`corpusDrift()` is one `stat` per
|
|
7
|
+
* document, reading nothing), which is what makes it affordable after EVERY tool result. Two things
|
|
8
|
+
* about it are easy to get wrong and are pinned by `test/reconcile.spec.ts` instead of by a mounted
|
|
9
|
+
* plugin: the THROTTLE (with a trailing run — skipping alone would drop the LAST edit, the one that
|
|
10
|
+
* matters) and the STOP rule (an in-flight pass must not keep writing after the plugin unmounted and
|
|
11
|
+
* its databases closed). `index.ts` is the assembly hub; this is the rule.
|
|
12
|
+
*
|
|
13
|
+
* @module @avantf/dsh-mem/reconcile
|
|
14
|
+
*/
|
|
15
|
+
/** The corpus surface a reconciler drives — structural, so a test can hand it a fake. */
|
|
16
|
+
interface ReconcileCorpus {
|
|
17
|
+
/** Re-ingest changed documents; `{}` is the full sweep that also reports corpus-level changes. */
|
|
18
|
+
sync(options: {
|
|
19
|
+
docId?: number;
|
|
20
|
+
}): Promise<unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* One `stat` per document; no file is read. ASYNC because it is a per-document walk that yields
|
|
23
|
+
* the event loop every batch (see `KnowledgeStore.corpusDrift`), so it is another `await`
|
|
24
|
+
* boundary at which `stop()` is honoured.
|
|
25
|
+
*/
|
|
26
|
+
corpusDrift(): Promise<{
|
|
27
|
+
changed: number[];
|
|
28
|
+
missing: number[];
|
|
29
|
+
fileSetChanged: boolean;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
/** What {@link createCorpusReconciler} needs from its caller. */
|
|
33
|
+
export interface ReconcileDeps {
|
|
34
|
+
corpus: ReconcileCorpus;
|
|
35
|
+
/** Minimum spacing between non-full checks (ms). */
|
|
36
|
+
minIntervalMs: number;
|
|
37
|
+
/** Called for a failed pass. The reconciler NEVER rethrows: a sync failure must not break the host. */
|
|
38
|
+
onError(error: unknown): void;
|
|
39
|
+
/** Clock seam (defaults to `Date.now`). */
|
|
40
|
+
now?(): number;
|
|
41
|
+
/** Timer seam (defaults to the global `setTimeout`); the handle is `unref`ed when it supports it. */
|
|
42
|
+
schedule?(fn: () => void, ms: number): ReturnType<typeof setTimeout>;
|
|
43
|
+
/** Timer-cancellation seam (defaults to the global `clearTimeout`). */
|
|
44
|
+
cancel?(handle: ReturnType<typeof setTimeout>): void;
|
|
45
|
+
}
|
|
46
|
+
/** The handle `index.ts` wires into an effect: request a check, and stop it on unmount. */
|
|
47
|
+
interface CorpusReconciler {
|
|
48
|
+
/** Run one check — `full` bypasses the throttle and takes the baseline after the sweep. */
|
|
49
|
+
request(full: boolean): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Stop permanently: no further pass starts, a scheduled trailing check is cancelled, and a pass
|
|
52
|
+
* already in flight exits at its next `await` boundary without touching the corpus again.
|
|
53
|
+
*/
|
|
54
|
+
stop(): void;
|
|
55
|
+
/** Whether a pass is currently in flight (diagnostics and the unmount test). */
|
|
56
|
+
readonly running: boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Build the reconciler. All state is closed over here, so a fresh mount gets a fresh one — the
|
|
60
|
+
* plugin can be unmounted and mounted again in one process.
|
|
61
|
+
*/
|
|
62
|
+
export declare function createCorpusReconciler(deps: ReconcileDeps): CorpusReconciler;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=reconcile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconcile.d.ts","sourceRoot":"","sources":["../../src/reconcile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,yFAAyF;AACzF,UAAU,eAAe;IACvB,kGAAkG;IAClG,IAAI,CAAC,OAAO,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACnD;;;;OAIG;IACH,WAAW,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,cAAc,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;CAC1F;AAED,iEAAiE;AACjE,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,eAAe,CAAA;IACvB,oDAAoD;IACpD,aAAa,EAAE,MAAM,CAAA;IACrB,uGAAuG;IACvG,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAA;IAC7B,2CAA2C;IAC3C,GAAG,CAAC,IAAI,MAAM,CAAA;IACd,qGAAqG;IACrG,QAAQ,CAAC,CAAC,EAAE,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAA;IACpE,uEAAuE;IACvE,MAAM,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG,IAAI,CAAA;CACrD;AAED,2FAA2F;AAC3F,UAAU,gBAAgB;IACxB,2FAA2F;IAC3F,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACrC;;;OAGG;IACH,IAAI,IAAI,IAAI,CAAA;IACZ,gFAAgF;IAChF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC1B;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,aAAa,GAAG,gBAAgB,CA8E5E"}
|
package/lib/types/remote.d.ts
CHANGED
|
@@ -1,8 +1,61 @@
|
|
|
1
1
|
import type { InvocationDescriptor, TypertRemoteContribution } from '@deepseek-ai/dsh-typert-protocol';
|
|
2
2
|
import type { TypertContribution } from '@deepseek-ai/dsh-typert-registry/types';
|
|
3
|
+
import type { RemoteErr, RemoteOk } from '../engine/mem-contract/index.js';
|
|
3
4
|
export declare const descriptors: readonly InvocationDescriptor[];
|
|
4
5
|
/** Client face: mounted by the client half through `ctx.remote.$mount()`. */
|
|
5
6
|
export declare const clientContribution: TypertRemoteContribution;
|
|
7
|
+
/**
|
|
8
|
+
* The revision of the Remote FACE `descriptors` publishes.
|
|
9
|
+
*
|
|
10
|
+
* WHY THIS EXISTS. The two halves of this plugin do not update together: the browser bundle is
|
|
11
|
+
* re-read on every page load, the host half only when `dsh web` starts. So a rebuilt client
|
|
12
|
+
* routinely talks to a host process loaded before a method existed, and the gateway answers an
|
|
13
|
+
* unpublished method with an HTTP 404 — which reads exactly like "the record or the file is gone",
|
|
14
|
+
* the two things it does NOT mean. Mission paid this tuition with a measured 404
|
|
15
|
+
* (`SNAPSHOT_WIRE_VERSION`); mem has the same skew with no marker at all. The host now stamps this
|
|
16
|
+
* number onto every application envelope (see `wireOk`/`wireErr`), and the client half reads it back
|
|
17
|
+
* (contract's `unwrapRemoteEnvelope`) so it can refuse to SEND a call the host cannot have, and say
|
|
18
|
+
* "restart dsh web" instead of surfacing a bare 404.
|
|
19
|
+
*
|
|
20
|
+
* WHY THE ENVELOPE AND NOT ONE METHOD'S PAYLOAD. Mission's `snapshot` is the panel's one entry point,
|
|
21
|
+
* so its marker rides that payload. mem has no such method: the 记忆 tab opens with `admin.list` and
|
|
22
|
+
* the 知识 tab with `kb.list`/`kb.domains`, either can be first, and neither is mandatory. The one
|
|
23
|
+
* object EVERY answer shares is the application envelope, so the revision rides there — same
|
|
24
|
+
* guarantee, stamped in the one place every method already goes through (`wireOk`/`wireErr`).
|
|
25
|
+
*
|
|
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.
|
|
32
|
+
*
|
|
33
|
+
* ABSENT MEANS OLD. An old host sends no `wire` at all; the client must treat that as "older than the
|
|
34
|
+
* marker", never as a decode failure — the answer is still readable.
|
|
35
|
+
*
|
|
36
|
+
* Revision history:
|
|
37
|
+
* - 1: the first marker. The face at this point is the ten methods in `descriptors`
|
|
38
|
+
* (remember / recall / admin / kb / query + openDoc / classifySource / browseDir / kbDomains /
|
|
39
|
+
* kbAddDomain), all of which predate the marker — so nothing is gated on revision 1; the mechanism
|
|
40
|
+
* exists for the NEXT method.
|
|
41
|
+
*/
|
|
42
|
+
export declare const WIRE_VERSION = 1;
|
|
43
|
+
/**
|
|
44
|
+
* The successful application envelope, with the wire revision stamped on.
|
|
45
|
+
*
|
|
46
|
+
* A helper rather than a literal at each return site (the shared `call` covers the five tool-backed
|
|
47
|
+
* methods; the five UI-only methods return directly): "every answer carries the marker" is then a
|
|
48
|
+
* property of the code, not of six copies staying in step. The result is structurally the contract's
|
|
49
|
+
* `RemoteOk`.
|
|
50
|
+
*/
|
|
51
|
+
export declare function wireOk<T>(value: T): RemoteOk<T>;
|
|
52
|
+
/**
|
|
53
|
+
* The failed application envelope, with the wire revision stamped on.
|
|
54
|
+
*
|
|
55
|
+
* Takes the failure body already built (`{ok:false, error}` / validation's `{ok:false,error,violations}`)
|
|
56
|
+
* so the message and violations keep coming from their existing single sources.
|
|
57
|
+
*/
|
|
58
|
+
export declare function wireErr(failure: Omit<RemoteErr, 'wire'>): RemoteErr;
|
|
6
59
|
/**
|
|
7
60
|
* Host face: registered by the host half through `ctx.typert.register()`.
|
|
8
61
|
*
|
|
@@ -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;
|
|
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"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE model-facing output boundary of the eight mem tools (`TOOL_SPECS`; `kb_manage` is
|
|
3
|
+
* `KB_TOOL`, the internal engine API the UI/CLI dispatch through, and is not part of the model
|
|
4
|
+
* surface).
|
|
5
|
+
*
|
|
6
|
+
* `output.render` is what the DSH tool runner calls to turn a result value into the text block the
|
|
7
|
+
* model reads, so this is the last code of ours the payload passes through before `JSON.stringify`.
|
|
8
|
+
* The recursion is there because the value can contain data this process did not just write: a row
|
|
9
|
+
* from a database an older build (or a different driver) filled, or a string derived by the
|
|
10
|
+
* tokenizer. `JSON.stringify` emits a lone surrogate as the escape `"\ud800"`, which JavaScript
|
|
11
|
+
* parses back but a strict parser rejects — repairing every string first means the text block is
|
|
12
|
+
* always strictly parseable, whatever the payload's provenance.
|
|
13
|
+
*
|
|
14
|
+
* The repair itself is NOT this module's: `toWellFormedDeep` resolves to the loaded base kit's
|
|
15
|
+
* implementation when the mount adopted it, and to `@avantf/mem-contract`'s mirror otherwise (see
|
|
16
|
+
* that module's note and `index.ts`'s `adoptWellFormed` call).
|
|
17
|
+
*
|
|
18
|
+
* Extracted from `index.ts` so the boundary is testable without the DSH harness: this module only
|
|
19
|
+
* type-imports the peer type, which is erased at transpile (see `vitest.config.ts`).
|
|
20
|
+
*
|
|
21
|
+
* @module plugin/render
|
|
22
|
+
*/
|
|
23
|
+
import type { JsonValue } from '@deepseek-ai/dsh-util-values';
|
|
24
|
+
/** The tool output spec registered on every mem tool. */
|
|
25
|
+
export declare const OUTPUT: {
|
|
26
|
+
readonly schema: {
|
|
27
|
+
readonly type: "object";
|
|
28
|
+
readonly additionalProperties: true;
|
|
29
|
+
};
|
|
30
|
+
readonly render: (_args: unknown, value: JsonValue) => {
|
|
31
|
+
type: "text";
|
|
32
|
+
text: string;
|
|
33
|
+
}[];
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAG7D,yDAAyD;AACzD,eAAO,MAAM,MAAM;;;;;6BAED,OAAO,SAAS,SAAS,KAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE;CAGpE,CAAA"}
|
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
import { type ToolSpec } from '
|
|
2
|
-
|
|
1
|
+
import { type ToolSpec } from '../engine/mem-contract/index.js';
|
|
2
|
+
type ParamSpec = {
|
|
3
3
|
type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
|
|
4
4
|
description?: string;
|
|
5
5
|
required?: true;
|
|
6
6
|
enum?: readonly string[];
|
|
7
7
|
items?: ParamSpec;
|
|
8
8
|
};
|
|
9
|
-
/** The slice of zod v4's `def` this derivation reads (structure only, never type tags). */
|
|
10
|
-
export interface ZodDef {
|
|
11
|
-
type?: string;
|
|
12
|
-
shape?: Record<string, unknown>;
|
|
13
|
-
options?: unknown[];
|
|
14
|
-
/** A literal's / enum's values; v4 keeps them in an array. */
|
|
15
|
-
values?: unknown;
|
|
16
|
-
}
|
|
17
|
-
export declare function zodDef(schema: unknown): ZodDef;
|
|
18
9
|
/** Nearest `description` on a schema (wrappers included — the converter already unwrapped them). */
|
|
19
10
|
export declare function schemaDescription(schema: unknown): string | undefined;
|
|
20
11
|
export declare function zodToSpec(schema: unknown): ParamSpec;
|
|
21
|
-
/** Materialize one zod object branch's fields, or undefined for a non-object. */
|
|
22
|
-
export declare function branchShape(schema: unknown): Record<string, unknown> | undefined;
|
|
23
12
|
/**
|
|
24
13
|
* Flatten a tool input schema into DSH's implicit parameter map. A discriminated
|
|
25
14
|
* union contributes one required `action` enum plus the merged field set (fields
|
|
@@ -37,4 +26,5 @@ export declare function branchShape(schema: unknown): Record<string, unknown> |
|
|
|
37
26
|
* descriptions, which is what keeps them in agreement field for field.
|
|
38
27
|
*/
|
|
39
28
|
export declare function flattenToolSpec(spec: ToolSpec): Record<string, ParamSpec>;
|
|
29
|
+
export {};
|
|
40
30
|
//# sourceMappingURL=tool_schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool_schema.d.ts","sourceRoot":"","sources":["../../src/tool_schema.ts"],"names":[],"mappings":"AAgBA,OAAO,EAA0B,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAE5E,
|
|
1
|
+
{"version":3,"file":"tool_schema.d.ts","sourceRoot":"","sources":["../../src/tool_schema.ts"],"names":[],"mappings":"AAgBA,OAAO,EAA0B,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAE5E,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAA;IACtE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,IAAI,CAAA;IACf,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACxB,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,CAAA;AA+BD,oGAAoG;AACpG,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAGrE;AAqBD,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAEpD;AAOD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAiDzE"}
|