@sentry/junior 0.244.0 → 0.246.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 (58) hide show
  1. package/dist/{admin-CF9lQg0M.js → admin-Bh-MYw-j.js} +1 -1
  2. package/dist/{agent-hooks-Cj_rSeWd.js → agent-hooks-DpklSWZg.js} +10 -10
  3. package/dist/{agent-runner-DtEtbaOb.js → agent-runner-DSKpHjHW.js} +568 -191
  4. package/dist/api/schema.d.ts +86 -3
  5. package/dist/api/schema.js +3 -3
  6. package/dist/api.js +372 -245
  7. package/dist/{app-DRLh-8zs.d.ts → app-BYB7szGb.d.ts} +2 -0
  8. package/dist/app.d.ts +1 -1
  9. package/dist/app.js +179 -146
  10. package/dist/{briefs-BMzTiGJO.js → briefs-cZ5vWqP_.js} +4 -4
  11. package/dist/{catalog-runtime-CpxhLwZG.js → catalog-runtime-CTaQXYqS.js} +1 -1
  12. package/dist/cli/chat.js +17 -13
  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-BVaGEb1-.js → client--xtsAxKP.js} +2 -2
  19. package/dist/{config-q9xXVN_5.js → config-BK53Ip5C.js} +11 -2
  20. package/dist/{conversation-BxvgH64Q.js → conversation-CvBG57Io.js} +11 -1
  21. package/dist/{conversation-privacy-Dyh_63Ee.js → conversation-privacy-BDBFw6Ws.js} +1 -1
  22. package/dist/{credential-sync-Bsn-6m16.js → credential-sync-BiuhC9Ds.js} +14 -14
  23. package/dist/{executor-DA7eHhmC.js → executor-bmmuRY-w.js} +2 -2
  24. package/dist/{images-CvMreau5.js → images-DZliDtSH.js} +3 -3
  25. package/dist/instrumentation.js +2 -2
  26. package/dist/{job-queue-mVyF9jgv.js → job-queue-Cz3M7gg4.js} +1 -1
  27. package/dist/{logging-z7_w-KN_.js → logging-DVtMYOdD.js} +1 -1
  28. package/dist/message-BSN-Ma5f.js +317 -0
  29. package/dist/nitro.d.ts +1 -1
  30. package/dist/nitro.js +3 -3
  31. package/dist/{oauth-authorization-Db1yGVvG.js → oauth-authorization-By_MVRDC.js} +1 -1
  32. package/dist/{oauth-callback-server-_MfOtSxS.js → oauth-callback-server-BrUo6w1e.js} +2 -2
  33. package/dist/{pending-auth-OndKPW4M.js → pending-auth-BuQLZ6dK.js} +2 -2
  34. package/dist/{profile-yeKVNECl.js → profile-BevMNSlr.js} +4 -4
  35. package/dist/{prompt-CX36ZlbV.js → prompt-C9Q9cjD3.js} +1 -1
  36. package/dist/{registry-DvzzL8-v.js → registry-C2rSEio1.js} +1 -1
  37. package/dist/{resolve-4u5gEU04.js → resolve-qPhrznTf.js} +2 -2
  38. package/dist/{runner-Y6A6pww4.js → runner-CNh5eMWx.js} +10 -10
  39. package/dist/{sandbox-egress-signals-D7AOkuoe.js → sandbox-egress-signals-BnDEKu8d.js} +1 -1
  40. package/dist/{schema-Dyyi9oRc.js → schema-BWMRg8JS.js} +28 -4
  41. package/dist/{skills-DFduSvuO.js → skills-C6zJbudq.js} +2 -2
  42. package/dist/{spawn-DYg7jhhR.js → spawn-C3efZSx3.js} +2 -2
  43. package/dist/{task-queue-BQ0vnumm.js → task-queue-BX4vG6uA.js} +3 -3
  44. package/dist/{task-runner-D4jvUpFV.js → task-runner-T51kll0U.js} +10 -10
  45. package/dist/{tasks-DBZAgTx7.js → tasks-B9OIjl2K.js} +82 -11
  46. package/dist/{thread-state-hj70P2Cp.js → thread-state-AGZtVyXp.js} +6 -6
  47. package/dist/{turn-failure-response-S2pwtR8b.js → turn-failure-response-DJ8KU2bo.js} +9 -9
  48. package/dist/{turn-lifecycle-CNFOMAJq.js → turn-lifecycle-DZJkJ95q.js} +1 -1
  49. package/dist/{turn-session-routing-1eTgv6ns.js → turn-session-routing-mRqLbMZW.js} +1 -1
  50. package/dist/{validation-DcsBjzdi.js → validation-Dg0Ihxzo.js} +1 -1
  51. package/dist/{version-DVCHJYcY.js → version-Deub4try.js} +1 -1
  52. package/dist/version.js +1 -1
  53. package/dist/{viewer-BBnCMR1g.js → viewer-D5hbx6TE.js} +3 -3
  54. package/dist/{web-authorization-CTltRLsB.js → web-authorization-DCxixz5S.js} +6 -6
  55. package/dist/{web-input-CIsRGF07.js → web-input-0sorYVLh.js} +74 -187
  56. package/dist/{work-fje9VXgQ.js → work-rm2X7jj4.js} +13 -6
  57. package/dist/{worker-Byd2Et9r.js → worker-bnGsAOP3.js} +5 -5
  58. package/package.json +4 -4
@@ -61,6 +61,8 @@ interface RuntimeLimits {
61
61
  maxAgentDepth?: number;
62
62
  /** Automated turns in a row before Junior stops answering automation. */
63
63
  maxConsecutiveAutomatedTurns?: number;
64
+ /** Runs one Event automation can start in a rolling hour. */
65
+ maxEventAutomationRunsPerHour?: number;
64
66
  /** Run slices one turn may use. */
65
67
  maxSlicesPerTurn?: number;
66
68
  /** Tool calls one turn may make. */
package/dist/app.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as ModelProfileInput, n as createApp, r as JuniorDashboardOptions, t as JuniorAppOptions } from "./app-DRLh-8zs.js";
1
+ import { i as ModelProfileInput, n as createApp, r as JuniorDashboardOptions, t as JuniorAppOptions } from "./app-BYB7szGb.js";
2
2
  import { i as defineJuniorPlugins, n as JuniorPluginSet, r as JuniorPluginSetOptions, t as JuniorPluginInput } from "./plugins-CjfUP5gJ.js";
3
3
  import { t as JUNIOR_VERSION } from "./version-CnXZ614E.js";
4
4
  export { JUNIOR_VERSION, JuniorAppOptions, type JuniorDashboardOptions, type JuniorPluginInput, type JuniorPluginSet, type JuniorPluginSetOptions, type ModelProfileInput, createApp, defineJuniorPlugins };
package/dist/app.js CHANGED
@@ -1,33 +1,34 @@
1
- import { $t as resolveSandboxEgressProviderForHost, B as effectiveTaskOutcomes, Cn as setConfigDefaults, E as requestAttachmentDeletion, F as logScheduledAutomationRunSkipped, Ft as listActiveConversationIds, Gt as CONVERSATION_WORK_STALE_ENQUEUE_MS, I as scheduledAutomationRunAttributes, Mt as getConversation, Nt as getConversationWorkState, O as parseSlackThreadId, Pt as hasRunnableConversationWork, Sn as getConfigDefaults, Tt as clearExpiredConversationLease, U as recordSubagentEnded, Ut as stopConversationWork, Vt as requestConversationWork, Xt as renderTaskInput, Yt as isInvalidConversationRecordError, an as consumeSandboxEgressPermissionDeniedSignal, b as unpublishedArtifactHeaders, bt as appendAndEnqueueInboundMessage, c as deleteMcpAuthSessionsForUserProvider, cn as formatProviderLabel, dn as startOAuthFlow, dt as ingestEvent, en as normalizeSandboxEgressTracePropagationDomains, fn as createUserTokenStore, gt as eventGuidance, ht as getEventCatalog, i as executeCredentialedEgressRequest, in as consumeSandboxEgressAuthRequiredSignal, jt as ensureConversationWake, l as deleteMcpServerSessionId, n as executeAgentRun, nn as SANDBOX_EGRESS_PROXY_PATH, nt as listPendingAgentInvocationMailboxAppends, on as parseSandboxEgressCredentialToken, qt as hasRunnableConversationWork$1, rn as clearSandboxEgressSignals, rt as listPendingAgentInvocationResults, t as createAgentRunner, tn as shouldPropagateSandboxEgressTrace, u as deleteMcpStoredOAuthCredentials, ut as processWorkspaceSnapshotJob, v as publicArtifactHeaders, w as collectAttachmentGarbage, x as lookupSlackUserProfile, y as readPublicArtifact, zt as removeActiveConversation } from "./agent-runner-DtEtbaOb.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-z7_w-KN_.js";
3
- import { r as continueTrace } from "./sentry-CgWZM_kV.js";
4
- import { t as JUNIOR_VERSION } from "./version-DVCHJYcY.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-q9xXVN_5.js";
1
+ import { At as appendAndEnqueueInboundMessage, B as effectiveTaskOutcomes, Ct as SLACK_EVENT_NAMESPACE, Dt as eventGuidance, E as requestAttachmentDeletion, F as logScheduledAutomationRunSkipped, Ft as clearExpiredConversationLease, Gt as listActiveConversationIds, Ht as getConversation, I as scheduledAutomationRunAttributes, Nn as getConfigDefaults, O as parseSlackThreadId, Pn as setConfigDefaults, Sn as createUserTokenStore, St as getEventCatalog, Tt as slackChannelMessageReplyThreadTs, U as recordSubagentEnded, Ut as getConversationWorkState, Vt as ensureConversationWake, Wt as hasRunnableConversationWork, Yt as removeActiveConversation, _t as processWorkspaceSnapshotJob, an as isInvalidConversationRecordError, b as unpublishedArtifactHeaders, c as deleteMcpAuthSessionsForUserProvider, ct as listPendingAgentInvocationResults, dn as shouldPropagateSandboxEgressTrace, fn as SANDBOX_EGRESS_PROXY_PATH, gn as parseSandboxEgressCredentialToken, hn as consumeSandboxEgressPermissionDeniedSignal, i as executeCredentialedEgressRequest, l as deleteMcpServerSessionId, ln as resolveSandboxEgressProviderForHost, mn as consumeSandboxEgressAuthRequiredSignal, n as executeAgentRun, on as renderTaskInput, pn as clearSandboxEgressSignals, rn as hasRunnableConversationWork$1, st as listPendingAgentInvocationMailboxAppends, t as createAgentRunner, tn as CONVERSATION_WORK_STALE_ENQUEUE_MS, u as deleteMcpStoredOAuthCredentials, un as normalizeSandboxEgressTracePropagationDomains, v as publicArtifactHeaders, vn as formatProviderLabel, vt as ingestEvent, w as collectAttachmentGarbage, wt as slackChannelMessageEvent, x as lookupSlackUserProfile, xn as startOAuthFlow, y as readPublicArtifact } from "./agent-runner-DSKpHjHW.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-DVtMYOdD.js";
3
+ import { n as captureMessage, r as continueTrace } from "./sentry-CgWZM_kV.js";
4
+ import { t as JUNIOR_VERSION } from "./version-Deub4try.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-BK53Ip5C.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 { D as deleteProviderIdentityForSlackUser, c as getConversationEventStore, d as getDb, f as getSqlExecutor, g as withConversationMutationLock, m as withConversationEventLock, r as readActorIdentity, u as getConversationStore } from "./viewer-BBnCMR1g.js";
7
+ import { D as deleteProviderIdentityForSlackUser, c as getConversationEventStore, d as getDb, f as getSqlExecutor, g as withConversationMutationLock, m as withConversationEventLock, r as readActorIdentity, u as getConversationStore } from "./viewer-D5hbx6TE.js";
8
8
  import { a as juniorAgentInvocations, d as juniorDestinations, i as juniorAgentBindings, s as juniorConversations } from "./agent-invocations-BO6ddZax.js";
