@sentry/junior 0.159.0 → 0.160.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 (64) hide show
  1. package/dist/{agent-hooks-IAD3AANZ.js → agent-hooks-U6R3O2V4.js} +10 -10
  2. package/dist/api/conversations/events.d.ts +1 -1
  3. package/dist/api/schema/conversation.d.ts +32 -0
  4. package/dist/api/schema.js +1 -1
  5. package/dist/api.js +32 -23
  6. package/dist/app.js +32 -32
  7. package/dist/{catalog-runtime-6VANKLH5.js → catalog-runtime-HIDNHGOP.js} +5 -5
  8. package/dist/chat/conversations/history.d.ts +31 -1
  9. package/dist/chat/conversations/projection.d.ts +13 -0
  10. package/dist/chat/slack/tools/send-files.d.ts +2 -2
  11. package/dist/chat/tool-support/action-review.d.ts +5 -4
  12. package/dist/chat/tools/search-conversation-events.d.ts +1 -1
  13. package/dist/{chunk-UP6KQVF5.js → chunk-2MK6S2UA.js} +1 -1
  14. package/dist/{chunk-CNHELV2P.js → chunk-2SFMRMDV.js} +1 -1
  15. package/dist/{chunk-UKKOKMRE.js → chunk-3AHIB66R.js} +5 -5
  16. package/dist/{chunk-YCBZ47LC.js → chunk-42E7432W.js} +1 -1
  17. package/dist/{chunk-UG673UVL.js → chunk-472VVYYV.js} +1 -1
  18. package/dist/{chunk-O2DZWUPQ.js → chunk-4UO3UAW7.js} +1 -1
  19. package/dist/{chunk-IJ6KWS3V.js → chunk-56TFPTZU.js} +1 -1
  20. package/dist/{chunk-X7AIXRVJ.js → chunk-756F567I.js} +5 -5
  21. package/dist/{chunk-PQWWCKNB.js → chunk-BGVQGEKB.js} +4 -4
  22. package/dist/{chunk-AIQKUJKK.js → chunk-FJR66CQT.js} +4 -4
  23. package/dist/{chunk-FWDN67U3.js → chunk-FKMWPA4A.js} +4 -4
  24. package/dist/{chunk-OGMHLKNO.js → chunk-HDPH4CHJ.js} +1 -1
  25. package/dist/{chunk-L2PEQ2PY.js → chunk-J77DLAPE.js} +2 -2
  26. package/dist/{chunk-QODFNKQS.js → chunk-JQZIUESN.js} +17 -3
  27. package/dist/{chunk-WTQ3CKC3.js → chunk-LNUZXEEI.js} +1 -1
  28. package/dist/{chunk-SQOVZSWF.js → chunk-M5HCOMDR.js} +88 -35
  29. package/dist/{chunk-YSMAMSOU.js → chunk-MBDWMEO6.js} +10 -10
  30. package/dist/{chunk-K2LAI7RW.js → chunk-OUAZDZTZ.js} +2 -2
  31. package/dist/{chunk-DJZPA72K.js → chunk-P7W3ZL5J.js} +6 -6
  32. package/dist/{chunk-AZW5HKC5.js → chunk-PVIM2RWO.js} +8 -8
  33. package/dist/{chunk-6IADZQJR.js → chunk-PZUJPPON.js} +1 -1
  34. package/dist/{chunk-NT6V5WEE.js → chunk-RJGRXDA7.js} +5 -5
  35. package/dist/{chunk-54O6IKUS.js → chunk-RLOXMHLA.js} +40 -4
  36. package/dist/{chunk-PT7B6A3O.js → chunk-TBRJGMTO.js} +1 -1
  37. package/dist/{chunk-DXSZJAVZ.js → chunk-TPFOVXRB.js} +18 -18
  38. package/dist/{chunk-EBP6IS66.js → chunk-U26KRMYX.js} +6 -6
  39. package/dist/{chunk-Q5X37U6G.js → chunk-UNDTW2PY.js} +1 -1
  40. package/dist/{chunk-NCJV265M.js → chunk-URPLKXLG.js} +9 -9
  41. package/dist/{chunk-EQXVKNLM.js → chunk-UYUS4L6F.js} +11 -0
  42. package/dist/{chunk-27UQ7UB3.js → chunk-WACYTIIK.js} +6 -6
  43. package/dist/{chunk-U7D4VLUF.js → chunk-XPX3DYG7.js} +2 -2
  44. package/dist/{chunk-LUIKMY35.js → chunk-YPMDNE7R.js} +1 -1
  45. package/dist/{chunk-TD7ZQZ5W.js → chunk-ZNBGWMVQ.js} +1 -1
  46. package/dist/cli/chat.js +30 -30
  47. package/dist/cli/check.js +6 -6
  48. package/dist/cli/plugins.js +13 -13
  49. package/dist/cli/snapshot-create.js +9 -9
  50. package/dist/cli/upgrade.js +7 -7
  51. package/dist/{db-BIIMAPFB.js → db-2JKT3BB5.js} +7 -7
  52. package/dist/instrumentation.js +4 -4
  53. package/dist/nitro.js +2 -2
  54. package/dist/{oauth-callback-server-4BENCPP3.js → oauth-callback-server-7MC2UMQC.js} +23 -23
  55. package/dist/{runner-TUBJLEYO.js → runner-GUU4G7XO.js} +13 -13
  56. package/dist/{skills-MBRLNBRV.js → skills-7NW5N3VM.js} +6 -6
  57. package/dist/spawn-WGK4W3XF.js +37 -0
  58. package/dist/{validation-YTJGRJYT.js → validation-AQLI6N2C.js} +6 -6
  59. package/dist/version.js +1 -1
  60. package/dist/{work-5MRHKA54.js → work-FLFK5XNU.js} +17 -17
  61. package/dist/worker-KSJIRBQJ.js +24 -0
  62. package/package.json +4 -4
  63. package/dist/spawn-ZWIXA46E.js +0 -37
  64. package/dist/worker-S2V7HZJ4.js +0 -24
@@ -9,7 +9,7 @@ export declare function createSearchConversationEventsTool(context: ToolRuntimeC
9
9
  after_seq?: number | null | undefined;
10
10
  before_seq?: number | null | undefined;
11
11
  limit?: number | null | undefined;
12
- types?: ("message" | "message_handled" | "assistant_message" | "turn_routed" | "guardian_action_reviewed" | "turn_context" | "structured_event" | "compaction" | "handoff" | "user_message" | "tool_result" | "mcp_provider_connected" | "mcp_provider_connected_unowned" | "authorization_requested" | "authorization_completed" | "tool_execution_started" | "message_updated" | "messages_summarized" | "turn_started" | "turn_completed" | "turn_failed" | "subagent_started" | "subagent_ended")[] | null | undefined;
12
+ types?: ("message" | "message_handled" | "assistant_message" | "turn_routed" | "guardian_action_reviewed" | "turn_context" | "structured_event" | "attachments_delivered" | "compaction" | "handoff" | "user_message" | "tool_result" | "mcp_provider_connected" | "mcp_provider_connected_unowned" | "authorization_requested" | "authorization_completed" | "tool_execution_started" | "message_updated" | "messages_summarized" | "turn_started" | "turn_completed" | "turn_failed" | "subagent_started" | "subagent_ended")[] | null | undefined;
13
13
  };
14
14
  execute?: ((input: unknown, options: import("./definition").ToolExecuteOptions) => {
15
15
  [x: string]: unknown;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createAndEnqueueAgentInvocation
3
- } from "./chunk-27UQ7UB3.js";
3
+ } from "./chunk-WACYTIIK.js";
4
4
  import {
5
5
  actorFromRun,
6
6
  toolInvocationDestination
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createPluginCatalogRuntime
3
- } from "./chunk-YCBZ47LC.js";
3
+ } from "./chunk-42E7432W.js";
4
4
 
5
5
  // src/chat/plugins/catalog-runtime.ts
6
6
  var pluginCatalogRuntime = createPluginCatalogRuntime();
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  persistConversationMessages
3
- } from "./chunk-54O6IKUS.js";
3
+ } from "./chunk-RLOXMHLA.js";
4
4
  import {
5
5
  JUNIOR_THREAD_STATE_TTL_MS
6
6
  } from "./chunk-3Y47VMHV.js";
7
7
  import {
8
8
  getDb
9
- } from "./chunk-QODFNKQS.js";
9
+ } from "./chunk-JQZIUESN.js";
10
10
  import {
11
11
  juniorLocationConfigurations
12
- } from "./chunk-O2DZWUPQ.js";
12
+ } from "./chunk-4UO3UAW7.js";
13
13
  import {
14
14
  getStateAdapter
15
- } from "./chunk-Q5X37U6G.js";
15
+ } from "./chunk-UNDTW2PY.js";
16
16
  import {
17
17
  juniorDestinations
18
18
  } from "./chunk-VFUK3X5B.js";
