@sentry/junior 0.235.0 → 0.237.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 (73) hide show
  1. package/dist/{agent-hooks-DS7k0ZWY.js → agent-hooks-otHGbhBx.js} +20 -9
  2. package/dist/{agent-runner-BlDI1zV2.js → agent-runner-DMAsnPb9.js} +456 -120
  3. package/dist/api/schema.d.ts +223 -2
  4. package/dist/api/schema.js +5 -4
  5. package/dist/api.d.ts +8 -2
  6. package/dist/api.js +404 -47
  7. package/dist/{app-pGsR__aT.d.ts → app-MEd7wbF0.d.ts} +82 -48
  8. package/dist/app.d.ts +3 -3
  9. package/dist/app.js +162 -119
  10. package/dist/{types-Du-HbEun.js → automation-CrQGQ2MT.js} +306 -34
  11. package/dist/{briefs-C3jhszOz.js → briefs-DDA1ugXk.js} +4 -4
  12. package/dist/{catalog-runtime-B9u_3-GW.js → catalog-runtime-DlXuhrmk.js} +1 -1
  13. package/dist/{checkpoint-DLcJ5mKL.js → checkpoint-BlIIiHG5.js} +16 -9
  14. package/dist/cli/chat.d.ts +1 -1
  15. package/dist/cli/chat.js +14 -14
  16. package/dist/cli/check.js +4 -4
  17. package/dist/cli/main.js +1 -1
  18. package/dist/cli/plugins.d.ts +1 -1
  19. package/dist/cli/plugins.js +4 -4
  20. package/dist/cli/snapshot-create.js +3 -3
  21. package/dist/cli/upgrade.d.ts +1 -1
  22. package/dist/cli/upgrade.js +5 -5
  23. package/dist/{client-BSnNHO0R.js → client-CPMbTmJU.js} +2 -2
  24. package/dist/{config-Bmw4xTPK.js → config-CxpPG6nR.js} +57 -17
  25. package/dist/{conversation-C_aYrISI.js → conversation-9Fxa1Zbq.js} +13 -1
  26. package/dist/{conversation-privacy-BV2dtba2.js → conversation-privacy-Dbkdvozu.js} +1 -1
  27. package/dist/{credential-sync-CukzQJ1x.js → credential-sync-D9yGg3q5.js} +14 -14
  28. package/dist/{executor-B9ksWZCv.js → executor-BNxfDS1V.js} +39 -6
  29. package/dist/{images-CEXcQ0Id.js → images-D6Y3FJDQ.js} +3 -3
  30. package/dist/instrumentation.js +2 -2
  31. package/dist/{job-queue-CY1L2YRn.js → job-queue-Dq5_zt_l.js} +1 -1
  32. package/dist/{logging-F--48Q7Q.js → logging-rB_ngE_R.js} +1 -1
  33. package/dist/nitro.d.ts +2 -2
  34. package/dist/nitro.js +5 -5
  35. package/dist/{oauth-authorization-LasSG3Qc.js → oauth-authorization-5T1S1v_1.js} +1 -1
  36. package/dist/{oauth-callback-server-D07ZzVMs.js → oauth-callback-server-Csw7RssK.js} +2 -2
  37. package/dist/{pending-auth-DrG9Mkje.js → pending-auth-moCA2mTc.js} +1 -1
  38. package/dist/{plugins-BT2l4We3.d.ts → plugins-CjfUP5gJ.d.ts} +1 -0
  39. package/dist/{profile-DZ2DUdd1.js → profile-D6apIG2N.js} +4 -4
  40. package/dist/{prompt-BM_5mAU3.js → prompt-Ctwy6hSI.js} +1 -1
  41. package/dist/queue-B5SnqRln.d.ts +25 -0
  42. package/dist/{registry-_JLY0x7b.js → registry-zfTzTHe6.js} +38 -2
  43. package/dist/{resolve-Cuoj3MML.js → resolve-sJtTzuBO.js} +2 -2
  44. package/dist/{runner-BfelmbMv.js → runner-DkCk8cbc.js} +9 -9
  45. package/dist/{sandbox-egress-signals-D5QUIO7Z.js → sandbox-egress-signals-tSQ8OEcw.js} +1 -1
  46. package/dist/{schema-CrdDxGbx.js → schema-C5bgOpRg.js} +3 -2
  47. package/dist/{skills-DAegjk5Y.js → skills-BVpr_Gnv.js} +3 -3
  48. package/dist/{spawn-DCfV7zGK.js → spawn-CJhmyE4E.js} +2 -2
  49. package/dist/{task-queue-GcuFtzor.js → task-queue-BAiZ7_CF.js} +16 -10
  50. package/dist/{task-runner-B0-P_3aq.js → task-runner-Bh8XONXT.js} +9 -9
  51. package/dist/{thread-state-TezcEhuH.js → thread-state-BnQln4jO.js} +5 -5
  52. package/dist/{turn-failure-response-Drhj_-t4.js → turn-failure-response-Ba7_kItn.js} +8 -8
  53. package/dist/{turn-lifecycle-BpIW3zOx.js → turn-lifecycle-D6CTbkb9.js} +1 -1
  54. package/dist/{turn-session-routing-Dg8GDgyc.js → turn-session-routing-DNevs9H7.js} +1 -1
  55. package/dist/{validation-DAkYeKDT.js → validation-BNPhuAvt.js} +2 -3
  56. package/dist/{version-9CB4Z-J4.js → version-EQ4MWuUJ.js} +1 -1
  57. package/dist/version.js +1 -1
  58. package/dist/{web-authorization-Cu33voNg.js → web-authorization-DDt4FZld.js} +6 -6
  59. package/dist/{web-input-B3k0J7WB.js → web-input-C56ivZuH.js} +86 -102
  60. package/dist/web-message-id-xPI_EFSC.js +239 -0
  61. package/dist/{work-PmkvcY9l.js → work-DJ7hb9Ul.js} +7 -7
  62. package/dist/{worker-COcaq2J6.js → worker-DiiV8Lba.js} +5 -5
  63. package/migrations/0045_conversation_forks.sql +3 -0
  64. package/migrations/0046_automation_versions.sql +71 -0
  65. package/migrations/0047_user_timezone.sql +1 -0
  66. package/migrations/meta/0045_snapshot.json +3503 -0
  67. package/migrations/meta/0046_snapshot.json +3707 -0
  68. package/migrations/meta/0047_snapshot.json +3713 -0
  69. package/migrations/meta/_journal.json +22 -1
  70. package/package.json +4 -4
  71. package/dist/web-message-id-CVVCTWUb.js +0 -464
  72. package/dist/{package-discovery-7a9YqLhE.js → package-discovery-BVvSnQBB.js} +1 -1
  73. package/dist/{plugin-module-BKGOXca2.js → plugin-module-CVvEUSMH.js} +1 -1
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { p as logWarn } from "./logging-F--48Q7Q.js";
3
- import { s as skillRoots } from "./package-discovery-7a9YqLhE.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-B9u_3-GW.js";
2
+ import { p as logWarn } from "./logging-rB_ngE_R.js";
3
+ import { s as skillRoots } from "./package-discovery-BVvSnQBB.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-DlXuhrmk.js";
5
5
  import path from "node:path";
