@sentry/junior-memory 0.147.0 → 0.148.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.
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import type { ResolvedMemoryScope } from "./scope";
3
3
  import { type MemoryDb, type MemoryRecord } from "./store";
4
+ import { type MemorySourcePlatform } from "./types";
4
5
  declare const memoryVisibilitySchema: z.ZodEnum<{
5
6
  public: "public";
6
7
  private: "private";
@@ -40,7 +41,7 @@ export interface PersonalMemoryPage {
40
41
  /** Safe provenance attached to one viewer-visible memory. */
41
42
  export type PersonalMemoryRecord = MemoryRecord & {
42
43
  origin: "automatic" | "explicit" | "other";
43
- sourcePlatform: "local" | "slack";
44
+ sourcePlatform: MemorySourcePlatform;
44
45
  visibility: MemoryVisibility;
45
46
  };
46
47
  /** Viewer-scoped active memory totals used by the dashboard. */
package/dist/store.d.ts CHANGED
@@ -80,6 +80,12 @@ export declare const memorySupersessionInputSchema: z.ZodObject<{
80
80
  fullName: z.ZodOptional<z.ZodString>;
81
81
  userId: z.ZodString;
82
82
  userName: z.ZodOptional<z.ZodString>;
83
+ }, z.core.$strict>, z.ZodObject<{
84
+ platform: z.ZodLiteral<"web">;
85
+ email: z.ZodOptional<z.ZodString>;
86
+ fullName: z.ZodOptional<z.ZodString>;
87
+ userId: z.ZodString;
88
+ userName: z.ZodOptional<z.ZodString>;
83
89
  }, z.core.$strict>, z.ZodObject<{
84
90
  platform: z.ZodLiteral<"system">;
85
91
  name: z.ZodString;
@@ -98,6 +104,13 @@ export declare const memorySupersessionInputSchema: z.ZodObject<{
98
104
  platform: z.ZodLiteral<"local">;
99
105
  visibility: z.ZodLiteral<"private">;
100
106
  conversationId: z.ZodString;
107
+ }, z.core.$strict>, z.ZodObject<{
108
+ platform: z.ZodLiteral<"web">;
109
+ visibility: z.ZodEnum<{
110
+ public: "public";
111
+ private: "private";
112
+ }>;
113
+ conversationId: z.ZodString;
101
114
  }, z.core.$strict>], "platform">;
102
115
  }, z.core.$strict>;
103
116
  }, z.core.$strict>;
package/dist/types.d.ts CHANGED
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  export declare const MEMORY_KINDS: readonly ["preference", "procedure", "knowledge"];
3
3
  export declare const MEMORY_SCOPES: readonly ["personal", "conversation"];
4
4
  export declare const MEMORY_SUBJECT_TYPES: readonly ["user", "conversation", "general"];
5
- export declare const MEMORY_SOURCE_PLATFORMS: readonly ["slack", "local"];
5
+ export declare const MEMORY_SOURCE_PLATFORMS: readonly ["slack", "local", "web"];
6
6
  export declare const MEMORY_EMBEDDING_METRICS: readonly ["cosine"];
7
7
  export declare const MEMORY_EMBEDDING_DIMENSIONS = 1536;
8
8
  export type MemoryKind = (typeof MEMORY_KINDS)[number];
@@ -26,6 +26,12 @@ export declare const memoryRuntimeContextSchema: z.ZodObject<{
26
26
  fullName: z.ZodOptional<z.ZodString>;
27
27
  userId: z.ZodString;
28
28
  userName: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$strict>, z.ZodObject<{
30
+ platform: z.ZodLiteral<"web">;
31
+ email: z.ZodOptional<z.ZodString>;
32
+ fullName: z.ZodOptional<z.ZodString>;
33
+ userId: z.ZodString;
34
+ userName: z.ZodOptional<z.ZodString>;
29
35
  }, z.core.$strict>, z.ZodObject<{
30
36
  platform: z.ZodLiteral<"system">;
31
37
  name: z.ZodString;
@@ -44,6 +50,13 @@ export declare const memoryRuntimeContextSchema: z.ZodObject<{
44
50
  platform: z.ZodLiteral<"local">;
45
51
  visibility: z.ZodLiteral<"private">;
46
52
  conversationId: z.ZodString;
53
+ }, z.core.$strict>, z.ZodObject<{
54
+ platform: z.ZodLiteral<"web">;
55
+ visibility: z.ZodEnum<{
56
+ public: "public";
57
+ private: "private";
58
+ }>;
59
+ conversationId: z.ZodString;
47
60
  }, z.core.$strict>], "platform">;
48
61
  }, z.core.$strict>;
