dsh-plugin-sessiongraph-native 0.1.21 → 0.2.0
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 +69 -1
- package/lib/index.js +1 -1
- package/package.json +6 -6
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Loader for the native Rust index
|
|
2
|
+
* Loader for the native Rust kernel: the index writer and the query engine.
|
|
3
3
|
*
|
|
4
4
|
* The kernel is a napi-rs `cdylib` (`sessiongraph-core.<platform>-<arch>.node`) built from
|
|
5
5
|
* `crates/sessiongraph-core` and copied beside this module by `build-native.sh`. Nothing here may
|
|
@@ -73,6 +73,64 @@ export interface NativeIndexReport {
|
|
|
73
73
|
/** Wall-clock duration of the run, milliseconds. */
|
|
74
74
|
elapsedMs: number;
|
|
75
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* One request to the native query kernel.
|
|
78
|
+
*
|
|
79
|
+
* Field names are snake_case because the Rust `QueryRequest` declares them so; the numeric fields are
|
|
80
|
+
* `number` (never BigInt) because napi maps `f64` to a JS number. The seam's request shape uses
|
|
81
|
+
* camelCase and different names (`after`/`before`), so the store's adapter translates.
|
|
82
|
+
*/
|
|
83
|
+
export interface NativeQueryRequest {
|
|
84
|
+
/** Directory holding the index (`<indexRoot>/index.db`). */
|
|
85
|
+
index_root: string;
|
|
86
|
+
/** `search | session | event | trace | timeline | workspaces | status`. */
|
|
87
|
+
operation: string;
|
|
88
|
+
/** Search text. */
|
|
89
|
+
query?: string;
|
|
90
|
+
/** Full session id, or a prefix identifying exactly one session. */
|
|
91
|
+
session_id?: string;
|
|
92
|
+
/** Event sequence number (event; trace's event shape). */
|
|
93
|
+
seq?: number;
|
|
94
|
+
/** Page size. */
|
|
95
|
+
limit?: number;
|
|
96
|
+
/** Rows to skip. */
|
|
97
|
+
offset?: number;
|
|
98
|
+
/** Raw events before the target (event). */
|
|
99
|
+
window_before?: number;
|
|
100
|
+
/** Raw events after the target (event). */
|
|
101
|
+
window_after?: number;
|
|
102
|
+
/** Maximum descendant depth (trace's session shape). */
|
|
103
|
+
depth?: number;
|
|
104
|
+
/** Workspace filter (exact, or a prefix when it ends with `/`). */
|
|
105
|
+
workspace?: string;
|
|
106
|
+
/** Lower epoch-millisecond bound. */
|
|
107
|
+
since?: number;
|
|
108
|
+
/** Upper epoch-millisecond bound. */
|
|
109
|
+
until?: number;
|
|
110
|
+
/** Entry kinds to include (search). */
|
|
111
|
+
kinds?: string[];
|
|
112
|
+
/** One hit per session (default true). */
|
|
113
|
+
dedupe_by_session?: boolean;
|
|
114
|
+
/** Largest snippet, in UTF-16 code units (the store's `maxSnippetChars`, default 240). */
|
|
115
|
+
max_snippet_chars?: number;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* One answer from the native query kernel.
|
|
119
|
+
*
|
|
120
|
+
* The result crosses as a JSON string in `payloadJson`: a raw event can be tens of kilobytes, and one
|
|
121
|
+
* `JSON.parse` costs less than converting every field across the napi boundary. A failure is reported
|
|
122
|
+
* as `ok: false` with the seam's error code rather than thrown, so the caller can fall back.
|
|
123
|
+
*/
|
|
124
|
+
export interface NativeQueryResponse {
|
|
125
|
+
/** Whether the operation ran. */
|
|
126
|
+
ok: boolean;
|
|
127
|
+
/** Complete result JSON, or an empty string on failure. */
|
|
128
|
+
payload_json: string;
|
|
129
|
+
/** `SESSIONGRAPH_*` code when `ok` is false. */
|
|
130
|
+
error_code?: string;
|
|
131
|
+
/** Human-readable failure reason when `ok` is false. */
|
|
132
|
+
error_message?: string;
|
|
133
|
+
}
|
|
76
134
|
/** The loaded native module's surface. */
|
|
77
135
|
export interface NativeKernel {
|
|
78
136
|
/**
|
|
@@ -86,6 +144,16 @@ export interface NativeKernel {
|
|
|
86
144
|
* @throws when the index cannot be written; parse failures are reported, not thrown.
|
|
87
145
|
*/
|
|
88
146
|
indexSessions(options: NativeIndexOptions): Promise<NativeIndexReport>;
|
|
147
|
+
/**
|
|
148
|
+
* Answer one query, off the JavaScript thread.
|
|
149
|
+
*
|
|
150
|
+
* Optional on the interface because a kernel built before the query export exists still loads:
|
|
151
|
+
* `typeof kernel.query === 'function'` is the store's probe, and a build without it falls back to
|
|
152
|
+
* the TypeScript store exactly as a missing binary does.
|
|
153
|
+
* @param request - the snake_case request the Rust side declares.
|
|
154
|
+
* @returns the response envelope, `ok: false` carrying any failure.
|
|
155
|
+
*/
|
|
156
|
+
query?(request: NativeQueryRequest): Promise<NativeQueryResponse>;
|
|
89
157
|
}
|
|
90
158
|
/**
|
|
91
159
|
* Load the native kernel, or report that this machine has none.
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Loader for the native Rust index
|
|
2
|
+
* Loader for the native Rust kernel: the index writer and the query engine.
|
|
3
3
|
*
|
|
4
4
|
* The kernel is a napi-rs `cdylib` (`sessiongraph-core.<platform>-<arch>.node`) built from
|
|
5
5
|
* `crates/sessiongraph-core` and copied beside this module by `build-native.sh`. Nothing here may
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-sessiongraph-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Native Rust index kernel for DeepSeek Harness sessiongraph — scan, multi-frame zstd decode, JSONL parse and SQLite write, exposed to Node through napi-rs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
"@types/node": "^22.10.0"
|
|
49
49
|
},
|
|
50
50
|
"optionalDependencies": {
|
|
51
|
-
"dsh-plugin-sessiongraph-indexer-darwin-arm64": "0.
|
|
52
|
-
"dsh-plugin-sessiongraph-indexer-darwin-x64": "0.
|
|
53
|
-
"dsh-plugin-sessiongraph-indexer-linux-x64-gnu": "0.
|
|
54
|
-
"dsh-plugin-sessiongraph-indexer-linux-arm64-gnu": "0.
|
|
55
|
-
"dsh-plugin-sessiongraph-indexer-win32-x64-msvc": "0.
|
|
51
|
+
"dsh-plugin-sessiongraph-indexer-darwin-arm64": "0.2.0",
|
|
52
|
+
"dsh-plugin-sessiongraph-indexer-darwin-x64": "0.2.0",
|
|
53
|
+
"dsh-plugin-sessiongraph-indexer-linux-x64-gnu": "0.2.0",
|
|
54
|
+
"dsh-plugin-sessiongraph-indexer-linux-arm64-gnu": "0.2.0",
|
|
55
|
+
"dsh-plugin-sessiongraph-indexer-win32-x64-msvc": "0.2.0"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "tsc -b",
|