From 1f4c016c06fa48953a29510a12a1545c63ea0066 Mon Sep 17 00:00:00 2001 From: sawka Date: Tue, 19 Aug 2025 09:37:18 -0700 Subject: [PATCH 1/5] config docs --- aiprompts/config-system.md | 324 +++++++++++++++++++++++++++++++++++++ 1 file changed, 324 insertions(+) create mode 100644 aiprompts/config-system.md diff --git a/aiprompts/config-system.md b/aiprompts/config-system.md new file mode 100644 index 0000000000..ad06fb3468 --- /dev/null +++ b/aiprompts/config-system.md @@ -0,0 +1,324 @@ +# Wave Terminal Configuration System + +This document explains how Wave Terminal's configuration system works and provides step-by-step instructions for adding new configuration values. + +## Overview + +Wave Terminal uses a hierarchical configuration system with the following components: + +1. **Go Struct Definitions** - Type-safe configuration structure in Go +2. **JSON Schema** - Validation schema for configuration files +3. **Default Values** - Built-in default configuration +4. **User Configuration** - User-customizable settings in `~/.config/waveterm/settings.json` +5. **Documentation** - User-facing documentation + +## Configuration File Structure + +Wave Terminal's configuration system is organized into several key directories and files: + +``` +waveterm/ +├── pkg/wconfig/ # Go configuration package +│ ├── settingsconfig.go # Main settings struct definitions +│ ├── defaultconfig/ # Default configuration files +│ │ ├── settings.json # Default settings values +│ │ ├── termthemes.json # Default terminal themes +│ │ ├── presets.json # Default background presets +│ │ └── widgets.json # Default widget configurations +│ └── ... # Other config-related Go files +├── schema/ # JSON Schema definitions +│ ├── settings.json # Settings validation schema +│ └── ... # Other schema files +├── docs/docs/ # User documentation +│ └── config.mdx # Configuration documentation +└── ~/.config/waveterm/ # User config directory (runtime) + ├── settings.json # User settings overrides + ├── termthemes.json # User terminal themes + ├── presets.json # User background presets + ├── widgets.json # User widget configurations + ├── bookmarks.json # Web bookmarks + └── connections.json # SSH/remote connections +``` + +**Key Files:** +- **[`pkg/wconfig/settingsconfig.go`](pkg/wconfig/settingsconfig.go)** - Defines the `SettingsType` struct with all configuration fields +- **[`schema/settings.json`](schema/settings.json)** - JSON Schema for validation and type checking +- **[`pkg/wconfig/defaultconfig/settings.json`](pkg/wconfig/defaultconfig/settings.json)** - Default values for all settings +- **[`docs/docs/config.mdx`](docs/docs/config.mdx)** - User-facing documentation with descriptions and examples + +## Configuration Architecture + +### Configuration Hierarchy + +1. **Built-in Defaults** (`pkg/wconfig/defaultconfig/settings.json`) +2. **User Settings** (`~/.config/waveterm/settings.json`) +3. **Block-level Overrides** (stored in block metadata) + +Settings cascade from defaults → user settings → block overrides. + +## How to Add a New Configuration Value + +Follow these steps to add a new configuration setting: + +### Step 1: Add to Go Struct Definition + +Edit [`pkg/wconfig/settingsconfig.go`](pkg/wconfig/settingsconfig.go) and add your new field to the `SettingsType` struct: + +```go +type SettingsType struct { + // ... existing fields ... + + // Add your new field with appropriate JSON tag + MyNewSetting string `json:"mynew:setting,omitempty"` + + // For different types: + MyBoolSetting bool `json:"mynew:boolsetting,omitempty"` + MyNumberSetting float64 `json:"mynew:numbersetting,omitempty"` + MyIntSetting *int64 `json:"mynew:intsetting,omitempty"` // Use pointer for optional ints + MyArraySetting []string `json:"mynew:arraysetting,omitempty"` +} +``` + +**Naming Conventions:** + +- Use namespace prefixes (e.g., `term:`, `window:`, `ai:`, `web:`) +- Use lowercase with colons as separators +- Field names should be descriptive and follow Go naming conventions +- Use `omitempty` tag to exclude empty values from JSON + +**Type Guidelines:** + +- Use `*int64` and `*float64` for optional numeric values +- Use `*bool` for optional boolean values +- Use `string` for text values +- Use `[]string` for arrays +- Use `float64` for numbers that can be decimals + +### Step 2: Add to JSON Schema + +Edit [`schema/settings.json`](schema/settings.json) and add your field to the `properties` section: + +```json +{ + "$defs": { + "SettingsType": { + "properties": { + // ... existing properties ... + + "mynew:setting": { + "type": "string" + }, + "mynew:boolsetting": { + "type": "boolean" + }, + "mynew:numbersetting": { + "type": "number" + }, + "mynew:intsetting": { + "type": "integer" + }, + "mynew:arraysetting": { + "items": { + "type": "string" + }, + "type": "array" + } + } + } + } +} +``` + +**Schema Type Mapping:** + +- Go `string` → JSON Schema `"string"` +- Go `bool` → JSON Schema `"boolean"` +- Go `float64` → JSON Schema `"number"` +- Go `int64` → JSON Schema `"integer"` +- Go `[]string` → JSON Schema `"array"` with `"items": {"type": "string"}` + +### Step 3: Set Default Value (Optional) + +If your setting should have a default value, add it to [`pkg/wconfig/defaultconfig/settings.json`](pkg/wconfig/defaultconfig/settings.json): + +```json +{ + "ai:preset": "ai@global", + "ai:model": "gpt-4o-mini", + // ... existing defaults ... + + "mynew:setting": "default value", + "mynew:boolsetting": true, + "mynew:numbersetting": 42.5, + "mynew:intsetting": 100 +} +``` + +**Default Value Guidelines:** + +- Only add defaults for settings that should have non-zero/non-empty initial values +- Ensure defaults make sense for the typical user experience +- Keep defaults conservative and safe + +### Step 4: Update Documentation + +Add your new setting to the configuration table in [`docs/docs/config.mdx`](docs/docs/config.mdx): + +```markdown +| Key Name | Type | Function | +| ------------------- | -------- | ----------------------------------------- | +| mynew:setting | string | Description of what this setting controls | +| mynew:boolsetting | bool | Enable/disable some feature | +| mynew:numbersetting | float | Numeric setting for some parameter | +| mynew:intsetting | int | Integer setting for some configuration | +| mynew:arraysetting | string[] | Array of strings for multiple values | +``` + +Also update the default configuration example in the same file if you added defaults. + +### Step 5: Regenerate Schema and TypeScript Types + +Run the build tasks to regenerate schema and TypeScript types: + +```bash +task build:schema +task generate +``` + +Or run them individually: +```bash +# Regenerate JSON schema +task build:schema + +# Regenerate TypeScript types +go run cmd/generatets/main-generatets.go +``` + +This will update the schema files and [`frontend/types/gotypes.d.ts`](frontend/types/gotypes.d.ts) with your new settings. + +### Step 6: Use in Frontend Code + +Access your new setting in React components: + +```typescript +import { useSettingsKeyAtom } from "@/app/store/global"; + +// In a React component +const MyComponent = () => { + // Read global setting with fallback + const mySetting = useSettingsKeyAtom("mynew:setting") ?? "fallback value"; + + // For block-specific overrides + const myBlockSetting = useOverrideConfigAtom(blockId, "mynew:setting") ?? "fallback"; + + return
Setting value: {mySetting}
; +}; +``` + +### Step 7: Use in Backend Code + +Access settings in Go code: + +```go +// Get the full config +fullConfig := wconfig.GetWatcher().GetFullConfig() + +// Access your setting +myValue := fullConfig.Settings.MyNewSetting +``` + +## Configuration Patterns + +### Namespace Organization + +Settings are organized by namespace using colon separators: + +- `app:*` - Application-level settings +- `term:*` - Terminal-specific settings +- `window:*` - Window and UI settings +- `ai:*` - AI-related settings +- `web:*` - Web browser settings +- `editor:*` - Code editor settings +- `conn:*` - Connection settings + +### Clear/Reset Pattern + +Each namespace can have a "clear" field for resetting all settings in that namespace: + +```go +AppClear bool `json:"app:*,omitempty"` +TermClear bool `json:"term:*,omitempty"` +``` + +### Optional vs Required Settings + +- Use pointer types (`*bool`, `*int64`, `*float64`) for truly optional settings +- Use regular types for settings that should always have a value +- Provide sensible defaults for important settings + +### Block-Level Overrides + +Settings can be overridden at the block level using metadata: + +```typescript +// Set block-specific override +await RpcApi.SetMetaCommand(TabRpcClient, { + oref: WOS.makeORef("block", blockId), + meta: { "mynew:setting": "block-specific value" }, +}); +``` + +## Example: Adding a New Terminal Setting + +Let's walk through adding a new terminal setting `term:bellsound`: + +### 1. Go Struct (settingsconfig.go) + +```go +type SettingsType struct { + // ... existing fields ... + TermBellSound string `json:"term:bellsound,omitempty"` +} +``` + +### 2. JSON Schema (schema/settings.json) + +```json +{ + "properties": { + "term:bellsound": { + "type": "string" + } + } +} +``` + +### 3. Default Value (defaultconfig/settings.json) + +```json +{ + "term:bellsound": "default" +} +``` + +### 4. Documentation (docs/config.mdx) + +```markdown +| term:bellsound | string | Sound to play for terminal bell ("default", "none", or custom sound file path) | +``` + +### 5. Frontend Usage + +```typescript +const bellSound = useOverrideConfigAtom(blockId, "term:bellsound") ?? "default"; +``` + +## Testing Your Configuration + +1. **Build and run** Wave Terminal with your changes +2. **Test default behavior** - Ensure the default value works +3. **Test user override** - Add your setting to `~/.config/waveterm/settings.json` +4. **Test block override** - Set block-specific metadata +5. **Verify schema validation** - Ensure invalid values are rejected + +## Common Pitfalls From 0e51ce5b51dea68669e3dba7db9457d34fa334ae Mon Sep 17 00:00:00 2001 From: sawka Date: Tue, 19 Aug 2025 09:48:20 -0700 Subject: [PATCH 2/5] add ai:proxyurl to settings + aisettings --- frontend/types/gotypes.d.ts | 2 +- pkg/wconfig/metaconsts.go | 1 + pkg/wconfig/settingsconfig.go | 2 ++ schema/aipresets.json | 3 +++ schema/settings.json | 3 +++ 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/types/gotypes.d.ts b/frontend/types/gotypes.d.ts index 4f399e0e34..42a16254ac 100644 --- a/frontend/types/gotypes.d.ts +++ b/frontend/types/gotypes.d.ts @@ -559,7 +559,6 @@ declare global { "editor:minimapenabled"?: boolean; "editor:stickyscrollenabled"?: boolean; "editor:wordwrap"?: boolean; - "editor:fontsize"?: number; "graph:*"?: boolean; "graph:numpoints"?: number; "graph:metrics"?: string[]; @@ -693,6 +692,7 @@ declare global { "ai:apiversion"?: string; "ai:maxtokens"?: number; "ai:timeoutms"?: number; + "ai:proxyurl"?: string; "ai:fontsize"?: number; "ai:fixedfontsize"?: number; "term:*"?: boolean; diff --git a/pkg/wconfig/metaconsts.go b/pkg/wconfig/metaconsts.go index 0185b3bc24..1057b9c82f 100644 --- a/pkg/wconfig/metaconsts.go +++ b/pkg/wconfig/metaconsts.go @@ -22,6 +22,7 @@ const ( ConfigKey_AIApiVersion = "ai:apiversion" ConfigKey_AiMaxTokens = "ai:maxtokens" ConfigKey_AiTimeoutMs = "ai:timeoutms" + ConfigKey_AiProxyUrl = "ai:proxyurl" ConfigKey_AiFontSize = "ai:fontsize" ConfigKey_AiFixedFontSize = "ai:fixedfontsize" diff --git a/pkg/wconfig/settingsconfig.go b/pkg/wconfig/settingsconfig.go index 814d3d46a9..e926689abf 100644 --- a/pkg/wconfig/settingsconfig.go +++ b/pkg/wconfig/settingsconfig.go @@ -44,6 +44,7 @@ type AiSettingsType struct { AIApiVersion string `json:"ai:apiversion,omitempty"` AiMaxTokens float64 `json:"ai:maxtokens,omitempty"` AiTimeoutMs float64 `json:"ai:timeoutms,omitempty"` + AiProxyUrl string `json:"ai:proxyurl,omitempty"` AiFontSize float64 `json:"ai:fontsize,omitempty"` AiFixedFontSize float64 `json:"ai:fixedfontsize,omitempty"` DisplayName string `json:"display:name,omitempty"` @@ -67,6 +68,7 @@ type SettingsType struct { AIApiVersion string `json:"ai:apiversion,omitempty"` AiMaxTokens float64 `json:"ai:maxtokens,omitempty"` AiTimeoutMs float64 `json:"ai:timeoutms,omitempty"` + AiProxyUrl string `json:"ai:proxyurl,omitempty"` AiFontSize float64 `json:"ai:fontsize,omitempty"` AiFixedFontSize float64 `json:"ai:fixedfontsize,omitempty"` diff --git a/schema/aipresets.json b/schema/aipresets.json index db6d2b052e..c932a5c777 100644 --- a/schema/aipresets.json +++ b/schema/aipresets.json @@ -36,6 +36,9 @@ "ai:timeoutms": { "type": "number" }, + "ai:proxyurl": { + "type": "string" + }, "ai:fontsize": { "type": "number" }, diff --git a/schema/settings.json b/schema/settings.json index 395974b573..c885204a09 100644 --- a/schema/settings.json +++ b/schema/settings.json @@ -50,6 +50,9 @@ "ai:timeoutms": { "type": "number" }, + "ai:proxyurl": { + "type": "string" + }, "ai:fontsize": { "type": "number" }, From 80009474bb7e5cd93e963e20183e61494676b123 Mon Sep 17 00:00:00 2001 From: sawka Date: Tue, 19 Aug 2025 10:11:39 -0700 Subject: [PATCH 3/5] update roo rules with overview and guidelines --- .roo/rules/overview.md | 259 +++++++++++++++++++++++++++++++++++++++++ .roo/rules/rules.md | 109 +++++++++++++++++ 2 files changed, 368 insertions(+) create mode 100644 .roo/rules/overview.md create mode 100644 .roo/rules/rules.md diff --git a/.roo/rules/overview.md b/.roo/rules/overview.md new file mode 100644 index 0000000000..84289a1623 --- /dev/null +++ b/.roo/rules/overview.md @@ -0,0 +1,259 @@ +# Wave Terminal - High Level Architecture Overview + +## Project Description + +Wave Terminal is an open-source AI-native terminal built for seamless workflows. It's an Electron application that serves as a command line terminal host (it hosts CLI applications rather than running inside a CLI). The application combines a React frontend with a Go backend server to provide a modern terminal experience with advanced features. + +## Top-Level Directory Structure + +``` +waveterm/ +├── emain/ # Electron main process code +├── frontend/ # React application (renderer process) +├── cmd/ # Go command-line applications +├── pkg/ # Go packages/modules +├── db/ # Database migrations +├── docs/ # Documentation (Docusaurus) +├── build/ # Build configuration and assets +├── assets/ # Application assets (icons, images) +├── public/ # Static public assets +├── tests/ # Test files +├── .github/ # GitHub workflows and configuration +└── Configuration files (package.json, tsconfig.json, etc.) +``` + +## Architecture Components + +### 1. Electron Main Process (`emain/`) + +The Electron main process handles the native desktop application layer: + +**Key Files:** +- [`emain.ts`](emain/emain.ts) - Main entry point, application lifecycle management +- [`emain-window.ts`](emain/emain-window.ts) - Window management (`WaveBrowserWindow` class) +- [`emain-tabview.ts`](emain/emain-tabview.ts) - Tab view management (`WaveTabView` class) +- [`emain-wavesrv.ts`](emain/emain-wavesrv.ts) - Go backend server integration +- [`emain-wsh.ts`](emain/emain-wsh.ts) - WSH (Wave Shell) client integration +- [`menu.ts`](emain/menu.ts) - Application menu system +- [`updater.ts`](emain/updater.ts) - Auto-update functionality +- [`preload.ts`](emain/preload.ts) - Preload script for renderer security +- [`preload-webview.ts`](emain/preload-webview.ts) - Webview preload script + +**Responsibilities:** +- Window and tab management +- Native OS integration +- Auto-updater +- Menu system +- Security (preload scripts) +- Communication with Go backend + +### 2. Frontend React Application (`frontend/`) + +The React application runs in the Electron renderer process: + +**Structure:** +``` +frontend/ +├── app/ # Main application code +│ ├── app.tsx # Root App component +│ ├── block/ # Block-based UI components +│ ├── element/ # Reusable UI elements +│ ├── hook/ # Custom React hooks +│ ├── modals/ # Modal components +│ ├── store/ # State management (Jotai) +│ ├── view/ # Different view types +│ │ ├── chat/ # Chat interface +│ │ ├── codeeditor/ # Code editor (Monaco) +│ │ ├── term/ # Terminal view +│ │ ├── webview/ # Web view +│ │ └── waveai/ # AI integration +│ └── workspace/ # Workspace management +├── layout/ # Layout system +├── types/ # TypeScript type definitions +└── util/ # Utility functions +``` + +**Key Technologies:** +- React 18 with TypeScript +- Jotai for state management +- Monaco Editor for code editing +- XTerm.js for terminal emulation +- Tailwind CSS for styling +- SCSS for additional styling + +### 3. Go Backend Server (`cmd/server/`) + +The Go backend server handles all heavy lifting operations: + +**Entry Point:** [`main-server.go`](cmd/server/main-server.go) + +**Key Responsibilities:** +- Database operations +- SSH connections +- File system operations +- Networking +- Telemetry +- Configuration management +- WebSocket communication +- RPC services + +### 4. Go Packages (`pkg/`) + +The Go codebase is organized into modular packages: + +**Core Packages:** +- `wstore/` - Database and storage layer +- `wconfig/` - Configuration management +- `wcore/` - Core business logic +- `wshrpc/` - RPC communication system +- `wshutil/` - WSH (Wave Shell) utilities +- `blockcontroller/` - Block execution management +- `remote/` - Remote connection handling +- `filestore/` - File storage system +- `web/` - Web server and WebSocket handling +- `telemetry/` - Usage analytics and telemetry +- `waveobj/` - Core data objects +- `service/` - Service layer +- `util/` - Common utilities + +**Additional Packages:** +- `authkey/` - Authentication +- `eventbus/` - Event system +- `wcloud/` - Cloud integration +- `waveai/` - AI functionality +- `panichandler/` - Error handling +- `shellexec/` - Shell execution + +### 5. Command Line Tools (`cmd/`) + +Additional Go command-line utilities: +- `wsh/` - Wave Shell command-line tool +- `server/` - Main backend server +- `generatego/` - Code generation +- `generateschema/` - Schema generation +- `generatets/` - TypeScript generation +- `packfiles/` - File packaging utility + +### 6. Database Layer (`db/`) + +Database migrations for two main stores: +- `migrations-wstore/` - Main application database +- `migrations-filestore/` - File storage database + +## Communication Architecture + +The core communication system is built around the **WSH RPC (Wave Shell RPC)** system, which provides a unified interface for all inter-process communication. + +``` +┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐ +│ Electron │ │ React │ │ Go Backend │ +│ Main Process │◄──►│ Frontend │◄──►│ Server │ +│ (emain/) │ │ (frontend/) │ │ (cmd/server/) │ +└─────────────────┘ └──────────────────┘ └─────────────────┘ + │ │ │ + │ WSH RPC │ WSH RPC │ + ▼ ▼ ▼ +┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐ +│ Native OS │ │ Web APIs │ │ System APIs │ +│ Integration │ │ DOM/Canvas │ │ SSH/Network │ +└─────────────────┘ └──────────────────┘ └─────────────────┘ + │ + │ WSH RPC + ▼ + ┌─────────────────────┐ + │ Remote Systems │ + │ (SSH, WSL, etc.) │ + └─────────────────────┘ +``` + +### WSH RPC System (`pkg/wshrpc/`) + +The WSH RPC system is the backbone of Wave Terminal's communication architecture: + +**Key Components:** +- [`wshrpctypes.go`](pkg/wshrpc/wshrpctypes.go) - Core RPC interface and type definitions +- [`wshserver/`](pkg/wshrpc/wshserver/) - Server-side RPC implementation +- [`wshremote/`](pkg/wshrpc/wshremote/) - Remote connection handling +- [`wshclient.go`](pkg/wshrpc/wshclient.go) - Client-side RPC implementation + +**Transport Flexibility:** +- **WebSockets** - Primary transport for frontend ↔ backend communication +- **Unix Domain Sockets** - Local process communication +- **Terminal/Stdio** - Communication over terminal connections +- **SSH Tunneling** - Remote system communication + +**RPC Interface:** +The [`WshRpcInterface`](pkg/wshrpc/wshrpctypes.go:147) defines 100+ commands including: +- File operations (`FileRead`, `FileWrite`, `FileCopy`, etc.) +- Block management (`CreateBlock`, `DeleteBlock`, `ControllerInput`) +- Remote operations (`RemoteStreamFile`, `RemoteFileInfo`, etc.) +- Connection management (`ConnStatus`, `ConnConnect`, `ConnDisconnect`) +- AI integration (`AiSendMessage`, `StreamWaveAi`) +- Event system (`EventPublish`, `EventSub`, `EventRecv`) + +**Communication Flow:** +1. **Frontend → Backend**: React components call WSH RPC methods via WebSocket +2. **Electron → Backend**: Main process uses WSH RPC for system integration +3. **Backend → Remote**: Go server uses WSH RPC over SSH/terminal for remote operations +4. **WSH Binary**: Command-line tool communicates with backend via same RPC system + +This unified RPC system allows the `wsh` binary to work both locally and remotely, providing the same interface whether running on the local machine or on a remote server via SSH. + +### Type-Safe Code Generation + +Wave Terminal uses an innovative code generation system to maintain type safety between Go and TypeScript: + +**Generation Process:** +1. **Go Definitions** - All RPC types and interfaces are defined in Go ([`wshrpctypes.go`](pkg/wshrpc/wshrpctypes.go)) +2. **TypeScript Generation** - [`cmd/generatets/main-generatets.go`](cmd/generatets/main-generatets.go) automatically generates TypeScript bindings +3. **Build Integration** - The `generate` task in [`Taskfile.yml`](Taskfile.yml:252) runs code generation as part of the build process + +**Generated Files:** +- [`frontend/types/gotypes.d.ts`](frontend/types/gotypes.d.ts) - TypeScript type definitions from Go structs +- [`frontend/app/store/services.ts`](frontend/app/store/services.ts) - Service layer bindings +- [`frontend/app/store/wshclientapi.ts`](frontend/app/store/wshclientapi.ts) - RPC client API methods + +**Benefits:** +- **Type Safety** - Compile-time type checking between frontend and backend +- **Single Source of Truth** - Go types are the authoritative definition +- **Automatic Sync** - Changes to Go types automatically propagate to TypeScript +- **IDE Support** - Full IntelliSense and autocomplete for RPC calls + +This approach ensures that the frontend and backend stay in sync, preventing runtime errors from type mismatches and providing excellent developer experience with full type safety across the entire stack. + +## Build System + +**Configuration Files:** +- [`package.json`](package.json) - Node.js dependencies and scripts +- [`electron.vite.config.ts`](electron.vite.config.ts) - Vite build configuration +- [`tsconfig.json`](tsconfig.json) - TypeScript configuration +- [`electron-builder.config.cjs`](electron-builder.config.cjs) - Electron packaging + +**Build Targets:** +- **Main Process** - TypeScript → JavaScript (Node.js) +- **Preload Scripts** - TypeScript → CommonJS +- **Renderer** - React/TypeScript → ES6 bundle +- **Go Backend** - Go → Native binary + +## Key Features + +1. **Terminal Emulation** - XTerm.js-based terminal with modern features +2. **Block-based UI** - Modular block system for different content types +3. **AI Integration** - Built-in AI assistance and chat +4. **Code Editor** - Monaco Editor integration +5. **Remote Connections** - SSH and WSL support +6. **File Management** - Integrated file browser and operations +7. **Workspace Management** - Multi-workspace support +8. **Auto-updates** - Electron-based update system +9. **Cross-platform** - macOS, Linux, Windows support + +## Development Workflow + +1. **Frontend Development** - React components with hot reload +2. **Backend Development** - Go server with live reload +3. **Electron Integration** - Main process development +4. **Database Migrations** - SQL migration system +5. **Testing** - Vitest for frontend, Go testing for backend +6. **Documentation** - Docusaurus-based docs site + +This architecture provides a robust foundation for a modern terminal application, combining the best of web technologies (React, TypeScript) with native performance (Go, Electron) and system integration capabilities. \ No newline at end of file diff --git a/.roo/rules/rules.md b/.roo/rules/rules.md new file mode 100644 index 0000000000..519bacf82c --- /dev/null +++ b/.roo/rules/rules.md @@ -0,0 +1,109 @@ +Wave Terminal is a modern terminal which provides graphical blocks, dynamic layout, workspaces, and SSH connection management. It is cross platform and built on electron. + +### Project Structure + +It has a TypeScript/React frontend and a Go backend. They talk together over `wshrpc` a custom RPC protocol that is implemented over websocket (and domain sockets). + +### Coding Guidelines + +- **Go Conventions**: + - Don't use custom enum types in Go. Instead, use string constants (e.g., `const StatusRunning = "running"` rather than creating a custom type like `type Status string`). + - Use string constants for status values, packet types, and other string-based enumerations. + - in Go code, prefer using Printf() vs Println() + - use "Make" as opposed to "New" for struct initialization func names + - in general const decls go at the top fo the file (before types and functions) + - NEVER run `go build` (especially in weird sub-package directories). we can tell if everything compiles by seeing there are no problems/errors. +- **Synchronization**: + - Always prefer to use the `lock.Lock(); defer lock.Unlock()` pattern for synchronization if possible + - Avoid inline lock/unlock pairs - instead create helper functions that use the defer pattern + - When accessing shared data structures (maps, slices, etc.), ensure proper locking + - Example: Instead of `gc.lock.Lock(); gc.map[key]++; gc.lock.Unlock()`, create a helper function like `getNextValue(key string) int { gc.lock.Lock(); defer gc.lock.Unlock(); gc.map[key]++; return gc.map[key] }` +- **TypeScript Imports**: + - Use `@/...` for imports from different parts of the project (configured in `tsconfig.json` as `"@/*": ["frontend/*"]`). + - Prefer relative imports (`"./name"`) only within the same directory. + - Use named exports exclusively; avoid default exports. It's acceptable to export functions directly (e.g., React Components). + - Our indent is 4 spaces +- **JSON Field Naming**: All fields must be lowercase, without underscores. +- **TypeScript Conventions** + - **Type Handling**: + - In TypeScript we have strict null checks off, so no need to add "| null" to all the types. + - In TypeScript for Jotai atoms, if we want to write, we need to type the atom as a PrimitiveAtom + - Jotai has a bug with strict null checks off where if you create a null atom, e.g. atom(null) it does not "type" correctly. That's no issue, just cast it to the proper PrimitiveAtom type (no "| null") and it will work fine. + - Generally never use "=== undefined" or "!== undefined". This is bad style. Just use a "== null" or "!= null" unless it is a very specific case where we need to distinguish undefined from null. + - **Coding Style**: + - Use all lowercase filenames (except where case is actually important like Taskfile.yml) + - Import the "cn" function from "@/util/util" to do classname / clsx class merge (it uses twMerge underneath) + - For element variants use class-variance-authority + - **Component Practices**: + - Make sure to add cursor-pointer to buttons/links and clickable items + - NEVER use cursor-help (it looks terrible) + - useAtom() and useAtomValue() are react HOOKS, so they must be called at the component level not inline in JSX + - If you use React.memo(), make sure to add a displayName for the component + +### Styling + +- We use tailwind v4 to style. Custom stuff is defined in tailwindsetup.css. +- _never_ use cursor-help (it looks terrible) +- We have custom CSS setup as well, so it is a hybrid system. For new code we prefer tailwind, and are working to migrate code to all use tailwind. + +### Code Generation + +- **TypeScript Types**: TypeScript types are automatically generated from Go types. After modifying Go types in `pkg/wshrpc/wshrpctypes.go`, run `task generate` to update the TypeScript type definitions in `frontend/types/gotypes.d.ts`. +- **Manual Edits**: Do not manually edit generated files like `frontend/types/gotypes.d.ts` or `frontend/app/store/wshclientapi.ts`. Instead, modify the source Go types and run `task generate`. + +### Documentation References + +Found in /aiprompts + +- config-system.md -- for help with adding new config or settings values +- contextmenu.md +- getsetconfigvar.md +- view-prompt.md -- view model guide + +### Frontend Architecture + +- The application uses Jotai for state management. +- When working with Jotai atoms that need to be updated, define them as `PrimitiveAtom` rather than just `atom`. + +### Notes + +- **CRITICAL: Completion format MUST be: "Done: [one-line description]"** +- **Keep your Task Completed summaries VERY short** +- **No lengthy pre-completion summaries** - Do not provide detailed explanations of implementation before using attempt_completion +- **No recaps of changes** - Skip explaining what was done before completion +- **Go directly to completion** - After making changes, proceed directly to attempt_completion without summarizing +- The project is currently an un-released POC / MVP. Do not worry about backward compatibility when making changes +- With React hooks, always complete all hook calls at the top level before any conditional returns (including jotai hook calls useAtom and useAtomValue); when a user explicitly tells you a function handles null inputs, trust them and stop trying to "protect" it with unnecessary checks or workarounds. +- **Match response length to question complexity** - For simple, direct questions in Ask mode (especially those that can be answered in 1-2 sentences), provide equally brief answers. Save detailed explanations for complex topics or when explicitly requested. +- **CRITICAL** - useAtomValue and useAtom are React HOOKS. They cannot be used inline in JSX code, they must appear at the top of a component in the hooks area of the react code. + +### Strict Comment Rules + +- **NEVER add comments that merely describe what code is doing**: + - ❌ `mutex.Lock() // Lock the mutex` + - ❌ `counter++ // Increment the counter` + - ❌ `buffer.Write(data) // Write data to buffer` + - ❌ `// Header component for app run list` (above AppRunListHeader) + - ❌ `// Updated function to include onClick parameter` + - ❌ `// Changed padding calculation` + - ❌ `// Removed unnecessary div` + - ❌ `// Using the model's width value here` +- **Only use comments for**: + - Explaining WHY a particular approach was chosen + - Documenting non-obvious edge cases or side effects + - Warning about potential pitfalls in usage + - Explaining complex algorithms that can't be simplified +- **When in doubt, leave it out**. No comment is better than a redundant comment. +- **Never add comments explaining code changes** - The code should speak for itself, and version control tracks changes. The one exception to this rule is if it is a very unobvious implementation. Something that someone would typically implement in a different (wrong) way. Then the comment helps us remember WHY we changed it to a less obvious implementation. + +### Tool Use + +Do NOT use write_to_file unless it is a new file or very short. Always prefer to use replace_in_file. Often your diffs fail when a file may be out of date in your cache vs the actual on-disk format. You should RE-READ the file and try to create diffs again if your diffs fail rather than fall back to write_to_file. If you feel like your ONLY option is to use write_to_file please ask first. + +Also when adding content to the end of files prefer to use the new append_file tool rather than trying to create a diff (as your diffs are often not specific enough and end up inserting code in the middle of existing functions). + +### Directory Awareness + +- **ALWAYS verify the current working directory before executing commands** +- Either run "pwd" first to verify the directory, or do a "cd" to the correct absolute directory before running commands +- When running tests, do not "cd" to the pkg directory and then run the test. This screws up the cwd and you never recover. run the test from the project root instead. From 166367311616081ce18e80bccd68c832fa0063d7 Mon Sep 17 00:00:00 2001 From: sawka Date: Tue, 19 Aug 2025 10:11:56 -0700 Subject: [PATCH 4/5] add support for proxyurl --- aiprompts/overview.md | 259 -------------------------------- pkg/waveai/anthropicbackend.go | 14 ++ pkg/waveai/googlebackend.go | 27 +++- pkg/waveai/openaibackend.go | 17 +++ pkg/waveai/perplexitybackend.go | 14 ++ pkg/wshrpc/wshrpctypes.go | 1 + 6 files changed, 72 insertions(+), 260 deletions(-) delete mode 100644 aiprompts/overview.md diff --git a/aiprompts/overview.md b/aiprompts/overview.md deleted file mode 100644 index 84289a1623..0000000000 --- a/aiprompts/overview.md +++ /dev/null @@ -1,259 +0,0 @@ -# Wave Terminal - High Level Architecture Overview - -## Project Description - -Wave Terminal is an open-source AI-native terminal built for seamless workflows. It's an Electron application that serves as a command line terminal host (it hosts CLI applications rather than running inside a CLI). The application combines a React frontend with a Go backend server to provide a modern terminal experience with advanced features. - -## Top-Level Directory Structure - -``` -waveterm/ -├── emain/ # Electron main process code -├── frontend/ # React application (renderer process) -├── cmd/ # Go command-line applications -├── pkg/ # Go packages/modules -├── db/ # Database migrations -├── docs/ # Documentation (Docusaurus) -├── build/ # Build configuration and assets -├── assets/ # Application assets (icons, images) -├── public/ # Static public assets -├── tests/ # Test files -├── .github/ # GitHub workflows and configuration -└── Configuration files (package.json, tsconfig.json, etc.) -``` - -## Architecture Components - -### 1. Electron Main Process (`emain/`) - -The Electron main process handles the native desktop application layer: - -**Key Files:** -- [`emain.ts`](emain/emain.ts) - Main entry point, application lifecycle management -- [`emain-window.ts`](emain/emain-window.ts) - Window management (`WaveBrowserWindow` class) -- [`emain-tabview.ts`](emain/emain-tabview.ts) - Tab view management (`WaveTabView` class) -- [`emain-wavesrv.ts`](emain/emain-wavesrv.ts) - Go backend server integration -- [`emain-wsh.ts`](emain/emain-wsh.ts) - WSH (Wave Shell) client integration -- [`menu.ts`](emain/menu.ts) - Application menu system -- [`updater.ts`](emain/updater.ts) - Auto-update functionality -- [`preload.ts`](emain/preload.ts) - Preload script for renderer security -- [`preload-webview.ts`](emain/preload-webview.ts) - Webview preload script - -**Responsibilities:** -- Window and tab management -- Native OS integration -- Auto-updater -- Menu system -- Security (preload scripts) -- Communication with Go backend - -### 2. Frontend React Application (`frontend/`) - -The React application runs in the Electron renderer process: - -**Structure:** -``` -frontend/ -├── app/ # Main application code -│ ├── app.tsx # Root App component -│ ├── block/ # Block-based UI components -│ ├── element/ # Reusable UI elements -│ ├── hook/ # Custom React hooks -│ ├── modals/ # Modal components -│ ├── store/ # State management (Jotai) -│ ├── view/ # Different view types -│ │ ├── chat/ # Chat interface -│ │ ├── codeeditor/ # Code editor (Monaco) -│ │ ├── term/ # Terminal view -│ │ ├── webview/ # Web view -│ │ └── waveai/ # AI integration -│ └── workspace/ # Workspace management -├── layout/ # Layout system -├── types/ # TypeScript type definitions -└── util/ # Utility functions -``` - -**Key Technologies:** -- React 18 with TypeScript -- Jotai for state management -- Monaco Editor for code editing -- XTerm.js for terminal emulation -- Tailwind CSS for styling -- SCSS for additional styling - -### 3. Go Backend Server (`cmd/server/`) - -The Go backend server handles all heavy lifting operations: - -**Entry Point:** [`main-server.go`](cmd/server/main-server.go) - -**Key Responsibilities:** -- Database operations -- SSH connections -- File system operations -- Networking -- Telemetry -- Configuration management -- WebSocket communication -- RPC services - -### 4. Go Packages (`pkg/`) - -The Go codebase is organized into modular packages: - -**Core Packages:** -- `wstore/` - Database and storage layer -- `wconfig/` - Configuration management -- `wcore/` - Core business logic -- `wshrpc/` - RPC communication system -- `wshutil/` - WSH (Wave Shell) utilities -- `blockcontroller/` - Block execution management -- `remote/` - Remote connection handling -- `filestore/` - File storage system -- `web/` - Web server and WebSocket handling -- `telemetry/` - Usage analytics and telemetry -- `waveobj/` - Core data objects -- `service/` - Service layer -- `util/` - Common utilities - -**Additional Packages:** -- `authkey/` - Authentication -- `eventbus/` - Event system -- `wcloud/` - Cloud integration -- `waveai/` - AI functionality -- `panichandler/` - Error handling -- `shellexec/` - Shell execution - -### 5. Command Line Tools (`cmd/`) - -Additional Go command-line utilities: -- `wsh/` - Wave Shell command-line tool -- `server/` - Main backend server -- `generatego/` - Code generation -- `generateschema/` - Schema generation -- `generatets/` - TypeScript generation -- `packfiles/` - File packaging utility - -### 6. Database Layer (`db/`) - -Database migrations for two main stores: -- `migrations-wstore/` - Main application database -- `migrations-filestore/` - File storage database - -## Communication Architecture - -The core communication system is built around the **WSH RPC (Wave Shell RPC)** system, which provides a unified interface for all inter-process communication. - -``` -┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐ -│ Electron │ │ React │ │ Go Backend │ -│ Main Process │◄──►│ Frontend │◄──►│ Server │ -│ (emain/) │ │ (frontend/) │ │ (cmd/server/) │ -└─────────────────┘ └──────────────────┘ └─────────────────┘ - │ │ │ - │ WSH RPC │ WSH RPC │ - ▼ ▼ ▼ -┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐ -│ Native OS │ │ Web APIs │ │ System APIs │ -│ Integration │ │ DOM/Canvas │ │ SSH/Network │ -└─────────────────┘ └──────────────────┘ └─────────────────┘ - │ - │ WSH RPC - ▼ - ┌─────────────────────┐ - │ Remote Systems │ - │ (SSH, WSL, etc.) │ - └─────────────────────┘ -``` - -### WSH RPC System (`pkg/wshrpc/`) - -The WSH RPC system is the backbone of Wave Terminal's communication architecture: - -**Key Components:** -- [`wshrpctypes.go`](pkg/wshrpc/wshrpctypes.go) - Core RPC interface and type definitions -- [`wshserver/`](pkg/wshrpc/wshserver/) - Server-side RPC implementation -- [`wshremote/`](pkg/wshrpc/wshremote/) - Remote connection handling -- [`wshclient.go`](pkg/wshrpc/wshclient.go) - Client-side RPC implementation - -**Transport Flexibility:** -- **WebSockets** - Primary transport for frontend ↔ backend communication -- **Unix Domain Sockets** - Local process communication -- **Terminal/Stdio** - Communication over terminal connections -- **SSH Tunneling** - Remote system communication - -**RPC Interface:** -The [`WshRpcInterface`](pkg/wshrpc/wshrpctypes.go:147) defines 100+ commands including: -- File operations (`FileRead`, `FileWrite`, `FileCopy`, etc.) -- Block management (`CreateBlock`, `DeleteBlock`, `ControllerInput`) -- Remote operations (`RemoteStreamFile`, `RemoteFileInfo`, etc.) -- Connection management (`ConnStatus`, `ConnConnect`, `ConnDisconnect`) -- AI integration (`AiSendMessage`, `StreamWaveAi`) -- Event system (`EventPublish`, `EventSub`, `EventRecv`) - -**Communication Flow:** -1. **Frontend → Backend**: React components call WSH RPC methods via WebSocket -2. **Electron → Backend**: Main process uses WSH RPC for system integration -3. **Backend → Remote**: Go server uses WSH RPC over SSH/terminal for remote operations -4. **WSH Binary**: Command-line tool communicates with backend via same RPC system - -This unified RPC system allows the `wsh` binary to work both locally and remotely, providing the same interface whether running on the local machine or on a remote server via SSH. - -### Type-Safe Code Generation - -Wave Terminal uses an innovative code generation system to maintain type safety between Go and TypeScript: - -**Generation Process:** -1. **Go Definitions** - All RPC types and interfaces are defined in Go ([`wshrpctypes.go`](pkg/wshrpc/wshrpctypes.go)) -2. **TypeScript Generation** - [`cmd/generatets/main-generatets.go`](cmd/generatets/main-generatets.go) automatically generates TypeScript bindings -3. **Build Integration** - The `generate` task in [`Taskfile.yml`](Taskfile.yml:252) runs code generation as part of the build process - -**Generated Files:** -- [`frontend/types/gotypes.d.ts`](frontend/types/gotypes.d.ts) - TypeScript type definitions from Go structs -- [`frontend/app/store/services.ts`](frontend/app/store/services.ts) - Service layer bindings -- [`frontend/app/store/wshclientapi.ts`](frontend/app/store/wshclientapi.ts) - RPC client API methods - -**Benefits:** -- **Type Safety** - Compile-time type checking between frontend and backend -- **Single Source of Truth** - Go types are the authoritative definition -- **Automatic Sync** - Changes to Go types automatically propagate to TypeScript -- **IDE Support** - Full IntelliSense and autocomplete for RPC calls - -This approach ensures that the frontend and backend stay in sync, preventing runtime errors from type mismatches and providing excellent developer experience with full type safety across the entire stack. - -## Build System - -**Configuration Files:** -- [`package.json`](package.json) - Node.js dependencies and scripts -- [`electron.vite.config.ts`](electron.vite.config.ts) - Vite build configuration -- [`tsconfig.json`](tsconfig.json) - TypeScript configuration -- [`electron-builder.config.cjs`](electron-builder.config.cjs) - Electron packaging - -**Build Targets:** -- **Main Process** - TypeScript → JavaScript (Node.js) -- **Preload Scripts** - TypeScript → CommonJS -- **Renderer** - React/TypeScript → ES6 bundle -- **Go Backend** - Go → Native binary - -## Key Features - -1. **Terminal Emulation** - XTerm.js-based terminal with modern features -2. **Block-based UI** - Modular block system for different content types -3. **AI Integration** - Built-in AI assistance and chat -4. **Code Editor** - Monaco Editor integration -5. **Remote Connections** - SSH and WSL support -6. **File Management** - Integrated file browser and operations -7. **Workspace Management** - Multi-workspace support -8. **Auto-updates** - Electron-based update system -9. **Cross-platform** - macOS, Linux, Windows support - -## Development Workflow - -1. **Frontend Development** - React components with hot reload -2. **Backend Development** - Go server with live reload -3. **Electron Integration** - Main process development -4. **Database Migrations** - SQL migration system -5. **Testing** - Vitest for frontend, Go testing for backend -6. **Documentation** - Docusaurus-based docs site - -This architecture provides a robust foundation for a modern terminal application, combining the best of web technologies (React, TypeScript) with native performance (Go, Electron) and system integration capabilities. \ No newline at end of file diff --git a/pkg/waveai/anthropicbackend.go b/pkg/waveai/anthropicbackend.go index 81a07e881d..496d73b075 100644 --- a/pkg/waveai/anthropicbackend.go +++ b/pkg/waveai/anthropicbackend.go @@ -11,6 +11,7 @@ import ( "fmt" "io" "net/http" + "net/url" "strings" "github.com/wavetermdev/waveterm/pkg/panichandler" @@ -180,7 +181,20 @@ func (AnthropicBackend) StreamCompletion(ctx context.Context, request wshrpc.Wav req.Header.Set("x-api-key", request.Opts.APIToken) req.Header.Set("anthropic-version", "2023-06-01") + // Configure HTTP client with proxy if specified client := &http.Client{} + if request.Opts.ProxyURL != "" { + proxyURL, err := url.Parse(request.Opts.ProxyURL) + if err != nil { + rtn <- makeAIError(fmt.Errorf("invalid proxy URL: %v", err)) + return + } + transport := &http.Transport{ + Proxy: http.ProxyURL(proxyURL), + } + client.Transport = transport + } + resp, err := client.Do(req) if err != nil { rtn <- makeAIError(fmt.Errorf("failed to send anthropic request: %v", err)) diff --git a/pkg/waveai/googlebackend.go b/pkg/waveai/googlebackend.go index 06daf76dcd..8c87259873 100644 --- a/pkg/waveai/googlebackend.go +++ b/pkg/waveai/googlebackend.go @@ -4,6 +4,8 @@ import ( "context" "fmt" "log" + "net/http" + "net/url" "github.com/google/generative-ai-go/genai" "github.com/wavetermdev/waveterm/pkg/wshrpc" @@ -16,7 +18,30 @@ type GoogleBackend struct{} var _ AIBackend = GoogleBackend{} func (GoogleBackend) StreamCompletion(ctx context.Context, request wshrpc.WaveAIStreamRequest) chan wshrpc.RespOrErrorUnion[wshrpc.WaveAIPacketType] { - client, err := genai.NewClient(ctx, option.WithAPIKey(request.Opts.APIToken)) + var clientOptions []option.ClientOption + clientOptions = append(clientOptions, option.WithAPIKey(request.Opts.APIToken)) + + // Configure proxy if specified + if request.Opts.ProxyURL != "" { + proxyURL, err := url.Parse(request.Opts.ProxyURL) + if err != nil { + rtn := make(chan wshrpc.RespOrErrorUnion[wshrpc.WaveAIPacketType]) + go func() { + defer close(rtn) + rtn <- makeAIError(fmt.Errorf("invalid proxy URL: %v", err)) + }() + return rtn + } + transport := &http.Transport{ + Proxy: http.ProxyURL(proxyURL), + } + httpClient := &http.Client{ + Transport: transport, + } + clientOptions = append(clientOptions, option.WithHTTPClient(httpClient)) + } + + client, err := genai.NewClient(ctx, clientOptions...) if err != nil { log.Printf("failed to create client: %v", err) return nil diff --git a/pkg/waveai/openaibackend.go b/pkg/waveai/openaibackend.go index 36135884a6..c077afeea4 100644 --- a/pkg/waveai/openaibackend.go +++ b/pkg/waveai/openaibackend.go @@ -8,6 +8,8 @@ import ( "errors" "fmt" "io" + "net/http" + "net/url" "regexp" "strings" @@ -100,6 +102,21 @@ func (OpenAIBackend) StreamCompletion(ctx context.Context, request wshrpc.WaveAI clientConfig.APIVersion = request.Opts.APIVersion } + // Configure proxy if specified + if request.Opts.ProxyURL != "" { + proxyURL, err := url.Parse(request.Opts.ProxyURL) + if err != nil { + rtn <- makeAIError(fmt.Errorf("invalid proxy URL: %v", err)) + return + } + transport := &http.Transport{ + Proxy: http.ProxyURL(proxyURL), + } + clientConfig.HTTPClient = &http.Client{ + Transport: transport, + } + } + client := openaiapi.NewClientWithConfig(clientConfig) req := openaiapi.ChatCompletionRequest{ Model: request.Opts.Model, diff --git a/pkg/waveai/perplexitybackend.go b/pkg/waveai/perplexitybackend.go index a3786cabd1..e24481d417 100644 --- a/pkg/waveai/perplexitybackend.go +++ b/pkg/waveai/perplexitybackend.go @@ -11,6 +11,7 @@ import ( "fmt" "io" "net/http" + "net/url" "strings" "github.com/wavetermdev/waveterm/pkg/panichandler" @@ -108,7 +109,20 @@ func (PerplexityBackend) StreamCompletion(ctx context.Context, request wshrpc.Wa req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer "+request.Opts.APIToken) + // Configure HTTP client with proxy if specified client := &http.Client{} + if request.Opts.ProxyURL != "" { + proxyURL, err := url.Parse(request.Opts.ProxyURL) + if err != nil { + rtn <- makeAIError(fmt.Errorf("invalid proxy URL: %v", err)) + return + } + transport := &http.Transport{ + Proxy: http.ProxyURL(proxyURL), + } + client.Transport = transport + } + resp, err := client.Do(req) if err != nil { rtn <- makeAIError(fmt.Errorf("failed to send perplexity request: %v", err)) diff --git a/pkg/wshrpc/wshrpctypes.go b/pkg/wshrpc/wshrpctypes.go index 3d629533cf..0b984a468e 100644 --- a/pkg/wshrpc/wshrpctypes.go +++ b/pkg/wshrpc/wshrpctypes.go @@ -496,6 +496,7 @@ type WaveAIOptsType struct { OrgID string `json:"orgid,omitempty"` APIVersion string `json:"apiversion,omitempty"` BaseURL string `json:"baseurl,omitempty"` + ProxyURL string `json:"proxyurl,omitempty"` MaxTokens int `json:"maxtokens,omitempty"` MaxChoices int `json:"maxchoices,omitempty"` TimeoutMs int `json:"timeoutms,omitempty"` From 11f1af46c467282419f7d6fdbe73778e82170b00 Mon Sep 17 00:00:00 2001 From: sawka Date: Tue, 19 Aug 2025 10:16:46 -0700 Subject: [PATCH 5/5] pass proxyurl from frontend to backend --- frontend/app/view/waveai/waveai.tsx | 1 + frontend/types/gotypes.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/frontend/app/view/waveai/waveai.tsx b/frontend/app/view/waveai/waveai.tsx index 3ed852a780..3c36087cc8 100644 --- a/frontend/app/view/waveai/waveai.tsx +++ b/frontend/app/view/waveai/waveai.tsx @@ -187,6 +187,7 @@ export class WaveAiModel implements ViewModel { maxtokens: mergedPresets["ai:maxtokens"] ?? null, timeoutms: mergedPresets["ai:timeoutms"] ?? 60000, baseurl: mergedPresets["ai:baseurl"] ?? null, + proxyurl: mergedPresets["ai:proxyurl"] ?? null, }; return opts; }); diff --git a/frontend/types/gotypes.d.ts b/frontend/types/gotypes.d.ts index 42a16254ac..13868f341b 100644 --- a/frontend/types/gotypes.d.ts +++ b/frontend/types/gotypes.d.ts @@ -1168,6 +1168,7 @@ declare global { orgid?: string; apiversion?: string; baseurl?: string; + proxyurl?: string; maxtokens?: number; maxchoices?: number; timeoutms?: number;