@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
@@ -1,10 +1,19 @@
1
1
  import {
2
2
  relayLocalOAuthCallback
3
3
  } from "./chunk-FA6POGLH.js";
4
+ import {
5
+ getTurnRequestDeadline
6
+ } from "./chunk-DUY5CDAM.js";
7
+ import {
8
+ persistAuthPauseTurnState
9
+ } from "./chunk-LNVEIJ2L.js";
10
+ import {
11
+ buildSentryConversationUrl
12
+ } from "./chunk-4CODA7P5.js";
4
13
  import {
5
14
  ensureConversationWake,
6
15
  requestConversationWork
7
- } from "./chunk-X2WMBTS3.js";
16
+ } from "./chunk-HLPLT3NY.js";
8
17
  import {
9
18
  buildConversationContext,
10
19
  buildDeliveredTurnStatePatch,
@@ -15,19 +24,21 @@ import {
15
24
  getTurnUserReplyAttachmentContext,
16
25
  getTurnUserSlackMessageTs,
17
26
  markConversationMessage,
18
- persistAuthPauseTurnState,
19
27
  recordDeliveredAssistantMessage,
20
28
  requireTurnFailureEventId,
21
29
  resolveTurnSessionRouting,
22
30
  scheduleSessionCompletedPluginTasks,
23
31
  turnHasReply
24
- } from "./chunk-H6U2U3EP.js";
32
+ } from "./chunk-RRJV5UR5.js";
25
33
  import {
26
- ConversationTurnLifecycleService
27
- } from "./chunk-Q6QZTTLS.js";
28
- import {
29
- buildSentryConversationUrl
30
- } from "./chunk-4CODA7P5.js";
34
+ ConversationTurnLifecycleService,
35
+ coerceThreadConversationState,
36
+ configValueSchema,
37
+ getLocationConfigurationService,
38
+ getPersistedSandboxState,
39
+ getPersistedThreadState,
40
+ persistThreadStateById
41
+ } from "./chunk-IL4EDBMV.js";
31
42
  import {
32
43
  getVercelConversationWorkQueue
33
44
  } from "./chunk-WR76IVA5.js";
