@sentry/junior 0.254.0 → 0.256.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 (60) hide show
  1. package/dist/{admin-D7kYbu5l.js → admin-BhucwVfy.js} +1 -1
  2. package/dist/{agent-hooks-DfPubHYm.js → agent-hooks-DlSK8PQQ.js} +8 -8
  3. package/dist/{agent-runner-BWmnJ0dD.js → agent-runner-C6_cd61V.js} +24 -21
  4. package/dist/api/schema.d.ts +0 -8
  5. package/dist/api/schema.js +2 -2
  6. package/dist/api.js +60 -70
  7. package/dist/app.js +36 -36
  8. package/dist/{assistant-reply-B3J6ogAM.js → assistant-reply-yn5G-YEG.js} +1 -1
  9. package/dist/{automation-gznOMaQ2.js → automation-CHdlHVZP.js} +3 -4
  10. package/dist/{briefs-B_fgUFD2.js → briefs-U6Bi3IYw.js} +2 -2
  11. package/dist/{catalog-runtime-TG5WF66H.js → catalog-runtime-DF5OWqCc.js} +1 -1
  12. package/dist/cli/chat.js +15 -15
  13. package/dist/cli/check.js +3 -3
  14. package/dist/cli/main.js +2 -2
  15. package/dist/cli/plugins.js +4 -4
  16. package/dist/cli/snapshot-create.js +3 -3
  17. package/dist/cli/upgrade.js +3 -3
  18. package/dist/{client-oBgOmQV6.js → client-BVrAp-pq.js} +2 -2
  19. package/dist/{config-CRlLncIj.js → config-DdBiDanf.js} +2 -2
  20. package/dist/{connections-BZAuDnYm.js → connections-CG04HdpC.js} +9 -9
  21. package/dist/{conversation-privacy-Dui3hTO-.js → conversation-privacy-CpSYOWnP.js} +1 -1
  22. package/dist/{credential-sync-9HiSpphh.js → credential-sync-DKWNdcgm.js} +14 -14
  23. package/dist/{executor-B88oEqok.js → executor-BroK9oKy.js} +5 -6
  24. package/dist/{images-k8HewSp_.js → images-D0VZ5nv0.js} +2 -2
  25. package/dist/instrumentation.js +2 -2
  26. package/dist/{job-queue-B6KaQXY6.js → job-queue-BbGg3gvu.js} +1 -1
  27. package/dist/{logging-B3nJLXT7.js → logging-tPQeUe2i.js} +1 -1
  28. package/dist/{message-C9Wx3Rxx.js → message-DdPGRYQP.js} +3 -3
  29. package/dist/nitro.js +3 -3
  30. package/dist/{oauth-callback-server-CetsCZng.js → oauth-callback-server-B-2errCX.js} +2 -2
  31. package/dist/{pending-auth-m8aJlwP_.js → pending-auth-DT3MRVW8.js} +2 -2
  32. package/dist/{profile-Dh73O6lZ.js → profile-Bb1zCVGP.js} +4 -4
  33. package/dist/{registry-C-jns0Be.js → registry-CsNavQ_Z.js} +1 -1
  34. package/dist/{resolve-CDYCpS_U.js → resolve-B6ZZ9duG.js} +2 -2
  35. package/dist/{result-sih-x_yN.js → result-j9nS0se-.js} +6 -6
  36. package/dist/{runner-CA43p74t.js → runner-Y331DoZ5.js} +9 -9
  37. package/dist/{sandbox-egress-signals-CxHHTu8e.js → sandbox-egress-signals-BUfjEdHY.js} +1 -1
  38. package/dist/{schema-C-a9U34c.js → schema-BBgv0MNf.js} +1 -1
  39. package/dist/{session-stop-DenN1GuJ.js → session-stop-q-6GNHx6.js} +10 -10
  40. package/dist/{skills-D_XDFkSx.js → skills-CyvTsR9M.js} +2 -2
  41. package/dist/{spawn-CcWYt3Tl.js → spawn-Do5mX3d_.js} +2 -2
  42. package/dist/{store-CIs0Tr31.js → store-D2It0ozF.js} +6 -6
  43. package/dist/{task-queue-DAY-aQLX.js → task-queue-ZMk9bLRT.js} +3 -3
  44. package/dist/{task-runner-BE6Jgt2u.js → task-runner-cIGU5VwJ.js} +10 -10
  45. package/dist/{tasks-DO9VM9cu.js → tasks-CODtRzvX.js} +16 -26
  46. package/dist/{thread-state-FreaCOZD.js → thread-state-BPkwVmvK.js} +6 -6
  47. package/dist/{turn-failure-response-CJSt2ZSf.js → turn-failure-response-ChmMeKar.js} +7 -7
  48. package/dist/{turn-lifecycle-BXclEcfZ.js → turn-lifecycle-BUP7ZOVa.js} +1 -1
  49. package/dist/{turn-session-routing-CItfUsjQ.js → turn-session-routing-BcWM3PLm.js} +1 -1
  50. package/dist/{validation-MW8dmhF9.js → validation-DCd69-cP.js} +1 -1
  51. package/dist/{version-DcWD8xpq.js → version-DBc4Qt_P.js} +1 -1
  52. package/dist/version.js +1 -1
  53. package/dist/{viewer-CGZiUVMU.js → viewer-C-9nFKYr.js} +3 -3
  54. package/dist/{web-input-Dpqh0oBt.js → web-input-Cv42P3ni.js} +74 -75
  55. package/dist/{work-DbA9xNO1.js → work-6UmVQq1V.js} +9 -9
  56. package/dist/{worker-DuCs9-3G.js → worker-DAoBZuZn.js} +5 -5
  57. package/migrations/0058_automation_creator_identity.sql +45 -0
  58. package/migrations/meta/0058_snapshot.json +3598 -0
  59. package/migrations/meta/_journal.json +7 -0
  60. package/package.json +4 -4
