Skip to content

Wire alien-x-llm UCEP provider and document production LLM path #1

@Nkovaturient

Description

@Nkovaturient

Description

  • Scope: Production intelligence via terminal alien-x-llm (UCEP), not browser Ollama/OpenAI on Vercel.
  • Not in scope: Running Ollama on Vercel serverless or exposing VITE_OPENAI_API_KEY in the static UI (see README production section).

Problem

  • On hosted UI (HTTPS / Vercel), browser direct LLM is intentionally disabled (isBrowserDirectLLMEnabled()). Chat depends on discovering and calling alien-x-llm on the terminal agent.

  • Current gaps:
    - app/index.js logs [UCEP] LLM extension registered: alien-x-llm but does not call registerExtension (only echo is registered). Browser Identify finds echo only — no alien-x-llm protocol.
    - LLMService is imported and used for file analysis but never instantiated (llmService is undefined at runtime).
    - llm-extension-provider.js referenced in docs is missing from app/.
    - Users expect Ollama/OpenAI on Vercel via /api/ollama-proxy; proxy cannot reach 127.0.0.1:11434 and is not the intended production architecture.

Acceptance Criteria

  • Terminal registers alien-x-llm via registerExtension with handler calling LLMService.generateResponse.
  • After browser dials agent on /ws (local) or production transport (see connectivity issue), Identify lists /uc/extension/alien-x-llm/1.0.0.
  • window.testExtension('alien-x-llm', 'chat', ['ping']) returns a reply with Ollama or OpenAI configured on the terminal (OPENAI_*, LLM_MODEL).
  • Browser chat on production host shows Alien X replies via UCEP (no UCEP_ONLY_HINT) when agent is connected.
  • README / app/README.md state clearly: Vercel = UI only; LLM runs on operator's terminal; optional VITE_ALLOW_BROWSER_LLM documented as dev-only escape hatch.

Reference

  • README.md § Production (UCEP-only LLM)
  • p2p-X/web/LLM_UCEP_ARC.md
  • src/lib/llm.js, src/lib/llm-ucep-client.js, app/agent-llm.js, app/index.js

Demo or Repro (show)

Local (expected after fix):

  1. cd p2p-X/web/app && npm start — confirm Identify advertises alien-x-llm.
  2. cd p2p-X/web && npm run dev — dial /ws multiaddr, mesh sync.
  3. Chat message → Alien X reply via UCEP (not browser fetch to Ollama).

Production:

  1. Deploy UI to Vercel without VITE_ALLOW_BROWSER_LLM.
  2. Run terminal agent with OPENAI_API_KEY or OLLAMA reachable from that host.
  3. Connect using production multiaddr (blocked today — see connectivity issue).

Current repro: Browser console shows only echo extension from agent; resolveAlienXReply falls through to UCEP_ONLY_HINT on non-localhost.

Browser Console logs

[P2P] Spawning browser libp2p node (ws + circuit-relay + gossipsub)...
stores.js:13 [P2P] Node ready as nGDFs6pe
extension-provider.js:13 📦 Registering extension: echo v1.0.0 at /uc/extension/echo/1.0.0
extension-provider.js:92  Extension echo registered and will be advertised via Identify
stores.js:13 [P2P] Example extension registered: echo
chatroom.js:67 [CHAT] Subscribed to topic: universal-connectivity
chatroom.js:70 [CHAT] Subscribed to discovery topic: universal-connectivity-browser-peer-discovery
chatroom.js:105 [CHAT] Message handlers registered successfully
chatroom.js:46 [CHAT] Joined chat room as: nGDFs6pe
ucep-client.js:26 🔍 Extension Test Client: Starting...
ucep-client.js:33  Extension Test Client: Listening for extensions
stores.js:13 [P2P] UCEP extension discovery client initialized
gossipsub-extension-manager.js:32 📡 GossipSub Extension Manager: Starting...
gossipsub-extension-manager.js:36  Subscribed to extension discovery topic: universal connectivity
gossipsub-extension-manager.js:47  GossipSub Extension Manager: Listening for extensions
stores.js:13 [P2P] GossipSub extension manager initialized
p2p.js:210 🌐 Extension commands available:
p2p.js:211   - window.listExtensions() - List all discovered extensions
p2p.js:212   - window.testExtension(id, cmd, args) - Test UCEP extension
p2p.js:213   - window.installExtension(id) - Install GossipSub extension
p2p.js:214   - window.executeExtensionCommand(id, cmd, args) - Execute GossipSub extension command
stores.js:13 [P2P] Dialing Agent at /ip4/127.0.0.1/tcp/54006/ws/p2p/12D3KooWPjLTB6oCBz7RAV9cX6APbFBY3CtMUhHjhdZ9QoB8xANT
stores.js:13 [P2P] Connected to peer QoB8xANT
stores.js:13 [P2P] Identify complete with QoB8xANT
ucep-client.js:43 🔍 Peer identified: 12D3KooW... with 12 protocols
ucep-client.js:51 📦 Found extension: echo v1.0.0 from peer 12D3KooW...
extension-provider.js:46  Sent manifest for echo
chatroom.js:87 [GOSSIPSUB] subscription-change from QoB8xANT: [{"topic":"universal-connectivity","subscribe":true},{"topic":"universal-connectivity-workshop-js-peer-discovery","subscribe":true}]
chatroom.js:92 [GOSSIPSUB]  Peer QoB8xANT subscribed to universal-connectivity
chatroom.js:99 [GOSSIPSUB] Mesh snapshot: 1 subscriber(s)
chatroom.js:100 [GOSSIPSUB]   - QoB8xANT
ucep-client.js:92 🔍 Extension Test Client: Received response: Object
ucep-client.js:61  Extension discovered: Echo Extension
ucep-client.js:62    Description: Echoes back messages for testing UCEP
ucep-client.js:63    Commands: echo, ping
2stores.js:13 [P2P] Message from QoB8xANT
stores.js:13 [P2P] Mesh formed with 1 peer(s)
stores.js:13 [P2P] Mesh active with 1 peer(s)
chatroom.js:200 [CHAT] Publishing message to 1 peer(s) in mesh
chatroom.js:207 [CHAT]  Message sent: "Hello! I'm nGDFs6pe - ready to chat!"
chatroom.js:200 [CHAT] Publishing message to 1 peer(s) in mesh
chatroom.js:207 [CHAT]  Message sent: "echo "hii""
chatroom.js:200 [CHAT] Publishing message to 1 peer(s) in mesh
chatroom.js:207 [CHAT]  Message sent: "ping"
stores.js:13 [P2P] Sending file chainpulse-logo.png to QoB8xANT...

Metadata

Metadata

Labels

bugSomething isn't workinghelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions