@sentry/junior 0.257.0 → 0.259.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 (104) hide show
  1. package/dist/{actor-BTtLaeWy.js → actor-tlxzqaRe.js} +3 -6
  2. package/dist/adapter-Bn0gFVSF.js +270 -0
  3. package/dist/{admin-DgIkm6Vy.js → admin-C8xz2f10.js} +2 -3
  4. package/dist/{agent-hooks-BjtTzvru.js → agent-hooks-B00FaKdP.js} +70 -109
  5. package/dist/{agent-invocations-Bdu3ROfo.js → agent-invocations-Qfz7dWgU.js} +6 -12
  6. package/dist/{agent-runner-D7OboVb3.js → agent-runner-CPSd7rKm.js} +324 -742
  7. package/dist/api/schema.d.ts +442 -447
  8. package/dist/api/schema.js +6 -6
  9. package/dist/api.d.ts +2 -12
  10. package/dist/api.js +165 -158
  11. package/dist/{app-BsU5QNBd.d.ts → app-Bbxrehjf.d.ts} +25 -45
  12. package/dist/app.d.ts +3 -3
  13. package/dist/app.js +206 -321
  14. package/dist/{assistant-reply-CbTPebzL.js → assistant-reply-CqthTerd.js} +3 -5
  15. package/dist/{automation-CHdlHVZP.js → automation-DWBFBenG.js} +6 -11
  16. package/dist/{briefs-oLOldnDM.js → briefs-DNYbQ9cD.js} +8 -11
  17. package/dist/{cadence-D00SCzT1.js → cadence-R7Em4RjE.js} +1 -2
  18. package/dist/{catalog-runtime-CZzhGQ7F.js → catalog-runtime-B8SuFPGb.js} +3 -4
  19. package/dist/cli/chat.d.ts +2 -4
  20. package/dist/cli/chat.js +22 -24
  21. package/dist/cli/check.d.ts +1 -3
  22. package/dist/cli/check.js +4 -5
  23. package/dist/cli/env.d.ts +1 -3
  24. package/dist/cli/env.js +1 -2
  25. package/dist/cli/init.d.ts +1 -3
  26. package/dist/cli/init.js +3 -3
  27. package/dist/cli/main.d.ts +1 -3
  28. package/dist/cli/main.js +8 -5
  29. package/dist/cli/plugins.d.ts +2 -4
  30. package/dist/cli/plugins.js +7 -8
  31. package/dist/cli/run.d.ts +3 -3
  32. package/dist/cli/run.js +3 -3
  33. package/dist/cli/snapshot-create.d.ts +1 -3
  34. package/dist/cli/snapshot-create.js +5 -5
  35. package/dist/cli/upgrade.d.ts +3 -6
  36. package/dist/cli/upgrade.js +11 -17
  37. package/dist/{client-D8HnkOQX.js → client-BZdxgKyL.js} +64 -18
  38. package/dist/{config-CJRnWK9H.js → config-Deqpfpg9.js} +21 -15
  39. package/dist/{connections-ClYrKzpX.js → connections-9gJkfS85.js} +179 -20
  40. package/dist/{conversation-CKNLYBJt.js → conversation-DjN3mlog.js} +8 -15
  41. package/dist/{conversation-privacy-C8b1nphZ.js → conversation-privacy-CFhNKxp-.js} +2 -3
  42. package/dist/{conversation-work-C6y3T5Hx.js → conversation-work-BaT_T6EB.js} +1 -2
  43. package/dist/{credential-sync-BXfohNmJ.js → credential-sync-BABGymK3.js} +23 -190
  44. package/dist/{db-Ca9Nt5ci.d.ts → db-BnRqQ7G5.d.ts} +1 -1
  45. package/dist/{executor-Do0THDRR.js → executor-Bb3eQb8q.js} +30 -52
  46. package/dist/{experimental-CQIvMUO7.js → experimental-BNK1l1jv.js} +2 -4
  47. package/dist/{history-9pO1Zd4Y.js → history-AY8rs-FR.js} +5 -9
  48. package/dist/{history-DvqWZlYX.d.ts → history-BgI33Kie.d.ts} +12 -20
  49. package/dist/{images-BN_BiBXF.js → images-BbSdVHC6.js} +5 -6
  50. package/dist/instrumentation.d.ts +1 -3
  51. package/dist/instrumentation.js +6 -8
  52. package/dist/{job-queue-B6SV9uVa.js → job-queue-vdGU-5ge.js} +6 -12
  53. package/dist/{logging-CWxiIuCF.js → logging-BStXN56b.js} +7 -12
  54. package/dist/{message-TUOdbSBW.js → message-DRf6m4uO.js} +5 -6
  55. package/dist/{model-profile-BwU8mqwD.js → model-profile-Bg8EoCKD.js} +2 -4
  56. package/dist/nitro.d.ts +3 -5
  57. package/dist/nitro.js +12 -17
  58. package/dist/{oauth-authorization-BA4Dt6a7.js → oauth-authorization-djQn5Nhy.js} +2 -4
  59. package/dist/{oauth-callback-server-Dj5UJODo.js → oauth-callback-server-JmOgLcGl.js} +3 -4
  60. package/dist/{oauth-relay-CdCnu80W.js → oauth-relay-CTygMkNx.js} +2 -3
  61. package/dist/{package-discovery-BVvSnQBB.js → package-discovery-DJBompdd.js} +17 -21
  62. package/dist/{pending-auth-s_QFribU.js → pending-auth-rG5U_QS1.js} +92 -83
  63. package/dist/{plugin-module-CVvEUSMH.js → plugin-module-Cf5gVPWP.js} +1 -2
  64. package/dist/{plugins-CjfUP5gJ.d.ts → plugins-B_0Cr0MO.d.ts} +5 -5
  65. package/dist/{plugins-egKWjgue.js → plugins-DOm9Y6qI.js} +2 -3
  66. package/dist/{private-trace-result-BLvBjy_e.js → private-trace-result-CE7_lEdq.js} +1 -2
  67. package/dist/{profile-h-72wM78.js → profile-qBM6B_-V.js} +14 -295
  68. package/dist/{prompt-DyoEj9c2.js → prompt-xgpyMtg7.js} +5 -9
  69. package/dist/{queue-B5SnqRln.d.ts → queue-C37RbDVc.d.ts} +0 -2
  70. package/dist/{registry-sLTr-sV9.js → registry-B_M_x_iS.js} +56 -30
  71. package/dist/{resolve-ncQPZROQ.js → resolve-BzpuLh8c.js} +8 -12
  72. package/dist/{result-C883vngT.js → result-DEZH_AnZ.js} +13 -17
  73. package/dist/{rolldown-runtime-B4FMCO8f.js → rolldown-runtime-nwUcYXjP.js} +1 -2
  74. package/dist/{runner-CzYImdOF.js → runner-BqQlG10t.js} +12 -13
  75. package/dist/{sandbox-egress-signals-CZbMINHI.js → sandbox-egress-signals-DCq3WLs5.js} +2 -3
  76. package/dist/{schema-Dy69D4Ge.js → schema-CF9HqNRY.js} +30 -27
  77. package/dist/{sentry-CgWZM_kV.js → sentry-BBUlHih9.js} +2 -3
  78. package/dist/service-account-BqTBkyD7.js +120 -0
  79. package/dist/service-account-BzhW7kXu.js +661 -0
  80. package/dist/{session-stop-CQjKd4a2.js → session-stop-CV65ZlU3.js} +23 -33
  81. package/dist/{skills-C22SLruK.js → skills-CiWS5_Ub.js} +9 -9
  82. package/dist/{spawn-DY9CLXDL.js → spawn-BSAQ7UQZ.js} +4 -5
  83. package/dist/{store-DXFIQy-G.js → store-B1GES4gC.js} +13 -15
  84. package/dist/{store-DoewL5mG.d.ts → store-CG0VJyye.d.ts} +0 -14
  85. package/dist/{task-queue-B17vV0La.js → task-queue-BAeGEMjJ.js} +5 -7
  86. package/dist/{task-runner-DUjvzYXj.js → task-runner-BlGhcQPi.js} +22 -26
  87. package/dist/{tasks-D_WIJtvO.js → tasks-DieKX3d4.js} +63 -78
  88. package/dist/{thread-state-Ch4yuCqG.js → thread-state-DpSWS4Rr.js} +13 -19
  89. package/dist/{turn-failure-response-C5nBKC4S.js → turn-failure-response-DQljogGJ.js} +16 -22
  90. package/dist/{turn-lifecycle-CO-ylUmV.js → turn-lifecycle-BLgrkV_L.js} +2 -3
  91. package/dist/{turn-session-routing-B3LWooK5.js → turn-session-routing-BlajheOU.js} +2 -3
  92. package/dist/{validation-CXYxaNYx.js → validation-23d7K9tX.js} +3 -4
  93. package/dist/vercel.d.ts +1 -3
  94. package/dist/vercel.js +1 -2
  95. package/dist/{version-BcdZy2zg.js → version-B_XumRx-.js} +3 -5
  96. package/dist/{version-CnXZ614E.d.ts → version-Cc2OFd9G.d.ts} +0 -2
  97. package/dist/version.d.ts +1 -1
  98. package/dist/version.js +1 -2
  99. package/dist/{viewer-DSZXygMU.js → viewer-B2_ABsYi.js} +26 -57
  100. package/dist/{web-input-B9Bv0_lR.js → web-input-BZDyxpzR.js} +101 -158
  101. package/dist/{web-message-id-xPI_EFSC.js → web-message-id-CJSUiksE.js} +3 -6
  102. package/dist/{work-nAfDSUFP.js → work-D3QKiV0O.js} +14 -16
  103. package/dist/{worker-vGXZ6XFT.js → worker-C8mUjYf9.js} +7 -8
  104. package/package.json +10 -9
