fix: update isolated blocks in conversation context for Skill tool (#622)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2026-01-21 17:45:41 -08:00
committed by GitHub
parent 2c82bd880a
commit ce89e962c7
4 changed files with 179 additions and 17 deletions

View File

@@ -7,6 +7,7 @@ interface AgentContext {
agentId: string | null;
skillsDirectory: string | null;
hasLoadedSkills: boolean;
conversationId: string | null;
}
// Use globalThis to ensure singleton across bundle
@@ -24,6 +25,7 @@ function getContext(): AgentContext {
agentId: null,
skillsDirectory: null,
hasLoadedSkills: false,
conversationId: null,
};
}
return global[CONTEXT_KEY];
@@ -86,6 +88,22 @@ export function setHasLoadedSkills(loaded: boolean): void {
context.hasLoadedSkills = loaded;
}
/**
* Set the current conversation ID
* @param conversationId - The conversation ID, or null to clear
*/
export function setConversationId(conversationId: string | null): void {
context.conversationId = conversationId;
}
/**
* Get the current conversation ID
* @returns The conversation ID or null if not set
*/
export function getConversationId(): string | null {
return context.conversationId;
}
/**
* Initialize the loaded skills flag by checking the block
* Should be called after setAgentContext to sync the cached state