@sentry/junior 0.148.0 → 0.150.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 (84) hide show
  1. package/dist/{agent-hooks-VAUYT6PD.js → agent-hooks-SEOGOGKX.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.d.ts +1 -1
  10. package/dist/api.js +186 -35
  11. package/dist/app.js +152 -186
  12. package/dist/{catalog-runtime-WADOZVTB.js → catalog-runtime-HA7RIWYT.js} +5 -5
  13. package/dist/chat/agent/index.d.ts +5 -4
  14. package/dist/chat/agent/prompt.d.ts +8 -5
  15. package/dist/chat/agent/resume.d.ts +2 -2
  16. package/dist/chat/agent/tools.d.ts +4 -7
  17. package/dist/chat/agent/{request.d.ts → types.d.ts} +138 -129
  18. package/dist/chat/agent-dispatch/types.d.ts +2 -2
  19. package/dist/chat/agent-invocations/spawn.d.ts +2 -2
  20. package/dist/chat/api-turns/work.d.ts +6 -1
  21. package/dist/chat/app/services.d.ts +1 -1
  22. package/dist/chat/plugins/viewer.d.ts +4 -0
  23. package/dist/chat/runtime/agent-runner.d.ts +7 -5
  24. package/dist/chat/runtime/reply-executor.d.ts +0 -2
  25. package/dist/chat/runtime/slack-resume.d.ts +3 -3
  26. package/dist/chat/services/conversation-memory.d.ts +2 -2
  27. package/dist/chat/services/conversation-title.d.ts +20 -0
  28. package/dist/chat/slack/assistant-thread/title.d.ts +10 -27
  29. package/dist/chat/state/conversation.d.ts +1 -0
  30. package/dist/chat/task-execution/paused-turn.d.ts +2 -2
  31. package/dist/chat/tools/types.d.ts +1 -1
  32. package/dist/{chunk-QOWHHM3F.js → chunk-3GL327SC.js} +1 -1
  33. package/dist/{chunk-45LOR4PU.js → chunk-3JVUWLR7.js} +45 -1
  34. package/dist/{chunk-4GXJUYJV.js → chunk-3ZMKDHCT.js} +2 -2
  35. package/dist/{chunk-DUY5CDAM.js → chunk-4KAYAIBV.js} +1 -1
  36. package/dist/{chunk-ULAU5ZGU.js → chunk-4VH7KLGC.js} +106 -113
  37. package/dist/{chunk-V2FXMOEA.js → chunk-64K7GKRW.js} +2 -2
  38. package/dist/{chunk-2B3PT3V2.js → chunk-6PFDWAK2.js} +1 -1
  39. package/dist/{chunk-LNVEIJ2L.js → chunk-7D4GNUV2.js} +5 -5
  40. package/dist/{chunk-ZPL2RR7F.js → chunk-7GOP6VFJ.js} +40 -36
  41. package/dist/{chunk-HWQGBIH7.js → chunk-7NLW2NF5.js} +1 -1
  42. package/dist/{chunk-55F4QU2V.js → chunk-7QB2CKCW.js} +1 -1
  43. package/dist/{chunk-WCN4YSH7.js → chunk-DWETNV66.js} +6 -6
  44. package/dist/{chunk-D3WPMGEX.js → chunk-F5NMSEBL.js} +1 -1
  45. package/dist/{chunk-IL4EDBMV.js → chunk-FEFEIA3Z.js} +5 -5
  46. package/dist/{chunk-WOONT5ZP.js → chunk-H2RLIJ7G.js} +1 -1
  47. package/dist/{chunk-VRHTNBA6.js → chunk-ILYL6YFD.js} +3 -3
  48. package/dist/{chunk-VCYSOXON.js → chunk-IPGNWXA3.js} +545 -7
  49. package/dist/{chunk-LAZGHEYU.js → chunk-IZRSLANA.js} +1 -1
  50. package/dist/{chunk-EAI67NTM.js → chunk-JQXJ2E53.js} +1 -1
  51. package/dist/{chunk-HLPLT3NY.js → chunk-M5OZSVJI.js} +8 -4
  52. package/dist/{chunk-XJ42NBP5.js → chunk-MCNP7A7T.js} +8 -8
  53. package/dist/{chunk-OJCP3C3J.js → chunk-NCGVQXX5.js} +22 -26
  54. package/dist/{chunk-4AQZYNHM.js → chunk-NNOCRVQO.js} +2 -2
  55. package/dist/{chunk-GXYDVZKM.js → chunk-P43QM7JY.js} +5 -5
  56. package/dist/{chunk-EINWQFXI.js → chunk-QPIPYVGE.js} +5 -5
  57. package/dist/{chunk-GDFF3BQG.js → chunk-RF6J3DIO.js} +34 -36
  58. package/dist/{chunk-D6YX4NNN.js → chunk-SH6ZKJFZ.js} +4 -4
  59. package/dist/{chunk-LE5H7LMT.js → chunk-SHDREBGC.js} +1 -1
  60. package/dist/{chunk-VMNRXKAH.js → chunk-TZLYAO2J.js} +191 -134
  61. package/dist/{chunk-RRJV5UR5.js → chunk-UIMBNY6O.js} +11 -337
  62. package/dist/{chunk-ZCHIC2GM.js → chunk-UOFQEVR5.js} +15 -6
  63. package/dist/{chunk-7OEIXFC3.js → chunk-Y2VZ54CQ.js} +12 -12
  64. package/dist/{chunk-VY6W3T43.js → chunk-ZBOGYZ53.js} +4 -4
  65. package/dist/{chunk-POSZWRGL.js → chunk-ZUQT35YC.js} +1 -1
  66. package/dist/cli/chat.js +31 -32
  67. package/dist/cli/check.js +6 -6
  68. package/dist/cli/plugins.js +13 -13
  69. package/dist/cli/snapshot-create.js +9 -9
  70. package/dist/cli/upgrade.js +7 -7
  71. package/dist/{db-XUKZRFFK.js → db-HUW75QG7.js} +7 -7
  72. package/dist/instrumentation.js +4 -4
  73. package/dist/nitro.js +2 -2
  74. package/dist/{oauth-callback-server-LPZMMGFI.js → oauth-callback-server-DP7NIZPQ.js} +24 -25
  75. package/dist/{runner-DGKUTMPX.js → runner-AINV7K3M.js} +47 -45
  76. package/dist/{skills-P7YUFSXM.js → skills-PKS37E6B.js} +6 -6
  77. package/dist/spawn-NJCDEPPL.js +38 -0
  78. package/dist/{validation-S7U5M5NR.js → validation-PDC3MVMM.js} +6 -6
  79. package/dist/version.js +1 -1
  80. package/dist/{work-GAA7TVAD.js → work-KJLJRPXS.js} +17 -17
  81. package/dist/{worker-JXPJH3QB.js → worker-TYQ7YVIR.js} +11 -11
  82. package/package.json +5 -5
  83. package/dist/chunk-4EA2SFK2.js +0 -137
  84. 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-SH6ZKJFZ.js";
4
4
  import {
5
5
  bindSpawnAgent
6
- } from "./chunk-7OEIXFC3.js";
6
+ } from "./chunk-Y2VZ54CQ.js";
7
7
  import {
8
8
  createAgentInvocationWorker,
9
9
  enqueueAgentInvocation,
10
10
  listPendingAgentInvocationMailboxAppends,
11
11
  routeAgentInvocationWork
12
- } from "./chunk-OJCP3C3J.js";
12
+ } from "./chunk-NCGVQXX5.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-4VH7KLGC.js";
40
40
  import "./chunk-FA6POGLH.js";
