@sentry/junior 0.283.0 → 0.284.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.
- package/dist/{adapter-D8-lqOBF.js → adapter-CW5UW7vL.js} +1 -1
- package/dist/{admin-Dnw5SCXp.js → admin-DUWN8zZX.js} +1 -1
- package/dist/{agent-runner-Bj7GhysW.js → agent-runner-Cqr21pOU.js} +24 -22
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +4 -3
- package/dist/api.d.ts +1 -1
- package/dist/api.js +96 -23
- package/dist/{app-CMBP-N43.d.ts → app-CvGalMxi.d.ts} +2 -2
- package/dist/app.d.ts +1 -1
- package/dist/app.js +32 -29
- package/dist/{assistant-reply-CdYsLbXL.js → assistant-reply-CFE-OZMS.js} +1 -1
- package/dist/{automation-MLWOrghe.js → automation-Zvx_I9Z5.js} +1 -1
- package/dist/{background-compaction-queue-Bbsqx8Vm.js → background-compaction-queue-CHFzrQbS.js} +2 -2
- package/dist/{briefs-C4qBY-jb.js → briefs-Cx7mkfSk.js} +2 -2
- package/dist/{catalog-runtime-B7NRB7eH.js → catalog-runtime-dKOVbR7l.js} +1 -1
- package/dist/cli/chat.js +14 -14
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +30 -4
- package/dist/{client-a3Ib6wxr.js → client-CMyH5rDz.js} +2 -2
- package/dist/{config-DFVlYCeY.js → config-Dt3CpG17.js} +1 -1
- package/dist/{connections-BtnvpBEV.js → connections-CCHPybZP.js} +10 -10
- package/dist/{conversation-privacy-DLq-abjU.js → conversation-privacy-BpHHhEVp.js} +1 -1
- package/dist/{credential-sync-B4XFVcjM.js → credential-sync-BBPw8dam.js} +13 -13
- package/dist/{db-A_WrTY-s.d.ts → db-D7CCwAo8.d.ts} +1 -1
- package/dist/{executor-HPgHGAWK.js → executor-CyIwHz9r.js} +20 -3
- package/dist/instrumentation.js +37 -13
- package/dist/{logging-2BXvW7Mp.js → logging-Qo-7xGp1.js} +1 -1
- package/dist/{message-BG1v1lXX.js → message-DFbtOWqv.js} +9 -9
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-CXNZJymo.js → oauth-callback-server-BB1gixWo.js} +2 -2
- package/dist/{projection-BfKkpOGQ.js → projection-0UcUeuzn.js} +305 -13
- package/dist/push-endpoint-CO-nomUd.js +36 -0
- package/dist/{registry-CLooHPAz.js → registry-DOnPkI8g.js} +1 -1
- package/dist/{resolve-D3MK9oRJ.js → resolve-Di3omymY.js} +3 -3
- package/dist/{result-BPCjUefO.js → result-NvndYzCb.js} +8 -8
- package/dist/{runner-Ds31u3rB.js → runner-CnX_dTKw.js} +10 -10
- package/dist/{sandbox-egress-signals-CLd5RPUw.js → sandbox-egress-signals-CtxLJmmg.js} +1 -1
- package/dist/{cadence-R7Em4RjE.js → schedule-BTp__wrw.js} +81 -1
- package/dist/{schema-jW3ccLjp.d.ts → schema-B017enNE.d.ts} +40 -1
- package/dist/{schema-CHNP0GfH.js → schema-Bn3miEd_.js} +33 -2
- package/dist/{service-account-D6AMahy7.js → service-account-KhZIqXRi.js} +3 -3
- package/dist/{service-account-CWpTsoIM.js → service-account-ewDAx4Mx.js} +3 -3
- package/dist/{session-stop-D8LGC3H6.js → session-stop-D_1SysjC.js} +10 -10
- package/dist/{skills-DuOKByQH.js → skills-CKyotM4g.js} +2 -2
- package/dist/{spawn-CNIQGgAS.js → spawn-D5D2MQdz.js} +2 -2
- package/dist/{stop-DX2oOIgl.js → stop-BSKRTaRS.js} +45 -37
- package/dist/{store-61mD4ZSh.js → store-G3S0kWSD.js} +4 -4
- package/dist/{store-DAJntSEv.js → store-ymkEUWe4.js} +3 -3
- package/dist/{task-queue-BE70Pb9p.js → task-queue-BcOHzXxe.js} +3 -3
- package/dist/{task-runner-CmmfddSZ.js → task-runner-B65cDumh.js} +17 -8
- package/dist/{thread-state-0UfRMWYd.js → thread-state-D6rNGQu9.js} +4 -4
- package/dist/{turn-failure-response-DKdzxJHE.js → turn-failure-response-BlO4nuDJ.js} +6 -6
- package/dist/{turn-lifecycle-24sBZ4Ip.js → turn-lifecycle-BQ8ETk63.js} +1 -1
- package/dist/{turn-session-routing-CzCnNAUO.js → turn-session-routing-D_GXfcAG.js} +9 -9
- package/dist/{validation-Cs_knhR8.js → validation-DJG_wrg2.js} +1 -1
- package/dist/{version-ZMC4cXWN.js → version-i1An1eTS.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-CYB9T4rm.js → viewer-BlpnzZZa.js} +3 -3
- package/dist/{work-J1n6RQkY.js → work-BgCW3FDC.js} +10 -10
- package/dist/{worker-s1fCvj1z.js → worker-BJz1mwYt.js} +6 -6
- package/migrations/0082_push_notifications.sql +14 -0
- package/migrations/meta/0082_snapshot.json +4373 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +7 -5
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
1
2
|
// src/chat/scheduled-automations/cadence.ts
|
|
2
3
|
const FORMATTERS = /* @__PURE__ */ new Map();
|
|
3
4
|
function getFormatter(timezone) {
|
|
@@ -252,4 +253,83 @@ function getNextRunAtMs(task, scheduledForMs, afterMs = scheduledForMs) {
|
|
|
252
253
|
timezone
|
|
253
254
|
});
|
|
254
255
|
}
|
|
255
|
-
|
|
256
|
+
// src/chat/notifications/schedule.ts
|
|
257
|
+
/**
|
|
258
|
+
* Notification hours for one user.
|
|
259
|
+
*
|
|
260
|
+
* This module imports only zod and the browser-safe cadence helpers, so the
|
|
261
|
+
* dashboard client bundle can use it.
|
|
262
|
+
*/
|
|
263
|
+
const clockTimePattern = /^([01]\d|2[0-3]):[0-5]\d$/;
|
|
264
|
+
/** Saved notification hours. Weekdays use 0 for Sunday, like `Date#getDay`. */
|
|
265
|
+
const notificationScheduleSchema = z.object({
|
|
266
|
+
/** When false, Junior sends phone notifications at any time. */
|
|
267
|
+
workingHoursOnly: z.boolean(),
|
|
268
|
+
days: z.array(z.number().int().min(0).max(6)).max(7).refine((days) => new Set(days).size === days.length, { message: "Days must be unique." }),
|
|
269
|
+
/** Local start time, `HH:MM`. */
|
|
270
|
+
start: z.string().regex(clockTimePattern),
|
|
271
|
+
/** Local end time, `HH:MM`. An end before the start crosses midnight. */
|
|
272
|
+
end: z.string().regex(clockTimePattern),
|
|
273
|
+
/** IANA timezone set by the user. Absent means the profile timezone. */
|
|
274
|
+
timezone: z.string().min(1).max(64).refine(isValidTimeZone, { message: "Unknown timezone." }).optional()
|
|
275
|
+
}).strict().refine((schedule) => schedule.start !== schedule.end, {
|
|
276
|
+
message: "Start and end must differ.",
|
|
277
|
+
path: ["end"]
|
|
278
|
+
});
|
|
279
|
+
/** Default hours when a user has not saved a schedule: 09:00–18:00, Mon–Fri. */
|
|
280
|
+
const DEFAULT_NOTIFICATION_SCHEDULE = {
|
|
281
|
+
workingHoursOnly: true,
|
|
282
|
+
days: [
|
|
283
|
+
1,
|
|
284
|
+
2,
|
|
285
|
+
3,
|
|
286
|
+
4,
|
|
287
|
+
5
|
|
288
|
+
],
|
|
289
|
+
start: "09:00",
|
|
290
|
+
end: "18:00"
|
|
291
|
+
};
|
|
292
|
+
function clockMinutes(value) {
|
|
293
|
+
const [hours, minutes] = value.split(":").map(Number);
|
|
294
|
+
return hours * 60 + minutes;
|
|
295
|
+
}
|
|
296
|
+
const weekdayIndex = {
|
|
297
|
+
Sun: 0,
|
|
298
|
+
Mon: 1,
|
|
299
|
+
Tue: 2,
|
|
300
|
+
Wed: 3,
|
|
301
|
+
Thu: 4,
|
|
302
|
+
Fri: 5,
|
|
303
|
+
Sat: 6
|
|
304
|
+
};
|
|
305
|
+
function localWeekdayAndMinutes(nowMs, timezone) {
|
|
306
|
+
const parts = new Intl.DateTimeFormat("en-US", {
|
|
307
|
+
hour: "2-digit",
|
|
308
|
+
hourCycle: "h23",
|
|
309
|
+
minute: "2-digit",
|
|
310
|
+
timeZone: timezone,
|
|
311
|
+
weekday: "short"
|
|
312
|
+
}).formatToParts(new Date(nowMs));
|
|
313
|
+
const value = (type) => parts.find((part) => part.type === type)?.value ?? "";
|
|
314
|
+
const weekday = weekdayIndex[value("weekday")];
|
|
315
|
+
if (weekday === void 0) throw new Error(`Could not read the weekday for timezone ${timezone}`);
|
|
316
|
+
return {
|
|
317
|
+
minutes: Number(value("hour")) % 24 * 60 + Number(value("minute")),
|
|
318
|
+
weekday
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Return whether a notification may be sent now. A window that crosses
|
|
323
|
+
* midnight belongs to the day on which it starts.
|
|
324
|
+
*/
|
|
325
|
+
function isWithinNotificationSchedule(schedule, timezone, nowMs) {
|
|
326
|
+
if (!schedule.workingHoursOnly) return true;
|
|
327
|
+
const { minutes, weekday } = localWeekdayAndMinutes(nowMs, timezone);
|
|
328
|
+
const start = clockMinutes(schedule.start);
|
|
329
|
+
const end = clockMinutes(schedule.end);
|
|
330
|
+
if (start < end) return schedule.days.includes(weekday) && minutes >= start && minutes < end;
|
|
331
|
+
if (minutes >= start) return schedule.days.includes(weekday);
|
|
332
|
+
if (minutes < end) return schedule.days.includes((weekday + 6) % 7);
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
export { getNextRunAtMs as a, resolveLocalScheduleAtMs as c, getFirstRunAtMs as i, isWithinNotificationSchedule as n, getZonedDateTimeParts as o, notificationScheduleSchema as r, isValidTimeZone as s, DEFAULT_NOTIFICATION_SCHEDULE as t };
|
|
@@ -5370,6 +5370,45 @@ declare const startConnectionResponseSchema: z.ZodObject<{
|
|
|
5370
5370
|
declare const disconnectConnectionResponseSchema: z.ZodObject<{
|
|
5371
5371
|
disconnected: z.ZodLiteral<true>;
|
|
5372
5372
|
}, z.core.$strict>;
|
|
5373
|
+
/** Saved notification hours. Weekdays use 0 for Sunday, like `Date#getDay`. */
|
|
5374
|
+
declare const notificationScheduleSchema: z.ZodObject<{
|
|
5375
|
+
workingHoursOnly: z.ZodBoolean;
|
|
5376
|
+
days: z.ZodArray<z.ZodNumber>;
|
|
5377
|
+
start: z.ZodString;
|
|
5378
|
+
end: z.ZodString;
|
|
5379
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
5380
|
+
}, z.core.$strict>;
|
|
5381
|
+
type NotificationSchedule = z.output<typeof notificationScheduleSchema>;
|
|
5382
|
+
/** Default hours when a user has not saved a schedule: 09:00–18:00, Mon–Fri. */
|
|
5383
|
+
declare const DEFAULT_NOTIFICATION_SCHEDULE: NotificationSchedule;
|
|
5384
|
+
/**
|
|
5385
|
+
* Return whether a notification may be sent now. A window that crosses
|
|
5386
|
+
* midnight belongs to the day on which it starts.
|
|
5387
|
+
*/
|
|
5388
|
+
declare function isWithinNotificationSchedule(schedule: NotificationSchedule, timezone: string, nowMs: number): boolean;
|
|
5389
|
+
/** The viewer's phone notification settings. */
|
|
5390
|
+
declare const notificationSettingsSchema: z.ZodObject<{
|
|
5391
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
5392
|
+
schedule: z.ZodObject<{
|
|
5393
|
+
workingHoursOnly: z.ZodBoolean;
|
|
5394
|
+
days: z.ZodArray<z.ZodNumber>;
|
|
5395
|
+
start: z.ZodString;
|
|
5396
|
+
end: z.ZodString;
|
|
5397
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
5398
|
+
}, z.core.$strict>;
|
|
5399
|
+
timezone: z.ZodString;
|
|
5400
|
+
timezoneSource: z.ZodEnum<{
|
|
5401
|
+
default: "default";
|
|
5402
|
+
manual: "manual";
|
|
5403
|
+
saved: "saved";
|
|
5404
|
+
slack: "slack";
|
|
5405
|
+
}>;
|
|
5406
|
+
deviceCount: z.ZodNumber;
|
|
5407
|
+
}, z.core.$strict>;
|
|
5408
|
+
type NotificationSettings = z.output<typeof notificationSettingsSchema>;
|
|
5409
|
+
declare const testNotificationResponseSchema: z.ZodObject<{
|
|
5410
|
+
delivered: z.ZodNumber;
|
|
5411
|
+
}, z.core.$strict>;
|
|
5373
5412
|
declare const serviceAccountSchema: z.ZodObject<{
|
|
5374
5413
|
provider: z.ZodString;
|
|
5375
5414
|
displayName: z.ZodString;
|
|
@@ -7395,4 +7434,4 @@ declare const reviewItemActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7395
7434
|
}, z.core.$strict>;
|
|
7396
7435
|
}, z.core.$strict>], "action">;
|
|
7397
7436
|
type ReviewItemActionBody = z.output<typeof reviewItemActionSchema>;
|
|
7398
|
-
export { automationExecutionSchema as $,
|
|
7437
|
+
export { automationExecutionSchema as $, GuardianMetricDay as $n, conversationAuxiliaryCostsSchema as $r, startConnectionResponseSchema as $t, StatReport as A, codeRepositorySummarySchema as Ai, ConversationChildAgent as An, ConversationAgentTreeNode as Ar, PersonalTokenMetadata as At, AutomationListQuery as B, UserInputAnswer as Bi, reorderPinnedConversationsBodySchema as Bn, ConversationReportEventData as Br, serviceAccountSchema as Bt, pluginPackageContentItemReportSchema as C, codeActivityDaySchema as Ci, actorProfileReportSchema as Cn, conversationUnchangedDetailWithMailboxSchema as Cr, workspaceBodySchema as Ct, runtimeInfoReportSchema as D, codePersonReportSchema as Di, ConversationWatchesReport as Dn, ActorIdentity as Dr, workspaceSchema as Dt, pluginsSchema as E, codeOverviewReportSchema as Ei, ConversationWatch as En, AcceptedConversationMessage as Er, workspaceRepoSchema as Et, AutomationExecution as F, MessageCard as Fi, PinConversationResponse as Fn, ConversationEventPage as Fr, personalTokenParamsSchema as Ft, AutomationSummary as G, normalizeUserInputAnswer as Gi, conversationCatchUpSchema as Gn, ConversationSurface as Gr, DEFAULT_NOTIFICATION_SCHEDULE as Gt, AutomationRunList as H, UserInputRequest as Hi, ConversationCatchUp as Hn, ConversationReportStatus as Hr, NotificationSettings as Ht, AutomationExecutionDay as I, messageCardText as Ii, ReorderPinnedConversationsBody as In, ConversationFeed as Ir, revokePersonalTokenResponseSchema as It, ListedAutomationVersion as J, MAX_INPUT_IMAGES as Ji, StopConversationTurnResponse as Jn, ConversationUsage as Jr, notificationScheduleSchema as Jt, AutomationUpdate as K, webMessageId as Ki, ConversationReadPosition as Kn, ConversationTurnFailureCode as Kr, NotificationSchedule as Kt, AutomationExecutionList as L, resolveMessageCards as Li, ReorderPinnedConversationsResponse as Ln, ConversationModelUsage as Lr, disconnectServiceAccountResponseSchema as Lt, statSchema as M, conversationChildAgentTotalsSchema as Mi, conversationChildAgentSchema as Mn, ConversationCost as Mr, createdPersonalTokenSchema as Mt, statsReportSchema as N, DailyConversationActivity as Ni, conversationChildAgentsReportSchema as Nn, ConversationDetailReport as Nr, personalTokenListSchema as Nt, skillReportSchema as O, codeRepositoryParamsSchema as Oi, conversationWatchSchema as On, CONVERSATION_DETAIL_VERSION_HEADER as Or, USER_CUSTOMIZATION_MAX_CHARS as Ot, AutomationEdit as P, dailyConversationActivitySchema as Pi, PinConversationBody as Pn, ConversationEventHistory as Pr, personalTokenMetadataSchema as Pt, automationExecutionListSchema as Q, INPUT_IMAGE_TYPES as Qi, ConversationStatsReport as Qn, conversationActivityPreviewSchema as Qr, disconnectConnectionResponseSchema as Qt, AutomationExecutionStatusDay as R, AutomationCard as Ri, pinConversationBodySchema as Rn, ConversationParams as Rr, serviceAccountListSchema as Rt, pluginOperationalReportSchema as S, CodeRepositorySummary as Si, actorDirectoryReportSchema as Sn, conversationPendingMessagesReportSchema as Sr, deleteWorkspaceResponseSchema as St, pluginSchema as T, codeChangeSummarySchema as Ti, personalSpendReportSchema as Tn, steerConversationPendingMessagesResponseSchema as Tr, workspaceParamsSchema as Tt, AutomationRunWindows as U, buttonUserInputField as Ui, ConversationCatchUpBody as Un, ConversationSourceTask as Ur, notificationSettingsSchema as Ut, AutomationRun as V, UserInputField as Vi, reorderPinnedConversationsResponseSchema as Vn, ConversationReportMessageEvent as Vr, startServiceAccountSignInResponseSchema as Vt, AutomationScheduleIntent as W, isEmptyUserInputAnswer as Wi, conversationCatchUpBodySchema as Wn, ConversationSummaryReport as Wr, testNotificationResponseSchema as Wt, automationEditSchema as X, MessageAttachment as Xi, ConversationMetricDay as Xn, CreateConversationMessageBody as Xr, connectionParamsSchema as Xt, automationEditErrorSchema as Y, MAX_INPUT_IMAGE_BYTES as Yi, stopConversationTurnResponseSchema as Yn, CreateConversationBody as Yr, connectionListSchema as Yt, automationEventCatalogSchema as Z, INLINE_VIDEO_TYPES as Zi, ConversationStatsItem as Zn, acceptedConversationMessageSchema as Zr, connectionSchema as Zt, RuntimeInfoReport as _, CodeActivityDay as _i, ActorTotalsReport as _n, cancelConversationPendingMessagesResponseSchema as _r, scheduledAutomationSummarySchema as _t, reviewItemCountSchema as a, conversationFeedQuerySchema as ai, LocationDirectoryReport as an, archiveConversationBodySchema as ar, automationRunListSchema as at, healthReportSchema as b, CodePersonReport as bi, PersonParams as bn, conversationPendingMessageDeliverySchema as br, WorkspaceReport as bt, reviewItemWaitingConversationsSchema as c, conversationReportEventDataSchema as ci, locationActivityDayReportSchema as cn, conversationAutoArchiveSchema as cr, automationScheduleIntentSchema as ct, Plugin as d, createConversationBodySchema as di, locationParamsSchema as dn, ConversationPendingMessage as dr, automationUpdateSchema as dt, conversationDetailQuerySchema as ei, ApiError as en, GuardianStats as er, automationExecutionStatusDaySchema as et, PluginOperationalReport as f, createConversationMessageBodySchema as fi, ActorActivityDayReport as fn, ConversationPendingMessageDelivery as fr, automationVersionActivateSchema as ft, Plugins as g, conversationTurnFailureReasonSchema as gi, ActorSummaryReport as gn, cancelConversationPendingMessagesBodySchema as gr, eventAutomationSummarySchema as gt, PluginPackageContentReport as h, conversationTurnFailureCodeSchema as hi, ActorProfileReport as hn, SteerConversationPendingMessagesResponse as hr, automationVersionSchema as ht, reviewItemActionSchema as i, conversationEventsQuerySchema as ii, LocationDetailReport as in, ConversationAutoArchive as ir, automationParamsSchema as it, StatsReport as j, ConversationChildAgentTotals as ji, ConversationChildAgentsReport as jn, ConversationAuxiliaryCosts as jr, createPersonalTokenBodySchema as jt, skillReportsSchema as k, codeRepositoryReportSchema as ki, conversationWatchesReportSchema as kn, ConversationActivityPreview as kr, userCustomizationSchema as kt, ReviewItemChangeRecord as l, conversationReportEventSchema as li, locationDetailReportSchema as ln, CancelConversationPendingMessagesBody as lr, automationSchedulePreviewSchema as lt, PluginPackageContentItemReport as m, forkConversationResponseSchema as mi, ActorDirectoryWindows as mn, SteerConversationPendingMessagesBody as mr, automationVersionParamsSchema as mt, ReviewItemActionBody as n, conversationEventHistorySchema as ni, LocationActivityDayReport as nn, ArchiveConversationBody as nr, automationListQuerySchema as nt, reviewItemListSchema as o, conversationFeedSchema as oi, LocationParams as on, archiveConversationResponseSchema as or, automationRunSchema as ot, PluginOperationalReportFeed as p, forkConversationBodySchema as pi, ActorDirectoryReport as pn, ConversationPendingMessagesReport as pr, automationVersionListSchema as pt, AutomationVersionList as q, InputImage as qi, conversationReadPositionSchema as qn, ConversationTurnFailureReason as qr, isWithinNotificationSchedule as qt, ReviewItemPayload as r, conversationEventPageSchema as ri, LocationActorSummaryReport as rn, ArchiveConversationResponse as rr, automationListSchema as rt, reviewItemSchema as s, conversationParamsSchema as si, LocationSummaryReport as sn, archiveDoneConversationsResponseSchema as sr, automationRunWindowsSchema as st, OwnedObjectAnnotation$1 as t, conversationDetailReportSchema as ti, apiErrorSchema as tn, conversationStatsReportSchema as tr, automationExecutionStatusSchema as tt, HealthReport as u, conversationSummaryReportSchema as ui, locationDirectoryReportSchema as un, CancelConversationPendingMessagesResponse as ur, automationSummarySchema as ut, SkillReport as v, CodeChangeSummaryReport as vi, ActorWindowMetrics as vn, conversationDetailWithMailboxReportSchema as vr, BaselineSnapshotReport as vt, pluginPackageContentReportSchema as w, codeChangeSummaryReportSchema as wi, personParamsSchema as wn, steerConversationPendingMessagesBodySchema as wr, workspaceListSchema as wt, pluginOperationalReportFeedSchema as x, CodeRepositoryReport as xi, PersonalSpendReport as xn, conversationPendingMessageSchema as xr, baselineSnapshotSchema as xt, SkillReports as y, CodeOverviewReport as yi, PeopleActivityDayReport as yn, conversationPendingAuthorizationSchema as yr, WorkspaceListReport as yt, AutomationList as z, USER_INPUT_NOTE as zi, pinConversationResponseSchema as zn, ConversationReportEvent as zr, serviceAccountParamsSchema as zt };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { r as notificationScheduleSchema } from "./schedule-BTp__wrw.js";
|
|
1
2
|
import { E as conversationChildAgentTotalsSchema, o as conversationAuxiliaryCostsSchema, r as actorIdentitySchema, x as conversationUsageSchema, y as conversationSummaryReportSchema } from "./conversation-DdT7SNar.js";
|
|
2
3
|
import { C as AGENT_INVOCATION_STATUSES, i as fillUtcHours, r as fillUtcDays, s as sumUtcHoursIntoSixHours, y as userInputRequestSchema } from "./reporting-window-B-QP9zX1.js";
|
|
3
|
-
import "./automation-
|
|
4
|
+
import "./automation-Zvx_I9Z5.js";
|
|
4
5
|
import "./conversation-pending-messages-Dct5pheX.js";
|
|
6
|
+
import { t as isPushServiceEndpoint } from "./push-endpoint-CO-nomUd.js";
|
|
5
7
|
import * as z from "zod";
|
|
6
8
|
import { codeChangeStateSchema, eventMatchSchema } from "@sentry/junior-plugin-api";
|
|
7
9
|
// src/api/schema/conversation-catch-up.ts
|
|
@@ -302,6 +304,35 @@ const connectionListSchema = z.object({ connections: z.array(connectionSchema) }
|
|
|
302
304
|
const connectionParamsSchema = z.object({ provider: z.string().regex(/^[a-z][a-z0-9-]*$/).max(64) }).strict();
|
|
303
305
|
const startConnectionResponseSchema = z.object({ authorizationUrl: z.string().url() }).strict();
|
|
304
306
|
const disconnectConnectionResponseSchema = z.object({ disconnected: z.literal(true) }).strict();
|
|
307
|
+
// src/api/schema/notification.ts
|
|
308
|
+
const notificationTimezoneSourceSchema = z.enum([
|
|
309
|
+
"manual",
|
|
310
|
+
"slack",
|
|
311
|
+
"saved",
|
|
312
|
+
"default"
|
|
313
|
+
]);
|
|
314
|
+
/** The viewer's phone notification settings. */
|
|
315
|
+
const notificationSettingsSchema = z.object({
|
|
316
|
+
/** Server VAPID public key. Absent when Web Push is not configured. */
|
|
317
|
+
publicKey: z.string().min(1).optional(),
|
|
318
|
+
schedule: notificationScheduleSchema,
|
|
319
|
+
/** Timezone that Junior uses for the schedule now. */
|
|
320
|
+
timezone: z.string().min(1),
|
|
321
|
+
timezoneSource: notificationTimezoneSourceSchema,
|
|
322
|
+
/** Number of browsers that receive the viewer's notifications. */
|
|
323
|
+
deviceCount: z.number().int().nonnegative()
|
|
324
|
+
}).strict();
|
|
325
|
+
/** `PushSubscription#toJSON()` from the browser. */
|
|
326
|
+
const pushSubscriptionBodySchema = z.object({
|
|
327
|
+
endpoint: z.string().max(2048).refine(isPushServiceEndpoint, "Unknown push service."),
|
|
328
|
+
expirationTime: z.number().nullable().optional(),
|
|
329
|
+
keys: z.object({
|
|
330
|
+
auth: z.string().min(1).max(256),
|
|
331
|
+
p256dh: z.string().min(1).max(256)
|
|
332
|
+
}).strict()
|
|
333
|
+
}).strict();
|
|
334
|
+
const pushSubscriptionDeleteBodySchema = z.object({ endpoint: z.string().url().max(2048) }).strict();
|
|
335
|
+
const testNotificationResponseSchema = z.object({ delivered: z.number().int().nonnegative() }).strict();
|
|
305
336
|
// src/api/activity.ts
|
|
306
337
|
const dailyConversationActivitySchema = z.object({
|
|
307
338
|
active: z.number(),
|
|
@@ -679,4 +710,4 @@ const statsReportSchema = z.object({
|
|
|
679
710
|
windowEnd: z.string(),
|
|
680
711
|
windowStart: z.string()
|
|
681
712
|
}).strict();
|
|
682
|
-
export {
|
|
713
|
+
export { codeOverviewReportSchema as $, avatarParamsSchema as A, dailyConversationActivitySchema as B, createdPersonalTokenSchema as C, revokePersonalTokenResponseSchema as D, personalTokenParamsSchema as E, locationDirectoryReportSchema as F, connectionListSchema as G, pushSubscriptionBodySchema as H, locationParamsSchema as I, disconnectConnectionResponseSchema as J, connectionParamsSchema as K, activityDays as L, personalSpendReportSchema as M, locationActivityDayReportSchema as N, actorDirectoryReportSchema as O, locationDetailReportSchema as P, codeChangeSummarySchema as Q, activityHours as R, createPersonalTokenBodySchema as S, personalTokenMetadataSchema as T, pushSubscriptionDeleteBodySchema as U, notificationSettingsSchema as V, testNotificationResponseSchema as W, codeActivityDaySchema as X, startConnectionResponseSchema as Y, codeChangeSummaryReportSchema as Z, disconnectServiceAccountResponseSchema as _, reorderPinnedConversationsResponseSchema as _t, workspaceBodySchema as a, conversationWatchesReportSchema as at, serviceAccountSchema as b, workspaceRepoSchema as c, stopConversationTurnResponseSchema as ct, reviewItemCountSchema as d, archiveConversationResponseSchema as dt, codePersonReportSchema as et, reviewItemListQuerySchema as f, archiveDoneConversationsResponseSchema as ft, reviewItemWaitingConversationsSchema as g, reorderPinnedConversationsBodySchema as gt, reviewItemSchema as h, pinConversationResponseSchema as ht, deleteWorkspaceResponseSchema as i, conversationWatchSchema as it, personParamsSchema as j, actorProfileReportSchema as k, workspaceSchema as l, conversationStatsReportSchema as lt, reviewItemParamsSchema as m, pinConversationBodySchema as mt, statsReportSchema as n, codeRepositoryReportSchema as nt, workspaceListSchema as o, conversationChildAgentSchema as ot, reviewItemListSchema as p, conversationAutoArchiveSchema as pt, connectionSchema as q, baselineSnapshotSchema as r, codeRepositorySummarySchema as rt, workspaceParamsSchema as s, conversationChildAgentsReportSchema as st, statSchema as t, codeRepositoryParamsSchema as tt, reviewItemActionSchema as u, archiveConversationBodySchema as ut, serviceAccountListSchema as v, conversationCatchUpBodySchema as vt, personalTokenListSchema as w, startServiceAccountSignInResponseSchema as x, serviceAccountParamsSchema as y, conversationCatchUpSchema as yt, activitySixHours as z };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { W as isRecord, b as setSpanAttributes, h as logWarn } from "./logging-
|
|
2
|
-
import { c as fetchWithBoundedOAuthErrorBodies, i as resolvePluginHeaderEnvRefs } from "./registry-
|
|
1
|
+
import { W as isRecord, b as setSpanAttributes, h as logWarn } from "./logging-Qo-7xGp1.js";
|
|
2
|
+
import { c as fetchWithBoundedOAuthErrorBodies, i as resolvePluginHeaderEnvRefs } from "./registry-DOnPkI8g.js";
|
|
3
3
|
import { a as withLock, i as fenceLock, n as MUTATION_LOCK_TTL_MS } from "./locks-D-0h111u.js";
|
|
4
|
-
import { r as getStateAdapter } from "./adapter-
|
|
4
|
+
import { r as getStateAdapter } from "./adapter-CW5UW7vL.js";
|
|
5
5
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
7
7
|
import { UnauthorizedError, auth } from "@modelcontextprotocol/sdk/client/auth.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
2
|
-
import { t as disconnectStateAdapter } from "./adapter-
|
|
3
|
-
import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-
|
|
1
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-dKOVbR7l.js";
|
|
2
|
+
import { t as disconnectStateAdapter } from "./adapter-CW5UW7vL.js";
|
|
3
|
+
import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-KhZIqXRi.js";
|
|
4
4
|
import { CLI_USAGE } from "./cli/run.js";
|
|
5
5
|
import { createServer } from "node:http";
|
|
6
6
|
// src/cli/service-account.ts
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import {
|
|
3
|
-
import { n as botConfig } from "./config-
|
|
4
|
-
import { h as logWarn, m as logInfo, p as logException } from "./logging-
|
|
5
|
-
import { C as getSqlExecutor, F as SYSTEM_IDENTITY_ID, J as nextDetailVersion, x as getConversationStore } from "./viewer-
|
|
6
|
-
import {
|
|
7
|
-
import { h as credentialSubjectSchema } from "./registry-
|
|
8
|
-
import { r as getStateAdapter } from "./adapter-
|
|
2
|
+
import { $r as ToolInputError, Di as formatSlackLink, Ei as escapeSlackMrkdwnText, Gr as verifyTimerWatchCredentialSubject, Jr as getDashboardObjectIconLink, Kr as JUNIOR_THREAD_STATE_TTL_MS, Ln as getPlugins, N as normalizeConversationText, Nn as getPluginSlackConversationLink, Oi as normalizeSlackReplyMarkdown, Ri as postSlackMessage, Zt as isAssistantMessage, en as isToolResultError, nn as normalizeToolNameFromResult, qr as getDashboardConversationLink, so as buildSentryConversationUrl, tn as isToolResultMessage } from "./projection-0UcUeuzn.js";
|
|
3
|
+
import { n as botConfig } from "./config-Dt3CpG17.js";
|
|
4
|
+
import { h as logWarn, m as logInfo, p as logException } from "./logging-Qo-7xGp1.js";
|
|
5
|
+
import { C as getSqlExecutor, F as SYSTEM_IDENTITY_ID, J as nextDetailVersion, x as getConversationStore } from "./viewer-BlpnzZZa.js";
|
|
6
|
+
import { j as juniorConversations } from "./executor-CyIwHz9r.js";
|
|
7
|
+
import { h as credentialSubjectSchema } from "./registry-DOnPkI8g.js";
|
|
8
|
+
import { r as getStateAdapter } from "./adapter-CW5UW7vL.js";
|
|
9
9
|
import { R as readMessageAttachments } from "./conversation-DdT7SNar.js";
|
|
10
10
|
import { r as EVENT_AUTHOR_ID } from "./prompt-CCtaGgbI.js";
|
|
11
|
-
import { a as QUIET_MARKER, r as sanitizeAssistantText } from "./assistant-reply-
|
|
12
|
-
import { r as appendAndEnqueueInboundMessage } from "./store-
|
|
13
|
-
import { dt as CORE_EVENT_NAMESPACE, ht as eventGuidance, mt as eventCatalogEntry } from "./turn-session-routing-
|
|
11
|
+
import { a as QUIET_MARKER, r as sanitizeAssistantText } from "./assistant-reply-CFE-OZMS.js";
|
|
12
|
+
import { r as appendAndEnqueueInboundMessage } from "./store-ymkEUWe4.js";
|
|
13
|
+
import { dt as CORE_EVENT_NAMESPACE, ht as eventGuidance, mt as eventCatalogEntry } from "./turn-session-routing-D_GXfcAG.js";
|
|
14
14
|
import * as z from "zod";
|
|
15
15
|
import { eq, inArray } from "drizzle-orm";
|
|
16
16
|
import { agentEventKeys, eventMatchFieldsSchema, objectFactFields, objectPresentation, objectTypeSchema } from "@sentry/junior-plugin-api";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { h as logWarn } from "./logging-
|
|
2
|
+
import { h as logWarn } from "./logging-Qo-7xGp1.js";
|
|
3
3
|
import { s as skillRoots } from "./package-discovery-DJhGdS4c.js";
|
|
4
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
4
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-dKOVbR7l.js";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import * as z from "zod";
|
|
7
7
|
import fs from "node:fs/promises";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { Ft as toolInvocationDestination, Pt as actorFromRun } from "./agent-runner-
|
|
3
|
-
import { n as createAndEnqueueAgentInvocation } from "./work-
|
|
2
|
+
import { Ft as toolInvocationDestination, Pt as actorFromRun } from "./agent-runner-Cqr21pOU.js";
|
|
3
|
+
import { n as createAndEnqueueAgentInvocation } from "./work-BgCW3FDC.js";
|
|
4
4
|
// src/chat/agent-invocations/spawn.ts
|
|
5
5
|
var spawn_exports = /* @__PURE__ */ __exportAll({ bindSpawnAgent: () => bindSpawnAgent });
|
|
6
6
|
/** Bind a Run's Actor and credentials to new Agent invocations. */
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { h as startSpan, i as getActiveSpan, r as continueTrace } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { $ as completeTurnRecord, $
|
|
3
|
-
import { a as completeText, c as resolveGatewayModel, m as escapeXml, r as completeDecision, x as isProviderRetryError } from "./client-
|
|
4
|
-
import { c as getSlackClientSecret, i as getChatConfig, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, s as getSlackClientId, v as normalizeSlackEmojiName } from "./config-
|
|
5
|
-
import { E as withSpan, G as toOptionalNumber, K as toOptionalString, S as setTags, T as withLogContext, W as isRecord, b as setSpanAttributes, f as logError, h as logWarn, m as logInfo, n as createChatSdkLogger, o as getActiveTraceContext, p as logException, s as getActiveTraceId, t as buildTurnFailureResponse, y as setSentryUser } from "./logging-
|
|
6
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
2
|
+
import { $ as completeTurnRecord, $i as withSlackRetries, A as getConversationMessageSlackTs, Co as createPluginCache, D as buildConversationContext, Do as piMessageFromHistoryItem, E as appendThreadContextMessages, En as webActorUserIds, F as turnHasReply, Ga as conversationHasParticipantUser, Gi as downloadPrivateSlackFile, Gr as verifyTimerWatchCredentialSubject, H as AuthorizationFlowDisabledError, Ha as readConversationAccessFromSql, I as upsertConversationMessage, J as wasPendingAuthStopped, Ja as conversationNotArchivedForUser, Ji as getSlackClient, K as clearPendingAuth, Ka as conversationIsMemberRoot, Kr as JUNIOR_THREAD_STATE_TTL_MS, Ln as getPlugins, M as markConversationMessage, Mi as addReactionToMessage, N as normalizeConversationText, O as createConversationMemoryService, P as recordDeliveredAssistantMessage, Q as abandonTurnRecord, Qa as viewerConversationMembership, Qn as closeReviewItem, R as PluginCredentialFailureError, S as resolveConversationTitle, Sn as isExperimentalFeatureEnabled, So as lookupSlackUser, To as configValueSchema, Ua as conversationArchivedForEmail, Ut as persistWithRetry, Va as createConversationAccessReader, Wa as conversationArchivedForUser, Wi as SlackActionError, X as loadTurnCheckpoint, Xa as conversationViewerMarks, Xi as isDmChannel, Ya as conversationPinnedForUser, Z as saveTurnCheckpoint, Za as readConversationViewerMarks, Zi as normalizeSlackConversationId, _r as reviewItemNeedsUser, a as loadProjection, an as trimTrailingAssistantMessages, ar as listWaitingConversations, d as recordAuthorizationCompleted, et as failTurnRecord, fn as decideSubscribedThreadReply, fo as readAttachmentVisionSummary, fr as canReadReviewItem, h as recordSubscribedReplyRoute, i as loadConversationProjection, io as readConversationEventPageAround, ir as listReplyActionItems, j as isHumanConversationMessage, ji as truncateStatusText, k as estimateConversationContextTokens, ki as normalizeSlackStatusText, kr as cancelSubscriptions, ln as buildDeterministicAssistantMessageId, lo as notInheritedByForkChild, mn as getThreadStopDecision, mo as recordSlackAttachment, n as commitMessages, no as readConversationEventPage, nr as getReviewItem, nt as listTurnSummaries, o as loadTurnProjection, pn as getSubscribedReplyPreflightDecision, po as readSlackAttachmentsVersion, pr as isOnlyAssignee, qa as conversationNotArchivedForEmail, qi as getHeaderString, ro as readConversationEventPageAfter, rt as recordTurnSummary, so as buildSentryConversationUrl, sr as takeReviewItem, t as commitAcceptedReply, to as readLatestConversationBrief, tt as getTurnRecord, un as buildDeterministicTurnId, uo as getSlackFileId, ur as canActOnReviewItem, v as hydrateConversationMessages, vo as listConversationAnnotations, vr as reviewItemReaderForUser, w as fallbackShortTitle, wn as createUserTokenStore, x as persistConversationMessageSummaries, y as persistConversationMessages, yo as listConversationAnnotationsById, za as createPluginLogger, zi as removeReactionFromMessage, zt as buildTurnErrorResponse } from "./projection-0UcUeuzn.js";
|
|
3
|
+
import { a as completeText, c as resolveGatewayModel, m as escapeXml, r as completeDecision, x as isProviderRetryError } from "./client-CMyH5rDz.js";
|
|
4
|
+
import { c as getSlackClientSecret, i as getChatConfig, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, s as getSlackClientId, v as normalizeSlackEmojiName } from "./config-Dt3CpG17.js";
|
|
5
|
+
import { E as withSpan, G as toOptionalNumber, K as toOptionalString, S as setTags, T as withLogContext, W as isRecord, b as setSpanAttributes, f as logError, h as logWarn, m as logInfo, n as createChatSdkLogger, o as getActiveTraceContext, p as logException, s as getActiveTraceId, t as buildTurnFailureResponse, y as setSentryUser } from "./logging-Qo-7xGp1.js";
|
|
6
|
+
import { t as JUNIOR_VERSION } from "./version-i1An1eTS.js";
|
|
7
7
|
import { f as parseSlackTeamId, h as parseSlackMessageTs, i as isActorUserId, n as createSlackActor, o as isUserActor, r as createSlackResumeActor, s as parseActorUserId, t as createActor, u as parseSlackChannelId } from "./actor-6jsm_v96.js";
|
|
8
|
-
import { $ as agentTurnUsageSchema, A as loadConversationSlackTenantIds, C as getSqlExecutor, I as resolveActorIdentityId, J as nextDetailVersion, K as parseSessionSource, L as saveActorAvatar, N as locationFromRow, S as getDb, X as addAgentTurnUsage, et as hasAgentTurnUsage, f as identityAvatarUrl, h as readUserAvatarUrls, it as requireSlackDestination, k as withConversationEventLock, nt as createSlackDestination, q as conversationDetailTouch, tt as resolveRootConversationId, x as getConversationStore, y as getConversationEventStore } from "./viewer-
|
|
9
|
-
import { A as
|
|
8
|
+
import { $ as agentTurnUsageSchema, A as loadConversationSlackTenantIds, C as getSqlExecutor, I as resolveActorIdentityId, J as nextDetailVersion, K as parseSessionSource, L as saveActorAvatar, N as locationFromRow, S as getDb, X as addAgentTurnUsage, et as hasAgentTurnUsage, f as identityAvatarUrl, h as readUserAvatarUrls, it as requireSlackDestination, k as withConversationEventLock, nt as createSlackDestination, q as conversationDetailTouch, tt as resolveRootConversationId, x as getConversationStore, y as getConversationEventStore } from "./viewer-BlpnzZZa.js";
|
|
9
|
+
import { A as conversationReadColumns, C as isUserInstruction, D as juniorCodeChanges, M as juniorIdentities, N as juniorUsers, P as juniorDestinations, _ as juniorConversationReadPositions, b as juniorConversationBriefs, j as juniorConversations, l as juniorReviewItems, s as juniorReviewItemConversations, v as juniorConversationParticipants, w as juniorConversationEvents } from "./executor-CyIwHz9r.js";
|
|
10
10
|
import { _ as instructionProvenanceFor, h as contextProvenance, i as isVisionImageMediaType, r as detectImageMediaType } from "./media-Bu9C6lz0.js";
|
|
11
|
-
import { d as actorLogContext, f as credentialContextForActor } from "./registry-
|
|
12
|
-
import { A as runWithSlackInstallation, At as withoutSavedSteeringMessages, Et as conversationSubtreeColumns, F as resolveSlackChannelIdFromThreadId, I as getConversationInfo, J as readConversationSourceTask, Lt as shouldEmitDevAgentTrace, M as parseSlackThreadId, N as readSlackRawMessageContext, Nt as RetryableDeliveryError, P as resolveSlackChannelIdFromMessage, R as listThreadReplies, S as createSlackReviewItemShow, Tt as conversationSubtree, a as buildAuthPauseResponse, b as renderAttachmentText, dt as recordWebConversationActivity, ft as webActorFromUser, i as measureTurnCompactionWait, kt as buildSteeringPiMessage, lt as createAndEnqueueConversation, m as latestProgressStatus, mt as decodeInputImages, n as executeAgentRun, ot as acceptsWebMessages, pt as resolveConversationDestination, rt as deliverReviewItemChange, st as appendAndEnqueueWebMessage, t as createAgentRunner, ut as createConversationId, vt as storeAttachment, x as renderBlockText, z as resolveDestinationVisibility } from "./agent-runner-
|
|
11
|
+
import { d as actorLogContext, f as credentialContextForActor } from "./registry-DOnPkI8g.js";
|
|
12
|
+
import { A as runWithSlackInstallation, At as withoutSavedSteeringMessages, Et as conversationSubtreeColumns, F as resolveSlackChannelIdFromThreadId, I as getConversationInfo, J as readConversationSourceTask, Lt as shouldEmitDevAgentTrace, M as parseSlackThreadId, N as readSlackRawMessageContext, Nt as RetryableDeliveryError, P as resolveSlackChannelIdFromMessage, R as listThreadReplies, S as createSlackReviewItemShow, Tt as conversationSubtree, a as buildAuthPauseResponse, b as renderAttachmentText, dt as recordWebConversationActivity, ft as webActorFromUser, i as measureTurnCompactionWait, kt as buildSteeringPiMessage, lt as createAndEnqueueConversation, m as latestProgressStatus, mt as decodeInputImages, n as executeAgentRun, ot as acceptsWebMessages, pt as resolveConversationDestination, rt as deliverReviewItemChange, st as appendAndEnqueueWebMessage, t as createAgentRunner, ut as createConversationId, vt as storeAttachment, x as renderBlockText, z as resolveDestinationVisibility } from "./agent-runner-Cqr21pOU.js";
|
|
13
13
|
import { a as withLock, n as MUTATION_LOCK_TTL_MS, r as acquireActiveLock } from "./locks-D-0h111u.js";
|
|
14
|
-
import { r as getStateAdapter } from "./adapter-
|
|
14
|
+
import { r as getStateAdapter } from "./adapter-CW5UW7vL.js";
|
|
15
15
|
import { R as readMessageAttachments, c as conversationDetailReportSchema, p as conversationFeedSchema, u as conversationEventPageSchema } from "./conversation-DdT7SNar.js";
|
|
16
16
|
import { a as EVENT_SYSTEM_ACTOR, o as isEventConversationMessage } from "./prompt-CCtaGgbI.js";
|
|
17
|
-
import { $ as markTurnFailed, G as TurnInputCommitLostError, J as isCooperativeTurnYieldError, K as TurnInputDeferredError, Q as markTurnCompleted, U as ConversationTurnBoundaryError, W as CooperativeTurnYieldError, X as isTurnInputDeferredError, Y as isTurnInputCommitLostError, Z as markTurnClosed, et as startActiveTurn, h as getChildAgentLabel, q as getConversationTurnBoundaryError } from "./store-
|
|
18
|
-
import { n as getAssistantReplyText, t as decideReply } from "./assistant-reply-
|
|
19
|
-
import { C as savedTurnInputMessages, E as maybePostAutomatedTurnLimitNotice, I as deliversFinalText, L as finishedRunReply, M as recordFinishedTurnForAutomatedLimit, O as resolveSlackReplyTarget, R as postsRunNotices, S as joinMailboxText, V as runDispatchOutcome, c as isEventMailboxMetadata, i as skipInputBeforeConversationStop, k as sendSlackReply, l as renderEventBatchText, s as eventBatchMessageMeta, u as timerWatchCredentialSubject, w as webConversationMessage } from "./session-stop-
|
|
17
|
+
import { $ as markTurnFailed, G as TurnInputCommitLostError, J as isCooperativeTurnYieldError, K as TurnInputDeferredError, Q as markTurnCompleted, U as ConversationTurnBoundaryError, W as CooperativeTurnYieldError, X as isTurnInputDeferredError, Y as isTurnInputCommitLostError, Z as markTurnClosed, et as startActiveTurn, h as getChildAgentLabel, q as getConversationTurnBoundaryError } from "./store-G3S0kWSD.js";
|
|
18
|
+
import { n as getAssistantReplyText, t as decideReply } from "./assistant-reply-CFE-OZMS.js";
|
|
19
|
+
import { C as savedTurnInputMessages, E as maybePostAutomatedTurnLimitNotice, I as deliversFinalText, L as finishedRunReply, M as recordFinishedTurnForAutomatedLimit, O as resolveSlackReplyTarget, R as postsRunNotices, S as joinMailboxText, V as runDispatchOutcome, c as isEventMailboxMetadata, i as skipInputBeforeConversationStop, k as sendSlackReply, l as renderEventBatchText, s as eventBatchMessageMeta, u as timerWatchCredentialSubject, w as webConversationMessage } from "./session-stop-D_1SysjC.js";
|
|
20
20
|
import { _ as isEmptyUserInputAnswer, b as webMessageId, v as normalizeUserInputAnswer } from "./reporting-window-B-QP9zX1.js";
|
|
21
|
-
import { g as getTurnRequestDeadline, l as getVercelConversationWorkQueue } from "./background-compaction-queue-
|
|
22
|
-
import { D as stopConversationWork, E as steerWebPendingMessages, a as cancelHumanFacingPendingMessages, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, w as requestConversationWork } from "./store-
|
|
23
|
-
import { _ as markDispatchCompleted, a as confirmDispatchMailboxAppend, d as getDispatchTurnId, g as markDispatchBlocked, h as markDispatchAwaitingResume, i as claimDispatchMailboxAppend, j as readAutomationTitlesByConversationId, l as getDispatchInputMessageId, n as resolveTurnSessionRouting, p as isTerminalDispatchStatus, s as getDispatchConversationId, t as resolveConversationRouting, u as getDispatchRecord, v as markDispatchFailed, y as markDispatchRunning } from "./turn-session-routing-
|
|
21
|
+
import { g as getTurnRequestDeadline, l as getVercelConversationWorkQueue } from "./background-compaction-queue-CHFzrQbS.js";
|
|
22
|
+
import { D as stopConversationWork, E as steerWebPendingMessages, a as cancelHumanFacingPendingMessages, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, r as appendAndEnqueueInboundMessage, w as requestConversationWork } from "./store-ymkEUWe4.js";
|
|
23
|
+
import { _ as markDispatchCompleted, a as confirmDispatchMailboxAppend, d as getDispatchTurnId, g as markDispatchBlocked, h as markDispatchAwaitingResume, i as claimDispatchMailboxAppend, j as readAutomationTitlesByConversationId, l as getDispatchInputMessageId, n as resolveTurnSessionRouting, p as isTerminalDispatchStatus, s as getDispatchConversationId, t as resolveConversationRouting, u as getDispatchRecord, v as markDispatchFailed, y as markDispatchRunning } from "./turn-session-routing-D_GXfcAG.js";
|
|
24
24
|
import { d as apiErrorSchema, f as healthReportSchema, s as conversationPendingMessagesReportSchema } from "./conversation-pending-messages-Dct5pheX.js";
|
|
25
|
-
import { a as withAgentInvocationResultActors, c as listActiveMailboxTurns, d as turnInputFactsFromConversationMessage, f as legacyWebMailboxMetadataSchema, l as resolveMailboxTurnWork, n as enqueueAgentInvocationResult, o as getAuthPausedConversationTurnId, s as getEventBatchDelayMs, t as createChildConversationWorker, u as sourceFromTurnInput } from "./result-
|
|
26
|
-
import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-
|
|
27
|
-
import { o as AgentRunError, s as executeTurn } from "./work-
|
|
28
|
-
import { a as persistThreadStateById, i as persistThreadRuntimeState, n as getPersistedSandboxState, o as coerceThreadConversationState, r as getPersistedThreadState, t as getLocationConfigurationService } from "./thread-state-
|
|
29
|
-
import { c as deleteWebAuthorization, d as createPausedTurns, f as getPausedTurnRequest, h as getTurnAuthorization, l as getWebAuthorization, m as wakePausedTurn, s as createWebAuthorization } from "./connections-
|
|
30
|
-
import { t as bindMessageAgent } from "./message-
|
|
31
|
-
import { t as bindSpawnAgent } from "./spawn-
|
|
32
|
-
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-
|
|
33
|
-
import { a as persistAuthPauseTurnState, c as getTurnUserSlackMessageTs, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, n as getAgentTurnDiagnosticsAttributes, o as getTurnUserMessage, r as requireTurnFailureEventId, s as getTurnUserReplyAttachmentContext, t as finalizeFailedTurnReplyWithEvent, u as loadPendingMessageCards } from "./turn-failure-response-
|
|
25
|
+
import { a as withAgentInvocationResultActors, c as listActiveMailboxTurns, d as turnInputFactsFromConversationMessage, f as legacyWebMailboxMetadataSchema, l as resolveMailboxTurnWork, n as enqueueAgentInvocationResult, o as getAuthPausedConversationTurnId, s as getEventBatchDelayMs, t as createChildConversationWorker, u as sourceFromTurnInput } from "./result-NvndYzCb.js";
|
|
26
|
+
import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-BQ8ETk63.js";
|
|
27
|
+
import { o as AgentRunError, s as executeTurn } from "./work-BgCW3FDC.js";
|
|
28
|
+
import { a as persistThreadStateById, i as persistThreadRuntimeState, n as getPersistedSandboxState, o as coerceThreadConversationState, r as getPersistedThreadState, t as getLocationConfigurationService } from "./thread-state-D6rNGQu9.js";
|
|
29
|
+
import { c as deleteWebAuthorization, d as createPausedTurns, f as getPausedTurnRequest, h as getTurnAuthorization, l as getWebAuthorization, m as wakePausedTurn, s as createWebAuthorization } from "./connections-CCHPybZP.js";
|
|
30
|
+
import { t as bindMessageAgent } from "./message-DFbtOWqv.js";
|
|
31
|
+
import { t as bindSpawnAgent } from "./spawn-D5D2MQdz.js";
|
|
32
|
+
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-B65cDumh.js";
|
|
33
|
+
import { a as persistAuthPauseTurnState, c as getTurnUserSlackMessageTs, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, n as getAgentTurnDiagnosticsAttributes, o as getTurnUserMessage, r as requireTurnFailureEventId, s as getTurnUserReplyAttachmentContext, t as finalizeFailedTurnReplyWithEvent, u as loadPendingMessageCards } from "./turn-failure-response-BlO4nuDJ.js";
|
|
34
34
|
import { createHash, createHmac, timingSafeEqual } from "node:crypto";
|
|
35
35
|
import * as z from "zod";
|
|
36
36
|
import { and, asc, desc, eq, gt, inArray, isNotNull, isNull, lte, max, ne, or, sql } from "drizzle-orm";
|
|
@@ -1173,7 +1173,18 @@ async function startProcessingReactionForMessage(args) {
|
|
|
1173
1173
|
}
|
|
1174
1174
|
};
|
|
1175
1175
|
}
|
|
1176
|
-
// src/chat/
|
|
1176
|
+
// src/chat/task-execution/turn-telemetry.ts
|
|
1177
|
+
/** Read the turn input timing facts from a mailbox batch, oldest first. */
|
|
1178
|
+
function turnInputTelemetry(messages) {
|
|
1179
|
+
const oldest = messages[0];
|
|
1180
|
+
if (!oldest) return void 0;
|
|
1181
|
+
return {
|
|
1182
|
+
count: messages.length,
|
|
1183
|
+
oldestCreatedAtMs: oldest.createdAtMs,
|
|
1184
|
+
oldestReceivedAtMs: oldest.receivedAtMs,
|
|
1185
|
+
traceContexts: messages.flatMap((message) => message.traceContext ?? [])
|
|
1186
|
+
};
|
|
1187
|
+
}
|
|
1177
1188
|
const SENTRY_TRACE_PATTERN = /^([0-9a-f]{32})-([0-9a-f]{16})(?:-([01]))?$/;
|
|
1178
1189
|
function spanLinks({ sentryTrace }) {
|
|
1179
1190
|
const [, traceId, spanId, sampled] = SENTRY_TRACE_PATTERN.exec(sentryTrace) ?? [];
|
|
@@ -1208,7 +1219,7 @@ async function withTurnSpan(context, input, callback) {
|
|
|
1208
1219
|
/**
|
|
1209
1220
|
* Build the `chat.turn` timing attributes for the oldest input message.
|
|
1210
1221
|
*
|
|
1211
|
-
*
|
|
1222
|
+
* The provider, the ingress host, and the worker host use separate clocks. A negative
|
|
1212
1223
|
* duration is clock skew, not latency, so it is left out.
|
|
1213
1224
|
*/
|
|
1214
1225
|
function getTurnInputSpanAttributes(input, turnStartedAtMs) {
|
|
@@ -2560,15 +2571,9 @@ function createSlackConversationWorker(options) {
|
|
|
2560
2571
|
}
|
|
2561
2572
|
return { status: "completed" };
|
|
2562
2573
|
}
|
|
2563
|
-
const oldestRecord = records[0];
|
|
2564
2574
|
const latestRecord = records[records.length - 1];
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
count: records.length,
|
|
2568
|
-
oldestCreatedAtMs: oldestRecord.createdAtMs,
|
|
2569
|
-
oldestReceivedAtMs: oldestRecord.receivedAtMs,
|
|
2570
|
-
traceContexts: records.flatMap((record) => record.traceContext ?? [])
|
|
2571
|
-
};
|
|
2575
|
+
const telemetry = turnInputTelemetry(records);
|
|
2576
|
+
if (!latestRecord || !telemetry) return { status: "completed" };
|
|
2572
2577
|
const latestMetadata = parseSlackMetadata(latestRecord.input.metadata);
|
|
2573
2578
|
if (!latestMetadata) throw new Error("Latest conversation mailbox record is not Slack metadata");
|
|
2574
2579
|
if (!await context.checkIn()) return { status: "lost_lease" };
|
|
@@ -6510,14 +6515,17 @@ function createConversationTurnWorker(agentRunner, deliverMessage) {
|
|
|
6510
6515
|
const isEventTurn = source.kind === "event" || savedMessageIsEvent;
|
|
6511
6516
|
const deliverToProvider = Boolean(conversationLocation) && isEventTurn;
|
|
6512
6517
|
const surface = deliverToProvider ? "slack" : "api";
|
|
6513
|
-
|
|
6518
|
+
const inputTelemetry = resolved.kind === "mailbox" ? turnInputTelemetry(resolved.batch.map((entry) => entry.message)) : void 0;
|
|
6519
|
+
const turnTrace = inputTelemetry ?? (savedTurn?.traceContext ? { traceContexts: [savedTurn.traceContext] } : void 0);
|
|
6520
|
+
return await withTurnSpan({
|
|
6514
6521
|
conversationId: context.conversationId,
|
|
6515
6522
|
platform: actor.platform,
|
|
6516
6523
|
...webActor ? {
|
|
6517
6524
|
userId: webActor.userId,
|
|
6518
6525
|
...webActor.userName ? { userName: webActor.userName } : void 0
|
|
6519
6526
|
} : void 0
|
|
6520
|
-
}, async () => {
|
|
6527
|
+
}, turnTrace, async (setTurnSpanAttributes) => {
|
|
6528
|
+
if (inputTelemetry) setTurnSpanAttributes(getTurnInputSpanAttributes(inputTelemetry, Date.now()));
|
|
6521
6529
|
let acknowledged = isResume || context.attempt.messages.length === 0;
|
|
6522
6530
|
const acknowledge = async () => {
|
|
6523
6531
|
if (acknowledged) return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as TURN_REASONING_LEVELS } from "./config-
|
|
2
|
-
import { C as getSqlExecutor, x as getConversationStore } from "./viewer-
|
|
3
|
-
import {
|
|
4
|
-
import { p as credentialContextSchema } from "./registry-
|
|
1
|
+
import { g as TURN_REASONING_LEVELS } from "./config-Dt3CpG17.js";
|
|
2
|
+
import { C as getSqlExecutor, x as getConversationStore } from "./viewer-BlpnzZZa.js";
|
|
3
|
+
import { g as juniorAgentInvocations, h as juniorAgentBindings } from "./executor-CyIwHz9r.js";
|
|
4
|
+
import { p as credentialContextSchema } from "./registry-DOnPkI8g.js";
|
|
5
5
|
import { S as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, x as AGENT_INVOCATION_MAILBOX_STATUSES } from "./reporting-window-B-QP9zX1.js";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
import * as z from "zod";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { At as requestAnotherSlice$1, Dt as recordConversationRetry$1, Et as recordAttemptFailure$1, Mt as startConversationWork$1, Nt as steerWebPendingMessages$1, Ot as releaseConversationWork$1, Pt as stopConversationWork$1, Tt as markConversationWorkEnqueued$1, _t as drainConversationMailbox$1, ct as appendInboundMessage, dt as checkInConversationWork$1, ft as clearConsumedConversationWake$1, gt as deadLetterAttempt$1, ht as completeConversationWork$1, jt as requestConversationWork$1, kt as removeActiveConversation$1, lt as beginConversationResume$1, mt as completeConversationStop$1, ot as ackMessages$1, pt as clearExpiredConversationLease$1, st as appendExclusiveInboundMessage, ut as cancelHumanFacingPendingMessages$1, vt as getConversation$1, wt as listActiveConversationIds$1, yt as getConversationWorkState$1 } from "./projection-
|
|
2
|
-
import { x as getConversationStore } from "./viewer-
|
|
3
|
-
import "./background-compaction-queue-
|
|
1
|
+
import { At as requestAnotherSlice$1, Dt as recordConversationRetry$1, Et as recordAttemptFailure$1, Mt as startConversationWork$1, Nt as steerWebPendingMessages$1, Ot as releaseConversationWork$1, Pt as stopConversationWork$1, Tt as markConversationWorkEnqueued$1, _t as drainConversationMailbox$1, ct as appendInboundMessage, dt as checkInConversationWork$1, ft as clearConsumedConversationWake$1, gt as deadLetterAttempt$1, ht as completeConversationWork$1, jt as requestConversationWork$1, kt as removeActiveConversation$1, lt as beginConversationResume$1, mt as completeConversationStop$1, ot as ackMessages$1, pt as clearExpiredConversationLease$1, st as appendExclusiveInboundMessage, ut as cancelHumanFacingPendingMessages$1, vt as getConversation$1, wt as listActiveConversationIds$1, yt as getConversationWorkState$1 } from "./projection-0UcUeuzn.js";
|
|
2
|
+
import { x as getConversationStore } from "./viewer-BlpnzZZa.js";
|
|
3
|
+
import "./background-compaction-queue-CHFzrQbS.js";
|
|
4
4
|
// src/chat/task-execution/store.ts
|
|
5
5
|
function metadataStore(options) {
|
|
6
6
|
return options.conversationStore ?? getConversationStore();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as logWarn } from "./logging-
|
|
2
|
-
import { _ as runWithTurnRequestDeadline, f as QUEUE_SIGNATURE_MAX_AGE_MS, h as getQueueProvider, m as verifyQueueMessage, p as signQueueMessage } from "./background-compaction-queue-
|
|
1
|
+
import { h as logWarn } from "./logging-Qo-7xGp1.js";
|
|
2
|
+
import { _ as runWithTurnRequestDeadline, f as QUEUE_SIGNATURE_MAX_AGE_MS, h as getQueueProvider, m as verifyQueueMessage, p as signQueueMessage } from "./background-compaction-queue-CHFzrQbS.js";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
import * as z from "zod";
|
|
5
5
|
// src/chat/queue/callback.ts
|
|
@@ -110,7 +110,7 @@ function pluginTaskCallback() {
|
|
|
110
110
|
maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
|
|
111
111
|
onRejected: logPluginTaskQueueMessageRejected,
|
|
112
112
|
run: async (message) => {
|
|
113
|
-
const { processPluginTask } = await import("./task-runner-
|
|
113
|
+
const { processPluginTask } = await import("./task-runner-B65cDumh.js").then((n) => n.r);
|
|
114
114
|
await processPluginTask(message);
|
|
115
115
|
},
|
|
116
116
|
topic: PLUGIN_TASK_QUEUE_TOPIC,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import {
|
|
2
|
+
import { $a as createPluginConversationEvents, Bn as coreTaskRegistrations, Co as createPluginCache, Gt as getPiMessageRole, Ln as getPlugins, Ra as createPluginModelCostRecorder, Ta as createPluginModel, Xt as instructionTextForProjection, ei as createPluginState, en as isToolResultError, in as stripRuntimeTurnContext, nn as normalizeToolNameFromResult, tn as isToolResultMessage, tt as getTurnRecord, v as hydrateConversationMessages, wa as createPluginEmbedder, za as createPluginLogger } from "./projection-0UcUeuzn.js";
|
|
3
|
+
import { E as withSpan } from "./logging-Qo-7xGp1.js";
|
|
3
4
|
import { h as parseSlackMessageTs } from "./actor-6jsm_v96.js";
|
|
4
|
-
import { S as getDb, i as readActorIdentity, x as getConversationStore } from "./viewer-
|
|
5
|
+
import { S as getDb, i as readActorIdentity, x as getConversationStore } from "./viewer-BlpnzZZa.js";
|
|
5
6
|
import { v as sameActorIdentity } from "./media-Bu9C6lz0.js";
|
|
6
|
-
import { r as getStateAdapter } from "./adapter-
|
|
7
|
-
import { t as resolveConversationRouting, u as getDispatchRecord } from "./turn-session-routing-
|
|
8
|
-
import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-
|
|
9
|
-
import { i as pluginTaskParamsSchema, r as pluginTaskId, s as sendVercelPluginTask } from "./task-queue-
|
|
7
|
+
import { r as getStateAdapter } from "./adapter-CW5UW7vL.js";
|
|
8
|
+
import { t as resolveConversationRouting, u as getDispatchRecord } from "./turn-session-routing-D_GXfcAG.js";
|
|
9
|
+
import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-D6rNGQu9.js";
|
|
10
|
+
import { i as pluginTaskParamsSchema, r as pluginTaskId, s as sendVercelPluginTask } from "./task-queue-BcOHzXxe.js";
|
|
10
11
|
import { pluginRunContextSchema } from "@sentry/junior-plugin-api";
|
|
11
12
|
// src/chat/plugins/task-runner.ts
|
|
12
13
|
/**
|
|
@@ -270,12 +271,20 @@ async function scheduleSessionCompletedPluginTasks(params, options = {}) {
|
|
|
270
271
|
await send(message);
|
|
271
272
|
}));
|
|
272
273
|
}
|
|
273
|
-
/**
|
|
274
|
+
/**
|
|
275
|
+
* Execute one parsed plugin task request in a `plugin.task` span. The span
|
|
276
|
+
* includes the lock wait, because both delay the work that runs the task.
|
|
277
|
+
*/
|
|
274
278
|
async function processPluginTask(message, options = {}) {
|
|
275
|
-
|
|
279
|
+
const params = pluginTaskParamsSchema.parse(message.params);
|
|
280
|
+
await withSpan(`plugin.task ${message.plugin}.${message.name}`, "plugin.task", { conversationId: params.conversationId }, () => withPluginTaskLock(pluginTaskId(message), async () => {
|
|
276
281
|
const resolved = findPluginTask(message);
|
|
277
282
|
if (!resolved?.task) throw new Error(`Plugin task "${message.plugin}.${message.name}" is not registered`);
|
|
278
283
|
await resolved.task.run(taskPluginContext(resolved.plugin, message, options));
|
|
284
|
+
}), {
|
|
285
|
+
"app.ai.turn.session_id": params.sessionId,
|
|
286
|
+
"app.plugin.name": message.plugin,
|
|
287
|
+
"app.plugin.task": message.name
|
|
279
288
|
});
|
|
280
289
|
}
|
|
281
290
|
export { scheduleSessionCompletedPluginTasks as n, task_runner_exports as r, processPluginTask as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { G as toOptionalNumber, K as toOptionalString, W as isRecord } from "./logging-
|
|
3
|
-
import { S as getDb } from "./viewer-
|
|
4
|
-
import { r as getStateAdapter } from "./adapter-
|
|
1
|
+
import { Kr as JUNIOR_THREAD_STATE_TTL_MS, wo as createDurableLocationConfigurationService, y as persistConversationMessages } from "./projection-0UcUeuzn.js";
|
|
2
|
+
import { G as toOptionalNumber, K as toOptionalString, W as isRecord } from "./logging-Qo-7xGp1.js";
|
|
3
|
+
import { S as getDb } from "./viewer-BlpnzZZa.js";
|
|
4
|
+
import { r as getStateAdapter } from "./adapter-CW5UW7vL.js";
|
|
5
5
|
// src/chat/state/conversation.ts
|
|
6
6
|
function defaultConversationState() {
|
|
7
7
|
return {
|