@sentry/junior 0.260.0 → 0.261.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.
Files changed (59) hide show
  1. package/dist/{adapter-Dj5BTJRd.js → adapter-Bx_1B2De.js} +1 -1
  2. package/dist/{admin-tzkZDqrH.js → admin-BAbbVgVc.js} +1 -1
  3. package/dist/{agent-hooks-V4Hfc2tB.js → agent-hooks-ghyZZQqB.js} +20 -16
  4. package/dist/{agent-runner-DvTUyGTY.js → agent-runner-g110-xgg.js} +23 -22
  5. package/dist/api.js +35 -37
  6. package/dist/{app-BsBUs3rF.d.ts → app-VCiPQ65Q.d.ts} +5 -0
  7. package/dist/app.d.ts +1 -1
  8. package/dist/app.js +34 -31
  9. package/dist/{assistant-reply-CEOMzsWy.js → assistant-reply-CQcMaWNL.js} +1 -1
  10. package/dist/{briefs-BSCkyYqs.js → briefs-CKcfrIQL.js} +2 -2
  11. package/dist/{catalog-runtime-Bpcs2b2L.js → catalog-runtime-cd60vzAB.js} +1 -1
  12. package/dist/cli/chat.js +16 -16
  13. package/dist/cli/check.js +3 -3
  14. package/dist/cli/init.js +1 -1
  15. package/dist/cli/main.js +3 -3
  16. package/dist/cli/plugins.js +4 -4
  17. package/dist/cli/snapshot-create.js +4 -4
  18. package/dist/cli/upgrade.js +3 -3
  19. package/dist/{client-JeyzRwsT.js → client-2i0JJpoC.js} +2 -2
  20. package/dist/{config-ULs6Zl9b.js → config-C9qM41O0.js} +2 -2
  21. package/dist/{connections-CZ7HhEmN.js → connections-DrtTrwkp.js} +10 -10
  22. package/dist/{conversation-privacy-BQSlZXgV.js → conversation-privacy-1iTiFX1O.js} +1 -1
  23. package/dist/{credential-sync-BKcv5rBe.js → credential-sync-wKNQ1dYc.js} +14 -14
  24. package/dist/{executor-BoGNVEDn.js → executor-Rimyj8HZ.js} +2 -2
  25. package/dist/{images-BBmDXQCB.js → images-D1JggcVY.js} +2 -2
  26. package/dist/instrumentation.js +2 -2
  27. package/dist/{job-queue-CbdVyaCo.js → job-queue-BjQdSqA3.js} +1 -1
  28. package/dist/{logging-DSMmkHXG.js → logging-BLTa7R7f.js} +1 -1
  29. package/dist/{message-zaj5gBbS.js → message-DAeP5WWW.js} +3 -3
  30. package/dist/nitro.d.ts +1 -1
  31. package/dist/nitro.js +3 -3
  32. package/dist/{oauth-callback-server-yYFG8Own.js → oauth-callback-server-BAy1hhF1.js} +2 -2
  33. package/dist/{profile-ByWkAY7L.js → profile-CthM2qFM.js} +3 -3
  34. package/dist/{registry-BL-osYWN.js → registry-BnSaArNb.js} +1 -1
  35. package/dist/{resolve-HuPG2VMB.js → resolve-B5eLRl0v.js} +3 -3
  36. package/dist/{result-DS7V4a3-.js → result-Cvm0GZCv.js} +6 -6
  37. package/dist/{runner-Cba_OfGl.js → runner-D-pUzHbU.js} +10 -10
  38. package/dist/{sandbox-egress-signals-C7NcPzea.js → sandbox-egress-signals-mvwGV7rl.js} +1 -1
  39. package/dist/{service-account-Ko1Xs--F.js → service-account-Ch1uIpnR.js} +3 -3
  40. package/dist/{service-account-DqwHhwJA.js → service-account-DWxvpSfd.js} +3 -3
  41. package/dist/{session-stop-HfKx-pky.js → session-stop-Boj_zpTa.js} +10 -10
  42. package/dist/{skills-D6_bcAuW.js → skills-BpdYCfFt.js} +2 -2
  43. package/dist/{spawn-BWqK6EwM.js → spawn-h1DJMQTf.js} +2 -2
  44. package/dist/{store-DzRbd5VT.js → store-B6KqcdCQ.js} +6 -6
  45. package/dist/{task-queue-9LICOzcL.js → task-queue-BaDwKSYv.js} +3 -3
  46. package/dist/{task-runner-DGnd_B5X.js → task-runner-BAX5li9a.js} +10 -10
  47. package/dist/{tasks-CjrS098O.js → tasks-uCfmlWga.js} +40 -14
  48. package/dist/{thread-state-CqkYowEz.js → thread-state-BJHVIz8G.js} +5 -5
  49. package/dist/{turn-failure-response-BkKmGqFt.js → turn-failure-response-CCC76P6-.js} +7 -7
  50. package/dist/{turn-lifecycle-DYv8IV6w.js → turn-lifecycle-pHSESVR9.js} +1 -1
  51. package/dist/{turn-session-routing-TaVhKmdz.js → turn-session-routing-BIKJZaiw.js} +1 -1
  52. package/dist/{validation-BrXMYPyo.js → validation-B9KL_5Wc.js} +1 -1
  53. package/dist/{version-Ct049vav.js → version-CN9BXMW_.js} +1 -1
  54. package/dist/version.js +1 -1
  55. package/dist/{viewer-C-J0ewlH.js → viewer-C5xFaYVi.js} +3 -3
  56. package/dist/{web-input-C_xB3RXp.js → web-input-D6eqfXYd.js} +25 -25
  57. package/dist/{work-D829Ue7k.js → work-C-ecZAme.js} +9 -9
  58. package/dist/{worker-BRTYzlpk.js → worker-BpYDqiOf.js} +5 -5
  59. package/package.json +11 -11
@@ -1,4 +1,4 @@
1
- import { i as getChatConfig } from "./config-ULs6Zl9b.js";
1
+ import { i as getChatConfig } from "./config-C9qM41O0.js";
2
2
  import { createMemoryState } from "@chat-adapter/state-memory";
3
3
  import { createRedisState } from "@chat-adapter/state-redis";
4
4
  import { setTimeout } from "node:timers/promises";
@@ -1,4 +1,4 @@
1
- import { a as setUserAdminFromSql, d as getDb, n as listAdminUsersFromSql } from "./viewer-C-J0ewlH.js";
1
+ import { a as setUserAdminFromSql, d as getDb, n as listAdminUsersFromSql } from "./viewer-C5xFaYVi.js";
2
2
  import { CLI_USAGE } from "./cli/run.js";
3
3
  // src/cli/admin.ts
4
4
  /**
@@ -1,27 +1,27 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { i as completeObject, o as embedTexts } from "./client-JeyzRwsT.js";
3
- import { T as withSpan, a as extractGenAiUsageSummary, b as setSpanStatus, f as logException, m as logWarn, p as logInfo, y as setSpanAttributes, z as isRecord$1 } from "./logging-DSMmkHXG.js";
2
+ import { i as completeObject, o as embedTexts } from "./client-2i0JJpoC.js";
3
+ import { T as withSpan, a as extractGenAiUsageSummary, b as setSpanStatus, f as logException, m as logWarn, p as logInfo, y as setSpanAttributes, z as isRecord$1 } from "./logging-BLTa7R7f.js";
4
4
  import { a as getClient$1 } from "./sentry-BBUlHih9.js";
5
- import { t as canExposeConversationPayload } from "./conversation-privacy-BQSlZXgV.js";
6
- import { i as getChatConfig, n as botConfig, o as getSlackBotToken } from "./config-ULs6Zl9b.js";
5
+ import { t as canExposeConversationPayload } from "./conversation-privacy-1iTiFX1O.js";
6
+ import { i as getChatConfig, n as botConfig, o as getSlackBotToken } from "./config-C9qM41O0.js";
7
7
  import { r as defaultModelId } from "./model-profile-Bg8EoCKD.js";
8
8
  import { d as parseSlackTeamId, g as parseSlackMessageTs, i as isActorUserId, o as parseActorUserId, u as parseSlackChannelReferenceId } from "./actor-tlxzqaRe.js";
9
- import { D as hasAgentTurnUsage, M as readUserTimezone, P as saveUserTimezone, c as getConversationEventStore, d as getDb, f as getSqlExecutor, g as createSqlStore, i as resolveViewerUser, r as readActorIdentity } from "./viewer-C-J0ewlH.js";
9
+ import { D as hasAgentTurnUsage, M as readUserTimezone, P as saveUserTimezone, c as getConversationEventStore, d as getDb, f as getSqlExecutor, g as createSqlStore, i as resolveViewerUser, r as readActorIdentity } from "./viewer-C5xFaYVi.js";
10
10
  import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, s as juniorConversations } from "./agent-invocations-Qfz7dWgU.js";
11
- import { _ as juniorConversationAnnotations, b as juniorAttachments, f as juniorConversationBriefs, h as juniorConversationEvents, i as juniorWorkspaces, n as juniorSnapshots, r as juniorWorkspaceRepos, u as juniorConversationParticipants, v as juniorCodeChanges, y as juniorCodeRepositories } from "./executor-BoGNVEDn.js";
11
+ import { _ as juniorConversationAnnotations, b as juniorAttachments, f as juniorConversationBriefs, h as juniorConversationEvents, i as juniorWorkspaces, n as juniorSnapshots, r as juniorWorkspaceRepos, u as juniorConversationParticipants, v as juniorCodeChanges, y as juniorCodeRepositories } from "./executor-Rimyj8HZ.js";
12
12
  import { o as decodeStoredConversationEvent } from "./history-AY8rs-FR.js";
13
- import { h as credentialSubjectSchema } from "./registry-BL-osYWN.js";
13
+ import { h as credentialSubjectSchema } from "./registry-BnSaArNb.js";
14
14
  import { i as isValidTimeZone } from "./cadence-R7Em4RjE.js";
15
15
  import { B as readMessageAttachments, C as conversationReportEventSchema, F as readMessageCardRefs, J as parseBriefInput, q as conversationBriefSchema, w as conversationReportMessageEventSchema } from "./conversation-CvuKJ3tA.js";
16
16
  import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-DeVax2qO.js";
17
- import { n as getDefaultRedisStateAdapterFor, r as getStateAdapter } from "./adapter-Dj5BTJRd.js";
18
- import { E as SANDBOX_WORKSPACE_ROOT, S as runNonInteractiveCommand, l as isSandboxMissingError, n as hash, v as getVercelSandboxCredentials, y as sleep$1 } from "./profile-ByWkAY7L.js";
17
+ import { n as getDefaultRedisStateAdapterFor, r as getStateAdapter } from "./adapter-Bx_1B2De.js";
18
+ import { E as SANDBOX_WORKSPACE_ROOT, S as runNonInteractiveCommand, l as isSandboxMissingError, n as hash, v as getVercelSandboxCredentials, y as sleep$1 } from "./profile-CthM2qFM.js";
19
19
  import { AsyncLocalStorage } from "node:async_hooks";
20
20
  import { z } from "zod";
21
21
  import { createHash, createHmac, randomUUID, timingSafeEqual } from "node:crypto";
22
22
  import { and, arrayContains, asc, desc, eq, exists, getTableColumns, gte, inArray, isNotNull, isNull, lt, lte, max, ne, notExists, or, sql } from "drizzle-orm";
23
23
  import { codeChangeInputSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, defineConversationEvent, eventInputSchema, eventMatchSchema, eventMatches, eventTypeSchema, missingToolAnnotationKeys, normalizeEventIdentifier, objectAnnotationSchema, objectIconPath, objectTypeSchema, pluginEventsSchema, promptContextSchema, promptMessageSchema, stableEventMatchKey } from "@sentry/junior-plugin-api";
24
- import { alias } from "drizzle-orm/pg-core";
24
+ import { alias, union } from "drizzle-orm/pg-core";
25
25
  import { WebClient } from "@slack/web-api";
26
26
  import { Sandbox } from "@vercel/sandbox";
27
27
  // src/chat/conversations/structured-events.ts
@@ -1451,12 +1451,16 @@ function conversationHasParticipantUser(userId) {
1451
1451
  return exists(participant);
1452
1452
  }
1453
1453
  /**
1454
- * True when a verified primary-email user participates on this root
1455
- * conversation. Used only for the actorEmail feed fallback.
1454
+ * True when the conversation is one the person started or participates in.
1455
+ * Feeds filter with this id set instead of a per-row membership check, so
1456
+ * Postgres reads only that person's conversations, not every root.
1456
1457
  */
1457
- function conversationHasParticipantEmail(email) {
1458
- const participant = getDb().select({ rootConversationId: juniorConversationParticipants.rootConversationId }).from(juniorConversationParticipants).innerJoin(juniorUsers, eq(juniorUsers.id, juniorConversationParticipants.userId)).where(and(eq(juniorConversationParticipants.rootConversationId, juniorConversations.conversationId), eq(juniorUsers.primaryEmailNormalized, email)));
1459
- return exists(participant);
1458
+ function conversationIsMemberRoot(member) {
1459
+ const db = getDb();
1460
+ const started = db.select({ conversationId: juniorConversations.conversationId }).from(juniorConversations).innerJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId));
1461
+ const participating = db.select({ conversationId: juniorConversationParticipants.rootConversationId }).from(juniorConversationParticipants);
1462
+ const memberRoots = "userId" in member ? union(started.where(eq(juniorIdentities.userId, member.userId)), participating.where(eq(juniorConversationParticipants.userId, member.userId))) : union(started.innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(eq(juniorUsers.primaryEmailNormalized, member.email)), participating.innerJoin(juniorUsers, eq(juniorUsers.id, juniorConversationParticipants.userId)).where(eq(juniorUsers.primaryEmailNormalized, member.email)));
1463
+ return inArray(juniorConversations.conversationId, memberRoots);
1460
1464
  }
1461
1465
  /** True when one user's personal feed has archived this root after the cutoff. */
1462
1466
  function conversationArchivedForUser(userId, archivedAfter) {
@@ -4345,4 +4349,4 @@ function createPluginHookRunner(input = {}) {
4345
4349
  }
4346
4350
  };
4347
4351
  }
4348
- export { bindSlackDirectCredentialSubject as $, authenticationUnlinkedEvent as $t, getWorkspaceSnapshotBuilder as A, conversationHasParticipantUser as At, STOP_WATCHING_TOOL_NAME as B, readAttachmentVisionSummary as Bt, WorkspaceValidationError as C, createPluginModel as Ct, setWorkspaceSnapshotBuild as D, conversationArchivedForEmail as Dt, setWorkspaceSnapshot as E, conversationArchiveTimes as Et, isSlackMessageTurn as F, readLatestConversationBrief as Ft, createWatch as G, listConversationAnnotations as Gt, cancelWatch as H, resolveRootVisibility as Ht, slackMessageTurnDisabledReason as I, readConversationEventPage as It, getWatch as J, resolveUserTimezone as Jt, deliverWatch as K, listConversationAnnotationsById as Kt, RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS as L, buildSentryConversationUrl as Lt, workspaceRepoCheckoutPath as M, conversationNotArchivedForUser as Mt, resolveChannelCapabilities as N, viewerConversationMembership as Nt, SANDBOX_RUNTIME as O, conversationArchivedForUser as Ot, getSlackToolContext as P, createPluginConversationEvents as Pt, bindScheduledAutomationCredentialSubject as Q, authenticationLinkedEvent as Qt, RESOURCE_SUBSCRIPTION_MAX_TTL_MS as R, getSlackFileId as Rt, updateWorkspace as S, createPluginEmbedder as St, loadSnapshotsForProfile as T, readConversationAccessFromSql as Tt, collectEventMatchKeys as U, saveObjectAnnotations as Ut, cancelSubscriptions as V, recordSlackAttachment as Vt, createTimerWatch as W, createPluginAnnotations as Wt, takeDueTimerWatches as X, JUNIOR_NATIVE_EVENT_NAMESPACE as Xt, listWatches as Y, lookupSlackUser as Yt, bindEventAutomationCredentialSubject as Z, agentsInstructionsUpdatedEvent as Zt, deleteWorkspace as _, getDashboardConversationLink as _t, getPluginRoutes as a, downloadPrivateSlackFile as at, listWorkspaces as b, setDashboardConversationLinkOptions as bt, getPluginTools as c, getSlackClient as ct, setPlugins as d, normalizeSlackConversationId as dt, conversationNoteEvent as en, verifyEventAutomationCredentialSubject as et, validatePlugins as f, runWithSlackInstallationToken as ft, createWorkspace as g, JUNIOR_THREAD_STATE_TTL_MS as gt, setBriefsConfig as h, runWithWorkspaceTeamId as ht, getPluginApiRoutes as i, SlackActionError as it, tryWorkspaceRepoCheckoutPath as j, conversationNotArchivedForEmail as jt, deleteWorkspaceSnapshotBuilders as k, conversationHasParticipantEmail as kt, getPluginUserPromptContributions as l, isConversationScopedChannel as lt, registration_exports as m, getWorkspaceTeamId as mt, applyPluginFormatMarkdown as n, verifySlackDirectCredentialSubject as nt, getPluginSlackConversationLink as o, getFilePermalink as ot, coreTaskRegistrations as p, withSlackRetries as pt, findMatchingWatches as q, defaultTimezone as qt, createPluginHookRunner as r, verifyTimerWatchCredentialSubject as rt, getPluginSystemPromptContributions as s, getHeaderString as st, agent_hooks_exports as t, verifyScheduledAutomationCredentialSubject as tt, getPlugins as u, isDmChannel as ut, getWorkspace as v, getDashboardObjectIconLink as vt, invalidateReadySnapshot as w, createPluginLogger as wt, listWorkspacesByRepository as x, createPluginState as xt, getWorkspaceByName as y, getDashboardTaskLink as yt, RESOURCE_WATCH_TOOL_SOURCE as z, matchSlackAttachments as zt };
4352
+ export { bindSlackDirectCredentialSubject as $, authenticationUnlinkedEvent as $t, getWorkspaceSnapshotBuilder as A, conversationIsMemberRoot as At, STOP_WATCHING_TOOL_NAME as B, readAttachmentVisionSummary as Bt, WorkspaceValidationError as C, createPluginModel as Ct, setWorkspaceSnapshotBuild as D, conversationArchivedForEmail as Dt, setWorkspaceSnapshot as E, conversationArchiveTimes as Et, isSlackMessageTurn as F, readLatestConversationBrief as Ft, createWatch as G, listConversationAnnotations as Gt, cancelWatch as H, resolveRootVisibility as Ht, slackMessageTurnDisabledReason as I, readConversationEventPage as It, getWatch as J, resolveUserTimezone as Jt, deliverWatch as K, listConversationAnnotationsById as Kt, RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS as L, buildSentryConversationUrl as Lt, workspaceRepoCheckoutPath as M, conversationNotArchivedForUser as Mt, resolveChannelCapabilities as N, viewerConversationMembership as Nt, SANDBOX_RUNTIME as O, conversationArchivedForUser as Ot, getSlackToolContext as P, createPluginConversationEvents as Pt, bindScheduledAutomationCredentialSubject as Q, authenticationLinkedEvent as Qt, RESOURCE_SUBSCRIPTION_MAX_TTL_MS as R, getSlackFileId as Rt, updateWorkspace as S, createPluginEmbedder as St, loadSnapshotsForProfile as T, readConversationAccessFromSql as Tt, collectEventMatchKeys as U, saveObjectAnnotations as Ut, cancelSubscriptions as V, recordSlackAttachment as Vt, createTimerWatch as W, createPluginAnnotations as Wt, takeDueTimerWatches as X, JUNIOR_NATIVE_EVENT_NAMESPACE as Xt, listWatches as Y, lookupSlackUser as Yt, bindEventAutomationCredentialSubject as Z, agentsInstructionsUpdatedEvent as Zt, deleteWorkspace as _, getDashboardConversationLink as _t, getPluginRoutes as a, downloadPrivateSlackFile as at, listWorkspaces as b, setDashboardConversationLinkOptions as bt, getPluginTools as c, getSlackClient as ct, setPlugins as d, normalizeSlackConversationId as dt, conversationNoteEvent as en, verifyEventAutomationCredentialSubject as et, validatePlugins as f, runWithSlackInstallationToken as ft, createWorkspace as g, JUNIOR_THREAD_STATE_TTL_MS as gt, setBriefsConfig as h, runWithWorkspaceTeamId as ht, getPluginApiRoutes as i, SlackActionError as it, tryWorkspaceRepoCheckoutPath as j, conversationNotArchivedForEmail as jt, deleteWorkspaceSnapshotBuilders as k, conversationHasParticipantUser as kt, getPluginUserPromptContributions as l, isConversationScopedChannel as lt, registration_exports as m, getWorkspaceTeamId as mt, applyPluginFormatMarkdown as n, verifySlackDirectCredentialSubject as nt, getPluginSlackConversationLink as o, getFilePermalink as ot, coreTaskRegistrations as p, withSlackRetries as pt, findMatchingWatches as q, defaultTimezone as qt, createPluginHookRunner as r, verifyTimerWatchCredentialSubject as rt, getPluginSystemPromptContributions as s, getHeaderString as st, agent_hooks_exports as t, verifyScheduledAutomationCredentialSubject as tt, getPlugins as u, isDmChannel as ut, getWorkspace as v, getDashboardObjectIconLink as vt, invalidateReadySnapshot as w, createPluginLogger as wt, listWorkspacesByRepository as x, createPluginState as xt, getWorkspaceByName as y, getDashboardTaskLink as yt, RESOURCE_WATCH_TOOL_SOURCE as z, matchSlackAttachments as zt };
@@ -1,30 +1,30 @@
1
- import { $t as isToolResultError, A as ToolInputError, An as createSandboxEgressCredentialToken, At as saveTurnCheckpoint, B as recordAgentsInstructionsUpdated, Bt as TurnToolCallLimitExceededError, Ct as abandonReplacedPendingAuth, Dn as clearSandboxEgressSignals, F as loadLastModelProfile, G as recordGuardianActionReviewed, Gn as getSlackMessagePermalink, Gt as extractAssistantText, Hn as slackMention, Ht as createTurnLimitGate, In as resolveBaseUrl, J as recordToolExecutionStarted, Jt as getUserMessageInstructionText, K as recordMcpProviderConnected, Kn as openSlackDirectMessage, Kt as getPiMessageRole, Lt as TURN_LIMIT_DISABLED_REASON, N as loadConnectedMcpProviders, Nn as deliverOAuthAuthorization, O as automationRevision, On as consumeSandboxEgressAuthRequiredSignal, Ot as continuableMessages, P as loadConversationProjection, Pn as formatProviderLabel, Qn as getOAuthAccountProviders, Qt as isContinuablePiBoundary, R as loadTurnRoute, Rt as TurnBudgetExceededError, Sn as resolveSandboxCommandEnvironment, St as AuthorizationPauseError, Ut as isTurnExecutionLimitExceededError, V as recordAttachmentsDelivered, W as recordAuthorizationRequested, Wn as addReactionToMessage, Y as recordTurnRoute, Yn as uploadFilesToConversation, Yt as hasRuntimeTurnContext, Zt as isAssistantMessage, _n as isExperimentalFeatureEnabled, _t as PluginCredentialFailureError, a as saveScheduledAutomation, an as TURN_CONTEXT_TAG, bn as createUserTokenStore, bt as AuthPausePersistenceError, d as createEventAutomation, en as isToolResultMessage, f as deleteEventAutomation, fn as estimateTextTokens, g as listEventAutomationsForTeam, gt as createPluginEgress, i as readScheduledAutomation, in as trimTrailingAssistantMessages, ir as getConfigDefaults, it as resolveTaskTitle, kn as consumeSandboxEgressPermissionDeniedSignal, kt as loadTurnCheckpoint, m as getEventAutomation, mn as getAgentContextInputLimitTokens, n as listScheduledAutomationsForTeam, nn as retainRuntimeTurnContext, nr as historyItemFromPiMessage, pn as getAgentContextCompactionTriggerTokens, qt as getTerminalAssistantMessages, rn as stripRuntimeTurnContext, rr as piMessageFromHistoryItem, rt as fallbackShortTitle, t as createScheduledAutomation, tn as normalizeToolNameFromResult, v as saveEventAutomation, vt as createPluginAuthOrchestration, wt as canReusePendingAuthLink, xn as buildSandboxEgressNetworkPolicy, xt as AuthorizationFlowDisabledError, y as setEventAutomationStatus, yt as authorizationId, z as openConversationProjection, zt as TurnSliceLimitExceededError } from "./tasks-CjrS098O.js";
2
- import { S as resolveGatewayCredential, _ as getProviderErrorAttributes, a as completeText, b as MISSING_GATEWAY_CREDENTIALS_ERROR, c as COMPACTION_SUMMARY_PREFIX, d as renderCurrentInstruction, f as unwrapCurrentInstruction, g as findProviderError, h as createProviderError, i as completeObject, l as hasCompactedConversationContext, m as ProviderError, n as GEN_AI_SERVER_ADDRESS, p as escapeXml, s as resolveGatewayModel, t as GEN_AI_PROVIDER_NAME, u as isCompactionSummaryText, x as getGatewayApiKey, y as isProviderRetryError } from "./client-JeyzRwsT.js";
3
- import { R as normalizeIdentityEmail, S as summarizeMessageText, T as withSpan, V as toOptionalString, _ as serializeGenAiAttribute, a as extractGenAiUsageSummary, b as setSpanStatus, c as getLogContextAttributesForSpan, d as logError, f as logException, h as normalizeGenAiFinishReason, i as extractGenAiUsageAttributes, l as getTracePropagationHeaders, m as logWarn, p as logInfo, w as withLogContext, x as setTags, y as setSpanAttributes, z as isRecord$4 } from "./logging-DSMmkHXG.js";
1
+ import { $t as isToolResultError, A as ToolInputError, An as createSandboxEgressCredentialToken, At as saveTurnCheckpoint, B as recordAgentsInstructionsUpdated, Bt as TurnToolCallLimitExceededError, Ct as abandonReplacedPendingAuth, Dn as clearSandboxEgressSignals, F as loadLastModelProfile, G as recordGuardianActionReviewed, Gn as getSlackMessagePermalink, Gt as extractAssistantText, Hn as slackMention, Ht as createTurnLimitGate, In as resolveBaseUrl, J as recordToolExecutionStarted, Jt as getUserMessageInstructionText, K as recordMcpProviderConnected, Kn as openSlackDirectMessage, Kt as getPiMessageRole, Lt as TURN_LIMIT_DISABLED_REASON, N as loadConnectedMcpProviders, Nn as deliverOAuthAuthorization, O as automationRevision, On as consumeSandboxEgressAuthRequiredSignal, Ot as continuableMessages, P as loadConversationProjection, Pn as formatProviderLabel, Qn as getOAuthAccountProviders, Qt as isContinuablePiBoundary, R as loadTurnRoute, Rt as TurnBudgetExceededError, Sn as resolveSandboxCommandEnvironment, St as AuthorizationPauseError, Ut as isTurnExecutionLimitExceededError, V as recordAttachmentsDelivered, W as recordAuthorizationRequested, Wn as addReactionToMessage, Y as recordTurnRoute, Yn as uploadFilesToConversation, Yt as hasRuntimeTurnContext, Zt as isAssistantMessage, _n as isExperimentalFeatureEnabled, _t as PluginCredentialFailureError, a as saveScheduledAutomation, an as TURN_CONTEXT_TAG, bn as createUserTokenStore, bt as AuthPausePersistenceError, d as createEventAutomation, en as isToolResultMessage, f as deleteEventAutomation, fn as estimateTextTokens, g as listEventAutomationsForTeam, gt as createPluginEgress, i as readScheduledAutomation, in as trimTrailingAssistantMessages, ir as getConfigDefaults, it as resolveTaskTitle, kn as consumeSandboxEgressPermissionDeniedSignal, kt as loadTurnCheckpoint, m as getEventAutomation, mn as getAgentContextInputLimitTokens, n as listScheduledAutomationsForTeam, nn as retainRuntimeTurnContext, nr as historyItemFromPiMessage, pn as getAgentContextCompactionTriggerTokens, qt as getTerminalAssistantMessages, rn as stripRuntimeTurnContext, rr as piMessageFromHistoryItem, rt as fallbackShortTitle, t as createScheduledAutomation, tn as normalizeToolNameFromResult, v as saveEventAutomation, vt as createPluginAuthOrchestration, wt as canReusePendingAuthLink, xn as buildSandboxEgressNetworkPolicy, xt as AuthorizationFlowDisabledError, y as setEventAutomationStatus, yt as authorizationId, z as openConversationProjection, zt as TurnSliceLimitExceededError } from "./tasks-uCfmlWga.js";
2
+ import { S as resolveGatewayCredential, _ as getProviderErrorAttributes, a as completeText, b as MISSING_GATEWAY_CREDENTIALS_ERROR, c as COMPACTION_SUMMARY_PREFIX, d as renderCurrentInstruction, f as unwrapCurrentInstruction, g as findProviderError, h as createProviderError, i as completeObject, l as hasCompactedConversationContext, m as ProviderError, n as GEN_AI_SERVER_ADDRESS, p as escapeXml, s as resolveGatewayModel, t as GEN_AI_PROVIDER_NAME, u as isCompactionSummaryText, x as getGatewayApiKey, y as isProviderRetryError } from "./client-2i0JJpoC.js";
3
+ import { R as normalizeIdentityEmail, S as summarizeMessageText, T as withSpan, V as toOptionalString, _ as serializeGenAiAttribute, a as extractGenAiUsageSummary, b as setSpanStatus, c as getLogContextAttributesForSpan, d as logError, f as logException, h as normalizeGenAiFinishReason, i as extractGenAiUsageAttributes, l as getTracePropagationHeaders, m as logWarn, p as logInfo, w as withLogContext, x as setTags, y as setSpanAttributes, z as isRecord$4 } from "./logging-BLTa7R7f.js";
4
4
  import { m as startInactiveSpan, v as withActiveSpan } from "./sentry-BBUlHih9.js";
5
- import { a as toCanonicalInputMessage, c as toGenAiPayloadMetadata, i as runWithConversationPrivacy, l as toGenAiPayloadTraceAttributes, o as toCanonicalOutputMessage, r as resolveConversationPrivacy, s as toGenAiMessagesTraceAttributes, t as canExposeConversationPayload } from "./conversation-privacy-BQSlZXgV.js";
6
- import { n as botConfig, v as normalizeSlackEmojiName } from "./config-ULs6Zl9b.js";
5
+ import { a as toCanonicalInputMessage, c as toGenAiPayloadMetadata, i as runWithConversationPrivacy, l as toGenAiPayloadTraceAttributes, o as toCanonicalOutputMessage, r as resolveConversationPrivacy, s as toGenAiMessagesTraceAttributes, t as canExposeConversationPayload } from "./conversation-privacy-1iTiFX1O.js";
6
+ import { n as botConfig, v as normalizeSlackEmojiName } from "./config-C9qM41O0.js";
7
7
  import { a as formatModelProfiles, c as profileConfig, i as formatModelProfile, l as TURN_REASONING_LEVELS, n as ModelProfileNotConfiguredError, o as modelIdForProfile, s as modelProfileSchema } from "./model-profile-Bg8EoCKD.js";
8
8
  import { a as isUserActor, d as parseSlackTeamId, f as parseSlackUserId, g as parseSlackMessageTs, l as parseSlackChannelId, u as parseSlackChannelReferenceId } from "./actor-tlxzqaRe.js";
9
- import { C as addAgentTurnUsage, D as hasAgentTurnUsage, R as parseDestination, c as getConversationEventStore, d as getDb, f as getSqlExecutor, l as getConversationMessageSearchStore, r as readActorIdentity, u as getConversationStore, w as agentTurnCostUsd } from "./viewer-C-J0ewlH.js";
9
+ import { C as addAgentTurnUsage, D as hasAgentTurnUsage, R as parseDestination, c as getConversationEventStore, d as getDb, f as getSqlExecutor, l as getConversationMessageSearchStore, r as readActorIdentity, u as getConversationStore, w as agentTurnCostUsd } from "./viewer-C5xFaYVi.js";
10
10
  import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, i as juniorAgentBindings, n as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, s as juniorConversations, t as AGENT_INVOCATION_MAILBOX_STATUSES } from "./agent-invocations-Qfz7dWgU.js";
11
- import { _ as juniorConversationAnnotations, a as juniorAutomationRuns, b as juniorAttachments, c as juniorStats, f as juniorConversationBriefs, x as juniorArtifacts } from "./executor-BoGNVEDn.js";
11
+ import { _ as juniorConversationAnnotations, a as juniorAutomationRuns, b as juniorAttachments, c as juniorStats, f as juniorConversationBriefs, x as juniorArtifacts } from "./executor-Rimyj8HZ.js";
12
12
  import { d as contextProvenance, f as instructionActors, m as sameActorIdentity, p as instructionProvenanceFor, t as KNOWN_CONVERSATION_EVENT_TYPES, u as agentInstructionProvenance } from "./history-AY8rs-FR.js";
13
13
  import { a as listReferenceFiles, c as soulPathCandidates, l as worldPathCandidates } from "./package-discovery-DJBompdd.js";
14
- import { c as fetchWithBoundedOAuthErrorBodies, d as actorLogContext, f as credentialContextForActor, g as credentialUserSubjectId, i as resolvePluginHeaderEnvRefs, l as getOAuthProviderErrorAttributes, p as credentialContextSchema, s as OAuthProviderError } from "./registry-BL-osYWN.js";
15
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Bpcs2b2L.js";
16
- import { a as parseSkillInvocation, i as parseSkillFile, n as findSkillByName, r as loadSkillsByName, t as discoverSkills } from "./skills-D6_bcAuW.js";
17
- import { A as getWorkspaceSnapshotBuilder, B as STOP_WATCHING_TOOL_NAME, C as WorkspaceValidationError, D as setWorkspaceSnapshotBuild, E as setWorkspaceSnapshot, F as isSlackMessageTurn, G as createWatch, H as cancelWatch, I as slackMessageTurnDisabledReason, J as getWatch, Jt as resolveUserTimezone, K as deliverWatch, L as RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS, M as workspaceRepoCheckoutPath, N as resolveChannelCapabilities, O as SANDBOX_RUNTIME, P as getSlackToolContext, R as RESOURCE_SUBSCRIPTION_MAX_TTL_MS, S as updateWorkspace, T as loadSnapshotsForProfile, Ut as saveObjectAnnotations, V as cancelSubscriptions, W as createTimerWatch, Wt as createPluginAnnotations, Xt as JUNIOR_NATIVE_EVENT_NAMESPACE, Y as listWatches, _ as deleteWorkspace, _t as getDashboardConversationLink, at as downloadPrivateSlackFile, b as listWorkspaces, c as getPluginTools, ct as getSlackClient, dt as normalizeSlackConversationId, en as conversationNoteEvent, g as createWorkspace, it as SlackActionError, j as tryWorkspaceRepoCheckoutPath, k as deleteWorkspaceSnapshotBuilders, l as getPluginUserPromptContributions, lt as isConversationScopedChannel, ot as getFilePermalink, pt as withSlackRetries, q as findMatchingWatches, qt as defaultTimezone, r as createPluginHookRunner, s as getPluginSystemPromptContributions, u as getPlugins, ut as isDmChannel$1, v as getWorkspace, w as invalidateReadySnapshot, y as getWorkspaceByName, yt as getDashboardTaskLink, z as RESOURCE_WATCH_TOOL_SOURCE, zt as matchSlackAttachments } from "./agent-hooks-V4Hfc2tB.js";
14
+ import { c as fetchWithBoundedOAuthErrorBodies, d as actorLogContext, f as credentialContextForActor, g as credentialUserSubjectId, i as resolvePluginHeaderEnvRefs, l as getOAuthProviderErrorAttributes, p as credentialContextSchema, s as OAuthProviderError } from "./registry-BnSaArNb.js";
15
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-cd60vzAB.js";
16
+ import { a as parseSkillInvocation, i as parseSkillFile, n as findSkillByName, r as loadSkillsByName, t as discoverSkills } from "./skills-BpdYCfFt.js";
17
+ import { A as getWorkspaceSnapshotBuilder, B as STOP_WATCHING_TOOL_NAME, C as WorkspaceValidationError, D as setWorkspaceSnapshotBuild, E as setWorkspaceSnapshot, F as isSlackMessageTurn, G as createWatch, H as cancelWatch, I as slackMessageTurnDisabledReason, J as getWatch, Jt as resolveUserTimezone, K as deliverWatch, L as RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS, M as workspaceRepoCheckoutPath, N as resolveChannelCapabilities, O as SANDBOX_RUNTIME, P as getSlackToolContext, R as RESOURCE_SUBSCRIPTION_MAX_TTL_MS, S as updateWorkspace, T as loadSnapshotsForProfile, Ut as saveObjectAnnotations, V as cancelSubscriptions, W as createTimerWatch, Wt as createPluginAnnotations, Xt as JUNIOR_NATIVE_EVENT_NAMESPACE, Y as listWatches, _ as deleteWorkspace, _t as getDashboardConversationLink, at as downloadPrivateSlackFile, b as listWorkspaces, c as getPluginTools, ct as getSlackClient, dt as normalizeSlackConversationId, en as conversationNoteEvent, g as createWorkspace, it as SlackActionError, j as tryWorkspaceRepoCheckoutPath, k as deleteWorkspaceSnapshotBuilders, l as getPluginUserPromptContributions, lt as isConversationScopedChannel, ot as getFilePermalink, pt as withSlackRetries, q as findMatchingWatches, qt as defaultTimezone, r as createPluginHookRunner, s as getPluginSystemPromptContributions, u as getPlugins, ut as isDmChannel$1, v as getWorkspace, w as invalidateReadySnapshot, y as getWorkspaceByName, yt as getDashboardTaskLink, z as RESOURCE_WATCH_TOOL_SOURCE, zt as matchSlackAttachments } from "./agent-hooks-ghyZZQqB.js";
18
18
  import { i as isValidTimeZone, r as getZonedDateTimeParts } from "./cadence-R7Em4RjE.js";
19
19
  import { G as briefLinkSchema, H as detectImageMediaType, I as removedCardSchema, K as briefOutcomeStatusSchema, U as isVisionImageMediaType, q as conversationBriefSchema } from "./conversation-CvuKJ3tA.js";
20
- import { o as fenceLock, r as getStateAdapter, s as withLock } from "./adapter-Dj5BTJRd.js";
21
- import { C as SANDBOX_DATA_ROOT, D as sandboxSkillDir, E as SANDBOX_WORKSPACE_ROOT, O as sandboxSkillFile, S as runNonInteractiveCommand, T as SANDBOX_SKILLS_ROOT, _ as workspaceSnapshotNotReadyUserMessage, a as isAbortError, b as buildCommandScript, c as isSandboxCommandStreamInterruptedError, d as isSnapshottingError, f as throwSandboxOperationError, g as isWorkspaceSnapshotNotReadyError, h as getWorkspaceSnapshotNotReadyError, i as ensureDockerDaemon, k as sandboxSkillPathResolution, l as isSandboxMissingError, m as WorkspaceSnapshotNotReadyError, n as hash, o as isAlreadyExistsError, p as wrapSandboxSetupError, r as isStale, s as isSandboxApiTransientError, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as SANDBOX_REPOS_ROOT, x as buildNonInteractiveShellScript, y as sleep } from "./profile-ByWkAY7L.js";
22
- import { a as isNoReplyMarker, i as NO_REPLY_MARKER, n as getAssistantReplyText, r as sanitizeAssistantText, t as decideReply } from "./assistant-reply-CEOMzsWy.js";
23
- import { A as requireSupportedEventMatch, B as readAutomationResult, C as eventNamespaceSchema, D as registeredEventTypeSchema, E as registeredEventMatchSchema, I as FINISH_AUTOMATION_RUN_TOOL_NAME, L as automationResultSchema, O as registeredResourceTypeSchema, T as pluginSupportsEvent, V as remindMissingAutomationResult, _ as WORKSPACE_SNAPSHOT_FAILED_EVENT, b as workspaceSnapshotWatch, d as getEventCatalog, k as requireEventIdentifier, n as markConversationsStopped, o as enqueueEventNotification, p as requireSlackChannelMessageScope, t as getConversationStoppedAtMs, v as WORKSPACE_SNAPSHOT_READY_EVENT, w as hasEventCatalogEntries, x as automationEventCatalog, y as workspaceSnapshotFinishedEvent } from "./session-stop-HfKx-pky.js";
24
- import { a as createSandboxSession, c as postinstall, d as getSandboxResources, i as bindSandboxFileSystem, l as setSnapshotSpanAttributes, n as isMissingError, o as stopSession, r as resolve$1, s as dependencies } from "./resolve-HuPG2VMB.js";
25
- import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline, n as sendNextWorkspaceSnapshotJob, r as sendWorkspaceSnapshotJob } from "./job-queue-CbdVyaCo.js";
26
- import { E as stopConversationWork } from "./store-DzRbd5VT.js";
27
- import { _ as getMcpProviderErrorAttributes, a as serviceAccountOnly, c as createMcpServiceAccountClientProvider, d as PluginMcpClient, f as McpProviderError, g as getMcpAwareTelemetryMessage, h as getMcpAwareErrorType, i as serviceAccountAllows, l as getMcpServiceAccountCredentials, m as McpToolError, p as McpServiceAccountRequiredError, u as McpAuthorizationRequiredError, v as toMcpProviderError } from "./service-account-Ko1Xs--F.js";
20
+ import { o as fenceLock, r as getStateAdapter, s as withLock } from "./adapter-Bx_1B2De.js";
21
+ import { C as SANDBOX_DATA_ROOT, D as sandboxSkillDir, E as SANDBOX_WORKSPACE_ROOT, O as sandboxSkillFile, S as runNonInteractiveCommand, T as SANDBOX_SKILLS_ROOT, _ as workspaceSnapshotNotReadyUserMessage, a as isAbortError, b as buildCommandScript, c as isSandboxCommandStreamInterruptedError, d as isSnapshottingError, f as throwSandboxOperationError, g as isWorkspaceSnapshotNotReadyError, h as getWorkspaceSnapshotNotReadyError, i as ensureDockerDaemon, k as sandboxSkillPathResolution, l as isSandboxMissingError, m as WorkspaceSnapshotNotReadyError, n as hash, o as isAlreadyExistsError, p as wrapSandboxSetupError, r as isStale, s as isSandboxApiTransientError, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as SANDBOX_REPOS_ROOT, x as buildNonInteractiveShellScript, y as sleep } from "./profile-CthM2qFM.js";
22
+ import { a as isNoReplyMarker, i as NO_REPLY_MARKER, n as getAssistantReplyText, r as sanitizeAssistantText, t as decideReply } from "./assistant-reply-CQcMaWNL.js";
23
+ import { A as requireSupportedEventMatch, B as readAutomationResult, C as eventNamespaceSchema, D as registeredEventTypeSchema, E as registeredEventMatchSchema, I as FINISH_AUTOMATION_RUN_TOOL_NAME, L as automationResultSchema, O as registeredResourceTypeSchema, T as pluginSupportsEvent, V as remindMissingAutomationResult, _ as WORKSPACE_SNAPSHOT_FAILED_EVENT, b as workspaceSnapshotWatch, d as getEventCatalog, k as requireEventIdentifier, n as markConversationsStopped, o as enqueueEventNotification, p as requireSlackChannelMessageScope, t as getConversationStoppedAtMs, v as WORKSPACE_SNAPSHOT_READY_EVENT, w as hasEventCatalogEntries, x as automationEventCatalog, y as workspaceSnapshotFinishedEvent } from "./session-stop-Boj_zpTa.js";
24
+ import { a as createSandboxSession, c as postinstall, d as getSandboxResources, i as bindSandboxFileSystem, l as setSnapshotSpanAttributes, n as isMissingError, o as stopSession, r as resolve$1, s as dependencies } from "./resolve-B5eLRl0v.js";
25
+ import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline, n as sendNextWorkspaceSnapshotJob, r as sendWorkspaceSnapshotJob } from "./job-queue-BjQdSqA3.js";
26
+ import { E as stopConversationWork } from "./store-B6KqcdCQ.js";
27
+ import { _ as getMcpProviderErrorAttributes, a as serviceAccountOnly, c as createMcpServiceAccountClientProvider, d as PluginMcpClient, f as McpProviderError, g as getMcpAwareTelemetryMessage, h as getMcpAwareErrorType, i as serviceAccountAllows, l as getMcpServiceAccountCredentials, m as McpToolError, p as McpServiceAccountRequiredError, u as McpAuthorizationRequiredError, v as toMcpProviderError } from "./service-account-Ch1uIpnR.js";
28
28
  import { F as taskOutcomeInputSchema, M as compileScheduleIntent, N as scheduleIntentSchema, O as automationInstructionToolSchema, T as SCHEDULED_AUTOMATION_SYSTEM_ACTOR, j as ScheduleIntentError, k as automationTitleSchema } from "./automation-DrpcA-SX.js";
29
29
  import { n as privateTraceResultAttributes } from "./private-trace-result-CE7_lEdq.js";
30
30
  import { streamSimple } from "@earendil-works/pi-ai/compat";
@@ -1897,11 +1897,12 @@ function buildBehaviorSection(platform, mode) {
1897
1897
  renderRuleSection("failure-handling", automation ? AUTOMATION_FAILURE_RULES : mode === "child_agent" ? CHILD_AGENT_FAILURE_RULES : FAILURE_RULES)
1898
1898
  ].join("\n\n");
1899
1899
  }
1900
+ const SLACK_MARKDOWN_RULES = ["- Use Slack-flavored Markdown: **bold** section labels, `code`, [text](url) links, bullet lists, and fenced code blocks. No hash-prefixed headings and no tables.", "- Write a Slack channel as `<#C…>` when you already know its ID, so Slack renders a channel link. Do not look up an ID only for formatting. When the ID is unknown, write plain `#name` and never invent an ID."];
1900
1901
  function buildAutomationOutputSection(platform) {
1901
1902
  return [
1902
1903
  platform === "slack" ? `<output format="slack-markdown">` : `<output format="markdown">`,
1903
1904
  "- Follow any format in the instruction. Otherwise keep the message as short as the job allows, and do not describe the run.",
1904
- platform === "slack" ? "- Use Slack-flavored Markdown: **bold** section labels, `code`, [text](url) links, bullet lists, and fenced code blocks. No hash-prefixed headings and no tables." : "- Use concise Markdown: short paragraphs, bullets, links, and fenced code blocks.",
1905
+ ...platform === "slack" ? SLACK_MARKDOWN_RULES : ["- Use concise Markdown: short paragraphs, bullets, links, and fenced code blocks."],
1905
1906
  "</output>"
1906
1907
  ].join("\n");
1907
1908
  }
