@sentry/junior 0.116.1 → 0.118.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.
Files changed (93) hide show
  1. package/dist/{agent-hooks-GUAAS3XH.js → agent-hooks-J2FB7XD6.js} +8 -10
  2. package/dist/api/conversations/detail.d.ts +7 -0
  3. package/dist/api/conversations/event-list.d.ts +7 -0
  4. package/dist/api/conversations/events.d.ts +1 -1
  5. package/dist/api/schema/conversation.d.ts +28 -0
  6. package/dist/api/schema/stats.d.ts +22 -0
  7. package/dist/api/schema.d.ts +2 -0
  8. package/dist/api/schema.js +7 -3
  9. package/dist/api/stats.d.ts +16 -0
  10. package/dist/api/user-pages/routes.d.ts +4 -0
  11. package/dist/api.js +192 -18
  12. package/dist/app.js +53 -46
  13. package/dist/{catalog-runtime-WMPC4J4U.js → catalog-runtime-UHHLU53I.js} +5 -5
  14. package/dist/chat/agent/prompt.d.ts +6 -2
  15. package/dist/chat/agent/request.d.ts +2 -1
  16. package/dist/chat/agent/resume.d.ts +2 -0
  17. package/dist/chat/agent/tools.d.ts +1 -0
  18. package/dist/chat/conversations/history.d.ts +22 -1
  19. package/dist/chat/conversations/projection.d.ts +6 -0
  20. package/dist/chat/mcp/client.d.ts +4 -0
  21. package/dist/chat/mcp/errors.d.ts +22 -1
  22. package/dist/chat/oauth-response.d.ts +21 -0
  23. package/dist/chat/plugins/prompt.d.ts +9 -0
  24. package/dist/chat/plugins/types.d.ts +2 -21
  25. package/dist/chat/plugins/user-pages.d.ts +15 -0
  26. package/dist/chat/plugins/viewer-actors.d.ts +6 -0
  27. package/dist/chat/prompt.d.ts +1 -2
  28. package/dist/chat/sandbox/paths.d.ts +2 -0
  29. package/dist/chat/sandbox/sandbox.d.ts +3 -1
  30. package/dist/chat/sandbox/snapshot/install.d.ts +6 -0
  31. package/dist/chat/sandbox/snapshot/profile.d.ts +14 -0
  32. package/dist/chat/sandbox/snapshot/resolve.d.ts +22 -0
  33. package/dist/chat/sandbox/snapshot/span.d.ts +2 -0
  34. package/dist/chat/sandbox/workspace.d.ts +1 -0
  35. package/dist/chat/services/context-compaction-marker.d.ts +1 -0
  36. package/dist/chat/services/turn-session-record.d.ts +2 -0
  37. package/dist/chat/skills.d.ts +1 -2
  38. package/dist/chat/state/turn-session.d.ts +2 -0
  39. package/dist/chat/tools/index.d.ts +4 -1
  40. package/dist/chat/tools/query-conversation-events.d.ts +1 -1
  41. package/dist/chat/tools/sandbox/file-utils.d.ts +11 -0
  42. package/dist/chat/tools/sandbox/find-files.d.ts +2 -1
  43. package/dist/chat/tools/sandbox/grep.d.ts +2 -1
  44. package/dist/chat/tools/sandbox/view-image.d.ts +11 -0
  45. package/dist/chat/tools/types.d.ts +7 -0
  46. package/dist/{chunk-XA3VLFPK.js → chunk-3LGCVRBQ.js} +154 -20
  47. package/dist/{chunk-JPKGW6L6.js → chunk-3MUSSFMP.js} +78 -39
  48. package/dist/{chunk-7CSVG54J.js → chunk-3N3FMCKN.js} +30 -2
  49. package/dist/{chunk-VBMMMVVQ.js → chunk-4LPPH7Y6.js} +405 -446
  50. package/dist/{chunk-2YYPXQNQ.js → chunk-4SOQPUF4.js} +1 -1
  51. package/dist/{chunk-H35BDAUS.js → chunk-6BGUAOYP.js} +8 -8
  52. package/dist/{chunk-GDAXWEIJ.js → chunk-6K2QE2UI.js} +731 -424
  53. package/dist/{chunk-DLLW5ITL.js → chunk-7GADTCNS.js} +30 -9
  54. package/dist/{chunk-TC4ZEM2D.js → chunk-7SM3P4XR.js} +28 -1
  55. package/dist/{chunk-WKU7TY22.js → chunk-FIANEE7Z.js} +3 -1
  56. package/dist/{chunk-RXRQJF7Y.js → chunk-GCGJGSQL.js} +21 -0
  57. package/dist/{chunk-ZYHLNTC2.js → chunk-GT2ZUALJ.js} +584 -25
  58. package/dist/{chunk-KNCELO2M.js → chunk-HN6LFYG3.js} +1 -1
  59. package/dist/{chunk-N3C4XCRE.js → chunk-HWUBBHLK.js} +1 -1
  60. package/dist/{chunk-BFYVIOTS.js → chunk-KC5EE27Y.js} +13 -3
  61. package/dist/chunk-L72GDKSN.js +37 -0
  62. package/dist/{chunk-F3SWGSPG.js → chunk-MLZFK4KP.js} +1 -1
  63. package/dist/{chunk-RYFAVWP3.js → chunk-PJPKHGLG.js} +34 -15
  64. package/dist/{chunk-CY7NXM32.js → chunk-PWRFTDTY.js} +4 -2
  65. package/dist/{chunk-WLT72MRP.js → chunk-QWCF4RAC.js} +1 -1
  66. package/dist/{chunk-CGXLCMWI.js → chunk-S6R23MFB.js} +117 -17
  67. package/dist/{chunk-OY2PQQ4P.js → chunk-UXLYAVYL.js} +1 -1
  68. package/dist/cli/chat.js +23 -24
  69. package/dist/cli/check.js +6 -6
  70. package/dist/cli/main.js +1 -1
  71. package/dist/cli/plugins.js +12 -14
  72. package/dist/cli/{snapshot-warmup.js → snapshot-create.js} +17 -20
  73. package/dist/cli/upgrade.js +7 -7
  74. package/dist/db/schema/stats.d.ts +93 -0
  75. package/dist/db/schema.d.ts +94 -1
  76. package/dist/{db-FH4R5ZQ4.js → db-PMRHFSYL.js} +6 -6
  77. package/dist/handlers/oauth-html.d.ts +4 -2
  78. package/dist/instrumentation.js +2 -2
  79. package/dist/nitro.js +3 -3
  80. package/dist/{oauth-callback-server-C2SSJ3FQ.js → oauth-callback-server-QJUC7S4X.js} +15 -17
  81. package/dist/{plugins-IUJA4VBU.js → plugins-HW4VWW6G.js} +1 -1
  82. package/dist/{runner-NAALFIXM.js → runner-PZMV6JQW.js} +10 -12
  83. package/dist/{skills-UN2JXYYF.js → skills-W4JETYSV.js} +6 -6
  84. package/dist/stats.d.ts +18 -0
  85. package/dist/{validation-EEF4ROHR.js → validation-IJLNHZSU.js} +6 -6
  86. package/dist/version.js +1 -1
  87. package/migrations/0011_sour_golden_guardian.sql +8 -0
  88. package/migrations/meta/0011_snapshot.json +1195 -0
  89. package/migrations/meta/_journal.json +8 -1
  90. package/package.json +5 -5
  91. package/dist/chat/sandbox/runtime-dependency-snapshots.d.ts +0 -20
  92. package/dist/chunk-4ZNGQH7C.js +0 -25
  93. package/dist/chunk-FAEALXEH.js +0 -517
