Also: the check follows a Desktop model switch made after the last turn.
cybercaius (#help): with gpt-6.1-sol on AnyRouter chosen in the
conversation, the Routing page showed "Claude Desktop requested
deepseek/deepseek-flash" while the answer came from gpt-6.1-sol. The route
was right; the row was not explained.
Those rows are Desktop's own connection check ({"max_tokens":1, content
"."}, app.asar 2.7032 lWt/YT). Desktop names its model itself: the
shortest listed id with haiku, else sonnet, else opus, else the FIRST
listed model. magpie lists no Claude-named ids to it, so the check names
the first one (deepseek-flash), whatever the conversation is on, and
magpie sends it to the model chosen in Desktop's menu (desktopChosen).
- The check is recorded with kind connection_check (KindDesktopCheck,
usage purposeKinds "Connection check", purposes.js regenerated). The
Routing page tags the row "Connection check" next to the requested id
and its story says the id is the one Desktop named from its list, not
the conversation's model, and where magpie sent it. zh/zh-TW/ja/de.
The requested id itself stays what Desktop sent.
- desktopChosen: a turn sent after cowork_account_settings.json was last
written wins over the menus (newer of the two). Before, the last
session's model came first whenever any menu still held it, so the Code
tab switched off DeepSeek with Cowork left on it kept the check on
DeepSeek. desktopPicked now carries when that turn was sent (the
file's mtime once read).
The two 400s were AnyRouter's own (the reporter says so); not changed.
Run (at 0013f990c, this tree before its rebase on e0ad48641 and the
version stamp v0.1.2208 -> v0.1.2212 in comments/doc):
- mote: go test -tags nogui -timeout 45m -count=1 ./... : 81 ok, exit 0.
- mote: go vet ./internal/gateway ./internal/usage for darwin, linux
(nogui) and windows: ok. gofmt clean. go generate ./internal/usage
gives the same purposes.js as committed.
- GUI: routing-desktop-check (new; en, zh, zh-TW, ja, de), routing-kind,
i18n-keys: chromium on mote ok; WebKit could not launch on mote (90+
hung pw_run.sh launches from other sessions), so both engines ran on
the Linux box (wsl-run): 14/14 ok.
- Whole GUI suite (wsl-run, concurrency 4) still running at push; reds
so far are in account-arrange, account-models and agent-expand-steady,
files this change does not reach. Checked against main after.
Broken by hand:
- call.Kind = KindDesktopCheck turned off: TestClaudeDesktopProbeAsksNoClassifier
red ('recorded as kind "" (unmarked)').
- the connection_check story removed from client.js: routing-desktop-check red.
- old desktop.go: the new "Code tab switched off the last session's
model" case red; the at.After check turned off: red too.
Not tried: a real Claude Desktop. Whether Desktop sends a check on each
model switch, and whether its composer switch writes the menu file, are
read from its bundle, not seen live. AnyRouter's 400s not looked into.
57 lines
2.1 KiB
Go
57 lines
2.1 KiB
Go
package usage
|
|
|
|
import "maps"
|
|
|
|
//go:generate go run ../gui/genpurposes -out ../gui/assets/purposes.js
|
|
|
|
// PurposeKind is the shared filtering key and untranslated display name of a kind.
|
|
type PurposeKind struct {
|
|
Purpose string `json:"purpose"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
var purposeKinds = func() map[string]PurposeKind {
|
|
out := map[string]PurposeKind{}
|
|
add := func(name string, kinds ...string) {
|
|
for _, kind := range kinds {
|
|
out[kind] = PurposeKind{"kind:" + kinds[0], name}
|
|
}
|
|
}
|
|
add("Approval check", "guardian", "auto_review", "guardian_review")
|
|
add("Review", "review")
|
|
add("Compaction", "compact")
|
|
add("Memory", "memory_consolidation", "memgen", "memory")
|
|
add("Title", "thread_title", "thread_title_reconsideration", "title_generation", "title")
|
|
add("Description", "thread_description")
|
|
add("Prediction", "composer_predictions")
|
|
add("Subagent", "collab_spawn", "thread_spawn", "agent_job")
|
|
add("Luna Reserve", "luna_reserve")
|
|
add("Suggestions", "ambient_suggestions", "ambient_suggestion_safety")
|
|
add("Web search", "web_search")
|
|
add("Image description", "vision")
|
|
add("Routing classifier", "routing")
|
|
add("Connection check", "connection_check") // Claude Desktop's (gateway.KindDesktopCheck)
|
|
add("Test", "provider_test") // magpie's own (probelog.KindTest)
|
|
add("Detect APIs", "api_detect") // probelog.KindDetect
|
|
add("Model list", "model_list") // probelog.KindList
|
|
add("MCP tool", KindMCP) // an MCP tool call (SourceMCP)
|
|
return out
|
|
}()
|
|
|
|
// PurposeKinds returns a copy of the catalog used to generate the UI's catalog.
|
|
// Add aliases here, then run go generate ./internal/usage from the repo root.
|
|
func PurposeKinds() map[string]PurposeKind { return maps.Clone(purposeKinds) }
|
|
|
|
// PurposeOf groups the agent's equivalent call-kind spellings for filtering.
|
|
// The recorded Kind stays untouched. Prefixing nonempty kinds keeps future
|
|
// names distinct from the unmarked bucket (which is not necessarily a chat).
|
|
func PurposeOf(kind string) string {
|
|
if kind == "" {
|
|
return "unmarked"
|
|
}
|
|
if p, ok := purposeKinds[kind]; ok {
|
|
return p.Purpose
|
|
}
|
|
return "kind:" + kind
|
|
}
|