@sentry/junior-memory 0.124.1 → 0.125.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/README.md CHANGED
@@ -15,7 +15,9 @@ exported types, tools, and tests are authoritative.
15
15
  inspection.
16
16
  - The dashboard exposes a searchable, paginated **Memories** user page for
17
17
  personal memories owned by actors linked to the signed-in viewer. Its
18
- **Forget** action archives the selected memory.
18
+ **Forget** action archives the selected memory. The overview charts global
19
+ passive-extraction cost from the durable `memory/memories_captured` events;
20
+ the System plugin report uses the same event-cost feed.
19
21
  - Authenticated REST clients can list and search personal memories through
20
22
  `GET /api/plugins/memory/memories`, read one through
21
23
  `GET /api/plugins/memory/memories/:id`, and archive one through
@@ -55,6 +57,10 @@ exported types, tools, and tests are authoritative.
55
57
  learning.
56
58
  - Passive extraction creates only durable, reusable facts—not transient tasks,
57
59
  conversation summaries, secrets, or speculative interpretation.
60
+ - Every completed passive extraction emits the namespaced
61
+ `memory/memories_captured` conversation event with its best-effort model cost.
62
+ Empty extraction outcomes remain durable for reporting but do not produce a
63
+ transcript row.
58
64
  - Candidate review resolves duplicates and supersession before activation.
59
65
  - Search combines independently ranked vector and PostgreSQL full-text matches
60
66
  with reciprocal rank fusion; provider-specific raw scores are never added
@@ -62,6 +68,10 @@ exported types, tools, and tests are authoritative.
62
68
  - Automatic recall retrieves a broad candidate window, then uses the
63
69
  memory-owned relevance model to admit at most five directly useful memories.
64
70
  An empty result contributes no filler prompt text.
71
+ - Every completed automatic recall attempt emits an invisible, namespaced
72
+ `memory/memories_recalled` conversation event with the admitted memory IDs
73
+ and best-effort embedding and relevance-model cost, including retrievals that
74
+ find no candidates and decisions that admit no memories.
65
75
  - Automatic recall degrades to no prompt contribution when relevance selection
66
76
  fails. Review, extraction, and write failures still fail their owning
67
77
  hook/task without corrupting existing memory state.
package/dist/agent.d.ts CHANGED
@@ -183,12 +183,22 @@ export type MemoryRecallInput = z.output<typeof memoryRecallInputSchema>;
183
183
  export type CreateMemoryRequest = z.output<typeof createMemoryRequestSchema>;
184
184
  export type ExtractSessionRequest = z.output<typeof extractSessionRequestSchema>;
185
185
  export type ExtractedMemory = z.output<typeof extractedMemoryResultSchema>;
186
+ /** Memories proposed by passive extraction and the model cost of that pass. */
187
+ export type MemoryExtractionResult = {
188
+ costUsd?: number;
189
+ memories: ExtractedMemory[];
190
+ };
191
+ /** Memories admitted by automatic recall and the model cost of that decision. */
192
+ export type MemoryRecallResult = {
193
+ costUsd?: number;
194
+ relevantIds: string[];
195
+ };
186
196
  export interface MemoryAgent {
187
197
  /** Select candidate memories that directly help with the current request. */
188
- selectRelevantMemories(request: MemoryRecallInput): Promise<string[]> | string[];
198
+ selectRelevantMemories(request: MemoryRecallInput): Promise<MemoryRecallResult> | MemoryRecallResult;
189
199
  /** Classify a new preference against related active preferences. */
190
200
  adjudicateSupersession(request: MemorySupersessionInput): Promise<MemorySupersessionDecision> | MemorySupersessionDecision;
191
- extractSessionMemories(request: ExtractSessionRequest): Promise<ExtractedMemory[]> | ExtractedMemory[];
201
+ extractSessionMemories(request: ExtractSessionRequest): Promise<MemoryExtractionResult> | MemoryExtractionResult;
192
202
  reviewCreateRequest(request: CreateMemoryRequest): Promise<MemoryReview> | MemoryReview;
193
203
  }
194
204
  /** Create the memory-owned agent that reviews, extracts, and recalls memories. */
package/dist/api.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  /**
2
- * Authenticated REST resources for personal memories.
2
+ * Authenticated REST resources for viewer-visible memories.
3
3
  *
4
4
  * HTTP identity is one verified viewer. Linked platform actors are resolved
5
- * behind the route boundary and used only to authorize personal scopes.
5
+ * behind the route boundary and used only to authorize personal and public
6
+ * workspace scopes.
6
7
  */
7
8
  import { z } from "zod";
8
- import { type PluginRouteApp, type PluginUserPageActor } from "@sentry/junior-plugin-api";
9
+ import { type PluginConversationEventStats, type PluginRouteApp, type PluginUserPageActor } from "@sentry/junior-plugin-api";
9
10
  import type { MemoryDb } from "./store";
10
11
  export declare const memoryApiSchema: z.ZodObject<{
11
12
  content: z.ZodString;
@@ -18,6 +19,10 @@ export declare const memoryApiSchema: z.ZodObject<{
18
19
  knowledge: "knowledge";
19
20
  }>;
20
21
  observedAt: z.ZodISODateTime;
22
+ visibility: z.ZodEnum<{
23
+ public: "public";
24
+ private: "private";
25
+ }>;
21
26
  }, z.core.$strict>;
22
27
  export declare const memoryListResponseSchema: z.ZodObject<{
23
28
  memories: z.ZodArray<z.ZodObject<{
@@ -31,15 +36,23 @@ export declare const memoryListResponseSchema: z.ZodObject<{
31
36
  knowledge: "knowledge";
32
37
  }>;
33
38
  observedAt: z.ZodISODateTime;
39
+ visibility: z.ZodEnum<{
40
+ public: "public";
41
+ private: "private";
42
+ }>;
34
43
  }, z.core.$strict>>;
35
44
  nextCursor: z.ZodOptional<z.ZodString>;
36
45
  }, z.core.$strict>;
37
46
  export declare const memoryDashboardResponseSchema: z.ZodObject<{
38
47
  days: z.ZodArray<z.ZodObject<{
39
48
  date: z.ZodISODate;
40
- knowledge: z.ZodNumber;
41
- preference: z.ZodNumber;
42
- procedure: z.ZodNumber;
49
+ personal: z.ZodNumber;
50
+ public: z.ZodNumber;
51
+ }, z.core.$strict>>;
52
+ extractionDays: z.ZodArray<z.ZodObject<{
53
+ costUsd: z.ZodNumber;
54
+ date: z.ZodISODate;
55
+ events: z.ZodNumber;
43
56
  }, z.core.$strict>>;
44
57
  generatedAt: z.ZodISODateTime;
45
58
  stats: z.ZodObject<{
@@ -49,8 +62,10 @@ export declare const memoryDashboardResponseSchema: z.ZodObject<{
49
62
  embedded: z.ZodNumber;
50
63
  explicit: z.ZodNumber;
51
64
  knowledge: z.ZodNumber;
65
+ personal: z.ZodNumber;
52
66
  preference: z.ZodNumber;
53
67
  procedure: z.ZodNumber;
68
+ public: z.ZodNumber;
54
69
  }, z.core.$strict>;
55
70
  }, z.core.$strict>;
56
71
  export type MemoryApi = z.output<typeof memoryApiSchema>;
@@ -59,7 +74,8 @@ export type MemoryListResponse = z.output<typeof memoryListResponseSchema>;
59
74
  interface MemoryApiOptions {
60
75
  actors(email: string): Promise<PluginUserPageActor[]>;
61
76
  db: MemoryDb;
77
+ eventStats: PluginConversationEventStats;
62
78
  }
63
- /** Create the authenticated personal-memory REST app. */
79
+ /** Create the authenticated viewer-memory REST app. */
64
80
  export declare function createMemoryApi(options: MemoryApiOptions): PluginRouteApp;
65
81
  export {};
package/dist/events.d.ts CHANGED
@@ -1,5 +1,15 @@
1
1
  import type { MemoryRecord } from "./store";
2
- /** Durable transcript event emitted after background memory capture. */
2
+ /** Previous stored memory-capture event shape retained for transcript rendering. */
3
+ export declare const memoriesCapturedEventV1: import("@sentry/junior-plugin-api").DefinedConversationEvent<{
4
+ memories: {
5
+ content: string;
6
+ id: string;
7
+ kind: "preference" | "procedure" | "knowledge";
8
+ observedAtMs: number;
9
+ scope: "personal" | "conversation";
10
+ }[];
11
+ }>;
12
+ /** Durable outcome emitted after every completed passive memory extraction. */
3
13
  export declare const memoriesCapturedEvent: import("@sentry/junior-plugin-api").DefinedConversationEvent<{
4
14
  memories: {
5
15
  content: string;
@@ -8,6 +18,12 @@ export declare const memoriesCapturedEvent: import("@sentry/junior-plugin-api").
8
18
  observedAtMs: number;
9
19
  scope: "personal" | "conversation";
10
20
  }[];
21
+ costUsd?: number | undefined;
22
+ }>;
23
+ /** Durable outcome emitted after one completed automatic recall attempt. */
24
+ export declare const memoriesRecalledEvent: import("@sentry/junior-plugin-api").DefinedConversationEvent<{
25
+ memories: string[];
26
+ costUsd?: number | undefined;
11
27
  }>;
12
28
  /** Select the stable, safe memory fields retained in conversation history. */
13
29
  export declare function capturedMemory(memory: MemoryRecord): {