evOo-local/packages/core/src/composer-slash.ts
cynarAI 6c7eed7580 Initial clean evOo-local from f00577b
Fresh history cut from cynarAI/evoo antigravity-handoff/project-timeline
(Voice First + project timeline). Brand docs/titles as evOo; keep @rakazo/*
packages as tech debt. Excludes node_modules, caches, secrets, voice blobs.
2026-09-20 17:15:16 +02:00

27 lines
1.1 KiB
TypeScript

export const SLASH_ACTIONS = [
{ id: "chat-settings" as const, label: "Chat Settings" },
{ id: "settings-general" as const, label: "Settings: General" },
{ id: "settings-usage" as const, label: "Settings: Usage" },
] as const;
export type SlashActionId = (typeof SLASH_ACTIONS)[number]["id"];
/** Serialize composer chips + draft into the prompt text sent to the agent. */
export function serializeComposerPrompt(
draft: string,
skill: { name: string } | null,
mentions: Array<{ name: string }>,
): string {
const body = draft.replace(/^\s+/, "");
const mentionPrefix = mentions.map((member) => `@${member.name}`).join(" ");
const afterSkill = [mentionPrefix, body].filter((part) => part.trim().length > 0).join(" ");
if (!skill) return afterSkill.trimEnd();
return afterSkill.trim().length > 0 ? `/${skill.name}\n${afterSkill}` : `/${skill.name}`;
}
export function truncateSlashDescription(value: string, max = 72): string {
const text = value.replace(/\s+/g, " ").trim();
if (text.length <= max) return text;
return `${text.slice(0, max - 1).trimEnd()}…`;
}