Skip to content

Holo-web-conductor support - #47

Open
zippy wants to merge 2 commits into
main-0.6from
hwc-support
Open

Holo-web-conductor support#47
zippy wants to merge 2 commits into
main-0.6from
hwc-support

Conversation

@zippy

@zippy zippy commented May 8, 2026

Copy link
Copy Markdown
Contributor
  • Adds support for running under holo-web-condcutor.

zippy added 2 commits May 8, 2026 19:30
Adds end-to-end support for running emergence under the Holo Web
Conductor browser extension, with a single-command local dev stack
that spins up bootstrap + conductor + h2hc-linker + joining service +
hc-spin progenitor sharing one network seed. Modelled on
../unyt/deploy/local-dev.sh and ../mewsfeed's NetworkInfo connection
indicator pattern.

Stack (deploy/local-dev.sh + deploy/start-hwc.sh):
- start-hwc.sh wraps `npm run start:hwc[:joining]`, exporting one
  NETWORK_SEED both as itself (read by local-dev.sh) and as
  VITE_PROGENITOR_NETWORK_SEED (read by App.svelte). Default
  `emergence-local-dev`; override with `NETWORK_SEED=foo npm run …`.
- local-dev.sh repacks workdir/emergence.happ with $NETWORK_SEED
  stamped into dna.yaml and stages it to ui/public/emergence.happ —
  required because @holo-host/web-conductor-client's joinAndInstall
  doesn't pass dna_modifiers.network_seed through to installApp, so
  the bundle's manifest seed has to match the conductors'.
- kitsune2-bootstrap-srv runs both bootstrap and iroh-relay on the
  same HTTP listener (`no_relay_server: false`); the relay URL = the
  bootstrap URL. Parsing the QAD port instead leaves iroh stuck
  without a current url and silently breaks peer discovery.
- Linker runs in open-auth mode (no admin secret) even with the
  joining service, so a stale HWC install can't get locked out by an
  empty in-memory allowlist after a linker restart.
- hc-spin is launched WITHOUT --network-seed; emergence's model is
  "provisioned cell = empty template, each network is a clone." If
  hc-spin baked the seed into the provisioned cell, the UI's
  auto-join would collide on DNA hash and the conductor would return
  DuplicateCellId.

Yarn/npm surface:
  npm run start:hwc          backend + vite + hc-spin (no joining)
  npm run start:hwc:joining  + joining service (recommended)
  npm run start:hwc:progenitor   spawn hc-spin standalone
  npm run stop:hwc           tear down everything
  npm run status:hwc         show what's running

UI changes (ui/src/App.svelte + helpers):
- isHwcContext() in utils.ts: true on ?runtime=hwc query param OR
  window.holochain.isWebConductor (matches mewsfeed's runtime-config
  pattern as a query param so we don't ship a config file with the
  .webhapp).
- New HWC connect branch uses WebConductorAppClient with
  roleName: "emergence" (HWC's synthetic appInfo defaults to
  "default"/<app-id> without it, breaking CloneManagerStore). URL
  params override env vars: ?joiningServiceUrl, ?linkerUrl,
  ?happBundlePath. happBundlePath defaults to /emergence.happ.
- VITE_PROGENITOR_NETWORK_SEED is the non-Moss stand-in for the
  Weave tool-installer affordance: when set, the UI in non-Weave/
  non-HWC mode (i.e. the hc-spin progenitor window) auto-joins a
  clone with that seed, skipping NetworkOnboarding entirely. join()
  is wrapped in DuplicateCellId fallback that re-lists clones and
  activates the existing one — robust against hot-reload + residual
  state. amSteward = (env var set), so the Admin pane's initial-
  config wizard auto-shows. Production builds leave the env var
  unset, so HWC browser users do NOT become stewards.
- CloneManagerStore gains an `isHwc` constructor flag; HWC mode uses
  the provisioned cell directly (the joining service installs with
  dna_modifiers.network_seed, no clone needed) — same code path as
  the existing Weave branch.
- HwcConnectionStatus.svelte (adapted from mewsfeed/components/
  NetworkInfo.vue) subscribes to the HWC client's connection:change
  events and renders Extension/HTTP/WS/Auth/Linker/Peers/Reconnect/
  Errors live, plus a derived boot-stage label so the loading screen
  shows exactly which step is stuck. Wired into App.svelte's three
  waiting states: pre-connect spinner, post-connect sync, and
  init-error.

.npmrc: legacy-peer-deps=true. @holo-host/web-conductor-client@0.1.0
declares peer @holochain/client ^0.18.0 || ^0.19.0 || ^0.20.0 and
emergence pins ^0.20.4-rc.0 — strict-mode npm rejects the prerelease
as unsatisfied; runtime APIs are compatible.

.gitignore: linker-key.ed25519 (h2hc-linker writes its identity
keypair to cwd on first start).

docs/dev/hwc-manual-test.md walks the flow, why .happ is repacked,
why bootstrap == relay, the env-var → seed plumbing, and a
troubleshooting section keyed on the specific error messages we hit.
…inker

Three small follow-ups to the local HWC dev stack from 932576e.

clean subcommand
----------------
`stop` deliberately leaves /tmp/emergence-local-dev intact so you can
post-mortem linker.log / conductor.log / progenitor.log after a failed
session. Wiping that state is now an explicit action: `npm run
clean:hwc` (or `./deploy/local-dev.sh clean`). It refuses to run while
any tracked PID is alive — you have to `stop` first — and also removes
the staged ui/public/emergence.happ so a subsequent start re-stages a
freshly seed-stamped bundle.

Terminology + log map
---------------------
Reframed the script + manual-test doc around "three k2 nodes" instead
of "the linker's conductor". The h2hc-linker binary itself is a k2
node; the `hc sandbox` instance it points at via
H2HC_LINKER_CONDUCTOR_URL is a separate k2 node ("background
conductor"); and hc-spin runs a third k2 node ("progenitor"). All
three peer up via the same bootstrap+relay. Stopped using
"linker conductor" to refer to either of the latter two — it conflated
roles that are independent at the kitsune2 layer. Doc gains a small
table mapping each of the three log files to which k2 node wrote it,
plus a one-liner on reading `iroh::magicsock me=/remote=` lines to
confirm full-mesh peering.

Always rebuild the linker on start
----------------------------------
Replaced the "rebuild only if missing or `--help` fails" gate with an
unconditional `cargo build --release` against
$H2HC_LINKER_DIR. Cargo's own incremental check is the up-to-date
oracle (~0.6s no-op when nothing changed), and the prior gate
silently shipped stale binaries when ../h2hc-linker source was edited
between runs. The stale-nix-interpreter recovery branch was kept and
moved to run *after* a successful build, gated on the binary not
responding to `--help`. cargo's stdout is suppressed unless the build
fails, in which case a verbose re-run command is printed.
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.

1 participant