feat: implement trajectory discovery and resumption logic (Stage 2)

This commit is contained in:
Aishanee Shah
2026-05-14 18:12:05 +00:00
parent d0b05a8f2a
commit 431155cf41
5 changed files with 67 additions and 17 deletions
+4 -2
View File
@@ -183,9 +183,9 @@ const resumeCheckpointCommand: SlashCommand = {
const config = context.services.agentContext?.config;
await logger.initialize();
const checkpoint = await logger.loadCheckpoint(tag);
const conversation = checkpoint.history;
const conversation = checkpoint.history ?? [];
if (conversation.length === 0) {
if (conversation.length === 0 && !checkpoint.messages) {
return {
type: 'message',
messageType: 'info',
@@ -233,6 +233,8 @@ const resumeCheckpointCommand: SlashCommand = {
type: 'load_history',
history: uiHistory,
clientHistory: conversation,
messages: checkpoint.messages,
version: checkpoint.version,
};
},
completion: async (context, partialArg) => {
@@ -549,7 +549,16 @@ export const useSlashCommandProcessor = (
}
}
case 'load_history': {
config?.getGeminiClient()?.setHistory(result.clientHistory);
const client = config?.getGeminiClient();
if (result.version === '2.0' && client) {
await client.resumeChat(
[...result.clientHistory],
undefined,
result.messages,
);
} else {
client?.setHistory(result.clientHistory);
}
fullCommandContext.ui.clear();
result.history.forEach((item, index) => {
fullCommandContext.ui.addItem(item, index);