@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
33 lines • 1.27 kB
JavaScript
/**
* A {@link RunSampleSource} over a fixed list of runs — the regression-set / fixture source. Also
* what a test uses instead of standing up a store.
*/
export class StaticRunSampleSource {
runs;
constructor(runs) {
this.runs = runs;
}
async listRuns(query) {
return this.runs
.filter((run) => {
if (query.agentName !== undefined && run.agentName !== query.agentName)
return false;
if (query.status !== undefined && run.status !== query.status)
return false;
if (query.actorRef !== undefined && run.actorRef !== query.actorRef)
return false;
const day = run.startedAt.slice(0, 10);
if (query.fromDay !== undefined && day < query.fromDay)
return false;
if (query.toDay !== undefined && day > query.toDay)
return false;
return true;
})
.sort((left, right) => right.startedAt.localeCompare(left.startedAt) || right.runId.localeCompare(left.runId))
.slice(0, query.limit);
}
async getRun(runId) {
return this.runs.find((run) => run.runId === runId) ?? null;
}
}
//# sourceMappingURL=sample-source.js.map