LearnNewsExamplesServices
Frontmatter
id8173
titleImplement Unique App Worker Identification & Worker Topology
stateClosed
labels
enhancementaiarchitecture
assigneestobiu
createdAtDec 28, 2025, 3:24 PM
updatedAtDec 28, 2025, 4:30 PM
githubUrlhttps://github.com/neomjs/neo/issues/8173
authortobiu
commentsCount2
parentIssue8169
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtDec 28, 2025, 4:30 PM

Implement Unique App Worker Identification & Worker Topology

Closed v11.18.0 enhancementaiarchitecture
tobiu
tobiu commented on Dec 28, 2025, 3:24 PM

To correctly map the topology of a distributed Neo.mjs environment (multiple browsers, shared workers), App Workers need globally unique identifiers when connecting to the Neural Link.

Requirements:

  1. Unique ID: Generate a UUID for the App Worker instance (id) on startup.
  2. Handshake: Update Neo.ai.Client to send a register payload upon WebSocket connection, including:
    • appWorkerId
    • isSharedWorker boolean
    • userAgent
    • environment
  3. ConnectionService: Update registry to track sessions by appWorkerId (or map socket ID to this metadata).
  4. Tool: Implement get_worker_topology to list connected workers.
tobiu added the enhancement label on Dec 28, 2025, 3:24 PM
tobiu added the ai label on Dec 28, 2025, 3:24 PM
tobiu added the architecture label on Dec 28, 2025, 3:24 PM
tobiu added parent issue #8169 on Dec 28, 2025, 3:25 PM
tobiu assigned to @tobiu on Dec 28, 2025, 3:27 PM
tobiu
tobiu Dec 28, 2025, 3:53 PM

we enhanced core.Base to enable uids inside the static config block:

    construct(config={}) {
        let me = this;

    Object.defineProperties(me, {
        [configSymbol]: {
            configurable: true,
            enumerable  : false,
            value       : {},
            writable    : true
        },
        [isInstance]: {
            enumerable: false,
            value     : true
        }
    });

    me.id = config.id || me.constructor.config.id || IdGenerator.getId(this.getIdKey());
    delete config.id;

=> the ctor check is new.

tobiu referenced in commit 9053f90 - "#8173 app worker uid" on Dec 28, 2025, 3:54 PM
tobiu referenced in commit 58c6e6f - "#8171 and #8173 in combination" on Dec 28, 2025, 4:29 PM
tobiu
tobiu Dec 28, 2025, 4:29 PM

Input from Gemini 3:

Implementation Complete

I have established the foundation for unique App Worker identification and topology discovery.

Changes:

  1. Core (src/core/Base.mjs): Updated construct to allow static config.id to act as a fallback instance ID.
  2. Worker (src/worker/App.mjs):
    • Set id to crypto.randomUUID() in static config, ensuring every App Worker instance has a unique, persistent identity (appWorkerId).
  3. Client (src/ai/Client.mjs):
    • Implemented register handshake in onSocketOpen.
    • Sends appWorkerId, isSharedWorker, userAgent, and environment to the MCP Server.
  4. Server (ConnectionService.mjs):
    • Renamed internal windowId to sessionId to correctly reflect Socket semantics.
    • Implemented sessionData map to store metadata from register handshake.
    • Implemented getWorkerTopology tool to return the list of connected workers.
  5. OpenAPI & Tools:
    • Added /worker/topology endpoint.
    • Mapped get_worker_topology in toolService.mjs.

Verification:

  • test_connection_service.mjs passes.
  • Server correctly initializes and listens.

Ready for review.

tobiu closed this issue on Dec 28, 2025, 4:30 PM