Skip to content

[WIP] Publish object inventories to external editor.#5834

Draft
Rider-Linden wants to merge 3 commits into
project/lua_editorfrom
rider/poc/object_publish
Draft

[WIP] Publish object inventories to external editor.#5834
Rider-Linden wants to merge 3 commits into
project/lua_editorfrom
rider/poc/object_publish

Conversation

@Rider-Linden
Copy link
Copy Markdown
Contributor

@Rider-Linden Rider-Linden commented May 19, 2026

Description

This is very much a work in progress.

This PR adds a set of commands to the JSON-RPC editor websocket that allow an external editor to read the contents of an object in world, read and write scripts and notecards in that object. Child prims in a linkset are treated as directories.

The feature is enabled via a debug variable for "tight editor integration"


Related plugin PR:
secondlife/sl-vscode-plugin#69

Checklist

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This WIP PR extends the external-editor WebSocket/JSON-RPC integration to support “tight” VS Code launching and publishing in-world object inventories (scripts/notecards) for an external editor to browse and edit.

Changes:

  • Add JSON-RPC methods for object inventory publish/update plus item content get/save and item create/delete, and add VS Code launch helpers.
  • Introduce async JSON-RPC method handling (coroutine-based) and improve WebSocket shutdown behavior by closing all connections on server stop.
  • Update viewer UI behavior/settings/strings and expand the JSON-RPC documentation to cover object content publishing and VS Code launch URIs.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
indra/newview/skins/default/xui/en/strings.xml Adds user-facing error strings for WebSocket server start and VS Code launch failures.
indra/newview/llscripteditorws.h Expands the script editor WS server interface to include object publishing/content APIs and VS Code launch helpers.
indra/newview/llscripteditorws.cpp Implements object inventory publishing, content read/write, item create/delete, prim inventory listeners, and VS Code launching.
indra/newview/llpreviewscript.cpp Routes “Edit in External Editor” through tight VS Code integration when enabled; refactors server startup via ensureServerRunning().
indra/newview/app_settings/settings.xml Adds ExternalEditorTightIntegration debug setting.
indra/llcorehttp/llwebsocketmgr.h Adds WSConnection::getSelfPtr() and WSServer::closeAllConnections().
indra/llcorehttp/llwebsocketmgr.cpp Closes all WS connections during server stop; implements getSelfPtr() and closeAllConnections().
indra/llcorehttp/lljsonrpcws.h Adds registerAsyncMethod() and storage for async handlers.
indra/llcorehttp/lljsonrpcws.cpp Dispatches async JSON-RPC methods via main-thread task + LLCoros coroutine and sends responses on completion.
doc/external-editor-json-rpc.md Updates/extends protocol docs to include VS Code launch URI and object content publishing interfaces.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +906 to +909
std::string content = params["content"].asString();
if (content.empty())
throw LLJSONRPCConnection::InvalidParams("content is required");

Comment on lines +179 to +187
LLSD result = handler(method, id, params);
conn->sendResponse(id, result);
}
catch (const RPCError& e)
{
conn->sendError(id, e);
}
catch (const std::exception& e)
{
Comment on lines +811 to +812
auto v = validatePublishedItem(params, PERM_COPY | PERM_MODIFY);

Comment on lines +1143 to +1147
// Set up event pump to wait for inventory change
LLEventMailDrop result_pump("objectItemCreate." + LLUUID::generateNewID().asString(), true);
std::string pump_name = result_pump.getName();
mPendingItemCreates[prim_id] = pump_name;

Comment on lines +7 to +45
- [Usage Flow](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#usage-flow)
- [VS Code Launch URI](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#vs-code-launch-uri)
- [JSON-RPC Method Summary](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#json-rpc-method-summary)
- [Session Management Interfaces](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#session-management-interfaces)
- [SessionHandshake](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#sessionhandshake)
- [SessionHandshakeResponse](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#sessionhandshakeresponse)
- [Session OK](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#session-ok)
- [SessionDisconnect](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#sessiondisconnect)
- [Language and Syntax Interfaces](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#language-and-syntax-interfaces)
- [SyntaxChange](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#syntaxchange)
- [Language Syntax ID Request](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#language-syntax-id-request)
- [Language Syntax Request](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#language-syntax-request)
- [Language Syntax Cache List](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#language-syntax-cache-list)
- [Language Syntax Cache Get](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#language-syntax-cache-get)
- [Script Subscription Interfaces](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#script-subscription-interfaces)
- [ScriptSubscribe](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#scriptsubscribe)
- [ScriptSubscribeResponse](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#scriptsubscriberesponse)
- [ScriptUnsubscribe](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#scriptunsubscribe)
- [ScriptList](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#scriptlist)
- [Compilation Interfaces](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#compilation-interfaces)
- [CompilationError](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#compilationerror)
- [CompilationResult](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#compilationresult)
- [Runtime Event Interfaces](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#runtime-event-interfaces)
- [RuntimeDebug](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#runtimedebug)
- [RuntimeError](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#runtimeerror)
- [Handler and Configuration Interfaces](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#handler-and-configuration-interfaces)
- [WebSocketHandlers](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#websockethandlers)
- [ClientInfo](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#clientinfo)
- [Object Content Interfaces](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#object-content-interfaces)
- [Core Data Types](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#core-data-types)
- [ObjectPublish](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#objectpublish)
- [ObjectUnpublish](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#objectunpublish)
- [ObjectUpdate](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#objectupdate)
- [ObjectContentGet](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#objectcontentget)
- [ObjectContentSave](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#objectcontentsave)
- [ObjectItemCreate](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#objectitemcreate)
- [ObjectItemDelete](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#objectitemdelete)
- [ObjectScriptSetRunning](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#objectscriptsetrunning)
- [ObjectRequest](../../../VSCode/sl-vscode-edit/doc/Message_Interfaces.md#objectrequest)
Comment on lines +785 to +792
### ObjectUpdate

**JSON-RPC Method:** `object.update` (notification from viewer)

Sent when the inventory of a published object changes. Supports two modes:
- **Full replacement**: `inventory` and/or `linked_objects` fields replace the entire prior state.
- **Delta update**: `changes` field describes only what changed. Takes precedence over full replacement fields when present.

Comment on lines +182 to +183
| `object.script.set_running` | Extension -> Viewer | Call | `ObjectScriptSetRunningParams` |
| `object.script.set_running` (response) | Viewer -> Extension | Response | `ObjectScriptSetRunningResponse` |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants