Skip to content

feat(tools)!: catalog tools on stock routes; model policy in tenant config (CL-8170) - #773

Merged
TheGreatAxios merged 5 commits into
mainfrom
cl-8170-catalog-tools
Sep 17, 2026
Merged

TheGreatAxios merged 5 commits into
mainfrom
cl-8170-catalog-tools

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Summary

@corbits/catalog-tools (list_model_concepts, pick_models,
estimate_run_cost) no longer talks to a Workbench-only hub route. It now
reads two stock Interchange tenant routes with the run's own bearer, and
resolves the model chain itself:

  • GET /api/tenants/:tenantId/models — the bench's resolved model catalog
    (offerings + active price per currency), flattened by the new
    @corbits/inference-catalog catalog.ts into the plain rows
    resolveModelChain ranks.
  • GET /api/tenants/:tenantId — the bench itself, for its model policy at
    config.corbits.modelPolicy (schema and reader in
    @corbits/inference-catalog/policy.ts).

Deleted: packages/inference-catalog/src/workflow-catalog-routes.ts, its
pg-store/migrations/schema (bench_model_policy table), and the hub's
/api/workflow-inference-catalog mount. There is no hub-side chain
resolution left for this bundle — it all runs in the workflow child
(packages/catalog-tools/src/chain.ts).

corbits.modelPolicy config shape

{
  "corbits": {
    "modelPolicy": {
      "allow": ["string selectors"],       // canonical name | "provider:<name>" | "<provider>/<name>"
      "deny": ["string selectors"],
      "maxInputUsdPerMTok": 3.0,           // or null
      "maxOutputUsdPerMTok": 15.0,         // or null
      "ceilingIsHard": false,              // soft (demote) vs hard (exclude)
      "conceptCeilings": {
        "<conceptId>": { "maxInputUsdPerMTok": 50, "maxOutputUsdPerMTok": 100 }
      },
      "providerPreference": { "mode": "pin" | "prefer", "order": ["providerName"] } // or null
    }
  }
}

Every key is optional; a missing or malformed blob reads as
EMPTY_POLICY (unconstrained), never an error.

Notes for reviewers

  • This finishes CL-8170, picking up a branch a prior agent left mid-fix.
    My work here was: rewriting the stale resolve-chain.test.ts,
    price.test.ts, client.test.ts, tool.test.ts and
    test/fixtures.ts against the new pure CatalogOffering/
    CatalogPricingRow shapes (no more asOf/connectivity/provenance
    concerns, since those are the platform's own job now); bumping
    @corbits/catalog-tools to 0.1.0 and its pin in
    workflows/assistant/src/prompt.ts; regenerating tsconfig references
    and the changeset ignore list; and rebasing onto origin/main (which
    had, unrelated to this PR, deleted @corbits/bench and its
    bench-settings mount — cleaned up a stray reintroduction of that dead
    code from the rebase's own conflict resolution).
  • bun run typecheck, bun test (workspace-wide check:structural
    suite included), and bun run lint are all green locally.

Test plan

  • bun run typecheck
  • bun test packages/catalog-tools packages/inference-catalog
  • bun run lint
  • bun run check:structural
  • CI

@linear-code

linear-code Bot commented Sep 17, 2026

Copy link
Copy Markdown

CL-8170

Deletes the bench_model_policy table and pg-store: bench model policy now
lives under the tenant's own config blob at corbits.modelPolicy, read with
the stock GET /api/tenants/:tenantId. Adds catalog.ts, a pure flattening of
the stock GET /api/tenants/:tenantId/models discovery response into the
offering/pricing rows resolveModelChain ranks, so chain resolution has no
database and no Workbench-only route anywhere near it.
list_model_concepts, pick_models and estimate_run_cost no longer call a
Workbench-only hub route. They read the run's bench catalog and model
policy directly off the stock GET /api/tenants/:tenantId/models and GET
/api/tenants/:tenantId (client.ts), and resolve the chain themselves
(chain.ts) with @corbits/inference-catalog's pure resolver — the hub does
no chain computation for this bundle at all.
Removes the dedicated /api/workflow-inference-catalog route, its
migrations, and the bench_model_policy pg-store now that
@corbits/catalog-tools resolves its own chains off stock tenant routes.
Bumps the catalog-tools pin in the assistant workflow to match the
package's new minor version.
@TheGreatAxios
TheGreatAxios merged commit d63985b into main Sep 17, 2026
2 of 13 checks passed
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