@sentry/junior-memory 0.189.0 → 0.191.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,8 +91,8 @@ 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.ZodPipe<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
98
  visibility: z.ZodEnum<{
@@ -101,90 +101,24 @@ export declare const memorySupersessionInputSchema: z.ZodObject<{
101
101
  }>;
102
102
  messageTs: z.ZodOptional<z.ZodString>;
103
103
  threadTs: z.ZodOptional<z.ZodString>;
104
- location: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
105
- id: z.ZodString;
106
- provider: z.ZodLiteral<"slack">;
107
- teamId: z.ZodString;
108
- channelId: z.ZodString;
109
- threadTs: z.ZodOptional<z.ZodString>;
110
- }, z.core.$strict>], "provider">>;
111
104
  }, z.core.$strict>, z.ZodObject<{
112
- platform: z.ZodLiteral<"local">;
105
+ kind: z.ZodLiteral<"local">;
113
106
  visibility: z.ZodLiteral<"private">;
114
107
  conversationId: z.ZodString;
115
- location: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
116
- id: z.ZodString;
117
- provider: z.ZodLiteral<"slack">;
118
- teamId: z.ZodString;
119
- channelId: z.ZodString;
120
- threadTs: z.ZodOptional<z.ZodString>;
121
- }, z.core.$strict>], "provider">>;
122
108
  }, z.core.$strict>, z.ZodObject<{
123
- platform: z.ZodLiteral<"web">;
109
+ kind: z.ZodLiteral<"web">;
124
110
  visibility: z.ZodEnum<{
125
111
  public: "public";
126
112
  private: "private";
127
113
  }>;
128
114
  conversationId: z.ZodString;
129
- location: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
130
- id: z.ZodString;
131
- provider: z.ZodLiteral<"slack">;
132
- teamId: z.ZodString;
133
- channelId: z.ZodString;
134
- threadTs: z.ZodOptional<z.ZodString>;
135
- }, z.core.$strict>], "provider">>;
136
- }, z.core.$strict>], "platform">, z.ZodTransform<{
137
- platform: "slack";
138
- teamId: string;
139
- channelId: string;
140
- visibility: "public" | "private";
141
- messageTs?: string | undefined;
142
- threadTs?: string | undefined;
143
- } | {
144
- platform: "local";
145
- visibility: "private";
146
- conversationId: string;
147
- } | {
148
- platform: "web";
149
- visibility: "public" | "private";
150
- conversationId: string;
151
- }, {
152
- platform: "slack";
153
- teamId: string;
154
- channelId: string;
155
- visibility: "public" | "private";
156
- messageTs?: string | undefined;
157
- threadTs?: string | undefined;
158
- location?: {
159
- id: string;
160
- provider: "slack";
161
- teamId: string;
162
- channelId: string;
163
- threadTs?: string | undefined;
164
- } | undefined;
165
- } | {
166
- platform: "local";
167
- visibility: "private";
168
- conversationId: string;
169
- location?: {
170
- id: string;
171
- provider: "slack";
172
- teamId: string;
173
- channelId: string;
174
- threadTs?: string | undefined;
175
- } | undefined;
176
- } | {
177
- platform: "web";
178
- visibility: "public" | "private";
179
- conversationId: string;
180
- location?: {
181
- id: string;
182
- provider: "slack";
183
- teamId: string;
184
- channelId: string;
185
- threadTs?: string | undefined;
186
- } | undefined;
187
- }>>;
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">, unknown>;
188
122
  userId: z.ZodOptional<z.ZodString>;
189
123
  }, z.core.$strict>;
190
124
  }, z.core.$strict>;
package/dist/types.d.ts CHANGED
@@ -37,8 +37,8 @@ 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.ZodPipe<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
44
  visibility: z.ZodEnum<{
@@ -47,90 +47,24 @@ export declare const memoryRuntimeContextSchema: z.ZodObject<{
47
47
  }>;
48
48
  messageTs: z.ZodOptional<z.ZodString>;
49
49
  threadTs: z.ZodOptional<z.ZodString>;
50
- location: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
51
- id: z.ZodString;
52
- provider: z.ZodLiteral<"slack">;
53
- teamId: z.ZodString;
54
- channelId: z.ZodString;
55
- threadTs: z.ZodOptional<z.ZodString>;
56
- }, z.core.$strict>], "provider">>;
57
50
  }, z.core.$strict>, z.ZodObject<{
58
- platform: z.ZodLiteral<"local">;
51
+ kind: z.ZodLiteral<"local">;
59
52
  visibility: z.ZodLiteral<"private">;
60
53
  conversationId: z.ZodString;
61
- location: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
62
- id: z.ZodString;
63
- provider: z.ZodLiteral<"slack">;
64
- teamId: z.ZodString;
65
- channelId: z.ZodString;
66
- threadTs: z.ZodOptional<z.ZodString>;
67
- }, z.core.$strict>], "provider">>;
68
54
  }, z.core.$strict>, z.ZodObject<{
69
- platform: z.ZodLiteral<"web">;
55
+ kind: z.ZodLiteral<"web">;
70
56
  visibility: z.ZodEnum<{
71
57
  public: "public";
72
58
  private: "private";
73
59
  }>;
74
60
  conversationId: z.ZodString;
75
- location: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
76
- id: z.ZodString;
77
- provider: z.ZodLiteral<"slack">;
78
- teamId: z.ZodString;
79
- channelId: z.ZodString;
80
- threadTs: z.ZodOptional<z.ZodString>;
81
- }, z.core.$strict>], "provider">>;
82
- }, z.core.$strict>], "platform">, z.ZodTransform<{
83
- platform: "slack";
84
- teamId: string;
85
- channelId: string;
86
- visibility: "public" | "private";
87
- messageTs?: string | undefined;
88
- threadTs?: string | undefined;
89
- } | {
90
- platform: "local";
91
- visibility: "private";
92
- conversationId: string;
93
- } | {
94
- platform: "web";
95
- visibility: "public" | "private";
96
- conversationId: string;
97
- }, {
98
- platform: "slack";
99
- teamId: string;
100
- channelId: string;
101
- visibility: "public" | "private";
102
- messageTs?: string | undefined;
103
- threadTs?: string | undefined;
104
- location?: {
105
- id: string;
106
- provider: "slack";
107
- teamId: string;
108
- channelId: string;
109
- threadTs?: string | undefined;
110
- } | undefined;
111
- } | {
112
- platform: "local";
113
- visibility: "private";
114
- conversationId: string;
115
- location?: {
116
- id: string;
117
- provider: "slack";
118
- teamId: string;
119
- channelId: string;
120
- threadTs?: string | undefined;
121
- } | undefined;
122
- } | {
123
- platform: "web";
124
- visibility: "public" | "private";
125
- conversationId: string;
126
- location?: {
127
- id: string;
128
- provider: "slack";
129
- teamId: string;
130
- channelId: string;
131
- threadTs?: string | undefined;
132
- } | undefined;
133
- }>>;
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">, unknown>;
134
68
  userId: z.ZodOptional<z.ZodString>;
135
69
  }, z.core.$strict>;
136
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.189.0",
3
+ "version": "0.191.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -26,8 +26,8 @@
26
26
  "@sinclair/typebox": "^0.34.49",
27
27
  "commander": "^14.0.3",
28
28
  "drizzle-orm": "^0.45.2",
29
- "zod": "^4.4.3",
30
- "@sentry/junior-plugin-api": "0.189.0"
29
+ "zod": "^4.5.4",
30
+ "@sentry/junior-plugin-api": "0.191.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;