41
41
  import {
42
42
  getTurnRequestDeadline,
43
43
  runWithTurnRequestDeadline
44
- } from "./chunk-DUY5CDAM.js";
44
+ } from "./chunk-4KAYAIBV.js";
45
45
  import {
46
46
  completeAuthPauseTurn,
47
47
  persistAuthPauseTurnState
48
- } from "./chunk-LNVEIJ2L.js";
48
+ } from "./chunk-7D4GNUV2.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-7GOP6VFJ.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-M5OZSVJI.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-UIMBNY6O.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-FEFEIA3Z.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-3GL327SC.js";
138
127
  import {
139
128
  defineJuniorPlugins,
140
129
  pluginCatalogConfigFromEnv,
@@ -167,26 +156,26 @@ import {
167
156
  setConfigDefaults,
168
157
  shouldEmitDevAgentTrace,
169
158
  shouldPropagateSandboxEgressTrace
170
- } from "./chunk-VMNRXKAH.js";
159
+ } from "./chunk-TZLYAO2J.js";
171
160
  import {
172
161
  AuthorizationFlowDisabledError,
173
162
  PluginCredentialFailureError
174
- } from "./chunk-EINWQFXI.js";
163
+ } from "./chunk-QPIPYVGE.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-MCNP7A7T.js";
182
171
  import {
183
172
  RetryableDeliveryError
184
- } from "./chunk-GDFF3BQG.js";
173
+ } from "./chunk-RF6J3DIO.js";
185
174
  import {
186
175
  formatProviderLabel,
187
176
  postSlackMessage,
188
177
  startOAuthFlow
189
- } from "./chunk-WCN4YSH7.js";
178
+ } from "./chunk-DWETNV66.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-ZBOGYZ53.js";
199
188
  import {
200
189
  createSchedulerSqlStore,
201
190
  findMatchingEventTasks,
202
191
  logScheduledTaskRunSkipped,
203
192
  scheduledTaskRunAttributes
204
- } from "./chunk-GXYDVZKM.js";
193
+ } from "./chunk-P43QM7JY.js";
205
194
  import {
206
195
  parseSlackThreadId
207
- } from "./chunk-WOONT5ZP.js";
208
- import {
209
- estimateTextTokens
210
- } from "./chunk-4EA2SFK2.js";
196
+ } from "./chunk-H2RLIJ7G.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-IPGNWXA3.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-UOFQEVR5.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-64K7GKRW.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-ILYL6YFD.js";
292
290
  import {
293
291
  juniorAgentBindings,
294
292
  juniorAgentInvocations,
295
293
  juniorConversationEvents,
296
294
  juniorConversations
297
- } from "./chunk-D3WPMGEX.js";
295
+ } from "./chunk-F5NMSEBL.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-6PFDWAK2.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-3ZMKDHCT.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-SHDREBGC.js";
324
+ import "./chunk-NNOCRVQO.js";
327
325
  import {
328
326
  pluginCatalogRuntime
329
- } from "./chunk-HWQGBIH7.js";
330
- import "./chunk-POSZWRGL.js";
327
+ } from "./chunk-7NLW2NF5.js";
328
+ import "./chunk-ZUQT35YC.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-JQXJ2E53.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-IZRSLANA.js";
373
371
  import {
374
372
  JUNIOR_VERSION
375
- } from "./chunk-55F4QU2V.js";
373
+ } from "./chunk-7QB2CKCW.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
@@ -6440,7 +6425,7 @@ function createReplyToThread(deps) {
6440
6425
  text: queued.userText,
6441
6426
  timestampMs: queued.message.metadata.dateSent.getTime(),
6442
6427
  omittedImageAttachmentCount: !isVisionEnabled() && hasPotentialImageAttachment(attachments) ? countPotentialImageAttachments(attachments) : 0,
6443
- userAttachments: await deps.resolveUserAttachments(
6428
+ attachments: await deps.resolveUserAttachments(
6444
6429
  attachments,
6445
6430
  {
6446
6431
  threadId,
@@ -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);
@@ -6996,48 +6955,54 @@ function createReplyToThread(deps) {
6996
6955
  conversationId,
6997
6956
  turnId,
6998
6957
  ...runId ? { runId } : {},
6999
- input: {
6958
+ instruction: {
7000
6959
  actor: {
7001
6960
  ...activeInstructionAuthorId ? { authorId: activeInstructionAuthorId } : {},
7002
6961
  ...activeInstructionAuthorName ? { authorName: activeInstructionAuthorName } : {},
7003
6962
  ...slackMessageTs ? { slackTs: slackMessageTs } : {}
7004
6963
  },
7005
- includeConversationContextWithPiMessages: hasDurablePromptHistory,
7006
- messageText: effectiveUserText,
7007
- conversationContext: promptConversationContext,
7008
- piMessages,
6964
+ includeConversationContextWithHistory: hasDurablePromptHistory,
6965
+ text: effectiveUserText,
6966
+ context: promptConversationContext,
7009
6967
  inboundAttachmentCount: turnAttachments.length,
7010
6968
  omittedImageAttachmentCount,
7011
- userAttachments
6969
+ attachments: userAttachments
7012
6970
  },
7013
- routing: {
7014
- credentialContext,
7015
- // Always set the execution actor when known. Resource-event turns
7016
- // carry the system principal; interactive turns carry the Slack user.
7017
- actor: executionActor,
7018
- slackConversation,
7019
- source,
7020
- destination,
7021
- publishExternally: shouldPublishExternally2(options.publishExternally),
7022
- ...destinationVisibility ? { destinationVisibility } : {},
7023
- surface: options.execution?.surface ?? "slack",
7024
- dispatch: options.execution?.dispatch,
7025
- toolChannelId,
7026
- slackActionToken
7027
- },
7028
- policy: {
6971
+ history: piMessages,
6972
+ credentialContext,
6973
+ // Always set the execution actor when known. Resource-event turns
6974
+ // carry the system principal; interactive turns carry the Slack user.
6975
+ actor: executionActor,
6976
+ slackConversation,
6977
+ source,
6978
+ destination,
6979
+ publishExternally: shouldPublishExternally2(options.publishExternally),
6980
+ ...destinationVisibility ? { destinationVisibility } : {},
6981
+ surface: options.execution?.surface ?? "slack",
6982
+ dispatch: options.execution?.dispatch,
6983
+ toolChannelId,
6984
+ slackActionToken,
6985
+ environment: {
7029
6986
  configuration: preparedState.configuration,
7030
- locationConfiguration: preparedState.locationConfiguration,
7031
- disabledFeatures: options.execution?.disabledFeatures ?? (message.author.isBot === true ? ["interactive-auth"] : void 0),
7032
- turnDeadlineAtMs: getTurnRequestDeadline()?.deadlineAtMs
6987
+ locationConfiguration: preparedState.locationConfiguration
7033
6988
  },
6989
+ disabledFeatures: options.execution?.disabledFeatures ?? (message.author.isBot === true ? ["interactive-auth"] : void 0),
6990
+ deadlineAtMs: getTurnRequestDeadline()?.deadlineAtMs,
7034
6991
  state: {
7035
6992
  pendingAuth: preparedState.conversation.processing.pendingAuth,
7036
6993
  sandboxRef: preparedState.sandboxRef
7037
6994
  },
7038
- observers: {
7039
- onStatus: (nextStatus) => status.update(nextStatus),
7040
- onToolInvocation: options.onToolInvocation
6995
+ onEvent: async (event) => {
6996
+ if (event.type === "status") {
6997
+ status.update({ text: event.text });
6998
+ return;
6999
+ }
7000
+ if (event.type === "tool_started") {
7001
+ await options.onToolInvocation?.({
7002
+ params: event.params,
7003
+ toolName: event.toolName
7004
+ });
7005
+ }
7041
7006
  },
7042
7007
  delivery: deliverAssistantMessage,
7043
7008
  durability: {
@@ -8199,29 +8164,29 @@ async function runPausedTurnInContext(payload, options, runOptions) {
8199
8164
  inputMessageIds: [userMessage.id],
8200
8165
  initialStatus: latestReportedProgress(turnMessages),
8201
8166
  replyContext: {
8202
- input: {
8203
- ...conversationContext ? { conversationContext } : {},
8204
- // Pi history is SQL-authoritative: the resumed run reads its
8205
- // exact dispatch session so unrelated conversation input cannot
8206
- // gain system authority. Interactive turns retain their merged
8207
- // projection so queued steering remains visible.
8208
- piMessages: dispatchId ? activeTurn.piMessages : await loadProjection({
8209
- conversationId: payload.conversationId
8210
- }),
8211
- ...getTurnUserReplyAttachmentContext(userMessage)
8167
+ instruction: {
8168
+ ...conversationContext ? { context: conversationContext } : {},
8169
+ // Attachment fields come from the turn user message context helper.
8170
+ ...getTurnUserReplyAttachmentContext(userMessage),
8171
+ text: userMessage.text
8212
8172
  },
8213
- routing: {
8214
- ...options.routingContext,
8215
- credentialContext,
8216
- actor,
8217
- destination: routingDestination,
8218
- // Slack resume publishes unless the checkpoint opted out.
8219
- // Missing means legacy/in-flight Slack turns still post.
8220
- publishExternally: activeTurn.publishExternally !== false,
8221
- source,
8222
- toolChannelId: destination.channelId
8223
- },
8224
- policy: {
8173
+ // Pi history is SQL-authoritative: the resumed run reads its
8174
+ // exact dispatch session so unrelated conversation input cannot
8175
+ // gain system authority. Interactive turns retain their merged
8176
+ // projection so queued steering remains visible.
8177
+ history: dispatchId ? activeTurn.piMessages : await loadProjection({
8178
+ conversationId: payload.conversationId
8179
+ }),
8180
+ ...options.routingContext,
8181
+ credentialContext,
8182
+ actor,
8183
+ destination: routingDestination,
8184
+ // Slack resume publishes unless the checkpoint opted out.
8185
+ // Missing means legacy/in-flight Slack turns still post.
8186
+ publishExternally: activeTurn.publishExternally !== false,
8187
+ source,
8188
+ toolChannelId: destination.channelId,
8189
+ environment: {
8225
8190
  locationConfiguration
8226
8191
  },
8227
8192
  state: {
@@ -8951,7 +8916,8 @@ function dashboardHostRoutePaths(dashboard) {
8951
8916
  `${pagePath("system")}/*`,
8952
8917
  pagePath("plugins"),
8953
8918
  `${pagePath("plugins")}/*`,
8954
- pagePath("settings/api-tokens")
8919
+ pagePath("settings"),
8920
+ `${pagePath("settings")}/*`
8955
8921
  ];
8956
8922
  if (dashboard.componentGallery) {
8957
8923
  pagePaths.push(pagePath("dev"), `${pagePath("dev")}/*`);
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-HWQGBIH7.js";
4
- import "./chunk-POSZWRGL.js";
3
+ } from "./chunk-7NLW2NF5.js";
4
+ import "./chunk-ZUQT35YC.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-JQXJ2E53.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-IZRSLANA.js";
13
+ import "./chunk-7QB2CKCW.js";
14
14
  import "./chunk-MLKGABMK.js";
15
15
  export {
16
16
  pluginCatalogRuntime
@@ -11,11 +11,12 @@
11
11
  */
12
12
  import { type StreamFn } from "@earendil-works/pi-agent-core";
13
13
  import type { AgentRunOutcome } from "@/chat/runtime/agent-run-outcome";
14
- import { type AgentRunRequest } from "@/chat/agent/request";
14
+ import { type AgentRun } from "@/chat/agent/types";
15
15
  /**
16
16
  * Run a full agent turn, optionally using a caller-provided model stream.
17
17
  *
18
- * The stream changes model output only; prompt assembly, persistence, tools,
19
- * delivery, and completion still use the normal agent runtime.
18
+ * Prefer binding `streamFn` through `createAgentRunner`. The stream changes
19
+ * model output only; prompt assembly, persistence, tools, delivery, and
20
+ * completion still use the normal agent runtime.
20
21
  */
21
- export declare function executeAgentRun(request: AgentRunRequest, streamFn?: StreamFn): Promise<AgentRunOutcome>;
22
+ export declare function executeAgentRun(run: AgentRun, streamFn?: StreamFn): Promise<AgentRunOutcome>;