fix: unify exec approval ids

This commit is contained in:
Peter Steinberger
2026-01-22 00:49:02 +00:00
parent 4997a5b93f
commit 7e1a17e5e6
14 changed files with 966 additions and 416 deletions

View File

@@ -33,11 +33,15 @@ type PendingEntry = {
export class ExecApprovalManager {
private pending = new Map<string, PendingEntry>();
create(request: ExecApprovalRequestPayload, timeoutMs: number): ExecApprovalRecord {
create(
request: ExecApprovalRequestPayload,
timeoutMs: number,
id?: string | null,
): ExecApprovalRecord {
const now = Date.now();
const id = randomUUID();
const resolvedId = id && id.trim().length > 0 ? id.trim() : randomUUID();
const record: ExecApprovalRecord = {
id,
id: resolvedId,
request,
createdAtMs: now,
expiresAtMs: now + timeoutMs,