@sentry/junior 0.133.0 → 0.135.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 (69) hide show
  1. package/dist/{agent-hooks-5BUIXVIX.js → agent-hooks-EMXDAD2K.js} +9 -9
  2. package/dist/api/schema/task.d.ts +36 -0
  3. package/dist/api/schema.d.ts +1 -1
  4. package/dist/api/schema.js +1 -1
  5. package/dist/api.js +39 -20
  6. package/dist/app.js +46 -24
  7. package/dist/{catalog-runtime-VGB3DWXZ.js → catalog-runtime-NVPT6HA5.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 +28 -0
  20. package/dist/chat/tools/index.d.ts +2 -0
  21. package/dist/chat/tools/sandbox/bash.d.ts +1 -0
  22. package/dist/chat/tools/system-time.d.ts +11 -1
  23. package/dist/{chunk-XTQGVNM3.js → chunk-45DPXMI3.js} +6 -12
  24. package/dist/{chunk-TU7P77FI.js → chunk-5EX36ZCD.js} +12 -12
  25. package/dist/{chunk-VL7OYSHD.js → chunk-5LD6EBH2.js} +1 -1
  26. package/dist/{chunk-HJ4KDO4N.js → chunk-6UNZ5DHG.js} +1 -1
  27. package/dist/{chunk-IVTHTAVK.js → chunk-AGAHACF7.js} +2 -2
  28. package/dist/{chunk-HX236W2U.js → chunk-CDQ4YIZM.js} +9 -0
  29. package/dist/{chunk-5ZAZHLIW.js → chunk-EBRB6ZBF.js} +1 -1
  30. package/dist/{chunk-VQA25AL4.js → chunk-EJT7EPP3.js} +6 -6
  31. package/dist/{chunk-FX6BLEDP.js → chunk-HDGTBCQR.js} +1 -1
  32. package/dist/{chunk-AH5HTUYX.js → chunk-IRTIVX42.js} +1 -1
  33. package/dist/{chunk-ECUILEUX.js → chunk-NGX2V4WY.js} +430 -29
  34. package/dist/{chunk-TBVS7GBE.js → chunk-OSCF2BDE.js} +9 -8
  35. package/dist/{chunk-HTGXUNEC.js → chunk-P2D7IW57.js} +7 -7
  36. package/dist/{chunk-EJRJWBKG.js → chunk-QQCEMMVN.js} +1 -1
  37. package/dist/{chunk-LDRO4OQ4.js → chunk-RMI6OX52.js} +2 -2
  38. package/dist/{chunk-QVEXYYFM.js → chunk-TRZSM67C.js} +11 -1
  39. package/dist/{chunk-TLN54TOQ.js → chunk-TYEDZVRM.js} +32 -32
  40. package/dist/{chunk-QWGZ273D.js → chunk-U37P4IIP.js} +81 -27
  41. package/dist/{chunk-JLN4XSPR.js → chunk-UXYZPEWP.js} +1 -1
  42. package/dist/{chunk-LNYNTR27.js → chunk-VZEKCQLD.js} +3 -3
  43. package/dist/{chunk-T5FPIBU2.js → chunk-Y6627MTY.js} +788 -674
  44. package/dist/{chunk-IKO5LFIU.js → chunk-YPKPXLMS.js} +1 -1
  45. package/dist/chunk-Z67KVHMJ.js +233 -0
  46. package/dist/{chunk-WHEMUEXT.js → chunk-ZBQIA5NI.js} +8 -6
  47. package/dist/cli/chat.js +25 -25
  48. package/dist/cli/check.js +6 -6
  49. package/dist/cli/init.js +0 -1
  50. package/dist/cli/plugins.js +12 -12
  51. package/dist/cli/snapshot-create.js +9 -9
  52. package/dist/cli/upgrade.js +7 -7
  53. package/dist/db/schema/task-executions.d.ts +110 -0
  54. package/dist/db/schema.d.ts +111 -1
  55. package/dist/{db-RICMPUFT.js → db-UA6OFL25.js} +7 -7
  56. package/dist/instrumentation.js +4 -4
  57. package/dist/nitro.js +2 -2
  58. package/dist/{oauth-callback-server-YFVS4SAX.js → oauth-callback-server-IJDYBSTX.js} +18 -18
  59. package/dist/{runner-A3LVGZR6.js → runner-K6GID4HN.js} +12 -12
  60. package/dist/{skills-P7Q6Z6PN.js → skills-KJVS753I.js} +6 -6
  61. package/dist/{validation-RYHOWBET.js → validation-7VDJGK7K.js} +6 -6
  62. package/dist/version.js +1 -1
  63. package/migrations/0019_lowly_valkyrie.sql +14 -0
  64. package/migrations/0020_restrict_task_execution_kinds.sql +2 -0
  65. package/migrations/meta/0019_snapshot.json +1904 -0
  66. package/migrations/meta/0020_snapshot.json +1848 -0
  67. package/migrations/meta/_journal.json +15 -1
  68. package/package.json +4 -4
  69. package/dist/chunk-V365UVCU.js +0 -115
@@ -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-ZBQIA5NI.js";
15
+ import "./chunk-VZEKCQLD.js";
16
+ import "./chunk-U37P4IIP.js";
17
+ import "./chunk-TYEDZVRM.js";
18
+ import "./chunk-RMI6OX52.js";
19
19
  import "./chunk-VFUK3X5B.js";
20
- import "./chunk-VL7OYSHD.js";
20
+ import "./chunk-5LD6EBH2.js";
21
21
  import "./chunk-HZF5P5UN.js";
22
22
  import "./chunk-F3B2YJ76.js";
23
- import "./chunk-EJRJWBKG.js";
23
+ import "./chunk-QQCEMMVN.js";
24
24
  import "./chunk-6GWA276C.js";
25
- import "./chunk-FX6BLEDP.js";
26
- import "./chunk-IKO5LFIU.js";
25
+ import "./chunk-HDGTBCQR.js";
26
+ import "./chunk-YPKPXLMS.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,29 @@ 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 UTC day of successful task executions stacked by task type. */
110
+ export declare const taskExecutionDaySchema: z.ZodObject<{
111
+ date: z.ZodString;
112
+ event: z.ZodNumber;
113
+ scheduled: z.ZodNumber;
114
+ }, z.core.$strict>;
93
115
  export declare const taskListSchema: z.ZodObject<{
116
+ executionDays: z.ZodArray<z.ZodObject<{
117
+ date: z.ZodString;
118
+ event: z.ZodNumber;
119
+ scheduled: z.ZodNumber;
120
+ }, z.core.$strict>>;
94
121
  tasks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
95
122
  createdAt: z.ZodString;
96
123
  createdBy: z.ZodString;
@@ -106,7 +133,11 @@ export declare const taskListSchema: z.ZodObject<{
106
133
  }, z.core.$strict>;
107
134
  id: z.ZodString;
108
135
  instruction: z.ZodString;
136
+ lastConversationId: z.ZodOptional<z.ZodString>;
137
+ lastRunAt: z.ZodOptional<z.ZodString>;
109
138
  ownedByViewer: z.ZodBoolean;
139
+ runsLast7Days: z.ZodNumber;
140
+ totalRuns: z.ZodNumber;
110
141
  kind: z.ZodLiteral<"scheduled">;
111
142
  nextRunAt: z.ZodOptional<z.ZodString>;
112
143
  schedule: z.ZodString;
@@ -129,7 +160,11 @@ export declare const taskListSchema: z.ZodObject<{
129
160
  }, z.core.$strict>;
130
161
  id: z.ZodString;
131
162
  instruction: z.ZodString;
163
+ lastConversationId: z.ZodOptional<z.ZodString>;
164
+ lastRunAt: z.ZodOptional<z.ZodString>;
132
165
  ownedByViewer: z.ZodBoolean;
166
+ runsLast7Days: z.ZodNumber;
167
+ totalRuns: z.ZodNumber;
133
168
  events: z.ZodArray<z.ZodString>;
134
169
  kind: z.ZodLiteral<"event">;
135
170
  resource: z.ZodString;
@@ -145,5 +180,6 @@ export declare const taskParamsSchema: z.ZodObject<{
145
180
  scheduled: "scheduled";
146
181
  }>;
147
182
  }, z.core.$strict>;
183
+ export type TaskExecutionDay = z.output<typeof taskExecutionDaySchema>;
148
184
  export type TaskSummary = z.output<typeof taskSummarySchema>;
149
185
  export type TaskList = z.output<typeof taskListSchema>;
@@ -11,7 +11,7 @@ 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
13
  export { eventTaskSummarySchema, scheduledTaskSummarySchema, taskListSchema, taskParamsSchema, taskSummarySchema, } from "./schema/task";
14
- export type { TaskList, TaskSummary } from "./schema/task";
14
+ export type { 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";
@@ -37,7 +37,7 @@ import {
37
37
  taskListSchema,
38
38
  taskParamsSchema,
39
39
  taskSummarySchema
40
- } from "../chunk-QVEXYYFM.js";
40
+ } from "../chunk-TRZSM67C.js";
41
41
  import {
42
42
  healthReportSchema,
43
43
  pluginOperationalReportFeedSchema,
package/dist/api.js CHANGED
@@ -27,12 +27,14 @@ import {
27
27
  statsReportSchema,
28
28
  taskListSchema,
29
29
  taskParamsSchema
30
- } from "./chunk-QVEXYYFM.js";
30
+ } from "./chunk-TRZSM67C.js";
31
31
  import {
32
32
  formatSlackConversationRedactedLabel,
33
33
  readHealthReport,
34
+ readTaskExecutionDays,
35
+ readTaskExecutionSummaries,
34
36
  resolveSlackConversationContextFromThreadId
35
- } from "./chunk-V365UVCU.js";
37
+ } from "./chunk-Z67KVHMJ.js";
36
38
  import {
37
39
  buildSentryConversationUrl
38
40
  } from "./chunk-4CODA7P5.js";
@@ -54,15 +56,15 @@ import {
54
56
  listPublicEventTasksForTeams,
55
57
  listPublicScheduledTasksForTeams,
56
58
  readStats
57
- } from "./chunk-XTQGVNM3.js";
59
+ } from "./chunk-45DPXMI3.js";
58
60
  import {
59
61
  parseSlackThreadId
60
- } from "./chunk-AH5HTUYX.js";
62
+ } from "./chunk-IRTIVX42.js";
61
63
  import {
62
64
  agentTurnUsageSchema,
63
65
  hasAgentTurnUsage,
64
66
  renderJuniorNativeConversationEvent
65
- } from "./chunk-HX236W2U.js";
67
+ } from "./chunk-CDQ4YIZM.js";
66
68
  import "./chunk-PDO5BLNM.js";
67
69
  import {
68
70
  createPluginLogger,
@@ -70,38 +72,38 @@ import {
70
72
  listConversationAnnotations,
71
73
  renderPluginConversationEvent,
72
74
  resolveViewerUser
73
- } from "./chunk-WHEMUEXT.js";
75
+ } from "./chunk-ZBQIA5NI.js";
74
76
  import {
75
77
  decodeStoredConversationEvent,
76
78
  getDb,
77
79
  getSqlExecutor,
78
80
  locationFromRow,
79
81
  parseSessionSource
80
- } from "./chunk-LNYNTR27.js";
82
+ } from "./chunk-VZEKCQLD.js";
81
83
  import {
82
84
  juniorApiTokens,
83
85
  juniorConversationEvents,
84
86
  juniorConversations,
85
87
  juniorIdentities,
86
88
  juniorUsers
87
- } from "./chunk-QWGZ273D.js";
88
- import "./chunk-TLN54TOQ.js";
89
- import "./chunk-LDRO4OQ4.js";
89
+ } from "./chunk-U37P4IIP.js";
90
+ import "./chunk-TYEDZVRM.js";
91
+ import "./chunk-RMI6OX52.js";
90
92
  import {
91
93
  juniorDestinations
92
94
  } from "./chunk-VFUK3X5B.js";
93
95
  import {
94
96
  canExposeConversationPayload
95
- } from "./chunk-VL7OYSHD.js";
97
+ } from "./chunk-5LD6EBH2.js";
96
98
  import "./chunk-HZF5P5UN.js";
97
99
  import {
98
100
  parseSlackChannelId,
99
101
  parseSlackTeamId
100
102
  } from "./chunk-F3B2YJ76.js";
101
- import "./chunk-EJRJWBKG.js";
103
+ import "./chunk-QQCEMMVN.js";
102
104
  import "./chunk-6GWA276C.js";
103
- import "./chunk-FX6BLEDP.js";
104
- import "./chunk-IKO5LFIU.js";
105
+ import "./chunk-HDGTBCQR.js";
106
+ import "./chunk-YPKPXLMS.js";
105
107
  import "./chunk-MLKGABMK.js";
106
108
 
107
109
  // src/api.ts
@@ -2027,7 +2029,7 @@ function readDescriptionText(home) {
2027
2029
  }
2028
2030
  }
2029
2031
  async function readSkillReports() {
2030
- const { discoverSkills } = await import("./skills-P7Q6Z6PN.js");
2032
+ const { discoverSkills } = await import("./skills-KJVS753I.js");
2031
2033
  const skills = await discoverSkills();
2032
2034
  return skillReportsSchema.parse(
2033
2035
  skills.map((skill) => ({
@@ -2037,7 +2039,7 @@ async function readSkillReports() {
2037
2039
  );
2038
2040
  }
2039
2041
  async function readPlugins() {
2040
- const { pluginCatalogRuntime } = await import("./catalog-runtime-VGB3DWXZ.js");
2042
+ const { pluginCatalogRuntime } = await import("./catalog-runtime-NVPT6HA5.js");
2041
2043
  return pluginsSchema.parse(
2042
2044
  pluginCatalogRuntime.getProviders().map((plugin) => ({
2043
2045
  configKeys: plugin.manifest.configKeys ?? [],
@@ -2050,7 +2052,7 @@ async function readPlugins() {
2050
2052
  async function readRuntimeInfoReport() {
2051
2053
  const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
2052
2054
  import("./discovery-GUFTFBTL.js"),
2053
- import("./catalog-runtime-VGB3DWXZ.js"),
2055
+ import("./catalog-runtime-NVPT6HA5.js"),
2054
2056
  readPlugins(),
2055
2057
  readSkillReports()
2056
2058
  ]);
@@ -2066,7 +2068,7 @@ async function readRuntimeInfoReport() {
2066
2068
  }
2067
2069
  async function readPluginOperationalReportFeed() {
2068
2070
  const nowMs = Date.now();
2069
- const { getPluginOperationalReports } = await import("./agent-hooks-5BUIXVIX.js");
2071
+ const { getPluginOperationalReports } = await import("./agent-hooks-EMXDAD2K.js");
2070
2072
  return pluginOperationalReportFeedSchema.parse({
2071
2073
  source: "plugins",
2072
2074
  generatedAt: new Date(nowMs).toISOString(),
@@ -3522,7 +3524,15 @@ async function destinationDetails(destinations) {
3522
3524
  })
3523
3525
  );
3524
3526
  }
3525
- function scheduledTaskSummary(task, ownedByViewer, destination) {
3527
+ function executionSummaryFields(stats) {
3528
+ return {
3529
+ ...stats?.lastConversationId ? { lastConversationId: stats.lastConversationId } : {},
3530
+ ...stats?.lastExecutedAtMs ? { lastRunAt: new Date(stats.lastExecutedAtMs).toISOString() } : {},
3531
+ runsLast7Days: stats?.runsLast7Days ?? 0,
3532
+ totalRuns: stats?.totalRuns ?? 0
3533
+ };
3534
+ }
3535
+ function scheduledTaskSummary(task, ownedByViewer, destination, stats) {
3526
3536
  if (task.status === "deleted") {
3527
3537
  throw new Error("Deleted scheduled tasks cannot enter the Tasks view");
3528
3538
  }
@@ -3539,6 +3549,7 @@ function scheduledTaskSummary(task, ownedByViewer, destination) {
3539
3549
  id: task.id,
3540
3550
  instruction: displayText(task.task.text, "Untitled scheduled task"),
3541
3551
  kind: "scheduled",
3552
+ ...executionSummaryFields(stats),
3542
3553
  ...nextRunAtMs !== void 0 ? { nextRunAt: new Date(nextRunAtMs).toISOString() } : {},
3543
3554
  ownedByViewer,
3544
3555
  schedule: displayText(task.schedule.description, "Schedule unavailable"),
@@ -3605,6 +3616,11 @@ async function readViewerTasks(user) {
3605
3616
  const visible = selected.filter(
3606
3617
  (candidate) => candidate.ownedByViewer || destinations.get(destinationKey(candidate.task.destination))?.visibility === "public"
3607
3618
  );
3619
+ const [executionDays, scheduledStats, eventStats] = await Promise.all([
3620
+ readTaskExecutionDays(),
3621
+ readTaskExecutionSummaries("scheduled", "junior"),
3622
+ readTaskExecutionSummaries("event", "junior")
3623
+ ]);
3608
3624
  const tasks = visible.map((candidate) => {
3609
3625
  const destination = destinations.get(
3610
3626
  destinationKey(candidate.task.destination)
@@ -3622,7 +3638,8 @@ async function readViewerTasks(user) {
3622
3638
  const summary = scheduledTaskSummary(
3623
3639
  candidate.task,
3624
3640
  candidate.ownedByViewer,
3625
- destination
3641
+ destination,
3642
+ scheduledStats.get(candidate.task.id)
3626
3643
  );
3627
3644
  return {
3628
3645
  ...summary,
@@ -3644,6 +3661,7 @@ async function readViewerTasks(user) {
3644
3661
  id: task.id,
3645
3662
  instruction: task.task.text,
3646
3663
  kind: "event",
3664
+ ...executionSummaryFields(eventStats.get(task.id)),
3647
3665
  ownedByViewer: candidate.ownedByViewer,
3648
3666
  resource: `${task.trigger.label} \xB7 ${task.trigger.identifier}`,
3649
3667
  source: task.trigger.namespace,
@@ -3651,6 +3669,7 @@ async function readViewerTasks(user) {
3651
3669
  };
3652
3670
  });
3653
3671
  return {
3672
+ executionDays,
3654
3673
  tasks,
3655
3674
  truncated: ownedCandidates.length > TASK_LIST_LIMIT || publicCandidates.length > TASK_LIST_LIMIT
3656
3675
  };
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-5EX36ZCD.js";
54
54
  import "./chunk-FA6POGLH.js";
55
55
  import {
56
56
  ConversationTurnLifecycleService,
@@ -65,13 +65,14 @@ import {
65
65
  processPluginTask,
66
66
  requireTurnFailureEventId,
67
67
  scheduleSessionCompletedPluginTasks
68
- } from "./chunk-VQA25AL4.js";
68
+ } from "./chunk-EJT7EPP3.js";
69
69
  import {
70
70
  GET,
71
71
  conversationVisibilityFromSlackChannelType,
72
+ recordTaskExecution,
72
73
  resolveSlackChannelTypeFromMessage,
73
74
  resolveSlackConversationContext
74
- } from "./chunk-V365UVCU.js";
75
+ } from "./chunk-Z67KVHMJ.js";
75
76
  import "./chunk-4CODA7P5.js";
76
77
  import "./chunk-UTL3MHPC.js";
77
78
  import {
@@ -90,7 +91,7 @@ import {
90
91
  import {
91
92
  validatePluginEgressCredentialHooks,
92
93
  validatePluginRegistrations
93
- } from "./chunk-5ZAZHLIW.js";
94
+ } from "./chunk-EBRB6ZBF.js";
94
95
  import {
95
96
  defineJuniorPlugins,
96
97
  pluginCatalogConfigFromEnv,
@@ -125,7 +126,7 @@ import {
125
126
  setConfigDefaults,
126
127
  shouldEmitDevAgentTrace,
127
128
  shouldPropagateSandboxEgressTrace
128
- } from "./chunk-T5FPIBU2.js";
129
+ } from "./chunk-Y6627MTY.js";
129
130
  import "./chunk-DIB4GX3G.js";
130
131
  import {
131
132
  RetryableDeliveryError,
@@ -136,7 +137,7 @@ import {
136
137
  formatProviderLabel,
137
138
  postSlackMessage,
138
139
  startOAuthFlow
139
- } from "./chunk-HTGXUNEC.js";
140
+ } from "./chunk-P2D7IW57.js";
140
141
  import {
141
142
  ConversationTurnBoundaryError,
142
143
  CooperativeTurnYieldError,
@@ -192,20 +193,20 @@ import {
192
193
  trimTrailingAssistantMessages,
193
194
  updateConversationStats,
194
195
  upsertConversationMessage
195
- } from "./chunk-ECUILEUX.js";
196
+ } from "./chunk-NGX2V4WY.js";
196
197
  import "./chunk-EPBBYMNE.js";
197
198
  import {
198
199
  getSandboxResourceConfig,
199
200
  setSandboxResourceConfig
200
- } from "./chunk-TBVS7GBE.js";
201
+ } from "./chunk-OSCF2BDE.js";
201
202
  import {
202
203
  createSchedulerSqlStore,
203
204
  findMatchingEventTasks
204
- } from "./chunk-XTQGVNM3.js";
205
+ } from "./chunk-45DPXMI3.js";
205
206
  import {
206
207
  parseSlackThreadId
207
- } from "./chunk-AH5HTUYX.js";
208
- import "./chunk-HX236W2U.js";
208
+ } from "./chunk-IRTIVX42.js";
209
+ import "./chunk-CDQ4YIZM.js";
209
210
  import "./chunk-PDO5BLNM.js";
210
211
  import "./chunk-UIE3R5XU.js";
211
212
  import {
@@ -232,7 +233,7 @@ import {
232
233
  verifyEventTaskCredentialSubject,
233
234
  verifyScheduledTaskCredentialSubject,
234
235
  verifySlackDirectCredentialSubject
235
- } from "./chunk-WHEMUEXT.js";
236
+ } from "./chunk-ZBQIA5NI.js";
236
237
  import {
237
238
  contextProvenance,
238
239
  createSlackDestination,
@@ -243,16 +244,16 @@ import {
243
244
  instructionProvenanceFor,
244
245
  requireSlackDestination,
245
246
  withConversationEventLock
246
- } from "./chunk-LNYNTR27.js";
247
+ } from "./chunk-VZEKCQLD.js";
247
248
  import {
248
249
  juniorConversationEvents,
249
250
  juniorConversations
250
- } from "./chunk-QWGZ273D.js";
251
+ } from "./chunk-U37P4IIP.js";
251
252
  import {
252
253
  acquireActiveLock,
253
254
  getStateAdapter,
254
255
  sleep
255
- } from "./chunk-TLN54TOQ.js";
256
+ } from "./chunk-TYEDZVRM.js";
256
257
  import {
257
258
  STANDARD_MODEL_PROFILE,
258
259
  botConfig,
@@ -270,16 +271,16 @@ import {
270
271
  modelIdForProfile,
271
272
  setSlackReactionConfig,
272
273
  standardModelId
273
- } from "./chunk-LDRO4OQ4.js";
274
+ } from "./chunk-RMI6OX52.js";
274
275
  import {
275
276
  juniorDestinations
276
277
  } from "./chunk-VFUK3X5B.js";
277
- import "./chunk-VL7OYSHD.js";
278
- import "./chunk-IVTHTAVK.js";
278
+ import "./chunk-5LD6EBH2.js";
279
+ import "./chunk-AGAHACF7.js";
279
280
  import {
280
281
  pluginCatalogRuntime
281
- } from "./chunk-JLN4XSPR.js";
282
- import "./chunk-HJ4KDO4N.js";
282
+ } from "./chunk-UXYZPEWP.js";
283
+ import "./chunk-6UNZ5DHG.js";
283
284
  import {
284
285
  credentialSubjectSchema
285
286
  } from "./chunk-77VDLF3Z.js";
@@ -311,7 +312,7 @@ import {
311
312
  withContext,
312
313
  withLogContext,
313
314
  withSpan
314
- } from "./chunk-EJRJWBKG.js";
315
+ } from "./chunk-QQCEMMVN.js";
315
316
  import {
316
317
  continueTrace
317
318
  } from "./chunk-6GWA276C.js";
@@ -319,10 +320,10 @@ import "./chunk-OOUNJNMR.js";
319
320
  import "./chunk-H4HBKISO.js";
320
321
  import {
321
322
  JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE
322
- } from "./chunk-FX6BLEDP.js";
323
+ } from "./chunk-HDGTBCQR.js";
323
324
  import {
324
325
  JUNIOR_VERSION
325
- } from "./chunk-IKO5LFIU.js";
326
+ } from "./chunk-YPKPXLMS.js";
326
327
  import "./chunk-MLKGABMK.js";
327
328
 
328
329
  // src/app.ts
@@ -697,7 +698,8 @@ async function markDispatchBlocked(id, errorMessage, resultMessageTs) {
697
698
  );
698
699
  }
699
700
  async function markDispatchCompleted(id, resultMessageTs) {
700
- return await transitionDispatch(
701
+ const previous = await getDispatchRecord(id);
702
+ const next = await transitionDispatch(
701
703
  id,
702
704
  (record) => isTerminalDispatchStatus(record.status) ? record : {
703
705
  ...record,
@@ -706,6 +708,17 @@ async function markDispatchCompleted(id, resultMessageTs) {
706
708
  status: "completed"
707
709
  }
708
710
  );
711
+ if (next?.status === "completed" && previous?.status !== "completed" && next.plugin === "junior") {
712
+ const eventTaskId = next.metadata?.eventTaskId;
713
+ if (eventTaskId) {
714
+ await recordTaskExecution("event", eventTaskId, {
715
+ conversationId: getDispatchConversationId(next),
716
+ executionId: next.id,
717
+ nowMs: next.updatedAtMs
718
+ });
719
+ }
720
+ }
721
+ return next;
709
722
  }
710
723
  async function markDispatchFailed(id, errorMessage, resultMessageTs) {
711
724
  return await transitionDispatch(
@@ -1583,6 +1596,14 @@ async function applyDispatchResult(args) {
1583
1596
  run: args.run,
1584
1597
  status: "completed"
1585
1598
  });
1599
+ const dispatchId = args.run.dispatchId;
1600
+ if (dispatchId) {
1601
+ await recordTaskExecution("scheduled", args.run.taskId, {
1602
+ conversationId: getDispatchConversationId({ id: dispatchId }),
1603
+ executionId: args.run.id,
1604
+ nowMs: args.nowMs
1605
+ });
1606
+ }
1586
1607
  return true;
1587
1608
  }
1588
1609
  if (args.dispatch.status === "blocked") {
@@ -9355,6 +9376,7 @@ async function ingestEventTasks(input, options) {
9355
9376
  destination: task.destination,
9356
9377
  destinationVisibility: task.destinationVisibility,
9357
9378
  input: eventInput(task, event),
9379
+ metadata: { eventTaskId: task.id },
9358
9380
  replyAttribution: replyAttribution2(task, event),
9359
9381
  source: createSlackSource3({
9360
9382
  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-UXYZPEWP.js";
4
+ import "./chunk-6UNZ5DHG.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-QQCEMMVN.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-HDGTBCQR.js";
13
+ import "./chunk-YPKPXLMS.js";
14
14
  import "./chunk-MLKGABMK.js";
15
15
  export {
16
16
  pluginCatalogRuntime
@@ -19,26 +19,27 @@ export type UserContentPart = {
19
19
  };
20
20
  /** User-turn content parts plus the plain-text blocks used for routing decisions. */
21
21
  export interface PromptInput {
22
+ contextContentParts: UserContentPart[];
22
23
  routerBlocks: string[];
23
24
  userContentParts: UserContentPart[];
24
25
  }
25
26
  /** Fully assembled prompt state for one run slice. */
26
27
  export interface PromptAssembly {
27
28
  baseInstructions: string;
29
+ contextContentParts: UserContentPart[];
28
30
  inputMessages: Array<{
29
31
  role: string;
30
32
  content: Record<string, unknown>[];
31
33
  }>;
32
34
  inputMessagesAttribute: string | undefined;
33
- promptContentParts: UserContentPart[];
35
+ promptTimestamp?: number;
34
36
  promptHistoryMessages: PiMessage[];
35
37
  shouldPromptAgent: boolean;
36
38
  turnContexts: PluginTurnContext[];
39
+ userContentParts: UserContentPart[];
37
40
  }
38
- /**
39
- * Keep thread text separate from the canonical active task boundary.
40
- */
41
- export declare function buildUserTurnText(userInput: string, conversationContext?: string, actor?: AgentRunInstructionActor): string;
41
+ /** Render the current actor's instruction without host-owned thread context. */
42
+ export declare function buildUserTurnText(userInput: string, actor?: AgentRunInstructionActor): string;
42
43
  /** Render an explicitly selected skill as instructions for the current turn. */
43
44
  export declare function renderExplicitSkillInstructions(skill: Skill): string;
44
45
  /** Encode a non-image attachment as base64 XML for the prompt. */
@@ -64,6 +65,7 @@ export declare function assemblePrompt(args: {
64
65
  artifactState?: ThreadArtifactsState;
65
66
  availableSkills: SkillMetadata[];
66
67
  configurationValues: Record<string, unknown>;
68
+ contextContentParts: UserContentPart[];
67
69
  conversationPrivacy?: ConversationPrivacy;
68
70
  existingSessionPiMessages?: PiMessage[];
69
71
  existingTurnStartMessageIndex?: number;
@@ -0,0 +1,20 @@
1
+ import type { AgentContext, AgentLoopTurnUpdate } from "@earendil-works/pi-agent-core";
2
+ import type { ConversationMessageProvenance } from "@/chat/conversations/provenance";
3
+ import type { UserContentPart } from "@/chat/agent/prompt";
4
+ import type { PiMessage } from "@/chat/pi/messages";
5
+ import { type RepositoryInstructions } from "@/chat/repository-instructions";
6
+ type RepositoryInstructionsContextOptions = {
7
+ capture(): Promise<RepositoryInstructions | undefined>;
8
+ hasSandbox(): boolean;
9
+ initialInstructions?: RepositoryInstructions;
10
+ restoredMessages?: PiMessage[];
11
+ restoredProvenance?: ConversationMessageProvenance[];
12
+ promptContextContentParts: UserContentPart[];
13
+ setMessages(messages: PiMessage[]): void;
14
+ shouldPromptAgent: boolean;
15
+ };
16
+ /** Track model-visible AGENTS.md state and append updates before later samples. */
17
+ export declare function createRepositoryInstructionsContext(options: RepositoryInstructionsContextOptions): {
18
+ applyUpdate(currentUpdate: AgentLoopTurnUpdate | undefined, currentContext: AgentContext): Promise<AgentLoopTurnUpdate | undefined>;
19
+ };
20
+ export {};
@@ -6,6 +6,7 @@
6
6
  * routing, and generated-artifact materialization.
7
7
  */
8
8
  import type { FileUpload } from "chat";
9
+ import type { PluginSandbox } from "@sentry/junior-plugin-api";
9
10
  import { type Actor } from "@/chat/actor";
10
11
  import type { ChannelConfigurationService } from "@/chat/configuration/types";
11
12
  import type { CredentialContext } from "@/chat/credentials/context";
@@ -13,6 +14,7 @@ import type { LogContext } from "@/chat/logging";
13
14
  import type { SandboxEgressTracePropagationConfig } from "@/chat/sandbox/egress/tracing";
14
15
  import type { SandboxEgressSignalTransport } from "@/chat/sandbox/egress/signals";
15
16
  import type { SandboxRef } from "@/chat/sandbox/ref";
17
+ import type { RepositoryInstructions } from "@/chat/repository-instructions";
16
18
  import { type SandboxTools } from "@/chat/sandbox/sandbox";
17
19
  import type { SandboxWorkspace } from "@/chat/sandbox/workspace";
18
20
  import type { Skill, SkillMetadata } from "@/chat/skills";
@@ -33,11 +35,17 @@ export interface AgentSandboxOptions {
33
35
  persistSandboxRef?(sandboxRef: SandboxRef): void | Promise<void>;
34
36
  }
35
37
  export interface AgentSandbox {
38
+ /** Resolve the AGENTS.md bundle for the selected repository directory. */
39
+ captureRepositoryInstructions(): Promise<RepositoryInstructions | undefined>;
36
40
  readonly tools: SandboxTools;
37
41
  readonly workspace: SandboxWorkspace;
38
42
  sandboxRef(): SandboxRef | undefined;
39
43
  close(): void;
40
44
  writeGeneratedArtifacts(files: FileUpload[]): Promise<GeneratedArtifactFileRef[]>;
41
45
  }
46
+ /** Adapt agent sandbox execution for plugin-owned workspace tools. */
47
+ export declare function createPluginToolSandbox(sandbox: Pick<AgentSandbox, "tools" | "workspace">, options: {
48
+ handleAuthSignal(details: unknown): Promise<void>;
49
+ }): PluginSandbox;
42
50
  /** Create run-scoped sandbox capabilities adapted to the current agent context. */
43
51
  export declare function createAgentSandbox(options: AgentSandboxOptions): AgentSandbox;
@@ -17,6 +17,7 @@ import type { AnyToolDefinition } from "@/chat/tools/definition";
17
17
  import type { ToolRuntimeContext } from "@/chat/tools/types";
18
18
  import { type ActiveMcpCatalogSummary } from "@/chat/tool-support/skill/mcp-tool-summary";
19
19
  import type { SandboxRef } from "@/chat/sandbox/ref";
20
+ import type { RepositoryInstructions } from "@/chat/repository-instructions";
20
21
  import type { PiMessage } from "@/chat/pi/messages";
21
22
  import type { LogContext } from "@/chat/logging";
22
23
  import type { ConversationPrivacy } from "@/chat/conversation-privacy";
@@ -81,6 +82,8 @@ export interface ToolWiring {
81
82
  isError?: boolean;
82
83
  }>(toolCallId: string, result: TResult): TResult;
83
84
  getSandboxRef: () => SandboxRef | undefined;
85
+ /** Resolve the AGENTS.md bundle selected by the sandbox workspace. */
86
+ captureRepositoryInstructions: () => Promise<RepositoryInstructions | undefined>;
84
87
  close(): Promise<void>;
85
88
  toolGuidance: Array<{
86
89
  name: string;