@sentry/junior 0.132.0 → 0.134.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 (83) hide show
  1. package/dist/{agent-hooks-ONXOJDR6.js → agent-hooks-HGXNYOOD.js} +9 -9
  2. package/dist/api/schema/task.d.ts +60 -0
  3. package/dist/api/schema.d.ts +2 -2
  4. package/dist/api/schema.js +3 -1
  5. package/dist/api.js +90 -20
  6. package/dist/app.js +110 -39
  7. package/dist/{catalog-runtime-BATAY4R7.js → catalog-runtime-P6QHU6XE.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/config.d.ts +2 -0
  13. package/dist/chat/conversations/projection.d.ts +3 -1
  14. package/dist/chat/conversations/sql/bindings.d.ts +13 -0
  15. package/dist/chat/conversations/sql/store.d.ts +3 -0
  16. package/dist/chat/conversations/store.d.ts +15 -0
  17. package/dist/chat/plugins/agent-hooks.d.ts +2 -2
  18. package/dist/chat/repository-instructions.d.ts +44 -0
  19. package/dist/chat/runtime/reply-executor.d.ts +1 -0
  20. package/dist/chat/runtime/slack-runtime.d.ts +2 -0
  21. package/dist/chat/sandbox/noninteractive-command.d.ts +2 -0
  22. package/dist/chat/sandbox/sandbox.d.ts +3 -0
  23. package/dist/chat/sandbox/session.d.ts +1 -0
  24. package/dist/chat/services/context-compaction.d.ts +1 -0
  25. package/dist/chat/slack/dispatch-turn.d.ts +1 -0
  26. package/dist/chat/slack/reply.d.ts +1 -1
  27. package/dist/chat/slack/tools/user-lookup.d.ts +2 -6
  28. package/dist/chat/tasks/execution-stats.d.ts +29 -0
  29. package/dist/chat/tasks/registered.d.ts +3 -0
  30. package/dist/chat/tools/index.d.ts +2 -0
  31. package/dist/chat/tools/sandbox/bash.d.ts +1 -0
  32. package/dist/chat/tools/system-time.d.ts +11 -1
  33. package/dist/{chunk-O2UXPUVQ.js → chunk-52DIKFJV.js} +14 -6
  34. package/dist/{chunk-GOEZU33G.js → chunk-6T3AYZT7.js} +1 -1
  35. package/dist/{chunk-GPXVDJML.js → chunk-7GKQ7UIO.js} +449 -39
  36. package/dist/{chunk-QVEXYYFM.js → chunk-7UTBPDXK.js} +24 -1
  37. package/dist/{chunk-U76PS7AT.js → chunk-AS3I7OIL.js} +2 -2
  38. package/dist/{chunk-HX236W2U.js → chunk-CDQ4YIZM.js} +9 -0
  39. package/dist/{chunk-ODIP5CEM.js → chunk-FDNAUM7X.js} +32 -32
  40. package/dist/{chunk-GTKNPQNN.js → chunk-FL466XX5.js} +36 -24
  41. package/dist/{chunk-2425Q4OR.js → chunk-GSP5SMZJ.js} +1 -1
  42. package/dist/{chunk-XN656LB4.js → chunk-KWGJG4HO.js} +6 -12
  43. package/dist/{chunk-ISNRPCPG.js → chunk-LKK4XMUV.js} +1 -1
  44. package/dist/{chunk-G3WYA2RS.js → chunk-MFERLE3G.js} +1 -1
  45. package/dist/{chunk-ZMV2YBT6.js → chunk-NF2TNZPD.js} +788 -674
  46. package/dist/chunk-NOA34AJY.js +122 -0
  47. package/dist/{chunk-JYQAE2ZU.js → chunk-NYWSCJVW.js} +1 -1
  48. package/dist/{chunk-KB2M27DL.js → chunk-QLEKAO7O.js} +130 -40
  49. package/dist/{chunk-BKE47OOW.js → chunk-S6DMTEOM.js} +2 -2
  50. package/dist/{chunk-ALDPUN3Z.js → chunk-TR6UEEYD.js} +8 -6
  51. package/dist/{chunk-WEJIS7OC.js → chunk-U3ZI7CCW.js} +1 -1
  52. package/dist/{chunk-B7IY6SVJ.js → chunk-VEGF62FV.js} +1 -1
  53. package/dist/{chunk-SKWIIUS7.js → chunk-VGXJMECA.js} +7 -7
  54. package/dist/{chunk-V44FFBO3.js → chunk-VP6NCPRS.js} +1 -1
  55. package/dist/{chunk-WYQP7QSB.js → chunk-VPYKNCTN.js} +101 -61
  56. package/dist/{chunk-NNHUGGO4.js → chunk-XG5PHKPM.js} +19 -3
  57. package/dist/{chunk-AW5Z3T7V.js → chunk-YNLQQ622.js} +9 -8
  58. package/dist/cli/chat.js +25 -25
  59. package/dist/cli/check.js +6 -6
  60. package/dist/cli/init.js +1 -1
  61. package/dist/cli/plugins.js +12 -12
  62. package/dist/cli/snapshot-create.js +9 -9
  63. package/dist/cli/upgrade.js +9 -8
  64. package/dist/db/executor.d.ts +2 -1
  65. package/dist/db/neon.d.ts +1 -0
  66. package/dist/db/postgres.d.ts +1 -0
  67. package/dist/db/schema/conversation-bindings.d.ts +110 -0
  68. package/dist/db/schema/task-executions.d.ts +110 -0
  69. package/dist/db/schema.d.ts +221 -1
  70. package/dist/{db-QFFZACXF.js → db-GFK4NHWJ.js} +7 -7
  71. package/dist/instrumentation.js +4 -4
  72. package/dist/nitro.js +2 -2
  73. package/dist/{oauth-callback-server-5WXLD533.js → oauth-callback-server-HUJLAQ5N.js} +19 -18
  74. package/dist/{runner-Y3LTUNAA.js → runner-T77AFAH4.js} +13 -12
  75. package/dist/{skills-7M5C24GM.js → skills-3KUFJOOR.js} +6 -6
  76. package/dist/{validation-MRILMYDI.js → validation-FMWDHKYU.js} +6 -6
  77. package/dist/version.js +1 -1
  78. package/migrations/0018_curvy_excalibur.sql +12 -0
  79. package/migrations/0019_lowly_valkyrie.sql +14 -0
  80. package/migrations/meta/0018_snapshot.json +1756 -0
  81. package/migrations/meta/0019_snapshot.json +1904 -0
  82. package/migrations/meta/_journal.json +15 -1
  83. package/package.json +5 -5
@@ -1,6 +1,31 @@
1
1
  import {
2
2
  getChatConfig
3
- } from "./chunk-NNHUGGO4.js";
3
+ } from "./chunk-XG5PHKPM.js";
4
+
5
+ // src/chat/sandbox/paths.ts
6
+ function normalizeWorkspaceRoot(input) {
7
+ const candidate = (input ?? "").trim();
8
+ if (!candidate) {
9
+ return "/vercel/sandbox";
10
+ }
11
+ const normalized = candidate.replace(/\/+$/, "");
12
+ return normalized.startsWith("/") ? normalized : `/${normalized}`;
13
+ }
14
+ var SANDBOX_WORKSPACE_ROOT = normalizeWorkspaceRoot(
15
+ process.env.VERCEL_SANDBOX_WORKSPACE_DIR
16
+ );
17
+ var SANDBOX_SKILLS_ROOT = `${SANDBOX_WORKSPACE_ROOT}/skills`;
18
+ var SANDBOX_DATA_ROOT = `${SANDBOX_WORKSPACE_ROOT}/data`;
19
+ function sandboxSkillDir(skillName) {
20
+ return `${SANDBOX_SKILLS_ROOT}/${skillName}`;
21
+ }
22
+ function sandboxSkillFile(skillName) {
23
+ return `${sandboxSkillDir(skillName)}/SKILL.md`;
24
+ }
25
+ function sandboxSkillPathResolution(skillName) {
26
+ const skillDir = sandboxSkillDir(skillName);
27
+ return `Resolve relative paths in this skill against ${skillDir}. For bash commands from this skill, cd to ${skillDir} first or use absolute paths.`;
28
+ }
4
29
 
5
30
  // src/chat/state/adapter.ts
6
31
  import { createMemoryState } from "@chat-adapter/state-memory";
@@ -271,31 +296,6 @@ async function disconnectStateAdapter() {
271
296
  }
272
297
  }
273
298
 
274
- // src/chat/sandbox/paths.ts
275
- function normalizeWorkspaceRoot(input) {
276
- const candidate = (input ?? "").trim();
277
- if (!candidate) {
278
- return "/vercel/sandbox";
279
- }
280
- const normalized = candidate.replace(/\/+$/, "");
281
- return normalized.startsWith("/") ? normalized : `/${normalized}`;
282
- }
283
- var SANDBOX_WORKSPACE_ROOT = normalizeWorkspaceRoot(
284
- process.env.VERCEL_SANDBOX_WORKSPACE_DIR
285
- );
286
- var SANDBOX_SKILLS_ROOT = `${SANDBOX_WORKSPACE_ROOT}/skills`;
287
- var SANDBOX_DATA_ROOT = `${SANDBOX_WORKSPACE_ROOT}/data`;
288
- function sandboxSkillDir(skillName) {
289
- return `${SANDBOX_SKILLS_ROOT}/${skillName}`;
290
- }
291
- function sandboxSkillFile(skillName) {
292
- return `${sandboxSkillDir(skillName)}/SKILL.md`;
293
- }
294
- function sandboxSkillPathResolution(skillName) {
295
- const skillDir = sandboxSkillDir(skillName);
296
- return `Resolve relative paths in this skill against ${skillDir}. For bash commands from this skill, cd to ${skillDir} first or use absolute paths.`;
297
- }
298
-
299
299
  // src/chat/sleep.ts
300
300
  function sleep(ms, signal) {
301
301
  if (!signal) {
@@ -319,15 +319,15 @@ function sleep(ms, signal) {
319
319
  }
320
320
 
321
321
  export {
322
- acquireActiveLock,
323
- getDefaultRedisStateAdapterFor,
324
- getStateAdapter,
325
- disconnectStateAdapter,
326
- sleep,
327
322
  SANDBOX_WORKSPACE_ROOT,
328
323
  SANDBOX_SKILLS_ROOT,
329
324
  SANDBOX_DATA_ROOT,
330
325
  sandboxSkillDir,
331
326
  sandboxSkillFile,
332
- sandboxSkillPathResolution
327
+ sandboxSkillPathResolution,
328
+ acquireActiveLock,
329
+ getDefaultRedisStateAdapterFor,
330
+ getStateAdapter,
331
+ disconnectStateAdapter,
332
+ sleep
333
333
  };
@@ -13,7 +13,7 @@ import {
13
13
  persistAuthPauseTurnState,
14
14
  requireTurnFailureEventId,
15
15
  scheduleSessionCompletedPluginTasks
16
- } from "./chunk-O2UXPUVQ.js";
16
+ } from "./chunk-52DIKFJV.js";
17
17
  import {
18
18
  buildSentryConversationUrl
19
19
  } from "./chunk-4CODA7P5.js";
@@ -40,7 +40,7 @@ import {
40
40
  resolveBaseUrl,
41
41
  resolvePluginOAuthAccount,
42
42
  truncateStatusText
43
- } from "./chunk-SKWIIUS7.js";
43
+ } from "./chunk-VGXJMECA.js";
44
44
  import {
45
45
  JUNIOR_THREAD_STATE_TTL_MS,
46
46
  TurnSliceLimitExceededError,
@@ -64,7 +64,6 @@ import {
64
64
  markConversationMessage,
65
65
  markTurnFailed,
66
66
  persistCompletedSessionRecord,
67
- persistConversationMessages,
68
67
  persistThreadStateById,
69
68
  persistWithRetry,
70
69
  recordAgentTurnSessionSummary,
@@ -73,13 +72,13 @@ import {
73
72
  recordDeliveredAssistantMessage,
74
73
  turnHasReply,
75
74
  updateConversationStats
76
- } from "./chunk-GPXVDJML.js";
75
+ } from "./chunk-7GKQ7UIO.js";
77
76
  import {
78
77
  parseSlackThreadId,
79
78
  readSlackRawMessageContext,
80
79
  resolveSlackChannelIdFromMessage,
81
80
  resolveSlackChannelIdFromThreadId
82
- } from "./chunk-G3WYA2RS.js";
81
+ } from "./chunk-MFERLE3G.js";
83
82
  import {
84
83
  SlackActionError,
85
84
  getDashboardConversationLink,
@@ -88,19 +87,19 @@ import {
88
87
  getSlackClient,
89
88
  isDmChannel,
90
89
  normalizeSlackConversationId
91
- } from "./chunk-ALDPUN3Z.js";
90
+ } from "./chunk-TR6UEEYD.js";
92
91
  import {
93
92
  getConversationEventStore,
94
93
  getConversationStore,
95
94
  parseDestination,
96
95
  requireSlackDestination,
97
96
  sameDestination
98
- } from "./chunk-WYQP7QSB.js";
97
+ } from "./chunk-VPYKNCTN.js";
99
98
  import {
100
99
  acquireActiveLock,
101
100
  getDefaultRedisStateAdapterFor,
102
101
  getStateAdapter
103
- } from "./chunk-ODIP5CEM.js";
102
+ } from "./chunk-FDNAUM7X.js";
104
103
  import {
105
104
  FUNCTION_TIMEOUT_BUFFER_SECONDS,
106
105
  botConfig,
@@ -109,18 +108,18 @@ import {
109
108
  getRuntimeMetadata,
110
109
  normalizeSlackEmojiName,
111
110
  standardModelId
112
- } from "./chunk-NNHUGGO4.js";
111
+ } from "./chunk-XG5PHKPM.js";
113
112
  import {
114
113
  discoverSkills
115
- } from "./chunk-BKE47OOW.js";
114
+ } from "./chunk-S6DMTEOM.js";
116
115
  import {
117
116
  pluginCatalogRuntime
118
- } from "./chunk-B7IY6SVJ.js";
117
+ } from "./chunk-VEGF62FV.js";
119
118
  import {
120
119
  buildOAuthTokenRequest,
121
120
  hasRequiredOAuthScope,
122
121
  parseOAuthTokenResponse
123
- } from "./chunk-V44FFBO3.js";
122
+ } from "./chunk-VP6NCPRS.js";
124
123
  import {
125
124
  createSlackResumeActor,
126
125
  isUserActor,
@@ -139,7 +138,7 @@ import {
139
138
  toOptionalNumber,
140
139
  toOptionalString,
141
140
  withLogContext
142
- } from "./chunk-GOEZU33G.js";
141
+ } from "./chunk-6T3AYZT7.js";
143
142
  import {
144
143
  homeDir
145
144
  } from "./chunk-H4HBKISO.js";
