copilot-operator 0.1.2 → 0.1.3
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.
- package/README.md +5 -1
- package/dist/src/api/operator.service.js +2 -0
- package/dist/src/cli.js +1 -0
- package/dist/src/config/schema.js +25 -0
- package/dist/src/exec/authorizer.js +18 -8
- package/dist/src/exec/policyManifest.js +16 -2
- package/dist/src/orchestrator/taskRunner.js +1 -0
- package/dist/src/plan/systemGuide.js +22 -6
- package/dist/web/404.html +2 -2
- package/dist/web/_next/static/chunks/867-55627c5122ff6336.js +1 -0
- package/dist/web/_next/static/chunks/89-5585315f51e4c481.js +1 -0
- package/dist/web/_next/static/chunks/app/defaults/{page-559af121c43127a1.js → page-4ff25cafe6de779c.js} +1 -1
- package/dist/web/_next/static/chunks/app/history/page-2232949a2ff8559e.js +1 -0
- package/dist/web/_next/static/chunks/app/page-f04d6e00182ccc76.js +1 -0
- package/dist/web/_next/static/chunks/app/sessions/view/page-9dda275f4b1b0423.js +1 -0
- package/dist/web/appearance.html +2 -2
- package/dist/web/appearance.txt +10 -10
- package/dist/web/defaults.html +2 -2
- package/dist/web/defaults.txt +10 -10
- package/dist/web/history.html +2 -2
- package/dist/web/history.txt +10 -10
- package/dist/web/import.html +2 -2
- package/dist/web/import.txt +10 -10
- package/dist/web/index.html +2 -2
- package/dist/web/index.txt +10 -10
- package/dist/web/level1.html +2 -2
- package/dist/web/level1.txt +10 -10
- package/dist/web/presets.html +2 -2
- package/dist/web/presets.txt +10 -10
- package/dist/web/sessions/view.html +2 -2
- package/dist/web/sessions/view.txt +10 -10
- package/dist/web/system.html +2 -2
- package/dist/web/system.txt +10 -10
- package/package.json +1 -1
- package/dist/web/_next/static/chunks/867-5b104743e24a4e2f.js +0 -1
- package/dist/web/_next/static/chunks/955-cf291b8a60315c58.js +0 -1
- package/dist/web/_next/static/chunks/app/history/page-0df90ab9998815db.js +0 -1
- package/dist/web/_next/static/chunks/app/page-050cf6f71187e8af.js +0 -1
- package/dist/web/_next/static/chunks/app/sessions/view/page-4d31690c22c8b331.js +0 -1
- /package/dist/web/_next/static/{eWzbORCbQ1h_2IeLH_njb → QwjyyBjkO5xlKFU5O6Wux}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{eWzbORCbQ1h_2IeLH_njb → QwjyyBjkO5xlKFU5O6Wux}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{1035:(e,l,t)=>{"use strict";t.d(l,{DialogHost:()=>c,Z:()=>d});var n=t(3365),s=t(1521),a=t(867);let i=null,r=[];function d(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(t=>{var n;return n={kind:"confirm",message:e,...l,resolve:t},void(i?i(n):r.push(n))})}function c(e){var l,t;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(l=>[...l,e]),r.length>0){let e=r.splice(0,r.length);h(l=>[...l,...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 l=e=>{"Escape"===e.key&&(e.preventDefault(),p(!1))};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[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!=(l=u.title)?l: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!=(t=u.okLabel)?t:c("dialog.ok")})]})]})})]})}},2114:(e,l,t)=>{"use strict";t.r(l),t.d(l,{default:()=>h});var n=t(3365),s=t(1521),a=t(8197),i=t.n(a),r=t(5549),d=t(867),c=t(1035),o=t(8848);function h(){let{t:e}=(0,d.kj)(),l=(0,d.W3)(),[t,a]=(0,s.useState)(null),[o,h]=(0,s.useState)(null),[u,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,I]=(0,s.useState)(null),[H,W]=(0,s.useState)(!1),T=(0,s.useCallback)(async()=>{try{let[e,l,t]=await Promise.all([r.FH.sessions(),r.FH.batch().catch(()=>null),r.FH.approvals().catch(()=>[])]);a(e),h(l),p(t),x(l=>l.filter(l=>e.some(e=>e.id===l))),I(!0),W(!1),C("")}catch(e){W(!(0,r.AV)()),I(!1),C(e.message)}},[]);(0,s.useEffect)(()=>{T();let e=setInterval(()=>void T(),3e3);return()=>clearInterval(e)},[T]),(0,s.useEffect)(()=>{var e;let l=new URLSearchParams(window.location.search),t=(null!=(e=l.get("run"))?e:"").split(",").map(e=>e.trim()).filter(Boolean);0!==t.length&&(x(t),b("continue"===l.get("fail")?"continue":"stop"),f(!0),window.history.replaceState(null,"",window.location.pathname))},[]);let E=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 l=>{if(l.running)return void k(e("home.deleteRunning"));if(await (0,c.Z)(e("home.deleteConfirm",{name:l.name,n:l.tasks.length})))try{await r.FH.deleteSession(l.id),k(e("home.deleted",{name:l.name})),x(e=>e.filter(e=>e!==l.id)),await T()}catch(e){k(e.message)}},R=async()=>{let l=(null!=t?t:[]).filter(e=>j.includes(e.id));if(0===l.length)return;let n=l.map(e=>"• ".concat(e.name," (").concat(e.tasks.length,")")).join("\n");if(!await (0,c.Z)(e("home.deleteSelectedConfirm",{n:l.length,names:n})))return;let s=0,a=[];for(let e of l)try{await r.FH.deleteSession(e.id),s+=1}catch(l){a.push("".concat(e.name,": ").concat(l.message))}k(0===a.length?e("home.deletedMany",{n:s}):e("home.deleteSomeFailed",{n:s,m:a.length,why:a.join("; ")})),x([]),await T()},U=l=>{if(l.running)return{label:e("state.running"),badge:"running"};let t=l.tasks.some(e=>"queued"===e.status||"running"===e.status);if("idle"!==l.status||t||0===l.tasks.length)return{label:e("state.".concat(l.status)),badge:""};let n=l.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:[H&&(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&&!H&&(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&&E()}}),(0,n.jsx)("button",{className:"primary",onClick:()=>void E(),disabled:!1===F,children:e("home.create")})]})]}),t&&t.length>0&&(0,n.jsx)(m,{sessions:t,selected:j,setSelected:x,onFailure:g,setOnFailure:b,fromPlan:v,batch:o,approvals:u,onChange:T,move:(e,l)=>{x(t=>{let n=t.indexOf(e),s=n+l;if(n<0||s<0||s>=t.length)return t;let a=[...t];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===t&&(0,n.jsx)("div",{className:"muted",children:e("home.loading")}),t&&0===t.length&&(0,n.jsx)("div",{className:"muted",children:e("home.none")}),t&&t.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||t.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")})]}),t&&t.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}),t&&t.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:t.length>0&&j.length===t.length,onChange:e=>x(e.target.checked?t.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:t.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(l=>{if(l.includes(e))return l.filter(l=>l!==e);let n=(null!=t?t:[]).map(e=>e.id).reverse();return[...l,e].sort((e,l)=>n.indexOf(e)-n.indexOf(l))})},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:l(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 m(e){var l,t,a,h,m,u,p;let{sessions:j,selected:x,setSelected:g,onFailure:b,setOnFailure:v,fromPlan:f,batch:N,approvals:w,onChange:y,move:k}=e,{t:S}=(0,d.kj)(),[C,F]=(0,s.useState)(""),[I,H]=(0,s.useState)(""),[W,T]=(0,s.useState)(""),[E,P]=(0,s.useState)(""),[R,U]=(0,s.useState)(""),[D,B]=(0,s.useState)(null),[L,M]=(0,s.useState)([]);(0,s.useEffect)(()=>{r.FH.models().then(e=>{B(e),T(l=>l||e.defaultModel),P(l=>l||e.defaultReviewModel)}).catch(()=>void 0)},[]);let O=x.join(",");(0,s.useEffect)(()=>{let e=!1,l=O.split(",").filter(Boolean);if(0===l.length)return void M([]);let t=async()=>{let t=await Promise.all(l.map(async e=>{let l=await r.FH.vcsStatus(e).catch(()=>null);return{id:e,status:l}}));e||M(t.filter(e=>e.status&&!e.status.ok&&"off"!==e.status.problem).map(e=>{var l,t,n,s;return{name:null!=(n=null==(l=j.find(l=>l.id===e.id))?void 0:l.name)?n:e.id,problem:null!=(s=null==(t=e.status)?void 0:t.problem)?s:""}}))};t();let n=setInterval(()=>void t(),1e4);return()=>{e=!0,clearInterval(n)}},[O]);let q=new Map(j.map(e=>[e.id,e])),_=e=>e.tasks.filter(e=>"queued"===e.status).length,Z=x.map(e=>q.get(e)).filter(e=>!!e),A=Z.filter(e=>_(e)>0),K=A.reduce((e,l)=>e+_(l),0),z=(null==N?void 0:N.running)===!0,Q=j.some(e=>e.running),V=z||0===A.length||Q,G=Q?{title:"batch.oneRunning",why:"batch.oneRunningWhy"}:0===Z.length?{title:"batch.pickFirst",why:"batch.pickFirstWhy"}:0===A.length?{title:"batch.nothingRunnable",why:"batch.nothingRunnableWhy"}:null,J=async e=>{if("unattended"!==e||await (0,c.Z)(S("batch.unattendedConfirm",{n:A.length})))try{var l;let t=await r.FH.startBatch(A.map(e=>e.id),e,b,W||void 0,E||void 0,R.trim()||A.map(e=>e.planName).find(Boolean)||void 0);F(""),H(t.started?"":null!=(l=t.reason)?l:""),y()}catch(e){H(e.message)}},X=async()=>{await r.FH.stopBatch(),F(S("batch.stopping")),y()},Y=async()=>{await r.FH.pauseBatch(),F(S("batch.pausing")),y()},$=async()=>{await r.FH.resumeBatch(),F(""),y()},ee=Z.filter(e=>{var l;return(null!=(l=e.model)?l:"")!==W}).length,el=Z.filter(e=>{var l;return(null==(l=e.review)?void 0:l.enabled)===!1}).length,et=null!=(a=null==D?void 0:D.options)?a:[],en=et.filter(e=>!e.group),es=new Map;for(let e of et)e.group&&es.set(e.group,[...null!=(h=es.get(e.group))?h:[],e]);let ea=N?{done:N.sessions.filter(e=>"done"===e.state).length,failed:N.sessions.filter(e=>"failed"===e.state).length,skipped:N.sessions.filter(e=>"skipped"===e.state||"stopped"===e.state).length}:null,ei=null==N?void 0:N.sessions.find(e=>"running"===e.state);return(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("h2",{children:S("batch.title")}),(0,n.jsx)("p",{className:"muted small",children:S("batch.hint")}),!z&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("strong",{className:"small",children:S("batch.selected",{n:A.length,tasks:K})}),(0,n.jsx)("button",{className:"quiet",onClick:()=>g(j.filter(e=>_(e)>0).map(e=>e.id).reverse()),children:S("batch.selectQueued")}),(0,n.jsx)("button",{className:"quiet",onClick:()=>g([]),disabled:0===Z.length,children:S("batch.selectNone")})]}),f&&(0,n.jsx)("p",{className:"muted small",children:S("batch.fromPlan")}),Z.length>A.length&&(0,n.jsx)("p",{className:"muted small",children:S("batch.notRunnable",{n:Z.length-A.length})}),A.length>0&&(0,n.jsx)("ol",{className:"run-order",children:A.map((e,l)=>(0,n.jsxs)("li",{children:[(0,n.jsxs)("span",{children:[e.name," ",(0,n.jsxs)("span",{className:"muted small",children:["(",_(e),")"]})]}),(0,n.jsxs)("span",{children:[(0,n.jsx)("button",{className:"quiet",onClick:()=>k(e.id,-1),disabled:0===l,"aria-label":"up",children:"↑"}),(0,n.jsx)("button",{className:"quiet",onClick:()=>k(e.id,1),disabled:l===A.length-1,"aria-label":"down",children:"↓"})]})]},e.id))}),(0,n.jsx)("label",{htmlFor:"batch-run-name",children:S("batch.runName")}),(0,n.jsx)("input",{id:"batch-run-name",type:"text",value:R,onChange:e=>U(e.target.value),placeholder:null!=(m=A.map(e=>e.planName).find(Boolean))?m:S("batch.runNamePlaceholder")}),(0,n.jsx)("p",{className:"why",children:S("batch.runNameWhy")}),(0,n.jsx)("label",{htmlFor:"batch-model",children:S("batch.model")}),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsxs)("select",{id:"batch-model",value:W,onChange:e=>T(e.target.value),style:{width:"auto",minWidth:260},children:[(0,n.jsx)("option",{value:"",children:S("batch.modelKeep")}),en.map(e=>(0,n.jsx)("option",{value:e.name,disabled:e.disabled,children:e.name},e.name)),[...es.entries()].map(e=>{let[l,t]=e;return(0,n.jsx)("optgroup",{label:l,children:t.map(e=>(0,n.jsx)("option",{value:e.name,disabled:e.disabled,children:e.name},e.name))},l)})]}),(null!=(u=null==D?void 0:D.options.length)?u:0)===0&&(0,n.jsx)("span",{className:"muted small",children:S("batch.modelNone")})]}),(0,n.jsx)("p",{className:"why",children:S("batch.modelWhy")}),(0,n.jsx)(o.L,{current:W,onUse:e=>T(e)}),W&&ee>0&&(0,n.jsx)("p",{className:"why",style:{color:"var(--warn)"},children:S("batch.modelOverrides",{n:ee})}),(0,n.jsx)("label",{htmlFor:"batch-review-model",children:S("batch.reviewModel")}),(0,n.jsx)("div",{className:"row",children:(0,n.jsxs)("select",{id:"batch-review-model",value:E,onChange:e=>P(e.target.value),style:{width:"auto",minWidth:260},children:[(0,n.jsx)("option",{value:"",children:S("batch.reviewModelKeep")}),en.map(e=>(0,n.jsx)("option",{value:e.name,disabled:e.disabled,children:e.name},e.name)),[...es.entries()].map(e=>{let[l,t]=e;return(0,n.jsx)("optgroup",{label:l,children:t.map(e=>(0,n.jsx)("option",{value:e.name,disabled:e.disabled,children:e.name},e.name))},l)})]})}),(0,n.jsx)("p",{className:"why",children:S("batch.reviewModelWhy")}),""!==E&&E===W&&(0,n.jsx)("p",{className:"why",style:{color:"var(--warn)"},children:S("batch.reviewSame")}),el>0&&(0,n.jsx)("p",{className:"why",children:S("batch.reviewOffIn",{n:el})}),(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:S("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"===b,onChange:()=>v("stop")}),(0,n.jsx)("span",{children:S("batch.chain")})]}),(0,n.jsx)("p",{className:"why",children:S("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"===b,onChange:()=>v("continue")}),(0,n.jsx)("span",{children:S("batch.independent")})]}),(0,n.jsx)("p",{className:"why",children:S("batch.independentWhy")})]})]}),G&&(0,n.jsxs)("div",{className:"notice caution",children:[(0,n.jsx)("strong",{children:S(G.title)}),(0,n.jsx)("div",{className:"small",style:{marginTop:4},children:S(G.why)})]}),L.length>0&&(0,n.jsxs)("div",{className:"notice caution",children:[(0,n.jsx)("strong",{children:S("batch.vcsProblem")}),(0,n.jsx)("ul",{children:L.map(e=>(0,n.jsx)("li",{children:S("batch.vcsProblemRow",{name:e.name,problem:e.problem})},e.name))}),(0,n.jsx)("div",{className:"muted small",children:S("batch.vcsProblemWhy")})]}),I&&(0,n.jsxs)("div",{className:"notice caution",role:"alert",children:[(0,n.jsx)("strong",{children:S("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:S("batch.notStartedIsolation")})})]}),(0,n.jsxs)("div",{className:"run-choice",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("button",{className:"primary",onClick:()=>void J("unattended"),disabled:V,children:S("batch.run",{n:A.length})}),(0,n.jsx)("p",{className:"why",children:S("batch.runWhy")})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("button",{onClick:()=>void J("confirm"),disabled:V,children:S("batch.runStep")}),(0,n.jsx)("p",{className:"why",children:S("batch.runStepWhy")})]})]})]}),z&&(0,n.jsxs)("div",{className:"row",children:[(null==N?void 0:N.pausing)?(0,n.jsx)("button",{className:"primary",onClick:()=>void $(),disabled:null==N?void 0:N.stopping,title:S("batch.resumeWhy"),children:S("batch.resume")}):(0,n.jsx)("button",{onClick:()=>void Y(),disabled:null==N?void 0:N.stopping,title:S("batch.pauseWhy"),children:S("batch.pause")}),(0,n.jsx)("button",{onClick:()=>void X(),disabled:null==N?void 0:N.stopping,title:S("batch.stopWhy"),children:S("batch.stop")}),(null==N?void 0:N.pausing)&&!(null==N?void 0:N.stopping)&&(0,n.jsx)("span",{className:"muted small",children:S("batch.pausing")}),(0,n.jsx)("span",{className:"badge",children:S("batch.modelRunning",{name:(ei?(null==(l=q.get(ei.sessionId))?void 0:l.modelInUse)||(null==(t=q.get(ei.sessionId))?void 0:t.model):"")||S("model.default")})}),w.length>0&&(0,n.jsx)("span",{className:"badge waiting-approval",children:S("batch.waiting",{n:w.length})}),ei&&(0,n.jsx)("span",{className:"small",children:S("batch.progress",{name:ei.name,done:N.sessions.filter(e=>"waiting"!==e.state&&"running"!==e.state).length,total:N.sessions.length})})]}),z&&(0,n.jsx)("p",{className:"muted small",children:S("batch.hiddenWhileRunning")}),C&&(0,n.jsx)("div",{className:"muted small",role:"status",children:C}),(Z.length>0||N)&&(0,n.jsxs)("div",{className:"row",style:{marginTop:12},children:[(0,n.jsx)("a",{className:"button-link",href:r.FH.debugExportUrl(Z.length>0?Z.map(e=>e.id):(null!=(p=null==N?void 0:N.sessions)?p:[]).map(e=>e.sessionId)),children:S("batch.debug")}),(0,n.jsx)("span",{className:"muted small",children:Z.length>0?S("batch.debugSelected",{n:Z.length}):S("batch.debugLast")})]}),(Z.length>0||N)&&(0,n.jsx)("p",{className:"why",children:S("batch.debugWhy")}),N&&(0,n.jsxs)(n.Fragment,{children:[!z&&ea&&(0,n.jsx)("div",{className:"notice calm",style:{marginTop:12},children:(0,n.jsx)("strong",{children:S("batch.finished",ea)})}),(0,n.jsxs)("table",{style:{marginTop:10},children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:S("batch.col.session")}),(0,n.jsx)("th",{children:S("batch.col.state")}),(0,n.jsx)("th",{children:S("batch.col.ran")}),(0,n.jsx)("th",{children:S("batch.col.why")})]})}),(0,n.jsx)("tbody",{children:N.sessions.map(e=>{var l,t;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"===(t=e.state)?"running":"done"===t?"done":"failed"===t?"failed":"stopped"===t?"aborted":""),children:S("batch.state.".concat(e.state))})}),(0,n.jsx)("td",{className:"small",children:S("batch.ranOf",{ran:e.ran,failed:e.failed})}),(0,n.jsx)("td",{className:"muted small",children:null!=(l=e.reason)?l:""})]},e.sessionId)})})]})]})]})}},5704:(e,l,t)=>{Promise.resolve().then(t.bind(t,2114))},8848:(e,l,t)=>{"use strict";t.d(l,{H4:()=>c,L:()=>o,z4:()=>h});var n=t(3365),s=t(8197),a=t.n(s),i=t(1521),r=t(5549),d=t(867);function c(e){let{current:l,onUse:t}=e,{t:s}=(0,d.kj)(),[a,c]=(0,i.useState)(null);if((0,i.useEffect)(()=>{let e=!1;return r.FH.project().then(l=>{e||c(l)}).catch(()=>void 0),()=>{e=!0}},[]),!a)return null;let o=a.rootDir.trim(),h=l.trim().toLowerCase(),m=t?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&&t&&h!==o.toLowerCase()?{text:s("proj.useIt"),onUse:()=>t(o)}:void 0,more:m.map(e=>({text:s("proj.otherUse",{name:e.name}),title:e.rootDir,onUse:()=>null==t?void 0:t(e.rootDir)})),link:o?s("proj.change"):s("proj.setIt"),anchor:"project"})}function o(e){let{current:l,onUse:t}=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&&t&&l.trim()!==i?{text:a("def.modelUseIt"),onUse:()=>t(i)}:void 0,link:a(i?"proj.change":"proj.setIt"),anchor:"model"})}function h(e){let{current:l,onUse:t}=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&&t&&l.trim()!==i?{text:a("def.modelUseIt"),onUse:()=>t(i)}:void 0,link:a(i?"proj.change":"proj.setIt"),anchor:"review"})}function m(){let[e,l]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!1;return r.FH.models().then(t=>{e||l(t)}).catch(()=>void 0),()=>{e=!0}},[]),e}function u(e){let{label:l,offer:t,more:s=[],link:i,anchor:r}=e;return(0,n.jsxs)("p",{className:"muted small",style:{marginTop:4},children:[l," ",t&&(0,n.jsxs)(n.Fragment,{children:["\xb7"," ",(0,n.jsx)("button",{type:"button",className:"linkish",onClick:t.onUse,children:t.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()}]);
|
|
@@ -1 +0,0 @@
|
|
|
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:()=>b});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(3041);function b(){return(0,n.jsx)(a.Suspense,{fallback:null,children:(0,n.jsx)(w,{})})}function w(){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)(C,{session:r,queued:N,onChange:k}),(0,n.jsx)(E,{tasks:r.tasks}),(0,n.jsx)(F,{session:r,onChange:k}),(0,n.jsx)(S,{level1:x,sent:r.contractSent}),(0,n.jsx)(H,{session:r,onChange:k}),(0,n.jsx)(D,{session:r,onChange:k}),(0,n.jsx)(T,{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)(I,{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)(O,{session:r,task:e,index:s+1,presets:h,onChange:k},e.id))]}),(0,n.jsx)(L,{session:r}),(0,n.jsx)(W,{session:r,presets:h,onAdded:k,onPresetsChanged:()=>c.FH.presets().then(p)}),(0,n.jsx)(A,{events:m})]})}function C(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=async e=>{var s;if("unattended"===e&&!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()},f=async()=>{await c.FH.stop(l.id),m(i("session.stopping")),r()},k=async()=>{await c.FH.setRunMode(l.id,"confirm"),m(i("session.askingAgain")),r()},N=async()=>{p.trim()&&p!==l.name&&await c.FH.updateSession(l.id,{name:p}),r()},b=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)}},w=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)}},C=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 N()}),(0,n.jsx)("span",{className:"badge ".concat(l.running?"running":""),children:C})]}),!l.running&&(0,n.jsxs)("div",{className:"run-choice",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("button",{className:"primary",onClick:()=>void g("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 g("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 f(),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 k(),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 b(),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 w(),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 S(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 F(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 D(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 H(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 T(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),[I,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})]}),I&&(0,n.jsx)(M,{preview:I})]})}function M(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 I(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 P(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 L(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 W(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)(P,{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 O(e){var s,l,t,r,i,h,p,x,v,j,g,b,w,C,S,F,D,H,T,M,I,L,W,O,A,E,q,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!=(q=null==(s=eC.vcsPlan)?void 0:s.branch)?q:""),[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,N.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==(b=eC.vcsPlan)?void 0:b.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)(P,{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)(R,{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)(G,{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)(B,{items:null!=(eu=eC.deviations)?eu:[]}),(null!=(eh=null==(I=eC.disputes)?void 0:I.length)?eh:0)>0&&(0,n.jsx)(U,{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==(L=eC.leftovers)?void 0:L.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==(E=eC.attempts)?void 0:E.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)})]}),(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 A(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 R(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 E(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 B(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 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.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 G(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,955,347,131,358],()=>e(e.s=1772)),_N_E=e.O()}]);
|
/package/dist/web/_next/static/{eWzbORCbQ1h_2IeLH_njb → QwjyyBjkO5xlKFU5O6Wux}/_buildManifest.js
RENAMED
|
File without changes
|
/package/dist/web/_next/static/{eWzbORCbQ1h_2IeLH_njb → QwjyyBjkO5xlKFU5O6Wux}/_ssgManifest.js
RENAMED
|
File without changes
|