@sentry/junior 0.105.0 → 0.106.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.
@@ -11,13 +11,13 @@ import {
11
11
  getPlugins,
12
12
  setPlugins,
13
13
  validatePlugins
14
- } from "./chunk-VDHMFCDY.js";
15
- import "./chunk-4PDVOHXP.js";
14
+ } from "./chunk-ZMRLBBD5.js";
15
+ import "./chunk-AZ5OMSN5.js";
16
16
  import "./chunk-G3E7SCME.js";
17
- import "./chunk-CCTCIISK.js";
18
- import "./chunk-BCULHGZK.js";
17
+ import "./chunk-3MPPVPGZ.js";
18
+ import "./chunk-XTKJPSMF.js";
19
19
  import "./chunk-4ZNGQH7C.js";
20
- import "./chunk-M3UAVLEN.js";
20
+ import "./chunk-4UYIRWDW.js";
21
21
  import "./chunk-FXFQNHRU.js";
22
22
  import "./chunk-RT5BUHR5.js";
23
23
  import "./chunk-B7PUBQQM.js";
package/dist/api.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  formatSlackConversationRedactedLabel,
21
21
  readHealthReport,
22
22
  resolveSlackConversationContextFromThreadId
23
- } from "./chunk-O7ILGCMJ.js";
23
+ } from "./chunk-R5BFYK2O.js";
24
24
  import {
25
25
  pluginOperationalReportFeedSchema,
26
26
  pluginReportsSchema,
@@ -31,10 +31,10 @@ import {
31
31
  listBoundedAgentTurnSessionSummariesForConversation,
32
32
  loadProjection,
33
33
  projectSteps
34
- } from "./chunk-QDKRE3LS.js";
35
- import "./chunk-RYDF4GOX.js";
34
+ } from "./chunk-DDRQ4U7I.js";
35
+ import "./chunk-P4P7O5WG.js";
36
36
  import "./chunk-PDO5BLNM.js";
37
- import "./chunk-CCTCIISK.js";
37
+ import "./chunk-3MPPVPGZ.js";
38
38
  import {
39
39
  getAgentStepStore,
40
40
  getConversationMessageStore,
@@ -42,13 +42,13 @@ import {
42
42
  juniorConversations,
43
43
  juniorIdentities,
44
44
  juniorUsers
45
- } from "./chunk-BCULHGZK.js";
45
+ } from "./chunk-XTKJPSMF.js";
46
46
  import "./chunk-4ZNGQH7C.js";
47
47
  import {
48
48
  stripRuntimeTurnContext,
49
49
  unescapeXml,
50
50
  unwrapCurrentInstruction
51
- } from "./chunk-M3UAVLEN.js";
51
+ } from "./chunk-4UYIRWDW.js";
52
52
  import {
53
53
  juniorDestinations
54
54
  } from "./chunk-FXFQNHRU.js";
@@ -2281,7 +2281,7 @@ async function readRuntimeInfoReport() {
2281
2281
  }
2282
2282
  async function readPluginOperationalReportFeed() {
2283
2283
  const nowMs = Date.now();
2284
- const { getPluginOperationalReports } = await import("./agent-hooks-EOFSY2PD.js");
2284
+ const { getPluginOperationalReports } = await import("./agent-hooks-KR5BCWOK.js");
2285
2285
  return pluginOperationalReportFeedSchema.parse({
2286
2286
  source: "plugins",
2287
2287
  generatedAt: new Date(nowMs).toISOString(),
package/dist/app.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  processPluginTask,
6
6
  requireTurnFailureEventId,
7
7
  scheduleSessionCompletedPluginTasks
8
- } from "./chunk-QVTVCJR4.js";
8
+ } from "./chunk-4W4O4DCV.js";
9
9
  import {
10
10
  CONVERSATION_WORK_CHECK_IN_INTERVAL_MS,
11
11
  CONVERSATION_WORK_STALE_ENQUEUE_MS,
@@ -29,14 +29,14 @@ import {
29
29
  requestConversationContinuation,
30
30
  requestConversationWork,
31
31
  startConversationWork
32
- } from "./chunk-U26ZWZCN.js";
32
+ } from "./chunk-3OUSJPR7.js";
33
33
  import {
34
34
  GET,
35
35
  buildSentryConversationUrl,
36
36
  conversationVisibilityFromSlackChannelType,
37
37
  resolveSlackChannelTypeFromMessage,
38
38
  resolveSlackConversationContext
39
- } from "./chunk-O7ILGCMJ.js";
39
+ } from "./chunk-R5BFYK2O.js";
40
40
  import "./chunk-CEA3A3UA.js";
41
41
  import {
42
42
  getVercelConversationWorkQueue,
@@ -102,12 +102,14 @@ import {
102
102
  splitSlackReplyText,
103
103
  startOAuthFlow,
104
104
  truncateStatusText
105
- } from "./chunk-NJJFU6CP.js";
105
+ } from "./chunk-GPPUTY5M.js";
106
106
  import {
107
107
  CooperativeTurnYieldError,
108
108
  TurnInputCommitLostError,
109
109
  TurnInputDeferredError,
110
+ TurnSliceLimitExceededError,
110
111
  buildDeterministicTurnId,
112
+ buildTurnLimitResponse,
111
113
  clearPendingAuth,
112
114
  coerceThreadArtifactsState,
113
115
  completeDeliveredTurn,
@@ -130,12 +132,12 @@ import {
130
132
  persistWithRetry,
131
133
  persistYieldSessionRecord,
132
134
  startActiveTurn
133
- } from "./chunk-RMZ65YAA.js";
135
+ } from "./chunk-BKM4UXUD.js";
134
136
  import {
135
137
  JUNIOR_THREAD_STATE_TTL_MS,
136
138
  coerceThreadConversationState
137
139
  } from "./chunk-XIMUQ4IU.js";
138
- import "./chunk-7G4J3CR7.js";
140
+ import "./chunk-3NYUCBLE.js";
139
141
  import {
140
142
  abandonAgentTurnSessionRecord,
141
143
  commitMessages,
@@ -146,7 +148,7 @@ import {
146
148
  loadProjection,
147
149
  recordAgentTurnSessionSummary,
148
150
  recordAuthorizationCompleted
149
- } from "./chunk-QDKRE3LS.js";
151
+ } from "./chunk-DDRQ4U7I.js";
150
152
  import {
151
153
  buildConversationContext,
152
154
  createConversationMemoryService,
@@ -161,7 +163,7 @@ import {
161
163
  persistConversationMessages,
162
164
  updateConversationStats,
163
165
  upsertConversationMessage
164
- } from "./chunk-RYDF4GOX.js";
166
+ } from "./chunk-P4P7O5WG.js";
165
167
  import "./chunk-PDO5BLNM.js";
166
168
  import "./chunk-UIE3R5XU.js";
167
169
  import {
@@ -177,11 +179,11 @@ import {
177
179
  validatePlugins,
178
180
  verifyScheduledTaskCredentialSubject,
179
181
  verifySlackDirectCredentialSubject
180
- } from "./chunk-VDHMFCDY.js";
182
+ } from "./chunk-ZMRLBBD5.js";
181
183
  import {
182
184
  createPluginLogger,
183
185
  createPluginState
184
- } from "./chunk-4PDVOHXP.js";
186
+ } from "./chunk-AZ5OMSN5.js";
185
187
  import "./chunk-G3E7SCME.js";
186
188
  import {
187
189
  SlackActionError,
@@ -193,7 +195,7 @@ import {
193
195
  normalizeSlackConversationId,
194
196
  runWithSlackInstallationToken,
195
197
  runWithWorkspaceTeamId
196
- } from "./chunk-CCTCIISK.js";
198
+ } from "./chunk-3MPPVPGZ.js";
197
199
  import {
198
200
  contextProvenance,
199
201
  getConversationStore,
@@ -203,7 +205,7 @@ import {
203
205
  juniorAgentSteps,
204
206
  juniorConversationMessages,
205
207
  juniorConversations
206
- } from "./chunk-BCULHGZK.js";
208
+ } from "./chunk-XTKJPSMF.js";
207
209
  import {
208
210
  sleep
209
211
  } from "./chunk-4ZNGQH7C.js";
@@ -230,7 +232,7 @@ import {
230
232
  setSlackReactionConfig,
231
233
  stripRuntimeTurnContext,
232
234
  trimTrailingAssistantMessages
233
- } from "./chunk-M3UAVLEN.js";
235
+ } from "./chunk-4UYIRWDW.js";
234
236
  import {
235
237
  juniorDestinations
236
238
  } from "./chunk-FXFQNHRU.js";
@@ -3837,7 +3839,9 @@ async function startSlackProcessingReactionForMessage(args) {
3837
3839
  };
3838
3840
  return {
3839
3841
  complete: async () => {
3840
- if (!await removeProcessingReaction()) {
3842
+ const shouldAddCompleted = shouldRemove;
3843
+ await removeProcessingReaction();
3844
+ if (!shouldAddCompleted) {
3841
3845
  return;
3842
3846
  }
3843
3847
  try {
@@ -3990,7 +3994,7 @@ async function postResumeFailureReply(args) {
3990
3994
  await postSlackMessage({
3991
3995
  channelId: args.channelId,
3992
3996
  threadTs: args.threadTs,
3993
- text: buildTurnFailureResponse(args.eventId)
3997
+ text: args.error instanceof TurnSliceLimitExceededError ? buildTurnLimitResponse(args.eventId) : buildTurnFailureResponse(args.eventId)
3994
3998
  });
3995
3999
  } catch (error) {
3996
4000
  logException(
@@ -4020,6 +4024,7 @@ async function handleResumeFailure(args) {
4020
4024
  channelId: args.resumeArgs.channelId,
4021
4025
  threadTs: args.resumeArgs.threadTs,
4022
4026
  eventId,
4027
+ error: args.error,
4023
4028
  logContext
4024
4029
  });
4025
4030
  }
@@ -9948,10 +9953,18 @@ function createReplyToThread(deps) {
9948
9953
  let persistedAtLeastOnce = false;
9949
9954
  let shouldPersistFailureState = true;
9950
9955
  let finalReplyDelivered = false;
9956
+ let turnCompletionNotified = false;
9951
9957
  let latestArtifacts = preparedState.artifacts;
9952
9958
  let assistantTitleArtifacts = {};
9953
9959
  let agentContinueScheduleError;
9954
9960
  const hasVisibleSlackDelivery = (post) => post.text.trim().length > 0;
9961
+ const notifyTurnCompleted = async () => {
9962
+ if (turnCompletionNotified) {
9963
+ return;
9964
+ }
9965
+ await options.onTurnCompleted?.();
9966
+ turnCompletionNotified = true;
9967
+ };
9955
9968
  try {
9956
9969
  const loadedPiMessages = await loadPiMessagesForTurn({
9957
9970
  conversationId,
@@ -10426,7 +10439,7 @@ function createReplyToThread(deps) {
10426
10439
  "Agent turn completed"
10427
10440
  );
10428
10441
  }
10429
- await options.onTurnCompleted?.();
10442
+ await notifyTurnCompleted();
10430
10443
  if (reply.diagnostics.outcome === "success" && conversationId) {
10431
10444
  try {
10432
10445
  await deps.services.scheduleSessionCompletedPluginTasks({
@@ -10453,6 +10466,17 @@ function createReplyToThread(deps) {
10453
10466
  messageTs ? { "messaging.message.id": messageTs } : {},
10454
10467
  "Post-delivery turn work failed after Slack accepted the reply"
10455
10468
  );
10469
+ try {
10470
+ await notifyTurnCompleted();
10471
+ } catch (completionError) {
10472
+ logException(
10473
+ completionError,
10474
+ "slack_reply_post_delivery_completion_callback_failed",
10475
+ turnTraceContext,
10476
+ messageTs ? { "messaging.message.id": messageTs } : {},
10477
+ "Post-delivery turn completion callback failed after Slack accepted the reply"
10478
+ );
10479
+ }
10456
10480
  return;
10457
10481
  }
10458
10482
  if (error instanceof CooperativeTurnYieldError) {
@@ -13,6 +13,7 @@ export interface BotConfig {
13
13
  reasoningLevel?: TurnReasoningLevel;
14
14
  modelContextWindowTokens?: number;
15
15
  visionModelId?: string;
16
+ maxSlicesPerTurn: number;
16
17
  turnTimeoutMs: number;
17
18
  userName: string;
18
19
  }
@@ -0,0 +1,6 @@
1
+ /** Terminal failure raised when one agent turn exhausts its slice budget. */
2
+ export declare class TurnSliceLimitExceededError extends Error {
3
+ constructor(maxSlices: number);
4
+ }
5
+ /** Explain a terminal turn execution limit with actionable recovery guidance. */
6
+ export declare function buildTurnLimitResponse(eventId: string): string;
@@ -4,7 +4,6 @@ import type { Destination, Actor, Source } from "@sentry/junior-plugin-api";
4
4
  import type { PiMessage } from "@/chat/pi/messages";
5
5
  import type { PiMessageProvenance } from "@/chat/state/session-log";
6
6
  import { type AgentTurnUsage } from "@/chat/usage";
7
- export declare const AGENT_CONTINUE_MAX_SLICES = 48;
8
7
  export interface TurnSessionContext {
9
8
  conversationId?: string;
10
9
  sessionId?: string;
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-4ZNGQH7C.js";
4
4
  import {
5
5
  getSlackBotToken
6
- } from "./chunk-M3UAVLEN.js";
6
+ } from "./chunk-4UYIRWDW.js";
7
7
  import {
8
8
  logWarn,
9
9
  setSpanAttributes,
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  getStateAdapter,
9
9
  toOptionalTrimmed
10
- } from "./chunk-M3UAVLEN.js";
10
+ } from "./chunk-4UYIRWDW.js";
11
11
  import {
12
12
  pluginCatalogRuntime
13
13
  } from "./chunk-77LHNQK4.js";
@@ -5,7 +5,7 @@ import {
5
5
  getChatConfig,
6
6
  getDefaultRedisStateAdapterFor,
7
7
  getStateAdapter
8
- } from "./chunk-M3UAVLEN.js";
8
+ } from "./chunk-4UYIRWDW.js";
9
9
  import {
10
10
  parseDestination,
11
11
  sameDestination
@@ -596,6 +596,7 @@ function modelIdForProfile(config, profile) {
596
596
  // src/chat/config.ts
597
597
  var MIN_AGENT_TURN_TIMEOUT_MS = 10 * 1e3;
598
598
  var DEFAULT_AGENT_TURN_TIMEOUT_MS = 12 * 60 * 1e3;
599
+ var MAX_SLICES_PER_TURN = 100;
599
600
  var DEFAULT_FUNCTION_MAX_DURATION_SECONDS = 300;
600
601
  var DEFAULT_SLACK_SLASH_COMMAND = "/jr";
601
602
  var DEFAULT_PROCESSING_REACTION_EMOJI = "eyes";
@@ -767,6 +768,7 @@ function readBotConfig(env) {
767
768
  embeddingModelId: validateEmbeddingModelId(env.AI_EMBEDDING_MODEL) ?? DEFAULT_EMBEDDING_MODEL_ID,
768
769
  loadingMessages: parseLoadingMessages(env.JUNIOR_LOADING_MESSAGES),
769
770
  visionModelId: validateGatewayModelId(env.AI_VISION_MODEL),
771
+ maxSlicesPerTurn: MAX_SLICES_PER_TURN,
770
772
  turnTimeoutMs: parseAgentTurnTimeoutMs(
771
773
  env.AGENT_TURN_TIMEOUT_MS,
772
774
  maxTurnTimeoutMs
@@ -9,13 +9,13 @@ import {
9
9
  getPersistedThreadState,
10
10
  markTurnCompleted,
11
11
  mergeArtifactsState
12
- } from "./chunk-RMZ65YAA.js";
12
+ } from "./chunk-BKM4UXUD.js";
13
13
  import {
14
14
  coerceThreadConversationState
15
15
  } from "./chunk-XIMUQ4IU.js";
16
16
  import {
17
17
  getAgentTurnSessionRecord
18
- } from "./chunk-QDKRE3LS.js";
18
+ } from "./chunk-DDRQ4U7I.js";
19
19
  import {
20
20
  generateConversationId,
21
21
  hydrateConversationMessages,
@@ -23,19 +23,19 @@ import {
23
23
  normalizeConversationText,
24
24
  updateConversationStats,
25
25
  upsertConversationMessage
26
- } from "./chunk-RYDF4GOX.js";
26
+ } from "./chunk-P4P7O5WG.js";
27
27
  import {
28
28
  createPluginEmbedder,
29
29
  createPluginModel,
30
30
  getPlugins
31
- } from "./chunk-VDHMFCDY.js";
31
+ } from "./chunk-ZMRLBBD5.js";
32
32
  import {
33
33
  createPluginLogger,
34
34
  createPluginState
35
- } from "./chunk-4PDVOHXP.js";
35
+ } from "./chunk-AZ5OMSN5.js";
36
36
  import {
37
37
  getDb
38
- } from "./chunk-BCULHGZK.js";
38
+ } from "./chunk-XTKJPSMF.js";
39
39
  import {
40
40
  botConfig,
41
41
  getPiMessageRole,
@@ -45,7 +45,7 @@ import {
45
45
  isToolResultMessage,
46
46
  normalizeToolNameFromResult,
47
47
  stripRuntimeTurnContext
48
- } from "./chunk-M3UAVLEN.js";
48
+ } from "./chunk-4UYIRWDW.js";
49
49
  import {
50
50
  buildTurnFailureResponse
51
51
  } from "./chunk-AEWZ7F65.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getStateAdapter
3
- } from "./chunk-M3UAVLEN.js";
3
+ } from "./chunk-4UYIRWDW.js";
4
4
  import {
5
5
  logException,
6
6
  logInfo,
@@ -7,18 +7,19 @@ import {
7
7
  addAgentTurnUsage,
8
8
  getAgentTurnSessionRecord,
9
9
  upsertAgentTurnSessionRecord
10
- } from "./chunk-QDKRE3LS.js";
10
+ } from "./chunk-DDRQ4U7I.js";
11
11
  import {
12
12
  persistConversationMessages
13
- } from "./chunk-RYDF4GOX.js";
13
+ } from "./chunk-P4P7O5WG.js";
14
14
  import {
15
15
  sleep
16
16
  } from "./chunk-4ZNGQH7C.js";
17
17
  import {
18
+ botConfig,
18
19
  getPiMessageRole,
19
20
  getStateAdapter,
20
21
  trimTrailingAssistantMessages
21
- } from "./chunk-M3UAVLEN.js";
22
+ } from "./chunk-4UYIRWDW.js";
22
23
  import {
23
24
  getActiveTraceId,
24
25
  logException
@@ -112,8 +113,18 @@ async function persistWithRetry(persist) {
112
113
  throw lastError;
113
114
  }
114
115
 
116
+ // src/chat/services/turn-limit.ts
117
+ var TurnSliceLimitExceededError = class extends Error {
118
+ constructor(maxSlices) {
119
+ super(`Agent turn exceeded execution limit (${maxSlices} slices)`);
120
+ this.name = "TurnSliceLimitExceededError";
121
+ }
122
+ };
123
+ function buildTurnLimitResponse(eventId) {
124
+ return `I couldn't finish this request because this turn reached its execution limit. Please try again with a smaller or more specific request. Reference: \`event_id=${eventId}\`.`;
125
+ }
126
+
115
127
  // src/chat/services/turn-session-record.ts
116
- var AGENT_CONTINUE_MAX_SLICES = 48;
117
128
  function logSessionRecordError(error, eventName, args, attributes, message) {
118
129
  logException(
119
130
  error,
@@ -362,7 +373,7 @@ async function persistTimeoutSessionRecord(args) {
362
373
  latestSessionRecord?.cumulativeUsage,
363
374
  args.currentUsage
364
375
  );
365
- if (nextSliceId > AGENT_CONTINUE_MAX_SLICES) {
376
+ if (nextSliceId > botConfig.maxSlicesPerTurn) {
366
377
  return await upsertAgentTurnSessionRecord({
367
378
  ...args.channelName ?? latestSessionRecord?.channelName ? {
368
379
  channelName: args.channelName ?? latestSessionRecord?.channelName
@@ -386,7 +397,9 @@ async function persistTimeoutSessionRecord(args) {
386
397
  } : {},
387
398
  resumeReason: "timeout",
388
399
  resumedFromSliceId: latestSessionRecord?.resumedFromSliceId,
389
- errorMessage: `Agent continuation exceeded slice limit (${AGENT_CONTINUE_MAX_SLICES})`,
400
+ errorMessage: new TurnSliceLimitExceededError(
401
+ botConfig.maxSlicesPerTurn
402
+ ).message,
390
403
  ...args.actor ?? latestSessionRecord?.actor ? { actor: args.actor ?? latestSessionRecord?.actor } : {},
391
404
  ...getActiveTraceId() ?? latestSessionRecord?.traceId ? { traceId: getActiveTraceId() ?? latestSessionRecord?.traceId } : {}
392
405
  });
@@ -938,6 +951,8 @@ export {
938
951
  markTurnCompleted,
939
952
  markTurnFailed,
940
953
  persistWithRetry,
954
+ TurnSliceLimitExceededError,
955
+ buildTurnLimitResponse,
941
956
  loadTurnSessionRecord,
942
957
  persistRunningSessionRecord,
943
958
  persistCompletedSessionRecord,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ensureLegacyConversationImport
3
- } from "./chunk-RYDF4GOX.js";
3
+ } from "./chunk-P4P7O5WG.js";
4
4
  import {
5
5
  usageSchema
6
6
  } from "./chunk-PDO5BLNM.js";
@@ -10,10 +10,10 @@ import {
10
10
  getConversationStore,
11
11
  instructionActors,
12
12
  instructionProvenanceFor
13
- } from "./chunk-BCULHGZK.js";
13
+ } from "./chunk-XTKJPSMF.js";
14
14
  import {
15
15
  getStateAdapter
16
- } from "./chunk-M3UAVLEN.js";
16
+ } from "./chunk-4UYIRWDW.js";
17
17
  import {
18
18
  logWarn,
19
19
  toStoredSlackActor
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  CooperativeTurnYieldError,
3
3
  TurnInputCommitLostError,
4
+ TurnSliceLimitExceededError,
4
5
  abandonReplacedPendingAuth,
5
6
  canReusePendingAuthLink,
6
7
  getInterruptionMarker,
@@ -11,7 +12,7 @@ import {
11
12
  persistRunningSessionRecord,
12
13
  persistTimeoutSessionRecord,
13
14
  persistYieldSessionRecord
14
- } from "./chunk-RMZ65YAA.js";
15
+ } from "./chunk-BKM4UXUD.js";
15
16
  import {
16
17
  JUNIOR_THREAD_STATE_TTL_MS
17
18
  } from "./chunk-XIMUQ4IU.js";
@@ -24,7 +25,7 @@ import {
24
25
  isSnapshotMissingError,
25
26
  resolveRuntimeDependencySnapshot,
26
27
  runNonInteractiveCommand
27
- } from "./chunk-7G4J3CR7.js";
28
+ } from "./chunk-3NYUCBLE.js";
28
29
  import {
29
30
  addAgentTurnUsage,
30
31
  hasAgentTurnUsage,
@@ -34,12 +35,12 @@ import {
34
35
  recordAuthorizationRequested,
35
36
  recordMcpProviderConnected,
36
37
  recordToolExecutionStarted
37
- } from "./chunk-QDKRE3LS.js";
38
+ } from "./chunk-DDRQ4U7I.js";
38
39
  import {
39
40
  estimateTextTokens,
40
41
  getAgentContextCompactionTriggerTokens,
41
42
  updateConversationStats
42
- } from "./chunk-RYDF4GOX.js";
43
+ } from "./chunk-P4P7O5WG.js";
43
44
  import {
44
45
  privateTraceResultAttributes
45
46
  } from "./chunk-UIE3R5XU.js";
@@ -51,10 +52,10 @@ import {
51
52
  getPlugins,
52
53
  getSlackToolContext,
53
54
  resolveChannelCapabilities
54
- } from "./chunk-VDHMFCDY.js";
55
+ } from "./chunk-ZMRLBBD5.js";
55
56
  import {
56
57
  createPluginLogger
57
- } from "./chunk-4PDVOHXP.js";
58
+ } from "./chunk-AZ5OMSN5.js";
58
59
  import {
59
60
  SANDBOX_DATA_ROOT,
60
61
  SANDBOX_SKILLS_ROOT,
@@ -71,7 +72,7 @@ import {
71
72
  isDmChannel,
72
73
  normalizeSlackConversationId,
73
74
  withSlackRetries
74
- } from "./chunk-CCTCIISK.js";
75
+ } from "./chunk-3MPPVPGZ.js";
75
76
  import {
76
77
  contextProvenance,
77
78
  getAgentStepStore,
@@ -80,7 +81,7 @@ import {
80
81
  getDb,
81
82
  instructionActors,
82
83
  instructionProvenanceFor
83
- } from "./chunk-BCULHGZK.js";
84
+ } from "./chunk-XTKJPSMF.js";
84
85
  import {
85
86
  sleep
86
87
  } from "./chunk-4ZNGQH7C.js";
@@ -123,7 +124,7 @@ import {
123
124
  stripRuntimeTurnContext,
124
125
  trimTrailingAssistantMessages,
125
126
  unwrapCurrentInstruction
126
- } from "./chunk-M3UAVLEN.js";
127
+ } from "./chunk-4UYIRWDW.js";
127
128
  import {
128
129
  parseSlackThreadId,
129
130
  resolveConversationPrivacy,
@@ -2101,7 +2102,7 @@ var SKILL_POLICY_RULES = [
2101
2102
  var EXECUTION_CONTRACT_RULES = [
2102
2103
  "- Actionable request: act in this turn.",
2103
2104
  "- Continue until done or genuinely blocked. Do not finish with a plan, promise, or offer to check next when an available tool or source can move the request forward.",
2104
- "- Completion means the final answer covers the user's actual ask, including requested follow-up checks, and is grounded in the best evidence you could access.",
2105
+ "- Complete the full task, but report only the result and evidence the user needs; do not narrate every step, check, or detail.",
2105
2106
  "- Ask the user only for missing access, approval, or a decision that blocks safe progress. Ask one focused question; otherwise infer conservatively and continue.",
2106
2107
  "- For conflicting evidence, compare sources and state which source is authoritative for the answer.",
2107
2108
  "- For non-trivial or long-running work, call `reportProgress` early when available, then only when the major phase changes. Routine tool calls should stay silent."
@@ -2166,8 +2167,8 @@ function buildOutputSection(platform) {
2166
2167
  openTag,
2167
2168
  "- Start with the answer or result, not internal process narration.",
2168
2169
  "- Use Slack-flavored Markdown: **bold** section labels, `code`, [text](url) links, bullet lists, and fenced code blocks. No hash-prefixed headings and no tables. When the answer primarily lists several URLs, show each URL bare instead of as a labeled link.",
2169
- "- Keep replies brief and scannable; use bullets or short code blocks when helpful, and one compact thread reply when it fits.",
2170
- "- When a research or document-style answer would benefit from continuation, multiple sections, or future reference value, create a Slack canvas and keep the thread reply to one or two short sentences plus the link; do not recap the canvas contents.",
2170
+ "- Default to one compact thread reply containing the conclusion and only decisive evidence or action. Do not split an explainer across multiple Slack messages.",
2171
+ "- Put plans, research, and other long or multi-section explainers in a Slack canvas; reply with one or two short sentences plus the link, without recapping the canvas.",
2171
2172
  "- End every turn with a final user-facing markdown response unless the Slack action rules allow a no-reply completion.",
2172
2173
  "</output>"
2173
2174
  ].join("\n");
@@ -11430,6 +11431,19 @@ function findInErrorChain(error, predicate) {
11430
11431
  }
11431
11432
  return false;
11432
11433
  }
11434
+ function isRecord5(value) {
11435
+ return typeof value === "object" && value !== null;
11436
+ }
11437
+ function isInvalidSandboxSessionError(error) {
11438
+ if (!isRecord5(error)) {
11439
+ return false;
11440
+ }
11441
+ if (isRecord5(error.json) && error.json.invalidToken === true) {
11442
+ return true;
11443
+ }
11444
+ const response = error.response;
11445
+ return isRecord5(response) && response.status === 403 && typeof response.url === "string" && response.url.includes("/sandboxes/sessions");
11446
+ }
11433
11447
  function getFirstErrorMessage(error) {
11434
11448
  const seen = /* @__PURE__ */ new Set();
11435
11449
  let current = error;
@@ -11451,9 +11465,12 @@ function isAlreadyExistsError(error) {
11451
11465
  }
11452
11466
  function isSandboxUnavailableError(error) {
11453
11467
  return findInErrorChain(error, (candidate) => {
11468
+ if (isInvalidSandboxSessionError(candidate)) {
11469
+ return true;
11470
+ }
11454
11471
  const details = getSandboxErrorDetails(candidate);
11455
11472
  const searchable = `${details.searchableText} ${details.summary}`.toLowerCase();
11456
- return searchable.includes("sandbox_stopped") || searchable.includes("status=410") || searchable.includes("status code 410") || searchable.includes("no longer available");
11473
+ return searchable.includes("sandbox_stopped") || searchable.includes("status=410") || searchable.includes("status code 410") || searchable.includes("no longer available") || searchable.includes("stream was closed and is not accepting commands");
11457
11474
  });
11458
11475
  }
11459
11476
  function isSnapshottingError(error) {
@@ -15082,9 +15099,7 @@ function createResumeState(args) {
15082
15099
  }
15083
15100
  };
15084
15101
  }
15085
- throw new Error(
15086
- sessionRecord.errorMessage ?? (error instanceof Error ? error.message : String(error))
15087
- );
15102
+ throw new TurnSliceLimitExceededError(botConfig.maxSlicesPerTurn);
15088
15103
  }
15089
15104
  if (error instanceof AuthorizationPauseError) {
15090
15105
  const usage = args2.currentUsage ?? (resumeMessages.length > 0 ? extractSliceUsage(resumeMessages, beforeMessageCount) : void 0);
@@ -12,14 +12,14 @@ import {
12
12
  piMessageSchema,
13
13
  readSessionLogEntries,
14
14
  sanitizePostgresJson
15
- } from "./chunk-BCULHGZK.js";
15
+ } from "./chunk-XTKJPSMF.js";
16
16
  import {
17
17
  botConfig,
18
18
  escapeXml,
19
19
  getStateAdapter,
20
20
  resolveGatewayModel,
21
21
  unescapeXml
22
- } from "./chunk-M3UAVLEN.js";
22
+ } from "./chunk-4UYIRWDW.js";
23
23
  import {
24
24
  logWarn,
25
25
  setSpanAttributes
@@ -465,7 +465,7 @@ async function hydrateConversationMessages(args) {
465
465
  args.conversation.messages = [];
466
466
  return;
467
467
  }
468
- const { ensureLegacyConversationImport: ensureLegacyConversationImport2 } = await import("./legacy-import-G333RHJZ.js");
468
+ const { ensureLegacyConversationImport: ensureLegacyConversationImport2 } = await import("./legacy-import-TMJISRKO.js");
469
469
  await ensureLegacyConversationImport2({ conversationId: args.conversationId });
470
470
  await hydrateConversationCompactions({
471
471
  conversation: args.conversation,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-CEA3A3UA.js";
4
4
  import {
5
5
  normalizeSlackConversationId
6
- } from "./chunk-CCTCIISK.js";
6
+ } from "./chunk-3MPPVPGZ.js";
7
7
  import {
8
8
  parseSlackThreadId
9
9
  } from "./chunk-RT5BUHR5.js";
@@ -3,7 +3,7 @@ import {
3
3
  getConnectedStateContext,
4
4
  getStateAdapter,
5
5
  modelProfileSchema
6
- } from "./chunk-M3UAVLEN.js";
6
+ } from "./chunk-4UYIRWDW.js";
7
7
  import {
8
8
  juniorDestinations,
9
9
  timestamptz
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createPluginLogger,
3
3
  createPluginState
4
- } from "./chunk-4PDVOHXP.js";
4
+ } from "./chunk-AZ5OMSN5.js";
5
5
  import {
6
6
  SANDBOX_WORKSPACE_ROOT
7
7
  } from "./chunk-G3E7SCME.js";
@@ -10,15 +10,15 @@ import {
10
10
  isConversationScopedChannel,
11
11
  isDmChannel,
12
12
  normalizeSlackConversationId
13
- } from "./chunk-CCTCIISK.js";
13
+ } from "./chunk-3MPPVPGZ.js";
14
14
  import {
15
15
  getDb
16
- } from "./chunk-BCULHGZK.js";
16
+ } from "./chunk-XTKJPSMF.js";
17
17
  import {
18
18
  botConfig,
19
19
  completeObject,
20
20
  embedTexts
21
- } from "./chunk-M3UAVLEN.js";
21
+ } from "./chunk-4UYIRWDW.js";
22
22
  import {
23
23
  isActorUserId,
24
24
  logInfo,
package/dist/cli/chat.js CHANGED
@@ -1,24 +1,24 @@
1
1
  import {
2
2
  createAgentRunner,
3
3
  executeAgentRun
4
- } from "../chunk-NJJFU6CP.js";
5
- import "../chunk-RMZ65YAA.js";
4
+ } from "../chunk-GPPUTY5M.js";
5
+ import "../chunk-BKM4UXUD.js";
6
6
  import "../chunk-XIMUQ4IU.js";
7
- import "../chunk-7G4J3CR7.js";
8
- import "../chunk-QDKRE3LS.js";
9
- import "../chunk-RYDF4GOX.js";
7
+ import "../chunk-3NYUCBLE.js";
8
+ import "../chunk-DDRQ4U7I.js";
9
+ import "../chunk-P4P7O5WG.js";
10
10
  import "../chunk-PDO5BLNM.js";
11
11
  import "../chunk-UIE3R5XU.js";
12
12
  import {
13
13
  loadAppPluginSet
14
14
  } from "../chunk-Y2CM7HXH.js";
15
- import "../chunk-VDHMFCDY.js";
16
- import "../chunk-4PDVOHXP.js";
15
+ import "../chunk-ZMRLBBD5.js";
16
+ import "../chunk-AZ5OMSN5.js";
17
17
  import "../chunk-G3E7SCME.js";
18
- import "../chunk-CCTCIISK.js";
19
- import "../chunk-BCULHGZK.js";
18
+ import "../chunk-3MPPVPGZ.js";
19
+ import "../chunk-XTKJPSMF.js";
20
20
  import "../chunk-4ZNGQH7C.js";
21
- import "../chunk-M3UAVLEN.js";
21
+ import "../chunk-4UYIRWDW.js";
22
22
  import "../chunk-FXFQNHRU.js";
23
23
  import "../chunk-RT5BUHR5.js";
24
24
  import "../chunk-B7PUBQQM.js";
@@ -152,10 +152,10 @@ async function configureLocalChatPlugins(pluginSet) {
152
152
  databaseModule
153
153
  ] = await Promise.all([
154
154
  import("../plugins-PZMDS7AT.js"),
155
- import("../agent-hooks-EOFSY2PD.js"),
155
+ import("../agent-hooks-KR5BCWOK.js"),
156
156
  import("../catalog-runtime-5CVM2DOF.js"),
157
157
  import("../validation-EUI2UFRM.js"),
158
- import("../db-PDMC67T3.js")
158
+ import("../db-S33LFWG2.js")
159
159
  ]);
160
160
  const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
161
161
  const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
@@ -216,7 +216,7 @@ function newRunConversationId() {
216
216
  async function prepareLocalChatRun(io, pluginSet) {
217
217
  defaultStateAdapterForLocalChat();
218
218
  await configureLocalChatPlugins(pluginSet);
219
- const { runLocalAgentTurn } = await import("../runner-6A7MQRUE.js");
219
+ const { runLocalAgentTurn } = await import("../runner-HA5XAL6K.js");
220
220
  const deps = {
221
221
  agentRunner: createAgentRunner(executeAgentRun),
222
222
  deliverReply: async (reply) => {
@@ -13,17 +13,17 @@ import {
13
13
  import {
14
14
  setPlugins,
15
15
  validatePlugins
16
- } from "../chunk-VDHMFCDY.js";
16
+ } from "../chunk-ZMRLBBD5.js";
17
17
  import {
18
18
  createPluginLogger
19
- } from "../chunk-4PDVOHXP.js";
19
+ } from "../chunk-AZ5OMSN5.js";
20
20
  import "../chunk-G3E7SCME.js";
21
- import "../chunk-CCTCIISK.js";
21
+ import "../chunk-3MPPVPGZ.js";
22
22
  import {
23
23
  getDb
24
- } from "../chunk-BCULHGZK.js";
24
+ } from "../chunk-XTKJPSMF.js";
25
25
  import "../chunk-4ZNGQH7C.js";
26
- import "../chunk-M3UAVLEN.js";
26
+ import "../chunk-4UYIRWDW.js";
27
27
  import "../chunk-FXFQNHRU.js";
28
28
  import "../chunk-RT5BUHR5.js";
29
29
  import "../chunk-B7PUBQQM.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  GLOBAL_RUNTIME_DEPENDENCIES,
3
3
  resolveRuntimeDependencySnapshot
4
- } from "../chunk-7G4J3CR7.js";
4
+ } from "../chunk-3NYUCBLE.js";
5
5
  import "../chunk-G3E7SCME.js";
