feat(FN-3548): add agent action routes and approval pause/resume lifecycle

Merges the FN-3548 approval pause/resume system: agents now stall at workflow gates pending approval, with a full lifecycle spanning gate context lookup, action-gate pause/retry, executor and heartbeat pause callbacks, and dedicated approval decision routes. Also lands FN-3744 agent action routes an

Fusion-Task-Id: FN-3548
This commit is contained in:
Fusion
2026-05-08 20:19:15 -07:00
committed by gsxdsm
parent 58576c882e
commit 6ee85daa47
17 changed files with 833 additions and 69 deletions

View File

@@ -221,6 +221,31 @@ export class ApprovalRequestStore {
return rows.map((row) => this.rowToRequest(row));
}
findLatestByDedupeKey(input: { requesterActorId: string; taskId?: string; dedupeKey: string }): ApprovalRequest | null {
const where = ["requesterActorId = ?"];
const params: Array<string> = [input.requesterActorId];
if (input.taskId !== undefined) {
where.push("taskId = ?");
params.push(input.taskId);
}
const rows = this.db.prepare(`
SELECT * FROM approval_requests
WHERE ${where.join(" AND ")}
ORDER BY createdAt DESC, id DESC
`).all(...params) as ApprovalRequestRow[];
for (const row of rows) {
const context = fromJson<Record<string, unknown>>(row.targetContext);
if (context?.approvalDedupeKey === input.dedupeKey) {
return this.rowToRequest(row);
}
}
return null;
}
decide(requestId: string, status: "approved" | "denied", input: ApprovalRequestDecisionInput): ApprovalRequest {
const existing = this.get(requestId);
if (!existing) {