Add support for LUA scripts - #3
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds multi-runtime script creation/upload support (including Lua/Luau) to inventory/task inventory flows, and tightens capability POST error handling so failures surface as exceptions instead of being parsed as normal LLSD responses.
Changes:
- Added
CreateTaskInventoryItemcapability support and aCreateTaskInventoryItemMessagefor creating task-inventory scripts with selectable runtimes/languages. - Extended
InventoryItemmetadata parsing to capture script VM runtime (runtime) when present in task inventory responses. - Refactored script update APIs to use a
ScriptTargetenum (instead of a mono boolean) and improved capability POST error handling.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| Programs/examples/TestClient/Commands/Inventory/UploadScriptCommand.cs | Updates example client script upload call to use ScriptTarget.Mono. |
| LibreMetaverse/Messages/LindenMessages.cs | Adds CreateTaskInventoryItemMessage for capability POST payloads. |
| LibreMetaverse/Inventory/InventoryManager.Handlers.cs | Adds HTTP status checking to capability POST helper. |
| LibreMetaverse/Inventory/InventoryManager.Async.cs | Introduces task script creation API and ScriptTarget / ScriptLanguage enums; updates script upload APIs. |
| LibreMetaverse/Inventory/InventoryBase.cs | Adds Runtime property and populates it from task inventory metadata when available. |
| LibreMetaverse/Caps.cs | Registers the new CreateTaskInventoryItem capability name. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+47
to
+50
| if (result.response.StatusCode != System.Net.HttpStatusCode.OK) | ||
| { | ||
| throw new System.Net.Http.HttpRequestException($"{result.response.StatusCode}({(int)result.response.StatusCode}): {System.Text.Encoding.UTF8.GetString(responseData)}"); | ||
| } |
Comment on lines
364
to
+365
| public async Task<(bool uploadSuccess, string uploadStatus, bool compileSuccess, List<string>? compileMessages, UUID itemID, UUID assetID)> RequestUpdateScriptAgentInventoryAsync( | ||
| byte[] data, UUID itemID, bool mono, CancellationToken cancellationToken = default, IProgress<ProgressReport>? progress = null) | ||
| byte[] data, UUID itemID, ScriptTarget target = ScriptTarget.Mono, CancellationToken cancellationToken = default, IProgress<ProgressReport>? progress = null) |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
This pull request introduces support for creating and managing scripts with multiple runtimes (such as "lsl2", "mono", and "luau") in task inventory, along with improved error handling for capability POST requests. The main changes add a new capability for creating task inventory scripts, extend inventory item metadata to include script runtime, and refactor script upload/update methods to use explicit script runtime targets.
Script runtime and inventory enhancements:
RequestCreateTaskScriptAsyncmethod inInventoryManager.Async.csto create scripts in an object's inventory, supporting multiple runtimes and script languages. This includes the newCreateTaskInventoryItemMessagemessage class and associated enums for script language and target. [1] [2] [3]InventoryItemclass to include aRuntimeproperty, which is populated from inventory metadata (if present) when deserializing from OSD. [1] [2] [3]Capability and API changes:
"CreateTaskInventoryItem"capability inCaps.cs.RequestUpdateScriptAgentInventoryAsync,RequestUpdateScriptTaskAsync) to use the newScriptTargetenum instead of a boolean, allowing explicit selection of script runtime. This also affects usage in theUploadScriptCommand. [1] [2] [3]Error handling improvements: