@sentry/junior 0.315.0 → 0.317.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/{admin-5jUYY46p.js → admin-CAugg87B.js} +1 -1
- package/dist/{agent-runner-C7GNLRB6.js → agent-runner-AjrEV6Qe.js} +13532 -12811
- package/dist/{reporting-window-C4dbzDiR.js → agent-status-BA5x3Xtp.js} +33 -1
- package/dist/{agent-update-delivery-BNEYQsAf.js → agent-update-delivery-B_YIZcgf.js} +10 -37
- package/dist/api/schema.d.ts +609 -104
- package/dist/api/schema.js +6 -6
- package/dist/api.js +373 -469
- package/dist/{app-D_bAXRDe.d.ts → app-MoNAsVV5.d.ts} +52 -28
- package/dist/app.d.ts +1 -1
- package/dist/app.js +177 -132
- package/dist/catalog-runtime-DfSpJZdY.js +6 -0
- package/dist/{change-record-Bqsa5ZXE.d.ts → change-record-BzJgLsv7.d.ts} +60 -1
- package/dist/{adapter-context-BlSGE44V.js → channel-access-j-YAVYK4.js} +2 -42
- package/dist/{chat-core-engine-CxkwRpn9.js → chat-core-engine-aH85nEHv.js} +4 -3
- package/dist/{child-message--2G3Ft26.js → child-message-DHjQLEd1.js} +1 -1
- package/dist/cli/chat.js +23 -23
- package/dist/cli/check.js +5 -5
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +5 -4
- package/dist/cli/snapshot-create.js +5 -2
- package/dist/cli/upgrade.js +27 -5
- package/dist/config-CHQ8X251.js +2422 -0
- package/dist/{continue-in-slack-BGKjIdFp.js → continue-in-slack-D-FZ8Fin.js} +2 -3
- package/dist/{conversation-feed-Sl8lKKmR.js → conversation-feed--9S0_PXL.js} +9 -4
- package/dist/{proxy-path-Dc-0jXGi.js → conversation-privacy-B1uXn5sf.js} +2 -16
- package/dist/{conversation-turn-BoLK9i6g.js → conversation-turn-BUE_7xaN.js} +102 -172
- package/dist/{create-BOycVH9h.js → create-DoDIYgtZ.js} +12 -10
- package/dist/{credential-sync-Mn4OdkEh.js → credential-sync-BJOqGnjV.js} +17 -12
- package/dist/{db-DXTOYRzR.js → db-BFmyYZtJ.js} +20276 -27398
- package/dist/{deployment-CG3TchWh.js → deployment-DXq9ZLU4.js} +17 -15
- package/dist/{engine-context-dyWlfNdD.js → engine-context-CgQ7mlHt.js} +264 -50
- package/dist/{html-CfXEwl_h.js → html-B3VKTGbJ.js} +6 -2
- package/dist/instrumentation.js +15 -7
- package/dist/{job-runner-CySgpi9v.js → job-runner-A1lCkybD.js} +397 -22
- package/dist/{lineage-tRTOcrsL.js → lineage-Bktb0UcV.js} +1 -1
- package/dist/{list-DXBz8SYL.js → list-Bxvg5wXf.js} +260 -698
- package/dist/{logging-czs0nqLC.js → logging--smS7XRK.js} +2 -2
- package/dist/{mailbox-turn-79Nv1JXv.js → mailbox-turn-uSXhUFc9.js} +648 -2957
- package/dist/{message-BTox2Cmb.js → message-BNenhsmB.js} +12 -22
- package/dist/{model-input-IRGa98V7.js → model-input-BReSnwHp.js} +3 -3
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +20 -6
- package/dist/{oauth-callback-server-NXK7AlBp.js → oauth-callback-server-CE4soEIY.js} +2 -2
- package/dist/{oauth-relay-6NBPSpFE.js → oauth-relay-C36gX1gH.js} +2 -2
- package/dist/{package-discovery-BI6T_RkD.js → package-discovery-DD9vencX.js} +1 -50
- package/dist/{parent-result-Dg6P6roR.js → parent-result-Ck1rFYRQ.js} +93 -106
- package/dist/{plugins-BXMdNdyA.js → plugins-D_Ru4CWc.js} +1 -1
- package/dist/profile-BQ-iBDsZ.js +4657 -0
- package/dist/{transcript-BHhJVY0P.js → prompt-Dv7gkpD6.js} +97 -103
- package/dist/proxy-path-BHYoKZdq.js +15 -0
- package/dist/registry-iXMT5Jmh.js +3279 -0
- package/dist/reports-WKHfGTsU.js +195 -0
- package/dist/{resolve-BUFkmxkT.js → resolve-tony4ibz.js} +9 -29
- package/dist/{result-DfATzX77.js → result-Bta_dlWa.js} +42 -117
- package/dist/run-conversation-DL6ru7iW.js +336 -0
- package/dist/{runner-CmKP3inb.js → runner-BstDRbD9.js} +7 -7
- package/dist/{sandbox-egress-signals-DYo5BsM7.js → sandbox-egress-signals-oSJMJOnn.js} +1 -1
- package/dist/{schema-DrBMdPmv.js → schema-DfqrHACA.js} +67 -84
- package/dist/sender-actors-CPglLd5R.js +83 -0
- package/dist/{service-account-CxTX7nnR.js → service-account-CTV_jaNu.js} +3 -1
- package/dist/{skills-BlHUDj7k.js → skills-BCEU41zM.js} +4 -4
- package/dist/{slack-conversation-unfurl-Dhe3lB1U.js → slack-conversation-unfurl-DxVmhbGP.js} +7 -6
- package/dist/{spawn-CfvlFdfz.js → spawn-frczVPIr.js} +11 -8
- package/dist/{system-prompt-table-CDCYVwqN.js → system-prompt-table-CiXy0eNR.js} +91 -70
- package/dist/{task-runner-DcdQJd9e.js → task-runner-C9Yc2_ae.js} +35 -49
- package/dist/{thread-context-DF5uDcWN.js → thread-context-CqZDKErp.js} +6 -6
- package/dist/topics-SRN7IVX-.js +24 -0
- package/dist/turn-membership-CENFf3kI.js +856 -0
- package/dist/{turn-wake-um5Ubd4m.js → turn-wake-BhloiI2h.js} +4 -5
- package/dist/{media-Cr9pGkzr.js → types-C4iC-IMC.js} +819 -777
- package/dist/user-customization-CvfuY9Eo.js +93 -0
- package/dist/users-ByG5RCEJ.js +181 -0
- package/dist/{validation-CJyuOPD2.js → validation-8gjfR91V.js} +1 -1
- package/dist/{version-Bhe7RPIe.js → version-BeZhWWBE.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{worker-D8PRgUqr.js → worker-BqMQQNRk.js} +5 -4
- package/migrations/20261125171254_conversation_visibility/migration.sql +4 -0
- package/migrations/20261125171254_conversation_visibility/snapshot.json +67 -0
- package/migrations/20261125171257_conversation_visibility_backfill/migration.sql +25 -0
- package/migrations/20261125171257_conversation_visibility_backfill/snapshot.json +9 -0
- package/migrations/20261125213232_drop_versions_notify/migration.sql +19 -0
- package/migrations/20261125213232_drop_versions_notify/snapshot.json +9 -0
- package/migrations/20261125225138_conversation_kind_root_thread/migration.sql +23 -0
- package/migrations/20261125225138_conversation_kind_root_thread/snapshot.json +55 -0
- package/migrations/20261125225142_conversation_kind_root_thread_backfill/migration.sql +7 -0
- package/migrations/20261125225142_conversation_kind_root_thread_backfill/snapshot.json +9 -0
- package/migrations/20261126000151_conversation_event_message_role_seq_index/migration.sql +1 -0
- package/migrations/20261126000151_conversation_event_message_role_seq_index/snapshot.json +69 -0
- package/migrations/20261126012917_merge_leaves/migration.sql +2 -0
- package/migrations/20261126012917_merge_leaves/snapshot.json +12 -0
- package/migrations/20261126025226_drop_agent_invocations/migration.sql +6 -0
- package/migrations/20261126025226_drop_agent_invocations/snapshot.json +9 -0
- package/migrations/20261126033000_space_conversations_lead_children/migration.sql +155 -0
- package/migrations/20261126033000_space_conversations_lead_children/snapshot.json +9 -0
- package/migrations/20261126144620_drop_user_message_time_index/migration.sql +1 -0
- package/migrations/20261126144620_drop_user_message_time_index/snapshot.json +38 -0
- package/migrations/20261126153100_inbox_item_subjects/migration.sql +140 -0
- package/migrations/20261126153100_inbox_item_subjects/snapshot.json +9 -0
- package/migrations/20261126153103_inbox_item_subjects_not_null/migration.sql +12 -0
- package/migrations/20261126153103_inbox_item_subjects_not_null/snapshot.json +9 -0
- package/migrations/20261126153105_inbox_item_subject_indexes/migration.sql +1 -0
- package/migrations/20261126153105_inbox_item_subject_indexes/snapshot.json +9 -0
- package/migrations/20261126153108_automation_run_conversation_index/migration.sql +1 -0
- package/migrations/20261126153108_automation_run_conversation_index/snapshot.json +9 -0
- package/migrations/20261126153159_inbox_item_subjects_schema/migration.sql +4 -0
- package/migrations/20261126153159_inbox_item_subjects_schema/snapshot.json +437 -0
- package/migrations/20261126153259_inbox_questions/migration.sql +76 -0
- package/migrations/20261126153259_inbox_questions/snapshot.json +9 -0
- package/migrations/20261126153301_inbox_questions_valid/migration.sql +3 -0
- package/migrations/20261126153301_inbox_questions_valid/snapshot.json +9 -0
- package/migrations/20261126153343_inbox_questions_schema/migration.sql +5 -0
- package/migrations/20261126153343_inbox_questions_schema/snapshot.json +407 -0
- package/migrations/20261126154025_inbox_item_owners/migration.sql +74 -0
- package/migrations/20261126154025_inbox_item_owners/snapshot.json +9 -0
- package/migrations/20261126154048_inbox_item_open_subject_key_index/migration.sql +1 -0
- package/migrations/20261126154048_inbox_item_open_subject_key_index/snapshot.json +9 -0
- package/migrations/20261126154051_drop_inbox_item_owner_indexes/migration.sql +7 -0
- package/migrations/20261126154051_drop_inbox_item_owner_indexes/snapshot.json +9 -0
- package/migrations/20261126154121_inbox_item_owners_schema/migration.sql +8 -0
- package/migrations/20261126154121_inbox_item_owners_schema/snapshot.json +311 -0
- package/migrations/20261126175601_conversation_event_turn/migration.sql +5 -0
- package/migrations/20261126175601_conversation_event_turn/snapshot.json +103 -0
- package/migrations/20261126175614_conversation_event_turn_index/migration.sql +1 -0
- package/migrations/20261126175614_conversation_event_turn_index/snapshot.json +62 -0
- package/migrations/20261126230028_merge_leaves/migration.sql +2 -0
- package/migrations/20261126230028_merge_leaves/snapshot.json +12 -0
- package/migrations/20261126231932_space_lead_holds_name/migration.sql +46 -0
- package/migrations/20261126231932_space_lead_holds_name/snapshot.json +58 -0
- package/migrations/20261127001022_merge_leaves/migration.sql +2 -0
- package/migrations/20261127001022_merge_leaves/snapshot.json +12 -0
- package/package.json +5 -5
- package/skills/jr-rpc/SKILL.md +3 -5
- package/dist/direct-url-BYgYfuIy.js +0 -22
- package/dist/markers-CE0HMXWT.js +0 -67
- package/dist/people-Cegp1Iwq.js +0 -81
- package/dist/start-conversation-Uh8Sk1EF.js +0 -162
- package/dist/turn-session-routing-GtetHsdO.js +0 -1309
- package/dist/user-customization-B27StpVQ.js +0 -9
- package/dist/web-message-id-C6P83ans.js +0 -10
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { mi as moveIdleConversationDestination } from "./mailbox-turn-79Nv1JXv.js";
|
|
1
|
+
import { A as setFirstConversationLocation, Cl as getDashboardConversationLink, Cn as moveIdleConversationDestination, Ei as formatSlackLink, Ku as getStateAdapter, N as claimProviderConversation, O as withConversationMutationLock, P as getConversationIdByProviderConversation, Ti as escapeSlackMrkdwnText, a as getDb, cd as parseSlackChannelId, gd as parseSlackMessageTs, gf as juniorDestinations, i as getConversationStore, mi as getSlackMessagePermalink, o as getSqlExecutor, pi as deleteSlackMessage, vi as postSlackMessage } from "./db-BFmyYZtJ.js";
|
|
2
|
+
import { n as joinPublicChannelForRead, t as checkSlackChannelReadAccess } from "./channel-access-j-YAVYK4.js";
|
|
4
3
|
import { and, eq } from "drizzle-orm";
|
|
5
4
|
// src/chat/slack/continue-in-slack.ts
|
|
6
5
|
/** Refusal for a move that cannot wait for the active Run. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as actorIdentitySchema, Nt as spaceRefSchema, V as conversationDetailReportSchema, X as conversationSummaryReportSchema, Yt as messageAttachmentSchema, zt as inboxItemChangeRecordSchema } from "./types-C4iC-IMC.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
// src/api/objects/cards.ts
|
|
4
4
|
const MAX_LABEL_CHARS = 256;
|
|
@@ -340,8 +340,13 @@ const conversationSubscriptionResponseSchema = z.object({
|
|
|
340
340
|
archivedAt: z.string().datetime().nullable().describe("Set when the conversation is archived for everyone."),
|
|
341
341
|
subscribed: z.boolean()
|
|
342
342
|
}).strict();
|
|
343
|
-
/**
|
|
344
|
-
|
|
343
|
+
/**
|
|
344
|
+
* The root after the viewer left it. `archivedAt` is set when the viewer
|
|
345
|
+
* was the last subscriber, so leaving archived it for everyone.
|
|
346
|
+
*/
|
|
347
|
+
const conversationLeaveResponseSchema = z.object({ archivedAt: z.string().datetime().nullable().describe("Set when the conversation is archived for everyone.") }).strict();
|
|
348
|
+
/** Invite one User, by the id that user search returns, to a Conversation. */
|
|
349
|
+
const conversationInviteBodySchema = z.object({ userId: z.string().min(1).max(64) }).strict();
|
|
345
350
|
/** `added` is false when the person was already a Participant. */
|
|
346
351
|
const conversationInviteResponseSchema = z.object({ added: z.boolean() }).strict();
|
|
347
352
|
// src/api/schema/conversation-stop.ts
|
|
@@ -437,4 +442,4 @@ const conversationFeedSchema = z.object({
|
|
|
437
442
|
*/
|
|
438
443
|
waitingRowsTruncated: z.literal(true).optional()
|
|
439
444
|
}).strict();
|
|
440
|
-
export {
|
|
445
|
+
export { conversationUnchangedDetailWithMailboxSchema as A, runtimeInfoReportSchema as B, cancelConversationPendingMessagesBodySchema as C, conversationPendingMessageDeliverySchema as D, conversationPendingAuthorizationSchema as E, pluginOperationalReportSchema as F, messageObjectCard as G, skillReportSchema as H, pluginPackageContentItemReportSchema as I, personObjectCard as K, pluginPackageContentReportSchema as L, steerConversationPendingMessagesResponseSchema as M, healthReportSchema as N, conversationPendingMessageSchema as O, pluginOperationalReportFeedSchema as P, pluginSchema as R, conversationAutoArchiveSchema as S, conversationDetailWithMailboxReportSchema as T, skillReportsSchema as U, skillDetailReportSchema as V, conversationObjectCard as W, reorderPinnedConversationsBodySchema as _, conversationInviteResponseSchema as a, archiveConversationResponseSchema as b, conversationSubscriptionResponseSchema as c, CONVERSATION_TITLE_MAX_LENGTH as d, conversationTitleSchema as f, pinConversationResponseSchema as g, pinConversationBodySchema as h, conversationInviteBodySchema as i, steerConversationPendingMessagesBodySchema as j, conversationPendingMessagesReportSchema as k, setConversationSpaceBodySchema as l, renameConversationResponseSchema as m, conversationFeedSchema as n, conversationLeaveResponseSchema as o, renameConversationBodySchema as p, webPageObjectCard as q, stopConversationTurnResponseSchema as r, conversationSubscriptionBodySchema as s, conversationFeedQuerySchema as t, setConversationSpaceResponseSchema as u, reorderPinnedConversationsResponseSchema as v, cancelConversationPendingMessagesResponseSchema as w, archiveDoneConversationsResponseSchema as x, archiveConversationBodySchema as y, pluginsSchema as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as logWarn } from "./logging
|
|
1
|
+
import { h as logWarn } from "./logging--smS7XRK.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
|
|
@@ -186,18 +186,4 @@ function toGenAiMessagesTraceAttributes(prefix, messages) {
|
|
|
186
186
|
...partTypes.size > 0 ? { [`${prefix}.part_types`]: [...partTypes] } : void 0
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
|
-
|
|
190
|
-
const SANDBOX_EGRESS_PROXY_PATH = "/api/internal/sandbox-egress";
|
|
191
|
-
const PROXY_PATH_PREFIX = `${SANDBOX_EGRESS_PROXY_PATH}/`;
|
|
192
|
-
const SIGNALS_SEGMENT = "signals";
|
|
193
|
-
/**
|
|
194
|
-
* Replace the credential token and everything after it in a sandbox egress
|
|
195
|
-
* proxy path or URL. Other values are returned unchanged.
|
|
196
|
-
*/
|
|
197
|
-
function redactSandboxEgressProxyPath(value) {
|
|
198
|
-
const index = value.indexOf(PROXY_PATH_PREFIX);
|
|
199
|
-
if (index === -1) return value;
|
|
200
|
-
if (value.slice(index + PROXY_PATH_PREFIX.length).split(/[/?#]/, 1)[0] === SIGNALS_SEGMENT) return value;
|
|
201
|
-
return `${value.slice(0, index)}${PROXY_PATH_PREFIX}<token>`;
|
|
202
|
-
}
|
|
203
|
-
export { resolveConversationPrivacy as a, toCanonicalOutputMessage as c, toGenAiPayloadTraceAttributes as d, getCurrentConversationPrivacy as i, toGenAiMessagesTraceAttributes as l, redactSandboxEgressProxyPath as n, runWithConversationPrivacy as o, canExposeConversationPayload as r, toCanonicalInputMessage as s, SANDBOX_EGRESS_PROXY_PATH as t, toGenAiPayloadMetadata as u };
|
|
189
|
+
export { toCanonicalInputMessage as a, toGenAiPayloadMetadata as c, runWithConversationPrivacy as i, toGenAiPayloadTraceAttributes as l, getCurrentConversationPrivacy as n, toCanonicalOutputMessage as o, resolveConversationPrivacy as r, toGenAiMessagesTraceAttributes as s, canExposeConversationPayload as t };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { a as buildDeliveredTurnStatePatch, o as loadPendingMessageCards, r as completeAuthPauseTurn, t as buildTurnThreadContext } from "./thread-context-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
2
|
+
import { $r as getDispatchIdForConversation, Bo as credentialContextForActor, Io as verifyTimerWatchCredentialSubject, Ku as getStateAdapter, Mn as readParentMessage, On as canJoinTurn, Pn as isEventMailboxMetadata, Qo as isConversationDeliveryPaused, Ro as JUNIOR_THREAD_STATE_TTL_MS, Xi as blockScheduledAutomation, Xn as sendSlackReply, Yn as resolveSlackReplyTarget, a as getDb, di as notifyAutomationBlocked, hu as indexEndedTurnEvents, i as getConversationStore, iu as isTopLevel, n as getConversationEventStore, nu as isPersonInput, oa as blockEventAutomation, ou as ownsLocation, rn as getConversationWorkState, uu as turnBehavior, yf as resolveConversationDestination } from "./db-BFmyYZtJ.js";
|
|
3
|
+
import { Lt as readConversationAutomationRun, M as measureTurnCompactionWait, q as stopConversationAndChildAgents } from "./agent-runner-AjrEV6Qe.js";
|
|
4
|
+
import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging--smS7XRK.js";
|
|
5
|
+
import { Xt as readMessageAttachments, wt as instructionProvenanceFor } from "./types-C4iC-IMC.js";
|
|
6
|
+
import { a as buildDeliveredTurnStatePatch, o as loadPendingMessageCards, r as completeAuthPauseTurn, t as buildTurnThreadContext } from "./thread-context-CqZDKErp.js";
|
|
7
|
+
import { At as turnRequestText, Dt as instructionActorFor, Er as getTurnLifecycle, Et as buildSteeringPiMessage, Fn as persistConversationMessages, Gn as recordDeliveredAssistantMessage, Hn as latestConversationMessageSeq, Jn as upsertConversationMessage, M as eventBatchMessageMeta, N as renderEventBatchInputs, Nn as hydrateConversationMessages, Ot as instructionForInputs, P as timerWatchCredentialSubject, Qn as isEventConversationMessage, Rr as finalizeFailedTurnReplyWithEvent, Rt as buildDeterministicTurnId, Sr as getTurnRecord, St as loadInboxItemInput, Tr as ConversationTurnLifecycleService, Un as markConversationMessage, Wn as normalizeConversationText, X as getTurnUserMessage, Y as completeCancelledConversationTurn, _t as coerceThreadConversationState, c as legacyWebMailboxMetadataSchema, ct as markTurnClosed, d as childAgentTurnOptions, dt as startActiveTurn, f as commitParentMessageFork, gn as commitAcceptedReply, gt as persistThreadStateById, i as listActiveMailboxTurns, it as getConversationTurnBoundaryError, jt as withoutSavedSteeringMessages, m as isParentMessageAuthor, mt as getPersistedThreadState, n as getEventBatchDelayMs, nt as TurnInputCommitLostError, o as sourceFromTurnInput, ot as isTurnInputCommitLostError, pt as getPersistedSandboxState, s as turnInputFactsFromConversationMessage, ti as persistWithRetry, ut as markTurnFailed, vr as saveTurnCheckpoint, vt as createWebAuthorization, xr as failTurnRecord, xt as eventInboxItemInputs, yn as loadConversationProjection, yr as abandonTurnRecord, yt as deleteWebAuthorization } from "./mailbox-turn-uSXhUFc9.js";
|
|
8
|
+
import { d as isChildAgentEvent, t as parentResultActor } from "./parent-result-Ck1rFYRQ.js";
|
|
9
9
|
import { i as getActiveSpan, r as continueTrace } from "./sentry-CPbZjomA.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { n as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { t as readConversationLineage } from "./lineage-
|
|
10
|
+
import { h as getAssistantReplyText } from "./system-prompt-table-CiXy0eNR.js";
|
|
11
|
+
import { t as botConfig } from "./config-CHQ8X251.js";
|
|
12
|
+
import { i as CONVERSATION_METADATA_TASK, n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-C9Yc2_ae.js";
|
|
13
|
+
import { n as getPausedTurnRequest } from "./turn-wake-BhloiI2h.js";
|
|
14
|
+
import { L as mapBounded } from "./prompt-Dv7gkpD6.js";
|
|
15
|
+
import { t as readConversationLineage } from "./lineage-Bktb0UcV.js";
|
|
16
16
|
import * as z from "zod";
|
|
17
17
|
import { isDeepStrictEqual } from "node:util";
|
|
18
18
|
import { createHash } from "node:crypto";
|
|
@@ -225,100 +225,6 @@ async function recordFinishedTurnForAutomatedLimit(args) {
|
|
|
225
225
|
state: args.state
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
|
-
// src/chat/conversations/stop.ts
|
|
229
|
-
/**
|
|
230
|
-
* Stop a Conversation for a person, on every stop path. Every child agent
|
|
231
|
-
* below it stops, then it and they are stopped Conversations until a person
|
|
232
|
-
* sends input, and then its Turn stops. A Turn that waits for sign-in ends
|
|
233
|
-
* too, so a later sign-in does not resume it. Their automated input is held.
|
|
234
|
-
* Nothing above it changes: this reports the stop of a Task to its parent.
|
|
235
|
-
*
|
|
236
|
-
* A stop that comes from a message or a button press, such as the Slack
|
|
237
|
-
* `stop` keyword or stop button, passes it. Its id is claimed in the mailbox
|
|
238
|
-
* first, so a redelivery returns `duplicate` and stops nothing, not even
|
|
239
|
-
* newer work. A stop that fails before its stop request is saved releases
|
|
240
|
-
* its claim, so a redelivery can stop again. A failed claim check keeps a
|
|
241
|
-
* claim that an earlier delivery saved. A failure after the stop request is
|
|
242
|
-
* saved keeps the claim, as does a failed reply: the work is already
|
|
243
|
-
* stopped, and a redelivery must not stop newer work. Its send time
|
|
244
|
-
* is the stop time, and only person input sent at or before it is dropped.
|
|
245
|
-
* So a retry writes the same stop and keeps input that the person sent after
|
|
246
|
-
* it.
|
|
247
|
-
*
|
|
248
|
-
* The child agents and sessions stop first, so a failure leaves the Turn
|
|
249
|
-
* running and the stop can be retried. A child agent can outlive the parent
|
|
250
|
-
* Turn, so this runs even when no Turn runs.
|
|
251
|
-
*/
|
|
252
|
-
async function stopConversation(args) {
|
|
253
|
-
if (args.message && (await claimInboundMessage({
|
|
254
|
-
conversationStore: args.conversationStore,
|
|
255
|
-
message: args.message,
|
|
256
|
-
state: args.state
|
|
257
|
-
})).status === "duplicate") return { status: "duplicate" };
|
|
258
|
-
let stopSaved = false;
|
|
259
|
-
try {
|
|
260
|
-
const nowMs = Date.now();
|
|
261
|
-
const stoppedAtMs = args.message?.createdAtMs ?? nowMs;
|
|
262
|
-
await reportPersonStopToParent(args.conversationId, {
|
|
263
|
-
queue: args.queue,
|
|
264
|
-
state: args.state,
|
|
265
|
-
stoppedAtMs
|
|
266
|
-
});
|
|
267
|
-
const result = await stopConversationAndChildAgents({
|
|
268
|
-
conversationId: args.conversationId,
|
|
269
|
-
conversationStore: args.conversationStore,
|
|
270
|
-
nowMs,
|
|
271
|
-
onStopSaved: () => {
|
|
272
|
-
stopSaved = true;
|
|
273
|
-
},
|
|
274
|
-
queue: args.queue,
|
|
275
|
-
sentAtOrBeforeMs: args.message ? stoppedAtMs : void 0,
|
|
276
|
-
state: args.state,
|
|
277
|
-
stoppedAtMs
|
|
278
|
-
});
|
|
279
|
-
if (result.status === "requested") await ensureConversationWake({
|
|
280
|
-
conversationId: args.conversationId,
|
|
281
|
-
conversationStore: args.conversationStore,
|
|
282
|
-
idempotencyKey: `conversation-stop:${args.conversationId}:${result.runId}`,
|
|
283
|
-
nowMs,
|
|
284
|
-
queue: args.queue,
|
|
285
|
-
replaceExistingWake: true,
|
|
286
|
-
state: args.state
|
|
287
|
-
});
|
|
288
|
-
return result;
|
|
289
|
-
} catch (error) {
|
|
290
|
-
if (args.message && !stopSaved) await releaseInboundMessage({
|
|
291
|
-
message: args.message,
|
|
292
|
-
state: args.state
|
|
293
|
-
});
|
|
294
|
-
throw error;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Stop a Conversation and every child agent below it, through
|
|
299
|
-
* `stopConversationTree`. A person's stop and the automated-turn limit call
|
|
300
|
-
* this. The child agents stop first, so a failure leaves the Conversation
|
|
301
|
-
* running and the stop can be retried. Its waiting parent messages are
|
|
302
|
-
* dropped before its stop request is saved, so no stop request outlives
|
|
303
|
-
* the stop.
|
|
304
|
-
*/
|
|
305
|
-
async function stopConversationAndChildAgents(args) {
|
|
306
|
-
const { conversationId, ...options } = args;
|
|
307
|
-
await stopChildAgentsBelow(conversationId, {
|
|
308
|
-
nowMs: options.nowMs,
|
|
309
|
-
queue: options.queue,
|
|
310
|
-
stoppedAtMs: options.stoppedAtMs,
|
|
311
|
-
state: options.state
|
|
312
|
-
});
|
|
313
|
-
await cancelWaitingParentMessages(conversationId, {
|
|
314
|
-
nowMs: options.stoppedAtMs,
|
|
315
|
-
state: options.state
|
|
316
|
-
});
|
|
317
|
-
const [result] = await stopConversationTree([conversationId], options);
|
|
318
|
-
if (!result) throw new Error("Stop returned no result");
|
|
319
|
-
await dropOwnUnreadLoopReplies(conversationId, options.state);
|
|
320
|
-
return result;
|
|
321
|
-
}
|
|
322
228
|
// src/chat/slack/automated-turn-limit-notice.ts
|
|
323
229
|
/**
|
|
324
230
|
* Stop and notice for the consecutive automated-turn limit.
|
|
@@ -543,6 +449,81 @@ async function runTurnEndTasks(args) {
|
|
|
543
449
|
params
|
|
544
450
|
}, conversationId, turnId);
|
|
545
451
|
}
|
|
452
|
+
// src/chat/task-execution/turn-failure.ts
|
|
453
|
+
function captureConversationTurnFailure(args) {
|
|
454
|
+
const eventId = logException(args.error, `conversation.turn.${args.failureCode}`, {
|
|
455
|
+
conversationId: args.conversationId,
|
|
456
|
+
...args.runId ? { runId: args.runId } : void 0,
|
|
457
|
+
turnId: args.turnId
|
|
458
|
+
});
|
|
459
|
+
return typeof eventId === "string" ? eventId : void 0;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Record a final-attempt failure on the Turn record, the Conversation, and
|
|
463
|
+
* the Turn lifecycle, so the Turn ends failed and its update reaches the
|
|
464
|
+
* starter and Watches. The caller still acknowledges the input.
|
|
465
|
+
*/
|
|
466
|
+
async function failConversationTurn(args) {
|
|
467
|
+
const { conversation, conversationId, failure, failureCode, runId, turnId, userMessageId } = args;
|
|
468
|
+
const failureEventId = args.modelFailureCaptureAttempted && failureCode === "agent_run_failed" ? args.modelFailureEventId : captureConversationTurnFailure({
|
|
469
|
+
conversationId,
|
|
470
|
+
error: failure,
|
|
471
|
+
failureCode,
|
|
472
|
+
runId,
|
|
473
|
+
turnId
|
|
474
|
+
});
|
|
475
|
+
try {
|
|
476
|
+
const latest = await getTurnRecord(conversationId, turnId);
|
|
477
|
+
if (latest) await failTurnRecord({
|
|
478
|
+
conversationId,
|
|
479
|
+
errorMessage: failure instanceof Error ? failure.message : String(failure),
|
|
480
|
+
expectedVersion: latest.version,
|
|
481
|
+
turnId
|
|
482
|
+
});
|
|
483
|
+
} catch (turnRecordError) {
|
|
484
|
+
captureConversationTurnFailure({
|
|
485
|
+
conversationId,
|
|
486
|
+
error: turnRecordError,
|
|
487
|
+
failureCode: "persistence_failed",
|
|
488
|
+
runId,
|
|
489
|
+
turnId
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
try {
|
|
493
|
+
markTurnFailed({
|
|
494
|
+
conversation,
|
|
495
|
+
nowMs: Date.now(),
|
|
496
|
+
sessionId: turnId,
|
|
497
|
+
userMessageId,
|
|
498
|
+
markConversationMessage
|
|
499
|
+
});
|
|
500
|
+
await persistThreadStateById(conversationId, {
|
|
501
|
+
conversation,
|
|
502
|
+
sandboxRef: args.sandboxRef ?? null
|
|
503
|
+
});
|
|
504
|
+
} catch (persistenceError) {
|
|
505
|
+
captureConversationTurnFailure({
|
|
506
|
+
conversationId,
|
|
507
|
+
error: persistenceError,
|
|
508
|
+
failureCode: "persistence_failed",
|
|
509
|
+
runId,
|
|
510
|
+
turnId
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
await args.lifecycle.fail({
|
|
514
|
+
conversationId,
|
|
515
|
+
createdAtMs: Date.now(),
|
|
516
|
+
...failureEventId ? { eventId: failureEventId } : void 0,
|
|
517
|
+
failureCode,
|
|
518
|
+
failureText: failure instanceof Error ? failure.message : String(failure),
|
|
519
|
+
reportAs: args.reportAs,
|
|
520
|
+
turnId
|
|
521
|
+
});
|
|
522
|
+
await indexEndedTurnEvents({
|
|
523
|
+
conversationId,
|
|
524
|
+
turnId
|
|
525
|
+
});
|
|
526
|
+
}
|
|
546
527
|
// src/chat/task-execution/mailbox-input.ts
|
|
547
528
|
/**
|
|
548
529
|
* Return the Turn inputs of web Messages, one per non-empty Message, in
|
|
@@ -713,14 +694,6 @@ var conversation_turn_exports = /* @__PURE__ */ __exportAll({ createConversation
|
|
|
713
694
|
function stableHex(...parts) {
|
|
714
695
|
return createHash("sha256").update(parts.join("\0")).digest("hex").slice(0, 24);
|
|
715
696
|
}
|
|
716
|
-
function captureConversationTurnFailure(args) {
|
|
717
|
-
const eventId = logException(args.error, `conversation.turn.${args.failureCode}`, {
|
|
718
|
-
conversationId: args.conversationId,
|
|
719
|
-
...args.runId ? { runId: args.runId } : void 0,
|
|
720
|
-
turnId: args.turnId
|
|
721
|
-
});
|
|
722
|
-
return typeof eventId === "string" ? eventId : void 0;
|
|
723
|
-
}
|
|
724
697
|
function hasLostTurnInputCommit(error) {
|
|
725
698
|
const cause = getConversationTurnBoundaryError(error)?.cause ?? error;
|
|
726
699
|
return isTurnInputCommitLostError(error) || isTurnInputCommitLostError(cause);
|
|
@@ -782,7 +755,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, updates) {
|
|
|
782
755
|
let authorIdentityId;
|
|
783
756
|
let webInputMessages = [];
|
|
784
757
|
const storedConversation = await getConversationStore().get({ conversationId: context.conversationId });
|
|
785
|
-
const kind = storedConversation?.kind ?? "
|
|
758
|
+
const kind = storedConversation?.kind ?? "thread";
|
|
786
759
|
const visibility = isTopLevel({ parentConversationId: storedConversation?.parentConversationId }) ? storedConversation?.visibility : storedConversation?.visibility ?? "private";
|
|
787
760
|
const mailboxDestination = resolved.kind === "mailbox" ? resolved.batch[0]?.message.destination : void 0;
|
|
788
761
|
const destination = resolveConversationDestination({
|
|
@@ -854,12 +827,13 @@ function createConversationTurnWorker(agentRunner, deliverMessage, updates) {
|
|
|
854
827
|
const postsToProvider = Boolean(conversationLocation) && isEventTurn;
|
|
855
828
|
const behavior = turnBehavior({
|
|
856
829
|
kind,
|
|
830
|
+
hasParent: !isTopLevel({ parentConversationId: storedConversation?.parentConversationId }),
|
|
857
831
|
personInput: isPersonInput(source.kind)
|
|
858
832
|
});
|
|
859
833
|
const webActor = actor.platform === "web" ? actor : void 0;
|
|
860
834
|
const signInActor = behavior.waitsForSignIn ? webActor : void 0;
|
|
861
835
|
const disabledFeatures = signInActor ? [] : ["interactive-auth"];
|
|
862
|
-
const deliverToProvider = postsToProvider && behavior.delivery === "location";
|
|
836
|
+
const deliverToProvider = postsToProvider && (behavior.delivery === "location" || !behavior.gated && storedConversation !== void 0 && ownsLocation(storedConversation));
|
|
863
837
|
const surface = postsToProvider ? "slack" : "api";
|
|
864
838
|
const inputTelemetry = resolved.kind === "mailbox" ? turnInputTelemetry(resolved.batch.map((entry) => entry.message)) : void 0;
|
|
865
839
|
const turnTrace = inputTelemetry ?? (savedTurn?.traceContext ? { traceContexts: [savedTurn.traceContext] } : void 0);
|
|
@@ -1160,63 +1134,19 @@ function createConversationTurnWorker(agentRunner, deliverMessage, updates) {
|
|
|
1160
1134
|
if (hasLostTurnInputCommit(failure)) return { status: "lost_lease" };
|
|
1161
1135
|
if (stopSignal?.aborted) return await completeCancelledTurn();
|
|
1162
1136
|
if (!context.attempt.isFinalAttempt) throw failure;
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
error: failure,
|
|
1166
|
-
failureCode,
|
|
1167
|
-
runId: currentRunId,
|
|
1168
|
-
turnId
|
|
1169
|
-
});
|
|
1170
|
-
try {
|
|
1171
|
-
const latest = await getTurnRecord(context.conversationId, turnId);
|
|
1172
|
-
if (latest) await failTurnRecord({
|
|
1173
|
-
conversationId: context.conversationId,
|
|
1174
|
-
errorMessage: failure instanceof Error ? failure.message : String(failure),
|
|
1175
|
-
expectedVersion: latest.version,
|
|
1176
|
-
turnId
|
|
1177
|
-
});
|
|
1178
|
-
} catch (turnRecordError) {
|
|
1179
|
-
captureConversationTurnFailure({
|
|
1180
|
-
conversationId: context.conversationId,
|
|
1181
|
-
error: turnRecordError,
|
|
1182
|
-
failureCode: "persistence_failed",
|
|
1183
|
-
runId: currentRunId,
|
|
1184
|
-
turnId
|
|
1185
|
-
});
|
|
1186
|
-
}
|
|
1187
|
-
try {
|
|
1188
|
-
markTurnFailed({
|
|
1189
|
-
conversation,
|
|
1190
|
-
nowMs: Date.now(),
|
|
1191
|
-
sessionId: turnId,
|
|
1192
|
-
userMessageId,
|
|
1193
|
-
markConversationMessage
|
|
1194
|
-
});
|
|
1195
|
-
await persistThreadStateById(context.conversationId, {
|
|
1196
|
-
conversation,
|
|
1197
|
-
sandboxRef: initialSandboxRef ?? null
|
|
1198
|
-
});
|
|
1199
|
-
} catch (persistenceError) {
|
|
1200
|
-
captureConversationTurnFailure({
|
|
1201
|
-
conversationId: context.conversationId,
|
|
1202
|
-
error: persistenceError,
|
|
1203
|
-
failureCode: "persistence_failed",
|
|
1204
|
-
runId: currentRunId,
|
|
1205
|
-
turnId
|
|
1206
|
-
});
|
|
1207
|
-
}
|
|
1208
|
-
await lifecycle.fail({
|
|
1137
|
+
await failConversationTurn({
|
|
1138
|
+
conversation,
|
|
1209
1139
|
conversationId: context.conversationId,
|
|
1210
|
-
|
|
1211
|
-
...failureEventId ? { eventId: failureEventId } : void 0,
|
|
1140
|
+
failure,
|
|
1212
1141
|
failureCode,
|
|
1213
|
-
|
|
1142
|
+
lifecycle,
|
|
1143
|
+
modelFailureCaptureAttempted,
|
|
1144
|
+
modelFailureEventId,
|
|
1214
1145
|
reportAs: parentResultActor(actor, source.kind),
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
turnId
|
|
1146
|
+
runId: currentRunId,
|
|
1147
|
+
sandboxRef: initialSandboxRef,
|
|
1148
|
+
turnId,
|
|
1149
|
+
userMessageId
|
|
1220
1150
|
});
|
|
1221
1151
|
await acknowledge();
|
|
1222
1152
|
return { status: "completed" };
|
|
@@ -1224,4 +1154,4 @@ function createConversationTurnWorker(agentRunner, deliverMessage, updates) {
|
|
|
1224
1154
|
});
|
|
1225
1155
|
};
|
|
1226
1156
|
}
|
|
1227
|
-
export {
|
|
1157
|
+
export { recordFinishedTurnForAutomatedLimit as a, getTurnInputSpanAttributes as c, stopAtAutomatedTurnLimit as i, turnInputTelemetry as l, createConversationTurnWorker as n, AgentRunError as o, supersedeTurnForInput as r, executeTurn as s, conversation_turn_exports as t, withTurnSpan as u };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as recordSubagentStartedMarker } from "./markers-CE0HMXWT.js";
|
|
1
|
+
import { Gd as juniorAgentBindings, It as spawnChildAgentInputSchema, Mt as getAgentBinding, Zl as capsActiveChildren, i as getConversationStore, lf as juniorConversations, o as getSqlExecutor, rd as nextDetailVersion, rn as getConversationWorkState, tn as ensureConversationWake, yn as hasConversationStop } from "./db-BFmyYZtJ.js";
|
|
2
|
+
import { C as getChildAgentLockName, Dr as loadTurnStart, It as addConversationNote, T as getSpawnedChildConversationId, W as getConversationStoppedAtMs, b as readAgentConfig, l as appendParentMessage, u as buildParentMessage, y as agentConfigSchema } from "./mailbox-turn-uSXhUFc9.js";
|
|
3
|
+
import { m as readChildConversationSender, r as recordSubagentStartedMarker, s as listOpenChildAgents } from "./parent-result-Ck1rFYRQ.js";
|
|
4
|
+
import { I as AgentNameInUseError, L as AgentStoppedError, R as ChildAgentLimitError } from "./agent-runner-AjrEV6Qe.js";
|
|
6
5
|
import { randomUUID } from "node:crypto";
|
|
7
6
|
import { eq } from "drizzle-orm";
|
|
8
7
|
/**
|
|
@@ -15,14 +14,17 @@ async function assertCanGiveChildWork(parentConversationId) {
|
|
|
15
14
|
}
|
|
16
15
|
/**
|
|
17
16
|
* Throw when giving work to one child agent would put its parent over
|
|
18
|
-
* `
|
|
17
|
+
* `MAX_ACTIVE_CHILD_AGENTS`, unless the parent is a Lead. A child agent is active while
|
|
19
18
|
* its listing shows open work, so a busy child already counts and messages
|
|
20
19
|
* queued for it do not count again. A new or idle child becomes active. This
|
|
21
20
|
* is the only place the rule for which child agents count lives. `active` is
|
|
22
21
|
* the parent's active children from `listOpenChildAgents`.
|
|
23
22
|
*/
|
|
24
|
-
function assertChildAgentCapacity(active, childConversationId) {
|
|
25
|
-
if (
|
|
23
|
+
async function assertChildAgentCapacity(parentConversationId, active, childConversationId) {
|
|
24
|
+
if (active.includes(childConversationId) || active.length < 8) return;
|
|
25
|
+
const parent = await getConversationStore().get({ conversationId: parentConversationId });
|
|
26
|
+
if (parent && !capsActiveChildren(parent.kind)) return;
|
|
27
|
+
throw new ChildAgentLimitError(8);
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
28
30
|
* Create the Conversation of one new child agent and bind its name, after
|
|
@@ -36,7 +38,7 @@ async function createChildAgentConversation(input, childConversationId, nowMs) {
|
|
|
36
38
|
name: input.agentName,
|
|
37
39
|
parentConversationId: input.parentConversationId
|
|
38
40
|
})) throw new AgentNameInUseError(input.agentName);
|
|
39
|
-
assertChildAgentCapacity(await listOpenChildAgents(input.parentConversationId), childConversationId);
|
|
41
|
+
await assertChildAgentCapacity(input.parentConversationId, await listOpenChildAgents(input.parentConversationId), childConversationId);
|
|
40
42
|
await getConversationStore().createChild({
|
|
41
43
|
childConversationId,
|
|
42
44
|
kind: input.kind,
|
|
@@ -203,7 +205,7 @@ async function messageChildAgent(input, options, nowMs = Date.now()) {
|
|
|
203
205
|
}
|
|
204
206
|
await assertCanGiveChildWork(input.parentConversationId);
|
|
205
207
|
const active = await listOpenChildAgents(input.parentConversationId);
|
|
206
|
-
assertChildAgentCapacity(active, input.childConversationId);
|
|
208
|
+
await assertChildAgentCapacity(input.parentConversationId, active, input.childConversationId);
|
|
207
209
|
return {
|
|
208
210
|
delivery: "message",
|
|
209
211
|
value: active.includes(input.childConversationId) ? "queued" : "started"
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { i as finalizeMcpAuthorization } from "./agent-runner-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { n as
|
|
1
|
+
import { Ku as getStateAdapter, dd as parseSlackUserId, hc as upsertLinkedIdentity, o as getSqlExecutor, pc as findUserByVerifiedEmails, sc as resolveActorIdentityId, tc as readIdentityById, vi as postSlackMessage, zs as getSlackClient } from "./db-BFmyYZtJ.js";
|
|
2
|
+
import { M as acquireActiveLock, n as getChatConfig, r as getRuntimeMetadata, t as botConfig } from "./config-CHQ8X251.js";
|
|
3
|
+
import { M as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging--smS7XRK.js";
|
|
4
|
+
import { L as mapBounded } from "./prompt-Dv7gkpD6.js";
|
|
5
|
+
import { Sr as getTurnRecord, Tn as recordAuthorizationCompleted, _t as coerceThreadConversationState, ii as parseOAuthStatePayload, mt as getPersistedThreadState, or as authorizationId, pr as getConversationPendingAuth, ri as formatProviderLabel, wn as recordAuthenticationLinked, yt as deleteWebAuthorization } from "./mailbox-turn-uSXhUFc9.js";
|
|
6
|
+
import { i as finalizeMcpAuthorization } from "./agent-runner-AjrEV6Qe.js";
|
|
7
|
+
import { i as homeDir } from "./package-discovery-DD9vencX.js";
|
|
8
|
+
import { t as discoverSkills } from "./skills-BCEU41zM.js";
|
|
9
|
+
import { C as getMcpAuthSession, H as getMcpProviderErrorAttributes, T as getMcpStoredOAuthCredentials, f as buildOAuthTokenRequest, k as putMcpStoredOAuthCredentials, m as hasRequiredOAuthScope, p as parseOAuthTokenResponse, y as deleteMcpAuthSession } from "./registry-iXMT5Jmh.js";
|
|
10
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-DfSpJZdY.js";
|
|
11
|
+
import { A as createUserTokenStore, I as resolvePluginOAuthAccount } from "./profile-BQ-iBDsZ.js";
|
|
12
|
+
import { i as lookupSlackUserProfile } from "./users-ByG5RCEJ.js";
|
|
13
|
+
import { a as wakePausedTurn, i as wakeAuthorizedTurn } from "./turn-wake-BhloiI2h.js";
|
|
14
|
+
import { s as readConnectedOAuthTokens, t as escapeHtml, u as htmlCallbackResponse } from "./html-B3VKTGbJ.js";
|
|
15
|
+
import { n as relayLocalOAuthCallback } from "./oauth-relay-C36gX1gH.js";
|
|
11
16
|
import * as z from "zod";
|
|
12
17
|
import path from "node:path";
|
|
13
18
|
import { createHmac, createSecretKey, timingSafeEqual } from "node:crypto";
|
|
@@ -495,7 +500,7 @@ async function GET(request, provider, waitUntil, options) {
|
|
|
495
500
|
const clientId = process.env[providerConfig.clientIdEnv]?.trim();
|
|
496
501
|
const clientSecret = process.env[providerConfig.clientSecretEnv]?.trim();
|
|
497
502
|
if (!clientId || !clientSecret) return htmlErrorResponse("Configuration error", "OAuth client credentials are not configured on the server.", 500);
|
|
498
|
-
const baseUrl =
|
|
503
|
+
const baseUrl = getChatConfig().deployment.baseUrl;
|
|
499
504
|
if (!baseUrl) return htmlErrorResponse("Configuration error", "The server cannot determine its base URL.", 500);
|
|
500
505
|
const redirectUri = `${baseUrl}${providerConfig.callbackPath}`;
|
|
501
506
|
const requestedScope = stored.scope ?? providerConfig.scope;
|
|
@@ -639,7 +644,7 @@ const localCredentialSyncSchema = z.object({
|
|
|
639
644
|
tokens: pluginStoredTokensSchema
|
|
640
645
|
}).strict();
|
|
641
646
|
function syncSecret() {
|
|
642
|
-
const secret =
|
|
647
|
+
const secret = getChatConfig().secrets.juniorSecret;
|
|
643
648
|
if (!secret) throw new Error("Local credential sync requires JUNIOR_SECRET");
|
|
644
649
|
return secret;
|
|
645
650
|
}
|