fix select boxes of models #105
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_shrimp#105
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implementation Spec for Issue #105
Objective
Make the model select boxes in the Hero Shrimp web UI show the models actually configured in the daemon's model catalog (the
models:section ofshrimp.yml, plus bundled defaults), instead of a hardcoded six-entry list, so operators can correctly choose a model that the router can actually resolve.Current Behavior
crates/hero_shrimp_web/ui/src/components/SettingsModal.tsx:27-30— the per-phase model inputs get their suggestions from a hardcodedKNOWN_MODELSarray (deepseek-v4-flash,deepseek-v4-pro,kimi-2.6,qwen-3.6-plus,mercury-2,minimax-m2.7). When the operator changes themodels:catalog inshrimp.yml, the suggestions no longer match anything configured, and picking one writes an unresolvable alias intollm.routing.<phase>.crates/hero_shrimp_web/ui/src/components/CrewPage.tsx:470-478— the hire-agent "Model" field is a plain text input with no suggestions at all.method_config_getincrates/hero_shrimp_server/src/rpc/methods/admin.rsnever exposes the configured catalog, so the UI has nothing real to populate from. The authoritative source ishero_shrimp_runtime::global_catalog()(aModelCatalogset at daemon boot and on live reloads).Requirements
config.getRPC response gains amodelsarray listing every configured catalog entry (alias plus light metadata: tier, ctx, caps), in alphabetical order.ModelCatalog::resolveacceptsprovider/model[@backend]strings), so the inputs stay datalist-backed combo boxes rather than strict selects.config.get).modelsfield is present and well-formed.crates/hero_shrimp_web/static/assets/is rebuilt.Files to Modify
crates/hero_shrimp_server/src/rpc/methods/admin.rs- extendmethod_config_getto emit amodelsarray fromglobal_catalog()crates/hero_shrimp_server/src/rpc/jsonrpc/tests/chunk_2.rs- test for the newmodelsfieldcrates/hero_shrimp_web/ui/src/store.ts- add aconfiguredModelssignal populated inloadConfig()crates/hero_shrimp_web/ui/src/components/SettingsModal.tsx- populate theknown-modelsdatalist from configured modelscrates/hero_shrimp_web/ui/src/components/CrewPage.tsx- attach a configured-models datalist to the hire-modal Model inputcrates/hero_shrimp_web/static/assets/*- regenerated build artifacts (npm run build)Implementation Plan
Step 1: Expose configured models through
config.getFiles:
crates/hero_shrimp_server/src/rpc/methods/admin.rsmethod_config_get, readhero_shrimp_runtime::global_catalog()and map each entry to{ alias, tier, ctx, caps }."models": modelsto the JSON response. Keep the payload small (noserveor pricing metadata). No secrets involved.Dependencies: none
Step 2: Backend test
Files:
crates/hero_shrimp_server/src/rpc/jsonrpc/tests/chunk_2.rsmethod_config_get, and assertsconfig["models"]is a non-empty array whose elements each have a non-empty stringalias. Assert shape only (globals are process-wide and tests run in parallel).Dependencies: Step 1
Step 3: Share configured models in the web store
Files:
crates/hero_shrimp_web/ui/src/store.tsexport const [configuredModels, setConfiguredModels] = createSignal<string[]>([]).loadConfig(), populate it from themodelsarray of theconfig.getresponse.loadConfig()already runs at boot and after every settings save, so the list stays fresh.Dependencies: Step 1
Step 4: Populate the Settings modal datalist from configuration
Files:
crates/hero_shrimp_web/ui/src/components/SettingsModal.tsxKNOWN_MODELStoFALLBACK_MODELSand use it only when the config resource reports no catalog.config.getresource (it refetches on save), falling back toFALLBACK_MODELSwhen empty.Dependencies: Step 1
Step 5: Add the configured-models datalist to the Crew hire modal
Files:
crates/hero_shrimp_web/ui/src/components/CrewPage.tsxconfiguredModelsfrom the store, render a<datalist id="crew-known-models">next to the hire-modal Model input, and setlist="crew-known-models"on it. Keep placeholder and free-text behavior (empty = inherit from cascade).Dependencies: Step 3
Step 6: Rebuild the committed UI bundle and verify
Files:
crates/hero_shrimp_web/static/assets/*npm run buildincrates/hero_shrimp_web/ui/and commit the regenerated assets.cargo checkandcargo test -p hero_shrimp_server.shrimp.ymlwhosemodels:list differs from the defaults, the Settings and Crew hire model inputs must suggest exactly the configured aliases.Dependencies: Steps 1-5
Acceptance Criteria
config.getresponse contains amodelsarray with one object per configured catalog entry (alias,tier,ctx,caps), reflectingshrimp.ymloverrides.anthropic/claude-opus-4@openrouter) still works in both places.cargo test -p hero_shrimp_serverpasses, including the newmodelsfield test.Notes
<select>elements, becauseModelCatalog::resolveaccepts non-catalogprovider/model[@backend]strings and the existing UI promises free text.config.getis preferred over a newmodels.listRPC because SettingsModal already consumesconfig.getwith refetch-on-save, and it avoids new method and auth wiring.global_catalog()is updated on live reload paths, so the list stays consistent with active routing without plumbing a catalog parameter through.Test Results
cargo test -p hero_shrimp_serveron branchintegration_fix_model_select_boxesThe new test
config_get_includes_model_catalogverifies themodelsarray in theconfig.getresponse.Implementation Summary
All changes are on branch
integration_fix_model_select_boxes(based onintegration).Changes
crates/hero_shrimp_server/src/rpc/methods/admin.rs—method_config_getnow emits amodelsarray sourced from the global model catalog (hero_shrimp_runtime::global_catalog()). Each entry carriesalias,tier,ctx, andcaps, sorted alphabetically by alias. Empty array when no catalog is loaded.crates/hero_shrimp_server/src/rpc/jsonrpc/tests/chunk_2.rs— new testconfig_get_includes_model_catalogasserting themodelsfield is a non-empty array whose entries each have a non-emptyalias.crates/hero_shrimp_web/ui/src/store.ts— new sharedconfiguredModelssignal, populated inloadConfig()from themodelsfield; refreshed at boot and after every settings save.crates/hero_shrimp_web/ui/src/components/SettingsModal.tsx— the per-phase model inputs' datalist is now populated from the configured catalog reported byconfig.get; the old hardcoded list remains only asFALLBACK_MODELSfor daemons that report no catalog. Inputs stay datalist-backed combo boxes, so free-textprovider/model[@backend]entries remain valid.crates/hero_shrimp_web/ui/src/components/CrewPage.tsx— the hire-agent Model field now offers the same configured-model suggestions via acrew-known-modelsdatalist; free text and empty-means-inherit behavior unchanged.crates/hero_shrimp_web/static/— UI bundle rebuilt (app.D5h1qBfB.js); regenerated artifacts committed.Test Results
cargo test -p hero_shrimp_server: 308 total — 305 passed, 0 failed, 3 ignored (pre-existing ignored doc-tests).Notes
shrimp.ymlmodels:section plus bundled defaults), including after live config reloads, with no restart needed.provider/model[@backend]strings.