feat: gate slash commands and add compact

This commit is contained in:
Peter Steinberger
2026-01-06 02:06:06 +01:00
parent 085c70a87b
commit b56338171b
16 changed files with 566 additions and 59 deletions

View File

@@ -56,6 +56,8 @@ const formatAge = (ms?: number | null) => {
const formatKTokens = (value: number) =>
`${(value / 1000).toFixed(value >= 10_000 ? 0 : 1)}k`;
export const formatTokenCount = (value: number) => formatKTokens(value);
const formatTokens = (
total: number | null | undefined,
contextTokens: number | null,
@@ -71,6 +73,11 @@ const formatTokens = (
return `${totalLabel}/${ctxLabel}${pct !== null ? ` (${pct}%)` : ""}`;
};
export const formatContextUsageShort = (
total: number | null | undefined,
contextTokens: number | null | undefined,
) => `Context ${formatTokens(total, contextTokens ?? null)}`;
const readUsageFromSessionLog = (
sessionId?: string,
):
@@ -262,7 +269,7 @@ export function buildStatusMessage(args: StatusArgs): string {
export function buildHelpMessage(): string {
return [
" Help",
"Shortcuts: /new reset | /restart relink",
"Shortcuts: /new reset | /compact [instructions] | /restart relink",
"Options: /think <level> | /verbose on|off | /elevated on|off | /model <id>",
].join("\n");
}