6
6
  import "../chunk-4ZNGQH7C.js";
7
7
  import {
8
8
  disconnectStateAdapter
9
- } from "../chunk-M3UAVLEN.js";
9
+ } from "../chunk-4UYIRWDW.js";
10
10
  import "../chunk-RT5BUHR5.js";
11
11
  import {
12
12
  pluginCatalogRuntime
@@ -4,7 +4,7 @@ import {
4
4
  recordConversationActivity,
5
5
  recordConversationExecution,
6
6
  requestConversationWork
7
- } from "../chunk-U26ZWZCN.js";
7
+ } from "../chunk-3OUSJPR7.js";
8
8
  import {
9
9
  defineJuniorPlugins,
10
10
  pluginCatalogConfigFromEnv,
@@ -18,10 +18,10 @@ import {
18
18
  import {
19
19
  addAgentTurnUsage,
20
20
  listAgentTurnSessionSummariesForConversations
21
- } from "../chunk-QDKRE3LS.js";
21
+ } from "../chunk-DDRQ4U7I.js";
22
22
  import {
23
23
  importConversationFromLegacy
24
- } from "../chunk-RYDF4GOX.js";
24
+ } from "../chunk-P4P7O5WG.js";
25
25
  import "../chunk-PDO5BLNM.js";