@@ -11,22 +11,20 @@ import {
11
11
  getPlugins,
12
12
  setPlugins,
13
13
  validatePlugins
14
- } from "./chunk-ZYHLNTC2.js";
15
- import "./chunk-7CSVG54J.js";
16
- import "./chunk-FAEALXEH.js";
17
- import "./chunk-BFYVIOTS.js";
18
- import "./chunk-RXRQJF7Y.js";
19
- import "./chunk-4ZNGQH7C.js";
20
- import "./chunk-CY7NXM32.js";
14
+ } from "./chunk-GT2ZUALJ.js";
15
+ import "./chunk-KC5EE27Y.js";
16
+ import "./chunk-GCGJGSQL.js";
17
+ import "./chunk-3N3FMCKN.js";
18
+ import "./chunk-PWRFTDTY.js";
21
19
  import "./chunk-VFUK3X5B.js";
22
20
  import "./chunk-FXOYURO4.js";
23
21
  import "./chunk-HZF5P5UN.js";
24
- import "./chunk-F3SWGSPG.js";
22
+ import "./chunk-MLZFK4KP.js";
25
23
  import "./chunk-OB42YVAE.js";
26
24
  import "./chunk-F3B2YJ76.js";
27
25
  import "./chunk-6GWA276C.js";
