@sentry/junior 0.233.0 → 0.235.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/{agent-hooks-DATy_Hnt.js → agent-hooks-DS7k0ZWY.js} +17 -10
  2. package/dist/{agent-runner-BKOtZjez.js → agent-runner-BlDI1zV2.js} +354 -813
  3. package/dist/api/schema.d.ts +528 -2
  4. package/dist/api/schema.js +4 -4
  5. package/dist/api.js +350 -55
  6. package/dist/{app-xk2-Id1T.d.ts → app-pGsR__aT.d.ts} +1 -1
  7. package/dist/app.d.ts +1 -1
  8. package/dist/app.js +33 -21
  9. package/dist/{briefs-ClOTHmQ-.js → briefs-C3jhszOz.js} +4 -4
  10. package/dist/{catalog-runtime-xFtmw3oA.js → catalog-runtime-B9u_3-GW.js} +1 -1
  11. package/dist/{checkpoint-zkEB448J.js → checkpoint-DLcJ5mKL.js} +7 -7
  12. package/dist/cli/chat.js +13 -13
  13. package/dist/cli/check.js +3 -3
  14. package/dist/cli/main.js +1 -1
  15. package/dist/cli/plugins.js +3 -3
  16. package/dist/cli/snapshot-create.js +3 -3
  17. package/dist/cli/upgrade.js +3 -3
  18. package/dist/{client-CJUZHY9Y.js → client-BSnNHO0R.js} +2 -2
  19. package/dist/{config-XtycpE-i.js → config-Bmw4xTPK.js} +2 -2
  20. package/dist/{conversation-CPjHYOV5.js → conversation-C_aYrISI.js} +1 -0
  21. package/dist/{conversation-privacy-B30pEcsR.js → conversation-privacy-BV2dtba2.js} +1 -1
  22. package/dist/{credential-sync-vufd6gwK.js → credential-sync-CukzQJ1x.js} +13 -13
  23. package/dist/{executor-BGDb_cM-.js → executor-B9ksWZCv.js} +33 -1
  24. package/dist/{images-zuEwjVKU.js → images-CEXcQ0Id.js} +3 -3
  25. package/dist/instrumentation.js +2 -2
  26. package/dist/{job-queue-C5JaRRcE.js → job-queue-CY1L2YRn.js} +1 -1
  27. package/dist/{logging-BS563NYn.js → logging-F--48Q7Q.js} +1 -1
  28. package/dist/nitro.d.ts +1 -1
  29. package/dist/nitro.js +3 -3
  30. package/dist/{oauth-authorization-DF2dSmNh.js → oauth-authorization-LasSG3Qc.js} +1 -1
  31. package/dist/{oauth-callback-server-CW9COQ9L.js → oauth-callback-server-D07ZzVMs.js} +2 -2
  32. package/dist/{pending-auth-8Kmti8S3.js → pending-auth-DrG9Mkje.js} +1 -1
  33. package/dist/{profile-C4_njQYA.js → profile-DZ2DUdd1.js} +4 -4
  34. package/dist/{prompt-3D0sSbTC.js → prompt-BM_5mAU3.js} +1 -1
  35. package/dist/{registry-BhiLWAY6.js → registry-_JLY0x7b.js} +1 -1
  36. package/dist/{resolve-ZDwJ6a3N.js → resolve-Cuoj3MML.js} +2 -2
  37. package/dist/{runner-D1xeORYM.js → runner-BfelmbMv.js} +9 -9
  38. package/dist/{sandbox-egress-signals-Dx1PzQpy.js → sandbox-egress-signals-D5QUIO7Z.js} +1 -1
  39. package/dist/{schema-DuGfOm4u.js → schema-CrdDxGbx.js} +26 -117
  40. package/dist/{skills-CN-ye6on.js → skills-DAegjk5Y.js} +2 -2
  41. package/dist/{spawn-B8KYOBcU.js → spawn-DCfV7zGK.js} +2 -2
  42. package/dist/{task-queue-DPaZtxld.js → task-queue-GcuFtzor.js} +3 -3
  43. package/dist/{task-runner-D23tSETM.js → task-runner-B0-P_3aq.js} +16 -13
  44. package/dist/{thread-state-BbxSiDa9.js → thread-state-TezcEhuH.js} +5 -5
  45. package/dist/{turn-failure-response-c8irQDMB.js → turn-failure-response-Drhj_-t4.js} +8 -8
  46. package/dist/{turn-lifecycle-DSVG3u_p.js → turn-lifecycle-BpIW3zOx.js} +1 -1
  47. package/dist/{turn-session-routing-B2hNxu_N.js → turn-session-routing-Dg8GDgyc.js} +1 -1
  48. package/dist/types-Du-HbEun.js +621 -0
  49. package/dist/{validation-BrLB5qbC.js → validation-DAkYeKDT.js} +1 -1
  50. package/dist/{version-B2rspCmP.js → version-9CB4Z-J4.js} +1 -1
  51. package/dist/version.js +1 -1
  52. package/dist/{web-authorization-CVSTvY_D.js → web-authorization-Cu33voNg.js} +6 -6
  53. package/dist/{web-input-zUQoZMZw.js → web-input-B3k0J7WB.js} +212 -164
  54. package/dist/web-message-id-CVVCTWUb.js +464 -0
  55. package/dist/{work-BXbJVOZI.js → work-PmkvcY9l.js} +7 -7
  56. package/dist/{worker-ClkQ9S9C.js → worker-COcaq2J6.js} +5 -5
  57. package/package.json +5 -5
  58. package/dist/web-message-id-xPI_EFSC.js +0 -239
