import { defineHandler } from '@kb-labs/sdk';
import { loadHistory } from '@kb-labs/qa-core';

// src/rest/handlers/history-handler.ts
var history_handler_default = defineHandler({
  async execute(ctx, input) {
    const limit = input.query?.limit;
    const allEntries = loadHistory(ctx.cwd);
    let entries = [...allEntries].reverse();
    if (limit && limit > 0) {
      entries = entries.slice(0, limit);
    }
    return {
      entries,
      total: allEntries.length
    };
  }
});

export { history_handler_default as default };
//# sourceMappingURL=history-handler.js.map
//# sourceMappingURL=history-handler.js.map