@insy/server
v0.0.7
Published
Insy local server
Maintainers
Readme
@insy/server
Local server for Insy - AI-powered visual code editing
The server component that handles AI integration, WebSocket communication, and coordinates between the browser client and CLI tools like OpenCode.
Installation
npm install @insy/server
# or
pnpm add @insy/server
# or
yarn add @insy/serverUsage
Programmatic API
import { startServer, InsyServer } from '@insy/server';
// Simple start
await startServer({
port: 7777,
host: 'localhost',
projectRoot: process.cwd()
});
// Or with full control
const server = new InsyServer({
port: 7777,
host: 'localhost',
projectRoot: '/path/to/project'
});
await server.start();Via CLI
npx @insy/server
# or
npx insy-serverFeatures
- HTTP server with REST API endpoints
- WebSocket server for real-time communication
- CLI tool adapter system (OpenCode integration)
- Prompt building with element context
- Client script serving with injected configuration
- Project registration for multi-project support
API Endpoints
GET /health- Health checkGET /config- Get project configurationGET /client.js- Serve client script with injected configPOST /register- Register a project
WebSocket Messages
Client to Server
prompt/submit- Submit a prompt with element context
Server to Client
connected- Connection establishedstatus- Status update during processingdone- Processing completeerror- Error occurred
Requirements
- Node.js >= 18.0.0
- OpenCode CLI (for AI integration)
Related Packages
- @insy/client - Browser client
- @insy/vite - Vite plugin
- @insy/next - Next.js plugin
- @insy/shared - Shared types
License
MIT
