dsh-plugin-sessiongraph-sessions 0.1.7 → 0.1.9
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 +14 -6
- package/lib/index.js +14 -8
- package/package.json +3 -3
package/lib/index.d.ts
CHANGED
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
* rebuilds every log into a temporary file that replaces the old index atomically. A single bad log
|
|
15
15
|
* is reported in `failed` and never aborts the run.
|
|
16
16
|
*
|
|
17
|
-
* Every session creation also
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* the
|
|
17
|
+
* Every session creation also does indexing work in the background (`agent/created`, `autoIndex`):
|
|
18
|
+
* an existing index is refreshed incrementally, and a missing one is built from scratch (`autoBuild`,
|
|
19
|
+
* default true) so a fresh install becomes searchable without the user running anything. Both runs
|
|
20
|
+
* go through the host's job registry and never block session creation. `autoBuild: false` restores
|
|
21
|
+
* the stricter behaviour where nothing is indexed until the caller asks for it.
|
|
21
22
|
*
|
|
22
23
|
* Sessions the host still holds in memory (`ctx.sessionQuery`) are indexed as well, in a second pass
|
|
23
24
|
* after the file-path transaction commits: a conversation that is still running has no log on disk
|
|
@@ -98,10 +99,17 @@ export interface Config {
|
|
|
98
99
|
/** Logs larger than this are skipped and reported in `failed` (default 67108864). */
|
|
99
100
|
maxFileBytes?: number;
|
|
100
101
|
/**
|
|
101
|
-
*
|
|
102
|
-
*
|
|
102
|
+
* Do indexing work in the background whenever a session is created (default true). With no index
|
|
103
|
+
* yet this builds the first one; with one already present it refreshes incrementally.
|
|
103
104
|
*/
|
|
104
105
|
autoIndex?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Build the very first index automatically in the background when a session starts (default
|
|
108
|
+
* true). The first build reads every log on the machine and can take seconds to minutes, so it
|
|
109
|
+
* runs as a host background job and never blocks session creation. Set false to require an
|
|
110
|
+
* explicit `sessiongraph_index` / `/sessiongraph index` before anything is searchable.
|
|
111
|
+
*/
|
|
112
|
+
autoBuild?: boolean;
|
|
105
113
|
/**
|
|
106
114
|
* Hand an explicit index run to the host's background-job registry once the session store holds at
|
|
107
115
|
* least this many logs (default 1000). Below it the run is synchronous, because a small index is
|
package/lib/index.js
CHANGED
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
* rebuilds every log into a temporary file that replaces the old index atomically. A single bad log
|
|
15
15
|
* is reported in `failed` and never aborts the run.
|
|
16
16
|
*
|
|
17
|
-
* Every session creation also
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* the
|
|
17
|
+
* Every session creation also does indexing work in the background (`agent/created`, `autoIndex`):
|
|
18
|
+
* an existing index is refreshed incrementally, and a missing one is built from scratch (`autoBuild`,
|
|
19
|
+
* default true) so a fresh install becomes searchable without the user running anything. Both runs
|
|
20
|
+
* go through the host's job registry and never block session creation. `autoBuild: false` restores
|
|
21
|
+
* the stricter behaviour where nothing is indexed until the caller asks for it.
|
|
21
22
|
*
|
|
22
23
|
* Sessions the host still holds in memory (`ctx.sessionQuery`) are indexed as well, in a second pass
|
|
23
24
|
* after the file-path transaction commits: a conversation that is still running has no log on disk
|
|
@@ -88,6 +89,7 @@ export const Config = z.object({
|
|
|
88
89
|
toolCallChars: z.number().default(DEFAULT_TOOL_CALL_CHARS),
|
|
89
90
|
maxFileBytes: z.number().default(DEFAULT_MAX_FILE_BYTES),
|
|
90
91
|
autoIndex: z.boolean().default(true),
|
|
92
|
+
autoBuild: z.boolean().default(true),
|
|
91
93
|
backgroundIndexThreshold: z.number().default(DEFAULT_BACKGROUND_INDEX_THRESHOLD),
|
|
92
94
|
maxLiveSessions: z.number().default(DEFAULT_MAX_LIVE_SESSIONS),
|
|
93
95
|
engine: z.union([z.const('auto'), z.const('native'), z.const('typescript')]).default(DEFAULT_ENGINE),
|
|
@@ -182,9 +184,11 @@ function scheduleAutoIndex(ctx, config, autoIndexed, payload) {
|
|
|
182
184
|
// Once per root per process: a burst of session creations must not queue a burst of index runs.
|
|
183
185
|
if (autoIndexed.has(indexRoot))
|
|
184
186
|
return;
|
|
185
|
-
//
|
|
186
|
-
//
|
|
187
|
-
|
|
187
|
+
// A first build reads every log on the machine and can take a while, so it stays a background
|
|
188
|
+
// job like the incremental refresh. `autoBuild: false` restores the stricter behaviour where
|
|
189
|
+
// nothing becomes searchable until someone asks for it.
|
|
190
|
+
const existing = hasExistingIndex(indexRoot);
|
|
191
|
+
if (!existing && !config.autoBuild)
|
|
188
192
|
return;
|
|
189
193
|
// `ctx.get` rather than an `inject` entry: background jobs are a host composition choice, and
|
|
190
194
|
// requiring the service would hide this whole indexer from a profile that runs none.
|
|
@@ -195,7 +199,9 @@ function scheduleAutoIndex(ctx, config, autoIndexed, payload) {
|
|
|
195
199
|
// The registry keys a job by its owning session id, not the agent object.
|
|
196
200
|
owner: agent.id,
|
|
197
201
|
kind: AUTO_INDEX_JOB_KIND,
|
|
198
|
-
label:
|
|
202
|
+
label: existing
|
|
203
|
+
? `sessiongraph refresh for ${workspace}`
|
|
204
|
+
: `sessiongraph first build for ${workspace}`,
|
|
199
205
|
run: handle => runIndexJob(indexRoot, {}, config, handle),
|
|
200
206
|
});
|
|
201
207
|
// Marked only after the registry accepted the job, so a refusal leaves the root eligible for
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-sessiongraph-sessions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Session-log indexer for DeepSeek Harness — scans ~/.dsh/sessions, decompresses the multi-frame zstd JSONL logs and writes the sessiongraph SQLite index the store reads",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
52
|
-
"dsh-plugin-sessiongraph-service": "^0.1.
|
|
53
|
-
"dsh-plugin-sessiongraph-native": "^0.1.
|
|
52
|
+
"dsh-plugin-sessiongraph-service": "^0.1.9",
|
|
53
|
+
"dsh-plugin-sessiongraph-native": "^0.1.9"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@deepseek-ai/cordis": ">=4.0.1",
|