copilot-operator 0.1.41 → 0.1.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/src/api/operator.controller.js +28 -6
  2. package/dist/src/api/operator.service.js +82 -7
  3. package/dist/src/config/schema.js +7 -0
  4. package/dist/src/orchestrator/planMode.js +102 -0
  5. package/dist/src/orchestrator/review.js +8 -4
  6. package/dist/src/orchestrator/taskRunner.js +137 -2
  7. package/dist/src/plan/brief.js +12 -0
  8. package/dist/src/plan/importPlan.js +2 -0
  9. package/dist/src/plan/schema.js +10 -0
  10. package/dist/src/plan/systemGuide.js +193 -2
  11. package/dist/src/protocol/parser.js +26 -2
  12. package/dist/src/protocol/replySchema.js +28 -4
  13. package/dist/src/session/compose.js +62 -7
  14. package/dist/src/session/exports.js +1 -0
  15. package/dist/src/session/model.js +38 -0
  16. package/dist/src/session/store.js +30 -3
  17. package/dist/src/vcs/startChoice.js +80 -8
  18. package/dist/src/vcs/taskVcs.js +16 -7
  19. package/dist/web/404.html +2 -2
  20. package/dist/web/_next/static/chunks/{584-578be94a0786334b.js → 204-db82ca47ff211e21.js} +1 -1
  21. package/dist/web/_next/static/chunks/499-39b2c00bda3656f0.js +1 -0
  22. package/dist/web/_next/static/chunks/549-348b0a1404407e5a.js +1 -0
  23. package/dist/web/_next/static/chunks/867-7d86a692260006f1.js +1 -0
  24. package/dist/web/_next/static/chunks/app/defaults/page-a25c40436fc312db.js +1 -0
  25. package/dist/web/_next/static/chunks/app/history/page-47973539ceff81d6.js +1 -0
  26. package/dist/web/_next/static/chunks/app/layout-6ee612d25e78b246.js +1 -0
  27. package/dist/web/_next/static/chunks/app/sessions/view/page-872d8b9fe8eedbbf.js +1 -0
  28. package/dist/web/_next/static/css/{cea7913ba416dbb7.css → 0e55721108c300f2.css} +1 -1
  29. package/dist/web/appearance.html +2 -2
  30. package/dist/web/appearance.txt +13 -13
  31. package/dist/web/defaults.html +2 -2
  32. package/dist/web/defaults.txt +13 -13
  33. package/dist/web/history.html +2 -2
  34. package/dist/web/history.txt +13 -13
  35. package/dist/web/import.html +2 -2
  36. package/dist/web/import.txt +13 -13
  37. package/dist/web/index.html +2 -2
  38. package/dist/web/index.txt +13 -13
  39. package/dist/web/level1.html +2 -2
  40. package/dist/web/level1.txt +13 -13
  41. package/dist/web/presets.html +2 -2
  42. package/dist/web/presets.txt +13 -13
  43. package/dist/web/sessions/view.html +2 -2
  44. package/dist/web/sessions/view.txt +13 -13
  45. package/dist/web/system.html +2 -2
  46. package/dist/web/system.txt +13 -13
  47. package/package.json +159 -158
  48. package/dist/web/_next/static/chunks/499-28e118e33ce07935.js +0 -1
  49. package/dist/web/_next/static/chunks/549-f295c8429e83b25b.js +0 -1
  50. package/dist/web/_next/static/chunks/867-8dc5bbb092ca2c5c.js +0 -1
  51. package/dist/web/_next/static/chunks/app/defaults/page-879158e9e550eea7.js +0 -1
  52. package/dist/web/_next/static/chunks/app/history/page-9f69ccde726c9be2.js +0 -1
  53. package/dist/web/_next/static/chunks/app/layout-73f28bc065a46ed3.js +0 -1
  54. package/dist/web/_next/static/chunks/app/sessions/view/page-0485ee7f781156ec.js +0 -1
  55. /package/dist/web/_next/static/{-htN5GTSrd3W3f5j_QC2y → lDmqS7pWU_B_Ac5idPvdS}/_buildManifest.js +0 -0
  56. /package/dist/web/_next/static/{-htN5GTSrd3W3f5j_QC2y → lDmqS7pWU_B_Ac5idPvdS}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[189],{1035:(e,l,a)=>{"use strict";a.d(l,{DialogHost:()=>c,Z:()=>d});var t=a(3365),n=a(1521),s=a(867),r=a(4969);let i=null,o=[];function d(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(a=>{var t;return t={kind:"confirm",message:e,...l,resolve:a},void(i?i(t):o.push(t))})}function c(e){var l,a;let{children:d}=e,{t:c}=(0,s.kj)(),[u,m]=(0,n.useState)([]),h=(0,n.useRef)(null),p=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(i=e=>m(l=>[...l,e]),o.length>0){let e=o.splice(0,o.length);m(l=>[...l,...e])}return()=>{i=null}},[]);let x=u[0],j=(0,n.useCallback)(e=>{x&&(x.resolve(e),m(e=>e.slice(1)))},[x]);return(0,r.V)(p,!!x,h),(0,n.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,t.jsxs)(t.Fragment,{children:[d,x&&(0,t.jsx)("div",{className:"modal-backdrop",onClick:()=>j(!1),role:"presentation",children:(0,t.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,t.jsx)("h2",{id:"modal-title",children:null!=(l=x.title)?l:c("confirm"===x.kind?"dialog.confirmTitle":"dialog.noticeTitle")}),(0,t.jsx)("div",{id:"modal-body",className:"modal-body",children:x.message}),(0,t.jsxs)("div",{className:"row modal-actions",children:["confirm"===x.kind&&(0,t.jsx)("button",{type:"button",className:"quiet",onClick:()=>j(!1),children:c("dialog.cancel")}),(0,t.jsx)("button",{ref:h,type:"button",className:x.danger?"danger":"primary",onClick:()=>j(!0),children:null!=(a=x.okLabel)?a:c("dialog.ok")})]})]})})]})}},1896:(e,l,a)=>{Promise.resolve().then(a.bind(a,3197))},3197:(e,l,a)=>{"use strict";a.r(l),a.d(l,{default:()=>m});var t=a(3365),n=a(1521),s=a(8596),r=a(8197),i=a.n(r),o=a(5549),d=a(867),c=a(1035),u=a(4784);function m(){let{t:e}=(0,d.kj)(),[l,a]=(0,n.useState)(null),[s,r]=(0,n.useState)(!1),[i,u]=(0,n.useState)("");(0,n.useEffect)(()=>{o.FH.models().then(a).catch(()=>void 0)},[]);let m=async()=>{if(await (0,c.Z)(e("model.refreshConfirm"))){r(!0),u(e("model.refreshing"));try{var l;let t=await o.FH.models().then(()=>o.FH.refreshModels());a(t),u(0===t.options.length?null!=(l=t.note)?l:e("model.none"):e("model.refreshed",{n:t.options.length}))}catch(e){u(e.message)}finally{r(!1)}}},h={catalogue:l,setCatalogue:a,refreshModels:m,refreshing:s,refreshMsg:i};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"panel",children:[(0,t.jsx)("h2",{children:e("def.title")}),(0,t.jsx)("p",{className:"muted small",children:e("def.intro")}),(0,t.jsx)("p",{className:"why",children:e("def.autoSave")})]}),(0,t.jsx)(v,{}),(0,t.jsx)(y,{}),(0,t.jsx)(b,{...h}),(0,t.jsx)(N,{...h}),(0,t.jsx)(g,{})]})}function h(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:900,a=(0,n.useRef)(null),t=(0,n.useRef)(null),s=(0,n.useRef)(e);return s.current=e,(0,n.useEffect)(()=>()=>{a.current&&clearTimeout(a.current),t.current&&s.current(t.current.value)},[]),e=>{a.current&&clearTimeout(a.current),t.current={value:e},a.current=setTimeout(()=>{t.current=null,s.current(e)},l)}}function p(e){let{id:l,value:a,min:s,max:r,onChange:i,disabled:o}=e,[d,c]=(0,n.useState)(String(a));return(0,n.useEffect)(()=>c(e=>x(e)===a?e:String(a)),[a]),(0,t.jsx)("input",{id:l,type:"number",min:s,max:r,step:1,value:d,onChange:e=>{c(e.target.value);let l=x(e.target.value);null!==l&&l>=s&&l<=r&&i(l)},onBlur:()=>{let e=x(d),l=null===e?a:Math.max(s,Math.min(r,e));c(String(l)),l!==a&&i(l)},style:{width:"9ch"},disabled:o})}function x(e){if(""===e.trim())return null;let l=Number(e);return Number.isInteger(l)?l:null}function j(e){let{msg:l,onSave:a}=e,{t:n}=(0,d.kj)();return(0,t.jsxs)("div",{className:"row",style:{marginTop:6},children:[a&&(0,t.jsx)("button",{className:"quiet",onClick:a,title:n("def.saveAnywayWhy"),children:n("def.saveAnyway")}),(0,t.jsx)("span",{className:"muted small",role:"status",children:l||n("def.savedAutomatically")})]})}function v(){var e;let{t:l}=(0,d.kj)(),[a,s]=(0,n.useState)(null),[r,i]=(0,n.useState)(""),[c,u]=(0,n.useState)(""),[m,p]=(0,n.useState)(""),[x,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 o.FH.project();s(e),i(e.rootDir),u(e.name),v("")}catch(e){v(e.message)}},[]);(0,n.useEffect)(()=>{S()},[S]);let C=async(e,l)=>{y(!0),p("");try{let a=await o.FH.setProject(e);return s(a),i(a.rootDir),p(l(a)),v(""),!0}catch(e){return v(e.message),!1}finally{y(!1)}},F=e=>C({rootDir:e},e=>e.rootDir?l("proj.saved",{dir:e.rootDir}):l("proj.cleared")),R=e=>C({name:e},()=>l("proj.nameSaved")),M=h(F),T=h(R),E=async(e,l)=>{y(!0);try{var a;let t=await o.FH.browseFolder(l.trim()||void 0);t.ok?e(t.path):t.cancelled||v(null!=(a=t.reason)?a:"")}catch(e){v(e.message)}finally{y(!1)}},D=null!=(e=null==a?void 0:a.others)?e:[],B=e=>e.map(e=>({name:e.name,rootDir:e.rootDir})),A=async()=>{await C({others:[...B(D),{name:b.trim(),rootDir:N.trim()}]},e=>l("proj.othersSaved",{n:e.others.length}))&&(w(""),k(""))};return(0,t.jsxs)("div",{className:"panel",id:"project",children:[(0,t.jsx)("h2",{children:l("proj.title")}),(0,t.jsx)("p",{className:"muted small",children:l("proj.intro")}),x&&(0,t.jsx)("div",{className:"err",children:x}),(0,t.jsx)("p",{className:"muted small",children:l("proj.listIntro")}),(0,t.jsx)(f,{name:c,dir:r,repoOk:!!(null==a?void 0:a.repoOk),repoProblem:null==a?void 0:a.repoProblem,isDefault:!0,busy:g,onNameInput:e=>{u(e),T(e)},onName:e=>void R(e),onDirInput:e=>{i(e),M(e)},onDir:e=>void F(e),onBrowse:()=>void E(e=>void F(e),r),onRemove:(null==a?void 0:a.rootDir)?()=>void F(""):void 0,removeLabel:l("proj.clear")}),(0,t.jsx)(j,{msg:m}),a&&!a.rootDir&&(0,t.jsx)("p",{className:"muted small",style:{marginTop:8},children:l("proj.none")}),D.map((e,a)=>(0,t.jsx)(f,{name:e.name,dir:e.rootDir,repoOk:e.repoOk,repoProblem:e.repoProblem,busy:g,onName:a=>void C({others:B(D.map(l=>l.name===e.name?{...l,name:a}:l))},()=>l("proj.nameSaved")),onDir:a=>void C({others:B(D.map(l=>l.name===e.name?{...l,rootDir:a}:l))},()=>l("proj.othersSaved",{n:D.length})),onBrowse:()=>void E(a=>void C({others:B(D.map(l=>l.name===e.name?{...l,rootDir:a}:l))},()=>l("proj.othersSaved",{n:D.length})),e.rootDir),onRemove:()=>{let a;a=e.name,C({others:B(D.filter(e=>e.name!==a))},e=>l("proj.othersSaved",{n:e.others.length}))},removeLabel:l("proj.otherRemove")},"other-".concat(a))),(0,t.jsx)("h3",{id:"others",children:l("proj.addTitle")}),(0,t.jsx)("p",{className:"muted small",children:l("proj.othersIntro")}),(0,t.jsxs)("div",{className:"row",style:{marginTop:8},children:[(0,t.jsx)("input",{type:"text","aria-label":l("proj.entryName"),value:b,onChange:e=>w(e.target.value),placeholder:l("proj.entryName"),disabled:g,style:{width:160}}),(0,t.jsx)("input",{type:"text",className:"grow","aria-label":l("proj.entryDir"),value:N,onChange:e=>k(e.target.value),placeholder:"C:\\Projects\\my-app-tests",disabled:g}),(0,t.jsx)("button",{onClick:()=>void E(e=>k(e),N),disabled:g,children:l("mirror.browse")}),(0,t.jsx)("button",{className:"primary",onClick:()=>void A(),disabled:g||!b.trim()||!N.trim(),children:l("proj.otherAdd")})]}),(0,t.jsx)("h3",{children:l("proj.affects")}),(0,t.jsxs)("ul",{className:"muted small",style:{margin:0,paddingLeft:20},children:[(0,t.jsx)("li",{children:l("proj.affectsNew")}),(0,t.jsx)("li",{children:l("proj.affectsExisting")}),(0,t.jsx)("li",{children:l("proj.affectsPlan")}),(0,t.jsx)("li",{children:l("proj.affectsNever")})]})]})}function f(e){var l;let{name:a,dir:r,repoOk:i,repoProblem:o,isDefault:c=!1,busy:u,onNameInput:m,onName:h,onDirInput:p,onDir:x,onBrowse:j,onRemove:v,removeLabel:f}=e,{t:g}=(0,d.kj)(),y=(0,n.useId)(),[b,w]=(0,n.useState)(a),[N,k]=(0,n.useState)(r);return(0,n.useEffect)(()=>w(a),[a]),(0,n.useEffect)(()=>k(r),[r]),(0,t.jsxs)("div",{className:"panel inner",style:{marginTop:10},children:[(0,t.jsxs)("div",{className:"row",children:[(0,t.jsxs)("div",{style:{width:"min(200px, 100%)"},children:[(0,t.jsx)("label",{htmlFor:"".concat(y,"-name"),children:g("proj.entryName")}),(0,t.jsx)("input",{id:"".concat(y,"-name"),type:"text",value:b,onChange:e=>{w(e.target.value),null==m||m(e.target.value)},onBlur:()=>{(b!==a||m)&&h(b)},placeholder:r?null!=(l=r.replace(/[\/]+$/,"").split(/[\/]/).pop())?l:"":g("proj.namePlaceholder")})]}),(0,t.jsxs)("div",{className:"grow",children:[(0,t.jsx)("label",{htmlFor:"".concat(y,"-dir"),children:g("proj.entryDir")}),(0,t.jsx)("input",{id:"".concat(y,"-dir"),type:"text",value:N,onChange:e=>{k(e.target.value),null==p||p(e.target.value)},onBlur:()=>{(N!==r||p)&&x(N)},placeholder:"C:\\Projects\\my-app"})]}),(0,t.jsx)("button",{onClick:j,disabled:u,children:g("mirror.browse")}),v&&(0,t.jsx)("button",{className:"quiet",onClick:v,disabled:u,children:f})]}),(0,t.jsxs)("div",{className:"row small",style:{marginTop:6},children:[c&&(0,t.jsx)("span",{className:"chip",title:g("proj.isDefaultWhy"),children:g("proj.isDefault")}),r&&(0,t.jsx)("span",{className:"badge ".concat(i?"done":""),title:i?g("proj.isRepo"):o,children:g(i?"proj.otherRepo":"proj.otherNotRepo")}),r&&!i&&(0,t.jsx)("span",{className:"muted",children:o||g("proj.notRepoWhy")})]}),r&&i&&(0,t.jsx)(s.E,{dir:r})]})}function g(){let{t:e}=(0,d.kj)(),[l,a]=(0,n.useState)(null),s=(0,n.useRef)(null),r=(0,n.useRef)(Promise.resolve()),[i,c]=(0,n.useState)(2),[u,m]=(0,n.useState)(2),[x,v]=(0,n.useState)(2),[f,g]=(0,n.useState)(60),[y,b]=(0,n.useState)(240),[w,N]=(0,n.useState)(900),[k,S]=(0,n.useState)("none"),[C,F]=(0,n.useState)("confirm"),[R,M]=(0,n.useState)("ask"),[T,E]=(0,n.useState)("off"),[D,B]=(0,n.useState)(""),[A,H]=(0,n.useState)("");(0,n.useEffect)(()=>{o.FH.settings().then(e=>{var l,t,n,r,i,o,d;s.current=e.raw,a(e.raw);let u=null!=(l=e.raw.limits)?l:{};c("number"==typeof u.retryBlockedInFreshChat?u.retryBlockedInFreshChat:2),m("number"==typeof u.minApproachesBeforeBlocked?u.minApproachesBeforeBlocked:2),v("number"==typeof u.maxReviewRounds?u.maxReviewRounds:2),g("number"==typeof u.maxIterations?u.maxIterations:60),b("number"==typeof u.maxRunMinutes?u.maxRunMinutes:240);let h=null!=(t=e.raw.copilot)?t:{};N("number"==typeof h.replyTimeoutSec?h.replyTimeoutSec:900);let p=null!=(n=e.raw.execution)?n:{};S(null!=(r=p.isolation)?r:"none"),F(null!=(i=p.mode)?i:"confirm"),M(null!=(o=p.networkFetch)?o:"ask"),E(null!=(d=p.planMode)?d:"off")}).catch(e=>H(e.message))},[]);let I=(l,t,n)=>{let i=async()=>{var r;if(!s.current)return;let i=await o.FH.settings().then(e=>e.raw).catch(()=>s.current),d={...i,[l]:{...null!=(r=i[l])?r:{},[t]:n}};B("");try{await o.FH.saveSettings(d),s.current=d,a(d),B(e("exec.saved")),H("")}catch(e){H(e.message)}},d=r.current.then(i);return r.current=d.catch(()=>void 0),d},W=h(e=>I("limits","retryBlockedInFreshChat",e)),P=h(e=>I("limits","minApproachesBeforeBlocked",e)),L=h(e=>I("limits","maxReviewRounds",e)),O=h(e=>I("limits","maxIterations",e)),q=h(e=>I("limits","maxRunMinutes",e)),_=h(e=>I("copilot","replyTimeoutSec",e)),U=(e,l)=>I("execution",e,l);return(0,t.jsxs)("div",{className:"panel",id:"execution",children:[(0,t.jsx)("h2",{children:e("exec.title")}),(0,t.jsx)("p",{className:"muted small",children:e("exec.intro")}),A&&(0,t.jsx)("div",{className:"err",children:A}),(0,t.jsx)("label",{htmlFor:"min-approaches",children:e("exec.minApproaches")}),(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)(p,{id:"min-approaches",value:u,min:2,max:20,onChange:e=>{m(e),P(e)},disabled:!l}),(0,t.jsx)("span",{className:"muted small",children:e("exec.minApproachesUnit")})]}),(0,t.jsx)("p",{className:"why",children:e("exec.minApproachesWhy")}),(0,t.jsx)("label",{htmlFor:"max-review-rounds",children:e("exec.maxReviewRounds")}),(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)(p,{id:"max-review-rounds",value:x,min:1,max:6,onChange:e=>{v(e),L(e)},disabled:!l}),(0,t.jsx)("span",{className:"muted small",children:e("exec.maxReviewRoundsUnit")})]}),(0,t.jsx)("p",{className:"why",children:e("exec.maxReviewRoundsWhy")}),(0,t.jsx)("label",{htmlFor:"retry-blocked",children:e("exec.retryBlocked")}),(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)(p,{id:"retry-blocked",value:i,min:0,max:5,onChange:e=>{c(e),W(e)},disabled:!l}),(0,t.jsx)("span",{className:"muted small",children:e("exec.retryBlockedTimes")})]}),(0,t.jsx)("p",{className:"why",children:e("exec.retryBlockedWhy")}),(0,t.jsx)("label",{htmlFor:"max-iterations",children:e("exec.maxIterations")}),(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)(p,{id:"max-iterations",value:f,min:5,max:200,onChange:e=>{g(e),O(e)},disabled:!l}),(0,t.jsx)("span",{className:"muted small",children:e("exec.maxIterationsUnit")})]}),(0,t.jsx)("p",{className:"why",children:e("exec.maxIterationsWhy")}),(0,t.jsx)("label",{htmlFor:"max-minutes",children:e("exec.maxRunMinutes")}),(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)(p,{id:"max-minutes",value:y,min:10,max:1440,onChange:e=>{b(e),q(e)},disabled:!l}),(0,t.jsx)("span",{className:"muted small",children:e("exec.maxRunMinutesUnit")})]}),(0,t.jsx)("p",{className:"why",children:e("exec.maxRunMinutesWhy")}),(0,t.jsx)("label",{htmlFor:"reply-timeout",children:e("exec.replyTimeout")}),(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)(p,{id:"reply-timeout",value:w,min:60,max:10800,onChange:e=>{N(e),_(e)},disabled:!l}),(0,t.jsx)("span",{className:"muted small",children:e("exec.replyTimeoutUnit")})]}),(0,t.jsx)("p",{className:"why",children:e("exec.replyTimeoutWhy")}),(0,t.jsx)("label",{htmlFor:"isolation",children:e("exec.isolation")}),(0,t.jsxs)("select",{id:"isolation",value:k,onChange:e=>{let l=e.target.value;S(l),U("isolation",l)},disabled:!l,children:[(0,t.jsx)("option",{value:"none",children:e("exec.isolationNone")}),(0,t.jsx)("option",{value:"none-accepted",children:e("exec.isolationNoneAccepted")}),(0,t.jsx)("option",{value:"separate-account",children:e("exec.isolationAccount")}),(0,t.jsx)("option",{value:"sandbox",children:e("exec.isolationSandbox")}),(0,t.jsx)("option",{value:"vm",children:e("exec.isolationVm")})]}),(0,t.jsx)("p",{className:"why",children:e("exec.isolationWhy")}),(0,t.jsx)("label",{htmlFor:"start-mode",children:e("exec.startMode")}),(0,t.jsxs)("select",{id:"start-mode",value:C,onChange:e=>{let l=e.target.value;F(l),U("mode",l)},disabled:!l,children:[(0,t.jsx)("option",{value:"confirm",children:e("exec.startModeAsk")}),(0,t.jsx)("option",{value:"unattended",children:e("exec.startModeAuto")})]}),(0,t.jsx)("p",{className:"why",children:e("exec.startModeWhy")}),(0,t.jsx)("label",{htmlFor:"network-fetch",children:e("exec.networkFetch")}),(0,t.jsxs)("select",{id:"network-fetch",value:R,onChange:e=>{let l=e.target.value;M(l),U("networkFetch",l)},disabled:!l,children:[(0,t.jsx)("option",{value:"ask",children:e("exec.networkFetchAsk")}),(0,t.jsx)("option",{value:"refuse",children:e("exec.networkFetchRefuse")}),(0,t.jsx)("option",{value:"run",children:e("exec.networkFetchRun")})]}),(0,t.jsx)("p",{className:"why",children:e("exec.networkFetchWhy")}),(0,t.jsx)("label",{htmlFor:"plan-mode",children:e("pm.setting")}),(0,t.jsxs)("select",{id:"plan-mode",value:T,onChange:e=>{let l=e.target.value;E(l),U("planMode",l)},disabled:!l,children:[(0,t.jsx)("option",{value:"off",children:e("pm.off")}),(0,t.jsx)("option",{value:"auto",children:e("pm.auto")}),(0,t.jsx)("option",{value:"approve",children:e("pm.approveMode")})]}),(0,t.jsx)(j,{msg:D}),(0,t.jsx)("p",{className:"why",children:e("pm.settingWhy")})]})}function y(){let{t:e}=(0,d.kj)(),[l,a]=(0,n.useState)(""),[s,r]=(0,n.useState)(!1),[i,c]=(0,n.useState)(""),[u,m]=(0,n.useState)(""),h=async()=>{r(!0),m(""),c(e("login.waiting"));try{let e=await o.FH.login(l);e.ok?c(e.message):(c(""),m(e.message))}catch(e){c(""),m(e.message)}finally{r(!1)}};return(0,t.jsxs)("div",{className:"panel",id:"login",children:[(0,t.jsx)("h2",{children:e("login.title")}),(0,t.jsx)("p",{className:"muted small",children:e("login.intro")}),u&&(0,t.jsx)("div",{className:"err",children:u}),(0,t.jsx)("label",{htmlFor:"login-account",children:e("login.account")}),(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)("input",{id:"login-account",type:"email",className:"grow",value:l,onChange:e=>a(e.target.value),placeholder:"name@company.com",disabled:s}),(0,t.jsx)("button",{className:"primary",onClick:()=>void h(),disabled:s,children:s?e("login.busy"):e("login.button")})]}),(0,t.jsx)("p",{className:"why",children:e("login.accountWhy")}),i&&(0,t.jsx)("div",{className:"small",role:"status",children:i})]})}function b(e){var l;let{catalogue:a,setCatalogue:s,refreshModels:r,refreshing:i,refreshMsg:c}=e,{t:m}=(0,d.kj)(),h=(0,d.W3)(),[p,x]=(0,n.useState)(""),[v,f]=(0,n.useState)(""),[g,y]=(0,n.useState)(!1),b=null!=(l=null==a?void 0:a.defaultModel)?l:"",N=async e=>{y(!0),x("");try{let l=await o.FH.setDefaultModel(e);a&&s({...a,defaultModel:l.defaultModel}),x(l.defaultModel?m("def.modelSaved",{name:l.defaultModel}):m("def.modelCleared")),f("")}catch(e){f(e.message)}finally{y(!1)}};return(0,t.jsxs)("div",{className:"panel",id:"model",children:[(0,t.jsx)("h2",{children:m("def.modelTitle")}),(0,t.jsx)("p",{className:"muted small",children:m("def.modelIntro")}),v&&(0,t.jsx)("div",{className:"err",children:v}),(0,t.jsx)("label",{htmlFor:"default-model",children:m("def.modelField")}),(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)(u.Y,{id:"default-model",chosen:b,onChange:e=>void N(e),none:m("def.modelNone"),catalogue:a,disabled:g||i}),(0,t.jsx)("button",{className:"quiet",onClick:()=>void N(""),disabled:g||!b,children:m("proj.clear")}),(0,t.jsx)("button",{onClick:()=>void r(),disabled:g||i,children:m("model.refresh")})]}),(0,t.jsx)(j,{msg:p||c}),(0,t.jsx)("p",{className:"muted small",style:{marginTop:8},children:(null==a?void 0:a.readAt)?m("model.readAt",{t:h(a.readAt),n:a.options.length}):m("model.neverRead")}),(0,t.jsx)(w,{}),(0,t.jsx)("h3",{children:m("proj.affects")}),(0,t.jsxs)("ul",{className:"muted small",style:{margin:0,paddingLeft:20},children:[(0,t.jsx)("li",{children:m("def.modelAffectsNew")}),(0,t.jsx)("li",{children:m("def.modelAffectsExisting")}),(0,t.jsx)("li",{children:m("def.modelAffectsBatch")})]})]})}function w(){let{t:e}=(0,d.kj)(),[l,a]=(0,n.useState)(null),[s,r]=(0,n.useState)("");(0,n.useEffect)(()=>{o.FH.settings().then(e=>{var l;return a((null==(l=e.raw.copilot)?void 0:l.manualModel)===!0)}).catch(e=>r(e.message))},[]);let i=async e=>{a(e);try{var l;let a=await o.FH.settings();await o.FH.saveSettings({...a.raw,copilot:{...null!=(l=a.raw.copilot)?l:{},manualModel:e}}),r("")}catch(e){r(e.message)}};return(0,t.jsxs)("div",{style:{marginTop:12},children:[(0,t.jsxs)("label",{className:"row",style:{gap:8,alignItems:"center"},children:[(0,t.jsx)("input",{id:"manual-model",type:"checkbox",checked:!0===l,disabled:null===l,onChange:e=>void i(e.target.checked)}),(0,t.jsx)("span",{children:e("def.manualModel")})]}),(0,t.jsx)("p",{className:"why",children:e("def.manualModelWhy")}),s&&(0,t.jsx)("div",{className:"err",children:s})]})}function N(e){var l,a;let{catalogue:s,setCatalogue:r,refreshModels:c,refreshing:m,refreshMsg:h}=e,{t:p}=(0,d.kj)(),[x,v]=(0,n.useState)(""),[f,g]=(0,n.useState)(""),[y,b]=(0,n.useState)(!1),w=null!=(l=null==s?void 0:s.defaultReviewModel)?l:"",N=async e=>{b(!0),v("");try{let l=await o.FH.setDefaultReviewModel(e);s&&r({...s,defaultReviewModel:l.defaultReviewModel}),v(l.defaultReviewModel?p("def.reviewSaved",{name:l.defaultReviewModel}):p("def.reviewCleared")),g("")}catch(e){g(e.message)}finally{b(!1)}},k=""!==w&&w===(null!=(a=null==s?void 0:s.defaultModel)?a:"");return(0,t.jsxs)("div",{className:"panel",id:"review",children:[(0,t.jsx)("h2",{children:p("def.reviewTitle")}),(0,t.jsx)("p",{className:"muted small",children:p("def.reviewIntro")}),f&&(0,t.jsx)("div",{className:"err",children:f}),(0,t.jsx)("label",{htmlFor:"default-review-model",children:p("def.reviewField")}),(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)(u.Y,{id:"default-review-model",chosen:w,onChange:e=>void N(e),none:p("def.reviewNone"),catalogue:s,disabled:y||m}),(0,t.jsx)("button",{className:"quiet",onClick:()=>void N(""),disabled:y||!w,children:p("proj.clear")}),(0,t.jsx)("button",{onClick:()=>void c(),disabled:y||m,children:p("model.refresh")})]}),k&&(0,t.jsx)("p",{className:"why",style:{color:"var(--warn)"},children:p("def.reviewSame")}),(0,t.jsx)(j,{msg:x||h}),(0,t.jsx)("h3",{children:p("proj.affects")}),(0,t.jsxs)("ul",{className:"muted small",style:{margin:0,paddingLeft:20},children:[(0,t.jsx)("li",{children:p("def.reviewAffectsNew")}),(0,t.jsx)("li",{children:p("def.reviewAffectsExisting")}),(0,t.jsx)("li",{children:p("def.reviewAffectsBatch")})]}),(0,t.jsxs)("div",{className:"row",style:{marginTop:12},children:[(0,t.jsx)(i(),{href:"/",className:"button-link plain",children:p("proj.toSessions")}),(0,t.jsx)(i(),{href:"/import",className:"button-link quiet",children:p("proj.toImport")})]})]})}},4784:(e,l,a)=>{"use strict";a.d(l,{Y:()=>i});var t=a(3365),n=a(1521),s=a(5549),r=a(867);function i(e){var l,a,i;let{id:o,chosen:d,onChange:c,none:u,catalogue:m,disabled:h=!1,style:p}=e,{t:x}=(0,r.kj)(),j=function(e){let[l,a]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(void 0!==e)return;let l=!0;return s.FH.models().then(e=>{l&&a(e)}).catch(()=>void 0),()=>{l=!1}},[e]),void 0!==e?e:l}(m),v=null!=(l=null==j?void 0:j.options)?l:[],f=e=>e.toLowerCase().replace(/[-‐‑‒–—_]+/g," ").replace(/\s+/g," ").trim(),g=d?v.find(e=>f(e.name)===f(d)):void 0,y=null!=(a=null==g?void 0:g.name)?a:d,b=!!g,w=v.filter(e=>!e.group),N=new Map;for(let e of v)e.group&&N.set(e.group,[...null!=(i=N.get(e.group))?i:[],e]);return(0,t.jsxs)("select",{id:o,value:y,onChange:e=>c(e.target.value),disabled:h,style:{width:"auto",minWidth:280,...p},children:[(0,t.jsx)("option",{value:"",children:u}),d&&!b&&(0,t.jsx)("option",{value:d,children:x("model.notInList",{name:d})}),w.map(e=>(0,t.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(x("model.unavailable")):""]},e.name)),[...N.entries()].map(e=>{let[l,a]=e;return(0,t.jsx)("optgroup",{label:l,children:a.map(e=>(0,t.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(x("model.unavailable")):""]},e.name))},l)})]})}},4969:(e,l,a)=>{"use strict";a.d(l,{V:()=>s});var t=a(1521);let n='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function s(e,l,a){(0,t.useEffect)(()=>{var t,s;if(!l)return;let r=document.activeElement instanceof HTMLElement?document.activeElement:null,i=e.current,o=null!=(s=null!=(t=null==a?void 0:a.current)?t:null==i?void 0:i.querySelector(n))?s:null;null==o||o.focus();let d=e=>{if("Tab"!==e.key||!i)return;let l=Array.from(i.querySelectorAll(n)).filter(e=>null!==e.offsetParent);if(0===l.length)return;let a=l[0],t=l[l.length-1],s=i.contains(document.activeElement);e.shiftKey&&(document.activeElement===a||!s)?(e.preventDefault(),t.focus()):e.shiftKey||document.activeElement!==t&&s||(e.preventDefault(),a.focus())};return document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d),r&&document.contains(r)&&r.focus()}},[e,l,a])}},8596:(e,l,a)=>{"use strict";a.d(l,{E:()=>i});var t=a(3365),n=a(1521),s=a(5549),r=a(867);function i(e){var l,a,i,o,d,c,u;let{dir:m,onDone:h}=e,{t:p}=(0,r.kj)(),x=(0,r.W3)(),[j,v]=(0,n.useState)(null),[f,g]=(0,n.useState)(""),[y,b]=(0,n.useState)(""),[w,N]=(0,n.useState)(""),[k,S]=(0,n.useState)(!1),C=e=>(null!=e?e:"—").slice(0,8),F=async e=>{b(""),N(""),g(e?"fetch":"prepare");try{v(await s.FH.preparePreview(m,e))}catch(e){b(e.message)}finally{g("")}},R=async()=>{if(null==j?void 0:j.fingerprint){b(""),g("prepare");try{var e,l;let a=await s.FH.prepareProject(m,j.fingerprint,{savedBranch:j.savedBranch,savedMainBranch:j.savedMainBranch});a.ok?(N(null!=(l=a.result)?l:""),v(null),null==h||h()):b(null!=(e=a.problem)?e:"")}catch(e){b(e.message)}finally{g("")}}},M=async e=>{try{await navigator.clipboard.writeText(e),S(!0),window.setTimeout(()=>S(!1),2500)}catch(e){b(p("plan.copyFailed"))}},T=e=>(0,t.jsxs)("ul",{style:{margin:"2px 0 6px",paddingLeft:20},children:[e.slice(0,30).map(e=>(0,t.jsx)("li",{children:(0,t.jsx)("code",{children:e})},e)),e.length>30&&(0,t.jsx)("li",{className:"muted",children:p("prep.more",{n:e.length-30})})]}),E=j&&!j.ok&&j.fetched&&!j.fetched.ok;return(0,t.jsxs)("div",{className:"prepare-folder small",style:{marginTop:8,overflowWrap:"anywhere"},children:[(0,t.jsx)("button",{type:"button",onClick:()=>void F(!0),disabled:!!f,children:p("prep.show")}),(0,t.jsx)("p",{className:"why",children:p("prep.why")}),(0,t.jsx)("p",{className:"why",children:p("prep.password")}),"fetch"===f&&(0,t.jsx)("p",{role:"status",children:p("prep.fetching")}),y&&(0,t.jsx)("p",{className:"err",role:"alert",children:y}),w&&(0,t.jsx)("p",{className:"notice",role:"status",children:w}),j&&!j.ok&&!E&&(0,t.jsx)("p",{className:"err",children:j.problem}),E&&(0,t.jsxs)("div",{className:"notice caution",style:{marginTop:8},children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:p("prep.fetchFailed")})," ",(0,t.jsx)("code",{children:null==(l=j.fetched)?void 0:l.detail})]}),(null==(a=j.fetched)?void 0:a.auth)&&(0,t.jsx)("p",{children:p("prep.fetchAuth")}),(0,t.jsx)("div",{className:"row",children:(0,t.jsx)("button",{type:"button",onClick:()=>void F(!0),disabled:!!f,children:p("prep.retry")})}),j.fetchCommand&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{style:{marginTop:8},children:p("prep.ownTerminal")}),(0,t.jsx)("pre",{className:"sync-cmd",children:j.fetchCommand}),(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{var e;M(null!=(e=j.fetchCommand)?e:"")},children:p("prep.copyFetch")}),k&&(0,t.jsx)("span",{className:"badge done",children:p("prep.copied")}),(0,t.jsx)("button",{type:"button",onClick:()=>void F(!1),disabled:!!f,children:p("prep.useFetched")})]}),j.lastFetched&&(0,t.jsx)("p",{className:"muted",children:p("prep.lastFetched",{when:x(j.lastFetched)})})]})]}),(null==j?void 0:j.ok)&&(0,t.jsxs)("div",{className:"notice caution",style:{marginTop:8},children:[(0,t.jsx)("p",{children:p("prep.where",{target:null!=(i=j.target)?i:"",commit:C(j.targetCommit),branch:null!=(o=j.branch)?o:"HEAD",head:C(j.head)})}),!j.fetched&&(0,t.jsxs)("p",{className:"muted",children:[p("prep.notFetched")," ",j.lastFetched?p("prep.lastFetched",{when:x(j.lastFetched)}):p("prep.lastFetchedUnknown")]}),j.alreadyThere?(0,t.jsx)("p",{children:p("prep.already")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("strong",{children:p("prep.willDo")}),(0,t.jsxs)("ol",{style:{margin:"4px 0",paddingLeft:20},children:[j.savedBranch&&(0,t.jsxs)("li",{children:[p("prep.keepChanges",{changed:j.changed.length,untracked:j.untracked.length,saved:j.savedBranch}),T([...j.changed,...j.untracked])]}),j.savedMainBranch&&(0,t.jsxs)("li",{children:[p("prep.keepMain",{n:j.mainOnlyCommits.length,branch:null!=(d=j.localBranch)?d:"",saved:j.savedMainBranch}),T(j.mainOnlyCommits)]}),(0,t.jsx)("li",{children:p("prep.moveTo",{branch:null!=(c=j.localBranch)?c:"",commit:C(j.targetCommit),target:null!=(u=j.target)?u:""})})]}),j.branchOnlyCommits.length>0&&j.branch&&(0,t.jsx)("p",{children:p("prep.branchStays",{branch:j.branch,n:j.branchOnlyCommits.length})}),(0,t.jsx)("p",{className:"muted",children:p("prep.ignored")}),(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)("button",{type:"button",className:"primary",onClick:()=>void R(),disabled:!!f,children:p("prep.confirm")}),(0,t.jsx)("button",{type:"button",className:"quiet",onClick:()=>v(null),disabled:!!f,children:p("prep.cancel")})]})]})]})]})}}},e=>{e.O(0,[197,867,549,347,131,358],()=>e(e.s=1896)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[810],{3256:(e,s,t)=>{Promise.resolve().then(t.bind(t,4627))},4627:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>q});var n=t(3365),a=t(1521),l=t(8197),i=t.n(l),r=t(5549),o=t(7527),d=t(4969),c=t(1366),u=t(1701),h=t(3523),m=t(3374),p=t(867),g=t(1910),x=t(5132);function j(){let{t:e}=(0,p.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)(x.s,{text:e("row.infoWhich"),className:"small"})]})]})}function k(e){let{onChange:s}=e,{t}=(0,p.kj)(),[l,i]=(0,a.useState)(null),[d,c]=(0,a.useState)(!1),[u,h]=(0,a.useState)(""),m=(0,a.useCallback)(async()=>{try{i(await r.FH.batch())}catch(e){}},[]);(0,o.z)(m,3e3);let g=async e=>{c(!0),h("");try{"pause"===e?await r.FH.pauseBatch():"resume"===e?await r.FH.resumeBatch():await r.FH.stopBatch(),await m(),null==s||s()}catch(e){h(e.message)}finally{c(!1)}};return(null==l?void 0:l.running)?(0,n.jsxs)("div",{className:"row",style:{marginBottom:8},children:[l.pausing?(0,n.jsx)("button",{className:"primary",disabled:d,onClick:()=>void g("resume"),title:t("batch.resumeWhy"),children:t("batch.resume")}):(0,n.jsx)("button",{disabled:d||l.stopping,onClick:()=>void g("pause"),title:t("batch.pauseWhy"),children:t("batch.pause")}),(0,n.jsx)("button",{className:"danger",disabled:d||l.stopping,onClick:()=>void g("stop"),title:t("batch.stopWhy"),children:t("batch.stop")}),l.pausing&&!l.stopping&&(0,n.jsx)("span",{className:"muted small",children:t("batch.pausing")}),l.stopping&&(0,n.jsx)("span",{className:"muted small",children:t("batch.stopping")}),u&&(0,n.jsx)("span",{className:"err small",children:u})]}):null}var v=t(3041),N=t(1035),f=t(8934),y=t(4811),w=t(2876),b=t(287),I=t(6983);let C=["queued","running","waiting-approval"],S=["blocked","failed","aborted","limit-reached"],F=e=>!!e.continuable;function H(e){let{run:s}=e,{t}=(0,p.kj)(),a=s.entries.some(h.DG),l=(0,m.c)(a),i=(0,h.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)})})}let A=(0,a.createContext)(new Map),R=(0,a.createContext)({runPanel:null,setRunPanel:()=>void 0}),T=(0,a.createContext)(()=>void 0);function P(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 q(){let{t:e}=(0,p.kj)(),s=(0,p.W3)(),[t,l]=(0,a.useState)(null),[i,d]=(0,a.useState)(""),[c,u]=(0,a.useState)(""),[h,m]=(0,a.useState)("flow"),[g,x]=(0,a.useState)(""),[j,v]=(0,a.useState)(""),[N,f]=(0,a.useState)(""),y=(0,a.useCallback)(async()=>{try{l(await r.FH.tasks()),u(new Date().toISOString()),d("")}catch(e){d(e.message)}},[]);(0,o.z)(y,6e3);let w=(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]),b=(0,a.useMemo)(()=>{let e=N.trim().toLowerCase();return(null!=t?t:[]).filter(s=>{var t,n;return(!g||s.sessionId===g)&&(!j||s.status===j)&&(!e||"".concat(s.title," ").concat(null!=(t=s.summary)?t:""," ").concat(null!=(n=s.reason)?n:""," ").concat(s.sessionName).toLowerCase().includes(e))})},[t,g,j,N]),F=(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=>S.includes(e.status)).length}},[t]),H=(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]),q=(0,a.useMemo)(()=>P(b),[b]),W=(0,a.useMemo)(()=>(function(e){let s=new Map;for(let n of e){var t;let e=n.title.trim().toLowerCase();s.set(e,[...null!=(t=s.get(e))?t:[],n])}let n=new Map;for(let e of s.values())for(let s of e){let t=e.filter(e=>e.sessionId!==s.sessionId);t.length>0&&n.set("".concat(s.sessionId,":").concat(s.taskId),t)}return n})(null!=t?t:[]),[t]),[M,D]=(0,a.useState)(null),V=(0,a.useMemo)(()=>({runPanel:M,setRunPanel:D}),[M]),[X,J]=(0,a.useState)(null),Q=b.filter(e=>"running"===e.status||"waiting-approval"===e.status),Y=b.filter(e=>"queued"===e.status),$=[...b.filter(e=>S.includes(e.status)&&"stop"===e.sessionOnFailure&&!e.sessionRunning&&Y.some(s=>s.sessionId===e.sessionId)),...Y].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}),ee=b.filter(e=>!C.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)}),es=""!==g||""!==j||""!==N.trim();return(0,n.jsx)(A.Provider,{value:W,children:(0,n.jsx)(R.Provider,{value:V,children:(0,n.jsxs)(T.Provider,{value:J,children:[(null==X?void 0:X.kind)==="fix-prompt"&&(0,n.jsx)(B,{entry:X.entry,offerRun:!0,onClose:e=>{J(null),e&&y()}}),(null==X?void 0:X.kind)==="follow-up"&&(0,n.jsx)(I.J,{sessionId:X.entry.sessionId,taskId:X.entry.taskId,title:X.entry.title,onClose:e=>{J(null),e&&y()}}),(null==X?void 0:X.kind)==="contract"&&(0,n.jsx)(z,{entry:X.entry,onChange:()=>void y(),onClose:e=>{J(null),e&&y()}}),(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("h2",{className:"grow",style:{margin:0},children:e("reg.title")}),(0,n.jsx)("span",{className:"muted small",children:c&&e("reg.updated",{t:s(c)})}),(0,n.jsx)("button",{className:"quiet",onClick:()=>void y(),children:e("reg.refresh")})]}),(0,n.jsx)("p",{className:"muted small",children:e("reg.hint")}),(0,n.jsx)(U,{sessions:w}),(0,n.jsxs)("div",{className:"counts",children:[(0,n.jsxs)("div",{className:"count",children:[(0,n.jsx)("div",{className:"n",children:F.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:F.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:F.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:F.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:F.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:g,onChange:e=>x(e.target.value),children:[(0,n.jsx)("option",{value:"",children:e("reg.allSessions")}),w.map(e=>{let[s,t]=e;return(0,n.jsx)("option",{value:s,children:t},s)})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"f-status",style:{margin:0},children:e("reg.filterStatus")}),(0,n.jsxs)("select",{id:"f-status",value:j,onChange:e=>v(e.target.value),children:[(0,n.jsx)("option",{value:"",children:e("reg.allStatuses")}),["queued","running","waiting-approval","done","blocked","failed","aborted","limit-reached"].map(s=>(0,n.jsx)("option",{value:s,children:e("status.".concat(s))},s))]})]}),(0,n.jsxs)("div",{className:"grow",children:[(0,n.jsx)("label",{htmlFor:"f-q",style:{margin:0},children:e("reg.search")}),(0,n.jsx)("input",{id:"f-q",type:"text",value:N,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"===h,onClick:()=>m("flow"),children:e("reg.viewFlow")}),(0,n.jsx)("button",{type:"button","aria-pressed":"runs"===h,onClick:()=>m("runs"),children:e("reg.groupBy")}),(0,n.jsx)("button",{type:"button","aria-pressed":"list"===h,onClick:()=>m("list"),children:e("reg.viewList")})]})]}),es&&(0,n.jsx)("button",{className:"quiet",onClick:()=>{x(""),v(""),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===b.length&&(0,n.jsx)("div",{className:"empty",children:e("reg.noMatch")})]}),"list"===h&&b.length>0&&(0,n.jsx)(K,{entries:[...Q,...Y,...ee]}),"runs"===h&&b.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")})]}),q.runs.map(e=>(0,n.jsxs)("section",{className:"panel",children:[(0,n.jsx)(_,{run:e}),(0,n.jsx)(O,{entries:e.entries,sizes:H,onChange:()=>void y()})]},e.id)),q.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)(O,{entries:q.loose,sizes:H,onChange:()=>void y()})]})]}),"flow"===h&&(0,n.jsxs)(n.Fragment,{children:[Q.length>0&&(0,n.jsxs)("section",{className:"panel",children:[(0,n.jsx)("h2",{children:e("reg.activeNow")}),(0,n.jsx)(O,{entries:Q,sizes:H,onChange:()=>void y()})]}),b.length>0&&(0,n.jsxs)("div",{style:{marginBottom:12},children:[(0,n.jsx)(k,{onChange:()=>void y()}),b.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:b.filter(e=>e.interrupted&&!e.sessionRunning).length})]}),(0,n.jsx)(Z,{entries:b,onChange:()=>void y()})]}),b.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===ee.length?(0,n.jsx)("div",{className:"empty",children:e("reg.noPast")}):(0,n.jsx)(L,{entries:ee,sizes:H,onChange:()=>void y()})]}),b.length>0&&(0,n.jsx)("section",{className:"panel",children:(0,n.jsxs)(E,{count:$.length,children:[(0,n.jsx)("p",{className:"muted small",children:e("reg.upcomingHint")}),0===$.length?(0,n.jsx)("div",{className:"empty",children:e("reg.noUpcoming")}):(0,n.jsx)(O,{entries:$,upcoming:!0,sizes:H,onChange:()=>void y()})]})}),t&&t.length>0&&(0,n.jsx)(G,{refreshKey:c})]})]})})})}let W="cop.register.upcomingOpen";function E(e){let{count:s,children:t}=e,{t:l}=(0,p.kj)(),[i,r]=(0,a.useState)(()=>{try{let e=window.localStorage.getItem(W);if("true"===e||"false"===e)return"true"===e}catch(e){}return s<=8});return(0,n.jsxs)("details",{open:i,children:[(0,n.jsx)("summary",{onClick:e=>{e.preventDefault();let s=!i;r(s);try{window.localStorage.setItem(W,String(s))}catch(e){}},children:(0,n.jsxs)("h2",{style:{display:"inline"},children:[l("reg.upcoming")," (",s,")"]})}),i&&t]})}function G(e){let{refreshKey:s}=e,{t}=(0,p.kj)(),[l,i]=(0,a.useState)(null),[o,d]=(0,a.useState)("");if((0,a.useEffect)(()=>{r.FH.metrics().then(e=>{i(e),d("")}).catch(e=>d(e.message))},[s]),!l)return o?(0,n.jsx)("div",{className:"panel err",children:o}):null;let c=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=>c(e.firstPass)],["metrics.doneInTheEnd",e=>c(e.doneInTheEnd)],["metrics.falseCompletion",e=>c(e.falseCompletion)],["metrics.reviewRejection",e=>c(e.reviewRejection)],["metrics.repeatedCommands",e=>c(e.repeatedCommands)],["metrics.noProgress",e=>c(e.noProgress)],["metrics.scopeViolation",e=>c(e.scopeViolation)],["metrics.unrelatedDiff",e=>c(e.unrelatedDiff)],["metrics.resumed",e=>c(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(", ")||"—"]],h=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")}),h&&h.withStats<h.attempts&&(0,n.jsx)("p",{className:"muted small",children:t("metrics.olderAttempts",{n:h.attempts-h.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 O(e){let{entries:s,upcoming:t=!1,sizes:l,onChange:o,picking:d}=e,{t:c}=(0,p.kj)(),u=(0,p.W3)(),k=(0,v.e)(null!=o?o:()=>void 0),N=(0,m.c)(s.some(h.DG)),[y,I]=(0,a.useState)(new Set),[H,P]=(0,a.useState)(null),{runPanel:q,setRunPanel:W}=(0,a.useContext)(R),E=(0,a.useContext)(T),G=(0,a.useContext)(A);return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)("ol",{className:"flow",children:s.map(e=>{var s,a,m,p,v,A,R,T,O,_,L,B,z,U,X,Z,K,J,Q,Y,$,ee,es,et,en,ea,el;let ei=t&&1===e.queuePosition,er=e.runGroup?null!=(T=null==l?void 0:l.get(e.runGroup.id))?T:1:0;return(0,n.jsxs)("li",{className:"".concat(e.status).concat(ei?" next":""),children:[(0,n.jsx)("span",{className:"flow-mark",role:"img","aria-label":c("status.".concat(e.status)),title:c("flow.markWhy",{status:c("status.".concat(e.status))})}),(0,n.jsxs)("div",{className:"head",children:[d&&(0,n.jsx)("input",{type:"checkbox",className:"pick","aria-label":e.title,checked:d.picked.has("".concat(e.sessionId,":").concat(e.taskId)),onChange:()=>d.toggle("".concat(e.sessionId,":").concat(e.taskId))}),(0,n.jsx)("strong",{children:e.title}),(0,n.jsx)("span",{className:"badge ".concat(e.status),children:c("status.".concat(e.status))}),ei&&(0,n.jsx)("span",{className:"chip",children:c("reg.next")}),(0,n.jsx)(M,{entry:e,twins:G.get("".concat(e.sessionId,":").concat(e.taskId))}),e.limit&&(0,n.jsx)("span",{className:"chip",title:c("reg.limitChipWhy"),children:c("reg.limitChip",{limit:(el=e.limit,c("limit.".concat(el.setting),{n:el.value}))})}),t&&S.includes(e.status)&&(0,n.jsx)("span",{className:"chip",title:c("reg.willRequeueFirstWhy"),children:c("reg.willRequeueFirst")}),e.sessionRunning&&(0,n.jsx)("span",{className:"chip",children:c("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?c("review.ran",{n:e.review.stepsRun}):void 0,children:[c("review.verdict.".concat(e.review.verdict)),e.review.findings>0?" (".concat(e.review.findings,")"):""]}),(null!=(O=e.deviations)?O:0)>0&&(0,n.jsx)("span",{className:"badge waiting-approval",title:c("reg.deviationsWhy"),children:c("reg.deviations",{n:null!=(_=e.deviations)?_:0})}),(null!=(L=e.disputes)?L:0)>0&&(0,n.jsx)("span",{className:"badge waiting-approval",title:c("reg.disputesWhy"),children:c("reg.disputes",{n:null!=(B=e.disputes)?B:0})}),e.readOnly&&(0,n.jsx)("span",{className:"chip",title:c("reg.readOnlyWhy"),children:c("task.readOnly")}),e.stopCode&&(0,n.jsx)("span",{className:"chip",title:c("stop.why"),children:c("stop.".concat(e.stopCode))}),(null!=(z=null==(s=e.scope)?void 0:s.length)?z:0)>0&&(0,n.jsx)("span",{className:"chip",title:c("task.scopeWhy"),children:c("task.scope",{paths:(null!=(U=e.scope)?U:[]).join(", ")})}),(null!=(X=e.autoRetries)?X:0)>0&&(0,n.jsx)("span",{className:"badge ".concat("done"===e.status?"done":"blocked"===e.status?"blocked":""),title:c("reg.retriedFreshWhy"),children:"done"===e.status?c("reg.retriedFreshDone",{n:null!=(Z=e.autoRetries)?Z:0}):"blocked"===e.status?c("reg.retriedFreshStill",{n:null!=(K=e.autoRetries)?K:0}):c("reg.retriedFreshOther",{n:null!=(J=e.autoRetries)?J:0})}),e.runGroup&&(0,n.jsx)("span",{className:"chip",title:c("reg.runTitle",{t:er,s:e.runGroup.sessions,when:u(e.runGroup.startedAt)}),children:er>1?c("reg.runWith",{n:er-1}):c("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?c("task.started",{t:u(e.startedAt)}):c("task.added",{t:u(e.createdAt)}),e.finishedAt?" \xb7 ".concat(c("task.finished",{t:u(e.finishedAt)})):"",void 0!==e.durationMs?" \xb7 ".concat(c("reg.took",{d:(0,r.c5)(e.durationMs)})):"",(0,h.DG)(e)?" \xb7 ".concat(c("task.runningFor",{d:(0,r.c5)((0,h.d5)(e.startedAt,void 0,N))})):"",e.iterations>0?" \xb7 ".concat(c("reg.iterations",{n:e.iterations})):""]}),"queued"===e.status&&(0,n.jsx)("div",{className:"when",children:e.queuePosition&&e.queuePosition>1?c("reg.willFollow",{n:e.queuePosition-1}):e.sessionRunning?c("reg.queuePos",{n:null!=(Q=e.queuePosition)?Q:1}):c("reg.waitingRun")}),"blocked"===e.status&&(0,n.jsx)("p",{className:"what muted small",children:c("reg.blockedWhat")}),(null!=(Y=null==(a=e.attempts)?void 0:a.length)?Y:0)>0&&(0,n.jsxs)("details",{className:"small",style:{marginTop:6},children:[(0,n.jsx)("summary",{children:(null!=($=null==(m=e.attempts)?void 0:m.length)?$:0)===1?c("reg.attemptsOne",{n:null!=(es=e.attempt)?es:(null!=(ee=null==(p=e.attempts)?void 0:p.length)?ee:0)+1}):c("reg.attempts",{n:null!=(en=e.attempt)?en:(null!=(et=null==(v=e.attempts)?void 0:v.length)?et:0)+1,m:null!=(ea=null==(A=e.attempts)?void 0:A.length)?ea:0})}),(0,n.jsx)("ol",{className:"attempts",children:null==(R=e.attempts)?void 0:R.map(s=>{var t;return(0,n.jsxs)("li",{children:[(0,n.jsxs)("div",{className:"head",children:[(0,n.jsx)("strong",{children:c("reg.attemptN",{n:s.attempt})}),(0,n.jsx)("span",{className:"badge ".concat(s.status),children:c("status.".concat(s.status))}),s.iterations>0&&(0,n.jsx)("span",{className:"muted",children:c("reg.iterations",{n:s.iterations})}),void 0!==s.durationMs&&(0,n.jsx)("span",{className:"muted",children:c("reg.took",{d:(0,r.c5)(s.durationMs)})}),s.runId&&(0,n.jsx)(g.u,{label:c("save.attemptLog"),save:()=>r.FH.saveTaskLog(e.sessionId,e.taskId,s.runId)}),s.runId&&(0,n.jsx)(g.H,{sessionId:e.sessionId,taskId:e.taskId,attempt:s.attempt}),s.runId&&void 0!==s.changedFiles&&(0,n.jsx)(f.C,{sessionId:e.sessionId,taskId:e.taskId,runId:s.runId,title:"".concat(e.title," — ").concat(c("reg.attemptN",{n:s.attempt})),files:s.changedFiles})]}),(0,n.jsxs)("div",{className:"when",children:[s.startedAt?c("task.started",{t:u(s.startedAt)}):"",s.finishedAt?" \xb7 ".concat(c("task.finished",{t:u(s.finishedAt)})):"",s.branch?" \xb7 ".concat(s.branch):""]}),s.reason&&(0,n.jsx)("p",{className:"what err",children:c("reg.stopped",{reason:s.reason})}),s.summary&&(0,n.jsx)(x.s,{text:s.summary,className:"what"})]},"".concat(null!=(t=s.runId)?t:s.attempt))})})]}),e.summary&&(0,n.jsx)(x.s,{text:e.summary,className:"what"}),e.reason&&(0,n.jsx)("p",{className:"what err",children:c("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:c("reg.openTask")}),e.runId&&(0,n.jsx)(g.u,{label:c("save.log"),save:()=>r.FH.saveTaskLog(e.sessionId,e.taskId)}),e.chatUrl&&(0,n.jsx)("a",{href:e.chatUrl,target:"_blank",rel:"noreferrer",children:c("home.col.chat")}),e.startedAt&&(0,n.jsx)(D,{where:{session:e.sessionId,task:e.taskId}}),void 0!==e.changedFiles&&(0,n.jsx)(f.C,{sessionId:e.sessionId,taskId:e.taskId,title:e.title,files:e.changedFiles}),(0,n.jsx)(j,{}),e.runId&&(0,n.jsxs)("button",{className:y.has(e.taskId)?"":"quiet","aria-expanded":y.has(e.taskId),onClick:()=>{let s;return s=e.taskId,I(e=>{let t=new Set(e);return t.has(s)?t.delete(s):t.add(s),t})},title:(0,h.DG)(e)?c("story.showLiveWhy"):c("story.why"),children:[(0,h.DG)(e)&&!y.has(e.taskId)&&(0,n.jsx)("span",{className:"dot","aria-hidden":"true"}),y.has(e.taskId)?c("story.hide"):(0,h.DG)(e)?c("story.showLive"):c("story.show")]}),"queued"===e.status&&!e.sessionRunning&&!e.sessionInactive&&(0,n.jsx)("button",{className:(null==q?void 0:q.taskId)===e.taskId?"":"primary","aria-expanded":(null==q?void 0:q.taskId)===e.taskId,onClick:()=>W((null==q?void 0:q.taskId)===e.taskId?null:{taskId:e.taskId}),title:c("runq.buttonWhy"),children:c("runq.button")}),"contract-conflict"===e.stopCode&&!C.includes(e.status)&&!e.sessionRunning&&(0,n.jsx)("button",{className:"primary","aria-haspopup":"dialog",onClick:()=>E({kind:"contract",entry:e}),title:c("cfix.buttonWhy"),children:c("cfix.button")}),F(e)&&!e.sessionRunning&&!e.sessionInactive&&(0,n.jsx)("button",{className:H===e.taskId?"":"primary","aria-expanded":H===e.taskId,onClick:()=>P(H===e.taskId?null:e.taskId),title:c("reg.continueHereWhy"),children:c("reg.continueHere")}),!F(e)&&(0,r.Dh)(e)&&!e.sessionRunning&&!e.sessionInactive&&(0,n.jsx)("button",{className:"primary","aria-haspopup":"dialog",onClick:()=>E({kind:"follow-up",entry:e}),title:c("fup.buttonWhy"),children:c("fup.button")}),!F(e)&&("failed"===e.status||"blocked"===e.status)&&!e.sessionRunning&&!e.sessionInactive&&(0,n.jsx)("button",{className:H===e.taskId||"contract-conflict"===e.stopCode||(0,r.Dh)(e)?"":"primary","aria-expanded":H===e.taskId,onClick:()=>P(H===e.taskId?null:e.taskId),title:c("reg.rerunHereWhy"),children:c("reg.rerunHere")}),S.includes(e.status)&&!e.sessionRunning&&(0,n.jsx)("button",{className:"quiet","aria-haspopup":"dialog",onClick:()=>E({kind:"fix-prompt",entry:e}),title:c("reg.fixPromptHint"),children:c("reg.fixPrompt")}),"done"===e.status&&!e.sessionRunning&&(0,n.jsx)("button",{className:"quiet","aria-haspopup":"dialog",onClick:()=>E({kind:"fix-prompt",entry:e}),title:c("reg.newPromptHint"),children:c("reg.newPrompt")}),e.startedAt&&!e.sessionRunning&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{className:"quiet",disabled:""!==k.busy,title:c("restore.why"),onClick:()=>void k.restore({sessionId:e.sessionId,taskId:e.taskId,title:e.title}),children:"restore"===k.busy?c("restore.checking"):c("restore.button")}),(0,n.jsx)("button",{className:"quiet",disabled:""!==k.busy,title:c("restart.why"),onClick:()=>void k.restartFrom({sessionId:e.sessionId,taskId:e.taskId,title:e.title}),children:"restart"===k.busy?c("restart.checking"):c("restart.button")})]})]}),H===e.taskId&&(F(e)||"failed"===e.status||"blocked"===e.status)&&!e.sessionRunning&&(0,n.jsx)(V,{entry:e,onClose:e=>{P(null),e&&(null==o||o())}}),(null==q?void 0:q.taskId)===e.taskId&&"queued"===e.status&&(0,n.jsx)(b.f,{target:{sessionId:e.sessionId,taskId:e.taskId,title:e.title},onClose:e=>{W(null),e&&(null==o||o())}}),y.has(e.taskId)&&e.runId&&(0,n.jsx)(w.P,{sessionId:e.sessionId,taskId:e.taskId,live:"running"===e.status||"waiting-approval"===e.status})]},"".concat(e.sessionId,"-").concat(e.taskId))})})})}function M(e){var s;let{entry:t,twins:a}=e,{t:l}=(0,p.kj)(),i=(0,p.W3)();if(!a||0===a.length)return null;let r=l("twin.why",{mine:i(t.createdAt),attempt:null!=(s=t.attempt)?s:1});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"chip twin",title:r,children:l("twin.sameTitle",{n:a.length})}),a.map(e=>{var s;return(0,n.jsx)("span",{className:"chip twin",title:r,children:l("twin.alsoIn",{session:e.sessionName,when:i(e.createdAt),status:l("status.".concat(e.status)),attempt:null!=(s=e.attempt)?s:1})},"".concat(e.sessionId,":").concat(e.taskId))})]})}function D(e){let{where:s}=e,{t}=(0,p.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 _(e){var s;let{run:t}=e,{t:a}=(0,p.kj)(),l=(0,p.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,o=t.entries.filter(e=>S.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)(H,{run:t})]})]}),(0,n.jsxs)("div",{className:"row small",style:{marginTop:4},children:[(0,n.jsx)("span",{className:"badge ".concat(o>0?"failed":r===t.entries.length?"done":""),children:a("reg.runCounts",{done:r,failed:o})}),(0,n.jsx)(D,{where:{run:t.id}})]})]})}function L(e){let{entries:s,sizes:t,onChange:l}=e,{t:i}=(0,p.kj)(),o=(0,a.useMemo)(()=>P(s),[s]),[d,c]=(0,a.useState)(!1),[u,h]=(0,a.useState)(new Set),[m,g]=(0,a.useState)(!1),[x,j]=(0,a.useState)(""),[k,v]=(0,a.useState)(""),N=e=>"".concat(e.sessionId,":").concat(e.taskId),f=s.filter(e=>e.startedAt),y=[...u],w=async()=>{g(!0),v(""),j("");try{let e=await r.FH.downloadBundle(y.map(e=>{let[s,t]=e.split(":");return{sessionId:s,taskId:t}}));j(i("reg.bundleSaved",{name:e}))}catch(e){v(e.message)}finally{g(!1)}},b=d?{picked:u,toggle:e=>h(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:[d?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{className:"quiet",onClick:()=>{c(!1),h(new Set),j(""),v("")},children:i("reg.pickDone")}),(0,n.jsx)("button",{className:"quiet",onClick:()=>h(new Set(f.map(N))),children:i("reg.pickAll")}),(0,n.jsx)("button",{className:"quiet",onClick:()=>h(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:m,onClick:()=>void w(),title:i("reg.bundleWhy"),children:i("reg.bundle",{n:u.size})})]}):(0,n.jsx)("button",{className:"quiet",onClick:()=>c(!0),title:i("reg.pickWhy"),children:i("reg.pick")}),x&&(0,n.jsx)("span",{className:"muted",children:x}),k&&(0,n.jsx)("span",{className:"err",children:k})]}),o.runs.map((e,s)=>(0,n.jsxs)("details",{className:"run-fold",open:0===s||d,children:[(0,n.jsx)("summary",{children:(0,n.jsx)(_,{run:e})}),(0,n.jsx)(O,{entries:e.entries,sizes:t,onChange:l,picking:b})]},e.id)),o.loose.length>0&&(0,n.jsxs)("details",{className:"run-fold",open:0===o.runs.length||d,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)(O,{entries:o.loose,sizes:t,onChange:l,picking:b})]})]})}function B(e){let{entry:s,onClose:t,offerRun:l=!1}=e,{t:i}=(0,p.kj)(),[o,u]=(0,a.useState)(null),[h,m]=(0,a.useState)(""),[g,x]=(0,a.useState)(!1),[j,k]=(0,a.useState)(!1),[v,N]=(0,a.useState)([]),[f,y]=(0,a.useState)(new Set),[w,I]=(0,a.useState)(!1),[C,S]=(0,a.useState)(""),[F,H]=(0,a.useState)(""),A=(0,a.useRef)(null);(0,d.V)(A,!0),(0,a.useEffect)(()=>{let e=e=>{"Escape"!==e.key||e.defaultPrevented||g||document.querySelector('[role="alertdialog"]')||t(j)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[g,j,t]),(0,a.useEffect)(()=>{let e=!0;return r.FH.session(s.sessionId).then(t=>{var n,a,l,i;let r=t.tasks.find(e=>e.id===s.taskId);if(!e)return;u(null!=(n=null==r?void 0:r.prompt)?n:""),H(null!=(a=null==r?void 0:r.prompt)?a:"");let o=null!=(l=null==r?void 0:r.checks)?l:[];N(o),y(new Set("done"===s.status?[]:o.map((e,s)=>s))),I(!!(null==r?void 0:r.readOnly)),S((null!=(i=null==r?void 0:r.scope)?i:[]).join("\n"))}).catch(s=>{e&&m(s.message)}),()=>{e=!1}},[s.sessionId,s.taskId]);let R=async()=>{if(null!==o){x(!0),m("");try{await r.FH.rerunTask(s.sessionId,s.taskId,{prompt:o,checks:v.filter((e,s)=>f.has(s)),readOnly:w,scope:w?[]:(0,c.w)(C)},{buildOnFinished:"done"===s.status}),m(i("reg.fixPromptSaved",{title:s.title})),l?(k(!0),x(!1)):setTimeout(()=>t(!0),900)}catch(e){m(e.message),x(!1)}}};return(0,n.jsx)("div",{className:"modal-backdrop",role:"presentation",onClick:()=>t(j),children:(0,n.jsxs)("div",{ref:A,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:i("reg.fixPromptTitle",{title:s.title})}),j?(0,n.jsx)(b.f,{target:{sessionId:s.sessionId,taskId:s.taskId,title:s.title},intro:"".concat(h," ").concat(i("runq.ask")),focusFirst:!0,onClose:()=>t(!0)}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"muted small",children:i("done"===s.status?"reg.newPromptHint":"reg.fixPromptHint")}),s.reason&&(0,n.jsx)("p",{className:"what err small",children:i("reg.stopped",{reason:s.reason})}),null===o?(0,n.jsx)("p",{className:"muted small",children:h||i("reg.fixPromptLoading")}):(0,n.jsx)("textarea",{className:"prose","aria-labelledby":"fix-title",value:o,onChange:e=>u(e.target.value),style:{minHeight:260},disabled:g}),null!==o&&v.length>0&&(0,n.jsxs)("div",{style:{marginTop:10},children:[(0,n.jsx)("strong",{className:"small",children:i("reg.keepChecks")}),(0,n.jsx)("p",{className:"why",children:i("reg.keepChecksWhy")}),v.map((e,s)=>(0,n.jsx)("div",{className:"option",style:{margin:"4px 0"},children:(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"checkbox",checked:f.has(s),onChange:e=>y(t=>{let n=new Set(t);return e.target.checked?n.add(s):n.delete(s),n})}),(0,n.jsx)("span",{children:e.name})]})},s))]}),null!==o&&o.trim()!==F.trim()&&(0,n.jsx)("p",{className:"notice caution small",children:i("task.newIntentNote")}),null!==o&&(0,n.jsx)(c.y,{readOnly:w,scope:C,onReadOnly:I,onScope:S}),(0,n.jsxs)("div",{className:"row modal-actions",children:[h&&null!==o&&(0,n.jsx)("span",{className:"small grow",children:h}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>t(!1),disabled:g,children:i("dialog.cancel")}),(0,n.jsx)("button",{type:"button",className:"primary",onClick:()=>void R(),disabled:g||null===o||!o.trim(),children:i("reg.fixPromptSave")})]})]})]})})}function z(e){let{entry:s,onChange:t,onClose:l}=e,{t:i}=(0,p.kj)(),[r,o]=(0,a.useState)(!1),[c,u]=(0,a.useState)(null),h=(0,a.useRef)(null);(0,d.V)(h,!0),(0,a.useEffect)(()=>{let e=e=>{"Escape"!==e.key||e.defaultPrevented||document.querySelector('[role="alertdialog"]')||l(r)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,l]);let m={sessionId:s.sessionId,taskId:s.taskId,title:s.title};return(0,n.jsx)("div",{className:"modal-backdrop",role:"presentation",onClick:()=>l(r),children:(0,n.jsxs)("div",{ref:h,className:"modal wide",role:"dialog","aria-modal":"true","aria-labelledby":"contract-title",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{id:"contract-title",children:i("cfix.button")}),s.reason&&(0,n.jsx)("p",{className:"what err small",children:i("reg.stopped",{reason:s.reason})}),null!==c?(0,n.jsx)(b.f,{target:m,intro:"".concat(c," ").concat(i("runq.savedOffer")),focusFirst:!0,onClose:()=>l(!0)}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b.y,{target:m,onApplied:(e,s)=>{o(!0),t(),0===e&&u(s)}}),(0,n.jsx)("div",{className:"row modal-actions",children:(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>l(r),children:i(r?"runq.later":"dialog.cancel")})})]})]})})}function U(e){let{sessions:s}=e,{t}=(0,p.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 V(e){let{entry:s,onClose:t}=e,{t:l}=(0,p.kj)(),i=(0,y.p)(),[o,d]=(0,a.useState)(!1),[c,h]=(0,a.useState)(""),[m,g]=(0,a.useState)(""),x=F(s),j=x?s.branch?s.commit?l("reg.continueHereCommitted",{branch:s.branch,commit:s.commit.slice(0,8)}):s.vcsProblem?l("reg.continueHereNotCommitted",{branch:s.branch,problem:s.vcsProblem}):l("reg.continueHereNothingNew",{branch:s.branch}):s.vcsProblem?l("reg.continueHereVcsInactive",{problem:s.vcsProblem}):l("reg.continueHereNoVcs"):l("reg.rerunHereBranch"),k=async e=>{if("unattended"!==e||i||await (0,N.Z)(l("batch.unattendedConfirm",{n:1}))){d(!0),h("");try{var n,a;let i=await r.FH.suggestedRunName([s.sessionId]).then(e=>e.name).catch(()=>void 0),o=!1,d=await (0,u.L)({sessionIds:[s.sessionId],mode:e,start:async t=>(o||(x?await r.FH.continueTask(s.sessionId,s.taskId,m):await r.FH.rerunTask(s.sessionId,s.taskId),o=!0),await r.FH.startBatch([s.sessionId],e,"stop",void 0,void 0,i,[s.taskId],t))});if(!d.started&&!d.reply)return;let c=null!=(n=d.reply)?n:{started:!0};if(!d.started)return void h(l("batch.notStarted",{reason:null!=(a=c.reason)?a:""}));h(l("reg.continueHereStarted",{title:s.title})),t(!0)}catch(e){h(e.message)}finally{d(!1)}}};return(0,n.jsxs)("div",{className:"notice",role:"group","aria-label":l(x?"reg.continueHereTitle":"reg.rerunHereTitle",{title:s.title}),style:{marginTop:8},children:[(0,n.jsx)("strong",{children:l(x?"reg.continueHereTitle":"reg.rerunHereTitle",{title:s.title})}),s.reason&&(0,n.jsx)("p",{className:"small",children:s.reason}),(0,n.jsxs)("ul",{className:"small",children:[(0,n.jsx)("li",{children:l(x?"reg.continueHereChat":"reg.rerunHereChat")}),(0,n.jsx)("li",{children:j}),(0,n.jsx)("li",{children:l(x?"reg.continueHereCount":"reg.rerunHereKept")}),(0,n.jsx)("li",{children:l("reg.continueHereAlone")})]}),x&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("label",{htmlFor:"continue-prompt-".concat(s.taskId),className:"small",children:l("reg.continueHerePrompt")}),(0,n.jsx)("textarea",{id:"continue-prompt-".concat(s.taskId),className:"prose",value:m,onChange:e=>g(e.target.value),style:{minHeight:90},disabled:o}),(0,n.jsx)("p",{className:"why",children:l("reg.continueHerePromptWhy")})]}),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("button",{className:"primary",disabled:o,onClick:()=>void k("confirm"),title:l("reg.continueWhy"),children:l("reg.continueGo")}),(0,n.jsx)("button",{disabled:o,onClick:()=>void k("unattended"),title:l("reg.continueUnattendedWhy"),children:l("reg.continueUnattended")}),(0,n.jsx)("button",{className:"quiet",disabled:o,onClick:()=>t(!1),children:l("dialog.cancel")}),c&&(0,n.jsx)("span",{className:"small",children:c})]})]})}function X(e){var s;let{entry:t}=e,{t:l}=(0,p.kj)(),i=(0,p.W3)(),r=(0,a.useContext)(A).get("".concat(t.sessionId,":").concat(t.taskId));return r&&0!==r.length?(0,n.jsxs)("span",{className:"muted small",children:[" \xb7 ",l("twin.mark",{when:i(t.createdAt),attempt:null!=(s=t.attempt)?s:1})]}):null}function Z(e){let{entries:s,onChange:t}=e,{t:l}=(0,p.kj)(),[i,o]=(0,a.useState)(!1),[d,c]=(0,a.useState)(""),[h,m]=(0,a.useState)(!1),[g,x]=(0,a.useState)(new Set),[j,k]=(0,a.useState)(null),v=s.filter(e=>"queued"===e.status&&!e.sessionInactive),f=s.filter(e=>S.includes(e.status)&&!e.sessionRunning&&!e.sessionInactive),w=s.some(e=>e.sessionRunning),b=f.filter(e=>"stop"===e.sessionOnFailure),I=f.filter(e=>"stop"!==e.sessionOnFailure),C=[...v,...f],H=C.filter(e=>g.has(e.taskId)),A=f.filter(e=>g.has(e.taskId)),R=v.filter(e=>g.has(e.taskId)),T=[...new Set([...H].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))],P=H.filter(e=>"stop"===e.sessionOnFailure).map(e=>({e,before:C.find(s=>s.sessionId===e.sessionId&&s.position<e.position&&!g.has(s.taskId))})).filter(e=>!!e.before),[q,W]=(0,a.useState)(""),E=b.length>0?l("reg.continueWithFailed",{f:b.length,n:v.length,s:T.length}):l("reg.continue",{n:v.length,s:T.length}),G=(0,y.p)(),O=async e=>{if("unattended"!==e||G||await (0,N.Z)(l("batch.unattendedConfirm",{n:T.length}))){o(!0),c("");try{var s,n;let a=new Set,i=await (0,u.L)({sessionIds:T,mode:e,start:async s=>{for(let e of A){let s="".concat(e.sessionId,"/").concat(e.taskId);a.has(s)||(F(e)?await r.FH.continueTask(e.sessionId,e.taskId):await r.FH.rerunTask(e.sessionId,e.taskId),a.add(s))}return await r.FH.startBatch(T,e,"stop",void 0,void 0,q.trim()||void 0,H.map(e=>e.taskId),s)}});if(!i.started&&!i.reply)return;let o=null!=(s=i.reply)?s:{started:!0};c(i.started?l("reg.continueStarted",{n:T.length}):l("batch.notStarted",{reason:null!=(n=o.reason)?n:""})),m(!1),t()}catch(e){c(e.message)}finally{o(!1)}}};return 0===v.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:()=>{x(new Set(C.map(e=>e.taskId))),m(!0),c("");let e=[...new Set([...C].sort((e,s)=>{var t,n;return(null!=(t=e.sessionRunOrder)?t:Number.MAX_SAFE_INTEGER)-(null!=(n=s.sessionRunOrder)?n:Number.MAX_SAFE_INTEGER)||e.position-s.position}).map(e=>e.sessionId))];r.FH.suggestedRunName(e).then(e=>W(e.name)).catch(()=>void 0)},title:l("reg.continueWhy"),children:E}),w&&(0,n.jsx)("span",{className:"muted small",children:l("reg.continueRunning")}),d&&(0,n.jsx)("span",{className:"small",children:d})]}),h&&!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",style:{marginTop:6},children:[(0,n.jsx)("span",{className:"small",children:l("reg.pickedCount",{n:H.length,of:C.length})}),(0,n.jsx)("button",{className:"small",onClick:()=>x(new Set),disabled:0===H.length,children:l("reg.pickNone")}),(0,n.jsx)("button",{className:"small",onClick:()=>x(new Set(C.map(e=>e.taskId))),disabled:H.length===C.length,children:l("reg.pickAll")})]}),[{key:"chain",entries:b,intro:l("reg.continueChain"),fix:!0},{key:"loose",entries:I,intro:l("reg.continueIndependent"),fix:!0},{key:"queued",entries:v,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,x(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))}),(0,n.jsx)(X,{entry:s}),F(s)&&(0,n.jsxs)("span",{className:"muted small",children:[" \xb7 ",l("reg.willContinue")]})]})," ",(0,n.jsx)("button",{className:"quiet small",onClick:()=>x(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:()=>k(s),title:l("reg.fixPromptHint"),children:l("reg.fixPrompt")})]})]},s.taskId))})]},e.key)),P.length>0&&(0,n.jsx)("div",{className:"notice caution small",style:{marginTop:6},children:P.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:q,onChange:e=>W(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:R.length,r:A.length,s:T.length})}),(0,n.jsxs)("div",{className:"row",style:{marginTop:8},children:[(0,n.jsx)("button",{className:"primary",disabled:i||0===T.length,onClick:()=>void O("unattended"),title:l("reg.continueUnattendedWhy"),children:l("reg.continueUnattended")}),(0,n.jsx)("button",{disabled:i||0===T.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")})]})]}),j&&(0,n.jsx)(B,{entry:j,onClose:e=>{k(null),e&&t()}})]})}function K(e){let{entries:s}=e,{t}=(0,p.kj)(),a=(0,p.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.jsxs)("td",{children:[(0,n.jsx)(i(),{href:(0,r.aT)(e.sessionId,e.taskId),children:e.title}),(0,n.jsx)(X,{entry:e})]}),(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,499,204,347,131,358],()=>e(e.s=3256)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[177],{132:(e,a,s)=>{Promise.resolve().then(s.t.bind(s,8197,23)),Promise.resolve().then(s.bind(s,6657)),Promise.resolve().then(s.bind(s,1035)),Promise.resolve().then(s.t.bind(s,952,23)),Promise.resolve().then(s.bind(s,8214)),Promise.resolve().then(s.bind(s,7712)),Promise.resolve().then(s.bind(s,1701)),Promise.resolve().then(s.bind(s,3069)),Promise.resolve().then(s.bind(s,8078)),Promise.resolve().then(s.bind(s,867))},952:()=>{},1702:(e,a,s)=>{"use strict";var t=s(9962);s.o(t,"usePathname")&&s.d(a,{usePathname:function(){return t.usePathname}}),s.o(t,"useSearchParams")&&s.d(a,{useSearchParams:function(){return t.useSearchParams}})},6657:(e,a,s)=>{"use strict";s.d(a,{GlobalApprovals:()=>p});var t=s(3365),r=s(1521),n=s(8197),l=s.n(n),o=s(5549),i=s(867),c=s(1035),d=s(7527),h=s(9717);function p(){let{t:e}=(0,i.kj)(),[a,s]=(0,r.useState)([]),[n,l]=(0,r.useState)({}),c=(0,r.useRef)({}),h=(0,r.useRef)(""),p=(0,r.useCallback)(async()=>{try{let e=await o.FH.approvals();s(e);let a=[...new Set(e.map(e=>e.sessionId).filter(e=>!(e in c.current)))],t=a.sort().join(",");if(a.length>0&&t!==h.current){for(let e of(h.current=t,await o.FH.sessions().catch(()=>[])))c.current[e.id]=e.name;l({...c.current})}}catch(e){}},[]);return((0,d.z)(p,2e3),(0,r.useEffect)(()=>{let s="copilot-operator";document.title=a.length>0?"(".concat(a.length,") ").concat(e("approval.tabTitle")," — ").concat(s):s},[a.length,e]),0===a.length)?null:(0,t.jsxs)("section",{className:"approval-banner",role:"alert","aria-live":"assertive",children:[(0,t.jsx)("h2",{children:e("approval.waitingHere")}),(0,t.jsx)("p",{className:"small",children:e("approval.waitingHereWhy")}),a.map(e=>{var a;return(0,t.jsx)(m,{approval:e,sessionName:null!=(a=n[e.sessionId])?a:e.sessionId,onDecided:()=>void p()},e.id)})]})}function m(e){let{approval:a,sessionName:s,onDecided:n}=e,{t:d}=(0,i.kj)(),h=(0,i.W3)(),[p,m]=(0,r.useState)(!1),[v,x]=(0,r.useState)(""),j=(0,r.useRef)(!1),f=async e=>{if(!j.current&&("run-all"!==e||await (0,c.Z)(d("approval.runAllConfirm")))){j.current=!0,m(!0),x("");try{await o.FH.decide(a.id,e)}catch(e){x(e.message)}finally{j.current=!1,m(!1),n()}}};if(a.plan)return(0,t.jsx)(u,{approval:a,sessionName:s,onDecided:n});if(a.model){var k;let e=a.model;return(0,t.jsxs)("div",{className:"approval",children:[(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)("strong",{children:d(e.manual?"approval.manualTitle":"approval.modelTitle")}),(0,t.jsx)(l(),{href:(0,o.aT)(a.sessionId),children:s}),(0,t.jsx)("span",{className:"muted small",children:h(a.createdAt)})]}),(0,t.jsx)("p",{children:e.manual?e.asked?d("approval.manualAsk",{model:e.asked}):d("approval.manualAskAny"):d("approval.modelAsk",{model:e.asked})}),(0,t.jsx)("p",{className:"muted small",children:d("approval.modelShown",{shown:null!=(k=e.shown)?k:"—"})}),!e.manual&&(0,t.jsx)("p",{className:"reason small",children:d("approval.modelWhy",{why:e.why,tries:e.tries})}),v&&(0,t.jsx)("p",{className:"err",role:"alert",children:v}),(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)("button",{className:"primary",disabled:p,onClick:()=>void f("run"),children:d(e.manual?"approval.manualReady":"approval.modelChosen")}),(0,t.jsx)("button",{disabled:p,onClick:()=>void f("skip"),children:d("approval.modelAsItIs")}),(0,t.jsx)("button",{className:"danger",disabled:p,onClick:()=>void f("abort"),children:d("approval.modelStop")})]})]})}return(0,t.jsxs)("div",{className:"approval",children:[(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)("strong",{children:d("approval.title",{n:a.stepId})}),(0,t.jsx)(l(),{href:(0,o.aT)(a.sessionId),children:s}),(0,t.jsx)("span",{className:"muted small",children:h(a.createdAt)})]}),(0,t.jsx)("pre",{style:{margin:"8px 0"},children:a.description}),a.network&&(0,t.jsx)("p",{className:"reason small",children:d("approval.network")}),v&&(0,t.jsx)("p",{className:"err",role:"alert",children:v}),(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)("button",{className:"primary",disabled:p,onClick:()=>void f("run"),children:d("approval.run")}),!a.network&&(0,t.jsx)("button",{disabled:p,onClick:()=>void f("run-all"),title:d("approval.runAllWhy"),children:d("approval.runAll")}),(0,t.jsx)("button",{disabled:p,onClick:()=>void f("skip"),children:d("approval.skip")}),(0,t.jsx)("button",{className:"danger",disabled:p,onClick:()=>void f("abort"),children:d("approval.abort")})]})]})}function u(e){let{approval:a,sessionName:s,onDecided:n}=e,{t:d}=(0,i.kj)(),p=(0,i.W3)(),[m,u]=(0,r.useState)(""),[v,x]=(0,r.useState)(!1),[j,f]=(0,r.useState)(""),k=(0,r.useRef)(!1),b=a.plan,w=async e=>{if(!k.current){if("revise"===e&&!m.trim())return void f(d("pm.reviseNeedsNote"));if("stop"!==e||await (0,c.Z)(d("pm.stopConfirm"))){k.current=!0,x(!0),f("");try{await o.FH.decidePlan(a.id,e,m)}catch(e){f(e.message)}finally{k.current=!1,x(!1),n()}}}};return(0,t.jsxs)("div",{className:"approval",children:[(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)("strong",{children:d("pm.cardTitle",{title:b.title})}),(0,t.jsx)(l(),{href:(0,o.aT)(a.sessionId),children:s}),(0,t.jsx)("span",{className:"muted small",children:p(a.createdAt)})]}),(0,t.jsx)("p",{className:"small",children:d("pm.cardWhy")}),(0,t.jsx)(h.D,{plan:b.plan,showApproval:!1}),(0,t.jsx)("label",{htmlFor:"plan-note-".concat(a.id),children:d("pm.note")}),(0,t.jsx)("textarea",{id:"plan-note-".concat(a.id),className:"prose",value:m,onChange:e=>u(e.target.value),placeholder:d("pm.notePlaceholder"),style:{minHeight:70},disabled:v}),j&&(0,t.jsx)("p",{className:"err",role:"alert",children:j}),(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)("button",{className:"primary",disabled:v,onClick:()=>void w("approve"),children:d("pm.approve")}),(0,t.jsx)("button",{disabled:v,onClick:()=>void w("revise"),title:d("pm.reviseWhy"),children:d("pm.revise")}),(0,t.jsx)("button",{className:"danger",disabled:v,onClick:()=>void w("stop"),children:d("pm.stop")})]})]})}},7712:(e,a,s)=>{"use strict";s.d(a,{ScrollJump:()=>l});var t=s(3365),r=s(1521),n=s(867);function l(){let{t:e}=(0,n.kj)(),[a,s]=(0,r.useState)({long:!1,atTop:!0,atBottom:!1});return((0,r.useEffect)(()=>{let e=()=>{let e=document.documentElement;s({long:e.scrollHeight>2*window.innerHeight,atTop:window.scrollY<200,atBottom:window.innerHeight+window.scrollY>=e.scrollHeight-200})};e(),window.addEventListener("scroll",e,{passive:!0}),window.addEventListener("resize",e);let a=new ResizeObserver(e);return a.observe(document.body),()=>{window.removeEventListener("scroll",e),window.removeEventListener("resize",e),a.disconnect()}},[]),a.long)?(0,t.jsxs)("div",{className:"scroll-jump",children:[!a.atTop&&(0,t.jsx)("button",{type:"button","aria-label":e("scroll.top"),title:e("scroll.top"),onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),children:"↑"}),!a.atBottom&&(0,t.jsx)("button",{type:"button","aria-label":e("scroll.bottom"),title:e("scroll.bottom"),onClick:()=>window.scrollTo({top:document.documentElement.scrollHeight,behavior:"smooth"}),children:"↓"})]}):null}},8078:(e,a,s)=>{"use strict";s.d(a,{AppearanceProvider:()=>d,KP:()=>h});var t=s(3365),r=s(1521);let n="cop.appearance",l=["small","normal","large","huge","giant"];"\n(function () {\n try {\n var d = document.documentElement;\n var raw = localStorage.getItem('".concat(n,"');\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(l),".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");let o={theme:"light",textSize:"normal",highContrast:!1,reduceMotion:!1,underlineLinks:!1,strongFocus:!1};function i(e){let a=document.documentElement;a.dataset.theme=e.theme,a.dataset.textsize=e.textSize,a.dataset.contrast=e.highContrast?"high":"normal",a.dataset.motion=e.reduceMotion?"reduced":"normal",a.dataset.links=e.underlineLinks?"underline":"plain",a.dataset.focus=e.strongFocus?"strong":"normal"}let c=(0,r.createContext)({appearance:o,set:()=>void 0,reset:()=>void 0,loaded:!1});function d(e){let{children:a}=e,[s,d]=(0,r.useState)(o),[h,p]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=o;try{let a=window.localStorage.getItem(n);a?e=function(e){let a=e&&"object"==typeof e?e:{},s=(e,a)=>"boolean"==typeof e?e:a;return{theme:"dark"===a.theme?"dark":"light"===a.theme?"light":o.theme,textSize:l.includes(a.textSize)?a.textSize:o.textSize,highContrast:s(a.highContrast,o.highContrast),reduceMotion:s(a.reduceMotion,o.reduceMotion),underlineLinks:s(a.underlineLinks,o.underlineLinks),strongFocus:s(a.strongFocus,o.strongFocus)}}(JSON.parse(a)):window.matchMedia("(prefers-color-scheme: dark)").matches&&(e={...e,theme:"dark"}),window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!a&&(e={...e,reduceMotion:!0})}catch(e){}d(e),i(e),p(!0)},[]);let m=(0,r.useCallback)(e=>{d(a=>{let s={...a,...e};i(s);try{window.localStorage.setItem(n,JSON.stringify(s))}catch(e){}return s})},[]),u=(0,r.useCallback)(()=>{d(o),i(o);try{window.localStorage.removeItem(n)}catch(e){}},[]);return(0,t.jsx)(c.Provider,{value:{appearance:s,set:m,reset:u,loaded:h},children:a})}function h(){return(0,r.useContext)(c)}},8214:(e,a,s)=>{"use strict";s.d(a,{Nav:()=>u,SkipLink:()=>m});var t=s(3365),r=s(1521),n=s(8197),l=s.n(n),o=s(1702),i=s(5549),c=s(7527),d=s(867);let h={sessions:(0,t.jsx)("path",{d:"M4 5h16v4H4zM4 11h16v4H4zM4 17h10v2H4z"}),defaults:(0,t.jsx)("path",{d:"M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8zm8.5 4 1.5 1-1.6 2.8-1.8-.4a7 7 0 0 1-1.5 1.5l.4 1.8L14.7 21l-1-1.5a7 7 0 0 1-3.4 0l-1 1.5-2.8-1.6.4-1.8A7 7 0 0 1 5.4 16l-1.8.4L2 13.6 3.5 12.6V11.4L2 10.4l1.6-2.8 1.8.4A7 7 0 0 1 6.9 6.5l-.4-1.8L9.3 3l1 1.5a7 7 0 0 1 3.4 0l1-1.5 2.8 1.6-.4 1.8a7 7 0 0 1 1.5 1.5l1.8-.4L22 10.4l-1.5 1z"}),import:(0,t.jsx)("path",{d:"M12 3v10m0 0 4-4m-4 4-4-4M4 15v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),history:(0,t.jsx)("path",{d:"M12 3a9 9 0 1 0 8.5 6M12 7v5l3 2M3 4v5h5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),level1:(0,t.jsx)("path",{d:"M6 3h9l5 5v13H6zM14 3v6h6M9 13h7M9 17h7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),presets:(0,t.jsx)("path",{d:"M5 4h14v4H5zM5 10h14v4H5zM5 16h9v4H5z",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),appearance:(0,t.jsx)("path",{d:"M12 3a9 9 0 0 0 0 18c1.5 0 2-1 2-2s-1-1.5-1-2.5S14 15 15.5 15H17a4 4 0 0 0 4-4 8 8 0 0 0-9-8zM8 9a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm4-3a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm4 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"}),system:(0,t.jsx)("path",{d:"M4 5h16v10H4zM2 19h20M9 15v4M15 15v4",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"})},p=[{href:"/",label:"nav.sessions",icon:"sessions"},{href:"/defaults",label:"nav.defaults",icon:"defaults"},{href:"/import",label:"nav.import",icon:"import"},{href:"/history",label:"nav.history",icon:"history"},{href:"/level1",label:"nav.level1",icon:"level1"},{href:"/presets",label:"nav.presets",icon:"presets"},{href:"/appearance",label:"nav.appearance",icon:"appearance"},{href:"/system",label:"nav.system",icon:"system"}];function m(){let{t:e}=(0,d.kj)();return(0,t.jsx)("a",{className:"skip-link",href:"#main",children:e("a11y.skip")})}function u(){let{t:e}=(0,d.kj)(),a=(0,o.usePathname)(),s=function(){let[e,a]=(0,r.useState)(0);return(0,c.z)(()=>i.FH.activity().then(e=>a(e.sessions)).catch(()=>void 0),4e3),e}();return(0,t.jsxs)("nav",{"aria-label":e("nav.label"),children:[p.map(r=>(0,t.jsxs)(l(),{href:r.href,"aria-current":a===r.href?"page":void 0,children:[(0,t.jsx)("svg",{className:"nav-icon",viewBox:"0 0 24 24",width:"16",height:"16",fill:"currentColor","aria-hidden":"true",children:h[r.icon]}),(0,t.jsx)("span",{children:e(r.label)}),"/history"===r.href&&s>0&&(0,t.jsxs)("span",{className:"live",title:e("nav.liveTitle",{n:s}),children:[(0,t.jsx)("span",{className:"dot","aria-hidden":"true"}),e("nav.live")]})]},r.href)),(0,t.jsx)(d.c5,{})]})}},9717:(e,a,s)=>{"use strict";s.d(a,{D:()=>n});var t=s(3365),r=s(867);function n(e){var a,s;let{plan:n,showApproval:l=!0}=e,{t:o}=(0,r.kj)(),i=(0,r.W3)(),c=n.approved;return(0,t.jsxs)("div",{className:"plan-view",children:[(0,t.jsx)("p",{className:"small muted",children:o("pm.version",{n:n.version,at:i(n.at)})}),l&&c&&(0,t.jsxs)("p",{className:"small",children:["operator"===c.by?o("pm.approvedByOperator",{at:i(c.at)}):o("pm.approvedAuto",{at:i(c.at)}),c.why&&" ".concat(c.why),c.note&&" ".concat(o("pm.approvedNote",{note:c.note}))]}),(0,t.jsx)("h4",{children:o("pm.existing")}),(0,t.jsx)("p",{className:"pre-wrap",children:n.existing}),(0,t.jsx)("h4",{children:o("pm.approach")}),(0,t.jsx)("p",{className:"pre-wrap",children:n.approach}),(0,t.jsx)("h4",{children:o("pm.steps")}),(0,t.jsx)("ol",{children:n.steps.map((e,a)=>(0,t.jsx)("li",{className:"pre-wrap",children:e},a))}),n.files.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("h4",{children:o("pm.files")}),(0,t.jsx)("ul",{children:n.files.map(e=>(0,t.jsx)("li",{children:(0,t.jsx)("code",{children:e})},e))})]}),(0,t.jsx)("h4",{children:o("pm.verification")}),(0,t.jsx)("p",{className:"pre-wrap",children:n.verification}),n.risks&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("h4",{children:o("pm.risks")}),(0,t.jsx)("p",{className:"pre-wrap",children:n.risks})]}),(null!=(s=null==(a=n.revisions)?void 0:a.length)?s:0)>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("h4",{children:o("pm.revisions")}),(0,t.jsx)("ul",{children:n.revisions.map(e=>(0,t.jsxs)("li",{className:"small",children:[o("pm.revision",{n:e.version,at:i(e.at)})," ",(0,t.jsx)("span",{className:"pre-wrap",children:e.comment})]},e.version))})]})]})}}},e=>{e.O(0,[353,197,867,549,499,347,131,358],()=>e(e.s=132)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[66],{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,2438))},2438:(e,s,n)=>{"use strict";n.r(s),n.d(s,{default:()=>W});var a=n(3365),t=n(1521),l=n(1702),i=n(8197),r=n.n(i),c=n(5549),d=n(867),o=n(1910),h=n(3523),u=n(3374),m=n(8078),p=n(8848),v=n(4784),x=n(2876),j=n(5132),g=n(1035),f=n(8934),y=n(4811),b=n(3041),k=n(7527),N=n(1366),w=n(8596),S=n(287),C=n(6983),F=n(1701),I=n(9717);function W(){return(0,a.jsx)(t.Suspense,{fallback:null,children:(0,a.jsx)(M,{})})}function M(){var e;let{t:s}=(0,d.kj)(),n=null!=(e=(0,l.useSearchParams)().get("id"))?e:"",[i,o]=(0,t.useState)(null),[h,u]=(0,t.useState)([]),[m,p]=(0,t.useState)([]),[v,x]=(0,t.useState)(null),[j,g]=(0,t.useState)(""),[f,y]=(0,t.useState)(!1),b=(0,t.useRef)(null),N=(0,t.useRef)(0),w=(0,t.useCallback)(async()=>{if(!n)return;let e=++N.current;try{let s=await c.FH.session(n);if(e!==N.current)return;o(s),g("")}catch(s){if(e!==N.current)return;g(s.message)}},[n]),S=(0,t.useCallback)(()=>{b.current||(b.current=window.setTimeout(()=>{b.current=null,w()},400))},[w]);if((0,t.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=()=>y(!1),e.onmessage=e=>{let s;try{s=JSON.parse(e.data)}catch(e){return}"ping"!==s.type&&(u(e=>[...e.slice(-400),s]),S())},e.onerror=()=>{e.readyState===EventSource.CLOSED&&y(!0)},()=>{e.close()}},[n,S]),(0,k.z)(w,8e3,!!n),!n)return(0,a.jsx)("div",{className:"panel err",children:s("session.noId")});if(j&&!i)return(0,a.jsx)("div",{className:"panel err",children:j});if(!i)return(0,a.jsx)("div",{className:"panel muted",children:s("home.loading")});let C=i.tasks.filter(e=>"queued"===e.status).length;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"crumbs",children:[(0,a.jsx)(r(),{href:"/",children:s("session.crumb")})," / ",i.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)(T,{session:i,queued:C,onChange:w}),(0,a.jsx)(G,{tasks:i.tasks}),(0,a.jsx)(O,{session:i,onChange:w}),(0,a.jsx)(B,{level1:v,sent:i.contractSent}),(0,a.jsx)(P,{session:i,onChange:w}),(0,a.jsx)(R,{session:i,onChange:w}),(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)(D,{session:i,onChange:w}),0===i.tasks.length&&(0,a.jsx)("div",{className:"muted",children:s("tasks.none")}),i.tasks.map((e,s)=>(0,a.jsx)(U,{session:i,task:e,index:s+1,presets:m,onChange:w},e.id))]}),(0,a.jsx)(L,{session:i}),(0,a.jsx)(q,{session:i,presets:m,onAdded:w,onPresetsChanged:()=>c.FH.presets().then(p)}),(0,a.jsx)(J,{events:h})]})}function T(e){var s,n;let{session:l,queued:i,onChange:r}=e,{t:o}=(0,d.kj)(),[h,u]=(0,t.useState)(""),[m,p]=(0,t.useState)("");(0,t.useEffect)(()=>{c.FH.models().then(e=>{var s;return p(null!=(s=e.defaultModel)?s:"")}).catch(()=>void 0)},[]);let[v,x]=(0,t.useState)(l.name),[j,f]=(0,t.useState)(null!=(s=l.conversationGroup)?s:"");(0,t.useEffect)(()=>x(l.name),[l.name]),(0,t.useEffect)(()=>{var e;return f(null!=(e=l.conversationGroup)?e:"")},[l.conversationGroup]);let b=(0,y.p)(),[k,N]=(0,t.useState)(!1),w=(0,t.useRef)(!1),S=async e=>{if(!w.current){w.current=!0,N(!0);try{await e()}catch(e){u(e.message)}finally{w.current=!1,N(!1),r()}}},C=async e=>{("unattended"!==e||b||await (0,g.Z)(o("session.unattendedConfirm")))&&await S(async()=>{var s;let n=await (0,F.L)({sessionIds:[l.id],mode:e,start:s=>c.FH.start(l.id,e,l.planName,s)});n.started?u(o("unattended"===e?"session.startedAuto":"session.startedStep")):n.reply&&u(o("session.notStarted",{reason:null!=(s=n.reply.reason)?s:""}))})},I=async()=>{if(l.running)return void u(o("home.deleteRunning"));if(await (0,g.Z)(o("home.deleteConfirm",{name:l.name,n:l.tasks.length})))try{await c.FH.deleteSession(l.id),window.location.href="/"}catch(e){u(e.message)}},W=async()=>{var e;if(j.trim()!==(null!=(e=l.conversationGroup)?e:""))try{await c.FH.updateSession(l.id,{conversationGroup:j.trim()}),u(o("session.groupSaved")),r()}catch(e){u(e.message)}},M=l.running?o("state.running"):o("state.".concat(l.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":o("home.col.name"),value:v,onChange:e=>x(e.target.value),onBlur:()=>void S(async()=>{v.trim()&&v!==l.name&&await c.FH.updateSession(l.id,{name:v})})}),(0,a.jsx)("span",{className:"badge ".concat(l.running?"running":""),children:M})]}),!l.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:k||0===i,children:o("session.run",{n:i})}),(0,a.jsx)("p",{className:"why",children:o("session.runWhy")})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("button",{onClick:()=>void C("confirm"),disabled:k||0===i,children:o("session.runStep")}),(0,a.jsx)("p",{className:"why",children:o("session.runStepWhy")})]})]}),(0,a.jsxs)("div",{className:"row",style:{marginTop:10},children:[l.running&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{className:"danger",onClick:()=>void S(async()=>{await c.FH.stop(l.id),u(o("session.stopping"))}),disabled:k,children:o("session.stop")}),"unattended"===l.runMode&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"badge waiting-approval",children:o("session.modeUnattended")}),(0,a.jsx)("button",{onClick:()=>void S(async()=>{await c.FH.setRunMode(l.id,"confirm"),u(o("session.askingAgain"))}),disabled:k,children:o("session.askAgain")})]})]}),(0,a.jsx)("span",{className:"muted small",children:h}),(0,a.jsx)("span",{className:"grow"}),(0,a.jsx)("button",{className:"quiet",onClick:()=>void I(),disabled:l.running,children:o("home.delete")}),l.chat?(0,a.jsx)("a",{href:l.chat.url,target:"_blank",rel:"noreferrer",className:"small",children:o("session.openChat",{name:l.chat.name})}):(0,a.jsx)("span",{className:"muted small",children:o("session.noChat")})]}),(0,a.jsx)("label",{htmlFor:"session-group",children:o("session.group")}),(0,a.jsx)("div",{className:"row",children:(0,a.jsx)("input",{id:"session-group",type:"text",className:"grow",value:j,placeholder:o("session.groupPlaceholder"),onChange:e=>f(e.target.value),onBlur:()=>void W(),disabled:l.running})}),(0,a.jsxs)("p",{className:"why",children:[o("session.groupWhy"),l.chat&&" ".concat(o("session.groupHasChat"))]}),(0,a.jsx)("label",{htmlFor:"session-plan-mode",children:o("pm.sessionSetting")}),(0,a.jsxs)("select",{id:"session-plan-mode",value:null!=(n=l.planMode)?n:"",onChange:e=>{let s=e.target.value;c.FH.updateSession(l.id,{planMode:s}).then(()=>{u(o("pm.saved")),r()}).catch(e=>u(e.message))},disabled:l.running,style:{width:"auto",maxWidth:"100%"},children:[(0,a.jsx)("option",{value:"",children:o("pm.followSettings")}),(0,a.jsx)("option",{value:"off",children:o("pm.off")}),(0,a.jsx)("option",{value:"auto",children:o("pm.auto")}),(0,a.jsx)("option",{value:"approve",children:o("pm.approveMode")})]}),(0,a.jsx)("p",{className:"why",children:o("pm.sessionWhy")}),(0,a.jsx)("div",{className:"muted small",style:{marginTop:10},children:o("session.willUseModel",{name:(l.model&&("operator"===l.modelSource||!m)?l.model:"")||(m?o("model.followsDefault",{name:m}):o("model.default"))})})]})}function B(e){var s;let{level1:n,sent:t}=e,{t:l}=(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:l("l1.title")}),(0,a.jsx)("span",{className:"badge",children:l(t?"l1.sent":"l1.notSent")}),(0,a.jsx)(r(),{href:"/level1",className:"small",children:l("l1.edit")})]}),(0,a.jsxs)("p",{className:"muted small",style:{marginBottom:6},children:[l("l1.hint"),(null==n?void 0:n.customised)?" ".concat(l("l1.customised")):""]}),(0,a.jsxs)("details",{children:[(0,a.jsx)("summary",{children:l("l1.show")}),(0,a.jsx)("pre",{className:"tall",children:null!=(s=null==n?void 0:n.content)?s:"…"})]})]})}function O(e){var s,n,l,i,r;let{session:o,onChange:h}=e,{t:u}=(0,d.kj)(),m=(0,d.W3)(),[v,x]=(0,t.useState)(null),[j,f]=(0,t.useState)(!1),[y,b]=(0,t.useState)("");(0,t.useEffect)(()=>{c.FH.models().then(x).catch(()=>void 0)},[]);let k=async e=>{try{await c.FH.updateSession(o.id,{model:e}),b(e?u("model.saved",{name:e}):u("model.savedDefault")),h()}catch(e){b(e.message)}},N=async()=>{try{let e=await c.FH.setDefaultModel(C);x(s=>s?{...s,defaultModel:e.defaultModel}:s),b(e.defaultModel?u("model.defaultSaved",{name:e.defaultModel}):u("model.defaultCleared"))}catch(e){b(e.message)}},w=async()=>{if(await (0,g.Z)(u("model.refreshConfirm"))){f(!0),b(u("model.refreshing"));try{var e;let s=await c.FH.refreshModels();x(s),b(0===s.options.length?null!=(e=s.note)?e:u("model.none"):u("model.refreshed",{n:s.options.length}))}catch(e){b(e.message)}finally{f(!1)}}},S=!!o.model&&"operator"!==o.modelSource&&!!(null==v?void 0:v.defaultModel),C=S?"":null!=(s=o.model)?s:"",F=null!=(n=null==v?void 0:v.options)?n:[],I=F.some(e=>e.name===C),W=F.filter(e=>!e.group),M=new Map;for(let e of F)e.group&&M.set(e.group,[...null!=(l=M.get(e.group))?l:[],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:u("model.title")}),o.modelInUse&&(0,a.jsx)("span",{className:"chip",children:u("model.lastUsed",{name:o.modelInUse})}),S&&(0,a.jsx)("p",{className:"muted small",children:u("model.planOutranked",{name:null!=(i=o.model)?i:""})})]}),(0,a.jsx)("p",{className:"muted small",children:u("model.hint")}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsxs)("select",{"aria-label":u("model.title"),value:C,disabled:o.running,onChange:e=>void k(e.target.value),style:{width:"auto",minWidth:260},children:[(0,a.jsx)("option",{value:"",children:(null==v?void 0:v.defaultModel)?u("model.followsDefault",{name:v.defaultModel}):u("model.default")}),C&&!I&&(0,a.jsx)("option",{value:C,children:u("model.notInList",{name:C})}),W.map(e=>(0,a.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(u("model.unavailable")):""]},e.name)),[...M.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(u("model.unavailable")):""]},e.name))},s)})]}),(0,a.jsx)("button",{onClick:()=>void w(),disabled:j||o.running,children:u("model.refresh")}),(0,a.jsx)("span",{className:"muted small",role:"status",children:y})]}),(0,a.jsx)(p.L,{current:C,onUse:e=>void k(e)}),(0,a.jsxs)("div",{className:"row",style:{marginTop:8},children:[(0,a.jsx)("span",{className:"muted small",children:(null==v?void 0:v.defaultModel)?u("model.defaultIs",{name:v.defaultModel}):u("model.defaultIsNone")}),(0,a.jsx)("button",{onClick:()=>void N(),disabled:C===(null!=(r=null==v?void 0:v.defaultModel)?r:""),children:C?u("model.makeDefault",{name:C}):u("model.clearDefault")})]}),(null==v?void 0:v.readAt)?(0,a.jsxs)("p",{className:"muted small",style:{marginTop:8},children:[u("model.readAt",{t:m(v.readAt),n:v.options.length}),v.current?" ".concat(u("model.chatWasOn",{name:v.current})):"",v.note?" ".concat(v.note):""]}):(0,a.jsx)("p",{className:"muted small",style:{marginTop:8},children:u("model.neverRead")}),F.length>0&&(0,a.jsxs)("details",{children:[(0,a.jsx)("summary",{children:u("model.showDetails")}),(0,a.jsx)("pre",{className:"tall",children:F.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 R(e){var s,n;let{session:l,onChange:i}=e,{t:r}=(0,d.kj)(),o=null!=(s=l.review)?s:{enabled:!0,model:""},[h,u]=(0,t.useState)(o.enabled),[m,x]=(0,t.useState)(null!=(n=o.model)?n:""),[j,g]=(0,t.useState)(""),[f,y]=(0,t.useState)(!1),[b,k]=(0,t.useState)("");(0,t.useEffect)(()=>{c.FH.models().then(e=>{var s;k(null!=(s=e.defaultReviewModel)?s:""),e.defaultReviewModel&&"operator"!==l.reviewModelSource&&x("")}).catch(()=>void 0)},[l.reviewModelSource]);let N=async()=>{y(!0),g("");try{await c.FH.updateSession(l.id,{review:{enabled:h,model:m}}),g(r("review.saved")),i()}catch(e){g(e.message)}finally{y(!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:r("review.title")}),(0,a.jsx)("span",{className:"badge ".concat(h?"done":""),children:h?r("review.on"):r("review.off")})]}),(0,a.jsx)("p",{className:"muted small",children:r("review.hint")}),(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"checkbox",checked:h,onChange:e=>u(e.target.checked),disabled:l.running}),(0,a.jsx)("span",{children:r("review.enable")})]}),(0,a.jsx)("p",{className:"why",children:r("review.enableWhy")})]}),(0,a.jsx)("label",{htmlFor:"review-model",children:r("review.modelField")}),(0,a.jsx)("div",{className:"row",children:(0,a.jsx)(v.Y,{id:"review-model",chosen:m,onChange:x,none:b?r("model.followsDefault",{name:b}):r("review.modelSame"),disabled:l.running||!h})}),(0,a.jsx)("p",{className:"why",children:r("review.modelWhy")}),(0,a.jsx)(p.z4,{current:m,onUse:e=>x(e)}),(0,a.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,a.jsx)("button",{className:"primary",onClick:()=>void N(),disabled:f||l.running,children:r("review.save")}),j&&(0,a.jsx)("span",{className:"muted small",children:j})]})]})}function H(e){var s;let{session:n,plan:l,onDone:i}=e,{t:r}=(0,d.kj)(),o=()=>Object.fromEntries(l.entries.filter(e=>e.choice).map(e=>[e.path,e.choice])),h=JSON.stringify(l.entries.map(e=>[e.path,e.choice])),[u,m]=(0,t.useState)(o);(0,t.useEffect)(()=>m(o()),[h]);let[p,v]=(0,t.useState)(!1),[x,j]=(0,t.useState)(""),g=l.entries.filter(e=>"include"===u[e.path]).length,f=async()=>{v(!0),j("");try{var e,s,a;let t=await c.FH.vcsSnapshot(n.id,u);j(t.ok?r("vcs.snapshotTaken",{branch:null!=(e=t.branch)?e:"",commit:(null!=(s=t.commit)?s:"").slice(0,8)}):null!=(a=t.problem)?a:""),i()}catch(e){j(e.message)}finally{v(!1)}};return(0,a.jsxs)("div",{className:"option",children:[(0,a.jsx)("p",{className:"small",children:r("vcs.snapshotList",{n:l.entries.length,branch:null!=(s=l.baselineBranch)?s:"—"})}),(0,a.jsx)("ul",{style:{margin:"4px 0",paddingLeft:0,listStyle:"none"},children:l.entries.map(e=>{var s;return(0,a.jsxs)("li",{style:{marginBottom:4,overflowWrap:"anywhere"},children:[(0,a.jsx)("code",{children:e.path})," ",(0,a.jsxs)("span",{className:"muted small",children:["(",e.input?"".concat(r("vcs.snapshotInput"),", "):"",r("vcs.snapshotKind.".concat(e.kind)),void 0!==e.size?", ".concat((0,c.zi)(e.size)):"",")"]})," ",0===e.allowed.length?(0,a.jsx)("span",{className:"err small",children:r("vcs.snapshotBlocked")}):(0,a.jsx)("select",{"aria-label":e.path,value:null!=(s=u[e.path])?s:"",onChange:s=>m({...u,[e.path]:s.target.value}),disabled:p||n.running||e.allowed.length<2,children:e.allowed.map(e=>(0,a.jsx)("option",{value:e,children:r("include"===e?"vcs.snapshotInclude":"vcs.snapshotLeaveOut")},e))}),e.reason&&(0,a.jsx)("div",{className:"muted small",children:e.reason})]},e.path)})}),(0,a.jsx)("button",{className:"primary",onClick:()=>void f(),disabled:p||n.running||!l.ok||0===g,children:r("vcs.snapshotTake")}),(0,a.jsx)("p",{className:"why",children:r("vcs.snapshotCancelWhy")}),x&&(0,a.jsx)("p",{className:"small",role:"status",children:x})]})}function P(e){var s,n,l,i,r,o,h,u,m,v,x,j,g,f,y,b,k,N,S,C,F,I,W,M,T,B,O,R,P,D,A,L,E,q,U,J;let{session:z,onChange:G}=e,{t:Z}=(0,d.kj)(),K=null!=(g=z.vcs)?g:{enabled:!0,repoDir:"",branchMode:"per-task",commitOnFinish:!0,branchPrefix:"cop/"},[_,Y]=(0,t.useState)(K.repoDir),[Q,V]=(0,t.useState)(null),[X,$]=(0,t.useState)(""),[ee,es]=(0,t.useState)(!1),en=JSON.stringify(K),[ea,et]=(0,t.useState)(null),[el,ei]=(0,t.useState)(null!=(f=K.branchName)?f:"");(0,t.useEffect)(()=>{var e;return ei(null!=(e=JSON.parse(en).branchName)?e:"")},[en]);let[er,ec]=(0,t.useState)(null!=(y=K.baseBranch)?y:"");(0,t.useEffect)(()=>{var e;return ec(null!=(e=JSON.parse(en).baseBranch)?e:"")},[en]);let[ed,eo]=(0,t.useState)((null!=(b=null==(s=K.userInputs)?void 0:s.paths)?b:[]).join("\n"));(0,t.useEffect)(()=>{var e,s;return eo((null!=(s=null==(e=JSON.parse(en).userInputs)?void 0:e.paths)?s:[]).join("\n"))},[en]);let[eh,eu]=(0,t.useState)((null!=(k=null==(n=K.artifacts)?void 0:n.paths)?k:[]).join("\n"));(0,t.useEffect)(()=>{var e,s;return eu((null!=(s=null==(e=JSON.parse(en).artifacts)?void 0:e.paths)?s:[]).join("\n"))},[en]);let em=e=>e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean),[ep,ev]=(0,t.useState)(null!=(N=K.existingBranch)?N:"");(0,t.useEffect)(()=>{var e;return ev(null!=(e=JSON.parse(en).existingBranch)?e:"")},[en]);let ex=null!=(S=K.startFrom)?S:"head";(0,t.useEffect)(()=>{Y(JSON.parse(en).repoDir)},[en]);let ej=JSON.parse(en).repoDir||z.projectDir||"";(0,t.useEffect)(()=>{let e=!1;return ej.trim()?(c.FH.repoCheck(ej).then(s=>{var n;e||et(s.ok?null:null!=(n=s.problem)?n:null)}).catch(()=>{e||et(null)}),()=>{e=!0}):void et(null)},[ej]);let eg=(0,t.useCallback)(()=>{c.FH.vcsStatus(z.id).then(V).catch(()=>V(null))},[z.id]);(0,t.useEffect)(eg,[eg,en]);let ef=async e=>{try{await c.FH.updateSession(z.id,{vcs:e}),$(Z("vcs.saved")),G(),eg()}catch(e){$(e.message)}},ey=async()=>{es(!0),$(Z("mirror.browsing"));try{let s=await c.FH.browseFolder(_.trim()||z.projectDir||void 0);if(s.ok)Y(s.path),await ef({repoDir:s.path});else{var e;$(s.cancelled?Z("mirror.browseCancelled"):null!=(e=s.reason)?e:"")}}catch(e){$(e.message)}finally{es(!1)}},eb=K.repoDir||z.projectDir||"",ek=""!==eb.trim()&&null===ea;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:Z("vcs.title")}),(0,a.jsx)("span",{className:"badge ".concat(K.enabled?"done":""),children:K.enabled?Z("vcs.on"):Z("vcs.off")})]}),(0,a.jsx)("p",{className:"muted small",children:Z("vcs.hint")}),(0,a.jsx)("label",{htmlFor:"vcs-root",children:Z("vcs.repoField")}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("input",{id:"vcs-root",type:"text",className:"grow",value:_,onChange:e=>Y(e.target.value),onBlur:()=>_.trim()!==K.repoDir&&void ef({repoDir:_.trim()}),placeholder:z.projectDir||"C:\\Projects\\my-app",disabled:z.running}),(0,a.jsx)("button",{onClick:()=>void ey(),disabled:ee||z.running,children:Z("mirror.browse")})]}),(0,a.jsx)(p.H4,{current:_,onUse:e=>{Y(e),ef({repoDir:e})}}),ea&&(0,a.jsxs)("div",{className:"notice caution",style:{marginTop:8},children:[(0,a.jsx)("strong",{children:Z("vcs.noRepo")}),(0,a.jsx)("div",{className:"small",style:{marginTop:4},children:ea}),(0,a.jsx)("div",{className:"muted small",style:{marginTop:6},children:Z("vcs.noRepoHow")})]}),!ea&&""!==eb.trim()&&(0,a.jsx)("p",{className:"muted small",style:{marginTop:4},children:Z("vcs.repoOk")}),""===eb.trim()&&(0,a.jsx)("p",{className:"muted small",style:{marginTop:4},children:Z("vcs.pickFirst")}),(0,a.jsxs)("div",{className:"option".concat(ek||K.enabled?"":" warned"),children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"checkbox",checked:K.enabled,onChange:e=>void ef({enabled:e.target.checked}),disabled:z.running||!ek&&!K.enabled}),(0,a.jsx)("span",{children:Z("vcs.enable")})]}),(0,a.jsx)("p",{className:"why",children:Z("vcs.enableWhy")})]}),K.enabled&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"muted small",style:{marginTop:4},children:eb?Z("vcs.repoIs",{dir:eb}):Z("vcs.repoNone")}),eb&&!ea&&(0,a.jsx)(w.E,{dir:eb}),(0,a.jsx)("h3",{children:Z("vcs.branches")}),"existing-branch"===ex&&(0,a.jsx)("p",{className:"muted small",children:Z("vcs.branchesExisting",{branch:K.existingBranch||"…"})}),(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"radio",name:"branchMode",checked:"per-task"===K.branchMode,onChange:()=>void ef({branchMode:"per-task"}),disabled:z.running}),(0,a.jsx)("span",{children:Z("vcs.perTask")})]}),(0,a.jsx)("p",{className:"why",children:Z("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"===K.branchMode,onChange:()=>void ef({branchMode:"per-session"}),disabled:z.running}),(0,a.jsx)("span",{children:Z("vcs.perSession")})]}),(0,a.jsx)("p",{className:"why",children:Z("vcs.perSessionWhy")})]}),"per-session"===K.branchMode&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("label",{htmlFor:"vcs-branch-name",children:Z("vcs.branchName")}),(0,a.jsx)("input",{id:"vcs-branch-name",type:"text",value:el,onChange:e=>ei(e.target.value),onBlur:()=>{var e;return el.trim()!==(null!=(e=K.branchName)?e:"")&&void ef({branchName:el.trim()})},placeholder:z.name,disabled:z.running}),(0,a.jsx)("p",{className:"why",children:Z("vcs.branchNameWhy")})]}),(0,a.jsx)("h3",{children:Z("vcs.startFrom")}),(0,a.jsx)("p",{className:"muted small",children:Z("vcs.startAsked")}),K.baseRemote&&("branch"===ex||"existing-branch"===ex)&&(0,a.jsx)("p",{className:"small",children:Z("vcs.fromRemote",{remote:K.baseRemote,branch:("existing-branch"===ex?K.existingBranch:K.baseBranch)||"main"})}),(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"radio",name:"startFrom",checked:"branch"===ex,onChange:()=>void ef({startFrom:"branch"}),disabled:z.running}),(0,a.jsx)("span",{children:Z("vcs.startBranch")})]}),(0,a.jsx)("p",{className:"why",children:Z("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"===ex,onChange:()=>void ef({startFrom:"previous-session"}),disabled:z.running}),(0,a.jsx)("span",{children:Z("vcs.startPrevious")})]}),(0,a.jsx)("p",{className:"why",children:Z("vcs.startPreviousWhy")})]}),(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"radio",name:"startFrom",checked:"head"===ex,onChange:()=>void ef({startFrom:"head"}),disabled:z.running}),(0,a.jsx)("span",{children:Z("vcs.startHead")})]}),(0,a.jsx)("p",{className:"why",children:Z("vcs.startHeadWhy")})]}),(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"radio",name:"startFrom",checked:"existing-branch"===ex,onChange:()=>void ef({startFrom:"existing-branch"}),disabled:z.running}),(0,a.jsx)("span",{children:Z("vcs.startExisting")})]}),(0,a.jsx)("p",{className:"why",children:Z("vcs.startExistingWhy")})]}),"existing-branch"===ex&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("label",{htmlFor:"vcs-existing-branch",children:Z("vcs.existingBranch")}),(0,a.jsx)("input",{id:"vcs-existing-branch",type:"text",list:"vcs-local-branches",value:ep,onChange:e=>ev(e.target.value),onBlur:()=>{var e;return ep.trim()!==(null!=(e=K.existingBranch)?e:"")&&void ef({existingBranch:ep.trim()})},disabled:z.running}),(0,a.jsx)("datalist",{id:"vcs-local-branches",children:(null!=(C=null==Q?void 0:Q.branches)?C:[]).map(e=>(0,a.jsx)("option",{value:e},e))}),(0,a.jsx)("p",{className:"why",children:Z("vcs.existingBranchWhy")}),K.existingBranch&&(null==Q?void 0:Q.branches)&&!Q.branches.includes(K.existingBranch)&&(0,a.jsx)("p",{className:"err small",children:Z("vcs.existingBranchMissing",{branch:K.existingBranch})})]}),("branch"===ex||"previous-session"===ex)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("label",{htmlFor:"vcs-base-branch",children:Z("vcs.baseBranch")}),(0,a.jsx)("input",{id:"vcs-base-branch",type:"text",value:er,onChange:e=>ec(e.target.value),onBlur:()=>{var e;return er.trim()!==(null!=(e=K.baseBranch)?e:"")&&void ef({baseBranch:er.trim()})},placeholder:"main",disabled:z.running}),(0,a.jsx)("p",{className:"why",children:Z("vcs.baseBranchWhy")})]}),z.vcsStart&&(0,a.jsxs)("p",{className:"muted small",children:["existing-branch"===z.vcsStart.kind?Z("vcs.startedExisting",{branch:null!=(F=z.vcsStart.branch)?F:"",commit:z.vcsStart.commit.slice(0,8)}):"previous-session"===z.vcsStart.kind?Z("vcs.startedPrevious",{name:null!=(I=null==(l=z.vcsStart.fromSession)?void 0:l.name)?I:"",branch:null!=(W=z.vcsStart.branch)?W:"",commit:z.vcsStart.commit.slice(0,8)}):"branch"===z.vcsStart.kind?Z(z.vcsStart.remote?"vcs.startedRemote":"vcs.startedBranch",{branch:null!=(M=z.vcsStart.branch)?M:"",commit:z.vcsStart.commit.slice(0,8)}):"snapshot"===z.vcsStart.kind?Z("vcs.startedSnapshot",{branch:null!=(T=z.vcsStart.branch)?T:"",commit:z.vcsStart.commit.slice(0,8),from:null!=(B=null==(i=z.vcsStart.snapshot)?void 0:i.fromBranch)?B:"HEAD",n:null!=(O=null==(r=z.vcsStart.snapshot)?void 0:r.included.length)?O:0,out:null!=(R=null==(o=z.vcsStart.snapshot)?void 0:o.leftOut.length)?R:0}):Z("vcs.startedHead",{commit:z.vcsStart.commit.slice(0,8)}),z.vcsStart.note?" — ".concat(z.vcsStart.note):"",z.vcsStart.update&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("br",{}),"updated"===z.vcsStart.update.outcome?Z("vcs.updated",{branch:z.vcsStart.update.branch,remote:null!=(P=z.vcsStart.update.remote)?P:"",from:(null!=(D=z.vcsStart.update.from)?D:"").slice(0,8),to:(null!=(A=z.vcsStart.update.to)?A:"").slice(0,8)}):"up-to-date"===z.vcsStart.update.outcome?Z("vcs.upToDate",{branch:z.vcsStart.update.branch,remote:null!=(L=z.vcsStart.update.remote)?L:""}):Z("vcs.notUpdated",{branch:z.vcsStart.update.branch,why:null!=(E=z.vcsStart.update.detail)?E:z.vcsStart.update.outcome})]})]}),"head"!==ex&&(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"checkbox",checked:!1!==K.updateFromRemote,onChange:e=>void ef({updateFromRemote:e.target.checked}),disabled:z.running}),(0,a.jsx)("span",{children:Z("vcs.updateFromRemote")})]}),(0,a.jsx)("p",{className:"why",children:Z("vcs.updateFromRemoteWhy")})]}),(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"checkbox",checked:K.commitOnFinish,onChange:e=>void ef({commitOnFinish:e.target.checked}),disabled:z.running}),(0,a.jsx)("span",{children:Z("vcs.commit")})]}),(0,a.jsx)("p",{className:"why",children:Z("vcs.commitWhy")})]}),"existing-branch"!==ex&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h3",{children:Z("vcs.dirty")}),["reject","snapshot","tracked-only-snapshot"].map(e=>{var s,n;return(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"radio",name:"vcs-dirty-".concat(z.id),checked:(null!=(n=null==(s=K.dirtyWorktree)?void 0:s.policy)?n:"reject")===e,onChange:()=>{var s;ef({dirtyWorktree:{policy:e,requireApproval:null==(s=K.dirtyWorktree)?void 0:s.requireApproval}})},disabled:z.running}),(0,a.jsx)("span",{children:Z("reject"===e?"vcs.dirtyReject":"snapshot"===e?"vcs.dirtySnapshot":"vcs.dirtyTracked")})]}),(0,a.jsx)("p",{className:"why",children:Z("reject"===e?"vcs.dirtyRejectWhy":"snapshot"===e?"vcs.dirtySnapshotWhy":"vcs.dirtyTrackedWhy")})]},e)}),(null!=(q=null==(h=K.dirtyWorktree)?void 0:h.policy)?q:"reject")!=="reject"&&(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"checkbox",checked:(null==(u=K.dirtyWorktree)?void 0:u.requireApproval)!==!1,onChange:e=>{var s,n;ef({dirtyWorktree:{policy:null!=(n=null==(s=K.dirtyWorktree)?void 0:s.policy)?n:"snapshot",requireApproval:e.target.checked}})},disabled:z.running}),(0,a.jsx)("span",{children:Z("vcs.dirtyApproval")})]}),(0,a.jsx)("p",{className:"why",children:Z("vcs.dirtyApprovalWhy")})]})]}),(0,a.jsx)("h3",{children:Z("vcs.inputs")}),(0,a.jsx)("label",{htmlFor:"vcs-inputs-".concat(z.id),children:Z("vcs.inputsField")}),(0,a.jsx)("textarea",{id:"vcs-inputs-".concat(z.id),rows:3,value:ed,onChange:e=>eo(e.target.value),onBlur:()=>{var e,s;return JSON.stringify(em(ed))!==JSON.stringify(null!=(s=null==(e=K.userInputs)?void 0:e.paths)?s:[])&&void ef({userInputs:{...K.userInputs,paths:em(ed)}})},disabled:z.running,placeholder:"rules-engine/test-data/schemas/*.yaml",spellCheck:!1}),(0,a.jsx)("p",{className:"why",children:Z("vcs.inputsWhy")}),(null!=(U=null==(m=K.userInputs)?void 0:m.paths.length)?U:0)>0&&(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"checkbox",checked:(null==(v=K.userInputs)?void 0:v.readOnly)!==!1,onChange:e=>{var s,n,a;ef({userInputs:{paths:null!=(a=null==(s=K.userInputs)?void 0:s.paths)?a:[],requireApproval:null==(n=K.userInputs)?void 0:n.requireApproval,readOnly:e.target.checked}})},disabled:z.running}),(0,a.jsx)("span",{children:Z("vcs.inputsReadOnly")})]}),(0,a.jsx)("p",{className:"why",children:Z("vcs.inputsReadOnlyWhy")})]}),(null==(x=z.vcsStart)?void 0:x.inputs)&&(0,a.jsx)("p",{className:"muted small",children:z.vcsStart.inputs.carried?Z("vcs.inputsCarried",{n:z.vcsStart.inputs.files.length,branch:z.vcsStart.inputs.carried.branch,onto:z.vcsStart.inputs.carried.onto.slice(0,8)}):Z("vcs.inputsRecorded",{n:z.vcsStart.inputs.files.length,commit:z.vcsStart.commit.slice(0,8)})}),(0,a.jsx)("h3",{children:Z("vcs.artifacts")}),(0,a.jsx)("label",{htmlFor:"vcs-artifacts-".concat(z.id),children:Z("vcs.artifactsField")}),(0,a.jsx)("textarea",{id:"vcs-artifacts-".concat(z.id),rows:2,value:eh,onChange:e=>eu(e.target.value),onBlur:()=>{var e,s;return JSON.stringify(em(eh))!==JSON.stringify(null!=(s=null==(e=K.artifacts)?void 0:e.paths)?s:[])&&void ef({artifacts:{paths:em(eh)}})},disabled:z.running,placeholder:"rules-engine/test-results/**",spellCheck:!1}),(0,a.jsx)("p",{className:"why",children:Z("vcs.artifactsWhy")}),Q&&!Q.ok&&(0,a.jsxs)("div",{className:"notice caution",role:"status",children:[(0,a.jsx)("strong",{children:Z("vcs.notReady")})," ",Q.problem]}),(null==Q||null==(j=Q.snapshot)?void 0:j.needed)&&Q.snapshot.entries.length>0&&(0,a.jsx)(H,{session:z,plan:Q.snapshot,onDone:()=>{G(),eg()}}),(null==Q?void 0:Q.ok)&&(0,a.jsx)("div",{className:"muted small",children:Z("vcs.ready",{branch:null!=(J=Q.branch)?J:"—",dir:Q.repoDir})}),(null==Q?void 0:Q.ok)&&Q.work&&Q.work.branches.length>0&&(0,a.jsxs)("div",{className:"muted small",children:["per-session"===Q.work.mode&&Q.work.complete?Z("vcs.completeOn",{branch:Q.work.complete}):Z("vcs.noSingleBranch",{n:Q.work.branches.length}),"per-task"===Q.work.mode&&(0,a.jsx)("ul",{style:{margin:"4px 0",paddingLeft:20},children:Q.work.branches.map(e=>(0,a.jsxs)("li",{children:[(0,a.jsx)("code",{children:e.branch})," — ",e.title,e.commit?"":" (".concat(Z("vcs.taskNoFiles"),")")]},e.branch))})]}),(0,a.jsx)("p",{className:"muted small",children:Z("vcs.pushIsYours")})]}),(0,a.jsx)("div",{className:"muted small",role:"status",children:X})]})}function D(e){var s;let{session:n,onChange:l}=e,{t:i}=(0,d.kj)(),[r,o]=(0,t.useState)(""),h=null!=(s=n.onFailure)?s:"stop",u=async e=>{if(e!==h)try{await c.FH.updateSession(n.id,{onFailure:e}),o(i("stop"===e?"chain.savedStop":"chain.savedContinue")),l()}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:i("chain.title")}),(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"radio",name:"chain",checked:"stop"===h,onChange:()=>void u("stop"),disabled:n.running}),(0,a.jsx)("span",{children:i("chain.stop")})]}),(0,a.jsx)("p",{className:"why",children:i("chain.stopWhy")})]}),(0,a.jsxs)("div",{className:"option",children:[(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"radio",name:"chain",checked:"continue"===h,onChange:()=>void u("continue"),disabled:n.running}),(0,a.jsx)("span",{children:i("chain.continue")})]}),(0,a.jsx)("p",{className:"why",children:i("chain.continueWhy")})]}),r&&(0,a.jsx)("div",{className:"muted small",role:"status",children:r}),n.running&&(0,a.jsx)("div",{className:"muted small",children:i("chain.locked")})]})}function A(e){let{value:s,onChange:n,presets:l,onPresetsChanged:i}=e,{t:r}=(0,d.kj)(),o=(0,t.useId)(),[h,u]=(0,t.useState)(""),m=async()=>{let e=prompt(r("l2.saveAsPrompt"));if(e)try{await c.FH.savePreset(e,s),u(r("l2.savedAs",{name:e})),null==i||i()}catch(e){u(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},htmlFor:"".concat(o,"-text"),children:r("l2.label")}),(0,a.jsxs)("select",{value:"","aria-label":r("l2.loadPreset"),onChange:e=>{let s=l.find(s=>s.name===e.target.value);s&&n(s.content)},children:[(0,a.jsx)("option",{value:"",children:r("l2.loadPreset")}),l.map(e=>(0,a.jsx)("option",{value:e.name,children:e.name},e.name))]}),(0,a.jsx)("button",{onClick:()=>void m(),disabled:!s.trim(),children:r("l2.saveAs")})]}),(0,a.jsx)("textarea",{id:"".concat(o,"-text"),className:"prose",value:s,onChange:e=>n(e.target.value),placeholder:r("l2.placeholder"),style:{minHeight:140,marginTop:10}}),h&&(0,a.jsx)("div",{className:"muted small",children:h})]})}function L(e){let{session:s}=e,{t:n}=(0,d.kj)(),l=(0,d.W3)(),i=s.tasks.filter(e=>"queued"!==e.status),[r,o]=(0,t.useState)([]),h=r.length>0?r:i.map(e=>e.id),u=e=>(0,c.ub)("".concat(c.nC,"/sessions/").concat(s.id,"/export?variant=").concat(e)+(r.length>0?"&tasks=".concat(encodeURIComponent(r.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===i.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(i.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:r.length>0?n("export.selected",{n:r.length}):n("export.allOf",{n:i.length})})]}),i.map(e=>{var s,t,i,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:r.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!=(t=null==(s=e.scope)?void 0:s.length)?t:0)>0&&(0,a.jsx)("span",{className:"chip",children:n("task.scope",{paths:(null!=(i=e.scope)?i:[]).join(", ")})})," ",(0,a.jsx)("span",{className:"muted small",children:l(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:u("outcome"),download:!0,children:n("export.outcome",{n:h.length})}),(0,a.jsx)("a",{className:"button-link",href:u("full"),download:!0,children:n("export.full",{n:h.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)(),t=(e,s)=>(0,a.jsxs)("div",{className:"handoff-row",children:[(0,a.jsx)("strong",{children:n(e)})," ",s]}),l=e=>(0,a.jsx)("ul",{children:e.map((e,s)=>(0,a.jsx)("li",{children:e},s))}),i=s.validation.filter(e=>e.passed).length;return(0,a.jsxs)("div",{className:"summary handoff",children:[(0,a.jsx)("strong",{children:n("handoff.title")}),t("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):""]})),t("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&&t("handoff.validation",(0,a.jsxs)(a.Fragment,{children:[n("handoff.passed",{n:i,of:s.validation.length}),s.review?" \xb7 ".concat(n("handoff.review",{verdict:s.review.verdict,open:s.review.open})):""]})),t("handoff.issues",0===s.knownIssues.length?(0,a.jsx)("span",{className:"muted",children:n("handoff.noIssues")}):l(s.knownIssues)),s.evidence.runId&&t("handoff.evidence",(0,a.jsx)("code",{children:s.evidence.runId})),(s.vcs.branch||s.vcs.problem)&&t("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&&t("handoff.manual",l(s.manual)),s.notExecuted.length>0&&t("handoff.notRun",l(s.notExecuted))]})}function q(e){var s;let{session:n,presets:l,onAdded:i,onPresetsChanged:r}=e,{t:o}=(0,d.kj)(),h=[...n.tasks].reverse()[0],[u,m]=(0,t.useState)(""),[p,v]=(0,t.useState)(null!=(s=null==h?void 0:h.level2)?s:""),[x,j]=(0,t.useState)(""),[g,f]=(0,t.useState)(""),[y,b]=(0,t.useState)(!1),k=(0,t.useRef)(!1),N=async()=>{if(!k.current){k.current=!0,b(!0);try{await c.FH.addTask(n.id,{title:u,level2:p,prompt:x}),m(""),j(""),f(o("form.queued")),i()}catch(e){f(e.message)}finally{k.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:u,onChange:e=>m(e.target.value),placeholder:o("form.titlePlaceholder")}),(0,a.jsx)("div",{style:{marginTop:10},children:(0,a.jsx)(A,{value:p,onChange:v,presets:l,onPresetsChanged:r})}),(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:y||!x.trim(),children:o("form.add")}),(0,a.jsx)("span",{className:"muted small",children:g})]})]})}function U(e){var s,n,l,i,r,m,p,v,y,k,w,F,W,M,T,B,O,R,H,P,D,L,q,U,J,G,Y,Q,V,X,$,ee,es,en,ea,et,el,ei,er,ec,ed,eo,eh,eu,em,ep,ev,ex,ej,eg,ef,ey,eb,ek,eN,ew,eS,eC,eF,eI,eW,eM,eT,eB,eO,eR,eH,eP,eD,eA,eL,eE,eq,eU,eJ,ez,eG,eZ,eK,e_,eY,eQ,eV,eX,e$,e0,e1,e2;let{session:e8,task:e4,index:e6,presets:e3,onChange:e5}=e,{t:e7}=(0,d.kj)(),e9=(0,d.W3)(),[se,ss]=(0,t.useState)(!1),[sn,sa]=(0,t.useState)(!1),[st,sl]=(0,t.useState)(e4.title),[si,sr]=(0,t.useState)(e4.level2),[sc,sd]=(0,t.useState)(e4.prompt),[so,sh]=(0,t.useState)(null!=(ei=null==(s=e4.vcsPlan)?void 0:s.branch)?ei:""),[su,sm]=(0,t.useState)(null!=(er=null==(n=e4.vcsPlan)?void 0:n.commitMessage)?er:""),[sp,sv]=(0,t.useState)(null!=(ec=e4.checks)?ec:[]),[sx,sj]=(0,t.useState)(!!e4.readOnly),[sg,sf]=(0,t.useState)((null!=(ed=e4.scope)?ed:[]).join("\n")),sy={readOnly:sx,scope:sx?[]:(0,N.w)(sg)},sb=(0,u.c)((0,h.DG)(e4)),[sk,sN]=(0,t.useState)(null),[sw,sS]=(0,t.useState)(""),[sC,sF]=(0,t.useState)(null),[sI,sW]=(0,t.useState)(!1),[sM,sT]=(0,t.useState)(!1),sB=async()=>{try{await c.FH.updateTask(e8.id,e4.id,{title:st,level2:si,prompt:sc,vcsPlan:{branch:so,commitMessage:su},checks:sp,...sy}),ss(!1),e5()}catch(e){sS(e.message)}},sO="running"===e4.status||"waiting-approval"===e4.status,sR=!sO&&"queued"!==e4.status,sH=!sO&&"queued"!==e4.status,sP=!sO&&null!=(eo=null==(l=e8.vcs)?void 0:l.enabled)&&eo&&(!!(null==(i=e4.vcs)?void 0:i.baseCommit)||(null!=(eh=e4.attempts)?eh:[]).some(e=>{var s;return null==(s=e.vcs)?void 0:s.baseCommit})),sD=!sO&&(0,c.Zm)(e4),sA=!sO&&!sD&&(0,c.Dh)(e4)&&!e8.running,sL=async()=>{if(await (0,g.Z)(e7("task.continueConfirm",{title:e4.title})))try{await c.FH.continueTask(e8.id,e4.id),e5(),sF({intro:e7("runq.savedOffer")})}catch(e){sS(e.message)}},sE=async()=>{if(await (0,g.Z)(e7("task.rerunConfirm",{title:e4.title})))try{await c.FH.rerunTask(e8.id,e4.id),e5(),sF({intro:e7("runq.savedOffer")})}catch(e){sS(e.message)}},sq=async()=>{if(await (0,g.Z)(e7("task.editRanConfirm",{title:e4.title})))try{await c.FH.rerunTask(e8.id,e4.id,{title:st,level2:si,prompt:sc,vcsPlan:{branch:so,commitMessage:su},checks:sp,...sy},{buildOnFinished:"done"===e4.status}),ss(!1),e5(),sF({intro:e7("runq.savedOffer")})}catch(e){sS(e.message)}},sU=(0,b.e)(e5),sJ=async()=>{let e="queued"===e4.status?"task.deleteConfirm":"task.deleteConfirmRan";if(await (0,g.Z)(e7(e,{title:e4.title})))try{await c.FH.deleteTask(e8.id,e4.id),e5()}catch(e){sS(e.message)}},sz=null!=(em=e4.plan)?em:e4.continuing?null==(r=[...null!=(eu=e4.attempts)?eu:[]].reverse().find(e=>{var s;return null==(s=e.plan)?void 0:s.approved}))?void 0:r.plan:void 0,sG=async()=>{try{sN(await c.FH.taskFiles(e8.id,e4.id))}catch(e){sS(e.message)}},sZ=(e,s,n)=>n.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("span",{className:"muted",children:[e7(e)," "]}),n.map(e=>(0,a.jsx)("span",{style:{marginRight:10},children:(0,a.jsx)(o.u,{label:e,save:()=>c.FH.saveTaskFile(e8.id,e4.id,s,e)})},e))]});return(0,a.jsxs)("div",{className:"task ".concat(e4.status),id:e4.id,children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsxs)("h4",{className:"grow",children:[e6,". ",e4.title]}),(0,a.jsx)("span",{className:"badge ".concat(e4.status),children:e7("status.".concat(e4.status))}),e4.limit&&(0,a.jsx)("span",{className:"chip",title:e7("reg.limitChipWhy"),children:e7("reg.limitChip",{limit:e7("limit.".concat(e4.limit.setting),{n:e4.limit.value})})}),(null!=(ep=e4.attempt)?ep:1)>1&&(0,a.jsx)("span",{className:"chip",children:e7("task.attemptN",{n:null!=(ev=e4.attempt)?ev:1})}),e4.iterations>0&&(0,a.jsx)("span",{className:"muted small",children:e7("task.iterations",{n:e4.iterations})}),e4.runId&&(0,a.jsxs)("button",{className:sn?"":"quiet","aria-expanded":sn,onClick:()=>sa(e=>!e),title:(0,h.DG)(e4)?e7("story.showLiveWhy"):e7("story.why"),children:[(0,h.DG)(e4)&&!sn&&(0,a.jsx)("span",{className:"dot","aria-hidden":"true"}),sn?e7("story.hide"):(0,h.DG)(e4)?e7("story.showLive"):e7("story.show")]}),"queued"===e4.status&&!e8.running&&!1!==e8.active&&(0,a.jsx)("button",{className:sC?"":"primary","aria-expanded":!!sC,onClick:()=>{sW(!1),sF(sC?null:{})},title:e7("runq.buttonWhy"),children:e7("runq.button")}),(sI||"contract-conflict"===e4.stopCode&&!sO&&"queued"!==e4.status&&!e8.running)&&(0,a.jsx)("button",{className:sI?"":"primary","aria-expanded":sI,onClick:()=>sW(!sI),title:e7("cfix.buttonWhy"),children:e7("cfix.button")}),!sO&&(0,a.jsx)("button",{onClick:()=>{if(!se){var e,s,n,a,t,l;sl(e4.title),sr(e4.level2),sd(e4.prompt),sh(null!=(n=null==(e=e4.vcsPlan)?void 0:e.branch)?n:""),sm(null!=(a=null==(s=e4.vcsPlan)?void 0:s.commitMessage)?a:""),sv(null!=(t=e4.checks)?t:[]),sj(!!e4.readOnly),sf((null!=(l=e4.scope)?l:[]).join("\n"))}ss(!se)},title:e7("task.editAll"),children:se?e7("task.cancel"):e7("task.edit")}),sD&&(0,a.jsx)("button",{className:"primary",onClick:()=>void sL(),title:e7("task.continueWhy"),children:e7("task.continue")}),sA&&(0,a.jsx)("button",{className:"primary","aria-haspopup":"dialog",onClick:()=>sT(!0),title:e7("fup.buttonWhy"),children:e7("fup.button")}),sH&&(0,a.jsx)("button",{className:sD||sA?"":"primary",onClick:()=>void sE(),title:e7("task.rerunWhy"),children:e7("task.rerun")}),sP&&(0,a.jsx)("button",{onClick:()=>void sU.restore({sessionId:e8.id,taskId:e4.id,title:e4.title}),disabled:""!==sU.busy||e8.running,title:e7("restore.why"),children:"restore"===sU.busy?e7("restore.checking"):e7("restore.button")}),sR&&(0,a.jsx)("button",{onClick:()=>void sU.restartFrom({sessionId:e8.id,taskId:e4.id,title:e4.title}),disabled:""!==sU.busy||e8.running,title:e7("restart.why"),children:"restart"===sU.busy?e7("restart.checking"):e7("restart.button")}),!sO&&(0,a.jsx)("button",{className:"danger",onClick:()=>void sJ(),children:e7("task.delete")}),!se&&(sw||sU.message)&&(0,a.jsx)("span",{className:"err",role:"alert",children:sw||sU.message})]}),(0,a.jsxs)("div",{className:"muted small",children:[e4.startedAt?e7("task.started",{t:e9(e4.startedAt)}):e7("task.added",{t:e9(e4.createdAt)}),e4.finishedAt?" \xb7 ".concat(e7("task.finished",{t:e9(e4.finishedAt)})):"",e4.startedAt&&e4.finishedAt?" \xb7 ".concat(e7("task.took",{d:(0,c.c5)((0,h.d5)(e4.startedAt,e4.finishedAt))})):"",(0,h.DG)(e4)?" \xb7 ".concat(e7("task.runningFor",{d:(0,c.c5)((0,h.d5)(e4.startedAt,void 0,sb))})):""]}),"queued"!==e4.status&&(null==(m=e8.vcs)?void 0:m.enabled)&&e4.vcs&&(0,a.jsx)("div",{className:"muted small",children:e4.vcs.problem&&!e4.vcs.branch?(0,a.jsx)("span",{className:"reason",children:e7("vcs.taskProblem",{problem:e4.vcs.problem})}):(0,a.jsxs)(a.Fragment,{children:[e4.vcs.branch&&e7("vcs.taskBranch",{branch:e4.vcs.branch}),e4.vcs.baseCommit&&" \xb7 ".concat(e7("vcs.taskBase",{commit:e4.vcs.baseCommit.slice(0,8)})),e4.vcs.commit?" \xb7 ".concat(e7("vcs.taskCommit",{commit:e4.vcs.commit.slice(0,8)})):" \xb7 ".concat(e7("vcs.taskNoFiles")),(null!=(ex=null==(p=e4.vcs.files)?void 0:p.length)?ex:0)>0&&(0,a.jsxs)("details",{style:{display:"inline"},children:[(0,a.jsxs)("summary",{style:{display:"inline",cursor:"pointer"},children:[" \xb7 ",e7("vcs.taskFiles",{n:null!=(ej=null==(v=e4.vcs.files)?void 0:v.length)?ej:0})]}),(0,a.jsx)("ul",{style:{margin:"4px 0 4px 0",paddingLeft:20},children:(null!=(eg=e4.vcs.files)?eg:[]).map(e=>(0,a.jsxs)("li",{children:[(0,a.jsx)("code",{children:e.path})," ",e.added<0||e.removed<0?e7("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))})]}),e4.vcs.commit&&e4.vcs.baseCommit&&(0,a.jsxs)(a.Fragment,{children:[" \xb7 ",(0,a.jsx)(f.C,{sessionId:e8.id,taskId:e4.id,title:e4.title,files:null!=(ef=null==(y=e4.vcs.files)?void 0:y.length)?ef:0})]}),(null!=(ey=null==(k=e4.vcs.suspicious)?void 0:k.length)?ey:0)>0&&(0,a.jsxs)("div",{className:"err small",style:{marginTop:4},children:[e7("vcs.suspicious",{n:null!=(eb=null==(w=e4.vcs.suspicious)?void 0:w.length)?eb:0}),(0,a.jsx)("ul",{style:{margin:"4px 0",paddingLeft:20},children:(null!=(ek=e4.vcs.suspicious)?ek:[]).map(e=>(0,a.jsxs)("li",{children:[(0,a.jsx)("code",{children:e.path})," — ",e.reason]},e.path))})]}),(null!=(eN=null==(F=e4.scopeReverted)?void 0:F.length)?eN:0)>0&&(0,a.jsx)("div",{className:"small",style:{marginTop:4},children:e7(e4.readOnly?"task.readOnlyReverted":"task.scopeReverted",{n:null!=(ew=null==(W=e4.scopeReverted)?void 0:W.length)?ew:0,paths:(null!=(eS=e4.scopeReverted)?eS:[]).join(", ")})}),(null!=(eC=null==(M=e4.inputsRestored)?void 0:M.length)?eC:0)>0&&(0,a.jsx)("div",{className:"small",style:{marginTop:4},children:e7("task.inputsRestored",{n:null!=(eF=null==(T=e4.inputsRestored)?void 0:T.length)?eF:0,paths:(null!=(eI=e4.inputsRestored)?eI:[]).join(", ")})}),(null!=(eW=null==(B=e4.artifactsKept)?void 0:B.length)?eW:0)>0&&(0,a.jsx)("div",{className:"muted small",style:{marginTop:4,overflowWrap:"anywhere"},children:e7("task.artifactsKept",{n:null!=(eM=null==(O=e4.artifactsKept)?void 0:O.length)?eM:0,paths:(null!=(eT=e4.artifactsKept)?eT:[]).slice(0,10).map(e=>e.path).join(", ")})}),(null!=(eB=null==(R=e4.vcs.foreignCommits)?void 0:R.length)?eB:0)>0&&(0,a.jsxs)("div",{className:"err small",style:{marginTop:4},children:[e7("vcs.foreignCommits",{n:null!=(eO=null==(H=e4.vcs.foreignCommits)?void 0:H.length)?eO:0}),(0,a.jsx)("ul",{style:{margin:"4px 0",paddingLeft:20},children:(null!=(eR=e4.vcs.foreignCommits)?eR:[]).map(e=>(0,a.jsx)("li",{children:(0,a.jsx)("code",{children:e})},e))})]})]})}),"queued"===e4.status&&(null==(P=e8.vcs)?void 0:P.enabled)&&((null==(D=e4.vcsPlan)?void 0:D.branch)||(null==(L=e4.vcsPlan)?void 0:L.commitMessage))&&(0,a.jsx)("div",{className:"muted small",children:e4.vcsPlan.branch&&e4.vcsPlan.commitMessage?e7("task.gitNames",{branch:e4.vcsPlan.branch,subject:e4.vcsPlan.commitMessage.split("\n")[0]}):e4.vcsPlan.branch?e7("task.gitBranchOnly",{branch:e4.vcsPlan.branch}):e7("task.gitCommitOnly",{subject:(null!=(eH=e4.vcsPlan.commitMessage)?eH:"").split("\n")[0]})}),sM&&(0,a.jsx)(C.J,{sessionId:e8.id,taskId:e4.id,title:e4.title,onClose:e=>{sT(!1),e&&e5()}}),sI&&(0,a.jsx)(S.y,{target:{sessionId:e8.id,taskId:e4.id,title:e4.title},onApplied:(e,s)=>{e5(),0===e&&(sW(!1),sF({intro:"".concat(s," ").concat(e7("runq.savedOffer"))}))}}),sC&&"queued"===e4.status&&(0,a.jsx)(S.f,{target:{sessionId:e8.id,taskId:e4.id,title:e4.title},intro:sC.intro,checkContract:!sI,onClose:e=>{sF(null),e&&e5()}}),sn&&e4.runId&&(0,a.jsx)(x.P,{sessionId:e8.id,taskId:e4.id,live:"running"===e4.status||"waiting-approval"===e4.status}),se?(0,a.jsxs)("div",{style:{marginTop:8},children:[(0,a.jsx)("label",{children:e7("form.titleLabel")}),(0,a.jsx)("input",{type:"text",value:st,onChange:e=>sl(e.target.value)}),(0,a.jsx)("div",{style:{marginTop:8},children:(0,a.jsx)(A,{value:si,onChange:sr,presets:e3})}),(0,a.jsx)("label",{children:e7("form.taskLabel")}),(0,a.jsx)("textarea",{className:"prose",value:sc,onChange:e=>sd(e.target.value)}),(null==(q=e8.vcs)?void 0:q.enabled)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("label",{htmlFor:"branch-".concat(e4.id),children:e7("task.branch")}),(0,a.jsx)("input",{id:"branch-".concat(e4.id),type:"text",value:so,onChange:e=>sh(e.target.value),placeholder:e8.vcs.branchPrefix,disabled:"per-session"===e8.vcs.branchMode}),(0,a.jsx)("p",{className:"why",children:"per-session"===e8.vcs.branchMode?e7("task.branchIgnored"):e7("task.branchWhy")}),(0,a.jsx)("label",{htmlFor:"commit-".concat(e4.id),children:e7("task.commitMessage")}),(0,a.jsx)("textarea",{id:"commit-".concat(e4.id),value:su,onChange:e=>sm(e.target.value),style:{minHeight:70}}),(0,a.jsx)("p",{className:"why",children:e7("task.commitWhy")})]}),(0,a.jsx)(z,{checks:sp,onChange:sv}),sc.trim()!==e4.prompt.trim()&&(0,a.jsx)("p",{className:"notice caution small",children:e7("task.newIntentNote")}),(0,a.jsx)(N.y,{readOnly:sx,scope:sg,onReadOnly:sj,onScope:sf}),(0,a.jsxs)("div",{className:"row",style:{marginTop:8},children:[(0,a.jsx)("button",{className:"primary",onClick:()=>void(sR?sq():sB()),children:sR?e7("task.saveAndRerun"):e7("task.save")}),(0,a.jsx)("span",{className:"err",children:sw})]}),sR&&(0,a.jsx)("p",{className:"muted small",children:e7("task.editRanWhy")})]}):(0,a.jsxs)(a.Fragment,{children:[(null!=(eP=null==(U=e4.checks)?void 0:U.length)?eP:0)>0&&(0,a.jsxs)("details",{className:"small",style:{margin:"6px 0"},children:[(0,a.jsxs)("summary",{children:[e7("checks.title")," — ",e7("checks.n",{n:null!=(eD=null==(J=e4.checks)?void 0:J.length)?eD:0}),(null!=(eA=null==(G=e4.checkResults)?void 0:G.length)?eA:0)>0&&" \xb7 ".concat((null!=(eL=e4.checkResults)?eL:[]).filter(e=>e.passed).length,"/").concat(null==(Y=e4.checkResults)?void 0:Y.length," ").concat(e7("checks.passed"))]}),(0,a.jsx)("ul",{style:{margin:"6px 0",paddingLeft:20},children:(null!=(eE=e4.checks)?eE:[]).map((e,s)=>{var n;let t=(null!=(n=e4.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:[" — ",e7("checks.kind.".concat(e.expect)),e.value?' "'.concat(e.value,'"'):"",e.run?": ".concat(e.run):e.file?": ".concat(e.file):""]}),t&&(0,a.jsxs)("div",{className:t.passed?"muted":"reason",children:[t.passed?e7("checks.passed"):e7("checks.failed")," — ",t.detail]})]},"".concat(e.name,"-").concat(s))})})]}),(null!=(eq=null==(Q=e4.reviewChecks)?void 0:Q.length)?eq:0)>0&&(0,a.jsxs)("details",{className:"small",style:{margin:"6px 0"},children:[(0,a.jsx)("summary",{children:e7("checks.fromReview",{n:null!=(eU=null==(V=e4.reviewChecks)?void 0:V.length)?eU:0})}),(0,a.jsx)("p",{className:"why",children:e7("checks.fromReviewWhy")}),(0,a.jsx)("ul",{style:{margin:"6px 0",paddingLeft:20},children:(null!=(eJ=e4.reviewChecks)?eJ:[]).map(e=>{var s;let n=(null!=(s=e4.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:e7("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?e7("checks.passed"):e7("checks.failed")," — ",n.detail]})]},"".concat(e.attempt,":").concat(e.findingId,":").concat(e.check.name))})})]}),(0,a.jsx)(_,{review:e4.review}),e4.stopCode&&!(0,h.DG)(e4)&&(0,a.jsx)("p",{className:"small",children:(0,a.jsx)("span",{className:"chip",title:e7("stop.why"),children:e7("stop.".concat(e4.stopCode))})}),e4.handoff&&!(0,h.DG)(e4)&&(0,a.jsx)(E,{handoff:e4.handoff}),e4.summary&&(0,a.jsxs)("div",{className:"summary",children:[(0,a.jsx)("strong",{children:e7("task.whatWasDone")}),(0,a.jsx)(j.s,{text:e4.summary})]}),(null!=(ez=null==(X=e4.deviations)?void 0:X.length)?ez:0)>0&&(0,a.jsx)(Z,{items:null!=(eG=e4.deviations)?eG:[]}),(null!=(eZ=null==($=e4.disputes)?void 0:$.length)?eZ:0)>0&&(0,a.jsx)(K,{items:null!=(eK=e4.disputes)?eK:[]}),e4.environment&&(0,a.jsx)("div",{className:"muted small",style:{margin:"4px 0"},children:e7("task.ranWith",{node:e4.environment.node,npm:null!=(e_=e4.environment.npm)?e_:"—",git:null!=(eY=e4.environment.git)?eY:"—",pwsh:null!=(eV=null!=(eQ=e4.environment.pwsh)?eQ:e4.environment.powershell)?eV:"—"})}),(null!=(eX=null==(ee=e4.leftovers)?void 0:ee.length)?eX:0)>0&&(0,a.jsxs)("div",{className:"err small",style:{margin:"6px 0"},children:[e7("task.leftovers",{n:null!=(e$=null==(es=e4.leftovers)?void 0:es.length)?e$:0}),(0,a.jsx)("ul",{style:{margin:"4px 0",paddingLeft:20},children:(null!=(e0=e4.leftovers)?e0:[]).map(e=>(0,a.jsxs)("li",{children:[(0,a.jsx)("code",{children:e.name})," pid ",e.pid,e.ports.length>0?" \xb7 ".concat(e7("task.leftoverPorts",{ports:e.ports.join(", ")})):""," \xb7 ",e.by]},"".concat(e.by,"-").concat(e.pid)))})]}),e4.reason&&(0,a.jsx)("div",{className:"reason small",style:{margin:"6px 0"},children:e4.reason}),(null!=(e1=null==(en=e4.attempts)?void 0:en.length)?e1:0)>0&&(0,a.jsxs)("details",{children:[(0,a.jsx)("summary",{children:e7("task.attempts",{n:null!=(e2=null==(ea=e4.attempts)?void 0:ea.length)?e2:0})}),null==(et=e4.attempts)?void 0:et.map((e,s)=>{var n,t,l,i;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:e7("task.attemptN",{n:s+1})}),(0,a.jsx)("span",{className:"badge ".concat(e.status),children:e7("status.".concat(e.status))}),e.iterations>0&&(0,a.jsx)("span",{className:"muted",children:e7("task.iterations",{n:e.iterations})}),e.runId&&(0,a.jsx)(o.u,{label:e7("save.attemptLog"),save:()=>c.FH.saveTaskLog(e8.id,e4.id,e.runId)}),e.runId&&(0,a.jsx)(o.H,{sessionId:e8.id,taskId:e4.id,attempt:s+1}),e.runId&&(null==(n=e.vcs)?void 0:n.commit)&&e.vcs.baseCommit&&(0,a.jsx)(f.C,{sessionId:e8.id,taskId:e4.id,runId:e.runId,title:"".concat(e4.title," — ").concat(e7("task.attemptN",{n:s+1})),files:null!=(l=null==(t=e.vcs.files)?void 0:t.length)?l:0})]}),(0,a.jsxs)("div",{className:"muted",children:[e.startedAt?e7("task.started",{t:e9(e.startedAt)}):"",e.finishedAt?" \xb7 ".concat(e7("task.finished",{t:e9(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!==e4.prompt&&(0,a.jsxs)("details",{children:[(0,a.jsx)("summary",{children:e7("task.attemptText")}),(0,a.jsx)("pre",{children:e.prompt})]})]},"".concat(null!=(i=e.runId)?i:s))})]}),"queued"===e4.status?(0,a.jsxs)("div",{style:{marginTop:8},children:[(0,a.jsx)("div",{className:"muted small",children:e7("task.prompt")}),(0,a.jsx)("pre",{children:e4.prompt}),e4.level2.trim()?(0,a.jsxs)("details",{children:[(0,a.jsx)("summary",{children:e7("task.l2Show",{n:e4.level2.trim().split("\n").length})}),(0,a.jsx)("pre",{children:e4.level2})]}):(0,a.jsx)("div",{className:"muted small",children:e7("task.noL2")})]}):(0,a.jsxs)("details",{children:[(0,a.jsx)("summary",{children:e7("task.promptAndL2")}),e4.level2.trim()&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"muted small",children:e7("task.l2")}),(0,a.jsx)("pre",{children:e4.level2})]}),(0,a.jsx)("div",{className:"muted small",children:e7("task.prompt")}),(0,a.jsx)("pre",{children:e4.prompt})]}),(null==(el=e4.continuing)?void 0:el.instruction)&&(0,a.jsxs)("div",{className:"notice calm small",style:{marginTop:6},children:[(0,a.jsx)("strong",{children:e7("task.continuedWith",{n:e4.continuing.fromAttempt})}),(0,a.jsx)("pre",{style:{margin:"4px 0 0",whiteSpace:"pre-wrap"},children:e4.continuing.instruction})]}),sz&&(0,a.jsxs)("details",{open:!sz.approved,children:[(0,a.jsx)("summary",{children:sz.approved?e7("pm.taskApproved",{n:sz.version}):e7("pm.taskWaiting",{n:sz.version})}),(0,a.jsx)(I.D,{plan:sz})]}),e4.firstMessage&&(0,a.jsxs)("details",{children:[(0,a.jsx)("summary",{children:e7("task.firstMessage")}),(0,a.jsx)("pre",{className:"tall",children:e4.firstMessage})]}),e4.runId&&(0,a.jsxs)("details",{onToggle:e=>e.currentTarget.open&&void sG(),children:[(0,a.jsx)("summary",{children:e7("task.files")}),(0,a.jsx)("div",{className:"row small",style:{margin:"6px 0"},children:(0,a.jsx)(o.u,{label:e7("save.log"),save:()=>c.FH.saveTaskLog(e8.id,e4.id)})}),sk&&(0,a.jsxs)("div",{className:"small",children:[sZ("task.reports","reports",sk.reports),sZ("task.artifacts","artifacts",sk.artifacts),sZ("task.replies","replies",sk.replies)]})]}),e4.finalReply&&(0,a.jsxs)("details",{children:[(0,a.jsx)("summary",{children:e7("task.finalReply")}),(0,a.jsx)("pre",{className:"tall",children:e4.finalReply})]})]})]})}function J(e){let{events:s}=e,{t:n}=(0,d.kj)(),{appearance:l}=(0,m.KP)(),i=(0,t.useRef)(null);return(0,t.useEffect)(()=>{!l.reduceMotion&&i.current&&(i.current.scrollTop=i.current.scrollHeight)},[s.length,l.reduceMotion]),(0,a.jsxs)("div",{className:"panel",children:[(0,a.jsx)("h2",{children:n("live.title")}),(0,a.jsxs)("div",{className:"log",ref:i,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 z(e){let{checks:s,onChange:n}=e,{t}=(0,d.kj)(),l=(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:t("checks.title")}),(0,a.jsx)("p",{className:"why",style:{marginTop:0},children:t("checks.why")}),0===s.length&&(0,a.jsx)("p",{className:"muted small",children:t("checks.noneWhy")}),s.map((e,i)=>{var r,d,o,h;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:t("checks.namePlaceholder"),onChange:e=>l(i,{name:e.target.value}),"aria-label":t("checks.name")}),(0,a.jsx)("select",{value:e.expect,onChange:e=>l(i,{expect:e.target.value}),"aria-label":t("checks.kind"),style:{width:"auto"},children:c.FZ.map(e=>(0,a.jsx)("option",{value:e,children:t("checks.kind.".concat(e))},e))}),(0,a.jsx)("button",{className:"quiet",onClick:()=>n(s.filter((e,s)=>s!==i)),children:t("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!=(r=e.run)?r:"",placeholder:t("checks.run"),onChange:e=>l(i,{run:e.target.value}),"aria-label":t("checks.run")}),(0,a.jsx)("input",{type:"text",value:null!=(d=e.cwd)?d:"",placeholder:t("checks.cwd"),onChange:e=>l(i,{cwd:e.target.value}),"aria-label":t("checks.cwd"),style:{width:220}})]}):(0,a.jsx)("input",{type:"text",className:"grow",value:null!=(o=e.file)?o:"",placeholder:t("checks.file"),onChange:e=>l(i,{file:e.target.value}),"aria-label":t("checks.file")}),(0,c.dK)(e.expect)&&(0,a.jsx)("input",{type:"text",value:null!=(h=e.value)?h:"",placeholder:"output-matches"===e.expect?t("checks.valueRegex"):t("checks.value"),onChange:e=>l(i,{value:e.target.value}),"aria-label":t("checks.value"),style:{width:240}})]})]},i)}),(0,a.jsx)("button",{onClick:()=>n([...s,{name:"",expect:"exit-zero",run:""}]),children:t("checks.add")})]})}function G(e){let{tasks:s}=e,{t:n}=(0,d.kj)(),t=(0,h.hH)(s),l=(0,u.c)(!!t&&t.tasks.some(h.DG));if(!t)return null;let i=(0,h.eZ)(t.run,t.tasks,l);return(0,a.jsx)("p",{className:"muted small",style:{margin:"4px 0 10px"},children:n(i.live?"session.runClockLive":"session.runClock",{n:i.tasks,d:(0,c.c5)(i.ms)})})}function Z(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 K(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 _(e){var s,n,t,l,i;let{review:r}=e,{t:c}=(0,d.kj)();if(!r)return null;if("skipped"===r.verdict)return r.skippedBecause?(0,a.jsx)("p",{className:"muted small",children:c("review.skippedWhy",{why:r.skippedBecause})}):null;let o="pass"===r.verdict?"done":"fail"===r.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(r.verdict))}),r.stepsRun>0&&(0,a.jsx)("span",{className:"muted",children:c("review.ran",{n:r.stepsRun})}),r.rounds>1&&(0,a.jsx)("span",{className:"muted",children:c("review.rounds",{n:r.rounds})}),r.model&&(0,a.jsx)("span",{className:"chip",children:c("review.onModel",{model:r.model})})]}),r.problem&&(0,a.jsx)("p",{className:"reason",children:c("review.problem",{problem:r.problem})}),r.summary&&(0,a.jsx)(j.s,{text:r.summary}),(null!=(t=null==(s=r.findings)?void 0:s.length)?t:0)>0&&(0,a.jsxs)("details",{style:{marginTop:4},children:[(0,a.jsx)("summary",{children:c("review.findings",{n:null!=(l=null==(n=r.findings)?void 0:n.length)?l:0})}),(0,a.jsx)("ol",{style:{margin:"6px 0",paddingLeft:20},children:(null!=(i=r.findings)?i:[]).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:()=>r});var a=n(3365),t=n(1521),l=n(5549),i=n(867);function r(e){var s,n,r;let{id:c,chosen:d,onChange:o,none:h,catalogue:u,disabled:m=!1,style:p}=e,{t:v}=(0,i.kj)(),x=function(e){let[s,n]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(void 0!==e)return;let s=!0;return l.FH.models().then(e=>{s&&n(e)}).catch(()=>void 0),()=>{s=!1}},[e]),void 0!==e?e:s}(u),j=null!=(s=null==x?void 0:x.options)?s:[],g=e=>e.toLowerCase().replace(/[-‐‑‒–—_]+/g," ").replace(/\s+/g," ").trim(),f=d?j.find(e=>g(e.name)===g(d)):void 0,y=null!=(n=null==f?void 0:f.name)?n:d,b=!!f,k=j.filter(e=>!e.group),N=new Map;for(let e of j)e.group&&N.set(e.group,[...null!=(r=N.get(e.group))?r:[],e]);return(0,a.jsxs)("select",{id:c,value:y,onChange:e=>o(e.target.value),disabled:m,style:{width:"auto",minWidth:280,...p},children:[(0,a.jsx)("option",{value:"",children:h}),d&&!b&&(0,a.jsx)("option",{value:d,children:v("model.notInList",{name:d})}),k.map(e=>(0,a.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(v("model.unavailable")):""]},e.name)),[...N.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(v("model.unavailable")):""]},e.name))},s)})]})}},8078:(e,s,n)=>{"use strict";n.d(s,{AppearanceProvider:()=>o,KP:()=>h});var a=n(3365),t=n(1521);let l="cop.appearance",i=["small","normal","large","huge","giant"];"\n(function () {\n try {\n var d = document.documentElement;\n var raw = localStorage.getItem('".concat(l,"');\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(i),".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");let r={theme:"light",textSize:"normal",highContrast:!1,reduceMotion:!1,underlineLinks:!1,strongFocus:!1};function c(e){let s=document.documentElement;s.dataset.theme=e.theme,s.dataset.textsize=e.textSize,s.dataset.contrast=e.highContrast?"high":"normal",s.dataset.motion=e.reduceMotion?"reduced":"normal",s.dataset.links=e.underlineLinks?"underline":"plain",s.dataset.focus=e.strongFocus?"strong":"normal"}let d=(0,t.createContext)({appearance:r,set:()=>void 0,reset:()=>void 0,loaded:!1});function o(e){let{children:s}=e,[n,o]=(0,t.useState)(r),[h,u]=(0,t.useState)(!1);(0,t.useEffect)(()=>{let e=r;try{let s=window.localStorage.getItem(l);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:i.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){}o(e),c(e),u(!0)},[]);let m=(0,t.useCallback)(e=>{o(s=>{let n={...s,...e};c(n);try{window.localStorage.setItem(l,JSON.stringify(n))}catch(e){}return n})},[]),p=(0,t.useCallback)(()=>{o(r),c(r);try{window.localStorage.removeItem(l)}catch(e){}},[]);return(0,a.jsx)(d.Provider,{value:{appearance:n,set:m,reset:p,loaded:h},children:s})}function h(){return(0,t.useContext)(d)}},8596:(e,s,n)=>{"use strict";n.d(s,{E:()=>r});var a=n(3365),t=n(1521),l=n(5549),i=n(867);function r(e){var s,n,r,c,d,o,h;let{dir:u,onDone:m}=e,{t:p}=(0,i.kj)(),v=(0,i.W3)(),[x,j]=(0,t.useState)(null),[g,f]=(0,t.useState)(""),[y,b]=(0,t.useState)(""),[k,N]=(0,t.useState)(""),[w,S]=(0,t.useState)(!1),C=e=>(null!=e?e:"—").slice(0,8),F=async e=>{b(""),N(""),f(e?"fetch":"prepare");try{j(await l.FH.preparePreview(u,e))}catch(e){b(e.message)}finally{f("")}},I=async()=>{if(null==x?void 0:x.fingerprint){b(""),f("prepare");try{var e,s;let n=await l.FH.prepareProject(u,x.fingerprint,{savedBranch:x.savedBranch,savedMainBranch:x.savedMainBranch});n.ok?(N(null!=(s=n.result)?s:""),j(null),null==m||m()):b(null!=(e=n.problem)?e:"")}catch(e){b(e.message)}finally{f("")}}},W=async e=>{try{await navigator.clipboard.writeText(e),S(!0),window.setTimeout(()=>S(!1),2500)}catch(e){b(p("plan.copyFailed"))}},M=e=>(0,a.jsxs)("ul",{style:{margin:"2px 0 6px",paddingLeft:20},children:[e.slice(0,30).map(e=>(0,a.jsx)("li",{children:(0,a.jsx)("code",{children:e})},e)),e.length>30&&(0,a.jsx)("li",{className:"muted",children:p("prep.more",{n:e.length-30})})]}),T=x&&!x.ok&&x.fetched&&!x.fetched.ok;return(0,a.jsxs)("div",{className:"prepare-folder small",style:{marginTop:8,overflowWrap:"anywhere"},children:[(0,a.jsx)("button",{type:"button",onClick:()=>void F(!0),disabled:!!g,children:p("prep.show")}),(0,a.jsx)("p",{className:"why",children:p("prep.why")}),(0,a.jsx)("p",{className:"why",children:p("prep.password")}),"fetch"===g&&(0,a.jsx)("p",{role:"status",children:p("prep.fetching")}),y&&(0,a.jsx)("p",{className:"err",role:"alert",children:y}),k&&(0,a.jsx)("p",{className:"notice",role:"status",children:k}),x&&!x.ok&&!T&&(0,a.jsx)("p",{className:"err",children:x.problem}),T&&(0,a.jsxs)("div",{className:"notice caution",style:{marginTop:8},children:[(0,a.jsxs)("p",{children:[(0,a.jsx)("strong",{children:p("prep.fetchFailed")})," ",(0,a.jsx)("code",{children:null==(s=x.fetched)?void 0:s.detail})]}),(null==(n=x.fetched)?void 0:n.auth)&&(0,a.jsx)("p",{children:p("prep.fetchAuth")}),(0,a.jsx)("div",{className:"row",children:(0,a.jsx)("button",{type:"button",onClick:()=>void F(!0),disabled:!!g,children:p("prep.retry")})}),x.fetchCommand&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{style:{marginTop:8},children:p("prep.ownTerminal")}),(0,a.jsx)("pre",{className:"sync-cmd",children:x.fetchCommand}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("button",{type:"button",onClick:()=>{var e;W(null!=(e=x.fetchCommand)?e:"")},children:p("prep.copyFetch")}),w&&(0,a.jsx)("span",{className:"badge done",children:p("prep.copied")}),(0,a.jsx)("button",{type:"button",onClick:()=>void F(!1),disabled:!!g,children:p("prep.useFetched")})]}),x.lastFetched&&(0,a.jsx)("p",{className:"muted",children:p("prep.lastFetched",{when:v(x.lastFetched)})})]})]}),(null==x?void 0:x.ok)&&(0,a.jsxs)("div",{className:"notice caution",style:{marginTop:8},children:[(0,a.jsx)("p",{children:p("prep.where",{target:null!=(r=x.target)?r:"",commit:C(x.targetCommit),branch:null!=(c=x.branch)?c:"HEAD",head:C(x.head)})}),!x.fetched&&(0,a.jsxs)("p",{className:"muted",children:[p("prep.notFetched")," ",x.lastFetched?p("prep.lastFetched",{when:v(x.lastFetched)}):p("prep.lastFetchedUnknown")]}),x.alreadyThere?(0,a.jsx)("p",{children:p("prep.already")}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("strong",{children:p("prep.willDo")}),(0,a.jsxs)("ol",{style:{margin:"4px 0",paddingLeft:20},children:[x.savedBranch&&(0,a.jsxs)("li",{children:[p("prep.keepChanges",{changed:x.changed.length,untracked:x.untracked.length,saved:x.savedBranch}),M([...x.changed,...x.untracked])]}),x.savedMainBranch&&(0,a.jsxs)("li",{children:[p("prep.keepMain",{n:x.mainOnlyCommits.length,branch:null!=(d=x.localBranch)?d:"",saved:x.savedMainBranch}),M(x.mainOnlyCommits)]}),(0,a.jsx)("li",{children:p("prep.moveTo",{branch:null!=(o=x.localBranch)?o:"",commit:C(x.targetCommit),target:null!=(h=x.target)?h:""})})]}),x.branchOnlyCommits.length>0&&x.branch&&(0,a.jsx)("p",{children:p("prep.branchStays",{branch:x.branch,n:x.branchOnlyCommits.length})}),(0,a.jsx)("p",{className:"muted",children:p("prep.ignored")}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("button",{type:"button",className:"primary",onClick:()=>void I(),disabled:!!g,children:p("prep.confirm")}),(0,a.jsx)("button",{type:"button",className:"quiet",onClick:()=>j(null),disabled:!!g,children:p("prep.cancel")})]})]})]})]})}},8848:(e,s,n)=>{"use strict";n.d(s,{H4:()=>d,L:()=>o,z4:()=>h});var a=n(3365),t=n(8197),l=n.n(t),i=n(1521),r=n(5549),c=n(867);function d(e){let{current:s,onUse:n}=e,{t}=(0,c.kj)(),[l,d]=(0,i.useState)(null);if((0,i.useEffect)(()=>{let e=!1;return r.FH.project().then(s=>{e||d(s)}).catch(()=>void 0),()=>{e=!0}},[]),!l)return null;let o=l.rootDir.trim(),h=s.trim().toLowerCase(),u=n?l.others.filter(e=>e.rootDir.trim().toLowerCase()!==h):[];return(0,a.jsx)(m,{label:o?t("proj.defaultIs",{dir:o}):t("proj.noneShort"),offer:o&&n&&h!==o.toLowerCase()?{text:t("proj.useIt"),onUse:()=>n(o)}:void 0,more:u.map(e=>({text:t("proj.otherUse",{name:e.name}),title:e.rootDir,onUse:()=>null==n?void 0:n(e.rootDir)})),link:o?t("proj.change"):t("proj.setIt"),anchor:"project"})}function o(e){let{current:s,onUse:n}=e,t=u(),{t:l}=(0,c.kj)();if(!t)return null;let i=t.defaultModel.trim();return(0,a.jsx)(m,{label:i?l("def.modelDefaultIs",{name:i}):l("def.modelNoneShort"),offer:i&&n&&s.trim()!==i?{text:l("def.modelUseIt"),onUse:()=>n(i)}:void 0,link:l(i?"proj.change":"proj.setIt"),anchor:"model"})}function h(e){let{current:s,onUse:n}=e,t=u(),{t:l}=(0,c.kj)();if(!t)return null;let i=t.defaultReviewModel.trim();return(0,a.jsx)(m,{label:i?l("def.reviewDefaultIs",{name:i}):l("def.reviewNoneShort"),offer:i&&n&&s.trim()!==i?{text:l("def.modelUseIt"),onUse:()=>n(i)}:void 0,link:l(i?"proj.change":"proj.setIt"),anchor:"review"})}function u(){let[e,s]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!1;return r.FH.models().then(n=>{e||s(n)}).catch(()=>void 0),()=>{e=!0}},[]),e}function m(e){let{label:s,offer:n,more:t=[],link:i,anchor:r}=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})," "]}),t.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)(l(),{href:"/defaults#".concat(r),children:i})]})}},9717:(e,s,n)=>{"use strict";n.d(s,{D:()=>l});var a=n(3365),t=n(867);function l(e){var s,n;let{plan:l,showApproval:i=!0}=e,{t:r}=(0,t.kj)(),c=(0,t.W3)(),d=l.approved;return(0,a.jsxs)("div",{className:"plan-view",children:[(0,a.jsx)("p",{className:"small muted",children:r("pm.version",{n:l.version,at:c(l.at)})}),i&&d&&(0,a.jsxs)("p",{className:"small",children:["operator"===d.by?r("pm.approvedByOperator",{at:c(d.at)}):r("pm.approvedAuto",{at:c(d.at)}),d.why&&" ".concat(d.why),d.note&&" ".concat(r("pm.approvedNote",{note:d.note}))]}),(0,a.jsx)("h4",{children:r("pm.existing")}),(0,a.jsx)("p",{className:"pre-wrap",children:l.existing}),(0,a.jsx)("h4",{children:r("pm.approach")}),(0,a.jsx)("p",{className:"pre-wrap",children:l.approach}),(0,a.jsx)("h4",{children:r("pm.steps")}),(0,a.jsx)("ol",{children:l.steps.map((e,s)=>(0,a.jsx)("li",{className:"pre-wrap",children:e},s))}),l.files.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h4",{children:r("pm.files")}),(0,a.jsx)("ul",{children:l.files.map(e=>(0,a.jsx)("li",{children:(0,a.jsx)("code",{children:e})},e))})]}),(0,a.jsx)("h4",{children:r("pm.verification")}),(0,a.jsx)("p",{className:"pre-wrap",children:l.verification}),l.risks&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h4",{children:r("pm.risks")}),(0,a.jsx)("p",{className:"pre-wrap",children:l.risks})]}),(null!=(n=null==(s=l.revisions)?void 0:s.length)?n:0)>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h4",{children:r("pm.revisions")}),(0,a.jsx)("ul",{children:l.revisions.map(e=>(0,a.jsxs)("li",{className:"small",children:[r("pm.revision",{n:e.version,at:c(e.at)})," ",(0,a.jsx)("span",{className:"pre-wrap",children:e.comment})]},e.version))})]})]})}}},e=>{e.O(0,[197,867,549,499,204,347,131,358],()=>e(e.s=1772)),_N_E=e.O()}]);