@sentry/junior 0.264.0 → 0.266.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/README.md +1 -1
- package/dist/{adapter-BIbMSKlG.js → adapter-eRFA_naf.js} +1 -1
- package/dist/{admin-D4d0HXax.js → admin-tILpP51p.js} +1 -1
- package/dist/{agent-runner-CvRxb09K.js → agent-runner-BtYK7bht.js} +263 -198
- package/dist/api/schema.d.ts +216 -15
- package/dist/api/schema.js +5 -5
- package/dist/api.js +109 -42
- package/dist/{app-Buc5gIWz.d.ts → app-Csbi9dW7.d.ts} +0 -4
- package/dist/app.d.ts +1 -1
- package/dist/app.js +79 -390
- package/dist/{assistant-reply-BcJj_ORj.js → assistant-reply-UyzAfZQo.js} +1 -1
- package/dist/{automation-CWX0qL8U.js → automation-BKpY9LPa.js} +31 -10
- package/dist/{briefs-BFfIE5N6.js → briefs-DgfWMU7e.js} +5 -5
- package/dist/{catalog-runtime-R53MWcMi.js → catalog-runtime-DAJjAbSx.js} +1 -1
- package/dist/cli/chat.js +15 -15
- package/dist/cli/check.js +3 -3
- package/dist/cli/init.js +4 -18
- package/dist/cli/main.js +4 -4
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client-DpOwh_zX.js → client-B0YZfxNy.js} +3 -8
- package/dist/{config-BxPrFVJP.js → config-C0UwYqDK.js} +100 -3
- package/dist/{connections-BnTM1nRf.js → connections-Bwu3VORi.js} +11 -10
- package/dist/{conversation-B0baEwoA.js → conversation-DF4rUcjb.js} +6 -2
- package/dist/{conversation-privacy-ueJ6i-t9.js → conversation-privacy-CY7JVjxn.js} +1 -1
- package/dist/{credential-sync-DeDkof_D.js → credential-sync-VGAMUTGp.js} +20 -20
- package/dist/{agent-hooks-D_PbluRX.js → credentialed-enF5Bf3y.js} +3316 -179
- package/dist/{executor-D3WIS4vl.js → executor-TnWbvL09.js} +10 -300
- package/dist/{history-AY8rs-FR.js → history-C84mlAwO.js} +2 -1
- package/dist/{images-5VNK_yYC.js → images-BKQqSi5W.js} +3 -3
- package/dist/instrumentation.js +41 -25
- package/dist/{job-queue-BYHonCAH.js → job-queue-DBpHmKnd.js} +53 -14
- package/dist/{logging-DNQqsQ57.js → logging-Ce0mXZ8J.js} +19 -32
- package/dist/{message-CDTJISxL.js → message-VZ3DFpGb.js} +4 -4
- package/dist/nitro.d.ts +17 -2
- package/dist/nitro.js +26 -27
- package/dist/{oauth-callback-server-Bk4rbLOs.js → oauth-callback-server-CpqWLjVY.js} +2 -2
- package/dist/{prompt-CxatQVaj.js → prompt-BcCGlmg2.js} +2 -2
- package/dist/{registry-CfdUEk4N.js → registry-1BEIPdbT.js} +1 -1
- package/dist/{resolve-BXShI336.js → resolve-BSHHkEGE.js} +7 -106
- package/dist/{result-R35jcahx.js → result-CwOpzqdh.js} +8 -8
- package/dist/{runner-IC4Drh3Y.js → runner-CEaX04kz.js} +11 -11
- package/dist/{sandbox-egress-signals-C4RIfjb8.js → sandbox-egress-signals-BwtGHwqa.js} +1 -1
- package/dist/{schema-QidbykYl.js → schema-RsaBHxRH.js} +45 -4
- package/dist/{sentry-BBUlHih9.js → sentry-MDkYAVPV.js} +3 -6
- package/dist/{service-account-DJSRo2cL.js → service-account-6wC76eBZ.js} +5 -5
- package/dist/{service-account-DifohWyX.js → service-account-Dg4lIbHm.js} +3 -3
- package/dist/{session-stop-B9RRGC-P.js → session-stop-tZOw9AJD.js} +120 -80
- package/dist/{skills-DVJmS_ZP.js → skills-DzyGN7wd.js} +2 -2
- package/dist/{spawn-DkVYGfSY.js → spawn-6rokq7l_.js} +2 -2
- package/dist/{store-BvolNnx4.js → store-DcKkzrdt.js} +3 -3
- package/dist/{store-C_mHwAnR.js → store-FALy-JQb.js} +6 -6
- package/dist/{task-queue-BcEyPhtX.js → task-queue-Bg4RS2Gy.js} +14 -19
- package/dist/{task-runner-CiQj5M_9.js → task-runner-8N5LIkSg.js} +47 -29
- package/dist/{tasks-OgXmReUv.js → tasks-DDT-J3Rf.js} +17 -2078
- package/dist/{thread-state-XFvpWXE9.js → thread-state-cprEaxgl.js} +5 -5
- package/dist/{turn-failure-response-BjBAtnVt.js → turn-failure-response-C8sMdsdX.js} +8 -8
- package/dist/{turn-lifecycle-nvKL2rul.js → turn-lifecycle-DaBVoz7h.js} +2 -2
- package/dist/{turn-session-routing-DEMxHySb.js → turn-session-routing-a9CHX-w6.js} +1 -1
- package/dist/{validation-XOFldwvE.js → validation-C2lllinq.js} +1 -1
- package/dist/{version-C9f5hdHD.js → version-oaLfxxnf.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-BuPwzOC9.js → viewer-BpE6Z3qf.js} +22 -6
- package/dist/{web-input-4t7TYLsY.js → web-input-B-bMjD1V.js} +147 -48
- package/dist/{work-C_aF6JN5.js → work-VX1SHWha.js} +52 -51
- package/dist/{worker-DR633sA-.js → worker-hook-y_Y.js} +5 -5
- package/package.json +10 -9
- package/dist/profile-ieODOp4u.js +0 -582
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Z as persistConversationMessages,
|
|
2
|
-
import { B as toOptionalNumber, V as toOptionalString, z as isRecord } from "./logging-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { r as getStateAdapter } from "./adapter-
|
|
1
|
+
import { Z as persistConversationMessages, yn as createDurableLocationConfigurationService } from "./tasks-DDT-J3Rf.js";
|
|
2
|
+
import { B as toOptionalNumber, V as toOptionalString, z as isRecord } from "./logging-Ce0mXZ8J.js";
|
|
3
|
+
import { f as getDb } from "./viewer-BpE6Z3qf.js";
|
|
4
|
+
import { ln as JUNIOR_THREAD_STATE_TTL_MS } from "./credentialed-enF5Bf3y.js";
|
|
5
|
+
import { r as getStateAdapter } from "./adapter-eRFA_naf.js";
|
|
6
6
|
// src/chat/state/conversation.ts
|
|
7
7
|
function defaultConversationState() {
|
|
8
8
|
return {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { X as hydrateConversationMessages, cn as buildDeterministicTurnId, ut as markConversationMessage, wt as clearPendingAuth } from "./tasks-
|
|
2
|
-
import { _ as getProviderErrorAttributes, g as findProviderError, m as ProviderError, v as getProviderErrorUserMessage } from "./client-
|
|
3
|
-
import { t as buildTurnFailureResponse, z as isRecord } from "./logging-
|
|
1
|
+
import { X as hydrateConversationMessages, cn as buildDeterministicTurnId, ut as markConversationMessage, wt as clearPendingAuth } from "./tasks-DDT-J3Rf.js";
|
|
2
|
+
import { _ as getProviderErrorAttributes, g as findProviderError, m as ProviderError, v as getProviderErrorUserMessage } from "./client-B0YZfxNy.js";
|
|
3
|
+
import { t as buildTurnFailureResponse, z as isRecord } from "./logging-Ce0mXZ8J.js";
|
|
4
4
|
import { g as parseSlackMessageTs } from "./actor-tlxzqaRe.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { F as readMessageCardRefs, I as removedCardSchema, L as resolveMessageCards } from "./conversation-
|
|
8
|
-
import { D as parseAgentInvocationResultMessageId, J as markTurnClosed, Y as markTurnCompleted, c as getAgentInvocation, m as getAgentInvocationTurnId } from "./store-
|
|
9
|
-
import { o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-
|
|
5
|
+
import { f as getDb, l as getConversationEventStore } from "./viewer-BpE6Z3qf.js";
|
|
6
|
+
import { Zn as listConversationAnnotations } from "./credentialed-enF5Bf3y.js";
|
|
7
|
+
import { F as readMessageCardRefs, I as removedCardSchema, L as resolveMessageCards } from "./conversation-DF4rUcjb.js";
|
|
8
|
+
import { D as parseAgentInvocationResultMessageId, J as markTurnClosed, Y as markTurnCompleted, c as getAgentInvocation, m as getAgentInvocationTurnId } from "./store-DcKkzrdt.js";
|
|
9
|
+
import { o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-cprEaxgl.js";
|
|
10
10
|
// src/chat/conversations/pending-cards.ts
|
|
11
11
|
/**
|
|
12
12
|
* Add the cards that tool results selected since the last visible assistant
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as getConversationEventStore } from "./viewer-BpE6Z3qf.js";
|
|
2
2
|
// src/chat/conversations/turn-lifecycle.ts
|
|
3
3
|
/** Persist correlated turn lifecycle facts with retry-safe terminal exclusion. */
|
|
4
4
|
var ConversationTurnLifecycleService = class {
|
|
@@ -19,7 +19,7 @@ var ConversationTurnLifecycleService = class {
|
|
|
19
19
|
}
|
|
20
20
|
}]);
|
|
21
21
|
}
|
|
22
|
-
/** Record
|
|
22
|
+
/** Record a completion that is not a failure once. */
|
|
23
23
|
async complete(input) {
|
|
24
24
|
await this.events.append(input.conversationId, [{
|
|
25
25
|
idempotencyKey: `turn:${input.turnId}:terminal`,
|
|
@@ -34,7 +34,7 @@ function slackSourceForDestination(args) {
|
|
|
34
34
|
* Reads parent Conversations when this Conversation has no Destination.
|
|
35
35
|
*/
|
|
36
36
|
async function resolveConversationRouting(args) {
|
|
37
|
-
const conversationStore = args.conversationStore ?? (await import("./viewer-
|
|
37
|
+
const conversationStore = args.conversationStore ?? (await import("./viewer-BpE6Z3qf.js").then((n) => n.c)).getConversationStore();
|
|
38
38
|
const chain = await loadConversationChain(args.conversationId, conversationStore);
|
|
39
39
|
let destination;
|
|
40
40
|
let source;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
2
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-DAJjAbSx.js";
|
|
3
3
|
import { isDeepStrictEqual } from "node:util";
|
|
4
4
|
// src/chat/plugins/validation.ts
|
|
5
5
|
var validation_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.
|
|
2
|
+
var version = "0.266.0";
|
|
3
3
|
// src/version.ts
|
|
4
4
|
/** Installed Junior package version, or `unknown` when package metadata is unavailable. */
|
|
5
5
|
const JUNIOR_VERSION = typeof version === "string" && version.trim() ? version : "unknown";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as JUNIOR_VERSION } from "./version-
|
|
1
|
+
export { t as JUNIOR_VERSION } from "./version-oaLfxxnf.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { i as getChatConfig } from "./config-C0UwYqDK.js";
|
|
3
|
+
import { I as GOOGLE_IDENTITY_PROVIDER, R as normalizeIdentityEmail } from "./logging-Ce0mXZ8J.js";
|
|
4
4
|
import { d as parseSlackTeamId, o as parseActorUserId, u as parseSlackChannelReferenceId } from "./actor-tlxzqaRe.js";
|
|
5
5
|
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-CxKldAeB.js";
|
|
6
|
-
import { _ as juniorConversationAnnotations, d as juniorConversationBindings, h as juniorConversationEvents, m as juniorConversationMetrics, p as CONVERSATION_METRICS, t as createJuniorSqlExecutor, u as juniorConversationParticipants } from "./executor-
|
|
7
|
-
import { c as newConversationEventSchema, h as usageSchema, l as encodeHistoryPayload, o as decodeStoredConversationEvent, r as conversationEventDataSchema, s as historyReplacementSchema } from "./history-
|
|
6
|
+
import { _ as juniorConversationAnnotations, d as juniorConversationBindings, h as juniorConversationEvents, m as juniorConversationMetrics, p as CONVERSATION_METRICS, t as createJuniorSqlExecutor, u as juniorConversationParticipants } from "./executor-TnWbvL09.js";
|
|
7
|
+
import { c as newConversationEventSchema, h as usageSchema, l as encodeHistoryPayload, o as decodeStoredConversationEvent, r as conversationEventDataSchema, s as historyReplacementSchema } from "./history-C84mlAwO.js";
|
|
8
8
|
import { randomUUID } from "node:crypto";
|
|
9
9
|
import { and, asc, desc, eq, gt, gte, inArray, isNull, lt, lte, ne, or, sql } from "drizzle-orm";
|
|
10
10
|
import { destinationSchema, identitySchema, locationSchema, sourceSchema, userSchema } from "@sentry/junior-plugin-api";
|
|
@@ -482,7 +482,7 @@ function systemIdentityFromSource(source) {
|
|
|
482
482
|
kind: "system",
|
|
483
483
|
provider: "junior",
|
|
484
484
|
providerSubjectId: "scheduler",
|
|
485
|
-
displayName: "
|
|
485
|
+
displayName: "Scheduler"
|
|
486
486
|
};
|
|
487
487
|
if (source === "local") return {
|
|
488
488
|
kind: "system",
|
|
@@ -1646,4 +1646,20 @@ async function readActorIdentityFromSql(db, actor) {
|
|
|
1646
1646
|
async function readActorIdentity(actor) {
|
|
1647
1647
|
return await readActorIdentityFromSql(getDb(), actor);
|
|
1648
1648
|
}
|
|
1649
|
-
|
|
1649
|
+
/** Read one stored identity and its linked user by identity id. */
|
|
1650
|
+
async function readIdentityByIdFromSql(db, identityId) {
|
|
1651
|
+
const row = (await db.select({
|
|
1652
|
+
identity: juniorIdentities,
|
|
1653
|
+
user: juniorUsers
|
|
1654
|
+
}).from(juniorIdentities).leftJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(and(eq(juniorIdentities.id, identityId), eq(juniorIdentities.kind, "user"))).limit(1))[0];
|
|
1655
|
+
if (!row) return void 0;
|
|
1656
|
+
return {
|
|
1657
|
+
identity: identityFromRow(row.identity),
|
|
1658
|
+
...row.user ? { user: await readUserById(db, row.user) } : void 0
|
|
1659
|
+
};
|
|
1660
|
+
}
|
|
1661
|
+
/** Read one stored identity and its linked user by identity id. */
|
|
1662
|
+
async function readIdentityById(identityId) {
|
|
1663
|
+
return await readIdentityByIdFromSql(getDb(), identityId);
|
|
1664
|
+
}
|
|
1665
|
+
export { deleteProviderIdentityForSlackUser as A, requireSlackDestination as B, parseSessionSource as C, agentTurnUsageSchema as D, agentTurnTotalTokens as E, saveUserTimezone as F, upsertIdentity as I, upsertLinkedIdentity as L, findUserByVerifiedEmails as M, readUserTimezone as N, hasAgentTurnUsage as O, recordGoogleSignIn as P, createSlackDestination as R, bindProviderConversation as S, agentTurnCostUsd as T, sameDestination as V, createSqlStore as _, resolveViewerUser as a, startLocationThread as b, db_exports as c, getConversationStore as d, getDb as f, loadConversationSlackTenantIds as g, withConversationEventLock as h, readIdentityById as i, deleteProviderIdentityForUser as j, resolveRootConversationId as k, getConversationEventStore as l, createSqlConversationEventStore as m, listAdminUsersFromSql as n, setUserAdminFromSql as o, getSqlExecutor as p, readActorIdentity as r, updateViewerDisplayName as s, findUserByEmail as t, getConversationMessageSearchStore as u, withConversationMutationLock as v, addAgentTurnUsage as w, identityFromActor as x, locationFromRow as y, parseDestination as z };
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { $ as persistConversationMessageSummaries, A as commitAcceptedReply, At as abandonTurnRecord,
|
|
2
|
-
import { a as completeText, p as escapeXml, r as completeDecision, y as isProviderRetryError } from "./client-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { $ as persistConversationMessageSummaries, A as commitAcceptedReply, At as abandonTurnRecord, Bt as buildTurnErrorResponse, E as sameDefinitionValue, Et as wasPendingAuthStopped, F as loadProjection, Ft as recordTurnSummary, H as recordAuthorizationCompleted, K as recordSubscribedReplyRoute, Mt as failTurnRecord, N as loadConversationProjection, Nt as getTurnRecord, Ot as loadTurnCheckpoint, Pt as listTurnSummaries, S as automationDefinition, Ut as persistWithRetry, X as hydrateConversationMessages, Z as persistConversationMessages, _ as parseEventAutomationRow, _n as isExperimentalFeatureEnabled, at as buildConversationContext, bn as configValueSchema, bt as AuthorizationFlowDisabledError, c as withScheduledAutomationLock, cn as buildDeterministicTurnId, ct as getConversationMessageSlackTs, dn as getSubscribedReplyPreflightDecision, dt as normalizeConversationText, et as resolveConversationTitle, f as deleteEventAutomation, fn as getThreadStopDecision, ft as recordDeliveredAssistantMessage, gt as PluginCredentialFailureError, h as listDeletedEventAutomationsCreatedBy, i as readScheduledAutomation, it as appendThreadContextMessages, j as commitMessages, jt as completeTurnRecord, kt as saveTurnCheckpoint, lt as isHumanConversationMessage, mt as upsertConversationMessage, nt as fallbackShortTitle, o as saveScheduledAutomationInLock, ot as createConversationMemoryService, pt as turnHasReply, r as parseScheduledAutomationRow, rn as trimTrailingAssistantMessages, sn as buildDeterministicAssistantMessageId, st as estimateConversationContextTokens, un as decideSubscribedThreadReply, ut as markConversationMessage, w as listAutomationVersions, wt as clearPendingAuth } from "./tasks-DDT-J3Rf.js";
|
|
2
|
+
import { a as completeText, p as escapeXml, r as completeDecision, y as isProviderRetryError } from "./client-B0YZfxNy.js";
|
|
3
|
+
import { c as getSlackClientSecret, i as getChatConfig, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, s as getSlackClientId, v as normalizeSlackEmojiName, y as createS3AttachmentStorage } from "./config-C0UwYqDK.js";
|
|
4
|
+
import { B as toOptionalNumber, T as withSpan, V as toOptionalString, d as logError, f as logException, m as logWarn, n as createChatSdkLogger, o as getActiveTraceId, p as logInfo, t as buildTurnFailureResponse, v as setSentryUser, w as withLogContext, x as setTags, y as setSpanAttributes, z as isRecord } from "./logging-Ce0mXZ8J.js";
|
|
5
5
|
import { o as modelIdForProfile, r as defaultModelId } from "./model-profile-Bg8EoCKD.js";
|
|
6
6
|
import { a as isUserActor, g as parseSlackMessageTs, i as isActorUserId, l as parseSlackChannelId, n as createSlackActor, o as parseActorUserId, r as createSlackResumeActor, t as createActor } from "./actor-tlxzqaRe.js";
|
|
7
|
-
import {
|
|
7
|
+
import { B as requireSlackDestination, R as createSlackDestination, d as getConversationStore, f as getDb, l as getConversationEventStore, p as getSqlExecutor } from "./viewer-BpE6Z3qf.js";
|
|
8
8
|
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers } from "./agent-invocations-CxKldAeB.js";
|
|
9
|
-
import { a as juniorAutomationRuns, s as juniorAutomations } from "./executor-
|
|
10
|
-
import { p as instructionProvenanceFor } from "./history-
|
|
11
|
-
import { d as actorLogContext, f as credentialContextForActor } from "./registry-
|
|
12
|
-
import { A as listThreadReplies, D as resolveSlackChannelIdFromMessage, E as readSlackRawMessageContext, I as
|
|
13
|
-
import {
|
|
14
|
-
import { a as acquireActiveLock, i as MUTATION_LOCK_TTL_MS, r as getStateAdapter, s as withLock } from "./adapter-
|
|
15
|
-
import { B as readMessageAttachments, U as isVisionImageMediaType } from "./conversation-
|
|
16
|
-
import { a as EVENT_SYSTEM_ACTOR, o as isEventConversationMessage } from "./prompt-
|
|
17
|
-
import { B as ConversationTurnBoundaryError, G as isCooperativeTurnYieldError, H as TurnInputCommitLostError, J as markTurnClosed, K as isTurnInputCommitLostError, U as TurnInputDeferredError, V as CooperativeTurnYieldError, W as getConversationTurnBoundaryError, X as markTurnFailed, Y as markTurnCompleted, Z as startActiveTurn, q as isTurnInputDeferredError } from "./store-
|
|
18
|
-
import { n as getAssistantReplyText } from "./assistant-reply-
|
|
19
|
-
import {
|
|
20
|
-
import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline } from "./job-queue-
|
|
21
|
-
import { E as stopConversationWork, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, n as appendAndEnqueueExclusiveInboundMessage, r as appendAndEnqueueInboundMessage, w as requestConversationWork } from "./store-
|
|
22
|
-
import { l as automationListQuerySchema } from "./automation-
|
|
9
|
+
import { a as juniorAutomationRuns, s as juniorAutomations } from "./executor-TnWbvL09.js";
|
|
10
|
+
import { p as instructionProvenanceFor } from "./history-C84mlAwO.js";
|
|
11
|
+
import { d as actorLogContext, f as credentialContextForActor } from "./registry-1BEIPdbT.js";
|
|
12
|
+
import { A as listThreadReplies, D as resolveSlackChannelIdFromMessage, E as readSlackRawMessageContext, I as describeEventAutomationTrigger, L as effectiveTaskOutcomes, O as resolveSlackChannelIdFromThreadId, Q as RetryableDeliveryError, T as parseSlackThreadId, X as buildSteeringPiMessage, Z as withoutSavedSteeringMessages, b as renderBlockText, i as buildAuthPauseResponse, k as getConversationInfo, n as executeAgentRun, nt as shouldEmitDevAgentTrace, p as latestProgressStatus, r as createContextCompactor, t as createAgentRunner, w as storeAttachment, y as renderAttachmentText } from "./agent-runner-BtYK7bht.js";
|
|
13
|
+
import { $t as getHeaderString, Kn as readAttachmentVisionSummary, Nt as cancelSubscriptions, Un as buildSentryConversationUrl, Wn as getSlackFileId, Xt as SlackActionError, Yt as verifyTimerWatchCredentialSubject, Zt as downloadPrivateSlackFile, dn as getDashboardObjectIconLink, dt as normalizeSlackReplyMarkdown, en as getSlackClient, ft as normalizeSlackStatusText, ht as addReactionToMessage, in as runWithSlackInstallationToken, l as getPluginSlackConversationLink, ln as JUNIOR_THREAD_STATE_TTL_MS, lt as escapeSlackMrkdwnText, mt as truncateStatusText, n as createUserTokenStore, nn as isDmChannel, qn as recordSlackAttachment, rn as normalizeSlackConversationId, tr as lookupSlackUser, un as getDashboardConversationLink, ut as formatSlackLink, vt as postSlackMessage, yt as removeReactionFromMessage } from "./credentialed-enF5Bf3y.js";
|
|
14
|
+
import { a as acquireActiveLock, i as MUTATION_LOCK_TTL_MS, r as getStateAdapter, s as withLock } from "./adapter-eRFA_naf.js";
|
|
15
|
+
import { B as readMessageAttachments, U as isVisionImageMediaType } from "./conversation-DF4rUcjb.js";
|
|
16
|
+
import { a as EVENT_SYSTEM_ACTOR, o as isEventConversationMessage } from "./prompt-BcCGlmg2.js";
|
|
17
|
+
import { B as ConversationTurnBoundaryError, G as isCooperativeTurnYieldError, H as TurnInputCommitLostError, J as markTurnClosed, K as isTurnInputCommitLostError, U as TurnInputDeferredError, V as CooperativeTurnYieldError, W as getConversationTurnBoundaryError, X as markTurnFailed, Y as markTurnCompleted, Z as startActiveTurn, q as isTurnInputDeferredError } from "./store-DcKkzrdt.js";
|
|
18
|
+
import { n as getAssistantReplyText } from "./assistant-reply-UyzAfZQo.js";
|
|
19
|
+
import { B as finishedRunReply, F as recordFinishedTurnForAutomatedLimit, M as joinMailboxText, P as maybePostAutomatedTurnLimitNotice, U as runDispatchOutcome, c as isEventMailboxMetadata, d as getEventCatalog, i as skipInputBeforeConversationStop, l as renderEventBatchText, s as eventBatchMessageEvents, u as timerWatchCredentialSubject, x as automationEventCatalog, z as deliversFinalText } from "./session-stop-tZOw9AJD.js";
|
|
20
|
+
import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline } from "./job-queue-DBpHmKnd.js";
|
|
21
|
+
import { E as stopConversationWork, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, n as appendAndEnqueueExclusiveInboundMessage, r as appendAndEnqueueInboundMessage, w as requestConversationWork } from "./store-FALy-JQb.js";
|
|
22
|
+
import { l as automationListQuerySchema } from "./automation-BKpY9LPa.js";
|
|
23
23
|
import { c as sumUtcHoursIntoSixHours, m as healthReportSchema, t as webMessageId } from "./web-message-id-CJSUiksE.js";
|
|
24
|
-
import { A as readAutomationExecutions, D as readAutomationExecutionStatusDays, E as readAutomationExecutionHours, O as readAutomationExecutionStatusHours, S as emptyAutomationRunWindows, T as readAutomationExecutionDays, _ as markDispatchBlocked, a as claimDispatchMailboxAppend, b as markDispatchRunning, c as getDispatchConversationId, d as getDispatchRecord, f as getDispatchTurnId, g as markDispatchAwaitingResume, j as readAutomationRuns, k as readAutomationExecutionSummaries, l as getDispatchIdForConversation, m as isTerminalDispatchStatus, n as scheduleSessionCompletedPluginTasks, o as confirmDispatchMailboxAppend, t as processPluginTask, u as getDispatchInputMessageId, v as markDispatchCompleted, w as readAutomationExecutionByConversationId, y as markDispatchFailed } from "./task-runner-
|
|
25
|
-
import { a as withAgentInvocationResultActors, c as resolveMailboxTurnWork, i as startAgentInvocationsForChildInput, l as sourceFromTurnInput, o as getAuthPausedConversationTurnId, s as getEventBatchDelayMs, t as enqueueAgentInvocationResult, u as turnInputFactsFromConversationMessage } from "./result-
|
|
26
|
-
import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-
|
|
27
|
-
import { i as resolveAgentInvocationId, o as AgentRunError, s as executeTurn, t as createAgentInvocationWorker } from "./work-
|
|
28
|
-
import { a as persistThreadState, i as persistThreadRuntimeState, n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState, t as getLocationConfigurationService } from "./thread-state-
|
|
29
|
-
import { c as deleteWebAuthorization, d as createPausedTurns, f as getPausedTurnRequest, h as getTurnAuthorization, m as wakePausedTurn, s as createWebAuthorization } from "./connections-
|
|
30
|
-
import { n as resolveTurnSessionRouting } from "./turn-session-routing-
|
|
31
|
-
import { t as bindMessageAgent } from "./message-
|
|
32
|
-
import { t as bindSpawnAgent } from "./spawn-
|
|
33
|
-
import { a as persistAuthPauseTurnState, c as getTurnUserSlackMessageTs, d as loadPendingMessageCards, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, n as getAgentTurnDiagnosticsAttributes, o as getTurnUserMessage, r as requireTurnFailureEventId, s as getTurnUserReplyAttachmentContext, t as finalizeFailedTurnReplyWithEvent, u as getInterruptionMarker } from "./turn-failure-response-
|
|
34
|
-
import { r as storeInputImages } from "./images-
|
|
24
|
+
import { A as readAutomationExecutions, D as readAutomationExecutionStatusDays, E as readAutomationExecutionHours, O as readAutomationExecutionStatusHours, S as emptyAutomationRunWindows, T as readAutomationExecutionDays, _ as markDispatchBlocked, a as claimDispatchMailboxAppend, b as markDispatchRunning, c as getDispatchConversationId, d as getDispatchRecord, f as getDispatchTurnId, g as markDispatchAwaitingResume, j as readAutomationRuns, k as readAutomationExecutionSummaries, l as getDispatchIdForConversation, m as isTerminalDispatchStatus, n as scheduleSessionCompletedPluginTasks, o as confirmDispatchMailboxAppend, t as processPluginTask, u as getDispatchInputMessageId, v as markDispatchCompleted, w as readAutomationExecutionByConversationId, y as markDispatchFailed } from "./task-runner-8N5LIkSg.js";
|
|
25
|
+
import { a as withAgentInvocationResultActors, c as resolveMailboxTurnWork, i as startAgentInvocationsForChildInput, l as sourceFromTurnInput, o as getAuthPausedConversationTurnId, s as getEventBatchDelayMs, t as enqueueAgentInvocationResult, u as turnInputFactsFromConversationMessage } from "./result-CwOpzqdh.js";
|
|
26
|
+
import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-DaBVoz7h.js";
|
|
27
|
+
import { i as resolveAgentInvocationId, o as AgentRunError, s as executeTurn, t as createAgentInvocationWorker } from "./work-VX1SHWha.js";
|
|
28
|
+
import { a as persistThreadState, i as persistThreadRuntimeState, n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState, t as getLocationConfigurationService } from "./thread-state-cprEaxgl.js";
|
|
29
|
+
import { c as deleteWebAuthorization, d as createPausedTurns, f as getPausedTurnRequest, h as getTurnAuthorization, m as wakePausedTurn, s as createWebAuthorization } from "./connections-Bwu3VORi.js";
|
|
30
|
+
import { n as resolveTurnSessionRouting } from "./turn-session-routing-a9CHX-w6.js";
|
|
31
|
+
import { t as bindMessageAgent } from "./message-VZ3DFpGb.js";
|
|
32
|
+
import { t as bindSpawnAgent } from "./spawn-6rokq7l_.js";
|
|
33
|
+
import { a as persistAuthPauseTurnState, c as getTurnUserSlackMessageTs, d as loadPendingMessageCards, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, n as getAgentTurnDiagnosticsAttributes, o as getTurnUserMessage, r as requireTurnFailureEventId, s as getTurnUserReplyAttachmentContext, t as finalizeFailedTurnReplyWithEvent, u as getInterruptionMarker } from "./turn-failure-response-C8sMdsdX.js";
|
|
34
|
+
import { r as storeInputImages } from "./images-BKQqSi5W.js";
|
|
35
35
|
import { z } from "zod";
|
|
36
36
|
import { createHash } from "node:crypto";
|
|
37
37
|
import { and, asc, count, desc, eq, exists, inArray, ne, or, sql } from "drizzle-orm";
|
|
@@ -303,6 +303,34 @@ function createAgentDispatchConversationWorker(options) {
|
|
|
303
303
|
}
|
|
304
304
|
};
|
|
305
305
|
}
|
|
306
|
+
// src/chat/attachments/memory.ts
|
|
307
|
+
/**
|
|
308
|
+
* Store attachments in process memory, for tests.
|
|
309
|
+
*
|
|
310
|
+
* Objects are lost when the process stops, and each process has its own
|
|
311
|
+
* copy. Do not use this provider for deployed apps.
|
|
312
|
+
*/
|
|
313
|
+
function createMemoryAttachmentStorage() {
|
|
314
|
+
const objects = /* @__PURE__ */ new Map();
|
|
315
|
+
return {
|
|
316
|
+
objects,
|
|
317
|
+
provider: "memory",
|
|
318
|
+
async put(input) {
|
|
319
|
+
objects.set(input.key, Buffer.from(input.body));
|
|
320
|
+
},
|
|
321
|
+
async get(key) {
|
|
322
|
+
const body = objects.get(key);
|
|
323
|
+
if (!body) return null;
|
|
324
|
+
return new ReadableStream({ start(controller) {
|
|
325
|
+
controller.enqueue(new Uint8Array(body));
|
|
326
|
+
controller.close();
|
|
327
|
+
} });
|
|
328
|
+
},
|
|
329
|
+
async delete(keys) {
|
|
330
|
+
for (const key of keys) objects.delete(key);
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
}
|
|
306
334
|
// src/chat/attachments/vercel.ts
|
|
307
335
|
/** Store private conversation attachments in Vercel Blob. */
|
|
308
336
|
function createVercelAttachmentStorage() {
|
|
@@ -329,6 +357,29 @@ function createVercelAttachmentStorage() {
|
|
|
329
357
|
}
|
|
330
358
|
};
|
|
331
359
|
}
|
|
360
|
+
// src/chat/attachments/storage.ts
|
|
361
|
+
/**
|
|
362
|
+
* Return attachment storage for the configured provider.
|
|
363
|
+
*
|
|
364
|
+
* Callers do not choose a provider. Chat config decides it.
|
|
365
|
+
*/
|
|
366
|
+
function getAttachmentStorage() {
|
|
367
|
+
return createAttachmentStorage(getChatConfig().attachmentStorage);
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Create attachment storage for one provider config.
|
|
371
|
+
*
|
|
372
|
+
* Runtime code uses `getAttachmentStorage()`. Call this only to test a
|
|
373
|
+
* provider adapter with its own config.
|
|
374
|
+
*/
|
|
375
|
+
function createAttachmentStorage(config) {
|
|
376
|
+
switch (config.provider) {
|
|
377
|
+
case "vercel-blob": return createVercelAttachmentStorage();
|
|
378
|
+
case "s3": return createS3AttachmentStorage(config.s3);
|
|
379
|
+
case "memory": return createMemoryAttachmentStorage();
|
|
380
|
+
default: throw new Error(`Unsupported attachment storage provider: ${String(config.provider)}`);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
332
383
|
// src/chat/slack/automation-card.ts
|
|
333
384
|
function preview(text, length) {
|
|
334
385
|
const compact = text.replace(/\s+/g, " ").trim();
|
|
@@ -798,6 +849,21 @@ async function startProcessingReactionForMessage(args) {
|
|
|
798
849
|
}
|
|
799
850
|
};
|
|
800
851
|
}
|
|
852
|
+
// src/chat/providers/slack/turn-input-telemetry.ts
|
|
853
|
+
/**
|
|
854
|
+
* Build the `chat.turn` timing attributes for the oldest input message.
|
|
855
|
+
*
|
|
856
|
+
* Slack, the webhook host, and the worker host use separate clocks. A negative
|
|
857
|
+
* duration is clock skew, not latency, so it is left out.
|
|
858
|
+
*/
|
|
859
|
+
function getTurnInputSpanAttributes(input, turnStartedAtMs) {
|
|
860
|
+
const attributes = { "app.turn.input_count": input.count };
|
|
861
|
+
const deliveryLagMs = input.oldestReceivedAtMs - input.oldestCreatedAtMs;
|
|
862
|
+
if (deliveryLagMs >= 0) attributes["app.turn.delivery_lag_ms"] = Math.round(deliveryLagMs);
|
|
863
|
+
const waitMs = turnStartedAtMs - input.oldestReceivedAtMs;
|
|
864
|
+
if (waitMs >= 0) attributes["app.turn.wait_ms"] = Math.round(waitMs);
|
|
865
|
+
return attributes;
|
|
866
|
+
}
|
|
801
867
|
// src/chat/slack/message-control.ts
|
|
802
868
|
/** Leading Slack mention forms that may precede an explicit steering marker. */
|
|
803
869
|
const LEADING_MENTION_BEFORE_STEERING_RE = /^(\s*(?:<@[^>]+>|@[A-Za-z0-9._-]+\b)[\s,:-]*)!!\s*/;
|
|
@@ -1167,7 +1233,9 @@ function createSlackTurnRuntime(deps) {
|
|
|
1167
1233
|
}
|
|
1168
1234
|
processingReaction = await processingReactions.start(context, message);
|
|
1169
1235
|
const toolInvocationHook = createToolInvocationHook(processingReaction, hooks);
|
|
1170
|
-
await withSpan("chat.turn", "chat.turn", context, async () => {
|
|
1236
|
+
await withSpan("chat.turn", "chat.turn", context, async (set) => {
|
|
1237
|
+
const turnStartedAtMs = deps.now();
|
|
1238
|
+
if (hooks.telemetry) set(getTurnInputSpanAttributes(hooks.telemetry, turnStartedAtMs));
|
|
1171
1239
|
const queuedMessages = getQueuedMessages(hooks.messageContext, {
|
|
1172
1240
|
botUserId: deps.getBotUserId(),
|
|
1173
1241
|
explicitMention: true
|
|
@@ -1307,7 +1375,9 @@ function createSlackTurnRuntime(deps) {
|
|
|
1307
1375
|
channelId,
|
|
1308
1376
|
runId
|
|
1309
1377
|
});
|
|
1310
|
-
await withSpan("chat.turn", "chat.turn", turnContext, async () => {
|
|
1378
|
+
await withSpan("chat.turn", "chat.turn", turnContext, async (set) => {
|
|
1379
|
+
const turnStartedAtMs = deps.now();
|
|
1380
|
+
if (hooks.telemetry) set(getTurnInputSpanAttributes(hooks.telemetry, turnStartedAtMs));
|
|
1311
1381
|
const content = parseContent(message);
|
|
1312
1382
|
const strippedUserText = stripLeadingBotMention(stripLeadingSteeringOverride(content.topLevelText), {
|
|
1313
1383
|
botUserId: deps.getBotUserId(),
|
|
@@ -2090,8 +2160,14 @@ function createSlackConversationWorker(options) {
|
|
|
2090
2160
|
}
|
|
2091
2161
|
return { status: "completed" };
|
|
2092
2162
|
}
|
|
2163
|
+
const oldestRecord = records[0];
|
|
2093
2164
|
const latestRecord = records[records.length - 1];
|
|
2094
|
-
if (!latestRecord) return { status: "completed" };
|
|
2165
|
+
if (!oldestRecord || !latestRecord) return { status: "completed" };
|
|
2166
|
+
const telemetry = {
|
|
2167
|
+
count: records.length,
|
|
2168
|
+
oldestCreatedAtMs: oldestRecord.createdAtMs,
|
|
2169
|
+
oldestReceivedAtMs: oldestRecord.receivedAtMs
|
|
2170
|
+
};
|
|
2095
2171
|
const latestMetadata = parseSlackMetadata(latestRecord.input.metadata);
|
|
2096
2172
|
if (!latestMetadata) throw new Error("Latest conversation mailbox record is not Slack metadata");
|
|
2097
2173
|
if (!await context.checkIn()) return { status: "lost_lease" };
|
|
@@ -2157,6 +2233,7 @@ function createSlackConversationWorker(options) {
|
|
|
2157
2233
|
isFinalAttempt: context.attempt.isFinalAttempt,
|
|
2158
2234
|
shouldYield: context.shouldYield,
|
|
2159
2235
|
stopSignal: context.stopSignal?.(),
|
|
2236
|
+
telemetry,
|
|
2160
2237
|
subscribeThread: async () => await subscribeSlackThreadForMessage({
|
|
2161
2238
|
messageCreatedAtMs: latestRecord.createdAtMs,
|
|
2162
2239
|
state,
|
|
@@ -2171,7 +2248,8 @@ function createSlackConversationWorker(options) {
|
|
|
2171
2248
|
ack,
|
|
2172
2249
|
isFinalAttempt: context.attempt.isFinalAttempt,
|
|
2173
2250
|
shouldYield: context.shouldYield,
|
|
2174
|
-
stopSignal: context.stopSignal?.()
|
|
2251
|
+
stopSignal: context.stopSignal?.(),
|
|
2252
|
+
telemetry
|
|
2175
2253
|
});
|
|
2176
2254
|
} catch (error) {
|
|
2177
2255
|
if (isTurnInputDeferredError(error)) return { status: "deferred" };
|
|
@@ -2284,7 +2362,7 @@ function buildAttachmentResolutionFailurePromptText(args) {
|
|
|
2284
2362
|
`filename: ${args.filename ?? "unnamed"}`,
|
|
2285
2363
|
`media_type: ${args.mediaType}`,
|
|
2286
2364
|
"<resolution-error>",
|
|
2287
|
-
"The user attached this file, but
|
|
2365
|
+
"The user attached this file, but you could not download its content from Slack. Tell the user the attachment could not be read; do not say no attachment was sent.",
|
|
2288
2366
|
"</resolution-error>",
|
|
2289
2367
|
"</attachment>"
|
|
2290
2368
|
].join("\n");
|
|
@@ -2721,10 +2799,18 @@ function viewerAutomationCollection(user) {
|
|
|
2721
2799
|
const owned = inArray(automation.creatorIdentityId, user.identities.map((identity) => identity.id));
|
|
2722
2800
|
const publicDestination = sql`coalesce(${destination.visibility} = 'public', false)`;
|
|
2723
2801
|
const publicToViewer = and(inArray(automation.teamId, teamIds), publicDestination, ne(automation.status, "completed"));
|
|
2724
|
-
const
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2802
|
+
const trigger = sql`${automation.record}->'trigger'`;
|
|
2803
|
+
const match = sql`coalesce(${trigger}->'match', '{}'::jsonb)`;
|
|
2804
|
+
const json = (value) => sql`${JSON.stringify(value)}::jsonb`;
|
|
2805
|
+
const fieldWorks = (key, field) => {
|
|
2806
|
+
const value = sql`${match}->(${key}::text)`;
|
|
2807
|
+
const type = sql`jsonb_typeof(${value})`;
|
|
2808
|
+
return sql`(${value} is null or (${and(field.events ? sql`${trigger}->'events' <@ ${json(field.events)}` : void 0, field.kind === "boolean" ? sql`${type} = 'boolean'` : sql`(${type} = ${field.kind} or (${type} = 'array' and not exists (select 1 from jsonb_array_elements(${value}) entry where jsonb_typeof(entry) <> ${field.kind})))`, field.enum ? sql`${value} <@ ${json(field.enum)}` : void 0)}))`;
|
|
2809
|
+
};
|
|
2810
|
+
const available = or(isScheduled, ...Object.entries(automationEventCatalog(getEventCatalog())).flatMap(([namespace, registration]) => registration.resourceTypes.map((resourceType) => {
|
|
2811
|
+
const fields = Object.entries(resourceType.matchFields ?? {});
|
|
2812
|
+
return and(eq(automation.namespace, namespace), sql`${trigger}->>'resourceType' = ${resourceType.type}`, sql`${trigger}->'events' <@ ${json(resourceType.supportedEvents)}`, sql`not exists (select 1 from jsonb_object_keys(${match}) match_key where not (${json(fields.map(([key]) => key))} @> to_jsonb(match_key)))`, ...fields.map(([key, field]) => fieldWorks(key, field)));
|
|
2813
|
+
}))) ?? sql`false`;
|
|
2728
2814
|
const runs = juniorAutomationRuns;
|
|
2729
2815
|
const lastRunNeedsAttention = sql`coalesce((select ${runs.status} in ('failed', 'blocked') from ${runs}
|
|
2730
2816
|
where ${runs.automationId} = ${automation.id} and ${runs.status} in ('blocked', 'completed', 'failed') and ${runs.completedAtMs} is not null
|
|
@@ -2916,6 +3002,7 @@ function scheduledAutomationSummary(task, ownedByViewer, destination, stats, cre
|
|
|
2916
3002
|
}
|
|
2917
3003
|
function eventAutomationSummary(task, ownedByViewer, destination, stats, creator) {
|
|
2918
3004
|
const instruction = task.task.text;
|
|
3005
|
+
const catalog = getEventCatalog();
|
|
2919
3006
|
return {
|
|
2920
3007
|
createdAt: new Date(task.createdAtMs).toISOString(),
|
|
2921
3008
|
createdBy: creatorLabel(task.createdBy),
|
|
@@ -2927,8 +3014,6 @@ function eventAutomationSummary(task, ownedByViewer, destination, stats, creator
|
|
|
2927
3014
|
teamId: task.destination.teamId,
|
|
2928
3015
|
visibility: destination.visibility
|
|
2929
3016
|
},
|
|
2930
|
-
events: task.trigger.events,
|
|
2931
|
-
match: task.trigger.match,
|
|
2932
3017
|
id: task.id,
|
|
2933
3018
|
instruction,
|
|
2934
3019
|
kind: "event",
|
|
@@ -2941,7 +3026,7 @@ function eventAutomationSummary(task, ownedByViewer, destination, stats, creator
|
|
|
2941
3026
|
title: taskDisplayTitle(task.title, instruction, "Untitled event automation"),
|
|
2942
3027
|
status: task.status === "deleted" ? "active" : task.status,
|
|
2943
3028
|
statusReason: task.statusReason,
|
|
2944
|
-
|
|
3029
|
+
trigger: describeEventAutomationTrigger(task.trigger, catalog)
|
|
2945
3030
|
};
|
|
2946
3031
|
}
|
|
2947
3032
|
function viewerTeamIds(user) {
|
|
@@ -3183,8 +3268,12 @@ async function readViewerAutomationVersions(user, id) {
|
|
|
3183
3268
|
const versions = await listAutomationVersions(getDb(), id, 101);
|
|
3184
3269
|
const current = automationDefinition(candidate.task);
|
|
3185
3270
|
const listed = versions.slice(0, AUTOMATION_VERSION_LIST_LIMIT);
|
|
3271
|
+
const catalog = getEventCatalog();
|
|
3186
3272
|
return {
|
|
3187
|
-
versions: listed
|
|
3273
|
+
versions: listed.map((version) => version.kind === "event" ? {
|
|
3274
|
+
...version,
|
|
3275
|
+
trigger: describeEventAutomationTrigger(version.definition.trigger, catalog)
|
|
3276
|
+
} : version),
|
|
3188
3277
|
activeVersion: listed.find(({ definition }) => sameDefinitionValue(definition, current))?.version ?? null,
|
|
3189
3278
|
truncated: versions.length > AUTOMATION_VERSION_LIST_LIMIT
|
|
3190
3279
|
};
|
|
@@ -3284,7 +3373,7 @@ function createSlackAdapterStatusSender(args) {
|
|
|
3284
3373
|
if (!normalizedChannelId) return;
|
|
3285
3374
|
const nextLoadingMessages = text ? loadingMessages ?? [text] : void 0;
|
|
3286
3375
|
try {
|
|
3287
|
-
await runWithBoundSlackToken(adapter, boundToken, () => adapter.setAssistantStatus(normalizedChannelId, threadTs, text ? SLACK_ASSISTANT_ACTIVE_STATUS : "", nextLoadingMessages));
|
|
3376
|
+
await withSetStatusSpan(() => runWithBoundSlackToken(adapter, boundToken, () => adapter.setAssistantStatus(normalizedChannelId, threadTs, text ? SLACK_ASSISTANT_ACTIVE_STATUS : "", nextLoadingMessages)));
|
|
3288
3377
|
} catch (error) {
|
|
3289
3378
|
logAssistantStatusFailure({
|
|
3290
3379
|
status: text,
|
|
@@ -3311,12 +3400,12 @@ function createSlackWebApiStatusSender(args) {
|
|
|
3311
3400
|
if (!normalizedChannelId) return;
|
|
3312
3401
|
const nextLoadingMessages = text ? loadingMessages ?? [text] : void 0;
|
|
3313
3402
|
try {
|
|
3314
|
-
await getClient().assistant.threads.setStatus({
|
|
3403
|
+
await withSetStatusSpan(() => getClient().assistant.threads.setStatus({
|
|
3315
3404
|
channel_id: normalizedChannelId,
|
|
3316
3405
|
thread_ts: threadTs,
|
|
3317
3406
|
status: text ? SLACK_ASSISTANT_ACTIVE_STATUS : "",
|
|
3318
3407
|
...nextLoadingMessages ? { loading_messages: nextLoadingMessages } : void 0
|
|
3319
|
-
});
|
|
3408
|
+
}));
|
|
3320
3409
|
} catch (error) {
|
|
3321
3410
|
logAssistantStatusFailure({
|
|
3322
3411
|
status: text,
|
|
@@ -3328,6 +3417,16 @@ function createSlackWebApiStatusSender(args) {
|
|
|
3328
3417
|
}
|
|
3329
3418
|
};
|
|
3330
3419
|
}
|
|
3420
|
+
async function withSetStatusSpan(task) {
|
|
3421
|
+
const method = "assistant.threads.setStatus";
|
|
3422
|
+
return await withSpan(`POST slack.com/api/${method}`, "http.client", {}, task, {
|
|
3423
|
+
"http.request.method": "POST",
|
|
3424
|
+
"server.address": "slack.com",
|
|
3425
|
+
"url.scheme": "https",
|
|
3426
|
+
"url.path": `/api/${method}`,
|
|
3427
|
+
"app.slack.method": method
|
|
3428
|
+
});
|
|
3429
|
+
}
|
|
3331
3430
|
function getSlackAdapterRequestToken(adapter) {
|
|
3332
3431
|
const token = adapter.requestContext?.getStore()?.token;
|
|
3333
3432
|
if (typeof token !== "string") return;
|
|
@@ -5093,7 +5192,7 @@ async function syncAssistantThreadContext(event, options) {
|
|
|
5093
5192
|
const channelId = normalizeSlackConversationId(event.channelId);
|
|
5094
5193
|
if (!channelId) throw new Error("Assistant thread initialization requires a channel ID");
|
|
5095
5194
|
const slack = event.getSlackAdapter();
|
|
5096
|
-
if (options.setInitialTitle) await slack.setAssistantTitle(channelId, event.threadTs,
|
|
5195
|
+
if (options.setInitialTitle) await slack.setAssistantTitle(channelId, event.threadTs, botConfig.userName);
|
|
5097
5196
|
await slack.setSuggestedPrompts(channelId, event.threadTs, [
|
|
5098
5197
|
{
|
|
5099
5198
|
title: "Summarize thread",
|
|
@@ -7382,4 +7481,4 @@ async function appendAndEnqueueWebMessage(input, options) {
|
|
|
7382
7481
|
status
|
|
7383
7482
|
};
|
|
7384
7483
|
}
|
|
7385
|
-
export { THREAD_OPTOUT_ACK as A, readHealthReport as B, buildSlackInboundMessage as C, normalizeIncomingSlackThreadId as D, stopSlackThread as E, renderSlackObjectCard as F,
|
|
7484
|
+
export { THREAD_OPTOUT_ACK as A, readHealthReport as B, buildSlackInboundMessage as C, normalizeIncomingSlackThreadId as D, stopSlackThread as E, renderSlackObjectCard as F, getAttachmentStorage as I, AGENT_DISPATCH_MAX_AGE_MS as L, parseContent as M, runWithSlackInstallation as N, withNormalizedThreadId as O, verifySlackSignature as P, enqueueAgentDispatch as R, recordSkippedConversationMessage as S, isSlackMessageStopped as T, readViewerAutomationRuns as _, recordWebConversationActivity as a, readViewerAutomations as b, createProductionSlackWebhookServices as c, resolveSlackConversationContextFromThreadId as d, createSlackWebApiStatusSender as f, readViewerAutomationExecutions as g, readConversationSourceTask as h, createConversationId as i, startProcessingReaction as j, stopConversationTurn as k, getProductionSlackAdapter as l, deleteViewerTask as m, conversationTurnIdForMessage as n, webActorFromEmail as o, ViewerTaskNotFoundError as p, createAndEnqueueConversation as r, createProductionConversationWorkOptions as s, appendAndEnqueueWebMessage as t, formatSlackConversationRedactedLabel as u, readViewerAutomationSummary as v, clearSlackPendingReactions as w, resolveViewerTaskCandidate as x, readViewerAutomationVersions as y, GET as z };
|