@theglitchking/semantic-memory 1.0.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/.claude-plugin/marketplace.json +71 -0
- package/.claude-plugin/plugin.json +34 -0
- package/CHANGELOG.md +233 -0
- package/LICENSE +21 -0
- package/README.md +91 -0
- package/bin/semantic-memory +2 -0
- package/bin/semantic-sidekick +2 -0
- package/commands/healthcheck.md +6 -0
- package/commands/mode.md +65 -0
- package/commands/normalize-config.md +6 -0
- package/commands/policy.md +16 -0
- package/commands/relink.md +6 -0
- package/commands/status.md +6 -0
- package/commands/update.md +6 -0
- package/commands/vault.md +21 -0
- package/dist/chunk-25EIQWXL.js +651 -0
- package/dist/chunk-25EIQWXL.js.map +1 -0
- package/dist/chunk-CAN2GWUG.js +88 -0
- package/dist/chunk-CAN2GWUG.js.map +1 -0
- package/dist/chunk-CXTRTCIK.js +762 -0
- package/dist/chunk-CXTRTCIK.js.map +1 -0
- package/dist/chunk-E2Z4J4MK.js +180 -0
- package/dist/chunk-E2Z4J4MK.js.map +1 -0
- package/dist/chunk-HODDRXJK.js +169 -0
- package/dist/chunk-HODDRXJK.js.map +1 -0
- package/dist/chunk-JPQHNG3R.js +147 -0
- package/dist/chunk-JPQHNG3R.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +505 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/embed-worker.d.ts +2 -0
- package/dist/core/embed-worker.js +121 -0
- package/dist/core/embed-worker.js.map +1 -0
- package/dist/core/index.d.ts +486 -0
- package/dist/core/index.js +62 -0
- package/dist/core/index.js.map +1 -0
- package/dist/indexer-KD6UTXZB.js +8 -0
- package/dist/indexer-KD6UTXZB.js.map +1 -0
- package/dist/lint-GMXQF4RW.js +11 -0
- package/dist/lint-GMXQF4RW.js.map +1 -0
- package/dist/log-LQXIJXIA.js +10 -0
- package/dist/log-LQXIJXIA.js.map +1 -0
- package/dist/mcp/server.d.ts +16 -0
- package/dist/mcp/server.js +4925 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/schema-F3RTY6SQ.js +12 -0
- package/dist/schema-F3RTY6SQ.js.map +1 -0
- package/dist/search-27WYAI24.js +202 -0
- package/dist/search-27WYAI24.js.map +1 -0
- package/docs/compat-matrix.md +127 -0
- package/docs/corpora-json.md +150 -0
- package/docs/regression-snapshot.md +122 -0
- package/docs/smart-middle-activation.md +97 -0
- package/hooks/hooks.json +39 -0
- package/hooks/reconcile.js +171 -0
- package/hooks/session-start.js +81 -0
- package/hooks/vault-context.js +503 -0
- package/package.json +97 -0
- package/scripts/link-skills.js +25 -0
- package/scripts/pre-commit-lint.sh +42 -0
- package/skills/outage-silence/SKILL.md +72 -0
- package/skills/research-mode/SKILL.md +84 -0
- package/skills/semantic-first/SKILL.md +117 -0
- package/skills/semantic-first/evals/evals.json +37 -0
- package/skills/semantic-first/references/vault-frontmatter.md +133 -0
- package/skills/vault-first/SKILL.md +100 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// src/core/embed-worker.ts
|
|
2
|
+
import { parentPort, workerData } from "worker_threads";
|
|
3
|
+
import { AutoTokenizer } from "@huggingface/transformers";
|
|
4
|
+
var { modelPath, modelName, cacheDir, runtimeLabel, batchSize = 32 } = workerData;
|
|
5
|
+
function meanPoolAndNormalizeMany(outputData, maskData, batchSize2, seqLen, hiddenSize) {
|
|
6
|
+
const results = [];
|
|
7
|
+
for (let b = 0; b < batchSize2; b++) {
|
|
8
|
+
const result = new Float32Array(hiddenSize);
|
|
9
|
+
let maskSum = 0;
|
|
10
|
+
for (let t = 0; t < seqLen; t++) {
|
|
11
|
+
const mask = maskData[b * seqLen + t];
|
|
12
|
+
maskSum += mask;
|
|
13
|
+
const offset = (b * seqLen + t) * hiddenSize;
|
|
14
|
+
for (let d = 0; d < hiddenSize; d++) {
|
|
15
|
+
result[d] += outputData[offset + d] * mask;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (maskSum > 0) {
|
|
19
|
+
for (let d = 0; d < hiddenSize; d++) result[d] /= maskSum;
|
|
20
|
+
}
|
|
21
|
+
let norm = 0;
|
|
22
|
+
for (let d = 0; d < hiddenSize; d++) norm += result[d] * result[d];
|
|
23
|
+
norm = Math.sqrt(norm);
|
|
24
|
+
if (norm > 0) {
|
|
25
|
+
for (let d = 0; d < hiddenSize; d++) result[d] /= norm;
|
|
26
|
+
}
|
|
27
|
+
results.push(result);
|
|
28
|
+
}
|
|
29
|
+
return results;
|
|
30
|
+
}
|
|
31
|
+
async function init() {
|
|
32
|
+
let ort;
|
|
33
|
+
try {
|
|
34
|
+
if (runtimeLabel === "native") {
|
|
35
|
+
ort = await import("onnxruntime-node");
|
|
36
|
+
} else {
|
|
37
|
+
ort = await import("onnxruntime-web");
|
|
38
|
+
}
|
|
39
|
+
} catch {
|
|
40
|
+
ort = await import("onnxruntime-web");
|
|
41
|
+
}
|
|
42
|
+
const tokenizer = await AutoTokenizer.from_pretrained(modelName, { cache_dir: cacheDir });
|
|
43
|
+
const session = await ort.InferenceSession.create(modelPath, {
|
|
44
|
+
executionProviders: [runtimeLabel === "native" ? "cpu" : "wasm"]
|
|
45
|
+
});
|
|
46
|
+
const needsTokenTypeIds = session.inputNames.includes("token_type_ids");
|
|
47
|
+
const outputName = session.outputNames[0];
|
|
48
|
+
parentPort.postMessage({ type: "ready" });
|
|
49
|
+
parentPort.on("message", async (msg) => {
|
|
50
|
+
if (msg.type !== "embed") return;
|
|
51
|
+
try {
|
|
52
|
+
const embeddings = [];
|
|
53
|
+
let totalDone = 0;
|
|
54
|
+
for (let i = 0; i < msg.texts.length; i += batchSize) {
|
|
55
|
+
const subBatch = msg.texts.slice(i, i + batchSize);
|
|
56
|
+
const n = subBatch.length;
|
|
57
|
+
const encodings = await Promise.all(
|
|
58
|
+
subBatch.map(
|
|
59
|
+
(text) => tokenizer(text, { padding: false, truncation: true, max_length: 512, return_tensor: false })
|
|
60
|
+
)
|
|
61
|
+
);
|
|
62
|
+
const tokenized = encodings.map((enc) => ({
|
|
63
|
+
ids: Array.from(enc.input_ids.data ?? enc.input_ids),
|
|
64
|
+
mask: Array.from(enc.attention_mask.data ?? enc.attention_mask)
|
|
65
|
+
}));
|
|
66
|
+
const seqLen = Math.max(...tokenized.map((t) => t.ids.length));
|
|
67
|
+
const flatIds = new BigInt64Array(n * seqLen);
|
|
68
|
+
const flatMask = new BigInt64Array(n * seqLen);
|
|
69
|
+
const flatMaskNums = new Array(n * seqLen).fill(0);
|
|
70
|
+
for (let b = 0; b < n; b++) {
|
|
71
|
+
const { ids, mask } = tokenized[b];
|
|
72
|
+
for (let j = 0; j < ids.length; j++) {
|
|
73
|
+
flatIds[b * seqLen + j] = BigInt(ids[j]);
|
|
74
|
+
flatMask[b * seqLen + j] = BigInt(mask[j]);
|
|
75
|
+
flatMaskNums[b * seqLen + j] = mask[j];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const inputIds = new ort.Tensor("int64", flatIds, [n, seqLen]);
|
|
79
|
+
const attentionMask = new ort.Tensor("int64", flatMask, [n, seqLen]);
|
|
80
|
+
const feeds = { input_ids: inputIds, attention_mask: attentionMask };
|
|
81
|
+
if (needsTokenTypeIds) {
|
|
82
|
+
feeds.token_type_ids = new ort.Tensor("int64", new BigInt64Array(n * seqLen), [n, seqLen]);
|
|
83
|
+
}
|
|
84
|
+
const output = await session.run(feeds);
|
|
85
|
+
const outputTensor = output[outputName];
|
|
86
|
+
const hiddenSize = outputTensor.dims[outputTensor.dims.length - 1];
|
|
87
|
+
const batchEmbeddings = meanPoolAndNormalizeMany(
|
|
88
|
+
outputTensor.data,
|
|
89
|
+
flatMaskNums,
|
|
90
|
+
n,
|
|
91
|
+
seqLen,
|
|
92
|
+
hiddenSize
|
|
93
|
+
);
|
|
94
|
+
for (const emb of batchEmbeddings) {
|
|
95
|
+
embeddings.push(emb);
|
|
96
|
+
totalDone++;
|
|
97
|
+
parentPort.postMessage({
|
|
98
|
+
type: "progress",
|
|
99
|
+
done: totalDone,
|
|
100
|
+
total: msg.texts.length,
|
|
101
|
+
startIndex: msg.startIndex
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
parentPort.postMessage({
|
|
106
|
+
type: "result",
|
|
107
|
+
embeddings,
|
|
108
|
+
startIndex: msg.startIndex
|
|
109
|
+
});
|
|
110
|
+
} catch (err) {
|
|
111
|
+
parentPort.postMessage({
|
|
112
|
+
type: "error",
|
|
113
|
+
error: err?.message ?? String(err)
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
init().catch((err) => {
|
|
119
|
+
parentPort.postMessage({ type: "error", error: err?.message ?? String(err) });
|
|
120
|
+
});
|
|
121
|
+
//# sourceMappingURL=embed-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/embed-worker.ts"],"sourcesContent":["import { parentPort, workerData } from \"node:worker_threads\";\nimport { AutoTokenizer } from \"@huggingface/transformers\";\n\ninterface WorkerData {\n modelPath: string;\n modelName: string;\n cacheDir: string;\n runtimeLabel: \"native\" | \"wasm\";\n batchSize: number;\n}\n\ninterface WorkMessage {\n type: \"embed\";\n texts: string[];\n startIndex: number;\n}\n\ninterface ResultMessage {\n type: \"result\";\n embeddings: Float32Array[];\n startIndex: number;\n}\n\ninterface ProgressMessage {\n type: \"progress\";\n done: number;\n total: number;\n startIndex: number;\n}\n\ninterface ErrorMessage {\n type: \"error\";\n error: string;\n}\n\ninterface ReadyMessage {\n type: \"ready\";\n}\n\nconst { modelPath, modelName, cacheDir, runtimeLabel, batchSize = 32 } = workerData as WorkerData;\n\nfunction meanPoolAndNormalizeMany(\n outputData: Float32Array,\n maskData: number[],\n batchSize: number,\n seqLen: number,\n hiddenSize: number\n): Float32Array[] {\n const results: Float32Array[] = [];\n for (let b = 0; b < batchSize; b++) {\n const result = new Float32Array(hiddenSize);\n let maskSum = 0;\n for (let t = 0; t < seqLen; t++) {\n const mask = maskData[b * seqLen + t];\n maskSum += mask;\n const offset = (b * seqLen + t) * hiddenSize;\n for (let d = 0; d < hiddenSize; d++) {\n result[d] += (outputData as Float32Array)[offset + d] * mask;\n }\n }\n if (maskSum > 0) {\n for (let d = 0; d < hiddenSize; d++) result[d] /= maskSum;\n }\n let norm = 0;\n for (let d = 0; d < hiddenSize; d++) norm += result[d] * result[d];\n norm = Math.sqrt(norm);\n if (norm > 0) {\n for (let d = 0; d < hiddenSize; d++) result[d] /= norm;\n }\n results.push(result);\n }\n return results;\n}\n\nasync function init() {\n // Resolve ONNX runtime\n let ort: any;\n try {\n if (runtimeLabel === \"native\") {\n ort = await import(\"onnxruntime-node\");\n } else {\n ort = await import(\"onnxruntime-web\");\n }\n } catch {\n ort = await import(\"onnxruntime-web\");\n }\n\n // Load tokenizer and session\n const tokenizer = await AutoTokenizer.from_pretrained(modelName, { cache_dir: cacheDir });\n const session = await ort.InferenceSession.create(modelPath, {\n executionProviders: [runtimeLabel === \"native\" ? \"cpu\" : \"wasm\"],\n });\n\n const needsTokenTypeIds = session.inputNames.includes(\"token_type_ids\");\n const outputName = session.outputNames[0];\n\n parentPort!.postMessage({ type: \"ready\" } as ReadyMessage);\n\n parentPort!.on(\"message\", async (msg: WorkMessage) => {\n if (msg.type !== \"embed\") return;\n\n try {\n const embeddings: Float32Array[] = [];\n let totalDone = 0;\n\n // Process texts in sub-batches\n for (let i = 0; i < msg.texts.length; i += batchSize) {\n const subBatch = msg.texts.slice(i, i + batchSize);\n const n = subBatch.length;\n\n // Tokenize individually to avoid ambiguous batch tokenizer output format\n const encodings = await Promise.all(\n subBatch.map((text: string) =>\n tokenizer(text, { padding: false, truncation: true, max_length: 512, return_tensor: false })\n )\n );\n const tokenized = encodings.map((enc: any) => ({\n ids: Array.from(enc.input_ids.data ?? enc.input_ids) as number[],\n mask: Array.from(enc.attention_mask.data ?? enc.attention_mask) as number[],\n }));\n const seqLen = Math.max(...tokenized.map((t: any) => t.ids.length));\n\n const flatIds = new BigInt64Array(n * seqLen);\n const flatMask = new BigInt64Array(n * seqLen);\n const flatMaskNums = new Array<number>(n * seqLen).fill(0);\n for (let b = 0; b < n; b++) {\n const { ids, mask } = tokenized[b];\n for (let j = 0; j < ids.length; j++) {\n flatIds[b * seqLen + j] = BigInt(ids[j]);\n flatMask[b * seqLen + j] = BigInt(mask[j]);\n flatMaskNums[b * seqLen + j] = mask[j];\n }\n }\n\n const inputIds = new ort.Tensor(\"int64\", flatIds, [n, seqLen]);\n const attentionMask = new ort.Tensor(\"int64\", flatMask, [n, seqLen]);\n\n const feeds: Record<string, any> = { input_ids: inputIds, attention_mask: attentionMask };\n if (needsTokenTypeIds) {\n feeds.token_type_ids = new ort.Tensor(\"int64\", new BigInt64Array(n * seqLen), [n, seqLen]);\n }\n\n const output = await session.run(feeds);\n const outputTensor = output[outputName];\n const hiddenSize = outputTensor.dims[outputTensor.dims.length - 1];\n\n const batchEmbeddings = meanPoolAndNormalizeMany(\n outputTensor.data as Float32Array,\n flatMaskNums,\n n,\n seqLen,\n hiddenSize\n );\n\n for (const emb of batchEmbeddings) {\n embeddings.push(emb);\n totalDone++;\n parentPort!.postMessage({\n type: \"progress\",\n done: totalDone,\n total: msg.texts.length,\n startIndex: msg.startIndex,\n } as ProgressMessage);\n }\n }\n\n parentPort!.postMessage({\n type: \"result\",\n embeddings,\n startIndex: msg.startIndex,\n } as ResultMessage);\n } catch (err: any) {\n parentPort!.postMessage({\n type: \"error\",\n error: err?.message ?? String(err),\n } as ErrorMessage);\n }\n });\n}\n\ninit().catch((err) => {\n parentPort!.postMessage({ type: \"error\", error: err?.message ?? String(err) } as ErrorMessage);\n});\n"],"mappings":";AAAA,SAAS,YAAY,kBAAkB;AACvC,SAAS,qBAAqB;AAsC9B,IAAM,EAAE,WAAW,WAAW,UAAU,cAAc,YAAY,GAAG,IAAI;AAEzE,SAAS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|
+
import Graph from 'graphology';
|
|
2
|
+
import { EventEmitter } from 'node:events';
|
|
3
|
+
|
|
4
|
+
interface IndexedDocument {
|
|
5
|
+
path: string;
|
|
6
|
+
title: string;
|
|
7
|
+
content: string;
|
|
8
|
+
frontmatter: Record<string, unknown>;
|
|
9
|
+
wikilinks: string[];
|
|
10
|
+
tags: string[];
|
|
11
|
+
headers: string[];
|
|
12
|
+
chunks: string[];
|
|
13
|
+
/** ISO timestamp — prefers frontmatter last_updated/updated/date/lastmod, falls back to fs.stat mtime */
|
|
14
|
+
mtime: string;
|
|
15
|
+
loadPriority?: number;
|
|
16
|
+
status?: string;
|
|
17
|
+
tier?: string;
|
|
18
|
+
domains?: string[];
|
|
19
|
+
purpose?: string;
|
|
20
|
+
relatedDocs?: string[];
|
|
21
|
+
}
|
|
22
|
+
interface SearchResult {
|
|
23
|
+
path: string;
|
|
24
|
+
title: string;
|
|
25
|
+
score: number;
|
|
26
|
+
snippet: string;
|
|
27
|
+
matchedChunk?: string;
|
|
28
|
+
mtime?: string;
|
|
29
|
+
loadPriority?: number;
|
|
30
|
+
status?: string;
|
|
31
|
+
tier?: string;
|
|
32
|
+
domains?: string[];
|
|
33
|
+
}
|
|
34
|
+
interface GraphNode {
|
|
35
|
+
path: string;
|
|
36
|
+
title: string;
|
|
37
|
+
tags: string[];
|
|
38
|
+
linkCount: number;
|
|
39
|
+
backlinkCount: number;
|
|
40
|
+
loadPriority?: number;
|
|
41
|
+
status?: string;
|
|
42
|
+
}
|
|
43
|
+
interface GraphEdge {
|
|
44
|
+
source: string;
|
|
45
|
+
target: string;
|
|
46
|
+
type: "wikilink" | "tag" | "backlink";
|
|
47
|
+
weight: number;
|
|
48
|
+
}
|
|
49
|
+
interface GraphStats {
|
|
50
|
+
totalNodes: number;
|
|
51
|
+
totalEdges: number;
|
|
52
|
+
orphanCount: number;
|
|
53
|
+
mostConnected: Array<{
|
|
54
|
+
path: string;
|
|
55
|
+
connections: number;
|
|
56
|
+
}>;
|
|
57
|
+
density: number;
|
|
58
|
+
}
|
|
59
|
+
type IndexState = "empty" | "loading" | "stale" | "indexing" | "ready";
|
|
60
|
+
interface VaultStats {
|
|
61
|
+
totalNotes: number;
|
|
62
|
+
totalChunks: number;
|
|
63
|
+
totalEmbeddings: number;
|
|
64
|
+
embeddingDimensions: number;
|
|
65
|
+
embeddingModel: string;
|
|
66
|
+
embeddingRuntime: "native" | "wasm" | "unknown";
|
|
67
|
+
graphNodes: number;
|
|
68
|
+
graphEdges: number;
|
|
69
|
+
indexSize: number;
|
|
70
|
+
lastIndexed: string | null;
|
|
71
|
+
indexState: IndexState;
|
|
72
|
+
indexProgress?: {
|
|
73
|
+
embedded: number;
|
|
74
|
+
total: number;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
interface UpdateNoteOptions {
|
|
78
|
+
mode: "overwrite" | "append" | "prepend" | "patch-by-heading";
|
|
79
|
+
heading?: string;
|
|
80
|
+
}
|
|
81
|
+
interface SearchTextOptions {
|
|
82
|
+
pattern: string;
|
|
83
|
+
regex?: boolean;
|
|
84
|
+
caseSensitive?: boolean;
|
|
85
|
+
pathGlob?: string;
|
|
86
|
+
tagFilter?: string[];
|
|
87
|
+
limit?: number;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
declare class Indexer {
|
|
91
|
+
private notesPath;
|
|
92
|
+
private processor;
|
|
93
|
+
constructor(notesPath: string);
|
|
94
|
+
indexAll(): Promise<IndexedDocument[]>;
|
|
95
|
+
/**
|
|
96
|
+
* Load parsed-doc cache from disk. Returns null if missing or unreadable.
|
|
97
|
+
* The cache is a verbatim JSON dump of a prior indexAll() result, written by
|
|
98
|
+
* saveDocsCache. Consumers (search CLI / hook path) prefer this over re-parsing
|
|
99
|
+
* 500+ markdown files; the tradeoff is that cache may be stale if the vault
|
|
100
|
+
* changed since the last reindex — same staleness window as the vector cache.
|
|
101
|
+
*/
|
|
102
|
+
loadDocsCache(indexPath: string): Promise<IndexedDocument[] | null>;
|
|
103
|
+
saveDocsCache(indexPath: string, docs: IndexedDocument[]): Promise<void>;
|
|
104
|
+
indexFile(absolutePath: string, relativePath: string): Promise<IndexedDocument>;
|
|
105
|
+
/**
|
|
106
|
+
* Resolve the best available modification date for a document.
|
|
107
|
+
* Priority: last_updated → updated → date → lastmod → fs.stat mtime
|
|
108
|
+
* Accepts YYYY-MM-DD strings or full ISO timestamps.
|
|
109
|
+
*/
|
|
110
|
+
private resolveMtime;
|
|
111
|
+
private extractWikilinks;
|
|
112
|
+
private extractTags;
|
|
113
|
+
private extractHeaders;
|
|
114
|
+
private nodeToText;
|
|
115
|
+
private stripMarkdown;
|
|
116
|
+
chunkText(text: string): string[];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
type RuntimeLabel = "native" | "wasm";
|
|
120
|
+
declare class Embedder {
|
|
121
|
+
private model;
|
|
122
|
+
private session;
|
|
123
|
+
private tokenizer;
|
|
124
|
+
private ort;
|
|
125
|
+
private dimensions;
|
|
126
|
+
private runtimeLabel;
|
|
127
|
+
private initialized;
|
|
128
|
+
private numWorkers;
|
|
129
|
+
private batchSize;
|
|
130
|
+
private quantized;
|
|
131
|
+
private modelPath;
|
|
132
|
+
constructor(model?: string, numWorkers?: number, batchSize?: number, quantized?: boolean);
|
|
133
|
+
init(): Promise<void>;
|
|
134
|
+
embed(text: string): Promise<Float32Array>;
|
|
135
|
+
private meanPoolAndNormalize;
|
|
136
|
+
private meanPoolAndNormalizeMany;
|
|
137
|
+
private embedSubBatch;
|
|
138
|
+
embedBatch(texts: string[], onProgress?: (embedded: number, total: number, subBatch?: Float32Array[]) => Promise<void> | void): Promise<Float32Array[]>;
|
|
139
|
+
private embedBatchParallel;
|
|
140
|
+
getDimensions(): number;
|
|
141
|
+
getModel(): string;
|
|
142
|
+
getRuntime(): RuntimeLabel;
|
|
143
|
+
saveEmbeddings(embeddings: Map<string, Float32Array>, indexPath: string): Promise<void>;
|
|
144
|
+
loadEmbeddings(indexPath: string): Promise<Map<string, Float32Array>>;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
declare class GraphBuilder {
|
|
148
|
+
private graph;
|
|
149
|
+
constructor();
|
|
150
|
+
buildFromDocuments(documents: IndexedDocument[]): void;
|
|
151
|
+
backlinks(notePath: string): GraphNode[];
|
|
152
|
+
forwardlinks(notePath: string): GraphNode[];
|
|
153
|
+
findPath(from: string, to: string): string[] | null;
|
|
154
|
+
searchGraph(concept: string, maxDepth?: number, limit?: number): GraphNode[];
|
|
155
|
+
statistics(): GraphStats;
|
|
156
|
+
private nodeToGraphNode;
|
|
157
|
+
save(indexPath: string): Promise<void>;
|
|
158
|
+
load(indexPath: string): Promise<boolean>;
|
|
159
|
+
getGraph(): Graph;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
interface ChunkMeta {
|
|
163
|
+
docPath: string;
|
|
164
|
+
chunkIndex: number;
|
|
165
|
+
text: string;
|
|
166
|
+
}
|
|
167
|
+
declare class VectorIndex {
|
|
168
|
+
private index;
|
|
169
|
+
private dimensions;
|
|
170
|
+
private chunkMeta;
|
|
171
|
+
constructor(dimensions: number);
|
|
172
|
+
build(embeddings: Float32Array[], meta: ChunkMeta[]): void;
|
|
173
|
+
search(queryEmbedding: Float32Array, k?: number): SearchResult[];
|
|
174
|
+
save(indexPath: string): Promise<void>;
|
|
175
|
+
load(indexPath: string): Promise<boolean>;
|
|
176
|
+
getChunkMeta(): ChunkMeta[];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
declare class TextSearch {
|
|
180
|
+
private documents;
|
|
181
|
+
setDocuments(documents: IndexedDocument[]): void;
|
|
182
|
+
search(options: SearchTextOptions): SearchResult[];
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
declare class NoteCrud {
|
|
186
|
+
private notesPath;
|
|
187
|
+
constructor(notesPath: string);
|
|
188
|
+
create(relativePath: string, content: string, frontmatter?: Record<string, unknown>): Promise<string>;
|
|
189
|
+
read(relativePath: string): Promise<string>;
|
|
190
|
+
readMultiple(paths: string[]): Promise<Map<string, string>>;
|
|
191
|
+
update(relativePath: string, content: string, options: UpdateNoteOptions): Promise<void>;
|
|
192
|
+
delete(relativePath: string): Promise<void>;
|
|
193
|
+
move(fromPath: string, toPath: string): Promise<void>;
|
|
194
|
+
private updateWikilinksAfterMove;
|
|
195
|
+
private patchByHeading;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
declare class FrontmatterManager {
|
|
199
|
+
private notesPath;
|
|
200
|
+
constructor(notesPath: string);
|
|
201
|
+
get(relativePath: string): Promise<Record<string, unknown>>;
|
|
202
|
+
update(relativePath: string, fields: Record<string, unknown>): Promise<void>;
|
|
203
|
+
}
|
|
204
|
+
declare class TagManager {
|
|
205
|
+
private notesPath;
|
|
206
|
+
constructor(notesPath: string);
|
|
207
|
+
list(relativePath: string): Promise<string[]>;
|
|
208
|
+
add(relativePath: string, tags: string[]): Promise<void>;
|
|
209
|
+
remove(relativePath: string, tags: string[]): Promise<void>;
|
|
210
|
+
renameVaultWide(oldTag: string, newTag: string): Promise<number>;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
declare class Watcher extends EventEmitter {
|
|
214
|
+
private notesPath;
|
|
215
|
+
private fsWatcher;
|
|
216
|
+
private debounceMs;
|
|
217
|
+
private pendingChanges;
|
|
218
|
+
private debounceTimer;
|
|
219
|
+
private readyPromise;
|
|
220
|
+
private usePolling;
|
|
221
|
+
constructor(notesPath: string, debounceMs?: number, usePolling?: boolean);
|
|
222
|
+
start(): void;
|
|
223
|
+
ready(): Promise<void>;
|
|
224
|
+
stop(): void;
|
|
225
|
+
private enqueue;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
interface VaultSchema {
|
|
229
|
+
version: number;
|
|
230
|
+
provenance_fields: string[];
|
|
231
|
+
status_enum: string[];
|
|
232
|
+
confidence_enum: string[];
|
|
233
|
+
severity_enum: string[];
|
|
234
|
+
types: Record<string, {
|
|
235
|
+
description?: string;
|
|
236
|
+
required: string[];
|
|
237
|
+
}>;
|
|
238
|
+
lint: {
|
|
239
|
+
missing_provenance: {
|
|
240
|
+
applies_to: string[];
|
|
241
|
+
severity: "warn" | "error";
|
|
242
|
+
};
|
|
243
|
+
stale: {
|
|
244
|
+
max_age_days: number;
|
|
245
|
+
severity: "warn" | "error";
|
|
246
|
+
};
|
|
247
|
+
schema_violations: {
|
|
248
|
+
severity: "warn" | "error";
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
type Severity = "warn" | "error";
|
|
253
|
+
interface LintFinding {
|
|
254
|
+
path: string;
|
|
255
|
+
rule: "missing_provenance" | "stale" | "schema_violations" | "broken_links";
|
|
256
|
+
severity: Severity;
|
|
257
|
+
message: string;
|
|
258
|
+
}
|
|
259
|
+
declare function loadSchema(vaultPath: string): Promise<VaultSchema>;
|
|
260
|
+
/**
|
|
261
|
+
* Bootstrap the schema file in a vault by writing the default if none exists.
|
|
262
|
+
* Used by the `--install-schema` CLI flag. Returns the path that was (or would be) written.
|
|
263
|
+
*/
|
|
264
|
+
declare function installDefaultSchema(vaultPath: string, force?: boolean): Promise<{
|
|
265
|
+
written: boolean;
|
|
266
|
+
path: string;
|
|
267
|
+
}>;
|
|
268
|
+
/**
|
|
269
|
+
* Validate a single note's frontmatter + content against the schema.
|
|
270
|
+
* Returns findings (possibly empty). Does NOT throw — lint never throws.
|
|
271
|
+
*/
|
|
272
|
+
declare function validateNote(relativePath: string, rawFileContent: string, schema: VaultSchema, opts?: {
|
|
273
|
+
todayIso?: string;
|
|
274
|
+
}): LintFinding[];
|
|
275
|
+
|
|
276
|
+
declare const INDEX_FILE = "INDEX.md";
|
|
277
|
+
declare const INDEX_OVERFLOW_THRESHOLD = 100;
|
|
278
|
+
interface IndexEntry {
|
|
279
|
+
path: string;
|
|
280
|
+
title: string;
|
|
281
|
+
summary?: string;
|
|
282
|
+
}
|
|
283
|
+
interface RegenResult {
|
|
284
|
+
directory: string;
|
|
285
|
+
indexPath: string;
|
|
286
|
+
entryCount: number;
|
|
287
|
+
overflowed: boolean;
|
|
288
|
+
wrote: boolean;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Regenerate INDEX.md for a single vault directory.
|
|
292
|
+
* Lists every *.md file in the directory (non-recursive, excluding the index itself)
|
|
293
|
+
* with its title (frontmatter or first heading) and optional summary (from frontmatter
|
|
294
|
+
* `purpose` or first non-heading paragraph).
|
|
295
|
+
*/
|
|
296
|
+
declare function regenDirectoryIndex(vaultPath: string, dirRel: string): Promise<RegenResult>;
|
|
297
|
+
/**
|
|
298
|
+
* Regenerate indexes for every directory affected by a set of paths.
|
|
299
|
+
* Walks up the parent chain for each input so a deep change at
|
|
300
|
+
* `a/b/c/note.md` regenerates `a/b/c/INDEX.md`. Does NOT recurse further —
|
|
301
|
+
* `a/b/INDEX.md` stays as-is unless a path under `a/b/` (not `a/b/c/`)
|
|
302
|
+
* also changed.
|
|
303
|
+
*/
|
|
304
|
+
declare function regenIndexesForPaths(vaultPath: string, paths: string[]): Promise<RegenResult[]>;
|
|
305
|
+
|
|
306
|
+
interface PatchCreate {
|
|
307
|
+
path: string;
|
|
308
|
+
content: string;
|
|
309
|
+
frontmatter?: Record<string, unknown>;
|
|
310
|
+
}
|
|
311
|
+
interface PatchUpdate {
|
|
312
|
+
path: string;
|
|
313
|
+
content: string;
|
|
314
|
+
mode: UpdateNoteOptions["mode"];
|
|
315
|
+
heading?: string;
|
|
316
|
+
}
|
|
317
|
+
interface PatchDelete {
|
|
318
|
+
path: string;
|
|
319
|
+
}
|
|
320
|
+
interface PatchMove {
|
|
321
|
+
from: string;
|
|
322
|
+
to: string;
|
|
323
|
+
}
|
|
324
|
+
interface ChangeSet {
|
|
325
|
+
creates?: PatchCreate[];
|
|
326
|
+
updates?: PatchUpdate[];
|
|
327
|
+
deletes?: PatchDelete[];
|
|
328
|
+
moves?: PatchMove[];
|
|
329
|
+
}
|
|
330
|
+
interface ApplyPatchOptions {
|
|
331
|
+
dryRun?: boolean;
|
|
332
|
+
validate?: boolean;
|
|
333
|
+
allowLintWarnings?: boolean;
|
|
334
|
+
/** Regenerate INDEX.md in directories touched by this patch. Default: true. */
|
|
335
|
+
regenIndexes?: boolean;
|
|
336
|
+
}
|
|
337
|
+
interface AppliedOp {
|
|
338
|
+
op: "create" | "update" | "delete" | "move";
|
|
339
|
+
path: string;
|
|
340
|
+
}
|
|
341
|
+
interface ApplyPatchResult {
|
|
342
|
+
ok: boolean;
|
|
343
|
+
applied: AppliedOp[];
|
|
344
|
+
rolledBack: AppliedOp[];
|
|
345
|
+
lint: LintFinding[];
|
|
346
|
+
errors: string[];
|
|
347
|
+
/** Index files regenerated as a side-effect. Empty if regenIndexes=false or dry-run. */
|
|
348
|
+
indexes_regenerated?: RegenResult[];
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Atomic multi-note patch with rollback. Applies creates → updates → moves → deletes
|
|
352
|
+
* in that order. If any op fails, all successful ops before it are reverted in reverse.
|
|
353
|
+
*
|
|
354
|
+
* In dry-run mode, nothing is written; the result describes what would have happened,
|
|
355
|
+
* including lint findings on the proposed state.
|
|
356
|
+
*/
|
|
357
|
+
declare function applyPatch(notesPath: string, changeset: ChangeSet, options?: ApplyPatchOptions): Promise<ApplyPatchResult>;
|
|
358
|
+
|
|
359
|
+
interface IngestSource {
|
|
360
|
+
/** Identifier of the source — URL, filesystem path, DOI, ISBN, etc. */
|
|
361
|
+
source_uri: string;
|
|
362
|
+
/** Human-readable title for the source-note's frontmatter */
|
|
363
|
+
source_title: string;
|
|
364
|
+
/** One of the schema types; typically "source" */
|
|
365
|
+
source_type?: string;
|
|
366
|
+
/** Path under the vault to write the source-note. Defaults to `sources/<slug>.md`. */
|
|
367
|
+
source_path?: string;
|
|
368
|
+
/** Free-form body for the source-note (summary, abstract, your notes on it) */
|
|
369
|
+
source_summary?: string;
|
|
370
|
+
/** Tags for the source-note */
|
|
371
|
+
source_tags?: string[];
|
|
372
|
+
}
|
|
373
|
+
interface IngestUnit {
|
|
374
|
+
/** Path under the vault where this extracted note should live */
|
|
375
|
+
path: string;
|
|
376
|
+
/** Note title — if absent, derived from basename */
|
|
377
|
+
title?: string;
|
|
378
|
+
/** Note body — markdown */
|
|
379
|
+
content: string;
|
|
380
|
+
/** Schema type. Default: "note". */
|
|
381
|
+
type?: string;
|
|
382
|
+
/** Additional wikilink-style derived_from targets beyond the source-note */
|
|
383
|
+
extra_derived_from?: string[];
|
|
384
|
+
/** Additional free-form frontmatter fields */
|
|
385
|
+
extra_frontmatter?: Record<string, unknown>;
|
|
386
|
+
/** Per-unit confidence override */
|
|
387
|
+
confidence?: string;
|
|
388
|
+
}
|
|
389
|
+
interface IngestInput {
|
|
390
|
+
source: IngestSource;
|
|
391
|
+
units: IngestUnit[];
|
|
392
|
+
/** If true, the existing source-note is updated if present; else an error is raised */
|
|
393
|
+
allow_existing_source?: boolean;
|
|
394
|
+
}
|
|
395
|
+
interface IngestPreview {
|
|
396
|
+
changeset: ChangeSet;
|
|
397
|
+
sourcePath: string;
|
|
398
|
+
unitPaths: string[];
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Build a ChangeSet for ingesting a source into the vault.
|
|
402
|
+
*
|
|
403
|
+
* Shape: one create for the source-note (type=source) + one create per unit,
|
|
404
|
+
* each stamped with `derived_from: [<source-path>]` so lint.missing_provenance
|
|
405
|
+
* is satisfied automatically and the graph reflects the provenance edge.
|
|
406
|
+
*
|
|
407
|
+
* Intentionally does NOT touch the filesystem — callers route the result
|
|
408
|
+
* through applyPatch for atomicity, validation, and rollback.
|
|
409
|
+
*/
|
|
410
|
+
declare function buildIngestChangeSet(input: IngestInput): IngestPreview;
|
|
411
|
+
|
|
412
|
+
interface LogEventInput {
|
|
413
|
+
kind: string;
|
|
414
|
+
summary: string;
|
|
415
|
+
payload?: Record<string, unknown>;
|
|
416
|
+
ts?: string;
|
|
417
|
+
}
|
|
418
|
+
interface LogEntry {
|
|
419
|
+
ts: string;
|
|
420
|
+
kind: string;
|
|
421
|
+
summary: string;
|
|
422
|
+
payload?: Record<string, unknown>;
|
|
423
|
+
}
|
|
424
|
+
interface LogQueryOptions {
|
|
425
|
+
kind?: string;
|
|
426
|
+
after?: string;
|
|
427
|
+
before?: string;
|
|
428
|
+
limit?: number;
|
|
429
|
+
}
|
|
430
|
+
declare function logEvent(vaultPath: string, input: LogEventInput): Promise<LogEntry>;
|
|
431
|
+
declare function logQuery(vaultPath: string, opts?: LogQueryOptions): Promise<LogEntry[]>;
|
|
432
|
+
|
|
433
|
+
interface SynthesizeNoteInput {
|
|
434
|
+
topic: string;
|
|
435
|
+
answer: string;
|
|
436
|
+
suggested_path: string;
|
|
437
|
+
type?: string;
|
|
438
|
+
sources?: string[];
|
|
439
|
+
derived_from?: string[];
|
|
440
|
+
related_notes?: string[];
|
|
441
|
+
status?: string;
|
|
442
|
+
confidence?: string;
|
|
443
|
+
decision_maker?: string;
|
|
444
|
+
decided_on?: string;
|
|
445
|
+
severity?: string;
|
|
446
|
+
extra_frontmatter?: Record<string, unknown>;
|
|
447
|
+
}
|
|
448
|
+
interface SynthesizePreview {
|
|
449
|
+
changeset: ChangeSet;
|
|
450
|
+
path: string;
|
|
451
|
+
title: string;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Convert a query answer + provenance into a ChangeSet that can be fed to applyPatch.
|
|
455
|
+
* The shaped note includes provenance frontmatter and auto-inserts [[wikilinks]] for
|
|
456
|
+
* any related_notes that appear as bare titles in the body.
|
|
457
|
+
*
|
|
458
|
+
* Does NOT write to disk — always returns a ChangeSet. Callers pass it to applyPatch.
|
|
459
|
+
*/
|
|
460
|
+
declare function buildSynthesizeChangeSet(input: SynthesizeNoteInput): SynthesizePreview;
|
|
461
|
+
|
|
462
|
+
interface LintReport {
|
|
463
|
+
schemaPath: string;
|
|
464
|
+
findings: LintFinding[];
|
|
465
|
+
byRule: {
|
|
466
|
+
schema_violations: LintFinding[];
|
|
467
|
+
missing_provenance: LintFinding[];
|
|
468
|
+
stale: LintFinding[];
|
|
469
|
+
broken_links: LintFinding[];
|
|
470
|
+
};
|
|
471
|
+
counts: {
|
|
472
|
+
errors: number;
|
|
473
|
+
warnings: number;
|
|
474
|
+
filesLinted: number;
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
declare function lintVault(notesPath: string, opts?: {
|
|
478
|
+
pathGlob?: string;
|
|
479
|
+
schemaOverride?: VaultSchema;
|
|
480
|
+
todayIso?: string;
|
|
481
|
+
}): Promise<LintReport>;
|
|
482
|
+
declare function formatLintReport(report: LintReport, opts?: {
|
|
483
|
+
rule?: keyof LintReport["byRule"];
|
|
484
|
+
}): string;
|
|
485
|
+
|
|
486
|
+
export { type ApplyPatchOptions, type ApplyPatchResult, type ChangeSet, Embedder, FrontmatterManager, GraphBuilder, type GraphEdge, type GraphNode, INDEX_FILE, INDEX_OVERFLOW_THRESHOLD, type IndexEntry, type IndexedDocument, Indexer, type IngestInput, type IngestPreview, type IngestSource, type IngestUnit, type LintFinding, type LintReport, type LogEntry, type LogEventInput, type LogQueryOptions, NoteCrud, type RegenResult, type SearchResult, type Severity, type SynthesizeNoteInput, TagManager, TextSearch, type VaultSchema, type VaultStats, VectorIndex, Watcher, applyPatch, buildIngestChangeSet, buildSynthesizeChangeSet, formatLintReport, installDefaultSchema, lintVault, loadSchema, logEvent, logQuery, regenDirectoryIndex, regenIndexesForPaths, validateNote };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FrontmatterManager,
|
|
3
|
+
INDEX_FILE,
|
|
4
|
+
INDEX_OVERFLOW_THRESHOLD,
|
|
5
|
+
NoteCrud,
|
|
6
|
+
TagManager,
|
|
7
|
+
Watcher,
|
|
8
|
+
applyPatch,
|
|
9
|
+
buildIngestChangeSet,
|
|
10
|
+
buildSynthesizeChangeSet,
|
|
11
|
+
regenDirectoryIndex,
|
|
12
|
+
regenIndexesForPaths
|
|
13
|
+
} from "../chunk-CXTRTCIK.js";
|
|
14
|
+
import {
|
|
15
|
+
Embedder,
|
|
16
|
+
GraphBuilder,
|
|
17
|
+
TextSearch,
|
|
18
|
+
VectorIndex
|
|
19
|
+
} from "../chunk-25EIQWXL.js";
|
|
20
|
+
import {
|
|
21
|
+
Indexer
|
|
22
|
+
} from "../chunk-HODDRXJK.js";
|
|
23
|
+
import {
|
|
24
|
+
logEvent,
|
|
25
|
+
logQuery
|
|
26
|
+
} from "../chunk-JPQHNG3R.js";
|
|
27
|
+
import {
|
|
28
|
+
formatLintReport,
|
|
29
|
+
lintVault
|
|
30
|
+
} from "../chunk-CAN2GWUG.js";
|
|
31
|
+
import {
|
|
32
|
+
installDefaultSchema,
|
|
33
|
+
loadSchema,
|
|
34
|
+
validateNote
|
|
35
|
+
} from "../chunk-E2Z4J4MK.js";
|
|
36
|
+
import "../chunk-PZ5AY32C.js";
|
|
37
|
+
export {
|
|
38
|
+
Embedder,
|
|
39
|
+
FrontmatterManager,
|
|
40
|
+
GraphBuilder,
|
|
41
|
+
INDEX_FILE,
|
|
42
|
+
INDEX_OVERFLOW_THRESHOLD,
|
|
43
|
+
Indexer,
|
|
44
|
+
NoteCrud,
|
|
45
|
+
TagManager,
|
|
46
|
+
TextSearch,
|
|
47
|
+
VectorIndex,
|
|
48
|
+
Watcher,
|
|
49
|
+
applyPatch,
|
|
50
|
+
buildIngestChangeSet,
|
|
51
|
+
buildSynthesizeChangeSet,
|
|
52
|
+
formatLintReport,
|
|
53
|
+
installDefaultSchema,
|
|
54
|
+
lintVault,
|
|
55
|
+
loadSchema,
|
|
56
|
+
logEvent,
|
|
57
|
+
logQuery,
|
|
58
|
+
regenDirectoryIndex,
|
|
59
|
+
regenIndexesForPaths,
|
|
60
|
+
validateNote
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|