langmart-gateway-type3 3.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +174 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Gateway Type 3 - Seller-Managed Gateway
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/langmart-gateway-type3)
|
|
4
|
+
|
|
3
5
|
## Overview
|
|
4
6
|
Type 3 Gateway is a seller-managed gateway client that runs on the seller's infrastructure. It connects to the marketplace via WebSocket and uses the seller's own API keys to fulfill requests.
|
|
5
7
|
|
|
@@ -18,42 +20,200 @@ Type 3 Gateway is a seller-managed gateway client that runs on the seller's infr
|
|
|
18
20
|
- **Interactive CLI UI** with chat interface and model management
|
|
19
21
|
- **Intelligent Image Generation** with keyword-based auto-detection
|
|
20
22
|
- **Terminal Image Preview** for generated images
|
|
23
|
+
- **DevOps Mode**: Full session management with bash, SSH, and system tools
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 🚀 Quick Install (Recommended)
|
|
28
|
+
|
|
29
|
+
Install the gateway on any server with a single command:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Using unpkg CDN (recommended)
|
|
33
|
+
curl -fsSL https://unpkg.com/langmart-gateway-type3/scripts/install.sh | bash -s -- \
|
|
34
|
+
--marketplace-url ws://your-marketplace:8081 \
|
|
35
|
+
--api-key YOUR_API_KEY \
|
|
36
|
+
--full \
|
|
37
|
+
--service
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Install Options
|
|
41
|
+
|
|
42
|
+
| Option | Description | Default |
|
|
43
|
+
|--------|-------------|---------|
|
|
44
|
+
| `--marketplace-url URL` | Marketplace WebSocket URL | `ws://localhost:8081` |
|
|
45
|
+
| `--api-key KEY` | Gateway API key for authentication | (none) |
|
|
46
|
+
| `--port PORT` | Gateway port | `8083` |
|
|
47
|
+
| `--install-dir DIR` | Installation directory | `/opt/langmart-gateway` |
|
|
48
|
+
| `--capabilities CAPS` | Capabilities: `session,llm` or `llm` | `llm` |
|
|
49
|
+
| `--full` | Enable full capabilities (DevOps + LLM) | (disabled) |
|
|
50
|
+
| `--service` | Install as systemd service | (disabled) |
|
|
51
|
+
|
|
52
|
+
### Examples
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# LLM routing only (default)
|
|
56
|
+
curl -fsSL https://unpkg.com/langmart-gateway-type3/scripts/install.sh | bash -s -- \
|
|
57
|
+
--marketplace-url ws://10.0.1.117:8081 \
|
|
58
|
+
--api-key sk-test-inference-key
|
|
59
|
+
|
|
60
|
+
# Full DevOps mode with systemd service
|
|
61
|
+
curl -fsSL https://unpkg.com/langmart-gateway-type3/scripts/install.sh | bash -s -- \
|
|
62
|
+
--marketplace-url ws://10.0.1.117:8081 \
|
|
63
|
+
--api-key sk-test-inference-key \
|
|
64
|
+
--full \
|
|
65
|
+
--service
|
|
66
|
+
|
|
67
|
+
# Custom port and directory
|
|
68
|
+
curl -fsSL https://unpkg.com/langmart-gateway-type3/scripts/install.sh | bash -s -- \
|
|
69
|
+
--marketplace-url ws://10.0.1.117:8081 \
|
|
70
|
+
--api-key sk-test-inference-key \
|
|
71
|
+
--port 9000 \
|
|
72
|
+
--install-dir /home/user/gateway
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Alternative CDN
|
|
21
76
|
|
|
22
|
-
|
|
77
|
+
```bash
|
|
78
|
+
# Using jsdelivr
|
|
79
|
+
curl -fsSL https://cdn.jsdelivr.net/npm/langmart-gateway-type3/scripts/install.sh | bash -s -- [OPTIONS]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 📦 Manual Installation
|
|
85
|
+
|
|
86
|
+
### Option 1: npm install
|
|
23
87
|
|
|
24
88
|
```bash
|
|
89
|
+
# Create installation directory
|
|
90
|
+
mkdir -p /opt/langmart-gateway && cd /opt/langmart-gateway
|
|
91
|
+
|
|
92
|
+
# Initialize and install
|
|
93
|
+
npm init -y
|
|
94
|
+
npm install langmart-gateway-type3
|
|
95
|
+
|
|
96
|
+
# Create .env file
|
|
97
|
+
cat > .env << EOF
|
|
98
|
+
INSTANCE_ID=gw3-$(hostname)-$(date +%s | tail -c 5)
|
|
99
|
+
GATEWAY_PORT=8083
|
|
100
|
+
MARKETPLACE_URL=ws://your-marketplace:8081
|
|
101
|
+
GATEWAY_API_KEY=your-api-key
|
|
102
|
+
GATEWAY_CAPABILITIES=llm
|
|
103
|
+
NODE_ENV=production
|
|
104
|
+
EOF
|
|
105
|
+
|
|
106
|
+
# Start the gateway
|
|
107
|
+
node node_modules/langmart-gateway-type3/dist/index-server.js
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Option 2: Clone and Build
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Clone the repository
|
|
114
|
+
git clone https://github.com/YiHuangDB/LangMartDesign.git
|
|
115
|
+
cd LangMartDesign/gateway-type3
|
|
116
|
+
|
|
25
117
|
# Install dependencies
|
|
26
118
|
npm install
|
|
27
119
|
|
|
28
120
|
# Build TypeScript
|
|
29
121
|
npm run build
|
|
122
|
+
|
|
123
|
+
# Configure
|
|
124
|
+
cp .env.example .env
|
|
125
|
+
# Edit .env with your settings
|
|
126
|
+
|
|
127
|
+
# Start
|
|
128
|
+
npm start
|
|
30
129
|
```
|
|
31
130
|
|
|
32
|
-
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## ⚙️ Configuration
|
|
134
|
+
|
|
135
|
+
### Environment Variables
|
|
33
136
|
|
|
34
|
-
Environment variables:
|
|
35
137
|
```bash
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
138
|
+
# Gateway identification
|
|
139
|
+
INSTANCE_ID=gw3-server-001 # Gateway identifier (auto-generated if not set)
|
|
140
|
+
GATEWAY_PORT=8083 # Gateway HTTP/WebSocket port
|
|
141
|
+
|
|
142
|
+
# Marketplace connection
|
|
143
|
+
MARKETPLACE_URL=ws://localhost:8081 # Marketplace WebSocket URL
|
|
144
|
+
GATEWAY_API_KEY=sk-your-key # Marketplace API key
|
|
145
|
+
|
|
146
|
+
# Capabilities
|
|
147
|
+
GATEWAY_CAPABILITIES=llm # "llm" or "session,llm" for full DevOps
|
|
39
148
|
|
|
40
|
-
#
|
|
149
|
+
# Local vault (for storing provider API keys)
|
|
150
|
+
VAULT_PATH=.vault/credentials.enc # Encrypted vault path
|
|
151
|
+
VAULT_PASSWORD=random-secure-password # Vault encryption password
|
|
152
|
+
|
|
153
|
+
# Provider API Keys (seller's own keys - stored in vault)
|
|
41
154
|
OPENAI_API_KEY=sk-... # OpenAI API key
|
|
42
155
|
ANTHROPIC_API_KEY=sk-ant-... # Anthropic API key
|
|
43
|
-
|
|
44
|
-
DEEPSEEK_API_KEY=sk-... # DeepSeek API key
|
|
156
|
+
GROQ_API_KEY=gsk_... # Groq API key
|
|
45
157
|
```
|
|
46
158
|
|
|
47
|
-
|
|
159
|
+
### Capability Modes
|
|
160
|
+
|
|
161
|
+
| Mode | GATEWAY_CAPABILITIES | Description |
|
|
162
|
+
|------|---------------------|-------------|
|
|
163
|
+
| **LLM Only** | `llm` | Routes LLM requests to providers (default) |
|
|
164
|
+
| **Full DevOps** | `session,llm` | LLM routing + bash, SSH, file ops, system tools |
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## 🏃 Running
|
|
169
|
+
|
|
170
|
+
### Manual Start
|
|
48
171
|
|
|
49
172
|
```bash
|
|
50
|
-
|
|
51
|
-
npm run dev
|
|
173
|
+
cd /opt/langmart-gateway
|
|
52
174
|
|
|
53
|
-
#
|
|
54
|
-
|
|
175
|
+
# If installed via npm
|
|
176
|
+
./start.sh
|
|
177
|
+
|
|
178
|
+
# Or directly
|
|
179
|
+
node node_modules/langmart-gateway-type3/dist/index-server.js
|
|
55
180
|
```
|
|
56
181
|
|
|
182
|
+
### Systemd Service
|
|
183
|
+
|
|
184
|
+
If installed with `--service`:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Start
|
|
188
|
+
sudo systemctl start langmart-gateway
|
|
189
|
+
|
|
190
|
+
# Stop
|
|
191
|
+
sudo systemctl stop langmart-gateway
|
|
192
|
+
|
|
193
|
+
# Status
|
|
194
|
+
sudo systemctl status langmart-gateway
|
|
195
|
+
|
|
196
|
+
# Logs
|
|
197
|
+
sudo journalctl -u langmart-gateway -f
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Verify Installation
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# Health check
|
|
204
|
+
curl http://localhost:8083/health
|
|
205
|
+
|
|
206
|
+
# Expected response:
|
|
207
|
+
{
|
|
208
|
+
"status": "healthy",
|
|
209
|
+
"gatewayId": "gw3-server-12345",
|
|
210
|
+
"capabilities": ["session", "llm"],
|
|
211
|
+
"tools": 18
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
57
217
|
## How It Works
|
|
58
218
|
|
|
59
219
|
1. **Connection**: Gateway connects to marketplace via WebSocket
|