summaryrefslogtreecommitdiffhomepage
path: root/src/app/views/NamedAgentsPane.svelte
blob: 413141a91e3dbb3043d9ae6a052f32891d88ae27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<script lang="ts">
  /**
   * The `named-agents` view — a global, collapsible sidebar view of curated
   * presets. The store owns the list (authoritative for the model selector +
   * agent tooling); the view drives CRUD via injected ports (auto-save).
   * Unkeyed — the list is global (no {#key}, like today).
   */
  import {
    NamedAgentsView,
    type NamedAgentInput,
  } from "../../features/named-agents";
  import type { AppViewPorts } from "../view-ports";

  let { ports }: { ports: AppViewPorts } = $props();
  const store = $derived(ports.store);

  // Adapt the store's Named Agent CRUD to the named-agents feature's ports.
  const namedAgentPorts = {
    create: (input: NamedAgentInput) => store.createNamedAgent(input),
    update: (id: string, input: NamedAgentInput) => store.updateNamedAgent(id, input),
    remove: (id: string) => store.deleteNamedAgent(id),
  };
</script>

<NamedAgentsView agents={store.namedAgents} models={store.models} ports={namedAgentPorts} />