dsh-plugin-sessiongraph-service 0.1.20 → 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 +1 -1
- package/lib/types.d.ts +148 -6
- package/lib/types.js +10 -2
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export { SessiongraphIndexerId, SessiongraphSessionId, SessiongraphStoreId } fro
|
|
|
21
21
|
export { ENTRY_FTS_TABLE, ENTRY_TABLE, INDEX_RELATIVE_PATH, META_DISCOVERED, META_FAILED, META_INDEXED_AT, META_SCHEMA_VERSION, SCHEMA_STATEMENTS, SCHEMA_VERSION, SESSION_TABLE, } from './schema.ts';
|
|
22
22
|
export { highlightTerms, isCjk, matchExpression, tokenize } from './tokenize.ts';
|
|
23
23
|
export { SessiongraphError } from './types.ts';
|
|
24
|
-
export type { SessiongraphEntry, SessiongraphEntryKind, SessiongraphErrorCode, SessiongraphHit, SessiongraphIndexer, SessiongraphIndexOptions, SessiongraphIndexReport, SessiongraphOperation, SessiongraphRequest, SessiongraphRequestBase, SessiongraphResult, SessiongraphResultFor, SessiongraphSearchRequest, SessiongraphSearchResult, SessiongraphService, SessiongraphSessionRequest, SessiongraphSessionResult, SessiongraphSessionSummary, SessiongraphStatusRequest, SessiongraphStatusResult, SessiongraphStoreProvider, SessiongraphTimelineRequest, SessiongraphTimelineResult, SessiongraphWorkspaceStat, SessiongraphWorkspacesRequest, SessiongraphWorkspacesResult, } from './types.ts';
|
|
24
|
+
export type { SessiongraphEntry, SessiongraphEntryKind, SessiongraphErrorCode, SessiongraphEventRequest, SessiongraphEventResult, SessiongraphEventTraceResult, SessiongraphHit, SessiongraphIndexer, SessiongraphIndexOptions, SessiongraphIndexReport, SessiongraphOperation, SessiongraphRawEvent, SessiongraphRawEventSummary, SessiongraphRequest, SessiongraphRequestBase, SessiongraphResult, SessiongraphResultFor, SessiongraphSearchRequest, SessiongraphSearchResult, SessiongraphService, SessiongraphSessionRequest, SessiongraphSessionResult, SessiongraphSessionSummary, SessiongraphSessionTraceResult, SessiongraphStatusRequest, SessiongraphStatusResult, SessiongraphStoreProvider, SessiongraphTimelineRequest, SessiongraphTimelineResult, SessiongraphTraceNode, SessiongraphTraceRequest, SessiongraphTraceResult, SessiongraphWorkspaceStat, SessiongraphWorkspacesRequest, SessiongraphWorkspacesResult, } from './types.ts';
|
|
25
25
|
export { SESSIONGRAPH_ENTRY_KINDS, SESSIONGRAPH_OPERATIONS } from './types.ts';
|
|
26
26
|
/**
|
|
27
27
|
* `ctx.sessiongraph`. Holds the store and indexer reservations; selection reads them per call so a
|
package/lib/types.d.ts
CHANGED
|
@@ -9,8 +9,16 @@
|
|
|
9
9
|
* @module dsh-plugin-sessiongraph-service/types
|
|
10
10
|
*/
|
|
11
11
|
import type { SessiongraphIndexerId, SessiongraphSessionId, SessiongraphStoreId } from './brand.ts';
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Every query operation the seam answers.
|
|
14
|
+
*
|
|
15
|
+
* `event` and `trace` were added when the model-facing surface collapsed from two tools into one:
|
|
16
|
+
* the built-in session tools could read a single unabridged event and follow replacement/citation
|
|
17
|
+
* relationships, and a replacement that dropped those answers would be a downgrade rather than a
|
|
18
|
+
* swap. An index run is deliberately **not** here — it writes, so the tool routes it through
|
|
19
|
+
* `Sessiongraph.index()` instead of pretending a query provider can build an index.
|
|
20
|
+
*/
|
|
21
|
+
export declare const SESSIONGRAPH_OPERATIONS: readonly ["search", "session", "event", "trace", "timeline", "workspaces", "status"];
|
|
14
22
|
/** One query operation. */
|
|
15
23
|
export type SessiongraphOperation = (typeof SESSIONGRAPH_OPERATIONS)[number];
|
|
16
24
|
/**
|
|
@@ -52,6 +60,22 @@ export interface SessiongraphSearchRequest extends SessiongraphRequestBase {
|
|
|
52
60
|
before?: number;
|
|
53
61
|
/** Restrict to these entry kinds. Absent means every kind. */
|
|
54
62
|
kinds?: readonly SessiongraphEntryKind[];
|
|
63
|
+
/**
|
|
64
|
+
* Restrict the search to one session: a full id, or a prefix long enough to identify exactly one.
|
|
65
|
+
*
|
|
66
|
+
* A prefix that matches several sessions raises `SESSIONGRAPH_INVALID_REQUEST` rather than
|
|
67
|
+
* guessing — a search silently answered from the wrong conversation is worse than a refusal. This
|
|
68
|
+
* is what replaces the built-in `session_event_search`, which needed its own tool for it.
|
|
69
|
+
*/
|
|
70
|
+
sessionId?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Return at most one hit per session (the strongest), default `true`.
|
|
73
|
+
*
|
|
74
|
+
* The built-in cross-session search answered one hit per session, and a caller paging through a
|
|
75
|
+
* verbatim log usually wants breadth across conversations, not ten matches from one. Callers that
|
|
76
|
+
* want every entry (a single-session sweep) turn it off.
|
|
77
|
+
*/
|
|
78
|
+
dedupeBySession?: boolean;
|
|
55
79
|
/** Maximum hits to return. */
|
|
56
80
|
limit: number;
|
|
57
81
|
/** Hits to skip, for paging. */
|
|
@@ -81,7 +105,13 @@ export interface SessiongraphHit {
|
|
|
81
105
|
export interface SessiongraphSearchResult {
|
|
82
106
|
operation: 'search';
|
|
83
107
|
hits: SessiongraphHit[];
|
|
84
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* How many results matched before `limit`/`offset` — counted in the same unit the hits use.
|
|
110
|
+
*
|
|
111
|
+
* With `dedupeBySession` on (the default) that is **sessions**, because the hits are one per
|
|
112
|
+
* session; counting entries there would make `truncated` permanently true and paging incoherent.
|
|
113
|
+
* With it off, it is entries.
|
|
114
|
+
*/
|
|
85
115
|
total: number;
|
|
86
116
|
/** True when `total` exceeded `limit + offset`, or when a snippet was clipped. */
|
|
87
117
|
truncated: boolean;
|
|
@@ -148,6 +178,8 @@ export interface SessiongraphTimelineRequest extends SessiongraphRequestBase {
|
|
|
148
178
|
before?: number;
|
|
149
179
|
/** Maximum sessions to return, newest first. */
|
|
150
180
|
limit: number;
|
|
181
|
+
/** Sessions to skip, for paging; follows the timeline's newest-first order. */
|
|
182
|
+
offset?: number;
|
|
151
183
|
}
|
|
152
184
|
/** Answer to a timeline request. */
|
|
153
185
|
export interface SessiongraphTimelineResult {
|
|
@@ -161,6 +193,8 @@ export interface SessiongraphWorkspacesRequest extends SessiongraphRequestBase {
|
|
|
161
193
|
operation: 'workspaces';
|
|
162
194
|
/** Maximum workspaces to return, most recently active first. */
|
|
163
195
|
limit: number;
|
|
196
|
+
/** Workspaces to skip, for paging; follows the most-recently-active-first order. */
|
|
197
|
+
offset?: number;
|
|
164
198
|
}
|
|
165
199
|
/** One workspace's coverage. */
|
|
166
200
|
export interface SessiongraphWorkspaceStat {
|
|
@@ -208,12 +242,120 @@ export interface SessiongraphStatusResult {
|
|
|
208
242
|
/** Bytes the index file occupies on disk. */
|
|
209
243
|
bytes: number;
|
|
210
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* One raw event, reduced to the fields that let a reader orient around a target.
|
|
247
|
+
*
|
|
248
|
+
* The window around an event is answered as summaries rather than full payloads: a caller asking
|
|
249
|
+
* "what came before this" wants the shape of the conversation, not megabytes of tool output.
|
|
250
|
+
*/
|
|
251
|
+
export interface SessiongraphRawEventSummary {
|
|
252
|
+
/** Event sequence number inside its session. */
|
|
253
|
+
seq: number;
|
|
254
|
+
/** Event timestamp, epoch milliseconds. */
|
|
255
|
+
time: number;
|
|
256
|
+
/** Event type as the log records it (`tool/call`, `assistant/message`, …). */
|
|
257
|
+
type: string;
|
|
258
|
+
}
|
|
259
|
+
/** One event exactly as the session log holds it, with no clipping applied. */
|
|
260
|
+
export interface SessiongraphRawEvent {
|
|
261
|
+
/** Event sequence number inside its session. */
|
|
262
|
+
seq: number;
|
|
263
|
+
/** Event timestamp, epoch milliseconds. */
|
|
264
|
+
time: number;
|
|
265
|
+
/** Event type as the log records it. */
|
|
266
|
+
type: string;
|
|
267
|
+
/**
|
|
268
|
+
* The event's own `data` payload, verbatim. Opaque to this seam on purpose: the log's event
|
|
269
|
+
* vocabulary belongs to `dsh-session`, and re-declaring it here would drift.
|
|
270
|
+
*/
|
|
271
|
+
data: unknown;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Read one unabridged event, plus an optional window of neighbouring events.
|
|
275
|
+
*
|
|
276
|
+
* This is what replaces the built-in `session_event_read`. It reads the source log directly rather
|
|
277
|
+
* than the index, because the index stores semantic text clipped to a per-entry cap and this answer
|
|
278
|
+
* must be the original bytes.
|
|
279
|
+
*/
|
|
280
|
+
export interface SessiongraphEventRequest extends SessiongraphRequestBase {
|
|
281
|
+
operation: 'event';
|
|
282
|
+
/** Full session id, or a prefix long enough to identify exactly one session. */
|
|
283
|
+
sessionId: string;
|
|
284
|
+
/** Sequence number of the target event. */
|
|
285
|
+
seq: number;
|
|
286
|
+
/** Raw events to include immediately before the target. Omitted means none. */
|
|
287
|
+
windowBefore?: number;
|
|
288
|
+
/** Raw events to include immediately after the target. Omitted means none. */
|
|
289
|
+
windowAfter?: number;
|
|
290
|
+
}
|
|
291
|
+
/** Answer to an event request. */
|
|
292
|
+
export interface SessiongraphEventResult {
|
|
293
|
+
operation: 'event';
|
|
294
|
+
session: SessiongraphSessionSummary;
|
|
295
|
+
/** The target event, unabridged. */
|
|
296
|
+
event: SessiongraphRawEvent;
|
|
297
|
+
/** Neighbours before the target, oldest first. */
|
|
298
|
+
before: SessiongraphRawEventSummary[];
|
|
299
|
+
/** Neighbours after the target, oldest first. */
|
|
300
|
+
after: SessiongraphRawEventSummary[];
|
|
301
|
+
}
|
|
302
|
+
/** One node of a recursive descendant tree. */
|
|
303
|
+
export interface SessiongraphTraceNode {
|
|
304
|
+
session: SessiongraphSessionSummary;
|
|
305
|
+
descendants: SessiongraphTraceNode[];
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Follow session lineage, or one event's replacement and citation relationships.
|
|
309
|
+
*
|
|
310
|
+
* `seq` selects the shape: present means "trace this event", absent means "trace this session".
|
|
311
|
+
* Both live in one operation because they share the only other input (`sessionId`) and because a
|
|
312
|
+
* second tool would cost permanent schema tokens for a question asked rarely.
|
|
313
|
+
*/
|
|
314
|
+
export interface SessiongraphTraceRequest extends SessiongraphRequestBase {
|
|
315
|
+
operation: 'trace';
|
|
316
|
+
/** Full session id, or a prefix long enough to identify exactly one session. */
|
|
317
|
+
sessionId: string;
|
|
318
|
+
/** Given → trace one event inside the session; omitted → trace the session's lineage. */
|
|
319
|
+
seq?: number;
|
|
320
|
+
/** Maximum descendant depth to walk. Omitted means the whole tree. */
|
|
321
|
+
depth?: number;
|
|
322
|
+
}
|
|
323
|
+
/** A session's ancestor chain and descendant tree. */
|
|
324
|
+
export interface SessiongraphSessionTraceResult {
|
|
325
|
+
operation: 'trace';
|
|
326
|
+
kind: 'session';
|
|
327
|
+
target: SessiongraphSessionSummary;
|
|
328
|
+
/** Ancestors, nearest first. */
|
|
329
|
+
ancestors: SessiongraphSessionSummary[];
|
|
330
|
+
descendants: SessiongraphTraceNode[];
|
|
331
|
+
/**
|
|
332
|
+
* False when the walk stopped early — a depth limit was hit, or a parent the index does not hold.
|
|
333
|
+
* A caller must be able to tell "this is the root" from "I gave up looking".
|
|
334
|
+
*/
|
|
335
|
+
complete: boolean;
|
|
336
|
+
}
|
|
337
|
+
/** One event's positional replacements and the source events it cites. */
|
|
338
|
+
export interface SessiongraphEventTraceResult {
|
|
339
|
+
operation: 'trace';
|
|
340
|
+
kind: 'event';
|
|
341
|
+
session: SessiongraphSessionSummary;
|
|
342
|
+
/** The target event, reduced to its identity. */
|
|
343
|
+
event: SessiongraphRawEventSummary;
|
|
344
|
+
/** Sequence numbers that replaced this event, following the chain outward. */
|
|
345
|
+
replacedBy: number[];
|
|
346
|
+
/** Sequence numbers this event shadowed. */
|
|
347
|
+
shadowedSeqs: number[];
|
|
348
|
+
/** Sequence numbers this event cites as sources (a tool result citing its call, for instance). */
|
|
349
|
+
sourceEventSeqs: number[];
|
|
350
|
+
}
|
|
351
|
+
/** Either trace shape, discriminated on `kind`. */
|
|
352
|
+
export type SessiongraphTraceResult = SessiongraphSessionTraceResult | SessiongraphEventTraceResult;
|
|
211
353
|
/** Every request the seam accepts, discriminated on `operation`. */
|
|
212
|
-
export type SessiongraphRequest = SessiongraphSearchRequest | SessiongraphSessionRequest | SessiongraphTimelineRequest | SessiongraphWorkspacesRequest | SessiongraphStatusRequest;
|
|
354
|
+
export type SessiongraphRequest = SessiongraphSearchRequest | SessiongraphSessionRequest | SessiongraphEventRequest | SessiongraphTraceRequest | SessiongraphTimelineRequest | SessiongraphWorkspacesRequest | SessiongraphStatusRequest;
|
|
213
355
|
/** The result type a given request produces. */
|
|
214
|
-
export type SessiongraphResultFor<R extends SessiongraphRequest> = R extends SessiongraphSearchRequest ? SessiongraphSearchResult : R extends SessiongraphSessionRequest ? SessiongraphSessionResult : R extends SessiongraphTimelineRequest ? SessiongraphTimelineResult : R extends SessiongraphWorkspacesRequest ? SessiongraphWorkspacesResult : R extends SessiongraphStatusRequest ? SessiongraphStatusResult : never;
|
|
356
|
+
export type SessiongraphResultFor<R extends SessiongraphRequest> = R extends SessiongraphSearchRequest ? SessiongraphSearchResult : R extends SessiongraphSessionRequest ? SessiongraphSessionResult : R extends SessiongraphEventRequest ? SessiongraphEventResult : R extends SessiongraphTraceRequest ? SessiongraphTraceResult : R extends SessiongraphTimelineRequest ? SessiongraphTimelineResult : R extends SessiongraphWorkspacesRequest ? SessiongraphWorkspacesResult : R extends SessiongraphStatusRequest ? SessiongraphStatusResult : never;
|
|
215
357
|
/** Every result the seam produces. */
|
|
216
|
-
export type SessiongraphResult = SessiongraphSearchResult | SessiongraphSessionResult | SessiongraphTimelineResult | SessiongraphWorkspacesResult | SessiongraphStatusResult;
|
|
358
|
+
export type SessiongraphResult = SessiongraphSearchResult | SessiongraphSessionResult | SessiongraphEventResult | SessiongraphTraceResult | SessiongraphTimelineResult | SessiongraphWorkspacesResult | SessiongraphStatusResult;
|
|
217
359
|
/**
|
|
218
360
|
* A read provider: answers queries from an index it claims.
|
|
219
361
|
*
|
package/lib/types.js
CHANGED
|
@@ -8,8 +8,16 @@
|
|
|
8
8
|
* never exposes a path to a table — only sessions, entries, and search hits.
|
|
9
9
|
* @module dsh-plugin-sessiongraph-service/types
|
|
10
10
|
*/
|
|
11
|
-
/**
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Every query operation the seam answers.
|
|
13
|
+
*
|
|
14
|
+
* `event` and `trace` were added when the model-facing surface collapsed from two tools into one:
|
|
15
|
+
* the built-in session tools could read a single unabridged event and follow replacement/citation
|
|
16
|
+
* relationships, and a replacement that dropped those answers would be a downgrade rather than a
|
|
17
|
+
* swap. An index run is deliberately **not** here — it writes, so the tool routes it through
|
|
18
|
+
* `Sessiongraph.index()` instead of pretending a query provider can build an index.
|
|
19
|
+
*/
|
|
20
|
+
export const SESSIONGRAPH_OPERATIONS = ['search', 'session', 'event', 'trace', 'timeline', 'workspaces', 'status'];
|
|
13
21
|
/**
|
|
14
22
|
* What a searchable entry is, from the reader's point of view.
|
|
15
23
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-sessiongraph-service",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Service definition for the DeepSeek Harness session-graph seam (ctx.sessiongraph) — a store-provider and indexer-provider registry over local conversation history, plus the normalized query vocabulary the model-facing tool speaks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|