dsh-plugin-sessiongraph-service 0.2.0 → 0.3.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 CHANGED
@@ -19,10 +19,11 @@ import type { SessiongraphIndexer, SessiongraphIndexOptions, SessiongraphIndexRe
19
19
  export { assertNever } from './assert.ts';
20
20
  export { SessiongraphIndexerId, SessiongraphSessionId, SessiongraphStoreId } from './brand.ts';
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
+ export { PANEL_CODEX_SYNC_KEY, PANEL_FILE_NAME } from './panel.ts';
22
23
  export { highlightTerms, isCjk, matchExpression, tokenize } from './tokenize.ts';
23
24
  export { SessiongraphError } 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
- export { SESSIONGRAPH_ENTRY_KINDS, SESSIONGRAPH_OPERATIONS } from './types.ts';
25
+ 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, SessiongraphSource, SessiongraphStatusRequest, SessiongraphStatusResult, SessiongraphStoreProvider, SessiongraphTimelineRequest, SessiongraphTimelineResult, SessiongraphTraceNode, SessiongraphTraceRequest, SessiongraphTraceResult, SessiongraphWorkspaceStat, SessiongraphWorkspacesRequest, SessiongraphWorkspacesResult, } from './types.ts';
26
+ export { SESSIONGRAPH_ENTRY_KINDS, SESSIONGRAPH_OPERATIONS, SESSIONGRAPH_SOURCES } from './types.ts';
26
27
  /**
27
28
  * `ctx.sessiongraph`. Holds the store and indexer reservations; selection reads them per call so a
28
29
  * provider that unloads mid-session stops serving without leaving a stale route behind.
package/lib/index.js CHANGED
@@ -21,9 +21,10 @@ import { SessiongraphError } from "./types.js";
21
21
  export { assertNever } from "./assert.js";
22
22
  export { SessiongraphIndexerId, SessiongraphSessionId, SessiongraphStoreId } from "./brand.js";
23
23
  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.js";
24
+ export { PANEL_CODEX_SYNC_KEY, PANEL_FILE_NAME } from "./panel.js";
24
25
  export { highlightTerms, isCjk, matchExpression, tokenize } from "./tokenize.js";
25
26
  export { SessiongraphError } from "./types.js";
26
- export { SESSIONGRAPH_ENTRY_KINDS, SESSIONGRAPH_OPERATIONS } from "./types.js";
27
+ export { SESSIONGRAPH_ENTRY_KINDS, SESSIONGRAPH_OPERATIONS, SESSIONGRAPH_SOURCES } from "./types.js";
27
28
  /**
28
29
  * `ctx.sessiongraph`. Holds the store and indexer reservations; selection reads them per call so a
29
30
  * provider that unloads mid-session stops serving without leaving a stale route behind.
package/lib/panel.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The one file the settings panel and the indexer both know about.
3
+ *
4
+ * `panel.json` lives inside an index root and holds choices a human made in the settings page. It is
5
+ * **not** an index artifact: nothing in it describes indexed data, it is rewritten whole on every
6
+ * save, and a missing or unreadable file means "use the configured value" rather than an error — a
7
+ * broken panel must never stop an index run.
8
+ *
9
+ * Two packages read it for different members, which is why the name lives here rather than in either
10
+ * of them: `tool` owns the HTTP surface and writes the document, while `sessions` reads
11
+ * `codexSync` on every run because that choice decides whether Codex history is part of the corpus.
12
+ * A second spelling of the filename would let the panel save a choice the indexer never sees.
13
+ * @module dsh-plugin-sessiongraph-service/panel
14
+ */
15
+ /** Name of the settings document inside an index root. */
16
+ export declare const PANEL_FILE_NAME = "panel.json";
17
+ /**
18
+ * The member of `panel.json` that decides whether Codex history is indexed.
19
+ *
20
+ * Absent means "whatever the plugin configuration says": a user who never opened the panel keeps the
21
+ * configured default, and only an explicit save stores a value. Deliberately a bare optional boolean
22
+ * rather than a tri-state — the configuration already owns "default", so the file only ever records
23
+ * a human's deviation from it.
24
+ */
25
+ export declare const PANEL_CODEX_SYNC_KEY = "codexSync";
26
+ //# sourceMappingURL=panel.d.ts.map
package/lib/panel.js ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The one file the settings panel and the indexer both know about.
3
+ *
4
+ * `panel.json` lives inside an index root and holds choices a human made in the settings page. It is
5
+ * **not** an index artifact: nothing in it describes indexed data, it is rewritten whole on every
6
+ * save, and a missing or unreadable file means "use the configured value" rather than an error — a
7
+ * broken panel must never stop an index run.
8
+ *
9
+ * Two packages read it for different members, which is why the name lives here rather than in either
10
+ * of them: `tool` owns the HTTP surface and writes the document, while `sessions` reads
11
+ * `codexSync` on every run because that choice decides whether Codex history is part of the corpus.
12
+ * A second spelling of the filename would let the panel save a choice the indexer never sees.
13
+ * @module dsh-plugin-sessiongraph-service/panel
14
+ */
15
+ /** Name of the settings document inside an index root. */
16
+ export const PANEL_FILE_NAME = 'panel.json';
17
+ /**
18
+ * The member of `panel.json` that decides whether Codex history is indexed.
19
+ *
20
+ * Absent means "whatever the plugin configuration says": a user who never opened the panel keeps the
21
+ * configured default, and only an explicit save stores a value. Deliberately a bare optional boolean
22
+ * rather than a tri-state — the configuration already owns "default", so the file only ever records
23
+ * a human's deviation from it.
24
+ */
25
+ export const PANEL_CODEX_SYNC_KEY = 'codexSync';
26
+ //# sourceMappingURL=panel.js.map
package/lib/schema.d.ts CHANGED
@@ -14,8 +14,12 @@
14
14
  * v2 stores the FTS index contentless (`content=''`): FTS5's default build keeps a copy of every
15
15
  * indexed column in a `_content` shadow table, which on a real corpus was 67MB of a 174MB file
16
16
  * holding a token stream that can always be recomputed from `entry.text`.
17
+ *
18
+ * v3 records which harness wrote a session (`session.source`). The first version indexed only DSH's
19
+ * own logs, so the column is absent rather than defaulted; a v3 row carries `'dsh'` or `'codex'` and
20
+ * a store that cannot name the origin refuses the file instead of labelling every hit "dsh".
17
21
  */
18
- export declare const SCHEMA_VERSION = 2;
22
+ export declare const SCHEMA_VERSION = 3;
19
23
  /** Relative path of the index file inside an index root. */
20
24
  export declare const INDEX_RELATIVE_PATH = "index.db";
21
25
  /** One session, keyed by its harness session id. */
package/lib/schema.js CHANGED
@@ -14,8 +14,12 @@
14
14
  * v2 stores the FTS index contentless (`content=''`): FTS5's default build keeps a copy of every
15
15
  * indexed column in a `_content` shadow table, which on a real corpus was 67MB of a 174MB file
16
16
  * holding a token stream that can always be recomputed from `entry.text`.
17
+ *
18
+ * v3 records which harness wrote a session (`session.source`). The first version indexed only DSH's
19
+ * own logs, so the column is absent rather than defaulted; a v3 row carries `'dsh'` or `'codex'` and
20
+ * a store that cannot name the origin refuses the file instead of labelling every hit "dsh".
17
21
  */
18
- export const SCHEMA_VERSION = 2;
22
+ export const SCHEMA_VERSION = 3;
19
23
  /** Relative path of the index file inside an index root. */
20
24
  export const INDEX_RELATIVE_PATH = 'index.db';
21
25
  /** One session, keyed by its harness session id. */
@@ -43,6 +47,7 @@ export const SCHEMA_STATEMENTS = [
43
47
  )`,
44
48
  `CREATE TABLE IF NOT EXISTS ${SESSION_TABLE} (
45
49
  id TEXT PRIMARY KEY,
50
+ source TEXT NOT NULL,
46
51
  workspace TEXT NOT NULL,
47
52
  title TEXT,
48
53
  created_at INTEGER NOT NULL,
package/lib/types.d.ts CHANGED
@@ -31,6 +31,18 @@ export type SessiongraphOperation = (typeof SESSIONGRAPH_OPERATIONS)[number];
31
31
  export declare const SESSIONGRAPH_ENTRY_KINDS: readonly ["user", "assistant", "tool", "title"];
32
32
  /** One entry kind. */
33
33
  export type SessiongraphEntryKind = (typeof SESSIONGRAPH_ENTRY_KINDS)[number];
34
+ /**
35
+ * Which agent harness wrote a session log.
36
+ *
37
+ * `dsh` is this host's own store under `~/.dsh/sessions`; `codex` is OpenAI Codex's rollout log
38
+ * under `~/.codex`. The value is stored per session, not per index, because one index deliberately
39
+ * holds both and a hit that cannot say where it came from makes a caller read the wrong file. It is
40
+ * a closed set rather than a free-form string: an unknown origin is a bug in the indexer, and
41
+ * widening this list is how a new harness becomes queryable.
42
+ */
43
+ export declare const SESSIONGRAPH_SOURCES: readonly ["dsh", "codex"];
44
+ /** One session source. */
45
+ export type SessiongraphSource = (typeof SESSIONGRAPH_SOURCES)[number];
34
46
  /** Error codes the seam raises, so a consumer can distinguish "no index" from "bad request". */
35
47
  export type SessiongraphErrorCode = 'SESSIONGRAPH_UNAVAILABLE' | 'SESSIONGRAPH_CONFLICT' | 'SESSIONGRAPH_INVALID_PROVIDER' | 'SESSIONGRAPH_INVALID_REQUEST' | 'SESSIONGRAPH_NOT_FOUND' | 'SESSIONGRAPH_CORRUPT' | 'SESSIONGRAPH_IO';
36
48
  /** The single error type crossing the seam. */
@@ -54,6 +66,14 @@ export interface SessiongraphSearchRequest extends SessiongraphRequestBase {
54
66
  query: string;
55
67
  /** Restrict to one workspace (exact `cwd`), or a path prefix when it ends without a trailing slash. */
56
68
  workspace?: string;
69
+ /**
70
+ * Restrict to sessions one harness wrote.
71
+ *
72
+ * An index holds DSH's own logs and Codex's rollout logs side by side, and the two answer different
73
+ * questions: "what did I ask DSH about this repo" and "what did I ask Codex about it". Absent means
74
+ * every source, which is the right default for a cross-harness sweep.
75
+ */
76
+ source?: SessiongraphSource;
57
77
  /** Only entries at or after this epoch-millisecond timestamp. */
58
78
  after?: number;
59
79
  /** Only entries at or before this epoch-millisecond timestamp. */
@@ -84,6 +104,8 @@ export interface SessiongraphSearchRequest extends SessiongraphRequestBase {
84
104
  /** One matched entry, with enough context to recognize it without a second query. */
85
105
  export interface SessiongraphHit {
86
106
  sessionId: SessiongraphSessionId;
107
+ /** Which harness wrote the session this hit belongs to. */
108
+ source: SessiongraphSource;
87
109
  /** Session title, when the session ever produced one. */
88
110
  title: string | undefined;
89
111
  /** The session's working directory. */
@@ -119,6 +141,8 @@ export interface SessiongraphSearchResult {
119
141
  /** A session's metadata, as the timeline and session operations report it. */
120
142
  export interface SessiongraphSessionSummary {
121
143
  sessionId: SessiongraphSessionId;
144
+ /** Which harness wrote this session's log. */
145
+ source: SessiongraphSource;
122
146
  title: string | undefined;
123
147
  workspace: string;
124
148
  /** Epoch milliseconds of the session's first event. */
@@ -172,6 +196,8 @@ export interface SessiongraphTimelineRequest extends SessiongraphRequestBase {
172
196
  operation: 'timeline';
173
197
  /** Restrict to one workspace, or a path prefix when it ends without a trailing slash. */
174
198
  workspace?: string;
199
+ /** Restrict to one harness's sessions. Absent means every source. */
200
+ source?: SessiongraphSource;
175
201
  /** Only sessions whose last event is at or after this epoch-millisecond timestamp. */
176
202
  after?: number;
177
203
  /** Only sessions whose first event is at or before this epoch-millisecond timestamp. */
@@ -191,6 +217,8 @@ export interface SessiongraphTimelineResult {
191
217
  /** Enumerate the workspaces the index covers. */
192
218
  export interface SessiongraphWorkspacesRequest extends SessiongraphRequestBase {
193
219
  operation: 'workspaces';
220
+ /** Restrict the census to one harness's sessions. Absent means every source. */
221
+ source?: SessiongraphSource;
194
222
  /** Maximum workspaces to return, most recently active first. */
195
223
  limit: number;
196
224
  /** Workspaces to skip, for paging; follows the most-recently-active-first order. */
package/lib/types.js CHANGED
@@ -26,6 +26,16 @@ export const SESSIONGRAPH_OPERATIONS = ['search', 'session', 'event', 'trace', '
26
26
  * is a session title, kept as its own kind so a title match is recognizable in the hit list.
27
27
  */
28
28
  export const SESSIONGRAPH_ENTRY_KINDS = ['user', 'assistant', 'tool', 'title'];
29
+ /**
30
+ * Which agent harness wrote a session log.
31
+ *
32
+ * `dsh` is this host's own store under `~/.dsh/sessions`; `codex` is OpenAI Codex's rollout log
33
+ * under `~/.codex`. The value is stored per session, not per index, because one index deliberately
34
+ * holds both and a hit that cannot say where it came from makes a caller read the wrong file. It is
35
+ * a closed set rather than a free-form string: an unknown origin is a bug in the indexer, and
36
+ * widening this list is how a new harness becomes queryable.
37
+ */
38
+ export const SESSIONGRAPH_SOURCES = ['dsh', 'codex'];
29
39
  /** The single error type crossing the seam. */
30
40
  export class SessiongraphError extends Error {
31
41
  code;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-sessiongraph-service",
3
- "version": "0.2.0",
3
+ "version": "0.3.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",