listReservations
codebolt.mail.listReservations(params: IListReservationsParams): Promise<IListReservationsResponse>
Lists all active file reservations in the system.
Parameters
params(IListReservationsParams): Optional filters including agentId, threadId, and file paths.
Returns
Promise<IListReservationsResponse>: A promise that resolves with the list of active reservations.
Examples
Example 1: List All Reservations
import codebolt from '@codebolt/codeboltjs';
await codebolt.waitForReady();
const result = await codebolt.mail.listReservations({});
console.log('Active file reservations:');
result.reservations.forEach(reservation => {
console.log(`- ${reservation.files.join(', ')}`);
console.log(` Reserved by: ${reservation.agentId}`);
console.log(` Expires: ${new Date(reservation.expiresAt).toLocaleString()}`);
});
Example 2: Check Specific Agent's Reservations
const result = await codebolt.mail.listReservations({
agentId: 'agent-001'
});
console.log(`Agent has ${result.reservations.length} active reservations`);
Common Use Cases
- Status Check: See what files are currently reserved
- Conflict Detection: Identify potential conflicts before starting work
- Management: Oversee file reservations across agents
Notes
- Shows all active reservations
- Includes expiration times
- Useful for coordination