feat: profile解決とmodel catalogを更新

This commit is contained in:
2026-07-30 22:12:25 +09:00
parent d94ef81b43
commit 3e217adc14
34 changed files with 421 additions and 347 deletions
@@ -109,7 +109,7 @@
<span class="worker-task-title">-</span>
</span>
<span class="item-meta">
worker {worker.worker_id} · {worker.role ? `${worker.role} · ` : ''}{worker.state} · 🖥 {worker.host_id}
worker {worker.worker_id} · {worker.profile ? `${worker.profile} · ` : ''}{worker.state} · 🖥 {worker.host_id}
{worker.working_directory ? ` · wd:${worker.working_directory.repository_id}@${worker.working_directory.resolved_commit.slice(0, 8)}` : ''}
</span>
</a>
@@ -79,7 +79,6 @@ export type Worker = {
host_id: string;
display_name: string;
label: string;
role?: string | null;
profile?: string | null;
singleton_key?: string | null;
tags: string[];
@@ -233,6 +232,7 @@ export type BrowserWorkingDirectoryCreateRequest = {
export type WorkerLaunchOptionsResponse = {
workspace_id: string;
runtimes: WorkerLaunchRuntimeOption[];
default_profile?: string | null;
profiles: WorkerLaunchProfileCandidate[];
repositories: WorkingDirectoryRepositoryOption[];
working_directories: WorkingDirectorySummary[];
@@ -38,6 +38,7 @@ const options: WorkerLaunchOptionsResponse = {
diagnostics: [],
},
],
default_profile: "builtin:coder",
profiles: [
{ id: "builtin:companion", label: "Companion", description: "chat" },
{ id: "builtin:coder", label: "Coder", description: "code" },
@@ -65,7 +66,7 @@ const options: WorkerLaunchOptionsResponse = {
diagnostics: [],
};
Deno.test("defaultWorkerLaunchForm chooses active runtime, coder profile, repository, and working directory", () => {
Deno.test("defaultWorkerLaunchForm uses the Backend-published Workspace default profile", () => {
const form = defaultWorkerLaunchForm(options, {
runtime_id: "",
display_name: "",
@@ -78,7 +79,7 @@ Deno.test("defaultWorkerLaunchForm chooses active runtime, coder profile, reposi
});
assertEquals(form.runtime_id, "remote");
assertEquals(form.display_name, "Coding Worker");
assertEquals(form.display_name, "Worker");
assertEquals(form.profile, "builtin:coder");
assertEquals(form.initial_text, "hello");
assertEquals(form.working_directory_id, "wd-1-repo");
@@ -32,9 +32,9 @@ export function defaultWorkerLaunchForm(
) ??
options?.runtimes.find((runtime) => runtime.can_spawn_worker) ??
options?.runtimes[0];
const preferredProfile =
options?.profiles.find((candidate) => candidate.id === "builtin:coder") ??
options?.profiles[0];
const preferredProfile = options?.profiles.find((candidate) =>
candidate.id === options.default_profile
);
const availableWorkingDirectories =
options?.working_directories.filter((directory) =>
directory.status === "active" &&
@@ -60,7 +60,7 @@ export function defaultWorkerLaunchForm(
return {
runtime_id: current.runtime_id || preferredRuntime?.runtime_id || "",
display_name: current.display_name || "Coding Worker",
display_name: current.display_name || "Worker",
profile:
options?.profiles.some((candidate) => candidate.id === current.profile)
? current.profile
@@ -18,7 +18,6 @@ function worker(overrides: Partial<Worker>): Worker {
host_id: "host",
display_name: "Worker 1",
label: "Worker 1",
role: null,
profile: null,
singleton_key: null,
tags: [],
@@ -1259,11 +1259,8 @@
<dd><code>{worker.host_id}</code></dd>
</div>
<div>
<dt>Role / profile</dt>
<dd>
{worker.role ?? "unknown"} / {worker.profile ??
"unknown"}
</dd>
<dt>Profile</dt>
<dd>{worker.profile ?? "unknown"}</dd>
</div>
<div>
<dt>Workspace</dt>
@@ -139,7 +139,7 @@
}
function workerProfile(worker: Worker): string {
return worker.profile ?? worker.role ?? 'unknown';
return worker.profile ?? 'unknown';
}
function workerDirectory(worker: Worker): string {
@@ -31,9 +31,9 @@
let optionsError = $state<string | null>(null);
let submitting = $state(false);
let submitError = $state<DisplayError | null>(null);
let displayName = $state('Coding Worker');
let displayName = $state('Worker');
let runtimeId = $state('');
let profile = $state('builtin:coder');
let profile = $state('');
let initialText = $state('');
let workingDirectoryId = $state('');
let workingDirectoryRepositoryId = $state('');