Files
cindy/docs/dev-rules
Chris Zhang 3f4ec18ec5 feat(input-handoff): 代输入——把需要主人填写的输入步骤交给主人 (#6009)
* feat(input-handoff): hand on-screen input steps to the owner (代输入)

Agents call request_input_handoff when a screen needs the owner (sign-in,
password, code, consent, an unknown choice). The host reads each step of the
target window and shows it as a card on the owner's devices; values go only
to the host through the signed v3 exchange and never reach the model, logs,
transcript, IM or push. Includes multi-step following, auto hand-back,
screenshot-tap and single-window live view fallbacks, device-code sign-in,
terminal askpass for sudo/ssh/git, teammate toggle and IM pointers.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* feat(input-handoff): composer strip and dialog, scan-to-sign-in, locked-screen handling

- Desktop: a strip above the composer opens a native-style dialog that shows
  only what the owner types (standard inputs, so password managers fill them),
  a sign-in QR code, a device code or a tappable picture of the window.
- Scan-to-sign-in: the helper finds QR codes on the target window (Vision);
  the code travels only in the sealed picture, can be opened on the device
  (web and app links), copied or shared, and the computer detects the
  sign-in on its own.
- Fix: keep the helper's stdin open until it replies; closing it early made
  the helper's caller check fail, so every handoff ended as unreadable. The
  QR picture is now length-prefixed instead of ending at EOF.
- A locked screen ends with screen_locked and tells the agent to wait for
  the owner to unlock.
- A quiet claim on an unheld screen keeps the claiming device's answer valid,
  so fill-and-submit from a password manager is not rejected as stale.
- Mobile: matching strip and sheet (SwiftUI sheet on iOS), no new native
  dependencies.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(input-handoff): type only into the app in front and stay on a form that still asks

macOS can refuse to bring another app forward for a background helper, and
typed keys then went to whatever app was in front. Typing now requires the
target to be in front (read fresh from accessibility), activation falls back
to a click on the window's own title bar, and synthesized clicks land only
where the target's window is. Typed keys get time to drain before a press.

After a submit, switching to an app the owner already had open no longer
counts as the sign-in moving there while the form still asks for input.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(input-handoff): lead the QR step with opening the link here; say a sleeping display locks the screen

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* docs(design): refresh design inventory for the input handoff screens

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(input-handoff): confine to the target window and stop acting after the request ends

- Live view: keys and text reach the target only while its own window is focused, not just its app.
- Screenshot and QR steps capture the target window by id instead of cropping the screen, so covering windows never show.
- A submission waiting for the desktop no longer types or taps after the request was cancelled, timed out or closed.
- A remote answer that completes the handoff (terminal password, last step) reports success over the signed exchange.
- A screen that locks while the card is open ends the handoff as screen_locked.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(computer): load the 代输入 secure-field check on use

The computer tool statically imported the 代输入 driver, which pulls the native
input helpers (and their child_process use) into its module graph and broke the
computer tool tests that mock child_process.

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

---------

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
Co-authored-by: Chris <4436110+zqchris@users.noreply.github.com>
2026-10-14 14:12:29 +08:00
..
…

开发规则

这里存放 Cindy 客户端仓的工程约束、实现规则、开发流程和验证方法。

收录标准

  • 规则说明“代码怎样实现、怎样验证或哪些技术操作被禁止”。
  • 每条规则应写清触发条件、必须做什么、禁止做什么、验证方法和例外条件。
  • 只适用于单个目录或模块的规则,优先放到对应目录的嵌套 AGENTS.md;需要跨目录 复用或需要较长解释的规则放在这里。
  • 可以由 lint、测试、类型检查或脚本强制的要求,应同时落实到自动化检查,不能只靠 Agent 阅读文字。

当前文档

  • repo-map.md:仓库地图——apps、packages 与顶层目录的定位导航。
  • environment-setup.md:公共开发环境、依赖安装与 submodule 准备。
  • model-catalog-maintenance.md:模型配置与下发统一入口——架构图、字段职责、覆盖顺序、修改位置、代码导航与发布验收。
  • model-catalog-runtime.md:模型窗口、压缩预算、原生缓存、参考价与显示细则;从架构入口按需进入。
  • desktop-development.md:Desktop 的 Agent 安全启动入口与 分层验证命令。
  • electron-security-and-process-boundaries.md: Electron 进程职责、Renderer 信任模型、BrowserWindow、独立辅助窗口统一生命周期、 preload、IPC 与远程内容安全边界。
  • credentials-and-local-storage.md:凭证不入仓、 用户持久数据、临时文件与测试目录的安全边界。
  • media-storage-and-protocols.md:Desktop 媒体总仓、 cindy-media:// 协议、引用生命周期与历史兼容边界。
  • database-and-migrations.md:Desktop SQLite schema、 append-only migration、companion script、隔离运行与异步数据库访问规则。
  • mobile-development.md:Mobile 的模拟器开发、分层验证与 专项文档入口。
  • orca-team-architecture.md:Orca 多 Agent 协同架构与运行时约束。
  • maker-core-and-agent-behavior.md:packages/maker-core 的 Agent 能力归属、代码优先确定性、缓存率/性能/准确性指标不可回退,以及 system prompt 改动门禁。
  • plugin-security-and-authoring.md:插件(.cindy) 运行时沙箱与进程隔离、权限即授权边界、网络/凭证/资源交接、存量插件向下兼容红线 (升级不得要求用户重装或重新确认),以及作者契约与编写手册(FORGE_GUIDE)同步。
  • cindy-updater.md:客户端自动更新链路的 owner 确认门禁与高风险 约束。
  • engineering-conventions.md:统一日志、IPC 错误协议 (throwIpcError)、main 侧默认带测试、macOS/Windows 双端兼容,以及 UI 文案的 i18n 落地与 pnpm check:i18n 门禁。
  • log-upload-and-redaction.md:客户端日志采集/脱敏/上报的 三条不变量(记录边界、白名单方向 deny-by-default、标记代次 + 原子清除)、四层收窄管道、 授权闸、区域绑定与崩溃时序。
  • protocol-compatibility.md:两仓本地协议实现、device-link relay 层、插件来源与 wire protocol 兼容。
  • architecture-invariants.md:package 与 render/main 解耦、 main 进程静态依赖,以及主界面布局树不变量。
  • configuration-and-overrides.md:配置可见性分层、默认值 与用户 override 分离、默认值迁移与恢复默认语义。
  • remote-and-mobile-adaptation.md:SSH 远程工作区、 device-link allowlist、手机版入口与功能类 PR 的远程/手机三选一门禁。
  • development-workflow.md:worktree dogfooding 会话契约、提 PR 与直推 main 门禁,以及 Review P0/P1/P2 严重度口径。