@sentry/junior 0.240.0 → 0.241.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 (56) hide show
  1. package/dist/{admin-D6fRPRgC.js → admin-CJkjl-aN.js} +1 -1
  2. package/dist/{agent-hooks-JFbgedMZ.js → agent-hooks-C5zYOaJk.js} +1952 -1952
  3. package/dist/{agent-runner-0IjJxsL1.js → agent-runner-CMZ6lFQe.js} +336 -1125
  4. package/dist/api/schema.d.ts +9 -0
  5. package/dist/api/schema.js +2 -2
  6. package/dist/api.js +21 -21
  7. package/dist/app.js +104 -31
  8. package/dist/{automation-B5_c8hEb.js → automation-gznOMaQ2.js} +11 -2
  9. package/dist/{briefs-BGWTp-nz.js → briefs-CsQbFjRi.js} +2 -2
  10. package/dist/{catalog-runtime-DdigNl7s.js → catalog-runtime-Tz0O2MZe.js} +1 -1
  11. package/dist/cli/chat.js +12 -12
  12. package/dist/cli/check.js +3 -3
  13. package/dist/cli/main.js +2 -2
  14. package/dist/cli/plugins.js +4 -4
  15. package/dist/cli/snapshot-create.js +3 -3
  16. package/dist/cli/upgrade.js +3 -3
  17. package/dist/{client-Cn73E7br.js → client-CRZ-i1tH.js} +2 -2
  18. package/dist/{config-B0S86yw9.js → config-CCI82OTD.js} +2 -2
  19. package/dist/{conversation-privacy-BKlX7D_R.js → conversation-privacy-D5Byl5eC.js} +1 -1
  20. package/dist/{credential-sync-DeNQm7st.js → credential-sync-DUpSxUum.js} +14 -14
  21. package/dist/{executor-BQ-A5nov.js → executor-CewKi7EG.js} +4 -2
  22. package/dist/{images-C7OKd6uy.js → images-DY6Pxq4w.js} +2 -2
  23. package/dist/instrumentation.js +2 -2
  24. package/dist/{job-queue-DgXLqoeB.js → job-queue-C6o2aJQ6.js} +1 -1
  25. package/dist/{logging-BSNF167N.js → logging-LQnLlPf8.js} +1 -1
  26. package/dist/nitro.js +3 -3
  27. package/dist/{oauth-authorization-BM7g61od.js → oauth-authorization-Clzkm-Ts.js} +1 -1
  28. package/dist/{oauth-callback-server-Dw-BwI6x.js → oauth-callback-server-DcYAJSEz.js} +2 -2
  29. package/dist/{pending-auth-Chn_EA1_.js → pending-auth-CT3ojhKe.js} +2 -2
  30. package/dist/{profile-3t9H_IwL.js → profile-mWuVZ8ht.js} +4 -4
  31. package/dist/{registry-DLZlAhdP.js → registry-DPDH6s5G.js} +1 -1
  32. package/dist/{resolve-9_cIPQsq.js → resolve-BAN8BSGy.js} +2 -2
  33. package/dist/{runner-C_eUbFyp.js → runner-CqXZJfzk.js} +9 -9
  34. package/dist/{sandbox-egress-signals-C1ycxTNA.js → sandbox-egress-signals-DFUUokws.js} +1 -1
  35. package/dist/{schema-C4XwHTY4.js → schema-Cabm4jcj.js} +1 -1
  36. package/dist/{skills-Dqgjr_Tl.js → skills-BtHhSATy.js} +2 -2
  37. package/dist/{spawn-BfEr3t7b.js → spawn-BszkFJKJ.js} +2 -2
  38. package/dist/{task-queue-CuFZDOXn.js → task-queue-1LP6benz.js} +3 -3
  39. package/dist/{task-runner-c7gwV8dj.js → task-runner-kLN3HC-_.js} +54 -12
  40. package/dist/{checkpoint-C1ZnSz7r.js → tasks-CO52vLkI.js} +1056 -14
  41. package/dist/{thread-state-exTu-G1w.js → thread-state-CaFRG5Mh.js} +6 -6
  42. package/dist/{turn-failure-response-DFp99ziF.js → turn-failure-response-Dmovuiq1.js} +9 -8
  43. package/dist/{turn-lifecycle-C4TjuOzG.js → turn-lifecycle-DGqZgU6J.js} +1 -1
  44. package/dist/{turn-session-routing-Vpg8jUD1.js → turn-session-routing-B_v8Wbn4.js} +1 -1
  45. package/dist/{validation-D2lULEG9.js → validation-B4L2Rmiw.js} +1 -1
  46. package/dist/{version-BjBMCc2o.js → version-DiR36OaN.js} +1 -1
  47. package/dist/version.js +1 -1
  48. package/dist/{viewer-XE3nFqKM.js → viewer-D6stAU7h.js} +3 -3
  49. package/dist/{web-authorization-8E8IrWOj.js → web-authorization-DLMBx2nL.js} +6 -6
  50. package/dist/{web-input-DF4GGJrf.js → web-input---xuox1t.js} +135 -129
  51. package/dist/{work-Dt_JjfbX.js → work-G-HdoOSF.js} +7 -7
  52. package/dist/{worker-BrbnLmD3.js → worker-CDUDfL9P.js} +5 -5
  53. package/migrations/0049_event_automation_status_reason.sql +1 -0
  54. package/migrations/meta/0049_snapshot.json +3581 -0
  55. package/migrations/meta/_journal.json +8 -1
  56. package/package.json +4 -4
