@sentry/junior-memory 0.188.0 → 0.190.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/store.d.ts CHANGED
@@ -91,16 +91,10 @@ export declare const memorySupersessionInputSchema: z.ZodObject<{
91
91
  platform: z.ZodLiteral<"system">;
92
92
  name: z.ZodString;
93
93
  }, z.core.$strict>], "platform">>;
94
- source: z.ZodDiscriminatedUnion<[z.ZodObject<{
95
- platform: z.ZodLiteral<"slack">;
94
+ source: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
95
+ kind: z.ZodLiteral<"slack">;
96
96
  teamId: z.ZodString;
97
97
  channelId: z.ZodString;
98
- location: z.ZodOptional<z.ZodObject<{
99
- id: z.ZodString;
100
- provider: z.ZodString;
101
- tenantId: z.ZodOptional<z.ZodString>;
102
- providerId: z.ZodString;
103
- }, z.core.$strict>>;
104
98
  visibility: z.ZodEnum<{
105
99
  public: "public";
106
100
  private: "private";
@@ -108,29 +102,23 @@ export declare const memorySupersessionInputSchema: z.ZodObject<{
108
102
  messageTs: z.ZodOptional<z.ZodString>;
109
103
  threadTs: z.ZodOptional<z.ZodString>;
110
104
  }, z.core.$strict>, z.ZodObject<{
111
- location: z.ZodOptional<z.ZodObject<{
112
- id: z.ZodString;
113
- provider: z.ZodString;
114
- tenantId: z.ZodOptional<z.ZodString>;
115
- providerId: z.ZodString;
116
- }, z.core.$strict>>;
117
- platform: z.ZodLiteral<"local">;
105
+ kind: z.ZodLiteral<"local">;
118
106
  visibility: z.ZodLiteral<"private">;
119
107
  conversationId: z.ZodString;
120
108
  }, z.core.$strict>, z.ZodObject<{
121
- location: z.ZodOptional<z.ZodObject<{
122
- id: z.ZodString;
123
- provider: z.ZodString;
124
- tenantId: z.ZodOptional<z.ZodString>;
125
- providerId: z.ZodString;
126
- }, z.core.$strict>>;
127
- platform: z.ZodLiteral<"web">;
109
+ kind: z.ZodLiteral<"web">;
128
110
  visibility: z.ZodEnum<{
129
111
  public: "public";
130
112
  private: "private";
131
113
  }>;
132
114
  conversationId: z.ZodString;
133
- }, z.core.$strict>], "platform">;
115
+ }, z.core.$strict>, z.ZodObject<{
116
+ kind: z.ZodLiteral<"resource_event">;
117
+ eventKey: z.ZodString;
118
+ eventType: z.ZodString;
119
+ identifier: z.ZodString;
120
+ namespace: z.ZodString;
121
+ }, z.core.$strict>], "kind">>;
134
122
  userId: z.ZodOptional<z.ZodString>;
135
123
  }, z.core.$strict>;
136
124
  }, z.core.$strict>;
package/dist/types.d.ts CHANGED
@@ -37,16 +37,10 @@ export declare const memoryRuntimeContextSchema: z.ZodObject<{
37
37
  platform: z.ZodLiteral<"system">;
38
38
  name: z.ZodString;
39
39
  }, z.core.$strict>], "platform">>;
40
- source: z.ZodDiscriminatedUnion<[z.ZodObject<{
41
- platform: z.ZodLiteral<"slack">;
40
+ source: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
41
+ kind: z.ZodLiteral<"slack">;
42
42
  teamId: z.ZodString;
43
43
  channelId: z.ZodString;
44
- location: z.ZodOptional<z.ZodObject<{
45
- id: z.ZodString;
46
- provider: z.ZodString;
47
- tenantId: z.ZodOptional<z.ZodString>;
48
- providerId: z.ZodString;
49
- }, z.core.$strict>>;
50
44
  visibility: z.ZodEnum<{
51
45
  public: "public";
52
46
  private: "private";
@@ -54,29 +48,23 @@ export declare const memoryRuntimeContextSchema: z.ZodObject<{
54
48
  messageTs: z.ZodOptional<z.ZodString>;
55
49
  threadTs: z.ZodOptional<z.ZodString>;
56
50
  }, z.core.$strict>, z.ZodObject<{
57
- location: z.ZodOptional<z.ZodObject<{
58
- id: z.ZodString;
59
- provider: z.ZodString;
60
- tenantId: z.ZodOptional<z.ZodString>;
61
- providerId: z.ZodString;
62
- }, z.core.$strict>>;
63
- platform: z.ZodLiteral<"local">;
51
+ kind: z.ZodLiteral<"local">;
64
52
  visibility: z.ZodLiteral<"private">;
65
53
  conversationId: z.ZodString;
66
54
  }, z.core.$strict>, z.ZodObject<{
67
- location: z.ZodOptional<z.ZodObject<{
68
- id: z.ZodString;
69
- provider: z.ZodString;
70
- tenantId: z.ZodOptional<z.ZodString>;
71
- providerId: z.ZodString;
72
- }, z.core.$strict>>;
73
- platform: z.ZodLiteral<"web">;
55
+ kind: z.ZodLiteral<"web">;
74
56
  visibility: z.ZodEnum<{
75
57
  public: "public";
76
58
  private: "private";
77
59
  }>;
78
60
  conversationId: z.ZodString;
79
- }, z.core.$strict>], "platform">;
61
+ }, z.core.$strict>, z.ZodObject<{
62
+ kind: z.ZodLiteral<"resource_event">;
63
+ eventKey: z.ZodString;
64
+ eventType: z.ZodString;
65
+ identifier: z.ZodString;
66
+ namespace: z.ZodString;
67
+ }, z.core.$strict>], "kind">>;
80
68
  userId: z.ZodOptional<z.ZodString>;
81
69
  }, z.core.$strict>;
82
70
  export type MemoryRuntimeContext = z.output<typeof memoryRuntimeContextSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-memory",
3
- "version": "0.188.0",
3
+ "version": "0.190.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -27,7 +27,7 @@
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.188.0"
30
+ "@sentry/junior-plugin-api": "0.190.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@oxlint/plugins": "1.79.0",
package/src/agent.ts CHANGED
@@ -294,12 +294,14 @@ function actorLabel(actor: z.output<typeof actorSchema> | undefined): string {
294
294
  }
295
295
 
296
296
  function sourceLabel(source: z.output<typeof sourceSchema>): string {
297
- switch (source.platform) {
297
+ switch (source.kind) {
298
298
  case "slack":
299
299
  return `slack:${source.teamId}:${source.channelId}`;
300
300
  case "web":
301
301
  case "local":
302
- return `${source.platform}:${source.conversationId}`;
302
+ return `${source.kind}:${source.conversationId}`;
303
+ case "resource_event":
304
+ return `resource-event:${source.namespace}:${source.eventKey}`;
303
305
  }
304
306
  }
305
307
 
@@ -223,7 +223,7 @@ export async function processMemorySession(
223
223
  context: PluginTaskContext,
224
224
  ): Promise<void> {
225
225
  const run = await context.run.load();
226
- if (run.source.platform === "local") {
226
+ if (run.source.kind === "local" || run.source.kind === "resource_event") {
227
227
  return;
228
228
  }
229
229
  // Memory tool turns already own memory management or recall; do not reinterpret
package/src/scope.ts CHANGED
@@ -32,7 +32,7 @@ function privateMemoryScope(userId: string): ResolvedMemoryScope {
32
32
  export function deriveMemoryScope(
33
33
  ctx: MemoryRuntimeContext,
34
34
  ): ResolvedMemoryScope {
35
- if (ctx.source.visibility === "public") {
35
+ if ("visibility" in ctx.source && ctx.source.visibility === "public") {
36
36
  return publicMemoryScope;
37
37
  }
38
38
  if (!ctx.userId) {
package/src/store.ts CHANGED
@@ -37,6 +37,7 @@ import {
37
37
  MEMORY_KINDS,
38
38
  memoryRuntimeContextSchema,
39
39
  type MemoryRuntimeContext,
40
+ type MemorySourcePlatform,
40
41
  } from "./types";
41
42
  import {
42
43
  deriveMemoryScope,
@@ -183,6 +184,15 @@ const memoryRowSchema = z
183
184
  }
184
185
  });
185
186
 
187
+ function storedMemorySource(
188
+ source: MemoryRuntimeContext["source"],
189
+ ): MemorySourcePlatform {
190
+ if (source.kind === "resource_event") {
191
+ throw new Error("Resource event Source cannot own a Memory.");
192
+ }
193
+ return source.kind;
194
+ }
195
+
186
196
  const memoryRecordSchema = z
187
197
  .object({
188
198
  archivedAtMs: numberSchema.optional(),
@@ -772,7 +782,7 @@ async function rememberDuplicateIdempotency(args: {
772
782
  scope: args.scope.scope,
773
783
  scopeKey: args.scope.scopeKey,
774
784
  sourceKey: sourceKey(args.runtimeContext),
775
- sourcePlatform: args.runtimeContext.source.platform,
785
+ sourcePlatform: storedMemorySource(args.runtimeContext.source),
776
786
  subjectKey: args.subject.subjectKey,
777
787
  subjectType: args.subject.subjectType,
778
788
  supersededAtMs: args.nowMs,
@@ -1288,7 +1298,7 @@ export function createMemoryStore(
1288
1298
  scope: scope.scope,
1289
1299
  scopeKey: scope.scopeKey,
1290
1300
  sourceKey: sourceKey(runtimeContext),
1291
- sourcePlatform: runtimeContext.source.platform,
1301
+ sourcePlatform: storedMemorySource(runtimeContext.source),
1292
1302
  subjectKey: subject.subjectKey,
1293
1303
  subjectType: subject.subjectType,
1294
1304
  kind: input.kind,
package/src/types.ts CHANGED
@@ -9,7 +9,7 @@ export const MEMORY_SUBJECT_TYPES = [
9
9
  "conversation",
10
10
  "general",
11
11
  ] as const;
12
- // Durable attribution follows Source platform, including dashboard/web roots.
12
+ // Durable attribution follows Source kind, including dashboard roots.
13
13
  export const MEMORY_SOURCE_PLATFORMS = ["slack", "local", "web"] as const;
14
14
  export const MEMORY_EMBEDDING_METRICS = ["cosine"] as const;
15
15
  export const MEMORY_EMBEDDING_DIMENSIONS = 1536;