@sentry/junior-memory 0.178.0 → 0.180.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-memory",
3
- "version": "0.178.0",
3
+ "version": "0.180.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -27,12 +27,13 @@
27
27
  "commander": "^14.0.3",
28
28
  "drizzle-orm": "^0.45.2",
29
29
  "zod": "^4.4.3",
30
- "@sentry/junior-plugin-api": "0.178.0"
30
+ "@sentry/junior-plugin-api": "0.180.0"
31
31
  },
32
32
  "devDependencies": {
33
+ "@oxlint/plugins": "1.79.0",
33
34
  "@types/node": "^25.9.1",
34
35
  "drizzle-kit": "^0.31.8",
35
- "oxlint": "^1.66.0",
36
+ "oxlint": "^1.79.0",
36
37
  "tsup": "^8.5.1",
37
38
  "typescript": "^6.0.3",
38
39
  "vitest": "^4.1.7",
package/src/agent.ts CHANGED
@@ -564,7 +564,7 @@ export function createMemoryAgent(model: PluginModel): MemoryAgent {
564
564
  relevantIds: [...new Set(decision.relevantIds)].filter((id) =>
565
565
  candidateIds.has(id),
566
566
  ),
567
- ...(result.costUsd !== undefined ? { costUsd: result.costUsd } : {}),
567
+ ...(result.costUsd !== undefined ? { costUsd: result.costUsd } : undefined),
568
568
  };
569
569
  },
570
570
  async adjudicateSupersession(rawRequest) {
@@ -589,7 +589,7 @@ export function createMemoryAgent(model: PluginModel): MemoryAgent {
589
589
  memories: extractedMemoriesFromResponse(
590
590
  extractMemoriesResponseSchema.parse(result.object),
591
591
  ),
592
- ...(result.costUsd !== undefined ? { costUsd: result.costUsd } : {}),
592
+ ...(result.costUsd !== undefined ? { costUsd: result.costUsd } : undefined),
593
593
  };
594
594
  },
595
595
  async reviewCreateRequest(rawRequest) {
@@ -616,7 +616,7 @@ function memoryReviewFromResponse(
616
616
  content: response.canonicalFact,
617
617
  ...(response.expiresAtMs !== null
618
618
  ? { expiresAtMs: response.expiresAtMs }
619
- : {}),
619
+ : undefined),
620
620
  });
621
621
  }
622
622
  return parseMemoryReview({
package/src/api.ts CHANGED
@@ -117,7 +117,7 @@ function apiMemory(
117
117
  createdAt: new Date(memory.createdAtMs).toISOString(),
118
118
  ...(memory.expiresAtMs !== undefined
119
119
  ? { expiresAt: new Date(memory.expiresAtMs).toISOString() }
120
- : {}),
120
+ : undefined),
121
121
  id: memory.id,
122
122
  kind: memory.kind,
123
123
  observedAt: new Date(memory.observedAtMs).toISOString(),
@@ -198,11 +198,11 @@ export function createMemoryApi(options: MemoryApiOptions): PluginRouteApp {
198
198
  const page = await memories.list({
199
199
  cursor: query.cursor,
200
200
  limit: query.limit,
201
- ...(query.q ? { query: query.q } : {}),
201
+ ...(query.q ? { query: query.q } : undefined),
202
202
  });
203
203
  const body = memoryListResponseSchema.parse({
204
204
  memories: page.memories.map(apiMemory),
205
- ...(page.nextCursor ? { nextCursor: page.nextCursor } : {}),
205
+ ...(page.nextCursor ? { nextCursor: page.nextCursor } : undefined),
206
206
  });
207
207
  return request.method === "HEAD"
208
208
  ? new Response(null, {
@@ -302,7 +302,7 @@ export function createPersonalMemoryCollection(
302
302
  id: last.id,
303
303
  },
304
304
  }
305
- : {}),
305
+ : undefined),
306
306
  };
307
307
  },
308
308
 
package/src/personal.ts CHANGED
@@ -87,10 +87,10 @@ function encodeCursor(
87
87
  return Buffer.from(
88
88
  JSON.stringify({
89
89
  ...cursor,
90
- ...(input.query ? { query: input.query } : {}),
91
- ...(input.kind ? { kind: input.kind } : {}),
92
- ...(input.origin ? { origin: input.origin } : {}),
93
- ...(input.visibility ? { visibility: input.visibility } : {}),
90
+ ...(input.query ? { query: input.query } : undefined),
91
+ ...(input.kind ? { kind: input.kind } : undefined),
92
+ ...(input.origin ? { origin: input.origin } : undefined),
93
+ ...(input.visibility ? { visibility: input.visibility } : undefined),
94
94
  version: 1,
95
95
  }),
96
96
  "utf8",
@@ -113,10 +113,10 @@ export function createViewerMemories(db: MemoryDb, user: User) {
113
113
  async list(input: ViewerMemoryPageInput): Promise<ViewerMemoryPage> {
114
114
  const query = input.query?.trim() || undefined;
115
115
  const filters = {
116
- ...(input.kind ? { kind: input.kind } : {}),
117
- ...(input.origin ? { origin: input.origin } : {}),
118
- ...(query ? { query } : {}),
119
- ...(input.visibility ? { visibility: input.visibility } : {}),
116
+ ...(input.kind ? { kind: input.kind } : undefined),
117
+ ...(input.origin ? { origin: input.origin } : undefined),
118
+ ...(query ? { query } : undefined),
119
+ ...(input.visibility ? { visibility: input.visibility } : undefined),
120
120
  };
121
121
  const page = await collection.list({
122
122
  cursor: decodeCursor(input.cursor, filters),
@@ -127,7 +127,7 @@ export function createViewerMemories(db: MemoryDb, user: User) {
127
127
  memories: page.memories,
128
128
  ...(page.nextCursor
129
129
  ? { nextCursor: encodeCursor(page.nextCursor, filters) }
130
- : {}),
130
+ : undefined),
131
131
  };
132
132
  },
133
133
  async stats() {
package/src/plugin.ts CHANGED
@@ -52,12 +52,12 @@ function memoryToolContext(ctx: {
52
52
  }): MemoryToolContext {
53
53
  return {
54
54
  agent: ctx.agent,
55
- ...(ctx.conversationId ? { conversationId: ctx.conversationId } : {}),
56
- ...(ctx.actor ? { actor: ctx.actor } : {}),
55
+ ...(ctx.conversationId ? { conversationId: ctx.conversationId } : undefined),
56
+ ...(ctx.actor ? { actor: ctx.actor } : undefined),
57
57
  db: ctx.db,
58
- ...(ctx.embedder ? { embedder: ctx.embedder } : {}),
58
+ ...(ctx.embedder ? { embedder: ctx.embedder } : undefined),
59
59
  source: ctx.source,
60
- ...(ctx.userText ? { userText: ctx.userText } : {}),
60
+ ...(ctx.userText ? { userText: ctx.userText } : undefined),
61
61
  };
62
62
  }
63
63
 
@@ -157,8 +157,8 @@ export function memoryPlugin(options: MemoryPluginOptions = {}) {
157
157
  agent: createMemoryAgent(ctx.model),
158
158
  ...(ctx.conversationId
159
159
  ? { conversationId: ctx.conversationId }
160
- : {}),
161
- ...(ctx.actor ? { actor: ctx.actor } : {}),
160
+ : undefined),
161
+ ...(ctx.actor ? { actor: ctx.actor } : undefined),
162
162
  db: ctx.db as MemoryDb,
163
163
  embedder: ctx.embedder,
164
164
  events: ctx.events,
@@ -168,7 +168,7 @@ export function memoryPlugin(options: MemoryPluginOptions = {}) {
168
168
  });
169
169
  },
170
170
  }
171
- : {}),
171
+ : undefined),
172
172
  },
173
173
  });
174
174
  }
@@ -203,7 +203,7 @@ function passiveInput(
203
203
  content: memory.content,
204
204
  idempotencyKey: `session:${sourceKey}:${sessionId}:${memoryIdempotencySuffix(memory, target)}`,
205
205
  kind: memory.kind,
206
- ...(memory.expiresAtMs !== null ? { expiresAtMs: memory.expiresAtMs } : {}),
206
+ ...(memory.expiresAtMs !== null ? { expiresAtMs: memory.expiresAtMs } : undefined),
207
207
  };
208
208
  }
209
209
 
@@ -270,7 +270,7 @@ export async function processMemorySession(
270
270
 
271
271
  const runtimeContext = memoryRuntimeContextSchema.parse({
272
272
  conversationId: run.conversationId,
273
- ...(run.actor ? { actor: run.actor } : {}),
273
+ ...(run.actor ? { actor: run.actor } : undefined),
274
274
  source: run.source,
275
275
  });
276
276
  const agent = createMemoryAgent(context.model);
@@ -317,7 +317,7 @@ export async function processMemorySession(
317
317
  memories: captured,
318
318
  ...(extraction.costUsd !== undefined
319
319
  ? { costUsd: extraction.costUsd }
320
- : {}),
320
+ : undefined),
321
321
  }),
