Panel: switch the deployment default model from the header

The panel could show the DSH default model but not change it, so an operator
who wanted a different Executor or Assessor model had to edit the profile by
hand. PUT default-model routes a switch through the Session Controller, which
is the same path the DSH picker uses: it retargets the master Session and lets
agent-default-model persist the choice into the profile through configEditor.

switchDefaultModel refuses a provider the catalog cannot route and a model its
group does not offer, and reports unchanged rather than writing the same value
again. selectModel saves the default in the background, so the switch polls the
catalog until the saved selection appears instead of assuming the write landed;
effort is compared against the selection the Controller resolved, because it
fills in a default effort the caller never sent.

The refusal carries its reason as a code, which ApiError now keeps so the panel
can word it in the operator's language instead of showing host English.
This commit is contained in:
2026-11-02 00:12:23 +08:00
parent 589b5a6533
commit a662188a57
13 changed files with 287 additions and 5 deletions
+3
View File
@@ -333,6 +333,7 @@ Some generic modules still refer directly to GitHub or Feishu:
| `src/app/delivery.ts` | `AgentDelivery`: delivers a message to a DeepSeek Harness agent once per request id, also across a restored Session |
| `src/app/retry-health.ts` | `RetryHealth`: which Sessions wait on a model budget retry, for the `models` health entry |
| `src/app/role-models.ts` | Resolves the Eval and Executor models, and seeds a new Session with its role's model |
| `src/app/default-model.ts` | `switchDefaultModel`: changes the deployment default model through the Session Controller, which persists it into the profile, and refuses a route a new Session could not use |
| `src/app/assessment.ts` | The MasterAssessor, the assessment schema and the window `orchestrator_eval` answers |
| `src/app/execution-environment.ts` | The execution environment: its variables, a Ticket's values, the directory root and the lines of the prompt section, which `src/app/prompts.ts` fills into its template |
| `src/app/source-context.ts` | `sourceContextOf`: each Source kind's `SourceContext` |
@@ -381,6 +382,7 @@ Some generic modules still refer directly to GitHub or Feishu:
| `src/client/index.tsx` | The client plugin entry: the sidebar entry, the main panel and the page in DeepSeek Harness's Plugin Manager |
| `src/client/app.tsx` | The panel: header, search, glossary, tabs and the page of the current route |
| `src/client/provider.tsx` | What every page reads from its host: copy, calls, navigation, notices, the state poll, and `restart`, which reads the state quickly while dsh-superagent restarts |
| `src/client/default-model.tsx` | The header's default-model switcher, and how a refused switch is worded |
| `src/client/api.ts` | Calls and polls of the management API, typed by `src/app/api.ts`, and the Decision filters of the Eval status |
| `src/client/route.ts` | The tabs, the settings groups, the typed routes that `parseRoute` reads, and the route memory with the settings group opened last |
| `src/client/overview.tsx` | The overview |
@@ -413,6 +415,7 @@ Some generic modules still refer directly to GitHub or Feishu:
| `tests/registry.spec.ts` | `SourceRegistry`: instances, validation, Policy parts, Channels and Thread context |
| `tests/sources.spec.ts` | The Feishu and GitHub Sources on a `SourceContext`: translation, polls and read positions, the pull request rules, health |
| `tests/gitea.spec.ts` | The Gitea Source on a `SourceContext` against a fetched stub of the Gitea API: translation, notification and stream polls, cursors, the Channel, health |
| `tests/default-model.spec.ts` | The default-model switcher: the routes it refuses, the switch it makes through the Session Controller, and the wording of a refusal |
| `tests/commands.spec.ts` | CLI calls as the deployment's accounts, the Channels' answers, and repository-scoped GitHub calls |
| `tests/feishu-read.spec.ts`, `tests/github-read.spec.ts` | Feishu and GitHub reads |
| `tests/admission-context.spec.ts`, `tests/feishu-image.spec.ts` | The Thread window of assessments, and Feishu image reads |