@sentry/junior 0.234.0 → 0.236.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 (71) hide show
  1. package/dist/{agent-hooks-BcH6E48y.js → agent-hooks-Da_H0jHv.js} +17 -10
  2. package/dist/{agent-runner-DUkGlK89.js → agent-runner-uP7QRc4c.js} +484 -162
  3. package/dist/api/schema.d.ts +288 -2
  4. package/dist/api/schema.js +5 -4
  5. package/dist/api.d.ts +8 -2
  6. package/dist/api.js +524 -83
  7. package/dist/{app-xk2-Id1T.d.ts → app-MEd7wbF0.d.ts} +83 -49
  8. package/dist/app.d.ts +3 -3
  9. package/dist/app.js +164 -119
  10. package/dist/{types-Du-HbEun.js → automation-B9Kc1gcf.js} +304 -33
  11. package/dist/{briefs-lyAQbDxJ.js → briefs-DrjBPQFy.js} +4 -4
  12. package/dist/{catalog-runtime-BSgsPVnr.js → catalog-runtime-C7339Cfm.js} +1 -1
  13. package/dist/{checkpoint-BNfXlq_1.js → checkpoint-DaD7_Gsb.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-BX5lJRqW.js → client-Ch9Hg9NU.js} +2 -2
  24. package/dist/{config-DuCzUoCo.js → config-JR9wke1W.js} +57 -17
  25. package/dist/{conversation-CPjHYOV5.js → conversation-9Fxa1Zbq.js} +14 -1
  26. package/dist/{conversation-privacy-CSxvdSoV.js → conversation-privacy-au02dyZK.js} +1 -1
  27. package/dist/{credential-sync-BO4DfH9a.js → credential-sync-BWTA3LnL.js} +14 -14
  28. package/dist/{executor--jWf-Nnm.js → executor-BW9XWgUQ.js} +70 -6
  29. package/dist/{images-BaL19wFC.js → images-BdG7zcNf.js} +3 -3
  30. package/dist/instrumentation.js +2 -2
  31. package/dist/{job-queue-cwHVOwVZ.js → job-queue-BqXd0ZPV.js} +1 -1
  32. package/dist/{logging-Cox1Mgcv.js → logging-B4sKwmCG.js} +1 -1
  33. package/dist/nitro.d.ts +2 -2
  34. package/dist/nitro.js +5 -5
  35. package/dist/{oauth-authorization-CC8a1JKP.js → oauth-authorization-BjRN99dc.js} +1 -1
  36. package/dist/{oauth-callback-server-Z7QSt416.js → oauth-callback-server-B_1p98Mb.js} +2 -2
  37. package/dist/{pending-auth-DQhC3eSR.js → pending-auth-WqF4Gh8Z.js} +1 -1
  38. package/dist/{plugins-BT2l4We3.d.ts → plugins-CjfUP5gJ.d.ts} +1 -0
  39. package/dist/{profile-BdApelHS.js → profile-BamYnmhO.js} +4 -4
  40. package/dist/{prompt-3D0sSbTC.js → prompt-Ctwy6hSI.js} +1 -1
  41. package/dist/queue-B5SnqRln.d.ts +25 -0
  42. package/dist/{registry-DiY6B8CN.js → registry-CXNv9fDX.js} +38 -2
  43. package/dist/{resolve-VpJoiDpc.js → resolve-C9ETkt4T.js} +2 -2
  44. package/dist/{runner-BIMegnPE.js → runner-DnBGVRnW.js} +9 -9
  45. package/dist/{sandbox-egress-signals-Cbtxe492.js → sandbox-egress-signals-DwJ7Boi_.js} +1 -1
  46. package/dist/{schema-CxwnlTDN.js → schema-CJiqDc5r.js} +26 -3
  47. package/dist/{skills-WttpPJUy.js → skills-Dd8O9Aav.js} +3 -3
  48. package/dist/{spawn-DhfMKt4y.js → spawn-DFdRspSD.js} +2 -2
  49. package/dist/{task-queue-CZqUNJD0.js → task-queue-DGQEOk1A.js} +16 -10
  50. package/dist/{task-runner-BZaqoUCT.js → task-runner-C5XCIDSF.js} +9 -9
  51. package/dist/{thread-state-8tXZhu0y.js → thread-state-D3E29wZk.js} +5 -5
  52. package/dist/{turn-failure-response-DFJ9L9NQ.js → turn-failure-response-TDoj0aZz.js} +8 -8
  53. package/dist/{turn-lifecycle-WbpTUQ_r.js → turn-lifecycle-DOnU45p7.js} +1 -1
  54. package/dist/{turn-session-routing--EhI76rH.js → turn-session-routing-DbpZZoin.js} +1 -1
  55. package/dist/{validation-0F9IgG3b.js → validation-B9lMbisx.js} +1 -1
  56. package/dist/{version-A7-RRBOE.js → version-CWkIGcLU.js} +1 -1
  57. package/dist/version.js +1 -1
  58. package/dist/{web-authorization-BJggXofy.js → web-authorization-PPaoj2ns.js} +6 -6
  59. package/dist/{web-input-B-siN5Dr.js → web-input-CfNxXtHm.js} +86 -34
  60. package/dist/web-message-id-xPI_EFSC.js +239 -0
  61. package/dist/{work-CNc0ejGG.js → work-DNaoFrEe.js} +7 -7
  62. package/dist/{worker-BHbqpUAu.js → worker-xeJLxYwm.js} +5 -5
  63. package/migrations/0045_conversation_forks.sql +3 -0
  64. package/migrations/0046_automation_versions.sql +71 -0
  65. package/migrations/meta/0045_snapshot.json +3503 -0
  66. package/migrations/meta/0046_snapshot.json +3707 -0
  67. package/migrations/meta/_journal.json +15 -1
  68. package/package.json +5 -5
  69. package/dist/web-message-id-CVVCTWUb.js +0 -464
  70. package/dist/{package-discovery-7a9YqLhE.js → package-discovery-BVvSnQBB.js} +1 -1
  71. package/dist/{plugin-module-BKGOXca2.js → plugin-module-CVvEUSMH.js} +1 -1
@@ -1,13 +1,13 @@
1
- import { C as withLogContext, b as setTags, d as logException } from "./logging-Cox1Mgcv.js";
1
+ import { C as withLogContext, b as setTags, d as logException } from "./logging-B4sKwmCG.js";
2
2
  import { t as credentialContextForActor } from "./context-0Et9iVSB.js";
3
- import { $t as getConversationStore, Zt as getConversationEventStore } from "./agent-hooks-BcH6E48y.js";
4
- import { V as messageCardText } from "./conversation-CPjHYOV5.js";
5
- import { A as commitAcceptedReply, B as recordAuthorizationCompleted, J as hydrateConversationMessages, P as loadProjection, Y as persistConversationMessages, ct as normalizeConversationText, dt as upsertConversationMessage, lt as recordDeliveredAssistantMessage, nt as buildConversationContext, r as saveTurnCheckpoint, st as markConversationMessage, u as persistWithRetry } from "./checkpoint-BNfXlq_1.js";
6
- import { _ as markTurnFailed, r as getAssistantReplyText, t as authorizationId, v as startActiveTurn } from "./oauth-authorization-CC8a1JKP.js";
7
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-BZaqoUCT.js";
8
- import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-WbpTUQ_r.js";
9
- import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-8tXZhu0y.js";
10
- import { d as loadPendingMessageCards, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, t as finalizeFailedTurnReplyWithEvent } from "./turn-failure-response-DFJ9L9NQ.js";
3
+ import { Qt as getConversationEventStore, en as getConversationStore } from "./agent-hooks-Da_H0jHv.js";
4
+ import { U as messageCardText } from "./conversation-9Fxa1Zbq.js";
5
+ import { A as commitAcceptedReply, P as loadProjection, V as recordAuthorizationCompleted, X as persistConversationMessages, Y as hydrateConversationMessages, dt as recordDeliveredAssistantMessage, it as buildConversationContext, lt as markConversationMessage, pt as upsertConversationMessage, r as saveTurnCheckpoint, u as persistWithRetry, ut as normalizeConversationText } from "./checkpoint-DaD7_Gsb.js";
6
+ import { _ as markTurnFailed, r as getAssistantReplyText, t as authorizationId, v as startActiveTurn } from "./oauth-authorization-BjRN99dc.js";
7
+ import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-C5XCIDSF.js";
8
+ import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-DOnU45p7.js";
9
+ import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-D3E29wZk.js";
10
+ import { d as loadPendingMessageCards, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, t as finalizeFailedTurnReplyWithEvent } from "./turn-failure-response-TDoj0aZz.js";
11
11
  import { randomUUID } from "node:crypto";
12
12
  import { createLocalSource, localDestinationSchema } from "@sentry/junior-plugin-api";
13
13
  //#region src/chat/local/runner.ts
@@ -1,4 +1,4 @@
1
- import { fn as sandboxEgressSignalsResponseSchema } from "./agent-runner-DUkGlK89.js";
1
+ import { vn as sandboxEgressSignalsResponseSchema } from "./agent-runner-uP7QRc4c.js";
2
2
  //#region src/chat/local/sandbox-egress-signals.ts
3
3
  const SANDBOX_EGRESS_SIGNALS_PATH = "/api/internal/sandbox-egress/signals";
4
4
  const LOCAL_DEV_SERVER_TIMEOUT_MS = 1e3;
@@ -1,6 +1,7 @@
1
1
  import { t as juniorDestinationKindSchema } from "./destinations-BeBiJeEM.js";
2
- import { E as conversationSummaryReportSchema, n as actorIdentitySchema, w as conversationStatsItemSchema } from "./conversation-CPjHYOV5.js";
3
- import { a as fillUtcHours, c as sumUtcHoursIntoSixHours, i as fillUtcDays } from "./web-message-id-CVVCTWUb.js";
2
+ import { E as conversationSummaryReportSchema, n as actorIdentitySchema, w as conversationStatsItemSchema } from "./conversation-9Fxa1Zbq.js";
3
+ import "./automation-B9Kc1gcf.js";
4
+ import { a as fillUtcHours, c as sumUtcHoursIntoSixHours, i as fillUtcDays } from "./web-message-id-xPI_EFSC.js";
4
5
  import { z } from "zod";
