@sentry/junior 0.205.0 → 0.206.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 (66) hide show
  1. package/dist/{agent-D4nu8MQV.js → agent-C9yuiZUF.js} +247 -67
  2. package/dist/{agent-hooks-DXHpTJ4m.js → agent-hooks-DNjlz2A-.js} +1078 -12
  3. package/dist/{agent-runner-C04colea.js → agent-runner-E67lFrDG.js} +5 -5
  4. package/dist/api/schema.d.ts +77 -0
  5. package/dist/api/schema.js +2 -2
  6. package/dist/api.js +44 -511
  7. package/dist/{app-Cb776lL8.d.ts → app-AxGmJHwK.d.ts} +7 -0
  8. package/dist/app.d.ts +1 -1
  9. package/dist/app.js +50 -80
  10. package/dist/{auth-pause-state-C2P3guS1.js → auth-pause-state-MVZ6xvEK.js} +6 -6
  11. package/dist/briefs-CvJFQvhJ.js +398 -0
  12. package/dist/{catalog-runtime-CXw3asJD.js → catalog-runtime-TBR8n4e1.js} +1 -1
  13. package/dist/{checkpoint-CrViJ8Ps.js → checkpoint-BY47jJCB.js} +7 -6
  14. package/dist/cli/chat.js +14 -12
  15. package/dist/cli/check.js +3 -3
  16. package/dist/cli/init.js +1 -0
  17. package/dist/cli/main.js +5 -1
  18. package/dist/cli/plugins.js +3 -3
  19. package/dist/cli/run.d.ts +2 -1
  20. package/dist/cli/run.js +2 -1
  21. package/dist/cli/snapshot-create.js +3 -3
  22. package/dist/cli/upgrade.js +3 -3
  23. package/dist/{config-BOtJQ7Pc.js → client-ceE7NtvC.js} +4 -367
  24. package/dist/config-CIE83sR2.js +386 -0
  25. package/dist/{schema-Rn8-XEaN.js → conversation-AA4R1VUn.js} +580 -558
  26. package/dist/{conversation-privacy-BZRA6Pes.js → conversation-privacy-Auyq26XQ.js} +1 -1
  27. package/dist/{credential-sync-Bep34IB_.js → credential-sync-BO33aNQd.js} +20 -19
  28. package/dist/{execution-stats-B6lgWxCK.js → execution-stats-SiS2FLcv.js} +4 -4
  29. package/dist/{executor-BlUhFL7_.js → executor-BfbYPW63.js} +31 -3
  30. package/dist/instrumentation.js +2 -2
  31. package/dist/{job-queue-DLMqIK74.js → job-queue-CyTc24Es.js} +1 -1
  32. package/dist/{logging-BMJzdDlP.js → logging-D37bayDc.js} +1 -1
  33. package/dist/nitro.d.ts +1 -1
  34. package/dist/nitro.js +3 -3
  35. package/dist/{oauth-callback-server-WwG5_Zgm.js → oauth-callback-server-BtfOeHTZ.js} +2 -2
  36. package/dist/{pending-auth-CUbXq06G.js → pending-auth-BPUzcs7n.js} +2 -2
  37. package/dist/{profile-T0tXE4zu.js → profile-CSixooTi.js} +4 -3
  38. package/dist/prompt-3gqNY1Ka.js +552 -0
  39. package/dist/{registry-BA0__8ai.js → registry-DiR0-xRg.js} +1 -1
  40. package/dist/{resolve-bvD1ORdv.js → resolve-Bn5q__9b.js} +2 -2
  41. package/dist/{runner-BXYxfIUL.js → runner-DFx3dIJH.js} +9 -9
  42. package/dist/{sandbox-egress-signals-ngEPjSEW.js → sandbox-egress-signals-bwvjihxA.js} +1 -1
  43. package/dist/schema-8GXFfclK.js +559 -0
  44. package/dist/{skills-DJOlYdBs.js → skills-BhM5qyCF.js} +2 -2
  45. package/dist/{spawn-h0R1bTEo.js → spawn-Dk0PqdH6.js} +2 -2
  46. package/dist/{stats-3YZn-Swi.js → stats-DKRP4rsY.js} +6 -6
  47. package/dist/{task-queue-CoXwd2eq.js → task-queue-CdpTvu4R.js} +3 -3
  48. package/dist/{task-runner-B2_mJZj0.js → task-runner-alpjVSxQ.js} +10 -10
  49. package/dist/{thread-state-CqZ1m-es.js → thread-state-CRK7aA41.js} +5 -5
  50. package/dist/{turn-execution-fI6PZ0iI.js → turn-execution-XtyzIHog.js} +3 -3
  51. package/dist/{turn-lifecycle-CcnwrOcp.js → turn-lifecycle-VbwZLfBv.js} +1 -1
  52. package/dist/{usage-B5SfMb3H.js → usage-D4A48Bdl.js} +4 -125
  53. package/dist/{validation-DfWcvhuS.js → validation-jn_46o4U.js} +1 -1
  54. package/dist/{version-oD-oPrbO.js → version-DcfJxB4z.js} +1 -1
  55. package/dist/version.js +1 -1
  56. package/dist/web-authorization-CsfLSfEs.js +38 -0
  57. package/dist/{web-input-BOuq3oKK.js → web-input-BPp_sc7t.js} +6 -6
  58. package/dist/{work-B91LQKHr.js → work-Di-ubSGg.js} +9 -9
  59. package/dist/{worker-BcRRTe6k.js → worker-Cu_D5Mr8.js} +5 -4
  60. package/migrations/0040_conversation_briefs.sql +17 -0
  61. package/migrations/meta/0040_snapshot.json +3516 -0
  62. package/migrations/meta/_journal.json +7 -0
  63. package/package.json +5 -5
  64. package/dist/history-CqTuSAdI.js +0 -441
  65. package/dist/usage-schema-CKaDkH_j.js +0 -20
  66. package/dist/web-authorization-Crbzlmzo.js +0 -76
@@ -0,0 +1,559 @@
1
+ import { t as juniorDestinationKindSchema } from "./destinations-BeBiJeEM.js";
2
+ import { E as conversationSummaryReportSchema, n as actorIdentitySchema, w as conversationStatsItemSchema } from "./conversation-AA4R1VUn.js";
3
+ import "./reporting-schema-DosTN__Q.js";
4
+ import { z } from "zod";
5
+ import { codeChangeStateSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
6
+ //#region src/api/schema/common.ts
7
+ /** Stable error body returned by Junior-owned REST endpoints. */
8
+ const apiErrorSchema = z.object({ error: z.string().min(1) }).strict();
9
+ //#endregion
10
+ //#region src/api/reporting-window.ts
11
+ /** Shared UTC day/hour/six-hour windows for dashboard activity series. */
12
+ const HOUR_MS = 36e5;
13
+ const SIX_HOUR_MS = 6 * HOUR_MS;
14
+ const DAY_MS = 24 * HOUR_MS;
15
+ /** Start of the UTC calendar day containing `valueMs`. */
16
+ function startOfUtcDay(valueMs) {
17
+ const date = new Date(valueMs);
18
+ date.setUTCHours(0, 0, 0, 0);
19
+ return date;
20
+ }
21
+ /** Start of the UTC hour containing `valueMs`. */
22
+ function startOfUtcHour(valueMs) {
23
+ const date = new Date(valueMs);
24
+ date.setUTCMinutes(0, 0, 0);
25
+ return date;
26
+ }
27
+ /** Start of the UTC 6-hour bucket containing `valueMs` (00/06/12/18). */
28
+ function startOfUtcSixHour(valueMs) {
29
+ const date = startOfUtcHour(valueMs);
30
+ date.setUTCHours(Math.floor(date.getUTCHours() / 6) * 6, 0, 0, 0);
31
+ return date;
32
+ }
33
+ /** UTC day key `YYYY-MM-DD`. */
34
+ function utcDayKey(value) {
35
+ return (typeof value === "number" ? new Date(value) : value).toISOString().slice(0, 10);
36
+ }
37
+ /** UTC hour key `YYYY-MM-DDTHH`. */
38
+ function utcHourKey(value) {
39
+ return (typeof value === "number" ? new Date(value) : value).toISOString().slice(0, 13);
40
+ }
41
+ /** UTC 6-hour bucket key `YYYY-MM-DDTHH` at 00/06/12/18. */
42
+ function utcSixHourKey(value) {
43
+ return utcHourKey(startOfUtcSixHour(typeof value === "number" ? value : value.getTime()));
44
+ }
45
+ /** Inclusive trailing UTC day window ending on today's UTC day. */
46
+ function trailingUtcDayWindow(nowMs, dayCount) {
47
+ const end = startOfUtcDay(nowMs);
48
+ const start = new Date(end);
49
+ start.setUTCDate(start.getUTCDate() - (dayCount - 1));
50
+ return {
51
+ end,
52
+ start
53
+ };
54
+ }
55
+ /** Inclusive trailing UTC hour window ending on the current UTC hour. */
56
+ function trailingUtcHourWindow(nowMs, hourCount = 24) {
57
+ const end = startOfUtcHour(nowMs);
58
+ return {
59
+ end,
60
+ start: /* @__PURE__ */ new Date(end.getTime() - (hourCount - 1) * HOUR_MS)
61
+ };
62
+ }
63
+ /** Inclusive trailing UTC 6-hour window ending on the current 6h bucket. */
64
+ function trailingUtcSixHourWindow(nowMs, bucketCount = 28) {
65
+ const end = startOfUtcSixHour(nowMs);
66
+ return {
67
+ end,
68
+ start: /* @__PURE__ */ new Date(end.getTime() - (bucketCount - 1) * SIX_HOUR_MS)
69
+ };
70
+ }
71
+ /** Fill a fixed UTC day window from a sparse map. */
72
+ function fillUtcDays(args) {
73
+ const { end, start } = trailingUtcDayWindow(args.nowMs, args.count);
74
+ const items = [];
75
+ for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setUTCDate(cursor.getUTCDate() + 1)) {
76
+ const date = utcDayKey(cursor);
77
+ items.push(args.rows.get(date) ?? args.empty(date));
78
+ }
79
+ return items;
80
+ }
81
+ /** Fill a fixed UTC hour window from a sparse map. */
82
+ function fillUtcHours(args) {
83
+ const hourCount = args.count ?? 24;
84
+ const { end, start } = trailingUtcHourWindow(args.nowMs, hourCount);
85
+ const items = [];
86
+ for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setTime(cursor.getTime() + HOUR_MS)) {
87
+ const date = utcHourKey(cursor);
88
+ items.push(args.rows.get(date) ?? args.empty(date));
89
+ }
90
+ return items;
91
+ }
92
+ /** Fill a fixed UTC 6-hour window from a map of known rows. */
93
+ function fillUtcSixHours(args) {
94
+ const bucketCount = args.count ?? 28;
95
+ const { end, start } = trailingUtcSixHourWindow(args.nowMs, bucketCount);
96
+ const items = [];
97
+ for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setTime(cursor.getTime() + SIX_HOUR_MS)) {
98
+ const date = utcSixHourKey(cursor);
99
+ items.push(args.rows.get(date) ?? args.empty(date));
100
+ }
101
+ return items;
102
+ }
103
+ /**
104
+ * Sum hour rows into trailing 6-hour buckets.
105
+ * Adds number fields. Keeps other fields from the first row in the bucket.
106
+ * Sets `date` to the 6-hour bucket key.
107
+ */
108
+ function sumUtcHoursIntoSixHours(args) {
109
+ const bucketCount = args.count ?? 28;
110
+ const bySix = /* @__PURE__ */ new Map();
111
+ for (const hour of args.hours) {
112
+ const key = utcSixHourKey(Date.parse(`${hour.date}:00:00.000Z`));
113
+ const next = {
114
+ ...bySix.get(key) ?? args.empty(key),
115
+ date: key
116
+ };
117
+ for (const [field, value] of Object.entries(hour)) {
118
+ if (field === "date") continue;
119
+ if (typeof value === "number") {
120
+ const prior = next[field];
121
+ next[field] = (typeof prior === "number" ? prior : 0) + value;
122
+ }
123
+ }
124
+ bySix.set(key, next);
125
+ }
126
+ return fillUtcSixHours({
127
+ count: bucketCount,
128
+ empty: args.empty,
129
+ nowMs: args.nowMs,
130
+ rows: bySix
131
+ });
132
+ }
133
+ //#endregion
134
+ //#region src/api/schema/code.ts
135
+ const codeChangeSummarySchema = z.object({
136
+ closed: z.number().int().nonnegative(),
137
+ costUsd: z.number().nonnegative().optional(),
138
+ created: z.number().int().nonnegative(),
139
+ medianCostUsd: z.number().nonnegative().optional(),
140
+ medianMergeTimeMs: z.number().nonnegative().optional(),
141
+ merged: z.number().int().nonnegative(),
142
+ mergeRate: z.number().min(0).max(1).optional(),
143
+ open: z.number().int().nonnegative()
144
+ }).strict();
145
+ /** UTC day (`YYYY-MM-DD`) or hour (`YYYY-MM-DDTHH`) activity bucket key. */
146
+ const codeMetricBucketSchema = z.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
147
+ const codeActivityDaySchema = z.object({
148
+ closed: z.number().int().nonnegative(),
149
+ created: z.number().int().nonnegative(),
150
+ date: codeMetricBucketSchema,
151
+ merged: z.number().int().nonnegative()
152
+ }).strict();
153
+ const codeRepositorySummarySchema = z.object({
154
+ closed: z.number().int().nonnegative(),
155
+ created: z.number().int().nonnegative(),
156
+ id: z.string().uuid(),
157
+ medianCostUsd: z.number().nonnegative().optional(),
158
+ merged: z.number().int().nonnegative(),
159
+ mergeRate: z.number().min(0).max(1).optional(),
160
+ name: z.string().min(1),
161
+ open: z.number().int().nonnegative(),
162
+ provider: z.string().min(1),
163
+ url: z.string().url().optional()
164
+ }).strict();
165
+ const codeChangeSummaryReportSchema = z.object({
166
+ closedAt: z.string().optional(),
167
+ id: z.string().uuid(),
168
+ mergedAt: z.string().optional(),
169
+ number: z.number().int().positive(),
170
+ openedAt: z.string(),
171
+ provider: z.string().min(1),
172
+ repository: z.string().min(1),
173
+ state: codeChangeStateSchema,
174
+ title: z.string().optional(),
175
+ url: z.string().url().optional()
176
+ }).strict();
177
+ const codeOverviewReportSchema = z.object({
178
+ activityDays: z.array(codeActivityDaySchema),
179
+ activityHours: z.array(codeActivityDaySchema).optional(),
180
+ activitySixHours: z.array(codeActivityDaySchema).optional(),
181
+ changes: z.array(codeChangeSummaryReportSchema),
182
+ generatedAt: z.string(),
183
+ repositories: z.array(codeRepositorySummarySchema),
184
+ summary: codeChangeSummarySchema,
185
+ windowEnd: z.string(),
186
+ windowStart: z.string()
187
+ }).strict();
188
+ /** Person-scoped code activity for one People profile. */
189
+ const codePersonReportSchema = z.object({
190
+ activityDays: z.array(codeActivityDaySchema),
191
+ activityHours: z.array(codeActivityDaySchema).optional(),
192
+ activitySixHours: z.array(codeActivityDaySchema).optional(),
193
+ generatedAt: z.string(),
194
+ summary: codeChangeSummarySchema,
195
+ windowEnd: z.string(),
196
+ windowStart: z.string()
197
+ }).strict();
198
+ //#endregion
199
+ //#region src/api/activity.ts
200
+ const dailyConversationActivitySchema = z.object({
201
+ active: z.number(),
202
+ conversations: z.number(),
203
+ date: z.string(),
204
+ durationMs: z.number(),
205
+ failed: z.number(),
206
+ tokens: z.number().optional()
207
+ }).strict();
208
+ /** Build a zeroed day for conversation activity projections. */
209
+ function emptyActivityDay(date) {
210
+ return {
211
+ active: 0,
212
+ conversations: 0,
213
+ date,
214
+ durationMs: 0,
215
+ failed: 0
216
+ };
217
+ }
218
+ /** Fill a fixed UTC day window from sparse conversation activity. */
219
+ function activityDays(days, nowMs, count) {
220
+ return fillUtcDays({
221
+ count,
222
+ empty: emptyActivityDay,
223
+ nowMs,
224
+ rows: days
225
+ });
226
+ }
227
+ /**
228
+ * Fill the trailing 7-day UTC hour window from known hour rows.
229
+ * 24h charts use the last 24 points. 7d charts sum hours into 6-hour buckets.
230
+ */
231
+ function activityHours(hours, nowMs) {
232
+ return fillUtcHours({
233
+ count: 168,
234
+ empty: emptyActivityDay,
235
+ nowMs,
236
+ rows: hours
237
+ });
238
+ }
239
+ /**
240
+ * Fill trailing 6-hour buckets from hour keys or hour rows.
241
+ * Hour keys must be summed into 6-hour keys first.
242
+ */
243
+ function activitySixHours(hours, nowMs) {
244
+ return sumUtcHoursIntoSixHours({
245
+ empty: emptyActivityDay,
246
+ hours: hours instanceof Map ? activityHours(hours, nowMs) : [...hours],
247
+ nowMs
248
+ });
249
+ }
250
+ //#endregion
251
+ //#region src/api/schema/location.ts
252
+ const locationParamsSchema = z.object({ locationId: z.string().min(1) }).strict();
253
+ const locationSummaryReportSchema = conversationStatsItemSchema.extend({
254
+ id: z.string(),
255
+ firstSeenAt: z.string(),
256
+ kind: juniorDestinationKindSchema,
257
+ lastSeenAt: z.string(),
258
+ provider: z.string(),
259
+ providerDestinationId: z.string(),
260
+ visibility: z.literal("public")
261
+ }).strict();
262
+ const locationActorSummaryReportSchema = conversationStatsItemSchema.extend({ actor: actorIdentitySchema }).strict();
263
+ /** UTC day (`YYYY-MM-DD`) or hour (`YYYY-MM-DDTHH`) activity bucket key. */
264
+ const locationMetricBucketSchema = z.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
265
+ const locationActivityDayReportSchema = z.object({
266
+ date: locationMetricBucketSchema,
267
+ privateConversations: z.number(),
268
+ publicConversations: z.number()
269
+ }).strict();
270
+ const locationDirectoryReportSchema = z.object({
271
+ activityDays: z.array(locationActivityDayReportSchema),
272
+ activityHours: z.array(locationActivityDayReportSchema).optional(),
273
+ activitySixHours: z.array(locationActivityDayReportSchema).optional(),
274
+ generatedAt: z.string(),
275
+ locations: z.array(locationSummaryReportSchema),
276
+ privateActivity: conversationStatsItemSchema,
277
+ source: z.literal("conversation_index"),
278
+ windowEnd: z.string(),
279
+ windowStart: z.string()
280
+ }).strict();
281
+ const locationDetailReportSchema = locationSummaryReportSchema.extend({
282
+ activityDays: z.array(dailyConversationActivitySchema),
283
+ activityHours: z.array(dailyConversationActivitySchema).optional(),
284
+ activitySixHours: z.array(dailyConversationActivitySchema).optional(),
285
+ actors: z.array(locationActorSummaryReportSchema),
286
+ generatedAt: z.string(),
287
+ recentConversations: z.array(conversationSummaryReportSchema),
288
+ source: z.literal("conversation_index"),
289
+ windowEnd: z.string(),
290
+ windowStart: z.string()
291
+ }).strict();
292
+ //#endregion
293
+ //#region src/api/schema/person.ts
294
+ const personParamsSchema = z.object({ email: z.string().trim().min(1) }).strict();
295
+ const peopleConversationStatsItemSchema = conversationStatsItemSchema.omit({ costUsd: true });
296
+ /** UTC day (`YYYY-MM-DD`) or hour (`YYYY-MM-DDTHH`) activity bucket key. */
297
+ const peopleMetricBucketSchema = z.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
298
+ const actorActivityDayReportSchema = z.object({
299
+ active: z.number(),
300
+ conversations: z.number(),
301
+ costUsd: z.number().optional(),
302
+ date: peopleMetricBucketSchema,
303
+ durationMs: z.number(),
304
+ failed: z.number(),
305
+ tokens: z.number().optional()
306
+ }).strict();
307
+ const peopleActivityDayReportSchema = z.object({
308
+ activePeople: z.number(),
309
+ conversations: z.number(),
310
+ date: peopleMetricBucketSchema
311
+ }).strict();
312
+ const actorTotalsReportSchema = z.object({
313
+ active: z.number(),
314
+ activeDays: z.number(),
315
+ conversations: z.number(),
316
+ durationMs: z.number(),
317
+ failed: z.number(),
318
+ tokens: z.number().optional()
319
+ }).strict();
320
+ /** Spend and activity for one people-directory range, plus the prior period's spend. */
321
+ const actorWindowMetricsSchema = z.object({
322
+ conversations: z.number().int().nonnegative(),
323
+ costUsd: z.number().finite().nonnegative(),
324
+ durationMs: z.number().finite().nonnegative(),
325
+ priorCostUsd: z.number().finite().nonnegative()
326
+ }).strict();
327
+ /** People-directory ranges that match the dashboard range control. */
328
+ const actorDirectoryWindowsSchema = z.object({
329
+ 1: actorWindowMetricsSchema,
330
+ 7: actorWindowMetricsSchema,
331
+ 30: actorWindowMetricsSchema,
332
+ 90: actorWindowMetricsSchema
333
+ }).strict();
334
+ const identifiedActorSchema = actorIdentitySchema.extend({ email: z.string().min(1) }).strict();
335
+ const actorSummaryReportSchema = actorTotalsReportSchema.extend({
336
+ firstSeenAt: z.string(),
337
+ lastSeenAt: z.string(),
338
+ actor: identifiedActorSchema,
339
+ windows: actorDirectoryWindowsSchema
340
+ }).strict();
341
+ const actorDirectoryReportSchema = z.object({
342
+ activityDays: z.array(peopleActivityDayReportSchema),
343
+ activityHours: z.array(peopleActivityDayReportSchema).optional(),
344
+ activitySixHours: z.array(peopleActivityDayReportSchema).optional(),
345
+ generatedAt: z.string(),
346
+ people: z.array(actorSummaryReportSchema),
347
+ source: z.literal("conversation_index"),
348
+ windowEnd: z.string(),
349
+ windowStart: z.string()
350
+ }).strict();
351
+ const actorProfileReportSchema = z.object({
352
+ activityDays: z.array(actorActivityDayReportSchema),
353
+ activityHours: z.array(actorActivityDayReportSchema).optional(),
354
+ activitySixHours: z.array(actorActivityDayReportSchema).optional(),
355
+ generatedAt: z.string(),
356
+ locations: z.array(peopleConversationStatsItemSchema),
357
+ recentConversations: z.array(conversationSummaryReportSchema),
358
+ actor: identifiedActorSchema,
359
+ source: z.literal("conversation_index"),
360
+ surfaces: z.array(peopleConversationStatsItemSchema),
361
+ totals: actorTotalsReportSchema,
362
+ windowEnd: z.string(),
363
+ windowStart: z.string()
364
+ }).strict();
365
+ const personalSpendReportSchema = z.object({
366
+ generatedAt: z.string(),
367
+ sevenDaysUsd: z.number().finite().nonnegative(),
368
+ source: z.literal("conversation_index"),
369
+ thirtyDaysUsd: z.number().finite().nonnegative(),
370
+ windowEnd: z.string(),
371
+ windowStart: z.string()
372
+ }).strict();
373
+ //#endregion
374
+ //#region src/api/schema/personal-token.ts
375
+ const personalTokenMetadataSchema = z.object({
376
+ id: z.string().uuid(),
377
+ name: z.string(),
378
+ tokenSuffix: z.string(),
379
+ createdAt: z.string().datetime(),
380
+ expiresAt: z.string().datetime(),
381
+ lastUsedAt: z.string().datetime().nullable()
382
+ }).strict();
383
+ const personalTokenListSchema = z.object({ tokens: z.array(personalTokenMetadataSchema) }).strict();
384
+ const createPersonalTokenBodySchema = z.object({ name: z.string().trim().min(1).max(80) }).strict();
385
+ const createdPersonalTokenSchema = personalTokenMetadataSchema.extend({ token: z.string().startsWith("jr_pat_") }).strict();
386
+ const personalTokenParamsSchema = z.object({ id: z.string().uuid() }).strict();
387
+ const revokePersonalTokenResponseSchema = z.object({ revoked: z.literal(true) }).strict();
388
+ //#endregion
389
+ //#region src/api/schema/task.ts
390
+ const taskDestinationSchema = z.object({
391
+ channelId: z.string().min(1),
392
+ label: z.string().min(1),
393
+ teamId: z.string().min(1),
394
+ visibility: z.enum(["private", "public"])
395
+ }).strict();
396
+ /** Task run counts for the dashboard range control (24h/7d/30d/90d). */
397
+ const taskRunWindowsSchema = z.object({
398
+ 1: z.number().int().nonnegative(),
399
+ 7: z.number().int().nonnegative(),
400
+ 30: z.number().int().nonnegative(),
401
+ 90: z.number().int().nonnegative()
402
+ }).strict();
403
+ const taskSummaryBaseSchema = z.object({
404
+ createdAt: z.string().datetime(),
405
+ createdBy: z.string().min(1),
406
+ createdByEmail: z.string().trim().email().optional(),
407
+ destination: taskDestinationSchema,
408
+ id: z.string().min(1),
409
+ instruction: z.string().min(1),
410
+ lastConversationId: z.string().min(1).optional(),
411
+ lastRunAt: z.string().datetime().optional(),
412
+ ownedByViewer: z.boolean(),
413
+ runs: taskRunWindowsSchema,
414
+ outcomes: z.array(taskOutcomeSchema).max(5),
415
+ /** Short display title; falls back from instruction when unset. */
416
+ title: z.string().min(1),
417
+ totalRuns: z.number().int().nonnegative()
418
+ });
419
+ const scheduledTaskSummarySchema = taskSummaryBaseSchema.extend({
420
+ kind: z.literal("scheduled"),
421
+ nextRunAt: z.string().datetime().optional(),
422
+ schedule: z.string().min(1),
423
+ status: z.enum([
424
+ "active",
425
+ "blocked",
426
+ "completed"
427
+ ])
428
+ }).strict();
429
+ const eventTaskSummarySchema = taskSummaryBaseSchema.extend({
430
+ events: z.array(z.string().min(1)).min(1),
431
+ kind: z.literal("event"),
432
+ resource: z.string().min(1),
433
+ source: z.string().min(1),
434
+ triggerAvailable: z.boolean()
435
+ }).strict();
436
+ const taskSummarySchema = z.discriminatedUnion("kind", [scheduledTaskSummarySchema, eventTaskSummarySchema]);
437
+ /** UTC day (`YYYY-MM-DD`) or hour (`YYYY-MM-DDTHH`) execution bucket key. */
438
+ const taskMetricBucketSchema = z.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
439
+ /** One UTC day/hour of completed task executions stacked by task type. */
440
+ const taskExecutionDaySchema = z.object({
441
+ /** Linked conversation spend for executions in this bucket. */
442
+ costUsd: z.number().finite().nonnegative(),
443
+ date: taskMetricBucketSchema,
444
+ event: z.number().int().nonnegative(),
445
+ scheduled: z.number().int().nonnegative()
446
+ }).strict();
447
+ const taskListQuerySchema = z.object({ q: z.string().trim().max(200).optional() }).strict();
448
+ const taskListSchema = z.object({
449
+ executionDays: z.array(taskExecutionDaySchema),
450
+ executionHours: z.array(taskExecutionDaySchema).optional(),
451
+ executionSixHours: z.array(taskExecutionDaySchema).optional(),
452
+ tasks: z.array(taskSummarySchema),
453
+ truncated: z.boolean()
454
+ }).strict();
455
+ const taskParamsSchema = z.object({
456
+ id: z.string().min(1),
457
+ kind: z.enum(["scheduled", "event"])
458
+ }).strict();
459
+ const taskExecutionStatusSchema = z.enum([
460
+ "blocked",
461
+ "completed",
462
+ "failed"
463
+ ]);
464
+ const taskExecutionSchema = z.object({
465
+ conversationId: z.string().min(1).optional(),
466
+ /** Estimated model cost for the linked conversation, when known. */
467
+ costUsd: z.number().finite().nonnegative().optional(),
468
+ /** Cumulative conversation runtime in milliseconds, when known. */
469
+ durationMs: z.number().finite().nonnegative().optional(),
470
+ executedAt: z.string().datetime(),
471
+ executionId: z.string().min(1),
472
+ status: taskExecutionStatusSchema,
473
+ title: z.string().min(1).optional(),
474
+ /** Cumulative conversation token total, when known. */
475
+ totalTokens: z.number().int().nonnegative().optional()
476
+ }).strict();
477
+ /** One UTC day/hour of terminal executions for a single task, stacked by status. */
478
+ const taskExecutionStatusDaySchema = z.object({
479
+ blocked: z.number().int().nonnegative(),
480
+ completed: z.number().int().nonnegative(),
481
+ date: taskMetricBucketSchema,
482
+ failed: z.number().int().nonnegative()
483
+ }).strict();
484
+ const taskExecutionListSchema = z.object({
485
+ executionDays: z.array(taskExecutionStatusDaySchema),
486
+ executionHours: z.array(taskExecutionStatusDaySchema).optional(),
487
+ executionSixHours: z.array(taskExecutionStatusDaySchema).optional(),
488
+ executions: z.array(taskExecutionSchema),
489
+ task: taskSummarySchema,
490
+ truncated: z.boolean()
491
+ }).strict();
492
+ const taskRunSchema = taskExecutionSchema.extend({
493
+ kind: z.enum(["scheduled", "event"]),
494
+ taskId: z.string().min(1),
495
+ taskTitle: z.string().min(1)
496
+ }).strict();
497
+ const taskRunListSchema = z.object({
498
+ runs: z.array(taskRunSchema),
499
+ truncated: z.boolean()
500
+ }).strict();
501
+ //#endregion
502
+ //#region src/api/schema/workspace.ts
503
+ const workspaceRepoInputSchema = z.object({
504
+ provider: z.string(),
505
+ repo: z.string()
506
+ }).strict();
507
+ const workspaceRepoSchema = z.object({
508
+ provider: z.string(),
509
+ repo: z.string(),
510
+ checkoutPath: z.string()
511
+ }).strict();
512
+ const workspaceSnapshotSchema = z.object({
513
+ id: z.string(),
514
+ generatedAt: z.iso.datetime(),
515
+ buildDurationMs: z.number().int().nonnegative(),
516
+ sizeBytes: z.number().int().nonnegative().nullable()
517
+ }).strict();
518
+ /** Install-wide baseline Sandbox snapshot used when no Workspace recipe is selected. */
519
+ const baselineSnapshotSchema = z.object({
520
+ id: z.string(),
521
+ generatedAt: z.iso.datetime(),
522
+ buildDurationMs: z.number().int().nonnegative(),
523
+ dependencyCount: z.number().int().nonnegative()
524
+ }).strict();
525
+ const workspaceSchema = z.object({
526
+ id: z.string().uuid(),
527
+ name: z.string(),
528
+ setupScript: z.string(),
529
+ repos: z.array(workspaceRepoSchema),
530
+ snapshot: workspaceSnapshotSchema.nullable()
531
+ }).strict();
532
+ const workspaceListSchema = z.object({
533
+ baselineSnapshot: baselineSnapshotSchema.nullable(),
534
+ workspaces: z.array(workspaceSchema)
535
+ }).strict();
536
+ const workspaceBodySchema = z.object({
537
+ name: z.string(),
538
+ setupScript: z.string().optional(),
539
+ repos: z.array(workspaceRepoInputSchema)
540
+ }).strict();
541
+ const workspaceParamsSchema = z.object({ id: z.string().uuid() }).strict();
542
+ const deleteWorkspaceResponseSchema = z.object({ deleted: z.literal(true) }).strict();
543
+ //#endregion
544
+ //#region src/api/schema/stats.ts
545
+ const statSchema = z.object({
546
+ count: z.number().int().nonnegative(),
547
+ date: z.string(),
548
+ metric: z.string().min(1),
549
+ name: z.string().min(1),
550
+ namespace: z.string().min(1)
551
+ }).strict();
552
+ const statsReportSchema = z.object({
553
+ generatedAt: z.string().datetime(),
554
+ stats: z.array(statSchema),
555
+ windowEnd: z.string(),
556
+ windowStart: z.string()
557
+ }).strict();
558
+ //#endregion
559
+ export { sumUtcHoursIntoSixHours as $, actorProfileReportSchema as A, dailyConversationActivitySchema as B, createPersonalTokenBodySchema as C, personalTokenParamsSchema as D, personalTokenMetadataSchema as E, locationDirectoryReportSchema as F, codePersonReportSchema as G, codeChangeSummaryReportSchema as H, locationParamsSchema as I, HOUR_MS as J, codeRepositorySummarySchema as K, activityDays as L, personalSpendReportSchema as M, locationActivityDayReportSchema as N, revokePersonalTokenResponseSchema as O, locationDetailReportSchema as P, startOfUtcHour as Q, activityHours as R, taskSummarySchema as S, personalTokenListSchema as T, codeChangeSummarySchema as U, codeActivityDaySchema as V, codeOverviewReportSchema as W, fillUtcHours as X, fillUtcDays as Y, fillUtcSixHours as Z, taskListSchema as _, workspaceBodySchema as a, apiErrorSchema as at, taskRunSchema as b, workspaceRepoSchema as c, scheduledTaskSummarySchema as d, trailingUtcDayWindow as et, taskExecutionListSchema as f, taskListQuerySchema as g, taskExecutionStatusSchema as h, deleteWorkspaceResponseSchema as i, utcHourKey as it, personParamsSchema as j, actorDirectoryReportSchema as k, workspaceSchema as l, taskExecutionStatusDaySchema as m, statsReportSchema as n, trailingUtcSixHourWindow as nt, workspaceListSchema as o, taskExecutionSchema as p, DAY_MS as q, baselineSnapshotSchema as r, utcDayKey as rt, workspaceParamsSchema as s, statSchema as t, trailingUtcHourWindow as tt, eventTaskSummarySchema as u, taskParamsSchema as v, createdPersonalTokenSchema as w, taskRunWindowsSchema as x, taskRunListSchema as y, activitySixHours as z };
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { f as logWarn } from "./logging-BMJzdDlP.js";
2
+ import { f as logWarn } from "./logging-D37bayDc.js";
3
3
  import { s as skillRoots } from "./package-discovery-7a9YqLhE.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-CXw3asJD.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-TBR8n4e1.js";
5
5
  import path from "node:path";
6
6
  import { z } from "zod";
7
7
  import fs from "node:fs/promises";
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { C as toolInvocationDestination, y as actorFromRun } from "./agent-runner-C04colea.js";
3
- import { n as createAndEnqueueAgentInvocation } from "./work-B91LQKHr.js";
2
+ import { C as toolInvocationDestination, y as actorFromRun } from "./agent-runner-E67lFrDG.js";
3
+ import { n as createAndEnqueueAgentInvocation } from "./work-Di-ubSGg.js";
4
4
  //#region src/chat/agent-invocations/spawn.ts
5
5
  var spawn_exports = /* @__PURE__ */ __exportAll({ bindSpawnAgent: () => bindSpawnAgent });
6
6
  /** Bind a Run's Actor and credentials to new Agent invocations. */
@@ -1,11 +1,11 @@
1
- import { i as getChatConfig } from "./config-BOtJQ7Pc.js";
2
- import { F as isRecord$1, I as toOptionalNumber, L as toOptionalString } from "./logging-BMJzdDlP.js";
1
+ import { F as isRecord$1, I as toOptionalNumber, L as toOptionalString } from "./logging-D37bayDc.js";
2
+ import { a as getChatConfig } from "./config-CIE83sR2.js";
3
3
  import { _ as parseSlackMessageTs, d as parseStoredSlackActor, h as parseSlackTeamId, p as parseSlackChannelId } from "./context-B45_WqVX.js";
4
- import { B as getSlackClient, Bt as parseDestination, Et as getDb, G as withSlackRetries, Ht as sameDestination, Tt as getConversationStore, u as getPlugins, ut as JUNIOR_THREAD_STATE_TTL_MS } from "./agent-hooks-DXHpTJ4m.js";
4
+ import { Ft as getConversationStore, It as getDb, J as withSlackRetries, Qt as sameDestination, U as getSlackClient, Xt as parseDestination, pt as JUNIOR_THREAD_STATE_TTL_MS, u as getPlugins } from "./agent-hooks-DNjlz2A-.js";
5
5
  import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
6
- import { C as juniorConversations, a as juniorSchedulerRuns, c as juniorStats, l as juniorEventTasks, o as juniorSchedulerTasks, x as juniorAttachments } from "./executor-BlUhFL7_.js";
7
- import { o as ToolInputError } from "./usage-B5SfMb3H.js";
8
- import { C as getDefaultRedisStateAdapterFor, w as getStateAdapter } from "./profile-T0tXE4zu.js";
6
+ import { S as juniorAttachments, a as juniorSchedulerRuns, c as juniorStats, l as juniorEventTasks, o as juniorSchedulerTasks, w as juniorConversations } from "./executor-BfbYPW63.js";
7
+ import { o as ToolInputError } from "./usage-D4A48Bdl.js";
8
+ import { C as getDefaultRedisStateAdapterFor, w as getStateAdapter } from "./profile-CSixooTi.js";
9
9
  import "./vercel-queue-DIkVcfK4.js";
10
10
  import { z } from "zod";
11
11
  import { createHash, randomUUID } from "node:crypto";
@@ -1,6 +1,6 @@
1
- import { f as logWarn } from "./logging-BMJzdDlP.js";
1
+ import { f as logWarn } from "./logging-D37bayDc.js";
2
2
  import { a as signQueueMessage, i as QUEUE_SIGNATURE_MAX_AGE_MS, o as verifyQueueMessage, s as createVercelQueueClient } from "./vercel-queue-DIkVcfK4.js";
3
- import { o as runWithTurnRequestDeadline } from "./job-queue-DLMqIK74.js";
3
+ import { o as runWithTurnRequestDeadline } from "./job-queue-CyTc24Es.js";
4
4
  import { z } from "zod";
5
5
  import { createHash } from "node:crypto";
6
6
  import { handleCallback, registerDevConsumer } from "@vercel/queue";
@@ -110,7 +110,7 @@ function pluginTaskCallback() {
110
110
  maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
111
111
  onRejected: logPluginTaskQueueMessageRejected,
112
112
  run: async (message) => {
113
- const { processPluginTask } = await import("./task-runner-B2_mJZj0.js").then((n) => n.r);
113
+ const { processPluginTask } = await import("./task-runner-alpjVSxQ.js").then((n) => n.r);
114
114
  await processPluginTask(message);
115
115
  },
116
116
  topic: PLUGIN_TASK_QUEUE_TOPIC,
@@ -1,12 +1,12 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
2
  import { _ as parseSlackMessageTs, r as credentialSubjectSchema } from "./context-B45_WqVX.js";
3
- import { Et as getDb, Tt as getConversationStore, Y as readActorIdentity, _t as createPluginLogger, gt as createPluginModel, ht as createPluginEmbedder, mt as createPluginState, u as getPlugins, ut as JUNIOR_THREAD_STATE_TTL_MS, vt as createPluginConversationEvents } from "./agent-hooks-DXHpTJ4m.js";
4
- import { f as sameActorIdentity } from "./history-CqTuSAdI.js";
5
- import { Dt as isToolResultError, Ot as isToolResultMessage, Q as hydrateConversationMessages, bt as getPiMessageRole, jt as stripRuntimeTurnContext, kt as normalizeToolNameFromResult, s as getTurnRecord, wt as instructionTextForProjection } from "./checkpoint-CrViJ8Ps.js";
6
- import { w as getStateAdapter } from "./profile-T0tXE4zu.js";
7
- import { u as recordTaskExecution } from "./execution-stats-B6lgWxCK.js";
8
- import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-CqZ1m-es.js";
9
- import { i as pluginTaskParamsSchema, o as sendVercelPluginTask, r as pluginTaskId } from "./task-queue-CoXwd2eq.js";
3
+ import { Ft as getConversationStore, It as getDb, Q as readActorIdentity, _t as createPluginState, bt as createPluginLogger, p as coreTaskRegistrations, pt as JUNIOR_THREAD_STATE_TTL_MS, u as getPlugins, vt as createPluginEmbedder, xt as createPluginConversationEvents, yt as createPluginModel } from "./agent-hooks-DNjlz2A-.js";
4
+ import { K as sameActorIdentity } from "./conversation-AA4R1VUn.js";
5
+ import { Dt as isToolResultError, Ot as isToolResultMessage, Q as hydrateConversationMessages, bt as getPiMessageRole, jt as stripRuntimeTurnContext, kt as normalizeToolNameFromResult, s as getTurnRecord, wt as instructionTextForProjection } from "./checkpoint-BY47jJCB.js";
6
+ import { w as getStateAdapter } from "./profile-CSixooTi.js";
7
+ import { u as recordTaskExecution } from "./execution-stats-SiS2FLcv.js";
8
+ import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-CRK7aA41.js";
9
+ import { i as pluginTaskParamsSchema, o as sendVercelPluginTask, r as pluginTaskId } from "./task-queue-CdpTvu4R.js";
10
10
  import { z } from "zod";
11
11
  import { createHash } from "node:crypto";
12
12
  import { destinationSchema, destinationVisibilitySchema, isSlackDestination, pluginRunContextSchema, replyAttributionSchema, sourceSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
@@ -345,7 +345,7 @@ function slackSourceForDestination(args) {
345
345
  * Reads parent Conversations when this Conversation has no Destination.
346
346
  */
347
347
  async function resolveConversationRouting(args) {
348
- const conversationStore = args.conversationStore ?? (await import("./agent-hooks-DXHpTJ4m.js").then((n) => n.St)).getConversationStore();
348
+ const conversationStore = args.conversationStore ?? (await import("./agent-hooks-DNjlz2A-.js").then((n) => n.Mt)).getConversationStore();
349
349
  const chain = await loadConversationChain(args.conversationId, conversationStore);
350
350
  let destination;
351
351
  let source;
@@ -600,7 +600,7 @@ function taskPluginContext(plugin, message, options = {}) {
600
600
  };
601
601
  }
602
602
  function findPluginTask(message) {
603
- const plugin = getPlugins().find((candidate) => candidate.manifest.name === message.plugin);
603
+ const plugin = [...coreTaskRegistrations(), ...getPlugins()].find((candidate) => candidate.manifest.name === message.plugin);
604
604
  if (!plugin?.tasks || !Object.hasOwn(plugin.tasks, message.name)) return;
605
605
  return {
606
606
  plugin,
@@ -610,7 +610,7 @@ function findPluginTask(message) {
610
610
  /** Schedule all plugin tasks interested in a completed agent-run session. */
611
611
  async function scheduleSessionCompletedPluginTasks(params, options = {}) {
612
612
  const coreParams = pluginTaskParamsSchema.parse(params);
613
- const taskRegistrations = getPlugins().flatMap((plugin) => Object.keys(plugin.tasks ?? {}).map((name) => ({
613
+ const taskRegistrations = [...getPlugins(), ...coreTaskRegistrations()].flatMap((plugin) => Object.keys(plugin.tasks ?? {}).map((name) => ({
614
614
  name,
615
615
  plugin
616
616
  })));