lobstakit-cloud 1.0.7 → 1.0.9
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/lib/config.js +18 -69
- package/package.json +2 -2
- package/public/css/styles.css +405 -443
- package/public/index.html +168 -494
- package/public/js/manage.js +78 -1230
- package/public/js/setup.js +158 -696
- package/public/manage.html +60 -730
- package/server.js +106 -1238
- package/public/js/app.js +0 -198
- package/public/js/login.js +0 -93
- package/public/login.html +0 -73
package/lib/config.js
CHANGED
|
@@ -30,7 +30,7 @@ function readConfig() {
|
|
|
30
30
|
* Write config to disk. Merges with existing config to preserve
|
|
31
31
|
* gateway auth token and other cloud-init values.
|
|
32
32
|
*/
|
|
33
|
-
function writeConfig({ apiKey, model,
|
|
33
|
+
function writeConfig({ apiKey, model, telegramBotToken, telegramUserId }) {
|
|
34
34
|
// Ensure config directory exists
|
|
35
35
|
if (!fs.existsSync(CONFIG_DIR)) {
|
|
36
36
|
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
@@ -40,56 +40,6 @@ function writeConfig({ apiKey, model, channel, telegramBotToken, telegramUserId,
|
|
|
40
40
|
const existing = readConfig() || {};
|
|
41
41
|
const existingToken = existing?.gateway?.auth?.token || '';
|
|
42
42
|
|
|
43
|
-
// Build channels config based on selected channel
|
|
44
|
-
const channels = {};
|
|
45
|
-
const selectedChannel = channel || 'web';
|
|
46
|
-
|
|
47
|
-
if (selectedChannel === 'telegram' && telegramBotToken && telegramUserId) {
|
|
48
|
-
channels.telegram = {
|
|
49
|
-
enabled: true,
|
|
50
|
-
botToken: telegramBotToken,
|
|
51
|
-
allowFrom: [telegramUserId],
|
|
52
|
-
dmPolicy: 'allowlist'
|
|
53
|
-
};
|
|
54
|
-
} else if (selectedChannel === 'discord' && discordBotToken && discordServerId) {
|
|
55
|
-
channels.discord = {
|
|
56
|
-
enabled: true,
|
|
57
|
-
botToken: discordBotToken,
|
|
58
|
-
allowedGuilds: [discordServerId]
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
// Web channel: no channel plugins needed (empty channels object)
|
|
62
|
-
|
|
63
|
-
// Build agent defaults
|
|
64
|
-
const agentDefaults = {
|
|
65
|
-
model: {
|
|
66
|
-
primary: model
|
|
67
|
-
},
|
|
68
|
-
workspace: '/root/clawd'
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
// Add memorySearch config if private memory is enabled (default: true)
|
|
72
|
-
if (privateMemory !== false) {
|
|
73
|
-
agentDefaults.memorySearch = {
|
|
74
|
-
provider: 'local',
|
|
75
|
-
fallback: 'none',
|
|
76
|
-
local: {
|
|
77
|
-
modelPath: 'hf:ggml-org/embeddinggemma-300M-GGUF/embeddinggemma-300M-Q8_0.gguf'
|
|
78
|
-
},
|
|
79
|
-
query: {
|
|
80
|
-
hybrid: {
|
|
81
|
-
enabled: true,
|
|
82
|
-
vectorWeight: 0.7,
|
|
83
|
-
textWeight: 0.3
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
cache: {
|
|
87
|
-
enabled: true,
|
|
88
|
-
maxEntries: 50000
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
43
|
const config = {
|
|
94
44
|
gateway: {
|
|
95
45
|
port: 3001,
|
|
@@ -104,9 +54,21 @@ function writeConfig({ apiKey, model, channel, telegramBotToken, telegramUserId,
|
|
|
104
54
|
}
|
|
105
55
|
},
|
|
106
56
|
agents: {
|
|
107
|
-
defaults:
|
|
57
|
+
defaults: {
|
|
58
|
+
model: {
|
|
59
|
+
primary: model
|
|
60
|
+
},
|
|
61
|
+
workspace: '/root/clawd'
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
channels: {
|
|
65
|
+
telegram: {
|
|
66
|
+
enabled: true,
|
|
67
|
+
botToken: telegramBotToken,
|
|
68
|
+
allowFrom: [telegramUserId],
|
|
69
|
+
dmPolicy: 'allowlist'
|
|
70
|
+
}
|
|
108
71
|
},
|
|
109
|
-
channels,
|
|
110
72
|
env: {
|
|
111
73
|
vars: {
|
|
112
74
|
ANTHROPIC_API_KEY: apiKey
|
|
@@ -114,22 +76,11 @@ function writeConfig({ apiKey, model, channel, telegramBotToken, telegramUserId,
|
|
|
114
76
|
}
|
|
115
77
|
};
|
|
116
78
|
|
|
117
|
-
fs.writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2),
|
|
79
|
+
fs.writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2), 'utf8');
|
|
118
80
|
console.log('[config] Config written to', CONFIG_PATH);
|
|
119
81
|
return config;
|
|
120
82
|
}
|
|
121
83
|
|
|
122
|
-
/**
|
|
123
|
-
* Write raw config object to disk (for channel management updates).
|
|
124
|
-
*/
|
|
125
|
-
function writeRawConfig(configObj) {
|
|
126
|
-
if (!fs.existsSync(CONFIG_DIR)) {
|
|
127
|
-
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
128
|
-
}
|
|
129
|
-
fs.writeFileSync(CONFIG_PATH, JSON.stringify(configObj, null, 2), { encoding: 'utf8', mode: 0o600 });
|
|
130
|
-
console.log('[config] Raw config written to', CONFIG_PATH);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
84
|
/**
|
|
134
85
|
* Check if the gateway is configured (has channels + API key).
|
|
135
86
|
*/
|
|
@@ -137,11 +88,10 @@ function isConfigured() {
|
|
|
137
88
|
const config = readConfig();
|
|
138
89
|
if (!config) return false;
|
|
139
90
|
|
|
91
|
+
const hasChannel = config?.channels?.telegram?.enabled === true;
|
|
140
92
|
const hasApiKey = !!config?.env?.vars?.ANTHROPIC_API_KEY;
|
|
141
|
-
const hasModel = !!config?.agents?.defaults?.model?.primary;
|
|
142
93
|
|
|
143
|
-
|
|
144
|
-
return hasApiKey && hasModel;
|
|
94
|
+
return hasChannel && hasApiKey;
|
|
145
95
|
}
|
|
146
96
|
|
|
147
97
|
/**
|
|
@@ -169,7 +119,6 @@ function getSubdomain() {
|
|
|
169
119
|
module.exports = {
|
|
170
120
|
readConfig,
|
|
171
121
|
writeConfig,
|
|
172
|
-
writeRawConfig,
|
|
173
122
|
isConfigured,
|
|
174
123
|
getSubdomain,
|
|
175
124
|
CONFIG_PATH
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lobstakit-cloud",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "LobstaKit Cloud — Setup wizard and management for LobstaCloud gateways",
|
|
5
5
|
"main": "server.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"lobstakit
|
|
7
|
+
"lobstakit": "./bin/lobstakit.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"start": "node server.js"
|