[WIP] Prim publishing#69
Draft
Rider-Linden wants to merge 2 commits into
Draft
Conversation
…them as virtual file systems, so that they appear as folders in the explorer tab. Not yet in a stable state.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds initial support for “prim publishing” by integrating new viewer JSON-RPC methods and exposing published in-world object inventory as a browsable sl://objects/... virtual filesystem inside VS Code, plus a viewer-driven vscode://.../connect launch flow.
Changes:
- Introduces
ObjectContentService+ObjectContentProviderto model published objects and implement a VS CodeFileSystemProviderforsl://objects. - Extends WebSocket/JSON-RPC client and
SynchServiceto handleobject.publish/object.unpublish/object.updatenotifications and new object content RPC calls. - Registers URI handler + file decorations + resource label formatting to improve UX for viewer launches and disconnected state.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/websockclient.ts | Adds JSON-RPC inbound/outbound message debug logging hooks. |
| src/utils.ts | Introduces logDebug() for debug-level logging. |
| src/vscode/objectcontentservice.ts | New singleton service to track published objects, inventories, and content cache with change events. |
| src/vscode/objectcontentprovider.ts | New sl:// FileSystemProvider exposing objects/prims/items and mapping viewer RPC errors to FileSystemErrors. |
| src/vscode/objectcontentinterfaces.ts | New protocol/type definitions for object publishing + content CRUD JSON-RPC. |
| src/vscode/ObjectContentDecorator.ts | New file decoration provider to indicate disconnected state for sl:// resources. |
| src/viewereditwsclient.ts | Adds typed wrappers for new object content JSON-RPC calls and object publish/update notifications. |
| src/synchservice.ts | Wires object publish/update notifications into ObjectContentService, adds connection-state eventing, and adds viewer launch parameter handling. |
| src/extension.ts | Registers the sl:// FS provider, decorations, workspace folder management, and a vscode://.../connect URI handler. |
| package.json | Adds resourceLabelFormatters for nicer display labels for sl://objects resources. |
| doc/Message_Interfaces.md | Documents the new launch URI and object content/publishing JSON-RPC interfaces. |
Comments suppressed due to low confidence (2)
src/extension.ts:120
connectToViewerreturns a Promise but is called withoutawait/voidand without error handling. IfsetupConnectionthrows (e.g., unexpected failure paths), this can surface as an unhandled promise rejection. Considervoid synchService.connectToViewer(...).catch(err => showErrorMessage(...)), or makehandleUriasync and await with try/catch.
logInfo(`Connecting with port=${port}, object_id=${object_id ?? "(none)"}, script_id=${script_id ?? "(none)"}`);
synchService.connectToViewer({ port, object_id, script_id });
}
doc/Message_Interfaces.md:910
ObjectItemCreateParams.vmis documented here as "luau" | "lsl", but the code/interface usesScriptVM = "lsl2" | "mono" | "luau"and the provider sends "lsl2" for .lsl creation. Update the doc to match the actual accepted values.
prim_id: string; // UUID of the prim to create the item in
name: string; // Pure SL inventory name — no file extension
type: InventoryItemType; // "script" ("notecard" reserved for future)
vm: ScriptVM; // Required for scripts: "luau" | "lsl"
}
Comment on lines
+182
to
+186
| if (!item_id) { | ||
| if (options?.allowMissingLeaf) { | ||
| return { root_id, link_id, pending_name: seg2, isDirectory: false }; | ||
| } | ||
| throw vscode.FileSystemError.FileNotFound(uri); |
Comment on lines
+532
to
+535
| const response = await client.getObjectContent({ prim_id, item_id: result.item_id }); | ||
| const text = response.content ?? ""; | ||
| // Cache under the real item_id returned by the viewer | ||
| this.service.cacheContent(root_id, result.item_id, Buffer.from(text, "utf-8")); |
Comment on lines
+423
to
+424
| const text = response.content ?? ""; | ||
| const bytes = Buffer.from(text, "utf-8"); |
Comment on lines
+92
to
+93
| // Decode the query string first - some viewers incorrectly encode the delimiters | ||
| const decodedQuery = decodeURIComponent(uri.query); |
Comment on lines
+43
to
+44
| // TODO: Check a debug setting to conditionally log | ||
| // For now, always log debug messages |
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
+840
to
+844
| interface ObjectContentGetResponse { | ||
| success: boolean; | ||
| prim_id: string; | ||
| item_id: string; | ||
| content: string; // Raw text content (UTF-8). Notecard envelope is unwrapped automatically. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Work in progress,
Handles new launch method from viewer and supports "prim publishing" by viewer.
Presents prims as files directories on the explorer pane. Allows read, write and limited script creation.
See Message_Interface.md for description of JSON-RPC protocol with viewer.
Viewer side PR:
secondlife/viewer#5834