49
62
  export type MemoryRuntimeContext = z.output<typeof memoryRuntimeContextSchema>;
@@ -0,0 +1,2 @@
1
+ ALTER TABLE "junior_memory_memories" DROP CONSTRAINT "junior_memory_memories_source_platform_check";--> statement-breakpoint
2
+ ALTER TABLE "junior_memory_memories" ADD CONSTRAINT "junior_memory_memories_source_platform_check" CHECK ("junior_memory_memories"."source_platform" IN ('slack', 'local', 'web'));
@@ -0,0 +1,409 @@
1
+ {
2
+ "id": "030f5fc1-7062-4287-bd0b-14fcfd1c6a65",
3
+ "prevId": "eeef198b-34d7-4ab8-9e1e-1a238ce8bdd5",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.junior_memory_embeddings": {
8
+ "name": "junior_memory_embeddings",
9
+ "schema": "",
10
+ "columns": {
11
+ "memory_id": {
12
+ "name": "memory_id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "provider": {
18
+ "name": "provider",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "model": {
24
+ "name": "model",
25
+ "type": "text",
26
+ "primaryKey": false,
27
+ "notNull": true
28
+ },
29
+ "dimensions": {
30
+ "name": "dimensions",
31
+ "type": "integer",
32
+ "primaryKey": false,
33
+ "notNull": true
34
+ },
35
+ "metric": {
36
+ "name": "metric",
37
+ "type": "text",
38
+ "primaryKey": false,
39
+ "notNull": true
40
+ },
41
+ "content_hash": {
42
+ "name": "content_hash",
43
+ "type": "text",
44
+ "primaryKey": false,
45
+ "notNull": true
46
+ },
47
+ "embedding": {
48
+ "name": "embedding",
49
+ "type": "vector(1536)",
50
+ "primaryKey": false,
51
+ "notNull": true
52
+ },
53
+ "created_at_ms": {
54
+ "name": "created_at_ms",
55
+ "type": "bigint",
56
+ "primaryKey": false,
57
+ "notNull": true
58
+ }
59
+ },
60
+ "indexes": {
61
+ "junior_memory_embeddings_model_idx": {
62
+ "name": "junior_memory_embeddings_model_idx",
63
+ "columns": [
64
+ {
65
+ "expression": "provider",
66
+ "isExpression": false,
67
+ "asc": true,
68
+ "nulls": "last"
69
+ },
70
+ {
71
+ "expression": "model",
72
+ "isExpression": false,
73
+ "asc": true,
74
+ "nulls": "last"
75
+ },
76
+ {
77
+ "expression": "dimensions",
78
+ "isExpression": false,
79
+ "asc": true,
80
+ "nulls": "last"
81
+ },
82
+ {
83
+ "expression": "metric",
84
+ "isExpression": false,
85
+ "asc": true,
86
+ "nulls": "last"
87
+ }
88
+ ],
89
+ "isUnique": false,
90
+ "concurrently": false,
91
+ "method": "btree",
92
+ "with": {}
93
+ },
94
+ "junior_memory_embeddings_embedding_hnsw_idx": {
95
+ "name": "junior_memory_embeddings_embedding_hnsw_idx",
96
+ "columns": [
97
+ {
98
+ "expression": "embedding",
99
+ "isExpression": false,
100
+ "asc": true,
101
+ "nulls": "last",
102
+ "opclass": "vector_cosine_ops"
103
+ }
104
+ ],
105
+ "isUnique": false,
106
+ "concurrently": false,
107
+ "method": "hnsw",
108
+ "with": {
109
+ "m": 16,
110
+ "ef_construction": 64
111
+ }
112
+ }
113
+ },
114
+ "foreignKeys": {
115
+ "junior_memory_embeddings_memory_id_junior_memory_memories_id_fk": {
116
+ "name": "junior_memory_embeddings_memory_id_junior_memory_memories_id_fk",
117
+ "tableFrom": "junior_memory_embeddings",
118
+ "tableTo": "junior_memory_memories",
119
+ "columnsFrom": [
120
+ "memory_id"
121
+ ],
122
+ "columnsTo": [
123
+ "id"
124
+ ],
125
+ "onDelete": "cascade",
126
+ "onUpdate": "no action"
127
+ }
128
+ },
129
+ "compositePrimaryKeys": {},
130
+ "uniqueConstraints": {},
131
+ "policies": {},
132
+ "checkConstraints": {
133
+ "junior_memory_embeddings_metric_check": {
134
+ "name": "junior_memory_embeddings_metric_check",
135
+ "value": "\"junior_memory_embeddings\".\"metric\" IN ('cosine')"
136
+ },
137
+ "junior_memory_embeddings_dimensions_check": {
138
+ "name": "junior_memory_embeddings_dimensions_check",
139
+ "value": "\"junior_memory_embeddings\".\"dimensions\" = 1536"
140
+ }
141
+ },
142
+ "isRLSEnabled": false
143
+ },
144
+ "public.junior_memory_memories": {
145
+ "name": "junior_memory_memories",
146
+ "schema": "",
147
+ "columns": {
148
+ "id": {
149
+ "name": "id",
150
+ "type": "text",
151
+ "primaryKey": true,
152
+ "notNull": true
153
+ },
154
+ "scope": {
155
+ "name": "scope",
156
+ "type": "text",
157
+ "primaryKey": false,
158
+ "notNull": true
159
+ },
160
+ "scope_key": {
161
+ "name": "scope_key",
162
+ "type": "text",
163
+ "primaryKey": false,
164
+ "notNull": true
165
+ },
166
+ "type": {
167
+ "name": "type",
168
+ "type": "text",
169
+ "primaryKey": false,
170
+ "notNull": true
171
+ },
172
+ "subject_type": {
173
+ "name": "subject_type",
174
+ "type": "text",
175
+ "primaryKey": false,
176
+ "notNull": true
177
+ },
178
+ "subject_key": {
179
+ "name": "subject_key",
180
+ "type": "text",
181
+ "primaryKey": false,
182
+ "notNull": false
183
+ },
184
+ "content": {
185
+ "name": "content",
186
+ "type": "text",
187
+ "primaryKey": false,
188
+ "notNull": true
189
+ },
190
+ "search_vector": {
191
+ "name": "search_vector",
192
+ "type": "tsvector",
193
+ "primaryKey": false,
194
+ "notNull": false,
195
+ "generated": {
196
+ "as": "to_tsvector('english', \"content\")",
197
+ "type": "stored"
198
+ }
199
+ },
200
+ "source_platform": {
201
+ "name": "source_platform",
202
+ "type": "text",
203
+ "primaryKey": false,
204
+ "notNull": true
205
+ },
206
+ "source_key": {
207
+ "name": "source_key",
208
+ "type": "text",
209
+ "primaryKey": false,
210
+ "notNull": true
211
+ },
212
+ "idempotency_key": {
213
+ "name": "idempotency_key",
214
+ "type": "text",
215
+ "primaryKey": false,
216
+ "notNull": false
217
+ },
218
+ "observed_at_ms": {
219
+ "name": "observed_at_ms",
220
+ "type": "bigint",
221
+ "primaryKey": false,
222
+ "notNull": true
223
+ },
224
+ "created_at_ms": {
225
+ "name": "created_at_ms",
226
+ "type": "bigint",
227
+ "primaryKey": false,
228
+ "notNull": true
229
+ },
230
+ "expires_at_ms": {
231
+ "name": "expires_at_ms",
232
+ "type": "bigint",
233
+ "primaryKey": false,
234
+ "notNull": false
235
+ },
236
+ "superseded_at_ms": {
237
+ "name": "superseded_at_ms",
238
+ "type": "bigint",
239
+ "primaryKey": false,
240
+ "notNull": false
241
+ },
242
+ "superseded_by_id": {
243
+ "name": "superseded_by_id",
244
+ "type": "text",
245
+ "primaryKey": false,
246
+ "notNull": false
247
+ },
248
+ "archived_at_ms": {
249
+ "name": "archived_at_ms",
250
+ "type": "bigint",
251
+ "primaryKey": false,
252
+ "notNull": false
253
+ },
254
+ "archive_reason": {
255
+ "name": "archive_reason",
256
+ "type": "text",
257
+ "primaryKey": false,
258
+ "notNull": false
259
+ }
260
+ },
261
+ "indexes": {
262
+ "junior_memory_memories_visible_idx": {
263
+ "name": "junior_memory_memories_visible_idx",
264
+ "columns": [
265
+ {
266
+ "expression": "scope",
267
+ "isExpression": false,
268
+ "asc": true,
269
+ "nulls": "last"
270
+ },
271
+ {
272
+ "expression": "scope_key",
273
+ "isExpression": false,
274
+ "asc": true,
275
+ "nulls": "last"
276
+ },
277
+ {
278
+ "expression": "created_at_ms",
279
+ "isExpression": false,
280
+ "asc": false,
281
+ "nulls": "last"
282
+ },
283
+ {
284
+ "expression": "id",
285
+ "isExpression": false,
286
+ "asc": true,
287
+ "nulls": "last"
288
+ }
289
+ ],
290
+ "isUnique": false,
291
+ "where": "\"junior_memory_memories\".\"archived_at_ms\" IS NULL AND \"junior_memory_memories\".\"superseded_at_ms\" IS NULL AND \"junior_memory_memories\".\"superseded_by_id\" IS NULL",
292
+ "concurrently": false,
293
+ "method": "btree",
294
+ "with": {}
295
+ },
296
+ "junior_memory_memories_expiration_idx": {
297
+ "name": "junior_memory_memories_expiration_idx",
298
+ "columns": [
299
+ {
300
+ "expression": "expires_at_ms",
301
+ "isExpression": false,
302
+ "asc": true,
303
+ "nulls": "last"
304
+ }
305
+ ],
306
+ "isUnique": false,
307
+ "where": "\"junior_memory_memories\".\"archived_at_ms\" IS NULL AND \"junior_memory_memories\".\"expires_at_ms\" IS NOT NULL",
308
+ "concurrently": false,
309
+ "method": "btree",
310
+ "with": {}
311
+ },
312
+ "junior_memory_memories_search_idx": {
313
+ "name": "junior_memory_memories_search_idx",
314
+ "columns": [
315
+ {
316
+ "expression": "scope",
317
+ "isExpression": false,
318
+ "asc": true,
319
+ "nulls": "last"
320
+ },
321
+ {
322
+ "expression": "scope_key",
323
+ "isExpression": false,
324
+ "asc": true,
325
+ "nulls": "last"
326
+ },
327
+ {
328
+ "expression": "search_vector",
329
+ "isExpression": false,
330
+ "asc": true,
331
+ "nulls": "last"
332
+ }
333
+ ],
334
+ "isUnique": false,
335
+ "where": "\"junior_memory_memories\".\"archived_at_ms\" IS NULL AND \"junior_memory_memories\".\"superseded_at_ms\" IS NULL AND \"junior_memory_memories\".\"superseded_by_id\" IS NULL",
336
+ "concurrently": false,
337
+ "method": "gin",
338
+ "with": {}
339
+ },
340
+ "junior_memory_memories_idempotency_idx": {
341
+ "name": "junior_memory_memories_idempotency_idx",
342
+ "columns": [
343
+ {
344
+ "expression": "scope",
345
+ "isExpression": false,
346
+ "asc": true,
347
+ "nulls": "last"
348
+ },
349
+ {
350
+ "expression": "scope_key",
351
+ "isExpression": false,
352
+ "asc": true,
353
+ "nulls": "last"
354
+ },
355
+ {
356
+ "expression": "idempotency_key",
357
+ "isExpression": false,
358
+ "asc": true,
359
+ "nulls": "last"
360
+ }
361
+ ],
362
+ "isUnique": true,
363
+ "where": "\"junior_memory_memories\".\"idempotency_key\" IS NOT NULL AND \"junior_memory_memories\".\"archived_at_ms\" IS NULL AND \"junior_memory_memories\".\"superseded_at_ms\" IS NULL AND \"junior_memory_memories\".\"superseded_by_id\" IS NULL",
364
+ "concurrently": false,
365
+ "method": "btree",
366
+ "with": {}
367
+ }
368
+ },
369
+ "foreignKeys": {},
370
+ "compositePrimaryKeys": {},
371
+ "uniqueConstraints": {},
372
+ "policies": {},
373
+ "checkConstraints": {
374
+ "junior_memory_memories_scope_check": {
375
+ "name": "junior_memory_memories_scope_check",
376
+ "value": "\"junior_memory_memories\".\"scope\" IN ('personal', 'conversation')"
377
+ },
378
+ "junior_memory_memories_kind_check": {
379
+ "name": "junior_memory_memories_kind_check",
380
+ "value": "\"junior_memory_memories\".\"type\" IN (\n 'preference',\n 'procedure',\n 'knowledge'\n )"
381
+ },
382
+ "junior_memory_memories_subject_type_check": {
383
+ "name": "junior_memory_memories_subject_type_check",
384
+ "value": "\"junior_memory_memories\".\"subject_type\" IN ('user', 'conversation', 'general')"
385
+ },
386
+ "junior_memory_memories_subject_key_check": {
387
+ "name": "junior_memory_memories_subject_key_check",
388
+ "value": "(\"junior_memory_memories\".\"subject_type\" = 'general' AND \"junior_memory_memories\".\"subject_key\" IS NULL) OR (\"junior_memory_memories\".\"subject_type\" IN ('user', 'conversation') AND \"junior_memory_memories\".\"subject_key\" IS NOT NULL AND length(\"junior_memory_memories\".\"subject_key\") > 0)"
389
+ },
390
+ "junior_memory_memories_source_platform_check": {
391
+ "name": "junior_memory_memories_source_platform_check",
392
+ "value": "\"junior_memory_memories\".\"source_platform\" IN ('slack', 'local', 'web')"
393
+ }
394
+ },
395
+ "isRLSEnabled": false
396
+ }
397
+ },
398
+ "enums": {},
399
+ "schemas": {},
400
+ "sequences": {},
401
+ "roles": {},
402
+ "policies": {},
403
+ "views": {},
404
+ "_meta": {
405
+ "columns": {},
406
+ "schemas": {},
407
+ "tables": {}
408
+ }
409
+ }
@@ -57,6 +57,13 @@
57
57
  "when": 1785910292191,
