@sentry/junior 0.117.0 → 0.119.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 (73) hide show
  1. package/dist/{agent-hooks-5IK4LPLP.js → agent-hooks-NZSV4QQR.js} +9 -11
  2. package/dist/api/conversations/detail.d.ts +17 -0
  3. package/dist/api/conversations/event-list.d.ts +17 -0
  4. package/dist/api/schema/conversation.d.ts +68 -0
  5. package/dist/api/schema/stats.d.ts +22 -0
  6. package/dist/api/schema.d.ts +2 -0
  7. package/dist/api/schema.js +7 -3
  8. package/dist/api/stats.d.ts +16 -0
  9. package/dist/api/user-pages/routes.d.ts +4 -0
  10. package/dist/api.js +223 -20
  11. package/dist/app.js +43 -38
  12. package/dist/{catalog-runtime-MTUYW3AA.js → catalog-runtime-TAOYIZIZ.js} +5 -5
  13. package/dist/chat/agent/prompt.d.ts +4 -2
  14. package/dist/chat/plugins/user-pages.d.ts +15 -0
  15. package/dist/chat/plugins/viewer-actors.d.ts +6 -0
  16. package/dist/chat/prompt.d.ts +1 -2
  17. package/dist/chat/sandbox/paths.d.ts +2 -0
  18. package/dist/chat/sandbox/sandbox.d.ts +3 -1
  19. package/dist/chat/sandbox/workspace.d.ts +1 -0
  20. package/dist/chat/skills.d.ts +1 -2
  21. package/dist/chat/slack/tools/canvas/api.d.ts +2 -9
  22. package/dist/chat/slack/tools/canvas/markdown.d.ts +9 -0
  23. package/dist/chat/tools/index.d.ts +4 -1
  24. package/dist/chat/tools/sandbox/file-utils.d.ts +11 -0
  25. package/dist/chat/tools/sandbox/find-files.d.ts +2 -1
  26. package/dist/chat/tools/sandbox/grep.d.ts +2 -1
  27. package/dist/{chunk-6G45D3YG.js → chunk-4UIUDOOV.js} +16 -233
  28. package/dist/{chunk-LUMEBOWC.js → chunk-6ZR455DC.js} +2 -2
  29. package/dist/{chunk-STUI6NIL.js → chunk-BLQZACHV.js} +511 -14
  30. package/dist/{chunk-27KWTFP6.js → chunk-BNJEPYTC.js} +5 -14
  31. package/dist/{chunk-ZRQUQJUV.js → chunk-D3N4BPSL.js} +3 -3
  32. package/dist/{chunk-WKU7TY22.js → chunk-FIANEE7Z.js} +3 -1
  33. package/dist/{chunk-RXRQJF7Y.js → chunk-GCGJGSQL.js} +21 -0
  34. package/dist/{chunk-FAWBONPC.js → chunk-GKFDU3ZI.js} +5 -7
  35. package/dist/{chunk-FXOYURO4.js → chunk-HDFGNU5E.js} +1 -0
  36. package/dist/{chunk-3GE3F4LT.js → chunk-JLJLZS2N.js} +1 -1
  37. package/dist/{chunk-CU7HTGNI.js → chunk-JSTGI7TX.js} +1 -1
  38. package/dist/chunk-JXRAOOXQ.js +37 -0
  39. package/dist/{chunk-WUNPRM76.js → chunk-NUENIPQL.js} +1 -1
  40. package/dist/{chunk-BFIRIZPH.js → chunk-O2ULQJWR.js} +101 -2
  41. package/dist/{chunk-AKG4TZNH.js → chunk-QZ7XRJDB.js} +30 -9
  42. package/dist/{chunk-5O3JDQDG.js → chunk-R53UT2OI.js} +1 -1
  43. package/dist/{chunk-W5JEQQEA.js → chunk-TAGV4Z3J.js} +1 -1
  44. package/dist/{chunk-NHZEUHKH.js → chunk-TGIQN7QW.js} +388 -113
  45. package/dist/{chunk-KU6ALEJC.js → chunk-VJTWKJWQ.js} +30 -2
  46. package/dist/{chunk-DS27ZBSP.js → chunk-VLTWQQKH.js} +2 -2
  47. package/dist/{chunk-WEK3V5RI.js → chunk-YLYJIQRX.js} +226 -21
  48. package/dist/{chunk-LN765Y4N.js → chunk-ZFX4M743.js} +15 -9
  49. package/dist/{chunk-72Z3HNTQ.js → chunk-ZJ6IVZVO.js} +1 -1
  50. package/dist/cli/chat.js +24 -25
  51. package/dist/cli/check.js +6 -6
  52. package/dist/cli/init.js +2 -2
  53. package/dist/cli/plugins.js +13 -15
  54. package/dist/cli/snapshot-create.js +9 -10
  55. package/dist/cli/upgrade.js +8 -8
  56. package/dist/db/schema/stats.d.ts +93 -0
  57. package/dist/db/schema.d.ts +94 -1
  58. package/dist/{db-J2ITKS63.js → db-FWGP5CKY.js} +7 -7
  59. package/dist/instrumentation.js +3 -3
  60. package/dist/nitro.js +3 -3
  61. package/dist/{oauth-callback-server-NQYKBT24.js → oauth-callback-server-PM3QNXJQ.js} +16 -18
  62. package/dist/{plugins-IUJA4VBU.js → plugins-HW4VWW6G.js} +1 -1
  63. package/dist/{runner-53V5GIQM.js → runner-DV55N6ZB.js} +11 -13
  64. package/dist/{skills-BU3ZMLVB.js → skills-MANV5ZK6.js} +6 -6
  65. package/dist/stats.d.ts +18 -0
  66. package/dist/{validation-74EIKKE6.js → validation-QGB4INTI.js} +6 -6
  67. package/dist/version.js +1 -1
  68. package/migrations/0011_sour_golden_guardian.sql +8 -0
  69. package/migrations/meta/0011_snapshot.json +1195 -0
  70. package/migrations/meta/_journal.json +8 -1
  71. package/package.json +5 -5
  72. package/dist/chunk-4ZNGQH7C.js +0 -25
  73. package/dist/chunk-YRWJ3KEU.js +0 -517
@@ -11,22 +11,20 @@ import {
11
11
  getPlugins,
12
12
  setPlugins,
13
13
  validatePlugins
14
- } from "./chunk-STUI6NIL.js";
15
- import "./chunk-KU6ALEJC.js";
16
- import "./chunk-YRWJ3KEU.js";
17
- import "./chunk-ZRQUQJUV.js";
18
- import "./chunk-RXRQJF7Y.js";
19
- import "./chunk-4ZNGQH7C.js";
20
- import "./chunk-DS27ZBSP.js";
14
+ } from "./chunk-BLQZACHV.js";
15
+ import "./chunk-D3N4BPSL.js";
16
+ import "./chunk-GCGJGSQL.js";
17
+ import "./chunk-VJTWKJWQ.js";
18
+ import "./chunk-VLTWQQKH.js";
21
19
  import "./chunk-VFUK3X5B.js";
22
- import "./chunk-FXOYURO4.js";
20
+ import "./chunk-HDFGNU5E.js";
23
21
  import "./chunk-HZF5P5UN.js";
24
- import "./chunk-72Z3HNTQ.js";
22
+ import "./chunk-ZJ6IVZVO.js";
25
23
  import "./chunk-OB42YVAE.js";
26
24
  import "./chunk-F3B2YJ76.js";
27
25
  import "./chunk-6GWA276C.js";
28
- import "./chunk-WUNPRM76.js";
29
- import "./chunk-3GE3F4LT.js";
26
+ import "./chunk-NUENIPQL.js";
27
+ import "./chunk-JLJLZS2N.js";
30
28
  import "./chunk-MLKGABMK.js";
31
29
  export {
32
30
  PluginHookDeniedError,
@@ -105,6 +105,13 @@ declare const _default: import("../route").ApiRoute<import("zod").ZodObject<{
105
105
  }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
106
106
  type: import("zod").ZodLiteral<"message_handled">;
107
107
  messageId: import("zod").ZodString;
108
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
109
+ type: import("zod").ZodLiteral<"assistant_message">;
110
+ parts: import("zod").ZodArray<import("zod").ZodObject<{
111
+ type: import("zod").ZodLiteral<"reasoning">;
112
+ text: import("zod").ZodOptional<import("zod").ZodString>;
113
+ redacted: import("zod").ZodOptional<import("zod").ZodLiteral<true>>;
114
+ }, import("zod/v4/core").$strict>>;
108
115
  }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
109
116
  type: import("zod").ZodLiteral<"tool_calls">;
110
117
  calls: import("zod").ZodArray<import("zod").ZodObject<{
@@ -120,6 +127,16 @@ declare const _default: import("../route").ApiRoute<import("zod").ZodObject<{
120
127
  input: import("zod").ZodOptional<import("zod").ZodUnknown>;
121
128
  output: import("zod").ZodOptional<import("zod").ZodUnknown>;
122
129
  }, import("zod/v4/core").$strict>>;
130
+ assistant: import("zod").ZodOptional<import("zod").ZodObject<{
131
+ parts: import("zod").ZodArray<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
132
+ type: import("zod").ZodLiteral<"reasoning">;
133
+ text: import("zod").ZodOptional<import("zod").ZodString>;
134
+ redacted: import("zod").ZodOptional<import("zod").ZodLiteral<true>>;
135
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
136
+ type: import("zod").ZodLiteral<"tool_call">;
137
+ toolCallId: import("zod").ZodString;
138
+ }, import("zod/v4/core").$strict>], "type">>;
139
+ }, import("zod/v4/core").$strict>>;
123
140
  }, import("zod/v4/core").$strict>, import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
124
141
  type: import("zod").ZodLiteral<"turn_lifecycle">;
125
142
  turnId: import("zod").ZodString;
@@ -22,6 +22,13 @@ declare const _default: import("../route").ApiRoute<import("zod").ZodObject<{
22
22
  }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
23
23
  type: import("zod").ZodLiteral<"message_handled">;
24
24
  messageId: import("zod").ZodString;
25
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
26
+ type: import("zod").ZodLiteral<"assistant_message">;
27
+ parts: import("zod").ZodArray<import("zod").ZodObject<{
28
+ type: import("zod").ZodLiteral<"reasoning">;
29
+ text: import("zod").ZodOptional<import("zod").ZodString>;
30
+ redacted: import("zod").ZodOptional<import("zod").ZodLiteral<true>>;
31
+ }, import("zod/v4/core").$strict>>;
25
32
  }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
26
33
  type: import("zod").ZodLiteral<"tool_calls">;
27
34
  calls: import("zod").ZodArray<import("zod").ZodObject<{
@@ -37,6 +44,16 @@ declare const _default: import("../route").ApiRoute<import("zod").ZodObject<{
37
44
  input: import("zod").ZodOptional<import("zod").ZodUnknown>;
38
45
  output: import("zod").ZodOptional<import("zod").ZodUnknown>;
39
46
  }, import("zod/v4/core").$strict>>;
47
+ assistant: import("zod").ZodOptional<import("zod").ZodObject<{
48
+ parts: import("zod").ZodArray<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
49
+ type: import("zod").ZodLiteral<"reasoning">;
50
+ text: import("zod").ZodOptional<import("zod").ZodString>;
51
+ redacted: import("zod").ZodOptional<import("zod").ZodLiteral<true>>;
52
+ }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
53
+ type: import("zod").ZodLiteral<"tool_call">;
54
+ toolCallId: import("zod").ZodString;
55
+ }, import("zod/v4/core").$strict>], "type">>;
56
+ }, import("zod/v4/core").$strict>>;
40
57
  }, import("zod/v4/core").$strict>, import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
41
58
  type: import("zod").ZodLiteral<"turn_lifecycle">;
42
59
  turnId: import("zod").ZodString;
