summaryrefslogtreecommitdiffhomepage
path: root/src/app/views/ConcurrencyPane.svelte
blob: d04307f58b66cde4506f2bca0941afd6b700e96b (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<script lang="ts">
  /**
   * The `concurrency` view — per-provider concurrency limits + live status.
   * GLOBAL (not workspace- or conversation-scoped), so the panel stays mounted
   * across tab switches (no {#key}, like today).
   */
  import {
    ConcurrencyView,
    type DeleteConcurrencyLimit,
    type LoadConcurrencyLimits,
    type LoadConcurrencyStatus,
    type SaveConcurrencyCooldown,
    type SaveConcurrencyLimit,
  } from "../../features/concurrency";
  import type { AppViewPorts } from "../view-ports";

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

  // Thin passthroughs (kept for structural consistency — AGENTS.md "contracts
  // are the cross-unit surface").
  const loadConcurrencyLimits: LoadConcurrencyLimits = () => store.concurrencyLimits();
  const saveConcurrencyLimit: SaveConcurrencyLimit = (providerId, limit) =>
    store.setConcurrencyLimit(providerId, limit);
  const deleteConcurrencyLimit: DeleteConcurrencyLimit = (providerId) =>
    store.deleteConcurrencyLimit(providerId);
  const loadConcurrencyStatus: LoadConcurrencyStatus = () => store.concurrencyStatus();
  const saveConcurrencyCooldown: SaveConcurrencyCooldown = (providerId, cooldownMs) =>
    store.setConcurrencyCooldown(providerId, cooldownMs);
</script>

<ConcurrencyView
  models={store.models}
  loadLimits={loadConcurrencyLimits}
  saveLimit={saveConcurrencyLimit}
  deleteLimit={deleteConcurrencyLimit}
  loadStatus={loadConcurrencyStatus}
  saveCooldown={saveConcurrencyCooldown}
/>