@sentry/junior 0.312.0 → 0.313.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-iIq7ihf7.js → adapter-CYAvJzZS.js} +1 -1
- package/dist/{adapter-context-BRjEWRy1.js → adapter-context-CVsHoVSf.js} +2 -2
- package/dist/{admin-DhInw5K9.js → admin-Cyhb4TwZ.js} +1 -1
- package/dist/{agent-runner-C9iDurwX.js → agent-runner-B5y9MsT-.js} +93 -45
- package/dist/api/schema.d.ts +1 -1
- package/dist/api/schema.js +4 -4
- package/dist/api.d.ts +1 -1
- package/dist/api.js +40 -40
- package/dist/{app-DRFrC8Mw.d.ts → app-DA8-hCMj.d.ts} +2 -2
- package/dist/app.d.ts +1 -1
- package/dist/app.js +31 -33
- package/dist/{background-compaction-queue-DrKi7w3d.js → background-compaction-queue-iZXadLV3.js} +56 -6
- package/dist/{catalog-runtime-D7xapBAX.js → catalog-runtime-kkE3hvCX.js} +1 -1
- package/dist/{channel-access-CJGfNTdn.js → channel-access-mt7K6dPh.js} +2 -2
- package/dist/cli/chat.js +16 -16
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +5 -5
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{config-kXB2Y5tl.js → config-CWbwKj0j.js} +3 -3
- package/dist/{continue-in-slack-O6pV5004.js → continue-in-slack-CxyFzdlF.js} +6 -6
- package/dist/{conversation-feed-uNOv_x68.js → conversation-feed-BEXLD3Me.js} +13 -2
- package/dist/{conversation-privacy-L4ja1_W6.js → conversation-privacy-BrMiDN61.js} +1 -1
- package/dist/{conversation-turn-CeLbHqdw.js → conversation-turn-B35eu0uz.js} +63 -45
- package/dist/{credential-sync-I8VBGk05.js → credential-sync-DWTOEQrm.js} +15 -16
- package/dist/{credentialed-Cb6E2phL.js → credentialed-Dyv8b-lu.js} +12 -14
- package/dist/{db-BbC5stfa.d.ts → db-DYGcXYl3.d.ts} +1 -1
- package/dist/{db-LAyyX8tk.js → db-PwSRzWWn.js} +17 -19
- package/dist/{executor-SCub-fAq.js → executor-CgWyWfYz.js} +2 -4
- package/dist/{html-BCZ3Xtb_.js → html-DidUcRhI.js} +6 -6
- package/dist/ingest-B0AggUEC.js +7931 -0
- package/dist/{install-DCFJFkC0.js → install-2urLLXNt.js} +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{lineage-B_m-4TJw.js → lineage-BXplQAVH.js} +2 -2
- package/dist/{list-CN2QA2R9.js → list-DyIyReSV.js} +82 -69
- package/dist/{logging-dQ9ZRGQ8.js → logging-DNt-qOIO.js} +1 -1
- package/dist/{media-CYm1QD8T.js → media-B0pZJ0bG.js} +9 -6
- package/dist/{message-DSXGj1hM.js → message-Z5YKC-Af.js} +23 -9
- package/dist/{model-input--TrP9hYV.js → model-input-BhPJYdSV.js} +3 -3
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +4 -4
- package/dist/{oauth-callback-server-DHCZC6B4.js → oauth-callback-server-ByvDdcdY.js} +2 -2
- package/dist/{oauth-relay-pPMGnDZt.js → oauth-relay-D-kK0yoN.js} +1 -1
- package/dist/{registry-CZOzddwu.js → registry-POH4bZC4.js} +1 -1
- package/dist/{statuses-_cRJHXK7.js → reporting-window-C4dbzDiR.js} +1 -27
- package/dist/request-deadline-BUiRYQYj.js +24 -0
- package/dist/{resolve-cKOQ14Dh.js → resolve-CWtBNSKP.js} +3 -3
- package/dist/{runner-DBfUW44l.js → runner-CsZ_VRxp.js} +8 -8
- package/dist/{sandbox-egress-signals-BVF_xAm1.js → sandbox-egress-signals-FbCk1FkN.js} +1 -1
- package/dist/{schema-BEHKxr4I.d.ts → schema-DBf18QPS.d.ts} +131 -912
- package/dist/{schema-Bk9Nm2E8.js → schema-DojR2uCL.js} +4 -4
- package/dist/{service-account-CVYsFjty.js → service-account-CDYb9hfX.js} +3 -3
- package/dist/{service-account-Ts4ulcrV.js → service-account-o15pZWcJ.js} +5 -5
- package/dist/{skills-VTnhAJWm.js → skills-B0jP4whm.js} +2 -2
- package/dist/{slack-conversation-unfurl-fuLnF1jE.js → slack-conversation-unfurl-D26t9kBC.js} +8 -8
- package/dist/{spawn-vxAarlX5.js → spawn-BjljgExZ.js} +14 -33
- package/dist/{start-conversation-CEn2KH1A.js → start-conversation-DbVujrwO.js} +10 -196
- package/dist/{state-C1P3_Ywk.js → state-BTawTCme.js} +4 -4
- package/dist/{result-event-type-BdIJuZxg.js → statuses-BKwqCPhj.js} +25 -4
- package/dist/{store-DFZaN-Ix.js → store-CjXrp-Up.js} +3 -3
- package/dist/{task-queue-Cx4Lmjyk.js → task-queue-Cwlatjz3.js} +4 -4
- package/dist/{task-runner-CbTwFA6k.js → task-runner--Ke8KSMf.js} +11 -11
- package/dist/{thread-context-BkAZDTX2.js → thread-context-B8exINEe.js} +6 -7
- package/dist/{thread-state-DhPndWi1.js → turn-membership-DTR3SaKD.js} +251 -17
- package/dist/{validation-nIzMtAVJ.js → validation-Ce0qbMlT.js} +1 -1
- package/dist/{vercel-queue-hW90XzbG.js → vercel-queue-q4z8w5QO.js} +2 -2
- package/dist/{version-Brbtz4Qf.js → version-DFh4n9nr.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{warmup-BDA5myRK.js → warmup-D5hzqTcp.js} +44 -2969
- package/dist/{worker-D63RcaVD.js → worker-CDg9Lbpg.js} +6 -6
- package/migrations/0158_keep_legacy_archive_columns.sql +5 -0
- package/migrations/0159_conversation_embeddings_fk_validate.sql +5 -0
- package/migrations/meta/0158_snapshot.json +6515 -0
- package/migrations/meta/0159_snapshot.json +6515 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +5 -5
- package/dist/callback-mFlTUWWx.js +0 -75
- package/dist/child-message-DcsritGf.js +0 -179
- package/dist/ingest-BDf3D50j.js +0 -3836
- package/dist/result-DcvEOe1r.js +0 -574
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { B as claimProviderConversation, R as setFirstConversationLocation, V as getConversationIdByProviderConversation, a as getConversationStore, o as getDb, s as getSqlExecutor, w as withConversationMutationLock } from "./db-
|
|
2
|
-
import { Gr as deleteSlackMessage, Kr as getSlackMessagePermalink, Xr as postSlackMessage, ai as escapeSlackMrkdwnText, oi as formatSlackLink, wi as getDashboardConversationLink } from "./credentialed-
|
|
1
|
+
import { B as claimProviderConversation, R as setFirstConversationLocation, V as getConversationIdByProviderConversation, a as getConversationStore, o as getDb, s as getSqlExecutor, w as withConversationMutationLock } from "./db-PwSRzWWn.js";
|
|
2
|
+
import { Gr as deleteSlackMessage, Kr as getSlackMessagePermalink, Xr as postSlackMessage, ai as escapeSlackMrkdwnText, oi as formatSlackLink, wi as getDashboardConversationLink } from "./credentialed-Dyv8b-lu.js";
|
|
3
3
|
import { u as parseSlackChannelId, v as parseSlackMessageTs } from "./actor-BsBdxDXQ.js";
|
|
4
|
-
import { n as joinPublicChannelForRead, t as checkSlackChannelReadAccess } from "./channel-access-
|
|
5
|
-
import { i as getStateAdapter } from "./adapter-
|
|
6
|
-
import {
|
|
7
|
-
import { q as juniorDestinations } from "./executor-
|
|
4
|
+
import { n as joinPublicChannelForRead, t as checkSlackChannelReadAccess } from "./channel-access-mt7K6dPh.js";
|
|
5
|
+
import { i as getStateAdapter } from "./adapter-CYAvJzZS.js";
|
|
6
|
+
import { mn as moveIdleConversationDestination } from "./turn-membership-DTR3SaKD.js";
|
|
7
|
+
import { q as juniorDestinations } from "./executor-CgWyWfYz.js";
|
|
8
8
|
import { and, eq } from "drizzle-orm";
|
|
9
9
|
// src/chat/slack/continue-in-slack.ts
|
|
10
10
|
/** Refusal for a move that cannot wait for the active Run. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as conversationDetailReportSchema, Ot as messageAttachmentSchema, et as conversationSummaryReportSchema, vt as inboxItemChangeRecordSchema, z as actorIdentitySchema } from "./media-
|
|
1
|
+
import { G as conversationDetailReportSchema, Ot as messageAttachmentSchema, et as conversationSummaryReportSchema, vt as inboxItemChangeRecordSchema, z as actorIdentitySchema } from "./media-B0pZJ0bG.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
// src/api/objects/cards.ts
|
|
4
4
|
const MAX_LABEL_CHARS = 256;
|
|
@@ -395,6 +395,11 @@ const conversationFeedItemSchema = conversationSummaryReportSchema.extend({
|
|
|
395
395
|
links: z.array(z.url()).max(3).optional(),
|
|
396
396
|
/** Only with `include=media`. */
|
|
397
397
|
media: z.array(conversationFeedMediaSchema).max(3).optional(),
|
|
398
|
+
/**
|
|
399
|
+
* Threads that `CONVERSATION_FEED_THREAD_LIMIT` left out of `threads`.
|
|
400
|
+
* Only on a root, and only when the cap cut some.
|
|
401
|
+
*/
|
|
402
|
+
omittedThreadCount: z.number().int().positive().optional(),
|
|
398
403
|
threads: z.lazy(() => z.array(conversationFeedItemSchema)).optional(),
|
|
399
404
|
/** Only on the viewer's own feed. */
|
|
400
405
|
viewerAnswer: conversationFeedViewerAnswerSchema.optional()
|
|
@@ -404,6 +409,12 @@ const conversationFeedSchema = z.object({
|
|
|
404
409
|
source: z.literal("conversation_index"),
|
|
405
410
|
generatedAt: z.string(),
|
|
406
411
|
/** Present when older conversations follow this page. */
|
|
407
|
-
nextCursor: z.string().optional()
|
|
412
|
+
nextCursor: z.string().optional(),
|
|
413
|
+
/**
|
|
414
|
+
* Present when `CONVERSATION_FEED_WAITING_LIMIT` cut the waiting rows
|
|
415
|
+
* that this first page adds from outside it. The rest come on later
|
|
416
|
+
* pages.
|
|
417
|
+
*/
|
|
418
|
+
waitingRowsTruncated: z.literal(true).optional()
|
|
408
419
|
}).strict();
|
|
409
420
|
export { pluginPackageContentReportSchema as A, webPageObjectCard as B, conversationUnchangedDetailWithMailboxSchema as C, pluginOperationalReportFeedSchema as D, healthReportSchema as E, skillReportSchema as F, skillReportsSchema as I, conversationObjectCard as L, pluginsSchema as M, runtimeInfoReportSchema as N, pluginOperationalReportSchema as O, skillDetailReportSchema as P, messageObjectCard as R, conversationPendingMessagesReportSchema as S, steerConversationPendingMessagesResponseSchema as T, cancelConversationPendingMessagesResponseSchema as _, conversationInviteResponseSchema as a, conversationPendingMessageDeliverySchema as b, pinConversationBodySchema as c, reorderPinnedConversationsResponseSchema as d, archiveConversationBodySchema as f, cancelConversationPendingMessagesBodySchema as g, conversationAutoArchiveSchema as h, conversationInviteBodySchema as i, pluginSchema as j, pluginPackageContentItemReportSchema as k, pinConversationResponseSchema as l, archiveDoneConversationsResponseSchema as m, conversationFeedSchema as n, conversationSubscriptionBodySchema as o, archiveConversationResponseSchema as p, stopConversationTurnResponseSchema as r, conversationSubscriptionResponseSchema as s, conversationFeedQuerySchema as t, reorderPinnedConversationsBodySchema as u, conversationDetailWithMailboxReportSchema as v, steerConversationPendingMessagesBodySchema as w, conversationPendingMessageSchema as x, conversationPendingAuthorizationSchema as y, personObjectCard as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as logWarn } from "./logging-
|
|
1
|
+
import { h as logWarn } from "./logging-DNt-qOIO.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,21 +1,21 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import { Ii as blockEventAutomation, To as verifyTimerWatchCredentialSubject, Tr as readConversationAutomationRun, Ur as notifyAutomationBlocked, jr as getDispatchIdForConversation, mi as blockScheduledAutomation } from "./credentialed-
|
|
3
|
-
import { A as isTopLevelKind, F as turnBehavior, O as isPersonInput, a as getConversationStore, o as getDb } from "./db-
|
|
4
|
-
import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging-
|
|
5
|
-
import { kt as readMessageAttachments } from "./media-
|
|
6
|
-
import { C as isConversationDeliveryPaused } from "./agent-runner-
|
|
7
|
-
import { a as buildDeliveredTurnStatePatch, o as loadPendingMessageCards, r as completeAuthPauseTurn, t as buildTurnThreadContext } from "./thread-context-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { p as credentialContextForActor } from "./registry-CZOzddwu.js";
|
|
2
|
+
import { Ii as blockEventAutomation, To as verifyTimerWatchCredentialSubject, Tr as readConversationAutomationRun, Ur as notifyAutomationBlocked, jr as getDispatchIdForConversation, mi as blockScheduledAutomation } from "./credentialed-Dyv8b-lu.js";
|
|
3
|
+
import { A as isTopLevelKind, F as turnBehavior, O as isPersonInput, a as getConversationStore, o as getDb } from "./db-PwSRzWWn.js";
|
|
4
|
+
import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging-DNt-qOIO.js";
|
|
5
|
+
import { kt as readMessageAttachments } from "./media-B0pZJ0bG.js";
|
|
6
|
+
import { C as isConversationDeliveryPaused } from "./agent-runner-B5y9MsT-.js";
|
|
7
|
+
import { a as buildDeliveredTurnStatePatch, o as loadPendingMessageCards, r as completeAuthPauseTurn, t as buildTurnThreadContext } from "./thread-context-B8exINEe.js";
|
|
8
|
+
import { Bt as getTurnUserMessage, Ct as isEventMailboxMetadata, E as stopAtAutomatedTurnLimit, Jt as getConversationTurnBoundaryError, Kt as TurnInputCommitLostError, Q as recordChildAgentEnded, St as eventBatchMessageMeta, Tt as timerWatchCredentialSubject, Xt as isTurnInputCommitLostError, _t as resetAutomatedTurnLimit, an as eventInboxItemInputs, d as legacyWebMailboxMetadataSchema, dn as instructionActorFor, en as markTurnFailed, f as childAgentTurnOptions, fn as instructionForInputs, gt as recordFinishedTurnForAutomatedLimit, hn as withoutSavedSteeringMessages, l as sourceFromTurnInput, m as isParentMessageAuthor, mn as turnRequestText, nn as createWebAuthorization, on as loadInboxItemInput, p as commitParentMessageFork, s as getEventBatchDelayMs, tn as startActiveTurn, u as turnInputFactsFromConversationMessage, un as buildSteeringPiMessage, v as supersedeOpenMailboxTurns, vt as AgentRunError, wt as renderEventBatchInputs, yt as executeTurn, zt as completeCancelledConversationTurn } from "./ingest-B0AggUEC.js";
|
|
9
|
+
import { Cn as readParentMessage, Ct as recordDeliveredAssistantMessage, Et as upsertConversationMessage, In as finalizeFailedTurnReplyWithEvent, K as buildDeterministicTurnId, Mt as isEventConversationMessage, Qt as saveTurnCheckpoint, St as normalizeConversationText, X as loadConversationProjection, bt as latestConversationMessageSeq, d as getPersistedThreadState, dr as persistWithRetry, ft as persistConversationMessages, m as coerceThreadConversationState, p as persistThreadStateById, q as commitAcceptedReply, rn as getTurnRecord, tn as failTurnRecord, tr as getAssistantReplyText, u as getPersistedSandboxState, ut as hydrateConversationMessages, wn as getTurnLifecycle, xt as markConversationMessage } from "./turn-membership-DTR3SaKD.js";
|
|
10
|
+
import { p as credentialContextForActor } from "./registry-POH4bZC4.js";
|
|
12
11
|
import { i as getActiveSpan, r as continueTrace } from "./sentry-CPbZjomA.js";
|
|
13
|
-
import {
|
|
14
|
-
import { n as
|
|
12
|
+
import { g as measureTurnCompactionWait } from "./warmup-D5hzqTcp.js";
|
|
13
|
+
import { n as botConfig } from "./config-CWbwKj0j.js";
|
|
14
|
+
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner--Ke8KSMf.js";
|
|
15
15
|
import { t as mapBounded } from "./fan-out-Cod-yEHG.js";
|
|
16
16
|
import { p as instructionProvenanceFor } from "./history-CYstOMKX.js";
|
|
17
|
-
import { p as resolveConversationDestination } from "./start-conversation-
|
|
18
|
-
import { t as readConversationLineage } from "./lineage-
|
|
17
|
+
import { p as resolveConversationDestination } from "./start-conversation-DbVujrwO.js";
|
|
18
|
+
import { t as readConversationLineage } from "./lineage-BXplQAVH.js";
|
|
19
19
|
import { isDeepStrictEqual } from "node:util";
|
|
20
20
|
import { createHash } from "node:crypto";
|
|
21
21
|
// src/chat/task-execution/turn-telemetry.ts
|
|
@@ -174,6 +174,34 @@ function savedTurnInputMessages(conversation, turnMessage, inputMessageIds) {
|
|
|
174
174
|
const saved = (inputMessageIds ?? []).flatMap((id) => conversation.messages.find((message) => message.id === id && message.role === "user") ?? []);
|
|
175
175
|
return saved.some((message) => message.id === turnMessage.id) ? saved : [turnMessage];
|
|
176
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Render the Turn inputs of one new mailbox batch. A parent batch is the
|
|
179
|
+
* parent's task, as on an Agent invocation. An Event batch also returns the
|
|
180
|
+
* meta of its one saved Message. A web batch returns one transcript Message
|
|
181
|
+
* per input.
|
|
182
|
+
*/
|
|
183
|
+
async function mailboxTurnInputs(batch, fromParent) {
|
|
184
|
+
const messages = batch.map((entry) => entry.message);
|
|
185
|
+
if (fromParent) return {
|
|
186
|
+
eventMeta: {},
|
|
187
|
+
inputs: batch.map(({ message, requestText }) => ({
|
|
188
|
+
kind: "runtime",
|
|
189
|
+
text: message.input.text.trim(),
|
|
190
|
+
...requestText ? { requestText } : void 0
|
|
191
|
+
})),
|
|
192
|
+
webInputMessages: []
|
|
193
|
+
};
|
|
194
|
+
if (isEventMailboxMetadata(messages[0]?.input.metadata)) return {
|
|
195
|
+
eventMeta: eventBatchMessageMeta(messages),
|
|
196
|
+
inputs: renderEventBatchInputs(messages, await eventInboxItemInputs(messages)),
|
|
197
|
+
webInputMessages: []
|
|
198
|
+
};
|
|
199
|
+
return {
|
|
200
|
+
eventMeta: {},
|
|
201
|
+
inputs: await webTurnInputs(messages.map((message) => message.input)),
|
|
202
|
+
webInputMessages: batch.map((entry) => webConversationMessage(entry.message, entry.author))
|
|
203
|
+
};
|
|
204
|
+
}
|
|
177
205
|
// src/chat/task-execution/web-steering.ts
|
|
178
206
|
async function steeringMessageFromWeb(message, actor) {
|
|
179
207
|
const storedAttachments = readMessageAttachments(message.input.attachments);
|
|
@@ -290,6 +318,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
|
|
|
290
318
|
let startedAtMs = Date.now();
|
|
291
319
|
let inputMessageIds = [];
|
|
292
320
|
let eventMeta = {};
|
|
321
|
+
let fromParent = resolved.kind === "mailbox" && resolved.batch.every((entry) => readParentMessage(entry.message));
|
|
293
322
|
let authorIdentityId;
|
|
294
323
|
let webInputMessages = [];
|
|
295
324
|
const storedConversation = await getConversationStore().get({ conversationId: context.conversationId });
|
|
@@ -303,20 +332,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
|
|
|
303
332
|
if (resolved.kind === "mailbox") {
|
|
304
333
|
const first = resolved.batch[0];
|
|
305
334
|
const messages = resolved.batch.map((entry) => entry.message);
|
|
306
|
-
|
|
307
|
-
if (isEventMailboxMetadata(firstMetadata)) {
|
|
308
|
-
const rendered = await eventInboxItemInputs(messages);
|
|
309
|
-
for (const { message, requestText } of resolved.batch) if (requestText) rendered.set(message.inboundMessageId, {
|
|
310
|
-
kind: "runtime",
|
|
311
|
-
text: message.input.text.trim(),
|
|
312
|
-
requestText
|
|
313
|
-
});
|
|
314
|
-
inputs = renderEventBatchInputs(messages, rendered);
|
|
315
|
-
eventMeta = eventBatchMessageMeta(messages);
|
|
316
|
-
} else {
|
|
317
|
-
inputs = await webTurnInputs(messages.map((message) => message.input));
|
|
318
|
-
webInputMessages = resolved.batch.map((entry) => webConversationMessage(entry.message, entry.author));
|
|
319
|
-
}
|
|
335
|
+
({eventMeta, inputs, webInputMessages} = await mailboxTurnInputs(resolved.batch, fromParent));
|
|
320
336
|
attachments = resolved.batch.flatMap((entry) => readMessageAttachments(entry.message.input.attachments));
|
|
321
337
|
startedAtMs = first.message.createdAtMs;
|
|
322
338
|
userMessageId = first.message.inboundMessageId;
|
|
@@ -333,12 +349,11 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
|
|
|
333
349
|
});
|
|
334
350
|
const savedTurn = isResume ? await getTurnRecord(context.conversationId, turnId) : void 0;
|
|
335
351
|
let savedMessageIsEvent = false;
|
|
336
|
-
let savedParentMessage = false;
|
|
337
352
|
if (isResume) {
|
|
338
353
|
const userMessage = getTurnUserMessage(conversation, turnId);
|
|
339
354
|
if (!userMessage) throw new Error(`Unable to locate the persisted user message for Turn "${turnId}"`);
|
|
340
355
|
savedMessageIsEvent = isEventConversationMessage(userMessage);
|
|
341
|
-
|
|
356
|
+
fromParent = isParentMessageAuthor(userMessage.author);
|
|
342
357
|
turnInputFacts = turnInputFactsFromConversationMessage(userMessage, {
|
|
343
358
|
conversationId: context.conversationId,
|
|
344
359
|
location: storedConversation?.location,
|
|
@@ -348,7 +363,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
|
|
|
348
363
|
});
|
|
349
364
|
const turnInputs = savedTurnInputMessages(conversation, userMessage, await lifecycle.loadInputMessageIds(context.conversationId, turnId));
|
|
350
365
|
userMessageId = userMessage.id;
|
|
351
|
-
inputs = savedMessageIsEvent ? [{
|
|
366
|
+
inputs = savedMessageIsEvent || fromParent ? [{
|
|
352
367
|
kind: "runtime",
|
|
353
368
|
text: userMessage.text,
|
|
354
369
|
...userMessage.meta?.requestText ? { requestText: userMessage.meta.requestText } : void 0
|
|
@@ -366,7 +381,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
|
|
|
366
381
|
const { text } = instructionInputs;
|
|
367
382
|
const instructionActor = instructionActorFor(actor);
|
|
368
383
|
let credentialSubject;
|
|
369
|
-
if (actor.platform === "system") credentialSubject = resolved.kind === "mailbox" ? timerWatchCredentialSubject(context.conversationId, resolved.batch.map((entry) => entry.message)) ?? await verifiedTimerWatchSubject(context.conversationId, sharedDelegatedSubject(resolved.batch),
|
|
384
|
+
if (actor.platform === "system") credentialSubject = resolved.kind === "mailbox" ? timerWatchCredentialSubject(context.conversationId, resolved.batch.map((entry) => entry.message)) ?? await verifiedTimerWatchSubject(context.conversationId, sharedDelegatedSubject(resolved.batch), fromParent) : await verifiedTimerWatchSubject(context.conversationId, savedTurn?.credentialSubject, fromParent);
|
|
370
385
|
const source = sourceFromTurnInput({
|
|
371
386
|
conversationId: context.conversationId,
|
|
372
387
|
source: turnInputFacts.source,
|
|
@@ -531,8 +546,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
|
|
|
531
546
|
if (stopSignal?.aborted) return await completeCancelledTurn();
|
|
532
547
|
const childTurn = await childAgentTurnOptions({
|
|
533
548
|
conversationId: context.conversationId,
|
|
534
|
-
|
|
535
|
-
savedParentMessage
|
|
549
|
+
fromParent
|
|
536
550
|
});
|
|
537
551
|
const history = await loadConversationProjection({ conversationId: context.conversationId });
|
|
538
552
|
failureCode = "agent_run_failed";
|
|
@@ -651,17 +665,20 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
|
|
|
651
665
|
surface
|
|
652
666
|
});
|
|
653
667
|
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
668
|
+
if (fromParent) await resetAutomatedTurnLimit({ conversationId: context.conversationId });
|
|
669
|
+
else {
|
|
670
|
+
const automatedTurnLimit = await recordFinishedTurnForAutomatedLimit({
|
|
671
|
+
conversationId: context.conversationId,
|
|
672
|
+
maxTurns: botConfig.maxConsecutiveAutomatedTurns,
|
|
673
|
+
source
|
|
674
|
+
});
|
|
675
|
+
await stopAtAutomatedTurnLimit({
|
|
676
|
+
conversationId: context.conversationId,
|
|
677
|
+
maxTurns: botConfig.maxConsecutiveAutomatedTurns,
|
|
678
|
+
source,
|
|
679
|
+
update: automatedTurnLimit
|
|
680
|
+
});
|
|
681
|
+
}
|
|
665
682
|
completedSuccessfully = reply.diagnostics.outcome === "success";
|
|
666
683
|
return completedSuccessfully ? { outcome: assistantMessageDelivered ? "success" : "no_reply" } : {
|
|
667
684
|
...modelFailureEventId ? { eventId: modelFailureEventId } : void 0,
|
|
@@ -769,6 +786,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, deliverToPare
|
|
|
769
786
|
kind: "failed",
|
|
770
787
|
text: failure instanceof Error ? failure.message : String(failure)
|
|
771
788
|
});
|
|
789
|
+
else await recordChildAgentEnded(context.conversationId, "error");
|
|
772
790
|
await acknowledge();
|
|
773
791
|
return { status: "completed" };
|
|
774
792
|
}
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { Ao as getSlackClient, Xr as postSlackMessage, an as resolveBaseUrl, i as resolvePluginOAuthAccount, in as parseOAuthStatePayload, r as createUserTokenStore, rn as formatProviderLabel, sr as lookupSlackUserProfile } from "./credentialed-
|
|
2
|
-
import { L as acquireActiveLock, i as getRuntimeMetadata, n as botConfig } from "./config-
|
|
1
|
+
import { Ao as getSlackClient, Xr as postSlackMessage, an as resolveBaseUrl, i as resolvePluginOAuthAccount, in as parseOAuthStatePayload, r as createUserTokenStore, rn as formatProviderLabel, sr as lookupSlackUserProfile } from "./credentialed-Dyv8b-lu.js";
|
|
2
|
+
import { L as acquireActiveLock, i as getRuntimeMetadata, n as botConfig } from "./config-CWbwKj0j.js";
|
|
3
3
|
import { t as mapBounded } from "./fan-out-Cod-yEHG.js";
|
|
4
|
-
import { _ as runBestEffort, h as logWarn, p as logException, q as isNativeIdentityProvider } from "./logging-
|
|
4
|
+
import { _ as runBestEffort, h as logWarn, p as logException, q as isNativeIdentityProvider } from "./logging-DNt-qOIO.js";
|
|
5
5
|
import { p as parseSlackUserId } from "./actor-BsBdxDXQ.js";
|
|
6
|
-
import {
|
|
7
|
-
import { i as getStateAdapter } from "./adapter-
|
|
6
|
+
import { Qt as resolveActorIdentityId, Rt as readIdentityById, in as findUserByVerifiedEmails, ln as upsertLinkedIdentity, s as getSqlExecutor } from "./db-PwSRzWWn.js";
|
|
7
|
+
import { i as getStateAdapter } from "./adapter-CYAvJzZS.js";
|
|
8
8
|
import { i as homeDir } from "./package-discovery-DD9vencX.js";
|
|
9
|
-
import { t as discoverSkills } from "./skills-
|
|
10
|
-
import { d as hasRequiredOAuthScope, n as buildOAuthTokenRequest, r as parseOAuthTokenResponse } from "./registry-
|
|
11
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
12
|
-
import { i as finalizeMcpAuthorization } from "./agent-runner-
|
|
13
|
-
import { O as getMcpProviderErrorAttributes, S as putMcpStoredOAuthCredentials, f as deleteMcpAuthSession, g as getMcpAuthSession, v as getMcpStoredOAuthCredentials } from "./service-account-
|
|
14
|
-
import {
|
|
15
|
-
import { f as readJuniorSecret } from "./vercel-queue-
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { n as relayLocalOAuthCallback } from "./oauth-relay-pPMGnDZt.js";
|
|
9
|
+
import { t as discoverSkills } from "./skills-B0jP4whm.js";
|
|
10
|
+
import { d as hasRequiredOAuthScope, n as buildOAuthTokenRequest, r as parseOAuthTokenResponse } from "./registry-POH4bZC4.js";
|
|
11
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-kkE3hvCX.js";
|
|
12
|
+
import { i as finalizeMcpAuthorization } from "./agent-runner-B5y9MsT-.js";
|
|
13
|
+
import { O as getMcpProviderErrorAttributes, S as putMcpStoredOAuthCredentials, f as deleteMcpAuthSession, g as getMcpAuthSession, v as getMcpStoredOAuthCredentials } from "./service-account-o15pZWcJ.js";
|
|
14
|
+
import { Bt as authorizationId, d as getPersistedThreadState, m as coerceThreadConversationState, nt as recordAuthorizationCompleted, qt as getConversationPendingAuth, rn as getTurnRecord, tt as recordAuthenticationLinked } from "./turn-membership-DTR3SaKD.js";
|
|
15
|
+
import { f as readJuniorSecret } from "./vercel-queue-q4z8w5QO.js";
|
|
16
|
+
import { C as wakeAuthorizedTurn, rn as deleteWebAuthorization, w as wakePausedTurn } from "./ingest-B0AggUEC.js";
|
|
17
|
+
import { s as readConnectedOAuthTokens, t as escapeHtml, u as htmlCallbackResponse } from "./html-DidUcRhI.js";
|
|
18
|
+
import { n as relayLocalOAuthCallback } from "./oauth-relay-D-kK0yoN.js";
|
|
20
19
|
import * as z from "zod";
|
|
21
20
|
import path from "node:path";
|
|
22
21
|
import { createHmac, createSecretKey, timingSafeEqual } from "node:crypto";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import { _ as credentialUserSubjectId, a as HOST_MANAGED_CREDENTIAL_PLACEHOLDER, g as credentialSubjectSchema, h as credentialLogContext, m as credentialContextSchema, o as resolveAuthTokenPlaceholder, s as resolvePluginCommandEnv, v as CredentialUnavailableError } from "./registry-
|
|
3
|
-
import { E as withSpan, J as normalizeIdentityEmail, _ as runBestEffort, a as extractGenAiUsageSummary, b as setSpanAttributes, c as getLogContextAttributes, d as logAudit, h as logWarn, i as extractGenAiUsageAttributes, m as logInfo, p as logException, x as setSpanStatus, y as setSentryUser } from "./logging-
|
|
4
|
-
import { C as completeText$1, D as rerankTexts, E as generateImages$1, I as MUTATION_LOCK_TTL_MS, L as acquireActiveLock, P as createCache, Q as THREAD_CONTEXT_TAGS, S as completeObject$1, T as gatewayCostUsd, Y as hasCurrentInstruction, Z as unwrapCurrentInstruction, _t as toOptionalTrimmed, a as getSlackBotToken, at as ProviderError, b as GEN_AI_SERVER_ADDRESS, et as isRuntimeInputText, ft as isProviderRetryError, ht as bufferBody, k as searchWeb$1, mt as resolveGatewayCredential, n as botConfig, r as getChatConfig, st as createProviderError, tt as readParentAgentTask, v as normalizeSlackEmojiName, w as embedTexts$1, x as completeDecision$1, y as GEN_AI_PROVIDER_NAME, z as withLock } from "./config-
|
|
5
|
-
import { a as getStateValues, i as getStateAdapter, o as setStateValues, r as getDefaultRedisStateAdapterFor } from "./adapter-
|
|
6
|
-
import {
|
|
7
|
-
import { Ft as scheduledAutomationSchema, Gt as isValidTimeZone, Jt as inboxItemRequestSchema, Kt as eventAutomationSchema, N as automationVersionSchema, Yt as USER_INPUT_LIMITS, a as DEFAULT_NOTIFICATION_SCHEDULE, an as automationTaskDescription, c as CONTENT_VERSION_HEADER, in as automationTaskColumns, o as isWithinNotificationSchedule, on as automationTaskSchema, qt as eventAutomationTriggerSchema, r as detectImageMediaType, rn as automationSkillNameSchema, s as notificationScheduleSchema } from "./media-
|
|
2
|
+
import { _ as credentialUserSubjectId, a as HOST_MANAGED_CREDENTIAL_PLACEHOLDER, g as credentialSubjectSchema, h as credentialLogContext, m as credentialContextSchema, o as resolveAuthTokenPlaceholder, s as resolvePluginCommandEnv, v as CredentialUnavailableError } from "./registry-POH4bZC4.js";
|
|
3
|
+
import { E as withSpan, J as normalizeIdentityEmail, _ as runBestEffort, a as extractGenAiUsageSummary, b as setSpanAttributes, c as getLogContextAttributes, d as logAudit, h as logWarn, i as extractGenAiUsageAttributes, m as logInfo, p as logException, x as setSpanStatus, y as setSentryUser } from "./logging-DNt-qOIO.js";
|
|
4
|
+
import { C as completeText$1, D as rerankTexts, E as generateImages$1, I as MUTATION_LOCK_TTL_MS, L as acquireActiveLock, P as createCache, Q as THREAD_CONTEXT_TAGS, S as completeObject$1, T as gatewayCostUsd, Y as hasCurrentInstruction, Z as unwrapCurrentInstruction, _t as toOptionalTrimmed, a as getSlackBotToken, at as ProviderError, b as GEN_AI_SERVER_ADDRESS, et as isRuntimeInputText, ft as isProviderRetryError, ht as bufferBody, k as searchWeb$1, mt as resolveGatewayCredential, n as botConfig, r as getChatConfig, st as createProviderError, tt as readParentAgentTask, v as normalizeSlackEmojiName, w as embedTexts$1, x as completeDecision$1, y as GEN_AI_PROVIDER_NAME, z as withLock } from "./config-CWbwKj0j.js";
|
|
5
|
+
import { a as getStateValues, i as getStateAdapter, o as setStateValues, r as getDefaultRedisStateAdapterFor } from "./adapter-CYAvJzZS.js";
|
|
6
|
+
import { At as automationCreatorUserId, F as turnBehavior, Fn as nextDetailVersion, G as microUsdToUsd, In as touchConversationDetail, It as readActorIdentity, Kt as parseAvatarUrl, O as isPersonInput, On as agentTurnCostUsd, P as sourceLabel, Pn as conversationDetailTouch, Pt as findUserByEmailFromSql, Rt as readIdentityById, U as conversationCostOf, Vt as resolveViewerUser, Wt as hasUserPhoto, Yt as userAvatarUrlsFromIdentities, _t as inboxItemPlugin, a as getConversationStore, an as linkedSlackUser, at as AUTOMATION_INBOX_ITEM_KEY_PREFIX, bt as inboxItemVisibleTo, c as hasAnnotationKey, cn as saveUserTimezone, dn as ToolInputError, dt as inboxItemAssignedTo, fn as isToolInputError, ft as inboxItemForUser, gt as inboxItemOwnedByConversation, hn as canReadConversation, ht as inboxItemNeedsUser, j as personSourcePlatform, k as isPersonSource, kn as agentTurnTotalTokens, l as treeHasAnnotationKey, o as getDb, on as readUserTimezone, ot as PLUGIN_INBOX_ITEM_KEY_PREFIX, pt as inboxItemLinkedTo, r as getConversationEventStore, s as getSqlExecutor, vn as readConversationAccessFromSql, zt as readIdentityByIdFromSql } from "./db-PwSRzWWn.js";
|
|
7
|
+
import { Ft as scheduledAutomationSchema, Gt as isValidTimeZone, Jt as inboxItemRequestSchema, Kt as eventAutomationSchema, N as automationVersionSchema, Yt as USER_INPUT_LIMITS, a as DEFAULT_NOTIFICATION_SCHEDULE, an as automationTaskDescription, c as CONTENT_VERSION_HEADER, in as automationTaskColumns, o as isWithinNotificationSchedule, on as automationTaskSchema, qt as eventAutomationTriggerSchema, r as detectImageMediaType, rn as automationSkillNameSchema, s as notificationScheduleSchema } from "./media-B0pZJ0bG.js";
|
|
8
8
|
import { d as parseSlackChannelReferenceId, f as parseSlackTeamId, i as isActorUserId, p as parseSlackUserId, s as parseActorUserId, v as parseSlackMessageTs } from "./actor-BsBdxDXQ.js";
|
|
9
|
-
import { f as readJuniorSecret, h as readWebPushPrivateKey, t as getVercelConversationWorkQueue } from "./vercel-queue-
|
|
9
|
+
import { f as readJuniorSecret, h as readWebPushPrivateKey, t as getVercelConversationWorkQueue } from "./vercel-queue-q4z8w5QO.js";
|
|
10
10
|
import { t as mapBounded } from "./fan-out-Cod-yEHG.js";
|
|
11
|
-
import { $ as MEMORY_SCOPES, C as juniorConversationParticipants, D as juniorConversationEventEmbeddings, E as juniorConversationEventLexemes, H as juniorConversations, J as juniorMemoryEmbeddings, K as juniorUsers, L as juniorCodeChanges, M as juniorConversationEvents, O as juniorConversationEmbeddings, P as juniorConversationAnnotations, Q as MEMORY_KINDS, R as juniorCodeRepositories, U as juniorIdentities, X as juniorMemorySignals, Y as juniorMemoryMemories, Z as MEMORY_EMBEDDING_DIMENSIONS, _ as juniorAutomationRuns, a as juniorWorkspaces, at as guardedCosineDistance, ct as juniorArtifacts, d as juniorInboxSnoozes, et as MEMORY_SOURCE_PLATFORMS, f as juniorInboxItemAssignees, g as juniorAutomations, h as juniorInboxItems, i as juniorWorkspaceRepos, it as embedText, n as isPostgresErrorCode, nt as memoryRuntimeContextSchema, o as juniorPushSubscriptions, ot as parseEmbeddingBatch$1, p as juniorInboxItemConversations, q as juniorDestinations, r as juniorSnapshots, rt as cosineDistance, st as refreshEmbeddings, tt as MEMORY_SUBJECT_TYPES, u as juniorInboxSnoozeTriggers, v as juniorAutomationVersions } from "./executor-
|
|
11
|
+
import { $ as MEMORY_SCOPES, C as juniorConversationParticipants, D as juniorConversationEventEmbeddings, E as juniorConversationEventLexemes, H as juniorConversations, J as juniorMemoryEmbeddings, K as juniorUsers, L as juniorCodeChanges, M as juniorConversationEvents, O as juniorConversationEmbeddings, P as juniorConversationAnnotations, Q as MEMORY_KINDS, R as juniorCodeRepositories, U as juniorIdentities, X as juniorMemorySignals, Y as juniorMemoryMemories, Z as MEMORY_EMBEDDING_DIMENSIONS, _ as juniorAutomationRuns, a as juniorWorkspaces, at as guardedCosineDistance, ct as juniorArtifacts, d as juniorInboxSnoozes, et as MEMORY_SOURCE_PLATFORMS, f as juniorInboxItemAssignees, g as juniorAutomations, h as juniorInboxItems, i as juniorWorkspaceRepos, it as embedText, n as isPostgresErrorCode, nt as memoryRuntimeContextSchema, o as juniorPushSubscriptions, ot as parseEmbeddingBatch$1, p as juniorInboxItemConversations, q as juniorDestinations, r as juniorSnapshots, rt as cosineDistance, st as refreshEmbeddings, tt as MEMORY_SUBJECT_TYPES, u as juniorInboxSnoozeTriggers, v as juniorAutomationVersions } from "./executor-CgWyWfYz.js";
|
|
12
12
|
import { n as captureMessage, r as continueTrace } from "./sentry-CPbZjomA.js";
|
|
13
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
13
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-kkE3hvCX.js";
|
|
14
14
|
import { n as redactSandboxEgressProxyPath, t as SANDBOX_EGRESS_PROXY_PATH } from "./proxy-path-BHYoKZdq.js";
|
|
15
|
-
import { n as readEncryptedState, r as findLegacyWebActorUserId, t as createEncryptedState } from "./state-
|
|
15
|
+
import { n as readEncryptedState, r as findLegacyWebActorUserId, t as createEncryptedState } from "./state-BTawTCme.js";
|
|
16
16
|
import * as z from "zod";
|
|
17
17
|
import pLimit from "p-limit";
|
|
18
18
|
import { createGatewayProvider } from "@ai-sdk/gateway";
|
|
@@ -1951,7 +1951,7 @@ async function publishConversationStatus(conversationId, status, options) {
|
|
|
1951
1951
|
nowMs,
|
|
1952
1952
|
state: options.state
|
|
1953
1953
|
})).length === 0 || await options.skip?.()) return;
|
|
1954
|
-
const { ingestEvent } = await import("./ingest-
|
|
1954
|
+
const { ingestEvent } = await import("./ingest-B0AggUEC.js").then((n) => n.n);
|
|
1955
1955
|
await ingestEvent(event, {
|
|
1956
1956
|
admit: async (watch) => await canReadConversation(getDb(), watch.conversationId, conversationId),
|
|
1957
1957
|
nowMs,
|
|
@@ -6461,7 +6461,6 @@ async function writeConversationEmbedding(db, { item, vector }, batch) {
|
|
|
6461
6461
|
conversationId: item.conversationId,
|
|
6462
6462
|
dimensions: batch.dimensions,
|
|
6463
6463
|
embedding: vector,
|
|
6464
|
-
legacyBriefVersion: null,
|
|
6465
6464
|
model: batch.model,
|
|
6466
6465
|
provider: batch.provider,
|
|
6467
6466
|
throughSeq: item.throughSeq
|
|
@@ -6470,7 +6469,6 @@ async function writeConversationEmbedding(db, { item, vector }, batch) {
|
|
|
6470
6469
|
set: {
|
|
6471
6470
|
dimensions: sql`excluded.dimensions`,
|
|
6472
6471
|
embedding: sql`excluded.embedding`,
|
|
6473
|
-
legacyBriefVersion: null,
|
|
6474
6472
|
model: sql`excluded.model`,
|
|
6475
6473
|
provider: sql`excluded.provider`,
|
|
6476
6474
|
throughSeq: sql`excluded.through_seq`,
|
|
@@ -11169,7 +11167,7 @@ const RESOURCE_SUBSCRIPTION_MAX_TTL_MS = 2592e6;
|
|
|
11169
11167
|
const STOP_WATCHING_TOOL_NAME = "stopWatchingResources";
|
|
11170
11168
|
const RESOURCE_WATCH_TOOL_SOURCE = {
|
|
11171
11169
|
id: "resource-watches",
|
|
11172
|
-
description: "Find event
|
|
11170
|
+
description: "Find the events that watches and event automations can use, and inspect or stop watches for the current conversation and its child agents."
|
|
11173
11171
|
};
|
|
11174
11172
|
// src/chat/plugins/watches.ts
|
|
11175
11173
|
/**
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import { N as cacheKeyPrefix, P as createCache, r as getChatConfig } from "./config-
|
|
2
|
+
import { N as cacheKeyPrefix, P as createCache, r as getChatConfig } from "./config-CWbwKj0j.js";
|
|
3
3
|
import { a as isSlackUserId, d as parseSlackChannelReferenceId, f as parseSlackTeamId, s as parseActorUserId } from "./actor-BsBdxDXQ.js";
|
|
4
|
-
import { A as juniorConversationMetrics, B as juniorAttachments, C as juniorConversationParticipants, H as juniorConversations, K as juniorUsers, M as juniorConversationEvents, P as juniorConversationAnnotations, S as juniorConversationReadPositions, T as juniorConversationBriefs, U as juniorIdentities, V as juniorMessageAttachments, _ as juniorAutomationRuns, f as juniorInboxItemAssignees, g as juniorAutomations, h as juniorInboxItems, j as isUserInstruction, k as CONVERSATION_METRICS, p as juniorInboxItemConversations, q as juniorDestinations, t as createJuniorSqlExecutor, w as juniorConversationBindings } from "./executor-
|
|
4
|
+
import { A as juniorConversationMetrics, B as juniorAttachments, C as juniorConversationParticipants, H as juniorConversations, K as juniorUsers, M as juniorConversationEvents, P as juniorConversationAnnotations, S as juniorConversationReadPositions, T as juniorConversationBriefs, U as juniorIdentities, V as juniorMessageAttachments, _ as juniorAutomationRuns, f as juniorInboxItemAssignees, g as juniorAutomations, h as juniorInboxItems, j as isUserInstruction, k as CONVERSATION_METRICS, p as juniorInboxItemConversations, q as juniorDestinations, t as createJuniorSqlExecutor, w as juniorConversationBindings } from "./executor-CgWyWfYz.js";
|
|
5
5
|
import { c as newConversationEventSchema, h as usageSchema, l as encodeHistoryPayload, o as decodeStoredConversationEvent, r as conversationEventDataSchema, s as historyReplacementSchema } from "./history-CYstOMKX.js";
|
|
6
|
-
import { t as canExposeConversationPayload } from "./conversation-privacy-
|
|
6
|
+
import { t as canExposeConversationPayload } from "./conversation-privacy-BrMiDN61.js";
|
|
7
7
|
import { t as mapBounded } from "./fan-out-Cod-yEHG.js";
|
|
8
|
-
import { J as normalizeIdentityEmail, K as GOOGLE_IDENTITY_PROVIDER, h as logWarn } from "./logging-
|
|
9
|
-
import { i as getStateAdapter } from "./adapter-
|
|
8
|
+
import { J as normalizeIdentityEmail, K as GOOGLE_IDENTITY_PROVIDER, h as logWarn } from "./logging-DNt-qOIO.js";
|
|
9
|
+
import { i as getStateAdapter } from "./adapter-CYAvJzZS.js";
|
|
10
10
|
import * as z from "zod";
|
|
11
11
|
import { createHash, randomUUID } from "node:crypto";
|
|
12
12
|
import { PluginToolInputError, destinationSchema, identitySchema, locationSchema, sourceSchema, userSchema } from "@sentry/junior-plugin-api";
|
|
13
|
-
import { and, asc, desc, eq, exists, gt, gte, inArray, isNotNull, isNull, lt, lte, ne, not, or, sql } from "drizzle-orm";
|
|
13
|
+
import { SQL, and, asc, desc, eq, exists, gt, gte, inArray, isNotNull, isNull, lt, lte, ne, not, or, sql } from "drizzle-orm";
|
|
14
14
|
import { alias } from "drizzle-orm/pg-core";
|
|
15
15
|
// src/chat/destination.ts
|
|
16
16
|
/** Build Junior's canonical destination from Slack workspace and channel ids. */
|
|
@@ -1158,13 +1158,6 @@ function inboxItemNeedsUser(userId) {
|
|
|
1158
1158
|
return and(eq(juniorInboxItems.status, "open"), eq(juniorInboxItems.kind, "action"), inboxItemAssignedTo(userId));
|
|
1159
1159
|
}
|
|
1160
1160
|
/**
|
|
1161
|
-
* SQL: the Inbox item needs some person: an open `action` item with an
|
|
1162
|
-
* assigned User. It is `inboxItemNeedsUser` for any User.
|
|
1163
|
-
*/
|
|
1164
|
-
function inboxItemNeedsSomeone() {
|
|
1165
|
-
return and(eq(juniorInboxItems.status, "open"), eq(juniorInboxItems.kind, "action"), sql`exists (select 1 from ${juniorInboxItemAssignees} where ${juniorInboxItemAssignees.itemId} = ${juniorInboxItems.id})`);
|
|
1166
|
-
}
|
|
1167
|
-
/**
|
|
1168
1161
|
* SQL: the Inbox item waits for a person's input: an open `action` item,
|
|
1169
1162
|
* whoever it is assigned to. An item with no assignees still waits for
|
|
1170
1163
|
* anyone who can answer it. The Conversation that added it shows
|
|
@@ -2965,13 +2958,18 @@ function conversationDescendants(tree, conversationId) {
|
|
|
2965
2958
|
}
|
|
2966
2959
|
return descendants;
|
|
2967
2960
|
}
|
|
2968
|
-
/**
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2961
|
+
/**
|
|
2962
|
+
* Set or clear the shared archive and count the rows written. This is the
|
|
2963
|
+
* only write of `archived_at`. `conversations` names the rows by id or by a
|
|
2964
|
+
* condition. `guard` is a condition that each row must still meet when it is
|
|
2965
|
+
* written, so a stale read loses to a newer change.
|
|
2966
|
+
*/
|
|
2967
|
+
async function setArchivedAt(db, conversations, archivedAt, guard) {
|
|
2968
|
+
if (!(conversations instanceof SQL) && conversations.length === 0) return 0;
|
|
2969
|
+
return (await db.update(juniorConversations).set({
|
|
2972
2970
|
archivedAt,
|
|
2973
2971
|
detailVersion: nextDetailVersion
|
|
2974
|
-
}).where(inArray(juniorConversations.conversationId, [...
|
|
2972
|
+
}).where(and(conversations instanceof SQL ? conversations : inArray(juniorConversations.conversationId, [...conversations]), guard)).returning({ conversationId: juniorConversations.conversationId })).length;
|
|
2975
2973
|
}
|
|
2976
2974
|
/**
|
|
2977
2975
|
* Restore one archived Conversation and its archived ancestors, so it shows
|
|
@@ -3606,4 +3604,4 @@ async function closeDb() {
|
|
|
3606
3604
|
current = void 0;
|
|
3607
3605
|
await previous?.db.close();
|
|
3608
3606
|
}
|
|
3609
|
-
export { conversationWaitsOnUserSql as $,
|
|
3607
|
+
export { conversationWaitsOnUserSql as $, saveActorAvatar as $t, isTopLevelKind as A, agentTurnUsageSchema as An, automationCreatorUserId as At, claimProviderConversation as B, sameDestination as Bn, readViewerAvatarUrl as Bt, createSqlStore as C, conversationPinnedForUser as Cn, isPluginInboxItem as Ct, hasConversationMetadata as D, addAgentTurnUsage as Dn, requireInboxItemLinks as Dt, dispatchInstructionsInvokeSkills as E, viewerMarksFromParticipant as En, requireInboxItemAssignees as Et, turnBehavior as F, nextDetailVersion as Fn, listAdminUsersFromSql as Ft, microUsdToUsd as G, identityAvatarUrl as Gt, parseSessionSource as H, setUserAdminFromSql as Ht, watchRepeatsChildResults as I, touchConversationDetail as In, readActorIdentity as It, conversationRangeColumns as J, readUserAvatarUrls as Jt, usdToMicroUsd as K, parseAvatarUrl as Kt, locationFromRow as L, createSlackDestination as Ln, readActorIdentityFromSql as Lt, postsRunNotices as M, resolveRootConversationId as Mn, resolveAssignees as Mt, promptModeTurnTools as N, rootConversationIsArchived as Nn, findUserByEmail as Nt, isPersonInput as O, agentTurnCostUsd as On, EVERYONE_ASSIGNEE as Ot, sourceLabel as P, conversationDetailTouch as Pn, findUserByEmailFromSql as Pt, conversationTurnFailedSql as Q, resolveActorIdentityId as Qt, setFirstConversationLocation as R, parseDestination as Rn, readIdentityById as Rt, userMessageQueries as S, conversationIsNotUnsubscribedRoot as Sn, isOnlyAssignee as St, deliversFinalText as T, rootVisibleToViewer as Tn, readInboxItemAgentScope as Tt, conversationCostOf as U, updateViewerDisplayName as Ut, getConversationIdByProviderConversation as V, resolveViewerUser as Vt, microUsdSql as W, hasUserPhoto as Wt, conversationIsActiveSql as X, userAvatarUrlsFromJoinedPhotos as Xt, conversationUsageCostExpr as Y, userAvatarUrlsFromIdentities as Yt, conversationStatusSql as Z, SYSTEM_IDENTITY_ID as Zt, readConversationTrees as _, createConversationAccessReader as _n, inboxItemPlugin as _t, getConversationStore as a, linkedSlackUser as an, AUTOMATION_INBOX_ITEM_KEY_PREFIX as at, loadConversationSlackTenantIds as b, readableSlackTeamId as bn, inboxItemVisibleTo as bt, hasAnnotationKey as c, saveUserTimezone as cn, canAgentChangeInboxItem as ct, eventFromRow as d, ToolInputError as dn, inboxItemAssignedTo as dt, deleteProviderIdentityForSlackUser as en, executionIsActive as et, copyMessageLinks as f, isToolInputError as fn, inboxItemForUser as ft, conversationDescendants as g, conversationAccessFromRows as gn, inboxItemOwnedByConversation as gt, conversationAncestors as h, canReadConversation as hn, inboxItemNeedsUser as ht, getConversationMessageSearchStore as i, findUserByVerifiedEmails as in, treeAwaitsAuthorization as it, personSourcePlatform as j, hasAgentTurnUsage as jn, resolveAssignee as jt, isPersonSource as k, agentTurnTotalTokens as kn, activeParticipantUserIds as kt, treeHasAnnotationKey as l, upsertLinkedIdentity as ln, canReadInboxItem as lt, withConversationEventLock as m, canAddConversationMessages as mn, inboxItemNeedsInput as mt, db_exports as n, findLinkedSlackUser as nn, conversationKindSql as nt, getDb as o, readUserTimezone as on, PLUGIN_INBOX_ITEM_KEY_PREFIX as ot, deleteMessageLinks as p, canAccessConversation as pn, inboxItemLinkedTo as pt, conversationAggregateColumns as q, readAvatarFetch as qt, getConversationEventStore as r, findSlackUserByPrimaryEmail as rn, awaitsAuthorizationFrom as rt, getSqlExecutor as s, recordGoogleSignIn as sn, canActOnInboxItem as st, closeDb as t, deleteProviderIdentityForUser as tn, conversationKindFromRow as tt, createSqlConversationEventStore as u, readCachedUserByEmail as un, canUserReadInboxItem as ut, setArchivedAt as v, readConversationAccessFromSql as vn, inboxItemReaderForUser as vt, withConversationMutationLock as w, readMemberParticipants as wn, itemNeedsUser as wt, lastMessageAtSql as x, conversationIsMemberRoot as xn, isAutomationAlertItem as xt, conversationSlackTenantId as y, readConversationAccessRows as yn, inboxItemReaderForUserInConversation as yt, startLocationThread as z, requireSlackDestination as zn, readIdentityByIdFromSql as zt };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { h as logWarn, p as logException } from "./logging-
|
|
1
|
+
import { h as logWarn, p as logException } from "./logging-DNt-qOIO.js";
|
|
2
2
|
import { _ as withScope } from "./sentry-CPbZjomA.js";
|
|
3
|
-
import "./config-
|
|
3
|
+
import "./config-CWbwKj0j.js";
|
|
4
4
|
import * as z from "zod";
|
|
5
5
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
6
|
import { actorSchema, sourceSchema } from "@sentry/junior-plugin-api";
|
|
@@ -426,7 +426,6 @@ const juniorConversations = pgTable("junior_conversations", {
|
|
|
426
426
|
kind: text("kind").$type(),
|
|
427
427
|
agentConfig: jsonb("agent_config_json").$type(),
|
|
428
428
|
archivedAt: timestamptz("archived_at"),
|
|
429
|
-
legacyChildArchivedAt: timestamptz("child_archived_at"),
|
|
430
429
|
forkedFromConversationId: text("forked_from_conversation_id").references(() => juniorConversations.conversationId, { onDelete: "set null" }),
|
|
431
430
|
quickQuestionAt: timestamptz("quick_question_at"),
|
|
432
431
|
rootConversationId: text("root_conversation_id").references(() => juniorConversations.conversationId),
|
|
@@ -856,7 +855,6 @@ const juniorConversationParticipants = pgTable("junior_conversation_participants
|
|
|
856
855
|
userId: text("user_id").notNull().references(() => juniorUsers.id),
|
|
857
856
|
rootConversationId: text("root_conversation_id").notNull().references(() => juniorConversations.conversationId),
|
|
858
857
|
lastMessageAt: timestamptz("last_message_at").notNull(),
|
|
859
|
-
legacyArchivedAt: timestamptz("archived_at"),
|
|
860
858
|
pinnedAt: timestamptz("pinned_at"),
|
|
861
859
|
/**
|
|
862
860
|
* The viewer's place for this pin in the Pinned section, from a drag
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { on as startOAuthFlow } from "./credentialed-
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
1
|
+
import { on as startOAuthFlow } from "./credentialed-Dyv8b-lu.js";
|
|
2
|
+
import { n as botConfig } from "./config-CWbwKj0j.js";
|
|
3
3
|
import { t as mapBounded } from "./fan-out-Cod-yEHG.js";
|
|
4
|
-
import {
|
|
5
|
-
import { d as hasRequiredOAuthScope } from "./registry-
|
|
6
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
7
|
-
import { h as deleteMcpStoredOAuthCredentials, m as deleteMcpServerSessionId, p as deleteMcpAuthSessionsForUserProvider } from "./service-account-
|
|
4
|
+
import { en as deleteProviderIdentityForSlackUser, s as getSqlExecutor, tn as deleteProviderIdentityForUser } from "./db-PwSRzWWn.js";
|
|
5
|
+
import { d as hasRequiredOAuthScope } from "./registry-POH4bZC4.js";
|
|
6
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-kkE3hvCX.js";
|
|
7
|
+
import { h as deleteMcpStoredOAuthCredentials, m as deleteMcpServerSessionId, p as deleteMcpAuthSessionsForUserProvider } from "./service-account-o15pZWcJ.js";
|
|
8
8
|
import { randomBytes } from "node:crypto";
|
|
9
9
|
// src/handlers/oauth-html.ts
|
|
10
10
|
/** Build pre-escaped callback HTML with the shared response security policy. */
|