@sentry/junior 0.148.0 → 0.149.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 (70) hide show
  1. package/dist/{agent-hooks-VAUYT6PD.js → agent-hooks-CWMCXAMT.js} +10 -10
  2. package/dist/api/conversations/aggregate.d.ts +2 -0
  3. package/dist/api/conversations/create.d.ts +1 -1
  4. package/dist/api/conversations/pending-messages.d.ts +15 -0
  5. package/dist/api/people/shared.d.ts +2 -0
  6. package/dist/api/schema/conversation.d.ts +78 -4
  7. package/dist/api/schema.d.ts +2 -2
  8. package/dist/api/schema.js +7 -1
  9. package/dist/api.js +182 -33
  10. package/dist/app.js +92 -133
  11. package/dist/{catalog-runtime-WADOZVTB.js → catalog-runtime-GAW5APVI.js} +5 -5
  12. package/dist/chat/api-turns/work.d.ts +6 -1
  13. package/dist/chat/app/services.d.ts +1 -1
  14. package/dist/chat/runtime/reply-executor.d.ts +0 -2
  15. package/dist/chat/services/conversation-memory.d.ts +2 -2
  16. package/dist/chat/services/conversation-title.d.ts +20 -0
  17. package/dist/chat/slack/assistant-thread/title.d.ts +10 -27
  18. package/dist/chat/state/conversation.d.ts +1 -0
  19. package/dist/{chunk-2B3PT3V2.js → chunk-25SC7D6Z.js} +1 -1
  20. package/dist/{chunk-POSZWRGL.js → chunk-2JHKISQA.js} +1 -1
  21. package/dist/{chunk-VY6W3T43.js → chunk-2P6BQQER.js} +4 -4
  22. package/dist/{chunk-4GXJUYJV.js → chunk-32CXPIZE.js} +2 -2
  23. package/dist/{chunk-VRHTNBA6.js → chunk-3GYZ5YEH.js} +3 -3
  24. package/dist/{chunk-D3WPMGEX.js → chunk-3I2IVWSZ.js} +1 -1
  25. package/dist/{chunk-45LOR4PU.js → chunk-3JVUWLR7.js} +45 -1
  26. package/dist/{chunk-LE5H7LMT.js → chunk-3KGQOKIG.js} +1 -1
  27. package/dist/{chunk-4AQZYNHM.js → chunk-4JGM7FXO.js} +2 -2
  28. package/dist/{chunk-IL4EDBMV.js → chunk-4YKPOYRV.js} +5 -5
  29. package/dist/{chunk-ZPL2RR7F.js → chunk-5CWUQXXT.js} +28 -20
  30. package/dist/{chunk-LAZGHEYU.js → chunk-6G5RCDKP.js} +1 -1
  31. package/dist/{chunk-ULAU5ZGU.js → chunk-75DSYFFB.js} +24 -24
  32. package/dist/{chunk-ZCHIC2GM.js → chunk-7BH46NB4.js} +6 -6
  33. package/dist/{chunk-7OEIXFC3.js → chunk-ALJG73MQ.js} +1 -1
  34. package/dist/{chunk-LNVEIJ2L.js → chunk-ART7P442.js} +5 -5
  35. package/dist/{chunk-VMNRXKAH.js → chunk-DK5UT6PQ.js} +24 -26
  36. package/dist/{chunk-VCYSOXON.js → chunk-EW2LNCRL.js} +545 -7
  37. package/dist/{chunk-DUY5CDAM.js → chunk-EXW76GW4.js} +1 -1
  38. package/dist/{chunk-WCN4YSH7.js → chunk-JMH3DBM5.js} +6 -6
  39. package/dist/{chunk-HLPLT3NY.js → chunk-JMSMXXED.js} +8 -4
  40. package/dist/{chunk-WOONT5ZP.js → chunk-MEMURSBG.js} +1 -1
  41. package/dist/{chunk-QOWHHM3F.js → chunk-QIW7OQEO.js} +1 -1
  42. package/dist/{chunk-XJ42NBP5.js → chunk-RB26T3LU.js} +8 -8
  43. package/dist/{chunk-EAI67NTM.js → chunk-RLVZIWNQ.js} +1 -1
  44. package/dist/{chunk-V2FXMOEA.js → chunk-SWHPVZBV.js} +2 -2
  45. package/dist/{chunk-D6YX4NNN.js → chunk-TFBNBXPU.js} +4 -4
  46. package/dist/{chunk-GXYDVZKM.js → chunk-URDCZAL4.js} +5 -5
  47. package/dist/{chunk-RRJV5UR5.js → chunk-UZGASGOD.js} +11 -337
  48. package/dist/{chunk-OJCP3C3J.js → chunk-W7UONUIZ.js} +6 -6
  49. package/dist/{chunk-HWQGBIH7.js → chunk-X22XXSZA.js} +1 -1
  50. package/dist/{chunk-EINWQFXI.js → chunk-XPYWWMHR.js} +5 -5
  51. package/dist/{chunk-55F4QU2V.js → chunk-ZYMYLLWG.js} +1 -1
  52. package/dist/cli/chat.js +30 -31
  53. package/dist/cli/check.js +6 -6
  54. package/dist/cli/plugins.js +13 -13
  55. package/dist/cli/snapshot-create.js +9 -9
  56. package/dist/cli/upgrade.js +7 -7
  57. package/dist/{db-XUKZRFFK.js → db-JBZLRIVY.js} +7 -7
  58. package/dist/instrumentation.js +4 -4
  59. package/dist/nitro.js +2 -2
  60. package/dist/{oauth-callback-server-LPZMMGFI.js → oauth-callback-server-MNTVYY2I.js} +23 -24
  61. package/dist/{runner-DGKUTMPX.js → runner-K24BWZSZ.js} +21 -22
  62. package/dist/{skills-P7YUFSXM.js → skills-AU5ST2CG.js} +6 -6
  63. package/dist/spawn-6PO7CVJ6.js +38 -0
  64. package/dist/{validation-S7U5M5NR.js → validation-IXGZCFRO.js} +6 -6
  65. package/dist/version.js +1 -1
  66. package/dist/{work-GAA7TVAD.js → work-WCZIYILX.js} +17 -17
  67. package/dist/{worker-JXPJH3QB.js → worker-U2AACBEY.js} +11 -11
  68. package/package.json +5 -5
  69. package/dist/chunk-4EA2SFK2.js +0 -137
  70. package/dist/spawn-DSK3ZEVD.js +0 -38
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-HWQGBIH7.js";
3
+ } from "./chunk-X22XXSZA.js";
4
4
 
5
5
  // src/chat/plugins/validation.ts
6
6
  import { isDeepStrictEqual } from "util";
@@ -1,34 +1,34 @@
1
1
  import {
2
2
  resolveBaseUrl
3
- } from "./chunk-WCN4YSH7.js";
3
+ } from "./chunk-JMH3DBM5.js";
4
4
  import {
5
5
  createPluginLogger,
6
6
  getPlugins
7
- } from "./chunk-ZCHIC2GM.js";
7
+ } from "./chunk-7BH46NB4.js";
8
8
  import {
9
9
  getSlackClient,
10
10
  withSlackRetries
11
- } from "./chunk-V2FXMOEA.js";
11
+ } from "./chunk-SWHPVZBV.js";
12
12
  import {
13
13
  getDb,
14
14
  parseDestination
15
- } from "./chunk-VRHTNBA6.js";
15
+ } from "./chunk-3GYZ5YEH.js";
16
16
  import {
17
17
  sleep
18
18
  } from "./chunk-EM225ITJ.js";
19
19
  import {
20
20
  acquireActiveLock,
21
21
  getStateAdapter
22
- } from "./chunk-2B3PT3V2.js";
22
+ } from "./chunk-25SC7D6Z.js";
23
23
  import {
24
24
  pluginCatalogRuntime
25
- } from "./chunk-HWQGBIH7.js";
25
+ } from "./chunk-X22XXSZA.js";
26
26
  import {
27
27
  fetchWithBoundedOAuthErrorBodies
28
- } from "./chunk-POSZWRGL.js";
28
+ } from "./chunk-2JHKISQA.js";
29
29
  import {
30
30
  isRecord
31
- } from "./chunk-EAI67NTM.js";
31
+ } from "./chunk-RLVZIWNQ.js";
32
32
 
33
33
  // src/chat/capabilities/router.ts
34
34
  var ProviderCredentialRouter = class {
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-6GWA276C.js";
10
10
  import {
11
11
  getDeploymentTelemetryAttributes
12
- } from "./chunk-LAZGHEYU.js";
12
+ } from "./chunk-6G5RCDKP.js";
13
13
 
14
14
  // src/chat/logging.ts
15
15
  import path from "path";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-EM225ITJ.js";
4
4
  import {
5
5
  getSlackBotToken
6
- } from "./chunk-4GXJUYJV.js";
6
+ } from "./chunk-32CXPIZE.js";
7
7
  import {
8
8
  parseSlackChannelReferenceId
9
9
  } from "./chunk-F3B2YJ76.js";
@@ -12,7 +12,7 @@ import {
12
12
  setSpanAttributes,
13
13
  setSpanStatus,
14
14
  withSpan
15
- } from "./chunk-EAI67NTM.js";
15
+ } from "./chunk-RLVZIWNQ.js";
16
16
 
17
17
  // src/chat/slack/client.ts
18
18
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getTurnRequestDeadline
3
- } from "./chunk-DUY5CDAM.js";
3
+ } from "./chunk-EXW76GW4.js";
4
4
  import {
5
5
  CONVERSATION_WORK_CHECK_IN_INTERVAL_MS,
6
6
  CONVERSATION_WORK_MAX_RETRIES,
@@ -21,20 +21,20 @@ import {
21
21
  releaseConversationWork,
22
22
  requestAnotherSlice,
23
23
  startConversationWork
24
- } from "./chunk-HLPLT3NY.js";
24
+ } from "./chunk-JMSMXXED.js";
25
25
  import {
26
26
  ConversationQueueMessageRejectedError
27
27
  } from "./chunk-JAL3CH4G.js";
28
28
  import {
29
29
  getChatConfig,
30
30
  isProviderRetryError
31
- } from "./chunk-4GXJUYJV.js";
31
+ } from "./chunk-32CXPIZE.js";
32
32
  import {
33
33
  logException,
34
34
  logInfo,
35
35
  logWarn,
36
36
  withLogContext
37
- } from "./chunk-EAI67NTM.js";
37
+ } from "./chunk-RLVZIWNQ.js";
38
38
 
39
39
  // src/chat/task-execution/worker.ts
40
40
  var CONVERSATION_WORK_DEFER_DELAY_MS = 15e3;
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  ToolInputError
3
- } from "./chunk-VCYSOXON.js";
3
+ } from "./chunk-EW2LNCRL.js";
4
4
  import {
5
5
  canRouteResourceEvents,
6
6
  getPlugins
7
- } from "./chunk-ZCHIC2GM.js";
7
+ } from "./chunk-7BH46NB4.js";
8
8
  import {
9
9
  getDb
10
- } from "./chunk-VRHTNBA6.js";
10
+ } from "./chunk-3GYZ5YEH.js";
11
11
  import {
12
12
  juniorEventTasks,
13
13
  juniorSchedulerRuns,
14
14
  juniorSchedulerTasks,
15
15
  juniorStats
16
- } from "./chunk-D3WPMGEX.js";
16
+ } from "./chunk-3I2IVWSZ.js";
17
17
  import {
18
18
  juniorDestinations
19
19
  } from "./chunk-VFUK3X5B.js";
20
20
  import {
21
21
  logInfo
22
- } from "./chunk-EAI67NTM.js";
22
+ } from "./chunk-RLVZIWNQ.js";
23
23
 
24
24
  // src/chat/event-tasks/store.ts
25
25
  import { and, asc, desc, eq, inArray, or, sql } from "drizzle-orm";
@@ -1,19 +1,12 @@
1
1
  import {
2
2
  coerceThreadConversationState,
3
3
  getPersistedThreadState
4
- } from "./chunk-IL4EDBMV.js";
4
+ } from "./chunk-4YKPOYRV.js";
5
5
  import {
6
6
  pluginTaskId,
7
7
  pluginTaskParamsSchema,
8
8
  sendVercelPluginTask
9
9
  } from "./chunk-5I6ORJUY.js";
10
- import {
11
- calculateContextCompactionTargetTokens,
12
- estimateTextTokens,
13
- fallbackShortTitle,
14
- generateShortTitle,
15
- getConversationContextCompactionTriggerTokens
16
- } from "./chunk-4EA2SFK2.js";
17
10
  import {
18
11
  buildDeterministicTurnId,
19
12
  clearPendingAuth,
@@ -23,10 +16,11 @@ import {
23
16
  instructionTextForProjection,
24
17
  isToolResultError,
25
18
  isToolResultMessage,
19
+ markConversationMessage,
26
20
  markTurnCompleted,
27
21
  normalizeToolNameFromResult,
28
22
  stripRuntimeTurnContext
29
- } from "./chunk-VCYSOXON.js";
23
+ } from "./chunk-EW2LNCRL.js";
30
24
  import {
31
25
  JUNIOR_THREAD_STATE_TTL_MS
32
26
  } from "./chunk-3Y47VMHV.js";
@@ -37,27 +31,25 @@ import {
37
31
  createPluginModel,
38
32
  createPluginState,
39
33
  getPlugins
40
- } from "./chunk-ZCHIC2GM.js";
34
+ } from "./chunk-7BH46NB4.js";
41
35
  import {
42
36
  getConversationStore,
43
37
  getDb,
44
38
  sameActorIdentity
45
- } from "./chunk-VRHTNBA6.js";
39
+ } from "./chunk-3GYZ5YEH.js";
46
40
  import {
47
41
  juniorConversations,
48
42
  juniorTaskExecutions
49
- } from "./chunk-D3WPMGEX.js";
43
+ } from "./chunk-3I2IVWSZ.js";
50
44
  import {
51
45
  getStateAdapter
52
- } from "./chunk-2B3PT3V2.js";
46
+ } from "./chunk-25SC7D6Z.js";
53
47
  import {
54
48
  ProviderError,
55
- botConfig,
56
- escapeXml,
57
49
  findProviderError,
58
50
  getProviderErrorAttributes,
59
51
  getProviderErrorUserMessage
60
- } from "./chunk-4GXJUYJV.js";
52
+ } from "./chunk-32CXPIZE.js";
61
53
  import {
62
54
  credentialSubjectSchema
63
55
  } from "./chunk-RUIXF3YQ.js";
@@ -66,315 +58,8 @@ import {
66
58
  } from "./chunk-F3B2YJ76.js";
67
59
  import {
68
60
  buildTurnFailureResponse,
69
- logWarn,
70
- setSpanAttributes
71
- } from "./chunk-EAI67NTM.js";
72
-
73
- // src/chat/services/conversation-memory.ts
74
- var CONTEXT_MIN_LIVE_MESSAGES = 12;
75
- var CONTEXT_COMPACTION_BATCH_SIZE = 24;
76
- var CONTEXT_MAX_COMPACTIONS = 16;
77
- var CONTEXT_MAX_MESSAGE_CHARS = 3200;
78
- var SLACK_USER_ID_DISPLAY_PATTERN = /^[UW][A-Z0-9]{5,}$/;
79
- function generateConversationId(prefix) {
80
- return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
81
- }
82
- function normalizeConversationText(text) {
83
- return text.replace(/\r\n?/g, "\n").trim();
84
- }
85
- function buildImageContextSuffix(message, conversation) {
86
- const byFileId = conversation?.vision.byFileId;
87
- const imageFileIds = message.meta?.imageFileIds ?? [];
88
- if (!byFileId || imageFileIds.length === 0) {
89
- return "";
90
- }
91
- const summaries = imageFileIds.map((fileId) => byFileId[fileId]?.summary?.trim()).filter((summary) => Boolean(summary));
92
- if (summaries.length === 0) {
93
- return "";
94
- }
95
- return ` [image context: ${summaries.join(" | ")}]`;
96
- }
97
- function renderConversationMessageLine(message, conversation) {
98
- const displayName = conversationAuthorDisplayName(message);
99
- const text = message.text.replace(/\s+/g, " ").slice(0, CONTEXT_MAX_MESSAGE_CHARS);
100
- const markers = [];
101
- if (message.meta?.replied === false) {
102
- markers.push(
103
- `assistant skipped: ${message.meta?.skippedReason ?? "no-reply route"}`
104
- );
105
- }
106
- if (message.meta?.explicitMention) {
107
- markers.push("explicit mention");
108
- }
109
- const markerSuffix = markers.length > 0 ? ` (${markers.join("; ")})` : "";
110
- const imageContext = buildImageContextSuffix(message, conversation);
111
- return `[${message.role}] ${displayName}: ${text}${imageContext}${markerSuffix}`;
112
- }
113
- function conversationAuthorDisplayName(message) {
114
- const author = message.author;
115
- const fullName = authorDisplayField(author?.fullName, author?.userId);
116
- const userName = authorDisplayField(author?.userName, author?.userId);
117
- return fullName ?? userName ?? (message.role === "assistant" ? botConfig.userName : message.role);
118
- }
119
- function authorDisplayField(value, userId) {
120
- if (!value || value === userId || SLACK_USER_ID_DISPLAY_PATTERN.test(value)) {
121
- return void 0;
122
- }
123
- return value;
124
- }
125
- function estimateConversationContextTokens(conversation) {
126
- return estimateTextTokens(buildConversationContext(conversation) ?? "");
127
- }
128
- function upsertConversationMessage(conversation, message) {
129
- const existingIndex = conversation.messages.findIndex(
130
- (entry) => entry.id === message.id
131
- );
132
- if (existingIndex >= 0) {
133
- conversation.messages[existingIndex] = {
134
- ...conversation.messages[existingIndex],
135
- ...message,
136
- meta: {
137
- ...conversation.messages[existingIndex]?.meta,
138
- ...message.meta
139
- }
140
- };
141
- return message.id;
142
- }
143
- conversation.messages.push(message);
144
- return message.id;
145
- }
146
- function recordDeliveredAssistantMessage(args) {
147
- const prefix = `${args.sessionId}:assistant:`;
148
- const ordinal = args.conversation.messages.filter(
149
- (message) => message.id.startsWith(prefix)
150
- ).length + 1;
151
- const messageId = `${prefix}${ordinal}`;
152
- markConversationMessage(args.conversation, args.userMessageId, {
153
- replied: true,
154
- skippedReason: void 0
155
- });
156
- upsertConversationMessage(args.conversation, {
157
- id: messageId,
158
- role: "assistant",
159
- text: normalizeConversationText(args.text),
160
- createdAtMs: Date.now(),
161
- author: {
162
- userName: botConfig.userName,
163
- isBot: true
164
- },
165
- meta: {
166
- replied: true
167
- }
168
- });
169
- return messageId;
170
- }
171
- function turnHasReply(conversation, turnId) {
172
- const assistantPrefix = `${turnId}:assistant:`;
173
- return conversation.messages.some(
174
- (message) => message.role === "assistant" && message.id.startsWith(assistantPrefix)
175
- );
176
- }
177
- function markConversationMessage(conversation, messageId, patch) {
178
- if (!messageId) return;
179
- const messageIndex = conversation.messages.findIndex(
180
- (entry) => entry.id === messageId
181
- );
182
- if (messageIndex < 0) return;
183
- const current = conversation.messages[messageIndex];
184
- conversation.messages[messageIndex] = {
185
- ...current,
186
- meta: {
187
- ...current.meta ?? {},
188
- ...patch
189
- }
190
- };
191
- }
192
- function buildConversationContext(conversation, options = {}) {
193
- const messages = conversation.messages.filter(
194
- (entry) => entry.id !== options.excludeMessageId
195
- );
196
- if (messages.length === 0 && conversation.compactions.length === 0) {
197
- return void 0;
198
- }
199
- const lines = [];
200
- if (conversation.compactions.length > 0) {
201
- lines.push("<thread-compactions>");
202
- for (const [index, compaction] of conversation.compactions.entries()) {
203
- lines.push(
204
- ` <compaction index="${index + 1}" covered_messages="${compaction.coveredMessageCount}" created_at="${new Date(compaction.createdAtMs).toISOString()}">`,
205
- compaction.summary,
206
- " </compaction>"
207
- );
208
- }
209
- lines.push("</thread-compactions>");
210
- }
211
- if (messages.length > 0) {
212
- if (lines.length > 0) {
213
- lines.push("");
214
- }
215
- lines.push("<thread-transcript>");
216
- for (const [index, message] of messages.entries()) {
217
- const author = escapeXml(conversationAuthorDisplayName(message));
218
- const actorIdAttr = message.author?.userId ? ` actor_id="${escapeXml(message.author.userId)}"` : "";
219
- const ts = new Date(message.createdAtMs).toISOString();
220
- const slackTsAttr = message.meta?.slackTs ? ` slack_ts="${escapeXml(message.meta.slackTs)}"` : "";
221
- lines.push(
222
- ` <message index="${index + 1}" ts="${ts}" role="${message.role}" author="${author}"${actorIdAttr}${slackTsAttr}>`,
223
- renderConversationMessageLine(message, conversation),
224
- " </message>"
225
- );
226
- }
227
- lines.push("</thread-transcript>");
228
- }
229
- return lines.join("\n");
230
- }
231
- function pruneCompactions(compactions) {
232
- if (compactions.length <= CONTEXT_MAX_COMPACTIONS) {
233
- return compactions;
234
- }
235
- const overflowCount = compactions.length - CONTEXT_MAX_COMPACTIONS + 1;
236
- const merged = compactions.slice(0, overflowCount);
237
- const mergedSummary = merged.map((entry) => entry.summary).join("\n").slice(0, 3500);
238
- const coveredMessageCount = merged.reduce(
239
- (count2, entry) => count2 + entry.coveredMessageCount,
240
- 0
241
- );
242
- const compacted = {
243
- id: generateConversationId("compaction"),
244
- createdAtMs: Date.now(),
245
- summary: mergedSummary,
246
- coveredMessageCount
247
- };
248
- return [compacted, ...compactions.slice(overflowCount)];
249
- }
250
- async function summarizeConversationChunk(messages, conversation, context, deps) {
251
- const transcript = messages.map((message) => renderConversationMessageLine(message, conversation)).join("\n");
252
- try {
253
- const result = await deps.completeText({
254
- modelId: botConfig.fastModelId,
255
- temperature: 0,
256
- promptName: "junior.thread_compaction",
257
- messages: [
258
- {
259
- role: "user",
260
- content: [
261
- "Summarize the following older Slack thread transcript segment for future assistant turns.",
262
- "Keep the summary factual and concise. Do not invent details.",
263
- "",
264
- "Output exactly three XML sections in this order:",
265
- "<active-asks> one bullet per outstanding user ask that has not been narrowed, answered, or replaced by a later turn. Omit the section body if none. </active-asks>",
266
- "<resolved-or-replaced-asks> one bullet per ask that has been replaced, narrowed, answered, or already acted on in this segment. Include the replacement/outcome inline. Omit the section body if none. </resolved-or-replaced-asks>",
267
- "<facts> one bullet per durable fact useful regardless of scope: names, ids, URLs, decisions, locations, preferences, constraints that remain true. Omit the section body if none. </facts>",
268
- "",
269
- "Do not output any text outside the three sections.",
270
- "",
271
- transcript
272
- ].join("\n"),
273
- timestamp: Date.now()
274
- }
275
- ],
276
- metadata: {
277
- modelId: botConfig.fastModelId,
278
- threadId: context.threadId ?? "",
279
- channelId: context.channelId ?? "",
280
- actorId: context.actorId ?? "",
281
- runId: context.runId ?? ""
282
- }
283
- });
284
- const summary = result.text.trim();
285
- if (summary.length > 0) {
286
- return summary.slice(0, 3500);
287
- }
288
- } catch (error) {
289
- logWarn("conversation.compaction.summary.failed", {
290
- "exception.message": error instanceof Error ? error.message : String(error),
291
- "app.compaction_messages_covered": messages.length
292
- });
293
- }
294
- return transcript.slice(0, 2800);
295
- }
296
- async function generateThreadTitleWithDeps(sourceText, deps) {
297
- const title = await generateShortTitle({
298
- completeText: deps.completeText,
299
- kind: "conversation",
300
- sourceText
301
- });
302
- return title ?? fallbackShortTitle(sourceText, "Conversation");
303
- }
304
- function getThreadTitleSourceMessage(conversation) {
305
- let firstMessage;
306
- for (const message of conversation.messages) {
307
- if (!isHumanConversationMessage(message)) {
308
- continue;
309
- }
310
- if (!firstMessage) {
311
- firstMessage = message;
312
- continue;
313
- }
314
- if (message.createdAtMs < firstMessage.createdAtMs) {
315
- firstMessage = message;
316
- continue;
317
- }
318
- if (message.createdAtMs === firstMessage.createdAtMs && message.id < firstMessage.id) {
319
- firstMessage = message;
320
- }
321
- }
322
- return firstMessage;
323
- }
324
- async function compactConversationIfNeededWithDeps(conversation, context, deps) {
325
- let estimatedTokens = estimateConversationContextTokens(conversation);
326
- setSpanAttributes({
327
- "app.context_tokens_estimated": estimatedTokens
328
- });
329
- const triggerTokens = getConversationContextCompactionTriggerTokens();
330
- const targetTokens = calculateContextCompactionTargetTokens(triggerTokens);
331
- while (estimatedTokens > triggerTokens && conversation.messages.length > CONTEXT_MIN_LIVE_MESSAGES) {
332
- const compactCount = Math.min(
333
- CONTEXT_COMPACTION_BATCH_SIZE,
334
- conversation.messages.length - CONTEXT_MIN_LIVE_MESSAGES
335
- );
336
- if (compactCount <= 0) {
337
- break;
338
- }
339
- const compactedChunk = conversation.messages.slice(0, compactCount);
340
- const summary = await summarizeConversationChunk(
341
- compactedChunk,
342
- conversation,
343
- context,
344
- deps
345
- );
346
- conversation.compactions.push({
347
- id: generateConversationId("compaction"),
348
- createdAtMs: Date.now(),
349
- summary,
350
- coveredMessageCount: compactedChunk.length
351
- });
352
- conversation.compactions = pruneCompactions(conversation.compactions);
353
- conversation.messages = conversation.messages.slice(compactCount);
354
- estimatedTokens = estimateConversationContextTokens(conversation);
355
- setSpanAttributes({
356
- "app.compaction_messages_covered": compactCount,
357
- "app.compaction.trigger_tokens": triggerTokens,
358
- "app.compaction.target_tokens": targetTokens,
359
- "app.context_tokens_estimated": estimatedTokens
360
- });
361
- if (estimatedTokens <= targetTokens) {
362
- break;
363
- }
364
- }
365
- }
366
- function createConversationMemoryService(deps) {
367
- return {
368
- compactConversationIfNeeded: async (conversation, context) => await compactConversationIfNeededWithDeps(conversation, context, deps),
369
- generateThreadTitle: async (sourceText) => await generateThreadTitleWithDeps(sourceText, deps)
370
- };
371
- }
372
- function isHumanConversationMessage(message) {
373
- return message.role === "user" && message.author?.isBot !== true;
374
- }
375
- function getConversationMessageSlackTs(message) {
376
- return parseSlackMessageTs(message.meta?.slackTs);
377
- }
61
+ logWarn
62
+ } from "./chunk-RLVZIWNQ.js";
378
63
 
379
64
  // src/chat/runtime/delivered-turn-state.ts
380
65
  function buildDeliveredTurnStatePatch(args) {
@@ -400,7 +85,7 @@ import { pluginRunContextSchema } from "@sentry/junior-plugin-api";
400
85
 
401
86
  // src/chat/services/turn-session-routing.ts
402
87
  async function resolveTurnSessionRouting(args) {
403
- const conversationStore = args.conversationStore ?? (await import("./db-XUKZRFFK.js")).getConversationStore();
88
+ const conversationStore = args.conversationStore ?? (await import("./db-JBZLRIVY.js")).getConversationStore();
404
89
  const conversation = await conversationStore.get({
405
90
  conversationId: args.conversationId
406
91
  });
@@ -1522,17 +1207,6 @@ export {
1522
1207
  listPendingDispatchMailboxAppends,
1523
1208
  claimDispatchMailboxAppend,
1524
1209
  getPluginDispatchProjection,
1525
- normalizeConversationText,
1526
- estimateConversationContextTokens,
1527
- upsertConversationMessage,
1528
- recordDeliveredAssistantMessage,
1529
- turnHasReply,
1530
- markConversationMessage,
1531
- buildConversationContext,
1532
- getThreadTitleSourceMessage,
1533
- createConversationMemoryService,
1534
- isHumanConversationMessage,
1535
- getConversationMessageSlackTs,
1536
1210
  buildDeliveredTurnStatePatch,
1537
1211
  getTurnUserMessage,
1538
1212
  getTurnUserMessageId,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  appendAndEnqueueInboundMessage
3
- } from "./chunk-HLPLT3NY.js";
3
+ } from "./chunk-JMSMXXED.js";
4
4
  import {
5
5
  ConversationTurnLifecycleService,
6
6
  getPersistedSandboxState,
7
7
  getPersistedThreadState,
8
8
  persistThreadStateById
9
- } from "./chunk-IL4EDBMV.js";
9
+ } from "./chunk-4YKPOYRV.js";
10
10
  import {
11
11
  AgentInvocationBusyError,
12
12
  AgentInvocationLimitError,
@@ -15,7 +15,7 @@ import {
15
15
  agentBindingSchema,
16
16
  agentInvocationSchema,
17
17
  createAgentInvocationSchema
18
- } from "./chunk-EINWQFXI.js";
18
+ } from "./chunk-XPYWWMHR.js";
19
19
  import {
20
20
  TurnInputCommitLostError,
21
21
  failTurnRecord,
@@ -26,16 +26,16 @@ import {
26
26
  isTurnInputCommitLostError,
27
27
  openConversationProjection,
28
28
  saveTurnCheckpoint
29
- } from "./chunk-VCYSOXON.js";
29
+ } from "./chunk-EW2LNCRL.js";
30
30
  import {
31
31
  getConversationEventStore,
32
32
  getConversationStore,
33
33
  getSqlExecutor
34
- } from "./chunk-VRHTNBA6.js";
34
+ } from "./chunk-3GYZ5YEH.js";
35
35
  import {
36
36
  juniorAgentBindings,
37
37
  juniorAgentInvocations
38
- } from "./chunk-D3WPMGEX.js";
38
+ } from "./chunk-3I2IVWSZ.js";
39
39
 
40
40
  // src/chat/agent-invocations/work.ts
41
41
  import { z } from "zod";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createPluginCatalogRuntime
3
- } from "./chunk-POSZWRGL.js";
3
+ } from "./chunk-2JHKISQA.js";
4
4
 
5
5
  // src/chat/plugins/catalog-runtime.ts
6
6
  var pluginCatalogRuntime = createPluginCatalogRuntime();
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  formatProviderLabel,
6
6
  startOAuthFlow
7
- } from "./chunk-WCN4YSH7.js";
7
+ } from "./chunk-JMH3DBM5.js";
8
8
  import {
9
9
  parseSandboxEgressAuthRequiredSignal
10
10
  } from "./chunk-HUO3UTAQ.js";
@@ -12,16 +12,16 @@ import {
12
12
  abandonReplacedPendingAuth,
13
13
  canReusePendingAuthLink,
14
14
  recordAuthorizationRequested
15
- } from "./chunk-VCYSOXON.js";
15
+ } from "./chunk-EW2LNCRL.js";
16
16
  import {
17
17
  AGENT_INVOCATION_MAILBOX_STATUSES
18
- } from "./chunk-D3WPMGEX.js";
18
+ } from "./chunk-3I2IVWSZ.js";
19
19
  import {
20
20
  TURN_REASONING_LEVELS
21
- } from "./chunk-4GXJUYJV.js";
21
+ } from "./chunk-32CXPIZE.js";
22
22
  import {
23
23
  pluginCatalogRuntime
24
- } from "./chunk-HWQGBIH7.js";
24
+ } from "./chunk-X22XXSZA.js";
25
25
  import {
26
26
  credentialContextSchema
27
27
  } from "./chunk-RUIXF3YQ.js";
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@sentry/junior",
4
- version: "0.148.0",
4
+ version: "0.149.0",
5
5
  private: false,
6
6
  publishConfig: {
7
7
  access: "public"