feat: Phase 3 – Modul-System (Manifest, ZIP-Installation, Lifecycle, Prozess-Manager)

This commit is contained in:
MPM Dev
2026-10-07 15:37:09 +02:00
parent e87dc1f836
commit 4bbca21fd6
31 changed files with 2055 additions and 19 deletions

View File

@@ -0,0 +1,50 @@
/**
* Demo-Modul: Minimaler HTTP-Server, der den Modul-API-Vertrag erfüllt.
* Läuft als eigener Node-Prozess im Management-Container (Port via ENV PORT).
*/
const http = require('node:http');
const PORT = Number(process.env.PORT ?? 41001);
/** Manifest des Moduls (identisch zu module.json). */
const MANIFEST = {
moduleId: 'demo',
version: '1.0.0',
status: 'healthy',
};
const server = http.createServer((request, response) => {
const url = new URL(request.url ?? '/', `http://127.0.0.1:${PORT}`);
if (url.pathname === '/health') {
response.writeHead(200, { 'Content-Type': 'application/json' });
response.end(JSON.stringify({ moduleId: 'demo', version: '1.0.0', status: 'healthy' }));
return;
}
if (url.pathname === '/api/manifest') {
response.writeHead(200, { 'Content-Type': 'application/json' });
response.end(JSON.stringify(MANIFEST));
return;
}
if (url.pathname === '/api/me') {
response.writeHead(200, { 'Content-Type': 'application/json' });
response.end(
JSON.stringify({
user: { id: 'demo', username: 'demo' },
module: { id: 'demo' },
permissions: [],
}),
);
return;
}
response.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' });
response.end('Demo-Modul läuft');
});
server.listen(PORT, '127.0.0.1', () => {
console.log(`Demo-Modul läuft auf Port ${PORT}`);
});

Binary file not shown.

13
modules/demo/module.json Normal file
View File

@@ -0,0 +1,13 @@
{
"id": "demo",
"name": "Demo-Modul",
"version": "1.0.0",
"slug": "demo",
"description": "Referenzmodul zum Testen des Modul-Systems",
"author": "MPM",
"runtime": "node",
"entrypoint": "server.js",
"port": 41001,
"healthcheck": "/health",
"apiVersion": "v1"
}