Elffuss BraidHub

kikocis/continue public

fix: lint, etc
Changesetc31e5ac0d178d1f8d2ba852ca90cb6e3d5423e57e14a8fb9e4e5063b3183399c
AuthorNate <sestinj@gmail.com> · 2025-08-27 22:16 -07:00
CommitterNate <sestinj@gmail.com> · 2025-08-27 22:16 -07:00
Parentsd17cfe476040

Browse the files at this changeset

3 files changed

modified core/util/history.test.ts +4 −2
@@ -93,8 +93,9 @@
9393 const offset = 10;
9494
9595 const sessions = historyManager.list({ offset: offset, limit: limit });
96+ // Sessions are now reversed, so newest (99) comes first
9697 const sessionIds = Array.from({ length: limit }, (_, i) =>
97- (i + offset).toString(),
98+ (99 - offset - i).toString(),
9899 );
99100 const isSessionIdInList = (sessionId: string) =>
100101 sessions.some((session) => session.sessionId === sessionId);
@@ -105,7 +106,8 @@
105106 const limit = 25;
106107
107108 const sessions = historyManager.list({ limit: limit });
108- const sessionIds = Array.from({ length: limit }, (_, i) => i.toString());
109+ // Sessions are now reversed, so newest (99) comes first
110+ const sessionIds = Array.from({ length: limit }, (_, i) => (99 - i).toString());
109111
110112 const isSessionIdInList = (sessionId: string) =>
111113 sessions.some((session) => session.sessionId === sessionId);
modified core/util/messageConversion.ts +7 −4
@@ -222,10 +222,13 @@
222222 if (!toolCall) return;
223223
224224 // Add tool result as context to the previous assistant message
225- const lastAssistantIndex = historyItems.findLastIndex(
226- (item) => item.message.role === "assistant",
227- );
228-
225+ let lastAssistantIndex = -1;
226+ for (let i = historyItems.length - 1; i >= 0; i--) {
227+ if (historyItems[i].message.role === "assistant") {
228+ lastAssistantIndex = i;
229+ break;
230+ }
231+ }
229232 if (lastAssistantIndex < 0) return;
230233 if (!historyItems[lastAssistantIndex].toolCallStates) return;
231234
modified extensions/cli/src/session.ts +6 −5
@@ -33,7 +33,8 @@
3333 }
3434
3535 // Use CONTINUE_GLOBAL_DIR if set (for testing)
36- const continueHome = process.env.CONTINUE_GLOBAL_DIR || path.join(os.homedir(), ".continue");
36+ const continueHome =
37+ process.env.CONTINUE_GLOBAL_DIR || path.join(os.homedir(), ".continue");
3738 const sessionDir = path.join(continueHome, "sessions");
3839
3940 // Create directory if it doesn't exist
@@ -70,10 +71,10 @@
7071 getCurrentSession(): Session {
7172 if (!this.currentSession) {
7273 // Use test session ID for testing consistency
73- const sessionId = process.env.CONTINUE_CLI_TEST_SESSION_ID ?
74- process.env.CONTINUE_CLI_TEST_SESSION_ID :
75- uuidv4();
76-
74+ const sessionId = process.env.CONTINUE_CLI_TEST_SESSION_ID
75+ ? process.env.CONTINUE_CLI_TEST_SESSION_ID
76+ : uuidv4();
77+
7778 this.currentSession = {
7879 sessionId,
7980 title: DEFAULT_SESSION_TITLE,