feat(ui): default the workflow's run-as identity to the seeded agent

This commit is contained in:
sam committed 2026-10-17 17:21:58 +11:00
1 parent 127e5e70a0
commit e9f45eeb8b
3 files changed
+86 -84

No files matched your search

+7 -5
View File
@@ -8,7 +8,6 @@ import { Plus, Trash2, X } from "@lucide/vue";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import { Switch } from "@/components/ui/switch";
import { cn } from "@/lib/utils";
import { statusKind, statusLabel, type Binding } from "@/bindings/binding-draft";
import { api } from "@/lib/api";
import type { Identity } from "@/stores/org";
@@ -61,7 +60,9 @@ function addSpec(key: "inputs" | "outputs", list: [string, Spec][]): void {
}
// The identity a run acts as must be an agent, never a person; a workflow
// naming none is refused when it runs.
// naming none is refused when it runs, so it defaults to the agent identity
// every install seeds (identity.AgentID).
const SEEDED_AGENT_ID = "6f129e29-0e26-5246-99bd-74cb4496203b";
const identities = useOrgStore();
const agents = ref<Identity[]>([]);
const identitiesLoading = ref(true);
@@ -74,6 +75,7 @@ async function loadAgents(): Promise<void> {
await identities.loadOrg();
const response = await api.orgAgents<{ agents: Identity[] }>(identities.homeOrg);
agents.value = response.agents.filter((agent) => agent.lifecycle === "active");
if (!text("identity") && agents.value.some((agent) => agent.id === SEEDED_AGENT_ID)) set("identity", SEEDED_AGENT_ID);
} catch (cause) {
identitiesError.value = String((cause as Error).message || cause);
} finally { identitiesLoading.value = false; }
@@ -170,11 +172,11 @@ function setNeeds(next: { captures?: boolean; gate_retries?: number }): void {
:model-value="text('identity')"
aria-label="Execution identity"
:disabled="identitiesLoading || !!identitiesError"
:class="cn('w-44 text-[13px]', !text('identity') && 'border-danger/60')"
class="w-44 text-[13px]"
@update:model-value="(value) => set('identity', String(value))"
>
<NativeSelectOption value="" disabled>{{ identitiesLoading ? 'Loading agents…' : 'Choose an agent' }}</NativeSelectOption>
<NativeSelectOption v-if="text('identity') && !agents.some((agent) => agent.id === text('identity'))" :value="text('identity')" disabled>{{ text('identity') === 'root' ? 'Existing instance agent' : 'Unavailable agent' }}</NativeSelectOption>
<NativeSelectOption v-if="!text('identity')" value="" disabled>{{ identitiesLoading ? 'Loading agents…' : 'Choose an agent' }}</NativeSelectOption>
<NativeSelectOption v-if="text('identity') && !agents.some((agent) => agent.id === text('identity'))" :value="text('identity')" disabled>{{ text('identity') }} (unknown)</NativeSelectOption>
<NativeSelectOption v-for="agent in agents" :key="agent.id" :value="agent.id">{{ agent.display_name }}</NativeSelectOption>
</NativeSelect>
</label>