Wire context event to preprocessor for per-LLM-call execution
- Change from contextTransform (runs once at agent start) to preprocessor - preprocessor runs before EACH LLM call inside the agent loop - ContextEvent now uses Message[] (pi-ai format) instead of AppMessage[] - Deep copy handled by pi-ai preprocessor, not Agent This enables: - Pruning rules applied on every turn (not just agent start) - /prune during long agent loop takes effect immediately - Compaction can use same transforms (future work)
This commit is contained in:
@@ -589,7 +589,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
||||
tools: allToolsArray,
|
||||
},
|
||||
messageTransformer,
|
||||
contextTransform: hookRunner
|
||||
preprocessor: hookRunner
|
||||
? async (messages) => {
|
||||
return hookRunner.emitContext(messages);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user