@@ -1,19 +1,19 @@
1
- import { Dn as postSlackMessage, _ as resolvePluginOAuthAccount, _n as parseOAuthStatePayload, _t as getMcpProviderErrorAttributes, d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, gn as formatProviderLabel, jn as createUserTokenStore, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, vn as resolveBaseUrl, x as lookupSlackUserProfile } from "./agent-runner-0IjJxsL1.js";
2
- import { f as escapeXml } from "./client-Cn73E7br.js";
3
- import { d as logException, h as runBestEffort, p as logWarn } from "./logging-BSNF167N.js";
4
- import { a as getRuntimeMetadata, n as botConfig } from "./config-B0S86yw9.js";
1
+ import { Jt as resolveBaseUrl, Kt as formatProviderLabel, Xt as createUserTokenStore, _ as resolvePluginOAuthAccount, d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, q as getMcpProviderErrorAttributes, qt as parseOAuthStatePayload, s as deleteMcpAuthSession, x as lookupSlackUserProfile } from "./agent-runner-CMZ6lFQe.js";
2
+ import { f as escapeXml } from "./client-CRZ-i1tH.js";
3
+ import { d as logException, h as runBestEffort, p as logWarn } from "./logging-LQnLlPf8.js";
4
+ import { a as getRuntimeMetadata, n as botConfig } from "./config-CCI82OTD.js";
5
5
  import { f as parseSlackUserId } from "./actor-BTtLaeWy.js";
6
- import { A as upsertIdentity, f as getSqlExecutor, j as upsertLinkedIdentity } from "./viewer-XE3nFqKM.js";
6
+ import { A as upsertIdentity, f as getSqlExecutor, j as upsertLinkedIdentity } from "./viewer-D6stAU7h.js";
7
7
  import { i as homeDir } from "./package-discovery-BVvSnQBB.js";
8
- import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-DLZlAhdP.js";
9
- import { n as pluginCatalogRuntime } from "./catalog-runtime-DdigNl7s.js";
10
- import { t as discoverSkills } from "./skills-Dqgjr_Tl.js";
11
- import { B as recordAuthenticationLinked, V as recordAuthorizationCompleted, s as getTurnRecord } from "./checkpoint-C1ZnSz7r.js";
12
- import { at as getSlackClient } from "./agent-hooks-JFbgedMZ.js";
13
- import { E as acquireActiveLock, w as getStateAdapter } from "./profile-3t9H_IwL.js";
14
- import { i as getConversationPendingAuth } from "./pending-auth-Chn_EA1_.js";
15
- import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-exTu-G1w.js";
16
- import { n as deleteWebAuthorization, o as wakeAuthorizedTurn, s as wakePausedTurn } from "./web-authorization-8E8IrWOj.js";
8
+ import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-DPDH6s5G.js";
9
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-Tz0O2MZe.js";
10
+ import { t as discoverSkills } from "./skills-BtHhSATy.js";
11
+ import { At as recordAuthenticationLinked, X as getTurnRecord, jt as recordAuthorizationCompleted, z as postSlackMessage } from "./tasks-CO52vLkI.js";
12
+ import { zt as getSlackClient } from "./agent-hooks-C5zYOaJk.js";
13
+ import { E as acquireActiveLock, w as getStateAdapter } from "./profile-mWuVZ8ht.js";
14
+ import { i as getConversationPendingAuth } from "./pending-auth-CT3ojhKe.js";
15
+ import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-CaFRG5Mh.js";
16
+ import { n as deleteWebAuthorization, o as wakeAuthorizedTurn, s as wakePausedTurn } from "./web-authorization-DLMBx2nL.js";
17
17
  import { n as relayLocalOAuthCallback } from "./oauth-relay-CdCnu80W.js";
18
18
  import path from "node:path";
19
19
  import { z } from "zod";
@@ -1,6 +1,6 @@
1
- import { d as logException } from "./logging-BSNF167N.js";
1
+ import { d as logException } from "./logging-LQnLlPf8.js";
2
2
  import { g as startSpanManual } from "./sentry-CgWZM_kV.js";
3
- import "./config-B0S86yw9.js";
3
+ import "./config-CCI82OTD.js";
4
4
  import { n as juniorDestinations, r as timestamptz } from "./destinations-BeBiJeEM.js";
5
5
  import { AsyncLocalStorage } from "node:async_hooks";
6
6
  import { getTableColumns, sql } from "drizzle-orm";