6
6
  import { z } from "zod";
7
7
  import fs from "node:fs/promises";
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { An as actorFromRun, jn as toolInvocationDestination } from "./agent-runner-BlDI1zV2.js";
3
- import { n as createAndEnqueueAgentInvocation } from "./work-PmkvcY9l.js";
2
+ import { Rn as actorFromRun, zn as toolInvocationDestination } from "./agent-runner-DMAsnPb9.js";
3
+ import { n as createAndEnqueueAgentInvocation } from "./work-DJ7hb9Ul.js";
4
4
  //#region src/chat/agent-invocations/spawn.ts
5
5
  var spawn_exports = /* @__PURE__ */ __exportAll({ bindSpawnAgent: () => bindSpawnAgent });
6
6
  /** Bind a Run's Actor and credentials to new Agent invocations. */
@@ -1,5 +1,5 @@
1
- import { p as logWarn } from "./logging-F--48Q7Q.js";
2
- import { c as QUEUE_SIGNATURE_MAX_AGE_MS, d as createVercelQueueClient, l as signQueueMessage, p as runWithTurnRequestDeadline, u as verifyQueueMessage } from "./job-queue-CY1L2YRn.js";
1
+ import { p as logWarn } from "./logging-rB_ngE_R.js";
2
+ import { c as QUEUE_SIGNATURE_MAX_AGE_MS, d as createVercelQueueClient, l as signQueueMessage, p as runWithTurnRequestDeadline, u as verifyQueueMessage } from "./job-queue-Dq5_zt_l.js";
3
3
  import { z } from "zod";
4
4
  import { createHash } from "node:crypto";
5
5
  import { handleCallback, registerDevConsumer } from "@vercel/queue";
@@ -7,6 +7,16 @@ import { handleCallback, registerDevConsumer } from "@vercel/queue";
7
7
  /** Shared Vercel Queue callback wiring for signed messages. */
8
8
  /** Build the HTTP callback and local-dev consumer for one signed queue. */