@@ -38,11 +49,12 @@ import {
38
49
  getMcpAuthSession,
39
50
  getMcpProviderErrorAttributes,
40
51
  getMcpStoredOAuthCredentials,
52
+ lookupSlackUserProfile,
41
53
  resolvePluginOAuthAccount
42
- } from "./chunk-47OSH2ZO.js";
54
+ } from "./chunk-XJ42NBP5.js";
43
55
  import {
44
56
  RetryableDeliveryError
45
- } from "./chunk-R776HKPK.js";
57
+ } from "./chunk-GDFF3BQG.js";
46
58
  import {
47
59
  addReactionToMessage,
48
60
  escapeSlackMrkdwnText,
@@ -55,95 +67,93 @@ import {
55
67
  removeReactionFromMessage,
56
68
  resolveBaseUrl,
57
69
  truncateStatusText
58
- } from "./chunk-ZDGHGY74.js";
70
+ } from "./chunk-WCN4YSH7.js";
71
+ import {
72
+ parseSlackThreadId,
73
+ readSlackRawMessageContext,
74
+ resolveSlackChannelIdFromMessage,
75
+ resolveSlackChannelIdFromThreadId
76
+ } from "./chunk-WOONT5ZP.js";
59
77
  import {
60
78
  TurnSliceLimitExceededError,
61
79
  abandonTurnRecord,
62
80
  buildTurnLimitResponse,
63
81
  clearPendingAuth,
64
- coerceThreadArtifactsState,
65
- coerceThreadConversationState,
66
82
  commitAcceptedReply,
67
83
  failTurnRecord,
68
84
  getAssistantReplyText,
69
- getChannelConfigurationServiceById,
70
85
  getConversationPendingAuth,
71
- getPersistedSandboxState,
72
- getPersistedThreadState,
73
86
  getTurnRecord,
74
87
  hydrateConversationMessages,
75
88
  isPendingAuthLatestRequest,
76
89
  loadProjection,
77
90
  loadTurnCheckpoint,
78
91
  markTurnFailed,
79
- persistThreadStateById,
80
92
  persistWithRetry,
81
93
  recordAuthenticationLinked,
82
94
  recordAuthorizationCompleted,
83
95
  recordTurnSummary,
84
96
  saveTurnCheckpoint
85
- } from "./chunk-GDQEU4I7.js";
86
- import {
87
- parseSlackThreadId,
88
- readSlackRawMessageContext,
89
- resolveSlackChannelIdFromMessage,
90
- resolveSlackChannelIdFromThreadId
91
- } from "./chunk-PH4Q3A6W.js";
97
+ } from "./chunk-VCYSOXON.js";
92
98
  import {
93
99
  getDashboardConversationLink,
94
100
  getPluginSlackConversationLink
95
- } from "./chunk-SCGVWUZX.js";
101
+ } from "./chunk-ZCHIC2GM.js";
96
102
  import {
97
103
  SlackActionError,
98
104
  getHeaderString,
99
105
  getSlackClient,
100
106
  isDmChannel,
101
107
  normalizeSlackConversationId
102
- } from "./chunk-V6SRLKUB.js";
108
+ } from "./chunk-V2FXMOEA.js";
103
109
  import {
104
110
  getConversationEventStore,
105
- requireSlackDestination
106
- } from "./chunk-37EVZP66.js";
111
+ getSqlExecutor,
112
+ requireSlackDestination,
113
+ upsertIdentity,
114
+ upsertLinkedIdentity
115
+ } from "./chunk-VRHTNBA6.js";
107
116
  import {
108
117
  acquireActiveLock,
109
118
  getStateAdapter
110
- } from "./chunk-GYEKOX7N.js";
119
+ } from "./chunk-2B3PT3V2.js";
111
120
  import {
112
- FUNCTION_TIMEOUT_BUFFER_SECONDS,
113
121
  botConfig,
114
122
  escapeXml,
115
123
  getChatConfig,
116
124
  getRuntimeMetadata,
117
125
  normalizeSlackEmojiName,
118
126
  standardModelId
119
- } from "./chunk-MKRIZ4VG.js";
127
+ } from "./chunk-4GXJUYJV.js";
120
128
  import {
121
129
  discoverSkills
122
- } from "./chunk-FGHADGIC.js";
130
+ } from "./chunk-4AQZYNHM.js";
123
131
  import {
124
132
  pluginCatalogRuntime
125
- } from "./chunk-PB222GIA.js";
133
+ } from "./chunk-HWQGBIH7.js";
126
134
  import {
127
135
  buildOAuthTokenRequest,
128
136
  hasRequiredOAuthScope,
129
137
  parseOAuthTokenResponse
130
- } from "./chunk-37JJDS4H.js";
138
+ } from "./chunk-POSZWRGL.js";
131
139
  import {
132
140
  createSlackResumeActor,
133
141
  isUserActor
134
142
  } from "./chunk-HZF5P5UN.js";
135
143
  import {
136
- parseSlackMessageTs
144
+ parseSlackMessageTs,
145
+ parseSlackUserId
137
146
  } from "./chunk-F3B2YJ76.js";
138
147
  import {
139
148
  buildTurnFailureResponse,
140
149
  logException,
141
150
  logInfo,
142
151
  logWarn,
152
+ runBestEffort,
143
153
  setTags,
144
154
  toOptionalString,
145
155
  withLogContext
146
- } from "./chunk-B63BF443.js";
156
+ } from "./chunk-EAI67NTM.js";
147
157
  import {
148
158
  homeDir
149
159
  } from "./chunk-H4HBKISO.js";
@@ -1070,33 +1080,6 @@ function buildAuthPauseResponse(slackUserId, providerDisplayName, requestText) {
1070
1080
  I sent you a link.`;
1071
1081
  }
1072
1082
 
1073
- // src/chat/runtime/request-deadline.ts
1074
- import { AsyncLocalStorage } from "async_hooks";
1075
- var requestDeadlineStorage = new AsyncLocalStorage();
1076
- function createTurnRequestDeadline(startedAtMs) {
1077
- const requestBudgetMs = Math.max(
1078
- 1,
1079
- getChatConfig().functionMaxDurationSeconds * 1e3 - FUNCTION_TIMEOUT_BUFFER_SECONDS * 1e3
1080
- );
1081
- return {
1082
- startedAtMs,
1083
- deadlineAtMs: startedAtMs + requestBudgetMs
1084
- };
1085
- }
1086
- function getTurnRequestDeadline() {
1087
- return requestDeadlineStorage.getStore();
1088
- }
1089
- function runWithTurnRequestDeadline(callback, startedAtMs = Date.now()) {
1090
- const existingDeadline = requestDeadlineStorage.getStore();
1091
- if (existingDeadline) {
1092
- return callback();
1093
- }
1094
- return requestDeadlineStorage.run(
1095
- createTurnRequestDeadline(startedAtMs),
1096
- callback
1097
- );
1098
- }
1099
-
1100
1083
  // src/chat/runtime/slack-resume.ts
1101
1084
  function resolveReplyTimeoutMs(explicitTimeoutMs) {
1102
1085
  if (typeof explicitTimeoutMs === "number" && explicitTimeoutMs > 0) {
@@ -1125,11 +1108,17 @@ async function postSlackMessageBestEffort(channelId, threadTs, text, conversatio
1125
1108
  } catch {
1126
1109
  }
1127
1110
  }
1128
- function createReadOnlyConfigService(values) {
1111
+ function createReadOnlyConfigService(rawValues) {
1112
+ const values = Object.fromEntries(
1113
+ Object.entries(rawValues).map(([key, value]) => [
1114
+ key,
1115
+ configValueSchema.parse(value)
1116
+ ])
1117
+ );
1129
1118
  const entries = Object.entries(values).map(([key, value]) => ({
1130
1119
  key,
1131
1120
  value,
1132
- scope: "conversation",
1121
+ scope: "location",
1133
1122
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
1134
1123
  }));
1135
1124
  return {
@@ -1264,7 +1253,7 @@ function createResumeReplyContext(args, statusSession, delivery) {
1264
1253
  }
1265
1254
  const requestDeadline = getTurnRequestDeadline();
1266
1255
  const threadId = args.lockKey ?? getDefaultLockKey(args.channelId, args.threadTs);
1267
- const persistedChannelConfiguration = replyContext.policy?.channelConfiguration ?? (replyContext.policy?.configuration ? createReadOnlyConfigService(replyContext.policy.configuration) : void 0);
1256
+ const persistedLocationConfiguration = replyContext.policy?.locationConfiguration ?? (replyContext.policy?.configuration ? createReadOnlyConfigService(replyContext.policy.configuration) : void 0);
1268
1257
  return {
1269
1258
  conversationId: args.conversationId,
1270
1259
  turnId: args.turnId,
@@ -1283,7 +1272,7 @@ function createResumeReplyContext(args, statusSession, delivery) {
1283
1272
  policy: {
1284
1273
  ...replyContext.policy,
1285
1274
  turnDeadlineAtMs: replyContext.policy?.turnDeadlineAtMs ?? requestDeadline?.deadlineAtMs,
1286
- channelConfiguration: persistedChannelConfiguration
1275
+ locationConfiguration: persistedLocationConfiguration
1287
1276
  },
1288
1277
  state: replyContext.state,
1289
1278
  observers: {
@@ -1301,10 +1290,6 @@ function createResumeReplyContext(args, statusSession, delivery) {
1301
1290
  sandboxRef
1302
1291
  });
1303
1292
  await replyContext.durability?.onSandboxRefChanged?.(sandboxRef);
1304
- },
1305
- onArtifactStateUpdated: async (artifacts) => {
1306
- await persistThreadStateById(threadId, { artifacts });
1307
- await replyContext.durability?.onArtifactStateUpdated?.(artifacts);
1308
1293
  }
1309
1294
  }
1310
1295
  };
@@ -1428,15 +1413,17 @@ async function resumeSlackTurnInContext(args) {
1428
1413
  }
1429
1414
  failureCode = "delivery_failed";
1430
1415
  const deliveryState2 = await getDeliveryConversation();
1431
- let slackMessageTs;
1416
+ let slackMessageTs = [];
1432
1417
  try {
1433
- slackMessageTs = await sendSlackReply({
1434
- channelId: runArgs.channelId,
1435
- conversationId: runArgs.conversationId,
1436
- replyAttribution: runArgs.replyContext?.routing.dispatch?.replyAttribution,
1437
- text,
1438
- threadTs: runArgs.threadTs
1439
- });
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
+ }
1440
1427
  } catch (error) {
1441
1428
  if (isRetryableSlackPostError(error)) {
1442
1429
  throw new RetryableDeliveryError(error);
@@ -1885,10 +1872,8 @@ async function persistCompletedReplyState(channelId, threadTs, sessionId, reply)
1885
1872
  const currentState = await getPersistedThreadState(threadId);
1886
1873
  const conversation = coerceThreadConversationState(currentState);
1887
1874
  await hydrateConversationMessages({ conversation, conversationId: threadId });
1888
- const artifacts = coerceThreadArtifactsState(currentState);
1889
1875
  const userMessage = getTurnUserMessage(conversation, sessionId);
1890
1876
  const statePatch = buildDeliveredTurnStatePatch({
1891
- artifacts,
1892
1877
  conversation,
1893
1878
  reply,
1894
1879
  sessionId,
@@ -1994,7 +1979,6 @@ async function resumeAuthorizedMcpTurn(args) {
1994
1979
  conversation: lockedConversation,
1995
1980
  conversationId: threadId
1996
1981
  });
1997
- const lockedArtifacts = coerceThreadArtifactsState(lockedState);
1998
1982
  const lockedPendingAuth = getConversationPendingAuth({
1999
1983
  conversation: lockedConversation,
2000
1984
  kind: "mcp",
@@ -2040,9 +2024,7 @@ async function resumeAuthorizedMcpTurn(args) {
2040
2024
  excludeMessageId: lockedUserMessage.id
2041
2025
  }
2042
2026
  );
2043
- const lockedChannelConfiguration = getChannelConfigurationServiceById(
2044
- authSession.channelId
2045
- );
2027
+ const lockedLocationConfiguration = getLocationConfigurationService(destination);
2046
2028
  let actor;
2047
2029
  try {
2048
2030
  actor = createSlackResumeActor({
@@ -2103,14 +2085,13 @@ async function resumeAuthorizedMcpTurn(args) {
2103
2085
  actor,
2104
2086
  destination,
2105
2087
  source: routing.source,
2106
- toolChannelId: authSession.toolChannelId ?? lockedArtifacts.assistantContextChannelId ?? authSession.channelId
2088
+ toolChannelId: authSession.toolChannelId ?? authSession.channelId
2107
2089
  },
2108
2090
  policy: {
2109
2091
  configuration: authSession.configuration,
2110
- channelConfiguration: lockedChannelConfiguration
2092
+ locationConfiguration: lockedLocationConfiguration
2111
2093
  },
2112
2094
  state: {
2113
- artifactState: lockedArtifacts,
2114
2095
  pendingAuth: lockedPendingAuth,
2115
2096
  sandboxRef: getPersistedSandboxState(lockedState)
2116
2097
  },
@@ -2487,10 +2468,8 @@ async function persistCompletedOAuthReplyState(args) {
2487
2468
  conversation,
2488
2469
  conversationId: args.conversationId
2489
2470
  });
2490
- const artifacts = coerceThreadArtifactsState(currentState);
2491
2471
  const userMessage = getTurnUserMessage(conversation, args.sessionId);
2492
2472
  const statePatch = buildDeliveredTurnStatePatch({
2493
- artifacts,
2494
2473
  conversation,
2495
2474
  reply: args.reply,
2496
2475
  sessionId: args.sessionId,
@@ -2624,7 +2603,6 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
2624
2603
  conversation: lockedConversation,
2625
2604
  conversationId: stored.resumeConversationId
2626
2605
  });
2627
- const lockedArtifacts = coerceThreadArtifactsState(lockedState);
2628
2606
  const lockedPendingAuth = getConversationPendingAuth({
2629
2607
  conversation: lockedConversation,
2630
2608
  kind: "plugin",
@@ -2672,9 +2650,7 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
2672
2650
  excludeMessageId: lockedUserMessage.id
2673
2651
  }
2674
2652
  );
2675
- const lockedChannelConfiguration = getChannelConfigurationServiceById(
2676
- stored.channelId
2677
- );
2653
+ const lockedLocationConfiguration = getLocationConfigurationService(destination);
2678
2654
  let actor;
2679
2655
  try {
2680
2656
  actor = createSlackResumeActor({
@@ -2740,13 +2716,12 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
2740
2716
  actor,
2741
2717
  destination,
2742
2718
  source: routing.source,
2743
- toolChannelId: lockedArtifacts.assistantContextChannelId ?? stored.channelId
2719
+ toolChannelId: stored.channelId
2744
2720
  },
2745
2721
  policy: {
2746
- channelConfiguration: lockedChannelConfiguration
2722
+ locationConfiguration: lockedLocationConfiguration
2747
2723
  },
2748
2724
  state: {
2749
- artifactState: lockedArtifacts,
2750
2725
  pendingAuth: lockedPendingAuth,
2751
2726
  sandboxRef: getPersistedSandboxState(lockedState)
2752
2727
  },
@@ -2974,27 +2949,61 @@ async function GET2(request, provider, waitUntil, options) {
2974
2949
  ...parsedTokenResponse,
2975
2950
  ...account ? { account } : {}
2976
2951
  });
2977
- if (stored.resumeConversationId) {
2978
- try {
2979
- await recordAuthenticationLinked({
2980
- conversationId: stored.resumeConversationId,
2981
- provider,
2982
- actorId: stored.userId,
2983
- providerLabel,
2984
- ...account?.label ? { accountLabel: account.label } : {},
2985
- ...stored.resumeSessionId ? {
2986
- authorizationId: pluginAuthorizationId({
2987
- provider,
2988
- sessionId: stored.resumeSessionId
2989
- }),
2990
- turnId: stored.resumeSessionId
2991
- } : {}
2992
- });
2993
- } catch (error) {
2994
- logException(error, "oauth.callback.authentication_event.failed", {
2995
- "app.credential.provider": provider
2996
- });
2997
- }
2952
+ const slackActor = stored.actor?.platform === "slack" ? stored.actor : void 0;
2953
+ if (account && slackActor) {
2954
+ await runBestEffort(
2955
+ async () => {
2956
+ const slackUserId = parseSlackUserId(slackActor.userId);
2957
+ if (!slackUserId) {
2958
+ throw new Error("OAuth Slack actor user id is invalid");
2959
+ }
2960
+ const profile = await lookupSlackUserProfile(slackUserId);
2961
+ const slackIdentity = await upsertIdentity(getSqlExecutor(), {
2962
+ kind: "user",
2963
+ provider: "slack",
2964
+ providerTenantId: slackActor.teamId,
2965
+ providerSubjectId: profile.id,
2966
+ displayName: profile.real_name || profile.display_name,
2967
+ handle: profile.name,
2968
+ ...profile.email ? { email: profile.email, emailVerified: true } : {}
2969
+ });
2970
+ if (!slackIdentity.userId) {
2971
+ throw new Error("OAuth Slack identity is not linked to a user");
2972
+ }
2973
+ await upsertLinkedIdentity(getSqlExecutor(), slackIdentity.userId, {
2974
+ kind: "user",
2975
+ provider,
2976
+ providerSubjectId: account.id,
2977
+ displayName: account.displayName,
2978
+ handle: account.handle ?? account.label
2979
+ });
2980
+ },
2981
+ "oauth.callback.identity_link.failed",
2982
+ { "app.credential.provider": provider }
2983
+ );
2984
+ }
2985
+ const resumeConversationId = stored.resumeConversationId;
2986
+ if (resumeConversationId) {
2987
+ await runBestEffort(
2988
+ async () => {
2989
+ await recordAuthenticationLinked({
2990
+ conversationId: resumeConversationId,
2991
+ provider,
2992
+ actorId: stored.userId,
2993
+ providerLabel,
2994
+ ...account?.label ? { accountLabel: account.label } : {},
2995
+ ...stored.resumeSessionId ? {
2996
+ authorizationId: pluginAuthorizationId({
2997
+ provider,
2998
+ sessionId: stored.resumeSessionId
2999
+ }),
3000
+ turnId: stored.resumeSessionId
3001
+ } : {}
3002
+ });
3003
+ },
3004
+ "oauth.callback.authentication_event.failed",
3005
+ { "app.credential.provider": provider }
3006
+ );
2998
3007
  }
2999
3008
  if (stored.destination?.platform !== "local") {
3000
3009
  waitUntil(async () => {
@@ -3155,8 +3164,6 @@ export {
3155
3164
  shouldKeepProcessingReactionForToolInvocation,
3156
3165
  startSlackProcessingReaction,
3157
3166
  buildAuthPauseResponse,
3158
- getTurnRequestDeadline,
3159
- runWithTurnRequestDeadline,
3160
3167
  resumeSlackTurn,
3161
3168
  getPausedTurnRequest,
3162
3169
  wakePausedTurn,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-EM225ITJ.js";
4
4
  import {
5
5
  getSlackBotToken
6
- } from "./chunk-MKRIZ4VG.js";
6
+ } from "./chunk-4GXJUYJV.js";
7
7
  import {
8
8
  parseSlackChannelReferenceId
9
9
  } from "./chunk-F3B2YJ76.js";
@@ -12,7 +12,7 @@ import {
12
12
  setSpanAttributes,
13
13
  setSpanStatus,
14
14
  withSpan
15
- } from "./chunk-B63BF443.js";
15
+ } from "./chunk-EAI67NTM.js";
16
16
 
17
17
  // src/chat/slack/client.ts
18
18
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";