@sentry/junior 0.109.0 → 0.111.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 (123) hide show
  1. package/dist/{agent-hooks-FHHVLNPA.js → agent-hooks-QQ2IWKOP.js} +12 -13
  2. package/dist/api/conversations/access.d.ts +9 -0
  3. package/dist/api/conversations/aggregate.d.ts +12 -1
  4. package/dist/api/conversations/archive.d.ts +3 -5
  5. package/dist/api/conversations/detail.d.ts +156 -7
  6. package/dist/api/conversations/events.d.ts +1 -1
  7. package/dist/api/conversations/list.d.ts +57 -6
  8. package/dist/api/conversations/projection.d.ts +6 -7
  9. package/dist/api/conversations/reporting.d.ts +10 -4
  10. package/dist/api/conversations/routes.d.ts +2 -1
  11. package/dist/api/conversations/shared.d.ts +1 -1
  12. package/dist/api/conversations/stats.d.ts +37 -6
  13. package/dist/api/conversations/stats.query.d.ts +1 -1
  14. package/dist/api/conversations/usage.d.ts +9 -0
  15. package/dist/api/http.d.ts +7 -0
  16. package/dist/api/locations/detail.d.ts +102 -6
  17. package/dist/api/locations/list.d.ts +43 -5
  18. package/dist/api/locations/query.d.ts +4 -2
  19. package/dist/api/locations/routes.d.ts +2 -1
  20. package/dist/api/people/list.d.ts +28 -6
  21. package/dist/api/people/list.query.d.ts +1 -1
  22. package/dist/api/people/profile.d.ts +96 -7
  23. package/dist/api/people/profile.query.d.ts +4 -2
  24. package/dist/api/people/routes.d.ts +2 -1
  25. package/dist/api/people/shared.d.ts +1219 -2
  26. package/dist/api/route.d.ts +18 -4
  27. package/dist/api/schema/common.d.ts +6 -0
  28. package/dist/api/{conversations/schema.d.ts → schema/conversation.d.ts} +31 -3
  29. package/dist/api/{locations/schema.d.ts → schema/location.d.ts} +5 -0
  30. package/dist/api/{people/schema.d.ts → schema/person.d.ts} +37 -45
  31. package/dist/api/schema.d.ts +8 -22
  32. package/dist/api/schema.js +10 -2
  33. package/dist/api.d.ts +5 -1
  34. package/dist/api.js +767 -384
  35. package/dist/app.js +591 -447
  36. package/dist/build/virtual-config.d.ts +2 -0
  37. package/dist/catalog-runtime-D22W6QEJ.js +16 -0
  38. package/dist/chat/agent/request.d.ts +3 -6
  39. package/dist/chat/agent/resume.d.ts +11 -12
  40. package/dist/chat/agent/sandbox.d.ts +36 -11
  41. package/dist/chat/agent/tools.d.ts +5 -8
  42. package/dist/chat/config.d.ts +8 -1
  43. package/dist/chat/conversations/history.d.ts +3 -0
  44. package/dist/chat/conversations/sql/privacy.d.ts +3 -15
  45. package/dist/chat/pi/messages.d.ts +2 -2
  46. package/dist/chat/pi/sdk.d.ts +1 -1
  47. package/dist/chat/pi/sql-model-usage.d.ts +4 -1
  48. package/dist/chat/plugins/agent-hooks.d.ts +2 -2
  49. package/dist/chat/runtime/agent-continue-runner.d.ts +7 -3
  50. package/dist/chat/runtime/slack-runtime.d.ts +1 -2
  51. package/dist/chat/runtime/thread-state.d.ts +3 -7
  52. package/dist/chat/runtime/turn-preparation.d.ts +2 -2
  53. package/dist/chat/sandbox/command-result.d.ts +91 -0
  54. package/dist/chat/sandbox/errors.d.ts +3 -1
  55. package/dist/chat/sandbox/ref.d.ts +5 -0
  56. package/dist/chat/sandbox/sandbox.d.ts +19 -46
  57. package/dist/chat/sandbox/session.d.ts +16 -20
  58. package/dist/chat/sandbox/skill-sync.d.ts +2 -2
  59. package/dist/chat/sandbox/workspace.d.ts +14 -12
  60. package/dist/chat/services/auth-pause.d.ts +4 -0
  61. package/dist/chat/services/context-compaction.d.ts +1 -0
  62. package/dist/chat/services/turn-result.d.ts +3 -4
  63. package/dist/chat/task-execution/queue-signing.d.ts +10 -8
  64. package/dist/chat/task-execution/queue.d.ts +9 -7
  65. package/dist/chat/task-execution/slack-work.d.ts +9 -7
  66. package/dist/chat/task-execution/state.d.ts +75 -22
  67. package/dist/chat/task-execution/store.d.ts +34 -3
  68. package/dist/chat/task-execution/worker.d.ts +0 -1
  69. package/dist/chat/tool-support/normalize-result.d.ts +2 -2
  70. package/dist/chat/tool-support/pi-tool-adapter.d.ts +2 -2
  71. package/dist/chat/tool-support/structured-result.d.ts +1 -2
  72. package/dist/chat/tools/sandbox/file-uploads.d.ts +1 -1
  73. package/dist/chat/{runtime → tools/sandbox}/generated-artifacts.d.ts +3 -3
  74. package/dist/chat/tools/types.d.ts +1 -1
  75. package/dist/chat/tools/web/fetch-content.d.ts +5 -0
  76. package/dist/chat/tools/web/image-generate.d.ts +2 -1
  77. package/dist/chat/tools/web/search.d.ts +1 -1
  78. package/dist/{chunk-CEA3A3UA.js → chunk-2ZTTXTSZ.js} +24 -1
  79. package/dist/{chunk-IVVGFRQQ.js → chunk-42WRQLJ6.js} +10 -38
  80. package/dist/{chunk-O3JMSZLI.js → chunk-6Y5L4BOM.js} +3 -5
  81. package/dist/{chunk-HO5NT6OE.js → chunk-B45FPP2A.js} +306 -31
  82. package/dist/{chunk-WHMOBKT7.js → chunk-BTRNMS6A.js} +2 -2
  83. package/dist/{chunk-PLB7MRCQ.js → chunk-C4MZ3GP5.js} +1 -1
  84. package/dist/{chunk-HHVY4SMP.js → chunk-FPK7XY3F.js} +98 -92
  85. package/dist/{chunk-RGX4V75M.js → chunk-IFAHK54X.js} +3 -3
  86. package/dist/{chunk-ISMWX44P.js → chunk-J7APPQIJ.js} +2 -2
  87. package/dist/{chunk-TMBRFULF.js → chunk-JQFJO5WH.js} +7 -1
  88. package/dist/{chunk-FWJRXN4F.js → chunk-L6JPKANW.js} +3 -139
  89. package/dist/{chunk-7Q6WCISF.js → chunk-MIAKQNYX.js} +43 -31
  90. package/dist/chunk-MPVES2IC.js +44 -0
  91. package/dist/{chunk-JNAVF45E.js → chunk-NQLWOTY4.js} +47 -19
  92. package/dist/{chunk-IXKSQGIO.js → chunk-OOLU34J4.js} +8860 -9137
  93. package/dist/{chunk-OUHNWH46.js → chunk-PYKKM4MM.js} +1 -1
  94. package/dist/{chunk-MXW4GL53.js → chunk-PZELBSHC.js} +8 -9
  95. package/dist/{chunk-QY636HZU.js → chunk-QQIVLZW4.js} +96 -17
  96. package/dist/{chunk-72OMGPDS.js → chunk-SL3ZKNLQ.js} +19 -18
  97. package/dist/{chunk-3SXUV423.js → chunk-WSRBFHPX.js} +1 -1
  98. package/dist/{chunk-TT6GMXNA.js → chunk-XQAYFRWT.js} +2 -2
  99. package/dist/{chunk-MGUMR35T.js → chunk-Z2W4SJZ7.js} +1 -1
  100. package/dist/{chunk-OCD3OZRK.js → chunk-Z4G3WCP3.js} +1 -1
  101. package/dist/{chunk-FENLIFJD.js → chunk-ZRZ4SVWG.js} +69 -10
  102. package/dist/cli/chat.js +23 -24
  103. package/dist/cli/check.js +8 -8
  104. package/dist/cli/plugins.js +15 -16
  105. package/dist/cli/snapshot-warmup.js +11 -11
  106. package/dist/cli/upgrade.js +9 -9
  107. package/dist/db/schema/conversations.d.ts +17 -0
  108. package/dist/db/schema.d.ts +17 -0
  109. package/dist/{db-V3NU72O2.js → db-WXQOQESG.js} +8 -9
  110. package/dist/instrumentation.js +4 -4
  111. package/dist/nitro.js +15 -10
  112. package/dist/reporting-schema.d.ts +46 -0
  113. package/dist/{runner-JYBCQBLK.js → runner-4QY4XH4B.js} +23 -33
  114. package/dist/{skills-U6MDAST7.js → skills-P5MU4EBX.js} +8 -8
  115. package/dist/{validation-72N3JVRU.js → validation-PQF5OP6T.js} +8 -8
  116. package/dist/version.js +1 -1
  117. package/migrations/0007_thick_sugar_man.sql +23 -0
  118. package/migrations/meta/0007_snapshot.json +1013 -0
  119. package/migrations/meta/_journal.json +7 -0
  120. package/package.json +6 -6
  121. package/dist/catalog-runtime-DMGJSLV2.js +0 -16
  122. package/dist/chunk-OB42YVAE.js +0 -16
  123. package/dist/chunk-SYAQIR5Z.js +0 -53
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getChatConfig
3
- } from "./chunk-JNAVF45E.js";
3
+ } from "./chunk-NQLWOTY4.js";
4
4
 
