@sentry/junior 0.252.0 → 0.253.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{admin-C_-XEdym.js → admin-CZnlnlg9.js} +1 -1
- package/dist/{agent-hooks-DcoKnnxn.js → agent-hooks-CvcbAtJH.js} +8 -8
- package/dist/{agent-runner-B-7S_DCS.js → agent-runner-B4FMVbCs.js} +20 -20
- package/dist/api.js +21 -21
- package/dist/app.js +111 -82
- package/dist/{assistant-reply-DbPLvsnL.js → assistant-reply-BU05IECs.js} +1 -1
- package/dist/{briefs-D4SMqc-r.js → briefs-DyspoG90.js} +2 -2
- package/dist/{catalog-runtime-BQQiwwA7.js → catalog-runtime-Br8s-TYx.js} +1 -1
- package/dist/cli/chat.js +15 -15
- 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 +3 -3
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client-ROZeVjq0.js → client-CRVXpEWi.js} +2 -2
- package/dist/{config-DNNkxfGS.js → config-B7joRWt7.js} +2 -2
- package/dist/{connections-DJV6mLrH.js → connections-CGPYNw2B.js} +9 -9
- package/dist/{conversation-privacy-B19umzIL.js → conversation-privacy-0JuTT_OJ.js} +1 -1
- package/dist/{credential-sync-CEd2F5PS.js → credential-sync-C-k3fnY5.js} +14 -14
- package/dist/{executor-_4bdoCxe.js → executor-YL577nNt.js} +32 -4
- package/dist/{images-BAN7DHuO.js → images-DopOctPc.js} +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-DSQx1qFY.js → job-queue-CIhKXUE3.js} +1 -1
- package/dist/{logging-COUsTFIL.js → logging-B0QxCh3D.js} +1 -1
- package/dist/{message-CtDDEwwV.js → message-DQvor8lM.js} +3 -3
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-CCiKrS0s.js → oauth-callback-server-BT7cSxBm.js} +2 -2
- package/dist/{pending-auth-DDx3EU4M.js → pending-auth-CwA1uLA9.js} +2 -2
- package/dist/{profile-DP4LKL6V.js → profile-p1oiViVs.js} +4 -4
- package/dist/{registry-CeEpPna6.js → registry-BO2LM2oW.js} +1 -1
- package/dist/{resolve-B5ma3igH.js → resolve-CtWKGuKE.js} +2 -2
- package/dist/{result-Da0RVuWG.js → result-DR5JTBcb.js} +6 -6
- package/dist/{runner-se1W_jGZ.js → runner-BIxTJF9a.js} +9 -9
- package/dist/{sandbox-egress-signals-CS959-wm.js → sandbox-egress-signals-DF3Pu813.js} +1 -1
- package/dist/{session-stop-DlRDisF5.js → session-stop-BRq8Vxrr.js} +10 -10
- package/dist/{skills-CSzgs0EC.js → skills-DitcC3Vw.js} +2 -2
- package/dist/{spawn-DT9fMjtd.js → spawn-CHQ42PAo.js} +2 -2
- package/dist/{store-Dx1U69mm.js → store-DIFp9K52.js} +6 -6
- package/dist/{task-queue-BX9YrIsw.js → task-queue-UAeJGLYM.js} +3 -3
- package/dist/{task-runner-CO55Olal.js → task-runner-DwD-i2ta.js} +144 -126
- package/dist/{tasks-DwGlFX9i.js → tasks-DThIG7F-.js} +15 -26
- package/dist/{thread-state-Ces6tXmB.js → thread-state-BQxkL7Xm.js} +6 -6
- package/dist/{turn-failure-response-B4VCvEQf.js → turn-failure-response-OAIxgzNh.js} +7 -7
- package/dist/{turn-lifecycle-B1VV58Yo.js → turn-lifecycle-BAEJpjDI.js} +1 -1
- package/dist/{turn-session-routing-Dw2Kamg9.js → turn-session-routing-F5s728f0.js} +1 -1
- package/dist/{validation-yJF9LKOv.js → validation-DFM4-vDr.js} +1 -1
- package/dist/{version-CZYqvIFh.js → version-B80CD9sN.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-D96vo_42.js → viewer-CPxNfHWa.js} +3 -3
- package/dist/{web-input-5mls-41-.js → web-input-DIO177R0.js} +43 -51
- package/dist/{work-D2M2-zCO.js → work-Dl5KPKjW.js} +9 -9
- package/dist/{worker-BwCpf8tB.js → worker-CJkE86Co.js} +5 -5
- package/migrations/0056_automation_runs.sql +69 -0
- package/migrations/meta/0056_snapshot.json +4280 -0
- package/migrations/meta/_journal.json +8 -1
- package/package.json +4 -4
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { A as resolveSlackChannelIdFromMessage, B as effectiveTaskOutcomes, Bt as RetryableDeliveryError, C as renderBlockText, D as storeAttachment, Gt as shouldEmitDevAgentTrace, Lt as createUserTokenStore, M as getConversationInfo, N as listThreadReplies, O as parseSlackThreadId, Rt as buildSteeringPiMessage, S as renderAttachmentText, Ut as AuthorizationFlowDisabledError, a as buildAuthPauseResponse, h as latestProgressStatus, j as resolveSlackChannelIdFromThreadId, k as readSlackRawMessageContext, m as PluginCredentialFailureError, n as executeAgentRun, r as createContextCompactor, t as createAgentRunner, z as eventAutomationTriggerAvailable, zt as withoutSavedSteeringMessages } from "./agent-runner-
|
|
2
|
-
import { f as escapeXml, i as completeText, r as completeObject, v as isProviderRetryError } from "./client-
|
|
3
|
-
import { C as withLogContext, I as isRecord, L as toOptionalNumber, R as toOptionalString, _ as setSentryUser, b as setTags, d as logException, f as logInfo, n as createChatSdkLogger, o as getActiveTraceId, p as logWarn, t as buildTurnFailureResponse, u as logError, v as setSpanAttributes, w as withSpan } from "./logging-
|
|
4
|
-
import { c as getSlackClientSecret, i as getChatConfig, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, s as getSlackClientId, v as normalizeSlackEmojiName } from "./config-
|
|
1
|
+
import { A as resolveSlackChannelIdFromMessage, B as effectiveTaskOutcomes, Bt as RetryableDeliveryError, C as renderBlockText, D as storeAttachment, Gt as shouldEmitDevAgentTrace, Lt as createUserTokenStore, M as getConversationInfo, N as listThreadReplies, O as parseSlackThreadId, Rt as buildSteeringPiMessage, S as renderAttachmentText, Ut as AuthorizationFlowDisabledError, a as buildAuthPauseResponse, h as latestProgressStatus, j as resolveSlackChannelIdFromThreadId, k as readSlackRawMessageContext, m as PluginCredentialFailureError, n as executeAgentRun, r as createContextCompactor, t as createAgentRunner, z as eventAutomationTriggerAvailable, zt as withoutSavedSteeringMessages } from "./agent-runner-B4FMVbCs.js";
|
|
2
|
+
import { f as escapeXml, i as completeText, r as completeObject, v as isProviderRetryError } from "./client-CRVXpEWi.js";
|
|
3
|
+
import { C as withLogContext, I as isRecord, L as toOptionalNumber, R as toOptionalString, _ as setSentryUser, b as setTags, d as logException, f as logInfo, n as createChatSdkLogger, o as getActiveTraceId, p as logWarn, t as buildTurnFailureResponse, u as logError, v as setSpanAttributes, w as withSpan } from "./logging-B0QxCh3D.js";
|
|
4
|
+
import { c as getSlackClientSecret, i as getChatConfig, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, s as getSlackClientId, v as normalizeSlackEmojiName } from "./config-B7joRWt7.js";
|
|
5
5
|
import { o as modelIdForProfile, r as defaultModelId } from "./model-profile-BwU8mqwD.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-BTtLaeWy.js";
|
|
7
|
-
import { M as createSlackDestination, P as requireSlackDestination, c as getConversationEventStore, d as getDb, f as getSqlExecutor, u as getConversationStore } from "./viewer-
|
|
7
|
+
import { M as createSlackDestination, P as requireSlackDestination, c as getConversationEventStore, d as getDb, f as getSqlExecutor, u as getConversationStore } from "./viewer-CPxNfHWa.js";
|
|
8
8
|
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers } from "./agent-invocations-D_YoNnAn.js";
|
|
9
|
-
import {
|
|
9
|
+
import { o as juniorAutomationRuns, s as juniorAutomations } from "./executor-YL577nNt.js";
|
|
10
10
|
import { p as instructionProvenanceFor } from "./history-9pO1Zd4Y.js";
|
|
11
|
-
import { d as credentialContextForActor } from "./registry-
|
|
12
|
-
import { $ as listTurnSummaries, $t as appendThreadContextMessages, At as loadProjection, D as sameDefinitionValue, Et as commitMessages, Gt as hydrateConversationMessages, H as removeReactionFromMessage, I as truncateStatusText, J as saveTurnCheckpoint, Jt as persistConversationMessageSummaries, Kt as persistConversationMessages, L as addReactionToMessage, Lt as recordAuthorizationCompleted, M as formatSlackLink, N as normalizeSlackReplyMarkdown, Ot as loadConversationProjection, P as normalizeSlackStatusText, Q as getTurnRecord, St as trimTrailingAssistantMessages, T as listAutomationVersions, Tt as commitAcceptedReply, V as postSlackMessage, Vt as recordSubscribedReplyRoute, X as completeTurnRecord, Y as abandonTurnRecord, Yt as resolveConversationTitle, Z as failTurnRecord, Zt as fallbackShortTitle, _ as listDeletedEventAutomationsCreatedBy, a as readScheduledAutomation, an as markConversationMessage, cn as turnHasReply, en as buildConversationContext, et as recordTurnSummary, g as getEventAutomation, i as parseScheduledAutomationRow, in as isHumanConversationMessage, j as escapeSlackMrkdwnText, l as withScheduledAutomationLock, ln as upsertConversationMessage, m as eventAutomationBelongsToUser, nn as estimateConversationContextTokens, on as normalizeConversationText, ot as buildTurnErrorResponse, p as deleteEventAutomation, q as loadTurnCheckpoint, rn as getConversationMessageSlackTs, s as saveScheduledAutomationInLock, sn as recordDeliveredAssistantMessage, tn as createConversationMemoryService, tt as persistWithRetry, w as automationDefinition, y as parseEventAutomationRow } from "./tasks-
|
|
13
|
-
import { Et as getSlackFileId, Gt as normalizeSlackConversationId, Ht as getSlackClient, Kt as runWithSlackInstallationToken, Lt as lookupSlackUser, Ot as readAttachmentVisionSummary, Rt as SlackActionError, Tt as buildSentryConversationUrl, V as cancelSubscriptions, Vt as getHeaderString, Wt as isDmChannel, at as getDashboardConversationLink, it as JUNIOR_THREAD_STATE_TTL_MS, kt as recordSlackAttachment, o as getPluginSlackConversationLink, ot as getDashboardObjectIconLink, rt as verifyTimerWatchCredentialSubject, zt as downloadPrivateSlackFile } from "./agent-hooks-
|
|
11
|
+
import { d as credentialContextForActor } from "./registry-BO2LM2oW.js";
|
|
12
|
+
import { $ as listTurnSummaries, $t as appendThreadContextMessages, At as loadProjection, D as sameDefinitionValue, Et as commitMessages, Gt as hydrateConversationMessages, H as removeReactionFromMessage, I as truncateStatusText, J as saveTurnCheckpoint, Jt as persistConversationMessageSummaries, Kt as persistConversationMessages, L as addReactionToMessage, Lt as recordAuthorizationCompleted, M as formatSlackLink, N as normalizeSlackReplyMarkdown, Ot as loadConversationProjection, P as normalizeSlackStatusText, Q as getTurnRecord, St as trimTrailingAssistantMessages, T as listAutomationVersions, Tt as commitAcceptedReply, V as postSlackMessage, Vt as recordSubscribedReplyRoute, X as completeTurnRecord, Y as abandonTurnRecord, Yt as resolveConversationTitle, Z as failTurnRecord, Zt as fallbackShortTitle, _ as listDeletedEventAutomationsCreatedBy, a as readScheduledAutomation, an as markConversationMessage, cn as turnHasReply, en as buildConversationContext, et as recordTurnSummary, g as getEventAutomation, i as parseScheduledAutomationRow, in as isHumanConversationMessage, j as escapeSlackMrkdwnText, l as withScheduledAutomationLock, ln as upsertConversationMessage, m as eventAutomationBelongsToUser, nn as estimateConversationContextTokens, on as normalizeConversationText, ot as buildTurnErrorResponse, p as deleteEventAutomation, q as loadTurnCheckpoint, rn as getConversationMessageSlackTs, s as saveScheduledAutomationInLock, sn as recordDeliveredAssistantMessage, tn as createConversationMemoryService, tt as persistWithRetry, w as automationDefinition, y as parseEventAutomationRow } from "./tasks-DThIG7F-.js";
|
|
13
|
+
import { Et as getSlackFileId, Gt as normalizeSlackConversationId, Ht as getSlackClient, Kt as runWithSlackInstallationToken, Lt as lookupSlackUser, Ot as readAttachmentVisionSummary, Rt as SlackActionError, Tt as buildSentryConversationUrl, V as cancelSubscriptions, Vt as getHeaderString, Wt as isDmChannel, at as getDashboardConversationLink, it as JUNIOR_THREAD_STATE_TTL_MS, kt as recordSlackAttachment, o as getPluginSlackConversationLink, ot as getDashboardObjectIconLink, rt as verifyTimerWatchCredentialSubject, zt as downloadPrivateSlackFile } from "./agent-hooks-CvcbAtJH.js";
|
|
14
14
|
import { F as readMessageAttachments, R as isVisionImageMediaType } from "./conversation-T18Xlkx9.js";
|
|
15
|
-
import { E as acquireActiveLock, O as withLock, T as MUTATION_LOCK_TTL_MS, w as getStateAdapter } from "./profile-
|
|
16
|
-
import { a as wasPendingAuthStopped, c as getThreadStopDecision, l as buildDeterministicAssistantMessageId, o as decideSubscribedThreadReply, r as clearPendingAuth, s as getSubscribedReplyPreflightDecision, u as buildDeterministicTurnId } from "./pending-auth-
|
|
15
|
+
import { E as acquireActiveLock, O as withLock, T as MUTATION_LOCK_TTL_MS, w as getStateAdapter } from "./profile-p1oiViVs.js";
|
|
16
|
+
import { a as wasPendingAuthStopped, c as getThreadStopDecision, l as buildDeterministicAssistantMessageId, o as decideSubscribedThreadReply, r as clearPendingAuth, s as getSubscribedReplyPreflightDecision, u as buildDeterministicTurnId } from "./pending-auth-CwA1uLA9.js";
|
|
17
17
|
import { a as TurnInputDeferredError, c as isTurnInputCommitLostError, d as markTurnCompleted, f as markTurnFailed, i as TurnInputCommitLostError, l as isTurnInputDeferredError, n as ConversationTurnBoundaryError, o as getConversationTurnBoundaryError, p as startActiveTurn, r as CooperativeTurnYieldError, s as isCooperativeTurnYieldError, u as markTurnClosed } from "./oauth-authorization-BA4Dt6a7.js";
|
|
18
|
-
import { n as getAssistantReplyText } from "./assistant-reply-
|
|
19
|
-
import { A as recordFinishedTurnForAutomatedLimit, F as finishedRunReply, P as deliversFinalText, R as runDispatchOutcome, c as timerWatchCredentialSubject, i as skipInputBeforeConversationStop, k as maybePostAutomatedTurnLimitNotice, l as getEventCatalog, s as isEventMailboxMetadata, v as automationEventCatalog } from "./session-stop-
|
|
18
|
+
import { n as getAssistantReplyText } from "./assistant-reply-BU05IECs.js";
|
|
19
|
+
import { A as recordFinishedTurnForAutomatedLimit, F as finishedRunReply, P as deliversFinalText, R as runDispatchOutcome, c as timerWatchCredentialSubject, i as skipInputBeforeConversationStop, k as maybePostAutomatedTurnLimitNotice, l as getEventCatalog, s as isEventMailboxMetadata, v as automationEventCatalog } from "./session-stop-BRq8Vxrr.js";
|
|
20
20
|
import { a as EVENT_SYSTEM_ACTOR, o as isEventConversationMessage } from "./prompt-C04mP1hu.js";
|
|
21
|
-
import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline } from "./job-queue-
|
|
22
|
-
import { E as stopConversationWork, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, n as appendAndEnqueueExclusiveInboundMessage, r as appendAndEnqueueInboundMessage, w as requestConversationWork } from "./store-
|
|
21
|
+
import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline } from "./job-queue-CIhKXUE3.js";
|
|
22
|
+
import { E as stopConversationWork, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, n as appendAndEnqueueExclusiveInboundMessage, r as appendAndEnqueueInboundMessage, w as requestConversationWork } from "./store-DIFp9K52.js";
|
|
23
23
|
import { l as automationListQuerySchema } from "./automation-gznOMaQ2.js";
|
|
24
24
|
import { r as isExperimentalFeatureEnabled } from "./experimental-Qn9rKLgx.js";
|
|
25
25
|
import { c as sumUtcHoursIntoSixHours, m as healthReportSchema, t as webMessageId } from "./web-message-id-xPI_EFSC.js";
|
|
26
|
-
import {
|
|
27
|
-
import { a as withAgentInvocationResultActors, c as resolveMailboxTurnWork, f as joinMailboxText, i as startAgentInvocationsForChildInput, l as sourceFromTurnInput, o as getAuthPausedConversationTurnId, s as getEventBatchDelayMs, t as enqueueAgentInvocationResult, u as turnInputFactsFromConversationMessage } from "./result-
|
|
28
|
-
import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-
|
|
29
|
-
import { i as resolveAgentInvocationId, o as AgentRunError, s as executeTurn, t as createAgentInvocationWorker } from "./work-
|
|
30
|
-
import { a as persistThreadState, c as configValueSchema, i as persistThreadRuntimeState, n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState, t as getLocationConfigurationService } from "./thread-state-
|
|
31
|
-
import { c as deleteWebAuthorization, d as getPausedTurnRequest, m as getTurnAuthorization, p as wakePausedTurn, s as createWebAuthorization, u as createPausedTurns } from "./connections-
|
|
32
|
-
import { n as resolveTurnSessionRouting } from "./turn-session-routing-
|
|
33
|
-
import { t as bindMessageAgent } from "./message-
|
|
34
|
-
import { t as bindSpawnAgent } from "./spawn-
|
|
35
|
-
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-
|
|
36
|
-
import { r as storeInputImages } from "./images-
|
|
26
|
+
import { A as readAutomationRuns, C as readAutomationExecutionByConversationId, D as readAutomationExecutionStatusHours, E as readAutomationExecutionStatusDays, O as readAutomationExecutionSummaries, T as readAutomationExecutionHours, _ as markDispatchCompleted, a as confirmDispatchMailboxAppend, c as getDispatchIdForConversation, d as getDispatchTurnId, g as markDispatchBlocked, h as markDispatchAwaitingResume, i as claimDispatchMailboxAppend, k as readAutomationExecutions, l as getDispatchInputMessageId, n as scheduleSessionCompletedPluginTasks, p as isTerminalDispatchStatus, s as getDispatchConversationId, t as processPluginTask, u as getDispatchRecord, v as markDispatchFailed, w as readAutomationExecutionDays, x as emptyAutomationRunWindows, y as markDispatchRunning } from "./task-runner-DwD-i2ta.js";
|
|
27
|
+
import { a as withAgentInvocationResultActors, c as resolveMailboxTurnWork, f as joinMailboxText, i as startAgentInvocationsForChildInput, l as sourceFromTurnInput, o as getAuthPausedConversationTurnId, s as getEventBatchDelayMs, t as enqueueAgentInvocationResult, u as turnInputFactsFromConversationMessage } from "./result-DR5JTBcb.js";
|
|
28
|
+
import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-BAEJpjDI.js";
|
|
29
|
+
import { i as resolveAgentInvocationId, o as AgentRunError, s as executeTurn, t as createAgentInvocationWorker } from "./work-Dl5KPKjW.js";
|
|
30
|
+
import { a as persistThreadState, c as configValueSchema, i as persistThreadRuntimeState, n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState, t as getLocationConfigurationService } from "./thread-state-BQxkL7Xm.js";
|
|
31
|
+
import { c as deleteWebAuthorization, d as getPausedTurnRequest, m as getTurnAuthorization, p as wakePausedTurn, s as createWebAuthorization, u as createPausedTurns } from "./connections-CGPYNw2B.js";
|
|
32
|
+
import { n as resolveTurnSessionRouting } from "./turn-session-routing-F5s728f0.js";
|
|
33
|
+
import { t as bindMessageAgent } from "./message-DQvor8lM.js";
|
|
34
|
+
import { t as bindSpawnAgent } from "./spawn-CHQ42PAo.js";
|
|
35
|
+
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-OAIxgzNh.js";
|
|
36
|
+
import { r as storeInputImages } from "./images-DopOctPc.js";
|
|
37
37
|
import { z } from "zod";
|
|
38
38
|
import { createHash } from "node:crypto";
|
|
39
39
|
import { and, asc, count, desc, eq, exists, inArray, ne, or, sql } from "drizzle-orm";
|
|
@@ -2750,10 +2750,10 @@ function viewerAutomationCollection(user) {
|
|
|
2750
2750
|
const events = registration.resourceTypes.flatMap((resource) => resource.supportedEvents);
|
|
2751
2751
|
return and(eq(automation.namespace, namespace), sql`${automation.record}->'trigger'->'events' <@ ${JSON.stringify(events)}::jsonb`);
|
|
2752
2752
|
})) ?? sql`false`;
|
|
2753
|
-
const
|
|
2754
|
-
const lastRunNeedsAttention = sql`coalesce((select ${
|
|
2755
|
-
where ${
|
|
2756
|
-
order by ${
|
|
2753
|
+
const runs = juniorAutomationRuns;
|
|
2754
|
+
const lastRunNeedsAttention = sql`coalesce((select ${runs.status} in ('failed', 'blocked') from ${runs}
|
|
2755
|
+
where ${runs.automationId} = ${automation.id} and ${runs.status} in ('blocked', 'completed', 'failed') and ${runs.completedAtMs} is not null
|
|
2756
|
+
order by ${runs.completedAtMs} desc, ${runs.id} desc limit 1), false)`;
|
|
2757
2757
|
return db.select({
|
|
2758
2758
|
kind: automation.kind,
|
|
2759
2759
|
id: automation.id,
|
|
@@ -3011,7 +3011,7 @@ async function automationSummaryForCandidate(candidate) {
|
|
|
3011
3011
|
const [destinations, creators, stats] = await Promise.all([
|
|
3012
3012
|
destinationDetails([candidate.task.destination]),
|
|
3013
3013
|
creatorProfiles([candidate]),
|
|
3014
|
-
readAutomationExecutionSummaries(
|
|
3014
|
+
readAutomationExecutionSummaries([candidate.task.id])
|
|
3015
3015
|
]);
|
|
3016
3016
|
const destination = destinations.get(destinationKey(candidate.task.destination)) ?? {
|
|
3017
3017
|
label: `Channel ${candidate.task.destination.channelId}`,
|
|
@@ -3083,12 +3083,11 @@ async function readViewerAutomations(user, input = automationListQuerySchema.par
|
|
|
3083
3083
|
const [destinations, creators] = await Promise.all([destinationDetails(selected.map(({ task }) => task.destination)), creatorProfiles(selected)]);
|
|
3084
3084
|
const visible = selected.filter((candidate) => candidate.ownedByViewer || destinations.get(destinationKey(candidate.task.destination))?.visibility === "public");
|
|
3085
3085
|
const collection = viewerAutomationCollection(user);
|
|
3086
|
-
const access = exists(getDb().select({ id: collection.id }).from(collection).where(
|
|
3087
|
-
const [executionDays, executionHours,
|
|
3086
|
+
const access = exists(getDb().select({ id: collection.id }).from(collection).where(eq(collection.id, juniorAutomationRuns.automationId)));
|
|
3087
|
+
const [executionDays, executionHours, stats] = await Promise.all([
|
|
3088
3088
|
readAutomationExecutionDays(90, { access }),
|
|
3089
3089
|
readAutomationExecutionHours(168, { access }),
|
|
3090
|
-
readAutomationExecutionSummaries(
|
|
3091
|
-
readAutomationExecutionSummaries("event", "junior", { automationIds: ids })
|
|
3090
|
+
readAutomationExecutionSummaries(ids)
|
|
3092
3091
|
]);
|
|
3093
3092
|
const automations = visible.map((candidate) => {
|
|
3094
3093
|
const destination = destinations.get(destinationKey(candidate.task.destination)) ?? {
|
|
@@ -3096,8 +3095,8 @@ async function readViewerAutomations(user, input = automationListQuerySchema.par
|
|
|
3096
3095
|
visibility: "private"
|
|
3097
3096
|
};
|
|
3098
3097
|
const creator = creators.get(creatorKey(candidate.task.destination.teamId, candidate.task.createdBy.slackUserId));
|
|
3099
|
-
if (candidate.kind === "scheduled") return scheduledAutomationSummary(candidate.task, candidate.ownedByViewer, destination,
|
|
3100
|
-
return eventAutomationSummary(candidate.task, candidate.ownedByViewer, destination,
|
|
3098
|
+
if (candidate.kind === "scheduled") return scheduledAutomationSummary(candidate.task, candidate.ownedByViewer, destination, stats.get(candidate.task.id), creator);
|
|
3099
|
+
return eventAutomationSummary(candidate.task, candidate.ownedByViewer, destination, stats.get(candidate.task.id), creator);
|
|
3101
3100
|
});
|
|
3102
3101
|
return {
|
|
3103
3102
|
executionDays,
|
|
@@ -3166,8 +3165,8 @@ async function readViewerAutomationRuns(user) {
|
|
|
3166
3165
|
}, automationTitles, automations);
|
|
3167
3166
|
}
|
|
3168
3167
|
const runs = await readAutomationRuns({
|
|
3169
|
-
|
|
3170
|
-
|
|
3168
|
+
automationIds: automations.map((automation) => automation.automationId),
|
|
3169
|
+
limit: 101
|
|
3171
3170
|
});
|
|
3172
3171
|
return {
|
|
3173
3172
|
runs: runs.slice(0, TASK_EXECUTION_LIST_LIMIT).map((run) => ({
|
|
@@ -3190,18 +3189,11 @@ async function readViewerAutomationExecutions(user, kind, id) {
|
|
|
3190
3189
|
const [automation, executions, executionDays, executionHours] = await Promise.all([
|
|
3191
3190
|
automationSummaryForCandidate(candidate),
|
|
3192
3191
|
readAutomationExecutions({
|
|
3193
|
-
|
|
3194
|
-
limit: 101
|
|
3195
|
-
automationId: id
|
|
3192
|
+
automationId: id,
|
|
3193
|
+
limit: 101
|
|
3196
3194
|
}),
|
|
3197
|
-
readAutomationExecutionStatusDays({
|
|
3198
|
-
|
|
3199
|
-
automationId: id
|
|
3200
|
-
}),
|
|
3201
|
-
readAutomationExecutionStatusHours({
|
|
3202
|
-
kind,
|
|
3203
|
-
automationId: id
|
|
3204
|
-
})
|
|
3195
|
+
readAutomationExecutionStatusDays({ automationId: id }),
|
|
3196
|
+
readAutomationExecutionStatusHours({ automationId: id })
|
|
3205
3197
|
]);
|
|
3206
3198
|
return {
|
|
3207
3199
|
executionDays,
|
|
@@ -3245,7 +3237,7 @@ async function readRunCredential(dispatchId, creator) {
|
|
|
3245
3237
|
credentialUser: subject.userId === creator.slackUserId ? creatorLabel(creator) : subject.userId
|
|
3246
3238
|
};
|
|
3247
3239
|
}
|
|
3248
|
-
/** Resolve the source task for one conversation when
|
|
3240
|
+
/** Resolve the source task for one conversation when an Automation run links it. */
|
|
3249
3241
|
async function readConversationSourceTask(args) {
|
|
3250
3242
|
const execution = await readAutomationExecutionByConversationId({ conversationId: args.conversationId });
|
|
3251
3243
|
if (!execution) return void 0;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import { $ as getAgentInvocation, G as recordSubagentStarted, H as stopChildAgentsOf, J as createAgentInvocation, Q as getActiveAgentInvocationForConversation, Rt as buildSteeringPiMessage, Ut as AuthorizationFlowDisabledError, W as recordSubagentEnded, Wt as readBlockedReport, at as getAgentInvocationTurnId, ct as isTerminalAgentInvocation, dt as markAgentInvocationMailboxAppended, gt as reportReplacedAgentInvocation, ht as markAgentInvocationSteered, m as PluginCredentialFailureError, mt as markAgentInvocationRunning, pt as markAgentInvocationPaused, q as completeAgentInvocation, rt as getAgentInvocationMessageId, st as getLatestAgentInvocationForConversation, zt as withoutSavedSteeringMessages } from "./agent-runner-
|
|
3
|
-
import { n as botConfig } from "./config-
|
|
4
|
-
import { c as getConversationEventStore, u as getConversationStore } from "./viewer-
|
|
2
|
+
import { $ as getAgentInvocation, G as recordSubagentStarted, H as stopChildAgentsOf, J as createAgentInvocation, Q as getActiveAgentInvocationForConversation, Rt as buildSteeringPiMessage, Ut as AuthorizationFlowDisabledError, W as recordSubagentEnded, Wt as readBlockedReport, at as getAgentInvocationTurnId, ct as isTerminalAgentInvocation, dt as markAgentInvocationMailboxAppended, gt as reportReplacedAgentInvocation, ht as markAgentInvocationSteered, m as PluginCredentialFailureError, mt as markAgentInvocationRunning, pt as markAgentInvocationPaused, q as completeAgentInvocation, rt as getAgentInvocationMessageId, st as getLatestAgentInvocationForConversation, zt as withoutSavedSteeringMessages } from "./agent-runner-B4FMVbCs.js";
|
|
3
|
+
import { n as botConfig } from "./config-B7joRWt7.js";
|
|
4
|
+
import { c as getConversationEventStore, u as getConversationStore } from "./viewer-CPxNfHWa.js";
|
|
5
5
|
import { m as sameActorIdentity, u as agentInstructionProvenance } from "./history-9pO1Zd4Y.js";
|
|
6
|
-
import { J as saveTurnCheckpoint, Nt as openConversationProjection, Q as getTurnRecord, Y as abandonTurnRecord, Z as failTurnRecord, ct as isTurnExecutionLimitExceededError, dt as getTerminalAssistantMessages } from "./tasks-
|
|
6
|
+
import { J as saveTurnCheckpoint, Nt as openConversationProjection, Q as getTurnRecord, Y as abandonTurnRecord, Z as failTurnRecord, ct as isTurnExecutionLimitExceededError, dt as getTerminalAssistantMessages } from "./tasks-DThIG7F-.js";
|
|
7
7
|
import { c as isTurnInputCommitLostError, i as TurnInputCommitLostError, o as getConversationTurnBoundaryError } from "./oauth-authorization-BA4Dt6a7.js";
|
|
8
|
-
import { n as getAssistantReplyText } from "./assistant-reply-
|
|
9
|
-
import { A as recordFinishedTurnForAutomatedLimit, j as resetAutomatedTurnLimit, k as maybePostAutomatedTurnLimitNotice } from "./session-stop-
|
|
10
|
-
import { r as appendAndEnqueueInboundMessage } from "./store-
|
|
11
|
-
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-
|
|
12
|
-
import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState } from "./thread-state-
|
|
8
|
+
import { n as getAssistantReplyText } from "./assistant-reply-BU05IECs.js";
|
|
9
|
+
import { A as recordFinishedTurnForAutomatedLimit, j as resetAutomatedTurnLimit, k as maybePostAutomatedTurnLimitNotice } from "./session-stop-BRq8Vxrr.js";
|
|
10
|
+
import { r as appendAndEnqueueInboundMessage } from "./store-DIFp9K52.js";
|
|
11
|
+
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-BAEJpjDI.js";
|
|
12
|
+
import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState } from "./thread-state-BQxkL7Xm.js";
|
|
13
13
|
import { isDeepStrictEqual } from "node:util";
|
|
14
14
|
import { z } from "zod";
|
|
15
15
|
//#region src/chat/runtime/turn-execution.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import { v as isProviderRetryError } from "./client-
|
|
3
|
-
import { C as withLogContext, d as logException, f as logInfo, p as logWarn } from "./logging-
|
|
4
|
-
import { i as getChatConfig } from "./config-
|
|
5
|
-
import { f as getTurnRequestDeadline, m as ConversationQueueMessageRejectedError } from "./job-queue-
|
|
6
|
-
import { C as requestAnotherSlice, M as isInvalidConversationRecordError, T as startConversationWork, b as recordConversationRetry, d as countPendingConversationMessages, f as deadLetterAttempt, g as getConversationWorkState, i as beginConversationResume, j as isFinalAttempt, k as hasConversationStop, l as completeConversationStop, m as ensureConversationWake, o as checkInConversationWork, p as drainConversationMailbox, s as clearConsumedConversationWake, t as ackMessages, u as completeConversationWork, x as releaseConversationWork, y as recordAttemptFailure } from "./store-
|
|
2
|
+
import { v as isProviderRetryError } from "./client-CRVXpEWi.js";
|
|
3
|
+
import { C as withLogContext, d as logException, f as logInfo, p as logWarn } from "./logging-B0QxCh3D.js";
|
|
4
|
+
import { i as getChatConfig } from "./config-B7joRWt7.js";
|
|
5
|
+
import { f as getTurnRequestDeadline, m as ConversationQueueMessageRejectedError } from "./job-queue-CIhKXUE3.js";
|
|
6
|
+
import { C as requestAnotherSlice, M as isInvalidConversationRecordError, T as startConversationWork, b as recordConversationRetry, d as countPendingConversationMessages, f as deadLetterAttempt, g as getConversationWorkState, i as beginConversationResume, j as isFinalAttempt, k as hasConversationStop, l as completeConversationStop, m as ensureConversationWake, o as checkInConversationWork, p as drainConversationMailbox, s as clearConsumedConversationWake, t as ackMessages, u as completeConversationWork, x as releaseConversationWork, y as recordAttemptFailure } from "./store-DIFp9K52.js";
|
|
7
7
|
//#region src/chat/task-execution/worker.ts
|
|
8
8
|
var worker_exports = /* @__PURE__ */ __exportAll({
|
|
9
9
|
CONVERSATION_WORK_DEFER_DELAY_MS: () => CONVERSATION_WORK_DEFER_DELAY_MS,
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
CREATE TABLE "junior_automation_runs" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"automation_id" text NOT NULL,
|
|
4
|
+
"conversation_id" text,
|
|
5
|
+
"status" text NOT NULL,
|
|
6
|
+
"scheduled_for_ms" bigint,
|
|
7
|
+
"attempt" integer,
|
|
8
|
+
"claimed_at_ms" bigint,
|
|
9
|
+
"dispatch_id" text,
|
|
10
|
+
"started_at_ms" bigint,
|
|
11
|
+
"completed_at_ms" bigint,
|
|
12
|
+
"error_message" text,
|
|
13
|
+
"result_message_ts" text,
|
|
14
|
+
CONSTRAINT "junior_automation_runs_conversation_id_unique" UNIQUE("conversation_id"),
|
|
15
|
+
CONSTRAINT "junior_automation_runs_status_check" CHECK ("junior_automation_runs"."status" in ('pending', 'running', 'completed', 'failed', 'blocked', 'skipped'))
|
|
16
|
+
);
|
|
17
|
+
--> statement-breakpoint
|
|
18
|
+
ALTER TABLE "junior_automation_runs" ADD CONSTRAINT "junior_automation_runs_automation_id_junior_automations_id_fk" FOREIGN KEY ("automation_id") REFERENCES "public"."junior_automations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
19
|
+
ALTER TABLE "junior_automation_runs" ADD CONSTRAINT "junior_automation_runs_conversation_id_junior_conversations_conversation_id_fk" FOREIGN KEY ("conversation_id") REFERENCES "public"."junior_conversations"("conversation_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
20
|
+
CREATE INDEX "junior_automation_runs_automation_idx" ON "junior_automation_runs" USING btree ("automation_id","completed_at_ms");--> statement-breakpoint
|
|
21
|
+
CREATE INDEX "junior_automation_runs_completed_idx" ON "junior_automation_runs" USING btree ("completed_at_ms");--> statement-breakpoint
|
|
22
|
+
CREATE INDEX "junior_automation_runs_incomplete_idx" ON "junior_automation_runs" USING btree ("automation_id","scheduled_for_ms") WHERE "junior_automation_runs"."status" in ('pending', 'running');--> statement-breakpoint
|
|
23
|
+
-- Copy run history from both old tables. They stay for old workers during the
|
|
24
|
+
-- deploy. Copy junior_scheduler_runs first, because its rows have the full
|
|
25
|
+
-- run state. Then copy the junior_task_executions rows that are still missing.
|
|
26
|
+
-- A run keeps its Conversation link only when that Conversation exists. A run
|
|
27
|
+
-- of an Automation that no longer exists is not copied.
|
|
28
|
+
INSERT INTO "junior_automation_runs" (
|
|
29
|
+
"id", "automation_id", "conversation_id", "status", "scheduled_for_ms",
|
|
30
|
+
"attempt", "claimed_at_ms", "dispatch_id", "started_at_ms",
|
|
31
|
+
"completed_at_ms", "error_message", "result_message_ts"
|
|
32
|
+
)
|
|
33
|
+
SELECT
|
|
34
|
+
r."id",
|
|
35
|
+
r."task_id",
|
|
36
|
+
c."conversation_id",
|
|
37
|
+
r."status",
|
|
38
|
+
r."scheduled_for_ms",
|
|
39
|
+
(r."record"->>'attempt')::integer,
|
|
40
|
+
(r."record"->>'claimedAtMs')::bigint,
|
|
41
|
+
r."record"->>'dispatchId',
|
|
42
|
+
(r."record"->>'startedAtMs')::bigint,
|
|
43
|
+
(r."record"->>'completedAtMs')::bigint,
|
|
44
|
+
r."record"->>'errorMessage',
|
|
45
|
+
r."record"->>'resultMessageTs'
|
|
46
|
+
FROM "junior_scheduler_runs" r
|
|
47
|
+
JOIN "junior_automations" a ON a."id" = r."task_id" AND a."kind" = 'scheduled'
|
|
48
|
+
LEFT JOIN "junior_conversations" c
|
|
49
|
+
ON c."conversation_id" = 'agent-dispatch:' || (r."record"->>'dispatchId')
|
|
50
|
+
WHERE r."status" IN ('pending', 'running', 'completed', 'failed', 'blocked', 'skipped')
|
|
51
|
+
ON CONFLICT DO NOTHING;
|
|
52
|
+
--> statement-breakpoint
|
|
53
|
+
-- An event run id is its dispatch id, so its Conversation id follows from it.
|
|
54
|
+
INSERT INTO "junior_automation_runs" (
|
|
55
|
+
"id", "automation_id", "conversation_id", "status", "completed_at_ms"
|
|
56
|
+
)
|
|
57
|
+
SELECT
|
|
58
|
+
e."execution_id",
|
|
59
|
+
e."task_id",
|
|
60
|
+
coalesce(e."conversation_id", c."conversation_id"),
|
|
61
|
+
e."status",
|
|
62
|
+
e."executed_at_ms"
|
|
63
|
+
FROM "junior_task_executions" e
|
|
64
|
+
JOIN "junior_automations" a ON a."id" = e."task_id" AND a."kind" = e."kind"
|
|
65
|
+
LEFT JOIN "junior_conversations" c
|
|
66
|
+
ON e."kind" = 'event'
|
|
67
|
+
AND c."conversation_id" = 'agent-dispatch:' || e."execution_id"
|
|
68
|
+
WHERE e."namespace" = 'junior'
|
|
69
|
+
ON CONFLICT DO NOTHING;
|