@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/agent.d.ts
CHANGED
|
@@ -11,17 +11,26 @@ declare const memoryRecallInputSchema: z.ZodObject<{
|
|
|
11
11
|
declare const createMemoryRequestSchema: z.ZodObject<{
|
|
12
12
|
content: z.ZodString;
|
|
13
13
|
expiresAtMs: z.ZodOptional<z.ZodNumber>;
|
|
14
|
-
runtimeContext: z.
|
|
14
|
+
runtimeContext: 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
|
-
|
|
23
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
24
|
+
platform: z.ZodLiteral<"local">;
|
|
25
|
+
email: z.ZodOptional<z.ZodString>;
|
|
26
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
27
|
+
userId: z.ZodString;
|
|
28
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
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<{
|
|
25
34
|
platform: z.ZodLiteral<"slack">;
|
|
26
35
|
teamId: z.ZodString;
|
|
27
36
|
channelId: z.ZodString;
|
|
@@ -31,22 +40,12 @@ declare const createMemoryRequestSchema: z.ZodObject<{
|
|
|
31
40
|
}>;
|
|
32
41
|
messageTs: z.ZodOptional<z.ZodString>;
|
|
33
42
|
threadTs: z.ZodOptional<z.ZodString>;
|
|
34
|
-
}, z.core.$strict
|
|
35
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
36
|
-
conversationId: z.ZodOptional<z.ZodString>;
|
|
37
|
-
actor: z.ZodOptional<z.ZodObject<{
|
|
38
|
-
platform: z.ZodLiteral<"local">;
|
|
39
|
-
email: z.ZodOptional<z.ZodString>;
|
|
40
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
41
|
-
userId: z.ZodString;
|
|
42
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
43
|
-
}, z.core.$strict>>;
|
|
44
|
-
source: z.ZodObject<{
|
|
43
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
45
44
|
platform: z.ZodLiteral<"local">;
|
|
46
45
|
visibility: z.ZodLiteral<"private">;
|
|
47
46
|
conversationId: z.ZodString;
|
|
48
|
-
}, z.core.$strict>;
|
|
49
|
-
}, z.core.$strict
|
|
47
|
+
}, z.core.$strict>], "platform">;
|
|
48
|
+
}, z.core.$strict>;
|
|
50
49
|
sourceContext: z.ZodOptional<z.ZodObject<{
|
|
51
50
|
currentUserText: z.ZodOptional<z.ZodString>;
|
|
52
51
|
}, z.core.$strict>>;
|
|
@@ -72,17 +71,26 @@ declare const extractSessionRequestSchema: z.ZodObject<{
|
|
|
72
71
|
platform: z.ZodLiteral<"system">;
|
|
73
72
|
name: z.ZodString;
|
|
74
73
|
}, z.core.$strict>], "platform">>;
|
|
75
|
-
runtimeContext: z.
|
|
74
|
+
runtimeContext: z.ZodObject<{
|
|
76
75
|
conversationId: z.ZodOptional<z.ZodString>;
|
|
77
|
-
actor: z.ZodOptional<z.ZodObject<{
|
|
76
|
+
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
78
77
|
platform: z.ZodLiteral<"slack">;
|
|
79
78
|
teamId: z.ZodString;
|
|
80
79
|
email: z.ZodOptional<z.ZodString>;
|
|
81
80
|
fullName: z.ZodOptional<z.ZodString>;
|
|
82
81
|
userId: z.ZodString;
|
|
83
82
|
userName: z.ZodOptional<z.ZodString>;
|
|
84
|
-
}, z.core.$strict
|
|
85
|
-
|
|
83
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
84
|
+
platform: z.ZodLiteral<"local">;
|
|
85
|
+
email: z.ZodOptional<z.ZodString>;
|
|
86
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
87
|
+
userId: z.ZodString;
|
|
88
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
89
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
90
|
+
platform: z.ZodLiteral<"system">;
|
|
91
|
+
name: z.ZodString;
|
|
92
|
+
}, z.core.$strict>], "platform">>;
|
|
93
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
86
94
|
platform: z.ZodLiteral<"slack">;
|
|
87
95
|
teamId: z.ZodString;
|
|
88
96
|
channelId: z.ZodString;
|
|
@@ -92,22 +100,12 @@ declare const extractSessionRequestSchema: z.ZodObject<{
|
|
|
92
100
|
}>;
|
|
93
101
|
messageTs: z.ZodOptional<z.ZodString>;
|
|
94
102
|
threadTs: z.ZodOptional<z.ZodString>;
|
|
95
|
-
}, z.core.$strict
|
|
96
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
97
|
-
conversationId: z.ZodOptional<z.ZodString>;
|
|
98
|
-
actor: z.ZodOptional<z.ZodObject<{
|
|
99
|
-
platform: z.ZodLiteral<"local">;
|
|
100
|
-
email: z.ZodOptional<z.ZodString>;
|
|
101
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
102
|
-
userId: z.ZodString;
|
|
103
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
104
|
-
}, z.core.$strict>>;
|
|
105
|
-
source: z.ZodObject<{
|
|
103
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
106
104
|
platform: z.ZodLiteral<"local">;
|
|
107
105
|
visibility: z.ZodLiteral<"private">;
|
|
108
106
|
conversationId: z.ZodString;
|
|
109
|
-
}, z.core.$strict>;
|
|
110
|
-
}, z.core.$strict
|
|
107
|
+
}, z.core.$strict>], "platform">;
|
|
108
|
+
}, z.core.$strict>;
|
|
111
109
|
transcript: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
112
110
|
type: z.ZodLiteral<"message">;
|
|
113
111
|
role: z.ZodEnum<{
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { defineJuniorPlugin } from "@sentry/junior-plugin-api";
|
|
3
3
|
|
|
4
4
|
// src/agent.ts
|
|
5
|
-
import { actorSchema } from "@sentry/junior-plugin-api";
|
|
5
|
+
import { actorSchema as actorSchema2 } from "@sentry/junior-plugin-api";
|
|
6
6
|
import { z as z3 } from "zod";
|
|
7
7
|
|
|
8
8
|
// src/store.ts
|
|
@@ -40,10 +40,8 @@ import {
|
|
|
40
40
|
|
|
41
41
|
// src/types.ts
|
|
42
42
|
import {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
slackActorSchema,
|
|
46
|
-
slackSourceSchema
|
|
43
|
+
actorSchema,
|
|
44
|
+
sourceSchema
|
|
47
45
|
} from "@sentry/junior-plugin-api";
|
|
48
46
|
import { z } from "zod";
|
|
49
47
|
var MEMORY_KINDS = ["preference", "procedure", "knowledge"];
|
|
@@ -60,20 +58,11 @@ var MEMORY_SOURCE_PLATFORMS = [
|
|
|
60
58
|
var MEMORY_EMBEDDING_METRICS = ["cosine"];
|
|
61
59
|
var MEMORY_EMBEDDING_DIMENSIONS = 1536;
|
|
62
60
|
var nonEmptyStringSchema = z.string().min(1);
|
|
63
|
-
var
|
|
61
|
+
var memoryRuntimeContextSchema = z.object({
|
|
64
62
|
conversationId: nonEmptyStringSchema.optional(),
|
|
65
|
-
actor:
|
|
66
|
-
source:
|
|
63
|
+
actor: actorSchema.optional(),
|
|
64
|
+
source: sourceSchema
|
|
67
65
|
}).strict();
|
|
68
|
-
var localMemoryRuntimeContextSchema = z.object({
|
|
69
|
-
conversationId: nonEmptyStringSchema.optional(),
|
|
70
|
-
actor: localActorSchema.optional(),
|
|
71
|
-
source: localSourceSchema
|
|
72
|
-
}).strict();
|
|
73
|
-
var memoryRuntimeContextSchema = z.union([
|
|
74
|
-
slackMemoryRuntimeContextSchema,
|
|
75
|
-
localMemoryRuntimeContextSchema
|
|
76
|
-
]);
|
|
77
66
|
|
|
78
67
|
// src/db/schema.ts
|
|
79
68
|
var tsvector = customType({
|
|
@@ -302,7 +291,7 @@ function sourceConversationKey(ctx) {
|
|
|
302
291
|
}
|
|
303
292
|
function actorScopeKey(ctx) {
|
|
304
293
|
const actor = ctx.actor;
|
|
305
|
-
if (!actor
|
|
294
|
+
if (!actor || actor.platform === "system") {
|
|
306
295
|
return void 0;
|
|
307
296
|
}
|
|
308
297
|
if (actor.platform === "slack") {
|
|
@@ -1421,7 +1410,7 @@ var createMemoryRequestSchema = z3.object({
|
|
|
1421
1410
|
}).strict();
|
|
1422
1411
|
var transcriptProvenanceSchema = z3.object({
|
|
1423
1412
|
authority: z3.enum(["instruction", "context"]),
|
|
1424
|
-
actor:
|
|
1413
|
+
actor: actorSchema2.optional()
|
|
1425
1414
|
}).strict();
|
|
1426
1415
|
var evidenceMessageIndicesSchema = z3.array(z3.number().int().nonnegative()).min(1).max(10).describe("Indices from <run-transcript> that directly support this memory.");
|
|
1427
1416
|
var extractSessionRequestSchema = z3.object({
|
|
@@ -1430,7 +1419,7 @@ var extractSessionRequestSchema = z3.object({
|
|
|
1430
1419
|
content: z3.string().min(1)
|
|
1431
1420
|
}).strict()
|
|
1432
1421
|
).max(10).default([]),
|
|
1433
|
-
actors: z3.array(
|
|
1422
|
+
actors: z3.array(actorSchema2),
|
|
1434
1423
|
runtimeContext: memoryRuntimeContextSchema,
|
|
1435
1424
|
transcript: z3.array(
|
|
1436
1425
|
z3.discriminatedUnion("type", [
|
|
@@ -3029,8 +3018,8 @@ function routeExtractedMemory(memory, transcript, run) {
|
|
|
3029
3018
|
return "drop";
|
|
3030
3019
|
}
|
|
3031
3020
|
if (memory.kind === "preference") {
|
|
3032
|
-
const
|
|
3033
|
-
if (!
|
|
3021
|
+
const exactlyOneHumanRunActor = run.actor !== void 0 && run.actor.platform !== "system" && run.actors.length === 1 && run.actors[0]?.platform !== "system";
|
|
3022
|
+
if (!exactlyOneHumanRunActor) {
|
|
3034
3023
|
return "drop";
|
|
3035
3024
|
}
|
|
3036
3025
|
return cited.entries.every(isRunActorInstruction) ? "personal" : "drop";
|