@sentry/junior 0.193.0 → 0.194.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 (82) hide show
  1. package/dist/{agent-hooks-DWY3MZZ7.js → agent-hooks-IDX764FD.js} +11 -11
  2. package/dist/api/conversations/aggregate.d.ts +2 -0
  3. package/dist/api/conversations/list.d.ts +1 -1
  4. package/dist/api/conversations/projection.d.ts +1 -1
  5. package/dist/api/locations/detail.d.ts +1 -1
  6. package/dist/api/schema/conversation.d.ts +3 -3
  7. package/dist/api/schema/location.d.ts +1 -1
  8. package/dist/api/schema/person.d.ts +1 -1
  9. package/dist/api/schema/task.d.ts +71 -8
  10. package/dist/api/schema.d.ts +2 -2
  11. package/dist/api/schema.js +3 -1
  12. package/dist/api.js +106 -187
  13. package/dist/app.js +44 -39
  14. package/dist/{catalog-runtime-NAD44W5K.js → catalog-runtime-MICXEBLK.js} +4 -4
  15. package/dist/chat/agent/resume.d.ts +2 -0
  16. package/dist/chat/config.d.ts +1 -0
  17. package/dist/chat/conversations/history.d.ts +4 -2
  18. package/dist/chat/services/turn-limit.d.ts +11 -1
  19. package/dist/chat/slack/{source-link.d.ts → location-url.d.ts} +1 -1
  20. package/dist/chat/task-execution/checkpoint.d.ts +2 -0
  21. package/dist/chat/task-execution/turn-cursor.d.ts +3 -0
  22. package/dist/chat/tasks/execution-stats.d.ts +13 -1
  23. package/dist/chat/usage.d.ts +4 -0
  24. package/dist/{chunk-GTXQHZ2O.js → chunk-2NL3Y47F.js} +5 -5
  25. package/dist/{chunk-DVU734PI.js → chunk-53IEEFFP.js} +3 -3
  26. package/dist/{chunk-WH5VV2RW.js → chunk-6H2MKVV5.js} +1 -1
  27. package/dist/{chunk-42N6CDWF.js → chunk-73JEAQRT.js} +4 -4
  28. package/dist/{chunk-KWXZMHJS.js → chunk-7ANA7PBB.js} +3 -3
  29. package/dist/{chunk-2CYWEVOP.js → chunk-ADEACKAH.js} +81 -68
  30. package/dist/{chunk-D4XQZOHB.js → chunk-AWZS5SVX.js} +8 -8
  31. package/dist/{chunk-FQ5HFSFR.js → chunk-CCTYK5RH.js} +6 -6
  32. package/dist/{chunk-N6Q2PNSI.js → chunk-CFGBKPWQ.js} +3 -3
  33. package/dist/{chunk-5LEVZYXF.js → chunk-E53C73ML.js} +4 -4
  34. package/dist/{chunk-IBXXTO3J.js → chunk-ELCYG6UU.js} +3 -3
  35. package/dist/{chunk-COCVPDWX.js → chunk-ENWIHU54.js} +6 -6
  36. package/dist/{chunk-AZVDODSP.js → chunk-F2KSURTJ.js} +9 -9
  37. package/dist/{chunk-K47OVEO4.js → chunk-G35QGPO2.js} +1 -1
  38. package/dist/{chunk-PYBFVK6K.js → chunk-G4RARFNT.js} +50 -24
  39. package/dist/{chunk-S5HS6WRH.js → chunk-GY5SEFVL.js} +5 -5
  40. package/dist/{chunk-LG7Q4OW4.js → chunk-H4DCWLTR.js} +8 -8
  41. package/dist/{chunk-QDU5MW2R.js → chunk-IME5OW4Y.js} +1 -1
  42. package/dist/{chunk-5E5SLAVD.js → chunk-INTBMGNX.js} +23 -25
  43. package/dist/{chunk-HMBTX5RK.js → chunk-IOGDKPVU.js} +1 -1
  44. package/dist/{chunk-OICYQPKP.js → chunk-JOI3DHML.js} +1 -1
  45. package/dist/{chunk-GUKGU6R7.js → chunk-KNIAWMBU.js} +1 -1
  46. package/dist/{chunk-4UA5C7AM.js → chunk-NPO24LAN.js} +8 -8
  47. package/dist/{chunk-IQCL5JGL.js → chunk-NWWDFHXP.js} +1 -1
  48. package/dist/{chunk-ZFPEPWOO.js → chunk-OEQOAONV.js} +60 -29
  49. package/dist/{chunk-3YZ2Q6AW.js → chunk-P2P6MUQ4.js} +2 -2
  50. package/dist/{chunk-LXRTHE43.js → chunk-QMEF4Z7R.js} +5 -5
  51. package/dist/{chunk-D5YQPCEG.js → chunk-RFE7DCZK.js} +24 -2
  52. package/dist/{chunk-QWY4KI2V.js → chunk-S7GX44BU.js} +1 -1
  53. package/dist/{chunk-WJJDQLVL.js → chunk-U76RWMFR.js} +4 -2
  54. package/dist/{chunk-IOUUS6H4.js → chunk-V4HXV5MY.js} +1 -1
  55. package/dist/{chunk-GUMBIDDL.js → chunk-VOB2DKO6.js} +174 -34
  56. package/dist/{chunk-BFP3ZKG6.js → chunk-WMJS5DDV.js} +4 -4
  57. package/dist/{chunk-DXFUYLHX.js → chunk-WWXJUURQ.js} +1 -1
  58. package/dist/{chunk-QY2IU47O.js → chunk-X76JVHQ4.js} +1 -1
  59. package/dist/{chunk-5S6AQFNG.js → chunk-XLWZRHX5.js} +1 -1
  60. package/dist/{chunk-THYNA2QN.js → chunk-XND3J6AT.js} +1 -1
  61. package/dist/{chunk-THFNL3TL.js → chunk-XRDSML3K.js} +2 -2
  62. package/dist/{chunk-EYIMZY5O.js → chunk-YSLIB7ER.js} +18 -3
  63. package/dist/cli/chat.js +33 -33
  64. package/dist/cli/check.js +5 -5
  65. package/dist/cli/plugins.js +12 -12
  66. package/dist/cli/snapshot-create.js +9 -9
  67. package/dist/cli/upgrade.js +6 -6
  68. package/dist/{db-H5MDRQEY.js → db-3IEVINAY.js} +6 -6
  69. package/dist/instrumentation.js +3 -3
  70. package/dist/nitro.js +6 -6
  71. package/dist/{oauth-callback-server-IOU3NUHT.js → oauth-callback-server-N7L2BB4L.js} +29 -29
  72. package/dist/{runner-FZ5ZHLFG.js → runner-PTTZV3WU.js} +21 -21
  73. package/dist/{skills-AR3WD6BX.js → skills-POMWS2RR.js} +5 -5
  74. package/dist/spawn-R75MXXKE.js +42 -0
  75. package/dist/task-runner-OQLRHADB.js +36 -0
  76. package/dist/{validation-VYE7TQY7.js → validation-U6LOMXR7.js} +5 -5
  77. package/dist/version.js +1 -1
  78. package/dist/{work-CTQFWYKE.js → work-FHA3BS4L.js} +21 -21
  79. package/dist/{worker-6WQU3IT5.js → worker-GR4UNVVP.js} +10 -10
  80. package/package.json +5 -5
  81. package/dist/spawn-ZU6JABR7.js +0 -42
  82. package/dist/task-runner-EEGGG2PM.js +0 -36
package/dist/app.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  processConversationWork
3
- } from "./chunk-42N6CDWF.js";
3
+ } from "./chunk-73JEAQRT.js";
4
4
  import {
5
5
  bindSpawnAgent
6
- } from "./chunk-THFNL3TL.js";
6
+ } from "./chunk-XRDSML3K.js";
7
7
  import {
8
8
  createAgentInvocationWorker,
9
9
  enqueueAgentInvocation,
10
10
  listPendingAgentInvocationMailboxAppends,
11
11
  resolveAgentInvocationId
12
- } from "./chunk-AZVDODSP.js";
12
+ } from "./chunk-F2KSURTJ.js";
13
13
  import {
14
14
  GET as GET2,
15
15
  GET2 as GET3,
@@ -37,12 +37,12 @@ import {
37
37
  startProcessingReaction,
38
38
  stripLeadingBotMention,
39
39
  wakePausedTurn
40
- } from "./chunk-5E5SLAVD.js";
40
+ } from "./chunk-INTBMGNX.js";
41
41
  import "./chunk-FA6POGLH.js";
42
42
  import {
43
43
  AgentRunError,
44
44
  executeTurn
45
- } from "./chunk-DVU734PI.js";
45
+ } from "./chunk-53IEEFFP.js";
46
46
  import {
47
47
  buildDeliveredTurnStatePatch,
48
48
  completeAuthPauseTurn,
@@ -53,7 +53,7 @@ import {
53
53
  getTurnUserSlackMessageTs,
54
54
  persistAuthPauseTurnState,
55
55
  requireTurnFailureEventId
56
- } from "./chunk-GTXQHZ2O.js";
56
+ } from "./chunk-2NL3Y47F.js";
57
57
  import {
58
58
  claimDispatchMailboxAppend,
59
59
  confirmDispatchMailboxAppend,
@@ -73,11 +73,11 @@ import {
73
73
  processPluginTask,
74
74
  resolveTurnSessionRouting,
75
75
  scheduleSessionCompletedPluginTasks
76
- } from "./chunk-4UA5C7AM.js";
76
+ } from "./chunk-NPO24LAN.js";
77
77
  import {
78
78
  ConversationTurnLifecycleService,
79
79
  getTurnLifecycle
80
- } from "./chunk-WH5VV2RW.js";
80
+ } from "./chunk-6H2MKVV5.js";
81
81
  import {
82
82
  coerceThreadConversationState,
83
83
  getLocationConfigurationService,
@@ -86,7 +86,7 @@ import {
86
86
  persistThreadRuntimeState,
87
87
  persistThreadState,
88
88
  persistThreadStateById
89
- } from "./chunk-S5HS6WRH.js";
89
+ } from "./chunk-GY5SEFVL.js";
90
90
  import {
91
91
  GET,
92
92
  appendAndEnqueueWebMessage,
@@ -101,24 +101,24 @@ import {
101
101
  resolveSlackChannelTypeFromMessage,
102
102
  resolveSlackConversationContext,
103
103
  webActorFromEmail
104
- } from "./chunk-LG7Q4OW4.js";
104
+ } from "./chunk-H4DCWLTR.js";
105
105
  import {
106
106
  createWebAuthorization,
107
107
  deleteWebAuthorization
108
- } from "./chunk-THYNA2QN.js";
108
+ } from "./chunk-XND3J6AT.js";
109
109
  import {
110
110
  recordTaskExecution
111
- } from "./chunk-GUMBIDDL.js";
111
+ } from "./chunk-VOB2DKO6.js";
112
112
  import "./chunk-RC745GGZ.js";
113
113
  import {
114
114
  createVercelPluginTaskCallback,
115
115
  queueCallback,
116
116
  registerVercelPluginTaskDevConsumer
117
- } from "./chunk-N6Q2PNSI.js";
117
+ } from "./chunk-CFGBKPWQ.js";
118
118
  import {
119
119
  validatePluginEgressCredentialHooks,
120
120
  validatePluginRegistrations
121
- } from "./chunk-GUKGU6R7.js";
121
+ } from "./chunk-KNIAWMBU.js";
122
122
  import {
123
123
  defineJuniorPlugins,
124
124
  pluginCatalogConfigFromEnv,
@@ -158,11 +158,11 @@ import {
158
158
  shouldEmitDevAgentTrace,
159
159
  shouldPropagateSandboxEgressTrace,
160
160
  unpublishedArtifactHeaders
161
- } from "./chunk-PYBFVK6K.js";
161
+ } from "./chunk-G4RARFNT.js";
162
162
  import {
163
163
  AuthorizationFlowDisabledError,
164
164
  PluginCredentialFailureError
165
- } from "./chunk-LXRTHE43.js";
165
+ } from "./chunk-QMEF4Z7R.js";
166
166
  import "./chunk-6Y5B5PEX.js";
167
167
  import "./chunk-DIB4GX3G.js";