@@ -20,7 +20,7 @@ import {
20
20
  isRecord,
21
21
  toOptionalNumber,
22
22
  toOptionalString
23
- } from "./chunk-TD7ZQZ5W.js";
23
+ } from "./chunk-ZNBGWMVQ.js";
24
24
 
25
25
  // src/chat/conversations/turn-lifecycle.ts
26
26
  var ConversationTurnLifecycleService = class {
@@ -5,7 +5,7 @@ import {
5
5
  logInfo,
6
6
  logWarn,
7
7
  setSpanAttributes
8
- } from "./chunk-TD7ZQZ5W.js";
8
+ } from "./chunk-ZNBGWMVQ.js";
9
9
  import {
10
10
  discoverInstalledPluginPackageContent,
11
11
  normalizePluginPackageNames
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getStateAdapter
3
- } from "./chunk-Q5X37U6G.js";
3
+ } from "./chunk-UNDTW2PY.js";
4
4
  import {
5
5
  getClient
6
6
  } from "./chunk-6GWA276C.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_SQL_STATEMENT_TIMEOUT_MS
3
- } from "./chunk-L2PEQ2PY.js";
3
+ } from "./chunk-J77DLAPE.js";
4
4
  import {
5
5
  juniorDestinations,
6
6
  timestamptz
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-V7YE4WCP.js";
6
6
  import {
7
7
  toOptionalString
8
- } from "./chunk-TD7ZQZ5W.js";
8
+ } from "./chunk-ZNBGWMVQ.js";
9
9
 
10
10
  // src/chat/slack/context.ts
11
11
  import { z } from "zod";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  formatProviderLabel,
6
6
  startOAuthFlow
7
- } from "./chunk-DJZPA72K.js";
7
+ } from "./chunk-P7W3ZL5J.js";
8
8
  import {
9
9
  parseSandboxEgressAuthRequiredSignal
10
10
  } from "./chunk-7MA4HV4W.js";
@@ -12,16 +12,16 @@ import {
12
12
  abandonReplacedPendingAuth,
13
13
  canReusePendingAuthLink,
14
14
  recordAuthorizationRequested
15
- } from "./chunk-54O6IKUS.js";
15
+ } from "./chunk-RLOXMHLA.js";
16
16
  import {
17
17
  AGENT_INVOCATION_MAILBOX_STATUSES
18
- } from "./chunk-O2DZWUPQ.js";
18
+ } from "./chunk-4UO3UAW7.js";
19
19
  import {
20
20
  TURN_REASONING_LEVELS
21
- } from "./chunk-L2PEQ2PY.js";
21
+ } from "./chunk-J77DLAPE.js";
22
22
  import {
23
23
  pluginCatalogRuntime
24
- } from "./chunk-CNHELV2P.js";
24
+ } from "./chunk-2SFMRMDV.js";
25
25
  import {
26
26
  credentialContextSchema
27
27
  } from "./chunk-BDUENQD3.js";
@@ -4,18 +4,18 @@ import {
4
4
  } from "./chunk-EM225ITJ.js";
5
5
  import {
6
6
  getStateAdapter
7
- } from "./chunk-Q5X37U6G.js";
7
+ } from "./chunk-UNDTW2PY.js";
8
8
  import {
9
9
  toOptionalTrimmed
10
- } from "./chunk-L2PEQ2PY.js";
10
+ } from "./chunk-J77DLAPE.js";
11
11
  import {
12
12
  pluginCatalogRuntime
13
- } from "./chunk-CNHELV2P.js";
13
+ } from "./chunk-2SFMRMDV.js";
14
14
  import {
15
15
  setSpanAttributes,
16
16
  setSpanStatus,
17
17
  withSpan
18
- } from "./chunk-TD7ZQZ5W.js";
18
+ } from "./chunk-ZNBGWMVQ.js";
19
19
 
20
20
  // src/chat/sandbox/resources.ts
21
21
  var configuredResources;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getTurnRequestDeadline
3
- } from "./chunk-WTQ3CKC3.js";
3
+ } from "./chunk-LNUZXEEI.js";
4
4
  import {
5
5
  CONVERSATION_WORK_CHECK_IN_INTERVAL_MS,
6
6
  CONVERSATION_WORK_MAX_RETRIES,
@@ -21,20 +21,20 @@ import {
21
21
  releaseConversationWork,
22
22
  requestAnotherSlice,
23
23
  startConversationWork
24
- } from "./chunk-FWDN67U3.js";
24
+ } from "./chunk-FKMWPA4A.js";
25
25
  import {
26
26
  ConversationQueueMessageRejectedError
27
27
  } from "./chunk-JAL3CH4G.js";
28
28
  import {
29
29
  getChatConfig,
30
30
  isProviderRetryError
31
- } from "./chunk-L2PEQ2PY.js";
31
+ } from "./chunk-J77DLAPE.js";
32
32
  import {
33
33
  logException,
34
34
  logInfo,
35
35
  logWarn,
36
36
  withLogContext
37
- } from "./chunk-TD7ZQZ5W.js";
37
+ } from "./chunk-ZNBGWMVQ.js";
38
38
 
39
39
  // src/chat/task-execution/worker.ts
40
40
  var CONVERSATION_WORK_DEFER_DELAY_MS = 15e3;
@@ -8,14 +8,14 @@ import {
8
8
  getConversationStore,
9
9
  parseDestination,
10
10
  sameDestination
11
- } from "./chunk-QODFNKQS.js";
11
+ } from "./chunk-JQZIUESN.js";
12
12
  import {
13
13
  getDefaultRedisStateAdapterFor,
14
14
  getStateAdapter
15
- } from "./chunk-Q5X37U6G.js";
15
+ } from "./chunk-UNDTW2PY.js";
16
16
  import {
17
17
  getChatConfig
18
- } from "./chunk-L2PEQ2PY.js";
18
+ } from "./chunk-J77DLAPE.js";
19
19
  import {
20
20
  parseStoredSlackActor
21
21
  } from "./chunk-V7YE4WCP.js";
@@ -23,7 +23,7 @@ import {
23
23
  isRecord,
24
24
  toOptionalNumber,
25
25
  toOptionalString
26
- } from "./chunk-TD7ZQZ5W.js";
26
+ } from "./chunk-ZNBGWMVQ.js";
27
27
 
28
28
  // src/chat/task-execution/state.ts
29
29
  import { randomUUID } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  JUNIOR_VERSION
3
- } from "./chunk-LUIKMY35.js";
3
+ } from "./chunk-YPMDNE7R.js";
4
4
 
5
5
  // src/deployment.ts
6
6
  var JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";
@@ -3,7 +3,7 @@ import {
3
3
  toCanonicalInputMessage,
4
4
  toCanonicalOutputMessage,
5
5
  toGenAiMessagesTraceAttributes
6
- } from "./chunk-PT7B6A3O.js";
6
+ } from "./chunk-TBRJGMTO.js";
7
7
  import {
8
8
  extractGenAiUsageAttributes,
9
9
  logException,
@@ -11,7 +11,7 @@ import {
11
11
  normalizeGenAiFinishReason,
12
12
  serializeGenAiAttribute,
13
13
  withSpan
14
- } from "./chunk-TD7ZQZ5W.js";
14
+ } from "./chunk-ZNBGWMVQ.js";
15
15
 
16
16
  // src/chat/services/provider-error.ts
17
17
  var ProviderError = class extends Error {
@@ -6,12 +6,12 @@ import {
6
6
  juniorConversations,
7
7
  juniorIdentities,
8
8
  juniorUsers
9
- } from "./chunk-O2DZWUPQ.js";
9
+ } from "./chunk-4UO3UAW7.js";
10
10
  import {
11
11
  TURN_REASONING_LEVELS,
12
12
  getChatConfig,
13
13
  modelProfileSchema
14
- } from "./chunk-L2PEQ2PY.js";
14
+ } from "./chunk-J77DLAPE.js";
15
15
  import {
16
16
  juniorDestinations
17
17
  } from "./chunk-VFUK3X5B.js";
@@ -22,7 +22,7 @@ import {
22
22
  } from "./chunk-V7YE4WCP.js";
23
23
  import {
24
24
  normalizeIdentityEmail
25
- } from "./chunk-TD7ZQZ5W.js";
25
+ } from "./chunk-ZNBGWMVQ.js";
26
26
 
27
27
  // src/chat/conversations/sql/store.ts
28
28
  import { randomUUID as randomUUID2 } from "crypto";
@@ -1266,6 +1266,18 @@ var structuredConversationEventDataSchema = z3.object({
1266
1266
  turnId: z3.string().min(1).optional(),
1267
1267
  content: z3.record(z3.string(), z3.unknown())
1268
1268
  }).strict();
1269
+ var deliveredAttachmentSchema = z3.object({
1270
+ id: z3.string().min(1),
1271
+ filename: z3.string().min(1),
1272
+ contentType: z3.string().min(1),
1273
+ bytes: z3.number().int().nonnegative()
1274
+ }).strict();
1275
+ var attachmentsDeliveredEventDataSchema = z3.object({
1276
+ type: z3.literal("attachments_delivered"),
1277
+ attachments: z3.array(deliveredAttachmentSchema).min(1),
1278
+ toolCallId: z3.string().min(1).optional(),
1279
+ turnId: z3.string().min(1).optional()
1280
+ }).strict();
1269
1281
  var turnCompletedEventDataSchema = z3.object({
1270
1282
  type: z3.literal("turn_completed"),
1271
1283
  turnId: z3.string().min(1),
@@ -1310,6 +1322,7 @@ var appendableConversationEventDataSchema = z3.union([
1310
1322
  turnStartedEventDataSchema,
1311
1323
  turnContextEventDataSchema,
1312
1324
  structuredConversationEventDataSchema,
1325
+ attachmentsDeliveredEventDataSchema,
1313
1326
  turnRoutedEventDataSchema,
1314
1327
  turnCompletedEventDataSchema,
1315
1328
  turnFailedEventDataSchema,
@@ -1338,6 +1351,7 @@ var KNOWN_CONVERSATION_EVENT_TYPES = [
1338
1351
  "turn_started",
1339
1352
  "turn_context",
1340
1353
  "structured_event",
1354
+ "attachments_delivered",
1341
1355
  "turn_routed",
1342
1356
  "turn_completed",
1343
1357
  "turn_failed",
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  FUNCTION_TIMEOUT_BUFFER_SECONDS,
3
3
  getChatConfig
4
- } from "./chunk-L2PEQ2PY.js";
4
+ } from "./chunk-J77DLAPE.js";
5
5
 
6
6
  // src/chat/runtime/request-deadline.ts
7
7
  import { AsyncLocalStorage } from "async_hooks";
@@ -7,7 +7,7 @@ import {
7
7
  PluginCredentialFailureError,
8
8
  agentNameSchema,
9
9
  createPluginAuthOrchestration
10
- } from "./chunk-X7AIXRVJ.js";
10
+ } from "./chunk-756F567I.js";
11
11
  import {
12
12
  authorizationId
13
13
  } from "./chunk-DIB4GX3G.js";
@@ -32,7 +32,7 @@ import {
32
32
  searchSlackUsers,
33
33
  selectPluginGrant,
34
34
  toMcpProviderError
35
- } from "./chunk-AZW5HKC5.js";
35
+ } from "./chunk-PVIM2RWO.js";
36
36
  import {
37
37
  RetryableDeliveryError,
38
38
  actorFromRun,
@@ -48,7 +48,7 @@ import {
48
48
  getSlackMessagePermalink,
49
49
  resolveBaseUrl,
50
50
  uploadFilesToConversation
51
- } from "./chunk-DJZPA72K.js";
51
+ } from "./chunk-P7W3ZL5J.js";
52
52
  import {
53
53
  parseSandboxEgressAuthRequiredSignal,
54
54
  parseSandboxEgressPermissionDeniedSignal,
@@ -74,7 +74,7 @@ import {
74
74
  runNonInteractiveCommand,
75
75
  throwSandboxOperationError,
76
76
  wrapSandboxSetupError
77
- } from "./chunk-PQWWCKNB.js";
77
+ } from "./chunk-BGVQGEKB.js";
78
78
  import {
79
79
  SCHEDULED_TASK_SYSTEM_ACTOR,
80
80
  compactEventTask,
@@ -107,10 +107,10 @@ import {
107
107
  scheduledTaskAttributes,
108
108
  storeAttachments,
109
109
  writableEventTask
110
- } from "./chunk-NT6V5WEE.js";
110
+ } from "./chunk-RJGRXDA7.js";
111
111
  import {
112
112
  parseSlackThreadId
113
- } from "./chunk-IJ6KWS3V.js";
113
+ } from "./chunk-56TFPTZU.js";
114
114
  import {
115
115
  AGENTS_REMOVAL_NOTICE,
116
116
  AGENTS_REPLACEMENT_NOTICE,
@@ -165,6 +165,7 @@ import {
165
165
  piMessageFromHistoryItem,
166
166
  positiveInteger,
167
167
  recordAgentsInstructionsUpdated,
168
+ recordAttachmentsDelivered,
168
169
  recordAuthorizationRequested,
169
170
  recordGuardianActionReviewed,
170
171
  recordMcpProviderConnected,
@@ -180,7 +181,7 @@ import {
180
181
  stripRuntimeTurnContext,
181
182
  trimTrailingAssistantMessages,
182
183
  truncateText
183
- } from "./chunk-54O6IKUS.js";
184
+ } from "./chunk-RLOXMHLA.js";
184
185
  import {
185
186
  JUNIOR_THREAD_STATE_TTL_MS
186
187
  } from "./chunk-3Y47VMHV.js";
@@ -196,7 +197,7 @@ import {
196
197
  getSlackToolContext,
197
198
  readActorIdentity,
198
199
  resolveChannelCapabilities
199
- } from "./chunk-EBP6IS66.js";
200
+ } from "./chunk-U26KRMYX.js";
200
201
  import {
201
202
  SlackActionError,
202
203
  downloadPrivateSlackFile,
@@ -205,7 +206,7 @@ import {
205
206
  isConversationScopedChannel,
206
207
  normalizeSlackConversationId,
207
208
  withSlackRetries
208
- } from "./chunk-K2LAI7RW.js";
209
+ } from "./chunk-OUAZDZTZ.js";
209
210
  import {
210
211
  KNOWN_CONVERSATION_EVENT_TYPES,
211
212
  contextProvenance,
@@ -217,10 +218,10 @@ import {
217
218
  instructionActors,
218
219
  instructionProvenanceFor,
219
220
  sameActorIdentity
220
- } from "./chunk-QODFNKQS.js";
221
+ } from "./chunk-JQZIUESN.js";
221
222
  import {
222
223
  juniorIdentities
223
- } from "./chunk-O2DZWUPQ.js";
224
+ } from "./chunk-4UO3UAW7.js";
224
225
  import {
225
226
  SANDBOX_DATA_ROOT,
226
227
  SANDBOX_SKILLS_ROOT,
@@ -232,7 +233,7 @@ import {
232
233
  } from "./chunk-EM225ITJ.js";
233
234
  import {
234
235
  getStateAdapter
235
- } from "./chunk-Q5X37U6G.js";
236
+ } from "./chunk-UNDTW2PY.js";
236
237
  import {
237
238
  ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX,
238
239
  COMPACTION_SUMMARY_PREFIX,
@@ -265,7 +266,7 @@ import {
265
266
  resolveGatewayCredential,
266
267
  resolveGatewayModel,
267
268
  unwrapCurrentInstruction
268
- } from "./chunk-L2PEQ2PY.js";
269
+ } from "./chunk-J77DLAPE.js";
269
270
  import {
270
271
  canExposeConversationPayload,
271
272
  resolveConversationPrivacy,
@@ -275,16 +276,16 @@ import {
275
276
  toGenAiMessagesTraceAttributes,
276
277
  toGenAiPayloadMetadata,
277
278
  toGenAiPayloadTraceAttributes
278
- } from "./chunk-PT7B6A3O.js";
279
+ } from "./chunk-TBRJGMTO.js";
279
280
  import {
280
281
  discoverSkills,
281
282
  findSkillByName,
282
283
  loadSkillsByName,
283
284
  parseSkillInvocation
284
- } from "./chunk-U7D4VLUF.js";
285
+ } from "./chunk-XPX3DYG7.js";
285
286
  import {
286
287
  pluginCatalogRuntime
287
- } from "./chunk-CNHELV2P.js";
288
+ } from "./chunk-2SFMRMDV.js";
288
289
  import {
289
290
  CredentialUnavailableError,
290
291
  OAuthProviderError,
@@ -292,7 +293,7 @@ import {
292
293
  getOAuthProviderErrorAttributes,
293
294
  resolveAuthTokenPlaceholder,
294
295
  resolvePluginCommandEnv
295
- } from "./chunk-YCBZ47LC.js";
296
+ } from "./chunk-42E7432W.js";
296
297
  import {
297
298
  credentialUserSubjectId
298
299
  } from "./chunk-BDUENQD3.js";
@@ -320,7 +321,7 @@ import {
320
321
  summarizeMessageText,
321
322
  withLogContext,
322
323
  withSpan
323
- } from "./chunk-TD7ZQZ5W.js";
324
+ } from "./chunk-ZNBGWMVQ.js";
324
325
  import {
325
326
  startInactiveSpan,
326
327
  withActiveSpan
@@ -10545,7 +10546,8 @@ var sendFilesResultSchema = juniorToolOutputSchema.extend({
10545
10546
  attachment_refs: z42.array(
10546
10547
  z42.object({
10547
10548
  id: z42.string().min(1),
10548
- name: z42.string().min(1)
10549
+ // Same noun as storage, delivery events, and the report API.
10550
+ filename: z42.string().min(1)
10549
10551
  })
10550
10552
  )
10551
10553
  });
@@ -10583,7 +10585,7 @@ function createSendFilesTool(context, state, materializeFile, attachments) {
10583
10585
  )
10584
10586
  }),
10585
10587
  outputSchema: sendFilesResultSchema,
10586
- execute: async ({ files }) => {
10588
+ execute: async ({ files }, options) => {
10587
10589
  const filesToSend = normalizeFiles(files);
10588
10590
  const activeChannelId = context.sourceChannelId;
10589
10591
  if (!activeChannelId) {
@@ -10605,8 +10607,15 @@ function createSendFilesTool(context, state, materializeFile, attachments) {
10605
10607
  });
10606
10608
  const cached = state.getOperationResult(operationKey);
10607
10609
  if (cached) {
10610
+ if (attachments && cached.delivered.length > 0) {
10611
+ await recordAttachmentsDelivered({
10612
+ attachments: cached.delivered,
10613
+ conversationId: attachments.conversationId,
10614
+ ...cached.toolCallId ? { toolCallId: cached.toolCallId } : {}
10615
+ });
10616
+ }
10608
10617
  return sendFilesResultSchema.parse({
10609
- ...cached,
10618
+ ...cached.result,
10610
10619
  deduplicated: true
10611
10620
  });
10612
10621
  }
@@ -10625,13 +10634,36 @@ function createSendFilesTool(context, state, materializeFile, attachments) {
10625
10634
  files: uploads,
10626
10635
  threadTs
10627
10636
  });
10637
+ const delivered = stored.map(
10638
+ (attachment, index) => {
10639
+ const file = materializedFiles[index];
10640
+ return {
10641
+ id: attachment.id,
10642
+ filename: file.filename,
10643
+ contentType: file.mimeType,
10644
+ bytes: file.bytes
10645
+ };
10646
+ }
10647
+ );
10628
10648
  const response = {
10629
- attachment_refs: stored.map((attachment, index) => ({
10649
+ // Tool result stays minimal; transcript/report carries full metadata.
10650
+ attachment_refs: delivered.map((attachment) => ({
10630
10651
  id: attachment.id,
10631
- name: materializedFiles[index].filename
10652
+ filename: attachment.filename
10632
10653
  }))
10633
10654
  };
10634
- state.setOperationResult(operationKey, response);
10655
+ state.setOperationResult(operationKey, {
10656
+ delivered,
10657
+ result: response,
10658
+ ...options.toolCallId ? { toolCallId: options.toolCallId } : {}
10659
+ });
10660
+ if (attachments && delivered.length > 0) {
10661
+ await recordAttachmentsDelivered({
10662
+ attachments: delivered,
10663
+ conversationId: attachments.conversationId,
10664
+ ...options.toolCallId ? { toolCallId: options.toolCallId } : {}
10665
+ });
10666
+ }
10635
10667
  return response;
10636
10668
  }
10637
10669
  });
@@ -13519,6 +13551,9 @@ function buildSandboxInput(toolName, params) {
13519
13551
  import { PluginToolInputError } from "@sentry/junior-plugin-api";
13520
13552
 
13521
13553
  // src/chat/tool-support/action-review.ts
13554
+ import {
13555
+ missingToolAnnotationKeys as missingToolAnnotationKeys2
13556
+ } from "@sentry/junior-plugin-api";
13522
13557
  var ACTION_CONFIRMATION_INSTRUCTIONS = [
13523
13558
  "The action was not executed because explicit user confirmation is required.",
13524
13559
  "Stop tool use for this turn and respond to the user now with a direct, concise confirmation question that names the exact action, target, and material side effects.",
@@ -13531,6 +13566,13 @@ var ACTION_DENIAL_INSTRUCTIONS = [
13531
13566
  "If the reason is missing or withheld authorization and exact confirmation could make the action allowable, stop tool use for this turn and respond to the user now with a direct, concise confirmation question that names the exact action, target, and material side effects.",
13532
13567
  "Proceed only with a materially safer alternative. Otherwise, stop and explain the specific risk to the user without mentioning Guardian or internal review mechanics."
13533
13568
  ].join("\n");
13569
+ var ACTION_REVIEW_LIMIT_INSTRUCTIONS = [
13570
+ "This action was rejected due to unacceptable risk.",
13571
+ "Action review rejected three consecutive tool execution attempts.",
13572
+ "Do not retry this action or an equivalent write this turn.",
13573
+ "Stop tool use for this turn and respond to the user now with a direct, concise explanation of the risk.",
13574
+ "Do not mention Guardian, the runtime, policy, or internal review mechanics."
13575
+ ].join("\n");
13534
13576
  var ToolActionRejectedError = class extends Error {
13535
13577
  decision;
13536
13578
  reason;
@@ -13538,11 +13580,9 @@ var ToolActionRejectedError = class extends Error {
13538
13580
  riskLevel;
13539
13581
  userAuthorization;
13540
13582
  constructor(decision, reason, assessment = {}) {
13541
- super(
13542
- decision === "ask" ? `${ACTION_CONFIRMATION_INSTRUCTIONS}
13543
- Reason: ${reason}` : `${ACTION_DENIAL_INSTRUCTIONS}
13544
- Reason: ${reason}`
13545
- );
13583
+ const instructions = assessment.instructions ?? (decision === "ask" ? ACTION_CONFIRMATION_INSTRUCTIONS : ACTION_DENIAL_INSTRUCTIONS);
13584
+ super(`${instructions}
13585
+ Reason: ${reason}`);
13546
13586
  this.name = "ToolActionRejectedError";
13547
13587
  this.decision = decision;
13548
13588
  this.reason = reason;
@@ -13565,7 +13605,7 @@ var ToolActionReviewUnavailableError = class extends Error {
13565
13605
  var ToolActionReviewLimitError = class extends Error {
13566
13606
  constructor() {
13567
13607
  super(
13568
- "Action review rejected three consecutive tool execution attempts; the run was interrupted."
13608
+ "Action review rejected three consecutive tool execution attempts."
13569
13609
  );
13570
13610
  this.name = "ToolActionReviewLimitError";
13571
13611
  }
@@ -13582,6 +13622,9 @@ function effectiveApprovalMode(tool, resolved) {
13582
13622
  return "review";
13583
13623
  }
13584
13624
  const annotations = resolved?.annotations ?? tool.annotations;
13625
+ if (missingToolAnnotationKeys2(annotations).length > 0) {
13626
+ return "review";
13627
+ }
13585
13628
  if (annotations?.destructiveHint === true || annotations?.openWorldHint === true || annotations?.readOnlyHint === false) {
13586
13629
  return "review";
13587
13630
  }
@@ -13782,10 +13825,19 @@ function createToolActionReview(options) {
13782
13825
  const reviewedAction = projectedRejection(proposal, decision);
13783
13826
  appendVisibleRejection(priorRejections, reviewedAction);
13784
13827
  consecutiveRejections += 1;
13785
- if (consecutiveRejections >= MAX_CONSECUTIVE_REJECTIONS) {
13786
- const limitError = new ToolActionReviewLimitError();
13787
- options.onFatal(limitError);
13788
- throw limitError;
13828
+ const exhausted = consecutiveRejections >= MAX_CONSECUTIVE_REJECTIONS;
13829
+ if (exhausted) {
13830
+ logException(
13831
+ new ToolActionReviewLimitError(),
13832
+ "guardian.action_review.exhausted",
13833
+ {
13834
+ "app.guardian.decision": decision.decision,
13835
+ "app.guardian.risk_level": decision.riskLevel,
13836
+ "app.guardian.user_authorization": decision.userAuthorization,
13837
+ "gen_ai.tool.name": proposal.tool.name,
13838
+ "gen_ai.tool.call.id": toolCallId
13839
+ }
13840
+ );
13789
13841
  }
13790
13842
  pendingRejections.set(toolCallId, {
13791
13843
  decision: decision.decision,
@@ -13798,7 +13850,8 @@ function createToolActionReview(options) {
13798
13850
  throw new ToolActionRejectedError(decision.decision, decision.reason, {
13799
13851
  riskLevel: decision.riskLevel,
13800
13852
  reviewedAction,
13801
- userAuthorization: decision.userAuthorization
13853
+ userAuthorization: decision.userAuthorization,
13854
+ ...exhausted ? { instructions: ACTION_REVIEW_LIMIT_INSTRUCTIONS } : {}
13802
13855
  });
13803
13856
  },
13804
13857
  projectToolResult(toolCallId, result) {