@sentry/junior-memory 0.155.0 → 0.156.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/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/events.ts +2 -1
- package/src/recall.ts +3 -4
package/dist/index.js
CHANGED
|
@@ -2946,7 +2946,8 @@ var capturedMemoriesSchema = z8.object({
|
|
|
2946
2946
|
costUsd: z8.number().finite().nonnegative().optional()
|
|
2947
2947
|
}).strict();
|
|
2948
2948
|
var recalledMemoriesSchema = z8.object({
|
|
2949
|
-
|
|
2949
|
+
// Matches the automatic-recall candidate window; admission packs by char budget.
|
|
2950
|
+
memories: z8.array(z8.string().min(1)).max(20),
|
|
2950
2951
|
costUsd: z8.number().finite().nonnegative().optional()
|
|
2951
2952
|
}).strict();
|
|
2952
2953
|
function renderCapturedMemories(event) {
|
|
@@ -3175,7 +3176,6 @@ import {
|
|
|
3175
3176
|
definePromptContext
|
|
3176
3177
|
} from "@sentry/junior-plugin-api";
|
|
3177
3178
|
import { z as z10 } from "zod";
|
|
3178
|
-
var DEFAULT_RECALL_LIMIT = 5;
|
|
3179
3179
|
var RECALL_CANDIDATE_LIMIT = 20;
|
|
3180
3180
|
var MAX_PROMPT_CHARS = 4e3;
|
|
3181
3181
|
var MAX_MEMORY_LINE_CHARS = 600;
|
|
@@ -3197,7 +3197,8 @@ var recalledMemorySchema = z10.object({
|
|
|
3197
3197
|
kind: z10.enum(["preference", "procedure", "knowledge"])
|
|
3198
3198
|
}).strict();
|
|
3199
3199
|
var memoryRecallContextSchema = z10.object({
|
|
3200
|
-
|
|
3200
|
+
// Count is a safety rail only. Admission packs by MAX_PROMPT_CHARS.
|
|
3201
|
+
memories: z10.array(recalledMemorySchema).min(1).max(RECALL_CANDIDATE_LIMIT)
|
|
3201
3202
|
}).strict();
|
|
3202
3203
|
function selectPromptMemories(memories) {
|
|
3203
3204
|
const header = "Relevant memories for this request:";
|
|
@@ -3295,7 +3296,7 @@ async function createMemoryPromptContributions(context) {
|
|
|
3295
3296
|
const candidatesById = new Map(
|
|
3296
3297
|
candidates.map((memory) => [memory.id, memory])
|
|
3297
3298
|
);
|
|
3298
|
-
const relevant = recall.relevantIds.map((id) => candidatesById.get(id)).filter((memory) => memory !== void 0)
|
|
3299
|
+
const relevant = recall.relevantIds.map((id) => candidatesById.get(id)).filter((memory) => memory !== void 0);
|
|
3299
3300
|
const selected = selectPromptMemories(relevant);
|
|
3300
3301
|
const costUsd = addUsd(embeddingCostUsd, recall.costUsd);
|
|
3301
3302
|
await emitRecallOutcome({
|