@sentry/junior 0.141.0 → 0.143.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-HIRVKUQJ.js → agent-hooks-2EP3QS47.js} +10 -10
  2. package/dist/api/schema/task.d.ts +8 -0
  3. package/dist/api/schema.js +1 -1
  4. package/dist/api.js +34 -22
  5. package/dist/app.js +62 -91
  6. package/dist/{catalog-runtime-XVLED5UH.js → catalog-runtime-IAVW4W3B.js} +5 -5
  7. package/dist/chat/event-tasks/types.d.ts +7 -1
  8. package/dist/chat/runtime/turn.d.ts +0 -4
  9. package/dist/chat/scheduled-tasks/tools/create.d.ts +1 -0
  10. package/dist/chat/scheduled-tasks/types.d.ts +5 -0
  11. package/dist/chat/services/conversation-memory.d.ts +2 -1
  12. package/dist/chat/services/short-title.d.ts +25 -0
  13. package/dist/chat/state/conversation.d.ts +6 -17
  14. package/dist/chat/tools/create-event-task.d.ts +1 -0
  15. package/dist/{chunk-3H42HMA2.js → chunk-2KLMGRRQ.js} +5 -1
  16. package/dist/{chunk-HN4UZTG7.js → chunk-2T5CHXRZ.js} +2 -2
  17. package/dist/{chunk-PGJUJCOQ.js → chunk-5YJBS4I5.js} +1 -1
  18. package/dist/{chunk-BBLO66XT.js → chunk-7GVX5SOG.js} +2 -2
  19. package/dist/{chunk-2DOVDDZJ.js → chunk-A3XPSABC.js} +3 -3
  20. package/dist/{chunk-FZFJZZR3.js → chunk-AEFJN7OK.js} +4 -4
  21. package/dist/{chunk-DK3GQWJK.js → chunk-ANG7IWAI.js} +6 -6
  22. package/dist/{chunk-LMGKSDO4.js → chunk-BJ6ISBOA.js} +1 -1
  23. package/dist/{chunk-H4WNQFBH.js → chunk-F6RWNJBK.js} +5 -5
  24. package/dist/{chunk-UFEU4UX6.js → chunk-GZRWULXF.js} +1 -1
  25. package/dist/{chunk-DVIJ6DP6.js → chunk-I25V3XRN.js} +2 -2
  26. package/dist/{chunk-A2O7SGK5.js → chunk-I4NQNZVW.js} +6 -6
  27. package/dist/{chunk-DKH4WGZU.js → chunk-I5PIM72M.js} +341 -16
  28. package/dist/{chunk-FWXSPJRN.js → chunk-LSBQHDI2.js} +1 -1
  29. package/dist/{chunk-6U44QGXL.js → chunk-M2T7MHQJ.js} +1 -1
  30. package/dist/{chunk-5MFCEKR6.js → chunk-NAINBOZQ.js} +3 -3
  31. package/dist/{chunk-EYD523BV.js → chunk-NVFVM67W.js} +1 -1
  32. package/dist/{chunk-43OPSFUY.js → chunk-OB7ZJK7Y.js} +1 -1
  33. package/dist/{chunk-HQAFIN6O.js → chunk-OG5JQHKR.js} +1 -1
  34. package/dist/{chunk-YWM6MJT4.js → chunk-OGQGJAD7.js} +2 -0
  35. package/dist/{chunk-PIQKV7IR.js → chunk-PBV7VXUA.js} +10 -451
  36. package/dist/{chunk-LIVSCWI5.js → chunk-QFWXGUAH.js} +23 -26
  37. package/dist/{chunk-UONUDOJP.js → chunk-RABHACKG.js} +7 -7
  38. package/dist/{chunk-7ULXCNOZ.js → chunk-SNBTWIQO.js} +6 -6
  39. package/dist/chunk-STX5WIH6.js +75 -0
  40. package/dist/{chunk-44NWPKY3.js → chunk-TPJK6AVJ.js} +1 -1
  41. package/dist/{chunk-6FRAWWGR.js → chunk-U5ATCOHE.js} +2 -2
  42. package/dist/{chunk-5LPWHC7Q.js → chunk-UFCA4EZB.js} +80 -46
  43. package/dist/chunk-WJHWOAVZ.js +67 -0
  44. package/dist/{chunk-NFL4FRIU.js → chunk-WM4PRM7W.js} +4 -4
  45. package/dist/{chunk-OFQBDHVG.js → chunk-WSWVWP2V.js} +1 -1
  46. package/dist/{chunk-DBKS7JR2.js → chunk-X5SC2UGE.js} +3 -3
  47. package/dist/{chunk-OHO46E7F.js → chunk-XYJNNZYR.js} +88 -36
  48. package/dist/cli/chat.js +32 -30
  49. package/dist/cli/check.js +6 -6
  50. package/dist/cli/plugins.js +13 -13
  51. package/dist/cli/snapshot-create.js +9 -9
  52. package/dist/cli/upgrade.js +7 -7
  53. package/dist/db/schema/event-tasks.d.ts +20 -52
  54. package/dist/db/schema/scheduled-tasks.d.ts +17 -0
  55. package/dist/db/schema.d.ts +36 -52
  56. package/dist/{db-PSMQZR4P.js → db-RBXBVEVO.js} +7 -7
  57. package/dist/instrumentation.js +4 -4
  58. package/dist/nitro.js +2 -2
  59. package/dist/{oauth-callback-server-XZUK2AT6.js → oauth-callback-server-LRB6BX6C.js} +23 -21
  60. package/dist/{runner-5EKJCQWP.js → runner-WK5VUOW6.js} +24 -25
  61. package/dist/{skills-2PRM42SE.js → skills-MJWRME3A.js} +6 -6
  62. package/dist/{spawn-UGTLRTFP.js → spawn-ZCW6UOAA.js} +17 -17
  63. package/dist/{validation-XLXAIRTR.js → validation-556WSWVU.js} +6 -6
  64. package/dist/version.js +1 -1
  65. package/dist/{work-CNTNEQ2Q.js → work-W6IXSPY3.js} +16 -16
  66. package/dist/{worker-BGW7CKZ7.js → worker-5KM346HH.js} +10 -10
  67. package/migrations/0023_task_title_columns.sql +2 -0
  68. package/migrations/meta/0023_snapshot.json +2198 -0
  69. package/migrations/meta/_journal.json +7 -0
  70. package/package.json +5 -5
package/dist/app.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  processConversationWork
3
- } from "./chunk-DBKS7JR2.js";
3
+ } from "./chunk-X5SC2UGE.js";
4
4
  import {
5
5
  bindSpawnAgent
6
- } from "./chunk-FWXSPJRN.js";
6
+ } from "./chunk-LSBQHDI2.js";
7
7
  import {
8
8
  createAgentInvocationWorker,
9
9
  enqueueAgentInvocation,
10
10
  listPendingAgentInvocationMailboxAppends,
11
11
  routeAgentInvocationWork
12
- } from "./chunk-A2O7SGK5.js";
12
+ } from "./chunk-I4NQNZVW.js";
13
13
  import {
14
14
  GET as GET2,
15
15
  GET2 as GET3,
@@ -39,7 +39,7 @@ import {
39
39
  splitSlackReplyText,
40
40
  startSlackProcessingReaction,
41
41
  stripLeadingBotMention
42
- } from "./chunk-LIVSCWI5.js";
42
+ } from "./chunk-QFWXGUAH.js";
43
43
  import "./chunk-FA6POGLH.js";
44
44
  import {
45
45
  CONVERSATION_WORK_STALE_ENQUEUE_MS,
@@ -51,37 +51,47 @@ import {
51
51
  isInvalidConversationRecordError,
52
52
  listActiveConversationIds,
53
53
  removeActiveConversation
54
- } from "./chunk-NFL4FRIU.js";
54
+ } from "./chunk-WM4PRM7W.js";
55
55
  import {
56
+ buildConversationContext,
56
57
  buildDeliveredTurnStatePatch,
57
58
  claimDispatchMailboxAppend,
58
59
  completeAuthPauseTurn,
59
60
  confirmDispatchMailboxAppend,
61
+ createConversationMemoryService,
60
62
  createOrGetDispatch,
63
+ estimateConversationContextTokens,
61
64
  finalizeFailedTurnReplyWithEvent,
62
65
  getAgentTurnDiagnosticsAttributes,
66
+ getConversationMessageSlackTs,
63
67
  getDispatchConversationId,
64
68
  getDispatchInputMessageId,
65
69
  getDispatchInputMessageIds,
66
70
  getDispatchRecord,
67
71
  getDispatchTurnId,
68
72
  getPluginDispatchProjection,
73
+ getThreadTitleSourceMessage,
69
74
  getTurnUserMessage,
70
75
  getTurnUserReplyAttachmentContext,
71
76
  getTurnUserSlackMessageTs,
77
+ isHumanConversationMessage,
72
78
  isTerminalDispatchStatus,
73
79
  listPendingDispatchMailboxAppends,
80
+ markConversationMessage,
74
81
  markDispatchAwaitingResume,
75
82
  markDispatchBlocked,
76
83
  markDispatchCompleted,
77
84
  markDispatchFailed,
78
85
  markDispatchRunning,
86
+ normalizeConversationText,
79
87
  persistAuthPauseTurnState,
80
88
  processPluginTask,
89
+ recordDeliveredAssistantMessage,
81
90
  requireTurnFailureEventId,
82
91
  resolveTurnSessionRouting,
83
- scheduleSessionCompletedPluginTasks
84
- } from "./chunk-DKH4WGZU.js";
92
+ scheduleSessionCompletedPluginTasks,
93
+ upsertConversationMessage
94
+ } from "./chunk-I5PIM72M.js";
85
95
  import {
86
96
  ConversationTurnLifecycleService
87
97
  } from "./chunk-Q6QZTTLS.js";