5
5
  // src/chat/state/adapter.ts
6
6
  import { createMemoryState } from "@chat-adapter/state-memory";
@@ -14,20 +14,20 @@ import {
14
14
  markTurnCompleted,
15
15
  mergeArtifactsState,
16
16
  updateConversationStats
17
- } from "./chunk-72OMGPDS.js";
17
+ } from "./chunk-SL3ZKNLQ.js";
18
18
  import {
19
19
  createPluginEmbedder,
20
20
  createPluginLogger,
21
21
  createPluginModel,
22
22
  createPluginState,
23
23
  getPlugins
24
- } from "./chunk-QY636HZU.js";
24
+ } from "./chunk-QQIVLZW4.js";
25
25
  import {
26
26
  getStateAdapter
27
- } from "./chunk-OUHNWH46.js";
27
+ } from "./chunk-PYKKM4MM.js";
28
28
  import {
29
29
  getDb
30
- } from "./chunk-FENLIFJD.js";
30
+ } from "./chunk-ZRZ4SVWG.js";
31
31
  import {
32
32
  getPiMessageRole,
33
33
  instructionTextForProjection,
@@ -35,13 +35,13 @@ import {
35
35
  isToolResultMessage,
36
36
  normalizeToolNameFromResult,
37
37
  stripRuntimeTurnContext
38
- } from "./chunk-JNAVF45E.js";
38
+ } from "./chunk-NQLWOTY4.js";
39
39
  import {
40
40
  buildTurnFailureResponse
41
- } from "./chunk-ISMWX44P.js";
41
+ } from "./chunk-J7APPQIJ.js";
42
42
  import {
43
43
  parseSlackMessageTs
44
- } from "./chunk-IVVGFRQQ.js";
44
+ } from "./chunk-42WRQLJ6.js";
45
45
 
46
46
  // src/chat/services/turn-failure-response.ts
47
47
  function requireTurnFailureEventId(eventId, eventName) {
@@ -514,8 +514,7 @@ function buildDeliveredTurnStatePatch(args) {
514
514
  return {
515
515
  artifacts,
516
516
  conversation,
517
- sandboxId: args.reply.sandboxId,
518
- sandboxDependencyProfileHash: args.reply.sandboxDependencyProfileHash
517
+ sandboxRef: args.reply.sandboxRef
519
518
  };
520
519
  }
521
520
 
@@ -1,36 +1,36 @@
1
1
  import {
2
2
  SANDBOX_WORKSPACE_ROOT,
3
3
  getStateAdapter
4
- } from "./chunk-OUHNWH46.js";
4
+ } from "./chunk-PYKKM4MM.js";
5
5
  import {
6
6
  isConversationChannel,
7
7
  isConversationScopedChannel,
8
8
  isDmChannel,
9
9
  normalizeSlackConversationId
10
- } from "./chunk-RGX4V75M.js";
10
+ } from "./chunk-IFAHK54X.js";
11
11
  import {
12
12
  getDb
13
- } from "./chunk-FENLIFJD.js";
13
+ } from "./chunk-ZRZ4SVWG.js";
14
14
  import {
15
15
  botConfig,
16
16
  completeObject,
17
17
  embedTexts,
18
18
  standardModelId
19
- } from "./chunk-JNAVF45E.js";
19
+ } from "./chunk-NQLWOTY4.js";
20
20
  import {
21
21
  isActorUserId,
22
22
  parseActorUserId
23
- } from "./chunk-PLB7MRCQ.js";
23
+ } from "./chunk-C4MZ3GP5.js";
24
24
  import {
25
25
  logException,
26
26
  logInfo,
27
27
  logWarn
28
- } from "./chunk-ISMWX44P.js";
28
+ } from "./chunk-J7APPQIJ.js";
29
29
  import {
30
30
  parseSlackChannelReferenceId,
31
31
  parseSlackMessageTs,
32
32
  parseSlackTeamId
33
- } from "./chunk-IVVGFRQQ.js";
33
+ } from "./chunk-42WRQLJ6.js";
34
34
 
35
35
  // src/chat/plugins/agent-hooks.ts
36
36
  import {
@@ -406,6 +406,9 @@ var registeredPlugins = [];
406
406
  var PLUGIN_NAME_RE = /^[a-z][a-z0-9-]*$/;
407
407
  var PLUGIN_TOOL_NAME_RE = /^[a-z][A-Za-z0-9]*$/;
408
408
  var OPERATIONAL_REPORT_MAX_METRICS = 8;
409
+ var OPERATIONAL_REPORT_MAX_WIDGETS = 12;
410
+ var OPERATIONAL_REPORT_MAX_CHART_SERIES = 8;
411
+ var OPERATIONAL_REPORT_MAX_CHART_CATEGORIES = 100;
409
412
  var OPERATIONAL_REPORT_MAX_RECORD_SETS = 8;
410
413
  var OPERATIONAL_REPORT_MAX_FIELDS = 8;
411
414
  var OPERATIONAL_REPORT_MAX_RECORDS = 25;
@@ -1004,6 +1007,83 @@ function sanitizeOperationalReport(args) {
1004
1007
  }).filter(
1005
1008
  (recordSet) => Boolean(recordSet)
1006
1009
  );
