@sentry/junior 0.252.0 → 0.254.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-D7kYbu5l.js} +1 -1
- package/dist/{agent-hooks-DcoKnnxn.js → agent-hooks-DfPubHYm.js} +9 -9
- package/dist/{agent-invocations-D_YoNnAn.js → agent-invocations-BY60iNw-.js} +0 -4
- package/dist/{agent-runner-B-7S_DCS.js → agent-runner-BWmnJ0dD.js} +21 -21
- package/dist/api/schema.js +1 -1
- package/dist/api.js +23 -23
- package/dist/app.js +113 -83
- package/dist/{assistant-reply-DbPLvsnL.js → assistant-reply-B3J6ogAM.js} +1 -1
- package/dist/{briefs-D4SMqc-r.js → briefs-B_fgUFD2.js} +2 -2
- package/dist/{catalog-runtime-BQQiwwA7.js → catalog-runtime-TG5WF66H.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-oBgOmQV6.js} +2 -2
- package/dist/{config-DNNkxfGS.js → config-CRlLncIj.js} +2 -2
- package/dist/{connections-DJV6mLrH.js → connections-BZAuDnYm.js} +9 -9
- package/dist/{conversation-privacy-B19umzIL.js → conversation-privacy-Dui3hTO-.js} +1 -1
- package/dist/{credential-sync-CEd2F5PS.js → credential-sync-9HiSpphh.js} +14 -14
- package/dist/{executor-_4bdoCxe.js → executor-B88oEqok.js} +41 -92
- package/dist/{images-BAN7DHuO.js → images-k8HewSp_.js} +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-DSQx1qFY.js → job-queue-B6KaQXY6.js} +1 -1
- package/dist/{logging-COUsTFIL.js → logging-B3nJLXT7.js} +1 -1
- package/dist/{message-CtDDEwwV.js → message-C9Wx3Rxx.js} +3 -3
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-CCiKrS0s.js → oauth-callback-server-CetsCZng.js} +2 -2
- package/dist/{pending-auth-DDx3EU4M.js → pending-auth-m8aJlwP_.js} +2 -2
- package/dist/{profile-DP4LKL6V.js → profile-Dh73O6lZ.js} +4 -4
- package/dist/{registry-CeEpPna6.js → registry-C-jns0Be.js} +1 -1
- package/dist/{resolve-B5ma3igH.js → resolve-CDYCpS_U.js} +2 -2
- package/dist/{result-Da0RVuWG.js → result-sih-x_yN.js} +6 -6
- package/dist/{runner-se1W_jGZ.js → runner-CA43p74t.js} +9 -9
- package/dist/{sandbox-egress-signals-CS959-wm.js → sandbox-egress-signals-CxHHTu8e.js} +1 -1
- package/dist/{schema-C9Vnyb_f.js → schema-C-a9U34c.js} +1 -1
- package/dist/{session-stop-DlRDisF5.js → session-stop-DenN1GuJ.js} +11 -11
- package/dist/{skills-CSzgs0EC.js → skills-D_XDFkSx.js} +2 -2
- package/dist/{spawn-DT9fMjtd.js → spawn-CcWYt3Tl.js} +2 -2
- package/dist/{store-Dx1U69mm.js → store-CIs0Tr31.js} +6 -6
- package/dist/{task-queue-BX9YrIsw.js → task-queue-DAY-aQLX.js} +3 -3
- package/dist/{task-runner-CO55Olal.js → task-runner-BE6Jgt2u.js} +145 -127
- package/dist/{tasks-DwGlFX9i.js → tasks-DO9VM9cu.js} +15 -26
- package/dist/{thread-state-Ces6tXmB.js → thread-state-FreaCOZD.js} +7 -7
- package/dist/{turn-failure-response-B4VCvEQf.js → turn-failure-response-CJSt2ZSf.js} +7 -7
- package/dist/{turn-lifecycle-B1VV58Yo.js → turn-lifecycle-BXclEcfZ.js} +1 -1
- package/dist/{turn-session-routing-Dw2Kamg9.js → turn-session-routing-CItfUsjQ.js} +1 -1
- package/dist/{validation-yJF9LKOv.js → validation-MW8dmhF9.js} +1 -1
- package/dist/{version-CZYqvIFh.js → version-DcWD8xpq.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-D96vo_42.js → viewer-CGZiUVMU.js} +4 -13
- package/dist/{web-input-5mls-41-.js → web-input-Dpqh0oBt.js} +44 -52
- package/dist/{work-D2M2-zCO.js → work-DbA9xNO1.js} +9 -9
- package/dist/{worker-BwCpf8tB.js → worker-DuCs9-3G.js} +5 -5
- package/migrations/0056_automation_runs.sql +69 -0
- package/migrations/0057_drop_legacy_automation_tables.sql +10 -0
- package/migrations/meta/0056_snapshot.json +4280 -0
- package/migrations/meta/0057_snapshot.json +3618 -0
- package/migrations/meta/_journal.json +15 -1
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as getConversationEventStore } from "./viewer-
|
|
1
|
+
import { c as getConversationEventStore } from "./viewer-CGZiUVMU.js";
|
|
2
2
|
//#region src/chat/conversations/turn-lifecycle.ts
|
|
3
3
|
/** Persist correlated turn lifecycle facts with retry-safe terminal exclusion. */
|
|
4
4
|
var ConversationTurnLifecycleService = class {
|
|
@@ -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-CGZiUVMU.js").then((n) => n.s)).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-B4FMCO8f.js";
|
|
2
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
2
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-TG5WF66H.js";
|
|
3
3
|
import { isDeepStrictEqual } from "node:util";
|
|
4
4
|
//#region src/chat/plugins/validation.ts
|
|
5
5
|
var validation_exports = /* @__PURE__ */ __exportAll({
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
1
|
+
import { t as JUNIOR_VERSION } from "./version-DcWD8xpq.js";
|
|
2
2
|
export { JUNIOR_VERSION };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import { F as normalizeIdentityEmail } from "./logging-
|
|
3
|
-
import { i as getChatConfig } from "./config-
|
|
2
|
+
import { F as normalizeIdentityEmail } from "./logging-B3nJLXT7.js";
|
|
3
|
+
import { i as getChatConfig } from "./config-CRlLncIj.js";
|
|
4
4
|
import { d as parseSlackTeamId, o as parseActorUserId, u as parseSlackChannelReferenceId } from "./actor-BTtLaeWy.js";
|
|
5
|
-
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-
|
|
6
|
-
import {
|
|
5
|
+
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-BY60iNw-.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-B88oEqok.js";
|
|
7
7
|
import { c as newConversationEventSchema, h as usageSchema, l as encodeHistoryPayload, o as decodeStoredConversationEvent, r as conversationEventDataSchema, s as historyReplacementSchema } from "./history-9pO1Zd4Y.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";
|
|
@@ -595,9 +595,6 @@ function tenantId(value) {
|
|
|
595
595
|
function sourceFromValue(value) {
|
|
596
596
|
if (value === "api" || value === "internal" || value === "local" || value === "plugin" || value === "event" || value === "scheduler" || value === "slack" || value === "web") return value;
|
|
597
597
|
}
|
|
598
|
-
function originTypeFromSource(source) {
|
|
599
|
-
return source;
|
|
600
|
-
}
|
|
601
598
|
function localWorkspaceFromConversationId(conversationId) {
|
|
602
599
|
return /^local:([^:]+):/.exec(conversationId)?.[1];
|
|
603
600
|
}
|
|
@@ -903,9 +900,6 @@ var SqlStore = class {
|
|
|
903
900
|
schemaVersion: 1,
|
|
904
901
|
source: conversation.source ?? null,
|
|
905
902
|
sessionSource: conversation.sessionSource ?? null,
|
|
906
|
-
originType: originTypeFromSource(conversation.source) ?? null,
|
|
907
|
-
originId: null,
|
|
908
|
-
originRunId: null,
|
|
909
903
|
location: location ?? null,
|
|
910
904
|
destinationId: destinationId ?? null,
|
|
911
905
|
destination: null,
|
|
@@ -930,9 +924,6 @@ var SqlStore = class {
|
|
|
930
924
|
set: {
|
|
931
925
|
source: sql`coalesce(${juniorConversations.source}, excluded.source)`,
|
|
932
926
|
sessionSource: sql`coalesce(${juniorConversations.sessionSource}, excluded.source_json)`,
|
|
933
|
-
originType: sql`coalesce(excluded.origin_type, ${juniorConversations.originType})`,
|
|
934
|
-
originId: sql`coalesce(excluded.origin_id, ${juniorConversations.originId})`,
|
|
935
|
-
originRunId: sql`coalesce(excluded.origin_run_id, ${juniorConversations.originRunId})`,
|
|
936
927
|
location: sql`coalesce(excluded.location_json, ${juniorConversations.location})`,
|
|
937
928
|
destinationId: sql`coalesce(excluded.destination_id, ${juniorConversations.destinationId})`,
|
|
938
929
|
actorIdentityId: sql`coalesce(excluded.actor_identity_id, ${juniorConversations.actorIdentityId})`,
|
|
@@ -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-BWmnJ0dD.js";
|
|
2
|
+
import { f as escapeXml, i as completeText, r as completeObject, v as isProviderRetryError } from "./client-oBgOmQV6.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-B3nJLXT7.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-CRlLncIj.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-
|
|
8
|
-
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers } from "./agent-invocations-
|
|
9
|
-
import {
|
|
7
|
+
import { M as createSlackDestination, P as requireSlackDestination, c as getConversationEventStore, d as getDb, f as getSqlExecutor, u as getConversationStore } from "./viewer-CGZiUVMU.js";
|
|
8
|
+
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers } from "./agent-invocations-BY60iNw-.js";
|
|
9
|
+
import { o as juniorAutomationRuns, s as juniorAutomations } from "./executor-B88oEqok.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-C-jns0Be.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-DO9VM9cu.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-DfPubHYm.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-Dh73O6lZ.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-m8aJlwP_.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-B3J6ogAM.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-DenN1GuJ.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-B6KaQXY6.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-CIs0Tr31.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-BE6Jgt2u.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-sih-x_yN.js";
|
|
28
|
+
import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-BXclEcfZ.js";
|
|
29
|
+
import { i as resolveAgentInvocationId, o as AgentRunError, s as executeTurn, t as createAgentInvocationWorker } from "./work-DbA9xNO1.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-FreaCOZD.js";
|
|
31
|
+
import { c as deleteWebAuthorization, d as getPausedTurnRequest, m as getTurnAuthorization, p as wakePausedTurn, s as createWebAuthorization, u as createPausedTurns } from "./connections-BZAuDnYm.js";
|
|
32
|
+
import { n as resolveTurnSessionRouting } from "./turn-session-routing-CItfUsjQ.js";
|
|
33
|
+
import { t as bindMessageAgent } from "./message-C9Wx3Rxx.js";
|
|
34
|
+
import { t as bindSpawnAgent } from "./spawn-CcWYt3Tl.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-CJSt2ZSf.js";
|
|
36
|
+
import { r as storeInputImages } from "./images-k8HewSp_.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-BWmnJ0dD.js";
|
|
3
|
+
import { n as botConfig } from "./config-CRlLncIj.js";
|
|
4
|
+
import { c as getConversationEventStore, u as getConversationStore } from "./viewer-CGZiUVMU.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-DO9VM9cu.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-B3J6ogAM.js";
|
|
9
|
+
import { A as recordFinishedTurnForAutomatedLimit, j as resetAutomatedTurnLimit, k as maybePostAutomatedTurnLimitNotice } from "./session-stop-DenN1GuJ.js";
|
|
10
|
+
import { r as appendAndEnqueueInboundMessage } from "./store-CIs0Tr31.js";
|
|
11
|
+
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-BXclEcfZ.js";
|
|
12
|
+
import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState } from "./thread-state-FreaCOZD.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-oBgOmQV6.js";
|
|
3
|
+
import { C as withLogContext, d as logException, f as logInfo, p as logWarn } from "./logging-B3nJLXT7.js";
|
|
4
|
+
import { i as getChatConfig } from "./config-CRlLncIj.js";
|
|
5
|
+
import { f as getTurnRequestDeadline, m as ConversationQueueMessageRejectedError } from "./job-queue-B6KaQXY6.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-CIs0Tr31.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;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
DROP TABLE "junior_task_executions" CASCADE;--> statement-breakpoint
|
|
2
|
+
DROP TABLE "junior_event_tasks" CASCADE;--> statement-breakpoint
|
|
3
|
+
DROP TABLE "junior_scheduler_runs" CASCADE;--> statement-breakpoint
|
|
4
|
+
DROP TABLE "junior_scheduler_tasks" CASCADE;--> statement-breakpoint
|
|
5
|
+
-- Dropping junior_scheduler_tasks drops its trigger but not the function.
|
|
6
|
+
DROP FUNCTION IF EXISTS "junior_scheduler_assign_creator_identity"();
|
|
7
|
+
-- The snapshot no longer has junior_automation_versions.kind, the
|
|
8
|
+
-- junior_conversations origin_* columns, or junior_conversations_origin_idx.
|
|
9
|
+
-- They stay in the database for one release. Old workers still name them in
|
|
10
|
+
-- every insert while this migration runs. Migration 0058 drops them.
|