@sentry/junior 0.147.0 → 0.149.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 (162) hide show
  1. package/dist/{agent-hooks-HS6VGUPM.js → agent-hooks-CWMCXAMT.js} +10 -10
  2. package/dist/api/conversations/access.d.ts +2 -1
  3. package/dist/api/conversations/aggregate.d.ts +2 -0
  4. package/dist/api/conversations/archive.d.ts +3 -5
  5. package/dist/api/conversations/create.d.ts +6 -0
  6. package/dist/api/conversations/detail.d.ts +2 -296
  7. package/dist/api/conversations/event-list.d.ts +2 -193
  8. package/dist/api/conversations/list.d.ts +4 -66
  9. package/dist/api/conversations/pending-messages.d.ts +15 -0
  10. package/dist/api/conversations/routes.d.ts +1 -1
  11. package/dist/api/conversations/stats.d.ts +0 -54
  12. package/dist/api/http.d.ts +2 -6
  13. package/dist/api/locations/detail.d.ts +3 -111
  14. package/dist/api/locations/list.d.ts +0 -45
  15. package/dist/api/locations/query.d.ts +2 -1
  16. package/dist/api/locations/routes.d.ts +1 -1
  17. package/dist/api/people/list.d.ts +0 -29
  18. package/dist/api/people/profile.d.ts +2 -106
  19. package/dist/api/people/profile.query.d.ts +2 -1
  20. package/dist/api/people/routes.d.ts +1 -1
  21. package/dist/api/people/shared.d.ts +3 -1
  22. package/dist/api/people/spend.d.ts +3 -4
  23. package/dist/api/personal-tokens/routes.d.ts +2 -2
  24. package/dist/api/route.d.ts +8 -14
  25. package/dist/api/schema/conversation.d.ts +130 -25
  26. package/dist/api/schema/location.d.ts +4 -0
  27. package/dist/api/schema/person.d.ts +7 -3
  28. package/dist/api/schema.d.ts +2 -2
  29. package/dist/api/schema.js +13 -1
  30. package/dist/api/stats.d.ts +0 -13
  31. package/dist/api/validation.d.ts +7 -0
  32. package/dist/api/viewer.d.ts +3 -0
  33. package/dist/api.d.ts +2 -1
  34. package/dist/api.js +772 -561
  35. package/dist/app.js +241 -204
  36. package/dist/{catalog-runtime-M6ZTPYRV.js → catalog-runtime-GAW5APVI.js} +5 -5
  37. package/dist/chat/actor.d.ts +4 -1
  38. package/dist/chat/agent/request.d.ts +2 -0
  39. package/dist/chat/agent/resume.d.ts +1 -0
  40. package/dist/chat/agent-dispatch/context.d.ts +2 -2
  41. package/dist/chat/agent-invocations/types.d.ts +52 -0
  42. package/dist/chat/api-turns/work.d.ts +108 -0
  43. package/dist/chat/app/services.d.ts +1 -1
  44. package/dist/chat/conversations/history.d.ts +60 -0
  45. package/dist/chat/conversations/provenance.d.ts +6 -0
  46. package/dist/chat/conversations/sql/actor-identity.d.ts +19 -0
  47. package/dist/chat/conversations/store.d.ts +1 -1
  48. package/dist/chat/resource-events/store.d.ts +1 -1
  49. package/dist/chat/runtime/reply-executor.d.ts +1 -3
  50. package/dist/chat/runtime/slack-runtime.d.ts +2 -1
  51. package/dist/chat/runtime/turn-preparation.d.ts +9 -0
  52. package/dist/chat/scheduled-tasks/tool-support.d.ts +5 -5
  53. package/dist/chat/scheduled-tasks/tools/create.d.ts +2 -2
  54. package/dist/chat/scheduled-tasks/tools/delete.d.ts +2 -2
  55. package/dist/chat/scheduled-tasks/tools/list.d.ts +2 -2
  56. package/dist/chat/scheduled-tasks/tools/run-now.d.ts +2 -2
  57. package/dist/chat/scheduled-tasks/tools/update.d.ts +2 -2
  58. package/dist/chat/services/conversation-memory.d.ts +2 -2
  59. package/dist/chat/services/conversation-title.d.ts +20 -0
  60. package/dist/chat/slack/assistant-thread/title.d.ts +10 -27
  61. package/dist/chat/slack/channel.d.ts +26 -0
  62. package/dist/chat/slack/dispatch-turn.d.ts +1 -0
  63. package/dist/chat/slack/timestamp-param.d.ts +0 -2
  64. package/dist/chat/slack/{tools → tool-support}/canvas/api.d.ts +1 -1
  65. package/dist/chat/slack/{tools → tool-support}/canvas/context.d.ts +3 -0
  66. package/dist/chat/slack/tool-support/channel-access.d.ts +42 -0
  67. package/dist/chat/slack/tool-support/channel-target.d.ts +27 -0
  68. package/dist/chat/slack/tool-support/list/params.d.ts +5 -0
  69. package/dist/chat/slack/tools/canvas/create.d.ts +1 -1
  70. package/dist/chat/slack/tools/channel-join.d.ts +28 -0
  71. package/dist/chat/slack/tools/channel-list-messages.d.ts +3 -2
  72. package/dist/chat/slack/tools/conversation-message-search.d.ts +2 -8
  73. package/dist/chat/slack/tools/message-add-reaction.d.ts +1 -1
  74. package/dist/chat/slack/tools/public-search.d.ts +63 -2
  75. package/dist/chat/slack/tools/send-files.d.ts +1 -1
  76. package/dist/chat/slack/tools/thread-read.d.ts +2 -5
  77. package/dist/chat/source.d.ts +2 -0
  78. package/dist/chat/state/conversation.d.ts +1 -0
  79. package/dist/chat/task-execution/checkpoint.d.ts +1 -0
  80. package/dist/chat/task-execution/state.d.ts +9 -4
  81. package/dist/chat/task-execution/store.d.ts +3 -2
  82. package/dist/chat/task-execution/turn-cursor.d.ts +2 -0
  83. package/dist/chat/task-execution/worker.d.ts +2 -0
  84. package/dist/chat/tasks/read.d.ts +1 -1
  85. package/dist/chat/tools/search-conversation-events.d.ts +1 -1
  86. package/dist/chat/tools/types.d.ts +11 -4
  87. package/dist/chat/tools/watch-resource-events.d.ts +2 -2
  88. package/dist/{chunk-ORO3PWKQ.js → chunk-25SC7D6Z.js} +1 -1
  89. package/dist/{chunk-GGB4WL5A.js → chunk-2JHKISQA.js} +1 -1
  90. package/dist/{chunk-AVZDSUFB.js → chunk-2P6BQQER.js} +4 -4
  91. package/dist/{chunk-7NVJVJID.js → chunk-32CXPIZE.js} +2 -2
  92. package/dist/{chunk-YSB2N563.js → chunk-3GYZ5YEH.js} +121 -87
  93. package/dist/{chunk-DU74WPIC.js → chunk-3I2IVWSZ.js} +1 -1
  94. package/dist/{chunk-SVHUEHUL.js → chunk-3JVUWLR7.js} +65 -4
  95. package/dist/{chunk-RXBVB2JM.js → chunk-3KGQOKIG.js} +1 -1
  96. package/dist/{chunk-YBVXBNSV.js → chunk-4JGM7FXO.js} +2 -2
  97. package/dist/{chunk-AZ7EAOBE.js → chunk-4YKPOYRV.js} +5 -5
  98. package/dist/chunk-5CWUQXXT.js +806 -0
  99. package/dist/{chunk-DLDRQHG5.js → chunk-6G5RCDKP.js} +1 -1
  100. package/dist/{chunk-AYU72WO7.js → chunk-75DSYFFB.js} +47 -70
  101. package/dist/{chunk-YHDERDRO.js → chunk-7BH46NB4.js} +91 -75
  102. package/dist/{chunk-745QJ3ZA.js → chunk-ALJG73MQ.js} +2 -2
  103. package/dist/chunk-ART7P442.js +48 -0
  104. package/dist/{chunk-7A4M7PCV.js → chunk-DK5UT6PQ.js} +1180 -556
  105. package/dist/{chunk-AIOK6LAG.js → chunk-EW2LNCRL.js} +813 -44
  106. package/dist/chunk-EXW76GW4.js +36 -0
  107. package/dist/chunk-GDFF3BQG.js +136 -0
  108. package/dist/{chunk-7UQIVT6G.js → chunk-JMH3DBM5.js} +6 -6
  109. package/dist/{chunk-CWP5RHVX.js → chunk-JMSMXXED.js} +12 -5
  110. package/dist/{chunk-CSZINQJ2.js → chunk-MEMURSBG.js} +1 -1
  111. package/dist/{chunk-YNTTROJT.js → chunk-QIW7OQEO.js} +1 -1
  112. package/dist/{chunk-Q4R73I43.js → chunk-RB26T3LU.js} +58 -28
  113. package/dist/{chunk-4LJO56OJ.js → chunk-RLVZIWNQ.js} +1 -1
  114. package/dist/{chunk-SGZO7UWH.js → chunk-SWHPVZBV.js} +2 -2
  115. package/dist/{chunk-PVNG6UMU.js → chunk-TFBNBXPU.js} +22 -10
  116. package/dist/{chunk-EFLJ2WJH.js → chunk-URDCZAL4.js} +5 -5
  117. package/dist/{chunk-6H5SZR24.js → chunk-UZGASGOD.js} +300 -383
  118. package/dist/{chunk-YEO3VX72.js → chunk-W7UONUIZ.js} +8 -6
  119. package/dist/{chunk-JUUKWRBE.js → chunk-X22XXSZA.js} +1 -1
  120. package/dist/{chunk-X5UY34KT.js → chunk-XPYWWMHR.js} +8 -8
  121. package/dist/{chunk-IIOOO4FQ.js → chunk-ZYMYLLWG.js} +2 -1
  122. package/dist/cli/chat.js +32 -35
  123. package/dist/cli/check.js +6 -6
  124. package/dist/cli/plugins.js +13 -13
  125. package/dist/cli/snapshot-create.js +9 -9
  126. package/dist/cli/upgrade.js +7 -7
  127. package/dist/db/schema/agent-invocations.d.ts +20 -0
  128. package/dist/db/schema/conversation-annotations.d.ts +2 -2
  129. package/dist/db/schema.d.ts +22 -2
  130. package/dist/{db-CSEW4RII.js → db-JBZLRIVY.js} +7 -7
  131. package/dist/instrumentation.js +4 -4
  132. package/dist/nitro.js +2 -2
  133. package/dist/{oauth-callback-server-FUEV5HNG.js → oauth-callback-server-MNTVYY2I.js} +24 -26
  134. package/dist/{runner-U3XHSKSH.js → runner-K24BWZSZ.js} +23 -25
  135. package/dist/{skills-AKE6W3WI.js → skills-AU5ST2CG.js} +6 -6
  136. package/dist/spawn-6PO7CVJ6.js +38 -0
  137. package/dist/{validation-WDTAULUF.js → validation-IXGZCFRO.js} +6 -6
  138. package/dist/version.js +1 -1
  139. package/dist/{work-C3HAO2BG.js → work-WCZIYILX.js} +18 -19
  140. package/dist/{worker-LNP4YKBM.js → worker-U2AACBEY.js} +11 -10
  141. package/package.json +6 -5
  142. package/dist/api/health.d.ts +0 -7
  143. package/dist/api/personal-tokens/create.d.ts +0 -11
  144. package/dist/api/personal-tokens/list.d.ts +0 -12
  145. package/dist/api/personal-tokens/revoke.d.ts +0 -5
  146. package/dist/api/plugin-reports.d.ts +0 -63
  147. package/dist/api/plugins.d.ts +0 -8
  148. package/dist/api/runtime.d.ts +0 -24
  149. package/dist/api/skills.d.ts +0 -6
  150. package/dist/chat/slack/tools/channel-access.d.ts +0 -30
  151. package/dist/chunk-34GS7B6L.js +0 -115
  152. package/dist/chunk-AVOCH2Z5.js +0 -285
  153. package/dist/chunk-HLXXQI5Q.js +0 -238
  154. package/dist/chunk-K4SZAP3K.js +0 -67
  155. package/dist/chunk-R776HKPK.js +0 -81
  156. package/dist/chunk-Z4YU7Z4L.js +0 -76
  157. package/dist/spawn-B6GDTWJ4.js +0 -39
  158. /package/dist/chat/slack/{tools → tool-support}/canvas/markdown.d.ts +0 -0
  159. /package/dist/chat/slack/{tools → tool-support}/channel-capabilities.d.ts +0 -0
  160. /package/dist/chat/slack/{tools → tool-support}/context.d.ts +0 -0
  161. /package/dist/chat/slack/{tools → tool-support}/list/api.d.ts +0 -0
  162. /package/dist/chat/slack/{tools → tool-support}/slack-message-url.d.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  JUNIOR_VERSION
