@sentry/junior 0.254.0 → 0.255.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-D7kYbu5l.js → admin-CeJh4SuR.js} +1 -1
- package/dist/{agent-hooks-DfPubHYm.js → agent-hooks-CDVx26Uu.js} +8 -8
- package/dist/{agent-runner-BWmnJ0dD.js → agent-runner-Caiof09f.js} +24 -21
- package/dist/api/schema.d.ts +0 -8
- package/dist/api/schema.js +2 -2
- package/dist/api.js +60 -70
- package/dist/app.js +36 -36
- package/dist/{assistant-reply-B3J6ogAM.js → assistant-reply-BddmM66R.js} +1 -1
- package/dist/{automation-gznOMaQ2.js → automation-CHdlHVZP.js} +3 -4
- package/dist/{briefs-B_fgUFD2.js → briefs-iVq_8-ft.js} +2 -2
- package/dist/{catalog-runtime-TG5WF66H.js → catalog-runtime-hKmI-iZa.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-oBgOmQV6.js → client-Clj7onnT.js} +2 -2
- package/dist/{config-CRlLncIj.js → config-BDAfLTI9.js} +2 -2
- package/dist/{connections-BZAuDnYm.js → connections-BC0RTejT.js} +9 -9
- package/dist/{conversation-privacy-Dui3hTO-.js → conversation-privacy-1ERtieuM.js} +1 -1
- package/dist/{credential-sync-9HiSpphh.js → credential-sync-BZuqqIHk.js} +14 -14
- package/dist/{executor-B88oEqok.js → executor-Dh4Ofsnx.js} +5 -6
- package/dist/{images-k8HewSp_.js → images-C-WOnTc_.js} +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-B6KaQXY6.js → job-queue-BaCL36FY.js} +1 -1
- package/dist/{logging-B3nJLXT7.js → logging-D3aYP0aG.js} +1 -1
- package/dist/{message-C9Wx3Rxx.js → message-B9xqD2BP.js} +3 -3
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-CetsCZng.js → oauth-callback-server-i5qdAou6.js} +2 -2
- package/dist/{pending-auth-m8aJlwP_.js → pending-auth-D2t1Moxf.js} +2 -2
- package/dist/{profile-Dh73O6lZ.js → profile-DnkX3e2S.js} +4 -4
- package/dist/{registry-C-jns0Be.js → registry-CmKmKHpp.js} +1 -1
- package/dist/{resolve-CDYCpS_U.js → resolve-jfNHtEBx.js} +2 -2
- package/dist/{result-sih-x_yN.js → result-Df5nEDX2.js} +6 -6
- package/dist/{runner-CA43p74t.js → runner-CmzoXEI4.js} +9 -9
- package/dist/{sandbox-egress-signals-CxHHTu8e.js → sandbox-egress-signals-DjMNKLZz.js} +1 -1
- package/dist/{schema-C-a9U34c.js → schema-BBgv0MNf.js} +1 -1
- package/dist/{session-stop-DenN1GuJ.js → session-stop-BEBfE97J.js} +10 -10
- package/dist/{skills-D_XDFkSx.js → skills-Dc-AMYi4.js} +2 -2
- package/dist/{spawn-CcWYt3Tl.js → spawn-OgTwBUj0.js} +2 -2
- package/dist/{store-CIs0Tr31.js → store-BashBewg.js} +6 -6
- package/dist/{task-queue-DAY-aQLX.js → task-queue-VvIKqlQ4.js} +3 -3
- package/dist/{task-runner-BE6Jgt2u.js → task-runner-D2CpD6GN.js} +10 -10
- package/dist/{tasks-DO9VM9cu.js → tasks-dJooqiip.js} +16 -26
- package/dist/{thread-state-FreaCOZD.js → thread-state-CsMC-ob0.js} +6 -6
- package/dist/{turn-failure-response-CJSt2ZSf.js → turn-failure-response-zB364t7_.js} +7 -7
- package/dist/{turn-lifecycle-BXclEcfZ.js → turn-lifecycle-BfodfmiY.js} +1 -1
- package/dist/{turn-session-routing-CItfUsjQ.js → turn-session-routing-BAh_qsBJ.js} +1 -1
- package/dist/{validation-MW8dmhF9.js → validation-LzIilOb6.js} +1 -1
- package/dist/{version-DcWD8xpq.js → version-CDM8Rq6E.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-CGZiUVMU.js → viewer-Rnim7alE.js} +3 -3
- package/dist/{web-input-Dpqh0oBt.js → web-input-Dc1VwcT4.js} +74 -75
- package/dist/{work-DbA9xNO1.js → work-BAn43SsN.js} +9 -9
- package/dist/{worker-DuCs9-3G.js → worker-mBXq4_zg.js} +5 -5
- package/migrations/0058_automation_creator_identity.sql +45 -0
- package/migrations/meta/0058_snapshot.json +3598 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +5 -5
|
@@ -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-Caiof09f.js";
|
|
2
|
+
import { f as escapeXml, i as completeText, r as completeObject, v as isProviderRetryError } from "./client-Clj7onnT.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-D3aYP0aG.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-BDAfLTI9.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-Rnim7alE.js";
|
|
8
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-
|
|
9
|
+
import { o as juniorAutomationRuns, s as juniorAutomations } from "./executor-Dh4Ofsnx.js";
|
|
10
10
|
import { p as instructionProvenanceFor } from "./history-9pO1Zd4Y.js";
|
|
11
|
-
import { d as credentialContextForActor } from "./registry-
|
|
12
|
-
import { $ as
|
|
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-CmKmKHpp.js";
|
|
12
|
+
import { $ as persistWithRetry, $t as createConversationMemoryService, A as formatSlackLink, B as removeReactionFromMessage, C as listAutomationVersions, Ct as commitAcceptedReply, Et as loadConversationProjection, F as addReactionToMessage, Ft as recordAuthorizationCompleted, G as loadTurnCheckpoint, J as completeTurnRecord, K as saveTurnCheckpoint, Kt as persistConversationMessageSummaries, M as normalizeSlackStatusText, Ot as loadProjection, P as truncateStatusText, Q as recordTurnSummary, Qt as buildConversationContext, S as automationDefinition, T as sameDefinitionValue, Ut as hydrateConversationMessages, Wt as persistConversationMessages, X as getTurnRecord, Y as failTurnRecord, Yt as fallbackShortTitle, Z as listTurnSummaries, Zt as appendThreadContextMessages, _ as parseEventAutomationRow, an as recordDeliveredAssistantMessage, bt as trimTrailingAssistantMessages, c as withScheduledAutomationLock, en as estimateConversationContextTokens, f as deleteEventAutomation, h as listDeletedEventAutomationsCreatedBy, i as readScheduledAutomation, in as normalizeConversationText, it as buildTurnErrorResponse, j as normalizeSlackReplyMarkdown, k as escapeSlackMrkdwnText, nn as isHumanConversationMessage, o as saveScheduledAutomationInLock, on as turnHasReply, q as abandonTurnRecord, qt as resolveConversationTitle, r as parseScheduledAutomationRow, rn as markConversationMessage, sn as upsertConversationMessage, tn as getConversationMessageSlackTs, wt as commitMessages, z as postSlackMessage, zt as recordSubscribedReplyRoute } from "./tasks-dJooqiip.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-CDVx26Uu.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-DnkX3e2S.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-D2t1Moxf.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-BddmM66R.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-BEBfE97J.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-
|
|
23
|
-
import { l as automationListQuerySchema } from "./automation-
|
|
21
|
+
import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline } from "./job-queue-BaCL36FY.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-BashBewg.js";
|
|
23
|
+
import { l as automationListQuerySchema } from "./automation-CHdlHVZP.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 { 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-
|
|
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-D2CpD6GN.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-Df5nEDX2.js";
|
|
28
|
+
import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-BfodfmiY.js";
|
|
29
|
+
import { i as resolveAgentInvocationId, o as AgentRunError, s as executeTurn, t as createAgentInvocationWorker } from "./work-BAn43SsN.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-CsMC-ob0.js";
|
|
31
|
+
import { c as deleteWebAuthorization, d as getPausedTurnRequest, m as getTurnAuthorization, p as wakePausedTurn, s as createWebAuthorization, u as createPausedTurns } from "./connections-BC0RTejT.js";
|
|
32
|
+
import { n as resolveTurnSessionRouting } from "./turn-session-routing-BAh_qsBJ.js";
|
|
33
|
+
import { t as bindMessageAgent } from "./message-B9xqD2BP.js";
|
|
34
|
+
import { t as bindSpawnAgent } from "./spawn-OgTwBUj0.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-zB364t7_.js";
|
|
36
|
+
import { r as storeInputImages } from "./images-C-WOnTc_.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";
|
|
@@ -2738,12 +2738,11 @@ function recordSkippedConversationMessage(args) {
|
|
|
2738
2738
|
*/
|
|
2739
2739
|
function viewerAutomationCollection(user) {
|
|
2740
2740
|
const db = getDb();
|
|
2741
|
-
const
|
|
2742
|
-
const teamIds = identities.flatMap((identity) => identity.providerTenantId ? [identity.providerTenantId] : []);
|
|
2741
|
+
const teamIds = user.identities.filter((identity) => identity.provider === "slack").flatMap((identity) => identity.providerTenantId ? [identity.providerTenantId] : []);
|
|
2743
2742
|
const automation = juniorAutomations;
|
|
2744
2743
|
const destination = juniorDestinations;
|
|
2745
2744
|
const isScheduled = eq(automation.kind, "scheduled");
|
|
2746
|
-
const owned =
|
|
2745
|
+
const owned = inArray(automation.creatorIdentityId, user.identities.map((identity) => identity.id));
|
|
2747
2746
|
const publicDestination = sql`coalesce(${destination.visibility} = 'public', false)`;
|
|
2748
2747
|
const publicToViewer = and(inArray(automation.teamId, teamIds), publicDestination, ne(automation.status, "completed"));
|
|
2749
2748
|
const available = or(isScheduled, ...Object.entries(automationEventCatalog(getEventCatalog())).map(([namespace, registration]) => {
|
|
@@ -2801,7 +2800,7 @@ async function readAutomationCollection(user, input) {
|
|
|
2801
2800
|
rows: await db.select({
|
|
2802
2801
|
id: collection.id,
|
|
2803
2802
|
kind: collection.kind
|
|
2804
|
-
}).from(collection).where(where).orderBy(order, desc(collection.id)
|
|
2803
|
+
}).from(collection).where(where).orderBy(order, desc(collection.id)).limit(input.pageSize).offset((page - 1) * input.pageSize),
|
|
2805
2804
|
total,
|
|
2806
2805
|
page,
|
|
2807
2806
|
pageSize: input.pageSize,
|
|
@@ -2810,12 +2809,17 @@ async function readAutomationCollection(user, input) {
|
|
|
2810
2809
|
destinations
|
|
2811
2810
|
};
|
|
2812
2811
|
}
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2812
|
+
//#endregion
|
|
2813
|
+
//#region src/chat/automations/creator.ts
|
|
2814
|
+
/**
|
|
2815
|
+
* Return whether the user created the Automation. Both kinds store the
|
|
2816
|
+
* creating Junior identity, so one rule decides ownership.
|
|
2817
|
+
*/
|
|
2818
|
+
function isAutomationCreator(user, automation) {
|
|
2819
|
+
return user.identities.some((identity) => identity.id === automation.creatorIdentityId);
|
|
2820
|
+
}
|
|
2821
|
+
//#endregion
|
|
2822
|
+
//#region src/chat/scheduled-automations/personal.ts
|
|
2819
2823
|
var PersonalScheduledAutomationNotFoundError = class extends Error {
|
|
2820
2824
|
constructor() {
|
|
2821
2825
|
super("Scheduled automation was not found.");
|
|
@@ -2825,9 +2829,8 @@ var PersonalScheduledAutomationNotFoundError = class extends Error {
|
|
|
2825
2829
|
/** Delete one scheduled automation created by the viewer. */
|
|
2826
2830
|
async function deleteViewerScheduledAutomation(db, user, id, nowMs = Date.now()) {
|
|
2827
2831
|
await withScheduledAutomationLock(db, id, async (tx) => {
|
|
2828
|
-
const identityIds = new Set(user.identities.map((identity) => identity.id));
|
|
2829
2832
|
const task = await readScheduledAutomation(tx, id);
|
|
2830
|
-
if (!task || task.status === "deleted" || !
|
|
2833
|
+
if (!task || task.status === "deleted" || !isAutomationCreator(user, task)) throw new PersonalScheduledAutomationNotFoundError();
|
|
2831
2834
|
await saveScheduledAutomationInLock(tx, {
|
|
2832
2835
|
...task,
|
|
2833
2836
|
nextRunAtMs: void 0,
|
|
@@ -2972,38 +2975,35 @@ function viewerTeamIds(user) {
|
|
|
2972
2975
|
return [...new Set(user.identities.filter((identity) => identity.provider === "slack").map((identity) => identity.providerTenantId).filter((teamId) => Boolean(teamId)))];
|
|
2973
2976
|
}
|
|
2974
2977
|
/** Resolve an Automation the viewer owns or can read through a public Destination. */
|
|
2975
|
-
async function resolveViewerTaskCandidate(user,
|
|
2976
|
-
const
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
if (kind === "scheduled") {
|
|
2980
|
-
const task =
|
|
2981
|
-
if (!task
|
|
2982
|
-
|
|
2983
|
-
const destination = (await destinationDetails([task.destination])).get(destinationKey(task.destination));
|
|
2984
|
-
const publicToViewer = teamIds.includes(task.destination.teamId) && destination?.visibility === "public";
|
|
2985
|
-
if (!ownedByViewer && !publicToViewer) return void 0;
|
|
2986
|
-
return {
|
|
2978
|
+
async function resolveViewerTaskCandidate(user, id) {
|
|
2979
|
+
const [row] = await getDb().select().from(juniorAutomations).where(eq(juniorAutomations.id, id)).limit(1);
|
|
2980
|
+
if (!row) return void 0;
|
|
2981
|
+
let candidate;
|
|
2982
|
+
if (row.kind === "scheduled") {
|
|
2983
|
+
const task = parseScheduledAutomationRow(row);
|
|
2984
|
+
if (!task) return void 0;
|
|
2985
|
+
candidate = {
|
|
2987
2986
|
kind: "scheduled",
|
|
2988
|
-
ownedByViewer,
|
|
2987
|
+
ownedByViewer: isAutomationCreator(user, task),
|
|
2988
|
+
task
|
|
2989
|
+
};
|
|
2990
|
+
} else {
|
|
2991
|
+
const task = parseEventAutomationRow(row);
|
|
2992
|
+
candidate = {
|
|
2993
|
+
kind: "event",
|
|
2994
|
+
ownedByViewer: isAutomationCreator(user, task),
|
|
2989
2995
|
task
|
|
2990
2996
|
};
|
|
2991
2997
|
}
|
|
2992
|
-
const task =
|
|
2993
|
-
if (
|
|
2994
|
-
|
|
2998
|
+
const { task } = candidate;
|
|
2999
|
+
if (task.status === "deleted") return void 0;
|
|
3000
|
+
if (candidate.ownedByViewer) return candidate;
|
|
2995
3001
|
const destination = (await destinationDetails([task.destination])).get(destinationKey(task.destination));
|
|
2996
|
-
|
|
2997
|
-
if (!ownedByViewer && !publicToViewer) return void 0;
|
|
2998
|
-
return {
|
|
2999
|
-
kind: "event",
|
|
3000
|
-
ownedByViewer,
|
|
3001
|
-
task
|
|
3002
|
-
};
|
|
3002
|
+
return viewerTeamIds(user).includes(task.destination.teamId) && destination?.visibility === "public" ? candidate : void 0;
|
|
3003
3003
|
}
|
|
3004
3004
|
/** Read one current Automation summary with the Automations view access rules. */
|
|
3005
3005
|
async function readViewerAutomationSummary(user, id) {
|
|
3006
|
-
const candidate = await resolveViewerTaskCandidate(user,
|
|
3006
|
+
const candidate = await resolveViewerTaskCandidate(user, id);
|
|
3007
3007
|
if (!candidate) return void 0;
|
|
3008
3008
|
return automationSummaryForCandidate(candidate);
|
|
3009
3009
|
}
|
|
@@ -3057,7 +3057,6 @@ async function readViewerAutomations(user, input = automationListQuerySchema.par
|
|
|
3057
3057
|
const db = getDb();
|
|
3058
3058
|
const ids = rows.map((row) => row.id);
|
|
3059
3059
|
const stored = ids.length ? await db.select().from(juniorAutomations).where(inArray(juniorAutomations.id, ids)) : [];
|
|
3060
|
-
const identityIds = new Set(user.identities.map((identity) => identity.id));
|
|
3061
3060
|
const candidates = /* @__PURE__ */ new Map();
|
|
3062
3061
|
for (const row of stored) {
|
|
3063
3062
|
if (row.kind === "scheduled") {
|
|
@@ -3065,7 +3064,7 @@ async function readViewerAutomations(user, input = automationListQuerySchema.par
|
|
|
3065
3064
|
if (task && task.status !== "deleted") candidates.set(task.id, {
|
|
3066
3065
|
kind: "scheduled",
|
|
3067
3066
|
task,
|
|
3068
|
-
ownedByViewer:
|
|
3067
|
+
ownedByViewer: isAutomationCreator(user, task)
|
|
3069
3068
|
});
|
|
3070
3069
|
continue;
|
|
3071
3070
|
}
|
|
@@ -3073,7 +3072,7 @@ async function readViewerAutomations(user, input = automationListQuerySchema.par
|
|
|
3073
3072
|
if (task.status !== "deleted") candidates.set(task.id, {
|
|
3074
3073
|
kind: "event",
|
|
3075
3074
|
task,
|
|
3076
|
-
ownedByViewer:
|
|
3075
|
+
ownedByViewer: isAutomationCreator(user, task)
|
|
3077
3076
|
});
|
|
3078
3077
|
}
|
|
3079
3078
|
const selected = rows.flatMap((row) => {
|
|
@@ -3183,8 +3182,8 @@ var ViewerTaskNotFoundError = class extends Error {
|
|
|
3183
3182
|
}
|
|
3184
3183
|
};
|
|
3185
3184
|
/** Read one viewer-visible task and its newest terminal executions. */
|
|
3186
|
-
async function readViewerAutomationExecutions(user,
|
|
3187
|
-
const candidate = await resolveViewerTaskCandidate(user,
|
|
3185
|
+
async function readViewerAutomationExecutions(user, id) {
|
|
3186
|
+
const candidate = await resolveViewerTaskCandidate(user, id);
|
|
3188
3187
|
if (!candidate) throw new ViewerTaskNotFoundError();
|
|
3189
3188
|
const [automation, executions, executionDays, executionHours] = await Promise.all([
|
|
3190
3189
|
automationSummaryForCandidate(candidate),
|
|
@@ -3205,8 +3204,8 @@ async function readViewerAutomationExecutions(user, kind, id) {
|
|
|
3205
3204
|
};
|
|
3206
3205
|
}
|
|
3207
3206
|
/** Read saved definitions for one viewer-visible Automation, newest first. */
|
|
3208
|
-
async function readViewerAutomationVersions(user,
|
|
3209
|
-
const candidate = await resolveViewerTaskCandidate(user,
|
|
3207
|
+
async function readViewerAutomationVersions(user, id) {
|
|
3208
|
+
const candidate = await resolveViewerTaskCandidate(user, id);
|
|
3210
3209
|
if (!candidate) throw new ViewerTaskNotFoundError();
|
|
3211
3210
|
const versions = await listAutomationVersions(getDb(), id, 101);
|
|
3212
3211
|
const current = automationDefinition(candidate.task);
|
|
@@ -3247,7 +3246,7 @@ async function readConversationSourceTask(args) {
|
|
|
3247
3246
|
...dispatchId ? { triggerMessageId: getDispatchInputMessageId(dispatchId) } : void 0
|
|
3248
3247
|
};
|
|
3249
3248
|
if (!args.viewer) return base;
|
|
3250
|
-
const candidate = await resolveViewerTaskCandidate(args.viewer, execution.
|
|
3249
|
+
const candidate = await resolveViewerTaskCandidate(args.viewer, execution.automationId);
|
|
3251
3250
|
if (!candidate) return base;
|
|
3252
3251
|
const credential = await readRunCredential(dispatchId, candidate.task.createdBy);
|
|
3253
3252
|
if (candidate.kind === "scheduled") {
|
|
@@ -3276,16 +3275,16 @@ async function readConversationSourceTask(args) {
|
|
|
3276
3275
|
};
|
|
3277
3276
|
}
|
|
3278
3277
|
/** Delete one viewer-owned scheduled or event automation. */
|
|
3279
|
-
async function deleteViewerTask(user,
|
|
3280
|
-
|
|
3278
|
+
async function deleteViewerTask(user, id) {
|
|
3279
|
+
const candidate = await resolveViewerTaskCandidate(user, id);
|
|
3280
|
+
if (!candidate?.ownedByViewer) throw new ViewerTaskNotFoundError();
|
|
3281
|
+
if (candidate.kind === "scheduled") try {
|
|
3281
3282
|
await deleteViewerScheduledAutomation(getDb(), user, id);
|
|
3282
3283
|
return;
|
|
3283
3284
|
} catch (error) {
|
|
3284
3285
|
if (error instanceof PersonalScheduledAutomationNotFoundError) throw new ViewerTaskNotFoundError();
|
|
3285
3286
|
throw error;
|
|
3286
3287
|
}
|
|
3287
|
-
const task = await getEventAutomation(getDb(), id);
|
|
3288
|
-
if (!task || task.status === "deleted" || !eventAutomationBelongsToUser(task, user)) throw new ViewerTaskNotFoundError();
|
|
3289
3288
|
await deleteEventAutomation(getDb(), id);
|
|
3290
3289
|
}
|
|
3291
3290
|
//#endregion
|
|
@@ -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-Caiof09f.js";
|
|
3
|
+
import { n as botConfig } from "./config-BDAfLTI9.js";
|
|
4
|
+
import { c as getConversationEventStore, u as getConversationStore } from "./viewer-Rnim7alE.js";
|
|
5
5
|
import { m as sameActorIdentity, u as agentInstructionProvenance } from "./history-9pO1Zd4Y.js";
|
|
6
|
-
import {
|
|
6
|
+
import { K as saveTurnCheckpoint, X as getTurnRecord, Y as failTurnRecord, jt as openConversationProjection, lt as getTerminalAssistantMessages, ot as isTurnExecutionLimitExceededError, q as abandonTurnRecord } from "./tasks-dJooqiip.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-BddmM66R.js";
|
|
9
|
+
import { A as recordFinishedTurnForAutomatedLimit, j as resetAutomatedTurnLimit, k as maybePostAutomatedTurnLimitNotice } from "./session-stop-BEBfE97J.js";
|
|
10
|
+
import { r as appendAndEnqueueInboundMessage } from "./store-BashBewg.js";
|
|
11
|
+
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-BfodfmiY.js";
|
|
12
|
+
import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState } from "./thread-state-CsMC-ob0.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-Clj7onnT.js";
|
|
3
|
+
import { C as withLogContext, d as logException, f as logInfo, p as logWarn } from "./logging-D3aYP0aG.js";
|
|
4
|
+
import { i as getChatConfig } from "./config-BDAfLTI9.js";
|
|
5
|
+
import { f as getTurnRequestDeadline, m as ConversationQueueMessageRejectedError } from "./job-queue-BaCL36FY.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-BashBewg.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,45 @@
|
|
|
1
|
+
-- Bind every Automation to the Junior identity that created it. Event rows
|
|
2
|
+
-- did not store an identity before. Use the Slack identity of the stored
|
|
3
|
+
-- creator, and add it when Junior has not seen that Slack user yet. A stored
|
|
4
|
+
-- identity ID that has no identity row is replaced the same way, so the
|
|
5
|
+
-- foreign key can be added.
|
|
6
|
+
UPDATE "junior_automations" AS automation
|
|
7
|
+
SET "creator_identity_id" = NULL
|
|
8
|
+
WHERE automation."creator_identity_id" IS NOT NULL
|
|
9
|
+
AND NOT EXISTS (
|
|
10
|
+
SELECT 1 FROM "junior_identities" AS identity
|
|
11
|
+
WHERE identity."id" = automation."creator_identity_id"
|
|
12
|
+
);--> statement-breakpoint
|
|
13
|
+
INSERT INTO "junior_identities" (
|
|
14
|
+
"id",
|
|
15
|
+
"kind",
|
|
16
|
+
"provider",
|
|
17
|
+
"provider_tenant_id",
|
|
18
|
+
"provider_subject_id",
|
|
19
|
+
"created_at",
|
|
20
|
+
"updated_at"
|
|
21
|
+
)
|
|
22
|
+
SELECT DISTINCT ON (automation."team_id", automation."creator_slack_user_id")
|
|
23
|
+
'automation-slack-' || md5(automation."team_id" || ':' || automation."creator_slack_user_id"),
|
|
24
|
+
'user',
|
|
25
|
+
'slack',
|
|
26
|
+
automation."team_id",
|
|
27
|
+
automation."creator_slack_user_id",
|
|
28
|
+
to_timestamp(automation."created_at_ms" / 1000.0),
|
|
29
|
+
CURRENT_TIMESTAMP
|
|
30
|
+
FROM "junior_automations" AS automation
|
|
31
|
+
WHERE automation."creator_identity_id" IS NULL
|
|
32
|
+
ORDER BY automation."team_id", automation."creator_slack_user_id", automation."created_at_ms"
|
|
33
|
+
ON CONFLICT DO NOTHING;--> statement-breakpoint
|
|
34
|
+
UPDATE "junior_automations" AS automation
|
|
35
|
+
SET "creator_identity_id" = identity."id"
|
|
36
|
+
FROM "junior_identities" AS identity
|
|
37
|
+
WHERE automation."creator_identity_id" IS NULL
|
|
38
|
+
AND identity."provider" = 'slack'
|
|
39
|
+
AND identity."provider_tenant_id" = automation."team_id"
|
|
40
|
+
AND identity."provider_subject_id" = automation."creator_slack_user_id";--> statement-breakpoint
|
|
41
|
+
DROP INDEX "junior_automations_creator_idx";--> statement-breakpoint
|
|
42
|
+
DROP INDEX "junior_automations_creator_identity_idx";--> statement-breakpoint
|
|
43
|
+
ALTER TABLE "junior_automations" ALTER COLUMN "creator_identity_id" SET NOT NULL;--> statement-breakpoint
|
|
44
|
+
ALTER TABLE "junior_automations" ADD CONSTRAINT "junior_automations_creator_identity_id_junior_identities_id_fk" FOREIGN KEY ("creator_identity_id") REFERENCES "public"."junior_identities"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
45
|
+
CREATE INDEX "junior_automations_creator_identity_idx" ON "junior_automations" USING btree ("creator_identity_id","created_at_ms","id");
|