@sentry/junior 0.146.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-SLJADYE5.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 +220 -238
- package/dist/{catalog-runtime-RQIMSDPR.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/sandbox.d.ts +2 -2
- package/dist/chat/agent/tools.d.ts +0 -2
- 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/projection.d.ts +10 -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/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/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-message-search.d.ts +2 -0
- 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/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/search-conversation-events.d.ts +2 -0
- 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-LVW7BLLT.js → chunk-34GS7B6L.js} +2 -2
- package/dist/{chunk-B63BF443.js → chunk-4LJO56OJ.js} +9 -1
- package/dist/{chunk-H6U2U3EP.js → chunk-6H5SZR24.js} +16 -20
- package/dist/{chunk-M6ZWP4RI.js → chunk-745QJ3ZA.js} +1 -1
- package/dist/{chunk-BLETMLRX.js → chunk-7A4M7PCV.js} +231 -472
- package/dist/{chunk-MKRIZ4VG.js → chunk-7NVJVJID.js} +4 -2
- package/dist/{chunk-ZDGHGY74.js → chunk-7UQIVT6G.js} +13 -6
- package/dist/{chunk-GDQEU4I7.js → chunk-AIOK6LAG.js} +28 -489
- package/dist/{chunk-QSXZ42KX.js → chunk-AVOCH2Z5.js} +3 -3
- package/dist/{chunk-FXDDDSPL.js → chunk-AVZDSUFB.js} +4 -4
- package/dist/{chunk-OFPYOC3M.js → chunk-AYU72WO7.js} +102 -72
- package/dist/chunk-AZ7EAOBE.js +566 -0
- package/dist/{chunk-PH4Q3A6W.js → chunk-CSZINQJ2.js} +1 -1
- package/dist/{chunk-X2WMBTS3.js → chunk-CWP5RHVX.js} +4 -4
- package/dist/{chunk-HQE6EJS5.js → chunk-DLDRQHG5.js} +1 -1
- package/dist/{chunk-MCFIXAV5.js → chunk-DU74WPIC.js} +55 -37
- package/dist/{chunk-X22KCSCO.js → chunk-EFLJ2WJH.js} +6 -4
- package/dist/{chunk-37JJDS4H.js → chunk-GGB4WL5A.js} +1 -1
- package/dist/{chunk-F7REGDKO.js → chunk-IIOOO4FQ.js} +1 -1
- package/dist/{chunk-PB222GIA.js → chunk-JUUKWRBE.js} +1 -1
- package/dist/{chunk-T5GXFFLA.js → chunk-K4SZAP3K.js} +1 -1
- package/dist/{chunk-GYEKOX7N.js → chunk-ORO3PWKQ.js} +1 -1
- package/dist/{chunk-AISNSNDV.js → chunk-PVNG6UMU.js} +3 -3
- package/dist/{chunk-47OSH2ZO.js → chunk-Q4R73I43.js} +365 -206
- package/dist/{chunk-QG7OOKIN.js → chunk-RXBVB2JM.js} +1 -1
- package/dist/{chunk-V6SRLKUB.js → chunk-SGZO7UWH.js} +2 -2
- package/dist/{chunk-JLMVCNXL.js → chunk-SVHUEHUL.js} +1 -0
- package/dist/{chunk-FEKQHPVA.js → chunk-X5UY34KT.js} +6 -5
- package/dist/{chunk-FGHADGIC.js → chunk-YBVXBNSV.js} +2 -2
- package/dist/{chunk-JUA6VU2Z.js → chunk-YEO3VX72.js} +10 -23
- package/dist/{chunk-SCGVWUZX.js → chunk-YHDERDRO.js} +7 -6
- package/dist/{chunk-TCEJ7XXM.js → chunk-YNTTROJT.js} +1 -1
- package/dist/{chunk-37EVZP66.js → chunk-YSB2N563.js} +49 -8
- package/dist/{chunk-W65V465O.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-WWOMXWTT.js → db-CSEW4RII.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-A6ZZX74U.js → oauth-callback-server-FUEV5HNG.js} +24 -24
- package/dist/{runner-KSGB2UAV.js → runner-U3XHSKSH.js} +21 -39
- package/dist/{skills-26QPWKVS.js → skills-AKE6W3WI.js} +6 -6
- package/dist/spawn-B6GDTWJ4.js +39 -0
- package/dist/{validation-OPSRGFGH.js → validation-WDTAULUF.js} +6 -6
- package/dist/version.js +1 -1
- package/dist/{work-VMSW7STJ.js → work-C3HAO2BG.js} +17 -17
- package/dist/{worker-2JNFB7C7.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 +5 -5
- package/dist/chat/slack/tools/user-lookup.d.ts +0 -27
- 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-5LAJXZ2P.js +0 -39
|
@@ -4,18 +4,18 @@ import {
|
|
|
4
4
|
} from "./chunk-EM225ITJ.js";
|
|
5
5
|
import {
|
|
6
6
|
getStateAdapter
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ORO3PWKQ.js";
|
|
8
8
|
import {
|
|
9
9
|
toOptionalTrimmed
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7NVJVJID.js";
|
|
11
11
|
import {
|
|
12
12
|
pluginCatalogRuntime
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JUUKWRBE.js";
|
|
14
14
|
import {
|
|
15
15
|
setSpanAttributes,
|
|
16
16
|
setSpanStatus,
|
|
17
17
|
withSpan
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-4LJO56OJ.js";
|
|
19
19
|
|
|
20
20
|
// src/chat/sandbox/resources.ts
|
|
21
21
|
var configuredResources;
|
|
@@ -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
|
};
|
|
@@ -1885,10 +1893,8 @@ async function persistCompletedReplyState(channelId, threadTs, sessionId, reply)
|
|
|
1885
1893
|
const currentState = await getPersistedThreadState(threadId);
|
|
1886
1894
|
const conversation = coerceThreadConversationState(currentState);
|
|
1887
1895
|
await hydrateConversationMessages({ conversation, conversationId: threadId });
|
|
1888
|
-
const artifacts = coerceThreadArtifactsState(currentState);
|
|
1889
1896
|
const userMessage = getTurnUserMessage(conversation, sessionId);
|
|
1890
1897
|
const statePatch = buildDeliveredTurnStatePatch({
|
|
1891
|
-
artifacts,
|
|
1892
1898
|
conversation,
|
|
1893
1899
|
reply,
|
|
1894
1900
|
sessionId,
|
|
@@ -1994,7 +2000,6 @@ async function resumeAuthorizedMcpTurn(args) {
|
|
|
1994
2000
|
conversation: lockedConversation,
|
|
1995
2001
|
conversationId: threadId
|
|
1996
2002
|
});
|
|
1997
|
-
const lockedArtifacts = coerceThreadArtifactsState(lockedState);
|
|
1998
2003
|
const lockedPendingAuth = getConversationPendingAuth({
|
|
1999
2004
|
conversation: lockedConversation,
|
|
2000
2005
|
kind: "mcp",
|
|
@@ -2040,9 +2045,7 @@ async function resumeAuthorizedMcpTurn(args) {
|
|
|
2040
2045
|
excludeMessageId: lockedUserMessage.id
|
|
2041
2046
|
}
|
|
2042
2047
|
);
|
|
2043
|
-
const
|
|
2044
|
-
authSession.channelId
|
|
2045
|
-
);
|
|
2048
|
+
const lockedLocationConfiguration = getLocationConfigurationService(destination);
|
|
2046
2049
|
let actor;
|
|
2047
2050
|
try {
|
|
2048
2051
|
actor = createSlackResumeActor({
|
|
@@ -2103,14 +2106,13 @@ async function resumeAuthorizedMcpTurn(args) {
|
|
|
2103
2106
|
actor,
|
|
2104
2107
|
destination,
|
|
2105
2108
|
source: routing.source,
|
|
2106
|
-
toolChannelId: authSession.toolChannelId ??
|
|
2109
|
+
toolChannelId: authSession.toolChannelId ?? authSession.channelId
|
|
2107
2110
|
},
|
|
2108
2111
|
policy: {
|
|
2109
2112
|
configuration: authSession.configuration,
|
|
2110
|
-
|
|
2113
|
+
locationConfiguration: lockedLocationConfiguration
|
|
2111
2114
|
},
|
|
2112
2115
|
state: {
|
|
2113
|
-
artifactState: lockedArtifacts,
|
|
2114
2116
|
pendingAuth: lockedPendingAuth,
|
|
2115
2117
|
sandboxRef: getPersistedSandboxState(lockedState)
|
|
2116
2118
|
},
|
|
@@ -2487,10 +2489,8 @@ async function persistCompletedOAuthReplyState(args) {
|
|
|
2487
2489
|
conversation,
|
|
2488
2490
|
conversationId: args.conversationId
|
|
2489
2491
|
});
|
|
2490
|
-
const artifacts = coerceThreadArtifactsState(currentState);
|
|
2491
2492
|
const userMessage = getTurnUserMessage(conversation, args.sessionId);
|
|
2492
2493
|
const statePatch = buildDeliveredTurnStatePatch({
|
|
2493
|
-
artifacts,
|
|
2494
2494
|
conversation,
|
|
2495
2495
|
reply: args.reply,
|
|
2496
2496
|
sessionId: args.sessionId,
|
|
@@ -2624,7 +2624,6 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
|
|
|
2624
2624
|
conversation: lockedConversation,
|
|
2625
2625
|
conversationId: stored.resumeConversationId
|
|
2626
2626
|
});
|
|
2627
|
-
const lockedArtifacts = coerceThreadArtifactsState(lockedState);
|
|
2628
2627
|
const lockedPendingAuth = getConversationPendingAuth({
|
|
2629
2628
|
conversation: lockedConversation,
|
|
2630
2629
|
kind: "plugin",
|
|
@@ -2672,9 +2671,7 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
|
|
|
2672
2671
|
excludeMessageId: lockedUserMessage.id
|
|
2673
2672
|
}
|
|
2674
2673
|
);
|
|
2675
|
-
const
|
|
2676
|
-
stored.channelId
|
|
2677
|
-
);
|
|
2674
|
+
const lockedLocationConfiguration = getLocationConfigurationService(destination);
|
|
2678
2675
|
let actor;
|
|
2679
2676
|
try {
|
|
2680
2677
|
actor = createSlackResumeActor({
|
|
@@ -2740,13 +2737,12 @@ async function resumeOAuthSessionRecordTurn(stored, options) {
|
|
|
2740
2737
|
actor,
|
|
2741
2738
|
destination,
|
|
2742
2739
|
source: routing.source,
|
|
2743
|
-
toolChannelId:
|
|
2740
|
+
toolChannelId: stored.channelId
|
|
2744
2741
|
},
|
|
2745
2742
|
policy: {
|
|
2746
|
-
|
|
2743
|
+
locationConfiguration: lockedLocationConfiguration
|
|
2747
2744
|
},
|
|
2748
2745
|
state: {
|
|
2749
|
-
artifactState: lockedArtifacts,
|
|
2750
2746
|
pendingAuth: lockedPendingAuth,
|
|
2751
2747
|
sandboxRef: getPersistedSandboxState(lockedState)
|
|
2752
2748
|
},
|
|
@@ -2974,27 +2970,61 @@ async function GET2(request, provider, waitUntil, options) {
|
|
|
2974
2970
|
...parsedTokenResponse,
|
|
2975
2971
|
...account ? { account } : {}
|
|
2976
2972
|
});
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
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
|
+
);
|
|
2998
3028
|
}
|
|
2999
3029
|
if (stored.destination?.platform !== "local") {
|
|
3000
3030
|
waitUntil(async () => {
|