import { randomUUID } from "node:crypto"; import type {
ExecApprovalDecision,
ExecApprovalRequestPayload as InfraExecApprovalRequestPayload,
} from "../infra/exec-approvals.js"; import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";
// Grace period to keep resolved entries for late awaitDecision calls const RESOLVED_ENTRY_GRACE_MS = 15_000;
export type ExecApprovalRequestPayload = InfraExecApprovalRequestPayload;
export type ExecApprovalRecord<TPayload = ExecApprovalRequestPayload> = {
id: string;
request: TPayload;
createdAtMs: number;
expiresAtMs: number; // Caller metadata (best-effort). Used to prevent other clients from replaying an approval id.
requestedByConnId?: string | null;
requestedByDeviceId?: string | null;
requestedByClientId?: string | null;
resolvedAtMs?: number;
decision?: ExecApprovalDecision;
resolvedBy?: string | null;
};
consumeAllowOnce(recordId: string): boolean { const entry = this.pending.get(recordId); if (!entry) { returnfalse;
} const record = entry.record; if (record.decision !== "allow-once") { returnfalse;
} // One-time approvals must be consumed atomically so the same runId // cannot be replayed during the resolved-entry grace window.
record.decision = undefined; returntrue;
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.23Bemerkung:
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.