Skip to content

新增本机 Agent Bridge 采集流程#22

Open
MisonL wants to merge 49 commits into
setube:mainfrom
MisonL:codex/agent-bridge-implementation
Open

新增本机 Agent Bridge 采集流程#22
MisonL wants to merge 49 commits into
setube:mainfrom
MisonL:codex/agent-bridge-implementation

Conversation

@MisonL

@MisonL MisonL commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

功能用途

这个 PR 新增的 Agent Bridge,主要是让本机 AI Agent 能在用户授权后读取当前浏览器里的真实页面体验,并生成一份可复用的页面 profile。它不是替代普通技术栈检测,而是给 Agent 提供更完整的页面上下文。

典型使用场景:

  • 快速复刻一个网页的前端风格样式:提取页面的视觉层级、布局结构、颜色、字体、组件形态和首屏截图,作为实现参考。
  • 分析一个复杂页面的技术与体验结构:同时整理技术栈、资源线索、交互路径、首屏结构和页面限制。
  • 给 Coding Agent 提供更准确的改版输入:避免只靠截图或人工描述,让 Agent 直接拿到结构化摘要和可选截图。
  • 在 Chrome 或 Firefox 的真实 profile 中验证页面:可以复用当前登录态和浏览器环境,但不会输出敏感凭据明文。

Skill 相关

这次也新增了 repo-local skill:agent-skill/stackprism-site-experience。它的作用是把 Agent Bridge 封装成 Agent 可直接使用的采集流程:启动本机 bridge、打开目标页面、等待扩展回传 profile,并把结果整理成适合 Coding Agent 阅读的页面体验摘要。

这个 skill 包含:

  • Node bridge 主实现和 Python fallback,方便不同本机环境使用。
  • capture-site.mjs 等采集脚本,支持输出 profile JSON 和可选截图文件。
  • profile schema、Agent 消费指南和 OpenAI skill metadata。
  • 私网目标、浏览器 profile、重试降级和失败边界说明。

当前验证边界:这个 repo-local skill 已在 Codex 上做过实际使用验证;Claude、Gemini 等其他 Agent 工具还没有验证效果。

做了什么

这次 PR 新增了一个默认关闭的本机 Agent Bridge 流程。用户明确开启后,本机 Agent 可以通过当前浏览器 profile 采集目标页面的技术栈、首屏结构、交互路径、资产线索和可选截图,最后生成适合 Agent 阅读的页面体验 profile。

主要改动包括:

  • 新增 Agent Bridge 的后台编排、content script 通信、profile 分块回传、状态轮询、取消和超时处理。
  • 新增页面体验分析器,把 DOM、视觉结构、组件、交互和资源信息整理成更适合 Agent 使用的摘要。
  • 新增设置页入口和隐私开关,Agent Bridge 默认关闭,需要用户显式启用。
  • 完善 Chrome 与 Firefox 的兼容路径,包括 Firefox 打包、content script 注入、数据授权提示和 XPI 检查。
  • 新增 repo-local skill:agent-skill/stackprism-site-experience,包含 Node bridge、Python fallback、采集脚本、profile schema 和使用说明。
  • 更新 README、开发文档、发布文档和验证记录,说明 Agent Bridge 的用途、安装方式、安全边界和 Firefox 支持。

安全与边界

  • Bridge 只绑定 127.0.0.1,不开放外网监听。
  • 只允许采集 http:https: 页面;私网、localhost 等目标默认阻断,必须显式允许。
  • 不输出 Cookie、Authorization、localStorage/sessionStorage 明文、签名 URL 或账号私密内容。
  • token、nonce、capture id 都绑定单次流程,失败不会伪装成成功 profile。
  • 普通页面检测和 Agent Bridge 采集路径隔离,避免被桥接页面或失败采集污染结果。

验证

已在 rebase 到最新 upstream/main 后通过以下检查:

  • git diff --check
  • python3 -m py_compile agent-skill/stackprism-site-experience/scripts/stackprism_bridge.py agent-skill/stackprism-site-experience/scripts/stackprism_bridge_lib/*.py
  • pnpm run test:unit,357 passed
  • pnpm run lint
  • pnpm run typecheck,包含生产构建

当前分支相对 upstream/main0 behind / 49 ahead,PR 状态为 mergeable。

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, we are unable to review this pull request

The GitHub API does not allow us to fetch diffs exceeding 20000 lines

MisonL added 29 commits June 12, 2026 16:22
@MisonL MisonL force-pushed the codex/agent-bridge-implementation branch from df42ade to 9c2076a Compare June 12, 2026 08:32
@MisonL MisonL changed the title Add Agent Bridge capture workflow 新增本机 Agent Bridge 采集流程 Jun 12, 2026
@MisonL

MisonL commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

补充一张当前 Agent Bridge 采集完成页截图,方便 review 直接看用户可见效果。截图来自本分支的 bridge 页面渲染,仅展示界面状态,不包含真实 token、nonce 或用户数据。

Agent Bridge 采集完成

Agent Bridge 采集完成

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant