import { d as defineEventHandler, b as getRouterParam, c as createError, C as findBySessionId } from '../../../../../../nitro/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:crypto';
import 'stream';
import 'events';
import 'http';
import 'crypto';
import 'buffer';
import 'zlib';
import 'https';
import 'net';
import 'tls';
import 'url';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'vue-router';
import '@prisma/client';
import '@prisma/adapter-better-sqlite3';
import 'fs';
import 'path';
import 'fs/promises';
import 'child_process';
import 'node:child_process';
import 'node:url';

const prompt_get = defineEventHandler(async (event) => {
  var _a, _b;
  const issueId = getRouterParam(event, "id");
  const sessionId = getRouterParam(event, "sessionId");
  if (!issueId || !sessionId) {
    throw createError({
      statusCode: 400,
      message: "Issue ID and Session ID required"
    });
  }
  const log = await findBySessionId(sessionId);
  if (!log || log.issueKey !== issueId) {
    throw createError({
      statusCode: 404,
      message: `Session ${sessionId} not found for issue ${issueId}`
    });
  }
  return {
    issueKey: issueId,
    sessionId,
    column: (_b = (_a = log.column) == null ? void 0 : _a.slug) != null ? _b : null,
    content: log.prompt || ""
  };
});

export { prompt_get as default };
//# sourceMappingURL=prompt.get.mjs.map
