@sentry/junior-memory 0.197.0 → 0.199.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/dist/index.d.ts CHANGED
@@ -1,7 +1,887 @@
1
- export { memoryPlugin } from "./plugin";
2
- export { memoryApiSchema, memoryDashboardResponseSchema, memoryListResponseSchema, type MemoryApi, type MemoryDashboardResponse, type MemoryListResponse, } from "./api";
3
- export type { MemoryPluginOptions } from "./plugin";
4
- export { createMemoryStore } from "./store";
5
- export type { ArchiveMemoryInput, CreateMemoryInput, CreateMemoryResult, ListMemoriesInput, MemoryDb, MemoryEmbeddingProvider, MemoryRecord, MemoryStore, MemoryStoreOptions, SearchMemoriesInput, } from "./store";
6
- export { MEMORY_KINDS } from "./types";
7
- export type { MemoryKind, MemoryRuntimeContext } from "./types";
1
+ import * as _sentry_junior_plugin_api from '@sentry/junior-plugin-api';
2
+ import { z } from 'zod';
3
+ import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
4
+ import { PgDatabase } from 'drizzle-orm/pg-core';
5
+ import { PgQueryResultHKT } from 'drizzle-orm/pg-core/session';
6
+
7
+ interface MemoryPluginOptions {
8
+ /** Disable automatic prompt recall while keeping explicit memory tools available. */
9
+ disableRecall?: boolean;
10
+ /** Disable passive memory extraction from completed sessions. */
11
+ disableExtraction?: boolean;
12
+ modelId?: string;
13
+ }
14
+ /** Register Junior's long-term memory plugin. */
15
+ declare function memoryPlugin(options?: MemoryPluginOptions): _sentry_junior_plugin_api.PluginRegistration;
16
+
17
+ declare const juniorMemoryMemories: drizzle_orm_pg_core.PgTableWithColumns<{
18
+ name: "junior_memory_memories";
19
+ schema: undefined;
20
+ columns: {
21
+ id: drizzle_orm_pg_core.PgColumn<{
22
+ name: "id";
23
+ tableName: "junior_memory_memories";
24
+ dataType: "string";
25
+ columnType: "PgText";
26
+ data: string;
27
+ driverParam: string;
28
+ notNull: true;
29
+ hasDefault: false;
30
+ isPrimaryKey: true;
31
+ isAutoincrement: false;
32
+ hasRuntimeDefault: false;
33
+ enumValues: [string, ...string[]];
34
+ baseColumn: never;
35
+ identity: undefined;
36
+ generated: undefined;
37
+ }, {}, {}>;
38
+ scope: drizzle_orm_pg_core.PgColumn<{
39
+ name: "scope";
40
+ tableName: "junior_memory_memories";
41
+ dataType: "string";
42
+ columnType: "PgText";
43
+ data: "private" | "public";
44
+ driverParam: string;
45
+ notNull: true;
46
+ hasDefault: false;
47
+ isPrimaryKey: false;
48
+ isAutoincrement: false;
49
+ hasRuntimeDefault: false;
50
+ enumValues: ["private", "public"];
51
+ baseColumn: never;
52
+ identity: undefined;
53
+ generated: undefined;
54
+ }, {}, {}>;
55
+ scopeKey: drizzle_orm_pg_core.PgColumn<{
56
+ name: "scope_key";
57
+ tableName: "junior_memory_memories";
58
+ dataType: "string";
59
+ columnType: "PgText";
60
+ data: string;
61
+ driverParam: string;
62
+ notNull: true;
63
+ hasDefault: false;
64
+ isPrimaryKey: false;
65
+ isAutoincrement: false;
66
+ hasRuntimeDefault: false;
67
+ enumValues: [string, ...string[]];
68
+ baseColumn: never;
69
+ identity: undefined;
70
+ generated: undefined;
71
+ }, {}, {}>;
72
+ kind: drizzle_orm_pg_core.PgColumn<{
73
+ name: "type";
74
+ tableName: "junior_memory_memories";
75
+ dataType: "string";
76
+ columnType: "PgText";
77
+ data: "preference" | "procedure" | "knowledge";
78
+ driverParam: string;
79
+ notNull: true;
80
+ hasDefault: false;
81
+ isPrimaryKey: false;
82
+ isAutoincrement: false;
83
+ hasRuntimeDefault: false;
84
+ enumValues: ["preference", "procedure", "knowledge"];
85
+ baseColumn: never;
86
+ identity: undefined;
87
+ generated: undefined;
88
+ }, {}, {}>;
89
+ subjectType: drizzle_orm_pg_core.PgColumn<{
90
+ name: "subject_type";
91
+ tableName: "junior_memory_memories";
92
+ dataType: "string";
93
+ columnType: "PgText";
94
+ data: "user" | "conversation" | "general";
95
+ driverParam: string;
96
+ notNull: true;
97
+ hasDefault: false;
98
+ isPrimaryKey: false;
99
+ isAutoincrement: false;
100
+ hasRuntimeDefault: false;
101
+ enumValues: ["user", "conversation", "general"];
102
+ baseColumn: never;
103
+ identity: undefined;
104
+ generated: undefined;
105
+ }, {}, {}>;
106
+ subjectKey: drizzle_orm_pg_core.PgColumn<{
107
+ name: "subject_key";
108
+ tableName: "junior_memory_memories";
109
+ dataType: "string";
110
+ columnType: "PgText";
111
+ data: string;
112
+ driverParam: string;
113
+ notNull: false;
114
+ hasDefault: false;
115
+ isPrimaryKey: false;
116
+ isAutoincrement: false;
117
+ hasRuntimeDefault: false;
118
+ enumValues: [string, ...string[]];
119
+ baseColumn: never;
120
+ identity: undefined;
121
+ generated: undefined;
122
+ }, {}, {}>;
123
+ content: drizzle_orm_pg_core.PgColumn<{
124
+ name: "content";
125
+ tableName: "junior_memory_memories";
126
+ dataType: "string";
127
+ columnType: "PgText";
128
+ data: string;
129
+ driverParam: string;
130
+ notNull: true;
131
+ hasDefault: false;
132
+ isPrimaryKey: false;
133
+ isAutoincrement: false;
134
+ hasRuntimeDefault: false;
135
+ enumValues: [string, ...string[]];
136
+ baseColumn: never;
137
+ identity: undefined;
138
+ generated: undefined;
139
+ }, {}, {}>;
140
+ searchVector: drizzle_orm_pg_core.PgColumn<{
141
+ name: "search_vector";
142
+ tableName: "junior_memory_memories";
143
+ dataType: "custom";
144
+ columnType: "PgCustomColumn";
145
+ data: string;
146
+ driverParam: unknown;
147
+ notNull: false;
148
+ hasDefault: true;
149
+ isPrimaryKey: false;
150
+ isAutoincrement: false;
151
+ hasRuntimeDefault: false;
152
+ enumValues: undefined;
153
+ baseColumn: never;
154
+ identity: undefined;
155
+ generated: {
156
+ type: "always";
157
+ };
158
+ }, {}, {
159
+ pgColumnBuilderBrand: "PgCustomColumnBuilderBrand";
160
+ }>;
161
+ sourcePlatform: drizzle_orm_pg_core.PgColumn<{
162
+ name: "source_platform";
163
+ tableName: "junior_memory_memories";
164
+ dataType: "string";
165
+ columnType: "PgText";
166
+ data: "slack" | "local" | "web";
167
+ driverParam: string;
168
+ notNull: true;
169
+ hasDefault: false;
170
+ isPrimaryKey: false;
171
+ isAutoincrement: false;
172
+ hasRuntimeDefault: false;
173
+ enumValues: ["slack", "local", "web"];
174
+ baseColumn: never;
175
+ identity: undefined;
176
+ generated: undefined;
177
+ }, {}, {}>;
178
+ sourceKey: drizzle_orm_pg_core.PgColumn<{
179
+ name: "source_key";
180
+ tableName: "junior_memory_memories";
181
+ dataType: "string";
182
+ columnType: "PgText";
183
+ data: string;
184
+ driverParam: string;
185
+ notNull: true;
186
+ hasDefault: false;
187
+ isPrimaryKey: false;
188
+ isAutoincrement: false;
189
+ hasRuntimeDefault: false;
190
+ enumValues: [string, ...string[]];
191
+ baseColumn: never;
192
+ identity: undefined;
193
+ generated: undefined;
194
+ }, {}, {}>;
195
+ locationId: drizzle_orm_pg_core.PgColumn<{
196
+ name: "location_id";
197
+ tableName: "junior_memory_memories";
198
+ dataType: "string";
199
+ columnType: "PgText";
200
+ data: string;
201
+ driverParam: string;
202
+ notNull: false;
203
+ hasDefault: false;
204
+ isPrimaryKey: false;
205
+ isAutoincrement: false;
206
+ hasRuntimeDefault: false;
207
+ enumValues: [string, ...string[]];
208
+ baseColumn: never;
209
+ identity: undefined;
210
+ generated: undefined;
211
+ }, {}, {}>;
212
+ idempotencyKey: drizzle_orm_pg_core.PgColumn<{
213
+ name: "idempotency_key";
214
+ tableName: "junior_memory_memories";
215
+ dataType: "string";
216
+ columnType: "PgText";
217
+ data: string;
218
+ driverParam: string;
219
+ notNull: false;
220
+ hasDefault: false;
221
+ isPrimaryKey: false;
222
+ isAutoincrement: false;
223
+ hasRuntimeDefault: false;
224
+ enumValues: [string, ...string[]];
225
+ baseColumn: never;
226
+ identity: undefined;
227
+ generated: undefined;
228
+ }, {}, {}>;
229
+ observedAtMs: drizzle_orm_pg_core.PgColumn<{
230
+ name: "observed_at_ms";
231
+ tableName: "junior_memory_memories";
232
+ dataType: "number";
233
+ columnType: "PgBigInt53";
234
+ data: number;
235
+ driverParam: string | number;
236
+ notNull: true;
237
+ hasDefault: false;
238
+ isPrimaryKey: false;
239
+ isAutoincrement: false;
240
+ hasRuntimeDefault: false;
241
+ enumValues: undefined;
242
+ baseColumn: never;
243
+ identity: undefined;
244
+ generated: undefined;
245
+ }, {}, {}>;
246
+ createdAtMs: drizzle_orm_pg_core.PgColumn<{
247
+ name: "created_at_ms";
248
+ tableName: "junior_memory_memories";
249
+ dataType: "number";
250
+ columnType: "PgBigInt53";
251
+ data: number;
252
+ driverParam: string | number;
253
+ notNull: true;
254
+ hasDefault: false;
255
+ isPrimaryKey: false;
256
+ isAutoincrement: false;
257
+ hasRuntimeDefault: false;
258
+ enumValues: undefined;
259
+ baseColumn: never;
260
+ identity: undefined;
261
+ generated: undefined;
262
+ }, {}, {}>;
263
+ expiresAtMs: drizzle_orm_pg_core.PgColumn<{
264
+ name: "expires_at_ms";
265
+ tableName: "junior_memory_memories";
266
+ dataType: "number";
267
+ columnType: "PgBigInt53";
268
+ data: number;
269
+ driverParam: string | number;
270
+ notNull: false;
271
+ hasDefault: false;
272
+ isPrimaryKey: false;
273
+ isAutoincrement: false;
274
+ hasRuntimeDefault: false;
275
+ enumValues: undefined;
276
+ baseColumn: never;
277
+ identity: undefined;
278
+ generated: undefined;
279
+ }, {}, {}>;
280
+ supersededAtMs: drizzle_orm_pg_core.PgColumn<{
281
+ name: "superseded_at_ms";
282
+ tableName: "junior_memory_memories";
283
+ dataType: "number";
284
+ columnType: "PgBigInt53";
285
+ data: number;
286
+ driverParam: string | number;
287
+ notNull: false;
288
+ hasDefault: false;
289
+ isPrimaryKey: false;
290
+ isAutoincrement: false;
291
+ hasRuntimeDefault: false;
292
+ enumValues: undefined;
293
+ baseColumn: never;
294
+ identity: undefined;
295
+ generated: undefined;
296
+ }, {}, {}>;
297
+ supersededById: drizzle_orm_pg_core.PgColumn<{
298
+ name: "superseded_by_id";
299
+ tableName: "junior_memory_memories";
300
+ dataType: "string";
301
+ columnType: "PgText";
302
+ data: string;
303
+ driverParam: string;
304
+ notNull: false;
305
+ hasDefault: false;
306
+ isPrimaryKey: false;
307
+ isAutoincrement: false;
308
+ hasRuntimeDefault: false;
309
+ enumValues: [string, ...string[]];
310
+ baseColumn: never;
311
+ identity: undefined;
312
+ generated: undefined;
313
+ }, {}, {}>;
314
+ archivedAtMs: drizzle_orm_pg_core.PgColumn<{
315
+ name: "archived_at_ms";
316
+ tableName: "junior_memory_memories";
317
+ dataType: "number";
318
+ columnType: "PgBigInt53";
319
+ data: number;
320
+ driverParam: string | number;
321
+ notNull: false;
322
+ hasDefault: false;
323
+ isPrimaryKey: false;
324
+ isAutoincrement: false;
325
+ hasRuntimeDefault: false;
326
+ enumValues: undefined;
327
+ baseColumn: never;
328
+ identity: undefined;
329
+ generated: undefined;
330
+ }, {}, {}>;
331
+ archiveReason: drizzle_orm_pg_core.PgColumn<{
332
+ name: "archive_reason";
333
+ tableName: "junior_memory_memories";
334
+ dataType: "string";
335
+ columnType: "PgText";
336
+ data: string;
337
+ driverParam: string;
338
+ notNull: false;
339
+ hasDefault: false;
340
+ isPrimaryKey: false;
341
+ isAutoincrement: false;
342
+ hasRuntimeDefault: false;
343
+ enumValues: [string, ...string[]];
344
+ baseColumn: never;
345
+ identity: undefined;
346
+ generated: undefined;
347
+ }, {}, {}>;
348
+ };
349
+ dialect: "pg";
350
+ }>;
351
+ declare const juniorMemoryEmbeddings: drizzle_orm_pg_core.PgTableWithColumns<{
352
+ name: "junior_memory_embeddings";
353
+ schema: undefined;
354
+ columns: {
355
+ memoryId: drizzle_orm_pg_core.PgColumn<{
356
+ name: "memory_id";
357
+ tableName: "junior_memory_embeddings";
358
+ dataType: "string";
359
+ columnType: "PgText";
360
+ data: string;
361
+ driverParam: string;
362
+ notNull: true;
363
+ hasDefault: false;
364
+ isPrimaryKey: true;
365
+ isAutoincrement: false;
366
+ hasRuntimeDefault: false;
367
+ enumValues: [string, ...string[]];
368
+ baseColumn: never;
369
+ identity: undefined;
370
+ generated: undefined;
371
+ }, {}, {}>;
372
+ provider: drizzle_orm_pg_core.PgColumn<{
373
+ name: "provider";
374
+ tableName: "junior_memory_embeddings";
375
+ dataType: "string";
376
+ columnType: "PgText";
377
+ data: string;
378
+ driverParam: string;
379
+ notNull: true;
380
+ hasDefault: false;
381
+ isPrimaryKey: false;
382
+ isAutoincrement: false;
383
+ hasRuntimeDefault: false;
384
+ enumValues: [string, ...string[]];
385
+ baseColumn: never;
386
+ identity: undefined;
387
+ generated: undefined;
388
+ }, {}, {}>;
389
+ model: drizzle_orm_pg_core.PgColumn<{
390
+ name: "model";
391
+ tableName: "junior_memory_embeddings";
392
+ dataType: "string";
393
+ columnType: "PgText";
394
+ data: string;
395
+ driverParam: string;
396
+ notNull: true;
397
+ hasDefault: false;
398
+ isPrimaryKey: false;
399
+ isAutoincrement: false;
400
+ hasRuntimeDefault: false;
401
+ enumValues: [string, ...string[]];
402
+ baseColumn: never;
403
+ identity: undefined;
404
+ generated: undefined;
405
+ }, {}, {}>;
406
+ dimensions: drizzle_orm_pg_core.PgColumn<{
407
+ name: "dimensions";
408
+ tableName: "junior_memory_embeddings";
409
+ dataType: "number";
410
+ columnType: "PgInteger";
411
+ data: number;
412
+ driverParam: string | number;
413
+ notNull: true;
414
+ hasDefault: false;
415
+ isPrimaryKey: false;
416
+ isAutoincrement: false;
417
+ hasRuntimeDefault: false;
418
+ enumValues: undefined;
419
+ baseColumn: never;
420
+ identity: undefined;
421
+ generated: undefined;
422
+ }, {}, {}>;
423
+ metric: drizzle_orm_pg_core.PgColumn<{
424
+ name: "metric";
425
+ tableName: "junior_memory_embeddings";
426
+ dataType: "string";
427
+ columnType: "PgText";
428
+ data: "cosine";
429
+ driverParam: string;
430
+ notNull: true;
431
+ hasDefault: false;
432
+ isPrimaryKey: false;
433
+ isAutoincrement: false;
434
+ hasRuntimeDefault: false;
435
+ enumValues: ["cosine"];
436
+ baseColumn: never;
437
+ identity: undefined;
438
+ generated: undefined;
439
+ }, {}, {}>;
440
+ contentHash: drizzle_orm_pg_core.PgColumn<{
441
+ name: "content_hash";
442
+ tableName: "junior_memory_embeddings";
443
+ dataType: "string";
444
+ columnType: "PgText";
445
+ data: string;
446
+ driverParam: string;
447
+ notNull: true;
448
+ hasDefault: false;
449
+ isPrimaryKey: false;
450
+ isAutoincrement: false;
451
+ hasRuntimeDefault: false;
452
+ enumValues: [string, ...string[]];
453
+ baseColumn: never;
454
+ identity: undefined;
455
+ generated: undefined;
456
+ }, {}, {}>;
457
+ embedding: drizzle_orm_pg_core.PgColumn<{
458
+ name: "embedding";
459
+ tableName: "junior_memory_embeddings";
460
+ dataType: "array";
461
+ columnType: "PgVector";
462
+ data: number[];
463
+ driverParam: string;
464
+ notNull: true;
465
+ hasDefault: false;
466
+ isPrimaryKey: false;
467
+ isAutoincrement: false;
468
+ hasRuntimeDefault: false;
469
+ enumValues: undefined;
470
+ baseColumn: never;
471
+ identity: undefined;
472
+ generated: undefined;
473
+ }, {}, {
474
+ dimensions: 1536;
475
+ }>;
476
+ createdAtMs: drizzle_orm_pg_core.PgColumn<{
477
+ name: "created_at_ms";
478
+ tableName: "junior_memory_embeddings";
479
+ dataType: "number";
480
+ columnType: "PgBigInt53";
481
+ data: number;
482
+ driverParam: string | number;
483
+ notNull: true;
484
+ hasDefault: false;
485
+ isPrimaryKey: false;
486
+ isAutoincrement: false;
487
+ hasRuntimeDefault: false;
488
+ enumValues: undefined;
489
+ baseColumn: never;
490
+ identity: undefined;
491
+ generated: undefined;
492
+ }, {}, {}>;
493
+ };
494
+ dialect: "pg";
495
+ }>;
496
+
497
+ declare const memorySqlSchema_juniorMemoryEmbeddings: typeof juniorMemoryEmbeddings;
498
+ declare const memorySqlSchema_juniorMemoryMemories: typeof juniorMemoryMemories;
499
+ declare namespace memorySqlSchema {
500
+ export { memorySqlSchema_juniorMemoryEmbeddings as juniorMemoryEmbeddings, memorySqlSchema_juniorMemoryMemories as juniorMemoryMemories };
501
+ }
502
+
503
+ declare const MEMORY_KINDS: readonly ["preference", "procedure", "knowledge"];
504
+ type MemoryKind = (typeof MEMORY_KINDS)[number];
505
+ /** Host data used to set memory access, subject, and source. */
506
+ declare const memoryRuntimeContextSchema: z.ZodObject<{
507
+ conversationId: z.ZodOptional<z.ZodString>;
508
+ locationId: z.ZodOptional<z.ZodString>;
509
+ actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
510
+ platform: z.ZodLiteral<"slack">;
511
+ teamId: z.ZodString;
512
+ email: z.ZodOptional<z.ZodString>;
513
+ fullName: z.ZodOptional<z.ZodString>;
514
+ userId: z.ZodString;
515
+ userName: z.ZodOptional<z.ZodString>;
516
+ }, z.core.$strict>, z.ZodObject<{
517
+ platform: z.ZodLiteral<"local">;
518
+ email: z.ZodOptional<z.ZodString>;
519
+ fullName: z.ZodOptional<z.ZodString>;
520
+ userId: z.ZodString;
521
+ userName: z.ZodOptional<z.ZodString>;
522
+ }, z.core.$strict>, z.ZodObject<{
523
+ platform: z.ZodLiteral<"web">;
524
+ email: z.ZodOptional<z.ZodString>;
525
+ fullName: z.ZodOptional<z.ZodString>;
526
+ userId: z.ZodString;
527
+ userName: z.ZodOptional<z.ZodString>;
528
+ }, z.core.$strict>, z.ZodObject<{
529
+ platform: z.ZodLiteral<"system">;
530
+ name: z.ZodString;
531
+ }, z.core.$strict>], "platform">>;
532
+ source: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
533
+ kind: z.ZodLiteral<"slack">;
534
+ teamId: z.ZodString;
535
+ channelId: z.ZodString;
536
+ visibility: z.ZodEnum<{
537
+ public: "public";
538
+ private: "private";
539
+ }>;
540
+ messageTs: z.ZodOptional<z.ZodString>;
541
+ threadTs: z.ZodOptional<z.ZodString>;
542
+ }, z.core.$strict>, z.ZodObject<{
543
+ kind: z.ZodLiteral<"local">;
544
+ visibility: z.ZodLiteral<"private">;
545
+ conversationId: z.ZodString;
546
+ }, z.core.$strict>, z.ZodObject<{
547
+ kind: z.ZodLiteral<"web">;
548
+ visibility: z.ZodEnum<{
549
+ public: "public";
550
+ private: "private";
551
+ }>;
552
+ conversationId: z.ZodString;
553
+ }, z.core.$strict>, z.ZodObject<{
554
+ kind: z.ZodLiteral<"resource_event">;
555
+ eventKey: z.ZodString;
556
+ eventType: z.ZodString;
557
+ identifier: z.ZodString;
558
+ namespace: z.ZodString;
559
+ }, z.core.$strict>, z.ZodObject<{
560
+ kind: z.ZodLiteral<"scheduled_task">;
561
+ }, z.core.$strict>, z.ZodObject<{
562
+ kind: z.ZodLiteral<"event_task">;
563
+ }, z.core.$strict>, z.ZodObject<{
564
+ kind: z.ZodLiteral<"plugin_dispatch">;
565
+ }, z.core.$strict>, z.ZodObject<{
566
+ kind: z.ZodLiteral<"agent_invocation">;
567
+ }, z.core.$strict>], "kind">, unknown>;
568
+ userId: z.ZodOptional<z.ZodString>;
569
+ }, z.core.$strict>;
570
+ type MemoryRuntimeContext = z.output<typeof memoryRuntimeContextSchema>;
571
+
572
+ type MemoryDb = PgDatabase<PgQueryResultHKT, typeof memorySqlSchema>;
573
+ declare const createMemoryInputSchema: z.ZodObject<{
574
+ content: z.ZodString;
575
+ expiresAtMs: z.ZodOptional<z.ZodNumber>;
576
+ idempotencyKey: z.ZodString;
577
+ kind: z.ZodEnum<{
578
+ preference: "preference";
579
+ procedure: "procedure";
580
+ knowledge: "knowledge";
581
+ }>;
582
+ }, z.core.$strict>;
583
+ declare const listMemoriesInputSchema: z.ZodObject<{
584
+ limit: z.ZodOptional<z.ZodNumber>;
585
+ }, z.core.$strict>;
586
+ declare const searchMemoriesInputSchema: z.ZodObject<{
587
+ limit: z.ZodOptional<z.ZodNumber>;
588
+ query: z.ZodString;
589
+ }, z.core.$strict>;
590
+ declare const archiveMemoryInputSchema: z.ZodObject<{
591
+ id: z.ZodString;
592
+ reason: z.ZodOptional<z.ZodString>;
593
+ }, z.core.$strict>;
594
+ declare const archiveExpiredMemoriesInputSchema: z.ZodObject<{
595
+ limit: z.ZodOptional<z.ZodNumber>;
596
+ }, z.core.$strict>;
597
+ declare const memoryRecordSchema: z.ZodObject<{
598
+ archivedAtMs: z.ZodOptional<z.ZodNumber>;
599
+ archiveReason: z.ZodOptional<z.ZodString>;
600
+ content: z.ZodString;
601
+ createdAtMs: z.ZodNumber;
602
+ expiresAtMs: z.ZodOptional<z.ZodNumber>;
603
+ id: z.ZodString;
604
+ observedAtMs: z.ZodNumber;
605
+ scope: z.ZodEnum<{
606
+ private: "private";
607
+ public: "public";
608
+ }>;
609
+ subjectType: z.ZodEnum<{
610
+ user: "user";
611
+ conversation: "conversation";
612
+ general: "general";
613
+ }>;
614
+ supersededAtMs: z.ZodOptional<z.ZodNumber>;
615
+ supersededById: z.ZodOptional<z.ZodString>;
616
+ kind: z.ZodEnum<{
617
+ preference: "preference";
618
+ procedure: "procedure";
619
+ knowledge: "knowledge";
620
+ }>;
621
+ }, z.core.$strict>;
622
+ /** Validated preference comparison input supplied to a supersession decider. */
623
+ declare const memorySupersessionInputSchema: z.ZodObject<{
624
+ candidate: z.ZodObject<{
625
+ content: z.ZodString;
626
+ kind: z.ZodLiteral<"preference">;
627
+ }, z.core.$strict>;
628
+ existingMemories: z.ZodArray<z.ZodObject<{
629
+ content: z.ZodString;
630
+ id: z.ZodString;
631
+ }, z.core.$strict>>;
632
+ runtimeContext: z.ZodObject<{
633
+ conversationId: z.ZodOptional<z.ZodString>;
634
+ locationId: z.ZodOptional<z.ZodString>;
635
+ actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
636
+ platform: z.ZodLiteral<"slack">;
637
+ teamId: z.ZodString;
638
+ email: z.ZodOptional<z.ZodString>;
639
+ fullName: z.ZodOptional<z.ZodString>;
640
+ userId: z.ZodString;
641
+ userName: z.ZodOptional<z.ZodString>;
642
+ }, z.core.$strict>, z.ZodObject<{
643
+ platform: z.ZodLiteral<"local">;
644
+ email: z.ZodOptional<z.ZodString>;
645
+ fullName: z.ZodOptional<z.ZodString>;
646
+ userId: z.ZodString;
647
+ userName: z.ZodOptional<z.ZodString>;
648
+ }, z.core.$strict>, z.ZodObject<{
649
+ platform: z.ZodLiteral<"web">;
650
+ email: z.ZodOptional<z.ZodString>;
651
+ fullName: z.ZodOptional<z.ZodString>;
652
+ userId: z.ZodString;
653
+ userName: z.ZodOptional<z.ZodString>;
654
+ }, z.core.$strict>, z.ZodObject<{
655
+ platform: z.ZodLiteral<"system">;
656
+ name: z.ZodString;
657
+ }, z.core.$strict>], "platform">>;
658
+ source: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
659
+ kind: z.ZodLiteral<"slack">;
660
+ teamId: z.ZodString;
661
+ channelId: z.ZodString;
662
+ visibility: z.ZodEnum<{
663
+ public: "public";
664
+ private: "private";
665
+ }>;
666
+ messageTs: z.ZodOptional<z.ZodString>;
667
+ threadTs: z.ZodOptional<z.ZodString>;
668
+ }, z.core.$strict>, z.ZodObject<{
669
+ kind: z.ZodLiteral<"local">;
670
+ visibility: z.ZodLiteral<"private">;
671
+ conversationId: z.ZodString;
672
+ }, z.core.$strict>, z.ZodObject<{
673
+ kind: z.ZodLiteral<"web">;
674
+ visibility: z.ZodEnum<{
675
+ public: "public";
676
+ private: "private";
677
+ }>;
678
+ conversationId: z.ZodString;
679
+ }, z.core.$strict>, z.ZodObject<{
680
+ kind: z.ZodLiteral<"resource_event">;
681
+ eventKey: z.ZodString;
682
+ eventType: z.ZodString;
683
+ identifier: z.ZodString;
684
+ namespace: z.ZodString;
685
+ }, z.core.$strict>, z.ZodObject<{
686
+ kind: z.ZodLiteral<"scheduled_task">;
687
+ }, z.core.$strict>, z.ZodObject<{
688
+ kind: z.ZodLiteral<"event_task">;
689
+ }, z.core.$strict>, z.ZodObject<{
690
+ kind: z.ZodLiteral<"plugin_dispatch">;
691
+ }, z.core.$strict>, z.ZodObject<{
692
+ kind: z.ZodLiteral<"agent_invocation">;
693
+ }, z.core.$strict>], "kind">, unknown>;
694
+ userId: z.ZodOptional<z.ZodString>;
695
+ }, z.core.$strict>;
696
+ }, z.core.$strict>;
697
+ /**
698
+ * Validated preference decision whose referenced ids must come from the
699
+ * supplied existing memories.
700
+ */
701
+ declare const memorySupersessionDecisionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
702
+ decision: z.ZodLiteral<"duplicate">;
703
+ duplicateId: z.ZodString;
704
+ }, z.core.$strict>, z.ZodObject<{
705
+ decision: z.ZodLiteral<"supersedes_old">;
706
+ supersededIds: z.ZodArray<z.ZodString>;
707
+ }, z.core.$strict>, z.ZodObject<{
708
+ decision: z.ZodEnum<{
709
+ distinct: "distinct";
710
+ uncertain: "uncertain";
711
+ }>;
712
+ }, z.core.$strict>], "decision">;
713
+ type MemoryRecord = z.output<typeof memoryRecordSchema>;
714
+ type CreateMemoryInput = z.output<typeof createMemoryInputSchema>;
715
+ /** Result of a memory write after idempotency checks. */
716
+ interface CreateMemoryResult {
717
+ created: boolean;
718
+ /** True when this call found the memory previously written for the same input identity. */
719
+ idempotent?: true;
720
+ memory: MemoryRecord;
721
+ /** Memory ids made inactive by this write. */
722
+ supersededIds?: string[];
723
+ }
724
+ type ListMemoriesInput = z.output<typeof listMemoriesInputSchema>;
725
+ type SearchMemoriesInput = z.output<typeof searchMemoriesInputSchema>;
726
+ type ArchiveMemoryInput = z.output<typeof archiveMemoryInputSchema>;
727
+ type ArchiveExpiredMemoriesInput = z.output<typeof archiveExpiredMemoriesInputSchema>;
728
+ interface ArchiveExpiredMemoriesResult {
729
+ archivedCount: number;
730
+ }
731
+ interface MemoryEmbeddingProvider {
732
+ /** Embed normalized memory text for derived vector retrieval. */
733
+ embedTexts(input: {
734
+ texts: string[];
735
+ }): Promise<{
736
+ costUsd?: number;
737
+ dimensions: number;
738
+ model: string;
739
+ provider: string;
740
+ vectors: number[][];
741
+ }>;
742
+ }
743
+ type MemorySupersessionInput = z.output<typeof memorySupersessionInputSchema>;
744
+ type MemorySupersessionDecision = z.output<typeof memorySupersessionDecisionSchema>;
745
+ interface MemorySupersessionDecider {
746
+ /** Classify a new preference against related active preferences. */
747
+ adjudicateSupersession(input: MemorySupersessionInput): Promise<MemorySupersessionDecision> | MemorySupersessionDecision;
748
+ }
749
+ interface MemoryStoreOptions {
750
+ embedder?: MemoryEmbeddingProvider;
751
+ now?: () => number;
752
+ supersessionDecider?: MemorySupersessionDecider;
753
+ }
754
+ /** Context-bound storage operations for visible long-term memories. */
755
+ interface MemoryStore {
756
+ /** Archive expired memories visible in the current runtime context. */
757
+ archiveExpiredMemories(input?: ArchiveExpiredMemoriesInput): Promise<ArchiveExpiredMemoriesResult>;
758
+ /** Archive a visible memory in the current runtime context. */
759
+ archiveMemory(input: ArchiveMemoryInput): Promise<MemoryRecord>;
760
+ /** Store a memory about the current User. The Source sets access. */
761
+ createMemory(input: CreateMemoryInput): Promise<CreateMemoryResult>;
762
+ /** Store a memory about the current Conversation. The Source sets access. */
763
+ createConversationMemory(input: CreateMemoryInput): Promise<CreateMemoryResult>;
764
+ /** List active memories visible in the current runtime context. */
765
+ listMemories(input: ListMemoriesInput): Promise<MemoryRecord[]>;
766
+ /**
767
+ * Retrieve a broad relevance-ranked candidate window for automatic recall.
768
+ * Prompt admission remains owned by the recall boundary.
769
+ */
770
+ recallMemories(input: SearchMemoriesInput): Promise<MemoryRecord[]>;
771
+ /** Search active memories visible in the current runtime context. */
772
+ searchMemories(input: SearchMemoriesInput): Promise<MemoryRecord[]>;
773
+ }
774
+ /** Create a context-bound SQL-backed store for explicit memory operations. */
775
+ declare function createMemoryStore(db: MemoryDb, context: MemoryRuntimeContext, options?: MemoryStoreOptions): MemoryStore;
776
+
777
+ /**
778
+ * Authenticated REST access to memory.
779
+ *
780
+ * The signed-in User can read public memory and private memory that they own.
781
+ */
782
+
783
+ declare const memoryApiSchema: z.ZodObject<{
784
+ content: z.ZodString;
785
+ createdAt: z.ZodISODateTime;
786
+ expiresAt: z.ZodOptional<z.ZodISODateTime>;
787
+ id: z.ZodString;
788
+ kind: z.ZodEnum<{
789
+ preference: "preference";
790
+ procedure: "procedure";
791
+ knowledge: "knowledge";
792
+ }>;
793
+ observedAt: z.ZodISODateTime;
794
+ origin: z.ZodEnum<{
795
+ automatic: "automatic";
796
+ explicit: "explicit";
797
+ other: "other";
798
+ }>;
799
+ sourcePlatform: z.ZodEnum<{
800
+ slack: "slack";
801
+ local: "local";
802
+ web: "web";
803
+ }>;
804
+ visibility: z.ZodEnum<{
805
+ private: "private";
806
+ public: "public";
807
+ }>;
808
+ }, z.core.$strict>;
809
+ declare const memoryListResponseSchema: z.ZodObject<{
810
+ memories: z.ZodArray<z.ZodObject<{
811
+ content: z.ZodString;
812
+ createdAt: z.ZodISODateTime;
813
+ expiresAt: z.ZodOptional<z.ZodISODateTime>;
814
+ id: z.ZodString;
815
+ kind: z.ZodEnum<{
816
+ preference: "preference";
817
+ procedure: "procedure";
818
+ knowledge: "knowledge";
819
+ }>;
820
+ observedAt: z.ZodISODateTime;
821
+ origin: z.ZodEnum<{
822
+ automatic: "automatic";
823
+ explicit: "explicit";
824
+ other: "other";
825
+ }>;
826
+ sourcePlatform: z.ZodEnum<{
827
+ slack: "slack";
828
+ local: "local";
829
+ web: "web";
830
+ }>;
831
+ visibility: z.ZodEnum<{
832
+ private: "private";
833
+ public: "public";
834
+ }>;
835
+ }, z.core.$strict>>;
836
+ nextCursor: z.ZodOptional<z.ZodString>;
837
+ }, z.core.$strict>;
838
+ declare const memoryDashboardResponseSchema: z.ZodObject<{
839
+ days: z.ZodArray<z.ZodObject<{
840
+ date: z.ZodString;
841
+ personal: z.ZodNumber;
842
+ public: z.ZodNumber;
843
+ }, z.core.$strict>>;
844
+ extractionDays: z.ZodArray<z.ZodObject<{
845
+ costUsd: z.ZodNumber;
846
+ date: z.ZodString;
847
+ events: z.ZodNumber;
848
+ }, z.core.$strict>>;
849
+ extractionHours: z.ZodOptional<z.ZodArray<z.ZodObject<{
850
+ costUsd: z.ZodNumber;
851
+ date: z.ZodString;
852
+ events: z.ZodNumber;
853
+ }, z.core.$strict>>>;
854
+ generatedAt: z.ZodISODateTime;
855
+ hours: z.ZodOptional<z.ZodArray<z.ZodObject<{
856
+ date: z.ZodString;
857
+ personal: z.ZodNumber;
858
+ public: z.ZodNumber;
859
+ }, z.core.$strict>>>;
860
+ recallDays: z.ZodArray<z.ZodObject<{
861
+ costUsd: z.ZodNumber;
862
+ date: z.ZodString;
863
+ events: z.ZodNumber;
864
+ }, z.core.$strict>>;
865
+ recallHours: z.ZodOptional<z.ZodArray<z.ZodObject<{
866
+ costUsd: z.ZodNumber;
867
+ date: z.ZodString;
868
+ events: z.ZodNumber;
869
+ }, z.core.$strict>>>;
870
+ stats: z.ZodObject<{
871
+ active: z.ZodNumber;
872
+ automatic: z.ZodNumber;
873
+ createdThirtyDays: z.ZodNumber;
874
+ embedded: z.ZodNumber;
875
+ explicit: z.ZodNumber;
876
+ knowledge: z.ZodNumber;
877
+ personal: z.ZodNumber;
878
+ preference: z.ZodNumber;
879
+ procedure: z.ZodNumber;
880
+ public: z.ZodNumber;
881
+ }, z.core.$strict>;
882
+ }, z.core.$strict>;
883
+ type MemoryApi = z.output<typeof memoryApiSchema>;
884
+ type MemoryDashboardResponse = z.output<typeof memoryDashboardResponseSchema>;
885
+ type MemoryListResponse = z.output<typeof memoryListResponseSchema>;
886
+
887
+ export { type ArchiveMemoryInput, type CreateMemoryInput, type CreateMemoryResult, type ListMemoriesInput, MEMORY_KINDS, type MemoryApi, type MemoryDashboardResponse, type MemoryDb, type MemoryEmbeddingProvider, type MemoryKind, type MemoryListResponse, type MemoryPluginOptions, type MemoryRecord, type MemoryRuntimeContext, type MemoryStore, type MemoryStoreOptions, type SearchMemoriesInput, createMemoryStore, memoryApiSchema, memoryDashboardResponseSchema, memoryListResponseSchema, memoryPlugin };