import { getSessionIndex } from "../../utils/session.js";
//#region src/cli/commands/agent/sessions.ts
/**
* Session listing for agent command
*/
/**
* List available sessions in a table format
*/
async function listSessions() {
	const result = await (await getSessionIndex()).listSessions({
		limit: 20,
		sortBy: "updatedAt",
		sortOrder: "desc"
	});
	console.log("\n📋 Available Sessions:\n");
	if (result.items.length === 0) {
		console.log("No sessions found.");
		return;
	}
	console.log("Key".padEnd(35) + "Name".padEnd(20) + "Messages".padEnd(10) + "Updated");
	console.log("─".repeat(85));
	for (const session of result.items) {
		const name = (session.name || "-").slice(0, 18).padEnd(20);
		const messages = String(session.messageCount).padEnd(10);
		const updated = new Date(session.updatedAt).toLocaleDateString();
		console.log(`${session.key.slice(0, 33).padEnd(35)}${name}${messages}${updated}`);
	}
	console.log();
}
//#endregion
export { listSessions };

//# sourceMappingURL=sessions.js.map