@sentry/junior-memory 0.76.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/LICENSE +201 -0
- package/dist/agent.d.ts +144 -0
- package/dist/cli/format.d.ts +5 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/search.d.ts +4 -0
- package/dist/cli/show.d.ts +4 -0
- package/dist/db/schema.d.ts +441 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1773 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +6 -0
- package/dist/process-session.d.ts +10 -0
- package/dist/recall.d.ts +12 -0
- package/dist/scope.d.ts +17 -0
- package/dist/store.d.ts +93 -0
- package/dist/tools.d.ts +103 -0
- package/dist/types.d.ts +89 -0
- package/migrations/0000_dizzy_millenium_guard.sql +37 -0
- package/migrations/0001_closed_madrox.sql +2 -0
- package/migrations/0002_light_silver_centurion.sql +17 -0
- package/migrations/meta/0000_snapshot.json +234 -0
- package/migrations/meta/0001_snapshot.json +234 -0
- package/migrations/meta/0002_snapshot.json +348 -0
- package/migrations/meta/_journal.json +27 -0
- package/package.json +48 -0
- package/src/agent.ts +437 -0
- package/src/cli/format.ts +30 -0
- package/src/cli/index.ts +15 -0
- package/src/cli/search.ts +119 -0
- package/src/cli/show.ts +44 -0
- package/src/db/schema.ts +130 -0
- package/src/index.ts +16 -0
- package/src/plugin.ts +103 -0
- package/src/process-session.ts +151 -0
- package/src/recall.ts +81 -0
- package/src/scope.ts +99 -0
- package/src/store.ts +761 -0
- package/src/tools.ts +487 -0
- package/src/types.ts +66 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "9e9985ce-7ac3-4872-97f3-e4a4d3fe39c9",
|
|
3
|
+
"prevId": "aef16541-5bbe-4c1b-867d-a19c841cb278",
|
|
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
|
+
},
|
|
95
|
+
"foreignKeys": {
|
|
96
|
+
"junior_memory_embeddings_memory_id_junior_memory_memories_id_fk": {
|
|
97
|
+
"name": "junior_memory_embeddings_memory_id_junior_memory_memories_id_fk",
|
|
98
|
+
"tableFrom": "junior_memory_embeddings",
|
|
99
|
+
"tableTo": "junior_memory_memories",
|
|
100
|
+
"columnsFrom": ["memory_id"],
|
|
101
|
+
"columnsTo": ["id"],
|
|
102
|
+
"onDelete": "cascade",
|
|
103
|
+
"onUpdate": "no action"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"compositePrimaryKeys": {},
|
|
107
|
+
"uniqueConstraints": {},
|
|
108
|
+
"policies": {},
|
|
109
|
+
"checkConstraints": {
|
|
110
|
+
"junior_memory_embeddings_metric_check": {
|
|
111
|
+
"name": "junior_memory_embeddings_metric_check",
|
|
112
|
+
"value": "\"junior_memory_embeddings\".\"metric\" IN ('cosine')"
|
|
113
|
+
},
|
|
114
|
+
"junior_memory_embeddings_dimensions_check": {
|
|
115
|
+
"name": "junior_memory_embeddings_dimensions_check",
|
|
116
|
+
"value": "\"junior_memory_embeddings\".\"dimensions\" = 1536"
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"isRLSEnabled": false
|
|
120
|
+
},
|
|
121
|
+
"public.junior_memory_memories": {
|
|
122
|
+
"name": "junior_memory_memories",
|
|
123
|
+
"schema": "",
|
|
124
|
+
"columns": {
|
|
125
|
+
"id": {
|
|
126
|
+
"name": "id",
|
|
127
|
+
"type": "text",
|
|
128
|
+
"primaryKey": true,
|
|
129
|
+
"notNull": true
|
|
130
|
+
},
|
|
131
|
+
"scope": {
|
|
132
|
+
"name": "scope",
|
|
133
|
+
"type": "text",
|
|
134
|
+
"primaryKey": false,
|
|
135
|
+
"notNull": true
|
|
136
|
+
},
|
|
137
|
+
"scope_key": {
|
|
138
|
+
"name": "scope_key",
|
|
139
|
+
"type": "text",
|
|
140
|
+
"primaryKey": false,
|
|
141
|
+
"notNull": true
|
|
142
|
+
},
|
|
143
|
+
"type": {
|
|
144
|
+
"name": "type",
|
|
145
|
+
"type": "text",
|
|
146
|
+
"primaryKey": false,
|
|
147
|
+
"notNull": true
|
|
148
|
+
},
|
|
149
|
+
"subject_type": {
|
|
150
|
+
"name": "subject_type",
|
|
151
|
+
"type": "text",
|
|
152
|
+
"primaryKey": false,
|
|
153
|
+
"notNull": true
|
|
154
|
+
},
|
|
155
|
+
"subject_key": {
|
|
156
|
+
"name": "subject_key",
|
|
157
|
+
"type": "text",
|
|
158
|
+
"primaryKey": false,
|
|
159
|
+
"notNull": false
|
|
160
|
+
},
|
|
161
|
+
"content": {
|
|
162
|
+
"name": "content",
|
|
163
|
+
"type": "text",
|
|
164
|
+
"primaryKey": false,
|
|
165
|
+
"notNull": true
|
|
166
|
+
},
|
|
167
|
+
"source_platform": {
|
|
168
|
+
"name": "source_platform",
|
|
169
|
+
"type": "text",
|
|
170
|
+
"primaryKey": false,
|
|
171
|
+
"notNull": true
|
|
172
|
+
},
|
|
173
|
+
"source_key": {
|
|
174
|
+
"name": "source_key",
|
|
175
|
+
"type": "text",
|
|
176
|
+
"primaryKey": false,
|
|
177
|
+
"notNull": true
|
|
178
|
+
},
|
|
179
|
+
"idempotency_key": {
|
|
180
|
+
"name": "idempotency_key",
|
|
181
|
+
"type": "text",
|
|
182
|
+
"primaryKey": false,
|
|
183
|
+
"notNull": false
|
|
184
|
+
},
|
|
185
|
+
"observed_at_ms": {
|
|
186
|
+
"name": "observed_at_ms",
|
|
187
|
+
"type": "bigint",
|
|
188
|
+
"primaryKey": false,
|
|
189
|
+
"notNull": true
|
|
190
|
+
},
|
|
191
|
+
"created_at_ms": {
|
|
192
|
+
"name": "created_at_ms",
|
|
193
|
+
"type": "bigint",
|
|
194
|
+
"primaryKey": false,
|
|
195
|
+
"notNull": true
|
|
196
|
+
},
|
|
197
|
+
"expires_at_ms": {
|
|
198
|
+
"name": "expires_at_ms",
|
|
199
|
+
"type": "bigint",
|
|
200
|
+
"primaryKey": false,
|
|
201
|
+
"notNull": false
|
|
202
|
+
},
|
|
203
|
+
"superseded_at_ms": {
|
|
204
|
+
"name": "superseded_at_ms",
|
|
205
|
+
"type": "bigint",
|
|
206
|
+
"primaryKey": false,
|
|
207
|
+
"notNull": false
|
|
208
|
+
},
|
|
209
|
+
"superseded_by_id": {
|
|
210
|
+
"name": "superseded_by_id",
|
|
211
|
+
"type": "text",
|
|
212
|
+
"primaryKey": false,
|
|
213
|
+
"notNull": false
|
|
214
|
+
},
|
|
215
|
+
"archived_at_ms": {
|
|
216
|
+
"name": "archived_at_ms",
|
|
217
|
+
"type": "bigint",
|
|
218
|
+
"primaryKey": false,
|
|
219
|
+
"notNull": false
|
|
220
|
+
},
|
|
221
|
+
"archive_reason": {
|
|
222
|
+
"name": "archive_reason",
|
|
223
|
+
"type": "text",
|
|
224
|
+
"primaryKey": false,
|
|
225
|
+
"notNull": false
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
"indexes": {
|
|
229
|
+
"junior_memory_memories_visible_idx": {
|
|
230
|
+
"name": "junior_memory_memories_visible_idx",
|
|
231
|
+
"columns": [
|
|
232
|
+
{
|
|
233
|
+
"expression": "scope",
|
|
234
|
+
"isExpression": false,
|
|
235
|
+
"asc": true,
|
|
236
|
+
"nulls": "last"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"expression": "scope_key",
|
|
240
|
+
"isExpression": false,
|
|
241
|
+
"asc": true,
|
|
242
|
+
"nulls": "last"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"expression": "created_at_ms",
|
|
246
|
+
"isExpression": false,
|
|
247
|
+
"asc": false,
|
|
248
|
+
"nulls": "last"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"expression": "id",
|
|
252
|
+
"isExpression": false,
|
|
253
|
+
"asc": true,
|
|
254
|
+
"nulls": "last"
|
|
255
|
+
}
|
|
256
|
+
],
|
|
257
|
+
"isUnique": false,
|
|
258
|
+
"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",
|
|
259
|
+
"concurrently": false,
|
|
260
|
+
"method": "btree",
|
|
261
|
+
"with": {}
|
|
262
|
+
},
|
|
263
|
+
"junior_memory_memories_expiration_idx": {
|
|
264
|
+
"name": "junior_memory_memories_expiration_idx",
|
|
265
|
+
"columns": [
|
|
266
|
+
{
|
|
267
|
+
"expression": "expires_at_ms",
|
|
268
|
+
"isExpression": false,
|
|
269
|
+
"asc": true,
|
|
270
|
+
"nulls": "last"
|
|
271
|
+
}
|
|
272
|
+
],
|
|
273
|
+
"isUnique": false,
|
|
274
|
+
"where": "\"junior_memory_memories\".\"archived_at_ms\" IS NULL AND \"junior_memory_memories\".\"expires_at_ms\" IS NOT NULL",
|
|
275
|
+
"concurrently": false,
|
|
276
|
+
"method": "btree",
|
|
277
|
+
"with": {}
|
|
278
|
+
},
|
|
279
|
+
"junior_memory_memories_idempotency_idx": {
|
|
280
|
+
"name": "junior_memory_memories_idempotency_idx",
|
|
281
|
+
"columns": [
|
|
282
|
+
{
|
|
283
|
+
"expression": "scope",
|
|
284
|
+
"isExpression": false,
|
|
285
|
+
"asc": true,
|
|
286
|
+
"nulls": "last"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"expression": "scope_key",
|
|
290
|
+
"isExpression": false,
|
|
291
|
+
"asc": true,
|
|
292
|
+
"nulls": "last"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"expression": "idempotency_key",
|
|
296
|
+
"isExpression": false,
|
|
297
|
+
"asc": true,
|
|
298
|
+
"nulls": "last"
|
|
299
|
+
}
|
|
300
|
+
],
|
|
301
|
+
"isUnique": true,
|
|
302
|
+
"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",
|
|
303
|
+
"concurrently": false,
|
|
304
|
+
"method": "btree",
|
|
305
|
+
"with": {}
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
"foreignKeys": {},
|
|
309
|
+
"compositePrimaryKeys": {},
|
|
310
|
+
"uniqueConstraints": {},
|
|
311
|
+
"policies": {},
|
|
312
|
+
"checkConstraints": {
|
|
313
|
+
"junior_memory_memories_scope_check": {
|
|
314
|
+
"name": "junior_memory_memories_scope_check",
|
|
315
|
+
"value": "\"junior_memory_memories\".\"scope\" IN ('personal', 'conversation')"
|
|
316
|
+
},
|
|
317
|
+
"junior_memory_memories_type_check": {
|
|
318
|
+
"name": "junior_memory_memories_type_check",
|
|
319
|
+
"value": "\"junior_memory_memories\".\"type\" IN (\n 'preference',\n 'identity',\n 'relationship',\n 'knowledge',\n 'context',\n 'event',\n 'task',\n 'observation'\n )"
|
|
320
|
+
},
|
|
321
|
+
"junior_memory_memories_subject_type_check": {
|
|
322
|
+
"name": "junior_memory_memories_subject_type_check",
|
|
323
|
+
"value": "\"junior_memory_memories\".\"subject_type\" IN ('user', 'conversation', 'general')"
|
|
324
|
+
},
|
|
325
|
+
"junior_memory_memories_subject_key_check": {
|
|
326
|
+
"name": "junior_memory_memories_subject_key_check",
|
|
327
|
+
"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)"
|
|
328
|
+
},
|
|
329
|
+
"junior_memory_memories_source_platform_check": {
|
|
330
|
+
"name": "junior_memory_memories_source_platform_check",
|
|
331
|
+
"value": "\"junior_memory_memories\".\"source_platform\" IN ('slack', 'local')"
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
"isRLSEnabled": false
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
"enums": {},
|
|
338
|
+
"schemas": {},
|
|
339
|
+
"sequences": {},
|
|
340
|
+
"roles": {},
|
|
341
|
+
"policies": {},
|
|
342
|
+
"views": {},
|
|
343
|
+
"_meta": {
|
|
344
|
+
"columns": {},
|
|
345
|
+
"schemas": {},
|
|
346
|
+
"tables": {}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "7",
|
|
3
|
+
"dialect": "postgresql",
|
|
4
|
+
"entries": [
|
|
5
|
+
{
|
|
6
|
+
"idx": 0,
|
|
7
|
+
"version": "7",
|
|
8
|
+
"when": 1781976138405,
|
|
9
|
+
"tag": "0000_dizzy_millenium_guard",
|
|
10
|
+
"breakpoints": true
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"idx": 1,
|
|
14
|
+
"version": "7",
|
|
15
|
+
"when": 1782149964214,
|
|
16
|
+
"tag": "0001_closed_madrox",
|
|
17
|
+
"breakpoints": true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"idx": 2,
|
|
21
|
+
"version": "7",
|
|
22
|
+
"when": 1782158974888,
|
|
23
|
+
"tag": "0002_light_silver_centurion",
|
|
24
|
+
"breakpoints": true
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sentry/junior-memory",
|
|
3
|
+
"version": "0.76.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/getsentry/junior.git",
|
|
12
|
+
"directory": "packages/junior-memory"
|
|
13
|
+
},
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./src/index.ts",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"migrations",
|
|
23
|
+
"src"
|
|
24
|
+
],
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@sinclair/typebox": "^0.34.49",
|
|
27
|
+
"commander": "^14.0.3",
|
|
28
|
+
"drizzle-orm": "^0.45.2",
|
|
29
|
+
"zod": "^4.4.3",
|
|
30
|
+
"@sentry/junior-plugin-api": "0.76.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "^25.9.1",
|
|
34
|
+
"drizzle-kit": "^0.31.8",
|
|
35
|
+
"oxlint": "^1.66.0",
|
|
36
|
+
"tsup": "^8.5.1",
|
|
37
|
+
"typescript": "^6.0.3",
|
|
38
|
+
"vitest": "^4.1.7",
|
|
39
|
+
"@sentry/junior-testing": "0.0.0"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",
|
|
43
|
+
"db:generate": "pnpm exec drizzle-kit generate --config drizzle.config.ts",
|
|
44
|
+
"lint": "oxlint --config ../junior/.oxlintrc.json --deny-warnings src tests tsup.config.ts",
|
|
45
|
+
"test": "vitest run",
|
|
46
|
+
"typecheck": "tsc --noEmit"
|
|
47
|
+
}
|
|
48
|
+
}
|