@sentry/junior 0.146.0 → 0.148.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 (227) hide show
  1. package/dist/{agent-hooks-SLJADYE5.js → agent-hooks-VAUYT6PD.js} +10 -10
  2. package/dist/api/conversations/access.d.ts +2 -1
  3. package/dist/api/conversations/archive.d.ts +3 -5
  4. package/dist/api/conversations/create.d.ts +6 -0
  5. package/dist/api/conversations/detail.d.ts +2 -295
  6. package/dist/api/conversations/event-list.d.ts +2 -192
  7. package/dist/api/conversations/list.d.ts +4 -66
  8. package/dist/api/conversations/routes.d.ts +1 -1
  9. package/dist/api/conversations/stats.d.ts +0 -54
  10. package/dist/api/http.d.ts +2 -6
  11. package/dist/api/locations/detail.d.ts +3 -111
  12. package/dist/api/locations/list.d.ts +0 -45
  13. package/dist/api/locations/query.d.ts +2 -1
  14. package/dist/api/locations/routes.d.ts +1 -1
  15. package/dist/api/people/list.d.ts +0 -29
  16. package/dist/api/people/profile.d.ts +2 -106
  17. package/dist/api/people/profile.query.d.ts +2 -1
  18. package/dist/api/people/routes.d.ts +1 -1
  19. package/dist/api/people/shared.d.ts +1 -1
  20. package/dist/api/people/spend.d.ts +3 -4
  21. package/dist/api/personal-tokens/routes.d.ts +2 -2
  22. package/dist/api/route.d.ts +8 -14
  23. package/dist/api/schema/conversation.d.ts +64 -29
  24. package/dist/api/schema/location.d.ts +4 -0
  25. package/dist/api/schema/person.d.ts +7 -3
  26. package/dist/api/schema.d.ts +2 -2
  27. package/dist/api/schema.js +7 -1
  28. package/dist/api/stats.d.ts +0 -13
  29. package/dist/api/validation.d.ts +7 -0
  30. package/dist/api/viewer.d.ts +3 -0
  31. package/dist/api.d.ts +2 -1
  32. package/dist/api.js +630 -564
  33. package/dist/app.js +369 -309
  34. package/dist/{catalog-runtime-RQIMSDPR.js → catalog-runtime-WADOZVTB.js} +5 -5
  35. package/dist/chat/actor.d.ts +4 -1
  36. package/dist/chat/agent/prompt.d.ts +0 -2
  37. package/dist/chat/agent/request.d.ts +4 -5
  38. package/dist/chat/agent/resume.d.ts +1 -0
  39. package/dist/chat/agent/sandbox.d.ts +2 -2
  40. package/dist/chat/agent/tools.d.ts +0 -2
  41. package/dist/chat/agent-dispatch/context.d.ts +2 -2
  42. package/dist/chat/agent-dispatch/types.d.ts +2 -2
  43. package/dist/chat/agent-invocations/types.d.ts +52 -0
  44. package/dist/chat/api-turns/work.d.ts +103 -0
  45. package/dist/chat/capabilities/jr-rpc-command.d.ts +2 -2
  46. package/dist/chat/configuration/service.d.ts +5 -2
  47. package/dist/chat/configuration/sql.d.ts +9 -0
  48. package/dist/chat/configuration/types.d.ts +17 -13
  49. package/dist/chat/conversations/history.d.ts +63 -0
  50. package/dist/chat/conversations/projection.d.ts +10 -0
  51. package/dist/chat/conversations/provenance.d.ts +6 -0
  52. package/dist/chat/conversations/sql/actor-identity.d.ts +19 -0
  53. package/dist/chat/conversations/store.d.ts +1 -1
  54. package/dist/chat/credentials/unlink-provider.d.ts +2 -1
  55. package/dist/chat/credentials/user-token-store.d.ts +2 -0
  56. package/dist/chat/event-tasks/tool-support.d.ts +2 -0
  57. package/dist/chat/identities/sql.d.ts +8 -0
  58. package/dist/chat/logging.d.ts +2 -0
  59. package/dist/chat/mcp/auth-store.d.ts +0 -2
  60. package/dist/chat/mcp/oauth.d.ts +0 -2
  61. package/dist/chat/oauth-flow.d.ts +3 -1
  62. package/dist/chat/pi/client.d.ts +2 -0
  63. package/dist/chat/plugins/credential-hooks.d.ts +2 -0
  64. package/dist/chat/prompt.d.ts +0 -2
  65. package/dist/chat/resource-events/notification.d.ts +2 -1
  66. package/dist/chat/resource-events/store.d.ts +1 -1
  67. package/dist/chat/runtime/delivered-turn-state.d.ts +1 -4
  68. package/dist/chat/runtime/reply-executor.d.ts +1 -1
  69. package/dist/chat/runtime/slack-runtime.d.ts +2 -1
  70. package/dist/chat/runtime/thread-state.d.ts +8 -11
  71. package/dist/chat/runtime/turn-input.d.ts +4 -2
  72. package/dist/chat/runtime/turn-preparation.d.ts +11 -4
  73. package/dist/chat/sandbox/command-result.d.ts +2 -0
  74. package/dist/chat/sandbox/egress/schemas.d.ts +6 -0
  75. package/dist/chat/scheduled-tasks/tool-support.d.ts +7 -5
  76. package/dist/chat/scheduled-tasks/tools/create.d.ts +4 -2
  77. package/dist/chat/scheduled-tasks/tools/delete.d.ts +4 -2
  78. package/dist/chat/scheduled-tasks/tools/list.d.ts +4 -2
  79. package/dist/chat/scheduled-tasks/tools/run-now.d.ts +4 -2
  80. package/dist/chat/scheduled-tasks/tools/update.d.ts +4 -2
  81. package/dist/chat/services/mcp-auth-orchestration.d.ts +0 -3
  82. package/dist/chat/services/plugin-auth-orchestration.d.ts +2 -1
  83. package/dist/chat/services/provider-default-config.d.ts +2 -2
  84. package/dist/chat/services/subscribed-decision.d.ts +3 -0
  85. package/dist/chat/services/subscribed-reply-policy.d.ts +1 -0
  86. package/dist/chat/services/turn-result.d.ts +0 -3
  87. package/dist/chat/services/turn-router.d.ts +3 -0
  88. package/dist/chat/slack/assistant-thread/lifecycle.d.ts +0 -1
  89. package/dist/chat/slack/assistant-thread/title.d.ts +0 -3
  90. package/dist/chat/slack/channel.d.ts +26 -0
  91. package/dist/chat/slack/dispatch-turn.d.ts +2 -1
  92. package/dist/chat/slack/timestamp-param.d.ts +0 -2
  93. package/dist/chat/slack/{tools → tool-support}/canvas/api.d.ts +1 -1
  94. package/dist/chat/slack/tool-support/canvas/context.d.ts +11 -0
  95. package/dist/chat/slack/tool-support/channel-access.d.ts +42 -0
  96. package/dist/chat/slack/tool-support/channel-target.d.ts +27 -0
  97. package/dist/chat/slack/{tools → tool-support}/list/api.d.ts +8 -1
  98. package/dist/chat/slack/tool-support/list/params.d.ts +5 -0
  99. package/dist/chat/slack/tools/canvas/create.d.ts +3 -1
  100. package/dist/chat/slack/tools/canvas/edit.d.ts +2 -0
  101. package/dist/chat/slack/tools/canvas/read.d.ts +2 -0
  102. package/dist/chat/slack/tools/canvas/write.d.ts +2 -0
  103. package/dist/chat/slack/tools/{user-lookup.d.ts → channel-join.d.ts} +6 -5
  104. package/dist/chat/slack/tools/channel-list-messages.d.ts +5 -2
  105. package/dist/chat/slack/tools/conversation-message-search.d.ts +4 -8
  106. package/dist/chat/slack/tools/list/add-items.d.ts +4 -1
  107. package/dist/chat/slack/tools/list/create.d.ts +2 -0
  108. package/dist/chat/slack/tools/list/get-items.d.ts +5 -3
  109. package/dist/chat/slack/tools/list/update-item.d.ts +5 -1
  110. package/dist/chat/slack/tools/message-add-reaction.d.ts +3 -1
  111. package/dist/chat/slack/tools/public-search.d.ts +65 -2
  112. package/dist/chat/slack/tools/send-files.d.ts +3 -1
  113. package/dist/chat/slack/tools/thread-read.d.ts +4 -5
  114. package/dist/chat/slack/vision-cache.d.ts +5 -0
  115. package/dist/chat/source.d.ts +2 -0
  116. package/dist/chat/state/conversation.d.ts +4 -5
  117. package/dist/chat/task-execution/checkpoint.d.ts +1 -0
  118. package/dist/chat/task-execution/state.d.ts +9 -4
  119. package/dist/chat/task-execution/store.d.ts +3 -2
  120. package/dist/chat/task-execution/turn-cursor.d.ts +2 -0
  121. package/dist/chat/task-execution/worker.d.ts +2 -0
  122. package/dist/chat/tasks/read.d.ts +1 -1
  123. package/dist/chat/tool-support/structured-result.d.ts +1 -0
  124. package/dist/chat/tool-support/timed-out-tool-result.d.ts +11 -0
  125. package/dist/chat/tools/create-event-task.d.ts +2 -0
  126. package/dist/chat/tools/delete-event-task.d.ts +2 -0
  127. package/dist/chat/tools/handoff/tool.d.ts +2 -0
  128. package/dist/chat/tools/list-event-tasks.d.ts +2 -0
  129. package/dist/chat/tools/list-resource-event-subscriptions.d.ts +2 -0
  130. package/dist/chat/tools/runtime/report-progress.d.ts +2 -0
  131. package/dist/chat/tools/runtime/spawn-agent.d.ts +2 -0
  132. package/dist/chat/tools/search-conversation-events.d.ts +3 -1
  133. package/dist/chat/tools/search-resource-event-types.d.ts +2 -0
  134. package/dist/chat/tools/search-tools.d.ts +2 -0
  135. package/dist/chat/tools/skill/load-skill.d.ts +2 -0
  136. package/dist/chat/tools/skill/search-mcp-tools.d.ts +2 -0
  137. package/dist/chat/tools/stop-watching-resources.d.ts +2 -0
  138. package/dist/chat/tools/system-time.d.ts +2 -0
  139. package/dist/chat/tools/types.d.ts +11 -10
  140. package/dist/chat/tools/update-event-task.d.ts +2 -0
  141. package/dist/chat/tools/user-lookup.d.ts +29 -0
  142. package/dist/chat/tools/watch-resource-events.d.ts +4 -2
  143. package/dist/chat/tools/web/fetch-tool.d.ts +2 -0
  144. package/dist/chat/tools/web/image-generate.d.ts +2 -0
  145. package/dist/chat/tools/web/search.d.ts +2 -0
  146. package/dist/{chunk-GYEKOX7N.js → chunk-2B3PT3V2.js} +1 -1
  147. package/dist/{chunk-JLMVCNXL.js → chunk-45LOR4PU.js} +22 -4
  148. package/dist/{chunk-FGHADGIC.js → chunk-4AQZYNHM.js} +2 -2
  149. package/dist/{chunk-W65V465O.js → chunk-4EA2SFK2.js} +66 -4
  150. package/dist/{chunk-MKRIZ4VG.js → chunk-4GXJUYJV.js} +4 -2
  151. package/dist/{chunk-F7REGDKO.js → chunk-55F4QU2V.js} +2 -1
  152. package/dist/{chunk-M6ZWP4RI.js → chunk-7OEIXFC3.js} +2 -2
  153. package/dist/{chunk-MCFIXAV5.js → chunk-D3WPMGEX.js} +55 -37
  154. package/dist/{chunk-AISNSNDV.js → chunk-D6YX4NNN.js} +22 -10
  155. package/dist/chunk-DUY5CDAM.js +36 -0
  156. package/dist/{chunk-B63BF443.js → chunk-EAI67NTM.js} +9 -1
  157. package/dist/{chunk-FEKQHPVA.js → chunk-EINWQFXI.js} +9 -8
  158. package/dist/chunk-GDFF3BQG.js +136 -0
  159. package/dist/{chunk-X22KCSCO.js → chunk-GXYDVZKM.js} +7 -5
  160. package/dist/{chunk-X2WMBTS3.js → chunk-HLPLT3NY.js} +8 -5
  161. package/dist/{chunk-PB222GIA.js → chunk-HWQGBIH7.js} +1 -1
  162. package/dist/chunk-IL4EDBMV.js +566 -0
  163. package/dist/{chunk-HQE6EJS5.js → chunk-LAZGHEYU.js} +1 -1
  164. package/dist/{chunk-QG7OOKIN.js → chunk-LE5H7LMT.js} +1 -1
  165. package/dist/chunk-LNVEIJ2L.js +48 -0
  166. package/dist/{chunk-JUA6VU2Z.js → chunk-OJCP3C3J.js} +12 -23
  167. package/dist/{chunk-37JJDS4H.js → chunk-POSZWRGL.js} +1 -1
  168. package/dist/{chunk-TCEJ7XXM.js → chunk-QOWHHM3F.js} +1 -1
  169. package/dist/{chunk-H6U2U3EP.js → chunk-RRJV5UR5.js} +304 -65
  170. package/dist/{chunk-OFPYOC3M.js → chunk-ULAU5ZGU.js} +127 -120
  171. package/dist/{chunk-V6SRLKUB.js → chunk-V2FXMOEA.js} +2 -2
  172. package/dist/{chunk-GDQEU4I7.js → chunk-VCYSOXON.js} +296 -526
  173. package/dist/{chunk-BLETMLRX.js → chunk-VMNRXKAH.js} +1374 -989
  174. package/dist/{chunk-37EVZP66.js → chunk-VRHTNBA6.js} +167 -92
  175. package/dist/{chunk-FXDDDSPL.js → chunk-VY6W3T43.js} +4 -4
  176. package/dist/{chunk-ZDGHGY74.js → chunk-WCN4YSH7.js} +13 -6
  177. package/dist/{chunk-PH4Q3A6W.js → chunk-WOONT5ZP.js} +1 -1
  178. package/dist/{chunk-47OSH2ZO.js → chunk-XJ42NBP5.js} +395 -206
  179. package/dist/{chunk-SCGVWUZX.js → chunk-ZCHIC2GM.js} +92 -75
  180. package/dist/chunk-ZPL2RR7F.js +798 -0
  181. package/dist/cli/chat.js +33 -35
  182. package/dist/cli/check.js +6 -6
  183. package/dist/cli/plugins.js +13 -13
  184. package/dist/cli/snapshot-create.js +9 -9
  185. package/dist/cli/upgrade.js +7 -7
  186. package/dist/db/schema/agent-invocations.d.ts +20 -0
  187. package/dist/db/schema/conversation-annotations.d.ts +2 -2
  188. package/dist/db/schema/location-configurations.d.ts +127 -0
  189. package/dist/db/schema.d.ts +150 -3
  190. package/dist/{db-WWOMXWTT.js → db-XUKZRFFK.js} +7 -7
  191. package/dist/instrumentation.js +4 -4
  192. package/dist/nitro.js +2 -2
  193. package/dist/{oauth-callback-server-A6ZZX74U.js → oauth-callback-server-LPZMMGFI.js} +25 -26
  194. package/dist/{runner-KSGB2UAV.js → runner-DGKUTMPX.js} +22 -41
  195. package/dist/{skills-26QPWKVS.js → skills-P7YUFSXM.js} +6 -6
  196. package/dist/spawn-DSK3ZEVD.js +38 -0
  197. package/dist/{validation-OPSRGFGH.js → validation-S7U5M5NR.js} +6 -6
  198. package/dist/version.js +1 -1
  199. package/dist/{work-VMSW7STJ.js → work-GAA7TVAD.js} +18 -19
  200. package/dist/{worker-2JNFB7C7.js → worker-JXPJH3QB.js} +11 -10
  201. package/migrations/0024_misty_typhoid_mary.sql +12 -0
  202. package/migrations/meta/0024_snapshot.json +2275 -0
  203. package/migrations/meta/_journal.json +7 -0
  204. package/package.json +6 -5
  205. package/dist/api/health.d.ts +0 -7
  206. package/dist/api/personal-tokens/create.d.ts +0 -11
  207. package/dist/api/personal-tokens/list.d.ts +0 -12
  208. package/dist/api/personal-tokens/revoke.d.ts +0 -5
  209. package/dist/api/plugin-reports.d.ts +0 -63
  210. package/dist/api/plugins.d.ts +0 -8
  211. package/dist/api/runtime.d.ts +0 -24
  212. package/dist/api/skills.d.ts +0 -6
  213. package/dist/chat/slack/tools/canvas/context.d.ts +0 -18
  214. package/dist/chat/slack/tools/channel-access.d.ts +0 -30
  215. package/dist/chat/state/artifacts.d.ts +0 -30
  216. package/dist/chat/tool-support/turn-deadline-result.d.ts +0 -3
  217. package/dist/chunk-HLXXQI5Q.js +0 -238
  218. package/dist/chunk-LVW7BLLT.js +0 -115
  219. package/dist/chunk-Q6QZTTLS.js +0 -55
  220. package/dist/chunk-QSXZ42KX.js +0 -285
  221. package/dist/chunk-R776HKPK.js +0 -81
  222. package/dist/chunk-T5GXFFLA.js +0 -67
  223. package/dist/spawn-5LAJXZ2P.js +0 -39
  224. /package/dist/chat/slack/{tools → tool-support}/canvas/markdown.d.ts +0 -0
  225. /package/dist/chat/slack/{tools → tool-support}/channel-capabilities.d.ts +0 -0
  226. /package/dist/chat/slack/{tools → tool-support}/context.d.ts +0 -0
  227. /package/dist/chat/slack/{tools → tool-support}/slack-message-url.d.ts +0 -0
@@ -4,30 +4,30 @@ import {
4
4
  isConversationScopedChannel,
5
5
  isDmChannel,
6
6
  normalizeSlackConversationId
7
- } from "./chunk-V6SRLKUB.js";
7
+ } from "./chunk-V2FXMOEA.js";
8
8
  import {
9
9
  getConversationEventStore,
10
10
  getDb
11
- } from "./chunk-37EVZP66.js";
11
+ } from "./chunk-VRHTNBA6.js";
12
12
  import {
13
13
  juniorConversationAnnotations,
14
14
  juniorConversationEvents,
15
15
  juniorIdentities,
16
16
  juniorUsers
17
- } from "./chunk-MCFIXAV5.js";
17
+ } from "./chunk-D3WPMGEX.js";
18
18
  import {
19
19
  SANDBOX_WORKSPACE_ROOT
20
20
  } from "./chunk-EM225ITJ.js";
21
21
  import {
22
22
  getStateAdapter
23
- } from "./chunk-GYEKOX7N.js";
23
+ } from "./chunk-2B3PT3V2.js";
24
24
  import {
25
25
  botConfig,
26
26
  completeObject,
27
27
  embedTexts,
28
28
  getSlackBotToken,
29
29
  standardModelId
30
- } from "./chunk-MKRIZ4VG.js";
30
+ } from "./chunk-4GXJUYJV.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-B63BF443.js";
45
+ } from "./chunk-EAI67NTM.js";
46
46
 
47
47
  // src/chat/plugins/agent-hooks.ts
48
48
  import {
@@ -280,6 +280,7 @@ function createPluginModel(pluginName, options = {}, runtime = {}) {
280
280
  ...input.system !== void 0 ? { system: input.system } : {},
281
281
  ...input.maxTokens !== void 0 ? { maxTokens: input.maxTokens } : {},
282
282
  signal: runtime.signal,
283
+ promptName: `${pluginName}.structured_completion`,
283
284
  metadata: {
284
285
  pluginName,
285
286
  pluginModelRole: "structured"
@@ -459,7 +460,7 @@ function createResourceEventTeamIdResolver() {
459
460
  };
460
461
  }
461
462
 
462
- // src/chat/slack/tools/context.ts
463
+ // src/chat/slack/tool-support/context.ts
463
464
  function getSlackToolContext(context) {
464
465
  if (context.source.platform !== "slack") {
465
466
  return void 0;
@@ -739,7 +740,7 @@ function verifyEventTaskCredentialSubject(input) {
739
740
  return timingSafeMatch(expected, binding.signature);
740
741
  }
741
742
 
742
- // src/chat/slack/tools/channel-capabilities.ts
743
+ // src/chat/slack/tool-support/channel-capabilities.ts
743
744
  function resolveChannelCapabilities(channelId) {
744
745
  return {
745
746
  canCreateCanvas: isConversationScopedChannel(channelId),
@@ -804,6 +805,40 @@ function systemPromptPluginContext(plugin) {
804
805
  ...basePluginContext(plugin)
805
806
  };
806
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
+ }
807
842
  function invocationPluginContext(plugin, context, turnId) {
808
843
  const base = basePluginContext(plugin);
809
844
  const common = {
@@ -823,27 +858,9 @@ function invocationPluginContext(plugin, context, turnId) {
823
858
  text: context.userText ?? "",
824
859
  state: createPluginState(plugin.manifest.name)
825
860
  };
826
- if (context.source.platform === "slack") {
827
- if (context.destination.platform !== "slack") {
828
- throw new TypeError(
829
- "Slack plugin prompt context requires Slack destination"
830
- );
831
- }
832
- return {
833
- ...common,
834
- destination: context.destination,
835
- actor: context.actor?.platform === "slack" ? context.actor : void 0
836
- };
837
- }
838
- if (context.destination.platform !== "local") {
839
- throw new TypeError(
840
- "Local plugin prompt context requires local destination"
841
- );
842
- }
843
861
  return {
844
862
  ...common,
845
- destination: context.destination,
846
- actor: context.actor?.platform === "local" ? context.actor : void 0
863
+ ...pluginInvocationContext(context)
847
864
  };
848
865
  }
849
866
  function pluginMcpContext(plugin, context) {
@@ -989,7 +1006,8 @@ async function getPluginSystemPromptContributions(source) {
989
1006
  try {
990
1007
  const pluginContributions = await hook({
991
1008
  ...systemPromptPluginContext(plugin),
992
- platform: source.platform
1009
+ // Plugin system prompts only distinguish Slack vs non-Slack surfaces.
1010
+ platform: source.platform === "slack" ? "slack" : "local"
993
1011
  });
994
1012
  const result = systemPromptMessageArraySchema.safeParse(pluginContributions);
995
1013
  if (!result.success) {
@@ -1126,54 +1144,53 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
1126
1144
  canSubscribe: context.source.platform === "slack" && canRouteResourceEvents()
1127
1145
  };
1128
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
+ };
1129
1161
  let pluginContext;
1130
- if (context.source.platform === "slack") {
1131
- if (context.destination.platform !== "slack") {
1132
- throw new TypeError(
1133
- "Slack plugin tool context requires Slack destination"
1134
- );
1135
- }
1136
- pluginContext = {
1137
- ...basePluginContext(plugin),
1138
- actor: context.actor?.platform === "slack" ? context.actor : void 0,
1139
- conversationId: context.conversationId,
1140
- ...annotations ? { annotations } : {},
1141
- destination: context.destination,
1142
- slack: slackContext,
1143
- source: context.source,
1144
- userText: context.userText,
1145
- embedder: createPluginEmbedder(pluginName),
1146
- egress: context.egress,
1147
- ...mcp ? { mcp } : {},
1148
- model: createPluginModel(pluginName, plugin.model),
1149
- resourceEvents,
1150
- sandbox,
1151
- state: createPluginState(pluginName),
1152
- users: { resolveActor }
1153
- };
1154
- } else {
1155
- if (context.destination.platform !== "local") {
1156
- throw new TypeError(
1157
- "Local plugin tool context requires local destination"
1158
- );
1159
- }
1160
- pluginContext = {
1161
- ...basePluginContext(plugin),
1162
- actor: context.actor?.platform === "local" ? context.actor : void 0,
1163
- conversationId: context.conversationId,
1164
- ...annotations ? { annotations } : {},
1165
- destination: context.destination,
1166
- source: context.source,
1167
- userText: context.userText,
1168
- embedder: createPluginEmbedder(pluginName),
1169
- egress: context.egress,
1170
- ...mcp ? { mcp } : {},
1171
- model: createPluginModel(pluginName, plugin.model),
1172
- resourceEvents,
1173
- sandbox,
1174
- state: createPluginState(pluginName),
1175
- users: { resolveActor }
1176
- };
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;
1177
1194
  }
1178
1195
  const pluginTools = hook(pluginContext);
1179
1196
  const namespace = pluginToolNamespace(pluginName);