@sentry/junior 0.203.0 → 0.205.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 (174) hide show
  1. package/dist/agent-D4nu8MQV.js +17521 -0
  2. package/dist/agent-hooks-DXHpTJ4m.js +4042 -0
  3. package/dist/agent-runner-C04colea.js +678 -0
  4. package/dist/api/schema.d.ts +2736 -2639
  5. package/dist/api/schema.js +4 -169
  6. package/dist/api.d.ts +23 -17
  7. package/dist/api.js +3881 -5326
  8. package/dist/app-Cb776lL8.d.ts +247 -0
  9. package/dist/app.d.ts +4 -520
  10. package/dist/app.js +9524 -11875
  11. package/dist/auth-pause-state-C2P3guS1.js +168 -0
  12. package/dist/catalog-runtime-CXw3asJD.js +7 -0
  13. package/dist/checkpoint-CrViJ8Ps.js +2450 -0
  14. package/dist/cli/chat.d.ts +20 -0
  15. package/dist/cli/chat.js +229 -336
  16. package/dist/cli/check.d.ts +8 -0
  17. package/dist/cli/check.js +513 -806
  18. package/dist/cli/env.d.ts +13 -0
  19. package/dist/cli/env.js +63 -12
  20. package/dist/cli/init.d.ts +3 -0
  21. package/dist/cli/init.js +90 -159
  22. package/dist/cli/main.d.ts +6 -0
  23. package/dist/cli/main.js +43 -64
  24. package/dist/cli/plugins.d.ts +13 -0
  25. package/dist/cli/plugins.js +148 -227
  26. package/dist/cli/run.d.ts +16 -0
  27. package/dist/cli/run.js +52 -8
  28. package/dist/cli/snapshot-create.d.ts +4 -0
  29. package/dist/cli/snapshot-create.js +71 -125
  30. package/dist/cli/upgrade.d.ts +15 -0
  31. package/dist/cli/upgrade.js +232 -335
  32. package/dist/config-BOtJQ7Pc.js +941 -0
  33. package/dist/context-B45_WqVX.js +298 -0
  34. package/dist/conversation-privacy-BZRA6Pes.js +182 -0
  35. package/dist/conversation-work-C6y3T5Hx.js +51 -0
  36. package/dist/credential-sync-Bep34IB_.js +2661 -0
  37. package/dist/db-BeyXKJOI.d.ts +5 -0
  38. package/dist/destinations-BeBiJeEM.js +29 -0
  39. package/dist/execution-stats-B6lgWxCK.js +373 -0
  40. package/dist/executor-BlUhFL7_.js +721 -0
  41. package/dist/experimental-CIXf7Uye.js +46 -0
  42. package/dist/history-ClE4toxe.d.ts +32 -0
  43. package/dist/history-CqTuSAdI.js +441 -0
  44. package/dist/instrumentation.d.ts +3 -3
  45. package/dist/instrumentation.js +130 -176
  46. package/dist/job-queue-DLMqIK74.js +63 -0
  47. package/dist/logging-BMJzdDlP.js +1210 -0
  48. package/dist/model-profile-CZmVoGdX.js +49 -0
  49. package/dist/nitro.d.ts +31 -36
  50. package/dist/nitro.js +275 -456
  51. package/dist/oauth-callback-server-WwG5_Zgm.js +130 -0
  52. package/dist/oauth-relay-CdCnu80W.js +62 -0
  53. package/dist/package-discovery-7a9YqLhE.js +455 -0
  54. package/dist/pending-auth-CUbXq06G.js +185 -0
  55. package/dist/plugin-module-BKGOXca2.js +81 -0
  56. package/dist/plugins-BI9A1vKA.d.ts +95 -0
  57. package/dist/plugins-egKWjgue.js +99 -0
  58. package/dist/private-trace-result-BLvBjy_e.js +16 -0
  59. package/dist/profile-T0tXE4zu.js +861 -0
  60. package/dist/registry-BA0__8ai.js +1419 -0
  61. package/dist/reporting-schema-DosTN__Q.js +105 -0
  62. package/dist/resolve-bvD1ORdv.js +546 -0
  63. package/dist/rolldown-runtime-B4FMCO8f.js +28 -0
  64. package/dist/runner-BXYxfIUL.js +392 -0
  65. package/dist/sandbox-egress-signals-ngEPjSEW.js +46 -0
  66. package/dist/schema-Rn8-XEaN.js +1140 -0
  67. package/dist/sentry-CD3SdJl-.js +26 -0
  68. package/dist/skills-DJOlYdBs.js +316 -0
  69. package/dist/spawn-h0R1bTEo.js +29 -0
  70. package/dist/stats-3YZn-Swi.js +2648 -0
  71. package/dist/store-C5qxF2ac.d.ts +208 -0
  72. package/dist/task-queue-CoXwd2eq.js +136 -0
  73. package/dist/task-runner-B2_mJZj0.js +639 -0
  74. package/dist/thread-state-CqZ1m-es.js +431 -0
  75. package/dist/turn-execution-fI6PZ0iI.js +47 -0
  76. package/dist/turn-lifecycle-CcnwrOcp.js +54 -0
  77. package/dist/usage-B5SfMb3H.js +296 -0
  78. package/dist/usage-schema-CKaDkH_j.js +20 -0
  79. package/dist/validation-DfWcvhuS.js +40 -0
  80. package/dist/vercel-queue-DIkVcfK4.js +167 -0
  81. package/dist/vercel.d.ts +6 -6
  82. package/dist/vercel.js +14 -6
  83. package/dist/version-CnXZ614E.d.ts +5 -0
  84. package/dist/version-oD-oPrbO.js +8 -0
  85. package/dist/version.d.ts +2 -4
  86. package/dist/version.js +2 -6
  87. package/dist/web-authorization-Crbzlmzo.js +76 -0
  88. package/dist/web-input-BOuq3oKK.js +494 -0
  89. package/dist/work-B91LQKHr.js +509 -0
  90. package/dist/worker-BcRRTe6k.js +625 -0
  91. package/package.json +9 -9
  92. package/dist/agent-hooks-GB2VPTNA.js +0 -51
  93. package/dist/catalog-runtime-UBLIWD3O.js +0 -14
  94. package/dist/chunk-2LYHWMR4.js +0 -46
  95. package/dist/chunk-352OWAZH.js +0 -320
  96. package/dist/chunk-3Y47VMHV.js +0 -6
  97. package/dist/chunk-3YJSKOWF.js +0 -164
  98. package/dist/chunk-4KSSKTQ5.js +0 -229
  99. package/dist/chunk-4UO6FK4G.js +0 -64
  100. package/dist/chunk-5AHX53NQ.js +0 -717
  101. package/dist/chunk-5J3E5FWA.js +0 -700
  102. package/dist/chunk-5PDAG6O3.js +0 -206
  103. package/dist/chunk-6Y5B5PEX.js +0 -80
  104. package/dist/chunk-7GWQ5S5R.js +0 -2086
  105. package/dist/chunk-7H2VZTWN.js +0 -103
  106. package/dist/chunk-7NL7T6VU.js +0 -406
  107. package/dist/chunk-A5L27LE4.js +0 -387
  108. package/dist/chunk-ADIAWL34.js +0 -81
  109. package/dist/chunk-ASTEMBKJ.js +0 -519
  110. package/dist/chunk-CEMMLV5L.js +0 -98
  111. package/dist/chunk-CM5HNV2W.js +0 -131
  112. package/dist/chunk-CRTRBBRI.js +0 -105
  113. package/dist/chunk-DA2KGZZI.js +0 -13
  114. package/dist/chunk-DIB4GX3G.js +0 -8
  115. package/dist/chunk-DKIJ2RP5.js +0 -68
  116. package/dist/chunk-DWPN6SCH.js +0 -172
  117. package/dist/chunk-EDKUFGPL.js +0 -64
  118. package/dist/chunk-ENY6SKIU.js +0 -1228
  119. package/dist/chunk-F4MGCZOX.js +0 -2943
  120. package/dist/chunk-FA6POGLH.js +0 -70
  121. package/dist/chunk-FSUR7GTG.js +0 -20475
  122. package/dist/chunk-GKEOHJL5.js +0 -1856
  123. package/dist/chunk-GMCB6W5Y.js +0 -333
  124. package/dist/chunk-IE2VPG7O.js +0 -1135
  125. package/dist/chunk-IZ5B5IHQ.js +0 -3656
  126. package/dist/chunk-JAL3CH4G.js +0 -27
  127. package/dist/chunk-KIIEUXD3.js +0 -1764
  128. package/dist/chunk-KXU4NIL7.js +0 -692
  129. package/dist/chunk-MTM5IFCY.js +0 -1190
  130. package/dist/chunk-N7TMSOZH.js +0 -235
  131. package/dist/chunk-NCEBK6PH.js +0 -36
  132. package/dist/chunk-NHJU2ZAL.js +0 -56
  133. package/dist/chunk-P6KTRNVC.js +0 -321
  134. package/dist/chunk-PDO5BLNM.js +0 -22
  135. package/dist/chunk-PDRNLLFT.js +0 -3295
  136. package/dist/chunk-PEQXYSSE.js +0 -45
  137. package/dist/chunk-PKEX2AQX.js +0 -198
  138. package/dist/chunk-PSJCGIGO.js +0 -1163
  139. package/dist/chunk-PZUSUL55.js +0 -506
  140. package/dist/chunk-R45M4TUS.js +0 -37
  141. package/dist/chunk-RC745GGZ.js +0 -122
  142. package/dist/chunk-SP3QKZXJ.js +0 -820
  143. package/dist/chunk-TXKUKMVO.js +0 -417
  144. package/dist/chunk-UE4GPWSD.js +0 -931
  145. package/dist/chunk-UIE3R5XU.js +0 -17
  146. package/dist/chunk-UXPG6ZIN.js +0 -84
  147. package/dist/chunk-VFUK3X5B.js +0 -50
  148. package/dist/chunk-VNMJWREK.js +0 -787
  149. package/dist/chunk-VZ7CSOX2.js +0 -706
  150. package/dist/chunk-WCNQJKFT.js +0 -10
  151. package/dist/chunk-WDZR3QQM.js +0 -135
  152. package/dist/chunk-WLYVJCHV.js +0 -1433
  153. package/dist/chunk-WS7NAFTM.js +0 -1520
  154. package/dist/chunk-X6GDDWQH.js +0 -60
  155. package/dist/chunk-XPDEYNQI.js +0 -102
  156. package/dist/chunk-XRW44VGM.js +0 -58
  157. package/dist/chunk-Y2CM7HXH.js +0 -111
  158. package/dist/chunk-Y7X25LFY.js +0 -15
  159. package/dist/conversation-work-VIOQ5ZF3.js +0 -54
  160. package/dist/db-NGDJV7YH.js +0 -26
  161. package/dist/discovery-DWVDM7UK.js +0 -44
  162. package/dist/experimental-P5FZM4CU.js +0 -12
  163. package/dist/oauth-callback-server-YFY7YEGK.js +0 -243
  164. package/dist/oauth-relay-5XPVRPYB.js +0 -8
  165. package/dist/plugins-YTYJMMJF.js +0 -14
  166. package/dist/runner-ORTNSB2Q.js +0 -522
  167. package/dist/sandbox-egress-signals-FIL7EGPR.js +0 -73
  168. package/dist/sentry-MB3NL3IR.js +0 -42
  169. package/dist/skills-H376WQOH.js +0 -27
  170. package/dist/spawn-T43WHLOS.js +0 -42
  171. package/dist/task-runner-LBZWF32V.js +0 -36
  172. package/dist/validation-REJLRKI6.js +0 -17
  173. package/dist/work-3KJ3RE76.js +0 -51
  174. package/dist/worker-QFEBU72E.js +0 -24
@@ -1,1190 +0,0 @@
1
- import {
2
- usageSchema
3
- } from "./chunk-PDO5BLNM.js";
4
- import {
5
- conversationTurnFailureCodeSchema,
6
- conversationTurnFailureReasonSchema
7
- } from "./chunk-7NL7T6VU.js";
8
- import {
9
- juniorDestinationKindSchema
10
- } from "./chunk-VFUK3X5B.js";
11
-
12
- // src/api/activity.ts
13
- import { z } from "zod";
14
-
15
- // src/api/reporting-window.ts
16
- var HOUR_MS = 60 * 60 * 1e3;
17
- var SIX_HOUR_MS = 6 * HOUR_MS;
18
- var DAY_MS = 24 * HOUR_MS;
19
- var WINDOW_HOURS = 24;
20
- var WINDOW_SEVEN_DAY_HOURS = 7 * 24;
21
- var WINDOW_SIX_HOURS = 7 * 4;
22
- function startOfUtcDay(valueMs) {
23
- const date = new Date(valueMs);
24
- date.setUTCHours(0, 0, 0, 0);
25
- return date;
26
- }
27
- function startOfUtcHour(valueMs) {
28
- const date = new Date(valueMs);
29
- date.setUTCMinutes(0, 0, 0);
30
- return date;
31
- }
32
- function startOfUtcSixHour(valueMs) {
33
- const date = startOfUtcHour(valueMs);
34
- date.setUTCHours(Math.floor(date.getUTCHours() / 6) * 6, 0, 0, 0);
35
- return date;
36
- }
37
- function utcDayKey(value) {
38
- const date = typeof value === "number" ? new Date(value) : value;
39
- return date.toISOString().slice(0, 10);
40
- }
41
- function utcHourKey(value) {
42
- const date = typeof value === "number" ? new Date(value) : value;
43
- return date.toISOString().slice(0, 13);
44
- }
45
- function utcSixHourKey(value) {
46
- return utcHourKey(startOfUtcSixHour(
47
- typeof value === "number" ? value : value.getTime()
48
- ));
49
- }
50
- function trailingUtcDayWindow(nowMs, dayCount) {
51
- const end = startOfUtcDay(nowMs);
52
- const start = new Date(end);
53
- start.setUTCDate(start.getUTCDate() - (dayCount - 1));
54
- return { end, start };
55
- }
56
- function trailingUtcHourWindow(nowMs, hourCount = WINDOW_HOURS) {
57
- const end = startOfUtcHour(nowMs);
58
- const start = new Date(end.getTime() - (hourCount - 1) * HOUR_MS);
59
- return { end, start };
60
- }
61
- function trailingUtcSixHourWindow(nowMs, bucketCount = WINDOW_SIX_HOURS) {
62
- const end = startOfUtcSixHour(nowMs);
63
- const start = new Date(end.getTime() - (bucketCount - 1) * SIX_HOUR_MS);
64
- return { end, start };
65
- }
66
- function fillUtcDays(args) {
67
- const { end, start } = trailingUtcDayWindow(args.nowMs, args.count);
68
- const items = [];
69
- for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setUTCDate(cursor.getUTCDate() + 1)) {
70
- const date = utcDayKey(cursor);
71
- items.push(args.rows.get(date) ?? args.empty(date));
72
- }
73
- return items;
74
- }
75
- function fillUtcHours(args) {
76
- const hourCount = args.count ?? WINDOW_HOURS;
77
- const { end, start } = trailingUtcHourWindow(args.nowMs, hourCount);
78
- const items = [];
79
- for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setTime(cursor.getTime() + HOUR_MS)) {
80
- const date = utcHourKey(cursor);
81
- items.push(args.rows.get(date) ?? args.empty(date));
82
- }
83
- return items;
84
- }
85
- function fillUtcSixHours(args) {
86
- const bucketCount = args.count ?? WINDOW_SIX_HOURS;
87
- const { end, start } = trailingUtcSixHourWindow(args.nowMs, bucketCount);
88
- const items = [];
89
- for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setTime(cursor.getTime() + SIX_HOUR_MS)) {
90
- const date = utcSixHourKey(cursor);
91
- items.push(args.rows.get(date) ?? args.empty(date));
92
- }
93
- return items;
94
- }
95
- function sumUtcHoursIntoSixHours(args) {
96
- const bucketCount = args.count ?? WINDOW_SIX_HOURS;
97
- const bySix = /* @__PURE__ */ new Map();
98
- for (const hour of args.hours) {
99
- const key = utcSixHourKey(Date.parse(`${hour.date}:00:00.000Z`));
100
- const current = bySix.get(key) ?? args.empty(key);
101
- const next = { ...current, date: key };
102
- for (const [field, value] of Object.entries(hour)) {
103
- if (field === "date") continue;
104
- if (typeof value === "number") {
105
- const prior = next[field];
106
- next[field] = (typeof prior === "number" ? prior : 0) + value;
107
- }
108
- }
109
- bySix.set(key, next);
110
- }
111
- return fillUtcSixHours({
112
- count: bucketCount,
113
- empty: args.empty,
114
- nowMs: args.nowMs,
115
- rows: bySix
116
- });
117
- }
118
-
119
- // src/api/activity.ts
120
- var dailyConversationActivitySchema = z.object({
121
- active: z.number(),
122
- conversations: z.number(),
123
- date: z.string(),
124
- durationMs: z.number(),
125
- failed: z.number(),
126
- tokens: z.number().optional()
127
- }).strict();
128
- function emptyActivityDay(date) {
129
- return {
130
- active: 0,
131
- conversations: 0,
132
- date,
133
- durationMs: 0,
134
- failed: 0
135
- };
136
- }
137
- function activityDays(days, nowMs, count) {
138
- return fillUtcDays({
139
- count,
140
- empty: emptyActivityDay,
141
- nowMs,
142
- rows: days
143
- });
144
- }
145
- function activityHours(hours, nowMs) {
146
- return fillUtcHours({
147
- count: WINDOW_SEVEN_DAY_HOURS,
148
- empty: emptyActivityDay,
149
- nowMs,
150
- rows: hours
151
- });
152
- }
153
- function activitySixHours(hours, nowMs) {
154
- const series = hours instanceof Map ? activityHours(hours, nowMs) : [...hours];
155
- return sumUtcHoursIntoSixHours({
156
- empty: emptyActivityDay,
157
- hours: series,
158
- nowMs
159
- });
160
- }
161
-
162
- // src/api/schema/code.ts
163
- import { z as z2 } from "zod";
164
- import { codeChangeStateSchema } from "@sentry/junior-plugin-api";
165
- var codeChangeSummarySchema = z2.object({
166
- closed: z2.number().int().nonnegative(),
167
- costUsd: z2.number().nonnegative().optional(),
168
- created: z2.number().int().nonnegative(),
169
- medianCostUsd: z2.number().nonnegative().optional(),
170
- medianMergeTimeMs: z2.number().nonnegative().optional(),
171
- merged: z2.number().int().nonnegative(),
172
- mergeRate: z2.number().min(0).max(1).optional(),
173
- open: z2.number().int().nonnegative()
174
- }).strict();
175
- var codeMetricBucketSchema = z2.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
176
- var codeActivityDaySchema = z2.object({
177
- closed: z2.number().int().nonnegative(),
178
- created: z2.number().int().nonnegative(),
179
- date: codeMetricBucketSchema,
180
- merged: z2.number().int().nonnegative()
181
- }).strict();
182
- var codeRepositorySummarySchema = z2.object({
183
- closed: z2.number().int().nonnegative(),
184
- created: z2.number().int().nonnegative(),
185
- id: z2.string().uuid(),
186
- medianCostUsd: z2.number().nonnegative().optional(),
187
- merged: z2.number().int().nonnegative(),
188
- mergeRate: z2.number().min(0).max(1).optional(),
189
- name: z2.string().min(1),
190
- open: z2.number().int().nonnegative(),
191
- provider: z2.string().min(1),
192
- url: z2.string().url().optional()
193
- }).strict();
194
- var codeChangeSummaryReportSchema = z2.object({
195
- closedAt: z2.string().optional(),
196
- id: z2.string().uuid(),
197
- mergedAt: z2.string().optional(),
198
- number: z2.number().int().positive(),
199
- openedAt: z2.string(),
200
- provider: z2.string().min(1),
201
- repository: z2.string().min(1),
202
- state: codeChangeStateSchema,
203
- title: z2.string().optional(),
204
- url: z2.string().url().optional()
205
- }).strict();
206
- var codeOverviewReportSchema = z2.object({
207
- activityDays: z2.array(codeActivityDaySchema),
208
- activityHours: z2.array(codeActivityDaySchema).optional(),
209
- activitySixHours: z2.array(codeActivityDaySchema).optional(),
210
- changes: z2.array(codeChangeSummaryReportSchema),
211
- generatedAt: z2.string(),
212
- repositories: z2.array(codeRepositorySummarySchema),
213
- summary: codeChangeSummarySchema,
214
- windowEnd: z2.string(),
215
- windowStart: z2.string()
216
- }).strict();
217
- var codePersonReportSchema = z2.object({
218
- activityDays: z2.array(codeActivityDaySchema),
219
- activityHours: z2.array(codeActivityDaySchema).optional(),
220
- activitySixHours: z2.array(codeActivityDaySchema).optional(),
221
- generatedAt: z2.string(),
222
- summary: codeChangeSummarySchema,
223
- windowEnd: z2.string(),
224
- windowStart: z2.string()
225
- }).strict();
226
-
227
- // src/api/schema/conversation.ts
228
- import { z as z3 } from "zod";
229
- import {
230
- conversationAnnotationInputSchema,
231
- conversationSidebarAnnotationSchema,
232
- conversationEventPresentationSchema
233
- } from "@sentry/junior-plugin-api";
234
- var conversationReportStatusSchema = z3.enum([
235
- "active",
236
- "completed",
237
- "failed"
238
- ]);
239
- var conversationSurfaceSchema = z3.enum([
240
- "api",
241
- "internal",
242
- "scheduler",
243
- "slack"
244
- ]);
245
- var conversationUsageSchema = usageSchema;
246
- var conversationParamsSchema = z3.object({ conversationId: z3.string().min(1) }).strict();
247
- var conversationAttachmentParamsSchema = z3.object({
248
- attachmentId: z3.string().min(1),
249
- conversationId: z3.string().min(1)
250
- }).strict();
251
- var conversationDetailQuerySchema = z3.object({
252
- limit: z3.coerce.number().int().min(1).max(1e3).default(500)
253
- }).strict();
254
- var conversationEventsQuerySchema = z3.object({
255
- before: z3.string().min(1),
256
- limit: z3.coerce.number().int().min(1).max(1e3).default(500)
257
- }).strict();
258
- var conversationFeedQuerySchema = z3.object({
259
- actorEmail: z3.string().trim().email().transform((value) => value.toLowerCase()).optional(),
260
- status: z3.enum(["active", "archived"]).default("active")
261
- }).strict();
262
- var archiveConversationBodySchema = z3.object({ archived: z3.boolean(), lastSeenAt: z3.string().datetime() }).strict();
263
- var archiveConversationResponseSchema = z3.object({ archivedAt: z3.string().datetime().nullable() }).strict();
264
- var createConversationBodySchema = z3.object({
265
- idempotencyKey: z3.string().trim().min(1).max(200),
266
- message: z3.string().trim().min(1).max(32e3),
267
- /** New roots default public. Private roots stay participant-only. */
268
- visibility: z3.enum(["private", "public"]).optional()
269
- }).strict();
270
- var createConversationMessageBodySchema = z3.object({
271
- idempotencyKey: z3.string().trim().min(1).max(200),
272
- message: z3.string().trim().min(1).max(32e3)
273
- }).strict();
274
- var acceptedConversationMessageSchema = z3.object({
275
- conversationId: z3.string().min(1),
276
- messageId: z3.string().min(1),
277
- status: z3.enum(["accepted", "duplicate"])
278
- }).strict();
279
- var actorIdentitySchema = z3.object({
280
- email: z3.string().optional(),
281
- fullName: z3.string().optional(),
282
- slackUserId: z3.string().optional(),
283
- slackUserName: z3.string().optional()
284
- }).strict();
285
- var conversationPendingMessageDeliverySchema = z3.enum([
286
- "defer",
287
- "interrupt"
288
- ]);
289
- var conversationPendingMessageSchema = z3.object({
290
- actorIdentity: actorIdentitySchema.optional(),
291
- createdAt: z3.string().datetime(),
292
- delivery: conversationPendingMessageDeliverySchema,
293
- inboundMessageId: z3.string().min(1),
294
- messageId: z3.string().min(1),
295
- receivedAt: z3.string().datetime(),
296
- role: z3.literal("user"),
297
- source: z3.enum(["slack", "web"]),
298
- text: z3.string().optional(),
299
- redacted: z3.literal(true).optional()
300
- }).strict().superRefine((data, context) => {
301
- if (data.text === void 0 === (data.redacted !== true)) {
302
- context.addIssue({
303
- code: "custom",
304
- message: "pending message content must be text or explicitly redacted"
305
- });
306
- }
307
- if (data.redacted && data.actorIdentity) {
308
- context.addIssue({
309
- code: "custom",
310
- message: "redacted pending messages must not expose actor identity"
311
- });
312
- }
313
- });
314
- var conversationPendingAuthorizationSchema = z3.object({
315
- authorizationUrl: z3.string().url(),
316
- completionText: z3.string().min(1),
317
- label: z3.string().min(1)
318
- }).strict();
319
- var conversationPendingMessagesReportSchema = z3.object({
320
- authorization: conversationPendingAuthorizationSchema.optional(),
321
- conversationId: z3.string().min(1),
322
- generatedAt: z3.string().datetime(),
323
- messages: z3.array(conversationPendingMessageSchema)
324
- }).strict();
325
- var cancelConversationPendingMessagesBodySchema = z3.object({
326
- inboundMessageIds: z3.array(z3.string().min(1)).min(1).optional(),
327
- receivedBefore: z3.string().datetime().optional()
328
- }).strict();
329
- var cancelConversationPendingMessagesResponseSchema = z3.object({
330
- cancelledCount: z3.number().int().nonnegative(),
331
- cancelledInboundMessageIds: z3.array(z3.string().min(1)),
332
- conversationId: z3.string().min(1)
333
- }).strict();
334
- var conversationAuxiliaryCostsSchema = z3.object({
335
- costUsd: z3.number().finite().nonnegative(),
336
- operations: z3.array(
337
- z3.object({
338
- costUsd: z3.number().finite().nonnegative(),
339
- events: z3.number().int().positive(),
340
- name: z3.string().min(1),
341
- namespace: z3.string().min(1)
342
- }).strict()
343
- ).min(1)
344
- }).strict();
345
- var conversationSourceTaskSchema = z3.object({
346
- id: z3.string().min(1).optional(),
347
- kind: z3.enum(["scheduled", "event"]),
348
- label: z3.string().min(1).optional(),
349
- title: z3.string().min(1).optional()
350
- }).strict().superRefine((value, context) => {
351
- if (Boolean(value.id) !== Boolean(value.label)) {
352
- context.addIssue({
353
- code: "custom",
354
- message: "sourceTask id and label must both be set or both omitted"
355
- });
356
- }
357
- });
358
- var conversationAnnotationReportSchema = conversationAnnotationInputSchema.and(
359
- z3.object({
360
- plugin: z3.string().min(1),
361
- createdAt: z3.string().datetime(),
362
- updatedAt: z3.string().datetime()
363
- })
364
- );
365
- var conversationSummaryReportSchema = z3.object({
366
- displayTitle: z3.string(),
367
- cumulativeDurationMs: z3.number(),
368
- cumulativeUsage: conversationUsageSchema.optional(),
369
- auxiliaryCosts: conversationAuxiliaryCostsSchema.optional(),
370
- conversationId: z3.string(),
371
- isParticipant: z3.boolean(),
372
- visibility: z3.enum(["private", "public"]).optional(),
373
- status: conversationReportStatusSchema,
374
- startedAt: z3.string(),
375
- lastSeenAt: z3.string(),
376
- lastProgressAt: z3.string(),
377
- surface: conversationSurfaceSchema,
378
- actorIdentity: actorIdentitySchema.optional(),
379
- archivedAt: z3.string().datetime().nullable().optional(),
380
- channel: z3.string().optional(),
381
- channelName: z3.string().optional(),
382
- channelNameRedacted: z3.boolean().optional(),
383
- locationId: z3.string().optional(),
384
- sentryTraceUrl: z3.string().optional(),
385
- locationUrl: z3.string().url().optional(),
386
- traceId: z3.string().optional(),
387
- /**
388
- * Plugin-owned resource links for this conversation.
389
- * Present on the conversation feed when the viewer can see private content.
390
- * Clients must not fetch provider state while rendering these links.
391
- */
392
- annotations: z3.array(conversationAnnotationReportSchema).optional(),
393
- /** Plugin-selected annotations for the compact conversation row. */
394
- sidebarAnnotations: z3.array(conversationSidebarAnnotationSchema).optional(),
395
- assignedWork: z3.boolean().optional(),
396
- finishedWorkAt: z3.string().datetime().optional(),
397
- /**
398
- * Dashboard Priority membership for this conversation summary.
399
- * Present on the conversation feed. Clients must not recompute it.
400
- *
401
- * True only when:
402
- * - unfinished work was last seen within 48 hours
403
- * - finished assigned work has conversation activity after the finish time
404
- * - there is no known work and the conversation was last seen within 3 hours
405
- */
406
- isPriority: z3.boolean().optional(),
407
- unfinishedWork: z3.boolean().optional()
408
- }).strict();
409
- var conversationReportMessageEventDataSchema = z3.object({
410
- type: z3.literal("message"),
411
- messageId: z3.string().min(1),
412
- role: z3.enum(["assistant", "system", "user"]),
413
- source: z3.enum(["slack", "web"]).optional(),
414
- actorIdentity: actorIdentitySchema.optional(),
415
- eventType: z3.string().min(1).optional(),
416
- explicitMention: z3.boolean().optional(),
417
- trustedSummary: z3.string().min(1).optional(),
418
- text: z3.string().optional(),
419
- redacted: z3.literal(true).optional()
420
- }).strict().superRefine((data, context) => {
421
- if (data.text === void 0 === (data.redacted !== true)) {
422
- context.addIssue({
423
- code: "custom",
424
- message: "message content must be text or explicitly redacted"
425
- });
426
- }
427
- if (data.redacted && data.actorIdentity) {
428
- context.addIssue({
429
- code: "custom",
430
- message: "redacted messages must not expose actor identity"
431
- });
432
- }
433
- });
434
- var conversationReportMessageHandledEventDataSchema = z3.object({
435
- type: z3.literal("message_handled"),
436
- messageId: z3.string().min(1)
437
- }).strict();
438
- var conversationReportToolCallSchema = z3.object({
439
- toolCallId: z3.string().min(1),
440
- name: z3.string().min(1),
441
- status: z3.enum(["running", "completed", "error"]),
442
- startedAt: z3.string().datetime().optional(),
443
- startedSeq: z3.number().int().nonnegative().optional(),
444
- input: z3.unknown().optional(),
445
- output: z3.unknown().optional()
446
- }).strict().superRefine((call, context) => {
447
- if (call.startedAt === void 0 !== (call.startedSeq === void 0)) {
448
- context.addIssue({
449
- code: "custom",
450
- message: "tool start sequence and timestamp must be provided together"
451
- });
452
- }
453
- });
454
- var conversationReportReasoningPartSchema = z3.object({
455
- type: z3.literal("reasoning"),
456
- text: z3.string().min(1).optional(),
457
- redacted: z3.literal(true).optional()
458
- }).strict().superRefine((data, context) => {
459
- if (data.text === void 0 === (data.redacted !== true)) {
460
- context.addIssue({
461
- code: "custom",
462
- message: "reasoning content must be text or explicitly redacted"
463
- });
464
- }
465
- });
466
- var conversationReportAssistantToolCallPartSchema = z3.object({
467
- type: z3.literal("tool_call"),
468
- toolCallId: z3.string().min(1)
469
- }).strict();
470
- var conversationReportAssistantMetadataSchema = z3.object({
471
- parts: z3.array(
472
- z3.discriminatedUnion("type", [
473
- conversationReportReasoningPartSchema,
474
- conversationReportAssistantToolCallPartSchema
475
- ])
476
- ).min(1)
477
- }).strict();
478
- var conversationReportToolCallsEventDataSchema = z3.object({
479
- type: z3.literal("tool_calls"),
480
- calls: z3.array(conversationReportToolCallSchema).min(1),
481
- assistant: conversationReportAssistantMetadataSchema.optional()
482
- }).strict().superRefine((data, context) => {
483
- if (!data.assistant) return;
484
- const callCounts = /* @__PURE__ */ new Map();
485
- for (const call of data.calls) {
486
- callCounts.set(
487
- call.toolCallId,
488
- (callCounts.get(call.toolCallId) ?? 0) + 1
489
- );
490
- }
491
- const partCounts = /* @__PURE__ */ new Map();
492
- for (const part of data.assistant.parts) {
493
- if (part.type !== "tool_call") continue;
494
- partCounts.set(
495
- part.toolCallId,
496
- (partCounts.get(part.toolCallId) ?? 0) + 1
497
- );
498
- }
499
- if (callCounts.size !== partCounts.size || [...callCounts].some(
500
- ([toolCallId, count]) => partCounts.get(toolCallId) !== count
501
- )) {
502
- context.addIssue({
503
- code: "custom",
504
- path: ["assistant", "parts"],
505
- message: "assistant tool parts must reference every call exactly once"
506
- });
507
- }
508
- });
509
- var conversationReportAssistantMessageEventDataSchema = z3.object({
510
- type: z3.literal("assistant_message"),
511
- parts: z3.array(conversationReportReasoningPartSchema).min(1)
512
- }).strict();
513
- var conversationReportTurnLifecycleEventDataSchema = z3.discriminatedUnion(
514
- "state",
515
- [
516
- z3.object({
517
- type: z3.literal("turn_lifecycle"),
518
- turnId: z3.string().min(1),
519
- state: z3.enum(["succeeded", "no_reply"])
520
- }).strict(),
521
- z3.object({
522
- type: z3.literal("turn_lifecycle"),
523
- turnId: z3.string().min(1),
524
- state: z3.literal("started"),
525
- inputMessageIds: z3.array(z3.string().min(1)).min(1).optional()
526
- }).strict(),
527
- z3.object({
528
- type: z3.literal("turn_lifecycle"),
529
- turnId: z3.string().min(1),
530
- state: z3.literal("failed"),
531
- failureCode: conversationTurnFailureCodeSchema,
532
- failureReason: conversationTurnFailureReasonSchema.optional(),
533
- eventId: z3.string().regex(/^[a-f0-9]{32}$/i).optional(),
534
- sentryEventUrl: z3.string().url().optional()
535
- }).strict()
536
- ]
537
- );
538
- var conversationReportTurnRoutedEventDataSchema = z3.object({
539
- type: z3.literal("turn_routed"),
540
- turnId: z3.string().min(1),
541
- modelProfile: z3.string().min(1),
542
- modelId: z3.string().min(1),
543
- costUsd: z3.number().finite().nonnegative().optional(),
544
- reasoningLevel: z3.string().min(1),
545
- confidence: z3.number().min(0).max(1).optional(),
546
- source: z3.enum(["configured", "inherited", "router"])
547
- }).strict();
548
- var conversationReportGuardianActionReviewedEventDataSchema = z3.object({
549
- type: z3.literal("guardian_action_reviewed"),
550
- turnId: z3.string().min(1),
551
- toolCallId: z3.string().min(1),
552
- toolName: z3.string().min(1),
553
- decision: z3.enum(["allow", "ask", "deny"]),
554
- riskLevel: z3.enum(["low", "medium", "high", "critical"]),
555
- userAuthorization: z3.enum(["high", "medium", "low", "unknown"])
556
- }).strict();
557
- var conversationReportTurnContextEventDataSchema = z3.object({
558
- type: z3.literal("turn_context"),
559
- turnId: z3.string().min(1),
560
- pluginName: z3.string().min(1),
561
- kind: z3.string().min(1),
562
- version: z3.number().int().positive(),
563
- content: z3.record(z3.string(), z3.unknown())
564
- }).strict();
565
- var conversationReportStructuredEventDataSchema = z3.object({
566
- type: z3.literal("structured_event"),
567
- namespace: z3.string().min(1),
568
- name: z3.string().min(1),
569
- version: z3.number().int().positive(),
570
- turnId: z3.string().min(1).optional(),
571
- presentation: conversationEventPresentationSchema
572
- }).strict();
573
- var conversationReportDeliveredAttachmentSchema = z3.object({
574
- id: z3.string().min(1),
575
- filename: z3.string().min(1),
576
- contentType: z3.string().min(1),
577
- bytes: z3.number().int().nonnegative()
578
- }).strict();
579
- var conversationReportAttachmentsDeliveredEventDataSchema = z3.object({
580
- type: z3.literal("attachments_delivered"),
581
- attachments: z3.array(conversationReportDeliveredAttachmentSchema).min(1)
582
- }).strict();
583
- var conversationReportCompactionEventDataSchema = z3.object({
584
- type: z3.literal("compaction"),
585
- modelProfile: z3.string().min(1).optional(),
586
- modelId: z3.string().min(1).optional(),
587
- summary: z3.string().min(1).optional(),
588
- details: z3.object({
589
- reason: z3.literal("capacity"),
590
- estimatedInputTokens: z3.number().int().nonnegative(),
591
- replacementInputTokens: z3.number().int().nonnegative().optional(),
592
- triggerTokens: z3.number().int().nonnegative(),
593
- inputLimitTokens: z3.number().int().positive(),
594
- inputMessageCount: z3.number().int().nonnegative(),
595
- retainedMessageCount: z3.number().int().nonnegative(),
596
- summaryChars: z3.number().int().nonnegative()
597
- }).strict().optional()
598
- }).strict();
599
- var conversationReportHandoffEventDataSchema = z3.object({
600
- type: z3.literal("handoff"),
601
- modelProfile: z3.string().min(1),
602
- modelId: z3.string().min(1),
603
- reasoningLevel: z3.string().min(1).optional(),
604
- triggeringToolCallId: z3.string().min(1).optional(),
605
- summary: z3.string().min(1).optional()
606
- }).strict();
607
- var conversationReportSubagentEventDataSchema = z3.object({
608
- type: z3.literal("subagent"),
609
- startedSeq: z3.number().int().nonnegative(),
610
- startedAt: z3.string().datetime(),
611
- childConversationId: z3.string().min(1),
612
- subagentKind: z3.string().min(1),
613
- parentToolCallId: z3.string().min(1).optional(),
614
- status: z3.enum(["running", "completed", "error", "aborted"])
615
- }).strict();
616
- var conversationReportEventDataSchema = z3.discriminatedUnion("type", [
617
- conversationReportMessageEventDataSchema,
618
- conversationReportMessageHandledEventDataSchema,
619
- conversationReportAssistantMessageEventDataSchema,
620
- conversationReportToolCallsEventDataSchema,
621
- conversationReportTurnLifecycleEventDataSchema,
622
- conversationReportTurnContextEventDataSchema,
623
- conversationReportStructuredEventDataSchema,
624
- conversationReportAttachmentsDeliveredEventDataSchema,
625
- conversationReportTurnRoutedEventDataSchema,
626
- conversationReportGuardianActionReviewedEventDataSchema,
627
- conversationReportCompactionEventDataSchema,
628
- conversationReportHandoffEventDataSchema,
629
- conversationReportSubagentEventDataSchema
630
- ]);
631
- var conversationReportEventSchema = z3.object({
632
- seq: z3.number().int().nonnegative(),
633
- createdAt: z3.string().datetime(),
634
- data: conversationReportEventDataSchema
635
- }).strict();
636
- var conversationEventHistorySchema = z3.discriminatedUnion("status", [
637
- z3.object({ status: z3.literal("available") }).strict(),
638
- z3.object({
639
- status: z3.literal("redacted"),
640
- reason: z3.literal("non_public_conversation")
641
- }).strict(),
642
- z3.object({
643
- status: z3.literal("expired"),
644
- expiredAt: z3.string().datetime()
645
- }).strict()
646
- ]);
647
- var conversationModelUsageSchema = z3.object({
648
- modelId: z3.string(),
649
- usage: conversationUsageSchema
650
- }).strict();
651
- function validateConversationEvents(report, context) {
652
- if (report.eventHistory.status === "expired" && report.events.length > 0) {
653
- context.addIssue({
654
- code: "custom",
655
- path: ["events"],
656
- message: "expired event history must not contain events"
657
- });
658
- }
659
- for (let index = 1; index < report.events.length; index += 1) {
660
- if (report.events[index].seq <= report.events[index - 1].seq) {
661
- context.addIssue({
662
- code: "custom",
663
- path: ["events", index, "seq"],
664
- message: "report event sequences must be strictly increasing"
665
- });
666
- }
667
- }
668
- for (const [index, event] of report.events.entries()) {
669
- if (event.data.type === "message") {
670
- if (report.eventHistory.status === "redacted" && event.data.redacted !== true) {
671
- context.addIssue({
672
- code: "custom",
673
- path: ["events", index, "data"],
674
- message: "redacted event history must redact messages"
675
- });
676
- }
677
- if (report.eventHistory.status === "available" && event.data.redacted === true) {
678
- context.addIssue({
679
- code: "custom",
680
- path: ["events", index, "data"],
681
- message: "available event history must expose messages"
682
- });
683
- }
684
- }
685
- if (report.eventHistory.status === "redacted" && event.data.type === "tool_calls" && event.data.calls.some(
686
- (call) => call.input !== void 0 || call.output !== void 0
687
- )) {
688
- context.addIssue({
689
- code: "custom",
690
- path: ["events", index, "data"],
691
- message: "redacted event history must redact tool payloads"
692
- });
693
- }
694
- if (report.eventHistory.status === "redacted" && event.data.type === "assistant_message" && event.data.parts.some((part) => part.text !== void 0)) {
695
- context.addIssue({
696
- code: "custom",
697
- path: ["events", index, "data"],
698
- message: "redacted event history must redact assistant messages"
699
- });
700
- }
701
- if (report.eventHistory.status === "available" && event.data.type === "assistant_message" && event.data.parts.some((part) => part.redacted === true)) {
702
- context.addIssue({
703
- code: "custom",
704
- path: ["events", index, "data"],
705
- message: "available event history must expose reasoning"
706
- });
707
- }
708
- if (event.data.type === "tool_calls" && (report.eventHistory.status === "redacted" && event.data.assistant?.parts.some(
709
- (part) => part.type === "reasoning" && part.text !== void 0
710
- ) || report.eventHistory.status === "available" && event.data.assistant?.parts.some(
711
- (part) => part.type === "reasoning" && part.redacted === true
712
- ))) {
713
- context.addIssue({
714
- code: "custom",
715
- path: ["events", index, "data", "assistant"],
716
- message: "assistant reasoning must match event history visibility"
717
- });
718
- }
719
- }
720
- }
721
- var conversationDetailReportSchema = conversationSummaryReportSchema.extend({
722
- modelUsage: z3.array(conversationModelUsageSchema).optional(),
723
- events: z3.array(conversationReportEventSchema),
724
- eventHistory: conversationEventHistorySchema,
725
- previousCursor: z3.string().min(1).optional(),
726
- generatedAt: z3.string(),
727
- sentryConversationUrl: z3.string().optional(),
728
- sourceTask: conversationSourceTaskSchema.optional()
729
- }).strict().superRefine(validateConversationEvents);
730
- var conversationEventPageSchema = z3.object({
731
- events: z3.array(conversationReportEventSchema),
732
- eventHistory: conversationEventHistorySchema,
733
- previousCursor: z3.string().min(1).optional(),
734
- generatedAt: z3.string()
735
- }).strict().superRefine(validateConversationEvents);
736
- var conversationFeedSchema = z3.object({
737
- conversations: z3.array(conversationSummaryReportSchema),
738
- source: z3.literal("conversation_index"),
739
- generatedAt: z3.string()
740
- }).strict();
741
- var conversationStatsItemSchema = z3.object({
742
- active: z3.number(),
743
- conversations: z3.number(),
744
- durationMs: z3.number(),
745
- failed: z3.number(),
746
- label: z3.string(),
747
- costUsd: z3.number().optional(),
748
- tokens: z3.number().optional()
749
- }).strict();
750
- var conversationMetricBucketSchema = z3.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
751
- var conversationMetricDaySchema = z3.object({
752
- cachedInputTokens: z3.number().optional(),
753
- conversations: z3.number(),
754
- costUsd: z3.number().optional(),
755
- date: conversationMetricBucketSchema,
756
- durationMs: z3.number(),
757
- inputTokens: z3.number().optional(),
758
- tokens: z3.number().optional()
759
- }).strict();
760
- var guardianMetricDaySchema = z3.object({
761
- allow: z3.number(),
762
- ask: z3.number(),
763
- costUsd: z3.number().optional(),
764
- date: conversationMetricBucketSchema,
765
- deny: z3.number(),
766
- requests: z3.number()
767
- }).strict();
768
- var guardianStatsSchema = z3.object({
769
- allow: z3.number(),
770
- ask: z3.number(),
771
- costUsd: z3.number().optional(),
772
- deny: z3.number(),
773
- metricDays: z3.array(guardianMetricDaySchema),
774
- metricHours: z3.array(guardianMetricDaySchema).optional(),
775
- metricSixHours: z3.array(guardianMetricDaySchema).optional(),
776
- requests: z3.number()
777
- }).strict();
778
- var conversationStatsReportSchema = z3.object({
779
- active: z3.number(),
780
- cachedInputTokens: z3.number().optional(),
781
- conversations: z3.number(),
782
- durationMs: z3.number(),
783
- failed: z3.number(),
784
- generatedAt: z3.string(),
785
- guardian: guardianStatsSchema,
786
- metricDays: z3.array(conversationMetricDaySchema),
787
- metricHours: z3.array(conversationMetricDaySchema).optional(),
788
- metricSixHours: z3.array(conversationMetricDaySchema).optional(),
789
- locations: z3.array(conversationStatsItemSchema),
790
- actors: z3.array(conversationStatsItemSchema),
791
- source: z3.literal("conversation_index"),
792
- costUsd: z3.number().optional(),
793
- inputTokens: z3.number().optional(),
794
- tokens: z3.number().optional(),
795
- windowEnd: z3.string(),
796
- windowStart: z3.string()
797
- }).strict();
798
-
799
- // src/api/schema/person.ts
800
- import { z as z4 } from "zod";
801
- var personParamsSchema = z4.object({ email: z4.string().trim().min(1) }).strict();
802
- var peopleConversationStatsItemSchema = conversationStatsItemSchema.omit({ costUsd: true });
803
- var peopleMetricBucketSchema = z4.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
804
- var actorActivityDayReportSchema = z4.object({
805
- active: z4.number(),
806
- conversations: z4.number(),
807
- costUsd: z4.number().optional(),
808
- date: peopleMetricBucketSchema,
809
- durationMs: z4.number(),
810
- failed: z4.number(),
811
- tokens: z4.number().optional()
812
- }).strict();
813
- var peopleActivityDayReportSchema = z4.object({
814
- activePeople: z4.number(),
815
- conversations: z4.number(),
816
- date: peopleMetricBucketSchema
817
- }).strict();
818
- var actorTotalsReportSchema = z4.object({
819
- active: z4.number(),
820
- activeDays: z4.number(),
821
- conversations: z4.number(),
822
- durationMs: z4.number(),
823
- failed: z4.number(),
824
- tokens: z4.number().optional()
825
- }).strict();
826
- var actorWindowMetricsSchema = z4.object({
827
- conversations: z4.number().int().nonnegative(),
828
- costUsd: z4.number().finite().nonnegative(),
829
- durationMs: z4.number().finite().nonnegative(),
830
- priorCostUsd: z4.number().finite().nonnegative()
831
- }).strict();
832
- var actorDirectoryWindowsSchema = z4.object({
833
- 1: actorWindowMetricsSchema,
834
- 7: actorWindowMetricsSchema,
835
- 30: actorWindowMetricsSchema,
836
- 90: actorWindowMetricsSchema
837
- }).strict();
838
- var identifiedActorSchema = actorIdentitySchema.extend({ email: z4.string().min(1) }).strict();
839
- var actorSummaryReportSchema = actorTotalsReportSchema.extend({
840
- firstSeenAt: z4.string(),
841
- lastSeenAt: z4.string(),
842
- actor: identifiedActorSchema,
843
- windows: actorDirectoryWindowsSchema
844
- }).strict();
845
- var actorDirectoryReportSchema = z4.object({
846
- activityDays: z4.array(peopleActivityDayReportSchema),
847
- activityHours: z4.array(peopleActivityDayReportSchema).optional(),
848
- activitySixHours: z4.array(peopleActivityDayReportSchema).optional(),
849
- generatedAt: z4.string(),
850
- people: z4.array(actorSummaryReportSchema),
851
- source: z4.literal("conversation_index"),
852
- windowEnd: z4.string(),
853
- windowStart: z4.string()
854
- }).strict();
855
- var actorProfileReportSchema = z4.object({
856
- activityDays: z4.array(actorActivityDayReportSchema),
857
- activityHours: z4.array(actorActivityDayReportSchema).optional(),
858
- activitySixHours: z4.array(actorActivityDayReportSchema).optional(),
859
- generatedAt: z4.string(),
860
- locations: z4.array(peopleConversationStatsItemSchema),
861
- recentConversations: z4.array(conversationSummaryReportSchema),
862
- actor: identifiedActorSchema,
863
- source: z4.literal("conversation_index"),
864
- surfaces: z4.array(peopleConversationStatsItemSchema),
865
- totals: actorTotalsReportSchema,
866
- windowEnd: z4.string(),
867
- windowStart: z4.string()
868
- }).strict();
869
- var personalSpendReportSchema = z4.object({
870
- generatedAt: z4.string(),
871
- sevenDaysUsd: z4.number().finite().nonnegative(),
872
- source: z4.literal("conversation_index"),
873
- thirtyDaysUsd: z4.number().finite().nonnegative(),
874
- windowEnd: z4.string(),
875
- windowStart: z4.string()
876
- }).strict();
877
-
878
- // src/api/schema/location.ts
879
- import { z as z5 } from "zod";
880
- var locationParamsSchema = z5.object({ locationId: z5.string().min(1) }).strict();
881
- var locationSummaryReportSchema = conversationStatsItemSchema.extend({
882
- id: z5.string(),
883
- firstSeenAt: z5.string(),
884
- kind: juniorDestinationKindSchema,
885
- lastSeenAt: z5.string(),
886
- provider: z5.string(),
887
- providerDestinationId: z5.string(),
888
- visibility: z5.literal("public")
889
- }).strict();
890
- var locationActorSummaryReportSchema = conversationStatsItemSchema.extend({ actor: actorIdentitySchema }).strict();
891
- var locationMetricBucketSchema = z5.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
892
- var locationActivityDayReportSchema = z5.object({
893
- date: locationMetricBucketSchema,
894
- privateConversations: z5.number(),
895
- publicConversations: z5.number()
896
- }).strict();
897
- var locationDirectoryReportSchema = z5.object({
898
- activityDays: z5.array(locationActivityDayReportSchema),
899
- activityHours: z5.array(locationActivityDayReportSchema).optional(),
900
- activitySixHours: z5.array(locationActivityDayReportSchema).optional(),
901
- generatedAt: z5.string(),
902
- locations: z5.array(locationSummaryReportSchema),
903
- privateActivity: conversationStatsItemSchema,
904
- source: z5.literal("conversation_index"),
905
- windowEnd: z5.string(),
906
- windowStart: z5.string()
907
- }).strict();
908
- var locationDetailReportSchema = locationSummaryReportSchema.extend({
909
- activityDays: z5.array(dailyConversationActivitySchema),
910
- activityHours: z5.array(dailyConversationActivitySchema).optional(),
911
- activitySixHours: z5.array(dailyConversationActivitySchema).optional(),
912
- actors: z5.array(locationActorSummaryReportSchema),
913
- generatedAt: z5.string(),
914
- recentConversations: z5.array(conversationSummaryReportSchema),
915
- source: z5.literal("conversation_index"),
916
- windowEnd: z5.string(),
917
- windowStart: z5.string()
918
- }).strict();
919
-
920
- // src/api/schema/common.ts
921
- import { z as z6 } from "zod";
922
- var apiErrorSchema = z6.object({ error: z6.string().min(1) }).strict();
923
-
924
- // src/api/schema/personal-token.ts
925
- import { z as z7 } from "zod";
926
- var personalTokenMetadataSchema = z7.object({
927
- id: z7.string().uuid(),
928
- name: z7.string(),
929
- tokenSuffix: z7.string(),
930
- createdAt: z7.string().datetime(),
931
- expiresAt: z7.string().datetime(),
932
- lastUsedAt: z7.string().datetime().nullable()
933
- }).strict();
934
- var personalTokenListSchema = z7.object({ tokens: z7.array(personalTokenMetadataSchema) }).strict();
935
- var createPersonalTokenBodySchema = z7.object({ name: z7.string().trim().min(1).max(80) }).strict();
936
- var createdPersonalTokenSchema = personalTokenMetadataSchema.extend({ token: z7.string().startsWith("jr_pat_") }).strict();
937
- var personalTokenParamsSchema = z7.object({ id: z7.string().uuid() }).strict();
938
- var revokePersonalTokenResponseSchema = z7.object({ revoked: z7.literal(true) }).strict();
939
-
940
- // src/api/schema/workspace.ts
941
- import { z as z8 } from "zod";
942
- var workspaceRepoInputSchema = z8.object({
943
- provider: z8.string(),
944
- repo: z8.string()
945
- }).strict();
946
- var workspaceRepoSchema = z8.object({
947
- provider: z8.string(),
948
- repo: z8.string(),
949
- checkoutPath: z8.string()
950
- }).strict();
951
- var workspaceSnapshotSchema = z8.object({
952
- id: z8.string(),
953
- generatedAt: z8.iso.datetime(),
954
- buildDurationMs: z8.number().int().nonnegative(),
955
- sizeBytes: z8.number().int().nonnegative().nullable()
956
- }).strict();
957
- var baselineSnapshotSchema = z8.object({
958
- id: z8.string(),
959
- generatedAt: z8.iso.datetime(),
960
- buildDurationMs: z8.number().int().nonnegative(),
961
- dependencyCount: z8.number().int().nonnegative()
962
- }).strict();
963
- var workspaceSchema = z8.object({
964
- id: z8.string().uuid(),
965
- name: z8.string(),
966
- setupScript: z8.string(),
967
- repos: z8.array(workspaceRepoSchema),
968
- snapshot: workspaceSnapshotSchema.nullable()
969
- }).strict();
970
- var workspaceListSchema = z8.object({
971
- baselineSnapshot: baselineSnapshotSchema.nullable(),
972
- workspaces: z8.array(workspaceSchema)
973
- }).strict();
974
- var workspaceBodySchema = z8.object({
975
- name: z8.string(),
976
- setupScript: z8.string().optional(),
977
- repos: z8.array(workspaceRepoInputSchema)
978
- }).strict();
979
- var workspaceParamsSchema = z8.object({ id: z8.string().uuid() }).strict();
980
- var deleteWorkspaceResponseSchema = z8.object({ deleted: z8.literal(true) }).strict();
981
-
982
- // src/api/schema/task.ts
983
- import { z as z9 } from "zod";
984
- var taskDestinationSchema = z9.object({
985
- channelId: z9.string().min(1),
986
- label: z9.string().min(1),
987
- teamId: z9.string().min(1),
988
- visibility: z9.enum(["private", "public"])
989
- }).strict();
990
- var taskRunWindowsSchema = z9.object({
991
- 1: z9.number().int().nonnegative(),
992
- 7: z9.number().int().nonnegative(),
993
- 30: z9.number().int().nonnegative(),
994
- 90: z9.number().int().nonnegative()
995
- }).strict();
996
- var taskSummaryBaseSchema = z9.object({
997
- createdAt: z9.string().datetime(),
998
- createdBy: z9.string().min(1),
999
- createdByEmail: z9.string().trim().email().optional(),
1000
- destination: taskDestinationSchema,
1001
- id: z9.string().min(1),
1002
- instruction: z9.string().min(1),
1003
- lastConversationId: z9.string().min(1).optional(),
1004
- lastRunAt: z9.string().datetime().optional(),
1005
- ownedByViewer: z9.boolean(),
1006
- runs: taskRunWindowsSchema,
1007
- /** Short display title; falls back from instruction when unset. */
1008
- title: z9.string().min(1),
1009
- totalRuns: z9.number().int().nonnegative()
1010
- });
1011
- var scheduledTaskSummarySchema = taskSummaryBaseSchema.extend({
1012
- kind: z9.literal("scheduled"),
1013
- nextRunAt: z9.string().datetime().optional(),
1014
- schedule: z9.string().min(1),
1015
- status: z9.enum(["active", "blocked", "completed"])
1016
- }).strict();
1017
- var eventTaskSummarySchema = taskSummaryBaseSchema.extend({
1018
- events: z9.array(z9.string().min(1)).min(1),
1019
- kind: z9.literal("event"),
1020
- resource: z9.string().min(1),
1021
- source: z9.string().min(1),
1022
- triggerAvailable: z9.boolean()
1023
- }).strict();
1024
- var taskSummarySchema = z9.discriminatedUnion("kind", [
1025
- scheduledTaskSummarySchema,
1026
- eventTaskSummarySchema
1027
- ]);
1028
- var taskMetricBucketSchema = z9.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
1029
- var taskExecutionDaySchema = z9.object({
1030
- /** Linked conversation spend for executions in this bucket. */
1031
- costUsd: z9.number().finite().nonnegative(),
1032
- date: taskMetricBucketSchema,
1033
- event: z9.number().int().nonnegative(),
1034
- scheduled: z9.number().int().nonnegative()
1035
- }).strict();
1036
- var taskListSchema = z9.object({
1037
- executionDays: z9.array(taskExecutionDaySchema),
1038
- executionHours: z9.array(taskExecutionDaySchema).optional(),
1039
- executionSixHours: z9.array(taskExecutionDaySchema).optional(),
1040
- tasks: z9.array(taskSummarySchema),
1041
- truncated: z9.boolean()
1042
- }).strict();
1043
- var taskParamsSchema = z9.object({
1044
- id: z9.string().min(1),
1045
- kind: z9.enum(["scheduled", "event"])
1046
- }).strict();
1047
- var taskExecutionStatusSchema = z9.enum([
1048
- "blocked",
1049
- "completed",
1050
- "failed"
1051
- ]);
1052
- var taskExecutionSchema = z9.object({
1053
- conversationId: z9.string().min(1).optional(),
1054
- /** Estimated model cost for the linked conversation, when known. */
1055
- costUsd: z9.number().finite().nonnegative().optional(),
1056
- /** Cumulative conversation runtime in milliseconds, when known. */
1057
- durationMs: z9.number().finite().nonnegative().optional(),
1058
- executedAt: z9.string().datetime(),
1059
- executionId: z9.string().min(1),
1060
- status: taskExecutionStatusSchema,
1061
- title: z9.string().min(1).optional(),
1062
- /** Cumulative conversation token total, when known. */
1063
- totalTokens: z9.number().int().nonnegative().optional()
1064
- }).strict();
1065
- var taskExecutionStatusDaySchema = z9.object({
1066
- blocked: z9.number().int().nonnegative(),
1067
- completed: z9.number().int().nonnegative(),
1068
- date: taskMetricBucketSchema,
1069
- failed: z9.number().int().nonnegative()
1070
- }).strict();
1071
- var taskExecutionListSchema = z9.object({
1072
- executionDays: z9.array(taskExecutionStatusDaySchema),
1073
- executionHours: z9.array(taskExecutionStatusDaySchema).optional(),
1074
- executionSixHours: z9.array(taskExecutionStatusDaySchema).optional(),
1075
- executions: z9.array(taskExecutionSchema),
1076
- task: taskSummarySchema,
1077
- truncated: z9.boolean()
1078
- }).strict();
1079
- var taskRunSchema = taskExecutionSchema.extend({
1080
- kind: z9.enum(["scheduled", "event"]),
1081
- taskId: z9.string().min(1),
1082
- taskTitle: z9.string().min(1)
1083
- }).strict();
1084
- var taskRunListSchema = z9.object({
1085
- runs: z9.array(taskRunSchema),
1086
- truncated: z9.boolean()
1087
- }).strict();
1088
-
1089
- // src/api/schema/stats.ts
1090
- import { z as z10 } from "zod";
1091
- var statSchema = z10.object({
1092
- count: z10.number().int().nonnegative(),
1093
- date: z10.string(),
1094
- metric: z10.string().min(1),
1095
- name: z10.string().min(1),
1096
- namespace: z10.string().min(1)
1097
- }).strict();
1098
- var statsReportSchema = z10.object({
1099
- generatedAt: z10.string().datetime(),
1100
- stats: z10.array(statSchema),
1101
- windowEnd: z10.string(),
1102
- windowStart: z10.string()
1103
- }).strict();
1104
-
1105
- export {
1106
- apiErrorSchema,
1107
- conversationParamsSchema,
1108
- conversationAttachmentParamsSchema,
1109
- conversationDetailQuerySchema,
1110
- conversationEventsQuerySchema,
1111
- conversationFeedQuerySchema,
1112
- archiveConversationBodySchema,
1113
- archiveConversationResponseSchema,
1114
- createConversationBodySchema,
1115
- createConversationMessageBodySchema,
1116
- acceptedConversationMessageSchema,
1117
- conversationPendingMessageDeliverySchema,
1118
- conversationPendingMessageSchema,
1119
- conversationPendingAuthorizationSchema,
1120
- conversationPendingMessagesReportSchema,
1121
- cancelConversationPendingMessagesBodySchema,
1122
- cancelConversationPendingMessagesResponseSchema,
1123
- conversationAuxiliaryCostsSchema,
1124
- conversationSummaryReportSchema,
1125
- conversationReportEventDataSchema,
1126
- conversationReportEventSchema,
1127
- conversationEventHistorySchema,
1128
- conversationDetailReportSchema,
1129
- conversationEventPageSchema,
1130
- conversationFeedSchema,
1131
- conversationStatsReportSchema,
1132
- HOUR_MS,
1133
- DAY_MS,
1134
- WINDOW_SEVEN_DAY_HOURS,
1135
- startOfUtcHour,
1136
- utcDayKey,
1137
- utcHourKey,
1138
- trailingUtcDayWindow,
1139
- trailingUtcHourWindow,
1140
- trailingUtcSixHourWindow,
1141
- fillUtcDays,
1142
- fillUtcHours,
1143
- fillUtcSixHours,
1144
- sumUtcHoursIntoSixHours,
1145
- codeChangeSummarySchema,
1146
- codeActivityDaySchema,
1147
- codeRepositorySummarySchema,
1148
- codeChangeSummaryReportSchema,
1149
- codeOverviewReportSchema,
1150
- codePersonReportSchema,
1151
- dailyConversationActivitySchema,
1152
- activityDays,
1153
- activityHours,
1154
- activitySixHours,
1155
- locationParamsSchema,
1156
- locationActivityDayReportSchema,
1157
- locationDirectoryReportSchema,
1158
- locationDetailReportSchema,
1159
- personParamsSchema,
1160
- actorDirectoryReportSchema,
1161
- actorProfileReportSchema,
1162
- personalSpendReportSchema,
1163
- personalTokenMetadataSchema,
1164
- personalTokenListSchema,
1165
- createPersonalTokenBodySchema,
1166
- createdPersonalTokenSchema,
1167
- personalTokenParamsSchema,
1168
- revokePersonalTokenResponseSchema,
1169
- taskRunWindowsSchema,
1170
- scheduledTaskSummarySchema,
1171
- eventTaskSummarySchema,
1172
- taskSummarySchema,
1173
- taskListSchema,
1174
- taskParamsSchema,
1175
- taskExecutionStatusSchema,
1176
- taskExecutionSchema,
1177
- taskExecutionStatusDaySchema,
1178
- taskExecutionListSchema,
1179
- taskRunSchema,
1180
- taskRunListSchema,
1181
- workspaceRepoSchema,
1182
- baselineSnapshotSchema,
1183
- workspaceSchema,
1184
- workspaceListSchema,
1185
- workspaceBodySchema,
1186
- workspaceParamsSchema,
1187
- deleteWorkspaceResponseSchema,
1188
- statSchema,
1189
- statsReportSchema
1190
- };