Files
orca/tests/e2e/orchestration-run-pages.ts
T
64a1269409 perf(orchestration): bound mutation ledger and run pages (#11432)
* perf(orchestration): bound mutation ledger and run pages

Co-authored-by: Orca <help@stably.ai>

* fix(orchestration): close retention pagination gaps

* fix(orchestration): preserve unpaginated run listing

Co-authored-by: Orca <help@stably.ai>

* fix(orchestration): reject malformed run cursors

---------

Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
2026-07-30 00:49:23 -07:00

30 lines
820 B
TypeScript

import { ORCHESTRATION_RUN_PAGE_LIMIT } from '../../src/shared/orchestration-run-pagination'
export type OrchestrationRunSummary = {
id: string
objective: string
}
type RunListClient = {
call<TResult>(method: string, params?: unknown): Promise<{ result: TResult }>
}
export async function listAllOrchestrationRuns(
client: RunListClient
): Promise<OrchestrationRunSummary[]> {
const runs: OrchestrationRunSummary[] = []
let cursor: string | undefined
do {
const page = await client.call<{
runs: OrchestrationRunSummary[]
nextCursor?: string | null
}>('orchestration.runList', {
limit: ORCHESTRATION_RUN_PAGE_LIMIT,
...(cursor ? { cursor } : {})
})
runs.push(...page.result.runs)
cursor = page.result.nextCursor ?? undefined
} while (cursor)
return runs
}