@sentry/junior 0.239.0 → 0.240.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/{admin-Cc-iA6z9.js → admin-D6fRPRgC.js} +1 -1
  2. package/dist/{agent-hooks-DzfA5m3R.js → agent-hooks-JFbgedMZ.js} +116 -10
  3. package/dist/{agent-runner--1wC26S6.js → agent-runner-0IjJxsL1.js} +60 -121
  4. package/dist/api/schema.js +2 -2
  5. package/dist/api.d.ts +1 -1
  6. package/dist/api.js +21 -20
  7. package/dist/{app-FB2hmHpZ.d.ts → app-MEd7wbF0.d.ts} +1 -1
  8. package/dist/app.d.ts +1 -1
  9. package/dist/app.js +24 -23
  10. package/dist/{automation-CrQGQ2MT.js → automation-B5_c8hEb.js} +2 -253
  11. package/dist/{briefs-DGc2Thua.js → briefs-BGWTp-nz.js} +2 -2
  12. package/dist/cadence-D00SCzT1.js +256 -0
  13. package/dist/{catalog-runtime-DpB_hG_I.js → catalog-runtime-DdigNl7s.js} +1 -1
  14. package/dist/{checkpoint-CN7yMfSo.js → checkpoint-C1ZnSz7r.js} +15 -11
  15. package/dist/cli/chat.js +12 -12
  16. package/dist/cli/check.js +3 -3
  17. package/dist/cli/main.js +2 -2
  18. package/dist/cli/plugins.js +4 -4
  19. package/dist/cli/snapshot-create.js +3 -3
  20. package/dist/cli/upgrade.d.ts +1 -1
  21. package/dist/cli/upgrade.js +3 -3
  22. package/dist/{client-DNf-sJmM.js → client-Cn73E7br.js} +2 -2
  23. package/dist/{config-B8QN-04U.js → config-B0S86yw9.js} +2 -2
  24. package/dist/{conversation-privacy-CrYizZM3.js → conversation-privacy-BKlX7D_R.js} +1 -1
  25. package/dist/{credential-sync-BG_Yvja8.js → credential-sync-DeNQm7st.js} +14 -14
  26. package/dist/{db-CWZP77Ex.d.ts → db-Ca9Nt5ci.d.ts} +1 -1
  27. package/dist/{executor-BQV1Zc1z.js → executor-BQ-A5nov.js} +2 -2
  28. package/dist/{images-C_0iwPsW.js → images-C7OKd6uy.js} +2 -2
  29. package/dist/instrumentation.js +2 -2
  30. package/dist/{job-queue-D82gksYM.js → job-queue-DgXLqoeB.js} +1 -1
  31. package/dist/{logging-Crg0e1jb.js → logging-BSNF167N.js} +1 -1
  32. package/dist/nitro.d.ts +1 -1
  33. package/dist/nitro.js +3 -3
  34. package/dist/{oauth-authorization-Bdu39G-H.js → oauth-authorization-BM7g61od.js} +1 -1
  35. package/dist/{oauth-callback-server-eJfI6skP.js → oauth-callback-server-Dw-BwI6x.js} +2 -2
  36. package/dist/{pending-auth-DauOaies.js → pending-auth-Chn_EA1_.js} +2 -2
  37. package/dist/{profile-XzHSfIah.js → profile-3t9H_IwL.js} +4 -4
  38. package/dist/{registry-BJME30oR.js → registry-DLZlAhdP.js} +1 -1
  39. package/dist/{resolve-ZKXfsZuZ.js → resolve-9_cIPQsq.js} +2 -2
  40. package/dist/{runner-DkHL8vRA.js → runner-C_eUbFyp.js} +9 -9
  41. package/dist/{sandbox-egress-signals-BEQsK7ym.js → sandbox-egress-signals-C1ycxTNA.js} +1 -1
  42. package/dist/{schema-CxWAN2zq.js → schema-C4XwHTY4.js} +1 -1
  43. package/dist/{skills-CMl248J3.js → skills-Dqgjr_Tl.js} +2 -2
  44. package/dist/{spawn-DrvZYrTQ.js → spawn-BfEr3t7b.js} +2 -2
  45. package/dist/{store-BxxbxBlm.d.ts → store-DoewL5mG.d.ts} +0 -7
  46. package/dist/{task-queue-BMzTARMo.js → task-queue-CuFZDOXn.js} +3 -3
  47. package/dist/{task-runner-CXTpWSmw.js → task-runner-c7gwV8dj.js} +10 -10
  48. package/dist/{thread-state-BM1sLptE.js → thread-state-exTu-G1w.js} +6 -6
  49. package/dist/{turn-failure-response-ISrbka5I.js → turn-failure-response-DFp99ziF.js} +8 -8
  50. package/dist/{turn-lifecycle-f7TPxQsc.js → turn-lifecycle-C4TjuOzG.js} +1 -1
  51. package/dist/{turn-session-routing-BcAD7onh.js → turn-session-routing-Vpg8jUD1.js} +1 -1
  52. package/dist/{validation-Bo6BHmig.js → validation-D2lULEG9.js} +1 -1
  53. package/dist/{version-Cv__n5ue.js → version-BjBMCc2o.js} +1 -1
  54. package/dist/version.js +1 -1
  55. package/dist/{viewer-EftpWXcF.js → viewer-XE3nFqKM.js} +9 -11
  56. package/dist/{web-authorization-BLDXKk2u.js → web-authorization-8E8IrWOj.js} +6 -6
  57. package/dist/{web-input-DSa6geKr.js → web-input-DF4GGJrf.js} +24 -41
  58. package/dist/{work-WOk5DovU.js → work-Dt_JjfbX.js} +7 -7
  59. package/dist/{worker-B7rtMFzw.js → worker-BrbnLmD3.js} +5 -5
  60. package/package.json +5 -5
@@ -1,5 +1,5 @@
1
1
  import { n as ConversationWorkQueue, t as ConversationQueueMessage } from "./queue-B5SnqRln.js";
2
- import { t as ConversationStore } from "./store-BxxbxBlm.js";
2
+ import { t as ConversationStore } from "./store-DoewL5mG.js";
3
3
  import "./history-DvqWZlYX.js";
4
4
  import { n as JuniorPluginSet } from "./plugins-CjfUP5gJ.js";
5
5
  import { Hono } from "hono";
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-FB2hmHpZ.js";
1
+ import { i as ModelProfileInput, n as createApp, r as JuniorDashboardOptions, t as JuniorAppOptions } from "./app-MEd7wbF0.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,32 +1,33 @@
1
- import { An as slackEntitySchema, Bn as setConfigDefaults, Bt as ensureConversationWake, E as requestAttachmentDeletion, G as withScheduledAutomationLock, Ht as getConversationWorkState, I as logScheduledAutomationRunSkipped, Jt as removeActiveConversation, L as scheduledAutomationRunAttributes, Mn as createUserTokenStore, O as parseSlackThreadId, Pt as clearExpiredConversationLease, Qt as stopConversationWork, R as listScheduledAutomations, Tn as slackMention, Tt as eventGuidance, U as saveScheduledAutomationInLock, Ut as hasRunnableConversationWork, V as readScheduledAutomation, Vt as getConversation, W as scheduledRunId, Wt as listActiveConversationIds, Xt as requestConversationWork, Y as effectiveTaskOutcomes, Z as collectEventAutomationMatchKeys, _n as formatProviderLabel, an as renderTaskInput, b as unpublishedArtifactHeaders, bn as startOAuthFlow, bt as ingestEvent, c as deleteMcpAuthSessionsForUserProvider, cn as resolveSandboxEgressProviderForHost, dn as SANDBOX_EGRESS_PROXY_PATH, en as CONVERSATION_WORK_STALE_ENQUEUE_MS, et as findMatchingEventAutomations, fn as clearSandboxEgressSignals, hn as parseSandboxEgressCredentialToken, i as executeCredentialedEgressRequest, in as isInvalidConversationRecordError, jn as slackExternalRefIdSchema, kt as appendAndEnqueueInboundMessage, l as deleteMcpServerSessionId, ln as normalizeSandboxEgressTracePropagationDomains, mn as consumeSandboxEgressPermissionDeniedSignal, n as executeAgentRun, nn as hasRunnableConversationWork$1, pn as consumeSandboxEgressAuthRequiredSignal, t as createAgentRunner, u as deleteMcpStoredOAuthCredentials, un as shouldPropagateSandboxEgressTrace, v as publicArtifactHeaders, w as collectAttachmentGarbage, wt as getEventCatalog, x as lookupSlackUserProfile, y as readPublicArtifact, yt as processWorkspaceSnapshotJob, z as listScheduledAutomationsForTeam, zn as getConfigDefaults } from "./agent-runner--1wC26S6.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-Crg0e1jb.js";
1
+ import { $ as findMatchingEventAutomations, $t as CONVERSATION_WORK_STALE_ENQUEUE_MS, An as slackExternalRefIdSchema, B as readScheduledAutomation, Bt as getConversation, Ct as getEventCatalog, E as requestAttachmentDeletion, F as logScheduledAutomationRunSkipped, H as saveScheduledAutomationInLock, Ht as hasRunnableConversationWork, I as scheduledAutomationRunAttributes, J as effectiveTaskOutcomes, L as listScheduledAutomations, Nt as clearExpiredConversationLease, O as parseSlackThreadId, Ot as appendAndEnqueueInboundMessage, R as listScheduledAutomationsForTeam, Rn as getConfigDefaults, U as scheduledRunId, Ut as listActiveConversationIds, Vt as getConversationWorkState, W as withScheduledAutomationLock, X as collectEventAutomationMatchKeys, Yt as requestConversationWork, Zt as stopConversationWork, b as unpublishedArtifactHeaders, c as deleteMcpAuthSessionsForUserProvider, cn as normalizeSandboxEgressTracePropagationDomains, dn as clearSandboxEgressSignals, fn as consumeSandboxEgressAuthRequiredSignal, gn as formatProviderLabel, i as executeCredentialedEgressRequest, in as renderTaskInput, jn as createUserTokenStore, kn as slackEntitySchema, l as deleteMcpServerSessionId, ln as shouldPropagateSandboxEgressTrace, mn as parseSandboxEgressCredentialToken, n as executeAgentRun, pn as consumeSandboxEgressPermissionDeniedSignal, qt as removeActiveConversation, rn as isInvalidConversationRecordError, sn as resolveSandboxEgressProviderForHost, t as createAgentRunner, tn as hasRunnableConversationWork$1, u as deleteMcpStoredOAuthCredentials, un as SANDBOX_EGRESS_PROXY_PATH, v as publicArtifactHeaders, vt as processWorkspaceSnapshotJob, w as collectAttachmentGarbage, wn as slackMention, wt as eventGuidance, x as lookupSlackUserProfile, y as readPublicArtifact, yn as startOAuthFlow, yt as ingestEvent, zn as setConfigDefaults, zt as ensureConversationWake } from "./agent-runner-0IjJxsL1.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-BSNF167N.js";
3
3
  import { r as continueTrace } from "./sentry-CgWZM_kV.js";
4
- import { t as JUNIOR_VERSION } from "./version-Cv__n5ue.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-B8QN-04U.js";
4
+ import { t as JUNIOR_VERSION } from "./version-BjBMCc2o.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-B0S86yw9.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 { E 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-EftpWXcF.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-XE3nFqKM.js";
8
8
  import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
9
- import { D as juniorConversations, _ as juniorConversationBriefs, a as juniorSchedulerRuns, b as juniorConversationEvents, m as juniorAgentInvocations, o as juniorSchedulerTasks, p as juniorAgentBindings } from "./executor-BQV1Zc1z.js";
10
- import { n as pluginCatalogRuntime } from "./catalog-runtime-DpB_hG_I.js";
11
- import { J as appendConversationMessages, Z as projectConversationMessages, et as settleConversationTitleWork } from "./checkpoint-CN7yMfSo.js";
12
- import { $ as verifySlackDirectCredentialSubject, G as findMatchingWatches, Ht as listConversationAnnotations, J as bindEventAutomationCredentialSubject, Q as verifyScheduledAutomationCredentialSubject, St as readConversationAccessFromSql, V as collectEventMatchKeys, X as bindSlackDirectCredentialSubject, Y as bindScheduledAutomationCredentialSubject, Z as verifyEventAutomationCredentialSubject, _t as setDashboardConversationLinkOptions, a as getPluginRoutes, at as getSlackClient, d as setPlugins, dt as getWorkspaceTeamId, f as validatePlugins, ft as runWithWorkspaceTeamId, gt as getDashboardTaskLink, h as setBriefsConfig, i as getPluginApiRoutes, mt as getDashboardConversationLink, q as takeDueTimerWatches, st as isDmChannel, u as getPlugins, vt as createPluginState, xt as createPluginLogger, z as cancelSubscriptions, zt as resolveRootVisibility } from "./agent-hooks-DzfA5m3R.js";
9
+ import { D as juniorConversations, _ as juniorConversationBriefs, a as juniorSchedulerRuns, b as juniorConversationEvents, m as juniorAgentInvocations, o as juniorSchedulerTasks, p as juniorAgentBindings } from "./executor-BQ-A5nov.js";
10
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-DdigNl7s.js";
11
+ import { J as appendConversationMessages, Z as projectConversationMessages, et as settleConversationTitleWork } from "./checkpoint-C1ZnSz7r.js";
12
+ import { $ as verifySlackDirectCredentialSubject, G as findMatchingWatches, Ht as listConversationAnnotations, J as bindEventAutomationCredentialSubject, Q as verifyScheduledAutomationCredentialSubject, St as readConversationAccessFromSql, V as collectEventMatchKeys, X as bindSlackDirectCredentialSubject, Y as bindScheduledAutomationCredentialSubject, Z as verifyEventAutomationCredentialSubject, _t as setDashboardConversationLinkOptions, a as getPluginRoutes, at as getSlackClient, d as setPlugins, dt as getWorkspaceTeamId, f as validatePlugins, ft as runWithWorkspaceTeamId, gt as getDashboardTaskLink, h as setBriefsConfig, i as getPluginApiRoutes, mt as getDashboardConversationLink, q as takeDueTimerWatches, st as isDmChannel, u as getPlugins, vt as createPluginState, xt as createPluginLogger, z as cancelSubscriptions, zt as resolveRootVisibility } from "./agent-hooks-JFbgedMZ.js";
13
13
  import { V as annotationCard } from "./conversation-DwD-vquD.js";
14
- import { O as withLock$1, w as getStateAdapter } from "./profile-XzHSfIah.js";
15
- import { c as getThreadStopDecision } from "./pending-auth-DauOaies.js";
16
- import { f as setSandboxResourceConfig, u as getSandboxResourceConfig } from "./resolve-ZKXfsZuZ.js";
17
- 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-D82gksYM.js";
18
- import { D as scheduledRunSchema, L as getNextRunAtMs } from "./automation-CrQGQ2MT.js";
14
+ import { O as withLock$1, w as getStateAdapter } from "./profile-3t9H_IwL.js";
15
+ import { c as getThreadStopDecision } from "./pending-auth-Chn_EA1_.js";
16
+ import { n as getNextRunAtMs } from "./cadence-D00SCzT1.js";
17
+ import { f as setSandboxResourceConfig, u as getSandboxResourceConfig } from "./resolve-9_cIPQsq.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-DgXLqoeB.js";
19
+ import { D as scheduledRunSchema } from "./automation-B5_c8hEb.js";
19
20
  import { i as setExperimentalFeatures, n as getExperimentalFeatures, r as isExperimentalFeatureEnabled } from "./experimental-Qn9rKLgx.js";