3
- } from "./chunk-IIOOO4FQ.js";
3
+ } from "./chunk-ZYMYLLWG.js";
4
4
 
5
5
  // src/deployment.ts
6
6
  var JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";
@@ -1,12 +1,20 @@
1
1
  import {
2
2
  relayLocalOAuthCallback
3
3
  } from "./chunk-FA6POGLH.js";
4
+ import {
5
+ getTurnRequestDeadline
6
+ } from "./chunk-EXW76GW4.js";
7
+ import {
8
+ persistAuthPauseTurnState
9
+ } from "./chunk-ART7P442.js";
10
+ import {
11
+ buildSentryConversationUrl
12
+ } from "./chunk-4CODA7P5.js";
4
13
  import {
5
14
  ensureConversationWake,
6
15
  requestConversationWork
7
- } from "./chunk-CWP5RHVX.js";
16
+ } from "./chunk-JMSMXXED.js";
8
17
  import {
9
- buildConversationContext,
10
18
  buildDeliveredTurnStatePatch,
11
19
  finalizeFailedTurnReplyWithEvent,
12
20
  getInterruptionMarker,
@@ -14,14 +22,10 @@ import {
14
22
  getTurnUserMessageId,
15
23
  getTurnUserReplyAttachmentContext,
16
24
  getTurnUserSlackMessageTs,
17
- markConversationMessage,
18
- persistAuthPauseTurnState,
19
- recordDeliveredAssistantMessage,
20
25
  requireTurnFailureEventId,
21
26
  resolveTurnSessionRouting,
22
- scheduleSessionCompletedPluginTasks,
23
- turnHasReply
24
- } from "./chunk-6H5SZR24.js";
27
+ scheduleSessionCompletedPluginTasks
28
+ } from "./chunk-UZGASGOD.js";
25
29
  import {
26
30
  ConversationTurnLifecycleService,
27
31
  coerceThreadConversationState,
@@ -30,10 +34,7 @@ import {
30
34
  getPersistedSandboxState,
31
35
  getPersistedThreadState,
32
36
  persistThreadStateById
33
- } from "./chunk-AZ7EAOBE.js";
34
- import {
35
- buildSentryConversationUrl
36
- } from "./chunk-4CODA7P5.js";
37
+ } from "./chunk-4YKPOYRV.js";
37
38
  import {
38
39
  getVercelConversationWorkQueue
39
40
  } from "./chunk-WR76IVA5.js";