168
168
  import {
@@ -170,14 +170,14 @@ import {
170
170
  deleteMcpAuthSessionsForUserProvider,
171
171
  deleteMcpServerSessionId,
172
172
  deleteMcpStoredOAuthCredentials
173
- } from "./chunk-D4XQZOHB.js";
173
+ } from "./chunk-AWZS5SVX.js";
174
174
  import {
175
175
  RetryableDeliveryError,
176
176
  createAgentRunner,
177
177
  formatProviderLabel,
178
178
  postSlackMessage,
179
179
  startOAuthFlow
180
- } from "./chunk-COCVPDWX.js";
180
+ } from "./chunk-ENWIHU54.js";
181
181
  import {
182
182
  ConversationTurnBoundaryError,
183
183
  CooperativeTurnYieldError,
@@ -193,11 +193,12 @@ import {
193
193
  markTurnCompleted,
194
194
  markTurnFailed,
195
195
  startActiveTurn
196
- } from "./chunk-K47OVEO4.js";
196
+ } from "./chunk-G35QGPO2.js";
197
197
  import {
198
198
  abandonTurnRecord,
199
199
  appendThreadContextMessages,
200
200
  buildConversationContext,
201
+ buildTurnErrorResponse,
201
202
  commitAcceptedReply,
202
203
  commitMessages,
203
204
  completeTurnRecord,
@@ -229,7 +230,7 @@ import {
229
230
  trimTrailingAssistantMessages,
230
231
  turnHasReply,
231
232
  upsertConversationMessage
232
- } from "./chunk-ZFPEPWOO.js";
233
+ } from "./chunk-OEQOAONV.js";
233
234
  import {
234
235
  getExperimentalFeatures,
235
236
  isExperimentalFeatureEnabled,
@@ -249,10 +250,10 @@ import {
249
250
  scheduledRunId,
250
251
  scheduledRunSchema,
251
252
  withScheduledTaskLock
252
- } from "./chunk-BFP3ZKG6.js";
253
+ } from "./chunk-WMJS5DDV.js";
253
254
  import {
254
255
  parseSlackThreadId
255
- } from "./chunk-HMBTX5RK.js";
256
+ } from "./chunk-IOGDKPVU.js";
256
257
  import {
257
258
  CONVERSATION_WORK_STALE_ENQUEUE_MS,
258
259
  appendAndEnqueueInboundMessage,
@@ -267,16 +268,16 @@ import {
267
268
  removeActiveConversation,
268
269
  requestConversationWork,
269
270
  stopConversationWork
270
- } from "./chunk-5LEVZYXF.js";
271
+ } from "./chunk-E53C73ML.js";
271
272
  import {
272
273
  buildDeterministicAssistantMessageId,
273
274
  buildDeterministicTurnId
274
275
  } from "./chunk-DA2KGZZI.js";
275
- import "./chunk-D5YQPCEG.js";
276
+ import "./chunk-RFE7DCZK.js";
276
277
  import {
277
278
  getSandboxResourceConfig,
278
279
  setSandboxResourceConfig
279
- } from "./chunk-IBXXTO3J.js";
280
+ } from "./chunk-ELCYG6UU.js";
280
281
  import "./chunk-PDO5BLNM.js";
281
282
  import "./chunk-UIE3R5XU.js";
282
283
  import {
@@ -285,7 +286,7 @@ import {
285
286
  } from "./chunk-X6GDDWQH.js";
286
287
  import {
287
288
  getTurnRequestDeadline
288
- } from "./chunk-IQCL5JGL.js";
289
+ } from "./chunk-NWWDFHXP.js";
289
290
  import {
290
291
  getVercelConversationWorkQueue,
291
292
  resolveConversationWorkQueueTopic,
@@ -321,7 +322,7 @@ import {
321
322
  verifyEventTaskCredentialSubject,
322
323
  verifyScheduledTaskCredentialSubject,
323
324
  verifySlackDirectCredentialSubject
324
- } from "./chunk-FQ5HFSFR.js";
325
+ } from "./chunk-CCTYK5RH.js";
325
326
  import "./chunk-3Y47VMHV.js";
326
327
  import {
327
328
  createSlackDestination,
@@ -333,7 +334,7 @@ import {
333
334
  requireSlackDestination,
334
335
  withConversationEventLock,
335
336
  withConversationMutationLock
336
- } from "./chunk-2CYWEVOP.js";
337
+ } from "./chunk-ADEACKAH.js";
337
338
  import {
338
339
  juniorAgentBindings,
339
340
  juniorAgentInvocations,
@@ -341,13 +342,13 @@ import {
341
342
  juniorConversations,
342
343
  juniorSchedulerRuns,
343
344
  juniorSchedulerTasks
344
- } from "./chunk-5S6AQFNG.js";
345
- import "./chunk-KWXZMHJS.js";
345
+ } from "./chunk-XLWZRHX5.js";
346
+ import "./chunk-7ANA7PBB.js";
346
347
  import {
347
348
  acquireActiveLock,
348
349
  getStateAdapter,
349
350
  withActiveLock
350
- } from "./chunk-IOUUS6H4.js";
351
+ } from "./chunk-V4HXV5MY.js";
351
352
  import {
352
353
  instructionProvenanceFor
353
354
  } from "./chunk-GFBR4S3Q.js";
@@ -369,17 +370,17 @@ import {
369
370
  isProviderRetryError,
370
371
  setProfiles,
371
372
  setSlackReactionConfig
372
- } from "./chunk-WJJDQLVL.js";
373
+ } from "./chunk-U76RWMFR.js";
373
374
  import {
374
375
  defaultModelId,
375
376
  modelIdForProfile
376
377
  } from "./chunk-D4YV5TDV.js";
377
- import "./chunk-OICYQPKP.js";
378
- import "./chunk-3YZ2Q6AW.js";
378
+ import "./chunk-JOI3DHML.js";
379
+ import "./chunk-P2P6MUQ4.js";
379
380
  import {
380
381
  pluginCatalogRuntime
381
- } from "./chunk-DXFUYLHX.js";
382
- import "./chunk-QWY4KI2V.js";
382
+ } from "./chunk-WWXJUURQ.js";
383
+ import "./chunk-S7GX44BU.js";
383
384
  import {
384
385
  credentialContextForActor
385
386
  } from "./chunk-CEMMLV5L.js";
@@ -415,13 +416,13 @@ import {
415
416
  withContext,
416
417
  withLogContext,
417
418
  withSpan
418
- } from "./chunk-QY2IU47O.js";
419
+ } from "./chunk-X76JVHQ4.js";
419
420
  import {
420
421
  continueTrace
421
422
  } from "./chunk-PEQXYSSE.js";
422
423
  import {
423
424
  JUNIOR_VERSION
424
- } from "./chunk-QDU5MW2R.js";
425
+ } from "./chunk-IME5OW4Y.js";
425
426
 
426
427
  // src/app.ts
427
428
  import { createRequire } from "module";
@@ -5017,7 +5018,9 @@ function createSlackTurnRuntime(deps) {
5017
5018
  };
