@morlay/session-rdb 0.0.16 → 0.0.17
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/README.md +44 -10
- package/dist/artifact.d.mts +9 -2
- package/dist/artifact.mjs +3 -3
- package/dist/{import-BPEHfHNk.mjs → import-DZIAjOUr.mjs} +2 -1
- package/dist/import.d.mts +1 -1
- package/dist/import.mjs +1 -1
- package/dist/{index-CgAqCQAb.d.mts → index-BEKoV1Uy.d.mts} +11 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +509 -6
- package/dist/{log-BIuXv09P.mjs → log-DO69NQnn.mjs} +16 -1
- package/dist/schema-Bo6Hy5gW.d.mts +3476 -0
- package/dist/{sqlite-IH5I48aL.mjs → sqlite-BIPdMNQb.mjs} +504 -6
- package/dist/storage.d.mts +10 -2
- package/dist/storage.mjs +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.mjs +1 -1
- package/drizzle/postgres/20260910120001_v3_storage_tables/migration.sql +65 -0
- package/drizzle/postgres/20260910120001_v3_storage_tables/snapshot.json +1236 -0
- package/drizzle/postgres/20260910130001_v3_session_title_backfill/migration.sql +10 -0
- package/drizzle/postgres/20260910130001_v3_session_title_backfill/snapshot.json +1236 -0
- package/drizzle/sqlite/20260910120000_v3_storage_tables/migration.sql +66 -0
- package/drizzle/sqlite/20260910120000_v3_storage_tables/snapshot.json +958 -0
- package/drizzle/sqlite/20260910130000_v3_session_title_backfill/migration.sql +13 -0
- package/drizzle/sqlite/20260910130000_v3_session_title_backfill/snapshot.json +958 -0
- package/package.json +6 -4
- package/src/backend.ts +7 -0
- package/src/branch.ts +2 -0
- package/src/drizzle/postgres-v3.ts +5 -0
- package/src/drizzle/sqlite-v3.ts +5 -0
- package/src/entities/v3/index.ts +20 -0
- package/src/entities/v3/session-projcache-rows.ts +27 -0
- package/src/entities/v3/sessions.ts +6 -0
- package/src/entities/v3/storage-units.ts +10 -0
- package/src/entities/v3/workspace-sessions.ts +24 -0
- package/src/entities/v3/workspace-state.ts +18 -0
- package/src/entities/v3/workspaces.ts +19 -0
- package/src/import-storages.ts +173 -0
- package/src/index.ts +53 -0
- package/src/log.ts +19 -0
- package/src/postgres.ts +70 -2
- package/src/schema.ts +16 -2
- package/src/sqlite.ts +87 -4
- package/src/storage-takeover/index.ts +60 -0
- package/src/storage-takeover/projection-cache.ts +445 -0
- package/src/storage-takeover/repository.ts +420 -0
- package/src/storage-takeover/storage-backend.ts +177 -0
- package/src/storage-takeover/types.ts +82 -0
- package/dist/schema-COK7-wRV.d.mts +0 -104
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { SessionStorageMetadata } from "@deepseek-ai/dsh-session-persistence";
|
|
2
|
-
import { SessionEvent, SessionId } from "@deepseek-ai/dsh-session";
|
|
3
|
-
//#region src/backend.d.ts
|
|
4
|
-
interface SessionRow {
|
|
5
|
-
fSessionId: string;
|
|
6
|
-
fHeadEventId: string;
|
|
7
|
-
fHeadSequence: number;
|
|
8
|
-
fVersion: number;
|
|
9
|
-
fCreatedAt: number;
|
|
10
|
-
fCwd: string | null;
|
|
11
|
-
fParentSession: string | null;
|
|
12
|
-
fSeedLength: number | null;
|
|
13
|
-
fOrigin: string | null;
|
|
14
|
-
fDelegationDepth: number | null;
|
|
15
|
-
fIncarnation: string;
|
|
16
|
-
fRevision: number;
|
|
17
|
-
}
|
|
18
|
-
interface EventInsert {
|
|
19
|
-
fEventId: string;
|
|
20
|
-
fParentId: string;
|
|
21
|
-
fType: string;
|
|
22
|
-
fKind: string;
|
|
23
|
-
fRole: string;
|
|
24
|
-
fName: string;
|
|
25
|
-
fActionId: string;
|
|
26
|
-
fEncoding: string;
|
|
27
|
-
fData: string;
|
|
28
|
-
fCreatedAt: number;
|
|
29
|
-
}
|
|
30
|
-
interface EventRow {
|
|
31
|
-
fEventId: string;
|
|
32
|
-
fSequence: number;
|
|
33
|
-
fType: string;
|
|
34
|
-
fKind: string;
|
|
35
|
-
fRole: string;
|
|
36
|
-
fName: string;
|
|
37
|
-
fActionId: string;
|
|
38
|
-
fCreatedAt: number;
|
|
39
|
-
fData: string;
|
|
40
|
-
fSurfaceOp: string | null;
|
|
41
|
-
}
|
|
42
|
-
interface BackendTx {
|
|
43
|
-
upsertSession(storage: SessionStorageMetadata, incarnation: string): Promise<void>;
|
|
44
|
-
getHead(id: SessionId): Promise<Pick<SessionRow, "fHeadEventId" | "fHeadSequence">>;
|
|
45
|
-
getSeedLength(id: SessionId): Promise<number | null>;
|
|
46
|
-
updateSeedLength(id: SessionId, seedLength: number): Promise<void>;
|
|
47
|
-
insertEvents(events: EventInsert[]): Promise<void>;
|
|
48
|
-
insertBridges(rows: Array<{
|
|
49
|
-
fSessionId: SessionId;
|
|
50
|
-
fEventId: string;
|
|
51
|
-
fSequence: number;
|
|
52
|
-
fSurfaceOp: string | null;
|
|
53
|
-
}>): Promise<void>;
|
|
54
|
-
updateHead(id: SessionId, headEventId: string, headSequence: number): Promise<void>;
|
|
55
|
-
bumpRevision(id: SessionId): Promise<void>;
|
|
56
|
-
deleteBridgeTail(id: SessionId, fromSequence: number): Promise<void>;
|
|
57
|
-
getPrevBridge(id: SessionId, sequence: number): Promise<{
|
|
58
|
-
fEventId: string;
|
|
59
|
-
fSequence: number;
|
|
60
|
-
} | undefined>;
|
|
61
|
-
}
|
|
62
|
-
interface Backend {
|
|
63
|
-
readonly kind: "sqlite" | "postgres";
|
|
64
|
-
readonly storeIdentity: string;
|
|
65
|
-
open(): Promise<void>;
|
|
66
|
-
getSession(id: SessionId): Promise<SessionRow | undefined>;
|
|
67
|
-
getEventRows(id: SessionId, fromSequence?: number): Promise<EventRow[]>;
|
|
68
|
-
listSessions(): Promise<SessionRow[]>;
|
|
69
|
-
transaction<T>(fn: (tx: BackendTx) => Promise<T>): Promise<T>;
|
|
70
|
-
close(): Promise<void>;
|
|
71
|
-
}
|
|
72
|
-
//#endregion
|
|
73
|
-
//#region src/write-guard.d.ts
|
|
74
|
-
declare class WriteGuard {
|
|
75
|
-
private readonly headSeqs;
|
|
76
|
-
confirmHead(id: SessionId, head: number): void;
|
|
77
|
-
assertNoConcurrentWriter(id: SessionId, storedHead: number): void;
|
|
78
|
-
}
|
|
79
|
-
//#endregion
|
|
80
|
-
//#region src/schema.d.ts
|
|
81
|
-
declare const SCHEMA_VERSION = 3;
|
|
82
|
-
declare const SESSION_PERSISTENCE_SQLITE_APPLICATION_ID = 1146308688;
|
|
83
|
-
declare const EVENT_ENCODING = "json";
|
|
84
|
-
declare const tPersistenceState: any;
|
|
85
|
-
declare const tSchemaMeta: any;
|
|
86
|
-
declare const tSessions: any;
|
|
87
|
-
declare const tEvents: any;
|
|
88
|
-
declare const tSessionEvents: any;
|
|
89
|
-
type JournalMode = "wal" | "delete" | "truncate" | "persist";
|
|
90
|
-
declare const DEFAULT_BUSY_TIMEOUT_MS = 5000;
|
|
91
|
-
type EventKind = "message" | "thinking" | "turn" | "tool" | "request" | "config" | "audit" | "lifecycle" | "inbox" | "compaction" | "llm" | "subagent" | "team" | "workflow" | "goal" | "schedule" | "todo" | "web";
|
|
92
|
-
type EventRole = "user" | "assistant" | "tool";
|
|
93
|
-
declare function eventKind(event: {
|
|
94
|
-
type: string;
|
|
95
|
-
data?: unknown;
|
|
96
|
-
}): EventKind | "";
|
|
97
|
-
declare function eventDimensions(event: SessionEvent): {
|
|
98
|
-
kind: string;
|
|
99
|
-
role: string;
|
|
100
|
-
name: string;
|
|
101
|
-
actionId: string;
|
|
102
|
-
};
|
|
103
|
-
//#endregion
|
|
104
|
-
export { BackendTx as _, JournalMode as a, eventDimensions as c, tPersistenceState as d, tSchemaMeta as f, Backend as g, WriteGuard as h, EventRole as i, eventKind as l, tSessions as m, EVENT_ENCODING as n, SCHEMA_VERSION as o, tSessionEvents as p, EventKind as r, SESSION_PERSISTENCE_SQLITE_APPLICATION_ID as s, DEFAULT_BUSY_TIMEOUT_MS as t, tEvents as u, EventRow as v, SessionRow as y };
|