@@ -1,39 +1,39 @@
1
- import { A as resolveSlackChannelIdFromMessage, B as effectiveTaskOutcomes, Bt as withoutSavedSteeringMessages, C as renderBlockText, D as storeAttachment, Kt as shouldEmitDevAgentTrace, M as getConversationInfo, N as listThreadReplies, O as parseSlackThreadId, Rt as createUserTokenStore, S as renderAttachmentText, Vt as RetryableDeliveryError, Wt 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 buildSteeringPiMessage } from "./agent-runner-D7OboVb3.js";
2
- import { f as escapeXml, i as completeText, r as completeObject, v as isProviderRetryError } from "./client-D8HnkOQX.js";
3
- import { B as toOptionalNumber, T as withSpan, V as toOptionalString, d as logError, f as logException, m as logWarn, n as createChatSdkLogger, o as getActiveTraceId, p as logInfo, t as buildTurnFailureResponse, v as setSentryUser, w as withLogContext, x as setTags, y as setSpanAttributes, z as isRecord } from "./logging-CWxiIuCF.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-CJRnWK9H.js";
5
- import { o as modelIdForProfile, r as defaultModelId } from "./model-profile-BwU8mqwD.js";
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 { B as createSlackDestination, H as requireSlackDestination, d as getConversationStore, f as getDb, l as getConversationEventStore, p as getSqlExecutor } from "./viewer-DSZXygMU.js";
8
- import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers } from "./agent-invocations-Bdu3ROfo.js";
9
- import { a as juniorAutomationRuns, s as juniorAutomations } from "./executor-Do0THDRR.js";
10
- import { p as instructionProvenanceFor } from "./history-9pO1Zd4Y.js";
11
- import { d as actorLogContext, f as credentialContextForActor } from "./registry-sLTr-sV9.js";
12
- import { $ as recordTurnSummary, $t as buildConversationContext, A as escapeSlackMrkdwnText, B as postSlackMessage, Bt as recordSubscribedReplyRoute, Dt as loadConversationProjection, E as sameDefinitionValue, F as truncateStatusText, Gt as persistConversationMessages, I as addReactionToMessage, It as recordAuthorizationCompleted, J as abandonTurnRecord, Jt as resolveConversationTitle, K as loadTurnCheckpoint, M as normalizeSlackReplyMarkdown, N as normalizeSlackStatusText, Q as listTurnSummaries, Qt as appendThreadContextMessages, S as automationDefinition, Tt as commitMessages, V as removeReactionFromMessage, Wt as hydrateConversationMessages, X as failTurnRecord, Xt as fallbackShortTitle, Y as completeTurnRecord, Z as getTurnRecord, _ as parseEventAutomationRow, an as normalizeConversationText, at as buildTurnErrorResponse, c as withScheduledAutomationLock, cn as upsertConversationMessage, en as createConversationMemoryService, et as persistWithRetry, f as deleteEventAutomation, h as listDeletedEventAutomationsCreatedBy, i as readScheduledAutomation, in as markConversationMessage, j as formatSlackLink, kt as loadProjection, nn as getConversationMessageSlackTs, o as saveScheduledAutomationInLock, on as recordDeliveredAssistantMessage, q as saveTurnCheckpoint, qt as persistConversationMessageSummaries, r as parseScheduledAutomationRow, rn as isHumanConversationMessage, sn as turnHasReply, tn as estimateConversationContextTokens, w as listAutomationVersions, wt as commitAcceptedReply, xt as trimTrailingAssistantMessages } from "./tasks-D_WIJtvO.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-BjtTzvru.js";
14
- import { F as readMessageAttachments, R as isVisionImageMediaType } from "./conversation-CKNLYBJt.js";
15
- import { E as acquireActiveLock, O as withLock, T as MUTATION_LOCK_TTL_MS, w as getStateAdapter } from "./profile-h-72wM78.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-s_QFribU.js";
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-CbTPebzL.js";
19
- import { A as maybePostAutomatedTurnLimitNotice, F as deliversFinalText, I as finishedRunReply, c as timerWatchCredentialSubject, i as skipInputBeforeConversationStop, j as recordFinishedTurnForAutomatedLimit, l as getEventCatalog, s as isEventMailboxMetadata, y as automationEventCatalog, z as runDispatchOutcome } from "./session-stop-CQjKd4a2.js";
20
- import { a as EVENT_SYSTEM_ACTOR, o as isEventConversationMessage } from "./prompt-DyoEj9c2.js";
21
- import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline } from "./job-queue-B6SV9uVa.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-DXFIQy-G.js";
23
- import { l as automationListQuerySchema } from "./automation-CHdlHVZP.js";
24
- import { r as isExperimentalFeatureEnabled } from "./experimental-CQIvMUO7.js";
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-DUjvzYXj.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-C883vngT.js";
28
- import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-CO-ylUmV.js";
29
- import { i as resolveAgentInvocationId, o as AgentRunError, s as executeTurn, t as createAgentInvocationWorker } from "./work-nAfDSUFP.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-Ch4yuCqG.js";
31
- import { c as deleteWebAuthorization, d as getPausedTurnRequest, m as getTurnAuthorization, p as wakePausedTurn, s as createWebAuthorization, u as createPausedTurns } from "./connections-ClYrKzpX.js";
32
- import { n as resolveTurnSessionRouting } from "./turn-session-routing-B3LWooK5.js";
33
- import { t as bindMessageAgent } from "./message-TUOdbSBW.js";
34
- import { t as bindSpawnAgent } from "./spawn-DY9CLXDL.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-C5nBKC4S.js";
36
- import { r as storeInputImages } from "./images-BN_BiBXF.js";
1
+ import { A as resolveSlackChannelIdFromMessage, B as effectiveTaskOutcomes, C as renderBlockText, D as storeAttachment, Ht as AuthorizationFlowDisabledError, It as createUserTokenStore, Lt as buildSteeringPiMessage, M as getConversationInfo, N as listThreadReplies, O as parseSlackThreadId, Rt as withoutSavedSteeringMessages, S as renderAttachmentText, Wt as shouldEmitDevAgentTrace, 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 RetryableDeliveryError } from "./agent-runner-CPSd7rKm.js";
2
+ import { a as completeText, p as escapeXml, r as completeDecision, y as isProviderRetryError } from "./client-BZdxgKyL.js";
3
+ import { B as toOptionalNumber, T as withSpan, V as toOptionalString, d as logError, f as logException, m as logWarn, n as createChatSdkLogger, o as getActiveTraceId, p as logInfo, t as buildTurnFailureResponse, v as setSentryUser, w as withLogContext, x as setTags, y as setSpanAttributes, z as isRecord } from "./logging-BStXN56b.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-Deqpfpg9.js";
5
+ import { o as modelIdForProfile, r as defaultModelId } from "./model-profile-Bg8EoCKD.js";
6
+ import { a as isUserActor, g as parseSlackMessageTs, i as isActorUserId, l as parseSlackChannelId, n as createSlackActor, o as parseActorUserId, r as createSlackResumeActor, t as createActor } from "./actor-tlxzqaRe.js";
7
+ import { L as createSlackDestination, c as getConversationEventStore, d as getDb, f as getSqlExecutor, u as getConversationStore, z as requireSlackDestination } from "./viewer-B2_ABsYi.js";
8
+ import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers } from "./agent-invocations-Qfz7dWgU.js";
9
+ import { a as juniorAutomationRuns, s as juniorAutomations } from "./executor-Bb3eQb8q.js";
10
+ import { p as instructionProvenanceFor } from "./history-AY8rs-FR.js";
11
+ import { d as actorLogContext, f as credentialContextForActor } from "./registry-B_M_x_iS.js";
12
+ import { $ as recordTurnSummary, $t as buildConversationContext, A as escapeSlackMrkdwnText, B as postSlackMessage, Bt as recordSubscribedReplyRoute, Dt as loadConversationProjection, E as sameDefinitionValue, F as truncateStatusText, Gt as persistConversationMessages, I as addReactionToMessage, It as recordAuthorizationCompleted, J as abandonTurnRecord, Jt as resolveConversationTitle, K as loadTurnCheckpoint, M as normalizeSlackReplyMarkdown, N as normalizeSlackStatusText, Q as listTurnSummaries, Qt as appendThreadContextMessages, S as automationDefinition, Tt as commitMessages, V as removeReactionFromMessage, Wt as hydrateConversationMessages, X as failTurnRecord, Xt as fallbackShortTitle, Y as completeTurnRecord, Z as getTurnRecord, _ as parseEventAutomationRow, an as normalizeConversationText, at as buildTurnErrorResponse, c as withScheduledAutomationLock, cn as upsertConversationMessage, en as createConversationMemoryService, et as persistWithRetry, f as deleteEventAutomation, h as listDeletedEventAutomationsCreatedBy, i as readScheduledAutomation, in as markConversationMessage, j as formatSlackLink, kt as loadProjection, nn as getConversationMessageSlackTs, o as saveScheduledAutomationInLock, on as recordDeliveredAssistantMessage, q as saveTurnCheckpoint, qt as persistConversationMessageSummaries, r as parseScheduledAutomationRow, rn as isHumanConversationMessage, sn as turnHasReply, tn as estimateConversationContextTokens, w as listAutomationVersions, wt as commitAcceptedReply, xt as trimTrailingAssistantMessages } from "./tasks-DieKX3d4.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-B00FaKdP.js";
14
+ import { F as readMessageAttachments, R as isVisionImageMediaType } from "./conversation-DjN3mlog.js";
15
+ import { a as wasPendingAuthStopped, c as getSubscribedReplyPreflightDecision, d as buildDeterministicTurnId, l as getThreadStopDecision, r as clearPendingAuth, s as decideSubscribedThreadReply, u as buildDeterministicAssistantMessageId } from "./pending-auth-rG5U_QS1.js";
16
+ 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-djQn5Nhy.js";
17
+ import { n as getAssistantReplyText } from "./assistant-reply-CqthTerd.js";
18
+ import { A as maybePostAutomatedTurnLimitNotice, F as deliversFinalText, I as finishedRunReply, c as timerWatchCredentialSubject, i as skipInputBeforeConversationStop, j as recordFinishedTurnForAutomatedLimit, l as getEventCatalog, s as isEventMailboxMetadata, y as automationEventCatalog, z as runDispatchOutcome } from "./session-stop-CV65ZlU3.js";
19
+ import { a as acquireActiveLock, i as MUTATION_LOCK_TTL_MS, r as getStateAdapter, s as withLock } from "./adapter-Bn0gFVSF.js";
20
+ import { a as EVENT_SYSTEM_ACTOR, o as isEventConversationMessage } from "./prompt-xgpyMtg7.js";
21
+ import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline } from "./job-queue-vdGU-5ge.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-B1GES4gC.js";
23
+ import { l as automationListQuerySchema } from "./automation-DWBFBenG.js";
24
+ import { r as isExperimentalFeatureEnabled } from "./experimental-BNK1l1jv.js";
25
+ import { c as sumUtcHoursIntoSixHours, m as healthReportSchema, t as webMessageId } from "./web-message-id-CJSUiksE.js";
26
+ import { A as readAutomationExecutions, D as readAutomationExecutionStatusDays, E as readAutomationExecutionHours, O as readAutomationExecutionStatusHours, S as emptyAutomationRunWindows, T as readAutomationExecutionDays, _ as markDispatchBlocked, a as claimDispatchMailboxAppend, b as markDispatchRunning, c as getDispatchConversationId, d as getDispatchRecord, f as getDispatchTurnId, g as markDispatchAwaitingResume, j as readAutomationRuns, k as readAutomationExecutionSummaries, l as getDispatchIdForConversation, m as isTerminalDispatchStatus, n as scheduleSessionCompletedPluginTasks, o as confirmDispatchMailboxAppend, t as processPluginTask, u as getDispatchInputMessageId, v as markDispatchCompleted, w as readAutomationExecutionByConversationId, y as markDispatchFailed } from "./task-runner-BlGhcQPi.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-DEZH_AnZ.js";
28
+ import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-BLgrkV_L.js";
29
+ import { i as resolveAgentInvocationId, o as AgentRunError, s as executeTurn, t as createAgentInvocationWorker } from "./work-D3QKiV0O.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-DpSWS4Rr.js";
31
+ import { c as deleteWebAuthorization, d as createPausedTurns, f as getPausedTurnRequest, h as getTurnAuthorization, m as wakePausedTurn, s as createWebAuthorization } from "./connections-9gJkfS85.js";
32
+ import { n as resolveTurnSessionRouting } from "./turn-session-routing-BlajheOU.js";
33
+ import { t as bindMessageAgent } from "./message-DRf6m4uO.js";
34
+ import { t as bindSpawnAgent } from "./spawn-BSAQ7UQZ.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-DQljogGJ.js";
36
+ import { r as storeInputImages } from "./images-BbSdVHC6.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";
@@ -41,7 +41,7 @@ import { createSlackSource, createWebSource, localDestinationSchema, objectFactF
41
41
  import { del, get, put } from "@vercel/blob";
42
42
  import { Message, ThreadImpl, stringifyMarkdown } from "chat";
43
43
  import { SlackFormatConverter, createSlackAdapter } from "@chat-adapter/slack";
44
- //#region src/handlers/health.ts
44
+ // src/handlers/health.ts
45
45
  /** Build Junior's process health value for HTTP and reporting consumers. */
46
46
  function readHealthReport() {
47
47
  return healthReportSchema.parse({
@@ -56,8 +56,7 @@ function readHealthReport() {
56
56
  function GET() {
57
57
  return Response.json(readHealthReport());
58
58
  }
59
- //#endregion
60
- //#region src/chat/agent-dispatch/work.ts
59
+ // src/chat/agent-dispatch/work.ts
61
60
  const agentDispatchMailboxMetadataSchema = z.object({
62
61
  dispatchId: z.string().min(1),
63
62
  kind: z.literal("agent_dispatch")
@@ -306,8 +305,7 @@ function createAgentDispatchConversationWorker(options) {
306
305
  }
307
306
  };
308
307
  }
309
- //#endregion
310
- //#region src/chat/attachments/vercel.ts
308
+ // src/chat/attachments/vercel.ts
311
309
  /** Store private conversation attachments in Vercel Blob. */
312
310
  function createVercelAttachmentStorage() {
313
311
  return {
@@ -333,8 +331,7 @@ function createVercelAttachmentStorage() {
333
331
  }
334
332
  };
335
333
  }
336
- //#endregion
337
- //#region src/chat/slack/automation-card.ts
334
+ // src/chat/slack/automation-card.ts
338
335
  function preview(text, length) {
339
336
  const compact = text.replace(/\s+/g, " ").trim();
340
337
  return compact.length > length ? `${compact.slice(0, length - 1)}…` : compact;
@@ -390,8 +387,7 @@ function renderSlackAutomationCard(card) {
390
387
  }
391
388
  };
392
389
  }
393
- //#endregion
394
- //#region src/chat/slack/object-card.ts
390
+ // src/chat/slack/object-card.ts
395
391
  function descriptionPreview(value) {
396
392
  const text = value?.replace(/\r\n/g, "\n").trim() ?? "";
397
393
  const preview = text.split("\n").slice(0, 6).join("\n").slice(0, 500);
@@ -497,8 +493,7 @@ function renderSlackObjectCard(card, conversationId, surface = "preview") {
497
493
  }
498
494
  };
499
495
  }
500
- //#endregion
501
- //#region src/chat/slack/adapter-context.ts
496
+ // src/chat/slack/adapter-context.ts
502
497
  const initializedAdapters = /* @__PURE__ */ new WeakSet();
503
498
  async function getConnectedState$1(stateAdapter) {
504
499
  const state = stateAdapter ?? getStateAdapter();
@@ -538,8 +533,7 @@ async function runWithSlackInstallation(args) {
538
533
  isEnterpriseInstall: args.installation.isEnterpriseInstall
539
534
  }, () => runWithSlackInstallationToken(tokenContext.token, args.task));
540
535
  }
541
- //#endregion
542
- //#region src/chat/slack/errors.ts
536
+ // src/chat/slack/errors.ts
543
537
  /** Extract Slack's stable API error code from Web API errors. */
544
538
  function getSlackApiErrorCode(error) {
545
539
  if (!error || typeof error !== "object") return;
@@ -585,8 +579,7 @@ function isSlackTitlePermissionError(error) {
585
579
  const code = getSlackApiErrorCode(error);
586
580
  return code === "no_permission" || code === "missing_scope" || code === "not_allowed_token_type";
587
581
  }
588
- //#endregion
589
- //#region src/chat/slack/message/content.ts
582
+ // src/chat/slack/message/content.ts
590
583
  /**
591
584
  * Slack message content projection.
592
585
  *
@@ -647,8 +640,7 @@ function parseContent(message) {
647
640
  topLevelText
648
641
  };
649
642
  }
650
- //#endregion
651
- //#region src/chat/runtime/thread-context.ts
643
+ // src/chat/runtime/thread-context.ts
652
644
  function escapeRegExp(value) {
653
645
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
654
646
  }
@@ -720,8 +712,7 @@ function getMessageTs(message) {
720
712
  if (ts) return ts;
721
713
  }
722
714
  }
723
- //#endregion
724
- //#region src/chat/providers/slack/processing-reaction.ts
715
+ // src/chat/providers/slack/processing-reaction.ts
725
716
  const noProcessingReaction = {
726
717
  complete: async () => void 0,
727
718
  keep: () => void 0,
@@ -809,16 +800,14 @@ async function startProcessingReactionForMessage(args) {
809
800
  }
810
801
  };
811
802
  }
812
- //#endregion
813
- //#region src/chat/slack/message-control.ts
803
+ // src/chat/slack/message-control.ts
814
804
  /** Leading Slack mention forms that may precede an explicit steering marker. */
815
805
  const LEADING_MENTION_BEFORE_STEERING_RE = /^(\s*(?:<@[^>]+>|@[A-Za-z0-9._-]+\b)[\s,:-]*)!!\s*/;
816
806
  /** Remove the explicit Slack steering marker before building agent input. */
817
807
  function stripLeadingSteeringOverride(text) {
818
808
  return text.replace(LEADING_MENTION_BEFORE_STEERING_RE, "$1").replace(/^\s*!!\s*/, "");
819
809
  }
820
- //#endregion
821
- //#region src/chat/runtime/turn-input.ts
810
+ // src/chat/runtime/turn-input.ts
822
811
  function combineTextParts(queuedTexts, latestText) {
823
812
  const parts = [...queuedTexts, latestText].filter((part) => part.trim().length > 0);
824
813
  return parts.length > 0 ? parts.join("\n\n") : latestText;
@@ -830,8 +819,7 @@ function combineTurnText(queuedMessages, latestText) {
830
819
  userText: combineTextParts(queuedMessages.map((message) => message.userText), latestText.userText)
831
820
  };
832
821
  }
833
- //#endregion
834
- //#region src/chat/services/message-actor-identity.ts
822
+ // src/chat/services/message-actor-identity.ts
835
823
  const messageActors = /* @__PURE__ */ new WeakMap();
836
824
  function canonicalUserId(author, actor) {
837
825
  const authorUserId = parseActorUserId(author.userId);
@@ -880,8 +868,7 @@ async function ensureSlackMessageActorIdentity(message, teamId, lookupSlackUser)
880
868
  if (actor.platform !== "slack") throw new Error("Slack message actor identity requires a Slack actor");
881
869
  return actor;
882
870
  }
883
- //#endregion
884
- //#region src/chat/providers/slack/runtime.ts
871
+ // src/chat/providers/slack/runtime.ts
885
872
  /** Sent when a stop decision unsubscribes a thread. */
886
873
  const THREAD_OPTOUT_ACK = "Understood. I'll stay out of this thread unless someone @mentions me again.";
887
874
  /** Preserve retry/yield control flow for the durable worker boundary. */
@@ -985,7 +972,7 @@ function createSlackTurnRuntime(deps) {
985
972
  const processingReactions = [];
986
973
  const processingReactionByMessage = /* @__PURE__ */ new Map();
987
974
  return {
988
- start: async (context, targetMessage) => {
975
+ start: async (_context, targetMessage) => {
989
976
  const channelId = getChannelId(thread, targetMessage);
990
977
  const messageTs = getMessageTs(targetMessage);
991
978
  const reactionKey = channelId && messageTs ? `${channelId}:${messageTs}` : void 0;
@@ -1612,8 +1599,7 @@ function createSlackTurnRuntime(deps) {
1612
1599
  }
1613
1600
  };
1614
1601
  }
1615
- //#endregion
1616
- //#region src/chat/conversations/stop.ts
1602
+ // src/chat/conversations/stop.ts
1617
1603
  /** Stop the current Conversation Turn and wake an idle resume when needed. */
1618
1604
  async function stopConversationTurn(args) {
1619
1605
  const nowMs = args.nowMs ?? Date.now();
@@ -1649,8 +1635,7 @@ async function stopConversationTurn(args) {
1649
1635
  });
1650
1636
  return result;
1651
1637
  }
1652
- //#endregion
1653
- //#region src/chat/ingress/message-router.ts
1638
+ // src/chat/ingress/message-router.ts
1654
1639
  /** Derive canonical Slack thread IDs from the raw event payload. */
1655
1640
  /** Rebuild a Message onto a normalized Slack thread id. */
1656
1641
  function withNormalizedThreadId(message, threadId) {
@@ -1682,8 +1667,7 @@ function nonEmptyString(value) {
1682
1667
  if (typeof value !== "string") return void 0;
1683
1668
  return value.trim() || void 0;
1684
1669
  }
1685
- //#endregion
1686
- //#region src/chat/slack/attachment-fetchers.ts
1670
+ // src/chat/slack/attachment-fetchers.ts
1687
1671
  /**
1688
1672
  * Restore Slack private-file fetchers on message attachments that crossed a
1689
1673
  * serialization boundary.
@@ -1691,8 +1675,7 @@ function nonEmptyString(value) {
1691
1675
  function rehydrateAttachmentFetchers(message, downloadPrivateSlackFile$1 = downloadPrivateSlackFile) {
1692
1676
  for (const attachment of message.attachments) if (!attachment.fetchData && attachment.url) attachment.fetchData = () => downloadPrivateSlackFile$1(attachment.url);
1693
1677
  }
1694
- //#endregion
1695
- //#region src/chat/slack/thread-stop.ts
1678
+ // src/chat/slack/thread-stop.ts
1696
1679
  const watermarksSchema = z.object({
1697
1680
  mentionAtMs: z.number().finite().optional(),
1698
1681
  stopAtMs: z.number().finite().optional()
@@ -1768,8 +1751,7 @@ async function subscribeSlackThreadForMessage(args) {
1768
1751
  if (!result.acquired) throw new Error(`Could not lock Slack stop state for ${args.thread.id}`);
1769
1752
  return result.value;
1770
1753
  }
1771
- //#endregion
1772
- //#region src/chat/task-execution/slack-work.ts
1754
+ // src/chat/task-execution/slack-work.ts
1773
1755
  const slackConversationRouteSchema = z.enum(["mention", "subscribed"]);
1774
1756
  function hasSteeringOverride(text) {
1775
1757
  return stripLeadingSteeringOverride(text) !== text;
@@ -2241,8 +2223,7 @@ function buildSlackInboundMessage(args) {
2241
2223
  }
2242
2224
  };
2243
2225
  }
2244
- //#endregion
2245
- //#region src/chat/slack/message/identity.ts
2226
+ // src/chat/slack/message/identity.ts
2246
2227
  /**
2247
2228
  * Preserve the native Slack message timestamp when a synthetic message ID is
2248
2229
  * used for routing or deduplication.
@@ -2252,8 +2233,7 @@ function getMessageTimestamp(message) {
2252
2233
  if (idTs) return idTs;
2253
2234
  if (message.raw && typeof message.raw === "object") return parseSlackMessageTs(message.raw.ts);
2254
2235
  }
2255
- //#endregion
2256
- //#region src/chat/slack/vision-context.ts
2236
+ // src/chat/slack/vision-context.ts
2257
2237
  const MAX_USER_ATTACHMENTS = 3;
2258
2238
  const MAX_USER_ATTACHMENT_BYTES = 5242880;
2259
2239
  const MAX_MESSAGE_IMAGE_ATTACHMENTS = 3;
@@ -2676,8 +2656,7 @@ function createVisionContextService(deps) {
2676
2656
  hydrateConversationVisionContext: async (conversation, context) => await hydrateConversationVisionContextWithDeps(conversation, context, deps)
2677
2657
  };
2678
2658
  }
2679
- //#endregion
2680
- //#region src/chat/runtime/conversation-message.ts
2659
+ // src/chat/runtime/conversation-message.ts
2681
2660
  const NON_TEXT_MESSAGE_TEXT = "[non-text message]";
2682
2661
  function resolveMessageText(args) {
2683
2662
  return normalizeConversationText(args.text) || NON_TEXT_MESSAGE_TEXT;
@@ -2729,8 +2708,7 @@ function recordSkippedConversationMessage(args) {
2729
2708
  }
2730
2709
  });
2731
2710
  }
2732
- //#endregion
2733
- //#region src/chat/automations/collection.ts
2711
+ // src/chat/automations/collection.ts
2734
2712
  /**
2735
2713
  * The web collection applies access before counts, filter options, and paging.
2736
2714
  * Keep its ownership rules aligned with the direct Automation reader. A public
@@ -2809,8 +2787,7 @@ async function readAutomationCollection(user, input) {
2809
2787
  destinations
2810
2788
  };
2811
2789
  }
2812
- //#endregion
2813
- //#region src/chat/automations/creator.ts
2790
+ // src/chat/automations/creator.ts
2814
2791
  /**
2815
2792
  * Return whether the user created the Automation. Both kinds store the
2816
2793
  * creating Junior identity, so one rule decides ownership.
@@ -2818,8 +2795,7 @@ async function readAutomationCollection(user, input) {
2818
2795
  function isAutomationCreator(user, automation) {
2819
2796
  return user.identities.some((identity) => identity.id === automation.creatorIdentityId);
2820
2797
  }
2821
- //#endregion
2822
- //#region src/chat/scheduled-automations/personal.ts
2798
+ // src/chat/scheduled-automations/personal.ts
2823
2799
  var PersonalScheduledAutomationNotFoundError = class extends Error {
2824
2800
  constructor() {
2825
2801
  super("Scheduled automation was not found.");
@@ -2840,8 +2816,7 @@ async function deleteViewerScheduledAutomation(db, user, id, nowMs = Date.now())
2840
2816
  }, task);
2841
2817
  });
2842
2818
  }
2843
- //#endregion
2844
- //#region src/chat/automations/read.ts
2819
+ // src/chat/automations/read.ts
2845
2820
  const TASK_EXECUTION_LIST_LIMIT = 100;
2846
2821
  const AUTOMATION_VERSION_LIST_LIMIT = 100;
2847
2822
  function creatorLabel(creator) {
@@ -3287,8 +3262,7 @@ async function deleteViewerTask(user, id) {
3287
3262
  }
3288
3263
  await deleteEventAutomation(getDb(), id);
3289
3264
  }
3290
- //#endregion
3291
- //#region src/chat/slack/assistant-thread/status-send.ts
3265
+ // src/chat/slack/assistant-thread/status-send.ts
3292
3266
  /**
3293
3267
  * Slack's assistant loading UI accepts both `status` and `loading_messages`,
3294
3268
  * but product policy keeps `status` stable and generic. User-visible progress
@@ -3374,15 +3348,14 @@ function logAssistantStatusFailure(args) {
3374
3348
  "exception.message": args.error instanceof Error ? args.error.message : String(args.error)
3375
3349
  });
3376
3350
  }
3377
- //#endregion
3378
- //#region src/chat/services/subscribed-reply-policy.ts
3351
+ // src/chat/services/subscribed-reply-policy.ts
3379
3352
  function createSubscribedReplyPolicy(deps) {
3380
3353
  return async (args) => {
3381
3354
  const decision = await decideSubscribedThreadReply({
3382
3355
  botUserName: botConfig.userName,
3383
- modelId: botConfig.fastModelId,
3356
+ modelId: botConfig.decisionModelId,
3384
3357
  input: args,
3385
- completeObject: deps.completeObject,
3358
+ completeDecision: deps.completeDecision,
3386
3359
  logClassifierFailure: (error) => {
3387
3360
  logWarn("subscribed_message.classifier.failed", { "exception.message": error instanceof Error ? error.message : String(error) });
3388
3361
  }
@@ -3396,8 +3369,7 @@ function createSubscribedReplyPolicy(deps) {
3396
3369
  };
3397
3370
  };
3398
3371
  }
3399
- //#endregion
3400
- //#region src/chat/app/services.ts
3372
+ // src/chat/app/services.ts
3401
3373
  function createJuniorRuntimeServices(overrides = {}) {
3402
3374
  const conversationMemory = createConversationMemoryService({ completeText: overrides.conversationMemory?.completeText ?? completeText });
3403
3375
  const contextCompactor = createContextCompactor({
@@ -3419,12 +3391,11 @@ function createJuniorRuntimeServices(overrides = {}) {
3419
3391
  conversationMemory,
3420
3392
  contextCompactor,
3421
3393
  executeTurn: async (run, saveResult) => await executeTurn(agentRunner, run, saveResult),
3422
- subscribedReplyPolicy: createSubscribedReplyPolicy({ completeObject: overrides.subscribedReplyPolicy?.completeObject ?? completeObject }),
3394
+ subscribedReplyPolicy: createSubscribedReplyPolicy({ completeDecision: overrides.subscribedReplyPolicy?.completeDecision ?? completeDecision }),
3423
3395
  visionContext
3424
3396
  };
3425
3397
  }
3426
- //#endregion
3427
- //#region src/chat/slack/action-token.ts
3398
+ // src/chat/slack/action-token.ts
3428
3399
  const slackActionTokenSchema = z.string().trim().min(1).brand();
3429
3400
  const slackMessageEnvelopeSchema = z.object({ raw: z.object({ action_token: z.unknown().optional() }).optional() });
3430
3401
  /** Parse the ephemeral search token from an untrusted Slack message envelope. */
@@ -3434,8 +3405,7 @@ function readSlackActionToken(message) {
3434
3405
  const token = slackActionTokenSchema.safeParse(envelope.data.raw?.action_token);
3435
3406
  return token.success ? token.data : void 0;
3436
3407
  }
3437
- //#endregion
3438
- //#region src/chat/slack/cards.ts
3408
+ // src/chat/slack/cards.ts
3439
3409
  /** Select the Slack object renderer for a built-in card. */
3440
3410
  function renderSlackCard(card, conversationId) {
3441
3411
  switch (card.kind) {
@@ -3443,8 +3413,7 @@ function renderSlackCard(card, conversationId) {
3443
3413
  case "automation": return renderSlackAutomationCard(card);
3444
3414
  }
3445
3415
  }
3446
- //#endregion
3447
- //#region src/chat/slack/footer.ts
3416
+ // src/chat/slack/footer.ts
3448
3417
  /** Render compact reply attribution for the Slack footer. */
3449
3418
  function formatReplyAttribution(attribution) {
3450
3419
  return attribution.detail ? `${attribution.label} · ${attribution.detail}` : attribution.label;
@@ -3492,8 +3461,7 @@ function buildSlackReplyBlocks(text, footer) {
3492
3461
  }
3493
3462
  return blocks.length ? blocks : void 0;
3494
3463
  }
3495
- //#endregion
3496
- //#region src/chat/slack/output.ts
3464
+ // src/chat/slack/output.ts
3497
3465
  const MAX_INLINE_CHARS = 2200;
3498
3466
  const MAX_INLINE_LINES = 45;
3499
3467
  const CONTINUED_MARKER = "\n\n[Continued below]";
@@ -3537,7 +3505,7 @@ function getFenceContinuation(text) {
3537
3505
  for (const line of text.split("\n")) {
3538
3506
  const trimmed = line.trimStart();
3539
3507
  const openerMatch = trimmed.match(/^(`{3,}|~{3,})(.*)$/);
3540
- if (!openerMatch) continue;
3508
+ if (!openerMatch?.[1]) continue;
3541
3509
  if (!open) {
3542
3510
  open = {
3543
3511
  fence: openerMatch[1],
@@ -3666,8 +3634,7 @@ function buildSlackOutputMessage(text) {
3666
3634
  if (!normalized) throw new Error(`Slack output normalized to empty content: original_length=${text.length} parsed_length=${normalized.length}`);
3667
3635
  return { markdown: normalized };
3668
3636
  }
3669
- //#endregion
3670
- //#region src/chat/slack/reply.ts
3637
+ // src/chat/slack/reply.ts
3671
3638
  /**
3672
3639
  * Send one destination-visible Slack reply.
3673
3640
  *
@@ -3724,8 +3691,7 @@ async function sendSlackReply(args) {
3724
3691
  }
3725
3692
  return messageTs;
3726
3693
  }
3727
- //#endregion
3728
- //#region src/chat/slack/assistant-thread/status-render.ts
3694
+ // src/chat/slack/assistant-thread/status-render.ts
3729
3695
  const DEFAULT_STATUS_CONTEXTS = {
3730
3696
  thinking: "…",
3731
3697
  searching: "sources",
@@ -3765,8 +3731,7 @@ function selectAssistantLoadingMessages(args) {
3765
3731
  }
3766
3732
  return shuffled.slice(0, 10);
3767
3733
  }
3768
- //#endregion
3769
- //#region src/chat/slack/assistant-thread/status-scheduler.ts
3734
+ // src/chat/slack/assistant-thread/status-scheduler.ts
3770
3735
  const STATUS_UPDATE_DEBOUNCE_MS = 1e3;
3771
3736
  const STATUS_MIN_VISIBLE_MS = 1200;
3772
3737
  const STATUS_ROTATION_INTERVAL_MS = 3e4;
@@ -3819,7 +3784,8 @@ function createAssistantStatusScheduler(args) {
3819
3784
  };
3820
3785
  const getLoadingMessagesForVisibleStatus = (visible) => visible ? [visible] : void 0;
3821
3786
  const getInitialStatusText = () => {
3822
- if (loadingMessages?.length) return loadingMessages[0];
3787
+ const [firstLoadingMessage] = loadingMessages ?? [];
3788
+ if (firstLoadingMessage) return firstLoadingMessage;
3823
3789
  return defaultStatus.text;
3824
3790
  };
3825
3791
  const haveSameLoadingMessages = (left, right) => {
@@ -3916,8 +3882,7 @@ function createAssistantStatusScheduler(args) {
3916
3882
  }
3917
3883
  };
3918
3884
  }
3919
- //#endregion
3920
- //#region src/chat/slack/assistant-thread/status.ts
3885
+ // src/chat/slack/assistant-thread/status.ts
3921
3886
  /**
3922
3887
  * Create a Slack adapter-backed session for Slack's assistant loading state.
3923
3888
  *
@@ -3957,8 +3922,7 @@ function createSlackWebApiAssistantStatusSession(args) {
3957
3922
  random: args.random
3958
3923
  });
3959
3924
  }
3960
- //#endregion
3961
- //#region src/chat/slack/assistant-thread/title.ts
3925
+ // src/chat/slack/assistant-thread/title.ts
3962
3926
  /** Set-once DM title projection for the current process. */
3963
3927
  const projectedAssistantTitles = /* @__PURE__ */ new Set();
3964
3928
  function assistantTitleKey(channelId, threadTs) {
@@ -3995,8 +3959,7 @@ async function maybeSyncAssistantTitle(args) {
3995
3959
  logWarn("thread.title.slack_update.failed", { "exception.message": error instanceof Error ? error.message : String(error) });
3996
3960
  }
3997
3961
  }
3998
- //#endregion
3999
- //#region src/chat/slack/conversation-context.ts
3962
+ // src/chat/slack/conversation-context.ts
4000
3963
  function normalizeConversationName(type, channelName) {
4001
3964
  const trimmed = channelName?.trim();
4002
3965
  if (!trimmed) return void 0;
@@ -4085,8 +4048,7 @@ function formatSlackConversationRedactedLabel(context) {
4085
4048
  if (!context) return void 0;
4086
4049
  return formatSlackConversationTypeLabel(context.type);
4087
4050
  }
4088
- //#endregion
4089
- //#region src/chat/services/provider-default-config.ts
4051
+ // src/chat/services/provider-default-config.ts
4090
4052
  const GITHUB_REPO_PART = String.raw`[A-Za-z0-9_.-]*[A-Za-z0-9_-]`;
4091
4053
  const GITHUB_REPO_RE = new RegExp(String.raw`^\s*(?:set|use)\s+(?:the\s+)?default\s+(?:github\s+)?repo(?:sitory)?\s+(?:to|as)\s+(${GITHUB_REPO_PART}/${GITHUB_REPO_PART})(?:\s+for\s+this\s+channel)?[.!?]?\s*$`, "i");
4092
4054
  /** Apply explicit provider-default config requests that do not need agent reasoning. */
@@ -4101,8 +4063,7 @@ async function maybeApplyProviderDefaultConfigRequest(args) {
4101
4063
  });
4102
4064
  return { text: `Default GitHub repo set to \`${repo}\`.` };
4103
4065
  }
4104
- //#endregion
4105
- //#region src/chat/conversations/destination-visibility.ts
4066
+ // src/chat/conversations/destination-visibility.ts
4106
4067
  /** Read confirmed visibility from the current signal or persisted destination. */
4107
4068
  async function resolveDestinationVisibility(args) {
4108
4069
  if (args.visibility) return args.visibility;
@@ -4113,8 +4074,7 @@ async function resolveDestinationVisibility(args) {
4113
4074
  providerTenantId: args.destination.teamId
4114
4075
  });
4115
4076
  }
4116
- //#endregion
4117
- //#region src/chat/providers/slack/input.ts
4077
+ // src/chat/providers/slack/input.ts
4118
4078
  function renderRecentThreadMessageLines(conversationContext, messages) {
4119
4079
  const messagesForContext = messages.filter((queued) => {
4120
4080
  if (queued.explicitMention) return false;
@@ -4221,8 +4181,7 @@ async function saveSteeringMessages(args) {
4221
4181
  await state.releaseLock(lock);
4222
4182
  }
4223
4183
  }
4224
- //#endregion
4225
- //#region src/chat/providers/slack/turn.ts
4184
+ // src/chat/providers/slack/turn.ts
4226
4185
  /**
4227
4186
  * Add Slack behavior around one Turn.
4228
4187
  *
@@ -5131,8 +5090,7 @@ function createSlackTurn(deps) {
5131
5090
  });
5132
5091
  };
5133
5092
  }
5134
- //#endregion
5135
- //#region src/chat/slack/assistant-thread/lifecycle.ts
5093
+ // src/chat/slack/assistant-thread/lifecycle.ts
5136
5094
  async function syncAssistantThreadContext(event, options) {
5137
5095
  const channelId = normalizeSlackConversationId(event.channelId);
5138
5096
  if (!channelId) throw new Error("Assistant thread initialization requires a channel ID");
@@ -5161,8 +5119,7 @@ async function initializeAssistantThread(event) {
5161
5119
  async function refreshAssistantThreadContext(event) {
5162
5120
  await syncAssistantThreadContext(event, { setInitialTitle: false });
5163
5121
  }
5164
- //#endregion
5165
- //#region src/chat/slack/vision-cache.ts
5122
+ // src/chat/slack/vision-cache.ts
5166
5123
  const VISION_CACHE_SCHEMA_VERSION = 1;
5167
5124
  const VISION_CACHE_TTL_MS = 6048e5;
5168
5125
  function visionCacheKey(conversationId) {
@@ -5203,8 +5160,7 @@ async function persistConversationVisionCache(conversationId, vision) {
5203
5160
  byFileId: vision.byFileId
5204
5161
  }, VISION_CACHE_TTL_MS);
5205
5162
  }
5206
- //#endregion
5207
- //#region src/chat/runtime/turn-preparation.ts
5163
+ // src/chat/runtime/turn-preparation.ts
5208
5164
  const BACKFILL_MESSAGE_LIMIT = 80;
5209
5165
  function hasPendingImageHydration(conversation) {
5210
5166
  return conversation.messages.some((message) => isHumanConversationMessage(message) && !message.meta?.imagesHydrated);
@@ -5337,8 +5293,7 @@ function createPrepareTurnState(deps) {
5337
5293
  };
5338
5294
  };
5339
5295
  }
5340
- //#endregion
5341
- //#region src/chat/slack/dispatch-turn.ts
5296
+ // src/chat/slack/dispatch-turn.ts
5342
5297
  /** Build the Slack provider adapter for agent-dispatched conversation turns. */
5343
5298
  function createSlackDispatchTurnRunner(options) {
5344
5299
  return async function runSlackDispatchTurn(dispatch, hooks) {
@@ -5420,8 +5375,7 @@ function createSlackDispatchTurnRunner(options) {
5420
5375
  };
5421
5376
  };
5422
5377
  }
5423
- //#endregion
5424
- //#region src/chat/app/factory.ts
5378
+ // src/chat/app/factory.ts
5425
5379
  function clearSkippedTurnIfActive(conversation, messageId) {
5426
5380
  if (conversation.processing.activeTurnId === buildDeterministicTurnId(messageId)) conversation.processing.activeTurnId = void 0;
5427
5381
  }
@@ -5528,8 +5482,7 @@ function createSlackRuntime(options) {
5528
5482
  })
5529
5483
  };
5530
5484
  }
5531
- //#endregion
5532
- //#region src/chat/slack/adapter.ts
5485
+ // src/chat/slack/adapter.ts
5533
5486
  /**
5534
5487
  * Create the repository's Slack adapter.
5535
5488
  *
@@ -5540,8 +5493,7 @@ function createSlackRuntime(options) {
5540
5493
  function createJuniorSlackAdapter(config) {
5541
5494
  return createSlackAdapter(config);
5542
5495
  }
5543
- //#endregion
5544
- //#region src/chat/providers/slack/resume.ts
5496
+ // src/chat/providers/slack/resume.ts
5545
5497
  /**
5546
5498
  * Resume a Slack Turn from saved Run state.
5547
5499
  *
@@ -6034,8 +5986,7 @@ async function resumeSlackTurnInContext(args) {
6034
5986
  if (deferredFailureHandler) await deferredFailureHandler();
6035
5987
  return true;
6036
5988
  }
6037
- //#endregion
6038
- //#region src/chat/task-execution/paused-turn.ts
5989
+ // src/chat/task-execution/paused-turn.ts
6039
5990
  /**
6040
5991
  * Worker continue for paused turns under the conversation lease.
6041
5992
  *
@@ -6521,8 +6472,7 @@ async function runNextPausedTurnInContext(conversationId, options, runOptions) {
6521
6472
  }
6522
6473
  return false;
6523
6474
  }
6524
- //#endregion
6525
- //#region src/chat/task-execution/assistant-message.ts
6475
+ // src/chat/task-execution/assistant-message.ts
6526
6476
  /** Store one assistant Message and its Agent history. */
6527
6477
  async function commitAssistantMessage(args) {
6528
6478
  const conversationMessageId = recordDeliveredAssistantMessage({
@@ -6546,8 +6496,7 @@ async function commitAssistantMessage(args) {
6546
6496
  logException(error, "conversation.assistant.message_persist.failed");
6547
6497
  }
6548
6498
  }
6549
- //#endregion
6550
- //#region src/chat/conversations/destination.ts
6499
+ // src/chat/conversations/destination.ts
6551
6500
  function requireLocalDestination(conversationId) {
6552
6501
  const parsed = localDestinationSchema.safeParse({
6553
6502
  platform: "local",
@@ -6566,8 +6515,7 @@ function requireLocalDestination(conversationId) {
6566
6515
  function resolveConversationDestination(args) {
6567
6516
  return args.existing ?? requireLocalDestination(args.conversationId);
6568
6517
  }
6569
- //#endregion
6570
- //#region src/chat/task-execution/conversation-turn.ts
6518
+ // src/chat/task-execution/conversation-turn.ts
6571
6519
  /** Run a mailbox Turn and store its assistant Messages. */
6572
6520
  function stableHex$1(...parts) {
6573
6521
  return createHash("sha256").update(parts.join("\0")).digest("hex").slice(0, 24);
@@ -7027,8 +6975,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage) {
7027
6975
  });
7028
6976
  };
7029
6977
  }
7030
- //#endregion
7031
- //#region src/chat/providers/slack/system-turn.ts
6978
+ // src/chat/providers/slack/system-turn.ts
7032
6979
  /**
7033
6980
  * Deliver system Turn output to Slack without a webhook Message.
7034
6981
  *
@@ -7069,8 +7016,7 @@ function createSlackSystemTurnDelivery(args) {
7069
7016
  };
7070
7017
  };
7071
7018
  }
7072
- //#endregion
7073
- //#region src/chat/app/conversation-work.ts
7019
+ // src/chat/app/conversation-work.ts
7074
7020
  /**
7075
7021
  * Build conversation work once for production and integration tests.
7076
7022
  * The app chooses the queue, state, Slack, and agent values here.
@@ -7157,8 +7103,7 @@ function createConversationWork(options) {
7157
7103
  waitUntil: options.waitUntil
7158
7104
  };
7159
7105
  }
7160
- //#endregion
7161
- //#region src/chat/app/production.ts
7106
+ // src/chat/app/production.ts
7162
7107
  let productionSlackAdapter;
7163
7108
  function createProductionSlackAdapter() {
7164
7109
  const signingSecret = getSlackSigningSecret();
@@ -7211,8 +7156,7 @@ function createProductionConversationWorkOptions(options) {
7211
7156
  waitUntil: options.waitUntil
7212
7157
  });
7213
7158
  }
7214
- //#endregion
7215
- //#region src/chat/conversations/web-input.ts
7159
+ // src/chat/conversations/web-input.ts
7216
7160
  function normalizeEmail(email) {
7217
7161
  return email.trim().toLowerCase();
7218
7162
  }
@@ -7373,5 +7317,4 @@ async function appendAndEnqueueWebMessage(input, options) {
7373
7317
  status
7374
7318
  };
7375
7319
  }
7376
- //#endregion
7377
7320
  export { THREAD_OPTOUT_ACK as A, readHealthReport as B, buildSlackInboundMessage as C, normalizeIncomingSlackThreadId as D, stopSlackThread as E, renderSlackObjectCard as F, createVercelAttachmentStorage as I, AGENT_DISPATCH_MAX_AGE_MS as L, parseContent as M, runWithSlackInstallation as N, withNormalizedThreadId as O, verifySlackSignature as P, enqueueAgentDispatch as R, recordSkippedConversationMessage as S, isSlackMessageStopped as T, readViewerAutomationRuns as _, recordWebConversationActivity as a, readViewerAutomations as b, createProductionSlackWebhookServices as c, resolveSlackConversationContextFromThreadId as d, createSlackWebApiStatusSender as f, readViewerAutomationExecutions as g, readConversationSourceTask as h, createConversationId as i, startProcessingReaction as j, stopConversationTurn as k, getProductionSlackAdapter as l, deleteViewerTask as m, conversationTurnIdForMessage as n, webActorFromEmail as o, ViewerTaskNotFoundError as p, createAndEnqueueConversation as r, createProductionConversationWorkOptions as s, appendAndEnqueueWebMessage as t, formatSlackConversationRedactedLabel as u, readViewerAutomationSummary as v, clearSlackPendingReactions as w, resolveViewerTaskCandidate as x, readViewerAutomationVersions as y, GET as z };