Commit Graph

15 Commits

Author SHA1 Message Date
NiJingzhe 9b3b1ab2cf fix(editor): sca cell finds the editor through proxies and reports what it failed to reach
A container's http_proxy swallowed the health check of a 127.0.0.1 editor url
and the miss was read as "no editor is running" — both the record's url (now
always the loopback) and the check (now a proxy-bypassing opener) are fixed,
and a record whose server does not answer is an error naming the record and
url, not a silent fallthrough. Reading the file as a fallback says so on
stderr. Cell feedback: put/insert/run carry console and the not-healthy
dependents, the swept dependents run, and a failing cell names its upstream
(the failing ancestors first) with marimo's own dependency semantics.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-15 20:02:04 +08:00
NiJingzhe 678cc0f376 fix(editor): a failed publish is told on every run someone asked for, and to a late page
The page's veil lifts on a preview or an error. A publish error was deduped
per identical message with no reset when a new run began, so a repeat of the
same failure (a rerun after the first report) stayed silent: no preview, no
error, and the page waited out its three-minute veil. The dedup is kept for
the parameter burst; discrete runs (page commands, agent cell commands, a
file change, a module reload, a param commit) reset it. A page that connects
after the failure is told the last error at the end of the handshake.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-15 02:06:30 +08:00
NiJingzhe 3d4e789da6 fix(editor): take in edits made to the notebook file; sca cell / sca new
The editor held the open notebook in memory and rewrote the file on each edit, so an
agent's saved change was overwritten and never noticed. The file is now watched and
applied cell by cell (agent's version wins a same-cell conflict), the workspace list
follows new files, and sca cell/new edit through the running editor.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 15:30:40 +08:00
NiJingzhe 5aa9f53468 feat(editor): code completion from the SDK — scad. lists functions, ( writes the required name= parameters, Tab moves between them
- GET /api/sdk: the running package's public API (names, parameters, which are required, summaries)
  from inspect, for scad, scad.ql and scad.std.<module>
- editor-web/src/lib/sdk-complete.ts: member completion (scad., scad.ql., ql., Q.), snippet on accepting
  a function or typing ( after a known name, name= completion inside calls (required first, above
  Python's builtins), Tab accepts a suggestion and then moves between parameters
- the editor wrapper rebuilt its configuration on every render (new onChange / basicSetup each time),
  which drops a snippet in progress; both are stable now
- popup styled to the editor's themes

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-13 23:29:13 +08:00
NiJingzhe a9fc2aa410 feat(editor): log dock with re-evaluation progress; ordered notebook switching
- bottom dock: log of events/errors, progress of the cells being re-evaluated,
  running/queued/blocked on cells; errors leave the header
- opening notebooks is ordered (latest wins), a superseded open ends quietly,
  the list highlights the notebook being opened immediately
- boot waits for the instantiate run before publishing; a failing setup is
  reported as the cause; refreshed pages load an unchanged model; viewport
  redraws after resize

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 17:53:00 +08:00
NiJingzhe 26acbf2192 feat(editor): live preview path — models reach the viewport without building a package
The kernel publishes a SCAPREV1 preview (triangles, edges, vertices, face/edge
groups) straight from the solids; the viewer loads it, and per-entity details
are fetched on demand (entity.info) before a selection cell is written.
Previews are cached per dependency signature for instant revisit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 07:29:53 +08:00
NiJingzhe 3c104da9ca feat(editor): stop button; switching back to a notebook shows it at once
A cell's run button is a stop button while the kernel runs it (so is run-all in
the header); stopping interrupts the kernel and drops the work queued behind it.
The server forwards marimo's live cell states.

The editor remembers each notebook's last published package under a digest of
everything the model depends on (notebook, modules, children, data, saved
values, versions); switching back shows that model and the cells from the file
immediately while the kernel boots, and the kernel's own publish only reloads
the view if the model differs. Revisiting an assembly went from 16.5 s to 0.3 s.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 05:48:39 +08:00
NiJingzhe 058310f2ca fix(editor): stop the bridge interrupting long cells; calmer loading veil
marimo interrupts the kernel when the client of /api/kernel/execute
disconnects. The bridge's scratch calls had client timeouts (the 5 s watchdog
ping: 10 s; the idle probe: 15 s), so any cell that ran longer than that - a
use() of a child notebook - was killed with KeyboardInterrupt and the
product was missing. Scratch calls now wait without a timeout and the
watchdog asks /api/sessions instead.

The loading veil's swell is one long wave and its dots are dimmer.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-11 22:47:29 +08:00
NiJingzhe cb7a5369aa feat(runtime): per-cell cache dependencies, shared with the editor kernel; faster packages
The cell cache is stored under a digest of the files each cell depends on
(modules reached through the names it reads, through the notebook functions it
calls, and through the cells it reads from; child notebooks; inputs) instead
of one digest for the notebook: a changed module recomputes what reads it and
restores the rest, and going back restores everything. The editor kernel runs
cells through the same cache (cells downstream of saved parameter values are
keyed by them; cells that run child notebooks are not cached there).

The render mesh of a face is computed with numpy in the profile's fixed
operation order: identical bytes, package builds about twice as fast.

The editor also watches the data files a notebook lists in 'inputs'.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-11 18:28:45 +08:00
NiJingzhe 8e613b852e fix(editor): show a pick at once; write only the newest selection to the kernel
The kernel runs scratch code one piece at a time, so a selection write queued
behind a long run (publishing a big assembly takes seconds) delayed the cell,
and fast picks piled up one thread each. The server now pushes the selection
cell from memory immediately and coalesces the kernel writes. SCA_EDITOR_TRACE=1
logs the time of every kernel call.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-11 18:01:59 +08:00
NiJingzhe 3dad39999f feat(editor): local modules in the workspace, module view, reload on change
The workspace lists the local modules notebooks import (sca ls reports them
too) and opens one in a module view: autosaved source plus its dataclass
fields (and commented constants) as controls written into the file. A change,
from the editor or on disk, reloads the module in the kernel and reruns the
notebook; used notebooks are rerun from their files. Number boxes keep the
typed text until it is committed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-11 16:30:27 +08:00
NiJingzhe 07f88761a7 feat(editor): copy a cell reference for a coding agent
Each cell header gets a copy button: the reference is the notebook path, the
cell's line range in the file, its number and name; Alt/Shift+click adds the
code. Line ranges come from the saved file, so they follow autosave.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-11 16:11:38 +08:00
NiJingzhe b0909b29ba feat(editor): selection as ql code, agent snapshot, grid and axes, new look
Picking in the viewport writes a selection cell (ql selectors from the picked
geometry, selected_<kind>[_<i>] and selected_item) and saves a snapshot
(.sca-editor/snapshot.json + viewport.png, sca snapshot) for coding agents.
The viewport gets a ground grid and an axis gizmo in a CAD (Z up) frame.
Cells fold to their step name, run everything above, autosave, and are
deleted with a trash button; the inspector shows a JSON tree; the chrome is
black and white with square 2px rules. Opening a notebook clears the model at
once. ql.vertices() now resolves through solids and faces.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-11 06:53:48 +08:00
NiJingzhe 88829b8dba fix(editor): never rewrite notebook files on a plain run; keep returns inside functions
code.edit stripped every line starting with 'return', including those inside
@app.function bodies, and rewrote the file even when the code was unchanged.
Now only the cell's own top-level return is stripped (by AST), unchanged code
just runs, and @app.function cells are not edited through code mode (marimo
would turn them into plain cells).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-11 06:13:44 +08:00
NiJingzhe 64f2cc9c61 feat(editor): sca edit — the web editor, now part of the SDK
The editor moves in from sca-web-editor as simplecadapi.editor (UI sources
in editor-web/, built into the package; 'editor' extra). It no longer
records anything itself: the kernel runs the notebook with the SDK cell
executor, the server asks it for the product (runtime.live.publish_live)
when marimo reports a completed run, and parameters are saved values the
executor applies, so marimo's dataflow reruns what reads them. Controls
come from '# ui:' comments; a workspace is any directory of notebooks.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-11 05:55:50 +08:00