5
6
  import { codeChangeStateSchema } from "@sentry/junior-plugin-api";
6
7
  //#region src/api/schema/common.ts
@@ -61,6 +62,28 @@ const codeOverviewReportSchema = z.object({
61
62
  windowEnd: z.string(),
62
63
  windowStart: z.string()
63
64
  }).strict();
65
+ const codeRepositoryParamsSchema = z.object({ repositoryId: z.string().uuid() }).strict();
66
+ /** Code activity, recent changes, and Workspaces for one repository. */
67
+ const codeRepositoryReportSchema = z.object({
68
+ activityDays: z.array(codeActivityDaySchema),
69
+ activityHours: z.array(codeActivityDaySchema).optional(),
70
+ activitySixHours: z.array(codeActivityDaySchema).optional(),
71
+ changes: z.array(codeChangeSummaryReportSchema),
72
+ generatedAt: z.string(),
73
+ repository: z.object({
74
+ id: z.string().uuid(),
75
+ name: z.string().min(1),
76
+ provider: z.string().min(1),
77
+ url: z.string().url().optional()
78
+ }).strict(),
79
+ summary: codeChangeSummarySchema,
80
+ windowEnd: z.string(),
81
+ windowStart: z.string(),
82
+ workspaces: z.array(z.object({
83
+ id: z.string().min(1),
84
+ name: z.string().min(1)
85
+ }).strict())
86
+ }).strict();
64
87
  /** Person-scoped code activity for one People profile. */
65
88
  const codePersonReportSchema = z.object({
66
89
  activityDays: z.array(codeActivityDaySchema),
@@ -320,4 +343,4 @@ const statsReportSchema = z.object({
320
343
  windowStart: z.string()
321
344
  }).strict();
322
345
  //#endregion
323
- export { codeChangeSummarySchema as A, locationParamsSchema as C, dailyConversationActivitySchema as D, activitySixHours as E, codePersonReportSchema as M, codeRepositorySummarySchema as N, codeActivityDaySchema as O, apiErrorSchema as P, locationDirectoryReportSchema as S, activityHours as T, actorProfileReportSchema as _, workspaceBodySchema as a, locationActivityDayReportSchema as b, workspaceRepoSchema as c, createdPersonalTokenSchema as d, personalTokenListSchema as f, actorDirectoryReportSchema as g, revokePersonalTokenResponseSchema as h, deleteWorkspaceResponseSchema as i, codeOverviewReportSchema as j, codeChangeSummaryReportSchema as k, workspaceSchema as l, personalTokenParamsSchema as m, statsReportSchema as n, workspaceListSchema as o, personalTokenMetadataSchema as p, baselineSnapshotSchema as r, workspaceParamsSchema as s, statSchema as t, createPersonalTokenBodySchema as u, personParamsSchema as v, activityDays as w, locationDetailReportSchema as x, personalSpendReportSchema as y };
346
+ export { codeChangeSummarySchema as A, locationParamsSchema as C, dailyConversationActivitySchema as D, activitySixHours as E, codeRepositorySummarySchema as F, apiErrorSchema as I, codePersonReportSchema as M, codeRepositoryParamsSchema as N, codeActivityDaySchema as O, codeRepositoryReportSchema as P, locationDirectoryReportSchema as S, activityHours as T, actorProfileReportSchema as _, workspaceBodySchema as a, locationActivityDayReportSchema as b, workspaceRepoSchema as c, createdPersonalTokenSchema as d, personalTokenListSchema as f, actorDirectoryReportSchema as g, revokePersonalTokenResponseSchema as h, deleteWorkspaceResponseSchema as i, codeOverviewReportSchema as j, codeChangeSummaryReportSchema as k, workspaceSchema as l, personalTokenParamsSchema as m, statsReportSchema as n, workspaceListSchema as o, personalTokenMetadataSchema as p, baselineSnapshotSchema as r, workspaceParamsSchema as s, statSchema as t, createPersonalTokenBodySchema as u, personParamsSchema as v, activityDays as w, locationDetailReportSchema as x, personalSpendReportSchema as y };
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { p as logWarn } from "./logging-Cox1Mgcv.js";
3
- import { s as skillRoots } from "./package-discovery-7a9YqLhE.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-BSgsPVnr.js";
2
+ import { p as logWarn } from "./logging-B4sKwmCG.js";
3
+ import { s as skillRoots } from "./package-discovery-BVvSnQBB.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-C7339Cfm.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-DUkGlK89.js";
3
- import { n as createAndEnqueueAgentInvocation } from "./work-CNc0ejGG.js";
2
+ import { Ln as actorFromRun, Rn as toolInvocationDestination } from "./agent-runner-uP7QRc4c.js";
3
+ import { n as createAndEnqueueAgentInvocation } from "./work-DNaoFrEe.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-Cox1Mgcv.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-cwHVOwVZ.js";
1
+ import { p as logWarn } from "./logging-B4sKwmCG.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-BqXd0ZPV.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-BZaqoUCT.js").then((n) => n.r);
118
+ const { processPluginTask } = await import("./task-runner-C5XCIDSF.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-Cox1Mgcv.js";
2
+ import { p as logWarn } from "./logging-B4sKwmCG.js";
3
3
  import { b as parseSlackMessageTs, r as credentialSubjectSchema } from "./context-0Et9iVSB.js";
4
- import { $t as getConversationStore, Ct as createPluginLogger, Nt as createPluginConversationEvents, Q as readActorIdentity, St as createPluginModel, bt as createPluginState, en as getDb, ht as JUNIOR_THREAD_STATE_TTL_MS, ln as agentTurnCostUsd, p as coreTaskRegistrations, u as getPlugins, un as agentTurnTotalTokens, xt as createPluginEmbedder } from "./agent-hooks-BcH6E48y.js";
5
- import { E as juniorConversations, s as juniorAutomationExecutions } from "./executor--jWf-Nnm.js";
6
- import { rt as sameActorIdentity } from "./conversation-CPjHYOV5.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-BNfXlq_1.js";
8
- import { w as getStateAdapter } from "./profile-BdApelHS.js";
9
- import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-8tXZhu0y.js";
10
- import { t as resolveConversationRouting } from "./turn-session-routing--EhI76rH.js";
11
- import { i as pluginTaskParamsSchema, o as sendVercelPluginTask, r as pluginTaskId } from "./task-queue-CZqUNJD0.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-Da_H0jHv.js";
5
+ import { D as juniorConversations, c as juniorAutomationExecutions } from "./executor-BW9XWgUQ.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-DaD7_Gsb.js";
8
+ import { w as getStateAdapter } from "./profile-BamYnmhO.js";
9
+ import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-D3E29wZk.js";
10
+ import { t as resolveConversationRouting } from "./turn-session-routing-DbpZZoin.js";
11
+ import { i as pluginTaskParamsSchema, o as sendVercelPluginTask, r as pluginTaskId } from "./task-queue-DGQEOk1A.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-Cox1Mgcv.js";
2
- import { en as getDb, ht as JUNIOR_THREAD_STATE_TTL_MS } from "./agent-hooks-BcH6E48y.js";
1
+ import { I as isRecord, L as toOptionalNumber, R as toOptionalString } from "./logging-B4sKwmCG.js";
2
+ import { gt as JUNIOR_THREAD_STATE_TTL_MS, tn as getDb } from "./agent-hooks-Da_H0jHv.js";
3
3
  import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
4
- import { u as juniorLocationConfigurations } from "./executor--jWf-Nnm.js";
5
- import { Y as persistConversationMessages } from "./checkpoint-BNfXlq_1.js";
6
- import { w as getStateAdapter } from "./profile-BdApelHS.js";
4
+ import { d as juniorLocationConfigurations } from "./executor-BW9XWgUQ.js";
5
+ import { X as persistConversationMessages } from "./checkpoint-DaD7_Gsb.js";
6
+ import { w as getStateAdapter } from "./profile-BamYnmhO.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-BX5lJRqW.js";
2
- import { I as isRecord, t as buildTurnFailureResponse } from "./logging-Cox1Mgcv.js";
1
+ import { _ as getProviderErrorUserMessage, g as getProviderErrorAttributes, h as findProviderError, p as ProviderError } from "./client-Ch9Hg9NU.js";
2
+ import { I as isRecord, t as buildTurnFailureResponse } from "./logging-B4sKwmCG.js";
3
3
  import { b as parseSlackMessageTs } from "./context-0Et9iVSB.js";
4
- import { Wt as listConversationAnnotations, Zt as getConversationEventStore, en as getDb } from "./agent-hooks-BcH6E48y.js";
5
- import { H as readMessageCardRefs, U as removedCardSchema, W as resolveMessageCards } from "./conversation-CPjHYOV5.js";
6
- import { J as hydrateConversationMessages, st as markConversationMessage } from "./checkpoint-BNfXlq_1.js";
7
- import { r as clearPendingAuth, s as buildDeterministicTurnId } from "./pending-auth-DQhC3eSR.js";
8
- import { g as markTurnCompleted, h as markTurnClosed } from "./oauth-authorization-CC8a1JKP.js";
9
- import { o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-8tXZhu0y.js";
4
+ import { Gt as listConversationAnnotations, Qt as getConversationEventStore, tn as getDb } from "./agent-hooks-Da_H0jHv.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-DaD7_Gsb.js";
7
+ import { r as clearPendingAuth, s as buildDeterministicTurnId } from "./pending-auth-WqF4Gh8Z.js";
8
+ import { g as markTurnCompleted, h as markTurnClosed } from "./oauth-authorization-BjRN99dc.js";
9
+ import { o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-D3E29wZk.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 { Zt as getConversationEventStore } from "./agent-hooks-BcH6E48y.js";
1
+ import { Qt as getConversationEventStore } from "./agent-hooks-Da_H0jHv.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-BcH6E48y.js").then((n) => n.Xt)).getConversationStore();
37
+ const conversationStore = args.conversationStore ?? (await import("./agent-hooks-Da_H0jHv.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-BSgsPVnr.js";
2
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-C7339Cfm.js";
3
3
  import { isDeepStrictEqual } from "node:util";
4
4
  //#region src/chat/plugins/validation.ts
5
5
  var validation_exports = /* @__PURE__ */ __exportAll({
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.234.0";
2
+ var version = "0.236.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-A7-RRBOE.js";
1
+ import { t as JUNIOR_VERSION } from "./version-CWkIGcLU.js";
2
2
  export { JUNIOR_VERSION };
@@ -1,9 +1,9 @@
1
- import { It as ensureConversationWake, Kt as requestConversationWork } from "./agent-runner-DUkGlK89.js";
2
- import { Zt as getConversationEventStore } from "./agent-hooks-BcH6E48y.js";
3
- import { n as loadTurnCheckpoint, o as failTurnRecord, s as getTurnRecord } from "./checkpoint-BNfXlq_1.js";
4
- import { w as getStateAdapter } from "./profile-BdApelHS.js";
5
- import { a as getVercelConversationWorkQueue } from "./job-queue-cwHVOwVZ.js";
6
- import { n as resolveTurnSessionRouting } from "./turn-session-routing--EhI76rH.js";
1
+ import { Ht as ensureConversationWake, Qt as requestConversationWork } from "./agent-runner-uP7QRc4c.js";
2
+ import { Qt as getConversationEventStore } from "./agent-hooks-Da_H0jHv.js";
3
+ import { n as loadTurnCheckpoint, o as failTurnRecord, s as getTurnRecord } from "./checkpoint-DaD7_Gsb.js";
4
+ import { w as getStateAdapter } from "./profile-BamYnmhO.js";
5
+ import { a as getVercelConversationWorkQueue } from "./job-queue-BqXd0ZPV.js";
6
+ import { n as resolveTurnSessionRouting } from "./turn-session-routing-DbpZZoin.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, 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, a as isExperimentalFeatureEnabled, bn as normalizeSlackStatusText, bt as getEventCatalog, c as createContextCompactor, et as eventAutomationBelongsToUser, it as parseEventAutomationRow, j as storeAttachment, kn as RetryableDeliveryError, nn as maybePostAutomatedTurnLimitNotice, nt as getEventAutomation, q as withScheduledAutomationLock, rn as recordFinishedTurnForAutomatedLimit, rt as listDeletedEventAutomationsCreatedBy, s as executeAgentRun, t as createAgentRunner, v as PluginCredentialFailureError, vn as formatSlackLink, vt as EVENT_WAIT_MS, wn as removeReactionFromMessage, wt as appendAndEnqueueExclusiveInboundMessage, xn as truncateStatusText, y as latestProgressStatus, yn as normalizeSlackReplyMarkdown, yt as isEventMailboxMetadata } from "./agent-runner-DUkGlK89.js";
2
- import { f as escapeXml, i as completeText, r as completeObject, v as isProviderRetryError } from "./client-BX5lJRqW.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-Cox1Mgcv.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-DuCzUoCo.js";
1
+ import { An as postSlackMessage, At as appendAndEnqueueExclusiveInboundMessage, Bn as shouldEmitDevAgentTrace, C as isExperimentalFeatureEnabled, Cn as escapeSlackMrkdwnText, D as renderBlockText, E as renderAttachmentText, En as normalizeSlackStatusText, Et as getEventCatalog, F as resolveSlackChannelIdFromThreadId, Fn as buildSteeringPiMessage, I as getConversationInfo, In as RetryableDeliveryError, J as withScheduledAutomationLock, K as saveScheduledAutomationInLock, L as listThreadReplies, M as parseSlackThreadId, N as readSlackRawMessageContext, On as truncateStatusText, Ot as pluginEventCatalog, P as resolveSlackChannelIdFromMessage, Pn as createUserTokenStore, Q as effectiveTaskOutcomes, Tn as normalizeSlackReplyMarkdown, Tt as isEventMailboxMetadata, U as parseScheduledAutomationRow, W as readScheduledAutomation, Wt as getConversationWorkState, Z as eventAutomationTriggerAvailable, at as listDeletedEventAutomationsCreatedBy, cn as maybePostAutomatedTurnLimitNotice, ft as sameDefinitionValue, h as latestProgressStatus, i as createContextCompactor, it as getEventAutomation, j as storeAttachment, jn as removeReactionFromMessage, jt as appendAndEnqueueInboundMessage, kn as addReactionToMessage, ln as recordFinishedTurnForAutomatedLimit, lt as automationDefinition, m as PluginCredentialFailureError, nt as eventAutomationBelongsToUser, ot as parseEventAutomationRow, r as executeAgentRun, t as createAgentRunner, tt as deleteEventAutomation, ut as listAutomationVersions, wn as formatSlackLink, wt as EVENT_WAIT_MS, zn as AuthorizationFlowDisabledError } from "./agent-runner-uP7QRc4c.js";
2
+ import { f as escapeXml, i as completeText, r as completeObject, v as isProviderRetryError } from "./client-Ch9Hg9NU.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-B4sKwmCG.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-JR9wke1W.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 { $t as getConversationStore, B as downloadPrivateSlackFile, Bt as recordSlackAttachment, G as isDmChannel, H as getHeaderString, It as buildSentryConversationUrl, K as normalizeSlackConversationId, Lt as getSlackFileId, U as getSlackClient, Zt as getConversationEventStore, _n as createSlackDestination, _t as getDashboardObjectIconLink, en as getDb, gt as getDashboardConversationLink, ht as JUNIOR_THREAD_STATE_TTL_MS, o as getPluginSlackConversationLink, ot as cancelSubscriptions, q as runWithSlackInstallationToken, tn as getSqlExecutor, yn as requireSlackDestination, z as SlackActionError, zt as readAttachmentVisionSummary } from "./agent-hooks-BcH6E48y.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-Da_H0jHv.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--jWf-Nnm.js";
10
- import { N as isVisionImageMediaType, j as readMessageAttachments, nt as instructionProvenanceFor } from "./conversation-CPjHYOV5.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-BNfXlq_1.js";
12
- import { E as acquireActiveLock, O as withLock, T as MUTATION_LOCK_TTL_MS, w as getStateAdapter } from "./profile-BdApelHS.js";
13
- import { a as isPendingAuthLatestRequest, o as buildDeterministicAssistantMessageId, r as clearPendingAuth, s as buildDeterministicTurnId } from "./pending-auth-DQhC3eSR.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-CC8a1JKP.js";
15
- import { a as EVENT_SYSTEM_ACTOR, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage } from "./prompt-3D0sSbTC.js";
16
- import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline } from "./job-queue-cwHVOwVZ.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-BZaqoUCT.js";
19
- import { i as resolveAgentInvocationId, o as AgentRunError, s as executeTurn, t as createAgentInvocationWorker } from "./work-CNc0ejGG.js";
20
- import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-WbpTUQ_r.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-8tXZhu0y.js";
22
- import { a as getPausedTurnRequest, c as getTurnAuthorization, i as createPausedTurns, n as deleteWebAuthorization, s as wakePausedTurn, t as createWebAuthorization } from "./web-authorization-BJggXofy.js";
23
- import { n as resolveTurnSessionRouting } from "./turn-session-routing--EhI76rH.js";
24
- import { t as bindSpawnAgent } from "./spawn-DhfMKt4y.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-DFJ9L9NQ.js";
26
- import { r as storeInputImages } from "./images-BaL19wFC.js";
9
+ import { O as juniorIdentities, c as juniorAutomationExecutions, k as juniorUsers, o as juniorSchedulerTasks, u as juniorEventAutomations } from "./executor-BW9XWgUQ.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-DaD7_Gsb.js";
12
+ import { E as acquireActiveLock, O as withLock, T as MUTATION_LOCK_TTL_MS, w as getStateAdapter } from "./profile-BamYnmhO.js";
13
+ import { a as isPendingAuthLatestRequest, o as buildDeterministicAssistantMessageId, r as clearPendingAuth, s as buildDeterministicTurnId } from "./pending-auth-WqF4Gh8Z.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-BjRN99dc.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-BqXd0ZPV.js";
17
+ import { l as automationListQuerySchema } from "./automation-B9Kc1gcf.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-C5XCIDSF.js";
20
+ import { i as resolveAgentInvocationId, o as AgentRunError, s as executeTurn, t as createAgentInvocationWorker } from "./work-DNaoFrEe.js";
21
+ import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-DOnU45p7.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-D3E29wZk.js";
23
+ import { a as getPausedTurnRequest, c as getTurnAuthorization, i as createPausedTurns, n as deleteWebAuthorization, s as wakePausedTurn, t as createWebAuthorization } from "./web-authorization-PPaoj2ns.js";
24
+ import { n as resolveTurnSessionRouting } from "./turn-session-routing-DbpZZoin.js";
25
+ import { t as bindSpawnAgent } from "./spawn-DFdRspSD.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-TDoj0aZz.js";
27
+ import { r as storeInputImages } from "./images-BdG7zcNf.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";
@@ -3376,6 +3377,7 @@ async function deleteViewerScheduledAutomation(db, user, id, nowMs = Date.now())
3376
3377
  //#endregion
3377
3378
  //#region src/chat/automations/read.ts
3378
3379
  const TASK_EXECUTION_LIST_LIMIT = 100;
3380
+ const AUTOMATION_VERSION_LIST_LIMIT = 100;
3379
3381
  function creatorLabel(creator) {
3380
3382
  return creator.fullName?.trim() || (creator.userName?.trim() ? `@${creator.userName.trim()}` : "") || creator.slackUserId;
3381
3383
  }
@@ -3505,6 +3507,7 @@ function eventAutomationSummary(task, ownedByViewer, destination, stats, creator
3505
3507
  function viewerTeamIds(user) {
3506
3508
  return [...new Set(user.identities.filter((identity) => identity.provider === "slack").map((identity) => identity.providerTenantId).filter((teamId) => Boolean(teamId)))];
3507
3509
  }
3510
+ /** Resolve an Automation the viewer owns or can read through a public Destination. */
3508
3511
  async function resolveViewerTaskCandidate(user, kind, id) {
3509
3512
  const db = getDb();
3510
3513
  const identityIds = new Set(user.identities.map((identity) => identity.id));
@@ -3749,6 +3752,19 @@ async function readViewerAutomationExecutions(user, kind, id) {
3749
3752
  truncated: executions.length > TASK_EXECUTION_LIST_LIMIT
3750
3753
  };
3751
3754
  }
3755
+ /** Read saved definitions for one viewer-visible Automation, newest first. */
3756
+ async function readViewerAutomationVersions(user, kind, id) {
3757
+ const candidate = await resolveViewerTaskCandidate(user, kind, id);
3758
+ if (!candidate) throw new ViewerTaskNotFoundError();
3759
+ const versions = await listAutomationVersions(getDb(), kind, id, 101);
3760
+ const current = automationDefinition(candidate.task);
3761
+ const listed = versions.slice(0, AUTOMATION_VERSION_LIST_LIMIT);
3762
+ return {
3763
+ versions: listed,
3764
+ activeVersion: listed.find(({ definition }) => sameDefinitionValue(definition, current))?.version ?? null,
3765
+ truncated: versions.length > AUTOMATION_VERSION_LIST_LIMIT
3766
+ };
3767
+ }
3752
3768
  /** Resolve the source task for one conversation when a terminal execution links it. */
3753
3769
  async function readConversationSourceTask(args) {
3754
3770
  const execution = await readAutomationExecutionByConversationId({ conversationId: args.conversationId });
@@ -4520,13 +4536,23 @@ function toSlackEventChannelType(channelType) {
4520
4536
  /**
4521
4537
  * Map Slack's Events API channel_type to a source-confirmed visibility.
4522
4538
  *
4523
- * Slack's event metadata is the only visibility authority; channel IDs never
4524
- * classify visibility.
4539
+ * Slack's event metadata and live conversation metadata are the only
4540
+ * visibility authorities; channel IDs never classify visibility.
4525
4541
  */
4526
4542
  function conversationVisibilityFromSlackChannelType(channelType) {
4527
4543
  if (!channelType) return void 0;
4528
4544
  return channelType === "channel" ? "public" : "private";
4529
4545
  }
4546
+ /**
4547
+ * Map live `conversations.info` metadata to Slack's Events API channel type,
4548
+ * for events that carry no `channel_type`.
4549
+ */
4550
+ function slackChannelTypeFromConversationInfo(info) {
4551
+ if (info.isIm) return "im";
4552
+ if (info.isMpim) return "mpim";
4553
+ if (info.isPrivate) return "group";
4554
+ return info.isChannel ? "channel" : void 0;
4555
+ }
4530
4556
  /** Resolve Slack's raw event channel type from a Chat SDK message-like object. */
4531
4557
  function resolveSlackChannelTypeFromMessage(message) {
4532
4558
  const raw = message.raw;
@@ -4686,6 +4712,26 @@ async function resolveChannelName(thread) {
4686
4712
  return;
4687
4713
  }
4688
4714
  }
4715
+ /**
4716
+ * Return the Slack channel type of a message.
4717
+ *
4718
+ * Slack delivers a channel mention as two events with the same `ts`: `message`
4719
+ * has `channel_type`, and `app_mention` does not. Junior stores the event that
4720
+ * arrives first. When that event has no `channel_type`, ask Slack for the
4721
+ * conversation, so the turn does not depend on the order of the two events.
4722
+ */
4723
+ async function resolveSlackChannelType(message, channelId) {
4724
+ const eventChannelType = resolveSlackChannelTypeFromMessage(message);
4725
+ if (eventChannelType) return eventChannelType;
4726
+ const slackChannelId = parseSlackChannelId(channelId);
4727
+ if (!slackChannelId) return;
4728
+ try {
4729
+ return slackChannelTypeFromConversationInfo(await getConversationInfo(slackChannelId));
4730
+ } catch (error) {
4731
+ if (error instanceof SlackActionError) return;
4732
+ throw error;
4733
+ }
4734
+ }
4689
4735
  /** Collect attachments from the current Slack message and its batch. */
4690
4736
  function collectAttachments(message, batchedMessages) {
4691
4737
  return [...(batchedMessages ?? []).flatMap((queued) => queued.message.attachments), ...message.attachments];
@@ -4761,7 +4807,7 @@ function createSlackTurn(deps) {
4761
4807
  const channelId = getChannelId(thread, message);
4762
4808
  const channelName = !options.execution && channelId ? await resolveChannelName(thread) : void 0;
4763
4809
  const destination = requireSlackDestination(options.destination, "Slack reply execution");
4764
- const slackChannelType = resolveSlackChannelTypeFromMessage(message);
4810
+ const slackChannelType = options.execution ? resolveSlackChannelTypeFromMessage(message) : await resolveSlackChannelType(message, channelId);
4765
4811
  const slackConversation = resolveSlackConversationContext({
4766
4812
  channelId,
4767
4813
  channelName,
@@ -5253,7 +5299,7 @@ function createSlackTurn(deps) {
5253
5299
  if (newSteeringMessages.length > 0) piMessages = [...piMessages ?? [], ...newSteeringMessages];
5254
5300
  }
5255
5301
  status.update();
5256
- resolveConversationTitle({ conversationId }).then(async (title) => {
5302
+ const titleProjection = resolveConversationTitle({ conversationId }).then(async (title) => {
5257
5303
  if (!title) return;
5258
5304
  await maybeSyncAssistantTitle({
5259
5305
  channelId: assistantThreadContext?.channelId,
@@ -5264,6 +5310,7 @@ function createSlackTurn(deps) {
5264
5310
  }).catch((error) => {
5265
5311
  logException(error, "conversation.title.task.failed");
5266
5312
  });
5313
+ deps.waitUntil?.(titleProjection);
5267
5314
  const toolChannelId = channelId;
5268
5315
  const activeInstructionAuthorId = actor?.userId ?? parseActorUserId(message.author.userId);
5269
5316
  const activeInstructionAuthorName = actor?.fullName ?? actor?.userName;
@@ -5942,7 +5989,8 @@ function createSlackRuntime(options) {
5942
5989
  pausedTurns: options.pausedTurns ?? createPausedTurns(),
5943
5990
  prepareTurnState,
5944
5991
  resolveUserAttachments: services.visionContext.resolveUserAttachments,
5945
- sendPluginTask: options.sendPluginTask
5992
+ sendPluginTask: options.sendPluginTask,
5993
+ waitUntil: options.waitUntil
5946
5994
  });
5947
5995
  return {
5948
5996
  ...createSlackTurnRuntime({
@@ -7593,7 +7641,8 @@ function createConversationWork(options) {
7593
7641
  services: {
7594
7642
  ...options.services,
7595
7643
  agentRunner: options.agentRunner
7596
- }
7644
+ },
7645
+ waitUntil: options.waitUntil
7597
7646
  });
7598
7647
  const runtime = options.wrapRuntime?.(baseRuntime) ?? baseRuntime;
7599
7648
  const scheduleCompletedPluginTasks = options.sendPluginTask ? async (params) => await scheduleSessionCompletedPluginTasks(params, { send: options.sendPluginTask }) : void 0;
@@ -7644,7 +7693,8 @@ function createConversationWork(options) {
7644
7693
  queue: options.queue,
7645
7694
  run,
7646
7695
  runtime,
7647
- state: options.state
7696
+ state: options.state,
7697
+ waitUntil: options.waitUntil
7648
7698
  };
7649
7699
  }
7650
7700
  //#endregion
@@ -7684,7 +7734,7 @@ function createProductionSlackWebhookServices(options) {
7684
7734
  getSlackAdapter: getProductionSlackAdapter,
7685
7735
  getUserTokenStore: createUserTokenStore,
7686
7736
  conversationStore,
7687
- queue: getVercelConversationWorkQueue(),
7737
+ queue: options.queue,
7688
7738
  runtime
7689
7739
  };
7690
7740
  }
@@ -7695,8 +7745,10 @@ function createProductionConversationWorkOptions(options) {
7695
7745
  agentRunner: options.agentRunner,
7696
7746
  conversationStore,
7697
7747
  getSlackAdapter: getProductionSlackAdapter,
7698
- queue: getVercelConversationWorkQueue(),
7699
- services: options.services
7748
+ queue: options.queue,
7749
+ sendPluginTask: options.sendPluginTask,
7750
+ services: options.services,
7751
+ waitUntil: options.waitUntil
7700
7752
  });
7701
7753
  }
7702
7754
  //#endregion
@@ -7862,4 +7914,4 @@ async function appendAndEnqueueWebMessage(input, options) {
7862
7914
  };
7863
7915
  }
7864
7916
  //#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 };
7917
+ export { withNormalizedThreadId as A, enqueueAgentDispatch as B, clearSlackPendingReactions as C, isSlackMessageStopped as D, verifySlackSignature as E, parseContent as F, readHealthReport as H, getThreadStopDecision as I, renderSlackObjectCard as L, legacyWebMailboxMetadataSchema as M, THREAD_OPTOUT_ACK as N, stopSlackThread as O, startProcessingReaction as P, createVercelAttachmentStorage as R, buildSlackInboundMessage as S, runWithSlackInstallation as T, GET 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, getAuthPausedConversationTurnId as j, normalizeIncomingSlackThreadId 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, lookupSlackUser as w, recordSkippedConversationMessage as x, readViewerAutomations as y, AGENT_DISPATCH_MAX_AGE_MS as z };