28
- import "./chunk-WLT72MRP.js";
29
- import "./chunk-N3C4XCRE.js";
26
+ import "./chunk-QWCF4RAC.js";
27
+ import "./chunk-HWUBBHLK.js";
30
28
  import "./chunk-MLKGABMK.js";
31
29
  export {
32
30
  PluginHookDeniedError,
@@ -137,6 +137,13 @@ declare const _default: import("../route").ApiRoute<import("zod").ZodObject<{
137
137
  agent: "agent";
138
138
  }>;
139
139
  }, import("zod/v4/core").$strict>], "state">, import("zod").ZodObject<{
140
+ type: import("zod").ZodLiteral<"turn_context">;
141
+ turnId: import("zod").ZodString;
142
+ pluginName: import("zod").ZodString;
143
+ kind: import("zod").ZodString;
144
+ version: import("zod").ZodNumber;
145
+ content: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
146
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
140
147
  type: import("zod").ZodLiteral<"turn_routed">;
141
148
  turnId: import("zod").ZodString;
142
149
  modelProfile: import("zod").ZodString;
@@ -54,6 +54,13 @@ declare const _default: import("../route").ApiRoute<import("zod").ZodObject<{
54
54
  agent: "agent";
55
55
  }>;
56
56
  }, import("zod/v4/core").$strict>], "state">, import("zod").ZodObject<{
57
+ type: import("zod").ZodLiteral<"turn_context">;
58
+ turnId: import("zod").ZodString;
59
+ pluginName: import("zod").ZodString;
60
+ kind: import("zod").ZodString;
61
+ version: import("zod").ZodNumber;
62
+ content: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
63
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
57
64
  type: import("zod").ZodLiteral<"turn_routed">;
58
65
  turnId: import("zod").ZodString;
59
66
  modelProfile: import("zod").ZodString;
@@ -1,7 +1,7 @@
1
1
  import type { ConversationEvent } from "@/chat/conversations/history";
2
2
  import { type ConversationReportEvent } from "../schema/conversation";
3
3
  /** Canonical event types that can contribute to the reporting projection. */
4
- export declare const conversationReportSourceEventTypes: readonly ["message", "message_handled", "assistant_message", "tool_result", "tool_execution_started", "turn_started", "turn_routed", "turn_completed", "turn_failed", "compaction", "handoff", "subagent_started", "subagent_ended"];
4
+ export declare const conversationReportSourceEventTypes: readonly ["message", "message_handled", "assistant_message", "tool_result", "tool_execution_started", "turn_started", "turn_context", "turn_routed", "turn_completed", "turn_failed", "compaction", "handoff", "subagent_started", "subagent_ended"];
5
5
  /** Return tool result ids that may need start metadata from outside a page. */
6
6
  export declare function conversationReportToolResultIds(events: ConversationEvent[]): string[];
7
7
  /**
@@ -153,6 +153,13 @@ export declare const conversationReportEventDataSchema: z.ZodDiscriminatedUnion<
153
153
  agent: "agent";
154
154
  }>;
155
155
  }, z.core.$strict>], "state">, z.ZodObject<{
156
+ type: z.ZodLiteral<"turn_context">;
157
+ turnId: z.ZodString;
158
+ pluginName: z.ZodString;
159
+ kind: z.ZodString;
160
+ version: z.ZodNumber;
161
+ content: z.ZodRecord<z.ZodString, z.ZodUnknown>;
162
+ }, z.core.$strict>, z.ZodObject<{
156
163
  type: z.ZodLiteral<"turn_routed">;
157
164
  turnId: z.ZodString;
158
165
  modelProfile: z.ZodString;
@@ -250,6 +257,13 @@ export declare const conversationReportEventSchema: z.ZodObject<{
250
257
  agent: "agent";
251
258
  }>;
252
259
  }, z.core.$strict>], "state">, z.ZodObject<{
260
+ type: z.ZodLiteral<"turn_context">;
261
+ turnId: z.ZodString;
262
+ pluginName: z.ZodString;
263
+ kind: z.ZodString;
264
+ version: z.ZodNumber;
265
+ content: z.ZodRecord<z.ZodString, z.ZodUnknown>;
266
+ }, z.core.$strict>, z.ZodObject<{
253
267
  type: z.ZodLiteral<"turn_routed">;
254
268
  turnId: z.ZodString;
255
269
  modelProfile: z.ZodString;
@@ -458,6 +472,13 @@ export declare const conversationDetailReportSchema: z.ZodObject<{
458
472
  agent: "agent";
459
473
  }>;
460
474
  }, z.core.$strict>], "state">, z.ZodObject<{
475
+ type: z.ZodLiteral<"turn_context">;
476
+ turnId: z.ZodString;
477
+ pluginName: z.ZodString;
478
+ kind: z.ZodString;
479
+ version: z.ZodNumber;
480
+ content: z.ZodRecord<z.ZodString, z.ZodUnknown>;
481
+ }, z.core.$strict>, z.ZodObject<{
461
482
  type: z.ZodLiteral<"turn_routed">;
462
483
  turnId: z.ZodString;
463
484
  modelProfile: z.ZodString;
@@ -569,6 +590,13 @@ export declare const conversationEventPageSchema: z.ZodObject<{
569
590
  agent: "agent";
570
591
  }>;
571
592
  }, z.core.$strict>], "state">, z.ZodObject<{
593
+ type: z.ZodLiteral<"turn_context">;
594
+ turnId: z.ZodString;
595
+ pluginName: z.ZodString;
596
+ kind: z.ZodString;
597
+ version: z.ZodNumber;
598
+ content: z.ZodRecord<z.ZodString, z.ZodUnknown>;
599
+ }, z.core.$strict>, z.ZodObject<{
572
600
  type: z.ZodLiteral<"turn_routed">;
573
601
  turnId: z.ZodString;
574
602
  modelProfile: z.ZodString;
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+ export declare const statSchema: z.ZodObject<{
3
+ count: z.ZodNumber;
4
+ date: z.ZodString;
5
+ metric: z.ZodString;
6
+ name: z.ZodString;
7
+ namespace: z.ZodString;
8
+ }, z.core.$strict>;
9
+ export declare const statsReportSchema: z.ZodObject<{
10
+ generatedAt: z.ZodString;
11
+ stats: z.ZodArray<z.ZodObject<{
12
+ count: z.ZodNumber;
13
+ date: z.ZodString;
14
+ metric: z.ZodString;
15
+ name: z.ZodString;
16
+ namespace: z.ZodString;
17
+ }, z.core.$strict>>;
18
+ windowEnd: z.ZodString;
19
+ windowStart: z.ZodString;
20
+ }, z.core.$strict>;
21
+ export type StatReport = z.infer<typeof statSchema>;
22
+ export type StatsReport = z.infer<typeof statsReportSchema>;
@@ -10,5 +10,7 @@ export { apiErrorSchema } from "./schema/common";
10
10
  export type { ApiError } from "./schema/common";
11
11
  export { createPersonalTokenBodySchema, createdPersonalTokenSchema, personalTokenListSchema, personalTokenMetadataSchema, personalTokenParamsSchema, revokePersonalTokenResponseSchema, } from "./schema/personal-token";
12
12
  export type { PersonalTokenMetadata } from "./schema/personal-token";
13
+ export { statSchema, statsReportSchema } from "./schema/stats";
14
+ export type { StatReport, StatsReport } from "./schema/stats";
13
15
  export { healthReportSchema, pluginOperationalReportFeedSchema, pluginOperationalReportSchema, pluginPackageContentItemReportSchema, pluginPackageContentReportSchema, pluginSchema, pluginsSchema, runtimeInfoReportSchema, skillReportSchema, skillReportsSchema, } from "../reporting-schema";
14
16
  export type { HealthReport, PluginOperationalReport, PluginOperationalReportFeed, PluginPackageContentItemReport, PluginPackageContentReport, Plugin, Plugins, RuntimeInfoReport, SkillReport, SkillReports, } from "../reporting-schema";
@@ -27,8 +27,10 @@ import {
27
27
  personalTokenListSchema,
28
28
  personalTokenMetadataSchema,
29
29
  personalTokenParamsSchema,
30
- revokePersonalTokenResponseSchema
31
- } from "../chunk-TC4ZEM2D.js";
30
+ revokePersonalTokenResponseSchema,
31
+ statSchema,
32
+ statsReportSchema
33
+ } from "../chunk-7SM3P4XR.js";
32
34
  import {
33
35
  healthReportSchema,
34
36
  pluginOperationalReportFeedSchema,
@@ -83,5 +85,7 @@ export {
83
85
  revokePersonalTokenResponseSchema,
84
86
  runtimeInfoReportSchema,
85
87
  skillReportSchema,
86
- skillReportsSchema
88
+ skillReportsSchema,
89
+ statSchema,
90
+ statsReportSchema
87
91
  };
@@ -0,0 +1,16 @@
1
+ import { type StatsReport } from "./schema/stats";
2
+ /** Read the last 90 days of named daily counters. */
3
+ export declare function readStatsReport(): Promise<StatsReport>;
4
+ declare const _default: import("./route").ApiRoute<import("zod").ZodObject<{
5
+ generatedAt: import("zod").ZodString;
6
+ stats: import("zod").ZodArray<import("zod").ZodObject<{
7
+ count: import("zod").ZodNumber;
8
+ date: import("zod").ZodString;
9
+ metric: import("zod").ZodString;
10
+ name: import("zod").ZodString;
11
+ namespace: import("zod").ZodString;
12
+ }, import("zod/v4/core").$strict>>;
13
+ windowEnd: import("zod").ZodString;
14
+ windowStart: import("zod").ZodString;
15
+ }, import("zod/v4/core").$strict>>;
16
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { Hono } from "hono";
2
+ import type { JuniorApiEnv } from "../route";
3
+ /** Create authenticated discovery and read routes for plugin user pages. */
4
+ export declare function createUserPageRoutes(): Hono<JuniorApiEnv>;
package/dist/api.js CHANGED
@@ -22,13 +22,14 @@ import {
22
22
  personParamsSchema,
23
23
  personalTokenListSchema,
24
24
  personalTokenParamsSchema,
25
- revokePersonalTokenResponseSchema
26
- } from "./chunk-TC4ZEM2D.js";
25
+ revokePersonalTokenResponseSchema,
26
+ statsReportSchema
27
+ } from "./chunk-7SM3P4XR.js";
27
28
  import {
28
29
  formatSlackConversationRedactedLabel,
29
30
  readHealthReport,
30
31
  resolveSlackConversationContextFromThreadId
31
- } from "./chunk-KNCELO2M.js";
32
+ } from "./chunk-HN6LFYG3.js";
32
33
  import {
33
34
  buildSentryConversationUrl
34
35
  } from "./chunk-4CODA7P5.js";
@@ -39,28 +40,33 @@ import {
39
40
  runtimeInfoReportSchema,
40
41
  skillReportsSchema
41
42
  } from "./chunk-PE44LDDQ.js";
43
+ import {
44
+ readStats
45
+ } from "./chunk-L72GDKSN.js";
42
46
  import {
43
47
  agentTurnUsageSchema,
44
48
  hasAgentTurnUsage
45
49
  } from "./chunk-MU6HHZEN.js";
46
50
  import "./chunk-PDO5BLNM.js";
47
51
  import {
52
+ createPluginLogger,
53
+ getPlugins,
48
54
  listConversationAnnotations
49
- } from "./chunk-FAEALXEH.js";
55
+ } from "./chunk-GT2ZUALJ.js";
50
56
  import {
51
57
  decodeStoredConversationEvent,
52
58
  getDb,
53
59
  getSqlExecutor
54
- } from "./chunk-BFYVIOTS.js";
60
+ } from "./chunk-KC5EE27Y.js";
55
61
  import {
56
62
  juniorApiTokens,
57
63
  juniorConversationEvents,
58
64
  juniorConversations,
59
65
  juniorIdentities,
60
66
  juniorUsers
61
- } from "./chunk-RXRQJF7Y.js";
62
- import "./chunk-4ZNGQH7C.js";
63
- import "./chunk-CY7NXM32.js";
67
+ } from "./chunk-GCGJGSQL.js";
68
+ import "./chunk-3N3FMCKN.js";
69
+ import "./chunk-PWRFTDTY.js";
64
70
  import {
65
71
  juniorDestinations
66
72
  } from "./chunk-VFUK3X5B.js";
@@ -68,16 +74,19 @@ import {
68
74
  canExposeConversationPayload,
69
75
  parseSlackThreadId
70
76
  } from "./chunk-FXOYURO4.js";
71
- import "./chunk-F3SWGSPG.js";
77
+ import "./chunk-HZF5P5UN.js";
78
+ import {
79
+ normalizeIdentityEmail
80
+ } from "./chunk-MLZFK4KP.js";
72
81
  import "./chunk-OB42YVAE.js";
73
82
  import "./chunk-F3B2YJ76.js";
74
83
  import "./chunk-6GWA276C.js";
75
- import "./chunk-WLT72MRP.js";
76
- import "./chunk-N3C4XCRE.js";
84
+ import "./chunk-QWCF4RAC.js";
85
+ import "./chunk-HWUBBHLK.js";
77
86
  import "./chunk-MLKGABMK.js";
78
87
 
79
88
  // src/api.ts
80
- import { Hono as Hono5 } from "hono";
89
+ import { Hono as Hono6 } from "hono";
81
90
 
82
91
  // src/api/conversations/routes.ts
83
92
  import { Hono } from "hono";
@@ -353,6 +362,7 @@ var conversationReportSourceEventTypes = [
353
362
  "tool_result",
354
363
  "tool_execution_started",
355
364
  "turn_started",
365
+ "turn_context",
356
366
  "turn_routed",
357
367
  "turn_completed",
358
368
  "turn_failed",
@@ -483,6 +493,18 @@ function reportEventData(args) {
483
493
  turnId: data.turnId,
484
494
  state: "started"
485
495
  };
496
+ case "turn_context":
497
+ if (!args.canExposePayload) {
498
+ return void 0;
499
+ }
500
+ return {
501
+ type: "turn_context",
502
+ turnId: data.turnId,
503
+ pluginName: data.pluginName,
504
+ kind: data.kind,
505
+ version: data.version,
506
+ content: data.content
507
+ };
486
508
  case "turn_routed":
487
509
  return {
488
510
  type: "turn_routed",
@@ -1677,7 +1699,7 @@ function readDescriptionText(home) {
1677
1699
  }
1678
1700
  }
1679
1701
  async function readSkillReports() {
1680
- const { discoverSkills } = await import("./skills-UN2JXYYF.js");
1702
+ const { discoverSkills } = await import("./skills-W4JETYSV.js");
1681
1703
  const skills = await discoverSkills();
1682
1704
  return skillReportsSchema.parse(
1683
1705
  skills.map((skill) => ({
@@ -1687,7 +1709,7 @@ async function readSkillReports() {
1687
1709
  );
1688
1710
  }
1689
1711
  async function readPlugins() {
1690
- const { pluginCatalogRuntime } = await import("./catalog-runtime-WMPC4J4U.js");
1712
+ const { pluginCatalogRuntime } = await import("./catalog-runtime-UHHLU53I.js");
1691
1713
  return pluginsSchema.parse(
1692
1714
  pluginCatalogRuntime.getProviders().map((plugin) => ({
1693
1715
  configKeys: plugin.manifest.configKeys ?? [],
@@ -1700,7 +1722,7 @@ async function readPlugins() {
1700
1722
  async function readRuntimeInfoReport() {
1701
1723
  const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
1702
1724
  import("./discovery-RMHYSRL7.js"),
1703
- import("./catalog-runtime-WMPC4J4U.js"),
1725
+ import("./catalog-runtime-UHHLU53I.js"),
1704
1726
  readPlugins(),
1705
1727
  readSkillReports()
1706
1728
  ]);
@@ -1716,7 +1738,7 @@ async function readRuntimeInfoReport() {
1716
1738
  }
1717
1739
  async function readPluginOperationalReportFeed() {
1718
1740
  const nowMs = Date.now();
1719
- const { getPluginOperationalReports } = await import("./agent-hooks-GUAAS3XH.js");
1741
+ const { getPluginOperationalReports } = await import("./agent-hooks-J2FB7XD6.js");
1720
1742
  return pluginOperationalReportFeedSchema.parse({
1721
1743
  source: "plugins",
1722
1744
  generatedAt: new Date(nowMs).toISOString(),
@@ -2786,6 +2808,133 @@ function createPersonalTokenRoutes() {
2786
2808
  return app;
2787
2809
  }
2788
2810
 
2811
+ // src/api/user-pages/routes.ts
2812
+ import { Hono as Hono5 } from "hono";
2813
+ import {
2814
+ pluginUserPageContentSchema as pluginUserPageContentSchema2,
2815
+ pluginUserPageLinksSchema as pluginUserPageLinksSchema2
2816
+ } from "@sentry/junior-plugin-api";
2817
+
2818
+ // src/chat/plugins/user-pages.ts
2819
+ import {
2820
+ pluginUserPageContentSchema,
2821
+ pluginUserPageLinksSchema
2822
+ } from "@sentry/junior-plugin-api";
2823
+
2824
+ // src/chat/plugins/viewer-actors.ts
2825
+ import { and as and12, eq as eq13 } from "drizzle-orm";
2826
+ import {
2827
+ actorSchema
2828
+ } from "@sentry/junior-plugin-api";
2829
+ async function readViewerActorsFromSql(db, email) {
2830
+ const normalizedEmail = normalizeIdentityEmail(email);
2831
+ if (!normalizedEmail) return [];
2832
+ const rows = await db.select({
2833
+ displayName: juniorIdentities.displayName,
2834
+ email: juniorUsers.primaryEmail,
2835
+ handle: juniorIdentities.handle,
2836
+ provider: juniorIdentities.provider,
2837
+ providerSubjectId: juniorIdentities.providerSubjectId,
2838
+ providerTenantId: juniorIdentities.providerTenantId
2839
+ }).from(juniorIdentities).innerJoin(juniorUsers, eq13(juniorUsers.id, juniorIdentities.userId)).where(
2840
+ and12(
2841
+ eq13(juniorUsers.primaryEmailNormalized, normalizedEmail),
2842
+ eq13(juniorIdentities.kind, "user")
2843
+ )
2844
+ );
2845
+ const actors = [];
2846
+ for (const row of rows) {
2847
+ const candidate = row.provider === "slack" ? {
2848
+ platform: "slack",
2849
+ teamId: row.providerTenantId,
2850
+ userId: row.providerSubjectId,
2851
+ email: row.email,
2852
+ ...row.displayName ? { fullName: row.displayName } : {},
2853
+ ...row.handle ? { userName: row.handle } : {}
2854
+ } : row.provider === "local" ? {
2855
+ platform: "local",
2856
+ userId: row.providerSubjectId,
2857
+ email: row.email,
2858
+ ...row.displayName ? { fullName: row.displayName } : {},
2859
+ ...row.handle ? { userName: row.handle } : {}
2860
+ } : void 0;
2861
+ if (!candidate) continue;
2862
+ const parsed = actorSchema.safeParse(candidate);
2863
+ if (parsed.success && parsed.data.platform !== "system") {
2864
+ actors.push(parsed.data);
2865
+ }
2866
+ }
2867
+ return actors;
2868
+ }
2869
+ async function readViewerActors(email) {
2870
+ return await readViewerActorsFromSql(getDb(), email);
2871
+ }
2872
+
2873
+ // src/chat/plugins/user-pages.ts
2874
+ function readPluginUserPageLinks() {
2875
+ return pluginUserPageLinksSchema.parse(
2876
+ getPlugins().flatMap(
2877
+ (plugin) => (plugin.userPages ?? []).map((page) => ({
2878
+ description: page.description,
2879
+ id: page.id,
2880
+ label: page.label,
2881
+ pluginDisplayName: plugin.manifest.displayName,
2882
+ pluginName: plugin.manifest.name
2883
+ }))
2884
+ )
2885
+ );
2886
+ }
2887
+ async function readPluginUserPage(input) {
2888
+ const plugin = getPlugins().find(
2889
+ (candidate) => candidate.manifest.name === input.pluginName
2890
+ );
2891
+ const page = plugin?.userPages?.find(
2892
+ (candidate) => candidate.id === input.pageId
2893
+ );
2894
+ if (!plugin || !page) return void 0;
2895
+ return pluginUserPageContentSchema.parse(
2896
+ await page.read({
2897
+ db: getDb(),
2898
+ log: createPluginLogger(plugin.manifest.name),
2899
+ plugin: { name: plugin.manifest.name },
2900
+ viewer: {
2901
+ actors: await readViewerActors(input.email),
2902
+ email: input.email
2903
+ }
2904
+ })
2905
+ );
2906
+ }
2907
+
2908
+ // src/api/user-pages/routes.ts
2909
+ function createUserPageRoutes() {
2910
+ const app = new Hono5();
2911
+ app.get(
2912
+ "/",
2913
+ () => jsonResponse(pluginUserPageLinksSchema2, readPluginUserPageLinks())
2914
+ );
2915
+ app.get("/:pluginName/:pageId", async (context) => {
2916
+ const email = context.get("verifiedViewerEmail")?.trim();
2917
+ if (!email) {
2918
+ return jsonResponse(
2919
+ apiErrorSchema,
2920
+ { error: "Authentication required." },
2921
+ { status: 401 }
2922
+ );
2923
+ }
2924
+ const page = await readPluginUserPage({
2925
+ email,
2926
+ pageId: context.req.param("pageId"),
2927
+ pluginName: context.req.param("pluginName")
2928
+ });
2929
+ return page ? jsonResponse(pluginUserPageContentSchema2, page) : jsonResponse(
2930
+ apiErrorSchema,
2931
+ { error: "User page not found." },
2932
+ { status: 404 }
2933
+ );
2934
+ });
2935
+ return app;
2936
+ }
2937
+
2789
2938
  // src/api/plugins.ts
2790
2939
  var plugins_default = defineApiRoute({
2791
2940
  method: "get",
@@ -2810,21 +2959,46 @@ var skills_default = defineApiRoute({
2810
2959
  handler: readSkillReports
2811
2960
  });
2812
2961
 
2962
+ // src/api/stats.ts
2963
+ var WINDOW_DAYS2 = 90;
2964
+ async function readStatsReport() {
2965
+ const now = /* @__PURE__ */ new Date();
2966
+ const end = now.toISOString().slice(0, 10);
2967
+ const startDate = new Date(now);
2968
+ startDate.setUTCHours(0, 0, 0, 0);
2969
+ startDate.setUTCDate(startDate.getUTCDate() - (WINDOW_DAYS2 - 1));
2970
+ const start = startDate.toISOString().slice(0, 10);
2971
+ return statsReportSchema.parse({
2972
+ generatedAt: now.toISOString(),
2973
+ stats: await readStats(start, end),
2974
+ windowEnd: end,
2975
+ windowStart: start
2976
+ });
2977
+ }
2978
+ var stats_default2 = defineApiRoute({
2979
+ method: "get",
2980
+ path: "/api/stats",
2981
+ responseSchema: statsReportSchema,
2982
+ handler: readStatsReport
2983
+ });
2984
+
2813
2985
  // src/api.ts
2814
2986
  var routes5 = [
2815
2987
  health_default,
2816
2988
  runtime_default,
2817
2989
  plugins_default,
2818
2990
  skills_default,
2819
- plugin_reports_default
2991
+ plugin_reports_default,
2992
+ stats_default2
2820
2993
  ];
2821
2994
  function createJuniorApi() {
2822
- const app = new Hono5();
2995
+ const app = new Hono6();
2823
2996
  registerApiRoutes(app, routes5);
2824
2997
  app.route("/api/conversations", createConversationRoutes());
2825
2998
  app.route("/api/personal-tokens", createPersonalTokenRoutes());
2826
2999
  app.route("/api/people", createPeopleRoutes());
2827
3000
  app.route("/api/locations", createLocationRoutes());
3001
+ app.route("/api/user-pages", createUserPageRoutes());
2828
3002
  app.notFound(
2829
3003
  () => jsonResponse(
2830
3004
  apiErrorSchema,