( ctx: ExecutionContext, config: PiMemoryConfig, task: string, finalText: string )
| 101 | |
| 102 | /** Persists the user task and the agent's final message to memory. */ |
| 103 | export async function appendPiMemory( |
| 104 | ctx: ExecutionContext, |
| 105 | config: PiMemoryConfig, |
| 106 | task: string, |
| 107 | finalText: string |
| 108 | ): Promise<void> { |
| 109 | if (!isMemoryEnabled(config)) return |
| 110 | try { |
| 111 | await memoryService.appendToMemory(ctx, config, { role: 'user', content: task }) |
| 112 | if (finalText) { |
| 113 | await memoryService.appendToMemory(ctx, config, { role: 'assistant', content: finalText }) |
| 114 | } |
| 115 | } catch (error) { |
| 116 | logger.warn('Failed to append Pi memory', { error: getErrorMessage(error) }) |
| 117 | } |
| 118 | } |
no test coverage detected