langmart-gateway-type3 3.0.42 → 3.0.44
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/.env.example +3 -3
- package/README.md +38 -38
- package/dist/index-server.js +1 -1
- package/dist/index-server.js.map +1 -1
- package/package.json +1 -1
- package/scripts/install.ps1 +14 -14
- package/scripts/install.sh +9 -9
- package/scripts/start.ps1 +5 -5
- package/scripts/start.sh +4 -4
package/.env.example
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
INSTANCE_ID=gw3-local-001
|
|
6
6
|
GATEWAY_PORT=8083
|
|
7
7
|
|
|
8
|
-
#
|
|
9
|
-
|
|
8
|
+
# Platform connection
|
|
9
|
+
PLATFORM_URL=ws://10.0.1.117:8081
|
|
10
10
|
|
|
11
|
-
# Gateway authentication (required for
|
|
11
|
+
# Gateway authentication (required for platform connection)
|
|
12
12
|
GATEWAY_API_KEY=sk-test-inference-key
|
|
13
13
|
# Alternative: API_KEY=sk-test-inference-key
|
|
14
14
|
|
package/README.md
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/langmart-gateway-type3)
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
|
-
Type 3 Gateway is a seller-managed gateway client that runs on the seller's infrastructure. It connects to the
|
|
6
|
+
Type 3 Gateway is a seller-managed gateway client that runs on the seller's infrastructure. It connects to the platform via WebSocket and uses the seller's own API keys to fulfill requests.
|
|
7
7
|
|
|
8
8
|
## Architecture
|
|
9
9
|
- **Deployment**: Seller's own infrastructure
|
|
10
10
|
- **Credentials**: Seller's own API keys
|
|
11
|
-
- **Connection**: WebSocket client to
|
|
11
|
+
- **Connection**: WebSocket client to platform
|
|
12
12
|
- **Control**: Fully managed by seller
|
|
13
13
|
|
|
14
14
|
## Features
|
|
@@ -33,7 +33,7 @@ Install the gateway on any Linux/macOS server with a single command:
|
|
|
33
33
|
```bash
|
|
34
34
|
# Using unpkg CDN (recommended)
|
|
35
35
|
curl -fsSL https://unpkg.com/langmart-gateway-type3/scripts/install.sh | bash -s -- \
|
|
36
|
-
--
|
|
36
|
+
--platform-url ws://your-platform:8081 \
|
|
37
37
|
--api-key YOUR_API_KEY \
|
|
38
38
|
--full \
|
|
39
39
|
--service
|
|
@@ -45,11 +45,11 @@ Install on Windows using PowerShell:
|
|
|
45
45
|
|
|
46
46
|
```powershell
|
|
47
47
|
# One-liner installation
|
|
48
|
-
$env:
|
|
48
|
+
$env:PLATFORM_URL="ws://your-platform:8081"; $env:GATEWAY_API_KEY="YOUR_API_KEY"; iwr -useb https://unpkg.com/langmart-gateway-type3/scripts/install.ps1 | iex
|
|
49
49
|
|
|
50
50
|
# Or download and run with parameters
|
|
51
51
|
iwr -OutFile install.ps1 https://unpkg.com/langmart-gateway-type3/scripts/install.ps1
|
|
52
|
-
.\install.ps1 -
|
|
52
|
+
.\install.ps1 -PlatformUrl "ws://your-platform:8081" -ApiKey "YOUR_API_KEY" -Full -Service
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
### Install Options
|
|
@@ -58,7 +58,7 @@ iwr -OutFile install.ps1 https://unpkg.com/langmart-gateway-type3/scripts/instal
|
|
|
58
58
|
|
|
59
59
|
| Option | Description | Default |
|
|
60
60
|
|--------|-------------|---------|
|
|
61
|
-
| `--
|
|
61
|
+
| `--platform-url URL` | Platform WebSocket URL | `ws://localhost:8081` |
|
|
62
62
|
| `--api-key KEY` | Gateway API key for authentication | (none) |
|
|
63
63
|
| `--port PORT` | Gateway port | `8083` |
|
|
64
64
|
| `--install-dir DIR` | Installation directory | `/opt/langmart-gateway` |
|
|
@@ -70,7 +70,7 @@ iwr -OutFile install.ps1 https://unpkg.com/langmart-gateway-type3/scripts/instal
|
|
|
70
70
|
|
|
71
71
|
| Parameter | Description | Default |
|
|
72
72
|
|-----------|-------------|---------|
|
|
73
|
-
| `-
|
|
73
|
+
| `-PlatformUrl URL` | Platform WebSocket URL | `ws://localhost:8081` |
|
|
74
74
|
| `-ApiKey KEY` | Gateway API key for authentication | (none) |
|
|
75
75
|
| `-Port PORT` | Gateway port | `8083` |
|
|
76
76
|
| `-InstallDir DIR` | Installation directory | `C:\langmart-gateway` |
|
|
@@ -85,19 +85,19 @@ iwr -OutFile install.ps1 https://unpkg.com/langmart-gateway-type3/scripts/instal
|
|
|
85
85
|
```bash
|
|
86
86
|
# LLM routing only (default)
|
|
87
87
|
curl -fsSL https://unpkg.com/langmart-gateway-type3/scripts/install.sh | bash -s -- \
|
|
88
|
-
--
|
|
88
|
+
--platform-url ws://10.0.1.117:8081 \
|
|
89
89
|
--api-key sk-test-inference-key
|
|
90
90
|
|
|
91
91
|
# Full Automation mode with systemd service
|
|
92
92
|
curl -fsSL https://unpkg.com/langmart-gateway-type3/scripts/install.sh | bash -s -- \
|
|
93
|
-
--
|
|
93
|
+
--platform-url ws://10.0.1.117:8081 \
|
|
94
94
|
--api-key sk-test-inference-key \
|
|
95
95
|
--full \
|
|
96
96
|
--service
|
|
97
97
|
|
|
98
98
|
# Custom port and directory
|
|
99
99
|
curl -fsSL https://unpkg.com/langmart-gateway-type3/scripts/install.sh | bash -s -- \
|
|
100
|
-
--
|
|
100
|
+
--platform-url ws://10.0.1.117:8081 \
|
|
101
101
|
--api-key sk-test-inference-key \
|
|
102
102
|
--port 9000 \
|
|
103
103
|
--install-dir /home/user/gateway
|
|
@@ -107,13 +107,13 @@ curl -fsSL https://unpkg.com/langmart-gateway-type3/scripts/install.sh | bash -s
|
|
|
107
107
|
|
|
108
108
|
```powershell
|
|
109
109
|
# LLM routing only (default)
|
|
110
|
-
.\install.ps1 -
|
|
110
|
+
.\install.ps1 -PlatformUrl "ws://10.0.1.117:8081" -ApiKey "sk-test-inference-key"
|
|
111
111
|
|
|
112
112
|
# Full Automation mode with Windows Service
|
|
113
|
-
.\install.ps1 -
|
|
113
|
+
.\install.ps1 -PlatformUrl "ws://10.0.1.117:8081" -ApiKey "sk-test-inference-key" -Full -Service
|
|
114
114
|
|
|
115
115
|
# Custom port and directory
|
|
116
|
-
.\install.ps1 -
|
|
116
|
+
.\install.ps1 -PlatformUrl "ws://10.0.1.117:8081" -ApiKey "sk-test-inference-key" -Port 9000 -InstallDir "D:\gateway"
|
|
117
117
|
```
|
|
118
118
|
|
|
119
119
|
### Alternative CDN
|
|
@@ -146,7 +146,7 @@ npm install langmart-gateway-type3
|
|
|
146
146
|
cat > .env << EOF
|
|
147
147
|
INSTANCE_ID=gw3-$(hostname)-$(date +%s | tail -c 5)
|
|
148
148
|
GATEWAY_PORT=8083
|
|
149
|
-
|
|
149
|
+
PLATFORM_URL=ws://your-platform:8081
|
|
150
150
|
GATEWAY_API_KEY=your-api-key
|
|
151
151
|
GATEWAY_CAPABILITIES=llm
|
|
152
152
|
NODE_ENV=production
|
|
@@ -188,9 +188,9 @@ npm start
|
|
|
188
188
|
INSTANCE_ID=gw3-server-001 # Gateway identifier (auto-generated if not set)
|
|
189
189
|
GATEWAY_PORT=8083 # Gateway HTTP/WebSocket port
|
|
190
190
|
|
|
191
|
-
#
|
|
192
|
-
|
|
193
|
-
GATEWAY_API_KEY=sk-your-key
|
|
191
|
+
# Platform connection
|
|
192
|
+
PLATFORM_URL=ws://localhost:8081 # Platform WebSocket URL
|
|
193
|
+
GATEWAY_API_KEY=sk-your-key # Platform API key
|
|
194
194
|
|
|
195
195
|
# Capabilities
|
|
196
196
|
GATEWAY_CAPABILITIES=llm # "llm" or "session,llm" for full Automation
|
|
@@ -265,12 +265,12 @@ curl http://localhost:8083/health
|
|
|
265
265
|
|
|
266
266
|
## How It Works
|
|
267
267
|
|
|
268
|
-
1. **Connection**: Gateway connects to
|
|
269
|
-
2. **Authentication**: Authenticates using
|
|
268
|
+
1. **Connection**: Gateway connects to platform via WebSocket
|
|
269
|
+
2. **Authentication**: Authenticates using platform API key
|
|
270
270
|
3. **Registration**: Registers available models and capabilities
|
|
271
|
-
4. **Requests**: Receives inference requests from
|
|
271
|
+
4. **Requests**: Receives inference requests from platform
|
|
272
272
|
5. **Processing**: Routes requests to appropriate provider using seller's keys
|
|
273
|
-
6. **Response**: Streams responses back to
|
|
273
|
+
6. **Response**: Streams responses back to platform
|
|
274
274
|
|
|
275
275
|
---
|
|
276
276
|
|
|
@@ -318,7 +318,7 @@ Press `Tab` key to enter model selection mode where you can:
|
|
|
318
318
|
- Browse available models
|
|
319
319
|
- Filter models by typing keywords (AND-condition search)
|
|
320
320
|
- View model details (pricing, context window, capabilities)
|
|
321
|
-
- Select models from your own connections or the
|
|
321
|
+
- Select models from your own connections or the platform
|
|
322
322
|
|
|
323
323
|
### Slash Commands
|
|
324
324
|
Type `/` to see available commands:
|
|
@@ -458,7 +458,7 @@ Type `/` and the CLI will suggest commands:
|
|
|
458
458
|
### Tool Calling
|
|
459
459
|
|
|
460
460
|
The CLI supports native function calling with:
|
|
461
|
-
-
|
|
461
|
+
- Platform tools (connections, models, vault, logs)
|
|
462
462
|
- Web tools (search, fetch)
|
|
463
463
|
- Core tools (system operations)
|
|
464
464
|
- MCP tools (Model Context Protocol servers)
|
|
@@ -483,7 +483,7 @@ This allows resuming conversations across sessions.
|
|
|
483
483
|
1. Verify your model has `image_gen` capability
|
|
484
484
|
2. Include both action and subject keywords
|
|
485
485
|
3. Check model is properly selected (not "No model selected")
|
|
486
|
-
4. Verify
|
|
486
|
+
4. Verify platform connection is active
|
|
487
487
|
|
|
488
488
|
**Problem**: Image preview not showing
|
|
489
489
|
**Solutions**:
|
|
@@ -497,7 +497,7 @@ This allows resuming conversations across sessions.
|
|
|
497
497
|
**Problem**: CLI shows "Not connected"
|
|
498
498
|
**Solutions**:
|
|
499
499
|
1. Verify Gateway Type 3 server is running
|
|
500
|
-
2. Check `
|
|
500
|
+
2. Check `PLATFORM_URL` environment variable
|
|
501
501
|
3. Ensure API key is valid and authenticated
|
|
502
502
|
4. Review gateway logs for connection errors
|
|
503
503
|
|
|
@@ -533,15 +533,15 @@ docker exec -it <container-name> npm run ui
|
|
|
533
533
|
|
|
534
534
|
The container needs these environment variables:
|
|
535
535
|
```bash
|
|
536
|
-
GATEWAY_API_KEY=sk-test-inference-key # Your
|
|
537
|
-
|
|
538
|
-
|
|
536
|
+
GATEWAY_API_KEY=sk-test-inference-key # Your platform API key
|
|
537
|
+
PLATFORM_URL=ws://localhost:8081 # WebSocket URL for gateway connection
|
|
538
|
+
PLATFORM_API_URL=http://localhost:8081 # HTTP URL for REST API calls
|
|
539
539
|
USER_ID=aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa # Your user ID
|
|
540
540
|
```
|
|
541
541
|
|
|
542
542
|
**Important**: The Docker container needs **both** URLs:
|
|
543
|
-
- `
|
|
544
|
-
- `
|
|
543
|
+
- `PLATFORM_URL` (ws://) for WebSocket gateway connection
|
|
544
|
+
- `PLATFORM_API_URL` (http://) for REST API calls (models, connections, etc.)
|
|
545
545
|
|
|
546
546
|
### Persistent Data in Docker
|
|
547
547
|
|
|
@@ -556,8 +556,8 @@ docker run -d \
|
|
|
556
556
|
--name my-gateway-type3 \
|
|
557
557
|
--network host \
|
|
558
558
|
-e GATEWAY_API_KEY=sk-test-inference-key \
|
|
559
|
-
-e
|
|
560
|
-
-e
|
|
559
|
+
-e PLATFORM_URL=ws://localhost:8081 \
|
|
560
|
+
-e PLATFORM_API_URL=http://localhost:8081 \
|
|
561
561
|
-v gateway-type3-data:/app/data \
|
|
562
562
|
langmart-gateway-type3-ui:latest
|
|
563
563
|
```
|
|
@@ -626,7 +626,7 @@ fantasy art style, ethereal atmosphere
|
|
|
626
626
|
## Related Documentation
|
|
627
627
|
|
|
628
628
|
- **Gateway Server**: See main README sections above for server operations
|
|
629
|
-
- **Tool Calling**: See `
|
|
629
|
+
- **Tool Calling**: See `registry-tools.ts` for available platform tools
|
|
630
630
|
- **MCP Integration**: See `mcp-manager.ts` for Model Context Protocol support
|
|
631
631
|
- **Local Vault**: See `local-vault.ts` for credential management
|
|
632
632
|
- **Web Tools**: See `web-tools.ts` for web search and fetch capabilities
|
|
@@ -635,7 +635,7 @@ fantasy art style, ethereal atmosphere
|
|
|
635
635
|
|
|
636
636
|
### Connection
|
|
637
637
|
```javascript
|
|
638
|
-
ws://
|
|
638
|
+
ws://platform.api/gateway
|
|
639
639
|
Headers: {
|
|
640
640
|
'Authorization': 'Bearer sk-...',
|
|
641
641
|
'X-Gateway-ID': 'gw3-seller-001'
|
|
@@ -645,15 +645,15 @@ Headers: {
|
|
|
645
645
|
### Message Types
|
|
646
646
|
- `auth`: Authentication handshake
|
|
647
647
|
- `heartbeat`: Keep-alive ping/pong
|
|
648
|
-
- `request`: Inference request from
|
|
649
|
-
- `response`: Streaming response to
|
|
648
|
+
- `request`: Inference request from platform
|
|
649
|
+
- `response`: Streaming response to platform
|
|
650
650
|
- `error`: Error notification
|
|
651
651
|
- `update`: Version/configuration updates
|
|
652
652
|
|
|
653
653
|
## Monitoring
|
|
654
654
|
|
|
655
655
|
The gateway emits events for monitoring:
|
|
656
|
-
- `connected`: Successfully connected to
|
|
656
|
+
- `connected`: Successfully connected to platform
|
|
657
657
|
- `disconnected`: Connection lost
|
|
658
658
|
- `error`: Error occurred
|
|
659
659
|
- `request`: Processing request
|
|
@@ -675,7 +675,7 @@ The gateway emits events for monitoring:
|
|
|
675
675
|
|
|
676
676
|
### Connection Issues
|
|
677
677
|
- Check firewall rules for WebSocket
|
|
678
|
-
- Verify
|
|
678
|
+
- Verify platform URL
|
|
679
679
|
- Ensure API key is valid
|
|
680
680
|
|
|
681
681
|
### Provider Errors
|
package/dist/index-server.js
CHANGED
|
@@ -35,7 +35,7 @@ async function main() {
|
|
|
35
35
|
// Configuration
|
|
36
36
|
const config = {
|
|
37
37
|
port: parseInt(process.env.GATEWAY_PORT || '8083'),
|
|
38
|
-
registryUrl: process.env.MARKETPLACE_URL || process.env.REGISTRY_URL || 'ws://localhost:8081',
|
|
38
|
+
registryUrl: process.env.PLATFORM_URL || process.env.MARKETPLACE_URL || process.env.REGISTRY_URL || 'ws://localhost:8081',
|
|
39
39
|
instanceId: process.env.INSTANCE_ID || 'gw3-local-001',
|
|
40
40
|
apiKey: apiKey,
|
|
41
41
|
vaultPath: process.env.VAULT_PATH,
|
package/dist/index-server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-server.js","sourceRoot":"","sources":["../index-server.ts"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,wCAAwC;;;AAExC,qDAAsD;AACtD,+CAA2C;AAC3C,iDAAsF;AAEtF,KAAK,UAAU,IAAI;IACf,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;IAC/D,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC,CAAC;IAEpF,wDAAwD;IACxD,IAAI,UAA6B,CAAC;IAClC,IAAI,CAAC;QACD,UAAU,GAAG,MAAM,IAAA,6BAAc,GAAE,CAAC;QACpC,IAAA,gCAAiB,EAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,iDAAiD,EAAE,KAAK,CAAC,CAAC;QACxE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IAED,gDAAgD;IAChD,MAAM,KAAK,GAAG,IAAI,wBAAU,CAAC;QACzB,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;QACjC,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;KAC7C,CAAC,CAAC;IAEH,qDAAqD;IACrD,IAAI,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;IACtE,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,UAAU,EAAE,EAAE,CAAC;QAChC,MAAM,GAAG,KAAK,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;QAClC,IAAI,MAAM,EAAE,CAAC;YACT,OA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AC;AAED,oBAAoB;AACpB,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,8CAA8C,EAAE,KAAK,CAAC,CAAC;IACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC;AAEH,mDAAsD;AAA7C,oHAAA,kBAAkB,OAAA;AAC3B,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,+CAAgE;AAAvD,2GAAA,WAAW,OAAA"}
|
package/package.json
CHANGED
package/scripts/install.ps1
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
# iwr -useb https://unpkg.com/langmart-gateway-type3/scripts/install.ps1 | iex
|
|
6
6
|
#
|
|
7
7
|
# Or with parameters:
|
|
8
|
-
# $env:
|
|
8
|
+
# $env:PLATFORM_URL="ws://your-server:8081"; $env:GATEWAY_API_KEY="your-key"; iwr -useb https://unpkg.com/langmart-gateway-type3/scripts/install.ps1 | iex
|
|
9
9
|
#
|
|
10
10
|
# Or download and run:
|
|
11
|
-
# .\install.ps1 -
|
|
11
|
+
# .\install.ps1 -PlatformUrl "ws://localhost:8081" -ApiKey "your-key" -Full -Service
|
|
12
12
|
#
|
|
13
13
|
# Parameters:
|
|
14
|
-
# -
|
|
14
|
+
# -PlatformUrl Platform WebSocket URL (default: ws://localhost:8081)
|
|
15
15
|
# -ApiKey Gateway API key for authentication
|
|
16
16
|
# -Port Gateway port (default: 8083)
|
|
17
17
|
# -InstallDir Installation directory (default: C:\langmart-gateway)
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
[CmdletBinding()]
|
|
23
23
|
param(
|
|
24
|
-
[string]$
|
|
24
|
+
[string]$PlatformUrl = $env:PLATFORM_URL,
|
|
25
25
|
[string]$ApiKey = $env:GATEWAY_API_KEY,
|
|
26
26
|
[int]$Port = 8083,
|
|
27
27
|
[string]$InstallDir = "C:\langmart-gateway",
|
|
@@ -32,8 +32,8 @@ param(
|
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
# Set defaults if not provided
|
|
35
|
-
if ([string]::IsNullOrEmpty($
|
|
36
|
-
$
|
|
35
|
+
if ([string]::IsNullOrEmpty($PlatformUrl)) {
|
|
36
|
+
$PlatformUrl = "ws://localhost:8081"
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
# Colors for output
|
|
@@ -59,7 +59,7 @@ LangMart Gateway Type 3 - Windows Installation Script
|
|
|
59
59
|
Usage: .\install.ps1 [OPTIONS]
|
|
60
60
|
|
|
61
61
|
Options:
|
|
62
|
-
-
|
|
62
|
+
-PlatformUrl URL Platform WebSocket URL (default: ws://localhost:8081)
|
|
63
63
|
-ApiKey KEY Gateway API key for authentication
|
|
64
64
|
-Port PORT Gateway port (default: 8083)
|
|
65
65
|
-InstallDir DIR Installation directory (default: C:\langmart-gateway)
|
|
@@ -70,13 +70,13 @@ Options:
|
|
|
70
70
|
|
|
71
71
|
Examples:
|
|
72
72
|
# Basic installation (LLM routing only)
|
|
73
|
-
.\install.ps1 -
|
|
73
|
+
.\install.ps1 -PlatformUrl "ws://10.0.1.117:8081" -ApiKey "sk-test-key"
|
|
74
74
|
|
|
75
75
|
# Full Automation mode with Windows Service
|
|
76
|
-
.\install.ps1 -
|
|
76
|
+
.\install.ps1 -PlatformUrl "ws://10.0.1.117:8081" -ApiKey "sk-test-key" -Full -Service
|
|
77
77
|
|
|
78
78
|
# One-liner from web (set env vars first)
|
|
79
|
-
`$env:
|
|
79
|
+
`$env:PLATFORM_URL="ws://10.0.1.117:8081"; `$env:GATEWAY_API_KEY="sk-test-key"; iwr -useb https://unpkg.com/langmart-gateway-type3/scripts/install.ps1 | iex
|
|
80
80
|
"@
|
|
81
81
|
exit 0
|
|
82
82
|
}
|
|
@@ -199,8 +199,8 @@ $envContent = @"
|
|
|
199
199
|
INSTANCE_ID=$instanceId
|
|
200
200
|
GATEWAY_PORT=$Port
|
|
201
201
|
|
|
202
|
-
#
|
|
203
|
-
|
|
202
|
+
# Platform connection
|
|
203
|
+
PLATFORM_URL=$PlatformUrl
|
|
204
204
|
|
|
205
205
|
# Gateway authentication
|
|
206
206
|
GATEWAY_API_KEY=$ApiKey
|
|
@@ -312,7 +312,7 @@ if ($Service) {
|
|
|
312
312
|
$envVars = @(
|
|
313
313
|
"INSTANCE_ID=$instanceId",
|
|
314
314
|
"GATEWAY_PORT=$Port",
|
|
315
|
-
"
|
|
315
|
+
"PLATFORM_URL=$PlatformUrl",
|
|
316
316
|
"GATEWAY_API_KEY=$ApiKey",
|
|
317
317
|
"GATEWAY_CAPABILITIES=$Capabilities",
|
|
318
318
|
"NODE_ENV=production"
|
|
@@ -336,7 +336,7 @@ Write-Host "===============================================================" -Fo
|
|
|
336
336
|
Write-Host ""
|
|
337
337
|
Write-Info "Installation Directory: $InstallDir"
|
|
338
338
|
Write-Info "Gateway Port: $Port"
|
|
339
|
-
Write-Info "
|
|
339
|
+
Write-Info "Platform URL: $PlatformUrl"
|
|
340
340
|
|
|
341
341
|
if ($Capabilities -eq "session,llm") {
|
|
342
342
|
Write-Info "Mode: Full (Automation + LLM Routing)"
|
package/scripts/install.sh
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# bash install.sh [OPTIONS]
|
|
13
13
|
#
|
|
14
14
|
# Options:
|
|
15
|
-
# --
|
|
15
|
+
# --platform-url URL Platform WebSocket URL (default: ws://localhost:8081)
|
|
16
16
|
# --api-key KEY Gateway API key for authentication
|
|
17
17
|
# --port PORT Gateway port (default: 8083)
|
|
18
18
|
# --install-dir DIR Installation directory (default: /opt/langmart-gateway)
|
|
@@ -34,7 +34,7 @@ NC='\033[0m' # No Color
|
|
|
34
34
|
# Default configuration
|
|
35
35
|
INSTALL_DIR="/opt/langmart-gateway"
|
|
36
36
|
GATEWAY_PORT="8083"
|
|
37
|
-
|
|
37
|
+
PLATFORM_URL="ws://localhost:8081"
|
|
38
38
|
GATEWAY_API_KEY=""
|
|
39
39
|
GATEWAY_CAPABILITIES=""
|
|
40
40
|
INSTALL_SERVICE=false
|
|
@@ -43,8 +43,8 @@ GITHUB_TOKEN=""
|
|
|
43
43
|
# Parse command line arguments
|
|
44
44
|
while [[ $# -gt 0 ]]; do
|
|
45
45
|
case $1 in
|
|
46
|
-
--
|
|
47
|
-
|
|
46
|
+
--platform-url)
|
|
47
|
+
PLATFORM_URL="$2"
|
|
48
48
|
shift 2
|
|
49
49
|
;;
|
|
50
50
|
--api-key)
|
|
@@ -81,7 +81,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
81
81
|
echo "Usage: $0 [OPTIONS]"
|
|
82
82
|
echo ""
|
|
83
83
|
echo "Options:"
|
|
84
|
-
echo " --
|
|
84
|
+
echo " --platform-url URL Platform WebSocket URL (default: ws://localhost:8081)"
|
|
85
85
|
echo " --api-key KEY Gateway API key for authentication"
|
|
86
86
|
echo " --port PORT Gateway port (default: 8083)"
|
|
87
87
|
echo " --install-dir DIR Installation directory (default: /opt/langmart-gateway)"
|
|
@@ -92,7 +92,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
92
92
|
echo " --help Show this help message"
|
|
93
93
|
echo ""
|
|
94
94
|
echo "Example:"
|
|
95
|
-
echo " $0 --
|
|
95
|
+
echo " $0 --platform-url ws://10.0.1.117:8081 --api-key sk-test-key --full --service"
|
|
96
96
|
exit 0
|
|
97
97
|
;;
|
|
98
98
|
*)
|
|
@@ -195,8 +195,8 @@ cat > .env << EOF
|
|
|
195
195
|
INSTANCE_ID=gw3-$(hostname)-$(date +%s | tail -c 5)
|
|
196
196
|
GATEWAY_PORT=${GATEWAY_PORT}
|
|
197
197
|
|
|
198
|
-
#
|
|
199
|
-
|
|
198
|
+
# Platform connection
|
|
199
|
+
PLATFORM_URL=${PLATFORM_URL}
|
|
200
200
|
|
|
201
201
|
# Gateway authentication
|
|
202
202
|
GATEWAY_API_KEY=${GATEWAY_API_KEY}
|
|
@@ -289,7 +289,7 @@ echo -e "${GREEN}╚════════════════════
|
|
|
289
289
|
echo ""
|
|
290
290
|
echo -e "${CYAN}Installation Directory: ${INSTALL_DIR}${NC}"
|
|
291
291
|
echo -e "${CYAN}Gateway Port: ${GATEWAY_PORT}${NC}"
|
|
292
|
-
echo -e "${CYAN}
|
|
292
|
+
echo -e "${CYAN}Platform URL: ${PLATFORM_URL}${NC}"
|
|
293
293
|
if [ -n "$GATEWAY_CAPABILITIES" ] && [ "$GATEWAY_CAPABILITIES" = "session,llm" ]; then
|
|
294
294
|
echo -e "${CYAN}Mode: Full (Automation + LLM Routing)${NC}"
|
|
295
295
|
else
|
package/scripts/start.ps1
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Gateway Type 3 Start Script for Windows
|
|
2
2
|
# Features: Service mode detection, pre-flight checks, RESULT output
|
|
3
3
|
|
|
4
|
-
param([int]$Port = 0, [string]$
|
|
4
|
+
param([int]$Port = 0, [string]$PlatformUrl = "", [string]$ApiKey = "", [string]$GatewayId = "")
|
|
5
5
|
|
|
6
6
|
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
7
7
|
$ProjectDir = Split-Path -Parent $ScriptDir
|
|
@@ -51,7 +51,7 @@ Load-EnvFile
|
|
|
51
51
|
|
|
52
52
|
$GatewayPort = if ($Port -gt 0) { $Port } elseif ($env:GATEWAY_PORT) { [int]$env:GATEWAY_PORT } else { 8083 }
|
|
53
53
|
$GatewayApiKey = if ($ApiKey) { $ApiKey } elseif ($env:GATEWAY_API_KEY) { $env:GATEWAY_API_KEY } else { "" }
|
|
54
|
-
$
|
|
54
|
+
$GatewayPlatform = if ($PlatformUrl) { $PlatformUrl } elseif ($env:PLATFORM_URL) { $env:PLATFORM_URL } else { "ws://localhost:8081" }
|
|
55
55
|
$GatewayIdValue = if ($GatewayId) { $GatewayId } elseif ($env:GATEWAY_ID) { $env:GATEWAY_ID } else { "" }
|
|
56
56
|
|
|
57
57
|
# CHECK SERVICE MODE
|
|
@@ -87,14 +87,14 @@ if ($serviceMode) {
|
|
|
87
87
|
# STANDALONE MODE
|
|
88
88
|
Write-Log "Running in standalone mode"
|
|
89
89
|
Write-Log "Checking required parameters..."
|
|
90
|
-
$missingVars = @(); if (-not $GatewayApiKey) { $missingVars += "GATEWAY_API_KEY" }; if (-not $
|
|
90
|
+
$missingVars = @(); if (-not $GatewayApiKey) { $missingVars += "GATEWAY_API_KEY" }; if (-not $GatewayPlatform) { $missingVars += "PLATFORM_URL" }
|
|
91
91
|
if ($missingVars.Count -gt 0) {
|
|
92
92
|
Write-Log "Missing required parameters: $($missingVars -join ', ')" "ERROR"
|
|
93
93
|
Write-Output "RESULT:running=false,port=,pid=,mode=standalone"; exit 1
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
Write-Log "GATEWAY_PORT: $GatewayPort"
|
|
97
|
-
Write-Log "
|
|
97
|
+
Write-Log "PLATFORM_URL: $GatewayPlatform"
|
|
98
98
|
Write-Log "GATEWAY_API_KEY: $($GatewayApiKey.Substring(0, [Math]::Min(8, $GatewayApiKey.Length)))..."
|
|
99
99
|
|
|
100
100
|
try {
|
|
@@ -113,7 +113,7 @@ Write-Log "Entry file: $EntryFile"
|
|
|
113
113
|
Write-Log "=== Starting Gateway ==="
|
|
114
114
|
if (-not (Test-Path $LogDir)) { New-Item -ItemType Directory -Path $LogDir -Force | Out-Null }
|
|
115
115
|
if (Test-Path $LogFile) { Clear-Content $LogFile -ErrorAction SilentlyContinue }
|
|
116
|
-
$env:GATEWAY_PORT = $GatewayPort; $env:
|
|
116
|
+
$env:GATEWAY_PORT = $GatewayPort; $env:PLATFORM_URL = $GatewayPlatform; $env:GATEWAY_API_KEY = $GatewayApiKey; $env:GATEWAY_ID = $GatewayIdValue
|
|
117
117
|
|
|
118
118
|
Write-Log "Starting with: node $EntryFile"
|
|
119
119
|
try {
|
package/scripts/start.sh
CHANGED
|
@@ -118,7 +118,7 @@ load_env
|
|
|
118
118
|
# Set defaults
|
|
119
119
|
GATEWAY_PORT="${GATEWAY_PORT:-8083}"
|
|
120
120
|
GATEWAY_API_KEY="${GATEWAY_API_KEY:-}"
|
|
121
|
-
|
|
121
|
+
PLATFORM_URL="${PLATFORM_URL:-ws://localhost:8081}"
|
|
122
122
|
GATEWAY_ID="${GATEWAY_ID:-}"
|
|
123
123
|
|
|
124
124
|
# ============================================
|
|
@@ -169,7 +169,7 @@ log "Checking required parameters..."
|
|
|
169
169
|
|
|
170
170
|
missing_vars=""
|
|
171
171
|
[ -z "$GATEWAY_API_KEY" ] && missing_vars="$missing_vars GATEWAY_API_KEY"
|
|
172
|
-
[ -z "$
|
|
172
|
+
[ -z "$PLATFORM_URL" ] && missing_vars="$missing_vars PLATFORM_URL"
|
|
173
173
|
|
|
174
174
|
if [ -n "$missing_vars" ]; then
|
|
175
175
|
log "Missing required parameters:$missing_vars" "ERROR"
|
|
@@ -178,7 +178,7 @@ if [ -n "$missing_vars" ]; then
|
|
|
178
178
|
fi
|
|
179
179
|
|
|
180
180
|
log "GATEWAY_PORT: $GATEWAY_PORT"
|
|
181
|
-
log "
|
|
181
|
+
log "PLATFORM_URL: $PLATFORM_URL"
|
|
182
182
|
log "GATEWAY_API_KEY: ${GATEWAY_API_KEY:0:8}..."
|
|
183
183
|
|
|
184
184
|
# PRE-FLIGHT CHECK: Already running
|
|
@@ -207,7 +207,7 @@ log "=== Starting Gateway ==="
|
|
|
207
207
|
mkdir -p "$LOG_DIR"
|
|
208
208
|
> "$LOG_FILE"
|
|
209
209
|
|
|
210
|
-
export GATEWAY_PORT GATEWAY_API_KEY
|
|
210
|
+
export GATEWAY_PORT GATEWAY_API_KEY PLATFORM_URL GATEWAY_ID
|
|
211
211
|
|
|
212
212
|
log "Starting with: $NODE_BIN $ENTRY_FILE"
|
|
213
213
|
|