Files
cindy/packages/browser-control-runtime/README.md
Lizi bb3f71d084 chore: Cindy 首次开源提交 / initial open-source release
Cindy 是心动网络 (X.D. Network Inc.) 的跨端 AI Agent 客户端。
本次提交包含 Desktop(Electron)、Mobile(Expo)及全部共享 packages
的完整源码,以 Apache-2.0 协议开源。

This is the first public release of Cindy, X.D. Network's cross-platform
AI agent client: the Electron desktop app, the Expo mobile app, and all
shared workspace packages, licensed under Apache-2.0.

- 许可与合规:根 LICENSE(Apache-2.0)+ NOTICE;第三方组件归属声明与
  SPDX SBOM 收口在 docs/legal/notices/,由 pnpm licenses:generate 生成。
- 社区文件:README / CONTRIBUTING / CODE_OF_CONDUCT / SECURITY / SUPPORT
  中英双语;issue / PR 模板与 CI workflow 在 .github/。
- 协议层以公开 submodule 引入:github.com/makecindy/cindy-protocol。
- 提交前已通过仓库门禁:全量 pnpm test:unit 与涉及 package 的 typecheck。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-24 08:30:44 +08:00

2.7 KiB

@cindy/browser-control-runtime

Neutral, in-process browser-automation runtime for Cindy. Exposes a small, stable contract (BrowserControlRuntime) that the cindy_browser MCP and the desktop host drive — without depending on any upstream product API or surfacing an upstream product name in product code.

Layout

src/
  types.ts            Public contract: BrowserControlRuntime / Request / Result
  runtime.ts          createBrowserControlRuntime() — drives the vendored
                      in-process route dispatcher behind the contract
  unavailable.ts      A safe "not configured" runtime
  shim/               Hand-written replacements for the upstream plugin-sdk
                      surface the vendored core imports (see shim-spec)
    _local/           Faithful ports of small self-contained upstream helpers
                      (errors, ports, redact, tmp-dir, browser-cdp, text-utils)
  _generated/         GENERATED — DO NOT EDIT. Produced by sync.mjs:
    extension/        vendored browser core (extensions/browser/src/**)
    leaf/             vendored SSRF / security leaf closure (src/infra, src/security)
    packages/         vendored net-policy + normalization-core
    vendor/fs-safe/   vendored @openclaw/fs-safe dist (zero-dep, version-pinned)
  __tests__/          runtime + SSRF contract tests
upstream/
  MAINTAINING.md              维护者必读:三层架构 + 踩坑清单 + 上游同步 + 中性约束
  browser-runtime.lock.json   pinned commit + fs-safe version + content hash
  vendor-manifest.txt         the 133 core files
  shim-spec.md                exact named-export surface each shim must provide
  STATUS.md                   交付现状
  BUILD-PLAN.md               历史设计笔记

改这块代码前先读 upstream/MAINTAINING.md —— 它记录了集成层(desktop host + cindy_browser MCP)以及所有踩过的坑与不变量。

Updating from upstream

pnpm sync:browser-runtime --ref=<commit-or-branch>
pnpm --filter @cindy/browser-control-runtime build   # surfaces any shim gaps
pnpm --filter @cindy/browser-control-runtime test     # contract + SSRF guard

_generated/** is regenerated wholesale; never hand-edit it. To change behavior, edit sync.mjs (vendor set / import rewrite) or the hand-written src/shim/*.

Security note

The SSRF/path-containment decision logic is vendored upstream code, not re-implemented. src/shim/ssrf-runtime.ts only re-implements the thin fetch shell that composes those vendored primitives (isBlockedHostnameOrIp, resolvePinnedHostnameWithPolicy, createPinnedDispatcher). The SSRF contract tests assert the real teeth still block cloud-metadata and private IPs, so a future sync that weakens them fails CI.