9
9
  function queueCallback(options) {
10
+ const consume = async (message, metadata) => {
11
+ if (options.skip?.(metadata)) return;
12
+ try {
13
+ await runWithTurnRequestDeadline(() => options.run(message, metadata));
14
+ } catch (error) {
15
+ const reason = options.permanentError?.(error);
16
+ if (!reason) throw error;
17
+ options.onRejected(reason, metadata, error);
18
+ }
19
+ };
10
20
  const handler = async (value, metadata) => {
11
21
  if (options.skip?.(metadata)) return;
12
22
  const checked = options.verify(value);
@@ -15,13 +25,7 @@ function queueCallback(options) {
15
25
  return;
16
26
  }
17
27
  if (checked.status === "unavailable") throw new Error(`Queue message verification unavailable: ${checked.reason}`);
18
- try {
19
- await runWithTurnRequestDeadline(() => options.run(checked.message, metadata));
20
- } catch (error) {
21
- const reason = options.permanentError?.(error);
22
- if (!reason) throw error;
23
- options.onRejected(reason, metadata, error);
24
- }
28
+ await consume(checked.message, metadata);
25
29
  };
26
30
  const retry = (error, metadata) => {
27
31
  const reason = options.permanentError?.(error);
@@ -33,6 +37,8 @@ function queueCallback(options) {
33
37
  };
34
38
  const visibility = options.visibilityTimeoutSeconds === void 0 ? {} : { visibilityTimeoutSeconds: options.visibilityTimeoutSeconds };
35
39
  return {
40
+ /** Run a message that an in-process queue already trusts. */
41
+ consume,
36
42
  create: () => handleCallback(handler, {
37
43
  retry,
38
44
  ...visibility
@@ -109,7 +115,7 @@ function pluginTaskCallback() {
109
115
  maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
110
116
  onRejected: logPluginTaskQueueMessageRejected,
111
117
  run: async (message) => {
112
- const { processPluginTask } = await import("./task-runner-B0-P_3aq.js").then((n) => n.r);
118
+ const { processPluginTask } = await import("./task-runner-Bh8XONXT.js").then((n) => n.r);
113
119
  await processPluginTask(message);
114
120
  },
115
121
  topic: PLUGIN_TASK_QUEUE_TOPIC,
@@ -1,14 +1,14 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { p as logWarn } from "./logging-F--48Q7Q.js";
2
+ import { p as logWarn } from "./logging-rB_ngE_R.js";
3
3
  import { b as parseSlackMessageTs, r as credentialSubjectSchema } from "./context-0Et9iVSB.js";
4
- import { $ as readActorIdentity, Ct as createPluginModel, Pt as createPluginConversationEvents, St as createPluginEmbedder, dn as agentTurnTotalTokens, en as getConversationStore, gt as JUNIOR_THREAD_STATE_TTL_MS, p as coreTaskRegistrations, tn as getDb, u as getPlugins, un as agentTurnCostUsd, wt as createPluginLogger, xt as createPluginState } from "./agent-hooks-DS7k0ZWY.js";
5
- import { E as juniorConversations, s as juniorAutomationExecutions } from "./executor-B9ksWZCv.js";
6
- import { rt as sameActorIdentity } from "./conversation-C_aYrISI.js";
7
- import { C as isToolResultError, D as stripRuntimeTurnContext, J as hydrateConversationMessages, T as normalizeToolNameFromResult, b as instructionTextForProjection, g as getPiMessageRole, s as getTurnRecord, w as isToolResultMessage } from "./checkpoint-DLcJ5mKL.js";
8
- import { w as getStateAdapter } from "./profile-DZ2DUdd1.js";
9
- import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-TezcEhuH.js";
10
- import { t as resolveConversationRouting } from "./turn-session-routing-Dg8GDgyc.js";
11
- import { i as pluginTaskParamsSchema, o as sendVercelPluginTask, r as pluginTaskId } from "./task-queue-GcuFtzor.js";
4
+ import { $ as readActorIdentity, Ct as createPluginModel, Pt as createPluginConversationEvents, St as createPluginEmbedder, dn as agentTurnTotalTokens, en as getConversationStore, gt as JUNIOR_THREAD_STATE_TTL_MS, p as coreTaskRegistrations, tn as getDb, u as getPlugins, un as agentTurnCostUsd, wt as createPluginLogger, xt as createPluginState } from "./agent-hooks-otHGbhBx.js";
5
+ import { D as juniorConversations, c as juniorAutomationExecutions } from "./executor-BNxfDS1V.js";
6
+ import { at as sameActorIdentity } from "./conversation-9Fxa1Zbq.js";
7
+ import { C as isToolResultError, D as stripRuntimeTurnContext, T as normalizeToolNameFromResult, Y as hydrateConversationMessages, b as instructionTextForProjection, g as getPiMessageRole, s as getTurnRecord, w as isToolResultMessage } from "./checkpoint-BlIIiHG5.js";
8
+ import { w as getStateAdapter } from "./profile-D6apIG2N.js";
9
+ import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-BnQln4jO.js";
10
+ import { t as resolveConversationRouting } from "./turn-session-routing-DNevs9H7.js";
11
+ import { i as pluginTaskParamsSchema, o as sendVercelPluginTask, r as pluginTaskId } from "./task-queue-BAiZ7_CF.js";
12
12
  import { z } from "zod";
13
13
  import { createHash } from "node:crypto";
14
14
  import { and, asc, count, desc, eq, gte, inArray, lte, max, or, sql } from "drizzle-orm";
@@ -1,9 +1,9 @@
1
- import { I as isRecord, L as toOptionalNumber, R as toOptionalString } from "./logging-F--48Q7Q.js";
2
- import { gt as JUNIOR_THREAD_STATE_TTL_MS, tn as getDb } from "./agent-hooks-DS7k0ZWY.js";
1
+ import { I as isRecord, L as toOptionalNumber, R as toOptionalString } from "./logging-rB_ngE_R.js";
2
+ import { gt as JUNIOR_THREAD_STATE_TTL_MS, tn as getDb } from "./agent-hooks-otHGbhBx.js";
3
3
  import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
4
- import { u as juniorLocationConfigurations } from "./executor-B9ksWZCv.js";
5
- import { Y as persistConversationMessages } from "./checkpoint-DLcJ5mKL.js";
6
- import { w as getStateAdapter } from "./profile-DZ2DUdd1.js";
4
+ import { d as juniorLocationConfigurations } from "./executor-BNxfDS1V.js";
5
+ import { X as persistConversationMessages } from "./checkpoint-BlIIiHG5.js";
6
+ import { w as getStateAdapter } from "./profile-D6apIG2N.js";
7
7
  import { z } from "zod";
8
8
  import { randomUUID } from "node:crypto";
9
9
  import { and, eq, sql } from "drizzle-orm";
@@ -1,12 +1,12 @@
1
- import { _ as getProviderErrorUserMessage, g as getProviderErrorAttributes, h as findProviderError, p as ProviderError } from "./client-BSnNHO0R.js";
2
- import { I as isRecord, t as buildTurnFailureResponse } from "./logging-F--48Q7Q.js";
1
+ import { _ as getProviderErrorUserMessage, g as getProviderErrorAttributes, h as findProviderError, p as ProviderError } from "./client-CPMbTmJU.js";
2
+ import { I as isRecord, t as buildTurnFailureResponse } from "./logging-rB_ngE_R.js";
3
3
  import { b as parseSlackMessageTs } from "./context-0Et9iVSB.js";
4
- import { Gt as listConversationAnnotations, Qt as getConversationEventStore, tn as getDb } from "./agent-hooks-DS7k0ZWY.js";
5
- import { H as readMessageCardRefs, U as removedCardSchema, W as resolveMessageCards } from "./conversation-C_aYrISI.js";
6
- import { J as hydrateConversationMessages, st as markConversationMessage } from "./checkpoint-DLcJ5mKL.js";
7
- import { r as clearPendingAuth, s as buildDeterministicTurnId } from "./pending-auth-DrG9Mkje.js";
8
- import { g as markTurnCompleted, h as markTurnClosed } from "./oauth-authorization-LasSG3Qc.js";
9
- import { o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-TezcEhuH.js";
4
+ import { Gt as listConversationAnnotations, Qt as getConversationEventStore, tn as getDb } from "./agent-hooks-otHGbhBx.js";
5
+ import { G as removedCardSchema, K as resolveMessageCards, W as readMessageCardRefs } from "./conversation-9Fxa1Zbq.js";
6
+ import { Y as hydrateConversationMessages, lt as markConversationMessage } from "./checkpoint-BlIIiHG5.js";
7
+ import { r as clearPendingAuth, s as buildDeterministicTurnId } from "./pending-auth-moCA2mTc.js";
8
+ import { g as markTurnCompleted, h as markTurnClosed } from "./oauth-authorization-5T1S1v_1.js";
9
+ import { o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-BnQln4jO.js";
10
10
  //#region src/chat/conversations/pending-cards.ts
11
11
  /** Select undelivered cards and load their latest saved facts. */
12
12
  async function loadPendingMessageCards(conversationId) {
@@ -1,4 +1,4 @@
1
- import { Qt as getConversationEventStore } from "./agent-hooks-DS7k0ZWY.js";
1
+ import { Qt as getConversationEventStore } from "./agent-hooks-otHGbhBx.js";
2
2
  //#region src/chat/conversations/turn-lifecycle.ts
3
3
  /** Persist correlated turn lifecycle facts with retry-safe terminal exclusion. */
4
4
  var ConversationTurnLifecycleService = class {
@@ -34,7 +34,7 @@ function slackSourceForDestination(args) {
34
34
  * Reads parent Conversations when this Conversation has no Destination.
35
35
  */
36
36
  async function resolveConversationRouting(args) {
37
- const conversationStore = args.conversationStore ?? (await import("./agent-hooks-DS7k0ZWY.js").then((n) => n.Zt)).getConversationStore();
37
+ const conversationStore = args.conversationStore ?? (await import("./agent-hooks-otHGbhBx.js").then((n) => n.Zt)).getConversationStore();
38
38
  const chain = await loadConversationChain(args.conversationId, conversationStore);
39
39
  let destination;
40
40
  let source;
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { n as pluginCatalogRuntime } from "./catalog-runtime-B9u_3-GW.js";
2
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-DlXuhrmk.js";
3
3
  import { isDeepStrictEqual } from "node:util";
4
4
  //#region src/chat/plugins/validation.ts
5
5
  var validation_exports = /* @__PURE__ */ __exportAll({
@@ -32,8 +32,7 @@ function validatePluginEgressCredentialHooks(registrations) {
32
32
  continue;
33
33
  }
34
34
  if (!hasGrantHook || !hasIssueHook) throw new Error(`Plugin "${provider.manifest.name}" egress credential hooks must include both grantForEgress and issueCredential.`);
35
- if (hasGenericCredentials) throw new Error(`Plugin "${provider.manifest.name}" egress credential hooks must use manifest.domains instead of generic credentials or apiHeaders.`);
36
- if (!hasDomains) throw new Error(`Plugin "${provider.manifest.name}" egress credential hooks require manifest.domains to list sandbox egress hosts.`);
35
+ if (!hasDomains && !hasGenericCredentials) throw new Error(`Plugin "${provider.manifest.name}" egress credential hooks require manifest.domains to list sandbox egress hosts.`);
37
36
  }
38
37
  }
39
38
  //#endregion
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.235.0";
2
+ var version = "0.237.0";
3
3
  //#endregion
4
4
  //#region src/version.ts
5
5
  /** Installed Junior package version, or `unknown` when package metadata is unavailable. */
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as JUNIOR_VERSION } from "./version-9CB4Z-J4.js";
1
+ import { t as JUNIOR_VERSION } from "./version-EQ4MWuUJ.js";
2
2
  export { JUNIOR_VERSION };
@@ -1,9 +1,9 @@
1
- import { It as ensureConversationWake, Kt as requestConversationWork } from "./agent-runner-BlDI1zV2.js";
2
- import { Qt as getConversationEventStore } from "./agent-hooks-DS7k0ZWY.js";
3
- import { n as loadTurnCheckpoint, o as failTurnRecord, s as getTurnRecord } from "./checkpoint-DLcJ5mKL.js";
4
- import { w as getStateAdapter } from "./profile-DZ2DUdd1.js";
5
- import { a as getVercelConversationWorkQueue } from "./job-queue-CY1L2YRn.js";
6
- import { n as resolveTurnSessionRouting } from "./turn-session-routing-Dg8GDgyc.js";
1
+ import { $t as requestConversationWork, Ut as ensureConversationWake } from "./agent-runner-DMAsnPb9.js";
2
+ import { Qt as getConversationEventStore } from "./agent-hooks-otHGbhBx.js";
3
+ import { n as loadTurnCheckpoint, o as failTurnRecord, s as getTurnRecord } from "./checkpoint-BlIIiHG5.js";
4
+ import { w as getStateAdapter } from "./profile-D6apIG2N.js";
5
+ import { a as getVercelConversationWorkQueue } from "./job-queue-Dq5_zt_l.js";
6
+ import { n as resolveTurnSessionRouting } from "./turn-session-routing-DNevs9H7.js";
7
7
  import { z } from "zod";
8
8
  import { randomUUID } from "node:crypto";
9
9
  //#region src/chat/task-execution/authorized-turn.ts
@@ -1,29 +1,30 @@
1
- import { $ as deleteEventAutomation, C as isExperimentalFeatureEnabled, Cn as postSlackMessage, D as renderBlockText, Dn as createUserTokenStore, E as renderAttachmentText, F as resolveSlackChannelIdFromThreadId, G as saveScheduledAutomationInLock, H as parseScheduledAutomationRow, I as listThreadReplies, M as parseSlackThreadId, Mn as AuthorizationFlowDisabledError, N as readSlackRawMessageContext, Nn as shouldEmitDevAgentTrace, On as buildSteeringPiMessage, P as resolveSlackChannelIdFromMessage, Rt as getConversationWorkState, Sn as addReactionToMessage, St as pluginEventCatalog, Tt as appendAndEnqueueInboundMessage, U as readScheduledAutomation, X as eventAutomationTriggerAvailable, Z as effectiveTaskOutcomes, _n as escapeSlackMrkdwnText, bn as normalizeSlackStatusText, bt as getEventCatalog, et as eventAutomationBelongsToUser, h as latestProgressStatus, i as createContextCompactor, it as parseEventAutomationRow, j as storeAttachment, kn as RetryableDeliveryError, m as PluginCredentialFailureError, nn as maybePostAutomatedTurnLimitNotice, nt as getEventAutomation, q as withScheduledAutomationLock, r as executeAgentRun, rn as recordFinishedTurnForAutomatedLimit, rt as listDeletedEventAutomationsCreatedBy, t as createAgentRunner, vn as formatSlackLink, vt as EVENT_WAIT_MS, wn as removeReactionFromMessage, wt as appendAndEnqueueExclusiveInboundMessage, xn as truncateStatusText, yn as normalizeSlackReplyMarkdown, yt as isEventMailboxMetadata } from "./agent-runner-BlDI1zV2.js";
2
- import { f as escapeXml, i as completeText, r as completeObject, v as isProviderRetryError } from "./client-BSnNHO0R.js";
3
- import { C as withLogContext, I as isRecord, L as toOptionalNumber, R as toOptionalString, _ as setSentryUser, b as setTags, d as logException, f as logInfo, n as createChatSdkLogger, o as getActiveTraceId, p as logWarn, t as buildTurnFailureResponse, u as logError, v as setSpanAttributes, w as withSpan } from "./logging-F--48Q7Q.js";
4
- import { a as getChatConfig, c as getSlackClientId, d as getSlackSigningSecret, h as normalizeSlackEmojiName, l as getSlackClientSecret, n as botConfig, s as getSlackBotToken } from "./config-Bmw4xTPK.js";
1
+ import { $ as effectiveTaskOutcomes, An as addReactionToMessage, Bn as AuthorizationFlowDisabledError, C as isExperimentalFeatureEnabled, D as renderBlockText, Dn as normalizeSlackStatusText, Dt as getEventCatalog, E as renderAttachmentText, En as normalizeSlackReplyMarkdown, Et as isEventMailboxMetadata, F as resolveSlackChannelIdFromThreadId, Fn as createUserTokenStore, G as readScheduledAutomation, Gt as getConversationWorkState, I as getConversationInfo, In as buildSteeringPiMessage, L as listThreadReplies, Ln as RetryableDeliveryError, M as parseSlackThreadId, Mn as removeReactionFromMessage, Mt as appendAndEnqueueInboundMessage, N as readSlackRawMessageContext, P as resolveSlackChannelIdFromMessage, Q as eventAutomationTriggerAvailable, Tn as formatSlackLink, Tt as EVENT_WAIT_MS, Vn as shouldEmitDevAgentTrace, W as parseScheduledAutomationRow, Y as withScheduledAutomationLock, at as getEventAutomation, dt as listAutomationVersions, h as latestProgressStatus, i as createContextCompactor, j as storeAttachment, jn as postSlackMessage, jt as appendAndEnqueueExclusiveInboundMessage, kn as truncateStatusText, kt as pluginEventCatalog, ln as maybePostAutomatedTurnLimitNotice, m as PluginCredentialFailureError, nt as deleteEventAutomation, ot as listDeletedEventAutomationsCreatedBy, pt as sameDefinitionValue, q as saveScheduledAutomationInLock, r as executeAgentRun, rt as eventAutomationBelongsToUser, st as parseEventAutomationRow, t as createAgentRunner, un as recordFinishedTurnForAutomatedLimit, ut as automationDefinition, wn as escapeSlackMrkdwnText, z as lookupSlackUser } from "./agent-runner-DMAsnPb9.js";
2
+ import { f as escapeXml, i as completeText, r as completeObject, v as isProviderRetryError } from "./client-CPMbTmJU.js";
3
+ import { C as withLogContext, I as isRecord, L as toOptionalNumber, R as toOptionalString, _ as setSentryUser, b as setTags, d as logException, f as logInfo, n as createChatSdkLogger, o as getActiveTraceId, p as logWarn, t as buildTurnFailureResponse, u as logError, v as setSpanAttributes, w as withSpan } from "./logging-rB_ngE_R.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-CxpPG6nR.js";
5
5
  import { o as modelIdForProfile, r as defaultModelId } from "./model-profile-BwU8mqwD.js";
6
6
  import { a as createActor, b as parseSlackMessageTs, c as isActorUserId, l as isUserActor, o as createSlackActor, p as parseSlackChannelId, s as createSlackResumeActor, t as credentialContextForActor, u as parseActorUserId } from "./context-0Et9iVSB.js";
7
- import { B as SlackActionError, Bt as readAttachmentVisionSummary, J as runWithSlackInstallationToken, K as isDmChannel, Lt as buildSentryConversationUrl, Qt as getConversationEventStore, Rt as getSlackFileId, U as getHeaderString, V as downloadPrivateSlackFile, Vt as recordSlackAttachment, W as getSlackClient, _t as getDashboardConversationLink, bn as requireSlackDestination, en as getConversationStore, gt as JUNIOR_THREAD_STATE_TTL_MS, nn as getSqlExecutor, o as getPluginSlackConversationLink, q as normalizeSlackConversationId, st as cancelSubscriptions, tn as getDb, vn as createSlackDestination, vt as getDashboardObjectIconLink } from "./agent-hooks-DS7k0ZWY.js";
7
+ import { B as SlackActionError, Bt as readAttachmentVisionSummary, J as runWithSlackInstallationToken, K as isDmChannel, Lt as buildSentryConversationUrl, Qt as getConversationEventStore, Rt as getSlackFileId, Sn as requireSlackDestination, U as getHeaderString, V as downloadPrivateSlackFile, Vt as recordSlackAttachment, W as getSlackClient, _t as getDashboardConversationLink, bn as createSlackDestination, en as getConversationStore, gt as JUNIOR_THREAD_STATE_TTL_MS, nn as getSqlExecutor, o as getPluginSlackConversationLink, q as normalizeSlackConversationId, st as cancelSubscriptions, tn as getDb, vt as getDashboardObjectIconLink } from "./agent-hooks-otHGbhBx.js";
8
8
  import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
9
- import { D as juniorIdentities, O as juniorUsers, l as juniorEventAutomations, o as juniorSchedulerTasks, s as juniorAutomationExecutions } from "./executor-B9ksWZCv.js";
10
- import { N as isVisionImageMediaType, j as readMessageAttachments, nt as instructionProvenanceFor } from "./conversation-C_aYrISI.js";
11
- import { $ as fallbackShortTitle, A as commitAcceptedReply, B as recordAuthorizationCompleted, J as hydrateConversationMessages, N as loadConversationProjection, O as trimTrailingAssistantMessages, P as loadProjection, Q as resolveConversationTitle, W as recordSubscribedReplyRoute, Y as persistConversationMessages, Z as persistConversationMessageSummaries, a as completeTurnRecord, at as getConversationMessageSlackTs, c as listTurnSummaries, ct as normalizeConversationText, dt as upsertConversationMessage, ft as estimateTextTokens, i as abandonTurnRecord, it as estimateConversationContextTokens, j as commitMessages, l as recordTurnSummary, lt as recordDeliveredAssistantMessage, n as loadTurnCheckpoint, nt as buildConversationContext, o as failTurnRecord, ot as isHumanConversationMessage, p as buildTurnErrorResponse, r as saveTurnCheckpoint, rt as createConversationMemoryService, s as getTurnRecord, st as markConversationMessage, tt as appendThreadContextMessages, u as persistWithRetry, ut as turnHasReply } from "./checkpoint-DLcJ5mKL.js";
12
- import { E as acquireActiveLock, O as withLock, T as MUTATION_LOCK_TTL_MS, w as getStateAdapter } from "./profile-DZ2DUdd1.js";
13
- import { a as isPendingAuthLatestRequest, o as buildDeterministicAssistantMessageId, r as clearPendingAuth, s as buildDeterministicTurnId } from "./pending-auth-DrG9Mkje.js";
14
- import { _ as markTurnFailed, c as CooperativeTurnYieldError, d as getConversationTurnBoundaryError, f as isCooperativeTurnYieldError, g as markTurnCompleted, h as markTurnClosed, l as TurnInputCommitLostError, m as isTurnInputDeferredError, p as isTurnInputCommitLostError, r as getAssistantReplyText, s as ConversationTurnBoundaryError, u as TurnInputDeferredError, v as startActiveTurn } from "./oauth-authorization-LasSG3Qc.js";
15
- import { a as EVENT_SYSTEM_ACTOR, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage } from "./prompt-BM_5mAU3.js";
16
- import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline } from "./job-queue-CY1L2YRn.js";
17
- import { P as healthReportSchema, S as automationListQuerySchema, c as sumUtcHoursIntoSixHours, t as webMessageId } from "./web-message-id-CVVCTWUb.js";
18
- import { C as readAutomationExecutionStatusDays, D as readAutomationRuns, E as readAutomationExecutions, S as readAutomationExecutionHours, T as readAutomationExecutionSummaries, _ as markDispatchFailed, a as confirmDispatchMailboxAppend, b as readAutomationExecutionByConversationId, c as getDispatchInputMessageId, f as isTerminalDispatchStatus, g as markDispatchCompleted, h as markDispatchBlocked, i as claimDispatchMailboxAppend, l as getDispatchRecord, m as markDispatchAwaitingResume, n as scheduleSessionCompletedPluginTasks, s as getDispatchConversationId, t as processPluginTask, u as getDispatchTurnId, v as markDispatchRunning, w as readAutomationExecutionStatusHours, x as readAutomationExecutionDays, y as emptyAutomationRunWindows } from "./task-runner-B0-P_3aq.js";
19
- import { i as resolveAgentInvocationId, o as AgentRunError, s as executeTurn, t as createAgentInvocationWorker } from "./work-PmkvcY9l.js";
20
- import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-BpIW3zOx.js";
21
- 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-TezcEhuH.js";
22
- import { a as getPausedTurnRequest, c as getTurnAuthorization, i as createPausedTurns, n as deleteWebAuthorization, s as wakePausedTurn, t as createWebAuthorization } from "./web-authorization-Cu33voNg.js";
23
- import { n as resolveTurnSessionRouting } from "./turn-session-routing-Dg8GDgyc.js";
24
- import { t as bindSpawnAgent } from "./spawn-DCfV7zGK.js";
25
- 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-Drhj_-t4.js";
26
- import { r as storeInputImages } from "./images-CEXcQ0Id.js";
9
+ import { O as juniorIdentities, c as juniorAutomationExecutions, k as juniorUsers, o as juniorSchedulerTasks, u as juniorEventAutomations } from "./executor-BNxfDS1V.js";
10
+ import { F as isVisionImageMediaType, N as readMessageAttachments, it as instructionProvenanceFor } from "./conversation-9Fxa1Zbq.js";
11
+ import { $ as resolveConversationTitle, A as commitAcceptedReply, G as recordSubscribedReplyRoute, N as loadConversationProjection, O as trimTrailingAssistantMessages, P as loadProjection, Q as persistConversationMessageSummaries, V as recordAuthorizationCompleted, X as persistConversationMessages, Y as hydrateConversationMessages, a as completeTurnRecord, at as createConversationMemoryService, c as listTurnSummaries, ct as isHumanConversationMessage, dt as recordDeliveredAssistantMessage, ft as turnHasReply, i as abandonTurnRecord, it as buildConversationContext, j as commitMessages, l as recordTurnSummary, lt as markConversationMessage, mt as estimateTextTokens, n as loadTurnCheckpoint, o as failTurnRecord, ot as estimateConversationContextTokens, p as buildTurnErrorResponse, pt as upsertConversationMessage, r as saveTurnCheckpoint, rt as appendThreadContextMessages, s as getTurnRecord, st as getConversationMessageSlackTs, tt as fallbackShortTitle, u as persistWithRetry, ut as normalizeConversationText } from "./checkpoint-BlIIiHG5.js";
12
+ import { E as acquireActiveLock, O as withLock, T as MUTATION_LOCK_TTL_MS, w as getStateAdapter } from "./profile-D6apIG2N.js";
13
+ import { a as isPendingAuthLatestRequest, o as buildDeterministicAssistantMessageId, r as clearPendingAuth, s as buildDeterministicTurnId } from "./pending-auth-moCA2mTc.js";
14
+ import { _ as markTurnFailed, c as CooperativeTurnYieldError, d as getConversationTurnBoundaryError, f as isCooperativeTurnYieldError, g as markTurnCompleted, h as markTurnClosed, l as TurnInputCommitLostError, m as isTurnInputDeferredError, p as isTurnInputCommitLostError, r as getAssistantReplyText, s as ConversationTurnBoundaryError, u as TurnInputDeferredError, v as startActiveTurn } from "./oauth-authorization-5T1S1v_1.js";
15
+ import { a as EVENT_SYSTEM_ACTOR, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage } from "./prompt-Ctwy6hSI.js";
16
+ import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline } from "./job-queue-Dq5_zt_l.js";
17
+ import { l as automationListQuerySchema } from "./automation-CrQGQ2MT.js";
18
+ import { c as sumUtcHoursIntoSixHours, m as healthReportSchema, t as webMessageId } from "./web-message-id-xPI_EFSC.js";
19
+ import { C as readAutomationExecutionStatusDays, D as readAutomationRuns, E as readAutomationExecutions, S as readAutomationExecutionHours, T as readAutomationExecutionSummaries, _ as markDispatchFailed, a as confirmDispatchMailboxAppend, b as readAutomationExecutionByConversationId, c as getDispatchInputMessageId, f as isTerminalDispatchStatus, g as markDispatchCompleted, h as markDispatchBlocked, i as claimDispatchMailboxAppend, l as getDispatchRecord, m as markDispatchAwaitingResume, n as scheduleSessionCompletedPluginTasks, s as getDispatchConversationId, t as processPluginTask, u as getDispatchTurnId, v as markDispatchRunning, w as readAutomationExecutionStatusHours, x as readAutomationExecutionDays, y as emptyAutomationRunWindows } from "./task-runner-Bh8XONXT.js";
20
+ import { i as resolveAgentInvocationId, o as AgentRunError, s as executeTurn, t as createAgentInvocationWorker } from "./work-DJ7hb9Ul.js";
21
+ import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-D6CTbkb9.js";
22
+ 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-BnQln4jO.js";
23
+ import { a as getPausedTurnRequest, c as getTurnAuthorization, i as createPausedTurns, n as deleteWebAuthorization, s as wakePausedTurn, t as createWebAuthorization } from "./web-authorization-DDt4FZld.js";
24
+ import { n as resolveTurnSessionRouting } from "./turn-session-routing-DNevs9H7.js";
25
+ import { t as bindSpawnAgent } from "./spawn-CJhmyE4E.js";
26
+ 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-Ba7_kItn.js";
27
+ import { r as storeInputImages } from "./images-D6Y3FJDQ.js";
27
28
  import { z } from "zod";
28
29
  import { createHash } from "node:crypto";
29
30
  import { and, asc, count, desc, eq, exists, inArray, ne, or, sql } from "drizzle-orm";
@@ -2209,74 +2210,6 @@ async function runWithSlackInstallation(args) {
2209
2210
  }, () => runWithSlackInstallationToken(tokenContext.token, args.task));
2210
2211
  }
2211
2212
  //#endregion
2212
- //#region src/chat/slack/user.ts
2213
- const slackUserInfoSchema = z.object({
2214
- ok: z.literal(true),
2215
- user: z.object({
2216
- name: z.string().nullish(),
2217
- profile: z.object({
2218
- email: z.string().nullish(),
2219
- real_name: z.string().nullish()
2220
- }).optional()
2221
- })
2222
- });
2223
- const USER_CACHE_TTL_MS = 3e5;
2224
- const userCache = /* @__PURE__ */ new Map();
2225
- function userCacheKey(teamId, userId) {
2226
- return `${teamId}:${userId}`;
2227
- }
2228
- function readFromCache(teamId, userId) {
2229
- const hit = userCache.get(userCacheKey(teamId, userId));
2230
- if (!hit) return null;
2231
- if (hit.expiresAt < Date.now()) {
2232
- userCache.delete(userCacheKey(teamId, userId));
2233
- return null;
2234
- }
2235
- return hit.value;
2236
- }
2237
- function writeToCache(teamId, userId, value) {
2238
- userCache.set(userCacheKey(teamId, userId), {
2239
- value,
2240
- expiresAt: Date.now() + USER_CACHE_TTL_MS
2241
- });
2242
- }
2243
- /** Fetch Slack user profile info with in-memory TTL cache to avoid repeated API calls. */
2244
- async function lookupSlackUser(teamId, userId) {
2245
- if (!teamId || !userId) return null;
2246
- const cached = readFromCache(teamId, userId);
2247
- if (cached) return cached;
2248
- const token = getSlackBotToken();
2249
- if (!token) return null;
2250
- try {
2251
- const response = await fetch(`https://slack.com/api/users.info?user=${encodeURIComponent(userId)}`, { headers: { authorization: `Bearer ${token}` } });
2252
- if (!response.ok) {
2253
- logWarn("slack.user.lookup.failed", {
2254
- "enduser.id": userId,
2255
- "app.slack.team_id": teamId,
2256
- "http.response.status_code": response.status
2257
- });
2258
- return null;
2259
- }
2260
- const parsed = slackUserInfoSchema.safeParse(await response.json());
2261
- if (!parsed.success) return null;
2262
- const payload = parsed.data;
2263
- const result = {
2264
- userName: payload.user.name?.trim() || void 0,
2265
- fullName: payload.user.profile?.real_name?.trim() || void 0,
2266
- email: payload.user.profile?.email?.trim() || void 0
2267
- };
2268
- writeToCache(teamId, userId, result);
2269
- return result;
2270
- } catch (error) {
2271
- logWarn("slack.user.lookup.failed", {
2272
- "enduser.id": userId,
2273
- "app.slack.team_id": teamId,
2274
- "exception.message": error instanceof Error ? error.message : String(error)
2275
- });
2276
- return null;
2277
- }
2278
- }
2279
- //#endregion
2280
2213
  //#region src/chat/task-execution/slack-work.ts
2281
2214
  const slackConversationRouteSchema = z.enum(["mention", "subscribed"]);
2282
2215
  function hasSteeringOverride(text) {
@@ -3376,6 +3309,7 @@ async function deleteViewerScheduledAutomation(db, user, id, nowMs = Date.now())
3376
3309
  //#endregion
3377
3310
  //#region src/chat/automations/read.ts
3378
3311
  const TASK_EXECUTION_LIST_LIMIT = 100;
3312
+ const AUTOMATION_VERSION_LIST_LIMIT = 100;
3379
3313
  function creatorLabel(creator) {
3380
3314
  return creator.fullName?.trim() || (creator.userName?.trim() ? `@${creator.userName.trim()}` : "") || creator.slackUserId;
3381
3315
  }
@@ -3505,6 +3439,7 @@ function eventAutomationSummary(task, ownedByViewer, destination, stats, creator
3505
3439
  function viewerTeamIds(user) {
3506
3440
  return [...new Set(user.identities.filter((identity) => identity.provider === "slack").map((identity) => identity.providerTenantId).filter((teamId) => Boolean(teamId)))];
3507
3441
  }
3442
+ /** Resolve an Automation the viewer owns or can read through a public Destination. */
3508
3443
  async function resolveViewerTaskCandidate(user, kind, id) {
3509
3444
  const db = getDb();
3510
3445
  const identityIds = new Set(user.identities.map((identity) => identity.id));
@@ -3749,6 +3684,19 @@ async function readViewerAutomationExecutions(user, kind, id) {
3749
3684
  truncated: executions.length > TASK_EXECUTION_LIST_LIMIT
3750
3685
  };
3751
3686
  }
3687
+ /** Read saved definitions for one viewer-visible Automation, newest first. */
3688
+ async function readViewerAutomationVersions(user, kind, id) {
3689
+ const candidate = await resolveViewerTaskCandidate(user, kind, id);
3690
+ if (!candidate) throw new ViewerTaskNotFoundError();
3691
+ const versions = await listAutomationVersions(getDb(), kind, id, 101);
3692
+ const current = automationDefinition(candidate.task);
3693
+ const listed = versions.slice(0, AUTOMATION_VERSION_LIST_LIMIT);
3694
+ return {
3695
+ versions: listed,
3696
+ activeVersion: listed.find(({ definition }) => sameDefinitionValue(definition, current))?.version ?? null,
3697
+ truncated: versions.length > AUTOMATION_VERSION_LIST_LIMIT
3698
+ };
3699
+ }
3752
3700
  /** Resolve the source task for one conversation when a terminal execution links it. */
3753
3701
  async function readConversationSourceTask(args) {
3754
3702
  const execution = await readAutomationExecutionByConversationId({ conversationId: args.conversationId });
@@ -4520,13 +4468,23 @@ function toSlackEventChannelType(channelType) {
4520
4468
  /**
4521
4469
  * Map Slack's Events API channel_type to a source-confirmed visibility.
4522
4470
  *
4523
- * Slack's event metadata is the only visibility authority; channel IDs never
4524
- * classify visibility.
4471
+ * Slack's event metadata and live conversation metadata are the only
4472
+ * visibility authorities; channel IDs never classify visibility.
4525
4473
  */
4526
4474
  function conversationVisibilityFromSlackChannelType(channelType) {
4527
4475
  if (!channelType) return void 0;
4528
4476
  return channelType === "channel" ? "public" : "private";
4529
4477
  }
4478
+ /**
4479
+ * Map live `conversations.info` metadata to Slack's Events API channel type,
4480
+ * for events that carry no `channel_type`.
4481
+ */
4482
+ function slackChannelTypeFromConversationInfo(info) {
4483
+ if (info.isIm) return "im";
4484
+ if (info.isMpim) return "mpim";
4485
+ if (info.isPrivate) return "group";
4486
+ return info.isChannel ? "channel" : void 0;
4487
+ }
4530
4488
  /** Resolve Slack's raw event channel type from a Chat SDK message-like object. */
4531
4489
  function resolveSlackChannelTypeFromMessage(message) {
4532
4490
  const raw = message.raw;
@@ -4686,6 +4644,26 @@ async function resolveChannelName(thread) {
4686
4644
  return;
4687
4645
  }
4688
4646
  }
4647
+ /**
4648
+ * Return the Slack channel type of a message.
4649
+ *
4650
+ * Slack delivers a channel mention as two events with the same `ts`: `message`
4651
+ * has `channel_type`, and `app_mention` does not. Junior stores the event that
4652
+ * arrives first. When that event has no `channel_type`, ask Slack for the
4653
+ * conversation, so the turn does not depend on the order of the two events.
4654
+ */
4655
+ async function resolveSlackChannelType(message, channelId) {
4656
+ const eventChannelType = resolveSlackChannelTypeFromMessage(message);
4657
+ if (eventChannelType) return eventChannelType;
4658
+ const slackChannelId = parseSlackChannelId(channelId);
4659
+ if (!slackChannelId) return;
4660
+ try {
4661
+ return slackChannelTypeFromConversationInfo(await getConversationInfo(slackChannelId));
4662
+ } catch (error) {
4663
+ if (error instanceof SlackActionError) return;
4664
+ throw error;
4665
+ }
4666
+ }
4689
4667
  /** Collect attachments from the current Slack message and its batch. */
4690
4668
  function collectAttachments(message, batchedMessages) {
4691
4669
  return [...(batchedMessages ?? []).flatMap((queued) => queued.message.attachments), ...message.attachments];
@@ -4761,7 +4739,7 @@ function createSlackTurn(deps) {
4761
4739
  const channelId = getChannelId(thread, message);
4762
4740
  const channelName = !options.execution && channelId ? await resolveChannelName(thread) : void 0;
4763
4741
  const destination = requireSlackDestination(options.destination, "Slack reply execution");
4764
- const slackChannelType = resolveSlackChannelTypeFromMessage(message);
4742
+ const slackChannelType = options.execution ? resolveSlackChannelTypeFromMessage(message) : await resolveSlackChannelType(message, channelId);
4765
4743
  const slackConversation = resolveSlackConversationContext({
4766
4744
  channelId,
4767
4745
  channelName,
@@ -5253,7 +5231,7 @@ function createSlackTurn(deps) {
5253
5231
  if (newSteeringMessages.length > 0) piMessages = [...piMessages ?? [], ...newSteeringMessages];
5254
5232
  }
5255
5233
  status.update();
5256
- resolveConversationTitle({ conversationId }).then(async (title) => {
5234
+ const titleProjection = resolveConversationTitle({ conversationId }).then(async (title) => {
5257
5235
  if (!title) return;
5258
5236
  await maybeSyncAssistantTitle({
5259
5237
  channelId: assistantThreadContext?.channelId,
@@ -5264,6 +5242,7 @@ function createSlackTurn(deps) {
5264
5242
  }).catch((error) => {
5265
5243
  logException(error, "conversation.title.task.failed");
5266
5244
  });
5245
+ deps.waitUntil?.(titleProjection);
5267
5246
  const toolChannelId = channelId;
5268
5247
  const activeInstructionAuthorId = actor?.userId ?? parseActorUserId(message.author.userId);
5269
5248
  const activeInstructionAuthorName = actor?.fullName ?? actor?.userName;
@@ -5942,7 +5921,8 @@ function createSlackRuntime(options) {
5942
5921
  pausedTurns: options.pausedTurns ?? createPausedTurns(),
5943
5922
  prepareTurnState,
5944
5923
  resolveUserAttachments: services.visionContext.resolveUserAttachments,
5945
- sendPluginTask: options.sendPluginTask
5924
+ sendPluginTask: options.sendPluginTask,
5925
+ waitUntil: options.waitUntil
5946
5926
  });
5947
5927
  return {
5948
5928
  ...createSlackTurnRuntime({
@@ -7593,7 +7573,8 @@ function createConversationWork(options) {
7593
7573
  services: {
7594
7574
  ...options.services,
7595
7575
  agentRunner: options.agentRunner
7596
- }
7576
+ },
7577
+ waitUntil: options.waitUntil
7597
7578
  });
7598
7579
  const runtime = options.wrapRuntime?.(baseRuntime) ?? baseRuntime;
7599
7580
  const scheduleCompletedPluginTasks = options.sendPluginTask ? async (params) => await scheduleSessionCompletedPluginTasks(params, { send: options.sendPluginTask }) : void 0;
@@ -7644,7 +7625,8 @@ function createConversationWork(options) {
7644
7625
  queue: options.queue,
7645
7626
  run,
7646
7627
  runtime,
7647
- state: options.state
7628
+ state: options.state,
7629
+ waitUntil: options.waitUntil
7648
7630
  };
7649
7631
  }
7650
7632
  //#endregion
@@ -7684,7 +7666,7 @@ function createProductionSlackWebhookServices(options) {
7684
7666
  getSlackAdapter: getProductionSlackAdapter,
7685
7667
  getUserTokenStore: createUserTokenStore,
7686
7668
  conversationStore,
7687
- queue: getVercelConversationWorkQueue(),
7669
+ queue: options.queue,
7688
7670
  runtime
7689
7671
  };
7690
7672
  }
@@ -7695,8 +7677,10 @@ function createProductionConversationWorkOptions(options) {
7695
7677
  agentRunner: options.agentRunner,
7696
7678
  conversationStore,
7697
7679
  getSlackAdapter: getProductionSlackAdapter,
7698
- queue: getVercelConversationWorkQueue(),
7699
- services: options.services
7680
+ queue: options.queue,
7681
+ sendPluginTask: options.sendPluginTask,
7682
+ services: options.services,
7683
+ waitUntil: options.waitUntil
7700
7684
  });
7701
7685
  }
7702
7686
  //#endregion
@@ -7862,4 +7846,4 @@ async function appendAndEnqueueWebMessage(input, options) {
7862
7846
  };
7863
7847
  }
7864
7848
  //#endregion
7865
- export { THREAD_OPTOUT_ACK as A, verifySlackSignature as C, withNormalizedThreadId as D, normalizeIncomingSlackThreadId as E, createVercelAttachmentStorage as F, AGENT_DISPATCH_MAX_AGE_MS as I, enqueueAgentDispatch as L, parseContent as M, getThreadStopDecision as N, getAuthPausedConversationTurnId as O, renderSlackObjectCard as P, GET as R, runWithSlackInstallation as S, stopSlackThread as T, readViewerAutomations as _, webActorFromEmail as a, clearSlackPendingReactions as b, getProductionSlackAdapter as c, ViewerTaskNotFoundError as d, deleteViewerTask as f, readViewerAutomationSummary as g, readViewerAutomationRuns as h, recordWebConversationActivity as i, startProcessingReaction as j, legacyWebMailboxMetadataSchema as k, formatSlackConversationRedactedLabel as l, readViewerAutomationExecutions as m, conversationTurnIdForMessage as n, createProductionConversationWorkOptions as o, readConversationSourceTask as p, createAndEnqueueConversation as r, createProductionSlackWebhookServices as s, appendAndEnqueueWebMessage as t, resolveSlackConversationContextFromThreadId as u, recordSkippedConversationMessage as v, isSlackMessageStopped as w, lookupSlackUser as x, buildSlackInboundMessage as y, readHealthReport as z };
7849
+ export { getAuthPausedConversationTurnId as A, GET as B, clearSlackPendingReactions as C, stopSlackThread as D, isSlackMessageStopped as E, getThreadStopDecision as F, renderSlackObjectCard as I, createVercelAttachmentStorage as L, THREAD_OPTOUT_ACK as M, startProcessingReaction as N, normalizeIncomingSlackThreadId as O, parseContent as P, AGENT_DISPATCH_MAX_AGE_MS as R, buildSlackInboundMessage as S, verifySlackSignature as T, readHealthReport as V, readViewerAutomationSummary as _, recordWebConversationActivity as a, resolveViewerTaskCandidate as b, createProductionSlackWebhookServices as c, resolveSlackConversationContextFromThreadId as d, ViewerTaskNotFoundError as f, readViewerAutomationRuns as g, readViewerAutomationExecutions as h, createConversationId as i, legacyWebMailboxMetadataSchema as j, withNormalizedThreadId as k, getProductionSlackAdapter as l, readConversationSourceTask as m, conversationTurnIdForMessage as n, webActorFromEmail as o, deleteViewerTask as p, createAndEnqueueConversation as r, createProductionConversationWorkOptions as s, appendAndEnqueueWebMessage as t, formatSlackConversationRedactedLabel as u, readViewerAutomationVersions as v, runWithSlackInstallation as w, recordSkippedConversationMessage as x, readViewerAutomations as y, enqueueAgentDispatch as z };