@@ -90,11 +100,11 @@ import {
90
100
  conversationVisibilityFromSlackChannelType,
91
101
  resolveSlackChannelTypeFromMessage,
92
102
  resolveSlackConversationContext
93
- } from "./chunk-HN4UZTG7.js";
103
+ } from "./chunk-2T5CHXRZ.js";
94
104
  import "./chunk-4CODA7P5.js";
95
105
  import {
96
106
  recordTaskExecution
97
- } from "./chunk-2DOVDDZJ.js";
107
+ } from "./chunk-A3XPSABC.js";
98
108
  import "./chunk-UTL3MHPC.js";
99
109
  import {
100
110
  getVercelConversationWorkQueue,
@@ -113,7 +123,7 @@ import {
113
123
  import {
114
124
  validatePluginEgressCredentialHooks,
115
125
  validatePluginRegistrations
116
- } from "./chunk-44NWPKY3.js";
126
+ } from "./chunk-TPJK6AVJ.js";
117
127
  import {
118
128
  defineJuniorPlugins,
119
129
  pluginCatalogConfigFromEnv,
@@ -146,18 +156,18 @@ import {
146
156
  setConfigDefaults,
147
157
  shouldEmitDevAgentTrace,
148
158
  shouldPropagateSandboxEgressTrace
149
- } from "./chunk-OHO46E7F.js";
159
+ } from "./chunk-XYJNNZYR.js";
150
160
  import {
151
161
  AuthorizationFlowDisabledError,
152
162
  PluginCredentialFailureError
153
- } from "./chunk-H4WNQFBH.js";
163
+ } from "./chunk-F6RWNJBK.js";
154
164
  import "./chunk-DIB4GX3G.js";
155
165
  import {
156
166
  createUserTokenStore,
157
167
  deleteMcpAuthSessionsForUserProvider,
158
168
  deleteMcpServerSessionId,
159
169
  deleteMcpStoredOAuthCredentials
160
- } from "./chunk-UONUDOJP.js";
170
+ } from "./chunk-RABHACKG.js";
161
171
  import {
162
172
  RetryableDeliveryError
163
173
  } from "./chunk-R776HKPK.js";
@@ -165,14 +175,16 @@ import {
165
175
  formatProviderLabel,
166
176
  postSlackMessage,
167
177
  startOAuthFlow
168
- } from "./chunk-DK3GQWJK.js";
178
+ } from "./chunk-ANG7IWAI.js";
179
+ import {
180
+ estimateTextTokens
181
+ } from "./chunk-WJHWOAVZ.js";
169
182
  import {
170
183
  ConversationTurnBoundaryError,
171
184
  CooperativeTurnYieldError,
172
185
  TurnInputCommitLostError,
173
186
  TurnInputDeferredError,
174
187
  abandonAgentTurnSessionRecord,
175
- buildConversationContext,
176
188
  buildDeterministicAssistantMessageId,
177
189
  buildDeterministicTurnId,
178
190
  clearPendingAuth,
@@ -181,32 +193,25 @@ import {
181
193
  commitAcceptedReply,
182
194
  commitMessages,
183
195
  completeDeliveredTurn,
184
- createConversationMemoryService,
185
- estimateTextTokens,
186
196
  failAgentTurnSessionRecord,
187
197
  getAgentTurnSessionRecord,
188
198
  getAgentTurnSessionRecordForResume,
189
199
  getAssistantReplyText,
190
200
  getChannelConfigurationService,
191
201
  getChannelConfigurationServiceById,
192
- getConversationMessageSlackTs,
193
202
  getConversationTurnBoundaryError,
194
203
  getPersistedSandboxState,
195
204
  getPersistedThreadState,
196
- getThreadTitleSourceMessage,
197
205
  hydrateConversationMessages,
198
206
  isCooperativeTurnYieldError,
199
- isHumanConversationMessage,
200
207
  isTurnInputCommitLostError,
201
208
  isTurnInputDeferredError,
202
209
  listAgentTurnSessionSummariesForConversation,
203
210
  loadConversationProjection,
204
211
  loadProjection,
205
- markConversationMessage,
206
212
  markTurnClosed,
207
213
  markTurnFailed,
208
214
  mergeArtifactsState,
209
- normalizeConversationText,
210
215
  persistConversationMessageSummaries,
211
216
  persistConversationMessages,
212
217
  persistThreadRuntimeState,
@@ -215,13 +220,10 @@ import {
215
220
  persistWithRetry,
216
221
  persistYieldSessionRecord,
217
222
  recordAgentTurnSessionSummary,
218
- recordDeliveredAssistantMessage,
219
223
  startActiveTurn,
220
224
  stripRuntimeTurnContext,
221
- trimTrailingAssistantMessages,
222
- updateConversationStats,
223
- upsertConversationMessage
224
- } from "./chunk-PIQKV7IR.js";
225
+ trimTrailingAssistantMessages
226
+ } from "./chunk-PBV7VXUA.js";
225
227
  import "./chunk-3Y47VMHV.js";
226
228
  import "./chunk-HUO3UTAQ.js";
227
229
  import {
@@ -231,16 +233,17 @@ import {
231
233
  import {
232
234
  getSandboxResourceConfig,
233
235
  setSandboxResourceConfig
234
- } from "./chunk-FZFJZZR3.js";
236
+ } from "./chunk-AEFJN7OK.js";
235
237
  import {
236
238
  createSchedulerSqlStore,
237
239
  findMatchingEventTasks,
238
240
  logScheduledTaskRunSkipped,
239
241
  scheduledTaskRunAttributes
240
- } from "./chunk-5LPWHC7Q.js";
242
+ } from "./chunk-UFCA4EZB.js";
241
243
  import {
242
244
  parseSlackThreadId
243
- } from "./chunk-HQAFIN6O.js";
245
+ } from "./chunk-OG5JQHKR.js";
246
+ import "./chunk-STX5WIH6.js";
244
247
  import "./chunk-HLXXQI5Q.js";
245
248
  import "./chunk-PDO5BLNM.js";
246
249
  import "./chunk-UIE3R5XU.js";
@@ -260,7 +263,7 @@ import {
260
263
  verifyEventTaskCredentialSubject,
261
264
  verifyScheduledTaskCredentialSubject,
262
265
  verifySlackDirectCredentialSubject
263
- } from "./chunk-7ULXCNOZ.js";
266
+ } from "./chunk-SNBTWIQO.js";
264
267
  import {
265
268
  SlackActionError,
266
269
  downloadPrivateSlackFile,
@@ -270,7 +273,7 @@ import {
270
273
  normalizeSlackConversationId,
271
274
  runWithSlackInstallationToken,
272
275
  runWithWorkspaceTeamId
273
- } from "./chunk-DVIJ6DP6.js";
276
+ } from "./chunk-I25V3XRN.js";
274
277
  import {
275
278
  contextProvenance,
276
279
  createSlackDestination,
@@ -282,20 +285,20 @@ import {
282
285
  requireSlackDestination,
283
286
  withConversationEventLock,
284
287
  withConversationMutationLock
285
- } from "./chunk-5MFCEKR6.js";
288
+ } from "./chunk-NAINBOZQ.js";
286
289
  import {
287
290
  juniorAgentBindings,
288
291
  juniorAgentInvocations,
289
292
  juniorConversationEvents,
290
293
  juniorConversations
291
- } from "./chunk-3H42HMA2.js";
294
+ } from "./chunk-2KLMGRRQ.js";
292
295
  import {
293
296
  sleep
294
297
  } from "./chunk-EM225ITJ.js";
295
298
  import {
296
299
  acquireActiveLock,
297
300
  getStateAdapter
298
- } from "./chunk-6U44QGXL.js";
301
+ } from "./chunk-M2T7MHQJ.js";
299
302
  import {
300
303
  STANDARD_MODEL_PROFILE,
301
304
  botConfig,
@@ -313,16 +316,16 @@ import {
313
316
  modelIdForProfile,
314
317
  setSlackReactionConfig,
315
318
  standardModelId
316
- } from "./chunk-BBLO66XT.js";
319
+ } from "./chunk-7GVX5SOG.js";
317
320
  import {
318
321
  juniorDestinations
319
322
  } from "./chunk-VFUK3X5B.js";
320
- import "./chunk-PGJUJCOQ.js";
321
- import "./chunk-6FRAWWGR.js";
323
+ import "./chunk-5YJBS4I5.js";
324
+ import "./chunk-U5ATCOHE.js";
322
325
  import {
323
326
  pluginCatalogRuntime
324
- } from "./chunk-EYD523BV.js";
325
- import "./chunk-LMGKSDO4.js";
327
+ } from "./chunk-NVFVM67W.js";
328
+ import "./chunk-BJ6ISBOA.js";
326
329
  import {
327
330
  credentialContextForActor
328
331
  } from "./chunk-RUIXF3YQ.js";
@@ -354,7 +357,7 @@ import {
354
357
  withContext,
355
358
  withLogContext,
356
359
  withSpan
357
- } from "./chunk-UFEU4UX6.js";
360
+ } from "./chunk-GZRWULXF.js";
358
361
  import {
359
362
  continueTrace
360
363
  } from "./chunk-6GWA276C.js";
