@sentry/junior-memory 0.136.0 → 0.137.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/dist/agent.d.ts +32 -34
- package/dist/index.js +11 -22
- package/dist/index.js.map +1 -1
- package/dist/store.d.ts +16 -17
- package/dist/types.d.ts +11 -51
- package/package.json +2 -2
- package/src/process-session.ts +7 -4
- package/src/scope.ts +1 -1
- package/src/types.ts +5 -22
package/dist/store.d.ts
CHANGED
|
@@ -65,17 +65,26 @@ export declare const memorySupersessionInputSchema: z.ZodObject<{
|
|
|
65
65
|
content: z.ZodString;
|
|
66
66
|
id: z.ZodString;
|
|
67
67
|
}, z.core.$strict>>;
|
|
68
|
-
runtimeContext: z.
|
|
68
|
+
runtimeContext: z.ZodObject<{
|
|
69
69
|
conversationId: z.ZodOptional<z.ZodString>;
|
|
70
|
-
actor: z.ZodOptional<z.ZodObject<{
|
|
70
|
+
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
71
71
|
platform: z.ZodLiteral<"slack">;
|
|
72
72
|
teamId: z.ZodString;
|
|
73
73
|
email: z.ZodOptional<z.ZodString>;
|
|
74
74
|
fullName: z.ZodOptional<z.ZodString>;
|
|
75
75
|
userId: z.ZodString;
|
|
76
76
|
userName: z.ZodOptional<z.ZodString>;
|
|
77
|
-
}, z.core.$strict
|
|
78
|
-
|
|
77
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
78
|
+
platform: z.ZodLiteral<"local">;
|
|
79
|
+
email: z.ZodOptional<z.ZodString>;
|
|
80
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
81
|
+
userId: z.ZodString;
|
|
82
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
83
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
84
|
+
platform: z.ZodLiteral<"system">;
|
|
85
|
+
name: z.ZodString;
|
|
86
|
+
}, z.core.$strict>], "platform">>;
|
|
87
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
79
88
|
platform: z.ZodLiteral<"slack">;
|
|
80
89
|
teamId: z.ZodString;
|
|
81
90
|
channelId: z.ZodString;
|
|
@@ -85,22 +94,12 @@ export declare const memorySupersessionInputSchema: z.ZodObject<{
|
|
|
85
94
|
}>;
|
|
86
95
|
messageTs: z.ZodOptional<z.ZodString>;
|
|
87
96
|
threadTs: z.ZodOptional<z.ZodString>;
|
|
88
|
-
}, z.core.$strict
|
|
89
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
90
|
-
conversationId: z.ZodOptional<z.ZodString>;
|
|
91
|
-
actor: z.ZodOptional<z.ZodObject<{
|
|
92
|
-
platform: z.ZodLiteral<"local">;
|
|
93
|
-
email: z.ZodOptional<z.ZodString>;
|
|
94
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
95
|
-
userId: z.ZodString;
|
|
96
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
97
|
-
}, z.core.$strict>>;
|
|
98
|
-
source: z.ZodObject<{
|
|
97
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
99
98
|
platform: z.ZodLiteral<"local">;
|
|
100
99
|
visibility: z.ZodLiteral<"private">;
|
|
101
100
|
conversationId: z.ZodString;
|
|
102
|
-
}, z.core.$strict>;
|
|
103
|
-
}, z.core.$strict
|
|
101
|
+
}, z.core.$strict>], "platform">;
|
|
102
|
+
}, z.core.$strict>;
|
|
104
103
|
}, z.core.$strict>;
|
|
105
104
|
/**
|
|
106
105
|
* Validated preference decision whose referenced ids must come from the
|
package/dist/types.d.ts
CHANGED
|
@@ -11,56 +11,26 @@ export type MemorySubjectType = (typeof MEMORY_SUBJECT_TYPES)[number];
|
|
|
11
11
|
export type MemorySourcePlatform = (typeof MEMORY_SOURCE_PLATFORMS)[number];
|
|
12
12
|
export type MemoryEmbeddingMetric = (typeof MEMORY_EMBEDDING_METRICS)[number];
|
|
13
13
|
/** Runtime-owned memory invocation fields used for scope and source authority. */
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const memoryRuntimeContextSchema: z.ZodObject<{
|
|
15
15
|
conversationId: z.ZodOptional<z.ZodString>;
|
|
16
|
-
actor: z.ZodOptional<z.ZodObject<{
|
|
16
|
+
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
17
17
|
platform: z.ZodLiteral<"slack">;
|
|
18
18
|
teamId: z.ZodString;
|
|
19
19
|
email: z.ZodOptional<z.ZodString>;
|
|
20
20
|
fullName: z.ZodOptional<z.ZodString>;
|
|
21
21
|
userId: z.ZodString;
|
|
22
22
|
userName: z.ZodOptional<z.ZodString>;
|
|
23
|
-
}, z.core.$strict
|
|
24
|
-
source: z.ZodObject<{
|
|
25
|
-
platform: z.ZodLiteral<"slack">;
|
|
26
|
-
teamId: z.ZodString;
|
|
27
|
-
channelId: z.ZodString;
|
|
28
|
-
visibility: z.ZodEnum<{
|
|
29
|
-
public: "public";
|
|
30
|
-
private: "private";
|
|
31
|
-
}>;
|
|
32
|
-
messageTs: z.ZodOptional<z.ZodString>;
|
|
33
|
-
threadTs: z.ZodOptional<z.ZodString>;
|
|
34
|
-
}, z.core.$strict>;
|
|
35
|
-
}, z.core.$strict>;
|
|
36
|
-
/** Runtime-owned local memory invocation fields used for scope and source authority. */
|
|
37
|
-
export declare const localMemoryRuntimeContextSchema: z.ZodObject<{
|
|
38
|
-
conversationId: z.ZodOptional<z.ZodString>;
|
|
39
|
-
actor: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
40
24
|
platform: z.ZodLiteral<"local">;
|
|
41
25
|
email: z.ZodOptional<z.ZodString>;
|
|
42
26
|
fullName: z.ZodOptional<z.ZodString>;
|
|
43
27
|
userId: z.ZodString;
|
|
44
28
|
userName: z.ZodOptional<z.ZodString>;
|
|
45
|
-
}, z.core.$strict
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}, z.core.$strict>;
|
|
51
|
-
}, z.core.$strict>;
|
|
52
|
-
/** Runtime-owned memory invocation fields accepted by memory store operations. */
|
|
53
|
-
export declare const memoryRuntimeContextSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
54
|
-
conversationId: z.ZodOptional<z.ZodString>;
|
|
55
|
-
actor: z.ZodOptional<z.ZodObject<{
|
|
56
|
-
platform: z.ZodLiteral<"slack">;
|
|
57
|
-
teamId: z.ZodString;
|
|
58
|
-
email: z.ZodOptional<z.ZodString>;
|
|
59
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
60
|
-
userId: z.ZodString;
|
|
61
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
62
|
-
}, z.core.$strict>>;
|
|
63
|
-
source: z.ZodObject<{
|
|
29
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
30
|
+
platform: z.ZodLiteral<"system">;
|
|
31
|
+
name: z.ZodString;
|
|
32
|
+
}, z.core.$strict>], "platform">>;
|
|
33
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
64
34
|
platform: z.ZodLiteral<"slack">;
|
|
65
35
|
teamId: z.ZodString;
|
|
66
36
|
channelId: z.ZodString;
|
|
@@ -70,20 +40,10 @@ export declare const memoryRuntimeContextSchema: z.ZodUnion<readonly [z.ZodObjec
|
|
|
70
40
|
}>;
|
|
71
41
|
messageTs: z.ZodOptional<z.ZodString>;
|
|
72
42
|
threadTs: z.ZodOptional<z.ZodString>;
|
|
73
|
-
}, z.core.$strict
|
|
74
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
75
|
-
conversationId: z.ZodOptional<z.ZodString>;
|
|
76
|
-
actor: z.ZodOptional<z.ZodObject<{
|
|
77
|
-
platform: z.ZodLiteral<"local">;
|
|
78
|
-
email: z.ZodOptional<z.ZodString>;
|
|
79
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
80
|
-
userId: z.ZodString;
|
|
81
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
82
|
-
}, z.core.$strict>>;
|
|
83
|
-
source: z.ZodObject<{
|
|
43
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
84
44
|
platform: z.ZodLiteral<"local">;
|
|
85
45
|
visibility: z.ZodLiteral<"private">;
|
|
86
46
|
conversationId: z.ZodString;
|
|
87
|
-
}, z.core.$strict>;
|
|
88
|
-
}, z.core.$strict
|
|
47
|
+
}, z.core.$strict>], "platform">;
|
|
48
|
+
}, z.core.$strict>;
|
|
89
49
|
export type MemoryRuntimeContext = z.output<typeof memoryRuntimeContextSchema>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-memory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.137.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"commander": "^14.0.3",
|
|
28
28
|
"drizzle-orm": "^0.45.2",
|
|
29
29
|
"zod": "^4.4.3",
|
|
30
|
-
"@sentry/junior-plugin-api": "0.
|
|
30
|
+
"@sentry/junior-plugin-api": "0.137.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^25.9.1",
|
package/src/process-session.ts
CHANGED
|
@@ -143,10 +143,13 @@ function routeExtractedMemory(
|
|
|
143
143
|
return "drop";
|
|
144
144
|
}
|
|
145
145
|
if (memory.kind === "preference") {
|
|
146
|
-
// Only a run attributed to exactly one run actor may store a preference
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
146
|
+
// Only a run attributed to exactly one human run actor may store a preference.
|
|
147
|
+
const exactlyOneHumanRunActor =
|
|
148
|
+
run.actor !== undefined &&
|
|
149
|
+
run.actor.platform !== "system" &&
|
|
150
|
+
run.actors.length === 1 &&
|
|
151
|
+
run.actors[0]?.platform !== "system";
|
|
152
|
+
if (!exactlyOneHumanRunActor) {
|
|
150
153
|
return "drop";
|
|
151
154
|
}
|
|
152
155
|
// Never downgrade an unproven first-person preference to conversation scope.
|
package/src/scope.ts
CHANGED
|
@@ -81,7 +81,7 @@ function sourceConversationKey(ctx: MemoryRuntimeContext): string | undefined {
|
|
|
81
81
|
|
|
82
82
|
function actorScopeKey(ctx: MemoryRuntimeContext): string | undefined {
|
|
83
83
|
const actor = ctx.actor;
|
|
84
|
-
if (!actor
|
|
84
|
+
if (!actor || actor.platform === "system") {
|
|
85
85
|
return undefined;
|
|
86
86
|
}
|
|
87
87
|
if (actor.platform === "slack") {
|
package/src/types.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
localSourceSchema,
|
|
2
|
+
actorSchema,
|
|
4
3
|
platformSchema,
|
|
5
|
-
|
|
6
|
-
slackSourceSchema,
|
|
4
|
+
sourceSchema,
|
|
7
5
|
} from "@sentry/junior-plugin-api";
|
|
8
6
|
import { z } from "zod";
|
|
9
7
|
|
|
@@ -31,27 +29,12 @@ export type MemoryEmbeddingMetric = (typeof MEMORY_EMBEDDING_METRICS)[number];
|
|
|
31
29
|
const nonEmptyStringSchema = z.string().min(1);
|
|
32
30
|
|
|
33
31
|
/** Runtime-owned memory invocation fields used for scope and source authority. */
|
|
34
|
-
export const
|
|
32
|
+
export const memoryRuntimeContextSchema = z
|
|
35
33
|
.object({
|
|
36
34
|
conversationId: nonEmptyStringSchema.optional(),
|
|
37
|
-
actor:
|
|
38
|
-
source:
|
|
35
|
+
actor: actorSchema.optional(),
|
|
36
|
+
source: sourceSchema,
|
|
39
37
|
})
|
|
40
38
|
.strict();
|
|
41
39
|
|
|
42
|
-
/** Runtime-owned local memory invocation fields used for scope and source authority. */
|
|
43
|
-
export const localMemoryRuntimeContextSchema = z
|
|
44
|
-
.object({
|
|
45
|
-
conversationId: nonEmptyStringSchema.optional(),
|
|
46
|
-
actor: localActorSchema.optional(),
|
|
47
|
-
source: localSourceSchema,
|
|
48
|
-
})
|
|
49
|
-
.strict();
|
|
50
|
-
|
|
51
|
-
/** Runtime-owned memory invocation fields accepted by memory store operations. */
|
|
52
|
-
export const memoryRuntimeContextSchema = z.union([
|
|
53
|
-
slackMemoryRuntimeContextSchema,
|
|
54
|
-
localMemoryRuntimeContextSchema,
|
|
55
|
-
]);
|
|
56
|
-
|
|
57
40
|
export type MemoryRuntimeContext = z.output<typeof memoryRuntimeContextSchema>;
|