@sentry/junior 0.98.0 → 0.99.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.
@@ -1,3 +1,8 @@
1
1
  import type { ConversationFeed } from "./schema";
2
- /** Load the conversation feed directly from durable SQL records. */
3
- export declare function readConversationFeed(): Promise<ConversationFeed>;
2
+ /**
3
+ * Load a bounded feed with an optional normalized actor-email presentation
4
+ * filter. This filter is not an authorization boundary.
5
+ */
6
+ export declare function readConversationFeed(options?: {
7
+ actorEmail?: string;
8
+ }): Promise<ConversationFeed>;
@@ -1,7 +1,7 @@
1
1
  import type { Conversation } from "@/chat/conversations/store";
2
2
  import type { JuniorDatabase } from "@/db/db";
3
3
  import type { ConversationFeed } from "./schema";
4
- declare function conversationRows(db: JuniorDatabase, limit: number): Promise<{
4
+ declare function conversationRows(db: JuniorDatabase, limit: number, actorEmail?: string): Promise<{
5
5
  conversation: {
6
6
  conversationId: string;
7
7
  schemaVersion: number;
@@ -89,6 +89,12 @@ export declare function readConversationRecordFromSql(conversationId: string): P
89
89
  durationMs: number;
90
90
  usage: ConversationRow["conversation"]["usage"];
91
91
  } | undefined>;
92
- /** Build the dashboard conversation feed directly from durable SQL rows. */
93
- export declare function readConversationFeedFromSql(limit?: number): Promise<ConversationFeed>;
92
+ /**
93
+ * Build a bounded dashboard feed, applying a normalized actor-email filter
94
+ * before the limit when one is provided.
95
+ */
96
+ export declare function readConversationFeedFromSql(options?: {
97
+ actorEmail?: string;
98
+ limit?: number;
99
+ }): Promise<ConversationFeed>;
94
100
  export {};
@@ -8,6 +8,9 @@ import { z } from "zod";
8
8
  export declare const conversationParamsSchema: z.ZodObject<{
9
9
  conversationId: z.ZodString;
10
10
  }, z.core.$strict>;
11
+ export declare const conversationFeedQuerySchema: z.ZodObject<{
12
+ actorEmail: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
13
+ }, z.core.$strict>;
11
14
  export declare const subagentParamsSchema: z.ZodObject<{
12
15
  conversationId: z.ZodString;
13
16
  subagentId: z.ZodString;
@@ -1,8 +1,9 @@
1
1
  import {
2
+ conversationFeedQuerySchema,
2
3
  conversationParamsSchema,
3
4
  personParamsSchema,
4
5
  subagentParamsSchema
5
- } from "../chunk-UAMKJPDF.js";
6
+ } from "../chunk-T55RBE4Z.js";
6
7
  import {
7
8
  actorDirectoryReportSchema,
8
9
  actorProfileReportSchema
@@ -31,6 +32,7 @@ export {
31
32
  actorDirectoryReportSchema,
32
33
  actorProfileReportSchema,
33
34
  conversationDetailReportSchema,
35
+ conversationFeedQuerySchema,
34
36
  conversationFeedSchema,
35
37
  conversationParamsSchema,
36
38
  conversationStatsReportSchema,
@@ -8,7 +8,7 @@ export { defineJuniorPlugins } from "./plugins";
8
8
  export type { JuniorPluginInput, JuniorPluginSet, JuniorPluginSetOptions, } from "./plugins";
9
9
  export type { PluginRunContext, PluginRunTranscriptEntry, PluginTaskContext, PluginTaskDefinition, PluginTasks, PluginConversationStatus, PluginConversations, PluginConversationSummary, SubscribableResource, } from "@sentry/junior-plugin-api";
10
10
  export { definePluginTool, pluginRunContextSchema, pluginRunTranscriptEntrySchema, zodTool, } from "@sentry/junior-plugin-api";
11
- export { actorDirectoryReportSchema, actorProfileReportSchema, conversationDetailReportSchema, conversationFeedSchema, conversationParamsSchema, conversationStatsReportSchema, conversationSubagentTranscriptReportSchema, healthReportSchema, personParamsSchema, pluginOperationalReportFeedSchema, pluginOperationalReportSchema, pluginPackageContentItemReportSchema, pluginPackageContentReportSchema, pluginReportSchema, pluginReportsSchema, runtimeInfoReportSchema, skillReportSchema, skillReportsSchema, subagentParamsSchema, } from "./api/schema";
11
+ export { actorDirectoryReportSchema, actorProfileReportSchema, conversationDetailReportSchema, conversationFeedSchema, conversationFeedQuerySchema, conversationParamsSchema, conversationStatsReportSchema, conversationSubagentTranscriptReportSchema, healthReportSchema, personParamsSchema, pluginOperationalReportFeedSchema, pluginOperationalReportSchema, pluginPackageContentItemReportSchema, pluginPackageContentReportSchema, pluginReportSchema, pluginReportsSchema, runtimeInfoReportSchema, skillReportSchema, skillReportsSchema, subagentParamsSchema, } from "./api/schema";
12
12
  export type { ActorActivityDayReport, ActorDirectoryReport, ActorIdentity, ActorProfileReport, ActorSummaryReport, ActorTotalsReport, ConversationActivityReport, ConversationActivityStatus, ConversationContextEvent, ConversationCost, ConversationDetailReport, ConversationFeed, ConversationParams, ConversationReportStatus, ConversationStatsItem, ConversationStatsReport, ConversationSubagentActivityReport, ConversationSubagentTranscriptReport, ConversationSummaryReport, ConversationSurface, ConversationToolActivityReport, ConversationUsage, HealthReport, PersonParams, PluginOperationalReport, PluginOperationalReportFeed, PluginPackageContentItemReport, PluginPackageContentReport, PluginReport, PluginReports, RuntimeInfoReport, SkillReport, SkillReports, SubagentParams, TranscriptMessage, TranscriptPart, TranscriptPartType, TranscriptRole, } from "./api/schema";
13
13
  export { juniorVercelConfig } from "./vercel";
14
14
  export type { JuniorVercelConfigOptions } from "./vercel";
package/dist/api.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import {
2
+ conversationFeedQuerySchema,
2
3
  conversationParamsSchema,
3
4
  personParamsSchema,
4
5
  subagentParamsSchema
5
- } from "./chunk-UAMKJPDF.js";
6
+ } from "./chunk-T55RBE4Z.js";
6
7
  import "./chunk-CRQVIHDI.js";
7
8
  import "./chunk-EUZ44ROE.js";
8
9
  import {
@@ -69,7 +70,7 @@ async function readRuntimeInfoReport() {
69
70
  }
70
71
  async function readPluginOperationalReportFeed() {
71
72
  const listRecent = async (listOptions) => {
72
- const { listRecentConversationSummaries } = await import("./plugin-conversations-ZYRWZYEA.js");
73
+ const { listRecentConversationSummaries } = await import("./plugin-conversations-PDCQWU3O.js");
73
74
  return listRecentConversationSummaries(listOptions?.limit);
74
75
  };
75
76
  const nowMs = Date.now();
@@ -94,6 +95,16 @@ function parseParams(schema, params) {
94
95
  message: "Invalid route parameters."
95
96
  });
96
97
  }
98
+ function parseQuery(schema, query) {
99
+ const result = schema.safeParse(query);
100
+ if (result.success) {
101
+ return result.data;
102
+ }
103
+ throw new HTTPException(400, {
104
+ cause: result.error,
105
+ message: "Invalid query parameters."
106
+ });
107
+ }
97
108
  function createJuniorApi() {
98
109
  const app = new Hono();
99
110
  app.get("/api/health", async () => {
@@ -111,16 +122,20 @@ function createJuniorApi() {
111
122
  app.get("/api/plugin-reports", async () => {
112
123
  return Response.json(await readPluginOperationalReportFeed());
113
124
  });
114
- app.get("/api/conversations", async () => {
115
- const { readConversationFeed } = await import("./list-3KZNG3SJ.js");
116
- return Response.json(await readConversationFeed());
125
+ app.get("/api/conversations", async (c) => {
126
+ const { readConversationFeed } = await import("./list-A3F5JDYV.js");
127
+ const { actorEmail } = parseQuery(
128
+ conversationFeedQuerySchema,
129
+ c.req.query()
130
+ );
131
+ return Response.json(await readConversationFeed({ actorEmail }));
117
132
  });
118
133
  app.get("/api/conversations/stats", async () => {
119
134
  const { readConversationStats } = await import("./stats-L62E4O4U.js");
120
135
  return Response.json(await readConversationStats());
121
136
  });
122
137
  app.get("/api/conversations/:conversationId", async (c) => {
123
- const { readConversationDetail } = await import("./detail-W4ZSD45K.js");
138
+ const { readConversationDetail } = await import("./detail-Q4IVDNGS.js");
124
139
  const { conversationId } = parseParams(
125
140
  conversationParamsSchema,
126
141
  c.req.param()
@@ -131,7 +146,7 @@ function createJuniorApi() {
131
146
  app.get(
132
147
  "/api/conversations/:conversationId/subagents/:subagentId",
133
148
  async (c) => {
134
- const { readConversationSubagent } = await import("./subagent-5HZPQC7V.js");
149
+ const { readConversationSubagent } = await import("./subagent-UN3MP6LV.js");
135
150
  const { conversationId, subagentId } = parseParams(
136
151
  subagentParamsSchema,
137
152
  c.req.param()
package/dist/app.js CHANGED
@@ -105,7 +105,7 @@ import {
105
105
  splitSlackReplyText,
106
106
  startOAuthFlow,
107
107
  truncateStatusText
108
- } from "./chunk-DPHWDS6I.js";
108
+ } from "./chunk-PYK7R5A7.js";
109
109
  import {
110
110
  CooperativeTurnYieldError,
111
111
  TurnInputCommitLostError,
@@ -11667,15 +11667,17 @@ function normalizeDashboardPath2(path2, fallback) {
11667
11667
  function dashboardHostRoutePaths(dashboard) {
11668
11668
  const basePath = normalizeDashboardPath2(dashboard.basePath, "/");
11669
11669
  const authPath = normalizeDashboardPath2(dashboard.authPath, "/api/auth");
11670
- const pagePaths = basePath === "/" ? [
11671
- "/",
11672
- "/conversations",
11673
- "/conversations/*",
11674
- "/people",
11675
- "/people/*",
11676
- "/plugins",
11677
- "/plugins/*"
11678
- ] : [basePath, `${basePath}/*`];
11670
+ const pagePath = (suffix) => basePath === "/" ? `/${suffix}` : `${basePath}/${suffix}`;
11671
+ const conversationsPath = pagePath("conversations");
11672
+ const peoplePath = pagePath("people");
11673
+ const pagePaths = [
11674
+ basePath,
11675
+ conversationsPath,
11676
+ `${conversationsPath}/*`,
11677
+ peoplePath,
11678
+ `${peoplePath}/*`,
11679
+ pagePath("plugins")
11680
+ ];
11679
11681
  const loginPath = basePath === "/" ? "/auth/login" : `${basePath}/auth/login`;
11680
11682
  return [
11681
11683
  ...pagePaths,
@@ -32,6 +32,7 @@ interface HandoffContextArgs {
32
32
  conversationId: string;
33
33
  metadata?: CompactContextArgs["metadata"];
34
34
  piMessages: PiMessage[];
35
+ runtimeContext: PiMessage[];
35
36
  signal?: AbortSignal;
36
37
  target: {
37
38
  modelId: string;
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-LVA4I4H7.js";
15
15
 
16
16
  // src/api/conversations/list.query.ts
17
- import { asc, desc, eq, isNull } from "drizzle-orm";
17
+ import { and, asc, desc, eq, isNull } from "drizzle-orm";
18
18
 
19
19
  // src/api/conversations/shared.ts
20
20
  function slackStatsLocationLabel(input) {
@@ -154,7 +154,7 @@ function conversationSummaryFromStoredConversation(args) {
154
154
 
155
155
  // src/api/conversations/list.query.ts
156
156
  var CONVERSATION_FEED_LIMIT = 50;
157
- async function conversationRows(db, limit) {
157
+ async function conversationRows(db, limit, actorEmail) {
158
158
  return db.select({
159
159
  conversation: juniorConversations,
160
160
  destinationVisibility: juniorDestinations.visibility,
@@ -170,7 +170,15 @@ async function conversationRows(db, limit) {
170
170
  ).leftJoin(
171
171
  juniorIdentities,
172
172
  eq(juniorIdentities.id, juniorConversations.actorIdentityId)
173
- ).where(isNull(juniorConversations.parentConversationId)).orderBy(
173
+ ).where(
174
+ and(
175
+ isNull(juniorConversations.parentConversationId),
176
+ actorEmail ? and(
177
+ eq(juniorIdentities.emailNormalized, actorEmail),
178
+ eq(juniorIdentities.emailVerified, true)
179
+ ) : void 0
180
+ )
181
+ ).orderBy(
174
182
  desc(juniorConversations.lastActivityAt),
175
183
  asc(juniorConversations.conversationId)
176
184
  ).limit(limit);
@@ -231,9 +239,13 @@ async function readConversationRecordFromSql(conversationId) {
231
239
  usage: row.conversation.usage
232
240
  } : void 0;
233
241
  }
234
- async function readConversationFeedFromSql(limit = CONVERSATION_FEED_LIMIT) {
242
+ async function readConversationFeedFromSql(options = {}) {
235
243
  const nowMs = Date.now();
236
- const rows = await conversationRows(getDb(), limit);
244
+ const rows = await conversationRows(
245
+ getDb(),
246
+ options.limit ?? CONVERSATION_FEED_LIMIT,
247
+ options.actorEmail
248
+ );
237
249
  return {
238
250
  conversations: rows.map(
239
251
  (row) => conversationSummaryFromStoredConversation({
@@ -15124,9 +15124,19 @@ function createContextCompactor(deps) {
15124
15124
  };
15125
15125
  }
15126
15126
  async function compactContextForHandoff(args, deps) {
15127
- const summary = await summarizeContext(args, deps);
15128
- const message = userMessage(`${MODEL_HANDOFF_SUMMARY_PREFIX}
15129
- ${summary}`);
15127
+ const runtimeMessage = args.runtimeContext.at(-1);
15128
+ if (!runtimeMessage) {
15129
+ throw new Error("Handoff requires the current runtime turn context");
15130
+ }
15131
+ const summary = `${MODEL_HANDOFF_SUMMARY_PREFIX}
15132
+ ${await summarizeContext(args, deps)}`;
15133
+ const message = {
15134
+ ...runtimeMessage,
15135
+ content: [
15136
+ ...runtimeMessage.content,
15137
+ { type: "text", text: renderCurrentInstruction(summary) }
15138
+ ]
15139
+ };
15130
15140
  const messages = [message];
15131
15141
  args.signal?.throwIfAborted();
15132
15142
  await getAgentStepStore().startEpoch(args.conversationId, {
@@ -15449,6 +15459,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
15449
15459
  conversationContext: input.conversationContext,
15450
15460
  conversationId: sessionConversationId,
15451
15461
  piMessages: sourceMessages,
15462
+ runtimeContext,
15452
15463
  signal: signal2,
15453
15464
  target,
15454
15465
  metadata: {
@@ -15462,7 +15473,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
15462
15473
  );
15463
15474
  handoffPhaseUsage = phaseUsage;
15464
15475
  pendingHandoff = {
15465
- messages: [...handoffMessages, ...runtimeContext],
15476
+ messages: handoffMessages,
15466
15477
  model: handoffModel,
15467
15478
  thinkingLevel: handoffThinkingLevel
15468
15479
  };
@@ -1,11 +1,15 @@
1
1
  // src/api/schema.ts
2
2
  import { z } from "zod";
3
3
  var conversationParamsSchema = z.object({ conversationId: z.string().min(1) }).strict();
4
+ var conversationFeedQuerySchema = z.object({
5
+ actorEmail: z.string().trim().email().transform((value) => value.toLowerCase()).optional()
6
+ }).strict();
4
7
  var subagentParamsSchema = conversationParamsSchema.extend({ subagentId: z.string().min(1) }).strict();
5
8
  var personParamsSchema = z.object({ email: z.string().trim().min(1) }).strict();
6
9
 
7
10
  export {
8
11
  conversationParamsSchema,
12
+ conversationFeedQuerySchema,
9
13
  subagentParamsSchema,
10
14
  personParamsSchema
11
15
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  conversationSummaryFromStoredConversation
3
- } from "./chunk-KJHAW6VE.js";
3
+ } from "./chunk-KFUSLFLL.js";
4
4
  import {
5
5
  buildSentryConversationUrl,
6
6
  buildSentryTraceUrl
@@ -14,6 +14,7 @@ import {
14
14
  getConversationMessageStore
15
15
  } from "./chunk-OGHXZ4KQ.js";
16
16
  import {
17
+ stripRuntimeTurnContext,
17
18
  unescapeXml,
18
19
  unwrapCurrentInstruction
19
20
  } from "./chunk-EEZCY5WX.js";
@@ -449,12 +450,19 @@ function historyContent(args) {
449
450
  (step) => step.entry.type === "context_epoch_started"
450
451
  );
451
452
  const projection = projectSteps(steps);
452
- const projected = projection.messages;
453
+ const projected = [];
454
+ const projectedProvenance = [];
455
+ projection.messages.forEach((message, index) => {
456
+ for (const retained of stripRuntimeTurnContext([message])) {
457
+ projected.push(retained);
458
+ projectedProvenance.push(projection.provenance[index]);
459
+ }
460
+ });
453
461
  const replacementSummaryIndex = marker?.entry.reason === "compaction" ? summaryIndex(
454
462
  projected,
455
- projection.provenance,
463
+ projectedProvenance,
456
464
  COMPACTION_SUMMARY_PREFIXES
457
- ) : marker?.entry.reason === "handoff" ? summaryIndex(projected, projection.provenance, [
465
+ ) : marker?.entry.reason === "handoff" ? summaryIndex(projected, projectedProvenance, [
458
466
  MODEL_HANDOFF_SUMMARY_PREFIX
459
467
  ]) : -1;
460
468
  const summary = replacementSummaryIndex >= 0 ? summaryAfterPrefix(
package/dist/cli/chat.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createAgentRunner,
3
3
  executeAgentRun
4
- } from "../chunk-DPHWDS6I.js";
4
+ } from "../chunk-PYK7R5A7.js";
5
5
  import "../chunk-WJ7STXT6.js";
6
6
  import "../chunk-6DTVCPLO.js";
7
7
  import "../chunk-OL6XQ23W.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  buildConversationDetail
3
- } from "./chunk-6HHEZENZ.js";
3
+ } from "./chunk-ZZUBLPXD.js";
4
4
  import {
5
5
  readConversationRecordFromSql
6
- } from "./chunk-KJHAW6VE.js";
6
+ } from "./chunk-KFUSLFLL.js";
7
7
  import {
8
8
  conversationDetailReportSchema
9
9
  } from "./chunk-EUZ44ROE.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readConversationFeedFromSql
3
- } from "./chunk-KJHAW6VE.js";
3
+ } from "./chunk-KFUSLFLL.js";
4
4
  import {
5
5
  conversationFeedSchema
6
6
  } from "./chunk-EUZ44ROE.js";
@@ -19,8 +19,10 @@ import "./chunk-7FBGKXPE.js";
19
19
  import "./chunk-MLKGABMK.js";
20
20
 
21
21
  // src/api/conversations/list.ts
22
- async function readConversationFeed() {
23
- return conversationFeedSchema.parse(await readConversationFeedFromSql());
22
+ async function readConversationFeed(options = {}) {
23
+ return conversationFeedSchema.parse(
24
+ await readConversationFeedFromSql({ actorEmail: options.actorEmail })
25
+ );
24
26
  }
25
27
  export {
26
28
  readConversationFeed
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readConversationFeedFromSql
3
- } from "./chunk-KJHAW6VE.js";
3
+ } from "./chunk-KFUSLFLL.js";
4
4
  import "./chunk-NG2AV7IB.js";
5
5
  import "./chunk-WTYEKPXU.js";
6
6
  import "./chunk-OGHXZ4KQ.js";
@@ -17,7 +17,7 @@ import "./chunk-MLKGABMK.js";
17
17
  // src/reporting/plugin-conversations.ts
18
18
  async function listRecentConversationSummaries(requestedLimit = 25) {
19
19
  const limit = Math.max(0, Math.min(100, Math.floor(requestedLimit)));
20
- const feed = await readConversationFeedFromSql(limit);
20
+ const feed = await readConversationFeedFromSql({ limit });
21
21
  return feed.conversations.map((report) => {
22
22
  return {
23
23
  conversationId: report.conversationId,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  buildConversationSubagent
3
- } from "./chunk-6HHEZENZ.js";
3
+ } from "./chunk-ZZUBLPXD.js";
4
4
  import {
5
5
  readConversationRecordFromSql
6
- } from "./chunk-KJHAW6VE.js";
6
+ } from "./chunk-KFUSLFLL.js";
7
7
  import {
8
8
  conversationSubagentTranscriptReportSchema
9
9
  } from "./chunk-EUZ44ROE.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior",
3
- "version": "0.98.0",
3
+ "version": "0.99.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -75,7 +75,7 @@
75
75
  "pg": "^8.16.3",
76
76
  "yaml": "^2.9.0",
77
77
  "zod": "^4.4.3",
78
- "@sentry/junior-plugin-api": "0.98.0"
78
+ "@sentry/junior-plugin-api": "0.99.0"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@emnapi/core": "^1.10.0",
@@ -92,10 +92,10 @@
92
92
  "typescript": "^6.0.3",
93
93
  "vercel": "^54.4.0",
94
94
  "vitest": "^4.1.7",
95
- "@sentry/junior-github": "0.98.0",
96
- "@sentry/junior-memory": "0.98.0",
95
+ "@sentry/junior-memory": "0.99.0",
97
96
  "@sentry/junior-testing": "0.0.0",
98
- "@sentry/junior-scheduler": "0.98.0"
97
+ "@sentry/junior-scheduler": "0.99.0",
98
+ "@sentry/junior-github": "0.99.0"
99
99
  },
100
100
  "scripts": {
101
101
  "build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",