1010
+ const widgets = args.report.widgets?.slice(0, OPERATIONAL_REPORT_MAX_WIDGETS).map((widget, widgetIndex) => {
1011
+ const id = operationalReportText(widget.id, OPERATIONAL_REPORT_MAX_LABEL_LENGTH) ?? String(widgetIndex);
1012
+ const title2 = operationalReportText(
1013
+ widget.title,
1014
+ OPERATIONAL_REPORT_MAX_LABEL_LENGTH
1015
+ );
1016
+ if (!title2) {
1017
+ return void 0;
1018
+ }
1019
+ const seriesEntries = widget.series.slice(0, OPERATIONAL_REPORT_MAX_CHART_SERIES).map((item) => {
1020
+ const key = operationalReportText(
1021
+ item.key,
1022
+ OPERATIONAL_REPORT_MAX_LABEL_LENGTH
1023
+ );
1024
+ const label = operationalReportText(
1025
+ item.label,
1026
+ OPERATIONAL_REPORT_MAX_LABEL_LENGTH
1027
+ );
1028
+ if (!key || !label) {
1029
+ return void 0;
1030
+ }
1031
+ const sanitizedSeries = { key, label };
1032
+ const tone = operationalReportTone(item.tone);
1033
+ if (tone) {
1034
+ sanitizedSeries.tone = tone;
1035
+ }
1036
+ return { sanitizedSeries, sourceKey: item.key };
1037
+ }).filter((item) => Boolean(item));
1038
+ if (!seriesEntries.length) {
1039
+ return void 0;
1040
+ }
1041
+ const series = seriesEntries.map((item) => item.sanitizedSeries);
1042
+ const categories = widget.categories.slice(-OPERATIONAL_REPORT_MAX_CHART_CATEGORIES).map((category, categoryIndex) => ({
1043
+ id: operationalReportText(
1044
+ category.id,
1045
+ OPERATIONAL_REPORT_MAX_LABEL_LENGTH
1046
+ ) ?? `${widgetIndex}:${categoryIndex}`,
1047
+ label: operationalReportText(
1048
+ category.label,
1049
+ OPERATIONAL_REPORT_MAX_LABEL_LENGTH
1050
+ ) ?? String(categoryIndex + 1),
1051
+ values: Object.fromEntries(
1052
+ seriesEntries.map(({ sanitizedSeries, sourceKey }) => [
1053
+ sanitizedSeries.key,
1054
+ Number.isFinite(category.values[sourceKey]) ? category.values[sourceKey] : 0
1055
+ ])
1056
+ )
1057
+ }));
1058
+ const sanitizedWidget = {
1059
+ categories,
1060
+ id,
1061
+ series,
1062
+ title: title2,
1063
+ type: "bar_chart"
1064
+ };
1065
+ const description = operationalReportText(
1066
+ widget.description,
1067
+ OPERATIONAL_REPORT_MAX_VALUE_LENGTH
1068
+ );
1069
+ if (description) {
1070
+ sanitizedWidget.description = description;
1071
+ }
1072
+ const emptyText = operationalReportText(
1073
+ widget.emptyText,
1074
+ OPERATIONAL_REPORT_MAX_VALUE_LENGTH
1075
+ );
1076
+ if (emptyText) {
1077
+ sanitizedWidget.emptyText = emptyText;
1078
+ }
1079
+ const timeRangeDays = widget.timeRangeDays?.filter(
1080
+ (days) => days === 7 || days === 30 || days === 90
1081
+ );
1082
+ if (timeRangeDays?.length) {
1083
+ sanitizedWidget.timeRangeDays = [...new Set(timeRangeDays)];
1084
+ }
1085
+ return sanitizedWidget;
1086
+ }).filter((widget) => Boolean(widget));
1007
1087
  const sanitized = {
1008
1088
  pluginName: args.pluginName
1009
1089
  };
