feat: add durable AgentOS slice execution
This commit is contained in:
@@ -771,13 +771,41 @@ export const listForProject = query({
|
||||
.eq("designVersion", work.designVersion ?? 0)
|
||||
)
|
||||
.collect();
|
||||
const runs = await ctx.db
|
||||
const runRows = await ctx.db
|
||||
.query("workRuns")
|
||||
.withIndex("by_work_and_createdAt", (q: any) =>
|
||||
q.eq("workId", work._id)
|
||||
)
|
||||
.order("desc")
|
||||
.take(10);
|
||||
const runs = await Promise.all(
|
||||
runRows.map(async (run) => {
|
||||
const attempts = await ctx.db
|
||||
.query("workAttempts")
|
||||
.withIndex("by_runId_and_number", (q) => q.eq("runId", run._id))
|
||||
.collect();
|
||||
const eventsByAttempt = await Promise.all(
|
||||
attempts.map((attempt) =>
|
||||
ctx.db
|
||||
.query("workAttemptEvents")
|
||||
.withIndex("by_attempt_and_sequence", (q: any) =>
|
||||
q.eq("attemptId", attempt._id)
|
||||
)
|
||||
.collect()
|
||||
)
|
||||
);
|
||||
const attemptEvents = eventsByAttempt
|
||||
.flat()
|
||||
.sort((left, right) => left.occurredAt - right.occurredAt);
|
||||
const artifacts = await ctx.db
|
||||
.query("workArtifacts")
|
||||
.withIndex("by_runId_and_createdAt", (q) =>
|
||||
q.eq("runId", run._id)
|
||||
)
|
||||
.collect();
|
||||
return { ...run, artifacts, attemptEvents, attempts };
|
||||
})
|
||||
);
|
||||
const events = await ctx.db
|
||||
.query("workEvents")
|
||||
.withIndex("by_work_and_createdAt", (q: any) =>
|
||||
|
||||
Reference in New Issue
Block a user