9
- import { _ as juniorConversationEvents, a as juniorSchedulerRuns, m as juniorConversationBriefs, o as juniorSchedulerTasks } from "./executor-DA7eHhmC.js";
10
- import { n as pluginCatalogRuntime } from "./catalog-runtime-CpxhLwZG.js";
11
- import { Gt as settleConversationTitleWork, H as slackEntitySchema, Ht as projectConversationMessages, N as slackMention, U as slackExternalRefIdSchema, a as readScheduledAutomation, c as scheduledRunId, d as collectEventAutomationMatchKeys, h as findMatchingEventAutomations, l as withScheduledAutomationLock, n as listScheduledAutomations, r as listScheduledAutomationsForTeam, s as saveScheduledAutomationInLock, zt as appendConversationMessages } from "./tasks-DBZAgTx7.js";
12
- import { $ as verifySlackDirectCredentialSubject, At as listConversationAnnotations, Dt as resolveRootVisibility, G as findMatchingWatches, Gt as getWorkspaceTeamId, J as bindEventAutomationCredentialSubject, Kt as runWithWorkspaceTeamId, Q as verifyScheduledAutomationCredentialSubject, V as collectEventMatchKeys, Vt as isDmChannel, X as bindSlackDirectCredentialSubject, Y as bindScheduledAutomationCredentialSubject, Z as verifyEventAutomationCredentialSubject, a as getPluginRoutes, at as setDashboardConversationLinkOptions, d as setPlugins, f as validatePlugins, h as setBriefsConfig, i as getPluginApiRoutes, it as getDashboardTaskLink, lt as createPluginLogger, nt as getDashboardConversationLink, ot as createPluginState, q as takeDueTimerWatches, u as getPlugins, ut as readConversationAccessFromSql, z as cancelSubscriptions, zt as getSlackClient } from "./agent-hooks-Cj_rSeWd.js";
13
- import { V as annotationCard } from "./conversation-BxvgH64Q.js";
14
- import { O as withLock$1, w as getStateAdapter } from "./profile-yeKVNECl.js";
15
- import { c as getThreadStopDecision } from "./pending-auth-OndKPW4M.js";
9
+ import { _ as juniorConversationEvents, a as juniorSchedulerRuns, m as juniorConversationBriefs, o as juniorSchedulerTasks } from "./executor-bmmuRY-w.js";
10
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-CTaQXYqS.js";
11
+ import { C as eventAutomationRunLimitReason, F as slackMention, G as slackExternalRefIdSchema, S as admitEventAutomationRun, Vt as appendConversationMessages, W as slackEntitySchema, Wt as projectConversationMessages, a as readScheduledAutomation, c as scheduledRunId, d as collectEventAutomationMatchKeys, h as findMatchingEventAutomations, l as withScheduledAutomationLock, n as listScheduledAutomations, qt as settleConversationTitleWork, r as listScheduledAutomationsForTeam, s as saveScheduledAutomationInLock, u as blockEventAutomation } from "./tasks-B9OIjl2K.js";
12
+ import { $ as verifySlackDirectCredentialSubject, At as listConversationAnnotations, Dt as resolveRootVisibility, G as findMatchingWatches, Gt as getWorkspaceTeamId, J as bindEventAutomationCredentialSubject, Kt as runWithWorkspaceTeamId, Q as verifyScheduledAutomationCredentialSubject, V as collectEventMatchKeys, Vt as isDmChannel, X as bindSlackDirectCredentialSubject, Y as bindScheduledAutomationCredentialSubject, Z as verifyEventAutomationCredentialSubject, a as getPluginRoutes, at as setDashboardConversationLinkOptions, d as setPlugins, f as validatePlugins, h as setBriefsConfig, i as getPluginApiRoutes, it as getDashboardTaskLink, lt as createPluginLogger, nt as getDashboardConversationLink, ot as createPluginState, q as takeDueTimerWatches, u as getPlugins, ut as readConversationAccessFromSql, z as cancelSubscriptions, zt as getSlackClient } from "./agent-hooks-DpklSWZg.js";
13
+ import { H as annotationCard } from "./conversation-CvBG57Io.js";
14
+ import { O as withLock$1, w as getStateAdapter } from "./profile-BevMNSlr.js";
15
+ import { c as getThreadStopDecision } from "./pending-auth-BuQLZ6dK.js";
16
16
  import { n as getNextRunAtMs } from "./cadence-D00SCzT1.js";
17
- import { f as setSandboxResourceConfig, u as getSandboxResourceConfig } from "./resolve-4u5gEU04.js";
18
- 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-mVyF9jgv.js";
17
+ import { f as setSandboxResourceConfig, u as getSandboxResourceConfig } from "./resolve-qPhrznTf.js";
18
+ 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-Cz3M7gg4.js";
19
19
  import { D as scheduledRunSchema } from "./automation-gznOMaQ2.js";
20
20
  import { i as setExperimentalFeatures, n as getExperimentalFeatures, r as isExperimentalFeatureEnabled } from "./experimental-Qn9rKLgx.js";
21
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-DcsBjzdi.js";
21
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-Dg0Ihxzo.js";
22
22
  import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-egKWjgue.js";
