Repository navigation
editor (8/8): the editor keeps up with an agent — opens its part, keeps the model while cells wait, says what it changed - #111
Open
lizaixi01 wants to merge 59 commits into
Conversation
DECISION: the Chinese translation table uses the SolidWorks Chinese terms wherever the editor named the same thing differently (基准面, 完全定义/欠定义/过定义, 几何关系/尺寸, 镜向, 构造几何线, 拉伸凸台/拉伸切除, 移动面, 简单直孔, 边线, and 配合 for assembly joints). Only words a person reads change; the SDK, the notebook code, the table's keys and everything an agent reads stay as they are. WHY (discussion of 2026-11-29 between the user and the assistant; record: design-docs/editor-sw-terms.md): the user, learning CAD through the editor's manual mode and SolidWorks videos side by side, compared the two term by term and kept looking for the SolidWorks word and not finding it (工作平面 for a 基准面, 已求解 for 完全定义, 约束 for 几何关系 and 尺寸, 镜像 for 镜向). The people this manual mode is for learned CAD on SolidWorks. The user's judgement: rename so that everything a person reads matches SolidWorks as far as possible, as its own branch, while the kernel stays the agent-friendly tool it is. Words only, so no code path changes. ALTERNATIVE CONSIDERED AND REJECTED: replacing "约束" and "边" everywhere. 约束 also names assembly joints, which SolidWorks calls 配合, and 边 occurs inside other words (边界, 两边); both were changed key by key instead. 基本体 is kept: SolidWorks has no primitives, so there is no word to copy. WHAT CHANGES: editor-web/src/i18n/locales/zh-CN.json, 73 values (no key added, removed or reordered). Behaviour that differs from SolidWorks (pick-kind chips instead of hover selection, connectors instead of face mates, no rollback bar) is not touched here. Checked: `vitest run src/i18n` (3 passed: every key the source uses has a Chinese entry, interpolations kept) and `tsc --noEmit` in this branch, on origin/master. Seen in the running editor on the working branch: the pick chips read 边线, a picked face offers 简单直孔. Not checked: every dialog that shows the renamed words. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DECISION: keep the term-by-term table of the change "editor i18n: the Chinese UI names things the way SolidWorks does" as a design record, so that a later reader sees which words changed, which were kept on purpose (基本体, 组件) and that behaviour differences are a separate matter. WHY: the decision is about words only, and its reasons are not visible from the diff of a translation table; the repo's rule is that a decision that outlives one commit gets a record in design-docs/. WHAT CHANGES: design-docs/editor-sw-terms.md (new; design-docs/ is git-ignored, added with -f). Checked: the table matches the 73 values the previous commit changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SolidWorks' Chinese help says 零部件 throughout (插入零部件, 零部件属性); the table mixed it with 组件 (review of PhySpace#102). The wording note said both were SolidWorks' words; it now lists 零部件 with the other terms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…AL_MODE=1 DECISION: MANUAL_MODE stays off in a release, and `VITE_MANUAL_MODE=1` (for `npm run dev` or a build) turns it on. WHY (work with the user on the editor's human interface, 2026-11-27 to 11-29): the user learns CAD through the editor's manual mode and improves it, so it had to run without editing the constant every time and without the risk of committing it switched on. The release keeps the code mode only, as the comment of this file says, until manual mode has a plan of its own. ALTERNATIVE CONSIDERED AND REJECTED: flipping the constant to true locally (it is one stray commit away from shipping). WHAT CHANGES: editor-web/src/lib/manual-mode.ts. Nothing else reads the variable; without it the editor is as before. Checked: tsc --noEmit and vitest run (331 passed) in editor-web, on this commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DECISION: while an undo or redo applies its steps, those steps stay reachable by _rename, so a cell id that changes during the apply (a deleted cell brought back gets a new id) is updated in them too. WHY (found by the user on 2026-11-28: "为什么我撤销重做几次居然会报错,点不了了"): undo and redo pop the steps off both stacks before applying them. An undo that brings back a deleted cell renames its id in the stacks, but the steps being applied were on neither stack at that moment, so they kept the old id; the next redo then looked for a cell that no longer existed and failed, and every later undo or redo failed with it. WHAT CHANGES: src/simplecadapi/editor/gui_features.py (FeatureService._applying, used by undo, redo and _rename). Checked: the editor tests (test_editor_features.py) pass at the end of this series; at this commit only tsc and vitest were run (331 passed). Seen in the running editor: undoing and redoing several times no longer fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s undo and redo DECISION: when the person keeps a value tuned on a slider (the editor rewrites the params cell), the undo history takes the new code as that cell's code (FeatureService.follow), so undo and redo go on from it. An edit made in the code itself is not followed: undoing over that is still refused, never forced. WHY (the user, 2026-11-28, after dragging a slider and pressing undo): the history remembered the params cell's code from when the feature was made, so after a slider change undo said the code had been changed elsewhere and stopped. A slider is part of the GUI, not an edit somewhere else; the refusal is meant for edits in code, which must not be overwritten. ALTERNATIVE CONSIDERED AND REJECTED: recording each slider change as an undo step of its own (the slider already has its own reset, and one drag would fill the history). WHAT CHANGES: gui_features.py (follow), server.py (_commit calls it with each changed cell's old and new code), and the test test_numbers_tuned_on_the_sliders_and_kept_do_not_break_undo_and_redo. Checked: test_editor_features.py at the end of this series (see the last commit); tsc and vitest on this commit (331 passed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DECISION: the left panel's content box clips (overflow-clip) instead of hiding overflow, so it cannot be scrolled. WHY (seen on 2026-11-28): a panel that was not shown still got focus, and the box holding both scrolled sideways by 156 px, so the tree appeared cut off at the left. overflow-hidden still lets a box scroll by focus; overflow-clip does not. WHAT CHANGES: one class in editor-web/src/App.tsx. Checked: tsc and vitest on this commit (331 passed); in the running editor the tree no longer shifts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and offers save as
DECISION: the header has an Export button; export writes the package and, next to it, STEP and STL (each on its own, so
one failing keeps the other), then a dialog shows the folder, a copy button, and "Save as…" for each file (the browser's
save dialog, or a download where that is not allowed).
WHY (the user, 2026-11-27: "导出成功了,但是不知道导出到哪了…就像另存为一样"): the export only wrote a status line with a
path. A person exports to take the model elsewhere (another CAD program, a slicer), which needs STEP or STL and needs to
know where the file is.
WHAT CHANGES: components/ExportDialog.tsx (new), Header.tsx (button), App.tsx (state), server.py (_export writes STEP and
STL and remembers the files; GET /api/export/file/{name} serves only those names), Chinese strings.
Checked: tsc and vitest on this commit (334 passed); exported in the running editor; the save dialog falls back to a
download in the embedded browser, where it is refused.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bers, names, plain failures) DECISION: what a person reads about the steps says what it means, in their language, with the program's own words kept out of the way: steps are numbered 1, 2, 3 in order; a step is named by its operation (Box → 方块, numbered when repeated) or by a `# 名称:…` line in its code, with a second line from `# 说明:…` or "builds on «X»"; a failed step says "«X» did not work" and what to try, with the SDK's message folded under Details; the reference check is shown only when a reference is actually lost; the partial-model notice names the step; the header drops ".py" and translates the kind; slider labels are plain words. The role and "product" badges leave the tree. WHY (the user, 2026-11-27: "主界面英文太多了看不懂…要做爸妈,老板能看懂的产品…每个功能最简单地话要解释清楚", and on 2026-11-28 about the tree: the numbers in front were cell indexes with gaps, and "产品" was not a word anyone recognised): the tree showed code names (slug, role, reads -> makes), cell indexes and raw SDK errors. The product badge was looked up first: in a chain of steps the part is the last step, as in any feature tree; when it is not, the banner above the list already says so and offers the choice (design-docs/part-holds-one-solid.md), so the badge added nothing. ALTERNATIVE CONSIDERED AND REJECTED: translating the slugs (they are code names an agent uses; the name in the code stays in the tooltip). WHAT CHANGES: FeatureTree.tsx, lib/plain-label.ts (new, with tests), Header.tsx, ParamControl.tsx (labels), PartialModel.tsx, lib/features.ts (title/note, a translated candidate label), App.tsx (step names for the notice, remade on a language change), gui_features.py (feature_words reads the two comment lines into the snapshot), Chinese strings. Nothing an agent reads changes. Checked: tsc and vitest on this commit (339 passed); seen in the running editor in Chinese with a failed shell step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he pick DECISION: in the feature tree, a click on the row that is already picked, or on the empty part of the list, clears the pick (Ctrl/Cmd keeps adding and removing as before). WHY (the user, 2026-11-28: "按草图点击左边区域是无法取消选中的"): once a sketch row was picked there was no way to unpick it from the tree, which every file list and feature tree allows. WHAT CHANGES: lib/tree-click.ts (new, with tests: the decision as a pure function), FeatureTree.tsx (onSelect takes null). Checked: tsc and vitest on this commit (343 passed); tried in the running editor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DECISION: ParamControl shows the number box by default (editable = true); a caller that wants a bare slider passes false. WHY (the user, 2026-11-28: "这个拖动应该改成可以输入,这样更方便"): a person who knows the number (a 40 mm plate) types it rather than drags to it; the box existed but only in the operation panel. WHAT CHANGES: the default of one prop in components/ParamControl.tsx. Checked: tsc and vitest on this commit (343 passed); typed values in the running editor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… picks: distance and angle) DECISION: the inspector shows for each picked item what it is and its measures (a plane face's area and normal, a cylinder's diameter, an edge's length…), with a copy button for each number; for two picks it shows the distance between parallel faces, the angle, the centre distance and the offsets, for more the totals. The ids and raw properties stay, folded under "Details (for the AI and developers)". While an item's details load it shows nothing rather than "nothing to measure". WHY (the user, 2026-11-28: "检查器里的东西也非常看不懂,都是英文,我想先看看 onshape 或者 sw 是怎么做的"): the inspector listed entity ids and a JSON tree. SolidWorks' Measure tool and Onshape's measure panel show the measures of the picked geometry and, for two picks, the distance and angle between them; that is what a person picks things to find out. WHAT CHANGES: lib/measure.ts (new, pure, 9 tests), components/Inspector.tsx, Chinese strings. Checked: tsc and vitest on this commit (352 passed); picked faces and edges of a flange in the running editor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… stay on screen DECISION: the inspector (by its header) and the notice under it (anywhere on it) can be dragged; where each was put is remembered in this browser, two quick presses put it back, and a card is always kept at least partly on screen (also when a remembered place no longer fits the window). A drag the system breaks off ends. WHY (the user, 2026-11-29: "我希望这两个框能拖动,要不然就会像现在这样挤成一堆"): the inspector, the partial-model notice and the AI panel sat in the same corner and covered each other. The code review of 2026-11-29 found that a card could be dragged out of reach for good and that a cancelled drag never ended; both are handled here. ALTERNATIVE CONSIDERED AND REJECTED: reusing lib/useDraggable.ts, which centres dialogs and has a different contract. WHAT CHANGES: lib/useFloatingDrag.ts (new; clampToView is pure and tested), FloatingPanels.tsx, the inspector header as the handle. Checked: tsc and vitest on this commit (355 passed); in the running editor a card placed off screen came back on reload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nese in the library's source The library carries no Chinese (test_library_is_english). The tags `# 名称:` and `# 说明:` are still read, written as \u escapes, and `# name:` / `# note:` work as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NiJingzhe
requested changes
Dec 1, 2026
NiJingzhe
left a comment
Collaborator
There was a problem hiding this comment.
自动打开新建零件、--no-run 保留上次模型并提示等待运行、以及 agent.changed 播报与高亮这三个体验改进非常到位!不过有一个明确的 Bug 建议修复后再合并:
- 手动模式下用户自己点击 GUI 按钮也会误报「AI 刚刚改了」(
src/simplecadapi/editor/server.pycell_command):
FeatureService._command()(手动模式下所有按钮操作:添加/编辑特征、撤销/重做等)底层全部调用self.state.cell_command(op, body)。当前cell_command无条件写入self._agent_pending并在运行后触发_announce_agent_change()广播agent.changed,会导致用户自己在界面上点按钮建模或撤销时,视口上方也会弹出「AI 刚刚改了:第 N 步…」并给步骤打上「刚改过」标记。- 修复建议:给
cell_command()增加一个开关参数(例如announce: bool = True或from_agent: bool = False),仅在 HTTP 入口api_cell_command(供sca cellCLI 调用)中开启agent.changed记录与播报,FeatureService._command()调用时关闭即可。
- 修复建议:给
…87 filename*)
DECISION: GET /api/export/file/{name} sends Content-Disposition as an ASCII filename plus filename*=UTF-8''<quoted>
(server._attachment).
WHY: HTTP headers are Latin-1; a part named in Chinese (法兰.step) made the header fail to encode and the page's
"save as" answer 500 (review of PhySpace#103 by NiJingzhe, point 1).
Checked: ExportedFileTest in test_editor.py (a 法兰.step download: 200, the bytes, an ASCII header with the
filename* form).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iled: …") DECISION: the status line of a failed STEP/STL export is cut to its first 300 characters, not its last. WHY: with a long error the cut dropped "STEP export failed:", so the page said what went wrong without saying it was the export (review of PhySpace#103 by NiJingzhe, point 2). Checked: python -m py_compile; the line is the same otherwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… saved DECISION: every way out of the export dialog (its Close button, Esc, a click outside) goes through one close that clears the "Saved where you chose." notes. WHY: only the dialog's own onOpenChange cleared them; the Close button called onClose directly, so the next export showed the last one's notes (review of PhySpace#103 by NiJingzhe, point 3). Checked: tsc in editor-web. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DECISION: the inspector header shows "sending to AI…", "sent to AI ✓" or "not sent to AI, pick again"; the server echoes every selection it takes, also one equal to the last, and always answers an entity lookup, and a pick whose details never arrive is sent without them after a timeout. WHY (the user, 2026-11-28, before asking the AI about a face: "可是我确实选中了,难道出 bug 了"): nothing showed whether the pick had reached the notebook the agent reads. Found while building it: the server skipped the echo for an unchanged selection (a false "not sent"), and an entity lookup that raised never answered, so the pick waited for ever. WHAT CHANGES: lib/selection-sync.ts (new, with tests), App.tsx, Inspector.tsx, server.py (echo, lookup), the test test_the_same_selection_sent_twice_is_echoed_both_times. Checked: tsc and vitest on this commit (357 passed); the server test at the end of this series. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oding agent does it, in one undo step
DECISION (record: design-docs/editor-ask-ai.md): with faces, edges or solids picked, "Ask AI" opens a panel where the
person writes one sentence; the editor starts a headless coding agent (`claude -p`) in the workspace with the request and
the picks as ql selectors, shows its progress (stages, steps in plain words, elapsed time) and its result, and records all
the agent's edits as one undo step, so the undo button takes them back.
WHY (discussion with the user, 2026-11-28 and 11-29): the user asked to write a comment right on picked geometry. Three
prototypes were tried; the one where comments are only stored for a later agent was rejected ("还不如不加留言功能": a person
wants the change, not a note). The chosen one runs the agent at once. Then: it felt slow, so a progress bar with stages
and steps; the box closed after sending, so it stays open with "write another"; results are kept until read; Enter sent
half-typed Chinese, so the IME is respected; undo must work, so the edits are one history entry. The cost of running a
model per request was raised by the user; the model is the CLI's default unless SCA_AGENT_MODEL says otherwise.
The agent edits only through the running editor's cell commands (no file edits, no other shell, no web), so the page shows
each change live. The code review of 2026-11-29 found that the undo step also took in edits the person made while the agent
worked: the agent's commands now carry its request id (SCA_AGENT_REQUEST, header X-Sca-Agent-Request) and only the cells
they touched go into its step.
ALTERNATIVES CONSIDERED AND REJECTED: stored comments only (above); an agent with free file access (two writers of one
notebook).
WHAT CHANGES: agent_requests.py (new), server.py (/api/requests, the "request" message, tagged cell commands), cli.py (the
header), gui_features.py (cell_changes, record_changes, "modify" as a role with bodies), AskAiPanel.tsx and
lib/agent-requests.ts (new), App.tsx, commands.ts (in the context bar; a label starts lower case only by its first letter),
Chinese strings, tests (test_editor_agent_requests.py, two in test_editor_features.py). Requests are kept in
.sca-editor/requests.json; one interrupted by a restart is marked failed.
Checked: tsc and vitest (364 passed); pytest test_editor_features.py, test_editor_agent_requests.py and test_editor.py: 157
passed, 3 failed, the same 3 that fail without this series (starlette's test client needs httpx2, not installed here).
Requests run against the real editor and agent during the sessions above.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y to a coding agent DECISION: keep the design of "Ask AI" (the commit "feat(editor): leave the AI a request on picked geometry; a headless coding agent does it, in one undo step") as a record: why the agent runs at once, what it may touch, how its edits become one undo step, and what is open. WHY: the decision outlives one commit (the panel, the server, the CLI and the history all follow it) and its reasons, the prototypes and the rejected option are not visible in the diff; AGENT.md asks for a record in design-docs/. WHAT CHANGES: design-docs/editor-ask-ai.md (new; design-docs/ is git-ignored, added with -f). Checked: the record matches the code of that commit (allowed tools, environment variables, file of requests). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DECISION: _call imports os locally, like the other functions of editor/cli.py, and a test runs the real _call with and without SCA_AGENT_REQUEST. WHY (found on 2026-11-29 while reproducing an issue for the user with `sca cell open`): the commit "feat(editor): leave the AI a request on picked geometry; a headless coding agent does it, in one undo step" made _call read os.environ["SCA_AGENT_REQUEST"], but this module imports os inside each function and _call had no import, so every `sca cell` and `sca feature` command failed with a NameError, including the agent's own. The tests of that commit ran a stand-in agent and never the real `sca` call, so they did not see it. WHAT CHANGES: src/simplecadapi/editor/cli.py (one import), test/test_editor_agent_requests.py (test_sca_sends_the_request_id_of_the_agent_that_runs_it_and_nothing_without_one; it fails with the NameError without the import). Checked: pytest test/test_editor_agent_requests.py: 14 passed; the new test fails without the import. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Chinese on the page
The library carries no Chinese (test_library_is_english). The stages, the steps and the reasons the editor gives are
English with {{name}} slots ({"text", "vars"}), and the page translates them through the locale table like every other
message. A request keeps `counts` per kind so the page names what was picked in the person's words; `targets` and
`summary` stay readable English for other readers. The prompt asks the agent for `# name:` / `# note:` lines (Chinese
text after them), which the feature tree reads as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d notebook DECISION: the run of the coding agent (AgentRequests._run and its helpers): - reads the agent's stream as UTF-8 (errors replaced) whatever the system's code page; - knows a timeout by the timer's own flag, not by a negative return code; - writes sca.cmd beside the sca shim on Windows, so the agent's shell finds sca; - drops the undo step quietly when the notebook was closed meanwhile (state.notebook None was a TypeError); - keeps stderr's temporary file in a with block, so a failure while reading stdout does not leak it; - splits SCA_AGENT_CMD with shlex, so a quoted path may hold spaces. WHY: review of PhySpace#104 by NiJingzhe, points 1 to 3 and the first nit. On Windows the default code page (GBK/CP936) fails on the Chinese of the stream; a killed process returns 1 there, so a timeout read as an ordinary failure; and cmd/PowerShell do not run a #! script. Checked: test_editor_agent_requests.py (18 passed): new tests for a closed notebook, a timeout (TIMEOUT_S 0.5 s), a UTF-8 stream under a Latin-1 locale, and a quoted command with a space. The Windows shim is not run here (macOS). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…le (2 条边线) DECISION: "1 face, 2 edges" are English keys with a count, translated like every other word of the page; Chinese says 边线 for an edge, as the rest of the UI does since the SolidWorks wording. WHY: the counts were Chinese written into the code (an English page showed 个面), and said 条边 where the UI says 边线 (review of PhySpace#104 by NiJingzhe, second nit). Checked: tsc and vitest in editor-web (364 passed; describeTargets in Chinese and in English). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hbour that is left, and say when its place is not certain DECISION: a created or deleted step remembers all the cells before and after it, not one neighbour. Bringing it back puts it next to the nearest of them that still exists (before or after it). When the survivors around it are no longer next to each other, the cell still goes next to the nearest one, and the result lists it as "unsure"; the feature tree then says "«X» came back, but maybe not in its old place: check the order of the steps". A cell is never silently put at the end. WHY (discussion with the user, 2026-11-29, about issue 16 "a step runs to the end"): reproduced with the code before the commit "fix(editor): redo keeps a cell's id after an undo renamed it": undoing and redoing "add box" put the box after the selection cell, because its one remembered neighbour (the params cell, brought back under a new id) was not found and _apply fell back to "end" without a word. That commit fixed the id, but the fallback stayed: whenever the neighbour is really gone (deleted in the code or by the agent meanwhile), the step still lands at the end, and the feature tree's order changes with nobody told. The user asked to remove that too. ALTERNATIVE CONSIDERED AND REJECTED: refusing the undo when the neighbour is gone (the person loses the step they want back, for a place that can almost always be found from the other neighbours). WHAT CHANGES: gui_features.py (neighbours() and place(); steps carry "prev" and "next", _rename follows them; undo and redo return "unsure"), features.ts (CommandResult.unsure), App.tsx and FeatureTree.tsx (the note, with a close button; cleared by the next command), Chinese strings, and two tests in test_editor_features.py (the rule on its own, and against the real editor: a plain undo, a cell written in the old place meanwhile, the old neighbour gone; the last case fails on the code before this commit, the step goes to the end). Checked: pytest test_editor_features.py and test_editor_agent_requests.py: 80 passed; tsc and vitest in editor-web: 364 passed. In the running editor: deleted a sphere between a box and a cylinder, wrote a code cell in its place, pressed undo: the sphere came back between them and the note appeared above the tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…heir buttons below, in plain words
DECISION: the notes above the feature tree (which shape is the part, the part built from an older step, a step brought back
where its place is not certain) are blocks: the sentence on its own lines across the panel, the buttons in a row under it.
The "choose the part" note says it in a person's words and tells how to make one piece instead.
WHY (the user, 2026-11-29, with a screenshot: "这里很乱啊"): with the sentence and the buttons side by side, the narrow
left panel squeezed the sentence into a column of two or three characters per line, and a button wrapped onto a line of
its own. The words were also the program's ("有 3 个开放实体,而一个零件只能有一个实体"): "开放实体" means nothing to a
person, and the note did not say what to do if all of them belong to the part (join them).
WHAT CHANGES: FeatureTree.tsx (layout of the three notes), Chinese strings (new wording; the old key of the "choose the part"
note is replaced by a new one with plain English, "use «X»" reads 用「X」).
Checked: tsc and vitest in editor-web (364 passed). In the running editor with three separate shapes and a step brought
back: the notes read top to bottom, the buttons wrap in rows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ces it left on the model DECISION: hovering over a step in the feature tree, or clicking it (it stays until clicked again or the empty list is clicked), lights up in blue the faces of the finished model that this step made. The faces are found by their tags: the editor's features name their faces `<step>.<role>` (box.top, cylinder.side) and the names survive later cuts and joins. A step that left no such faces (a fillet, a step written as code) says so under its row. It is only a highlight: the selection the AI is given does not change. Switching to another notebook clears what the tree showed and said (the note of the commit "undo and redo bring a cell back next to its nearest neighbour…" stayed on screen after a switch). WHY (issue 19 of the user's list, found in practice on 2026-11-28; worked on 2026-11-29): only sketch rows reacted to a click; clicking 拉伸 or 圆角 did nothing. In SolidWorks, clicking any feature shows its geometry on the model, and the user expected "click a step to see what it did". Checked first: the live model the page draws is a preview with no tags (its entity data is made up in the page, brep-renderer.ts), while the kernel's preview scene has every face's tags (the hole's wall of a box cut by a cylinder carries cylinder.side), so the page asks the server. ALTERNATIVES CONSIDERED AND REJECTED: lighting up the whole body a step makes (only the last step's body is on screen, so every earlier step would light up nothing or everything); selecting the faces (it would rewrite the selection cell and what the AI sees on every hover). WHAT CHANGES: runtime/live.py (is_feature_tag, scene_feature_faces, preview_feature_faces), editor/kernel.py (feature_faces), editor/server.py (GET /api/features/faces?slug=), lib/feature-faces.ts (new, with a test), App.tsx (asks once per step and model, marks the faces), FeatureTree.tsx (hover, click, the note), Chinese strings, two tests in test_editor_features.py. Checked: pytest test_editor_features.py, test_editor_agent_requests.py and test_editor.py with PYTHONPATH set to the absolute src path (a relative one makes the kernel the tests start import the installed package instead): 163 passed, the 3 known failures (httpx2 not installed); tsc and vitest in editor-web: 366 passed. In the running editor: box with a cylinder cut, clicking 圆柱 lit the hole's wall, clicking 方块 its six faces and not the wall; a step written as code showed the note; a click on the empty list cleared it. Not checked: hover in the browser (the test browser's hover did not reach the row). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DECISION: a step's second line stays one line in the list (cut short with "…"), and the step clicked (or the sketch picked) shows it whole, wrapped, with what it builds on under it. WHY (the user, 2026-11-29, with a screenshot of the row "法兰 = 圆盘 + 中间…": "这里点了就不展开了,什么情况"): the commit "editor: a step's second line says what it does…" made the line a sentence from the code's comment, which rarely fits the panel; the whole sentence was only in a hover tooltip, and clicking the row, the natural way to ask for more, changed nothing in the text. WHAT CHANGES: FeatureTree.tsx (the second line of a pinned step or a picked sketch wraps; its buttons align to the top). Checked: tsc and vitest in editor-web (369 passed). In the running editor: clicking 「flange」 opened "法兰 = 圆盘 + 中间凸台,再打中心通孔和一圈均布螺栓孔。…" over four lines with "新建一个形状" under it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ep keeps its text, and an answer belongs to its own step
DECISION: in the feature tree, the pointer on a row lights up that step on the model and tints the row, nothing more; the
text of the rows changes on a click alone: the clicked step opens (its whole description, what it builds on, and the note
about what is lit up for it) and stays open while the pointer moves over other rows. The server's answers are kept per
step, so a row never shows another step's answer.
WHY (the user, 2026-11-29, with two screenshots: "放在上面的时候 2 会自动展开,但是 1 不会,然后如果点 2 了再划到 1 会一闪而过
1 的详细内容"): the note followed the step being shown (the one under the pointer, else the clicked one) while the text
followed the click, so moving the pointer made notes appear and vanish and rows change height under it. The flash came
from one shared answer: for the first render after the pointer moved, the new row was shown with the previous row's answer
("no new faces, the whole part is lit up") until its own arrived.
WHAT CHANGES: App.tsx (answers in a map by cell, asked for the clicked and the hovered step; the model shows the hovered
step, else the clicked one; the tree's note is about the clicked step), FeatureTree.tsx (the note under the clicked row only).
Checked: tsc and vitest in editor-web (369 passed). In the running editor on the user's flange notebook: with
「flange_scale」 clicked and the pointer moved onto 「flange」, both rows' text sampled at 0, 30, 80, 200 and 600 ms did not
change; the model showed the flange's faces and the clicked row stayed open with its bar greyed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ce, or opens it in code mode DECISION: a step written as code (by the AI or by hand) gets a working pencil: when its params cell has numbers, they open in the same in-place panel as a feature made with the buttons (every change rebuilds at once, Enter keeps them in the code, Esc takes them back), titled by the step's name (# 名称:…) or "数值"; the panel's other button reads "在代码里改" and switches to code mode. A step with no numbers to tune switches to code mode at once, and the log says why. WHY (issues 10 and 29 of the user's list: the AI's steps were second-class in the feature tree, their pencil grey, while in the way of working "the person points, the AI does it" the AI's steps are the ones most often changed afterwards; the user confirmed on 2026-11-29 "10/29 确实要改"; their names and notes were done before). The numbers of such a step are its params cell's sliders (featureParams by the cell's group), which the in-place session already knows how to tune and keep. ALTERNATIVE CONSIDERED AND REJECTED: a form built from the code's calls (the code is free-form; only its declared numbers are safe to change without the agent). WHAT CHANGES: App.tsx (editCodeStep; the panel's more button for such a step), FeatureTree.tsx (onEditCode, the pencil's words), OperationPanel.tsx (moreLabel), Chinese strings. Checked: tsc and vitest in editor-web (377 passed). In the running editor on the user's flange (written by the agent): the pencil opened "数值 · flange" with its eight numbers in Chinese; 法兰盘外径 changed and kept was written into the notebook (then set back to 120). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The library carries no Chinese (test_library_is_english). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…00 ms) DECISION: the faces of a hovered step are asked of the server only after the pointer has stayed on its row for 100 ms; a clicked step is asked at once, as before. WHY: each ask runs code in the kernel; sweeping the pointer down a long feature tree queued one call per row passed over (review of PhySpace#105 by NiJingzhe, an optional suggestion). Checked: tsc in editor-web. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ept horizontal and vertical) DECISION: the sketch has a rectangle tool (key G): click one corner and the opposite corner, or type width and height; it adds four lines in a closed chain, each constrained horizontal or vertical whatever the auto-constraint setting says, and a far corner snapped onto an existing point joins that point. WHY (the user's first sketch lesson, 2026-11-28): drawing a plate took four lines and four constraints, and every CAD program the user compares with (SolidWorks videos) starts a sketch with a rectangle. The constraints are forced because they are what keeps it a rectangle when the solver moves a corner. WHAT CHANGES: lib/sketch.ts (addRectangle), useSketchEditor.ts, sketch-typed.ts (width/height fields), sketch-ui.ts, SketchOverlay.tsx (preview), the i18n test's list of typed fields, Chinese strings, three tests in sketch.test.ts. Checked: tsc and vitest on this commit (334 passed); drawn in the running editor, including the snapped far corner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m the face, so the sketch follows the face DECISION: "Sketch on this face" first adds a workplane on the picked face (method "face", the same cell the Workplane command writes, which names the face by reference), then opens the sketch on that workplane, so its cell writes plane=<workplane> and the sketch moves with the face when the body changes. Before, it opened the sketch on a frame of numbers (the face's position at that moment), which stays put. WHY (issue 14 of the user's list, met in practice on 2026-11-28: the box moved 44 mm left, the hole sketched on its top face stayed behind and the cut failed with "the two solids do not touch, 12 mm apart"; the user asked on 2026-11-29 "现在 不是跟着面走的吗?"): checked in the code, the editor had two ways onto a face and only one followed it. A sketch on a workplane follows it (sketch_doc.validate_plane), and a workplane from a face follows the face; "Sketch on this face" took the face's frame from resolveFace and handed it to the sketch as numbers. In SolidWorks a sketch on a face follows the face. ALTERNATIVE CONSIDERED AND REJECTED: a sketch plane that names the face itself, without a workplane step (a new kind of plane for the sketch format, the SDK and the solver; the workplane already does this and shows in the tree as 基准面). WHAT CHANGES: App.tsx (sketchOnSelectedFace adds the workplane, waits for the kernel's frame of it, opens the sketch on it; it falls back to the face's frame tagged with the workplane when the frame is late), a test in test_editor_workplanes.py (the workplane-and-sketch cells run on a body moved 44 mm and made taller: the sketch is on its top face, 44 mm along). Kept: a sketch cancelled after this leaves the workplane step (undo removes it). Checked: pytest test_editor_workplanes.py (8 passed); tsc and vitest in editor-web (369 passed). In the running editor: a box, its top face picked, "在此面上画草图", a circle, 完成: the file has `wp = scad.make_workplane_from_face_rworkplane(...)` and `make_sketch_rsketch(name="sketch", plane=wp)`; the box then moved to x 24..64 and made 18 mm tall, the sketch's bounds were x 44..54 at z 18 (they had been x 0..10 at z 10). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DECISION: the Chinese words of the sketch tools say what the tool does and nothing else: "(SDK trim_rsketch)" and the like
are dropped from seven tooltips, and two messages that said "SDK" say what happens ("剪到两边相邻的图元为止", "正在计算…").
The English source strings keep the function names: they are the table's keys and tell a developer which call is made.
WHY (issue 13 of the user's list; shown to the user on 2026-11-29 in the running editor, the trim tooltip reads
"修剪:把图元剪到相邻图元处(SDK trim_rsketch)"; the user's rule for the editor: everything a person reads is plain
Chinese): a function name is noise to a person and is in English in the middle of Chinese.
WHAT CHANGES: editor-web/src/i18n/locales/zh-CN.json, nine values (no key added or removed).
Checked: vitest run src/i18n (3 passed); no Chinese value names an SDK function any more (searched).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DECISION: a constraint button that does not apply to the selection stays grey and says, on hover, what it needs ("中点:先选
1 个点和 1 条线(按住 Shift 点击可以多选)"); it is no longer a disabled button (a disabled one shows no tooltip in every
browser), it only ignores the click.
WHY (issue 22 of the user's list, shown to the user on 2026-11-29: with a line picked every button but 水平 and 竖直 is grey and
the tooltip only repeats its name, "中点"; the user had asked during the first sketch lesson which constraint "中点" needs):
the rules were in applicableConstraints and nowhere a person could read them.
WHAT CHANGES: lib/sketch.ts (CONSTRAINT_NEEDS, the rules of applicableConstraints in words), SketchToolbar.tsx, Chinese strings,
the i18n test (the words have Chinese entries).
Checked: tsc and vitest in editor-web. In the running editor with a rectangle sketch, the grey buttons' titles read
"水平:先选 1 条线(按住 Shift 点击可以多选)", "水平对齐:先选 2 个点…".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n the canvas and in the panels
DECISION: a sketch's profile is described by shapes, not loop numbers: "外轮廓:矩形;孔:2 个圆" in the sketch drawer, the
extrude panel and the inspector, and with several loops a label on the canvas under the outline's top edge ("外轮廓:矩形") and
under each hole ("孔:圆"). A loop's shape is told from its entities: circle, triangle, rectangle (four lines with square
corners), quadrilateral, polygon with n sides, slot, closed curve, or an outline of n pieces.
WHY (issue 26 of the user's list, met in the first sketch lesson on 2026-11-28: "外轮廓 0" was explained wrongly, and a number
says nothing about which shape it is and changes when another loop is drawn; the user confirmed on 2026-11-29 "26 确实要改").
WHAT CHANGES: lib/sketch.ts (loopShape; Loop.shape), lib/sketch-scene.ts (SketchShape.loops, shapeWord, profileSummary by
shapes), FeatureDialog.tsx, SketchDrawer.tsx, SketchOverlay.tsx (labels), Chinese strings, tests (the shape of a loop, the
summary; the old summary test described the numbers and is replaced).
Checked: tsc and vitest in editor-web (the new tests among them). In the running editor: a rectangle with a circle in it,
Shift+click in the circle: the canvas read 外轮廓:矩形 and 孔:圆; the first placement of the label (the loop's centre) sat on
the circle's centre point and was moved under the top edge.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nges the outline says so
DECISION: in the sketch's select tool, a click just beside a point (within twice the pick distance) inside a loop with room
around the point is a missed pick ("差一点没点中那个点") instead of choosing that loop; any click that changes the outline or the
holes says what changed, in shapes ("外轮廓换成了「圆」,拉伸时会做成这个形状…点一下原来那个形状里面就能换回来"); clicking back
into the old outline brings back its holes too.
WHY (issue 25 of the user's list, shown to the user on 2026-11-29: in a rectangle with a circle, a click about 20 px beside the
circle's centre point moved the filled outline from the rectangle to the circle with no word, so "finish and extrude" would
make a small cylinder instead of a plate with a hole). A small loop (a hole a few millimetres across) has no room: every click
in it is near its centre, so there it still chooses the loop, and the note is what keeps the change from going unnoticed.
WHAT CHANGES: lib/useSketchEditor.ts (the near miss, the notes, the choice before the last outline change), Chinese strings.
Checked: tsc and vitest in editor-web. In the running editor: Shift+click in the circle made it a hole with the note; a plain
click in it switched the outline with the note; a click back in the rectangle restored the outline and the hole (the first try
lost the hole, which is why the previous choice is kept).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Height 2"), not "length l0"
DECISION: the slider of a sketch dimension is labelled by what it measures: the length of a horizontal line is "Width", of a
vertical one "Height", of another line "Length"; then "Radius", "Diameter", "Distance", "Horizontal distance", "Vertical
distance", "Distance between lines", "Angle"; repeated names are numbered ("Width 2"). The variable keeps its name, and the
parameter's comment keeps which entities it constrains ("Width: length l0"), for an agent. The Chinese UI shows 宽度, 高度 2 ….
WHY (issue 6 of the user's list: the sliders read "length l0", "length l1", and nobody knows which side l0 is; confirmed on
2026-11-29 "6 确实要改").
WHAT CHANGES: editor/sketch_doc.py (dimension_word; render's label and comment), lib/plain-label.ts (a numbered label is
translated as its word and number), Chinese strings, tests (test_editor_workplanes.py, plain-label.test.ts). Notebooks written
before keep their labels until the sketch is saved again.
Checked: pytest test_editor_workplanes.py and test_editor_features.py (76 passed); tsc and vitest in editor-web. In the running
editor, a 40 x 20 rectangle sketch added through `sca feature add` wrote label="Width" and label="Height"; the code panel's
sliders read 宽度 and 高度 (in a narrow panel the labels are squeezed out by the number boxes, as before).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…outline matches the body built from it DECISION: the sketches drawn in the viewport (and described in the inspector) take each driving dimension's current slider value, matched by the name the params cell gives it (sketch_doc.render: <SLUG>_<KIND>_<TARGETS>), including a value tried in the editor and not yet written into the code. The sketch's own document is not changed: editing the sketch still starts from the code. WHY (issue 27 of the user's list, shown to the user on 2026-11-29: a 40 x 20 rectangle extruded, its width slider moved to 70: the plate was 70 long while the orange outline of the selected sketch, and the inspector's size, still said 40). The body is built from the slider's value (params.json, applied by the runtime), the outline was solved from the numbers in the code. WHAT CHANGES: lib/sketch-scene.ts (withParamValues), App.tsx (the shapes are solved from the sketches as built), tests. Checked: tsc and vitest in editor-web. In the running editor with the width tried at 70: the selected sketch's inspector size read "70.0 x 20.0 mm" and the outline ran along the plate's edges. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DECISION: "Sketch on this face" remembers the workplane it added for the sketch; cancelling the sketch (its cancel button, Esc, or leaving the plane chooser) deletes that workplane's step, and the log says so. Finishing the sketch keeps it. WHY: the workplane stayed in the feature tree for a sketch that was never drawn, and the person had to find and undo it (review of PhySpace#106 by NiJingzhe, a UX note). The removal is one step of the history, so undo brings it back. Checked: tsc and vitest in editor-web (377 passed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and what to do
DECISION: requests to /api/ go through one watch; one that cannot reach the service (the request fails, or the dev proxy
answers 502/503/504 without JSON) is answered with {ok: false, error} in the person's words, so every place that shows the
server's error shows "编辑器后台没有响应,这次修改没有保存…"; and while the service stays unreachable (also when the live
socket stays closed) for more than 1.5 s, a banner at the top says it has disconnected, that changes and an unfinished sketch
cannot be saved, and to start it again (sca edit), after which the page reconnects by itself. It goes away when the service
answers again.
WHY (issue 23 of the user's list, shown to the user on 2026-11-29: with the service stopped, finishing a sketch showed only
"Internal Server Error" in red, half under the toolbar). Checked first: the dev server's proxy answers 502 with an empty text
body when the service is down; without the proxy the request itself fails. The 1.5 s wait keeps the banner from flashing
during a restart the socket rides out.
WHAT CHANGES: lib/backend-link.ts (new: the watch, the state, useBackendDown; with tests), main.tsx (installs it),
lib/envelope.ts (the socket reports open and close), App.tsx (the banner), Chinese strings.
Checked: tsc and vitest in editor-web. In the running editor: the service stopped, the banner appeared; started again, it was
gone at the next look.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he top, with "write them into the code" and "back"
DECISION: while any parameter has a value tried in the editor and not written into the notebook (the editor keeps it beside
the notebook, in params.json), the top of the left panel, in both modes, says which ("宽度 70 mm(代码里是 40 mm)"), that the
file itself, a run from the command line and anyone it is sent to still use the code's numbers, and offers 写进代码 and
改回代码里的数. It is not shown while an operation is being tuned (Enter writes its numbers then anyway).
WHY (issue 15 of the user's list: the same file failed in the editor and ran in the command line, because a slider's value
lived only in params.json; shown to the user on 2026-11-29, where the code still said default=40.0 under a slider at 70; the
only way out was a small "write to source" link in the code panel). Trying numbers without touching the code is the design
and is kept; what was missing was saying so where a person looks.
ALTERNATIVE CONSIDERED AND REJECTED: writing every slider change into the code at once (it would undo the design of trying
values freely, and rewrite the file on every drag).
WHAT CHANGES: components/UnsavedParams.tsx (new), App.tsx (shown above the tabs of the left panel), Chinese strings.
Checked: tsc and vitest in editor-web. In the running editor: the width tried at 70 showed the note in code and manual mode;
写进代码 wrote default=70.0 into the notebook and the note went away.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e before it DECISION: "keep" (param.commit: Enter in the operation panel, 写进代码, write to source) first waits until the slider batches still on their way are applied to params.json (at most ten seconds), then writes; the rebuild loop wakes it when it finishes. WHY (found on 2026-11-29 while checking the pencil on a step written as code: 法兰盘外径 typed as 120 and Enter at once left the code at 130, and the new note at the top said "120 mm(代码里是 130 mm)"): param.set is coalesced into a rebuild loop that saves the values when it runs, while param.commit read params.json at once; a value typed and kept within the same moment was not in the file yet. Pressing Enter right after typing a number is the normal way to keep it. WHAT CHANGES: editor/server.py (_commit waits on _rebuild_cond; _rebuild_loop notifies when it ends), a test in test_editor_features.py (a value enqueued and kept at once is the one written; it fails without the wait). Checked: pytest test_editor_features.py, test_editor_agent_requests.py and test_editor_workplanes.py (92 passed). In the running editor, a number typed and Enter 50 ms later was written (125, then 120 again). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the editor keeps it
DECISION: the GUI history (undo and redo) is written to history.json in the notebook's state directory (beside params.json)
whenever it changes, with the notebook's cells (id and code) of that moment, and read back when the notebook is opened again,
if the cells are still the same code in the same order (the selection cell aside); otherwise it starts empty rather than offer
an undo that fails. Because the editor gives cells new ids whenever it reads a notebook again, the history's ids follow the
cells place by place whenever the code is unchanged and the ids are not (_follow_ids), at load and during a session.
WHY (issue 20 of the user's list: "撤销/重做不像 Word:编辑器重启后历史就清空了"; confirmed on 2026-11-29 "20 也要改"). Found
while building it, each one in a run against the real editor: the cells' ids are not stable across a read of the file (a
restart gave Hbol, MJUe … for cells that were RriG, wRAc); a notebook just opened lists no cells (or the last notebook's) for a
moment, so the read is retried until they fit; the editor reads the notebook once more after opening it, so a one-time mapping
of ids went stale ("the cell is gone"); every pick rewrites the selection cell, which no history has.
WHAT CHANGES: editor/gui_features.py (_history_file, _load, _save, _follow_ids, _cells_now; _sync reads the kept history;
_record, undo, redo and follow save it), a test in test_editor_features.py (an editor started again undoes and redoes the box
added before; a notebook changed outside since starts a new history). Still not in the history: edits made in the code itself.
Checked: pytest test_editor_features.py, test_editor_agent_requests.py, test_editor_workplanes.py and test_editor.py: 174
passed, the 3 known failures (httpx2). In the running editor: a sphere added, the service restarted, the notebook opened again:
undo 1, undo removed the sphere, redo brought it back.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t they did DECISION: the feature history says what each entry did (gui_features.describe_steps: features added, removed or changed, or only a params cell's numbers, by slug and written name), and the editor says it: the undo and redo buttons' titles read "撤销:添加「球体」(Ctrl/Cmd+Z)", a line under them reads "下一次撤销:添加「球体」", and after an undo or redo the line and the log say "已撤销:添加「球体」" for a few seconds. The sketch's own undo says that it takes back only the sketch's last edit, and that the whole sketch is undone in the feature tree after 完成. The two histories stay two, as in SolidWorks. WHY (issue 11 of the user's list: "撤销分成两套:草图里一套,特征一套,按 Ctrl+Z 时不确定会撤掉什么"; on 2026-11-29 the user chose "先说清撤什么" over merging the two histories, which would rework the sketch editor's and the server's history). ALTERNATIVE CONSIDERED AND REJECTED: one history for sketch edits and features (asked and set aside by the user for now). WHAT CHANGES: editor/gui_features.py (describe_steps; undo_label and redo_label in the snapshot), lib/features.ts (HistoryLabel), lib/history-words.ts (new: the words), FeatureTree.tsx (UndoRedo titles, the line under it), App.tsx (the note after an undo or redo), Chinese strings, a test in test_editor_features.py. Checked: pytest test_editor_features.py and test_editor.py (154 passed, now that httpx is installed in the dev environment); tsc and vitest in editor-web (377 passed). In the running editor with a box and a sphere: the line read 下一次撤销:添加「球体」; after 撤销 it read 已撤销:添加「球体」 · 下一次撤销:添加「方块」, and the redo button's title 重做:添加「球体」. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The library carries no Chinese (test_library_is_english). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eletes the saved undo history DECISION: FeatureService.follow() reads the history kept beside the notebook (_sync) before it changes and saves it; _save() deletes history.json only for a history this run read or made (an empty one never read leaves the file alone), and after writing it takes the cells it wrote as the ones a reload is compared with (_seen). WHY: after a restart nothing had read history.json yet; a slider's number kept into the code went through follow(), which saved the empty in-memory history and so deleted the file (review of PhySpace#107 by NiJingzhe, point 1; the _seen update is his point 2). Checked: test_editor_features.py, new test_a_number_kept_first_thing_after_a_restart_keeps_the_saved_history (fails without the fix, passes with it), and the other history tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DECISION: a message the editor's server shows a person (a refused request, a status error, notice or "working…" line, a
feature command's error) is sent as the plain English as before and, next to it, as `said`: English with {{name}}
slots and their values (editor/words.py: words, spoken, said_status, refusal). The page translates `said` through its
locale table and fills the slots (lib/words.ts: saidIn, refusedMessage, Refusal); a sentence the table lacks shows in
English with its slots filled, as before. GuiError takes the same slots and keeps its words. About fifty sentences a
person can meet got Chinese, reworded for a person (the "kernel" is the background service, a notebook a part or a file).
A feature command's error keeps its English (Refusal.plain) so the curated undo/redo sentences in plain-label still match.
WHY: deleting the only part showed "rounded_block.py is the only notebook of the workspace: create another before
deleting it" in English on the Chinese page (the user, 2026-12-01). Every server message went to the page untranslated:
the library's source must stay English (test_library_is_english), and the page only translated the strings it wrote
itself. The Ask AI panel already worked this way (agent_requests.words), so the helpers moved to editor/words.py.
ALTERNATIVE CONSIDERED AND REJECTED: matching the English on the page with patterns (plain-label does this for two
sentences): every reworded server message would silently break its pattern.
NOT CHANGED: errors that only an agent or the CLI meets (sca cell's, malformed requests) and the kernel's own messages
(a Python traceback) stay English; the validation messages of features.py, sketch_doc.py and assembly_doc.py are a
next step.
WHAT CHANGES: editor/words.py (new), server.py (status messages and refusals a person meets), gui_features.py (GuiError
with slots), agent_requests.py (uses words.py); lib/words.ts (new), the request functions of api.ts, assembly.ts,
features.ts, sketch.ts, sketch-scene.ts, sketch-edit.ts, the status handler of App.tsx, plain-label.ts and useFeatures.ts
(a Refusal), Chinese strings; test_editor_words.py and words.test.ts (new), the delete test of test_editor.py.
Checked: pytest test_editor_words.py, test_editor.py, test_editor_features.py, test_editor_agent_requests.py,
test_editor_workplanes.py, test_editor_assembly.py, test_sketch_fillet_project.py and test_library_is_english.py (218
passed; run on the same files over the master-based copy, since this checkout's native module predates dev's C++);
tsc and vitest in editor-web (383 passed). In the running editor, deleting the only part now reads "rounded_block.py
是这个项目里唯一的零件,先新建一个才能删除它".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ook, 单元 and 工作区
DECISION: the Chinese words of the manual mode name what a person sees, not how the editor stores it:
- notebook → 零件 / 零件文件 / 文件 (by what the sentence is about), 单元 → 步骤 in the log ("已重新计算 3 步") and
代码块 / 这段代码 in code mode, kernel → 后台;
- the manual mode's left tab 工作区 is 文件 (en: "files"), its list 零件和装配体, the kind badge 零件 / 装配体 / 共用代码
instead of PART / ASSEMBLY, and "uses …" is translated;
- the selection hint of the manual mode no longer says the pick is written to the notebook as selected_item (that is the
agent's business; the agent-first build keeps the sentence);
- a step's status dot says 已运行 / 正在运行 / 等待运行 / 运行失败 / 还没运行 instead of the raw state ("idle");
- the delete confirmation of a file is translated, and its tooltip names the trash as 回收文件夹, not .sca-editor/trash.
WHY: the user found English and code words left on the Chinese page (2026-12-01: "这里还有一些英文没有统一", and asked
what 特征 and 工作区 mean). The editor's manual mode is for people new to CAD (plain Chinese, no jargon).
NOT CHANGED: the code mode's tabs (notebook, 工作区), the English UI, and the keys of the table.
WHAT CHANGES: Chinese strings (57 rewritten, a few new), App.tsx (the files tab of the manual mode), NotebookList.tsx
(kind badge, "uses", delete confirmation), FeatureTree.tsx (statusWord), Inspector.tsx (the manual-mode hint).
Checked: tsc and vitest in editor-web (383 passed). In the running editor: the tabs read 特征 / 装配 / 文件, the list
零件和装配体 with a 零件 badge, the log 已重新计算 1 步, and a scan of the page's visible text and tooltips found no English
left but file names and Ctrl+K.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DECISION: the floating selection card over the viewport starts folded (a small 检查器 button) when the person has not chosen otherwise in this browser. The first pick opens it; clearing that pick folds it again. Opening or closing it by hand is remembered as before, and a pick no longer closes a card the person opened. WHY: with nothing picked the card only says how to pick, and it covered the model's top right corner (the user's list of 2026-12-01). On the aiad site every person starts with a fresh browser, so they all saw it. WHAT CHANGES: FloatingPanels.tsx (useRemembered takes the initial state; the inspector follows the first pick). Checked: tsc and vitest in editor-web (383 passed). In the running editor with the remembered choice cleared: the card was folded; picking the top face opened it with the face's area and size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DECISION: two cases where the editor did not follow a notebook it had not opened itself: - an editor started on an empty workspace now opens the first SimpleCAD notebook that appears in it (an agent's `sca new`), as if the person had clicked it (WorkspaceState._open_first_of, from the workspace watch); - when a notebook opens while the manual mode's left column shows the file list, it switches to the notebook's steps (code mode: its cells). This holds for every open: a click in the list, `sca cell open`, the case above. WHY: on the aiad site the editor opens beside the agent's messages before the agent has made anything. The part the agent then made was listed but not opened (the header said 未打开 notebook), and once the agent opened it, the left column still showed the file list, so the steps the agent talked about were not on screen (the user's demo of 2026-12-01, playground/learn/editor-sync-issues.md 2.1). Creating a notebook from the page already switched to its steps. ALTERNATIVE CONSIDERED AND REJECTED: have `sca new` open the notebook through the editor: it would switch the person's open notebook away under them whenever an agent adds a part; opening only when nothing is open does not. WHAT CHANGES: editor/server.py (_watch_workspace, _open_first_of), App.tsx (the `opening` handler). Checked: pytest of the editor tests (200 passed; master-based copy, as in "editor: what the server tells a person is translated on the page"); tsc and vitest in editor-web. In the running editor on an empty workspace: `sca new rounded_block` opened the part by itself and the left column showed 特征. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tree says what waits
DECISION: after `sca cell put/insert --no-run` the editor no longer settles (rebuilds and publishes the model): the page
keeps the last model, and the feature tree says "有 N 步写好了还没运行,模型显示的是上一次运行的结果". While cells wait, the tree
does not ask which of several shapes is the part, and a waiting step's dot says 改过了,还没运行. The run that follows
settles as before.
WHY: writing a cell without running it drops what the cell made from the kernel; the settle that followed published a
model without it, so the part vanished ("0 个零件", "还没有实体"), and the code analysis, not knowing what the unrun
cells make, counted every name as a solid and asked "现在有 2 个互不相连的形状……哪个是零件?" (the user's demo of
2026-12-01; playground/learn/editor-sync-issues.md 2.2). The skill now asks agents to run each feature
("skill: build one feature at a time while a person watches the editor"); this is for those that do not.
WHAT CHANGES: editor/server.py (cell_command: no settle after a write that does not run), FeatureTree.tsx (the waiting
line, the part question held back, statusWord for "stale"), App.tsx (the count of cells not run), Chinese strings.
Checked: pytest of the editor tests (200 passed, master-based copy); tsc and vitest in editor-web (383 passed). In the
running editor: the numbers cell rewritten with --no-run left the model on screen with the waiting line, live and after a
reload; `sca cell run` then rebuilt it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he page
DECISION: once an agent's `sca cell` write has run (at once, or in the `sca cell run` after `--no-run` writes), the
server sends `agent.changed`: the cells written, then the cells that read a number that changed, and the numbers
(name, label, unit, from, to; WorkspaceState._announce_agent_change). The page then:
- shows a line over the model for 12 s: "AI 刚刚改了:第 1 步「毛坯」、第 2 步「通孔」(圆角半径 2 → 5 mm、孔径 6 → 10 mm)",
also written to the log;
- marks those rows 刚改过 in the feature tree;
- lights the last changed step on the model, as a click on its row does ("feat(editor): pointing at a step in the feature tree lights up the faces
it left on the model" — the agent points instead of the person).
WHY: the agent changed the model and the page said nothing about where: the model changed, the log said "3 个单元重新计算",
and the person had to guess which step the agent's message was about (the user, 2026-12-01: 左边说的话出现在右边;
playground/learn/editor-sync-issues.md 2.4).
ALTERNATIVE CONSIDERED AND REJECTED: the platform passing the agent's progress to the editor: the editor already sees
every cell command, and this works without the aiad site (in a terminal, in Ask AI).
WHAT CHANGES: editor/server.py (pending changes per cell, _announce_agent_change, _read_names), lib/agent-change.ts
(new: the words), App.tsx (the message, the line, the pinned step), FeatureTree.tsx (the 刚改过 mark), Chinese strings;
test_editor_agent_change.py and agent-change.test.ts (new).
Checked: pytest of the editor tests and test_editor_agent_change.py (200 passed, master-based copy); tsc and vitest in
editor-web (386 passed). In the running editor, built by `sca cell insert` step by step: each step appeared with its
line and lit faces (the hole lit after step 2); after `put --no-run` of the numbers and `sca cell run` the line read
"AI 刚刚改了:第 1 步「毛坯」、第 2 步「通孔」(圆角半径 2 → 5 mm、孔径 6 → 10 mm)".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… as an agent's or keep the last model DECISION: WorkspaceState.cell_command takes outside= (True only from POST /api/cell, which sca cell uses). Only such a command is remembered for agent.changed, and only such a write without running skips the settle. WHY: the editor's own feature buttons write through cell_command too (a feature's numbers with run=False, then the feature with run=True): a workplane added by a click was marked 刚改过 as if the AI had made it, and a button command whose last write does not run would not have rebuilt the model. Found trying the cancelled-sketch change of the PhySpace#106 review in the running editor. Checked: in the running editor, "在此面上画草图" added its workplane without the 刚改过 mark; pytest of the editor tests on the master-based side copy (421 passed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lizaixi01
force-pushed
the
feat/editor-8-agent-in-step
branch
from
December 1, 2026 16:12
6a08926 to
4b6feb0
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The editor keeps up with an agent
When an agent builds a part through
scawhile a person watches the editor (on the aiad site the editor sits beside the agent's messages), the editor did not follow: the new part was listed but not opened, the left column showed the file list, a cell written with--no-runmade the model vanish and the tree ask "which of these 2 shapes is the part?", and a change showed up on the model with no word about where. Now:sca new); whenever a notebook opens while the file list is shown, the left column switches to its steps.sca cell put/insert --no-runthe editor does not rebuild the model (the cell's old values are gone from the kernel, so the rebuilt model lacked them); the tree says "有 N 步写好了还没运行,模型显示的是上一次运行的结果", and does not ask which shape is the part meanwhile. The run that follows rebuilds as before.agent.changed(the cells written, the cells reading a number that changed, and the numbers from → to). The page shows a line over the model for 12 s, e.g. "AI 刚刚改了:第 1 步「毛坯」、第 2 步「通孔」(圆角半径 2 → 5 mm、孔径 6 → 10 mm)", marks those rows 刚改过, and lights the last changed step on the model as a click on its row does (part 4).The skill side (build one feature at a time, no
--no-runbatches) is its own PR, #109.Server-side changes an agent may notice: a write with
--no-runno longer republishes the model until a run; the newagent.changedmessage on the page's socket.Commits of this part: from
editor: a part made or opened by someone else is shown with its stepstofix(editor): only cell commands from outside the editor are announced as an agent's or keep the last model(4 commits).Part 8 of 8 of the editor's manual-mode work (parts 1–6 are #102–#107, part 7 is #110). The parts build on each other: merge them in order. Until the parts before this one are merged, this PR also shows their commits; the commits that belong to this part are listed above.
Every commit holds one decision and its reasons (AGENT.md). Manual mode stays off in a release;
VITE_MANUAL_MODE=1turns it on for development (part 2).Checked at the tip of this part:
tsc --noEmitandvitest runineditor-web(386 passed);pytest test/test_editor_agent_change.py test/test_editor_words.py test/test_editor.py test/test_editor_features.py test/test_editor_agent_requests.py test/test_editor_workplanes.py test/test_editor_assembly.py test/test_library_is_english.py(200 passed, 5 skipped; on a master-based copy, as in part 7). In the running editor, from an empty workspace, with the commands an agent uses: the part opened by itself on its steps, eachsca cell insertgrew the model with its line and lit faces, and a--no-runchange kept the model and the waiting line untilsca cell run.🤖 Generated with Claude Code