package/dist/app.js CHANGED
@@ -1,38 +1,38 @@
1
- import { At as consumeSandboxEgressPermissionDeniedSignal, B as effectiveTaskOutcomes, Ct as ingestEvent, Dt as SANDBOX_EGRESS_PROXY_PATH, E as requestAttachmentDeletion, Et as shouldPropagateSandboxEgressTrace, F as logScheduledAutomationRunSkipped, I as scheduledAutomationRunAttributes, It as startOAuthFlow, Kt as getConfigDefaults, Lt as createUserTokenStore, Nt as formatProviderLabel, O as parseSlackThreadId, Ot as clearSandboxEgressSignals, St as processWorkspaceSnapshotJob, Tt as normalizeSandboxEgressTracePropagationDomains, U as stopConversationSession, W as recordSubagentEnded, b as unpublishedArtifactHeaders, i as executeCredentialedEgressRequest, jt as parseSandboxEgressCredentialToken, kt as consumeSandboxEgressAuthRequiredSignal, lt as listPendingAgentInvocationMailboxAppends, n as executeAgentRun, qt as setConfigDefaults, t as createAgentRunner, ut as listPendingAgentInvocationResults, v as publicArtifactHeaders, w as collectAttachmentGarbage, wt as resolveSandboxEgressProviderForHost, x as lookupSlackUserProfile, y as readPublicArtifact } from "./agent-runner-BWmnJ0dD.js";
2
- import { C as withLogContext, O as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, S as withContext, d as logException, f as logInfo, j as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, p as logWarn, r as createRequestContext, v as setSpanAttributes, w as withSpan, y as setSpanStatus } from "./logging-B3nJLXT7.js";
1
+ import { At as consumeSandboxEgressPermissionDeniedSignal, B as effectiveTaskOutcomes, Ct as ingestEvent, Dt as SANDBOX_EGRESS_PROXY_PATH, E as requestAttachmentDeletion, Et as shouldPropagateSandboxEgressTrace, F as logScheduledAutomationRunSkipped, I as scheduledAutomationRunAttributes, It as startOAuthFlow, Kt as getConfigDefaults, Lt as createUserTokenStore, Nt as formatProviderLabel, O as parseSlackThreadId, Ot as clearSandboxEgressSignals, St as processWorkspaceSnapshotJob, Tt as normalizeSandboxEgressTracePropagationDomains, U as stopConversationSession, W as recordSubagentEnded, b as unpublishedArtifactHeaders, i as executeCredentialedEgressRequest, jt as parseSandboxEgressCredentialToken, kt as consumeSandboxEgressAuthRequiredSignal, lt as listPendingAgentInvocationMailboxAppends, n as executeAgentRun, qt as setConfigDefaults, t as createAgentRunner, ut as listPendingAgentInvocationResults, v as publicArtifactHeaders, w as collectAttachmentGarbage, wt as resolveSandboxEgressProviderForHost, x as lookupSlackUserProfile, y as readPublicArtifact } from "./agent-runner-C6_cd61V.js";
2
+ import { C as withLogContext, O as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, S as withContext, d as logException, f as logInfo, j as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, p as logWarn, r as createRequestContext, v as setSpanAttributes, w as withSpan, y as setSpanStatus } from "./logging-tPQeUe2i.js";
3
3
  import { n as captureMessage, r as continueTrace } from "./sentry-CgWZM_kV.js";
4
- import { t as JUNIOR_VERSION } from "./version-DcWD8xpq.js";
5
- import { _ as snapshotRuntimeConfig, d as restoreRuntimeConfig, f as setBotModelConfig, g as setSlackReactionConfig, h as setRuntimeLimits, i as getChatConfig, m as setProfiles, n as botConfig, o as getSlackBotToken, p as setCrossActorMidRunMode, u as resetRuntimeConfig } from "./config-CRlLncIj.js";
4
+ import { t as JUNIOR_VERSION } from "./version-DBc4Qt_P.js";
5
+ import { _ as snapshotRuntimeConfig, d as restoreRuntimeConfig, f as setBotModelConfig, g as setSlackReactionConfig, h as setRuntimeLimits, i as getChatConfig, m as setProfiles, n as botConfig, o as getSlackBotToken, p as setCrossActorMidRunMode, u as resetRuntimeConfig } from "./config-DdBiDanf.js";
6
6
  import { _ as slackMessageTsSchema, d as parseSlackTeamId, f as parseSlackUserId, h as slackUserIdSchema, m as slackTeamIdSchema, o as parseActorUserId, p as slackChannelIdSchema } from "./actor-BTtLaeWy.js";
7
- import { c as getConversationEventStore, d as getDb, f as getSqlExecutor, g as withConversationMutationLock, m as withConversationEventLock, r as readActorIdentity, u as getConversationStore } from "./viewer-CGZiUVMU.js";
7
+ import { c as getConversationEventStore, d as getDb, f as getSqlExecutor, g as withConversationMutationLock, m as withConversationEventLock, r as readActorIdentity, u as getConversationStore } from "./viewer-C-9nFKYr.js";
8
8
  import { a as juniorAgentInvocations, d as juniorDestinations, i as juniorAgentBindings, s as juniorConversations } from "./agent-invocations-BY60iNw-.js";
9
- import { f as juniorConversationBriefs, h as juniorConversationEvents, o as juniorAutomationRuns, s as juniorAutomations } from "./executor-B88oEqok.js";
10
- import { n as pluginCatalogRuntime } from "./catalog-runtime-TG5WF66H.js";
11
- import { C as eventAutomationRunLimitReason, F as slackMention, G as slackExternalRefIdSchema, S as admitEventAutomationRun, W as slackEntitySchema, Wt as appendConversationMessages, Xt as settleConversationTitleWork, a as readScheduledAutomation, c as scheduledRunId, d as collectEventAutomationMatchKeys, h as findMatchingEventAutomations, l as withScheduledAutomationLock, n as listScheduledAutomations, qt as projectConversationMessages, r as listScheduledAutomationsForTeam, s as saveScheduledAutomationInLock, u as blockEventAutomation } from "./tasks-DO9VM9cu.js";
12
- import { $ as bindSlackDirectCredentialSubject, At as resolveRootVisibility, Ht as getSlackClient, Jt as getWorkspaceTeamId, Nt as listConversationAnnotations, Q as bindScheduledAutomationCredentialSubject, U as collectEventMatchKeys, Wt as isDmChannel, X as takeDueTimerWatches, Yt as runWithWorkspaceTeamId, Z as bindEventAutomationCredentialSubject, a as getPluginRoutes, at as getDashboardConversationLink, ct as setDashboardConversationLinkOptions, d as setPlugins, et as verifyEventAutomationCredentialSubject, f as validatePlugins, ft as createPluginLogger, h as setBriefsConfig, i as getPluginApiRoutes, lt as createPluginState, nt as verifySlackDirectCredentialSubject, pt as readConversationAccessFromSql, q as findMatchingWatches, st as getDashboardTaskLink, tt as verifyScheduledAutomationCredentialSubject, u as getPlugins } from "./agent-hooks-DfPubHYm.js";
9
+ import { f as juniorConversationBriefs, h as juniorConversationEvents, o as juniorAutomationRuns, s as juniorAutomations } from "./executor-BroK9oKy.js";
10
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-DF5OWqCc.js";
11
+ import { Gt as projectConversationMessages, H as slackEntitySchema, Ht as appendConversationMessages, Jt as settleConversationTitleWork, N as slackMention, U as slackExternalRefIdSchema, b as admitEventAutomationRun, c as withScheduledAutomationLock, i as readScheduledAutomation, l as blockEventAutomation, n as listScheduledAutomationsForTeam, o as saveScheduledAutomationInLock, p as findMatchingEventAutomations, s as scheduledRunId, u as collectEventAutomationMatchKeys, x as eventAutomationRunLimitReason } from "./tasks-CODtRzvX.js";
12
+ import { $ as bindSlackDirectCredentialSubject, At as resolveRootVisibility, Ht as getSlackClient, Jt as getWorkspaceTeamId, Nt as listConversationAnnotations, Q as bindScheduledAutomationCredentialSubject, U as collectEventMatchKeys, Wt as isDmChannel, X as takeDueTimerWatches, Yt as runWithWorkspaceTeamId, Z as bindEventAutomationCredentialSubject, a as getPluginRoutes, at as getDashboardConversationLink, ct as setDashboardConversationLinkOptions, d as setPlugins, et as verifyEventAutomationCredentialSubject, f as validatePlugins, ft as createPluginLogger, h as setBriefsConfig, i as getPluginApiRoutes, lt as createPluginState, nt as verifySlackDirectCredentialSubject, pt as readConversationAccessFromSql, q as findMatchingWatches, st as getDashboardTaskLink, tt as verifyScheduledAutomationCredentialSubject, u as getPlugins } from "./agent-hooks-DlSK8PQQ.js";
13
13
  import { W as annotationCard } from "./conversation-T18Xlkx9.js";
14
- import { O as withLock$1, w as getStateAdapter } from "./profile-Dh73O6lZ.js";
15
- import { c as getThreadStopDecision } from "./pending-auth-m8aJlwP_.js";
16
- import { O as renderTaskInput, f as slackChannelMessageEvent, l as getEventCatalog, p as slackChannelMessageReplyThreadTs, u as SLACK_EVENT_NAMESPACE, y as eventGuidance } from "./session-stop-DenN1GuJ.js";
14
+ import { O as withLock$1, w as getStateAdapter } from "./profile-Bb1zCVGP.js";
15
+ import { c as getThreadStopDecision } from "./pending-auth-DT3MRVW8.js";
16
+ import { O as renderTaskInput, f as slackChannelMessageEvent, l as getEventCatalog, p as slackChannelMessageReplyThreadTs, u as SLACK_EVENT_NAMESPACE, y as eventGuidance } from "./session-stop-q-6GNHx6.js";
17
17
  import { n as getNextRunAtMs } from "./cadence-D00SCzT1.js";
18
- import { f as setSandboxResourceConfig, u as getSandboxResourceConfig } from "./resolve-CDYCpS_U.js";
19
- import { a as getVercelConversationWorkQueue, g as isConversationQueueMessageRejectedError, h as conversationQueueMessageSchema, i as verifyWorkspaceSnapshotJobMessage, o as resolveConversationWorkQueueTopic, s as verifyConversationQueueMessage, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-B6KaQXY6.js";
20
- import { A as hasRunnableConversationWork$1, M as isInvalidConversationRecordError, O as CONVERSATION_WORK_STALE_ENQUEUE_MS, S as removeActiveConversation, _ as hasRunnableConversationWork, c as clearExpiredConversationLease, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, v as listActiveConversationIds } from "./store-CIs0Tr31.js";
21
- import { D as scheduledRunSchema } from "./automation-gznOMaQ2.js";
18
+ import { f as setSandboxResourceConfig, u as getSandboxResourceConfig } from "./resolve-B6ZZ9duG.js";
19
+ import { a as getVercelConversationWorkQueue, g as isConversationQueueMessageRejectedError, h as conversationQueueMessageSchema, i as verifyWorkspaceSnapshotJobMessage, o as resolveConversationWorkQueueTopic, s as verifyConversationQueueMessage, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-BbGg3gvu.js";
20
+ import { A as hasRunnableConversationWork$1, M as isInvalidConversationRecordError, O as CONVERSATION_WORK_STALE_ENQUEUE_MS, S as removeActiveConversation, _ as hasRunnableConversationWork, c as clearExpiredConversationLease, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, v as listActiveConversationIds } from "./store-D2It0ozF.js";
21
+ import { D as scheduledRunSchema } from "./automation-CHdlHVZP.js";
22
22
  import { i as setExperimentalFeatures, n as getExperimentalFeatures, r as isExperimentalFeatureEnabled } from "./experimental-Qn9rKLgx.js";
23
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-MW8dmhF9.js";
23
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-DCd69-cP.js";
24
24
  import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-egKWjgue.js";
25
- import { A as withNormalizedThreadId, C as buildSlackInboundMessage, D as isSlackMessageStopped, E as verifySlackSignature, F as renderSlackObjectCard, I as createVercelAttachmentStorage, M as THREAD_OPTOUT_ACK, N as startProcessingReaction, O as stopSlackThread, P as parseContent, R as enqueueAgentDispatch, S as recordSkippedConversationMessage, T as runWithSlackInstallation, a as recordWebConversationActivity, c as createProductionSlackWebhookServices, f as createSlackWebApiStatusSender, j as stopConversationTurn, k as normalizeIncomingSlackThreadId, l as getProductionSlackAdapter, n as conversationTurnIdForMessage, o as webActorFromEmail, s as createProductionConversationWorkOptions, t as appendAndEnqueueWebMessage, v as readViewerAutomationSummary, w as clearSlackPendingReactions, z as GET$3 } from "./web-input-Dpqh0oBt.js";
26
- import { M as recordAutomationExecution, S as existingConversationId, a as confirmDispatchMailboxAppend, b as notifyAutomationBlocked, f as getPluginDispatchProjection, m as listPendingDispatchMailboxAppends, o as createOrGetDispatch, p as isTerminalDispatchStatus, s as getDispatchConversationId, t as processPluginTask, u as getDispatchRecord, v as markDispatchFailed } from "./task-runner-BE6Jgt2u.js";
27
- import { o as getAuthPausedConversationTurnId, t as enqueueAgentInvocationResult } from "./result-sih-x_yN.js";
28
- import { r as enqueueAgentInvocation } from "./work-DbA9xNO1.js";
29
- import { s as coerceThreadConversationState } from "./thread-state-FreaCOZD.js";
30
- import { o as unlinkProvider } from "./connections-BZAuDnYm.js";
31
- import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-9HiSpphh.js";
32
- import { a as registerVercelPluginTaskDevConsumer, n as createVercelPluginTaskCallback, s as queueCallback } from "./task-queue-DAY-aQLX.js";
33
- import { t as processConversationWork } from "./worker-DuCs9-3G.js";
34
- import { t as bindMessageAgent } from "./message-C9Wx3Rxx.js";
35
- import { t as bindSpawnAgent } from "./spawn-CcWYt3Tl.js";
25
+ import { A as withNormalizedThreadId, C as buildSlackInboundMessage, D as isSlackMessageStopped, E as verifySlackSignature, F as renderSlackObjectCard, I as createVercelAttachmentStorage, M as THREAD_OPTOUT_ACK, N as startProcessingReaction, O as stopSlackThread, P as parseContent, R as enqueueAgentDispatch, S as recordSkippedConversationMessage, T as runWithSlackInstallation, a as recordWebConversationActivity, c as createProductionSlackWebhookServices, f as createSlackWebApiStatusSender, j as stopConversationTurn, k as normalizeIncomingSlackThreadId, l as getProductionSlackAdapter, n as conversationTurnIdForMessage, o as webActorFromEmail, s as createProductionConversationWorkOptions, t as appendAndEnqueueWebMessage, v as readViewerAutomationSummary, w as clearSlackPendingReactions, z as GET$3 } from "./web-input-Cv42P3ni.js";
26
+ import { M as recordAutomationExecution, S as existingConversationId, a as confirmDispatchMailboxAppend, b as notifyAutomationBlocked, f as getPluginDispatchProjection, m as listPendingDispatchMailboxAppends, o as createOrGetDispatch, p as isTerminalDispatchStatus, s as getDispatchConversationId, t as processPluginTask, u as getDispatchRecord, v as markDispatchFailed } from "./task-runner-cIGU5VwJ.js";
27
+ import { o as getAuthPausedConversationTurnId, t as enqueueAgentInvocationResult } from "./result-j9nS0se-.js";
28
+ import { r as enqueueAgentInvocation } from "./work-6UmVQq1V.js";
29
+ import { s as coerceThreadConversationState } from "./thread-state-BPkwVmvK.js";
30
+ import { o as unlinkProvider } from "./connections-CG04HdpC.js";
31
+ import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-DKWNdcgm.js";
32
+ import { a as registerVercelPluginTaskDevConsumer, n as createVercelPluginTaskCallback, s as queueCallback } from "./task-queue-ZMk9bLRT.js";
33
+ import { t as processConversationWork } from "./worker-DAoBZuZn.js";
34
+ import { t as bindMessageAgent } from "./message-DdPGRYQP.js";
35
+ import { t as bindSpawnAgent } from "./spawn-Do5mX3d_.js";
36
36
  import { createRequire } from "node:module";
37
37
  import { Hono } from "hono";
38
38
  import { z } from "zod";
@@ -442,13 +442,13 @@ async function writeRun(db, run) {
442
442
  set: columns
443
443
  });
444
444
  }
445
- async function listIncompleteRunsForTaskIds(db, taskIds) {
446
- if (taskIds.length === 0) return [];
447
- return (await db.select().from(juniorAutomationRuns).where(and(inArray(juniorAutomationRuns.automationId, taskIds), inArray(juniorAutomationRuns.status, [...INCOMPLETE_RUN_STATUSES]))).orderBy(asc(juniorAutomationRuns.scheduledForMs), asc(juniorAutomationRuns.id))).map(parseScheduledRunRow).filter(present);
448
- }
449
- /** List incomplete runs for retained scheduled automations. */
450
- async function listIncompleteScheduledRuns(db) {
451
- return await listIncompleteRunsForTaskIds(db, (await listScheduledAutomations(db)).map((task) => task.id));
445
+ /**
446
+ * List incomplete Scheduled automation runs, optionally for one automation.
447
+ * Deleted automations are included: a run that was already dispatched when
448
+ * its automation was deleted must still settle.
449
+ */
450
+ async function listIncompleteScheduledRuns(db, automationId) {
451
+ return (await db.select({ run: juniorAutomationRuns }).from(juniorAutomationRuns).innerJoin(juniorAutomations, eq(juniorAutomations.id, juniorAutomationRuns.automationId)).where(and(eq(juniorAutomations.kind, "scheduled"), automationId === void 0 ? void 0 : eq(juniorAutomationRuns.automationId, automationId), inArray(juniorAutomationRuns.status, [...INCOMPLETE_RUN_STATUSES]))).orderBy(asc(juniorAutomationRuns.scheduledForMs), asc(juniorAutomationRuns.id))).map(({ run }) => parseScheduledRunRow(run)).filter(present);
452
452
  }
453
453
  function getDueRunAtMs(task, nowMs) {
454
454
  if (typeof task.runNowAtMs === "number" && Number.isFinite(task.runNowAtMs) && task.runNowAtMs <= nowMs) return task.runNowAtMs;
@@ -539,7 +539,7 @@ async function claimDueScheduledRun(db, args) {
539
539
  const scheduledForMs = getDueRunAtMs(task, args.nowMs);
540
540
  if (scheduledForMs === void 0) return void 0;
541
541
  const runId = scheduledRunId(task.id, scheduledForMs);
542
- const incompleteRuns = await listIncompleteRunsForTaskIds(taskTx, [task.id]);
542
+ const incompleteRuns = await listIncompleteScheduledRuns(taskTx, task.id);
543
543
  const incompleteRun = incompleteRuns.find((item) => item.id === runId);
544
544
  if (incompleteRuns.find((item) => item.id !== runId && !isStalePendingRun(item, args.nowMs))) return void 0;
545
545
  if (incompleteRun) {
@@ -1,4 +1,4 @@
1
- import { lt as extractAssistantText } from "./tasks-DO9VM9cu.js";
1
+ import { st as extractAssistantText } from "./tasks-CODtRzvX.js";
2
2
  //#region src/chat/no-reply.ts
3
3
  const NO_REPLY_MARKER = "[[NO_REPLY]]";
4
4
  /**
@@ -234,6 +234,8 @@ const eventAutomationSchema = z.object({
234
234
  id: z.string().min(1),
235
235
  createdAtMs: z.number().finite(),
236
236
  createdBy: eventAutomationPrincipalSchema,
237
+ /** Junior identity that created the automation. It decides ownership. */
238
+ creatorIdentityId: z.string().min(1),
237
239
  credentialMode: z.enum(["system", "creator"]),
238
240
  destination: eventAutomationDestinationSchema,
239
241
  destinationVisibility: destinationVisibilitySchema,
@@ -501,10 +503,7 @@ const automationListSchema = z.object({
501
503
  creators: z.array(automationFilterOptionSchema),
502
504
  destinations: z.array(automationFilterOptionSchema)
503
505
  }).strict();
504
- const automationParamsSchema = z.object({
505
- id: z.string().min(1),
506
- kind: z.enum(["scheduled", "event"])
507
- }).strict();
506
+ const automationParamsSchema = z.object({ id: z.string().min(1) }).strict();
508
507
  const automationExecutionStatusSchema = z.enum([
509
508
  "blocked",
510
509
  "completed",
@@ -1,4 +1,4 @@
1
- import { r as completeObject } from "./client-oBgOmQV6.js";
1
+ import { r as completeObject } from "./client-BVrAp-pq.js";
2
2
  import { r as defaultModelId } from "./model-profile-BwU8mqwD.js";
3
3
  import { U as parseBriefInput, d as conversationDetailReportSchema, p as conversationEventPageSchema, z as briefCodeChangeSchema } from "./conversation-T18Xlkx9.js";
4
4
  import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-C04mP1hu.js";
@@ -269,7 +269,7 @@ async function parseRunOptions(argv) {
269
269
  * `DATABASE_URL` at import, and `briefs pull` must work with only a token.
270
270
  */
271
271
  async function configuredDefaultModelId() {
272
- const { botConfig } = await import("./config-CRlLncIj.js").then((n) => n.r);
272
+ const { botConfig } = await import("./config-DdBiDanf.js").then((n) => n.r);
273
273
  return defaultModelId(botConfig);
274
274
  }
275
275
  function apiUrl(baseUrl, pathname) {
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { t as createPluginCatalogRuntime } from "./registry-C-jns0Be.js";
2
+ import { t as createPluginCatalogRuntime } from "./registry-CsNavQ_Z.js";
3
3
  //#region src/chat/plugins/catalog-runtime.ts
4
4
  var catalog_runtime_exports = /* @__PURE__ */ __exportAll({ pluginCatalogRuntime: () => pluginCatalogRuntime });
5
5
  const pluginCatalogRuntime = createPluginCatalogRuntime();
package/dist/cli/chat.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-BWmnJ0dD.js";
1
+ import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-C6_cd61V.js";
2
2
  import { t as loadAppPluginSet } from "../plugin-module-CVvEUSMH.js";
3
3
  import path from "node:path";
4
4
  import { createHash, randomUUID } from "node:crypto";
@@ -100,10 +100,10 @@ async function loadLocalPluginSet() {
100
100
  async function configureLocalChatPlugins(pluginSet) {
101
101
  const [pluginsModule, agentHooksModule, catalogRuntimeModule, validationModule, databaseModule] = await Promise.all([
102
102
  import("../plugins-egKWjgue.js").then((n) => n.o),
103
- import("../agent-hooks-DfPubHYm.js").then((n) => n.t),
104
- import("../catalog-runtime-TG5WF66H.js").then((n) => n.t),
105
- import("../validation-MW8dmhF9.js").then((n) => n.r),
106
- import("../viewer-CGZiUVMU.js").then((n) => n.s)
103
+ import("../agent-hooks-DlSK8PQQ.js").then((n) => n.t),
104
+ import("../catalog-runtime-DF5OWqCc.js").then((n) => n.t),
105
+ import("../validation-DCd69-cP.js").then((n) => n.r),
106
+ import("../viewer-C-9nFKYr.js").then((n) => n.s)
107
107
  ]);
108
108
  const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
109
109
  const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
@@ -155,19 +155,19 @@ async function prepareLocalChatRun(io, pluginSet) {
155
155
  await configureLocalChatPlugins(pluginSet);
156
156
  const { setExperimentalFeatures } = await import("../experimental-Qn9rKLgx.js").then((n) => n.t);
157
157
  setExperimentalFeatures({ subagents: true });
158
- const { setBriefsConfig } = await import("../agent-hooks-DfPubHYm.js").then((n) => n.m);
158
+ const { setBriefsConfig } = await import("../agent-hooks-DlSK8PQQ.js").then((n) => n.m);
159
159
  setBriefsConfig({ enabled: true });
160
- const { runLocalAgentTurn } = await import("../runner-CA43p74t.js");
161
- const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-CetsCZng.js");
160
+ const { runLocalAgentTurn } = await import("../runner-Y331DoZ5.js");
161
+ const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-B-2errCX.js");
162
162
  const { createLocalOAuthState } = await import("../oauth-relay-CdCnu80W.js").then((n) => n.t);
163
- const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-CxHHTu8e.js");
164
- const { bindSpawnAgent } = await import("../spawn-CcWYt3Tl.js").then((n) => n.n);
165
- const { bindMessageAgent } = await import("../message-C9Wx3Rxx.js").then((n) => n.n);
166
- const { createAgentInvocationWorker, routeAgentInvocationWork } = await import("../work-DbA9xNO1.js").then((n) => n.a);
167
- const { startAgentInvocationsForChildInput } = await import("../result-sih-x_yN.js").then((n) => n.r);
168
- const { skipInputBeforeConversationStop } = await import("../session-stop-DenN1GuJ.js").then((n) => n.r);
163
+ const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-BUfjEdHY.js");
164
+ const { bindSpawnAgent } = await import("../spawn-Do5mX3d_.js").then((n) => n.n);
165
+ const { bindMessageAgent } = await import("../message-DdPGRYQP.js").then((n) => n.n);
166
+ const { createAgentInvocationWorker, routeAgentInvocationWork } = await import("../work-6UmVQq1V.js").then((n) => n.a);
167
+ const { startAgentInvocationsForChildInput } = await import("../result-j9nS0se-.js").then((n) => n.r);
168
+ const { skipInputBeforeConversationStop } = await import("../session-stop-q-6GNHx6.js").then((n) => n.r);
169
169
  const { createLocalConversationWork } = await import("../conversation-work-C6y3T5Hx.js");
170
- const { processConversationWork } = await import("../worker-DuCs9-3G.js").then((n) => n.n);
170
+ const { processConversationWork } = await import("../worker-DAoBZuZn.js").then((n) => n.n);
171
171
  let agentRunner;
172
172
  const localConversationWork = createLocalConversationWork(async (message) => {
173
173
  if (!agentRunner) throw new Error("Local agent runner is not ready");
package/dist/cli/check.js CHANGED
@@ -1,6 +1,6 @@
1
- import { D as JUNIOR_HEARTBEAT_ROUTE, M as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, T as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-B3nJLXT7.js";
2
- import { _ as parsePluginManifest, g as parseInlinePluginManifest } from "../registry-C-jns0Be.js";
3
- import { i as parseSkillFile } from "../skills-D_XDFkSx.js";
1
+ import { D as JUNIOR_HEARTBEAT_ROUTE, M as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, T as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-tPQeUe2i.js";
2
+ import { _ as parsePluginManifest, g as parseInlinePluginManifest } from "../registry-CsNavQ_Z.js";
3
+ import { i as parseSkillFile } from "../skills-CyvTsR9M.js";
4
4
  import path from "node:path";
5
5
  import fs from "node:fs/promises";
6
6
  import { pathToFileURL } from "node:url";
package/dist/cli/main.js CHANGED
@@ -25,10 +25,10 @@ async function runChat(argv, pluginSet) {
25
25
  return await (await import("./chat.js")).runChat(argv, void 0, { pluginSet });
26
26
  }
27
27
  async function runAdmin(argv) {
28
- return await (await import("../admin-D7kYbu5l.js")).runAdmin(argv);
28
+ return await (await import("../admin-BhucwVfy.js")).runAdmin(argv);
29
29
  }
30
30
  async function runBriefs(argv) {
31
- return await (await import("../briefs-B_fgUFD2.js")).runBriefs(argv);
31
+ return await (await import("../briefs-U6Bi3IYw.js")).runBriefs(argv);
32
32
  }
33
33
  function topLevelCommand(argv) {
34
34
  return (argv[0] === "--" ? argv.slice(1) : argv)[0];
@@ -1,7 +1,7 @@
1
- import { d as getDb } from "../viewer-CGZiUVMU.js";
2
- import { n as pluginCatalogRuntime } from "../catalog-runtime-TG5WF66H.js";
3
- import { d as setPlugins, f as validatePlugins, ft as createPluginLogger } from "../agent-hooks-DfPubHYm.js";
4
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-MW8dmhF9.js";
1
+ import { d as getDb } from "../viewer-C-9nFKYr.js";
2
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-DF5OWqCc.js";
3
+ import { d as setPlugins, f as validatePlugins, ft as createPluginLogger } from "../agent-hooks-DlSK8PQQ.js";
4
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-DCd69-cP.js";
5
5
  import { a as pluginRuntimeRegistrationsFromPluginSet, i as pluginCliRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "../plugins-egKWjgue.js";
6
6
  import { t as loadAppPluginSet } from "../plugin-module-CVvEUSMH.js";
7
7
  import { stderr, stdout } from "node:process";
@@ -1,6 +1,6 @@
1
- import { n as pluginCatalogRuntime } from "../catalog-runtime-TG5WF66H.js";
2
- import { S as disconnectStateAdapter, t as create } from "../profile-Dh73O6lZ.js";
3
- import { r as resolve } from "../resolve-CDYCpS_U.js";
1
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-DF5OWqCc.js";
2
+ import { S as disconnectStateAdapter, t as create } from "../profile-Bb1zCVGP.js";
3
+ import { r as resolve } from "../resolve-B6ZZ9duG.js";
4
4
  //#region src/cli/snapshot-create.ts
5
5
  const DEFAULT_RUNTIME = "node22";
6
6
  const DEFAULT_TIMEOUT_MS = 6e5;
@@ -1,6 +1,6 @@
1
- import { i as getChatConfig } from "../config-CRlLncIj.js";
2
- import { t as createJuniorSqlExecutor } from "../executor-B88oEqok.js";
3
- import { t as createPluginCatalogRuntime } from "../registry-C-jns0Be.js";
1
+ import { i as getChatConfig } from "../config-DdBiDanf.js";
2
+ import { t as createJuniorSqlExecutor } from "../executor-BroK9oKy.js";
3
+ import { t as createPluginCatalogRuntime } from "../registry-CsNavQ_Z.js";
4
4
  import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-egKWjgue.js";
5
5
  import { t as loadAppPluginSet } from "../plugin-module-CVvEUSMH.js";
6
6
  import { basename, dirname, join, resolve } from "node:path";
@@ -1,5 +1,5 @@
1
- import { d as logException, g as serializeGenAiAttribute, i as extractGenAiUsageAttributes, m as normalizeGenAiFinishReason, p as logWarn, w as withSpan } from "./logging-B3nJLXT7.js";
2
- import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-Dui3hTO-.js";
1
+ import { d as logException, g as serializeGenAiAttribute, i as extractGenAiUsageAttributes, m as normalizeGenAiFinishReason, p as logWarn, w as withSpan } from "./logging-tPQeUe2i.js";
2
+ import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-CpSYOWnP.js";
3
3
  import { calculateCost, completeSimple, getEnvApiKey, getModels, registerApiProvider } from "@earendil-works/pi-ai/compat";
4
4
  import { stream as streamAnthropic, streamSimple as streamSimpleAnthropic } from "@earendil-works/pi-ai/api/anthropic-messages";
5
5
  import { createGatewayProvider } from "@ai-sdk/gateway";
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { S as toOptionalTrimmed, o as resolveGatewayModel } from "./client-oBgOmQV6.js";
3
- import { p as logWarn } from "./logging-B3nJLXT7.js";
2
+ import { S as toOptionalTrimmed, o as resolveGatewayModel } from "./client-BVrAp-pq.js";
3
+ import { p as logWarn } from "./logging-tPQeUe2i.js";
4
4
  import { l as TURN_REASONING_LEVELS, s as modelProfileSchema, t as DEFAULT_MODEL_PROFILES, u as parseTurnReasoningLevel } from "./model-profile-BwU8mqwD.js";
5
5
  //#region src/chat/slack/emoji.ts
6
6
  const SLACK_EMOJI_NAME_RE = /^(?:[a-z0-9_+-]+)(?:::(?:skin-tone-[2-6]))?$/;
@@ -1,12 +1,12 @@
1
- import { It as startOAuthFlow, c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-BWmnJ0dD.js";
2
- import { D as deleteProviderIdentityForSlackUser, c as getConversationEventStore, f as getSqlExecutor } from "./viewer-CGZiUVMU.js";
3
- import { u as hasRequiredOAuthScope } from "./registry-C-jns0Be.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-TG5WF66H.js";
5
- import { Q as getTurnRecord, Z as failTurnRecord, q as loadTurnCheckpoint } from "./tasks-DO9VM9cu.js";
6
- import { w as getStateAdapter } from "./profile-Dh73O6lZ.js";
7
- import { a as getVercelConversationWorkQueue } from "./job-queue-B6KaQXY6.js";
8
- import { m as ensureConversationWake, w as requestConversationWork } from "./store-CIs0Tr31.js";
9
- import { n as resolveTurnSessionRouting } from "./turn-session-routing-CItfUsjQ.js";
1
+ import { It as startOAuthFlow, c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-C6_cd61V.js";
2
+ import { D as deleteProviderIdentityForSlackUser, c as getConversationEventStore, f as getSqlExecutor } from "./viewer-C-9nFKYr.js";
3
+ import { u as hasRequiredOAuthScope } from "./registry-CsNavQ_Z.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-DF5OWqCc.js";
5
+ import { G as loadTurnCheckpoint, X as getTurnRecord, Y as failTurnRecord } from "./tasks-CODtRzvX.js";
6
+ import { w as getStateAdapter } from "./profile-Bb1zCVGP.js";
7
+ import { a as getVercelConversationWorkQueue } from "./job-queue-BbGg3gvu.js";
8
+ import { m as ensureConversationWake, w as requestConversationWork } from "./store-D2It0ozF.js";
9
+ import { n as resolveTurnSessionRouting } from "./turn-session-routing-BcWM3PLm.js";
10
10
  import { z } from "zod";
11
11
  import { randomBytes, randomUUID } from "node:crypto";
12
12
  //#region src/chat/task-execution/authorized-turn.ts
@@ -1,4 +1,4 @@
1
- import { p as logWarn } from "./logging-B3nJLXT7.js";
1
+ import { p as logWarn } from "./logging-tPQeUe2i.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  //#region src/chat/conversation-privacy.ts
4
4
  const SAFE_METADATA_KEY_LIMIT = 20;
@@ -1,19 +1,19 @@
1
- import { Ft as resolveBaseUrl, Lt as createUserTokenStore, Nt as formatProviderLabel, Pt as parseOAuthStatePayload, _ as resolvePluginOAuthAccount, d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, x as lookupSlackUserProfile, xt as getMcpProviderErrorAttributes } from "./agent-runner-BWmnJ0dD.js";
2
- import { f as escapeXml } from "./client-oBgOmQV6.js";
3
- import { d as logException, h as runBestEffort, p as logWarn } from "./logging-B3nJLXT7.js";
4
- import { a as getRuntimeMetadata, n as botConfig } from "./config-CRlLncIj.js";
1
+ import { Ft as resolveBaseUrl, Lt as createUserTokenStore, Nt as formatProviderLabel, Pt as parseOAuthStatePayload, _ as resolvePluginOAuthAccount, d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, x as lookupSlackUserProfile, xt as getMcpProviderErrorAttributes } from "./agent-runner-C6_cd61V.js";
2
+ import { f as escapeXml } from "./client-BVrAp-pq.js";
3
+ import { d as logException, h as runBestEffort, p as logWarn } from "./logging-tPQeUe2i.js";
4
+ import { a as getRuntimeMetadata, n as botConfig } from "./config-DdBiDanf.js";
5
5
  import { f as parseSlackUserId } from "./actor-BTtLaeWy.js";
6
- import { A as upsertIdentity, f as getSqlExecutor, j as upsertLinkedIdentity } from "./viewer-CGZiUVMU.js";
6
+ import { A as upsertIdentity, f as getSqlExecutor, j as upsertLinkedIdentity } from "./viewer-C-9nFKYr.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-C-jns0Be.js";
9
- import { n as pluginCatalogRuntime } from "./catalog-runtime-TG5WF66H.js";
10
- import { t as discoverSkills } from "./skills-D_XDFkSx.js";
11
- import { It as recordAuthenticationLinked, Lt as recordAuthorizationCompleted, Q as getTurnRecord, V as postSlackMessage } from "./tasks-DO9VM9cu.js";
12
- import { Ht as getSlackClient } from "./agent-hooks-DfPubHYm.js";
13
- import { E as acquireActiveLock, w as getStateAdapter } from "./profile-Dh73O6lZ.js";
14
- import { i as getConversationPendingAuth } from "./pending-auth-m8aJlwP_.js";
15
- import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-FreaCOZD.js";
16
- import { c as deleteWebAuthorization, f as wakeAuthorizedTurn, i as readConnectedOAuthTokens, p as wakePausedTurn } from "./connections-BZAuDnYm.js";
8
+ import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-CsNavQ_Z.js";
9
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-DF5OWqCc.js";
10
+ import { t as discoverSkills } from "./skills-CyvTsR9M.js";
11
+ import { Ft as recordAuthorizationCompleted, Pt as recordAuthenticationLinked, X as getTurnRecord, z as postSlackMessage } from "./tasks-CODtRzvX.js";
12
+ import { Ht as getSlackClient } from "./agent-hooks-DlSK8PQQ.js";
13
+ import { E as acquireActiveLock, w as getStateAdapter } from "./profile-Bb1zCVGP.js";
14
+ import { i as getConversationPendingAuth } from "./pending-auth-DT3MRVW8.js";
15
+ import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-BPkwVmvK.js";
16
+ import { c as deleteWebAuthorization, f as wakeAuthorizedTurn, i as readConnectedOAuthTokens, p as wakePausedTurn } from "./connections-CG04HdpC.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-B3nJLXT7.js";
1
+ import { d as logException } from "./logging-tPQeUe2i.js";
2
2
  import { g as startSpanManual } from "./sentry-CgWZM_kV.js";
3
- import "./config-CRlLncIj.js";
3
+ import "./config-DdBiDanf.js";
4
4
  import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, f as timestamptz, i as juniorAgentBindings, l as juniorUsers, s as juniorConversations } from "./agent-invocations-BY60iNw-.js";
5
5
  import { AsyncLocalStorage } from "node:async_hooks";
6
6
  import { sql } from "drizzle-orm";
@@ -313,8 +313,8 @@ const juniorAutomations = pgTable("junior_automations", {
313
313
  teamId: text("team_id").notNull(),
314
314
  channelId: text("channel_id").notNull(),
315
315
  creatorSlackUserId: text("creator_slack_user_id").notNull(),
316
- /** Provider identity that created a Scheduled automation. */
317
- creatorIdentityId: text("creator_identity_id"),
316
+ /** Junior identity that created the Automation. It decides ownership. */
317
+ creatorIdentityId: text("creator_identity_id").notNull().references(() => juniorIdentities.id),
318
318
  status: text("status").$type().notNull(),
319
319
  /** Why a run blocked this Automation, until its creator resumes it. */
320
320
  statusReason: text("status_reason"),
@@ -332,8 +332,7 @@ const juniorAutomations = pgTable("junior_automations", {
332
332
  check("junior_automations_record_check", sql`jsonb_typeof(${table.record}) = 'object'`),
333
333
  check("junior_automations_trigger_check", sql`(${table.kind} = 'scheduled' and ${table.namespace} is null and ${table.identifier} is null) or (${table.kind} = 'event' and ${table.namespace} is not null and ${table.identifier} is not null and ${table.nextRunAtMs} is null and ${table.runNowAtMs} is null and ${table.status} <> 'completed')`),
334
334
  index("junior_automations_team_idx").on(table.teamId, table.createdAtMs, table.id).where(sql`${table.status} <> 'deleted'`),
335
- index("junior_automations_creator_idx").on(table.teamId, table.creatorSlackUserId, table.createdAtMs, table.id),
336
- index("junior_automations_creator_identity_idx").on(table.creatorIdentityId, table.createdAtMs, table.id).where(sql`${table.creatorIdentityId} IS NOT NULL`),
335
+ index("junior_automations_creator_identity_idx").on(table.creatorIdentityId, table.createdAtMs, table.id),
337
336
  index("junior_automations_run_now_due_idx").on(table.runNowAtMs, table.createdAtMs, table.id).where(sql`${table.status} = 'active' AND ${table.runNowAtMs} IS NOT NULL`),
338
337
  index("junior_automations_next_run_due_idx").on(table.nextRunAtMs, table.createdAtMs, table.id).where(sql`${table.status} = 'active' AND ${table.nextRunAtMs} IS NOT NULL`),
339
338
  index("junior_automations_match_idx").on(table.namespace, table.identifier, table.createdAtMs, table.id).where(sql`${table.status} <> 'deleted'`)
@@ -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-BWmnJ0dD.js";
3
- import { f as getSqlExecutor } from "./viewer-CGZiUVMU.js";
2
+ import { D as storeAttachment, T as readLiveAttachment } from "./agent-runner-C6_cd61V.js";
3
+ import { f as getSqlExecutor } from "./viewer-C-9nFKYr.js";
4
4
  import { L as detectImageMediaType } from "./conversation-T18Xlkx9.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-B3nJLXT7.js";
1
+ import { N as getDeploymentServiceVersion, P as getDeploymentTelemetryAttributes } from "./logging-tPQeUe2i.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-Dui3hTO-.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-CpSYOWnP.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-CRlLncIj.js";
1
+ import { i as getChatConfig } from "./config-DdBiDanf.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-DcWD8xpq.js";
2
+ import { t as JUNIOR_VERSION } from "./version-DBc4Qt_P.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";
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { Ht as toolInvocationDestination, Q as getActiveAgentInvocationForConversation, Vt as actorFromRun, Y as createAgentInvocationForMessage, Z as findChildAgentConversationId, _t as AgentMessageTargetError, vt as PARENT_AGENT_TARGET } from "./agent-runner-BWmnJ0dD.js";
3
- import { n as enqueueAgentMessageToParent } from "./result-sih-x_yN.js";
4
- import { r as enqueueAgentInvocation } from "./work-DbA9xNO1.js";
2
+ import { Ht as toolInvocationDestination, Q as getActiveAgentInvocationForConversation, Vt as actorFromRun, Y as createAgentInvocationForMessage, Z as findChildAgentConversationId, _t as AgentMessageTargetError, vt as PARENT_AGENT_TARGET } from "./agent-runner-C6_cd61V.js";
3
+ import { n as enqueueAgentMessageToParent } from "./result-j9nS0se-.js";
4
+ import { r as enqueueAgentInvocation } from "./work-6UmVQq1V.js";
5
5
  //#region src/chat/agent-invocations/message.ts
6
6
  var message_exports = /* @__PURE__ */ __exportAll({ bindMessageAgent: () => bindMessageAgent });
7
7
  /**
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-B3nJLXT7.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-tPQeUe2i.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-B6KaQXY6.js";
3
+ import { o as resolveConversationWorkQueueTopic, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-BbGg3gvu.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-DAY-aQLX.js";
5
+ import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-ZMk9bLRT.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,5 +1,5 @@
1
- import { Lt as createUserTokenStore } from "./agent-runner-BWmnJ0dD.js";
2
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-9HiSpphh.js";
1
+ import { Lt as createUserTokenStore } from "./agent-runner-C6_cd61V.js";
2
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-DKWNdcgm.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-oBgOmQV6.js";
2
- import { Y as abandonTurnRecord, un as estimateTextTokens } from "./tasks-DO9VM9cu.js";
1
+ import { v as isProviderRetryError } from "./client-BVrAp-pq.js";
2
+ import { cn as estimateTextTokens, q as abandonTurnRecord } from "./tasks-CODtRzvX.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-oBgOmQV6.js";
2
- import { v as setSpanAttributes, y as setSpanStatus } from "./logging-B3nJLXT7.js";
3
- import { i as getChatConfig } from "./config-CRlLncIj.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-TG5WF66H.js";
1
+ import { S as toOptionalTrimmed } from "./client-BVrAp-pq.js";
2
+ import { v as setSpanAttributes, y as setSpanStatus } from "./logging-tPQeUe2i.js";
3
+ import { i as getChatConfig } from "./config-DdBiDanf.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-DF5OWqCc.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-B3nJLXT7.js";
1
+ import { f as logInfo, p as logWarn, v as setSpanAttributes } from "./logging-tPQeUe2i.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-B3nJLXT7.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-Dh73O6lZ.js";
1
+ import { v as setSpanAttributes, w as withSpan } from "./logging-tPQeUe2i.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-Bb1zCVGP.js";
3
3
  import { z } from "zod";
4
4
  import { FileSystem, Sandbox } from "@vercel/sandbox";
5
5
  //#region src/chat/sandbox/resources.ts
@@ -1,12 +1,12 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { $ as getAgentInvocation, X as createAgentInvocationFromLatest, ct as isTerminalAgentInvocation, et as getAgentInvocationIdForEvents, ft as markAgentInvocationParentMailboxAppended, it as getAgentInvocationResultMessageId, nt as getAgentInvocationIdForResult, st as getLatestAgentInvocationForConversation, tt as getAgentInvocationIdForMessage } from "./agent-runner-BWmnJ0dD.js";
2
+ import { $ as getAgentInvocation, X as createAgentInvocationFromLatest, ct as isTerminalAgentInvocation, et as getAgentInvocationIdForEvents, ft as markAgentInvocationParentMailboxAppended, it as getAgentInvocationResultMessageId, nt as getAgentInvocationIdForResult, st as getLatestAgentInvocationForConversation, tt as getAgentInvocationIdForMessage } from "./agent-runner-C6_cd61V.js";
3
3
  import { t as createActor } from "./actor-BTtLaeWy.js";
4
- import { d as credentialContextForActor } from "./registry-C-jns0Be.js";
5
- import { $ as listTurnSummaries, Q as getTurnRecord } from "./tasks-DO9VM9cu.js";
6
- import { a as EVENT_WAIT_MS, c as timerWatchCredentialSubject, s as isEventMailboxMetadata } from "./session-stop-DenN1GuJ.js";
4
+ import { d as credentialContextForActor } from "./registry-CsNavQ_Z.js";
5
+ import { X as getTurnRecord, Z as listTurnSummaries } from "./tasks-CODtRzvX.js";
6
+ import { a as EVENT_WAIT_MS, c as timerWatchCredentialSubject, s as isEventMailboxMetadata } from "./session-stop-q-6GNHx6.js";
7
7
  import { a as EVENT_SYSTEM_ACTOR, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage } from "./prompt-C04mP1hu.js";
8
- import { r as appendAndEnqueueInboundMessage } from "./store-CIs0Tr31.js";
9
- import { r as enqueueAgentInvocation } from "./work-DbA9xNO1.js";
8
+ import { r as appendAndEnqueueInboundMessage } from "./store-D2It0ozF.js";
9
+ import { r as enqueueAgentInvocation } from "./work-6UmVQq1V.js";
10
10
  import { z } from "zod";
11
11
  import { createEventSource, createLocalSource, createWebSource } from "@sentry/junior-plugin-api";
12
12
  //#region src/chat/task-execution/mailbox-input.ts
@@ -1,14 +1,14 @@
1
- import { C as withLogContext, b as setTags, d as logException } from "./logging-B3nJLXT7.js";
2
- import { c as getConversationEventStore, u as getConversationStore } from "./viewer-CGZiUVMU.js";
3
- import { d as credentialContextForActor } from "./registry-C-jns0Be.js";
4
- import { At as loadProjection, Gt as hydrateConversationMessages, J as saveTurnCheckpoint, Kt as persistConversationMessages, Lt as recordAuthorizationCompleted, Tt as commitAcceptedReply, an as markConversationMessage, en as buildConversationContext, ln as upsertConversationMessage, on as normalizeConversationText, sn as recordDeliveredAssistantMessage, tt as persistWithRetry } from "./tasks-DO9VM9cu.js";
1
+ import { C as withLogContext, b as setTags, d as logException } from "./logging-tPQeUe2i.js";
2
+ import { c as getConversationEventStore, u as getConversationStore } from "./viewer-C-9nFKYr.js";
3
+ import { d as credentialContextForActor } from "./registry-CsNavQ_Z.js";
4
+ import { $ as persistWithRetry, Ct as commitAcceptedReply, Ft as recordAuthorizationCompleted, K as saveTurnCheckpoint, Ot as loadProjection, Qt as buildConversationContext, Ut as hydrateConversationMessages, Wt as persistConversationMessages, an as recordDeliveredAssistantMessage, in as normalizeConversationText, rn as markConversationMessage, sn as upsertConversationMessage } from "./tasks-CODtRzvX.js";
5
5
  import { K as messageCardText } from "./conversation-T18Xlkx9.js";
6
6
  import { f as markTurnFailed, p as startActiveTurn, t as authorizationId } from "./oauth-authorization-BA4Dt6a7.js";
7
- import { n as getAssistantReplyText } from "./assistant-reply-B3J6ogAM.js";
8
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-BE6Jgt2u.js";
9
- import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-BXclEcfZ.js";
10
- import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-FreaCOZD.js";
11
- import { d as loadPendingMessageCards, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, t as finalizeFailedTurnReplyWithEvent } from "./turn-failure-response-CJSt2ZSf.js";
7
+ import { n as getAssistantReplyText } from "./assistant-reply-yn5G-YEG.js";
8
+ import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-cIGU5VwJ.js";
9
+ import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-BUP7ZOVa.js";
10
+ import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-BPkwVmvK.js";
11
+ import { d as loadPendingMessageCards, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, t as finalizeFailedTurnReplyWithEvent } from "./turn-failure-response-ChmMeKar.js";
12
12
  import { randomUUID } from "node:crypto";
13
13
  import { createLocalSource, localDestinationSchema } from "@sentry/junior-plugin-api";
14
14
  //#region src/chat/local/runner.ts
@@ -1,4 +1,4 @@
1
- import { Mt as sandboxEgressSignalsResponseSchema } from "./agent-runner-BWmnJ0dD.js";
1
+ import { Mt as sandboxEgressSignalsResponseSchema } from "./agent-runner-C6_cd61V.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;