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:
Mario Zechner 2025-12-27 19:57:14 +01:00
parent 77fe3f1a13
commit a2515cf43f
6 changed files with 22 additions and 28 deletions

View file

@ -60,6 +60,7 @@ export class ProviderTransport implements AgentTransport {
// Resolve API key per assistant response (important for expiring OAuth tokens)
getApiKey: this.options.getApiKey,
getQueuedMessages: cfg.getQueuedMessages,
preprocessor: cfg.preprocessor,
};
}