refactor: make baseTimestamp optional in addItem and remove redundant calls (#16471)

This commit is contained in:
Sehoon Shon
2026-01-13 14:15:04 -05:00
committed by GitHub
parent aa52462550
commit 91fcca3b1c
30 changed files with 528 additions and 888 deletions
+11 -20
View File
@@ -17,13 +17,10 @@ async function defaultSessionView(context: CommandContext) {
const now = new Date();
const { sessionStartTime } = context.session.stats;
if (!sessionStartTime) {
context.ui.addItem(
{
type: MessageType.ERROR,
text: 'Session start time is unavailable, cannot calculate stats.',
},
Date.now(),
);
context.ui.addItem({
type: MessageType.ERROR,
text: 'Session start time is unavailable, cannot calculate stats.',
});
return;
}
const wallDuration = now.getTime() - sessionStartTime.getTime();
@@ -40,7 +37,7 @@ async function defaultSessionView(context: CommandContext) {
}
}
context.ui.addItem(statsItem, Date.now());
context.ui.addItem(statsItem);
}
export const statsCommand: SlashCommand = {
@@ -68,12 +65,9 @@ export const statsCommand: SlashCommand = {
kind: CommandKind.BUILT_IN,
autoExecute: true,
action: (context: CommandContext) => {
context.ui.addItem(
{
type: MessageType.MODEL_STATS,
},
Date.now(),
);
context.ui.addItem({
type: MessageType.MODEL_STATS,
});
},
},
{
@@ -82,12 +76,9 @@ export const statsCommand: SlashCommand = {
kind: CommandKind.BUILT_IN,
autoExecute: true,
action: (context: CommandContext) => {
context.ui.addItem(
{
type: MessageType.TOOL_STATS,
},
Date.now(),
);
context.ui.addItem({
type: MessageType.TOOL_STATS,
});
},
},
],