refactor: standardize developer text and identifiers in English

This commit is contained in:
2026-10-05 10:13:25 -03:00
parent 6b8c27fd76
commit dfc1f663c7
20 changed files with 933 additions and 1142 deletions
+21 -28
View File
@@ -1,26 +1,24 @@
/**
* Node-RED 5.0 settings for s2s-reasoning-engine — LOCAL INSTALL (non Docker).
* Node-RED 5.0 settings for s2s-reasoning-engine — local installation.
* File: <project_root>/s2s-reasoning-engine/.node-red/settings.js
* oppure <project_root>/s2s-reasoning-engine/settings.js (master)
* or <project_root>/s2s-reasoning-engine/settings.js (source)
*
* Copiato automaticamente in .node-red/ da start.sh se mancante o più vecchio.
* start.sh copies this into .node-red/ when missing or older than the source.
*/
const path = require("path");
const fs = require("fs");
// userDir è sempre <s2s-reasoning-engine>/.node-red (lo script start.sh)
// start.sh uses <s2s-reasoning-engine>/.node-red as its local user directory.
const ENGINE_ROOT = path.resolve(__dirname, "..");
const LOCAL_NODE_MODULES = path.join(ENGINE_ROOT, "node_modules");
const USERDIR_NODE_MODULES = path.join(__dirname, "node_modules");
// ── Fix per editor "tslib.es6.js 404 / net::ERR_ABORTED" ─────────────────
// Installazioni npm locali flat (default npm 3+) spostano tslib in
// node_modules/tslib/ (root) invece che dentro
// @node-red/editor-client/node_modules/tslib/. L'editor di Node-RED 5
// carica `/tslib.es6.js` dalla root HTTP: se la cartella nested non esiste,
// torna 404. Qui aggiorniamo editor-client/public/ con i file tslib mancanti
// a ogni avvio (sopravvive a npm reinstall se tslib è in root).
// Fix the editor's "tslib.es6.js 404 / net::ERR_ABORTED" error.
// Flat npm installations place tslib in the root node_modules/tslib directory
// rather than @node-red/editor-client/node_modules/tslib. The Node-RED 5 editor
// loads /tslib.es6.js from the HTTP root. Refresh the editor's public files at
// startup so the workaround survives dependency reinstallation.
(function _installTslibVendor() {
try {
const tslibRoot = path.join(LOCAL_NODE_MODULES, "tslib");
@@ -49,13 +47,10 @@ module.exports = {
httpRequestTimeout: 120000,
httpRequestLegacyMsgOverrides: true,
// ── Native HTTP helper per function node (SENZA externalModules) ─────
// NOTA: non usare functionExternalModules: true — in Node-RED v5 quel
// flag può bloccare il caricamento palette (es. "37/41 nodes loading"
// durante la verifica di tutti i pkg npm).
// Al suo posto usiamo functionGlobalContext: i moduli core Node.js sono
// require'd QUI nel settings.js (prima dell'avvio NR) e poi i function
// node li recuperano via global.get("_core_https") ecc.
// Native HTTP helpers for function nodes, without externalModules.
// functionExternalModules can stall palette loading in Node-RED 5.
// Load core Node.js modules here before startup and expose them through
// functionGlobalContext, accessed with global.get("_core_https") etc.
functionModuleRequireAllowList: ["https","http","url","path","util","fs","os","buffer","zlib","stream","crypto"],
functionGlobalContext: {
_core_https: require("https"),
@@ -63,9 +58,9 @@ module.exports = {
_core_url: require("url"),
},
// adminAuth: {...} ← scommentare e valorizzare in produzione
// adminAuth: {...} // Uncomment and configure for production.
// HTTPS (opzionale in produzione)
// HTTPS (optional for production).
// https: {
// key: require("fs").readFileSync(path.join(__dirname, "privkey.pem")),
// cert: require("fs").readFileSync(path.join(__dirname, "fullchain.pem"))
@@ -82,20 +77,18 @@ module.exports = {
},
csrf: false,
// ── IMPORTANTE: caricamento nodi extra ─────────────────────────────
// Node-RED 5 carica i plugin NODI da:
// 1) {userDir}/node_modules (nostro .node-red/node_modules)
// 2) {nodesDir} (installazione root del progetto)
// Additional node loading: Node-RED 5 looks for plugins in:
// 1) {userDir}/node_modules (our .node-red/node_modules)
// 2) {nodesDir} (the project-root installation)
// 3) npm global
// Senza nodesDir i pacchetti installati nella ROOT del progetto non
// vengono trovati.
// Set nodesDir so packages installed at the project root are discovered.
nodesDir: LOCAL_NODE_MODULES,
externalModules: {
autoInstall: true, // auto-installa nodi mancanti al boot
autoInstall: true, // Install missing nodes at startup.
autoInstallRetry: 3,
palette: {
allowInstall: true, // permette Install dall'editor
allowInstall: true, // Allow installation from the editor.
allowUpload: true,
modules: ["node-red-contrib-openai", "node-red-contrib-cache", "node-red-node-rbe"],
allowList: ["node-red-contrib-*", "node-red-node-*"],