Class DemoCatalog

java.lang.Object
ai.redouble.demo.DemoCatalog

public class DemoCatalog extends Object
Which model catalog this process runs on, and what to do when it is not this account's. The runtime reads models.json the way logback reads its configuration: the file -Dnucleo.models names, else the classpath, nearest first. The demo keeps it in its module's src/main/resources (DemoHome), from where every build carries it onto the classpath. Without one, the runtime runs on the providers' shipped defaults, which know nothing of this account's models, limits or pins; the demo then says so at startup and at the top of its page, with the steps that fix it. The discovery itself is the person's to run, through the page's Discover button, their coding agent or AGENTS.md: it spends on their account and writes a file they own, so the demo never runs it unasked. Once that file exists, the page edits it here too - a grade, a status, a pin - each edit validated by loading before it is written and adopted by the runtime live.
Since:
0.1 (2026-09-17)
Author:
Andrey Santrosyan
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    What the page and the startup log say about the catalog: the file the demo keeps it in (catalogFile, null when the process runs outside its module), where it was read from (null when nowhere, and the runtime is on the shipped defaults), the file the page's edits land in (null when the catalog in use is not a file of the deployment's own: the shipped defaults, or a copy packaged on the classpath), how many entries it has, each grade's order (its entries in the deployment's order of preference, the first the grade's default), the single pins (the embeddings and the decision entry), and the steps a person takes when something is missing.
  • Constructor Summary

    Constructors
    Constructor
    Description
    DemoCatalog(String module, String discoverCommand)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    editEntry(String id, String grade, String status, Double inputPricePerMillion, Double outputPricePerMillion, Boolean confirmed)
    An edit from the page to one entry of the deployment's own catalog file: its grade (a rung of the ladder; only an entry that carries one, since an embeddings entry, a decision entry or a model of another modality is on no rung) and its status, where a person's words are OPEN and DISABLED alone - DEPRECATED is the vendor's, UNLISTED the account's and UNREACHABLE this deployment's reach, all written by the discovery; its prices per million tokens in the entry's currency (an input price on any entry, an output price only on an LLM entry, since an embeddings or a decision call has no output the provider bills; never negative); and a confirmation.
    void
    Once the application is up: the catalog it runs on, and the steps to fix it when it is not this account's.
    order(String grade, List<String> ids)
    A grade's order from the page: its entries in the deployment's order of preference, the first the grade's default, replacing the order it had; an empty list clears it, leaving the grade to its cheapest entries.
    pin(String slot, String id)
    A single pin from the page: slot is embeddings (the embeddings entry) or decision (the entry that answers decisions); a null id clears it.
    The catalog as this process reads it now, and the file the demo writes it to (DemoHome.catalogFile(), null outside its module).

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DemoCatalog

      public DemoCatalog(String module, String discoverCommand)
  • Method Details

    • status

      public DemoCatalog.Status status()
      The catalog as this process reads it now, and the file the demo writes it to (DemoHome.catalogFile(), null outside its module).
    • editEntry

      public DemoCatalog.Status editEntry(String id, String grade, String status, Double inputPricePerMillion, Double outputPricePerMillion, Boolean confirmed)
      An edit from the page to one entry of the deployment's own catalog file: its grade (a rung of the ladder; only an entry that carries one, since an embeddings entry, a decision entry or a model of another modality is on no rung) and its status, where a person's words are OPEN and DISABLED alone - DEPRECATED is the vendor's, UNLISTED the account's and UNREACHABLE this deployment's reach, all written by the discovery; its prices per million tokens in the entry's currency (an input price on any entry, an output price only on an LLM entry, since an embeddings or a decision call has no output the provider bills; never negative); and a confirmation. A null leaves the field as it is. An entry moved to another grade leaves the order of the grade it left. The embeddings or decision entry cannot be disabled; the pin comes off first. An entry the discovery inferred (unverified) stops being so when a person edits its grade or a price, or confirms it as it is. The file is validated by loading it before it is written, so a price with no currency to be in is refused by the loader's own rule, and the runtime adopts it live.
      Throws:
      IllegalArgumentException - when the entry, the grade, the status or a price is not one the edit can apply to
      IllegalStateException - when the process has no file to edit or create: outside its module, on the build's copy
    • pin

      public DemoCatalog.Status pin(String slot, String id)
      A single pin from the page: slot is embeddings (the embeddings entry) or decision (the entry that answers decisions); a null id clears it. A grade is no pin slot: its entries are ordered (order(String, List)). Only an open entry can be pinned, and the loader's own rules apply on top: the embeddings pin names an embeddings entry, the decision pin a decision entry. Validated by loading before it is written, and adopted live.
      Throws:
      IllegalArgumentException - when the slot, the entry or the pairing is not one the loader accepts
      IllegalStateException - when the process has no file to edit or create: outside its module, on the build's copy
    • order

      public DemoCatalog.Status order(String grade, List<String> ids)
      A grade's order from the page: its entries in the deployment's order of preference, the first the grade's default, replacing the order it had; an empty list clears it, leaving the grade to its cheapest entries. The runtime serves a request of the grade from the first entry of the order it can call that accepts what the request sends. The loader's rules apply on top: every id an entry of the catalog, a graded LLM entry of the grade or above, each once. Validated by loading before it is written, and adopted live.
      Throws:
      IllegalArgumentException - when the grade or an entry is not one the loader accepts
      IllegalStateException - when the process has no file to edit or create: outside its module, on the build's copy
    • logReport

      public void logReport()
      Once the application is up: the catalog it runs on, and the steps to fix it when it is not this account's. Each host calls this when it is ready to serve, and stays quiet under its discover command, which is the fix running.