@morlay/session-rdb 0.0.21-alpha.7 → 0.0.21-alpha.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.
Files changed (45) hide show
  1. package/README.md +31 -12
  2. package/dist/artifact.d.mts +2 -101
  3. package/dist/artifact.mjs +2 -2
  4. package/dist/{branch-BjUR6wfe.mjs → branch-D4nVzQQM.mjs} +3 -3
  5. package/dist/deletion.d.mts +1 -1
  6. package/dist/deletion.mjs +1 -1
  7. package/dist/{dist-vIVO6bA-.mjs → dist-DHer1cql.mjs} +14 -7
  8. package/dist/export.d.mts +8 -0
  9. package/dist/export.mjs +76 -0
  10. package/dist/gc.d.mts +8 -0
  11. package/dist/gc.mjs +51 -0
  12. package/dist/import.d.mts +1 -1
  13. package/dist/import.mjs +1 -1
  14. package/dist/index.d.mts +2 -2
  15. package/dist/index.mjs +3 -3
  16. package/dist/{log-qCNkDjh5.mjs → log-BWVFYAh5.mjs} +39 -12
  17. package/dist/{backend-E0bmTXpz.d.mts → log-CUjKQbOR.d.mts} +222 -39
  18. package/dist/{sqlite-zcXVyMxr.mjs → sqlite-SCiSnwaz.mjs} +321 -259
  19. package/dist/{src-B9X8BKyh.mjs → src-BZ1tffd5.mjs} +342 -310
  20. package/dist/storage.d.mts +20 -7
  21. package/dist/storage.mjs +2 -2
  22. package/dist/testing.d.mts +1 -1
  23. package/dist/testing.mjs +48 -29
  24. package/dist/usage.d.mts +2 -0
  25. package/dist/usage.mjs +152 -0
  26. package/drizzle/postgres/20260923120000_v3_usage_materialized/migration.sql +48 -0
  27. package/drizzle/sqlite/20260923120000_v3_usage_materialized/migration.sql +48 -0
  28. package/package.json +25 -30
  29. package/src/backend.ts +41 -17
  30. package/src/branch.ts +4 -4
  31. package/src/drizzle/postgres-v3.ts +2 -0
  32. package/src/drizzle/sqlite-v3.ts +2 -0
  33. package/src/entities/v3/event-usage.ts +8 -1
  34. package/src/entities/v3/index.ts +8 -0
  35. package/src/entities/v3/session-counts.ts +23 -0
  36. package/src/entities/v3/session-usage.ts +29 -0
  37. package/src/index.ts +230 -88
  38. package/src/log.ts +58 -17
  39. package/src/postgres.ts +248 -149
  40. package/src/rows.ts +2 -1
  41. package/src/schema.ts +4 -0
  42. package/src/sqlite.ts +263 -124
  43. package/src/storage-takeover/repository.ts +1 -4
  44. package/src/usage.ts +10 -6
  45. package/cordis.patch.yml +0 -13
@@ -1,4 +1,4 @@
1
- import { A as eventKind, B as tWorkspaceState, C as EVENT_ENCODING, D as SCHEMA_VERSION, E as JournalMode, F as tSessionEvents, H as WriteGuard, I as tSessionProjcacheRows, L as tSessions, M as tEvents, N as tPersistenceState, O as SESSION_PERSISTENCE_SQLITE_APPLICATION_ID, P as tSchemaMeta, R as tStorageUnits, S as DEFAULT_BUSY_TIMEOUT_MS, T as EventRole, U as StorageRepository, V as tWorkspaces, a as SessionListRowsPage, c as UsageAggregate, i as EventRow, j as tEventUsage, k as eventDimensions, n as BackendTx, o as SessionListRowsQuery, r as EventCountBucket, s as SessionRow, t as Backend, w as EventKind, z as tWorkspaceSessions } from "./backend-E0bmTXpz.mjs";
1
+ import { A as SessionRow, At as tWorkspaceState, Ct as tSessionCounts, D as SessionCountBucket, Dt as tSessions, E as EventRow, Et as tSessionUsage, I as UsageAggregate, Mt as WriteGuard, Nt as StorageRepository, O as SessionListRowsPage, Ot as tStorageUnits, St as tSchemaMeta, T as BackendTx, Tt as tSessionProjcacheRows, _t as eventDimensions, bt as tEvents, dt as EVENT_ENCODING, ft as EventKind, gt as SESSION_PERSISTENCE_SQLITE_APPLICATION_ID, ht as SCHEMA_VERSION, j as SessionUsageBucket, jt as tWorkspaces, k as SessionListRowsQuery, kt as tWorkspaceSessions, mt as JournalMode, pt as EventRole, ut as DEFAULT_BUSY_TIMEOUT_MS, vt as eventKind, w as Backend, wt as tSessionEvents, xt as tPersistenceState, yt as tEventUsage } from "./log-CUjKQbOR.mjs";
2
2
  import { SessionId } from "@deepseek-ai/dsh-session";
3
3
  import { DatabaseSync } from "node:sqlite";
4
4
  //#region src/sqlite.d.ts
@@ -53,14 +53,27 @@ declare class SqliteBackend implements Backend {
53
53
  * `f_created_at`(同一时刻写入,口径一致)。
54
54
  */
55
55
  listSessionRows(query?: SessionListRowsQuery): Promise<SessionListRowsPage>;
56
+ /**
57
+ * 用量聚合:只读三张派生统计表——事件级用量行给去重口径的总量与「天 × 模型」桶,
58
+ * `t_session_usage` / `t_session_counts` 给按会话的行(含 fork 继承前缀)。
59
+ * 归属、本地日与「是否被引用」都是物化列,这里不再现算、也不回连事件表。
60
+ * 事件级按毫秒时间戳过滤、汇总表按本地日过滤——`sinceMs` 对齐到本地零点时两者等价。
61
+ */
56
62
  usageReport(sinceMs?: number): Promise<UsageAggregate>;
57
- /** 活动计数旁路累加:派生表 `t_event_counts`,不在写事务里(失败可丢,表可销毁重建)。 */
58
- incrementEventCounts(id: SessionId, buckets: readonly EventCountBucket[]): Promise<void>;
59
- /** 按会话重算活动计数(rewind / fork 之后):先删该会话的行,再从事件表重算。 */
60
- rebuildEventCounts(id: SessionId): Promise<void>;
61
- deleteEventCounts(id: SessionId): Promise<void>;
63
+ /** token 用量旁路累加:派生表 `t_session_usage`,不在写事务里(失败可丢,表可销毁重建)。 */
64
+ incrementSessionUsage(id: SessionId, buckets: readonly SessionUsageBucket[]): Promise<void>;
65
+ /** 活动计数旁路累加:派生表 `t_session_counts`,同上(四项计数一次落)。 */
66
+ incrementSessionCounts(id: SessionId, buckets: readonly SessionCountBucket[]): Promise<void>;
67
+ /** 按会话重算两张汇总表(rewind / fork 之后):先删该会话的行,再从事件表重算。 */
68
+ rebuildSessionStats(id: SessionId): Promise<void>;
69
+ /**
70
+ * 全量重算用量行的引用标记:rewind 截断 / fork 复用 / 会话删除都会让「引用」跨会话变化,
71
+ * 只按本会话判定不够。低频路径,一次全表 UPDATE(3 万行量级)。
72
+ */
73
+ refreshEventUsageFlags(): Promise<void>;
74
+ deleteSessionStats(id: SessionId): Promise<void>;
62
75
  vacuum(): Promise<void>;
63
76
  private eventRows;
64
77
  }
65
78
  //#endregion
66
- export { DEFAULT_BUSY_TIMEOUT_MS, EVENT_ENCODING, EventKind, EventRole, type EventRow, JournalMode, SCHEMA_VERSION, SESSION_PERSISTENCE_SQLITE_APPLICATION_ID, type SessionRow, SqliteBackend, SqliteBackendOptions, WriteGuard, eventDimensions, eventKind, openDatabase, tEventUsage, tEvents, tPersistenceState, tSchemaMeta, tSessionEvents, tSessionProjcacheRows, tSessions, tStorageUnits, tWorkspaceSessions, tWorkspaceState, tWorkspaces };
79
+ export { DEFAULT_BUSY_TIMEOUT_MS, EVENT_ENCODING, EventKind, EventRole, type EventRow, JournalMode, SCHEMA_VERSION, SESSION_PERSISTENCE_SQLITE_APPLICATION_ID, type SessionRow, SqliteBackend, SqliteBackendOptions, WriteGuard, eventDimensions, eventKind, openDatabase, tEventUsage, tEvents, tPersistenceState, tSchemaMeta, tSessionCounts, tSessionEvents, tSessionProjcacheRows, tSessionUsage, tSessions, tStorageUnits, tWorkspaceSessions, tWorkspaceState, tWorkspaces };
package/dist/storage.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { A as WriteGuard, C as tSessions, D as tWorkspaces, E as tWorkspaceState, S as tSessionProjcacheRows, T as tWorkspaceSessions, _ as tEventUsage, b as tSchemaMeta, d as DEFAULT_BUSY_TIMEOUT_MS, f as EVENT_ENCODING, g as eventKind, h as eventDimensions, m as SESSION_PERSISTENCE_SQLITE_APPLICATION_ID, n as openDatabase, p as SCHEMA_VERSION, t as SqliteBackend, v as tEvents, w as tStorageUnits, x as tSessionEvents, y as tPersistenceState } from "./sqlite-zcXVyMxr.mjs";
2
- export { DEFAULT_BUSY_TIMEOUT_MS, EVENT_ENCODING, SCHEMA_VERSION, SESSION_PERSISTENCE_SQLITE_APPLICATION_ID, SqliteBackend, WriteGuard, eventDimensions, eventKind, openDatabase, tEventUsage, tEvents, tPersistenceState, tSchemaMeta, tSessionEvents, tSessionProjcacheRows, tSessions, tStorageUnits, tWorkspaceSessions, tWorkspaceState, tWorkspaces };
1
+ import { S as tWorkspaces, T as WriteGuard, _ as tSessionUsage, a as EVENT_ENCODING, b as tWorkspaceSessions, c as eventDimensions, d as tEvents, f as tPersistenceState, g as tSessionProjcacheRows, h as tSessionEvents, i as DEFAULT_BUSY_TIMEOUT_MS, l as eventKind, m as tSessionCounts, n as openDatabase, o as SCHEMA_VERSION, p as tSchemaMeta, s as SESSION_PERSISTENCE_SQLITE_APPLICATION_ID, t as SqliteBackend, u as tEventUsage, v as tSessions, x as tWorkspaceState, y as tStorageUnits } from "./sqlite-SCiSnwaz.mjs";
2
+ export { DEFAULT_BUSY_TIMEOUT_MS, EVENT_ENCODING, SCHEMA_VERSION, SESSION_PERSISTENCE_SQLITE_APPLICATION_ID, SqliteBackend, WriteGuard, eventDimensions, eventKind, openDatabase, tEventUsage, tEvents, tPersistenceState, tSchemaMeta, tSessionCounts, tSessionEvents, tSessionProjcacheRows, tSessionUsage, tSessions, tStorageUnits, tWorkspaceSessions, tWorkspaceState, tWorkspaces };
@@ -1,4 +1,4 @@
1
- import { v as truncateLiveSession } from "./backend-E0bmTXpz.mjs";
1
+ import { ot as truncateLiveSession } from "./log-CUjKQbOR.mjs";
2
2
  import { SessionPersistence } from "@deepseek-ai/dsh-session-persistence";
3
3
  import { Session, SessionEvent, SessionHeader, SessionId } from "@deepseek-ai/dsh-session";
4
4
  import { Context, Fiber } from "@deepseek-ai/cordis";
package/dist/testing.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as truncateLiveSession } from "./branch-BjUR6wfe.mjs";
1
+ import { a as truncateLiveSession } from "./branch-D4nVzQQM.mjs";
2
2
  import { SessionAlreadyExistsError, SessionAlreadyOwnedError, SessionFormatUnsupportedError, SessionHandleClosedError, SessionPersistenceNotFoundError, SessionReadOnlyError } from "@deepseek-ai/dsh-session-persistence";
3
3
  import SessionStore, { SESSION_FORMAT_VERSION, SessionId, SessionLogOffset, SessionSeq } from "@deepseek-ai/dsh-session";
4
4
  import { Context } from "@deepseek-ai/cordis";
@@ -6,7 +6,7 @@ import { MessageId, createUserMessage, freezeMessage } from "@deepseek-ai/dsh-ll
6
6
  //#region \0rolldown/runtime.js
7
7
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
8
8
  //#endregion
