Skip to content

feat: integrate d-back browser runtime#9

Open
NNTin wants to merge 3 commits intofeat/plugin-system-for-runtime-extensibilityfrom
feat/integrate-d-back-browser-runtime
Open

feat: integrate d-back browser runtime#9
NNTin wants to merge 3 commits intofeat/plugin-system-for-runtime-extensibilityfrom
feat/integrate-d-back-browser-runtime

Conversation

@NNTin
Copy link
Owner

@NNTin NNTin commented Mar 18, 2026

Summary

  • Adds DBackRuntime (webview-ui/src/dback/DBackRuntime.ts): a browser-side WebSocket client that connects to a d-back server and maps Discord users to pixel agents
  • Integrates with the plugin system introduced in feat/plugin-system-for-runtime-extensibility (this branch is rebased on top of it)
  • Starts the runtime automatically in browser mode alongside the existing asset mock loading

How it works

  1. WebSocket protocol: connects to wss://hermes.nntin.xyz/dzone, sends { type: "connect", data: { server: "dworld" } }, receives server-join with the initial user list
  2. Agent mapping: each Discord user (uid, username, status, roleColor) becomes a pixel agent dispatched via window.dispatchEvent — the same bus the VS Code extension uses
  3. Live updates:
    • presence events → agent status changes (dnd → waiting bubble, offline → agent removed)
    • message events → short Write-tool animation (4 s) to simulate activity
  4. Auto-reconnect: exponential-free 5 s retry on disconnect
  5. Configuration: override URL/server via VITE_DBACK_WS_URL / VITE_DBACK_SERVER env vars

Test plan

  • Run cd webview-ui && npm run dev and open http://localhost:5173 in a browser — pixel agents should appear representing D-World Discord users
  • Observe agents updating their status as presence events arrive from the live server
  • Verify chat messages trigger typing animations on the corresponding agent
  • Confirm VS Code extension build still works (npm run build)
  • Confirm tests still pass (cd webview-ui && npm test)

🤖 Generated with Claude Code

Adds DBackRuntime — a browser-side plugin that connects to a d-back
WebSocket server (default: wss://hermes.nntin.xyz/dzone) and maps
Discord users to pixel agents in real time.

- src/dback/DBackRuntime.ts: WebSocket client that handles the d-back
  protocol (server-list → connect → server-join, presence, message).
  Each Discord user becomes a pixel agent; presence updates drive agent
  status; chat messages trigger short Write-tool animations.
  Reconnects automatically on disconnect.
- main.tsx: starts DBackRuntime in browser mode alongside asset loading
- .gitignore: ignore the cloned d-back/ directory

The live d-back instance at wss://hermes.nntin.xyz/dzone (D-World server,
id: dworld) is used by default. Override via VITE_DBACK_WS_URL /
VITE_DBACK_SERVER env vars.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Mar 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pixel-agents Ready Ready Preview, Comment Mar 19, 2026 2:17am

@NNTin NNTin changed the base branch from main to feat/stubbing-vscode March 18, 2026 17:20
@NNTin NNTin changed the base branch from feat/stubbing-vscode to feat/plugin-system-for-runtime-extensibility March 18, 2026 17:20
Two bugs fixed:

1. existingAgents post-layout flush (useExtensionMessages.ts):
   The d-back WebSocket responds asynchronously, so existingAgents
   arrives after layoutLoaded has already been processed. Previously
   agents were buffered in pendingAgents and never flushed (no second
   layoutLoaded fires). Now: if layoutReadyRef.current is true, agents
   are added to OfficeState immediately instead of buffered.

2. Stop removing agents on 'offline' status (DBackRuntime.ts):
   The mock d-back server randomly cycles statuses including 'offline',
   which was immediately closing agents in the pixel office. For a
   live-demo runtime the 'offline' status is treated as idle — agents
   stay in the office and just wander.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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