@sentry/junior 0.244.0 → 0.245.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 (57) hide show
  1. package/dist/{admin-CF9lQg0M.js → admin-BEbNsG87.js} +1 -1
  2. package/dist/{agent-hooks-Cj_rSeWd.js → agent-hooks-Caa0Qh_Q.js} +10 -10
  3. package/dist/{agent-runner-DtEtbaOb.js → agent-runner-BEuPFbbv.js} +170 -52
  4. package/dist/api/schema.d.ts +64 -3
  5. package/dist/api/schema.js +2 -2
  6. package/dist/api.js +314 -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 +171 -104
  10. package/dist/{briefs-BMzTiGJO.js → briefs-DFAh_jTW.js} +4 -4
  11. package/dist/{catalog-runtime-CpxhLwZG.js → catalog-runtime-wmq_fqff.js} +1 -1
  12. package/dist/cli/chat.js +12 -12
  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-Bn9SRFCi.js} +2 -2
  19. package/dist/{config-q9xXVN_5.js → config-_XAINZMN.js} +11 -2
  20. package/dist/{conversation-BxvgH64Q.js → conversation-CvBG57Io.js} +11 -1
  21. package/dist/{conversation-privacy-Dyh_63Ee.js → conversation-privacy-BN5SGxsF.js} +1 -1
  22. package/dist/{credential-sync-Bsn-6m16.js → credential-sync-BvaUm6HQ.js} +14 -14
  23. package/dist/{executor-DA7eHhmC.js → executor-CFIqoCNJ.js} +2 -2
  24. package/dist/{images-CvMreau5.js → images-Ci43I3ek.js} +3 -3
  25. package/dist/instrumentation.js +2 -2
  26. package/dist/{job-queue-mVyF9jgv.js → job-queue-CGicV7x6.js} +1 -1
  27. package/dist/{logging-z7_w-KN_.js → logging-Bs3dV81s.js} +1 -1
  28. package/dist/nitro.d.ts +1 -1
  29. package/dist/nitro.js +3 -3
  30. package/dist/{oauth-authorization-Db1yGVvG.js → oauth-authorization-COzWmMjO.js} +1 -1
  31. package/dist/{oauth-callback-server-_MfOtSxS.js → oauth-callback-server-17c9_39v.js} +2 -2
  32. package/dist/{pending-auth-OndKPW4M.js → pending-auth-Bnhg7Q9k.js} +2 -2
  33. package/dist/{profile-yeKVNECl.js → profile-BA471c-l.js} +4 -4
  34. package/dist/{prompt-CX36ZlbV.js → prompt-C9Q9cjD3.js} +1 -1
  35. package/dist/{registry-DvzzL8-v.js → registry-BYNOFO6e.js} +1 -1
  36. package/dist/{resolve-4u5gEU04.js → resolve-rpz8No2i.js} +2 -2
  37. package/dist/{runner-Y6A6pww4.js → runner-C8DRk9X6.js} +10 -10
  38. package/dist/{sandbox-egress-signals-D7AOkuoe.js → sandbox-egress-signals-B8hurjFt.js} +1 -1
  39. package/dist/{schema-Dyyi9oRc.js → schema-WRgR9EL6.js} +7 -3
  40. package/dist/{skills-DFduSvuO.js → skills-C4yrD2NR.js} +2 -2
  41. package/dist/{spawn-DYg7jhhR.js → spawn-CdAaTXrY.js} +2 -2
  42. package/dist/{task-queue-BQ0vnumm.js → task-queue-BBxHzlIB.js} +3 -3
  43. package/dist/{task-runner-D4jvUpFV.js → task-runner-BqFapTjs.js} +10 -10
  44. package/dist/{tasks-DBZAgTx7.js → tasks-Ddd7OAkp.js} +82 -11
  45. package/dist/{thread-state-hj70P2Cp.js → thread-state-DqErwbA8.js} +6 -6
  46. package/dist/{turn-failure-response-S2pwtR8b.js → turn-failure-response-DtL1-fOl.js} +9 -9
  47. package/dist/{turn-lifecycle-CNFOMAJq.js → turn-lifecycle-B5pzyD6W.js} +1 -1
  48. package/dist/{turn-session-routing-1eTgv6ns.js → turn-session-routing-D6pTU5uF.js} +1 -1
  49. package/dist/{validation-DcsBjzdi.js → validation-BAzlyNIc.js} +1 -1
  50. package/dist/{version-DVCHJYcY.js → version-CiXDH3oe.js} +1 -1
  51. package/dist/version.js +1 -1
  52. package/dist/{viewer-BBnCMR1g.js → viewer-wCn8xneI.js} +3 -3
  53. package/dist/{web-authorization-CTltRLsB.js → web-authorization-d5MtGpfG.js} +6 -6
  54. package/dist/{web-input-CIsRGF07.js → web-input-BZTiCtvP.js} +69 -46
  55. package/dist/{work-fje9VXgQ.js → work-4QPqTd5_.js} +6 -6
  56. package/dist/{worker-Byd2Et9r.js → worker-mc62tybz.js} +5 -5
  57. package/package.json +5 -5
