@sentry/junior-memory 0.180.0 → 0.181.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 +25 -24
- package/dist/agent.d.ts +4 -0
- package/dist/api.d.ts +3 -4
- package/dist/db/schema.d.ts +19 -2
- package/dist/events.d.ts +3 -3
- package/dist/index.js +487 -666
- package/dist/index.js.map +1 -1
- package/dist/process-session.d.ts +3 -4
- package/dist/ranking.d.ts +0 -2
- package/dist/recall.d.ts +9 -2
- package/dist/scope.d.ts +11 -15
- package/dist/store.d.ts +6 -7
- package/dist/tools.d.ts +8 -1
- package/dist/types.d.ts +4 -2
- package/dist/user-pages.d.ts +1 -1
- package/dist/viewer.d.ts +85 -0
- package/migrations/0009_faithful_whizzer.sql +114 -0
- package/migrations/meta/0009_snapshot.json +411 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +2 -2
- package/src/agent.ts +6 -8
- package/src/api.ts +33 -24
- package/src/db/schema.ts +3 -1
- package/src/events.ts +30 -8
- package/src/operational-report.ts +20 -20
- package/src/plugin.ts +13 -1
- package/src/process-session.ts +21 -35
- package/src/ranking.ts +9 -26
- package/src/recall.ts +11 -1
- package/src/scope.ts +34 -135
- package/src/store.ts +34 -91
- package/src/tools.ts +30 -14
- package/src/types.ts +5 -2
- package/src/user-pages.ts +4 -6
- package/src/viewer.ts +393 -0
- package/dist/personal-store.d.ts +0 -92
- package/dist/personal.d.ts +0 -31
- package/src/personal-store.ts +0 -421
- package/src/personal.ts +0 -140
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @sentry/junior-memory
|
|
2
2
|
|
|
3
|
-
The memory plugin stores durable
|
|
3
|
+
The memory plugin stores durable facts, recalls relevant facts
|
|
4
4
|
into prompts, and learns candidates from completed sessions. SQL schemas,
|
|
5
5
|
exported types, tools, and tests are authoritative.
|
|
6
6
|
|
|
@@ -13,27 +13,29 @@ 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 searchable, paginated **Memories** user page
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- Authenticated REST clients can list and search
|
|
16
|
+
- The dashboard exposes a searchable, paginated **Memories** user page. It
|
|
17
|
+
includes public memory and private memory owned by the authenticated user.
|
|
18
|
+
The overview charts global passive-extraction cost from the durable
|
|
19
|
+
`memory/memories_captured` events. The System plugin report uses the same
|
|
20
|
+
event-cost feed.
|
|
21
|
+
- Authenticated REST clients can list and search authorized memories through
|
|
22
22
|
`GET /api/plugins/memory/memories`, read one through
|
|
23
|
-
`GET /api/plugins/memory/memories/:id`, and
|
|
24
|
-
`DELETE /api/plugins/memory/memories/:id`.
|
|
25
|
-
read-only
|
|
23
|
+
`GET /api/plugins/memory/memories/:id`, and forget an authorized private
|
|
24
|
+
memory through `DELETE /api/plugins/memory/memories/:id`. Public memory is
|
|
25
|
+
read-only in the dashboard and REST API.
|
|
26
26
|
|
|
27
27
|
## Scope And Visibility
|
|
28
28
|
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
|
|
29
|
+
- The Source sets memory visibility. Model output cannot set it.
|
|
30
|
+
- Public memory is visible everywhere.
|
|
31
|
+
- Private memory belongs to one User. Every Identity linked to that User can
|
|
32
|
+
access it.
|
|
33
|
+
- Junior records the optional Location where it learned a memory. Location is
|
|
34
|
+
a record of where Junior learned it. It does not grant access.
|
|
35
|
+
- The subject says what a memory is about. It does not set access. A user
|
|
36
|
+
preference can be public or private based on its Source.
|
|
37
|
+
- Recall filters candidates by visibility, status, and relevance before content
|
|
38
|
+
reaches the model.
|
|
37
39
|
- Administrative reads require explicit selectors and safe output defaults.
|
|
38
40
|
- Memory content, embeddings, source excerpts, and review prompts must not be
|
|
39
41
|
logged or traced.
|
|
@@ -71,13 +73,12 @@ exported types, tools, and tests are authoritative.
|
|
|
71
73
|
and slightly prefers lexical ranks so exact tokens survive soft semantic
|
|
72
74
|
neighbors. Vector recall also applies the cosine distance cutoff in SQL, and
|
|
73
75
|
embeddings use an HNSW cosine index (`vector_cosine_ops`).
|
|
74
|
-
- Automatic recall also
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
score ties, personal-scope matches rank ahead of conversation matches.
|
|
76
|
+
- Automatic recall also searches private memory by itself. This keeps newer
|
|
77
|
+
public memory with common words from hiding older private memory. On equal
|
|
78
|
+
RRF scores, private memory ranks first.
|
|
78
79
|
- Automatic recall retrieves a bounded candidate window, then uses the
|
|
79
|
-
memory
|
|
80
|
-
|
|
80
|
+
memory relevance model and prompt limit to select useful memories. An empty
|
|
81
|
+
result adds no prompt text.
|
|
81
82
|
- Every completed automatic recall attempt emits an invisible, namespaced
|
|
82
83
|
`memory/memories_recalled` conversation event with the admitted memory IDs
|
|
83
84
|
and best-effort embedding and relevance-model cost, including retrievals that
|
package/dist/agent.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ declare const createMemoryRequestSchema: z.ZodObject<{
|
|
|
13
13
|
expiresAtMs: z.ZodOptional<z.ZodNumber>;
|
|
14
14
|
runtimeContext: z.ZodObject<{
|
|
15
15
|
conversationId: z.ZodOptional<z.ZodString>;
|
|
16
|
+
locationId: z.ZodOptional<z.ZodString>;
|
|
16
17
|
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
17
18
|
platform: z.ZodLiteral<"slack">;
|
|
18
19
|
teamId: z.ZodString;
|
|
@@ -58,6 +59,7 @@ declare const createMemoryRequestSchema: z.ZodObject<{
|
|
|
58
59
|
}>;
|
|
59
60
|
conversationId: z.ZodString;
|
|
60
61
|
}, z.core.$strict>], "platform">;
|
|
62
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
61
63
|
}, z.core.$strict>;
|
|
62
64
|
sourceContext: z.ZodOptional<z.ZodObject<{
|
|
63
65
|
currentUserText: z.ZodOptional<z.ZodString>;
|
|
@@ -92,6 +94,7 @@ declare const extractSessionRequestSchema: z.ZodObject<{
|
|
|
92
94
|
}, z.core.$strict>], "platform">>;
|
|
93
95
|
runtimeContext: z.ZodObject<{
|
|
94
96
|
conversationId: z.ZodOptional<z.ZodString>;
|
|
97
|
+
locationId: z.ZodOptional<z.ZodString>;
|
|
95
98
|
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
96
99
|
platform: z.ZodLiteral<"slack">;
|
|
97
100
|
teamId: z.ZodString;
|
|
@@ -137,6 +140,7 @@ declare const extractSessionRequestSchema: z.ZodObject<{
|
|
|
137
140
|
}>;
|
|
138
141
|
conversationId: z.ZodString;
|
|
139
142
|
}, z.core.$strict>], "platform">;
|
|
143
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
140
144
|
}, z.core.$strict>;
|
|
141
145
|
transcript: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
142
146
|
type: z.ZodLiteral<"message">;
|
package/dist/api.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Authenticated REST
|
|
2
|
+
* Authenticated REST access to memory.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* personal and public workspace scopes.
|
|
4
|
+
* The signed-in User can read public memory and private memory that they own.
|
|
6
5
|
*/
|
|
7
6
|
import { z } from "zod";
|
|
8
7
|
import { type PluginConversationEventStats, type PluginRouteApp, type User } from "@sentry/junior-plugin-api";
|
|
@@ -102,6 +101,6 @@ interface MemoryApiOptions {
|
|
|
102
101
|
resolve(email: string): Promise<User | undefined>;
|
|
103
102
|
};
|
|
104
103
|
}
|
|
105
|
-
/** Create the authenticated
|
|
104
|
+
/** Create the authenticated memory REST app. */
|
|
106
105
|
export declare function createMemoryApi(options: MemoryApiOptions): PluginRouteApp;
|
|
107
106
|
export {};
|
package/dist/db/schema.d.ts
CHANGED
|
@@ -24,14 +24,14 @@ export declare const juniorMemoryMemories: import("drizzle-orm/pg-core").PgTable
|
|
|
24
24
|
tableName: "junior_memory_memories";
|
|
25
25
|
dataType: "string";
|
|
26
26
|
columnType: "PgText";
|
|
27
|
-
data: "
|
|
27
|
+
data: "public" | "private";
|
|
28
28
|
driverParam: string;
|
|
29
29
|
notNull: true;
|
|
30
30
|
hasDefault: false;
|
|
31
31
|
isPrimaryKey: false;
|
|
32
32
|
isAutoincrement: false;
|
|
33
33
|
hasRuntimeDefault: false;
|
|
34
|
-
enumValues: ["
|
|
34
|
+
enumValues: ["private", "public"];
|
|
35
35
|
baseColumn: never;
|
|
36
36
|
identity: undefined;
|
|
37
37
|
generated: undefined;
|
|
@@ -176,6 +176,23 @@ export declare const juniorMemoryMemories: import("drizzle-orm/pg-core").PgTable
|
|
|
176
176
|
identity: undefined;
|
|
177
177
|
generated: undefined;
|
|
178
178
|
}, {}, {}>;
|
|
179
|
+
locationId: import("drizzle-orm/pg-core").PgColumn<{
|
|
180
|
+
name: "location_id";
|
|
181
|
+
tableName: "junior_memory_memories";
|
|
182
|
+
dataType: "string";
|
|
183
|
+
columnType: "PgText";
|
|
184
|
+
data: string;
|
|
185
|
+
driverParam: string;
|
|
186
|
+
notNull: false;
|
|
187
|
+
hasDefault: false;
|
|
188
|
+
isPrimaryKey: false;
|
|
189
|
+
isAutoincrement: false;
|
|
190
|
+
hasRuntimeDefault: false;
|
|
191
|
+
enumValues: [string, ...string[]];
|
|
192
|
+
baseColumn: never;
|
|
193
|
+
identity: undefined;
|
|
194
|
+
generated: undefined;
|
|
195
|
+
}, {}, {}>;
|
|
179
196
|
idempotencyKey: import("drizzle-orm/pg-core").PgColumn<{
|
|
180
197
|
name: "idempotency_key";
|
|
181
198
|
tableName: "junior_memory_memories";
|
package/dist/events.d.ts
CHANGED
|
@@ -2,21 +2,21 @@ import type { MemoryRecord } from "./store";
|
|
|
2
2
|
/** Previous stored memory-capture event shape retained for transcript rendering. */
|
|
3
3
|
export declare const memoriesCapturedEventV1: import("@sentry/junior-plugin-api").DefinedConversationEvent<{
|
|
4
4
|
memories: {
|
|
5
|
+
scope: "conversation" | "personal";
|
|
5
6
|
content: string;
|
|
6
7
|
id: string;
|
|
7
8
|
kind: "preference" | "procedure" | "knowledge";
|
|
8
9
|
observedAtMs: number;
|
|
9
|
-
scope: "personal" | "conversation";
|
|
10
10
|
}[];
|
|
11
11
|
}>;
|
|
12
12
|
/** Durable outcome emitted after every completed passive memory extraction. */
|
|
13
13
|
export declare const memoriesCapturedEvent: import("@sentry/junior-plugin-api").DefinedConversationEvent<{
|
|
14
14
|
memories: {
|
|
15
|
+
scope: "public" | "private";
|
|
15
16
|
content: string;
|
|
16
17
|
id: string;
|
|
17
18
|
kind: "preference" | "procedure" | "knowledge";
|
|
18
19
|
observedAtMs: number;
|
|
19
|
-
scope: "personal" | "conversation";
|
|
20
20
|
}[];
|
|
21
21
|
costUsd?: number | undefined;
|
|
22
22
|
}>;
|
|
@@ -31,5 +31,5 @@ export declare function capturedMemory(memory: MemoryRecord): {
|
|
|
31
31
|
id: string;
|
|
32
32
|
kind: "preference" | "procedure" | "knowledge";
|
|
33
33
|
observedAtMs: number;
|
|
34
|
-
scope: "
|
|
34
|
+
scope: "public" | "private";
|
|
35
35
|
};
|