wip: context-meter + model-label UI and provider/inference tweaks

Checkpoint of in-flight work so the orchestrator branch can rebase onto a
clean main: ContextBar → ContextMeter, model-label helper, model/agent picker
+ provider-snapshot/registry changes, inference payload + message-columns.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-03 14:55:38 +00:00
parent 5f4c7a9050
commit 163b5b86f7
21 changed files with 471 additions and 233 deletions

View File

@@ -91,6 +91,27 @@ export async function buildMessagesPayload(
}
}
// Per-turn model attribution. When the sent window mixes ≥2 models, prefix
// each prior assistant turn with its model id so the active model can answer
// "what did Opus say". Single-model chats are left byte-identical (no prefix,
// no note) so the common case sees no payload or prefix-cache change.
const sentModels = new Set<string>();
for (let i = startIdx; i < history.length; i++) {
const m = history[i]!;
if (m.role === 'assistant' && m.model && !isAnySentinel(m)) sentModels.add(m.model);
}
const annotateModels = sentModels.size >= 2;
if (annotateModels) {
out.push({
role: 'system',
content:
'This conversation includes replies from more than one AI model. Each prior ' +
'assistant turn below is prefixed with its model id in square brackets, e.g. ' +
'[claude-opus-4-8]. Those prefixes are metadata for your reference (so you can ' +
'tell which model produced which turn) — do not add such a prefix to your own replies.',
});
}
for (let i = startIdx; i < history.length; i++) {
const m = history[i]!;
if (m.kind === 'compact') {
@@ -143,9 +164,10 @@ export async function buildMessagesPayload(
continue;
}
if (m.role === 'assistant') {
const body = m.content && m.content.length > 0 ? m.content : null;
const msg: OpenAiMessage = {
role: 'assistant',
content: m.content && m.content.length > 0 ? m.content : null,
content: body != null && annotateModels && m.model ? `[${m.model}] ${body}` : body,
};
if (m.tool_calls && m.tool_calls.length > 0) {
if (assistantToolCallsArePayloadComplete(history, i)) {