@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
package/dist/app.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  processConversationWork
3
- } from "./chunk-D6YX4NNN.js";
3
+ } from "./chunk-TFBNBXPU.js";
4
4
  import {
5
5
  bindSpawnAgent
6
- } from "./chunk-7OEIXFC3.js";
6
+ } from "./chunk-ALJG73MQ.js";
7
7
  import {
8
8
  createAgentInvocationWorker,
9
9
  enqueueAgentInvocation,
10
10
  listPendingAgentInvocationMailboxAppends,
11
11
  routeAgentInvocationWork
12
- } from "./chunk-OJCP3C3J.js";
12
+ } from "./chunk-W7UONUIZ.js";
13
13
  import {
14
14
  GET as GET2,
15
15
  GET2 as GET3,
@@ -36,16 +36,16 @@ import {
36
36
  startSlackProcessingReaction,
37
37
  stripLeadingBotMention,
38
38
  wakePausedTurn
39
- } from "./chunk-ULAU5ZGU.js";
39
+ } from "./chunk-75DSYFFB.js";
40
40
  import "./chunk-FA6POGLH.js";
41
41
  import {
42
42
  getTurnRequestDeadline,
43
43
  runWithTurnRequestDeadline
44
- } from "./chunk-DUY5CDAM.js";
44
+ } from "./chunk-EXW76GW4.js";
45
45
  import {
46
46
  completeAuthPauseTurn,
47
47
  persistAuthPauseTurnState
48
- } from "./chunk-LNVEIJ2L.js";
48
+ } from "./chunk-ART7P442.js";
49
49
  import {
50
50
  GET,
51
51
  conversationVisibilityFromSlackChannelType,
@@ -53,7 +53,7 @@ import {
53
53
  resolveSlackChannelTypeFromMessage,
54
54
  resolveSlackConversationContext,
55
55
  routeApiTurnWork
56
- } from "./chunk-ZPL2RR7F.js";
56
+ } from "./chunk-5CWUQXXT.js";
57
57
  import "./chunk-4CODA7P5.js";
58
58
  import {
59
59
  CONVERSATION_WORK_STALE_ENQUEUE_MS,
@@ -65,47 +65,36 @@ import {
65
65
  isInvalidConversationRecordError,
66
66
  listActiveConversationIds,
67
67
  removeActiveConversation
68
- } from "./chunk-HLPLT3NY.js";
68
+ } from "./chunk-JMSMXXED.js";
69
69
  import {
70
- buildConversationContext,
71
70
  buildDeliveredTurnStatePatch,
72
71
  claimDispatchMailboxAppend,
73
72
  confirmDispatchMailboxAppend,
74
- createConversationMemoryService,
75
73
  createOrGetDispatch,
76
- estimateConversationContextTokens,
77
74
  finalizeFailedTurnReplyWithEvent,
78
75
  getAgentTurnDiagnosticsAttributes,
79
- getConversationMessageSlackTs,
80
76
  getDispatchConversationId,
81
77
  getDispatchInputMessageId,
82
78
  getDispatchInputMessageIds,
83
79
  getDispatchRecord,
84
80
  getDispatchTurnId,
85
81
  getPluginDispatchProjection,
86
- getThreadTitleSourceMessage,
87
82
  getTurnUserMessage,
88
83
  getTurnUserReplyAttachmentContext,
89
84
  getTurnUserSlackMessageTs,
90
- isHumanConversationMessage,
91
85
  isTerminalDispatchStatus,
92
86
  listPendingDispatchMailboxAppends,
93
- markConversationMessage,
94
87
  markDispatchAwaitingResume,
95
88
  markDispatchBlocked,
96
89
  markDispatchCompleted,
97
90
  markDispatchFailed,
98
91
  markDispatchRunning,
99
- normalizeConversationText,
100
92
  processPluginTask,
101
- recordDeliveredAssistantMessage,
102
93
  recordTaskExecution,
103
94
  requireTurnFailureEventId,
104
95
  resolveTurnSessionRouting,
105
- scheduleSessionCompletedPluginTasks,
106
- turnHasReply,
107
- upsertConversationMessage
108
- } from "./chunk-RRJV5UR5.js";
96
+ scheduleSessionCompletedPluginTasks
97
+ } from "./chunk-UZGASGOD.js";
109
98
  import {
110
99
  ConversationTurnLifecycleService,
111
100
  coerceThreadConversationState,
@@ -115,7 +104,7 @@ import {
115
104
  persistThreadRuntimeState,
116
105
  persistThreadState,
117
106
  persistThreadStateById
118
- } from "./chunk-IL4EDBMV.js";
107
+ } from "./chunk-4YKPOYRV.js";
119
108
  import "./chunk-UTL3MHPC.js";
120
109
  import {
121
110
  getVercelConversationWorkQueue,
@@ -134,7 +123,7 @@ import {
134
123
  import {
135
124
  validatePluginEgressCredentialHooks,
136
125
  validatePluginRegistrations
137
- } from "./chunk-QOWHHM3F.js";
126
+ } from "./chunk-QIW7OQEO.js";
138
127
  import {
139
128
  defineJuniorPlugins,
140
129
  pluginCatalogConfigFromEnv,
@@ -167,18 +156,18 @@ import {
167
156
  setConfigDefaults,
168
157
  shouldEmitDevAgentTrace,
169
158
  shouldPropagateSandboxEgressTrace
170
- } from "./chunk-VMNRXKAH.js";
159
+ } from "./chunk-DK5UT6PQ.js";
171
160
  import {
172
161
  AuthorizationFlowDisabledError,
173
162
  PluginCredentialFailureError
174
- } from "./chunk-EINWQFXI.js";
163
+ } from "./chunk-XPYWWMHR.js";
175
164
  import "./chunk-DIB4GX3G.js";
176
165
  import {
177
166
  createUserTokenStore,
178
167
  deleteMcpAuthSessionsForUserProvider,
179
168
  deleteMcpServerSessionId,
180
169
  deleteMcpStoredOAuthCredentials
181
- } from "./chunk-XJ42NBP5.js";
170
+ } from "./chunk-RB26T3LU.js";
182
171
  import {
183
172
  RetryableDeliveryError
184
173
  } from "./chunk-GDFF3BQG.js";
@@ -186,7 +175,7 @@ import {
186
175
  formatProviderLabel,
187
176
  postSlackMessage,
188
177
  startOAuthFlow
189
- } from "./chunk-WCN4YSH7.js";
178
+ } from "./chunk-JMH3DBM5.js";
190
179
  import "./chunk-HUO3UTAQ.js";
191
180
  import {
192
181
  getExperimentalFeatures,
@@ -195,57 +184,66 @@ import {
195
184
  import {
196
185
  getSandboxResourceConfig,
197
186
  setSandboxResourceConfig
198
- } from "./chunk-VY6W3T43.js";
187
+ } from "./chunk-2P6BQQER.js";
199
188
  import {
200
189
  createSchedulerSqlStore,
201
190
  findMatchingEventTasks,
202
191
  logScheduledTaskRunSkipped,
203
192
  scheduledTaskRunAttributes
204
- } from "./chunk-GXYDVZKM.js";
193
+ } from "./chunk-URDCZAL4.js";
205
194
  import {
206
195
  parseSlackThreadId
207
- } from "./chunk-WOONT5ZP.js";
208
- import {
209
- estimateTextTokens
210
- } from "./chunk-4EA2SFK2.js";
196
+ } from "./chunk-MEMURSBG.js";
211
197
  import {
212
198
  ConversationTurnBoundaryError,
213
199
  CooperativeTurnYieldError,
214
200
  TurnInputCommitLostError,
215
201
  TurnInputDeferredError,
216
202
  abandonTurnRecord,
203
+ buildConversationContext,
217
204
  buildDeterministicAssistantMessageId,
218
205
  buildDeterministicTurnId,
219
206
  clearPendingAuth,
220
207
  commitAcceptedReply,
221
208
  commitMessages,
222
209
  completeTurnRecord,
210
+ createConversationMemoryService,
211
+ estimateConversationContextTokens,
212
+ estimateTextTokens,
223
213
  failTurnRecord,
224
214
  getAssistantReplyText,
215
+ getConversationMessageSlackTs,
225
216
  getConversationTurnBoundaryError,
226
217
  getTurnRecord,
227
218
  getTurnRecordForResume,
228
219
  hydrateConversationMessages,
229
220
  isCooperativeTurnYieldError,
221
+ isHumanConversationMessage,
230
222
  isTurnInputCommitLostError,
231
223
  isTurnInputDeferredError,
232
224
  listTurnSummaries,
233
225
  loadConversationProjection,
234
226
  loadProjection,
235
227
  loadTurnCheckpoint,
228
+ markConversationMessage,
236
229
  markTurnClosed,
237
230
  markTurnCompleted,
238
231
  markTurnFailed,
232
+ normalizeConversationText,
239
233
  persistConversationMessageSummaries,
240
234
  persistConversationMessages,
241
235
  persistWithRetry,
236
+ recordDeliveredAssistantMessage,
242
237
  recordSubscribedReplyRoute,
243
238
  recordTurnSummary,
239
+ resolveConversationTitle,
244
240
  saveTurnCheckpoint,
245
241
  startActiveTurn,
246
242
  stripRuntimeTurnContext,
247
- trimTrailingAssistantMessages
248
- } from "./chunk-VCYSOXON.js";
243
+ trimTrailingAssistantMessages,
244
+ turnHasReply,
245
+ upsertConversationMessage
246
+ } from "./chunk-EW2LNCRL.js";
249
247
  import "./chunk-3Y47VMHV.js";
250
248
  import "./chunk-PDO5BLNM.js";
251
249
  import "./chunk-UIE3R5XU.js";
@@ -265,7 +263,7 @@ import {
265
263
  verifyEventTaskCredentialSubject,
266
264
  verifyScheduledTaskCredentialSubject,
267
265
  verifySlackDirectCredentialSubject
268
- } from "./chunk-ZCHIC2GM.js";
266
+ } from "./chunk-7BH46NB4.js";
269
267
  import {
270
268
  SlackActionError,
271
269
  downloadPrivateSlackFile,
@@ -275,7 +273,7 @@ import {
275
273
  normalizeSlackConversationId,
276
274
  runWithSlackInstallationToken,
277
275
  runWithWorkspaceTeamId
278
- } from "./chunk-V2FXMOEA.js";
276
+ } from "./chunk-SWHPVZBV.js";
279
277
  import {
280
278
  contextProvenance,
281
279
  createSlackDestination,
@@ -288,19 +286,19 @@ import {
288
286
  requireSlackDestination,
289
287
  withConversationEventLock,
290
288
  withConversationMutationLock
291
- } from "./chunk-VRHTNBA6.js";
289
+ } from "./chunk-3GYZ5YEH.js";
292
290
  import {
293
291
  juniorAgentBindings,
294
292
  juniorAgentInvocations,
295
293
  juniorConversationEvents,
296
294
  juniorConversations
297
- } from "./chunk-D3WPMGEX.js";
295
+ } from "./chunk-3I2IVWSZ.js";
298
296
  import "./chunk-EM225ITJ.js";
299
297
  import {
300
298
  acquireActiveLock,
301
299
  getStateAdapter,
302
300
  withActiveLock
303
- } from "./chunk-2B3PT3V2.js";
301
+ } from "./chunk-25SC7D6Z.js";
304
302
  import {
305
303
  STANDARD_MODEL_PROFILE,
306
304
  botConfig,
@@ -318,16 +316,16 @@ import {
318
316
  modelIdForProfile,
319
317
  setSlackReactionConfig,
320
318
  standardModelId
321
- } from "./chunk-4GXJUYJV.js";
319
+ } from "./chunk-32CXPIZE.js";
322
320
  import {
323
321
  juniorDestinations
324
322
  } from "./chunk-VFUK3X5B.js";
325
- import "./chunk-LE5H7LMT.js";
326
- import "./chunk-4AQZYNHM.js";
323
+ import "./chunk-3KGQOKIG.js";
324
+ import "./chunk-4JGM7FXO.js";
327
325
  import {
328
326
  pluginCatalogRuntime
329
- } from "./chunk-HWQGBIH7.js";
330
- import "./chunk-POSZWRGL.js";
327
+ } from "./chunk-X22XXSZA.js";
328
+ import "./chunk-2JHKISQA.js";
331
329
  import {
332
330
  credentialContextForActor
333
331
  } from "./chunk-RUIXF3YQ.js";
@@ -361,7 +359,7 @@ import {
361
359
  withContext,
362
360
  withLogContext,
363
361
  withSpan
364
- } from "./chunk-EAI67NTM.js";
362
+ } from "./chunk-RLVZIWNQ.js";
365
363
  import {
366
364
  continueTrace
367
365
  } from "./chunk-6GWA276C.js";
@@ -369,10 +367,10 @@ import "./chunk-OOUNJNMR.js";
369
367
  import "./chunk-H4HBKISO.js";
370
368
  import {
371
369
  JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE
372
- } from "./chunk-LAZGHEYU.js";
370
+ } from "./chunk-6G5RCDKP.js";
373
371
  import {
374
372
  JUNIOR_VERSION
375
- } from "./chunk-55F4QU2V.js";
373
+ } from "./chunk-ZYMYLLWG.js";
376
374
  import "./chunk-MLKGABMK.js";
377
375
 
378
376
  // src/app.ts
@@ -6024,8 +6022,7 @@ function createJuniorRuntimeServices(overrides = {}) {
6024
6022
  scheduleSessionCompletedPluginTasks: overrides.replyExecutor?.scheduleSessionCompletedPluginTasks ?? (async (params) => {
6025
6023
  await scheduleSessionCompletedPluginTasks(params);
6026
6024
  }),
6027
- turnLifecycle: overrides.replyExecutor?.turnLifecycle ?? new ConversationTurnLifecycleService(getConversationEventStore()),
6028
- generateThreadTitle: conversationMemory.generateThreadTitle
6025
+ turnLifecycle: overrides.replyExecutor?.turnLifecycle ?? new ConversationTurnLifecycleService(getConversationEventStore())
6029
6026
  },
6030
6027
  subscribedReplyPolicy: createSubscribedReplyPolicy({
6031
6028
  completeObject: overrides.subscribedReplyPolicy?.completeObject ?? completeObject
@@ -6069,56 +6066,44 @@ function readSlackActionToken(message) {
6069
6066
  }
6070
6067
 
6071
6068
  // src/chat/slack/assistant-thread/title.ts
6072
- function maybeUpdateAssistantTitle(args) {
6073
- const assistantThreadContext = args.assistantThreadContext;
6074
- if (!assistantThreadContext?.channelId || !assistantThreadContext.threadTs) {
6075
- return Promise.resolve(void 0);
6076
- }
6077
- const titleSourceMessage = getThreadTitleSourceMessage(args.conversation);
6078
- if (!titleSourceMessage) {
6079
- return Promise.resolve(void 0);
6080
- }
6081
- const isDm = isDmChannel(assistantThreadContext.channelId);
6082
- return (async () => {
6083
- let title;
6084
- try {
6085
- title = await args.generateThreadTitle(titleSourceMessage.text);
6086
- } catch (error) {
6087
- logWarn("thread.title.generation.failed", {
6088
- "exception.message": error instanceof Error ? error.message : String(error)
6089
- });
6090
- return void 0;
6091
- }
6092
- if (isDm) {
6093
- try {
6094
- await args.getSlackAdapter().setAssistantTitle(
6095
- assistantThreadContext.channelId,
6096
- assistantThreadContext.threadTs,
6097
- title
6098
- );
6099
- } catch (error) {
6100
- const slackErrorCode = getSlackApiErrorCode(error);
6101
- const assistantTitleErrorAttributes = {
6102
- "app.slack.assistant_title.outcome": "permission_denied",
6103
- ...slackErrorCode ? {
6104
- "app.slack.assistant_title.error_code": slackErrorCode
6105
- } : {}
6106
- };
6107
- if (isSlackTitlePermissionError(error)) {
6108
- setSpanAttributes(assistantTitleErrorAttributes);
6109
- logError(
6110
- "thread.title.generation_permission.denied",
6111
- assistantTitleErrorAttributes
6112
- );
6113
- } else {
6114
- logWarn("thread.title.slack_update.failed", {
6115
- "exception.message": error instanceof Error ? error.message : String(error)
6116
- });
6117
- }
6118
- }
6069
+ var projectedAssistantTitles = /* @__PURE__ */ new Set();
6070
+ function assistantTitleKey(channelId, threadTs) {
6071
+ return `${channelId}:${threadTs}`;
6072
+ }
6073
+ async function maybeSyncAssistantTitle(args) {
6074
+ const channelId = args.channelId;
6075
+ const threadTs = args.threadTs;
6076
+ if (!channelId || !threadTs || !isDmChannel(channelId)) {
6077
+ return;
6078
+ }
6079
+ const key = assistantTitleKey(channelId, threadTs);
6080
+ if (projectedAssistantTitles.has(key)) {
6081
+ return;
6082
+ }
6083
+ projectedAssistantTitles.add(key);
6084
+ try {
6085
+ await args.getSlackAdapter().setAssistantTitle(channelId, threadTs, args.title);
6086
+ } catch (error) {
6087
+ const slackErrorCode = getSlackApiErrorCode(error);
6088
+ if (isSlackTitlePermissionError(error)) {
6089
+ const assistantTitleErrorAttributes = {
6090
+ "app.slack.assistant_title.outcome": "permission_denied",
6091
+ ...slackErrorCode ? {
6092
+ "app.slack.assistant_title.error_code": slackErrorCode
6093
+ } : {}
6094
+ };
6095
+ setSpanAttributes(assistantTitleErrorAttributes);
6096
+ logError(
6097
+ "thread.title.generation_permission.denied",
6098
+ assistantTitleErrorAttributes
6099
+ );
6100
+ return;
6119
6101
  }
6120
- return { title };
6121
- })();
6102
+ projectedAssistantTitles.delete(key);
6103
+ logWarn("thread.title.slack_update.failed", {
6104
+ "exception.message": error instanceof Error ? error.message : String(error)
6105
+ });
6106
+ }
6122
6107
  }
6123
6108
 
6124
6109
  // src/chat/services/provider-default-config.ts
@@ -6935,44 +6920,18 @@ function createReplyToThread(deps) {
6935
6920
  }
6936
6921
  }
6937
6922
  status.update();
6938
- const assistantTitleTask = (async () => {
6939
- if (conversationId) {
6940
- const storedConversation = await getConversationStore().get({
6941
- conversationId
6942
- });
6943
- if (storedConversation?.title) {
6944
- return void 0;
6945
- }
6923
+ void resolveConversationTitle({ conversationId }).then(async (title) => {
6924
+ if (!title) {
6925
+ return;
6946
6926
  }
6947
- return maybeUpdateAssistantTitle({
6948
- assistantThreadContext,
6949
- assistantUserName: botConfig.userName,
6950
- channelId,
6951
- conversation: preparedState.conversation,
6952
- generateThreadTitle: deps.services.generateThreadTitle,
6927
+ await maybeSyncAssistantTitle({
6928
+ channelId: assistantThreadContext?.channelId,
6953
6929
  getSlackAdapter: deps.getSlackAdapter,
6954
- modelId: botConfig.fastModelId,
6955
- actorId: slackActorId,
6956
- runId,
6957
- threadId
6930
+ threadTs: assistantThreadContext?.threadTs,
6931
+ title
6958
6932
  });
6959
- })();
6960
- void assistantTitleTask.then(async (titleUpdateResult) => {
6961
- if (!titleUpdateResult) return;
6962
- if (conversationId && titleUpdateResult.title) {
6963
- try {
6964
- await getConversationStore().recordActivity({
6965
- activityAtMs: message.metadata.dateSent.getTime(),
6966
- conversationId,
6967
- nowMs: Date.now(),
6968
- title: titleUpdateResult.title
6969
- });
6970
- } catch (error) {
6971
- logException(error, "conversation.title.persist.failed");
6972
- }
6973
- }
6974
6933
  }).catch((error) => {
6975
- logException(error, "assistant.title.task.failed");
6934
+ logException(error, "conversation.title.task.failed");
6976
6935
  });
6977
6936
  const toolChannelId = channelId;
6978
6937
  const activeInstructionAuthorId = actor?.userId ?? parseActorUserId(message.author.userId);
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-HWQGBIH7.js";
4
- import "./chunk-POSZWRGL.js";
3
+ } from "./chunk-X22XXSZA.js";
4
+ import "./chunk-2JHKISQA.js";
5
5
  import "./chunk-RUIXF3YQ.js";
6
6
  import "./chunk-HZF5P5UN.js";
7
7
  import "./chunk-F3B2YJ76.js";
8
- import "./chunk-EAI67NTM.js";
8
+ import "./chunk-RLVZIWNQ.js";
9
9
  import "./chunk-6GWA276C.js";
10
10
  import "./chunk-OOUNJNMR.js";
11
11
  import "./chunk-H4HBKISO.js";
12
- import "./chunk-LAZGHEYU.js";
13
- import "./chunk-55F4QU2V.js";
12
+ import "./chunk-6G5RCDKP.js";
13
+ import "./chunk-ZYMYLLWG.js";
14
14
  import "./chunk-MLKGABMK.js";
15
15
  export {
16
16
  pluginCatalogRuntime
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import type { StateAdapter } from "chat";
3
3
  import { type Destination } from "@sentry/junior-plugin-api";
4
+ import type { ConversationPrivacy } from "@/chat/conversation-privacy";
4
5
  import type { WebActor } from "@/chat/actor";
5
6
  import type { ConversationStore } from "@/chat/conversations/store";
6
7
  import { type ConversationTurnLifecycle } from "@/chat/conversations/turn-lifecycle";
@@ -28,12 +29,16 @@ export interface CreateApiConversationInput {
28
29
  message: string;
29
30
  /** Client-supplied idempotency key for the first message. */
30
31
  idempotencyKey: string;
32
+ /** New roots default public. Continues never rewrite visibility. */
33
+ visibility?: ConversationPrivacy;
31
34
  }
32
35
  export interface AppendApiConversationMessageInput {
33
36
  actor: WebActor;
34
37
  conversationId: string;
35
38
  message: string;
36
39
  idempotencyKey: string;
40
+ /** Applied only when this call creates the conversation root. */
41
+ rootVisibility?: ConversationPrivacy;
37
42
  }
38
43
  export interface ApiConversationMessageAccepted {
39
44
  conversationId: string;
@@ -68,7 +73,7 @@ export declare function buildApiTurnInboundMessage(args: {
68
73
  messageId: string;
69
74
  nowMs?: number;
70
75
  }): InboundMessage;
71
- /** Create a public root conversation and enqueue its first message. */
76
+ /** Create a dashboard root conversation and enqueue its first message. */
72
77
  export declare function createAndEnqueueApiConversation(input: CreateApiConversationInput, options: EnqueueOptions): Promise<ApiConversationMessageAccepted>;
73
78
  /** Append one API message to an existing conversation and wake the worker. */
74
79
  export declare function appendAndEnqueueApiConversationMessage(input: AppendApiConversationMessageInput, options: EnqueueOptions): Promise<ApiConversationMessageAccepted>;
@@ -14,7 +14,7 @@ export interface JuniorRuntimeServices {
14
14
  export interface JuniorRuntimeServiceOverrides {
15
15
  conversationMemory?: Partial<ConversationMemoryDeps>;
16
16
  contextCompactor?: Partial<ContextCompactorDeps>;
17
- replyExecutor?: Partial<Omit<ReplyExecutorServices, "generateThreadTitle">>;
17
+ replyExecutor?: Partial<ReplyExecutorServices>;
18
18
  subscribedReplyPolicy?: Partial<SubscribedReplyPolicyDeps>;
19
19
  sandbox?: {
20
20
  tracePropagation?: SandboxEgressTracePropagationConfig;
@@ -12,7 +12,6 @@ import { type Destination } from "@sentry/junior-plugin-api";
12
12
  import type { AgentRunner } from "@/chat/runtime/agent-runner";
13
13
  import type { PreparedTurnState } from "@/chat/runtime/turn-preparation";
14
14
  import { type PrepareTurnStateInput, type QueuedTurnMessage, type TurnToolInvocation } from "@/chat/runtime/turn-input";
15
- import { type ConversationMemoryService } from "@/chat/services/conversation-memory";
16
15
  import type { ContextCompactor } from "@/chat/services/context-compaction";
17
16
  import { lookupSlackUser } from "@/chat/slack/user";
18
17
  import type { PausedTurnRequest } from "@/chat/task-execution/turn-wake";
@@ -21,7 +20,6 @@ import type { DispatchTurnContext, DispatchTurnResult } from "@/chat/agent-dispa
21
20
  export interface ReplyExecutorServices {
22
21
  agentRunner: AgentRunner;
23
22
  contextCompactor: ContextCompactor;
24
- generateThreadTitle: ConversationMemoryService["generateThreadTitle"];
25
23
  getPausedTurnRequest: (args: {
26
24
  conversationId: string;
27
25
  turnId: string;
@@ -11,7 +11,6 @@ export interface ConversationMemoryService {
11
11
  actorId?: string;
12
12
  runId?: string;
13
13
  }) => Promise<void>;
14
- generateThreadTitle: (sourceText: string) => Promise<string>;
15
14
  }
16
15
  export declare function generateConversationId(prefix: "assistant" | "backfill" | "compaction" | "turn"): string;
17
16
  /** Normalize message boundaries without changing transcript formatting. */
@@ -23,6 +22,7 @@ export declare function upsertConversationMessage(conversation: ThreadConversati
23
22
  export declare function recordDeliveredAssistantMessage(args: {
24
23
  conversation: ThreadConversationState;
25
24
  sessionId: string;
25
+ source?: "web";
26
26
  text: string;
27
27
  userMessageId?: string;
28
28
  }): string;
@@ -39,7 +39,7 @@ export declare function buildConversationContext(conversation: ThreadConversatio
39
39
  }): string | undefined;
40
40
  /** Return the earliest human-authored message known for a thread. */
41
41
  export declare function getThreadTitleSourceMessage(conversation: ThreadConversationState): ConversationMessage | undefined;
42
- /** Build the service that owns durable conversation memory compaction and titles. */
42
+ /** Build the service that owns durable conversation memory compaction. */
43
43
  export declare function createConversationMemoryService(deps: ConversationMemoryDeps): ConversationMemoryService;
44
44
  export declare function isHumanConversationMessage(message: ConversationMessage): boolean;
45
45
  /** Return the native Slack timestamp for a persisted conversation message. */
@@ -0,0 +1,20 @@
1
+ import type { ConversationStore } from "@/chat/conversations/store";
2
+ import type { ThreadConversationState } from "@/chat/state/conversation";
3
+ /** Test-only: clear in-flight title work between cases. */
4
+ export declare function resetConversationTitleStateForTests(): void;
5
+ /**
6
+ * Fire-and-forget title work after durable human transcript writes.
7
+ * This is the only entry that starts generation.
8
+ */
9
+ export declare function scheduleConversationTitle(args: {
10
+ conversation: ThreadConversationState;
11
+ conversationId: string | undefined;
12
+ }): void;
13
+ /**
14
+ * Join in-flight generation when present, otherwise read the stored title.
15
+ * Does not start generation; providers use this only to project a title.
16
+ */
17
+ export declare function resolveConversationTitle(args: {
18
+ conversationId: string;
19
+ conversationStore?: Pick<ConversationStore, "get">;
20
+ }): Promise<string | undefined>;
@@ -1,33 +1,16 @@
1
1
  import type { SlackAdapter } from "@chat-adapter/slack";
2
- import { type ConversationMemoryService } from "@/chat/services/conversation-memory";
3
- import type { ThreadConversationState } from "@/chat/state/conversation";
2
+ /** Test-only: clear set-once DM title projection between cases. */
3
+ export declare function resetAssistantTitleProjectionForTests(): void;
4
4
  /**
5
- * Best-effort conversation title generation for all Slack conversations.
5
+ * Best-effort Slack projection for a stored conversation title.
6
6
  *
7
- * Title generation is intentionally detached from reply generation and visible
8
- * reply delivery. For DM assistant threads the generated title is also pushed
9
- * to Slack via `setAssistantTitle`. For channel conversations the title is
10
- * generated and returned for dashboard reporting only — the Slack API for
11
- * setting thread titles is DM-only and is not called.
12
- *
13
- * Stable Slack permission failures on DM title updates are treated as a
14
- * terminal skip for the current source message so later turns do not keep
15
- * paying for the same fast-model call that Slack will reject.
7
+ * Only DM assistant threads support `setAssistantTitle`. Channel conversations
8
+ * keep the title in Junior for dashboard reporting and do not call Slack.
9
+ * Projection is set-once per DM thread so later turns do not rewrite Slack.
16
10
  */
17
- export declare function maybeUpdateAssistantTitle(args: {
18
- assistantThreadContext?: {
19
- channelId: string;
20
- threadTs: string;
21
- };
22
- assistantUserName: string;
11
+ export declare function maybeSyncAssistantTitle(args: {
23
12
  channelId?: string;
24
- conversation: ThreadConversationState;
25
- generateThreadTitle: ConversationMemoryService["generateThreadTitle"];
26
13
  getSlackAdapter: () => Pick<SlackAdapter, "setAssistantTitle">;
27
- modelId: string;
28
- actorId?: string;
29
- runId?: string;
30
- threadId?: string;
31
- }): Promise<{
32
- title?: string;
33
- } | undefined>;
14
+ threadTs?: string;
15
+ title: string;
16
+ }): Promise<void>;
@@ -7,6 +7,7 @@ export interface ConversationAuthor {
7
7
  }
8
8
  export interface ConversationMessageMeta {
9
9
  attachmentCount?: number;
10
+ source?: "web";
10
11
  eventType?: string;
11
12
  explicitMention?: boolean;
12
13
  imageAttachmentCount?: number;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getChatConfig
3
- } from "./chunk-4GXJUYJV.js";
3
+ } from "./chunk-32CXPIZE.js";
4
4
 
5
5
  // src/chat/state/adapter.ts
6
6
  import { createMemoryState } from "@chat-adapter/state-memory";
@@ -5,7 +5,7 @@ import {
5
5
  logInfo,
6
6
  logWarn,
7
7
  setSpanAttributes
8
- } from "./chunk-EAI67NTM.js";
8
+ } from "./chunk-RLVZIWNQ.js";
9
9
  import {
10
10
  discoverInstalledPluginPackageContent,
11
11
  normalizePluginPackageNames