ahpw

mcp
Security Audit
Fail
Health Warn
  • License — License: MIT
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Low visibility — Only 6 GitHub stars
Code Fail
  • exec() — Shell command execution in .agents/skills/do-spec/scripts/lint-prose.mjs
  • process.env — Environment variable access in cli/serve.ts
  • network request — Outbound network request in cli/server.test.ts
Permissions Pass
  • Permissions — No dangerous permissions requested

No AI report is available for this listing yet.

SUMMARY

A browser-based workspace for AI agents. Connect to your Agent Host Protocol server, interact with multiple agents, manage sessions, review code, browse files, access terminals, configure automations and manage your agent infrastructure from anywhere.

README.md

@ahpd/web

CI
@ahpd/web
license MIT
node >=22
Agent Host Protocol 1.0.0

A web UI for an Agent Host Protocol server.

Run it inside ahpd as a plugin, or on its own with ahpw serve in front of any AHP server.

What you get:

  • Sessions, the list, each chat, new sessions and what they changed.
  • Composer, supports @attachments, /skills and /commands.
  • Explorer, the host's folders as a tree: the default folder first, then each session's. Drag a file to the composer to attach it, or with Shift to write its path.
  • Automations for running tasks and scripts automatically based on session events.
  • Terminals and a log in a bottom panel.
  • Host Information, shows details about the server and its environment.
  • Agents, the ones the host offers: their models, customizations and sign-in, and a new session with one.
  • Settings, configure the host server and its plugins.
ahpw with the session list, a running session, its details and changes, and a terminal in the bottom panel

Two sessions side by side:

ahpw with two running sessions open side by side


Run it in ahpd

Install the plugin:

ahpd plugin install @ahpd/web

That installs it where the daemon looks for plugins and adds it to plugins in the configuration file.

Note: A plugin installed with npm i -g is not seen.

Turn on the API on the daemon's own port:

{
  "http": true,
  "plugins": ["@ahpd/web"]
}

Then open http://127.0.0.1:9187/plugins/web/.

Keep http.port unset. On another port the API is on another origin, and the page cannot reach it.

The daemon's client list shows the page as "ahpd web". clientName and clientTitle in the plugin's options change that:

{
  "plugins": [{ "source": "@ahpd/web", "options": { "clientTitle": "Office web" } }]
}

Run it on its own

npm i -g @ahpd/web
# --connect {HOST_URL} --token-file {PATH_TO_TOKEN}
ahpw serve --connect ws://127.0.0.1:9187 --token-file ~/.config/ahpd/token

Or without installing it:

npx @ahpd/web serve --connect ws://127.0.0.1:9187 --token-file ~/.config/ahpd/token

Then open http://127.0.0.1:5190/.

  • With a token, the server adds it to the socket. The page asks for nothing, and the browser never sees the token.
  • Without one, the page asks for a token, as it does in ahpd.

Options

Option What it does
--connect URL The server's socket: ws://, wss://, http://, https:// or HOST:PORT
--token SECRET The token to add to the socket
--token-file PATH Read the token from a file
--host ADDR Bind here, default 127.0.0.1
--port N Listen here, default 5190
--open Open the page in a browser
--client-name NAME The name the server's client list shows for the page, default ahpw
--client-title TITLE The title the server's client list shows for the page, default ahpw
--tls-cert PATH Serve https with this certificate, a PEM file. Needs --tls-key
--tls-key PATH The private key of --tls-cert, a PEM file
--domain NAME The name the page is reached by, as the certificate names it

A tkn= in the --connect URL counts as the token.

https

A browser holds some features back from a page on plain http, unless the page is at localhost. One of them is navigator.locks, which an agent needs to run ahpw's commands, so on http://192.168.0.4:5190 the agent gets no ahpw tools. Serve https instead, with a certificate for the name you open the page at:

{
  "tlsCert": "~/.config/ahpw/cert.pem",
  "tlsKey": "~/.config/ahpw/key.pem",
  "domain": "ahpw.example.com"
}

domain is what lets a page at that name open the socket. Without it, only a page at an IP address or localhost may. pnpm dev reads the same three keys.

Without https, a page on plain http shows Without https among the agent tools, in the Tools panel and the Interface settings (ui.agentToolsWithoutHttps). It is off by default. On, the browser's windows agree among themselves over a BroadcastChannel which one runs an agent's calls. That is not atomic, so with two windows open on one session, a call that arrives as you switch between them can run in both.

Config file and environment

Every option can go in ~/.config/ahpw/config.json, without the dashes:

{
  "connect": "ws://127.0.0.1:9187",
  "tokenFile": "~/.config/ahpd/token"
}

With no connect anywhere, ahpw serve reads the environment:

  1. AHPD_URL, else AHPD_HOST, for the server
  2. the tkn= in that URL, else AHPD_TOKEN, for the token
AHPD_URL="ws://127.0.0.1:9187/?tkn=$(cat ~/.config/ahpd/token)" ahpw serve

A flag beats the file, and the file beats the environment.

Security

  • The server binds 127.0.0.1 by default. Anyone who reaches it uses the AHP server with your token, so it warns when --host opens it up.
  • It takes a socket only from a page it served, at an IP address, localhost or the domain you set.
  • It warns when the token goes in cleartext (ws://) to another machine.

Sign-in

Without a token from ahpw serve, sign in with one the server accepts: the deployment's token, or a person's token.

Each ahpd command checks its own grants. A token that may not run one gets ahpd's refusal.

The socket carries the token as ?tkn=, because a browser cannot set a header on a WebSocket.


Develop

ahpw speaks the protocol through @microsoft/agent-host-protocol, the spec and its TypeScript SDK.

pnpm install
pnpm dev

pnpm dev serves on http://127.0.0.1:5180. It proxies /api and the socket (at /ahp) to AHPD_URL, default http://127.0.0.1:9187. The daemon needs "http": true.

With tlsCert and tlsKey in ~/.config/ahpw/config.json, pnpm dev serves https, and domain is a name Vite answers at. See https.

AHPD_URL=http://127.0.0.1:9187 pnpm dev            # another daemon
AHPD_URL=http://127.0.0.1:9187 pnpm dev --port 5200 # extra args go to Vite

To try a change in scena before it is released, point AHPW_SCENA at a scena checkout.
ahpw then uses that checkout's source instead of the installed package, in pnpm dev, pnpm build and pnpm test:

AHPW_SCENA=../scena pnpm dev

An app that embeds ahpw, as ahp-desk does, sets globalThis.ahpwEmbedder before ahpw's scripts run.
ahpw then takes its host and token from it instead of the address bar, and draws the window's frame when it gives one.
The contract is src/shell/embed/index.ts, and its types are exported as @ahpd/web/embed.

To try a local build in ahpd:

pnpm build
ahpd run --plugin /path/to/ahpd-web
Script What it does
pnpm dev Vite, with /api and the socket proxied to a daemon
pnpm build The page into dist/app, the plugin into dist/plugin, the CLI into dist/cli
pnpm typecheck Every TypeScript project
pnpm test The unit tests, for the page, the plugin and the CLI

Release

CI runs on every push to main: typecheck, tests, build, and the packed package installed and served once.

What changed in each version is in CHANGELOG.md.
Before a release, move the Unreleased entries under the new version.

A v* tag releases. It must match version in package.json:

git tag v0.1.0 && git push origin v0.1.0

The release workflow runs the same checks and stages @ahpd/web on npm with provenance. Nothing is installable until it is approved on the package's npm page.
It also creates the tag's GitHub Release, with the version's CHANGELOG.md section as its notes and the packed tarball attached.

npm sets a trusted publisher on a package that exists, so the first version is published once by hand with pnpm build && npm publish --access public, and the trusted publisher (ahpio/ahpw, release.yml) is added after it.


Layout

Path What it is
plugin/ The ahpd plugin: one route serving dist/app
cli/ ahpw serve: the same route on its own server, and the socket proxy
src/main.tsx, src/App.tsx The entry: the theme before the first paint, the scena root, sign-in or the shell
src/bridges/ The AHP connection, the socket address, the protocol versions offered
src/porta/ Sign-in with a token
src/lib/ The API root, the token and the storage keys
src/resources/ What the host offers, one folder each, each with an index.ts that registers it
src/resources/sessions/ The sessions list, a new session, a session's chat and details
src/resources/folders/ The explorer: the host's folders, and a host file dragged to the composer
src/resources/agents/ The agents the server offers
src/resources/changes/ What a session changed
src/resources/files/ File, Markdown and diff viewers
src/resources/editor/ The code editor the viewers and forms use
src/resources/terminals/ The server's terminals
src/resources/log/ The log page
src/resources/automations/ The automations list and an automation's page
src/resources/commands/ The command list, the command page, the result view
src/resources/manifest/ The manifest's types, commands to forms and requests
src/resources/host/ The host's settings and information
src/shell/ The chrome: register-shell.tsx registers every resource, the activity bar and the sidebars
src/shell/panel/ The bottom panel
src/shell/notify/ Toasts, confirm dialogs, browser notifications
src/shell/view/ The palette, layouts and key bindings
src/shell/explorer/ The list the sidebar sections share
src/shell/embed/ The contract with an app that embeds ahpw
src/shell/AhpwMark.tsx The logo, on the sign-in page and while loading
src/style/ ahpw's own styles

License

MIT © Softov

Reviews (0)

No results found