Skip to content

updated readme, removed dead code, added internal wschat as integral core to avoid confusion - #2

Merged
hsyvy merged 4 commits into
helloagentai:mainfrom
hsyvy:main
May 10, 2026
Merged

hsyvy merged 4 commits into
helloagentai:mainfrom
hsyvy:main

Conversation

@hsyvy

@hsyvy hsyvy commented May 10, 2026

Copy link
Copy Markdown
Contributor

No description provided.

hsyvy and others added 4 commits May 9, 2026 18:57
Terminology
- "relay" is internal HelloAgent jargon; the user-facing name is "HelloAgent
  server". Renamed user-facing strings, log messages, comments, README,
  package.json description, and the CLI flag (--relay-ws → --server-ws).
- Renamed our internal field names: Account.relayWs / Creds.relayWs /
  ImportTokenOptions.relayWs → serverWs. Note: this is a breaking change
  for any existing creds.json — re-pair to migrate. SDK contract names
  (Agent's `relayUrl` param, linkChannel's `relay_ws` response field) are
  left untouched since they belong to the SDK package.
- Stripped other internal-jargon leaks: sister-repo provenance comments
  (`openclaw-HelloAgent/...` in 7 files), server-internal Go path
  reference (`relay/internal/api/channels.go`), and a stale pre-split
  integration path in wschat/server.ts.
- The CLI help's manual-import example was using the dev relay URL
  (`ws://localhost:8080/v1/ws`); switched to `wss://api.helloagent.cc/v1/ws`.

Public API trimmed
- Published surface (src/index.ts) now exposes only what an embedder needs:
  createBridge / Bridge / BridgeOptions, ResolvedAccount, pairWithBrowser,
  pairWithDeviceCode, importToken (+ option types), hasAnyAuth, Creds and
  the read/write/delete/list helpers, DEFAULT_ACCOUNT_ID.
- Removed from exports (still used internally): HaClient and friends,
  createWschatServer + WschatServer types, all wschat frame types
  (internal wire protocol), path helpers (resolveStateDir/etc),
  CREDS_VERSION.

Dead code removed
- `export { randomUUID as newMsgId }` in bridge.ts and wschat/server.ts —
  nothing imported them.
- cli.ts had a trailing `export { hasAnyAuth }` plus its only-for-the-
  re-export `import` — unreachable since cli.ts is not in
  package.json#exports.
- Made ClientStatusListener / IncomingHandler file-internal in ha-client.ts.

Type declarations now ship
- tsconfig: declaration: false → true.
- package.json: exports gains types/import conditions; added top-level
  `types` field. Embedders importing `@helloagentai/hermes` now get full
  TypeScript types instead of `any`.

Quality fixes
- bridge.ts: the "bridge ready" log fired immediately after wschat started,
  before the HelloAgent connection completed. Split into "wschat
  listening on H:P" then "bridge ready: linked to HelloAgent as @x" after
  the SDK handshake finishes.
- bridge.ts: named the magic idleMs*5 initial-reply timeout multiplier
  (INITIAL_REPLY_IDLE_MULTIPLIER) with a comment explaining why first
  chunks get more time than subsequent ones.
- store.ts: creds-version mismatch error now names the offending file
  path and tells the user exactly which command (pair or logout) fixes it.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Three cohesive changes against the previous polish pass:

1. Replace OAuth/device-code/manual-flag combo with a single interactive
   token paste flow. Deleted src/auth/login.ts, src/auth/login-oauth.ts,
   src/auth/login-device.ts (~360 LOC of OAuth + linkChannel + PKCE
   loopback machinery). The HelloAgent web UI now handles agent creation
   and ha_* token issuance; this CLI just consumes the resulting token.
   `pair` prompts:

       Link this bridge to a HelloAgent account:
         1. Open https://app.helloagent.cc/app/agents/new
         2. Create an agent and copy its token (starts with "ha_")
         3. Paste the token below
       Token: _

   --token <T> still works for non-interactive scripting. Public API
   shrinks: pairWithBrowser / pairWithDeviceCode / their option types
   removed from index.ts; importToken stays.

2. Daemonize `pair`. After pairing succeeds (or creds already exist), the
   foreground spawns a detached child running `_serve` (hidden subcommand)
   that holds the bridge open. Foreground waits for the agent socket to
   actually bind (TCP probe, 8s timeout) before printing success and
   exiting — terminal returns to prompt. State files under
   ~/.helloagent-hermes/: bridge.pid (PID of the daemon, chmod 0600),
   bridge.log (verbose log; daemon always runs with HA_HERMES_BRIDGE_DEBUG=1).

   Added `stop` command (SIGTERM the daemon, clean up PID file). `status`
   now reports "bridge: running (pid X, log …)" or "bridge: stopped".
   `logout` stops the daemon before deleting creds.

   Output collapses from the previous block of internal log lines plus
   "Press Ctrl+C to stop the bridge" footer to two lines:

       ✓ Connected to HelloAgent as @alice/jarvis.
         You can now chat with your agent through the HelloAgent app or browser.

   logger.ts: info-level emission is now gated on HA_HERMES_BRIDGE_DEBUG=1.
   Warnings and errors still print. The daemon always runs with DEBUG=1
   in its env so its log file captures the full picture.

3. Rebrand "wschat" out of our package. The protocol stays compatible
   with Hermes' wschat plugin on the wire, but our code, types, and docs
   no longer call it that:

   - src/wschat/ → src/agent-socket/ (folder rename via git mv)
   - createWschatServer → createAgentSocket
   - WschatServerOptions → AgentSocketOptions
   - WschatServer → AgentSocket
   - BridgeOptions.wschatToken → BridgeOptions.socketToken
   - Log namespaces and code comments scrubbed
   - README's architecture diagram says "agent-socket protocol" instead
     of "wschat protocol"; one cross-reference note retained pointing at
     the Hermes plugin currently named wschat
   - CLI help drops `--port` / `--host` / `--wschat-token` flags from
     the visible surface; same overrides remain via env vars
     (HA_HERMES_BRIDGE_PORT / _HOST / _TOKEN)

Build hygiene: package.json gains a `postbuild` step that re-applies
chmod +x to dist/cli.js (tsc strips the executable bit). Without this
the global symlink (`npm link` / `npm install -g`) breaks after every
rebuild.

Tested end-to-end: paired with a real ha_* token, daemon spawned, agent
socket bound, Hermes plugin (after a parallel rename to "helloagent" in
its own install) connected, DM round-tripped from HelloAgent → bridge →
Hermes → reply back through the same chain.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Simplify pairing UX: paste-token, daemonize, drop wschat naming, polish API surface
@hsyvy
hsyvy merged commit 98fa2aa into helloagentai:main May 10, 2026
2 checks passed
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