Class CatalogAdmin

java.lang.Object
ai.redouble.demo.CatalogAdmin

public class CatalogAdmin extends Object
The demo's write-side catalog logic, shared by every host: connecting a credential for the session, running the discovery that writes the deployment's catalog, and editing or pinning one of its entries. It is the twin of DemoApi: the same read-side status shape, and the mutations the page drives it with, computed here once so no host carries a copy that can drift. A host adds only its routing - it maps a route to one of these calls, hands over its own SessionStore, and maps a refusal to its framework's status code: an IllegalArgumentException is a bad request, an IllegalStateException a conflict, an UncheckedIOException a server error.

The per-provider discovery fingerprints live here because this is the process-wide singleton both hosts hold one of; a request-scoped resource would forget them between clicks.

Since:
0.1 (2026-09-24)
Author:
Andrey Santrosyan
  • Constructor Details

  • Method Details

    • status

      public RuntimeStatus status()
      The status the page renders, including whether each credential is held by the session store.
    • connect

      public ConnectOutcome connect(ConnectRequest input)
      Holds the credentials for the session and tests them right then. A credential the deployment already configures is refused rather than shadowed - session credentials fill gaps, they never override, because the app's clients are constructed once around a credential and shared. A credential this store itself holds may be corrected, and the affected providers' cached clients are evicted in the same breath so the next call is built around the new value. All records validate before any is held, so a refused request holds nothing.
    • discover

      public DiscoverOutcome discover()
      The discovery, on a click instead of a terminal, and incremental: only providers whose credentials are new or changed since their last discovery this session are listed and pinged; everything already discovered rides through the scoped CatalogDiscovery.run(boolean, Set) untouched, so a second click costs nothing unless something changed. What ran is remembered as a fingerprint (a hash of the credential parts and the connection facts, never the values). The result (models, limits, pins - never a credential) is written to the demo's catalog file (DemoHome.catalogFile(), its module's src/main/resources/models.json) and Models.reload() adopts it live. A process outside its module has no such file and is refused before anything is pinged.
    • editEntry

      public RuntimeStatus editEntry(EntryEdit edit)
      One entry of the deployment's own catalog file, edited from the page: its grade, its status (OPEN or DISABLED), its input or output price, or a confirmation of its inferred facts; a null leaves the field alone. DemoCatalog.editEntry(String, String, String, Double, Double, Boolean) states the rules and validates the file by loading it before it is written; the runtime adopts it live. A refused edit is an IllegalArgumentException; an edit with no file of the deployment's own to land in is an IllegalStateException.
    • pin

      public RuntimeStatus pin(PinEdit edit)
      One pin of the deployment's own catalog file, set or cleared from the page: the embeddings entry or the decision entry; DemoCatalog.pin(String, String) states the rules.
    • order

      public RuntimeStatus order(OrderEdit edit)
      One grade's order of the deployment's own catalog file, set from the page (a row dragged or moved, a benchmark's order applied) or cleared; DemoCatalog.order(String, List) states the rules.