@@ -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,33 @@
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 { $t as isInvalidConversationRecordError, B as effectiveTaskOutcomes, Dn as setConfigDefaults, E as requestAttachmentDeletion, En as getConfigDefaults, F as logScheduledAutomationRunSkipped, Ft as ensureConversationWake, Gt as requestConversationWork, I as scheduledAutomationRunAttributes, It as getConversation, Lt as getConversationWorkState, O as parseSlackThreadId, Rt as hasRunnableConversationWork, U as recordSubagentEnded, Ut as removeActiveConversation, Yt as CONVERSATION_WORK_STALE_ENQUEUE_MS, Zt as hasRunnableConversationWork$1, _t as SLACK_EVENT_NAMESPACE, an as shouldPropagateSandboxEgressTrace, b as unpublishedArtifactHeaders, c as deleteMcpAuthSessionsForUserProvider, cn as consumeSandboxEgressAuthRequiredSignal, dt as processWorkspaceSnapshotJob, en as renderTaskInput, fn as formatProviderLabel, ft as ingestEvent, gn as createUserTokenStore, gt as getEventCatalog, hn as startOAuthFlow, i as executeCredentialedEgressRequest, in as normalizeSandboxEgressTracePropagationDomains, it as listPendingAgentInvocationResults, kt as clearExpiredConversationLease, l as deleteMcpServerSessionId, ln as consumeSandboxEgressPermissionDeniedSignal, n as executeAgentRun, on as SANDBOX_EGRESS_PROXY_PATH, qt as stopConversationWork, rn as resolveSandboxEgressProviderForHost, rt as listPendingAgentInvocationMailboxAppends, sn as clearSandboxEgressSignals, t as createAgentRunner, u as deleteMcpStoredOAuthCredentials, un as parseSandboxEgressCredentialToken, v as publicArtifactHeaders, vt as slackChannelMessageEvent, w as collectAttachmentGarbage, wt as appendAndEnqueueInboundMessage, x as lookupSlackUserProfile, xt as eventGuidance, y as readPublicArtifact, yt as slackChannelMessageReplyThreadTs, zt as listActiveConversationIds } from "./agent-runner-BEuPFbbv.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-Bs3dV81s.js";
3
+ import { n as captureMessage, r as continueTrace } from "./sentry-CgWZM_kV.js";
4
+ import { t as JUNIOR_VERSION } from "./version-CiXDH3oe.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-_XAINZMN.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-wCn8xneI.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-CFIqoCNJ.js";
10
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-wmq_fqff.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-Ddd7OAkp.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-Caa0Qh_Q.js";
13
+ import { H as annotationCard } from "./conversation-CvBG57Io.js";
14
+ import { O as withLock$1, w as getStateAdapter } from "./profile-BA471c-l.js";
15
+ import { c as getThreadStopDecision } from "./pending-auth-Bnhg7Q9k.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-rpz8No2i.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-CGicV7x6.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-BAzlyNIc.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 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-BZTiCtvP.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-BqFapTjs.js";
25
+ import { r as enqueueAgentInvocation } from "./work-4QPqTd5_.js";
26
+ import { s as coerceThreadConversationState } from "./thread-state-DqErwbA8.js";
27
+ import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-BvaUm6HQ.js";
28
+ import { a as registerVercelPluginTaskDevConsumer, n as createVercelPluginTaskCallback, s as queueCallback } from "./task-queue-BBxHzlIB.js";
29
+ import { t as processConversationWork } from "./worker-mc62tybz.js";
30
+ import { t as bindSpawnAgent } from "./spawn-CdAaTXrY.js";
31
31
  import { createRequire } from "node:module";
