TypeScript library for building NPC-powered applications with split-pane layouts, file editors, terminals, chat interfaces, and file management.
core/types.ts- Base types (ModelInfo, Attachment, ToolCall)core/chat.ts- Chat client interfacecore/files.ts- File system client interfacecore/browser.ts- Browser client interfacecore/jobs.ts- Jobs/cron client interfacecore/layout.ts- Layout node types
Platform-specific implementations of core interfaces:
adapters/base.ts- AppServices interface definitionadapters/electron/bridge.ts- Electron/window.api implementation
LayoutProvider- Context for split pane state managementLayoutNodeComponent- Recursive layout tree rendererSplitView- Resizable horizontal/vertical splitsPaneHeader- Pane title bar with close/renameContentPaneContainer- Content type routerAppShell- Complete application with sidebar + layout
FileSystemProvider- File operations contextFileTree- Recursive directory treeSidebar- Workspace sidebar with search
CodeEditor- CodeMirror-based editor with syntax highlightingTerminal- Basic terminal emulatorBrowserViewer- Embedded browser framePdfViewer- PDF document viewerCsvViewer- Spreadsheet table viewImageViewer- Image display with zoom/rotate
ChatProvider- Chat state management with streamingChatInterface- Complete chat UIChatView- Message list with auto-scrollInputArea- Message input with file attachmentsConversationList- Conversation sidebar
AutosizeTextarea- Auto-growing textareaSpinner- Loading indicator
import { createElectronAdapter, AppShell } from "npcts";
const services = createElectronAdapter(window.api);
function App() {
return (
<AppShell
services={services}
workspacePath="/path/to/workspace"
/>
);
}import type { AppServices, ChatClient, FileSystemClient } from "npcts";
const customServices: AppServices = {
chat: customChatClient,
files: customFileClient,
browser: customBrowserClient,
jobs: customJobsClient,
};import { LayoutProvider, Studio } from "npcts";
function App() {
return <Studio services={services} />;
}src/
├── adapters/ # Platform implementations
│ ├── base.ts
│ └── electron/
├── core/ # Core interface definitions
│ ├── types.ts
│ ├── chat.ts
│ ├── files.ts
│ ├── browser.ts
│ ├── jobs.ts
│ └── layout.ts
└── ui/ # React components
├── chat/ # Chat UI components
├── layout/ # Split pane system
├── viewers/ # Content viewers
├── files/ # File management
├── primitives/ # Base components
└── markdown/ # Markdown rendering
npm install # Install dependencies
npm run build # Compile TypeScript
npm run dev # Watch mode
npm run check # Type check only- 🎨 Split-pane layout system with drag-to-split
- 📁 File tree navigation with context menus
- 💬 Real-time chat with streaming support
- ✏️ Code editor with syntax highlighting
- 🖥️ Terminal emulator
- 🌐 Browser viewer
- 📄 PDF, CSV, and image viewers
- 🔌 Pluggable adapter system
- 📦 TypeScript-first with full type safety
- ⚛️ React 18+ compatible
MIT