@@ -770,7 +769,7 @@ async function sendSlackReply(args) {
770
769
  conversationId: args.conversationId,
771
770
  replyAttribution: args.replyAttribution
772
771
  });
773
- let lastMessageTs;
772
+ const messageTs = [];
774
773
  for (const [index, text] of chunks.entries()) {
775
774
  const isFinalChunk = index === chunks.length - 1;
776
775
  const blocks = buildSlackReplyBlocks(
@@ -786,9 +785,11 @@ ${escapeSlackMrkdwnText(formatReplyAttribution(args.replyAttribution))}` : text;
786
785
  text: fallbackText,
787
786
  ...blocks ? { blocks } : {}
788
787
  });
789
- lastMessageTs = response.ts;
788
+ if (response.ts) {
789
+ messageTs.push(response.ts);
790
+ }
790
791
  }
791
- return lastMessageTs;
792
+ return messageTs;
792
793
  }
793
794
 
794
795
  // src/chat/slack/errors.ts
@@ -1422,9 +1423,9 @@ async function resumeSlackTurnInContext(args) {
1422
1423
  }
1423
1424
  failureCode = "delivery_failed";
1424
1425
  const deliveryState2 = await getDeliveryConversation();
1425
- let messageTs;
1426
+ let slackMessageTs;
1426
1427
  try {
1427
- messageTs = await sendSlackReply({
1428
+ slackMessageTs = await sendSlackReply({
1428
1429
  channelId: runArgs.channelId,
1429
1430
  conversationId: runArgs.conversationId,
1430
1431
  replyAttribution: runArgs.replyContext?.routing.dispatch?.replyAttribution,
@@ -1437,6 +1438,7 @@ async function resumeSlackTurnInContext(args) {
1437
1438
  }
1438
1439
  throw error;
1439
1440
  }
1441
+ const messageTs = slackMessageTs.at(-1);
1440
1442
  assistantMessageDelivered = true;
1441
1443
  acceptedDeliveryId = messageTs;
1442
1444
  const recordedMessageId = recordDeliveredAssistantMessage({
@@ -1451,15 +1453,25 @@ async function resumeSlackTurnInContext(args) {
1451
1453
  });
1452
1454
  }
1453
1455
  try {
1456
+ const routing2 = runArgs.replyContext?.routing;
1457
+ const destination = routing2?.destination;
1458
+ const providerConversationIds = runArgs.threadTs ? [runArgs.threadTs] : slackMessageTs;
1454
1459
  await persistWithRetry(
1455
- () => message ? commitAcceptedReply({
1456
- agentMessage: message,
1460
+ () => commitAcceptedReply({
1461
+ ...message ? { agentMessage: message } : {},
1457
1462
  conversation: deliveryState2.conversation,
1458
1463
  conversationMessageId: recordedMessageId,
1459
- conversationId
1460
- }) : persistConversationMessages({
1461
- conversation: deliveryState2.conversation,
1462
- conversationId
1464
+ conversationId,
1465
+ ...routing2?.dispatch && destination?.platform === "slack" && providerConversationIds.length > 0 ? {
1466
+ providerConversationBindings: providerConversationIds.map(
1467
+ (providerConversationId) => ({
1468
+ provider: "slack",
1469
+ providerDestinationId: destination.channelId,
1470
+ providerTenantId: destination.teamId,
1471
+ providerConversationId
1472
+ })
1473
+ )
1474
+ } : {}
1463
1475
  })
1464
1476
  );
1465
1477
  } catch (error) {
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@sentry/junior",
4
- version: "0.132.0",
4
+ version: "0.134.0",
5
5
  private: false,
6
6
  publishConfig: {
7
7
  access: "public"
@@ -1,16 +1,19 @@
1
+ import {
2
+ ToolInputError
3
+ } from "./chunk-CDQ4YIZM.js";
1
4
  import {
2
5
  canRouteResourceEvents,
3
6
  getPlugins
4
- } from "./chunk-ALDPUN3Z.js";
7
+ } from "./chunk-TR6UEEYD.js";
5
8
  import {
6
9
  getDb
7
- } from "./chunk-WYQP7QSB.js";
10
+ } from "./chunk-VPYKNCTN.js";
8
11
  import {
9
12
  juniorEventTasks,
10
13
  juniorSchedulerRuns,
11
14
  juniorSchedulerTasks,
12
15
  juniorStats
13
- } from "./chunk-KB2M27DL.js";
16
+ } from "./chunk-QLEKAO7O.js";
14
17
  import {
15
18
  juniorDestinations
16
19
  } from "./chunk-VFUK3X5B.js";
@@ -218,14 +221,6 @@ function makeStructuredToolOutput(details, options = {}) {
218
221
  };
219
222
  }
220
223
 
221
- // src/chat/tools/execution/tool-input-error.ts
222
- var ToolInputError = class extends Error {
223
- constructor(message, options) {
224
- super(message, options);
225
- this.name = "ToolInputError";
226
- }
227
- };
228
-
229
224
  // src/chat/resource-events/runtime-catalog.ts
230
225
  function getResourceEventCatalog() {
231
226
  return Object.fromEntries(
@@ -1468,7 +1463,6 @@ export {
1468
1463
  juniorToolOutputSchema,
1469
1464
  injectContinuationToolName,
1470
1465
  makeStructuredToolOutput,
1471
- ToolInputError,
1472
1466
  eventNamespaceSchema,
1473
1467
  registeredEventTypeSchema,
1474
1468
  registeredResourceTypeSchema,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logWarn
3
- } from "./chunk-GOEZU33G.js";
3
+ } from "./chunk-6T3AYZT7.js";
4
4
 
5
5
  // src/chat/conversation-privacy.ts
6
6
  import { AsyncLocalStorage } from "async_hooks";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-F3B2YJ76.js";
6
6
  import {
7
7
  toOptionalString
8
- } from "./chunk-GOEZU33G.js";
8
+ } from "./chunk-6T3AYZT7.js";
9
9
 
10
10
  // src/chat/slack/context.ts
11
11
  import { z } from "zod";