copilot-operator 0.1.7 → 0.1.8
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/dist/src/api/operator.service.js +15 -9
- package/dist/src/plan/brief.js +4 -4
- package/dist/src/plan/systemGuide.js +22 -6
- package/dist/src/session/compose.js +24 -19
- package/dist/src/session/interruption.js +104 -0
- package/dist/src/session/store.js +21 -5
- package/dist/src/session/story.js +1 -1
- package/dist/web/404.html +2 -2
- package/dist/web/_next/static/chunks/867-3d4ee08c5f9f0e71.js +1 -0
- package/dist/web/_next/static/chunks/app/defaults/{page-1747c931adc746fd.js → page-dfcbd748f454d2d7.js} +1 -1
- package/dist/web/_next/static/chunks/app/history/page-49413c3a8266a0b7.js +1 -0
- package/dist/web/_next/static/chunks/app/sessions/view/page-a82e5e801dabc423.js +1 -0
- package/dist/web/appearance.html +2 -2
- package/dist/web/appearance.txt +11 -11
- package/dist/web/defaults.html +2 -2
- package/dist/web/defaults.txt +11 -11
- package/dist/web/history.html +2 -2
- package/dist/web/history.txt +11 -11
- package/dist/web/import.html +2 -2
- package/dist/web/import.txt +11 -11
- package/dist/web/index.html +2 -2
- package/dist/web/index.txt +11 -11
- package/dist/web/level1.html +2 -2
- package/dist/web/level1.txt +11 -11
- package/dist/web/presets.html +2 -2
- package/dist/web/presets.txt +11 -11
- package/dist/web/sessions/view.html +2 -2
- package/dist/web/sessions/view.txt +11 -11
- package/dist/web/system.html +2 -2
- package/dist/web/system.txt +11 -11
- package/package.json +1 -1
- package/dist/web/_next/static/chunks/867-4aa80f5a32311bce.js +0 -1
- package/dist/web/_next/static/chunks/app/history/page-2251664c0abe3f11.js +0 -1
- package/dist/web/_next/static/chunks/app/sessions/view/page-9517dd74c6d00f85.js +0 -1
- /package/dist/web/_next/static/{DCpEMjhrg9APkRwBBw5Do → kysrkUS5Y-ZTHsIIXgs3q}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{DCpEMjhrg9APkRwBBw5Do → kysrkUS5Y-ZTHsIIXgs3q}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[66],{1205:(e,s,n)=>{"use strict";n.d(s,{AppearanceProvider:()=>o,K:()=>m,themeScript:()=>i});var l=n(3365),a=n(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,[n,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 h=(0,a.useCallback)(e=>{i(s=>{let n={...s,...e};c(n);try{window.localStorage.setItem(r,JSON.stringify(n))}catch(e){}return n})},[]),u=(0,a.useCallback)(()=>{i(t),c(t);try{window.localStorage.removeItem(r)}catch(e){}},[]);return(0,l.jsx)(d.Provider,{value:{appearance:n,set:h,reset:u,loaded:o},children:s})}function m(){return(0,a.useContext)(d)}},1702:(e,s,n)=>{"use strict";var l=n(9962);n.o(l,"usePathname")&&n.d(s,{usePathname:function(){return l.usePathname}}),n.o(l,"useSearchParams")&&n.d(s,{useSearchParams:function(){return l.useSearchParams}})},1772:(e,s,n)=>{Promise.resolve().then(n.bind(n,4269))},2244:(e,s,n)=>{"use strict";n.d(s,{k:()=>o});var l=n(3365),a=n(1521),t=n(5549),r=n(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,n){return n.includes(e)?"out":n.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:n,includeEnvFiles:o,include:m,exclude:h,onChange:u}=e,{t:p}=(0,r.kj)(),[x,v]=(0,a.useState)(null),[j,g]=(0,a.useState)(""),[f,k]=(0,a.useState)(new Set),[b,y]=(0,a.useState)(""),N=async()=>{if(s.trim()){g("");try{let e=await t.FH.dirs(s,n);v(e),y("".concat(s,"|").concat(n)),k(new Set(e.filter(e=>!e.includes("/"))))}catch(e){g(e.message)}}};(0,a.useEffect)(()=>{v(null),y("")},[s,n]);let w=(0,a.useMemo)(()=>(function(e){let s=[],n=new Map;for(let a of[...e].sort()){var l;let e={path:a,name:null!=(l=a.split("/").pop())?l:a,children:[]};n.set(a,e);let t=a.includes("/")?n.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=h.map(i).filter(Boolean),F=e=>(0,l.jsx)("ul",{className:"dir-tree",children:e.map(e=>{let s=d(e.path,C,S),n=f.has(e.path),a=function(e,s,n){let l=s=>s.filter(s=>s!==e&&c(s,e)).length;return{included:l(s),excluded:l(n)}}(e.path,C,S),t=!n&&e.children.length>0&&(a.included>0||a.excluded>0);return(0,l.jsxs)("li",{className:"dir ".concat(s),children:[(0,l.jsxs)("div",{className:"dir-row",children:[e.children.length>0?(0,l.jsx)("button",{type:"button",className:"dir-flip",onClick:()=>{let s;return s=e.path,k(e=>{let n=new Set(e);return n.has(s)?n.delete(s):n.add(s),n})},"aria-label":n?p("tree.fold"):p("tree.unfold"),"aria-expanded":n,children:n?"▾":"▸"}):(0,l.jsx)("span",{className:"dir-flip","aria-hidden":"true"}),(0,l.jsxs)("button",{type:"button",className:"dir-name",onClick:()=>(e=>{if("in"===d(e,C,S))return void u(C.filter(s=>s!==e),S);u([...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,l.jsx)("span",{className:"dir-mark","aria-hidden":"true",children:"in"===s?"✓":"inherited"===s?"\xb7":"out"===s||"out-inherited"===s?"\xd7":""}),e.name]}),(0,l.jsx)("button",{type:"button",className:"dir-out".concat("out"===s?" on":""),onClick:()=>(e=>{if(S.includes(e))return void u(C,S.filter(s=>s!==e));u(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,l.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})})]}),n&&e.children.length>0&&F(e.children)]},e.path)})}),D=b!=="".concat(s,"|").concat(n);return(0,l.jsxs)("div",{className:"dir-tree-box",children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("button",{type:"button",onClick:()=>void N(),disabled:!s.trim(),children:null===x||D?p("tree.load"):p("tree.reload")}),(0,l.jsx)("span",{className:"muted small",children:p("tree.hint")})]}),j&&(0,l.jsx)("div",{className:"err small",children:j}),(0,l.jsxs)("p",{className:"muted small",style:{marginTop:6},children:[p("tree.alsoOut")," ",[n?p("tree.alsoGitignore"):null,!1===o?p("tree.alsoEnv"):null,p("tree.alsoAlways")].filter(Boolean).join(" \xb7 ")]}),null!==x&&!D&&(0===x.length?(0,l.jsx)("p",{className:"muted small",children:p("mirror.noDirs")}):F(w))]})}},4269:(e,s,n)=>{"use strict";n.r(s),n.d(s,{default:()=>C});var l=n(3365),a=n(1521),t=n(1702),r=n(8197),i=n.n(r),c=n(5549),d=n(867),o=n(1910),m=n(3523),h=n(3374);function u(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=n(1205),v=n(8848),j=n(4784),g=n(2244),f=n(2876),k=n(5132),b=n(1035),y=n(8934),N=n(4811),w=n(3041);function C(){return(0,l.jsx)(a.Suspense,{fallback:null,children:(0,l.jsx)(S,{})})}function S(){var e;let{t:s}=(0,d.kj)(),n=null!=(e=(0,t.useSearchParams)().get("id"))?e:"",[r,o]=(0,a.useState)(null),[m,h]=(0,a.useState)([]),[u,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(n)),g("")}catch(e){g(e.message)}},[n]),b=(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(n));e.onmessage=e=>{let s=JSON.parse(e.data);"ping"!==s.type&&(h(e=>[...e.slice(-400),s]),b())},e.onerror=()=>{};let s=setInterval(()=>void k(),8e3);return()=>{e.close(),clearInterval(s)}},[n,k,b]),j&&!r)return(0,l.jsx)("div",{className:"panel err",children:j});if(!r)return(0,l.jsx)("div",{className:"panel muted",children:s("home.loading")});let y=r.tasks.filter(e=>"queued"===e.status).length;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"crumbs",children:[(0,l.jsx)(i(),{href:"/",children:s("session.crumb")})," / ",r.name]}),(0,l.jsx)(F,{session:r,queued:y,onChange:k}),(0,l.jsx)(U,{tasks:r.tasks}),(0,l.jsx)(H,{session:r,onChange:k}),(0,l.jsx)(D,{level1:x,sent:r.contractSent}),(0,l.jsx)(T,{session:r,onChange:k}),(0,l.jsx)(I,{session:r,onChange:k}),(0,l.jsx)(M,{session:r,onChange:k}),(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsx)("h2",{children:s("tasks.title")}),(0,l.jsx)("p",{className:"muted small",children:s("tasks.hint")}),(0,l.jsx)(W,{session:r,onChange:k}),0===r.tasks.length&&(0,l.jsx)("div",{className:"muted",children:s("tasks.none")}),r.tasks.map((e,s)=>(0,l.jsx)(B,{session:r,task:e,index:s+1,presets:u,onChange:k},e.id))]}),(0,l.jsx)(O,{session:r}),(0,l.jsx)(A,{session:r,presets:u,onAdded:k,onPresetsChanged:()=>c.FH.presets().then(p)}),(0,l.jsx)(E,{events:m})]})}function F(e){var s;let{session:n,queued:t,onChange:r}=e,{t:i}=(0,d.kj)(),[o,m]=(0,a.useState)(""),[h,u]=(0,a.useState)("");(0,a.useEffect)(()=>{c.FH.models().then(e=>{var s;return u(null!=(s=e.defaultModel)?s:"")}).catch(()=>void 0)},[]);let[p,x]=(0,a.useState)(n.name),[v,j]=(0,a.useState)(null!=(s=n.conversationGroup)?s:"");(0,a.useEffect)(()=>x(n.name),[n.name]),(0,a.useEffect)(()=>{var e;return j(null!=(e=n.conversationGroup)?e:"")},[n.conversationGroup]);let g=(0,N.p)(),f=async e=>{var s;if("unattended"===e&&!g&&!await (0,b.Z)(i("session.unattendedConfirm")))return;let l=await c.FH.start(n.id,e,n.planName);m(l.started?i("unattended"===e?"session.startedAuto":"session.startedStep"):i("session.notStarted",{reason:null!=(s=l.reason)?s:""})),r()},k=async()=>{await c.FH.stop(n.id),m(i("session.stopping")),r()},y=async()=>{await c.FH.setRunMode(n.id,"confirm"),m(i("session.askingAgain")),r()},w=async()=>{p.trim()&&p!==n.name&&await c.FH.updateSession(n.id,{name:p}),r()},C=async()=>{if(n.running)return void m(i("home.deleteRunning"));if(await (0,b.Z)(i("home.deleteConfirm",{name:n.name,n:n.tasks.length})))try{await c.FH.deleteSession(n.id),window.location.href="/"}catch(e){m(e.message)}},S=async()=>{var e;if(v.trim()!==(null!=(e=n.conversationGroup)?e:""))try{await c.FH.updateSession(n.id,{conversationGroup:v.trim()}),m(i("session.groupSaved")),r()}catch(e){m(e.message)}},F=n.running?i("state.running"):i("state.".concat(n.status));return(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("input",{type:"text",className:"grow",value:p,onChange:e=>x(e.target.value),onBlur:()=>void w()}),(0,l.jsx)("span",{className:"badge ".concat(n.running?"running":""),children:F})]}),!n.running&&(0,l.jsxs)("div",{className:"run-choice",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("button",{className:"primary",onClick:()=>void f("unattended"),disabled:0===t,children:i("session.run",{n:t})}),(0,l.jsx)("p",{className:"why",children:i("session.runWhy")})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("button",{onClick:()=>void f("confirm"),disabled:0===t,children:i("session.runStep")}),(0,l.jsx)("p",{className:"why",children:i("session.runStepWhy")})]})]}),(0,l.jsxs)("div",{className:"row",style:{marginTop:10},children:[n.running&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{className:"danger",onClick:()=>void k(),children:i("session.stop")}),"unattended"===n.runMode&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"badge waiting-approval",children:i("session.modeUnattended")}),(0,l.jsx)("button",{onClick:()=>void y(),children:i("session.askAgain")})]})]}),(0,l.jsx)("span",{className:"muted small",children:o}),(0,l.jsx)("span",{className:"grow"}),(0,l.jsx)("button",{className:"quiet",onClick:()=>void C(),disabled:n.running,children:i("home.delete")}),n.chat?(0,l.jsx)("a",{href:n.chat.url,target:"_blank",rel:"noreferrer",className:"small",children:i("session.openChat",{name:n.chat.name})}):(0,l.jsx)("span",{className:"muted small",children:i("session.noChat")})]}),(0,l.jsx)("label",{htmlFor:"session-group",children:i("session.group")}),(0,l.jsx)("div",{className:"row",children:(0,l.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:n.running})}),(0,l.jsxs)("p",{className:"why",children:[i("session.groupWhy"),n.chat&&" ".concat(i("session.groupHasChat"))]}),(0,l.jsxs)("div",{className:"muted small",style:{marginTop:10},children:[i("session.willUseModel",{name:n.model||(h?i("model.followsDefault",{name:h}):i("model.default"))})," \xb7 ",n.mirror.enabled&&n.mirror.rootDir?i("session.willUseFiles",{root:n.mirror.rootDir,dirs:n.mirror.includeDirs.length?n.mirror.includeDirs.join(", "):"."}):(0,l.jsx)("span",{className:"err",children:i("session.noFiles")})]})]})}function D(e){var s;let{level1:n,sent:a}=e,{t}=(0,d.kj)();return(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("h2",{className:"grow",style:{margin:0},children:t("l1.title")}),(0,l.jsx)("span",{className:"badge",children:t(a?"l1.sent":"l1.notSent")}),(0,l.jsx)(i(),{href:"/level1",className:"small",children:t("l1.edit")})]}),(0,l.jsxs)("p",{className:"muted small",style:{marginBottom:6},children:[t("l1.hint"),(null==n?void 0:n.customised)?" ".concat(t("l1.customised")):""]}),(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:t("l1.show")}),(0,l.jsx)("pre",{className:"tall",children:null!=(s=null==n?void 0:n.content)?s:"…"})]})]})}function H(e){var s,n,t,r;let{session:i,onChange:o}=e,{t:m}=(0,d.kj)(),h=(0,d.W3)(),[u,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)}},y=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)}},N=async()=>{if(await (0,b.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!=(n=null==u?void 0:u.options)?n:[],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,l.jsxs)("div",{className:"panel",children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("h2",{className:"grow",style:{margin:0},children:m("model.title")}),i.modelInUse&&(0,l.jsx)("span",{className:"chip",children:m("model.lastUsed",{name:i.modelInUse})})]}),(0,l.jsx)("p",{className:"muted small",children:m("model.hint")}),(0,l.jsxs)("div",{className:"row",children:[(0,l.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,l.jsx)("option",{value:"",children:(null==u?void 0:u.defaultModel)?m("model.followsDefault",{name:u.defaultModel}):m("model.default")}),w&&!S&&(0,l.jsx)("option",{value:w,children:m("model.notInList",{name:w})}),F.map(e=>(0,l.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,n]=e;return(0,l.jsx)("optgroup",{label:s,children:n.map(e=>(0,l.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(m("model.unavailable")):""]},e.name))},s)})]}),(0,l.jsx)("button",{onClick:()=>void N(),disabled:x||i.running,children:m("model.refresh")}),(0,l.jsx)("span",{className:"muted small",role:"status",children:g})]}),(0,l.jsx)(v.L,{current:w,onUse:e=>void k(e)}),(0,l.jsxs)("div",{className:"row",style:{marginTop:8},children:[(0,l.jsx)("span",{className:"muted small",children:(null==u?void 0:u.defaultModel)?m("model.defaultIs",{name:u.defaultModel}):m("model.defaultIsNone")}),(0,l.jsx)("button",{onClick:()=>void y(),disabled:w===(null!=(r=null==u?void 0:u.defaultModel)?r:""),children:w?m("model.makeDefault",{name:w}):m("model.clearDefault")})]}),(null==u?void 0:u.readAt)?(0,l.jsxs)("p",{className:"muted small",style:{marginTop:8},children:[m("model.readAt",{t:h(u.readAt),n:u.options.length}),u.current?" ".concat(m("model.chatWasOn",{name:u.current})):"",u.note?" ".concat(u.note):""]}):(0,l.jsx)("p",{className:"muted small",style:{marginTop:8},children:m("model.neverRead")}),C.length>0&&(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:m("model.showDetails")}),(0,l.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 I(e){var s,n;let{session:t,onChange:r}=e,{t:i}=(0,d.kj)(),o=null!=(s=t.review)?s:{enabled:!0,model:""},[m,h]=(0,a.useState)(o.enabled),[u,p]=(0,a.useState)(null!=(n=o.model)?n:""),[x,g]=(0,a.useState)(""),[f,k]=(0,a.useState)(!1),[b,y]=(0,a.useState)("");(0,a.useEffect)(()=>{c.FH.models().then(e=>{var s;return y(null!=(s=e.defaultReviewModel)?s:"")}).catch(()=>void 0)},[]);let N=async()=>{k(!0),g("");try{await c.FH.updateSession(t.id,{review:{enabled:m,model:u}}),g(i("review.saved")),r()}catch(e){g(e.message)}finally{k(!1)}};return(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("h2",{className:"grow",style:{margin:0},children:i("review.title")}),(0,l.jsx)("span",{className:"badge ".concat(m?"done":""),children:m?i("review.on"):i("review.off")})]}),(0,l.jsx)("p",{className:"muted small",children:i("review.hint")}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"checkbox",checked:m,onChange:e=>h(e.target.checked),disabled:t.running}),(0,l.jsx)("span",{children:i("review.enable")})]}),(0,l.jsx)("p",{className:"why",children:i("review.enableWhy")})]}),(0,l.jsx)("label",{htmlFor:"review-model",children:i("review.modelField")}),(0,l.jsx)("div",{className:"row",children:(0,l.jsx)(j.Y,{id:"review-model",chosen:u,onChange:p,none:b?i("model.followsDefault",{name:b}):i("review.modelSame"),disabled:t.running||!m})}),(0,l.jsx)("p",{className:"why",children:i("review.modelWhy")}),(0,l.jsx)(v.z4,{current:u,onUse:e=>p(e)}),(0,l.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,l.jsx)("button",{className:"primary",onClick:()=>void N(),disabled:f||t.running,children:i("review.save")}),x&&(0,l.jsx)("span",{className:"muted small",children:x})]})]})}function T(e){var s,n,t,r,i,o,m,h,u;let{session:p,onChange:x}=e,{t:j}=(0,d.kj)(),g=null!=(n=p.vcs)?n:{enabled:!0,repoDir:"",branchMode:"per-task",commitOnFinish:!0,branchPrefix:"cop/"},[f,k]=(0,a.useState)(g.repoDir),[b,y]=(0,a.useState)(null),[N,w]=(0,a.useState)(""),[C,S]=(0,a.useState)(!1),F=JSON.stringify(g),[D,H]=(0,a.useState)(null),[I,T]=(0,a.useState)(null!=(t=g.branchName)?t:"");(0,a.useEffect)(()=>{var e;return T(null!=(e=JSON.parse(F).branchName)?e:"")},[F]);let[M,P]=(0,a.useState)(null!=(r=g.baseBranch)?r:"");(0,a.useEffect)(()=>{var e;return P(null!=(e=JSON.parse(F).baseBranch)?e:"")},[F]);let W=null!=(i=g.startFrom)?i:"head";(0,a.useEffect)(()=>{k(JSON.parse(F).repoDir)},[F]);let L=JSON.parse(F).repoDir||p.mirror.rootDir||"";(0,a.useEffect)(()=>{let e=!1;return L.trim()?(c.FH.repoCheck(L).then(s=>{var n;e||H(s.ok?null:null!=(n=s.problem)?n:null)}).catch(()=>{e||H(null)}),()=>{e=!0}):void H(null)},[L]);let O=(0,a.useCallback)(()=>{c.FH.vcsStatus(p.id).then(y).catch(()=>y(null))},[p.id]);(0,a.useEffect)(O,[O,F]);let A=async e=>{try{await c.FH.updateSession(p.id,{vcs:e}),w(j("vcs.saved")),x(),O()}catch(e){w(e.message)}},B=async()=>{S(!0),w(j("mirror.browsing"));try{let s=await c.FH.browseFolder(f.trim()||p.mirror.rootDir||void 0);if(s.ok)k(s.path),await A({repoDir:s.path});else{var e;w(s.cancelled?j("mirror.browseCancelled"):null!=(e=s.reason)?e:"")}}finally{S(!1)}},E=g.repoDir||p.mirror.rootDir||"",R=""!==E.trim()&&null===D;return(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("h2",{className:"grow",style:{margin:0},children:j("vcs.title")}),(0,l.jsx)("span",{className:"badge ".concat(g.enabled?"done":""),children:g.enabled?j("vcs.on"):j("vcs.off")})]}),(0,l.jsx)("p",{className:"muted small",children:j("vcs.hint")}),(0,l.jsx)("label",{htmlFor:"vcs-root",children:j("vcs.repoField")}),(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("input",{id:"vcs-root",type:"text",className:"grow",value:f,onChange:e=>k(e.target.value),onBlur:()=>f.trim()!==g.repoDir&&void A({repoDir:f.trim()}),placeholder:p.mirror.rootDir||"C:\\Projects\\my-app",disabled:p.running}),(0,l.jsx)("button",{onClick:()=>void B(),disabled:C||p.running,children:j("mirror.browse")})]}),(0,l.jsx)(v.H4,{current:f,onUse:e=>{k(e),A({repoDir:e})}}),D&&(0,l.jsxs)("div",{className:"notice caution",style:{marginTop:8},children:[(0,l.jsx)("strong",{children:j("vcs.noRepo")}),(0,l.jsx)("div",{className:"small",style:{marginTop:4},children:D}),(0,l.jsx)("div",{className:"muted small",style:{marginTop:6},children:j("vcs.noRepoHow")})]}),!D&&""!==E.trim()&&(0,l.jsx)("p",{className:"muted small",style:{marginTop:4},children:j("vcs.repoOk")}),""===E.trim()&&(0,l.jsx)("p",{className:"muted small",style:{marginTop:4},children:j("vcs.pickFirst")}),(0,l.jsxs)("div",{className:"option".concat(R||g.enabled?"":" warned"),children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"checkbox",checked:g.enabled,onChange:e=>void A({enabled:e.target.checked}),disabled:p.running||!R&&!g.enabled}),(0,l.jsx)("span",{children:j("vcs.enable")})]}),(0,l.jsx)("p",{className:"why",children:j("vcs.enableWhy")})]}),g.enabled&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"muted small",style:{marginTop:4},children:E?j("vcs.repoIs",{dir:E}):j("vcs.repoNone")}),(0,l.jsx)("h3",{children:j("vcs.branches")}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:"branchMode",checked:"per-task"===g.branchMode,onChange:()=>void A({branchMode:"per-task"}),disabled:p.running}),(0,l.jsx)("span",{children:j("vcs.perTask")})]}),(0,l.jsx)("p",{className:"why",children:j("vcs.perTaskWhy")})]}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:"branchMode",checked:"per-session"===g.branchMode,onChange:()=>void A({branchMode:"per-session"}),disabled:p.running}),(0,l.jsx)("span",{children:j("vcs.perSession")})]}),(0,l.jsx)("p",{className:"why",children:j("vcs.perSessionWhy")})]}),"per-session"===g.branchMode&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("label",{htmlFor:"vcs-branch-name",children:j("vcs.branchName")}),(0,l.jsx)("input",{id:"vcs-branch-name",type:"text",value:I,onChange:e=>T(e.target.value),onBlur:()=>{var e;return I.trim()!==(null!=(e=g.branchName)?e:"")&&void A({branchName:I.trim()})},placeholder:p.name,disabled:p.running}),(0,l.jsx)("p",{className:"why",children:j("vcs.branchNameWhy")})]}),(0,l.jsx)("h3",{children:j("vcs.startFrom")}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:"startFrom",checked:"branch"===W,onChange:()=>void A({startFrom:"branch"}),disabled:p.running}),(0,l.jsx)("span",{children:j("vcs.startBranch")})]}),(0,l.jsx)("p",{className:"why",children:j("vcs.startBranchWhy")})]}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:"startFrom",checked:"previous-session"===W,onChange:()=>void A({startFrom:"previous-session"}),disabled:p.running}),(0,l.jsx)("span",{children:j("vcs.startPrevious")})]}),(0,l.jsx)("p",{className:"why",children:j("vcs.startPreviousWhy")})]}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:"startFrom",checked:"head"===W,onChange:()=>void A({startFrom:"head"}),disabled:p.running}),(0,l.jsx)("span",{children:j("vcs.startHead")})]}),(0,l.jsx)("p",{className:"why",children:j("vcs.startHeadWhy")})]}),"head"!==W&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("label",{htmlFor:"vcs-base-branch",children:j("vcs.baseBranch")}),(0,l.jsx)("input",{id:"vcs-base-branch",type:"text",value:M,onChange:e=>P(e.target.value),onBlur:()=>{var e;return M.trim()!==(null!=(e=g.baseBranch)?e:"")&&void A({baseBranch:M.trim()})},placeholder:"main",disabled:p.running}),(0,l.jsx)("p",{className:"why",children:j("vcs.baseBranchWhy")})]}),p.vcsStart&&(0,l.jsxs)("p",{className:"muted small",children:["previous-session"===p.vcsStart.kind?j("vcs.startedPrevious",{name:null!=(o=null==(s=p.vcsStart.fromSession)?void 0:s.name)?o:"",branch:null!=(m=p.vcsStart.branch)?m:"",commit:p.vcsStart.commit.slice(0,8)}):"branch"===p.vcsStart.kind?j("vcs.startedBranch",{branch:null!=(h=p.vcsStart.branch)?h:"",commit:p.vcsStart.commit.slice(0,8)}):j("vcs.startedHead",{commit:p.vcsStart.commit.slice(0,8)}),p.vcsStart.note?" — ".concat(p.vcsStart.note):""]}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"checkbox",checked:g.commitOnFinish,onChange:e=>void A({commitOnFinish:e.target.checked}),disabled:p.running}),(0,l.jsx)("span",{children:j("vcs.commit")})]}),(0,l.jsx)("p",{className:"why",children:j("vcs.commitWhy")})]}),b&&!b.ok&&(0,l.jsxs)("div",{className:"notice caution",role:"status",children:[(0,l.jsx)("strong",{children:j("vcs.notReady")})," ",b.problem]}),(null==b?void 0:b.ok)&&(0,l.jsx)("div",{className:"muted small",children:j("vcs.ready",{branch:null!=(u=b.branch)?u:"—",dir:b.repoDir})}),(null==b?void 0:b.ok)&&b.work&&b.work.branches.length>0&&(0,l.jsxs)("div",{className:"muted small",children:["per-session"===b.work.mode&&b.work.complete?j("vcs.completeOn",{branch:b.work.complete}):j("vcs.noSingleBranch",{n:b.work.branches.length}),"per-task"===b.work.mode&&(0,l.jsx)("ul",{style:{margin:"4px 0",paddingLeft:20},children:b.work.branches.map(e=>(0,l.jsxs)("li",{children:[(0,l.jsx)("code",{children:e.branch})," — ",e.title,e.commit?"":" (".concat(j("vcs.taskNoFiles"),")")]},e.branch))})]}),(0,l.jsx)("p",{className:"muted small",children:j("vcs.pushIsYours")})]}),(0,l.jsx)("div",{className:"muted small",role:"status",children:N})]})}function M(e){var s,n,t,r;let{session:i,onChange:o}=e,{t:m}=(0,d.kj)(),[h,x]=(0,a.useState)(i.mirror.enabled),[j,f]=(0,a.useState)(i.mirror.rootDir),[k,y]=(0,a.useState)(i.mirror.includeDirs.join("\n")),[N,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!=(n=i.mirror.includeEnvFiles)&&n),[H,I]=(0,a.useState)(null),[T,M]=(0,a.useState)(null),[W,L]=(0,a.useState)(""),[O,A]=(0,a.useState)(""),[B,E]=(0,a.useState)([]),R=JSON.stringify(i.mirror);(0,a.useEffect)(()=>{var e,s;let n=JSON.parse(R);x(n.enabled),f(n.rootDir),y(n.includeDirs.join("\n")),w(n.excludeDirs.join("\n")),S(null==(e=n.respectGitignore)||e),D(null!=(s=n.includeEnvFiles)&&s)},[R]),(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(N),q=function(e,s){let n=e.map(u).filter(Boolean),l=s.map(u).filter(Boolean),a=[];for(let e of n)for(let s of l)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=h&&!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:h,...J}),Y=async()=>{if(!Z)try{await c.FH.updateSession(i.id,{mirror:{enabled:h,...J}}),A(m("mirror.saved")),o()}catch(e){A(e.message)}},$=async()=>{try{I(await c.FH.dirs(j,C)),A("")}catch(e){A(e.message)}},Q=async()=>{L("browse"),A(m("mirror.browsing"));try{let s=await c.FH.browseFolder(j.trim()||void 0);if(s.ok)f(s.path),I(null),M(null),A("");else{var e;A(s.cancelled?m("mirror.browseCancelled"):null!=(e=s.reason)?e:"")}}catch(e){A(e.message)}finally{L("")}},V=async()=>{if(!J.rootDir)return void A(m("mirror.needRoot"));L("check"),A(m("mirror.checking"));try{M(await c.FH.previewMirror(J)),A("")}catch(e){M(null),A(e.message)}finally{L("")}},X=async e=>{(!e||await (0,b.Z)(m("mirror.envWarn")))&&(D(e),M(null))};return(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("h2",{className:"grow",style:{margin:0},children:m("mirror.title")}),(0,l.jsx)("span",{className:"badge ".concat(i.mirror.enabled?"done":""),children:i.mirror.enabled?m("mirror.stateOn"):m("mirror.stateOff")})]}),(0,l.jsx)("p",{className:"muted small",children:m("mirror.hint",{example:"src--test--a.spec.ts.txt"})}),(0,l.jsx)("div",{className:"option",children:(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"checkbox",checked:h,onChange:e=>x(e.target.checked)}),(0,l.jsx)("span",{children:m("mirror.enable")})]})}),(0,l.jsx)("label",{htmlFor:"mirror-root",children:m("mirror.root")}),(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("input",{id:"mirror-root",type:"text",className:"grow",value:j,onChange:e=>{f(e.target.value),M(null)},placeholder:"C:\\Projects\\my-app"}),(0,l.jsx)("button",{onClick:()=>void Q(),disabled:"browse"===W,children:m("mirror.browse")}),(0,l.jsx)("button",{onClick:()=>void $(),disabled:!j.trim(),children:m("mirror.listDirs")})]}),(0,l.jsx)("div",{className:"muted small",style:{marginTop:4},children:m("mirror.rootHint")}),(0,l.jsx)(v.H4,{current:j,onUse:e=>{f(e),M(null)}}),H&&(0,l.jsx)("div",{className:"small muted",style:{margin:"6px 0"},children:0===H.length?m("mirror.noDirs"):H.join(" \xb7 ")}),(0,l.jsx)("h3",{children:m("mirror.rules")}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"checkbox",checked:C,onChange:e=>{S(e.target.checked),M(null)}}),(0,l.jsx)("span",{children:m("mirror.gitignore")})]}),(0,l.jsx)("p",{className:"why",children:m("mirror.gitignoreWhy")})]}),(0,l.jsxs)("div",{className:"option".concat(F?" warned":""),children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"checkbox",checked:F,onChange:e=>X(e.target.checked)}),(0,l.jsx)("span",{children:m("mirror.env")})]}),(0,l.jsx)("p",{className:"why",children:m("mirror.envWhy")}),F&&(0,l.jsx)("p",{className:"why",children:(0,l.jsx)("strong",{children:m("mirror.envOn")})})]}),B.length>0&&(0,l.jsx)("p",{className:"muted small",children:m("mirror.alwaysOut",{dirs:B.join(", ")})}),(0,l.jsxs)("div",{className:"row",style:{alignItems:"flex-start"},children:[(0,l.jsxs)("div",{className:"grow",children:[(0,l.jsx)("label",{htmlFor:"mirror-include",children:m("mirror.include")}),(0,l.jsx)("textarea",{id:"mirror-include",value:k,onChange:e=>{y(e.target.value),M(null)},placeholder:"src\ntests",style:{minHeight:80},"aria-invalid":q.length>0})]}),(0,l.jsxs)("div",{className:"grow",children:[(0,l.jsx)("label",{htmlFor:"mirror-exclude",children:m("mirror.exclude")}),(0,l.jsx)("textarea",{id:"mirror-exclude",value:N,onChange:e=>{w(e.target.value),M(null)},placeholder:"src/generated",style:{minHeight:80},"aria-invalid":q.length>0})]})]}),(0,l.jsx)(g.k,{rootDir:j,respectGitignore:C,includeEnvFiles:F,include:k.split("\n"),exclude:N.split("\n"),onChange:(e,s)=>{y(e.join("\n")),w(s.join("\n")),M(null)}}),q.length>0&&(0,l.jsxs)("div",{className:"notice",role:"alert",children:[(0,l.jsx)("strong",{children:m("mirror.conflict")}),(0,l.jsx)("ul",{children:q.map((e,s)=>(0,l.jsx)("li",{children:"same"===e.kind?m("mirror.conflictSame",{dir:e.include}):m("mirror.conflictParent",{include:e.include,exclude:e.exclude})},s))}),(0,l.jsx)("div",{style:{marginTop:6},children:m("mirror.conflictFix")})]}),z&&(0,l.jsx)("div",{className:"notice caution",role:"alert",children:(0,l.jsx)("strong",{children:m("mirror.needRoot")})}),K!==_&&(0,l.jsxs)("div",{className:"notice caution",role:"status",children:[(0,l.jsx)("strong",{children:m("mirror.unsaved")})," ",m("mirror.unsavedWhy")]}),(0,l.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,l.jsx)("button",{className:"primary",onClick:()=>void Y(),disabled:Z,children:m("mirror.save")}),(0,l.jsx)("button",{onClick:()=>void V(),disabled:q.length>0||"check"===W,children:m("mirror.check")}),(0,l.jsx)("span",{className:"muted small",role:"status",children:O})]}),T&&(0,l.jsx)(P,{preview:T})]})}function P(e){let{preview:s}=e,{t:n}=(0,d.kj)();return 0===s.files.length?(0,l.jsx)("div",{className:"notice caution",style:{marginTop:10},children:(0,l.jsx)("strong",{children:n("mirror.checkedNone")})}):(0,l.jsxs)("div",{className:"notice calm",style:{marginTop:10},children:[(0,l.jsx)("strong",{children:n("mirror.checked",{files:s.files.length,size:(0,c.zi)(s.totalBytes)})})," ",s.envFiles.length>0&&(0,l.jsx)("span",{className:"err",children:n("mirror.checkedEnv",{n:s.envFiles.length})})," ",s.skipped.length>0&&(0,l.jsx)("span",{className:"muted",children:n("mirror.checkedSkipped",{n:s.skipped.length})}),(0,l.jsxs)("details",{style:{marginTop:6},children:[(0,l.jsx)("summary",{children:n("mirror.showFiles")}),(0,l.jsx)("pre",{className:"tall",children:s.files.join("\n")})]}),s.skipped.length>0&&(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:n("mirror.showSkipped")}),(0,l.jsx)("pre",{className:"tall",children:s.skipped.map(e=>"".concat(e.relPath," — ").concat(e.reason)).join("\n")})]})]})}function W(e){var s;let{session:n,onChange:t}=e,{t:r}=(0,d.kj)(),[i,o]=(0,a.useState)(""),m=null!=(s=n.onFailure)?s:"stop",h=async e=>{if(e!==m)try{await c.FH.updateSession(n.id,{onFailure:e}),o(r("stop"===e?"chain.savedStop":"chain.savedContinue")),t()}catch(e){o(e.message)}};return(0,l.jsxs)("fieldset",{style:{border:0,padding:0,margin:"10px 0 14px"},children:[(0,l.jsx)("legend",{className:"muted small",style:{padding:0},children:r("chain.title")}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:"chain",checked:"stop"===m,onChange:()=>void h("stop"),disabled:n.running}),(0,l.jsx)("span",{children:r("chain.stop")})]}),(0,l.jsx)("p",{className:"why",children:r("chain.stopWhy")})]}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:"chain",checked:"continue"===m,onChange:()=>void h("continue"),disabled:n.running}),(0,l.jsx)("span",{children:r("chain.continue")})]}),(0,l.jsx)("p",{className:"why",children:r("chain.continueWhy")})]}),i&&(0,l.jsx)("div",{className:"muted small",role:"status",children:i}),n.running&&(0,l.jsx)("div",{className:"muted small",children:r("chain.locked")})]})}function L(e){let{value:s,onChange:n,presets:t,onPresetsChanged:r}=e,{t:i}=(0,d.kj)(),[o,m]=(0,a.useState)(""),h=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,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("label",{className:"grow",style:{margin:0},children:i("l2.label")}),(0,l.jsxs)("select",{value:"",onChange:e=>{let s=t.find(s=>s.name===e.target.value);s&&n(s.content)},children:[(0,l.jsx)("option",{value:"",children:i("l2.loadPreset")}),t.map(e=>(0,l.jsx)("option",{value:e.name,children:e.name},e.name))]}),(0,l.jsx)("button",{onClick:()=>void h(),disabled:!s.trim(),children:i("l2.saveAs")})]}),(0,l.jsx)("textarea",{className:"prose",value:s,onChange:e=>n(e.target.value),placeholder:i("l2.placeholder"),style:{minHeight:140,marginTop:10}}),o&&(0,l.jsx)("div",{className:"muted small",children:o})]})}function O(e){let{session:s}=e,{t:n}=(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),h=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,l.jsxs)("div",{className:"panel",children:[(0,l.jsx)("h2",{children:n("export.title")}),(0,l.jsx)("p",{className:"muted small",children:n("export.hint")}),0===r.length?(0,l.jsx)("div",{className:"empty",children:n("export.nothing")}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"row",style:{marginBottom:6},children:[(0,l.jsx)("button",{className:"quiet",onClick:()=>o(r.map(e=>e.id)),children:n("export.all")}),(0,l.jsx)("button",{className:"quiet",onClick:()=>o([]),children:n("export.none")}),(0,l.jsx)("span",{className:"muted small",children:i.length>0?n("export.selected",{n:i.length}):n("export.allOf",{n:r.length})})]}),r.map(e=>{var s,a;return(0,l.jsx)("div",{className:"option",style:{margin:"6px 0"},children:(0,l.jsxs)("label",{children:[(0,l.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,l.jsxs)("span",{children:[e.title," ",(0,l.jsx)("span",{className:"badge ".concat(e.status),children:n("status.".concat(e.status))})," ",e.readOnly&&(0,l.jsx)("span",{className:"chip",children:n("task.readOnly")})," ",(0,l.jsx)("span",{className:"muted small",children:t(null!=(a=null!=(s=e.finishedAt)?s:e.startedAt)?a:e.createdAt)})]})]})},e.id)}),(0,l.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,l.jsx)("a",{className:"button-link",href:h("outcome"),download:!0,children:n("export.outcome",{n:m.length})}),(0,l.jsx)("a",{className:"button-link",href:h("full"),download:!0,children:n("export.full",{n:m.length})})]}),(0,l.jsx)("p",{className:"muted small",style:{marginTop:8},children:n("export.outcomeWhy")})]})]})}function A(e){var s;let{session:n,presets:t,onAdded:r,onPresetsChanged:i}=e,{t:o}=(0,d.kj)(),m=[...n.tasks].reverse()[0],[h,u]=(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(n.id,{title:h,level2:p,prompt:v}),u(""),j(""),f(o("form.queued")),r()}catch(e){f(e.message)}};return(0,l.jsxs)("div",{className:"panel",id:"new-task",children:[(0,l.jsx)("h2",{children:o("form.title")}),(0,l.jsx)("p",{className:"muted small",children:o("form.hint")}),(0,l.jsx)("label",{children:o("form.titleLabel")}),(0,l.jsx)("input",{type:"text",value:h,onChange:e=>u(e.target.value),placeholder:o("form.titlePlaceholder")}),(0,l.jsx)("div",{style:{marginTop:10},children:(0,l.jsx)(L,{value:p,onChange:x,presets:t,onPresetsChanged:i})}),(0,l.jsx)("label",{children:o("form.taskLabel")}),(0,l.jsx)("textarea",{className:"prose",value:v,onChange:e=>j(e.target.value),placeholder:o("form.taskPlaceholder"),style:{minHeight:140}}),(0,l.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,l.jsx)("button",{className:"primary",onClick:()=>void k(),disabled:!v.trim(),children:o("form.add")}),(0,l.jsx)("span",{className:"muted small",children:g})]})]})}function B(e){var s,n,t,r,i,u,p,x,v,j,g,N,C,S,F,D,H,I,T,M,P,W,O,A,B,E,U,z,Z,_,K,Y,$,Q,V,X,ee,es,en,el,ea,et,er,ei,ec,ed,eo,em,eh,eu,ep,ex,ev,ej,eg,ef,ek,eb,ey,eN,ew,eC,eS;let{session:eF,task:eD,index:eH,presets:eI,onChange:eT}=e,{t:eM}=(0,d.kj)(),eP=(0,d.W3)(),[eW,eL]=(0,a.useState)(!1),[eO,eA]=(0,a.useState)(!1),[eB,eE]=(0,a.useState)(eD.title),[eR,eU]=(0,a.useState)(eD.level2),[eG,eq]=(0,a.useState)(eD.prompt),[eJ,ez]=(0,a.useState)(null!=(z=null==(s=eD.vcsPlan)?void 0:s.branch)?z:""),[eZ,e_]=(0,a.useState)(null!=(Z=null==(n=eD.vcsPlan)?void 0:n.commitMessage)?Z:""),[eK,eY]=(0,a.useState)(null!=(_=eD.checks)?_:[]),e$=(0,h.c)((0,m.DG)(eD)),[eQ,eV]=(0,a.useState)(null),[eX,e0]=(0,a.useState)(""),e1=async()=>{try{await c.FH.updateTask(eF.id,eD.id,{title:eB,level2:eR,prompt:eG,vcsPlan:{branch:eJ,commitMessage:eZ},checks:eK}),eL(!1),eT()}catch(e){e0(e.message)}},e2="running"===eD.status||"waiting-approval"===eD.status,e4=!e2&&"queued"!==eD.status,e6=!e2&&"queued"!==eD.status,e8=!e2&&null!=(K=null==(t=eF.vcs)?void 0:t.enabled)&&K&&(!!(null==(r=eD.vcs)?void 0:r.baseCommit)||(null!=(Y=eD.attempts)?Y:[]).some(e=>{var s;return null==(s=e.vcs)?void 0:s.baseCommit})),e5=!e2&&"limit-reached"===eD.status,e3=async()=>{if(await (0,b.Z)(eM("task.continueConfirm",{title:eD.title})))try{await c.FH.continueTask(eF.id,eD.id),eT()}catch(e){e0(e.message)}},e7=async()=>{if(await (0,b.Z)(eM("task.rerunConfirm",{title:eD.title})))try{await c.FH.rerunTask(eF.id,eD.id),eT()}catch(e){e0(e.message)}},e9=async()=>{if(await (0,b.Z)(eM("task.editRanConfirm",{title:eD.title})))try{await c.FH.rerunTask(eF.id,eD.id,{title:eB,level2:eR,prompt:eG,vcsPlan:{branch:eJ,commitMessage:eZ},checks:eK},{buildOnFinished:"done"===eD.status}),eL(!1),eT()}catch(e){e0(e.message)}},se=(0,w.e)(eT),ss=async()=>{let e="queued"===eD.status?"task.deleteConfirm":"task.deleteConfirmRan";if(await (0,b.Z)(eM(e,{title:eD.title})))try{await c.FH.deleteTask(eF.id,eD.id),eT()}catch(e){e0(e.message)}},sn=async()=>{eQ||eV(await c.FH.taskFiles(eF.id,eD.id))},sl=(e,s,n)=>n.length>0&&(0,l.jsxs)("div",{children:[(0,l.jsxs)("span",{className:"muted",children:[eM(e)," "]}),n.map(e=>(0,l.jsx)("span",{style:{marginRight:10},children:(0,l.jsx)(o.u,{label:e,save:()=>c.FH.saveTaskFile(eF.id,eD.id,s,e)})},e))]});return(0,l.jsxs)("div",{className:"task ".concat(eD.status),id:eD.id,children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsxs)("h4",{className:"grow",children:[eH,". ",eD.title]}),(0,l.jsx)("span",{className:"badge ".concat(eD.status),children:eM("status.".concat(eD.status))}),(null!=($=eD.attempt)?$:1)>1&&(0,l.jsx)("span",{className:"chip",children:eM("task.attemptN",{n:null!=(Q=eD.attempt)?Q:1})}),eD.iterations>0&&(0,l.jsx)("span",{className:"muted small",children:eM("task.iterations",{n:eD.iterations})}),eD.runId&&(0,l.jsxs)("button",{className:eO?"":"quiet",onClick:()=>eA(e=>!e),title:(0,m.DG)(eD)?eM("story.showLiveWhy"):eM("story.why"),children:[(0,m.DG)(eD)&&!eO&&(0,l.jsx)("span",{className:"dot","aria-hidden":"true"}),eO?eM("story.hide"):(0,m.DG)(eD)?eM("story.showLive"):eM("story.show")]}),!e2&&(0,l.jsx)("button",{onClick:()=>eL(e=>!e),title:eM("task.editAll"),children:eW?eM("task.cancel"):eM("task.edit")}),e5&&(0,l.jsx)("button",{className:"primary",onClick:()=>void e3(),title:eM("task.continueWhy"),children:eM("task.continue")}),e6&&(0,l.jsx)("button",{className:e5?"":"primary",onClick:()=>void e7(),title:eM("task.rerunWhy"),children:eM("task.rerun")}),e8&&(0,l.jsx)("button",{onClick:()=>void se.restore({sessionId:eF.id,taskId:eD.id,title:eD.title}),disabled:""!==se.busy||eF.running,title:eM("restore.why"),children:"restore"===se.busy?eM("restore.checking"):eM("restore.button")}),e4&&(0,l.jsx)("button",{onClick:()=>void se.restartFrom({sessionId:eF.id,taskId:eD.id,title:eD.title}),disabled:""!==se.busy||eF.running,title:eM("restart.why"),children:"restart"===se.busy?eM("restart.checking"):eM("restart.button")}),!e2&&(0,l.jsx)("button",{className:"danger",onClick:()=>void ss(),children:eM("task.delete")}),!eW&&(eX||se.message)&&(0,l.jsx)("span",{className:"err",role:"alert",children:eX||se.message})]}),(0,l.jsxs)("div",{className:"muted small",children:[eD.startedAt?eM("task.started",{t:eP(eD.startedAt)}):eM("task.added",{t:eP(eD.createdAt)}),eD.finishedAt?" \xb7 ".concat(eM("task.finished",{t:eP(eD.finishedAt)})):"",eD.startedAt&&eD.finishedAt?" \xb7 ".concat(eM("task.took",{d:(0,c.c5)((0,m.d5)(eD.startedAt,eD.finishedAt))})):"",(0,m.DG)(eD)?" \xb7 ".concat(eM("task.runningFor",{d:(0,c.c5)((0,m.d5)(eD.startedAt,void 0,e$))})):""]}),"queued"!==eD.status&&(null==(i=eF.vcs)?void 0:i.enabled)&&eD.vcs&&(0,l.jsx)("div",{className:"muted small",children:eD.vcs.problem&&!eD.vcs.branch?(0,l.jsx)("span",{className:"reason",children:eM("vcs.taskProblem",{problem:eD.vcs.problem})}):(0,l.jsxs)(l.Fragment,{children:[eD.vcs.branch&&eM("vcs.taskBranch",{branch:eD.vcs.branch}),eD.vcs.baseCommit&&" \xb7 ".concat(eM("vcs.taskBase",{commit:eD.vcs.baseCommit.slice(0,8)})),eD.vcs.commit?" \xb7 ".concat(eM("vcs.taskCommit",{commit:eD.vcs.commit.slice(0,8)})):" \xb7 ".concat(eM("vcs.taskNoFiles")),(null!=(V=null==(u=eD.vcs.files)?void 0:u.length)?V:0)>0&&(0,l.jsxs)("details",{style:{display:"inline"},children:[(0,l.jsxs)("summary",{style:{display:"inline",cursor:"pointer"},children:[" \xb7 ",eM("vcs.taskFiles",{n:null!=(X=null==(p=eD.vcs.files)?void 0:p.length)?X:0})]}),(0,l.jsx)("ul",{style:{margin:"4px 0 4px 0",paddingLeft:20},children:(null!=(ee=eD.vcs.files)?ee:[]).map(e=>(0,l.jsxs)("li",{children:[(0,l.jsx)("code",{children:e.path})," ",e.added<0||e.removed<0?eM("vcs.taskBinary"):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("span",{style:{color:"var(--ok)"},children:["+",e.added]})," ",(0,l.jsxs)("span",{style:{color:"var(--bad)"},children:["-",e.removed]})]})]},e.path))})]}),eD.vcs.commit&&eD.vcs.baseCommit&&(0,l.jsxs)(l.Fragment,{children:[" \xb7 ",(0,l.jsx)(y.C,{sessionId:eF.id,taskId:eD.id,title:eD.title,files:null!=(es=null==(x=eD.vcs.files)?void 0:x.length)?es:0})]}),(null!=(en=null==(v=eD.vcs.suspicious)?void 0:v.length)?en:0)>0&&(0,l.jsxs)("div",{className:"err small",style:{marginTop:4},children:[eM("vcs.suspicious",{n:null!=(el=null==(j=eD.vcs.suspicious)?void 0:j.length)?el:0}),(0,l.jsx)("ul",{style:{margin:"4px 0",paddingLeft:20},children:(null!=(ea=eD.vcs.suspicious)?ea:[]).map(e=>(0,l.jsxs)("li",{children:[(0,l.jsx)("code",{children:e.path})," — ",e.reason]},e.path))})]})]})}),"queued"===eD.status&&(null==(g=eF.vcs)?void 0:g.enabled)&&((null==(N=eD.vcsPlan)?void 0:N.branch)||(null==(C=eD.vcsPlan)?void 0:C.commitMessage))&&(0,l.jsx)("div",{className:"muted small",children:eD.vcsPlan.branch&&eD.vcsPlan.commitMessage?eM("task.gitNames",{branch:eD.vcsPlan.branch,subject:eD.vcsPlan.commitMessage.split("\n")[0]}):eD.vcsPlan.branch?eM("task.gitBranchOnly",{branch:eD.vcsPlan.branch}):eM("task.gitCommitOnly",{subject:(null!=(et=eD.vcsPlan.commitMessage)?et:"").split("\n")[0]})}),eO&&eD.runId&&(0,l.jsx)(f.P,{sessionId:eF.id,taskId:eD.id,live:"running"===eD.status||"waiting-approval"===eD.status}),eW?(0,l.jsxs)("div",{style:{marginTop:8},children:[(0,l.jsx)("label",{children:eM("form.titleLabel")}),(0,l.jsx)("input",{type:"text",value:eB,onChange:e=>eE(e.target.value)}),(0,l.jsx)("div",{style:{marginTop:8},children:(0,l.jsx)(L,{value:eR,onChange:eU,presets:eI})}),(0,l.jsx)("label",{children:eM("form.taskLabel")}),(0,l.jsx)("textarea",{className:"prose",value:eG,onChange:e=>eq(e.target.value)}),(null==(S=eF.vcs)?void 0:S.enabled)&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("label",{htmlFor:"branch-".concat(eD.id),children:eM("task.branch")}),(0,l.jsx)("input",{id:"branch-".concat(eD.id),type:"text",value:eJ,onChange:e=>ez(e.target.value),placeholder:eF.vcs.branchPrefix,disabled:"per-session"===eF.vcs.branchMode}),(0,l.jsx)("p",{className:"why",children:"per-session"===eF.vcs.branchMode?eM("task.branchIgnored"):eM("task.branchWhy")}),(0,l.jsx)("label",{htmlFor:"commit-".concat(eD.id),children:eM("task.commitMessage")}),(0,l.jsx)("textarea",{id:"commit-".concat(eD.id),value:eZ,onChange:e=>e_(e.target.value),style:{minHeight:70}}),(0,l.jsx)("p",{className:"why",children:eM("task.commitWhy")})]}),(0,l.jsx)(R,{checks:eK,onChange:eY}),(0,l.jsxs)("div",{className:"row",style:{marginTop:8},children:[(0,l.jsx)("button",{className:"primary",onClick:()=>void(e4?e9():e1()),children:e4?eM("task.saveAndRerun"):eM("task.save")}),(0,l.jsx)("span",{className:"err",children:eX})]}),e4&&(0,l.jsx)("p",{className:"muted small",children:eM("task.editRanWhy")})]}):(0,l.jsxs)(l.Fragment,{children:[(null!=(er=null==(F=eD.checks)?void 0:F.length)?er:0)>0&&(0,l.jsxs)("details",{className:"small",style:{margin:"6px 0"},children:[(0,l.jsxs)("summary",{children:[eM("checks.title")," — ",eM("checks.n",{n:null!=(ei=null==(D=eD.checks)?void 0:D.length)?ei:0}),(null!=(ec=null==(H=eD.checkResults)?void 0:H.length)?ec:0)>0&&" \xb7 ".concat((null!=(ed=eD.checkResults)?ed:[]).filter(e=>e.passed).length,"/").concat(null==(I=eD.checkResults)?void 0:I.length," ").concat(eM("checks.passed"))]}),(0,l.jsx)("ul",{style:{margin:"6px 0",paddingLeft:20},children:(null!=(eo=eD.checks)?eo:[]).map((e,s)=>{var n;let a=(null!=(n=eD.checkResults)?n:[]).find(s=>s.name===e.name);return(0,l.jsxs)("li",{children:[(0,l.jsx)("strong",{children:e.name}),(0,l.jsxs)("span",{className:"muted",children:[" — ",eM("checks.kind.".concat(e.expect)),e.value?' "'.concat(e.value,'"'):"",e.run?": ".concat(e.run):e.file?": ".concat(e.file):""]}),a&&(0,l.jsxs)("div",{className:a.passed?"muted":"reason",children:[a.passed?eM("checks.passed"):eM("checks.failed")," — ",a.detail]})]},"".concat(e.name,"-").concat(s))})})]}),(null!=(em=null==(T=eD.reviewChecks)?void 0:T.length)?em:0)>0&&(0,l.jsxs)("details",{className:"small",style:{margin:"6px 0"},children:[(0,l.jsx)("summary",{children:eM("checks.fromReview",{n:null!=(eh=null==(M=eD.reviewChecks)?void 0:M.length)?eh:0})}),(0,l.jsx)("p",{className:"why",children:eM("checks.fromReviewWhy")}),(0,l.jsx)("ul",{style:{margin:"6px 0",paddingLeft:20},children:(null!=(eu=eD.reviewChecks)?eu:[]).map(e=>{var s;let n=(null!=(s=eD.checkResults)?s:[]).find(s=>s.name===e.check.name);return(0,l.jsxs)("li",{children:[(0,l.jsx)("code",{children:e.findingId})," ",(0,l.jsx)("strong",{children:e.check.name}),"active"!==e.state&&(0,l.jsx)("span",{className:"chip",style:{marginLeft:6},children:eM("checks.state.".concat(e.state))}),(0,l.jsx)("div",{className:"muted",children:e.what}),n&&(0,l.jsxs)("div",{className:n.passed?"muted":"reason",children:[n.passed?eM("checks.passed"):eM("checks.failed")," — ",n.detail]})]},e.check.name)})})]}),(0,l.jsx)(J,{review:eD.review}),eD.summary&&(0,l.jsxs)("div",{className:"summary",children:[(0,l.jsx)("strong",{children:eM("task.whatWasDone")}),(0,l.jsx)(k.s,{text:eD.summary})]}),(null!=(ep=null==(P=eD.deviations)?void 0:P.length)?ep:0)>0&&(0,l.jsx)(G,{items:null!=(ex=eD.deviations)?ex:[]}),(null!=(ev=null==(W=eD.disputes)?void 0:W.length)?ev:0)>0&&(0,l.jsx)(q,{items:null!=(ej=eD.disputes)?ej:[]}),eD.environment&&(0,l.jsx)("div",{className:"muted small",style:{margin:"4px 0"},children:eM("task.ranWith",{node:eD.environment.node,npm:null!=(eg=eD.environment.npm)?eg:"—",git:null!=(ef=eD.environment.git)?ef:"—",pwsh:null!=(eb=null!=(ek=eD.environment.pwsh)?ek:eD.environment.powershell)?eb:"—"})}),(null!=(ey=null==(O=eD.leftovers)?void 0:O.length)?ey:0)>0&&(0,l.jsxs)("div",{className:"err small",style:{margin:"6px 0"},children:[eM("task.leftovers",{n:null!=(eN=null==(A=eD.leftovers)?void 0:A.length)?eN:0}),(0,l.jsx)("ul",{style:{margin:"4px 0",paddingLeft:20},children:(null!=(ew=eD.leftovers)?ew:[]).map(e=>(0,l.jsxs)("li",{children:[(0,l.jsx)("code",{children:e.name})," pid ",e.pid,e.ports.length>0?" \xb7 ".concat(eM("task.leftoverPorts",{ports:e.ports.join(", ")})):""," \xb7 ",e.by]},"".concat(e.by,"-").concat(e.pid)))})]}),eD.reason&&(0,l.jsx)("div",{className:"reason small",style:{margin:"6px 0"},children:eD.reason}),(null!=(eC=null==(B=eD.attempts)?void 0:B.length)?eC:0)>0&&(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:eM("task.attempts",{n:null!=(eS=null==(E=eD.attempts)?void 0:E.length)?eS:0})}),null==(U=eD.attempts)?void 0:U.map((e,s)=>{var n,a,t,r;return(0,l.jsxs)("div",{className:"small",style:{margin:"8px 0 12px"},children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("strong",{children:eM("task.attemptN",{n:s+1})}),(0,l.jsx)("span",{className:"badge ".concat(e.status),children:eM("status.".concat(e.status))}),e.iterations>0&&(0,l.jsx)("span",{className:"muted",children:eM("task.iterations",{n:e.iterations})}),e.runId&&(0,l.jsx)(o.u,{label:eM("save.attemptLog"),save:()=>c.FH.saveTaskLog(eF.id,eD.id,e.runId)}),e.runId&&(0,l.jsx)(o.H,{sessionId:eF.id,taskId:eD.id,attempt:s+1}),e.runId&&(null==(n=e.vcs)?void 0:n.commit)&&e.vcs.baseCommit&&(0,l.jsx)(y.C,{sessionId:eF.id,taskId:eD.id,runId:e.runId,title:"".concat(eD.title," — ").concat(eM("task.attemptN",{n:s+1})),files:null!=(t=null==(a=e.vcs.files)?void 0:a.length)?t:0})]}),(0,l.jsxs)("div",{className:"muted",children:[e.startedAt?eM("task.started",{t:eP(e.startedAt)}):"",e.finishedAt?" \xb7 ".concat(eM("task.finished",{t:eP(e.finishedAt)})):""]}),e.summary&&(0,l.jsx)("div",{children:e.summary}),e.reason&&(0,l.jsx)("div",{className:"err",children:e.reason}),e.prompt&&e.prompt!==eD.prompt&&(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:eM("task.attemptText")}),(0,l.jsx)("pre",{children:e.prompt})]})]},"".concat(null!=(r=e.runId)?r:s))})]}),"queued"===eD.status?(0,l.jsxs)("div",{style:{marginTop:8},children:[(0,l.jsx)("div",{className:"muted small",children:eM("task.prompt")}),(0,l.jsx)("pre",{children:eD.prompt}),eD.level2.trim()?(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:eM("task.l2Show",{n:eD.level2.trim().split("\n").length})}),(0,l.jsx)("pre",{children:eD.level2})]}):(0,l.jsx)("div",{className:"muted small",children:eM("task.noL2")})]}):(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:eM("task.promptAndL2")}),eD.level2.trim()&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"muted small",children:eM("task.l2")}),(0,l.jsx)("pre",{children:eD.level2})]}),(0,l.jsx)("div",{className:"muted small",children:eM("task.prompt")}),(0,l.jsx)("pre",{children:eD.prompt})]}),eD.firstMessage&&(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:eM("task.firstMessage")}),(0,l.jsx)("pre",{className:"tall",children:eD.firstMessage})]}),eD.runId&&(0,l.jsxs)("details",{onToggle:e=>e.currentTarget.open&&void sn(),children:[(0,l.jsx)("summary",{children:eM("task.files")}),(0,l.jsx)("div",{className:"row small",style:{margin:"6px 0"},children:(0,l.jsx)(o.u,{label:eM("save.log"),save:()=>c.FH.saveTaskLog(eF.id,eD.id)})}),eQ&&(0,l.jsxs)("div",{className:"small",children:[sl("task.reports","reports",eQ.reports),sl("task.artifacts","artifacts",eQ.artifacts),sl("task.replies","replies",eQ.replies)]})]}),eD.finalReply&&(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:eM("task.finalReply")}),(0,l.jsx)("pre",{className:"tall",children:eD.finalReply})]})]})]})}function E(e){let{events:s}=e,{t:n}=(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,l.jsxs)("div",{className:"panel",children:[(0,l.jsx)("h2",{children:n("live.title")}),(0,l.jsxs)("div",{className:"log",ref:r,children:[0===s.length&&(0,l.jsx)("div",{className:"muted",children:n("live.none")}),s.map((e,s)=>{var n;return(0,l.jsxs)("div",{className:e.level,children:[(0,l.jsx)("span",{className:"time",children:new Date(e.at).toLocaleTimeString(void 0,{hour12:!1})}),null!=(n=e.message)?n:e.type]},s)})]})]})}function R(e){let{checks:s,onChange:n}=e,{t:a}=(0,d.kj)(),t=(e,l)=>n(s.map((s,n)=>e===n?{...s,...l}:s));return(0,l.jsxs)("div",{style:{marginTop:12},children:[(0,l.jsx)("label",{children:a("checks.title")}),(0,l.jsx)("p",{className:"why",style:{marginTop:0},children:a("checks.why")}),0===s.length&&(0,l.jsx)("p",{className:"muted small",children:a("checks.noneWhy")}),s.map((e,r)=>{var i,d,o,m;return(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.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,l.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,l.jsx)("option",{value:e,children:a("checks.kind.".concat(e))},e))}),(0,l.jsx)("button",{className:"quiet",onClick:()=>n(s.filter((e,s)=>s!==r)),children:a("checks.remove")})]}),(0,l.jsxs)("div",{className:"row",style:{marginTop:6},children:[(0,c.rt)(e.expect)?(0,l.jsxs)(l.Fragment,{children:[(0,l.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,l.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,l.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,l.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,l.jsx)("button",{onClick:()=>n([...s,{name:"",expect:"exit-zero",run:""}]),children:a("checks.add")})]})}function U(e){let{tasks:s}=e,{t:n}=(0,d.kj)(),a=(0,m.hH)(s),t=(0,h.c)(!!a&&a.tasks.some(m.DG));if(!a)return null;let r=(0,m.eZ)(a.run,a.tasks,t);return(0,l.jsx)("p",{className:"muted small",style:{margin:"4px 0 10px"},children:n(r.live?"session.runClockLive":"session.runClock",{n:r.tasks,d:(0,c.c5)(r.ms)})})}function G(e){let{items:s}=e,{t:n}=(0,d.kj)();return(0,l.jsxs)("div",{className:"summary",children:[(0,l.jsx)("strong",{children:n("task.deviations",{n:s.length})}),(0,l.jsx)("ol",{style:{margin:"6px 0",paddingLeft:20},children:s.map((e,s)=>(0,l.jsxs)("li",{style:{marginBottom:6},children:[(0,l.jsx)("div",{children:e.instruction}),(0,l.jsxs)("div",{className:"muted",children:[n("task.deviationDid"),": ",e.did]}),(0,l.jsxs)("div",{className:"muted",children:[n("task.deviationWhy"),": ",e.why]})]},s))})]})}function q(e){let{items:s}=e,{t:n}=(0,d.kj)();return(0,l.jsxs)("div",{className:"summary",children:[(0,l.jsx)("strong",{children:n("task.disputes",{n:s.length})}),(0,l.jsx)("ol",{style:{margin:"6px 0",paddingLeft:20},children:s.map((e,s)=>(0,l.jsxs)("li",{style:{marginBottom:6},children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("code",{children:e.finding})," — ",e.why]}),(0,l.jsxs)("div",{className:"muted",children:[n("review.evidence"),": ",e.evidence]})]},s))})]})}function J(e){var s,n,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,l.jsxs)("div",{className:"small",style:{margin:"8px 0"},children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("span",{className:"badge ".concat(o),children:c("review.verdict.".concat(i.verdict))}),i.stepsRun>0&&(0,l.jsx)("span",{className:"muted",children:c("review.ran",{n:i.stepsRun})}),i.rounds>1&&(0,l.jsx)("span",{className:"muted",children:c("review.rounds",{n:i.rounds})}),i.model&&(0,l.jsx)("span",{className:"chip",children:c("review.onModel",{model:i.model})})]}),i.problem&&(0,l.jsx)("p",{className:"reason",children:c("review.problem",{problem:i.problem})}),i.summary&&(0,l.jsx)(k.s,{text:i.summary}),(null!=(a=null==(s=i.findings)?void 0:s.length)?a:0)>0&&(0,l.jsxs)("details",{style:{marginTop:4},children:[(0,l.jsx)("summary",{children:c("review.findings",{n:null!=(t=null==(n=i.findings)?void 0:n.length)?t:0})}),(0,l.jsx)("ol",{style:{margin:"6px 0",paddingLeft:20},children:(null!=(r=i.findings)?r:[]).map((e,s)=>(0,l.jsxs)("li",{style:{marginBottom:8},children:[(0,l.jsxs)("div",{children:[e.id&&(0,l.jsx)("code",{style:{marginRight:6},children:e.id}),e.what,"task"===e.about&&(0,l.jsx)("span",{className:"chip",style:{marginLeft:6},children:c("review.aboutTask")}),e.repeated&&(0,l.jsx)("span",{className:"chip",style:{marginLeft:6},children:c("review.repeated")})]}),e.where&&(0,l.jsx)("div",{className:"muted",children:e.where}),(0,l.jsxs)("div",{className:"muted",children:[c("review.evidence"),": ",e.evidence]})]},s))})]})]})}},4784:(e,s,n)=>{"use strict";n.d(s,{Y:()=>i});var l=n(3365),a=n(1521),t=n(5549),r=n(867);function i(e){var s,n;let{id:i,chosen:c,onChange:d,none:o,catalogue:m,disabled:h=!1,style:u}=e,{t:p}=(0,r.kj)(),x=function(e){let[s,n]=(0,a.useState)(null);return(0,a.useEffect)(()=>{if(void 0!==e)return;let s=!0;return t.FH.models().then(e=>{s&&n(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!=(n=f.get(e.group))?n:[],e]);return(0,l.jsxs)("select",{id:i,value:c,onChange:e=>d(e.target.value),disabled:h,style:{width:"auto",minWidth:280,...u},children:[(0,l.jsx)("option",{value:"",children:o}),c&&!j&&(0,l.jsx)("option",{value:c,children:p("model.notInList",{name:c})}),g.map(e=>(0,l.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,n]=e;return(0,l.jsx)("optgroup",{label:s,children:n.map(e=>(0,l.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(p("model.unavailable")):""]},e.name))},s)})]})}},8848:(e,s,n)=>{"use strict";n.d(s,{H4:()=>d,L:()=>o,z4:()=>m});var l=n(3365),a=n(8197),t=n.n(a),r=n(1521),i=n(5549),c=n(867);function d(e){let{current:s,onUse:n}=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(),h=n?t.others.filter(e=>e.rootDir.trim().toLowerCase()!==m):[];return(0,l.jsx)(u,{label:o?a("proj.defaultIs",{dir:o}):a("proj.noneShort"),offer:o&&n&&m!==o.toLowerCase()?{text:a("proj.useIt"),onUse:()=>n(o)}:void 0,more:h.map(e=>({text:a("proj.otherUse",{name:e.name}),title:e.rootDir,onUse:()=>null==n?void 0:n(e.rootDir)})),link:o?a("proj.change"):a("proj.setIt"),anchor:"project"})}function o(e){let{current:s,onUse:n}=e,a=h(),{t}=(0,c.kj)();if(!a)return null;let r=a.defaultModel.trim();return(0,l.jsx)(u,{label:r?t("def.modelDefaultIs",{name:r}):t("def.modelNoneShort"),offer:r&&n&&s.trim()!==r?{text:t("def.modelUseIt"),onUse:()=>n(r)}:void 0,link:t(r?"proj.change":"proj.setIt"),anchor:"model"})}function m(e){let{current:s,onUse:n}=e,a=h(),{t}=(0,c.kj)();if(!a)return null;let r=a.defaultReviewModel.trim();return(0,l.jsx)(u,{label:r?t("def.reviewDefaultIs",{name:r}):t("def.reviewNoneShort"),offer:r&&n&&s.trim()!==r?{text:t("def.modelUseIt"),onUse:()=>n(r)}:void 0,link:t(r?"proj.change":"proj.setIt"),anchor:"review"})}function h(){let[e,s]=(0,r.useState)(null);return(0,r.useEffect)(()=>{let e=!1;return i.FH.models().then(n=>{e||s(n)}).catch(()=>void 0),()=>{e=!0}},[]),e}function u(e){let{label:s,offer:n,more:a=[],link:r,anchor:i}=e;return(0,l.jsxs)("p",{className:"muted small",style:{marginTop:4},children:[s," ",n&&(0,l.jsxs)(l.Fragment,{children:["\xb7"," ",(0,l.jsx)("button",{type:"button",className:"linkish",onClick:n.onUse,children:n.text})," "]}),a.map(e=>(0,l.jsxs)("span",{children:["\xb7"," ",(0,l.jsx)("button",{type:"button",className:"linkish",onClick:e.onUse,title:e.title,children:e.text})," "]},e.text)),"\xb7 ",(0,l.jsx)(t(),{href:"/defaults#".concat(i),children:r})]})}}},e=>{e.O(0,[197,867,549,723,347,131,358],()=>e(e.s=1772)),_N_E=e.O()}]);
|
/package/dist/web/_next/static/{DCpEMjhrg9APkRwBBw5Do → kysrkUS5Y-ZTHsIIXgs3q}/_buildManifest.js
RENAMED
|
File without changes
|
/package/dist/web/_next/static/{DCpEMjhrg9APkRwBBw5Do → kysrkUS5Y-ZTHsIIXgs3q}/_ssgManifest.js
RENAMED
|
File without changes
|