20
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-Bo6BHmig.js";
21
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "./validation-D2lULEG9.js";
21
22
  import { a as pluginRuntimeRegistrationsFromPluginSet, n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "./plugins-egKWjgue.js";
22
- import { A as getAuthPausedConversationTurnId, C as clearSlackPendingReactions, D as stopSlackThread, E as isSlackMessageStopped, F as renderSlackObjectCard, I as createVercelAttachmentStorage, M as THREAD_OPTOUT_ACK, N as startProcessingReaction, O as normalizeIncomingSlackThreadId, P as parseContent, R as enqueueAgentDispatch, S as buildSlackInboundMessage, T as verifySlackSignature, _ as readViewerAutomationSummary, a as recordWebConversationActivity, c as createProductionSlackWebhookServices, k as withNormalizedThreadId, l as getProductionSlackAdapter, n as conversationTurnIdForMessage, o as webActorFromEmail, s as createProductionConversationWorkOptions, t as appendAndEnqueueWebMessage, w as runWithSlackInstallation, x as recordSkippedConversationMessage, z as GET$3 } from "./web-input-DSa6geKr.js";
23
- import { O as recordAutomationExecution, _ as markDispatchFailed, a as confirmDispatchMailboxAppend, d as getPluginDispatchProjection, f as isTerminalDispatchStatus, l as getDispatchRecord, o as createOrGetDispatch, p as listPendingDispatchMailboxAppends, s as getDispatchConversationId, t as processPluginTask } from "./task-runner-CXTpWSmw.js";
24
- import { c as listPendingAgentInvocationMailboxAppends, r as enqueueAgentInvocation } from "./work-WOk5DovU.js";
25
- import { s as coerceThreadConversationState } from "./thread-state-BM1sLptE.js";
26
- import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-BG_Yvja8.js";
27
- import { a as registerVercelPluginTaskDevConsumer, n as createVercelPluginTaskCallback, s as queueCallback } from "./task-queue-BMzTARMo.js";
28
- import { t as processConversationWork } from "./worker-B7rtMFzw.js";
29
- import { t as bindSpawnAgent } from "./spawn-DrvZYrTQ.js";
23
+ import { A as getAuthPausedConversationTurnId, C as clearSlackPendingReactions, D as stopSlackThread, E as isSlackMessageStopped, F as renderSlackObjectCard, I as createVercelAttachmentStorage, M as THREAD_OPTOUT_ACK, N as startProcessingReaction, O as normalizeIncomingSlackThreadId, P as parseContent, R as enqueueAgentDispatch, S as buildSlackInboundMessage, T as verifySlackSignature, _ as readViewerAutomationSummary, a as recordWebConversationActivity, c as createProductionSlackWebhookServices, k as withNormalizedThreadId, l as getProductionSlackAdapter, n as conversationTurnIdForMessage, o as webActorFromEmail, s as createProductionConversationWorkOptions, t as appendAndEnqueueWebMessage, w as runWithSlackInstallation, x as recordSkippedConversationMessage, z as GET$3 } from "./web-input-DF4GGJrf.js";
24
+ import { O as recordAutomationExecution, _ as markDispatchFailed, a as confirmDispatchMailboxAppend, d as getPluginDispatchProjection, f as isTerminalDispatchStatus, l as getDispatchRecord, o as createOrGetDispatch, p as listPendingDispatchMailboxAppends, s as getDispatchConversationId, t as processPluginTask } from "./task-runner-c7gwV8dj.js";
25
+ import { c as listPendingAgentInvocationMailboxAppends, r as enqueueAgentInvocation } from "./work-Dt_JjfbX.js";
26
+ import { s as coerceThreadConversationState } from "./thread-state-exTu-G1w.js";
27
+ import { a as GET$4, i as publishAppHomeView, r as GET$5, t as receiveLocalOAuthCredential } from "./credential-sync-DeNQm7st.js";
28
+ import { a as registerVercelPluginTaskDevConsumer, n as createVercelPluginTaskCallback, s as queueCallback } from "./task-queue-CuFZDOXn.js";
29
+ import { t as processConversationWork } from "./worker-BrbnLmD3.js";
30
+ import { t as bindSpawnAgent } from "./spawn-BfEr3t7b.js";
30
31
  import { createRequire } from "node:module";
31
32
  import { Hono } from "hono";
32
33
  import { z } from "zod";
@@ -1,3 +1,4 @@
1
+ import { a as resolveLocalScheduleAtMs, i as isValidTimeZone, r as getZonedDateTimeParts, t as getFirstRunAtMs } from "./cadence-D00SCzT1.js";
1
2
  import { z } from "zod";
2
3
  import { actorUserIdSchema, destinationVisibilitySchema, eventMatchSchema, eventTypeSchema, pluginEventTypeSchema, slackDestinationSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
3
4
  //#region src/chat/task-outcomes-schema.ts
@@ -8,249 +9,6 @@ const taskOutcomeInputSchema = z.object({
8
9
  destination: taskMessageDestinationInputSchema
9
10
  }).strict();
10
11
  //#endregion
11
- //#region src/chat/scheduled-automations/cadence.ts
12
- const FORMATTERS = /* @__PURE__ */ new Map();
13
- function getFormatter(timezone) {
14
- const existing = FORMATTERS.get(timezone);
15
- if (existing) return existing;
16
- const formatter = new Intl.DateTimeFormat("en-US", {
17
- timeZone: timezone,
18
- hour12: false,
19
- year: "numeric",
20
- month: "2-digit",
21
- day: "2-digit",
22
- hour: "2-digit",
23
- minute: "2-digit",
24
- second: "2-digit"
25
- });
26
- FORMATTERS.set(timezone, formatter);
27
- return formatter;
28
- }
29
- function normalizeHour(hour) {
30
- return hour === 24 ? 0 : hour;
31
- }
32
- function getLocalDateWeekday(date) {
33
- return new Date(Date.UTC(date.year, date.month - 1, date.day)).getUTCDay();
34
- }
35
- function getWeekStart(date) {
36
- return addDays(date, -((getLocalDateWeekday(date) + 6) % 7));
37
- }
38
- /** Resolve a UTC timestamp into calendar parts for a named time zone. */
39
- function getZonedDateTimeParts(timestampMs, timezone) {
40
- const parts = getFormatter(timezone).formatToParts(new Date(timestampMs));
41
- const values = new Map(parts.map((part) => [part.type, part.value]));
42
- const year = Number(values.get("year"));
43
- const month = Number(values.get("month"));
44
- const day = Number(values.get("day"));
45
- return {
46
- year,
47
- month,
48
- day,
49
- hour: normalizeHour(Number(values.get("hour"))),
50
- minute: Number(values.get("minute")),
51
- second: Number(values.get("second")),
52
- weekday: getLocalDateWeekday({
53
- year,
54
- month,
55
- day
56
- })
57
- };
58
- }
59
- function getTimeZoneOffsetMs(timestampMs, timezone) {
60
- const parts = getZonedDateTimeParts(timestampMs, timezone);
61
- return Date.UTC(parts.year, parts.month - 1, parts.day, parts.hour, parts.minute, parts.second) - timestampMs;
62
- }
63
- function localDateTimeToTimestampMs(args) {
64
- const localAsUtcMs = Date.UTC(args.date.year, args.date.month - 1, args.date.day, args.time.hour, args.time.minute, 0);
65
- const offsets = /* @__PURE__ */ new Set();
66
- for (const probeDeltaMs of [
67
- -1296e5,
68
- -432e5,
69
- 0,
70
- 432e5,
71
- 1296e5
72
- ]) offsets.add(getTimeZoneOffsetMs(localAsUtcMs + probeDeltaMs, args.timezone));
73
- const matches = [...offsets].map((offsetMs) => localAsUtcMs - offsetMs).filter((timestampMs) => {
74
- const parts = getZonedDateTimeParts(timestampMs, args.timezone);
75
- return parts.year === args.date.year && parts.month === args.date.month && parts.day === args.date.day && parts.hour === args.time.hour && parts.minute === args.time.minute;
76
- });
77
- if (matches.length === 0) return;
78
- return Math.min(...matches);
79
- }
80
- /** Resolve local time, rejecting DST gaps and choosing the earlier instant in a fold. */
81
- function resolveLocalScheduleAtMs(args) {
82
- const date = parseLocalDate(args.date);
83
- if (!date) return;
84
- return localDateTimeToTimestampMs({
85
- date,
86
- time: args.time,
87
- timezone: args.timezone
88
- });
89
- }
90
- function daysBetween(left, right) {
91
- return Math.floor((Date.UTC(right.year, right.month - 1, right.day) - Date.UTC(left.year, left.month - 1, left.day)) / 864e5);
92
- }
93
- function weeklyRecurrenceMatchesDate(date, start, recurrence) {
94
- if (compareDate(date, start) < 0) return false;
95
- return normalizeWeekdays(recurrence.weekdays).includes(getLocalDateWeekday(date)) && Math.floor(daysBetween(getWeekStart(start), getWeekStart(date)) / 7) % recurrence.interval === 0;
96
- }
97
- function greatestCommonDivisor(left, right) {
98
- let a = Math.abs(left);
99
- let b = Math.abs(right);
100
- while (b !== 0) [a, b] = [b, a % b];
101
- return a;
102
- }
103
- function findNextRunAtMs(args) {
104
- const start = parseLocalDate(args.recurrence.startDate);
105
- const interval = args.recurrence.interval;
106
- if (!start || !Number.isInteger(interval) || interval <= 0) return;
107
- const searchFrom = compareDate(args.searchFrom, start) < 0 ? start : args.searchFrom;
108
- if (args.recurrence.frequency === "daily") {
109
- const offsetDays = daysBetween(start, searchFrom);
110
- let candidateDate = addDays(start, Math.ceil(offsetDays / interval) * interval);
111
- const gregorianCycleDays = 146097;
112
- const candidateCount = gregorianCycleDays / greatestCommonDivisor(gregorianCycleDays, interval);
113
- for (let attempts = 0; attempts < candidateCount; attempts += 1) {
114
- const candidate = buildCandidate({
115
- date: candidateDate,
116
- recurrence: args.recurrence,
117
- timezone: args.timezone
118
- });
119
- if (candidate !== void 0 && candidate > args.afterMs) return candidate;
120
- candidateDate = addDays(candidateDate, interval);
121
- }
122
- return;
123
- }
124
- if (args.recurrence.frequency === "weekly") {
125
- if (normalizeWeekdays(args.recurrence.weekdays).length === 0) return;
126
- let candidateDate = searchFrom;
127
- const gregorianCycleDays = 146097;
128
- const cadenceDays = interval * 7;
129
- const searchDays = gregorianCycleDays * cadenceDays / greatestCommonDivisor(gregorianCycleDays, cadenceDays);
130
- for (let attempts = 0; attempts < searchDays; attempts += 1) {
131
- if (weeklyRecurrenceMatchesDate(candidateDate, start, args.recurrence)) {
132
- const candidate = buildCandidate({
133
- date: candidateDate,
134
- recurrence: args.recurrence,
135
- timezone: args.timezone
136
- });
137
- if (candidate !== void 0 && candidate > args.afterMs) return candidate;
138
- }
139
- candidateDate = addDays(candidateDate, 1);
140
- }
141
- return;
142
- }
143
- if (args.recurrence.frequency === "monthly") {
144
- const startMonth = start.year * 12 + start.month - 1;
145
- const searchMonth = searchFrom.year * 12 + searchFrom.month - 1;
146
- let candidateMonth = startMonth + Math.ceil((searchMonth - startMonth) / interval) * interval;
147
- const gregorianCycleMonths = 4800;
148
- const candidateCount = gregorianCycleMonths / greatestCommonDivisor(gregorianCycleMonths, interval);
149
- for (let attempts = 0; attempts < candidateCount; attempts += 1) {
150
- const candidateDate = {
151
- year: Math.floor(candidateMonth / 12),
152
- month: candidateMonth % 12 + 1,
153
- day: args.recurrence.dayOfMonth ?? 0
154
- };
155
- if (compareDate(candidateDate, searchFrom) >= 0) {
156
- const candidate = buildCandidate({
157
- date: candidateDate,
158
- recurrence: args.recurrence,
159
- timezone: args.timezone
160
- });
161
- if (candidate !== void 0 && candidate > args.afterMs) return candidate;
162
- }
163
- candidateMonth += interval;
164
- }
165
- return;
166
- }
167
- let candidateYear = start.year + Math.ceil((searchFrom.year - start.year) / interval) * interval;
168
- const candidateCount = 400 / greatestCommonDivisor(400, interval);
169
- for (let attempts = 0; attempts < candidateCount; attempts += 1) {
170
- const candidateDate = {
171
- year: candidateYear,
172
- month: args.recurrence.month ?? 0,
173
- day: args.recurrence.dayOfMonth ?? 0
174
- };
175
- if (compareDate(candidateDate, searchFrom) >= 0) {
176
- const candidate = buildCandidate({
177
- date: candidateDate,
178
- recurrence: args.recurrence,
179
- timezone: args.timezone
180
- });
181
- if (candidate !== void 0 && candidate > args.afterMs) return candidate;
182
- }
183
- candidateYear += interval;
184
- }
185
- }
186
- /** Compute the first recurring calendar occurrence strictly after a timestamp. */
187
- function getFirstRunAtMs(args) {
188
- return findNextRunAtMs({
189
- ...args,
190
- searchFrom: getLocalDate(args.afterMs, args.timezone)
191
- });
192
- }
193
- function compareDate(left, right) {
194
- return Date.UTC(left.year, left.month - 1, left.day) - Date.UTC(right.year, right.month - 1, right.day);
195
- }
196
- function addDays(date, days) {
197
- const next = new Date(Date.UTC(date.year, date.month - 1, date.day + days));
198
- return {
199
- year: next.getUTCFullYear(),
200
- month: next.getUTCMonth() + 1,
201
- day: next.getUTCDate()
202
- };
203
- }
204
- function daysInMonth(year, month) {
205
- return new Date(Date.UTC(year, month, 0)).getUTCDate();
206
- }
207
- function parseLocalDate(value) {
208
- const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
209
- if (!match) return;
210
- const year = Number(match[1]);
211
- const month = Number(match[2]);
212
- const day = Number(match[3]);
213
- if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day) || month < 1 || month > 12 || day < 1 || day > daysInMonth(year, month)) return;
214
- return {
215
- year,
216
- month,
217
- day
218
- };
219
- }
220
- function getLocalDate(timestampMs, timezone) {
221
- const parts = getZonedDateTimeParts(timestampMs, timezone);
222
- return {
223
- year: parts.year,
224
- month: parts.month,
225
- day: parts.day
226
- };
227
- }
228
- function normalizeWeekdays(values) {
229
- return [...new Set((values ?? []).filter((value) => value >= 0 && value <= 6))].sort((a, b) => a - b);
230
- }
231
- function buildCandidate(args) {
232
- return localDateTimeToTimestampMs({
233
- date: args.date,
234
- time: args.recurrence.time,
235
- timezone: args.timezone
236
- });
237
- }
238
- /** Return the next fire time after a completed run, when the task recurs. */
239
- function getNextRunAtMs(task, scheduledForMs, afterMs = scheduledForMs) {
240
- if (task.schedule.kind !== "recurring") return;
241
- const recurrence = task.schedule.recurrence;
242
- if (!recurrence || !Number.isFinite(recurrence.interval) || recurrence.interval <= 0) return;
243
- const timezone = task.schedule.timezone;
244
- const afterDate = getLocalDate(afterMs, timezone);
245
- const nextScheduledDate = addDays(getLocalDate(scheduledForMs, timezone), 1);
246
- return findNextRunAtMs({
247
- afterMs,
248
- recurrence,
249
- searchFrom: compareDate(afterDate, nextScheduledDate) < 0 ? nextScheduledDate : afterDate,
250
- timezone
251
- });
252
- }
253
- //#endregion
254
12
  //#region src/chat/scheduled-automations/schedule-intent.ts
255
13
  /**
256
14
  * Owns model-facing schedule intent and materializes it against the trusted
@@ -367,15 +125,6 @@ function localDateAt(timestampMs, timezone) {
367
125
  parts.day
368
126
  ].map((value, index) => index === 0 ? String(value).padStart(4, "0") : String(value).padStart(2, "0")).join("-");
369
127
  }
370
- /** Whether the runtime accepts this IANA timezone name. */
371
- function isValidTimeZone(timezone) {
372
- try {
373
- new Intl.DateTimeFormat("en-US", { timeZone: timezone }).format();
374
- return true;
375
- } catch {
376
- return false;
377
- }
378
- }
379
128
  function plural(value, unit) {
380
129
  return value === 1 ? unit : `${unit}s`;
381
130
  }
@@ -890,4 +639,4 @@ const automationEventCatalogSchema = z.array(pluginEventTypeSchema.safeExtend({
890
639
  const automationScheduleIntentSchema = scheduleIntentSchema;
891
640
  const automationSchedulePreviewSchema = scheduledAutomationSchema.pick({ schedule: true }).extend({ nextRunAtMs: z.number() }).strict();
892
641
  //#endregion
893
- export { eventAutomationSchema as A, eventAutomationSummarySchema as C, scheduledRunSchema as D, scheduledAutomationSchema as E, weekdaySchema as F, getFirstRunAtMs as I, getNextRunAtMs as L, compileScheduleIntent as M, isValidTimeZone as N, automationInstructionToolSchema as O, scheduleIntentSchema as P, getZonedDateTimeParts as R, automationVersionSchema as S, SCHEDULED_AUTOMATION_SYSTEM_ACTOR as T, automationSummarySchema as _, automationExecutionSchema as a, automationVersionListSchema as b, automationLifecycleSchema as c, automationParamsSchema as d, automationRunListSchema as f, automationSchedulePreviewSchema as g, automationScheduleIntentSchema as h, automationExecutionListSchema as i, ScheduleIntentError as j, automationTitleSchema as k, automationListQuerySchema as l, automationRunWindowsSchema as m, automationEditSchema as n, automationExecutionStatusDaySchema as o, automationRunSchema as p, automationEventCatalogSchema as r, automationExecutionStatusSchema as s, automationEditErrorSchema as t, automationListSchema as u, automationUpdateSchema as v, scheduledAutomationSummarySchema as w, automationVersionParamsSchema as x, automationVersionActivateSchema as y, taskOutcomeInputSchema as z };
642
+ export { eventAutomationSchema as A, eventAutomationSummarySchema as C, scheduledRunSchema as D, scheduledAutomationSchema as E, taskOutcomeInputSchema as F, compileScheduleIntent as M, scheduleIntentSchema as N, automationInstructionToolSchema as O, weekdaySchema as P, automationVersionSchema as S, SCHEDULED_AUTOMATION_SYSTEM_ACTOR as T, automationSummarySchema as _, automationExecutionSchema as a, automationVersionListSchema as b, automationLifecycleSchema as c, automationParamsSchema as d, automationRunListSchema as f, automationSchedulePreviewSchema as g, automationScheduleIntentSchema as h, automationExecutionListSchema as i, ScheduleIntentError as j, automationTitleSchema as k, automationListQuerySchema as l, automationRunWindowsSchema as m, automationEditSchema as n, automationExecutionStatusDaySchema as o, automationRunSchema as p, automationEventCatalogSchema as r, automationExecutionStatusSchema as s, automationEditErrorSchema as t, automationListSchema as u, automationUpdateSchema as v, scheduledAutomationSummarySchema as w, automationVersionParamsSchema as x, automationVersionActivateSchema as y };
@@ -1,4 +1,4 @@
1
- import { r as completeObject } from "./client-DNf-sJmM.js";
1
+ import { r as completeObject } from "./client-Cn73E7br.js";
2
2
  import { r as defaultModelId } from "./model-profile-BwU8mqwD.js";
3
3
  import { B as parseBriefInput, I as briefCodeChangeSchema, d as conversationDetailReportSchema, p as conversationEventPageSchema } from "./conversation-DwD-vquD.js";
4
4
  import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-CMU-B4FA.js";
@@ -269,7 +269,7 @@ async function parseRunOptions(argv) {
269
269
  * `DATABASE_URL` at import, and `briefs pull` must work with only a token.
270
270
  */
271
271
  async function configuredDefaultModelId() {
272
- const { botConfig } = await import("./config-B8QN-04U.js").then((n) => n.r);
272
+ const { botConfig } = await import("./config-B0S86yw9.js").then((n) => n.r);
273
273
  return defaultModelId(botConfig);
274
274
  }
275
275
  function apiUrl(baseUrl, pathname) {
@@ -0,0 +1,256 @@
1
+ //#region src/chat/scheduled-automations/cadence.ts
2
+ const FORMATTERS = /* @__PURE__ */ new Map();
3
+ function getFormatter(timezone) {
4
+ const existing = FORMATTERS.get(timezone);
5
+ if (existing) return existing;
6
+ const formatter = new Intl.DateTimeFormat("en-US", {
7
+ timeZone: timezone,
8
+ hour12: false,
9
+ year: "numeric",
10
+ month: "2-digit",
11
+ day: "2-digit",
12
+ hour: "2-digit",
13
+ minute: "2-digit",
14
+ second: "2-digit"
15
+ });
16
+ FORMATTERS.set(timezone, formatter);
17
+ return formatter;
18
+ }
19
+ function normalizeHour(hour) {
20
+ return hour === 24 ? 0 : hour;
21
+ }
22
+ function getLocalDateWeekday(date) {
23
+ return new Date(Date.UTC(date.year, date.month - 1, date.day)).getUTCDay();
24
+ }
25
+ function getWeekStart(date) {
26
+ return addDays(date, -((getLocalDateWeekday(date) + 6) % 7));
27
+ }
28
+ /**
29
+ * Check that a value is an IANA time zone that this runtime knows. This module
30
+ * has no runtime imports, so the dashboard client bundle can use it.
31
+ */
32
+ function isValidTimeZone(timezone) {
33
+ try {
34
+ new Intl.DateTimeFormat("en-US", { timeZone: timezone }).format();
35
+ return true;
36
+ } catch {
37
+ return false;
38
+ }
39
+ }
40
+ /** Resolve a UTC timestamp into calendar parts for a named time zone. */
41
+ function getZonedDateTimeParts(timestampMs, timezone) {
42
+ const parts = getFormatter(timezone).formatToParts(new Date(timestampMs));
43
+ const values = new Map(parts.map((part) => [part.type, part.value]));
44
+ const year = Number(values.get("year"));
45
+ const month = Number(values.get("month"));
46
+ const day = Number(values.get("day"));
47
+ return {
48
+ year,
49
+ month,
50
+ day,
51
+ hour: normalizeHour(Number(values.get("hour"))),
52
+ minute: Number(values.get("minute")),
53
+ second: Number(values.get("second")),
54
+ weekday: getLocalDateWeekday({
55
+ year,
56
+ month,
57
+ day
58
+ })
59
+ };
60
+ }
61
+ function getTimeZoneOffsetMs(timestampMs, timezone) {
62
+ const parts = getZonedDateTimeParts(timestampMs, timezone);
63
+ return Date.UTC(parts.year, parts.month - 1, parts.day, parts.hour, parts.minute, parts.second) - timestampMs;
64
+ }
65
+ function localDateTimeToTimestampMs(args) {
66
+ const localAsUtcMs = Date.UTC(args.date.year, args.date.month - 1, args.date.day, args.time.hour, args.time.minute, 0);
67
+ const offsets = /* @__PURE__ */ new Set();
68
+ for (const probeDeltaMs of [
69
+ -1296e5,
70
+ -432e5,
71
+ 0,
72
+ 432e5,
73
+ 1296e5
74
+ ]) offsets.add(getTimeZoneOffsetMs(localAsUtcMs + probeDeltaMs, args.timezone));
75
+ const matches = [...offsets].map((offsetMs) => localAsUtcMs - offsetMs).filter((timestampMs) => {
76
+ const parts = getZonedDateTimeParts(timestampMs, args.timezone);
77
+ return parts.year === args.date.year && parts.month === args.date.month && parts.day === args.date.day && parts.hour === args.time.hour && parts.minute === args.time.minute;
78
+ });
79
+ if (matches.length === 0) return;
80
+ return Math.min(...matches);
81
+ }
82
+ /** Resolve local time, rejecting DST gaps and choosing the earlier instant in a fold. */
83
+ function resolveLocalScheduleAtMs(args) {
84
+ const date = parseLocalDate(args.date);
85
+ if (!date) return;
86
+ return localDateTimeToTimestampMs({
87
+ date,
88
+ time: args.time,
89
+ timezone: args.timezone
90
+ });
91
+ }
92
+ function daysBetween(left, right) {
93
+ return Math.floor((Date.UTC(right.year, right.month - 1, right.day) - Date.UTC(left.year, left.month - 1, left.day)) / 864e5);
94
+ }
95
+ function weeklyRecurrenceMatchesDate(date, start, recurrence) {
96
+ if (compareDate(date, start) < 0) return false;
97
+ return normalizeWeekdays(recurrence.weekdays).includes(getLocalDateWeekday(date)) && Math.floor(daysBetween(getWeekStart(start), getWeekStart(date)) / 7) % recurrence.interval === 0;
98
+ }
99
+ function greatestCommonDivisor(left, right) {
100
+ let a = Math.abs(left);
101
+ let b = Math.abs(right);
102
+ while (b !== 0) [a, b] = [b, a % b];
103
+ return a;
104
+ }
105
+ function findNextRunAtMs(args) {
106
+ const start = parseLocalDate(args.recurrence.startDate);
107
+ const interval = args.recurrence.interval;
108
+ if (!start || !Number.isInteger(interval) || interval <= 0) return;
109
+ const searchFrom = compareDate(args.searchFrom, start) < 0 ? start : args.searchFrom;
110
+ if (args.recurrence.frequency === "daily") {
111
+ const offsetDays = daysBetween(start, searchFrom);
112
+ let candidateDate = addDays(start, Math.ceil(offsetDays / interval) * interval);
113
+ const gregorianCycleDays = 146097;
114
+ const candidateCount = gregorianCycleDays / greatestCommonDivisor(gregorianCycleDays, interval);
115
+ for (let attempts = 0; attempts < candidateCount; attempts += 1) {
116
+ const candidate = buildCandidate({
117
+ date: candidateDate,
118
+ recurrence: args.recurrence,
119
+ timezone: args.timezone
120
+ });
121
+ if (candidate !== void 0 && candidate > args.afterMs) return candidate;
122
+ candidateDate = addDays(candidateDate, interval);
123
+ }
124
+ return;
125
+ }
126
+ if (args.recurrence.frequency === "weekly") {
127
+ if (normalizeWeekdays(args.recurrence.weekdays).length === 0) return;
128
+ let candidateDate = searchFrom;
129
+ const gregorianCycleDays = 146097;
130
+ const cadenceDays = interval * 7;
131
+ const searchDays = gregorianCycleDays * cadenceDays / greatestCommonDivisor(gregorianCycleDays, cadenceDays);
132
+ for (let attempts = 0; attempts < searchDays; attempts += 1) {
133
+ if (weeklyRecurrenceMatchesDate(candidateDate, start, args.recurrence)) {
134
+ const candidate = buildCandidate({
135
+ date: candidateDate,
136
+ recurrence: args.recurrence,
137
+ timezone: args.timezone
138
+ });
139
+ if (candidate !== void 0 && candidate > args.afterMs) return candidate;
140
+ }
141
+ candidateDate = addDays(candidateDate, 1);
142
+ }
143
+ return;
144
+ }
145
+ if (args.recurrence.frequency === "monthly") {
146
+ const startMonth = start.year * 12 + start.month - 1;
147
+ const searchMonth = searchFrom.year * 12 + searchFrom.month - 1;
148
+ let candidateMonth = startMonth + Math.ceil((searchMonth - startMonth) / interval) * interval;
149
+ const gregorianCycleMonths = 4800;
150
+ const candidateCount = gregorianCycleMonths / greatestCommonDivisor(gregorianCycleMonths, interval);
151
+ for (let attempts = 0; attempts < candidateCount; attempts += 1) {
152
+ const candidateDate = {
153
+ year: Math.floor(candidateMonth / 12),
154
+ month: candidateMonth % 12 + 1,
155
+ day: args.recurrence.dayOfMonth ?? 0
156
+ };
157
+ if (compareDate(candidateDate, searchFrom) >= 0) {
158
+ const candidate = buildCandidate({
159
+ date: candidateDate,
160
+ recurrence: args.recurrence,
161
+ timezone: args.timezone
162
+ });
163
+ if (candidate !== void 0 && candidate > args.afterMs) return candidate;
164
+ }
165
+ candidateMonth += interval;
166
+ }
167
+ return;
168
+ }
169
+ let candidateYear = start.year + Math.ceil((searchFrom.year - start.year) / interval) * interval;
170
+ const candidateCount = 400 / greatestCommonDivisor(400, interval);
171
+ for (let attempts = 0; attempts < candidateCount; attempts += 1) {
172
+ const candidateDate = {
173
+ year: candidateYear,
174
+ month: args.recurrence.month ?? 0,
175
+ day: args.recurrence.dayOfMonth ?? 0
176
+ };
177
+ if (compareDate(candidateDate, searchFrom) >= 0) {
178
+ const candidate = buildCandidate({
179
+ date: candidateDate,
180
+ recurrence: args.recurrence,
181
+ timezone: args.timezone
182
+ });
183
+ if (candidate !== void 0 && candidate > args.afterMs) return candidate;
184
+ }
185
+ candidateYear += interval;
186
+ }
187
+ }
188
+ /** Compute the first recurring calendar occurrence strictly after a timestamp. */
189
+ function getFirstRunAtMs(args) {
190
+ return findNextRunAtMs({
191
+ ...args,
192
+ searchFrom: getLocalDate(args.afterMs, args.timezone)
193
+ });
194
+ }
195
+ function compareDate(left, right) {
196
+ return Date.UTC(left.year, left.month - 1, left.day) - Date.UTC(right.year, right.month - 1, right.day);
197
+ }
198
+ function addDays(date, days) {
199
+ const next = new Date(Date.UTC(date.year, date.month - 1, date.day + days));
200
+ return {
201
+ year: next.getUTCFullYear(),
202
+ month: next.getUTCMonth() + 1,
203
+ day: next.getUTCDate()
204
+ };
205
+ }
206
+ function daysInMonth(year, month) {
207
+ return new Date(Date.UTC(year, month, 0)).getUTCDate();
208
+ }
209
+ function parseLocalDate(value) {
210
+ const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
211
+ if (!match) return;
212
+ const year = Number(match[1]);
213
+ const month = Number(match[2]);
214
+ const day = Number(match[3]);
215
+ if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day) || month < 1 || month > 12 || day < 1 || day > daysInMonth(year, month)) return;
216
+ return {
217
+ year,
218
+ month,
219
+ day
220
+ };
221
+ }
222
+ function getLocalDate(timestampMs, timezone) {
223
+ const parts = getZonedDateTimeParts(timestampMs, timezone);
224
+ return {
225
+ year: parts.year,
226
+ month: parts.month,
227
+ day: parts.day
228
+ };
229
+ }
230
+ function normalizeWeekdays(values) {
231
+ return [...new Set((values ?? []).filter((value) => value >= 0 && value <= 6))].sort((a, b) => a - b);
232
+ }
233
+ function buildCandidate(args) {
234
+ return localDateTimeToTimestampMs({
235
+ date: args.date,
236
+ time: args.recurrence.time,
237
+ timezone: args.timezone
238
+ });
239
+ }
240
+ /** Return the next fire time after a completed run, when the task recurs. */
241
+ function getNextRunAtMs(task, scheduledForMs, afterMs = scheduledForMs) {
242
+ if (task.schedule.kind !== "recurring") return;
243
+ const recurrence = task.schedule.recurrence;
244
+ if (!recurrence || !Number.isFinite(recurrence.interval) || recurrence.interval <= 0) return;
245
+ const timezone = task.schedule.timezone;
246
+ const afterDate = getLocalDate(afterMs, timezone);
247
+ const nextScheduledDate = addDays(getLocalDate(scheduledForMs, timezone), 1);
248
+ return findNextRunAtMs({
249
+ afterMs,
250
+ recurrence,
251
+ searchFrom: compareDate(afterDate, nextScheduledDate) < 0 ? nextScheduledDate : afterDate,
252
+ timezone
253
+ });
254
+ }
255
+ //#endregion
256
+ export { resolveLocalScheduleAtMs as a, isValidTimeZone as i, getNextRunAtMs as n, getZonedDateTimeParts as r, getFirstRunAtMs as t };
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { t as createPluginCatalogRuntime } from "./registry-BJME30oR.js";
2
+ import { t as createPluginCatalogRuntime } from "./registry-DLZlAhdP.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();