32
32
  import { Hono } from "hono";
33
33
  import { z } from "zod";
@@ -1439,12 +1439,20 @@ async function getJwks(issuer) {
1439
1439
  });
1440
1440
  return jwks;
1441
1441
  }
1442
- /** Verify Vercel signed this Sandbox firewall proxy request for the active VM session. */
1443
- async function verifyVercelSandboxOidcToken(token) {
1442
+ /**
1443
+ * Verify Vercel signed this Sandbox firewall proxy request for the active VM session.
1444
+ *
1445
+ * `currentDate` is the time for the `exp` and `nbf` checks. It defaults to
1446
+ * now. Evals pass the real time because they replace `Date`.
1447
+ */
1448
+ async function verifyVercelSandboxOidcToken(token, options = {}) {
1444
1449
  const unverified = decodeJwt(token);
1445
1450
  if (typeof unverified.iss !== "string") throw new Error("Vercel OIDC token did not include an issuer");
1446
1451
  const jwks = await getJwks(unverified.iss);
1447
- return (await jwtVerify(token, jwks, { issuer: unverified.iss })).payload;
1452
+ return (await jwtVerify(token, jwks, {
1453
+ issuer: unverified.iss,
1454
+ ...options.currentDate ? { currentDate: options.currentDate } : void 0
1455
+ })).payload;
1448
1456
  }
1449
1457
  //#endregion
1450
1458
  //#region src/chat/sandbox/egress/proxy.ts
@@ -1693,7 +1701,8 @@ async function proxySandboxEgressRequest(request, deps = {}) {
1693
1701
  async function ALL(request, options = {}) {
1694
1702
  return await proxySandboxEgressRequest(request, {
1695
1703
  interceptHttp: options.interceptHttp,
1696
- tracePropagation: options.tracePropagation
1704
+ tracePropagation: options.tracePropagation,
1705
+ verifyOidc: options.verifyOidc
1697
1706
  });
1698
1707
  }
1699
1708
  /** Return whether a request should be routed through sandbox egress proxying. */
@@ -2028,6 +2037,120 @@ function textMentionsBot(text, botUserId) {
2028
2037
  return new RegExp(`<@${id}(?:\\|[^>]+)?>`).test(outside);
2029
2038
  }
2030
2039
  //#endregion
2040
+ //#region src/chat/event-automations/ingest.ts
2041
+ /**
2042
+ * Owns event matching and durable event-automation dispatch.
2043
+ *
2044
+ * Each matching automation is independently idempotent. Aggregate failures propagate
2045
+ * so the provider can retry the original delivery.
2046
+ */
2047
+ /** Bind provider delivery identity to one automation's durable dispatch. */
2048
+ function eventAutomationDispatchKey(taskId, namespace, eventKey) {
2049
+ return `event-automation:${createHash("sha256").update(`${taskId}\0${namespace}\0${eventKey}`).digest("hex").slice(0, 32)}`;
2050
+ }
2051
+ function oneLine(value) {
2052
+ return value.replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").trim().slice(0, 512);
2053
+ }
2054
+ /** Compact destination-visible context for event-automation replies. */
2055
+ function replyAttribution(task) {
2056
+ const detail = oneLine(task.trigger.label).slice(0, 128).trim();
2057
+ return detail ? {
2058
+ label: "Event automation",
2059
+ detail
2060
+ } : { label: "Event automation" };
2061
+ }
2062
+ /** Render plain agent input for one matching event automation. */
2063
+ function eventInput(task, event, outcomes) {
2064
+ const guidance = eventGuidance(getEventCatalog(), event.namespace, task.trigger.resourceType, event.eventType);
2065
+ return renderTaskInput({
2066
+ about: task.trigger.label,
2067
+ creator: slackMention(task.createdBy.slackUserId),
2068
+ instructions: task.task.text,
2069
+ outcomes,
2070
+ guidance,
2071
+ trustedSummary: event.trustedSummary,
2072
+ trustedSummaryMaxLength: EVENT_SUMMARY_MAX_LENGTH,
2073
+ verifiedDetails: event.data,
2074
+ externalText: event.untrustedText,
2075
+ externalTextMaxLength: EVENT_TEXT_MAX_LENGTH
2076
+ });
2077
+ }
2078
+ /** Match a normalized event and dispatch every matching automation. */
2079
+ async function ingestEventAutomations(input, options) {
2080
+ const event = eventSchema.parse(input);
2081
+ const db = getDb();
2082
+ const nowMs = options.nowMs ?? Date.now();
2083
+ const tasks = await findMatchingEventAutomations(db, event, options.teamId);
2084
+ let dispatched = 0;
2085
+ const errors = [];
2086
+ for (const task of tasks) try {
2087
+ const idempotencyKey = eventAutomationDispatchKey(task.id, event.namespace, event.eventKey);
2088
+ if (await admitEventAutomationRun({
2089
+ automationId: task.id,
2090
+ nowMs,
2091
+ runKey: idempotencyKey
2092
+ }) === "limited") {
2093
+ const reason = eventAutomationRunLimitReason();
2094
+ logWarn("event_automation.run_limit.exceeded", {
2095
+ "app.task.id": task.id,
2096
+ "app.task.type": "event"
2097
+ });
2098
+ if (await blockEventAutomation(db, task.id, reason)) {
2099
+ captureMessage("Event automation blocked by run limit", {
2100
+ level: "warning",
2101
+ fingerprint: ["event_automation.run_limit.blocked"],
2102
+ tags: {
2103
+ "app.event.namespace": event.namespace,
2104
+ "app.task.type": "event"
2105
+ },
2106
+ extra: {
2107
+ "app.event.event_type": event.eventType,
2108
+ "app.event_automation.max_runs_per_hour": botConfig.maxEventAutomationRunsPerHour,
2109
+ "app.event_automation.resource_type": task.trigger.resourceType,
2110
+ "app.task.id": task.id
2111
+ }
2112
+ });
2113
+ await notifyAutomationBlocked({
2114
+ automationId: task.id,
2115
+ kind: "event",
2116
+ reason
2117
+ });
2118
+ }
2119
+ continue;
2120
+ }
2121
+ const replyThreadTs = slackChannelMessageReplyThreadTs(event);
2122
+ const destination = replyThreadTs ? {
2123
+ ...task.destination,
2124
+ threadTs: replyThreadTs
2125
+ } : task.destination;
2126
+ const outcomes = effectiveTaskOutcomes(task.outcomes, destination);
2127
+ const credentialSubject = task.credentialMode === "creator" ? {
2128
+ type: "user",
2129
+ userId: task.createdBy.slackUserId,
2130
+ allowedWhen: "event-automation",
2131
+ taskId: task.id
2132
+ } : void 0;
2133
+ if ((await dispatchEventAutomation({
2134
+ conversationWorkQueue: options.queue,
2135
+ nowMs,
2136
+ options: {
2137
+ idempotencyKey,
2138
+ ...credentialSubject ? { credentialSubject } : void 0,
2139
+ destination,
2140
+ destinationVisibility: task.destinationVisibility,
2141
+ input: eventInput(task, event, outcomes),
2142
+ metadata: { eventAutomationId: task.id },
2143
+ replyAttribution: replyAttribution(task),
2144
+ outcomes
2145
+ }
2146
+ })).status === "created") dispatched += 1;
2147
+ } catch (error) {
2148
+ errors.push(error);
2149
+ }
2150
+ if (errors.length > 0) throw new AggregateError(errors, "Failed to dispatch one or more event automations");
2151
+ return { dispatched };
2152
+ }
2153
+ //#endregion
2031
2154
  //#region src/chat/ingress/workspace-membership.ts
2032
2155
  const MEMBER_TTL_MS = 3e5;
2033
2156
  const NON_MEMBER_TTL_MS = 3e4;
@@ -2531,7 +2654,26 @@ async function routeParsedMessage(args) {
2531
2654
  const isDirectMessage = isDmEvent(args.event);
2532
2655
  const isSubscribed = !isDirectMessage && !isMention && await args.state.isSubscribed(canonicalThreadId);
2533
2656
  const route = isDirectMessage || isMention ? "mention" : isSubscribed ? "subscribed" : void 0;
2534
- if (!route) return;
2657
+ if (!route) {
2658
+ const channelMessage = args.event.type === "message" && args.event.channel && args.event.ts ? slackChannelMessageEvent({
2659
+ botId: args.event.bot_id,
2660
+ channelId: args.event.channel,
2661
+ subtype: args.event.subtype,
2662
+ text: args.event.text,
2663
+ threadTs: args.event.thread_ts,
2664
+ ts: args.event.ts,
2665
+ userId: message.author.userId
2666
+ }) : void 0;
2667
+ const teamId = args.installation.teamId;
2668
+ if (channelMessage && teamId) await ingestEventAutomations({
2669
+ ...channelMessage,
2670
+ namespace: SLACK_EVENT_NAMESPACE
2671
+ }, {
2672
+ queue: args.queue,
2673
+ teamId
2674
+ });
2675
+ return;
2676
+ }
2535
2677
  const stopDecision = getThreadStopDecision({
2536
2678
  botUserName: botConfig.userName,
2537
2679
  rawText: args.event.text ?? "",
@@ -3012,81 +3154,6 @@ async function publicArtifactGET(args) {
3012
3154
  }
3013
3155
  }
3014
3156
  //#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
3157
  //#region src/chat/events/workspace.ts
3091
3158
  /**
3092
3159
  * Resolve the single-bot Slack team id for event-automation indexing.
@@ -1,7 +1,7 @@
1
- import { r as completeObject } from "./client-BVaGEb1-.js";
1
+ import { r as completeObject } from "./client-Bn9SRFCi.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-_XAINZMN.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-BYNOFO6e.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-BEuPFbbv.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-Caa0Qh_Q.js").then((n) => n.t),
104
+ import("../catalog-runtime-wmq_fqff.js").then((n) => n.t),
105
+ import("../validation-BAzlyNIc.js").then((n) => n.r),
106
+ import("../viewer-wCn8xneI.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,16 @@ 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-Caa0Qh_Q.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-C8DRk9X6.js");
161
+ const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-17c9_39v.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-B8hurjFt.js");
164
+ const { bindSpawnAgent } = await import("../spawn-CdAaTXrY.js").then((n) => n.n);
165
+ const { createAgentInvocationWorker, routeAgentInvocationWork } = await import("../work-4QPqTd5_.js").then((n) => n.a);
166
166
  const { createLocalConversationWork } = await import("../conversation-work-C6y3T5Hx.js");
167
- const { processConversationWork } = await import("../worker-Byd2Et9r.js").then((n) => n.n);
167
+ const { processConversationWork } = await import("../worker-mc62tybz.js").then((n) => n.n);
168
168
  let agentRunner;
169
169
  const localConversationWork = createLocalConversationWork(async (message) => {
170
170
  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-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-Bs3dV81s.js";
2
+ import { _ as parsePluginManifest, g as parseInlinePluginManifest } from "../registry-BYNOFO6e.js";
3
+ import { i as parseSkillFile } from "../skills-C4yrD2NR.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-BEbNsG87.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-DFAh_jTW.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-wCn8xneI.js";
2
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-wmq_fqff.js";
3
+ import { d as setPlugins, f as validatePlugins, lt as createPluginLogger } from "../agent-hooks-Caa0Qh_Q.js";
4
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-BAzlyNIc.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-wmq_fqff.js";
2
+ import { S as disconnectStateAdapter, t as create } from "../profile-BA471c-l.js";
3
+ import { r as resolve } from "../resolve-rpz8No2i.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-_XAINZMN.js";
2
+ import { t as createJuniorSqlExecutor } from "../executor-CFIqoCNJ.js";
3
+ import { t as createPluginCatalogRuntime } from "../registry-BYNOFO6e.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-Bs3dV81s.js";
2
+ import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-BN5SGxsF.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-Bn9SRFCi.js";
3
+ import { p as logWarn } from "./logging-Bs3dV81s.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));
@@ -766,7 +766,17 @@ const forkConversationBodySchema = z.object({
766
766
  idempotencyKey: z.string().trim().min(1).max(200)
767
767
  }).strict();
768
768
  const forkConversationResponseSchema = z.object({ conversationId: z.string() }).strict();
769
+ /** One Conversation in the agent tree of a child Conversation. */
770
+ const conversationAgentTreeNodeSchema = z.object({
771
+ conversationId: z.string().min(1),
772
+ label: z.string().min(1)
773
+ }).strict();
769
774
  const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
775
+ /**
776
+ * The parent chain of a child Conversation, root first, with this
777
+ * Conversation last. Root Conversations omit it.
778
+ */
779
+ agentTree: z.array(conversationAgentTreeNodeSchema).min(2).optional(),
770
780
  /** The viewer can fork this conversation from an assistant reply. */
771
781
  canFork: z.boolean().optional(),
772
782
  forkedFromConversationId: z.string().optional(),
@@ -858,4 +868,4 @@ const conversationStatsReportSchema = z.object({
858
868
  windowStart: z.string()
859
869
  }).strict();
860
870
  //#endregion
861
- export { forkConversationResponseSchema as A, parseBriefInput as B, conversationReportEventSchema as C, createConversationBodySchema as D, conversationSummaryReportSchema as E, isVisionImageMediaType as F, removedCardSchema as G, messageCardRef as H, briefCodeChangeSchema as I, resolveMessageCards as K, briefLinkSchema as L, MAX_INPUT_IMAGE_BYTES as M, readMessageAttachments as N, createConversationMessageBodySchema as O, INPUT_IMAGE_TYPES as P, briefOutcomeStatusSchema as R, conversationReportEventDataSchema as S, conversationStatsReportSchema as T, messageCardText as U, annotationCard as V, readMessageCardRefs as W, conversationParamsSchema as _, cancelConversationPendingMessagesBodySchema as a, conversationPendingMessageSchema as b, conversationAttachmentParamsSchema as c, conversationDetailReportSchema as d, conversationEventHistorySchema as f, conversationFeedSchema as g, conversationFeedQuerySchema as h, archiveConversationResponseSchema as i, MAX_INPUT_IMAGES as j, forkConversationBodySchema as k, conversationAuxiliaryCostsSchema as l, conversationEventsQuerySchema as m, actorIdentitySchema as n, cancelConversationPendingMessagesResponseSchema as o, conversationEventPageSchema as p, archiveConversationBodySchema as r, conversationActivityPreviewSchema as s, acceptedConversationMessageSchema as t, conversationDetailQuerySchema as u, conversationPendingAuthorizationSchema as v, conversationStatsItemSchema as w, conversationPendingMessagesReportSchema as x, conversationPendingMessageDeliverySchema as y, conversationBriefSchema as z };
871
+ export { forkConversationBodySchema as A, conversationBriefSchema as B, conversationReportEventSchema as C, conversationUsageSchema as D, conversationSummaryReportSchema as E, INPUT_IMAGE_TYPES as F, readMessageCardRefs as G, annotationCard as H, isVisionImageMediaType as I, removedCardSchema as K, briefCodeChangeSchema as L, MAX_INPUT_IMAGES as M, MAX_INPUT_IMAGE_BYTES as N, createConversationBodySchema as O, readMessageAttachments as P, briefLinkSchema as R, conversationReportEventDataSchema as S, conversationStatsReportSchema as T, messageCardRef as U, parseBriefInput as V, messageCardText as W, conversationParamsSchema as _, cancelConversationPendingMessagesBodySchema as a, conversationPendingMessageSchema as b, conversationAttachmentParamsSchema as c, conversationDetailReportSchema as d, conversationEventHistorySchema as f, conversationFeedSchema as g, conversationFeedQuerySchema as h, archiveConversationResponseSchema as i, forkConversationResponseSchema as j, createConversationMessageBodySchema as k, conversationAuxiliaryCostsSchema as l, conversationEventsQuerySchema as m, actorIdentitySchema as n, cancelConversationPendingMessagesResponseSchema as o, conversationEventPageSchema as p, resolveMessageCards as q, archiveConversationBodySchema as r, conversationActivityPreviewSchema as s, acceptedConversationMessageSchema as t, conversationDetailQuerySchema as u, conversationPendingAuthorizationSchema as v, conversationStatsItemSchema as w, conversationPendingMessagesReportSchema as x, conversationPendingMessageDeliverySchema as y, briefOutcomeStatusSchema as z };
@@ -1,4 +1,4 @@
1
- import { p as logWarn } from "./logging-z7_w-KN_.js";
1
+ import { p as logWarn } from "./logging-Bs3dV81s.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 { _ as resolvePluginOAuthAccount, cn as formatProviderLabel, d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, fn as createUserTokenStore, ln as parseOAuthStatePayload, lt as getMcpProviderErrorAttributes, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, un as resolveBaseUrl, x as lookupSlackUserProfile } from "./agent-runner-DtEtbaOb.js";
2
- import { f as escapeXml } from "./client-BVaGEb1-.js";
3
- import { d as logException, h as runBestEffort, p as logWarn } from "./logging-z7_w-KN_.js";
4
- import { a as getRuntimeMetadata, n as botConfig } from "./config-q9xXVN_5.js";
1
+ import { _ as resolvePluginOAuthAccount, d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, fn as formatProviderLabel, gn as createUserTokenStore, mn as resolveBaseUrl, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, pn as parseOAuthStatePayload, s as deleteMcpAuthSession, ut as getMcpProviderErrorAttributes, x as lookupSlackUserProfile } from "./agent-runner-BEuPFbbv.js";
2
+ import { f as escapeXml } from "./client-Bn9SRFCi.js";
3
+ import { d as logException, h as runBestEffort, p as logWarn } from "./logging-Bs3dV81s.js";
4
+ import { a as getRuntimeMetadata, n as botConfig } from "./config-_XAINZMN.js";
5
5
  import { f as parseSlackUserId } from "./actor-BTtLaeWy.js";
6
- import { A as upsertIdentity, f as getSqlExecutor, j as upsertLinkedIdentity } from "./viewer-BBnCMR1g.js";
6
+ import { A as upsertIdentity, f as getSqlExecutor, j as upsertLinkedIdentity } from "./viewer-wCn8xneI.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-DvzzL8-v.js";
9
- import { n as pluginCatalogRuntime } from "./catalog-runtime-CpxhLwZG.js";
10
- import { t as discoverSkills } from "./skills-DFduSvuO.js";
11
- import { Mt as recordAuthorizationCompleted, X as getTurnRecord, jt as recordAuthenticationLinked, z as postSlackMessage } from "./tasks-DBZAgTx7.js";
12
- import { zt as getSlackClient } from "./agent-hooks-Cj_rSeWd.js";
13
- import { E as acquireActiveLock, w as getStateAdapter } from "./profile-yeKVNECl.js";
14
- import { i as getConversationPendingAuth } from "./pending-auth-OndKPW4M.js";
15
- import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-hj70P2Cp.js";
16
- import { n as deleteWebAuthorization, o as wakeAuthorizedTurn, s as wakePausedTurn } from "./web-authorization-CTltRLsB.js";
8
+ import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-BYNOFO6e.js";
9
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-wmq_fqff.js";
10
+ import { t as discoverSkills } from "./skills-C4yrD2NR.js";
11
+ import { Nt as recordAuthenticationLinked, Pt as recordAuthorizationCompleted, Q as getTurnRecord, V as postSlackMessage } from "./tasks-Ddd7OAkp.js";
12
+ import { zt as getSlackClient } from "./agent-hooks-Caa0Qh_Q.js";
13
+ import { E as acquireActiveLock, w as getStateAdapter } from "./profile-BA471c-l.js";
14
+ import { i as getConversationPendingAuth } from "./pending-auth-Bnhg7Q9k.js";
15
+ import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-DqErwbA8.js";
16
+ import { n as deleteWebAuthorization, o as wakeAuthorizedTurn, s as wakePausedTurn } from "./web-authorization-d5MtGpfG.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";