@@ -1925,7 +1926,7 @@ function buildOutputSection(platform, mode) {
1925
1926
  `<output format="slack-markdown">`,
1926
1927
  "- Default to the shortest complete reply—usually 1–5 sentences and under 800 characters. Include only the outcome, decisive evidence, and any blocker or required next action. If useful detail would exceed that, put it in a Slack canvas and reply with the link. An explicit user request for detail overrides this target.",
1927
1928
  "- Start with the answer or result, not internal process narration.",
1928
- "- Use Slack-flavored Markdown: **bold** section labels, `code`, [text](url) links, bullet lists, and fenced code blocks. No hash-prefixed headings and no tables.",
1929
+ ...SLACK_MARKDOWN_RULES,
1929
1930
  "- End every turn with a final user-facing markdown response unless the Slack action rules allow a no-reply completion.",
1930
1931
  "</output>"
1931
1932
  ].join("\n");
@@ -18794,7 +18795,7 @@ function createAgentRunner(execute, options) {
18794
18795
  } } : void 0
18795
18796
  };
18796
18797
  if (run.instruction.storedAttachments?.length) {
18797
- const { loadInputImages } = await import("./images-BBmDXQCB.js").then((n) => n.n);
18798
+ const { loadInputImages } = await import("./images-D1JggcVY.js").then((n) => n.n);
18798
18799
  const storage = nextRun.environment?.attachmentStorage;
18799
18800
  if (!storage) throw new Error("Attachment storage is unavailable.");
18800
18801
  nextRun.instruction = {
package/dist/api.js CHANGED
@@ -1,29 +1,29 @@
1
- import { D as AutomationConflictError, E as sameDefinitionValue, L as loadTurnProjection, O as automationRevision, S as automationDefinition, T as readAutomationVersion, a as saveScheduledAutomation, bn as createUserTokenStore, k as requireAutomationRevision, rr as piMessageFromHistoryItem, v as saveEventAutomation, y as setEventAutomationStatus } from "./tasks-CjrS098O.js";
2
- import { p as escapeXml } from "./client-JeyzRwsT.js";
3
- import { f as logException, m as logWarn, p as logInfo } from "./logging-DSMmkHXG.js";
1
+ import { D as AutomationConflictError, E as sameDefinitionValue, L as loadTurnProjection, O as automationRevision, S as automationDefinition, T as readAutomationVersion, a as saveScheduledAutomation, bn as createUserTokenStore, k as requireAutomationRevision, rr as piMessageFromHistoryItem, v as saveEventAutomation, y as setEventAutomationStatus } from "./tasks-uCfmlWga.js";
2
+ import { p as escapeXml } from "./client-2i0JJpoC.js";
3
+ import { f as logException, m as logWarn, p as logInfo } from "./logging-BLTa7R7f.js";
4
4
  import { d as parseSlackTeamId, g as parseSlackMessageTs, l as parseSlackChannelId } from "./actor-tlxzqaRe.js";
5
- import { C as addAgentTurnUsage, D as hasAgentTurnUsage, E as agentTurnUsageSchema, O as resolveRootConversationId, S as parseSessionSource, c as getConversationEventStore, d as getDb, f as getSqlExecutor, h as loadConversationSlackTenantIds, i as resolveViewerUser, m as withConversationEventLock, o as updateViewerDisplayName, t as findUserByEmail, u as getConversationStore, v as locationFromRow } from "./viewer-C-J0ewlH.js";
5
+ import { C as addAgentTurnUsage, D as hasAgentTurnUsage, E as agentTurnUsageSchema, O as resolveRootConversationId, S as parseSessionSource, c as getConversationEventStore, d as getDb, f as getSqlExecutor, h as loadConversationSlackTenantIds, i as resolveViewerUser, m as withConversationEventLock, o as updateViewerDisplayName, t as findUserByEmail, u as getConversationStore, v as locationFromRow } from "./viewer-C5xFaYVi.js";
6
6
  import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-Qfz7dWgU.js";
7
- import { f as juniorConversationBriefs, g as juniorApiTokens, h as juniorConversationEvents, m as juniorConversationMetrics, u as juniorConversationParticipants, v as juniorCodeChanges, y as juniorCodeRepositories } from "./executor-BoGNVEDn.js";
7
+ import { f as juniorConversationBriefs, g as juniorApiTokens, h as juniorConversationEvents, m as juniorConversationMetrics, u as juniorConversationParticipants, v as juniorCodeChanges, y as juniorCodeRepositories } from "./executor-Rimyj8HZ.js";
8
8
  import { d as contextProvenance } from "./history-AY8rs-FR.js";
9
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Bpcs2b2L.js";
10
- import { F as AutomationEditError, I as eventAutomationTriggerAvailable, P as editEventAutomation, R as resolveTaskOutcomes, S as readLiveAttachment, T as parseSlackThreadId, U as listChildAgents, _t as conversationSubtreeColumns, gt as conversationSubtree, j as editScheduledAutomation, m as readStats, rt as getChildAgentLabel } from "./agent-runner-DvTUyGTY.js";
11
- import { At as conversationHasParticipantUser, C as WorkspaceValidationError, Dt as conversationArchivedForEmail, Et as conversationArchiveTimes, Ft as readLatestConversationBrief, Gt as listConversationAnnotations, It as readConversationEventPage, Kt as listConversationAnnotationsById, Lt as buildSentryConversationUrl, M as workspaceRepoCheckoutPath, Mt as conversationNotArchivedForUser, Nt as viewerConversationMembership, O as SANDBOX_RUNTIME, Ot as conversationArchivedForUser, S as updateWorkspace, Tt as readConversationAccessFromSql, Yt as lookupSlackUser, _ as deleteWorkspace, b as listWorkspaces, ct as getSlackClient, g as createWorkspace, jt as conversationNotArchivedForEmail, kt as conversationHasParticipantEmail, pt as withSlackRetries, u as getPlugins, v as getWorkspace, wt as createPluginLogger, x as listWorkspacesByRepository } from "./agent-hooks-V4Hfc2tB.js";
9
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-cd60vzAB.js";
10
+ import { F as AutomationEditError, I as eventAutomationTriggerAvailable, P as editEventAutomation, R as resolveTaskOutcomes, S as readLiveAttachment, T as parseSlackThreadId, U as listChildAgents, _t as conversationSubtreeColumns, gt as conversationSubtree, j as editScheduledAutomation, m as readStats, rt as getChildAgentLabel } from "./agent-runner-g110-xgg.js";
11
+ import { At as conversationIsMemberRoot, C as WorkspaceValidationError, Dt as conversationArchivedForEmail, Et as conversationArchiveTimes, Ft as readLatestConversationBrief, Gt as listConversationAnnotations, It as readConversationEventPage, Kt as listConversationAnnotationsById, Lt as buildSentryConversationUrl, M as workspaceRepoCheckoutPath, Mt as conversationNotArchivedForUser, Nt as viewerConversationMembership, O as SANDBOX_RUNTIME, Ot as conversationArchivedForUser, S as updateWorkspace, Tt as readConversationAccessFromSql, Yt as lookupSlackUser, _ as deleteWorkspace, b as listWorkspaces, ct as getSlackClient, g as createWorkspace, jt as conversationNotArchivedForEmail, kt as conversationHasParticipantUser, pt as withSlackRetries, u as getPlugins, v as getWorkspace, wt as createPluginLogger, x as listWorkspacesByRepository } from "./agent-hooks-ghyZZQqB.js";
12
12
  import { t as getFirstRunAtMs } from "./cadence-R7Em4RjE.js";
13
13
  import { A as forkConversationResponseSchema, B as readMessageAttachments, D as createConversationBodySchema, O as createConversationMessageBodySchema, V as INPUT_IMAGE_TYPES, _ as conversationParamsSchema, a as cancelConversationPendingMessagesBodySchema, c as conversationAttachmentParamsSchema, d as conversationDetailReportSchema, g as conversationFeedSchema, h as conversationFeedQuerySchema, i as archiveConversationResponseSchema, k as forkConversationBodySchema, m as conversationEventsQuerySchema, o as cancelConversationPendingMessagesResponseSchema, p as conversationEventPageSchema, r as archiveConversationBodySchema, t as acceptedConversationMessageSchema, u as conversationDetailQuerySchema, x as conversationPendingMessagesReportSchema } from "./conversation-CvuKJ3tA.js";
14
- import { n as hash, t as create } from "./profile-ByWkAY7L.js";
15
- import { d as getEventCatalog, x as automationEventCatalog } from "./session-stop-HfKx-pky.js";
16
- import { d as getSandboxResources, t as getCachedSnapshot } from "./resolve-HuPG2VMB.js";
17
- import { a as getVercelConversationWorkQueue } from "./job-queue-CbdVyaCo.js";
18
- import { a as cancelHumanFacingPendingMessages, h as getConversation } from "./store-DzRbd5VT.js";
19
- import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-Ko1Xs--F.js";
14
+ import { n as hash, t as create } from "./profile-CthM2qFM.js";
15
+ import { d as getEventCatalog, x as automationEventCatalog } from "./session-stop-Boj_zpTa.js";
16
+ import { d as getSandboxResources, t as getCachedSnapshot } from "./resolve-B5eLRl0v.js";
17
+ import { a as getVercelConversationWorkQueue } from "./job-queue-BjQdSqA3.js";
18
+ import { a as cancelHumanFacingPendingMessages, h as getConversation } from "./store-B6KqcdCQ.js";
19
+ import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-Ch1uIpnR.js";
20
20
  import { M as compileScheduleIntent, P as weekdaySchema, _ as automationSummarySchema, b as automationVersionListSchema, c as automationLifecycleSchema, d as automationParamsSchema, f as automationRunListSchema, g as automationSchedulePreviewSchema, h as automationScheduleIntentSchema, i as automationExecutionListSchema, j as ScheduleIntentError, l as automationListQuerySchema, n as automationEditSchema, r as automationEventCatalogSchema, t as automationEditErrorSchema, u as automationListSchema, v as automationUpdateSchema, x as automationVersionParamsSchema, y as automationVersionActivateSchema } from "./automation-DrpcA-SX.js";
21
21
  import { C as skillReportsSchema, a as fillUtcHours, b as pluginsSchema, c as sumUtcHoursIntoSixHours, d as trailingUtcSixHourWindow, f as utcDayKey, h as pluginOperationalReportFeedSchema, i as fillUtcDays, l as trailingUtcDayWindow, m as healthReportSchema, n as DAY_MS$1, o as fillUtcSixHours, p as utcHourKey, r as HOUR_MS$1, s as startOfUtcHour, u as trailingUtcHourWindow, x as runtimeInfoReportSchema } from "./web-message-id-CJSUiksE.js";
22
- import { B as readHealthReport, I as createVercelAttachmentStorage, _ as readViewerAutomationRuns, a as recordWebConversationActivity, b as readViewerAutomations, d as resolveSlackConversationContextFromThreadId, g as readViewerAutomationExecutions, h as readConversationSourceTask, i as createConversationId, k as stopConversationTurn, l as getProductionSlackAdapter, m as deleteViewerTask, o as webActorFromEmail, p as ViewerTaskNotFoundError, r as createAndEnqueueConversation, t as appendAndEnqueueWebMessage, u as formatSlackConversationRedactedLabel, v as readViewerAutomationSummary, w as clearSlackPendingReactions, x as resolveViewerTaskCandidate, y as readViewerAutomationVersions } from "./web-input-C_xB3RXp.js";
23
- import { F as conversationAggregateColumns, I as conversationRangeColumns, M as readAutomationTitlesByConversationId, P as conversationActiveDaysColumn } from "./task-runner-DGnd_B5X.js";
24
- import { d as legacyWebMailboxMetadataSchema } from "./result-DS7V4a3-.js";
25
- import { a as startConnection, l as getWebAuthorization, n as isConnectableProvider, r as listConnections, t as disconnectConnection, u as htmlCallbackResponse } from "./connections-CZ7HhEmN.js";
26
- import { t as decodeInputImages } from "./images-BBmDXQCB.js";
22
+ import { B as readHealthReport, I as createVercelAttachmentStorage, _ as readViewerAutomationRuns, a as recordWebConversationActivity, b as readViewerAutomations, d as resolveSlackConversationContextFromThreadId, g as readViewerAutomationExecutions, h as readConversationSourceTask, i as createConversationId, k as stopConversationTurn, l as getProductionSlackAdapter, m as deleteViewerTask, o as webActorFromEmail, p as ViewerTaskNotFoundError, r as createAndEnqueueConversation, t as appendAndEnqueueWebMessage, u as formatSlackConversationRedactedLabel, v as readViewerAutomationSummary, w as clearSlackPendingReactions, x as resolveViewerTaskCandidate, y as readViewerAutomationVersions } from "./web-input-D6eqfXYd.js";
23
+ import { F as conversationAggregateColumns, I as conversationRangeColumns, M as readAutomationTitlesByConversationId, P as conversationActiveDaysColumn } from "./task-runner-BAX5li9a.js";
24
+ import { d as legacyWebMailboxMetadataSchema } from "./result-Cvm0GZCv.js";
25
+ import { a as startConnection, l as getWebAuthorization, n as isConnectableProvider, r as listConnections, t as disconnectConnection, u as htmlCallbackResponse } from "./connections-DrtTrwkp.js";
26
+ import { t as decodeInputImages } from "./images-D1JggcVY.js";
27
27
  import { A as activityHours$1, C as personParamsSchema, D as locationDirectoryReportSchema, E as locationDetailReportSchema, H as codePersonReportSchema, I as disconnectConnectionResponseSchema, J as stopConversationTurnResponseSchema, L as startConnectionResponseSchema, N as connectionListSchema, O as locationParamsSchema, P as connectionParamsSchema, S as actorProfileReportSchema, U as codeRepositoryParamsSchema, V as codeOverviewReportSchema, W as codeRepositoryReportSchema, X as apiErrorSchema, Y as conversationStatsReportSchema, _ as personalTokenListSchema, a as workspaceBodySchema, b as revokePersonalTokenResponseSchema, d as serviceAccountListSchema, f as serviceAccountParamsSchema, g as createdPersonalTokenSchema, h as createPersonalTokenBodySchema, i as deleteWorkspaceResponseSchema, j as activitySixHours$1, k as activityDays$1, l as workspaceSchema, m as startServiceAccountSignInResponseSchema, n as statsReportSchema, o as workspaceListSchema, q as conversationChildAgentsReportSchema, s as workspaceParamsSchema, u as disconnectServiceAccountResponseSchema, w as personalSpendReportSchema, x as actorDirectoryReportSchema, y as personalTokenParamsSchema } from "./schema-OzL8Zw4H.js";
28
28
  import { Hono } from "hono";
29
29
  import path from "node:path";
@@ -1346,14 +1346,8 @@ async function readConversationParticipants(db, conversationIds) {
1346
1346
  const CONVERSATION_FEED_LIMIT = 50;
1347
1347
  function conversationFeedMembershipFilter(status, filter) {
1348
1348
  if (!filter) return status === "archived" ? sql`false` : void 0;
1349
- if (filter.kind === "viewer") return and(viewerConversationMembership({
1350
- actorMatch: eq(juniorIdentities.userId, filter.userId),
1351
- participantMatch: conversationHasParticipantUser(filter.userId)
1352
- }), status === "archived" ? conversationArchivedForUser(filter.userId) : status === "all" ? void 0 : conversationNotArchivedForUser(filter.userId));
1353
- return and(viewerConversationMembership({
1354
- actorMatch: eq(juniorUsers.primaryEmailNormalized, filter.email),
1355
- participantMatch: conversationHasParticipantEmail(filter.email)
1356
- }), status === "archived" ? conversationArchivedForEmail(filter.email) : status === "all" ? void 0 : conversationNotArchivedForEmail(filter.email));
1349
+ if (filter.kind === "viewer") return and(conversationIsMemberRoot({ userId: filter.userId }), status === "archived" ? conversationArchivedForUser(filter.userId) : status === "all" ? void 0 : conversationNotArchivedForUser(filter.userId));
1350
+ return and(conversationIsMemberRoot({ email: filter.email }), status === "archived" ? conversationArchivedForEmail(filter.email) : status === "all" ? void 0 : conversationNotArchivedForEmail(filter.email));
1357
1351
  }
1358
1352
  /**
1359
1353
  * Keep root conversations linked to one code repository. A code change can
@@ -2022,6 +2016,8 @@ function statsWindow(nowMs) {
2022
2016
  };
2023
2017
  }
2024
2018
  const HOUR_MS = 36e5;
2019
+ /** Keep 7d of hours so clients can roll 7d charts into 6h buckets. */
2020
+ const WINDOW_HOURS = 168;
2025
2021
  function applyMetricBuckets(rows, metrics) {
2026
2022
  const byDate = new Map(rows.map((row) => [row.date, {
2027
2023
  ...row,
@@ -2172,6 +2168,7 @@ function guardianStats(dayRows, hourRows, endMs) {
2172
2168
  }
2173
2169
  async function aggregateStats(db, start, end) {
2174
2170
  const where = statsWhere(start, end);
2171
+ const hourStart = trailingUtcHourWindow(end.getTime(), WINDOW_HOURS).start;
2175
2172
  const activityDate = sql`TO_CHAR(
2176
2173
  ${juniorConversations.lastActivityAt} AT TIME ZONE 'UTC',
2177
2174
  'YYYY-MM-DD'
@@ -2207,7 +2204,7 @@ async function aggregateStats(db, start, end) {
2207
2204
  db.select({
2208
2205
  conversations: treeAggregateColumns$1.conversations,
2209
2206
  date: activityHour
2210
- }).from(juniorConversations).innerJoin(treeConversation$1, eq(treeConversation$1.rootConversationId, juniorConversations.conversationId)).where(where).groupBy(activityHour),
2207
+ }).from(juniorConversations).innerJoin(treeConversation$1, eq(treeConversation$1.rootConversationId, juniorConversations.conversationId)).where(statsWhere(hourStart, end)).groupBy(activityHour),
2211
2208
  readConversationMetricBuckets(db, {
2212
2209
  bucket: "day",
2213
2210
  start,
@@ -2215,7 +2212,7 @@ async function aggregateStats(db, start, end) {
2215
2212
  }),
2216
2213
  readConversationMetricBuckets(db, {
2217
2214
  bucket: "hour",
2218
- start,
2215
+ start: hourStart,
2219
2216
  end
2220
2217
  })
2221
2218
  ]);
@@ -2228,6 +2225,7 @@ async function aggregateStats(db, start, end) {
2228
2225
  };
2229
2226
  }
2230
2227
  async function aggregateGuardianStats(db, start, end) {
2228
+ const hourStart = trailingUtcHourWindow(end.getTime(), WINDOW_HOURS).start;
2231
2229
  const day = sql`TO_CHAR(
2232
2230
  ${juniorConversationEvents.createdAt} AT TIME ZONE 'UTC',
2233
2231
  'YYYY-MM-DD'
@@ -2249,14 +2247,14 @@ async function aggregateGuardianStats(db, start, end) {
2249
2247
  deny: sql`COUNT(*) FILTER (WHERE ${decision} = 'deny')::integer`,
2250
2248
  requests: sql`COUNT(*)::integer`
2251
2249
  };
2252
- const where = and(eq(juniorConversationEvents.type, "guardian_action_reviewed"), gte(juniorConversationEvents.createdAt, start), lte(juniorConversationEvents.createdAt, end));
2250
+ const where = (windowStart) => and(eq(juniorConversationEvents.type, "guardian_action_reviewed"), gte(juniorConversationEvents.createdAt, windowStart), lte(juniorConversationEvents.createdAt, end));
2253
2251
  const [dayRows, hourRows] = await Promise.all([db.select({
2254
2252
  ...selectColumns,
2255
2253
  date: day
2256
- }).from(juniorConversationEvents).where(where).groupBy(day), db.select({
2254
+ }).from(juniorConversationEvents).where(where(start)).groupBy(day), db.select({
2257
2255
  ...selectColumns,
2258
2256
  date: hour
2259
- }).from(juniorConversationEvents).where(where).groupBy(hour)]);
2257
+ }).from(juniorConversationEvents).where(where(hourStart)).groupBy(hour)]);
2260
2258
  return {
2261
2259
  dayRows,
2262
2260
  hourRows
@@ -3710,7 +3708,7 @@ async function readPeoplePluginReports(args) {
3710
3708
  reports: [],
3711
3709
  source: "plugins"
3712
3710
  });
3713
- const { getPluginProfileReports } = await import("./agent-hooks-V4Hfc2tB.js").then((n) => n.t);
3711
+ const { getPluginProfileReports } = await import("./agent-hooks-ghyZZQqB.js").then((n) => n.t);
3714
3712
  return pluginOperationalReportFeedSchema.parse({
3715
3713
  generatedAt: new Date(nowMs).toISOString(),
3716
3714
  reports: await getPluginProfileReports({
@@ -4741,7 +4739,7 @@ function readDescriptionText(home) {
4741
4739
  }
4742
4740
  /** Read discovered skill names for authenticated runtime diagnostics. */
4743
4741
  async function readSkillReports() {
4744
- const { discoverSkills } = await import("./skills-D6_bcAuW.js").then((n) => n.o);
4742
+ const { discoverSkills } = await import("./skills-BpdYCfFt.js").then((n) => n.o);
4745
4743
  const skills = await discoverSkills();
4746
4744
  return skillReportsSchema.parse(skills.map((skill) => ({
4747
4745
  name: skill.name,
@@ -4750,7 +4748,7 @@ async function readSkillReports() {
4750
4748
  }
4751
4749
  /** Read safe configured plugin metadata for authenticated runtime diagnostics. */
4752
4750
  async function readPlugins() {
4753
- const { pluginCatalogRuntime } = await import("./catalog-runtime-Bpcs2b2L.js").then((n) => n.t);
4751
+ const { pluginCatalogRuntime } = await import("./catalog-runtime-cd60vzAB.js").then((n) => n.t);
4754
4752
  return pluginsSchema.parse(pluginCatalogRuntime.getProviders().map((plugin) => ({
4755
4753
  configKeys: plugin.manifest.configKeys ?? [],
4756
4754
  description: plugin.manifest.description,
@@ -4762,7 +4760,7 @@ async function readPlugins() {
4762
4760
  async function readRuntimeInfoReport() {
4763
4761
  const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
4764
4762
  import("./package-discovery-DJBompdd.js").then((n) => n.r),
4765
- import("./catalog-runtime-Bpcs2b2L.js").then((n) => n.t),
4763
+ import("./catalog-runtime-cd60vzAB.js").then((n) => n.t),
4766
4764
  readPlugins(),
4767
4765
  readSkillReports()
4768
4766
  ]);
@@ -4779,7 +4777,7 @@ async function readRuntimeInfoReport() {
4779
4777
  /** Read sanitized operational summaries contributed by plugins. */
4780
4778
  async function readPluginOperationalReportFeed() {
4781
4779
  const nowMs = Date.now();
4782
- const { getPluginOperationalReports } = await import("./agent-hooks-V4Hfc2tB.js").then((n) => n.t);
4780
+ const { getPluginOperationalReports } = await import("./agent-hooks-ghyZZQqB.js").then((n) => n.t);
4783
4781
  return pluginOperationalReportFeedSchema.parse({
4784
4782
  source: "plugins",
4785
4783
  generatedAt: new Date(nowMs).toISOString(),
@@ -251,6 +251,11 @@ interface JuniorAppOptions extends BotModelConfig {
251
251
  * `JUNIOR_CROSS_ACTOR_MID_RUN_MODE` or `follow_up`.
252
252
  */
253
253
  crossActorMidRunMode?: CrossActorMidRunMode;
254
+ /**
255
+ * Slack user IDs of bots that may start a Turn from a mention or DM. Bots
256
+ * have no profile email, so `allowedDomains` blocks them otherwise.
257
+ */
258
+ allowedBotUserIds?: string[];
254
259
  };
255
260
  /** Install-wide provider defaults. Unregistered `provider.key` entries warn at startup. */
256
261
  configDefaults?: Record<string, unknown>;
package/dist/app.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as ModelProfileInput, n as createApp, r as JuniorDashboardOptions, t as JuniorAppOptions } from "./app-BsBUs3rF.js";
1
+ import { i as ModelProfileInput, n as createApp, r as JuniorDashboardOptions, t as JuniorAppOptions } from "./app-VCiPQ65Q.js";
2
2
  import { i as defineJuniorPlugins, n as JuniorPluginSet, r as JuniorPluginSetOptions, t as JuniorPluginInput } from "./plugins-B_0Cr0MO.js";
3
3
  import { t as JUNIOR_VERSION } from "./version-Cc2OFd9G.js";
4
4
  export { JUNIOR_VERSION, JuniorAppOptions, type JuniorDashboardOptions, type JuniorPluginInput, type JuniorPluginSet, type JuniorPluginSetOptions, type ModelProfileInput, createApp, defineJuniorPlugins };
package/dist/app.js CHANGED
@@ -1,37 +1,37 @@
1
- import { $ as projectConversationMessages, C as automationVersionOf, Cn as resolveSandboxEgressProviderForHost, Dn as clearSandboxEgressSignals, En as SANDBOX_EGRESS_PROXY_PATH, Hn as slackMention, In as resolveBaseUrl, Ln as startOAuthFlow, On as consumeSandboxEgressAuthRequiredSignal, Pn as formatProviderLabel, Tn as shouldPropagateSandboxEgressTrace, X as appendConversationMessages, Xn as slackEntitySchema, Zn as slackExternalRefIdSchema, _n as isExperimentalFeatureEnabled, ar as setConfigDefaults, b as admitEventAutomationRun, bn as createUserTokenStore, c as withScheduledAutomationLock, cn as SubscribedReplyReason, dn as getThreadStopDecision, gn as getExperimentalFeatures, i as readScheduledAutomation, ir as getConfigDefaults, jn as parseSandboxEgressCredentialToken, kn as consumeSandboxEgressPermissionDeniedSignal, l as blockEventAutomation, n as listScheduledAutomationsForTeam, nt as settleConversationTitleWork, o as saveScheduledAutomationInLock, p as findMatchingEventAutomations, s as scheduledRunId, u as collectEventAutomationMatchKeys, vn as setExperimentalFeatures, wn as normalizeSandboxEgressTracePropagationDomains, x as eventAutomationRunLimitReason, yn as executeCredentialedEgressRequest } from "./tasks-CjrS098O.js";
2
- import { C as withContext, M as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, R as normalizeIdentityEmail, T as withSpan, b as setSpanStatus, f as logException, k as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, m as logWarn, p as logInfo, r as createRequestContext, v as setSentryUser, w as withLogContext, y as setSpanAttributes } from "./logging-DSMmkHXG.js";
1
+ import { $ as projectConversationMessages, C as automationVersionOf, Cn as resolveSandboxEgressProviderForHost, Dn as clearSandboxEgressSignals, En as SANDBOX_EGRESS_PROXY_PATH, Hn as slackMention, In as resolveBaseUrl, Ln as startOAuthFlow, On as consumeSandboxEgressAuthRequiredSignal, Pn as formatProviderLabel, Tn as shouldPropagateSandboxEgressTrace, X as appendConversationMessages, Xn as slackEntitySchema, Zn as slackExternalRefIdSchema, _n as isExperimentalFeatureEnabled, ar as setConfigDefaults, b as admitEventAutomationRun, bn as createUserTokenStore, c as withScheduledAutomationLock, cn as SubscribedReplyReason, dn as getThreadStopDecision, gn as getExperimentalFeatures, i as readScheduledAutomation, ir as getConfigDefaults, jn as parseSandboxEgressCredentialToken, kn as consumeSandboxEgressPermissionDeniedSignal, l as blockEventAutomation, n as listScheduledAutomationsForTeam, nt as settleConversationTitleWork, o as saveScheduledAutomationInLock, p as findMatchingEventAutomations, s as scheduledRunId, u as collectEventAutomationMatchKeys, vn as setExperimentalFeatures, wn as normalizeSandboxEgressTracePropagationDomains, x as eventAutomationRunLimitReason, yn as executeCredentialedEgressRequest } from "./tasks-uCfmlWga.js";
2
+ import { C as withContext, M as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, R as normalizeIdentityEmail, T as withSpan, b as setSpanStatus, f as logException, k as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, m as logWarn, p as logInfo, r as createRequestContext, v as setSentryUser, w as withLogContext, y as setSpanAttributes } from "./logging-BLTa7R7f.js";
3
3
  import { n as captureMessage, r as continueTrace } from "./sentry-BBUlHih9.js";
4
- import { t as JUNIOR_VERSION } from "./version-Ct049vav.js";
5
- import { _ as snapshotRuntimeConfig, d as restoreRuntimeConfig, f as setBotModelConfig, g as setSlackReactionConfig, h as setRuntimeLimits, i as getChatConfig, m as setProfiles, n as botConfig, o as getSlackBotToken, p as setCrossActorMidRunMode, u as resetRuntimeConfig } from "./config-ULs6Zl9b.js";
4
+ import { t as JUNIOR_VERSION } from "./version-CN9BXMW_.js";
5
+ import { _ as snapshotRuntimeConfig, d as restoreRuntimeConfig, f as setBotModelConfig, g as setSlackReactionConfig, h as setRuntimeLimits, i as getChatConfig, m as setProfiles, n as botConfig, o as getSlackBotToken, p as setCrossActorMidRunMode, u as resetRuntimeConfig } from "./config-C9qM41O0.js";
6
6
  import { _ as slackMessageTsSchema, d as parseSlackTeamId, f as parseSlackUserId, h as slackUserIdSchema, m as slackTeamIdSchema, o as parseActorUserId, p as slackChannelIdSchema } from "./actor-tlxzqaRe.js";
7
- import { N as recordGoogleSignIn, _ as withConversationMutationLock, c as getConversationEventStore, d as getDb, f as getSqlExecutor, m as withConversationEventLock, r as readActorIdentity, u as getConversationStore } from "./viewer-C-J0ewlH.js";
7
+ import { N as recordGoogleSignIn, _ as withConversationMutationLock, c as getConversationEventStore, d as getDb, f as getSqlExecutor, m as withConversationEventLock, r as readActorIdentity, u as getConversationStore } from "./viewer-C5xFaYVi.js";
8
8
  import { a as juniorAgentInvocations, d as juniorDestinations, i as juniorAgentBindings, s as juniorConversations } from "./agent-invocations-Qfz7dWgU.js";
9
- import { a as juniorAutomationRuns, f as juniorConversationBriefs, h as juniorConversationEvents, s as juniorAutomations } from "./executor-BoGNVEDn.js";
10
- import { m as credentialLogContext } from "./registry-BL-osYWN.js";
11
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Bpcs2b2L.js";
12
- import { B as stopConversationSession, C as requestAttachmentDeletion, L as effectiveTaskOutcomes, M as logScheduledAutomationRunSkipped, N as scheduledAutomationRunAttributes, T as parseSlackThreadId, V as recordSubagentEnded, _ as unpublishedArtifactHeaders, g as readPublicArtifact, h as publicArtifactHeaders, n as executeAgentRun, ot as listPendingAgentInvocationMailboxAppends, st as listPendingAgentInvocationResults, t as createAgentRunner, v as lookupSlackUserProfile, vt as processWorkspaceSnapshotJob, x as collectAttachmentGarbage, yt as ingestEvent } from "./agent-runner-DvTUyGTY.js";
13
- import { $ as bindSlackDirectCredentialSubject, Gt as listConversationAnnotations, Ht as resolveRootVisibility, Q as bindScheduledAutomationCredentialSubject, Tt as readConversationAccessFromSql, U as collectEventMatchKeys, X as takeDueTimerWatches, Z as bindEventAutomationCredentialSubject, _t as getDashboardConversationLink, a as getPluginRoutes, bt as setDashboardConversationLinkOptions, ct as getSlackClient, d as setPlugins, et as verifyEventAutomationCredentialSubject, f as validatePlugins, h as setBriefsConfig, ht as runWithWorkspaceTeamId, i as getPluginApiRoutes, mt as getWorkspaceTeamId, nt as verifySlackDirectCredentialSubject, q as findMatchingWatches, tt as verifyScheduledAutomationCredentialSubject, u as getPlugins, ut as isDmChannel, wt as createPluginLogger, xt as createPluginState, yt as getDashboardTaskLink } from "./agent-hooks-V4Hfc2tB.js";
9
+ import { a as juniorAutomationRuns, f as juniorConversationBriefs, h as juniorConversationEvents, s as juniorAutomations } from "./executor-Rimyj8HZ.js";
10
+ import { m as credentialLogContext } from "./registry-BnSaArNb.js";
11
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-cd60vzAB.js";
12
+ import { B as stopConversationSession, C as requestAttachmentDeletion, L as effectiveTaskOutcomes, M as logScheduledAutomationRunSkipped, N as scheduledAutomationRunAttributes, T as parseSlackThreadId, V as recordSubagentEnded, _ as unpublishedArtifactHeaders, g as readPublicArtifact, h as publicArtifactHeaders, n as executeAgentRun, ot as listPendingAgentInvocationMailboxAppends, st as listPendingAgentInvocationResults, t as createAgentRunner, v as lookupSlackUserProfile, vt as processWorkspaceSnapshotJob, x as collectAttachmentGarbage, yt as ingestEvent } from "./agent-runner-g110-xgg.js";
13
+ import { $ as bindSlackDirectCredentialSubject, Gt as listConversationAnnotations, Ht as resolveRootVisibility, Q as bindScheduledAutomationCredentialSubject, Tt as readConversationAccessFromSql, U as collectEventMatchKeys, X as takeDueTimerWatches, Z as bindEventAutomationCredentialSubject, _t as getDashboardConversationLink, a as getPluginRoutes, bt as setDashboardConversationLinkOptions, ct as getSlackClient, d as setPlugins, et as verifyEventAutomationCredentialSubject, f as validatePlugins, h as setBriefsConfig, ht as runWithWorkspaceTeamId, i as getPluginApiRoutes, mt as getWorkspaceTeamId, nt as verifySlackDirectCredentialSubject, q as findMatchingWatches, tt as verifyScheduledAutomationCredentialSubject, u as getPlugins, ut as isDmChannel, wt as createPluginLogger, xt as createPluginState, yt as getDashboardTaskLink } from "./agent-hooks-ghyZZQqB.js";
14
14
  import { n as getNextRunAtMs } from "./cadence-R7Em4RjE.js";
15
15
  import { M as annotationCard } from "./conversation-CvuKJ3tA.js";
16
- import { r as getStateAdapter, s as withLock$1 } from "./adapter-Dj5BTJRd.js";
17
- import { M as renderTaskInput, S as eventGuidance, d as getEventCatalog, f as SLACK_EVENT_NAMESPACE, g as slackChannelMessageRunsAutomation, h as slackChannelMessageReplyThreadTs, m as slackChannelMessageEvent } from "./session-stop-HfKx-pky.js";
18
- import { f as setSandboxResourceConfig, u as getSandboxResourceConfig } from "./resolve-HuPG2VMB.js";
19
- import { a as getVercelConversationWorkQueue, g as isConversationQueueMessageRejectedError, h as conversationQueueMessageSchema, i as verifyWorkspaceSnapshotJobMessage, o as resolveConversationWorkQueueTopic, s as verifyConversationQueueMessage, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-CbdVyaCo.js";
20
- import { A as hasRunnableConversationWork$1, M as isInvalidConversationRecordError, O as CONVERSATION_WORK_STALE_ENQUEUE_MS, S as removeActiveConversation, _ as hasRunnableConversationWork, c as clearExpiredConversationLease, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, v as listActiveConversationIds } from "./store-DzRbd5VT.js";
16
+ import { r as getStateAdapter, s as withLock$1 } from "./adapter-Bx_1B2De.js";
17
+ import { M as renderTaskInput, S as eventGuidance, d as getEventCatalog, f as SLACK_EVENT_NAMESPACE, g as slackChannelMessageRunsAutomation, h as slackChannelMessageReplyThreadTs, m as slackChannelMessageEvent } from "./session-stop-Boj_zpTa.js";
18
+ import { f as setSandboxResourceConfig, u as getSandboxResourceConfig } from "./resolve-B5eLRl0v.js";
19
+ import { a as getVercelConversationWorkQueue, g as isConversationQueueMessageRejectedError, h as conversationQueueMessageSchema, i as verifyWorkspaceSnapshotJobMessage, o as resolveConversationWorkQueueTopic, s as verifyConversationQueueMessage, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-BjQdSqA3.js";
20
+ import { A as hasRunnableConversationWork$1, M as isInvalidConversationRecordError, O as CONVERSATION_WORK_STALE_ENQUEUE_MS, S as removeActiveConversation, _ as hasRunnableConversationWork, c as clearExpiredConversationLease, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, v as listActiveConversationIds } from "./store-B6KqcdCQ.js";
21
21
  import { D as scheduledRunSchema } from "./automation-DrpcA-SX.js";
22
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-BrXMYPyo.js";
22
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-B9KL_5Wc.js";
23
23
  import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-DOm9Y6qI.js";
24
- import { A as THREAD_OPTOUT_ACK, C as buildSlackInboundMessage, D as normalizeIncomingSlackThreadId, E as stopSlackThread, F as renderSlackObjectCard, I as createVercelAttachmentStorage, M as parseContent, N as runWithSlackInstallation, O as withNormalizedThreadId, P as verifySlackSignature, R as enqueueAgentDispatch, S as recordSkippedConversationMessage, T as isSlackMessageStopped, a as recordWebConversationActivity, c as createProductionSlackWebhookServices, f as createSlackWebApiStatusSender, j as startProcessingReaction, k as stopConversationTurn, l as getProductionSlackAdapter, n as conversationTurnIdForMessage, o as webActorFromEmail, s as createProductionConversationWorkOptions, t as appendAndEnqueueWebMessage, v as readViewerAutomationSummary, w as clearSlackPendingReactions, z as GET$3 } from "./web-input-C_xB3RXp.js";
25
- import { C as existingConversationId, N as recordAutomationExecution, c as getDispatchConversationId, d as getDispatchRecord, h as listPendingDispatchMailboxAppends, i as buildDispatchId, m as isTerminalDispatchStatus, o as confirmDispatchMailboxAppend, p as getPluginDispatchProjection, s as createOrGetDispatch, t as processPluginTask, x as notifyAutomationBlocked, y as markDispatchFailed } from "./task-runner-DGnd_B5X.js";
26
- import { o as getAuthPausedConversationTurnId, t as enqueueAgentInvocationResult } from "./result-DS7V4a3-.js";
27
- import { r as enqueueAgentInvocation } from "./work-D829Ue7k.js";
28
- import { s as coerceThreadConversationState } from "./thread-state-CqkYowEz.js";
29
- import { o as unlinkProvider } from "./connections-CZ7HhEmN.js";
30
- import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-BKcv5rBe.js";
31
- import { a as registerVercelPluginTaskDevConsumer, n as createVercelPluginTaskCallback, s as queueCallback } from "./task-queue-9LICOzcL.js";
32
- import { t as processConversationWork } from "./worker-BRTYzlpk.js";
33
- import { t as bindMessageAgent } from "./message-zaj5gBbS.js";
34
- import { t as bindSpawnAgent } from "./spawn-BWqK6EwM.js";
24
+ import { A as THREAD_OPTOUT_ACK, C as buildSlackInboundMessage, D as normalizeIncomingSlackThreadId, E as stopSlackThread, F as renderSlackObjectCard, I as createVercelAttachmentStorage, M as parseContent, N as runWithSlackInstallation, O as withNormalizedThreadId, P as verifySlackSignature, R as enqueueAgentDispatch, S as recordSkippedConversationMessage, T as isSlackMessageStopped, a as recordWebConversationActivity, c as createProductionSlackWebhookServices, f as createSlackWebApiStatusSender, j as startProcessingReaction, k as stopConversationTurn, l as getProductionSlackAdapter, n as conversationTurnIdForMessage, o as webActorFromEmail, s as createProductionConversationWorkOptions, t as appendAndEnqueueWebMessage, v as readViewerAutomationSummary, w as clearSlackPendingReactions, z as GET$3 } from "./web-input-D6eqfXYd.js";
25
+ import { C as existingConversationId, N as recordAutomationExecution, c as getDispatchConversationId, d as getDispatchRecord, h as listPendingDispatchMailboxAppends, i as buildDispatchId, m as isTerminalDispatchStatus, o as confirmDispatchMailboxAppend, p as getPluginDispatchProjection, s as createOrGetDispatch, t as processPluginTask, x as notifyAutomationBlocked, y as markDispatchFailed } from "./task-runner-BAX5li9a.js";
26
+ import { o as getAuthPausedConversationTurnId, t as enqueueAgentInvocationResult } from "./result-Cvm0GZCv.js";
27
+ import { r as enqueueAgentInvocation } from "./work-C-ecZAme.js";
28
+ import { s as coerceThreadConversationState } from "./thread-state-BJHVIz8G.js";
29
+ import { o as unlinkProvider } from "./connections-DrtTrwkp.js";
30
+ import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-wKNQ1dYc.js";
31
+ import { a as registerVercelPluginTaskDevConsumer, n as createVercelPluginTaskCallback, s as queueCallback } from "./task-queue-BaDwKSYv.js";
32
+ import { t as processConversationWork } from "./worker-BpYDqiOf.js";
33
+ import { t as bindMessageAgent } from "./message-DAeP5WWW.js";
34
+ import { t as bindSpawnAgent } from "./spawn-h1DJMQTf.js";
35
35
  import { createRequire } from "node:module";
36
36
  import { Hono } from "hono";
37
37
  import { z } from "zod";
@@ -2396,12 +2396,14 @@ const NOT_ALLOWED_TTL_MS = 3e4;
2396
2396
  /**
2397
2397
  * Return whether a Slack author may start a Turn. With allowed domains, the
2398
2398
  * email of the author's Slack profile must be on one of them. Slack verifies
2399
- * that email, so Junior trusts it. Without allowed domains, every author may.
2399
+ * that email, so Junior trusts it. Bots have no profile email, so the allowed
2400
+ * bot user IDs skip this check. Without allowed domains, every author may.
2400
2401
  */
2401
2402
  async function isSlackAuthorDomainAllowed(args) {
2402
2403
  if (args.allowedDomains.length === 0) return true;
2403
2404
  const userId = parseSlackUserId(args.user);
2404
2405
  if (!args.teamId || !userId) return false;
2406
+ if (args.allowedBotUserIds.includes(userId)) return true;
2405
2407
  const key = `slack:allowed-domain:${args.teamId}:${userId}`;
2406
2408
  const cached = await args.state.get(key);
2407
2409
  if (typeof cached === "boolean") return cached;
@@ -2835,6 +2837,7 @@ async function routeParsedMessage(args) {
2835
2837
  return;
2836
2838
  }
2837
2839
  if (route === "mention" && !await isSlackAuthorDomainAllowed({
2840
+ allowedBotUserIds: args.allowedBotUserIds,
2838
2841
  allowedDomains: args.allowedDomains,
2839
2842
  state: args.state,
2840
2843
  teamId: args.installation.teamId,
@@ -2956,6 +2959,7 @@ async function handleSlackEvent(args) {
2956
2959
  conversationStore: args.services.conversationStore,
2957
2960
  queue: args.services.queue,
2958
2961
  receivedAtMs,
2962
+ allowedBotUserIds: args.services.allowedBotUserIds ?? [],
2959
2963
  allowedDomains: args.services.allowedDomains ?? [],
2960
2964
  state
2961
2965
  }), {
@@ -5055,8 +5059,7 @@ function readGoogleClaims(idToken) {
5055
5059
  } catch {
5056
5060
  return;
5057
5061
  }
5058
- const parsed = googleClaimsSchema.safeParse(payload);
5059
- return parsed.success ? parsed.data : void 0;
5062
+ return googleClaimsSchema.safeParse(payload).success ? payload : void 0;
5060
5063
  }
5061
5064
  function trimSlashes(value, leading) {
5062
5065
  let start = 0;
@@ -5106,7 +5109,6 @@ function createBetterAuth(config) {
5106
5109
  if (!isAllowedDomain(claims.hd, allowedDomains)) return null;
5107
5110
  return {
5108
5111
  user: {
5109
- id: claims.sub,
5110
5112
  email: claims.email,
5111
5113
  emailVerified: claims.email_verified === true,
5112
5114
  image: claims.picture,
@@ -5593,6 +5595,7 @@ async function createApp(options) {
5593
5595
  queue: conversationWorkQueue,
5594
5596
  services: runtimeServiceOverrides
5595
5597
  }),
5598
+ allowedBotUserIds: options?.slack?.allowedBotUserIds ?? [],
5596
5599
  allowedDomains
5597
5600
  };
5598
5601
  const app = new Hono();
@@ -1,4 +1,4 @@
1
- import { Gt as extractAssistantText } from "./tasks-CjrS098O.js";
1
+ import { Gt as extractAssistantText } from "./tasks-uCfmlWga.js";
2
2
  // src/chat/no-reply.ts
3
3
  const NO_REPLY_MARKER = "[[NO_REPLY]]";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { i as completeObject } from "./client-JeyzRwsT.js";
1
+ import { i as completeObject } from "./client-2i0JJpoC.js";
2
2
  import { r as defaultModelId } from "./model-profile-Bg8EoCKD.js";
3
3
  import { J as parseBriefInput, W as briefCodeChangeSchema, d as conversationDetailReportSchema, p as conversationEventPageSchema } from "./conversation-CvuKJ3tA.js";
4
4
  import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-DeVax2qO.js";
@@ -267,7 +267,7 @@ async function parseRunOptions(argv) {
267
267
  * `DATABASE_URL` at import, and `briefs pull` must work with only a token.
268
268
  */
269
269
  async function configuredDefaultModelId() {
270
- const { botConfig } = await import("./config-ULs6Zl9b.js").then((n) => n.r);
270
+ const { botConfig } = await import("./config-C9qM41O0.js").then((n) => n.r);
271
271
  return defaultModelId(botConfig);
272
272
  }
273
273
  function apiUrl(baseUrl, pathname) {
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { t as createPluginCatalogRuntime } from "./registry-BL-osYWN.js";
2
+ import { t as createPluginCatalogRuntime } from "./registry-BnSaArNb.js";
3
3
  // src/chat/plugins/catalog-runtime.ts
4
4
  var catalog_runtime_exports = /* @__PURE__ */ __exportAll({ pluginCatalogRuntime: () => pluginCatalogRuntime });
5
5
  const pluginCatalogRuntime = createPluginCatalogRuntime();