@sentry/junior-memory 0.198.0 → 0.199.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.198.0",
3
+ "version": "0.199.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -13,21 +13,20 @@
13
13
  },
14
14
  "exports": {
15
15
  ".": {
16
- "types": "./src/index.ts",
16
+ "types": "./dist/index.d.ts",
17
17
  "default": "./dist/index.js"
18
18
  }
19
19
  },
20
20
  "files": [
21
21
  "dist",
22
- "migrations",
23
- "src"
22
+ "migrations"
24
23
  ],
25
24
  "dependencies": {
26
25
  "@sinclair/typebox": "^0.34.49",
27
26
  "commander": "^14.0.3",
28
27
  "drizzle-orm": "^0.45.2",
29
28
  "zod": "^4.5.4",
30
- "@sentry/junior-plugin-api": "0.198.0"
29
+ "@sentry/junior-plugin-api": "0.199.0"
31
30
  },
32
31
  "devDependencies": {
33
32
  "@oxlint/plugins": "1.79.0",
@@ -40,7 +39,7 @@
40
39
  "@sentry/junior-testing": "0.0.0"
41
40
  },
42
41
  "scripts": {
43
- "build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",
42
+ "build": "tsup",
44
43
  "db:generate": "pnpm exec drizzle-kit generate --config drizzle.config.ts",
45
44
  "lint": "oxlint --config ../junior/.oxlintrc.json --deny-warnings src tests tsup.config.ts",
46
45
  "test": "vitest run",
package/dist/agent.d.ts DELETED
@@ -1,280 +0,0 @@
1
- import { type PluginModel } from "@sentry/junior-plugin-api";
2
- import { z } from "zod";
3
- import { type MemorySupersessionDecision, type MemorySupersessionInput } from "./store";
4
- declare const memoryRecallInputSchema: z.ZodObject<{
5
- candidates: z.ZodArray<z.ZodObject<{
6
- content: z.ZodString;
7
- id: z.ZodString;
8
- }, z.core.$strict>>;
9
- userRequest: z.ZodString;
10
- }, z.core.$strict>;
11
- declare const createMemoryRequestSchema: z.ZodObject<{
12
- content: z.ZodString;
13
- expiresAtMs: z.ZodOptional<z.ZodNumber>;
14
- runtimeContext: z.ZodObject<{
15
- conversationId: z.ZodOptional<z.ZodString>;
16
- locationId: z.ZodOptional<z.ZodString>;
17
- actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
18
- platform: z.ZodLiteral<"slack">;
19
- teamId: z.ZodString;
20
- email: z.ZodOptional<z.ZodString>;
21
- fullName: z.ZodOptional<z.ZodString>;
22
- userId: z.ZodString;
23
- userName: z.ZodOptional<z.ZodString>;
24
- }, z.core.$strict>, z.ZodObject<{
25
- platform: z.ZodLiteral<"local">;
26
- email: z.ZodOptional<z.ZodString>;
27
- fullName: z.ZodOptional<z.ZodString>;
28
- userId: z.ZodString;
29
- userName: z.ZodOptional<z.ZodString>;
30
- }, z.core.$strict>, z.ZodObject<{
31
- platform: z.ZodLiteral<"web">;
32
- email: z.ZodOptional<z.ZodString>;
33
- fullName: z.ZodOptional<z.ZodString>;
34
- userId: z.ZodString;
35
- userName: z.ZodOptional<z.ZodString>;
36
- }, z.core.$strict>, z.ZodObject<{
37
- platform: z.ZodLiteral<"system">;
38
- name: z.ZodString;
39
- }, z.core.$strict>], "platform">>;
40
- source: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
41
- kind: z.ZodLiteral<"slack">;
42
- teamId: z.ZodString;
43
- channelId: z.ZodString;
44
- visibility: z.ZodEnum<{
45
- public: "public";
46
- private: "private";
47
- }>;
48
- messageTs: z.ZodOptional<z.ZodString>;
49
- threadTs: z.ZodOptional<z.ZodString>;
50
- }, z.core.$strict>, z.ZodObject<{
51
- kind: z.ZodLiteral<"local">;
52
- visibility: z.ZodLiteral<"private">;
53
- conversationId: z.ZodString;
54
- }, z.core.$strict>, z.ZodObject<{
55
- kind: z.ZodLiteral<"web">;
56
- visibility: z.ZodEnum<{
57
- public: "public";
58
- private: "private";
59
- }>;
60
- conversationId: z.ZodString;
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>, z.ZodObject<{
68
- kind: z.ZodLiteral<"scheduled_task">;
69
- }, z.core.$strict>, z.ZodObject<{
70
- kind: z.ZodLiteral<"event_task">;
71
- }, z.core.$strict>, z.ZodObject<{
72
- kind: z.ZodLiteral<"plugin_dispatch">;
73
- }, z.core.$strict>, z.ZodObject<{
74
- kind: z.ZodLiteral<"agent_invocation">;
75
- }, z.core.$strict>], "kind">, unknown>;
76
- userId: z.ZodOptional<z.ZodString>;
77
- }, z.core.$strict>;
78
- sourceContext: z.ZodOptional<z.ZodObject<{
79
- currentUserText: z.ZodOptional<z.ZodString>;
80
- }, z.core.$strict>>;
81
- }, z.core.$strict>;
82
- declare const extractSessionRequestSchema: z.ZodObject<{
83
- existingMemories: z.ZodDefault<z.ZodArray<z.ZodObject<{
84
- content: z.ZodString;
85
- }, z.core.$strict>>>;
86
- actors: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
87
- platform: z.ZodLiteral<"slack">;
88
- teamId: z.ZodString;
89
- email: z.ZodOptional<z.ZodString>;
90
- fullName: z.ZodOptional<z.ZodString>;
91
- userId: z.ZodString;
92
- userName: z.ZodOptional<z.ZodString>;
93
- }, z.core.$strict>, z.ZodObject<{
94
- platform: z.ZodLiteral<"local">;
95
- email: z.ZodOptional<z.ZodString>;
96
- fullName: z.ZodOptional<z.ZodString>;
97
- userId: z.ZodString;
98
- userName: z.ZodOptional<z.ZodString>;
99
- }, z.core.$strict>, z.ZodObject<{
100
- platform: z.ZodLiteral<"web">;
101
- email: z.ZodOptional<z.ZodString>;
102
- fullName: z.ZodOptional<z.ZodString>;
103
- userId: z.ZodString;
104
- userName: z.ZodOptional<z.ZodString>;
105
- }, z.core.$strict>, z.ZodObject<{
106
- platform: z.ZodLiteral<"system">;
107
- name: z.ZodString;
108
- }, z.core.$strict>], "platform">>;
109
- runtimeContext: z.ZodObject<{
110
- conversationId: z.ZodOptional<z.ZodString>;
111
- locationId: z.ZodOptional<z.ZodString>;
112
- actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
113
- platform: z.ZodLiteral<"slack">;
114
- teamId: z.ZodString;
115
- email: z.ZodOptional<z.ZodString>;
116
- fullName: z.ZodOptional<z.ZodString>;
117
- userId: z.ZodString;
118
- userName: z.ZodOptional<z.ZodString>;
119
- }, z.core.$strict>, z.ZodObject<{
120
- platform: z.ZodLiteral<"local">;
121
- email: z.ZodOptional<z.ZodString>;
122
- fullName: z.ZodOptional<z.ZodString>;
123
- userId: z.ZodString;
124
- userName: z.ZodOptional<z.ZodString>;
125
- }, z.core.$strict>, z.ZodObject<{
126
- platform: z.ZodLiteral<"web">;
127
- email: z.ZodOptional<z.ZodString>;
128
- fullName: z.ZodOptional<z.ZodString>;
129
- userId: z.ZodString;
130
- userName: z.ZodOptional<z.ZodString>;
131
- }, z.core.$strict>, z.ZodObject<{
132
- platform: z.ZodLiteral<"system">;
133
- name: z.ZodString;
134
- }, z.core.$strict>], "platform">>;
135
- source: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
136
- kind: z.ZodLiteral<"slack">;
137
- teamId: z.ZodString;
138
- channelId: z.ZodString;
139
- visibility: z.ZodEnum<{
140
- public: "public";
141
- private: "private";
142
- }>;
143
- messageTs: z.ZodOptional<z.ZodString>;
144
- threadTs: z.ZodOptional<z.ZodString>;
145
- }, z.core.$strict>, z.ZodObject<{
146
- kind: z.ZodLiteral<"local">;
147
- visibility: z.ZodLiteral<"private">;
148
- conversationId: z.ZodString;
149
- }, z.core.$strict>, z.ZodObject<{
150
- kind: z.ZodLiteral<"web">;
151
- visibility: z.ZodEnum<{
152
- public: "public";
153
- private: "private";
154
- }>;
155
- conversationId: z.ZodString;
156
- }, z.core.$strict>, z.ZodObject<{
157
- kind: z.ZodLiteral<"resource_event">;
158
- eventKey: z.ZodString;
159
- eventType: z.ZodString;
160
- identifier: z.ZodString;
161
- namespace: z.ZodString;
162
- }, z.core.$strict>, z.ZodObject<{
163
- kind: z.ZodLiteral<"scheduled_task">;
164
- }, z.core.$strict>, z.ZodObject<{
165
- kind: z.ZodLiteral<"event_task">;
166
- }, z.core.$strict>, z.ZodObject<{
167
- kind: z.ZodLiteral<"plugin_dispatch">;
168
- }, z.core.$strict>, z.ZodObject<{
169
- kind: z.ZodLiteral<"agent_invocation">;
170
- }, z.core.$strict>], "kind">, unknown>;
171
- userId: z.ZodOptional<z.ZodString>;
172
- }, z.core.$strict>;
173
- transcript: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
174
- type: z.ZodLiteral<"message">;
175
- role: z.ZodEnum<{
176
- user: "user";
177
- assistant: "assistant";
178
- }>;
179
- text: z.ZodString;
180
- provenance: z.ZodOptional<z.ZodObject<{
181
- authority: z.ZodEnum<{
182
- instruction: "instruction";
183
- context: "context";
184
- }>;
185
- actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
186
- platform: z.ZodLiteral<"slack">;
187
- teamId: z.ZodString;
188
- email: z.ZodOptional<z.ZodString>;
189
- fullName: z.ZodOptional<z.ZodString>;
190
- userId: z.ZodString;
191
- userName: z.ZodOptional<z.ZodString>;
192
- }, z.core.$strict>, z.ZodObject<{
193
- platform: z.ZodLiteral<"local">;
194
- email: z.ZodOptional<z.ZodString>;
195
- fullName: z.ZodOptional<z.ZodString>;
196
- userId: z.ZodString;
197
- userName: z.ZodOptional<z.ZodString>;
198
- }, z.core.$strict>, z.ZodObject<{
199
- platform: z.ZodLiteral<"web">;
200
- email: z.ZodOptional<z.ZodString>;
201
- fullName: z.ZodOptional<z.ZodString>;
202
- userId: z.ZodString;
203
- userName: z.ZodOptional<z.ZodString>;
204
- }, z.core.$strict>, z.ZodObject<{
205
- platform: z.ZodLiteral<"system">;
206
- name: z.ZodString;
207
- }, z.core.$strict>], "platform">>;
208
- }, z.core.$strict>>;
209
- isRunActor: z.ZodOptional<z.ZodBoolean>;
210
- }, z.core.$strict>, z.ZodObject<{
211
- type: z.ZodLiteral<"toolResult">;
212
- toolName: z.ZodString;
213
- isError: z.ZodBoolean;
214
- text: z.ZodString;
215
- }, z.core.$strict>], "type">>;
216
- }, z.core.$strict>;
217
- declare const memoryReviewDecisionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
218
- decision: z.ZodLiteral<"store">;
219
- kind: z.ZodEnum<{
220
- preference: "preference";
221
- procedure: "procedure";
222
- knowledge: "knowledge";
223
- }>;
224
- content: z.ZodString;
225
- expiresAtMs: z.ZodOptional<z.ZodNumber>;
226
- }, z.core.$strict>, z.ZodObject<{
227
- decision: z.ZodLiteral<"reject">;
228
- reason: z.ZodEnum<{
229
- not_public_shareable: "not_public_shareable";
230
- secret_or_credential: "secret_or_credential";
231
- sensitive_personal: "sensitive_personal";
232
- third_party_personal: "third_party_personal";
233
- vague_or_not_self_contained: "vague_or_not_self_contained";
234
- not_durable: "not_durable";
235
- assistant_or_system_detail: "assistant_or_system_detail";
236
- unsupported_scope: "unsupported_scope";
237
- }>;
238
- }, z.core.$strict>], "decision">;
239
- declare const extractedMemoryResultSchema: z.ZodObject<{
240
- content: z.ZodString;
241
- expiresAtMs: z.ZodNullable<z.ZodNumber>;
242
- kind: z.ZodEnum<{
243
- preference: "preference";
244
- procedure: "procedure";
245
- knowledge: "knowledge";
246
- }>;
247
- evidenceMessageIndices: z.ZodArray<z.ZodNumber>;
248
- }, z.core.$strict>;
249
- export type MemoryReview = z.output<typeof memoryReviewDecisionSchema>;
250
- export type MemoryRecallInput = z.output<typeof memoryRecallInputSchema>;
251
- export type CreateMemoryRequest = z.output<typeof createMemoryRequestSchema>;
252
- export type ExtractSessionRequest = z.output<typeof extractSessionRequestSchema>;
253
- export type ExtractedMemory = z.output<typeof extractedMemoryResultSchema>;
254
- /** Memories proposed by passive extraction and the model cost of that pass. */
255
- export type MemoryExtractionResult = {
256
- costUsd?: number;
257
- memories: ExtractedMemory[];
258
- };
259
- /** Memories admitted by automatic recall and the model cost of that decision. */
260
- export type MemoryRecallResult = {
261
- costUsd?: number;
262
- relevantIds: string[];
263
- };
264
- export interface MemoryAgent {
265
- /** Select candidate memories that directly help with the current request. */
266
- selectRelevantMemories(request: MemoryRecallInput): Promise<MemoryRecallResult> | MemoryRecallResult;
267
- /** Classify a new preference against related active preferences. */
268
- adjudicateSupersession(request: MemorySupersessionInput): Promise<MemorySupersessionDecision> | MemorySupersessionDecision;
269
- extractSessionMemories(request: ExtractSessionRequest): Promise<MemoryExtractionResult> | MemoryExtractionResult;
270
- reviewCreateRequest(request: CreateMemoryRequest): Promise<MemoryReview> | MemoryReview;
271
- }
272
- /** Create the memory-owned agent that reviews, extracts, and recalls memories. */
273
- export declare function createMemoryAgent(model: PluginModel): MemoryAgent;
274
- /** Parse the canonical extracted-memory shape stored across task retries. */
275
- export declare function parseExtractedMemory(memory: unknown): ExtractedMemory;
276
- /** Parse the structured decision returned by the memory agent. */
277
- export declare function parseMemoryReview(result: unknown): MemoryReview;
278
- /** Parse the structured input sent to the memory agent. */
279
- export declare function parseCreateMemoryRequest(request: unknown): CreateMemoryRequest;
280
- export {};
package/dist/api.d.ts DELETED
@@ -1,121 +0,0 @@
1
- /**
2
- * Authenticated REST access to memory.
3
- *
4
- * The signed-in User can read public memory and private memory that they own.
5
- */
6
- import { z } from "zod";
7
- import { type PluginConversationEventStats, type PluginRouteApp, type User } from "@sentry/junior-plugin-api";
8
- import type { MemoryDb } from "./store";
9
- export declare const memoryApiSchema: z.ZodObject<{
10
- content: z.ZodString;
11
- createdAt: z.ZodISODateTime;
12
- expiresAt: z.ZodOptional<z.ZodISODateTime>;
13
- id: z.ZodString;
14
- kind: z.ZodEnum<{
15
- preference: "preference";
16
- procedure: "procedure";
17
- knowledge: "knowledge";
18
- }>;
19
- observedAt: z.ZodISODateTime;
20
- origin: z.ZodEnum<{
21
- automatic: "automatic";
22
- explicit: "explicit";
23
- other: "other";
24
- }>;
25
- sourcePlatform: z.ZodEnum<{
26
- slack: "slack";
27
- local: "local";
28
- web: "web";
29
- }>;
30
- visibility: z.ZodEnum<{
31
- public: "public";
32
- private: "private";
33
- }>;
34
- }, z.core.$strict>;
35
- export declare const memoryListResponseSchema: z.ZodObject<{
36
- memories: z.ZodArray<z.ZodObject<{
37
- content: z.ZodString;
38
- createdAt: z.ZodISODateTime;
39
- expiresAt: z.ZodOptional<z.ZodISODateTime>;
40
- id: z.ZodString;
41
- kind: z.ZodEnum<{
42
- preference: "preference";
43
- procedure: "procedure";
44
- knowledge: "knowledge";
45
- }>;
46
- observedAt: z.ZodISODateTime;
47
- origin: z.ZodEnum<{
48
- automatic: "automatic";
49
- explicit: "explicit";
50
- other: "other";
51
- }>;
52
- sourcePlatform: z.ZodEnum<{
53
- slack: "slack";
54
- local: "local";
55
- web: "web";
56
- }>;
57
- visibility: z.ZodEnum<{
58
- public: "public";
59
- private: "private";
60
- }>;
61
- }, z.core.$strict>>;
62
- nextCursor: z.ZodOptional<z.ZodString>;
63
- }, z.core.$strict>;
64
- export declare const memoryDashboardResponseSchema: z.ZodObject<{
65
- days: z.ZodArray<z.ZodObject<{
66
- date: z.ZodString;
67
- personal: z.ZodNumber;
68
- public: z.ZodNumber;
69
- }, z.core.$strict>>;
70
- extractionDays: z.ZodArray<z.ZodObject<{
71
- costUsd: z.ZodNumber;
72
- date: z.ZodString;
73
- events: z.ZodNumber;
74
- }, z.core.$strict>>;
75
- extractionHours: z.ZodOptional<z.ZodArray<z.ZodObject<{
76
- costUsd: z.ZodNumber;
77
- date: z.ZodString;
78
- events: z.ZodNumber;
79
- }, z.core.$strict>>>;
80
- generatedAt: z.ZodISODateTime;
81
- hours: z.ZodOptional<z.ZodArray<z.ZodObject<{
82
- date: z.ZodString;
83
- personal: z.ZodNumber;
84
- public: z.ZodNumber;
85
- }, z.core.$strict>>>;
86
- recallDays: z.ZodArray<z.ZodObject<{
87
- costUsd: z.ZodNumber;
88
- date: z.ZodString;
89
- events: z.ZodNumber;
90
- }, z.core.$strict>>;
91
- recallHours: z.ZodOptional<z.ZodArray<z.ZodObject<{
92
- costUsd: z.ZodNumber;
93
- date: z.ZodString;
94
- events: z.ZodNumber;
95
- }, z.core.$strict>>>;
96
- stats: z.ZodObject<{
97
- active: z.ZodNumber;
98
- automatic: z.ZodNumber;
99
- createdThirtyDays: z.ZodNumber;
100
- embedded: z.ZodNumber;
101
- explicit: z.ZodNumber;
102
- knowledge: z.ZodNumber;
103
- personal: z.ZodNumber;
104
- preference: z.ZodNumber;
105
- procedure: z.ZodNumber;
106
- public: z.ZodNumber;
107
- }, z.core.$strict>;
108
- }, z.core.$strict>;
109
- export type MemoryApi = z.output<typeof memoryApiSchema>;
110
- export type MemoryDashboardResponse = z.output<typeof memoryDashboardResponseSchema>;
111
- export type MemoryListResponse = z.output<typeof memoryListResponseSchema>;
112
- interface MemoryApiOptions {
113
- db: MemoryDb;
114
- eventStats: PluginConversationEventStats;
115
- users: {
116
- resolve(email: string): Promise<User | undefined>;
117
- };
118
- }
119
- /** Create the authenticated memory REST app. */
120
- export declare function createMemoryApi(options: MemoryApiOptions): PluginRouteApp;
121
- export {};
@@ -1,5 +0,0 @@
1
- import type { juniorMemoryMemories } from "../db/schema";
2
- /** Format a memory row as an operator-safe CLI projection. */
3
- export declare function formatMemory(row: typeof juniorMemoryMemories.$inferSelect, args: {
4
- showContent: boolean;
5
- }): string;
@@ -1,3 +0,0 @@
1
- import type { PluginCliCommandDefinition } from "@sentry/junior-plugin-api";
2
- /** Create the plugin-owned memory admin CLI command. */
3
- export declare function createMemoryCliCommand(): PluginCliCommandDefinition;
@@ -1,4 +0,0 @@
1
- import { type Command } from "commander";
2
- import type { PluginCliHost } from "@sentry/junior-plugin-api";
3
- /** Wire the memory search admin subcommand under the plugin namespace. */
4
- export declare function configureMemorySearchCommand(parent: Command, junior: PluginCliHost): void;
@@ -1,4 +0,0 @@
1
- import type { Command } from "commander";
2
- import type { PluginCliHost } from "@sentry/junior-plugin-api";
3
- /** Wire the explicit raw-content memory inspection subcommand. */
4
- export declare function configureMemoryShowCommand(parent: Command, junior: PluginCliHost): void;