58
58
  "tag": "0007_military_tyger_tiger",
59
59
  "breakpoints": true
60
+ },
61
+ {
62
+ "idx": 8,
63
+ "version": "7",
64
+ "when": 1786345372977,
65
+ "tag": "0008_web_memory_source_platform",
66
+ "breakpoints": true
60
67
  }
61
68
  ]
62
- }
69
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-memory",
3
- "version": "0.147.0",
3
+ "version": "0.148.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.147.0"
30
+ "@sentry/junior-plugin-api": "0.148.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^25.9.1",
package/src/agent.ts CHANGED
@@ -1,4 +1,8 @@
1
- import { actorSchema, type PluginModel } from "@sentry/junior-plugin-api";
1
+ import {
2
+ actorSchema,
3
+ sourceSchema,
4
+ type PluginModel,
5
+ } from "@sentry/junior-plugin-api";
2
6
  import { z } from "zod";
3
7
  import {
4
8
  memorySupersessionDecisionSchema,
@@ -273,23 +277,41 @@ function escapeXml(value: string): string {
273
277
  .replaceAll(">", "&gt;");
274
278
  }
275
279
 
280
+ function actorLabel(
281
+ actor: z.output<typeof actorSchema> | undefined,
282
+ ): string {
283
+ if (!actor) {
284
+ return "none";
285
+ }
286
+ switch (actor.platform) {
287
+ case "system":
288
+ return `system:${actor.name}`;
289
+ case "slack":
290
+ return `slack:${actor.teamId}:${actor.userId}`;
291
+ case "local":
292
+ return `local:${actor.userId}`;
293
+ case "web":
294
+ return `web:${actor.userId}`;
295
+ }
296
+ }
297
+
298
+ function sourceLabel(source: z.output<typeof sourceSchema>): string {
299
+ switch (source.platform) {
300
+ case "slack":
301
+ return `slack:${source.teamId}:${source.channelId}`;
302
+ case "web":
303
+ case "local":
304
+ return `${source.platform}:${source.conversationId}`;
305
+ }
306
+ }
307
+
276
308
  function runtimeDescription(
277
309
  request: Pick<CreateMemoryRequest, "expiresAtMs" | "runtimeContext">,
278
310
  ): string {
279
311
  const runtime = request.runtimeContext;
280
- const actor =
281
- runtime.actor?.platform === "slack"
282
- ? `slack:${runtime.actor.teamId}:${runtime.actor.userId}`
283
- : runtime.actor?.platform === "local"
284
- ? `local:${runtime.actor.userId}`
285
- : "none";
286
- const source =
287
- runtime.source.platform === "slack"
288
- ? `slack:${runtime.source.teamId}:${runtime.source.channelId}`
289
- : `local:${runtime.source.conversationId}`;
290
312
  const lines = [
291
- `- actor: ${escapeXml(actor)}`,
292
- `- source: ${escapeXml(source)}`,
313
+ `- actor: ${escapeXml(actorLabel(runtime.actor))}`,
314
+ `- source: ${escapeXml(sourceLabel(runtime.source))}`,
293
315
  `- has_conversation: ${runtime.conversationId ? "true" : "false"}`,
294
316
  `- expires_at: ${
295
317
  request.expiresAtMs === undefined
@@ -389,20 +411,6 @@ function reviewPrompt(request: CreateMemoryRequest): string {
389
411
  return sections.join("\n");
390
412
  }
391
413
 
392
- function transcriptActorLabel(
393
- actor: z.output<typeof actorSchema> | undefined,
394
- ): string {
395
- if (!actor) {
396
- return "none";
397
- }
398
- if (actor.platform === "system") {
399
- return `system:${actor.name}`;
400
- }
401
- return actor.platform === "slack"
402
- ? `slack:${actor.teamId}:${actor.userId}`
403
- : `local:${actor.userId}`;
404
- }
405
-
406
414
  function runTranscriptContext(request: ExtractSessionRequest): string {
407
415
  return [
408
416
  "<run-transcript>",
@@ -416,7 +424,7 @@ function runTranscriptContext(request: ExtractSessionRequest): string {
416
424
  }
417
425
  const authority = entry.provenance?.authority ?? "context";
418
426
  const isRunActor = entry.isRunActor === true;
419
- const actor = transcriptActorLabel(entry.provenance?.actor);
427
+ const actor = actorLabel(entry.provenance?.actor);
420
428
  return [
421
429
  `<message index="${index}" role="${entry.role}" authority="${authority}" is_run_actor="${isRunActor ? "true" : "false"}" actor="${escapeXml(actor)}">`,
422
430
  escapeXml(entry.text),
package/src/api.ts CHANGED
@@ -18,6 +18,7 @@ import {
18
18
  PersonalMemoryNotFoundError,
19
19
  type PersonalMemoryRecord,
20
20
  } from "./personal";
21
+ import { MEMORY_SOURCE_PLATFORMS } from "./types";
21
22
 
22
23
  export const memoryApiSchema = z
23
24
  .object({
@@ -28,7 +29,7 @@ export const memoryApiSchema = z
28
29
  kind: z.enum(["preference", "procedure", "knowledge"]),
29
30
  observedAt: z.iso.datetime(),
30
31
  origin: z.enum(["automatic", "explicit", "other"]),
31
- sourcePlatform: z.enum(["local", "slack"]),
32
+ sourcePlatform: z.enum(MEMORY_SOURCE_PLATFORMS),
32
33
  visibility: z.enum(["private", "public"]),
33
34
  })
34
35
  .strict();
package/src/db/schema.ts CHANGED
@@ -100,7 +100,7 @@ export const juniorMemoryMemories = pgTable(
100
100
  ),
101
101
  check(
102
102
  "junior_memory_memories_source_platform_check",
103
- sql`${table.sourcePlatform} IN ('slack', 'local')`,
103
+ sql`${table.sourcePlatform} IN ('slack', 'local', 'web')`,
104
104
  ),
105
105
  ],
106
106
  );
@@ -15,7 +15,7 @@ import {
15
15
  type MemoryDb,
16
16
  type MemoryRecord,
17
17
  } from "./store";
18
- import { MEMORY_KINDS } from "./types";
18
+ import { MEMORY_KINDS, type MemorySourcePlatform } from "./types";
19
19
 
20
20
  const nonEmptyStringSchema = z.string().min(1);
21
21
  const memoryVisibilitySchema = z.enum(["private", "public"]);
@@ -58,7 +58,7 @@ export interface PersonalMemoryPage {
58
58
  /** Safe provenance attached to one viewer-visible memory. */
59
59
  export type PersonalMemoryRecord = MemoryRecord & {
60
60
  origin: "automatic" | "explicit" | "other";
61
- sourcePlatform: "local" | "slack";
61
+ sourcePlatform: MemorySourcePlatform;
62
62
  visibility: MemoryVisibility;
63
63
  };
64
64