5018
5019
  const postFallbackErrorReplyWithLogging = async (args) => {
5019
5020
  try {
5020
- await args.thread.post(buildTurnFailureResponse(args.eventId));
5021
+ await args.thread.post(
5022
+ buildTurnErrorResponse(args.error, args.eventId)
5023
+ );
5021
5024
  } catch (postError) {
5022
5025
  logException(postError, args.postFailureEventName, {
5023
5026
  "app.slack.reply_stage": "error_fallback_post",
@@ -5319,6 +5322,7 @@ function createSlackTurnRuntime(deps) {
5319
5322
  await postFallbackErrorReplyWithLogging({
5320
5323
  thread,
5321
5324
  eventId,
5325
+ error: failureCause,
5322
5326
  postFailureEventName: "mention.handler.failure_reply_post.failed"
5323
5327
  });
5324
5328
  if (lifecycleError) throw lifecycleError;
@@ -5607,6 +5611,7 @@ function createSlackTurnRuntime(deps) {
5607
5611
  await postFallbackErrorReplyWithLogging({
5608
5612
  thread,
5609
5613
  eventId,
5614
+ error: failureCause,
5610
5615
  postFailureEventName: "subscribed_message.handler.failure_reply_post.failed"
5611
5616
  });
5612
5617
  if (lifecycleError) throw lifecycleError;
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-DXFUYLHX.js";
4
- import "./chunk-QWY4KI2V.js";
3
+ } from "./chunk-WWXJUURQ.js";
4
+ import "./chunk-S7GX44BU.js";
5
5
  import "./chunk-CEMMLV5L.js";
6
6
  import "./chunk-N7TMSOZH.js";
7
7
  import "./chunk-DWPN6SCH.js";
8
8
  import "./chunk-TXKUKMVO.js";
9
- import "./chunk-QY2IU47O.js";
9
+ import "./chunk-X76JVHQ4.js";
10
10
  import "./chunk-PEQXYSSE.js";
11
- import "./chunk-QDU5MW2R.js";
11
+ import "./chunk-IME5OW4Y.js";
12
12
  export {
13
13
  pluginCatalogRuntime
14
14
  };
@@ -38,6 +38,8 @@ export declare function createResumeState(args: ResumeStateArgs): {
38
38
  readonly timedOut: boolean;
39
39
  setTurnStartMessageIndex(index: number | undefined): void;
40
40
  setBeforeMessageCount(count: number): void;
41
+ /** Admit one tool call against the durable turn total, or throw the limit. */
42
+ admitToolCall(): void;
41
43
  setTurnContexts(contexts: PluginTurnContext[]): void;
42
44
  /** Use an already committed boundary as the resume baseline. */
43
45
  adoptCommittedBoundary(messages: PiMessage[]): void;
@@ -21,6 +21,7 @@ export interface BotConfig {
21
21
  reasoningLevel?: TurnReasoningLevel;
22
22
  visionModelId?: string;
23
23
  maxSlicesPerTurn: number;
24
+ maxToolCallsPerTurn: number;
24
25
  turnTimeoutMs: number;
25
26
  userName: string;
26
27
  webSearchModelId: string;
@@ -1124,12 +1124,12 @@ export interface ConversationEventPage {
1124
1124
  /** Persist and read the canonical per-conversation event log. */
1125
1125
  export interface ConversationEventStore {
1126
1126
  /**
1127
- * Append events atomically, optionally preserving conversation activity.
1127
+ * Append events atomically and return each event's sequence and history version.
1128
1128
  * Archive clears only for human user activity, not every non-preserve write.
1129
1129
  */
1130
1130
  append(conversationId: string, events: NewConversationEvent[], options?: {
1131
1131
  activity?: "preserve";
1132
- }): Promise<void>;
1132
+ }): Promise<Array<Pick<ConversationEvent, "seq" | "historyVersion">>>;
1133
1133
  /** Replace active model history with a compaction or handoff event. */
1134
1134
  replaceHistory(conversationId: string, replacement: HistoryReplacement): Promise<void>;
1135
1135
  /** One event selected by its retry-stable key across history versions. */
@@ -1138,6 +1138,8 @@ export interface ConversationEventStore {
1138
1138
  loadLatestStructuredEvent(conversationId: string, namespace: string, name: string): Promise<ConversationEvent | undefined>;
1139
1139
  /** Latest durable instruction across history versions. */
1140
1140
  loadLatestInstruction(conversationId: string): Promise<ConversationEvent | undefined>;
1141
+ /** Current model-history version, or zero when no event exists. */
1142
+ loadCurrentHistoryVersion(conversationId: string): Promise<number>;
1141
1143
  /** Events of the current history version in `seq` order. */
1142
1144
  loadCurrentHistory(conversationId: string): Promise<ConversationEvent[]>;
1143
1145
  /** Events in the history version containing `seq`, when it exists. */
@@ -1,6 +1,16 @@
1
- /** Terminal failure raised when one agent turn exhausts its slice budget. */
1
+ /** Terminal failure when one turn uses too many execution slices. */
2
2
  export declare class TurnSliceLimitExceededError extends Error {
3
3
  constructor(maxSlices: number);
4
4
  }
5
+ /** Terminal failure when one turn uses too many tool calls. */
6
+ export declare class TurnToolCallLimitExceededError extends Error {
7
+ constructor(maxToolCalls: number);
8
+ }
9
+ /** True when a turn hit a hard execution limit, including one Error.cause wrap. */
10
+ export declare function isTurnExecutionLimitExceededError(error: unknown): boolean;
11
+ /** Stop the turn when its tool-call count is past the limit. */
12
+ export declare function assertTurnToolCallLimit(toolCallCount: number, maxToolCalls: number): void;
5
13
  /** Explain a terminal turn execution limit with actionable recovery guidance. */
6
14
  export declare function buildTurnLimitResponse(eventId: string): string;
15
+ /** User-facing reply for a thrown turn error. */
16
+ export declare function buildTurnErrorResponse(error: unknown, eventId: string): string;
@@ -4,7 +4,7 @@ export declare function parseSlackTeamDomain(value: unknown): string | undefined
4
4
  * Build a direct Slack archive URL for a thread when the workspace domain is
5
5
  * known. Omits a link rather than falling back to `app_redirect`.
6
6
  */
7
- export declare function buildSlackSourceUrl(args: {
7
+ export declare function buildSlackLocationUrl(args: {
8
8
  channelId: string;
9
9
  teamDomain: string;
10
10
  threadTs: string;
@@ -49,6 +49,8 @@ interface TurnCheckpointWrite {
49
49
  source?: Source;
50
50
  surface?: AgentTurnSurface;
51
51
  turnStartMessageIndex?: number;
52
+ /** Tool calls charged to this turn; survives history replacement. */
53
+ cumulativeToolCallCount?: number;
52
54
  trailingMessageProvenance?: ConversationMessageProvenance[];
53
55
  turnContexts?: PluginTurnContext[];
54
56
  durationMs?: number;
@@ -32,6 +32,8 @@ export interface TurnRecord {
32
32
  version: number;
33
33
  conversationId: string;
34
34
  cumulativeDurationMs: number;
35
+ /** Tool calls charged to this turn; survives history replacement. */
36
+ cumulativeToolCallCount?: number;
35
37
  cumulativeUsage?: AgentTurnUsage;
36
38
  dispatchId?: string;
37
39
  dispatchOutcome?: AgentDispatchOutcome;
@@ -86,6 +88,7 @@ export declare function upsertTurnRecord(args: {
86
88
  channelName?: string;
87
89
  conversationId: string;
88
90
  cumulativeDurationMs?: number;
91
+ cumulativeToolCallCount?: number;
89
92
  cumulativeUsage?: AgentTurnUsage;
90
93
  destination?: Destination;
91
94
  dispatchId?: string;
@@ -3,22 +3,34 @@ export declare const TASK_EXECUTION_TYPES: readonly ["scheduled", "event"];
3
3
  export declare const TASK_EXECUTION_STATUSES: readonly ["blocked", "completed", "failed"];
4
4
  export type TaskExecutionType = (typeof TASK_EXECUTION_TYPES)[number];
5
5
  export type TaskExecutionDay = {
6
+ costUsd: number;
6
7
  date: string;
7
8
  event: number;
8
9
  scheduled: number;
9
10
  };
11
+ export type TaskRunWindows = {
12
+ 1: number;
13
+ 7: number;
14
+ 30: number;
15
+ 90: number;
16
+ };
10
17
  export type TaskExecutionSummary = {
11
18
  lastConversationId?: string;
12
19
  lastExecutedAtMs?: number;
13
- runsLast7Days: number;
20
+ runs: TaskRunWindows;
14
21
  totalRuns: number;
15
22
  };
23
+ /** Empty run windows for tasks with no execution history. */
24
+ export declare function emptyTaskRunWindows(): TaskRunWindows;
16
25
  export type TaskExecutionRecord = {
17
26
  conversationId?: string;
27
+ costUsd?: number;
28
+ durationMs?: number;
18
29
  executedAt: string;
19
30
  executionId: string;
20
31
  status: TaskExecutionStatus;
21
32
  title?: string;
33
+ totalTokens?: number;
22
34
  };
23
35
  export type TaskRunRecord = TaskExecutionRecord & {
24
36
  kind: TaskExecutionType;
@@ -34,5 +34,9 @@ export declare const agentTurnUsageSchema: import("zod").ZodObject<{
34
34
  export type AgentTurnUsage = Usage;
35
35
  /** Return whether any token counter is present on a usage record. */
36
36
  export declare function hasAgentTurnUsage(usage: AgentTurnUsage | undefined): usage is AgentTurnUsage;
37
+ /** Estimated total USD cost from one usage record, when any cost field is present. */
38
+ export declare function agentTurnCostUsd(usage: AgentTurnUsage | undefined): number | undefined;
39
+ /** Total token count from one usage record, preferring component counters. */
40
+ export declare function agentTurnTotalTokens(usage: AgentTurnUsage | undefined): number | undefined;
37
41
  /** Aggregate token usage across slices without double-counting provider totals. */
38
42
  export declare function addAgentTurnUsage(...usages: Array<AgentTurnUsage | undefined>): AgentTurnUsage | undefined;
@@ -2,16 +2,16 @@ import {
2
2
  coerceThreadConversationState,
3
3
  getPersistedThreadState,
4
4
  persistThreadStateById
5
- } from "./chunk-S5HS6WRH.js";
5
+ } from "./chunk-GY5SEFVL.js";
6
6
  import {
7
7
  clearPendingAuth,
8
8
  markTurnClosed,
9
9
  markTurnCompleted
10
- } from "./chunk-K47OVEO4.js";
10
+ } from "./chunk-G35QGPO2.js";
11
11
  import {
12
12
  hydrateConversationMessages,
13
13
  markConversationMessage
14
- } from "./chunk-ZFPEPWOO.js";
14
+ } from "./chunk-OEQOAONV.js";
15
15
  import {
16
16
  buildDeterministicTurnId
17
17
  } from "./chunk-DA2KGZZI.js";
@@ -20,13 +20,13 @@ import {
20
20
  findProviderError,
21
21
  getProviderErrorAttributes,
22
22
  getProviderErrorUserMessage
23
- } from "./chunk-WJJDQLVL.js";
23
+ } from "./chunk-U76RWMFR.js";
24
24
  import {
25
25
  parseSlackMessageTs
26
26
  } from "./chunk-N7TMSOZH.js";
27
27
  import {
28
28
  buildTurnFailureResponse
29
- } from "./chunk-QY2IU47O.js";
29
+ } from "./chunk-X76JVHQ4.js";
30
30
 
31
31
  // src/chat/runtime/delivered-turn-state.ts
32
32
  function buildDeliveredTurnStatePatch(args) {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  ConversationTurnLifecycleService
3
- } from "./chunk-WH5VV2RW.js";
3
+ } from "./chunk-6H2MKVV5.js";
4
4
  import {
5
5
  runAgentWithTimeout
6
- } from "./chunk-COCVPDWX.js";
6
+ } from "./chunk-ENWIHU54.js";
7
7
  import {
8
8
  getConversationEventStore
9
- } from "./chunk-2CYWEVOP.js";
9
+ } from "./chunk-ADEACKAH.js";
10
10
 
11
11
  // src/chat/runtime/turn-execution.ts
12
12
  var AgentRunError = class extends Error {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getConversationEventStore
3
- } from "./chunk-2CYWEVOP.js";
3
+ } from "./chunk-ADEACKAH.js";
4
4
 
5
5
  // src/chat/conversations/turn-lifecycle.ts
6
6
  var ConversationTurnLifecycleService = class {
@@ -19,23 +19,23 @@ import {
19
19
  releaseConversationWork,
20
20
  requestAnotherSlice,
21
21
  startConversationWork
22
- } from "./chunk-5LEVZYXF.js";
22
+ } from "./chunk-E53C73ML.js";
23
23
  import {
24
24
  getTurnRequestDeadline
25
- } from "./chunk-IQCL5JGL.js";
25
+ } from "./chunk-NWWDFHXP.js";
26
26
  import {
27
27
  ConversationQueueMessageRejectedError
28
28
  } from "./chunk-JAL3CH4G.js";
29
29
  import {
30
30
  getChatConfig,
31
31
  isProviderRetryError
32
- } from "./chunk-WJJDQLVL.js";
32
+ } from "./chunk-U76RWMFR.js";
33
33
  import {
34
34
  logException,
35
35
  logInfo,
36
36
  logWarn,
37
37
  withLogContext
38
- } from "./chunk-QY2IU47O.js";
38
+ } from "./chunk-X76JVHQ4.js";
39
39
 
40
40
  // src/chat/task-execution/worker.ts
41
41
  var CONVERSATION_WORK_DEFER_DELAY_MS = 15e3;
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  toOptionalTrimmed
3
- } from "./chunk-WJJDQLVL.js";
3
+ } from "./chunk-U76RWMFR.js";
4
4
  import {
5
5
  pluginCatalogRuntime
6
- } from "./chunk-DXFUYLHX.js";
6
+ } from "./chunk-WWXJUURQ.js";
7
7
  import {
8
8
  setSpanAttributes,
9
9
  setSpanStatus
10
- } from "./chunk-QY2IU47O.js";
10
+ } from "./chunk-X76JVHQ4.js";
11
11
 
12
12
  // src/chat/sandbox/paths.ts
13
13
  function normalizeWorkspaceRoot(input) {