Ship Assistent disk persist, park LLM, and memory UI cleanup.

Split the extension into partials, persist chats on the data volume, park/warm the chat model around Generate, and drop dual raw/persona dump paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-22 01:03:40 +03:00
co-authored by Cursor
parent 880e2dbea2
commit 8702b64e12
12 changed files with 1192 additions and 114 deletions
+16 -19
View File
@@ -37,7 +37,7 @@ public partial class SwarmAssistentExtension : Extension
ExtensionAuthor = "mrleo1nid";
Description = "Collaborative Krea 2 assistant: Ollama chat, persona presets, vector memory, model cards, Generate loop.";
License = "MIT";
Version = "0.8.1";
Version = "0.8.3";
Tags = ["tabs", "ui", "llm", "ollama", "krea", "inpaint", "memory"];
}
@@ -73,8 +73,11 @@ public partial class SwarmAssistentExtension : Extension
API.RegisterAPICall(AssistentListMemory, false, PermUse);
API.RegisterAPICall(AssistentUpsertMemory, true, PermUse);
API.RegisterAPICall(AssistentForgetMemory, true, PermUse);
API.RegisterAPICall(AssistentSearchMemory, false, PermUse);
API.RegisterAPICall(AssistentGetMemory, false, PermUse);
API.RegisterAPICall(AssistentLookupTags, false, PermUse);
API.RegisterAPICall(AssistentListWanted, false, PermUse);
Logs.Init("Swarm Assistent extension loaded (disk chats + park LLM + memory UI)");
Logs.Init("Swarm Assistent extension loaded (sqlite chats/kv + park LLM + memory UI)");
}
int CfgInt(string key, int fallback)
@@ -138,10 +141,6 @@ public partial class SwarmAssistentExtension : Extension
return Environment.CurrentDirectory;
}
string PersonasOverlayJsonPath() => Path.Combine(DataRoot(), "Assistent", "personas.json");
string TasteJsonPath() => Path.Combine(DataRoot(), "Assistent", "taste.json");
public string ReadPackFile(string name)
{
return Config?.LoadPackPrompt(Config.DefaultPersonaId(), name);
@@ -229,19 +228,13 @@ public partial class SwarmAssistentExtension : Extension
public async Task<JObject> AssistentGetTaste(Session session)
{
await Task.CompletedTask;
string path = TasteJsonPath();
if (!File.Exists(path))
{
return new JObject { ["success"] = true, ["taste"] = null };
}
try
{
JObject taste = JObject.Parse(File.ReadAllText(path, Encoding.UTF8));
return new JObject { ["success"] = true, ["taste"] = taste };
return new JObject { ["success"] = true, ["taste"] = Memory.GetKvObject(AssistentMemory.KvTaste) };
}
catch (Exception ex)
{
return new JObject { ["error"] = $"taste.json: {ex.Message}" };
return new JObject { ["error"] = $"taste: {ex.Message}" };
}
}
@@ -256,10 +249,14 @@ public partial class SwarmAssistentExtension : Extension
{
taste["updated"] = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
}
string dir = Path.Combine(DataRoot(), "Assistent");
Directory.CreateDirectory(dir);
string path = TasteJsonPath();
File.WriteAllText(path, taste.ToString(Newtonsoft.Json.Formatting.Indented), Encoding.UTF8);
return new JObject { ["success"] = true, ["path"] = path };
try
{
Memory.SetKvObject(AssistentMemory.KvTaste, taste);
return new JObject { ["success"] = true, ["path"] = "Assistent/memory/assistent.sqlite" };
}
catch (Exception ex)
{
return new JObject { ["error"] = $"taste save: {ex.Message}" };
}
}
}