23
- import { A as withNormalizedThreadId, B as enqueueAgentDispatch, C as buildSlackInboundMessage, D as isSlackMessageStopped, E as verifySlackSignature, F as parseContent, I as renderSlackObjectCard, L as createVercelAttachmentStorage, N as THREAD_OPTOUT_ACK, O as stopSlackThread, P as startProcessingReaction, R as enqueueAgentInvocationResult, S as recordSkippedConversationMessage, T as runWithSlackInstallation, V as GET$3, a as recordWebConversationActivity, c as createProductionSlackWebhookServices, f as createSlackWebApiStatusSender, j as getAuthPausedConversationTurnId, k as normalizeIncomingSlackThreadId, l as getProductionSlackAdapter, n as conversationTurnIdForMessage, o as webActorFromEmail, s as createProductionConversationWorkOptions, t as appendAndEnqueueWebMessage, v as readViewerAutomationSummary, w as clearSlackPendingReactions } from "./web-input-CIsRGF07.js";
24
- import { _ as markDispatchFailed, a as confirmDispatchMailboxAppend, d as getPluginDispatchProjection, f as isTerminalDispatchStatus, k as recordAutomationExecution, l as getDispatchRecord, o as createOrGetDispatch, p as listPendingDispatchMailboxAppends, s as getDispatchConversationId, t as processPluginTask, y as notifyAutomationBlocked } from "./task-runner-D4jvUpFV.js";
25
- import { r as enqueueAgentInvocation } from "./work-fje9VXgQ.js";
26
- import { s as coerceThreadConversationState } from "./thread-state-hj70P2Cp.js";
27
- import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-Bsn-6m16.js";
28
- import { a as registerVercelPluginTaskDevConsumer, n as createVercelPluginTaskCallback, s as queueCallback } from "./task-queue-BQ0vnumm.js";
29
- import { t as processConversationWork } from "./worker-Byd2Et9r.js";
30
- import { t as bindSpawnAgent } from "./spawn-DYg7jhhR.js";
23
+ import { A as withNormalizedThreadId, B as enqueueAgentDispatch, C as buildSlackInboundMessage, D as isSlackMessageStopped, E as verifySlackSignature, F as startProcessingReaction, I as parseContent, L as renderSlackObjectCard, M as getAuthPausedConversationTurnId, O as stopSlackThread, P as THREAD_OPTOUT_ACK, R as createVercelAttachmentStorage, S as recordSkippedConversationMessage, T as runWithSlackInstallation, V as GET$3, 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 } from "./web-input-0sorYVLh.js";
24
+ import { _ as markDispatchFailed, a as confirmDispatchMailboxAppend, d as getPluginDispatchProjection, f as isTerminalDispatchStatus, k as recordAutomationExecution, l as getDispatchRecord, o as createOrGetDispatch, p as listPendingDispatchMailboxAppends, s as getDispatchConversationId, t as processPluginTask, y as notifyAutomationBlocked } from "./task-runner-T51kll0U.js";
25
+ import { r as enqueueAgentInvocation } from "./work-rm2X7jj4.js";
26
+ import { s as coerceThreadConversationState } from "./thread-state-AGZtVyXp.js";
27
+ import { r as enqueueAgentInvocationResult, t as bindMessageAgent } from "./message-BSN-Ma5f.js";
28
+ import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-BiuhC9Ds.js";
29
+ import { a as registerVercelPluginTaskDevConsumer, n as createVercelPluginTaskCallback, s as queueCallback } from "./task-queue-BX4vG6uA.js";
30
+ import { t as processConversationWork } from "./worker-bnGsAOP3.js";
31
+ import { t as bindSpawnAgent } from "./spawn-C3efZSx3.js";
31
32
  import { createRequire } from "node:module";
32
33
  import { Hono } from "hono";
33
34
  import { z } from "zod";
@@ -1439,12 +1440,20 @@ async function getJwks(issuer) {
1439
1440
  });
1440
1441
  return jwks;
1441
1442
  }
1442
- /** Verify Vercel signed this Sandbox firewall proxy request for the active VM session. */
1443
- async function verifyVercelSandboxOidcToken(token) {
1443
+ /**
1444
+ * Verify Vercel signed this Sandbox firewall proxy request for the active VM session.
1445
+ *
1446
+ * `currentDate` is the time for the `exp` and `nbf` checks. It defaults to
1447
+ * now. Evals pass the real time because they replace `Date`.
1448
+ */
1449
+ async function verifyVercelSandboxOidcToken(token, options = {}) {
1444
1450
  const unverified = decodeJwt(token);
1445
1451
  if (typeof unverified.iss !== "string") throw new Error("Vercel OIDC token did not include an issuer");
1446
1452
  const jwks = await getJwks(unverified.iss);
1447
- return (await jwtVerify(token, jwks, { issuer: unverified.iss })).payload;
1453
+ return (await jwtVerify(token, jwks, {
1454
+ issuer: unverified.iss,
1455
+ ...options.currentDate ? { currentDate: options.currentDate } : void 0
1456
+ })).payload;
1448
1457
  }
1449
1458
  //#endregion
1450
1459
  //#region src/chat/sandbox/egress/proxy.ts
@@ -1693,7 +1702,8 @@ async function proxySandboxEgressRequest(request, deps = {}) {
1693
1702
  async function ALL(request, options = {}) {
1694
1703
  return await proxySandboxEgressRequest(request, {
1695
1704
  interceptHttp: options.interceptHttp,
1696
- tracePropagation: options.tracePropagation
1705
+ tracePropagation: options.tracePropagation,
1706
+ verifyOidc: options.verifyOidc
1697
1707
  });
1698
1708
  }
1699
1709
  /** Return whether a request should be routed through sandbox egress proxying. */
@@ -1913,43 +1923,6 @@ const slackInteractivePayloadSchema = z.object({
1913
1923
  }).optional()
1914
1924
  });
1915
1925
  //#endregion
1916
- //#region src/chat/conversations/stop.ts
1917
- /** Stop the current Conversation Turn and wake an idle resume when needed. */
1918
- async function stopConversationTurn(args) {
1919
- const nowMs = args.nowMs ?? Date.now();
1920
- const stop = async () => await stopConversationWork({
1921
- conversationId: args.conversationId,
1922
- conversationStore: args.conversationStore,
1923
- nowMs,
1924
- state: args.state
1925
- });
1926
- let result = await stop();
1927
- if (result.status === "no_work" && await getAuthPausedConversationTurnId(args.conversationId)) {
1928
- const conversation = await getConversation({
1929
- conversationId: args.conversationId,
1930
- state: args.state
1931
- });
1932
- await requestConversationWork({
1933
- conversationId: args.conversationId,
1934
- conversationStore: args.conversationStore,
1935
- destination: conversation?.destination,
1936
- nowMs,
1937
- state: args.state
1938
- });
1939
- result = await stop();
1940
- }
1941
- if (result.status === "requested") await ensureConversationWake({
1942
- conversationId: args.conversationId,
1943
- conversationStore: args.conversationStore,
1944
- idempotencyKey: `conversation-stop:${args.conversationId}:${result.runId}`,
1945
- nowMs,
1946
- queue: args.queue,
1947
- replaceExistingWake: true,
1948
- state: args.state
1949
- });
1950
- return result;
1951
- }
1952
- //#endregion
1953
1926
  //#region src/chat/ingress/bot-mention.ts
1954
1927
  /**
1955
1928
  * Detect Slack bot @mentions that should activate Junior.
@@ -2028,6 +2001,120 @@ function textMentionsBot(text, botUserId) {
2028
2001
  return new RegExp(`<@${id}(?:\\|[^>]+)?>`).test(outside);
2029
2002
  }
2030
2003
  //#endregion
2004
+ //#region src/chat/event-automations/ingest.ts
2005
+ /**
2006
+ * Owns event matching and durable event-automation dispatch.
2007
+ *
2008
+ * Each matching automation is independently idempotent. Aggregate failures propagate
2009
+ * so the provider can retry the original delivery.
2010
+ */
2011
+ /** Bind provider delivery identity to one automation's durable dispatch. */
2012
+ function eventAutomationDispatchKey(taskId, namespace, eventKey) {
2013
+ return `event-automation:${createHash("sha256").update(`${taskId}\0${namespace}\0${eventKey}`).digest("hex").slice(0, 32)}`;
2014
+ }
2015
+ function oneLine(value) {
2016
+ return value.replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").trim().slice(0, 512);
2017
+ }
2018
+ /** Compact destination-visible context for event-automation replies. */
2019
+ function replyAttribution(task) {
2020
+ const detail = oneLine(task.trigger.label).slice(0, 128).trim();
2021
+ return detail ? {
2022
+ label: "Event automation",
2023
+ detail
2024
+ } : { label: "Event automation" };
2025
+ }
2026
+ /** Render plain agent input for one matching event automation. */
2027
+ function eventInput(task, event, outcomes) {
2028
+ const guidance = eventGuidance(getEventCatalog(), event.namespace, task.trigger.resourceType, event.eventType);
2029
+ return renderTaskInput({
2030
+ about: task.trigger.label,
2031
+ creator: slackMention(task.createdBy.slackUserId),
2032
+ instructions: task.task.text,
2033
+ outcomes,
2034
+ guidance,
2035
+ trustedSummary: event.trustedSummary,
2036
+ trustedSummaryMaxLength: EVENT_SUMMARY_MAX_LENGTH,
2037
+ verifiedDetails: event.data,
2038
+ externalText: event.untrustedText,
2039
+ externalTextMaxLength: EVENT_TEXT_MAX_LENGTH
2040
+ });
2041
+ }
2042
+ /** Match a normalized event and dispatch every matching automation. */
2043
+ async function ingestEventAutomations(input, options) {
2044
+ const event = eventSchema.parse(input);
2045
+ const db = getDb();
2046
+ const nowMs = options.nowMs ?? Date.now();
2047
+ const tasks = await findMatchingEventAutomations(db, event, options.teamId);
2048
+ let dispatched = 0;
2049
+ const errors = [];
2050
+ for (const task of tasks) try {
2051
+ const idempotencyKey = eventAutomationDispatchKey(task.id, event.namespace, event.eventKey);
2052
+ if (await admitEventAutomationRun({
2053
+ automationId: task.id,
2054
+ nowMs,
2055
+ runKey: idempotencyKey
2056
+ }) === "limited") {
2057
+ const reason = eventAutomationRunLimitReason();
2058
+ logWarn("event_automation.run_limit.exceeded", {
2059
+ "app.task.id": task.id,
2060
+ "app.task.type": "event"
2061
+ });
2062
+ if (await blockEventAutomation(db, task.id, reason)) {
2063
+ captureMessage("Event automation blocked by run limit", {
2064
+ level: "warning",
2065
+ fingerprint: ["event_automation.run_limit.blocked"],
2066
+ tags: {
2067
+ "app.event.namespace": event.namespace,
2068
+ "app.task.type": "event"
2069
+ },
2070
+ extra: {
2071
+ "app.event.event_type": event.eventType,
2072
+ "app.event_automation.max_runs_per_hour": botConfig.maxEventAutomationRunsPerHour,
2073
+ "app.event_automation.resource_type": task.trigger.resourceType,
2074
+ "app.task.id": task.id
2075
+ }
2076
+ });
2077
+ await notifyAutomationBlocked({
2078
+ automationId: task.id,
2079
+ kind: "event",
2080
+ reason
2081
+ });
2082
+ }
2083
+ continue;
2084
+ }
2085
+ const replyThreadTs = slackChannelMessageReplyThreadTs(event);
2086
+ const destination = replyThreadTs ? {
2087
+ ...task.destination,
2088
+ threadTs: replyThreadTs
2089
+ } : task.destination;
2090
+ const outcomes = effectiveTaskOutcomes(task.outcomes, destination);
2091
+ const credentialSubject = task.credentialMode === "creator" ? {
2092
+ type: "user",
2093
+ userId: task.createdBy.slackUserId,
2094
+ allowedWhen: "event-automation",
2095
+ taskId: task.id
2096
+ } : void 0;
2097
+ if ((await dispatchEventAutomation({
2098
+ conversationWorkQueue: options.queue,
2099
+ nowMs,
2100
+ options: {
2101
+ idempotencyKey,
2102
+ ...credentialSubject ? { credentialSubject } : void 0,
2103
+ destination,
2104
+ destinationVisibility: task.destinationVisibility,
2105
+ input: eventInput(task, event, outcomes),
2106
+ metadata: { eventAutomationId: task.id },
2107
+ replyAttribution: replyAttribution(task),
2108
+ outcomes
2109
+ }
2110
+ })).status === "created") dispatched += 1;
2111
+ } catch (error) {
2112
+ errors.push(error);
2113
+ }
2114
+ if (errors.length > 0) throw new AggregateError(errors, "Failed to dispatch one or more event automations");
2115
+ return { dispatched };
2116
+ }
2117
+ //#endregion
2031
2118
  //#region src/chat/ingress/workspace-membership.ts
2032
2119
  const MEMBER_TTL_MS = 3e5;
2033
2120
  const NON_MEMBER_TTL_MS = 3e4;
@@ -2492,12 +2579,13 @@ const SLACK_SESSION_STOP_ACK = "Stopped.";
2492
2579
  */
2493
2580
  async function handleSlackSessionStop(args) {
2494
2581
  const canonicalThreadId = `slack:${args.channelId}:${args.threadTs}`;
2582
+ const conversationId = await resolveSlackConversationId({
2583
+ canonicalThreadId,
2584
+ conversationStore: args.conversationStore,
2585
+ installation: args.installation
2586
+ });
2495
2587
  const stopped = await stopConversationTurn({
2496
- conversationId: await resolveSlackConversationId({
2497
- canonicalThreadId,
2498
- conversationStore: args.conversationStore,
2499
- installation: args.installation
2500
- }),
2588
+ conversationId,
2501
2589
  conversationStore: args.conversationStore,
2502
2590
  queue: args.queue,
2503
2591
  state: args.state
@@ -2531,7 +2619,26 @@ async function routeParsedMessage(args) {
2531
2619
  const isDirectMessage = isDmEvent(args.event);
2532
2620
  const isSubscribed = !isDirectMessage && !isMention && await args.state.isSubscribed(canonicalThreadId);
2533
2621
  const route = isDirectMessage || isMention ? "mention" : isSubscribed ? "subscribed" : void 0;
2534
- if (!route) return;
2622
+ if (!route) {
2623
+ const channelMessage = args.event.type === "message" && args.event.channel && args.event.ts ? slackChannelMessageEvent({
2624
+ botId: args.event.bot_id,
2625
+ channelId: args.event.channel,
2626
+ subtype: args.event.subtype,
2627
+ text: args.event.text,
2628
+ threadTs: args.event.thread_ts,
2629
+ ts: args.event.ts,
2630
+ userId: message.author.userId
2631
+ }) : void 0;
2632
+ const teamId = args.installation.teamId;
2633
+ if (channelMessage && teamId) await ingestEventAutomations({
2634
+ ...channelMessage,
2635
+ namespace: SLACK_EVENT_NAMESPACE
2636
+ }, {
2637
+ queue: args.queue,
2638
+ teamId
2639
+ });
2640
+ return;
2641
+ }
2535
2642
  const stopDecision = getThreadStopDecision({
2536
2643
  botUserName: botConfig.userName,
2537
2644
  rawText: args.event.text ?? "",
@@ -3012,81 +3119,6 @@ async function publicArtifactGET(args) {
3012
3119
  }
3013
3120
  }
3014
3121
  //#endregion
3015
- //#region src/chat/event-automations/ingest.ts
3016
- /**
3017
- * Owns event matching and durable event-automation dispatch.
3018
- *
3019
- * Each matching automation is independently idempotent. Aggregate failures propagate
3020
- * so the provider can retry the original delivery.
3021
- */
3022
- /** Bind provider delivery identity to one automation's durable dispatch. */
3023
- function eventAutomationDispatchKey(taskId, namespace, eventKey) {
3024
- return `event-automation:${createHash("sha256").update(`${taskId}\0${namespace}\0${eventKey}`).digest("hex").slice(0, 32)}`;
3025
- }
3026
- function oneLine(value) {
3027
- return value.replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").trim().slice(0, 512);
3028
- }
3029
- /** Compact destination-visible context for event-automation replies. */
3030
- function replyAttribution(task) {
3031
- const detail = oneLine(task.trigger.label).slice(0, 128).trim();
3032
- return detail ? {
3033
- label: "Event automation",
3034
- detail
3035
- } : { label: "Event automation" };
3036
- }
3037
- /** Render plain agent input for one matching event automation. */
3038
- function eventInput(task, event) {
3039
- const guidance = eventGuidance(getEventCatalog(), event.namespace, task.trigger.resourceType, event.eventType);
3040
- return renderTaskInput({
3041
- about: task.trigger.label,
3042
- creator: slackMention(task.createdBy.slackUserId),
3043
- instructions: task.task.text,
3044
- outcomes: effectiveTaskOutcomes(task.outcomes, task.destination),
3045
- guidance,
3046
- trustedSummary: event.trustedSummary,
3047
- trustedSummaryMaxLength: EVENT_SUMMARY_MAX_LENGTH,
3048
- verifiedDetails: event.data,
3049
- externalText: event.untrustedText,
3050
- externalTextMaxLength: EVENT_TEXT_MAX_LENGTH
3051
- });
3052
- }
3053
- /** Match a normalized event and dispatch every matching automation. */
3054
- async function ingestEventAutomations(input, options) {
3055
- const event = eventSchema.parse(input);
3056
- const db = getDb();
3057
- const nowMs = options.nowMs ?? Date.now();
3058
- const tasks = await findMatchingEventAutomations(db, event, options.teamId);
3059
- let dispatched = 0;
3060
- const errors = [];
3061
- for (const task of tasks) try {
3062
- const idempotencyKey = eventAutomationDispatchKey(task.id, event.namespace, event.eventKey);
3063
- const credentialSubject = task.credentialMode === "creator" ? {
3064
- type: "user",
3065
- userId: task.createdBy.slackUserId,
3066
- allowedWhen: "event-automation",
3067
- taskId: task.id
3068
- } : void 0;
3069
- if ((await dispatchEventAutomation({
3070
- conversationWorkQueue: options.queue,
3071
- nowMs,
3072
- options: {
3073
- idempotencyKey,
3074
- ...credentialSubject ? { credentialSubject } : void 0,
3075
- destination: task.destination,
3076
- destinationVisibility: task.destinationVisibility,
3077
- input: eventInput(task, event),
3078
- metadata: { eventAutomationId: task.id },
3079
- replyAttribution: replyAttribution(task),
3080
- outcomes: effectiveTaskOutcomes(task.outcomes, task.destination)
3081
- }
3082
- })).status === "created") dispatched += 1;
3083
- } catch (error) {
3084
- errors.push(error);
3085
- }
3086
- if (errors.length > 0) throw new AggregateError(errors, "Failed to dispatch one or more event automations");
3087
- return { dispatched };
3088
- }
3089
- //#endregion
3090
3122
  //#region src/chat/events/workspace.ts
3091
3123
  /**
3092
3124
  * Resolve the single-bot Slack team id for event-automation indexing.
@@ -5241,6 +5273,7 @@ async function createApp(options) {
5241
5273
  const attachmentStorage = createVercelAttachmentStorage();
5242
5274
  const agentRunner = createAgentRunner(executeAgentRun, {
5243
5275
  attachmentStorage,
5276
+ bindMessageAgent: (request) => bindMessageAgent(request, { queue: conversationWorkQueue }),
5244
5277
  bindSpawnAgent: (request) => bindSpawnAgent(request, { queue: conversationWorkQueue }),
5245
5278
  tracePropagation
5246
5279
  });
@@ -1,7 +1,7 @@
1
- import { r as completeObject } from "./client-BVaGEb1-.js";
1
+ import { r as completeObject } from "./client--xtsAxKP.js";
2
2
  import { r as defaultModelId } from "./model-profile-BwU8mqwD.js";
3
- import { B as parseBriefInput, I as briefCodeChangeSchema, d as conversationDetailReportSchema, p as conversationEventPageSchema } from "./conversation-BxvgH64Q.js";
4
- import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-CX36ZlbV.js";
3
+ import { L as briefCodeChangeSchema, V as parseBriefInput, d as conversationDetailReportSchema, p as conversationEventPageSchema } from "./conversation-CvBG57Io.js";
4
+ import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-C9Q9cjD3.js";
5
5
  import { CLI_USAGE } from "./cli/run.js";
6
6
  import path from "node:path";
7
7
  import { z } from "zod";
@@ -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-q9xXVN_5.js").then((n) => n.r);
272
+ const { botConfig } = await import("./config-BK53Ip5C.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-DvzzL8-v.js";
2
+ import { t as createPluginCatalogRuntime } from "./registry-C2rSEio1.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-DtEtbaOb.js";
1
+ import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-DSKpHjHW.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-Cj_rSeWd.js").then((n) => n.t),
104
- import("../catalog-runtime-CpxhLwZG.js").then((n) => n.t),
105
- import("../validation-DcsBjzdi.js").then((n) => n.r),
106
- import("../viewer-BBnCMR1g.js").then((n) => n.s)
103
+ import("../agent-hooks-DpklSWZg.js").then((n) => n.t),
104
+ import("../catalog-runtime-CTaQXYqS.js").then((n) => n.t),
105
+ import("../validation-Dg0Ihxzo.js").then((n) => n.r),
106
+ import("../viewer-D5hbx6TE.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,16 +155,17 @@ 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-Cj_rSeWd.js").then((n) => n.m);
158
+ const { setBriefsConfig } = await import("../agent-hooks-DpklSWZg.js").then((n) => n.m);
159
159
  setBriefsConfig({ enabled: true });
160
- const { runLocalAgentTurn } = await import("../runner-Y6A6pww4.js");
161
- const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-_MfOtSxS.js");
160
+ const { runLocalAgentTurn } = await import("../runner-CNh5eMWx.js");
161
+ const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-BrUo6w1e.js");
162
162
  const { createLocalOAuthState } = await import("../oauth-relay-CdCnu80W.js").then((n) => n.t);
163
- const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-D7AOkuoe.js");
164
- const { bindSpawnAgent } = await import("../spawn-DYg7jhhR.js").then((n) => n.n);
165
- const { createAgentInvocationWorker, routeAgentInvocationWork } = await import("../work-fje9VXgQ.js").then((n) => n.a);
163
+ const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-BnDEKu8d.js");
164
+ const { bindSpawnAgent } = await import("../spawn-C3efZSx3.js").then((n) => n.n);
165
+ const { bindMessageAgent } = await import("../message-BSN-Ma5f.js").then((n) => n.n);
166
+ const { createAgentInvocationWorker, routeAgentInvocationWork } = await import("../work-rm2X7jj4.js").then((n) => n.a);
166
167
  const { createLocalConversationWork } = await import("../conversation-work-C6y3T5Hx.js");
167
- const { processConversationWork } = await import("../worker-Byd2Et9r.js").then((n) => n.n);
168
+ const { processConversationWork } = await import("../worker-bnGsAOP3.js").then((n) => n.n);
168
169
  let agentRunner;
169
170
  const localConversationWork = createLocalConversationWork(async (message) => {
170
171
  if (!agentRunner) throw new Error("Local agent runner is not ready");
@@ -179,7 +180,10 @@ async function prepareLocalChatRun(io, pluginSet) {
179
180
  run
180
181
  });
181
182
  });
182
- agentRunner = createAgentRunner(executeAgentRun, { bindSpawnAgent: (request) => bindSpawnAgent(request, { queue: localConversationWork.queue }) });
183
+ agentRunner = createAgentRunner(executeAgentRun, {
184
+ bindMessageAgent: (request) => request.source.kind === "agent_invocation" ? void 0 : bindMessageAgent(request, { queue: localConversationWork.queue }),
185
+ bindSpawnAgent: (request) => bindSpawnAgent(request, { queue: localConversationWork.queue })
186
+ });
183
187
  const oauthCallback = await startLocalOAuthCallbackServer();
184
188
  const deps = {
185
189
  agentRunner,
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-z7_w-KN_.js";
2
- import { _ as parsePluginManifest, g as parseInlinePluginManifest } from "../registry-DvzzL8-v.js";
3
- import { i as parseSkillFile } from "../skills-DFduSvuO.js";
1
+ import { D as JUNIOR_HEARTBEAT_ROUTE, M as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, T as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-DVtMYOdD.js";
2
+ import { _ as parsePluginManifest, g as parseInlinePluginManifest } from "../registry-C2rSEio1.js";
3
+ import { i as parseSkillFile } from "../skills-C6zJbudq.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-CF9lQg0M.js")).runAdmin(argv);
28
+ return await (await import("../admin-Bh-MYw-j.js")).runAdmin(argv);
29
29
  }
30
30
  async function runBriefs(argv) {
31
- return await (await import("../briefs-BMzTiGJO.js")).runBriefs(argv);
31
+ return await (await import("../briefs-cZ5vWqP_.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-BBnCMR1g.js";
2
- import { n as pluginCatalogRuntime } from "../catalog-runtime-CpxhLwZG.js";
3
- import { d as setPlugins, f as validatePlugins, lt as createPluginLogger } from "../agent-hooks-Cj_rSeWd.js";
4
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-DcsBjzdi.js";
1
+ import { d as getDb } from "../viewer-D5hbx6TE.js";
2
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-CTaQXYqS.js";
3
+ import { d as setPlugins, f as validatePlugins, lt as createPluginLogger } from "../agent-hooks-DpklSWZg.js";
4
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-Dg0Ihxzo.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-CpxhLwZG.js";
2
- import { S as disconnectStateAdapter, t as create } from "../profile-yeKVNECl.js";
3
- import { r as resolve } from "../resolve-4u5gEU04.js";
1
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-CTaQXYqS.js";
2
+ import { S as disconnectStateAdapter, t as create } from "../profile-BevMNSlr.js";
3
+ import { r as resolve } from "../resolve-qPhrznTf.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-q9xXVN_5.js";
2
- import { t as createJuniorSqlExecutor } from "../executor-DA7eHhmC.js";
3
- import { t as createPluginCatalogRuntime } from "../registry-DvzzL8-v.js";
1
+ import { i as getChatConfig } from "../config-BK53Ip5C.js";
2
+ import { t as createJuniorSqlExecutor } from "../executor-bmmuRY-w.js";
3
+ import { t as createPluginCatalogRuntime } from "../registry-C2rSEio1.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-z7_w-KN_.js";
2
- import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-Dyh_63Ee.js";
1
+ import { d as logException, g as serializeGenAiAttribute, i as extractGenAiUsageAttributes, m as normalizeGenAiFinishReason, p as logWarn, w as withSpan } from "./logging-DVtMYOdD.js";
2
+ import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-BDBFw6Ws.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-BVaGEb1-.js";
3
- import { p as logWarn } from "./logging-z7_w-KN_.js";
2
+ import { S as toOptionalTrimmed, o as resolveGatewayModel } from "./client--xtsAxKP.js";
3
+ import { p as logWarn } from "./logging-DVtMYOdD.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]))?$/;
@@ -54,6 +54,13 @@ const MAX_TOOL_CALLS_PER_TURN = 250;
54
54
  * headroom to avoid pausing on legitimate longer-running automation.
55
55
  */
56
56
  const MAX_CONSECUTIVE_AUTOMATED_TURNS = 25;
57
+ /**
58
+ * Max runs one Event automation can start in a rolling hour. Each run is a
59
+ * full agent turn, and Event automations skip the consecutive automated-turn
60
+ * limit. Kept low so a broad trigger, such as every message in a channel,
61
+ * blocks quickly instead of starting a turn for each Event.
62
+ */
63
+ const MAX_EVENT_AUTOMATION_RUNS_PER_HOUR = 10;
57
64
  const DEFAULT_FUNCTION_MAX_DURATION_SECONDS = 300;
58
65
  const DEFAULT_SLACK_SLASH_COMMAND = "/jr";
59
66
  const DEFAULT_PROCESSING_REACTION_EMOJI = "eyes";
@@ -257,6 +264,7 @@ function readBotConfig(env, functionMaxDurationSeconds) {
257
264
  maxSlicesPerTurn: MAX_SLICES_PER_TURN,
258
265
  maxToolCallsPerTurn: MAX_TOOL_CALLS_PER_TURN,
259
266
  maxConsecutiveAutomatedTurns: MAX_CONSECUTIVE_AUTOMATED_TURNS,
267
+ maxEventAutomationRunsPerHour: MAX_EVENT_AUTOMATION_RUNS_PER_HOUR,
260
268
  turnTimeoutMs: parseAgentTurnTimeoutMs(env.AGENT_TURN_TIMEOUT_MS, maxTurnTimeoutMs),
261
269
  webSearchModelId: validateGatewayModelId(env.AI_WEB_SEARCH_MODEL) ?? DEFAULT_WEB_SEARCH_MODEL_ID
262
270
  };
@@ -370,6 +378,7 @@ function setRuntimeLimits(limits) {
370
378
  bot.maxAgentDepth = limits.maxAgentDepth;
371
379
  }
372
380
  if (limits?.maxConsecutiveAutomatedTurns !== void 0) bot.maxConsecutiveAutomatedTurns = requirePositiveLimit("maxConsecutiveAutomatedTurns", limits.maxConsecutiveAutomatedTurns);
381
+ if (limits?.maxEventAutomationRunsPerHour !== void 0) bot.maxEventAutomationRunsPerHour = requirePositiveLimit("maxEventAutomationRunsPerHour", limits.maxEventAutomationRunsPerHour);
373
382
  if (limits?.maxSlicesPerTurn !== void 0) bot.maxSlicesPerTurn = requirePositiveLimit("maxSlicesPerTurn", limits.maxSlicesPerTurn);
374
383
  if (limits?.maxToolCallsPerTurn !== void 0) bot.maxToolCallsPerTurn = requirePositiveLimit("maxToolCallsPerTurn", limits.maxToolCallsPerTurn);
375
384
  if (limits?.turnTimeoutMs !== void 0) bot.turnTimeoutMs = Math.min(requirePositiveLimit("turnTimeoutMs", limits.turnTimeoutMs), resolveMaxTurnTimeoutMs(chatConfig.functionMaxDurationSeconds));