@sentry/junior 0.133.0 → 0.134.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 (68) hide show
  1. package/dist/{agent-hooks-5BUIXVIX.js → agent-hooks-HGXNYOOD.js} +9 -9
  2. package/dist/api/schema/task.d.ts +60 -0
  3. package/dist/api/schema.d.ts +2 -2
  4. package/dist/api/schema.js +3 -1
  5. package/dist/api.js +90 -20
  6. package/dist/app.js +48 -24
  7. package/dist/{catalog-runtime-VGB3DWXZ.js → catalog-runtime-P6QHU6XE.js} +5 -5
  8. package/dist/chat/agent/prompt.d.ts +7 -5
  9. package/dist/chat/agent/repository-context.d.ts +20 -0
  10. package/dist/chat/agent/sandbox.d.ts +8 -0
  11. package/dist/chat/agent/tools.d.ts +3 -0
  12. package/dist/chat/plugins/agent-hooks.d.ts +2 -2
  13. package/dist/chat/repository-instructions.d.ts +44 -0
  14. package/dist/chat/sandbox/noninteractive-command.d.ts +2 -0
  15. package/dist/chat/sandbox/sandbox.d.ts +3 -0
  16. package/dist/chat/sandbox/session.d.ts +1 -0
  17. package/dist/chat/services/context-compaction.d.ts +1 -0
  18. package/dist/chat/slack/tools/user-lookup.d.ts +2 -6
  19. package/dist/chat/tasks/execution-stats.d.ts +29 -0
  20. package/dist/chat/tasks/registered.d.ts +3 -0
  21. package/dist/chat/tools/index.d.ts +2 -0
  22. package/dist/chat/tools/sandbox/bash.d.ts +1 -0
  23. package/dist/chat/tools/system-time.d.ts +11 -1
  24. package/dist/{chunk-VQA25AL4.js → chunk-52DIKFJV.js} +14 -6
  25. package/dist/{chunk-EJRJWBKG.js → chunk-6T3AYZT7.js} +1 -1
  26. package/dist/{chunk-ECUILEUX.js → chunk-7GKQ7UIO.js} +430 -29
  27. package/dist/{chunk-QVEXYYFM.js → chunk-7UTBPDXK.js} +24 -1
  28. package/dist/{chunk-V365UVCU.js → chunk-AS3I7OIL.js} +2 -2
  29. package/dist/{chunk-HX236W2U.js → chunk-CDQ4YIZM.js} +9 -0
  30. package/dist/{chunk-TLN54TOQ.js → chunk-FDNAUM7X.js} +32 -32
  31. package/dist/{chunk-TU7P77FI.js → chunk-FL466XX5.js} +12 -12
  32. package/dist/{chunk-IKO5LFIU.js → chunk-GSP5SMZJ.js} +1 -1
  33. package/dist/{chunk-XTQGVNM3.js → chunk-KWGJG4HO.js} +6 -12
  34. package/dist/{chunk-VL7OYSHD.js → chunk-LKK4XMUV.js} +1 -1
  35. package/dist/{chunk-AH5HTUYX.js → chunk-MFERLE3G.js} +1 -1
  36. package/dist/{chunk-T5FPIBU2.js → chunk-NF2TNZPD.js} +788 -674
  37. package/dist/chunk-NOA34AJY.js +122 -0
  38. package/dist/{chunk-5ZAZHLIW.js → chunk-NYWSCJVW.js} +1 -1
  39. package/dist/{chunk-QWGZ273D.js → chunk-QLEKAO7O.js} +71 -23
  40. package/dist/{chunk-IVTHTAVK.js → chunk-S6DMTEOM.js} +2 -2
  41. package/dist/{chunk-WHEMUEXT.js → chunk-TR6UEEYD.js} +8 -6
  42. package/dist/{chunk-FX6BLEDP.js → chunk-U3ZI7CCW.js} +1 -1
  43. package/dist/{chunk-JLN4XSPR.js → chunk-VEGF62FV.js} +1 -1
  44. package/dist/{chunk-HTGXUNEC.js → chunk-VGXJMECA.js} +7 -7
  45. package/dist/{chunk-HJ4KDO4N.js → chunk-VP6NCPRS.js} +1 -1
  46. package/dist/{chunk-LNYNTR27.js → chunk-VPYKNCTN.js} +3 -3
  47. package/dist/{chunk-LDRO4OQ4.js → chunk-XG5PHKPM.js} +2 -2
  48. package/dist/{chunk-TBVS7GBE.js → chunk-YNLQQ622.js} +9 -8
  49. package/dist/cli/chat.js +25 -25
  50. package/dist/cli/check.js +6 -6
  51. package/dist/cli/init.js +0 -1
  52. package/dist/cli/plugins.js +12 -12
  53. package/dist/cli/snapshot-create.js +9 -9
  54. package/dist/cli/upgrade.js +7 -7
  55. package/dist/db/schema/task-executions.d.ts +110 -0
  56. package/dist/db/schema.d.ts +111 -1
  57. package/dist/{db-RICMPUFT.js → db-GFK4NHWJ.js} +7 -7
  58. package/dist/instrumentation.js +4 -4
  59. package/dist/nitro.js +2 -2
  60. package/dist/{oauth-callback-server-YFVS4SAX.js → oauth-callback-server-HUJLAQ5N.js} +19 -18
  61. package/dist/{runner-A3LVGZR6.js → runner-T77AFAH4.js} +13 -12
  62. package/dist/{skills-P7Q6Z6PN.js → skills-3KUFJOOR.js} +6 -6
  63. package/dist/{validation-RYHOWBET.js → validation-FMWDHKYU.js} +6 -6
  64. package/dist/version.js +1 -1
  65. package/migrations/0019_lowly_valkyrie.sql +14 -0
  66. package/migrations/meta/0019_snapshot.json +1904 -0
  67. package/migrations/meta/_journal.json +7 -0
  68. package/package.json +4 -4
@@ -11,19 +11,19 @@ import {
11
11
  getPlugins,
12
12
  setPlugins,
13
13
  validatePlugins
14
- } from "./chunk-WHEMUEXT.js";
15
- import "./chunk-LNYNTR27.js";
16
- import "./chunk-QWGZ273D.js";
17
- import "./chunk-TLN54TOQ.js";
18
- import "./chunk-LDRO4OQ4.js";
14
+ } from "./chunk-TR6UEEYD.js";
15
+ import "./chunk-VPYKNCTN.js";
16
+ import "./chunk-QLEKAO7O.js";
17
+ import "./chunk-FDNAUM7X.js";
18
+ import "./chunk-XG5PHKPM.js";
19
19
  import "./chunk-VFUK3X5B.js";
20
- import "./chunk-VL7OYSHD.js";
20
+ import "./chunk-LKK4XMUV.js";
21
21
  import "./chunk-HZF5P5UN.js";
22
22
  import "./chunk-F3B2YJ76.js";
23
- import "./chunk-EJRJWBKG.js";
23
+ import "./chunk-6T3AYZT7.js";
24
24
  import "./chunk-6GWA276C.js";
25
- import "./chunk-FX6BLEDP.js";
26
- import "./chunk-IKO5LFIU.js";
25
+ import "./chunk-U3ZI7CCW.js";
26
+ import "./chunk-GSP5SMZJ.js";
27
27
  import "./chunk-MLKGABMK.js";
28
28
  export {
29
29
  PluginHookDeniedError,
@@ -14,7 +14,11 @@ export declare const scheduledTaskSummarySchema: z.ZodObject<{
14
14
  }, z.core.$strict>;
15
15
  id: z.ZodString;
16
16
  instruction: z.ZodString;
17
+ lastConversationId: z.ZodOptional<z.ZodString>;
18
+ lastRunAt: z.ZodOptional<z.ZodString>;
17
19
  ownedByViewer: z.ZodBoolean;
20
+ runsLast7Days: z.ZodNumber;
21
+ totalRuns: z.ZodNumber;
18
22
  kind: z.ZodLiteral<"scheduled">;
19
23
  nextRunAt: z.ZodOptional<z.ZodString>;
20
24
  schedule: z.ZodString;
@@ -38,7 +42,11 @@ export declare const eventTaskSummarySchema: z.ZodObject<{
38
42
  }, z.core.$strict>;
39
43
  id: z.ZodString;
40
44
  instruction: z.ZodString;
45
+ lastConversationId: z.ZodOptional<z.ZodString>;
46
+ lastRunAt: z.ZodOptional<z.ZodString>;
41
47
  ownedByViewer: z.ZodBoolean;
48
+ runsLast7Days: z.ZodNumber;
49
+ totalRuns: z.ZodNumber;
42
50
  events: z.ZodArray<z.ZodString>;
43
51
  kind: z.ZodLiteral<"event">;
44
52
  resource: z.ZodString;
@@ -60,7 +68,11 @@ export declare const taskSummarySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
60
68
  }, z.core.$strict>;
61
69
  id: z.ZodString;
62
70
  instruction: z.ZodString;
71
+ lastConversationId: z.ZodOptional<z.ZodString>;
72
+ lastRunAt: z.ZodOptional<z.ZodString>;
63
73
  ownedByViewer: z.ZodBoolean;
74
+ runsLast7Days: z.ZodNumber;
75
+ totalRuns: z.ZodNumber;
64
76
  kind: z.ZodLiteral<"scheduled">;
65
77
  nextRunAt: z.ZodOptional<z.ZodString>;
66
78
  schedule: z.ZodString;
@@ -83,14 +95,52 @@ export declare const taskSummarySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
83
95
  }, z.core.$strict>;
84
96
  id: z.ZodString;
85
97
  instruction: z.ZodString;
98
+ lastConversationId: z.ZodOptional<z.ZodString>;
99
+ lastRunAt: z.ZodOptional<z.ZodString>;
86
100
  ownedByViewer: z.ZodBoolean;
101
+ runsLast7Days: z.ZodNumber;
102
+ totalRuns: z.ZodNumber;
87
103
  events: z.ZodArray<z.ZodString>;
88
104
  kind: z.ZodLiteral<"event">;
89
105
  resource: z.ZodString;
90
106
  source: z.ZodString;
91
107
  triggerAvailable: z.ZodBoolean;
92
108
  }, z.core.$strict>], "kind">;
109
+ /** One registered plugin background task with run frequency and recency. */
110
+ export declare const registeredTaskSummarySchema: z.ZodObject<{
111
+ id: z.ZodString;
112
+ lastConversationId: z.ZodOptional<z.ZodString>;
113
+ lastRunAt: z.ZodOptional<z.ZodString>;
114
+ name: z.ZodString;
115
+ pluginDisplayName: z.ZodString;
116
+ pluginName: z.ZodString;
117
+ runsLast7Days: z.ZodNumber;
118
+ totalRuns: z.ZodNumber;
119
+ }, z.core.$strict>;
120
+ /** One UTC day of successful task executions stacked by task type. */
121
+ export declare const taskExecutionDaySchema: z.ZodObject<{
122
+ date: z.ZodString;
123
+ event: z.ZodNumber;
124
+ registered: z.ZodNumber;
125
+ scheduled: z.ZodNumber;
126
+ }, z.core.$strict>;
93
127
  export declare const taskListSchema: z.ZodObject<{
128
+ executionDays: z.ZodArray<z.ZodObject<{
129
+ date: z.ZodString;
130
+ event: z.ZodNumber;
131
+ registered: z.ZodNumber;
132
+ scheduled: z.ZodNumber;
133
+ }, z.core.$strict>>;
134
+ registeredTasks: z.ZodArray<z.ZodObject<{
135
+ id: z.ZodString;
136
+ lastConversationId: z.ZodOptional<z.ZodString>;
137
+ lastRunAt: z.ZodOptional<z.ZodString>;
138
+ name: z.ZodString;
139
+ pluginDisplayName: z.ZodString;
140
+ pluginName: z.ZodString;
141
+ runsLast7Days: z.ZodNumber;
142
+ totalRuns: z.ZodNumber;
143
+ }, z.core.$strict>>;
94
144
  tasks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
95
145
  createdAt: z.ZodString;
96
146
  createdBy: z.ZodString;
@@ -106,7 +156,11 @@ export declare const taskListSchema: z.ZodObject<{
106
156
  }, z.core.$strict>;
107
157
  id: z.ZodString;
108
158
  instruction: z.ZodString;
159
+ lastConversationId: z.ZodOptional<z.ZodString>;
160
+ lastRunAt: z.ZodOptional<z.ZodString>;
109
161
  ownedByViewer: z.ZodBoolean;
162
+ runsLast7Days: z.ZodNumber;
163
+ totalRuns: z.ZodNumber;
110
164
  kind: z.ZodLiteral<"scheduled">;
111
165
  nextRunAt: z.ZodOptional<z.ZodString>;
112
166
  schedule: z.ZodString;
@@ -129,7 +183,11 @@ export declare const taskListSchema: z.ZodObject<{
129
183
  }, z.core.$strict>;
130
184
  id: z.ZodString;
131
185
  instruction: z.ZodString;
186
+ lastConversationId: z.ZodOptional<z.ZodString>;
187
+ lastRunAt: z.ZodOptional<z.ZodString>;
132
188
  ownedByViewer: z.ZodBoolean;
189
+ runsLast7Days: z.ZodNumber;
190
+ totalRuns: z.ZodNumber;
133
191
  events: z.ZodArray<z.ZodString>;
134
192
  kind: z.ZodLiteral<"event">;
135
193
  resource: z.ZodString;
@@ -145,5 +203,7 @@ export declare const taskParamsSchema: z.ZodObject<{
145
203
  scheduled: "scheduled";
146
204
  }>;
147
205
  }, z.core.$strict>;
206
+ export type RegisteredTaskSummary = z.output<typeof registeredTaskSummarySchema>;
207
+ export type TaskExecutionDay = z.output<typeof taskExecutionDaySchema>;
148
208
  export type TaskSummary = z.output<typeof taskSummarySchema>;
149
209
  export type TaskList = z.output<typeof taskListSchema>;
@@ -10,8 +10,8 @@ export { apiErrorSchema } from "./schema/common";
10
10
  export type { ApiError } from "./schema/common";
11
11
  export { createPersonalTokenBodySchema, createdPersonalTokenSchema, personalTokenListSchema, personalTokenMetadataSchema, personalTokenParamsSchema, revokePersonalTokenResponseSchema, } from "./schema/personal-token";
12
12
  export type { PersonalTokenMetadata } from "./schema/personal-token";
13
- export { eventTaskSummarySchema, scheduledTaskSummarySchema, taskListSchema, taskParamsSchema, taskSummarySchema, } from "./schema/task";
14
- export type { TaskList, TaskSummary } from "./schema/task";
13
+ export { eventTaskSummarySchema, registeredTaskSummarySchema, scheduledTaskSummarySchema, taskListSchema, taskParamsSchema, taskSummarySchema, } from "./schema/task";
14
+ export type { RegisteredTaskSummary, TaskExecutionDay, TaskList, TaskSummary, } from "./schema/task";
15
15
  export { statSchema, statsReportSchema } from "./schema/stats";
16
16
  export type { StatReport, StatsReport } from "./schema/stats";
17
17
  export { healthReportSchema, pluginOperationalReportFeedSchema, pluginOperationalReportSchema, pluginPackageContentItemReportSchema, pluginPackageContentReportSchema, pluginSchema, pluginsSchema, runtimeInfoReportSchema, skillReportSchema, skillReportsSchema, } from "../reporting-schema";
@@ -30,6 +30,7 @@ import {
30
30
  personalTokenListSchema,
31
31
  personalTokenMetadataSchema,
32
32
  personalTokenParamsSchema,
33
+ registeredTaskSummarySchema,
33
34
  revokePersonalTokenResponseSchema,
34
35
  scheduledTaskSummarySchema,
35
36
  statSchema,
@@ -37,7 +38,7 @@ import {
37
38
  taskListSchema,
38
39
  taskParamsSchema,
39
40
  taskSummarySchema
40
- } from "../chunk-QVEXYYFM.js";
41
+ } from "../chunk-7UTBPDXK.js";
41
42
  import {
42
43
  healthReportSchema,
43
44
  pluginOperationalReportFeedSchema,
@@ -92,6 +93,7 @@ export {
92
93
  pluginPackageContentReportSchema,
93
94
  pluginSchema,
94
95
  pluginsSchema,
96
+ registeredTaskSummarySchema,
95
97
  revokePersonalTokenResponseSchema,
96
98
  runtimeInfoReportSchema,
97
99
  scheduledTaskSummarySchema,
package/dist/api.js CHANGED
@@ -27,15 +27,19 @@ import {
27
27
  statsReportSchema,
28
28
  taskListSchema,
29
29
  taskParamsSchema
30
- } from "./chunk-QVEXYYFM.js";
30
+ } from "./chunk-7UTBPDXK.js";
31
31
  import {
32
32
  formatSlackConversationRedactedLabel,
33
33
  readHealthReport,
34
34
  resolveSlackConversationContextFromThreadId
35
- } from "./chunk-V365UVCU.js";
35
+ } from "./chunk-AS3I7OIL.js";
36
36
  import {
37
37
  buildSentryConversationUrl
38
38
  } from "./chunk-4CODA7P5.js";
39
+ import {
40
+ readTaskExecutionDays,
41
+ readTaskExecutionSummaries
42
+ } from "./chunk-NOA34AJY.js";
39
43
  import {
40
44
  healthReportSchema,
41
45
  pluginOperationalReportFeedSchema,
@@ -54,15 +58,15 @@ import {
54
58
  listPublicEventTasksForTeams,
55
59
  listPublicScheduledTasksForTeams,
56
60
  readStats
57
- } from "./chunk-XTQGVNM3.js";
61
+ } from "./chunk-KWGJG4HO.js";
58
62
  import {
59
63
  parseSlackThreadId
60
- } from "./chunk-AH5HTUYX.js";
64
+ } from "./chunk-MFERLE3G.js";
61
65
  import {
62
66
  agentTurnUsageSchema,
63
67
  hasAgentTurnUsage,
64
68
  renderJuniorNativeConversationEvent
65
- } from "./chunk-HX236W2U.js";
69
+ } from "./chunk-CDQ4YIZM.js";
66
70
  import "./chunk-PDO5BLNM.js";
67
71
  import {
68
72
  createPluginLogger,
@@ -70,38 +74,38 @@ import {
70
74
  listConversationAnnotations,
71
75
  renderPluginConversationEvent,
72
76
  resolveViewerUser
73
- } from "./chunk-WHEMUEXT.js";
77
+ } from "./chunk-TR6UEEYD.js";
74
78
  import {
75
79
  decodeStoredConversationEvent,
76
80
  getDb,
77
81
  getSqlExecutor,
78
82
  locationFromRow,
79
83
  parseSessionSource
80
- } from "./chunk-LNYNTR27.js";
84
+ } from "./chunk-VPYKNCTN.js";
81
85
  import {
82
86
  juniorApiTokens,
83
87
  juniorConversationEvents,
84
88
  juniorConversations,
85
89
  juniorIdentities,
86
90
  juniorUsers
87
- } from "./chunk-QWGZ273D.js";
88
- import "./chunk-TLN54TOQ.js";
89
- import "./chunk-LDRO4OQ4.js";
91
+ } from "./chunk-QLEKAO7O.js";
92
+ import "./chunk-FDNAUM7X.js";
93
+ import "./chunk-XG5PHKPM.js";
90
94
  import {
91
95
  juniorDestinations
92
96
  } from "./chunk-VFUK3X5B.js";
93
97
  import {
94
98
  canExposeConversationPayload
95
- } from "./chunk-VL7OYSHD.js";
99
+ } from "./chunk-LKK4XMUV.js";
96
100
  import "./chunk-HZF5P5UN.js";
97
101
  import {
98
102
  parseSlackChannelId,
99
103
  parseSlackTeamId
100
104
  } from "./chunk-F3B2YJ76.js";
101
- import "./chunk-EJRJWBKG.js";
105
+ import "./chunk-6T3AYZT7.js";
102
106
  import "./chunk-6GWA276C.js";
103
- import "./chunk-FX6BLEDP.js";
104
- import "./chunk-IKO5LFIU.js";
107
+ import "./chunk-U3ZI7CCW.js";
108
+ import "./chunk-GSP5SMZJ.js";
105
109
  import "./chunk-MLKGABMK.js";
106
110
 
107
111
  // src/api.ts
@@ -2027,7 +2031,7 @@ function readDescriptionText(home) {
2027
2031
  }
2028
2032
  }
2029
2033
  async function readSkillReports() {
2030
- const { discoverSkills } = await import("./skills-P7Q6Z6PN.js");
2034
+ const { discoverSkills } = await import("./skills-3KUFJOOR.js");
2031
2035
  const skills = await discoverSkills();
2032
2036
  return skillReportsSchema.parse(
2033
2037
  skills.map((skill) => ({
@@ -2037,7 +2041,7 @@ async function readSkillReports() {
2037
2041
  );
2038
2042
  }
2039
2043
  async function readPlugins() {
2040
- const { pluginCatalogRuntime } = await import("./catalog-runtime-VGB3DWXZ.js");
2044
+ const { pluginCatalogRuntime } = await import("./catalog-runtime-P6QHU6XE.js");
2041
2045
  return pluginsSchema.parse(
2042
2046
  pluginCatalogRuntime.getProviders().map((plugin) => ({
2043
2047
  configKeys: plugin.manifest.configKeys ?? [],
@@ -2050,7 +2054,7 @@ async function readPlugins() {
2050
2054
  async function readRuntimeInfoReport() {
2051
2055
  const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
2052
2056
  import("./discovery-GUFTFBTL.js"),
2053
- import("./catalog-runtime-VGB3DWXZ.js"),
2057
+ import("./catalog-runtime-P6QHU6XE.js"),
2054
2058
  readPlugins(),
2055
2059
  readSkillReports()
2056
2060
  ]);
@@ -2066,7 +2070,7 @@ async function readRuntimeInfoReport() {
2066
2070
  }
2067
2071
  async function readPluginOperationalReportFeed() {
2068
2072
  const nowMs = Date.now();
2069
- const { getPluginOperationalReports } = await import("./agent-hooks-5BUIXVIX.js");
2073
+ const { getPluginOperationalReports } = await import("./agent-hooks-HGXNYOOD.js");
2070
2074
  return pluginOperationalReportFeedSchema.parse({
2071
2075
  source: "plugins",
2072
2076
  generatedAt: new Date(nowMs).toISOString(),
@@ -3351,6 +3355,53 @@ import { Hono as Hono6 } from "hono";
3351
3355
  // src/chat/tasks/read.ts
3352
3356
  import { and as and14, eq as eq15, or as or3 } from "drizzle-orm";
3353
3357
 
3358
+ // src/chat/tasks/registered.ts
3359
+ async function readRegisteredTasks() {
3360
+ const [{ getPlugins: getPlugins2 }, { pluginCatalogRuntime }] = await Promise.all([
3361
+ import("./agent-hooks-HGXNYOOD.js"),
3362
+ import("./catalog-runtime-P6QHU6XE.js")
3363
+ ]);
3364
+ const runtimePlugins = new Map(
3365
+ getPlugins2().map((plugin) => [plugin.manifest.name, plugin])
3366
+ );
3367
+ const providers = pluginCatalogRuntime.getProviders();
3368
+ const pluginTaskStats = new Map(
3369
+ await Promise.all(
3370
+ providers.map(
3371
+ async (plugin) => [
3372
+ plugin.manifest.name,
3373
+ await readTaskExecutionSummaries(
3374
+ "registered",
3375
+ plugin.manifest.name
3376
+ )
3377
+ ]
3378
+ )
3379
+ )
3380
+ );
3381
+ return providers.flatMap((plugin) => {
3382
+ const taskNames = Object.keys(
3383
+ runtimePlugins.get(plugin.manifest.name)?.tasks ?? {}
3384
+ ).sort((left, right) => left.localeCompare(right));
3385
+ return taskNames.map((name) => {
3386
+ const stats = pluginTaskStats.get(plugin.manifest.name)?.get(name);
3387
+ return {
3388
+ id: `${plugin.manifest.name}:${name}`,
3389
+ name,
3390
+ pluginDisplayName: plugin.manifest.displayName,
3391
+ pluginName: plugin.manifest.name,
3392
+ runsLast7Days: stats?.runsLast7Days ?? 0,
3393
+ totalRuns: stats?.totalRuns ?? 0,
3394
+ ...stats?.lastConversationId ? { lastConversationId: stats.lastConversationId } : {},
3395
+ ...stats?.lastExecutedAtMs ? {
3396
+ lastRunAt: new Date(stats.lastExecutedAtMs).toISOString()
3397
+ } : {}
3398
+ };
3399
+ });
3400
+ }).sort(
3401
+ (left, right) => left.pluginDisplayName.localeCompare(right.pluginDisplayName) || left.name.localeCompare(right.name)
3402
+ );
3403
+ }
3404
+
3354
3405
  // src/chat/scheduled-tasks/personal.ts
3355
3406
  import { z as z3 } from "zod";
3356
3407
  var cursorSchema = z3.object({
@@ -3522,7 +3573,15 @@ async function destinationDetails(destinations) {
3522
3573
  })
3523
3574
  );
3524
3575
  }
3525
- function scheduledTaskSummary(task, ownedByViewer, destination) {
3576
+ function executionSummaryFields(stats) {
3577
+ return {
3578
+ ...stats?.lastConversationId ? { lastConversationId: stats.lastConversationId } : {},
3579
+ ...stats?.lastExecutedAtMs ? { lastRunAt: new Date(stats.lastExecutedAtMs).toISOString() } : {},
3580
+ runsLast7Days: stats?.runsLast7Days ?? 0,
3581
+ totalRuns: stats?.totalRuns ?? 0
3582
+ };
3583
+ }
3584
+ function scheduledTaskSummary(task, ownedByViewer, destination, stats) {
3526
3585
  if (task.status === "deleted") {
3527
3586
  throw new Error("Deleted scheduled tasks cannot enter the Tasks view");
3528
3587
  }
@@ -3539,6 +3598,7 @@ function scheduledTaskSummary(task, ownedByViewer, destination) {
3539
3598
  id: task.id,
3540
3599
  instruction: displayText(task.task.text, "Untitled scheduled task"),
3541
3600
  kind: "scheduled",
3601
+ ...executionSummaryFields(stats),
3542
3602
  ...nextRunAtMs !== void 0 ? { nextRunAt: new Date(nextRunAtMs).toISOString() } : {},
3543
3603
  ownedByViewer,
3544
3604
  schedule: displayText(task.schedule.description, "Schedule unavailable"),
@@ -3605,6 +3665,12 @@ async function readViewerTasks(user) {
3605
3665
  const visible = selected.filter(
3606
3666
  (candidate) => candidate.ownedByViewer || destinations.get(destinationKey(candidate.task.destination))?.visibility === "public"
3607
3667
  );
3668
+ const [registeredTasks, executionDays, scheduledStats, eventStats] = await Promise.all([
3669
+ readRegisteredTasks(),
3670
+ readTaskExecutionDays(),
3671
+ readTaskExecutionSummaries("scheduled", "junior"),
3672
+ readTaskExecutionSummaries("event", "junior")
3673
+ ]);
3608
3674
  const tasks = visible.map((candidate) => {
3609
3675
  const destination = destinations.get(
3610
3676
  destinationKey(candidate.task.destination)
@@ -3622,7 +3688,8 @@ async function readViewerTasks(user) {
3622
3688
  const summary = scheduledTaskSummary(
3623
3689
  candidate.task,
3624
3690
  candidate.ownedByViewer,
3625
- destination
3691
+ destination,
3692
+ scheduledStats.get(candidate.task.id)
3626
3693
  );
3627
3694
  return {
3628
3695
  ...summary,
@@ -3644,6 +3711,7 @@ async function readViewerTasks(user) {
3644
3711
  id: task.id,
3645
3712
  instruction: task.task.text,
3646
3713
  kind: "event",
3714
+ ...executionSummaryFields(eventStats.get(task.id)),
3647
3715
  ownedByViewer: candidate.ownedByViewer,
3648
3716
  resource: `${task.trigger.label} \xB7 ${task.trigger.identifier}`,
3649
3717
  source: task.trigger.namespace,
@@ -3651,6 +3719,8 @@ async function readViewerTasks(user) {
3651
3719
  };
3652
3720
  });
3653
3721
  return {
3722
+ executionDays,
3723
+ registeredTasks,
3654
3724
  tasks,
3655
3725
  truncated: ownedCandidates.length > TASK_LIST_LIMIT || publicCandidates.length > TASK_LIST_LIMIT
3656
3726
  };
package/dist/app.js CHANGED
@@ -50,7 +50,7 @@ import {
50
50
  startConversationWork,
51
51
  startSlackProcessingReaction,
52
52
  stripLeadingBotMention
53
- } from "./chunk-TU7P77FI.js";
53
+ } from "./chunk-FL466XX5.js";
54
54
  import "./chunk-FA6POGLH.js";
55
55
  import {
56
56
  ConversationTurnLifecycleService,
@@ -65,14 +65,17 @@ import {
65
65
  processPluginTask,
66
66
  requireTurnFailureEventId,
67
67
  scheduleSessionCompletedPluginTasks
68
- } from "./chunk-VQA25AL4.js";
68
+ } from "./chunk-52DIKFJV.js";
69
69
  import {
70
70
  GET,
71
71
  conversationVisibilityFromSlackChannelType,
72
72
  resolveSlackChannelTypeFromMessage,
73
73
  resolveSlackConversationContext
74
- } from "./chunk-V365UVCU.js";
74
+ } from "./chunk-AS3I7OIL.js";
75
75
  import "./chunk-4CODA7P5.js";
76
+ import {
77
+ recordTaskExecution
78
+ } from "./chunk-NOA34AJY.js";
76
79
  import "./chunk-UTL3MHPC.js";
77
80
  import {
78
81
  ConversationQueueMessageRejectedError,
@@ -90,7 +93,7 @@ import {
90
93
  import {
91
94
  validatePluginEgressCredentialHooks,
92
95
  validatePluginRegistrations
93
- } from "./chunk-5ZAZHLIW.js";
96
+ } from "./chunk-NYWSCJVW.js";
94
97
  import {
95
98
  defineJuniorPlugins,
96
99
  pluginCatalogConfigFromEnv,
@@ -125,7 +128,7 @@ import {
125
128
  setConfigDefaults,
126
129
  shouldEmitDevAgentTrace,
127
130
  shouldPropagateSandboxEgressTrace
128
- } from "./chunk-T5FPIBU2.js";
131
+ } from "./chunk-NF2TNZPD.js";
129
132
  import "./chunk-DIB4GX3G.js";
130
133
  import {
131
134
  RetryableDeliveryError,
@@ -136,7 +139,7 @@ import {
136
139
  formatProviderLabel,
137
140
  postSlackMessage,
138
141
  startOAuthFlow
139
- } from "./chunk-HTGXUNEC.js";
142
+ } from "./chunk-VGXJMECA.js";
140
143
  import {
141
144
  ConversationTurnBoundaryError,
142
145
  CooperativeTurnYieldError,
@@ -192,20 +195,20 @@ import {
192
195
  trimTrailingAssistantMessages,
193
196
  updateConversationStats,
194
197
  upsertConversationMessage
195
- } from "./chunk-ECUILEUX.js";
198
+ } from "./chunk-7GKQ7UIO.js";
196
199
  import "./chunk-EPBBYMNE.js";
197
200
  import {
198
201
  getSandboxResourceConfig,
199
202
  setSandboxResourceConfig
200
- } from "./chunk-TBVS7GBE.js";
203
+ } from "./chunk-YNLQQ622.js";
201
204
  import {
202
205
  createSchedulerSqlStore,
203
206
  findMatchingEventTasks
204
- } from "./chunk-XTQGVNM3.js";
207
+ } from "./chunk-KWGJG4HO.js";
205
208
  import {
206
209
  parseSlackThreadId
207
- } from "./chunk-AH5HTUYX.js";
208
- import "./chunk-HX236W2U.js";
210
+ } from "./chunk-MFERLE3G.js";
211
+ import "./chunk-CDQ4YIZM.js";
209
212
  import "./chunk-PDO5BLNM.js";
210
213
  import "./chunk-UIE3R5XU.js";
211
214
  import {
@@ -232,7 +235,7 @@ import {
232
235
  verifyEventTaskCredentialSubject,
233
236
  verifyScheduledTaskCredentialSubject,
234
237
  verifySlackDirectCredentialSubject
235
- } from "./chunk-WHEMUEXT.js";
238
+ } from "./chunk-TR6UEEYD.js";
236
239
  import {
237
240
  contextProvenance,
238
241
  createSlackDestination,
@@ -243,16 +246,16 @@ import {
243
246
  instructionProvenanceFor,
244
247
  requireSlackDestination,
245
248
  withConversationEventLock
246
- } from "./chunk-LNYNTR27.js";
249
+ } from "./chunk-VPYKNCTN.js";
247
250
  import {
248
251
  juniorConversationEvents,
249
252
  juniorConversations
250
- } from "./chunk-QWGZ273D.js";
253
+ } from "./chunk-QLEKAO7O.js";
251
254
  import {
252
255
  acquireActiveLock,
253
256
  getStateAdapter,
254
257
  sleep
255
- } from "./chunk-TLN54TOQ.js";
258
+ } from "./chunk-FDNAUM7X.js";
256
259
  import {
257
260
  STANDARD_MODEL_PROFILE,
258
261
  botConfig,
@@ -270,16 +273,16 @@ import {
270
273
  modelIdForProfile,
271
274
  setSlackReactionConfig,
272
275
  standardModelId
273
- } from "./chunk-LDRO4OQ4.js";
276
+ } from "./chunk-XG5PHKPM.js";
274
277
  import {
275
278
  juniorDestinations
276
279
  } from "./chunk-VFUK3X5B.js";
277
- import "./chunk-VL7OYSHD.js";
278
- import "./chunk-IVTHTAVK.js";
280
+ import "./chunk-LKK4XMUV.js";
281
+ import "./chunk-S6DMTEOM.js";
279
282
  import {
280
283
  pluginCatalogRuntime
281
- } from "./chunk-JLN4XSPR.js";
282
- import "./chunk-HJ4KDO4N.js";
284
+ } from "./chunk-VEGF62FV.js";
285
+ import "./chunk-VP6NCPRS.js";
283
286
  import {
284
287
  credentialSubjectSchema
285
288
  } from "./chunk-77VDLF3Z.js";
@@ -311,7 +314,7 @@ import {
311
314
  withContext,
312
315
  withLogContext,
313
316
  withSpan
314
- } from "./chunk-EJRJWBKG.js";
317
+ } from "./chunk-6T3AYZT7.js";
315
318
  import {
316
319
  continueTrace
317
320
  } from "./chunk-6GWA276C.js";
@@ -319,10 +322,10 @@ import "./chunk-OOUNJNMR.js";
319
322
  import "./chunk-H4HBKISO.js";
320
323
  import {
321
324
  JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE
322
- } from "./chunk-FX6BLEDP.js";
325
+ } from "./chunk-U3ZI7CCW.js";
323
326
  import {
324
327
  JUNIOR_VERSION
325
- } from "./chunk-IKO5LFIU.js";
328
+ } from "./chunk-GSP5SMZJ.js";
326
329
  import "./chunk-MLKGABMK.js";
327
330
 
328
331
  // src/app.ts
@@ -697,7 +700,8 @@ async function markDispatchBlocked(id, errorMessage, resultMessageTs) {
697
700
  );
698
701
  }
699
702
  async function markDispatchCompleted(id, resultMessageTs) {
700
- return await transitionDispatch(
703
+ const previous = await getDispatchRecord(id);
704
+ const next = await transitionDispatch(
701
705
  id,
702
706
  (record) => isTerminalDispatchStatus(record.status) ? record : {
703
707
  ...record,
@@ -706,6 +710,17 @@ async function markDispatchCompleted(id, resultMessageTs) {
706
710
  status: "completed"
707
711
  }
708
712
  );
713
+ if (next?.status === "completed" && previous?.status !== "completed" && next.plugin === "junior") {
714
+ const eventTaskId = next.metadata?.eventTaskId;
715
+ if (eventTaskId) {
716
+ await recordTaskExecution("event", eventTaskId, {
717
+ conversationId: getDispatchConversationId(next),
718
+ executionId: next.id,
719
+ nowMs: next.updatedAtMs
720
+ });
721
+ }
722
+ }
723
+ return next;
709
724
  }
710
725
  async function markDispatchFailed(id, errorMessage, resultMessageTs) {
711
726
  return await transitionDispatch(
@@ -1583,6 +1598,14 @@ async function applyDispatchResult(args) {
1583
1598
  run: args.run,
1584
1599
  status: "completed"
1585
1600
  });
1601
+ const dispatchId = args.run.dispatchId;
1602
+ if (dispatchId) {
1603
+ await recordTaskExecution("scheduled", args.run.taskId, {
1604
+ conversationId: getDispatchConversationId({ id: dispatchId }),
1605
+ executionId: args.run.id,
1606
+ nowMs: args.nowMs
1607
+ });
1608
+ }
1586
1609
  return true;
1587
1610
  }
1588
1611
  if (args.dispatch.status === "blocked") {
@@ -9355,6 +9378,7 @@ async function ingestEventTasks(input, options) {
9355
9378
  destination: task.destination,
9356
9379
  destinationVisibility: task.destinationVisibility,
9357
9380
  input: eventInput(task, event),
9381
+ metadata: { eventTaskId: task.id },
9358
9382
  replyAttribution: replyAttribution2(task, event),
9359
9383
  source: createSlackSource3({
9360
9384
  teamId: task.destination.teamId,
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-JLN4XSPR.js";
4
- import "./chunk-HJ4KDO4N.js";
3
+ } from "./chunk-VEGF62FV.js";
4
+ import "./chunk-VP6NCPRS.js";
5
5
  import "./chunk-77VDLF3Z.js";
6
6
  import "./chunk-HZF5P5UN.js";
7
7
  import "./chunk-F3B2YJ76.js";
8
- import "./chunk-EJRJWBKG.js";
8
+ import "./chunk-6T3AYZT7.js";
9
9
  import "./chunk-6GWA276C.js";
10
10
  import "./chunk-OOUNJNMR.js";
11
11
  import "./chunk-H4HBKISO.js";
12
- import "./chunk-FX6BLEDP.js";
13
- import "./chunk-IKO5LFIU.js";
12
+ import "./chunk-U3ZI7CCW.js";
13
+ import "./chunk-GSP5SMZJ.js";
14
14
  import "./chunk-MLKGABMK.js";
15
15
  export {
16
16
  pluginCatalogRuntime