@sentry/junior 0.145.0 → 0.147.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.
- package/dist/{agent-hooks-L7D2BDVV.js → agent-hooks-HS6VGUPM.js} +10 -10
- package/dist/api/conversations/detail.d.ts +1 -0
- package/dist/api/conversations/event-list.d.ts +1 -0
- package/dist/api/schema/conversation.d.ts +4 -0
- package/dist/api/schema.js +1 -1
- package/dist/api.js +26 -22
- package/dist/app.js +285 -290
- package/dist/{catalog-runtime-QLAC4Q3W.js → catalog-runtime-M6ZTPYRV.js} +5 -5
- package/dist/chat/agent/prompt.d.ts +0 -2
- package/dist/chat/agent/request.d.ts +2 -5
- package/dist/chat/agent/resume.d.ts +0 -3
- package/dist/chat/agent/sandbox.d.ts +2 -2
- package/dist/chat/agent/skills.d.ts +0 -1
- package/dist/chat/agent/tools.d.ts +0 -3
- package/dist/chat/agent-dispatch/types.d.ts +2 -2
- package/dist/chat/capabilities/jr-rpc-command.d.ts +2 -2
- package/dist/chat/configuration/service.d.ts +5 -2
- package/dist/chat/configuration/sql.d.ts +9 -0
- package/dist/chat/configuration/types.d.ts +17 -13
- package/dist/chat/conversations/history.d.ts +3 -0
- package/dist/chat/conversations/message-search.d.ts +32 -0
- package/dist/chat/conversations/projection.d.ts +10 -0
- package/dist/chat/conversations/sql/message-search.d.ts +4 -0
- package/dist/chat/conversations/tool-source.d.ts +5 -0
- package/dist/chat/credentials/unlink-provider.d.ts +2 -1
- package/dist/chat/credentials/user-token-store.d.ts +2 -0
- package/dist/chat/db.d.ts +2 -2
- package/dist/chat/event-tasks/tool-support.d.ts +2 -0
- package/dist/chat/identities/sql.d.ts +8 -0
- package/dist/chat/logging.d.ts +2 -0
- package/dist/chat/mcp/auth-store.d.ts +0 -2
- package/dist/chat/mcp/oauth.d.ts +0 -2
- package/dist/chat/oauth-flow.d.ts +3 -1
- package/dist/chat/pi/client.d.ts +2 -0
- package/dist/chat/plugins/credential-hooks.d.ts +2 -0
- package/dist/chat/prompt.d.ts +0 -2
- package/dist/chat/resource-events/notification.d.ts +2 -1
- package/dist/chat/runtime/delivered-turn-state.d.ts +1 -4
- package/dist/chat/runtime/thread-state.d.ts +8 -11
- package/dist/chat/runtime/turn-input.d.ts +4 -2
- package/dist/chat/runtime/turn-preparation.d.ts +2 -4
- package/dist/chat/sandbox/command-result.d.ts +2 -0
- package/dist/chat/sandbox/egress/schemas.d.ts +6 -0
- package/dist/chat/scheduled-tasks/tool-support.d.ts +2 -0
- package/dist/chat/scheduled-tasks/tools/create.d.ts +2 -0
- package/dist/chat/scheduled-tasks/tools/delete.d.ts +2 -0
- package/dist/chat/scheduled-tasks/tools/list.d.ts +2 -0
- package/dist/chat/scheduled-tasks/tools/run-now.d.ts +2 -0
- package/dist/chat/scheduled-tasks/tools/update.d.ts +2 -0
- package/dist/chat/services/mcp-auth-orchestration.d.ts +0 -3
- package/dist/chat/services/plugin-auth-orchestration.d.ts +2 -1
- package/dist/chat/services/provider-default-config.d.ts +2 -2
- package/dist/chat/services/subscribed-decision.d.ts +3 -0
- package/dist/chat/services/subscribed-reply-policy.d.ts +1 -0
- package/dist/chat/services/turn-result.d.ts +0 -3
- package/dist/chat/services/turn-router.d.ts +3 -0
- package/dist/chat/slack/assistant-thread/lifecycle.d.ts +0 -1
- package/dist/chat/slack/assistant-thread/title.d.ts +0 -3
- package/dist/chat/slack/dispatch-turn.d.ts +1 -1
- package/dist/chat/slack/message/attachments.d.ts +2 -0
- package/dist/chat/slack/message/blocks.d.ts +2 -0
- package/dist/chat/slack/message/content.d.ts +18 -0
- package/dist/chat/slack/message/identity.d.ts +7 -0
- package/dist/chat/slack/tools/canvas/context.d.ts +0 -10
- package/dist/chat/slack/tools/canvas/create.d.ts +2 -0
- package/dist/chat/slack/tools/canvas/edit.d.ts +2 -0
- package/dist/chat/slack/tools/canvas/read.d.ts +2 -0
- package/dist/chat/slack/tools/canvas/write.d.ts +2 -0
- package/dist/chat/slack/tools/channel-list-messages.d.ts +2 -0
- package/dist/chat/slack/tools/{conversation-search.d.ts → conversation-message-search.d.ts} +23 -14
- package/dist/chat/slack/tools/list/add-items.d.ts +4 -1
- package/dist/chat/slack/tools/list/api.d.ts +8 -1
- package/dist/chat/slack/tools/list/create.d.ts +2 -0
- package/dist/chat/slack/tools/list/get-items.d.ts +5 -3
- package/dist/chat/slack/tools/list/update-item.d.ts +5 -1
- package/dist/chat/slack/tools/message-add-reaction.d.ts +2 -0
- package/dist/chat/slack/tools/public-search.d.ts +2 -0
- package/dist/chat/slack/tools/send-files.d.ts +2 -0
- package/dist/chat/slack/tools/thread-read.d.ts +2 -0
- package/dist/chat/slack/vision-cache.d.ts +5 -0
- package/dist/chat/state/conversation.d.ts +4 -5
- package/dist/chat/task-execution/checkpoint.d.ts +1 -3
- package/dist/chat/task-execution/turn-cursor.d.ts +0 -9
- package/dist/chat/tool-support/structured-result.d.ts +1 -0
- package/dist/chat/tool-support/timed-out-tool-result.d.ts +11 -0
- package/dist/chat/tools/create-event-task.d.ts +2 -0
- package/dist/chat/tools/delete-event-task.d.ts +2 -0
- package/dist/chat/tools/handoff/tool.d.ts +2 -0
- package/dist/chat/tools/list-event-tasks.d.ts +2 -0
- package/dist/chat/tools/list-resource-event-subscriptions.d.ts +2 -0
- package/dist/chat/tools/runtime/report-progress.d.ts +2 -0
- package/dist/chat/tools/runtime/spawn-agent.d.ts +2 -0
- package/dist/chat/tools/{query-conversation-events.d.ts → search-conversation-events.d.ts} +5 -3
- package/dist/chat/tools/search-resource-event-types.d.ts +2 -0
- package/dist/chat/tools/search-tools.d.ts +2 -0
- package/dist/chat/tools/skill/load-skill.d.ts +2 -0
- package/dist/chat/tools/skill/search-mcp-tools.d.ts +2 -0
- package/dist/chat/tools/stop-watching-resources.d.ts +2 -0
- package/dist/chat/tools/system-time.d.ts +2 -0
- package/dist/chat/tools/types.d.ts +0 -6
- package/dist/chat/tools/update-event-task.d.ts +2 -0
- package/dist/chat/tools/user-lookup.d.ts +29 -0
- package/dist/chat/tools/watch-resource-events.d.ts +2 -0
- package/dist/chat/tools/web/fetch-tool.d.ts +2 -0
- package/dist/chat/tools/web/image-generate.d.ts +2 -0
- package/dist/chat/tools/web/search.d.ts +2 -0
- package/dist/{chunk-PJ4NMVQB.js → chunk-34GS7B6L.js} +2 -2
- package/dist/{chunk-2LWPFSB4.js → chunk-4LJO56OJ.js} +9 -1
- package/dist/{chunk-QJBDABQA.js → chunk-6H5SZR24.js} +16 -20
- package/dist/{chunk-LVVSIMBB.js → chunk-745QJ3ZA.js} +1 -1
- package/dist/{chunk-64SBYW2O.js → chunk-7A4M7PCV.js} +613 -561
- package/dist/{chunk-XFKIRN3Q.js → chunk-7NVJVJID.js} +4 -3
- package/dist/{chunk-FUBRJA5F.js → chunk-7UQIVT6G.js} +13 -6
- package/dist/{chunk-ZIAMN2UW.js → chunk-AIOK6LAG.js} +40 -513
- package/dist/{chunk-EIX2LQ6L.js → chunk-AVOCH2Z5.js} +3 -3
- package/dist/{chunk-GUWLDMGF.js → chunk-AVZDSUFB.js} +4 -4
- package/dist/{chunk-2XET6PKP.js → chunk-AYU72WO7.js} +102 -73
- package/dist/chunk-AZ7EAOBE.js +566 -0
- package/dist/{chunk-DXEQAIUV.js → chunk-CSZINQJ2.js} +1 -1
- package/dist/{chunk-HLOUZC5C.js → chunk-CWP5RHVX.js} +4 -4
- package/dist/{chunk-DS3J6WGY.js → chunk-DLDRQHG5.js} +1 -1
- package/dist/{chunk-27TEJTZO.js → chunk-DU74WPIC.js} +55 -37
- package/dist/{chunk-YD54Q45G.js → chunk-EFLJ2WJH.js} +6 -4
- package/dist/{chunk-CD2XFGYQ.js → chunk-GGB4WL5A.js} +1 -1
- package/dist/{chunk-GDV5LXRA.js → chunk-IIOOO4FQ.js} +1 -1
- package/dist/{chunk-SIN3MXH6.js → chunk-JUUKWRBE.js} +1 -1
- package/dist/{chunk-VTDMB7XX.js → chunk-K4SZAP3K.js} +1 -1
- package/dist/{chunk-QUG4JSZK.js → chunk-ORO3PWKQ.js} +1 -1
- package/dist/{chunk-RUSS62EN.js → chunk-PVNG6UMU.js} +3 -3
- package/dist/{chunk-I47UGQPJ.js → chunk-Q4R73I43.js} +365 -206
- package/dist/{chunk-JTGS3ZZE.js → chunk-RXBVB2JM.js} +1 -1
- package/dist/{chunk-TZRXYWRE.js → chunk-SGZO7UWH.js} +2 -2
- package/dist/{chunk-JLMVCNXL.js → chunk-SVHUEHUL.js} +1 -0
- package/dist/{chunk-B46ZMVOV.js → chunk-X5UY34KT.js} +6 -5
- package/dist/{chunk-5PNPQYTO.js → chunk-YBVXBNSV.js} +2 -2
- package/dist/{chunk-HISR3DTV.js → chunk-YEO3VX72.js} +10 -25
- package/dist/{chunk-ZIMRGFYL.js → chunk-YHDERDRO.js} +7 -6
- package/dist/{chunk-WF5HVH3M.js → chunk-YNTTROJT.js} +1 -1
- package/dist/{chunk-2UH3JI64.js → chunk-YSB2N563.js} +87 -34
- package/dist/{chunk-ZYAJMESY.js → chunk-Z4YU7Z4L.js} +3 -2
- package/dist/cli/chat.js +32 -32
- package/dist/cli/check.js +6 -6
- package/dist/cli/plugins.js +13 -13
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +7 -7
- package/dist/db/schema/location-configurations.d.ts +127 -0
- package/dist/db/schema.d.ts +128 -1
- package/dist/{db-62PW6LM3.js → db-CSEW4RII.js} +9 -9
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-6NZNHJAM.js → oauth-callback-server-FUEV5HNG.js} +24 -24
- package/dist/{runner-GCRPG3GQ.js → runner-U3XHSKSH.js} +21 -41
- package/dist/{skills-2S3MDFIQ.js → skills-AKE6W3WI.js} +6 -6
- package/dist/spawn-B6GDTWJ4.js +39 -0
- package/dist/{validation-HAOLCJ5A.js → validation-WDTAULUF.js} +6 -6
- package/dist/version.js +1 -1
- package/dist/{work-R4XYKMUW.js → work-C3HAO2BG.js} +17 -17
- package/dist/{worker-U2UCVR7M.js → worker-LNP4YKBM.js} +10 -10
- package/migrations/0024_misty_typhoid_mary.sql +12 -0
- package/migrations/meta/0024_snapshot.json +2275 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +4 -4
- package/dist/chat/conversations/search.d.ts +0 -24
- package/dist/chat/conversations/sql/search.d.ts +0 -4
- package/dist/chat/slack/legacy-attachments.d.ts +0 -4
- package/dist/chat/slack/message.d.ts +0 -12
- package/dist/chat/slack/tools/user-lookup.d.ts +0 -26
- package/dist/chat/state/artifacts.d.ts +0 -30
- package/dist/chat/tool-support/turn-deadline-result.d.ts +0 -3
- package/dist/chunk-Q6QZTTLS.js +0 -55
- package/dist/spawn-7WK37BTD.js +0 -39
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
ensureConversationWake,
|
|
6
6
|
requestConversationWork
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CWP5RHVX.js";
|
|
8
8
|
import {
|
|
9
9
|
buildConversationContext,
|
|
10
10
|
buildDeliveredTurnStatePatch,
|
|
@@ -21,10 +21,16 @@ import {
|
|
|
21
21
|
resolveTurnSessionRouting,
|
|
22
22
|
scheduleSessionCompletedPluginTasks,
|
|
23
23
|
turnHasReply
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-6H5SZR24.js";
|
|
25
25
|
import {
|
|
26
|
-
ConversationTurnLifecycleService
|
|
27
|
-
|
|
26
|
+
ConversationTurnLifecycleService,
|
|
27
|
+
coerceThreadConversationState,
|
|
28
|
+
configValueSchema,
|
|
29
|
+
getLocationConfigurationService,
|
|
30
|
+
getPersistedSandboxState,
|
|
31
|
+
getPersistedThreadState,
|
|
32
|
+
persistThreadStateById
|
|
33
|
+
} from "./chunk-AZ7EAOBE.js";
|
|
28
34
|
import {
|
|
29
35
|
buildSentryConversationUrl
|
|
30
36
|
} from "./chunk-4CODA7P5.js";
|
|
@@ -38,8 +44,9 @@ import {
|
|
|
38
44
|
getMcpAuthSession,
|
|
39
45
|
getMcpProviderErrorAttributes,
|
|
40
46
|
getMcpStoredOAuthCredentials,
|
|
47
|
+
lookupSlackUserProfile,
|
|
41
48
|
resolvePluginOAuthAccount
|
|
42
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-Q4R73I43.js";
|
|
43
50
|
import {
|
|
44
51
|
RetryableDeliveryError
|
|
45
52
|
} from "./chunk-R776HKPK.js";
|
|
@@ -55,59 +62,56 @@ import {
|
|
|
55
62
|
removeReactionFromMessage,
|
|
56
63
|
resolveBaseUrl,
|
|
57
64
|
truncateStatusText
|
|
58
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-7UQIVT6G.js";
|
|
59
66
|
import {
|
|
60
67
|
TurnSliceLimitExceededError,
|
|
61
68
|
abandonTurnRecord,
|
|
62
69
|
buildTurnLimitResponse,
|
|
63
70
|
clearPendingAuth,
|
|
64
|
-
coerceThreadArtifactsState,
|
|
65
|
-
coerceThreadConversationState,
|
|
66
71
|
commitAcceptedReply,
|
|
67
72
|
failTurnRecord,
|
|
68
73
|
getAssistantReplyText,
|
|
69
|
-
getChannelConfigurationServiceById,
|
|
70
74
|
getConversationPendingAuth,
|
|
71
|
-
getPersistedSandboxState,
|
|
72
|
-
getPersistedThreadState,
|
|
73
75
|
getTurnRecord,
|
|
74
76
|
hydrateConversationMessages,
|
|
75
77
|
isPendingAuthLatestRequest,
|
|
76
78
|
loadProjection,
|
|
77
79
|
loadTurnCheckpoint,
|
|
78
80
|
markTurnFailed,
|
|
79
|
-
persistThreadStateById,
|
|
80
81
|
persistWithRetry,
|
|
81
82
|
recordAuthenticationLinked,
|
|
82
83
|
recordAuthorizationCompleted,
|
|
83
84
|
recordTurnSummary,
|
|
84
85
|
saveTurnCheckpoint
|
|
85
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-AIOK6LAG.js";
|
|
86
87
|
import {
|
|
87
88
|
parseSlackThreadId,
|
|
88
89
|
readSlackRawMessageContext,
|
|
89
90
|
resolveSlackChannelIdFromMessage,
|
|
90
91
|
resolveSlackChannelIdFromThreadId
|
|
91
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-CSZINQJ2.js";
|
|
92
93
|
import {
|
|
93
94
|
getDashboardConversationLink,
|
|
94
95
|
getPluginSlackConversationLink
|
|
95
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-YHDERDRO.js";
|
|
96
97
|
import {
|
|
97
98
|
SlackActionError,
|
|
98
99
|
getHeaderString,
|
|
99
100
|
getSlackClient,
|
|
100
101
|
isDmChannel,
|
|
101
102
|
normalizeSlackConversationId
|
|
102
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-SGZO7UWH.js";
|
|
103
104
|
import {
|
|
104
105
|
getConversationEventStore,
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
getSqlExecutor,
|
|
107
|
+
requireSlackDestination,
|
|
108
|
+
upsertIdentity,
|
|
109
|
+
upsertLinkedIdentity
|
|
110
|
+
} from "./chunk-YSB2N563.js";
|
|
107
111
|
import {
|
|
108
112
|
acquireActiveLock,
|
|
109
113
|
getStateAdapter
|
|
110
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-ORO3PWKQ.js";
|
|
111
115
|
import {
|
|
112
116
|
FUNCTION_TIMEOUT_BUFFER_SECONDS,
|
|
113
117
|
botConfig,
|
|
@@ -116,34 +120,36 @@ import {
|
|
|
116
120
|
getRuntimeMetadata,
|
|
117
121
|
normalizeSlackEmojiName,
|
|
118
122
|
standardModelId
|
|
119
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-7NVJVJID.js";
|
|
120
124
|
import {
|
|
121
125
|
discoverSkills
|
|
122
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-YBVXBNSV.js";
|
|
123
127
|
import {
|
|
124
128
|
pluginCatalogRuntime
|
|
125
|
-
} from "./chunk-
|
|
129
|
+
} from "./chunk-JUUKWRBE.js";
|
|
126
130
|
import {
|
|
127
131
|
buildOAuthTokenRequest,
|
|
128
132
|
hasRequiredOAuthScope,
|
|
129
133
|
parseOAuthTokenResponse
|
|
130
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-GGB4WL5A.js";
|
|
131
135
|
import {
|
|
132
136
|
createSlackResumeActor,
|
|
133
137
|
isUserActor
|
|
134
138
|
} from "./chunk-HZF5P5UN.js";
|
|
135
139
|
import {
|
|
136
|
-
parseSlackMessageTs
|
|
140
|
+
parseSlackMessageTs,
|
|
141
|
+
parseSlackUserId
|
|
137
142
|
} from "./chunk-F3B2YJ76.js";
|
|
138
143
|
import {
|
|
139
144
|
buildTurnFailureResponse,
|
|
140
145
|
logException,
|
|
141
146
|
logInfo,
|
|
142
147
|
logWarn,
|
|
148
|
+
runBestEffort,
|
|
143
149
|
setTags,
|
|
144
150
|
toOptionalString,
|
|
145
151
|
withLogContext
|
|
146
|
-
} from "./chunk-
|
|
152
|
+
} from "./chunk-4LJO56OJ.js";
|
|
147
153
|
import {
|
|
148
154
|
homeDir
|
|
149
155
|
} from "./chunk-H4HBKISO.js";
|
|
@@ -1125,11 +1131,17 @@ async function postSlackMessageBestEffort(channelId, threadTs, text, conversatio
|
|
|
1125
1131
|
} catch {
|
|
1126
1132
|
}
|
|
1127
1133
|
}
|
|
1128
|
-
function createReadOnlyConfigService(
|
|
1134
|
+
function createReadOnlyConfigService(rawValues) {
|
|
1135
|
+
const values = Object.fromEntries(
|
|
1136
|
+
Object.entries(rawValues).map(([key, value]) => [
|
|
1137
|
+
key,
|
|
1138
|
+
configValueSchema.parse(value)
|
|
1139
|
+
])
|
|
1140
|
+
);
|
|
1129
1141
|
const entries = Object.entries(values).map(([key, value]) => ({
|
|
1130
1142
|
key,
|
|
1131
1143
|
value,
|
|
1132
|
-
scope: "
|
|
1144
|
+
scope: "location",
|
|
1133
1145
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1134
1146
|
}));
|
|
1135
1147
|
return {
|
|
@@ -1264,7 +1276,7 @@ function createResumeReplyContext(args, statusSession, delivery) {
|
|
|
1264
1276
|
}
|
|
1265
1277
|
const requestDeadline = getTurnRequestDeadline();
|
|
1266
1278
|
const threadId = args.lockKey ?? getDefaultLockKey(args.channelId, args.threadTs);
|
|
1267
|
-
const
|
|
1279
|
+
const persistedLocationConfiguration = replyContext.policy?.locationConfiguration ?? (replyContext.policy?.configuration ? createReadOnlyConfigService(replyContext.policy.configuration) : void 0);
|
|
1268
1280
|
return {
|
|
1269
1281
|
conversationId: args.conversationId,
|
|
1270
1282
|
turnId: args.turnId,
|
|
@@ -1283,7 +1295,7 @@ function createResumeReplyContext(args, statusSession, delivery) {
|
|
|
1283
1295
|
policy: {
|
|
1284
1296
|
...replyContext.policy,
|
|
1285
1297
|
turnDeadlineAtMs: replyContext.policy?.turnDeadlineAtMs ?? requestDeadline?.deadlineAtMs,
|
|
1286
|
-
|
|
1298
|
+
locationConfiguration: persistedLocationConfiguration
|
|
1287
1299
|
},
|
|
1288
1300
|
state: replyContext.state,
|
|
1289
1301
|
observers: {
|
|
@@ -1301,10 +1313,6 @@ function createResumeReplyContext(args, statusSession, delivery) {
|
|
|
1301
1313
|
sandboxRef
|
|
1302
1314
|
});
|
|
1303
1315
|
await replyContext.durability?.onSandboxRefChanged?.(sandboxRef);
|
|
1304
|
-
},
|
|
1305
|
-
onArtifactStateUpdated: async (artifacts) => {
|
|
1306
|
-
await persistThreadStateById(threadId, { artifacts });
|
|
1307
|
-
await replyContext.durability?.onArtifactStateUpdated?.(artifacts);
|
|
1308
1316
|
}
|
|
1309
1317
|
}
|
|
1310
1318
|
};
|
|
@@ -1597,7 +1605,6 @@ async function resumeSlackTurnInContext(args) {
|
|
|
1597
1605
|
conversationId: runArgs.conversationId,
|
|
1598
1606
|
turnId: runArgs.turnId,
|
|
1599
1607
|
messages: reply.piMessages,
|
|
1600
|
-
modelId: reply.diagnostics.modelId,
|
|
1601
1608
|
durationMs: reply.diagnostics.durationMs,
|
|
1602
1609
|
usage: reply.diagnostics.usage,
|
|
1603
1610
|
destination: replyContext.routing.destination,
|
|
@@ -1886,10 +1893,8 @@ async function persistCompletedReplyState(channelId, threadTs, sessionId, reply)
|
|
|
1886
1893
|
const currentState = await getPersistedThreadState(threadId);
|
|
1887
1894
|
const conversation = coerceThreadConversationState(currentState);
|
|
1888
1895
|
await hydrateConversationMessages({ conversation, conversationId: threadId });
|
|
1889
|
-
const artifacts = coerceThreadArtifactsState(currentState);
|
|
1890
1896
|
const userMessage = getTurnUserMessage(conversation, sessionId);
|
|
1891
1897
|
const statePatch = buildDeliveredTurnStatePatch({
|
|
1892
|
-
artifacts,
|
|
1893
1898
|
conversation,
|
|
1894
1899
|
reply,
|
|
1895
1900
|
sessionId,
|
|
@@ -1995,7 +2000,6 @@ async function resumeAuthorizedMcpTurn(args) {
|
|
|
1995
2000
|
conversation: lockedConversation,
|
|
1996
2001
|
conversationId: threadId
|
|
1997
2002
|
});
|
|
1998
|
-
const lockedArtifacts = coerceThreadArtifactsState(lockedState);
|
|
1999
2003
|
const lockedPendingAuth = getConversationPendingAuth({
|
|
2000
2004
|
conversation: lockedConversation,
|
|
2001
2005
|
kind: "mcp",
|
|
@@ -2041,9 +2045,7 @@ async function resumeAuthorizedMcpTurn(args) {
|
|
|
2041
2045
|
excludeMessageId: lockedUserMessage.id
|
|
2042
2046
|
}
|
|
2043
2047
|
);
|
|
2044
|
-
const
|
|
2045
|
-
authSession.channelId
|
|
2046
|
-
);
|
|
2048
|
+
const lockedLocationConfiguration = getLocationConfigurationService(destination);
|
|
2047
2049
|
let actor;
|
|
2048
2050
|
try {
|
|
2049
2051
|
actor = createSlackResumeActor({
|
|
@@ -2104,14 +2106,13 @@ async function resumeAuthorizedMcpTurn(args) {
|
|
|
2104
2106
|
actor,
|
|
2105
2107
|
destination,
|
|
2106
2108
|
source: routing.source,
|
|
2107
|
-
toolChannelId: authSession.toolChannelId ??
|
|
2109
|
+
toolChannelId: authSession.toolChannelId ?? authSession.channelId
|
|
2108
2110
|
},
|
|
2109
2111
|
policy: {
|
|
2110
2112
|
configuration: authSession.configuration,
|
|
2111
|
-
|
|
2113
|
+
locationConfiguration: lockedLocationConfiguration
|
|
2112
2114
|
},
|
|
2113
2115
|
state: {
|
|
2114
|
-
artifactState: lockedArtifacts,
|
|
2115
2116
|
pendingAuth: lockedPendingAuth,
|
|
2116
2117
|
sandboxRef: getPersistedSandboxState(lockedState)
|
|
2117
2118
|
},
|
|
@@ -2488,10 +2489,8 @@ async function persistCompletedOAuthReplyState(args) {
|
|
|
2488
2489
|
conversation,
|
|
2489
2490
|
conversationId: args.conversationId
|
|
2490
2491
|
});
|
|
2491
|
-
const artifacts = coerceThreadArtifactsState(currentState);
|
|
2492
2492
|
const userMessage = getTurnUserMessage(conversation, args.sessionId);
|
|
2493
2493
|
const statePatch = buildDeliveredTurnStatePatch({
|
|
2494
|
-
artifacts,
|
|
2495
2494
|
conversation,
|
|
2496
2495
|
reply: args.reply,
|
|
2497
2496
|
sessionId: args.sessionId,
|
|
@@ -2625,7 +2624,6 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
|
|
|
2625
2624
|
conversation: lockedConversation,
|
|
2626
2625
|
conversationId: stored.resumeConversationId
|
|
2627
2626
|
});
|
|
2628
|
-
const lockedArtifacts = coerceThreadArtifactsState(lockedState);
|
|
2629
2627
|
const lockedPendingAuth = getConversationPendingAuth({
|
|
2630
2628
|
conversation: lockedConversation,
|
|
2631
2629
|
kind: "plugin",
|
|
@@ -2673,9 +2671,7 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
|
|
|
2673
2671
|
excludeMessageId: lockedUserMessage.id
|
|
2674
2672
|
}
|
|
2675
2673
|
);
|
|
2676
|
-
const
|
|
2677
|
-
stored.channelId
|
|
2678
|
-
);
|
|
2674
|
+
const lockedLocationConfiguration = getLocationConfigurationService(destination);
|
|
2679
2675
|
let actor;
|
|
2680
2676
|
try {
|
|
2681
2677
|
actor = createSlackResumeActor({
|
|
@@ -2741,13 +2737,12 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
|
|
|
2741
2737
|
actor,
|
|
2742
2738
|
destination,
|
|
2743
2739
|
source: routing.source,
|
|
2744
|
-
toolChannelId:
|
|
2740
|
+
toolChannelId: stored.channelId
|
|
2745
2741
|
},
|
|
2746
2742
|
policy: {
|
|
2747
|
-
|
|
2743
|
+
locationConfiguration: lockedLocationConfiguration
|
|
2748
2744
|
},
|
|
2749
2745
|
state: {
|
|
2750
|
-
artifactState: lockedArtifacts,
|
|
2751
2746
|
pendingAuth: lockedPendingAuth,
|
|
2752
2747
|
sandboxRef: getPersistedSandboxState(lockedState)
|
|
2753
2748
|
},
|
|
@@ -2975,27 +2970,61 @@ async function GET2(request, provider, waitUntil, options) {
|
|
|
2975
2970
|
...parsedTokenResponse,
|
|
2976
2971
|
...account ? { account } : {}
|
|
2977
2972
|
});
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2973
|
+
const slackActor = stored.actor?.platform === "slack" ? stored.actor : void 0;
|
|
2974
|
+
if (account && slackActor) {
|
|
2975
|
+
await runBestEffort(
|
|
2976
|
+
async () => {
|
|
2977
|
+
const slackUserId = parseSlackUserId(slackActor.userId);
|
|
2978
|
+
if (!slackUserId) {
|
|
2979
|
+
throw new Error("OAuth Slack actor user id is invalid");
|
|
2980
|
+
}
|
|
2981
|
+
const profile = await lookupSlackUserProfile(slackUserId);
|
|
2982
|
+
const slackIdentity = await upsertIdentity(getSqlExecutor(), {
|
|
2983
|
+
kind: "user",
|
|
2984
|
+
provider: "slack",
|
|
2985
|
+
providerTenantId: slackActor.teamId,
|
|
2986
|
+
providerSubjectId: profile.id,
|
|
2987
|
+
displayName: profile.real_name || profile.display_name,
|
|
2988
|
+
handle: profile.name,
|
|
2989
|
+
...profile.email ? { email: profile.email, emailVerified: true } : {}
|
|
2990
|
+
});
|
|
2991
|
+
if (!slackIdentity.userId) {
|
|
2992
|
+
throw new Error("OAuth Slack identity is not linked to a user");
|
|
2993
|
+
}
|
|
2994
|
+
await upsertLinkedIdentity(getSqlExecutor(), slackIdentity.userId, {
|
|
2995
|
+
kind: "user",
|
|
2996
|
+
provider,
|
|
2997
|
+
providerSubjectId: account.id,
|
|
2998
|
+
displayName: account.displayName,
|
|
2999
|
+
handle: account.handle ?? account.label
|
|
3000
|
+
});
|
|
3001
|
+
},
|
|
3002
|
+
"oauth.callback.identity_link.failed",
|
|
3003
|
+
{ "app.credential.provider": provider }
|
|
3004
|
+
);
|
|
3005
|
+
}
|
|
3006
|
+
const resumeConversationId = stored.resumeConversationId;
|
|
3007
|
+
if (resumeConversationId) {
|
|
3008
|
+
await runBestEffort(
|
|
3009
|
+
async () => {
|
|
3010
|
+
await recordAuthenticationLinked({
|
|
3011
|
+
conversationId: resumeConversationId,
|
|
3012
|
+
provider,
|
|
3013
|
+
actorId: stored.userId,
|
|
3014
|
+
providerLabel,
|
|
3015
|
+
...account?.label ? { accountLabel: account.label } : {},
|
|
3016
|
+
...stored.resumeSessionId ? {
|
|
3017
|
+
authorizationId: pluginAuthorizationId({
|
|
3018
|
+
provider,
|
|
3019
|
+
sessionId: stored.resumeSessionId
|
|
3020
|
+
}),
|
|
3021
|
+
turnId: stored.resumeSessionId
|
|
3022
|
+
} : {}
|
|
3023
|
+
});
|
|
3024
|
+
},
|
|
3025
|
+
"oauth.callback.authentication_event.failed",
|
|
3026
|
+
{ "app.credential.provider": provider }
|
|
3027
|
+
);
|
|
2999
3028
|
}
|
|
3000
3029
|
if (stored.destination?.platform !== "local") {
|
|
3001
3030
|
waitUntil(async () => {
|