9
- //#region ../../../node_modules/.pnpm/vitest@5.0.1_@opentelemetry+api@1.9.1_@types+node@26.6.2_happy-dom@20.14.5_jsdom@30.1.1_5c5cec99992ade60b7d45a9d0ac17da3/node_modules/vitest/dist/chunks/tinyrainbow.Ht9iggcq.js
9
+ //#region ../../../node_modules/.pnpm/vitest@5.0.2_@opentelemetry+api@1.9.1_@types+node@26.6.3_happy-dom@20.14.5_jsdom@30.1.1_5bd35cff0016eb681427af506a019366/node_modules/vitest/dist/chunks/tinyrainbow.Ht9iggcq.js
10
10
  var b$1 = {
11
11
  reset: [0, 0],
12
12
  bold: [
@@ -58,16 +58,16 @@ var b$1 = {
58
58
  bgCyanBright: [106, 49],
59
59
  bgWhiteBright: [107, 49]
60
60
  };
61
- function i$1(e) {
61
+ function i(e) {
62
62
  return String(e);
63
63
  }
64
- i$1.open = "";
65
- i$1.close = "";
64
+ i.open = "";
65
+ i.close = "";
66
66
  function B() {
67
67
  let e = typeof process != "undefined" ? process : void 0, r = (e == null ? void 0 : e.env) || {}, a = r.FORCE_TTY !== "false", l = (e == null ? void 0 : e.argv) || [];
68
68
  return !("NO_COLOR" in r || l.includes("--no-color")) && ("FORCE_COLOR" in r || l.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || a && r.TERM !== "dumb" || "CI" in r) || typeof window != "undefined" && !!window.chrome;
69
69
  }
70
- function C({ force: e } = {}) {
70
+ function C$1({ force: e } = {}) {
71
71
  let r = e || B(), a = (t, o, u, n) => {
72
72
  let g = "", s = 0;
73
73
  do
@@ -83,13 +83,13 @@ function C({ force: e } = {}) {
83
83
  }, c = { isColorSupported: r }, f = (t) => `\x1B[${t}m`;
84
84
  for (let t in b$1) {
85
85
  let o = b$1[t];
86
- c[t] = r ? l(f(o[0]), f(o[1]), o[2]) : i$1;
86
+ c[t] = r ? l(f(o[0]), f(o[1]), o[2]) : i;
87
87
  }
88
88
  return c;
89
89
  }
90
- var y$1 = C();
90
+ var y$1 = C$1();
91
91
  //#endregion
92
- //#region ../../../node_modules/.pnpm/vitest@5.0.1_@opentelemetry+api@1.9.1_@types+node@26.6.2_happy-dom@20.14.5_jsdom@30.1.1_5c5cec99992ade60b7d45a9d0ac17da3/node_modules/vitest/dist/chunks/index.M2dsQ_UQ.js
92
+ //#region ../../../node_modules/.pnpm/vitest@5.0.2_@opentelemetry+api@1.9.1_@types+node@26.6.3_happy-dom@20.14.5_jsdom@30.1.1_5bd35cff0016eb681427af506a019366/node_modules/vitest/dist/chunks/index.M2dsQ_UQ.js
93
93
  function _mergeNamespaces$1(n, m) {
94
94
  m.forEach(function(e) {
95
95
  e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
@@ -988,7 +988,7 @@ const plugins = {
988
988
  Error: ErrorPlugin
989
989
  };
990
990
  //#endregion
991
- //#region ../../../node_modules/.pnpm/vitest@5.0.1_@opentelemetry+api@1.9.1_@types+node@26.6.2_happy-dom@20.14.5_jsdom@30.1.1_5c5cec99992ade60b7d45a9d0ac17da3/node_modules/vitest/dist/chunks/display.pkpxlVcY.js
991
+ //#region ../../../node_modules/.pnpm/vitest@5.0.2_@opentelemetry+api@1.9.1_@types+node@26.6.3_happy-dom@20.14.5_jsdom@30.1.1_5bd35cff0016eb681427af506a019366/node_modules/vitest/dist/chunks/display.pkpxlVcY.js
992
992
  const { AsymmetricMatcher: AsymmetricMatcher$3, DOMCollection: DOMCollection$2, DOMElement: DOMElement$2, Immutable: Immutable$2, ReactElement: ReactElement$2, ReactTestComponent: ReactTestComponent$2 } = plugins;
993
993
  const PLUGINS$2 = [
994
994
  ReactTestComponent$2,
@@ -1449,7 +1449,7 @@ const isAbsolute = function(p) {
1449
1449
  return _IS_ABSOLUTE_RE.test(p);
1450
1450
  };
1451
1451
  //#endregion
1452
- //#region ../../../node_modules/.pnpm/vitest@5.0.1_@opentelemetry+api@1.9.1_@types+node@26.6.2_happy-dom@20.14.5_jsdom@30.1.1_5c5cec99992ade60b7d45a9d0ac17da3/node_modules/vitest/dist/chunks/source-map.BH0bbrs9.js
1452
+ //#region ../../../node_modules/.pnpm/vitest@5.0.2_@opentelemetry+api@1.9.1_@types+node@26.6.3_happy-dom@20.14.5_jsdom@30.1.1_5bd35cff0016eb681427af506a019366/node_modules/vitest/dist/chunks/source-map.BH0bbrs9.js
1453
1453
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
1454
1454
  function getDefaultExportFromCjs(x) {
1455
1455
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -2232,7 +2232,7 @@ function getOriginalPosition(map, needle) {
2232
2232
  return result;
2233
2233
  }
2234
2234
  //#endregion
2235
- //#region ../../../node_modules/.pnpm/vitest@5.0.1_@opentelemetry+api@1.9.1_@types+node@26.6.2_happy-dom@20.14.5_jsdom@30.1.1_5c5cec99992ade60b7d45a9d0ac17da3/node_modules/vitest/dist/task-utils.js
2235
+ //#region ../../../node_modules/.pnpm/vitest@5.0.2_@opentelemetry+api@1.9.1_@types+node@26.6.3_happy-dom@20.14.5_jsdom@30.1.1_5bd35cff0016eb681427af506a019366/node_modules/vitest/dist/task-utils.js
2236
2236
  /* @__NO_SIDE_EFFECTS__ */
2237
2237
  function getNames(task) {
2238
2238
  const names = [task.name];
@@ -2249,7 +2249,7 @@ function createTaskName(names, separator = " > ") {
2249
2249
  return names.filter((name) => name !== void 0).join(separator);
2250
2250
  }
2251
2251
  //#endregion
2252
- //#region ../../../node_modules/.pnpm/vitest@5.0.1_@opentelemetry+api@1.9.1_@types+node@26.6.2_happy-dom@20.14.5_jsdom@30.1.1_5c5cec99992ade60b7d45a9d0ac17da3/node_modules/vitest/dist/chunks/run.C5UmxDPh.js
2252
+ //#region ../../../node_modules/.pnpm/vitest@5.0.2_@opentelemetry+api@1.9.1_@types+node@26.6.3_happy-dom@20.14.5_jsdom@30.1.1_5bd35cff0016eb681427af506a019366/node_modules/vitest/dist/chunks/run.C5UmxDPh.js
2253
2253
  /**
2254
2254
  * Diff Match and Patch
2255
2255
  * Copyright 2018 The diff-match-patch Authors.
@@ -4900,7 +4900,7 @@ async function finishSendTasksUpdate(runner) {
4900
4900
  await Promise.all(pendingTasksUpdates);
4901
4901
  }
4902
4902
  //#endregion
4903
- //#region ../../../node_modules/.pnpm/vitest@5.0.1_@opentelemetry+api@1.9.1_@types+node@26.6.2_happy-dom@20.14.5_jsdom@30.1.1_5c5cec99992ade60b7d45a9d0ac17da3/node_modules/vitest/dist/chunks/utils.DYj33du9.js
4903
+ //#region ../../../node_modules/.pnpm/vitest@5.0.2_@opentelemetry+api@1.9.1_@types+node@26.6.3_happy-dom@20.14.5_jsdom@30.1.1_5bd35cff0016eb681427af506a019366/node_modules/vitest/dist/chunks/utils.DYj33du9.js
4904
4904
  const NAME_WORKER_STATE = "__vitest_worker__";
4905
4905
  function getWorkerState() {
4906
4906
  const workerState = globalThis[NAME_WORKER_STATE];
@@ -4926,12 +4926,13 @@ function resetModules(modules, resetMocks = false) {
4926
4926
  });
4927
4927
  }
4928
4928
  //#endregion
4929
- //#region ../../../node_modules/.pnpm/vitest@5.0.1_@opentelemetry+api@1.9.1_@types+node@26.6.2_happy-dom@20.14.5_jsdom@30.1.1_5c5cec99992ade60b7d45a9d0ac17da3/node_modules/vitest/dist/chunks/spy.DQ0ZsPbi.js
4929
+ //#region ../../../node_modules/.pnpm/vitest@5.0.2_@opentelemetry+api@1.9.1_@types+node@26.6.3_happy-dom@20.14.5_jsdom@30.1.1_5bd35cff0016eb681427af506a019366/node_modules/vitest/dist/chunks/spy.KLHgXex_.js
4930
4930
  function isMockFunction(fn) {
4931
4931
  return typeof fn === "function" && "_isMockFunction" in fn && fn._isMockFunction === true;
4932
4932
  }
4933
4933
  const MOCK_RESTORE = /* @__PURE__ */ new Set();
4934
4934
  const DIRTY_MOCK_STATES = /* @__PURE__ */ new Set();
4935
+ const addDirtyMock = DIRTY_MOCK_STATES.add.bind(DIRTY_MOCK_STATES);
4935
4936
  const REGISTERED_MOCKS = /* @__PURE__ */ new Set();
4936
4937
  const MOCK_FINALIZER = new FinalizationRegistry((ref) => {
4937
4938
  REGISTERED_MOCKS.delete(ref);
@@ -5164,8 +5165,8 @@ function createMock({ state, config, name: mockName, prototypeState, prototypeCo
5164
5165
  const noopImplementation = function() {};
5165
5166
  const prototypeMock = prototypeState && MOCKS_BY_STATE.get(prototypeState);
5166
5167
  const namedObject = { [name]: (function(...args) {
5167
- DIRTY_MOCK_STATES.add(namedObject[name]);
5168
- if (prototypeMock) DIRTY_MOCK_STATES.add(prototypeMock);
5168
+ addDirtyMock(namedObject[name]);
5169
+ if (prototypeMock) addDirtyMock(prototypeMock);
5169
5170
  registerCalls(args, state, prototypeState);
5170
5171
  registerInvocationOrder(invocationCallCounter++, state, prototypeState);
5171
5172
  const result = {
@@ -8322,7 +8323,7 @@ function use(fn) {
8322
8323
  }
8323
8324
  __name(use, "use");
8324
8325
  //#endregion
8325
- //#region ../../../node_modules/.pnpm/vitest@5.0.1_@opentelemetry+api@1.9.1_@types+node@26.6.2_happy-dom@20.14.5_jsdom@30.1.1_5c5cec99992ade60b7d45a9d0ac17da3/node_modules/vitest/dist/chunks/plugins.Cigb0uSy.js
8326
+ //#region ../../../node_modules/.pnpm/vitest@5.0.2_@opentelemetry+api@1.9.1_@types+node@26.6.3_happy-dom@20.14.5_jsdom@30.1.1_5bd35cff0016eb681427af506a019366/node_modules/vitest/dist/chunks/plugins.Cigb0uSy.js
8326
8327
  const serialize$1 = (val, config, indentation, depth, refs, printer) => {
8327
8328
  const name = val.getMockName();
8328
8329
  const nameString = name === "vi.fn()" ? "" : ` ${name}`;
@@ -8355,7 +8356,7 @@ function getSerializers() {
8355
8356
  return PLUGINS;
8356
8357
  }
8357
8358
  //#endregion
8358
- //#region ../../../node_modules/.pnpm/vitest@5.0.1_@opentelemetry+api@1.9.1_@types+node@26.6.2_happy-dom@20.14.5_jsdom@30.1.1_5c5cec99992ade60b7d45a9d0ac17da3/node_modules/vitest/dist/chunks/offset.Dy-5Fdfn.js
8359
+ //#region ../../../node_modules/.pnpm/vitest@5.0.2_@opentelemetry+api@1.9.1_@types+node@26.6.3_happy-dom@20.14.5_jsdom@30.1.1_5bd35cff0016eb681427af506a019366/node_modules/vitest/dist/chunks/offset.Dy-5Fdfn.js
8359
8360
  const lineSplitRE = /\r?\n/;
8360
8361
  function positionToOffset(source, lineNumber, columnNumber) {
8361
8362
  const lines = source.split(lineSplitRE);
@@ -8380,18 +8381,27 @@ function offsetToLineNumber(source, offset) {
8380
8381
  }
8381
8382
  Object.freeze(() => {});
8382
8383
  globalThis.Event;
8383
- function r(e = globalThis) {
8384
+ (async () => {}).constructor;
8385
+ function m(e = globalThis) {
8384
8386
  let t = "unknown", n = "unknown";
8385
- return e.Bun || e.process && e.process.versions?.bun ? (t = "bun", n = e.Bun.version || "unknown") : e.Deno ? (t = "deno", n = e.Deno.version?.deno ?? "unknown") : e.process && e.process.release?.name === "node" ? (t = "node", n = e.process.versions?.node ?? "unknown") : e.HermesInternal ? (t = "hermes", n = e.HermesInternal.getRuntimeProperties?.()["OSS Release Version"] ?? "unknown") : i(e) && e.navigator.userAgent === "Cloudflare-Workers" ? t = "workerd" : i(e) && e.navigator.userAgent.toLowerCase().startsWith("quickjs-ng") ? (t = "quickjs-ng", n = e.navigator.userAgent.split("/")[1] ?? "unknown") : typeof e.Netlify == "object" ? t = "netlify" : typeof e.EdgeRuntime == "string" ? t = "edge-light" : e.__lagon__ ? t = "lagon" : e.fastly ? t = "fastly" : e.$262 && e.lockdown && e.AsyncDisposableStack ? t = "moddable" : e.d8 ? (t = "v8", n = typeof e.version == "function" ? e.version() : "unknown") : e.inIon && e.performance && e.performance.mozMemory ? t = "spidermonkey" : typeof e.$ == "object" && e.$ !== null && "IsHTMLDDA" in e.$ ? t = "jsc" : e.window && e.navigator && (t = "browser"), {
8387
+ if (e.Bun || e.process && e.process.versions?.bun) {
8388
+ t = "bun";
8389
+ let r = e.Bun?.version;
8390
+ if (r) n = r;
8391
+ else {
8392
+ let t = e.process?.versions?.bun;
8393
+ t && (n = t);
8394
+ }
8395
+ } else e.Deno ? (t = "deno", n = e.Deno.version?.deno ?? "unknown") : e.process && e.process.release?.name === "node" ? (t = "node", n = e.process.versions?.node ?? "unknown") : e.HermesInternal ? (t = "hermes", n = e.HermesInternal.getRuntimeProperties?.()["OSS Release Version"] ?? "unknown") : h(e) && e.navigator.userAgent === "Cloudflare-Workers" ? t = "workerd" : h(e) && e.navigator.userAgent.toLowerCase().startsWith("quickjs-ng") ? (t = "quickjs-ng", n = e.navigator.userAgent.split("/")[1] ?? "unknown") : typeof e.Netlify == "object" ? t = "netlify" : typeof e.EdgeRuntime == "string" ? t = "edge-light" : e.__lagon__ ? t = "lagon" : e.fastly ? t = "fastly" : e.$262 && e.lockdown && e.AsyncDisposableStack ? t = "moddable" : e.d8 ? (t = "v8", n = typeof e.version == "function" ? e.version() : "unknown") : e.inIon && e.performance && e.performance.mozMemory ? t = "spidermonkey" : typeof e.$ == "object" && e.$ !== null && "IsHTMLDDA" in e.$ ? t = "jsc" : e.window && e.navigator && (t = "browser");
8396
+ return {
8386
8397
  runtime: t,
8387
8398
  version: n
8388
8399
  };
8389
8400
  }
8390
- function i(e = globalThis) {
8401
+ function h(e = globalThis) {
8391
8402
  return typeof e.navigator == "object" && e.navigator !== null && typeof e.navigator.userAgent == "string";
8392
8403
  }
8393
- const { runtime: a, version: o } = r();
8394
- (async () => {}).constructor;
8404
+ const { runtime: g, version: _ } = m();
8395
8405
  globalThis.performance.now.bind(globalThis.performance);
8396
8406
  globalThis.process?.hrtime?.bigint.bind(globalThis.process?.hrtime);
8397
8407
  globalThis.Bun?.nanoseconds;
@@ -8687,7 +8697,7 @@ function memo(fn) {
8687
8697
  };
8688
8698
  }
8689
8699
  async function saveInlineSnapshots(environment, snapshots) {
8690
- const MagicString = (await import("./dist-vIVO6bA-.mjs")).default;
8700
+ const MagicString = (await import("./dist-DHer1cql.mjs")).default;
8691
8701
  const files = new Set(snapshots.map((i) => i.file));
8692
8702
  await Promise.all(Array.from(files).map(async (file) => {
8693
8703
  const snaps = snapshots.filter((i) => i.file === file);
@@ -9586,8 +9596,9 @@ function asymmetricMatch(a, b, customTesters) {
9586
9596
  const asymmetricA = isAsymmetric(a);
9587
9597
  const asymmetricB = isAsymmetric(b);
9588
9598
  if (asymmetricA && asymmetricB) return;
9589
- if (asymmetricA) return a.asymmetricMatch(b, customTesters);
9590
- if (asymmetricB) return b.asymmetricMatch(a, customTesters);
9599
+ const testers = customTesters.filter((tester) => !isSubsetEqualityTester(tester));
9600
+ if (asymmetricA) return a.asymmetricMatch(b, testers);
9601
+ if (asymmetricB) return b.asymmetricMatch(a, testers);
9591
9602
  }
9592
9603
  function isError(value) {
9593
9604
  if (typeof Error.isError === "function") return Error.isError(value);
@@ -9790,9 +9801,17 @@ function hasPropertyInObject(object, key) {
9790
9801
  function isObjectWithKeys(a) {
9791
9802
  return isObject(a) && !isError(a) && !Array.isArray(a) && !(a instanceof Date) && !(a instanceof Set) && !(a instanceof Map);
9792
9803
  }
9804
+ const subsetEqualityTesters = /* @__PURE__ */ new WeakSet();
9805
+ function registerSubsetEqualityTester(tester) {
9806
+ subsetEqualityTesters.add(tester);
9807
+ return tester;
9808
+ }
9809
+ function isSubsetEqualityTester(tester) {
9810
+ return tester === subsetEquality || subsetEqualityTesters.has(tester);
9811
+ }
9793
9812
  function subsetEquality(object, subset, customTesters = []) {
9794
9813
  const filteredCustomTesters = customTesters.filter((t) => t !== subsetEquality);
9795
- const subsetEqualityWithContext = (seenReferences = /* @__PURE__ */ new WeakMap()) => (object, subset) => {
9814
+ const subsetEqualityWithContext = (seenReferences = /* @__PURE__ */ new WeakMap()) => registerSubsetEqualityTester((object, subset) => {
9796
9815
  if (!isObjectWithKeys(subset)) return;
9797
9816
  return Object.keys(subset).every((key) => {
9798
9817
  if (subset[key] != null && typeof subset[key] === "object") {
@@ -9803,7 +9822,7 @@ function subsetEquality(object, subset, customTesters = []) {
9803
9822
  seenReferences.delete(subset[key]);
9804
9823
  return result;
9805
9824
  });
9806
- };
9825
+ });
9807
9826
  return subsetEqualityWithContext()(object, subset);
9808
9827
  }
9809
9828
  function typeEquality(a, b) {
@@ -0,0 +1,2 @@
1
+ import { B as UsageTokenTotals, F as UsageActivityTotals, G as addTotals, H as addActivityCount, I as UsageAggregate, J as registerSessionUsage, K as emptyTotals, L as UsageBucket, M as COUNTED_EVENT_TYPES, N as SESSION_USAGE_PATH, P as SessionUsageReport, R as UsageRangeKey, U as addActivityTotals, V as UsageTotals, W as addTokenTotals, Y as resolveUsageSince, q as localDayKey, z as UsageSessionRow } from "./log-CUjKQbOR.mjs";
2
+ export { COUNTED_EVENT_TYPES, SESSION_USAGE_PATH, SessionUsageReport, UsageActivityTotals, UsageAggregate, UsageBucket, UsageRangeKey, UsageSessionRow, UsageTokenTotals, UsageTotals, addActivityCount, addActivityTotals, addTokenTotals, addTotals, emptyTotals, localDayKey, registerSessionUsage, resolveUsageSince };
package/dist/usage.mjs ADDED
@@ -0,0 +1,152 @@
1
+ //#region src/usage.ts
2
+ const SESSION_USAGE_PATH = "/api/session.usage";
3
+ const ROLLING_DAYS = {
4
+ "7d": 7,
5
+ "30d": 30,
6
+ "90d": 90
7
+ };
8
+ function localDayStart(now) {
9
+ const start = new Date(now);
10
+ start.setHours(0, 0, 0, 0);
11
+ return start;
12
+ }
13
+ /**
14
+ * 范围起点(含),不限时为 undefined。**所有起点都对齐到 host 本地时区的零点**——`day` / `week` 是
15
+ * 今天 / 本周一的零点,`7d` / `30d` / `90d` 是「今天零点往前 N-1 天」(含今天共 N 个自然日)。
16
+ * 对齐的意义:事件级表按毫秒过滤、会话汇总表按本地日过滤,两者因此严格等价。
17
+ * @param range - 语义键。
18
+ * @param now - 当前时刻。
19
+ * @returns 起点毫秒时间戳,或 undefined。
20
+ */
21
+ function resolveUsageSince(range, now) {
22
+ switch (range) {
23
+ case "all": return;
24
+ case "day": return localDayStart(now).getTime();
25
+ case "week": {
26
+ const start = localDayStart(now);
27
+ start.setDate(start.getDate() - (start.getDay() + 6) % 7);
28
+ return start.getTime();
29
+ }
30
+ default: {
31
+ const start = localDayStart(now);
32
+ start.setDate(start.getDate() - (ROLLING_DAYS[range] - 1));
33
+ return start.getTime();
34
+ }
35
+ }
36
+ }
37
+ function parseUsageRange(value) {
38
+ return value === "day" || value === "week" || value === "7d" || value === "30d" || value === "90d" ? value : "all";
39
+ }
40
+ /** 计入活动计数的事件类型(轮次 / 步骤 / 用户输入 / 工具调用)。 */
41
+ const COUNTED_EVENT_TYPES = [
42
+ "turn/start",
43
+ "step/start",
44
+ "user/message",
45
+ "tool/call"
46
+ ];
47
+ /** 按事件类型把计数累加到活动指标上(表里按类型存,读的时候折成四项)。 */
48
+ function addActivityCount(target, type, count) {
49
+ switch (type) {
50
+ case "turn/start":
51
+ target.turns += count;
52
+ return target;
53
+ case "step/start":
54
+ target.steps += count;
55
+ return target;
56
+ case "user/message":
57
+ target.userInputs += count;
58
+ return target;
59
+ case "tool/call":
60
+ target.toolCalls += count;
61
+ return target;
62
+ default: return target;
63
+ }
64
+ }
65
+ /** 毫秒时间戳 → host 本地日(`YYYY-MM-DD`,与 SQL 的 localtime 口径一致)。 */
66
+ function localDayKey(ms) {
67
+ const date = new Date(ms);
68
+ const pad = (value) => String(value).padStart(2, "0");
69
+ return `${String(date.getFullYear())}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
70
+ }
71
+ function emptyTotals() {
72
+ return {
73
+ turns: 0,
74
+ steps: 0,
75
+ userInputs: 0,
76
+ toolCalls: 0,
77
+ inputTokens: 0,
78
+ outputTokens: 0,
79
+ cacheReadTokens: 0,
80
+ reasoningTokens: 0,
81
+ totalTokens: 0
82
+ };
83
+ }
84
+ function addTokenTotals(target, row) {
85
+ target.inputTokens += row.inputTokens;
86
+ target.outputTokens += row.outputTokens;
87
+ target.cacheReadTokens += row.cacheReadTokens;
88
+ target.reasoningTokens += row.reasoningTokens;
89
+ target.totalTokens += row.totalTokens;
90
+ return target;
91
+ }
92
+ function addActivityTotals(target, row) {
93
+ target.turns += row.turns;
94
+ target.steps += row.steps;
95
+ target.userInputs += row.userInputs;
96
+ target.toolCalls += row.toolCalls;
97
+ return target;
98
+ }
99
+ /** 把一行的整套指标累加进目标(后端合并「是否子代理」两组时用)。 */
100
+ function addTotals(target, row) {
101
+ addActivityTotals(target, row);
102
+ addTokenTotals(target, row);
103
+ return target;
104
+ }
105
+ /**
106
+ * 用量统计通道:一次请求回报总览(含 subagent 拆分)、按天 × 模型的桶与按会话的行。
107
+ * 聚合只算被会话引用的事件行——fork 共享行因此只计一次,已删会话留下的孤儿行不计。
108
+ */
109
+ function registerSessionUsage(ctx, persistence) {
110
+ ctx.inject(["webServer", "connection"], (webCtx) => {
111
+ const webServer = webCtx.webServer;
112
+ const connection = webCtx.get("connection");
113
+ return webCtx.effect(() => webServer.register({
114
+ kind: "exact",
115
+ path: SESSION_USAGE_PATH,
116
+ handler: async (req, res) => {
117
+ const rejection = connection.requestRejection(req);
118
+ if (rejection !== void 0) {
119
+ res.writeHead(rejection);
120
+ res.end(rejection === 401 ? "unauthorized" : "forbidden");
121
+ return;
122
+ }
123
+ if (req.method !== "POST") {
124
+ res.writeHead(405, { "content-type": "application/json" });
125
+ res.end(JSON.stringify({ error: "method not allowed" }));
126
+ return;
127
+ }
128
+ const chunks = [];
129
+ for await (const chunk of req) chunks.push(chunk);
130
+ const raw = Buffer.concat(chunks).toString("utf8");
131
+ let envelope = {};
132
+ if (raw !== "") try {
133
+ envelope = JSON.parse(raw);
134
+ } catch {
135
+ res.writeHead(400, { "content-type": "application/json" });
136
+ res.end(JSON.stringify({ error: "request body is not JSON" }));
137
+ return;
138
+ }
139
+ try {
140
+ const report = await persistence.usageReport(resolveUsageSince(parseUsageRange(envelope.range), Date.now()));
141
+ res.writeHead(200, { "content-type": "application/json" });
142
+ res.end(JSON.stringify(report));
143
+ } catch (error) {
144
+ res.writeHead(500, { "content-type": "application/json" });
145
+ res.end(JSON.stringify({ error: error instanceof Error ? error.message : "usage report failed" }));
146
+ }
147
+ }
148
+ }), `session-rdb: ${SESSION_USAGE_PATH} route`);
149
+ });
150
+ }
151
+ //#endregion
152
+ export { COUNTED_EVENT_TYPES, SESSION_USAGE_PATH, addActivityCount, addActivityTotals, addTokenTotals, addTotals, emptyTotals, localDayKey, registerSessionUsage, resolveUsageSince };
@@ -0,0 +1,48 @@
1
+ -- 统计衍生表:纯派生数据(打开库时按事件表全量回填),迁移直接先删后建,
2
+ -- 不做 ALTER / 数据搬迁。结构与取舍见 ADR-统计衍生表物化归属与汇总。
3
+ DROP TABLE IF EXISTS "t_event_usage";--> statement-breakpoint
4
+ DROP TABLE IF EXISTS "t_event_counts";--> statement-breakpoint
5
+ DROP TABLE IF EXISTS "t_session_usage";--> statement-breakpoint
6
+ DROP TABLE IF EXISTS "t_session_counts";--> statement-breakpoint
7
+ CREATE TABLE "t_event_usage" (
8
+ "f_event_id" text PRIMARY KEY NOT NULL,
9
+ "f_created_at" bigint NOT NULL,
10
+ "f_day" text NOT NULL,
11
+ "f_provider" text,
12
+ "f_model" text,
13
+ "f_referenced" integer DEFAULT 0 NOT NULL,
14
+ "f_subagent" integer DEFAULT 0 NOT NULL,
15
+ "f_input_tokens" integer DEFAULT 0 NOT NULL,
16
+ "f_output_tokens" integer DEFAULT 0 NOT NULL,
17
+ "f_cache_read_tokens" integer DEFAULT 0 NOT NULL,
18
+ "f_reasoning_tokens" integer DEFAULT 0 NOT NULL,
19
+ "f_total_tokens" integer DEFAULT 0 NOT NULL,
20
+ CONSTRAINT "fk_t_event_usage_f_event_id_t_events_f_event_id_fk" FOREIGN KEY ("f_event_id") REFERENCES "t_events"("f_event_id") ON DELETE CASCADE
21
+ );
22
+ --> statement-breakpoint
23
+ CREATE INDEX "idx_event_usage_created_at" ON "t_event_usage" USING btree ("f_created_at");--> statement-breakpoint
24
+ CREATE TABLE "t_session_usage" (
25
+ "f_session_id" text NOT NULL,
26
+ "f_day" text NOT NULL,
27
+ "f_provider" text DEFAULT '' NOT NULL,
28
+ "f_model" text DEFAULT '' NOT NULL,
29
+ "f_input_tokens" integer DEFAULT 0 NOT NULL,
30
+ "f_output_tokens" integer DEFAULT 0 NOT NULL,
31
+ "f_cache_read_tokens" integer DEFAULT 0 NOT NULL,
32
+ "f_reasoning_tokens" integer DEFAULT 0 NOT NULL,
33
+ "f_total_tokens" integer DEFAULT 0 NOT NULL,
34
+ CONSTRAINT "fk_t_session_usage_f_session_id_t_sessions_f_session_id_fk" FOREIGN KEY ("f_session_id") REFERENCES "t_sessions"("f_session_id") ON DELETE CASCADE
35
+ );
36
+ --> statement-breakpoint
37
+ CREATE UNIQUE INDEX "uq_session_usage_key" ON "t_session_usage" ("f_session_id","f_day","f_provider","f_model");--> statement-breakpoint
38
+ CREATE TABLE "t_session_counts" (
39
+ "f_session_id" text NOT NULL,
40
+ "f_day" text NOT NULL,
41
+ "f_turns" integer DEFAULT 0 NOT NULL,
42
+ "f_steps" integer DEFAULT 0 NOT NULL,
43
+ "f_user_inputs" integer DEFAULT 0 NOT NULL,
44
+ "f_tool_calls" integer DEFAULT 0 NOT NULL,
45
+ CONSTRAINT "fk_t_session_counts_f_session_id_t_sessions_f_session_id_fk" FOREIGN KEY ("f_session_id") REFERENCES "t_sessions"("f_session_id") ON DELETE CASCADE
46
+ );
47
+ --> statement-breakpoint
48
+ CREATE UNIQUE INDEX "uq_session_counts_key" ON "t_session_counts" ("f_session_id","f_day");
@@ -0,0 +1,48 @@
1
+ -- 统计衍生表:纯派生数据(打开库时按事件表全量回填),迁移直接先删后建,
2
+ -- 不做 ALTER / 数据搬迁。结构与取舍见 ADR-统计衍生表物化归属与汇总。
3
+ DROP TABLE IF EXISTS `t_event_usage`;--> statement-breakpoint
4
+ DROP TABLE IF EXISTS `t_event_counts`;--> statement-breakpoint
5
+ DROP TABLE IF EXISTS `t_session_usage`;--> statement-breakpoint
6
+ DROP TABLE IF EXISTS `t_session_counts`;--> statement-breakpoint
7
+ CREATE TABLE `t_event_usage` (
8
+ `f_event_id` text PRIMARY KEY NOT NULL,
9
+ `f_created_at` bigint NOT NULL,
10
+ `f_day` text NOT NULL,
11
+ `f_provider` text,
12
+ `f_model` text,
13
+ `f_referenced` integer DEFAULT 0 NOT NULL,
14
+ `f_subagent` integer DEFAULT 0 NOT NULL,
15
+ `f_input_tokens` integer DEFAULT 0 NOT NULL,
16
+ `f_output_tokens` integer DEFAULT 0 NOT NULL,
17
+ `f_cache_read_tokens` integer DEFAULT 0 NOT NULL,
18
+ `f_reasoning_tokens` integer DEFAULT 0 NOT NULL,
19
+ `f_total_tokens` integer DEFAULT 0 NOT NULL,
20
+ CONSTRAINT `fk_t_event_usage_f_event_id_t_events_f_event_id_fk` FOREIGN KEY (`f_event_id`) REFERENCES `t_events`(`f_event_id`) ON DELETE CASCADE
21
+ );
22
+ --> statement-breakpoint
23
+ CREATE INDEX `idx_event_usage_created_at` ON `t_event_usage` (`f_created_at`);--> statement-breakpoint
24
+ CREATE TABLE `t_session_usage` (
25
+ `f_session_id` text NOT NULL,
26
+ `f_day` text NOT NULL,
27
+ `f_provider` text DEFAULT '' NOT NULL,
28
+ `f_model` text DEFAULT '' NOT NULL,
29
+ `f_input_tokens` integer DEFAULT 0 NOT NULL,
30
+ `f_output_tokens` integer DEFAULT 0 NOT NULL,
31
+ `f_cache_read_tokens` integer DEFAULT 0 NOT NULL,
32
+ `f_reasoning_tokens` integer DEFAULT 0 NOT NULL,
33
+ `f_total_tokens` integer DEFAULT 0 NOT NULL,
34
+ CONSTRAINT `fk_t_session_usage_f_session_id_t_sessions_f_session_id_fk` FOREIGN KEY (`f_session_id`) REFERENCES `t_sessions`(`f_session_id`) ON DELETE CASCADE
35
+ );
36
+ --> statement-breakpoint
37
+ CREATE UNIQUE INDEX `uq_session_usage_key` ON `t_session_usage` (`f_session_id`,`f_day`,`f_provider`,`f_model`);--> statement-breakpoint
38
+ CREATE TABLE `t_session_counts` (
39
+ `f_session_id` text NOT NULL,
40
+ `f_day` text NOT NULL,
41
+ `f_turns` integer DEFAULT 0 NOT NULL,
42
+ `f_steps` integer DEFAULT 0 NOT NULL,
43
+ `f_user_inputs` integer DEFAULT 0 NOT NULL,
44
+ `f_tool_calls` integer DEFAULT 0 NOT NULL,
45
+ CONSTRAINT `fk_t_session_counts_f_session_id_t_sessions_f_session_id_fk` FOREIGN KEY (`f_session_id`) REFERENCES `t_sessions`(`f_session_id`) ON DELETE CASCADE
46
+ );
47
+ --> statement-breakpoint
48
+ CREATE UNIQUE INDEX `uq_session_counts_key` ON `t_session_counts` (`f_session_id`,`f_day`);
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@morlay/session-rdb",
3
- "version": "0.0.21-alpha.7",
3
+ "version": "0.0.21-alpha.9",
4
4
  "description": "RDB durable session backend for DeepSeek Harness: implements both session-persistence and session-branch (rewind / retry / fork) providers.",
5
5
  "keywords": [
6
6
  "branch",
7
7
  "dsh",
8
8
  "dsh-plugin",
9
- "dsh-session-rdb",
10
9
  "rdb",
11
10
  "rewind",
11
+ "session-persistence",
12
12
  "session-rdb"
13
13
  ],
14
14
  "license": "MIT",
@@ -21,7 +21,6 @@
21
21
  "dist",
22
22
  "src",
23
23
  "drizzle",
24
- "cordis.patch.yml",
25
24
  "!**/__tests__"
26
25
  ],
27
26
  "type": "module",
@@ -32,49 +31,45 @@
32
31
  "./export": "./dist/export.mjs",
33
32
  "./gc": "./dist/gc.mjs",
34
33
  "./import": "./dist/import.mjs",
35
- "./invariant": "./dist/invariant.mjs",
36
34
  "./storage": "./dist/storage.mjs",
37
35
  "./testing": "./dist/testing.mjs",
38
36
  "./usage": "./dist/usage.mjs",
37
+ "./invariant": "./dist/invariant.mjs",
39
38
  "./package.json": "./package.json",
40
- "./cordis.patch.yml": "./cordis.patch.yml",
41
39
  "./locale/*.json": "./locale/*.json"
42
40
  },
43
41
  "dependencies": {
44
- "@morlay/session-branch": "0.0.10-alpha.7",
42
+ "@morlay/session-branch": "0.0.10-alpha.9",
45
43
  "drizzle-orm": "^1.0.0-rc.5-ab785fc",
46
44
  "fflate": "^0.8.2",
47
45
  "pg": "^8.23.0"
48
46
  },
49
47
  "devDependencies": {
50
- "@deepseek-ai/dsh-compaction": "0.1.7-alpha.2",
51
- "@deepseek-ai/dsh-session-projection": "0.1.7-alpha.2",
52
- "@deepseek-ai/dsh-session-projection-cache": "0.1.7-alpha.2",
53
- "@deepseek-ai/dsh-session-turn-outline": "0.1.7-alpha.2",
54
- "@deepseek-ai/dsh-storage": "0.1.7-alpha.2",
55
- "@deepseek-ai/dsh-storage-domain": "0.1.7-alpha.2",
56
- "@deepseek-ai/dsh-token-meter": "0.1.7-alpha.2",
57
- "@deepseek-ai/dsh-workspace": "0.1.7-alpha.2",
48
+ "@deepseek-ai/cosmokit": "1.8.5",
49
+ "@deepseek-ai/dsh-compaction": "0.1.7-rc.2",
50
+ "@deepseek-ai/dsh-session-projection": "0.1.7-rc.2",
51
+ "@deepseek-ai/dsh-session-projection-cache": "0.1.7-rc.2",
52
+ "@deepseek-ai/dsh-session-turn-outline": "0.1.7-rc.2",
53
+ "@deepseek-ai/dsh-storage": "0.1.7-rc.2",
54
+ "@deepseek-ai/dsh-storage-domain": "0.1.7-rc.2",
55
+ "@deepseek-ai/dsh-token-meter": "0.1.7-rc.2",
56
+ "@deepseek-ai/dsh-workspace": "0.1.7-rc.2",
58
57
  "@types/pg": "^8.23.1",
59
58
  "drizzle-kit": "1.0.0-rc.5-ab785fc"
60
59
  },
61
60
  "peerDependencies": {
62
- "@deepseek-ai/cordis": "4.0.4",
63
- "@deepseek-ai/dsh-invariants": "0.1.7-alpha.2",
64
- "@deepseek-ai/dsh-llm": "0.1.7-alpha.2",
65
- "@deepseek-ai/dsh-scope": "0.1.7-alpha.2",
66
- "@deepseek-ai/dsh-session": "0.1.7-alpha.2",
67
- "@deepseek-ai/dsh-session-format": "0.1.7-alpha.2",
68
- "@deepseek-ai/dsh-session-format-catalog": "0.1.7-alpha.2",
69
- "@deepseek-ai/dsh-session-persistence": "0.1.7-alpha.2",
70
- "@deepseek-ai/dsh-session-query": "0.1.7-alpha.2",
71
- "@deepseek-ai/dsh-storage": "0.1.7-alpha.2",
72
- "@deepseek-ai/schemastery": "3.18.4"
73
- },
74
- "dsh": {
75
- "bundle": {
76
- "patch": "./cordis.patch.yml"
77
- }
61
+ "@deepseek-ai/cordis": "^4.0.4",
62
+ "@deepseek-ai/cosmokit": "^1.8.5",
63
+ "@deepseek-ai/dsh-invariants": "^0.1.7-rc.2",
64
+ "@deepseek-ai/dsh-llm": "^0.1.7-rc.2",
65
+ "@deepseek-ai/dsh-scope": "^0.1.7-rc.2",
66
+ "@deepseek-ai/dsh-session": "^0.1.7-rc.2",
67
+ "@deepseek-ai/dsh-session-format": "^0.1.7-rc.2",
68
+ "@deepseek-ai/dsh-session-format-catalog": "^0.1.7-rc.2",
69
+ "@deepseek-ai/dsh-session-persistence": "^0.1.7-rc.2",
70
+ "@deepseek-ai/dsh-session-query": "^0.1.7-rc.2",
71
+ "@deepseek-ai/dsh-storage": "^0.1.7-rc.2",
72
+ "@deepseek-ai/schemastery": "^3.18.4"
78
73
  },
79
74
  "inlinedDependencies": {
80
75
  "@jridgewell/sourcemap-codec": "1.6.0",