chat-logbook 0.4.0 → 0.4.1

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.
@@ -0,0 +1,18 @@
1
+ PRAGMA foreign_keys=OFF;
2
+ --> statement-breakpoint
3
+ CREATE TABLE `__new_sessions_meta` (
4
+ `id` text PRIMARY KEY NOT NULL,
5
+ `is_deleted` integer DEFAULT false NOT NULL,
6
+ `custom_title` text,
7
+ `created_at` integer NOT NULL,
8
+ `updated_at` integer NOT NULL
9
+ );
10
+ --> statement-breakpoint
11
+ INSERT INTO `__new_sessions_meta`("id", "is_deleted", "created_at", "updated_at")
12
+ SELECT `session_id`, `is_deleted`, `created_at`, `updated_at` FROM `sessions_meta`;
13
+ --> statement-breakpoint
14
+ DROP TABLE `sessions_meta`;
15
+ --> statement-breakpoint
16
+ ALTER TABLE `__new_sessions_meta` RENAME TO `sessions_meta`;
17
+ --> statement-breakpoint
18
+ PRAGMA foreign_keys=ON;
@@ -0,0 +1,5 @@
1
+ CREATE TABLE `archive_meta` (
2
+ `id` integer PRIMARY KEY NOT NULL,
3
+ `archive_uuid` text NOT NULL,
4
+ `created_at` integer NOT NULL
5
+ );
@@ -0,0 +1,4 @@
1
+ CREATE TABLE `schema_version` (
2
+ `version` integer PRIMARY KEY NOT NULL,
3
+ `applied_at` integer NOT NULL
4
+ );
@@ -0,0 +1,46 @@
1
+ CREATE TABLE `ingestion_events` (
2
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
3
+ `agent` text NOT NULL,
4
+ `session_id` text NOT NULL,
5
+ `source_path` text NOT NULL,
6
+ `event_type` text NOT NULL,
7
+ `detail` text NOT NULL,
8
+ `observed_at` integer NOT NULL
9
+ );
10
+ --> statement-breakpoint
11
+ CREATE TABLE `messages` (
12
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
13
+ `agent` text NOT NULL,
14
+ `session_id` text NOT NULL,
15
+ `message_id` text NOT NULL,
16
+ `role` text NOT NULL,
17
+ `ts` integer NOT NULL,
18
+ `text` text NOT NULL,
19
+ `blocks` text NOT NULL,
20
+ `raw_id` integer NOT NULL,
21
+ FOREIGN KEY (`raw_id`) REFERENCES `raw_messages`(`id`) ON UPDATE no action ON DELETE no action
22
+ );
23
+ --> statement-breakpoint
24
+ CREATE UNIQUE INDEX `messages_canonical_idx` ON `messages` (`agent`,`session_id`,`message_id`);--> statement-breakpoint
25
+ CREATE TABLE `raw_messages` (
26
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
27
+ `agent` text NOT NULL,
28
+ `session_id` text NOT NULL,
29
+ `source_path` text NOT NULL,
30
+ `source_locator` text NOT NULL,
31
+ `raw_payload` text NOT NULL,
32
+ `payload_hash` text NOT NULL,
33
+ `ingested_at` integer NOT NULL
34
+ );
35
+ --> statement-breakpoint
36
+ CREATE UNIQUE INDEX `raw_messages_idem_idx` ON `raw_messages` (`agent`,`session_id`,`payload_hash`);--> statement-breakpoint
37
+ CREATE TABLE `sessions` (
38
+ `id` text PRIMARY KEY NOT NULL,
39
+ `short_code` text NOT NULL,
40
+ `agent` text NOT NULL,
41
+ `source_session_id` text NOT NULL,
42
+ `first_seen_at` integer NOT NULL
43
+ );
44
+ --> statement-breakpoint
45
+ CREATE UNIQUE INDEX `sessions_short_code_unique` ON `sessions` (`short_code`);--> statement-breakpoint
46
+ CREATE UNIQUE INDEX `sessions_agent_source_idx` ON `sessions` (`agent`,`source_session_id`);
@@ -0,0 +1,11 @@
1
+ CREATE TABLE `session_scan_state` (
2
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
3
+ `agent` text NOT NULL,
4
+ `session_id` text NOT NULL,
5
+ `source_path` text NOT NULL,
6
+ `last_mtime_ms` integer NOT NULL,
7
+ `last_size_bytes` integer NOT NULL,
8
+ `last_scanned_at` integer NOT NULL
9
+ );
10
+ --> statement-breakpoint
11
+ CREATE UNIQUE INDEX `session_scan_state_idx` ON `session_scan_state` (`agent`,`session_id`);
@@ -0,0 +1 @@
1
+ ALTER TABLE `sessions` ADD `project` text;
@@ -0,0 +1,49 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "d3a95e23-e94b-48eb-b47f-93125fb0c649",
5
+ "prevId": "00000000-0000-0000-0000-000000000000",
6
+ "tables": {
7
+ "archive_meta": {
8
+ "name": "archive_meta",
9
+ "columns": {
10
+ "id": {
11
+ "name": "id",
12
+ "type": "integer",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "archive_uuid": {
18
+ "name": "archive_uuid",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true,
22
+ "autoincrement": false
23
+ },
24
+ "created_at": {
25
+ "name": "created_at",
26
+ "type": "integer",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ }
31
+ },
32
+ "indexes": {},
33
+ "foreignKeys": {},
34
+ "compositePrimaryKeys": {},
35
+ "uniqueConstraints": {},
36
+ "checkConstraints": {}
37
+ }
38
+ },
39
+ "views": {},
40
+ "enums": {},
41
+ "_meta": {
42
+ "schemas": {},
43
+ "tables": {},
44
+ "columns": {}
45
+ },
46
+ "internal": {
47
+ "indexes": {}
48
+ }
49
+ }
@@ -0,0 +1,73 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "037731f6-9a27-4a72-b757-9ac3c4cedf65",
5
+ "prevId": "d3a95e23-e94b-48eb-b47f-93125fb0c649",
6
+ "tables": {
7
+ "archive_meta": {
8
+ "name": "archive_meta",
9
+ "columns": {
10
+ "id": {
11
+ "name": "id",
12
+ "type": "integer",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "archive_uuid": {
18
+ "name": "archive_uuid",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true,
22
+ "autoincrement": false
23
+ },
24
+ "created_at": {
25
+ "name": "created_at",
26
+ "type": "integer",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ }
31
+ },
32
+ "indexes": {},
33
+ "foreignKeys": {},
34
+ "compositePrimaryKeys": {},
35
+ "uniqueConstraints": {},
36
+ "checkConstraints": {}
37
+ },
38
+ "schema_version": {
39
+ "name": "schema_version",
40
+ "columns": {
41
+ "version": {
42
+ "name": "version",
43
+ "type": "integer",
44
+ "primaryKey": true,
45
+ "notNull": true,
46
+ "autoincrement": false
47
+ },
48
+ "applied_at": {
49
+ "name": "applied_at",
50
+ "type": "integer",
51
+ "primaryKey": false,
52
+ "notNull": true,
53
+ "autoincrement": false
54
+ }
55
+ },
56
+ "indexes": {},
57
+ "foreignKeys": {},
58
+ "compositePrimaryKeys": {},
59
+ "uniqueConstraints": {},
60
+ "checkConstraints": {}
61
+ }
62
+ },
63
+ "views": {},
64
+ "enums": {},
65
+ "_meta": {
66
+ "schemas": {},
67
+ "tables": {},
68
+ "columns": {}
69
+ },
70
+ "internal": {
71
+ "indexes": {}
72
+ }
73
+ }
@@ -0,0 +1,349 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "cc9ed3dd-09fe-4c34-aef4-b1c07daabe89",
5
+ "prevId": "037731f6-9a27-4a72-b757-9ac3c4cedf65",
6
+ "tables": {
7
+ "archive_meta": {
8
+ "name": "archive_meta",
9
+ "columns": {
10
+ "id": {
11
+ "name": "id",
12
+ "type": "integer",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "archive_uuid": {
18
+ "name": "archive_uuid",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true,
22
+ "autoincrement": false
23
+ },
24
+ "created_at": {
25
+ "name": "created_at",
26
+ "type": "integer",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ }
31
+ },
32
+ "indexes": {},
33
+ "foreignKeys": {},
34
+ "compositePrimaryKeys": {},
35
+ "uniqueConstraints": {},
36
+ "checkConstraints": {}
37
+ },
38
+ "ingestion_events": {
39
+ "name": "ingestion_events",
40
+ "columns": {
41
+ "id": {
42
+ "name": "id",
43
+ "type": "integer",
44
+ "primaryKey": true,
45
+ "notNull": true,
46
+ "autoincrement": true
47
+ },
48
+ "agent": {
49
+ "name": "agent",
50
+ "type": "text",
51
+ "primaryKey": false,
52
+ "notNull": true,
53
+ "autoincrement": false
54
+ },
55
+ "session_id": {
56
+ "name": "session_id",
57
+ "type": "text",
58
+ "primaryKey": false,
59
+ "notNull": true,
60
+ "autoincrement": false
61
+ },
62
+ "source_path": {
63
+ "name": "source_path",
64
+ "type": "text",
65
+ "primaryKey": false,
66
+ "notNull": true,
67
+ "autoincrement": false
68
+ },
69
+ "event_type": {
70
+ "name": "event_type",
71
+ "type": "text",
72
+ "primaryKey": false,
73
+ "notNull": true,
74
+ "autoincrement": false
75
+ },
76
+ "detail": {
77
+ "name": "detail",
78
+ "type": "text",
79
+ "primaryKey": false,
80
+ "notNull": true,
81
+ "autoincrement": false
82
+ },
83
+ "observed_at": {
84
+ "name": "observed_at",
85
+ "type": "integer",
86
+ "primaryKey": false,
87
+ "notNull": true,
88
+ "autoincrement": false
89
+ }
90
+ },
91
+ "indexes": {},
92
+ "foreignKeys": {},
93
+ "compositePrimaryKeys": {},
94
+ "uniqueConstraints": {},
95
+ "checkConstraints": {}
96
+ },
97
+ "messages": {
98
+ "name": "messages",
99
+ "columns": {
100
+ "id": {
101
+ "name": "id",
102
+ "type": "integer",
103
+ "primaryKey": true,
104
+ "notNull": true,
105
+ "autoincrement": true
106
+ },
107
+ "agent": {
108
+ "name": "agent",
109
+ "type": "text",
110
+ "primaryKey": false,
111
+ "notNull": true,
112
+ "autoincrement": false
113
+ },
114
+ "session_id": {
115
+ "name": "session_id",
116
+ "type": "text",
117
+ "primaryKey": false,
118
+ "notNull": true,
119
+ "autoincrement": false
120
+ },
121
+ "message_id": {
122
+ "name": "message_id",
123
+ "type": "text",
124
+ "primaryKey": false,
125
+ "notNull": true,
126
+ "autoincrement": false
127
+ },
128
+ "role": {
129
+ "name": "role",
130
+ "type": "text",
131
+ "primaryKey": false,
132
+ "notNull": true,
133
+ "autoincrement": false
134
+ },
135
+ "ts": {
136
+ "name": "ts",
137
+ "type": "integer",
138
+ "primaryKey": false,
139
+ "notNull": true,
140
+ "autoincrement": false
141
+ },
142
+ "text": {
143
+ "name": "text",
144
+ "type": "text",
145
+ "primaryKey": false,
146
+ "notNull": true,
147
+ "autoincrement": false
148
+ },
149
+ "blocks": {
150
+ "name": "blocks",
151
+ "type": "text",
152
+ "primaryKey": false,
153
+ "notNull": true,
154
+ "autoincrement": false
155
+ },
156
+ "raw_id": {
157
+ "name": "raw_id",
158
+ "type": "integer",
159
+ "primaryKey": false,
160
+ "notNull": true,
161
+ "autoincrement": false
162
+ }
163
+ },
164
+ "indexes": {
165
+ "messages_canonical_idx": {
166
+ "name": "messages_canonical_idx",
167
+ "columns": ["agent", "session_id", "message_id"],
168
+ "isUnique": true
169
+ }
170
+ },
171
+ "foreignKeys": {
172
+ "messages_raw_id_raw_messages_id_fk": {
173
+ "name": "messages_raw_id_raw_messages_id_fk",
174
+ "tableFrom": "messages",
175
+ "tableTo": "raw_messages",
176
+ "columnsFrom": ["raw_id"],
177
+ "columnsTo": ["id"],
178
+ "onDelete": "no action",
179
+ "onUpdate": "no action"
180
+ }
181
+ },
182
+ "compositePrimaryKeys": {},
183
+ "uniqueConstraints": {},
184
+ "checkConstraints": {}
185
+ },
186
+ "raw_messages": {
187
+ "name": "raw_messages",
188
+ "columns": {
189
+ "id": {
190
+ "name": "id",
191
+ "type": "integer",
192
+ "primaryKey": true,
193
+ "notNull": true,
194
+ "autoincrement": true
195
+ },
196
+ "agent": {
197
+ "name": "agent",
198
+ "type": "text",
199
+ "primaryKey": false,
200
+ "notNull": true,
201
+ "autoincrement": false
202
+ },
203
+ "session_id": {
204
+ "name": "session_id",
205
+ "type": "text",
206
+ "primaryKey": false,
207
+ "notNull": true,
208
+ "autoincrement": false
209
+ },
210
+ "source_path": {
211
+ "name": "source_path",
212
+ "type": "text",
213
+ "primaryKey": false,
214
+ "notNull": true,
215
+ "autoincrement": false
216
+ },
217
+ "source_locator": {
218
+ "name": "source_locator",
219
+ "type": "text",
220
+ "primaryKey": false,
221
+ "notNull": true,
222
+ "autoincrement": false
223
+ },
224
+ "raw_payload": {
225
+ "name": "raw_payload",
226
+ "type": "text",
227
+ "primaryKey": false,
228
+ "notNull": true,
229
+ "autoincrement": false
230
+ },
231
+ "payload_hash": {
232
+ "name": "payload_hash",
233
+ "type": "text",
234
+ "primaryKey": false,
235
+ "notNull": true,
236
+ "autoincrement": false
237
+ },
238
+ "ingested_at": {
239
+ "name": "ingested_at",
240
+ "type": "integer",
241
+ "primaryKey": false,
242
+ "notNull": true,
243
+ "autoincrement": false
244
+ }
245
+ },
246
+ "indexes": {
247
+ "raw_messages_idem_idx": {
248
+ "name": "raw_messages_idem_idx",
249
+ "columns": ["agent", "session_id", "payload_hash"],
250
+ "isUnique": true
251
+ }
252
+ },
253
+ "foreignKeys": {},
254
+ "compositePrimaryKeys": {},
255
+ "uniqueConstraints": {},
256
+ "checkConstraints": {}
257
+ },
258
+ "schema_version": {
259
+ "name": "schema_version",
260
+ "columns": {
261
+ "version": {
262
+ "name": "version",
263
+ "type": "integer",
264
+ "primaryKey": true,
265
+ "notNull": true,
266
+ "autoincrement": false
267
+ },
268
+ "applied_at": {
269
+ "name": "applied_at",
270
+ "type": "integer",
271
+ "primaryKey": false,
272
+ "notNull": true,
273
+ "autoincrement": false
274
+ }
275
+ },
276
+ "indexes": {},
277
+ "foreignKeys": {},
278
+ "compositePrimaryKeys": {},
279
+ "uniqueConstraints": {},
280
+ "checkConstraints": {}
281
+ },
282
+ "sessions": {
283
+ "name": "sessions",
284
+ "columns": {
285
+ "id": {
286
+ "name": "id",
287
+ "type": "text",
288
+ "primaryKey": true,
289
+ "notNull": true,
290
+ "autoincrement": false
291
+ },
292
+ "short_code": {
293
+ "name": "short_code",
294
+ "type": "text",
295
+ "primaryKey": false,
296
+ "notNull": true,
297
+ "autoincrement": false
298
+ },
299
+ "agent": {
300
+ "name": "agent",
301
+ "type": "text",
302
+ "primaryKey": false,
303
+ "notNull": true,
304
+ "autoincrement": false
305
+ },
306
+ "source_session_id": {
307
+ "name": "source_session_id",
308
+ "type": "text",
309
+ "primaryKey": false,
310
+ "notNull": true,
311
+ "autoincrement": false
312
+ },
313
+ "first_seen_at": {
314
+ "name": "first_seen_at",
315
+ "type": "integer",
316
+ "primaryKey": false,
317
+ "notNull": true,
318
+ "autoincrement": false
319
+ }
320
+ },
321
+ "indexes": {
322
+ "sessions_short_code_unique": {
323
+ "name": "sessions_short_code_unique",
324
+ "columns": ["short_code"],
325
+ "isUnique": true
326
+ },
327
+ "sessions_agent_source_idx": {
328
+ "name": "sessions_agent_source_idx",
329
+ "columns": ["agent", "source_session_id"],
330
+ "isUnique": true
331
+ }
332
+ },
333
+ "foreignKeys": {},
334
+ "compositePrimaryKeys": {},
335
+ "uniqueConstraints": {},
336
+ "checkConstraints": {}
337
+ }
338
+ },
339
+ "views": {},
340
+ "enums": {},
341
+ "_meta": {
342
+ "schemas": {},
343
+ "tables": {},
344
+ "columns": {}
345
+ },
346
+ "internal": {
347
+ "indexes": {}
348
+ }
349
+ }