26
26
  import {
27
27
  loadAppPluginSet
@@ -29,18 +29,18 @@ import {
29
29
  import {
30
30
  createPluginLogger,
31
31
  createPluginState
32
- } from "../chunk-4PDVOHXP.js";
32
+ } from "../chunk-AZ5OMSN5.js";
33
33
  import {
34
34
  createJuniorSqlExecutor,
35
35
  createSqlConversationMessageStore,
36
36
  createSqlStore,
37
37
  getDb
38
- } from "../chunk-BCULHGZK.js";
38
+ } from "../chunk-XTKJPSMF.js";
39
39
  import {
40
40
  disconnectStateAdapter,
41
41
  getChatConfig,
42
42
  getConnectedStateContext
43
- } from "../chunk-M3UAVLEN.js";
43
+ } from "../chunk-4UYIRWDW.js";
44
44
  import "../chunk-FXFQNHRU.js";
45
45
  import "../chunk-RT5BUHR5.js";
46
46
  import {
@@ -6,8 +6,8 @@ import {
6
6
  getConversationStore,
7
7
  getDb,
8
8
  getSqlExecutor
9
- } from "./chunk-BCULHGZK.js";
10
- import "./chunk-M3UAVLEN.js";
9
+ } from "./chunk-XTKJPSMF.js";
10
+ import "./chunk-4UYIRWDW.js";
11
11
  import "./chunk-FXFQNHRU.js";
