context-vault 2.6.1 → 2.7.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/bin/cli.js +43 -17
- package/node_modules/@context-vault/core/package.json +1 -1
- package/node_modules/@context-vault/core/src/core/status.js +1 -1
- package/node_modules/@context-vault/core/src/index/index.js +3 -3
- package/node_modules/@context-vault/core/src/retrieve/index.js +1 -1
- package/node_modules/@context-vault/core/src/server/tools/context-status.js +90 -0
- package/node_modules/@context-vault/core/src/server/tools/delete-context.js +48 -0
- package/node_modules/@context-vault/core/src/server/tools/get-context.js +153 -0
- package/node_modules/@context-vault/core/src/server/tools/ingest-url.js +80 -0
- package/node_modules/@context-vault/core/src/server/tools/list-context.js +93 -0
- package/node_modules/@context-vault/core/src/server/tools/save-context.js +173 -0
- package/node_modules/@context-vault/core/src/server/tools/submit-feedback.js +49 -0
- package/node_modules/@context-vault/core/src/server/tools.js +36 -613
- package/node_modules/@context-vault/core/src/server/types.js +78 -0
- package/node_modules/@context-vault/core/src/sync/sync.js +2 -2
- package/package.json +2 -2
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* types.js — JSDoc type definitions for ctx shapes across modes.
|
|
3
|
+
*
|
|
4
|
+
* These typedefs document the context object passed through tool handlers,
|
|
5
|
+
* index, retrieve, and sync layers.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {Object} VaultConfig
|
|
10
|
+
* @property {string} vaultDir - Root vault directory path
|
|
11
|
+
* @property {string} dbPath - SQLite database file path
|
|
12
|
+
* @property {string} dataDir - Data directory for embeddings, models, etc.
|
|
13
|
+
* @property {string} devDir - Dev/config directory
|
|
14
|
+
* @property {number} eventDecayDays - Recency decay window for event entries
|
|
15
|
+
* @property {string} [configPath] - Path to resolved config file
|
|
16
|
+
* @property {boolean} [vaultDirExists] - Whether the vault directory exists on disk
|
|
17
|
+
* @property {string} [resolvedFrom] - How the config was resolved (env, flag, default, etc.)
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {Object} PreparedStatements
|
|
22
|
+
* @property {import('better-sqlite3').Statement} insertEntry
|
|
23
|
+
* @property {import('better-sqlite3').Statement} insertEntryEncrypted
|
|
24
|
+
* @property {import('better-sqlite3').Statement} updateEntry
|
|
25
|
+
* @property {import('better-sqlite3').Statement} upsertByIdentityKey
|
|
26
|
+
* @property {import('better-sqlite3').Statement} getEntryById
|
|
27
|
+
* @property {import('better-sqlite3').Statement} getByIdentityKey
|
|
28
|
+
* @property {import('better-sqlite3').Statement} getRowid
|
|
29
|
+
* @property {import('better-sqlite3').Statement} getRowidByPath
|
|
30
|
+
* @property {import('better-sqlite3').Statement} deleteEntry
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Core context properties present in all modes.
|
|
35
|
+
*
|
|
36
|
+
* @typedef {Object} BaseCtx
|
|
37
|
+
* @property {import('better-sqlite3').Database} db - SQLite database instance
|
|
38
|
+
* @property {VaultConfig} config - Resolved vault configuration
|
|
39
|
+
* @property {PreparedStatements} stmts - Prepared SQL statements
|
|
40
|
+
* @property {(text: string) => Promise<Float32Array|null>} embed - Generate embedding vector for text
|
|
41
|
+
* @property {(rowid: number, embedding: Float32Array) => void} insertVec - Insert vector embedding
|
|
42
|
+
* @property {(rowid: number) => void} deleteVec - Delete vector embedding
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Context for local (CLI/MCP) mode. Extends BaseCtx with graceful shutdown tracking.
|
|
47
|
+
*
|
|
48
|
+
* @typedef {BaseCtx & LocalCtxExtensions} LocalCtx
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @typedef {Object} LocalCtxExtensions
|
|
53
|
+
* @property {{ count: number }} [activeOps] - In-flight operation counter for graceful shutdown
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Context for hosted (multi-tenant) mode. Extends BaseCtx with auth and encryption.
|
|
58
|
+
*
|
|
59
|
+
* @typedef {BaseCtx & HostedCtxExtensions} HostedCtx
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @typedef {Object} HostedCtxExtensions
|
|
64
|
+
* @property {string} userId - Authenticated user ID
|
|
65
|
+
* @property {string} [teamId] - Team ID for team-scoped vaults
|
|
66
|
+
* @property {{ count: number }} [activeOps] - In-flight operation counter for graceful shutdown
|
|
67
|
+
* @property {(entry: { title?: string, body: string, meta?: object }) => Promise<{ body_encrypted: string, title_encrypted?: string, meta_encrypted?: string, iv: string }>} [encrypt] - Encrypt entry fields
|
|
68
|
+
* @property {(row: { body_encrypted: string, title_encrypted?: string, meta_encrypted?: string, iv: string }) => Promise<{ body: string, title?: string, meta?: object }>} [decrypt] - Decrypt entry fields
|
|
69
|
+
* @property {() => { entryCount: number, storageMb: number, maxEntries: number, maxStorageMb: number }} [checkLimits] - Check tier usage limits
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Shared utilities passed alongside ctx to tool handlers.
|
|
74
|
+
*
|
|
75
|
+
* @typedef {Object} ToolShared
|
|
76
|
+
* @property {() => Promise<void>} ensureIndexed - Ensure auto-reindex has completed
|
|
77
|
+
* @property {boolean} reindexFailed - Whether auto-reindex failed after max attempts
|
|
78
|
+
*/
|
|
@@ -14,7 +14,7 @@ import { indexEntry } from "../index/index.js";
|
|
|
14
14
|
/**
|
|
15
15
|
* Build a manifest of local vault entries (id → { id, created_at, kind, title }).
|
|
16
16
|
*
|
|
17
|
-
* @param {
|
|
17
|
+
* @param {import('../server/types.js').BaseCtx} ctx
|
|
18
18
|
* @returns {Map<string, { id: string, created_at: string, kind: string, title: string|null }>}
|
|
19
19
|
*/
|
|
20
20
|
export function buildLocalManifest(ctx) {
|
|
@@ -107,7 +107,7 @@ export function computeSyncPlan(local, remote) {
|
|
|
107
107
|
/**
|
|
108
108
|
* Execute a sync plan: push local entries to remote, pull remote entries to local.
|
|
109
109
|
*
|
|
110
|
-
* @param {
|
|
110
|
+
* @param {import('../server/types.js').BaseCtx & Partial<import('../server/types.js').HostedCtxExtensions>} ctx
|
|
111
111
|
* @param {{ hostedUrl: string, apiKey: string, plan: SyncPlan, onProgress?: (phase: string, current: number, total: number) => void }} opts
|
|
112
112
|
* @returns {Promise<{ pushed: number, pulled: number, failed: number, errors: string[] }>}
|
|
113
113
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-vault",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Persistent memory for AI agents — saves and searches knowledge across sessions",
|
|
6
6
|
"bin": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@context-vault/core"
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@context-vault/core": "^2.
|
|
59
|
+
"@context-vault/core": "^2.7.1",
|
|
60
60
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
61
61
|
"better-sqlite3": "^12.6.2",
|
|
62
62
|
"sqlite-vec": "^0.1.0"
|