@@ -121,6 +121,13 @@ export declare const conversationReportEventDataSchema: z.ZodDiscriminatedUnion<
121
121
  }, z.core.$strict>, z.ZodObject<{
122
122
  type: z.ZodLiteral<"message_handled">;
123
123
  messageId: z.ZodString;
124
+ }, z.core.$strict>, z.ZodObject<{
125
+ type: z.ZodLiteral<"assistant_message">;
126
+ parts: z.ZodArray<z.ZodObject<{
127
+ type: z.ZodLiteral<"reasoning">;
128
+ text: z.ZodOptional<z.ZodString>;
129
+ redacted: z.ZodOptional<z.ZodLiteral<true>>;
130
+ }, z.core.$strict>>;
124
131
  }, z.core.$strict>, z.ZodObject<{
125
132
  type: z.ZodLiteral<"tool_calls">;
126
133
  calls: z.ZodArray<z.ZodObject<{
@@ -136,6 +143,16 @@ export declare const conversationReportEventDataSchema: z.ZodDiscriminatedUnion<
136
143
  input: z.ZodOptional<z.ZodUnknown>;
137
144
  output: z.ZodOptional<z.ZodUnknown>;
138
145
  }, z.core.$strict>>;
146
+ assistant: z.ZodOptional<z.ZodObject<{
147
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
148
+ type: z.ZodLiteral<"reasoning">;
149
+ text: z.ZodOptional<z.ZodString>;
150
+ redacted: z.ZodOptional<z.ZodLiteral<true>>;
151
+ }, z.core.$strict>, z.ZodObject<{
152
+ type: z.ZodLiteral<"tool_call">;
153
+ toolCallId: z.ZodString;
154
+ }, z.core.$strict>], "type">>;
155
+ }, z.core.$strict>>;
139
156
  }, z.core.$strict>, z.ZodDiscriminatedUnion<[z.ZodObject<{
140
157
  type: z.ZodLiteral<"turn_lifecycle">;
141
158
  turnId: z.ZodString;
@@ -225,6 +242,13 @@ export declare const conversationReportEventSchema: z.ZodObject<{
225
242
  }, z.core.$strict>, z.ZodObject<{
226
243
  type: z.ZodLiteral<"message_handled">;
227
244
  messageId: z.ZodString;
245
+ }, z.core.$strict>, z.ZodObject<{
246
+ type: z.ZodLiteral<"assistant_message">;
247
+ parts: z.ZodArray<z.ZodObject<{
248
+ type: z.ZodLiteral<"reasoning">;
249
+ text: z.ZodOptional<z.ZodString>;
250
+ redacted: z.ZodOptional<z.ZodLiteral<true>>;
251
+ }, z.core.$strict>>;
228
252
  }, z.core.$strict>, z.ZodObject<{
229
253
  type: z.ZodLiteral<"tool_calls">;
230
254
  calls: z.ZodArray<z.ZodObject<{
@@ -240,6 +264,16 @@ export declare const conversationReportEventSchema: z.ZodObject<{
240
264
  input: z.ZodOptional<z.ZodUnknown>;
241
265
  output: z.ZodOptional<z.ZodUnknown>;
242
266
  }, z.core.$strict>>;
267
+ assistant: z.ZodOptional<z.ZodObject<{
268
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
269
+ type: z.ZodLiteral<"reasoning">;
270
+ text: z.ZodOptional<z.ZodString>;
271
+ redacted: z.ZodOptional<z.ZodLiteral<true>>;
272
+ }, z.core.$strict>, z.ZodObject<{
273
+ type: z.ZodLiteral<"tool_call">;
274
+ toolCallId: z.ZodString;
275
+ }, z.core.$strict>], "type">>;
276
+ }, z.core.$strict>>;
243
277
  }, z.core.$strict>, z.ZodDiscriminatedUnion<[z.ZodObject<{
244
278
  type: z.ZodLiteral<"turn_lifecycle">;
245
279
  turnId: z.ZodString;
@@ -440,6 +474,13 @@ export declare const conversationDetailReportSchema: z.ZodObject<{
440
474
  }, z.core.$strict>, z.ZodObject<{
441
475
  type: z.ZodLiteral<"message_handled">;
442
476
  messageId: z.ZodString;
477
+ }, z.core.$strict>, z.ZodObject<{
478
+ type: z.ZodLiteral<"assistant_message">;
479
+ parts: z.ZodArray<z.ZodObject<{
480
+ type: z.ZodLiteral<"reasoning">;
481
+ text: z.ZodOptional<z.ZodString>;
482
+ redacted: z.ZodOptional<z.ZodLiteral<true>>;
483
+ }, z.core.$strict>>;
443
484
  }, z.core.$strict>, z.ZodObject<{
444
485
  type: z.ZodLiteral<"tool_calls">;
445
486
  calls: z.ZodArray<z.ZodObject<{
@@ -455,6 +496,16 @@ export declare const conversationDetailReportSchema: z.ZodObject<{
455
496
  input: z.ZodOptional<z.ZodUnknown>;
456
497
  output: z.ZodOptional<z.ZodUnknown>;
457
498
  }, z.core.$strict>>;
499
+ assistant: z.ZodOptional<z.ZodObject<{
500
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
501
+ type: z.ZodLiteral<"reasoning">;
502
+ text: z.ZodOptional<z.ZodString>;
503
+ redacted: z.ZodOptional<z.ZodLiteral<true>>;
504
+ }, z.core.$strict>, z.ZodObject<{
505
+ type: z.ZodLiteral<"tool_call">;
506
+ toolCallId: z.ZodString;
507
+ }, z.core.$strict>], "type">>;
508
+ }, z.core.$strict>>;
458
509
  }, z.core.$strict>, z.ZodDiscriminatedUnion<[z.ZodObject<{
459
510
  type: z.ZodLiteral<"turn_lifecycle">;
460
511
  turnId: z.ZodString;
@@ -558,6 +609,13 @@ export declare const conversationEventPageSchema: z.ZodObject<{
558
609
  }, z.core.$strict>, z.ZodObject<{
559
610
  type: z.ZodLiteral<"message_handled">;
560
611
  messageId: z.ZodString;
612
+ }, z.core.$strict>, z.ZodObject<{
613
+ type: z.ZodLiteral<"assistant_message">;
614
+ parts: z.ZodArray<z.ZodObject<{
615
+ type: z.ZodLiteral<"reasoning">;
616
+ text: z.ZodOptional<z.ZodString>;
617
+ redacted: z.ZodOptional<z.ZodLiteral<true>>;
618
+ }, z.core.$strict>>;
561
619
  }, z.core.$strict>, z.ZodObject<{
562
620
  type: z.ZodLiteral<"tool_calls">;
563
621
  calls: z.ZodArray<z.ZodObject<{
@@ -573,6 +631,16 @@ export declare const conversationEventPageSchema: z.ZodObject<{
573
631
  input: z.ZodOptional<z.ZodUnknown>;
574
632
  output: z.ZodOptional<z.ZodUnknown>;
575
633
  }, z.core.$strict>>;
634
+ assistant: z.ZodOptional<z.ZodObject<{
635
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
636
+ type: z.ZodLiteral<"reasoning">;
637
+ text: z.ZodOptional<z.ZodString>;
638
+ redacted: z.ZodOptional<z.ZodLiteral<true>>;
639
+ }, z.core.$strict>, z.ZodObject<{
640
+ type: z.ZodLiteral<"tool_call">;
641
+ toolCallId: z.ZodString;
642
+ }, z.core.$strict>], "type">>;
643
+ }, z.core.$strict>>;
576
644
  }, z.core.$strict>, z.ZodDiscriminatedUnion<[z.ZodObject<{
577
645
  type: z.ZodLiteral<"turn_lifecycle">;
578
646
  turnId: 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-BFIRIZPH.js";
30
+ revokePersonalTokenResponseSchema,
31
+ statSchema,
32
+ statsReportSchema
33
+ } from "../chunk-O2ULQJWR.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-BFIRIZPH.js";
25
+ revokePersonalTokenResponseSchema,
26
+ statsReportSchema
27
+ } from "./chunk-O2ULQJWR.js";
27
28
  import {
28
29
  formatSlackConversationRedactedLabel,
29
30
  readHealthReport,
30
31
  resolveSlackConversationContextFromThreadId
31
- } from "./chunk-LUMEBOWC.js";
32
+ } from "./chunk-6ZR455DC.js";
32
33
  import {
33
34
  buildSentryConversationUrl
34
35
  } from "./chunk-4CODA7P5.js";
@@ -39,45 +40,53 @@ import {
39
40
  runtimeInfoReportSchema,
40
41
  skillReportsSchema
41
42
  } from "./chunk-PE44LDDQ.js";
43
+ import {
44
+ readStats
45
+ } from "./chunk-JXRAOOXQ.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-YRWJ3KEU.js";
55
+ } from "./chunk-BLQZACHV.js";
50
56
  import {
51
57
  decodeStoredConversationEvent,
52
58
  getDb,
53
59
  getSqlExecutor
54
- } from "./chunk-ZRQUQJUV.js";
60
+ } from "./chunk-D3N4BPSL.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-DS27ZBSP.js";
67
+ } from "./chunk-GCGJGSQL.js";
68
+ import "./chunk-VJTWKJWQ.js";
69
+ import "./chunk-VLTWQQKH.js";
64
70
  import {
65
71
  juniorDestinations
66
72
  } from "./chunk-VFUK3X5B.js";
67
73
  import {
68
74
  canExposeConversationPayload,
69
75
  parseSlackThreadId
70
- } from "./chunk-FXOYURO4.js";
71
- import "./chunk-72Z3HNTQ.js";
76
+ } from "./chunk-HDFGNU5E.js";
77
+ import "./chunk-HZF5P5UN.js";
78
+ import {
79
+ normalizeIdentityEmail
80
+ } from "./chunk-ZJ6IVZVO.js";
72
81
  import "./chunk-OB42YVAE.js";
73
82
  import "./chunk-F3B2YJ76.js";
74
83
  import "./chunk-6GWA276C.js";
75
- import "./chunk-WUNPRM76.js";
76
- import "./chunk-3GE3F4LT.js";
84
+ import "./chunk-NUENIPQL.js";
85
+ import "./chunk-JLJLZS2N.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";
@@ -386,6 +395,11 @@ var reportingToolResultDetailsSchema = z2.object({
386
395
  status: z2.string().optional()
387
396
  }).passthrough();
388
397
  var reportingTextPartSchema = z2.object({ type: z2.literal("text"), text: z2.string() }).passthrough();
398
+ var reportingReasoningPartSchema = z2.object({
399
+ type: z2.literal("thinking"),
400
+ thinking: z2.string(),
401
+ redacted: z2.literal(true).optional()
402
+ }).passthrough();
389
403
  var reportingMediaPartSchema = z2.object({
390
404
  type: z2.enum(["image", "audio"]),
391
405
  mimeType: z2.string().min(1).optional()
@@ -426,6 +440,43 @@ function reportToolCalls(args) {
426
440
  });
427
441
  return calls.length > 0 ? { type: "tool_calls", calls } : void 0;
428
442
  }
443
+ function reportAssistantMessage(args) {
444
+ const message2 = reportingAssistantMessageSchema.safeParse(args.message);
445
+ if (!message2.success) return void 0;
446
+ const hasReasoning = message2.data.content.some((part) => {
447
+ const reasoning = reportingReasoningPartSchema.safeParse(part);
448
+ return reasoning.success && reasoning.data.redacted !== true && reasoning.data.thinking.trim().length > 0;
449
+ });
450
+ if (!hasReasoning) return reportToolCalls(args);
451
+ const reasoningParts = [];
452
+ const assistantParts = [];
453
+ for (const part of message2.data.content) {
454
+ const reasoning = reportingReasoningPartSchema.safeParse(part);
455
+ if (reasoning.success) {
456
+ if (reasoning.data.redacted !== true && reasoning.data.thinking.trim().length > 0) {
457
+ const projected = {
458
+ type: "reasoning",
459
+ ...args.canExposePayload ? { text: reasoning.data.thinking } : { redacted: true }
460
+ };
461
+ reasoningParts.push(projected);
462
+ assistantParts.push(projected);
463
+ }
464
+ continue;
465
+ }
466
+ const call = reportingToolCallPartSchema.safeParse(part);
467
+ if (call.success) {
468
+ assistantParts.push({
469
+ type: "tool_call",
470
+ toolCallId: call.data.id
471
+ });
472
+ }
473
+ }
474
+ const toolCalls = reportToolCalls(args);
475
+ if (toolCalls?.type === "tool_calls") {
476
+ return { ...toolCalls, assistant: { parts: assistantParts } };
477
+ }
478
+ return reasoningParts.length > 0 ? { type: "assistant_message", parts: reasoningParts } : void 0;
479
+ }
429
480
  function reportToolResult(args) {
430
481
  const message2 = reportingToolResultMessageSchema.safeParse(args.message);
431
482
  if (!message2.success) return void 0;
@@ -567,7 +618,7 @@ function projectConversationReportEventPage(args) {
567
618
  };
568
619
  const result = reportingToolResultMessageSchema.safeParse(event.data);
569
620
  const start = result.success ? toolStarts.get(result.data.toolCallId) : void 0;
570
- data = reportToolCalls(reportArgs) ?? reportToolResult({
621
+ data = reportAssistantMessage(reportArgs) ?? reportToolResult({
571
622
  canExposePayload: args.canExposePayload,
572
623
  message: event.data,
573
624
  ...start && start.seq < event.seq ? { start } : {}
@@ -1690,7 +1741,7 @@ function readDescriptionText(home) {
1690
1741
  }
1691
1742
  }
1692
1743
  async function readSkillReports() {
1693
- const { discoverSkills } = await import("./skills-BU3ZMLVB.js");
1744
+ const { discoverSkills } = await import("./skills-MANV5ZK6.js");
1694
1745
  const skills = await discoverSkills();
1695
1746
  return skillReportsSchema.parse(
1696
1747
  skills.map((skill) => ({
@@ -1700,7 +1751,7 @@ async function readSkillReports() {
1700
1751
  );
1701
1752
  }
1702
1753
  async function readPlugins() {
1703
- const { pluginCatalogRuntime } = await import("./catalog-runtime-MTUYW3AA.js");
1754
+ const { pluginCatalogRuntime } = await import("./catalog-runtime-TAOYIZIZ.js");
1704
1755
  return pluginsSchema.parse(
1705
1756
  pluginCatalogRuntime.getProviders().map((plugin) => ({
1706
1757
  configKeys: plugin.manifest.configKeys ?? [],
@@ -1713,7 +1764,7 @@ async function readPlugins() {
1713
1764
  async function readRuntimeInfoReport() {
1714
1765
  const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
1715
1766
  import("./discovery-RMHYSRL7.js"),
1716
- import("./catalog-runtime-MTUYW3AA.js"),
1767
+ import("./catalog-runtime-TAOYIZIZ.js"),
1717
1768
  readPlugins(),
1718
1769
  readSkillReports()
1719
1770
  ]);
@@ -1729,7 +1780,7 @@ async function readRuntimeInfoReport() {
1729
1780
  }
1730
1781
  async function readPluginOperationalReportFeed() {
1731
1782
  const nowMs = Date.now();
1732
- const { getPluginOperationalReports } = await import("./agent-hooks-5IK4LPLP.js");
1783
+ const { getPluginOperationalReports } = await import("./agent-hooks-NZSV4QQR.js");
1733
1784
  return pluginOperationalReportFeedSchema.parse({
1734
1785
  source: "plugins",
1735
1786
  generatedAt: new Date(nowMs).toISOString(),
@@ -2799,6 +2850,133 @@ function createPersonalTokenRoutes() {
2799
2850
  return app;
2800
2851
  }
2801
2852
 
2853
+ // src/api/user-pages/routes.ts
2854
+ import { Hono as Hono5 } from "hono";
2855
+ import {
2856
+ pluginUserPageContentSchema as pluginUserPageContentSchema2,
2857
+ pluginUserPageLinksSchema as pluginUserPageLinksSchema2
2858
+ } from "@sentry/junior-plugin-api";
2859
+
2860
+ // src/chat/plugins/user-pages.ts
2861
+ import {
2862
+ pluginUserPageContentSchema,
2863
+ pluginUserPageLinksSchema
2864
+ } from "@sentry/junior-plugin-api";
2865
+
2866
+ // src/chat/plugins/viewer-actors.ts
2867
+ import { and as and12, eq as eq13 } from "drizzle-orm";
2868
+ import {
2869
+ actorSchema
2870
+ } from "@sentry/junior-plugin-api";
2871
+ async function readViewerActorsFromSql(db, email) {
2872
+ const normalizedEmail = normalizeIdentityEmail(email);
2873
+ if (!normalizedEmail) return [];
2874
+ const rows = await db.select({
2875
+ displayName: juniorIdentities.displayName,
2876
+ email: juniorUsers.primaryEmail,
2877
+ handle: juniorIdentities.handle,
2878
+ provider: juniorIdentities.provider,
2879
+ providerSubjectId: juniorIdentities.providerSubjectId,
2880
+ providerTenantId: juniorIdentities.providerTenantId
2881
+ }).from(juniorIdentities).innerJoin(juniorUsers, eq13(juniorUsers.id, juniorIdentities.userId)).where(
2882
+ and12(
2883
+ eq13(juniorUsers.primaryEmailNormalized, normalizedEmail),
2884
+ eq13(juniorIdentities.kind, "user")
2885
+ )
2886
+ );
2887
+ const actors = [];
2888
+ for (const row of rows) {
2889
+ const candidate = row.provider === "slack" ? {
2890
+ platform: "slack",
2891
+ teamId: row.providerTenantId,
2892
+ userId: row.providerSubjectId,
2893
+ email: row.email,
2894
+ ...row.displayName ? { fullName: row.displayName } : {},
2895
+ ...row.handle ? { userName: row.handle } : {}
2896
+ } : row.provider === "local" ? {
2897
+ platform: "local",
2898
+ userId: row.providerSubjectId,
2899
+ email: row.email,
2900
+ ...row.displayName ? { fullName: row.displayName } : {},
2901
+ ...row.handle ? { userName: row.handle } : {}
2902
+ } : void 0;
2903
+ if (!candidate) continue;
2904
+ const parsed = actorSchema.safeParse(candidate);
2905
+ if (parsed.success && parsed.data.platform !== "system") {
2906
+ actors.push(parsed.data);
2907
+ }
2908
+ }
2909
+ return actors;
2910
+ }
2911
+ async function readViewerActors(email) {
2912
+ return await readViewerActorsFromSql(getDb(), email);
2913
+ }
2914
+
2915
+ // src/chat/plugins/user-pages.ts
2916
+ function readPluginUserPageLinks() {
2917
+ return pluginUserPageLinksSchema.parse(
2918
+ getPlugins().flatMap(
2919
+ (plugin) => (plugin.userPages ?? []).map((page) => ({
2920
+ description: page.description,
2921
+ id: page.id,
2922
+ label: page.label,
2923
+ pluginDisplayName: plugin.manifest.displayName,
2924
+ pluginName: plugin.manifest.name
2925
+ }))
2926
+ )
2927
+ );
2928
+ }
2929
+ async function readPluginUserPage(input) {
2930
+ const plugin = getPlugins().find(
2931
+ (candidate) => candidate.manifest.name === input.pluginName
2932
+ );
2933
+ const page = plugin?.userPages?.find(
2934
+ (candidate) => candidate.id === input.pageId
2935
+ );
2936
+ if (!plugin || !page) return void 0;
2937
+ return pluginUserPageContentSchema.parse(
2938
+ await page.read({
2939
+ db: getDb(),
2940
+ log: createPluginLogger(plugin.manifest.name),
2941
+ plugin: { name: plugin.manifest.name },
2942
+ viewer: {
2943
+ actors: await readViewerActors(input.email),
2944
+ email: input.email
2945
+ }
2946
+ })
2947
+ );
2948
+ }
2949
+
2950
+ // src/api/user-pages/routes.ts
2951
+ function createUserPageRoutes() {
2952
+ const app = new Hono5();
2953
+ app.get(
2954
+ "/",
2955
+ () => jsonResponse(pluginUserPageLinksSchema2, readPluginUserPageLinks())
2956
+ );
2957
+ app.get("/:pluginName/:pageId", async (context) => {
2958
+ const email = context.get("verifiedViewerEmail")?.trim();
2959
+ if (!email) {
2960
+ return jsonResponse(
2961
+ apiErrorSchema,
2962
+ { error: "Authentication required." },
2963
+ { status: 401 }
2964
+ );
2965
+ }
2966
+ const page = await readPluginUserPage({
2967
+ email,
2968
+ pageId: context.req.param("pageId"),
2969
+ pluginName: context.req.param("pluginName")
2970
+ });
2971
+ return page ? jsonResponse(pluginUserPageContentSchema2, page) : jsonResponse(
2972
+ apiErrorSchema,
2973
+ { error: "User page not found." },
2974
+ { status: 404 }
2975
+ );
2976
+ });
2977
+ return app;
2978
+ }
2979
+
2802
2980
  // src/api/plugins.ts
2803
2981
  var plugins_default = defineApiRoute({
2804
2982
  method: "get",
@@ -2823,21 +3001,46 @@ var skills_default = defineApiRoute({
2823
3001
  handler: readSkillReports
2824
3002
  });
2825
3003
 
3004
+ // src/api/stats.ts
3005
+ var WINDOW_DAYS2 = 90;
3006
+ async function readStatsReport() {
3007
+ const now = /* @__PURE__ */ new Date();
3008
+ const end = now.toISOString().slice(0, 10);
3009
+ const startDate = new Date(now);
3010
+ startDate.setUTCHours(0, 0, 0, 0);
3011
+ startDate.setUTCDate(startDate.getUTCDate() - (WINDOW_DAYS2 - 1));
3012
+ const start = startDate.toISOString().slice(0, 10);
3013
+ return statsReportSchema.parse({
3014
+ generatedAt: now.toISOString(),
3015
+ stats: await readStats(start, end),
3016
+ windowEnd: end,
3017
+ windowStart: start
3018
+ });
3019
+ }
3020
+ var stats_default2 = defineApiRoute({
3021
+ method: "get",
3022
+ path: "/api/stats",
3023
+ responseSchema: statsReportSchema,
3024
+ handler: readStatsReport
3025
+ });
3026
+
2826
3027
  // src/api.ts
2827
3028
  var routes5 = [
2828
3029
  health_default,
2829
3030
  runtime_default,
2830
3031
  plugins_default,
2831
3032
  skills_default,
2832
- plugin_reports_default
3033
+ plugin_reports_default,
3034
+ stats_default2
2833
3035
  ];
2834
3036
  function createJuniorApi() {
2835
- const app = new Hono5();
3037
+ const app = new Hono6();
2836
3038
  registerApiRoutes(app, routes5);
2837
3039
  app.route("/api/conversations", createConversationRoutes());
2838
3040
  app.route("/api/personal-tokens", createPersonalTokenRoutes());
2839
3041
  app.route("/api/people", createPeopleRoutes());
2840
3042
  app.route("/api/locations", createLocationRoutes());
3043
+ app.route("/api/user-pages", createUserPageRoutes());
2841
3044
  app.notFound(
2842
3045
  () => jsonResponse(
2843
3046
  apiErrorSchema,