Skip to content

feat(web): scope the page to the daemon its address names - #377

Closed
futrime wants to merge 1 commit into
mainfrom
feat/web-daemon-scoping
Closed

futrime wants to merge 1 commit into
mainfrom
feat/web-daemon-scoping

Conversation

@futrime

@futrime futrime commented Oct 12, 2026

Copy link
Copy Markdown
Member

Unit 6 of the multi-daemon plan (C6).

  • Addresses name the daemon first: #/@<name>/<view>…. An address without @ is Local, so existing addresses keep working.
  • api.js exports daemon(), scoped(path), hash(path) (a page address that keeps the @name), onDaemon(fn) and toDaemon(name, path).
  • get, post, send and poll scope every call to /d/<name>/api/…, Local included, so Local is /d/local/api/…. /api/daemons* and /api/notifications* stay unscoped.
  • Switching daemon:
    • fires hmz:daemon
    • clears the poll caches and drops answers that were still in flight for the old daemon
    • closes the held SSE streams
    • remounts the view and dialog
    • resets the sidebar lists through the event (footer untouched)
    • resets the module caches: workspaces, backends, ssh hosts
  • go(), stays() and every #/ link or location.hash set in a static module go through hash(). Export links and the held stream go through scoped().
  • Server: site.py answers /d/local/api/… as /api/…. Proxying other daemons is unit 4.
  • Docs: addresses in docs/reference/web.md and docs/user/web.md.

Tests: new tests/integration/test_web_scoping.py (Chromium + WebKit) covers:

  • #/@local/… views load
  • every request goes under /d/local/api/
  • links keep @local
  • an epic started on @local stays there, and its stream is scoped
  • switching to a routed @other fires hmz:daemon, and its requests go to /d/other/api/

All test_web_* pass (139), and unit tests pass (5690). Live hmz web check with Playwright: all requests went to /d/local/api/, with no console errors.

🤖 Generated with Claude Code

The address names the daemon first, #/@<name>/<view>, and Local where it
names none. api.js asks everything of that daemon under /d/<name>/api/,
save /api/daemons and /api/notifications, keeps @<name> in every link
through hash(), and on a switch clears what polls read, closes the held
streams and fires hmz:daemon, on which the view and the sidebar's lists
are drawn again. The server answers /d/local/api/ as /api/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 12, 2026 14:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@futrime

futrime commented Oct 12, 2026

Copy link
Copy Markdown
Member Author

Landed together in #385.

@futrime futrime closed this Oct 12, 2026
@futrime
futrime deleted the feat/web-daemon-scoping branch October 12, 2026 23:56
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