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.

695 B
Raw Blame
import { classifyChainLink } from './sourceStateClassification';
import { equalHopIdentity } from './hopIdentity';
import type { AgentChain, AgentChainLink } from './types';

export const currentChainLink = (chain: AgentChain): AgentChainLink | null => {
  if (!chain.current) return null;
  return chain.chain.find((link) => equalHopIdentity(link, chain.current)) ?? null;
};

export const isTakeoverChain = (chain: AgentChain): boolean => {
  const current = currentChainLink(chain);
  const head = chain.chain[0];
  if (!current || !head) return false;
  const advanced = !equalHopIdentity(current, head);
  return advanced && !head.runnable && classifyChainLink(head) === 'self_healing';
};