copilot-operator 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +13 -3
  2. package/dist/src/api/operator.controller.js +6 -1
  3. package/dist/src/api/operator.service.js +57 -22
  4. package/dist/src/cli.js +1 -0
  5. package/dist/src/config/schema.js +25 -0
  6. package/dist/src/exec/authorizer.js +20 -10
  7. package/dist/src/exec/commandHeads.js +799 -0
  8. package/dist/src/exec/policy.js +1 -1
  9. package/dist/src/exec/policyManifest.js +16 -2
  10. package/dist/src/exec/programs.js +22 -82
  11. package/dist/src/exec/reportFile.js +5 -2
  12. package/dist/src/orchestrator/review.js +4 -3
  13. package/dist/src/orchestrator/taskRunner.js +33 -7
  14. package/dist/src/plan/schema.js +7 -0
  15. package/dist/src/plan/systemGuide.js +30 -6
  16. package/dist/src/protocol/reporter.js +8 -6
  17. package/dist/src/session/exports.js +128 -1
  18. package/dist/src/session/store.js +2 -0
  19. package/dist/src/vcs/taskVcs.js +33 -0
  20. package/dist/web/404.html +2 -2
  21. package/dist/web/_next/static/chunks/867-f0e3e152f6f67e45.js +1 -0
  22. package/dist/web/_next/static/chunks/89-382e9b29486d2747.js +1 -0
  23. package/dist/web/_next/static/chunks/app/defaults/page-1747c931adc746fd.js +1 -0
  24. package/dist/web/_next/static/chunks/app/history/page-8d4f817e36986e3f.js +1 -0
  25. package/dist/web/_next/static/chunks/app/page-f04d6e00182ccc76.js +1 -0
  26. package/dist/web/_next/static/chunks/app/sessions/view/page-185f5fcc383e6619.js +1 -0
  27. package/dist/web/appearance.html +2 -2
  28. package/dist/web/appearance.txt +10 -10
  29. package/dist/web/defaults.html +2 -2
  30. package/dist/web/defaults.txt +10 -10
  31. package/dist/web/history.html +2 -2
  32. package/dist/web/history.txt +10 -10
  33. package/dist/web/import.html +2 -2
  34. package/dist/web/import.txt +10 -10
  35. package/dist/web/index.html +2 -2
  36. package/dist/web/index.txt +10 -10
  37. package/dist/web/level1.html +2 -2
  38. package/dist/web/level1.txt +10 -10
  39. package/dist/web/presets.html +2 -2
  40. package/dist/web/presets.txt +10 -10
  41. package/dist/web/sessions/view.html +2 -2
  42. package/dist/web/sessions/view.txt +10 -10
  43. package/dist/web/system.html +2 -2
  44. package/dist/web/system.txt +10 -10
  45. package/package.json +1 -1
  46. package/dist/web/_next/static/chunks/867-5b104743e24a4e2f.js +0 -1
  47. package/dist/web/_next/static/chunks/955-cf291b8a60315c58.js +0 -1
  48. package/dist/web/_next/static/chunks/app/defaults/page-559af121c43127a1.js +0 -1
  49. package/dist/web/_next/static/chunks/app/history/page-0df90ab9998815db.js +0 -1
  50. package/dist/web/_next/static/chunks/app/page-050cf6f71187e8af.js +0 -1
  51. package/dist/web/_next/static/chunks/app/sessions/view/page-4d31690c22c8b331.js +0 -1
  52. /package/dist/web/_next/static/{eWzbORCbQ1h_2IeLH_njb → p9lexLS0u8W5N6VzLavHO}/_buildManifest.js +0 -0
  53. /package/dist/web/_next/static/{eWzbORCbQ1h_2IeLH_njb → p9lexLS0u8W5N6VzLavHO}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[89],{1035:(e,t,s)=>{s.d(t,{DialogHost:()=>c,Z:()=>o});var n=s(3365),a=s(1521),l=s(867);let r=null,i=[];function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(s=>{var n;return n={kind:"confirm",message:e,...t,resolve:s},void(r?r(n):i.push(n))})}function c(e){var t,s;let{children:o}=e,{t:c}=(0,l.kj)(),[d,u]=(0,a.useState)([]),h=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(r=e=>u(t=>[...t,e]),i.length>0){let e=i.splice(0,i.length);u(t=>[...t,...e])}return()=>{r=null}},[]);let m=d[0],p=(0,a.useCallback)(e=>{m&&(m.resolve(e),u(e=>e.slice(1)))},[m]);return(0,a.useEffect)(()=>{var e;if(!m)return;null==(e=h.current)||e.focus();let t=e=>{"Escape"===e.key&&(e.preventDefault(),p(!1))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[m,p]),(0,n.jsxs)(n.Fragment,{children:[o,m&&(0,n.jsx)("div",{className:"modal-backdrop",onClick:()=>p(!1),role:"presentation",children:(0,n.jsxs)("div",{className:"modal".concat(m.danger?" danger":""),role:"confirm"===m.kind?"alertdialog":"dialog","aria-modal":"true","aria-labelledby":"modal-title",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{id:"modal-title",children:null!=(t=m.title)?t:c("confirm"===m.kind?"dialog.confirmTitle":"dialog.noticeTitle")}),(0,n.jsx)("div",{className:"modal-body",children:m.message}),(0,n.jsxs)("div",{className:"row modal-actions",children:["confirm"===m.kind&&(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>p(!1),children:c("dialog.cancel")}),(0,n.jsx)("button",{ref:h,type:"button",className:m.danger?"danger":"primary",onClick:()=>p(!0),children:null!=(s=m.okLabel)?s:c("dialog.ok")})]})]})})]})}},1910:(e,t,s)=>{s.d(t,{H:()=>o,u:()=>i});var n=s(3365),a=s(1521),l=s(867),r=s(5549);function i(e){let{label:t,save:s}=e,{t:r}=(0,l.kj)(),[i,o]=(0,a.useState)(!1),[c,d]=(0,a.useState)(""),[u,h]=(0,a.useState)(!1),m=async()=>{o(!0),d("");try{var e;let t=await s();h(!1),d(t.revealed?r("save.done",{path:t.path}):r("save.savedOnly",{path:t.path,note:null!=(e=t.note)?e:""}))}catch(e){h(!0),d(r("save.failed",{problem:e.message}))}finally{o(!1)}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"linkish",disabled:i,title:r("save.why"),onClick:()=>void m(),children:i?r("save.saving"):t}),c&&(0,n.jsx)("span",{className:u?"err small":"muted small",children:c})]})}function o(e){let{sessionId:t,taskId:s,attempt:i}=e,{t:o}=(0,l.kj)(),[c,d]=(0,a.useState)(!1),[u,h]=(0,a.useState)(""),[m,p]=(0,a.useState)(!1),f=async()=>{d(!0),h("");try{let e=await r.FH.downloadBundle([{sessionId:t,taskId:s,attempt:i}]);p(!1),h(o("reg.bundleSaved",{name:e}))}catch(e){p(!0),h(o("save.failed",{problem:e.message}))}finally{d(!1)}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"linkish",disabled:c,title:o("save.attemptRecordWhy"),onClick:()=>void f(),children:c?o("save.saving"):o("save.attemptRecord")}),u&&(0,n.jsx)("span",{className:m?"err small":"muted small",children:u})]})}},3041:(e,t,s)=>{s.d(t,{e:()=>i});var n=s(1521),a=s(5549),l=s(1035),r=s(867);function i(e){let{t}=(0,r.kj)(),[s,i]=(0,n.useState)(""),[o,c]=(0,n.useState)("");return{busy:s,message:o,clearMessage:()=>c(""),restore:(0,n.useCallback)(async s=>{i("restore"),c("");try{var n,r,o,d,u,h,m,p,f,x,v,g,j,y;let i=await a.FH.restorePreview(s.sessionId,s.taskId);if(!i.ok)return void c(t("restore.cannot",{problem:null!=(o=i.problem)?o:""}));let k={repo:i.repoDir,title:s.title,branch:null!=(d=i.branchName)?d:"",commit:(null!=(u=i.baseCommit)?u:"").slice(0,8)},N=i.leftBehind.length>0?t("restore.confirmLosing",{...k,n:i.leftBehind.length,kept:null!=(h=i.keptOn)?h:"",list:i.leftBehind.slice(0,10).join("\n")}):t("restore.confirm",k);if(!await (0,l.Z)(N))return;let b=await a.FH.restore(s.sessionId,s.taskId);if(!b.ok)return void c(t("restore.failed",{problem:null!=(m=b.problem)?m:""}));c((null!=(p=null==(n=b.leftBehind)?void 0:n.length)?p:0)>0?t("restore.done",{branch:null!=(f=b.branch)?f:"",commit:(null!=(x=b.commit)?x:"").slice(0,8),n:null!=(v=null==(r=b.leftBehind)?void 0:r.length)?v:0,kept:null!=(g=b.keptOn)?g:""}):t("restore.doneNothing",{branch:null!=(j=b.branch)?j:"",commit:(null!=(y=b.commit)?y:"").slice(0,8)})),e()}catch(e){c(e.message)}finally{i("")}},[t,e]),restartFrom:(0,n.useCallback)(async s=>{i("restart"),c("");try{var n,r;let i=await a.FH.restartPlan(s.sessionId,s.taskId);if(!i.ok)return void c(t("restart.cannot",{problem:null!=(n=i.problem)?n:""}));let o=i.restores.filter(e=>!e.ok);if(o.length>0)return void c(t("restart.cannot",{problem:o.map(e=>{var t;return"".concat(e.repoDir,": ").concat(null!=(t=e.problem)?t:"")}).join(" | ")}));let d=i.restores.map(e=>{var s,n,a;return t("restart.repoLine",{repo:e.repoDir,commit:(null!=(s=e.baseCommit)?s:"").slice(0,8),branch:null!=(n=e.branchName)?n:"",n:e.leftBehind.length,kept:null!=(a=e.keptOn)?a:""})}).join("\n"),u=i.tasks.map(e=>" ".concat(e.sessionName," / ").concat(e.title).concat(e.alreadyQueued?t("restart.alreadyQueued"):"")).join("\n"),h=t("restart.confirm",{title:i.from.title,tasks:i.tasks.length,sessions:i.sessions.length,list:u,repos:d||t("restart.noRepo"),mode:t("unattended"===i.mode?"run.unattended":"run.confirm")});if(!await (0,l.Z)(h))return;let m=await a.FH.restartFrom(s.sessionId,s.taskId);if(!m.started){c(t("restart.failed",{problem:null!=(r=m.reason)?r:""})),e();return}c(t("restart.started",{requeued:m.requeued,repos:m.restored.length})),e()}catch(e){c(e.message)}finally{i("")}},[t,e])}}},3374:(e,t,s)=>{s.d(t,{c:()=>a});var n=s(1521);function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,[s,a]=(0,n.useState)(()=>Date.now());return(0,n.useEffect)(()=>{if(!e)return;a(Date.now());let s=window.setInterval(()=>a(Date.now()),t);return()=>window.clearInterval(s)},[e,t]),s}},3523:(e,t,s)=>{function n(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now();if(!e)return;let n=Date.parse(e);if(Number.isNaN(n))return;let a=t?Date.parse(t):s;return Number.isNaN(a)?void 0:Math.max(0,a-n)}function a(e){return!!e.startedAt&&!e.finishedAt&&"queued"!==e.status}function l(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now(),n=t.some(e=>a(e)),l=t.map(e=>e.finishedAt?Date.parse(e.finishedAt):NaN).filter(e=>!Number.isNaN(e)),r=Date.parse(e.startedAt),i=n||0===l.length?s:Math.max(...l);return{ms:Number.isNaN(r)?0:Math.max(0,i-r),live:n,tasks:t.length}}function r(e){var t,s;let n=new Map;for(let s of e){if(!s.runGroup)continue;let e=null!=(t=n.get(s.runGroup.id))?t:{run:s.runGroup,tasks:[]};e.tasks.push(s),n.set(s.runGroup.id,e)}return null!=(s=[...n.values()].sort((e,t)=>Date.parse(t.run.startedAt)-Date.parse(e.run.startedAt))[0])?s:null}s.d(t,{DG:()=>a,d5:()=>n,eZ:()=>l,hH:()=>r})},4811:(e,t,s)=>{s.d(t,{p:()=>l});var n=s(1521),a=s(5549);function l(){let[e,t]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e=!0;return a.FH.settings().then(s=>{var n;let a=null!=(n=s.raw.execution)?n:{};e&&t("unattended"===a.mode)}).catch(()=>void 0),()=>{e=!1}},[]),e}},5132:(e,t,s)=>{s.d(t,{s:()=>i});var n=s(3365),a=s(1521);function l(e,t){let s,a=[],l=/(`[^`\n]+`)|(\*\*[^*\n]+\*\*)|(\*[^*\n]+\*)/g,r=0,i=0;for(;null!==(s=l.exec(e));){s.index>r&&a.push(e.slice(r,s.index));let l=s[0],o="".concat(t,"-i").concat(i+=1);l.startsWith("`")?a.push((0,n.jsx)("code",{children:l.slice(1,-1)},o)):l.startsWith("**")?a.push((0,n.jsx)("strong",{children:l.slice(2,-2)},o)):a.push((0,n.jsx)("em",{children:l.slice(1,-1)},o)),r=s.index+l.length}return r<e.length&&a.push(e.slice(r)),a}function r(e){let t=/^\s*[-*•]\s+(.*)$/.exec(e);if(t)return t[1];let s=/^\s*\d+[.)]\s+(.*)$/.exec(e);return s?s[1]:null}function i(e){let{text:t,className:s}=e,i=[],o=t.replace(/\r\n/g,"\n").split("\n"),c=0,d=0;for(;c<o.length;){let e=o[c];if(e.trim().startsWith("```")){let e=[];for(c+=1;c<o.length&&!o[c].trim().startsWith("```");)e.push(o[c++]);c+=1,e.length>0&&i.push((0,n.jsx)("pre",{children:e.join("\n")},"b".concat(d+=1)));continue}if(null!==r(e)){let e=[];for(;c<o.length&&null!==r(o[c]);)e.push(r(o[c++]));i.push((0,n.jsx)("ul",{children:e.map((e,t)=>(0,n.jsx)("li",{children:l(e,"b".concat(d,"-").concat(t))},t))},"b".concat(d+=1)));continue}if(""===e.trim()){c+=1;continue}let t=[];for(;c<o.length&&""!==o[c].trim()&&null===r(o[c])&&!o[c].trim().startsWith("```");)t.push(o[c++]);let s=d+=1;i.push((0,n.jsx)("p",{children:t.map((e,t)=>(0,n.jsxs)(a.Fragment,{children:[t>0&&(0,n.jsx)("br",{}),l(e,"b".concat(s,"-").concat(t))]},t))},"b".concat(s)))}return(0,n.jsx)("div",{className:"rich ".concat(null!=s?s:""),children:i})}},7619:(e,t,s)=>{s.d(t,{P:()=>o});var n=s(3365),a=s(1521),l=s(5549),r=s(867),i=s(5132);function o(e){let{sessionId:t,taskId:s,runId:o,live:c}=e,{t:d}=(0,r.kj)(),[u,h]=(0,a.useState)(null),[m,p]=(0,a.useState)(""),[f,x]=(0,a.useState)(!0),[v,g]=(0,a.useState)(!0),[j,y]=(0,a.useState)(new Set);if((0,a.useEffect)(()=>{let e,n=!0,a=async()=>{try{let r=await l.FH.taskStory(t,s,o);if(!n)return;h(r),p(""),r.live&&(e=setTimeout(a,4e3))}catch(t){if(!n)return;p(t.message),c&&(e=setTimeout(a,4e3))}};return a(),()=>{n=!1,e&&clearTimeout(e)}},[t,s,o,c]),m&&!u)return(0,n.jsx)("div",{className:"err small",children:m});if(!u)return(0,n.jsx)("div",{className:"muted small",children:d("story.loading")});let k=e=>y(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s}),N=(e,t)=>{if(!("review"===e.kind?f||v:"step"===e.kind?v:f))return null;if("review"===e.kind)return(0,n.jsxs)("li",{className:"story-review",children:[(0,n.jsx)("div",{className:"story-head",children:(0,n.jsx)("span",{className:"chip",children:d("story.review",{n:e.round})})}),(0,n.jsx)("ol",{className:"story",children:e.entries.map((e,s)=>N(e,"".concat(t,"-").concat(s)))})]},t);if("step"===e.kind){let s=j.has(t);return(0,n.jsxs)("li",{className:"story-step".concat(e.failed?" failed":""),children:[(0,n.jsxs)("div",{className:"story-head",children:[(0,n.jsx)("span",{className:"chip",children:d("story.step",{it:e.iteration,id:e.id})}),e.outcome&&(0,n.jsxs)("span",{className:"badge ".concat(e.failed?"failed":"done"),children:[e.outcome,void 0!==e.exitCode?" \xb7 exit ".concat(e.exitCode):"",void 0!==e.durationMs?" \xb7 ".concat((0,l.c5)(e.durationMs)):""]}),!e.outcome&&(0,n.jsx)("span",{className:"badge running",children:d("story.running")}),e.failed&&(0,n.jsx)("span",{className:"badge failed",children:d("story.failedHere")})]}),(0,n.jsx)("pre",{className:"story-cmd",children:e.command}),e.output&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"linkish small",onClick:()=>k(t),children:s?d("story.hideOutput"):d("story.showOutput",{n:e.output.length})}),s&&(0,n.jsx)("pre",{className:"story-out",children:e.output})]})]},t)}let s=j.has(t),a="sent"===e.kind?d("story.bot"):d("story.chat"),r="reply"===e.kind&&("blocked"===e.status||"failed"===e.status);return(0,n.jsxs)("li",{className:"story-msg ".concat(e.kind).concat(r?" failed":""),children:[(0,n.jsxs)("div",{className:"story-head",children:[(0,n.jsx)("strong",{children:a}),(0,n.jsx)("span",{className:"muted small",children:e.label}),"reply"===e.kind&&e.status&&(0,n.jsx)("span",{className:"badge ".concat(r?"failed":"done"===e.status?"done":""),children:e.status})]}),"reply"===e.kind&&e.notes&&(0,n.jsx)("p",{className:"story-notes",children:e.notes}),(0,n.jsx)("button",{type:"button",className:"linkish small",onClick:()=>k(t),children:s?d("story.hideText"):d("story.showText",{n:e.text.length})}),s&&(0,n.jsx)("pre",{className:"story-out",children:e.text})]},t)},b=u.close,w=b&&"done"!==b.status;return(0,n.jsxs)("div",{className:"story-box",children:[(0,n.jsxs)("div",{className:"row small",style:{marginBottom:6},children:[(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:f,onChange:e=>x(e.target.checked)})," ",d("story.showChat")]}),(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:v,onChange:e=>g(e.target.checked)})," ",d("story.showCommands")]}),u.live&&(0,n.jsxs)("span",{className:"live",children:[(0,n.jsx)("span",{className:"dot","aria-hidden":"true"})," ",d("story.live")]}),m&&(0,n.jsx)("span",{className:"err",children:m})]}),(0,n.jsxs)("div",{className:"story-fixed",children:[(0,n.jsx)("strong",{children:d("story.prompt")}),(0,n.jsx)("pre",{className:"story-out always",children:u.prompt})]}),(0,n.jsx)("ol",{className:"story",children:u.entries.map((e,t)=>N(e,"e".concat(t)))}),b?(0,n.jsxs)("div",{className:"story-fixed close".concat(w?" failed":""),children:[(0,n.jsx)("strong",{children:w?d("story.endedBadly",{status:b.status}):d("story.ended")}),b.reason&&(0,n.jsx)("p",{className:"err small",children:b.reason}),b.summary&&(0,n.jsx)(i.s,{text:b.summary,className:"what"}),b.checks&&b.checks.length>0&&(0,n.jsx)("ul",{className:"small",style:{margin:"6px 0 0",paddingLeft:18},children:b.checks.map((e,t)=>(0,n.jsxs)("li",{className:e.passed?"":"err",children:[e.passed?"✓":"✗"," ",e.name,!e.passed&&e.detail?" — ".concat(e.detail):""]},t))})]}):(0,n.jsx)("div",{className:"story-fixed muted small",children:d("story.notEnded")})]})}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[189],{1035:(e,l,t)=>{"use strict";t.d(l,{DialogHost:()=>d,Z:()=>o});var r=t(3365),n=t(1521),s=t(867);let a=null,i=[];function o(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(t=>{var r;return r={kind:"confirm",message:e,...l,resolve:t},void(a?a(r):i.push(r))})}function d(e){var l,t;let{children:o}=e,{t:d}=(0,s.kj)(),[c,u]=(0,n.useState)([]),m=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(a=e=>u(l=>[...l,e]),i.length>0){let e=i.splice(0,i.length);u(l=>[...l,...e])}return()=>{a=null}},[]);let h=c[0],x=(0,n.useCallback)(e=>{h&&(h.resolve(e),u(e=>e.slice(1)))},[h]);return(0,n.useEffect)(()=>{var e;if(!h)return;null==(e=m.current)||e.focus();let l=e=>{"Escape"===e.key&&(e.preventDefault(),x(!1))};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[h,x]),(0,r.jsxs)(r.Fragment,{children:[o,h&&(0,r.jsx)("div",{className:"modal-backdrop",onClick:()=>x(!1),role:"presentation",children:(0,r.jsxs)("div",{className:"modal".concat(h.danger?" danger":""),role:"confirm"===h.kind?"alertdialog":"dialog","aria-modal":"true","aria-labelledby":"modal-title",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{id:"modal-title",children:null!=(l=h.title)?l:d("confirm"===h.kind?"dialog.confirmTitle":"dialog.noticeTitle")}),(0,r.jsx)("div",{className:"modal-body",children:h.message}),(0,r.jsxs)("div",{className:"row modal-actions",children:["confirm"===h.kind&&(0,r.jsx)("button",{type:"button",className:"quiet",onClick:()=>x(!1),children:d("dialog.cancel")}),(0,r.jsx)("button",{ref:m,type:"button",className:h.danger?"danger":"primary",onClick:()=>x(!0),children:null!=(t=h.okLabel)?t:d("dialog.ok")})]})]})})]})}},1896:(e,l,t)=>{Promise.resolve().then(t.bind(t,3197))},2244:(e,l,t)=>{"use strict";t.d(l,{k:()=>c});var r=t(3365),n=t(1521),s=t(5549),a=t(867);function i(e){return e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/+$/,"")}function o(e,l){return"."===l||""===l||e===l||e.startsWith("".concat(l,"/"))}function d(e,l,t){return t.includes(e)?"out":t.some(l=>l!==e&&o(e,l))?"out-inherited":l.includes(e)?"in":l.some(l=>l!==e&&o(e,l))?"inherited":"none"}function c(e){let{rootDir:l,respectGitignore:t,includeEnvFiles:c,include:u,exclude:m,onChange:h}=e,{t:x}=(0,a.kj)(),[j,p]=(0,n.useState)(null),[v,f]=(0,n.useState)(""),[g,y]=(0,n.useState)(new Set),[b,N]=(0,n.useState)(""),w=async()=>{if(l.trim()){f("");try{let e=await s.FH.dirs(l,t);p(e),N("".concat(l,"|").concat(t)),y(new Set(e.filter(e=>!e.includes("/"))))}catch(e){f(e.message)}}};(0,n.useEffect)(()=>{p(null),N("")},[l,t]);let k=(0,n.useMemo)(()=>(function(e){let l=[],t=new Map;for(let n of[...e].sort()){var r;let e={path:n,name:null!=(r=n.split("/").pop())?r:n,children:[]};t.set(n,e);let s=n.includes("/")?t.get(n.slice(0,n.lastIndexOf("/"))):void 0;(s?s.children:l).push(e)}return l})(null!=j?j:[]),[j]),S=u.map(i).filter(Boolean),C=m.map(i).filter(Boolean),D=e=>(0,r.jsx)("ul",{className:"dir-tree",children:e.map(e=>{let l=d(e.path,S,C),t=g.has(e.path),n=function(e,l,t){let r=l=>l.filter(l=>l!==e&&o(l,e)).length;return{included:r(l),excluded:r(t)}}(e.path,S,C),s=!t&&e.children.length>0&&(n.included>0||n.excluded>0);return(0,r.jsxs)("li",{className:"dir ".concat(l),children:[(0,r.jsxs)("div",{className:"dir-row",children:[e.children.length>0?(0,r.jsx)("button",{type:"button",className:"dir-flip",onClick:()=>{let l;return l=e.path,y(e=>{let t=new Set(e);return t.has(l)?t.delete(l):t.add(l),t})},"aria-label":t?x("tree.fold"):x("tree.unfold"),"aria-expanded":t,children:t?"▾":"▸"}):(0,r.jsx)("span",{className:"dir-flip","aria-hidden":"true"}),(0,r.jsxs)("button",{type:"button",className:"dir-name",onClick:()=>(e=>{if("in"===d(e,S,C))return void h(S.filter(l=>l!==e),C);h([...S.filter(l=>!o(l,e)),e],C.filter(l=>!o(l,e)))})(e.path),title:"in"===l?x("tree.stateIn"):"inherited"===l?x("tree.stateInherited"):"out"===l?x("tree.stateOut"):"out-inherited"===l?x("tree.stateOutInherited"):x("tree.stateNone"),"aria-pressed":"in"===l||"inherited"===l,children:[(0,r.jsx)("span",{className:"dir-mark","aria-hidden":"true",children:"in"===l?"✓":"inherited"===l?"\xb7":"out"===l||"out-inherited"===l?"\xd7":""}),e.name]}),(0,r.jsx)("button",{type:"button",className:"dir-out".concat("out"===l?" on":""),onClick:()=>(e=>{if(C.includes(e))return void h(S,C.filter(l=>l!==e));h(S.filter(l=>l!==e&&!o(l,e)),[...C.filter(l=>!o(l,e)),e])})(e.path),title:"out"===l?x("tree.unexclude"):x("tree.exclude"),children:"−"}),s&&(0,r.jsx)("span",{className:"chip inside".concat(n.excluded>0?" out":""),title:x("tree.insideWhy"),children:n.excluded>0&&n.included>0?x("tree.insideBoth",{i:n.included,e:n.excluded}):n.excluded>0?x("tree.insideOut",{n:n.excluded}):x("tree.insideIn",{n:n.included})})]}),t&&e.children.length>0&&D(e.children)]},e.path)})}),F=b!=="".concat(l,"|").concat(t);return(0,r.jsxs)("div",{className:"dir-tree-box",children:[(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("button",{type:"button",onClick:()=>void w(),disabled:!l.trim(),children:null===j||F?x("tree.load"):x("tree.reload")}),(0,r.jsx)("span",{className:"muted small",children:x("tree.hint")})]}),v&&(0,r.jsx)("div",{className:"err small",children:v}),(0,r.jsxs)("p",{className:"muted small",style:{marginTop:6},children:[x("tree.alsoOut")," ",[t?x("tree.alsoGitignore"):null,!1===c?x("tree.alsoEnv"):null,x("tree.alsoAlways")].filter(Boolean).join(" \xb7 ")]}),null!==j&&!F&&(0===j.length?(0,r.jsx)("p",{className:"muted small",children:x("mirror.noDirs")}):D(k))]})}},3197:(e,l,t)=>{"use strict";t.r(l),t.d(l,{default:()=>m});var r=t(3365),n=t(1521),s=t(8197),a=t.n(s),i=t(5549),o=t(867),d=t(1035),c=t(4784),u=t(2244);function m(){let{t:e}=(0,o.kj)(),[l,t]=(0,n.useState)(null),[s,a]=(0,n.useState)(!1),[c,u]=(0,n.useState)("");(0,n.useEffect)(()=>{i.FH.models().then(t).catch(()=>void 0)},[]);let m=async()=>{if(await (0,d.Z)(e("model.refreshConfirm"))){a(!0),u(e("model.refreshing"));try{var l;let r=await i.FH.models().then(()=>i.FH.refreshModels());t(r),u(0===r.options.length?null!=(l=r.note)?l:e("model.none"):e("model.refreshed",{n:r.options.length}))}catch(e){u(e.message)}finally{a(!1)}}},h={catalogue:l,setCatalogue:t,refreshModels:m,refreshing:s,refreshMsg:c};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"panel",children:[(0,r.jsx)("h2",{children:e("def.title")}),(0,r.jsx)("p",{className:"muted small",children:e("def.intro")}),(0,r.jsx)("p",{className:"why",children:e("def.autoSave")})]}),(0,r.jsx)(v,{}),(0,r.jsx)(b,{...h}),(0,r.jsx)(N,{...h}),(0,r.jsx)(y,{})]})}function h(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:900,t=(0,n.useRef)(null),r=(0,n.useRef)(null),s=(0,n.useRef)(e);return s.current=e,(0,n.useEffect)(()=>()=>{t.current&&clearTimeout(t.current),r.current&&s.current(r.current.value)},[]),e=>{t.current&&clearTimeout(t.current),r.current={value:e},t.current=setTimeout(()=>{r.current=null,s.current(e)},l)}}function x(e){let{id:l,value:t,min:s,max:a,onChange:i,disabled:o}=e,[d,c]=(0,n.useState)(String(t));return(0,n.useEffect)(()=>c(e=>j(e)===t?e:String(t)),[t]),(0,r.jsx)("input",{id:l,type:"number",min:s,max:a,step:1,value:d,onChange:e=>{c(e.target.value);let l=j(e.target.value);null!==l&&l>=s&&l<=a&&i(l)},onBlur:()=>{let e=j(d),l=null===e?t:Math.max(s,Math.min(a,e));c(String(l)),l!==t&&i(l)},style:{width:90},disabled:o})}function j(e){if(""===e.trim())return null;let l=Number(e);return Number.isInteger(l)?l:null}function p(e){let{msg:l,onSave:t}=e,{t:n}=(0,o.kj)();return(0,r.jsxs)("div",{className:"row",style:{marginTop:6},children:[t&&(0,r.jsx)("button",{className:"quiet",onClick:t,title:n("def.saveAnywayWhy"),children:n("def.saveAnyway")}),(0,r.jsx)("span",{className:"muted small",role:"status",children:l||n("def.savedAutomatically")})]})}function v(){var e;let{t:l}=(0,o.kj)(),[t,s]=(0,n.useState)(null),[a,d]=(0,n.useState)(""),[c,u]=(0,n.useState)(""),[m,x]=(0,n.useState)(""),[j,v]=(0,n.useState)(""),[g,y]=(0,n.useState)(!1),[b,N]=(0,n.useState)(""),[w,k]=(0,n.useState)(""),S=(0,n.useCallback)(async()=>{try{let e=await i.FH.project();s(e),d(e.rootDir),u(e.name),v("")}catch(e){v(e.message)}},[]);(0,n.useEffect)(()=>{S()},[S]);let C=async(e,l)=>{y(!0),x("");try{let t=await i.FH.setProject(e);return s(t),d(t.rootDir),x(l(t)),v(""),!0}catch(e){return v(e.message),!1}finally{y(!1)}},D=e=>C({rootDir:e},e=>e.rootDir?l("proj.saved",{dir:e.rootDir}):l("proj.cleared")),F=e=>C({name:e},()=>l("proj.nameSaved")),R=h(D),M=h(F),T=async(e,l)=>{y(!0);try{var t;let r=await i.FH.browseFolder(l.trim()||void 0);r.ok?e(r.path):r.cancelled||v(null!=(t=r.reason)?t:"")}finally{y(!1)}},E=null!=(e=null==t?void 0:t.others)?e:[],I=e=>e.map(e=>({name:e.name,rootDir:e.rootDir,...e.mirror?{mirror:e.mirror}:{}})),B=async()=>{await C({others:[...I(E),{name:b.trim(),rootDir:w.trim()}]},e=>l("proj.othersSaved",{n:e.others.length}))&&(N(""),k(""))};return(0,r.jsxs)("div",{className:"panel",id:"project",children:[(0,r.jsx)("h2",{children:l("proj.title")}),(0,r.jsx)("p",{className:"muted small",children:l("proj.intro")}),j&&(0,r.jsx)("div",{className:"err",children:j}),t&&(0,r.jsxs)("div",{className:"option".concat(t.mirrorToDesktop?" warned":""),style:{marginBottom:12},children:[(0,r.jsxs)("label",{children:[(0,r.jsx)("input",{type:"checkbox",checked:t.mirrorToDesktop,onChange:e=>{C({mirrorToDesktop:e.target.checked},e=>e.mirrorToDesktop?l("proj.mirrorOn",{root:e.contextRoot}):l("proj.mirrorOff"))},disabled:g}),(0,r.jsx)("span",{children:l("proj.mirrorToDesktop")})]}),(0,r.jsx)("p",{className:"why",children:l("proj.mirrorToDesktopWhy",{root:t.contextRoot})})]}),(0,r.jsx)("p",{className:"muted small",children:l("proj.listIntro")}),(0,r.jsx)(f,{name:c,dir:a,repoOk:!!(null==t?void 0:t.repoOk),repoProblem:null==t?void 0:t.repoProblem,mirror:null==t?void 0:t.mirror,isDefault:!0,busy:g,onName:e=>{u(e),M(e)},onNameBlur:()=>void F(c),onDir:e=>{d(e),R(e)},onDirBlur:()=>void D(a),onBrowse:()=>void T(e=>void D(e),a),onRemove:(null==t?void 0:t.rootDir)?()=>void D(""):void 0,removeLabel:l("proj.clear"),onFolders:e=>C({mirror:e},()=>l("proj.foldersSaved"))}),(0,r.jsx)(p,{msg:m}),t&&!t.rootDir&&(0,r.jsx)("p",{className:"muted small",style:{marginTop:8},children:l("proj.none")}),E.map(e=>(0,r.jsx)(f,{name:e.name,dir:e.rootDir,repoOk:e.repoOk,repoProblem:e.repoProblem,mirror:e.mirror,busy:g,onName:t=>void C({others:I(E.map(l=>l.name===e.name?{...l,name:t}:l))},()=>l("proj.nameSaved")),onDir:t=>void C({others:I(E.map(l=>l.name===e.name?{...l,rootDir:t}:l))},()=>l("proj.othersSaved",{n:E.length})),onBrowse:()=>void T(t=>void C({others:I(E.map(l=>l.name===e.name?{...l,rootDir:t}:l))},()=>l("proj.othersSaved",{n:E.length})),e.rootDir),onRemove:()=>{let t;t=e.name,C({others:I(E.filter(e=>e.name!==t))},e=>l("proj.othersSaved",{n:e.others.length}))},removeLabel:l("proj.otherRemove"),onFolders:t=>{let r;return r=e.name,C({others:I(E.map(e=>e.name===r?{...e,mirror:t}:e))},()=>l("proj.foldersSaved"))}},e.name)),(0,r.jsx)("h3",{id:"others",children:l("proj.addTitle")}),(0,r.jsx)("p",{className:"muted small",children:l("proj.othersIntro")}),(0,r.jsxs)("div",{className:"row",style:{marginTop:8},children:[(0,r.jsx)("input",{type:"text","aria-label":l("proj.entryName"),value:b,onChange:e=>N(e.target.value),placeholder:l("proj.entryName"),disabled:g,style:{width:160}}),(0,r.jsx)("input",{type:"text",className:"grow","aria-label":l("proj.entryDir"),value:w,onChange:e=>k(e.target.value),placeholder:"C:\\Projects\\my-app-tests",disabled:g}),(0,r.jsx)("button",{onClick:()=>void T(e=>k(e),w),disabled:g,children:l("mirror.browse")}),(0,r.jsx)("button",{className:"primary",onClick:()=>void B(),disabled:g||!b.trim()||!w.trim(),children:l("proj.otherAdd")})]}),(0,r.jsx)("h3",{children:l("proj.affects")}),(0,r.jsxs)("ul",{className:"muted small",style:{margin:0,paddingLeft:20},children:[(0,r.jsx)("li",{children:l("proj.affectsNew")}),(0,r.jsx)("li",{children:l("proj.affectsExisting")}),(0,r.jsx)("li",{children:l("proj.affectsPlan")}),(0,r.jsx)("li",{children:l("proj.affectsNever")})]})]})}function f(e){var l;let{name:t,dir:n,repoOk:s,repoProblem:a,mirror:i,isDefault:d=!1,busy:c,onName:u,onNameBlur:m,onDir:h,onDirBlur:x,onBrowse:j,onRemove:p,removeLabel:v,onFolders:f}=e,{t:y}=(0,o.kj)();return(0,r.jsxs)("div",{className:"panel inner",style:{marginTop:10},children:[(0,r.jsxs)("div",{className:"row",children:[(0,r.jsxs)("div",{style:{width:200},children:[(0,r.jsx)("label",{children:y("proj.entryName")}),(0,r.jsx)("input",{type:"text",value:t,onChange:e=>u(e.target.value),onBlur:m,placeholder:n?null!=(l=n.replace(/[\/]+$/,"").split(/[\/]/).pop())?l:"":y("proj.namePlaceholder"),disabled:c})]}),(0,r.jsxs)("div",{className:"grow",children:[(0,r.jsx)("label",{children:y("proj.entryDir")}),(0,r.jsx)("input",{type:"text",value:n,onChange:e=>h(e.target.value),onBlur:x,placeholder:"C:\\Projects\\my-app",disabled:c})]}),(0,r.jsx)("button",{onClick:j,disabled:c,children:y("mirror.browse")}),p&&(0,r.jsx)("button",{className:"quiet",onClick:p,disabled:c,children:v})]}),(0,r.jsxs)("div",{className:"row small",style:{marginTop:6},children:[d&&(0,r.jsx)("span",{className:"chip",title:y("proj.isDefaultWhy"),children:y("proj.isDefault")}),n&&(0,r.jsx)("span",{className:"badge ".concat(s?"done":""),title:s?y("proj.isRepo"):a,children:y(s?"proj.otherRepo":"proj.otherNotRepo")}),n&&!s&&(0,r.jsx)("span",{className:"muted",children:a||y("proj.notRepoWhy")})]}),n&&(0,r.jsxs)("details",{className:"small",style:{marginTop:8},children:[(0,r.jsx)("summary",{children:y("proj.folders")}),(0,r.jsx)(g,{rootDir:n,value:i,onSave:f,busy:c})]})]})}function g(e){var l,t,s,a;let{rootDir:i,value:c,onSave:m,busy:x}=e,{t:j}=(0,o.kj)(),[v,f]=(0,n.useState)((null!=(l=null==c?void 0:c.includeDirs)?l:[]).join("\n")),[g,y]=(0,n.useState)((null!=(t=null==c?void 0:c.excludeDirs)?t:[]).join("\n")),[b,N]=(0,n.useState)(null==(s=null==c?void 0:c.respectGitignore)||s),[w,k]=(0,n.useState)(null!=(a=null==c?void 0:c.includeEnvFiles)&&a),S=e=>e.split("\n").map(e=>e.trim()).filter(Boolean),[C,D]=(0,n.useState)(""),F=async e=>{let l={includeDirs:S(v),excludeDirs:S(g),respectGitignore:b,includeEnvFiles:w,...e};await m(l),D(j("proj.foldersSaved"))},R=h(F),M=async e=>{(!e||await (0,d.Z)(j("mirror.envWarn")))&&(k(e),F({includeEnvFiles:e}))};return(0,r.jsxs)("div",{style:{marginTop:8},children:[(0,r.jsx)("p",{className:"muted small",children:j("proj.foldersHint")}),(0,r.jsxs)("div",{className:"row",style:{alignItems:"flex-start"},children:[(0,r.jsxs)("div",{className:"grow",children:[(0,r.jsx)("label",{children:j("mirror.include")}),(0,r.jsx)("textarea",{value:v,onChange:e=>{f(e.target.value),R({includeDirs:S(e.target.value),excludeDirs:S(g)})},placeholder:"src\ntests",style:{minHeight:70}})]}),(0,r.jsxs)("div",{className:"grow",children:[(0,r.jsx)("label",{children:j("mirror.exclude")}),(0,r.jsx)("textarea",{value:g,onChange:e=>{y(e.target.value),R({includeDirs:S(v),excludeDirs:S(e.target.value)})},placeholder:"src/generated",style:{minHeight:70}})]})]}),(0,r.jsx)(u.k,{rootDir:i,respectGitignore:b,includeEnvFiles:w,include:S(v),exclude:S(g),onChange:(e,l)=>{f(e.join("\n")),y(l.join("\n")),R({includeDirs:e,excludeDirs:l})}}),(0,r.jsx)("div",{className:"option",children:(0,r.jsxs)("label",{children:[(0,r.jsx)("input",{type:"checkbox",checked:b,onChange:e=>{N(e.target.checked),F({respectGitignore:e.target.checked})}}),(0,r.jsx)("span",{children:j("mirror.gitignore")})]})}),(0,r.jsx)("div",{className:"option".concat(w?" warned":""),children:(0,r.jsxs)("label",{children:[(0,r.jsx)("input",{type:"checkbox",checked:w,onChange:e=>void M(e.target.checked)}),(0,r.jsx)("span",{children:j("mirror.env")})]})}),(0,r.jsx)(p,{msg:x?"":C})]})}function y(){let{t:e}=(0,o.kj)(),[l,t]=(0,n.useState)(null),s=(0,n.useRef)(null),a=(0,n.useRef)(Promise.resolve()),[d,c]=(0,n.useState)(2),[u,m]=(0,n.useState)(60),[j,v]=(0,n.useState)(240),[f,g]=(0,n.useState)("none"),[y,b]=(0,n.useState)("confirm"),[N,w]=(0,n.useState)("ask"),[k,S]=(0,n.useState)(""),[C,D]=(0,n.useState)("");(0,n.useEffect)(()=>{i.FH.settings().then(e=>{var l,r,n,a,i;s.current=e.raw,t(e.raw);let o=null!=(l=e.raw.limits)?l:{};c("number"==typeof o.retryBlockedInFreshChat?o.retryBlockedInFreshChat:2),m("number"==typeof o.maxIterations?o.maxIterations:60),v("number"==typeof o.maxRunMinutes?o.maxRunMinutes:240);let d=null!=(r=e.raw.execution)?r:{};g(null!=(n=d.isolation)?n:"none"),b(null!=(a=d.mode)?a:"confirm"),w(null!=(i=d.networkFetch)?i:"ask")}).catch(e=>D(e.message))},[]);let F=(l,r,n)=>{let o=async()=>{var a;let o=s.current;if(!o)return;let d={...o,[l]:{...null!=(a=o[l])?a:{},[r]:n}};S("");try{await i.FH.saveSettings(d),s.current=d,t(d),S(e("exec.saved")),D("")}catch(e){D(e.message)}},d=a.current.then(o);return a.current=d.catch(()=>void 0),d},R=h(e=>F("limits","retryBlockedInFreshChat",e)),M=h(e=>F("limits","maxIterations",e)),T=h(e=>F("limits","maxRunMinutes",e)),E=(e,l)=>F("execution",e,l);return(0,r.jsxs)("div",{className:"panel",id:"execution",children:[(0,r.jsx)("h2",{children:e("exec.title")}),(0,r.jsx)("p",{className:"muted small",children:e("exec.intro")}),C&&(0,r.jsx)("div",{className:"err",children:C}),(0,r.jsx)("label",{htmlFor:"retry-blocked",children:e("exec.retryBlocked")}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)(x,{id:"retry-blocked",value:d,min:0,max:5,onChange:e=>{c(e),R(e)},disabled:!l}),(0,r.jsx)("span",{className:"muted small",children:e("exec.retryBlockedTimes")})]}),(0,r.jsx)("p",{className:"why",children:e("exec.retryBlockedWhy")}),(0,r.jsx)("label",{htmlFor:"max-iterations",children:e("exec.maxIterations")}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)(x,{id:"max-iterations",value:u,min:5,max:200,onChange:e=>{m(e),M(e)},disabled:!l}),(0,r.jsx)("span",{className:"muted small",children:e("exec.maxIterationsUnit")})]}),(0,r.jsx)("p",{className:"why",children:e("exec.maxIterationsWhy")}),(0,r.jsx)("label",{htmlFor:"max-minutes",children:e("exec.maxRunMinutes")}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)(x,{id:"max-minutes",value:j,min:10,max:1440,onChange:e=>{v(e),T(e)},disabled:!l}),(0,r.jsx)("span",{className:"muted small",children:e("exec.maxRunMinutesUnit")})]}),(0,r.jsx)("p",{className:"why",children:e("exec.maxRunMinutesWhy")}),(0,r.jsx)("label",{htmlFor:"isolation",children:e("exec.isolation")}),(0,r.jsxs)("select",{id:"isolation",value:f,onChange:e=>{let l=e.target.value;g(l),E("isolation",l)},disabled:!l,children:[(0,r.jsx)("option",{value:"none",children:e("exec.isolationNone")}),(0,r.jsx)("option",{value:"none-accepted",children:e("exec.isolationNoneAccepted")}),(0,r.jsx)("option",{value:"separate-account",children:e("exec.isolationAccount")}),(0,r.jsx)("option",{value:"sandbox",children:e("exec.isolationSandbox")}),(0,r.jsx)("option",{value:"vm",children:e("exec.isolationVm")})]}),(0,r.jsx)("p",{className:"why",children:e("exec.isolationWhy")}),(0,r.jsx)("label",{htmlFor:"start-mode",children:e("exec.startMode")}),(0,r.jsxs)("select",{id:"start-mode",value:y,onChange:e=>{let l=e.target.value;b(l),E("mode",l)},disabled:!l,children:[(0,r.jsx)("option",{value:"confirm",children:e("exec.startModeAsk")}),(0,r.jsx)("option",{value:"unattended",children:e("exec.startModeAuto")})]}),(0,r.jsx)("p",{className:"why",children:e("exec.startModeWhy")}),(0,r.jsx)("label",{htmlFor:"network-fetch",children:e("exec.networkFetch")}),(0,r.jsxs)("select",{id:"network-fetch",value:N,onChange:e=>{let l=e.target.value;w(l),E("networkFetch",l)},disabled:!l,children:[(0,r.jsx)("option",{value:"ask",children:e("exec.networkFetchAsk")}),(0,r.jsx)("option",{value:"refuse",children:e("exec.networkFetchRefuse")}),(0,r.jsx)("option",{value:"run",children:e("exec.networkFetchRun")})]}),(0,r.jsx)(p,{msg:k}),(0,r.jsx)("p",{className:"why",children:e("exec.networkFetchWhy")})]})}function b(e){var l;let{catalogue:t,setCatalogue:s,refreshModels:a,refreshing:d,refreshMsg:u}=e,{t:m}=(0,o.kj)(),h=(0,o.W3)(),[x,j]=(0,n.useState)(""),[v,f]=(0,n.useState)(""),[g,y]=(0,n.useState)(!1),b=null!=(l=null==t?void 0:t.defaultModel)?l:"",N=async e=>{y(!0),j("");try{let l=await i.FH.setDefaultModel(e);t&&s({...t,defaultModel:l.defaultModel}),j(l.defaultModel?m("def.modelSaved",{name:l.defaultModel}):m("def.modelCleared")),f("")}catch(e){f(e.message)}finally{y(!1)}};return(0,r.jsxs)("div",{className:"panel",id:"model",children:[(0,r.jsx)("h2",{children:m("def.modelTitle")}),(0,r.jsx)("p",{className:"muted small",children:m("def.modelIntro")}),v&&(0,r.jsx)("div",{className:"err",children:v}),(0,r.jsx)("label",{htmlFor:"default-model",children:m("def.modelField")}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)(c.Y,{id:"default-model",chosen:b,onChange:e=>void N(e),none:m("def.modelNone"),catalogue:t,disabled:g||d}),(0,r.jsx)("button",{className:"quiet",onClick:()=>void N(""),disabled:g||!b,children:m("proj.clear")}),(0,r.jsx)("button",{onClick:()=>void a(),disabled:g||d,children:m("model.refresh")})]}),(0,r.jsx)(p,{msg:x||u}),(0,r.jsx)("p",{className:"muted small",style:{marginTop:8},children:(null==t?void 0:t.readAt)?m("model.readAt",{t:h(t.readAt),n:t.options.length}):m("model.neverRead")}),(0,r.jsx)("h3",{children:m("proj.affects")}),(0,r.jsxs)("ul",{className:"muted small",style:{margin:0,paddingLeft:20},children:[(0,r.jsx)("li",{children:m("def.modelAffectsNew")}),(0,r.jsx)("li",{children:m("def.modelAffectsExisting")}),(0,r.jsx)("li",{children:m("def.modelAffectsBatch")})]})]})}function N(e){var l,t;let{catalogue:s,setCatalogue:d,refreshModels:u,refreshing:m,refreshMsg:h}=e,{t:x}=(0,o.kj)(),[j,v]=(0,n.useState)(""),[f,g]=(0,n.useState)(""),[y,b]=(0,n.useState)(!1),N=null!=(l=null==s?void 0:s.defaultReviewModel)?l:"",w=async e=>{b(!0),v("");try{let l=await i.FH.setDefaultReviewModel(e);s&&d({...s,defaultReviewModel:l.defaultReviewModel}),v(l.defaultReviewModel?x("def.reviewSaved",{name:l.defaultReviewModel}):x("def.reviewCleared")),g("")}catch(e){g(e.message)}finally{b(!1)}},k=""!==N&&N===(null!=(t=null==s?void 0:s.defaultModel)?t:"");return(0,r.jsxs)("div",{className:"panel",id:"review",children:[(0,r.jsx)("h2",{children:x("def.reviewTitle")}),(0,r.jsx)("p",{className:"muted small",children:x("def.reviewIntro")}),f&&(0,r.jsx)("div",{className:"err",children:f}),(0,r.jsx)("label",{htmlFor:"default-review-model",children:x("def.reviewField")}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)(c.Y,{id:"default-review-model",chosen:N,onChange:e=>void w(e),none:x("def.reviewNone"),catalogue:s,disabled:y||m}),(0,r.jsx)("button",{className:"quiet",onClick:()=>void w(""),disabled:y||!N,children:x("proj.clear")}),(0,r.jsx)("button",{onClick:()=>void u(),disabled:y||m,children:x("model.refresh")})]}),k&&(0,r.jsx)("p",{className:"why",style:{color:"var(--warn)"},children:x("def.reviewSame")}),(0,r.jsx)(p,{msg:j||h}),(0,r.jsx)("h3",{children:x("proj.affects")}),(0,r.jsxs)("ul",{className:"muted small",style:{margin:0,paddingLeft:20},children:[(0,r.jsx)("li",{children:x("def.reviewAffectsNew")}),(0,r.jsx)("li",{children:x("def.reviewAffectsExisting")}),(0,r.jsx)("li",{children:x("def.reviewAffectsBatch")})]}),(0,r.jsxs)("div",{className:"row",style:{marginTop:12},children:[(0,r.jsx)(a(),{href:"/",children:(0,r.jsx)("button",{children:x("proj.toSessions")})}),(0,r.jsx)(a(),{href:"/import",children:(0,r.jsx)("button",{className:"quiet",children:x("proj.toImport")})})]})]})}},4784:(e,l,t)=>{"use strict";t.d(l,{Y:()=>i});var r=t(3365),n=t(1521),s=t(5549),a=t(867);function i(e){var l,t;let{id:i,chosen:o,onChange:d,none:c,catalogue:u,disabled:m=!1,style:h}=e,{t:x}=(0,a.kj)(),j=function(e){let[l,t]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(void 0!==e)return;let l=!0;return s.FH.models().then(e=>{l&&t(e)}).catch(()=>void 0),()=>{l=!1}},[e]),void 0!==e?e:l}(u),p=null!=(l=null==j?void 0:j.options)?l:[],v=p.some(e=>e.name===o),f=p.filter(e=>!e.group),g=new Map;for(let e of p)e.group&&g.set(e.group,[...null!=(t=g.get(e.group))?t:[],e]);return(0,r.jsxs)("select",{id:i,value:o,onChange:e=>d(e.target.value),disabled:m,style:{width:"auto",minWidth:280,...h},children:[(0,r.jsx)("option",{value:"",children:c}),o&&!v&&(0,r.jsx)("option",{value:o,children:x("model.notInList",{name:o})}),f.map(e=>(0,r.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(x("model.unavailable")):""]},e.name)),[...g.entries()].map(e=>{let[l,t]=e;return(0,r.jsx)("optgroup",{label:l,children:t.map(e=>(0,r.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(x("model.unavailable")):""]},e.name))},l)})]})}}},e=>{e.O(0,[197,867,549,347,131,358],()=>e(e.s=1896)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[810],{3256:(e,s,t)=>{Promise.resolve().then(t.bind(t,4627))},4627:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>w});var n=t(3365),a=t(1521),l=t(8197),r=t.n(l),i=t(5549),d=t(3523),c=t(3374),o=t(867),u=t(1910),h=t(5132);function m(){let{t:e}=(0,o.kj)(),[s,t]=(0,a.useState)(!1);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"info-dot","aria-expanded":s,"aria-label":e("row.info"),title:e("row.info"),onClick:()=>t(e=>!e),children:"i"}),s&&(0,n.jsxs)("div",{className:"notice info-panel",children:[(0,n.jsx)("strong",{children:e("row.infoTitle")}),(0,n.jsxs)("dl",{className:"small",children:[(0,n.jsx)("dt",{children:e("reg.openTask")}),(0,n.jsx)("dd",{children:e("row.infoOpenTask")}),(0,n.jsx)("dt",{children:e("save.log")}),(0,n.jsx)("dd",{children:e("save.why")}),(0,n.jsx)("dt",{children:e("home.col.chat")}),(0,n.jsx)("dd",{children:e("row.infoChat")})]}),(0,n.jsx)("div",{className:"small",style:{marginTop:6},children:e("row.infoExports")}),(0,n.jsxs)("dl",{className:"small",children:[(0,n.jsx)("dt",{children:e("reg.exportPlan")}),(0,n.jsx)("dd",{children:e("reg.exportPlanWhy")}),(0,n.jsx)("dt",{children:e("reg.exportDomain")}),(0,n.jsx)("dd",{children:e("reg.exportDomainWhy")}),(0,n.jsx)("dt",{children:e("reg.exportBot")}),(0,n.jsx)("dd",{children:e("reg.exportBotWhy")})]}),(0,n.jsx)(h.s,{text:e("row.infoWhich"),className:"small"})]})]})}function g(e){let{onChange:s}=e,{t}=(0,o.kj)(),[l,r]=(0,a.useState)(null),[d,c]=(0,a.useState)(!1),[u,h]=(0,a.useState)(""),m=(0,a.useCallback)(async()=>{try{r(await i.FH.batch())}catch(e){}},[]);(0,a.useEffect)(()=>{m();let e=setInterval(()=>void m(),3e3);return()=>clearInterval(e)},[m]);let g=async e=>{c(!0),h("");try{"pause"===e?await i.FH.pauseBatch():"resume"===e?await i.FH.resumeBatch():await i.FH.stopBatch(),await m(),null==s||s()}catch(e){h(e.message)}finally{c(!1)}};return(null==l?void 0:l.running)?(0,n.jsxs)("div",{className:"row",style:{marginBottom:8},children:[l.pausing?(0,n.jsx)("button",{className:"primary",disabled:d,onClick:()=>void g("resume"),title:t("batch.resumeWhy"),children:t("batch.resume")}):(0,n.jsx)("button",{disabled:d||l.stopping,onClick:()=>void g("pause"),title:t("batch.pauseWhy"),children:t("batch.pause")}),(0,n.jsx)("button",{className:"danger",disabled:d||l.stopping,onClick:()=>void g("stop"),title:t("batch.stopWhy"),children:t("batch.stop")}),l.pausing&&!l.stopping&&(0,n.jsx)("span",{className:"muted small",children:t("batch.pausing")}),l.stopping&&(0,n.jsx)("span",{className:"muted small",children:t("batch.stopping")}),u&&(0,n.jsx)("span",{className:"err small",children:u})]}):null}var x=t(3041),p=t(1035),j=t(4811),v=t(7619);let N=["queued","running","waiting-approval"],k=["blocked","failed","aborted","limit-reached"];function f(e){let{run:s}=e,{t}=(0,o.kj)(),a=s.entries.some(d.DG),l=(0,c.c)(a),r=(0,d.eZ)(s,s.entries,l);return(0,n.jsx)(n.Fragment,{children:t(r.live?"reg.runRunning":"reg.runTook",{d:(0,i.c5)(r.ms)})})}function b(e){let s=new Map,t=[];for(let n of e){if(!n.runGroup){t.push(n);continue}let e=s.get(n.runGroup.id);e?e.entries.push(n):s.set(n.runGroup.id,{...n.runGroup,entries:[n]})}let n=[...s.values()].sort((e,s)=>Date.parse(s.startedAt)-Date.parse(e.startedAt));for(let e of n)e.entries.sort((e,s)=>{var t,n;return Date.parse(null!=(t=e.startedAt)?t:e.createdAt)-Date.parse(null!=(n=s.startedAt)?n:s.createdAt)});return{runs:n,loose:t}}function w(){let{t:e}=(0,o.kj)(),s=(0,o.W3)(),[t,l]=(0,a.useState)(null),[r,d]=(0,a.useState)(""),[c,u]=(0,a.useState)(""),[h,m]=(0,a.useState)("flow"),[x,p]=(0,a.useState)(""),[j,v]=(0,a.useState)(""),[f,w]=(0,a.useState)(""),I=(0,a.useCallback)(async()=>{try{l(await i.FH.tasks()),u(new Date().toISOString()),d("")}catch(e){d(e.message)}},[]);(0,a.useEffect)(()=>{I();let e=setInterval(()=>void I(),6e3);return()=>clearInterval(e)},[I]);let F=(0,a.useMemo)(()=>{let e=new Map;for(let s of null!=t?t:[])e.has(s.sessionId)||e.set(s.sessionId,s.sessionName);return[...e.entries()]},[t]),R=(0,a.useMemo)(()=>{let e=f.trim().toLowerCase();return(null!=t?t:[]).filter(s=>{var t,n;return(!x||s.sessionId===x)&&(!j||s.status===j)&&(!e||"".concat(s.title," ").concat(null!=(t=s.summary)?t:""," ").concat(null!=(n=s.reason)?n:""," ").concat(s.sessionName).toLowerCase().includes(e))})},[t,x,j,f]),W=(0,a.useMemo)(()=>{let e=null!=t?t:[];return{total:e.length,done:e.filter(e=>"done"===e.status).length,running:e.filter(e=>"running"===e.status||"waiting-approval"===e.status).length,open:e.filter(e=>"queued"===e.status).length,failed:e.filter(e=>k.includes(e.status)).length}},[t]),G=(0,a.useMemo)(()=>{let e=new Map;for(let n of null!=t?t:[]){var s;n.runGroup&&e.set(n.runGroup.id,(null!=(s=e.get(n.runGroup.id))?s:0)+1)}return e},[t]),P=(0,a.useMemo)(()=>b(R),[R]),H=R.filter(e=>"running"===e.status||"waiting-approval"===e.status),D=R.filter(e=>"queued"===e.status),E=[...R.filter(e=>k.includes(e.status)&&"stop"===e.sessionOnFailure&&!e.sessionRunning&&D.some(s=>s.sessionId===e.sessionId)),...D].sort((e,s)=>{var t,n;return(null!=(t=e.sessionRunOrder)?t:Number.MAX_SAFE_INTEGER)-(null!=(n=s.sessionRunOrder)?n:Number.MAX_SAFE_INTEGER)||e.position-s.position}),M=R.filter(e=>!N.includes(e.status)).sort((e,s)=>{var t,n,a,l;return Date.parse(null!=(n=null!=(t=s.finishedAt)?t:s.startedAt)?n:s.createdAt)-Date.parse(null!=(l=null!=(a=e.finishedAt)?a:e.startedAt)?l:e.createdAt)}),O=""!==x||""!==j||""!==f.trim();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("h2",{className:"grow",style:{margin:0},children:e("reg.title")}),(0,n.jsx)("span",{className:"muted small",children:c&&e("reg.updated",{t:s(c)})}),(0,n.jsx)("button",{className:"quiet",onClick:()=>void I(),children:e("reg.refresh")})]}),(0,n.jsx)("p",{className:"muted small",children:e("reg.hint")}),(0,n.jsx)(A,{sessions:F}),(0,n.jsxs)("div",{className:"counts",children:[(0,n.jsxs)("div",{className:"count",children:[(0,n.jsx)("div",{className:"n",children:W.total}),(0,n.jsx)("div",{className:"k",children:e("reg.total")})]}),(0,n.jsxs)("div",{className:"count done",children:[(0,n.jsx)("div",{className:"n",children:W.done}),(0,n.jsx)("div",{className:"k",children:e("reg.done")})]}),(0,n.jsxs)("div",{className:"count running",children:[(0,n.jsx)("div",{className:"n",children:W.running}),(0,n.jsx)("div",{className:"k",children:e("reg.runningCount")})]}),(0,n.jsxs)("div",{className:"count queued",children:[(0,n.jsx)("div",{className:"n",children:W.open}),(0,n.jsx)("div",{className:"k",children:e("reg.open")})]}),(0,n.jsxs)("div",{className:"count failed",children:[(0,n.jsx)("div",{className:"n",children:W.failed}),(0,n.jsx)("div",{className:"k",children:e("reg.failedCount")})]})]})]}),r&&(0,n.jsx)("div",{className:"panel err",children:r}),(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsxs)("div",{className:"toolbar",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"f-session",style:{margin:0},children:e("reg.filterSession")}),(0,n.jsxs)("select",{id:"f-session",value:x,onChange:e=>p(e.target.value),children:[(0,n.jsx)("option",{value:"",children:e("reg.allSessions")}),F.map(e=>{let[s,t]=e;return(0,n.jsx)("option",{value:s,children:t},s)})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"f-status",style:{margin:0},children:e("reg.filterStatus")}),(0,n.jsxs)("select",{id:"f-status",value:j,onChange:e=>v(e.target.value),children:[(0,n.jsx)("option",{value:"",children:e("reg.allStatuses")}),["queued","running","waiting-approval","done","blocked","failed","aborted","limit-reached"].map(s=>(0,n.jsx)("option",{value:s,children:e("status.".concat(s))},s))]})]}),(0,n.jsxs)("div",{className:"grow",children:[(0,n.jsx)("label",{htmlFor:"f-q",style:{margin:0},children:e("reg.search")}),(0,n.jsx)("input",{id:"f-q",type:"text",value:f,onChange:e=>w(e.target.value),placeholder:e("reg.searchPlaceholder")})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{style:{margin:0},id:"view-label",children:e("reg.viewLabel")}),(0,n.jsxs)("div",{className:"segmented",role:"group","aria-labelledby":"view-label",children:[(0,n.jsx)("button",{type:"button","aria-pressed":"flow"===h,onClick:()=>m("flow"),children:e("reg.viewFlow")}),(0,n.jsx)("button",{type:"button","aria-pressed":"runs"===h,onClick:()=>m("runs"),children:e("reg.groupBy")}),(0,n.jsx)("button",{type:"button","aria-pressed":"list"===h,onClick:()=>m("list"),children:e("reg.viewList")})]})]}),O&&(0,n.jsx)("button",{className:"quiet",onClick:()=>{p(""),v(""),w("")},children:e("reg.clear")})]}),null===t&&(0,n.jsx)("div",{className:"muted",children:e("home.loading")}),null!==t&&0===t.length&&(0,n.jsx)("div",{className:"empty",children:e("reg.none")}),null!==t&&t.length>0&&0===R.length&&(0,n.jsx)("div",{className:"empty",children:e("reg.noMatch")})]}),"list"===h&&R.length>0&&(0,n.jsx)(q,{entries:[...H,...D,...M]}),"runs"===h&&R.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("h2",{children:e("reg.runGroup")}),(0,n.jsx)("p",{className:"muted small",children:e("reg.runGroupHint")})]}),P.runs.map(e=>(0,n.jsxs)("section",{className:"panel",children:[(0,n.jsx)(C,{run:e}),(0,n.jsx)(y,{entries:e.entries,sizes:G,onChange:()=>void I()})]},e.id)),P.loose.length>0&&(0,n.jsxs)("section",{className:"panel",children:[(0,n.jsx)("h2",{children:e("reg.notInARun")}),(0,n.jsx)("p",{className:"muted small",children:e("reg.notInARunHint")}),(0,n.jsx)(y,{entries:P.loose,sizes:G,onChange:()=>void I()})]})]}),"flow"===h&&(0,n.jsxs)(n.Fragment,{children:[H.length>0&&(0,n.jsxs)("section",{className:"panel",children:[(0,n.jsx)("h2",{children:e("reg.activeNow")}),(0,n.jsx)(y,{entries:H,sizes:G,onChange:()=>void I()})]}),R.length>0&&(0,n.jsxs)("section",{className:"panel",children:[(0,n.jsx)("h2",{children:e("reg.upcoming")}),(0,n.jsx)("p",{className:"muted small",children:e("reg.upcomingHint")}),(0,n.jsx)(g,{onChange:()=>void I()}),(0,n.jsx)(T,{entries:R,onChange:()=>void I()}),0===E.length?(0,n.jsx)("div",{className:"empty",children:e("reg.noUpcoming")}):(0,n.jsx)(y,{entries:E,upcoming:!0,sizes:G,onChange:()=>void I()})]}),R.length>0&&(0,n.jsxs)("section",{className:"panel",children:[(0,n.jsx)("h2",{children:e("reg.past")}),(0,n.jsx)("p",{className:"muted small",children:e("reg.pastHint")}),0===M.length?(0,n.jsx)("div",{className:"empty",children:e("reg.noPast")}):(0,n.jsx)(S,{entries:M,sizes:G,onChange:()=>void I()})]})]})]})}function y(e){let{entries:s,upcoming:t=!1,sizes:l,onChange:g,picking:p}=e,{t:j}=(0,o.kj)(),N=(0,o.W3)(),f=(0,x.e)(null!=g?g:()=>void 0),b=(0,c.c)(s.some(d.DG)),[w,y]=(0,a.useState)(null),[C,S]=(0,a.useState)(new Set);return(0,n.jsxs)(n.Fragment,{children:[w&&(0,n.jsx)(F,{entry:w,onClose:e=>{y(null),e&&(null==g||g())}}),(0,n.jsx)("ol",{className:"flow",children:s.map(e=>{var s,a,c,o,g,x,w,F,A,T,q,R,W,G,P,H,D,E,M,O,_,B;let L=t&&1===e.queuePosition,z=e.runGroup?null!=(w=null==l?void 0:l.get(e.runGroup.id))?w:1:0;return(0,n.jsxs)("li",{className:"".concat(e.status).concat(L?" next":""),children:[(0,n.jsxs)("div",{className:"head",children:[p&&(0,n.jsx)("input",{type:"checkbox",className:"pick","aria-label":e.title,checked:p.picked.has("".concat(e.sessionId,":").concat(e.taskId)),onChange:()=>p.toggle("".concat(e.sessionId,":").concat(e.taskId))}),(0,n.jsx)("strong",{children:e.title}),(0,n.jsx)("span",{className:"badge ".concat(e.status),children:j("status.".concat(e.status))}),L&&(0,n.jsx)("span",{className:"chip",children:j("reg.next")}),t&&k.includes(e.status)&&(0,n.jsx)("span",{className:"chip",title:j("reg.willRequeueFirstWhy"),children:j("reg.willRequeueFirst")}),e.sessionRunning&&(0,n.jsx)("span",{className:"chip",children:j("reg.sessionRunning")}),e.review&&"skipped"!==e.review.verdict&&(0,n.jsxs)("span",{className:"badge ".concat("pass"===e.review.verdict?"done":"fail"===e.review.verdict?"blocked":"waiting-approval"),title:e.review.stepsRun>0?j("review.ran",{n:e.review.stepsRun}):void 0,children:[j("review.verdict.".concat(e.review.verdict)),e.review.findings>0?" (".concat(e.review.findings,")"):""]}),(null!=(F=e.deviations)?F:0)>0&&(0,n.jsx)("span",{className:"badge waiting-approval",title:j("reg.deviationsWhy"),children:j("reg.deviations",{n:null!=(A=e.deviations)?A:0})}),(null!=(T=e.disputes)?T:0)>0&&(0,n.jsx)("span",{className:"badge waiting-approval",title:j("reg.disputesWhy"),children:j("reg.disputes",{n:null!=(q=e.disputes)?q:0})}),e.readOnly&&(0,n.jsx)("span",{className:"chip",title:j("reg.readOnlyWhy"),children:j("task.readOnly")}),(null!=(R=e.autoRetries)?R:0)>0&&(0,n.jsx)("span",{className:"badge ".concat("done"===e.status?"done":"blocked"),title:j("reg.retriedFreshWhy"),children:"done"===e.status?j("reg.retriedFreshDone",{n:null!=(W=e.autoRetries)?W:0}):j("reg.retriedFreshStill",{n:null!=(G=e.autoRetries)?G:0})}),e.runGroup&&(0,n.jsx)("span",{className:"chip",title:j("reg.runTitle",{t:z,s:e.runGroup.sessions,when:N(e.runGroup.startedAt)}),children:z>1?j("reg.runWith",{n:z-1}):j("reg.runAlone")})]}),(0,n.jsxs)("div",{className:"when",children:[(0,n.jsx)(r(),{href:(0,i.aT)(e.sessionId),children:e.sessionName})," \xb7 ",e.startedAt?j("task.started",{t:N(e.startedAt)}):j("task.added",{t:N(e.createdAt)}),e.finishedAt?" \xb7 ".concat(j("task.finished",{t:N(e.finishedAt)})):"",void 0!==e.durationMs?" \xb7 ".concat(j("reg.took",{d:(0,i.c5)(e.durationMs)})):"",(0,d.DG)(e)?" \xb7 ".concat(j("task.runningFor",{d:(0,i.c5)((0,d.d5)(e.startedAt,void 0,b))})):"",e.iterations>0?" \xb7 ".concat(j("reg.iterations",{n:e.iterations})):""]}),"queued"===e.status&&(0,n.jsx)("div",{className:"when",children:e.queuePosition&&e.queuePosition>1?j("reg.willFollow",{n:e.queuePosition-1}):e.sessionRunning?j("reg.queuePos",{n:null!=(P=e.queuePosition)?P:1}):j("reg.waitingRun")}),"blocked"===e.status&&(0,n.jsx)("p",{className:"what muted small",children:j("reg.blockedWhat")}),(null!=(H=null==(s=e.attempts)?void 0:s.length)?H:0)>0&&(0,n.jsxs)("details",{className:"small",style:{marginTop:6},children:[(0,n.jsx)("summary",{children:(null!=(D=null==(a=e.attempts)?void 0:a.length)?D:0)===1?j("reg.attemptsOne",{n:null!=(M=e.attempt)?M:(null!=(E=null==(c=e.attempts)?void 0:c.length)?E:0)+1}):j("reg.attempts",{n:null!=(_=e.attempt)?_:(null!=(O=null==(o=e.attempts)?void 0:o.length)?O:0)+1,m:null!=(B=null==(g=e.attempts)?void 0:g.length)?B:0})}),(0,n.jsx)("ol",{className:"attempts",children:null==(x=e.attempts)?void 0:x.map(s=>{var t;return(0,n.jsxs)("li",{children:[(0,n.jsxs)("div",{className:"head",children:[(0,n.jsx)("strong",{children:j("reg.attemptN",{n:s.attempt})}),(0,n.jsx)("span",{className:"badge ".concat(s.status),children:j("status.".concat(s.status))}),s.iterations>0&&(0,n.jsx)("span",{className:"muted",children:j("reg.iterations",{n:s.iterations})}),void 0!==s.durationMs&&(0,n.jsx)("span",{className:"muted",children:j("reg.took",{d:(0,i.c5)(s.durationMs)})}),s.runId&&(0,n.jsx)(u.u,{label:j("save.attemptLog"),save:()=>i.FH.saveTaskLog(e.sessionId,e.taskId,s.runId)}),s.runId&&(0,n.jsx)(u.H,{sessionId:e.sessionId,taskId:e.taskId,attempt:s.attempt})]}),(0,n.jsxs)("div",{className:"when",children:[s.startedAt?j("task.started",{t:N(s.startedAt)}):"",s.finishedAt?" \xb7 ".concat(j("task.finished",{t:N(s.finishedAt)})):"",s.branch?" \xb7 ".concat(s.branch):""]}),s.reason&&(0,n.jsx)("p",{className:"what err",children:j("reg.stopped",{reason:s.reason})}),s.summary&&(0,n.jsx)(h.s,{text:s.summary,className:"what"})]},"".concat(null!=(t=s.runId)?t:s.attempt))})})]}),e.summary&&(0,n.jsx)(h.s,{text:e.summary,className:"what"}),e.reason&&(0,n.jsx)("p",{className:"what err",children:j("reg.stopped",{reason:e.reason})}),f.message&&(0,n.jsx)("p",{className:"what small",children:f.message}),(0,n.jsxs)("div",{className:"row small",style:{marginTop:6},children:[(0,n.jsx)(r(),{href:(0,i.aT)(e.sessionId,e.taskId),children:j("reg.openTask")}),e.runId&&(0,n.jsx)(u.u,{label:j("save.log"),save:()=>i.FH.saveTaskLog(e.sessionId,e.taskId)}),e.chatUrl&&(0,n.jsx)("a",{href:e.chatUrl,target:"_blank",rel:"noreferrer",children:j("home.col.chat")}),e.startedAt&&(0,n.jsx)(I,{where:{session:e.sessionId,task:e.taskId}}),(0,n.jsx)(m,{}),e.runId&&(0,n.jsxs)("button",{className:C.has(e.taskId)?"":"quiet",onClick:()=>{let s;return s=e.taskId,S(e=>{let t=new Set(e);return t.has(s)?t.delete(s):t.add(s),t})},title:(0,d.DG)(e)?j("story.showLiveWhy"):j("story.why"),children:[(0,d.DG)(e)&&!C.has(e.taskId)&&(0,n.jsx)("span",{className:"dot","aria-hidden":"true"}),C.has(e.taskId)?j("story.hide"):(0,d.DG)(e)?j("story.showLive"):j("story.show")]}),k.includes(e.status)&&!e.sessionRunning&&(0,n.jsx)("button",{className:"quiet",onClick:()=>y(e),title:j("reg.fixPromptHint"),children:j("reg.fixPrompt")}),e.startedAt&&!e.sessionRunning&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{className:"quiet",disabled:""!==f.busy,title:j("restore.why"),onClick:()=>void f.restore({sessionId:e.sessionId,taskId:e.taskId,title:e.title}),children:"restore"===f.busy?j("restore.checking"):j("restore.button")}),(0,n.jsx)("button",{className:"quiet",disabled:""!==f.busy,title:j("restart.why"),onClick:()=>void f.restartFrom({sessionId:e.sessionId,taskId:e.taskId,title:e.title}),children:"restart"===f.busy?j("restart.checking"):j("restart.button")})]})]}),C.has(e.taskId)&&e.runId&&(0,n.jsx)(v.P,{sessionId:e.sessionId,taskId:e.taskId,live:"running"===e.status||"waiting-approval"===e.status})]},"".concat(e.sessionId,"-").concat(e.taskId))})})]})}function I(e){let{where:s}=e,{t}=(0,o.kj)();return(0,n.jsxs)("span",{className:"exports",title:t("reg.exportTitle"),children:[(0,n.jsxs)("span",{className:"muted",children:[t("reg.exportTitle"),":"]})," ",(0,n.jsx)("a",{href:i.FH.exportUrl("plan",s),title:t("reg.exportPlanWhy"),children:t("reg.exportPlan")})," \xb7 ",(0,n.jsx)("a",{href:i.FH.exportUrl("domain",s),title:t("reg.exportDomainWhy"),children:t("reg.exportDomain")})," \xb7 ",(0,n.jsx)("a",{href:i.FH.exportUrl("bot",s),title:t("reg.exportBotWhy"),children:t("reg.exportBot")})]})}function C(e){var s;let{run:t}=e,{t:a}=(0,o.kj)(),l=(0,o.W3)(),r=null!=(s=t.entries.map(e=>{var s;return null==(s=e.runGroup)?void 0:s.name}).find(Boolean))?s:a("reg.runUnnamed"),i=t.entries.filter(e=>"done"===e.status).length,d=t.entries.filter(e=>k.includes(e.status)).length;return(0,n.jsxs)("div",{className:"run-heading",children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("h2",{className:"grow",style:{margin:0},children:r}),(0,n.jsxs)("span",{className:"muted small",children:[a("reg.runOf",{t:t.entries.length,s:t.sessions})," \xb7 ",a("reg.runAt",{when:l(t.startedAt)})," \xb7 ",(0,n.jsx)(f,{run:t})]})]}),(0,n.jsxs)("div",{className:"row small",style:{marginTop:4},children:[(0,n.jsx)("span",{className:"badge ".concat(d>0?"failed":i===t.entries.length?"done":""),children:a("reg.runCounts",{done:i,failed:d})}),(0,n.jsx)(I,{where:{run:t.id}})]})]})}function S(e){let{entries:s,sizes:t,onChange:l}=e,{t:r}=(0,o.kj)(),d=(0,a.useMemo)(()=>b(s),[s]),[c,u]=(0,a.useState)(!1),[h,m]=(0,a.useState)(new Set),[g,x]=(0,a.useState)(!1),[p,j]=(0,a.useState)(""),[v,N]=(0,a.useState)(""),k=e=>"".concat(e.sessionId,":").concat(e.taskId),f=s.filter(e=>e.startedAt),w=[...h],I=async()=>{x(!0),N(""),j("");try{let e=await i.FH.downloadBundle(w.map(e=>{let[s,t]=e.split(":");return{sessionId:s,taskId:t}}));j(r("reg.bundleSaved",{name:e}))}catch(e){N(e.message)}finally{x(!1)}},S=c?{picked:h,toggle:e=>m(s=>{let t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})}:void 0;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"row small",style:{marginBottom:8},children:[c?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{className:"quiet",onClick:()=>{u(!1),m(new Set),j(""),N("")},children:r("reg.pickDone")}),(0,n.jsx)("button",{className:"quiet",onClick:()=>m(new Set(f.map(k))),children:r("reg.pickAll")}),(0,n.jsx)("button",{className:"quiet",onClick:()=>m(new Set),children:r("reg.pickNone")}),(0,n.jsx)("span",{className:"muted",children:h.size>0?r("reg.pickedN",{n:h.size}):r("reg.pickedNone")}),h.size>0&&(0,n.jsx)("button",{className:"primary",disabled:g,onClick:()=>void I(),title:r("reg.bundleWhy"),children:r("reg.bundle",{n:h.size})})]}):(0,n.jsx)("button",{className:"quiet",onClick:()=>u(!0),title:r("reg.pickWhy"),children:r("reg.pick")}),p&&(0,n.jsx)("span",{className:"muted",children:p}),v&&(0,n.jsx)("span",{className:"err",children:v})]}),d.runs.map((e,s)=>(0,n.jsxs)("details",{className:"run-fold",open:0===s||c,children:[(0,n.jsx)("summary",{children:(0,n.jsx)(C,{run:e})}),(0,n.jsx)(y,{entries:e.entries,sizes:t,onChange:l,picking:S})]},e.id)),d.loose.length>0&&(0,n.jsxs)("details",{className:"run-fold",open:0===d.runs.length||c,children:[(0,n.jsx)("summary",{children:(0,n.jsxs)("div",{className:"run-heading",children:[(0,n.jsx)("h2",{style:{margin:0},children:r("reg.notInARun")}),(0,n.jsx)("p",{className:"muted small",style:{margin:"4px 0 0"},children:r("reg.notInARunHint")})]})}),(0,n.jsx)(y,{entries:d.loose,sizes:t,onChange:l,picking:S})]})]})}function F(e){let{entry:s,onClose:t}=e,{t:l}=(0,o.kj)(),[r,d]=(0,a.useState)(null),[c,u]=(0,a.useState)(""),[h,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=!0;return i.FH.session(s.sessionId).then(t=>{var n;let a=t.tasks.find(e=>e.id===s.taskId);e&&d(null!=(n=null==a?void 0:a.prompt)?n:"")}).catch(s=>{e&&u(s.message)}),()=>{e=!1}},[s.sessionId,s.taskId]);let g=async()=>{if(null!==r){m(!0),u("");try{await i.FH.rerunTask(s.sessionId,s.taskId,{prompt:r}),u(l("reg.fixPromptSaved",{title:s.title})),setTimeout(()=>t(!0),900)}catch(e){u(e.message),m(!1)}}};return(0,n.jsx)("div",{className:"modal-backdrop",role:"presentation",onClick:()=>t(!1),children:(0,n.jsxs)("div",{className:"modal wide",role:"dialog","aria-modal":"true","aria-labelledby":"fix-title",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{id:"fix-title",children:l("reg.fixPromptTitle",{title:s.title})}),(0,n.jsx)("p",{className:"muted small",children:l("reg.fixPromptHint")}),s.reason&&(0,n.jsx)("p",{className:"what err small",children:l("reg.stopped",{reason:s.reason})}),null===r?(0,n.jsx)("p",{className:"muted small",children:c||l("reg.fixPromptLoading")}):(0,n.jsx)("textarea",{className:"prose",value:r,onChange:e=>d(e.target.value),style:{minHeight:260},disabled:h}),(0,n.jsxs)("div",{className:"row modal-actions",children:[c&&null!==r&&(0,n.jsx)("span",{className:"small grow",children:c}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>t(!1),disabled:h,children:l("dialog.cancel")}),(0,n.jsx)("button",{type:"button",className:"primary",onClick:()=>void g(),disabled:h||null===r||!r.trim(),children:l("reg.fixPromptSave")})]})]})})}function A(e){let{sessions:s}=e,{t}=(0,o.kj)();return(0,n.jsxs)("div",{className:"row",style:{margin:"14px 0 18px"},children:[(0,n.jsx)(r(),{href:"/#new-session",children:(0,n.jsx)("button",{className:"primary",children:t("reg.newSession")})}),s.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("label",{htmlFor:"new-task-session",style:{margin:0},children:[t("reg.newTask")," ",t("reg.newTaskIn")]}),(0,n.jsxs)("select",{id:"new-task-session",value:"",onChange:e=>{e.target.value&&(window.location.href=(0,i.aT)(e.target.value,"new-task"))},style:{width:"auto",minWidth:200},children:[(0,n.jsx)("option",{value:"",children:t("reg.newTaskPick")}),s.map(e=>{let[s,t]=e;return(0,n.jsx)("option",{value:s,children:t},s)})]})]})]})}function T(e){let{entries:s,onChange:t}=e,{t:l}=(0,o.kj)(),[r,d]=(0,a.useState)(!1),[c,u]=(0,a.useState)(""),[h,m]=(0,a.useState)(!1),[g,x]=(0,a.useState)(new Set),[v,N]=(0,a.useState)(null),f=s.filter(e=>"queued"===e.status),b=s.filter(e=>k.includes(e.status)&&!e.sessionRunning),w=s.some(e=>e.sessionRunning),y=b.filter(e=>"stop"===e.sessionOnFailure),I=b.filter(e=>"stop"!==e.sessionOnFailure),C=[...y,...I.filter(e=>g.has(e.taskId))],S=[...new Set([...f,...C].sort((e,s)=>{var t,n;return(null!=(t=e.sessionRunOrder)?t:Number.MAX_SAFE_INTEGER)-(null!=(n=s.sessionRunOrder)?n:Number.MAX_SAFE_INTEGER)||e.position-s.position}).map(e=>e.sessionId))],[A,T]=(0,a.useState)(""),q=y.length>0?l("reg.continueWithFailed",{f:y.length,n:f.length,s:S.length}):l("reg.continue",{n:f.length,s:S.length}),R=(0,j.p)(),W=async e=>{if("unattended"!==e||R||await (0,p.Z)(l("batch.unattendedConfirm",{n:S.length}))){d(!0),u("");try{var s;for(let e of C)await i.FH.rerunTask(e.sessionId,e.taskId);let n=await i.FH.startBatch(S,e,"stop",void 0,void 0,A.trim()||void 0);u(n.started?l("reg.continueStarted",{n:S.length}):l("batch.notStarted",{reason:null!=(s=n.reason)?s:""})),m(!1),t()}catch(e){u(e.message)}finally{d(!1)}}};return 0===f.length&&0===b.length?null:(0,n.jsxs)("div",{style:{marginBottom:8},children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("button",{className:"primary",disabled:r||w,onClick:()=>{x(new Set(I.map(e=>e.taskId))),m(!0),u(""),i.FH.suggestedRunName(S).then(e=>T(e.name)).catch(()=>void 0)},title:l("reg.continueWhy"),children:q}),w&&(0,n.jsx)("span",{className:"muted small",children:l("reg.continueRunning")}),c&&(0,n.jsx)("span",{className:"small",children:c})]}),h&&!w&&(0,n.jsxs)("div",{className:"notice",style:{marginTop:8},children:[(0,n.jsx)("strong",{children:l("reg.continuePanelTitle")}),y.length>0&&(0,n.jsxs)("div",{style:{marginTop:6},children:[(0,n.jsx)("div",{className:"small",children:l("reg.continueChain")}),(0,n.jsx)("ul",{className:"small",style:{margin:"4px 0",paddingLeft:18},children:y.map(e=>(0,n.jsxs)("li",{children:[(0,n.jsx)("strong",{children:e.title})," \xb7 ",e.sessionName," \xb7 ",(0,n.jsx)("span",{className:"badge ".concat(e.status),children:l("status.".concat(e.status))})," ",(0,n.jsx)("button",{className:"quiet small",onClick:()=>N(e),children:l("reg.fixPrompt")})]},e.taskId))})]}),I.length>0&&(0,n.jsxs)("div",{style:{marginTop:6},children:[(0,n.jsx)("div",{className:"small",children:l("reg.continueIndependent")}),(0,n.jsx)("ul",{className:"small",style:{margin:"4px 0",paddingLeft:18,listStyle:"none"},children:I.map(e=>(0,n.jsx)("li",{children:(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:g.has(e.taskId),onChange:s=>x(t=>{let n=new Set(t);return s.target.checked?n.add(e.taskId):n.delete(e.taskId),n})}),(0,n.jsx)("strong",{children:e.title})," \xb7 ",e.sessionName," \xb7 ",(0,n.jsx)("span",{className:"badge ".concat(e.status),children:l("status.".concat(e.status))})]})},e.taskId))})]}),(0,n.jsxs)("div",{style:{marginTop:8},children:[(0,n.jsx)("label",{htmlFor:"continue-run-name",children:l("batch.runName")}),(0,n.jsx)("input",{id:"continue-run-name",type:"text",value:A,onChange:e=>T(e.target.value),placeholder:l("batch.runNamePlaceholder"),disabled:r}),(0,n.jsx)("p",{className:"why",children:l("reg.continueNameWhy")})]}),(0,n.jsx)("div",{className:"small",style:{marginTop:6},children:l("reg.continueSummary",{q:f.length,r:C.length,s:S.length})}),(0,n.jsxs)("div",{className:"row",style:{marginTop:8},children:[(0,n.jsx)("button",{className:"primary",disabled:r||0===S.length,onClick:()=>void W("unattended"),title:l("reg.continueUnattendedWhy"),children:l("reg.continueUnattended")}),(0,n.jsx)("button",{disabled:r||0===S.length,onClick:()=>void W("confirm"),title:l("reg.continueWhy"),children:l("reg.continueGo")}),(0,n.jsx)("button",{className:"quiet",disabled:r,onClick:()=>m(!1),children:l("dialog.cancel")})]})]}),v&&(0,n.jsx)(F,{entry:v,onClose:e=>{N(null),e&&t()}})]})}function q(e){let{entries:s}=e,{t}=(0,o.kj)(),a=(0,o.W3)();return(0,n.jsx)("div",{className:"panel",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:t("reg.col.task")}),(0,n.jsx)("th",{children:t("reg.col.session")}),(0,n.jsx)("th",{children:t("reg.col.status")}),(0,n.jsx)("th",{children:t("reg.col.started")}),(0,n.jsx)("th",{children:t("reg.col.took")}),(0,n.jsx)("th",{children:t("reg.col.result")})]})}),(0,n.jsx)("tbody",{children:s.map(e=>{var s;return(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{children:(0,n.jsx)(r(),{href:(0,i.aT)(e.sessionId,e.taskId),children:e.title})}),(0,n.jsx)("td",{children:(0,n.jsx)(r(),{href:(0,i.aT)(e.sessionId),children:e.sessionName})}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"badge ".concat(e.status),children:t("status.".concat(e.status))})}),(0,n.jsx)("td",{className:"muted small",children:e.startedAt?a(e.startedAt):"—"}),(0,n.jsx)("td",{className:"muted small",children:(0,i.c5)(e.durationMs)||"—"}),(0,n.jsx)("td",{className:"small",children:null!=(s=e.summary)?s:e.reason?(0,n.jsx)("span",{className:"err",children:e.reason}):"—"})]},"".concat(e.sessionId,"-").concat(e.taskId))})})]})})}}},e=>{e.O(0,[197,867,549,89,347,131,358],()=>e(e.s=3256)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{1035:(e,t,l)=>{"use strict";l.d(t,{DialogHost:()=>c,Z:()=>d});var n=l(3365),s=l(1521),a=l(867);let i=null,r=[];function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(l=>{var n;return n={kind:"confirm",message:e,...t,resolve:l},void(i?i(n):r.push(n))})}function c(e){var t,l;let{children:d}=e,{t:c}=(0,a.kj)(),[o,h]=(0,s.useState)([]),m=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(i=e=>h(t=>[...t,e]),r.length>0){let e=r.splice(0,r.length);h(t=>[...t,...e])}return()=>{i=null}},[]);let u=o[0],p=(0,s.useCallback)(e=>{u&&(u.resolve(e),h(e=>e.slice(1)))},[u]);return(0,s.useEffect)(()=>{var e;if(!u)return;null==(e=m.current)||e.focus();let t=e=>{"Escape"===e.key&&(e.preventDefault(),p(!1))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[u,p]),(0,n.jsxs)(n.Fragment,{children:[d,u&&(0,n.jsx)("div",{className:"modal-backdrop",onClick:()=>p(!1),role:"presentation",children:(0,n.jsxs)("div",{className:"modal".concat(u.danger?" danger":""),role:"confirm"===u.kind?"alertdialog":"dialog","aria-modal":"true","aria-labelledby":"modal-title",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{id:"modal-title",children:null!=(t=u.title)?t:c("confirm"===u.kind?"dialog.confirmTitle":"dialog.noticeTitle")}),(0,n.jsx)("div",{className:"modal-body",children:u.message}),(0,n.jsxs)("div",{className:"row modal-actions",children:["confirm"===u.kind&&(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>p(!1),children:c("dialog.cancel")}),(0,n.jsx)("button",{ref:m,type:"button",className:u.danger?"danger":"primary",onClick:()=>p(!0),children:null!=(l=u.okLabel)?l:c("dialog.ok")})]})]})})]})}},2114:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>m});var n=l(3365),s=l(1521),a=l(8197),i=l.n(a),r=l(5549),d=l(867),c=l(1035),o=l(4811),h=l(8848);function m(){let{t:e}=(0,d.kj)(),t=(0,d.W3)(),[l,a]=(0,s.useState)(null),[o,h]=(0,s.useState)(null),[m,p]=(0,s.useState)([]),[j,x]=(0,s.useState)([]),[g,b]=(0,s.useState)("stop"),[v,f]=(0,s.useState)(!1),[N,w]=(0,s.useState)(""),[y,k]=(0,s.useState)(""),[S,C]=(0,s.useState)(""),[F,H]=(0,s.useState)(null),[I,W]=(0,s.useState)(!1),E=(0,s.useCallback)(async()=>{try{let[e,t,l]=await Promise.all([r.FH.sessions(),r.FH.batch().catch(()=>null),r.FH.approvals().catch(()=>[])]);a(e),h(t),p(l),x(t=>t.filter(t=>e.some(e=>e.id===t))),H(!0),W(!1),C("")}catch(e){W(!(0,r.AV)()),H(!1),C(e.message)}},[]);(0,s.useEffect)(()=>{E();let e=setInterval(()=>void E(),3e3);return()=>clearInterval(e)},[E]),(0,s.useEffect)(()=>{var e;let t=new URLSearchParams(window.location.search),l=(null!=(e=t.get("run"))?e:"").split(",").map(e=>e.trim()).filter(Boolean);0!==l.length&&(x(l),b("continue"===t.get("fail")?"continue":"stop"),f(!0),window.history.replaceState(null,"",window.location.pathname))},[]);let T=async()=>{try{let e=await r.FH.createSession(N||"session");w(""),window.location.href=(0,r.aT)(e.id)}catch(e){C(e.message)}},P=async t=>{if(t.running)return void k(e("home.deleteRunning"));if(await (0,c.Z)(e("home.deleteConfirm",{name:t.name,n:t.tasks.length})))try{await r.FH.deleteSession(t.id),k(e("home.deleted",{name:t.name})),x(e=>e.filter(e=>e!==t.id)),await E()}catch(e){k(e.message)}},R=async()=>{let t=(null!=l?l:[]).filter(e=>j.includes(e.id));if(0===t.length)return;let n=t.map(e=>"• ".concat(e.name," (").concat(e.tasks.length,")")).join("\n");if(!await (0,c.Z)(e("home.deleteSelectedConfirm",{n:t.length,names:n})))return;let s=0,a=[];for(let e of t)try{await r.FH.deleteSession(e.id),s+=1}catch(t){a.push("".concat(e.name,": ").concat(t.message))}k(0===a.length?e("home.deletedMany",{n:s}):e("home.deleteSomeFailed",{n:s,m:a.length,why:a.join("; ")})),x([]),await E()},U=t=>{if(t.running)return{label:e("state.running"),badge:"running"};let l=t.tasks.some(e=>"queued"===e.status||"running"===e.status);if("idle"!==t.status||l||0===t.tasks.length)return{label:e("state.".concat(t.status)),badge:""};let n=t.tasks.filter(e=>"done"!==e.status).length;return 0===n?{label:e("state.completed"),badge:"done",title:e("state.completedTitle")}:{label:e("state.ended"),badge:"failed",title:e("state.endedTitle",{n:n})}};return(0,n.jsxs)(n.Fragment,{children:[I&&(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("strong",{children:e("home.noToken")}),(0,n.jsx)("div",{className:"muted small",children:e("home.noTokenHint",{cmd:"npm start"})})]}),!1===F&&!I&&(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("strong",{children:e("home.apiDown")}),(0,n.jsx)("div",{className:"muted small",children:e("home.apiHint",{cmd:"npm start",url:"/api"})}),S&&(0,n.jsx)("div",{className:"err",children:S})]}),(0,n.jsxs)("div",{className:"panel",id:"new-session",children:[(0,n.jsx)("h2",{children:e("home.new")}),(0,n.jsx)("p",{className:"muted small",children:e("home.newHint")}),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("input",{type:"text",className:"grow",placeholder:e("home.namePlaceholder"),value:N,onChange:e=>w(e.target.value),onKeyDown:e=>{"Enter"===e.key&&T()}}),(0,n.jsx)("button",{className:"primary",onClick:()=>void T(),disabled:!1===F,children:e("home.create")})]})]}),l&&l.length>0&&(0,n.jsx)(u,{sessions:l,selected:j,setSelected:x,onFailure:g,setOnFailure:b,fromPlan:v,batch:o,approvals:m,onChange:E,move:(e,t)=>{x(l=>{let n=l.indexOf(e),s=n+t;if(n<0||s<0||s>=l.length)return l;let a=[...l];return[a[n],a[s]]=[a[s],a[n]],a})}}),(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("h2",{children:e("home.sessions")}),null===l&&(0,n.jsx)("div",{className:"muted",children:e("home.loading")}),l&&0===l.length&&(0,n.jsx)("div",{className:"muted",children:e("home.none")}),l&&l.length>0&&(0,n.jsxs)("div",{className:"row",style:{marginBottom:10},children:[(0,n.jsx)("strong",{className:"small",children:e("home.selected",{n:j.length})}),(0,n.jsx)("button",{className:"danger",onClick:()=>void R(),disabled:0===j.length||(null==o?void 0:o.running)===!0||l.some(e=>j.includes(e.id)&&e.running),children:e("home.deleteSelected",{n:j.length})}),(0,n.jsx)("span",{className:"muted small",children:e("home.tickForBoth")})]}),l&&l.length>0&&(0,n.jsx)("p",{className:"muted small",children:e("home.deleteWhy")}),y&&(0,n.jsx)("div",{className:"muted small",role:"status",children:y}),l&&l.length>0&&(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:(0,n.jsx)("input",{type:"checkbox","aria-label":e("home.selectAll"),checked:l.length>0&&j.length===l.length,onChange:e=>x(e.target.checked?l.map(e=>e.id).reverse():[]),disabled:(null==o?void 0:o.running)===!0})}),(0,n.jsx)("th",{children:e("home.col.name")}),(0,n.jsx)("th",{children:e("home.col.tasks")}),(0,n.jsx)("th",{children:e("home.col.state")}),(0,n.jsx)("th",{children:e("home.col.chat")}),(0,n.jsx)("th",{children:e("home.col.created")}),(0,n.jsx)("th",{children:(0,n.jsx)("span",{className:"visually-hidden",children:e("home.col.remove")})})]})}),(0,n.jsx)("tbody",{children:l.map(s=>{let a=s.tasks.filter(e=>"done"===e.status).length,d=s.tasks.filter(e=>"queued"===e.status).length;return(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{children:(0,n.jsx)("input",{type:"checkbox",checked:j.includes(s.id),onChange:()=>{var e;return e=s.id,void x(t=>{if(t.includes(e))return t.filter(t=>t!==e);let n=(null!=l?l:[]).map(e=>e.id).reverse();return[...t,e].sort((e,t)=>n.indexOf(e)-n.indexOf(t))})},disabled:(null==o?void 0:o.running)===!0,"aria-label":s.name})}),(0,n.jsx)("td",{children:(0,n.jsx)(i(),{href:(0,r.aT)(s.id),children:s.name})}),(0,n.jsxs)("td",{children:[s.tasks.length," ",(0,n.jsx)("span",{className:"muted small",children:e("home.tasksDetail",{done:a,queued:d})})]}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"badge ".concat(U(s).badge),title:U(s).title,children:U(s).label})}),(0,n.jsx)("td",{children:s.chat?(0,n.jsx)("a",{href:s.chat.url,target:"_blank",rel:"noreferrer",children:s.chat.name}):(0,n.jsx)("span",{className:"muted",children:e("home.notOpened")})}),(0,n.jsx)("td",{className:"muted small",children:t(s.createdAt)}),(0,n.jsx)("td",{children:(0,n.jsx)("button",{className:"quiet",onClick:()=>void P(s),disabled:s.running||(null==o?void 0:o.running)===!0,title:e("home.delete"),children:e("home.delete")})})]},s.id)})})]})]})]})}function u(e){var t,l,a,m,u,p,j;let{sessions:x,selected:g,setSelected:b,onFailure:v,setOnFailure:f,fromPlan:N,batch:w,approvals:y,onChange:k,move:S}=e,{t:C}=(0,d.kj)(),[F,H]=(0,s.useState)(""),[I,W]=(0,s.useState)(""),[E,T]=(0,s.useState)(""),[P,R]=(0,s.useState)(""),[U,D]=(0,s.useState)(""),[B,L]=(0,s.useState)(null),[M,O]=(0,s.useState)([]);(0,s.useEffect)(()=>{r.FH.models().then(e=>{L(e),T(t=>t||e.defaultModel),R(t=>t||e.defaultReviewModel)}).catch(()=>void 0)},[]);let q=g.join(",");(0,s.useEffect)(()=>{let e=!1,t=q.split(",").filter(Boolean);if(0===t.length)return void O([]);let l=async()=>{let l=await Promise.all(t.map(async e=>{let t=await r.FH.vcsStatus(e).catch(()=>null);return{id:e,status:t}}));e||O(l.filter(e=>e.status&&!e.status.ok&&"off"!==e.status.problem).map(e=>{var t,l,n,s;return{name:null!=(n=null==(t=x.find(t=>t.id===e.id))?void 0:t.name)?n:e.id,problem:null!=(s=null==(l=e.status)?void 0:l.problem)?s:""}}))};l();let n=setInterval(()=>void l(),1e4);return()=>{e=!0,clearInterval(n)}},[q]);let _=new Map(x.map(e=>[e.id,e])),Z=e=>e.tasks.filter(e=>"queued"===e.status).length,A=g.map(e=>_.get(e)).filter(e=>!!e),K=A.filter(e=>Z(e)>0),z=K.reduce((e,t)=>e+Z(t),0),Q=(null==w?void 0:w.running)===!0,V=x.some(e=>e.running),G=Q||0===K.length||V,J=V?{title:"batch.oneRunning",why:"batch.oneRunningWhy"}:0===A.length?{title:"batch.pickFirst",why:"batch.pickFirstWhy"}:0===K.length?{title:"batch.nothingRunnable",why:"batch.nothingRunnableWhy"}:null,X=(0,o.p)(),Y=async e=>{if("unattended"!==e||X||await (0,c.Z)(C("batch.unattendedConfirm",{n:K.length})))try{var t;let l=await r.FH.startBatch(K.map(e=>e.id),e,v,E||void 0,P||void 0,U.trim()||K.map(e=>e.planName).find(Boolean)||void 0);H(""),W(l.started?"":null!=(t=l.reason)?t:""),k()}catch(e){W(e.message)}},$=async()=>{await r.FH.stopBatch(),H(C("batch.stopping")),k()},ee=async()=>{await r.FH.pauseBatch(),H(C("batch.pausing")),k()},et=async()=>{await r.FH.resumeBatch(),H(""),k()},el=A.filter(e=>{var t;return(null!=(t=e.model)?t:"")!==E}).length,en=A.filter(e=>{var t;return(null==(t=e.review)?void 0:t.enabled)===!1}).length,es=null!=(a=null==B?void 0:B.options)?a:[],ea=es.filter(e=>!e.group),ei=new Map;for(let e of es)e.group&&ei.set(e.group,[...null!=(m=ei.get(e.group))?m:[],e]);let er=w?{done:w.sessions.filter(e=>"done"===e.state).length,failed:w.sessions.filter(e=>"failed"===e.state).length,skipped:w.sessions.filter(e=>"skipped"===e.state||"stopped"===e.state).length}:null,ed=null==w?void 0:w.sessions.find(e=>"running"===e.state);return(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("h2",{children:C("batch.title")}),(0,n.jsx)("p",{className:"muted small",children:C("batch.hint")}),!Q&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("strong",{className:"small",children:C("batch.selected",{n:K.length,tasks:z})}),(0,n.jsx)("button",{className:"quiet",onClick:()=>b(x.filter(e=>Z(e)>0).map(e=>e.id).reverse()),children:C("batch.selectQueued")}),(0,n.jsx)("button",{className:"quiet",onClick:()=>b([]),disabled:0===A.length,children:C("batch.selectNone")})]}),N&&(0,n.jsx)("p",{className:"muted small",children:C("batch.fromPlan")}),A.length>K.length&&(0,n.jsx)("p",{className:"muted small",children:C("batch.notRunnable",{n:A.length-K.length})}),K.length>0&&(0,n.jsx)("ol",{className:"run-order",children:K.map((e,t)=>(0,n.jsxs)("li",{children:[(0,n.jsxs)("span",{children:[e.name," ",(0,n.jsxs)("span",{className:"muted small",children:["(",Z(e),")"]})]}),(0,n.jsxs)("span",{children:[(0,n.jsx)("button",{className:"quiet",onClick:()=>S(e.id,-1),disabled:0===t,"aria-label":"up",children:"↑"}),(0,n.jsx)("button",{className:"quiet",onClick:()=>S(e.id,1),disabled:t===K.length-1,"aria-label":"down",children:"↓"})]})]},e.id))}),(0,n.jsx)("label",{htmlFor:"batch-run-name",children:C("batch.runName")}),(0,n.jsx)("input",{id:"batch-run-name",type:"text",value:U,onChange:e=>D(e.target.value),placeholder:null!=(u=K.map(e=>e.planName).find(Boolean))?u:C("batch.runNamePlaceholder")}),(0,n.jsx)("p",{className:"why",children:C("batch.runNameWhy")}),(0,n.jsx)("label",{htmlFor:"batch-model",children:C("batch.model")}),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsxs)("select",{id:"batch-model",value:E,onChange:e=>T(e.target.value),style:{width:"auto",minWidth:260},children:[(0,n.jsx)("option",{value:"",children:C("batch.modelKeep")}),ea.map(e=>(0,n.jsx)("option",{value:e.name,disabled:e.disabled,children:e.name},e.name)),[...ei.entries()].map(e=>{let[t,l]=e;return(0,n.jsx)("optgroup",{label:t,children:l.map(e=>(0,n.jsx)("option",{value:e.name,disabled:e.disabled,children:e.name},e.name))},t)})]}),(null!=(p=null==B?void 0:B.options.length)?p:0)===0&&(0,n.jsx)("span",{className:"muted small",children:C("batch.modelNone")})]}),(0,n.jsx)("p",{className:"why",children:C("batch.modelWhy")}),(0,n.jsx)(h.L,{current:E,onUse:e=>T(e)}),E&&el>0&&(0,n.jsx)("p",{className:"why",style:{color:"var(--warn)"},children:C("batch.modelOverrides",{n:el})}),(0,n.jsx)("label",{htmlFor:"batch-review-model",children:C("batch.reviewModel")}),(0,n.jsx)("div",{className:"row",children:(0,n.jsxs)("select",{id:"batch-review-model",value:P,onChange:e=>R(e.target.value),style:{width:"auto",minWidth:260},children:[(0,n.jsx)("option",{value:"",children:C("batch.reviewModelKeep")}),ea.map(e=>(0,n.jsx)("option",{value:e.name,disabled:e.disabled,children:e.name},e.name)),[...ei.entries()].map(e=>{let[t,l]=e;return(0,n.jsx)("optgroup",{label:t,children:l.map(e=>(0,n.jsx)("option",{value:e.name,disabled:e.disabled,children:e.name},e.name))},t)})]})}),(0,n.jsx)("p",{className:"why",children:C("batch.reviewModelWhy")}),""!==P&&P===E&&(0,n.jsx)("p",{className:"why",style:{color:"var(--warn)"},children:C("batch.reviewSame")}),en>0&&(0,n.jsx)("p",{className:"why",children:C("batch.reviewOffIn",{n:en})}),(0,n.jsxs)("fieldset",{style:{border:0,padding:0,margin:"10px 0 14px"},children:[(0,n.jsx)("legend",{className:"muted small",style:{padding:0},children:C("batch.onFailure")}),(0,n.jsxs)("div",{className:"option",children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"radio",name:"batch-fail",checked:"stop"===v,onChange:()=>f("stop")}),(0,n.jsx)("span",{children:C("batch.chain")})]}),(0,n.jsx)("p",{className:"why",children:C("batch.chainWhy")})]}),(0,n.jsxs)("div",{className:"option",children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"radio",name:"batch-fail",checked:"continue"===v,onChange:()=>f("continue")}),(0,n.jsx)("span",{children:C("batch.independent")})]}),(0,n.jsx)("p",{className:"why",children:C("batch.independentWhy")})]})]}),J&&(0,n.jsxs)("div",{className:"notice caution",children:[(0,n.jsx)("strong",{children:C(J.title)}),(0,n.jsx)("div",{className:"small",style:{marginTop:4},children:C(J.why)})]}),M.length>0&&(0,n.jsxs)("div",{className:"notice caution",children:[(0,n.jsx)("strong",{children:C("batch.vcsProblem")}),(0,n.jsx)("ul",{children:M.map(e=>(0,n.jsx)("li",{children:C("batch.vcsProblemRow",{name:e.name,problem:e.problem})},e.name))}),(0,n.jsx)("div",{className:"muted small",children:C("batch.vcsProblemWhy")})]}),I&&(0,n.jsxs)("div",{className:"notice caution",role:"alert",children:[(0,n.jsx)("strong",{children:C("batch.notStartedTitle")}),(0,n.jsx)("div",{className:"small",style:{marginTop:4},children:I}),/execution\.isolation/.test(I)&&(0,n.jsx)("div",{className:"small",style:{marginTop:4},children:(0,n.jsx)(i(),{href:"/defaults",children:C("batch.notStartedIsolation")})})]}),(0,n.jsxs)("div",{className:"run-choice",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("button",{className:"primary",onClick:()=>void Y("unattended"),disabled:G,children:C("batch.run",{n:K.length})}),(0,n.jsx)("p",{className:"why",children:C("batch.runWhy")})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("button",{onClick:()=>void Y("confirm"),disabled:G,children:C("batch.runStep")}),(0,n.jsx)("p",{className:"why",children:C("batch.runStepWhy")})]})]})]}),Q&&(0,n.jsxs)("div",{className:"row",children:[(null==w?void 0:w.pausing)?(0,n.jsx)("button",{className:"primary",onClick:()=>void et(),disabled:null==w?void 0:w.stopping,title:C("batch.resumeWhy"),children:C("batch.resume")}):(0,n.jsx)("button",{onClick:()=>void ee(),disabled:null==w?void 0:w.stopping,title:C("batch.pauseWhy"),children:C("batch.pause")}),(0,n.jsx)("button",{onClick:()=>void $(),disabled:null==w?void 0:w.stopping,title:C("batch.stopWhy"),children:C("batch.stop")}),(null==w?void 0:w.pausing)&&!(null==w?void 0:w.stopping)&&(0,n.jsx)("span",{className:"muted small",children:C("batch.pausing")}),(0,n.jsx)("span",{className:"badge",children:C("batch.modelRunning",{name:(ed?(null==(t=_.get(ed.sessionId))?void 0:t.modelInUse)||(null==(l=_.get(ed.sessionId))?void 0:l.model):"")||C("model.default")})}),y.length>0&&(0,n.jsx)("span",{className:"badge waiting-approval",children:C("batch.waiting",{n:y.length})}),ed&&(0,n.jsx)("span",{className:"small",children:C("batch.progress",{name:ed.name,done:w.sessions.filter(e=>"waiting"!==e.state&&"running"!==e.state).length,total:w.sessions.length})})]}),Q&&(0,n.jsx)("p",{className:"muted small",children:C("batch.hiddenWhileRunning")}),F&&(0,n.jsx)("div",{className:"muted small",role:"status",children:F}),(A.length>0||w)&&(0,n.jsxs)("div",{className:"row",style:{marginTop:12},children:[(0,n.jsx)("a",{className:"button-link",href:r.FH.debugExportUrl(A.length>0?A.map(e=>e.id):(null!=(j=null==w?void 0:w.sessions)?j:[]).map(e=>e.sessionId)),children:C("batch.debug")}),(0,n.jsx)("span",{className:"muted small",children:A.length>0?C("batch.debugSelected",{n:A.length}):C("batch.debugLast")})]}),(A.length>0||w)&&(0,n.jsx)("p",{className:"why",children:C("batch.debugWhy")}),w&&(0,n.jsxs)(n.Fragment,{children:[!Q&&er&&(0,n.jsx)("div",{className:"notice calm",style:{marginTop:12},children:(0,n.jsx)("strong",{children:C("batch.finished",er)})}),(0,n.jsxs)("table",{style:{marginTop:10},children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:C("batch.col.session")}),(0,n.jsx)("th",{children:C("batch.col.state")}),(0,n.jsx)("th",{children:C("batch.col.ran")}),(0,n.jsx)("th",{children:C("batch.col.why")})]})}),(0,n.jsx)("tbody",{children:w.sessions.map(e=>{var t,l;return(0,n.jsxs)("tr",{className:"batch-row ".concat(e.state),children:[(0,n.jsx)("td",{children:(0,n.jsx)(i(),{href:(0,r.aT)(e.sessionId),children:e.name})}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"badge ".concat("running"===(l=e.state)?"running":"done"===l?"done":"failed"===l?"failed":"stopped"===l?"aborted":""),children:C("batch.state.".concat(e.state))})}),(0,n.jsx)("td",{className:"small",children:C("batch.ranOf",{ran:e.ran,failed:e.failed})}),(0,n.jsx)("td",{className:"muted small",children:null!=(t=e.reason)?t:""})]},e.sessionId)})})]})]})]})}},4811:(e,t,l)=>{"use strict";l.d(t,{p:()=>a});var n=l(1521),s=l(5549);function a(){let[e,t]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e=!0;return s.FH.settings().then(l=>{var n;let s=null!=(n=l.raw.execution)?n:{};e&&t("unattended"===s.mode)}).catch(()=>void 0),()=>{e=!1}},[]),e}},5704:(e,t,l)=>{Promise.resolve().then(l.bind(l,2114))},8848:(e,t,l)=>{"use strict";l.d(t,{H4:()=>c,L:()=>o,z4:()=>h});var n=l(3365),s=l(8197),a=l.n(s),i=l(1521),r=l(5549),d=l(867);function c(e){let{current:t,onUse:l}=e,{t:s}=(0,d.kj)(),[a,c]=(0,i.useState)(null);if((0,i.useEffect)(()=>{let e=!1;return r.FH.project().then(t=>{e||c(t)}).catch(()=>void 0),()=>{e=!0}},[]),!a)return null;let o=a.rootDir.trim(),h=t.trim().toLowerCase(),m=l?a.others.filter(e=>e.rootDir.trim().toLowerCase()!==h):[];return(0,n.jsx)(u,{label:o?s("proj.defaultIs",{dir:o}):s("proj.noneShort"),offer:o&&l&&h!==o.toLowerCase()?{text:s("proj.useIt"),onUse:()=>l(o)}:void 0,more:m.map(e=>({text:s("proj.otherUse",{name:e.name}),title:e.rootDir,onUse:()=>null==l?void 0:l(e.rootDir)})),link:o?s("proj.change"):s("proj.setIt"),anchor:"project"})}function o(e){let{current:t,onUse:l}=e,s=m(),{t:a}=(0,d.kj)();if(!s)return null;let i=s.defaultModel.trim();return(0,n.jsx)(u,{label:i?a("def.modelDefaultIs",{name:i}):a("def.modelNoneShort"),offer:i&&l&&t.trim()!==i?{text:a("def.modelUseIt"),onUse:()=>l(i)}:void 0,link:a(i?"proj.change":"proj.setIt"),anchor:"model"})}function h(e){let{current:t,onUse:l}=e,s=m(),{t:a}=(0,d.kj)();if(!s)return null;let i=s.defaultReviewModel.trim();return(0,n.jsx)(u,{label:i?a("def.reviewDefaultIs",{name:i}):a("def.reviewNoneShort"),offer:i&&l&&t.trim()!==i?{text:a("def.modelUseIt"),onUse:()=>l(i)}:void 0,link:a(i?"proj.change":"proj.setIt"),anchor:"review"})}function m(){let[e,t]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!1;return r.FH.models().then(l=>{e||t(l)}).catch(()=>void 0),()=>{e=!0}},[]),e}function u(e){let{label:t,offer:l,more:s=[],link:i,anchor:r}=e;return(0,n.jsxs)("p",{className:"muted small",style:{marginTop:4},children:[t," ",l&&(0,n.jsxs)(n.Fragment,{children:["\xb7"," ",(0,n.jsx)("button",{type:"button",className:"linkish",onClick:l.onUse,children:l.text})," "]}),s.map(e=>(0,n.jsxs)("span",{children:["\xb7"," ",(0,n.jsx)("button",{type:"button",className:"linkish",onClick:e.onUse,title:e.title,children:e.text})," "]},e.text)),"\xb7 ",(0,n.jsx)(a(),{href:"/defaults#".concat(r),children:i})]})}}},e=>{e.O(0,[197,867,549,347,131,358],()=>e(e.s=5704)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[66],{1205:(e,s,l)=>{"use strict";l.d(s,{AppearanceProvider:()=>o,K:()=>m,themeScript:()=>i});var n=l(3365),a=l(1521);let t={theme:"light",textSize:"normal",highContrast:!1,reduceMotion:!1,underlineLinks:!1,strongFocus:!1},r="cop.appearance",i="\n(function () {\n try {\n var d = document.documentElement;\n var raw = localStorage.getItem('".concat(r,"');\n var a = raw ? JSON.parse(raw) : {};\n d.dataset.theme = a.theme === 'dark' ? 'dark' : 'light';\n d.dataset.textsize = a.textSize || 'normal';\n d.dataset.contrast = a.highContrast ? 'high' : 'normal';\n d.dataset.motion = a.reduceMotion ? 'reduced' : 'normal';\n d.dataset.links = a.underlineLinks ? 'underline' : 'plain';\n d.dataset.focus = a.strongFocus ? 'strong' : 'normal';\n } catch (e) {}\n})();\n");function c(e){let s=document.documentElement;s.dataset.theme=e.theme,s.dataset.textsize=e.textSize,s.dataset.contrast=e.highContrast?"high":"normal",s.dataset.motion=e.reduceMotion?"reduced":"normal",s.dataset.links=e.underlineLinks?"underline":"plain",s.dataset.focus=e.strongFocus?"strong":"normal"}let d=(0,a.createContext)({appearance:t,set:()=>void 0,reset:()=>void 0,loaded:!1});function o(e){let{children:s}=e,[l,i]=(0,a.useState)(t),[o,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=t;try{let s=window.localStorage.getItem(r);s?e={...t,...JSON.parse(s)}:window.matchMedia("(prefers-color-scheme: dark)").matches&&(e={...e,theme:"dark"}),window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!s&&(e={...e,reduceMotion:!0})}catch(e){}i(e),c(e),m(!0)},[]);let u=(0,a.useCallback)(e=>{i(s=>{let l={...s,...e};c(l);try{window.localStorage.setItem(r,JSON.stringify(l))}catch(e){}return l})},[]),h=(0,a.useCallback)(()=>{i(t),c(t);try{window.localStorage.removeItem(r)}catch(e){}},[]);return(0,n.jsx)(d.Provider,{value:{appearance:l,set:u,reset:h,loaded:o},children:s})}function m(){return(0,a.useContext)(d)}},1702:(e,s,l)=>{"use strict";var n=l(9962);l.o(n,"usePathname")&&l.d(s,{usePathname:function(){return n.usePathname}}),l.o(n,"useSearchParams")&&l.d(s,{useSearchParams:function(){return n.useSearchParams}})},1772:(e,s,l)=>{Promise.resolve().then(l.bind(l,4269))},2244:(e,s,l)=>{"use strict";l.d(s,{k:()=>o});var n=l(3365),a=l(1521),t=l(5549),r=l(867);function i(e){return e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/+$/,"")}function c(e,s){return"."===s||""===s||e===s||e.startsWith("".concat(s,"/"))}function d(e,s,l){return l.includes(e)?"out":l.some(s=>s!==e&&c(e,s))?"out-inherited":s.includes(e)?"in":s.some(s=>s!==e&&c(e,s))?"inherited":"none"}function o(e){let{rootDir:s,respectGitignore:l,includeEnvFiles:o,include:m,exclude:u,onChange:h}=e,{t:p}=(0,r.kj)(),[x,v]=(0,a.useState)(null),[j,g]=(0,a.useState)(""),[f,k]=(0,a.useState)(new Set),[y,N]=(0,a.useState)(""),b=async()=>{if(s.trim()){g("");try{let e=await t.FH.dirs(s,l);v(e),N("".concat(s,"|").concat(l)),k(new Set(e.filter(e=>!e.includes("/"))))}catch(e){g(e.message)}}};(0,a.useEffect)(()=>{v(null),N("")},[s,l]);let w=(0,a.useMemo)(()=>(function(e){let s=[],l=new Map;for(let a of[...e].sort()){var n;let e={path:a,name:null!=(n=a.split("/").pop())?n:a,children:[]};l.set(a,e);let t=a.includes("/")?l.get(a.slice(0,a.lastIndexOf("/"))):void 0;(t?t.children:s).push(e)}return s})(null!=x?x:[]),[x]),C=m.map(i).filter(Boolean),S=u.map(i).filter(Boolean),F=e=>(0,n.jsx)("ul",{className:"dir-tree",children:e.map(e=>{let s=d(e.path,C,S),l=f.has(e.path),a=function(e,s,l){let n=s=>s.filter(s=>s!==e&&c(s,e)).length;return{included:n(s),excluded:n(l)}}(e.path,C,S),t=!l&&e.children.length>0&&(a.included>0||a.excluded>0);return(0,n.jsxs)("li",{className:"dir ".concat(s),children:[(0,n.jsxs)("div",{className:"dir-row",children:[e.children.length>0?(0,n.jsx)("button",{type:"button",className:"dir-flip",onClick:()=>{let s;return s=e.path,k(e=>{let l=new Set(e);return l.has(s)?l.delete(s):l.add(s),l})},"aria-label":l?p("tree.fold"):p("tree.unfold"),"aria-expanded":l,children:l?"▾":"▸"}):(0,n.jsx)("span",{className:"dir-flip","aria-hidden":"true"}),(0,n.jsxs)("button",{type:"button",className:"dir-name",onClick:()=>(e=>{if("in"===d(e,C,S))return void h(C.filter(s=>s!==e),S);h([...C.filter(s=>!c(s,e)),e],S.filter(s=>!c(s,e)))})(e.path),title:"in"===s?p("tree.stateIn"):"inherited"===s?p("tree.stateInherited"):"out"===s?p("tree.stateOut"):"out-inherited"===s?p("tree.stateOutInherited"):p("tree.stateNone"),"aria-pressed":"in"===s||"inherited"===s,children:[(0,n.jsx)("span",{className:"dir-mark","aria-hidden":"true",children:"in"===s?"✓":"inherited"===s?"\xb7":"out"===s||"out-inherited"===s?"\xd7":""}),e.name]}),(0,n.jsx)("button",{type:"button",className:"dir-out".concat("out"===s?" on":""),onClick:()=>(e=>{if(S.includes(e))return void h(C,S.filter(s=>s!==e));h(C.filter(s=>s!==e&&!c(s,e)),[...S.filter(s=>!c(s,e)),e])})(e.path),title:"out"===s?p("tree.unexclude"):p("tree.exclude"),children:"−"}),t&&(0,n.jsx)("span",{className:"chip inside".concat(a.excluded>0?" out":""),title:p("tree.insideWhy"),children:a.excluded>0&&a.included>0?p("tree.insideBoth",{i:a.included,e:a.excluded}):a.excluded>0?p("tree.insideOut",{n:a.excluded}):p("tree.insideIn",{n:a.included})})]}),l&&e.children.length>0&&F(e.children)]},e.path)})}),D=y!=="".concat(s,"|").concat(l);return(0,n.jsxs)("div",{className:"dir-tree-box",children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("button",{type:"button",onClick:()=>void b(),disabled:!s.trim(),children:null===x||D?p("tree.load"):p("tree.reload")}),(0,n.jsx)("span",{className:"muted small",children:p("tree.hint")})]}),j&&(0,n.jsx)("div",{className:"err small",children:j}),(0,n.jsxs)("p",{className:"muted small",style:{marginTop:6},children:[p("tree.alsoOut")," ",[l?p("tree.alsoGitignore"):null,!1===o?p("tree.alsoEnv"):null,p("tree.alsoAlways")].filter(Boolean).join(" \xb7 ")]}),null!==x&&!D&&(0===x.length?(0,n.jsx)("p",{className:"muted small",children:p("mirror.noDirs")}):F(w))]})}},4269:(e,s,l)=>{"use strict";l.r(s),l.d(s,{default:()=>w});var n=l(3365),a=l(1521),t=l(1702),r=l(8197),i=l.n(r),c=l(5549),d=l(867),o=l(1910),m=l(3523),u=l(3374);function h(e){let s=e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/+$/,"");return""===s?".":s}function p(e){return e.split("\n").map(e=>e.trim()).filter(Boolean)}var x=l(1205),v=l(8848),j=l(4784),g=l(2244),f=l(7619),k=l(5132),y=l(1035),N=l(4811),b=l(3041);function w(){return(0,n.jsx)(a.Suspense,{fallback:null,children:(0,n.jsx)(C,{})})}function C(){var e;let{t:s}=(0,d.kj)(),l=null!=(e=(0,t.useSearchParams)().get("id"))?e:"",[r,o]=(0,a.useState)(null),[m,u]=(0,a.useState)([]),[h,p]=(0,a.useState)([]),[x,v]=(0,a.useState)(null),[j,g]=(0,a.useState)(""),f=(0,a.useRef)(null),k=(0,a.useCallback)(async()=>{try{o(await c.FH.session(l)),g("")}catch(e){g(e.message)}},[l]),y=(0,a.useCallback)(()=>{f.current||(f.current=window.setTimeout(()=>{f.current=null,k()},400))},[k]);if((0,a.useEffect)(()=>{k(),c.FH.presets().then(p).catch(()=>void 0),c.FH.level1().then(v).catch(()=>void 0);let e=new EventSource(c.FH.streamUrl(l));e.onmessage=e=>{let s=JSON.parse(e.data);"ping"!==s.type&&(u(e=>[...e.slice(-400),s]),y())},e.onerror=()=>{};let s=setInterval(()=>void k(),8e3);return()=>{e.close(),clearInterval(s)}},[l,k,y]),j&&!r)return(0,n.jsx)("div",{className:"panel err",children:j});if(!r)return(0,n.jsx)("div",{className:"panel muted",children:s("home.loading")});let N=r.tasks.filter(e=>"queued"===e.status).length;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"crumbs",children:[(0,n.jsx)(i(),{href:"/",children:s("session.crumb")})," / ",r.name]}),(0,n.jsx)(S,{session:r,queued:N,onChange:k}),(0,n.jsx)(B,{tasks:r.tasks}),(0,n.jsx)(D,{session:r,onChange:k}),(0,n.jsx)(F,{level1:x,sent:r.contractSent}),(0,n.jsx)(T,{session:r,onChange:k}),(0,n.jsx)(H,{session:r,onChange:k}),(0,n.jsx)(M,{session:r,onChange:k}),(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("h2",{children:s("tasks.title")}),(0,n.jsx)("p",{className:"muted small",children:s("tasks.hint")}),(0,n.jsx)(P,{session:r,onChange:k}),0===r.tasks.length&&(0,n.jsx)("div",{className:"muted",children:s("tasks.none")}),r.tasks.map((e,s)=>(0,n.jsx)(A,{session:r,task:e,index:s+1,presets:h,onChange:k},e.id))]}),(0,n.jsx)(W,{session:r}),(0,n.jsx)(O,{session:r,presets:h,onAdded:k,onPresetsChanged:()=>c.FH.presets().then(p)}),(0,n.jsx)(R,{events:m})]})}function S(e){var s;let{session:l,queued:t,onChange:r}=e,{t:i}=(0,d.kj)(),[o,m]=(0,a.useState)(""),[u,h]=(0,a.useState)("");(0,a.useEffect)(()=>{c.FH.models().then(e=>{var s;return h(null!=(s=e.defaultModel)?s:"")}).catch(()=>void 0)},[]);let[p,x]=(0,a.useState)(l.name),[v,j]=(0,a.useState)(null!=(s=l.conversationGroup)?s:"");(0,a.useEffect)(()=>x(l.name),[l.name]),(0,a.useEffect)(()=>{var e;return j(null!=(e=l.conversationGroup)?e:"")},[l.conversationGroup]);let g=(0,N.p)(),f=async e=>{var s;if("unattended"===e&&!g&&!await (0,y.Z)(i("session.unattendedConfirm")))return;let n=await c.FH.start(l.id,e,l.planName);m(n.started?i("unattended"===e?"session.startedAuto":"session.startedStep"):i("session.notStarted",{reason:null!=(s=n.reason)?s:""})),r()},k=async()=>{await c.FH.stop(l.id),m(i("session.stopping")),r()},b=async()=>{await c.FH.setRunMode(l.id,"confirm"),m(i("session.askingAgain")),r()},w=async()=>{p.trim()&&p!==l.name&&await c.FH.updateSession(l.id,{name:p}),r()},C=async()=>{if(l.running)return void m(i("home.deleteRunning"));if(await (0,y.Z)(i("home.deleteConfirm",{name:l.name,n:l.tasks.length})))try{await c.FH.deleteSession(l.id),window.location.href="/"}catch(e){m(e.message)}},S=async()=>{var e;if(v.trim()!==(null!=(e=l.conversationGroup)?e:""))try{await c.FH.updateSession(l.id,{conversationGroup:v.trim()}),m(i("session.groupSaved")),r()}catch(e){m(e.message)}},F=l.running?i("state.running"):i("state.".concat(l.status));return(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("input",{type:"text",className:"grow",value:p,onChange:e=>x(e.target.value),onBlur:()=>void w()}),(0,n.jsx)("span",{className:"badge ".concat(l.running?"running":""),children:F})]}),!l.running&&(0,n.jsxs)("div",{className:"run-choice",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("button",{className:"primary",onClick:()=>void f("unattended"),disabled:0===t,children:i("session.run",{n:t})}),(0,n.jsx)("p",{className:"why",children:i("session.runWhy")})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("button",{onClick:()=>void f("confirm"),disabled:0===t,children:i("session.runStep")}),(0,n.jsx)("p",{className:"why",children:i("session.runStepWhy")})]})]}),(0,n.jsxs)("div",{className:"row",style:{marginTop:10},children:[l.running&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{className:"danger",onClick:()=>void k(),children:i("session.stop")}),"unattended"===l.runMode&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"badge waiting-approval",children:i("session.modeUnattended")}),(0,n.jsx)("button",{onClick:()=>void b(),children:i("session.askAgain")})]})]}),(0,n.jsx)("span",{className:"muted small",children:o}),(0,n.jsx)("span",{className:"grow"}),(0,n.jsx)("button",{className:"quiet",onClick:()=>void C(),disabled:l.running,children:i("home.delete")}),l.chat?(0,n.jsx)("a",{href:l.chat.url,target:"_blank",rel:"noreferrer",className:"small",children:i("session.openChat",{name:l.chat.name})}):(0,n.jsx)("span",{className:"muted small",children:i("session.noChat")})]}),(0,n.jsx)("label",{htmlFor:"session-group",children:i("session.group")}),(0,n.jsx)("div",{className:"row",children:(0,n.jsx)("input",{id:"session-group",type:"text",className:"grow",value:v,placeholder:i("session.groupPlaceholder"),onChange:e=>j(e.target.value),onBlur:()=>void S(),disabled:l.running})}),(0,n.jsxs)("p",{className:"why",children:[i("session.groupWhy"),l.chat&&" ".concat(i("session.groupHasChat"))]}),(0,n.jsxs)("div",{className:"muted small",style:{marginTop:10},children:[i("session.willUseModel",{name:l.model||(u?i("model.followsDefault",{name:u}):i("model.default"))})," \xb7 ",l.mirror.enabled&&l.mirror.rootDir?i("session.willUseFiles",{root:l.mirror.rootDir,dirs:l.mirror.includeDirs.length?l.mirror.includeDirs.join(", "):"."}):(0,n.jsx)("span",{className:"err",children:i("session.noFiles")})]})]})}function F(e){var s;let{level1:l,sent:a}=e,{t}=(0,d.kj)();return(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("h2",{className:"grow",style:{margin:0},children:t("l1.title")}),(0,n.jsx)("span",{className:"badge",children:t(a?"l1.sent":"l1.notSent")}),(0,n.jsx)(i(),{href:"/level1",className:"small",children:t("l1.edit")})]}),(0,n.jsxs)("p",{className:"muted small",style:{marginBottom:6},children:[t("l1.hint"),(null==l?void 0:l.customised)?" ".concat(t("l1.customised")):""]}),(0,n.jsxs)("details",{children:[(0,n.jsx)("summary",{children:t("l1.show")}),(0,n.jsx)("pre",{className:"tall",children:null!=(s=null==l?void 0:l.content)?s:"…"})]})]})}function D(e){var s,l,t,r;let{session:i,onChange:o}=e,{t:m}=(0,d.kj)(),u=(0,d.W3)(),[h,p]=(0,a.useState)(null),[x,j]=(0,a.useState)(!1),[g,f]=(0,a.useState)("");(0,a.useEffect)(()=>{c.FH.models().then(p).catch(()=>void 0)},[]);let k=async e=>{try{await c.FH.updateSession(i.id,{model:e}),f(e?m("model.saved",{name:e}):m("model.savedDefault")),o()}catch(e){f(e.message)}},N=async()=>{try{let e=await c.FH.setDefaultModel(w);p(s=>s?{...s,defaultModel:e.defaultModel}:s),f(e.defaultModel?m("model.defaultSaved",{name:e.defaultModel}):m("model.defaultCleared"))}catch(e){f(e.message)}},b=async()=>{if(await (0,y.Z)(m("model.refreshConfirm"))){j(!0),f(m("model.refreshing"));try{var e;let s=await c.FH.refreshModels();p(s),f(0===s.options.length?null!=(e=s.note)?e:m("model.none"):m("model.refreshed",{n:s.options.length}))}catch(e){f(e.message)}finally{j(!1)}}},w=null!=(s=i.model)?s:"",C=null!=(l=null==h?void 0:h.options)?l:[],S=C.some(e=>e.name===w),F=C.filter(e=>!e.group),D=new Map;for(let e of C)e.group&&D.set(e.group,[...null!=(t=D.get(e.group))?t:[],e]);return(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("h2",{className:"grow",style:{margin:0},children:m("model.title")}),i.modelInUse&&(0,n.jsx)("span",{className:"chip",children:m("model.lastUsed",{name:i.modelInUse})})]}),(0,n.jsx)("p",{className:"muted small",children:m("model.hint")}),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsxs)("select",{"aria-label":m("model.title"),value:w,disabled:i.running,onChange:e=>void k(e.target.value),style:{width:"auto",minWidth:260},children:[(0,n.jsx)("option",{value:"",children:(null==h?void 0:h.defaultModel)?m("model.followsDefault",{name:h.defaultModel}):m("model.default")}),w&&!S&&(0,n.jsx)("option",{value:w,children:m("model.notInList",{name:w})}),F.map(e=>(0,n.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(m("model.unavailable")):""]},e.name)),[...D.entries()].map(e=>{let[s,l]=e;return(0,n.jsx)("optgroup",{label:s,children:l.map(e=>(0,n.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(m("model.unavailable")):""]},e.name))},s)})]}),(0,n.jsx)("button",{onClick:()=>void b(),disabled:x||i.running,children:m("model.refresh")}),(0,n.jsx)("span",{className:"muted small",role:"status",children:g})]}),(0,n.jsx)(v.L,{current:w,onUse:e=>void k(e)}),(0,n.jsxs)("div",{className:"row",style:{marginTop:8},children:[(0,n.jsx)("span",{className:"muted small",children:(null==h?void 0:h.defaultModel)?m("model.defaultIs",{name:h.defaultModel}):m("model.defaultIsNone")}),(0,n.jsx)("button",{onClick:()=>void N(),disabled:w===(null!=(r=null==h?void 0:h.defaultModel)?r:""),children:w?m("model.makeDefault",{name:w}):m("model.clearDefault")})]}),(null==h?void 0:h.readAt)?(0,n.jsxs)("p",{className:"muted small",style:{marginTop:8},children:[m("model.readAt",{t:u(h.readAt),n:h.options.length}),h.current?" ".concat(m("model.chatWasOn",{name:h.current})):"",h.note?" ".concat(h.note):""]}):(0,n.jsx)("p",{className:"muted small",style:{marginTop:8},children:m("model.neverRead")}),C.length>0&&(0,n.jsxs)("details",{children:[(0,n.jsx)("summary",{children:m("model.showDetails")}),(0,n.jsx)("pre",{className:"tall",children:C.map(e=>"".concat(e.selected?"*":" "," ").concat(e.group?"".concat(e.group," > "):"").concat(e.name)+"".concat(e.disabled?" [unavailable]":"","\n ").concat(e.raw.replace(/\n/g," | "))).join("\n")})]})]})}function H(e){var s,l;let{session:t,onChange:r}=e,{t:i}=(0,d.kj)(),o=null!=(s=t.review)?s:{enabled:!0,model:""},[m,u]=(0,a.useState)(o.enabled),[h,p]=(0,a.useState)(null!=(l=o.model)?l:""),[x,g]=(0,a.useState)(""),[f,k]=(0,a.useState)(!1),[y,N]=(0,a.useState)("");(0,a.useEffect)(()=>{c.FH.models().then(e=>{var s;return N(null!=(s=e.defaultReviewModel)?s:"")}).catch(()=>void 0)},[]);let b=async()=>{k(!0),g("");try{await c.FH.updateSession(t.id,{review:{enabled:m,model:h}}),g(i("review.saved")),r()}catch(e){g(e.message)}finally{k(!1)}};return(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("h2",{className:"grow",style:{margin:0},children:i("review.title")}),(0,n.jsx)("span",{className:"badge ".concat(m?"done":""),children:m?i("review.on"):i("review.off")})]}),(0,n.jsx)("p",{className:"muted small",children:i("review.hint")}),(0,n.jsxs)("div",{className:"option",children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"checkbox",checked:m,onChange:e=>u(e.target.checked),disabled:t.running}),(0,n.jsx)("span",{children:i("review.enable")})]}),(0,n.jsx)("p",{className:"why",children:i("review.enableWhy")})]}),(0,n.jsx)("label",{htmlFor:"review-model",children:i("review.modelField")}),(0,n.jsx)("div",{className:"row",children:(0,n.jsx)(j.Y,{id:"review-model",chosen:h,onChange:p,none:y?i("model.followsDefault",{name:y}):i("review.modelSame"),disabled:t.running||!m})}),(0,n.jsx)("p",{className:"why",children:i("review.modelWhy")}),(0,n.jsx)(v.z4,{current:h,onUse:e=>p(e)}),(0,n.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,n.jsx)("button",{className:"primary",onClick:()=>void b(),disabled:f||t.running,children:i("review.save")}),x&&(0,n.jsx)("span",{className:"muted small",children:x})]})]})}function T(e){var s,l,t;let{session:r,onChange:i}=e,{t:o}=(0,d.kj)(),m=null!=(s=r.vcs)?s:{enabled:!0,repoDir:"",branchMode:"per-task",commitOnFinish:!0,branchPrefix:"cop/"},[u,h]=(0,a.useState)(m.repoDir),[p,x]=(0,a.useState)(null),[j,g]=(0,a.useState)(""),[f,k]=(0,a.useState)(!1),y=JSON.stringify(m),[N,b]=(0,a.useState)(null),[w,C]=(0,a.useState)(null!=(l=m.branchName)?l:"");(0,a.useEffect)(()=>{var e;return C(null!=(e=JSON.parse(y).branchName)?e:"")},[y]),(0,a.useEffect)(()=>{h(JSON.parse(y).repoDir)},[y]);let S=JSON.parse(y).repoDir||r.mirror.rootDir||"";(0,a.useEffect)(()=>{let e=!1;return S.trim()?(c.FH.repoCheck(S).then(s=>{var l;e||b(s.ok?null:null!=(l=s.problem)?l:null)}).catch(()=>{e||b(null)}),()=>{e=!0}):void b(null)},[S]);let F=(0,a.useCallback)(()=>{c.FH.vcsStatus(r.id).then(x).catch(()=>x(null))},[r.id]);(0,a.useEffect)(F,[F,y]);let D=async e=>{try{await c.FH.updateSession(r.id,{vcs:e}),g(o("vcs.saved")),i(),F()}catch(e){g(e.message)}},H=async()=>{k(!0),g(o("mirror.browsing"));try{let s=await c.FH.browseFolder(u.trim()||r.mirror.rootDir||void 0);if(s.ok)h(s.path),await D({repoDir:s.path});else{var e;g(s.cancelled?o("mirror.browseCancelled"):null!=(e=s.reason)?e:"")}}finally{k(!1)}},T=m.repoDir||r.mirror.rootDir||"",M=""!==T.trim()&&null===N;return(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("h2",{className:"grow",style:{margin:0},children:o("vcs.title")}),(0,n.jsx)("span",{className:"badge ".concat(m.enabled?"done":""),children:m.enabled?o("vcs.on"):o("vcs.off")})]}),(0,n.jsx)("p",{className:"muted small",children:o("vcs.hint")}),(0,n.jsx)("label",{htmlFor:"vcs-root",children:o("vcs.repoField")}),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("input",{id:"vcs-root",type:"text",className:"grow",value:u,onChange:e=>h(e.target.value),onBlur:()=>u.trim()!==m.repoDir&&void D({repoDir:u.trim()}),placeholder:r.mirror.rootDir||"C:\\Projects\\my-app",disabled:r.running}),(0,n.jsx)("button",{onClick:()=>void H(),disabled:f||r.running,children:o("mirror.browse")})]}),(0,n.jsx)(v.H4,{current:u,onUse:e=>{h(e),D({repoDir:e})}}),N&&(0,n.jsxs)("div",{className:"notice caution",style:{marginTop:8},children:[(0,n.jsx)("strong",{children:o("vcs.noRepo")}),(0,n.jsx)("div",{className:"small",style:{marginTop:4},children:N}),(0,n.jsx)("div",{className:"muted small",style:{marginTop:6},children:o("vcs.noRepoHow")})]}),!N&&""!==T.trim()&&(0,n.jsx)("p",{className:"muted small",style:{marginTop:4},children:o("vcs.repoOk")}),""===T.trim()&&(0,n.jsx)("p",{className:"muted small",style:{marginTop:4},children:o("vcs.pickFirst")}),(0,n.jsxs)("div",{className:"option".concat(M||m.enabled?"":" warned"),children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"checkbox",checked:m.enabled,onChange:e=>void D({enabled:e.target.checked}),disabled:r.running||!M&&!m.enabled}),(0,n.jsx)("span",{children:o("vcs.enable")})]}),(0,n.jsx)("p",{className:"why",children:o("vcs.enableWhy")})]}),m.enabled&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"muted small",style:{marginTop:4},children:T?o("vcs.repoIs",{dir:T}):o("vcs.repoNone")}),(0,n.jsx)("h3",{children:o("vcs.branches")}),(0,n.jsxs)("div",{className:"option",children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"radio",name:"branchMode",checked:"per-task"===m.branchMode,onChange:()=>void D({branchMode:"per-task"}),disabled:r.running}),(0,n.jsx)("span",{children:o("vcs.perTask")})]}),(0,n.jsx)("p",{className:"why",children:o("vcs.perTaskWhy")})]}),(0,n.jsxs)("div",{className:"option",children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"radio",name:"branchMode",checked:"per-session"===m.branchMode,onChange:()=>void D({branchMode:"per-session"}),disabled:r.running}),(0,n.jsx)("span",{children:o("vcs.perSession")})]}),(0,n.jsx)("p",{className:"why",children:o("vcs.perSessionWhy")})]}),"per-session"===m.branchMode&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("label",{htmlFor:"vcs-branch-name",children:o("vcs.branchName")}),(0,n.jsx)("input",{id:"vcs-branch-name",type:"text",value:w,onChange:e=>C(e.target.value),onBlur:()=>{var e;return w.trim()!==(null!=(e=m.branchName)?e:"")&&void D({branchName:w.trim()})},placeholder:r.name,disabled:r.running}),(0,n.jsx)("p",{className:"why",children:o("vcs.branchNameWhy")})]}),(0,n.jsxs)("div",{className:"option",children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"checkbox",checked:m.commitOnFinish,onChange:e=>void D({commitOnFinish:e.target.checked}),disabled:r.running}),(0,n.jsx)("span",{children:o("vcs.commit")})]}),(0,n.jsx)("p",{className:"why",children:o("vcs.commitWhy")})]}),p&&!p.ok&&(0,n.jsxs)("div",{className:"notice caution",role:"status",children:[(0,n.jsx)("strong",{children:o("vcs.notReady")})," ",p.problem]}),(null==p?void 0:p.ok)&&(0,n.jsx)("div",{className:"muted small",children:o("vcs.ready",{branch:null!=(t=p.branch)?t:"—",dir:p.repoDir})}),(null==p?void 0:p.ok)&&p.work&&p.work.branches.length>0&&(0,n.jsxs)("div",{className:"muted small",children:["per-session"===p.work.mode&&p.work.complete?o("vcs.completeOn",{branch:p.work.complete}):o("vcs.noSingleBranch",{n:p.work.branches.length}),"per-task"===p.work.mode&&(0,n.jsx)("ul",{style:{margin:"4px 0",paddingLeft:20},children:p.work.branches.map(e=>(0,n.jsxs)("li",{children:[(0,n.jsx)("code",{children:e.branch})," — ",e.title,e.commit?"":" (".concat(o("vcs.taskNoFiles"),")")]},e.branch))})]}),(0,n.jsx)("p",{className:"muted small",children:o("vcs.pushIsYours")})]}),(0,n.jsx)("div",{className:"muted small",role:"status",children:j})]})}function M(e){var s,l,t,r;let{session:i,onChange:o}=e,{t:m}=(0,d.kj)(),[u,x]=(0,a.useState)(i.mirror.enabled),[j,f]=(0,a.useState)(i.mirror.rootDir),[k,N]=(0,a.useState)(i.mirror.includeDirs.join("\n")),[b,w]=(0,a.useState)(i.mirror.excludeDirs.join("\n")),[C,S]=(0,a.useState)(null==(s=i.mirror.respectGitignore)||s),[F,D]=(0,a.useState)(null!=(l=i.mirror.includeEnvFiles)&&l),[H,T]=(0,a.useState)(null),[M,P]=(0,a.useState)(null),[L,W]=(0,a.useState)(""),[O,A]=(0,a.useState)(""),[R,E]=(0,a.useState)([]),B=JSON.stringify(i.mirror);(0,a.useEffect)(()=>{var e,s;let l=JSON.parse(B);x(l.enabled),f(l.rootDir),N(l.includeDirs.join("\n")),w(l.excludeDirs.join("\n")),S(null==(e=l.respectGitignore)||e),D(null!=(s=l.includeEnvFiles)&&s)},[B]),(0,a.useEffect)(()=>{c.FH.doctor().then(e=>{var s;return E(null!=(s=e.alwaysIgnoredDirs)?s:[])}).catch(()=>void 0)},[]);let U=p(k),G=p(b),q=function(e,s){let l=e.map(h).filter(Boolean),n=s.map(h).filter(Boolean),a=[];for(let e of l)for(let s of n)if(e.toLowerCase()===s.toLowerCase())a.push({include:e,exclude:s,kind:"same"});else("."===s?"."!==e:e.toLowerCase().startsWith("".concat(s.toLowerCase(),"/")))&&a.push({include:e,exclude:s,kind:"excluded-parent"});return a}(U,G),J={rootDir:j.trim(),includeDirs:U,excludeDirs:G,respectGitignore:C,includeEnvFiles:F},z=u&&!J.rootDir,Z=q.length>0||z,_=JSON.stringify({enabled:i.mirror.enabled,rootDir:i.mirror.rootDir,includeDirs:i.mirror.includeDirs,excludeDirs:i.mirror.excludeDirs,respectGitignore:null==(t=i.mirror.respectGitignore)||t,includeEnvFiles:null!=(r=i.mirror.includeEnvFiles)&&r}),K=JSON.stringify({enabled:u,...J}),Y=async()=>{if(!Z)try{await c.FH.updateSession(i.id,{mirror:{enabled:u,...J}}),A(m("mirror.saved")),o()}catch(e){A(e.message)}},$=async()=>{try{T(await c.FH.dirs(j,C)),A("")}catch(e){A(e.message)}},Q=async()=>{W("browse"),A(m("mirror.browsing"));try{let s=await c.FH.browseFolder(j.trim()||void 0);if(s.ok)f(s.path),T(null),P(null),A("");else{var e;A(s.cancelled?m("mirror.browseCancelled"):null!=(e=s.reason)?e:"")}}catch(e){A(e.message)}finally{W("")}},V=async()=>{if(!J.rootDir)return void A(m("mirror.needRoot"));W("check"),A(m("mirror.checking"));try{P(await c.FH.previewMirror(J)),A("")}catch(e){P(null),A(e.message)}finally{W("")}},X=async e=>{(!e||await (0,y.Z)(m("mirror.envWarn")))&&(D(e),P(null))};return(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("h2",{className:"grow",style:{margin:0},children:m("mirror.title")}),(0,n.jsx)("span",{className:"badge ".concat(i.mirror.enabled?"done":""),children:i.mirror.enabled?m("mirror.stateOn"):m("mirror.stateOff")})]}),(0,n.jsx)("p",{className:"muted small",children:m("mirror.hint",{example:"src--test--a.spec.ts.txt"})}),(0,n.jsx)("div",{className:"option",children:(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"checkbox",checked:u,onChange:e=>x(e.target.checked)}),(0,n.jsx)("span",{children:m("mirror.enable")})]})}),(0,n.jsx)("label",{htmlFor:"mirror-root",children:m("mirror.root")}),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("input",{id:"mirror-root",type:"text",className:"grow",value:j,onChange:e=>{f(e.target.value),P(null)},placeholder:"C:\\Projects\\my-app"}),(0,n.jsx)("button",{onClick:()=>void Q(),disabled:"browse"===L,children:m("mirror.browse")}),(0,n.jsx)("button",{onClick:()=>void $(),disabled:!j.trim(),children:m("mirror.listDirs")})]}),(0,n.jsx)("div",{className:"muted small",style:{marginTop:4},children:m("mirror.rootHint")}),(0,n.jsx)(v.H4,{current:j,onUse:e=>{f(e),P(null)}}),H&&(0,n.jsx)("div",{className:"small muted",style:{margin:"6px 0"},children:0===H.length?m("mirror.noDirs"):H.join(" \xb7 ")}),(0,n.jsx)("h3",{children:m("mirror.rules")}),(0,n.jsxs)("div",{className:"option",children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"checkbox",checked:C,onChange:e=>{S(e.target.checked),P(null)}}),(0,n.jsx)("span",{children:m("mirror.gitignore")})]}),(0,n.jsx)("p",{className:"why",children:m("mirror.gitignoreWhy")})]}),(0,n.jsxs)("div",{className:"option".concat(F?" warned":""),children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"checkbox",checked:F,onChange:e=>X(e.target.checked)}),(0,n.jsx)("span",{children:m("mirror.env")})]}),(0,n.jsx)("p",{className:"why",children:m("mirror.envWhy")}),F&&(0,n.jsx)("p",{className:"why",children:(0,n.jsx)("strong",{children:m("mirror.envOn")})})]}),R.length>0&&(0,n.jsx)("p",{className:"muted small",children:m("mirror.alwaysOut",{dirs:R.join(", ")})}),(0,n.jsxs)("div",{className:"row",style:{alignItems:"flex-start"},children:[(0,n.jsxs)("div",{className:"grow",children:[(0,n.jsx)("label",{htmlFor:"mirror-include",children:m("mirror.include")}),(0,n.jsx)("textarea",{id:"mirror-include",value:k,onChange:e=>{N(e.target.value),P(null)},placeholder:"src\ntests",style:{minHeight:80},"aria-invalid":q.length>0})]}),(0,n.jsxs)("div",{className:"grow",children:[(0,n.jsx)("label",{htmlFor:"mirror-exclude",children:m("mirror.exclude")}),(0,n.jsx)("textarea",{id:"mirror-exclude",value:b,onChange:e=>{w(e.target.value),P(null)},placeholder:"src/generated",style:{minHeight:80},"aria-invalid":q.length>0})]})]}),(0,n.jsx)(g.k,{rootDir:j,respectGitignore:C,includeEnvFiles:F,include:k.split("\n"),exclude:b.split("\n"),onChange:(e,s)=>{N(e.join("\n")),w(s.join("\n")),P(null)}}),q.length>0&&(0,n.jsxs)("div",{className:"notice",role:"alert",children:[(0,n.jsx)("strong",{children:m("mirror.conflict")}),(0,n.jsx)("ul",{children:q.map((e,s)=>(0,n.jsx)("li",{children:"same"===e.kind?m("mirror.conflictSame",{dir:e.include}):m("mirror.conflictParent",{include:e.include,exclude:e.exclude})},s))}),(0,n.jsx)("div",{style:{marginTop:6},children:m("mirror.conflictFix")})]}),z&&(0,n.jsx)("div",{className:"notice caution",role:"alert",children:(0,n.jsx)("strong",{children:m("mirror.needRoot")})}),K!==_&&(0,n.jsxs)("div",{className:"notice caution",role:"status",children:[(0,n.jsx)("strong",{children:m("mirror.unsaved")})," ",m("mirror.unsavedWhy")]}),(0,n.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,n.jsx)("button",{className:"primary",onClick:()=>void Y(),disabled:Z,children:m("mirror.save")}),(0,n.jsx)("button",{onClick:()=>void V(),disabled:q.length>0||"check"===L,children:m("mirror.check")}),(0,n.jsx)("span",{className:"muted small",role:"status",children:O})]}),M&&(0,n.jsx)(I,{preview:M})]})}function I(e){let{preview:s}=e,{t:l}=(0,d.kj)();return 0===s.files.length?(0,n.jsx)("div",{className:"notice caution",style:{marginTop:10},children:(0,n.jsx)("strong",{children:l("mirror.checkedNone")})}):(0,n.jsxs)("div",{className:"notice calm",style:{marginTop:10},children:[(0,n.jsx)("strong",{children:l("mirror.checked",{files:s.files.length,size:(0,c.zi)(s.totalBytes)})})," ",s.envFiles.length>0&&(0,n.jsx)("span",{className:"err",children:l("mirror.checkedEnv",{n:s.envFiles.length})})," ",s.skipped.length>0&&(0,n.jsx)("span",{className:"muted",children:l("mirror.checkedSkipped",{n:s.skipped.length})}),(0,n.jsxs)("details",{style:{marginTop:6},children:[(0,n.jsx)("summary",{children:l("mirror.showFiles")}),(0,n.jsx)("pre",{className:"tall",children:s.files.join("\n")})]}),s.skipped.length>0&&(0,n.jsxs)("details",{children:[(0,n.jsx)("summary",{children:l("mirror.showSkipped")}),(0,n.jsx)("pre",{className:"tall",children:s.skipped.map(e=>"".concat(e.relPath," — ").concat(e.reason)).join("\n")})]})]})}function P(e){var s;let{session:l,onChange:t}=e,{t:r}=(0,d.kj)(),[i,o]=(0,a.useState)(""),m=null!=(s=l.onFailure)?s:"stop",u=async e=>{if(e!==m)try{await c.FH.updateSession(l.id,{onFailure:e}),o(r("stop"===e?"chain.savedStop":"chain.savedContinue")),t()}catch(e){o(e.message)}};return(0,n.jsxs)("fieldset",{style:{border:0,padding:0,margin:"10px 0 14px"},children:[(0,n.jsx)("legend",{className:"muted small",style:{padding:0},children:r("chain.title")}),(0,n.jsxs)("div",{className:"option",children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"radio",name:"chain",checked:"stop"===m,onChange:()=>void u("stop"),disabled:l.running}),(0,n.jsx)("span",{children:r("chain.stop")})]}),(0,n.jsx)("p",{className:"why",children:r("chain.stopWhy")})]}),(0,n.jsxs)("div",{className:"option",children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"radio",name:"chain",checked:"continue"===m,onChange:()=>void u("continue"),disabled:l.running}),(0,n.jsx)("span",{children:r("chain.continue")})]}),(0,n.jsx)("p",{className:"why",children:r("chain.continueWhy")})]}),i&&(0,n.jsx)("div",{className:"muted small",role:"status",children:i}),l.running&&(0,n.jsx)("div",{className:"muted small",children:r("chain.locked")})]})}function L(e){let{value:s,onChange:l,presets:t,onPresetsChanged:r}=e,{t:i}=(0,d.kj)(),[o,m]=(0,a.useState)(""),u=async()=>{let e=prompt(i("l2.saveAsPrompt"));if(e)try{await c.FH.savePreset(e,s),m(i("l2.savedAs",{name:e})),null==r||r()}catch(e){m(e.message)}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("label",{className:"grow",style:{margin:0},children:i("l2.label")}),(0,n.jsxs)("select",{value:"",onChange:e=>{let s=t.find(s=>s.name===e.target.value);s&&l(s.content)},children:[(0,n.jsx)("option",{value:"",children:i("l2.loadPreset")}),t.map(e=>(0,n.jsx)("option",{value:e.name,children:e.name},e.name))]}),(0,n.jsx)("button",{onClick:()=>void u(),disabled:!s.trim(),children:i("l2.saveAs")})]}),(0,n.jsx)("textarea",{className:"prose",value:s,onChange:e=>l(e.target.value),placeholder:i("l2.placeholder"),style:{minHeight:140,marginTop:10}}),o&&(0,n.jsx)("div",{className:"muted small",children:o})]})}function W(e){let{session:s}=e,{t:l}=(0,d.kj)(),t=(0,d.W3)(),r=s.tasks.filter(e=>"queued"!==e.status),[i,o]=(0,a.useState)([]),m=i.length>0?i:r.map(e=>e.id),u=e=>(0,c.ub)("".concat(c.nC,"/sessions/").concat(s.id,"/export?variant=").concat(e)+(i.length>0?"&tasks=".concat(encodeURIComponent(i.join(","))):""));return(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("h2",{children:l("export.title")}),(0,n.jsx)("p",{className:"muted small",children:l("export.hint")}),0===r.length?(0,n.jsx)("div",{className:"empty",children:l("export.nothing")}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"row",style:{marginBottom:6},children:[(0,n.jsx)("button",{className:"quiet",onClick:()=>o(r.map(e=>e.id)),children:l("export.all")}),(0,n.jsx)("button",{className:"quiet",onClick:()=>o([]),children:l("export.none")}),(0,n.jsx)("span",{className:"muted small",children:i.length>0?l("export.selected",{n:i.length}):l("export.allOf",{n:r.length})})]}),r.map(e=>{var s,a;return(0,n.jsx)("div",{className:"option",style:{margin:"6px 0"},children:(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"checkbox",checked:i.includes(e.id),onChange:()=>{let s;return s=e.id,o(e=>e.includes(s)?e.filter(e=>e!==s):[...e,s])}}),(0,n.jsxs)("span",{children:[e.title," ",(0,n.jsx)("span",{className:"badge ".concat(e.status),children:l("status.".concat(e.status))})," ",e.readOnly&&(0,n.jsx)("span",{className:"chip",children:l("task.readOnly")})," ",(0,n.jsx)("span",{className:"muted small",children:t(null!=(a=null!=(s=e.finishedAt)?s:e.startedAt)?a:e.createdAt)})]})]})},e.id)}),(0,n.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,n.jsx)("a",{className:"button-link",href:u("outcome"),download:!0,children:l("export.outcome",{n:m.length})}),(0,n.jsx)("a",{className:"button-link",href:u("full"),download:!0,children:l("export.full",{n:m.length})})]}),(0,n.jsx)("p",{className:"muted small",style:{marginTop:8},children:l("export.outcomeWhy")})]})]})}function O(e){var s;let{session:l,presets:t,onAdded:r,onPresetsChanged:i}=e,{t:o}=(0,d.kj)(),m=[...l.tasks].reverse()[0],[u,h]=(0,a.useState)(""),[p,x]=(0,a.useState)(null!=(s=null==m?void 0:m.level2)?s:""),[v,j]=(0,a.useState)(""),[g,f]=(0,a.useState)(""),k=async()=>{try{await c.FH.addTask(l.id,{title:u,level2:p,prompt:v}),h(""),j(""),f(o("form.queued")),r()}catch(e){f(e.message)}};return(0,n.jsxs)("div",{className:"panel",id:"new-task",children:[(0,n.jsx)("h2",{children:o("form.title")}),(0,n.jsx)("p",{className:"muted small",children:o("form.hint")}),(0,n.jsx)("label",{children:o("form.titleLabel")}),(0,n.jsx)("input",{type:"text",value:u,onChange:e=>h(e.target.value),placeholder:o("form.titlePlaceholder")}),(0,n.jsx)("div",{style:{marginTop:10},children:(0,n.jsx)(L,{value:p,onChange:x,presets:t,onPresetsChanged:i})}),(0,n.jsx)("label",{children:o("form.taskLabel")}),(0,n.jsx)("textarea",{className:"prose",value:v,onChange:e=>j(e.target.value),placeholder:o("form.taskPlaceholder"),style:{minHeight:140}}),(0,n.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,n.jsx)("button",{className:"primary",onClick:()=>void k(),disabled:!v.trim(),children:o("form.add")}),(0,n.jsx)("span",{className:"muted small",children:g})]})]})}function A(e){var s,l,t,r,i,h,p,x,v,j,g,N,w,C,S,F,D,H,T,M,I,P,W,O,A,R,B,J,z,Z,_,K,Y,$,Q,V,X,ee,es,el,en,ea,et,er,ei,ec,ed,eo,em,eu,eh,ep,ex,ev,ej,eg,ef,ek,ey,eN,eb;let{session:ew,task:eC,index:eS,presets:eF,onChange:eD}=e,{t:eH}=(0,d.kj)(),eT=(0,d.W3)(),[eM,eI]=(0,a.useState)(!1),[eP,eL]=(0,a.useState)(!1),[eW,eO]=(0,a.useState)(eC.title),[eA,eR]=(0,a.useState)(eC.level2),[eE,eB]=(0,a.useState)(eC.prompt),[eU,eG]=(0,a.useState)(null!=(B=null==(s=eC.vcsPlan)?void 0:s.branch)?B:""),[eq,eJ]=(0,a.useState)(null!=(J=null==(l=eC.vcsPlan)?void 0:l.commitMessage)?J:""),[ez,eZ]=(0,a.useState)(null!=(z=eC.checks)?z:[]),e_=(0,u.c)((0,m.DG)(eC)),[eK,eY]=(0,a.useState)(null),[e$,eQ]=(0,a.useState)(""),eV=async()=>{try{await c.FH.updateTask(ew.id,eC.id,{title:eW,level2:eA,prompt:eE,vcsPlan:{branch:eU,commitMessage:eq},checks:ez}),eI(!1),eD()}catch(e){eQ(e.message)}},eX="running"===eC.status||"waiting-approval"===eC.status,e0=!eX&&"queued"!==eC.status,e1=!eX&&"queued"!==eC.status,e2=!eX&&null!=(Z=null==(t=ew.vcs)?void 0:t.enabled)&&Z&&(!!(null==(r=eC.vcs)?void 0:r.baseCommit)||(null!=(_=eC.attempts)?_:[]).some(e=>{var s;return null==(s=e.vcs)?void 0:s.baseCommit})),e4=!eX&&"limit-reached"===eC.status,e6=async()=>{if(await (0,y.Z)(eH("task.continueConfirm",{title:eC.title})))try{await c.FH.continueTask(ew.id,eC.id),eD()}catch(e){eQ(e.message)}},e8=async()=>{if(await (0,y.Z)(eH("task.rerunConfirm",{title:eC.title})))try{await c.FH.rerunTask(ew.id,eC.id),eD()}catch(e){eQ(e.message)}},e5=async()=>{if(await (0,y.Z)(eH("task.editRanConfirm",{title:eC.title})))try{await c.FH.rerunTask(ew.id,eC.id,{title:eW,level2:eA,prompt:eE,vcsPlan:{branch:eU,commitMessage:eq},checks:ez}),eI(!1),eD()}catch(e){eQ(e.message)}},e3=(0,b.e)(eD),e7=async()=>{let e="queued"===eC.status?"task.deleteConfirm":"task.deleteConfirmRan";if(await (0,y.Z)(eH(e,{title:eC.title})))try{await c.FH.deleteTask(ew.id,eC.id),eD()}catch(e){eQ(e.message)}},e9=async()=>{eK||eY(await c.FH.taskFiles(ew.id,eC.id))},se=(e,s,l)=>l.length>0&&(0,n.jsxs)("div",{children:[(0,n.jsxs)("span",{className:"muted",children:[eH(e)," "]}),l.map(e=>(0,n.jsx)("span",{style:{marginRight:10},children:(0,n.jsx)(o.u,{label:e,save:()=>c.FH.saveTaskFile(ew.id,eC.id,s,e)})},e))]});return(0,n.jsxs)("div",{className:"task ".concat(eC.status),id:eC.id,children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsxs)("h4",{className:"grow",children:[eS,". ",eC.title]}),(0,n.jsx)("span",{className:"badge ".concat(eC.status),children:eH("status.".concat(eC.status))}),(null!=(K=eC.attempt)?K:1)>1&&(0,n.jsx)("span",{className:"chip",children:eH("task.attemptN",{n:null!=(Y=eC.attempt)?Y:1})}),eC.iterations>0&&(0,n.jsx)("span",{className:"muted small",children:eH("task.iterations",{n:eC.iterations})}),eC.runId&&(0,n.jsxs)("button",{className:eP?"":"quiet",onClick:()=>eL(e=>!e),title:(0,m.DG)(eC)?eH("story.showLiveWhy"):eH("story.why"),children:[(0,m.DG)(eC)&&!eP&&(0,n.jsx)("span",{className:"dot","aria-hidden":"true"}),eP?eH("story.hide"):(0,m.DG)(eC)?eH("story.showLive"):eH("story.show")]}),!eX&&(0,n.jsx)("button",{onClick:()=>eI(e=>!e),title:eH("task.editAll"),children:eM?eH("task.cancel"):eH("task.edit")}),e4&&(0,n.jsx)("button",{className:"primary",onClick:()=>void e6(),title:eH("task.continueWhy"),children:eH("task.continue")}),e1&&(0,n.jsx)("button",{className:e4?"":"primary",onClick:()=>void e8(),title:eH("task.rerunWhy"),children:eH("task.rerun")}),e2&&(0,n.jsx)("button",{onClick:()=>void e3.restore({sessionId:ew.id,taskId:eC.id,title:eC.title}),disabled:""!==e3.busy||ew.running,title:eH("restore.why"),children:"restore"===e3.busy?eH("restore.checking"):eH("restore.button")}),e0&&(0,n.jsx)("button",{onClick:()=>void e3.restartFrom({sessionId:ew.id,taskId:eC.id,title:eC.title}),disabled:""!==e3.busy||ew.running,title:eH("restart.why"),children:"restart"===e3.busy?eH("restart.checking"):eH("restart.button")}),!eX&&(0,n.jsx)("button",{className:"danger",onClick:()=>void e7(),children:eH("task.delete")}),!eM&&(e$||e3.message)&&(0,n.jsx)("span",{className:"err",role:"alert",children:e$||e3.message})]}),(0,n.jsxs)("div",{className:"muted small",children:[eC.startedAt?eH("task.started",{t:eT(eC.startedAt)}):eH("task.added",{t:eT(eC.createdAt)}),eC.finishedAt?" \xb7 ".concat(eH("task.finished",{t:eT(eC.finishedAt)})):"",eC.startedAt&&eC.finishedAt?" \xb7 ".concat(eH("task.took",{d:(0,c.c5)((0,m.d5)(eC.startedAt,eC.finishedAt))})):"",(0,m.DG)(eC)?" \xb7 ".concat(eH("task.runningFor",{d:(0,c.c5)((0,m.d5)(eC.startedAt,void 0,e_))})):""]}),"queued"!==eC.status&&(null==(i=ew.vcs)?void 0:i.enabled)&&eC.vcs&&(0,n.jsx)("div",{className:"muted small",children:eC.vcs.problem&&!eC.vcs.branch?(0,n.jsx)("span",{className:"reason",children:eH("vcs.taskProblem",{problem:eC.vcs.problem})}):(0,n.jsxs)(n.Fragment,{children:[eC.vcs.branch&&eH("vcs.taskBranch",{branch:eC.vcs.branch}),eC.vcs.baseCommit&&" \xb7 ".concat(eH("vcs.taskBase",{commit:eC.vcs.baseCommit.slice(0,8)})),eC.vcs.commit?" \xb7 ".concat(eH("vcs.taskCommit",{commit:eC.vcs.commit.slice(0,8)})):" \xb7 ".concat(eH("vcs.taskNoFiles")),(null!=($=null==(h=eC.vcs.files)?void 0:h.length)?$:0)>0&&(0,n.jsxs)("details",{style:{display:"inline"},children:[(0,n.jsxs)("summary",{style:{display:"inline",cursor:"pointer"},children:[" \xb7 ",eH("vcs.taskFiles",{n:null!=(Q=null==(p=eC.vcs.files)?void 0:p.length)?Q:0})]}),(0,n.jsx)("ul",{style:{margin:"4px 0 4px 0",paddingLeft:20},children:(null!=(V=eC.vcs.files)?V:[]).map(e=>(0,n.jsxs)("li",{children:[(0,n.jsx)("code",{children:e.path})," ",e.added<0||e.removed<0?eH("vcs.taskBinary"):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("span",{style:{color:"var(--ok)"},children:["+",e.added]})," ",(0,n.jsxs)("span",{style:{color:"var(--bad)"},children:["-",e.removed]})]})]},e.path))})]}),(null!=(X=null==(x=eC.vcs.suspicious)?void 0:x.length)?X:0)>0&&(0,n.jsxs)("div",{className:"err small",style:{marginTop:4},children:[eH("vcs.suspicious",{n:null!=(ee=null==(v=eC.vcs.suspicious)?void 0:v.length)?ee:0}),(0,n.jsx)("ul",{style:{margin:"4px 0",paddingLeft:20},children:(null!=(es=eC.vcs.suspicious)?es:[]).map(e=>(0,n.jsxs)("li",{children:[(0,n.jsx)("code",{children:e.path})," — ",e.reason]},e.path))})]})]})}),"queued"===eC.status&&(null==(j=ew.vcs)?void 0:j.enabled)&&((null==(g=eC.vcsPlan)?void 0:g.branch)||(null==(N=eC.vcsPlan)?void 0:N.commitMessage))&&(0,n.jsx)("div",{className:"muted small",children:eC.vcsPlan.branch&&eC.vcsPlan.commitMessage?eH("task.gitNames",{branch:eC.vcsPlan.branch,subject:eC.vcsPlan.commitMessage.split("\n")[0]}):eC.vcsPlan.branch?eH("task.gitBranchOnly",{branch:eC.vcsPlan.branch}):eH("task.gitCommitOnly",{subject:(null!=(el=eC.vcsPlan.commitMessage)?el:"").split("\n")[0]})}),eP&&eC.runId&&(0,n.jsx)(f.P,{sessionId:ew.id,taskId:eC.id,live:"running"===eC.status||"waiting-approval"===eC.status}),eM?(0,n.jsxs)("div",{style:{marginTop:8},children:[(0,n.jsx)("label",{children:eH("form.titleLabel")}),(0,n.jsx)("input",{type:"text",value:eW,onChange:e=>eO(e.target.value)}),(0,n.jsx)("div",{style:{marginTop:8},children:(0,n.jsx)(L,{value:eA,onChange:eR,presets:eF})}),(0,n.jsx)("label",{children:eH("form.taskLabel")}),(0,n.jsx)("textarea",{className:"prose",value:eE,onChange:e=>eB(e.target.value)}),(null==(w=ew.vcs)?void 0:w.enabled)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("label",{htmlFor:"branch-".concat(eC.id),children:eH("task.branch")}),(0,n.jsx)("input",{id:"branch-".concat(eC.id),type:"text",value:eU,onChange:e=>eG(e.target.value),placeholder:ew.vcs.branchPrefix,disabled:"per-session"===ew.vcs.branchMode}),(0,n.jsx)("p",{className:"why",children:"per-session"===ew.vcs.branchMode?eH("task.branchIgnored"):eH("task.branchWhy")}),(0,n.jsx)("label",{htmlFor:"commit-".concat(eC.id),children:eH("task.commitMessage")}),(0,n.jsx)("textarea",{id:"commit-".concat(eC.id),value:eq,onChange:e=>eJ(e.target.value),style:{minHeight:70}}),(0,n.jsx)("p",{className:"why",children:eH("task.commitWhy")})]}),(0,n.jsx)(E,{checks:ez,onChange:eZ}),(0,n.jsxs)("div",{className:"row",style:{marginTop:8},children:[(0,n.jsx)("button",{className:"primary",onClick:()=>void(e0?e5():eV()),children:e0?eH("task.saveAndRerun"):eH("task.save")}),(0,n.jsx)("span",{className:"err",children:e$})]}),e0&&(0,n.jsx)("p",{className:"muted small",children:eH("task.editRanWhy")})]}):(0,n.jsxs)(n.Fragment,{children:[(null!=(en=null==(C=eC.checks)?void 0:C.length)?en:0)>0&&(0,n.jsxs)("details",{className:"small",style:{margin:"6px 0"},children:[(0,n.jsxs)("summary",{children:[eH("checks.title")," — ",eH("checks.n",{n:null!=(ea=null==(S=eC.checks)?void 0:S.length)?ea:0}),(null!=(et=null==(F=eC.checkResults)?void 0:F.length)?et:0)>0&&" \xb7 ".concat((null!=(er=eC.checkResults)?er:[]).filter(e=>e.passed).length,"/").concat(null==(D=eC.checkResults)?void 0:D.length," ").concat(eH("checks.passed"))]}),(0,n.jsx)("ul",{style:{margin:"6px 0",paddingLeft:20},children:(null!=(ei=eC.checks)?ei:[]).map((e,s)=>{var l;let a=(null!=(l=eC.checkResults)?l:[]).find(s=>s.name===e.name);return(0,n.jsxs)("li",{children:[(0,n.jsx)("strong",{children:e.name}),(0,n.jsxs)("span",{className:"muted",children:[" — ",eH("checks.kind.".concat(e.expect)),e.value?' "'.concat(e.value,'"'):"",e.run?": ".concat(e.run):e.file?": ".concat(e.file):""]}),a&&(0,n.jsxs)("div",{className:a.passed?"muted":"reason",children:[a.passed?eH("checks.passed"):eH("checks.failed")," — ",a.detail]})]},"".concat(e.name,"-").concat(s))})})]}),(null!=(ec=null==(H=eC.reviewChecks)?void 0:H.length)?ec:0)>0&&(0,n.jsxs)("details",{className:"small",style:{margin:"6px 0"},children:[(0,n.jsx)("summary",{children:eH("checks.fromReview",{n:null!=(ed=null==(T=eC.reviewChecks)?void 0:T.length)?ed:0})}),(0,n.jsx)("p",{className:"why",children:eH("checks.fromReviewWhy")}),(0,n.jsx)("ul",{style:{margin:"6px 0",paddingLeft:20},children:(null!=(eo=eC.reviewChecks)?eo:[]).map(e=>{var s;let l=(null!=(s=eC.checkResults)?s:[]).find(s=>s.name===e.check.name);return(0,n.jsxs)("li",{children:[(0,n.jsx)("code",{children:e.findingId})," ",(0,n.jsx)("strong",{children:e.check.name}),"active"!==e.state&&(0,n.jsx)("span",{className:"chip",style:{marginLeft:6},children:eH("checks.state.".concat(e.state))}),(0,n.jsx)("div",{className:"muted",children:e.what}),l&&(0,n.jsxs)("div",{className:l.passed?"muted":"reason",children:[l.passed?eH("checks.passed"):eH("checks.failed")," — ",l.detail]})]},e.check.name)})})]}),(0,n.jsx)(q,{review:eC.review}),eC.summary&&(0,n.jsxs)("div",{className:"summary",children:[(0,n.jsx)("strong",{children:eH("task.whatWasDone")}),(0,n.jsx)(k.s,{text:eC.summary})]}),(null!=(em=null==(M=eC.deviations)?void 0:M.length)?em:0)>0&&(0,n.jsx)(U,{items:null!=(eu=eC.deviations)?eu:[]}),(null!=(eh=null==(I=eC.disputes)?void 0:I.length)?eh:0)>0&&(0,n.jsx)(G,{items:null!=(ep=eC.disputes)?ep:[]}),eC.environment&&(0,n.jsx)("div",{className:"muted small",style:{margin:"4px 0"},children:eH("task.ranWith",{node:eC.environment.node,npm:null!=(ex=eC.environment.npm)?ex:"—",git:null!=(ev=eC.environment.git)?ev:"—",pwsh:null!=(eg=null!=(ej=eC.environment.pwsh)?ej:eC.environment.powershell)?eg:"—"})}),(null!=(ef=null==(P=eC.leftovers)?void 0:P.length)?ef:0)>0&&(0,n.jsxs)("div",{className:"err small",style:{margin:"6px 0"},children:[eH("task.leftovers",{n:null!=(ek=null==(W=eC.leftovers)?void 0:W.length)?ek:0}),(0,n.jsx)("ul",{style:{margin:"4px 0",paddingLeft:20},children:(null!=(ey=eC.leftovers)?ey:[]).map(e=>(0,n.jsxs)("li",{children:[(0,n.jsx)("code",{children:e.name})," pid ",e.pid,e.ports.length>0?" \xb7 ".concat(eH("task.leftoverPorts",{ports:e.ports.join(", ")})):""," \xb7 ",e.by]},"".concat(e.by,"-").concat(e.pid)))})]}),eC.reason&&(0,n.jsx)("div",{className:"reason small",style:{margin:"6px 0"},children:eC.reason}),(null!=(eN=null==(O=eC.attempts)?void 0:O.length)?eN:0)>0&&(0,n.jsxs)("details",{children:[(0,n.jsx)("summary",{children:eH("task.attempts",{n:null!=(eb=null==(A=eC.attempts)?void 0:A.length)?eb:0})}),null==(R=eC.attempts)?void 0:R.map((e,s)=>{var l;return(0,n.jsxs)("div",{className:"small",style:{margin:"8px 0 12px"},children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("strong",{children:eH("task.attemptN",{n:s+1})}),(0,n.jsx)("span",{className:"badge ".concat(e.status),children:eH("status.".concat(e.status))}),e.iterations>0&&(0,n.jsx)("span",{className:"muted",children:eH("task.iterations",{n:e.iterations})}),e.runId&&(0,n.jsx)(o.u,{label:eH("save.attemptLog"),save:()=>c.FH.saveTaskLog(ew.id,eC.id,e.runId)}),e.runId&&(0,n.jsx)(o.H,{sessionId:ew.id,taskId:eC.id,attempt:s+1})]}),(0,n.jsxs)("div",{className:"muted",children:[e.startedAt?eH("task.started",{t:eT(e.startedAt)}):"",e.finishedAt?" \xb7 ".concat(eH("task.finished",{t:eT(e.finishedAt)})):""]}),e.summary&&(0,n.jsx)("div",{children:e.summary}),e.reason&&(0,n.jsx)("div",{className:"err",children:e.reason}),e.prompt&&e.prompt!==eC.prompt&&(0,n.jsxs)("details",{children:[(0,n.jsx)("summary",{children:eH("task.attemptText")}),(0,n.jsx)("pre",{children:e.prompt})]})]},"".concat(null!=(l=e.runId)?l:s))})]}),"queued"===eC.status?(0,n.jsxs)("div",{style:{marginTop:8},children:[(0,n.jsx)("div",{className:"muted small",children:eH("task.prompt")}),(0,n.jsx)("pre",{children:eC.prompt}),eC.level2.trim()?(0,n.jsxs)("details",{children:[(0,n.jsx)("summary",{children:eH("task.l2Show",{n:eC.level2.trim().split("\n").length})}),(0,n.jsx)("pre",{children:eC.level2})]}):(0,n.jsx)("div",{className:"muted small",children:eH("task.noL2")})]}):(0,n.jsxs)("details",{children:[(0,n.jsx)("summary",{children:eH("task.promptAndL2")}),eC.level2.trim()&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"muted small",children:eH("task.l2")}),(0,n.jsx)("pre",{children:eC.level2})]}),(0,n.jsx)("div",{className:"muted small",children:eH("task.prompt")}),(0,n.jsx)("pre",{children:eC.prompt})]}),eC.firstMessage&&(0,n.jsxs)("details",{children:[(0,n.jsx)("summary",{children:eH("task.firstMessage")}),(0,n.jsx)("pre",{className:"tall",children:eC.firstMessage})]}),eC.runId&&(0,n.jsxs)("details",{onToggle:e=>e.currentTarget.open&&void e9(),children:[(0,n.jsx)("summary",{children:eH("task.files")}),(0,n.jsx)("div",{className:"row small",style:{margin:"6px 0"},children:(0,n.jsx)(o.u,{label:eH("save.log"),save:()=>c.FH.saveTaskLog(ew.id,eC.id)})}),eK&&(0,n.jsxs)("div",{className:"small",children:[se("task.reports","reports",eK.reports),se("task.artifacts","artifacts",eK.artifacts),se("task.replies","replies",eK.replies)]})]}),eC.finalReply&&(0,n.jsxs)("details",{children:[(0,n.jsx)("summary",{children:eH("task.finalReply")}),(0,n.jsx)("pre",{className:"tall",children:eC.finalReply})]})]})]})}function R(e){let{events:s}=e,{t:l}=(0,d.kj)(),{appearance:t}=(0,x.K)(),r=(0,a.useRef)(null);return(0,a.useEffect)(()=>{!t.reduceMotion&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[s.length,t.reduceMotion]),(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("h2",{children:l("live.title")}),(0,n.jsxs)("div",{className:"log",ref:r,children:[0===s.length&&(0,n.jsx)("div",{className:"muted",children:l("live.none")}),s.map((e,s)=>{var l;return(0,n.jsxs)("div",{className:e.level,children:[(0,n.jsx)("span",{className:"time",children:new Date(e.at).toLocaleTimeString(void 0,{hour12:!1})}),null!=(l=e.message)?l:e.type]},s)})]})]})}function E(e){let{checks:s,onChange:l}=e,{t:a}=(0,d.kj)(),t=(e,n)=>l(s.map((s,l)=>e===l?{...s,...n}:s));return(0,n.jsxs)("div",{style:{marginTop:12},children:[(0,n.jsx)("label",{children:a("checks.title")}),(0,n.jsx)("p",{className:"why",style:{marginTop:0},children:a("checks.why")}),0===s.length&&(0,n.jsx)("p",{className:"muted small",children:a("checks.noneWhy")}),s.map((e,r)=>{var i,d,o,m;return(0,n.jsxs)("div",{className:"option",children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("input",{type:"text",className:"grow",value:e.name,placeholder:a("checks.namePlaceholder"),onChange:e=>t(r,{name:e.target.value}),"aria-label":a("checks.name")}),(0,n.jsx)("select",{value:e.expect,onChange:e=>t(r,{expect:e.target.value}),"aria-label":a("checks.kind"),style:{width:"auto"},children:c.FZ.map(e=>(0,n.jsx)("option",{value:e,children:a("checks.kind.".concat(e))},e))}),(0,n.jsx)("button",{className:"quiet",onClick:()=>l(s.filter((e,s)=>s!==r)),children:a("checks.remove")})]}),(0,n.jsxs)("div",{className:"row",style:{marginTop:6},children:[(0,c.rt)(e.expect)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("input",{type:"text",className:"grow",value:null!=(i=e.run)?i:"",placeholder:a("checks.run"),onChange:e=>t(r,{run:e.target.value}),"aria-label":a("checks.run")}),(0,n.jsx)("input",{type:"text",value:null!=(d=e.cwd)?d:"",placeholder:a("checks.cwd"),onChange:e=>t(r,{cwd:e.target.value}),"aria-label":a("checks.cwd"),style:{width:220}})]}):(0,n.jsx)("input",{type:"text",className:"grow",value:null!=(o=e.file)?o:"",placeholder:a("checks.file"),onChange:e=>t(r,{file:e.target.value}),"aria-label":a("checks.file")}),(0,c.dK)(e.expect)&&(0,n.jsx)("input",{type:"text",value:null!=(m=e.value)?m:"",placeholder:"output-matches"===e.expect?a("checks.valueRegex"):a("checks.value"),onChange:e=>t(r,{value:e.target.value}),"aria-label":a("checks.value"),style:{width:240}})]})]},r)}),(0,n.jsx)("button",{onClick:()=>l([...s,{name:"",expect:"exit-zero",run:""}]),children:a("checks.add")})]})}function B(e){let{tasks:s}=e,{t:l}=(0,d.kj)(),a=(0,m.hH)(s),t=(0,u.c)(!!a&&a.tasks.some(m.DG));if(!a)return null;let r=(0,m.eZ)(a.run,a.tasks,t);return(0,n.jsx)("p",{className:"muted small",style:{margin:"4px 0 10px"},children:l(r.live?"session.runClockLive":"session.runClock",{n:r.tasks,d:(0,c.c5)(r.ms)})})}function U(e){let{items:s}=e,{t:l}=(0,d.kj)();return(0,n.jsxs)("div",{className:"summary",children:[(0,n.jsx)("strong",{children:l("task.deviations",{n:s.length})}),(0,n.jsx)("ol",{style:{margin:"6px 0",paddingLeft:20},children:s.map((e,s)=>(0,n.jsxs)("li",{style:{marginBottom:6},children:[(0,n.jsx)("div",{children:e.instruction}),(0,n.jsxs)("div",{className:"muted",children:[l("task.deviationDid"),": ",e.did]}),(0,n.jsxs)("div",{className:"muted",children:[l("task.deviationWhy"),": ",e.why]})]},s))})]})}function G(e){let{items:s}=e,{t:l}=(0,d.kj)();return(0,n.jsxs)("div",{className:"summary",children:[(0,n.jsx)("strong",{children:l("task.disputes",{n:s.length})}),(0,n.jsx)("ol",{style:{margin:"6px 0",paddingLeft:20},children:s.map((e,s)=>(0,n.jsxs)("li",{style:{marginBottom:6},children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("code",{children:e.finding})," — ",e.why]}),(0,n.jsxs)("div",{className:"muted",children:[l("review.evidence"),": ",e.evidence]})]},s))})]})}function q(e){var s,l,a,t,r;let{review:i}=e,{t:c}=(0,d.kj)();if(!i||"skipped"===i.verdict)return null;let o="pass"===i.verdict?"done":"fail"===i.verdict?"blocked":"waiting-approval";return(0,n.jsxs)("div",{className:"small",style:{margin:"8px 0"},children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("span",{className:"badge ".concat(o),children:c("review.verdict.".concat(i.verdict))}),i.stepsRun>0&&(0,n.jsx)("span",{className:"muted",children:c("review.ran",{n:i.stepsRun})}),i.rounds>1&&(0,n.jsx)("span",{className:"muted",children:c("review.rounds",{n:i.rounds})}),i.model&&(0,n.jsx)("span",{className:"chip",children:c("review.onModel",{model:i.model})})]}),i.problem&&(0,n.jsx)("p",{className:"reason",children:c("review.problem",{problem:i.problem})}),i.summary&&(0,n.jsx)(k.s,{text:i.summary}),(null!=(a=null==(s=i.findings)?void 0:s.length)?a:0)>0&&(0,n.jsxs)("details",{style:{marginTop:4},children:[(0,n.jsx)("summary",{children:c("review.findings",{n:null!=(t=null==(l=i.findings)?void 0:l.length)?t:0})}),(0,n.jsx)("ol",{style:{margin:"6px 0",paddingLeft:20},children:(null!=(r=i.findings)?r:[]).map((e,s)=>(0,n.jsxs)("li",{style:{marginBottom:8},children:[(0,n.jsxs)("div",{children:[e.id&&(0,n.jsx)("code",{style:{marginRight:6},children:e.id}),e.what,"task"===e.about&&(0,n.jsx)("span",{className:"chip",style:{marginLeft:6},children:c("review.aboutTask")}),e.repeated&&(0,n.jsx)("span",{className:"chip",style:{marginLeft:6},children:c("review.repeated")})]}),e.where&&(0,n.jsx)("div",{className:"muted",children:e.where}),(0,n.jsxs)("div",{className:"muted",children:[c("review.evidence"),": ",e.evidence]})]},s))})]})]})}},4784:(e,s,l)=>{"use strict";l.d(s,{Y:()=>i});var n=l(3365),a=l(1521),t=l(5549),r=l(867);function i(e){var s,l;let{id:i,chosen:c,onChange:d,none:o,catalogue:m,disabled:u=!1,style:h}=e,{t:p}=(0,r.kj)(),x=function(e){let[s,l]=(0,a.useState)(null);return(0,a.useEffect)(()=>{if(void 0!==e)return;let s=!0;return t.FH.models().then(e=>{s&&l(e)}).catch(()=>void 0),()=>{s=!1}},[e]),void 0!==e?e:s}(m),v=null!=(s=null==x?void 0:x.options)?s:[],j=v.some(e=>e.name===c),g=v.filter(e=>!e.group),f=new Map;for(let e of v)e.group&&f.set(e.group,[...null!=(l=f.get(e.group))?l:[],e]);return(0,n.jsxs)("select",{id:i,value:c,onChange:e=>d(e.target.value),disabled:u,style:{width:"auto",minWidth:280,...h},children:[(0,n.jsx)("option",{value:"",children:o}),c&&!j&&(0,n.jsx)("option",{value:c,children:p("model.notInList",{name:c})}),g.map(e=>(0,n.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(p("model.unavailable")):""]},e.name)),[...f.entries()].map(e=>{let[s,l]=e;return(0,n.jsx)("optgroup",{label:s,children:l.map(e=>(0,n.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(p("model.unavailable")):""]},e.name))},s)})]})}},8848:(e,s,l)=>{"use strict";l.d(s,{H4:()=>d,L:()=>o,z4:()=>m});var n=l(3365),a=l(8197),t=l.n(a),r=l(1521),i=l(5549),c=l(867);function d(e){let{current:s,onUse:l}=e,{t:a}=(0,c.kj)(),[t,d]=(0,r.useState)(null);if((0,r.useEffect)(()=>{let e=!1;return i.FH.project().then(s=>{e||d(s)}).catch(()=>void 0),()=>{e=!0}},[]),!t)return null;let o=t.rootDir.trim(),m=s.trim().toLowerCase(),u=l?t.others.filter(e=>e.rootDir.trim().toLowerCase()!==m):[];return(0,n.jsx)(h,{label:o?a("proj.defaultIs",{dir:o}):a("proj.noneShort"),offer:o&&l&&m!==o.toLowerCase()?{text:a("proj.useIt"),onUse:()=>l(o)}:void 0,more:u.map(e=>({text:a("proj.otherUse",{name:e.name}),title:e.rootDir,onUse:()=>null==l?void 0:l(e.rootDir)})),link:o?a("proj.change"):a("proj.setIt"),anchor:"project"})}function o(e){let{current:s,onUse:l}=e,a=u(),{t}=(0,c.kj)();if(!a)return null;let r=a.defaultModel.trim();return(0,n.jsx)(h,{label:r?t("def.modelDefaultIs",{name:r}):t("def.modelNoneShort"),offer:r&&l&&s.trim()!==r?{text:t("def.modelUseIt"),onUse:()=>l(r)}:void 0,link:t(r?"proj.change":"proj.setIt"),anchor:"model"})}function m(e){let{current:s,onUse:l}=e,a=u(),{t}=(0,c.kj)();if(!a)return null;let r=a.defaultReviewModel.trim();return(0,n.jsx)(h,{label:r?t("def.reviewDefaultIs",{name:r}):t("def.reviewNoneShort"),offer:r&&l&&s.trim()!==r?{text:t("def.modelUseIt"),onUse:()=>l(r)}:void 0,link:t(r?"proj.change":"proj.setIt"),anchor:"review"})}function u(){let[e,s]=(0,r.useState)(null);return(0,r.useEffect)(()=>{let e=!1;return i.FH.models().then(l=>{e||s(l)}).catch(()=>void 0),()=>{e=!0}},[]),e}function h(e){let{label:s,offer:l,more:a=[],link:r,anchor:i}=e;return(0,n.jsxs)("p",{className:"muted small",style:{marginTop:4},children:[s," ",l&&(0,n.jsxs)(n.Fragment,{children:["\xb7"," ",(0,n.jsx)("button",{type:"button",className:"linkish",onClick:l.onUse,children:l.text})," "]}),a.map(e=>(0,n.jsxs)("span",{children:["\xb7"," ",(0,n.jsx)("button",{type:"button",className:"linkish",onClick:e.onUse,title:e.title,children:e.text})," "]},e.text)),"\xb7 ",(0,n.jsx)(t(),{href:"/defaults#".concat(i),children:r})]})}}},e=>{e.O(0,[197,867,549,89,347,131,358],()=>e(e.s=1772)),_N_E=e.O()}]);
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html><!--eWzbORCbQ1h_2IeLH_njb--><html lang="en" data-theme="light" data-textsize="normal" data-contrast="normal" data-motion="normal" data-links="plain" data-focus="normal"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/css/5a10c60adf9c5336.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-0f31b926d9a9c5a4.js"/><script src="/_next/static/chunks/c7879cf7-b5ab1053c1d9a2e7.js" async=""></script><script src="/_next/static/chunks/131-bae98f790a541679.js" async=""></script><script src="/_next/static/chunks/main-app-e3a5f713ba31557e.js" async=""></script><script src="/_next/static/chunks/197-f7c33a0114fc3db3.js" async=""></script><script src="/_next/static/chunks/867-5b104743e24a4e2f.js" async=""></script><script src="/_next/static/chunks/549-2086c05135bc9753.js" async=""></script><script src="/_next/static/chunks/app/layout-92fa876afe619cf3.js" async=""></script><script src="/_next/static/chunks/app/appearance/page-501842e7aeac7f6b.js" async=""></script><title>copilot-operator</title><meta name="description" content="Runs task loops with Microsoft 365 Copilot on this machine."/><script>
1
+ <!DOCTYPE html><!--p9lexLS0u8W5N6VzLavHO--><html lang="en" data-theme="light" data-textsize="normal" data-contrast="normal" data-motion="normal" data-links="plain" data-focus="normal"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/css/5a10c60adf9c5336.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-0f31b926d9a9c5a4.js"/><script src="/_next/static/chunks/c7879cf7-b5ab1053c1d9a2e7.js" async=""></script><script src="/_next/static/chunks/131-bae98f790a541679.js" async=""></script><script src="/_next/static/chunks/main-app-e3a5f713ba31557e.js" async=""></script><script src="/_next/static/chunks/197-f7c33a0114fc3db3.js" async=""></script><script src="/_next/static/chunks/867-f0e3e152f6f67e45.js" async=""></script><script src="/_next/static/chunks/549-2086c05135bc9753.js" async=""></script><script src="/_next/static/chunks/app/layout-92fa876afe619cf3.js" async=""></script><script src="/_next/static/chunks/app/appearance/page-501842e7aeac7f6b.js" async=""></script><title>copilot-operator</title><meta name="description" content="Runs task loops with Microsoft 365 Copilot on this machine."/><script>
2
2
  (function () {
3
3
  try {
4
4
  var d = document.documentElement;
@@ -12,4 +12,4 @@
12
12
  d.dataset.focus = a.strongFocus ? 'strong' : 'normal';
13
13
  } catch (e) {}
14
14
  })();
15
- </script><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><a class="skip-link" href="#main">Skip to the content</a><div class="wrap"><header class="top"><h1><a href="/">copilot-operator</a></h1><nav aria-label="Main"><a href="/"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M4 5h16v4H4zM4 11h16v4H4zM4 17h10v2H4z"></path></svg><span>Sessions</span></a><a href="/defaults"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8zm8.5 4 1.5 1-1.6 2.8-1.8-.4a7 7 0 0 1-1.5 1.5l.4 1.8L14.7 21l-1-1.5a7 7 0 0 1-3.4 0l-1 1.5-2.8-1.6.4-1.8A7 7 0 0 1 5.4 16l-1.8.4L2 13.6 3.5 12.6V11.4L2 10.4l1.6-2.8 1.8.4A7 7 0 0 1 6.9 6.5l-.4-1.8L9.3 3l1 1.5a7 7 0 0 1 3.4 0l1-1.5 2.8 1.6-.4 1.8a7 7 0 0 1 1.5 1.5l1.8-.4L22 10.4l-1.5 1z"></path></svg><span>Settings</span></a><a href="/import"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 3v10m0 0 4-4m-4 4-4-4M4 15v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg><span>Plan from JSON</span></a><a href="/history"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 3a9 9 0 1 0 8.5 6M12 7v5l3 2M3 4v5h5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg><span>Task register</span></a><a href="/level1"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M6 3h9l5 5v13H6zM14 3v6h6M9 13h7M9 17h7" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"></path></svg><span>Level 1 prompt</span></a><a href="/presets"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M5 4h14v4H5zM5 10h14v4H5zM5 16h9v4H5z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"></path></svg><span>Level 2 presets</span></a><a aria-current="page" href="/appearance"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 3a9 9 0 0 0 0 18c1.5 0 2-1 2-2s-1-1.5-1-2.5S14 15 15.5 15H17a4 4 0 0 0 4-4 8 8 0 0 0-9-8zM8 9a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm4-3a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm4 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"></path></svg><span>Appearance</span></a><a href="/system"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M4 5h16v10H4zM2 19h20M9 15v4M15 15v4" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"></path></svg><span>System</span></a><select aria-label="Language" style="width:auto"><option value="en" selected="">English</option><option value="bg">Български</option></select></nav></header><main id="main"><div class="panel"><h2>Appearance</h2><p class="muted small">Kept in this browser only. Nothing here is sent anywhere or shared with another machine.</p><h3>Theme</h3><div class="segmented" role="group" aria-label="Theme"><button type="button" aria-pressed="false">Light</button><button type="button" aria-pressed="false">Dark</button></div><p class="muted small" style="margin-top:6px">Warm light for a bright room, warm dark for a dim one.</p></div><div class="panel"><h2>Accessibility</h2><p class="muted small">Each of these can be turned on by itself; they are independent of the theme and of the language.</p><h3>Text size</h3><div class="segmented" role="group" aria-label="Text size"><button type="button" aria-pressed="false">Normal</button><button type="button" aria-pressed="false">Large</button><button type="button" aria-pressed="false">Largest</button></div><p class="muted small" style="margin-top:6px">Scales the whole interface, not only the body text.</p><div class="option"><label><input type="checkbox"/><span>Higher contrast</span></label><p class="why">Stronger borders and darker text. Drops some of the warmth in exchange for legibility.</p></div><div class="option"><label><input type="checkbox"/><span>Less motion</span></label><p class="why">No transitions, and the live log stops scrolling itself while a run is in progress.</p></div><div class="option"><label><input type="checkbox"/><span>Underline every link</span></label><p class="why">Links stop relying on colour alone to be recognisable.</p></div><div class="option"><label><input type="checkbox"/><span>Thick focus outline</span></label><p class="why">Makes what the keyboard is on impossible to lose, when tabbing through a page.</p></div><div class="row" style="margin-top:12px"><button>Back to the defaults</button></div></div><div class="panel"><h2>How it looks</h2><p class="small">A task that ended with a summary, one waiting for approval, and a link.<!-- --> <a href="#main">a link in a sentence</a></p><div class="row"><span class="badge done">done</span><span class="badge running">running</span><span class="badge waiting-approval">waiting for approval</span><span class="badge failed">failed</span></div><div class="summary" style="margin-top:10px"><strong>What was done</strong><div>A task that ended with a summary, one waiting for approval, and a link.</div></div><div class="row"><button class="primary">Run</button><button>Skip</button><button class="danger">Abort task</button></div></div><!--$--><!--/$--></main></div><script src="/_next/static/chunks/webpack-0f31b926d9a9c5a4.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[1205,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-5b104743e24a4e2f.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"themeScript\"]\n3:I[1205,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-5b104743e24a4e2f.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"AppearanceProvider\"]\n4:I[867,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-5b104743e24a4e2f.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"LanguageProvider\"]\n5:I[1035,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-5b104743e24a4e2f.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"DialogHost\"]\n6:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-5b104743e24a4e2f.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"SkipLink\"]\n7:I[8197,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-5b104743e24a4e2f.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"\"]\n8:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-5b104743e24a4e2f.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"Nav\"]\n9:I[6657,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-5b104743e24a4e2f.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"GlobalApprovals\"]\na:I[5204,[],\"\"]\nb:I[2642,[],\"\"]\nc:I[7089,[],\"ClientPageRoot\"]\nd:I[4585,[\"867\",\"static/chunks/867-5b104743e24a4e2f.js\",\"429\",\"static/chunks/app/appearance/page-501842e7aeac7f6b.js\"],\"default\"]\n10:I[433,[],\"OutletBoundary\"]\n12:I[9884,[],\"AsyncMetadataOutlet\"]\n14:I[433,[],\"ViewportBoundary\"]\n16:I[433,"])</script><script>self.__next_f.push([1,"[],\"MetadataBoundary\"]\n17:\"$Sreact.suspense\"\n19:I[3536,[],\"\"]\n:HL[\"/_next/static/css/5a10c60adf9c5336.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"eWzbORCbQ1h_2IeLH_njb\",\"p\":\"\",\"c\":[\"\",\"appearance\"],\"i\":false,\"f\":[[[\"\",{\"children\":[\"appearance\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[\"\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/5a10c60adf9c5336.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"data-theme\":\"light\",\"data-textsize\":\"normal\",\"data-contrast\":\"normal\",\"data-motion\":\"normal\",\"data-links\":\"plain\",\"data-focus\":\"normal\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"$2\"}}]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"$L3\",null,{\"children\":[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$L5\",null,{\"children\":[[\"$\",\"$L6\",null,{}],[\"$\",\"div\",null,{\"className\":\"wrap\",\"children\":[[\"$\",\"header\",null,{\"className\":\"top\",\"children\":[[\"$\",\"h1\",null,{\"children\":[\"$\",\"$L7\",null,{\"href\":\"/\",\"children\":\"copilot-operator\"}]}],[\"$\",\"$L8\",null,{}]]}],[\"$\",\"$L9\",null,{}],[\"$\",\"main\",null,{\"id\":\"main\",\"children\":[\"$\",\"$La\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lb\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]]}]]}]}]}]}]]}]]}],{\"children\":[\"appearance\",[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$La\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lb\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[\"__PAGE__\",[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"$Lc\",null,{\"Component\":\"$d\",\"searchParams\":{},\"params\":{},\"promises\":[\"$@e\",\"$@f\"]}],null,[\"$\",\"$L10\",null,{\"children\":[\"$L11\",[\"$\",\"$L12\",null,{\"promise\":\"$@13\"}]]}]]}],{},null,false]},null,false]},null,false],[\"$\",\"$1\",\"h\",{\"children\":[null,[[\"$\",\"$L14\",null,{\"children\":\"$L15\"}],null],[\"$\",\"$L16\",null,{\"children\":[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$17\",null,{\"fallback\":null,\"children\":\"$L18\"}]}]}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$19\",[]],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"e:{}\nf:\"$0:f:0:1:2:children:2:children:1:props:children:0:props:params\"\n"])</script><script>self.__next_f.push([1,"15:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n11:null\n"])</script><script>self.__next_f.push([1,"13:{\"metadata\":[[\"$\",\"title\",\"0\",{\"children\":\"copilot-operator\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Runs task loops with Microsoft 365 Copilot on this machine.\"}]],\"error\":null,\"digest\":\"$undefined\"}\n"])</script><script>self.__next_f.push([1,"18:\"$13:metadata\"\n"])</script></body></html>
15
+ </script><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><a class="skip-link" href="#main">Skip to the content</a><div class="wrap"><header class="top"><h1><a href="/">copilot-operator</a></h1><nav aria-label="Main"><a href="/"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M4 5h16v4H4zM4 11h16v4H4zM4 17h10v2H4z"></path></svg><span>Sessions</span></a><a href="/defaults"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8zm8.5 4 1.5 1-1.6 2.8-1.8-.4a7 7 0 0 1-1.5 1.5l.4 1.8L14.7 21l-1-1.5a7 7 0 0 1-3.4 0l-1 1.5-2.8-1.6.4-1.8A7 7 0 0 1 5.4 16l-1.8.4L2 13.6 3.5 12.6V11.4L2 10.4l1.6-2.8 1.8.4A7 7 0 0 1 6.9 6.5l-.4-1.8L9.3 3l1 1.5a7 7 0 0 1 3.4 0l1-1.5 2.8 1.6-.4 1.8a7 7 0 0 1 1.5 1.5l1.8-.4L22 10.4l-1.5 1z"></path></svg><span>Settings</span></a><a href="/import"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 3v10m0 0 4-4m-4 4-4-4M4 15v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg><span>Plan from JSON</span></a><a href="/history"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 3a9 9 0 1 0 8.5 6M12 7v5l3 2M3 4v5h5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg><span>Task register</span></a><a href="/level1"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M6 3h9l5 5v13H6zM14 3v6h6M9 13h7M9 17h7" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"></path></svg><span>Level 1 prompt</span></a><a href="/presets"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M5 4h14v4H5zM5 10h14v4H5zM5 16h9v4H5z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"></path></svg><span>Level 2 presets</span></a><a aria-current="page" href="/appearance"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 3a9 9 0 0 0 0 18c1.5 0 2-1 2-2s-1-1.5-1-2.5S14 15 15.5 15H17a4 4 0 0 0 4-4 8 8 0 0 0-9-8zM8 9a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm4-3a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm4 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"></path></svg><span>Appearance</span></a><a href="/system"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M4 5h16v10H4zM2 19h20M9 15v4M15 15v4" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"></path></svg><span>System</span></a><select aria-label="Language" style="width:auto"><option value="en" selected="">English</option><option value="bg">Български</option></select></nav></header><main id="main"><div class="panel"><h2>Appearance</h2><p class="muted small">Kept in this browser only. Nothing here is sent anywhere or shared with another machine.</p><h3>Theme</h3><div class="segmented" role="group" aria-label="Theme"><button type="button" aria-pressed="false">Light</button><button type="button" aria-pressed="false">Dark</button></div><p class="muted small" style="margin-top:6px">Warm light for a bright room, warm dark for a dim one.</p></div><div class="panel"><h2>Accessibility</h2><p class="muted small">Each of these can be turned on by itself; they are independent of the theme and of the language.</p><h3>Text size</h3><div class="segmented" role="group" aria-label="Text size"><button type="button" aria-pressed="false">Normal</button><button type="button" aria-pressed="false">Large</button><button type="button" aria-pressed="false">Largest</button></div><p class="muted small" style="margin-top:6px">Scales the whole interface, not only the body text.</p><div class="option"><label><input type="checkbox"/><span>Higher contrast</span></label><p class="why">Stronger borders and darker text. Drops some of the warmth in exchange for legibility.</p></div><div class="option"><label><input type="checkbox"/><span>Less motion</span></label><p class="why">No transitions, and the live log stops scrolling itself while a run is in progress.</p></div><div class="option"><label><input type="checkbox"/><span>Underline every link</span></label><p class="why">Links stop relying on colour alone to be recognisable.</p></div><div class="option"><label><input type="checkbox"/><span>Thick focus outline</span></label><p class="why">Makes what the keyboard is on impossible to lose, when tabbing through a page.</p></div><div class="row" style="margin-top:12px"><button>Back to the defaults</button></div></div><div class="panel"><h2>How it looks</h2><p class="small">A task that ended with a summary, one waiting for approval, and a link.<!-- --> <a href="#main">a link in a sentence</a></p><div class="row"><span class="badge done">done</span><span class="badge running">running</span><span class="badge waiting-approval">waiting for approval</span><span class="badge failed">failed</span></div><div class="summary" style="margin-top:10px"><strong>What was done</strong><div>A task that ended with a summary, one waiting for approval, and a link.</div></div><div class="row"><button class="primary">Run</button><button>Skip</button><button class="danger">Abort task</button></div></div><!--$--><!--/$--></main></div><script src="/_next/static/chunks/webpack-0f31b926d9a9c5a4.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[1205,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-f0e3e152f6f67e45.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"themeScript\"]\n3:I[1205,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-f0e3e152f6f67e45.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"AppearanceProvider\"]\n4:I[867,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-f0e3e152f6f67e45.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"LanguageProvider\"]\n5:I[1035,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-f0e3e152f6f67e45.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"DialogHost\"]\n6:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-f0e3e152f6f67e45.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"SkipLink\"]\n7:I[8197,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-f0e3e152f6f67e45.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"\"]\n8:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-f0e3e152f6f67e45.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"Nav\"]\n9:I[6657,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-f0e3e152f6f67e45.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"GlobalApprovals\"]\na:I[5204,[],\"\"]\nb:I[2642,[],\"\"]\nc:I[7089,[],\"ClientPageRoot\"]\nd:I[4585,[\"867\",\"static/chunks/867-f0e3e152f6f67e45.js\",\"429\",\"static/chunks/app/appearance/page-501842e7aeac7f6b.js\"],\"default\"]\n10:I[433,[],\"OutletBoundary\"]\n12:I[9884,[],\"AsyncMetadataOutlet\"]\n14:I[433,[],\"ViewportBoundary\"]\n16:I[433,"])</script><script>self.__next_f.push([1,"[],\"MetadataBoundary\"]\n17:\"$Sreact.suspense\"\n19:I[3536,[],\"\"]\n:HL[\"/_next/static/css/5a10c60adf9c5336.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"p9lexLS0u8W5N6VzLavHO\",\"p\":\"\",\"c\":[\"\",\"appearance\"],\"i\":false,\"f\":[[[\"\",{\"children\":[\"appearance\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[\"\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/5a10c60adf9c5336.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"data-theme\":\"light\",\"data-textsize\":\"normal\",\"data-contrast\":\"normal\",\"data-motion\":\"normal\",\"data-links\":\"plain\",\"data-focus\":\"normal\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"$2\"}}]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"$L3\",null,{\"children\":[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$L5\",null,{\"children\":[[\"$\",\"$L6\",null,{}],[\"$\",\"div\",null,{\"className\":\"wrap\",\"children\":[[\"$\",\"header\",null,{\"className\":\"top\",\"children\":[[\"$\",\"h1\",null,{\"children\":[\"$\",\"$L7\",null,{\"href\":\"/\",\"children\":\"copilot-operator\"}]}],[\"$\",\"$L8\",null,{}]]}],[\"$\",\"$L9\",null,{}],[\"$\",\"main\",null,{\"id\":\"main\",\"children\":[\"$\",\"$La\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lb\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]]}]]}]}]}]}]]}]]}],{\"children\":[\"appearance\",[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$La\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lb\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[\"__PAGE__\",[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"$Lc\",null,{\"Component\":\"$d\",\"searchParams\":{},\"params\":{},\"promises\":[\"$@e\",\"$@f\"]}],null,[\"$\",\"$L10\",null,{\"children\":[\"$L11\",[\"$\",\"$L12\",null,{\"promise\":\"$@13\"}]]}]]}],{},null,false]},null,false]},null,false],[\"$\",\"$1\",\"h\",{\"children\":[null,[[\"$\",\"$L14\",null,{\"children\":\"$L15\"}],null],[\"$\",\"$L16\",null,{\"children\":[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$17\",null,{\"fallback\":null,\"children\":\"$L18\"}]}]}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$19\",[]],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"e:{}\nf:\"$0:f:0:1:2:children:2:children:1:props:children:0:props:params\"\n"])</script><script>self.__next_f.push([1,"15:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n11:null\n"])</script><script>self.__next_f.push([1,"13:{\"metadata\":[[\"$\",\"title\",\"0\",{\"children\":\"copilot-operator\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Runs task loops with Microsoft 365 Copilot on this machine.\"}]],\"error\":null,\"digest\":\"$undefined\"}\n"])</script><script>self.__next_f.push([1,"18:\"$13:metadata\"\n"])</script></body></html>