322
322
  );
323
323
  }
package/src/ranking.ts CHANGED
@@ -90,8 +90,8 @@ export function rankMemoryMatches(
90
90
  ...existing,
91
91
  ...(!existing.lexical && match.lexical
92
92
  ? { lexical: match.lexical }
93
- : {}),
94
- ...(!existing.vector && match.vector ? { vector: match.vector } : {}),
93
+ : undefined),
94
+ ...(!existing.vector && match.vector ? { vector: match.vector } : undefined),
95
95
  });
96
96
  }
97
97
  return [...byId.values()].sort((left, right) => {
package/src/recall.ts CHANGED
@@ -119,7 +119,7 @@ async function emitRecallOutcome(args: {
119
119
  await args.events?.emit(
120
120
  memoriesRecalledEvent({
121
121
  memories: args.memories,
122
- ...(args.costUsd !== undefined ? { costUsd: args.costUsd } : {}),
122
+ ...(args.costUsd !== undefined ? { costUsd: args.costUsd } : undefined),
123
123
  }),
124
124
  );
125
125
  }
@@ -141,8 +141,8 @@ export async function createMemoryPromptContributions(
141
141
  const runtimeContext = memoryRuntimeContextSchema.parse({
142
142
  ...(context.conversationId
143
143
  ? { conversationId: context.conversationId }
144
- : {}),
145
- ...(context.actor ? { actor: context.actor } : {}),
144
+ : undefined),
145
+ ...(context.actor ? { actor: context.actor } : undefined),
146
146
  source: context.source,
147
147
  });
148
148
  let embeddingCostUsd: number | undefined;
@@ -164,7 +164,7 @@ export async function createMemoryPromptContributions(
164
164
  });
165
165
  if (candidates.length === 0) {
166
166
  await emitRecallOutcome({
167
- ...(embeddingCostUsd !== undefined ? { costUsd: embeddingCostUsd } : {}),
167
+ ...(embeddingCostUsd !== undefined ? { costUsd: embeddingCostUsd } : undefined),
168
168
  events: context.events,
169
169
  memories: [],
170
170
  });
@@ -191,7 +191,7 @@ export async function createMemoryPromptContributions(
191
191
  const selected = selectPromptMemories(relevant);
192
192
  const costUsd = addUsd(embeddingCostUsd, recall.costUsd);
193
193
  await emitRecallOutcome({
194
- ...(costUsd !== undefined ? { costUsd } : {}),
194
+ ...(costUsd !== undefined ? { costUsd } : undefined),
195
195
  events: context.events,
196
196
  memories: selected.map(({ id }) => id),
197
197
  });
package/src/store.ts CHANGED
@@ -441,15 +441,15 @@ export function parseMemoryRow(row: unknown): MemoryRecord {
441
441
  createdAtMs: parsed.createdAtMs,
442
442
  ...(parsed.expiresAtMs !== undefined
443
443
  ? { expiresAtMs: parsed.expiresAtMs }
444
- : {}),
444
+ : undefined),
445
445
  ...(parsed.supersededAtMs !== undefined
446
446
  ? { supersededAtMs: parsed.supersededAtMs }
447
- : {}),
448
- ...(parsed.supersededById ? { supersededById: parsed.supersededById } : {}),
447
+ : undefined),
448
+ ...(parsed.supersededById ? { supersededById: parsed.supersededById } : undefined),
449
449
  ...(parsed.archivedAtMs !== undefined
450
450
  ? { archivedAtMs: parsed.archivedAtMs }
451
- : {}),
452
- ...(parsed.archiveReason ? { archiveReason: parsed.archiveReason } : {}),
451
+ : undefined),
452
+ ...(parsed.archiveReason ? { archiveReason: parsed.archiveReason } : undefined),
453
453
  });
454
454
  }
455
455
 
@@ -1287,7 +1287,7 @@ export function createMemoryStore(
1287
1287
  ) {
1288
1288
  const preferenceCandidates = await listPreferenceAdjudicationCandidates({
1289
1289
  db,
1290
- ...(candidateEmbedding ? { embedding: candidateEmbedding } : {}),
1290
+ ...(candidateEmbedding ? { embedding: candidateEmbedding } : undefined),
1291
1291
  nowMs,
1292
1292
  scope,
1293
1293
  subject,
@@ -1386,7 +1386,7 @@ export function createMemoryStore(
1386
1386
  memory,
1387
1387
  ...(write.supersededIds.length > 0
1388
1388
  ? { supersededIds: write.supersededIds }
1389
- : {}),
1389
+ : undefined),
1390
1390
  };
1391
1391
  }
1392
1392
 
@@ -1474,7 +1474,7 @@ export function createMemoryStore(
1474
1474
  limit: candidateLimit,
1475
1475
  ...(vectorMaxDistance !== undefined
1476
1476
  ? { maxDistance: vectorMaxDistance }
1477
- : {}),
1477
+ : undefined),
1478
1478
  nowMs,
1479
1479
  scopes,
1480
1480
  })
@@ -1505,9 +1505,9 @@ export function createMemoryStore(
1505
1505
  nowMs,
1506
1506
  // Slight lexical preference protects exact ids/names/timezones on ties.
1507
1507
  ...(vectorMaxDistance === undefined
1508
- ? {}
1508
+ ? undefined
1509
1509
  : { lexicalWeight: 1, vectorWeight: 0.85 }),
1510
- ...(channelPrefix ? { channelPrefix } : {}),
1510
+ ...(channelPrefix ? { channelPrefix } : undefined),
1511
1511
  })
1512
1512
  .slice(0, limit)
1513
1513
  .map(({ memory }) => memory);
package/src/tools.ts CHANGED
@@ -85,8 +85,8 @@ function memoryRuntimeContext(
85
85
  return memoryRuntimeContextSchema.parse({
86
86
  ...(context.conversationId
87
87
  ? { conversationId: context.conversationId }
88
- : {}),
89
- ...(context.actor ? { actor: context.actor } : {}),
88
+ : undefined),
89
+ ...(context.actor ? { actor: context.actor } : undefined),
90
90
  source: context.source,
91
91
  });
92
92
  }
@@ -99,7 +99,7 @@ function memoryStore(
99
99
  embedder: context.embedder,
100
100
  ...(options.supersessionDecider
101
101
  ? { supersessionDecider: options.supersessionDecider }
102
- : {}),
102
+ : undefined),
103
103
  });
104
104
  }
105
105
 
@@ -355,7 +355,7 @@ function createInput(
355
355
  kind: input.kind,
356
356
  ...(input.expiresAtMs !== undefined
357
357
  ? { expiresAtMs: input.expiresAtMs }
358
- : {}),
358
+ : undefined),
359
359
  } satisfies CreateMemoryInput;
360
360
  }
361
361
 
@@ -375,7 +375,7 @@ function compactMemory(memory: MemoryRecord): MemoryToolProjection {
375
375
  observedAtMs: memory.observedAtMs,
376
376
  ...(memory.expiresAtMs !== undefined
377
377
  ? { expiresAtMs: memory.expiresAtMs }
378
- : {}),
378
+ : undefined),
379
379
  });
380
380
  }
381
381
 
@@ -420,7 +420,7 @@ export function createMemoryCreateTool(context: MemoryCreateToolContext) {
420
420
  content: requireMemoryContent(parsedInput.content),
421
421
  ...(requestedExpiresAtMs !== undefined
422
422
  ? { expiresAtMs: requestedExpiresAtMs }
423
- : {}),
423
+ : undefined),
424
424
  runtimeContext,
425
425
  ...(context.userText?.trim()
426
426
  ? {
@@ -428,7 +428,7 @@ export function createMemoryCreateTool(context: MemoryCreateToolContext) {
428
428
  currentUserText: context.userText.trim(),
429
429
  },
430
430
  }
431
- : {}),
431
+ : undefined),
432
432
  }),
433
433
  ),
434
434
  );
package/src/user-pages.ts CHANGED
@@ -55,12 +55,12 @@ export function createMemoryUserPage(): PluginUserPageDefinition {
55
55
  cursor: input.cursor,
56
56
  ...pageFilter(input.filter),
57
57
  limit: input.limit,
58
- ...(input.query ? { query: input.query } : {}),
58
+ ...(input.query ? { query: input.query } : undefined),
59
59
  });
60
60
  return {
61
61
  type: "list",
62
62
  emptyText: pageEmptyText(input),
63
- ...(page.nextCursor ? { nextCursor: page.nextCursor } : {}),
63
+ ...(page.nextCursor ? { nextCursor: page.nextCursor } : undefined),
64
64
  searchPlaceholder: "Search memories",
65
65
  records: page.memories.map((memory) => ({
66
66
  actions: