@sentry/junior-memory 0.214.0 → 0.216.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/README.md CHANGED
@@ -45,8 +45,8 @@ exported types, tools, and tests are authoritative.
45
45
 
46
46
  - The Drizzle schema in `src/db/schema.ts` and generated migrations define the
47
47
  database contract.
48
- - Records retain provenance, lifecycle status, supersession relationships, and
49
- timestamps needed for review and deletion.
48
+ - Records retain provenance, the optional origin `conversation_id`, lifecycle
49
+ status, supersession relationships, and timestamps needed for review and deletion.
50
50
  - Embeddings are derived indexes, not independent memory authority.
51
51
  - Embedding distance never decides that two memories are duplicates. Exact
52
52
  content and preference review own duplicate and supersession decisions.
package/dist/index.d.ts CHANGED
@@ -209,6 +209,23 @@ declare const juniorMemoryMemories: drizzle_orm_pg_core.PgTableWithColumns<{
209
209
  identity: undefined;
210
210
  generated: undefined;
211
211
  }, {}, {}>;
212
+ conversationId: drizzle_orm_pg_core.PgColumn<{
213
+ name: "conversation_id";
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
+ }, {}, {}>;
212
229
  idempotencyKey: drizzle_orm_pg_core.PgColumn<{
213
230
  name: "idempotency_key";
214
231
  tableName: "junior_memory_memories";
@@ -598,6 +615,7 @@ declare const memoryRecordSchema: z.ZodObject<{
598
615
  archivedAtMs: z.ZodOptional<z.ZodNumber>;
599
616
  archiveReason: z.ZodOptional<z.ZodString>;
600
617
  content: z.ZodString;
618
+ conversationId: z.ZodOptional<z.ZodString>;
601
619
  createdAtMs: z.ZodNumber;
602
620
  expiresAtMs: z.ZodOptional<z.ZodNumber>;
603
621
  id: z.ZodString;
package/dist/index.js CHANGED
@@ -89,6 +89,8 @@ var juniorMemoryMemories = pgTable(
89
89
  sourceKey: text("source_key").notNull(),
90
90
  /** Location where Junior learned the memory, when known. */
91
91
  locationId: text("location_id"),
92
+ /** Conversation where Junior learned the memory, when known. */
93
+ conversationId: text("conversation_id"),
92
94
  idempotencyKey: text("idempotency_key"),
93
95
  observedAtMs: bigint("observed_at_ms", { mode: "number" }).notNull(),
94
96
  createdAtMs: bigint("created_at_ms", { mode: "number" }).notNull(),
@@ -332,6 +334,7 @@ var memoryRowSchema = z2.object({
332
334
  archivedAtMs: optionalNumberSchema,
333
335
  archiveReason: optionalStringSchema,
334
336
  content: memoryContentSchema,
337
+ conversationId: optionalNonEmptyStringSchema,
335
338
  createdAtMs: z2.coerce.number(),
336
339
  expiresAtMs: optionalNumberSchema,
337
340
  id: z2.string().min(1),
@@ -385,6 +388,7 @@ var memoryRecordSchema = z2.object({
385
388
  archivedAtMs: numberSchema.optional(),
386
389
  archiveReason: nonEmptyStringSchema2.optional(),
387
390
  content: memoryContentSchema,
391
+ conversationId: nonEmptyStringSchema2.optional(),
388
392
  createdAtMs: numberSchema,
389
393
  expiresAtMs: numberSchema.optional(),
390
394
  id: nonEmptyStringSchema2,
@@ -463,6 +467,7 @@ function parseMemoryRow(row) {
463
467
  kind: parsed.kind,
464
468
  subjectType: parsed.subjectType,
465
469
  content: parsed.content,
470
+ ...parsed.conversationId ? { conversationId: parsed.conversationId } : void 0,
466
471
  observedAtMs: parsed.observedAtMs,
467
472
  createdAtMs: parsed.createdAtMs,
468
473
  ...parsed.expiresAtMs !== void 0 ? { expiresAtMs: parsed.expiresAtMs } : void 0,
@@ -706,6 +711,7 @@ async function rememberDuplicateIdempotency(args) {
706
711
  }
707
712
  await args.db.insert(juniorMemoryMemories).values({
708
713
  content: args.content,
714
+ conversationId: args.runtimeContext.conversationId,
709
715
  createdAtMs: args.nowMs,
710
716
  expiresAtMs: args.duplicate.expiresAtMs,
711
717
  id: idempotencyAliasId({
@@ -883,6 +889,7 @@ async function searchVisibleLexicalMemories(args) {
883
889
  archiveReason: candidates.archiveReason,
884
890
  archivedAtMs: candidates.archivedAtMs,
885
891
  content: candidates.content,
892
+ conversationId: candidates.conversationId,
886
893
  createdAtMs: candidates.createdAtMs,
887
894
  expiresAtMs: candidates.expiresAtMs,
888
895
  id: candidates.id,
@@ -1083,6 +1090,7 @@ function createMemoryStore(db, context, options = {}) {
1083
1090
  const write = await db.transaction(async (tx) => {
1084
1091
  const inserted = await tx.insert(juniorMemoryMemories).values({
1085
1092
  content,
1093
+ conversationId: runtimeContext.conversationId,
1086
1094
  createdAtMs: nowMs,
1087
1095
  expiresAtMs: input.expiresAtMs,
1088
1096
  id,