feat: Recompile system prompt after memory subagents finish (#1310)
This commit is contained in:
@@ -247,6 +247,45 @@ export async function updateConversationLLMConfig(
|
||||
return client.conversations.update(conversationId, payload);
|
||||
}
|
||||
|
||||
export interface RecompileAgentSystemPromptOptions {
|
||||
dryRun?: boolean;
|
||||
updateTimestamp?: boolean;
|
||||
}
|
||||
|
||||
interface AgentSystemPromptRecompileClient {
|
||||
agents: {
|
||||
recompile: (
|
||||
agentId: string,
|
||||
params: {
|
||||
dry_run?: boolean;
|
||||
update_timestamp?: boolean;
|
||||
},
|
||||
) => Promise<string>;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Recompile an agent's system prompt after memory writes so server-side prompt
|
||||
* state picks up the latest memory content.
|
||||
*
|
||||
* @param agentId - The agent ID to recompile
|
||||
* @param options - Optional dry-run/timestamp controls
|
||||
* @param clientOverride - Optional injected client for tests
|
||||
* @returns The compiled system prompt returned by the API
|
||||
*/
|
||||
export async function recompileAgentSystemPrompt(
|
||||
agentId: string,
|
||||
options: RecompileAgentSystemPromptOptions = {},
|
||||
clientOverride?: AgentSystemPromptRecompileClient,
|
||||
): Promise<string> {
|
||||
const client = clientOverride ?? (await getClient());
|
||||
|
||||
return client.agents.recompile(agentId, {
|
||||
dry_run: options.dryRun,
|
||||
update_timestamp: options.updateTimestamp,
|
||||
});
|
||||
}
|
||||
|
||||
export interface SystemPromptUpdateResult {
|
||||
success: boolean;
|
||||
message: string;
|
||||
|
||||
Reference in New Issue
Block a user