@@ -23,6 +23,7 @@ import {
2323 getSuspectCommit ,
2424 isPerformanceIssueType ,
2525 isSupportedEventType ,
26+ stripReplayMetadata ,
2627} from "../../internal/formatting" ;
2728import type { AIConversationReference } from "../../internal/tool-helpers/ai-conversation-actions" ;
2829import { apiServiceFromContext } from "../../internal/tool-helpers/api" ;
@@ -172,6 +173,15 @@ function buildReplays(
172173 } ;
173174}
174175
176+ type IssueDetailsArgs = Parameters < typeof formatIssueOutput > [ 0 ] ;
177+
178+ function issueDetailsResult ( args : IssueDetailsArgs ) {
179+ if ( args . experimentalMode && isSupportedEventType ( args . event ) ) {
180+ return structuredResult ( buildIssueDetailsPayload ( args ) ) ;
181+ }
182+ return formatIssueOutput ( args ) ;
183+ }
184+
175185function buildIssueDetailsPayload ( {
176186 organizationSlug,
177187 issue,
@@ -187,22 +197,7 @@ function buildIssueDetailsPayload({
187197 experimentalMode,
188198 availableToolNames,
189199 directToolNames,
190- } : {
191- organizationSlug : string ;
192- issue : Issue ;
193- event : Event ;
194- apiService : SentryApiService ;
195- autofixState ?: AutofixRunState ;
196- performanceTrace ?: Trace ;
197- externalIssues ?: ExternalIssueList ;
198- relatedReplayIds ?: string [ ] ;
199- aiConversations ?: AIConversationReference [ ] ;
200- codeLocation ?: CodeLocation ;
201- committers ?: CommitterList ;
202- experimentalMode ?: boolean ;
203- availableToolNames ?: ReadonlySet < string > ;
204- directToolNames ?: ReadonlySet < string > ;
205- } ) : GetIssueDetailsPayload {
200+ } : IssueDetailsArgs ) : GetIssueDetailsPayload {
206201 const autofix = autofixState ?. autofix ;
207202 const summaries = autofix ? getAutofixArtifactSummaries ( autofix ) : undefined ;
208203 const isPerf = isPerformanceIssueType ( issue ) && ! ! issue . metadata ;
@@ -243,10 +238,7 @@ function buildIssueDetailsPayload({
243238 ? event . message
244239 : null ,
245240 // replays are their own field below
246- body : formatEventOutput ( event , {
247- performanceTrace,
248- stripReplayIds : true ,
249- } ) ,
241+ body : formatEventOutput ( stripReplayMetadata ( event ) , { performanceTrace } ) ,
250242 } ,
251243 seer : autofix
252244 ? {
@@ -426,28 +418,7 @@ export default defineTool({
426418 } ) ,
427419 ] ) ;
428420
429- if ( context . experimentalMode && isSupportedEventType ( event ) ) {
430- return structuredResult (
431- buildIssueDetailsPayload ( {
432- organizationSlug : orgSlug ,
433- issue,
434- event,
435- apiService,
436- autofixState,
437- performanceTrace,
438- externalIssues,
439- relatedReplayIds,
440- aiConversations,
441- codeLocation,
442- committers,
443- experimentalMode : context . experimentalMode ,
444- availableToolNames : context . availableToolNames ,
445- directToolNames : context . directToolNames ,
446- } ) ,
447- ) ;
448- }
449-
450- return formatIssueOutput ( {
421+ return issueDetailsResult ( {
451422 organizationSlug : orgSlug ,
452423 issue,
453424 event,
@@ -534,28 +505,7 @@ export default defineTool({
534505 } ) ,
535506 ] ) ;
536507
537- if ( context . experimentalMode && isSupportedEventType ( event ) ) {
538- return structuredResult (
539- buildIssueDetailsPayload ( {
540- organizationSlug : orgSlug ,
541- issue,
542- event,
543- apiService,
544- autofixState,
545- performanceTrace,
546- externalIssues,
547- relatedReplayIds,
548- aiConversations,
549- codeLocation,
550- committers,
551- experimentalMode : context . experimentalMode ,
552- availableToolNames : context . availableToolNames ,
553- directToolNames : context . directToolNames ,
554- } ) ,
555- ) ;
556- }
557-
558- return formatIssueOutput ( {
508+ return issueDetailsResult ( {
559509 organizationSlug : orgSlug ,
560510 issue,
561511 event,
0 commit comments