model: every choice is provider/model; no main row

The picker and the text list now say what goes on the command line:
junction/qwen3.6-35b-judged, local/qwen3.6-35b. Labels and selectors are the
same string, so there is no second format to explain.

- the core endpoint (the endpoint/model without a provider block) is called
  "local" in every choice; its old name "main" is still accepted as a selector
  so existing drop-ins and session files keep working.
- sp_provider_choose("local/model") resolves to the core endpoint; a configured
  provider with that name wins if one exists.
- /model, /model probe and the served-model list all emit provider/model.
- the session sidecar stores provider/model (junction/qwen3.6-35b).
- the sidebar and /usage print "local" for the core endpoint.
- -m provider/model no longer produces an extra main row, and 90-model.conf
  (the old global /model file) was moved aside; the config's provider wins.
- tests and docs use local/test-model and local/m.

make check: all tests passed.
This commit is contained in:
lotherk committed 2026-11-18 12:22:52 +00:00
1 parent 056b8c4277
commit 6813fff1b5
12 files changed
+105 -56

No files matched your search

+3 -3
View File
@@ -583,7 +583,7 @@ list-price arithmetic.
`/new` (or `/reset`) starts a fresh conversation and a fresh session file; the
old one stays on disk, and the system prompt is put back.
`/model` lists the models the config names (the main endpoint, every delegate
`/model` lists the models the config names (the core endpoint, every delegate
with a model, every exit) as buttons and points the running transport at the
one you press. The choice is written to the session's sidecar
(`<session>.model`) and comes back when that session is opened again, so one
@@ -594,8 +594,8 @@ really serve.
In the curses chat, `/model` alone opens a picker: Up/Down move, typing filters
by provider or model, Enter takes the highlighted selector, Esc cancels. The
rows are named after the configured provider (`junction qwen3.6-35b-judged`);
`-m provider/model` does not invent a second "main" row for the same endpoint. After
rows are the full selector (`junction/qwen3.6-35b-judged`);
`-m provider/model` does not invent a second row for the same endpoint. After
the configured list appears, the picker asks the endpoint this session is on
what it serves and adds those models, so a router's whole menu is selectable
and not only the one alias in the config. It is the same list the clients get
+5 -5
View File
@@ -23,7 +23,7 @@ harness will not start. An error names the line you wrote.
```
core {
default = main # a provider or a pool, below
default = provider/model # a provider, provider/model, or a pool
theme = Xresources
autonomous = true
steps = 60
@@ -123,7 +123,7 @@ splinter -m some-model-name # a model that one provider has
Without `-m`, `default` in `core` decides. The order is: `-m` on the command
line, then the last `default` from the config and its drop-ins (a `/model`
choice writes one), then the `endpoint`/`model` of the `core` block (the main
endpoint). An explicit `default` is never shadowed by a main endpoint.
endpoint). An explicit `default` is never shadowed by a core endpoint.
## Agent profiles: build, plan and your own
@@ -252,10 +252,10 @@ lies about what it does.
| `env_delegates` | `1` turns `CLAUDE_CODE_OAUTH_TOKEN(_N)` into delegates (default off) |
| `on_limit` | `wait` (default) or `fail`: what a usage limit does |
| `max_wait` | longest wait for a limit, e.g. `6h`, `2d` (default 12h) |
| `kind` | of the main provider: `openai` (default) or `anthropic` |
| `kind` | of the core endpoint: `openai` (default) or `anthropic` |
| `default` | the provider or pool the conversation starts on |
| `pool` | `pool = id \| strategy=failover\|balance \| members=a,b` |
| `limit`, `tokens` | allowance of the main provider, see Usage limits |
| `limit`, `tokens` | allowance of the core endpoint, see Usage limits |
| `exit` | one way to reach a model for the exit ring, see below |
| `delegate` | another model the `delegate` tool can hand work to, see below |
| `mcp` | an MCP server whose tools become splinter's tools, see below |
@@ -290,7 +290,7 @@ calls: one line per call in `~/.splinter/usage/<id>.log`, shared by every
splinter on the machine. You declare the allowance:
```
limit = 45/5h # the main provider: 45 calls per 5 hours
limit = 45/5h # the core endpoint: 45 calls per 5 hours
tokens = 2000000/7d # and/or tokens per window (5m, 5h, 7d, 2w)
delegate = claude-a | Claude Pro A | kind=cli | cmd=claude -p | tags=plan | limit=45/5h
delegate = claude-b | Claude Pro B | kind=cli | cmd=claude -p | tags=plan | limit=45/5h | env=CLAUDE_CODE_OAUTH_TOKEN=...
+1 -1
View File
@@ -159,7 +159,7 @@ curses front end, plugin commands and `commands/` programs included.
### `{"cmd":"models"}`
The list `/model` takes, for a picker: `"ev":"models"` with
`"items":[{"sel":"junction","label":"junction qwen3.6-35b","current":true},...]`.
`"items":[{"sel":"junction/qwen3.6-35b","label":"junction/qwen3.6-35b","current":true},...]`.
`sel` is what goes after `/model `, `label` is what the picker shows, and
`current` marks the model the run is on. Without an argument it is the
configuration (providers, then pools), so it answers at once. With
+25 -34
View File
@@ -364,13 +364,10 @@ sp_engine_served_models(struct sp_engine *e, struct sp_model_choice *v,
m != NULL && n < max; m = strtok_r(NULL, "\n", &save)) {
if (*m == '\0' || strcmp(m, p.model) == 0)
continue;
if (p.main || strcmp(p.id, "main") == 0)
snprintf(v[n].sel, sizeof(v[n].sel), "%s", m);
else
snprintf(v[n].sel, sizeof(v[n].sel), "%s/%s",
p.id, m);
snprintf(v[n].label, sizeof(v[n].label), "%s %s",
p.id, m);
snprintf(v[n].sel, sizeof(v[n].sel), "%s/%s",
sp_provider_label(p.id), m);
snprintf(v[n].label, sizeof(v[n].label), "%s/%s",
sp_provider_label(p.id), m);
v[n].current = strcmp(m, e->cur_model) == 0;
n++;
}
@@ -471,8 +468,9 @@ current_model_selector(struct sp_engine *e, char *buf, size_t cap)
{
const char *act = sp_usage_active();
if (act != NULL && *act != '\0' && strcmp(act, "main") != 0)
snprintf(buf, cap, "%s/%s", act, e->cur_model);
if (act != NULL && *act != '\0')
snprintf(buf, cap, "%s/%s", sp_provider_label(act),
e->cur_model);
else
snprintf(buf, cap, "%s", e->cur_model);
}
@@ -1818,8 +1816,8 @@ cmd_model_apply(struct sp_engine *e, const char *args, struct sp_buf *out,
n = sp_provider_count(e->conf);
for (i = 0; i < n; i++)
if (sp_provider_at(e->conf, i, &p) == 0)
sp_buf_printf(out, "\n %s %s%s",
p.id, p.model,
sp_buf_printf(out, "\n %s/%s%s",
sp_provider_label(p.id), p.model,
strcmp(p.model, e->cur_model) == 0 ?
" *" : "");
if (e->conf->npools > 0)
@@ -1857,13 +1855,8 @@ cmd_model_apply(struct sp_engine *e, const char *args, struct sp_buf *out,
m != NULL; m = strtok_r(NULL, "\n", &save)) {
if (*m == '\0')
continue;
if (p.main ||
strcmp(p.id, "main") == 0)
sp_buf_printf(out,
"\n %s", m);
else
sp_buf_printf(out,
"\n %s/%s", p.id, m);
sp_buf_printf(out, "\n %s/%s",
sp_provider_label(p.id), m);
total++;
}
}
@@ -1891,7 +1884,8 @@ cmd_model_apply(struct sp_engine *e, const char *args, struct sp_buf *out,
snprintf(e->cur_model, sizeof(e->cur_model), "%s",
ch.model[0] != '\0' ? ch.model : ch.d->model);
session_model_note(e, poolname, out,
e->cur_model, ch.d->id);
e->cur_model,
sp_provider_label(ch.d->id));
}
sp_buf_free(&perr);
}
@@ -1902,11 +1896,16 @@ cmd_model_apply(struct sp_engine *e, const char *args, struct sp_buf *out,
sp_buf_printf(out, sp_t("model.failed"),
perr.p != NULL ? perr.p : "?");
} else if (sp_provider_at(e->conf, idx, &p) == 0) {
char sel[320];
snprintf(e->cur_endpoint, sizeof(e->cur_endpoint), "%s",
p.endpoint);
snprintf(e->cur_model, sizeof(e->cur_model), "%s",
p.model);
session_model_note(e, p.id, out, p.model, p.id);
snprintf(sel, sizeof(sel), "%s/%s",
sp_provider_label(p.id), p.model);
session_model_note(e, sel, out, p.model,
sp_provider_label(p.id));
}
sp_buf_free(&perr);
} else {
@@ -1931,13 +1930,10 @@ cmd_model_apply(struct sp_engine *e, const char *args, struct sp_buf *out,
"%s", ch.d->endpoint);
snprintf(e->cur_model, sizeof(e->cur_model), "%s",
model);
if (strcmp(ch.d->id, "main") == 0)
snprintf(sel, sizeof(sel), "%s", model);
else
snprintf(sel, sizeof(sel), "%s/%s",
ch.d->id, model);
snprintf(sel, sizeof(sel), "%s/%s",
sp_provider_label(ch.d->id), model);
session_model_note(e, sel, out, e->cur_model,
ch.d->id);
sp_provider_label(ch.d->id));
}
sp_buf_free(&perr);
} else {
@@ -1963,15 +1959,10 @@ cmd_model_apply(struct sp_engine *e, const char *args, struct sp_buf *out,
if (ok) {
snprintf(e->cur_model,
sizeof(e->cur_model), "%s", args);
if (p.main ||
strcmp(p.id, "main") == 0)
snprintf(sel, sizeof(sel), "%s",
args);
else
snprintf(sel, sizeof(sel),
"%s/%s", p.id, args);
snprintf(sel, sizeof(sel), "%s/%s",
sp_provider_label(p.id), args);
session_model_note(e, sel, out, args,
p.id);
sp_provider_label(p.id));
} else {
sp_buf_printf(out, sp_t("model.failed"),
perr.p != NULL ? perr.p : "?");
+53 -3
View File
@@ -139,6 +139,14 @@ sp_provider_find(const struct sp_config *cfg, const char *id, size_t *idx)
return 0;
}
const char *
sp_provider_label(const char *id)
{
if (id == NULL || *id == '\0' || strcmp(id, "main") == 0)
return "local";
return id;
}
size_t
sp_provider_choices(const struct sp_config *cfg, const char *cur_model,
struct sp_model_choice *v, size_t max)
@@ -152,9 +160,17 @@ sp_provider_choices(const struct sp_config *cfg, const char *cur_model,
for (i = 0; i < n && k < max; i++) {
if (sp_provider_at(cfg, i, &p) != 0)
continue;
snprintf(v[k].sel, sizeof(v[k].sel), "%s", p.id);
snprintf(v[k].label, sizeof(v[k].label), "%s %s", p.id,
p.model);
const char *name = sp_provider_label(p.id);
if (p.model[0] != '\0') {
snprintf(v[k].sel, sizeof(v[k].sel), "%s/%s", name,
p.model);
snprintf(v[k].label, sizeof(v[k].label), "%s/%s", name,
p.model);
} else {
snprintf(v[k].sel, sizeof(v[k].sel), "%s", name);
snprintf(v[k].label, sizeof(v[k].label), "%s", name);
}
v[k].current = cur_model != NULL && *cur_model != '\0' &&
strcmp(p.model, cur_model) == 0;
k++;
@@ -1082,6 +1098,26 @@ sp_pool_pick(const struct sp_config *cfg, const struct sp_pool *p,
return best;
}
/* one static stand-in for the core endpoint, filled per selection */
static struct sp_delegate main_d;
static int
main_choice(const struct sp_config *cfg, const char *model,
struct sp_choice *out)
{
memset(&main_d, 0, sizeof(main_d));
snprintf(main_d.id, sizeof(main_d.id), "main");
snprintf(main_d.kind, sizeof(main_d.kind), "%s", cfg->kind);
snprintf(main_d.endpoint, sizeof(main_d.endpoint), "%s",
cfg->endpoint);
snprintf(main_d.key_env, sizeof(main_d.key_env), "%s", cfg->key_env);
snprintf(main_d.model, sizeof(main_d.model), "%s",
model != NULL && *model != '\0' ? model : cfg->model);
out->d = &main_d;
snprintf(out->model, sizeof(out->model), "%s", main_d.model);
return 0;
}
int
sp_provider_choose(const struct sp_config *cfg, const char *sel,
struct sp_choice *out)
@@ -1110,6 +1146,15 @@ sp_provider_choose(const struct sp_config *cfg, const char *sel,
snprintf(out->model, sizeof(out->model), "%s", d->model);
return 0;
}
/*
* The core endpoint has no provider block. It is called "local" in a
* selector; "main" stays an alias for old configurations and files.
* The static delegate is filled per call and only used by apply().
*/
if ((strcmp(sel, "local") == 0 || strcmp(sel, "main") == 0) &&
cfg->endpoint[0] != '\0') {
return main_choice(cfg, NULL, out);
}
/* provider/model: the provider's id is the part before the first '/' */
slash = strchr(sel, '/');
if (slash != NULL && slash != sel) {
@@ -1119,6 +1164,11 @@ sp_provider_choose(const struct sp_config *cfg, const char *sel,
if (n < sizeof(id)) {
memcpy(id, sel, n);
id[n] = '\0';
if ((strcmp(id, "local") == 0 ||
strcmp(id, "main") == 0) &&
cfg->endpoint[0] != '\0' &&
delegate_by_id(cfg, id) == NULL)
return main_choice(cfg, slash + 1, out);
d = delegate_by_id(cfg, id);
if (d == NULL && sp_pool_find(cfg, id) != NULL) {
p = sp_pool_find(cfg, id);
+6
View File
@@ -152,6 +152,12 @@ struct sp_choice {
int sp_provider_choose(const struct sp_config *, const char *sel,
struct sp_choice *out);
/*
* The name people see: the core endpoint is "local", never "main"; every
* configured provider keeps its id. Selectors are always "<name>/<model>".
*/
const char *sp_provider_label(const char *id);
/*
* The provider the conversation is on is at its limit: move to another member
* of its pool that has room. 1 when the agent now talks to another provider.
+2 -1
View File
@@ -378,7 +378,8 @@ sp_usage_report(const struct sp_config *cfg, struct sp_buf *out)
sp_usage_brief(&u, brief, sizeof(brief));
if (u.frac >= 0)
bar(u.frac, b, sizeof(b));
snprintf(line, sizeof(line), "%-14.14s %s %s", ids[i], b, brief);
snprintf(line, sizeof(line), "%-14.14s %s %s",
sp_provider_label(ids[i]), b, brief);
(void)wr;
sp_buf_puts(out, line);
if (u.req_limit > 0)
+2 -1
View File
@@ -1247,7 +1247,8 @@ draw_sidebar(struct ui_state *s, const char *id, const char *dir,
printed = 1;
}
sp_usage_brief(&u, brief, sizeof(brief));
snprintf(line, sizeof(line), "%-9.9s %s", pid, brief);
snprintf(line, sizeof(line), "%-9.9s %s",
sp_provider_label(pid), brief);
if (u.frac >= 0.9 || u.benched_until > 0)
wattron(ui_side, A_BOLD);
if (y < getmaxy(ui_side))
+1 -1
View File
@@ -223,7 +223,7 @@ main(void)
SP_MODEL_CHOICES);
CHECK(mn == 2);
CHECK(strcmp(mv[0].sel, "main") == 0);
CHECK(strcmp(mv[0].sel, "local/test-model") == 0);
CHECK(contains(mv[0].label, "test-model"));
CHECK(strcmp(mv[1].sel, "testpool") == 0);
CHECK(contains(mv[1].label, "pool"));
+1 -1
View File
@@ -81,7 +81,7 @@ sessions = call(6, "splinter_sessions", {})
assert "sess-" in sessions and "*" in sessions, sessions
models = call(7, "splinter_models", {})
assert "main" in models, models
assert "local/m" in models, models
cancel = call(8, "splinter_cancel", {})
assert "no turn is running" in cancel, cancel
+2 -2
View File
@@ -113,7 +113,7 @@ while True:
ev = json.loads(f.readline())
if ev.get("ev") == "models":
sels = [it.get("sel") for it in ev.get("items", [])]
if "main" not in sels:
if "local/m" not in sels:
print("models incomplete", ev, file=sys.stderr)
sys.exit(1)
seen.append("models")
@@ -296,7 +296,7 @@ checkgrep 'model m' "$D/status.out"
HOME=$D/home SPLINTER_LOCALE=en ./splinterctl --socket "$D/sock" \
--cmd /model > "$D/model.out" 2>/dev/null
checkgrep 'main m' "$D/model.out"
checkgrep 'local/m' "$D/model.out"
# ------------------------------------------------- an approval is a question
[ -n "$S1" ] && kill "$S1" 2>/dev/null
+4 -4
View File
@@ -114,12 +114,12 @@ check shows 'unknown command: /xyz'
# Enter takes the highlighted one and runs the ordinary /model <id>
typed '/model'; key Enter
check shows 'type to filter'
check shows 'main m'
typed 'main'; key Enter
check shows 'Model: m (provider main'
check shows 'local/m'
typed 'local/'; key Enter
check shows 'Model: m (provider local'
# an argument still switches directly, without the picker
typed '/model andere'; key Enter
check shows 'Model: andere (provider main'
check shows 'Model: andere (provider local'
typed '/new'; key Enter
check shows 'New conversation: sess-'
typed '/connect'; key Enter