Repository navigation
feat(website): WebsiteEnvironment serves a site on the website/v1 contract, and a conformance check tests any server (FD-4683) - #428
Draft
williamloo-scale wants to merge 4 commits into
Conversation
…tract, and a conformance check tests any server (FD-4683) A site declares itself with @website(domains, static, health) and its routes with @api, which bind path, query and body from type hints and take an ApiContext with the signed-in user, role and public URL. It serves its built pages, its health path, the data plane and a card that declares website/v1 with its routes, an OpenAPI document and a session operation. self.now() reads the universe clock, and each response carries X-Universe-Now. A site on the built-in Collections store loads, exports and resets its state and serves /go without data hooks. python -m agentenv_protocol.website.conformance URL checks a running server over HTTP alone. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…E_KEY (FD-4683) The gateway forwards the role a browser sends on /website/<name>/, so a page or a fetch could claim any role and call a roles= route. ctx.role is now the AgentEnv-Role a caller names only when it also sends AgentEnv-Role-Key equal to the site's WEBSITE_ROLE_KEY, compared in constant time; every other caller, and every caller of a site with no key set, is default. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ruff's F401 failed the unit job's lint step on this branch. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Stacked on #427.
agentenv_protocol.website: the easy path to a synthetic website that follows website/v1 (urn:agentenv:website/v1).@api.get/post/put/patch/delete(path, name=, roles=, status=): path, query and body are bound from type hints, errors are exceptions mapped to statuses, and an OpenAPI 3.1 document is generated.ApiContext: the signed-in user (else the acting user, so the agent starts signed in), the caller's role, and the public URL fromX-Forwarded-Host/-Proto.AgentEnv-Rolea browser sends, so a site believes a non-defaultrole only when the request also carriesAgentEnv-Role-Keyequal to the site'sWEBSITE_ROLE_KEY(compared in constant time). Every other caller, and every caller of a site with no key set, isdefault, soroles=routes are closed until a key is set.index.htmlfallback, the health path with@ready_check, the data plane and a card declaring website/v1 with its routes andopenapi/sessionoperations./agentenv…routes are matched before the site's own.self.now()reads the universe clock (clock/v1sync_time); every response carriesX-Universe-Now;clock_patch=Truepatches the page'sDate.Collectionsstore: load, export, reset, initial/current/diff state and/gowith no data hooks written.python -m agentenv_protocol.website.conformance URLchecks any server over HTTP: card, any host name, health, universe time, data plane, clock, forwarded headers, cookies.Known gaps
WEBSITE_ROLE_KEYon a deployed site yet, and the gateway still trustsAgentEnv-Roleon MCP calls, non-SDK sites and website trigger attribution. A per-deploy key in the gateway is the full fix.X-Forwarded-*, so behind it sites must use relative URLs.X-Universe-Nowand a filled-in card, stricter than a non-SDK server may be./goignoressid.Test
packages/agentenv-protocol/tests: 946 passed; the website tests (59, with the Notes ones) pass after the role-key fix. Deployed locally behind the gateway, a spoofedAgentEnv-Role: adminnow gets 403 on both/website/and/svc/(200 before).🤖 Generated with Claude Code