From 4dbd247f71b02bd98c82b843ea662f3f0d3618d9 Mon Sep 17 00:00:00 2001 From: Kritphong Mongkhonvanit Date: Thu, 16 Jul 2026 22:11:03 +0700 Subject: [PATCH 1/2] Docs: Add new build variable versionMajorMinor This is the version string, but with everything after the minor version stripped. --- apps/docs/lib/docs/runDocsAutogen.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/docs/lib/docs/runDocsAutogen.ts b/apps/docs/lib/docs/runDocsAutogen.ts index 79c78d16..83cab74f 100644 --- a/apps/docs/lib/docs/runDocsAutogen.ts +++ b/apps/docs/lib/docs/runDocsAutogen.ts @@ -26,8 +26,10 @@ export default async function runDocsAutogen() { netlogoDictionary: prebuildHandlebarsHelper, }); + const version = process.env["PRODUCT_VERSION"] || "7.0.1"; const buildVariables = { - version: process.env["PRODUCT_VERSION"] || "7.0.1", + version: version, + versionMajorMinor: version.match(/^[^.]+\.[^.]+/)?.[0], buildDate: process.env["PRODUCT_BUILD_DATE"] || new Date().toISOString(), }; From 8d8779c0d3255024c44d5979187a0e76a5aac3ba Mon Sep 17 00:00:00 2001 From: Kritphong Mongkhonvanit Date: Thu, 16 Jul 2026 22:11:18 +0700 Subject: [PATCH 2/2] Docs: Add documentation for the "Enable remote commands" option --- apps/docs/autogen/netlogopreferences.md | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/apps/docs/autogen/netlogopreferences.md b/apps/docs/autogen/netlogopreferences.md index b785d13c..29245994 100644 --- a/apps/docs/autogen/netlogopreferences.md +++ b/apps/docs/autogen/netlogopreferences.md @@ -99,6 +99,35 @@ empty model. If you use an editor outside of NetLogo to change the model or any included .nls files, the changed file is updated in NetLogo. +### Enable remote commands + +When this option is enabled, NetLogo listens for commands to execute on a Unix Domain Socket. Received commands are executed in the observer context as if they were entered in the Command Center. This can be used by external software such as editor plugins for better integration with NetLogo. + +If the environment variable `XDG_RUNTIME_DIR` is set, the listening socket is created under `XDG_RUNTIME_DIR`. Otherwise, it is created under the NetLogo directory: +- On Mac OS X: `Library/Application Support/NetLogo/{{versionMajorMinor}}` +- On Windows: `AppData\NetLogo\\{{versionMajorMinor}}` +- On Linux: `.netlogo/{{versionMajorMinor}}` + +The listening socket is named using the following pattern `netlogo-` where `` is the process ID of the associated NetLogo process. + +To send a command to NetLogo, encode the command in a JSON object as follows, replacing `` with the command. The resulting string should then be written to the listening socket. + +```json +{ + "type": "nl-run-code", + "code": "" +} +``` + +Once the command is received and processed, NetLogo will respond with the following JSON object. If the command is successfully parsed and executed, `` will be `ok`. Otherwise, it will be a message describing the error that occurred. Note that this will only report errors that occur during the processing of the request. Runtime errors that occur as a result of executing the provided command are not reported here. + +```json +{ + "type": "nl-status", + "status": "" +} +``` + ### Bold widget text By default, widget text is not in bold, use this option to bold it.