@@ -1020,6 +1100,9 @@ function sanitizeOperationalReport(args) {
1020
1100
  if (metrics?.length) {
1021
1101
  sanitized.metrics = metrics;
1022
1102
  }
1103
+ if (widgets?.length) {
1104
+ sanitized.widgets = widgets;
1105
+ }
1023
1106
  const title = operationalReportText(
1024
1107
  args.report.title,
1025
1108
  OPERATIONAL_REPORT_MAX_LABEL_LENGTH
@@ -1089,27 +1172,23 @@ function normalizeEnv(value) {
1089
1172
  }
1090
1173
  return env;
1091
1174
  }
1092
- function createSandboxCapability(sandbox) {
1175
+ function createSandboxCapability(workspace) {
1093
1176
  return {
1094
1177
  root: SANDBOX_WORKSPACE_ROOT,
1095
1178
  juniorRoot: `${SANDBOX_WORKSPACE_ROOT}/.junior`,
1096
1179
  async readFile(filePath) {
1097
- return await sandbox.readFileToBuffer({ path: filePath }) ?? null;
1180
+ return await workspace.readFileToBuffer({ path: filePath }) ?? null;
1098
1181
  },
1099
1182
  async run(input) {
1100
- const result = await sandbox.runCommand(input);
1101
- const [stdout, stderr] = await Promise.all([
1102
- result.stdout(),
1103
- result.stderr()
1104
- ]);
1183
+ const result = await workspace.runCommand(input);
1105
1184
  return {
1106
1185
  exitCode: result.exitCode,
1107
- stdout,
1108
- stderr
1186
+ stdout: result.stdout,
1187
+ stderr: result.stderr
1109
1188
  };
1110
1189
  },
1111
1190
  async writeFile(input) {
1112
- await sandbox.writeFiles([
1191
+ await workspace.writeFiles([
1113
1192
  {
1114
1193
  path: input.path,
1115
1194
  content: input.content,
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-MU6HHZEN.js";
5
5
  import {
6
6
  getStateAdapter
7
- } from "./chunk-OUHNWH46.js";
7
+ } from "./chunk-PYKKM4MM.js";
8
8
  import {
9
9
  contextProvenance,
10
10
  createSqlConversationEventStore,
@@ -15,7 +15,7 @@ import {
15
15
  instructionProvenanceFor,
16
16
  sanitizePostgresJson,
17
17
  withConversationEventLock
18
- } from "./chunk-FENLIFJD.js";
18
+ } from "./chunk-ZRZ4SVWG.js";
19
19
  import {
20
20
  sleep
21
21
  } from "./chunk-4ZNGQH7C.js";
@@ -28,24 +28,22 @@ import {
28
28
  standardModelId,
29
29
  stripRuntimeTurnContext,
30
30
  trimTrailingAssistantMessages
31
- } from "./chunk-JNAVF45E.js";
31
+ } from "./chunk-NQLWOTY4.js";
32
32
  import {
33
33
  toStoredSlackActor
34
- } from "./chunk-PLB7MRCQ.js";
34
+ } from "./chunk-C4MZ3GP5.js";
35
35
  import {
36
36
  getActiveTraceId,
37
37
  logException,
38
38
  logWarn,
39
39
  setSpanAttributes
40
- } from "./chunk-ISMWX44P.js";
40
+ } from "./chunk-J7APPQIJ.js";
41
41
  import {
42
42
  isRecord,
43
+ parseSlackMessageTs,
43
44
  toOptionalNumber,
44
45
  toOptionalString
45
- } from "./chunk-OB42YVAE.js";
46
- import {
47
- parseSlackMessageTs
48
- } from "./chunk-IVVGFRQQ.js";
46
+ } from "./chunk-42WRQLJ6.js";
49
47
 
50
48
  // src/chat/conversations/projection.ts
51
49
  import { isDeepStrictEqual } from "util";
@@ -2354,11 +2352,9 @@ function buildThreadStatePayload(patch) {
2354
2352
  if (patch.conversation) {
2355
2353
  Object.assign(payload, buildConversationStatePatch(patch.conversation));
2356
2354
  }
2357
- if (patch.sandboxId !== void 0) {
2358
- payload.app_sandbox_id = patch.sandboxId;
2359
- }
2360
- if (patch.sandboxDependencyProfileHash !== void 0) {
2361
- payload.app_sandbox_dependency_profile_hash = patch.sandboxDependencyProfileHash;
2355
+ if (patch.sandboxRef !== void 0) {
2356
+ payload.app_sandbox_id = patch.sandboxRef?.id ?? "";
2357
+ payload.app_sandbox_dependency_profile_hash = patch.sandboxRef?.profileHash ?? "";
2362
2358
  }
2363
2359
  return payload;
2364
2360
  }
@@ -2376,11 +2372,16 @@ function mergeArtifactsState(artifacts, patch) {
2376
2372
  };
2377
2373
  }
2378
2374
  function getPersistedSandboxState(state) {
2375
+ const id = toOptionalString(state.app_sandbox_id);
2376
+ if (!id) {
2377
+ return void 0;
2378
+ }
2379
+ const profileHash = toOptionalString(
2380
+ state.app_sandbox_dependency_profile_hash
2381
+ );
2379
2382
  return {
2380
- sandboxId: toOptionalString(state.app_sandbox_id),
2381
- sandboxDependencyProfileHash: toOptionalString(
2382
- state.app_sandbox_dependency_profile_hash
2383
- )
2383
+ id,
2384
+ ...profileHash ? { profileHash } : {}
2384
2385
  };
2385
2386
  }
2386
2387
  async function persistThreadState(thread, patch) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createPluginCatalogRuntime
3
- } from "./chunk-TT6GMXNA.js";
3
+ } from "./chunk-XQAYFRWT.js";
4
4
 
5
5
  // src/chat/plugins/catalog-runtime.ts
6
6
  var pluginCatalogRuntime = createPluginCatalogRuntime();
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  parseActorUserId
3
- } from "./chunk-PLB7MRCQ.js";
3
+ } from "./chunk-C4MZ3GP5.js";
4
4
  import {
5
5
  logInfo,
6
6
  logWarn,
7
7
  setSpanAttributes
8
- } from "./chunk-ISMWX44P.js";
8
+ } from "./chunk-J7APPQIJ.js";
9
9
  import {
10
10
  discoverInstalledPluginPackageContent,
11
11
  normalizePluginPackageNames
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-3SXUV423.js";
3
+ } from "./chunk-WSRBFHPX.js";
4
4
 
5
5
  // src/chat/plugins/validation.ts
6
6
  import { isDeepStrictEqual } from "util";
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@sentry/junior",
4
- version: "0.109.0",
4
+ version: "0.111.0",
5
5
  private: false,
6
6
  publishConfig: {
7
7
  access: "public"
@@ -4,26 +4,67 @@ import {
4
4
  juniorConversations,
5
5
  juniorIdentities,
6
6
  juniorUsers
7
- } from "./chunk-TMBRFULF.js";
7
+ } from "./chunk-JQFJO5WH.js";
8
8
  import {
9
9
  getChatConfig,
10
10
  modelProfileSchema
11
- } from "./chunk-JNAVF45E.js";
11
+ } from "./chunk-NQLWOTY4.js";
12
12
  import {
13
13
  juniorDestinations
14
14
  } from "./chunk-VFUK3X5B.js";
15
- import {
16
- parseDestination,
17
- sameDestination
18
- } from "./chunk-SYAQIR5Z.js";
19
15
  import {
20
16
  normalizeIdentityEmail
21
- } from "./chunk-ISMWX44P.js";
17
+ } from "./chunk-J7APPQIJ.js";
18
+ import {
19
+ parseSlackChannelReferenceId,
20
+ parseSlackTeamId
21
+ } from "./chunk-42WRQLJ6.js";
22
22
 
23
23
  // src/chat/conversations/sql/store.ts
24
24
  import { randomUUID as randomUUID2 } from "crypto";
25
25
  import { and as and2, asc, desc, eq as eq2, isNull, sql as sql2 } from "drizzle-orm";
26
26
 
27
+ // src/chat/destination.ts
28
+ import {
29
+ destinationSchema
30
+ } from "@sentry/junior-plugin-api";
31
+ function createSlackDestination(input) {
32
+ const channelId = parseSlackChannelReferenceId(input.channelId);
33
+ const teamId = parseSlackTeamId(input.teamId);
34
+ if (!channelId || !teamId) {
35
+ return void 0;
36
+ }
37
+ return { platform: "slack", teamId, channelId };
38
+ }
39
+ function parseDestination(value) {
40
+ const parsed = destinationSchema.safeParse(value);
41
+ return parsed.success ? parsed.data : void 0;
42
+ }
43
+ function requireSlackDestination(destination, action) {
44
+ if (destination?.platform === "slack") {
45
+ return destination;
46
+ }
47
+ throw new Error(`${action} requires a Slack destination`);
48
+ }
49
+ function sameDestination(left, right) {
50
+ if (left.platform !== right.platform) {
51
+ return false;
52
+ }
53
+ if (left.platform === "local" && right.platform === "local") {
54
+ return left.conversationId === right.conversationId;
55
+ }
56
+ if (left.platform === "slack" && right.platform === "slack") {
57
+ return left.teamId === right.teamId && left.channelId === right.channelId;
58
+ }
59
+ return false;
60
+ }
61
+ function destinationKey(destination) {
62
+ if (destination.platform === "local") {
63
+ return destination.conversationId;
64
+ }
65
+ return `slack:${destination.teamId}:${destination.channelId}`;
66
+ }
67
+
27
68
  // src/chat/identities/sql.ts
28
69
  import { randomUUID } from "crypto";
29
70
  import { and, eq, sql } from "drizzle-orm";
@@ -592,7 +633,12 @@ var SqlStore = class {
592
633
  actorIdentityObservation,
593
634
  conversation.updatedAtMs
594
635
  ) : void 0;
595
- await this.executor.db().insert(juniorConversations).values({
636
+ const rootConversationId = conversation.lineage ? sql2`(
637
+ select parent.root_conversation_id
638
+ from junior_conversations parent
639
+ where parent.conversation_id = ${conversation.lineage.parentConversationId}
640
+ )` : conversation.conversationId;
641
+ const rows = await this.executor.db().insert(juniorConversations).values({
596
642
  conversationId: conversation.conversationId,
597
643
  schemaVersion: 1,
598
644
  source: conversation.source ?? null,
@@ -615,7 +661,8 @@ var SqlStore = class {
615
661
  runId: conversation.execution.runId ?? null,
616
662
  lastCheckpointAt: conversation.execution.lastCheckpointAtMs === void 0 ? null : dateFromMs2(conversation.execution.lastCheckpointAtMs),
617
663
  lastEnqueuedAt: conversation.execution.lastEnqueuedAtMs === void 0 ? null : dateFromMs2(conversation.execution.lastEnqueuedAtMs),
618
- parentConversationId: conversation.lineage?.parentConversationId ?? null
664
+ parentConversationId: conversation.lineage?.parentConversationId ?? null,
665
+ rootConversationId
619
666
  }).onConflictDoUpdate({
620
667
  target: juniorConversations.conversationId,
621
668
  set: {
@@ -636,9 +683,15 @@ var SqlStore = class {
636
683
  executionStatus: sql2`case when ${incomingExecutionIsFresh} then excluded.execution_status else ${juniorConversations.executionStatus} end`,
637
684
  runId: sql2`case when ${incomingExecutionIsFresh} then excluded.run_id else ${juniorConversations.runId} end`,
638
685
  lastCheckpointAt: sql2`case when ${incomingExecutionIsFresh} then coalesce(excluded.last_checkpoint_at, ${juniorConversations.lastCheckpointAt}) else ${juniorConversations.lastCheckpointAt} end`,
639
- lastEnqueuedAt: sql2`case when ${incomingExecutionIsFresh} then coalesce(excluded.last_enqueued_at, ${juniorConversations.lastEnqueuedAt}) else ${juniorConversations.lastEnqueuedAt} end`
686
+ lastEnqueuedAt: sql2`case when ${incomingExecutionIsFresh} then coalesce(excluded.last_enqueued_at, ${juniorConversations.lastEnqueuedAt}) else ${juniorConversations.lastEnqueuedAt} end`,
687
+ rootConversationId: sql2`coalesce(${juniorConversations.rootConversationId}, excluded.root_conversation_id)`
640
688
  }
689
+ }).returning({
690
+ rootConversationId: juniorConversations.rootConversationId
641
691
  });
692
+ if (!rows[0]?.rootConversationId) {
693
+ throw new Error("Conversation parent is missing its persisted root");
694
+ }
642
695
  }
643
696
  async upsertDestination(destination, nowMs) {
644
697
  if (!destination) {
@@ -761,6 +814,7 @@ var historyReplacementEventDataSchema = z2.discriminatedUnion("type", [
761
814
  type: z2.literal("handoff"),
762
815
  modelProfile: handoffModelProfileSchema,
763
816
  modelId: z2.string().min(1),
817
+ reasoningLevel: z2.string().min(1).optional(),
764
818
  triggeringToolCallId: z2.string().min(1).optional(),
765
819
  replacementHistory: replacementHistorySchema
766
820
  }).strict(),
@@ -1344,6 +1398,11 @@ async function closeDb() {
1344
1398
  }
1345
1399
 
1346
1400
  export {
1401
+ createSlackDestination,
1402
+ parseDestination,
1403
+ requireSlackDestination,
1404
+ sameDestination,
1405
+ destinationKey,
1347
1406
  instructionProvenanceFor,
1348
1407
  contextProvenance,
1349
1408
  instructionActors,
package/dist/cli/chat.js CHANGED
@@ -1,36 +1,35 @@
1
1
  import {
2
2
  createAgentRunner,
3
3
  executeAgentRun
4
- } from "../chunk-IXKSQGIO.js";
5
- import "../chunk-72OMGPDS.js";
6
- import "../chunk-HO5NT6OE.js";
4
+ } from "../chunk-OOLU34J4.js";
5
+ import "../chunk-SL3ZKNLQ.js";
6
+ import "../chunk-B45FPP2A.js";
7
7
  import "../chunk-MU6HHZEN.js";
8
8
  import "../chunk-PDO5BLNM.js";
9
9
  import "../chunk-UIE3R5XU.js";
10
10
  import {
11
11
  loadAppPluginSet
12
12
  } from "../chunk-Y2CM7HXH.js";
13
- import "../chunk-QY636HZU.js";
14
- import "../chunk-OUHNWH46.js";
15
- import "../chunk-RGX4V75M.js";
16
- import "../chunk-FENLIFJD.js";
17
- import "../chunk-TMBRFULF.js";
13
+ import "../chunk-QQIVLZW4.js";
14
+ import "../chunk-PYKKM4MM.js";
15
+ import "../chunk-IFAHK54X.js";
16
+ import "../chunk-ZRZ4SVWG.js";
17
+ import "../chunk-JQFJO5WH.js";
18
18
  import "../chunk-4ZNGQH7C.js";
19
- import "../chunk-JNAVF45E.js";
19
+ import "../chunk-NQLWOTY4.js";
20
20
  import "../chunk-VFUK3X5B.js";
21
- import "../chunk-O3JMSZLI.js";
22
- import "../chunk-SYAQIR5Z.js";
23
- import "../chunk-WHMOBKT7.js";
24
- import "../chunk-3SXUV423.js";
25
- import "../chunk-TT6GMXNA.js";
26
- import "../chunk-PLB7MRCQ.js";
27
- import "../chunk-ISMWX44P.js";
28
- import "../chunk-OB42YVAE.js";
21
+ import "../chunk-6Y5L4BOM.js";
22
+ import "../chunk-BTRNMS6A.js";
23
+ import "../chunk-WSRBFHPX.js";
24
+ import "../chunk-XQAYFRWT.js";
25
+ import "../chunk-C4MZ3GP5.js";
26
+ import "../chunk-J7APPQIJ.js";
27
+ import "../chunk-42WRQLJ6.js";
29
28
  import "../chunk-6GWA276C.js";
30
29
  import "../chunk-B3IT5END.js";
31
30
  import "../chunk-3V7OFJZC.js";
32
- import "../chunk-IVVGFRQQ.js";
33
- import "../chunk-OCD3OZRK.js";
31
+ import "../chunk-MPVES2IC.js";
32
+ import "../chunk-Z4G3WCP3.js";
34
33
  import "../chunk-MLKGABMK.js";
35
34
 
36
35
  // src/cli/chat.ts
@@ -153,10 +152,10 @@ async function configureLocalChatPlugins(pluginSet) {
153
152
  databaseModule
154
153
  ] = await Promise.all([
155
154
  import("../plugins-PZMDS7AT.js"),
156
- import("../agent-hooks-FHHVLNPA.js"),
157
- import("../catalog-runtime-DMGJSLV2.js"),
158
- import("../validation-72N3JVRU.js"),
159
- import("../db-V3NU72O2.js")
155
+ import("../agent-hooks-QQ2IWKOP.js"),
156
+ import("../catalog-runtime-D22W6QEJ.js"),
157
+ import("../validation-PQF5OP6T.js"),
158
+ import("../db-WXQOQESG.js")
160
159
  ]);
161
160
  const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
162
161
  const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
@@ -217,7 +216,7 @@ function newRunConversationId() {
217
216
  async function prepareLocalChatRun(io, pluginSet) {
218
217
  defaultStateAdapterForLocalChat();
219
218
  await configureLocalChatPlugins(pluginSet);
220
- const { runLocalAgentTurn } = await import("../runner-JYBCQBLK.js");
219
+ const { runLocalAgentTurn } = await import("../runner-4QY4XH4B.js");
221
220
  const deps = {
222
221
  agentRunner: createAgentRunner(executeAgentRun),
223
222
  deliverReply: async (reply) => {
package/dist/cli/check.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  parseSkillFile
3
- } from "../chunk-WHMOBKT7.js";
4
- import "../chunk-3SXUV423.js";
3
+ } from "../chunk-BTRNMS6A.js";
4
+ import "../chunk-WSRBFHPX.js";
5
5
  import {
6
6
  parseInlinePluginManifest,
7
7
  parsePluginManifest
8
- } from "../chunk-TT6GMXNA.js";
9
- import "../chunk-PLB7MRCQ.js";
10
- import "../chunk-ISMWX44P.js";
11
- import "../chunk-OB42YVAE.js";
8
+ } from "../chunk-XQAYFRWT.js";
9
+ import "../chunk-C4MZ3GP5.js";
10
+ import "../chunk-J7APPQIJ.js";
11
+ import "../chunk-42WRQLJ6.js";
12
12
  import "../chunk-6GWA276C.js";
13
13
  import "../chunk-B3IT5END.js";
14
14
  import "../chunk-3V7OFJZC.js";
@@ -16,8 +16,8 @@ import {
16
16
  JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
17
17
  JUNIOR_HEARTBEAT_ROUTE,
18
18
  LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION
19
- } from "../chunk-IVVGFRQQ.js";
20
- import "../chunk-OCD3OZRK.js";
19
+ } from "../chunk-MPVES2IC.js";
20
+ import "../chunk-Z4G3WCP3.js";
21
21
  import "../chunk-MLKGABMK.js";
22
22
 
23
23
  // src/cli/check.ts
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  validatePluginEgressCredentialHooks,
3
3
  validatePluginRegistrations
4
- } from "../chunk-MGUMR35T.js";
4
+ } from "../chunk-Z2W4SJZ7.js";
5
5
  import {
6
6
  pluginCatalogConfigFromPluginSet,
7
7
  pluginCliRegistrationsFromPluginSet,
@@ -14,30 +14,29 @@ import {
14
14
  createPluginLogger,
15
15
  setPlugins,
16
16
  validatePlugins
17
- } from "../chunk-QY636HZU.js";
18
- import "../chunk-OUHNWH46.js";
19
- import "../chunk-RGX4V75M.js";
17
+ } from "../chunk-QQIVLZW4.js";
18
+ import "../chunk-PYKKM4MM.js";
19
+ import "../chunk-IFAHK54X.js";
20
20
  import {
21
21
  getDb
22
- } from "../chunk-FENLIFJD.js";
23
- import "../chunk-TMBRFULF.js";
22
+ } from "../chunk-ZRZ4SVWG.js";
23
+ import "../chunk-JQFJO5WH.js";
24
24
  import "../chunk-4ZNGQH7C.js";
25
- import "../chunk-JNAVF45E.js";
25
+ import "../chunk-NQLWOTY4.js";
26
26
  import "../chunk-VFUK3X5B.js";
27
- import "../chunk-O3JMSZLI.js";
28
- import "../chunk-SYAQIR5Z.js";
27
+ import "../chunk-6Y5L4BOM.js";
29
28
  import {
30
29
  pluginCatalogRuntime
31
- } from "../chunk-3SXUV423.js";
32
- import "../chunk-TT6GMXNA.js";
33
- import "../chunk-PLB7MRCQ.js";
34
- import "../chunk-ISMWX44P.js";
35
- import "../chunk-OB42YVAE.js";
30
+ } from "../chunk-WSRBFHPX.js";
31
+ import "../chunk-XQAYFRWT.js";
32
+ import "../chunk-C4MZ3GP5.js";
33
+ import "../chunk-J7APPQIJ.js";
34
+ import "../chunk-42WRQLJ6.js";
36
35
  import "../chunk-6GWA276C.js";
37
36
  import "../chunk-B3IT5END.js";
38
37
  import "../chunk-3V7OFJZC.js";
39
- import "../chunk-IVVGFRQQ.js";
40
- import "../chunk-OCD3OZRK.js";
38
+ import "../chunk-MPVES2IC.js";
39
+ import "../chunk-Z4G3WCP3.js";
41
40
  import "../chunk-MLKGABMK.js";
42
41
 
43
42
  // src/cli/plugins.ts