Skip to content

One-click discovery: teach DreamLayer to find your local agent #388

Description

@LetsGetToWorkBro

The Brain panel now auto-scans your machine for a running local agent and connects in one tap, nothing to type. It probes the usual suspects — Ollama, LM Studio, Jan, vLLM, llama.cpp/LocalAI, Text-Gen-WebUI. If you run something it doesn't know yet, let's teach it to find yours.

What: add your local server to the discovery probe list so opening "Your API" finds it automatically. Good candidates not covered yet: GPT4All (:4891), KoboldCpp (:5001), Msty, LocalAI on a nonstandard port, or whatever you actually run at home.

Start here:

  • host-python/src/dreamlayer/ai_brain/server/backends.py — _LOCAL_AGENT_PROBES (~line 178). Add one dict: label, provider ("ollama" only for the Ollama /api/tags shape; everything OpenAI-compatible is "custom"), base_url (saved verbatim — use the /v1 form for OpenAI-compatible servers; the no-double-/v1 rule in _build_request handles the rest), and models_url (the endpoint that lists models).
  • Every probe must be a localhost address. That's the invariant that keeps one-click connect from ever wiring a remote endpoint — a discovered agent is on-device by construction. Don't add a LAN or public host.
  • _models_from(data) already parses both the Ollama (models[].name) and OpenAI (data[].id) shapes — reuse it. If your server returns a third shape, extend that one function.

Test (no network needed):

  • host-python/src/dreamlayer/tests/test_primary_api_brain.py → TestOneClickDiscovery. discover_local_agents(getter=fake) takes an injected getter, so you fake the HTTP response and assert your agent shows up with its model list. Mirror test_discover_returns_only_reachable_with_models.

Done means: your server is discovered when it's running, absent when it isn't, the base URL round-trips through _build_request without doubling /v1, and the new test passes with the rest of the suite (pytest -m "not hardware"). Sign your commits (git commit -s) — CI checks DCO.

No hardware needed — everything runs in the test suite.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions