Skip to content

feat(website): a Notes site on WebsiteEnvironment, one image that passes the conformance check (FD-4683) - #429

Open
williamloo-scale wants to merge 12 commits into
mainfrom
wloo/website-notes-example
Open

williamloo-scale wants to merge 12 commits into
mainfrom
wloo/website-notes-example

Conversation

@williamloo-scale

@williamloo-scale williamloo-scale commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #428.

packages/agentenv-protocol/examples/website/notes/: a reference site on WebsiteEnvironment, about 130 lines of Python plus a small Vite page.

  • Per-user notes stamped with self.now(), auto sign-in as the acting user, and /api/admin/notes with roles=["admin"] (403 otherwise).
  • The page uses relative URLs, so it works under the gateway's /website/notes/ route. A refresh keeps text typed into a note that isn't saved yet, with its focus and cursor, and the page's clock re-reads X-Universe-Now every 5 seconds, so a stopped or faster universe clock shows.
  • One image: a node stage builds the page, a python stage serves it with the API on PORT, with curl for the compose health check. env.toml declares it as the server image.

Test

Unit suite and protocol tests: 12,667 passed, lint clean.

  • test_website_notes_example.py: 8 passed.
  • Built and ran the image: healthy, and python -m agentenv_protocol.website.conformance http://localhost:18080 --clock-host host.docker.internal passed 8/8. Pages, session, notes and the admin route checked by curl.
  • In Chromium against the site: with a title's save delayed, text typed into the body stays focused through the refresh and is saved, one save per edit.
  • Registered with agent-env env website put --server-dockerfile ... --health-path /healthz against local stores only.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge with the noted dependency on PR #443.

Summary

Adds a Notes reference site with per-user notes, an admin-only route, a Vite page, and one server image.

  • The Notes server keeps notes with their owners and universe timestamps.
  • The Notes page keeps drafts and shows the environment's clock.
  • One container image serves the Notes page and API together.

Reviews (15) · Last reviewed commit: "fix(website): the Notes page keeps unsav..." · Reviewed by Greptile

@socket-security

socket-security Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​vite@​5.4.1091508397100

View full report

@socket-security

socket-security Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Priority Alert  (click "▶" to expand/collapse) Action
Low priority
High CVE: launch-editor: fs.existsSync() existence check can be bypassed on Windows in npm `vite`

CVE: GHSA-587h-7wmj-h5pm launch-editor: fs.existsSync() existence check can be bypassed on Windows (HIGH)

Affected versions: >= 8.3.0 < 8.3.3; >= 8.2.0 < 8.2.4; >= 8.0.0 < 8.1.6; >= 7.0.0 < 7.3.7; < 6.4.4

Patched version: 6.4.4

From: packages/agentenv-protocol/examples/website/notes/web/package-lock.json → npm/vite@5.4.10

ℹ Read more on: This package | This alert | What is a CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known high severity CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/vite@5.4.10. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn

View full report

williamloo-scale and others added 3 commits November 3, 2026 13:34
…'s websites as its MCP servers (FD-4683)

A website env, and a multi env's websites, get the harness treatment
MCP servers get: sync_env_clock syncs them (and tells them main's
timezone), snapshot_env exports each through its data plane and fails
on a site whose card can't be read, and an apply_server_config
broadcast reaches them; a site without the clock, a data plane or the
config extension is skipped.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…server the env card lists, at its own route (FD-4683)

The servers behind an env's gateway come from its card's
children_environments, each at its own /svc route, through new protocol
helpers (ChildEnv, children, child_at, child_named, serves), not from
the env's definition: a website sharing an MCP server's name is its own
server, and a card without data/get in its operations serves no v1 data
plane. The definition is read only for servers that serve no card, and
for a record whose card can't be read, logged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…tract, and a conformance check tests any server (FD-4683)

This PR's change, rebased as one commit onto #427.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@williamloo-scale
williamloo-scale force-pushed the wloo/website-notes-example branch from d76be33 to a68ff2a Compare November 3, 2026 21:50
@williamloo-scale
williamloo-scale force-pushed the wloo/website-environment-sdk branch from 3579c2a to 76145d2 Compare November 3, 2026 21:50
… keep older sites and shared names working (FD-4683)

- The gateway answers 503 on a site's route while its card can't be read, rather than forwarding with nothing reserved.
- A plugin's MultiEnv record looks each child up by its kind, so a website and an MCP server may share a name.
- The state verifier reads a site its definition names but its card doesn't list at /svc/<name>/go, deprecated.
- The clock script is put in streamed HTML holding only what comes before <head>.
- Conformance fails a website/v1 ready that answers an HTTP error, whatever its body says.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@williamloo-scale
williamloo-scale force-pushed the wloo/website-notes-example branch from a68ff2a to f1a665a Compare November 3, 2026 22:52
…ver HTTP client the test client uses (FD-4683)

After a sign-out the client's jar keeps the site's signed-out cookie under testserver.local, and setting the
forged one adds a second cookie of the same name. httpx2, which Starlette's TestClient uses when it is
installed (as on CodeBuild), sends the forged one first, so the site reads the valid signed-out cookie and
the test fails; httpx sends them the other way round. Clearing the jar first sends the forged cookie alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@williamloo-scale
williamloo-scale force-pushed the wloo/website-notes-example branch from 250afe3 to 30113cb Compare November 4, 2026 03:37
…op /go, the state op and website_state_verifier (FD-4683)

- The SDK serves no `/go`, no `params.state.path` and no `website/v1` `state` op; `STATE_PATH`, `WebsiteState`,
  `website_state`, `website_sites` and `website/state.py` are gone, and the default store keeps no initial state or diff.
- Conformance runs the data plane's round trip on every server, with no skip for a state that shows changes.
- The gateway reserves the card's `url` and every advertised endpoint, no longer a state path.
- `website_state_verifier` is removed from the framework; grading against a site's state belongs outside it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@williamloo-scale
williamloo-scale force-pushed the wloo/website-notes-example branch from 30113cb to d43c767 Compare November 4, 2026 03:56
@williamloo-scale
williamloo-scale force-pushed the wloo/website-environment-sdk branch from 05da818 to 33ad3b8 Compare November 4, 2026 03:56
williamloo-scale and others added 4 commits November 3, 2026 20:06
… items in OpenAPI, and find the clock's sync_time by name (FD-4683)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ses the conformance check (FD-4683)

This PR's change, rebased as one commit onto #428.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…s, and adds a note once per submit (FD-4683)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…sign-in fails, and reloads itself at its slash-ending address (FD-4683)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
williamloo-scale and others added 2 commits November 3, 2026 20:06
…hrough data/get, not /go (FD-4683)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…s, settles a save the server accepted, and reloads itself on its own origin (FD-4683)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@williamloo-scale
williamloo-scale force-pushed the wloo/website-notes-example branch from d43c767 to b055f91 Compare November 4, 2026 04:37
@williamloo-scale

Copy link
Copy Markdown
Contributor Author

@greptile-apps the three findings from the last review are fixed in b055f91:

  • Filters discard failed edits (main.js): unsaved edits now live in a drafts map keyed by note and field, not only in the inputs. Each render rebuilds a note's fields from its draft, so an edit whose PATCH failed survives a filter that hides the note. A successful save clears the fields it sent.
  • Notes links can leave (index.html): the trailing-slash reload builds its address from new URL(location.href) and changes only pathname, so it can't leave the page's origin. //evil.example/page reloads on the same host. The new-site template in feat(website): the browser client, env website new and env website dev (FD-4683) #446 gets the same line.
  • Saved titles keep saving (main.js): a render restores only the focused field's focus and selection, and takes each value from the note or its draft. Once a save succeeds, the server's trimmed title is shown and isn't sent again. An edit typed after the submission is kept.

Each fix was checked in a browser against a built Notes site: with a failing PATCH, against //evil.example/page and /%2F%2Fevil.example/page, and against a padded title. The full unit suite passes on this commit (12,915) and lint is clean. All three threads are replied to and resolved.

@greptile-apps

greptile-apps Bot commented Nov 4, 2026

Copy link
Copy Markdown

Confirmed: the changes in b055f918 address all three findings. Failed edits remain in drafts across filter renders, the trailing-slash redirect retains the current origin, and accepted saves clear only the submitted draft values so server-normalized titles display without losing newer edits. The reported browser and test checks are consistent with the updated flow.

@earakely-scale
earakely-scale force-pushed the wloo/website-environment-sdk branch from 6150bf6 to e44af7e Compare November 5, 2026 00:05
Base automatically changed from wloo/website-environment-sdk to main November 5, 2026 05:59
earakely-scale pushed a commit that referenced this pull request Nov 5, 2026
…gers by route (FD-4683)

This PR's change, rebased as one commit onto #429.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
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