feat(loop): add worker/verifier model selection and archive support

Loop runs can now specify separate provider/model for worker and verifier
agents (--provider, --model, --verify-provider, --verify-model). The
--archive flag preserves agent conversation history after each iteration
instead of destroying them.
This commit is contained in:
Mohamed Boudra
2026-03-28 01:10:05 +07:00
parent a2ab0af3f1
commit 657b3e1ccd
8 changed files with 259 additions and 19 deletions
@@ -860,6 +860,39 @@ export class AgentManager {
this.logger.trace({ agentId }, "closeAgent: completed");
}
async archiveAgent(agentId: string): Promise<{ archivedAt: string }> {
const agent = this.requireAgent(agentId);
if (!this.registry) {
throw new Error("Agent storage is not configured");
}
await this.registry.applySnapshot(agent, {
internal: agent.internal,
});
const stored = await this.registry.get(agentId);
if (!stored) {
throw new Error(`Agent ${agentId} not found in storage after snapshot`);
}
const archivedAt = new Date().toISOString();
const normalizedStatus =
stored.lastStatus === "running" || stored.lastStatus === "initializing"
? "idle"
: stored.lastStatus;
await this.registry.upsert({
...stored,
archivedAt,
lastStatus: normalizedStatus,
requiresAttention: false,
attentionReason: null,
attentionTimestamp: null,
});
await this.closeAgent(agentId);
return { archivedAt };
}
async setAgentMode(agentId: string, modeId: string): Promise<void> {
const agent = this.requireAgent(agentId);
await agent.session.setMode(modeId);