@sentry/junior 0.76.1 → 0.78.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 (37) hide show
  1. package/dist/{agent-hooks-ZOE7RIED.js → agent-hooks-OFDNZJB2.js} +6 -4
  2. package/dist/api-reference.d.ts +2 -2
  3. package/dist/app.d.ts +27 -0
  4. package/dist/app.js +264 -21
  5. package/dist/build/copy-build-content.d.ts +2 -0
  6. package/dist/build/virtual-config.d.ts +3 -0
  7. package/dist/chat/conversations/store.d.ts +1 -1
  8. package/dist/chat/plugins/agent-hooks.d.ts +7 -1
  9. package/dist/chat/slack/dashboard-link.d.ts +9 -0
  10. package/dist/chat/state/adapter.d.ts +0 -1
  11. package/dist/chat/state/locks.d.ts +7 -0
  12. package/dist/chat/task-execution/state.d.ts +21 -1
  13. package/dist/{chunk-NYKJ3KON.js → chunk-237T7XAN.js} +3 -3
  14. package/dist/{chunk-FFGXUXMD.js → chunk-2MSW5BZY.js} +10 -10
  15. package/dist/{chunk-ZQB37HUX.js → chunk-C2YBH4S6.js} +1 -1
  16. package/dist/{chunk-XBBC6W45.js → chunk-KIDP757T.js} +1 -1
  17. package/dist/{chunk-R6Z5XWY3.js → chunk-LUNMJQ7D.js} +49 -3
  18. package/dist/{chunk-Y5OFBCBZ.js → chunk-LXTPBU4K.js} +14 -10
  19. package/dist/{chunk-JBASI5VV.js → chunk-PNGAJ75P.js} +2 -2
  20. package/dist/{chunk-KOIMO7S3.js → chunk-QDQVOMBA.js} +21 -2
  21. package/dist/{chunk-56TBVRJG.js → chunk-RARSKPVT.js} +1 -1
  22. package/dist/{chunk-NFTMTIP3.js → chunk-SSWBYEFH.js} +26 -2
  23. package/dist/{chunk-4SCWV7TJ.js → chunk-Y3EG7S7P.js} +1 -1
  24. package/dist/{chunk-ZLMBNBUG.js → chunk-YLVJRYTD.js} +9 -1
  25. package/dist/cli/chat.js +6 -6
  26. package/dist/cli/check.js +2 -2
  27. package/dist/cli/plugins.js +6 -6
  28. package/dist/cli/snapshot-warmup.js +3 -3
  29. package/dist/cli/upgrade.js +7 -7
  30. package/dist/{db-7A7PFRGL.js → db-NGQ3JCMF.js} +1 -1
  31. package/dist/nitro.d.ts +4 -0
  32. package/dist/nitro.js +59 -3
  33. package/dist/{registry-OIPAJU2O.js → registry-RRIDPJBT.js} +1 -1
  34. package/dist/reporting.js +13 -24
  35. package/dist/{runner-7Z4D6AKV.js → runner-WW4GJFUB.js} +9 -9
  36. package/dist/{validation-SLA6IGF7.js → validation-MDMYBRFB.js} +2 -2
  37. package/package.json +5 -5
package/dist/nitro.js CHANGED
@@ -54,6 +54,8 @@ function globToRegex(pattern) {
54
54
  }
55
55
 
56
56
  // src/build/copy-build-content.ts
57
+ var DASHBOARD_PACKAGE_NAME = "@sentry/junior-dashboard";
58
+ var DASHBOARD_ASSET_NAMES = ["client.js", "tailwind.css"];
57
59
  function copyAppAndPluginContent(cwd, serverRoot, packageNames) {
58
60
  copyIfExists(path.join(cwd, "app"), path.join(serverRoot, "app"));
59
61
  const packagedContent = discoverInstalledPluginPackageContent(cwd, {
@@ -83,6 +85,27 @@ function copyAppAndPluginContent(cwd, serverRoot, packageNames) {
83
85
  }
84
86
  }
85
87
  }
88
+ function copyDashboardAssets(cwd, serverRoot) {
89
+ const packageDir = resolvePackageDir(cwd, DASHBOARD_PACKAGE_NAME);
90
+ if (!packageDir) {
91
+ throw new Error(
92
+ `createApp({ dashboard }) requires installing "${DASHBOARD_PACKAGE_NAME}"`
93
+ );
94
+ }
95
+ for (const fileName of DASHBOARD_ASSET_NAMES) {
96
+ const source = dashboardAssetPath(packageDir, fileName);
97
+ copyIfExists(
98
+ source,
99
+ path.join(
100
+ serverRoot,
101
+ "node_modules",
102
+ DASHBOARD_PACKAGE_NAME,
103
+ "dist",
104
+ fileName
105
+ )
106
+ );
107
+ }
108
+ }
86
109
  function copyIncludedFiles(cwd, serverRoot, patterns) {
87
110
  if (patterns === void 0) return;
88
111
  if (!Array.isArray(patterns)) {
@@ -170,6 +193,20 @@ function copyIfExists(source, target) {
170
193
  cpSync(source, target, { recursive: true });
171
194
  return true;
172
195
  }
196
+ function dashboardAssetPath(packageDir, fileName) {
197
+ const candidates = [
198
+ path.join(packageDir, fileName),
199
+ path.join(packageDir, "dist", fileName)
200
+ ];
201
+ for (const candidate of candidates) {
202
+ if (existsSync(candidate)) {
203
+ return candidate;
204
+ }
205
+ }
206
+ throw new Error(
207
+ `Junior dashboard asset ${fileName} was not built; run pnpm --filter @sentry/junior-dashboard build before building Nitro`
208
+ );
209
+ }
173
210
  function copyRootIntoServerOutput(cwd, serverRoot, root) {
174
211
  copyIfExists(root, resolveServerOutputPath(cwd, serverRoot, root));
175
212
  }
@@ -205,14 +242,25 @@ function renderRuntimePluginImport(module) {
205
242
  }
206
243
  return `import { ${module.exportName} as juniorRuntimePluginSet } from ${JSON.stringify(module.specifier)};`;
207
244
  }
245
+ function renderDashboardImport(enabled) {
246
+ return enabled ? [
247
+ 'import { createDashboardApp as juniorCreateDashboardApp } from "@sentry/junior-dashboard";',
248
+ "export const createDashboardApp = juniorCreateDashboardApp;"
249
+ ] : ["export const createDashboardApp = undefined;"];
250
+ }
251
+ function dashboardEnabled(dashboard) {
252
+ return Boolean(dashboard && !dashboard.disabled);
253
+ }
208
254
  function renderVirtualConfig(options) {
209
255
  const lines = [
256
+ ...renderDashboardImport(dashboardEnabled(options.dashboard)),
210
257
  ...options.pluginModule ? [
211
258
  renderRuntimePluginImport(options.pluginModule),
212
259
  "export const pluginSet = juniorRuntimePluginSet;"
213
260
  ] : ["export const pluginSet = undefined;"],
214
261
  `export const plugins = ${JSON.stringify(options.plugins ?? { packages: [] })};`,
215
- `export const pluginRuntimeRegistrations = ${JSON.stringify(options.pluginRuntimeRegistrations ?? [])};`
262
+ `export const pluginRuntimeRegistrations = ${JSON.stringify(options.pluginRuntimeRegistrations ?? [])};`,
263
+ `export const dashboard = ${JSON.stringify(options.dashboard)};`
216
264
  ];
217
265
  return lines.join("\n");
218
266
  }
@@ -227,7 +275,8 @@ function injectVirtualConfig(nitro, options = {}) {
227
275
  plugins: pluginCatalogConfigFromPluginSet(pluginSet),
228
276
  pluginRuntimeRegistrations: pluginRuntimeRegistrationsFromPluginSet(
229
277
  pluginSet
230
- ).map((plugin) => plugin.manifest.name)
278
+ ).map((plugin) => plugin.manifest.name),
279
+ dashboard: options.dashboard
231
280
  });
232
281
  };
233
282
  }
@@ -255,6 +304,9 @@ function assertSerializableDirectPluginSet(pluginSet) {
255
304
  `juniorNitro({ plugins }) cannot receive a direct defineJuniorPlugins(...) set with runtime plugin registration(s): ${pluginRuntimeNames.join(", ")}. Export the set from a runtime-safe plugin module and pass juniorNitro({ plugins: "./plugins" }) so createApp() can import the same registrations at runtime.`
256
305
  );
257
306
  }
307
+ function dashboardEnabled2(dashboard) {
308
+ return Boolean(dashboard && !dashboard.disabled);
309
+ }
258
310
  function runtimeModuleForResolvedPluginModule(moduleRef) {
259
311
  return {
260
312
  exportName: moduleRef.exportName,
@@ -356,7 +408,8 @@ function juniorNitro(options = {}) {
356
408
  pluginModule: runtimeModuleForResolvedPluginModule(pluginModule)
357
409
  } : {},
358
410
  plugins: pluginCatalogConfig,
359
- pluginRuntimeRegistrations
411
+ pluginRuntimeRegistrations,
412
+ dashboard: options.dashboard
360
413
  });
361
414
  const copyBuildContent = async () => {
362
415
  const pluginSet = await loadConfiguredPluginSet();
@@ -366,6 +419,9 @@ function juniorNitro(options = {}) {
366
419
  nitro.options.output.serverDir,
367
420
  compiledPluginCatalogConfig?.packages
368
421
  );
422
+ if (dashboardEnabled2(options.dashboard)) {
423
+ copyDashboardAssets(cwd, nitro.options.output.serverDir);
424
+ }
369
425
  copyIncludedFiles(
370
426
  cwd,
371
427
  nitro.options.output.serverDir,
@@ -17,7 +17,7 @@ import {
17
17
  isPluginConfigKey,
18
18
  isPluginProvider,
19
19
  setPluginCatalogConfig
20
- } from "./chunk-ZLMBNBUG.js";
20
+ } from "./chunk-YLVJRYTD.js";
21
21
  import "./chunk-VALUBQ7R.js";
22
22
  import "./chunk-Q3XNY442.js";
23
23
  import "./chunk-EJN6G5A2.js";
package/dist/reporting.js CHANGED
@@ -6,21 +6,21 @@ import {
6
6
  getConversationDetails,
7
7
  getConversationDetailsForIds,
8
8
  resolveSlackConversationContextFromThreadId
9
- } from "./chunk-ZQB37HUX.js";
9
+ } from "./chunk-C2YBH4S6.js";
10
10
  import {
11
11
  buildSystemPrompt,
12
12
  getAgentTurnSessionRecord,
13
13
  listAgentTurnSessionSummariesForConversation
14
- } from "./chunk-KOIMO7S3.js";
14
+ } from "./chunk-QDQVOMBA.js";
15
15
  import {
16
16
  getPluginOperationalReports
17
- } from "./chunk-NFTMTIP3.js";
18
- import "./chunk-56TBVRJG.js";
17
+ } from "./chunk-SSWBYEFH.js";
18
+ import "./chunk-RARSKPVT.js";
19
19
  import {
20
20
  getConversationStore
21
- } from "./chunk-NYKJ3KON.js";
21
+ } from "./chunk-237T7XAN.js";
22
22
  import "./chunk-G3E7SCME.js";
23
- import "./chunk-Y5OFBCBZ.js";
23
+ import "./chunk-LXTPBU4K.js";
24
24
  import "./chunk-Q6XFTRV5.js";
25
25
  import {
26
26
  canExposeConversationPayload,
@@ -29,11 +29,11 @@ import {
29
29
  } from "./chunk-T77LUIX3.js";
30
30
  import {
31
31
  discoverSkills
32
- } from "./chunk-4SCWV7TJ.js";
32
+ } from "./chunk-Y3EG7S7P.js";
33
33
  import {
34
34
  getPluginPackageContent,
35
35
  getPluginProviders
36
- } from "./chunk-ZLMBNBUG.js";
36
+ } from "./chunk-YLVJRYTD.js";
37
37
  import {
38
38
  toStoredSlackRequester
39
39
  } from "./chunk-VALUBQ7R.js";
@@ -163,6 +163,9 @@ function statusFromConversation(conversation, fallback, nowMs) {
163
163
  if (conversation.execution.status === "idle") {
164
164
  return "completed";
165
165
  }
166
+ if (conversation.execution.status === "failed") {
167
+ return "failed";
168
+ }
166
169
  const updatedAtMs = conversation.execution.updatedAtMs ?? conversation.updatedAtMs;
167
170
  if (conversation.execution.status === "running" && nowMs - updatedAtMs > HUNG_TURN_PROGRESS_MS) {
168
171
  return "hung";
@@ -796,22 +799,8 @@ async function readConversationStatsReport(options = {}) {
796
799
  });
797
800
  const truncated = conversations.length > CONVERSATION_STATS_LIMIT;
798
801
  const sampledConversations = conversations.slice(0, CONVERSATION_STATS_LIMIT);
799
- const detailsByConversationId = await getConversationDetailsForIds(
800
- sampledConversations.map((conversation) => conversation.conversationId)
801
- );
802
- const reportsByConversation = await reportsFromConversations({
803
- conversations: sampledConversations,
804
- detailsByConversationId,
805
- nowMs
806
- });
807
- const sessions = sampledConversations.flatMap(
808
- (conversation) => reportsByConversation.get(conversation.conversationId) ?? [
809
- sessionReportFromConversation(
810
- conversation,
811
- nowMs,
812
- detailsByConversationId.get(conversation.conversationId)
813
- )
814
- ]
802
+ const sessions = sampledConversations.map(
803
+ (conversation) => sessionReportFromConversation(conversation, nowMs)
815
804
  );
816
805
  return buildConversationStatsReport({
817
806
  generatedAt,
@@ -14,28 +14,28 @@ import {
14
14
  startActiveTurn,
15
15
  updateConversationStats,
16
16
  upsertConversationMessage
17
- } from "./chunk-FFGXUXMD.js";
17
+ } from "./chunk-2MSW5BZY.js";
18
18
  import {
19
19
  coerceThreadConversationState
20
20
  } from "./chunk-Z4CIQ3EB.js";
21
- import "./chunk-JBASI5VV.js";
21
+ import "./chunk-PNGAJ75P.js";
22
22
  import "./chunk-KNFROR7R.js";
23
23
  import {
24
24
  commitMessages,
25
25
  loadProjection
26
- } from "./chunk-KOIMO7S3.js";
27
- import "./chunk-NFTMTIP3.js";
28
- import "./chunk-56TBVRJG.js";
29
- import "./chunk-NYKJ3KON.js";
26
+ } from "./chunk-QDQVOMBA.js";
27
+ import "./chunk-SSWBYEFH.js";
28
+ import "./chunk-RARSKPVT.js";
29
+ import "./chunk-237T7XAN.js";
30
30
  import "./chunk-G3E7SCME.js";
31
- import "./chunk-Y5OFBCBZ.js";
31
+ import "./chunk-LXTPBU4K.js";
32
32
  import "./chunk-Q6XFTRV5.js";
33
33
  import {
34
34
  stripRuntimeTurnContext,
35
35
  trimTrailingAssistantMessages
36
36
  } from "./chunk-T77LUIX3.js";
37
- import "./chunk-4SCWV7TJ.js";
38
- import "./chunk-ZLMBNBUG.js";
37
+ import "./chunk-Y3EG7S7P.js";
38
+ import "./chunk-YLVJRYTD.js";
39
39
  import "./chunk-VALUBQ7R.js";
40
40
  import "./chunk-Q3XNY442.js";
41
41
  import {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  validatePluginEgressCredentialHooks,
3
3
  validatePluginRegistrations
4
- } from "./chunk-XBBC6W45.js";
5
- import "./chunk-ZLMBNBUG.js";
4
+ } from "./chunk-KIDP757T.js";
5
+ import "./chunk-YLVJRYTD.js";
6
6
  import "./chunk-VALUBQ7R.js";
7
7
  import "./chunk-Q3XNY442.js";
8
8
  import "./chunk-EJN6G5A2.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior",
3
- "version": "0.76.1",
3
+ "version": "0.78.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -70,7 +70,7 @@
70
70
  "pg": "^8.16.3",
71
71
  "yaml": "^2.9.0",
72
72
  "zod": "^4.4.3",
73
- "@sentry/junior-plugin-api": "0.76.1"
73
+ "@sentry/junior-plugin-api": "0.78.0"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@emnapi/core": "^1.10.0",
@@ -86,9 +86,9 @@
86
86
  "typescript": "^6.0.3",
87
87
  "vercel": "^54.4.0",
88
88
  "vitest": "^4.1.7",
89
- "@sentry/junior-memory": "0.76.1",
90
- "@sentry/junior-scheduler": "0.76.1",
91
- "@sentry/junior-testing": "0.0.0"
89
+ "@sentry/junior-memory": "0.78.0",
90
+ "@sentry/junior-testing": "0.0.0",
91
+ "@sentry/junior-scheduler": "0.78.0"
92
92
  },
93
93
  "scripts": {
94
94
  "build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",