module.exports=[53974,a=>{"use strict";var b=a.i(66680),c=a.i(80026);function d(a){return(0,c.getDb)().prepare("SELECT * FROM questions WHERE id = ?").get(a)??null}a.s(["answerQuestion",0,function(a){let b=(0,c.getDb)(),e=new Date().toISOString();return 0===b.prepare(`UPDATE questions
          SET status = 'answered',
              answer_option_index = ?,
              answer_text = ?,
              resolved_by_kind = 'user',
              resolved_at = ?
        WHERE id = ? AND status = 'pending'`).run(a.answer_option_index??null,a.answer_text??null,e,a.id).changes?null:d(a.id)},"cancelQuestion",0,function(a){let b=(0,c.getDb)(),e=new Date().toISOString();return 0===b.prepare(`UPDATE questions
          SET status = 'cancelled',
              resolved_by_kind = 'user',
              resolved_at = ?
        WHERE id = ? AND status = 'pending'`).run(e,a).changes?null:d(a)},"createQuestion",0,function(a){let e=(0,c.getDb)(),f=(0,b.randomUUID)(),g=new Date().toISOString();return e.prepare(`INSERT INTO questions
       (id, project_slug, agent_id, task_id, prompt, options_json,
        status, answer_option_index, answer_text, resolved_by_kind,
        created_at, resolved_at)
     VALUES (?, ?, ?, ?, ?, ?, 'pending', NULL, NULL, NULL, ?, NULL)`).run(f,a.project_slug,a.agent_id,a.task_id??null,a.prompt,JSON.stringify(a.options??[]),g),d(f)},"getQuestion",0,d,"listQuestionsForTask",0,function(a){return(0,c.getDb)().prepare(`SELECT * FROM questions
        WHERE task_id = ?
        ORDER BY created_at DESC, rowid DESC`).all(a)},"parseQuestionOptions",0,function(a){try{let b=JSON.parse(a.options_json);if(Array.isArray(b)&&b.every(a=>"string"==typeof a))return b}catch{}return[]}])},11040,a=>{a.v(b=>Promise.all(["server/chunks/ssr/src_server_orchestration_0i_x~ej._.js"].map(b=>a.l(b))).then(()=>b(28151)))}];

//# sourceMappingURL=src_server_0h~2bh_._.js.map