@sentry/junior-memory 0.127.0 → 0.128.1

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/src/tools.ts CHANGED
@@ -4,10 +4,10 @@ import {
4
4
  definePluginTool,
5
5
  getSourceKey,
6
6
  PluginToolInputError,
7
- type PluginToolResult,
7
+ type PluginToolOutput,
8
8
  type Source,
9
9
  type Actor,
10
- pluginToolResultSchema,
10
+ pluginToolOutputSchema,
11
11
  } from "@sentry/junior-plugin-api";
12
12
  import { z } from "zod";
13
13
  import {
@@ -297,12 +297,9 @@ const memoryToolProjectionSchema = Type.Object(
297
297
  type MemoryToolProjection = Static<typeof memoryToolProjectionSchema>;
298
298
 
299
299
  type MemoryStructuredToolResult<TData extends Record<string, unknown>> =
300
- PluginToolResult &
300
+ PluginToolOutput &
301
301
  TData & {
302
- ok: true;
303
- status: "success";
304
302
  target: string;
305
- data: TData;
306
303
  };
307
304
 
308
305
  const memoryProjectionOutputSchema = z.object({
@@ -313,41 +310,19 @@ const memoryProjectionOutputSchema = z.object({
313
310
  expiresAtMs: z.number().optional(),
314
311
  });
315
312
 
316
- const memoryCreateDataOutputSchema = z.object({
317
- created: z.boolean(),
318
- memory: memoryProjectionOutputSchema,
319
- });
320
-
321
- const memorySingleDataOutputSchema = z.object({
322
- memory: memoryProjectionOutputSchema,
323
- });
324
-
325
- const memoryManyDataOutputSchema = z.object({
326
- memories: z.array(memoryProjectionOutputSchema),
327
- });
328
-
329
- const memoryCreateOutputSchema = pluginToolResultSchema.extend({
330
- ok: z.literal(true),
331
- status: z.literal("success"),
313
+ const memoryCreateOutputSchema = pluginToolOutputSchema.extend({
332
314
  target: z.string(),
333
- data: memoryCreateDataOutputSchema,
334
315
  created: z.boolean(),
335
316
  memory: memoryProjectionOutputSchema,
336
317
  });
337
318
 
338
- const memorySingleOutputSchema = pluginToolResultSchema.extend({
339
- ok: z.literal(true),
340
- status: z.literal("success"),
319
+ const memorySingleOutputSchema = pluginToolOutputSchema.extend({
341
320
  target: z.string(),
342
- data: memorySingleDataOutputSchema,
343
321
  memory: memoryProjectionOutputSchema,
344
322
  });
345
323
 
346
- const memoryManyOutputSchema = pluginToolResultSchema.extend({
347
- ok: z.literal(true),
348
- status: z.literal("success"),
324
+ const memoryManyOutputSchema = pluginToolOutputSchema.extend({
349
325
  target: z.string(),
350
- data: memoryManyDataOutputSchema,
351
326
  memories: z.array(memoryProjectionOutputSchema),
352
327
  });
353
328
 
@@ -409,10 +384,7 @@ function memoryToolResult<TData extends Record<string, unknown>>(
409
384
  data: TData,
410
385
  ): MemoryStructuredToolResult<TData> {
411
386
  return {
412
- ok: true,
413
- status: "success",
414
387
  target,
415
- data,
416
388
  ...data,
417
389
  };
418
390
  }
package/src/user-pages.ts CHANGED
@@ -1,10 +1,7 @@
1
1
  /** Project viewer-visible memories into Junior's core-rendered user page. */
2
2
  import type { PluginUserPageDefinition } from "@sentry/junior-plugin-api";
3
3
  import { createViewerMemories } from "./personal";
4
- import type {
5
- MemoryVisibility,
6
- PersonalMemoryRecord,
7
- } from "./personal-store";
4
+ import type { MemoryVisibility, PersonalMemoryRecord } from "./personal-store";
8
5
  import type { MemoryDb } from "./store";
9
6
 
10
7
  function titleCase(value: string): string {
@@ -53,10 +50,7 @@ export function createMemoryUserPage(): PluginUserPageDefinition {
53
50
  description:
54
51
  "Personal and public memories Junior can use across conversations.",
55
52
  async read(ctx, input) {
56
- const memories = createViewerMemories(
57
- ctx.db as MemoryDb,
58
- ctx.viewer.actors,
59
- );
53
+ const memories = createViewerMemories(ctx.db as MemoryDb, ctx.viewer);
60
54
  const page = await memories.list({
61
55
  cursor: input.cursor,
62
56
  ...pageFilter(input.filter),