Skip to content

[WIP] Prim publishing#69

Draft
Rider-Linden wants to merge 2 commits into
developfrom
rider/poc/object_publish
Draft

[WIP] Prim publishing#69
Rider-Linden wants to merge 2 commits into
developfrom
rider/poc/object_publish

Conversation

@Rider-Linden
Copy link
Copy Markdown
Collaborator

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

…them as virtual file systems, so that they appear as folders in the explorer tab. Not yet in a stable state.
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

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 + ObjectContentProvider to model published objects and implement a VS Code FileSystemProvider for sl://objects.
  • Extends WebSocket/JSON-RPC client and SynchService to handle object.publish / object.unpublish / object.update notifications 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

  • connectToViewer returns a Promise but is called without await/void and without error handling. If setupConnection throws (e.g., unexpected failure paths), this can surface as an unhandled promise rejection. Consider void synchService.connectToViewer(...).catch(err => showErrorMessage(...)), or make handleUri async 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.vm is documented here as "luau" | "lsl", but the code/interface uses ScriptVM = "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 thread src/extension.ts
Comment on lines +92 to +93
// Decode the query string first - some viewers incorrectly encode the delimiters
const decodedQuery = decodeURIComponent(uri.query);
Comment thread src/utils.ts
Comment on lines +43 to +44
// TODO: Check a debug setting to conditionally log
// For now, always log debug messages
Comment thread doc/Message_Interfaces.md
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 thread doc/Message_Interfaces.md
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.
@Rider-Linden Rider-Linden marked this pull request as draft May 19, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants