agent-knowledge 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +94 -13
- package/README.md +51 -34
- package/dist/dashboard.d.ts +1 -0
- package/dist/dashboard.d.ts.map +1 -1
- package/dist/dashboard.js +76 -23
- package/dist/dashboard.js.map +1 -1
- package/dist/embeddings/anthropic.d.ts.map +1 -1
- package/dist/embeddings/anthropic.js +2 -1
- package/dist/embeddings/anthropic.js.map +1 -1
- package/dist/embeddings/gemini.d.ts.map +1 -1
- package/dist/embeddings/gemini.js +2 -1
- package/dist/embeddings/gemini.js.map +1 -1
- package/dist/embeddings/local.d.ts.map +1 -1
- package/dist/embeddings/local.js +3 -0
- package/dist/embeddings/local.js.map +1 -1
- package/dist/knowledge/consolidate.d.ts +46 -0
- package/dist/knowledge/consolidate.d.ts.map +1 -0
- package/dist/knowledge/consolidate.js +164 -0
- package/dist/knowledge/consolidate.js.map +1 -0
- package/dist/knowledge/distill.d.ts.map +1 -1
- package/dist/knowledge/distill.js +4 -2
- package/dist/knowledge/distill.js.map +1 -1
- package/dist/knowledge/graph.d.ts.map +1 -1
- package/dist/knowledge/graph.js +2 -1
- package/dist/knowledge/graph.js.map +1 -1
- package/dist/knowledge/reflect.d.ts +33 -0
- package/dist/knowledge/reflect.d.ts.map +1 -0
- package/dist/knowledge/reflect.js +115 -0
- package/dist/knowledge/reflect.js.map +1 -0
- package/dist/knowledge/scoring.d.ts.map +1 -1
- package/dist/knowledge/scoring.js +2 -1
- package/dist/knowledge/scoring.js.map +1 -1
- package/dist/knowledge/search.d.ts.map +1 -1
- package/dist/knowledge/search.js +4 -7
- package/dist/knowledge/search.js.map +1 -1
- package/dist/knowledge/store.d.ts.map +1 -1
- package/dist/knowledge/store.js +4 -3
- package/dist/knowledge/store.js.map +1 -1
- package/dist/search/excerpt.d.ts.map +1 -1
- package/dist/search/excerpt.js +2 -1
- package/dist/search/excerpt.js.map +1 -1
- package/dist/search/tfidf.d.ts +1 -0
- package/dist/search/tfidf.d.ts.map +1 -1
- package/dist/search/tfidf.js +38 -3
- package/dist/search/tfidf.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +103 -534
- package/dist/server.js.map +1 -1
- package/dist/sessions/parser.d.ts.map +1 -1
- package/dist/sessions/parser.js +33 -60
- package/dist/sessions/parser.js.map +1 -1
- package/dist/sessions/search.js +17 -3
- package/dist/sessions/search.js.map +1 -1
- package/dist/sessions/summary.d.ts.map +1 -1
- package/dist/sessions/summary.js +6 -3
- package/dist/sessions/summary.js.map +1 -1
- package/dist/tool-handlers.d.ts +41 -0
- package/dist/tool-handlers.d.ts.map +1 -0
- package/dist/tool-handlers.js +425 -0
- package/dist/tool-handlers.js.map +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +6 -4
- package/dist/types.js.map +1 -1
- package/dist/ui/app.js +86 -847
- package/dist/ui/index.html +17 -0
- package/dist/ui/render-knowledge.js +233 -0
- package/dist/ui/render-panel.js +350 -0
- package/dist/ui/render-search.js +109 -0
- package/dist/ui/render-sessions.js +234 -0
- package/dist/ui/styles.css +91 -0
- package/dist/ui/ui-utils.js +196 -0
- package/dist/vectorstore/store.d.ts +25 -44
- package/dist/vectorstore/store.d.ts.map +1 -1
- package/dist/vectorstore/store.js +167 -167
- package/dist/vectorstore/store.js.map +1 -1
- package/docs/ARCHITECTURE.md +29 -1
- package/docs/DASHBOARD.md +7 -0
- package/package.json +1 -1
|
@@ -36,91 +36,74 @@ export interface VectorStoreStats {
|
|
|
36
36
|
/**
|
|
37
37
|
* SQLite + sqlite-vec vector store for semantic search.
|
|
38
38
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
39
|
+
* Call `connect()` once before using the store, or let public methods
|
|
40
|
+
* auto-connect on first access. The DB connection and schema are set up
|
|
41
|
+
* once; subsequent calls are no-ops.
|
|
42
42
|
*/
|
|
43
43
|
export declare class VectorStore {
|
|
44
44
|
private db;
|
|
45
45
|
private dbPath;
|
|
46
|
-
private
|
|
46
|
+
private connected;
|
|
47
47
|
private vecAvailable;
|
|
48
48
|
private currentDimensions;
|
|
49
|
-
|
|
50
|
-
* Create a VectorStore instance.
|
|
51
|
-
* @param dbPath - Path to the SQLite database file. Defaults to `{dataDir}/knowledge-vectors.db`.
|
|
52
|
-
*/
|
|
49
|
+
private connectError;
|
|
53
50
|
constructor(dbPath?: string);
|
|
54
51
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
52
|
+
* Open the database, create tables, and load the sqlite-vec extension.
|
|
53
|
+
* Safe to call multiple times — subsequent calls are no-ops unless
|
|
54
|
+
* `dimensions` changes (which recreates the vec0 virtual table).
|
|
55
|
+
*
|
|
56
|
+
* If called without `dimensions`, uses the value stored in the meta table
|
|
57
|
+
* from a previous run. Throws if no dimensions are available at all.
|
|
57
58
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
connect(dimensions?: number): void;
|
|
60
|
+
private openDb;
|
|
61
|
+
private createSchema;
|
|
60
62
|
private loadVecExtension;
|
|
61
|
-
/** Create or verify the vec0 virtual table matches the expected dimensions. */
|
|
62
63
|
private ensureVecTable;
|
|
63
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* Read stored dimensions from meta (opens a temporary read-only DB if needed).
|
|
66
|
+
*/
|
|
67
|
+
private readStoredDimensions;
|
|
68
|
+
/**
|
|
69
|
+
* Ensure the store is connected. Auto-connects if not yet connected.
|
|
70
|
+
* If `dimensions` is provided, also ensures the vec0 table matches.
|
|
71
|
+
*
|
|
72
|
+
* Throws a clear error if initialization fails.
|
|
73
|
+
*/
|
|
74
|
+
private requireConnection;
|
|
64
75
|
private getMetaValue;
|
|
65
|
-
/** Set a value in the meta table. */
|
|
66
76
|
private setMetaValue;
|
|
67
|
-
/** Ensure DB is initialized, using dimensions from the first entry or the stored value. */
|
|
68
|
-
private ensureInit;
|
|
69
|
-
/** Read stored dimensions from meta (requires db to exist). */
|
|
70
|
-
private getStoredDimensions;
|
|
71
77
|
/**
|
|
72
78
|
* Store embeddings for a source. Replaces existing chunks for the same source_id.
|
|
73
79
|
* Uses a transaction for atomicity.
|
|
74
|
-
*
|
|
75
|
-
* @param entries - The embedding entries to store
|
|
76
80
|
*/
|
|
77
81
|
upsert(entries: VectorEntry[]): void;
|
|
78
82
|
/**
|
|
79
83
|
* Search by vector similarity. Returns top-k nearest neighbors.
|
|
80
|
-
*
|
|
81
|
-
* @param queryVector - The query embedding vector
|
|
82
|
-
* @param maxResults - Maximum number of results (default 10)
|
|
83
|
-
* @returns Sorted results with cosine similarity scores
|
|
84
84
|
*/
|
|
85
85
|
search(queryVector: number[], maxResults?: number): VectorSearchResult[];
|
|
86
86
|
/**
|
|
87
87
|
* Search filtered by source type (knowledge or session).
|
|
88
|
-
*
|
|
89
|
-
* @param queryVector - The query embedding vector
|
|
90
|
-
* @param source - Filter to 'knowledge' or 'session' entries only
|
|
91
|
-
* @param maxResults - Maximum number of results (default 10)
|
|
92
|
-
* @returns Sorted results with cosine similarity scores
|
|
93
88
|
*/
|
|
94
89
|
searchBySource(queryVector: number[], source: 'knowledge' | 'session', maxResults?: number): VectorSearchResult[];
|
|
95
|
-
/** Internal search implementation with optional source filter. */
|
|
96
90
|
private searchInternal;
|
|
97
91
|
/**
|
|
98
92
|
* Delete all embeddings for a given source_id.
|
|
99
|
-
*
|
|
100
|
-
* @param sourceId - The source identifier to remove
|
|
101
93
|
*/
|
|
102
94
|
deleteBySource(sourceId: string): void;
|
|
103
95
|
/**
|
|
104
96
|
* Check whether a source_id has any stored embeddings.
|
|
105
|
-
*
|
|
106
|
-
* @param sourceId - The source identifier to check
|
|
107
|
-
* @returns True if at least one embedding exists for this source
|
|
108
97
|
*/
|
|
109
98
|
hasEmbeddings(sourceId: string): boolean;
|
|
110
99
|
/**
|
|
111
100
|
* Get the name of the currently active embedding provider.
|
|
112
|
-
*
|
|
113
|
-
* @returns The provider name, or null if none is set
|
|
114
101
|
*/
|
|
115
102
|
getCurrentProvider(): string | null;
|
|
116
103
|
/**
|
|
117
104
|
* Set the active embedding provider. If the provider has changed since
|
|
118
105
|
* the last call, all existing embeddings are wiped to avoid mixing
|
|
119
106
|
* incompatible vector spaces.
|
|
120
|
-
*
|
|
121
|
-
* @param providerName - The provider name (e.g. "openai", "ollama")
|
|
122
|
-
* @param dimensions - The embedding dimensions for this provider
|
|
123
|
-
* @returns True if a wipe was performed (provider changed)
|
|
124
107
|
*/
|
|
125
108
|
setProvider(providerName: string, dimensions: number): boolean;
|
|
126
109
|
/**
|
|
@@ -130,8 +113,6 @@ export declare class VectorStore {
|
|
|
130
113
|
wipe(): void;
|
|
131
114
|
/**
|
|
132
115
|
* Get statistics about the vector store.
|
|
133
|
-
*
|
|
134
|
-
* @returns Counts by source type, DB file size, provider, and dimensions
|
|
135
116
|
*/
|
|
136
117
|
stats(): VectorStoreStats;
|
|
137
118
|
/** Close the database connection and release resources. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/vectorstore/store.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,yCAAyC;AACzC,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,6CAA6C;AAC7C,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC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