Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
import type { ConversationSection } from "../agentGuiNodeViewConversation";
|
|
import {
|
|
partitionConversationRailUserProjects,
|
|
type ConversationRailLabels
|
|
} from "./agentGuiConversationRail";
|
|
import type { AgentGUINodeViewModel } from "./agentGuiNodeTypes";
|
|
|
|
export function preserveConversationRailSectionTemplates(input: {
|
|
labels: ConversationRailLabels;
|
|
sections: readonly ConversationSection[];
|
|
userProjects: AgentGUINodeViewModel["rail"]["userProjects"];
|
|
}): ConversationSection[] {
|
|
const existingById = new Map(
|
|
input.sections.map((section) => [section.id, section] as const)
|
|
);
|
|
const result: ConversationSection[] = [];
|
|
const pinned = existingById.get("pinned");
|
|
if (pinned && pinned.items.length > 0) {
|
|
result.push(pinned);
|
|
}
|
|
existingById.delete("pinned");
|
|
|
|
const projectSectionKeys = new Set<string>();
|
|
for (const project of partitionConversationRailUserProjects(
|
|
input.userProjects
|
|
)) {
|
|
const sectionKey = project.sectionKey?.trim() ?? "";
|
|
if (!sectionKey || projectSectionKeys.has(sectionKey)) continue;
|
|
projectSectionKeys.add(sectionKey);
|
|
const existing = existingById.get(sectionKey);
|
|
result.push({
|
|
id: sectionKey,
|
|
kind: "project",
|
|
label: project.label,
|
|
project,
|
|
items: existing?.items ?? []
|
|
});
|
|
existingById.delete(sectionKey);
|
|
}
|
|
|
|
const conversations = existingById.get("conversations");
|
|
result.push(
|
|
conversations ?? {
|
|
id: "conversations",
|
|
kind: "conversations",
|
|
label: input.labels.sectionConversations,
|
|
project: null,
|
|
items: []
|
|
}
|
|
);
|
|
return result;
|
|
}
|