> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mka1.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MKA1

> Find what you can build with MKA1, explore the services behind it, and meet MKA1 Code.

export const Mka1Code = () => {
  const releaseAssets = useMemo(() => [{
    "surface": "desktop",
    "os": "darwin",
    "arch": "arm64",
    "format": "dmg",
    "name": "MKA1-Code-1.52.0-arm64.dmg",
    "url": "https://downloads.mka1.com/code/v1.52.0/MKA1-Code-1.52.0-arm64.dmg"
  }, {
    "surface": "desktop",
    "os": "darwin",
    "arch": "x64",
    "format": "dmg",
    "name": "MKA1-Code-1.52.0-x64.dmg",
    "url": "https://downloads.mka1.com/code/v1.52.0/MKA1-Code-1.52.0-x64.dmg"
  }, {
    "surface": "desktop",
    "os": "windows",
    "arch": "x64",
    "format": "exe",
    "name": "MKA1-Code-1.52.0-x64-setup.exe",
    "url": "https://downloads.mka1.com/code/v1.52.0/MKA1-Code-1.52.0-x64-setup.exe"
  }, {
    "surface": "desktop",
    "os": "linux",
    "arch": "arm64",
    "format": "appimage",
    "name": "MKA1-Code-1.52.0-arm64.AppImage",
    "url": "https://downloads.mka1.com/code/v1.52.0/MKA1-Code-1.52.0-arm64.AppImage"
  }, {
    "surface": "desktop",
    "os": "linux",
    "arch": "x64",
    "format": "appimage",
    "name": "MKA1-Code-1.52.0-x86_64.AppImage",
    "url": "https://downloads.mka1.com/code/v1.52.0/MKA1-Code-1.52.0-x86_64.AppImage"
  }, {
    "surface": "vscode",
    "os": "darwin",
    "arch": "arm64",
    "format": "vsix",
    "name": "mka1-code-darwin-arm64-1.52.0.vsix",
    "url": "https://downloads.mka1.com/code/v1.52.0/mka1-code-darwin-arm64-1.52.0.vsix"
  }, {
    "surface": "vscode",
    "os": "darwin",
    "arch": "x64",
    "format": "vsix",
    "name": "mka1-code-darwin-x64-1.52.0.vsix",
    "url": "https://downloads.mka1.com/code/v1.52.0/mka1-code-darwin-x64-1.52.0.vsix"
  }, {
    "surface": "vscode",
    "os": "windows",
    "arch": "x64",
    "format": "vsix",
    "name": "mka1-code-win32-x64-1.52.0.vsix",
    "url": "https://downloads.mka1.com/code/v1.52.0/mka1-code-win32-x64-1.52.0.vsix"
  }, {
    "surface": "vscode",
    "os": "linux",
    "arch": "arm64",
    "format": "vsix",
    "name": "mka1-code-linux-arm64-1.52.0.vsix",
    "url": "https://downloads.mka1.com/code/v1.52.0/mka1-code-linux-arm64-1.52.0.vsix"
  }, {
    "surface": "vscode",
    "os": "linux",
    "arch": "x64",
    "format": "vsix",
    "name": "mka1-code-linux-x64-1.52.0.vsix",
    "url": "https://downloads.mka1.com/code/v1.52.0/mka1-code-linux-x64-1.52.0.vsix"
  }, {
    "surface": "cli",
    "os": "darwin",
    "arch": "arm64",
    "format": "executable",
    "name": "mka1-code-cli-1.52.0-darwin-arm64",
    "url": "https://downloads.mka1.com/code/v1.52.0/mka1-code-cli-1.52.0-darwin-arm64"
  }, {
    "surface": "cli",
    "os": "darwin",
    "arch": "x64",
    "format": "executable",
    "name": "mka1-code-cli-1.52.0-darwin-x64",
    "url": "https://downloads.mka1.com/code/v1.52.0/mka1-code-cli-1.52.0-darwin-x64"
  }, {
    "surface": "cli",
    "os": "windows",
    "arch": "x64",
    "format": "executable",
    "name": "mka1-code-cli-1.52.0-win32-x64.exe",
    "url": "https://downloads.mka1.com/code/v1.52.0/mka1-code-cli-1.52.0-win32-x64.exe"
  }, {
    "surface": "cli",
    "os": "linux",
    "arch": "arm64",
    "format": "executable",
    "name": "mka1-code-cli-1.52.0-linux-arm64",
    "url": "https://downloads.mka1.com/code/v1.52.0/mka1-code-cli-1.52.0-linux-arm64"
  }, {
    "surface": "cli",
    "os": "linux",
    "arch": "x64",
    "format": "executable",
    "name": "mka1-code-cli-1.52.0-linux-x64",
    "url": "https://downloads.mka1.com/code/v1.52.0/mka1-code-cli-1.52.0-linux-x64"
  }], []);
  const dialogRef = useRef(null);
  const [surface, setSurface] = useState('desktop');
  const [os, setOs] = useState('all');
  const osNames = {
    darwin: 'macOS',
    windows: 'Windows',
    linux: 'Linux'
  };
  const downloads = releaseAssets.filter(asset => asset.surface === surface && (os === 'all' || asset.os === os));
  return <>
<section className="code-band" id="mka1-code" aria-labelledby="code-title"><div className="wrap section">

  <div className="code-intro"><h2 id="code-title">MKA1 Code.<br /><span>Think it through.<br />Build it out.</span></h2><div><p>MKA1 Code brings conversations, files, and agent tasks into one workspace. Run coding tasks on your computer or in the cloud, then review the results in the desktop app.</p><div className="actions"><button className="btn white" onClick={() => dialogRef.current.showModal()}>Get MKA1 Code <span className="arrow" aria-hidden="true">↗</span></button></div></div></div>
  <div className="product-features">
    <article><h3>Work with the material you have.</h3><p>Attach files to agent tasks, work with documents, and inspect local outputs in the same workspace. The desktop previews PDFs, spreadsheets, Word documents, and presentations.</p></article>
    <article><h3>Fix bugs. Build features.</h3><p>Choose a local folder or a cloud environment. Ask the agent to inspect code, make changes, and run tests. Follow its activity and review the diff before keeping the changes.</p></article>
    <article><h3>Connect tools and schedule recurring work.</h3><p>Configure connectors and plugins for the systems you use. In the desktop app, schedule recurring tasks or ask an agent to return to its conversation later.</p></article>
  </div>
  <div className="surface-row"><div className="surface"><div><b>Desktop</b><small>Conversations, files, and agent tasks</small></div><span className="surface-symbol" aria-hidden="true">▣</span></div><div className="surface"><div><b>VS Code</b><small>Coding workflows in your editor</small></div><span className="surface-symbol" aria-hidden="true">⌘</span></div><div className="surface"><div><b>CLI</b><small>Coding workflows in your terminal</small></div><span className="surface-symbol" aria-hidden="true">›_</span></div></div>
</div></section>

    <dialog className="download-dialog" ref={dialogRef} aria-labelledby="download-title">
      <div className="dialog-header"><h2 id="download-title">Get MKA1 Code</h2><button aria-label="Close download options" onClick={() => dialogRef.current.close()}>×</button></div>
      <p>Choose your surface and operating system.</p>
      <div className="download-controls">
        <div><label htmlFor="download-surface">Surface</label><select id="download-surface" value={surface} onChange={event => setSurface(event.target.value)}><option value="desktop">Desktop app</option><option value="vscode">VS Code extension</option><option value="cli">CLI</option></select></div>
        <div><label htmlFor="download-os">Operating system</label><select id="download-os" value={os} onChange={event => setOs(event.target.value)}><option value="all">All platforms</option><option value="darwin">macOS</option><option value="windows">Windows</option><option value="linux">Linux</option></select></div>
      </div>
      <ul className="download-list">{downloads.map(asset => <li key={asset.url}><a href={asset.url}><div>{osNames[asset.os]} · {asset.arch === 'arm64' ? asset.os === 'darwin' ? 'Apple silicon' : 'ARM64' : asset.os === 'darwin' ? 'Intel' : 'x64'}<small>{asset.surface === 'desktop' ? 'Desktop installer' : asset.surface === 'vscode' ? 'VS Code extension (.vsix)' : 'CLI executable'}</small></div><span className="arrow" aria-hidden="true">↓</span></a></li>)}</ul>
      <p className="download-note">Use your MKA1 account or configure access to your organization’s gateway.</p>
    </dialog>
  </>;
};

export const Mka1UseCases = () => {
  const {serviceNames, serviceFlows, useCases, services, serviceTitle} = useMemo(() => {
    const node = (key, title, detail, column, row = 1, span = 2, output = false) => ({
      key,
      title,
      detail,
      column,
      row,
      span,
      output
    });
    const serviceNames = {
      gateway: 'Gateway',
      agents: 'Agents',
      compute: 'Compute',
      datasets: 'Datasets',
      repos: 'Repos',
      sandbox: 'Sandbox',
      search: 'Search',
      platform: 'Platform',
      realtime: 'Realtime',
      mka1code: 'MKA1 Code'
    };
    const recipes = {
      knowledge: {
        service: 'gateway',
        example: 'Explain a return policy using your product guides.',
        nodes: [node('files', 'Files', 'Your guides and policies', 1, 1, 1), {
          ...node('search', 'Retrieval', 'Find relevant passages for RAG', 1, 2, 1),
          service: 'search'
        }, node('responses', 'Responses', 'Use the retrieved context', 2), node('output', 'An answer grounded in your knowledge.', 'The result uses evidence from your files.', 3, 1, 2, true)],
        edges: [['files', 'search'], ['search', 'responses'], ['responses', 'output']]
      },
      documents: {
        service: 'gateway',
        example: 'Turn invoices into records with vendors, dates, and totals.',
        nodes: [node('document', 'Document', 'An invoice or image', 1, 1, 1), node('schema', 'Fields', 'Vendor, date, total', 1, 2, 1), node('extract', 'Extract', 'Read the document using your schema', 2), node('output', 'Documents become usable records.', 'Defined fields your application can validate and save.', 3, 1, 2, true)],
        edges: [['document', 'extract'], ['schema', 'extract'], ['extract', 'output']]
      },
      assistant: {
        service: 'agents',
        example: 'Summarize release notes every weekday from a source you connect.',
        nodes: [node('instructions', 'Instructions', 'Define the recurring job', 1, 1, 1), node('tools', 'Tools', 'Connect the release-note source', 1, 2, 1), node('run', 'Scheduled run', 'Use the saved agent setup', 2), node('output', 'A briefing when you need it.', 'A repeatable task using your connected material.', 3, 1, 2, true)],
        edges: [['instructions', 'run'], ['tools', 'run'], ['run', 'output']]
      },
      analysis: {
        service: 'sandbox',
        example: 'Analyze a sales spreadsheet and turn the findings into a chart.',
        nodes: [node('files', 'Input files', 'Your sales spreadsheet', 1), node('execution', 'Code execution', 'Calculate and create a chart', 2), node('output', 'Results you can inspect.', 'Calculations and a chart for the assistant to explain.', 3, 1, 2, true)],
        edges: [['files', 'execution'], ['execution', 'output']]
      },
      voice: {
        service: 'realtime',
        example: 'Create a spoken question-and-answer experience in your application.',
        nodes: [node('audio', 'Audio input', 'A spoken question', 1, 1, 1), node('session', 'Session context', 'Instructions and available tools', 1, 2, 1), node('model', 'Model interaction', 'Process the live conversation', 2), node('output', 'A reply you can hear.', 'Spoken output in the same realtime session.', 3, 1, 2, true)],
        edges: [['audio', 'model'], ['session', 'model'], ['model', 'output']]
      },
      code: {
        service: 'gateway',
        example: 'Fix a bug, run relevant tests, and review the changes in MKA1 Code.',
        nodes: [node('task', 'Task', 'The change you want', 1, 1, 1), node('context', 'Context & tools', 'Files, instructions, and coding tools', 1, 2, 1), node('responses', 'Responses', 'Request tools and use their results', 2), node('output', 'The next step in your coding task.', 'Tool calls and replies for MKA1 Code to work through.', 3, 1, 2, true)],
        edges: [['task', 'responses'], ['context', 'responses'], ['responses', 'output']]
      }
    };
    const serviceFlows = {
      gateway: {
        service: 'gateway',
        example: 'Generate a response for your application.',
        nodes: [node('request', 'Your request', 'Messages, files, and available tools', 1, 1, 1), node('model', 'Model', 'Choose a model for the task', 1, 2, 1), node('responses', 'Responses', 'Generate a reply or request a tool', 2), node('output', 'A response your application can use.', 'Text, structured data, and tool calls.', 3, 1, 2, true)],
        edges: [['request', 'responses'], ['model', 'responses'], ['responses', 'output']]
      },
      agents: recipes.assistant,
      sandbox: recipes.analysis,
      realtime: recipes.voice,
      compute: {
        service: 'compute',
        example: 'Run a training workload on available hardware.',
        nodes: [node('container', 'Container', 'Your training software', 1, 1, 1), node('capacity', 'Configuration', 'Hardware and job settings', 1, 2, 1), node('job', 'Compute job', 'Run the workload', 2), node('output', 'Training outputs to publish.', 'Your workload saves checkpoints and artifacts explicitly.', 3, 1, 2, true)],
        edges: [['container', 'job'], ['capacity', 'job'], ['job', 'output']]
      },
      datasets: {
        service: 'datasets',
        example: 'Generate training examples in a format your model can use.',
        nodes: [node('generator', 'Generator', 'Choose from the catalog', 1, 1, 1), node('parameters', 'Parameters', 'Configure the generation', 1, 2, 1), node('generation', 'Generation', 'Run the generator on Compute', 2), node('output', 'Training data in a repository.', 'Examples in the generator’s defined format.', 3, 1, 2, true)],
        edges: [['generator', 'generation'], ['parameters', 'generation'], ['generation', 'output']]
      },
      repos: {
        service: 'repos',
        example: 'Give training jobs and model servers a shared place for artifacts.',
        nodes: [node('weights', 'Model weights', 'Checkpoints and trained models', 1, 1, 1), node('data', 'Datasets', 'Training material', 1, 2, 1), node('repository', 'Repository', 'Push and pull versioned artifacts', 2), node('output', 'Artifacts your workloads can share.', 'Use the same repository identifier to train or serve.', 3, 1, 2, true)],
        edges: [['weights', 'repository'], ['data', 'repository'], ['repository', 'output']]
      },
      search: {
        service: 'search',
        example: 'Find evidence in your knowledge for RAG.',
        nodes: [node('files', 'Knowledge base', 'Index your documents for retrieval', 1, 1, 1), node('query', 'Question', 'What you want to find', 1, 2, 1), node('retrieve', 'Retrieval', 'Find relevant passages with semantic search', 2), node('output', 'Context ready for RAG.', 'Pass retrieved evidence into a model response.', 3, 1, 2, true)],
        edges: [['files', 'retrieve'], ['query', 'retrieve'], ['retrieve', 'output']]
      },
      platform: {
        service: 'platform',
        example: 'Set up access and model policies for your organization.',
        nodes: [node('teams', 'Teams & credentials', 'Who can use the platform', 1, 1, 1), node('models', 'Models & policies', 'What is available to use', 1, 2, 1), node('configuration', 'Configuration', 'Manage access and usage settings', 2), node('output', 'A platform set up for your team.', 'Applications use the access and models you configure.', 3, 1, 2, true)],
        edges: [['teams', 'configuration'], ['models', 'configuration'], ['configuration', 'output']]
      }
    };
    const step = (key, service, title, detail, column, row = 1, output = false, optional = false) => ({
      ...node(key, title, detail, column, row, 1, output),
      service,
      optional
    });
    const useCases = {
      knowledge: {
        title: 'Find answers in your knowledge.',
        services: ['gateway', 'search'],
        optional: [],
        flow: recipes.knowledge
      },
      documents: {
        title: 'Turn documents into data.',
        services: ['gateway'],
        optional: [],
        flow: recipes.documents
      },
      assistant: {
        title: 'Give an assistant a repeatable job.',
        services: ['agents', 'gateway'],
        optional: ['sandbox'],
        flow: {
          nodes: [step('setup', 'agents', 'Saved job', 'Instructions, tools, and a schedule', 1), step('run', 'agents', 'Scheduled run', 'Start the configured job', 2), step('model', 'gateway', 'Responses', 'Use the connected context and tools', 3), step('execution', 'sandbox', 'Code or commands', 'When the job needs execution', 3, 2, false, true), step('output', 'agents', 'A recurring briefing.', 'The model result completes the agent run.', 2, 2, true)],
          edges: [['setup', 'run'], ['run', 'model'], ['model', 'output'], ['model', 'execution', true], ['execution', 'model', true]]
        }
      },
      analysis: {
        title: 'Make more sense of your data.',
        services: ['gateway', 'sandbox'],
        optional: [],
        flow: {
          nodes: [step('files', 'gateway', 'Files & question', 'Your spreadsheet and the analysis you need', 1), step('request', 'gateway', 'Responses', 'Request calculations and a chart', 2), step('execute', 'sandbox', 'Code execution', 'Run calculations and create files', 3), step('explain', 'gateway', 'Responses', 'Use the returned execution results', 2, 2), step('output', 'gateway', 'Analysis backed by calculations.', 'An explanation and chart you can inspect.', 3, 2, true)],
          edges: [['files', 'request'], ['request', 'execute'], ['execute', 'explain'], ['explain', 'output']]
        }
      },
      voice: {
        title: 'Make an interaction feel natural.',
        services: ['realtime', 'gateway'],
        optional: [],
        flow: {
          nodes: [step('audio', 'realtime', 'Audio input', 'A spoken question in the live session', 1), step('transcribe', 'realtime', 'Speech to text', 'Transcribe the incoming audio', 2), step('model', 'gateway', 'Responses', 'Generate a reply using the session context', 3), step('speak', 'realtime', 'Text to speech', 'Synthesize the model’s reply', 3, 2), step('output', 'realtime', 'A reply you can hear.', 'Spoken output returns to the live session.', 2, 2, true)],
          edges: [['audio', 'transcribe'], ['transcribe', 'model'], ['model', 'speak'], ['speak', 'output']]
        }
      },
      code: {
        title: 'Move a software idea forward.',
        services: ['gateway'],
        optional: ['sandbox'],
        flow: {
          nodes: [step('task', 'mka1code', 'Your coding task', 'Files, instructions, and available tools', 1), step('model', 'gateway', 'Responses', 'Request edits and commands', 2), step('local', 'mka1code', 'Local tools', 'Inspect files, edit code, and run tests on your computer', 3), step('remote', 'sandbox', 'Cloud execution', 'Run tools in a sandbox-backed cloud workspace', 2, 2, false, true), step('output', 'mka1code', 'Changes and test results to review.', 'The chosen workspace returns its files and command output.', 3, 2, true)],
          edges: [['task', 'model'], ['model', 'local'], ['local', 'output'], ['model', 'remote', true], ['remote', 'output', true]]
        }
      },
      'training-data': {
        title: 'Create training data for your model.',
        services: ['datasets', 'compute', 'repos'],
        optional: ['gateway'],
        flow: {
          nodes: [step('configure', 'datasets', 'Generation', 'Choose a generator and its parameters', 1), step('execute', 'compute', 'Generator job', 'Run the program that produces training rows', 2), step('publish', 'repos', 'Dataset repository', 'Publish rows, format, and provenance', 3), step('model', 'gateway', 'Model calls', 'If the generator needs model output', 2, 2, false, true), step('output', 'repos', 'Training data ready for your workload.', 'Download the dataset or use it in your own training job.', 3, 2, true)],
          edges: [['configure', 'execute'], ['execute', 'publish'], ['publish', 'output'], ['execute', 'model', true], ['model', 'execute', true]]
        }
      },
      training: {
        title: 'Train a model for your work.',
        services: ['compute', 'repos'],
        optional: [],
        flow: {
          nodes: [step('inputs', 'repos', 'Training inputs', 'Model weights and training data', 1), step('train', 'compute', 'Training job', 'Run your container on available hardware', 2), step('weights', 'repos', 'Saved model weights', 'Publish checkpoints and final outputs', 3), step('output', 'repos', 'A trained model ready for your workload.', 'Download saved weights or load them into your next job.', 3, 2, true)],
          edges: [['inputs', 'train'], ['train', 'weights'], ['weights', 'output']]
        }
      },
      team: {
        title: 'Give your team the access it needs.',
        services: ['platform', 'gateway'],
        optional: [],
        flow: {
          nodes: [step('team', 'platform', 'Teams & model access', 'Set up who can use which models', 1), step('credentials', 'platform', 'API keys', 'Issue credentials for the application', 2), step('request', 'gateway', 'Application request', 'Use configured access and routing settings', 3), step('output', 'gateway', 'Model access for your team.', 'Applications receive responses under the configured access.', 3, 2, true)],
          edges: [['team', 'credentials'], ['credentials', 'request'], ['request', 'output']]
        }
      }
    };
    const services = [{
      "key": "gateway",
      "name": "Gateway",
      "icon": "✳︎",
      "description": "Model access & application APIs",
      "earlyAccess": false
    }, {
      "key": "agents",
      "name": "Agents",
      "icon": "◎",
      "description": "Reusable jobs & schedules",
      "earlyAccess": false
    }, {
      "key": "compute",
      "name": "Compute",
      "icon": "▥",
      "description": "Training jobs & model servers",
      "earlyAccess": true
    }, {
      "key": "datasets",
      "name": "Datasets",
      "icon": "▤",
      "description": "Generate training examples",
      "earlyAccess": true
    }, {
      "key": "repos",
      "name": "Repos",
      "icon": "⌘",
      "description": "Model weights & datasets",
      "earlyAccess": true
    }, {
      "key": "sandbox",
      "name": "Sandbox",
      "icon": "›_",
      "description": "A workspace for execution",
      "earlyAccess": false
    }, {
      "key": "search",
      "name": "Search",
      "icon": "⌕",
      "description": "Knowledge retrieval & RAG",
      "earlyAccess": false
    }, {
      "key": "platform",
      "name": "Platform",
      "icon": "⤢",
      "description": "Access, models & policies",
      "earlyAccess": false
    }, {
      "key": "realtime",
      "name": "Realtime",
      "icon": "≋",
      "description": "Live spoken interactions",
      "earlyAccess": false
    }];
    const serviceTitle = ({services, optional}) => {
      const names = services.map(key => serviceNames[key]);
      const title = names.length === 1 ? names[0] : names.length === 2 ? names.join(' and ') : names.slice(0, -1).join(', ') + ', and ' + names.at(-1);
      return title + (optional.length ? ' (+ ' + optional.map(key => serviceNames[key]).join(', ') + ' if needed)' : '');
    };
    return {
      serviceNames,
      serviceFlows,
      useCases,
      services,
      serviceTitle
    };
  }, []);
  const [selectedOutcome, setSelectedOutcome] = useState('knowledge');
  const [displayedOutcome, setDisplayedOutcome] = useState('knowledge');
  const [selectedService, setSelectedService] = useState(null);
  const [isMobile, setIsMobile] = useState(false);
  const [edges, setEdges] = useState([]);
  const [connection, setConnection] = useState(null);
  const rootRef = useRef(null);
  const flowRef = useRef(null);
  const definition = selectedOutcome ? useCases[selectedOutcome] : {
    services: [selectedService],
    optional: [],
    flow: serviceFlows[selectedService]
  };
  const compound = definition.services.length + definition.optional.length > 1;
  const selectOutcome = key => {
    setSelectedOutcome(key);
    setDisplayedOutcome(key);
    setSelectedService(null);
  };
  useEffect(() => {
    const query = window.matchMedia('(max-width:720px)');
    const update = () => setIsMobile(query.matches);
    update();
    query.addEventListener('change', update);
    return () => query.removeEventListener('change', update);
  }, []);
  useEffect(() => {
    const requested = new URLSearchParams(window.location.search).get('use-case');
    if (Object.hasOwn(useCases, requested)) {
      selectOutcome(requested);
      const cards = rootRef.current.querySelectorAll('[data-outcome]');
      const selected = [...cards].find(card => card.dataset.outcome === requested);
      rootRef.current.querySelector('.outcomes').scrollTop = selected.offsetTop - cards[0].offsetTop;
    }
  }, []);
  useEffect(() => {
    const explorer = rootRef.current;
    const flow = flowRef.current;
    const list = explorer.querySelector('.outcomes');
    let frame;
    const measure = () => {
      const boxes = Object.fromEntries(definition.flow.nodes.map(item => [item.key, flow.querySelector(`[data-flow-node="${item.key}"]`)]));
      if (Object.values(boxes).some(box => !box)) return;
      const rect = flow.getBoundingClientRect();
      const borderRect = box => {
        const rect = box.getBoundingClientRect();
        const legend = box.querySelector(':scope > .flow-service-title')?.getBoundingClientRect();
        return {
          left: rect.left,
          right: rect.right,
          top: rect.top,
          bottom: rect.bottom,
          width: rect.width,
          height: rect.height,
          legend
        };
      };
      setEdges(definition.flow.edges.map(([from, to, optional]) => {
        const a = borderRect(boxes[from]);
        const b = borderRect(boxes[to]);
        let d;
        const arrowLength = 8;
        const overlapLeft = Math.max(a.left, b.left);
        const overlapRight = Math.min(a.right, b.right);
        const verticallySeparated = b.top >= a.bottom || a.top >= b.bottom;
        if (verticallySeparated && overlapRight - overlapLeft > 16) {
          const up = b.top < a.top;
          const paired = definition.flow.edges.some(edge => edge[0] === to && edge[1] === from);
          const offset = paired ? up ? 7 : -7 : 0;
          const sharedX = Math.max(overlapLeft + 8, Math.min(overlapRight - 8, a.left + a.width / 2 + offset));
          const portX = (box, atTop) => {
            let x = sharedX;
            if (atTop && box.legend && x >= box.legend.left - 4 && x <= box.legend.right + 4) {
              x = Math.min(box.right - 8, box.legend.right + 8);
            }
            return x - rect.left;
          };
          const ax = portX(a, up);
          const ay = (up ? a.top : a.bottom) - rect.top;
          const bx = portX(b, !up);
          const by = (up ? b.bottom : b.top) - rect.top + (up ? arrowLength : -arrowLength);
          const direction = up ? -1 : 1, bend = Math.abs(by - ay) / 2;
          d = `M ${ax} ${ay} C ${ax} ${ay + direction * bend}, ${bx} ${by - direction * bend}, ${bx} ${by}`;
        } else {
          const forward = b.left > a.left, direction = forward ? 1 : -1;
          const ax = (forward ? a.right : a.left) - rect.left, ay = a.top + a.height / 2 - rect.top;
          const bx = (forward ? b.left : b.right) - rect.left, by = b.top + b.height / 2 - rect.top;
          const base = bx - direction * arrowLength, bend = Math.abs(base - ax);
          d = `M ${ax} ${ay} C ${ax + direction * bend} ${ay}, ${base - direction * bend} ${by}, ${base} ${by}`;
        }
        return {
          key: from + '-' + to,
          d,
          optional
        };
      }));
      const selected = list.querySelector('.outcome.selected');
      if (!selected) {
        setConnection(null);
        return;
      }
      const root = explorer.getBoundingClientRect(), card = selected.getBoundingClientRect(), viewport = list.getBoundingClientRect();
      const workspace = explorer.querySelector('.service-workspace').getBoundingClientRect();
      const top = Math.max(card.top, viewport.top), bottom = Math.min(card.bottom, viewport.bottom);
      if (bottom <= top || workspace.left <= card.right) {
        setConnection(null);
        return;
      }
      const ax = card.right - root.left + 2, ay = (top + bottom) / 2 - root.top;
      const bx = workspace.left - root.left, by = workspace.top + workspace.height / 2 - root.top;
      const handle = (bx - ax) * .8;
      setConnection({
        ax,
        ay,
        bx,
        by,
        d: `M ${ax} ${ay} C ${ax + handle} ${ay}, ${bx - handle} ${by}, ${bx} ${by}`
      });
    };
    const scheduleMeasure = () => {
      cancelAnimationFrame(frame);
      frame = requestAnimationFrame(measure);
    };
    const observer = new ResizeObserver(scheduleMeasure);
    observer.observe(flow);
    observer.observe(explorer);
    list.addEventListener('scroll', scheduleMeasure, {
      passive: true
    });
    window.addEventListener('scroll', scheduleMeasure, {
      passive: true
    });
    window.addEventListener('resize', scheduleMeasure);
    scheduleMeasure();
    return () => {
      cancelAnimationFrame(frame);
      observer.disconnect();
      list.removeEventListener('scroll', scheduleMeasure);
      window.removeEventListener('scroll', scheduleMeasure);
      window.removeEventListener('resize', scheduleMeasure);
    };
  }, [selectedOutcome, selectedService]);
  return <div className="wrap">
      <section className="section" id="possibilities" aria-label="MKA1 use cases">
        <div id="possibilities-title" aria-hidden="true" />
        <div className="stack-explorer" id="service-map" ref={rootRef}>
          {connection && <svg className="selection-connection" aria-hidden="true"><path className="selection-line" d={connection.d} /><circle className="selection-source" r="3.5" cx={connection.ax} cy={connection.ay} /><circle className="selection-target" r="3.5" cx={connection.bx} cy={connection.by} /></svg>}
          <div className="outcome-column"><h2 className="use-cases-heading" id="use-cases-title">Use Cases</h2>
            <div className="mobile-outcome-picker">
              <select className="mobile-outcome-select" aria-labelledby="use-cases-title" aria-controls="workspace-flow" value={selectedOutcome || ''} onChange={event => selectOutcome(event.target.value)}>
                <option value="" disabled>Select a use case</option>
                {Object.entries(useCases).map(([key, useCase]) => <option key={key} value={key}>{useCase.title}</option>)}
              </select>
              <svg className="mobile-outcome-chevron" viewBox="0 0 20 20" aria-hidden="true"><path d="m5 7.5 5 5 5-5" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" /></svg>
            </div>
            <div className="outcomes" aria-labelledby="use-cases-title">
<article className={selectedOutcome === "knowledge" ? "outcome selected" : "outcome"} aria-pressed={isMobile ? undefined : selectedOutcome === "knowledge"} onClick={isMobile ? undefined : event => {
    if (!event.target.closest("a")) selectOutcome("knowledge");
  }} onKeyDown={isMobile ? undefined : event => {
    if (event.target === event.currentTarget && ["Enter", " "].includes(event.key)) {
      event.preventDefault();
      selectOutcome("knowledge");
    }
  }} aria-label="Find answers in your knowledge." aria-controls={isMobile ? undefined : 'workspace-flow'} data-outcome="knowledge" data-mobile-visible={displayedOutcome === "knowledge"} tabIndex={isMobile ? undefined : 0} role={isMobile ? undefined : 'button'}><div className="outcome-art sage" aria-hidden="true"><div className="mini-doc"><strong>Product guide</strong><i></i><i></i><i></i><i></i><i></i></div><div className="answer-tag">An answer from your files ↗</div></div><div className="outcome-copy"><h3>Find answers in your knowledge.</h3><p>Retrieve relevant information from your documents and use it to answer a question.</p><div className="example"><b>For example:</b> explain a return policy using your product guides and policy documents.</div><a href="/docs/vector-stores">Explore files and retrieval <span aria-hidden="true">↗</span></a></div></article>

<article className={selectedOutcome === "documents" ? "outcome selected" : "outcome"} aria-pressed={isMobile ? undefined : selectedOutcome === "documents"} onClick={isMobile ? undefined : event => {
    if (!event.target.closest("a")) selectOutcome("documents");
  }} onKeyDown={isMobile ? undefined : event => {
    if (event.target === event.currentTarget && ["Enter", " "].includes(event.key)) {
      event.preventDefault();
      selectOutcome("documents");
    }
  }} aria-label="Turn documents into data." aria-controls={isMobile ? undefined : 'workspace-flow'} data-outcome="documents" data-mobile-visible={displayedOutcome === "documents"} tabIndex={isMobile ? undefined : 0} role={isMobile ? undefined : 'button'}><div className="outcome-art peach" aria-hidden="true"><div className="invoice"><b>Invoice</b><div>Vendor</div><div>Date</div><div>Total</div></div><div className="data-tag">Document → usable fields</div></div><div className="outcome-copy"><h3>Turn documents into data.</h3><p>Define the fields you need. Extract them from documents or images into a consistent structure.</p><div className="example"><b>For example:</b> turn uploaded invoices into records with vendors, dates, and totals.</div><a href="/docs/extract-structured-data">Explore structured extraction <span aria-hidden="true">↗</span></a></div></article>

<article className={selectedOutcome === "assistant" ? "outcome selected" : "outcome"} aria-pressed={isMobile ? undefined : selectedOutcome === "assistant"} onClick={isMobile ? undefined : event => {
    if (!event.target.closest("a")) selectOutcome("assistant");
  }} onKeyDown={isMobile ? undefined : event => {
    if (event.target === event.currentTarget && ["Enter", " "].includes(event.key)) {
      event.preventDefault();
      selectOutcome("assistant");
    }
  }} aria-label="Give an assistant a repeatable job." aria-controls={isMobile ? undefined : 'workspace-flow'} data-outcome="assistant" data-mobile-visible={displayedOutcome === "assistant"} tabIndex={isMobile ? undefined : 0} role={isMobile ? undefined : 'button'}><div className="outcome-art lavender" aria-hidden="true"><div className="schedule">A recurring task<strong>Your morning briefing</strong><div className="weekday"><span>M</span><span>T</span><span>W</span><span>T</span><span>F</span></div></div><span className="check-tag">✓</span></div><div className="outcome-copy"><h3>Give an assistant a repeatable job.</h3><p>Save instructions and tools as an agent, then add a schedule for recurring work.</p><div className="example"><b>For example:</b> summarize release notes every weekday using a source your team connects.</div><a href="/docs/agents-overview">Meet agents and schedules <span aria-hidden="true">↗</span></a></div></article>

<article className={selectedOutcome === "analysis" ? "outcome selected" : "outcome"} aria-pressed={isMobile ? undefined : selectedOutcome === "analysis"} onClick={isMobile ? undefined : event => {
    if (!event.target.closest("a")) selectOutcome("analysis");
  }} onKeyDown={isMobile ? undefined : event => {
    if (event.target === event.currentTarget && ["Enter", " "].includes(event.key)) {
      event.preventDefault();
      selectOutcome("analysis");
    }
  }} aria-label="Make more sense of your data." aria-controls={isMobile ? undefined : 'workspace-flow'} data-outcome="analysis" data-mobile-visible={displayedOutcome === "analysis"} tabIndex={isMobile ? undefined : 0} role={isMobile ? undefined : 'button'}><div className="outcome-art sky" aria-hidden="true"><div className="art-bars"><i></i><i></i><i></i><i></i></div></div><div className="outcome-copy"><h3>Make more sense of your data.</h3><p>Give a model access to code execution to calculate, compare, and work with the data you provide.</p><div className="example"><b>For example:</b> analyze a sales spreadsheet and turn the findings into a chart.</div><a href="/docs/code-execution">Explore analysis and code execution <span aria-hidden="true">↗</span></a></div></article>

<article className={selectedOutcome === "voice" ? "outcome selected" : "outcome"} aria-pressed={isMobile ? undefined : selectedOutcome === "voice"} onClick={isMobile ? undefined : event => {
    if (!event.target.closest("a")) selectOutcome("voice");
  }} onKeyDown={isMobile ? undefined : event => {
    if (event.target === event.currentTarget && ["Enter", " "].includes(event.key)) {
      event.preventDefault();
      selectOutcome("voice");
    }
  }} aria-label="Make an interaction feel natural." aria-controls={isMobile ? undefined : 'workspace-flow'} data-outcome="voice" data-mobile-visible={displayedOutcome === "voice"} tabIndex={isMobile ? undefined : 0} role={isMobile ? undefined : 'button'}><div className="outcome-art sand" aria-hidden="true"><div className="sound"><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i></div></div><div className="outcome-copy"><h3>Make an interaction feel natural.</h3><p>Use speech and image capabilities, or connect realtime voice to a model interaction.</p><div className="example"><b>For example:</b> create a spoken question-and-answer experience in your application.</div><a href="/docs/advanced-voice-mode">Explore realtime voice <span aria-hidden="true">↗</span></a></div></article>

<article className={selectedOutcome === "code" ? "outcome selected" : "outcome"} aria-pressed={isMobile ? undefined : selectedOutcome === "code"} onClick={isMobile ? undefined : event => {
    if (!event.target.closest("a")) selectOutcome("code");
  }} onKeyDown={isMobile ? undefined : event => {
    if (event.target === event.currentTarget && ["Enter", " "].includes(event.key)) {
      event.preventDefault();
      selectOutcome("code");
    }
  }} aria-label="Move a software idea forward." aria-controls={isMobile ? undefined : 'workspace-flow'} data-outcome="code" data-mobile-visible={displayedOutcome === "code"} tabIndex={isMobile ? undefined : 0} role={isMobile ? undefined : 'button'}><div className="outcome-art rose" aria-hidden="true"><div className="code-art"><div className="line">Your next change</div><div className="line remove">− an unfinished idea</div><div className="line add">+ a change to review</div></div></div><div className="outcome-copy"><h3>Move a software idea forward.</h3><p>Give MKA1 Code a local folder or cloud workspace and a task. Its coding agent can inspect files, edit code, and run commands.</p><div className="example"><b>For example:</b> fix a bug, run the relevant tests, and review the resulting changes.</div><a href="#mka1-code">Explore MKA1 Code <span aria-hidden="true">↗</span></a></div></article>

<article className={selectedOutcome === "training-data" ? "outcome selected" : "outcome"} aria-pressed={isMobile ? undefined : selectedOutcome === "training-data"} onClick={isMobile ? undefined : event => {
    if (!event.target.closest("a")) selectOutcome("training-data");
  }} onKeyDown={isMobile ? undefined : event => {
    if (event.target === event.currentTarget && ["Enter", " "].includes(event.key)) {
      event.preventDefault();
      selectOutcome("training-data");
    }
  }} aria-label="Create training data for your model." aria-controls={isMobile ? undefined : 'workspace-flow'} data-outcome="training-data" data-mobile-visible={displayedOutcome === "training-data"} tabIndex={isMobile ? undefined : 0} role={isMobile ? undefined : 'button'}><div className="outcome-art mint" aria-hidden="true"><div className="dataset-illustration"><div><i></i><i></i><i></i></div><div><i></i><i></i><i></i></div><div><i></i><i></i><i></i></div></div></div><div className="outcome-copy"><h3>Create training data for your model.</h3><p>As an organization admin, choose a generator to produce training examples and publish them to a repository. Requires early access.</p><div className="example"><b>For example:</b> generate a dataset, then use it as input to your own training workload.</div><a href="/docs/datasets">Explore dataset generation <span aria-hidden="true">↗</span></a></div></article>

<article className={selectedOutcome === "training" ? "outcome selected" : "outcome"} aria-pressed={isMobile ? undefined : selectedOutcome === "training"} onClick={isMobile ? undefined : event => {
    if (!event.target.closest("a")) selectOutcome("training");
  }} onKeyDown={isMobile ? undefined : event => {
    if (event.target === event.currentTarget && ["Enter", " "].includes(event.key)) {
      event.preventDefault();
      selectOutcome("training");
    }
  }} aria-label="Train a model for your work." aria-controls={isMobile ? undefined : 'workspace-flow'} data-outcome="training" data-mobile-visible={displayedOutcome === "training"} tabIndex={isMobile ? undefined : 0} role={isMobile ? undefined : 'button'}><div className="outcome-art lavender" aria-hidden="true"><div className="training-illustration"><svg viewBox="0 0 180 70"><path className="plot-grid" d="M10 15H170M10 35H170M10 55H170"></path><path className="plot-line" d="M10 12C30 10 33 33 58 29S85 48 108 43S133 60 170 58"></path></svg><div className="weights-file">▤   model weights</div></div></div><div className="outcome-copy"><h3>Train a model for your work.</h3><p>Run your training container on Compute and save model weights and checkpoints in Repos. Requires early access.</p><div className="example"><b>For example:</b> fine-tune a model and save its checkpoints for your next workload.</div><a href="/docs/compute-fine-tune-job">Explore model training <span aria-hidden="true">↗</span></a></div></article>

<article className={selectedOutcome === "team" ? "outcome selected" : "outcome"} aria-pressed={isMobile ? undefined : selectedOutcome === "team"} onClick={isMobile ? undefined : event => {
    if (!event.target.closest("a")) selectOutcome("team");
  }} onKeyDown={isMobile ? undefined : event => {
    if (event.target === event.currentTarget && ["Enter", " "].includes(event.key)) {
      event.preventDefault();
      selectOutcome("team");
    }
  }} aria-label="Give your team the access it needs." aria-controls={isMobile ? undefined : 'workspace-flow'} data-outcome="team" data-mobile-visible={displayedOutcome === "team"} tabIndex={isMobile ? undefined : 0} role={isMobile ? undefined : 'button'}><div className="outcome-art peach" aria-hidden="true"><div className="access-illustration"><div className="team-symbols"><span>●</span><span>●</span><span>●</span></div><div className="access-key">⚿</div></div></div><div className="outcome-copy"><h3>Give your team the access it needs.</h3><p>As an organization admin, set up teams, credentials, and model access so your applications can use the MKA1 API.</p><div className="example"><b>For example:</b> give a support team access to the models its application needs.</div><a href="/docs/platform-getting-started">Explore team setup <span aria-hidden="true">↗</span></a></div></article>

          </div></div>
          <div className="services-column">
            <fieldset className="service-workspace"><legend><h2 id="workspace-title">{serviceTitle(definition)}</h2></legend>
              <div className={compound ? 'workspace-flow full-flow' : 'workspace-flow'} id="workspace-flow" ref={flowRef} aria-live="polite">
                <svg className="flow-lines" aria-hidden="true">
                  <defs>
                    <marker id="mka1-flow-arrow" viewBox="0 0 10 10" refX="0" refY="5" markerWidth="8" markerHeight="8" markerUnits="userSpaceOnUse" orient="auto"><path d="M 0 0 L 10 5 L 0 10 z" fill="#1549e8" /></marker>
                    <marker id="mka1-optional-arrow" viewBox="0 0 10 10" refX="0" refY="5" markerWidth="8" markerHeight="8" markerUnits="userSpaceOnUse" orient="auto"><path d="M 0 0 L 10 5 L 0 10 z" fill="#819273" /></marker>
                  </defs>
                  {edges.map(edge => <path key={edge.key} d={edge.d} fill="none" stroke={edge.optional ? '#819273' : '#1549e8'} strokeWidth="1.6" strokeDasharray={edge.optional ? '4 4' : undefined} markerEnd={edge.optional ? 'url(#mka1-optional-arrow)' : 'url(#mka1-flow-arrow)'} />)}
                </svg>
                {definition.flow.nodes.map(item => {
    const service = item.service || definition.flow.service;
    return <div key={item.key} data-flow-node={item.key} className={'flow-node' + (item.output ? ' output' : '') + (item.optional ? ' optional-step' : '')} style={{
      "--flow-column": item.column,
      "--flow-row": item.row,
      "--flow-span": item.span
    }}>
                    {service && <span className="flow-service-title">{serviceNames[service]}</span>}
                    <strong>{item.title}</strong><small>{item.detail}</small>
                  </div>;
  })}
              </div>
            </fieldset>
            <div className="services-heading"><h2>MKA1 services</h2></div>
            <div className="services-grid" aria-label="MKA1 services">
              {services.map(service => {
    const involved = definition.services.includes(service.key), optional = definition.optional.includes(service.key);
    return <button key={service.key} className={'service-tile' + (involved || optional ? ' active' : '') + (optional ? ' optional' : '')} data-service={service.key} aria-pressed={involved || optional} onClick={() => {
      if (!involved && !optional) {
        setSelectedOutcome(null);
        setSelectedService(service.key);
      }
    }}>
                  <span className="tile-icon" aria-hidden="true">{service.icon}</span><strong>{service.name}</strong><small>{service.description}</small>
                  {service.earlyAccess && <span className="tile-status">Early access</span>}
                  {optional && <span className="service-participation">If needed</span>}
                </button>;
  })}
            </div>
          </div>
        </div>
      </section>
    </div>;
};

<div className="mka1-home mka1-home-docs not-prose">
  <Mka1UseCases />

  <Mka1Code />
</div>
