mirror of
https://github.com/makecindy/cindy.git
synced 2026-12-02 05:30:14 +08:00
* fix(desktop): keep cached Library sessions from mkdir empty custom roots Re-resolve the live binding on each request so a missing custom root stays unavailable instead of recreating an empty library. Same-disk restore continues through existing open/status; a rebuilt path remains binding-moved. Signed-off-by: PraiseZhu <zhuzan@xd.com> * fix(desktop): do not mint unavailable Library identity from default root Unavailable cached custom sessions are not required to keep the live identity. Restore still uses the original disk object; a replaced directory stays binding-moved. Signed-off-by: PraiseZhu <zhuzan@xd.com> * feat(desktop): add owner-scoped Library staging adapter Host H1 is a thin LibraryVault adapter for plugin upload staging. It keeps owner×ghost isolation, hard quota, tombstones, and ACK-gated release without a second media library, new UI, or TCC path. Quota counts durable, orphan blobs, closed tmp, and in-memory uploads without overlap. abort of a commitPending blob is STREAM_INVALID so the landed original stays reserved until ACK. disposeAll/bind/unbind/relocate/delete drain in-flight release behind relocating. First-minted staging roots also fsync parent directory entries; Windows still reports fsynced:false. Signed-off-by: PraiseZhu <zhuzan@xd.com> * fix(desktop): recover staging commit from retained manifest and intent Same-instance retry after a durable manifest write plus failed journal fsync no longer dies on ifNotExists ALREADY_EXISTS. Matching identity is adopted; conflicting identity is rejected without overwrite. New originals write intent.json before blob rename. A new Store recovers only from that trusted identity after hash/bytes checks, then installs manifest+dirsync. Incomplete or conflicting intent fails closed and keeps the source. Historical orphans without intent stay billed in isolation and are not TTL-deleted. Signed-off-by: PraiseZhu <zhuzan@xd.com> * fix(desktop): fail closed when a custom Library parent vanishes A stale custom resolveLibraryRoot could still reach vault.open, which recursively created the missing user parent and reported ready empty. Custom open now refuses to recreate a vanished parent (disk-missing); default first-time create still mkdir. keep files remain in the renamed directory and are not treated as deleted. Signed-off-by: PraiseZhu <zhuzan@xd.com> * fix(desktop): reject replaced custom parents and revoke extraDir on drift Stale resolve plus a same-path new inode is binding-moved at the mkdir boundary. disk-missing after a granted extraDir actually revokes the slot. Auto-open failures latch drift so status-only restore works. Keep files stay in the renamed-away directory. Signed-off-by: PraiseZhu <zhuzan@xd.com> * fix(desktop): do not recursive-mkdir custom Library parent after inspect Custom skeleton mkdir is non-recursive so a vanished user parent cannot be rebuilt as an empty library. Default roots still create recursively. Keep files stay in the renamed-away directory. Signed-off-by: PraiseZhu <zhuzan@xd.com> * fix(desktop): bind custom Library mkdir to held parent identity After the last successful inspect, hold the parent directory and compare path identity after mkdir(root). A same-path new inode fails closed as binding-moved; an empty root created on the replacement is rolled back and keep files stay parked. Node has no mkdirat; this is not atomic. Signed-off-by: PraiseZhu <zhuzan@xd.com> * fix(desktop): create custom Library trees via held parent fd Darwin mkdirat/openat (SYS_mkdirat=475) and Linux /proc/self/fd keep ghostId/meta on the granted parent object. Missing helper fail-closed before mutation; no path mkdir fallback. Windows custom init unsupported. Default roots still mkdir recursively. Keep files stay parked. Signed-off-by: PraiseZhu <zhuzan@xd.com> * fix(desktop): skip custom first-open path usage persist and sweep After the held parent fd is closed, custom open does not write, rename, or unlink under this.root. Sweep unlink and persistUsage are skipped; read-only usage scan remains. Default roots unchanged. Later library writes still persist. Isolated D: no replacement usage.json. Signed-off-by: PraiseZhu <zhuzan@xd.com> * fix(desktop): existing custom open, session teardown, usage ledger Open an already-initialized custom library from the held parent fd without mkdir. Missing structure on platforms without create stays fail-closed. Teardown only the captured session. Reuse a valid usage ledger; scan only when it is missing or corrupt. Custom tmp is not path-unlinked. Signed-off-by: PraiseZhu <zhuzan@xd.com> * fix(desktop): Windows existing custom open via FILE_OPEN ReadFile Existing libraries open from the inherited parent handle with NtCreateFile FILE_OPEN+ReadFile. FileIndex 0 and missing helpers fail closed. Create stays unsupported on Windows. Linux may unlink only uuid.tmp/.stream staging leftovers via /proc/self/fd. No path mkdir fallback. Signed-off-by: PraiseZhu <zhuzan@xd.com> * fix(desktop): parse existing-open helper JSON as complete values Pretty-printed and compact meta/usage payloads both parse. Malformed JSON or failed field checks stay CORRUPT. Do not split on the first newline of the helper stdout. Signed-off-by: PraiseZhu <zhuzan@xd.com> * fix(desktop): do not delete custom Library uuid tmp/stream on open Age and an empty streams map cannot prove a fsynced .tmp/.stream is garbage after a crash before rename. Open no longer unlinks them. P2_tmp stays unresolved. Unknown names are kept. Signed-off-by: PraiseZhu <zhuzan@xd.com> * feat(desktop): Windows custom Library first-create via NtCreateFile Create dirs with FILE_OPEN_IF and meta.json with FILE_CREATE from the inherited parent handle. No path mkdir, no rollback rmdir, no new native dependency. Existing FILE_OPEN stays read-only. Missing helper still fails closed before mutation. Signed-off-by: PraiseZhu <zhuzan@xd.com> * test(maker-core): time durable Subagent system-deny waitFor Record list/resolver/control monotonic marks and dump them on waitFor failure so Linux CI can discriminate missed 500ms poll vs unpublished system-deny. Keep the original assertion and timeout. Mac is syntax sanity only. Signed-off-by: PraiseZhu <zhuzan@xd.com> * fix(desktop): distinguish Windows meta exists from reparse collision FILE_CREATE collision is exists only after FILE_OPEN of a regular file. Reparse and unknown collisions fail closed. CreateRelative always releases handles it still owns, including the catch path. Signed-off-by: PraiseZhu <zhuzan@xd.com> * fix(desktop): sweep idle staging uploads and count concurrent disk reserve Idle incomplete uploads now yield BUSY/QUOTA slots after timeout. Concurrent begin reservations are checked against reserveBytes. Durables and commitPending originals are never TTL-deleted. Signed-off-by: PraiseZhu <zhuzan@xd.com> * fix(desktop): count idle tmp residue and unwritten disk reserve Refresh closed tmp bytes after idle abort before quota admission. Disk reserve subtracts only unwritten stream remainder; commitPending does not double-count landed blobs. Durables stay off TTL. Signed-off-by: PraiseZhu <zhuzan@xd.com> * fix(desktop): recover staging durables across owner generation Restart resets app-session generation so live ownerScopeKey (local🆔2 vs local🆔0) no longer matches the on-disk manifest. Treat generation as a process lease, not durable owner identity. Signed-off-by: PraiseZhu <zhuzan@xd.com> * fix(desktop): fail closed on custom ghost loss and staging.release races Greptile P1: vanished custom ghost dirs must not rebuild an empty library on a live vault; staging.release re-hashes the unique original and blocks concurrent library mutates until the staging original is gone. P2: disposeAll now invalidates staging stores, uploads, and vaults. Signed-off-by: PraiseZhu <zhuzan@xd.com> * fix(desktop): persist custom libraryReady so vanished ghost dirs stay fail-closed Binding records first-create vs already-built trees without bumping generation. Restart after `<parent>/<ghostId>` disappears now returns disk-missing instead of initializing an empty replacement library. Signed-off-by: PraiseZhu <zhuzan@xd.com> * fix(desktop): serialize Library mutates with staging.release Greptile P1 r4058467558 needs a real per-ghost mutex, not only a second hash. Mutating Library ops and staging.release now share one chain so hash-then-delete cannot overlap write/delete/rename. Relocating releases still fail closed without taking the lock. Signed-off-by: PraiseZhu <zhuzan@xd.com> --------- Signed-off-by: PraiseZhu <zhuzan@xd.com>
开发规则
这里存放 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 严重度口径。