Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
Merge branch 'feat/project-default-name' into merge/project-default-name
vastsa89b43232a5f2
diff --cc apps/desktop/src/components/ProjectCreateDialog.tsxindex 8febd5d3a,c746b4201..24deae598--- a/apps/desktop/src/components/ProjectCreateDialog.tsx+++ b/apps/desktop/src/components/ProjectCreateDialog.tsx@@@ -56,10 -56,15 +57,16 @@@ export function ProjectCreateDialog()const inputRef = useRef<HTMLInputElement | null>(null);const dialogRef = useRef<HTMLDivElement | null>(null);const busyRef = useRef(false);+ const folderPickerInFlightRef = useRef(false);- // The repository name seeds the project name until the user types their own.+ // The picked source seeds the project name until the user types their own.const nameTouchedRef = useRef(false);const cloneTarget = parseGitCloneUrl(gitUrl);+ const defaultName = defaultProjectName({+ source,+ folders,+ repositoryName: cloneTarget?.name,+ });+ const projectName = resolveProjectName(name, defaultName);useEffect(() => {if (!open) return;diff --cc docs/spec/08-meta/decisions-log.mdindex cd2031143,ef1001879..59109a44a--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@@ -6408,125 -6400,22 +6408,145 @@@ that was sitting at the bottom — inclglyphs remain. See ADR 0298, `04-ux/06-settings-ia.md`,`04-ux/07-ui-design-system.md`, and E2E-126.-## 2026-09-20 — The Create project name defaults to the primary folder (D600)+## 2026-09-20 — Stdio MCP spawn uses the login-shell PATH (D600, issue #571)++- Finder/Dock launches Electron with `/usr/bin:/bin:/usr/sbin:/sbin`. User MCP+ stdio spawn copies that PATH and uses `shell: false`, so a market-installed+ Fetch server (`uvx mcp-server-fetch`) failed with `spawn uvx ENOENT` even+ when `uvx` worked in a terminal. Same hole for `npx`.+- Electron main now probes the login shell the way host-core already does for+ Bash (ADR 0045): `$SHELL -lic 'printf %s "$PATH"'`, 5s-bounded, cached, last+ stdout line only. Well-known user bin dirs that exist (`/opt/homebrew/bin`,+ `~/.local/bin`, `~/.cargo/bin`, …) are merged in. Windows stays on the+ inherited PATH. Command names stay bare; arguments stay literal.+- A missing executable is reported as `command not found: <name>` instead of+ a raw `spawn uvx ENOENT`.+- See ADR 0045, `03-runtime/03-tools-and-permissions.md`, issue #571.+## 2026-09-20 — Settings explain themselves on demand (D601)++- Decision D601 is renderer-only. A settings row no longer carries a permanent+ second line of prose under its title: `SettingsRow.description` is a string+ that renders behind the question mark beside the title, and `SettingsCard`+ gains the same `description` for a card heading. `HelpIcon`+ (`components/ui.tsx`) is the single affordance — a real button, so a keyboard+ reaches the sentence a pointer hovers, and the sentence itself is its+ accessible name. `Field`'s `hint` moved to it as well.+- A row's live value is not an explanation and stays visible: the pinned+ default model travels through the new `SettingsRow.detail`, and+ `NetworkProxySection`'s local copy of the row skeleton is gone in favour of+ the shared one, so the retired line cannot return through a second renderer.+- The mark is a sibling of the element it explains wherever that element is a+ heading, because a nested button joins the heading's accessible name. A+ settings `Field` is the deliberate exception: its hint stays inside the+ `<label>`, so the field's accessible name carries the sentence too. Moving it+ out would cost click-to-focus on every field, which a longer name does not+ justify.+- No IPC channel, host protocol, storage schema, persisted setting, or i18n key+ changed: every sentence keeps its key and only its placement moved. See+ `04-ux/06-settings-ia.md` and `04-ux/07-ui-design-system.md`.++## 2026-09-20 — Crash dumps stay in the data directory (D602)++- Crashpad starts local-only (`uploadToServer: false`) before `ready`. Dumps+ live under `<data_dir>/crash-dumps`, not Electron's default `userData`+ crashDumps path, so a `PI_DESKTOP_DATA_DIR` profile does not share dumps+ with another installation. The marker `crash-dumps.json` records the newest+ mtime already reported.+- The next lock-holding launch writes one `diagnostics` line for dumps newer+ than that marker, classified by Crashpad's `ptype` annotation: `error` if+ any new dump is the browser/main process, `warn` for a recovered renderer,+ GPU, or utility crash. A scan failure is one `crashDumpReportFailed` warn+ and never blocks the first window.+- Host-core and sidecar crashes stay on the supervisor path and the `host` /+ `agent` log channels. Nothing is uploaded. See+ `03-runtime/07-process-model.md` §4, `03-runtime/09-logging-and-observability.md`,+ and `03-runtime/04-data-storage.md`.++## 2026-09-20 — The dock occludes transcript paint below Composer (D603, issue #728)++- The transcript scrollport fills the conversation pane while its content+ reserves the measured Composer height. Because the absolutely positioned dock+ was transparent, a row could keep painting below the floating shell and stay+ visible in its bottom gap or outside its rounded corners.+- `.composer-dock-docked` now paints the opaque `--ds-bg-primary` workspace+ surface across its full width. The Composer retains its existing translucent+ elevated token, radius, shadow, and measured scroll reserve; the backing band+ removes only transcript paint that has crossed the Composer boundary.+- Renderer CSS and the theme surface regression change only. There is no scroll+ state, protocol, persistence, theme schema, or permission change. See+ `04-ux/08-component-spec.md` and E2E-CHAT-opaque-floating-decision-and-retry-surfaces.++## 2026-09-21 — The context estimate is calibrated conservatively (D606)++- Every budget threshold reads one number, and that number is corrected against+ what requests actually cost. pi's estimator anchors on the last assistant+ usage and estimates the rest as `chars / 4`, which under-counts CJK text by+ roughly a factor of 2–4 and, with no anchor left, omits the system prompt and+ tool schemas entirely.+- The two errors are applied separately: the per-character bias as a+ scale-free ratio over the guessed tail, and an unanchored residual as a ratio+ only for observations taken at a comparable scale (0.5×–2×), otherwise as the+ observed overhead capped at 32,000 tokens. A 100k-scale sample therefore+ cannot be applied as a ratio to a 1M projection.+- The correction is asymmetric: upward applies once three observations exist;+ downward needs three agreeing samples, is capped at 15 % per step, and can+ never take the value below 85 % of the raw estimate, so a projection at+ 1.18× the hard limit still compacts. A report outside 0.5×–3× of what the+ calibration predicted is a misreport, and two consecutive misreports freeze+ the downward direction. See `03-runtime/02-agent-runtime.md` §5.1.++## 2026-09-21 — A tool-call id is unique in every request (D608, issue #718)++- Anthropic-family endpoints, DeepSeek's included, reject a whole turn with+ `tool_use ids must be unique` when the request carries a call id twice, and+ the session cannot continue while that lasts. The transcript is an append-only+ snapshot stream that tolerates a retried append, so the same call can reach+ the assembled context twice: under one row id, which the host's keep-last read+ already collapses, or under two, which it cannot.+- The last view before the wire therefore keeps the first occurrence of each+ `toolCall` id and drops a later call or a later result for that id, so the+ call/result pair the provider validates stays well-formed. A request with no+ duplicates is returned unchanged (identity, not a copy). Nothing is rewritten+ on disk and no compaction or retention rule changes.+- A drop is reported once on the `agent` log channel with the session and the+ ids, so the next report of this names the writer instead of only the+ provider's sentence. See `03-runtime/02-agent-runtime.md` §5.+- The guard is deliberately the request boundary rather than the history+ rebuild: it also covers a duplicate that appears while the session runs, which+ a rebuild-time filter cannot see.++## 2026-09-21 — A plugin crash reports its exit code without copying raw output (D607, issue #747)++- The host-process crash path reported only the plugin id, so a report read+ `plugin host process exited: <id>` and carried nothing else — the reporter in+ issue #747 had exactly that sentence and no way to say more. The exit code it+ already had is now part of the message, the `failed` service state, the+ `plugin.crash` audit record and the `plugin` log channel; on Windows a hard+ fault (`0xC0000005` and friends, delivered as a negative signed int, printed+ alongside its unsigned hex form) and a plugin's own `process.exit(1)` are+ different bugs and this is the only field that tells them apart.+- Plugin stdout/stderr is not copied into the load error, crash audit record, or+ crash log payload because it may contain workspace data or secrets. Nothing+ new is persisted and no permission or API surface changes; the existing+ `plugin.stdio` audit stream is otherwise unchanged.+- See `07-plugins/05-plugin-lifecycle.md` §3.1.++++## 2026-09-20 — The Create project name defaults to the primary folder (D609)++ - The Create project dialog required a typed name before Create became+ available, so a local folder pick could not be confirmed without inventing a+ title; the git source already seeded the field from the repository name+ (D438, ADR 0273).+ - The name field is now optional for both sources. It seeds from the picked+ source — the first selected folder's name for a local pick, the repository+ name for a git checkout — and stops following the source as soon as the user+ types their own name. Create is gated by the source alone (one folder, or a+ parsed URL plus a destination), and a field left empty falls back to the same+ derived name.+ - Derived names are cut to `MAX_PROJECT_NAME_CHARS` (80) so the persisted+ sidebar preference and the name field accept them unchanged. Folder-name+ parsing moves to `apps/desktop/src/lib/project-name.ts` and is shared with the+ dialog's folder rows.+ - Renderer only: no protocol, storage, host, permission, or migration change,+ and no new default. See `04-ux/08-component-spec.md`, ADR 0233, ADR 0273, and+ E2E-012a / E2E-256.diff --cc docs/zh-CN/spec/08-meta/decisions-log.mdindex 63cffb59f,d34376044..2ff3481bd--- a/docs/zh-CN/spec/08-meta/decisions-log.md+++ b/docs/zh-CN/spec/08-meta/decisions-log.md@@@ -4574,58 -4571,16 +4574,72 @@@ that amendment are retired by ADR 0268- 渲染器产物不再产出任何应用字体面,只剩 KaTeX 的 `woff2` 字形。见 ADR 0298、`04-ux/06-settings-ia.md`、`04-ux/07-ui-design-system.md` 与 E2E-126。-## 2026-09-20 —— 新建项目的名称默认取主要文件夹(D600)+## 2026-09-20 —— 崩溃转储留在数据目录(D602)++- Crashpad 在 `ready` 之前以本地模式启动(`uploadToServer: false`)。转储放在+ `<data_dir>/crash-dumps`,而不是 Electron 默认的 `userData` crashDumps 路径,+ 因此 `PI_DESKTOP_DATA_DIR` profile 不会与其它安装共用转储。标记文件+ `crash-dumps.json` 记录已经报告过的最新 mtime。+- 下一次持有单实例锁的启动会为新于该标记的转储写一条 `diagnostics` 记录,+ 按 Crashpad 的 `ptype` 注解分类:任一新转储属于 browser/main 进程则为+ `error`,已恢复的 renderer、GPU 或 utility 崩溃为 `warn`。扫描失败是一条+ `crashDumpReportFailed` 警告,永不挡住第一扇窗口。+- host-core 与 sidecar 崩溃仍走监督器路径以及 `host` / `agent` 日志通道。+ 什么都不上传。见 `03-runtime/07-process-model.md` §4、+ `03-runtime/09-logging-and-observability.md` 与 `03-runtime/04-data-storage.md`。++## 2026-09-20 —— Composer 下方的停靠区遮住正文绘制(D603,issue #728)++- 正文滚动容器占满会话面板,内容通过实测 Composer 高度预留底部空间。此前绝对定位的+ 停靠区是透明的,因此正文行可以继续绘制到悬浮输入框下方,并从底部空隙或圆角外侧露出。+- `.composer-dock-docked` 现在横跨整个宽度绘制不透明的 `--ds-bg-primary` 工作区表面。+ Composer 原有的半透明高架令牌、圆角、阴影和滚动预留保持不变;底层遮罩只移除越过+ Composer 边界的正文绘制。+- 仅改动渲染器 CSS 与主题表面回归测试;不改变滚动状态、协议、持久化、主题 schema+ 或权限。见 `04-ux/08-component-spec.md` 与+ E2E-CHAT-opaque-floating-decision-and-retry-surfaces。++## 2026-09-21 —— 上下文估算采用保守校准(D606)++- 所有预算阈值读取同一个数字,该数字按请求的真实开销校正。pi 的估算器以最后一条助手用量为锚、其余按 `chars / 4` 估算,+ 这会低估中文文本约 2–4 倍;没有锚点时还会完全漏掉系统提示与工具结构。+- 两类误差分开应用:逐字符偏差是按比例(与量级无关)作用于猜测尾部;无锚点残差只在量级相当的样本(0.5×–2×)上按比例+ 应用,否则只加观测到的固定开销(上限 32,000 词元)。因此 100k 量级的样本不会作为比例系数套到 1M 的投影上。+- 校正不对称:向上修正有三个观测即生效;向下修正需要三个方向一致的样本、每次最多 15 %,且不会低于原始估算的 85 %——+ 处在硬限制 1.18× 的投影仍会压缩。偏离预测 0.5×–3× 的报告视为误报,连续两次误报冻结向下修正。+ 见 `03-runtime/02-agent-runtime §5.1`。++## 2026-09-21 —— 每个请求里的工具调用 id 必须唯一(D608,issue #718)++- Anthropic 系端点(含 DeepSeek)在请求中同一个调用 id 出现两次时,会以 `tool_use ids must be unique` 拒绝整个回合,+ 期间该会话无法继续。转录是仅追加的快照流、容忍重试造成的重复追加,因此同一次调用可能两次进入组装后的上下文:同一个行 id+ (宿主按 keep-last 读取时已折叠)或两个不同行 id(宿主无法折叠)。+- 因此上线前的最后一个视图对每个 `toolCall` id 只保留第一次出现,丢弃其后重复的调用或结果,使提供商校验的「一调用一结果」+ 配对保持完整;没有重复的请求原样返回(返回同一对象,而非副本)。磁盘上的内容不会被改写,压缩与保留规则也不变。+- 一旦发生丢弃,会在 `agent` 日志通道上报告一次,带上会话与 id,使下一次同类报障能指向写入方而不只是提供商那句话。+ 见 `03-runtime/02-agent-runtime §5`。+- 守卫刻意放在请求边界而不是历史重建处:这样也能覆盖**会话运行期间**产生的重复,而重建期的过滤看不到它。++## 2026-09-21 —— 插件崩溃上报带上退出码但不复制原始输出(D607,issue #747)++- 宿主进程崩溃路径此前只报插件 id,于是报障里只有 `plugin host process exited: <id>` 一句话——issue #747 的报告者手里+ 就是这么一句。现在运行时代码本来就已经拿到的**退出码**会出现在消息、`failed` 服务状态、`plugin.crash` 审计记录与+ `plugin` 日志通道里;Windows 上的硬故障(`0xC0000005` 一类,以负的有符号整数交付,同时打印其无符号十六进制形式)与+ 插件自己调用 `process.exit(1)` 是两类不同的问题,而这个字段是唯一能区分它们的。+- 插件 stdout/stderr 不复制进加载错误、崩溃审计记录或崩溃日志负载,因为其中可能包含工作区数据或敏感信息。不新增任何持久化,权限与 API 面不变;+ 既有的 `plugin.stdio` 审计流保持不变。+- 见 `07-plugins/05-plugin-lifecycle.md` §3.1。++++## 2026-09-20 —— 新建项目的名称默认取主要文件夹(D609)++ - 新建项目对话框原本要求先填名称才能创建,本地选文件夹时不得不先编一个标题;+ Git 来源此前已用仓库名预填该字段(D438、ADR 0273)。+ - 名称字段现在对两种来源都可选。它按所选来源预填——本地来源取第一个(主要)+ 文件夹的名称,Git 来源取仓库名——用户一旦自己输入就不再跟随来源。创建按钮+ 只由来源决定是否可用(一个文件夹,或解析成功的地址加保存位置),字段留空时+ 回退为同一个默认名。+ - 派生名称会截断到 `MAX_PROJECT_NAME_CHARS`(80),以保证侧边栏偏好持久化和+ 名称字段都能原样接受。文件夹名解析移到+ `apps/desktop/src/lib/project-name.ts`,与对话框的文件夹行共用。+ - 仅渲染器改动:不改协议、存储、宿主、权限或迁移,也不新增默认值。见+ `04-ux/08-component-spec.md`、ADR 0233、ADR 0273、E2E-012a / E2E-256。