@huanlin/dsh-plugin-codegraph-sqlite 0.1.8 → 0.1.10
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/lib/database.d.ts +13 -3
- package/lib/database.js +19 -3
- package/lib/index.js +3 -0
- package/package.json +6 -6
package/lib/database.d.ts
CHANGED
|
@@ -41,9 +41,9 @@ export declare function databasePath(projectRoot: string): string;
|
|
|
41
41
|
export declare function openGraph(projectRoot: string): DatabaseSync;
|
|
42
42
|
/**
|
|
43
43
|
* A bounded set of open graph connections keyed by project root, evicting the least recently used
|
|
44
|
-
* one when full. Every connection the pool hands out stays valid until
|
|
45
|
-
* disposal
|
|
46
|
-
* synchronous query.
|
|
44
|
+
* one when full. Every connection the pool hands out stays valid until it is closed: eviction,
|
|
45
|
+
* {@link release}, and disposal all close connections, so a caller holds a connection only for the
|
|
46
|
+
* duration of one synchronous query.
|
|
47
47
|
*
|
|
48
48
|
* A connection is opened against one specific on-disk file. An indexing run replaces that file
|
|
49
49
|
* wholesale (rename over the old path), and POSIX unlink semantics mean an already-open read-only
|
|
@@ -67,6 +67,16 @@ export declare class GraphPool {
|
|
|
67
67
|
* @returns the open, version-checked connection, current as of this call.
|
|
68
68
|
*/
|
|
69
69
|
acquire(projectRoot: string): DatabaseSync;
|
|
70
|
+
/**
|
|
71
|
+
* Close and forget the connection cached for `projectRoot`, when one is held. The store calls
|
|
72
|
+
* this before an indexing run replaces the graph file: Windows refuses that replace while the
|
|
73
|
+
* pooled read-only connection keeps the old file open — SQLite opens its files without
|
|
74
|
+
* `FILE_SHARE_DELETE` — and without this step every later rebuild would fail EPERM on a rename
|
|
75
|
+
* the pool's own connection alone caused. The next {@link acquire} simply opens fresh, which is
|
|
76
|
+
* also how it picks up the rebuilt graph.
|
|
77
|
+
* @param projectRoot - absolute path of the project root whose connection to close.
|
|
78
|
+
*/
|
|
79
|
+
release(projectRoot: string): void;
|
|
70
80
|
/** Close every open connection; further {@link acquire} calls fail as `CODEGRAPH_DISPOSED`. */
|
|
71
81
|
close(): void;
|
|
72
82
|
/** Close least-recently-used connections until the pool fits its capacity. */
|
package/lib/database.js
CHANGED
|
@@ -101,9 +101,9 @@ export function openGraph(projectRoot) {
|
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
103
|
* A bounded set of open graph connections keyed by project root, evicting the least recently used
|
|
104
|
-
* one when full. Every connection the pool hands out stays valid until
|
|
105
|
-
* disposal
|
|
106
|
-
* synchronous query.
|
|
104
|
+
* one when full. Every connection the pool hands out stays valid until it is closed: eviction,
|
|
105
|
+
* {@link release}, and disposal all close connections, so a caller holds a connection only for the
|
|
106
|
+
* duration of one synchronous query.
|
|
107
107
|
*
|
|
108
108
|
* A connection is opened against one specific on-disk file. An indexing run replaces that file
|
|
109
109
|
* wholesale (rename over the old path), and POSIX unlink semantics mean an already-open read-only
|
|
@@ -157,6 +157,22 @@ export class GraphPool {
|
|
|
157
157
|
this.evictOverflow();
|
|
158
158
|
return db;
|
|
159
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Close and forget the connection cached for `projectRoot`, when one is held. The store calls
|
|
162
|
+
* this before an indexing run replaces the graph file: Windows refuses that replace while the
|
|
163
|
+
* pooled read-only connection keeps the old file open — SQLite opens its files without
|
|
164
|
+
* `FILE_SHARE_DELETE` — and without this step every later rebuild would fail EPERM on a rename
|
|
165
|
+
* the pool's own connection alone caused. The next {@link acquire} simply opens fresh, which is
|
|
166
|
+
* also how it picks up the rebuilt graph.
|
|
167
|
+
* @param projectRoot - absolute path of the project root whose connection to close.
|
|
168
|
+
*/
|
|
169
|
+
release(projectRoot) {
|
|
170
|
+
const cached = this.open.get(projectRoot);
|
|
171
|
+
if (cached === undefined)
|
|
172
|
+
return;
|
|
173
|
+
cached.db.close();
|
|
174
|
+
this.open.delete(projectRoot);
|
|
175
|
+
}
|
|
160
176
|
/** Close every open connection; further {@link acquire} calls fail as `CODEGRAPH_DISPOSED`. */
|
|
161
177
|
close() {
|
|
162
178
|
this.disposed = true;
|
package/lib/index.js
CHANGED
|
@@ -70,6 +70,9 @@ export function apply(ctx, config) {
|
|
|
70
70
|
query(request) {
|
|
71
71
|
return Promise.resolve(run(pool, resolved, request));
|
|
72
72
|
},
|
|
73
|
+
release(projectRoot) {
|
|
74
|
+
pool.release(projectRoot);
|
|
75
|
+
},
|
|
73
76
|
};
|
|
74
77
|
ctx.effect(function* () {
|
|
75
78
|
// Registered first, so it disposes LAST: the store unregisters before its connections close,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huanlin/dsh-plugin-codegraph-sqlite",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "Read-only SQLite store for the DeepSeek Harness code-graph seam — serves structural queries from the schema-v4 graph at .codegraph/codegraph.db, the same on-disk format the codegraph CLI writes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
@@ -42,16 +42,16 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
45
|
-
"@huanlin/dsh-plugin-codegraph-service": "^0.1.
|
|
45
|
+
"@huanlin/dsh-plugin-codegraph-service": "^0.1.10"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@deepseek-ai/cordis": ">=4.0.1",
|
|
49
|
-
"@deepseek-ai/dsh-llm": ">=0.1.
|
|
50
|
-
"@deepseek-ai/dsh-util-values": ">=0.1.
|
|
49
|
+
"@deepseek-ai/dsh-llm": ">=0.1.5-rc.1",
|
|
50
|
+
"@deepseek-ai/dsh-util-values": ">=0.1.5-rc.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
54
|
-
"@deepseek-ai/dsh-llm": "0.1.
|
|
55
|
-
"@deepseek-ai/dsh-util-values": "0.1.
|
|
54
|
+
"@deepseek-ai/dsh-llm": "0.1.5-rc.1",
|
|
55
|
+
"@deepseek-ai/dsh-util-values": "0.1.5-rc.1"
|
|
56
56
|
}
|
|
57
57
|
}
|