Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

3.5 KB
Raw Blame
import { AgentCard } from '../../src/components/settings/models/AgentCard';
import { blankBackendModel } from '../../src/components/settings/models/backendCatalog';
import { modelChainKey } from '../../src/components/settings/models/modelRows';
import { readyRegion } from '../../src/components/settings/models/regionRead';
import { freshRuntimeProjection } from '../../src/components/settings/models/runtimeLifecycle';
import type { AgentChain, AgentSupply, Source } from '../../src/components/settings/models/types';

export function GatewayFixture() {
  const params = new URLSearchParams(location.search);
  const long = params.has('long');
  const status = params.get('status') ?? 'available';
  const requestedBackend = params.get('backend');
  const backend = requestedBackend === 'claude' || requestedBackend === 'codex' ? requestedBackend : 'opencode';
  const direct = params.get('mode') === 'direct';
  const ids = ['claude-fable-5', 'claude-opus-4-8', 'claude-fable-5-1', 'claude-opus-5', 'claude-sonnet-5'];
  const origins = ['automatic', 'passthrough', 'manual', 'automatic', 'automatic'] as const;
  const source: Source = {
    id: 'src_fixture', display_name: 'Primary', kind: 'api_key', vendor: 'anthropic',
    protocol: 'anthropic', supply_channel: 'hub', billing: 'metered', last_discovered_at: null,
    state: { status: 'active', retry_at: null, detail_key: null },
    models: ids.map((id) => ({ id, origin: 'discovered', reasoning_efforts: [], reasoning_efforts_source: null })),
  };
  const agent: AgentSupply = {
    backend, cli_present: true, mode: direct ? 'direct' : 'hub', menu_kind: 'open',
    catalog_models: status === 'empty' ? [] : ids.map((id) => ({ ...blankBackendModel(), id })),
    sources: { order: [source.id], eligibility: [{ source_id: source.id, eligible: true }] },
    model_supply: status === 'unknown' ? [] : ids.map((model_id, index) => ({
      model_id, route_origin: origins[index], chain_length: status === 'unconfigured' ? 0 : 1,
      has_runnable_hop: status === 'available' || (status === 'partial' && index === 0),
    })),
    named_agents: [{
      name: long ? `opencode-${'long-agent-name-'.repeat(16)}` : 'opencode',
      effective_model_id: long ? `grok/${'long-model-id-'.repeat(20)}grok-4.6` : 'grok/grok-4.6',
      route_reason: 'route_unconfigured', supply_status: 'interrupted',
    }],
  };
  const chains = Object.fromEntries(ids.map((model_id, index) => [modelChainKey(backend, model_id), readyRegion<AgentChain>({
    contract_version: 23, backend, model_id, route_origin: origins[index],
    manual_override: origins[index] === 'manual' ? { hops: [{ source_id: source.id, model_id }] } : null,
    current: { source_id: source.id, model_id }, supply_state: 'ok',
    chain: [{ source_id: source.id, model_id, channel: 'hub', health: 'healthy', runnable: true, reason: null, retry_at: null }],
  })]));
  const runtime = freshRuntimeProjection(readyRegion({
    contract_version: 23,
    manifest: { name: 'cliproxyapi', resolution: 'resolved', version: '1.0.0', source_sha: 'fixture', assets: [] },
    status: { installed_version: '1.0.0', verified: true, listening: null, health: 'ok', last_check: null },
  }));
  return <main className="model-hub-shell model-hub-overview mx-auto min-w-0 max-w-3xl p-4">
    <AgentCard agents={[agent]} sources={[source]} chains={chains} runtime={runtime}
      pendingBackends={new Set()} switchFailures={new Set()} connectingBackend={null}
      onConnectHub={() => {}} onSwitchDirect={() => {}} onOpenModels={() => {}}
      onOpenOrder={() => {}} onOpenRoute={() => {}} onProbeSettled={() => {}} />
  </main>;
}