makecindy / makecindy/cindy

Maker preview 在侧边栏打开后,cindy_browser 无法访问该预览

Open
#1,823 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.7k
Forks
401
Avg merge
21h 48m
Merged PRs (30d)
776

Description

## Problem

TapTap Maker 构建成功后,会通过 `cindy.preview({ url, sessionId })` 将预览打开在当前任务的 Cindy 右侧栏内置浏览器中。用户可以正常看到该页面,但 Agent 调用 `cindy_browser` 时,工具仍服从进程级的全局浏览器后端设置。

当浏览器自动化目标保持系统默认的 `external` 时,`cindy_browser` 连接的是独立 Chrome/CDP,而不是当前任务右侧栏里的 RSB WebView。因此 `tabs` 不会返回已经打开的 Maker preview,Agent 也无法对它执行 `snapshot` 或 `screenshot`。

这会造成明显的体验错位:页面明明由插件为当前任务打开、用户也正在 Cindy 内看到,Agent 却认为页面不存在或自己没有读取内置浏览器的能力。

## Reproduction

1. 保持「浏览器自动化目标」为系统默认的独立外置浏览器(`external`)。
2. 在 TapTap Maker 项目中执行构建,让插件通过 `cindy.preview()` 打开右侧预览。
3. 确认当前任务的右侧栏已经显示 Maker preview。
4. 在同一任务中调用 `cindy_browser` 的 `status` 和 `tabs`。

## Actual

- `status` 指向独立 Chrome/CDP backend。
- `tabs` 只枚举独立 Chrome 的标签,不包含右侧栏中可见的 Maker preview。
- Agent 无法继续对该 preview 执行页面检查或截图,只能尝试系统级窗口截图等旁路。

## Expected

插件通过 `cindy.preview()` 为某个任务打开预览后,该任务的 Agent 应能直接发现并检查这个 preview,而不需要用户先进入全局设置,把所有浏览器自动化切换到 `rsb-webview`。

具体实现可以是任务级路由、显式 backend/target 选择,或面向 preview 的专用检查能力;但不能把“当前任务明确打开的 preview”与全局默认 external backend 静默割裂。

## Acceptance criteria

- [ ] `cindy.preview()` 打开的 WebView 可被所属任务的 Agent 枚举并执行 `snapshot` / `screenshot`。
- [ ] 不要求用户为了检查一次 Maker preview,永久切换全局浏览器自动化目标。
- [ ] 不会误操作其他任务的 RSB 标签或独立 Chrome 中无关的标签。
- [ ] 两种 backend 并存时,工具状态或错误信息能明确说明当前操作目标。
- [ ] 增加覆盖 `cindy.preview()` → RSB tab 注册 → Agent 检查链路的回归测试。

## Relevant code

- `apps/desktop/src/main/cindy-brain/previewSlot.ts`
- `apps/desktop/src/renderer/lib/makerChatStore.ts`
- `apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarBrowser.ts`
- `apps/desktop/src/main/mcp-integrations/browser.ts`
- `apps/desktop/src/main/browser-backend-settings-store.ts`

## Out of scope

`screenshot` 的 MCP 返回结果目前被包装为 JSON 文本、无法稳定作为视觉输入的问题是独立缺口,另开 Issue 跟踪。

Contributor guide

Open the contributing guide

Research direction

Trace cindy.preview() from apps/desktop/src/main/cindy-brain/previewSlot.ts through makerChatStore.ts and openInSidebarBrowser.ts, then follow the browser selection flow in mcp-integrations/browser.ts and browser-backend-settings-store.ts. Add regression coverage for preview opening, RSB tab registration, and Agent inspection. Done means the owning task can enumerate and inspect only its preview without changing the global target.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
desktop, devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.