@@ -406,6 +406,8 @@ const juniorEventAutomations = pgTable("junior_event_tasks", {
406
406
  createdAtMs: bigint("created_at_ms", { mode: "number" }).notNull(),
407
407
  /** Retained row status. Deleted tasks keep history but stop matching. */
408
408
  status: text("status").$type().notNull().default("active"),
409
+ /** Why a run blocked this automation. Kept while paused; cleared on resume. */
410
+ statusReason: text("status_reason"),
409
411
  /** Short display title generated from the task instruction. */
410
412
  title: text("title"),
411
413
  task: jsonb("task_json").$type().notNull()
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { D as storeAttachment, T as readLiveAttachment } from "./agent-runner-0IjJxsL1.js";
3
- import { f as getSqlExecutor } from "./viewer-XE3nFqKM.js";
2
+ import { D as storeAttachment, T as readLiveAttachment } from "./agent-runner-CMZ6lFQe.js";
3
+ import { f as getSqlExecutor } from "./viewer-D6stAU7h.js";
4
4
  import "./conversation-DwD-vquD.js";
5
5
  //#region src/chat/attachments/images.ts
6
6
  var images_exports = /* @__PURE__ */ __exportAll({
@@ -1,6 +1,6 @@
1
- import { N as getDeploymentServiceVersion, P as getDeploymentTelemetryAttributes } from "./logging-BSNF167N.js";
1
+ import { N as getDeploymentServiceVersion, P as getDeploymentTelemetryAttributes } from "./logging-LQnLlPf8.js";
2
2
  import { _ as vercelAIIntegration, a as getClient, b as withStreamedSpan, c as init, o as getGlobalScope } from "./sentry-CgWZM_kV.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-BKlX7D_R.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-D5Byl5eC.js";
4
4
  import { t as consumePrivateTraceResultMarker } from "./private-trace-result-BLvBjy_e.js";
5
5
  //#region src/chat/sentry-payload-filter.ts
6
6
  const PAYLOAD_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
@@ -1,4 +1,4 @@
1
- import { i as getChatConfig } from "./config-B0S86yw9.js";
1
+ import { i as getChatConfig } from "./config-CCI82OTD.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  import { z } from "zod";
4
4
  import { createHash, createHmac, timingSafeEqual } from "node:crypto";
@@ -1,5 +1,5 @@
1
1
  import { d as setTag, f as setUser, h as startSpan, i as getActiveSpan, l as logger, n as captureMessage, p as spanToJSON, s as getTraceData, t as captureException, y as withScope } from "./sentry-CgWZM_kV.js";
2
- import { t as JUNIOR_VERSION } from "./version-BjBMCc2o.js";
2
+ import { t as JUNIOR_VERSION } from "./version-DiR36OaN.js";
3
3
  import path from "node:path";
4
4
  import { styleText } from "node:util";
5
5
  import { ConfigError, configureSync, getConfig, getLogger } from "@logtape/logtape";
package/dist/nitro.js CHANGED
@@ -1,8 +1,8 @@
1
- import { A as JUNIOR_RETENTION_ROUTE, D as JUNIOR_HEARTBEAT_ROUTE, E as JUNIOR_HEARTBEAT_CRON_SCHEDULE, O as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, T as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, j as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, k as JUNIOR_RETENTION_CRON_SCHEDULE } from "./logging-BSNF167N.js";
1
+ import { A as JUNIOR_RETENTION_ROUTE, D as JUNIOR_HEARTBEAT_ROUTE, E as JUNIOR_HEARTBEAT_CRON_SCHEDULE, O as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, T as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, j as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, k as JUNIOR_RETENTION_CRON_SCHEDULE } from "./logging-LQnLlPf8.js";
2
2
  import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-BVvSnQBB.js";
3
- import { o as resolveConversationWorkQueueTopic, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-DgXLqoeB.js";
3
+ import { o as resolveConversationWorkQueueTopic, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-C6o2aJQ6.js";
4
4
  import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-egKWjgue.js";
5
- import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-CuFZDOXn.js";
5
+ import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-1LP6benz.js";
6
6
  import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-CVvEUSMH.js";
7
7
  import path from "node:path";
8
8
  import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
@@ -1,4 +1,4 @@
1
- import { h as extractAssistantText } from "./checkpoint-C1ZnSz7r.js";
1
+ import { it as extractAssistantText } from "./tasks-CO52vLkI.js";
2
2
  //#region src/chat/runtime/turn.ts
3
3
  /** Classified Slack turn failure carrying the owning Sentry capture outward. */
4
4
  var ConversationTurnBoundaryError = class extends Error {
@@ -1,5 +1,5 @@
1
- import { jn as createUserTokenStore } from "./agent-runner-0IjJxsL1.js";
2
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-DeNQm7st.js";
1
+ import { Xt as createUserTokenStore } from "./agent-runner-CMZ6lFQe.js";
2
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-DUpSxUum.js";
3
3
  import { createServer } from "node:http";
4
4
  //#region src/chat/local/oauth-callback-server.ts
5
5
  const LOCAL_OAUTH_TIMEOUT_MS = 6e5;
@@ -1,5 +1,5 @@
1
- import { v as isProviderRetryError } from "./client-Cn73E7br.js";
2
- import { i as abandonTurnRecord, mt as estimateTextTokens } from "./checkpoint-C1ZnSz7r.js";
1
+ import { v as isProviderRetryError } from "./client-CRZ-i1tH.js";
2
+ import { in as estimateTextTokens, q as abandonTurnRecord } from "./tasks-CO52vLkI.js";
3
3
  import { r as isExperimentalFeatureEnabled } from "./experimental-Qn9rKLgx.js";
4
4
  import { z } from "zod";
5
5
  //#region src/chat/state/turn-id.ts
@@ -1,7 +1,7 @@
1
- import { S as toOptionalTrimmed } from "./client-Cn73E7br.js";
2
- import { v as setSpanAttributes, y as setSpanStatus } from "./logging-BSNF167N.js";
3
- import { i as getChatConfig } from "./config-B0S86yw9.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-DdigNl7s.js";
1
+ import { S as toOptionalTrimmed } from "./client-CRZ-i1tH.js";
2
+ import { v as setSpanAttributes, y as setSpanStatus } from "./logging-LQnLlPf8.js";
3
+ import { i as getChatConfig } from "./config-CCI82OTD.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-Tz0O2MZe.js";
5
5
  import { createHash } from "node:crypto";
6
6
  import { createMemoryState } from "@chat-adapter/state-memory";
7
7
  import { createRedisState } from "@chat-adapter/state-redis";
@@ -1,4 +1,4 @@
1
- import { f as logInfo, p as logWarn, v as setSpanAttributes } from "./logging-BSNF167N.js";
1
+ import { f as logInfo, p as logWarn, v as setSpanAttributes } from "./logging-LQnLlPf8.js";
2
2
  import { o as parseActorUserId } from "./actor-BTtLaeWy.js";
3
3
  import { n as normalizePluginPackageNames, o as pluginRoots, t as discoverInstalledPluginPackageContent } from "./package-discovery-BVvSnQBB.js";
4
4
  import path from "node:path";
@@ -1,5 +1,5 @@
1
- import { v as setSpanAttributes, w as withSpan } from "./logging-BSNF167N.js";
2
- import { N as SANDBOX_WORKSPACE_ROOT, k as sleep, r as isStale, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-3t9H_IwL.js";
1
+ import { v as setSpanAttributes, w as withSpan } from "./logging-LQnLlPf8.js";
2
+ import { N as SANDBOX_WORKSPACE_ROOT, k as sleep, r as isStale, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-mWuVZ8ht.js";
3
3
  import { z } from "zod";
4
4
  import { FileSystem, Sandbox } from "@vercel/sandbox";
5
5
  //#region src/chat/sandbox/resources.ts
@@ -1,13 +1,13 @@
1
- import { C as withLogContext, b as setTags, d as logException } from "./logging-BSNF167N.js";
2
- import { c as getConversationEventStore, u as getConversationStore } from "./viewer-XE3nFqKM.js";
3
- import { d as credentialContextForActor } from "./registry-DLZlAhdP.js";
4
- 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-C1ZnSz7r.js";
1
+ import { C as withLogContext, b as setTags, d as logException } from "./logging-LQnLlPf8.js";
2
+ import { c as getConversationEventStore, u as getConversationStore } from "./viewer-D6stAU7h.js";
3
+ import { d as credentialContextForActor } from "./registry-DPDH6s5G.js";
4
+ import { $ as persistWithRetry, $t as markConversationMessage, Bt as persistConversationMessages, Jt as buildConversationContext, K as saveTurnCheckpoint, bt as commitAcceptedReply, en as normalizeConversationText, jt as recordAuthorizationCompleted, rn as upsertConversationMessage, tn as recordDeliveredAssistantMessage, wt as loadProjection, zt as hydrateConversationMessages } from "./tasks-CO52vLkI.js";
5
5
  import { U as messageCardText } from "./conversation-DwD-vquD.js";
6
- import { _ as markTurnFailed, r as getAssistantReplyText, t as authorizationId, v as startActiveTurn } from "./oauth-authorization-BM7g61od.js";
7
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-c7gwV8dj.js";
8
- import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-C4TjuOzG.js";
9
- import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-exTu-G1w.js";
10
- import { d as loadPendingMessageCards, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, t as finalizeFailedTurnReplyWithEvent } from "./turn-failure-response-DFp99ziF.js";
6
+ import { _ as markTurnFailed, r as getAssistantReplyText, t as authorizationId, v as startActiveTurn } from "./oauth-authorization-Clzkm-Ts.js";
7
+ import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-kLN3HC-_.js";
8
+ import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-DGqZgU6J.js";
9
+ import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-CaFRG5Mh.js";
10
+ import { d as loadPendingMessageCards, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, t as finalizeFailedTurnReplyWithEvent } from "./turn-failure-response-Dmovuiq1.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 { hn as sandboxEgressSignalsResponseSchema } from "./agent-runner-0IjJxsL1.js";
1
+ import { Gt as sandboxEgressSignalsResponseSchema } from "./agent-runner-CMZ6lFQe.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,6 @@
1
1
  import { t as juniorDestinationKindSchema } from "./destinations-BeBiJeEM.js";
2
2
  import { E as conversationSummaryReportSchema, n as actorIdentitySchema, w as conversationStatsItemSchema } from "./conversation-DwD-vquD.js";
3
- import "./automation-B5_c8hEb.js";
3
+ import "./automation-gznOMaQ2.js";
4
4
  import { a as fillUtcHours, c as sumUtcHoursIntoSixHours, i as fillUtcDays } from "./web-message-id-xPI_EFSC.js";
5
5
  import { z } from "zod";
6
6
  import { codeChangeStateSchema } from "@sentry/junior-plugin-api";
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { p as logWarn } from "./logging-BSNF167N.js";
2
+ import { p as logWarn } from "./logging-LQnLlPf8.js";
3
3
  import { s as skillRoots } from "./package-discovery-BVvSnQBB.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-DdigNl7s.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-Tz0O2MZe.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 { Fn as toolInvocationDestination, Pn as actorFromRun } from "./agent-runner-0IjJxsL1.js";
3
- import { n as createAndEnqueueAgentInvocation } from "./work-Dt_JjfbX.js";
2
+ import { $t as actorFromRun, en as toolInvocationDestination } from "./agent-runner-CMZ6lFQe.js";
3
+ import { n as createAndEnqueueAgentInvocation } from "./work-G-HdoOSF.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-BSNF167N.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-DgXLqoeB.js";
1
+ import { p as logWarn } from "./logging-LQnLlPf8.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-C6o2aJQ6.js";
3
3
  import { z } from "zod";
4
4
  import { createHash } from "node:crypto";
5
5
  import { handleCallback, registerDevConsumer } from "@vercel/queue";
@@ -115,7 +115,7 @@ function pluginTaskCallback() {
115
115
  maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
116
116
  onRejected: logPluginTaskQueueMessageRejected,
117
117
  run: async (message) => {
118
- const { processPluginTask } = await import("./task-runner-c7gwV8dj.js").then((n) => n.r);
118
+ const { processPluginTask } = await import("./task-runner-kLN3HC-_.js").then((n) => n.r);
119
119
  await processPluginTask(message);
120
120
  },
121
121
  topic: PLUGIN_TASK_QUEUE_TOPIC,
@@ -1,16 +1,16 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { p as logWarn } from "./logging-BSNF167N.js";
2
+ import { h as runBestEffort, p as logWarn } from "./logging-LQnLlPf8.js";
3
3
  import { g as parseSlackMessageTs } from "./actor-BTtLaeWy.js";
4
- import { C as agentTurnTotalTokens, S as agentTurnCostUsd, d as getDb, r as readActorIdentity, u as getConversationStore } from "./viewer-XE3nFqKM.js";
5
- import { D as juniorConversations, c as juniorAutomationExecutions } from "./executor-BQ-A5nov.js";
4
+ import { C as agentTurnTotalTokens, S as agentTurnCostUsd, d as getDb, r as readActorIdentity, u as getConversationStore } from "./viewer-D6stAU7h.js";
5
+ import { D as juniorConversations, c as juniorAutomationExecutions } from "./executor-CewKi7EG.js";
6
6
  import { p as sameActorIdentity } from "./history-BLTUgFYO.js";
7
- import { p as credentialSubjectSchema } from "./registry-DLZlAhdP.js";
8
- 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-C1ZnSz7r.js";
9
- import { bt as createPluginModel, jt as createPluginConversationEvents, p as coreTaskRegistrations, pt as JUNIOR_THREAD_STATE_TTL_MS, u as getPlugins, vt as createPluginState, xt as createPluginLogger, yt as createPluginEmbedder } from "./agent-hooks-JFbgedMZ.js";
10
- import { w as getStateAdapter } from "./profile-3t9H_IwL.js";
11
- import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-exTu-G1w.js";
12
- import { t as resolveConversationRouting } from "./turn-session-routing-Vpg8jUD1.js";
13
- import { i as pluginTaskParamsSchema, o as sendVercelPluginTask, r as pluginTaskId } from "./task-queue-CuFZDOXn.js";
7
+ import { p as credentialSubjectSchema } from "./registry-DPDH6s5G.js";
8
+ import { A as formatSlackLink, Gt as fallbackShortTitle, L as openSlackDirectMessage, X as getTurnRecord, a as readScheduledAutomation, at as getPiMessageRole, ft as isToolResultError, g as getEventAutomation, gt as stripRuntimeTurnContext, k as escapeSlackMrkdwnText, lt as instructionTextForProjection, mt as normalizeToolNameFromResult, pt as isToolResultMessage, u as blockEventAutomation, z as postSlackMessage, zt as hydrateConversationMessages } from "./tasks-CO52vLkI.js";
9
+ import { ct as createPluginModel, it as getDashboardTaskLink, lt as createPluginLogger, ot as createPluginState, p as coreTaskRegistrations, st as createPluginEmbedder, tt as JUNIOR_THREAD_STATE_TTL_MS, u as getPlugins, yt as createPluginConversationEvents } from "./agent-hooks-C5zYOaJk.js";
10
+ import { w as getStateAdapter } from "./profile-mWuVZ8ht.js";
11
+ import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-CaFRG5Mh.js";
12
+ import { t as resolveConversationRouting } from "./turn-session-routing-B_v8Wbn4.js";
13
+ import { i as pluginTaskParamsSchema, o as sendVercelPluginTask, r as pluginTaskId } from "./task-queue-1LP6benz.js";
14
14
  import { z } from "zod";
15
15
  import { createHash } from "node:crypto";
16
16
  import { and, asc, count, desc, eq, gte, inArray, lte, max, or, sql } from "drizzle-orm";
@@ -386,6 +386,36 @@ async function readAutomationExecutionStatusHours(args) {
386
386
  return [...byHour.values()];
387
387
  }
388
388
  //#endregion
389
+ //#region src/chat/automations/blocked-notice.ts
390
+ function buildBlockedNoticeText(automationId, title, reason) {
391
+ const url = getDashboardTaskLink(automationId);
392
+ return [
393
+ `Your automation *${escapeSlackMrkdwnText(title)}* is blocked. It won't run again until you resume it.`,
394
+ `> ${escapeSlackMrkdwnText(reason.replace(/\s+/g, " ").trim())}`,
395
+ url ? `Fix the problem, then ${formatSlackLink(url, "resume it")}.` : "Fix the problem, then ask me to resume it."
396
+ ].join("\n");
397
+ }
398
+ /**
399
+ * Tell an Automation's creator in a direct message that a run blocked it,
400
+ * and why. Call this once, after the Automation itself is stored as blocked,
401
+ * so the dashboard matches the notice. The notice is best-effort: the reason
402
+ * also shows on the dashboard and in the Automation tools.
403
+ */
404
+ async function notifyAutomationBlocked(ref) {
405
+ await runBestEffort(async () => {
406
+ const task = ref.kind === "scheduled" ? await readScheduledAutomation(getDb(), ref.automationId) : await getEventAutomation(getDb(), ref.automationId);
407
+ if (!task) return;
408
+ const title = task.title ?? fallbackShortTitle(task.task.text, ref.kind === "scheduled" ? "Scheduled automation" : "Event automation");
409
+ await postSlackMessage({
410
+ channelId: await openSlackDirectMessage(task.createdBy.slackUserId),
411
+ text: buildBlockedNoticeText(ref.automationId, title, ref.reason)
412
+ });
413
+ }, "automation.blocked_notice.failed", {
414
+ "app.task.type": ref.kind,
415
+ ...ref.dispatchId ? { "app.dispatch.id": ref.dispatchId } : void 0
416
+ });
417
+ }
418
+ //#endregion
389
419
  //#region src/chat/agent-dispatch/store.ts
390
420
  const DISPATCH_PREFIX = "junior:agent_dispatch";
391
421
  const DISPATCH_LOCK_TTL_MS = 6e5;
@@ -630,9 +660,21 @@ async function recordEventAutomationExecution(previous, next, status) {
630
660
  status
631
661
  });
632
662
  }
633
- /** Project a blocked turn to the plugin API. */
663
+ /**
664
+ * Project a blocked turn to the plugin API. An Event automation is blocked
665
+ * first, so a retry after a failed write still blocks it. Its creator is told
666
+ * when the block is first stored. The heartbeat blocks a Scheduled automation
667
+ * and tells its creator.
668
+ */
634
669
  async function markDispatchBlocked(id, errorMessage, resultMessageTs) {
635
670
  const previous = await getDispatchRecord(id);
671
+ const eventAutomationId = previous?.metadata?.eventAutomationId;
672
+ if (previous?.plugin === "junior" && eventAutomationId && !isTerminalDispatchStatus(previous.status) && await blockEventAutomation(getDb(), eventAutomationId, errorMessage)) await notifyAutomationBlocked({
673
+ automationId: eventAutomationId,
674
+ dispatchId: id,
675
+ kind: "event",
676
+ reason: errorMessage
677
+ });
636
678
  const next = await transitionDispatch(id, (record) => isTerminalDispatchStatus(record.status) ? record : {
637
679
  ...record,
638
680
  errorMessage,
@@ -943,4 +985,4 @@ async function processPluginTask(message, options = {}) {
943
985
  });
944
986
  }
945
987
  //#endregion
946
- export { conversationAggregateColumns as A, readAutomationExecutionStatusDays as C, readAutomationRuns as D, readAutomationExecutions as E, recordAutomationExecution as O, readAutomationExecutionHours as S, readAutomationExecutionSummaries as T, markDispatchFailed as _, confirmDispatchMailboxAppend as a, readAutomationExecutionByConversationId as b, getDispatchInputMessageId as c, getPluginDispatchProjection as d, isTerminalDispatchStatus as f, markDispatchCompleted as g, markDispatchBlocked as h, claimDispatchMailboxAppend as i, conversationRangeColumns as j, conversationActiveDaysColumn as k, getDispatchRecord as l, markDispatchAwaitingResume as m, scheduleSessionCompletedPluginTasks as n, createOrGetDispatch as o, listPendingDispatchMailboxAppends as p, task_runner_exports as r, getDispatchConversationId as s, processPluginTask as t, getDispatchTurnId as u, markDispatchRunning as v, readAutomationExecutionStatusHours as w, readAutomationExecutionDays as x, emptyAutomationRunWindows as y };
988
+ export { conversationActiveDaysColumn as A, readAutomationExecutionHours as C, readAutomationExecutions as D, readAutomationExecutionSummaries as E, conversationRangeColumns as M, readAutomationRuns as O, readAutomationExecutionDays as S, readAutomationExecutionStatusHours as T, markDispatchFailed as _, confirmDispatchMailboxAppend as a, emptyAutomationRunWindows as b, getDispatchInputMessageId as c, getPluginDispatchProjection as d, isTerminalDispatchStatus as f, markDispatchCompleted as g, markDispatchBlocked as h, claimDispatchMailboxAppend as i, conversationAggregateColumns as j, recordAutomationExecution as k, getDispatchRecord as l, markDispatchAwaitingResume as m, scheduleSessionCompletedPluginTasks as n, createOrGetDispatch as o, listPendingDispatchMailboxAppends as p, task_runner_exports as r, getDispatchConversationId as s, processPluginTask as t, getDispatchTurnId as u, markDispatchRunning as v, readAutomationExecutionStatusDays as w, readAutomationExecutionByConversationId as x, notifyAutomationBlocked as y };