fix: preserve editable pattern graphs

Add mode-aware graph mutation helpers for pattern topology so backend
code can add and remove agents without forcing a full graph rebuild.
Also preserve an existing pattern graph in savePattern instead of
re-syncing it from defaults, and cover the new behavior with shared
and main-process tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-03-27 21:50:01 +01:00
co-authored by Copilot
parent b5ab92e444
commit bb7e5d4108
4 changed files with 596 additions and 1 deletions
+1 -1
View File
@@ -345,7 +345,7 @@ export class AryxAppService extends EventEmitter<AppServiceEvents> {
async savePattern(pattern: PatternDefinition): Promise<WorkspaceState> {
const workspace = await this.loadWorkspace();
const knownApprovalToolNames = await this.listKnownApprovalToolNames(workspace);
const synchronizedPattern = syncPatternGraph(pattern);
const synchronizedPattern = pattern.graph ? pattern : syncPatternGraph(pattern);
const issues = validatePatternDefinition(
synchronizedPattern,
knownApprovalToolNames,