@@ -46,10 +47,10 @@ import {
46
47
  getMcpStoredOAuthCredentials,
47
48
  lookupSlackUserProfile,
48
49
  resolvePluginOAuthAccount
49
- } from "./chunk-Q4R73I43.js";
50
+ } from "./chunk-RB26T3LU.js";
50
51
  import {
51
52
  RetryableDeliveryError
52
- } from "./chunk-R776HKPK.js";
53
+ } from "./chunk-GDFF3BQG.js";
53
54
  import {
54
55
  addReactionToMessage,
55
56
  escapeSlackMrkdwnText,
@@ -62,10 +63,17 @@ import {
62
63
  removeReactionFromMessage,
63
64
  resolveBaseUrl,
64
65
  truncateStatusText
65
- } from "./chunk-7UQIVT6G.js";
66
+ } from "./chunk-JMH3DBM5.js";
67
+ import {
68
+ parseSlackThreadId,
69
+ readSlackRawMessageContext,
70
+ resolveSlackChannelIdFromMessage,
71
+ resolveSlackChannelIdFromThreadId
72
+ } from "./chunk-MEMURSBG.js";
66
73
  import {
67
74
  TurnSliceLimitExceededError,
68
75
  abandonTurnRecord,
76
+ buildConversationContext,
69
77
  buildTurnLimitResponse,
70
78
  clearPendingAuth,
71
79
  commitAcceptedReply,
@@ -77,61 +85,57 @@ import {
77
85
  isPendingAuthLatestRequest,
78
86
  loadProjection,
79
87
  loadTurnCheckpoint,
88
+ markConversationMessage,
80
89
  markTurnFailed,
81
90
  persistWithRetry,
82
91
  recordAuthenticationLinked,
83
92
  recordAuthorizationCompleted,
93
+ recordDeliveredAssistantMessage,
84
94
  recordTurnSummary,
85
- saveTurnCheckpoint
86
- } from "./chunk-AIOK6LAG.js";
87
- import {
88
- parseSlackThreadId,
89
- readSlackRawMessageContext,
90
- resolveSlackChannelIdFromMessage,
91
- resolveSlackChannelIdFromThreadId
92
- } from "./chunk-CSZINQJ2.js";
95
+ saveTurnCheckpoint,
96
+ turnHasReply
97
+ } from "./chunk-EW2LNCRL.js";
93
98
  import {
94
99
  getDashboardConversationLink,
95
100
  getPluginSlackConversationLink
96
- } from "./chunk-YHDERDRO.js";
101
+ } from "./chunk-7BH46NB4.js";
97
102
  import {
98
103
  SlackActionError,
99
104
  getHeaderString,
100
105
  getSlackClient,
101
106
  isDmChannel,
102
107
  normalizeSlackConversationId
103
- } from "./chunk-SGZO7UWH.js";
108
+ } from "./chunk-SWHPVZBV.js";
104
109
  import {
105
110
  getConversationEventStore,
106
111
  getSqlExecutor,
107
112
  requireSlackDestination,
108
113
  upsertIdentity,
109
114
  upsertLinkedIdentity
110
- } from "./chunk-YSB2N563.js";
115
+ } from "./chunk-3GYZ5YEH.js";
111
116
  import {
112
117
  acquireActiveLock,
113
118
  getStateAdapter
114
- } from "./chunk-ORO3PWKQ.js";
119
+ } from "./chunk-25SC7D6Z.js";
115
120
  import {
116
- FUNCTION_TIMEOUT_BUFFER_SECONDS,
117
121
  botConfig,
118
122
  escapeXml,
119
123
  getChatConfig,
120
124
  getRuntimeMetadata,
121
125
  normalizeSlackEmojiName,
122
126
  standardModelId
123
- } from "./chunk-7NVJVJID.js";
127
+ } from "./chunk-32CXPIZE.js";
124
128
  import {
125
129
  discoverSkills
126
- } from "./chunk-YBVXBNSV.js";
130
+ } from "./chunk-4JGM7FXO.js";
127
131
  import {
128
132
  pluginCatalogRuntime
129
- } from "./chunk-JUUKWRBE.js";
133
+ } from "./chunk-X22XXSZA.js";
130
134
  import {
131
135
  buildOAuthTokenRequest,
132
136
  hasRequiredOAuthScope,
133
137
  parseOAuthTokenResponse
134
- } from "./chunk-GGB4WL5A.js";
138
+ } from "./chunk-2JHKISQA.js";
135
139
  import {
136
140
  createSlackResumeActor,
137
141
  isUserActor
@@ -149,7 +153,7 @@ import {
149
153
  setTags,
150
154
  toOptionalString,
151
155
  withLogContext
152
- } from "./chunk-4LJO56OJ.js";
156
+ } from "./chunk-RLVZIWNQ.js";
153
157
  import {
154
158
  homeDir
155
159
  } from "./chunk-H4HBKISO.js";
@@ -1076,33 +1080,6 @@ function buildAuthPauseResponse(slackUserId, providerDisplayName, requestText) {
1076
1080
  I sent you a link.`;
1077
1081
  }
1078
1082
 
1079
- // src/chat/runtime/request-deadline.ts
1080
- import { AsyncLocalStorage } from "async_hooks";
1081
- var requestDeadlineStorage = new AsyncLocalStorage();
1082
- function createTurnRequestDeadline(startedAtMs) {
1083
- const requestBudgetMs = Math.max(
1084
- 1,
1085
- getChatConfig().functionMaxDurationSeconds * 1e3 - FUNCTION_TIMEOUT_BUFFER_SECONDS * 1e3
1086
- );
1087
- return {
1088
- startedAtMs,
1089
- deadlineAtMs: startedAtMs + requestBudgetMs
1090
- };
1091
- }
1092
- function getTurnRequestDeadline() {
1093
- return requestDeadlineStorage.getStore();
1094
- }
1095
- function runWithTurnRequestDeadline(callback, startedAtMs = Date.now()) {
1096
- const existingDeadline = requestDeadlineStorage.getStore();
1097
- if (existingDeadline) {
1098
- return callback();
1099
- }
1100
- return requestDeadlineStorage.run(
1101
- createTurnRequestDeadline(startedAtMs),
1102
- callback
1103
- );
1104
- }
1105
-
1106
1083
  // src/chat/runtime/slack-resume.ts
1107
1084
  function resolveReplyTimeoutMs(explicitTimeoutMs) {
1108
1085
  if (typeof explicitTimeoutMs === "number" && explicitTimeoutMs > 0) {
@@ -1436,15 +1413,17 @@ async function resumeSlackTurnInContext(args) {
1436
1413
  }
1437
1414
  failureCode = "delivery_failed";
1438
1415
  const deliveryState2 = await getDeliveryConversation();
1439
- let slackMessageTs;
1416
+ let slackMessageTs = [];
1440
1417
  try {
1441
- slackMessageTs = await sendSlackReply({
1442
- channelId: runArgs.channelId,
1443
- conversationId: runArgs.conversationId,
1444
- replyAttribution: runArgs.replyContext?.routing.dispatch?.replyAttribution,
1445
- text,
1446
- threadTs: runArgs.threadTs
1447
- });
1418
+ if (runArgs.replyContext?.routing.publishExternally !== false) {
1419
+ slackMessageTs = await sendSlackReply({
1420
+ channelId: runArgs.channelId,
1421
+ conversationId: runArgs.conversationId,
1422
+ replyAttribution: runArgs.replyContext?.routing.dispatch?.replyAttribution,
1423
+ text,
1424
+ threadTs: runArgs.threadTs
1425
+ });
1426
+ }
1448
1427
  } catch (error) {
1449
1428
  if (isRetryableSlackPostError(error)) {
1450
1429
  throw new RetryableDeliveryError(error);
@@ -3185,8 +3164,6 @@ export {
3185
3164
  shouldKeepProcessingReactionForToolInvocation,
3186
3165
  startSlackProcessingReaction,
3187
3166
  buildAuthPauseResponse,
3188
- getTurnRequestDeadline,
3189
- runWithTurnRequestDeadline,
3190
3167
  resumeSlackTurn,
3191
3168
  getPausedTurnRequest,
3192
3169
  wakePausedTurn,
@@ -4,30 +4,30 @@ import {
4
4
  isConversationScopedChannel,
5
5
  isDmChannel,
6
6
  normalizeSlackConversationId
7
- } from "./chunk-SGZO7UWH.js";
7
+ } from "./chunk-SWHPVZBV.js";
8
8
  import {
9
9
  getConversationEventStore,
10
10
  getDb
11
- } from "./chunk-YSB2N563.js";
11
+ } from "./chunk-3GYZ5YEH.js";
12
12
  import {
13
13
  juniorConversationAnnotations,
14
14
  juniorConversationEvents,
15
15
  juniorIdentities,
16
16
  juniorUsers
17
- } from "./chunk-DU74WPIC.js";
17
+ } from "./chunk-3I2IVWSZ.js";
18
18
  import {
19
19
  SANDBOX_WORKSPACE_ROOT
20
20
  } from "./chunk-EM225ITJ.js";
21
21
  import {
22
22
  getStateAdapter
23
- } from "./chunk-ORO3PWKQ.js";
23
+ } from "./chunk-25SC7D6Z.js";
24
24
  import {
25
25
  botConfig,
26
26
  completeObject,
27
27
  embedTexts,
28
28
  getSlackBotToken,
29
29
  standardModelId
30
- } from "./chunk-7NVJVJID.js";
30
+ } from "./chunk-32CXPIZE.js";
31
31
  import {
32
32
  isActorUserId,
33
33
  parseActorUserId
@@ -42,7 +42,7 @@ import {
42
42
  logInfo,
43
43
  logWarn,
44
44
  normalizeIdentityEmail
45
- } from "./chunk-4LJO56OJ.js";
45
+ } from "./chunk-RLVZIWNQ.js";
46
46
 
47
47
  // src/chat/plugins/agent-hooks.ts
48
48
  import {
@@ -460,7 +460,7 @@ function createResourceEventTeamIdResolver() {
460
460
  };
461
461
  }
462
462
 
463
- // src/chat/slack/tools/context.ts
463
+ // src/chat/slack/tool-support/context.ts
464
464
  function getSlackToolContext(context) {
465
465
  if (context.source.platform !== "slack") {
466
466
  return void 0;
@@ -740,7 +740,7 @@ function verifyEventTaskCredentialSubject(input) {
740
740
  return timingSafeMatch(expected, binding.signature);
741
741
  }
742
742
 
743
- // src/chat/slack/tools/channel-capabilities.ts
743
+ // src/chat/slack/tool-support/channel-capabilities.ts
744
744
  function resolveChannelCapabilities(channelId) {
745
745
  return {
746
746
  canCreateCanvas: isConversationScopedChannel(channelId),
@@ -805,6 +805,40 @@ function systemPromptPluginContext(plugin) {
805
805
  ...basePluginContext(plugin)
806
806
  };
807
807
  }
808
+ function pluginInvocationContext(context) {
809
+ const common = { conversationId: context.conversationId };
810
+ switch (context.source.platform) {
811
+ case "slack": {
812
+ if (context.destination.platform !== "slack") {
813
+ throw new TypeError("Slack plugin context requires Slack destination");
814
+ }
815
+ return {
816
+ ...common,
817
+ actor: context.actor?.platform === "slack" ? context.actor : void 0,
818
+ destination: context.destination,
819
+ source: context.source
820
+ };
821
+ }
822
+ case "local": {
823
+ if (context.destination.platform !== "local") {
824
+ throw new TypeError("Local plugin context requires local destination");
825
+ }
826
+ return {
827
+ ...common,
828
+ actor: context.actor?.platform === "local" ? context.actor : void 0,
829
+ destination: context.destination,
830
+ source: context.source
831
+ };
832
+ }
833
+ case "web":
834
+ return {
835
+ ...common,
836
+ actor: context.actor?.platform === "web" ? context.actor : void 0,
837
+ destination: context.destination,
838
+ source: context.source
839
+ };
840
+ }
841
+ }
808
842
  function invocationPluginContext(plugin, context, turnId) {
809
843
  const base = basePluginContext(plugin);
810
844
  const common = {
@@ -824,27 +858,9 @@ function invocationPluginContext(plugin, context, turnId) {
824
858
  text: context.userText ?? "",
825
859
  state: createPluginState(plugin.manifest.name)
826
860
  };
827
- if (context.source.platform === "slack") {
828
- if (context.destination.platform !== "slack") {
829
- throw new TypeError(
830
- "Slack plugin prompt context requires Slack destination"
831
- );
832
- }
833
- return {
834
- ...common,
835
- destination: context.destination,
836
- actor: context.actor?.platform === "slack" ? context.actor : void 0
837
- };
838
- }
839
- if (context.destination.platform !== "local") {
840
- throw new TypeError(
841
- "Local plugin prompt context requires local destination"
842
- );
843
- }
844
861
  return {
845
862
  ...common,
846
- destination: context.destination,
847
- actor: context.actor?.platform === "local" ? context.actor : void 0
863
+ ...pluginInvocationContext(context)
848
864
  };
849
865
  }
850
866
  function pluginMcpContext(plugin, context) {
@@ -990,7 +1006,8 @@ async function getPluginSystemPromptContributions(source) {
990
1006
  try {
991
1007
  const pluginContributions = await hook({
992
1008
  ...systemPromptPluginContext(plugin),
993
- platform: source.platform
1009
+ // Plugin system prompts only distinguish Slack vs non-Slack surfaces.
1010
+ platform: source.platform === "slack" ? "slack" : "local"
994
1011
  });
995
1012
  const result = systemPromptMessageArraySchema.safeParse(pluginContributions);
996
1013
  if (!result.success) {
@@ -1127,54 +1144,53 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
1127
1144
  canSubscribe: context.source.platform === "slack" && canRouteResourceEvents()
1128
1145
  };
1129
1146
  const resolveActor = context.resolveActorIdentity ?? (async () => void 0);
1147
+ const common = {
1148
+ ...basePluginContext(plugin),
1149
+ ...annotations ? { annotations } : {},
1150
+ conversationId: context.conversationId,
1151
+ userText: context.userText,
1152
+ embedder: createPluginEmbedder(pluginName),
1153
+ egress: context.egress,
1154
+ ...mcp ? { mcp } : {},
1155
+ model: createPluginModel(pluginName, plugin.model),
1156
+ resourceEvents,
1157
+ sandbox,
1158
+ state: createPluginState(pluginName),
1159
+ users: { resolveActor }
1160
+ };
1130
1161
  let pluginContext;
1131
- if (context.source.platform === "slack") {
1132
- if (context.destination.platform !== "slack") {
1133
- throw new TypeError(
1134
- "Slack plugin tool context requires Slack destination"
1135
- );
1136
- }
1137
- pluginContext = {
1138
- ...basePluginContext(plugin),
1139
- actor: context.actor?.platform === "slack" ? context.actor : void 0,
1140
- conversationId: context.conversationId,
1141
- ...annotations ? { annotations } : {},
1142
- destination: context.destination,
1143
- slack: slackContext,
1144
- source: context.source,
1145
- userText: context.userText,
1146
- embedder: createPluginEmbedder(pluginName),
1147
- egress: context.egress,
1148
- ...mcp ? { mcp } : {},
1149
- model: createPluginModel(pluginName, plugin.model),
1150
- resourceEvents,
1151
- sandbox,
1152
- state: createPluginState(pluginName),
1153
- users: { resolveActor }
1154
- };
1155
- } else {
1156
- if (context.destination.platform !== "local") {
1157
- throw new TypeError(
1158
- "Local plugin tool context requires local destination"
1159
- );
1160
- }
1161
- pluginContext = {
1162
- ...basePluginContext(plugin),
1163
- actor: context.actor?.platform === "local" ? context.actor : void 0,
1164
- conversationId: context.conversationId,
1165
- ...annotations ? { annotations } : {},
1166
- destination: context.destination,
1167
- source: context.source,
1168
- userText: context.userText,
1169
- embedder: createPluginEmbedder(pluginName),
1170
- egress: context.egress,
1171
- ...mcp ? { mcp } : {},
1172
- model: createPluginModel(pluginName, plugin.model),
1173
- resourceEvents,
1174
- sandbox,
1175
- state: createPluginState(pluginName),
1176
- users: { resolveActor }
1177
- };
1162
+ switch (context.source.platform) {
1163
+ case "slack":
1164
+ if (context.destination.platform !== "slack") {
1165
+ throw new TypeError("Slack plugin context requires Slack destination");
1166
+ }
1167
+ pluginContext = {
1168
+ ...common,
1169
+ actor: context.actor?.platform === "slack" ? context.actor : void 0,
1170
+ destination: context.destination,
1171
+ slack: slackContext,
1172
+ source: context.source
1173
+ };
1174
+ break;
1175
+ case "local":
1176
+ if (context.destination.platform !== "local") {
1177
+ throw new TypeError("Local plugin context requires local destination");
1178
+ }
1179
+ pluginContext = {
1180
+ ...common,
1181
+ actor: context.actor?.platform === "local" ? context.actor : void 0,
1182
+ destination: context.destination,
1183
+ source: context.source
1184
+ };
1185
+ break;
1186
+ case "web":
1187
+ pluginContext = {
1188
+ ...common,
1189
+ actor: context.actor?.platform === "web" ? context.actor : void 0,
1190
+ destination: context.destination,
1191
+ source: context.source
1192
+ };
1193
+ break;
1178
1194
  }
1179
1195
  const pluginTools = hook(pluginContext);
1180
1196
  const namespace = pluginToolNamespace(pluginName);
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createAndEnqueueAgentInvocation
3
- } from "./chunk-YEO3VX72.js";
3
+ } from "./chunk-W7UONUIZ.js";
4
4
  import {
5
5
  actorFromRouting,
6
6
  toolInvocationDestination
7
- } from "./chunk-R776HKPK.js";
7
+ } from "./chunk-GDFF3BQG.js";
8
8
 
9
9
  // src/chat/agent-invocations/spawn.ts
10
10
  function bindSpawnAgent(request, options) {
@@ -0,0 +1,48 @@
1
+ import {
2
+ getTurnUserMessageId
3
+ } from "./chunk-UZGASGOD.js";
4
+ import {
5
+ coerceThreadConversationState,
6
+ getPersistedThreadState,
7
+ persistThreadStateById
8
+ } from "./chunk-4YKPOYRV.js";
9
+ import {
10
+ hydrateConversationMessages,
11
+ markConversationMessage,
12
+ markTurnClosed
13
+ } from "./chunk-EW2LNCRL.js";
14
+
15
+ // src/chat/runtime/auth-pause-state.ts
16
+ function completeAuthPauseTurn(args) {
17
+ markConversationMessage(
18
+ args.conversation,
19
+ getTurnUserMessageId(args.conversation, args.sessionId),
20
+ {
21
+ replied: true,
22
+ skippedReason: void 0
23
+ }
24
+ );
25
+ markTurnClosed({
26
+ conversation: args.conversation,
27
+ nowMs: Date.now(),
28
+ sessionId: args.sessionId
29
+ });
30
+ }
31
+ async function persistAuthPauseTurnState(args) {
32
+ const currentState = await getPersistedThreadState(args.threadStateId);
33
+ const conversation = coerceThreadConversationState(currentState);
34
+ await hydrateConversationMessages({
35
+ conversation,
36
+ conversationId: args.threadStateId
37
+ });
38
+ completeAuthPauseTurn({
39
+ conversation,
40
+ sessionId: args.sessionId
41
+ });
42
+ await persistThreadStateById(args.threadStateId, { conversation });
43
+ }
44
+
45
+ export {
46
+ completeAuthPauseTurn,
47
+ persistAuthPauseTurnState
48
+ };