@sentry/junior 0.305.0 → 0.307.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/{adapter-context-BpvbUki8.js → adapter-context-B69WPn6b.js} +2 -2
- package/dist/{admin-CoDt35ny.js → admin-nCJXMgkp.js} +2 -2
- package/dist/{agent-runner-C5d6rY5g.js → agent-runner-DdFcxAxG.js} +463 -303
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +7 -8
- package/dist/api.d.ts +19 -4
- package/dist/api.js +437 -310
- package/dist/{app-Cs157Zc5.d.ts → app-EZur8cVC.d.ts} +12 -3
- package/dist/app.d.ts +2 -2
- package/dist/app.js +532 -439
- package/dist/background-compaction-queue-BhEe4UfU.js +231 -0
- package/dist/{briefs-BRdznF7c.js → briefs-Dl9lxi7J.js} +3 -3
- package/dist/{catalog-runtime-J52Tej47.js → catalog-runtime-OXrv2Ewn.js} +1 -1
- package/dist/cli/chat.d.ts +1 -1
- package/dist/cli/chat.js +17 -16
- package/dist/cli/check.js +58 -48
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.d.ts +1 -1
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +5 -5
- package/dist/cli/upgrade.d.ts +2 -2
- package/dist/cli/upgrade.js +3 -8
- package/dist/{config-CBZp0udd.js → config-362yMSIz.js} +183 -49
- package/dist/{connections-BYmuJ6Vm.js → connections-BJv3EjmB.js} +10 -8
- package/dist/{continue-in-slack-Cvot6S38.js → continue-in-slack-CFEevC7z.js} +5 -5
- package/dist/{conversation-BOqdRtUx.js → conversation--f85g4zL.js} +132 -132
- package/dist/{conversation-feed-CgpgP7yi.js → conversation-feed-BNs9KiqC.js} +1 -1
- package/dist/{conversation-privacy-D2pOzBNl.js → conversation-privacy-Tjj5P2W6.js} +1 -1
- package/dist/{conversation-turn-CI8WDpnK.js → conversation-turn-DU0_WDAr.js} +26 -72
- package/dist/{credential-sync-COqnZ1Dx.js → credential-sync-D6aFARKE.js} +28 -27
- package/dist/{db-DU84dCVu.js → db-Bcbd9zQc.js} +226 -18
- package/dist/{db-zbN5ZV_o.d.ts → db-C41UgdBj.d.ts} +1 -1
- package/dist/{executor-CFyrgOu1.js → executor-DBMBrpNV.js} +137 -33
- package/dist/{history-m2-ceTTX.js → history-N7IVbUom.js} +5 -1
- package/dist/{install-CQ76CfRw.js → install-CgoAbzfF.js} +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{lineage-DLd2UxVP.js → lineage-CsZDmz3e.js} +2 -2
- package/dist/{logging-BPNTQVFu.js → logging-CHCuQ5iz.js} +1 -1
- package/dist/{message-BWJLeQ5e.js → message-B8vCbZZB.js} +8 -8
- package/dist/{model-input-DoM9Ht-d.js → model-input-Xluiy-1W.js} +3 -3
- package/dist/nitro.d.ts +2 -2
- package/dist/nitro.js +3 -4
- package/dist/{oauth-callback-server-DeHbnAQl.js → oauth-callback-server-BUuNvfvu.js} +2 -2
- package/dist/{oauth-relay-DAmfVmJu.js → oauth-relay-DGAZzg9m.js} +1 -1
- package/dist/{plugins-B_0Cr0MO.d.ts → plugins-fBrz8PCV.d.ts} +2 -0
- package/dist/{projection-CcFBVFUo.js → projection-xPpvqexa.js} +13423 -11432
- package/dist/{prompt-C5LREK2p.js → prompt-D8u4jFs_.js} +15 -7
- package/dist/{registry-BjZZqKqi.js → registry-D20hG3r6.js} +19 -9
- package/dist/{resolve-CeJgXuH1.js → resolve-BhCySRCW.js} +3 -3
- package/dist/{result-icDrueyB.js → result-DddO63S9.js} +13 -11
- package/dist/{runner-nVfMkMMB.js → runner-DQR9vYce.js} +13 -15
- package/dist/{sandbox-egress-signals-H9vQ5qRf.js → sandbox-egress-signals-DFlNUOnK.js} +1 -1
- package/dist/{automation-CuA3yEcD.js → schedule-BG1tEbRF.js} +380 -8
- package/dist/{schema-CKcu-IK6.d.ts → schema-CRXcj4fj.d.ts} +420 -143
- package/dist/{schema-Bx0Mlo32.js → schema-D4jdesIu.js} +62 -8
- package/dist/{service-account-DU5865XA.js → service-account-Bv5QwrEq.js} +8 -6
- package/dist/{service-account-Dw06p3zm.js → service-account-CNfycv0z.js} +3 -3
- package/dist/{session-stop-uotLtp4g.js → session-stop-BDdwyZaa.js} +878 -171
- package/dist/{skills-Bex1EaO5.js → skills-63i1Bcv1.js} +32 -28
- package/dist/{slack-conversation-unfurl-EPG3riWF.js → slack-conversation-unfurl-DtpBUlUu.js} +10 -9
- package/dist/{spawn-CoD3vDuS.js → spawn-mwimEY9_.js} +6 -6
- package/dist/{state-nCR4Muhn.js → state-BBn9L6gC.js} +4 -4
- package/dist/{stop-BFVd0P0m.js → stop-Da-Ug7tg.js} +172 -239
- package/dist/{store-Ca6G962n.js → store-CdWg2r2L.js} +5 -5
- package/dist/{background-compaction-queue-BTqMIfTA.js → task-queue-BcjAYWyB.js} +164 -180
- package/dist/{task-runner-xsOPIxCZ.js → task-runner-CoXmMlsW.js} +13 -11
- package/dist/{thread-context-BOvZhsKK.js → thread-context-ZPGqOjW7.js} +8 -91
- package/dist/turn-session-routing-DFYak28Q.js +263 -0
- package/dist/{turn-user-message-BrhuyYrH.js → turn-user-message-B1S8nOnG.js} +3 -3
- package/dist/users-DDbENg-I.js +181 -0
- package/dist/{validation-BnY9K5WB.js → validation-fl21ps-k.js} +1 -1
- package/dist/{version-qROlRQGF.js → version-DCdMMx_0.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-CxUiOraX.js → viewer-DN_xzVKj.js} +3 -3
- package/dist/{warmup--Gkz7iB-.js → warmup-CxhEhm71.js} +842 -532
- package/dist/{web-message-id-lNodcCOI.js → web-message-id-BT8Mg8LL.js} +16 -1
- package/dist/{worker-DJ8d9fmD.js → worker-Btb1SB5h.js} +8 -7
- package/migrations/0114_plan_items.sql +22 -0
- package/migrations/0115_automation_creator_slack_index.sql +1 -0
- package/migrations/0116_conversation_event_search.sql +25 -0
- package/migrations/0117_automation_last_run.sql +46 -0
- package/migrations/0118_automation_last_run_index.sql +1 -0
- package/migrations/0119_money_micro_usd.sql +29 -0
- package/migrations/0120_conversation_cost_micro_usd.sql +8 -0
- package/migrations/meta/0114_snapshot.json +5203 -0
- package/migrations/meta/0115_snapshot.json +5225 -0
- package/migrations/meta/0116_snapshot.json +5388 -0
- package/migrations/meta/0117_snapshot.json +5413 -0
- package/migrations/meta/0118_snapshot.json +5428 -0
- package/migrations/meta/0119_snapshot.json +5441 -0
- package/migrations/meta/0120_snapshot.json +5441 -0
- package/migrations/meta/_journal.json +49 -0
- package/package.json +10 -9
- package/dist/queue-B2AAL3ym.js +0 -115
- package/dist/schedule-cP0AACm1.js +0 -344
- package/dist/secrets-DHaJ5TTn.js +0 -18
- package/dist/task-queue-BLPZU6kC.js +0 -89
- package/dist/turn-session-routing-2bW2qfeb.js +0 -1792
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { P as briefOutcomeStatusSchema, W as reviewItemChangeRecordSchema, et as messageAttachmentSchema, i as actorIdentitySchema, u as conversationDetailReportSchema, y as conversationSummaryReportSchema } from "./conversation--f85g4zL.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
// src/api/objects/cards.ts
|
|
4
4
|
const MAX_LABEL_CHARS = 256;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as logWarn } from "./logging-
|
|
1
|
+
import { h as logWarn } from "./logging-CHCuQ5iz.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
import { renderSystemMessageUpdate } from "@earendil-works/pi-ai";
|
|
4
4
|
// src/chat/conversation-privacy.ts
|
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import {
|
|
3
|
-
import { E as isTopLevelKind, T as isPersonInput, a as getConversationStore, k as turnBehavior,
|
|
4
|
-
import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { f as credentialContextForActor } from "./registry-BjZZqKqi.js";
|
|
2
|
+
import { A as normalizeConversationText, O as latestConversationMessageSeq, P as upsertConversationMessage, Vo as readConversationAutomationRun, Ws as blockScheduledAutomation, a as loadProjection, as as notifyAutomationBlocked, at as getTurnRecord, b as persistConversationMessages, cn as getAssistantReplyText, dc as blockEventAutomation, et as saveTurnCheckpoint, j as recordDeliveredAssistantMessage, ji as verifyTimerWatchCredentialSubject, k as markConversationMessage, qo as getDispatchIdForConversation, rt as failTurnRecord, t as commitAcceptedReply, v as hydrateConversationMessages, vn as persistWithRetry } from "./projection-xPpvqexa.js";
|
|
3
|
+
import { E as isTopLevelKind, T as isPersonInput, a as getConversationStore, k as turnBehavior, o as getDb, r as getConversationEventStore } from "./db-Bcbd9zQc.js";
|
|
4
|
+
import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging-CHCuQ5iz.js";
|
|
5
|
+
import { tt as readMessageAttachments } from "./conversation--f85g4zL.js";
|
|
6
|
+
import { L as finalizeFailedTurnReplyWithEvent, O as isConversationDeliveryPaused, i as measureTurnCompactionWait } from "./agent-runner-DdFcxAxG.js";
|
|
7
|
+
import { a as buildDeliveredTurnStatePatch, o as loadPendingMessageCards, r as completeAuthPauseTurn, t as buildTurnThreadContext } from "./thread-context-ZPGqOjW7.js";
|
|
8
|
+
import { En as supersedeOpenMailboxTurns, Et as resolveConversationDestination, Hn as executeTurn, Rn as createWebAuthorization, Vn as AgentRunError, an as readParentMessage, gn as completeCancelledConversationTurn, nn as isParentMessageMeta, tn as childAgentTurnOptions } from "./warmup-CxhEhm71.js";
|
|
9
|
+
import { R as buildDeterministicTurnId, _ as ConversationTurnLifecycleService, d as isTurnInputCommitLostError, g as startActiveTurn, h as markTurnFailed, l as getConversationTurnBoundaryError, s as TurnInputCommitLostError, t as getTurnUserMessage } from "./turn-user-message-B1S8nOnG.js";
|
|
10
|
+
import { p as credentialContextForActor } from "./registry-D20hG3r6.js";
|
|
12
11
|
import { i as getActiveSpan, r as continueTrace } from "./sentry-CPbZjomA.js";
|
|
13
|
-
import { i as
|
|
14
|
-
import { n as botConfig } from "./config-
|
|
15
|
-
import {
|
|
16
|
-
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-
|
|
17
|
-
import { p as instructionProvenanceFor } from "./history-
|
|
18
|
-
import {
|
|
19
|
-
import { t as readConversationLineage } from "./lineage-
|
|
12
|
+
import { a as getPersistedThreadState, c as coerceThreadConversationState, i as getPersistedSandboxState, s as persistThreadStateById } from "./turn-session-routing-DFYak28Q.js";
|
|
13
|
+
import { n as botConfig } from "./config-362yMSIz.js";
|
|
14
|
+
import { B as renderEventBatchInputs, D as getEventBatchDelayMs, M as sourceFromTurnInput, N as turnInputFactsFromConversationMessage, P as legacyWebMailboxMetadataSchema, Q as maybePostAutomatedTurnLimitNotice, R as eventBatchMessageMeta, V as timerWatchCredentialSubject, c as loadReviewItemInput, f as buildSteeringPiMessage, g as withoutSavedSteeringMessages, m as instructionForInputs, p as instructionActorFor, s as eventReviewItemInputs, st as recordFinishedTurnForAutomatedLimit, z as isEventMailboxMetadata } from "./session-stop-BDdwyZaa.js";
|
|
15
|
+
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-CoXmMlsW.js";
|
|
16
|
+
import { p as instructionProvenanceFor } from "./history-N7IVbUom.js";
|
|
17
|
+
import { s as isEventConversationMessage } from "./prompt-D8u4jFs_.js";
|
|
18
|
+
import { t as readConversationLineage } from "./lineage-CsZDmz3e.js";
|
|
19
|
+
import pLimit from "p-limit";
|
|
20
20
|
import { isDeepStrictEqual } from "node:util";
|
|
21
21
|
import { createHash } from "node:crypto";
|
|
22
|
-
import { and, eq, isNotNull, isNull } from "drizzle-orm";
|
|
23
22
|
// src/chat/task-execution/turn-telemetry.ts
|
|
24
23
|
/** Read the turn input timing facts from a mailbox batch, oldest first. */
|
|
25
24
|
function turnInputTelemetry(messages) {
|
|
@@ -79,28 +78,13 @@ function getTurnInputSpanAttributes(input, turnStartedAtMs) {
|
|
|
79
78
|
}
|
|
80
79
|
// src/chat/automations/block-run.ts
|
|
81
80
|
/**
|
|
82
|
-
* Find the Automation of a run. The SQL run row lasts as long as the
|
|
83
|
-
* Automation, but a Watch can outlive the dispatch record. The dispatch record
|
|
84
|
-
* covers a run whose row does not link its Conversation yet.
|
|
85
|
-
*/
|
|
86
|
-
async function findRunAutomation(conversationId, dispatchId) {
|
|
87
|
-
const run = await readAutomationExecutionByConversationId({ conversationId });
|
|
88
|
-
if (run) return run;
|
|
89
|
-
const source = dispatchId ? (await getDispatchRecord(dispatchId))?.source : void 0;
|
|
90
|
-
if (!source || !("automationId" in source) || !source.automationId) return;
|
|
91
|
-
return {
|
|
92
|
-
automationId: source.automationId,
|
|
93
|
-
kind: source.kind === "scheduled_automation" ? "scheduled" : "event"
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
81
|
* Block the Automation of a run from a later Turn of the run, such as a Watch
|
|
98
82
|
* Event or child result Turn. The dispatch Turn blocks through its dispatch
|
|
99
83
|
* outcome. Its creator is told when the block is first stored.
|
|
100
84
|
*/
|
|
101
85
|
async function blockRunAutomation(conversationId, blocked) {
|
|
102
86
|
const dispatchId = getDispatchIdForConversation(conversationId);
|
|
103
|
-
const automation = await
|
|
87
|
+
const automation = await readConversationAutomationRun(conversationId);
|
|
104
88
|
if (!automation) {
|
|
105
89
|
logWarn("automation.block.unresolved", { "gen_ai.conversation.id": conversationId });
|
|
106
90
|
return;
|
|
@@ -113,34 +97,6 @@ async function blockRunAutomation(conversationId, blocked) {
|
|
|
113
97
|
reason: blocked.missing
|
|
114
98
|
});
|
|
115
99
|
}
|
|
116
|
-
// src/chat/conversations/delivery-pause.ts
|
|
117
|
-
/** True when the Conversation is a root that delivers to a Location. */
|
|
118
|
-
function canPauseConversationDelivery(conversation) {
|
|
119
|
-
return isTopLevelKind(conversation.kind) && conversation.location !== void 0;
|
|
120
|
-
}
|
|
121
|
-
const rootConversation = (conversationId) => and(eq(juniorConversations.conversationId, conversationId), isNull(juniorConversations.parentConversationId));
|
|
122
|
-
/**
|
|
123
|
-
* Stop Delivery of a root's Event Turn replies to its Location. Returns false
|
|
124
|
-
* when Delivery was already paused or the root does not exist.
|
|
125
|
-
*/
|
|
126
|
-
async function pauseConversationDelivery(conversationId) {
|
|
127
|
-
return (await getSqlExecutor().db().update(juniorConversations).set({
|
|
128
|
-
deliveryPausedAt: /* @__PURE__ */ new Date(),
|
|
129
|
-
detailVersion: nextDetailVersion
|
|
130
|
-
}).where(and(rootConversation(conversationId), isNull(juniorConversations.deliveryPausedAt))).returning({ conversationId: juniorConversations.conversationId })).length > 0;
|
|
131
|
-
}
|
|
132
|
-
/** Deliver a root's Event Turn replies to its Location again. */
|
|
133
|
-
async function resumeConversationDelivery(conversationId) {
|
|
134
|
-
await getSqlExecutor().db().update(juniorConversations).set({
|
|
135
|
-
deliveryPausedAt: null,
|
|
136
|
-
detailVersion: nextDetailVersion
|
|
137
|
-
}).where(and(rootConversation(conversationId), isNotNull(juniorConversations.deliveryPausedAt)));
|
|
138
|
-
}
|
|
139
|
-
/** True while a root's Event Turn replies stay out of its Location. */
|
|
140
|
-
async function isConversationDeliveryPaused(conversationId) {
|
|
141
|
-
const [row] = await getSqlExecutor().db().select({ pausedAt: juniorConversations.deliveryPausedAt }).from(juniorConversations).where(eq(juniorConversations.conversationId, conversationId)).limit(1);
|
|
142
|
-
return Boolean(row?.pausedAt);
|
|
143
|
-
}
|
|
144
100
|
// src/chat/task-execution/assistant-message.ts
|
|
145
101
|
/** Store one assistant Message and its Agent history. */
|
|
146
102
|
async function commitAssistantMessage(args) {
|
|
@@ -173,7 +129,8 @@ async function commitAssistantMessage(args) {
|
|
|
173
129
|
* attachments keeps one empty input, so the prompt still has an instruction.
|
|
174
130
|
*/
|
|
175
131
|
async function webTurnInputs(messages) {
|
|
176
|
-
const
|
|
132
|
+
const limit = pLimit(8);
|
|
133
|
+
const flat = (await Promise.all(messages.map((message) => limit(async () => {
|
|
177
134
|
const reviewItem = await loadReviewItemInput(message.reviewItemChange);
|
|
178
135
|
if (reviewItem) return [{
|
|
179
136
|
kind: "runtime",
|
|
@@ -184,7 +141,7 @@ async function webTurnInputs(messages) {
|
|
|
184
141
|
kind: "person",
|
|
185
142
|
text
|
|
186
143
|
}] : [];
|
|
187
|
-
}))).flat();
|
|
144
|
+
})))).flat();
|
|
188
145
|
return flat.length ? flat : [{
|
|
189
146
|
kind: "person",
|
|
190
147
|
text: ""
|
|
@@ -424,7 +381,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
|
|
|
424
381
|
personInput: isPersonInput(source.kind)
|
|
425
382
|
});
|
|
426
383
|
const webActor = actor.platform === "web" ? actor : void 0;
|
|
427
|
-
const signInActor = behavior.
|
|
384
|
+
const signInActor = behavior.waitsForSignIn ? webActor : void 0;
|
|
428
385
|
const disabledFeatures = signInActor ? [] : ["interactive-auth"];
|
|
429
386
|
const deliverToProvider = postsToProvider && behavior.delivery === "location";
|
|
430
387
|
const sendToParent = async (result) => {
|
|
@@ -642,10 +599,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
|
|
|
642
599
|
}, async (result) => {
|
|
643
600
|
if (stopSignal?.aborted) throw stopSignal.reason ?? new DOMException("Turn cancelled", "AbortError");
|
|
644
601
|
modelFailureCaptureAttempted = result.diagnostics.outcome !== "success";
|
|
645
|
-
const finalized = finalizeFailedTurnReplyWithEvent({
|
|
646
|
-
reply: result,
|
|
647
|
-
logException
|
|
648
|
-
});
|
|
602
|
+
const finalized = finalizeFailedTurnReplyWithEvent({ reply: result });
|
|
649
603
|
const modelFailureReason = finalized.failureReason;
|
|
650
604
|
const reply = finalized.reply;
|
|
651
605
|
modelFailureEventId = finalized.eventId;
|
|
@@ -728,7 +682,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
|
|
|
728
682
|
await scheduleSessionCompletedPluginTasks({
|
|
729
683
|
conversationId: context.conversationId,
|
|
730
684
|
sessionId: turnId
|
|
731
|
-
},
|
|
685
|
+
}, async (message) => {
|
|
732
686
|
try {
|
|
733
687
|
await processPluginTask(message);
|
|
734
688
|
} catch (error) {
|
|
@@ -739,7 +693,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
|
|
|
739
693
|
turnId
|
|
740
694
|
});
|
|
741
695
|
}
|
|
742
|
-
}
|
|
696
|
+
});
|
|
743
697
|
} catch (error) {
|
|
744
698
|
logException(error, "conversation.plugin.session_completion_task.failed", {
|
|
745
699
|
conversationId: context.conversationId,
|
|
@@ -815,4 +769,4 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
|
|
|
815
769
|
});
|
|
816
770
|
};
|
|
817
771
|
}
|
|
818
|
-
export {
|
|
772
|
+
export { withTurnSpan as a, turnInputTelemetry as i, createConversationTurnWorker as n, getTurnInputSpanAttributes as r, conversation_turn_exports as t };
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { V as escapeXml, a as getRuntimeMetadata, n as botConfig } from "./config-
|
|
3
|
-
import { W as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-
|
|
1
|
+
import { H as authorizationId, Sn as resolvePluginOAuthAccount, Y as getConversationPendingAuth, at as getTurnRecord, bn as createUserTokenStore, d as recordAuthorizationCompleted, fs as postSlackMessage, na as parseOAuthStatePayload, ra as resolveBaseUrl, ta as formatProviderLabel, u as recordAuthenticationLinked, ws as getSlackClient } from "./projection-xPpvqexa.js";
|
|
2
|
+
import { V as escapeXml, a as getRuntimeMetadata, n as botConfig } from "./config-362yMSIz.js";
|
|
3
|
+
import { W as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-CHCuQ5iz.js";
|
|
4
4
|
import { p as parseSlackUserId } from "./actor-D2iXzvlN.js";
|
|
5
|
-
import {
|
|
5
|
+
import { $ as getStateAdapter, H as findUserByVerifiedEmails, I as resolveActorIdentityId, q as upsertLinkedIdentity, rt as acquireActiveLock, s as getSqlExecutor } from "./db-Bcbd9zQc.js";
|
|
6
6
|
import { i as homeDir } from "./package-discovery-x4AvVhMj.js";
|
|
7
|
-
import {
|
|
8
|
-
import { n as
|
|
9
|
-
import {
|
|
10
|
-
import { o as finalizeMcpAuthorization } from "./agent-runner-
|
|
11
|
-
import { O as getMcpProviderErrorAttributes, S as putMcpStoredOAuthCredentials, f as deleteMcpAuthSession, g as getMcpAuthSession, v as getMcpStoredOAuthCredentials } from "./service-account-
|
|
12
|
-
import { o as readIdentityById } from "./viewer-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
7
|
+
import { t as discoverSkills } from "./skills-63i1Bcv1.js";
|
|
8
|
+
import { d as hasRequiredOAuthScope, n as buildOAuthTokenRequest, r as parseOAuthTokenResponse } from "./registry-D20hG3r6.js";
|
|
9
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-OXrv2Ewn.js";
|
|
10
|
+
import { o as finalizeMcpAuthorization } from "./agent-runner-DdFcxAxG.js";
|
|
11
|
+
import { O as getMcpProviderErrorAttributes, S as putMcpStoredOAuthCredentials, f as deleteMcpAuthSession, g as getMcpAuthSession, v as getMcpStoredOAuthCredentials } from "./service-account-Bv5QwrEq.js";
|
|
12
|
+
import { o as readIdentityById } from "./viewer-DN_xzVKj.js";
|
|
13
|
+
import { d as readJuniorSecret } from "./task-queue-BcjAYWyB.js";
|
|
14
|
+
import { Mn as wakePausedTurn, jn as wakeAuthorizedTurn, zn as deleteWebAuthorization } from "./warmup-CxhEhm71.js";
|
|
15
|
+
import { i as lookupSlackUserProfile } from "./users-DDbENg-I.js";
|
|
16
|
+
import { a as getPersistedThreadState, c as coerceThreadConversationState } from "./turn-session-routing-DFYak28Q.js";
|
|
17
|
+
import { i as readConnectedOAuthTokens, s as htmlCallbackResponse } from "./connections-BJv3EjmB.js";
|
|
18
|
+
import { n as relayLocalOAuthCallback } from "./oauth-relay-DGAZzg9m.js";
|
|
18
19
|
import * as z from "zod";
|
|
19
20
|
import path from "node:path";
|
|
20
21
|
import { createHmac, createSecretKey, timingSafeEqual } from "node:crypto";
|
|
@@ -74,9 +75,6 @@ var McpOAuthAttemptExpiredError = class extends Error {
|
|
|
74
75
|
this.name = "McpOAuthAttemptExpiredError";
|
|
75
76
|
}
|
|
76
77
|
};
|
|
77
|
-
function mcpAuthorizationId(args) {
|
|
78
|
-
return `${args.sessionId}:mcp:${args.provider}`;
|
|
79
|
-
}
|
|
80
78
|
function htmlResponse(kind, options) {
|
|
81
79
|
const botName = botConfig.userName;
|
|
82
80
|
const pages = callbackPages(botName);
|
|
@@ -101,7 +99,8 @@ async function wakeAuthorizedMcpTurn(args) {
|
|
|
101
99
|
authSessionId: authSession.authSessionId,
|
|
102
100
|
configuration: authSession.configuration,
|
|
103
101
|
toolChannelId: authSession.toolChannelId,
|
|
104
|
-
authorizationId:
|
|
102
|
+
authorizationId: authorizationId({
|
|
103
|
+
kind: "mcp",
|
|
105
104
|
provider,
|
|
106
105
|
sessionId: authSession.sessionId
|
|
107
106
|
})
|
|
@@ -190,7 +189,8 @@ async function GET$1(request, provider, waitUntil, options) {
|
|
|
190
189
|
conversationId: authSession.conversationId,
|
|
191
190
|
provider,
|
|
192
191
|
actorId: authSession.userId,
|
|
193
|
-
authorizationId:
|
|
192
|
+
authorizationId: authorizationId({
|
|
193
|
+
kind: "mcp",
|
|
194
194
|
provider,
|
|
195
195
|
sessionId: authSession.sessionId
|
|
196
196
|
}),
|
|
@@ -217,7 +217,8 @@ async function GET$1(request, provider, waitUntil, options) {
|
|
|
217
217
|
kind: "mcp",
|
|
218
218
|
provider,
|
|
219
219
|
actorId: authSession.userId,
|
|
220
|
-
authorizationId:
|
|
220
|
+
authorizationId: authorizationId({
|
|
221
|
+
kind: "mcp",
|
|
221
222
|
provider,
|
|
222
223
|
sessionId: authSession.sessionId
|
|
223
224
|
})
|
|
@@ -397,9 +398,6 @@ function oauthTokenErrorAttributes(provider, endpoint, status) {
|
|
|
397
398
|
...status !== void 0 ? { "http.response.status_code": status } : void 0
|
|
398
399
|
};
|
|
399
400
|
}
|
|
400
|
-
function pluginAuthorizationId(args) {
|
|
401
|
-
return `${args.sessionId}:plugin:${args.provider}`;
|
|
402
|
-
}
|
|
403
401
|
/** Return the Junior user of the person who started the OAuth connection. */
|
|
404
402
|
async function resolveOAuthActorUserId(actor) {
|
|
405
403
|
const identityActor = actor.platform === "web" ? actor : await slackProfileActor(actor);
|
|
@@ -465,7 +463,8 @@ async function wakeAuthorizedPluginTurn(stored, options) {
|
|
|
465
463
|
provider: stored.provider,
|
|
466
464
|
actorId: stored.userId,
|
|
467
465
|
scope: stored.scope,
|
|
468
|
-
authorizationId:
|
|
466
|
+
authorizationId: authorizationId({
|
|
467
|
+
kind: "plugin",
|
|
469
468
|
provider: stored.provider,
|
|
470
469
|
sessionId: turnId
|
|
471
470
|
})
|
|
@@ -576,7 +575,8 @@ async function GET(request, provider, waitUntil, options) {
|
|
|
576
575
|
providerLabel,
|
|
577
576
|
...account?.label ? { accountLabel: account.label } : void 0,
|
|
578
577
|
...stored.resumeSessionId ? {
|
|
579
|
-
authorizationId:
|
|
578
|
+
authorizationId: authorizationId({
|
|
579
|
+
kind: "plugin",
|
|
580
580
|
provider,
|
|
581
581
|
sessionId: stored.resumeSessionId
|
|
582
582
|
}),
|
|
@@ -604,7 +604,8 @@ async function GET(request, provider, waitUntil, options) {
|
|
|
604
604
|
kind: "plugin",
|
|
605
605
|
provider: stored.provider,
|
|
606
606
|
actorId: stored.userId,
|
|
607
|
-
authorizationId:
|
|
607
|
+
authorizationId: authorizationId({
|
|
608
|
+
kind: "plugin",
|
|
608
609
|
provider: stored.provider,
|
|
609
610
|
sessionId: stored.resumeSessionId
|
|
610
611
|
})
|