replicas-engine 0.1.129 → 0.1.132
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/dist/src/index.js +98 -3
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -1049,7 +1049,8 @@ var SANDBOX_PATHS = {
|
|
|
1049
1049
|
REPLICAS_FILES_DIR: "/home/ubuntu/.replicas/files",
|
|
1050
1050
|
REPLICAS_FILES_DISPLAY_DIR: "~/.replicas/files",
|
|
1051
1051
|
REPLICAS_RUNTIME_ENV_FILE: "/home/ubuntu/.replicas/runtime-env.sh",
|
|
1052
|
-
REPLICAS_PREVIEW_PORTS_FILE: "/home/ubuntu/.replicas/preview-ports.json"
|
|
1052
|
+
REPLICAS_PREVIEW_PORTS_FILE: "/home/ubuntu/.replicas/preview-ports.json",
|
|
1053
|
+
REPLICAS_MCPS_FILE: "/home/ubuntu/.replicas/mcps.json"
|
|
1053
1054
|
};
|
|
1054
1055
|
|
|
1055
1056
|
// ../shared/src/replicas-config.ts
|
|
@@ -1165,7 +1166,7 @@ function parseReplicasConfigString(content, filename) {
|
|
|
1165
1166
|
}
|
|
1166
1167
|
|
|
1167
1168
|
// ../shared/src/engine/environment.ts
|
|
1168
|
-
var DAYTONA_SNAPSHOT_ID = "
|
|
1169
|
+
var DAYTONA_SNAPSHOT_ID = "30-04-2026-islington-v1";
|
|
1169
1170
|
|
|
1170
1171
|
// ../shared/src/engine/types.ts
|
|
1171
1172
|
var DEFAULT_CHAT_TITLES = {
|
|
@@ -1179,6 +1180,12 @@ var IMAGE_MEDIA_TYPES = ["image/png", "image/jpeg", "image/gif", "image/webp"];
|
|
|
1179
1180
|
var WORKSPACE_FILE_UPLOAD_MAX_SIZE_BYTES = 20 * 1024 * 1024;
|
|
1180
1181
|
var WORKSPACE_FILE_CONTENT_MAX_SIZE_BYTES = 1 * 1024 * 1024;
|
|
1181
1182
|
|
|
1183
|
+
// ../shared/src/routes/environment.ts
|
|
1184
|
+
var RESERVED_MCP_NAME_PREFIXES = ["relay-", "replicas-"];
|
|
1185
|
+
function isReservedMcpName(name) {
|
|
1186
|
+
return RESERVED_MCP_NAME_PREFIXES.some((prefix) => name.startsWith(prefix));
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1182
1189
|
// src/services/environment-details-service.ts
|
|
1183
1190
|
import { mkdir as mkdir3, readFile as readFile2, writeFile as writeFile3 } from "fs/promises";
|
|
1184
1191
|
import { existsSync as existsSync3 } from "fs";
|
|
@@ -3714,6 +3721,92 @@ var KeepAliveService = class _KeepAliveService {
|
|
|
3714
3721
|
};
|
|
3715
3722
|
var keepAliveService = new KeepAliveService();
|
|
3716
3723
|
|
|
3724
|
+
// src/services/mcp-store.ts
|
|
3725
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
3726
|
+
var STDIO_INHERITED_ENV_KEYS = ["PATH", "HOME", "USER", "SHELL", "LANG", "LC_ALL"];
|
|
3727
|
+
var cache = {};
|
|
3728
|
+
var initialized = false;
|
|
3729
|
+
function buildStdioEnv(configEnv) {
|
|
3730
|
+
const merged = {};
|
|
3731
|
+
for (const key of STDIO_INHERITED_ENV_KEYS) {
|
|
3732
|
+
const value = process.env[key];
|
|
3733
|
+
if (value !== void 0) {
|
|
3734
|
+
merged[key] = value;
|
|
3735
|
+
}
|
|
3736
|
+
}
|
|
3737
|
+
Object.assign(merged, configEnv);
|
|
3738
|
+
return merged;
|
|
3739
|
+
}
|
|
3740
|
+
function transformEntry(entry) {
|
|
3741
|
+
if (entry.transport === "stdio" && "command" in entry.config) {
|
|
3742
|
+
return {
|
|
3743
|
+
type: "stdio",
|
|
3744
|
+
command: entry.config.command,
|
|
3745
|
+
args: entry.config.args,
|
|
3746
|
+
env: buildStdioEnv(entry.config.env ?? {})
|
|
3747
|
+
};
|
|
3748
|
+
}
|
|
3749
|
+
if (entry.transport === "http" && "url" in entry.config) {
|
|
3750
|
+
return {
|
|
3751
|
+
type: "http",
|
|
3752
|
+
url: entry.config.url,
|
|
3753
|
+
headers: entry.config.headers
|
|
3754
|
+
};
|
|
3755
|
+
}
|
|
3756
|
+
if (entry.transport === "sse" && "url" in entry.config) {
|
|
3757
|
+
return {
|
|
3758
|
+
type: "sse",
|
|
3759
|
+
url: entry.config.url,
|
|
3760
|
+
headers: entry.config.headers
|
|
3761
|
+
};
|
|
3762
|
+
}
|
|
3763
|
+
return null;
|
|
3764
|
+
}
|
|
3765
|
+
function initializeMcpStore(filePath = SANDBOX_PATHS.REPLICAS_MCPS_FILE) {
|
|
3766
|
+
if (initialized) return;
|
|
3767
|
+
initialized = true;
|
|
3768
|
+
let raw;
|
|
3769
|
+
try {
|
|
3770
|
+
raw = readFileSync2(filePath, "utf-8");
|
|
3771
|
+
} catch (error) {
|
|
3772
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
3773
|
+
if (error.code === "ENOENT") {
|
|
3774
|
+
console.log(`[mcp_loaded] count=0 names=[] reason=no_file`);
|
|
3775
|
+
} else {
|
|
3776
|
+
console.warn(`[mcp_store_load_skipped] reason=${reason}`);
|
|
3777
|
+
}
|
|
3778
|
+
return;
|
|
3779
|
+
}
|
|
3780
|
+
let parsed;
|
|
3781
|
+
try {
|
|
3782
|
+
parsed = JSON.parse(raw);
|
|
3783
|
+
} catch (error) {
|
|
3784
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
3785
|
+
console.warn(`[mcp_store_load_failed] reason=parse_error detail=${reason}`);
|
|
3786
|
+
return;
|
|
3787
|
+
}
|
|
3788
|
+
const entries = parsed.mcpServers ?? {};
|
|
3789
|
+
const result = {};
|
|
3790
|
+
for (const [name, entry] of Object.entries(entries)) {
|
|
3791
|
+
if (isReservedMcpName(name)) {
|
|
3792
|
+
console.warn(`[mcp_name_reserved] name=${name} dropped`);
|
|
3793
|
+
continue;
|
|
3794
|
+
}
|
|
3795
|
+
const transformed = transformEntry(entry);
|
|
3796
|
+
if (!transformed) {
|
|
3797
|
+
console.warn(`[mcp_transport_unknown] name=${name} transport=${entry.transport ?? "undefined"}`);
|
|
3798
|
+
continue;
|
|
3799
|
+
}
|
|
3800
|
+
result[name] = transformed;
|
|
3801
|
+
}
|
|
3802
|
+
cache = result;
|
|
3803
|
+
const names = Object.keys(cache);
|
|
3804
|
+
console.log(`[mcp_loaded] count=${names.length} names=[${names.join(",")}]`);
|
|
3805
|
+
}
|
|
3806
|
+
function getMcpServers() {
|
|
3807
|
+
return cache;
|
|
3808
|
+
}
|
|
3809
|
+
|
|
3717
3810
|
// src/services/chat/errors.ts
|
|
3718
3811
|
var ChatNotFoundError = class extends Error {
|
|
3719
3812
|
constructor(chatId) {
|
|
@@ -3950,7 +4043,8 @@ var ChatService = class {
|
|
|
3950
4043
|
initialSessionId: persisted.providerSessionId,
|
|
3951
4044
|
onSaveSessionId: saveSession,
|
|
3952
4045
|
onTurnComplete: onProviderTurnComplete,
|
|
3953
|
-
onEvent: onProviderEvent
|
|
4046
|
+
onEvent: onProviderEvent,
|
|
4047
|
+
mcpServers: getMcpServers()
|
|
3954
4048
|
});
|
|
3955
4049
|
} else if (persisted.provider === "relay") {
|
|
3956
4050
|
provider = new RelayManager({
|
|
@@ -4922,6 +5016,7 @@ process.on("unhandledRejection", (reason) => {
|
|
|
4922
5016
|
engineLogger.flush().finally(() => process.exit(1));
|
|
4923
5017
|
});
|
|
4924
5018
|
await eventService.initialize();
|
|
5019
|
+
initializeMcpStore();
|
|
4925
5020
|
var READY_MESSAGE = "========= REPLICAS WORKSPACE READY ==========";
|
|
4926
5021
|
var COMPLETION_MESSAGE = "========= REPLICAS WORKSPACE INITIALIZATION COMPLETE ==========";
|
|
4927
5022
|
function checkActiveSSHSessions() {
|