@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
@@ -148,6 +148,20 @@
148
148
  "when": 1785960181727,
149
149
  "tag": "0020_restrict_task_execution_kinds",
150
150
  "breakpoints": true
151
+ },
152
+ {
153
+ "idx": 21,
154
+ "version": "7",
155
+ "when": 1785985649150,
156
+ "tag": "0021_first_warhawk",
157
+ "breakpoints": true
158
+ },
159
+ {
160
+ "idx": 22,
161
+ "version": "7",
162
+ "when": 1786128720003,
163
+ "tag": "0022_task_execution_status",
164
+ "breakpoints": true
151
165
  }
152
166
  ]
153
- }
167
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior",
3
- "version": "0.137.0",
3
+ "version": "0.139.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -80,7 +80,7 @@
80
80
  "pg": "^8.16.3",
81
81
  "yaml": "^2.9.0",
82
82
  "zod": "^4.4.3",
83
- "@sentry/junior-plugin-api": "0.137.0"
83
+ "@sentry/junior-plugin-api": "0.139.0"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@emnapi/core": "^1.10.0",
@@ -97,8 +97,8 @@
97
97
  "typescript": "^6.0.3",
98
98
  "vercel": "^54.4.0",
99
99
  "vitest": "^4.1.7",
100
- "@sentry/junior-github": "0.137.0",
101
- "@sentry/junior-memory": "0.137.0",
100
+ "@sentry/junior-memory": "0.139.0",
101
+ "@sentry/junior-github": "0.139.0",
102
102
  "@sentry/junior-testing": "0.0.0"
103
103
  },
104
104
  "scripts": {
@@ -1,233 +0,0 @@
1
- import {
2
- healthReportSchema
3
- } from "./chunk-UTL3MHPC.js";
4
- import {
5
- parseSlackThreadId
6
- } from "./chunk-YRPC6MJY.js";
7
- import {
8
- normalizeSlackConversationId
9
- } from "./chunk-WPPXIAFB.js";
10
- import {
11
- getDb
12
- } from "./chunk-ZFS67WIR.js";
13
- import {
14
- juniorTaskExecutions
15
- } from "./chunk-RB4NJKEX.js";
16
- import {
17
- logWarn
18
- } from "./chunk-T6Z5S6PQ.js";
19
-
20
- // src/handlers/health.ts
21
- function readHealthReport() {
22
- return healthReportSchema.parse({
23
- status: "ok",
24
- service: "junior",
25
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
26
- });
27
- }
28
- function GET() {
29
- return Response.json(readHealthReport());
30
- }
31
-
32
- // src/chat/tasks/execution-stats.ts
33
- import { and, asc, count, desc, eq, gte, lte, max, sql } from "drizzle-orm";
34
- function utcDate(nowMs) {
35
- return new Date(nowMs).toISOString().slice(0, 10);
36
- }
37
- function emptyDay(date) {
38
- return { date, event: 0, scheduled: 0 };
39
- }
40
- async function recordTaskExecution(type, taskId, options) {
41
- const namespace = options.namespace ?? "junior";
42
- const nowMs = options.nowMs ?? Date.now();
43
- try {
44
- await getDb().insert(juniorTaskExecutions).values({
45
- conversationId: options.conversationId,
46
- executedAtMs: nowMs,
47
- executionId: options.executionId,
48
- kind: type,
49
- namespace,
50
- taskId
51
- }).onConflictDoNothing({
52
- target: [
53
- juniorTaskExecutions.kind,
54
- juniorTaskExecutions.namespace,
55
- juniorTaskExecutions.executionId
56
- ]
57
- });
58
- } catch (error) {
59
- logWarn("task.execution.stat_failed", {
60
- error,
61
- "app.task.execution.id": options.executionId,
62
- "app.task.execution.namespace": namespace,
63
- "app.task.execution.task_id": taskId,
64
- "app.task.execution.type": type
65
- });
66
- }
67
- }
68
- async function readTaskExecutionSummaries(type, namespace, options = {}) {
69
- const sevenDaysAgoMs = (options.nowMs ?? Date.now()) - 7 * 24 * 60 * 60 * 1e3;
70
- const db = getDb();
71
- const latest = db.selectDistinctOn([juniorTaskExecutions.taskId], {
72
- conversationId: juniorTaskExecutions.conversationId,
73
- taskId: juniorTaskExecutions.taskId
74
- }).from(juniorTaskExecutions).where(
75
- and(
76
- eq(juniorTaskExecutions.kind, type),
77
- eq(juniorTaskExecutions.namespace, namespace)
78
- )
79
- ).orderBy(
80
- juniorTaskExecutions.taskId,
81
- desc(juniorTaskExecutions.executedAtMs),
82
- desc(juniorTaskExecutions.executionId)
83
- ).as("latest_task_execution");
84
- const rows = await db.select({
85
- lastConversationId: latest.conversationId,
86
- lastExecutedAtMs: max(juniorTaskExecutions.executedAtMs),
87
- runsLast7Days: sql`count(*) filter (where ${juniorTaskExecutions.executedAtMs} >= ${sevenDaysAgoMs})::int`,
88
- taskId: juniorTaskExecutions.taskId,
89
- totalRuns: sql`count(*)::int`
90
- }).from(juniorTaskExecutions).innerJoin(latest, eq(latest.taskId, juniorTaskExecutions.taskId)).where(
91
- and(
92
- eq(juniorTaskExecutions.kind, type),
93
- eq(juniorTaskExecutions.namespace, namespace)
94
- )
95
- ).groupBy(juniorTaskExecutions.taskId, latest.conversationId);
96
- return new Map(
97
- rows.map((row) => [
98
- row.taskId,
99
- {
100
- lastConversationId: row.lastConversationId,
101
- ...row.lastExecutedAtMs !== null ? { lastExecutedAtMs: row.lastExecutedAtMs } : {},
102
- runsLast7Days: row.runsLast7Days,
103
- totalRuns: row.totalRuns
104
- }
105
- ])
106
- );
107
- }
108
- async function readTaskExecutionDays(dayCount = 90, options = {}) {
109
- const nowMs = options.nowMs ?? Date.now();
110
- const end = utcDate(nowMs);
111
- const endMs = Date.parse(`${end}T23:59:59.999Z`);
112
- const startMs = Date.parse(`${end}T00:00:00.000Z`) - (dayCount - 1) * 864e5;
113
- const executionDate = sql`to_char(to_timestamp(${juniorTaskExecutions.executedAtMs} / 1000.0) at time zone 'UTC', 'YYYY-MM-DD')`;
114
- const rows = await getDb().select({
115
- count: count(),
116
- date: executionDate,
117
- kind: juniorTaskExecutions.kind
118
- }).from(juniorTaskExecutions).where(
119
- and(
120
- gte(juniorTaskExecutions.executedAtMs, startMs),
121
- lte(juniorTaskExecutions.executedAtMs, endMs)
122
- )
123
- ).groupBy(executionDate, juniorTaskExecutions.kind).orderBy(asc(executionDate), asc(juniorTaskExecutions.kind));
124
- const byDate = /* @__PURE__ */ new Map();
125
- for (let offset = 0; offset < dayCount; offset += 1) {
126
- const date = utcDate(startMs + offset * 864e5);
127
- byDate.set(date, emptyDay(date));
128
- }
129
- for (const row of rows) {
130
- const day = byDate.get(row.date);
131
- if (!day) continue;
132
- if (row.kind === "scheduled") day.scheduled = row.count;
133
- else if (row.kind === "event") day.event = row.count;
134
- }
135
- return [...byDate.values()];
136
- }
137
-
138
- // src/chat/slack/conversation-context.ts
139
- function normalizeConversationName(type, channelName) {
140
- const trimmed = channelName?.trim();
141
- if (!trimmed) return void 0;
142
- if (type === "public_channel" || type === "private_channel" || type === "private_channel_or_group_dm") {
143
- return trimmed.startsWith("#") ? trimmed : `#${trimmed}`;
144
- }
145
- return trimmed;
146
- }
147
- function typeFromSlackChannelType(channelType) {
148
- if (channelType === "channel") return "public_channel";
149
- if (channelType === "group") return "private_channel";
150
- if (channelType === "mpim") return "group_dm";
151
- if (channelType === "im") return "direct_message";
152
- return void 0;
153
- }
154
- function typeFromChannelId(channelId, channelName) {
155
- const normalized = normalizeSlackConversationId(channelId);
156
- if (!normalized) return void 0;
157
- if (normalized.startsWith("C")) return "public_channel";
158
- if (normalized.startsWith("D")) return "direct_message";
159
- if (normalized.startsWith("G")) {
160
- return channelName?.trim().startsWith("mpdm-") ? "group_dm" : "private_channel_or_group_dm";
161
- }
162
- return void 0;
163
- }
164
- function toSlackEventChannelType(channelType) {
165
- if (channelType === "channel" || channelType === "group" || channelType === "mpim" || channelType === "im") {
166
- return channelType;
167
- }
168
- return void 0;
169
- }
170
- function conversationVisibilityFromSlackChannelType(channelType) {
171
- if (!channelType) return void 0;
172
- return channelType === "channel" ? "public" : "private";
173
- }
174
- function resolveSlackChannelTypeFromMessage(message) {
175
- const raw = message.raw;
176
- if (!raw || typeof raw !== "object") {
177
- return void 0;
178
- }
179
- const channelType = raw.channel_type;
180
- return typeof channelType === "string" ? toSlackEventChannelType(channelType.trim()) : void 0;
181
- }
182
- function resolveSlackConversationContext(input) {
183
- const type = typeFromSlackChannelType(input.channelType) ?? typeFromChannelId(input.channelId, input.channelName);
184
- if (!type) return void 0;
185
- const name = normalizeConversationName(type, input.channelName);
186
- const visibility = conversationVisibilityFromSlackChannelType(
187
- input.channelType
188
- );
189
- return {
190
- type,
191
- ...name ? { name } : {},
192
- ...visibility ? { visibility } : {}
193
- };
194
- }
195
- function resolveSlackConversationContextFromThreadId(input) {
196
- const slackThread = parseSlackThreadId(input.threadId);
197
- const context = resolveSlackConversationContext({
198
- channelId: slackThread?.channelId,
199
- channelName: input.channelName
200
- });
201
- if (!context || !input.visibility) {
202
- return context;
203
- }
204
- return {
205
- ...context,
206
- type: input.visibility === "private" && context.type === "public_channel" ? "private_channel" : context.type,
207
- visibility: input.visibility
208
- };
209
- }
210
- function formatSlackConversationTypeLabel(type) {
211
- if (type === "public_channel") return "Public Channel";
212
- if (type === "private_channel") return "Private Channel";
213
- if (type === "group_dm") return "Group DM";
214
- if (type === "direct_message") return "Direct Message";
215
- return "Private Channel or Group DM";
216
- }
217
- function formatSlackConversationRedactedLabel(context) {
218
- if (!context) return void 0;
219
- return formatSlackConversationTypeLabel(context.type);
220
- }
221
-
222
- export {
223
- readHealthReport,
224
- GET,
225
- recordTaskExecution,
226
- readTaskExecutionSummaries,
227
- readTaskExecutionDays,
228
- conversationVisibilityFromSlackChannelType,
229
- resolveSlackChannelTypeFromMessage,
230
- resolveSlackConversationContext,
231
- resolveSlackConversationContextFromThreadId,
232
- formatSlackConversationRedactedLabel
233
- };