@@ -1,4 +1,4 @@
1
- import { A as MAX_INPUT_IMAGE_BYTES, C as conversationReportEventSchema, D as createConversationBodySchema, E as conversationSummaryReportSchema, J as conversationTurnFailureCodeSchema, M as INPUT_IMAGE_TYPES, O as createConversationMessageBodySchema, S as conversationReportEventDataSchema, T as conversationStatsReportSchema, V as messageCardText, W as resolveMessageCards, Y as conversationTurnFailureReasonSchema, _ as conversationParamsSchema, a as cancelConversationPendingMessagesBodySchema, b as conversationPendingMessageSchema, d as conversationDetailReportSchema, f as conversationEventHistorySchema, g as conversationFeedSchema, h as conversationFeedQuerySchema, i as archiveConversationResponseSchema, k as MAX_INPUT_IMAGES, l as conversationAuxiliaryCostsSchema, m as conversationEventsQuerySchema, o as cancelConversationPendingMessagesResponseSchema, p as conversationEventPageSchema, r as archiveConversationBodySchema, s as conversationActivityPreviewSchema, t as acceptedConversationMessageSchema, u as conversationDetailQuerySchema, v as conversationPendingAuthorizationSchema, x as conversationPendingMessagesReportSchema, y as conversationPendingMessageDeliverySchema } from "../conversation-CPjHYOV5.js";
2
- import { C as skillReportsSchema, S as skillReportSchema, _ as pluginPackageContentItemReportSchema, b as pluginsSchema, g as pluginOperationalReportSchema, h as pluginOperationalReportFeedSchema, m as healthReportSchema, t as webMessageId, v as pluginPackageContentReportSchema, x as runtimeInfoReportSchema, y as pluginSchema } from "../web-message-id-xPI_EFSC.js";
3
- import { A as actorProfileReportSchema, B as dailyConversationActivitySchema, C as createPersonalTokenBodySchema, D as personalTokenParamsSchema, E as personalTokenMetadataSchema, F as locationDirectoryReportSchema, G as codePersonReportSchema, H as codeChangeSummaryReportSchema, I as locationParamsSchema, K as codeRepositorySummarySchema, M as personalSpendReportSchema, N as locationActivityDayReportSchema, O as revokePersonalTokenResponseSchema, P as locationDetailReportSchema, S as scheduledAutomationSummarySchema, T as personalTokenListSchema, U as codeChangeSummarySchema, V as codeActivityDaySchema, W as codeOverviewReportSchema, _ as automationRunListSchema, a as workspaceBodySchema, b as automationSummarySchema, c as workspaceRepoSchema, d as automationExecutionSchema, f as automationExecutionStatusDaySchema, g as automationParamsSchema, h as automationListSchema, i as deleteWorkspaceResponseSchema, j as personParamsSchema, k as actorDirectoryReportSchema, l as workspaceSchema, m as automationListQuerySchema, n as statsReportSchema, o as workspaceListSchema, p as automationExecutionStatusSchema, q as apiErrorSchema, r as baselineSnapshotSchema, s as workspaceParamsSchema, t as statSchema, u as automationExecutionListSchema, v as automationRunSchema, w as createdPersonalTokenSchema, x as eventAutomationSummarySchema, y as automationRunWindowsSchema } from "../schema-DuGfOm4u.js";
4
- export { INPUT_IMAGE_TYPES, MAX_INPUT_IMAGES, MAX_INPUT_IMAGE_BYTES, acceptedConversationMessageSchema, actorDirectoryReportSchema, actorProfileReportSchema, apiErrorSchema, archiveConversationBodySchema, archiveConversationResponseSchema, automationExecutionListSchema, automationExecutionSchema, automationExecutionStatusDaySchema, automationExecutionStatusSchema, automationListQuerySchema, automationListSchema, automationParamsSchema, automationRunListSchema, automationRunSchema, automationRunWindowsSchema, automationSummarySchema, baselineSnapshotSchema, cancelConversationPendingMessagesBodySchema, cancelConversationPendingMessagesResponseSchema, codeActivityDaySchema, codeChangeSummaryReportSchema, codeChangeSummarySchema, codeOverviewReportSchema, codePersonReportSchema, codeRepositorySummarySchema, conversationActivityPreviewSchema, conversationAuxiliaryCostsSchema, conversationDetailQuerySchema, conversationDetailReportSchema, conversationEventHistorySchema, conversationEventPageSchema, conversationEventsQuerySchema, conversationFeedQuerySchema, conversationFeedSchema, conversationParamsSchema, conversationPendingAuthorizationSchema, conversationPendingMessageDeliverySchema, conversationPendingMessageSchema, conversationPendingMessagesReportSchema, conversationReportEventDataSchema, conversationReportEventSchema, conversationStatsReportSchema, conversationSummaryReportSchema, conversationTurnFailureCodeSchema, conversationTurnFailureReasonSchema, createConversationBodySchema, createConversationMessageBodySchema, createPersonalTokenBodySchema, createdPersonalTokenSchema, dailyConversationActivitySchema, deleteWorkspaceResponseSchema, eventAutomationSummarySchema, healthReportSchema, locationActivityDayReportSchema, locationDetailReportSchema, locationDirectoryReportSchema, locationParamsSchema, messageCardText, personParamsSchema, personalSpendReportSchema, personalTokenListSchema, personalTokenMetadataSchema, personalTokenParamsSchema, pluginOperationalReportFeedSchema, pluginOperationalReportSchema, pluginPackageContentItemReportSchema, pluginPackageContentReportSchema, pluginSchema, pluginsSchema, resolveMessageCards, revokePersonalTokenResponseSchema, runtimeInfoReportSchema, scheduledAutomationSummarySchema, skillReportSchema, skillReportsSchema, statSchema, statsReportSchema, webMessageId, workspaceBodySchema, workspaceListSchema, workspaceParamsSchema, workspaceRepoSchema, workspaceSchema };
1
+ import { A as MAX_INPUT_IMAGE_BYTES, C as conversationReportEventSchema, D as createConversationBodySchema, E as conversationSummaryReportSchema, J as conversationTurnFailureCodeSchema, M as INPUT_IMAGE_TYPES, O as createConversationMessageBodySchema, S as conversationReportEventDataSchema, T as conversationStatsReportSchema, V as messageCardText, W as resolveMessageCards, Y as conversationTurnFailureReasonSchema, _ as conversationParamsSchema, a as cancelConversationPendingMessagesBodySchema, b as conversationPendingMessageSchema, d as conversationDetailReportSchema, f as conversationEventHistorySchema, g as conversationFeedSchema, h as conversationFeedQuerySchema, i as archiveConversationResponseSchema, k as MAX_INPUT_IMAGES, l as conversationAuxiliaryCostsSchema, m as conversationEventsQuerySchema, o as cancelConversationPendingMessagesResponseSchema, p as conversationEventPageSchema, r as archiveConversationBodySchema, s as conversationActivityPreviewSchema, t as acceptedConversationMessageSchema, u as conversationDetailQuerySchema, v as conversationPendingAuthorizationSchema, x as conversationPendingMessagesReportSchema, y as conversationPendingMessageDeliverySchema } from "../conversation-C_aYrISI.js";
2
+ import { A as automationSummarySchema, B as pluginsSchema, C as automationListSchema, D as automationRunWindowsSchema, E as automationRunSchema, F as pluginOperationalReportFeedSchema, H as skillReportSchema, I as pluginOperationalReportSchema, L as pluginPackageContentItemReportSchema, M as eventAutomationSummarySchema, N as scheduledAutomationSummarySchema, O as automationScheduleIntentSchema, P as healthReportSchema, R as pluginPackageContentReportSchema, S as automationListQuerySchema, T as automationRunListSchema, U as skillReportsSchema, V as runtimeInfoReportSchema, _ as automationExecutionListSchema, b as automationExecutionStatusSchema, g as automationEventCatalogSchema, h as automationEditSchema, j as automationUpdateSchema, k as automationSchedulePreviewSchema, m as automationEditErrorSchema, t as webMessageId, v as automationExecutionSchema, w as automationParamsSchema, y as automationExecutionStatusDaySchema, z as pluginSchema } from "../web-message-id-CVVCTWUb.js";
3
+ import { A as codeChangeSummarySchema, C as locationParamsSchema, D as dailyConversationActivitySchema, F as codeRepositorySummarySchema, I as apiErrorSchema, M as codePersonReportSchema, N as codeRepositoryParamsSchema, O as codeActivityDaySchema, P as codeRepositoryReportSchema, S as locationDirectoryReportSchema, _ as actorProfileReportSchema, a as workspaceBodySchema, b as locationActivityDayReportSchema, c as workspaceRepoSchema, d as createdPersonalTokenSchema, f as personalTokenListSchema, g as actorDirectoryReportSchema, h as revokePersonalTokenResponseSchema, i as deleteWorkspaceResponseSchema, j as codeOverviewReportSchema, k as codeChangeSummaryReportSchema, l as workspaceSchema, m as personalTokenParamsSchema, n as statsReportSchema, o as workspaceListSchema, p as personalTokenMetadataSchema, r as baselineSnapshotSchema, s as workspaceParamsSchema, t as statSchema, u as createPersonalTokenBodySchema, v as personParamsSchema, x as locationDetailReportSchema, y as personalSpendReportSchema } from "../schema-CrdDxGbx.js";
4
+ export { INPUT_IMAGE_TYPES, MAX_INPUT_IMAGES, MAX_INPUT_IMAGE_BYTES, acceptedConversationMessageSchema, actorDirectoryReportSchema, actorProfileReportSchema, apiErrorSchema, archiveConversationBodySchema, archiveConversationResponseSchema, automationEditErrorSchema, automationEditSchema, automationEventCatalogSchema, automationExecutionListSchema, automationExecutionSchema, automationExecutionStatusDaySchema, automationExecutionStatusSchema, automationListQuerySchema, automationListSchema, automationParamsSchema, automationRunListSchema, automationRunSchema, automationRunWindowsSchema, automationScheduleIntentSchema, automationSchedulePreviewSchema, automationSummarySchema, automationUpdateSchema, baselineSnapshotSchema, cancelConversationPendingMessagesBodySchema, cancelConversationPendingMessagesResponseSchema, codeActivityDaySchema, codeChangeSummaryReportSchema, codeChangeSummarySchema, codeOverviewReportSchema, codePersonReportSchema, codeRepositoryParamsSchema, codeRepositoryReportSchema, codeRepositorySummarySchema, conversationActivityPreviewSchema, conversationAuxiliaryCostsSchema, conversationDetailQuerySchema, conversationDetailReportSchema, conversationEventHistorySchema, conversationEventPageSchema, conversationEventsQuerySchema, conversationFeedQuerySchema, conversationFeedSchema, conversationParamsSchema, conversationPendingAuthorizationSchema, conversationPendingMessageDeliverySchema, conversationPendingMessageSchema, conversationPendingMessagesReportSchema, conversationReportEventDataSchema, conversationReportEventSchema, conversationStatsReportSchema, conversationSummaryReportSchema, conversationTurnFailureCodeSchema, conversationTurnFailureReasonSchema, createConversationBodySchema, createConversationMessageBodySchema, createPersonalTokenBodySchema, createdPersonalTokenSchema, dailyConversationActivitySchema, deleteWorkspaceResponseSchema, eventAutomationSummarySchema, healthReportSchema, locationActivityDayReportSchema, locationDetailReportSchema, locationDirectoryReportSchema, locationParamsSchema, messageCardText, personParamsSchema, personalSpendReportSchema, personalTokenListSchema, personalTokenMetadataSchema, personalTokenParamsSchema, pluginOperationalReportFeedSchema, pluginOperationalReportSchema, pluginPackageContentItemReportSchema, pluginPackageContentReportSchema, pluginSchema, pluginsSchema, resolveMessageCards, revokePersonalTokenResponseSchema, runtimeInfoReportSchema, scheduledAutomationSummarySchema, skillReportSchema, skillReportsSchema, statSchema, statsReportSchema, webMessageId, workspaceBodySchema, workspaceListSchema, workspaceParamsSchema, workspaceRepoSchema, workspaceSchema };
package/dist/api.js CHANGED
@@ -1,19 +1,20 @@
1
- import { Ct as cancelHumanFacingPendingMessages, M as parseSlackThreadId, Nt as getConversation, b as readStats, k as readLiveAttachment } from "./agent-runner-BKOtZjez.js";
2
- import { d as logException, p as logWarn } from "./logging-BS563NYn.js";
1
+ import { Dt as cancelHumanFacingPendingMessages, J as editEventAutomation, L as editScheduledAutomation, Lt as getConversation, M as parseSlackThreadId, St as pluginEventCatalog, U as readScheduledAutomation, W as saveScheduledAutomation, X as eventAutomationTriggerAvailable, Y as AutomationEditError, at as saveEventAutomation, bt as getEventCatalog, ct as automationRevision, et as eventAutomationBelongsToUser, g as readStats, k as readLiveAttachment, lt as requireAutomationRevision, nt as getEventAutomation, ot as setEventAutomationStatus, st as AutomationConflictError } from "./agent-runner-BlDI1zV2.js";
2
+ import { d as logException, p as logWarn } from "./logging-F--48Q7Q.js";
3
3
  import { b as parseSlackMessageTs, h as parseSlackTeamId, p as parseSlackChannelId } from "./context-0Et9iVSB.js";
4
- import { $ as resolveViewerUser, $t as getConversationStore, At as conversationNotArchivedForEmail, Ct as createPluginLogger, D as SANDBOX_RUNTIME, Dt as conversationArchivedForUser, Et as conversationArchivedForEmail, Ft as readConversationEventPage, Gt as listConversationAnnotationsById, It as buildSentryConversationUrl, J as withSlackRetries, Mt as viewerConversationMembership, Ot as conversationHasParticipantEmail, Pt as readLatestConversationBrief, S as WorkspaceValidationError, Tt as conversationArchiveTimes, U as getSlackClient, Wt as listConversationAnnotations, Z as findUserByEmail, _ as deleteWorkspace, an as locationFromRow, b as listWorkspaces, dn as agentTurnUsageSchema, en as getDb, et as updateViewerDisplayName, fn as hasAgentTurnUsage, g as createWorkspace, j as workspaceRepoCheckoutPath, jt as conversationNotArchivedForUser, kt as conversationHasParticipantUser, pn as resolveRootConversationId, sn as parseSessionSource, tn as getSqlExecutor, u as getPlugins, v as getWorkspace, wt as readConversationAccessFromSql, x as updateWorkspace } from "./agent-hooks-DATy_Hnt.js";
4
+ import { At as conversationHasParticipantUser, C as WorkspaceValidationError, Dt as conversationArchivedForEmail, Et as conversationArchiveTimes, Ft as readLatestConversationBrief, Gt as listConversationAnnotations, It as readConversationEventPage, Kt as listConversationAnnotationsById, Lt as buildSentryConversationUrl, M as workspaceRepoCheckoutPath, Mt as conversationNotArchivedForUser, Nt as viewerConversationMembership, O as SANDBOX_RUNTIME, Ot as conversationArchivedForUser, Q as findUserByEmail, S as updateWorkspace, Tt as readConversationAccessFromSql, W as getSlackClient, Y as withSlackRetries, _ as deleteWorkspace, b as listWorkspaces, cn as parseSessionSource, en as getConversationStore, et as resolveViewerUser, fn as agentTurnUsageSchema, g as createWorkspace, jt as conversationNotArchivedForEmail, kt as conversationHasParticipantEmail, mn as resolveRootConversationId, nn as getSqlExecutor, on as locationFromRow, pn as hasAgentTurnUsage, tn as getDb, tt as updateViewerDisplayName, u as getPlugins, v as getWorkspace, wt as createPluginLogger, x as listWorkspacesByRepository } from "./agent-hooks-DS7k0ZWY.js";
5
5
  import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
6
- import { C as juniorCodeRepositories, D as juniorIdentities, E as juniorConversations, O as juniorUsers, S as juniorCodeChanges, T as conversationReadColumns, b as juniorApiTokens, g as juniorConversationBriefs, m as juniorConversationParticipants, v as juniorConversationMetrics, y as juniorConversationEvents } from "./executor-BGDb_cM-.js";
7
- import { D as createConversationBodySchema, M as INPUT_IMAGE_TYPES, O as createConversationMessageBodySchema, T as conversationStatsReportSchema, _ as conversationParamsSchema, a as cancelConversationPendingMessagesBodySchema, c as conversationAttachmentParamsSchema, d as conversationDetailReportSchema, g as conversationFeedSchema, h as conversationFeedQuerySchema, i as archiveConversationResponseSchema, j as readMessageAttachments, m as conversationEventsQuerySchema, o as cancelConversationPendingMessagesResponseSchema, p as conversationEventPageSchema, r as archiveConversationBodySchema, t as acceptedConversationMessageSchema, u as conversationDetailQuerySchema, x as conversationPendingMessagesReportSchema } from "./conversation-CPjHYOV5.js";
8
- import { n as hash, t as create } from "./profile-C4_njQYA.js";
9
- import { t as getCachedSnapshot } from "./resolve-ZDwJ6a3N.js";
10
- import { a as getVercelConversationWorkQueue } from "./job-queue-C5JaRRcE.js";
11
- import { C as skillReportsSchema, a as fillUtcHours, b as pluginsSchema, c as sumUtcHoursIntoSixHours, d as trailingUtcSixHourWindow, f as utcDayKey, h as pluginOperationalReportFeedSchema, i as fillUtcDays, l as trailingUtcDayWindow, m as healthReportSchema, n as DAY_MS$1, o as fillUtcSixHours, p as utcHourKey, r as HOUR_MS$1, s as startOfUtcHour, u as trailingUtcHourWindow, x as runtimeInfoReportSchema } from "./web-message-id-xPI_EFSC.js";
12
- import { F as createVercelAttachmentStorage, _ as readViewerAutomations, a as webActorFromEmail, b as clearSlackPendingReactions, c as getProductionSlackAdapter, d as ViewerTaskNotFoundError, f as deleteViewerTask, h as readViewerAutomationRuns, k as legacyWebMailboxMetadataSchema, l as formatSlackConversationRedactedLabel, m as readViewerAutomationExecutions, p as readConversationSourceTask, r as createAndEnqueueConversation, t as appendAndEnqueueWebMessage, u as resolveSlackConversationContextFromThreadId, x as lookupSlackUser, z as readHealthReport } from "./web-input-zUQoZMZw.js";
13
- import { A as conversationAggregateColumns, j as conversationRangeColumns, k as conversationActiveDaysColumn } from "./task-runner-D23tSETM.js";
14
- import { r as getWebAuthorization } from "./web-authorization-CVSTvY_D.js";
15
- import { t as decodeInputImages } from "./images-zuEwjVKU.js";
16
- import { A as actorProfileReportSchema, C as createPersonalTokenBodySchema, D as personalTokenParamsSchema, F as locationDirectoryReportSchema, G as codePersonReportSchema, I as locationParamsSchema, L as activityDays$1, M as personalSpendReportSchema, O as revokePersonalTokenResponseSchema, P as locationDetailReportSchema, R as activityHours$1, T as personalTokenListSchema, W as codeOverviewReportSchema, _ as automationRunListSchema, a as workspaceBodySchema, g as automationParamsSchema, h as automationListSchema, i as deleteWorkspaceResponseSchema, j as personParamsSchema, k as actorDirectoryReportSchema, l as workspaceSchema, m as automationListQuerySchema, n as statsReportSchema, o as workspaceListSchema, q as apiErrorSchema, s as workspaceParamsSchema, u as automationExecutionListSchema, w as createdPersonalTokenSchema, z as activitySixHours$1 } from "./schema-DuGfOm4u.js";
6
+ import { C as juniorCodeRepositories, D as juniorIdentities, E as juniorConversations, O as juniorUsers, S as juniorCodeChanges, T as conversationReadColumns, b as juniorApiTokens, g as juniorConversationBriefs, m as juniorConversationParticipants, v as juniorConversationMetrics, y as juniorConversationEvents } from "./executor-B9ksWZCv.js";
7
+ import { D as createConversationBodySchema, M as INPUT_IMAGE_TYPES, O as createConversationMessageBodySchema, T as conversationStatsReportSchema, _ as conversationParamsSchema, a as cancelConversationPendingMessagesBodySchema, c as conversationAttachmentParamsSchema, d as conversationDetailReportSchema, g as conversationFeedSchema, h as conversationFeedQuerySchema, i as archiveConversationResponseSchema, j as readMessageAttachments, m as conversationEventsQuerySchema, o as cancelConversationPendingMessagesResponseSchema, p as conversationEventPageSchema, r as archiveConversationBodySchema, t as acceptedConversationMessageSchema, u as conversationDetailQuerySchema, x as conversationPendingMessagesReportSchema } from "./conversation-C_aYrISI.js";
8
+ import { n as hash, t as create } from "./profile-DZ2DUdd1.js";
9
+ import { t as getCachedSnapshot } from "./resolve-Cuoj3MML.js";
10
+ import { a as getVercelConversationWorkQueue } from "./job-queue-CY1L2YRn.js";
11
+ import { c as ScheduleIntentError, d as getFirstRunAtMs, l as compileScheduleIntent } from "./types-Du-HbEun.js";
12
+ import { A as automationSummarySchema, B as pluginsSchema, C as automationListSchema, F as pluginOperationalReportFeedSchema, O as automationScheduleIntentSchema, P as healthReportSchema, S as automationListQuerySchema, T as automationRunListSchema, U as skillReportsSchema, V as runtimeInfoReportSchema, _ as automationExecutionListSchema, a as fillUtcHours, c as sumUtcHoursIntoSixHours, d as trailingUtcSixHourWindow, f as utcDayKey, g as automationEventCatalogSchema, h as automationEditSchema, i as fillUtcDays, j as automationUpdateSchema, k as automationSchedulePreviewSchema, l as trailingUtcDayWindow, m as automationEditErrorSchema, n as DAY_MS$1, o as fillUtcSixHours, p as utcHourKey, r as HOUR_MS$1, s as startOfUtcHour, u as trailingUtcHourWindow, w as automationParamsSchema, x as automationLifecycleSchema } from "./web-message-id-CVVCTWUb.js";
13
+ import { F as createVercelAttachmentStorage, _ as readViewerAutomations, a as webActorFromEmail, b as clearSlackPendingReactions, c as getProductionSlackAdapter, d as ViewerTaskNotFoundError, f as deleteViewerTask, g as readViewerAutomationSummary, h as readViewerAutomationRuns, k as legacyWebMailboxMetadataSchema, l as formatSlackConversationRedactedLabel, m as readViewerAutomationExecutions, p as readConversationSourceTask, r as createAndEnqueueConversation, t as appendAndEnqueueWebMessage, u as resolveSlackConversationContextFromThreadId, x as lookupSlackUser, z as readHealthReport } from "./web-input-B3k0J7WB.js";
14
+ import { A as conversationAggregateColumns, j as conversationRangeColumns, k as conversationActiveDaysColumn } from "./task-runner-B0-P_3aq.js";
15
+ import { r as getWebAuthorization } from "./web-authorization-Cu33voNg.js";
16
+ import { t as decodeInputImages } from "./images-CEXcQ0Id.js";
17
+ import { C as locationParamsSchema, E as activitySixHours$1, I as apiErrorSchema, M as codePersonReportSchema, N as codeRepositoryParamsSchema, P as codeRepositoryReportSchema, S as locationDirectoryReportSchema, T as activityHours$1, _ as actorProfileReportSchema, a as workspaceBodySchema, d as createdPersonalTokenSchema, f as personalTokenListSchema, g as actorDirectoryReportSchema, h as revokePersonalTokenResponseSchema, i as deleteWorkspaceResponseSchema, j as codeOverviewReportSchema, l as workspaceSchema, m as personalTokenParamsSchema, n as statsReportSchema, o as workspaceListSchema, s as workspaceParamsSchema, u as createPersonalTokenBodySchema, v as personParamsSchema, w as activityDays$1, x as locationDetailReportSchema, y as personalSpendReportSchema } from "./schema-CrdDxGbx.js";
17
18
  import { Hono } from "hono";
18
19
  import path from "node:path";
19
20
  import { z } from "zod";
@@ -996,7 +997,26 @@ function conversationFeedMembershipFilter(status, filter) {
996
997
  participantMatch: conversationHasParticipantEmail(filter.email)
997
998
  }), status === "archived" ? conversationArchivedForEmail(filter.email) : status === "all" ? void 0 : conversationNotArchivedForEmail(filter.email));
998
999
  }
999
- async function conversationRows(db, limit, status, filter, query, includePrivateBriefs = false) {
1000
+ /**
1001
+ * Keep root conversations linked to one code repository. A code change can
1002
+ * link a child conversation, so linked ids resolve to their root. Private
1003
+ * roots stay visible only to their members.
1004
+ */
1005
+ function conversationCodeRepositoryFilter(repositoryId, viewerUserId) {
1006
+ return and(sql`${juniorConversations.conversationId} IN (
1007
+ SELECT coalesce(linked.root_conversation_id, linked.conversation_id)
1008
+ FROM ${juniorConversations} AS linked
1009
+ WHERE linked.conversation_id IN (
1010
+ SELECT unnest(${juniorCodeChanges.conversationIds})
1011
+ FROM ${juniorCodeChanges}
1012
+ WHERE ${juniorCodeChanges.repositoryId} = ${repositoryId}
1013
+ )
1014
+ )`, or(eq(juniorDestinations.visibility, "public"), viewerUserId ? viewerConversationMembership({
1015
+ actorMatch: eq(juniorIdentities.userId, viewerUserId),
1016
+ participantMatch: conversationHasParticipantUser(viewerUserId)
1017
+ }) : void 0));
1018
+ }
1019
+ async function conversationRows(db, limit, status, filter, query, includePrivateBriefs = false, codeRepository) {
1000
1020
  return db.select({
1001
1021
  conversation: conversationReadColumns(),
1002
1022
  location: juniorDestinations,
@@ -1007,7 +1027,7 @@ async function conversationRows(db, limit, status, filter, query, includePrivate
1007
1027
  identitySubjectId: juniorIdentities.providerSubjectId,
1008
1028
  identityTenantId: juniorIdentities.providerTenantId,
1009
1029
  userDisplayName: juniorUsers.displayName
1010
- }).from(juniorConversations).leftJoin(juniorDestinations, eq(juniorDestinations.id, juniorConversations.destinationId)).leftJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId)).leftJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(and(isNull(juniorConversations.parentConversationId), conversationFeedMembershipFilter(status, filter), query ? or(sql`strpos(lower(coalesce(${juniorConversations.title}, '')), ${query}) > 0`, sql`exists (
1030
+ }).from(juniorConversations).leftJoin(juniorDestinations, eq(juniorDestinations.id, juniorConversations.destinationId)).leftJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId)).leftJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(and(isNull(juniorConversations.parentConversationId), conversationFeedMembershipFilter(status, filter), codeRepository ? conversationCodeRepositoryFilter(codeRepository.id, codeRepository.viewerUserId) : void 0, query ? or(sql`strpos(lower(coalesce(${juniorConversations.title}, '')), ${query}) > 0`, sql`exists (
1011
1031
  select 1
1012
1032
  from ${juniorConversationBriefs}
1013
1033
  where ${juniorConversationBriefs.conversationId} = ${juniorConversations.conversationId}
@@ -1091,13 +1111,20 @@ function conversationFeedFilter(options) {
1091
1111
  * Build a bounded dashboard feed. Prefer the viewer user when present; otherwise
1092
1112
  * keep only roots linked to actorEmail before applying the limit. Membership is
1093
1113
  * root-actor ownership or a materialized participant row for that person.
1114
+ *
1115
+ * `codeRepositoryId` replaces membership with every root linked to that
1116
+ * repository's code changes. Private roots appear only for their members, and
1117
+ * per-person archive state does not hide rows.
1094
1118
  */
1095
1119
  async function readConversationFeedFromSql(options = {}) {
1096
1120
  const nowMs = Date.now();
1097
1121
  const db = getDb();
1098
- const filter = conversationFeedFilter(options);
1122
+ const filter = options.codeRepositoryId ? void 0 : conversationFeedFilter(options);
1099
1123
  const query = options.q?.trim().toLowerCase() || void 0;
1100
- const rows = await conversationRows(db, options.limit ?? CONVERSATION_FEED_LIMIT, query ? "all" : options.status ?? "active", filter, query, filter?.kind === "viewer");
1124
+ const rows = await conversationRows(db, options.limit ?? CONVERSATION_FEED_LIMIT, query || options.codeRepositoryId ? "all" : options.status ?? "active", filter, query, filter?.kind === "viewer", options.codeRepositoryId ? {
1125
+ id: options.codeRepositoryId,
1126
+ ...options.viewer ? { viewerUserId: options.viewer.id } : void 0
1127
+ } : void 0);
1101
1128
  const conversations = rows.map((row) => conversationFromRow(row));
1102
1129
  const conversationIds = conversations.map((conversation) => conversation.conversationId);
1103
1130
  const [accessByConversation, archiveTimesByConversation, annotationsByConversation, auxiliaryCostsByRoot, metricsByRoot, participantsByConversation, teamDomainByTeamId, conversationWork, lastUserMessageAtByConversation, activityPreviewByConversation] = await Promise.all([
@@ -1819,10 +1846,11 @@ function createConversationRoutes(options) {
1819
1846
  }
1820
1847
  });
1821
1848
  app.get("/", validateRequest("query", conversationFeedQuerySchema, "Invalid query parameters."), async (context) => {
1822
- const { actorEmail, q, status } = context.req.valid("query");
1849
+ const { actorEmail, codeRepositoryId, q, status } = context.req.valid("query");
1823
1850
  const viewer = context.get("viewer");
1824
1851
  return jsonResponse(conversationFeedSchema, await readConversationFeed({
1825
1852
  ...actorEmail ? { actorEmail } : void 0,
1853
+ ...codeRepositoryId ? { codeRepositoryId } : void 0,
1826
1854
  ...q ? { q } : void 0,
1827
1855
  status,
1828
1856
  ...viewer ? { viewer } : void 0
@@ -1993,17 +2021,18 @@ function ownedByUserSql(conversationIds, userId) {
1993
2021
  WHERE identities.user_id = ${userId}
1994
2022
  )`;
1995
2023
  }
1996
- function ownershipFilter(userId) {
1997
- if (!userId) return void 0;
1998
- return ownedByUserSql(sql`${juniorCodeChanges.conversationIds}`, userId);
2024
+ /** Limit code changes to one person's conversations or one repository. */
2025
+ function changeScopeFilter(args) {
2026
+ return and(args.userId ? ownedByUserSql(sql`${juniorCodeChanges.conversationIds}`, args.userId) : void 0, args.repositoryId ? eq(juniorCodeChanges.repositoryId, args.repositoryId) : void 0);
1999
2027
  }
2028
+ /** Read windowed code summary and activity buckets for an optional scope. */
2000
2029
  async function readCodeWindows(args) {
2001
2030
  const db = getDb();
2002
2031
  const windowEnd = new Date(args.nowMs);
2003
2032
  const windowStart = /* @__PURE__ */ new Date(args.nowMs - WINDOW_DAYS * DAY_MS);
2004
2033
  const activityStart = startOfUtcDay(args.nowMs - 89 * DAY_MS);
2005
2034
  const changes = juniorCodeChanges;
2006
- const ownership = ownershipFilter(args.userId);
2035
+ const scope = changeScopeFilter(args);
2007
2036
  const conversationTreeCost = conversationTreeCostExpr();
2008
2037
  const activityHourEnd = new Date(args.nowMs);
2009
2038
  activityHourEnd.setUTCMinutes(0, 0, 0);
@@ -2019,7 +2048,7 @@ async function readCodeWindows(args) {
2019
2048
  ${changes.state},
2020
2049
  ${changes.conversationIds} AS conversation_ids
2021
2050
  FROM ${changes}
2022
- ${ownership ? sql`WHERE ${ownership}` : sql``}
2051
+ ${scope ? sql`WHERE ${scope}` : sql``}
2023
2052
  ), change_costs AS (
2024
2053
  SELECT
2025
2054
  recent_changes.id,
@@ -2085,18 +2114,18 @@ async function readCodeWindows(args) {
2085
2114
  SELECT ${changes.openedAt} AS event_at, 'created'::text AS kind
2086
2115
  FROM ${changes}
2087
2116
  WHERE ${changes.openedAt} >= ${activityStart}
2088
- ${ownership ? sql`AND ${ownership}` : sql``}
2117
+ ${scope ? sql`AND ${scope}` : sql``}
2089
2118
  UNION ALL
2090
2119
  SELECT ${changes.mergedAt} AS event_at, 'merged'::text AS kind
2091
2120
  FROM ${changes}
2092
2121
  WHERE ${changes.mergedAt} >= ${activityStart}
2093
- ${ownership ? sql`AND ${ownership}` : sql``}
2122
+ ${scope ? sql`AND ${scope}` : sql``}
2094
2123
  UNION ALL
2095
2124
  SELECT ${changes.closedAt} AS event_at, 'closed'::text AS kind
2096
2125
  FROM ${changes}
2097
2126
  WHERE ${changes.state} = 'closed'
2098
2127
  AND ${changes.closedAt} >= ${activityStart}
2099
- ${ownership ? sql`AND ${ownership}` : sql``}
2128
+ ${scope ? sql`AND ${scope}` : sql``}
2100
2129
  ) AS events
2101
2130
  GROUP BY date_trunc('day', event_at AT TIME ZONE 'UTC')
2102
2131
  )
@@ -2126,18 +2155,18 @@ async function readCodeWindows(args) {
2126
2155
  SELECT ${changes.openedAt} AS event_at, 'created'::text AS kind
2127
2156
  FROM ${changes}
2128
2157
  WHERE ${changes.openedAt} >= ${activityHourStart}
2129
- ${ownership ? sql`AND ${ownership}` : sql``}
2158
+ ${scope ? sql`AND ${scope}` : sql``}
2130
2159
  UNION ALL
2131
2160
  SELECT ${changes.mergedAt} AS event_at, 'merged'::text AS kind
2132
2161
  FROM ${changes}
2133
2162
  WHERE ${changes.mergedAt} >= ${activityHourStart}
2134
- ${ownership ? sql`AND ${ownership}` : sql``}
2163
+ ${scope ? sql`AND ${scope}` : sql``}
2135
2164
  UNION ALL
2136
2165
  SELECT ${changes.closedAt} AS event_at, 'closed'::text AS kind
2137
2166
  FROM ${changes}
2138
2167
  WHERE ${changes.state} = 'closed'
2139
2168
  AND ${changes.closedAt} >= ${activityHourStart}
2140
- ${ownership ? sql`AND ${ownership}` : sql``}
2169
+ ${scope ? sql`AND ${scope}` : sql``}
2141
2170
  ) AS events
2142
2171
  GROUP BY date_trunc('hour', event_at AT TIME ZONE 'UTC')
2143
2172
  )
@@ -2182,6 +2211,30 @@ async function readCodeWindows(args) {
2182
2211
  windowStart
2183
2212
  };
2184
2213
  }
2214
+ /** Columns read for one code change report row. */
2215
+ const codeChangeReportColumns = {
2216
+ closedAt: juniorCodeChanges.closedAt,
2217
+ id: juniorCodeChanges.id,
2218
+ mergedAt: juniorCodeChanges.mergedAt,
2219
+ number: juniorCodeChanges.number,
2220
+ openedAt: juniorCodeChanges.openedAt,
2221
+ provider: juniorCodeChanges.provider,
2222
+ repository: juniorCodeRepositories.name,
2223
+ state: juniorCodeChanges.state,
2224
+ title: juniorCodeChanges.title,
2225
+ url: juniorCodeChanges.url
2226
+ };
2227
+ /** Convert one code change row to its report shape. */
2228
+ function codeChangeReport(change) {
2229
+ return {
2230
+ ...change,
2231
+ closedAt: change.closedAt?.toISOString(),
2232
+ mergedAt: change.mergedAt?.toISOString(),
2233
+ openedAt: change.openedAt.toISOString(),
2234
+ title: change.title ?? void 0,
2235
+ url: change.url ?? void 0
2236
+ };
2237
+ }
2185
2238
  /** Read code activity created by Junior across installed code plugins. */
2186
2239
  async function readCodeOverview(nowMs = Date.now()) {
2187
2240
  const db = getDb();
@@ -2247,30 +2300,12 @@ async function readCodeOverview(nowMs = Date.now()) {
2247
2300
  GROUP BY ${repositories.id}
2248
2301
  ORDER BY "merged" DESC, "created" DESC, ${repositories.name} ASC
2249
2302
  LIMIT 25
2250
- `), db.select({
2251
- closedAt: changes.closedAt,
2252
- id: changes.id,
2253
- mergedAt: changes.mergedAt,
2254
- number: changes.number,
2255
- openedAt: changes.openedAt,
2256
- provider: changes.provider,
2257
- repository: repositories.name,
2258
- state: changes.state,
2259
- title: changes.title,
2260
- url: changes.url
2261
- }).from(changes).innerJoin(repositories, eq(changes.repositoryId, repositories.id)).where(or(gte(changes.openedAt, windows.windowStart), gte(changes.mergedAt, windows.windowStart), gte(changes.closedAt, windows.windowStart), eq(changes.state, "open"))).orderBy(desc(changes.updatedAt)).limit(25)]);
2303
+ `), db.select(codeChangeReportColumns).from(changes).innerJoin(repositories, eq(changes.repositoryId, repositories.id)).where(or(gte(changes.openedAt, windows.windowStart), gte(changes.mergedAt, windows.windowStart), gte(changes.closedAt, windows.windowStart), eq(changes.state, "open"))).orderBy(desc(changes.updatedAt)).limit(25)]);
2262
2304
  return codeOverviewReportSchema.parse({
2263
2305
  activityDays: windows.activityDays,
2264
2306
  activityHours: windows.activityHours,
2265
2307
  activitySixHours: windows.activitySixHours,
2266
- changes: recentChanges.map((change) => ({
2267
- ...change,
2268
- closedAt: change.closedAt?.toISOString(),
2269
- mergedAt: change.mergedAt?.toISOString(),
2270
- openedAt: change.openedAt.toISOString(),
2271
- title: change.title ?? void 0,
2272
- url: change.url ?? void 0
2273
- })),
2308
+ changes: recentChanges.map(codeChangeReport),
2274
2309
  generatedAt: windows.windowEnd.toISOString(),
2275
2310
  repositories: z.array(repositoryRowSchema).parse(queryRows(repositoryResult)).map((repository) => ({
2276
2311
  ...repository,
@@ -2302,11 +2337,61 @@ async function readPersonCodeOverview(args) {
2302
2337
  });
2303
2338
  }
2304
2339
  //#endregion
2340
+ //#region src/api/code/repository.ts
2341
+ /** Most recent code changes listed on one repository page. */
2342
+ const REPOSITORY_CHANGE_LIMIT = 100;
2343
+ /**
2344
+ * Read code activity for one repository: windowed summary, activity buckets,
2345
+ * recent code changes, and the Workspaces that include it.
2346
+ */
2347
+ async function readCodeRepository(repositoryId, nowMs = Date.now()) {
2348
+ const db = getDb();
2349
+ const [repository] = await db.select({
2350
+ id: juniorCodeRepositories.id,
2351
+ name: juniorCodeRepositories.name,
2352
+ provider: juniorCodeRepositories.provider,
2353
+ url: juniorCodeRepositories.url
2354
+ }).from(juniorCodeRepositories).where(eq(juniorCodeRepositories.id, repositoryId)).limit(1);
2355
+ if (!repository) return void 0;
2356
+ const [windows, changes, workspaces] = await Promise.all([
2357
+ readCodeWindows({
2358
+ nowMs,
2359
+ repositoryId
2360
+ }),
2361
+ db.select(codeChangeReportColumns).from(juniorCodeChanges).innerJoin(juniorCodeRepositories, eq(juniorCodeChanges.repositoryId, juniorCodeRepositories.id)).where(eq(juniorCodeChanges.repositoryId, repositoryId)).orderBy(desc(juniorCodeChanges.updatedAt)).limit(REPOSITORY_CHANGE_LIMIT),
2362
+ listWorkspacesByRepository(db, {
2363
+ provider: repository.provider,
2364
+ repo: repository.name
2365
+ })
2366
+ ]);
2367
+ return codeRepositoryReportSchema.parse({
2368
+ activityDays: windows.activityDays,
2369
+ activityHours: windows.activityHours,
2370
+ activitySixHours: windows.activitySixHours,
2371
+ changes: changes.map(codeChangeReport),
2372
+ generatedAt: windows.windowEnd.toISOString(),
2373
+ repository: {
2374
+ ...repository,
2375
+ url: repository.url ?? void 0
2376
+ },
2377
+ summary: windows.summary,
2378
+ windowEnd: windows.windowEnd.toISOString(),
2379
+ windowStart: windows.windowStart.toISOString(),
2380
+ workspaces
2381
+ });
2382
+ }
2383
+ //#endregion
2305
2384
  //#region src/api/code/routes.ts
2306
2385
  /** Create the code analytics API. */
2307
2386
  function createCodeRoutes() {
2308
2387
  const app = new Hono();
2309
2388
  app.get("/", async () => jsonResponse(codeOverviewReportSchema, await readCodeOverview()));
2389
+ app.get("/repositories/:repositoryId", validateRequest("param", codeRepositoryParamsSchema, "Invalid route parameters."), async (context) => {
2390
+ const { repositoryId } = context.req.valid("param");
2391
+ const report = await readCodeRepository(repositoryId);
2392
+ if (!report) throwApiError(404, "Repository not found.");
2393
+ return jsonResponse(codeRepositoryReportSchema, report);
2394
+ });
2310
2395
  return app;
2311
2396
  }
2312
2397
  //#endregion
@@ -3059,7 +3144,7 @@ async function readPeoplePluginReports(args) {
3059
3144
  reports: [],
3060
3145
  source: "plugins"
3061
3146
  });
3062
- const { getPluginProfileReports } = await import("./agent-hooks-DATy_Hnt.js").then((n) => n.t);
3147
+ const { getPluginProfileReports } = await import("./agent-hooks-DS7k0ZWY.js").then((n) => n.t);
3063
3148
  return pluginOperationalReportFeedSchema.parse({
3064
3149
  generatedAt: new Date(nowMs).toISOString(),
3065
3150
  reports: await getPluginProfileReports({
@@ -3507,7 +3592,164 @@ function createUserPageRoutes() {
3507
3592
  return app;
3508
3593
  }
3509
3594
  //#endregion
3595
+ //#region src/chat/automations/edit.ts
3596
+ /** Creator-only web edits. Public read access never grants write authority. */
3597
+ async function requireOwnedAutomation(user, kind, id) {
3598
+ if (kind === "scheduled") {
3599
+ const task = await readScheduledAutomation(getDb(), id);
3600
+ if (!task || task.status === "deleted" || !user.identities.some((identity) => identity.id === task.creatorIdentityId)) throw new ViewerTaskNotFoundError();
3601
+ return {
3602
+ kind,
3603
+ task
3604
+ };
3605
+ }
3606
+ const task = await getEventAutomation(getDb(), id);
3607
+ if (!task || task.status === "deleted" || !eventAutomationBelongsToUser(task, user)) throw new ViewerTaskNotFoundError();
3608
+ return {
3609
+ kind,
3610
+ task
3611
+ };
3612
+ }
3613
+ function editView(automation) {
3614
+ const { task } = automation;
3615
+ const common = {
3616
+ id: task.id,
3617
+ revision: automationRevision(task),
3618
+ title: task.title ?? null,
3619
+ instruction: task.task.text,
3620
+ credentialMode: task.credentialMode,
3621
+ outcomes: task.outcomes,
3622
+ destination: task.destination,
3623
+ createdBy: task.createdBy
3624
+ };
3625
+ if (automation.kind === "scheduled") {
3626
+ const status = automation.task.status;
3627
+ if (status === "deleted") throw new ViewerTaskNotFoundError();
3628
+ return {
3629
+ ...common,
3630
+ kind: "scheduled",
3631
+ status,
3632
+ schedule: automation.task.schedule,
3633
+ nextRunAtMs: automation.task.nextRunAtMs
3634
+ };
3635
+ }
3636
+ return {
3637
+ ...common,
3638
+ kind: "event",
3639
+ status: automation.task.status === "paused" ? "paused" : "active",
3640
+ trigger: automation.task.trigger,
3641
+ triggerAvailable: eventAutomationTriggerAvailable(automation.task, getEventCatalog())
3642
+ };
3643
+ }
3644
+ /** Load exact editable values by ID, independent of list filters. */
3645
+ async function readViewerAutomationEdit(user, kind, id) {
3646
+ return editView(await requireOwnedAutomation(user, kind, id));
3647
+ }
3648
+ /** Save a partial edit against the read revision, without dispatching work. */
3649
+ async function updateViewerAutomation(user, id, input) {
3650
+ const current = await requireOwnedAutomation(user, input.kind, id);
3651
+ requireAutomationRevision(current.task, input.revision);
3652
+ if (input.kind === "scheduled" && current.kind === "scheduled") {
3653
+ const next = await editScheduledAutomation(current.task, input, true, Date.now());
3654
+ return editView({
3655
+ kind: "scheduled",
3656
+ task: await saveScheduledAutomation(getDb(), next, input.revision)
3657
+ });
3658
+ }
3659
+ if (input.kind === "event" && current.kind === "event") {
3660
+ const next = await editEventAutomation(current.task, input, true, getEventCatalog());
3661
+ const task = await saveEventAutomation(getDb(), next, input.revision);
3662
+ if (!task) throw new ViewerTaskNotFoundError();
3663
+ return editView({
3664
+ kind: "event",
3665
+ task
3666
+ });
3667
+ }
3668
+ throw new ViewerTaskNotFoundError();
3669
+ }
3670
+ /** Pause or resume future triggers. Already-claimed work can finish. */
3671
+ async function changeViewerAutomationLifecycle(user, kind, id, input) {
3672
+ const current = await requireOwnedAutomation(user, kind, id);
3673
+ requireAutomationRevision(current.task, input.revision);
3674
+ const status = current.task.status;
3675
+ if (status === "completed") throw new AutomationEditError("Completed Automations cannot be restarted.");
3676
+ if (input.action === "pause" && status === "paused") return editView(current);
3677
+ if (input.action === "resume" && status !== "paused" && status !== "blocked") throw new AutomationEditError("Only paused or blocked Automations can be resumed.");
3678
+ if (current.kind === "event") return editView({
3679
+ kind: "event",
3680
+ task: await setEventAutomationStatus(getDb(), id, input.action === "pause" ? "paused" : "active", input.revision)
3681
+ });
3682
+ const nowMs = Date.now();
3683
+ const next = {
3684
+ ...current.task,
3685
+ updatedAtMs: nowMs,
3686
+ runNowAtMs: void 0
3687
+ };
3688
+ if (input.action === "pause") {
3689
+ next.status = "paused";
3690
+ if (status === "blocked") next.statusReason ??= "A requirement blocked this Automation. Inspect its executions before resuming.";
3691
+ } else {
3692
+ next.status = status === "paused" && next.statusReason ? "blocked" : "active";
3693
+ if (next.status === "active") {
3694
+ next.nextRunAtMs = next.schedule.recurrence ? getFirstRunAtMs({
3695
+ afterMs: nowMs,
3696
+ recurrence: next.schedule.recurrence,
3697
+ timezone: next.schedule.timezone
3698
+ }) : next.nextRunAtMs;
3699
+ if (!next.nextRunAtMs || next.nextRunAtMs <= nowMs) throw new AutomationEditError("This Schedule has no future occurrence. Set a future Schedule before resuming.", "schedule");
3700
+ next.statusReason = void 0;
3701
+ }
3702
+ }
3703
+ return editView({
3704
+ kind: "scheduled",
3705
+ task: await saveScheduledAutomation(getDb(), next, input.revision)
3706
+ });
3707
+ }
3708
+ //#endregion
3709
+ //#region src/chat/automations/editor.ts
3710
+ /** Read-only editor support. Core owns schedules; plugins own Event choices. */
3711
+ /** Return only Event types that can start a durable Automation. */
3712
+ function readAutomationEventCatalog() {
3713
+ return Object.entries(pluginEventCatalog(getEventCatalog())).flatMap(([namespace, registration]) => registration.resourceTypes.map((resource) => ({
3714
+ namespace,
3715
+ ...resource
3716
+ })));
3717
+ }
3718
+ /** Preview a creator's draft with the same clock and compiler used by saving. */
3719
+ async function previewAutomationSchedule(user, id, intent) {
3720
+ const automation = await readViewerAutomationEdit(user, "scheduled", id);
3721
+ if (automation.kind !== "scheduled") throw new Error("Expected scheduled Automation");
3722
+ if (automation.status === "completed") throw new AutomationEditError("Completed automations cannot be edited.", "schedule");
3723
+ try {
3724
+ return compileScheduleIntent({
3725
+ defaultTimezone: automation.schedule.timezone,
3726
+ intent,
3727
+ nowMs: Date.now()
3728
+ });
3729
+ } catch (error) {
3730
+ if (error instanceof ScheduleIntentError) throw new AutomationEditError(error.message, "schedule");
3731
+ throw error;
3732
+ }
3733
+ }
3734
+ //#endregion
3510
3735
  //#region src/api/automations/routes.ts
3736
+ /** Translate expected edit failures; unexpected failures stay at the API boundary. */
3737
+ function editErrorResponse(error) {
3738
+ if (error instanceof ViewerTaskNotFoundError) return jsonResponse(automationEditErrorSchema, {
3739
+ error: "Automation was not found.",
3740
+ code: "not_found"
3741
+ }, { status: 404 });
3742
+ if (error instanceof AutomationConflictError) return jsonResponse(automationEditErrorSchema, {
3743
+ error: error.message,
3744
+ code: "conflict"
3745
+ }, { status: 409 });
3746
+ if (error instanceof AutomationEditError) return jsonResponse(automationEditErrorSchema, {
3747
+ error: error.message,
3748
+ code: "invalid_edit",
3749
+ ...error.field ? { fields: { [error.field]: [error.message] } } : void 0
3750
+ }, { status: 400 });
3751
+ throw error;
3752
+ }
3511
3753
  /** Create authenticated native task list and action routes. */
3512
3754
  function createAutomationRoutes() {
3513
3755
  const app = new Hono();
@@ -3516,6 +3758,16 @@ function createAutomationRoutes() {
3516
3758
  const query = context.req.valid("query");
3517
3759
  return jsonResponse(automationListSchema, await readViewerAutomations(user, query));
3518
3760
  });
3761
+ app.get("/event-catalog", requireViewer, () => {
3762
+ return jsonResponse(automationEventCatalogSchema, readAutomationEventCatalog());
3763
+ });
3764
+ app.post("/scheduled/:id/preview", requireViewer, validateRequest("json", automationScheduleIntentSchema, "Invalid schedule."), async (context) => {
3765
+ try {
3766
+ return jsonResponse(automationSchedulePreviewSchema, await previewAutomationSchedule(context.get("viewer"), context.req.param("id"), context.req.valid("json")));
3767
+ } catch (error) {
3768
+ return editErrorResponse(error);
3769
+ }
3770
+ });
3519
3771
  app.get("/runs", requireViewer, async (context) => {
3520
3772
  const user = context.get("viewer");
3521
3773
  return jsonResponse(automationRunListSchema, await readViewerAutomationRuns(user));
@@ -3530,6 +3782,49 @@ function createAutomationRoutes() {
3530
3782
  throw error;
3531
3783
  }
3532
3784
  });
3785
+ app.get("/:kind/:id/edit", requireViewer, validateRequest("param", automationParamsSchema, "Invalid Automation."), async (context) => {
3786
+ const { kind, id } = context.req.valid("param");
3787
+ try {
3788
+ return jsonResponse(automationEditSchema, await readViewerAutomationEdit(context.get("viewer"), kind, id));
3789
+ } catch (error) {
3790
+ return editErrorResponse(error);
3791
+ }
3792
+ });
3793
+ app.post("/:kind/:id/lifecycle", requireViewer, validateRequest("param", automationParamsSchema, "Invalid Automation."), validateRequest("json", automationLifecycleSchema, "Invalid lifecycle action."), async (context) => {
3794
+ const { kind, id } = context.req.valid("param");
3795
+ try {
3796
+ return jsonResponse(automationEditSchema, await changeViewerAutomationLifecycle(context.get("viewer"), kind, id, context.req.valid("json")));
3797
+ } catch (error) {
3798
+ return editErrorResponse(error);
3799
+ }
3800
+ });
3801
+ app.patch("/:kind/:id", requireViewer, validateRequest("param", automationParamsSchema, "Invalid Automation."), zValidator("json", automationUpdateSchema, (result) => {
3802
+ if (!result.success) {
3803
+ const fields = {};
3804
+ for (const issue of result.error.issues) {
3805
+ const field = issue.path.join(".") || "save";
3806
+ (fields[field] ??= []).push(issue.message);
3807
+ }
3808
+ return jsonResponse(automationEditErrorSchema, {
3809
+ error: "Invalid Automation edit.",
3810
+ code: "invalid_edit",
3811
+ fields
3812
+ }, { status: 400 });
3813
+ }
3814
+ }), async (context) => {
3815
+ const { kind, id } = context.req.valid("param");
3816
+ const input = context.req.valid("json");
3817
+ try {
3818
+ if (input.kind !== kind) throw new AutomationEditError("The trigger type cannot change.", "kind");
3819
+ return jsonResponse(automationEditSchema, await updateViewerAutomation(context.get("viewer"), id, input));
3820
+ } catch (error) {
3821
+ return editErrorResponse(error);
3822
+ }
3823
+ });
3824
+ app.get("/:id", requireViewer, async (context) => {
3825
+ const automation = await readViewerAutomationSummary(context.get("viewer"), context.req.param("id"));
3826
+ return automation ? jsonResponse(automationSummarySchema, automation) : jsonResponse(apiErrorSchema, { error: "Automation was not found." }, { status: 404 });
3827
+ });
3533
3828
  app.delete("/:kind/:id", requireViewer, validateRequest("param", automationParamsSchema, "Invalid task."), async (context) => {
3534
3829
  const user = context.get("viewer");
3535
3830
  const params = context.req.valid("param");
@@ -3668,7 +3963,7 @@ function readDescriptionText(home) {
3668
3963
  }
3669
3964
  /** Read discovered skill names for authenticated runtime diagnostics. */
3670
3965
  async function readSkillReports() {
3671
- const { discoverSkills } = await import("./skills-CN-ye6on.js").then((n) => n.o);
3966
+ const { discoverSkills } = await import("./skills-DAegjk5Y.js").then((n) => n.o);
3672
3967
  const skills = await discoverSkills();
3673
3968
  return skillReportsSchema.parse(skills.map((skill) => ({
3674
3969
  name: skill.name,
@@ -3677,7 +3972,7 @@ async function readSkillReports() {
3677
3972
  }
3678
3973
  /** Read safe configured plugin metadata for authenticated runtime diagnostics. */
3679
3974
  async function readPlugins() {
3680
- const { pluginCatalogRuntime } = await import("./catalog-runtime-xFtmw3oA.js").then((n) => n.t);
3975
+ const { pluginCatalogRuntime } = await import("./catalog-runtime-B9u_3-GW.js").then((n) => n.t);
3681
3976
  return pluginsSchema.parse(pluginCatalogRuntime.getProviders().map((plugin) => ({
3682
3977
  configKeys: plugin.manifest.configKeys ?? [],
3683
3978
  description: plugin.manifest.description,
@@ -3689,7 +3984,7 @@ async function readPlugins() {
3689
3984
  async function readRuntimeInfoReport() {
3690
3985
  const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
3691
3986
  import("./package-discovery-7a9YqLhE.js").then((n) => n.r),
3692
- import("./catalog-runtime-xFtmw3oA.js").then((n) => n.t),
3987
+ import("./catalog-runtime-B9u_3-GW.js").then((n) => n.t),
3693
3988
  readPlugins(),
3694
3989
  readSkillReports()
3695
3990
  ]);
@@ -3706,7 +4001,7 @@ async function readRuntimeInfoReport() {
3706
4001
  /** Read sanitized operational summaries contributed by plugins. */
3707
4002
  async function readPluginOperationalReportFeed() {
3708
4003
  const nowMs = Date.now();
3709
- const { getPluginOperationalReports } = await import("./agent-hooks-DATy_Hnt.js").then((n) => n.t);
4004
+ const { getPluginOperationalReports } = await import("./agent-hooks-DS7k0ZWY.js").then((n) => n.t);
3710
4005
  return pluginOperationalReportFeedSchema.parse({
3711
4006
  source: "plugins",
3712
4007
  generatedAt: new Date(nowMs).toISOString(),
@@ -54,7 +54,7 @@ interface BotModelConfig {
54
54
  * Add new keys here as features graduate from private experiments; remove them
55
55
  * once they become stable defaults.
56
56
  */
57
- declare const EXPERIMENTAL_FEATURES: readonly ["passive-routing", "subagents"];
57
+ declare const EXPERIMENTAL_FEATURES: readonly ["operator-tools", "passive-routing", "subagents"];
58
58
  /** One known experimental feature name. */
59
59
  type ExperimentalFeature = (typeof EXPERIMENTAL_FEATURES)[number];
60
60
  /** App-level opt-ins for unstable product features. */
package/dist/app.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as ModelProfileInput, n as JuniorDashboardOptions, r as createApp, t as JuniorAppOptions } from "./app-xk2-Id1T.js";
1
+ import { i as ModelProfileInput, n as JuniorDashboardOptions, r as createApp, t as JuniorAppOptions } from "./app-pGsR__aT.js";
2
2
  import { i as defineJuniorPlugins, n as JuniorPluginSet, r as JuniorPluginSetOptions, t as JuniorPluginInput } from "./plugins-BT2l4We3.js";
3
3
  import { t as JUNIOR_VERSION } from "./version-CnXZ614E.js";
4
4
  export { JUNIOR_VERSION, JuniorAppOptions, JuniorDashboardOptions, type JuniorPluginInput, type JuniorPluginSet, type JuniorPluginSetOptions, type ModelProfileInput, createApp, defineJuniorPlugins };