Thread externalReferences through issue-scoped markdown surfaces

Extend the Phase 6 plumbing so every `MarkdownBody` rendered inside an
issue context receives `externalObjectsState.markdownReferences`. Comments,
documents, chat, continuation handoffs, interaction details, and run
transcripts now decorate resolved external URLs with the §2 status chip.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-06-23 00:35:04 +00:00
1 parent aa9e782ea3
commit a2476bb79a
9 files changed
+249 -27

No files matched your search

@@ -1,6 +1,6 @@
import { useEffect, useMemo, useRef, useState } from "react";
import type { TranscriptEntry } from "../../adapters";
import { MarkdownBody } from "../MarkdownBody";
import { MarkdownBody, type MarkdownExternalReferenceMap } from "../MarkdownBody";
import { cn, formatTokens } from "../../lib/utils";
import {
Check,
@@ -31,6 +31,7 @@ interface RunTranscriptViewProps {
emptyMessage?: string;
className?: string;
thinkingClassName?: string;
externalReferences?: MarkdownExternalReferenceMap;
}
type TranscriptBlock =
@@ -636,9 +637,11 @@ export function normalizeTranscript(entries: TranscriptEntry[], streaming: boole
function TranscriptMessageBlock({
block,
density,
externalReferences,
}: {
block: Extract<TranscriptBlock, { type: "message" }>;
density: TranscriptDensity;
externalReferences?: MarkdownExternalReferenceMap;
}) {
const isAssistant = block.role === "assistant";
const compact = density === "compact";
@@ -656,6 +659,7 @@ function TranscriptMessageBlock({
"[&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
compact ? "text-xs leading-5 text-foreground/85" : "text-sm",
)}
externalReferences={externalReferences}
>
{block.text}
</MarkdownBody>
@@ -676,10 +680,12 @@ function TranscriptThinkingBlock({
block,
density,
className,
externalReferences,
}: {
block: Extract<TranscriptBlock, { type: "thinking" }>;
density: TranscriptDensity;
className?: string;
externalReferences?: MarkdownExternalReferenceMap;
}) {
return (
<MarkdownBody
@@ -688,6 +694,7 @@ function TranscriptThinkingBlock({
density === "compact" ? "text-[11px] leading-5" : "text-sm leading-6",
className,
)}
externalReferences={externalReferences}
>
{block.text}
</MarkdownBody>
@@ -1090,9 +1097,11 @@ function TranscriptActivityRow({
function TranscriptEventRow({
block,
density,
externalReferences,
}: {
block: Extract<TranscriptBlock, { type: "event" }>;
density: TranscriptDensity;
externalReferences?: MarkdownExternalReferenceMap;
}) {
const compact = density === "compact";
const toneClasses =
@@ -1121,6 +1130,7 @@ function TranscriptEventRow({
"[&>*:first-child]:mt-0 [&>*:last-child]:mb-0 text-sky-700 dark:text-sky-300",
compact ? "text-[11px] leading-5" : "text-xs leading-5",
)}
externalReferences={externalReferences}
>
{block.text}
</MarkdownBody>
@@ -1473,6 +1483,7 @@ export function RunTranscriptView({
emptyMessage = "No transcript yet.",
className,
thinkingClassName,
externalReferences,
}: RunTranscriptViewProps) {
const blocks = useMemo(
() => (mode === "raw" ? [] : normalizeTranscript(entries, streaming)),
@@ -1504,9 +1515,20 @@ export function RunTranscriptView({
key={`${block.type}-${block.ts}-${index}`}
className={cn(index === visibleBlocks.length - 1 && streaming && "animate-in fade-in slide-in-from-bottom-1 duration-300")}
>
{block.type === "message" && <TranscriptMessageBlock block={block} density={density} />}
{block.type === "message" && (
<TranscriptMessageBlock
block={block}
density={density}
externalReferences={externalReferences}
/>
)}
{block.type === "thinking" && (
<TranscriptThinkingBlock block={block} density={density} className={thinkingClassName} />
<TranscriptThinkingBlock
block={block}
density={density}
className={thinkingClassName}
externalReferences={externalReferences}
/>
)}
{block.type === "tool" && <TranscriptToolCard block={block} density={density} />}
{block.type === "command_group" && <TranscriptCommandGroup block={block} density={density} />}
@@ -1518,7 +1540,13 @@ export function RunTranscriptView({
<TranscriptStdoutRow block={block} density={density} collapseByDefault={collapseStdout} />
)}
{block.type === "activity" && <TranscriptActivityRow block={block} density={density} />}
{block.type === "event" && <TranscriptEventRow block={block} density={density} />}
{block.type === "event" && (
<TranscriptEventRow
block={block}
density={density}
externalReferences={externalReferences}
/>
)}
</div>
))}
</div>