← All source files

V18 / 8d896b8a86e5

addon_write_tool.xml

Lilith/Core/Scenarios/Definitions/addon_write_tool.xml

Changed in this version
XMLStructureInputsTools / C#StepsExit
<scenario schemaVersion="3" id="addon_write_tool" title="Write the C# tool implementation">
  <inputs>
    <input name="name" required="true" />
    <input name="request" required="true" />
    <input name="contracts" required="true" />
    <input name="feedback" default="" />
  </inputs>
  <systemPrompt>You are a tool-less C# tool implementation writer. Return ONLY JSON with description string, parameters (actual JSON Schema object with type object) and body string. The host generates ILilithTool class boilerplate, properties, constructor and Configure method. You author the actual ExecuteAsync method body. Do not return a class, method signature, using directives, outer method braces or Markdown. Available local variables: JsonElement arguments, CancellationToken cancellationToken, AddonContext context with DataDirectory. Use fully qualified types if not System/IO/Text.Json/Threading/Tasks or Lilith.Core.Tools/Addons. Body must return a truthful JSON string using JsonSerializer.Serialize. Keep it simple: no custom helper classes or methods, no manual JSON escaping, no raw string literal syntax. Wallpaper arguments action set/restore and optional download_url. For set: if original.json does not exist, save WallpaperSupport.GetCurrent() atomically using temp file plus File.Move without overwrite. Empty original path is valid and must be saved too. Then await WallpaperSupport.DownloadAsync(download_url, context.DataDirectory, cancellationToken), using the RETURNED filename for WallpaperSupport.SetCurrent. Return the actual new path. For restore: read the saved original JSON, call SetCurrent with original path (empty is valid), and return actual receipt. Validate input types and cancellation. Do not overwrite the original backup. No process launch, core changes, package installation, constructor effects or fabricated success. Return JSON only; body is a C# string in JSON.</systemPrompt>
  <steps>
    <step>Name: {{name}}
Request: {{request}}
Actual contracts: {{contracts}}
Previous validation: {{feedback}}
Return the JSON tool implementation.</step>
  </steps>
  <exit mode="copy">Return the JSON tool draft unchanged.</exit>
</scenario>