@sentry/junior 0.191.0 → 0.193.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 (96) hide show
  1. package/dist/{agent-hooks-HIWWBBKO.js → agent-hooks-DWY3MZZ7.js} +11 -11
  2. package/dist/api/activity.d.ts +3 -1
  3. package/dist/api/code/overview.d.ts +12 -0
  4. package/dist/api/locations/detail.d.ts +8 -0
  5. package/dist/api/locations/list.d.ts +5 -0
  6. package/dist/api/people/code.d.ts +6 -0
  7. package/dist/api/people/shared.d.ts +2 -0
  8. package/dist/api/reporting-window.d.ts +40 -0
  9. package/dist/api/schema/code.d.ts +14 -0
  10. package/dist/api/schema/conversation.d.ts +27 -0
  11. package/dist/api/schema/location.d.ts +15 -0
  12. package/dist/api/schema/person.d.ts +104 -0
  13. package/dist/api/schema/task.d.ts +15 -2
  14. package/dist/api/schema.d.ts +1 -1
  15. package/dist/api/schema.js +2 -2
  16. package/dist/api.js +536 -141
  17. package/dist/app.js +50 -83
  18. package/dist/{catalog-runtime-4OKH4265.js → catalog-runtime-NAD44W5K.js} +4 -4
  19. package/dist/chat/agent/prompt.d.ts +1 -1
  20. package/dist/chat/agent-dispatch/types.d.ts +2 -1
  21. package/dist/chat/agent-dispatch/validation.d.ts +1 -1
  22. package/dist/chat/agent-invocations/types.d.ts +24 -28
  23. package/dist/chat/event-tasks/tool-support.d.ts +10 -1
  24. package/dist/chat/plugins/agent-hooks.d.ts +2 -2
  25. package/dist/chat/prompt.d.ts +4 -5
  26. package/dist/chat/services/turn-session-routing.d.ts +4 -3
  27. package/dist/chat/slack/tool-support/context.d.ts +3 -6
  28. package/dist/chat/source.d.ts +4 -6
  29. package/dist/chat/tasks/execution-stats.d.ts +12 -0
  30. package/dist/chat/tools/delete-event-task.d.ts +1 -1
  31. package/dist/chat/tools/types.d.ts +10 -9
  32. package/dist/chat/tools/update-event-task.d.ts +1 -1
  33. package/dist/{chunk-S7NSFCCW.js → chunk-2CYWEVOP.js} +4 -4
  34. package/dist/{chunk-6KISW5UY.js → chunk-3YZ2Q6AW.js} +2 -2
  35. package/dist/{chunk-X6PQKQTY.js → chunk-42N6CDWF.js} +4 -4
  36. package/dist/{chunk-Q32BSFN4.js → chunk-4UA5C7AM.js} +32 -25
  37. package/dist/{chunk-VGYZ3YZM.js → chunk-5E5SLAVD.js} +21 -21
  38. package/dist/{chunk-3PDR63SX.js → chunk-5LEVZYXF.js} +4 -4
  39. package/dist/{chunk-SEIZ2XLD.js → chunk-5S6AQFNG.js} +1 -1
  40. package/dist/{chunk-AWFSSFAX.js → chunk-AZVDODSP.js} +11 -11
  41. package/dist/{chunk-LOYTPSAK.js → chunk-BFP3ZKG6.js} +12 -8
  42. package/dist/{chunk-GQN4REF5.js → chunk-COCVPDWX.js} +11 -7
  43. package/dist/{chunk-CECRMPXJ.js → chunk-D4XQZOHB.js} +8 -8
  44. package/dist/{chunk-WNIVCR74.js → chunk-D5YQPCEG.js} +2 -2
  45. package/dist/{chunk-CCPOZMS4.js → chunk-DVU734PI.js} +3 -3
  46. package/dist/{chunk-EQZUBYRF.js → chunk-DXFUYLHX.js} +1 -1
  47. package/dist/{chunk-PFAZSRGR.js → chunk-EYIMZY5O.js} +114 -19
  48. package/dist/{chunk-NK3UEKAW.js → chunk-FQ5HFSFR.js} +81 -33
  49. package/dist/{chunk-K2NKG42A.js → chunk-GTXQHZ2O.js} +5 -5
  50. package/dist/{chunk-BVWC5DBM.js → chunk-GUKGU6R7.js} +1 -1
  51. package/dist/{chunk-ZJRGWZZ2.js → chunk-GUMBIDDL.js} +74 -4
  52. package/dist/{chunk-DP6H3U2X.js → chunk-HMBTX5RK.js} +1 -1
  53. package/dist/{chunk-CUUE5MGF.js → chunk-IBXXTO3J.js} +3 -3
  54. package/dist/{chunk-YNRLCUCB.js → chunk-IOUUS6H4.js} +1 -1
  55. package/dist/{chunk-MFZOIKET.js → chunk-IQCL5JGL.js} +1 -1
  56. package/dist/{chunk-WCSXTDOL.js → chunk-K47OVEO4.js} +1 -1
  57. package/dist/{chunk-7PYCRKQL.js → chunk-KWXZMHJS.js} +3 -3
  58. package/dist/{chunk-5IMKUVMS.js → chunk-LG7Q4OW4.js} +9 -9
  59. package/dist/{chunk-HNMRX2EN.js → chunk-LXRTHE43.js} +6 -7
  60. package/dist/{chunk-RZS4F5K4.js → chunk-N6Q2PNSI.js} +3 -3
  61. package/dist/{chunk-BVYUIVXE.js → chunk-OICYQPKP.js} +1 -1
  62. package/dist/{chunk-NY5SJGJZ.js → chunk-PYBFVK6K.js} +73 -64
  63. package/dist/{chunk-ZNFNGDT7.js → chunk-QDU5MW2R.js} +1 -1
  64. package/dist/{chunk-QRNJO7DZ.js → chunk-QWY4KI2V.js} +1 -1
  65. package/dist/{chunk-L4JLLS6C.js → chunk-QY2IU47O.js} +1 -1
  66. package/dist/{chunk-UTL3MHPC.js → chunk-RC745GGZ.js} +8 -1
  67. package/dist/{chunk-SGRL7NV6.js → chunk-S5HS6WRH.js} +5 -5
  68. package/dist/{chunk-WBNQYVCM.js → chunk-THFNL3TL.js} +3 -4
  69. package/dist/{chunk-ZRN3OS7M.js → chunk-THYNA2QN.js} +1 -1
  70. package/dist/{chunk-TH6LMEOW.js → chunk-WH5VV2RW.js} +1 -1
  71. package/dist/{chunk-2JAWOTUT.js → chunk-WJJDQLVL.js} +2 -2
  72. package/dist/{chunk-KTW62MG5.js → chunk-ZFPEPWOO.js} +6 -6
  73. package/dist/cli/chat.js +33 -33
  74. package/dist/cli/check.js +5 -5
  75. package/dist/cli/plugins.js +12 -12
  76. package/dist/cli/snapshot-create.js +9 -9
  77. package/dist/cli/upgrade.js +6 -6
  78. package/dist/db/schema/agent-invocations.d.ts +16 -0
  79. package/dist/db/schema/stats.d.ts +5 -1
  80. package/dist/db/schema.d.ts +16 -0
  81. package/dist/{db-LG4ZEWA3.js → db-H5MDRQEY.js} +6 -6
  82. package/dist/instrumentation.js +3 -3
  83. package/dist/nitro.js +6 -6
  84. package/dist/{oauth-callback-server-KI7ZRTOG.js → oauth-callback-server-IOU3NUHT.js} +29 -29
  85. package/dist/reporting-schema.d.ts +2 -2
  86. package/dist/{runner-K2EOSAZQ.js → runner-FZ5ZHLFG.js} +21 -21
  87. package/dist/{skills-JTRDFKMA.js → skills-AR3WD6BX.js} +5 -5
  88. package/dist/spawn-ZU6JABR7.js +42 -0
  89. package/dist/task-runner-EEGGG2PM.js +36 -0
  90. package/dist/{validation-NBWURHAP.js → validation-VYE7TQY7.js} +5 -5
  91. package/dist/version.js +1 -1
  92. package/dist/{work-35TBEAUI.js → work-CTQFWYKE.js} +21 -21
  93. package/dist/{worker-F762M6XM.js → worker-6WQU3IT5.js} +10 -10
  94. package/package.json +5 -5
  95. package/dist/spawn-SRBETYCF.js +0 -42
  96. package/dist/task-runner-INQIQ4VF.js +0 -36
@@ -1,32 +1,32 @@
1
1
  import {
2
2
  resolveBaseUrl
3
- } from "./chunk-GQN4REF5.js";
3
+ } from "./chunk-COCVPDWX.js";
4
4
  import {
5
5
  createPluginLogger,
6
6
  getPlugins,
7
7
  getSlackClient,
8
8
  withSlackRetries
9
- } from "./chunk-NK3UEKAW.js";
9
+ } from "./chunk-FQ5HFSFR.js";
10
10
  import {
11
11
  getDb,
12
12
  parseDestination
13
- } from "./chunk-S7NSFCCW.js";
13
+ } from "./chunk-2CYWEVOP.js";
14
14
  import {
15
15
  sleep
16
- } from "./chunk-7PYCRKQL.js";
16
+ } from "./chunk-KWXZMHJS.js";
17
17
  import {
18
18
  acquireActiveLock,
19
19
  getStateAdapter
20
- } from "./chunk-YNRLCUCB.js";
20
+ } from "./chunk-IOUUS6H4.js";
21
21
  import {
22
22
  pluginCatalogRuntime
23
- } from "./chunk-EQZUBYRF.js";
23
+ } from "./chunk-DXFUYLHX.js";
24
24
  import {
25
25
  fetchWithBoundedOAuthErrorBodies
26
- } from "./chunk-QRNJO7DZ.js";
26
+ } from "./chunk-QWY4KI2V.js";
27
27
  import {
28
28
  isRecord
29
- } from "./chunk-L4JLLS6C.js";
29
+ } from "./chunk-QY2IU47O.js";
30
30
 
31
31
  // src/chat/capabilities/router.ts
32
32
  var ProviderCredentialRouter = class {
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-PDO5BLNM.js";
4
4
  import {
5
5
  botConfig
6
- } from "./chunk-2JAWOTUT.js";
6
+ } from "./chunk-WJJDQLVL.js";
7
7
  import {
8
8
  logWarn
9
- } from "./chunk-L4JLLS6C.js";
9
+ } from "./chunk-QY2IU47O.js";
10
10
 
11
11
  // src/chat/conversations/structured-events.ts
12
12
  import {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  ConversationTurnLifecycleService
3
- } from "./chunk-TH6LMEOW.js";
3
+ } from "./chunk-WH5VV2RW.js";
4
4
  import {
5
5
  runAgentWithTimeout
6
- } from "./chunk-GQN4REF5.js";
6
+ } from "./chunk-COCVPDWX.js";
7
7
  import {
8
8
  getConversationEventStore
9
- } from "./chunk-S7NSFCCW.js";
9
+ } from "./chunk-2CYWEVOP.js";
10
10
 
11
11
  // src/chat/runtime/turn-execution.ts
12
12
  var AgentRunError = class extends Error {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createPluginCatalogRuntime
3
- } from "./chunk-QRNJO7DZ.js";
3
+ } from "./chunk-QWY4KI2V.js";
4
4
 
5
5
  // src/chat/plugins/catalog-runtime.ts
6
6
  var pluginCatalogRuntime = createPluginCatalogRuntime();
@@ -11,6 +11,61 @@ import {
11
11
 
12
12
  // src/api/activity.ts
13
13
  import { z } from "zod";
14
+
15
+ // src/api/reporting-window.ts
16
+ var HOUR_MS = 60 * 60 * 1e3;
17
+ var DAY_MS = 24 * HOUR_MS;
18
+ var WINDOW_HOURS = 24;
19
+ function startOfUtcDay(valueMs) {
20
+ const date = new Date(valueMs);
21
+ date.setUTCHours(0, 0, 0, 0);
22
+ return date;
23
+ }
24
+ function startOfUtcHour(valueMs) {
25
+ const date = new Date(valueMs);
26
+ date.setUTCMinutes(0, 0, 0);
27
+ return date;
28
+ }
29
+ function utcDayKey(value) {
30
+ const date = typeof value === "number" ? new Date(value) : value;
31
+ return date.toISOString().slice(0, 10);
32
+ }
33
+ function utcHourKey(value) {
34
+ const date = typeof value === "number" ? new Date(value) : value;
35
+ return date.toISOString().slice(0, 13);
36
+ }
37
+ function trailingUtcDayWindow(nowMs, dayCount) {
38
+ const end = startOfUtcDay(nowMs);
39
+ const start = new Date(end);
40
+ start.setUTCDate(start.getUTCDate() - (dayCount - 1));
41
+ return { end, start };
42
+ }
43
+ function trailingUtcHourWindow(nowMs, hourCount = WINDOW_HOURS) {
44
+ const end = startOfUtcHour(nowMs);
45
+ const start = new Date(end.getTime() - (hourCount - 1) * HOUR_MS);
46
+ return { end, start };
47
+ }
48
+ function fillUtcDays(args) {
49
+ const { end, start } = trailingUtcDayWindow(args.nowMs, args.count);
50
+ const items = [];
51
+ for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setUTCDate(cursor.getUTCDate() + 1)) {
52
+ const date = utcDayKey(cursor);
53
+ items.push(args.rows.get(date) ?? args.empty(date));
54
+ }
55
+ return items;
56
+ }
57
+ function fillUtcHours(args) {
58
+ const hourCount = args.count ?? WINDOW_HOURS;
59
+ const { end, start } = trailingUtcHourWindow(args.nowMs, hourCount);
60
+ const items = [];
61
+ for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setTime(cursor.getTime() + HOUR_MS)) {
62
+ const date = utcHourKey(cursor);
63
+ items.push(args.rows.get(date) ?? args.empty(date));
64
+ }
65
+ return items;
66
+ }
67
+
68
+ // src/api/activity.ts
14
69
  var dailyConversationActivitySchema = z.object({
15
70
  active: z.number(),
16
71
  conversations: z.number(),
@@ -29,16 +84,19 @@ function emptyActivityDay(date) {
29
84
  };
30
85
  }
31
86
  function activityDays(days, nowMs, count) {
32
- const items = [];
33
- const end = new Date(nowMs);
34
- end.setUTCHours(0, 0, 0, 0);
35
- const start = new Date(end);
36
- start.setUTCDate(start.getUTCDate() - (count - 1));
37
- for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setUTCDate(cursor.getUTCDate() + 1)) {
38
- const date = cursor.toISOString().slice(0, 10);
39
- items.push(days.get(date) ?? emptyActivityDay(date));
40
- }
41
- return items;
87
+ return fillUtcDays({
88
+ count,
89
+ empty: emptyActivityDay,
90
+ nowMs,
91
+ rows: days
92
+ });
93
+ }
94
+ function activityHours(hours, nowMs) {
95
+ return fillUtcHours({
96
+ empty: emptyActivityDay,
97
+ nowMs,
98
+ rows: hours
99
+ });
42
100
  }
43
101
 
44
102
  // src/api/schema/code.ts
@@ -54,10 +112,11 @@ var codeChangeSummarySchema = z2.object({
54
112
  mergeRate: z2.number().min(0).max(1).optional(),
55
113
  open: z2.number().int().nonnegative()
56
114
  }).strict();
115
+ var codeMetricBucketSchema = z2.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
57
116
  var codeActivityDaySchema = z2.object({
58
117
  closed: z2.number().int().nonnegative(),
59
118
  created: z2.number().int().nonnegative(),
60
- date: z2.string().date(),
119
+ date: codeMetricBucketSchema,
61
120
  merged: z2.number().int().nonnegative()
62
121
  }).strict();
63
122
  var codeRepositorySummarySchema = z2.object({
@@ -86,6 +145,7 @@ var codeChangeSummaryReportSchema = z2.object({
86
145
  }).strict();
87
146
  var codeOverviewReportSchema = z2.object({
88
147
  activityDays: z2.array(codeActivityDaySchema),
148
+ activityHours: z2.array(codeActivityDaySchema).optional(),
89
149
  changes: z2.array(codeChangeSummaryReportSchema),
90
150
  generatedAt: z2.string(),
91
151
  repositories: z2.array(codeRepositorySummarySchema),
@@ -95,6 +155,7 @@ var codeOverviewReportSchema = z2.object({
95
155
  }).strict();
96
156
  var codePersonReportSchema = z2.object({
97
157
  activityDays: z2.array(codeActivityDaySchema),
158
+ activityHours: z2.array(codeActivityDaySchema).optional(),
98
159
  generatedAt: z2.string(),
99
160
  summary: codeChangeSummarySchema,
100
161
  windowEnd: z2.string(),
@@ -623,11 +684,12 @@ var conversationStatsItemSchema = z3.object({
623
684
  costUsd: z3.number().optional(),
624
685
  tokens: z3.number().optional()
625
686
  }).strict();
687
+ var conversationMetricBucketSchema = z3.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
626
688
  var conversationMetricDaySchema = z3.object({
627
689
  cachedInputTokens: z3.number().optional(),
628
690
  conversations: z3.number(),
629
691
  costUsd: z3.number().optional(),
630
- date: z3.string(),
692
+ date: conversationMetricBucketSchema,
631
693
  durationMs: z3.number(),
632
694
  inputTokens: z3.number().optional(),
633
695
  tokens: z3.number().optional()
@@ -636,7 +698,7 @@ var guardianMetricDaySchema = z3.object({
636
698
  allow: z3.number(),
637
699
  ask: z3.number(),
638
700
  costUsd: z3.number().optional(),
639
- date: z3.string(),
701
+ date: conversationMetricBucketSchema,
640
702
  deny: z3.number(),
641
703
  requests: z3.number()
642
704
  }).strict();
@@ -646,6 +708,7 @@ var guardianStatsSchema = z3.object({
646
708
  costUsd: z3.number().optional(),
647
709
  deny: z3.number(),
648
710
  metricDays: z3.array(guardianMetricDaySchema),
711
+ metricHours: z3.array(guardianMetricDaySchema).optional(),
649
712
  requests: z3.number()
650
713
  }).strict();
651
714
  var conversationStatsReportSchema = z3.object({
@@ -657,6 +720,7 @@ var conversationStatsReportSchema = z3.object({
657
720
  generatedAt: z3.string(),
658
721
  guardian: guardianStatsSchema,
659
722
  metricDays: z3.array(conversationMetricDaySchema),
723
+ metricHours: z3.array(conversationMetricDaySchema).optional(),
660
724
  locations: z3.array(conversationStatsItemSchema),
661
725
  actors: z3.array(conversationStatsItemSchema),
662
726
  source: z3.literal("conversation_index"),
@@ -671,11 +735,12 @@ var conversationStatsReportSchema = z3.object({
671
735
  import { z as z4 } from "zod";
672
736
  var personParamsSchema = z4.object({ email: z4.string().trim().min(1) }).strict();
673
737
  var peopleConversationStatsItemSchema = conversationStatsItemSchema.omit({ costUsd: true });
738
+ var peopleMetricBucketSchema = z4.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
674
739
  var actorActivityDayReportSchema = z4.object({
675
740
  active: z4.number(),
676
741
  conversations: z4.number(),
677
742
  costUsd: z4.number().optional(),
678
- date: z4.string(),
743
+ date: peopleMetricBucketSchema,
679
744
  durationMs: z4.number(),
680
745
  failed: z4.number(),
681
746
  tokens: z4.number().optional()
@@ -683,7 +748,7 @@ var actorActivityDayReportSchema = z4.object({
683
748
  var peopleActivityDayReportSchema = z4.object({
684
749
  activePeople: z4.number(),
685
750
  conversations: z4.number(),
686
- date: z4.string()
751
+ date: peopleMetricBucketSchema
687
752
  }).strict();
688
753
  var actorTotalsReportSchema = z4.object({
689
754
  active: z4.number(),
@@ -693,14 +758,28 @@ var actorTotalsReportSchema = z4.object({
693
758
  failed: z4.number(),
694
759
  tokens: z4.number().optional()
695
760
  }).strict();
761
+ var actorWindowMetricsSchema = z4.object({
762
+ conversations: z4.number().int().nonnegative(),
763
+ costUsd: z4.number().finite().nonnegative(),
764
+ durationMs: z4.number().finite().nonnegative(),
765
+ priorCostUsd: z4.number().finite().nonnegative()
766
+ }).strict();
767
+ var actorDirectoryWindowsSchema = z4.object({
768
+ 1: actorWindowMetricsSchema,
769
+ 7: actorWindowMetricsSchema,
770
+ 30: actorWindowMetricsSchema,
771
+ 90: actorWindowMetricsSchema
772
+ }).strict();
696
773
  var identifiedActorSchema = actorIdentitySchema.extend({ email: z4.string().min(1) }).strict();
697
774
  var actorSummaryReportSchema = actorTotalsReportSchema.extend({
698
775
  firstSeenAt: z4.string(),
699
776
  lastSeenAt: z4.string(),
700
- actor: identifiedActorSchema
777
+ actor: identifiedActorSchema,
778
+ windows: actorDirectoryWindowsSchema
701
779
  }).strict();
702
780
  var actorDirectoryReportSchema = z4.object({
703
781
  activityDays: z4.array(peopleActivityDayReportSchema),
782
+ activityHours: z4.array(peopleActivityDayReportSchema).optional(),
704
783
  generatedAt: z4.string(),
705
784
  people: z4.array(actorSummaryReportSchema),
706
785
  source: z4.literal("conversation_index"),
@@ -709,6 +788,7 @@ var actorDirectoryReportSchema = z4.object({
709
788
  }).strict();
710
789
  var actorProfileReportSchema = z4.object({
711
790
  activityDays: z4.array(actorActivityDayReportSchema),
791
+ activityHours: z4.array(actorActivityDayReportSchema).optional(),
712
792
  generatedAt: z4.string(),
713
793
  locations: z4.array(peopleConversationStatsItemSchema),
714
794
  recentConversations: z4.array(conversationSummaryReportSchema),
@@ -741,13 +821,15 @@ var locationSummaryReportSchema = conversationStatsItemSchema.extend({
741
821
  visibility: z5.literal("public")
742
822
  }).strict();
743
823
  var locationActorSummaryReportSchema = conversationStatsItemSchema.extend({ actor: actorIdentitySchema }).strict();
824
+ var locationMetricBucketSchema = z5.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
744
825
  var locationActivityDayReportSchema = z5.object({
745
- date: z5.string(),
826
+ date: locationMetricBucketSchema,
746
827
  privateConversations: z5.number(),
747
828
  publicConversations: z5.number()
748
829
  }).strict();
749
830
  var locationDirectoryReportSchema = z5.object({
750
831
  activityDays: z5.array(locationActivityDayReportSchema),
832
+ activityHours: z5.array(locationActivityDayReportSchema).optional(),
751
833
  generatedAt: z5.string(),
752
834
  locations: z5.array(locationSummaryReportSchema),
753
835
  privateActivity: conversationStatsItemSchema,
@@ -757,6 +839,7 @@ var locationDirectoryReportSchema = z5.object({
757
839
  }).strict();
758
840
  var locationDetailReportSchema = locationSummaryReportSchema.extend({
759
841
  activityDays: z5.array(dailyConversationActivitySchema),
842
+ activityHours: z5.array(dailyConversationActivitySchema).optional(),
760
843
  actors: z5.array(locationActorSummaryReportSchema),
761
844
  generatedAt: z5.string(),
762
845
  recentConversations: z5.array(conversationSummaryReportSchema),
@@ -867,13 +950,15 @@ var taskSummarySchema = z9.discriminatedUnion("kind", [
867
950
  scheduledTaskSummarySchema,
868
951
  eventTaskSummarySchema
869
952
  ]);
953
+ var taskMetricBucketSchema = z9.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
870
954
  var taskExecutionDaySchema = z9.object({
871
- date: z9.string().min(1),
955
+ date: taskMetricBucketSchema,
872
956
  event: z9.number().int().nonnegative(),
873
957
  scheduled: z9.number().int().nonnegative()
874
958
  }).strict();
875
959
  var taskListSchema = z9.object({
876
960
  executionDays: z9.array(taskExecutionDaySchema),
961
+ executionHours: z9.array(taskExecutionDaySchema).optional(),
877
962
  tasks: z9.array(taskSummarySchema),
878
963
  truncated: z9.boolean()
879
964
  }).strict();
@@ -896,11 +981,12 @@ var taskExecutionSchema = z9.object({
896
981
  var taskExecutionStatusDaySchema = z9.object({
897
982
  blocked: z9.number().int().nonnegative(),
898
983
  completed: z9.number().int().nonnegative(),
899
- date: z9.string().min(1),
984
+ date: taskMetricBucketSchema,
900
985
  failed: z9.number().int().nonnegative()
901
986
  }).strict();
902
987
  var taskExecutionListSchema = z9.object({
903
988
  executionDays: z9.array(taskExecutionStatusDaySchema),
989
+ executionHours: z9.array(taskExecutionStatusDaySchema).optional(),
904
990
  executions: z9.array(taskExecutionSchema),
905
991
  task: taskSummarySchema,
906
992
  truncated: z9.boolean()
@@ -964,8 +1050,17 @@ export {
964
1050
  codeChangeSummaryReportSchema,
965
1051
  codeOverviewReportSchema,
966
1052
  codePersonReportSchema,
1053
+ HOUR_MS,
1054
+ DAY_MS,
1055
+ utcDayKey,
1056
+ utcHourKey,
1057
+ trailingUtcDayWindow,
1058
+ trailingUtcHourWindow,
1059
+ fillUtcDays,
1060
+ fillUtcHours,
967
1061
  dailyConversationActivitySchema,
968
1062
  activityDays,
1063
+ activityHours,
969
1064
  locationParamsSchema,
970
1065
  locationActivityDayReportSchema,
971
1066
  locationDirectoryReportSchema,
@@ -5,7 +5,7 @@ import {
5
5
  getConversationEventStore,
6
6
  getDb,
7
7
  getSqlExecutor
8
- } from "./chunk-S7NSFCCW.js";
8
+ } from "./chunk-2CYWEVOP.js";
9
9
  import {
10
10
  juniorCodeChanges,
11
11
  juniorCodeRepositories,
@@ -16,7 +16,7 @@ import {
16
16
  juniorUsers,
17
17
  juniorWorkspaceRepos,
18
18
  juniorWorkspaces
19
- } from "./chunk-SEIZ2XLD.js";
19
+ } from "./chunk-5S6AQFNG.js";
20
20
  import {
21
21
  SANDBOX_WORKSPACE_ROOT,
22
22
  getVercelSandboxCredentials,
@@ -24,16 +24,16 @@ import {
24
24
  isSandboxMissingError,
25
25
  runNonInteractiveCommand,
26
26
  sleep
27
- } from "./chunk-7PYCRKQL.js";
27
+ } from "./chunk-KWXZMHJS.js";
28
28
  import {
29
29
  getStateAdapter
30
- } from "./chunk-YNRLCUCB.js";
30
+ } from "./chunk-IOUUS6H4.js";
31
31
  import {
32
32
  botConfig,
33
33
  completeObject,
34
34
  embedTexts,
35
35
  getSlackBotToken
36
- } from "./chunk-2JAWOTUT.js";
36
+ } from "./chunk-WJJDQLVL.js";
37
37
  import {
38
38
  defaultModelId
39
39
  } from "./chunk-D4YV5TDV.js";
@@ -52,7 +52,7 @@ import {
52
52
  setSpanAttributes,
53
53
  setSpanStatus,
54
54
  withSpan
55
- } from "./chunk-L4JLLS6C.js";
55
+ } from "./chunk-QY2IU47O.js";
56
56
 
57
57
  // src/chat/plugins/agent-hooks.ts
58
58
  import {
@@ -211,7 +211,7 @@ import { z } from "zod";
211
211
  var DAY_MS = 24 * 60 * 60 * 1e3;
212
212
  var costRowSchema = z.object({
213
213
  costUsd: z.number().finite().nonnegative(),
214
- date: z.string().date(),
214
+ date: z.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/),
215
215
  events: z.number().int().nonnegative()
216
216
  }).strict();
217
217
  function startOfUtcDay(value) {
@@ -231,6 +231,48 @@ function registeredEventName(plugin, eventName) {
231
231
  }
232
232
  function createPluginConversationEventStats(plugin, now = Date.now) {
233
233
  return {
234
+ async costsByHour(input) {
235
+ const eventName = registeredEventName(plugin, input.eventName);
236
+ const hourCount = input.hours ?? 24;
237
+ const end = new Date(now());
238
+ end.setUTCMinutes(0, 0, 0);
239
+ const start = new Date(end.getTime() - (hourCount - 1) * 60 * 60 * 1e3);
240
+ const endExclusive = new Date(end.getTime() + 60 * 60 * 1e3);
241
+ const date = sql`TO_CHAR(
242
+ ${juniorConversationEvents.createdAt} AT TIME ZONE 'UTC',
243
+ 'YYYY-MM-DD"T"HH24'
244
+ )`;
245
+ const cost = sql`CASE
246
+ WHEN jsonb_typeof(${juniorConversationEvents.payload}->'content'->'costUsd') = 'number'
247
+ THEN (${juniorConversationEvents.payload}->'content'->>'costUsd')::double precision
248
+ ELSE 0
249
+ END`;
250
+ const rows = await getDb().select({
251
+ costUsd: sql`SUM(${cost})::double precision`.mapWith(Number),
252
+ date,
253
+ events: sql`COUNT(*)::integer`.mapWith(Number)
254
+ }).from(juniorConversationEvents).where(
255
+ and2(
256
+ eq2(juniorConversationEvents.type, "structured_event"),
257
+ sql`${juniorConversationEvents.payload}->>'namespace' = ${plugin.manifest.name}`,
258
+ sql`${juniorConversationEvents.payload}->>'name' = ${eventName}`,
259
+ gte(juniorConversationEvents.createdAt, start),
260
+ lt(juniorConversationEvents.createdAt, endExclusive)
261
+ )
262
+ ).groupBy(date);
263
+ const byHour = new Map(
264
+ z.array(costRowSchema).parse(rows).map((row) => [row.date, row])
265
+ );
266
+ return Array.from({ length: hourCount }, (_, index) => {
267
+ const hour = new Date(start.getTime() + index * 60 * 60 * 1e3);
268
+ const key = hour.toISOString().slice(0, 13);
269
+ return byHour.get(key) ?? {
270
+ costUsd: 0,
271
+ date: key,
272
+ events: 0
273
+ };
274
+ });
275
+ },
234
276
  async costsByDay(input) {
235
277
  const eventName = registeredEventName(plugin, input.eventName);
236
278
  const end = startOfUtcDay(now());
@@ -898,31 +940,30 @@ var RESOURCE_WATCH_TOOL_SOURCE = {
898
940
 
899
941
  // src/chat/slack/tool-support/context.ts
900
942
  function getSlackToolContext(context) {
901
- if (context.source.kind !== "slack") {
902
- return void 0;
903
- }
904
- if (context.destination.platform !== "slack") {
905
- throw new TypeError("Slack source requires a Slack destination");
906
- }
943
+ const source = context.source.kind === "slack" ? context.source : void 0;
944
+ const location = context.location?.provider === "slack" ? context.location : source ? {
945
+ provider: "slack",
946
+ teamId: source.teamId,
947
+ channelId: source.channelId,
948
+ threadTs: source.threadTs
949
+ } : void 0;
950
+ if (!location) return void 0;
907
951
  const destinationChannelId = parseSlackChannelReferenceId(
908
- context.destination.channelId
952
+ context.destination.platform === "slack" ? context.destination.channelId : location.channelId
909
953
  );
910
- const sourceChannelId = parseSlackChannelReferenceId(
911
- context.source.channelId
912
- );
913
- const teamId = parseSlackTeamId(context.source.teamId);
914
- if (!destinationChannelId || !sourceChannelId || !teamId) {
954
+ const locationChannelId = parseSlackChannelReferenceId(location.channelId);
955
+ const teamId = parseSlackTeamId(location.teamId);
956
+ if (!destinationChannelId || !locationChannelId || !teamId) {
915
957
  return void 0;
916
958
  }
917
959
  return {
918
- destination: context.destination,
919
- source: context.source,
920
960
  actor: context.actor?.platform === "slack" ? context.actor : void 0,
921
961
  destinationChannelId,
922
- messageTs: parseSlackMessageTs(context.source.messageTs),
923
- sourceChannelId,
962
+ locationChannelId,
963
+ messageChannelId: source ? parseSlackChannelReferenceId(source.channelId) : void 0,
964
+ messageTs: parseSlackMessageTs(source?.messageTs),
924
965
  teamId,
925
- threadTs: parseSlackMessageTs(context.source.threadTs)
966
+ threadTs: parseSlackMessageTs(location.threadTs)
926
967
  };
927
968
  }
928
969
 
@@ -2335,9 +2376,13 @@ function pluginInvocationContext(context) {
2335
2376
  source: context.source
2336
2377
  };
2337
2378
  case "resource_event":
2379
+ case "scheduled_task":
2380
+ case "event_task":
2381
+ case "plugin_dispatch":
2382
+ case "agent_invocation":
2338
2383
  return {
2339
2384
  ...common,
2340
- actor: context.actor?.platform === "system" ? context.actor : void 0,
2385
+ actor: context.actor,
2341
2386
  destination: context.destination,
2342
2387
  source: context.source
2343
2388
  };
@@ -2523,7 +2568,7 @@ function applyPluginFormatMarkdown(text) {
2523
2568
  }
2524
2569
  return transformed;
2525
2570
  }
2526
- async function getPluginSystemPromptContributions(source) {
2571
+ async function getPluginSystemPromptContributions(platform) {
2527
2572
  const contributions = [];
2528
2573
  let totalChars = 0;
2529
2574
  for (const plugin of getPlugins()) {
@@ -2535,8 +2580,7 @@ async function getPluginSystemPromptContributions(source) {
2535
2580
  try {
2536
2581
  const pluginContributions = await hook({
2537
2582
  ...systemPromptPluginContext(plugin),
2538
- // Plugin system prompts only distinguish Slack vs non-Slack surfaces.
2539
- platform: source.kind === "slack" ? "slack" : "local"
2583
+ platform
2540
2584
  });
2541
2585
  const result = systemPromptMessageArraySchema.safeParse(pluginContributions);
2542
2586
  if (!result.success) {
@@ -2651,7 +2695,7 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
2651
2695
  }
2652
2696
  const slackToolContext = getSlackToolContext(context);
2653
2697
  const credentialSubject = slackToolContext ? createSlackDirectCredentialSubject({
2654
- channelId: slackToolContext.sourceChannelId,
2698
+ channelId: slackToolContext.locationChannelId,
2655
2699
  teamId: slackToolContext.teamId,
2656
2700
  userId: slackToolContext.actor?.userId
2657
2701
  }) : void 0;
@@ -2660,7 +2704,7 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
2660
2704
  );
2661
2705
  const slackContext = slackToolContext ? {
2662
2706
  channelCapabilities: resolveChannelCapabilities(
2663
- slackToolContext.sourceChannelId
2707
+ slackToolContext.locationChannelId
2664
2708
  ),
2665
2709
  ...dashboardConversationUrl ? { conversationLink: { url: dashboardConversationUrl } } : void 0,
2666
2710
  ...credentialSubject ? { credentialSubject } : void 0
@@ -2716,6 +2760,7 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
2716
2760
  annotations,
2717
2761
  conversationId: context.conversationId,
2718
2762
  locationId: context.locationId,
2763
+ ...slackContext ? { slack: slackContext } : void 0,
2719
2764
  userText: context.userText,
2720
2765
  embedder: createPluginEmbedder(pluginName),
2721
2766
  egress: context.egress,
@@ -2743,7 +2788,6 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
2743
2788
  ...common,
2744
2789
  actor: context.actor?.platform === "slack" ? context.actor : void 0,
2745
2790
  destination: context.destination,
2746
- slack: slackContext,
2747
2791
  source: context.source
2748
2792
  };
2749
2793
  break;
@@ -2769,9 +2813,13 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
2769
2813
  };
2770
2814
  break;
2771
2815
  case "resource_event":
2816
+ case "scheduled_task":
2817
+ case "event_task":
2818
+ case "plugin_dispatch":
2819
+ case "agent_invocation":
2772
2820
  pluginContext = {
2773
2821
  ...common,
2774
- actor: context.actor?.platform === "system" ? context.actor : void 0,
2822
+ actor: context.actor,
2775
2823
  destination: context.destination,
2776
2824
  source: context.source
2777
2825
  };
@@ -3191,7 +3239,7 @@ function sanitizeOperationalReport(args) {
3191
3239
  sanitizedWidget.emptyText = emptyText;
3192
3240
  }
3193
3241
  const timeRangeDays = widget.timeRangeDays?.filter(
3194
- (days) => days === 7 || days === 30 || days === 90
3242
+ (days) => days === 1 || days === 7 || days === 30 || days === 90
3195
3243
  );
3196
3244
  if (timeRangeDays?.length) {
3197
3245
  sanitizedWidget.timeRangeDays = [...new Set(timeRangeDays)];
@@ -2,16 +2,16 @@ import {
2
2
  coerceThreadConversationState,
3
3
  getPersistedThreadState,
4
4
  persistThreadStateById
5
- } from "./chunk-SGRL7NV6.js";
5
+ } from "./chunk-S5HS6WRH.js";
6
6
  import {
7
7
  clearPendingAuth,
8
8
  markTurnClosed,
9
9
  markTurnCompleted
10
- } from "./chunk-WCSXTDOL.js";
10
+ } from "./chunk-K47OVEO4.js";
11
11
  import {
12
12
  hydrateConversationMessages,
13
13
  markConversationMessage
14
- } from "./chunk-KTW62MG5.js";
14
+ } from "./chunk-ZFPEPWOO.js";
15
15
  import {
16
16
  buildDeterministicTurnId
17
17
  } from "./chunk-DA2KGZZI.js";
@@ -20,13 +20,13 @@ import {
20
20
  findProviderError,
21
21
  getProviderErrorAttributes,
22
22
  getProviderErrorUserMessage
23
- } from "./chunk-2JAWOTUT.js";
23
+ } from "./chunk-WJJDQLVL.js";
24
24
  import {
25
25
  parseSlackMessageTs
26
26
  } from "./chunk-N7TMSOZH.js";
27
27
  import {
28
28
  buildTurnFailureResponse
29
- } from "./chunk-L4JLLS6C.js";
29
+ } from "./chunk-QY2IU47O.js";
30
30
 
31
31
  // src/chat/runtime/delivered-turn-state.ts
32
32
  function buildDeliveredTurnStatePatch(args) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-EQZUBYRF.js";
3
+ } from "./chunk-DXFUYLHX.js";
4
4
 
5
5
  // src/chat/plugins/validation.ts
6
6
  import { isDeepStrictEqual } from "util";