mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
chore(lint): parallelize pending permission approvals
approvePendingPermissions now filters and records handled IDs in a sync pass, then awaits all allowPermission calls concurrently instead of looping awaits.
This commit is contained in:
@@ -120,13 +120,11 @@ async function approvePendingPermissions(
|
||||
): Promise<void> {
|
||||
const snapshot = await client.fetchAgent(agentId).catch(() => null);
|
||||
const pending = snapshot?.agent.pendingPermissions ?? [];
|
||||
for (const permission of pending) {
|
||||
if (handledPermissionIds.has(permission.id)) {
|
||||
continue;
|
||||
}
|
||||
const toApprove = pending.filter((permission) => !handledPermissionIds.has(permission.id));
|
||||
for (const permission of toApprove) {
|
||||
handledPermissionIds.add(permission.id);
|
||||
await allowPermission(client, agentId, permission);
|
||||
}
|
||||
await Promise.all(toApprove.map((permission) => allowPermission(client, agentId, permission)));
|
||||
}
|
||||
|
||||
async function waitForRunningBashToolCall(
|
||||
|
||||
Reference in New Issue
Block a user