@sentry/junior-memory 0.118.0 → 0.120.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
@@ -13,13 +13,22 @@ exported types, tools, and tests are authoritative.
13
13
  learning.
14
14
  - The `memory` CLI namespace provides explicit administrative search and
15
15
  inspection.
16
- - The dashboard exposes a read-only **Memories** user page for personal
17
- memories owned by actors linked to the signed-in user.
16
+ - The dashboard exposes a searchable, paginated **Memories** user page for
17
+ personal memories owned by actors linked to the signed-in viewer. Its
18
+ **Forget** action archives the selected memory.
19
+ - Authenticated REST clients can list and search personal memories through
20
+ `GET /api/plugins/memory/memories`, read one through
21
+ `GET /api/plugins/memory/memories/:id`, and archive one through
22
+ `DELETE /api/plugins/memory/memories/:id`. Personal bearer tokens remain
23
+ read-only, so mutations require a dashboard browser session.
18
24
 
19
25
  ## Scope And Visibility
20
26
 
21
27
  - Memory scope is derived from the active actor and source, never from
22
28
  model-supplied ownership fields.
29
+ - Dashboard and REST requests authorize one verified viewer, then resolve every
30
+ linked platform actor internally so one arbitrary actor is never treated as
31
+ the viewer's canonical identity.
23
32
  - Private conversations and local sources remain private by default.
24
33
  - Recall filters candidates by actor, source, visibility, status, and relevance
25
34
  before content reaches the model.
@@ -34,6 +43,8 @@ exported types, tools, and tests are authoritative.
34
43
  - Records retain provenance, lifecycle status, supersession relationships, and
35
44
  timestamps needed for review and deletion.
36
45
  - Embeddings are derived indexes, not independent memory authority.
46
+ - Embedding distance never decides that two memories are duplicates. Exact
47
+ content and preference review own duplicate and supersession decisions.
37
48
  - Writes are idempotent where a completed session or tool retry can repeat.
38
49
  - Removal and supersession preserve enough lifecycle information to prevent
39
50
  deleted facts from being recalled or silently recreated.
@@ -45,14 +56,19 @@ exported types, tools, and tests are authoritative.
45
56
  - Passive extraction creates only durable, reusable facts—not transient tasks,
46
57
  conversation summaries, secrets, or speculative interpretation.
47
58
  - Candidate review resolves duplicates and supersession before activation.
48
- - Recall is bounded and relevance-ranked; an empty result contributes no filler
49
- prompt text.
50
- - Model or embedding failures fail the owning hook/task without corrupting
51
- existing memory state.
59
+ - Search combines independently ranked vector and PostgreSQL full-text matches
60
+ with reciprocal rank fusion; provider-specific raw scores are never added
61
+ together.
62
+ - Automatic recall retrieves a broad candidate window, then uses the
63
+ memory-owned relevance model to admit at most five directly useful memories.
64
+ An empty result contributes no filler prompt text.
65
+ - Automatic recall degrades to no prompt contribution when relevance selection
66
+ fails. Review, extraction, and write failures still fail their owning
67
+ hook/task without corrupting existing memory state.
52
68
 
53
69
  ## Configuration
54
70
 
55
- - `AI_MEMORY_MODEL` or `createMemoryPlugin({ modelId })` selects the structured
71
+ - `AI_MEMORY_MODEL` or `memoryPlugin({ modelId })` selects the structured
56
72
  review model.
57
73
  - `MEMORY_RECALL_MAX_VECTOR_DISTANCE` or
58
74
  `recallMaxVectorDistance` configures the vector candidate threshold.
package/dist/agent.d.ts CHANGED
@@ -1,6 +1,13 @@
1
1
  import { type PluginModel } from "@sentry/junior-plugin-api";
2
2
  import { z } from "zod";
3
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>;
4
11
  declare const createMemoryRequestSchema: z.ZodObject<{
5
12
  content: z.ZodString;
6
13
  expiresAtMs: z.ZodOptional<z.ZodNumber>;
@@ -172,16 +179,19 @@ declare const extractedMemoryResultSchema: z.ZodObject<{
172
179
  evidenceMessageIndices: z.ZodArray<z.ZodNumber>;
173
180
  }, z.core.$strict>;
174
181
  export type MemoryReview = z.output<typeof memoryReviewDecisionSchema>;
182
+ export type MemoryRecallInput = z.output<typeof memoryRecallInputSchema>;
175
183
  export type CreateMemoryRequest = z.output<typeof createMemoryRequestSchema>;
176
184
  export type ExtractSessionRequest = z.output<typeof extractSessionRequestSchema>;
177
185
  export type ExtractedMemory = z.output<typeof extractedMemoryResultSchema>;
178
186
  export interface MemoryAgent {
187
+ /** Select candidate memories that directly help with the current request. */
188
+ selectRelevantMemories(request: MemoryRecallInput): Promise<string[]> | string[];
179
189
  /** Classify a new preference against related active preferences. */
180
190
  adjudicateSupersession(request: MemorySupersessionInput): Promise<MemorySupersessionDecision> | MemorySupersessionDecision;
181
191
  extractSessionMemories(request: ExtractSessionRequest): Promise<ExtractedMemory[]> | ExtractedMemory[];
182
192
  reviewCreateRequest(request: CreateMemoryRequest): Promise<MemoryReview> | MemoryReview;
183
193
  }
184
- /** Create the memory-owned agent that reviews and extracts memory candidates. */
194
+ /** Create the memory-owned agent that reviews, extracts, and recalls memories. */
185
195
  export declare function createMemoryAgent(model: PluginModel): MemoryAgent;
186
196
  /** Parse the canonical extracted-memory shape stored across task retries. */
187
197
  export declare function parseExtractedMemory(memory: unknown): ExtractedMemory;
package/dist/api.d.ts ADDED
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Authenticated REST resources for personal memories.
3
+ *
4
+ * HTTP identity is one verified viewer. Linked platform actors are resolved
5
+ * behind the route boundary and used only to authorize personal scopes.
6
+ */
7
+ import { z } from "zod";
8
+ import { type PluginRouteApp, type PluginUserPageActor } from "@sentry/junior-plugin-api";
9
+ import type { MemoryDb } from "./store";
10
+ export declare const memoryApiSchema: z.ZodObject<{
11
+ content: z.ZodString;
12
+ createdAt: z.ZodISODateTime;
13
+ expiresAt: z.ZodOptional<z.ZodISODateTime>;
14
+ id: z.ZodString;
15
+ kind: z.ZodEnum<{
16
+ preference: "preference";
17
+ procedure: "procedure";
18
+ knowledge: "knowledge";
19
+ }>;
20
+ observedAt: z.ZodISODateTime;
21
+ }, z.core.$strict>;
22
+ export declare const memoryListResponseSchema: z.ZodObject<{
23
+ memories: z.ZodArray<z.ZodObject<{
24
+ content: z.ZodString;
25
+ createdAt: z.ZodISODateTime;
26
+ expiresAt: z.ZodOptional<z.ZodISODateTime>;
27
+ id: z.ZodString;
28
+ kind: z.ZodEnum<{
29
+ preference: "preference";
30
+ procedure: "procedure";
31
+ knowledge: "knowledge";
32
+ }>;
33
+ observedAt: z.ZodISODateTime;
34
+ }, z.core.$strict>>;
35
+ nextCursor: z.ZodOptional<z.ZodString>;
36
+ }, z.core.$strict>;
37
+ export type MemoryApi = z.output<typeof memoryApiSchema>;
38
+ export type MemoryListResponse = z.output<typeof memoryListResponseSchema>;
39
+ interface MemoryApiOptions {
40
+ actors(email: string): Promise<PluginUserPageActor[]>;
41
+ db: MemoryDb;
42
+ }
43
+ /** Create the authenticated personal-memory REST app. */
44
+ export declare function createMemoryApi(options: MemoryApiOptions): PluginRouteApp;
45
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- export { createMemoryPlugin, memoryPlugin } from "./plugin";
1
+ export { memoryPlugin } from "./plugin";
2
+ export { memoryApiSchema, memoryListResponseSchema, type MemoryApi, type MemoryListResponse, } from "./api";
2
3
  export type { MemoryPluginOptions } from "./plugin";
3
4
  export { createMemoryStore } from "./store";
4
5
  export type { ArchiveMemoryInput, CreateMemoryInput, CreateMemoryResult, ListMemoriesInput, MemoryDb, MemoryEmbeddingProvider, MemoryRecord, MemoryStore, MemoryStoreOptions, SearchMemoriesInput, } from "./store";