axelburks (Discord #feedback): an in-house vendor queues requests to
its busy models, and the plugin could only put the load in the model's
name, which changed only when magpie re-read the list.
- A provider plugin calls input.magpie.load(provider, {"<model id>":
0-100 | null}) whenever it likes, from its own timer. host.js
(reportLoad) clamps each number to 0-100, null clears a model, every
other value is dropped, at most 1000 a call, and it returns the count
taken. A provider that isn't a string or loads that isn't an object
throws a TypeError. It goes to Go as an unasked {event:"load"}.
- internal/plugin/load.go keeps each by provider and lowercased model
id. ModelLoad answers unknown once a load is older than LoadFresh
(5 minutes), never idle. model@size falls back to its model.
- The provider editor shows it by the model as a grey ctx badge
("87%", titled "87% busy now, as its plugin says").
- Settings > Network and sharing > Busy models last (settings.BusyLoad,
POST /api/settings/busy-load, Off by default, over 50/70/80/90% or
1-99 by hand): restLast puts a model reported over it behind the
ready candidates, ahead of the resting. The trace row has busy:<load>.
At a new turn affine moves a conversation off it (Why "busy",
busyBehind); within a turn it stays. after, readyForNew and leastHeld
skip it. Unknown load, a lone candidate, or all busy: nothing moves.
- Docs: site plugins page (en, zh, ja) "Model load" section and input
table; docs/subsystems provider-plugins.md and gateway-routing.md.
Run, all on mote via mote-run at a42736807's tree rebased on
origin/main b683f1c0e:
- go test ./internal/plugin ./internal/gateway -run
'ModelLoad|TestBusy' -v: TestPluginReportsModelLoad,
TestModelLoadGoesStale, TestBusyModelGoesBehind,
TestBusyModelNotKeptAtNewTurn pass.
- Broken by hand, each red: host.js not sending the event
(TestPluginReportsModelLoad "the plugin's loads never arrived"), the
busy case off in restLast (TestBusyModelGoesBehind order), the affine
"busy" case off (TestBusyModelNotKeptAtNewTurn "kept true, why
session").
- go test ./internal/gui -run Budget: ok. No budget raised. app.js
+86 bytes, two comments trimmed to fit. The settings row lives in
plugins/gateway/settings.js.
- node --test model-load, i18n-keys, bare-ids, model-rate: 69/69 pass.
model-load is Chromium and WebKit, 420 and 900 wide, en zh zh-TW ja
de.
- gofmt -l: empty. go vet ./... (darwin), GOOS=linux go vet -tags
nogui ./..., GOOS=windows go vet ./..., go build: ok.
Not run before the push (owner: push and tag first): go test ./...
-timeout 45m and the whole GUI suite. mote and the WSL box were each
running another session's full suite. Both run next, and any red gets
its own commit.
Not tried: a real plugin and vendor reporting load. The plugin side is
tested through the real Bun host with a plugin written in the test.