@sentry/junior 0.102.0 → 0.102.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.
@@ -1,3 +1,3 @@
1
1
  import type { ConversationStatsReport } from "./schema";
2
- /** Build complete seven-day dashboard stats from normalized durable SQL records. */
2
+ /** Build complete 90-day dashboard stats from normalized durable SQL records. */
3
3
  export declare function readConversationStatsFromSql(): Promise<ConversationStatsReport>;
@@ -1,5 +1,10 @@
1
1
  /** Expose public conversation destinations as the dashboard's location index. */
2
2
  export declare function readLocationDirectory(): Promise<{
3
+ activityDays: {
4
+ date: string;
5
+ privateConversations: number;
6
+ publicConversations: number;
7
+ }[];
3
8
  generatedAt: string;
4
9
  locations: {
5
10
  active: number;
@@ -27,4 +32,6 @@ export declare function readLocationDirectory(): Promise<{
27
32
  tokens?: number | undefined;
28
33
  };
29
34
  source: "conversation_index";
35
+ windowEnd: string;
36
+ windowStart: string;
30
37
  }>;
@@ -37,7 +37,17 @@ export declare const locationActorSummaryReportSchema: z.ZodObject<{
37
37
  slackUserName: z.ZodOptional<z.ZodString>;
38
38
  }, z.core.$strict>;
39
39
  }, z.core.$strict>;
40
+ export declare const locationActivityDayReportSchema: z.ZodObject<{
41
+ date: z.ZodString;
42
+ privateConversations: z.ZodNumber;
43
+ publicConversations: z.ZodNumber;
44
+ }, z.core.$strict>;
40
45
  export declare const locationDirectoryReportSchema: z.ZodObject<{
46
+ activityDays: z.ZodArray<z.ZodObject<{
47
+ date: z.ZodString;
48
+ privateConversations: z.ZodNumber;
49
+ publicConversations: z.ZodNumber;
50
+ }, z.core.$strict>>;
41
51
  generatedAt: z.ZodString;
42
52
  locations: z.ZodArray<z.ZodObject<{
43
53
  active: z.ZodNumber;
@@ -72,6 +82,8 @@ export declare const locationDirectoryReportSchema: z.ZodObject<{
72
82
  tokens: z.ZodOptional<z.ZodNumber>;
73
83
  }, z.core.$strict>;
74
84
  source: z.ZodLiteral<"conversation_index">;
85
+ windowEnd: z.ZodString;
86
+ windowStart: z.ZodString;
75
87
  }, z.core.$strict>;
76
88
  export declare const locationDetailReportSchema: z.ZodObject<{
77
89
  active: z.ZodNumber;
@@ -171,5 +183,6 @@ export declare const locationDetailReportSchema: z.ZodObject<{
171
183
  }, z.core.$strict>;
172
184
  export type LocationSummaryReport = z.infer<typeof locationSummaryReportSchema>;
173
185
  export type LocationActorSummaryReport = z.infer<typeof locationActorSummaryReportSchema>;
186
+ export type LocationActivityDayReport = z.infer<typeof locationActivityDayReportSchema>;
174
187
  export type LocationDirectoryReport = z.infer<typeof locationDirectoryReportSchema>;
175
188
  export type LocationDetailReport = z.infer<typeof locationDetailReportSchema>;
@@ -1,6 +1,6 @@
1
1
  import type { ActorActivityDayReport, ConversationStatsItem, ActorTotalsReport } from "./schema";
2
2
  export declare const RECENT_LIMIT = 25;
3
- export declare const ACTIVITY_DAYS = 366;
3
+ export declare const ACTIVITY_DAYS = 90;
4
4
  /** Normalize emails before matching people API rows. */
5
5
  export declare function normalizeEmail(email: string | undefined): string | undefined;
6
6
  /** Build a zeroed totals object for people API aggregations. */
@@ -3,8 +3,8 @@ export type { DailyConversationActivity } from "./activity";
3
3
  export { conversationDetailReportSchema, conversationFeedSchema, conversationStatsReportSchema, conversationSubagentTranscriptReportSchema, } from "./conversations/schema";
4
4
  export type { ActorIdentity, ConversationActivityReport, ConversationActivityStatus, ConversationContextEvent, ConversationCost, ConversationDetailReport, ConversationFeed, ConversationReportStatus, ConversationStatsItem, ConversationStatsReport, ConversationSubagentActivityReport, ConversationSubagentTranscriptReport, ConversationSummaryReport, ConversationSurface, ConversationToolActivityReport, ConversationUsage, TranscriptMessage, TranscriptPart, TranscriptPartType, TranscriptRole, } from "./conversations/schema";
5
5
  export { actorDirectoryReportSchema, actorProfileReportSchema, } from "./people/schema";
6
- export { locationDetailReportSchema, locationDirectoryReportSchema, } from "./locations/schema";
7
- export type { LocationActorSummaryReport, LocationDetailReport, LocationDirectoryReport, LocationSummaryReport, } from "./locations/schema";
6
+ export { locationActivityDayReportSchema, locationDetailReportSchema, locationDirectoryReportSchema, } from "./locations/schema";
7
+ export type { LocationActorSummaryReport, LocationActivityDayReport, LocationDetailReport, LocationDirectoryReport, LocationSummaryReport, } from "./locations/schema";
8
8
  export type { ActorActivityDayReport, ActorDirectoryReport, ActorProfileReport, ActorSummaryReport, ActorTotalsReport, PeopleActivityDayReport, } from "./people/schema";
9
9
  export { healthReportSchema, pluginOperationalReportFeedSchema, pluginOperationalReportSchema, pluginPackageContentItemReportSchema, pluginPackageContentReportSchema, pluginReportSchema, pluginReportsSchema, runtimeInfoReportSchema, skillReportSchema, skillReportsSchema, } from "../reporting-schema";
10
10
  export type { HealthReport, PluginOperationalReport, PluginOperationalReportFeed, PluginPackageContentItemReport, PluginPackageContentReport, PluginReport, PluginReports, RuntimeInfoReport, SkillReport, SkillReports, } from "../reporting-schema";
@@ -7,9 +7,10 @@ import {
7
7
  } from "../chunk-2RNOB32R.js";
8
8
  import {
9
9
  dailyConversationActivitySchema,
10
+ locationActivityDayReportSchema,
10
11
  locationDetailReportSchema,
11
12
  locationDirectoryReportSchema
12
- } from "../chunk-HNIT4HXU.js";
13
+ } from "../chunk-WPHCUGN7.js";
13
14
  import {
14
15
  actorDirectoryReportSchema,
15
16
  actorProfileReportSchema
@@ -46,6 +47,7 @@ export {
46
47
  conversationSubagentTranscriptReportSchema,
47
48
  dailyConversationActivitySchema,
48
49
  healthReportSchema,
50
+ locationActivityDayReportSchema,
49
51
  locationDetailReportSchema,
50
52
  locationDirectoryReportSchema,
51
53
  locationParamsSchema,
package/dist/api.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  personParamsSchema,
6
6
  subagentParamsSchema
7
7
  } from "./chunk-2RNOB32R.js";
8
- import "./chunk-HNIT4HXU.js";
8
+ import "./chunk-WPHCUGN7.js";
9
9
  import "./chunk-4YN2ZXKB.js";
10
10
  import "./chunk-HYDQULR2.js";
11
11
  import {
@@ -134,7 +134,7 @@ function createJuniorApi() {
134
134
  return Response.json(await readConversationFeed({ actorEmail }));
135
135
  });
136
136
  app.get("/api/conversations/stats", async () => {
137
- const { readConversationStats } = await import("./stats-ZYFQFCTL.js");
137
+ const { readConversationStats } = await import("./stats-7UFY6FPE.js");
138
138
  return Response.json(await readConversationStats());
139
139
  });
140
140
  app.get("/api/conversations/:conversationId", async (c) => {
@@ -159,21 +159,21 @@ function createJuniorApi() {
159
159
  }
160
160
  );
161
161
  app.get("/api/people", async () => {
162
- const { readPeopleList } = await import("./list-UMZKA5AI.js");
162
+ const { readPeopleList } = await import("./list-NTUT6A5M.js");
163
163
  return Response.json(await readPeopleList());
164
164
  });
165
165
  app.get("/api/people/:email", async (c) => {
166
166
  const { email } = parseParams(personParamsSchema, c.req.param());
167
- const { readPeopleProfile } = await import("./profile-CQMPFKED.js");
167
+ const { readPeopleProfile } = await import("./profile-3FRQP4HP.js");
168
168
  return Response.json(await readPeopleProfile(email));
169
169
  });
170
170
  app.get("/api/locations", async () => {
171
- const { readLocationDirectory } = await import("./list-Z3CC52CZ.js");
171
+ const { readLocationDirectory } = await import("./list-FWLIZHSW.js");
172
172
  return Response.json(await readLocationDirectory());
173
173
  });
174
174
  app.get("/api/locations/:locationId", async (c) => {
175
175
  const { locationId } = parseParams(locationParamsSchema, c.req.param());
176
- const { readLocationDetail } = await import("./detail-U6IP2Z4N.js");
176
+ const { readLocationDetail } = await import("./detail-V37NTVBN.js");
177
177
  const report = await readLocationDetail(locationId);
178
178
  return report ? Response.json(report) : Response.json({ error: "Location not found." }, { status: 404 });
179
179
  });
package/dist/app.js CHANGED
@@ -11747,6 +11747,7 @@ function dashboardHostRoutePaths(dashboard) {
11747
11747
  return [
11748
11748
  ...pagePaths,
11749
11749
  "/favicon.ico",
11750
+ "/_junior/dashboard/avatar.png",
11750
11751
  "/_junior/dashboard/client.js",
11751
11752
  loginPath,
11752
11753
  "/api/health",
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-F4CQEUTP.js";
8
8
  import {
9
9
  activityDays
10
- } from "./chunk-HNIT4HXU.js";
10
+ } from "./chunk-WPHCUGN7.js";
11
11
  import {
12
12
  getDb,
13
13
  juniorConversations,
@@ -21,7 +21,7 @@ import {
21
21
  // src/api/locations/query.ts
22
22
  import { and, asc, desc, eq, gte, isNull, sql } from "drizzle-orm";
23
23
  var RECENT_LIMIT = 25;
24
- var ACTIVITY_DAYS = 30;
24
+ var ACTIVITY_DAYS = 90;
25
25
  function emptyMetrics() {
26
26
  return {
27
27
  active: 0,
@@ -117,9 +117,62 @@ async function directoryRows(db) {
117
117
  eq(juniorDestinations.id, juniorConversations.destinationId)
118
118
  ).where(topLevelWhere()).groupBy(...locationGroupBy());
119
119
  }
120
+ async function directoryActivityRows(db, start) {
121
+ const date = sql`TO_CHAR(
122
+ ${juniorConversations.lastActivityAt} AT TIME ZONE 'UTC',
123
+ 'YYYY-MM-DD'
124
+ )`;
125
+ return db.select({
126
+ conversations: sql`COUNT(*)::integer`,
127
+ date,
128
+ visibility: juniorDestinations.visibility
129
+ }).from(juniorConversations).leftJoin(
130
+ juniorDestinations,
131
+ eq(juniorDestinations.id, juniorConversations.destinationId)
132
+ ).where(and(topLevelWhere(), gte(juniorConversations.lastActivityAt, start))).groupBy(date, juniorDestinations.visibility);
133
+ }
134
+ function directoryActivityDays(rows, nowMs) {
135
+ const days = /* @__PURE__ */ new Map();
136
+ for (const row of rows) {
137
+ const day = days.get(row.date) ?? {
138
+ date: row.date,
139
+ privateConversations: 0,
140
+ publicConversations: 0
141
+ };
142
+ if (row.visibility === "public") {
143
+ day.publicConversations += row.conversations;
144
+ } else {
145
+ day.privateConversations += row.conversations;
146
+ }
147
+ days.set(row.date, day);
148
+ }
149
+ const end = new Date(nowMs);
150
+ end.setUTCHours(0, 0, 0, 0);
151
+ const start = new Date(end);
152
+ start.setUTCDate(start.getUTCDate() - (ACTIVITY_DAYS - 1));
153
+ const activity = [];
154
+ for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setUTCDate(cursor.getUTCDate() + 1)) {
155
+ const date = cursor.toISOString().slice(0, 10);
156
+ activity.push(
157
+ days.get(date) ?? {
158
+ date,
159
+ privateConversations: 0,
160
+ publicConversations: 0
161
+ }
162
+ );
163
+ }
164
+ return activity;
165
+ }
120
166
  async function readLocationDirectoryFromSql() {
121
167
  const nowMs = Date.now();
122
- const rows = await directoryRows(getDb());
168
+ const end = new Date(nowMs);
169
+ end.setUTCHours(0, 0, 0, 0);
170
+ const start = new Date(end);
171
+ start.setUTCDate(start.getUTCDate() - (ACTIVITY_DAYS - 1));
172
+ const [rows, activityRows] = await Promise.all([
173
+ directoryRows(getDb()),
174
+ directoryActivityRows(getDb(), start)
175
+ ]);
123
176
  const locations = [];
124
177
  const privateActivity = {
125
178
  ...emptyMetrics(),
@@ -131,12 +184,15 @@ async function readLocationDirectoryFromSql() {
131
184
  else addMetrics(privateActivity, row);
132
185
  }
133
186
  return {
187
+ activityDays: directoryActivityDays(activityRows, nowMs),
134
188
  generatedAt: new Date(nowMs).toISOString(),
135
189
  locations: locations.sort(
136
190
  (left, right) => Date.parse(right.lastSeenAt) - Date.parse(left.lastSeenAt) || right.conversations - left.conversations || left.label.localeCompare(right.label)
137
191
  ),
138
192
  privateActivity,
139
- source: "conversation_index"
193
+ source: "conversation_index",
194
+ windowEnd: end.toISOString(),
195
+ windowStart: start.toISOString()
140
196
  };
141
197
  }
142
198
  async function recentLocationRows(db, locationId) {
@@ -11,7 +11,7 @@ import {
11
11
  // src/api/people/shared.ts
12
12
  import { and, asc, desc, eq, sql } from "drizzle-orm";
13
13
  var RECENT_LIMIT = 25;
14
- var ACTIVITY_DAYS = 366;
14
+ var ACTIVITY_DAYS = 90;
15
15
  function normalizeEmail(email) {
16
16
  const normalized = email?.trim().toLowerCase();
17
17
  return normalized || void 0;
@@ -51,11 +51,19 @@ var locationSummaryReportSchema = conversationStatsItemSchema.extend({
51
51
  visibility: z2.literal("public")
52
52
  }).strict();
53
53
  var locationActorSummaryReportSchema = conversationStatsItemSchema.extend({ actor: actorIdentitySchema }).strict();
54
+ var locationActivityDayReportSchema = z2.object({
55
+ date: z2.string(),
56
+ privateConversations: z2.number(),
57
+ publicConversations: z2.number()
58
+ }).strict();
54
59
  var locationDirectoryReportSchema = z2.object({
60
+ activityDays: z2.array(locationActivityDayReportSchema),
55
61
  generatedAt: z2.string(),
56
62
  locations: z2.array(locationSummaryReportSchema),
57
63
  privateActivity: conversationStatsItemSchema,
58
- source: z2.literal("conversation_index")
64
+ source: z2.literal("conversation_index"),
65
+ windowEnd: z2.string(),
66
+ windowStart: z2.string()
59
67
  }).strict();
60
68
  var locationDetailReportSchema = locationSummaryReportSchema.extend({
61
69
  activityDays: z2.array(dailyConversationActivitySchema),
@@ -70,6 +78,7 @@ var locationDetailReportSchema = locationSummaryReportSchema.extend({
70
78
  export {
71
79
  dailyConversationActivitySchema,
72
80
  activityDays,
81
+ locationActivityDayReportSchema,
73
82
  locationDirectoryReportSchema,
74
83
  locationDetailReportSchema
75
84
  };
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  readLocationDetailFromSql
3
- } from "./chunk-MR6H67P2.js";
3
+ } from "./chunk-4XNQSJAX.js";
4
4
  import "./chunk-QOZOJNSE.js";
5
5
  import "./chunk-F4CQEUTP.js";
6
6
  import {
7
7
  locationDetailReportSchema
8
- } from "./chunk-HNIT4HXU.js";
8
+ } from "./chunk-WPHCUGN7.js";
9
9
  import "./chunk-HYDQULR2.js";
10
10
  import "./chunk-PDO5BLNM.js";
11
11
  import "./chunk-QZGVPPIJ.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  readLocationDirectoryFromSql
3
- } from "./chunk-MR6H67P2.js";
3
+ } from "./chunk-4XNQSJAX.js";
4
4
  import "./chunk-QOZOJNSE.js";
5
5
  import "./chunk-F4CQEUTP.js";
6
6
  import {
7
7
  locationDirectoryReportSchema
8
- } from "./chunk-HNIT4HXU.js";
8
+ } from "./chunk-WPHCUGN7.js";
9
9
  import "./chunk-HYDQULR2.js";
10
10
  import "./chunk-PDO5BLNM.js";
11
11
  import "./chunk-QZGVPPIJ.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  verifiedActorWhere
3
- } from "./chunk-E4EMFKGB.js";
3
+ } from "./chunk-KFP3TZOS.js";
4
4
  import {
5
5
  conversationActiveDaysColumn,
6
6
  conversationAggregateColumns,
@@ -11,7 +11,7 @@ import {
11
11
  recentActorRows,
12
12
  statsItems,
13
13
  verifiedActorWhere
14
- } from "./chunk-E4EMFKGB.js";
14
+ } from "./chunk-KFP3TZOS.js";
15
15
  import {
16
16
  conversationActiveDaysColumn,
17
17
  conversationAggregateColumns
@@ -25,7 +25,7 @@ import "./chunk-MLKGABMK.js";
25
25
 
26
26
  // src/api/conversations/stats.query.ts
27
27
  import { and, eq, gte, isNull, lte } from "drizzle-orm";
28
- var WINDOW_MS = 7 * 24 * 60 * 60 * 1e3;
28
+ var WINDOW_MS = 90 * 24 * 60 * 60 * 1e3;
29
29
  function emptyStatsItem(label) {
30
30
  return {
31
31
  active: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior",
3
- "version": "0.102.0",
3
+ "version": "0.102.1",
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.102.0"
78
+ "@sentry/junior-plugin-api": "0.102.1"
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.102.0",
96
- "@sentry/junior-scheduler": "0.102.0",
97
- "@sentry/junior-memory": "0.102.0",
98
- "@sentry/junior-testing": "0.0.0"
95
+ "@sentry/junior-github": "0.102.1",
96
+ "@sentry/junior-memory": "0.102.1",
97
+ "@sentry/junior-testing": "0.0.0",
98
+ "@sentry/junior-scheduler": "0.102.1"
99
99
  },
100
100
  "scripts": {
101
101
  "build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",