@sentry/junior 0.277.0 → 0.279.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-BtfBHVM5.js → adapter-phTTgw7H.js} +1 -1
- package/dist/{admin-DzAKbZsm.js → admin-PcpJDugZ.js} +1 -1
- package/dist/{agent-invocations-Crs3XHhg.js → agent-invocations-CUg_SODU.js} +0 -1
- package/dist/{agent-runner-BsYAbniN.js → agent-runner-DwvT1BY0.js} +321 -847
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +6 -6
- package/dist/api.d.ts +1 -1
- package/dist/api.js +46 -414
- package/dist/{app-BjEQwNVP.d.ts → app-DVs6noo7.d.ts} +6 -27
- package/dist/app.d.ts +2 -2
- package/dist/app.js +460 -78
- package/dist/{assistant-reply-NebRGG4G.js → assistant-reply-BXfxczd7.js} +28 -6
- package/dist/{automation-Cql9h2vO.js → automation-BehArCcq.js} +1 -1
- package/dist/{background-compaction-queue-hh18yCeU.js → background-compaction-queue-CcbuLJrZ.js} +2 -2
- package/dist/{briefs-BBo0Eimi.js → briefs-Dd_ezwED.js} +10 -10
- package/dist/{catalog-runtime-DE-F4Awo.js → catalog-runtime-BWVMeZhW.js} +2 -2
- package/dist/cli/chat.js +16 -16
- package/dist/cli/check.js +3 -3
- package/dist/cli/init.js +0 -2
- package/dist/cli/main.js +4 -4
- package/dist/cli/plugins.js +5 -5
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +4 -4
- package/dist/{client-DZ8HTnYH.js → client-Bpxe4vKa.js} +8 -4
- package/dist/{config-D5uUtrCP.js → config-C_bmRhrJ.js} +25 -100
- package/dist/{connections-Do24CGP5.js → connections-B2rHe5W5.js} +10 -10
- package/dist/{conversation-SsASlWL7.js → conversation-CIiJtx5q.js} +56 -104
- package/dist/conversation-pending-messages-CnBvE6-6.js +173 -0
- package/dist/{conversation-privacy-VuylvlKr.js → conversation-privacy-CzOfcz0U.js} +1 -1
- package/dist/{credential-sync-BGQK3pOa.js → credential-sync-Dal_unpv.js} +15 -15
- package/dist/{db-DEiwO5Sh.d.ts → db-CyLrV9C7.d.ts} +1 -1
- package/dist/{executor-hPfFTH0C.js → executor-BfYH-Wws.js} +6 -4
- package/dist/instrumentation.d.ts +12 -0
- package/dist/instrumentation.js +56 -23
- package/dist/{logging-cI3T1dNc.js → logging-CkT3_Xxp.js} +2 -2
- package/dist/{media-DstkkoNP.js → media-DTAA8Qs_.js} +21 -23
- package/dist/{message-DBwsAl7O.js → message-Q5dkgaJ5.js} +23 -29
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +18 -6
- package/dist/{oauth-callback-server-DXrnbplb.js → oauth-callback-server-BDRaqe8O.js} +2 -2
- package/dist/{oauth-relay-C6ZAyJgf.js → oauth-relay-D0G3T16m.js} +1 -1
- package/dist/{package-discovery-DJBompdd.js → package-discovery-DJhGdS4c.js} +1 -1
- package/dist/{plugins-DOm9Y6qI.js → plugins-HYh_JOdw.js} +1 -1
- package/dist/{projection-7EFIqzuj.js → projection-DWxX7pb1.js} +214 -138
- package/dist/{prompt-oRfGsxd3.js → prompt--dwus7Y-.js} +1 -1
- package/dist/proxy-path-BHYoKZdq.js +15 -0
- package/dist/{registry-Bzefs7kT.js → registry-DnrdeO4s.js} +2 -2
- package/dist/{resolve-CuiEY_2u.js → resolve-C_QXfqD_.js} +3 -3
- package/dist/{result-DrcUtFaD.js → result-DNmOxT-N.js} +10 -10
- package/dist/{runner-CDE4CZ52.js → runner-zd_noJ1l.js} +11 -11
- package/dist/{sandbox-egress-signals-0tcmGd13.js → sandbox-egress-signals-DQjv-nbG.js} +1 -1
- package/dist/{schema-Dzi3lkdP.js → schema-CNJNzvr8.js} +4 -4
- package/dist/{schema-B6N2nc6v.d.ts → schema-e90H5FIN.d.ts} +2176 -967
- package/dist/sentry-BRTJqumy.js +51 -0
- package/dist/sentry-DrKC2NeM.d.ts +1 -0
- package/dist/sentry-route-name-BhwWnfqj.js +51 -0
- package/dist/{service-account-BOz9pqOE.js → service-account-BK26XlHo.js} +3 -3
- package/dist/{service-account-DIyz_9Uh.js → service-account-CCH2Hv4h.js} +3 -3
- package/dist/{session-stop-0juF_BP0.js → session-stop-6Tf--T7G.js} +23 -16
- package/dist/{skills-CU5Is147.js → skills-BNrk8gi4.js} +4 -4
- package/dist/{spawn-6C9jHH4b.js → spawn-C75hAB9l.js} +3 -4
- package/dist/{stop-6FVG1c-r.js → stop-RYbf7PWi.js} +742 -207
- package/dist/{store-DtHZviJ1.js → store-CO5vGjwD.js} +9 -16
- package/dist/{store-DKs1WwdB.js → store-G3h2djJU.js} +3 -3
- package/dist/{task-queue-CcvFQE_p.js → task-queue-DlN58XeM.js} +3 -3
- package/dist/{task-runner-DBkNejLl.js → task-runner-B-Bdm23d.js} +22 -10
- package/dist/{thread-state-4hjEIkIq.js → thread-state-Cj_7Slru.js} +4 -4
- package/dist/{turn-failure-response-BZNLydC3.js → turn-failure-response-CE7gaoC7.js} +7 -7
- package/dist/{turn-lifecycle-BhqYjaa4.js → turn-lifecycle-7sXwXLJ6.js} +1 -1
- package/dist/{turn-session-routing-jnLOfBHJ.js → turn-session-routing-FBdaH1zf.js} +10 -10
- package/dist/{validation-BUFmsnKs.js → validation-DLWxEzWW.js} +2 -2
- package/dist/{version-DJTk0ZCE.js → version-DtQ8WFIZ.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-WY0RYE4E.js → viewer-vsM8_90o.js} +53 -22
- package/dist/{work-C5AKvXJV.js → work-DsoFRO_0.js} +12 -17
- package/dist/{worker-BcYVDVUy.js → worker-6kZEsCXs.js} +7 -7
- package/migrations/0077_drop_agent_invocation_model_profile.sql +1 -0
- package/migrations/0078_plugin_conversation_index.sql +20 -0
- package/migrations/0079_conversation_event_author_index.sql +20 -0
- package/migrations/meta/0075_snapshot.json +98 -314
- package/migrations/meta/0076_snapshot.json +98 -314
- package/migrations/meta/0077_snapshot.json +4141 -0
- package/migrations/meta/0078_snapshot.json +4175 -0
- package/migrations/meta/0079_snapshot.json +4203 -0
- package/migrations/meta/_journal.json +22 -1
- package/package.json +5 -5
- package/dist/common-Eu6sx09c.js +0 -107
- package/dist/model-profile-B998sjVd.js +0 -67
- package/dist/rolldown-runtime-nwUcYXjP.js +0 -27
- package/dist/sentry-MDkYAVPV.js +0 -23
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as conversationTurnFailureReasonSchema, s as conversationTurnFailureCodeSchema, t as INPUT_IMAGE_TYPES, v as usageSchema } from "./media-
|
|
1
|
+
import { c as conversationTurnFailureReasonSchema, s as conversationTurnFailureCodeSchema, t as INPUT_IMAGE_TYPES, v as usageSchema } from "./media-DTAA8Qs_.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, objectFactFields, objectTypeSchema } from "@sentry/junior-plugin-api";
|
|
4
4
|
// src/chat/briefs/schema.ts
|
|
@@ -284,11 +284,35 @@ const conversationAttachmentParamsSchema = z.object({
|
|
|
284
284
|
attachmentId: z.string().min(1),
|
|
285
285
|
conversationId: z.string().min(1)
|
|
286
286
|
}).strict();
|
|
287
|
-
const conversationDetailQuerySchema = z.object({
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
287
|
+
const conversationDetailQuerySchema = z.object({
|
|
288
|
+
limit: z.coerce.number().int().min(1).max(1e3).default(500),
|
|
289
|
+
/** Also return `unreadPage` when the detail has an `unreadCursor`. */
|
|
290
|
+
unreadPage: z.stringbool().optional(),
|
|
291
|
+
/**
|
|
292
|
+
* Also return `mailbox`, read before history, and never answer 304. A
|
|
293
|
+
* first load gets both in one request.
|
|
294
|
+
*/
|
|
295
|
+
mailbox: z.stringbool().optional()
|
|
291
296
|
}).strict();
|
|
297
|
+
const conversationEventsLimitSchema = z.coerce.number().int().min(1).max(1e3).default(500);
|
|
298
|
+
/**
|
|
299
|
+
* Page toward the start with `before`, toward the latest with `after`, or
|
|
300
|
+
* both ways from one event with `around`.
|
|
301
|
+
*/
|
|
302
|
+
const conversationEventsQuerySchema = z.union([
|
|
303
|
+
z.object({
|
|
304
|
+
before: z.string().min(1),
|
|
305
|
+
limit: conversationEventsLimitSchema
|
|
306
|
+
}).strict(),
|
|
307
|
+
z.object({
|
|
308
|
+
after: z.string().min(1),
|
|
309
|
+
limit: conversationEventsLimitSchema
|
|
310
|
+
}).strict(),
|
|
311
|
+
z.object({
|
|
312
|
+
around: z.string().min(1),
|
|
313
|
+
limit: conversationEventsLimitSchema
|
|
314
|
+
}).strict()
|
|
315
|
+
]);
|
|
292
316
|
const conversationFeedQuerySchema = z.object({
|
|
293
317
|
actorEmail: z.string().trim().email().transform((value) => value.toLowerCase()).optional(),
|
|
294
318
|
codeRepositoryId: z.string().uuid().optional(),
|
|
@@ -319,68 +343,6 @@ const actorIdentitySchema = z.object({
|
|
|
319
343
|
slackUserId: z.string().optional(),
|
|
320
344
|
slackUserName: z.string().optional()
|
|
321
345
|
}).strict();
|
|
322
|
-
/** Mailbox delivery mode for one accepted inbound message. */
|
|
323
|
-
const conversationPendingMessageDeliverySchema = z.enum(["defer", "interrupt"]);
|
|
324
|
-
/** One accepted mailbox message that has not reached durable history yet. */
|
|
325
|
-
const conversationPendingMessageSchema = z.object({
|
|
326
|
-
actorIdentity: actorIdentitySchema.optional(),
|
|
327
|
-
/** Identity id of the author. Detail `authors` maps it to the person. */
|
|
328
|
-
actorIdentityId: z.string().min(1).optional(),
|
|
329
|
-
createdAt: z.string().datetime(),
|
|
330
|
-
delivery: conversationPendingMessageDeliverySchema,
|
|
331
|
-
inboundMessageId: z.string().min(1),
|
|
332
|
-
messageId: z.string().min(1),
|
|
333
|
-
receivedAt: z.string().datetime(),
|
|
334
|
-
role: z.literal("user"),
|
|
335
|
-
source: z.enum(["slack", "web"]),
|
|
336
|
-
text: z.string().optional(),
|
|
337
|
-
/** People mentioned in the text, resolved at read time. */
|
|
338
|
-
mentions: z.array(actorIdentitySchema).optional(),
|
|
339
|
-
attachments: z.array(messageAttachmentSchema).optional(),
|
|
340
|
-
/** Review item change that this Message records. */
|
|
341
|
-
reviewItemChange: reviewItemChangeRecordSchema.optional(),
|
|
342
|
-
redacted: z.literal(true).optional()
|
|
343
|
-
}).strict().superRefine((data, context) => {
|
|
344
|
-
if (data.text === void 0 === (data.redacted !== true)) context.addIssue({
|
|
345
|
-
code: "custom",
|
|
346
|
-
message: "pending message content must be text or explicitly redacted"
|
|
347
|
-
});
|
|
348
|
-
if (data.redacted && (data.actorIdentity || data.attachments || data.mentions || data.reviewItemChange)) context.addIssue({
|
|
349
|
-
code: "custom",
|
|
350
|
-
message: "redacted pending messages must not expose actor identity, attachments, mentions, or a review item"
|
|
351
|
-
});
|
|
352
|
-
});
|
|
353
|
-
/** Participant-only authorization prompt for a parked web turn. */
|
|
354
|
-
const conversationPendingAuthorizationSchema = z.object({
|
|
355
|
-
authorizationUrl: z.string().url(),
|
|
356
|
-
completionText: z.string().min(1),
|
|
357
|
-
label: z.string().min(1)
|
|
358
|
-
}).strict();
|
|
359
|
-
/** Bounded mailbox snapshot for one conversation transcript. */
|
|
360
|
-
const conversationPendingMessagesReportSchema = z.object({
|
|
361
|
-
authorization: conversationPendingAuthorizationSchema.optional(),
|
|
362
|
-
conversationId: z.string().min(1),
|
|
363
|
-
generatedAt: z.string().datetime(),
|
|
364
|
-
messages: z.array(conversationPendingMessageSchema)
|
|
365
|
-
}).strict();
|
|
366
|
-
/** Optional filters for cancelling accepted mailbox rows. */
|
|
367
|
-
const cancelConversationPendingMessagesBodySchema = z.object({
|
|
368
|
-
inboundMessageIds: z.array(z.string().min(1)).min(1).optional(),
|
|
369
|
-
receivedBefore: z.string().datetime().optional()
|
|
370
|
-
}).strict();
|
|
371
|
-
/** Result of cancelling accepted human-facing mailbox rows. */
|
|
372
|
-
const cancelConversationPendingMessagesResponseSchema = z.object({
|
|
373
|
-
cancelledCount: z.number().int().nonnegative(),
|
|
374
|
-
cancelledInboundMessageIds: z.array(z.string().min(1)),
|
|
375
|
-
conversationId: z.string().min(1)
|
|
376
|
-
}).strict();
|
|
377
|
-
/** Queued web messages that the viewer wants Junior to read now. */
|
|
378
|
-
const steerConversationPendingMessagesBodySchema = z.object({ inboundMessageIds: z.array(z.string().min(1)).min(1) }).strict();
|
|
379
|
-
/** Result of steering queued web messages into the conversation. */
|
|
380
|
-
const steerConversationPendingMessagesResponseSchema = z.object({
|
|
381
|
-
conversationId: z.string().min(1),
|
|
382
|
-
steeredInboundMessageIds: z.array(z.string().min(1))
|
|
383
|
-
}).strict();
|
|
384
346
|
const conversationAuxiliaryCostsSchema = z.object({
|
|
385
347
|
costUsd: z.number().finite().nonnegative(),
|
|
386
348
|
operations: z.array(z.object({
|
|
@@ -493,6 +455,7 @@ const conversationReportMessageEventDataSchema = z.object({
|
|
|
493
455
|
eventType: z.string().min(1).optional(),
|
|
494
456
|
eventObjectType: objectTypeSchema.optional(),
|
|
495
457
|
explicitMention: z.boolean().optional(),
|
|
458
|
+
quiet: z.literal(true).optional(),
|
|
496
459
|
trustedSummary: z.string().min(1).optional(),
|
|
497
460
|
/**
|
|
498
461
|
* The Watch Events when several arrived together. A message that also
|
|
@@ -602,20 +565,6 @@ const conversationReportTurnLifecycleEventDataSchema = z.discriminatedUnion("sta
|
|
|
602
565
|
sentryEventUrl: z.string().url().optional()
|
|
603
566
|
}).strict()
|
|
604
567
|
]);
|
|
605
|
-
const conversationReportTurnRoutedEventDataSchema = z.object({
|
|
606
|
-
type: z.literal("turn_routed"),
|
|
607
|
-
turnId: z.string().min(1),
|
|
608
|
-
modelProfile: z.string().min(1),
|
|
609
|
-
modelId: z.string().min(1),
|
|
610
|
-
costUsd: z.number().finite().nonnegative().optional(),
|
|
611
|
-
reasoningLevel: z.string().min(1),
|
|
612
|
-
confidence: z.number().min(0).max(1).optional(),
|
|
613
|
-
source: z.enum([
|
|
614
|
-
"configured",
|
|
615
|
-
"inherited",
|
|
616
|
-
"router"
|
|
617
|
-
])
|
|
618
|
-
}).strict();
|
|
619
568
|
const conversationReportGuardianActionReviewedEventDataSchema = z.object({
|
|
620
569
|
type: z.literal("guardian_action_reviewed"),
|
|
621
570
|
turnId: z.string().min(1),
|
|
@@ -661,7 +610,6 @@ const conversationReportAttachmentsDeliveredEventDataSchema = z.object({
|
|
|
661
610
|
}).strict();
|
|
662
611
|
const conversationReportCompactionEventDataSchema = z.object({
|
|
663
612
|
type: z.literal("compaction"),
|
|
664
|
-
modelProfile: z.string().min(1).optional(),
|
|
665
613
|
modelId: z.string().min(1).optional(),
|
|
666
614
|
summary: z.string().min(1).optional(),
|
|
667
615
|
details: z.object({
|
|
@@ -675,14 +623,6 @@ const conversationReportCompactionEventDataSchema = z.object({
|
|
|
675
623
|
summaryChars: z.number().int().nonnegative()
|
|
676
624
|
}).strict().optional()
|
|
677
625
|
}).strict();
|
|
678
|
-
const conversationReportHandoffEventDataSchema = z.object({
|
|
679
|
-
type: z.literal("handoff"),
|
|
680
|
-
modelProfile: z.string().min(1),
|
|
681
|
-
modelId: z.string().min(1),
|
|
682
|
-
reasoningLevel: z.string().min(1).optional(),
|
|
683
|
-
triggeringToolCallId: z.string().min(1).optional(),
|
|
684
|
-
summary: z.string().min(1).optional()
|
|
685
|
-
}).strict();
|
|
686
626
|
const conversationReportSubagentEventDataSchema = z.object({
|
|
687
627
|
type: z.literal("subagent"),
|
|
688
628
|
startedSeq: z.number().int().nonnegative(),
|
|
@@ -711,10 +651,8 @@ const conversationReportEventDataSchema = z.discriminatedUnion("type", [
|
|
|
711
651
|
conversationReportTurnContextEventDataSchema,
|
|
712
652
|
conversationReportStructuredEventDataSchema,
|
|
713
653
|
conversationReportAttachmentsDeliveredEventDataSchema,
|
|
714
|
-
conversationReportTurnRoutedEventDataSchema,
|
|
715
654
|
conversationReportGuardianActionReviewedEventDataSchema,
|
|
716
655
|
conversationReportCompactionEventDataSchema,
|
|
717
|
-
conversationReportHandoffEventDataSchema,
|
|
718
656
|
conversationReportSubagentEventDataSchema
|
|
719
657
|
]);
|
|
720
658
|
/** One ordered, privacy-safe canonical event projected for API consumers. */
|
|
@@ -724,11 +662,7 @@ const conversationReportEventSchema = z.object({
|
|
|
724
662
|
data: conversationReportEventDataSchema,
|
|
725
663
|
/** People mentioned in the event text, resolved at read time. */
|
|
726
664
|
mentions: z.array(actorIdentitySchema).optional(),
|
|
727
|
-
model: z.object({
|
|
728
|
-
modelId: z.string().min(1),
|
|
729
|
-
modelProfile: z.string().min(1).optional(),
|
|
730
|
-
reasoningLevel: z.string().min(1).optional()
|
|
731
|
-
}).strict().optional(),
|
|
665
|
+
model: z.object({ modelId: z.string().min(1) }).strict().optional(),
|
|
732
666
|
modelCall: z.object({
|
|
733
667
|
provider: z.string().min(1).optional(),
|
|
734
668
|
api: z.string().min(1).optional(),
|
|
@@ -841,6 +775,20 @@ const conversationAgentTreeNodeSchema = z.object({
|
|
|
841
775
|
conversationId: z.string().min(1),
|
|
842
776
|
label: z.string().min(1)
|
|
843
777
|
}).strict();
|
|
778
|
+
const conversationEventPageSchema = z.object({
|
|
779
|
+
events: z.array(conversationReportEventSchema),
|
|
780
|
+
eventHistory: conversationEventHistorySchema,
|
|
781
|
+
previousCursor: z.string().min(1).optional(),
|
|
782
|
+
/** Present on `after` and `around` pages when newer events follow. */
|
|
783
|
+
nextCursor: z.string().min(1).optional(),
|
|
784
|
+
generatedAt: z.string()
|
|
785
|
+
}).strict().superRefine(validateConversationEvents);
|
|
786
|
+
/**
|
|
787
|
+
* Carries the detail version token in both directions. A custom header, not
|
|
788
|
+
* `ETag` / `If-None-Match`: in production the Vercel CDN answered standard
|
|
789
|
+
* validators itself, after the function had already built the full report.
|
|
790
|
+
*/
|
|
791
|
+
const CONVERSATION_DETAIL_VERSION_HEADER = "x-junior-detail-version";
|
|
844
792
|
const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
|
|
845
793
|
/**
|
|
846
794
|
* The parent chain of a child Conversation, root first, with this
|
|
@@ -853,6 +801,16 @@ const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
|
|
|
853
801
|
canFork: z.boolean().optional(),
|
|
854
802
|
/** How far the signed-in viewer has read. Absent until they read. */
|
|
855
803
|
readPosition: conversationReadPositionSchema.optional(),
|
|
804
|
+
/**
|
|
805
|
+
* Pass as `after` to the events API to read from the read position.
|
|
806
|
+
* Present only when unread events start before `events`.
|
|
807
|
+
*/
|
|
808
|
+
unreadCursor: z.string().min(1).optional(),
|
|
809
|
+
/**
|
|
810
|
+
* The `around` page of `unreadCursor`, when the request asks for it. A
|
|
811
|
+
* reader who opens at the read position needs no second request.
|
|
812
|
+
*/
|
|
813
|
+
unreadPage: conversationEventPageSchema.optional(),
|
|
856
814
|
forkedFromConversationId: z.string().optional(),
|
|
857
815
|
/** Title of the fork source, when the viewer can open it. */
|
|
858
816
|
forkedFromTitle: z.string().optional(),
|
|
@@ -878,15 +836,9 @@ const conversationDetailReportSchema = conversationSummaryReportSchema.extend({
|
|
|
878
836
|
sentryConversationUrl: z.string().optional(),
|
|
879
837
|
sourceTask: conversationSourceTaskSchema.optional()
|
|
880
838
|
}).strict().superRefine(validateConversationEvents);
|
|
881
|
-
const conversationEventPageSchema = z.object({
|
|
882
|
-
events: z.array(conversationReportEventSchema),
|
|
883
|
-
eventHistory: conversationEventHistorySchema,
|
|
884
|
-
previousCursor: z.string().min(1).optional(),
|
|
885
|
-
generatedAt: z.string()
|
|
886
|
-
}).strict().superRefine(validateConversationEvents);
|
|
887
839
|
const conversationFeedSchema = z.object({
|
|
888
840
|
conversations: z.array(conversationSummaryReportSchema),
|
|
889
841
|
source: z.literal("conversation_index"),
|
|
890
842
|
generatedAt: z.string()
|
|
891
843
|
}).strict();
|
|
892
|
-
export {
|
|
844
|
+
export { messageCardRef as A, briefLinkSchema as B, createConversationMessageBodySchema as C, conversationReadPositionSchema as D, conversationChildAgentTotalsSchema as E, MAX_INPUT_IMAGES as F, conversationBriefSchema as H, MAX_INPUT_IMAGE_BYTES as I, messageAttachmentSchema as L, readMessageCardRefs as M, removedCardSchema as N, reviewItemChangeRecordSchema as O, resolveMessageCards as P, readMessageAttachments as R, createConversationBodySchema as S, forkConversationResponseSchema as T, parseBriefInput as U, briefOutcomeStatusSchema as V, conversationReportMessageEventSchema as _, conversationAttachmentParamsSchema as a, conversationSurfaceSchema as b, conversationDetailReportSchema as c, conversationEventsQuerySchema as d, conversationFeedQuerySchema as f, conversationReportEventSchema as g, conversationReportEventDataSchema as h, conversationActivityPreviewSchema as i, messageCardText as j, annotationCard as k, conversationEventHistorySchema as l, conversationParamsSchema as m, acceptedConversationMessageSchema as n, conversationAuxiliaryCostsSchema as o, conversationFeedSchema as p, actorIdentitySchema as r, conversationDetailQuerySchema as s, CONVERSATION_DETAIL_VERSION_HEADER as t, conversationEventPageSchema as u, conversationReportStatusSchema as v, forkConversationBodySchema as w, conversationUsageSchema as x, conversationSummaryReportSchema as y, briefCodeChangeSchema as z };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { L as messageAttachmentSchema, O as reviewItemChangeRecordSchema, c as conversationDetailReportSchema, r as actorIdentitySchema } from "./conversation-CIiJtx5q.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
// src/reporting-schema.ts
|
|
4
|
+
const healthReportSchema = z.object({
|
|
5
|
+
status: z.literal("ok"),
|
|
6
|
+
service: z.string(),
|
|
7
|
+
timestamp: z.string()
|
|
8
|
+
}).strict();
|
|
9
|
+
const pluginSchema = z.object({
|
|
10
|
+
configKeys: z.array(z.string()),
|
|
11
|
+
description: z.string(),
|
|
12
|
+
displayName: z.string(),
|
|
13
|
+
name: z.string()
|
|
14
|
+
}).strict();
|
|
15
|
+
const pluginsSchema = z.array(pluginSchema);
|
|
16
|
+
const skillReportSchema = z.object({
|
|
17
|
+
name: z.string(),
|
|
18
|
+
pluginProvider: z.string().optional()
|
|
19
|
+
}).strict();
|
|
20
|
+
const skillReportsSchema = z.array(skillReportSchema);
|
|
21
|
+
const pluginPackageContentItemReportSchema = z.object({
|
|
22
|
+
dir: z.string(),
|
|
23
|
+
hasMigrationsDir: z.boolean(),
|
|
24
|
+
hasSkillsDir: z.boolean(),
|
|
25
|
+
packageName: z.string()
|
|
26
|
+
}).strict();
|
|
27
|
+
const pluginPackageContentReportSchema = z.object({
|
|
28
|
+
packageNames: z.array(z.string()),
|
|
29
|
+
packages: z.array(pluginPackageContentItemReportSchema),
|
|
30
|
+
manifestRoots: z.array(z.string()),
|
|
31
|
+
skillRoots: z.array(z.string()),
|
|
32
|
+
tracingIncludes: z.array(z.string())
|
|
33
|
+
}).strict();
|
|
34
|
+
const runtimeInfoReportSchema = z.object({
|
|
35
|
+
cwd: z.string(),
|
|
36
|
+
homeDir: z.string(),
|
|
37
|
+
descriptionText: z.string().optional(),
|
|
38
|
+
providers: z.array(z.string()),
|
|
39
|
+
skills: z.array(skillReportSchema),
|
|
40
|
+
packagedContent: pluginPackageContentReportSchema
|
|
41
|
+
}).strict();
|
|
42
|
+
const pluginOperationalToneSchema = z.enum([
|
|
43
|
+
"danger",
|
|
44
|
+
"good",
|
|
45
|
+
"neutral",
|
|
46
|
+
"warning"
|
|
47
|
+
]);
|
|
48
|
+
const pluginOperationalMetricSchema = z.object({
|
|
49
|
+
label: z.string(),
|
|
50
|
+
tone: pluginOperationalToneSchema.optional(),
|
|
51
|
+
value: z.string()
|
|
52
|
+
}).strict();
|
|
53
|
+
const pluginOperationalFieldSchema = z.object({
|
|
54
|
+
key: z.string(),
|
|
55
|
+
label: z.string()
|
|
56
|
+
}).strict();
|
|
57
|
+
const pluginOperationalRecordSchema = z.object({
|
|
58
|
+
id: z.string(),
|
|
59
|
+
tone: pluginOperationalToneSchema.optional(),
|
|
60
|
+
values: z.record(z.string(), z.string())
|
|
61
|
+
}).strict();
|
|
62
|
+
const pluginOperationalRecordSetSchema = z.object({
|
|
63
|
+
fields: z.array(pluginOperationalFieldSchema).optional(),
|
|
64
|
+
emptyText: z.string().optional(),
|
|
65
|
+
records: z.array(pluginOperationalRecordSchema).optional(),
|
|
66
|
+
title: z.string()
|
|
67
|
+
}).strict();
|
|
68
|
+
const pluginOperationalBarChartWidgetSchema = z.object({
|
|
69
|
+
categories: z.array(z.object({
|
|
70
|
+
id: z.string().min(1),
|
|
71
|
+
label: z.string().min(1),
|
|
72
|
+
values: z.record(z.string(), z.number().finite())
|
|
73
|
+
}).strict()).max(100),
|
|
74
|
+
description: z.string().optional(),
|
|
75
|
+
emptyText: z.string().optional(),
|
|
76
|
+
id: z.string().min(1),
|
|
77
|
+
series: z.array(z.object({
|
|
78
|
+
format: z.literal("usd").optional(),
|
|
79
|
+
key: z.string().min(1),
|
|
80
|
+
label: z.string().min(1),
|
|
81
|
+
tone: pluginOperationalToneSchema.optional()
|
|
82
|
+
}).strict()).min(1).max(8),
|
|
83
|
+
timeRangeDays: z.array(z.union([
|
|
84
|
+
z.literal(1),
|
|
85
|
+
z.literal(7),
|
|
86
|
+
z.literal(30),
|
|
87
|
+
z.literal(90)
|
|
88
|
+
])).min(1).max(4).optional(),
|
|
89
|
+
title: z.string().min(1),
|
|
90
|
+
type: z.literal("bar_chart")
|
|
91
|
+
}).strict();
|
|
92
|
+
const pluginOperationalReportSchema = z.object({
|
|
93
|
+
generatedAt: z.string().optional(),
|
|
94
|
+
metrics: z.array(pluginOperationalMetricSchema).optional(),
|
|
95
|
+
recordSets: z.array(pluginOperationalRecordSetSchema).optional(),
|
|
96
|
+
title: z.string().optional(),
|
|
97
|
+
pluginName: z.string(),
|
|
98
|
+
widgets: z.array(pluginOperationalBarChartWidgetSchema).max(12).optional()
|
|
99
|
+
}).strict();
|
|
100
|
+
const pluginOperationalReportFeedSchema = z.object({
|
|
101
|
+
generatedAt: z.string(),
|
|
102
|
+
reports: z.array(pluginOperationalReportSchema),
|
|
103
|
+
source: z.literal("plugins")
|
|
104
|
+
}).strict();
|
|
105
|
+
// src/api/schema/common.ts
|
|
106
|
+
/** Stable error body returned by Junior-owned REST endpoints. */
|
|
107
|
+
const apiErrorSchema = z.object({ error: z.string().min(1) }).strict();
|
|
108
|
+
// src/api/schema/conversation-pending-messages.ts
|
|
109
|
+
/** Mailbox delivery mode for one accepted inbound message. */
|
|
110
|
+
const conversationPendingMessageDeliverySchema = z.enum(["defer", "interrupt"]);
|
|
111
|
+
/** One accepted mailbox message that has not reached durable history yet. */
|
|
112
|
+
const conversationPendingMessageSchema = z.object({
|
|
113
|
+
actorIdentity: actorIdentitySchema.optional(),
|
|
114
|
+
/** Identity id of the author. Detail `authors` maps it to the person. */
|
|
115
|
+
actorIdentityId: z.string().min(1).optional(),
|
|
116
|
+
createdAt: z.string().datetime(),
|
|
117
|
+
delivery: conversationPendingMessageDeliverySchema,
|
|
118
|
+
inboundMessageId: z.string().min(1),
|
|
119
|
+
messageId: z.string().min(1),
|
|
120
|
+
receivedAt: z.string().datetime(),
|
|
121
|
+
role: z.literal("user"),
|
|
122
|
+
source: z.enum(["slack", "web"]),
|
|
123
|
+
text: z.string().optional(),
|
|
124
|
+
/** People mentioned in the text, resolved at read time. */
|
|
125
|
+
mentions: z.array(actorIdentitySchema).optional(),
|
|
126
|
+
attachments: z.array(messageAttachmentSchema).optional(),
|
|
127
|
+
/** Review item change that this Message records. */
|
|
128
|
+
reviewItemChange: reviewItemChangeRecordSchema.optional(),
|
|
129
|
+
redacted: z.literal(true).optional()
|
|
130
|
+
}).strict().superRefine((data, context) => {
|
|
131
|
+
if (data.text === void 0 === (data.redacted !== true)) context.addIssue({
|
|
132
|
+
code: "custom",
|
|
133
|
+
message: "pending message content must be text or explicitly redacted"
|
|
134
|
+
});
|
|
135
|
+
if (data.redacted && (data.actorIdentity || data.attachments || data.mentions || data.reviewItemChange)) context.addIssue({
|
|
136
|
+
code: "custom",
|
|
137
|
+
message: "redacted pending messages must not expose actor identity, attachments, mentions, or a review item"
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
/** Participant-only authorization prompt for a parked web turn. */
|
|
141
|
+
const conversationPendingAuthorizationSchema = z.object({
|
|
142
|
+
authorizationUrl: z.string().url(),
|
|
143
|
+
completionText: z.string().min(1),
|
|
144
|
+
label: z.string().min(1)
|
|
145
|
+
}).strict();
|
|
146
|
+
/** Bounded mailbox snapshot for one conversation transcript. */
|
|
147
|
+
const conversationPendingMessagesReportSchema = z.object({
|
|
148
|
+
authorization: conversationPendingAuthorizationSchema.optional(),
|
|
149
|
+
conversationId: z.string().min(1),
|
|
150
|
+
generatedAt: z.string().datetime(),
|
|
151
|
+
messages: z.array(conversationPendingMessageSchema)
|
|
152
|
+
}).strict();
|
|
153
|
+
/** Detail report with the mailbox that was read before its history. */
|
|
154
|
+
const conversationDetailWithMailboxReportSchema = conversationDetailReportSchema.extend({ mailbox: conversationPendingMessagesReportSchema });
|
|
155
|
+
/** Optional filters for cancelling accepted mailbox rows. */
|
|
156
|
+
const cancelConversationPendingMessagesBodySchema = z.object({
|
|
157
|
+
inboundMessageIds: z.array(z.string().min(1)).min(1).optional(),
|
|
158
|
+
receivedBefore: z.string().datetime().optional()
|
|
159
|
+
}).strict();
|
|
160
|
+
/** Result of cancelling accepted human-facing mailbox rows. */
|
|
161
|
+
const cancelConversationPendingMessagesResponseSchema = z.object({
|
|
162
|
+
cancelledCount: z.number().int().nonnegative(),
|
|
163
|
+
cancelledInboundMessageIds: z.array(z.string().min(1)),
|
|
164
|
+
conversationId: z.string().min(1)
|
|
165
|
+
}).strict();
|
|
166
|
+
/** Queued web messages that the viewer wants Junior to read now. */
|
|
167
|
+
const steerConversationPendingMessagesBodySchema = z.object({ inboundMessageIds: z.array(z.string().min(1)).min(1) }).strict();
|
|
168
|
+
/** Result of steering queued web messages into the conversation. */
|
|
169
|
+
const steerConversationPendingMessagesResponseSchema = z.object({
|
|
170
|
+
conversationId: z.string().min(1),
|
|
171
|
+
steeredInboundMessageIds: z.array(z.string().min(1))
|
|
172
|
+
}).strict();
|
|
173
|
+
export { pluginsSchema as _, conversationPendingMessageDeliverySchema as a, skillReportsSchema as b, steerConversationPendingMessagesBodySchema as c, healthReportSchema as d, pluginOperationalReportFeedSchema as f, pluginSchema as g, pluginPackageContentReportSchema as h, conversationPendingAuthorizationSchema as i, steerConversationPendingMessagesResponseSchema as l, pluginPackageContentItemReportSchema as m, cancelConversationPendingMessagesResponseSchema as n, conversationPendingMessageSchema as o, pluginOperationalReportSchema as p, conversationDetailWithMailboxReportSchema as r, conversationPendingMessagesReportSchema as s, cancelConversationPendingMessagesBodySchema as t, apiErrorSchema as u, runtimeInfoReportSchema as v, skillReportSchema as y };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { m as escapeXml } from "./client-
|
|
3
|
-
import { a as getRuntimeMetadata, n as botConfig } from "./config-
|
|
4
|
-
import { H as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-
|
|
1
|
+
import { On as resolvePluginOAuthAccount, d as recordAuthorizationCompleted, hi as resolveBaseUrl, ki as postSlackMessage, mi as parseOAuthStatePayload, pi as formatProviderLabel, q as getConversationPendingAuth, tt as getTurnRecord, u as recordAuthenticationLinked, wn as createUserTokenStore, zi as getSlackClient } from "./projection-DWxX7pb1.js";
|
|
2
|
+
import { m as escapeXml } from "./client-Bpxe4vKa.js";
|
|
3
|
+
import { a as getRuntimeMetadata, n as botConfig } from "./config-C_bmRhrJ.js";
|
|
4
|
+
import { H as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-CkT3_Xxp.js";
|
|
5
5
|
import { p as parseSlackUserId } from "./actor-B4DYygOB.js";
|
|
6
|
-
import {
|
|
7
|
-
import { i as homeDir } from "./package-discovery-
|
|
8
|
-
import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-
|
|
9
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
10
|
-
import { t as discoverSkills } from "./skills-
|
|
11
|
-
import { d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, y as lookupSlackUserProfile } from "./agent-runner-
|
|
6
|
+
import { B as findUserByVerifiedEmails, C as getSqlExecutor, I as resolveActorIdentityId, W as upsertLinkedIdentity, o as readIdentityById } from "./viewer-vsM8_90o.js";
|
|
7
|
+
import { i as homeDir } from "./package-discovery-DJhGdS4c.js";
|
|
8
|
+
import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-DnrdeO4s.js";
|
|
9
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BWVMeZhW.js";
|
|
10
|
+
import { t as discoverSkills } from "./skills-BNrk8gi4.js";
|
|
11
|
+
import { d as getMcpAuthSession, f as getMcpStoredOAuthCredentials, o as finalizeMcpAuthorization, p as putMcpStoredOAuthCredentials, s as deleteMcpAuthSession, y as lookupSlackUserProfile } from "./agent-runner-DwvT1BY0.js";
|
|
12
12
|
import { r as acquireActiveLock } from "./locks-D-0h111u.js";
|
|
13
|
-
import { r as getStateAdapter } from "./adapter-
|
|
14
|
-
import { _ as getMcpProviderErrorAttributes } from "./service-account-
|
|
15
|
-
import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-
|
|
16
|
-
import { c as deleteWebAuthorization, i as readConnectedOAuthTokens, m as wakePausedTurn, p as wakeAuthorizedTurn, u as htmlCallbackResponse } from "./connections-
|
|
17
|
-
import { n as relayLocalOAuthCallback } from "./oauth-relay-
|
|
13
|
+
import { r as getStateAdapter } from "./adapter-phTTgw7H.js";
|
|
14
|
+
import { _ as getMcpProviderErrorAttributes } from "./service-account-CCH2Hv4h.js";
|
|
15
|
+
import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-Cj_7Slru.js";
|
|
16
|
+
import { c as deleteWebAuthorization, i as readConnectedOAuthTokens, m as wakePausedTurn, p as wakeAuthorizedTurn, u as htmlCallbackResponse } from "./connections-B2rHe5W5.js";
|
|
17
|
+
import { n as relayLocalOAuthCallback } from "./oauth-relay-D0G3T16m.js";
|
|
18
18
|
import path from "node:path";
|
|
19
19
|
import { createHmac, createSecretKey, timingSafeEqual } from "node:crypto";
|
|
20
20
|
import { z } from "zod";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./config-
|
|
2
|
-
import { p as logException } from "./logging-
|
|
3
|
-
import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, f as timestamptz, i as juniorAgentBindings, l as juniorUsers, s as juniorConversations } from "./agent-invocations-
|
|
1
|
+
import "./config-C_bmRhrJ.js";
|
|
2
|
+
import { p as logException } from "./logging-CkT3_Xxp.js";
|
|
3
|
+
import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, f as timestamptz, i as juniorAgentBindings, l as juniorUsers, s as juniorConversations } from "./agent-invocations-CUg_SODU.js";
|
|
4
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
5
|
import { sql } from "drizzle-orm";
|
|
6
6
|
import { bigint, boolean, check, date, doublePrecision, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, uniqueIndex, uuid } from "drizzle-orm/pg-core";
|
|
@@ -153,7 +153,9 @@ const juniorConversationEvents = pgTable("junior_conversation_events", {
|
|
|
153
153
|
index("junior_conversation_events_history_version_idx").on(table.conversationId, table.historyVersion, table.seq),
|
|
154
154
|
index("junior_conversation_events_type_idx").on(table.conversationId, table.type, table.seq),
|
|
155
155
|
index("junior_conversation_events_plugin_report_idx").on(sql`(${table.payload}->>'namespace')`, sql`(${table.payload}->>'name')`, table.createdAt).where(sql`${table.type} = 'structured_event'`),
|
|
156
|
+
index("junior_conversation_events_plugin_conversation_idx").on(table.conversationId, sql`(${table.payload}->>'namespace')`, sql`(${table.payload}->>'name')`, table.seq).where(sql`${table.type} = 'structured_event'`),
|
|
156
157
|
index("junior_conversation_events_actor_identity_idx").on(table.actorIdentityId, table.conversationId, table.seq),
|
|
158
|
+
index("junior_conversation_events_author_idx").on(table.conversationId, table.actorIdentityId, table.seq).where(sql`${table.actorIdentityId} is not null`),
|
|
157
159
|
index("junior_conversation_events_message_search_idx").using("gin", sql`to_tsvector('english', ${table.payload}->>'text')`).where(sql`${table.type} = 'message'`),
|
|
158
160
|
uniqueIndex("junior_conversation_events_idempotency_idx").on(table.conversationId, table.idempotencyKey)
|
|
159
161
|
]);
|
|
@@ -676,7 +678,7 @@ var NeonExecutor = class {
|
|
|
676
678
|
function createNeonJuniorSqlExecutor(args) {
|
|
677
679
|
const pool = new Pool({
|
|
678
680
|
connectionString: args.connectionString,
|
|
679
|
-
max:
|
|
681
|
+
max: 10,
|
|
680
682
|
statement_timeout: args.statementTimeoutMs
|
|
681
683
|
});
|
|
682
684
|
pool.on("error", (error) => {
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import "./sentry-DrKC2NeM.js";
|
|
2
|
+
import { MiddlewareHandler } from "hono";
|
|
3
|
+
/**
|
|
4
|
+
* Name the current request span after a route pattern. Spans that end during
|
|
5
|
+
* the request take this name as their segment name.
|
|
6
|
+
*/
|
|
7
|
+
export declare function nameRequestRoute(method: string, route: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* Name the request span after the first route handler that matches in this
|
|
10
|
+
* app. Register it first in an app that another app calls through `fetch()`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function routeNameMiddleware(): MiddlewareHandler;
|
|
1
13
|
/** Browser SDK settings and the current request's trace, for an HTML page. */
|
|
2
14
|
export interface BrowserSentryConfig {
|
|
3
15
|
baggage?: string;
|
package/dist/instrumentation.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as getCurrentConversationPrivacy } from "./conversation-privacy-
|
|
1
|
+
import { a as getClient, c as init, i as getActiveSpan, o as getGlobalScope, p as spanToJSON, s as getTraceData } from "./sentry-BRTJqumy.js";
|
|
2
|
+
import { R as getDeploymentServiceVersion, z as getDeploymentTelemetryAttributes } from "./logging-CkT3_Xxp.js";
|
|
3
|
+
import { n as getCurrentConversationPrivacy } from "./conversation-privacy-CzOfcz0U.js";
|
|
4
|
+
import { n as redactSandboxEgressProxyPath } from "./proxy-path-BHYoKZdq.js";
|
|
4
5
|
import { t as consumePrivateTraceResultMarker } from "./private-trace-result-CE7_lEdq.js";
|
|
6
|
+
import { n as promoteHttpRouteName, r as routeNameMiddleware, t as nameRequestRoute } from "./sentry-route-name-BhwWnfqj.js";
|
|
5
7
|
import { performance } from "node:perf_hooks";
|
|
6
8
|
import { subscribe, unsubscribe } from "node:diagnostics_channel";
|
|
7
9
|
// src/chat/pi/gateway-request-timing.ts
|
|
@@ -130,14 +132,30 @@ const URL_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
|
|
|
130
132
|
"url.path"
|
|
131
133
|
]);
|
|
132
134
|
const SLACK_FILE_HOST = "files.slack.com";
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
const SECRET_HEADER_NAMES = /* @__PURE__ */ new Set([
|
|
136
|
+
"authorization",
|
|
137
|
+
"forwarded",
|
|
138
|
+
"referer",
|
|
139
|
+
"vercel-forwarded-path",
|
|
140
|
+
"x-hub-signature",
|
|
141
|
+
"x-hub-signature-256",
|
|
142
|
+
"x-junior-local-credential-signature",
|
|
143
|
+
"x-junior-sandbox-egress-token",
|
|
144
|
+
"x-slack-signature"
|
|
145
|
+
]);
|
|
146
|
+
const SDK_REQUEST_HEADER_PREFIX = "http.request.header.";
|
|
147
|
+
const URL_SPAN_NAME = /^([A-Z]+ )((?:https?:\/\/|\/)\S*)$/;
|
|
148
|
+
/** Drop the query and fragment, and hide the sandbox egress credential token. */
|
|
149
|
+
function scrubUrl(value) {
|
|
150
|
+
return redactSandboxEgressProxyPath(value.split(/[?#]/, 1)[0] ?? value);
|
|
151
|
+
}
|
|
152
|
+
function scrubSpanName(name) {
|
|
153
|
+
const match = URL_SPAN_NAME.exec(name);
|
|
154
|
+
return match ? `${match[1]}${scrubUrl(match[2] ?? "")}` : name;
|
|
139
155
|
}
|
|
140
156
|
function isSecretHeaderAttribute(key) {
|
|
157
|
+
const lowerKey = key.toLowerCase();
|
|
158
|
+
if (lowerKey.startsWith(SDK_REQUEST_HEADER_PREFIX) && SECRET_HEADER_NAMES.has(lowerKey.slice(20).replaceAll("_", "-"))) return true;
|
|
141
159
|
const normalized = key.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
142
160
|
return normalized.endsWith("xjuniorlocalcredentialsignature") || normalized.endsWith("xjuniorsandboxegresstoken");
|
|
143
161
|
}
|
|
@@ -160,29 +178,23 @@ function scrubSensitiveUrlAttributes(attributes) {
|
|
|
160
178
|
if (!attributes) return;
|
|
161
179
|
delete attributes["url.query"];
|
|
162
180
|
delete attributes["url.fragment"];
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return typeof value === "string" && value.includes(LOCAL_CREDENTIAL_PATH);
|
|
166
|
-
});
|
|
167
|
-
for (const key of Object.keys(attributes)) if (isSecretHeaderAttribute(key) || hasLocalCredentialUrl && key === "http.request.body.data") delete attributes[key];
|
|
181
|
+
delete attributes["http.request.body.data"];
|
|
182
|
+
for (const key of Object.keys(attributes)) if (isSecretHeaderAttribute(key)) delete attributes[key];
|
|
168
183
|
if (isSlackFileRequest(attributes)) {
|
|
169
184
|
scrubSlackFileUrls(attributes);
|
|
170
185
|
return;
|
|
171
186
|
}
|
|
172
187
|
for (const key of URL_ATTRIBUTE_KEYS) {
|
|
173
188
|
const value = attributes[key];
|
|
174
|
-
if (typeof value
|
|
175
|
-
attributes[key] = stripQuery(value);
|
|
189
|
+
if (typeof value === "string") attributes[key] = scrubUrl(value);
|
|
176
190
|
}
|
|
177
191
|
}
|
|
178
192
|
function scrubSensitiveRequest(request) {
|
|
179
193
|
if (!request) return;
|
|
180
194
|
const url = request.url;
|
|
181
|
-
if (url
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
if (url?.includes(LOCAL_CREDENTIAL_PATH)) delete request.data;
|
|
195
|
+
if (url !== void 0) request.url = scrubUrl(url);
|
|
196
|
+
delete request.query_string;
|
|
197
|
+
delete request.data;
|
|
186
198
|
if (!request.headers) return;
|
|
187
199
|
for (const key of Object.keys(request.headers)) if (SECRET_HEADER_NAMES.has(key.toLowerCase())) delete request.headers[key];
|
|
188
200
|
}
|
|
@@ -216,6 +228,7 @@ function scrubContainer(container) {
|
|
|
216
228
|
function scrubPrivateSentryEvent(event) {
|
|
217
229
|
scrubContainer(event);
|
|
218
230
|
scrubSensitiveRequest(event.request);
|
|
231
|
+
if (event.transaction) event.transaction = scrubSpanName(event.transaction);
|
|
219
232
|
scrubContainer(event.contexts?.trace);
|
|
220
233
|
for (const breadcrumb of event.breadcrumbs ?? []) scrubContainer(breadcrumb);
|
|
221
234
|
return event;
|
|
@@ -223,6 +236,10 @@ function scrubPrivateSentryEvent(event) {
|
|
|
223
236
|
/** Remove private conversation payloads and boundary secrets from streamed spans. */
|
|
224
237
|
function scrubPrivateSentrySpan(span) {
|
|
225
238
|
scrubContainer(span);
|
|
239
|
+
span.name = scrubSpanName(span.name);
|
|
240
|
+
const segmentName = span.attributes?.["sentry.segment.name"];
|
|
241
|
+
if (span.attributes && typeof segmentName === "string") span.attributes["sentry.segment.name"] = scrubSpanName(segmentName);
|
|
242
|
+
promoteHttpRouteName(span);
|
|
226
243
|
return span;
|
|
227
244
|
}
|
|
228
245
|
/** Remove private conversation payloads and boundary secrets from structured logs. */
|
|
@@ -302,7 +319,23 @@ function initSentry() {
|
|
|
302
319
|
attributes: { "url.path": "/_vercel/ping" }
|
|
303
320
|
}],
|
|
304
321
|
dataCollection: {
|
|
305
|
-
httpBodies: [
|
|
322
|
+
httpBodies: [],
|
|
323
|
+
httpHeaders: { request: { allow: [
|
|
324
|
+
"accept",
|
|
325
|
+
"baggage",
|
|
326
|
+
"content-encoding",
|
|
327
|
+
"content-length",
|
|
328
|
+
"content-type",
|
|
329
|
+
"host",
|
|
330
|
+
"sentry-trace",
|
|
331
|
+
"user-agent",
|
|
332
|
+
"x-github-delivery",
|
|
333
|
+
"x-github-event",
|
|
334
|
+
"x-slack-request-timestamp",
|
|
335
|
+
"x-slack-retry",
|
|
336
|
+
"x-vercel-id"
|
|
337
|
+
] } },
|
|
338
|
+
urlQueryParams: false,
|
|
306
339
|
databaseQueryData: false
|
|
307
340
|
},
|
|
308
341
|
beforeSend: scrubPrivateSentryEvent,
|
|
@@ -313,4 +346,4 @@ function initSentry() {
|
|
|
313
346
|
getGlobalScope().setAttributes(deploymentSpanAttributes);
|
|
314
347
|
subscribeGatewayRequestTiming();
|
|
315
348
|
}
|
|
316
|
-
export { getBrowserSentryConfig, initSentry };
|
|
349
|
+
export { getBrowserSentryConfig, initSentry, nameRequestRoute, routeNameMiddleware };
|