@amaster.ai/dsh-storage 0.1.2 → 0.1.4

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.js CHANGED
@@ -48,11 +48,11 @@ export function apply(ctx, config) {
48
48
  // Lifecycle: this cordis fork has no 'ready'/'dispose' events — startup
49
49
  // work goes in ctx.effect() (runs immediately at plugin load; the returned
50
50
  // disposer runs on fiber unload at shutdown). Event taps verified against
51
- // @deepseek-ai/dsh-session@0.1.5-rc.1: session/event(session, event),
51
+ // @deepseek-ai/dsh-session@0.1.6-alpha.2: session/event(session, event),
52
52
  // session/disposed(session), and the awaited session/flush(session)
53
- // durability checkpoint. The cast stays because the dsh-session types that
54
- // declare these event names are not installed.
55
- const on = ctx.on.bind(ctx);
53
+ // durability checkpoint. The type-only import above registers the event
54
+ // names; handler params stay `any` because storage also mirrors
55
+ // plugin-owned event types (e.g. session/title) it does not depend on.
56
56
  if (!config.enabled || !config.database.enabled || !config.database.url)
57
57
  return;
58
58
  const backends = [
@@ -137,7 +137,7 @@ export function apply(ctx, config) {
137
137
  };
138
138
  });
139
139
  /* eslint-disable @typescript-eslint/no-explicit-any */
140
- on('session/event', (session, event) => {
140
+ ctx.on('session/event', (session, event) => {
141
141
  const sessionId = session?.id ?? 'unknown';
142
142
  enqueue(sessionId, async () => {
143
143
  let accum = sessions.get(sessionId);
@@ -171,7 +171,7 @@ export function apply(ctx, config) {
171
171
  }
172
172
  }
173
173
  // Latest-wins title snapshot (log-only `session/title` event; payload
174
- // { title, messageSeqs, source } verified against dsh-session-title@0.1.5-rc.1).
174
+ // { title, messageSeqs, source } verified against dsh-session-title@0.1.6-alpha.2).
175
175
  if (event?.type === 'session/title' && typeof event.data?.title === 'string') {
176
176
  accum.title = event.data.title;
177
177
  }
@@ -198,7 +198,7 @@ export function apply(ctx, config) {
198
198
  }
199
199
  });
200
200
  });
201
- on('session/disposed', (session) => {
201
+ ctx.on('session/disposed', (session) => {
202
202
  const sessionId = session?.id ?? 'unknown';
203
203
  // The delete must run inside the session's chain — a synchronous delete
204
204
  // here races the queued event tasks (the map may not even have the entry
@@ -218,7 +218,7 @@ export function apply(ctx, config) {
218
218
  });
219
219
  });
220
220
  // Durability checkpoint: the store awaits every session/flush listener.
221
- on('session/flush', async () => {
221
+ ctx.on('session/flush', async () => {
222
222
  await Promise.all([...pending]);
223
223
  });
224
224
  }
package/lib/projector.js CHANGED
@@ -117,7 +117,7 @@ export function projectEvent(_session, event, sessionId) {
117
117
  * Extract the usage sample carried by one event, keyed by its step, or null
118
118
  * when the event carries none.
119
119
  *
120
- * V3 session log (dsh-session@0.1.5-rc.1):
120
+ * V3 session log (dsh-session@0.1.6-alpha.2):
121
121
  * - `assistant/message.data.usage` — the settled step's final accounting;
122
122
  * - `assistant/attempt` — a failed/retried/cancelled step commits no surface
123
123
  * message; the adapter's usage chunk survives as a raw `chunk` record in the
@@ -30,7 +30,7 @@ export interface UsageSample {
30
30
  * Extract the usage sample carried by one event, keyed by its step, or null
31
31
  * when the event carries none.
32
32
  *
33
- * V3 session log (dsh-session@0.1.5-rc.1):
33
+ * V3 session log (dsh-session@0.1.6-alpha.2):
34
34
  * - `assistant/message.data.usage` — the settled step's final accounting;
35
35
  * - `assistant/attempt` — a failed/retried/cancelled step commits no surface
36
36
  * message; the adapter's usage chunk survives as a raw `chunk` record in the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amaster.ai/dsh-storage",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Session storage mirror for DeepSeek Harness: projects the session event stream into MySQL/PostgreSQL/SQLite/SQL Server (ai_messages / ai_chat_histories) without replacing dsh's local persistence.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@deepseek-ai/cordis": "^4.0.1",
40
- "@deepseek-ai/dsh-session": "0.1.5-rc.1",
40
+ "@deepseek-ai/dsh-session": ">=0.1.5-rc.1",
41
41
  "@prisma/adapter-libsql": "^7.9.1",
42
42
  "@prisma/adapter-mariadb": "^7.9.1",
43
43
  "@prisma/adapter-mssql": "^7.9.1",
@@ -63,6 +63,7 @@
63
63
  },
64
64
  "devDependencies": {
65
65
  "@deepseek-ai/cordis": "^4.0.1",
66
+ "@deepseek-ai/dsh-session": "0.1.6-alpha.2",
66
67
  "@prisma/adapter-libsql": "^7.9.1",
67
68
  "@prisma/adapter-mariadb": "^7.9.1",
68
69
  "@prisma/adapter-mssql": "^7.9.1",