12
12
  import "./chunk-RT5BUHR5.js";
13
13
  import "./chunk-B7PUBQQM.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  ensureLegacyConversationImport,
3
3
  importConversationFromLegacy
4
- } from "./chunk-RYDF4GOX.js";
5
- import "./chunk-BCULHGZK.js";
6
- import "./chunk-M3UAVLEN.js";
4
+ } from "./chunk-P4P7O5WG.js";
5
+ import "./chunk-XTKJPSMF.js";
6
+ import "./chunk-4UYIRWDW.js";
7
7
  import "./chunk-FXFQNHRU.js";
8
8
  import "./chunk-RT5BUHR5.js";
9
9
  import "./chunk-B7PUBQQM.js";
@@ -3,7 +3,7 @@ import {
3
3
  finalizeFailedTurnReply,
4
4
  processPluginTask,
5
5
  scheduleSessionCompletedPluginTasks
6
- } from "./chunk-QVTVCJR4.js";
6
+ } from "./chunk-4W4O4DCV.js";
7
7
  import "./chunk-KNFROR7R.js";
8
8
  import {
9
9
  coerceThreadArtifactsState,
@@ -13,14 +13,14 @@ import {
13
13
  markTurnFailed,
14
14
  persistThreadStateById,
15
15
  startActiveTurn
16
- } from "./chunk-RMZ65YAA.js";
16
+ } from "./chunk-BKM4UXUD.js";
17
17
  import {
18
18
  coerceThreadConversationState
19
19
  } from "./chunk-XIMUQ4IU.js";
20
20
  import {
21
21
  commitMessages,
22
22
  loadProjection
23
- } from "./chunk-QDKRE3LS.js";
23
+ } from "./chunk-DDRQ4U7I.js";
24
24
  import {
25
25
  buildConversationContext,
26
26
  hydrateConversationMessages,
@@ -28,20 +28,20 @@ import {
28
28
  normalizeConversationText,
29
29
  updateConversationStats,
30
30
  upsertConversationMessage
31
- } from "./chunk-RYDF4GOX.js";
31
+ } from "./chunk-P4P7O5WG.js";
32
32
  import "./chunk-PDO5BLNM.js";
33
- import "./chunk-VDHMFCDY.js";
34
- import "./chunk-4PDVOHXP.js";
33
+ import "./chunk-ZMRLBBD5.js";
34
+ import "./chunk-AZ5OMSN5.js";
35
35
  import "./chunk-G3E7SCME.js";
36
- import "./chunk-CCTCIISK.js";
37
- import "./chunk-BCULHGZK.js";
36
+ import "./chunk-3MPPVPGZ.js";
37
+ import "./chunk-XTKJPSMF.js";
38
38
  import {
39
39
  sleep
40
40
  } from "./chunk-4ZNGQH7C.js";
41
41
  import {
42
42
  stripRuntimeTurnContext,
43
43
  trimTrailingAssistantMessages
44
- } from "./chunk-M3UAVLEN.js";
44
+ } from "./chunk-4UYIRWDW.js";
45
45
  import "./chunk-FXFQNHRU.js";
46
46
  import "./chunk-RT5BUHR5.js";
47
47
  import "./chunk-B7PUBQQM.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior",
3
- "version": "0.105.0",
3
+ "version": "0.106.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -75,7 +75,7 @@
75
75
  "pg": "^8.16.3",
76
76
  "yaml": "^2.9.0",
77
77
  "zod": "^4.4.3",
78
- "@sentry/junior-plugin-api": "0.105.0"
78
+ "@sentry/junior-plugin-api": "0.106.0"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@emnapi/core": "^1.10.0",
@@ -92,10 +92,10 @@
92
92
  "typescript": "^6.0.3",
93
93
  "vercel": "^54.4.0",
94
94
  "vitest": "^4.1.7",
95
- "@sentry/junior-testing": "0.0.0",
96
- "@sentry/junior-memory": "0.105.0",
97
- "@sentry/junior-scheduler": "0.105.0",
98
- "@sentry/junior-github": "0.105.0"
95
+ "@sentry/junior-github": "0.106.0",
96
+ "@sentry/junior-memory": "0.106.0",
97
+ "@sentry/junior-scheduler": "0.106.0",
98
+ "@sentry/junior-testing": "0.0.0"
99
99
  },
100
100
  "scripts": {
101
101
  "build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",