@huanlin/dsh-plugin-codegraph-service 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/index.d.ts CHANGED
@@ -64,6 +64,13 @@ export declare class Codegraph extends Service implements CodegraphService {
64
64
  registerIndexer(provider: CodegraphIndexer): () => void;
65
65
  available(projectRoot: string, signal?: AbortSignal): Promise<boolean>;
66
66
  index(projectRoot: string, signal?: AbortSignal): Promise<CodegraphIndexReport>;
67
+ /**
68
+ * Close every open connection the registered stores keep for `projectRoot`. A store that keeps
69
+ * none — or none for this root — contributes nothing; the seam never fails a caller because one
70
+ * store had nothing to release.
71
+ * @param projectRoot - absolute path of the project root whose readers to release.
72
+ */
73
+ release(projectRoot: string): void;
67
74
  query<R extends CodegraphRequest>(request: R, signal?: AbortSignal): Promise<CodegraphResultFor<R>>;
68
75
  /**
69
76
  * The one store that indexes `projectRoot`. Every registered store is asked concurrently, so the
package/lib/index.js CHANGED
@@ -161,9 +161,25 @@ export class Codegraph extends Service {
161
161
  return claims.some(Boolean);
162
162
  }
163
163
  async index(projectRoot, signal) {
164
+ // The run replaces the graph file by renaming the rebuilt one over it, and Windows refuses
165
+ // that rename while any reader in this process still holds the old file open — so every
166
+ // store's connections for this root are closed before the indexer starts. On POSIX the close
167
+ // is unobservable; on Windows it is the difference between a rebuild that lands and one that
168
+ // fails EPERM on every attempt for as long as the process lives.
169
+ this.release(projectRoot);
164
170
  const indexer = await this.selectIndexer(projectRoot, signal);
165
171
  return indexer.index(projectRoot, signal);
166
172
  }
173
+ /**
174
+ * Close every open connection the registered stores keep for `projectRoot`. A store that keeps
175
+ * none — or none for this root — contributes nothing; the seam never fails a caller because one
176
+ * store had nothing to release.
177
+ * @param projectRoot - absolute path of the project root whose readers to release.
178
+ */
179
+ release(projectRoot) {
180
+ for (const store of this.stores.values())
181
+ store.release?.(projectRoot);
182
+ }
167
183
  async query(request, signal) {
168
184
  return (await this.select(request.projectRoot, signal)).query(request, signal);
169
185
  }
package/lib/types.d.ts CHANGED
@@ -352,6 +352,17 @@ export interface CodegraphStoreProvider {
352
352
  * @returns the result member matching `request.operation`.
353
353
  */
354
354
  query<R extends CodegraphRequest>(request: R, signal?: AbortSignal): Promise<CodegraphResultFor<R>>;
355
+ /**
356
+ * Close every open connection this store keeps for `projectRoot`. An indexing run replaces the
357
+ * graph file by renaming the rebuilt one over it, and Windows refuses that rename while any
358
+ * handle in this process still holds the old file open — an open read-only connection is exactly
359
+ * such a handle — so {@link CodegraphService.index} asks every store to release the root's
360
+ * readers before the indexer runs. On POSIX the rename succeeds regardless, and releasing early
361
+ * merely makes the next query reopen promptly. Optional: a store that keeps no connections has
362
+ * nothing to release.
363
+ * @param projectRoot - absolute path of the project root whose connections to close.
364
+ */
365
+ release?(projectRoot: string): void;
355
366
  }
356
367
  /** What one indexing run produced, returned to the caller that requested it. */
357
368
  export interface CodegraphIndexReport {
@@ -438,6 +449,14 @@ export interface CodegraphService {
438
449
  * @returns the report the indexer produced.
439
450
  */
440
451
  index(projectRoot: string, signal?: AbortSignal): Promise<CodegraphIndexReport>;
452
+ /**
453
+ * Close every open connection the registered stores keep for `projectRoot`. This is the step an
454
+ * indexing run needs before replacing the graph file — Windows refuses the replace while any
455
+ * reader in this process holds the old file open — and it is the seam's job, not an indexer's,
456
+ * because which stores hold readers is a registry fact an indexer must not need to know.
457
+ * @param projectRoot - absolute path of the project root whose readers to release.
458
+ */
459
+ release(projectRoot: string): void;
441
460
  /**
442
461
  * Route one query to the store that indexes `request.projectRoot`.
443
462
  * @param request - the normalized query.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huanlin/dsh-plugin-codegraph-service",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "Service Definition for the DeepSeek Harness code-graph capability seam (ctx.codegraph): a graph-store and graph-indexer provider registry with per-query, order-independent selection over eight normalized structural queries",
5
5
  "keywords": [
6
6
  "dsh",
@@ -43,11 +43,11 @@
43
43
  "peerDependencies": {
44
44
  "@deepseek-ai/cordis": ">=4.0.1",
45
45
  "@deepseek-ai/dsh-brand": ">=0.1.0-rc.6",
46
- "@deepseek-ai/dsh-llm": ">=0.1.2-rc.1"
46
+ "@deepseek-ai/dsh-llm": ">=0.1.5-rc.1"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@deepseek-ai/cordis": "^4.0.1",
50
- "@deepseek-ai/dsh-brand": "0.1.2-rc.1",
51
- "@deepseek-ai/dsh-llm": "0.1.2-rc.1"
50
+ "@deepseek-ai/dsh-brand": "0.1.5-rc.1",
51
+ "@deepseek-ai/dsh-llm": "0.1.5-rc.1"
52
52
  }
53
53
  }