copilot-operator 0.1.9 → 0.1.11
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.controller.js +11 -0
- package/dist/src/api/operator.service.js +32 -13
- package/dist/src/config/schema.js +6 -0
- package/dist/src/orchestrator/contract.js +58 -0
- package/dist/src/orchestrator/taskRunner.js +104 -6
- package/dist/src/plan/schema.js +21 -1
- package/dist/src/plan/systemGuide.js +48 -0
- package/dist/src/protocol/parser.js +98 -5
- package/dist/src/session/compose.js +1 -1
- package/dist/src/session/exports.js +1 -0
- package/dist/src/session/handoff.js +1 -1
- package/dist/src/session/store.js +44 -10
- package/dist/src/transport/copilotTransport.js +145 -65
- package/dist/src/vcs/scope.js +10 -7
- package/dist/src/vcs/syncCommand.js +105 -0
- package/dist/web/404.html +2 -2
- package/dist/web/_next/static/chunks/295-04151ded0741d18d.js +1 -0
- package/dist/web/_next/static/chunks/36-17a3bcb0c2553c7c.js +1 -0
- package/dist/web/_next/static/chunks/549-8f69ef8086802748.js +1 -0
- package/dist/web/_next/static/chunks/867-f82c74b7b2ed5c54.js +1 -0
- package/dist/web/_next/static/chunks/app/defaults/page-abfa73fb08822e36.js +1 -0
- package/dist/web/_next/static/chunks/app/history/page-a9f2060f86a4a10e.js +1 -0
- package/dist/web/_next/static/chunks/app/import/page-999d6cd958989723.js +1 -0
- package/dist/web/_next/static/chunks/app/level1/{page-be366b35f4cc97ce.js → page-dd3ebf37d29dce4f.js} +1 -1
- package/dist/web/_next/static/chunks/app/page-2ac6b67f4ddcb808.js +1 -0
- package/dist/web/_next/static/chunks/app/presets/{page-cabc3876a8111edd.js → page-93ab518db67e52a2.js} +1 -1
- package/dist/web/_next/static/chunks/app/sessions/view/page-d7e1f83d13c6356b.js +1 -0
- package/dist/web/_next/static/css/{20c6b36996df5e4c.css → 2ad2a74b7e07dcc9.css} +1 -1
- package/dist/web/appearance.html +2 -2
- package/dist/web/appearance.txt +12 -12
- package/dist/web/defaults.html +2 -2
- package/dist/web/defaults.txt +12 -12
- package/dist/web/history.html +2 -2
- package/dist/web/history.txt +12 -12
- package/dist/web/import.html +2 -2
- package/dist/web/import.txt +12 -12
- package/dist/web/index.html +2 -2
- package/dist/web/index.txt +12 -12
- package/dist/web/level1.html +2 -2
- package/dist/web/level1.txt +12 -12
- package/dist/web/presets.html +3 -3
- package/dist/web/presets.txt +12 -12
- package/dist/web/sessions/view.html +2 -2
- package/dist/web/sessions/view.txt +12 -12
- package/dist/web/system.html +2 -2
- package/dist/web/system.txt +12 -12
- package/package.json +6 -2
- package/dist/web/_next/static/chunks/373-56833488fcb5aa29.js +0 -1
- package/dist/web/_next/static/chunks/549-43d1a5681752fbd4.js +0 -1
- package/dist/web/_next/static/chunks/867-76cc83e4e54812dc.js +0 -1
- package/dist/web/_next/static/chunks/app/defaults/page-78be7820772f8882.js +0 -1
- package/dist/web/_next/static/chunks/app/history/page-90bc1c718d76b6b2.js +0 -1
- package/dist/web/_next/static/chunks/app/import/page-1060c7cb8e8d66eb.js +0 -1
- package/dist/web/_next/static/chunks/app/page-9e2736286f16422d.js +0 -1
- package/dist/web/_next/static/chunks/app/sessions/view/page-0e2b6829643e9b04.js +0 -1
- /package/dist/web/_next/static/{auD7lTmj-JDMJIQ4TVivR → oyfXbuB_cq0sRZP7ukHlQ}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{auD7lTmj-JDMJIQ4TVivR → oyfXbuB_cq0sRZP7ukHlQ}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[189],{1035:(e,t,l)=>{"use strict";l.d(t,{DialogHost:()=>c,Z:()=>d});var r=l(3365),n=l(1521),a=l(867),s=l(4969);let i=null,o=[];function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(l=>{var r;return r={kind:"confirm",message:e,...t,resolve:l},void(i?i(r):o.push(r))})}function c(e){var t,l;let{children:d}=e,{t:c}=(0,a.kj)(),[u,m]=(0,n.useState)([]),h=(0,n.useRef)(null),x=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(i=e=>m(t=>[...t,e]),o.length>0){let e=o.splice(0,o.length);m(t=>[...t,...e])}return()=>{i=null}},[]);let p=u[0],j=(0,n.useCallback)(e=>{p&&(p.resolve(e),m(e=>e.slice(1)))},[p]);return(0,s.V)(x,!!p,h),(0,n.useEffect)(()=>{if(!p)return;let e=e=>{"Escape"===e.key&&(e.preventDefault(),j(!1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[p,j]),(0,r.jsxs)(r.Fragment,{children:[d,p&&(0,r.jsx)("div",{className:"modal-backdrop",onClick:()=>j(!1),role:"presentation",children:(0,r.jsxs)("div",{ref:x,className:"modal".concat(p.danger?" danger":""),role:"confirm"===p.kind?"alertdialog":"dialog","aria-modal":"true","aria-labelledby":"modal-title","aria-describedby":"modal-body",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{id:"modal-title",children:null!=(t=p.title)?t:c("confirm"===p.kind?"dialog.confirmTitle":"dialog.noticeTitle")}),(0,r.jsx)("div",{id:"modal-body",className:"modal-body",children:p.message}),(0,r.jsxs)("div",{className:"row modal-actions",children:["confirm"===p.kind&&(0,r.jsx)("button",{type:"button",className:"quiet",onClick:()=>j(!1),children:c("dialog.cancel")}),(0,r.jsx)("button",{ref:h,type:"button",className:p.danger?"danger":"primary",onClick:()=>j(!0),children:null!=(l=p.okLabel)?l:c("dialog.ok")})]})]})})]})}},1896:(e,t,l)=>{Promise.resolve().then(l.bind(l,3197))},2244:(e,t,l)=>{"use strict";l.d(t,{k:()=>c});var r=l(3365),n=l(1521),a=l(5549),s=l(867);function i(e){return e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/+$/,"")}function o(e,t){return"."===t||""===t||e===t||e.startsWith("".concat(t,"/"))}function d(e,t,l){return l.includes(e)?"out":l.some(t=>t!==e&&o(e,t))?"out-inherited":t.includes(e)?"in":t.some(t=>t!==e&&o(e,t))?"inherited":"none"}function c(e){let{rootDir:t,respectGitignore:l,includeEnvFiles:c,include:u,exclude:m,onChange:h}=e,{t:x}=(0,s.kj)(),[p,j]=(0,n.useState)(null),[v,f]=(0,n.useState)(""),[g,y]=(0,n.useState)(new Set),[b,w]=(0,n.useState)(""),N=async()=>{if(t.trim()){f("");try{let e=await a.FH.dirs(t,l);j(e),w("".concat(t,"|").concat(l)),y(new Set(e.filter(e=>!e.includes("/"))))}catch(e){f(e.message)}}};(0,n.useEffect)(()=>{j(null),w("")},[t,l]);let k=(0,n.useMemo)(()=>(function(e){let t=[],l=new Map;for(let n of[...e].sort()){var r;let e={path:n,name:null!=(r=n.split("/").pop())?r:n,children:[]};l.set(n,e);let a=n.includes("/")?l.get(n.slice(0,n.lastIndexOf("/"))):void 0;(a?a.children:t).push(e)}return t})(null!=p?p:[]),[p]),S=u.map(i).filter(Boolean),C=m.map(i).filter(Boolean),D=e=>(0,r.jsx)("ul",{className:"dir-tree",children:e.map(e=>{let t=d(e.path,S,C),l=g.has(e.path),n=function(e,t,l){let r=t=>t.filter(t=>t!==e&&o(t,e)).length;return{included:r(t),excluded:r(l)}}(e.path,S,C),a=!l&&e.children.length>0&&(n.included>0||n.excluded>0);return(0,r.jsxs)("li",{className:"dir ".concat(t),children:[(0,r.jsxs)("div",{className:"dir-row",children:[e.children.length>0?(0,r.jsx)("button",{type:"button",className:"dir-flip",onClick:()=>{let t;return t=e.path,y(e=>{let l=new Set(e);return l.has(t)?l.delete(t):l.add(t),l})},"aria-label":l?x("tree.fold"):x("tree.unfold"),"aria-expanded":l,children:l?"▾":"▸"}):(0,r.jsx)("span",{className:"dir-flip","aria-hidden":"true"}),(0,r.jsxs)("button",{type:"button",className:"dir-name",onClick:()=>(e=>{if("in"===d(e,S,C))return void h(S.filter(t=>t!==e),C);h([...S.filter(t=>!o(t,e)),e],C.filter(t=>!o(t,e)))})(e.path),title:"in"===t?x("tree.stateIn"):"inherited"===t?x("tree.stateInherited"):"out"===t?x("tree.stateOut"):"out-inherited"===t?x("tree.stateOutInherited"):x("tree.stateNone"),"aria-pressed":"in"===t||"inherited"===t,children:[(0,r.jsx)("span",{className:"dir-mark","aria-hidden":"true",children:"in"===t?"✓":"inherited"===t?"\xb7":"out"===t||"out-inherited"===t?"\xd7":""}),e.name]}),(0,r.jsx)("button",{type:"button",className:"dir-out".concat("out"===t?" on":""),onClick:()=>(e=>{if(C.includes(e))return void h(S,C.filter(t=>t!==e));h(S.filter(t=>t!==e&&!o(t,e)),[...C.filter(t=>!o(t,e)),e])})(e.path),title:"out"===t?x("tree.unexclude"):x("tree.exclude"),"aria-label":"".concat("out"===t?x("tree.unexclude"):x("tree.exclude"),": ").concat(e.path),children:"−"}),a&&(0,r.jsx)("span",{className:"chip inside".concat(n.excluded>0?" out":""),title:x("tree.insideWhy"),children:n.excluded>0&&n.included>0?x("tree.insideBoth",{i:n.included,e:n.excluded}):n.excluded>0?x("tree.insideOut",{n:n.excluded}):x("tree.insideIn",{n:n.included})})]}),l&&e.children.length>0&&D(e.children)]},e.path)})}),F=b!=="".concat(t,"|").concat(l);return(0,r.jsxs)("div",{className:"dir-tree-box",children:[(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("button",{type:"button",onClick:()=>void N(),disabled:!t.trim(),children:null===p||F?x("tree.load"):x("tree.reload")}),(0,r.jsx)("span",{className:"muted small",children:x("tree.hint")})]}),v&&(0,r.jsx)("div",{className:"err small",children:v}),(0,r.jsxs)("p",{className:"muted small",style:{marginTop:6},children:[x("tree.alsoOut")," ",[l?x("tree.alsoGitignore"):null,!1===c?x("tree.alsoEnv"):null,x("tree.alsoAlways")].filter(Boolean).join(" \xb7 ")]}),null!==p&&!F&&(0===p.length?(0,r.jsx)("p",{className:"muted small",children:x("mirror.noDirs")}):D(k))]})}},3197:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>m});var r=l(3365),n=l(1521),a=l(8197),s=l.n(a),i=l(5549),o=l(867),d=l(1035),c=l(4784),u=l(2244);function m(){let{t:e}=(0,o.kj)(),[t,l]=(0,n.useState)(null),[a,s]=(0,n.useState)(!1),[c,u]=(0,n.useState)("");(0,n.useEffect)(()=>{i.FH.models().then(l).catch(()=>void 0)},[]);let m=async()=>{if(await (0,d.Z)(e("model.refreshConfirm"))){s(!0),u(e("model.refreshing"));try{var t;let r=await i.FH.models().then(()=>i.FH.refreshModels());l(r),u(0===r.options.length?null!=(t=r.note)?t:e("model.none"):e("model.refreshed",{n:r.options.length}))}catch(e){u(e.message)}finally{s(!1)}}},h={catalogue:t,setCatalogue:l,refreshModels:m,refreshing:a,refreshMsg:c};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"panel",children:[(0,r.jsx)("h2",{children:e("def.title")}),(0,r.jsx)("p",{className:"muted small",children:e("def.intro")}),(0,r.jsx)("p",{className:"why",children:e("def.autoSave")})]}),(0,r.jsx)(v,{}),(0,r.jsx)(b,{...h}),(0,r.jsx)(w,{...h}),(0,r.jsx)(y,{})]})}function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:900,l=(0,n.useRef)(null),r=(0,n.useRef)(null),a=(0,n.useRef)(e);return a.current=e,(0,n.useEffect)(()=>()=>{l.current&&clearTimeout(l.current),r.current&&a.current(r.current.value)},[]),e=>{l.current&&clearTimeout(l.current),r.current={value:e},l.current=setTimeout(()=>{r.current=null,a.current(e)},t)}}function x(e){let{id:t,value:l,min:a,max:s,onChange:i,disabled:o}=e,[d,c]=(0,n.useState)(String(l));return(0,n.useEffect)(()=>c(e=>p(e)===l?e:String(l)),[l]),(0,r.jsx)("input",{id:t,type:"number",min:a,max:s,step:1,value:d,onChange:e=>{c(e.target.value);let t=p(e.target.value);null!==t&&t>=a&&t<=s&&i(t)},onBlur:()=>{let e=p(d),t=null===e?l:Math.max(a,Math.min(s,e));c(String(t)),t!==l&&i(t)},style:{width:"9ch"},disabled:o})}function p(e){if(""===e.trim())return null;let t=Number(e);return Number.isInteger(t)?t:null}function j(e){let{msg:t,onSave:l}=e,{t:n}=(0,o.kj)();return(0,r.jsxs)("div",{className:"row",style:{marginTop:6},children:[l&&(0,r.jsx)("button",{className:"quiet",onClick:l,title:n("def.saveAnywayWhy"),children:n("def.saveAnyway")}),(0,r.jsx)("span",{className:"muted small",role:"status",children:t||n("def.savedAutomatically")})]})}function v(){var e;let{t}=(0,o.kj)(),[l,a]=(0,n.useState)(null),[s,d]=(0,n.useState)(""),[c,u]=(0,n.useState)(""),[m,x]=(0,n.useState)(""),[p,v]=(0,n.useState)(""),[g,y]=(0,n.useState)(!1),[b,w]=(0,n.useState)(""),[N,k]=(0,n.useState)(""),S=(0,n.useCallback)(async()=>{try{let e=await i.FH.project();a(e),d(e.rootDir),u(e.name),v("")}catch(e){v(e.message)}},[]);(0,n.useEffect)(()=>{S()},[S]);let C=async(e,t)=>{y(!0),x("");try{let l=await i.FH.setProject(e);return a(l),d(l.rootDir),x(t(l)),v(""),!0}catch(e){return v(e.message),!1}finally{y(!1)}},D=e=>C({rootDir:e},e=>e.rootDir?t("proj.saved",{dir:e.rootDir}):t("proj.cleared")),F=e=>C({name:e},()=>t("proj.nameSaved")),E=h(D),T=h(F),R=async(e,t)=>{y(!0);try{var l;let r=await i.FH.browseFolder(t.trim()||void 0);r.ok?e(r.path):r.cancelled||v(null!=(l=r.reason)?l:"")}catch(e){v(e.message)}finally{y(!1)}},M=null!=(e=null==l?void 0:l.others)?e:[],I=e=>e.map(e=>({name:e.name,rootDir:e.rootDir,...e.mirror?{mirror:e.mirror}:{}})),A=async()=>{await C({others:[...I(M),{name:b.trim(),rootDir:N.trim()}]},e=>t("proj.othersSaved",{n:e.others.length}))&&(w(""),k(""))};return(0,r.jsxs)("div",{className:"panel",id:"project",children:[(0,r.jsx)("h2",{children:t("proj.title")}),(0,r.jsx)("p",{className:"muted small",children:t("proj.intro")}),p&&(0,r.jsx)("div",{className:"err",children:p}),l&&(0,r.jsxs)("div",{className:"option".concat(l.mirrorToDesktop?" warned":""),style:{marginBottom:12},children:[(0,r.jsxs)("label",{children:[(0,r.jsx)("input",{type:"checkbox",checked:l.mirrorToDesktop,onChange:e=>{C({mirrorToDesktop:e.target.checked},e=>e.mirrorToDesktop?t("proj.mirrorOn",{root:e.contextRoot}):t("proj.mirrorOff"))},disabled:g}),(0,r.jsx)("span",{children:t("proj.mirrorToDesktop")})]}),(0,r.jsx)("p",{className:"why",children:t("proj.mirrorToDesktopWhy",{root:l.contextRoot})})]}),(0,r.jsx)("p",{className:"muted small",children:t("proj.listIntro")}),(0,r.jsx)(f,{name:c,dir:s,repoOk:!!(null==l?void 0:l.repoOk),repoProblem:null==l?void 0:l.repoProblem,mirror:null==l?void 0:l.mirror,isDefault:!0,busy:g,onNameInput:e=>{u(e),T(e)},onName:e=>void F(e),onDirInput:e=>{d(e),E(e)},onDir:e=>void D(e),onBrowse:()=>void R(e=>void D(e),s),onRemove:(null==l?void 0:l.rootDir)?()=>void D(""):void 0,removeLabel:t("proj.clear"),onFolders:e=>C({mirror:e},()=>t("proj.foldersSaved"))}),(0,r.jsx)(j,{msg:m}),l&&!l.rootDir&&(0,r.jsx)("p",{className:"muted small",style:{marginTop:8},children:t("proj.none")}),M.map((e,l)=>(0,r.jsx)(f,{name:e.name,dir:e.rootDir,repoOk:e.repoOk,repoProblem:e.repoProblem,mirror:e.mirror,busy:g,onName:l=>void C({others:I(M.map(t=>t.name===e.name?{...t,name:l}:t))},()=>t("proj.nameSaved")),onDir:l=>void C({others:I(M.map(t=>t.name===e.name?{...t,rootDir:l}:t))},()=>t("proj.othersSaved",{n:M.length})),onBrowse:()=>void R(l=>void C({others:I(M.map(t=>t.name===e.name?{...t,rootDir:l}:t))},()=>t("proj.othersSaved",{n:M.length})),e.rootDir),onRemove:()=>{let l;l=e.name,C({others:I(M.filter(e=>e.name!==l))},e=>t("proj.othersSaved",{n:e.others.length}))},removeLabel:t("proj.otherRemove"),onFolders:l=>{let r;return r=e.name,C({others:I(M.map(e=>e.name===r?{...e,mirror:l}:e))},()=>t("proj.foldersSaved"))}},"other-".concat(l))),(0,r.jsx)("h3",{id:"others",children:t("proj.addTitle")}),(0,r.jsx)("p",{className:"muted small",children:t("proj.othersIntro")}),(0,r.jsxs)("div",{className:"row",style:{marginTop:8},children:[(0,r.jsx)("input",{type:"text","aria-label":t("proj.entryName"),value:b,onChange:e=>w(e.target.value),placeholder:t("proj.entryName"),disabled:g,style:{width:160}}),(0,r.jsx)("input",{type:"text",className:"grow","aria-label":t("proj.entryDir"),value:N,onChange:e=>k(e.target.value),placeholder:"C:\\Projects\\my-app-tests",disabled:g}),(0,r.jsx)("button",{onClick:()=>void R(e=>k(e),N),disabled:g,children:t("mirror.browse")}),(0,r.jsx)("button",{className:"primary",onClick:()=>void A(),disabled:g||!b.trim()||!N.trim(),children:t("proj.otherAdd")})]}),(0,r.jsx)("h3",{children:t("proj.affects")}),(0,r.jsxs)("ul",{className:"muted small",style:{margin:0,paddingLeft:20},children:[(0,r.jsx)("li",{children:t("proj.affectsNew")}),(0,r.jsx)("li",{children:t("proj.affectsExisting")}),(0,r.jsx)("li",{children:t("proj.affectsPlan")}),(0,r.jsx)("li",{children:t("proj.affectsNever")})]})]})}function f(e){var t;let{name:l,dir:a,repoOk:s,repoProblem:i,mirror:d,isDefault:c=!1,busy:u,onNameInput:m,onName:h,onDirInput:x,onDir:p,onBrowse:j,onRemove:v,removeLabel:f,onFolders:y}=e,{t:b}=(0,o.kj)(),w=(0,n.useId)(),[N,k]=(0,n.useState)(l),[S,C]=(0,n.useState)(a);return(0,n.useEffect)(()=>k(l),[l]),(0,n.useEffect)(()=>C(a),[a]),(0,r.jsxs)("div",{className:"panel inner",style:{marginTop:10},children:[(0,r.jsxs)("div",{className:"row",children:[(0,r.jsxs)("div",{style:{width:"min(200px, 100%)"},children:[(0,r.jsx)("label",{htmlFor:"".concat(w,"-name"),children:b("proj.entryName")}),(0,r.jsx)("input",{id:"".concat(w,"-name"),type:"text",value:N,onChange:e=>{k(e.target.value),null==m||m(e.target.value)},onBlur:()=>{(N!==l||m)&&h(N)},placeholder:a?null!=(t=a.replace(/[\/]+$/,"").split(/[\/]/).pop())?t:"":b("proj.namePlaceholder")})]}),(0,r.jsxs)("div",{className:"grow",children:[(0,r.jsx)("label",{htmlFor:"".concat(w,"-dir"),children:b("proj.entryDir")}),(0,r.jsx)("input",{id:"".concat(w,"-dir"),type:"text",value:S,onChange:e=>{C(e.target.value),null==x||x(e.target.value)},onBlur:()=>{(S!==a||x)&&p(S)},placeholder:"C:\\Projects\\my-app"})]}),(0,r.jsx)("button",{onClick:j,disabled:u,children:b("mirror.browse")}),v&&(0,r.jsx)("button",{className:"quiet",onClick:v,disabled:u,children:f})]}),(0,r.jsxs)("div",{className:"row small",style:{marginTop:6},children:[c&&(0,r.jsx)("span",{className:"chip",title:b("proj.isDefaultWhy"),children:b("proj.isDefault")}),a&&(0,r.jsx)("span",{className:"badge ".concat(s?"done":""),title:s?b("proj.isRepo"):i,children:b(s?"proj.otherRepo":"proj.otherNotRepo")}),a&&!s&&(0,r.jsx)("span",{className:"muted",children:i||b("proj.notRepoWhy")})]}),a&&(0,r.jsxs)("details",{className:"small",style:{marginTop:8},children:[(0,r.jsx)("summary",{children:b("proj.folders")}),(0,r.jsx)(g,{rootDir:a,value:d,onSave:y,busy:u})]})]})}function g(e){var t,l,a,s;let{rootDir:i,value:c,onSave:m,busy:x}=e,{t:p}=(0,o.kj)(),[v,f]=(0,n.useState)((null!=(t=null==c?void 0:c.includeDirs)?t:[]).join("\n")),[g,y]=(0,n.useState)((null!=(l=null==c?void 0:c.excludeDirs)?l:[]).join("\n")),[b,w]=(0,n.useState)(null==(a=null==c?void 0:c.respectGitignore)||a),[N,k]=(0,n.useState)(null!=(s=null==c?void 0:c.includeEnvFiles)&&s),S=e=>e.split("\n").map(e=>e.trim()).filter(Boolean),[C,D]=(0,n.useState)(""),F=async e=>{let t={includeDirs:S(v),excludeDirs:S(g),respectGitignore:b,includeEnvFiles:N,...e};await m(t)&&D(p("proj.foldersSaved"))},E=h(F),T=async e=>{(!e||await (0,d.Z)(p("mirror.envWarn")))&&(k(e),F({includeEnvFiles:e}))};return(0,r.jsxs)("div",{style:{marginTop:8},children:[(0,r.jsx)("p",{className:"muted small",children:p("proj.foldersHint")}),(0,r.jsxs)("div",{className:"row",style:{alignItems:"flex-start"},children:[(0,r.jsxs)("div",{className:"grow",children:[(0,r.jsx)("label",{children:p("mirror.include")}),(0,r.jsx)("textarea",{value:v,onChange:e=>{f(e.target.value),E({includeDirs:S(e.target.value),excludeDirs:S(g)})},placeholder:"src\ntests",style:{minHeight:70}})]}),(0,r.jsxs)("div",{className:"grow",children:[(0,r.jsx)("label",{children:p("mirror.exclude")}),(0,r.jsx)("textarea",{value:g,onChange:e=>{y(e.target.value),E({includeDirs:S(v),excludeDirs:S(e.target.value)})},placeholder:"src/generated",style:{minHeight:70}})]})]}),(0,r.jsx)(u.k,{rootDir:i,respectGitignore:b,includeEnvFiles:N,include:S(v),exclude:S(g),onChange:(e,t)=>{f(e.join("\n")),y(t.join("\n")),E({includeDirs:e,excludeDirs:t})}}),(0,r.jsx)("div",{className:"option",children:(0,r.jsxs)("label",{children:[(0,r.jsx)("input",{type:"checkbox",checked:b,onChange:e=>{w(e.target.checked),F({respectGitignore:e.target.checked})}}),(0,r.jsx)("span",{children:p("mirror.gitignore")})]})}),(0,r.jsx)("div",{className:"option".concat(N?" warned":""),children:(0,r.jsxs)("label",{children:[(0,r.jsx)("input",{type:"checkbox",checked:N,onChange:e=>void T(e.target.checked)}),(0,r.jsx)("span",{children:p("mirror.env")})]})}),(0,r.jsx)(j,{msg:x?"":C})]})}function y(){let{t:e}=(0,o.kj)(),[t,l]=(0,n.useState)(null),a=(0,n.useRef)(null),s=(0,n.useRef)(Promise.resolve()),[d,c]=(0,n.useState)(2),[u,m]=(0,n.useState)(60),[p,v]=(0,n.useState)(240),[f,g]=(0,n.useState)(900),[y,b]=(0,n.useState)("none"),[w,N]=(0,n.useState)("confirm"),[k,S]=(0,n.useState)("ask"),[C,D]=(0,n.useState)(""),[F,E]=(0,n.useState)("");(0,n.useEffect)(()=>{i.FH.settings().then(e=>{var t,r,n,s,i,o;a.current=e.raw,l(e.raw);let d=null!=(t=e.raw.limits)?t:{};c("number"==typeof d.retryBlockedInFreshChat?d.retryBlockedInFreshChat:2),m("number"==typeof d.maxIterations?d.maxIterations:60),v("number"==typeof d.maxRunMinutes?d.maxRunMinutes:240);let u=null!=(r=e.raw.copilot)?r:{};g("number"==typeof u.replyTimeoutSec?u.replyTimeoutSec:900);let h=null!=(n=e.raw.execution)?n:{};b(null!=(s=h.isolation)?s:"none"),N(null!=(i=h.mode)?i:"confirm"),S(null!=(o=h.networkFetch)?o:"ask")}).catch(e=>E(e.message))},[]);let T=(t,r,n)=>{let o=async()=>{var s;if(!a.current)return;let o=await i.FH.settings().then(e=>e.raw).catch(()=>a.current),d={...o,[t]:{...null!=(s=o[t])?s:{},[r]:n}};D("");try{await i.FH.saveSettings(d),a.current=d,l(d),D(e("exec.saved")),E("")}catch(e){E(e.message)}},d=s.current.then(o);return s.current=d.catch(()=>void 0),d},R=h(e=>T("limits","retryBlockedInFreshChat",e)),M=h(e=>T("limits","maxIterations",e)),I=h(e=>T("limits","maxRunMinutes",e)),A=h(e=>T("copilot","replyTimeoutSec",e)),B=(e,t)=>T("execution",e,t);return(0,r.jsxs)("div",{className:"panel",id:"execution",children:[(0,r.jsx)("h2",{children:e("exec.title")}),(0,r.jsx)("p",{className:"muted small",children:e("exec.intro")}),F&&(0,r.jsx)("div",{className:"err",children:F}),(0,r.jsx)("label",{htmlFor:"retry-blocked",children:e("exec.retryBlocked")}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)(x,{id:"retry-blocked",value:d,min:0,max:5,onChange:e=>{c(e),R(e)},disabled:!t}),(0,r.jsx)("span",{className:"muted small",children:e("exec.retryBlockedTimes")})]}),(0,r.jsx)("p",{className:"why",children:e("exec.retryBlockedWhy")}),(0,r.jsx)("label",{htmlFor:"max-iterations",children:e("exec.maxIterations")}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)(x,{id:"max-iterations",value:u,min:5,max:200,onChange:e=>{m(e),M(e)},disabled:!t}),(0,r.jsx)("span",{className:"muted small",children:e("exec.maxIterationsUnit")})]}),(0,r.jsx)("p",{className:"why",children:e("exec.maxIterationsWhy")}),(0,r.jsx)("label",{htmlFor:"max-minutes",children:e("exec.maxRunMinutes")}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)(x,{id:"max-minutes",value:p,min:10,max:1440,onChange:e=>{v(e),I(e)},disabled:!t}),(0,r.jsx)("span",{className:"muted small",children:e("exec.maxRunMinutesUnit")})]}),(0,r.jsx)("p",{className:"why",children:e("exec.maxRunMinutesWhy")}),(0,r.jsx)("label",{htmlFor:"reply-timeout",children:e("exec.replyTimeout")}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)(x,{id:"reply-timeout",value:f,min:60,max:10800,onChange:e=>{g(e),A(e)},disabled:!t}),(0,r.jsx)("span",{className:"muted small",children:e("exec.replyTimeoutUnit")})]}),(0,r.jsx)("p",{className:"why",children:e("exec.replyTimeoutWhy")}),(0,r.jsx)("label",{htmlFor:"isolation",children:e("exec.isolation")}),(0,r.jsxs)("select",{id:"isolation",value:y,onChange:e=>{let t=e.target.value;b(t),B("isolation",t)},disabled:!t,children:[(0,r.jsx)("option",{value:"none",children:e("exec.isolationNone")}),(0,r.jsx)("option",{value:"none-accepted",children:e("exec.isolationNoneAccepted")}),(0,r.jsx)("option",{value:"separate-account",children:e("exec.isolationAccount")}),(0,r.jsx)("option",{value:"sandbox",children:e("exec.isolationSandbox")}),(0,r.jsx)("option",{value:"vm",children:e("exec.isolationVm")})]}),(0,r.jsx)("p",{className:"why",children:e("exec.isolationWhy")}),(0,r.jsx)("label",{htmlFor:"start-mode",children:e("exec.startMode")}),(0,r.jsxs)("select",{id:"start-mode",value:w,onChange:e=>{let t=e.target.value;N(t),B("mode",t)},disabled:!t,children:[(0,r.jsx)("option",{value:"confirm",children:e("exec.startModeAsk")}),(0,r.jsx)("option",{value:"unattended",children:e("exec.startModeAuto")})]}),(0,r.jsx)("p",{className:"why",children:e("exec.startModeWhy")}),(0,r.jsx)("label",{htmlFor:"network-fetch",children:e("exec.networkFetch")}),(0,r.jsxs)("select",{id:"network-fetch",value:k,onChange:e=>{let t=e.target.value;S(t),B("networkFetch",t)},disabled:!t,children:[(0,r.jsx)("option",{value:"ask",children:e("exec.networkFetchAsk")}),(0,r.jsx)("option",{value:"refuse",children:e("exec.networkFetchRefuse")}),(0,r.jsx)("option",{value:"run",children:e("exec.networkFetchRun")})]}),(0,r.jsx)(j,{msg:C}),(0,r.jsx)("p",{className:"why",children:e("exec.networkFetchWhy")})]})}function b(e){var t;let{catalogue:l,setCatalogue:a,refreshModels:s,refreshing:d,refreshMsg:u}=e,{t:m}=(0,o.kj)(),h=(0,o.W3)(),[x,p]=(0,n.useState)(""),[v,f]=(0,n.useState)(""),[g,y]=(0,n.useState)(!1),b=null!=(t=null==l?void 0:l.defaultModel)?t:"",w=async e=>{y(!0),p("");try{let t=await i.FH.setDefaultModel(e);l&&a({...l,defaultModel:t.defaultModel}),p(t.defaultModel?m("def.modelSaved",{name:t.defaultModel}):m("def.modelCleared")),f("")}catch(e){f(e.message)}finally{y(!1)}};return(0,r.jsxs)("div",{className:"panel",id:"model",children:[(0,r.jsx)("h2",{children:m("def.modelTitle")}),(0,r.jsx)("p",{className:"muted small",children:m("def.modelIntro")}),v&&(0,r.jsx)("div",{className:"err",children:v}),(0,r.jsx)("label",{htmlFor:"default-model",children:m("def.modelField")}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)(c.Y,{id:"default-model",chosen:b,onChange:e=>void w(e),none:m("def.modelNone"),catalogue:l,disabled:g||d}),(0,r.jsx)("button",{className:"quiet",onClick:()=>void w(""),disabled:g||!b,children:m("proj.clear")}),(0,r.jsx)("button",{onClick:()=>void s(),disabled:g||d,children:m("model.refresh")})]}),(0,r.jsx)(j,{msg:x||u}),(0,r.jsx)("p",{className:"muted small",style:{marginTop:8},children:(null==l?void 0:l.readAt)?m("model.readAt",{t:h(l.readAt),n:l.options.length}):m("model.neverRead")}),(0,r.jsx)("h3",{children:m("proj.affects")}),(0,r.jsxs)("ul",{className:"muted small",style:{margin:0,paddingLeft:20},children:[(0,r.jsx)("li",{children:m("def.modelAffectsNew")}),(0,r.jsx)("li",{children:m("def.modelAffectsExisting")}),(0,r.jsx)("li",{children:m("def.modelAffectsBatch")})]})]})}function w(e){var t,l;let{catalogue:a,setCatalogue:d,refreshModels:u,refreshing:m,refreshMsg:h}=e,{t:x}=(0,o.kj)(),[p,v]=(0,n.useState)(""),[f,g]=(0,n.useState)(""),[y,b]=(0,n.useState)(!1),w=null!=(t=null==a?void 0:a.defaultReviewModel)?t:"",N=async e=>{b(!0),v("");try{let t=await i.FH.setDefaultReviewModel(e);a&&d({...a,defaultReviewModel:t.defaultReviewModel}),v(t.defaultReviewModel?x("def.reviewSaved",{name:t.defaultReviewModel}):x("def.reviewCleared")),g("")}catch(e){g(e.message)}finally{b(!1)}},k=""!==w&&w===(null!=(l=null==a?void 0:a.defaultModel)?l:"");return(0,r.jsxs)("div",{className:"panel",id:"review",children:[(0,r.jsx)("h2",{children:x("def.reviewTitle")}),(0,r.jsx)("p",{className:"muted small",children:x("def.reviewIntro")}),f&&(0,r.jsx)("div",{className:"err",children:f}),(0,r.jsx)("label",{htmlFor:"default-review-model",children:x("def.reviewField")}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)(c.Y,{id:"default-review-model",chosen:w,onChange:e=>void N(e),none:x("def.reviewNone"),catalogue:a,disabled:y||m}),(0,r.jsx)("button",{className:"quiet",onClick:()=>void N(""),disabled:y||!w,children:x("proj.clear")}),(0,r.jsx)("button",{onClick:()=>void u(),disabled:y||m,children:x("model.refresh")})]}),k&&(0,r.jsx)("p",{className:"why",style:{color:"var(--warn)"},children:x("def.reviewSame")}),(0,r.jsx)(j,{msg:p||h}),(0,r.jsx)("h3",{children:x("proj.affects")}),(0,r.jsxs)("ul",{className:"muted small",style:{margin:0,paddingLeft:20},children:[(0,r.jsx)("li",{children:x("def.reviewAffectsNew")}),(0,r.jsx)("li",{children:x("def.reviewAffectsExisting")}),(0,r.jsx)("li",{children:x("def.reviewAffectsBatch")})]}),(0,r.jsxs)("div",{className:"row",style:{marginTop:12},children:[(0,r.jsx)(s(),{href:"/",className:"button-link plain",children:x("proj.toSessions")}),(0,r.jsx)(s(),{href:"/import",className:"button-link quiet",children:x("proj.toImport")})]})]})}},4784:(e,t,l)=>{"use strict";l.d(t,{Y:()=>i});var r=l(3365),n=l(1521),a=l(5549),s=l(867);function i(e){var t,l;let{id:i,chosen:o,onChange:d,none:c,catalogue:u,disabled:m=!1,style:h}=e,{t:x}=(0,s.kj)(),p=function(e){let[t,l]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(void 0!==e)return;let t=!0;return a.FH.models().then(e=>{t&&l(e)}).catch(()=>void 0),()=>{t=!1}},[e]),void 0!==e?e:t}(u),j=null!=(t=null==p?void 0:p.options)?t:[],v=j.some(e=>e.name===o),f=j.filter(e=>!e.group),g=new Map;for(let e of j)e.group&&g.set(e.group,[...null!=(l=g.get(e.group))?l:[],e]);return(0,r.jsxs)("select",{id:i,value:o,onChange:e=>d(e.target.value),disabled:m,style:{width:"auto",minWidth:280,...h},children:[(0,r.jsx)("option",{value:"",children:c}),o&&!v&&(0,r.jsx)("option",{value:o,children:x("model.notInList",{name:o})}),f.map(e=>(0,r.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(x("model.unavailable")):""]},e.name)),[...g.entries()].map(e=>{let[t,l]=e;return(0,r.jsx)("optgroup",{label:t,children:l.map(e=>(0,r.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(x("model.unavailable")):""]},e.name))},t)})]})}},4969:(e,t,l)=>{"use strict";l.d(t,{V:()=>a});var r=l(1521);let n='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function a(e,t,l){(0,r.useEffect)(()=>{var r,a;if(!t)return;let s=document.activeElement instanceof HTMLElement?document.activeElement:null,i=e.current,o=null!=(a=null!=(r=null==l?void 0:l.current)?r:null==i?void 0:i.querySelector(n))?a:null;null==o||o.focus();let d=e=>{if("Tab"!==e.key||!i)return;let t=Array.from(i.querySelectorAll(n)).filter(e=>null!==e.offsetParent);if(0===t.length)return;let l=t[0],r=t[t.length-1],a=i.contains(document.activeElement);e.shiftKey&&(document.activeElement===l||!a)?(e.preventDefault(),r.focus()):e.shiftKey||document.activeElement!==r&&a||(e.preventDefault(),l.focus())};return document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d),s&&document.contains(s)&&s.focus()}},[e,t,l])}}},e=>{e.O(0,[197,867,549,347,131,358],()=>e(e.s=1896)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[810],{3256:(e,s,t)=>{Promise.resolve().then(t.bind(t,4627))},4627:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>S});var n=t(3365),a=t(1521),l=t(8197),i=t.n(l),r=t(5549),d=t(7527),c=t(4969),o=t(3523),u=t(3374),h=t(867),m=t(1910),g=t(5132);function p(){let{t:e}=(0,h.kj)(),[s,t]=(0,a.useState)(!1);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"info-dot","aria-expanded":s,"aria-label":e("row.info"),title:e("row.info"),onClick:()=>t(e=>!e),children:"i"}),s&&(0,n.jsxs)("div",{className:"notice info-panel",children:[(0,n.jsx)("strong",{children:e("row.infoTitle")}),(0,n.jsxs)("dl",{className:"small",children:[(0,n.jsx)("dt",{children:e("reg.openTask")}),(0,n.jsx)("dd",{children:e("row.infoOpenTask")}),(0,n.jsx)("dt",{children:e("save.log")}),(0,n.jsx)("dd",{children:e("save.why")}),(0,n.jsx)("dt",{children:e("home.col.chat")}),(0,n.jsx)("dd",{children:e("row.infoChat")})]}),(0,n.jsx)("div",{className:"small",style:{marginTop:6},children:e("row.infoExports")}),(0,n.jsxs)("dl",{className:"small",children:[(0,n.jsx)("dt",{children:e("reg.exportPlan")}),(0,n.jsx)("dd",{children:e("reg.exportPlanWhy")}),(0,n.jsx)("dt",{children:e("reg.exportDomain")}),(0,n.jsx)("dd",{children:e("reg.exportDomainWhy")}),(0,n.jsx)("dt",{children:e("reg.exportBot")}),(0,n.jsx)("dd",{children:e("reg.exportBotWhy")})]}),(0,n.jsx)(g.s,{text:e("row.infoWhich"),className:"small"})]})]})}function x(e){let{onChange:s}=e,{t}=(0,h.kj)(),[l,i]=(0,a.useState)(null),[c,o]=(0,a.useState)(!1),[u,m]=(0,a.useState)(""),g=(0,a.useCallback)(async()=>{try{i(await r.FH.batch())}catch(e){}},[]);(0,d.z)(g,3e3);let p=async e=>{o(!0),m("");try{"pause"===e?await r.FH.pauseBatch():"resume"===e?await r.FH.resumeBatch():await r.FH.stopBatch(),await g(),null==s||s()}catch(e){m(e.message)}finally{o(!1)}};return(null==l?void 0:l.running)?(0,n.jsxs)("div",{className:"row",style:{marginBottom:8},children:[l.pausing?(0,n.jsx)("button",{className:"primary",disabled:c,onClick:()=>void p("resume"),title:t("batch.resumeWhy"),children:t("batch.resume")}):(0,n.jsx)("button",{disabled:c||l.stopping,onClick:()=>void p("pause"),title:t("batch.pauseWhy"),children:t("batch.pause")}),(0,n.jsx)("button",{className:"danger",disabled:c||l.stopping,onClick:()=>void p("stop"),title:t("batch.stopWhy"),children:t("batch.stop")}),l.pausing&&!l.stopping&&(0,n.jsx)("span",{className:"muted small",children:t("batch.pausing")}),l.stopping&&(0,n.jsx)("span",{className:"muted small",children:t("batch.stopping")}),u&&(0,n.jsx)("span",{className:"err small",children:u})]}):null}var j=t(3041),v=t(1035),N=t(8934),k=t(4811),f=t(2876);let w=["queued","running","waiting-approval"],b=["blocked","failed","aborted","limit-reached"],y=["aborted","limit-reached"];function I(e){let{run:s}=e,{t}=(0,h.kj)(),a=s.entries.some(o.DG),l=(0,u.c)(a),i=(0,o.eZ)(s,s.entries,l);return(0,n.jsx)(n.Fragment,{children:t(i.live?"reg.runRunning":"reg.runTook",{d:(0,r.c5)(i.ms)})})}function C(e){let s=new Map,t=[];for(let n of e){if(!n.runGroup){t.push(n);continue}let e=s.get(n.runGroup.id);e?e.entries.push(n):s.set(n.runGroup.id,{...n.runGroup,entries:[n]})}let n=[...s.values()].sort((e,s)=>Date.parse(s.startedAt)-Date.parse(e.startedAt));for(let e of n)e.entries.sort((e,s)=>{var t,n;return Date.parse(null!=(t=e.startedAt)?t:e.createdAt)-Date.parse(null!=(n=s.startedAt)?n:s.createdAt)});return{runs:n,loose:t}}function S(){let{t:e}=(0,h.kj)(),s=(0,h.W3)(),[t,l]=(0,a.useState)(null),[i,c]=(0,a.useState)(""),[o,u]=(0,a.useState)(""),[m,g]=(0,a.useState)("flow"),[p,j]=(0,a.useState)(""),[v,N]=(0,a.useState)(""),[k,f]=(0,a.useState)(""),y=(0,a.useCallback)(async()=>{try{l(await r.FH.tasks()),u(new Date().toISOString()),c("")}catch(e){c(e.message)}},[]);(0,d.z)(y,6e3);let I=(0,a.useMemo)(()=>{let e=new Map;for(let s of null!=t?t:[])e.has(s.sessionId)||e.set(s.sessionId,s.sessionName);return[...e.entries()]},[t]),S=(0,a.useMemo)(()=>{let e=k.trim().toLowerCase();return(null!=t?t:[]).filter(s=>{var t,n;return(!p||s.sessionId===p)&&(!v||s.status===v)&&(!e||"".concat(s.title," ").concat(null!=(t=s.summary)?t:""," ").concat(null!=(n=s.reason)?n:""," ").concat(s.sessionName).toLowerCase().includes(e))})},[t,p,v,k]),T=(0,a.useMemo)(()=>{let e=null!=t?t:[];return{total:e.length,done:e.filter(e=>"done"===e.status).length,running:e.filter(e=>"running"===e.status||"waiting-approval"===e.status).length,open:e.filter(e=>"queued"===e.status).length,failed:e.filter(e=>b.includes(e.status)).length}},[t]),P=(0,a.useMemo)(()=>{let e=new Map;for(let n of null!=t?t:[]){var s;n.runGroup&&e.set(n.runGroup.id,(null!=(s=e.get(n.runGroup.id))?s:0)+1)}return e},[t]),G=(0,a.useMemo)(()=>C(S),[S]),O=S.filter(e=>"running"===e.status||"waiting-approval"===e.status),M=S.filter(e=>"queued"===e.status),D=[...S.filter(e=>b.includes(e.status)&&"stop"===e.sessionOnFailure&&!e.sessionRunning&&M.some(s=>s.sessionId===e.sessionId)),...M].sort((e,s)=>{var t,n;return(null!=(t=e.sessionRunOrder)?t:Number.MAX_SAFE_INTEGER)-(null!=(n=s.sessionRunOrder)?n:Number.MAX_SAFE_INTEGER)||e.position-s.position}),_=S.filter(e=>!w.includes(e.status)).sort((e,s)=>{var t,n,a,l;return Date.parse(null!=(n=null!=(t=s.finishedAt)?t:s.startedAt)?n:s.createdAt)-Date.parse(null!=(l=null!=(a=e.finishedAt)?a:e.startedAt)?l:e.createdAt)}),B=""!==p||""!==v||""!==k.trim();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("h2",{className:"grow",style:{margin:0},children:e("reg.title")}),(0,n.jsx)("span",{className:"muted small",children:o&&e("reg.updated",{t:s(o)})}),(0,n.jsx)("button",{className:"quiet",onClick:()=>void y(),children:e("reg.refresh")})]}),(0,n.jsx)("p",{className:"muted small",children:e("reg.hint")}),(0,n.jsx)(W,{sessions:I}),(0,n.jsxs)("div",{className:"counts",children:[(0,n.jsxs)("div",{className:"count",children:[(0,n.jsx)("div",{className:"n",children:T.total}),(0,n.jsx)("div",{className:"k",children:e("reg.total")})]}),(0,n.jsxs)("div",{className:"count done",children:[(0,n.jsx)("div",{className:"n",children:T.done}),(0,n.jsx)("div",{className:"k",children:e("reg.done")})]}),(0,n.jsxs)("div",{className:"count running",children:[(0,n.jsx)("div",{className:"n",children:T.running}),(0,n.jsx)("div",{className:"k",children:e("reg.runningCount")})]}),(0,n.jsxs)("div",{className:"count queued",children:[(0,n.jsx)("div",{className:"n",children:T.open}),(0,n.jsx)("div",{className:"k",children:e("reg.open")})]}),(0,n.jsxs)("div",{className:"count failed",children:[(0,n.jsx)("div",{className:"n",children:T.failed}),(0,n.jsx)("div",{className:"k",children:e("reg.failedCount")})]})]})]}),i&&(0,n.jsx)("div",{className:"panel err",children:i}),(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsxs)("div",{className:"toolbar",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"f-session",style:{margin:0},children:e("reg.filterSession")}),(0,n.jsxs)("select",{id:"f-session",value:p,onChange:e=>j(e.target.value),children:[(0,n.jsx)("option",{value:"",children:e("reg.allSessions")}),I.map(e=>{let[s,t]=e;return(0,n.jsx)("option",{value:s,children:t},s)})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"f-status",style:{margin:0},children:e("reg.filterStatus")}),(0,n.jsxs)("select",{id:"f-status",value:v,onChange:e=>N(e.target.value),children:[(0,n.jsx)("option",{value:"",children:e("reg.allStatuses")}),["queued","running","waiting-approval","done","blocked","failed","aborted","limit-reached"].map(s=>(0,n.jsx)("option",{value:s,children:e("status.".concat(s))},s))]})]}),(0,n.jsxs)("div",{className:"grow",children:[(0,n.jsx)("label",{htmlFor:"f-q",style:{margin:0},children:e("reg.search")}),(0,n.jsx)("input",{id:"f-q",type:"text",value:k,onChange:e=>f(e.target.value),placeholder:e("reg.searchPlaceholder")})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{style:{margin:0},id:"view-label",children:e("reg.viewLabel")}),(0,n.jsxs)("div",{className:"segmented",role:"group","aria-labelledby":"view-label",children:[(0,n.jsx)("button",{type:"button","aria-pressed":"flow"===m,onClick:()=>g("flow"),children:e("reg.viewFlow")}),(0,n.jsx)("button",{type:"button","aria-pressed":"runs"===m,onClick:()=>g("runs"),children:e("reg.groupBy")}),(0,n.jsx)("button",{type:"button","aria-pressed":"list"===m,onClick:()=>g("list"),children:e("reg.viewList")})]})]}),B&&(0,n.jsx)("button",{className:"quiet",onClick:()=>{j(""),N(""),f("")},children:e("reg.clear")})]}),null===t&&(0,n.jsx)("div",{className:"muted",children:e("home.loading")}),null!==t&&0===t.length&&(0,n.jsx)("div",{className:"empty",children:e("reg.none")}),null!==t&&t.length>0&&0===S.length&&(0,n.jsx)("div",{className:"empty",children:e("reg.noMatch")})]}),"list"===m&&S.length>0&&(0,n.jsx)(H,{entries:[...O,...M,..._]}),"runs"===m&&S.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("h2",{children:e("reg.runGroup")}),(0,n.jsx)("p",{className:"muted small",children:e("reg.runGroupHint")})]}),G.runs.map(e=>(0,n.jsxs)("section",{className:"panel",children:[(0,n.jsx)(R,{run:e}),(0,n.jsx)(A,{entries:e.entries,sizes:P,onChange:()=>void y()})]},e.id)),G.loose.length>0&&(0,n.jsxs)("section",{className:"panel",children:[(0,n.jsx)("h2",{children:e("reg.notInARun")}),(0,n.jsx)("p",{className:"muted small",children:e("reg.notInARunHint")}),(0,n.jsx)(A,{entries:G.loose,sizes:P,onChange:()=>void y()})]})]}),"flow"===m&&(0,n.jsxs)(n.Fragment,{children:[O.length>0&&(0,n.jsxs)("section",{className:"panel",children:[(0,n.jsx)("h2",{children:e("reg.activeNow")}),(0,n.jsx)(A,{entries:O,sizes:P,onChange:()=>void y()})]}),S.length>0&&(0,n.jsxs)("section",{className:"panel",children:[(0,n.jsx)("h2",{children:e("reg.upcoming")}),(0,n.jsx)("p",{className:"muted small",children:e("reg.upcomingHint")}),(0,n.jsx)(x,{onChange:()=>void y()}),S.some(e=>e.interrupted&&!e.sessionRunning)&&(0,n.jsxs)("div",{className:"notice caution",role:"status",children:[(0,n.jsx)("strong",{children:e("reg.interruptedTitle")})," ",e("reg.interrupted",{n:S.filter(e=>e.interrupted&&!e.sessionRunning).length})]}),(0,n.jsx)(E,{entries:S,onChange:()=>void y()}),0===D.length?(0,n.jsx)("div",{className:"empty",children:e("reg.noUpcoming")}):(0,n.jsx)(A,{entries:D,upcoming:!0,sizes:P,onChange:()=>void y()})]}),S.length>0&&(0,n.jsxs)("section",{className:"panel",children:[(0,n.jsx)("h2",{children:e("reg.past")}),(0,n.jsx)("p",{className:"muted small",children:e("reg.pastHint")}),0===_.length?(0,n.jsx)("div",{className:"empty",children:e("reg.noPast")}):(0,n.jsx)(q,{entries:_,sizes:P,onChange:()=>void y()})]}),t&&t.length>0&&(0,n.jsx)(F,{refreshKey:o})]})]})}function F(e){let{refreshKey:s}=e,{t}=(0,h.kj)(),[l,i]=(0,a.useState)(null),[d,c]=(0,a.useState)("");if((0,a.useEffect)(()=>{r.FH.metrics().then(e=>{i(e),c("")}).catch(e=>c(e.message))},[s]),!l)return d?(0,n.jsx)("div",{className:"panel err",children:d}):null;let o=e=>0===e.of?"—":"".concat(e.n," / ").concat(e.of," (").concat(Math.round(100*e.n/e.of),"%)"),u=[["metrics.tasks",e=>"".concat(e.tasks," \xb7 ").concat(t("metrics.attemptsN",{n:e.attempts}))],["metrics.firstPass",e=>o(e.firstPass)],["metrics.doneInTheEnd",e=>o(e.doneInTheEnd)],["metrics.falseCompletion",e=>o(e.falseCompletion)],["metrics.reviewRejection",e=>o(e.reviewRejection)],["metrics.repeatedCommands",e=>o(e.repeatedCommands)],["metrics.noProgress",e=>o(e.noProgress)],["metrics.scopeViolation",e=>o(e.scopeViolation)],["metrics.unrelatedDiff",e=>o(e.unrelatedDiff)],["metrics.resumed",e=>o(e.resumed)],["metrics.freshRetries",e=>String(e.freshRetries)],["metrics.manual",e=>String(e.manualInterventions)],["metrics.ended",e=>Object.entries(e.ended).map(e=>{let[s,n]=e;return"".concat(t("status.".concat(s))," ").concat(n)}).join(", ")||"—"]],m=l.rows[0];return(0,n.jsxs)("section",{className:"panel metrics",children:[(0,n.jsx)("h2",{children:t("metrics.title")}),(0,n.jsx)("p",{className:"muted small",children:t("metrics.hint")}),m&&m.withStats<m.attempts&&(0,n.jsx)("p",{className:"muted small",children:t("metrics.olderAttempts",{n:m.attempts-m.withStats})}),(0,n.jsx)("div",{className:"table-scroll",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:t("metrics.col.measure")}),l.rows.map(e=>(0,n.jsx)("th",{children:"all"===e.group?t("metrics.col.all"):e.group},e.group))]})}),(0,n.jsx)("tbody",{children:u.map(e=>{let[s,a]=e;return(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{children:t(s)}),l.rows.map(e=>(0,n.jsx)("td",{children:a(e)},e.group))]},s)})})]})})]})}function A(e){let{entries:s,upcoming:t=!1,sizes:l,onChange:d,picking:c}=e,{t:x}=(0,h.kj)(),v=(0,h.W3)(),k=(0,j.e)(null!=d?d:()=>void 0),w=(0,u.c)(s.some(o.DG)),[y,I]=(0,a.useState)(null),[C,S]=(0,a.useState)(new Set);return(0,n.jsxs)(n.Fragment,{children:[y&&(0,n.jsx)(P,{entry:y,onClose:e=>{I(null),e&&(null==d||d())}}),(0,n.jsx)("ol",{className:"flow",children:s.map(e=>{var s,a,d,u,h,j,y,F,A,R,q,P,W,E,H,G,O,M,D,_,B,z,L,U,X;let V=t&&1===e.queuePosition,Z=e.runGroup?null!=(F=null==l?void 0:l.get(e.runGroup.id))?F:1:0;return(0,n.jsxs)("li",{className:"".concat(e.status).concat(V?" next":""),children:[(0,n.jsxs)("div",{className:"head",children:[c&&(0,n.jsx)("input",{type:"checkbox",className:"pick","aria-label":e.title,checked:c.picked.has("".concat(e.sessionId,":").concat(e.taskId)),onChange:()=>c.toggle("".concat(e.sessionId,":").concat(e.taskId))}),(0,n.jsx)("strong",{children:e.title}),(0,n.jsx)("span",{className:"badge ".concat(e.status),children:x("status.".concat(e.status))}),V&&(0,n.jsx)("span",{className:"chip",children:x("reg.next")}),t&&b.includes(e.status)&&(0,n.jsx)("span",{className:"chip",title:x("reg.willRequeueFirstWhy"),children:x("reg.willRequeueFirst")}),e.sessionRunning&&(0,n.jsx)("span",{className:"chip",children:x("reg.sessionRunning")}),e.review&&"skipped"!==e.review.verdict&&(0,n.jsxs)("span",{className:"badge ".concat("pass"===e.review.verdict?"done":"fail"===e.review.verdict?"blocked":"waiting-approval"),title:e.review.stepsRun>0?x("review.ran",{n:e.review.stepsRun}):void 0,children:[x("review.verdict.".concat(e.review.verdict)),e.review.findings>0?" (".concat(e.review.findings,")"):""]}),(null!=(A=e.deviations)?A:0)>0&&(0,n.jsx)("span",{className:"badge waiting-approval",title:x("reg.deviationsWhy"),children:x("reg.deviations",{n:null!=(R=e.deviations)?R:0})}),(null!=(q=e.disputes)?q:0)>0&&(0,n.jsx)("span",{className:"badge waiting-approval",title:x("reg.disputesWhy"),children:x("reg.disputes",{n:null!=(P=e.disputes)?P:0})}),e.readOnly&&(0,n.jsx)("span",{className:"chip",title:x("reg.readOnlyWhy"),children:x("task.readOnly")}),(null!=(W=null==(s=e.scope)?void 0:s.length)?W:0)>0&&(0,n.jsx)("span",{className:"chip",title:x("task.scopeWhy"),children:x("task.scope",{paths:(null!=(E=e.scope)?E:[]).join(", ")})}),(null!=(H=e.autoRetries)?H:0)>0&&(0,n.jsx)("span",{className:"badge ".concat("done"===e.status?"done":"blocked"),title:x("reg.retriedFreshWhy"),children:"done"===e.status?x("reg.retriedFreshDone",{n:null!=(G=e.autoRetries)?G:0}):x("reg.retriedFreshStill",{n:null!=(O=e.autoRetries)?O:0})}),e.runGroup&&(0,n.jsx)("span",{className:"chip",title:x("reg.runTitle",{t:Z,s:e.runGroup.sessions,when:v(e.runGroup.startedAt)}),children:Z>1?x("reg.runWith",{n:Z-1}):x("reg.runAlone")})]}),(0,n.jsxs)("div",{className:"when",children:[(0,n.jsx)(i(),{href:(0,r.aT)(e.sessionId),children:e.sessionName})," \xb7 ",e.startedAt?x("task.started",{t:v(e.startedAt)}):x("task.added",{t:v(e.createdAt)}),e.finishedAt?" \xb7 ".concat(x("task.finished",{t:v(e.finishedAt)})):"",void 0!==e.durationMs?" \xb7 ".concat(x("reg.took",{d:(0,r.c5)(e.durationMs)})):"",(0,o.DG)(e)?" \xb7 ".concat(x("task.runningFor",{d:(0,r.c5)((0,o.d5)(e.startedAt,void 0,w))})):"",e.iterations>0?" \xb7 ".concat(x("reg.iterations",{n:e.iterations})):""]}),"queued"===e.status&&(0,n.jsx)("div",{className:"when",children:e.queuePosition&&e.queuePosition>1?x("reg.willFollow",{n:e.queuePosition-1}):e.sessionRunning?x("reg.queuePos",{n:null!=(M=e.queuePosition)?M:1}):x("reg.waitingRun")}),"blocked"===e.status&&(0,n.jsx)("p",{className:"what muted small",children:x("reg.blockedWhat")}),(null!=(D=null==(a=e.attempts)?void 0:a.length)?D:0)>0&&(0,n.jsxs)("details",{className:"small",style:{marginTop:6},children:[(0,n.jsx)("summary",{children:(null!=(_=null==(d=e.attempts)?void 0:d.length)?_:0)===1?x("reg.attemptsOne",{n:null!=(z=e.attempt)?z:(null!=(B=null==(u=e.attempts)?void 0:u.length)?B:0)+1}):x("reg.attempts",{n:null!=(U=e.attempt)?U:(null!=(L=null==(h=e.attempts)?void 0:h.length)?L:0)+1,m:null!=(X=null==(j=e.attempts)?void 0:j.length)?X:0})}),(0,n.jsx)("ol",{className:"attempts",children:null==(y=e.attempts)?void 0:y.map(s=>{var t;return(0,n.jsxs)("li",{children:[(0,n.jsxs)("div",{className:"head",children:[(0,n.jsx)("strong",{children:x("reg.attemptN",{n:s.attempt})}),(0,n.jsx)("span",{className:"badge ".concat(s.status),children:x("status.".concat(s.status))}),s.iterations>0&&(0,n.jsx)("span",{className:"muted",children:x("reg.iterations",{n:s.iterations})}),void 0!==s.durationMs&&(0,n.jsx)("span",{className:"muted",children:x("reg.took",{d:(0,r.c5)(s.durationMs)})}),s.runId&&(0,n.jsx)(m.u,{label:x("save.attemptLog"),save:()=>r.FH.saveTaskLog(e.sessionId,e.taskId,s.runId)}),s.runId&&(0,n.jsx)(m.H,{sessionId:e.sessionId,taskId:e.taskId,attempt:s.attempt}),s.runId&&void 0!==s.changedFiles&&(0,n.jsx)(N.C,{sessionId:e.sessionId,taskId:e.taskId,runId:s.runId,title:"".concat(e.title," — ").concat(x("reg.attemptN",{n:s.attempt})),files:s.changedFiles})]}),(0,n.jsxs)("div",{className:"when",children:[s.startedAt?x("task.started",{t:v(s.startedAt)}):"",s.finishedAt?" \xb7 ".concat(x("task.finished",{t:v(s.finishedAt)})):"",s.branch?" \xb7 ".concat(s.branch):""]}),s.reason&&(0,n.jsx)("p",{className:"what err",children:x("reg.stopped",{reason:s.reason})}),s.summary&&(0,n.jsx)(g.s,{text:s.summary,className:"what"})]},"".concat(null!=(t=s.runId)?t:s.attempt))})})]}),e.summary&&(0,n.jsx)(g.s,{text:e.summary,className:"what"}),e.reason&&(0,n.jsx)("p",{className:"what err",children:x("reg.stopped",{reason:e.reason})}),k.message&&k.messageTask===e.taskId&&(0,n.jsx)("p",{className:"what small",children:k.message}),(0,n.jsxs)("div",{className:"row small",style:{marginTop:6},children:[(0,n.jsx)(i(),{href:(0,r.aT)(e.sessionId,e.taskId),children:x("reg.openTask")}),e.runId&&(0,n.jsx)(m.u,{label:x("save.log"),save:()=>r.FH.saveTaskLog(e.sessionId,e.taskId)}),e.chatUrl&&(0,n.jsx)("a",{href:e.chatUrl,target:"_blank",rel:"noreferrer",children:x("home.col.chat")}),e.startedAt&&(0,n.jsx)(T,{where:{session:e.sessionId,task:e.taskId}}),void 0!==e.changedFiles&&(0,n.jsx)(N.C,{sessionId:e.sessionId,taskId:e.taskId,title:e.title,files:e.changedFiles}),(0,n.jsx)(p,{}),e.runId&&(0,n.jsxs)("button",{className:C.has(e.taskId)?"":"quiet","aria-expanded":C.has(e.taskId),onClick:()=>{let s;return s=e.taskId,S(e=>{let t=new Set(e);return t.has(s)?t.delete(s):t.add(s),t})},title:(0,o.DG)(e)?x("story.showLiveWhy"):x("story.why"),children:[(0,o.DG)(e)&&!C.has(e.taskId)&&(0,n.jsx)("span",{className:"dot","aria-hidden":"true"}),C.has(e.taskId)?x("story.hide"):(0,o.DG)(e)?x("story.showLive"):x("story.show")]}),b.includes(e.status)&&!e.sessionRunning&&(0,n.jsx)("button",{className:"quiet",onClick:()=>I(e),title:x("reg.fixPromptHint"),children:x("reg.fixPrompt")}),"done"===e.status&&!e.sessionRunning&&(0,n.jsx)("button",{className:"quiet",onClick:()=>I(e),title:x("reg.newPromptHint"),children:x("reg.newPrompt")}),e.startedAt&&!e.sessionRunning&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{className:"quiet",disabled:""!==k.busy,title:x("restore.why"),onClick:()=>void k.restore({sessionId:e.sessionId,taskId:e.taskId,title:e.title}),children:"restore"===k.busy?x("restore.checking"):x("restore.button")}),(0,n.jsx)("button",{className:"quiet",disabled:""!==k.busy,title:x("restart.why"),onClick:()=>void k.restartFrom({sessionId:e.sessionId,taskId:e.taskId,title:e.title}),children:"restart"===k.busy?x("restart.checking"):x("restart.button")})]})]}),C.has(e.taskId)&&e.runId&&(0,n.jsx)(f.P,{sessionId:e.sessionId,taskId:e.taskId,live:"running"===e.status||"waiting-approval"===e.status})]},"".concat(e.sessionId,"-").concat(e.taskId))})})]})}function T(e){let{where:s}=e,{t}=(0,h.kj)();return(0,n.jsxs)("span",{className:"exports",title:t("reg.exportTitle"),children:[(0,n.jsxs)("span",{className:"muted",children:[t("reg.exportTitle"),":"]})," ",(0,n.jsx)("a",{href:r.FH.exportUrl("plan",s),title:t("reg.exportPlanWhy"),children:t("reg.exportPlan")})," \xb7 ",(0,n.jsx)("a",{href:r.FH.exportUrl("domain",s),title:t("reg.exportDomainWhy"),children:t("reg.exportDomain")})," \xb7 ",(0,n.jsx)("a",{href:r.FH.exportUrl("bot",s),title:t("reg.exportBotWhy"),children:t("reg.exportBot")})]})}function R(e){var s;let{run:t}=e,{t:a}=(0,h.kj)(),l=(0,h.W3)(),i=null!=(s=t.entries.map(e=>{var s;return null==(s=e.runGroup)?void 0:s.name}).find(Boolean))?s:a("reg.runUnnamed"),r=t.entries.filter(e=>"done"===e.status).length,d=t.entries.filter(e=>b.includes(e.status)).length;return(0,n.jsxs)("div",{className:"run-heading",children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("h2",{className:"grow",style:{margin:0},children:i}),(0,n.jsxs)("span",{className:"muted small",children:[a("reg.runOf",{t:t.entries.length,s:t.sessions})," \xb7 ",a("reg.runAt",{when:l(t.startedAt)})," \xb7 ",(0,n.jsx)(I,{run:t})]})]}),(0,n.jsxs)("div",{className:"row small",style:{marginTop:4},children:[(0,n.jsx)("span",{className:"badge ".concat(d>0?"failed":r===t.entries.length?"done":""),children:a("reg.runCounts",{done:r,failed:d})}),(0,n.jsx)(T,{where:{run:t.id}})]})]})}function q(e){let{entries:s,sizes:t,onChange:l}=e,{t:i}=(0,h.kj)(),d=(0,a.useMemo)(()=>C(s),[s]),[c,o]=(0,a.useState)(!1),[u,m]=(0,a.useState)(new Set),[g,p]=(0,a.useState)(!1),[x,j]=(0,a.useState)(""),[v,N]=(0,a.useState)(""),k=e=>"".concat(e.sessionId,":").concat(e.taskId),f=s.filter(e=>e.startedAt),w=[...u],b=async()=>{p(!0),N(""),j("");try{let e=await r.FH.downloadBundle(w.map(e=>{let[s,t]=e.split(":");return{sessionId:s,taskId:t}}));j(i("reg.bundleSaved",{name:e}))}catch(e){N(e.message)}finally{p(!1)}},y=c?{picked:u,toggle:e=>m(s=>{let t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})}:void 0;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"row small",style:{marginBottom:8},children:[c?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{className:"quiet",onClick:()=>{o(!1),m(new Set),j(""),N("")},children:i("reg.pickDone")}),(0,n.jsx)("button",{className:"quiet",onClick:()=>m(new Set(f.map(k))),children:i("reg.pickAll")}),(0,n.jsx)("button",{className:"quiet",onClick:()=>m(new Set),children:i("reg.pickNone")}),(0,n.jsx)("span",{className:"muted",children:u.size>0?i("reg.pickedN",{n:u.size}):i("reg.pickedNone")}),u.size>0&&(0,n.jsx)("button",{className:"primary",disabled:g,onClick:()=>void b(),title:i("reg.bundleWhy"),children:i("reg.bundle",{n:u.size})})]}):(0,n.jsx)("button",{className:"quiet",onClick:()=>o(!0),title:i("reg.pickWhy"),children:i("reg.pick")}),x&&(0,n.jsx)("span",{className:"muted",children:x}),v&&(0,n.jsx)("span",{className:"err",children:v})]}),d.runs.map((e,s)=>(0,n.jsxs)("details",{className:"run-fold",open:0===s||c,children:[(0,n.jsx)("summary",{children:(0,n.jsx)(R,{run:e})}),(0,n.jsx)(A,{entries:e.entries,sizes:t,onChange:l,picking:y})]},e.id)),d.loose.length>0&&(0,n.jsxs)("details",{className:"run-fold",open:0===d.runs.length||c,children:[(0,n.jsx)("summary",{children:(0,n.jsxs)("div",{className:"run-heading",children:[(0,n.jsx)("h2",{style:{margin:0},children:i("reg.notInARun")}),(0,n.jsx)("p",{className:"muted small",style:{margin:"4px 0 0"},children:i("reg.notInARunHint")})]})}),(0,n.jsx)(A,{entries:d.loose,sizes:t,onChange:l,picking:y})]})]})}function P(e){let{entry:s,onClose:t}=e,{t:l}=(0,h.kj)(),[i,d]=(0,a.useState)(null),[o,u]=(0,a.useState)(""),[m,g]=(0,a.useState)(!1),p=(0,a.useRef)(null);(0,c.V)(p,!0),(0,a.useEffect)(()=>{let e=e=>{"Escape"!==e.key||m||t(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[m,t]),(0,a.useEffect)(()=>{let e=!0;return r.FH.session(s.sessionId).then(t=>{var n;let a=t.tasks.find(e=>e.id===s.taskId);e&&d(null!=(n=null==a?void 0:a.prompt)?n:"")}).catch(s=>{e&&u(s.message)}),()=>{e=!1}},[s.sessionId,s.taskId]);let x=async()=>{if(null!==i){g(!0),u("");try{await r.FH.rerunTask(s.sessionId,s.taskId,{prompt:i},{buildOnFinished:"done"===s.status}),u(l("reg.fixPromptSaved",{title:s.title})),setTimeout(()=>t(!0),900)}catch(e){u(e.message),g(!1)}}};return(0,n.jsx)("div",{className:"modal-backdrop",role:"presentation",onClick:()=>t(!1),children:(0,n.jsxs)("div",{ref:p,className:"modal wide",role:"dialog","aria-modal":"true","aria-labelledby":"fix-title",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{id:"fix-title",children:l("reg.fixPromptTitle",{title:s.title})}),(0,n.jsx)("p",{className:"muted small",children:l("done"===s.status?"reg.newPromptHint":"reg.fixPromptHint")}),s.reason&&(0,n.jsx)("p",{className:"what err small",children:l("reg.stopped",{reason:s.reason})}),null===i?(0,n.jsx)("p",{className:"muted small",children:o||l("reg.fixPromptLoading")}):(0,n.jsx)("textarea",{className:"prose","aria-labelledby":"fix-title",value:i,onChange:e=>d(e.target.value),style:{minHeight:260},disabled:m}),(0,n.jsxs)("div",{className:"row modal-actions",children:[o&&null!==i&&(0,n.jsx)("span",{className:"small grow",children:o}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>t(!1),disabled:m,children:l("dialog.cancel")}),(0,n.jsx)("button",{type:"button",className:"primary",onClick:()=>void x(),disabled:m||null===i||!i.trim(),children:l("reg.fixPromptSave")})]})]})})}function W(e){let{sessions:s}=e,{t}=(0,h.kj)();return(0,n.jsxs)("div",{className:"row",style:{margin:"14px 0 18px"},children:[(0,n.jsx)(i(),{href:"/#new-session",className:"button-link",children:t("reg.newSession")}),s.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("label",{htmlFor:"new-task-session",style:{margin:0},children:[t("reg.newTask")," ",t("reg.newTaskIn")]}),(0,n.jsxs)("select",{id:"new-task-session",value:"",onChange:e=>{e.target.value&&(window.location.href=(0,r.aT)(e.target.value,"new-task"))},style:{width:"auto",minWidth:200},children:[(0,n.jsx)("option",{value:"",children:t("reg.newTaskPick")}),s.map(e=>{let[s,t]=e;return(0,n.jsx)("option",{value:s,children:t},s)})]})]})]})}function E(e){let{entries:s,onChange:t}=e,{t:l}=(0,h.kj)(),[i,d]=(0,a.useState)(!1),[c,o]=(0,a.useState)(""),[u,m]=(0,a.useState)(!1),[g,p]=(0,a.useState)(new Set),[x,j]=(0,a.useState)(null),N=s.filter(e=>"queued"===e.status),f=s.filter(e=>b.includes(e.status)&&!e.sessionRunning),w=s.some(e=>e.sessionRunning),I=f.filter(e=>"stop"===e.sessionOnFailure),C=f.filter(e=>"stop"!==e.sessionOnFailure),S=[...N,...f],F=S.filter(e=>g.has(e.taskId)),A=f.filter(e=>g.has(e.taskId)),T=N.filter(e=>g.has(e.taskId)),R=[...new Set([...F].sort((e,s)=>{var t,n;return(null!=(t=e.sessionRunOrder)?t:Number.MAX_SAFE_INTEGER)-(null!=(n=s.sessionRunOrder)?n:Number.MAX_SAFE_INTEGER)||e.position-s.position}).map(e=>e.sessionId))],q=F.filter(e=>"stop"===e.sessionOnFailure).map(e=>({e,before:S.find(s=>s.sessionId===e.sessionId&&s.position<e.position&&!g.has(s.taskId))})).filter(e=>!!e.before),[W,E]=(0,a.useState)(""),H=I.length>0?l("reg.continueWithFailed",{f:I.length,n:N.length,s:R.length}):l("reg.continue",{n:N.length,s:R.length}),G=(0,k.p)(),O=async e=>{if("unattended"!==e||G||await (0,v.Z)(l("batch.unattendedConfirm",{n:R.length}))){d(!0),o("");try{var s;for(let e of A)y.includes(e.status)?await r.FH.continueTask(e.sessionId,e.taskId):await r.FH.rerunTask(e.sessionId,e.taskId);let n=await r.FH.startBatch(R,e,"stop",void 0,void 0,W.trim()||void 0,F.map(e=>e.taskId));o(n.started?l("reg.continueStarted",{n:R.length}):l("batch.notStarted",{reason:null!=(s=n.reason)?s:""})),m(!1),t()}catch(e){o(e.message)}finally{d(!1)}}};return 0===N.length&&0===f.length?null:(0,n.jsxs)("div",{style:{marginBottom:8},children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("button",{className:"primary",disabled:i||w,onClick:()=>{p(new Set(S.map(e=>e.taskId))),m(!0),o("");let e=[...new Set([...S].sort((e,s)=>{var t,n;return(null!=(t=e.sessionRunOrder)?t:Number.MAX_SAFE_INTEGER)-(null!=(n=s.sessionRunOrder)?n:Number.MAX_SAFE_INTEGER)||e.position-s.position}).map(e=>e.sessionId))];r.FH.suggestedRunName(e).then(e=>E(e.name)).catch(()=>void 0)},title:l("reg.continueWhy"),children:H}),w&&(0,n.jsx)("span",{className:"muted small",children:l("reg.continueRunning")}),c&&(0,n.jsx)("span",{className:"small",children:c})]}),u&&!w&&(0,n.jsxs)("div",{className:"notice",style:{marginTop:8},children:[(0,n.jsx)("strong",{children:l("reg.continuePanelTitle")}),(0,n.jsxs)("div",{className:"row small",style:{marginTop:6},children:[(0,n.jsx)("button",{className:"quiet small",onClick:()=>p(new Set(S.map(e=>e.taskId))),children:l("reg.pickAll")}),(0,n.jsx)("button",{className:"quiet small",onClick:()=>p(new Set),children:l("reg.pickNone")})]}),[{key:"chain",entries:I,intro:l("reg.continueChain"),fix:!0},{key:"loose",entries:C,intro:l("reg.continueIndependent"),fix:!0},{key:"queued",entries:N,intro:l("reg.continueQueued"),fix:!1}].filter(e=>e.entries.length>0).map(e=>(0,n.jsxs)("div",{style:{marginTop:6},children:[(0,n.jsx)("div",{className:"small",children:e.intro}),(0,n.jsx)("ul",{className:"small",style:{margin:"4px 0",paddingLeft:18,listStyle:"none"},children:e.entries.map(s=>(0,n.jsxs)("li",{children:[(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:g.has(s.taskId),onChange:e=>{let t,n;return t=s.taskId,n=e.target.checked,p(e=>{let s=new Set(e);return n?s.add(t):s.delete(t),s})}}),(0,n.jsx)("strong",{children:s.title})," \xb7 ",s.sessionName," \xb7 ",(0,n.jsx)("span",{className:"badge ".concat(s.status),children:l("status.".concat(s.status))}),y.includes(s.status)&&(0,n.jsxs)("span",{className:"muted small",children:[" \xb7 ",l("reg.willContinue")]})]})," ",(0,n.jsx)("button",{className:"quiet small",onClick:()=>p(new Set([s.taskId])),title:l("reg.pickOnlyWhy"),children:l("reg.pickOnly")}),e.fix&&(0,n.jsxs)(n.Fragment,{children:[" ",(0,n.jsx)("button",{className:"quiet small",onClick:()=>j(s),title:l("reg.fixPromptHint"),children:l("reg.fixPrompt")})]})]},s.taskId))})]},e.key)),q.length>0&&(0,n.jsx)("div",{className:"notice caution small",style:{marginTop:6},children:q.map(e=>(0,n.jsx)("div",{children:l("reg.continueGap",{task:e.e.title,before:e.before.title,session:e.e.sessionName})},e.e.taskId))}),(0,n.jsxs)("div",{style:{marginTop:8},children:[(0,n.jsx)("label",{htmlFor:"continue-run-name",children:l("batch.runName")}),(0,n.jsx)("input",{id:"continue-run-name",type:"text",value:W,onChange:e=>E(e.target.value),placeholder:l("batch.runNamePlaceholder"),disabled:i}),(0,n.jsx)("p",{className:"why",children:l("reg.continueNameWhy")})]}),(0,n.jsx)("div",{className:"small",style:{marginTop:6},children:l("reg.continueSummary",{q:T.length,r:A.length,s:R.length})}),(0,n.jsxs)("div",{className:"row",style:{marginTop:8},children:[(0,n.jsx)("button",{className:"primary",disabled:i||0===R.length,onClick:()=>void O("unattended"),title:l("reg.continueUnattendedWhy"),children:l("reg.continueUnattended")}),(0,n.jsx)("button",{disabled:i||0===R.length,onClick:()=>void O("confirm"),title:l("reg.continueWhy"),children:l("reg.continueGo")}),(0,n.jsx)("button",{className:"quiet",disabled:i,onClick:()=>m(!1),children:l("dialog.cancel")})]})]}),x&&(0,n.jsx)(P,{entry:x,onClose:e=>{j(null),e&&t()}})]})}function H(e){let{entries:s}=e,{t}=(0,h.kj)(),a=(0,h.W3)();return(0,n.jsx)("div",{className:"panel",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:t("reg.col.task")}),(0,n.jsx)("th",{children:t("reg.col.session")}),(0,n.jsx)("th",{children:t("reg.col.status")}),(0,n.jsx)("th",{children:t("reg.col.started")}),(0,n.jsx)("th",{children:t("reg.col.took")}),(0,n.jsx)("th",{children:t("reg.col.result")})]})}),(0,n.jsx)("tbody",{children:s.map(e=>{var s;return(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{children:(0,n.jsx)(i(),{href:(0,r.aT)(e.sessionId,e.taskId),children:e.title})}),(0,n.jsx)("td",{children:(0,n.jsx)(i(),{href:(0,r.aT)(e.sessionId),children:e.sessionName})}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"badge ".concat(e.status),children:t("status.".concat(e.status))})}),(0,n.jsx)("td",{className:"muted small",children:e.startedAt?a(e.startedAt):"—"}),(0,n.jsx)("td",{className:"muted small",children:(0,r.c5)(e.durationMs)||"—"}),(0,n.jsx)("td",{className:"small",children:null!=(s=e.summary)?s:e.reason?(0,n.jsx)("span",{className:"err",children:e.reason}):"—"})]},"".concat(e.sessionId,"-").concat(e.taskId))})})]})})}}},e=>{e.O(0,[197,867,549,373,347,131,358],()=>e(e.s=3256)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[322],{1035:(e,a,n)=>{"use strict";n.d(a,{DialogHost:()=>d,Z:()=>o});var l=n(3365),s=n(1521),t=n(867),i=n(4969);let r=null,c=[];function o(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(n=>{var l;return l={kind:"confirm",message:e,...a,resolve:n},void(r?r(l):c.push(l))})}function d(e){var a,n;let{children:o}=e,{t:d}=(0,t.kj)(),[m,p]=(0,s.useState)([]),u=(0,s.useRef)(null),h=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(r=e=>p(a=>[...a,e]),c.length>0){let e=c.splice(0,c.length);p(a=>[...a,...e])}return()=>{r=null}},[]);let x=m[0],j=(0,s.useCallback)(e=>{x&&(x.resolve(e),p(e=>e.slice(1)))},[x]);return(0,i.V)(h,!!x,u),(0,s.useEffect)(()=>{if(!x)return;let e=e=>{"Escape"===e.key&&(e.preventDefault(),j(!1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[x,j]),(0,l.jsxs)(l.Fragment,{children:[o,x&&(0,l.jsx)("div",{className:"modal-backdrop",onClick:()=>j(!1),role:"presentation",children:(0,l.jsxs)("div",{ref:h,className:"modal".concat(x.danger?" danger":""),role:"confirm"===x.kind?"alertdialog":"dialog","aria-modal":"true","aria-labelledby":"modal-title","aria-describedby":"modal-body",onClick:e=>e.stopPropagation(),children:[(0,l.jsx)("h2",{id:"modal-title",children:null!=(a=x.title)?a:d("confirm"===x.kind?"dialog.confirmTitle":"dialog.noticeTitle")}),(0,l.jsx)("div",{id:"modal-body",className:"modal-body",children:x.message}),(0,l.jsxs)("div",{className:"row modal-actions",children:["confirm"===x.kind&&(0,l.jsx)("button",{type:"button",className:"quiet",onClick:()=>j(!1),children:d("dialog.cancel")}),(0,l.jsx)("button",{ref:u,type:"button",className:x.danger?"danger":"primary",onClick:()=>j(!0),children:null!=(n=x.okLabel)?n:d("dialog.ok")})]})]})})]})}},4969:(e,a,n)=>{"use strict";n.d(a,{V:()=>t});var l=n(1521);let s='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function t(e,a,n){(0,l.useEffect)(()=>{var l,t;if(!a)return;let i=document.activeElement instanceof HTMLElement?document.activeElement:null,r=e.current,c=null!=(t=null!=(l=null==n?void 0:n.current)?l:null==r?void 0:r.querySelector(s))?t:null;null==c||c.focus();let o=e=>{if("Tab"!==e.key||!r)return;let a=Array.from(r.querySelectorAll(s)).filter(e=>null!==e.offsetParent);if(0===a.length)return;let n=a[0],l=a[a.length-1],t=r.contains(document.activeElement);e.shiftKey&&(document.activeElement===n||!t)?(e.preventDefault(),l.focus()):e.shiftKey||document.activeElement!==l&&t||(e.preventDefault(),n.focus())};return document.addEventListener("keydown",o),()=>{document.removeEventListener("keydown",o),i&&document.contains(i)&&i.focus()}},[e,a,n])}},5515:(e,a,n)=>{Promise.resolve().then(n.bind(n,9262))},9262:(e,a,n)=>{"use strict";n.r(a),n.d(a,{default:()=>d});var l=n(3365),s=n(1521),t=n(8197),i=n.n(t),r=n(5549),c=n(1035),o=n(867);function d(){var e,a;let{t:n,locale:t}=(0,o.kj)(),d=(0,o.W3)(),[m,u]=(0,s.useState)(""),[h,x]=(0,s.useState)(""),[j,v]=(0,s.useState)(!1),[g,f]=(0,s.useState)(""),[y,k]=(0,s.useState)(""),[b,N]=(0,s.useState)(0),[w,C]=(0,s.useState)(""),[S,T]=(0,s.useState)(!1),[E,H]=(0,s.useState)(null),[F,L]=(0,s.useState)(""),[P,D]=(0,s.useState)(""),R=(0,s.useRef)(null),[A,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{let e=!1;return r.FH.planBrief(t).then(a=>{e||(u(a.text),x(a.software),k(""))}).catch(a=>{e||k(a.message)}),()=>{e=!0}},[t,b]);let O=(0,s.useCallback)(async(e,a)=>{try{await navigator.clipboard.writeText(a),f(e),window.setTimeout(()=>f(""),2500)}catch(e){D(n("plan.copyFailed"))}},[n]),W=(0,s.useCallback)(async e=>{if(e.size>2097152)return void D(n("plan.fileTooBig",{size:"".concat(Math.round(e.size/1024)," KB")}));try{C(await e.text()),H(null),B(null),D("")}catch(e){D(n("plan.fileError",{reason:e.message}))}},[n]),q=async()=>{L("check"),D("");try{H(await r.FH.checkPlan(w))}catch(e){D(e.message)}finally{L("")}},Z=async()=>{var e;let a=null!=E?E:await r.FH.checkPlan(w).catch(()=>null),l=a&&!a.ok?[]:null!=(e=null==a?void 0:a.duplicates)?e:[];if(l.length>0){let e=l.map(e=>"• ".concat(e.name," (").concat(e.tasks,")")).join("\n");if(!await (0,c.Z)(n("plan.duplicateConfirm",{names:e})))return}L("import"),D("");try{let e=await r.FH.importPlan(w);e.ok?(B(e),H({ok:!0,warnings:e.result.warnings,summary:e.summary,duplicates:e.duplicates}),C("")):(B(null),H(e.check))}catch(e){D(e.message)}finally{L("")}},_=(E&&!E.ok?E.issues:[]).map(e=>e.path?"- ".concat(e.path,": ").concat(e.message):"- ".concat(e.message)).join("\n");return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsx)("h2",{children:n("plan.title")}),(0,l.jsx)("p",{className:"muted small",children:n("plan.intro")})]}),(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsx)("h2",{children:n("plan.step1")}),(0,l.jsx)("p",{className:"muted small",children:n("plan.step1Hint")}),(0,l.jsx)("h3",{children:n("plan.briefAsks")}),(0,l.jsx)("p",{className:"why",children:n("plan.briefAsksWhy")}),m.length>116e3&&(0,l.jsx)("div",{className:"notice caution",role:"status",style:{marginTop:12},children:n("plan.briefTooLong",{n:m.length.toLocaleString(),limit:116e3.toLocaleString()})}),(0,l.jsxs)("div",{className:"row",style:{marginTop:12},children:[(0,l.jsx)("button",{className:m.length>116e3?"":"primary",onClick:()=>void O("brief",m),disabled:!m,children:n("plan.copyBrief")}),(0,l.jsx)("button",{className:m.length>116e3?"primary":"",onClick:()=>(function(e,a){let n=URL.createObjectURL(new Blob([e],{type:"text/plain;charset=utf-8"})),l=document.createElement("a");l.href=n,l.download="copilot-operator-brief.".concat(a,".txt"),document.body.appendChild(l),l.click(),l.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e4)})(m,t),disabled:!m,children:n("plan.saveBrief")}),"brief"===g&&(0,l.jsx)("span",{className:"badge done",children:n("plan.copied")}),(0,l.jsx)("span",{className:"muted small",children:n("plan.briefLang")})]}),m.length>116e3&&(0,l.jsxs)("div",{className:"row",style:{marginTop:8},children:[(0,l.jsx)("button",{onClick:()=>void O("briefNote",n("plan.briefFileMessage")),children:n("plan.copyBriefNote")}),"briefNote"===g&&(0,l.jsx)("span",{className:"badge done",children:n("plan.copied")}),(0,l.jsx)("span",{className:"muted small",children:n("plan.briefFileMessage")})]}),y&&(0,l.jsx)("div",{className:"err",children:y}),(0,l.jsx)("h3",{style:{marginTop:16},children:n("plan.persona")}),(0,l.jsx)("p",{className:"why",children:n("plan.personaWhy")}),(0,l.jsxs)("details",{style:{marginTop:8},open:j,onToggle:e=>v(e.target.open),children:[(0,l.jsx)("summary",{children:n("plan.softwarePart")}),(0,l.jsx)("textarea",{readOnly:!0,value:h,style:{minHeight:380,marginTop:10}})]}),(0,l.jsx)(p,{kind:"organisation",onSaved:()=>N(e=>e+1)}),(0,l.jsx)(p,{kind:"persona",onSaved:()=>N(e=>e+1)}),(0,l.jsx)(p,{kind:"work",onSaved:()=>N(e=>e+1)})]}),(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsx)("h2",{children:n("plan.step2")}),(0,l.jsx)("p",{className:"muted small",children:n("plan.step2Hint")}),(0,l.jsxs)("div",{className:"dropzone".concat(S?" active":""),onDragOver:e=>{e.preventDefault(),T(!0)},onDragLeave:()=>T(!1),onDrop:e=>{var a;e.preventDefault(),T(!1);let n=null==(a=e.dataTransfer.files)?void 0:a[0];n&&W(n)},children:[(0,l.jsx)("textarea",{className:"grow",placeholder:n("plan.placeholder"),value:w,onChange:e=>{C(e.target.value),H(null),B(null)},style:{minHeight:220,width:"100%"}}),(0,l.jsx)("p",{className:"muted small",children:S?n("plan.dropActive"):n("plan.drop")})]}),(0,l.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,l.jsx)("button",{onClick:()=>{var e;return null==(e=R.current)?void 0:e.click()},children:n("plan.browse")}),(0,l.jsx)("input",{ref:R,type:"file",accept:".json,application/json,text/plain",style:{display:"none"},onChange:e=>{var a;let n=null==(a=e.target.files)?void 0:a[0];n&&W(n),e.target.value=""}}),(0,l.jsx)("button",{onClick:()=>void q(),disabled:!w.trim()||""!==F,children:"check"===F?n("plan.checking"):n("plan.check")}),(0,l.jsx)("button",{className:"primary",onClick:()=>void Z(),disabled:!w.trim()||""!==F,children:"import"===F?n("plan.importing"):n("plan.import")}),(0,l.jsx)("button",{className:"quiet",onClick:()=>{C(""),H(null),B(null),D("")},disabled:!w&&!E,children:n("plan.clear")})]}),P&&(0,l.jsx)("div",{className:"err",children:P}),A&&""===w.trim()&&(0,l.jsx)("p",{className:"why",children:n("plan.cleared")})]}),E&&!E.ok&&(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsx)("div",{className:"notice",children:(0,l.jsx)("strong",{children:n("plan.invalid")})}),(0,l.jsx)("h3",{children:n("plan.issues")}),(0,l.jsx)("p",{className:"muted small",children:n("plan.issuesHint")}),(0,l.jsx)("pre",{children:_}),(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("button",{onClick:()=>void O("issues",_),children:n("plan.copyIssues")}),"issues"===g&&(0,l.jsx)("span",{className:"badge done",children:n("plan.copied")})]})]}),(null!=(e=null==E?void 0:E.duplicates.length)?e:0)>0&&(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsxs)("div",{className:"notice caution",children:[(0,l.jsx)("strong",{children:n("plan.duplicates")}),(0,l.jsx)("ul",{children:(null!=(a=null==E?void 0:E.duplicates)?a:[]).map(e=>(0,l.jsx)("li",{children:(0,l.jsx)(i(),{href:(0,r.aT)(e.sessionId),children:n("plan.duplicateRow",{name:e.name,tasks:e.tasks,when:d(e.createdAt)})})},e.sessionId))})]}),(0,l.jsx)("p",{className:"muted small",children:n("plan.duplicatesHint")})]}),(null==E?void 0:E.ok)&&(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsx)("div",{className:"notice calm",children:(0,l.jsx)("strong",{children:A?n("plan.imported",{sessions:A.result.sessions.length,tasks:A.result.taskCount}):n("plan.valid",{sessions:E.summary.sessions.length,tasks:E.summary.taskCount})})}),E.summary.plan&&(0,l.jsx)("p",{children:E.summary.plan}),(0,l.jsxs)("p",{className:"muted small",children:[n("plan.col.planFail"),":"," ","continue"===E.summary.onFailure?n("batch.independent"):n("batch.chain")]}),(0,l.jsx)("h3",{children:n("plan.preview")}),(0,l.jsxs)("table",{children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:n("plan.col.session")}),(0,l.jsx)("th",{children:n("plan.col.tasks")}),(0,l.jsx)("th",{children:n("plan.col.chain")}),(0,l.jsx)("th",{children:n("plan.col.repo")})]})}),(0,l.jsx)("tbody",{children:E.summary.sessions.map((e,a)=>{let s=null==A?void 0:A.result.sessions[a];return(0,l.jsxs)("tr",{children:[(0,l.jsx)("td",{children:s?(0,l.jsx)(i(),{href:(0,r.aT)(s.id),children:e.name}):e.name}),(0,l.jsxs)("td",{className:"small",children:[e.tasks.length,(0,l.jsx)("div",{className:"muted small",children:e.tasks.join(", ")})]}),(0,l.jsx)("td",{className:"small",children:"continue"===e.onFailure?n("chain.continue"):n("chain.stop")}),(0,l.jsx)("td",{className:"small muted",children:e.repoDir||n("plan.noRepo")})]},"".concat(e.name,"-").concat(a))})})]}),E.summary.notes&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("h3",{children:n("plan.notes")}),(0,l.jsx)("p",{className:"muted small",style:{whiteSpace:"pre-wrap"},children:E.summary.notes})]}),E.warnings.length>0&&(0,l.jsxs)("div",{className:"notice caution",children:[(0,l.jsx)("strong",{children:n("plan.warnings")}),(0,l.jsx)("ul",{children:E.warnings.map(e=>(0,l.jsx)("li",{children:e},e))})]})]}),A&&(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsx)("h2",{children:n("plan.step3")}),(0,l.jsx)("p",{className:"muted small",children:n("plan.step3Hint")}),(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)(i(),{href:"/?run=".concat(encodeURIComponent(A.result.sessions.map(e=>e.id).join(",")),"&fail=").concat(A.summary.onFailure),className:"button-link",children:n("plan.runThese")}),(0,l.jsx)(i(),{href:"/",className:"button-link plain",children:n("plan.toSessions")})]})]})]})}function m(e){var a,n;let{current:t,onLoad:i}=e,{t:d}=(0,o.kj)(),[m,p]=(0,s.useState)([]),[u,h]=(0,s.useState)(""),[x,j]=(0,s.useState)(""),v=(0,s.useCallback)(async()=>{try{p(await r.FH.personas())}catch(e){j(e.message)}},[]);(0,s.useEffect)(()=>{v()},[v]);let g=null!=(n=null==(a=m.find(e=>e.content===t))?void 0:a.name)?n:"",f=async e=>{let a=m.find(a=>a.name===e);a&&(!t.trim()||g||await (0,c.Z)(d("plan.personaReplaceConfirm",{name:e})))&&(i(a.content),h(a.name),j(d("plan.personaLoaded",{name:a.name})))},y=async()=>{let e=u.trim();if(e&&t.trim()&&(!m.some(a=>a.name===e)||await (0,c.Z)(d("plan.personaOverwriteConfirm",{name:e}))))try{let a=await r.FH.savePersona(e,t);h(a.name),j(d("plan.personaSavedAs",{name:a.name})),await v()}catch(e){j(e.message)}},k=async()=>{if(g&&await (0,c.Z)(d("plan.personaDeleteConfirm",{name:g})))try{await r.FH.deletePersona(g),j(d("plan.personaDeleted",{name:g})),await v()}catch(e){j(e.message)}};return(0,l.jsxs)("div",{className:"option",style:{marginBottom:8},children:[(0,l.jsx)("label",{htmlFor:"persona-shelf",children:d("plan.personaSaved")}),(0,l.jsxs)("div",{className:"row",children:[(0,l.jsxs)("select",{id:"persona-shelf",value:g,onChange:e=>void f(e.target.value),style:{width:"auto",minWidth:260},children:[(0,l.jsx)("option",{value:"",children:0===m.length?d("plan.personaNone"):d("plan.personaPick")}),m.map(e=>(0,l.jsx)("option",{value:e.name,children:e.name},e.name))]}),(0,l.jsx)("button",{className:"quiet",onClick:()=>void k(),disabled:!g,children:d("plan.personaDelete")})]}),(0,l.jsxs)("div",{className:"row",style:{marginTop:6},children:[(0,l.jsx)("input",{type:"text",value:u,onChange:e=>h(e.target.value),placeholder:d("plan.personaNamePlaceholder"),"aria-label":d("plan.personaNamePlaceholder"),style:{maxWidth:360}}),(0,l.jsx)("button",{onClick:()=>void y(),disabled:!u.trim()||!t.trim(),children:d("plan.personaSaveAs")}),(0,l.jsx)("span",{className:"muted small",role:"status",children:x})]}),(0,l.jsx)("p",{className:"why",children:d("plan.personaSavedWhy")})]})}function p(e){let{kind:a,onSaved:n}=e,{t,locale:i}=(0,o.kj)(),[d,p]=(0,s.useState)(""),[u,h]=(0,s.useState)(""),[x,j]=(0,s.useState)(""),[v,g]=(0,s.useState)(!1),[f,y]=(0,s.useState)(""),k=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=!1;return r.FH.context(a,i).then(a=>{e||(p(a.content),h(a.content),j(a.example),g(a.customised))}).catch(e=>y(e.message)),()=>{e=!0}},[a,i]);let b=async e=>{try{await r.FH.setContext(a,e),h(e),g(""!==e.trim()),y(t("plan.ctxSaved")),n()}catch(e){y(e.message)}},N=async()=>{if(await (0,c.Z)(t("plan.ctxClearConfirm")))try{let e=await r.FH.resetContext(a,i);p(e.content),h(e.content),g(e.customised),y(t("plan.ctxCleared")),n()}catch(e){y(e.message)}},w="organisation"===a?t("plan.orgPart"):"persona"===a?t("plan.personaPart"):t("plan.workPart"),C="organisation"===a?t("plan.orgHint"):"persona"===a?t("plan.personaHint"):t("plan.workHint");return(0,l.jsxs)("details",{style:{marginTop:8},open:!0,children:[(0,l.jsxs)("summary",{children:[w," ",(0,l.jsxs)("span",{className:"muted small",children:["— ",v?t("plan.ctxWritten"):t("plan.ctxEmpty")]})]}),(0,l.jsx)("p",{className:"muted small",style:{marginTop:8},children:C}),"persona"===a&&(0,l.jsx)(m,{current:d,onLoad:e=>{p(e),b(e)}}),(0,l.jsx)("textarea",{value:d,onChange:e=>{var a;p(e.target.value),a=e.target.value,k.current&&clearTimeout(k.current),k.current=setTimeout(()=>void b(a),900)},onBlur:()=>d!==u&&void b(d),placeholder:x,style:{minHeight:220}}),(0,l.jsxs)("div",{className:"row",style:{marginTop:6},children:[(0,l.jsx)("button",{className:"quiet",onClick:()=>void N(),disabled:!v,children:t("plan.ctxClear")}),(0,l.jsx)("span",{className:"muted small",role:"status",children:f||t("def.savedAutomatically")})]})]})}}},e=>{e.O(0,[197,867,549,347,131,358],()=>e(e.s=5515)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{1035:(e,t,l)=>{"use strict";l.d(t,{DialogHost:()=>o,Z:()=>c});var n=l(3365),a=l(1521),s=l(867),i=l(4969);let r=null,d=[];function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(l=>{var n;return n={kind:"confirm",message:e,...t,resolve:l},void(r?r(n):d.push(n))})}function o(e){var t,l;let{children:c}=e,{t:o}=(0,s.kj)(),[h,u]=(0,a.useState)([]),m=(0,a.useRef)(null),p=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(r=e=>u(t=>[...t,e]),d.length>0){let e=d.splice(0,d.length);u(t=>[...t,...e])}return()=>{r=null}},[]);let x=h[0],b=(0,a.useCallback)(e=>{x&&(x.resolve(e),u(e=>e.slice(1)))},[x]);return(0,i.V)(p,!!x,m),(0,a.useEffect)(()=>{if(!x)return;let e=e=>{"Escape"===e.key&&(e.preventDefault(),b(!1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[x,b]),(0,n.jsxs)(n.Fragment,{children:[c,x&&(0,n.jsx)("div",{className:"modal-backdrop",onClick:()=>b(!1),role:"presentation",children:(0,n.jsxs)("div",{ref:p,className:"modal".concat(x.danger?" danger":""),role:"confirm"===x.kind?"alertdialog":"dialog","aria-modal":"true","aria-labelledby":"modal-title","aria-describedby":"modal-body",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{id:"modal-title",children:null!=(t=x.title)?t:o("confirm"===x.kind?"dialog.confirmTitle":"dialog.noticeTitle")}),(0,n.jsx)("div",{id:"modal-body",className:"modal-body",children:x.message}),(0,n.jsxs)("div",{className:"row modal-actions",children:["confirm"===x.kind&&(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>b(!1),children:o("dialog.cancel")}),(0,n.jsx)("button",{ref:m,type:"button",className:x.danger?"danger":"primary",onClick:()=>b(!0),children:null!=(l=x.okLabel)?l:o("dialog.ok")})]})]})})]})}},2114:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>m});var n=l(3365),a=l(1521),s=l(8197),i=l.n(s),r=l(5549),d=l(7527),c=l(867),o=l(1035),h=l(4811),u=l(8848);function m(){let{t:e}=(0,c.kj)(),t=(0,c.W3)(),[l,s]=(0,a.useState)(null),[h,u]=(0,a.useState)(null),[m,x]=(0,a.useState)([]),[b,j]=(0,a.useState)([]),[g,f]=(0,a.useState)("stop"),[v,y]=(0,a.useState)(!1),[N,w]=(0,a.useState)(""),[k,S]=(0,a.useState)(""),[C,F]=(0,a.useState)(""),[E,H]=(0,a.useState)(null),[T,W]=(0,a.useState)(!1),I=(0,a.useCallback)(async()=>{try{let[e,t,l]=await Promise.all([r.FH.sessions(),r.FH.batch().catch(()=>null),r.FH.approvals().catch(()=>[])]);s(e),u(t),x(l),j(t=>t.filter(t=>e.some(e=>e.id===t))),H(!0),W(!1),F("")}catch(e){W(!(0,r.AV)()),H(!1),F(e.message)}},[]);(0,d.z)(I,3e3),(0,a.useEffect)(()=>{var e;let t=new URLSearchParams(window.location.search),l=(null!=(e=t.get("run"))?e:"").split(",").map(e=>e.trim()).filter(Boolean);0!==l.length&&(j(l),f("continue"===t.get("fail")?"continue":"stop"),y(!0),window.history.replaceState(null,"",window.location.pathname))},[]);let[R,D]=(0,a.useState)(!1),P=(0,a.useRef)(!1),U=async()=>{if(!P.current){P.current=!0,D(!0);try{let e=await r.FH.createSession(N||"session");w(""),window.location.href=(0,r.aT)(e.id)}catch(e){F(e.message),P.current=!1,D(!1)}}},L=async t=>{if(t.running)return void S(e("home.deleteRunning"));if(await (0,o.Z)(e("home.deleteConfirm",{name:t.name,n:t.tasks.length})))try{await r.FH.deleteSession(t.id),S(e("home.deleted",{name:t.name})),j(e=>e.filter(e=>e!==t.id)),await I()}catch(e){S(e.message)}},q=async()=>{let t=(null!=l?l:[]).filter(e=>b.includes(e.id));if(0===t.length)return;let n=t.map(e=>"• ".concat(e.name," (").concat(e.tasks.length,")")).join("\n");if(!await (0,o.Z)(e("home.deleteSelectedConfirm",{n:t.length,names:n})))return;let a=0,s=[];for(let e of t)try{await r.FH.deleteSession(e.id),a+=1}catch(t){s.push("".concat(e.name,": ").concat(t.message))}S(0===s.length?e("home.deletedMany",{n:a}):e("home.deleteSomeFailed",{n:a,m:s.length,why:s.join("; ")})),j([]),await I()},M=t=>{if(t.running)return{label:e("state.running"),badge:"running"};let l=t.tasks.some(e=>"queued"===e.status||"running"===e.status);if("idle"!==t.status||l||0===t.tasks.length)return{label:e("state.".concat(t.status)),badge:""};let n=t.tasks.filter(e=>"done"!==e.status).length;return 0===n?{label:e("state.completed"),badge:"done",title:e("state.completedTitle")}:{label:e("state.ended"),badge:"failed",title:e("state.endedTitle",{n:n})}};return(0,n.jsxs)(n.Fragment,{children:[T&&(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===E&&!T&&(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"})}),C&&(0,n.jsx)("div",{className:"err",children:C})]}),(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&&U()}}),(0,n.jsx)("button",{className:"primary",onClick:()=>void U(),disabled:R||!1===E,children:e("home.create")})]})]}),l&&l.length>0&&(0,n.jsx)(p,{sessions:l,selected:b,setSelected:j,onFailure:g,setOnFailure:f,fromPlan:v,batch:h,approvals:m,onChange:I,move:(e,t)=>{j(l=>{let n=l.indexOf(e),a=n+t;if(n<0||a<0||a>=l.length)return l;let s=[...l];return[s[n],s[a]]=[s[a],s[n]],s})}}),(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("h2",{children:e("home.sessions")}),null===l&&(0,n.jsx)("div",{className:"muted",children:e("home.loading")}),l&&0===l.length&&(0,n.jsx)("div",{className:"muted",children:e("home.none")}),l&&l.length>0&&(0,n.jsxs)("div",{className:"row",style:{marginBottom:10},children:[(0,n.jsx)("strong",{className:"small",children:e("home.selected",{n:b.length})}),(0,n.jsx)("button",{className:"danger",onClick:()=>void q(),disabled:0===b.length||(null==h?void 0:h.running)===!0||l.some(e=>b.includes(e.id)&&e.running),children:e("home.deleteSelected",{n:b.length})}),(0,n.jsx)("span",{className:"muted small",children:e("home.tickForBoth")})]}),l&&l.length>0&&(0,n.jsx)("p",{className:"muted small",children:e("home.deleteWhy")}),k&&(0,n.jsx)("div",{className:"muted small",role:"status",children:k}),l&&l.length>0&&(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:(0,n.jsx)("input",{type:"checkbox","aria-label":e("home.selectAll"),checked:l.length>0&&b.length===l.length,onChange:e=>j(e.target.checked?l.map(e=>e.id).reverse():[]),disabled:(null==h?void 0:h.running)===!0})}),(0,n.jsx)("th",{children:e("home.col.name")}),(0,n.jsx)("th",{children:e("home.col.tasks")}),(0,n.jsx)("th",{children:e("home.col.state")}),(0,n.jsx)("th",{children:e("home.col.chat")}),(0,n.jsx)("th",{children:e("home.col.created")}),(0,n.jsx)("th",{children:(0,n.jsx)("span",{className:"visually-hidden",children:e("home.col.remove")})})]})}),(0,n.jsx)("tbody",{children:l.map(a=>{let s=a.tasks.filter(e=>"done"===e.status).length,d=a.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:b.includes(a.id),onChange:()=>{var e;return e=a.id,void j(t=>{if(t.includes(e))return t.filter(t=>t!==e);let n=(null!=l?l:[]).map(e=>e.id).reverse();return[...t,e].sort((e,t)=>n.indexOf(e)-n.indexOf(t))})},disabled:(null==h?void 0:h.running)===!0,"aria-label":a.name})}),(0,n.jsx)("td",{children:(0,n.jsx)(i(),{href:(0,r.aT)(a.id),children:a.name})}),(0,n.jsxs)("td",{children:[a.tasks.length," ",(0,n.jsx)("span",{className:"muted small",children:e("home.tasksDetail",{done:s,queued:d})})]}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"badge ".concat(M(a).badge),title:M(a).title,children:M(a).label})}),(0,n.jsx)("td",{children:a.chat?(0,n.jsx)("a",{href:a.chat.url,target:"_blank",rel:"noreferrer",children:a.chat.name}):(0,n.jsx)("span",{className:"muted",children:e("home.notOpened")})}),(0,n.jsx)("td",{className:"muted small",children:t(a.createdAt)}),(0,n.jsx)("td",{children:(0,n.jsx)("button",{className:"quiet",onClick:()=>void L(a),disabled:a.running||(null==h?void 0:h.running)===!0,title:e("home.delete"),children:e("home.delete")})})]},a.id)})})]})]})]})}function p(e){var t,l,s,d,m,p,x;let{sessions:b,selected:j,setSelected:g,onFailure:f,setOnFailure:v,fromPlan:y,batch:N,approvals:w,onChange:k,move:S}=e,{t:C}=(0,c.kj)(),[F,E]=(0,a.useState)(""),[H,T]=(0,a.useState)(""),[W,I]=(0,a.useState)(""),[R,D]=(0,a.useState)(""),[P,U]=(0,a.useState)(""),[L,q]=(0,a.useState)(null),[M,B]=(0,a.useState)([]);(0,a.useEffect)(()=>{r.FH.models().then(e=>{q(e),I(t=>t||e.defaultModel),D(t=>t||e.defaultReviewModel)}).catch(()=>void 0)},[]);let O=j.join(",");(0,a.useEffect)(()=>{let e=!1,t=O.split(",").filter(Boolean);if(0===t.length)return void B([]);let l=async()=>{let l=await Promise.all(t.map(async e=>{let t=await r.FH.vcsStatus(e).catch(()=>null);return{id:e,status:t}}));e||B(l.filter(e=>e.status&&!e.status.ok&&"off"!==e.status.problem).map(e=>{var t,l,n,a;return{name:null!=(n=null==(t=b.find(t=>t.id===e.id))?void 0:t.name)?n:e.id,problem:null!=(a=null==(l=e.status)?void 0:l.problem)?a:""}}))};l();let n=setInterval(()=>void l(),1e4);return()=>{e=!0,clearInterval(n)}},[O]);let _=new Map(b.map(e=>[e.id,e])),A=e=>e.tasks.filter(e=>"queued"===e.status).length,K=j.map(e=>_.get(e)).filter(e=>!!e),Z=K.filter(e=>A(e)>0),z=Z.reduce((e,t)=>e+A(t),0),V=(null==N?void 0:N.running)===!0,Q=b.some(e=>e.running),G=V||0===Z.length||Q,J=Q?{title:"batch.oneRunning",why:"batch.oneRunningWhy"}:0===K.length?{title:"batch.pickFirst",why:"batch.pickFirstWhy"}:0===Z.length?{title:"batch.nothingRunnable",why:"batch.nothingRunnableWhy"}:null,X=(0,h.p)(),[Y,$]=(0,a.useState)(!1),ee=(0,a.useRef)(!1),et=async e=>{if(!ee.current){ee.current=!0,$(!0);try{await e()}catch(e){T(e.message)}finally{ee.current=!1,$(!1),k()}}},el=async e=>{("unattended"!==e||X||await (0,o.Z)(C("batch.unattendedConfirm",{n:Z.length})))&&await et(async()=>{var t;let l=await r.FH.startBatch(Z.map(e=>e.id),e,f,W||void 0,R||void 0,P.trim()||Z.map(e=>e.planName).find(Boolean)||void 0);E(""),T(l.started?"":null!=(t=l.reason)?t:"")})},en=K.filter(e=>{var t;return(null!=(t=e.model)?t:"")!==W}).length,ea=K.filter(e=>{var t;return(null==(t=e.review)?void 0:t.enabled)===!1}).length,es=null!=(s=null==L?void 0:L.options)?s:[],ei=es.filter(e=>!e.group),er=new Map;for(let e of es)e.group&&er.set(e.group,[...null!=(d=er.get(e.group))?d:[],e]);let ed=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,ec=null==N?void 0:N.sessions.find(e=>"running"===e.state);return(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("h2",{children:C("batch.title")}),(0,n.jsx)("p",{className:"muted small",children:C("batch.hint")}),!V&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("strong",{className:"small",children:C("batch.selected",{n:Z.length,tasks:z})}),(0,n.jsx)("button",{className:"quiet",onClick:()=>g(b.filter(e=>A(e)>0).map(e=>e.id).reverse()),children:C("batch.selectQueued")}),(0,n.jsx)("button",{className:"quiet",onClick:()=>g([]),disabled:0===K.length,children:C("batch.selectNone")})]}),y&&(0,n.jsx)("p",{className:"muted small",children:C("batch.fromPlan")}),K.length>Z.length&&(0,n.jsx)("p",{className:"muted small",children:C("batch.notRunnable",{n:K.length-Z.length})}),Z.length>0&&(0,n.jsx)("ol",{className:"run-order",children:Z.map((e,t)=>(0,n.jsxs)("li",{children:[(0,n.jsxs)("span",{children:[e.name," ",(0,n.jsxs)("span",{className:"muted small",children:["(",A(e),")"]})]}),(0,n.jsxs)("span",{children:[(0,n.jsx)("button",{className:"quiet",onClick:()=>S(e.id,-1),disabled:0===t,"aria-label":C("batch.moveUp",{name:e.name}),children:"↑"}),(0,n.jsx)("button",{className:"quiet",onClick:()=>S(e.id,1),disabled:t===Z.length-1,"aria-label":C("batch.moveDown",{name:e.name}),children:"↓"})]})]},e.id))}),(0,n.jsx)("label",{htmlFor:"batch-run-name",children:C("batch.runName")}),(0,n.jsx)("input",{id:"batch-run-name",type:"text",value:P,onChange:e=>U(e.target.value),placeholder:null!=(m=Z.map(e=>e.planName).find(Boolean))?m:C("batch.runNamePlaceholder")}),(0,n.jsx)("p",{className:"why",children:C("batch.runNameWhy")}),(0,n.jsx)("label",{htmlFor:"batch-model",children:C("batch.model")}),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsxs)("select",{id:"batch-model",value:W,onChange:e=>I(e.target.value),style:{width:"auto",minWidth:260},children:[(0,n.jsx)("option",{value:"",children:C("batch.modelKeep")}),ei.map(e=>(0,n.jsx)("option",{value:e.name,disabled:e.disabled,children:e.name},e.name)),[...er.entries()].map(e=>{let[t,l]=e;return(0,n.jsx)("optgroup",{label:t,children:l.map(e=>(0,n.jsx)("option",{value:e.name,disabled:e.disabled,children:e.name},e.name))},t)})]}),(null!=(p=null==L?void 0:L.options.length)?p:0)===0&&(0,n.jsx)("span",{className:"muted small",children:C("batch.modelNone")})]}),(0,n.jsx)("p",{className:"why",children:C("batch.modelWhy")}),(0,n.jsx)(u.L,{current:W,onUse:e=>I(e)}),W&&en>0&&(0,n.jsx)("p",{className:"why",style:{color:"var(--warn)"},children:C("batch.modelOverrides",{n:en})}),(0,n.jsx)("label",{htmlFor:"batch-review-model",children:C("batch.reviewModel")}),(0,n.jsx)("div",{className:"row",children:(0,n.jsxs)("select",{id:"batch-review-model",value:R,onChange:e=>D(e.target.value),style:{width:"auto",minWidth:260},children:[(0,n.jsx)("option",{value:"",children:C("batch.reviewModelKeep")}),ei.map(e=>(0,n.jsx)("option",{value:e.name,disabled:e.disabled,children:e.name},e.name)),[...er.entries()].map(e=>{let[t,l]=e;return(0,n.jsx)("optgroup",{label:t,children:l.map(e=>(0,n.jsx)("option",{value:e.name,disabled:e.disabled,children:e.name},e.name))},t)})]})}),(0,n.jsx)("p",{className:"why",children:C("batch.reviewModelWhy")}),""!==R&&R===W&&(0,n.jsx)("p",{className:"why",style:{color:"var(--warn)"},children:C("batch.reviewSame")}),ea>0&&(0,n.jsx)("p",{className:"why",children:C("batch.reviewOffIn",{n:ea})}),(0,n.jsxs)("fieldset",{style:{border:0,padding:0,margin:"10px 0 14px"},children:[(0,n.jsx)("legend",{className:"muted small",style:{padding:0},children:C("batch.onFailure")}),(0,n.jsxs)("div",{className:"option",children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"radio",name:"batch-fail",checked:"stop"===f,onChange:()=>v("stop")}),(0,n.jsx)("span",{children:C("batch.chain")})]}),(0,n.jsx)("p",{className:"why",children:C("batch.chainWhy")})]}),(0,n.jsxs)("div",{className:"option",children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"radio",name:"batch-fail",checked:"continue"===f,onChange:()=>v("continue")}),(0,n.jsx)("span",{children:C("batch.independent")})]}),(0,n.jsx)("p",{className:"why",children:C("batch.independentWhy")})]})]}),J&&(0,n.jsxs)("div",{className:"notice caution",children:[(0,n.jsx)("strong",{children:C(J.title)}),(0,n.jsx)("div",{className:"small",style:{marginTop:4},children:C(J.why)})]}),M.length>0&&(0,n.jsxs)("div",{className:"notice caution",children:[(0,n.jsx)("strong",{children:C("batch.vcsProblem")}),(0,n.jsx)("ul",{children:M.map(e=>(0,n.jsx)("li",{children:C("batch.vcsProblemRow",{name:e.name,problem:e.problem})},e.name))}),(0,n.jsx)("div",{className:"muted small",children:C("batch.vcsProblemWhy")})]}),H&&(0,n.jsxs)("div",{className:"notice caution",role:"alert",children:[(0,n.jsx)("strong",{children:C("batch.notStartedTitle")}),(0,n.jsx)("div",{className:"small",style:{marginTop:4},children:H}),/execution\.isolation/.test(H)&&(0,n.jsx)("div",{className:"small",style:{marginTop:4},children:(0,n.jsx)(i(),{href:"/defaults",children:C("batch.notStartedIsolation")})})]}),(0,n.jsxs)("div",{className:"run-choice",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("button",{className:"primary",onClick:()=>void el("unattended"),disabled:Y||G,children:C("batch.run",{n:Z.length})}),(0,n.jsx)("p",{className:"why",children:C("batch.runWhy")})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("button",{onClick:()=>void el("confirm"),disabled:Y||G,children:C("batch.runStep")}),(0,n.jsx)("p",{className:"why",children:C("batch.runStepWhy")})]})]})]}),V&&(0,n.jsxs)("div",{className:"row",children:[(null==N?void 0:N.pausing)?(0,n.jsx)("button",{className:"primary",onClick:()=>void et(async()=>{await r.FH.resumeBatch(),E("")}),disabled:Y||(null==N?void 0:N.stopping),title:C("batch.resumeWhy"),children:C("batch.resume")}):(0,n.jsx)("button",{onClick:()=>void et(async()=>{await r.FH.pauseBatch(),E(C("batch.pausing"))}),disabled:Y||(null==N?void 0:N.stopping),title:C("batch.pauseWhy"),children:C("batch.pause")}),(0,n.jsx)("button",{onClick:()=>void et(async()=>{await r.FH.stopBatch(),E(C("batch.stopping"))}),disabled:Y||(null==N?void 0:N.stopping),title:C("batch.stopWhy"),children:C("batch.stop")}),(null==N?void 0:N.pausing)&&!(null==N?void 0:N.stopping)&&(0,n.jsx)("span",{className:"muted small",children:C("batch.pausing")}),(0,n.jsx)("span",{className:"badge",children:C("batch.modelRunning",{name:(ec?(null==(t=_.get(ec.sessionId))?void 0:t.modelInUse)||(null==(l=_.get(ec.sessionId))?void 0:l.model):"")||C("model.default")})}),w.length>0&&(0,n.jsx)("span",{className:"badge waiting-approval",children:C("batch.waiting",{n:w.length})}),ec&&(0,n.jsx)("span",{className:"small",children:C("batch.progress",{name:ec.name,done:N.sessions.filter(e=>"waiting"!==e.state&&"running"!==e.state).length,total:N.sessions.length})})]}),V&&(0,n.jsx)("p",{className:"muted small",children:C("batch.hiddenWhileRunning")}),F&&(0,n.jsx)("div",{className:"muted small",role:"status",children:F}),(K.length>0||N)&&(0,n.jsxs)("div",{className:"row",style:{marginTop:12},children:[(0,n.jsx)("a",{className:"button-link",href:r.FH.debugExportUrl(K.length>0?K.map(e=>e.id):(null!=(x=null==N?void 0:N.sessions)?x:[]).map(e=>e.sessionId)),children:C("batch.debug")}),(0,n.jsx)("span",{className:"muted small",children:K.length>0?C("batch.debugSelected",{n:K.length}):C("batch.debugLast")})]}),(K.length>0||N)&&(0,n.jsx)("p",{className:"why",children:C("batch.debugWhy")}),N&&(0,n.jsxs)(n.Fragment,{children:[!V&&ed&&(0,n.jsx)("div",{className:"notice calm",style:{marginTop:12},children:(0,n.jsx)("strong",{children:C("batch.finished",ed)})}),(0,n.jsxs)("table",{style:{marginTop:10},children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:C("batch.col.session")}),(0,n.jsx)("th",{children:C("batch.col.state")}),(0,n.jsx)("th",{children:C("batch.col.ran")}),(0,n.jsx)("th",{children:C("batch.col.why")})]})}),(0,n.jsx)("tbody",{children:N.sessions.map(e=>{var t,l;return(0,n.jsxs)("tr",{className:"batch-row ".concat(e.state),children:[(0,n.jsx)("td",{children:(0,n.jsx)(i(),{href:(0,r.aT)(e.sessionId),children:e.name})}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"badge ".concat("running"===(l=e.state)?"running":"done"===l?"done":"failed"===l?"failed":"stopped"===l?"aborted":""),children:C("batch.state.".concat(e.state))})}),(0,n.jsx)("td",{className:"small",children:C("batch.ranOf",{ran:e.ran,failed:e.failed})}),(0,n.jsx)("td",{className:"muted small",children:null!=(t=e.reason)?t:""})]},e.sessionId)})})]})]})]})}},4811:(e,t,l)=>{"use strict";l.d(t,{p:()=>s});var n=l(1521),a=l(5549);function s(){let[e,t]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e=!0;return a.FH.settings().then(l=>{var n;let a=null!=(n=l.raw.execution)?n:{};e&&t("unattended"===a.mode)}).catch(()=>void 0),()=>{e=!1}},[]),e}},4969:(e,t,l)=>{"use strict";l.d(t,{V:()=>s});var n=l(1521);let a='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function s(e,t,l){(0,n.useEffect)(()=>{var n,s;if(!t)return;let i=document.activeElement instanceof HTMLElement?document.activeElement:null,r=e.current,d=null!=(s=null!=(n=null==l?void 0:l.current)?n:null==r?void 0:r.querySelector(a))?s:null;null==d||d.focus();let c=e=>{if("Tab"!==e.key||!r)return;let t=Array.from(r.querySelectorAll(a)).filter(e=>null!==e.offsetParent);if(0===t.length)return;let l=t[0],n=t[t.length-1],s=r.contains(document.activeElement);e.shiftKey&&(document.activeElement===l||!s)?(e.preventDefault(),n.focus()):e.shiftKey||document.activeElement!==n&&s||(e.preventDefault(),l.focus())};return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c),i&&document.contains(i)&&i.focus()}},[e,t,l])}},5704:(e,t,l)=>{Promise.resolve().then(l.bind(l,2114))},7527:(e,t,l)=>{"use strict";l.d(t,{z:()=>a});var n=l(1521);function a(e,t){let l=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=(0,n.useRef)(e);a.current=e,(0,n.useEffect)(()=>{let e;if(!l)return;let n=!1,s=async()=>{try{await a.current()}catch(e){}finally{n||(e=setTimeout(()=>void s(),t))}};return s(),()=>{n=!0,e&&clearTimeout(e)}},[t,l])}},8848:(e,t,l)=>{"use strict";l.d(t,{H4:()=>c,L:()=>o,z4:()=>h});var n=l(3365),a=l(8197),s=l.n(a),i=l(1521),r=l(5549),d=l(867);function c(e){let{current:t,onUse:l}=e,{t:a}=(0,d.kj)(),[s,c]=(0,i.useState)(null);if((0,i.useEffect)(()=>{let e=!1;return r.FH.project().then(t=>{e||c(t)}).catch(()=>void 0),()=>{e=!0}},[]),!s)return null;let o=s.rootDir.trim(),h=t.trim().toLowerCase(),u=l?s.others.filter(e=>e.rootDir.trim().toLowerCase()!==h):[];return(0,n.jsx)(m,{label:o?a("proj.defaultIs",{dir:o}):a("proj.noneShort"),offer:o&&l&&h!==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:t,onUse:l}=e,a=u(),{t:s}=(0,d.kj)();if(!a)return null;let i=a.defaultModel.trim();return(0,n.jsx)(m,{label:i?s("def.modelDefaultIs",{name:i}):s("def.modelNoneShort"),offer:i&&l&&t.trim()!==i?{text:s("def.modelUseIt"),onUse:()=>l(i)}:void 0,link:s(i?"proj.change":"proj.setIt"),anchor:"model"})}function h(e){let{current:t,onUse:l}=e,a=u(),{t:s}=(0,d.kj)();if(!a)return null;let i=a.defaultReviewModel.trim();return(0,n.jsx)(m,{label:i?s("def.reviewDefaultIs",{name:i}):s("def.reviewNoneShort"),offer:i&&l&&t.trim()!==i?{text:s("def.modelUseIt"),onUse:()=>l(i)}:void 0,link:s(i?"proj.change":"proj.setIt"),anchor:"review"})}function u(){let[e,t]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!1;return r.FH.models().then(l=>{e||t(l)}).catch(()=>void 0),()=>{e=!0}},[]),e}function m(e){let{label:t,offer:l,more:a=[],link:i,anchor:r}=e;return(0,n.jsxs)("p",{className:"muted small",style:{marginTop:4},children:[t," ",l&&(0,n.jsxs)(n.Fragment,{children:["\xb7"," ",(0,n.jsx)("button",{type:"button",className:"linkish",onClick:l.onUse,children:l.text})," "]}),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)(s(),{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,n)=>{"use strict";n.d(s,{AppearanceProvider:()=>m,KP:()=>h,themeScript:()=>c});var a=n(3365),l=n(1521);let t=["small","normal","large","huge","giant"],r={theme:"light",textSize:"normal",highContrast:!1,reduceMotion:!1,underlineLinks:!1,strongFocus:!1},i="cop.appearance",c="\n(function () {\n try {\n var d = document.documentElement;\n var raw = localStorage.getItem('".concat(i,"');\n var a = raw ? JSON.parse(raw) : {};\n if (!a || typeof a !== 'object') a = {};\n d.dataset.theme = a.theme === 'dark' ? 'dark' : 'light';\n d.dataset.textsize = ").concat(JSON.stringify(t),".indexOf(a.textSize) >= 0 ? 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 d(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 o=(0,l.createContext)({appearance:r,set:()=>void 0,reset:()=>void 0,loaded:!1});function m(e){let{children:s}=e,[n,c]=(0,l.useState)(r),[m,h]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=r;try{let s=window.localStorage.getItem(i);s?e=function(e){let s=e&&"object"==typeof e?e:{},n=(e,s)=>"boolean"==typeof e?e:s;return{theme:"dark"===s.theme?"dark":"light"===s.theme?"light":r.theme,textSize:t.includes(s.textSize)?s.textSize:r.textSize,highContrast:n(s.highContrast,r.highContrast),reduceMotion:n(s.reduceMotion,r.reduceMotion),underlineLinks:n(s.underlineLinks,r.underlineLinks),strongFocus:n(s.strongFocus,r.strongFocus)}}(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){}c(e),d(e),h(!0)},[]);let u=(0,l.useCallback)(e=>{c(s=>{let n={...s,...e};d(n);try{window.localStorage.setItem(i,JSON.stringify(n))}catch(e){}return n})},[]),p=(0,l.useCallback)(()=>{c(r),d(r);try{window.localStorage.removeItem(i)}catch(e){}},[]);return(0,a.jsx)(o.Provider,{value:{appearance:n,set:u,reset:p,loaded:m},children:s})}function h(){return(0,l.useContext)(o)}},1702:(e,s,n)=>{"use strict";var a=n(9962);n.o(a,"usePathname")&&n.d(s,{usePathname:function(){return a.usePathname}}),n.o(a,"useSearchParams")&&n.d(s,{useSearchParams:function(){return a.useSearchParams}})},1772:(e,s,n)=>{Promise.resolve().then(n.bind(n,4269))},2244:(e,s,n)=>{"use strict";n.d(s,{k:()=>o});var a=n(3365),l=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)(),[v,x]=(0,l.useState)(null),[j,g]=(0,l.useState)(""),[f,k]=(0,l.useState)(new Set),[b,y]=(0,l.useState)(""),N=async()=>{if(s.trim()){g("");try{let e=await t.FH.dirs(s,n);x(e),y("".concat(s,"|").concat(n)),k(new Set(e.filter(e=>!e.includes("/"))))}catch(e){g(e.message)}}};(0,l.useEffect)(()=>{x(null),y("")},[s,n]);let w=(0,l.useMemo)(()=>(function(e){let s=[],n=new Map;for(let l of[...e].sort()){var a;let e={path:l,name:null!=(a=l.split("/").pop())?a:l,children:[]};n.set(l,e);let t=l.includes("/")?n.get(l.slice(0,l.lastIndexOf("/"))):void 0;(t?t.children:s).push(e)}return s})(null!=v?v:[]),[v]),C=m.map(i).filter(Boolean),S=h.map(i).filter(Boolean),F=e=>(0,a.jsx)("ul",{className:"dir-tree",children:e.map(e=>{let s=d(e.path,C,S),n=f.has(e.path),l=function(e,s,n){let a=s=>s.filter(s=>s!==e&&c(s,e)).length;return{included:a(s),excluded:a(n)}}(e.path,C,S),t=!n&&e.children.length>0&&(l.included>0||l.excluded>0);return(0,a.jsxs)("li",{className:"dir ".concat(s),children:[(0,a.jsxs)("div",{className:"dir-row",children:[e.children.length>0?(0,a.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,a.jsx)("span",{className:"dir-flip","aria-hidden":"true"}),(0,a.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,a.jsx)("span",{className:"dir-mark","aria-hidden":"true",children:"in"===s?"✓":"inherited"===s?"\xb7":"out"===s||"out-inherited"===s?"\xd7":""}),e.name]}),(0,a.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"),"aria-label":"".concat("out"===s?p("tree.unexclude"):p("tree.exclude"),": ").concat(e.path),children:"−"}),t&&(0,a.jsx)("span",{className:"chip inside".concat(l.excluded>0?" out":""),title:p("tree.insideWhy"),children:l.excluded>0&&l.included>0?p("tree.insideBoth",{i:l.included,e:l.excluded}):l.excluded>0?p("tree.insideOut",{n:l.excluded}):p("tree.insideIn",{n:l.included})})]}),n&&e.children.length>0&&F(e.children)]},e.path)})}),D=b!=="".concat(s,"|").concat(n);return(0,a.jsxs)("div",{className:"dir-tree-box",children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("button",{type:"button",onClick:()=>void N(),disabled:!s.trim(),children:null===v||D?p("tree.load"):p("tree.reload")}),(0,a.jsx)("span",{className:"muted small",children:p("tree.hint")})]}),j&&(0,a.jsx)("div",{className:"err small",children:j}),(0,a.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!==v&&!D&&(0===v.length?(0,a.jsx)("p",{className:"muted small",children:p("mirror.noDirs")}):F(w))]})}},4269:(e,s,n)=>{"use strict";n.r(s),n.d(s,{default:()=>S});var a=n(3365),l=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 v=n(1205),x=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),C=n(7527);function S(){return(0,a.jsx)(l.Suspense,{fallback:null,children:(0,a.jsx)(F,{})})}function F(){var e;let{t:s}=(0,d.kj)(),n=null!=(e=(0,t.useSearchParams)().get("id"))?e:"",[r,o]=(0,l.useState)(null),[m,h]=(0,l.useState)([]),[u,p]=(0,l.useState)([]),[v,x]=(0,l.useState)(null),[j,g]=(0,l.useState)(""),[f,k]=(0,l.useState)(!1),b=(0,l.useRef)(null),y=(0,l.useRef)(0),N=(0,l.useCallback)(async()=>{if(!n)return;let e=++y.current;try{let s=await c.FH.session(n);if(e!==y.current)return;o(s),g("")}catch(s){if(e!==y.current)return;g(s.message)}},[n]),w=(0,l.useCallback)(()=>{b.current||(b.current=window.setTimeout(()=>{b.current=null,N()},400))},[N]);if((0,l.useEffect)(()=>{if(!n)return;c.FH.presets().then(p).catch(()=>void 0),c.FH.level1().then(x).catch(()=>void 0);let e=new EventSource(c.FH.streamUrl(n));return e.onopen=()=>k(!1),e.onmessage=e=>{let s;try{s=JSON.parse(e.data)}catch(e){return}"ping"!==s.type&&(h(e=>[...e.slice(-400),s]),w())},e.onerror=()=>{e.readyState===EventSource.CLOSED&&k(!0)},()=>{e.close()}},[n,w]),(0,C.z)(N,8e3,!!n),!n)return(0,a.jsx)("div",{className:"panel err",children:s("session.noId")});if(j&&!r)return(0,a.jsx)("div",{className:"panel err",children:j});if(!r)return(0,a.jsx)("div",{className:"panel muted",children:s("home.loading")});let S=r.tasks.filter(e=>"queued"===e.status).length;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"crumbs",children:[(0,a.jsx)(i(),{href:"/",children:s("session.crumb")})," / ",r.name]}),j&&(0,a.jsx)("div",{className:"panel err",role:"alert",children:s("session.stale",{err:j})}),f&&!j&&(0,a.jsx)("div",{className:"panel muted small",role:"status",children:s("session.streamClosed")}),(0,a.jsx)(D,{session:r,queued:S,onChange:N}),(0,a.jsx)(z,{tasks:r.tasks}),(0,a.jsx)(I,{session:r,onChange:N}),(0,a.jsx)(H,{level1:v,sent:r.contractSent}),(0,a.jsx)(T,{session:r,onChange:N}),(0,a.jsx)(M,{session:r,onChange:N}),(0,a.jsx)(P,{session:r,onChange:N}),(0,a.jsxs)("div",{className:"panel",children:[(0,a.jsx)("h2",{children:s("tasks.title")}),(0,a.jsx)("p",{className:"muted small",children:s("tasks.hint")}),(0,a.jsx)(W,{session:r,onChange:N}),0===r.tasks.length&&(0,a.jsx)("div",{className:"muted",children:s("tasks.none")}),r.tasks.map((e,s)=>(0,a.jsx)(B,{session:r,task:e,index:s+1,presets:u,onChange:N},e.id))]}),(0,a.jsx)(O,{session:r}),(0,a.jsx)(A,{session:r,presets:u,onAdded:N,onPresetsChanged:()=>c.FH.presets().then(p)}),(0,a.jsx)(U,{events:m})]})}function D(e){var s;let{session:n,queued:t,onChange:r}=e,{t:i}=(0,d.kj)(),[o,m]=(0,l.useState)(""),[h,u]=(0,l.useState)("");(0,l.useEffect)(()=>{c.FH.models().then(e=>{var s;return u(null!=(s=e.defaultModel)?s:"")}).catch(()=>void 0)},[]);let[p,v]=(0,l.useState)(n.name),[x,j]=(0,l.useState)(null!=(s=n.conversationGroup)?s:"");(0,l.useEffect)(()=>v(n.name),[n.name]),(0,l.useEffect)(()=>{var e;return j(null!=(e=n.conversationGroup)?e:"")},[n.conversationGroup]);let g=(0,N.p)(),[f,k]=(0,l.useState)(!1),y=(0,l.useRef)(!1),w=async e=>{if(!y.current){y.current=!0,k(!0);try{await e()}catch(e){m(e.message)}finally{y.current=!1,k(!1),r()}}},C=async e=>{("unattended"!==e||g||await (0,b.Z)(i("session.unattendedConfirm")))&&await w(async()=>{var s;let a=await c.FH.start(n.id,e,n.planName);m(a.started?i("unattended"===e?"session.startedAuto":"session.startedStep"):i("session.notStarted",{reason:null!=(s=a.reason)?s:""}))})},S=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)}},F=async()=>{var e;if(x.trim()!==(null!=(e=n.conversationGroup)?e:""))try{await c.FH.updateSession(n.id,{conversationGroup:x.trim()}),m(i("session.groupSaved")),r()}catch(e){m(e.message)}},D=n.running?i("state.running"):i("state.".concat(n.status));return(0,a.jsxs)("div",{className:"panel",children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("input",{type:"text",className:"grow","aria-label":i("home.col.name"),value:p,onChange:e=>v(e.target.value),onBlur:()=>void w(async()=>{p.trim()&&p!==n.name&&await c.FH.updateSession(n.id,{name:p})})}),(0,a.jsx)("span",{className:"badge ".concat(n.running?"running":""),children:D})]}),!n.running&&(0,a.jsxs)("div",{className:"run-choice",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("button",{className:"primary",onClick:()=>void C("unattended"),disabled:f||0===t,children:i("session.run",{n:t})}),(0,a.jsx)("p",{className:"why",children:i("session.runWhy")})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("button",{onClick:()=>void C("confirm"),disabled:f||0===t,children:i("session.runStep")}),(0,a.jsx)("p",{className:"why",children:i("session.runStepWhy")})]})]}),(0,a.jsxs)("div",{className:"row",style:{marginTop:10},children:[n.running&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{className:"danger",onClick:()=>void w(async()=>{await c.FH.stop(n.id),m(i("session.stopping"))}),disabled:f,children:i("session.stop")}),"unattended"===n.runMode&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"badge waiting-approval",children:i("session.modeUnattended")}),(0,a.jsx)("button",{onClick:()=>void w(async()=>{await c.FH.setRunMode(n.id,"confirm"),m(i("session.askingAgain"))}),disabled:f,children:i("session.askAgain")})]})]}),(0,a.jsx)("span",{className:"muted small",children:o}),(0,a.jsx)("span",{className:"grow"}),(0,a.jsx)("button",{className:"quiet",onClick:()=>void S(),disabled:n.running,children:i("home.delete")}),n.chat?(0,a.jsx)("a",{href:n.chat.url,target:"_blank",rel:"noreferrer",className:"small",children:i("session.openChat",{name:n.chat.name})}):(0,a.jsx)("span",{className:"muted small",children:i("session.noChat")})]}),(0,a.jsx)("label",{htmlFor:"session-group",children:i("session.group")}),(0,a.jsx)("div",{className:"row",children:(0,a.jsx)("input",{id:"session-group",type:"text",className:"grow",value:x,placeholder:i("session.groupPlaceholder"),onChange:e=>j(e.target.value),onBlur:()=>void F(),disabled:n.running})}),(0,a.jsxs)("p",{className:"why",children:[i("session.groupWhy"),n.chat&&" ".concat(i("session.groupHasChat"))]}),(0,a.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,a.jsx)("span",{className:"err",children:i("session.noFiles")})]})]})}function H(e){var s;let{level1:n,sent:l}=e,{t}=(0,d.kj)();return(0,a.jsxs)("div",{className:"panel",children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("h2",{className:"grow",style:{margin:0},children:t("l1.title")}),(0,a.jsx)("span",{className:"badge",children:t(l?"l1.sent":"l1.notSent")}),(0,a.jsx)(i(),{href:"/level1",className:"small",children:t("l1.edit")})]}),(0,a.jsxs)("p",{className:"muted small",style:{marginBottom:6},children:[t("l1.hint"),(null==n?void 0:n.customised)?" ".concat(t("l1.customised")):""]}),(0,a.jsxs)("details",{children:[(0,a.jsx)("summary",{children:t("l1.show")}),(0,a.jsx)("pre",{className:"tall",children:null!=(s=null==n?void 0:n.content)?s:"…"})]})]})}function I(e){var s,n,t,r;let{session:i,onChange:o}=e,{t:m}=(0,d.kj)(),h=(0,d.W3)(),[u,p]=(0,l.useState)(null),[v,j]=(0,l.useState)(!1),[g,f]=(0,l.useState)("");(0,l.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,a.jsxs)("div",{className:"panel",children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("h2",{className:"grow",style:{margin:0},children:m("model.title")}),i.modelInUse&&(0,a.jsx)("span",{className:"chip",children:m("model.lastUsed",{name:i.modelInUse})})]}),(0,a.jsx)("p",{className:"muted small",children:m("model.hint")}),(0,a.jsxs)("div",{className:"row",children:[(0,a.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,a.jsx)("option",{value:"",children:(null==u?void 0:u.defaultModel)?m("model.followsDefault",{name:u.defaultModel}):m("model.default")}),w&&!S&&(0,a.jsx)("option",{value:w,children:m("model.notInList",{name:w})}),F.map(e=>(0,a.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,a.jsx)("optgroup",{label:s,children:n.map(e=>(0,a.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(m("model.unavailable")):""]},e.name))},s)})]}),(0,a.jsx)("button",{onClick:()=>void N(),disabled:v||i.running,children:m("model.refresh")}),(0,a.jsx)("span",{className:"muted small",role:"status",children:g})]}),(0,a.jsx)(x.L,{current:w,onUse:e=>void k(e)}),(0,a.jsxs)("div",{className:"row",style:{marginTop:8},children:[(0,a.jsx)("span",{className:"muted small",children:(null==u?void 0:u.defaultModel)?m("model.defaultIs",{name:u.defaultModel}):m("model.defaultIsNone")}),(0,a.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,a.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,a.jsx)("p",{className:"muted small",style:{marginTop:8},children:m("model.neverRead")}),C.length>0&&(0,a.jsxs)("details",{children:[(0,a.jsx)("summary",{children:m("model.showDetails")}),(0,a.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 M(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,l.useState)(o.enabled),[u,p]=(0,l.useState)(null!=(n=o.model)?n:""),[v,g]=(0,l.useState)(""),[f,k]=(0,l.useState)(!1),[b,y]=(0,l.useState)("");(0,l.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,a.jsxs)("div",{className:"panel",children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("h2",{className:"grow",style:{margin:0},children:i("review.title")}),(0,a.jsx)("span",{className:"badge ".concat(m?"done":""),children:m?i("review.on"):i("review.off")})]}),(0,a.jsx)("p",{className:"muted small",children:i("review.hint")}),(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"checkbox",checked:m,onChange:e=>h(e.target.checked),disabled:t.running}),(0,a.jsx)("span",{children:i("review.enable")})]}),(0,a.jsx)("p",{className:"why",children:i("review.enableWhy")})]}),(0,a.jsx)("label",{htmlFor:"review-model",children:i("review.modelField")}),(0,a.jsx)("div",{className:"row",children:(0,a.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,a.jsx)("p",{className:"why",children:i("review.modelWhy")}),(0,a.jsx)(x.z4,{current:u,onUse:e=>p(e)}),(0,a.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,a.jsx)("button",{className:"primary",onClick:()=>void N(),disabled:f||t.running,children:i("review.save")}),v&&(0,a.jsx)("span",{className:"muted small",children:v})]})]})}function T(e){var s,n,t,r,i,o,m,h,u;let{session:p,onChange:v}=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,l.useState)(g.repoDir),[b,y]=(0,l.useState)(null),[N,w]=(0,l.useState)(""),[C,S]=(0,l.useState)(!1),F=JSON.stringify(g),[D,H]=(0,l.useState)(null),[I,M]=(0,l.useState)(null!=(t=g.branchName)?t:"");(0,l.useEffect)(()=>{var e;return M(null!=(e=JSON.parse(F).branchName)?e:"")},[F]);let[T,P]=(0,l.useState)(null!=(r=g.baseBranch)?r:"");(0,l.useEffect)(()=>{var e;return P(null!=(e=JSON.parse(F).baseBranch)?e:"")},[F]);let L=null!=(i=g.startFrom)?i:"head";(0,l.useEffect)(()=>{k(JSON.parse(F).repoDir)},[F]);let W=JSON.parse(F).repoDir||p.mirror.rootDir||"";(0,l.useEffect)(()=>{let e=!1;return W.trim()?(c.FH.repoCheck(W).then(s=>{var n;e||H(s.ok?null:null!=(n=s.problem)?n:null)}).catch(()=>{e||H(null)}),()=>{e=!0}):void H(null)},[W]);let R=(0,l.useCallback)(()=>{c.FH.vcsStatus(p.id).then(y).catch(()=>y(null))},[p.id]);(0,l.useEffect)(R,[R,F]);let O=async e=>{try{await c.FH.updateSession(p.id,{vcs:e}),w(j("vcs.saved")),v(),R()}catch(e){w(e.message)}},E=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 O({repoDir:s.path});else{var e;w(s.cancelled?j("mirror.browseCancelled"):null!=(e=s.reason)?e:"")}}catch(e){w(e.message)}finally{S(!1)}},A=g.repoDir||p.mirror.rootDir||"",B=""!==A.trim()&&null===D;return(0,a.jsxs)("div",{className:"panel",children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("h2",{className:"grow",style:{margin:0},children:j("vcs.title")}),(0,a.jsx)("span",{className:"badge ".concat(g.enabled?"done":""),children:g.enabled?j("vcs.on"):j("vcs.off")})]}),(0,a.jsx)("p",{className:"muted small",children:j("vcs.hint")}),(0,a.jsx)("label",{htmlFor:"vcs-root",children:j("vcs.repoField")}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("input",{id:"vcs-root",type:"text",className:"grow",value:f,onChange:e=>k(e.target.value),onBlur:()=>f.trim()!==g.repoDir&&void O({repoDir:f.trim()}),placeholder:p.mirror.rootDir||"C:\\Projects\\my-app",disabled:p.running}),(0,a.jsx)("button",{onClick:()=>void E(),disabled:C||p.running,children:j("mirror.browse")})]}),(0,a.jsx)(x.H4,{current:f,onUse:e=>{k(e),O({repoDir:e})}}),D&&(0,a.jsxs)("div",{className:"notice caution",style:{marginTop:8},children:[(0,a.jsx)("strong",{children:j("vcs.noRepo")}),(0,a.jsx)("div",{className:"small",style:{marginTop:4},children:D}),(0,a.jsx)("div",{className:"muted small",style:{marginTop:6},children:j("vcs.noRepoHow")})]}),!D&&""!==A.trim()&&(0,a.jsx)("p",{className:"muted small",style:{marginTop:4},children:j("vcs.repoOk")}),""===A.trim()&&(0,a.jsx)("p",{className:"muted small",style:{marginTop:4},children:j("vcs.pickFirst")}),(0,a.jsxs)("div",{className:"option".concat(B||g.enabled?"":" warned"),children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"checkbox",checked:g.enabled,onChange:e=>void O({enabled:e.target.checked}),disabled:p.running||!B&&!g.enabled}),(0,a.jsx)("span",{children:j("vcs.enable")})]}),(0,a.jsx)("p",{className:"why",children:j("vcs.enableWhy")})]}),g.enabled&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"muted small",style:{marginTop:4},children:A?j("vcs.repoIs",{dir:A}):j("vcs.repoNone")}),(0,a.jsx)("h3",{children:j("vcs.branches")}),(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"radio",name:"branchMode",checked:"per-task"===g.branchMode,onChange:()=>void O({branchMode:"per-task"}),disabled:p.running}),(0,a.jsx)("span",{children:j("vcs.perTask")})]}),(0,a.jsx)("p",{className:"why",children:j("vcs.perTaskWhy")})]}),(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"radio",name:"branchMode",checked:"per-session"===g.branchMode,onChange:()=>void O({branchMode:"per-session"}),disabled:p.running}),(0,a.jsx)("span",{children:j("vcs.perSession")})]}),(0,a.jsx)("p",{className:"why",children:j("vcs.perSessionWhy")})]}),"per-session"===g.branchMode&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("label",{htmlFor:"vcs-branch-name",children:j("vcs.branchName")}),(0,a.jsx)("input",{id:"vcs-branch-name",type:"text",value:I,onChange:e=>M(e.target.value),onBlur:()=>{var e;return I.trim()!==(null!=(e=g.branchName)?e:"")&&void O({branchName:I.trim()})},placeholder:p.name,disabled:p.running}),(0,a.jsx)("p",{className:"why",children:j("vcs.branchNameWhy")})]}),(0,a.jsx)("h3",{children:j("vcs.startFrom")}),(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"radio",name:"startFrom",checked:"branch"===L,onChange:()=>void O({startFrom:"branch"}),disabled:p.running}),(0,a.jsx)("span",{children:j("vcs.startBranch")})]}),(0,a.jsx)("p",{className:"why",children:j("vcs.startBranchWhy")})]}),(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"radio",name:"startFrom",checked:"previous-session"===L,onChange:()=>void O({startFrom:"previous-session"}),disabled:p.running}),(0,a.jsx)("span",{children:j("vcs.startPrevious")})]}),(0,a.jsx)("p",{className:"why",children:j("vcs.startPreviousWhy")})]}),(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"radio",name:"startFrom",checked:"head"===L,onChange:()=>void O({startFrom:"head"}),disabled:p.running}),(0,a.jsx)("span",{children:j("vcs.startHead")})]}),(0,a.jsx)("p",{className:"why",children:j("vcs.startHeadWhy")})]}),"head"!==L&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("label",{htmlFor:"vcs-base-branch",children:j("vcs.baseBranch")}),(0,a.jsx)("input",{id:"vcs-base-branch",type:"text",value:T,onChange:e=>P(e.target.value),onBlur:()=>{var e;return T.trim()!==(null!=(e=g.baseBranch)?e:"")&&void O({baseBranch:T.trim()})},placeholder:"main",disabled:p.running}),(0,a.jsx)("p",{className:"why",children:j("vcs.baseBranchWhy")})]}),p.vcsStart&&(0,a.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,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"checkbox",checked:g.commitOnFinish,onChange:e=>void O({commitOnFinish:e.target.checked}),disabled:p.running}),(0,a.jsx)("span",{children:j("vcs.commit")})]}),(0,a.jsx)("p",{className:"why",children:j("vcs.commitWhy")})]}),b&&!b.ok&&(0,a.jsxs)("div",{className:"notice caution",role:"status",children:[(0,a.jsx)("strong",{children:j("vcs.notReady")})," ",b.problem]}),(null==b?void 0:b.ok)&&(0,a.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,a.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,a.jsx)("ul",{style:{margin:"4px 0",paddingLeft:20},children:b.work.branches.map(e=>(0,a.jsxs)("li",{children:[(0,a.jsx)("code",{children:e.branch})," — ",e.title,e.commit?"":" (".concat(j("vcs.taskNoFiles"),")")]},e.branch))})]}),(0,a.jsx)("p",{className:"muted small",children:j("vcs.pushIsYours")})]}),(0,a.jsx)("div",{className:"muted small",role:"status",children:N})]})}function P(e){var s,n,t,r;let{session:i,onChange:o}=e,{t:m}=(0,d.kj)(),[h,v]=(0,l.useState)(i.mirror.enabled),[j,f]=(0,l.useState)(i.mirror.rootDir),[k,y]=(0,l.useState)(i.mirror.includeDirs.join("\n")),[N,w]=(0,l.useState)(i.mirror.excludeDirs.join("\n")),[C,S]=(0,l.useState)(null==(s=i.mirror.respectGitignore)||s),[F,D]=(0,l.useState)(null!=(n=i.mirror.includeEnvFiles)&&n),[H,I]=(0,l.useState)(null),[M,T]=(0,l.useState)(null),[P,W]=(0,l.useState)(""),[R,O]=(0,l.useState)(""),[E,A]=(0,l.useState)([]),B=JSON.stringify(i.mirror);(0,l.useEffect)(()=>{var e,s;let n=JSON.parse(B);v(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)},[B]),(0,l.useEffect)(()=>{c.FH.doctor().then(e=>{var s;return A(null!=(s=e.alwaysIgnoredDirs)?s:[])}).catch(()=>void 0)},[]);let U=p(k),G=p(N),z=function(e,s){let n=e.map(u).filter(Boolean),a=s.map(u).filter(Boolean),l=[];for(let e of n)for(let s of a)if(e.toLowerCase()===s.toLowerCase())l.push({include:e,exclude:s,kind:"same"});else("."===s?"."!==e:e.toLowerCase().startsWith("".concat(s.toLowerCase(),"/")))&&l.push({include:e,exclude:s,kind:"excluded-parent"});return l}(U,G),q={rootDir:j.trim(),includeDirs:U,excludeDirs:G,respectGitignore:C,includeEnvFiles:F},J=h&&!q.rootDir,Z=z.length>0||J,_=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,...q}),Y=async()=>{if(!Z)try{await c.FH.updateSession(i.id,{mirror:{enabled:h,...q}}),O(m("mirror.saved")),o()}catch(e){O(e.message)}},$=async()=>{try{I(await c.FH.dirs(j,C)),O("")}catch(e){O(e.message)}},Q=async()=>{W("browse"),O(m("mirror.browsing"));try{let s=await c.FH.browseFolder(j.trim()||void 0);if(s.ok)f(s.path),I(null),T(null),O("");else{var e;O(s.cancelled?m("mirror.browseCancelled"):null!=(e=s.reason)?e:"")}}catch(e){O(e.message)}finally{W("")}},V=async()=>{if(!q.rootDir)return void O(m("mirror.needRoot"));W("check"),O(m("mirror.checking"));try{T(await c.FH.previewMirror(q)),O("")}catch(e){T(null),O(e.message)}finally{W("")}},X=async e=>{(!e||await (0,b.Z)(m("mirror.envWarn")))&&(D(e),T(null))};return(0,a.jsxs)("div",{className:"panel",children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("h2",{className:"grow",style:{margin:0},children:m("mirror.title")}),(0,a.jsx)("span",{className:"badge ".concat(i.mirror.enabled?"done":""),children:i.mirror.enabled?m("mirror.stateOn"):m("mirror.stateOff")})]}),(0,a.jsx)("p",{className:"muted small",children:m("mirror.hint",{example:"src--test--a.spec.ts.txt"})}),(0,a.jsx)("div",{className:"option",children:(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"checkbox",checked:h,onChange:e=>v(e.target.checked)}),(0,a.jsx)("span",{children:m("mirror.enable")})]})}),(0,a.jsx)("label",{htmlFor:"mirror-root",children:m("mirror.root")}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("input",{id:"mirror-root",type:"text",className:"grow",value:j,onChange:e=>{f(e.target.value),T(null)},placeholder:"C:\\Projects\\my-app"}),(0,a.jsx)("button",{onClick:()=>void Q(),disabled:"browse"===P,children:m("mirror.browse")}),(0,a.jsx)("button",{onClick:()=>void $(),disabled:!j.trim(),children:m("mirror.listDirs")})]}),(0,a.jsx)("div",{className:"muted small",style:{marginTop:4},children:m("mirror.rootHint")}),(0,a.jsx)(x.H4,{current:j,onUse:e=>{f(e),T(null)}}),H&&(0,a.jsx)("div",{className:"small muted",style:{margin:"6px 0"},children:0===H.length?m("mirror.noDirs"):H.join(" \xb7 ")}),(0,a.jsx)("h3",{children:m("mirror.rules")}),(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"checkbox",checked:C,onChange:e=>{S(e.target.checked),T(null)}}),(0,a.jsx)("span",{children:m("mirror.gitignore")})]}),(0,a.jsx)("p",{className:"why",children:m("mirror.gitignoreWhy")})]}),(0,a.jsxs)("div",{className:"option".concat(F?" warned":""),children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"checkbox",checked:F,onChange:e=>X(e.target.checked)}),(0,a.jsx)("span",{children:m("mirror.env")})]}),(0,a.jsx)("p",{className:"why",children:m("mirror.envWhy")}),F&&(0,a.jsx)("p",{className:"why",children:(0,a.jsx)("strong",{children:m("mirror.envOn")})})]}),E.length>0&&(0,a.jsx)("p",{className:"muted small",children:m("mirror.alwaysOut",{dirs:E.join(", ")})}),(0,a.jsxs)("div",{className:"row",style:{alignItems:"flex-start"},children:[(0,a.jsxs)("div",{className:"grow",children:[(0,a.jsx)("label",{htmlFor:"mirror-include",children:m("mirror.include")}),(0,a.jsx)("textarea",{id:"mirror-include",value:k,onChange:e=>{y(e.target.value),T(null)},placeholder:"src\ntests",style:{minHeight:80},"aria-invalid":z.length>0})]}),(0,a.jsxs)("div",{className:"grow",children:[(0,a.jsx)("label",{htmlFor:"mirror-exclude",children:m("mirror.exclude")}),(0,a.jsx)("textarea",{id:"mirror-exclude",value:N,onChange:e=>{w(e.target.value),T(null)},placeholder:"src/generated",style:{minHeight:80},"aria-invalid":z.length>0})]})]}),(0,a.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")),T(null)}}),z.length>0&&(0,a.jsxs)("div",{className:"notice",role:"alert",children:[(0,a.jsx)("strong",{children:m("mirror.conflict")}),(0,a.jsx)("ul",{children:z.map((e,s)=>(0,a.jsx)("li",{children:"same"===e.kind?m("mirror.conflictSame",{dir:e.include}):m("mirror.conflictParent",{include:e.include,exclude:e.exclude})},s))}),(0,a.jsx)("div",{style:{marginTop:6},children:m("mirror.conflictFix")})]}),J&&(0,a.jsx)("div",{className:"notice caution",role:"alert",children:(0,a.jsx)("strong",{children:m("mirror.needRoot")})}),K!==_&&(0,a.jsxs)("div",{className:"notice caution",role:"status",children:[(0,a.jsx)("strong",{children:m("mirror.unsaved")})," ",m("mirror.unsavedWhy")]}),(0,a.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,a.jsx)("button",{className:"primary",onClick:()=>void Y(),disabled:Z,children:m("mirror.save")}),(0,a.jsx)("button",{onClick:()=>void V(),disabled:z.length>0||"check"===P,children:m("mirror.check")}),(0,a.jsx)("span",{className:"muted small",role:"status",children:R})]}),M&&(0,a.jsx)(L,{preview:M})]})}function L(e){let{preview:s}=e,{t:n}=(0,d.kj)();return 0===s.files.length?(0,a.jsx)("div",{className:"notice caution",style:{marginTop:10},children:(0,a.jsx)("strong",{children:n("mirror.checkedNone")})}):(0,a.jsxs)("div",{className:"notice calm",style:{marginTop:10},children:[(0,a.jsx)("strong",{children:n("mirror.checked",{files:s.files.length,size:(0,c.zi)(s.totalBytes)})})," ",s.envFiles.length>0&&(0,a.jsx)("span",{className:"err",children:n("mirror.checkedEnv",{n:s.envFiles.length})})," ",s.skipped.length>0&&(0,a.jsx)("span",{className:"muted",children:n("mirror.checkedSkipped",{n:s.skipped.length})}),(0,a.jsxs)("details",{style:{marginTop:6},children:[(0,a.jsx)("summary",{children:n("mirror.showFiles")}),(0,a.jsx)("pre",{className:"tall",children:s.files.join("\n")})]}),s.skipped.length>0&&(0,a.jsxs)("details",{children:[(0,a.jsx)("summary",{children:n("mirror.showSkipped")}),(0,a.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,l.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,a.jsxs)("fieldset",{style:{border:0,padding:0,margin:"10px 0 14px"},children:[(0,a.jsx)("legend",{className:"muted small",style:{padding:0},children:r("chain.title")}),(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"radio",name:"chain",checked:"stop"===m,onChange:()=>void h("stop"),disabled:n.running}),(0,a.jsx)("span",{children:r("chain.stop")})]}),(0,a.jsx)("p",{className:"why",children:r("chain.stopWhy")})]}),(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"radio",name:"chain",checked:"continue"===m,onChange:()=>void h("continue"),disabled:n.running}),(0,a.jsx)("span",{children:r("chain.continue")})]}),(0,a.jsx)("p",{className:"why",children:r("chain.continueWhy")})]}),i&&(0,a.jsx)("div",{className:"muted small",role:"status",children:i}),n.running&&(0,a.jsx)("div",{className:"muted small",children:r("chain.locked")})]})}function R(e){let{value:s,onChange:n,presets:t,onPresetsChanged:r}=e,{t:i}=(0,d.kj)(),[o,m]=(0,l.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,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("label",{className:"grow",style:{margin:0},children:i("l2.label")}),(0,a.jsxs)("select",{value:"",onChange:e=>{let s=t.find(s=>s.name===e.target.value);s&&n(s.content)},children:[(0,a.jsx)("option",{value:"",children:i("l2.loadPreset")}),t.map(e=>(0,a.jsx)("option",{value:e.name,children:e.name},e.name))]}),(0,a.jsx)("button",{onClick:()=>void h(),disabled:!s.trim(),children:i("l2.saveAs")})]}),(0,a.jsx)("textarea",{className:"prose",value:s,onChange:e=>n(e.target.value),placeholder:i("l2.placeholder"),style:{minHeight:140,marginTop:10}}),o&&(0,a.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,l.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,a.jsxs)("div",{className:"panel",children:[(0,a.jsx)("h2",{children:n("export.title")}),(0,a.jsx)("p",{className:"muted small",children:n("export.hint")}),0===r.length?(0,a.jsx)("div",{className:"empty",children:n("export.nothing")}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"row",style:{marginBottom:6},children:[(0,a.jsx)("button",{className:"quiet",onClick:()=>o(r.map(e=>e.id)),children:n("export.all")}),(0,a.jsx)("button",{className:"quiet",onClick:()=>o([]),children:n("export.none")}),(0,a.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,l,r,c,d;return(0,a.jsx)("div",{className:"option",style:{margin:"6px 0"},children:(0,a.jsxs)("label",{children:[(0,a.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,a.jsxs)("span",{children:[e.title," ",(0,a.jsx)("span",{className:"badge ".concat(e.status),children:n("status.".concat(e.status))})," ",e.readOnly&&(0,a.jsx)("span",{className:"chip",children:n("task.readOnly")})," ",(null!=(l=null==(s=e.scope)?void 0:s.length)?l:0)>0&&(0,a.jsx)("span",{className:"chip",children:n("task.scope",{paths:(null!=(r=e.scope)?r:[]).join(", ")})})," ",(0,a.jsx)("span",{className:"muted small",children:t(null!=(d=null!=(c=e.finishedAt)?c:e.startedAt)?d:e.createdAt)})]})]})},e.id)}),(0,a.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,a.jsx)("a",{className:"button-link",href:h("outcome"),download:!0,children:n("export.outcome",{n:m.length})}),(0,a.jsx)("a",{className:"button-link",href:h("full"),download:!0,children:n("export.full",{n:m.length})})]}),(0,a.jsx)("p",{className:"muted small",style:{marginTop:8},children:n("export.outcomeWhy")})]})]})}function E(e){let{handoff:s}=e,{t:n}=(0,d.kj)(),l=(e,s)=>(0,a.jsxs)("div",{className:"handoff-row",children:[(0,a.jsx)("strong",{children:n(e)})," ",s]}),t=e=>(0,a.jsx)("ul",{children:e.map((e,s)=>(0,a.jsx)("li",{children:e},s))}),r=s.validation.filter(e=>e.passed).length;return(0,a.jsxs)("div",{className:"summary handoff",children:[(0,a.jsx)("strong",{children:n("handoff.title")}),l("handoff.outcome",(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"badge ".concat(s.outcome.status),children:n("status.".concat(s.outcome.status))}),s.outcome.reason?" ".concat(s.outcome.reason):""]})),l("handoff.files",0===s.changedFiles.length?(0,a.jsx)("span",{className:"muted",children:n("handoff.noFiles")}):(0,a.jsx)("code",{children:s.changedFiles.map(e=>"".concat(e.path).concat(e.added>=0?" +".concat(e.added,"/-").concat(e.removed):"")).join(", ")})),s.validation.length>0&&l("handoff.validation",(0,a.jsxs)(a.Fragment,{children:[n("handoff.passed",{n:r,of:s.validation.length}),s.review?" \xb7 ".concat(n("handoff.review",{verdict:s.review.verdict,open:s.review.open})):""]})),l("handoff.issues",0===s.knownIssues.length?(0,a.jsx)("span",{className:"muted",children:n("handoff.noIssues")}):t(s.knownIssues)),s.evidence.runId&&l("handoff.evidence",(0,a.jsx)("code",{children:s.evidence.runId})),(s.vcs.branch||s.vcs.problem)&&l("handoff.vcs",(0,a.jsxs)(a.Fragment,{children:[s.vcs.branch&&(0,a.jsx)("code",{children:s.vcs.branch}),s.vcs.commit?" @ ".concat(s.vcs.commit.slice(0,8)," \xb7 ").concat(n("handoff.notPushed")):s.vcs.branch?" \xb7 ".concat(n("handoff.noCommit")):"",s.vcs.problem?" — ".concat(s.vcs.problem):""]})),s.manual.length>0&&l("handoff.manual",t(s.manual)),s.notExecuted.length>0&&l("handoff.notRun",t(s.notExecuted))]})}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,l.useState)(""),[p,v]=(0,l.useState)(null!=(s=null==m?void 0:m.level2)?s:""),[x,j]=(0,l.useState)(""),[g,f]=(0,l.useState)(""),[k,b]=(0,l.useState)(!1),y=(0,l.useRef)(!1),N=async()=>{if(!y.current){y.current=!0,b(!0);try{await c.FH.addTask(n.id,{title:h,level2:p,prompt:x}),u(""),j(""),f(o("form.queued")),r()}catch(e){f(e.message)}finally{y.current=!1,b(!1)}}};return(0,a.jsxs)("div",{className:"panel",id:"new-task",children:[(0,a.jsx)("h2",{children:o("form.title")}),(0,a.jsx)("p",{className:"muted small",children:o("form.hint")}),(0,a.jsx)("label",{htmlFor:"new-task-title",children:o("form.titleLabel")}),(0,a.jsx)("input",{id:"new-task-title",type:"text",value:h,onChange:e=>u(e.target.value),placeholder:o("form.titlePlaceholder")}),(0,a.jsx)("div",{style:{marginTop:10},children:(0,a.jsx)(R,{value:p,onChange:v,presets:t,onPresetsChanged:i})}),(0,a.jsx)("label",{htmlFor:"new-task-prompt",children:o("form.taskLabel")}),(0,a.jsx)("textarea",{id:"new-task-prompt",className:"prose",value:x,onChange:e=>j(e.target.value),placeholder:o("form.taskPlaceholder"),style:{minHeight:140}}),(0,a.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,a.jsx)("button",{className:"primary",onClick:()=>void N(),disabled:k||!x.trim(),children:o("form.add")}),(0,a.jsx)("span",{className:"muted small",children:g})]})]})}function B(e){var s,n,t,r,i,u,p,v,x,j,g,N,C,S,F,D,H,I,M,T,P,L,W,O,A,B,U,z,_,K,Y,$,Q,V,X,ee,es,en,ea,el,et,er,ei,ec,ed,eo,em,eh,eu,ep,ev,ex,ej,eg,ef,ek,eb,ey,eN,ew,eC,eS,eF,eD,eH,eI,eM,eT,eP,eL,eW,eR,eO;let{session:eE,task:eA,index:eB,presets:eU,onChange:eG}=e,{t:ez}=(0,d.kj)(),eq=(0,d.W3)(),[eJ,eZ]=(0,l.useState)(!1),[e_,eK]=(0,l.useState)(!1),[eY,e$]=(0,l.useState)(eA.title),[eQ,eV]=(0,l.useState)(eA.level2),[eX,e0]=(0,l.useState)(eA.prompt),[e1,e2]=(0,l.useState)(null!=($=null==(s=eA.vcsPlan)?void 0:s.branch)?$:""),[e4,e6]=(0,l.useState)(null!=(Q=null==(n=eA.vcsPlan)?void 0:n.commitMessage)?Q:""),[e8,e5]=(0,l.useState)(null!=(V=eA.checks)?V:[]),e3=(0,h.c)((0,m.DG)(eA)),[e7,e9]=(0,l.useState)(null),[se,ss]=(0,l.useState)(""),sn=async()=>{try{await c.FH.updateTask(eE.id,eA.id,{title:eY,level2:eQ,prompt:eX,vcsPlan:{branch:e1,commitMessage:e4},checks:e8}),eZ(!1),eG()}catch(e){ss(e.message)}},sa="running"===eA.status||"waiting-approval"===eA.status,sl=!sa&&"queued"!==eA.status,st=!sa&&"queued"!==eA.status,sr=!sa&&null!=(X=null==(t=eE.vcs)?void 0:t.enabled)&&X&&(!!(null==(r=eA.vcs)?void 0:r.baseCommit)||(null!=(ee=eA.attempts)?ee:[]).some(e=>{var s;return null==(s=e.vcs)?void 0:s.baseCommit})),si=!sa&&("limit-reached"===eA.status||"aborted"===eA.status),sc=async()=>{if(await (0,b.Z)(ez("task.continueConfirm",{title:eA.title})))try{await c.FH.continueTask(eE.id,eA.id),eG()}catch(e){ss(e.message)}},sd=async()=>{if(await (0,b.Z)(ez("task.rerunConfirm",{title:eA.title})))try{await c.FH.rerunTask(eE.id,eA.id),eG()}catch(e){ss(e.message)}},so=async()=>{if(await (0,b.Z)(ez("task.editRanConfirm",{title:eA.title})))try{await c.FH.rerunTask(eE.id,eA.id,{title:eY,level2:eQ,prompt:eX,vcsPlan:{branch:e1,commitMessage:e4},checks:e8},{buildOnFinished:"done"===eA.status}),eZ(!1),eG()}catch(e){ss(e.message)}},sm=(0,w.e)(eG),sh=async()=>{let e="queued"===eA.status?"task.deleteConfirm":"task.deleteConfirmRan";if(await (0,b.Z)(ez(e,{title:eA.title})))try{await c.FH.deleteTask(eE.id,eA.id),eG()}catch(e){ss(e.message)}},su=async()=>{try{e9(await c.FH.taskFiles(eE.id,eA.id))}catch(e){ss(e.message)}},sp=(e,s,n)=>n.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("span",{className:"muted",children:[ez(e)," "]}),n.map(e=>(0,a.jsx)("span",{style:{marginRight:10},children:(0,a.jsx)(o.u,{label:e,save:()=>c.FH.saveTaskFile(eE.id,eA.id,s,e)})},e))]});return(0,a.jsxs)("div",{className:"task ".concat(eA.status),id:eA.id,children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsxs)("h4",{className:"grow",children:[eB,". ",eA.title]}),(0,a.jsx)("span",{className:"badge ".concat(eA.status),children:ez("status.".concat(eA.status))}),(null!=(es=eA.attempt)?es:1)>1&&(0,a.jsx)("span",{className:"chip",children:ez("task.attemptN",{n:null!=(en=eA.attempt)?en:1})}),eA.iterations>0&&(0,a.jsx)("span",{className:"muted small",children:ez("task.iterations",{n:eA.iterations})}),eA.runId&&(0,a.jsxs)("button",{className:e_?"":"quiet","aria-expanded":e_,onClick:()=>eK(e=>!e),title:(0,m.DG)(eA)?ez("story.showLiveWhy"):ez("story.why"),children:[(0,m.DG)(eA)&&!e_&&(0,a.jsx)("span",{className:"dot","aria-hidden":"true"}),e_?ez("story.hide"):(0,m.DG)(eA)?ez("story.showLive"):ez("story.show")]}),!sa&&(0,a.jsx)("button",{onClick:()=>{if(!eJ){var e,s,n,a,l;e$(eA.title),eV(eA.level2),e0(eA.prompt),e2(null!=(n=null==(e=eA.vcsPlan)?void 0:e.branch)?n:""),e6(null!=(a=null==(s=eA.vcsPlan)?void 0:s.commitMessage)?a:""),e5(null!=(l=eA.checks)?l:[])}eZ(!eJ)},title:ez("task.editAll"),children:eJ?ez("task.cancel"):ez("task.edit")}),si&&(0,a.jsx)("button",{className:"primary",onClick:()=>void sc(),title:ez("task.continueWhy"),children:ez("task.continue")}),st&&(0,a.jsx)("button",{className:si?"":"primary",onClick:()=>void sd(),title:ez("task.rerunWhy"),children:ez("task.rerun")}),sr&&(0,a.jsx)("button",{onClick:()=>void sm.restore({sessionId:eE.id,taskId:eA.id,title:eA.title}),disabled:""!==sm.busy||eE.running,title:ez("restore.why"),children:"restore"===sm.busy?ez("restore.checking"):ez("restore.button")}),sl&&(0,a.jsx)("button",{onClick:()=>void sm.restartFrom({sessionId:eE.id,taskId:eA.id,title:eA.title}),disabled:""!==sm.busy||eE.running,title:ez("restart.why"),children:"restart"===sm.busy?ez("restart.checking"):ez("restart.button")}),!sa&&(0,a.jsx)("button",{className:"danger",onClick:()=>void sh(),children:ez("task.delete")}),!eJ&&(se||sm.message)&&(0,a.jsx)("span",{className:"err",role:"alert",children:se||sm.message})]}),(0,a.jsxs)("div",{className:"muted small",children:[eA.startedAt?ez("task.started",{t:eq(eA.startedAt)}):ez("task.added",{t:eq(eA.createdAt)}),eA.finishedAt?" \xb7 ".concat(ez("task.finished",{t:eq(eA.finishedAt)})):"",eA.startedAt&&eA.finishedAt?" \xb7 ".concat(ez("task.took",{d:(0,c.c5)((0,m.d5)(eA.startedAt,eA.finishedAt))})):"",(0,m.DG)(eA)?" \xb7 ".concat(ez("task.runningFor",{d:(0,c.c5)((0,m.d5)(eA.startedAt,void 0,e3))})):""]}),"queued"!==eA.status&&(null==(i=eE.vcs)?void 0:i.enabled)&&eA.vcs&&(0,a.jsx)("div",{className:"muted small",children:eA.vcs.problem&&!eA.vcs.branch?(0,a.jsx)("span",{className:"reason",children:ez("vcs.taskProblem",{problem:eA.vcs.problem})}):(0,a.jsxs)(a.Fragment,{children:[eA.vcs.branch&&ez("vcs.taskBranch",{branch:eA.vcs.branch}),eA.vcs.baseCommit&&" \xb7 ".concat(ez("vcs.taskBase",{commit:eA.vcs.baseCommit.slice(0,8)})),eA.vcs.commit?" \xb7 ".concat(ez("vcs.taskCommit",{commit:eA.vcs.commit.slice(0,8)})):" \xb7 ".concat(ez("vcs.taskNoFiles")),(null!=(ea=null==(u=eA.vcs.files)?void 0:u.length)?ea:0)>0&&(0,a.jsxs)("details",{style:{display:"inline"},children:[(0,a.jsxs)("summary",{style:{display:"inline",cursor:"pointer"},children:[" \xb7 ",ez("vcs.taskFiles",{n:null!=(el=null==(p=eA.vcs.files)?void 0:p.length)?el:0})]}),(0,a.jsx)("ul",{style:{margin:"4px 0 4px 0",paddingLeft:20},children:(null!=(et=eA.vcs.files)?et:[]).map(e=>(0,a.jsxs)("li",{children:[(0,a.jsx)("code",{children:e.path})," ",e.added<0||e.removed<0?ez("vcs.taskBinary"):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("span",{style:{color:"var(--ok)"},children:["+",e.added]})," ",(0,a.jsxs)("span",{style:{color:"var(--bad)"},children:["-",e.removed]})]})]},e.path))})]}),eA.vcs.commit&&eA.vcs.baseCommit&&(0,a.jsxs)(a.Fragment,{children:[" \xb7 ",(0,a.jsx)(y.C,{sessionId:eE.id,taskId:eA.id,title:eA.title,files:null!=(er=null==(v=eA.vcs.files)?void 0:v.length)?er:0})]}),(null!=(ei=null==(x=eA.vcs.suspicious)?void 0:x.length)?ei:0)>0&&(0,a.jsxs)("div",{className:"err small",style:{marginTop:4},children:[ez("vcs.suspicious",{n:null!=(ec=null==(j=eA.vcs.suspicious)?void 0:j.length)?ec:0}),(0,a.jsx)("ul",{style:{margin:"4px 0",paddingLeft:20},children:(null!=(ed=eA.vcs.suspicious)?ed:[]).map(e=>(0,a.jsxs)("li",{children:[(0,a.jsx)("code",{children:e.path})," — ",e.reason]},e.path))})]}),(null!=(eo=null==(g=eA.scopeReverted)?void 0:g.length)?eo:0)>0&&(0,a.jsx)("div",{className:"small",style:{marginTop:4},children:ez("task.scopeReverted",{n:null!=(em=null==(N=eA.scopeReverted)?void 0:N.length)?em:0,paths:(null!=(eh=eA.scopeReverted)?eh:[]).join(", ")})}),(null!=(eu=null==(C=eA.vcs.foreignCommits)?void 0:C.length)?eu:0)>0&&(0,a.jsxs)("div",{className:"err small",style:{marginTop:4},children:[ez("vcs.foreignCommits",{n:null!=(ep=null==(S=eA.vcs.foreignCommits)?void 0:S.length)?ep:0}),(0,a.jsx)("ul",{style:{margin:"4px 0",paddingLeft:20},children:(null!=(ev=eA.vcs.foreignCommits)?ev:[]).map(e=>(0,a.jsx)("li",{children:(0,a.jsx)("code",{children:e})},e))})]})]})}),"queued"===eA.status&&(null==(F=eE.vcs)?void 0:F.enabled)&&((null==(D=eA.vcsPlan)?void 0:D.branch)||(null==(H=eA.vcsPlan)?void 0:H.commitMessage))&&(0,a.jsx)("div",{className:"muted small",children:eA.vcsPlan.branch&&eA.vcsPlan.commitMessage?ez("task.gitNames",{branch:eA.vcsPlan.branch,subject:eA.vcsPlan.commitMessage.split("\n")[0]}):eA.vcsPlan.branch?ez("task.gitBranchOnly",{branch:eA.vcsPlan.branch}):ez("task.gitCommitOnly",{subject:(null!=(ex=eA.vcsPlan.commitMessage)?ex:"").split("\n")[0]})}),e_&&eA.runId&&(0,a.jsx)(f.P,{sessionId:eE.id,taskId:eA.id,live:"running"===eA.status||"waiting-approval"===eA.status}),eJ?(0,a.jsxs)("div",{style:{marginTop:8},children:[(0,a.jsx)("label",{children:ez("form.titleLabel")}),(0,a.jsx)("input",{type:"text",value:eY,onChange:e=>e$(e.target.value)}),(0,a.jsx)("div",{style:{marginTop:8},children:(0,a.jsx)(R,{value:eQ,onChange:eV,presets:eU})}),(0,a.jsx)("label",{children:ez("form.taskLabel")}),(0,a.jsx)("textarea",{className:"prose",value:eX,onChange:e=>e0(e.target.value)}),(null==(I=eE.vcs)?void 0:I.enabled)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("label",{htmlFor:"branch-".concat(eA.id),children:ez("task.branch")}),(0,a.jsx)("input",{id:"branch-".concat(eA.id),type:"text",value:e1,onChange:e=>e2(e.target.value),placeholder:eE.vcs.branchPrefix,disabled:"per-session"===eE.vcs.branchMode}),(0,a.jsx)("p",{className:"why",children:"per-session"===eE.vcs.branchMode?ez("task.branchIgnored"):ez("task.branchWhy")}),(0,a.jsx)("label",{htmlFor:"commit-".concat(eA.id),children:ez("task.commitMessage")}),(0,a.jsx)("textarea",{id:"commit-".concat(eA.id),value:e4,onChange:e=>e6(e.target.value),style:{minHeight:70}}),(0,a.jsx)("p",{className:"why",children:ez("task.commitWhy")})]}),(0,a.jsx)(G,{checks:e8,onChange:e5}),(0,a.jsxs)("div",{className:"row",style:{marginTop:8},children:[(0,a.jsx)("button",{className:"primary",onClick:()=>void(sl?so():sn()),children:sl?ez("task.saveAndRerun"):ez("task.save")}),(0,a.jsx)("span",{className:"err",children:se})]}),sl&&(0,a.jsx)("p",{className:"muted small",children:ez("task.editRanWhy")})]}):(0,a.jsxs)(a.Fragment,{children:[(null!=(ej=null==(M=eA.checks)?void 0:M.length)?ej:0)>0&&(0,a.jsxs)("details",{className:"small",style:{margin:"6px 0"},children:[(0,a.jsxs)("summary",{children:[ez("checks.title")," — ",ez("checks.n",{n:null!=(eg=null==(T=eA.checks)?void 0:T.length)?eg:0}),(null!=(ef=null==(P=eA.checkResults)?void 0:P.length)?ef:0)>0&&" \xb7 ".concat((null!=(ek=eA.checkResults)?ek:[]).filter(e=>e.passed).length,"/").concat(null==(L=eA.checkResults)?void 0:L.length," ").concat(ez("checks.passed"))]}),(0,a.jsx)("ul",{style:{margin:"6px 0",paddingLeft:20},children:(null!=(eb=eA.checks)?eb:[]).map((e,s)=>{var n;let l=(null!=(n=eA.checkResults)?n:[]).find(s=>s.name===e.name);return(0,a.jsxs)("li",{children:[(0,a.jsx)("strong",{children:e.name}),(0,a.jsxs)("span",{className:"muted",children:[" — ",ez("checks.kind.".concat(e.expect)),e.value?' "'.concat(e.value,'"'):"",e.run?": ".concat(e.run):e.file?": ".concat(e.file):""]}),l&&(0,a.jsxs)("div",{className:l.passed?"muted":"reason",children:[l.passed?ez("checks.passed"):ez("checks.failed")," — ",l.detail]})]},"".concat(e.name,"-").concat(s))})})]}),(null!=(ey=null==(W=eA.reviewChecks)?void 0:W.length)?ey:0)>0&&(0,a.jsxs)("details",{className:"small",style:{margin:"6px 0"},children:[(0,a.jsx)("summary",{children:ez("checks.fromReview",{n:null!=(eN=null==(O=eA.reviewChecks)?void 0:O.length)?eN:0})}),(0,a.jsx)("p",{className:"why",children:ez("checks.fromReviewWhy")}),(0,a.jsx)("ul",{style:{margin:"6px 0",paddingLeft:20},children:(null!=(ew=eA.reviewChecks)?ew:[]).map(e=>{var s;let n=(null!=(s=eA.checkResults)?s:[]).find(s=>s.name===e.check.name);return(0,a.jsxs)("li",{children:[(0,a.jsx)("code",{children:e.findingId})," ",(0,a.jsx)("strong",{children:e.check.name}),"active"!==e.state&&(0,a.jsx)("span",{className:"chip",style:{marginLeft:6},children:ez("checks.state.".concat(e.state))}),(0,a.jsx)("div",{className:"muted",children:e.what}),n&&(0,a.jsxs)("div",{className:n.passed?"muted":"reason",children:[n.passed?ez("checks.passed"):ez("checks.failed")," — ",n.detail]})]},e.check.name)})})]}),(0,a.jsx)(Z,{review:eA.review}),eA.handoff&&!(0,m.DG)(eA)&&(0,a.jsx)(E,{handoff:eA.handoff}),eA.summary&&(0,a.jsxs)("div",{className:"summary",children:[(0,a.jsx)("strong",{children:ez("task.whatWasDone")}),(0,a.jsx)(k.s,{text:eA.summary})]}),(null!=(eC=null==(A=eA.deviations)?void 0:A.length)?eC:0)>0&&(0,a.jsx)(q,{items:null!=(eS=eA.deviations)?eS:[]}),(null!=(eF=null==(B=eA.disputes)?void 0:B.length)?eF:0)>0&&(0,a.jsx)(J,{items:null!=(eD=eA.disputes)?eD:[]}),eA.environment&&(0,a.jsx)("div",{className:"muted small",style:{margin:"4px 0"},children:ez("task.ranWith",{node:eA.environment.node,npm:null!=(eH=eA.environment.npm)?eH:"—",git:null!=(eI=eA.environment.git)?eI:"—",pwsh:null!=(eT=null!=(eM=eA.environment.pwsh)?eM:eA.environment.powershell)?eT:"—"})}),(null!=(eP=null==(U=eA.leftovers)?void 0:U.length)?eP:0)>0&&(0,a.jsxs)("div",{className:"err small",style:{margin:"6px 0"},children:[ez("task.leftovers",{n:null!=(eL=null==(z=eA.leftovers)?void 0:z.length)?eL:0}),(0,a.jsx)("ul",{style:{margin:"4px 0",paddingLeft:20},children:(null!=(eW=eA.leftovers)?eW:[]).map(e=>(0,a.jsxs)("li",{children:[(0,a.jsx)("code",{children:e.name})," pid ",e.pid,e.ports.length>0?" \xb7 ".concat(ez("task.leftoverPorts",{ports:e.ports.join(", ")})):""," \xb7 ",e.by]},"".concat(e.by,"-").concat(e.pid)))})]}),eA.reason&&(0,a.jsx)("div",{className:"reason small",style:{margin:"6px 0"},children:eA.reason}),(null!=(eR=null==(_=eA.attempts)?void 0:_.length)?eR:0)>0&&(0,a.jsxs)("details",{children:[(0,a.jsx)("summary",{children:ez("task.attempts",{n:null!=(eO=null==(K=eA.attempts)?void 0:K.length)?eO:0})}),null==(Y=eA.attempts)?void 0:Y.map((e,s)=>{var n,l,t,r;return(0,a.jsxs)("div",{className:"small",style:{margin:"8px 0 12px"},children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("strong",{children:ez("task.attemptN",{n:s+1})}),(0,a.jsx)("span",{className:"badge ".concat(e.status),children:ez("status.".concat(e.status))}),e.iterations>0&&(0,a.jsx)("span",{className:"muted",children:ez("task.iterations",{n:e.iterations})}),e.runId&&(0,a.jsx)(o.u,{label:ez("save.attemptLog"),save:()=>c.FH.saveTaskLog(eE.id,eA.id,e.runId)}),e.runId&&(0,a.jsx)(o.H,{sessionId:eE.id,taskId:eA.id,attempt:s+1}),e.runId&&(null==(n=e.vcs)?void 0:n.commit)&&e.vcs.baseCommit&&(0,a.jsx)(y.C,{sessionId:eE.id,taskId:eA.id,runId:e.runId,title:"".concat(eA.title," — ").concat(ez("task.attemptN",{n:s+1})),files:null!=(t=null==(l=e.vcs.files)?void 0:l.length)?t:0})]}),(0,a.jsxs)("div",{className:"muted",children:[e.startedAt?ez("task.started",{t:eq(e.startedAt)}):"",e.finishedAt?" \xb7 ".concat(ez("task.finished",{t:eq(e.finishedAt)})):""]}),e.summary&&(0,a.jsx)("div",{children:e.summary}),e.reason&&(0,a.jsx)("div",{className:"err",children:e.reason}),e.prompt&&e.prompt!==eA.prompt&&(0,a.jsxs)("details",{children:[(0,a.jsx)("summary",{children:ez("task.attemptText")}),(0,a.jsx)("pre",{children:e.prompt})]})]},"".concat(null!=(r=e.runId)?r:s))})]}),"queued"===eA.status?(0,a.jsxs)("div",{style:{marginTop:8},children:[(0,a.jsx)("div",{className:"muted small",children:ez("task.prompt")}),(0,a.jsx)("pre",{children:eA.prompt}),eA.level2.trim()?(0,a.jsxs)("details",{children:[(0,a.jsx)("summary",{children:ez("task.l2Show",{n:eA.level2.trim().split("\n").length})}),(0,a.jsx)("pre",{children:eA.level2})]}):(0,a.jsx)("div",{className:"muted small",children:ez("task.noL2")})]}):(0,a.jsxs)("details",{children:[(0,a.jsx)("summary",{children:ez("task.promptAndL2")}),eA.level2.trim()&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"muted small",children:ez("task.l2")}),(0,a.jsx)("pre",{children:eA.level2})]}),(0,a.jsx)("div",{className:"muted small",children:ez("task.prompt")}),(0,a.jsx)("pre",{children:eA.prompt})]}),eA.firstMessage&&(0,a.jsxs)("details",{children:[(0,a.jsx)("summary",{children:ez("task.firstMessage")}),(0,a.jsx)("pre",{className:"tall",children:eA.firstMessage})]}),eA.runId&&(0,a.jsxs)("details",{onToggle:e=>e.currentTarget.open&&void su(),children:[(0,a.jsx)("summary",{children:ez("task.files")}),(0,a.jsx)("div",{className:"row small",style:{margin:"6px 0"},children:(0,a.jsx)(o.u,{label:ez("save.log"),save:()=>c.FH.saveTaskLog(eE.id,eA.id)})}),e7&&(0,a.jsxs)("div",{className:"small",children:[sp("task.reports","reports",e7.reports),sp("task.artifacts","artifacts",e7.artifacts),sp("task.replies","replies",e7.replies)]})]}),eA.finalReply&&(0,a.jsxs)("details",{children:[(0,a.jsx)("summary",{children:ez("task.finalReply")}),(0,a.jsx)("pre",{className:"tall",children:eA.finalReply})]})]})]})}function U(e){let{events:s}=e,{t:n}=(0,d.kj)(),{appearance:t}=(0,v.KP)(),r=(0,l.useRef)(null);return(0,l.useEffect)(()=>{!t.reduceMotion&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[s.length,t.reduceMotion]),(0,a.jsxs)("div",{className:"panel",children:[(0,a.jsx)("h2",{children:n("live.title")}),(0,a.jsxs)("div",{className:"log",ref:r,children:[0===s.length&&(0,a.jsx)("div",{className:"muted",children:n("live.none")}),s.map((e,s)=>{var n;return(0,a.jsxs)("div",{className:e.level,children:[(0,a.jsx)("span",{className:"time",children:new Date(e.at).toLocaleTimeString(void 0,{hour12:!1})}),null!=(n=e.message)?n:e.type]},s)})]})]})}function G(e){let{checks:s,onChange:n}=e,{t:l}=(0,d.kj)(),t=(e,a)=>n(s.map((s,n)=>e===n?{...s,...a}:s));return(0,a.jsxs)("div",{style:{marginTop:12},children:[(0,a.jsx)("label",{children:l("checks.title")}),(0,a.jsx)("p",{className:"why",style:{marginTop:0},children:l("checks.why")}),0===s.length&&(0,a.jsx)("p",{className:"muted small",children:l("checks.noneWhy")}),s.map((e,r)=>{var i,d,o,m;return(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("input",{type:"text",className:"grow",value:e.name,placeholder:l("checks.namePlaceholder"),onChange:e=>t(r,{name:e.target.value}),"aria-label":l("checks.name")}),(0,a.jsx)("select",{value:e.expect,onChange:e=>t(r,{expect:e.target.value}),"aria-label":l("checks.kind"),style:{width:"auto"},children:c.FZ.map(e=>(0,a.jsx)("option",{value:e,children:l("checks.kind.".concat(e))},e))}),(0,a.jsx)("button",{className:"quiet",onClick:()=>n(s.filter((e,s)=>s!==r)),children:l("checks.remove")})]}),(0,a.jsxs)("div",{className:"row",style:{marginTop:6},children:[(0,c.rt)(e.expect)?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("input",{type:"text",className:"grow",value:null!=(i=e.run)?i:"",placeholder:l("checks.run"),onChange:e=>t(r,{run:e.target.value}),"aria-label":l("checks.run")}),(0,a.jsx)("input",{type:"text",value:null!=(d=e.cwd)?d:"",placeholder:l("checks.cwd"),onChange:e=>t(r,{cwd:e.target.value}),"aria-label":l("checks.cwd"),style:{width:220}})]}):(0,a.jsx)("input",{type:"text",className:"grow",value:null!=(o=e.file)?o:"",placeholder:l("checks.file"),onChange:e=>t(r,{file:e.target.value}),"aria-label":l("checks.file")}),(0,c.dK)(e.expect)&&(0,a.jsx)("input",{type:"text",value:null!=(m=e.value)?m:"",placeholder:"output-matches"===e.expect?l("checks.valueRegex"):l("checks.value"),onChange:e=>t(r,{value:e.target.value}),"aria-label":l("checks.value"),style:{width:240}})]})]},r)}),(0,a.jsx)("button",{onClick:()=>n([...s,{name:"",expect:"exit-zero",run:""}]),children:l("checks.add")})]})}function z(e){let{tasks:s}=e,{t:n}=(0,d.kj)(),l=(0,m.hH)(s),t=(0,h.c)(!!l&&l.tasks.some(m.DG));if(!l)return null;let r=(0,m.eZ)(l.run,l.tasks,t);return(0,a.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 q(e){let{items:s}=e,{t:n}=(0,d.kj)();return(0,a.jsxs)("div",{className:"summary",children:[(0,a.jsx)("strong",{children:n("task.deviations",{n:s.length})}),(0,a.jsx)("ol",{style:{margin:"6px 0",paddingLeft:20},children:s.map((e,s)=>(0,a.jsxs)("li",{style:{marginBottom:6},children:[(0,a.jsx)("div",{children:e.instruction}),(0,a.jsxs)("div",{className:"muted",children:[n("task.deviationDid"),": ",e.did]}),(0,a.jsxs)("div",{className:"muted",children:[n("task.deviationWhy"),": ",e.why]})]},s))})]})}function J(e){let{items:s}=e,{t:n}=(0,d.kj)();return(0,a.jsxs)("div",{className:"summary",children:[(0,a.jsx)("strong",{children:n("task.disputes",{n:s.length})}),(0,a.jsx)("ol",{style:{margin:"6px 0",paddingLeft:20},children:s.map((e,s)=>(0,a.jsxs)("li",{style:{marginBottom:6},children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("code",{children:e.finding})," — ",e.why]}),(0,a.jsxs)("div",{className:"muted",children:[n("review.evidence"),": ",e.evidence]})]},s))})]})}function Z(e){var s,n,l,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,a.jsxs)("div",{className:"small",style:{margin:"8px 0"},children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("span",{className:"badge ".concat(o),children:c("review.verdict.".concat(i.verdict))}),i.stepsRun>0&&(0,a.jsx)("span",{className:"muted",children:c("review.ran",{n:i.stepsRun})}),i.rounds>1&&(0,a.jsx)("span",{className:"muted",children:c("review.rounds",{n:i.rounds})}),i.model&&(0,a.jsx)("span",{className:"chip",children:c("review.onModel",{model:i.model})})]}),i.problem&&(0,a.jsx)("p",{className:"reason",children:c("review.problem",{problem:i.problem})}),i.summary&&(0,a.jsx)(k.s,{text:i.summary}),(null!=(l=null==(s=i.findings)?void 0:s.length)?l:0)>0&&(0,a.jsxs)("details",{style:{marginTop:4},children:[(0,a.jsx)("summary",{children:c("review.findings",{n:null!=(t=null==(n=i.findings)?void 0:n.length)?t:0})}),(0,a.jsx)("ol",{style:{margin:"6px 0",paddingLeft:20},children:(null!=(r=i.findings)?r:[]).map((e,s)=>(0,a.jsxs)("li",{style:{marginBottom:8},children:[(0,a.jsxs)("div",{children:[e.id&&(0,a.jsx)("code",{style:{marginRight:6},children:e.id}),e.what,"task"===e.about&&(0,a.jsx)("span",{className:"chip",style:{marginLeft:6},children:c("review.aboutTask")}),e.repeated&&(0,a.jsx)("span",{className:"chip",style:{marginLeft:6},children:c("review.repeated")})]}),e.where&&(0,a.jsx)("div",{className:"muted",children:e.where}),(0,a.jsxs)("div",{className:"muted",children:[c("review.evidence"),": ",e.evidence]})]},s))})]})]})}},4784:(e,s,n)=>{"use strict";n.d(s,{Y:()=>i});var a=n(3365),l=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)(),v=function(e){let[s,n]=(0,l.useState)(null);return(0,l.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),x=null!=(s=null==v?void 0:v.options)?s:[],j=x.some(e=>e.name===c),g=x.filter(e=>!e.group),f=new Map;for(let e of x)e.group&&f.set(e.group,[...null!=(n=f.get(e.group))?n:[],e]);return(0,a.jsxs)("select",{id:i,value:c,onChange:e=>d(e.target.value),disabled:h,style:{width:"auto",minWidth:280,...u},children:[(0,a.jsx)("option",{value:"",children:o}),c&&!j&&(0,a.jsx)("option",{value:c,children:p("model.notInList",{name:c})}),g.map(e=>(0,a.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,a.jsx)("optgroup",{label:s,children:n.map(e=>(0,a.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 a=n(3365),l=n(8197),t=n.n(l),r=n(1521),i=n(5549),c=n(867);function d(e){let{current:s,onUse:n}=e,{t:l}=(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,a.jsx)(u,{label:o?l("proj.defaultIs",{dir:o}):l("proj.noneShort"),offer:o&&n&&m!==o.toLowerCase()?{text:l("proj.useIt"),onUse:()=>n(o)}:void 0,more:h.map(e=>({text:l("proj.otherUse",{name:e.name}),title:e.rootDir,onUse:()=>null==n?void 0:n(e.rootDir)})),link:o?l("proj.change"):l("proj.setIt"),anchor:"project"})}function o(e){let{current:s,onUse:n}=e,l=h(),{t}=(0,c.kj)();if(!l)return null;let r=l.defaultModel.trim();return(0,a.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,l=h(),{t}=(0,c.kj)();if(!l)return null;let r=l.defaultReviewModel.trim();return(0,a.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:l=[],link:r,anchor:i}=e;return(0,a.jsxs)("p",{className:"muted small",style:{marginTop:4},children:[s," ",n&&(0,a.jsxs)(a.Fragment,{children:["\xb7"," ",(0,a.jsx)("button",{type:"button",className:"linkish",onClick:n.onUse,children:n.text})," "]}),l.map(e=>(0,a.jsxs)("span",{children:["\xb7"," ",(0,a.jsx)("button",{type:"button",className:"linkish",onClick:e.onUse,title:e.title,children:e.text})," "]},e.text)),"\xb7 ",(0,a.jsx)(t(),{href:"/defaults#".concat(i),children:r})]})}}},e=>{e.O(0,[197,867,549,373,347,131,358],()=>e(e.s=1772)),_N_E=e.O()}]);
|
/package/dist/web/_next/static/{auD7lTmj-JDMJIQ4TVivR → oyfXbuB_cq0sRZP7ukHlQ}/_buildManifest.js
RENAMED
|
File without changes
|
/package/dist/web/_next/static/{auD7lTmj-JDMJIQ4TVivR → oyfXbuB_cq0sRZP7ukHlQ}/_ssgManifest.js
RENAMED
|
File without changes
|