@coopah/bentley-server
v0.3.0
Published
HTTP/SSE server for Bentley agents (Hono)
Readme
@coopah/bentley-server
HTTP/SSE server for Bentley agents, built on Hono. Exposes REST endpoints for shell management and SSE streaming for real-time agent responses.
Install
pnpm add @coopah/bentley-serverThis package depends on:
@coopah/bentley-core@coopah/bentley-langfuse@coopah/bentley-provider-copilot@coopah/bentley-tool-browser@coopah/bentley-tool-web-search
Usage
import { createBentleyServer } from "@coopah/bentley-server";
import { createBentley } from "@coopah/bentley-core";
import { bentleyOpenAIPlugin } from "@coopah/bentley-provider-openai";
const bentley = createBentley({
plugins: [bentleyOpenAIPlugin()],
shellsPath: "./shells",
});
const server = createBentleyServer(bentley);
// Server starts on PORT (default 3000)Configuration
All configuration is via environment variables:
| Variable | Description | Default |
|----------|-------------|---------|
| PORT | Server port | 3000 |
| BENTLEY_API_KEY | API key for request authentication | (none, auth disabled) |
| CORS_ORIGINS | Comma-separated allowed origins | * |
| LANGFUSE_PUBLIC_KEY | LangFuse public key | (tracing disabled) |
| LANGFUSE_SECRET_KEY | LangFuse secret key | (tracing disabled) |
| LANGFUSE_BASE_URL | LangFuse endpoint | LangFuse cloud |
Endpoints
GET /— WebChat UIGET /health— Health check (unauthenticated)POST /api/chat— Chat endpoint with SSE streaming responseGET /api/studio/shells— List shells (Studio API)GET /api/studio/shells/:id— Get shell details (Studio API)
Built-in Middleware
- API key authentication (when
BENTLEY_API_KEYis set) - CORS with configurable origins
- Request logging
- Security headers
Related Packages
| Package | Role |
|---------|------|
| @coopah/bentley-core | Core runtime (required) |
| @coopah/bentley-react | React client for this server |
| @coopah/bentley-gateway | Multi-channel message routing |
License
MIT
