fix: lint, etc

This commit is contained in:
Nate 2025-08-27 22:16:05 -07:00
parent 71403237f3
commit fcaa80f445
3 changed files with 17 additions and 11 deletions

View file

@ -93,8 +93,9 @@ describe("Many sessions created", () => {
const offset = 10;
const sessions = historyManager.list({ offset: offset, limit: limit });
// Sessions are now reversed, so newest (99) comes first
const sessionIds = Array.from({ length: limit }, (_, i) =>
(i + offset).toString(),
(99 - offset - i).toString(),
);
const isSessionIdInList = (sessionId: string) =>
sessions.some((session) => session.sessionId === sessionId);
@ -105,7 +106,8 @@ describe("Many sessions created", () => {
const limit = 25;
const sessions = historyManager.list({ limit: limit });
const sessionIds = Array.from({ length: limit }, (_, i) => i.toString());
// Sessions are now reversed, so newest (99) comes first
const sessionIds = Array.from({ length: limit }, (_, i) => (99 - i).toString());
const isSessionIdInList = (sessionId: string) =>
sessions.some((session) => session.sessionId === sessionId);

View file

@ -222,10 +222,13 @@ function handleToolResult(
if (!toolCall) return;
// Add tool result as context to the previous assistant message
const lastAssistantIndex = historyItems.findLastIndex(
(item) => item.message.role === "assistant",
);
let lastAssistantIndex = -1;
for (let i = historyItems.length - 1; i >= 0; i--) {
if (historyItems[i].message.role === "assistant") {
lastAssistantIndex = i;
break;
}
}
if (lastAssistantIndex < 0) return;
if (!historyItems[lastAssistantIndex].toolCallStates) return;

View file

@ -33,7 +33,8 @@ function getSessionDir(): string {
}
// Use CONTINUE_GLOBAL_DIR if set (for testing)
const continueHome = process.env.CONTINUE_GLOBAL_DIR || path.join(os.homedir(), ".continue");
const continueHome =
process.env.CONTINUE_GLOBAL_DIR || path.join(os.homedir(), ".continue");
const sessionDir = path.join(continueHome, "sessions");
// Create directory if it doesn't exist
@ -70,10 +71,10 @@ class SessionManager {
getCurrentSession(): Session {
if (!this.currentSession) {
// Use test session ID for testing consistency
const sessionId = process.env.CONTINUE_CLI_TEST_SESSION_ID ?
process.env.CONTINUE_CLI_TEST_SESSION_ID :
uuidv4();
const sessionId = process.env.CONTINUE_CLI_TEST_SESSION_ID
? process.env.CONTINUE_CLI_TEST_SESSION_ID
: uuidv4();
this.currentSession = {
sessionId,
title: DEFAULT_SESSION_TITLE,