@@ -362,10 +365,10 @@ import "./chunk-OOUNJNMR.js";
362
365
  import "./chunk-H4HBKISO.js";
363
366
  import {
364
367
  JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE
365
- } from "./chunk-OFQBDHVG.js";
368
+ } from "./chunk-WSWVWP2V.js";
366
369
  import {
367
370
  JUNIOR_VERSION
368
- } from "./chunk-43OPSFUY.js";
371
+ } from "./chunk-OB7ZJK7Y.js";
369
372
  import "./chunk-MLKGABMK.js";
370
373
 
371
374
  // src/app.ts
@@ -5802,7 +5805,6 @@ async function hydrateConversationVisionContextWithDeps(conversation, context, d
5802
5805
  let cacheHits = 0;
5803
5806
  let cacheMisses = 0;
5804
5807
  let analyzed = 0;
5805
- let mutated = false;
5806
5808
  const hydratedMessageIds = /* @__PURE__ */ new Set();
5807
5809
  for (const reply of replies) {
5808
5810
  const ts = toOptionalString(reply.ts);
@@ -5827,7 +5829,6 @@ async function hydrateConversationVisionContextWithDeps(conversation, context, d
5827
5829
  slackTs: existingMeta.slackTs ?? ts,
5828
5830
  imagesHydrated: true
5829
5831
  };
5830
- mutated = true;
5831
5832
  continue;
5832
5833
  }
5833
5834
  const imageFileIds = imageFiles.map((file) => toOptionalString(file.id)).filter((fileId) => Boolean(fileId));
@@ -5837,7 +5838,6 @@ async function hydrateConversationVisionContextWithDeps(conversation, context, d
5837
5838
  imageFileIds,
5838
5839
  imagesHydrated: true
5839
5840
  };
5840
- mutated = true;
5841
5841
  for (const file of imageFiles) {
5842
5842
  const fileId = toOptionalString(file.id);
5843
5843
  if (!fileId) continue;
@@ -5896,12 +5896,8 @@ async function hydrateConversationVisionContextWithDeps(conversation, context, d
5896
5896
  analyzedAtMs: Date.now()
5897
5897
  };
5898
5898
  analyzed += 1;
5899
- mutated = true;
5900
5899
  }
5901
5900
  }
