TC$mC$ ratkaisu osuu suoraan The Dark Meshin P2P-ytimen maaliin. Koska
reitittimesi jC$ttC$C$ aktiivisen puskemisen tekemC$ttC$, mikC$li tilatulla
solmulla ei ole http-alkuista osoitetta, selaimesi voi vain rekisterC6ityC$
ilman endpointia (esim. endpoint: "POLL"). TC$llC6in paketit jC$C$vC$t
turvallisesti levylle out-jonoon odottamaan. Rakennetaan reitittimeen (API:n
ingress-pC$C$tepisteen perC$C$n) kokonainen P2P-hallintarajapinta. TC$mC$
lisC$ys sisC$ltC$C$ kaikki tarvitsemasi ominaisuudet:P2P Poll (GET
/api/omega/poll): Nappaa ja arkistoi seuraavan jonossa olevan paketin.Queue
List (GET /api/omega/queue): Listaa jonon sisC$llC6n haku/tyyppiehdoilla
purkamatta sitC$.Delete Single (DELETE /api/omega/queue/:msgId): Arkistoi ja
poistaa yksittC$isen jumittuneen paketin.Bulk Delete (DELETE /api/omega/queue):
TyhjentC$C$ koko jonon tai tietyn pakettityypin massana.Aja tC$mC$ pC$ivitys
sisC$C$n, niin selaimesi saa tC$ydellisen hallinnan omaan dataansa:
====================================================
>>> KC$sittelyssC$ kohde: /mnt/mesh_root/services/omega-router/omega_router_v3.
js
>>> Checkout luotu: /mnt/mesh_root/services/omega-router/pull_omega_router_v3_j
s/omega_router_v3.js
>>> AST-Broker yhdistetty lokaaliin kopioon!
>>> [UNIX] JC$rjestetC$C$n operaatiot alhaalta ylC6s (bottom-up)
rivisiirtymien vC$lttC$miseksi...
-> ENSURE LINES: 350 riviC$.
-> Rivit 98-100 korvattu.
>>> Muutokset tallennettu lokaaliin pull-kansioon!
----------------------------------------------------
TARKISTA LINT: /mnt/mesh_root/services/omega-router/pull_omega_router_v3
_js/lint.sh
TARKISTA MUUTOKSET: /mnt/mesh_root/services/omega-router/pull_omega_router_v3
_js/diff.sh
VIE TUOTANTOON: /mnt/mesh_root/services/omega-router/pull_omega_router_v3
_js/commit.sh
PERUUTA (REVERT): /mnt/mesh_root/services/omega-router/pull_omega_router_v3
_js/revert.sh
----------------------------------------------------
$ ./pull_omega_router_v3_js/diff.sh
--- /mnt/mesh_root/services/omega-router/omega_router_v3.js2026-08-03
23:37:15.000000000 +0000
+++ /mnt/mesh_root/services/omega-router/pull_omega_router_v3_js/omega_router_v
3.js2026-08-04 00:49:56.000000000 +0000
res.status(202).json({ status: "accepted", id: packet.head.id });
} catch (e) { res.status(500).json({ error: "Disk Write Error" }); }
});
+// --- 5.1 OMEGA EGRESS POLL & MANAGEMENT (P2P Polling) ---
+app.get('/api/omega/poll', async (req, res) => {
+const targetId = req.query.id;
+if (!targetId) return res.status(400).json({ error: "Missing node id" });
+
+try {
+ const files = await fs.readdir(DIRS.out);
+ for (const file of files.filter(f => f.endsWith('.json'))) {
+ const outPath = path.join(DIRS.out, file);
+ const archOutPath = path.join(DIRS.archive_out, file);
+ const packet = JSON.parse(await fs.readFile(outPath, 'utf8'));
+
+ if (packet.head.dst === targetId) {
+ // Paketti toimitetaan ja arkistoidaan valittomasti
+ await fs.rename(outPath, archOutPath);
+ return res.json(packet);
+ }
+ }
+ res.json({ status: "empty" });
+} catch (e) { res.status(500).json({ error: e.message }); }
+
+
+});
+
+app.get('/api/omega/queue', async (req, res) => {
+const { id, type } = req.query;
+if (!id) return res.status(400).json({ error: "Missing node id" });
+
+try {
+ const files = await fs.readdir(DIRS.out);
+ const results = [];
+ for (const file of files.filter(f => f.endsWith('.json'))) {
+ const outPath = path.join(DIRS.out, file);
+ const packet = JSON.parse(await fs.readFile(outPath, 'utf8'));
+
+ if (packet.head.dst === id) {
+ if (type && packet.head.type !== type) continue;
+ results.push(packet);
+ }
+ }
+ res.json({ status: "ok", count: results.length, queue: results });
+} catch (e) { res.status(500).json({ error: e.message }); }
+
+
+});
+
+app.delete('/api/omega/queue/:msgId', async (req, res) => {
+try {
+const outPath = path.join(DIRS.out, `req.params.msgId.jsonconstarchOutPath=pat
h.join(DIRS.archive{req.params.msgId}.json`);
+await fs.access(outPath);
+await fs.rename(outPath, archOutPath);
+res.json({ status: "deleted", id: req.params.msgId });
+} catch(e) { res.status(404).json({ error: "Message not found in queue" }); }
+});
+
+app.delete('/api/omega/queue', async (req, res) => {
+const { id, type } = req.query;
+if (!id) return res.status(400).json({ error: "Missing node id" });
+
+try {
+ const files = await fs.readdir(DIRS.out);
+ let deletedCount = 0;
+ for (const file of files.filter(f => f.endsWith('.json'))) {
+ const outPath = path.join(DIRS.out, file);
+ const archOutPath = path.join(DIRS.archive_out, file);
+ const packet = JSON.parse(await fs.readFile(outPath, 'utf8'));
+
+ if (packet.head.dst === id) {
+ if (type && packet.head.type !== type) continue;
+ await fs.rename(outPath, archOutPath);
+ deletedCount++;
+ }
+ }
+ res.json({ status: "ok", deleted: deletedCount });
+} catch(e) { res.status(500).json({ error: e.message }); }
+
+
+});
// --- APUFUNKTIO: Hae tilanneet mikropalvelut (Matchmaking) ---
function getSubscribers(packet) {
processOutbox(); // KC$ynnistetC$C$n ulosmenon tulittaja
});
});
+
[+] COMMIT VALMIS: /mnt/mesh_root/services/omega-router/omega_router_v3.js
$ x-console router_v3 restart
[+] Console router_v3 terminated.
[+] Console router_v3 created and executed via Event-Driven wrapper in
/mnt/mesh_root/services/omega-router
$ x-console router_v3 tail
user@hauki-obs:/mnt/mesh_root/services/omega-router$ /tmp/x_console_start_route
r
_v3.sh
[OMEGA ROUTER] Keskushermosto (v3) kC$ynnissC$ portissa 28888
$B
$ {
> # Kurkista Kallen_Selain -jonon tilaa lennosta
curl "http://localhost:28888/api/omega/queue?id=Kallen_Selain"
# Pollaa yksittC$inen paketti itsellesi (TC$mC$ imitoi selaimen toimintaa)
curl "http://localhost:28888/api/omega/poll?id=Kallen_Selain"