Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

1.3 KB
Raw Blame
/**
 * The AI Providers page's three views (#7567, epic #7561), each its own URL so
 * a card is linkable and reachable from ⌘K and voice:
 *
 *   - **Presets** — the stored records the `{ providerId, model, effort }`
 *     pickers name, grouped by harness, plus the compatibility matrix.
 *   - **Harnesses** — the programs that drive a model and whether each is
 *     switched on, plus the credential-bootstrap apps a composite can spawn through.
 *   - **Services** — instances of a service definition: plan, credential, catalog.
 *
 * Navigation between them is the Models section strip; this module is only the
 * route resolver, with no tab row of its own.
 *
 * Exported so the page test can enumerate the views without a second list.
 */
export const PROVIDER_PAGE_TABS = Object.freeze([
  { id: 'presets', label: 'Presets', to: '/ai/presets' },
  { id: 'harnesses', label: 'Harnesses', to: '/ai/harnesses' },
  { id: 'services', label: 'Services', to: '/ai/services' },
]);

/** Which view a pathname under `/ai` opens: the tab whose route prefixes it, else presets (the index and every overlay off it). */
export const providerPageTabForPath = (pathname) => {
  const bare = String(pathname || '').replace(/\/+$/, '');
  return PROVIDER_PAGE_TABS.find((tab) => bare === tab.to || bare.startsWith(`${tab.to}/`))?.id ?? 'presets';
};