Skip to content

TensorFold Web: a small local web app, and tensorfold web to open it - #1781

Merged
ashhart merged 20 commits into
mainfrom
lead/tensorfold-web
Nov 7, 2026
Merged

ashhart merged 20 commits into
mainfrom
lead/tensorfold-web

Conversation

@ashhart

@ashhart ashhart commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

TensorFold Web is a small local web app: pick a model that fits, run it, watch it, chat, and connect your tools. It lives in web/, and the CLI gets tensorfold web:

  • If tensorfold-web is installed, the command runs it.
  • If not, it asks once and installs it with uv tool install, pinned to the same release (git+…@v<version>#subdirectory=web).
  • It never installs without a yes.
  • Without a terminal, or with TENSORFOLD_WEB_NO_PROMPT=1, it prints the command instead.

It's adopted from @Stephane-Eden's project (Apache-2.0; web/LICENSE and web/NOTICE say where from and what changed), with fixes for current TensorFold:

  • Chat: the relay drops the browser's Origin.
  • Teaching: a copy that learns gets the API key --slide now requires.
  • Server state comes from /health and /v1/load, not from log lines.
  • Teaching is Nemotron-only, and the UI says so.
  • Framing is refused on every page.
  • Tool installs are pinned.

Every commit carries Stephane's co-author credit, and he's added to the Contributors list.

Draft until:

  • web/uv.lock is generated: cd web && uv lock.
  • The committed page (web/tensorfold_web/ui_dist) is rebuilt with npm ci && npm run build.

The web workflow's pytest/ruff and wheel jobs run here. The CLI's 12 host tests pass (zig build test-web-cli-host).

@ashhart

ashhart commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

This is ready for 1.2.5. @Stephane-Eden, thank you: TensorFold Web is your TensorFold Studio, and every commit here carries your Co-authored-by line. web/LICENSE and web/NOTICE keep the adoption's source and commit, and the changelog and contributors list thank you.

Since the adoption, the branch has been reworked to match our desktop app and our code rules:

  • Layout: it opens on a new chat, with the conversations in the sidebar. Models has the desktop's tabs (My models, Discover, Learning, API), with Benchmarks beside the search box and Compute and clusters in a drawer. Settings has its own section list. Home is gone. Every screen and its features are still there, in the places the desktop app puts them.

  • Look: the light and dark tokens and the fonts come from the desktop app's own theme files.

  • Code: every source file is 600 lines or fewer (the server was 2,164), there are no multi-line comments, and comments are 120 columns at most.

  • Two fixes:

    • At startup it no longer reaches the network: model sizes are fetched when you open Discover.
    • Calls to a local engine no longer go through the system proxy.

    Both have tests that fail on the earlier code.

  • Catalog: it lists only models the native engine serves, with a test against capabilities --json.

  • Tests: 457 web tests pass with the web packages installed, plus 35 UI tests and 12 CLI host tests. Without the web packages, the web tests skip with that reason, so python3 -m pytest from the root still passes as CI runs it (286 passed, 94 skipped).

Rebased onto 985b5255a5; only the changelog line changed in the rebase.

@ashhart
ashhart marked this pull request as ready for review November 7, 2026 22:10
@eXsoR65

eXsoR65 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Looking forward to testing it out!

ashhart and others added 20 commits November 7, 2026 23:15
A small local web app for picking a model that fits, running it, watching it, chatting and connecting tools,
adopted under its Apache-2.0 license (web/LICENSE, web/NOTICE): the package and its command are tensorfold-web,
the Python package tensorfold_web, and it lives in web/.

Co-authored-by: Stephane-Eden <[email protected]>
TensorFold's server now refuses a request whose Origin is not its own
address (zig/src/server/request_guard.zig), so chat through TensorFold Web's
relay got 403. The relay now drops Origin. TensorFold Web's own gate still
refuses cross-site changes before the relay runs.

Tested against a mocked engine that applies main's Origin rule.

Co-authored-by: Stephane-Eden <[email protected]>
Main still accepts --slide and --slide-graph (zig/src/server/cli.zig:100-101),
but it now refuses --slide before loading when the server has no key
(zig/src/server/slide_key.zig, called from main.zig:102), and exits 2. The
TensorFold Web made a key only when sharing was on, so a local copy that learns
never started. Starting such a copy now creates a key if Settings has none
and saves it, as sharing does. The key reaches the engine through
TENSORFOLD_API_KEY, never the command line, and the relay and the lessons
present it.

Tested with a mocked start that checks main's key rule.

Co-authored-by: Stephane-Eden <[email protected]>
Main's serving line no longer matched TensorFold Web's pattern: the drafts
field is a phrase ("MTP + copies", "DFlash2 (repo) + copies", "none",
"off") and the context can be "unlimited" (zig/src/server/serve.zig:247,
draft_line.zig). Ready state already came from GET /health. With a key,
/health is only {"status": "ok"}, so TensorFold Web now also reads GET /v1/load
(load_metrics.zig) for the served model, the parked state, the lanes and
the running and waiting requests. /v1/models stays as the fallback for an
engine without /v1/load, and a 401 there reads as an unauthorized key.

The serving line stays only as the fallback for what no endpoint gives,
the context and the load time, and now parses main's format as well as
1.0.x's.

Tested against a mocked keyed main server and main's serving lines.

Co-authored-by: Stephane-Eden <[email protected]>
The Teach screen now says that teaching works on Nemotron 3.5 Lightning
only. A lesson for a served copy of another family is refused with 409,
naming the family the copy's config gives. Such a copy starts without
--slide, with a note in the engine log, and needs no key. Copy creation
already refused other bases.

This is TensorFold Web's own limit. Main's --slide also teaches Qwen3.8
Flash Next on a GB10 (docs/living-weights.md).

The Teach line is edited in ui/src and in the built page alike. Run
npm run build in web/ui to regenerate the page.

Co-authored-by: Stephane-Eden <[email protected]>
Every response now carries X-Frame-Options: DENY and a
Content-Security-Policy with frame-ancestors 'none', the gate's own
refusals and the relay's responses included. An engine page relayed
through /engine/ keeps its own policy, with its frame-ancestors replaced.
The page frames none of its own pages, so nothing it shows is lost.

Co-authored-by: Stephane-Eden <[email protected]>
The one install TensorFold Web runs itself (Bench's Install button) was
already `uv tool install tool-eval-bench==2.8.0`. The commands it prints
for people to run were not: Bench's "not installed" error and the
service's "install it for good first" hint. They now name the exact
version: tool-eval-bench==2.8.0, and tensorfold-web=={__version__}.

A test reads every install command in the Python sources, the page
sources and the built page, and fails on one without ==.

Co-authored-by: Stephane-Eden <[email protected]>
It says where TensorFold Web comes from, that it was renamed, and the
changes made in adopting it. LICENSE is unchanged.

Co-authored-by: Stephane-Eden <[email protected]>
Split HTTP registration, engine telemetry, benchmark modes, lessons and report rendering by responsibility. Keep the behavior cases and share their fixtures. Make loopback tests independent of host DNS and proxy settings.

Co-authored-by: Stephane-Eden <[email protected]>
Generate both themes from the desktop preset and resolver. Use the same surfaces, type, content-pane seam and controls. Remove redundant fonts and block comments, and verify every generated runtime token in both modes.

Co-authored-by: Stephane-Eden <[email protected]>
Commit the resolved Python environment and the production UI built from the shared desktop theme.

Co-authored-by: Stephane-Eden <[email protected]>
Defer Hub size refresh until Discover is opened. Connect engine and peer RPCs directly so loopback requests cannot be captured by a system proxy. Limit recommendations to native families and report the build version for the development stand-in.

Retain red/green startup and proxy regressions, check the catalog against native capabilities, and keep Python comments to one line.

Co-authored-by: Stephane-Eden <[email protected]>
Open a fresh chat with a bottom composer and a conversation sidebar. Group model discovery, learning and API tools under Models, place benchmarks beside search, and open compute controls in a drawer. Give Settings its own section list and move the setup checklist there.

Preserve existing actions and shortcuts, shorten repeated copy, retire Home and its styles, and enforce source size and single-line comment rules. Generate the stand-in version from the native build metadata.

Co-authored-by: Stephane-Eden <[email protected]>
Ship the rebuilt UI with the existing dependency locks and retained third-party notices.

Co-authored-by: Stephane-Eden <[email protected]>
Keep screen and card explanations to a single sentence, including model
and API recipe descriptions. Use the machine engine version for every
Settings label, with the flags version only as a fallback.

Shorten the Teach comment and remove an over-wide inline comment.

Co-authored-by: Stephane-Eden <[email protected]>
Check all five optional Web packages before loading Web fixtures or test
modules. Collect an explicitly skipped item per module when they are
absent, so standalone and root collection both finish cleanly.

Count UTF-8 bytes and indentation in maintained comment-width checks.

Co-authored-by: Stephane-Eden <[email protected]>
@ashhart
ashhart force-pushed the lead/tensorfold-web branch from 0a0f4cf to 005ec1a Compare November 7, 2026 23:47
@ashhart
ashhart merged commit 413a6c3 into main Nov 7, 2026
33 of 38 checks passed
@ashhart

ashhart commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

Thank you @Stephane-Eden. This is merged into main with your commits under your own name, so you're credited as a TensorFold contributor.

ashhart added a commit that referenced this pull request Nov 8, 2026
#2465 gets its line, #2388 and #2434 their numbers, #2379 one line
(with #2516 folded in), seven contributor thanks restored, #1781 thanks
by handle, and no line promises later work.
@ashhart

ashhart commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

Thanks @Stephane-Eden! TensorFold Web, adopted from your TensorFold Studio, is in TensorFold 1.2.5, out now: https://github.com/ashhart/TensorFold/releases/tag/v1.2.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants