Quick Start
This repo is a pnpm monorepo.
Install & build
bash
pnpm install # install dependencies
pnpm -r build # build all packages in dependency order
pnpm -r test # run all unit testsNote: workspace packages reference the built
distoutput (notsrc). After changing a package'ssrc, runpnpm --filter <pkg> buildbefore building packages that depend on it;pnpm -r buildbuilds everything in dependency order.
Wire it into a React app
- Configure the scanner's Vite plugin to generate the capability manifest at build time:
ts
// vite.config.ts
import { aiScannerPlugin } from '@ai-operable/scanner/vite';
import { reactRouterPreset } from '@ai-operable/preset-react-router';
import { antdPreset } from '@ai-operable/preset-antd';
export default defineConfig({
plugins: [
aiScannerPlugin({
presets: [
reactRouterPreset({ routesFile: 'src/App.tsx', labels: { '/leave': 'Leave' } }),
antdPreset({ forms: [{ module: 'leave', file: 'src/modules/leave/LeaveForm.tsx' }] }),
],
}),
],
});- Compose
useAIAgent+AIBarin your app:
tsx
import { AIBar, useAIAgent } from '@ai-operable/react';
import { createHttpProvider, type Manifest } from '@ai-operable/core';
import manifestJson from './ai-manifest.json';
export function AI() {
const provider = createHttpProvider({ endpoint: '/api/chat' });
const agent = useAIAgent({ manifest: manifestJson as Manifest, provider });
return <AIBar agent={agent} examples={['file a personal leave for tomorrow']} />;
}- Add a
/api/chatproxy on the server that forwards to the LLM. The key is read from an environment variable and never enters the frontend bundle.
Run the examples
bash
pnpm --filter ai-native-demo dev # full React + antd example (bring your own LLM key)
pnpm --filter vue-demo dev # minimal Vue example (counter-proof of a framework-agnostic core)Vue integration is symmetric — just swap @ai-operable/react for @ai-operable/vue. See the Vue API.