feat(gen1): llGridSay cross-estate cube communication over authenticated NexBus (#332)
* feat(gen1): grid-wide script message router interface * build(gen1): include new grid script router interface * feat(gen1): implement grid-wide llGridSay scripting API * feat(gen1): implement grid-wide llGridSay scripting API * feat(gen1): implement grid-wide llGridSay scripting API * feat(gen1): relay authenticated llGridSay across estates via NexBus * config(gen1): add opt-in global script messaging on authenticated NexBus * config(gen1): add opt-in global script messaging on authenticated NexBus * config(gen1): add opt-in global script messaging on authenticated NexBus * example(gen1): cross-estate beep cube using llGridSay * test(gen1): guard grid script authorization and NexBus fanout contract * ci(gen1): verify llGridSay protections on every push * docs(gen1): grid-wide llGridSay cube protocol, permissions and staging acceptance * docs(gen1): distinguish example implementation from live validation
This commit is contained in:
1 parent
4b32646bf2
commit
da2011efbd
13 files changed
+406
-1
No files matched your search
@@ -553,6 +553,10 @@ jobs:
|
||||
shell: bash
|
||||
run: python3 tools/ci/verify_estate_say.py
|
||||
|
||||
- name: Verify grid-wide cross-estate LSL messaging
|
||||
shell: bash
|
||||
run: python3 tools/ci/verify_gen1_grid_script_messaging.py
|
||||
|
||||
- name: Verify NodeAgent registry projection
|
||||
shell: bash
|
||||
run: dotnet run --configuration Release --project tools/ci/NexNodeRegistryRegression/NexNodeRegistryRegression.csproj
|
||||
|
||||
@@ -36,7 +36,8 @@ namespace NexVerse.RegionModules.NodeAgent
|
||||
ISharedRegionModule,
|
||||
INexVerseEventBusModule,
|
||||
ICrossRegionObjectMessageRouter,
|
||||
IEstateScriptMessageRouter
|
||||
IEstateScriptMessageRouter,
|
||||
IGridScriptMessageRouter
|
||||
{
|
||||
private const int DebugChannel = 0x7fffffff;
|
||||
private const int ObjectMessageRateEntryLimit = 8192;
|
||||
@@ -57,6 +58,8 @@ namespace NexVerse.RegionModules.NodeAgent
|
||||
private int m_HeartbeatSeconds = 30;
|
||||
private bool m_ObjectMessagingEnabled;
|
||||
private bool m_EstateScriptMessagingEnabled = true;
|
||||
// An opt-in, manager/owner-only cross-estate channel; never public by default.
|
||||
private bool m_GridScriptMessagingEnabled;
|
||||
private bool m_CrossRegionChatMessaging;
|
||||
private int m_ChatWhisperDistance = 10;
|
||||
private int m_ChatSayDistance = 20;
|
||||
@@ -94,6 +97,7 @@ namespace NexVerse.RegionModules.NodeAgent
|
||||
private IDisposable m_IarControlSubscription;
|
||||
private IDisposable m_ObjectMessageSubscription;
|
||||
private IDisposable m_EstateScriptMessageSubscription;
|
||||
private IDisposable m_GridScriptMessageSubscription;
|
||||
private IDisposable m_CrossRegionChatSubscription;
|
||||
private IDisposable m_FeaturePolicySubscription;
|
||||
// A malformed own-node policy must remain visible without flooding the log.
|
||||
@@ -163,6 +167,8 @@ namespace NexVerse.RegionModules.NodeAgent
|
||||
config.GetBoolean(
|
||||
"EstateScriptMessaging",
|
||||
true);
|
||||
m_GridScriptMessagingEnabled =
|
||||
config.GetBoolean("GridScriptMessaging", false);
|
||||
m_CrossRegionChatMessaging = config.GetBoolean(
|
||||
"CrossRegionChatMessaging", false);
|
||||
IConfig chatConfig = source.Configs["Chat"];
|
||||
@@ -222,6 +228,7 @@ namespace NexVerse.RegionModules.NodeAgent
|
||||
scene.RegisterModuleInterface<INexVerseEventBusModule>(this);
|
||||
scene.RegisterModuleInterface<ICrossRegionObjectMessageRouter>(this);
|
||||
scene.RegisterModuleInterface<IEstateScriptMessageRouter>(this);
|
||||
scene.RegisterModuleInterface<IGridScriptMessageRouter>(this);
|
||||
if (m_CrossRegionChatMessaging)
|
||||
scene.EventManager.OnChatFromClient += PublishNeighbourAvatarChat;
|
||||
}
|
||||
@@ -242,6 +249,7 @@ namespace NexVerse.RegionModules.NodeAgent
|
||||
PublishRegionEvent("region.offline", scene);
|
||||
if (m_CrossRegionChatMessaging)
|
||||
scene.EventManager.OnChatFromClient -= PublishNeighbourAvatarChat;
|
||||
scene.UnregisterModuleInterface<IGridScriptMessageRouter>(this);
|
||||
scene.UnregisterModuleInterface<IEstateScriptMessageRouter>(this);
|
||||
scene.UnregisterModuleInterface<ICrossRegionObjectMessageRouter>(this);
|
||||
scene.UnregisterModuleInterface<INexVerseEventBusModule>(this);
|
||||
@@ -308,6 +316,13 @@ namespace NexVerse.RegionModules.NodeAgent
|
||||
"estate.script.message.requested",
|
||||
HandleEstateScriptMessage);
|
||||
}
|
||||
if (m_GridScriptMessagingEnabled)
|
||||
{
|
||||
m_GridScriptMessageSubscription =
|
||||
m_Bus.Subscribe(
|
||||
"grid.script.message.requested",
|
||||
HandleGridScriptMessage);
|
||||
}
|
||||
|
||||
m_HeartbeatTimer = new Timer(
|
||||
_ => PublishHeartbeatSafe(),
|
||||
@@ -364,6 +379,8 @@ namespace NexVerse.RegionModules.NodeAgent
|
||||
m_ObjectMessageSubscription = null;
|
||||
m_EstateScriptMessageSubscription?.Dispose();
|
||||
m_EstateScriptMessageSubscription = null;
|
||||
m_GridScriptMessageSubscription?.Dispose();
|
||||
m_GridScriptMessageSubscription = null;
|
||||
m_CrossRegionChatSubscription?.Dispose();
|
||||
m_CrossRegionChatSubscription = null;
|
||||
m_FeaturePolicySubscription?.Dispose();
|
||||
@@ -710,6 +727,120 @@ namespace NexVerse.RegionModules.NodeAgent
|
||||
return true;
|
||||
}
|
||||
|
||||
// Grid-wide script messages are opt-in and limited to source objects
|
||||
// owned by an Estate Manager/Owner. They are not emitted to viewer chat.
|
||||
// The trusted NexBus layer authenticates remote simulator messages.
|
||||
public bool TryBroadcastGridMessage(
|
||||
UUID sourceRegionId,
|
||||
UUID sourceObjectId,
|
||||
UUID sourceOwnerId,
|
||||
string sourceName,
|
||||
int channel,
|
||||
string message)
|
||||
{
|
||||
if (!m_Enabled || !m_GridScriptMessagingEnabled || m_Bus == null ||
|
||||
sourceRegionId.IsZero() || sourceObjectId.IsZero() ||
|
||||
sourceOwnerId.IsZero() || channel == 0 || channel == DebugChannel ||
|
||||
!m_Scenes.TryGetValue(sourceRegionId, out Scene sourceScene))
|
||||
return false;
|
||||
|
||||
SceneObjectPart sourcePart = sourceScene.GetSceneObjectPart(sourceObjectId);
|
||||
EstateSettings sourceEstate = sourceScene.RegionInfo.EstateSettings;
|
||||
if (sourcePart == null || sourcePart.IsDeleted ||
|
||||
sourcePart.OwnerID != sourceOwnerId || sourceEstate == null ||
|
||||
!sourceEstate.IsEstateManagerOrOwner(sourceOwnerId))
|
||||
{
|
||||
m_Log.WarnFormat("[NEX-GRID-SAY]: Unauthorisierter Sender {0}, Besitzer {1}.",
|
||||
sourceObjectId, sourceOwnerId);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!TryTakeObjectMessageRateSlot(m_ObjectMessageOutboundRates, sourceObjectId))
|
||||
return false;
|
||||
|
||||
string payload = message ?? string.Empty;
|
||||
if (payload.Length > 1023)
|
||||
payload = payload[..1023];
|
||||
|
||||
string name = string.IsNullOrWhiteSpace(sourceName)
|
||||
? sourcePart.Name ?? string.Empty
|
||||
: sourceName.Trim();
|
||||
|
||||
// All locally loaded scenes, regardless of EstateID. This happens
|
||||
// exactly once on the source node; the bus receiver skips this node.
|
||||
foreach (Scene scene in m_Scenes.Values)
|
||||
{
|
||||
IWorldComm comm = scene.RequestModuleInterface<IWorldComm>();
|
||||
comm?.DeliverMessage(ChatTypeEnum.Region, channel, name,
|
||||
sourceObjectId, payload);
|
||||
}
|
||||
|
||||
Publish(new NexEvent(
|
||||
"grid.script.message.requested",
|
||||
"nexverse.simulator",
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
["source_node_id"] = m_NodeId,
|
||||
["source_region_id"] = sourceRegionId.ToString(),
|
||||
["source_object_id"] = sourceObjectId.ToString(),
|
||||
["source_owner_id"] = sourceOwnerId.ToString(),
|
||||
["source_name"] = name,
|
||||
["channel"] = channel.ToString(
|
||||
System.Globalization.CultureInfo.InvariantCulture),
|
||||
["message"] = payload
|
||||
}));
|
||||
return true;
|
||||
}
|
||||
|
||||
private void HandleGridScriptMessage(NexEvent nexEvent)
|
||||
{
|
||||
if (!m_Enabled || !m_GridScriptMessagingEnabled ||
|
||||
nexEvent == null || nexEvent.Data == null ||
|
||||
!string.Equals(nexEvent.Source, "nexverse.simulator",
|
||||
StringComparison.Ordinal))
|
||||
return;
|
||||
|
||||
TimeSpan age = DateTimeOffset.UtcNow - nexEvent.Timestamp;
|
||||
if (age > TimeSpan.FromSeconds(m_ObjectMessageMaxAgeSeconds) ||
|
||||
age < TimeSpan.FromSeconds(-5))
|
||||
return;
|
||||
|
||||
if (!TryCommandData(nexEvent, "source_node_id", out string sourceNodeId) ||
|
||||
string.Equals(sourceNodeId, m_NodeId, StringComparison.Ordinal) ||
|
||||
!TryCommandData(nexEvent, "source_region_id", out string rawSourceRegion) ||
|
||||
!UUID.TryParse(rawSourceRegion, out UUID sourceRegionId) ||
|
||||
sourceRegionId.IsZero() ||
|
||||
!TryCommandData(nexEvent, "source_object_id", out string rawSourceObject) ||
|
||||
!UUID.TryParse(rawSourceObject, out UUID sourceObjectId) ||
|
||||
sourceObjectId.IsZero() ||
|
||||
!TryCommandData(nexEvent, "source_owner_id", out string rawSourceOwner) ||
|
||||
!UUID.TryParse(rawSourceOwner, out UUID sourceOwnerId) ||
|
||||
sourceOwnerId.IsZero() ||
|
||||
!TryCommandInt(nexEvent, "channel", out int channel) ||
|
||||
channel == 0 || channel == DebugChannel)
|
||||
return;
|
||||
|
||||
// The originating authenticated simulator validated object ownership
|
||||
// and Estate Manager/Owner rights; never rely on viewer-reported data.
|
||||
if (!TryTakeObjectMessageRateSlot(m_ObjectMessageInboundRates,
|
||||
sourceObjectId))
|
||||
return;
|
||||
|
||||
string sourceName = nexEvent.Data.TryGetValue("source_name", out string name)
|
||||
? name ?? string.Empty : string.Empty;
|
||||
string payload = nexEvent.Data.TryGetValue("message", out string message)
|
||||
? message ?? string.Empty : string.Empty;
|
||||
if (payload.Length > 1023)
|
||||
payload = payload[..1023];
|
||||
|
||||
foreach (Scene scene in m_Scenes.Values)
|
||||
{
|
||||
IWorldComm comm = scene.RequestModuleInterface<IWorldComm>();
|
||||
comm?.DeliverMessage(ChatTypeEnum.Region, channel, sourceName,
|
||||
sourceObjectId, payload);
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleEstateScriptMessage(
|
||||
NexEvent nexEvent)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Optional grid-wide, cross-estate script-message dispatcher.
|
||||
/// The router is responsible for permission checks, local delivery,
|
||||
/// cross-node transport authentication, and anti-flood controls.
|
||||
/// </summary>
|
||||
public interface IGridScriptMessageRouter
|
||||
{
|
||||
bool TryBroadcastGridMessage(
|
||||
UUID sourceRegionId,
|
||||
UUID sourceObjectId,
|
||||
UUID sourceOwnerId,
|
||||
string sourceName,
|
||||
int channel,
|
||||
string message);
|
||||
}
|
||||
}
|
||||
@@ -512,6 +512,7 @@
|
||||
<Compile Include="Interfaces\IFriendsModule.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Interfaces\IGridScriptMessageRouter.cs" />
|
||||
<Compile Include="Interfaces\ICommander.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
||||
@@ -1339,6 +1339,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// OpenGenesisLINK-only, opt-in grid-wide object chat. All security and
|
||||
/// fanout decisions belong to the NodeAgent router; this API never
|
||||
/// bypasses that router or exposes a public HTTP broadcast.
|
||||
/// </summary>
|
||||
public void llGridSay(int channelID, string text)
|
||||
{
|
||||
if (channelID == 0 || channelID == ScriptBaseClass.DEBUG_CHANNEL)
|
||||
{
|
||||
Error("llGridSay", "Channel 0 and DEBUG_CHANNEL are not allowed");
|
||||
return;
|
||||
}
|
||||
|
||||
IGridScriptMessageRouter router =
|
||||
World.RequestModuleInterface<IGridScriptMessageRouter>();
|
||||
if (router == null)
|
||||
{
|
||||
Error("llGridSay", "Grid-wide messaging is not enabled on this simulator");
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] payload = Utils.StringToBytesNoTerm(text ?? string.Empty, 1023);
|
||||
if (!router.TryBroadcastGridMessage(
|
||||
World.RegionInfo.RegionID,
|
||||
m_host.UUID,
|
||||
m_host.OwnerID,
|
||||
m_host.Name,
|
||||
channelID,
|
||||
Util.UTF8.GetString(payload)))
|
||||
{
|
||||
Error("llGridSay", "Grid-wide delivery refused by server policy");
|
||||
}
|
||||
}
|
||||
|
||||
public void llRegionSayTo(string target, int channel, string msg)
|
||||
{
|
||||
if (channel == ScriptBaseClass.DEBUG_CHANNEL)
|
||||
|
||||
@@ -320,6 +320,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
void llRefreshPrimURL();
|
||||
void llRegionSay(int channelID, string text);
|
||||
void llEstateSay(int channelID, string text);
|
||||
void llGridSay(int channelID, string text);
|
||||
void llRegionSayTo(string target, int channelID, string text);
|
||||
void llReleaseCamera(string avatar);
|
||||
void llReleaseControls();
|
||||
|
||||
@@ -1617,6 +1617,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
m_LSL_Functions.llEstateSay(channelID, text);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void llGridSay(int channelID, string text)
|
||||
{
|
||||
m_LSL_Functions.llGridSay(channelID, text);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void llRegionSayTo(string key, int channelID, string text)
|
||||
{
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
CrossRegionChatMessaging = true
|
||||
AllowCrossOwnerObjectMessages = true
|
||||
EstateScriptMessaging = true
|
||||
; Generation 1: explicit opt-in for global cross-estate object signals.
|
||||
; llGridSay is restricted to Estate Owner/Manager-owned source objects.
|
||||
GridScriptMessaging = true
|
||||
ObjectMessagesPerSecond = 20
|
||||
ObjectMessageMaxAgeSeconds = 30
|
||||
ManagedRegionCommands = false
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
CrossRegionChatMessaging = true
|
||||
AllowCrossOwnerObjectMessages = true
|
||||
EstateScriptMessaging = true
|
||||
; Generation 1: explicit opt-in for global cross-estate object signals.
|
||||
; llGridSay is restricted to Estate Owner/Manager-owned source objects.
|
||||
GridScriptMessaging = true
|
||||
ObjectMessagesPerSecond = 20
|
||||
ObjectMessageMaxAgeSeconds = 30
|
||||
ManagedRegionCommands = false
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
; also reaches matching Estate regions on other simulator nodes.
|
||||
; The LSL API itself still permits calls only from Estate Owner/Managers.
|
||||
EstateScriptMessaging = true
|
||||
; Generation 1: explicit opt-in for global cross-estate object signals.
|
||||
; llGridSay is restricted to Estate Owner/Manager-owned source objects.
|
||||
GridScriptMessaging = false
|
||||
|
||||
ObjectMessagesPerSecond = 20
|
||||
ObjectMessageMaxAgeSeconds = 30
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
# OpenGenesisLINK Generation 1 – gridweite LSL-Objektkommunikation
|
||||
|
||||
**Neu:** `llGridSay(integer channel, string message);` ist eine OpenGenesisLINK-eigene LSL-Erweiterung für Kommunikation zwischen Objekten in **allen laufenden Regionen des gleichen Grids**, unabhängig vom Estate und der Entfernung. Auch über getrennte Simulatorprozesse hinweg kann die Nachricht per NexBus übertragen werden. Dies ist keine Standard-LSL-Funktion und funktioniert nicht auf unveränderten OpenSim-/Second-Life-Servern.
|
||||
|
||||
Das bestehende `llEstateSay` (gleicher Estate) und `llRegionSayTo` (gezielte Objekt-UUID) bleiben unverändert.
|
||||
|
||||
## Verwendung
|
||||
|
||||
```lsl
|
||||
integer CHANNEL = -9342801;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen(CHANNEL, "", NULL_KEY, "");
|
||||
}
|
||||
|
||||
touch_start(integer total_number)
|
||||
{
|
||||
llGridSay(CHANNEL, "Beep");
|
||||
}
|
||||
|
||||
listen(integer channel, string name, key sender, string message)
|
||||
{
|
||||
if (message == "Beep")
|
||||
llSetColor(<1.0, 0.0, 0.0>, ALL_SIDES);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Die vollständige Würfel-Demovorlage mit 0,5-Sekunden-Rückstellung liegt in `tools/diagnostics/ogl_grid_beep_cubes.lsl`. Dieses Script kommt in jeden Würfel. Für zuverlässiges Feedback leuchtet der Sender beim Touch auch sofort lokal.
|
||||
|
||||
## Architektur
|
||||
|
||||
- **Gleicher Simulatorprozess:** Der NexVerse NodeAgent liefert über `IWorldComm.DeliverMessage(ChatTypeEnum.Region, ...)` in jede geladene Region, ohne Estate-Filter.
|
||||
- **Andere Simulatorprozesse:** Der NodeAgent veröffentlicht `grid.script.message.requested` auf dem bestehenden, HMAC-gesicherten NexBus. Empfangende Nodes liefern über `IWorldComm` an ihre lokalen Regionen. Die Quellnode wird übersprungen, damit keine Rückschleife entsteht.
|
||||
- **Empfänger:** Jedes Skript im selben Grid, das den benutzten Kanal abhört, kann den Inhalt empfangen. Ein negativer Kanal ist kein Geheimnis und keine authentisierte Senderidentität.
|
||||
- **Grenzen:** kein Kanal `0`, kein `DEBUG_CHANNEL`; maximale Nachricht 1023 Zeichen/Bytes im bestehenden LSL-Payloadpfad; pro Quellobjekt bestehendes Ratenlimit `ObjectMessagesPerSecond`. Alte oder wiederholte NexBus-Ereignisse werden durch Ablaufkontrolle und bestehende Event-ID-Deduplizierung verworfen. Die Zustellung ist best effort, nicht garantiert; offline Regionen bekommen keine gespeicherte Nachricht.
|
||||
- **Senden darf nur:** Objekt, das nachweislich dem **Estate Owner oder einem eingetragenen Estate Manager der Quellregion** gehört. Ein normales Einwohnerobjekt darf keine globalen Signale auslösen. Die Quellnode prüft live Objekt, Besitzer und Estate-Berechtigung, bevor lokal oder extern ausgeliefert wird. Die authentifizierte Gegenseite vertraut nur registrierten NexBus-Simulatoren, nicht Viewer-Daten.
|
||||
- **Hypergrid:** Die Funktion kommuniziert innerhalb der selben OpenGenesisLINK-NexBus-Gridverwaltung, **nicht automatisch in fremde Hypergrid-Systeme**.
|
||||
|
||||
## Konfiguration
|
||||
|
||||
Alle Simulatoren auf denen Würfel stehen müssen die Funktion laden. Für eine echte standortübergreifende Verbindung braucht jeder NodeAgent eine eindeutige `NodeId`, eine funktionierende `PeerUrl` sowie den korrekt gesetzten `NEXVERSE_NEXBUS_SHARED_KEY`. Der bestehende HMAC-Hub muss die Ereignisse verteilen; eingehende NexBus-Routen dürfen niemals ungeschützt ins Internet gelegt werden.
|
||||
|
||||
```ini
|
||||
[NexVerseNodeAgent]
|
||||
Enabled = true
|
||||
GridScriptMessaging = true
|
||||
ObjectMessagesPerSecond = 20
|
||||
ObjectMessageMaxAgeSeconds = 30
|
||||
```
|
||||
|
||||
`GridScriptMessaging` ist in `OpenSimDefaults.ini` sicherheitshalber **false**; in den Stadt-NexVerse-Aktivprofilen und Beispielen **true**. Neue GitHub-Konfigurationen werden auf existierende Installationen nicht automatisch angewandt. Nur aktivieren, wenn die verwendeten Sims und der NexBus zu derselben Gridverwaltung gehören.
|
||||
|
||||
## Abnahme im Staging
|
||||
|
||||
1. Zwei Würfel in **derselben Region**: einmal pro Klick rot aufleuchten und wieder weiß werden.
|
||||
2. Zwei Würfel auf **verschiedenen Regionen desselben Simulatorprozesses**, **verschiedene Estate-IDs**.
|
||||
3. Zwei Würfel auf **verschiedenen Simulatorservern**, verschiedene Estate-IDs, tatsächlicher NexBus/HMAC-Pfad.
|
||||
4. Nicht berechtigter Einwohner-Würfel muss Senden verweigert bekommen. Listener dürfen Empfang weiter nutzen.
|
||||
5. Negativtest mit Kanal 0, Debug-Kanal, zu langen Nachrichten, Spam, ungültigen Signaturen, Replay, abgeschaltetem NodeAgent und nicht zustellbarem Peer.
|
||||
6. Vorher bestehende `llEstateSay`/LSL-`llRegionSayTo` Tests, normale Hypergrid-Käufe, Region-Crossing und Build dürfen nicht regressieren.
|
||||
|
||||
Dies ist ein Grid-Broadcast im laufenden Simulatorbetrieb, **keine Hypergrid-Föderationsfunktion und keine dauerhafte Message-Queue**.
|
||||
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Static contract for opt-in, authenticated cross-estate llGridSay."""
|
||||
from pathlib import Path
|
||||
root = Path(__file__).resolve().parents[2]
|
||||
def read(path):
|
||||
return (root / path).read_text(encoding="utf-8-sig")
|
||||
|
||||
api = read("OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs")
|
||||
stub = read("OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs")
|
||||
lsl = read("OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs")
|
||||
router = read("OpenSim/Region/Framework/Interfaces/IGridScriptMessageRouter.cs")
|
||||
node = read("NexVerse/RegionModules/NodeAgent/NexVerseNodeAgentModule.cs")
|
||||
workflow = read(".github/workflows/nexjast-ci.yml")
|
||||
demo = read("tools/diagnostics/ogl_grid_beep_cubes.lsl")
|
||||
proj = read("OpenSim/Region/Framework/OpenSim.Region.Framework.csproj")
|
||||
|
||||
assert "void llGridSay(int channelID, string text);" in api
|
||||
assert "public void llGridSay(int channelID, string text)" in stub
|
||||
assert "m_LSL_Functions.llGridSay(channelID, text);" in stub
|
||||
assert "public void llGridSay(int channelID, string text)" in lsl
|
||||
assert 'channelID == 0 || channelID == ScriptBaseClass.DEBUG_CHANNEL' in lsl
|
||||
assert 'World.RequestModuleInterface<IGridScriptMessageRouter>()' in lsl
|
||||
assert "TryBroadcastGridMessage(" in router
|
||||
assert "TryBroadcastGridMessage(" in node
|
||||
assert 'GridScriptMessaging", false' in node, "must default OFF"
|
||||
assert "m_GridScriptMessagingEnabled" in node
|
||||
assert "scene.RegisterModuleInterface<IGridScriptMessageRouter>(this);" in node
|
||||
assert "scene.UnregisterModuleInterface<IGridScriptMessageRouter>(this);" in node
|
||||
assert "m_GridScriptMessageSubscription?.Dispose();" in node
|
||||
assert '"grid.script.message.requested"' in node
|
||||
assert "HandleGridScriptMessage" in node
|
||||
|
||||
sender = node.split("public bool TryBroadcastGridMessage(", 1)[1].split("private void HandleGridScriptMessage(", 1)[0]
|
||||
receiver = node.split("private void HandleGridScriptMessage(", 1)[1].split("private void HandleEstateScriptMessage(", 1)[0]
|
||||
for term in (
|
||||
"sourcePart.OwnerID != sourceOwnerId",
|
||||
"sourcePart.IsDeleted",
|
||||
"sourceEstate.IsEstateManagerOrOwner(sourceOwnerId)",
|
||||
"TryTakeObjectMessageRateSlot(m_ObjectMessageOutboundRates",
|
||||
"channel == 0",
|
||||
"channel == DebugChannel",
|
||||
"m_Scenes.Values",
|
||||
"IWorldComm",
|
||||
"ChatTypeEnum.Region",
|
||||
'Publish(new NexEvent(',
|
||||
):
|
||||
assert term in sender, "missing send authorization: "+term
|
||||
|
||||
for term in (
|
||||
"nexEvent.Timestamp",
|
||||
"m_ObjectMessageMaxAgeSeconds",
|
||||
'string.Equals(nexEvent.Source, "nexverse.simulator"',
|
||||
"TryTakeObjectMessageRateSlot(m_ObjectMessageInboundRates",
|
||||
'"source_node_id"',
|
||||
'"source_region_id"',
|
||||
'"source_object_id"',
|
||||
'"source_owner_id"',
|
||||
"m_Scenes.Values",
|
||||
"IWorldComm",
|
||||
"ChatTypeEnum.Region",
|
||||
):
|
||||
assert term in receiver, "missing remote guard: "+term
|
||||
|
||||
assert 'Interfaces\\IGridScriptMessageRouter.cs' in proj
|
||||
assert "llGridSay(CHANNEL, SIGNAL);" in demo
|
||||
assert "llListen(CHANNEL" in demo
|
||||
assert "llSetTimerEvent(FLASH_SECONDS)" in demo
|
||||
for path, state in (
|
||||
("bin/OpenSimDefaults.ini", "false"),
|
||||
("bin/OpenSim.ini", "true"),
|
||||
("bin/OpenSim.ini.example", "true"),
|
||||
):
|
||||
config = read(path)
|
||||
assert "GridScriptMessaging = " + state in config, path
|
||||
|
||||
assert "Verify grid-wide cross-estate LSL messaging" in workflow
|
||||
print("Generation 1 llGridSay: API, local broadcast, signed NexBus, permissions, rate limit and opt-in config OK")
|
||||
@@ -0,0 +1,54 @@
|
||||
// OpenGenesisLINK Generation 1 – gridweite Würfel-Kommunikation
|
||||
// Das gleiche Skript in jeden Würfel legen. Alle Würfel leuchten rot auf,
|
||||
// unabhängig von Region/Entfernung/Estate – innerhalb eines OpenGenesisLINK-Grids.
|
||||
//
|
||||
// Voraussetzung auf allen Simulatoren:
|
||||
// [NexVerseNodeAgent] Enabled = true; GridScriptMessaging = true
|
||||
// Für mehrere Simulatornodes muss der NexBus-HMAC-Transport funktionieren.
|
||||
// Der AUSLÖSENDE Würfel muss einem Estate Owner oder Manager gehören.
|
||||
// llGridSay ist eine OpenGenesisLINK-Servererweiterung (nicht Standard-LSL).
|
||||
|
||||
integer CHANNEL = -9342801;
|
||||
string SIGNAL = "Beep";
|
||||
float FLASH_SECONDS = 0.5;
|
||||
|
||||
flash()
|
||||
{
|
||||
llSetColor(<1.0, 0.0, 0.0>, ALL_SIDES);
|
||||
llSetTimerEvent(FLASH_SECONDS);
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSetColor(<1.0, 1.0, 1.0>, ALL_SIDES);
|
||||
llSetTimerEvent(0.0);
|
||||
llListen(CHANNEL, "", NULL_KEY, "");
|
||||
}
|
||||
|
||||
touch_start(integer total_number)
|
||||
{
|
||||
// Sofortiges Feedback am auslösenden Würfel.
|
||||
flash();
|
||||
// Alle anderen (auch auf fremden Estates im selben Grid) benachrichtigen.
|
||||
llGridSay(CHANNEL, SIGNAL);
|
||||
}
|
||||
|
||||
listen(integer channel, string name, key id, string message)
|
||||
{
|
||||
if (channel == CHANNEL && message == SIGNAL)
|
||||
flash();
|
||||
}
|
||||
|
||||
timer()
|
||||
{
|
||||
llSetColor(<1.0, 1.0, 1.0>, ALL_SIDES);
|
||||
llSetTimerEvent(0.0);
|
||||
}
|
||||
|
||||
on_rez(integer start_param)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user