5902
- if (mutated) {
5903
- updateConversationStats(conversation);
5904
- }
5905
5901
  if (cacheHits > 0 || cacheMisses > 0 || analyzed > 0 || hydratedMessageIds.size > 0) {
5906
5902
  logInfo("conversation.image.context.hydrated", {
5907
5903
  "app.conversation_image.cache_hits": cacheHits,
@@ -6516,8 +6512,7 @@ function createReplyToThread(deps) {
6516
6512
  markTurnClosed({
6517
6513
  conversation: preparedState.conversation,
6518
6514
  nowMs: Date.now(),
6519
- sessionId: activeTurnId,
6520
- updateConversationStats
6515
+ sessionId: activeTurnId
6521
6516
  });
6522
6517
  activeTurnId = void 0;
6523
6518
  } else {
@@ -6531,8 +6526,7 @@ function createReplyToThread(deps) {
6531
6526
  conversation: preparedState.conversation,
6532
6527
  nowMs: Date.now(),
6533
6528
  sessionId: activeTurnId,
6534
- markConversationMessage,
6535
- updateConversationStats
6529
+ markConversationMessage
6536
6530
  });
6537
6531
  activeTurnId = void 0;
6538
6532
  }
@@ -6576,8 +6570,7 @@ function createReplyToThread(deps) {
6576
6570
  }
6577
6571
  startActiveTurn({
6578
6572
  conversation: preparedState.conversation,
6579
- nextTurnId: turnId,
6580
- updateConversationStats
6573
+ nextTurnId: turnId
6581
6574
  });
6582
6575
  if (conversationId && preparedState.userMessageId) {
6583
6576
  await deps.services.turnLifecycle.start({
@@ -7028,8 +7021,7 @@ function createReplyToThread(deps) {
7028
7021
  markTurnClosed({
7029
7022
  conversation: preparedState.conversation,
7030
7023
  nowMs: Date.now(),
7031
- sessionId: turnId,
7032
- updateConversationStats
7024
+ sessionId: turnId
7033
7025
  });
7034
7026
  await persistThreadState(thread, {
7035
7027
  conversation: preparedState.conversation
@@ -7313,8 +7305,7 @@ function createReplyToThread(deps) {
7313
7305
  markTurnClosed({
7314
7306
  conversation: preparedState.conversation,
7315
7307
  nowMs: Date.now(),
7316
- sessionId: turnId,
7317
- updateConversationStats
7308
+ sessionId: turnId
7318
7309
  });
7319
7310
  await persistThreadState(thread, {
7320
7311
  artifacts: latestArtifacts,
@@ -7348,8 +7339,7 @@ function createReplyToThread(deps) {
7348
7339
  userMessageId: preparedState.userMessageId,
7349
7340
  markConversationMessage: (conversation, messageId, patch) => {
7350
7341
  markConversationMessage(conversation, messageId, patch);
7351
- },
7352
- updateConversationStats
7342
+ }
7353
7343
  });
7354
7344
  if (conversationId) {
7355
7345
  try {
@@ -7492,16 +7482,8 @@ function getBackfillText(entry) {
7492
7482
  return text || void 0;
7493
7483
  }
7494
7484
  async function seedConversationBackfill(thread, conversation, currentTurn) {
7495
- if (conversation.backfill.completedAtMs) {
7496
- return;
7497
- }
7498
7485
  if (conversation.messages.length > 0 || conversation.compactions.length > 0) {
7499
- conversation.backfill = {
7500
- completedAtMs: Date.now(),
7501
- source: "recent_messages"
7502
- };
7503
- updateConversationStats(conversation);
7504
- return;
7486
+ return "recent_messages";
7505
7487
  }
7506
7488
  const seeded = [];
7507
7489
  let source = "recent_messages";
@@ -7548,11 +7530,7 @@ async function seedConversationBackfill(thread, conversation, currentTurn) {
7548
7530
  }
7549
7531
  upsertConversationMessage(conversation, message);
7550
7532
  }
7551
- conversation.backfill = {
7552
- completedAtMs: Date.now(),
7553
- source
7554
- };
7555
- updateConversationStats(conversation);
7533
+ return source;
7556
7534
  }
7557
7535
  function createPrepareTurnState(deps) {
7558
7536
  return async function prepareTurnState(args) {
@@ -7564,12 +7542,10 @@ function createPrepareTurnState(deps) {
7564
7542
  await hydrateConversationMessages({ conversation, conversationId });
7565
7543
  const channelConfiguration = args.channelConfiguration ?? getChannelConfigurationService(args.thread);
7566
7544
  const configuration = await channelConfiguration.resolveValues();
7567
- if (!args.skipBackfill) {
7568
- await seedConversationBackfill(args.thread, conversation, {
7569
- messageId: args.message.id,
7570
- messageCreatedAtMs: args.message.metadata.dateSent.getTime()
7571
- });
7572
- }
7545
+ const backfillSource = args.skipBackfill ? void 0 : await seedConversationBackfill(args.thread, conversation, {
7546
+ messageId: args.message.id,
7547
+ messageCreatedAtMs: args.message.metadata.dateSent.getTime()
7548
+ });
7573
7549
  for (const queued of args.queuedMessages ?? []) {
7574
7550
  const queuedMessage = toConversationMessage({
7575
7551
  entry: queued.message,
@@ -7620,8 +7596,8 @@ function createPrepareTurnState(deps) {
7620
7596
  excludeMessageId: userMessageId
7621
7597
  });
7622
7598
  setSpanAttributes({
7623
- "app.backfill_source": conversation.backfill.source ?? "none",
7624
- "app.context_tokens_estimated": conversation.stats.estimatedContextTokens
7599
+ "app.backfill_source": backfillSource ?? "none",
7600
+ "app.context_tokens_estimated": estimateConversationContextTokens(conversation)
7625
7601
  });
7626
7602
  return {
7627
7603
  artifacts,
@@ -7797,7 +7773,6 @@ function createSlackRuntime(options) {
7797
7773
  message,
7798
7774
  text
7799
7775
  });
7800
- updateConversationStats(conversation);
7801
7776
  await persistThreadState(thread, {
7802
7777
  conversation
7803
7778
  });
@@ -7817,7 +7792,6 @@ function createSlackRuntime(options) {
7817
7792
  });
7818
7793
  clearSkippedTurnIfActive(conversation, message.id);
7819
7794
  conversation.processing.lastCompletedAtMs = completedAtMs;
7820
- updateConversationStats(conversation);
7821
7795
  await persistThreadState(thread, {
7822
7796
  conversation
7823
7797
  });
@@ -7839,7 +7813,6 @@ function createSlackRuntime(options) {
7839
7813
  );
7840
7814
  clearSkippedTurnIfActive(preparedState.conversation, message.id);
7841
7815
  preparedState.conversation.processing.lastCompletedAtMs = completedAtMs;
7842
- updateConversationStats(preparedState.conversation);
7843
7816
  await persistThreadState(thread, {
7844
7817
  conversation: preparedState.conversation
7845
7818
  });
@@ -7959,8 +7932,7 @@ async function persistFailedReplyState(sessionRecord, errorMessage = "Paused age
7959
7932
  nowMs: Date.now(),
7960
7933
  sessionId: sessionRecord.sessionId,
7961
7934
  userMessageId: getTurnUserMessage(conversation, sessionRecord.sessionId)?.id,
7962
- markConversationMessage,
7963
- updateConversationStats
7935
+ markConversationMessage
7964
7936
  });
7965
7937
  await failSessionRecordBestEffort({
7966
7938
  sessionRecord,
@@ -8300,8 +8272,7 @@ async function failStrandedSessionWithFallback(args) {
8300
8272
  conversation,
8301
8273
  args.sessionRecord.sessionId
8302
8274
  )?.id,
8303
- markConversationMessage,
8304
- updateConversationStats
8275
+ markConversationMessage
8305
8276
  });
8306
8277
  await persistThreadStateById(args.conversationId, { conversation });
8307
8278
  const eventName = "agent.turn.stranded_session.failed";
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-EYD523BV.js";
4
- import "./chunk-LMGKSDO4.js";
3
+ } from "./chunk-NVFVM67W.js";
4
+ import "./chunk-BJ6ISBOA.js";
5
5
  import "./chunk-RUIXF3YQ.js";
6
6
  import "./chunk-HZF5P5UN.js";
7
7
  import "./chunk-F3B2YJ76.js";
8
- import "./chunk-UFEU4UX6.js";
8
+ import "./chunk-GZRWULXF.js";
9
9
  import "./chunk-6GWA276C.js";
10
10
  import "./chunk-OOUNJNMR.js";
11
11
  import "./chunk-H4HBKISO.js";
12
- import "./chunk-OFQBDHVG.js";
13
- import "./chunk-43OPSFUY.js";
12
+ import "./chunk-WSWVWP2V.js";
13
+ import "./chunk-OB7ZJK7Y.js";
14
14
  import "./chunk-MLKGABMK.js";
15
15
  export {
16
16
  pluginCatalogRuntime
@@ -41,4 +41,10 @@ export declare const eventTaskSchema: z.ZodObject<{
41
41
  }, z.core.$strict>;
42
42
  }, z.core.$strict>;
43
43
  /** Durable instruction dispatched for matching resource events. */
44
- export type EventTask = z.output<typeof eventTaskSchema>;
44
+ export type EventTask = z.output<typeof eventTaskSchema> & {
45
+ /**
46
+ * Short display title generated from the task instruction.
47
+ * SQL-backed column; never stored inside the JSON task payload.
48
+ */
49
+ title?: string;
50
+ };
@@ -41,7 +41,6 @@ export declare function isTurnInputDeferredError(error: unknown): error is TurnI
41
41
  export declare function startActiveTurn(args: {
42
42
  conversation: ThreadConversationState;
43
43
  nextTurnId: string;
44
- updateConversationStats: (conversation: ThreadConversationState) => void;
45
44
  }): void;
46
45
  /**
47
46
  * Close the active turn without marking a Pi session reusable for future
@@ -52,7 +51,6 @@ export declare function markTurnClosed(args: {
52
51
  conversation: ThreadConversationState;
53
52
  nowMs: number;
54
53
  sessionId?: string;
55
- updateConversationStats: (conversation: ThreadConversationState) => void;
56
54
  }): void;
57
55
  /**
58
56
  * Mark a turn as completed after its assistant output has been handled.
@@ -61,7 +59,6 @@ export declare function markTurnCompleted(args: {
61
59
  conversation: ThreadConversationState;
62
60
  nowMs: number;
63
61
  sessionId: string;
64
- updateConversationStats: (conversation: ThreadConversationState) => void;
65
62
  }): void;
66
63
  /**
67
64
  * Mark a turn as failed when execution or final user-visible reply delivery
@@ -77,5 +74,4 @@ export declare function markTurnFailed(args: {
77
74
  replied?: boolean;
78
75
  skippedReason?: string;
79
76
  }) => void;
80
- updateConversationStats: (conversation: ThreadConversationState) => void;
81
77
  }): void;
@@ -28,6 +28,7 @@ export declare function createSlackScheduleCreateTaskTool(context: SchedulerTool
28
28
  };
29
29
  timezone?: string | null | undefined;
30
30
  };
31
+ title?: string | null | undefined;
31
32
  credential_mode?: "system" | "creator" | null | undefined;
32
33
  };
33
34
  execute?: ((input: unknown, options: import("../../tools/definition").ToolExecuteOptions) => {
@@ -64,6 +64,11 @@ export interface ScheduledTask {
64
64
  status: ScheduledTaskStatus;
65
65
  statusReason?: string;
66
66
  task: ScheduledTaskSpec;
67
+ /**
68
+ * Short display title generated from the task instruction.
69
+ * SQL-backed column; never stored inside the JSON record payload.
70
+ */
71
+ title?: string;
67
72
  updatedAtMs: number;
68
73
  }
69
74
  export interface ScheduledRun {
@@ -16,7 +16,8 @@ export interface ConversationMemoryService {
16
16
  export declare function generateConversationId(prefix: "assistant" | "backfill" | "compaction" | "turn"): string;
17
17
  /** Normalize message boundaries without changing transcript formatting. */
18
18
  export declare function normalizeConversationText(text: string): string;
19
- export declare function updateConversationStats(conversation: ThreadConversationState): void;
19
+ /** Estimate the token cost of the current visible conversation context. */
20
+ export declare function estimateConversationContextTokens(conversation: ThreadConversationState): number;
20
21
  export declare function upsertConversationMessage(conversation: ThreadConversationState, message: ConversationMessage): string;
21
22
  /** Record one assistant message after its destination accepts it. */
22
23
  export declare function recordDeliveredAssistantMessage(args: {
@@ -0,0 +1,25 @@
1
+ import type { completeText } from "@/chat/pi/client";
2
+ export declare const SHORT_TITLE_MAX_LENGTH = 60;
3
+ export type ShortTitleKind = "conversation" | "task";
4
+ /** Collapse whitespace and cap a candidate short title. */
5
+ export declare function normalizeShortTitle(value: string): string;
6
+ /**
7
+ * Deterministic display title when no generated title is stored.
8
+ * Uses the first non-empty line of the source text, capped like generated titles.
9
+ */
10
+ export declare function fallbackShortTitle(sourceText: string, fallback?: string): string;
11
+ /** Generate a short title with the fast model, or return undefined on failure. */
12
+ export declare function generateShortTitle(args: {
13
+ completeText: typeof completeText;
14
+ kind: ShortTitleKind;
15
+ sourceText: string;
16
+ }): Promise<string | undefined>;
17
+ /**
18
+ * Prefer an explicit task title when provided; otherwise generate one from the
19
+ * instruction with the fast model.
20
+ */
21
+ export declare function resolveTaskTitle(args: {
22
+ completeText: typeof completeText;
23
+ instruction: string;
24
+ title?: string | null;
25
+ }): Promise<string | undefined>;
@@ -30,10 +30,6 @@ export interface ConversationCompaction {
30
30
  id: string;
31
31
  summary: string;
32
32
  }
33
- export interface ConversationBackfillState {
34
- completedAtMs?: number;
35
- source?: "recent_messages" | "thread_fetch";
36
- }
37
33
  export interface ConversationProcessingState {
38
34
  activeTurnId?: string;
39
35
  lastCompletedAtMs?: number;
@@ -52,12 +48,6 @@ export type ConversationPendingAuthState = (ConversationPendingAuthBase & {
52
48
  }) | (ConversationPendingAuthBase & {
53
49
  kind: "plugin";
54
50
  });
55
- export interface ConversationStats {
56
- compactedMessageCount: number;
57
- estimatedContextTokens: number;
58
- totalMessageCount: number;
59
- updatedAtMs: number;
60
- }
61
51
  export interface ConversationVisionSummary {
62
52
  analyzedAtMs: number;
63
53
  summary: string;
@@ -67,23 +57,22 @@ export interface ConversationVisionState {
67
57
  byFileId: Record<string, ConversationVisionSummary>;
68
58
  }
69
59
  export interface ThreadConversationState {
70
- backfill: ConversationBackfillState;
71
60
  compactions: ConversationCompaction[];
72
61
  messages: ConversationMessage[];
73
62
  processing: ConversationProcessingState;
74
63
  schemaVersion: 1;
75
- stats: ConversationStats;
76
64
  vision: ConversationVisionState;
77
65
  }
78
66
  /** Safely coerce an unknown persisted value into a ThreadConversationState. */
79
67
  export declare function coerceThreadConversationState(value: unknown): ThreadConversationState;
80
68
  /**
81
- * Wrap a conversation state into the storage envelope for persistence. The
82
- * visible transcript (`messages`) is not written to `thread-state`; visible and
83
- * model history live in the SQL `ConversationEventStore`. Only runtime scratch
84
- * is persisted here.
69
+ * Wrap conversation runtime scratch into the storage envelope.
70
+ *
71
+ * Visible transcript and model history live in SQL. Redis only keeps
72
+ * short-lived processing control and the vision cache, which has no other
73
+ * authority yet.
85
74
  */
86
75
  export declare function buildConversationStatePatch(conversation: ThreadConversationState): {
87
- conversation: Omit<ThreadConversationState, "compactions" | "messages">;
76
+ conversation: Pick<ThreadConversationState, "schemaVersion" | "processing" | "vision">;
88
77
  };
89
78
  export {};
@@ -13,6 +13,7 @@ export declare function createEventTaskTool(context: ToolRuntimeContext, catalog
13
13
  label: string;
14
14
  events: string[];
15
15
  };
16
+ title?: string | null | undefined;
16
17
  credentialMode?: "system" | "creator" | null | undefined;
17
18
  };
18
19
  execute?: ((input: unknown, options: import("./definition").ToolExecuteOptions) => {