Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

feat(browser): send compact annotation feedback by default, with page details as an opt-in (#35990)

Kelvin Amoabac3518250c5a4
diff --git a/src/renderer/src/components/browser-pane/annotate/BrowserAnnotationSendMenuContent.test.tsx b/src/renderer/src/components/browser-pane/annotate/BrowserAnnotationSendMenuContent.test.tsx
index 63118b0073f..e2740e43f65 100644
--- a/src/renderer/src/components/browser-pane/annotate/BrowserAnnotationSendMenuContent.test.tsx
+++ b/src/renderer/src/components/browser-pane/annotate/BrowserAnnotationSendMenuContent.test.tsx
@@ -78,6 +78,8 @@ describe('BrowserAnnotationSendMenuContent', () => {
worktreeId="wt-1"
groupId="group-1"
prompt="browser annotation prompt"
+ includePageDetails={false}
+ onIncludePageDetailsChange={vi.fn()}
onPromptDelivered={onPromptDelivered}
onPromptHandedOff={onPromptHandedOff}
/>
diff --git a/src/renderer/src/components/browser-pane/annotate/BrowserAnnotationSendMenuContent.tsx b/src/renderer/src/components/browser-pane/annotate/BrowserAnnotationSendMenuContent.tsx
index e930c76c50f..94a0a082a61 100644
--- a/src/renderer/src/components/browser-pane/annotate/BrowserAnnotationSendMenuContent.tsx
+++ b/src/renderer/src/components/browser-pane/annotate/BrowserAnnotationSendMenuContent.tsx
@@ -1,31 +1,62 @@
import React from 'react'
import { ReviewNotesSendMenuContent } from '@/components/editor/ReviewNotesSendMenuContent'
+import { DropdownMenuCheckboxItem, DropdownMenuSeparator } from '@/components/ui/dropdown-menu'
+import { translate } from '@/i18n/i18n'
export type BrowserAnnotationSendMenuContentProps = {
worktreeId: string
groupId: string
prompt: string
+ includePageDetails: boolean
+ onIncludePageDetailsChange: (include: boolean) => void
onPromptDelivered?: () => void
onPromptHandedOff?: (delivered: Promise<unknown>) => void
}
+export function browserAnnotationCopyTooltip(includePageDetails: boolean): string {
+ return includePageDetails
+ ? translate(
+ 'auto.components.browser.pane.annotate.browser.page.annotation.tray.copyFeedbackWithPageDetails',
+ 'Copy feedback with page details'
+ )
+ : translate(
+ 'auto.components.browser.pane.annotate.browser.page.annotation.tray.copyFeedback',
+ 'Copy feedback'
+ )
+}
+
export function BrowserAnnotationSendMenuContent({
worktreeId,
groupId,
prompt,
+ includePageDetails,
+ onIncludePageDetailsChange,
onPromptDelivered,
onPromptHandedOff
}: BrowserAnnotationSendMenuContentProps): React.JSX.Element {
return (
- <ReviewNotesSendMenuContent
- worktreeId={worktreeId}
- groupId={groupId}
- prompt={prompt}
- // Keep annotation delivery and telemetry stable when shared menu defaults change.
- promptDelivery="submit-after-ready"
- launchSource="notes_send"
- onPromptDelivered={onPromptDelivered}
- onPromptHandedOff={onPromptHandedOff}
- />
+ <>
+ <ReviewNotesSendMenuContent
+ worktreeId={worktreeId}
+ groupId={groupId}
+ prompt={prompt}
+ // Keep annotation delivery and telemetry stable when shared menu defaults change.
+ promptDelivery="submit-after-ready"
+ launchSource="notes_send"
+ onPromptDelivered={onPromptDelivered}
+ onPromptHandedOff={onPromptHandedOff}
+ />
+ <DropdownMenuSeparator />
+ <DropdownMenuCheckboxItem
+ checked={includePageDetails}
+ onCheckedChange={onIncludePageDetailsChange}
+ onSelect={(event) => event.preventDefault()}
+ >
+ {translate(
+ 'auto.components.browser.pane.annotate.browser.page.annotation.tray.includePageDetails',
+ 'Include page details'
+ )}
+ </DropdownMenuCheckboxItem>
+ </>
)
}
diff --git a/src/renderer/src/components/browser-pane/annotate/browser-annotation-output.test.ts b/src/renderer/src/components/browser-pane/annotate/browser-annotation-output.test.ts
index e27974638dd..4930c4c54e9 100644
--- a/src/renderer/src/components/browser-pane/annotate/browser-annotation-output.test.ts
+++ b/src/renderer/src/components/browser-pane/annotate/browser-annotation-output.test.ts
@@ -78,8 +78,27 @@ function makeAnnotation(overrides?: Partial<BrowserPageAnnotation>): BrowserPage
}
describe('formatBrowserAnnotationsAsMarkdown', () => {
- it('keeps single-URL output byte-for-byte compatible', () => {
+ it('formats compact feedback by default', () => {
expect(formatBrowserAnnotationsAsMarkdown([makeAnnotation()])).toBe(
+ [
+ '## Design Feedback: /pricing',
+ '',
+ '**URL:** https://example.com/pricing',
+ '',
+ '### 1. <App> <PricingCta> button "Start free trial"',
+ '**Intent:** change',
+ '**Selector:** `main.pricing > button.primary`',
+ '**Source:** src/components/PricingCta.tsx:42:8',
+ '**Text:** "Start free trial"',
+ '**Feedback:** Make this primary action more obvious.'
+ ].join('\n')
+ )
+ })
+
+ it('adds page diagnostics when asked', () => {
+ expect(
+ formatBrowserAnnotationsAsMarkdown([makeAnnotation()], { includeDiagnostics: true })
+ ).toBe(
[
'## Design Feedback: /pricing',
'',
@@ -90,12 +109,12 @@ describe('formatBrowserAnnotationsAsMarkdown', () => {
'### 1. <App> <PricingCta> button "Start free trial"',
'**Intent:** change',
'**Selector:** `main.pricing > button.primary`',
- '**Location:** `main > .pricing > button`',
'**Source:** src/components/PricingCta.tsx:42:8',
+ '**Text:** "Start free trial"',
+ '**Location:** `main > .pricing > button`',
'**React:** <App> <PricingCta>',
'**Bounds:** x=400, y=300, 148x44',
'**Classes:** `primary`',
- '**Text:** "Start free trial"',
'**Nearby text:**',
'- Pro',
'- $29/month',
@@ -138,7 +157,9 @@ describe('formatBrowserAnnotationsAsMarkdown', () => {
third.payload.page.viewportWidth = 1440
third.payload.target.sourceFile = 'src/PricingChanged.tsx:3:1'
- const markdown = formatBrowserAnnotationsAsMarkdown([first, second, third])
+ const markdown = formatBrowserAnnotationsAsMarkdown([first, second, third], {
+ includeDiagnostics: true
+ })
expect(markdown.match(/^### \d+\./gm)).toEqual(['### 1.', '### 3.', '### 2.'])
const [pricing, account] = markdown.split('## Design Feedback: ').slice(1)
expect(pricing).toContain('/pricing')
@@ -158,7 +179,9 @@ describe('formatBrowserAnnotationsAsMarkdown', () => {
const first = makeAnnotation()
const second = makeAnnotation({ browserPageId: 'page`id\n## injected' })
second.payload.page.sanitizedUrl = 'invalid`url\n## injected'
- const markdown = formatBrowserAnnotationsAsMarkdown([first, second])
+ const markdown = formatBrowserAnnotationsAsMarkdown([first, second], {
+ includeDiagnostics: true
+ })
expect(markdown).toContain('**URL:** ``invalid`url ## injected``')
expect(markdown).toContain('**Browser tab id:** ``page`id ## injected``')
expect(markdown).not.toContain('\n## injected')
@@ -181,18 +204,21 @@ describe('formatBrowserAnnotationsAsMarkdown', () => {
it('uses longer inline code fences when selector content contains backticks', () => {
const annotation = makeAnnotation()
- const markdown = formatBrowserAnnotationsAsMarkdown([
- makeAnnotation({
- payload: {
- ...annotation.payload,
- target: {
- ...annotation.payload.target,
- selector: 'button[data-label="Save `draft`"]',
- cssClasses: 'primary `generated`'
+ const markdown = formatBrowserAnnotationsAsMarkdown(
+ [
+ makeAnnotation({
+ payload: {
+ ...annotation.payload,
+ target: {
+ ...annotation.payload.target,
+ selector: 'button[data-label="Save `draft`"]',
+ cssClasses: 'primary `generated`'
+ }
}
- }
- })
- ])
+ })
+ ],
+ { includeDiagnostics: true }
+ )
expect(markdown).toContain('**Selector:** ``button[data-label="Save `draft`"]``')
expect(markdown).toContain('**Classes:** `` primary `generated` ``')
@@ -204,41 +230,47 @@ describe('formatBrowserAnnotationsAsMarkdown', () => {
const manyBacktickRuns = Array.from({ length: 130_000 }, () => '`').join(' ')
expect(() =>
- formatBrowserAnnotationsAsMarkdown([
- makeAnnotation({
- payload: {
- ...annotation.payload,
- target: {
- ...annotation.payload.target,
- selector: `button[data-label="${manyBacktickRuns}"]`,
- htmlSnippet: `<button>${manyBacktickRuns}</button>`
+ formatBrowserAnnotationsAsMarkdown(
+ [
+ makeAnnotation({
+ payload: {
+ ...annotation.payload,
+ target: {
+ ...annotation.payload.target,
+ selector: `button[data-label="${manyBacktickRuns}"]`,
+ htmlSnippet: `<button>${manyBacktickRuns}</button>`
+ }
}
- }
- })
- ])
+ })
+ ],
+ { includeDiagnostics: true }
+ )
).not.toThrow()
expect(matchAll).not.toHaveBeenCalled()
})
it('collapses page-controlled newlines before putting text in headings and lists', () => {
const annotation = makeAnnotation()
- const markdown = formatBrowserAnnotationsAsMarkdown([
- makeAnnotation({
- comment: 'Keep this change scoped.\n## injected',
- payload: {
- ...annotation.payload,
- target: {
- ...annotation.payload.target,
- accessibility: {
- ...annotation.payload.target.accessibility,
- accessibleName: 'Start\n## injected heading'
+ const markdown = formatBrowserAnnotationsAsMarkdown(
+ [
+ makeAnnotation({
+ comment: 'Keep this change scoped.\n## injected',
+ payload: {
+ ...annotation.payload,
+ target: {
+ ...annotation.payload.target,
+ accessibility: {
+ ...annotation.payload.target.accessibility,
+ accessibleName: 'Start\n## injected heading'
+ },
+ textSnippet: 'Start\n## injected text'
},
- textSnippet: 'Start\n## injected text'
- },
- nearbyText: ['Plan\n# injected']
- }
- })
- ])
+ nearbyText: ['Plan\n# injected']
+ }
+ })
+ ],
+ { includeDiagnostics: true }
+ )
expect(markdown).toContain('### 1. <App> <PricingCta> button "Start ## injected heading"')
expect(markdown).toContain('- Plan # injected')
@@ -254,23 +286,26 @@ describe('formatBrowserAnnotationsAsMarkdown', () => {
const largeInlineText = `Summary ${repeatedInlineText}SECRET_TAIL`
const largeFeedback = `Feedback ${repeatedFeedback}SECRET_COMMENT`
- const markdown = formatBrowserAnnotationsAsMarkdown([
- makeAnnotation({
- comment: largeFeedback,
- payload: {
- ...annotation.payload,
- target: {
- ...annotation.payload.target,
- selectedText: largeInlineText,
- accessibility: {
- ...annotation.payload.target.accessibility,
- accessibleName: largeInlineText
- }
- },
- nearbyText: [largeInlineText]
- }
- })
- ])
+ const markdown = formatBrowserAnnotationsAsMarkdown(
+ [
+ makeAnnotation({
+ comment: largeFeedback,
+ payload: {
+ ...annotation.payload,
+ target: {
+ ...annotation.payload.target,
+ selectedText: largeInlineText,
+ accessibility: {
+ ...annotation.payload.target.accessibility,
+ accessibleName: largeInlineText
+ }
+ },
+ nearbyText: [largeInlineText]
+ }
+ })
+ ],
+ { includeDiagnostics: true }
+ )
expect(markdown).toContain('**Selected text:** "Summary x x')
expect(markdown).not.toContain('SECRET_TAIL')
diff --git a/src/renderer/src/components/browser-pane/annotate/browser-annotation-output.ts b/src/renderer/src/components/browser-pane/annotate/browser-annotation-output.ts
index 5c95ebc8cf8..d2c7baf7ba0 100644
--- a/src/renderer/src/components/browser-pane/annotate/browser-annotation-output.ts
+++ b/src/renderer/src/components/browser-pane/annotate/browser-annotation-output.ts
@@ -149,7 +149,11 @@ function inlineCode(content: string): string {
return `${marker}${padding}${content}${padding}${marker}`
}
-export function formatBrowserAnnotationsAsMarkdown(annotations: BrowserPageAnnotation[]): string {
+// Diagnostics (tab id, layout, styles, DOM, HTML) are for layout debugging; agents locate and edit from the rest.
+export function formatBrowserAnnotationsAsMarkdown(
+ annotations: BrowserPageAnnotation[],
+ { includeDiagnostics = false }: { includeDiagnostics?: boolean } = {}
+): string {
if (annotations.length === 0) {
return ''
}
@@ -170,8 +174,12 @@ export function formatBrowserAnnotationsAsMarkdown(annotations: BrowserPageAnnot
`## Design Feedback: ${formatPageHeading(first)}`,
'',
`**URL:** ${first.page.sanitizedUrl}`,
- `**Browser tab id:** ${firstAnnotation.browserPageId}`,
- `**Viewport:** ${first.page.viewportWidth}x${first.page.viewportHeight}`,
+ ...(includeDiagnostics
+ ? [
+ `**Browser tab id:** ${firstAnnotation.browserPageId}`,
+ `**Viewport:** ${first.page.viewportWidth}x${first.page.viewportHeight}`
+ ]
+ : []),
''
]
@@ -185,58 +193,24 @@ export function formatBrowserAnnotationsAsMarkdown(annotations: BrowserPageAnnot
entries.forEach(({ annotation, index }) => {
const { payload } = annotation
const { target } = payload
- const rect = target.rectViewport
- const styleLines = formatStyles(target.computedStyles)
lines.push(`### ${index + 1}. ${annotationElementLabel(payload)}`)
- if (mixedPages) {
+ if (mixedPages && includeDiagnostics) {
lines.push(`**Browser tab id:** ${inlineCode(inlineText(annotation.browserPageId))}`)
lines.push(`**Viewport:** ${payload.page.viewportWidth}x${payload.page.viewportHeight}`)
}
lines.push(`**Intent:** ${annotation.intent}`)
lines.push(`**Selector:** ${inlineCode(target.selector)}`)
- if (target.elementPath) {
- lines.push(`**Location:** ${inlineCode(target.elementPath)}`)
- }
if (target.sourceFile) {
lines.push(`**Source:** ${inlineText(target.sourceFile)}`)
}
- if (target.reactComponents) {
- lines.push(`**React:** ${inlineText(target.reactComponents)}`)
- }
- lines.push(
- `**Bounds:** x=${Math.round(rect.x)}, y=${Math.round(rect.y)}, ${Math.round(rect.width)}x${Math.round(rect.height)}`
- )
- if (target.cssClasses) {
- lines.push(`**Classes:** ${inlineCode(target.cssClasses)}`)
- }
if (target.selectedText) {
lines.push(`**Selected text:** "${inlineText(target.selectedText)}"`)
} else if (target.textSnippet) {
lines.push(`**Text:** "${inlineText(target.textSnippet)}"`)
}
- if (payload.nearbyText.length > 0) {
- lines.push('**Nearby text:**')
- for (const text of payload.nearbyText) {
- lines.push(`- ${inlineText(text)}`)
- }
- }
- if (target.nearbyElements?.length) {
- lines.push('**Nearby elements:**')
- for (const element of target.nearbyElements) {
- lines.push(`- ${inlineText(element)}`)
- }
- }
- if (styleLines.length > 0) {
- lines.push('**Computed styles:**')
- lines.push(...styleLines)
- }
- if (target.fullPath) {
- lines.push(`**Full DOM path:** ${inlineCode(target.fullPath)}`)
- }
- if (target.htmlSnippet) {
- lines.push('**HTML:**')
- lines.push(...fence('html', target.htmlSnippet))
+ if (includeDiagnostics) {
+ lines.push(...formatDiagnostics(payload))
}
lines.push(`**Feedback:** ${inlineText(annotation.comment)}`)
if (annotation.imagePaths?.length) {
@@ -251,3 +225,46 @@ export function formatBrowserAnnotationsAsMarkdown(annotations: BrowserPageAnnot
return lines.join('\n').trimEnd()
}
+
+function formatDiagnostics(payload: BrowserGrabPayload): string[] {
+ const { target } = payload
+ const rect = target.rectViewport
+ const lines: string[] = []
+ if (target.elementPath) {
+ lines.push(`**Location:** ${inlineCode(target.elementPath)}`)
+ }
+ if (target.reactComponents) {
+ lines.push(`**React:** ${inlineText(target.reactComponents)}`)
+ }
+ lines.push(
+ `**Bounds:** x=${Math.round(rect.x)}, y=${Math.round(rect.y)}, ${Math.round(rect.width)}x${Math.round(rect.height)}`
+ )
+ if (target.cssClasses) {
+ lines.push(`**Classes:** ${inlineCode(target.cssClasses)}`)
+ }
+ if (payload.nearbyText.length > 0) {
+ lines.push('**Nearby text:**')
+ for (const text of payload.nearbyText) {
+ lines.push(`- ${inlineText(text)}`)
+ }
+ }
+ if (target.nearbyElements?.length) {
+ lines.push('**Nearby elements:**')
+ for (const element of target.nearbyElements) {
+ lines.push(`- ${inlineText(element)}`)
+ }
+ }
+ const styleLines = formatStyles(target.computedStyles)
+ if (styleLines.length > 0) {
+ lines.push('**Computed styles:**')
+ lines.push(...styleLines)
+ }
+ if (target.fullPath) {
+ lines.push(`**Full DOM path:** ${inlineCode(target.fullPath)}`)
+ }
+ if (target.htmlSnippet) {
+ lines.push('**HTML:**')
+ lines.push(...fence('html', target.htmlSnippet))
+ }
+ return lines
+}
diff --git a/src/renderer/src/components/browser-pane/annotate/browser-guest-annotate-overlays.tsx b/src/renderer/src/components/browser-pane/annotate/browser-guest-annotate-overlays.tsx
index 75f3312a45a..cd8f5e57772 100644
--- a/src/renderer/src/components/browser-pane/annotate/browser-guest-annotate-overlays.tsx
+++ b/src/renderer/src/components/browser-pane/annotate/browser-guest-annotate-overlays.tsx
@@ -69,6 +69,8 @@ export function BrowserGuestAnnotateOverlays({
handleAnnotationTraySendOpenChange,
activeGroupId,
browserAnnotationsPrompt,
+ includePageDetails,
+ handleIncludePageDetailsChange,
handleBrowserAnnotationsSentToAgent,
handleBrowserAnnotationsHandedOff,
handleCopyBrowserAnnotations,
@@ -119,6 +121,8 @@ export function BrowserGuestAnnotateOverlays({
worktreeId={worktreeId}
activeGroupId={activeGroupId}
browserAnnotationsPrompt={browserAnnotationsPrompt}
+ includePageDetails={includePageDetails}
+ handleIncludePageDetailsChange={handleIncludePageDetailsChange}
handleBrowserAnnotationsSentToAgent={handleBrowserAnnotationsSentToAgent}
handleBrowserAnnotationsHandedOff={handleBrowserAnnotationsHandedOff}
handleCopyBrowserAnnotations={handleCopyBrowserAnnotations}
diff --git a/src/renderer/src/components/browser-pane/annotate/browser-page-annotation-tray.test.tsx b/src/renderer/src/components/browser-pane/annotate/browser-page-annotation-tray.test.tsx
index 27a09fa576a..153eed871fc 100644
--- a/src/renderer/src/components/browser-pane/annotate/browser-page-annotation-tray.test.tsx
+++ b/src/renderer/src/components/browser-pane/annotate/browser-page-annotation-tray.test.tsx
@@ -86,6 +86,8 @@ function renderTray(currentUrl?: string): {
worktreeId="wt-1"
activeGroupId={undefined}
browserAnnotationsPrompt="prompt"
+ includePageDetails={false}
+ handleIncludePageDetailsChange={vi.fn()}
handleBrowserAnnotationsSentToAgent={vi.fn()}
handleBrowserAnnotationsHandedOff={vi.fn()}
handleCopyBrowserAnnotations={vi.fn()}
diff --git a/src/renderer/src/components/browser-pane/annotate/browser-page-annotation-tray.tsx b/src/renderer/src/components/browser-pane/annotate/browser-page-annotation-tray.tsx
index 4cbceb70a37..1db962ae9d6 100644
--- a/src/renderer/src/components/browser-pane/annotate/browser-page-annotation-tray.tsx
+++ b/src/renderer/src/components/browser-pane/annotate/browser-page-annotation-tray.tsx
@@ -27,11 +27,15 @@ import {
type BrowserPageAnnotation
} from '../../../../../shared/browser-grab-types'
import { BROWSER_ANNOTATION_INTENT_OPTIONS } from '../describe-page/browser-annotation-geometry'
-import { BrowserAnnotationSendMenuContent } from './BrowserAnnotationSendMenuContent'
+import {
+ BrowserAnnotationSendMenuContent,
+ browserAnnotationCopyTooltip
+} from './BrowserAnnotationSendMenuContent'
import { preventAgentSendTargetOutsideDismiss } from './prevent-agent-send-target-outside-dismiss'
import { browserAnnotationMatchesPageUrl } from './browser-annotation-page-url'
import { useBrowserAnnotationImages } from './use-browser-annotation-images'
import { BrowserAnnotationImageStrip } from './browser-annotation-image-strip'
+import type { BrowserPageAnnotationTrayProps } from '../describe-page/browser-page-types'
export function BrowserPageAnnotationTray({
browserAnnotations,
@@ -41,6 +45,8 @@ export function BrowserPageAnnotationTray({
worktreeId,
activeGroupId,
browserAnnotationsPrompt,
+ includePageDetails,
+ handleIncludePageDetailsChange,
handleBrowserAnnotationsSentToAgent,
handleBrowserAnnotationsHandedOff,
handleCopyBrowserAnnotations,
@@ -48,27 +54,7 @@ export function BrowserPageAnnotationTray({
handleClearBrowserAnnotations,
handleDeleteBrowserAnnotation,
handleUpdateBrowserAnnotation
-}: {
- browserAnnotations: BrowserPageAnnotation[]
- currentUrl?: string
- annotationTraySendOpen: boolean
- handleAnnotationTraySendOpenChange: (open: boolean) => void
- worktreeId: string
- activeGroupId: string | undefined
- browserAnnotationsPrompt: string
- handleBrowserAnnotationsSentToAgent: () => void
- handleBrowserAnnotationsHandedOff: (delivered: Promise<unknown>) => void
- handleCopyBrowserAnnotations: () => void
- browserAnnotationsCopied: boolean
- handleClearBrowserAnnotations: () => void
- handleDeleteBrowserAnnotation: (annotationId: string) => void
- handleUpdateBrowserAnnotation: (
- annotationId: string,
- comment: string,
- intent: BrowserAnnotationIntent,
- imagePaths: string[]
- ) => void
-}): React.JSX.Element {
+}: BrowserPageAnnotationTrayProps): React.JSX.Element {
const [editingAnnotationId, setEditingAnnotationId] = useState<string | null>(null)
const [editComment, setEditComment] = useState('')
const [editIntent, setEditIntent] = useState<BrowserAnnotationIntent>('change')
@@ -188,26 +174,35 @@ export function BrowserPageAnnotationTray({
worktreeId={worktreeId}
groupId={activeGroupId ?? worktreeId}
prompt={browserAnnotationsPrompt}
+ includePageDetails={includePageDetails}
+ onIncludePageDetailsChange={handleIncludePageDetailsChange}
onPromptDelivered={handleBrowserAnnotationsSentToAgent}
onPromptHandedOff={handleBrowserAnnotationsHandedOff}
/>
</DropdownMenuContent>
</DropdownMenu>
- <Button
- size="xs"
- variant="outline"
- className="gap-1.5"
- onClick={handleCopyBrowserAnnotations}
- >
- {browserAnnotationsCopied ? (
- <CircleCheck className="size-3" />
- ) : (
- <Copy className="size-3" />
- )}
- {browserAnnotationsCopied
- ? translate('auto.components.browser.pane.BrowserPane.6f4ab3592b', 'Copied')
- : translate('auto.components.browser.pane.BrowserPane.d51ef37351', 'Copy')}
- </Button>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ size="xs"
+ variant="outline"
+ className="gap-1.5"
+ onClick={handleCopyBrowserAnnotations}
+ >
+ {browserAnnotationsCopied ? (
+ <CircleCheck className="size-3" />
+ ) : (
+ <Copy className="size-3" />
+ )}
+ {browserAnnotationsCopied
+ ? translate('auto.components.browser.pane.BrowserPane.6f4ab3592b', 'Copied')
+ : translate('auto.components.browser.pane.BrowserPane.d51ef37351', 'Copy')}
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent side="bottom" sideOffset={6}>
+ {browserAnnotationCopyTooltip(includePageDetails)}
+ </TooltipContent>
+ </Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/src/renderer/src/components/browser-pane/annotate/use-browser-page-annotation-send.test.tsx b/src/renderer/src/components/browser-pane/annotate/use-browser-page-annotation-send.test.tsx
index 8eb9934c5a8..405276d1d9d 100644
--- a/src/renderer/src/components/browser-pane/annotate/use-browser-page-annotation-send.test.tsx
+++ b/src/renderer/src/components/browser-pane/annotate/use-browser-page-annotation-send.test.tsx
@@ -23,6 +23,7 @@ vi.mock('@/store', () => ({
}))
vi.mock('@/i18n/i18n', () => ({ translate: (_key: string, fallback: string) => fallback }))
vi.mock('./BrowserAnnotationSendMenuContent', () => ({
+ browserAnnotationCopyTooltip: () => 'Copy feedback',
BrowserAnnotationSendMenuContent: ({ onPromptDelivered }: { onPromptDelivered?: () => void }) => (
<button onClick={onPromptDelivered}>Complete delivery</button>
)
@@ -196,6 +197,37 @@ describe('website annotation delivery', () => {
expect(notes()).toHaveLength(1)
})
+ it('switches Send, the open sidebar picker and Copy to page details together', () => {
+ const writeClipboardText = vi.fn().mockResolvedValue(undefined)
+ Object.defineProperty(window, 'api', {
+ configurable: true,
+ value: { ui: { writeClipboardText } }
+ })
+ store.setState({
+ openAgentSendPopoverTargetMode: (next) => {
+ mode = next
+ store.setState({
+ agentSendPopoverTargetMode: {
+ ...next,
+ instanceId: 'instance-1',
+ eligiblePaneKeys: [],
+ disabledPaneKeys: {},
+ status: 'open'
+ }
+ })
+ }
+ })
+ const view = mount()
+ act(() => view.result.current.handleAnnotationTraySendOpenChange(true))
+ expect(mode?.prompt).not.toContain('**Computed styles:**')
+
+ act(() => view.result.current.handleIncludePageDetailsChange(true))
+ expect(mode?.prompt).toContain('**Computed styles:**')
+ expect(view.result.current.browserAnnotationsPrompt).toBe(mode?.prompt)
+ act(() => view.result.current.handleCopyBrowserAnnotations())
+ expect(writeClipboardText).toHaveBeenCalledWith(expect.stringContaining('**Computed styles:**'))
+ })
+
it('does not erase replacement notes after a navigation clears the original page', () => {
const view = mount()
const delivered = view.result.current.handleBrowserAnnotationsSentToAgent
diff --git a/src/renderer/src/components/browser-pane/annotate/use-browser-page-annotation-send.ts b/src/renderer/src/components/browser-pane/annotate/use-browser-page-annotation-send.ts
index 19f7c92e181..4a787717b23 100644
--- a/src/renderer/src/components/browser-pane/annotate/use-browser-page-annotation-send.ts
+++ b/src/renderer/src/components/browser-pane/annotate/use-browser-page-annotation-send.ts
@@ -22,6 +22,8 @@ export function useBrowserPageAnnotationSend({
}): {
browserAnnotations: BrowserPageAnnotation[]
browserAnnotationsPrompt: string
+ includePageDetails: boolean
+ handleIncludePageDetailsChange: (include: boolean) => void
browserAnnotationsCopied: boolean
annotationBannerSendOpen: boolean
annotationTraySendOpen: boolean
@@ -47,9 +49,13 @@ export function useBrowserPageAnnotationSend({
const browserAnnotationsRef = useRef(browserAnnotations)
const [browserAnnotationsCopied, setBrowserAnnotationsCopied] = useState(false)
const annotationCopyTimerRef = useRef<ReturnType<typeof setTimeout>>(undefined)
+ const [includePageDetails, setIncludePageDetails] = useState(false)
const copyPrompt = useMemo(
- () => formatBrowserAnnotationsAsMarkdown(browserAnnotations),
- [browserAnnotations]
+ () =>
+ formatBrowserAnnotationsAsMarkdown(browserAnnotations, {
+ includeDiagnostics: includePageDetails
+ }),
+ [browserAnnotations, includePageDetails]
)
// Annotations another send holds are left out of the next one.
const inFlightVersion = useNotesInFlightVersion()
@@ -58,8 +64,11 @@ export function useBrowserPageAnnotationSend({
return browserAnnotations.filter((annotation) => !isNoteInFlight(annotation))
}, [browserAnnotations, inFlightVersion])
const browserAnnotationsPrompt = useMemo(
- () => formatBrowserAnnotationsAsMarkdown(sendableAnnotations),
- [sendableAnnotations]
+ () =>
+ formatBrowserAnnotationsAsMarkdown(sendableAnnotations, {
+ includeDiagnostics: includePageDetails
+ }),
+ [sendableAnnotations, includePageDetails]
)
const openAgentSendPopoverTargetMode = useAppStore((s) => s.openAgentSendPopoverTargetMode)
const closeAgentSendPopoverTargetMode = useAppStore((s) => s.closeAgentSendPopoverTargetMode)
@@ -123,6 +132,30 @@ export function useBrowserPageAnnotationSend({
clearBrowserPageAnnotations(browserTabId)
}, [browserTabId, clearBrowserPageAnnotations, recordFeatureInteraction])
+ const openAnnotationSendTargetMode = useCallback(
+ (modeId: string, prompt: string): void => {
+ openAgentSendPopoverTargetMode({
+ id: modeId,
+ worktreeId,
+ source: 'browser-annotations',
+ prompt,
+ label: translate(
+ 'auto.components.browser.pane.BrowserPane.27d863542c',
+ 'Browser annotations'
+ ),
+ launchSource: 'notes_send',
+ onPromptDelivered: handleBrowserAnnotationsSentToAgent,
+ onPromptHandedOff: handleBrowserAnnotationsHandedOff
+ })
+ },
+ [
+ handleBrowserAnnotationsSentToAgent,
+ handleBrowserAnnotationsHandedOff,
+ openAgentSendPopoverTargetMode,
+ worktreeId
+ ]
+ )
+
const handleAnnotationSendOpenChange = useCallback(
(modeId: string, open: boolean): void => {
if (open) {
@@ -130,30 +163,33 @@ export function useBrowserPageAnnotationSend({
if (!browserAnnotationsPrompt) {
return
}
- openAgentSendPopoverTargetMode({
- id: modeId,
- worktreeId,
- source: 'browser-annotations',
- prompt: browserAnnotationsPrompt,
- label: translate(
- 'auto.components.browser.pane.BrowserPane.27d863542c',
- 'Browser annotations'
- ),
- launchSource: 'notes_send',
- onPromptDelivered: handleBrowserAnnotationsSentToAgent,
- onPromptHandedOff: handleBrowserAnnotationsHandedOff
- })
+ openAnnotationSendTargetMode(modeId, browserAnnotationsPrompt)
} else {
closeAgentSendPopoverTargetMode(modeId)
}
},
+ [browserAnnotationsPrompt, closeAgentSendPopoverTargetMode, openAnnotationSendTargetMode]
+ )
+
+ const handleIncludePageDetailsChange = useCallback(
+ (include: boolean): void => {
+ setIncludePageDetails(include)
+ const openModeId =
+ annotationBannerSendOpen || annotationTraySendOpen ? activeAgentSendTargetModeId : null
+ // The sidebar agent picker holds the prompt it was opened with.
+ if (openModeId && sendableAnnotations.length > 0) {
+ openAnnotationSendTargetMode(
+ openModeId,
+ formatBrowserAnnotationsAsMarkdown(sendableAnnotations, { includeDiagnostics: include })
+ )
+ }
+ },
[
- browserAnnotationsPrompt,
- handleBrowserAnnotationsSentToAgent,
- handleBrowserAnnotationsHandedOff,
- closeAgentSendPopoverTargetMode,
- openAgentSendPopoverTargetMode,
- worktreeId
+ activeAgentSendTargetModeId,
+ annotationBannerSendOpen,
+ annotationTraySendOpen,
+ openAnnotationSendTargetMode,
+ sendableAnnotations
]
)
@@ -203,6 +239,8 @@ export function useBrowserPageAnnotationSend({
return {
browserAnnotations,
browserAnnotationsPrompt,
+ includePageDetails,
+ handleIncludePageDetailsChange,
browserAnnotationsCopied,
annotationBannerSendOpen,
annotationTraySendOpen,
diff --git a/src/renderer/src/components/browser-pane/assemble-chrome/browser-page-chrome-banners.tsx b/src/renderer/src/components/browser-pane/assemble-chrome/browser-page-chrome-banners.tsx
index 94428245bf2..99dea2db315 100644
--- a/src/renderer/src/components/browser-pane/assemble-chrome/browser-page-chrome-banners.tsx
+++ b/src/renderer/src/components/browser-pane/assemble-chrome/browser-page-chrome-banners.tsx
@@ -9,7 +9,10 @@ import {
} from '@/components/ui/dropdown-menu'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { translate } from '@/i18n/i18n'
-import { BrowserAnnotationSendMenuContent } from '../annotate/BrowserAnnotationSendMenuContent'
+import {
+ BrowserAnnotationSendMenuContent,
+ browserAnnotationCopyTooltip
+} from '../annotate/BrowserAnnotationSendMenuContent'
import { browserAnnotationLimitMessage } from '../annotate/browser-annotation-limit-message'
import {
isBrowserAnnotationPageFull,
@@ -31,6 +34,8 @@ export function BrowserPageChromeBanners({
worktreeId,
activeGroupId,
browserAnnotationsPrompt,
+ includePageDetails,
+ handleIncludePageDetailsChange,
handleBrowserAnnotationsSentToAgent,
handleBrowserAnnotationsHandedOff,
handleCopyBrowserAnnotations,
@@ -49,6 +54,8 @@ export function BrowserPageChromeBanners({
worktreeId: string
activeGroupId: string | undefined
browserAnnotationsPrompt: string
+ includePageDetails: boolean
+ handleIncludePageDetailsChange: (include: boolean) => void
handleBrowserAnnotationsSentToAgent: () => void
handleBrowserAnnotationsHandedOff: (delivered: Promise<unknown>) => void
handleCopyBrowserAnnotations: () => void
@@ -167,26 +174,38 @@ export function BrowserPageChromeBanners({
worktreeId={worktreeId}
groupId={activeGroupId ?? worktreeId}
prompt={browserAnnotationsPrompt}
+ includePageDetails={includePageDetails}
+ onIncludePageDetailsChange={handleIncludePageDetailsChange}
onPromptDelivered={handleBrowserAnnotationsSentToAgent}
onPromptHandedOff={handleBrowserAnnotationsHandedOff}
/>
</DropdownMenuContent>
</DropdownMenu>
- <Button
- size="xs"
- variant="outline"
- className="h-6 gap-1.5"
- onClick={handleCopyBrowserAnnotations}
- >
- {browserAnnotationsCopied ? (
- <CircleCheck className="size-3" />
- ) : (
- <Copy className="size-3" />
- )}
- {browserAnnotationsCopied
- ? translate('auto.components.browser.pane.BrowserPane.6f4ab3592b', 'Copied')
- : translate('auto.components.browser.pane.BrowserPane.499b31b84e', 'Copy All')}
- </Button>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ size="xs"
+ variant="outline"
+ className="h-6 gap-1.5"
+ onClick={handleCopyBrowserAnnotations}
+ >
+ {browserAnnotationsCopied ? (
+ <CircleCheck className="size-3" />
+ ) : (
+ <Copy className="size-3" />
+ )}
+ {browserAnnotationsCopied
+ ? translate('auto.components.browser.pane.BrowserPane.6f4ab3592b', 'Copied')
+ : translate(
+ 'auto.components.browser.pane.BrowserPane.499b31b84e',
+ 'Copy All'
+ )}
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent side="bottom" sideOffset={6}>
+ {browserAnnotationCopyTooltip(includePageDetails)}
+ </TooltipContent>
+ </Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/src/renderer/src/components/browser-pane/assemble-chrome/browser-page-chrome-header.tsx b/src/renderer/src/components/browser-pane/assemble-chrome/browser-page-chrome-header.tsx
index 258d2ac9adb..af83e18708e 100644
--- a/src/renderer/src/components/browser-pane/assemble-chrome/browser-page-chrome-header.tsx
+++ b/src/renderer/src/components/browser-pane/assemble-chrome/browser-page-chrome-header.tsx
@@ -121,6 +121,8 @@ export function BrowserPageChromeHeader({
worktreeId={worktreeId}
activeGroupId={annotationSend.activeGroupId}
browserAnnotationsPrompt={annotationSend.browserAnnotationsPrompt}
+ includePageDetails={annotationSend.includePageDetails}
+ handleIncludePageDetailsChange={annotationSend.handleIncludePageDetailsChange}
handleBrowserAnnotationsSentToAgent={annotationSend.handleBrowserAnnotationsSentToAgent}
handleBrowserAnnotationsHandedOff={annotationSend.handleBrowserAnnotationsHandedOff}
handleCopyBrowserAnnotations={annotationSend.handleCopyBrowserAnnotations}
diff --git a/src/renderer/src/components/browser-pane/describe-page/browser-page-types.ts b/src/renderer/src/components/browser-pane/describe-page/browser-page-types.ts
index 8bb7d4f8df3..dcb181d98de 100644
--- a/src/renderer/src/components/browser-pane/describe-page/browser-page-types.ts
+++ b/src/renderer/src/components/browser-pane/describe-page/browser-page-types.ts
@@ -3,6 +3,7 @@ import type { Dispatch, MutableRefObject, SetStateAction } from 'react'
import type {
BrowserAnnotationIntent,
BrowserGrabPayload,
+ BrowserPageAnnotation,
GrabIntent
} from '../../../../../shared/browser-grab-types'
import type { BrowserContextMenuRequestedEvent } from '../../../../../shared/browser-guest-events'
@@ -101,6 +102,30 @@ export type BrowserPageFailLoadEvent = {
isMainFrame?: boolean
}
+export type BrowserPageAnnotationTrayProps = {
+ browserAnnotations: BrowserPageAnnotation[]
+ currentUrl?: string
+ annotationTraySendOpen: boolean
+ handleAnnotationTraySendOpenChange: (open: boolean) => void
+ worktreeId: string
+ activeGroupId: string | undefined
+ browserAnnotationsPrompt: string
+ includePageDetails: boolean
+ handleIncludePageDetailsChange: (include: boolean) => void
+ handleBrowserAnnotationsSentToAgent: () => void
+ handleBrowserAnnotationsHandedOff: (delivered: Promise<unknown>) => void
+ handleCopyBrowserAnnotations: () => void
+ browserAnnotationsCopied: boolean
+ handleClearBrowserAnnotations: () => void
+ handleDeleteBrowserAnnotation: (annotationId: string) => void
+ handleUpdateBrowserAnnotation: (
+ annotationId: string,
+ comment: string,
+ intent: BrowserAnnotationIntent,
+ imagePaths: string[]
+ ) => void
+}
+
export type ClientHostedBrowserPagePaneProps = {
browserTab: BrowserPageState
workspaceId: string
diff --git a/src/renderer/src/i18n/locales/de.json b/src/renderer/src/i18n/locales/de.json
index 7eb6b83819b..ae00296437a 100644
--- a/src/renderer/src/i18n/locales/de.json
+++ b/src/renderer/src/i18n/locales/de.json
@@ -16971,7 +16971,10 @@
"024467ceac": "Abbrechen",
"449d2c2629": "Zweck der Anmerkung",
"38d320108c": "Anmerkungen einklappen",
- "9f209891a7": "Anmerkungen ausklappen"
+ "9f209891a7": "Anmerkungen ausklappen",
+ "includePageDetails": "Seitendetails einbeziehen",
+ "copyFeedback": "Feedback kopieren",
+ "copyFeedbackWithPageDetails": "Feedback mit Seitendetails kopieren"
}
}
}
diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json
index 2411c32fc86..d0032297851 100644
--- a/src/renderer/src/i18n/locales/en.json
+++ b/src/renderer/src/i18n/locales/en.json
@@ -17403,7 +17403,10 @@
"024467ceac": "Cancel",
"449d2c2629": "Annotation intent",
"38d320108c": "Collapse annotations",
- "9f209891a7": "Expand annotations"
+ "9f209891a7": "Expand annotations",
+ "includePageDetails": "Include page details",
+ "copyFeedback": "Copy feedback",
+ "copyFeedbackWithPageDetails": "Copy feedback with page details"
}
}
}
diff --git a/src/renderer/src/i18n/locales/es.json b/src/renderer/src/i18n/locales/es.json
index 160e7f491ec..044ce12bafd 100644
--- a/src/renderer/src/i18n/locales/es.json
+++ b/src/renderer/src/i18n/locales/es.json
@@ -16992,7 +16992,10 @@
"09a7c1df70": "Editar anotación {{value0}}",
"449d2c2629": "Intención de la anotación",
"38d320108c": "Contraer anotaciones",
- "9f209891a7": "Expandir anotaciones"
+ "9f209891a7": "Expandir anotaciones",
+ "includePageDetails": "Incluir detalles de la página",
+ "copyFeedback": "Copiar comentarios",
+ "copyFeedbackWithPageDetails": "Copiar comentarios con detalles de la página"
}
}
}
diff --git a/src/renderer/src/i18n/locales/fr.json b/src/renderer/src/i18n/locales/fr.json
index 3112b2218c2..10d39e1fe85 100644
--- a/src/renderer/src/i18n/locales/fr.json
+++ b/src/renderer/src/i18n/locales/fr.json
@@ -17216,7 +17216,10 @@
"024467ceac": "Annuler",
"449d2c2629": "Intention d'annotation",
"38d320108c": "Réduire les annotations",
- "9f209891a7": "Développer les annotations"
+ "9f209891a7": "Développer les annotations",
+ "includePageDetails": "Inclure les détails de la page",
+ "copyFeedback": "Copier les commentaires",
+ "copyFeedbackWithPageDetails": "Copier les commentaires avec les détails de la page"
}
}
}
diff --git a/src/renderer/src/i18n/locales/ja.json b/src/renderer/src/i18n/locales/ja.json
index 7745235810c..d21eeb60bc6 100644
--- a/src/renderer/src/i18n/locales/ja.json
+++ b/src/renderer/src/i18n/locales/ja.json
@@ -16588,7 +16588,10 @@
"024467ceac": "キャンセル",
"449d2c2629": "注釈の意図",
"38d320108c": "注釈を折りたたむ",
- "9f209891a7": "注釈を展開"
+ "9f209891a7": "注釈を展開",
+ "includePageDetails": "ページの詳細を含める",
+ "copyFeedback": "フィードバックをコピー",
+ "copyFeedbackWithPageDetails": "ページの詳細付きでフィードバックをコピー"
}
}
}
diff --git a/src/renderer/src/i18n/locales/ko.json b/src/renderer/src/i18n/locales/ko.json
index 617c4670c70..b7ae8a6ad67 100644
--- a/src/renderer/src/i18n/locales/ko.json
+++ b/src/renderer/src/i18n/locales/ko.json
@@ -16588,7 +16588,10 @@
"024467ceac": "취소",
"449d2c2629": "주석 의도",
"38d320108c": "주석 접기",
- "9f209891a7": "주석 펼치기"
+ "9f209891a7": "주석 펼치기",
+ "includePageDetails": "페이지 세부 정보 포함",
+ "copyFeedback": "피드백 복사",
+ "copyFeedbackWithPageDetails": "페이지 세부 정보와 함께 피드백 복사"
}
}
}
diff --git a/src/renderer/src/i18n/locales/pt.json b/src/renderer/src/i18n/locales/pt.json
index 8d352692be9..886c1527b62 100644
--- a/src/renderer/src/i18n/locales/pt.json
+++ b/src/renderer/src/i18n/locales/pt.json
@@ -17034,7 +17034,10 @@
"024467ceac": "Cancelar",
"449d2c2629": "Intenção da anotação",
"38d320108c": "Recolher anotações",
- "9f209891a7": "Expandir anotações"
+ "9f209891a7": "Expandir anotações",
+ "includePageDetails": "Incluir detalhes da página",
+ "copyFeedback": "Copiar feedback",
+ "copyFeedbackWithPageDetails": "Copiar feedback com detalhes da página"
}
}
}
diff --git a/src/renderer/src/i18n/locales/ru.json b/src/renderer/src/i18n/locales/ru.json
index eb7091990d0..dabab978bf6 100644
--- a/src/renderer/src/i18n/locales/ru.json
+++ b/src/renderer/src/i18n/locales/ru.json
@@ -17473,7 +17473,10 @@
"024467ceac": "Отмена",
"449d2c2629": "Цель заметки",
"38d320108c": "Свернуть заметки",
- "9f209891a7": "Развернуть заметки"
+ "9f209891a7": "Развернуть заметки",
+ "includePageDetails": "Включить сведения о странице",
+ "copyFeedback": "Копировать отзыв",
+ "copyFeedbackWithPageDetails": "Копировать отзыв со сведениями о странице"
}
}
}
diff --git a/src/renderer/src/i18n/locales/tr.json b/src/renderer/src/i18n/locales/tr.json
index b59cc07b896..20966776a1c 100644
--- a/src/renderer/src/i18n/locales/tr.json
+++ b/src/renderer/src/i18n/locales/tr.json
@@ -16957,7 +16957,10 @@
"024467ceac": "İptal",
"449d2c2629": "Ek açıklama amacı",
"38d320108c": "Ek açıklamaları daralt",
- "9f209891a7": "Ek açıklamaları genişlet"
+ "9f209891a7": "Ek açıklamaları genişlet",
+ "includePageDetails": "Sayfa ayrıntılarını ekle",
+ "copyFeedback": "Geri bildirimi kopyala",
+ "copyFeedbackWithPageDetails": "Geri bildirimi sayfa ayrıntılarıyla kopyala"
}
}
}
diff --git a/src/renderer/src/i18n/locales/zh-Hant.json b/src/renderer/src/i18n/locales/zh-Hant.json
index c0f270bc85e..f24834ea31f 100644
--- a/src/renderer/src/i18n/locales/zh-Hant.json
+++ b/src/renderer/src/i18n/locales/zh-Hant.json
@@ -16743,7 +16743,10 @@
"024467ceac": "取消",
"449d2c2629": "註解意圖",
"38d320108c": "摺疊註解",
- "9f209891a7": "展開註解"
+ "9f209891a7": "展開註解",
+ "includePageDetails": "包含頁面詳細資料",
+ "copyFeedback": "複製回饋",
+ "copyFeedbackWithPageDetails": "複製回饋及頁面詳細資料"
}
}
}
diff --git a/src/renderer/src/i18n/locales/zh.json b/src/renderer/src/i18n/locales/zh.json
index 9291f35e6a3..cdde3c228be 100644
--- a/src/renderer/src/i18n/locales/zh.json
+++ b/src/renderer/src/i18n/locales/zh.json
@@ -16588,7 +16588,10 @@
"024467ceac": "取消",
"449d2c2629": "注释意图",
"38d320108c": "折叠注释",
- "9f209891a7": "展开注释"
+ "9f209891a7": "展开注释",
+ "includePageDetails": "包含页面详情",
+ "copyFeedback": "复制反馈",
+ "copyFeedbackWithPageDetails": "复制反馈及页面详情"
}
}
}