Ship Assistent 0.11.9: esbuild bundle and patch-keys manifest.

Replace split Assets JS with a built bundle and aligned C#/config so SwarmUI loads one script and patch apply stays consistent; drop legacy terse persona and memory seed.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-22 13:58:11 +03:00
co-authored by Cursor
parent a5e96f7430
commit e8bb012885
42 changed files with 10652 additions and 1281 deletions
+26 -27
View File
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Newtonsoft.Json.Linq;
@@ -9,20 +10,9 @@ public partial class SwarmAssistentExtension
{
static readonly Regex JsonFenceRe = new(@"```(?:json)?\s*([\s\S]*?)```", RegexOptions.IgnoreCase | RegexOptions.Compiled);
static readonly string[] PatchKeys =
[
"prompt", "negative", "loras", "width", "height", "steps", "cfg", "seed", "sigma_shift", "sampler",
"actions", "search_query", "civitai_query",
"use_init_image", "clear_init_image", "init_creativity", "denoise",
"use_mask_image", "clear_mask_image", "mask_blur", "mask_grow",
"look_at", "vision_from", "vision_slots", "slot_to_init", "slot_to_mask",
"snapshot_generate", "select_slot", "aspect", "images", "batch", "vary", "lock_seed",
"creativity", "intensity", "complexity", "movement",
"clear_prompt_images", "slot_to_prompt_image", "pack", "memories", "memory",
"memory_query", "memory_kind", "tag_query", "user_prefs",
"inventory_query", "skills", "persona_shelves", "controls",
"variants",
];
static string[] PatchKeys => _patchKeys ??= Config?.LoadPatchKeys() ?? [];
static string[] _patchKeys;
static bool HasValue(JObject obj, string key)
{
@@ -84,6 +74,8 @@ public partial class SwarmAssistentExtension
{
return null;
}
JObject lastAny = null;
JObject lastTerminal = null;
foreach (Match match in JsonFenceRe.Matches(reply))
{
string raw = match.Groups[1].Value.Trim();
@@ -96,7 +88,12 @@ public partial class SwarmAssistentExtension
}
if (Array.Exists(PatchKeys, k => obj[k] is not null))
{
return NormalizePatch(obj);
JObject normalized = NormalizePatch(obj);
lastAny = normalized;
if (FenceIsTerminalPatch(obj))
{
lastTerminal = normalized;
}
}
}
catch
@@ -104,7 +101,7 @@ public partial class SwarmAssistentExtension
// not json
}
}
return null;
return lastTerminal ?? lastAny;
}
/// <summary>
@@ -264,43 +261,45 @@ public partial class SwarmAssistentExtension
return ActionsContain(patch, "lookup_tags") ? ExtractSearchQuery(patch) : null;
}
static string NextToolHop(JObject patch)
static string NextToolHop(JObject patch, HashSet<string> skip = null)
{
if (patch is null)
{
return null;
}
if (ActionsContain(patch, "memory_get"))
bool Skip(string tool) => skip is not null && skip.Contains(tool);
if (ActionsContain(patch, "memory_get") && !Skip("memory_get"))
{
return "memory_get";
}
if (ActionsContain(patch, "memory_search") || !string.IsNullOrWhiteSpace(patch["memory_query"]?.ToString()))
if ((ActionsContain(patch, "memory_search") || !string.IsNullOrWhiteSpace(patch["memory_query"]?.ToString()))
&& !Skip("memory_search"))
{
return "memory_search";
}
if (ActionsContain(patch, "lookup_tags") || !string.IsNullOrWhiteSpace(patch["tag_query"]?.ToString()))
if ((ActionsContain(patch, "lookup_tags") || !string.IsNullOrWhiteSpace(patch["tag_query"]?.ToString()))
&& !Skip("lookup_tags"))
{
return "lookup_tags";
}
if (ActionsContain(patch, "list_inventory") || !string.IsNullOrWhiteSpace(patch["inventory_query"]?.ToString()))
if ((ActionsContain(patch, "list_inventory") || !string.IsNullOrWhiteSpace(patch["inventory_query"]?.ToString()))
&& !Skip("list_inventory"))
{
return "list_inventory";
}
if (ActionsContain(patch, "skill_load"))
if (ActionsContain(patch, "skill_load") && !Skip("skill_load"))
{
return "skill_load";
}
if (ActionsContain(patch, "persona_read"))
if (ActionsContain(patch, "persona_read") && !Skip("persona_read"))
{
return "persona_read";
}
if (ActionsContain(patch, "search_civitai") || !string.IsNullOrWhiteSpace(ExtractSearchQuery(patch)))
if ((ActionsContain(patch, "search_civitai") || !string.IsNullOrWhiteSpace(ExtractSearchQuery(patch)))
&& !Skip("civitai"))
{
return "civitai";
}
return null;
}
static bool WantsCivitaiSearch(JObject patch)
=> ActionsContain(patch, "search_civitai") || !string.IsNullOrWhiteSpace(ExtractSearchQuery(patch));
}