@sentry/junior 0.137.0 → 0.139.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 (103) hide show
  1. package/dist/{agent-hooks-MZOKEP3J.js → agent-hooks-MJXMD7JP.js} +11 -9
  2. package/dist/api/schema/task.d.ts +100 -1
  3. package/dist/api/schema.d.ts +2 -2
  4. package/dist/api/schema.js +9 -1
  5. package/dist/api.js +202 -55
  6. package/dist/app.d.ts +7 -0
  7. package/dist/app.js +601 -1356
  8. package/dist/{catalog-runtime-MD66YLFV.js → catalog-runtime-GCCFYPIK.js} +6 -6
  9. package/dist/chat/agent/request.d.ts +44 -4
  10. package/dist/chat/agent-dispatch/heartbeat.d.ts +5 -0
  11. package/dist/chat/agent-dispatch/types.d.ts +1 -1
  12. package/dist/chat/agent-invocations/errors.d.ts +8 -0
  13. package/dist/chat/agent-invocations/spawn.d.ts +12 -0
  14. package/dist/chat/agent-invocations/store.d.ts +44 -0
  15. package/dist/chat/agent-invocations/types.d.ts +449 -0
  16. package/dist/chat/agent-invocations/work.d.ts +31 -0
  17. package/dist/chat/config.d.ts +1 -0
  18. package/dist/chat/conversations/sql/store.d.ts +8 -0
  19. package/dist/chat/conversations/store.d.ts +7 -0
  20. package/dist/chat/credentials/context.d.ts +14 -0
  21. package/dist/chat/experimental.d.ts +16 -0
  22. package/dist/chat/resource-events/actor.d.ts +23 -0
  23. package/dist/chat/runtime/agent-runner.d.ts +2 -1
  24. package/dist/chat/services/auth-pause.d.ts +0 -1
  25. package/dist/chat/services/mcp-auth-orchestration.d.ts +3 -2
  26. package/dist/chat/services/plugin-auth-orchestration.d.ts +3 -2
  27. package/dist/chat/state/turn-session.d.ts +1 -5
  28. package/dist/chat/task-execution/state.d.ts +23 -11
  29. package/dist/chat/task-execution/store.d.ts +20 -11
  30. package/dist/chat/task-execution/worker.d.ts +2 -2
  31. package/dist/chat/tasks/execution-stats.d.ts +34 -3
  32. package/dist/chat/tasks/read.d.ts +3 -1
  33. package/dist/chat/tools/runtime/spawn-agent.d.ts +31 -0
  34. package/dist/chat/tools/types.d.ts +2 -0
  35. package/dist/{chunk-T6Z5S6PQ.js → chunk-2ECYPYKP.js} +1 -1
  36. package/dist/chunk-3T2JAGRH.js +115 -0
  37. package/dist/chunk-3Y47VMHV.js +6 -0
  38. package/dist/chunk-4V4QIYJH.js +41 -0
  39. package/dist/{chunk-SYCX4DOK.js → chunk-5GSZWRE2.js} +434 -65
  40. package/dist/chunk-5IDFPCON.js +46 -0
  41. package/dist/{chunk-36EG34YI.js → chunk-6OHTDR4F.js} +1 -1
  42. package/dist/chunk-6SU2DT27.js +441 -0
  43. package/dist/{chunk-UG6ZYPBI.js → chunk-75I3UBIL.js} +73 -60
  44. package/dist/chunk-AEQISMMU.js +711 -0
  45. package/dist/{chunk-5PNJMOY5.js → chunk-C2N6MNO4.js} +9 -2
  46. package/dist/{chunk-BZAMASJP.js → chunk-CXH25EL4.js} +2 -2
  47. package/dist/{chunk-K2NCQJKH.js → chunk-DW4PMHNW.js} +3 -3
  48. package/dist/chunk-EM225ITJ.js +56 -0
  49. package/dist/{chunk-UOXATPSI.js → chunk-G52UXKGO.js} +7 -5
  50. package/dist/chunk-GI52BW74.js +207 -0
  51. package/dist/{chunk-3Q342EJJ.js → chunk-GWQSZT4C.js} +2 -2
  52. package/dist/{chunk-EPBBYMNE.js → chunk-HUO3UTAQ.js} +1 -1
  53. package/dist/{chunk-WPPXIAFB.js → chunk-IIESAYDL.js} +17 -434
  54. package/dist/chunk-IUFM5JWV.js +24 -0
  55. package/dist/{chunk-UZQ4VY3M.js → chunk-J3S57AXY.js} +1 -1
  56. package/dist/{chunk-DQXAAVTR.js → chunk-J6EJQCHY.js} +46 -1471
  57. package/dist/{chunk-6ZK6FZIV.js → chunk-KCBZSJRU.js} +6 -27
  58. package/dist/chunk-MQ5RYATN.js +1523 -0
  59. package/dist/{chunk-5G34IEK2.js → chunk-MXTVUV3I.js} +2 -56
  60. package/dist/{chunk-YRPC6MJY.js → chunk-MXVD2BDS.js} +1 -1
  61. package/dist/{chunk-POBSY47Q.js → chunk-PJW6U46K.js} +337 -306
  62. package/dist/chunk-Q6QZTTLS.js +55 -0
  63. package/dist/{chunk-ZFS67WIR.js → chunk-QTBKPZDA.js} +57 -6
  64. package/dist/chunk-R776HKPK.js +81 -0
  65. package/dist/{chunk-77VDLF3Z.js → chunk-RUIXF3YQ.js} +10 -0
  66. package/dist/chunk-U27DSXKB.js +714 -0
  67. package/dist/{chunk-XZ7NPXAB.js → chunk-U7CMWQ7Z.js} +1 -1
  68. package/dist/{chunk-RB4NJKEX.js → chunk-UDBUS533.js} +125 -51
  69. package/dist/chunk-WQRX57EA.js +668 -0
  70. package/dist/chunk-WZH4JV7R.js +320 -0
  71. package/dist/{chunk-HCIVH3JS.js → chunk-YCTDA7BD.js} +28 -0
  72. package/dist/{chunk-YNFERGKP.js → chunk-YGZ2OLXL.js} +1 -1
  73. package/dist/{chunk-EWDSB24B.js → chunk-ZQCGQMF2.js} +16 -776
  74. package/dist/{chunk-KJ4HGRHN.js → chunk-ZYQSPQYR.js} +515 -601
  75. package/dist/cli/chat.js +68 -29
  76. package/dist/cli/check.js +7 -7
  77. package/dist/cli/plugins.js +15 -13
  78. package/dist/cli/snapshot-create.js +11 -10
  79. package/dist/cli/upgrade.js +8 -8
  80. package/dist/conversation-work-KATFHLG3.js +56 -0
  81. package/dist/db/schema/agent-invocations.d.ts +544 -0
  82. package/dist/db/schema/task-executions.d.ts +23 -2
  83. package/dist/db/schema.d.ts +563 -2
  84. package/dist/{db-66E7VDNC.js → db-UXPPGHDF.js} +7 -7
  85. package/dist/experimental-HH6OM6UH.js +13 -0
  86. package/dist/instrumentation.js +4 -4
  87. package/dist/nitro.js +4 -3
  88. package/dist/{oauth-callback-server-7QPD4Q7P.js → oauth-callback-server-4ZYMD5UA.js} +28 -19
  89. package/dist/{runner-L2BKJKOD.js → runner-MZSEONRZ.js} +32 -18
  90. package/dist/{sandbox-egress-signals-A5HWIQH4.js → sandbox-egress-signals-EKPAVWQL.js} +2 -2
  91. package/dist/{skills-HOQ2NSPW.js → skills-IMVPXSQ7.js} +7 -7
  92. package/dist/spawn-S5LSVOCE.js +38 -0
  93. package/dist/{validation-ENHI7S2C.js → validation-ZKCY2BVR.js} +7 -7
  94. package/dist/version.js +1 -1
  95. package/dist/work-GG3XDYRX.js +46 -0
  96. package/dist/worker-23AUELCJ.js +24 -0
  97. package/migrations/0021_first_warhawk.sql +35 -0
  98. package/migrations/0022_task_execution_status.sql +3 -0
  99. package/migrations/meta/0021_snapshot.json +2176 -0
  100. package/migrations/meta/0022_snapshot.json +2186 -0
  101. package/migrations/meta/_journal.json +15 -1
  102. package/package.json +4 -4
  103. package/dist/chunk-6QW2RRQT.js +0 -233
@@ -11,19 +11,21 @@ import {
11
11
  getPlugins,
12
12
  setPlugins,
13
13
  validatePlugins
14
- } from "./chunk-WPPXIAFB.js";
15
- import "./chunk-ZFS67WIR.js";
16
- import "./chunk-RB4NJKEX.js";
17
- import "./chunk-5G34IEK2.js";
18
- import "./chunk-UG6ZYPBI.js";
14
+ } from "./chunk-IIESAYDL.js";
15
+ import "./chunk-6SU2DT27.js";
16
+ import "./chunk-QTBKPZDA.js";
17
+ import "./chunk-UDBUS533.js";
18
+ import "./chunk-EM225ITJ.js";
19
+ import "./chunk-MXTVUV3I.js";
20
+ import "./chunk-75I3UBIL.js";
19
21
  import "./chunk-VFUK3X5B.js";
20
- import "./chunk-YNFERGKP.js";
22
+ import "./chunk-YGZ2OLXL.js";
21
23
  import "./chunk-HZF5P5UN.js";
22
24
  import "./chunk-F3B2YJ76.js";
23
- import "./chunk-T6Z5S6PQ.js";
25
+ import "./chunk-2ECYPYKP.js";
24
26
  import "./chunk-6GWA276C.js";
25
- import "./chunk-5PNJMOY5.js";
26
- import "./chunk-XZ7NPXAB.js";
27
+ import "./chunk-C2N6MNO4.js";
28
+ import "./chunk-U7CMWQ7Z.js";
27
29
  import "./chunk-MLKGABMK.js";
28
30
  export {
29
31
  PluginHookDeniedError,
@@ -106,7 +106,7 @@ export declare const taskSummarySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
106
106
  source: z.ZodString;
107
107
  triggerAvailable: z.ZodBoolean;
108
108
  }, z.core.$strict>], "kind">;
109
- /** One UTC day of successful task executions stacked by task type. */
109
+ /** One UTC day of completed task executions stacked by task type. */
110
110
  export declare const taskExecutionDaySchema: z.ZodObject<{
111
111
  date: z.ZodString;
112
112
  event: z.ZodNumber;
@@ -180,6 +180,105 @@ export declare const taskParamsSchema: z.ZodObject<{
180
180
  scheduled: "scheduled";
181
181
  }>;
182
182
  }, z.core.$strict>;
183
+ export declare const taskExecutionStatusSchema: z.ZodEnum<{
184
+ completed: "completed";
185
+ failed: "failed";
186
+ blocked: "blocked";
187
+ }>;
188
+ export declare const taskExecutionSchema: z.ZodObject<{
189
+ conversationId: z.ZodOptional<z.ZodString>;
190
+ executedAt: z.ZodString;
191
+ executionId: z.ZodString;
192
+ status: z.ZodEnum<{
193
+ completed: "completed";
194
+ failed: "failed";
195
+ blocked: "blocked";
196
+ }>;
197
+ title: z.ZodOptional<z.ZodString>;
198
+ }, z.core.$strict>;
199
+ /** One UTC day of terminal executions for a single task, stacked by status. */
200
+ export declare const taskExecutionStatusDaySchema: z.ZodObject<{
201
+ blocked: z.ZodNumber;
202
+ completed: z.ZodNumber;
203
+ date: z.ZodString;
204
+ failed: z.ZodNumber;
205
+ }, z.core.$strict>;
206
+ export declare const taskExecutionListSchema: z.ZodObject<{
207
+ executionDays: z.ZodArray<z.ZodObject<{
208
+ blocked: z.ZodNumber;
209
+ completed: z.ZodNumber;
210
+ date: z.ZodString;
211
+ failed: z.ZodNumber;
212
+ }, z.core.$strict>>;
213
+ executions: z.ZodArray<z.ZodObject<{
214
+ conversationId: z.ZodOptional<z.ZodString>;
215
+ executedAt: z.ZodString;
216
+ executionId: z.ZodString;
217
+ status: z.ZodEnum<{
218
+ completed: "completed";
219
+ failed: "failed";
220
+ blocked: "blocked";
221
+ }>;
222
+ title: z.ZodOptional<z.ZodString>;
223
+ }, z.core.$strict>>;
224
+ task: z.ZodDiscriminatedUnion<[z.ZodObject<{
225
+ createdAt: z.ZodString;
226
+ createdBy: z.ZodString;
227
+ createdByEmail: z.ZodOptional<z.ZodString>;
228
+ destination: z.ZodObject<{
229
+ channelId: z.ZodString;
230
+ label: z.ZodString;
231
+ teamId: z.ZodString;
232
+ visibility: z.ZodEnum<{
233
+ public: "public";
234
+ private: "private";
235
+ }>;
236
+ }, z.core.$strict>;
237
+ id: z.ZodString;
238
+ instruction: z.ZodString;
239
+ lastConversationId: z.ZodOptional<z.ZodString>;
240
+ lastRunAt: z.ZodOptional<z.ZodString>;
241
+ ownedByViewer: z.ZodBoolean;
242
+ runsLast7Days: z.ZodNumber;
243
+ totalRuns: z.ZodNumber;
244
+ kind: z.ZodLiteral<"scheduled">;
245
+ nextRunAt: z.ZodOptional<z.ZodString>;
246
+ schedule: z.ZodString;
247
+ status: z.ZodEnum<{
248
+ blocked: "blocked";
249
+ active: "active";
250
+ }>;
251
+ }, z.core.$strict>, z.ZodObject<{
252
+ createdAt: z.ZodString;
253
+ createdBy: z.ZodString;
254
+ createdByEmail: z.ZodOptional<z.ZodString>;
255
+ destination: z.ZodObject<{
256
+ channelId: z.ZodString;
257
+ label: z.ZodString;
258
+ teamId: z.ZodString;
259
+ visibility: z.ZodEnum<{
260
+ public: "public";
261
+ private: "private";
262
+ }>;
263
+ }, z.core.$strict>;
264
+ id: z.ZodString;
265
+ instruction: z.ZodString;
266
+ lastConversationId: z.ZodOptional<z.ZodString>;
267
+ lastRunAt: z.ZodOptional<z.ZodString>;
268
+ ownedByViewer: z.ZodBoolean;
269
+ runsLast7Days: z.ZodNumber;
270
+ totalRuns: z.ZodNumber;
271
+ events: z.ZodArray<z.ZodString>;
272
+ kind: z.ZodLiteral<"event">;
273
+ resource: z.ZodString;
274
+ source: z.ZodString;
275
+ triggerAvailable: z.ZodBoolean;
276
+ }, z.core.$strict>], "kind">;
277
+ truncated: z.ZodBoolean;
278
+ }, z.core.$strict>;
183
279
  export type TaskExecutionDay = z.output<typeof taskExecutionDaySchema>;
280
+ export type TaskExecutionStatusDay = z.output<typeof taskExecutionStatusDaySchema>;
281
+ export type TaskExecution = z.output<typeof taskExecutionSchema>;
282
+ export type TaskExecutionList = z.output<typeof taskExecutionListSchema>;
184
283
  export type TaskSummary = z.output<typeof taskSummarySchema>;
185
284
  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 { TaskExecutionDay, TaskList, TaskSummary } from "./schema/task";
13
+ export { eventTaskSummarySchema, scheduledTaskSummarySchema, taskExecutionListSchema, taskExecutionSchema, taskExecutionStatusDaySchema, taskExecutionStatusSchema, taskListSchema, taskParamsSchema, taskSummarySchema, } from "./schema/task";
14
+ export type { TaskExecution, TaskExecutionDay, TaskExecutionList, TaskExecutionStatusDay, 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";
@@ -34,10 +34,14 @@ import {
34
34
  scheduledTaskSummarySchema,
35
35
  statSchema,
36
36
  statsReportSchema,
37
+ taskExecutionListSchema,
38
+ taskExecutionSchema,
39
+ taskExecutionStatusDaySchema,
40
+ taskExecutionStatusSchema,
37
41
  taskListSchema,
38
42
  taskParamsSchema,
39
43
  taskSummarySchema
40
- } from "../chunk-HCIVH3JS.js";
44
+ } from "../chunk-YCTDA7BD.js";
41
45
  import {
42
46
  healthReportSchema,
43
47
  pluginOperationalReportFeedSchema,
@@ -99,6 +103,10 @@ export {
99
103
  skillReportsSchema,
100
104
  statSchema,
101
105
  statsReportSchema,
106
+ taskExecutionListSchema,
107
+ taskExecutionSchema,
108
+ taskExecutionStatusDaySchema,
109
+ taskExecutionStatusSchema,
102
110
  taskListSchema,
103
111
  taskParamsSchema,
104
112
  taskSummarySchema
package/dist/api.js CHANGED
@@ -25,19 +25,24 @@ import {
25
25
  personalTokenParamsSchema,
26
26
  revokePersonalTokenResponseSchema,
27
27
  statsReportSchema,
28
+ taskExecutionListSchema,
28
29
  taskListSchema,
29
30
  taskParamsSchema
30
- } from "./chunk-HCIVH3JS.js";
31
+ } from "./chunk-YCTDA7BD.js";
31
32
  import {
32
33
  formatSlackConversationRedactedLabel,
33
34
  readHealthReport,
34
- readTaskExecutionDays,
35
- readTaskExecutionSummaries,
36
35
  resolveSlackConversationContextFromThreadId
37
- } from "./chunk-6QW2RRQT.js";
36
+ } from "./chunk-3T2JAGRH.js";
38
37
  import {
39
38
  buildSentryConversationUrl
40
39
  } from "./chunk-4CODA7P5.js";
40
+ import {
41
+ readTaskExecutionDays,
42
+ readTaskExecutionStatusDays,
43
+ readTaskExecutionSummaries,
44
+ readTaskExecutions
45
+ } from "./chunk-GI52BW74.js";
41
46
  import {
42
47
  healthReportSchema,
43
48
  pluginOperationalReportFeedSchema,
@@ -56,10 +61,10 @@ import {
56
61
  listPublicEventTasksForTeams,
57
62
  listPublicScheduledTasksForTeams,
58
63
  readStats
59
- } from "./chunk-K2NCQJKH.js";
64
+ } from "./chunk-DW4PMHNW.js";
60
65
  import {
61
66
  parseSlackThreadId
62
- } from "./chunk-YRPC6MJY.js";
67
+ } from "./chunk-MXVD2BDS.js";
63
68
  import {
64
69
  agentTurnUsageSchema,
65
70
  hasAgentTurnUsage,
@@ -69,44 +74,47 @@ import "./chunk-PDO5BLNM.js";
69
74
  import {
70
75
  createPluginLogger,
71
76
  getPlugins,
72
- getSlackClient,
73
77
  listConversationAnnotations,
74
78
  renderPluginConversationEvent,
75
- resolveViewerUser,
79
+ resolveViewerUser
80
+ } from "./chunk-IIESAYDL.js";
81
+ import {
82
+ getSlackClient,
76
83
  withSlackRetries
77
- } from "./chunk-WPPXIAFB.js";
84
+ } from "./chunk-6SU2DT27.js";
78
85
  import {
79
86
  decodeStoredConversationEvent,
80
87
  getDb,
81
88
  getSqlExecutor,
82
89
  locationFromRow,
83
90
  parseSessionSource
84
- } from "./chunk-ZFS67WIR.js";
91
+ } from "./chunk-QTBKPZDA.js";
85
92
  import {
86
93
  juniorApiTokens,
87
94
  juniorConversationEvents,
88
95
  juniorConversations,
89
96
  juniorIdentities,
90
97
  juniorUsers
91
- } from "./chunk-RB4NJKEX.js";
92
- import "./chunk-5G34IEK2.js";
93
- import "./chunk-UG6ZYPBI.js";
98
+ } from "./chunk-UDBUS533.js";
99
+ import "./chunk-EM225ITJ.js";
100
+ import "./chunk-MXTVUV3I.js";
101
+ import "./chunk-75I3UBIL.js";
94
102
  import {
95
103
  juniorDestinations
96
104
  } from "./chunk-VFUK3X5B.js";
97
105
  import {
98
106
  canExposeConversationPayload
99
- } from "./chunk-YNFERGKP.js";
107
+ } from "./chunk-YGZ2OLXL.js";
100
108
  import "./chunk-HZF5P5UN.js";
101
109
  import {
102
110
  parseSlackChannelId,
103
111
  parseSlackMessageTs,
104
112
  parseSlackTeamId
105
113
  } from "./chunk-F3B2YJ76.js";
106
- import "./chunk-T6Z5S6PQ.js";
114
+ import "./chunk-2ECYPYKP.js";
107
115
  import "./chunk-6GWA276C.js";
108
- import "./chunk-5PNJMOY5.js";
109
- import "./chunk-XZ7NPXAB.js";
116
+ import "./chunk-C2N6MNO4.js";
117
+ import "./chunk-U7CMWQ7Z.js";
110
118
  import "./chunk-MLKGABMK.js";
111
119
 
112
120
  // src/api.ts
@@ -2167,7 +2175,7 @@ function readDescriptionText(home) {
2167
2175
  }
2168
2176
  }
2169
2177
  async function readSkillReports() {
2170
- const { discoverSkills } = await import("./skills-HOQ2NSPW.js");
2178
+ const { discoverSkills } = await import("./skills-IMVPXSQ7.js");
2171
2179
  const skills = await discoverSkills();
2172
2180
  return skillReportsSchema.parse(
2173
2181
  skills.map((skill) => ({
@@ -2177,7 +2185,7 @@ async function readSkillReports() {
2177
2185
  );
2178
2186
  }
2179
2187
  async function readPlugins() {
2180
- const { pluginCatalogRuntime } = await import("./catalog-runtime-MD66YLFV.js");
2188
+ const { pluginCatalogRuntime } = await import("./catalog-runtime-GCCFYPIK.js");
2181
2189
  return pluginsSchema.parse(
2182
2190
  pluginCatalogRuntime.getProviders().map((plugin) => ({
2183
2191
  configKeys: plugin.manifest.configKeys ?? [],
@@ -2190,7 +2198,7 @@ async function readPlugins() {
2190
2198
  async function readRuntimeInfoReport() {
2191
2199
  const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
2192
2200
  import("./discovery-GUFTFBTL.js"),
2193
- import("./catalog-runtime-MD66YLFV.js"),
2201
+ import("./catalog-runtime-GCCFYPIK.js"),
2194
2202
  readPlugins(),
2195
2203
  readSkillReports()
2196
2204
  ]);
@@ -2206,7 +2214,7 @@ async function readRuntimeInfoReport() {
2206
2214
  }
2207
2215
  async function readPluginOperationalReportFeed() {
2208
2216
  const nowMs = Date.now();
2209
- const { getPluginOperationalReports } = await import("./agent-hooks-MZOKEP3J.js");
2217
+ const { getPluginOperationalReports } = await import("./agent-hooks-MJXMD7JP.js");
2210
2218
  return pluginOperationalReportFeedSchema.parse({
2211
2219
  source: "plugins",
2212
2220
  generatedAt: new Date(nowMs).toISOString(),
@@ -3576,6 +3584,7 @@ function createViewerScheduledTasks(store, user) {
3576
3584
  // src/chat/tasks/read.ts
3577
3585
  var TASK_LIST_LIMIT = 100;
3578
3586
  var TASK_FETCH_LIMIT = TASK_LIST_LIMIT + 1;
3587
+ var TASK_EXECUTION_LIST_LIMIT = 100;
3579
3588
  function creatorLabel(creator) {
3580
3589
  return creator.fullName?.trim() || (creator.userName?.trim() ? `@${creator.userName.trim()}` : "") || creator.slackUserId;
3581
3590
  }
@@ -3670,7 +3679,7 @@ function executionSummaryFields(stats) {
3670
3679
  totalRuns: stats?.totalRuns ?? 0
3671
3680
  };
3672
3681
  }
3673
- function scheduledTaskSummary(task, ownedByViewer, destination, stats) {
3682
+ function scheduledTaskSummary(task, ownedByViewer, destination, stats, createdByEmail) {
3674
3683
  if (task.status === "deleted") {
3675
3684
  throw new Error("Deleted scheduled tasks cannot enter the Tasks view");
3676
3685
  }
@@ -3678,6 +3687,7 @@ function scheduledTaskSummary(task, ownedByViewer, destination, stats) {
3678
3687
  return {
3679
3688
  createdAt: new Date(task.createdAtMs).toISOString(),
3680
3689
  createdBy: creatorLabel(task.createdBy),
3690
+ ...createdByEmail ? { createdByEmail } : {},
3681
3691
  destination: {
3682
3692
  channelId: task.destination.channelId,
3683
3693
  label: destination.label,
@@ -3694,15 +3704,111 @@ function scheduledTaskSummary(task, ownedByViewer, destination, stats) {
3694
3704
  status: task.status
3695
3705
  };
3696
3706
  }
3697
- async function readViewerTasks(user) {
3698
- const db = getDb();
3699
- const schedulerStore = createSchedulerSqlStore(db);
3700
- const identityIds = new Set(user.identities.map((identity) => identity.id));
3701
- const teamIds = [
3707
+ function eventTaskSummary(task, ownedByViewer, destination, stats, createdByEmail) {
3708
+ return {
3709
+ createdAt: new Date(task.createdAtMs).toISOString(),
3710
+ createdBy: creatorLabel(task.createdBy),
3711
+ ...createdByEmail ? { createdByEmail } : {},
3712
+ destination: {
3713
+ channelId: task.destination.channelId,
3714
+ label: destination.label,
3715
+ teamId: task.destination.teamId,
3716
+ visibility: destination.visibility
3717
+ },
3718
+ events: task.trigger.events,
3719
+ id: task.id,
3720
+ instruction: task.task.text,
3721
+ kind: "event",
3722
+ ...executionSummaryFields(stats),
3723
+ ownedByViewer,
3724
+ resource: `${task.trigger.label} \xB7 ${task.trigger.identifier}`,
3725
+ source: task.trigger.namespace,
3726
+ triggerAvailable: eventTaskTriggerAvailable(
3727
+ task,
3728
+ getResourceEventCatalog()
3729
+ )
3730
+ };
3731
+ }
3732
+ function viewerTeamIds(user) {
3733
+ return [
3702
3734
  ...new Set(
3703
3735
  user.identities.filter((identity) => identity.provider === "slack").map((identity) => identity.providerTenantId).filter((teamId) => Boolean(teamId))
3704
3736
  )
3705
3737
  ];
3738
+ }
3739
+ async function resolveViewerTaskCandidate(user, kind, id) {
3740
+ const db = getDb();
3741
+ const identityIds = new Set(user.identities.map((identity) => identity.id));
3742
+ const teamIds = viewerTeamIds(user);
3743
+ if (kind === "scheduled") {
3744
+ const task2 = await createSchedulerSqlStore(db).getTask(id);
3745
+ if (!task2 || task2.status === "deleted") return void 0;
3746
+ const ownedByViewer2 = identityIds.has(task2.creatorIdentityId);
3747
+ const destinations2 = await destinationDetails([task2.destination]);
3748
+ const destination2 = destinations2.get(destinationKey(task2.destination));
3749
+ const publicToViewer2 = teamIds.includes(task2.destination.teamId) && destination2?.visibility === "public";
3750
+ if (!ownedByViewer2 && !publicToViewer2) return void 0;
3751
+ return {
3752
+ kind: "scheduled",
3753
+ ownedByViewer: ownedByViewer2,
3754
+ publicToViewer: publicToViewer2,
3755
+ task: task2
3756
+ };
3757
+ }
3758
+ const task = await getEventTask(db, id);
3759
+ if (!task) return void 0;
3760
+ const ownedByViewer = eventTaskBelongsToUser(task, user);
3761
+ const destinations = await destinationDetails([task.destination]);
3762
+ const destination = destinations.get(destinationKey(task.destination));
3763
+ const publicToViewer = teamIds.includes(task.destination.teamId) && destination?.visibility === "public";
3764
+ if (!ownedByViewer && !publicToViewer) return void 0;
3765
+ return {
3766
+ kind: "event",
3767
+ ownedByViewer,
3768
+ publicToViewer,
3769
+ task
3770
+ };
3771
+ }
3772
+ async function taskSummaryForCandidate(candidate) {
3773
+ const [destinations, creatorEmails, stats] = await Promise.all([
3774
+ destinationDetails([candidate.task.destination]),
3775
+ creatorProfileEmails([candidate]),
3776
+ readTaskExecutionSummaries(candidate.kind, "junior")
3777
+ ]);
3778
+ const destination = destinations.get(
3779
+ destinationKey(candidate.task.destination)
3780
+ ) ?? {
3781
+ label: `Channel ${candidate.task.destination.channelId}`,
3782
+ visibility: "private"
3783
+ };
3784
+ const createdByEmail = creatorEmails.get(
3785
+ creatorKey(
3786
+ candidate.task.destination.teamId,
3787
+ candidate.task.createdBy.slackUserId
3788
+ )
3789
+ );
3790
+ if (candidate.kind === "scheduled") {
3791
+ return scheduledTaskSummary(
3792
+ candidate.task,
3793
+ candidate.ownedByViewer,
3794
+ destination,
3795
+ stats.get(candidate.task.id),
3796
+ createdByEmail
3797
+ );
3798
+ }
3799
+ return eventTaskSummary(
3800
+ candidate.task,
3801
+ candidate.ownedByViewer,
3802
+ destination,
3803
+ stats.get(candidate.task.id),
3804
+ createdByEmail
3805
+ );
3806
+ }
3807
+ async function readViewerTasks(user) {
3808
+ const db = getDb();
3809
+ const schedulerStore = createSchedulerSqlStore(db);
3810
+ const identityIds = new Set(user.identities.map((identity) => identity.id));
3811
+ const teamIds = viewerTeamIds(user);
3706
3812
  const [scheduledPage, publicScheduled, eventTasks, publicEventTasks] = await Promise.all([
3707
3813
  createViewerScheduledTasks(schedulerStore, user).list({
3708
3814
  limit: TASK_FETCH_LIMIT
@@ -3750,7 +3856,6 @@ async function readViewerTasks(user) {
3750
3856
  destinationDetails(selected.map(({ task }) => task.destination)),
3751
3857
  creatorProfileEmails(selected)
3752
3858
  ]);
3753
- const eventCatalog = getResourceEventCatalog();
3754
3859
  const visible = selected.filter(
3755
3860
  (candidate) => candidate.ownedByViewer || destinations.get(destinationKey(candidate.task.destination))?.visibility === "public"
3756
3861
  );
@@ -3773,38 +3878,21 @@ async function readViewerTasks(user) {
3773
3878
  )
3774
3879
  );
3775
3880
  if (candidate.kind === "scheduled") {
3776
- const summary = scheduledTaskSummary(
3881
+ return scheduledTaskSummary(
3777
3882
  candidate.task,
3778
3883
  candidate.ownedByViewer,
3779
3884
  destination,
3780
- scheduledStats.get(candidate.task.id)
3885
+ scheduledStats.get(candidate.task.id),
3886
+ createdByEmail
3781
3887
  );
3782
- return {
3783
- ...summary,
3784
- ...createdByEmail ? { createdByEmail } : {}
3785
- };
3786
3888
  }
3787
- const task = candidate.task;
3788
- return {
3789
- createdAt: new Date(task.createdAtMs).toISOString(),
3790
- createdBy: creatorLabel(task.createdBy),
3791
- ...createdByEmail ? { createdByEmail } : {},
3792
- destination: {
3793
- channelId: task.destination.channelId,
3794
- label: destination.label,
3795
- teamId: task.destination.teamId,
3796
- visibility: destination.visibility
3797
- },
3798
- events: task.trigger.events,
3799
- id: task.id,
3800
- instruction: task.task.text,
3801
- kind: "event",
3802
- ...executionSummaryFields(eventStats.get(task.id)),
3803
- ownedByViewer: candidate.ownedByViewer,
3804
- resource: `${task.trigger.label} \xB7 ${task.trigger.identifier}`,
3805
- source: task.trigger.namespace,
3806
- triggerAvailable: eventTaskTriggerAvailable(task, eventCatalog)
3807
- };
3889
+ return eventTaskSummary(
3890
+ candidate.task,
3891
+ candidate.ownedByViewer,
3892
+ destination,
3893
+ eventStats.get(candidate.task.id),
3894
+ createdByEmail
3895
+ );
3808
3896
  });
3809
3897
  return {
3810
3898
  executionDays,
@@ -3818,6 +3906,28 @@ var ViewerTaskNotFoundError = class extends Error {
3818
3906
  this.name = "ViewerTaskNotFoundError";
3819
3907
  }
3820
3908
  };
3909
+ async function readViewerTaskExecutions(user, kind, id) {
3910
+ const candidate = await resolveViewerTaskCandidate(user, kind, id);
3911
+ if (!candidate) throw new ViewerTaskNotFoundError();
3912
+ const [task, executions, executionDays] = await Promise.all([
3913
+ taskSummaryForCandidate(candidate),
3914
+ readTaskExecutions({
3915
+ kind,
3916
+ limit: TASK_EXECUTION_LIST_LIMIT + 1,
3917
+ taskId: id
3918
+ }),
3919
+ readTaskExecutionStatusDays({
3920
+ kind,
3921
+ taskId: id
3922
+ })
3923
+ ]);
3924
+ return {
3925
+ executionDays,
3926
+ executions: executions.slice(0, TASK_EXECUTION_LIST_LIMIT),
3927
+ task,
3928
+ truncated: executions.length > TASK_EXECUTION_LIST_LIMIT
3929
+ };
3930
+ }
3821
3931
  async function deleteViewerTask(user, kind, id) {
3822
3932
  if (kind === "scheduled") {
3823
3933
  try {
@@ -3855,6 +3965,43 @@ function createTaskRoutes() {
3855
3965
  { status: 401 }
3856
3966
  );
3857
3967
  });
3968
+ app.get("/:kind/:id/executions", async (context) => {
3969
+ const user = await viewer(context);
3970
+ if (!user) {
3971
+ return jsonResponse(
3972
+ apiErrorSchema,
3973
+ { error: "Authentication required." },
3974
+ { status: 401 }
3975
+ );
3976
+ }
3977
+ const params = taskParamsSchema.safeParse(context.req.param());
3978
+ if (!params.success) {
3979
+ return jsonResponse(
3980
+ apiErrorSchema,
3981
+ { error: "Invalid task." },
3982
+ { status: 400 }
3983
+ );
3984
+ }
3985
+ try {
3986
+ return jsonResponse(
3987
+ taskExecutionListSchema,
3988
+ await readViewerTaskExecutions(
3989
+ user,
3990
+ params.data.kind,
3991
+ params.data.id
3992
+ )
3993
+ );
3994
+ } catch (error) {
3995
+ if (error instanceof ViewerTaskNotFoundError) {
3996
+ return jsonResponse(
3997
+ apiErrorSchema,
3998
+ { error: error.message },
3999
+ { status: 404 }
4000
+ );
4001
+ }
4002
+ throw error;
4003
+ }
4004
+ });
3858
4005
  app.delete("/:kind/:id", async (context) => {
3859
4006
  const user = await viewer(context);
3860
4007
  if (!user) {
package/dist/app.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Hono } from "hono";
2
+ import { type ExperimentalFeaturesConfig } from "@/chat/experimental";
2
3
  import { type SandboxResourceConfig } from "@/chat/sandbox/resources";
3
4
  import { type JuniorPluginSet } from "./plugins";
4
5
  import { type VercelConversationWorkCallbackOptions } from "@/chat/task-execution/vercel-callback";
@@ -9,6 +10,12 @@ export type { JuniorPluginInput, JuniorPluginSet, JuniorPluginSetOptions, } from
9
10
  export interface JuniorAppOptions {
10
11
  /** Authenticated dashboard mounted by core when configured. */
11
12
  dashboard?: JuniorDashboardOptions;
13
+ /**
14
+ * Opt into unstable product features. Experimental keys may change or be
15
+ * removed without a stable migration path; leave unset in production unless
16
+ * you are deliberately dogfooding a pre-stable surface.
17
+ */
18
+ experimental?: ExperimentalFeaturesConfig;
12
19
  /** Slack-specific overrides applied after env parsing. */
13
20
  slack?: {
14
21
  /** Slack emoji shown while Junior is processing. Defaults to `eyes`. */