copilot-operator 0.1.47 → 0.1.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/api/operator.controller.js +62 -0
- package/dist/src/api/operator.service.js +39 -0
- package/dist/src/plan/systemGuide.js +96 -16
- package/dist/src/session/taskExchange.js +230 -0
- package/dist/src/session/workspaceGit.js +212 -0
- package/dist/src/transport/chatSession.js +28 -4
- package/dist/web/404.html +2 -2
- package/dist/web/_next/static/chunks/534-56c68930a1a3c10f.js +1 -0
- package/dist/web/_next/static/chunks/549-c32dd718a1809d4d.js +1 -0
- package/dist/web/_next/static/chunks/867-0e5d0d5472bf185f.js +1 -0
- package/dist/web/_next/static/chunks/app/history/page-95bab4c1b1ff9339.js +1 -0
- package/dist/web/_next/static/chunks/app/layout-a1314921eeba8ad5.js +1 -0
- package/dist/web/_next/static/chunks/app/page-4d8f0851fe672925.js +1 -0
- package/dist/web/_next/static/chunks/app/sessions/view/{page-835d3533fdc63082.js → page-adb64f8ba3d8c06e.js} +1 -1
- package/dist/web/_next/static/css/{70ceb261074b139c.css → 4335e4ce269ba1ea.css} +1 -1
- package/dist/web/appearance.html +2 -2
- package/dist/web/appearance.txt +10 -10
- package/dist/web/defaults.html +2 -2
- package/dist/web/defaults.txt +10 -10
- package/dist/web/history.html +2 -2
- package/dist/web/history.txt +10 -10
- package/dist/web/import.html +2 -2
- package/dist/web/import.txt +10 -10
- package/dist/web/index.html +2 -2
- package/dist/web/index.txt +10 -10
- package/dist/web/level1.html +2 -2
- package/dist/web/level1.txt +10 -10
- package/dist/web/presets.html +2 -2
- package/dist/web/presets.txt +10 -10
- package/dist/web/sessions/view.html +2 -2
- package/dist/web/sessions/view.txt +10 -10
- package/dist/web/sessions.html +2 -2
- package/dist/web/sessions.txt +10 -10
- package/dist/web/system.html +2 -2
- package/dist/web/system.txt +10 -10
- package/package.json +3 -2
- package/dist/web/_next/static/chunks/549-8732dd2c1339bc5d.js +0 -1
- package/dist/web/_next/static/chunks/867-7fb52be342fa64e5.js +0 -1
- package/dist/web/_next/static/chunks/897-5a34109533c3da50.js +0 -1
- package/dist/web/_next/static/chunks/app/history/page-0bb537407fed5944.js +0 -1
- package/dist/web/_next/static/chunks/app/layout-485ce9395cb17998.js +0 -1
- package/dist/web/_next/static/chunks/app/page-ed6a5a2ff1b6285e.js +0 -1
- /package/dist/web/_next/static/{HT6yqFoDPOXChAZVDxshC → z74_FBfnnXW5IJCHTgTH2}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{HT6yqFoDPOXChAZVDxshC → z74_FBfnnXW5IJCHTgTH2}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[897],{287:(e,t,s)=>{s.d(t,{y:()=>h,f:()=>u});var n=s(3365),l=s(1521),a=s(5549),i=s(867),r=s(7527),c=s(1035),d=s(1701),o=s(4811);function u(e){var t,s,u;let{target:f,intro:m,initial:p="one",focusFirst:x=!1,checkContract:g=!0,onClose:j}=e,{t:y}=(0,i.kj)(),k=(0,o.p)(),[v,b]=(0,l.useState)(null),[N,w]=(0,l.useState)(p),[S,C]=(0,l.useState)(!1),[q,I]=(0,l.useState)(""),[F,R]=(0,l.useState)(!1),E=(0,l.useRef)(null),L=(0,l.useRef)(null),T=(0,l.useRef)(null),M=(0,l.useId)(),H=()=>a.FH.session(f.sessionId).then(b).catch(e=>I(e.message));(0,l.useEffect)(()=>{H(),g&&a.FH.contractCheck(f.sessionId,f.taskId).then(e=>R(e.conflicts.length>0)).catch(()=>void 0)},[f.sessionId,f.taskId]),(0,r.z)(H,3e3,!!(null==v?void 0:v.running));let O=null!==v;if((0,l.useEffect)(()=>{var e,t,s;if(!O||(null==(t=E.current)||null==(e=t.scrollIntoView)||e.call(t,{block:"nearest"}),!x))return;let n=L.current;n&&!n.disabled?n.focus():null==(s=T.current)||s.focus()},[O,x]),!v)return(0,n.jsx)("div",{className:"notice calm",style:{marginTop:8},children:(0,n.jsx)("span",{className:"small",children:q||y("runq.loading")})});let W=function(e,t){let s=e.tasks.findIndex(e=>e.id===t),n=s>=0?e.tasks[s]:void 0,l=s>=0?e.tasks.slice(0,s):[],a=s>=0?e.tasks.slice(s+1):[],i="continue"!==e.onFailure,r=-1;return a.forEach((e,t)=>{"queued"===e.status&&(r=t)}),{task:n,followingQueued:a.filter(e=>"queued"===e.status),laterRan:a.filter(e=>"queued"!==e.status),earlierRan:l.filter(e=>"queued"!==e.status),chain:i,chainGap:i?l.find(e=>"done"!==e.status):void 0,chainGapLater:i&&r>0?a.slice(0,r).find(e=>"queued"!==e.status&&"done"!==e.status):void 0}}(v,f.taskId),D=(null==(t=W.task)?void 0:t.status)==="queued",G="following"===N?[W.task,...W.followingQueued]:W.task?[W.task]:[],Q=v.running?y("runq.sessionRunning"):!1===v.active?y("runq.sessionInactive"):"",P=async e=>{if("unattended"!==e||k||await (0,c.Z)(y("batch.unattendedConfirm",{n:1}))){C(!0),I(""),R(!1);try{var t,s;let n=await a.FH.suggestedRunName([f.sessionId]).then(e=>e.name).catch(()=>void 0),l=await (0,d.L)({sessionIds:[f.sessionId],mode:e,start:t=>a.FH.startBatch([f.sessionId],e,"stop",void 0,void 0,n,G.map(e=>e.id),t)});if(!l.started&&!l.reply)return;let i=null!=(t=l.reply)?t:{started:!0};if(!l.started){I(y("batch.notStarted",{reason:null!=(s=i.reason)?s:""}));let e=await a.FH.contractCheck(f.sessionId,f.taskId).catch(()=>({conflicts:[]}));R(e.conflicts.length>0);return}I(y("runq.started",{n:G.length})),j(!0)}catch(e){I(e.message)}finally{C(!1)}}},A=y("runq.title",{title:f.title});return(0,n.jsxs)("div",{ref:E,className:"notice calm",role:"group","aria-label":A,style:{marginTop:8},children:[m&&(0,n.jsx)("p",{className:"small",style:{marginTop:0},children:m}),(0,n.jsx)("strong",{children:A}),D?(0,n.jsxs)(n.Fragment,{children:[W.followingQueued.length>0&&(0,n.jsxs)("div",{className:"small",role:"radiogroup","aria-label":A,style:{marginTop:6},children:[(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"radio",name:"runq-".concat(M),checked:"one"===N,onChange:()=>w("one"),disabled:S}),y("runq.onlyThis")]}),(0,n.jsxs)("label",{className:"option-inline",title:y("runq.followingWhy"),children:[(0,n.jsx)("input",{type:"radio",name:"runq-".concat(M),checked:"following"===N,onChange:()=>w("following"),disabled:S}),y("runq.following",{n:W.followingQueued.length,session:v.name})]})]}),(0,n.jsx)("div",{className:"small",style:{marginTop:6},children:y("runq.willRun")}),(0,n.jsx)("ol",{className:"small",style:{margin:"4px 0",paddingLeft:22},children:G.map(e=>(0,n.jsx)("li",{children:e.title},e.id))}),(0,n.jsxs)("ul",{className:"small",style:{margin:"4px 0",paddingLeft:18},children:[W.chain&&G.length>1&&(0,n.jsx)("li",{children:y("runq.chainStops")}),W.earlierRan.length>0&&(0,n.jsx)("li",{children:y("runq.untouched",{n:W.earlierRan.length})}),W.laterRan.length>0&&(0,n.jsx)("li",{children:y("runq.laterRan",{list:W.laterRan.map(e=>'"'.concat(e.title,'"')).join(", ")})}),"one"===N&&W.followingQueued.length>0&&(0,n.jsx)("li",{children:y("runq.restWait",{n:W.followingQueued.length})})]}),W.chainGap&&(0,n.jsx)("div",{className:"notice caution small",style:{marginTop:6},children:y("runq.chainGap",{before:W.chainGap.title,status:y("status.".concat(W.chainGap.status))})}),"following"===N&&W.chainGapLater&&(0,n.jsx)("div",{className:"notice caution small",style:{marginTop:6},children:y("runq.chainGapLater",{between:W.chainGapLater.title,status:y("status.".concat(W.chainGapLater.status))})}),Q&&(0,n.jsx)("p",{className:"small",children:Q})]}):(0,n.jsx)("p",{className:"small",children:y("runq.notQueued",{status:y("status.".concat(null!=(u=null==(s=W.task)?void 0:s.status)?u:"queued"))})}),(0,n.jsxs)("div",{className:"row",style:{marginTop:8},children:[D&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{ref:L,className:"primary",disabled:S||!!Q,onClick:()=>void P("confirm"),title:y("runq.goWhy"),children:y("runq.go")}),(0,n.jsx)("button",{disabled:S||!!Q,onClick:()=>void P("unattended"),title:y("runq.unattendedWhy"),children:y("runq.unattended")})]}),(0,n.jsx)("button",{ref:T,className:"quiet",disabled:S,onClick:()=>j(!1),children:m?y("runq.later"):y("dialog.cancel")}),q&&(0,n.jsx)("span",{className:"small",role:"status",children:q})]}),F&&(0,n.jsx)(h,{target:f,onApplied:(e,t)=>{H(),0===e&&(R(!1),I(t))}})]})}function h(e){let{target:t,onApplied:s}=e,{t:r}=(0,i.kj)(),[c,d]=(0,l.useState)(null),[o,u]=(0,l.useState)([]),[h,f]=(0,l.useState)(!1),[m,p]=(0,l.useState)(""),[x,g]=(0,l.useState)(null),[j,y]=(0,l.useState)(null),k=(0,l.useId)();(0,l.useEffect)(()=>{d(null),Promise.all([a.FH.contractCheck(t.sessionId,t.taskId),a.FH.session(t.sessionId)]).then(e=>{var s;let[n,l]=e,a=l.tasks.find(e=>e.id===t.taskId);d(n.conflicts),u(n.conflicts.map(e=>e.fixes.length>0?0:-1)),g(null!=(s=null==a?void 0:a.status)?s:null),y(a?{readOnly:a.readOnly,scope:a.scope,checks:a.checks}:null)}).catch(e=>p(e.message))},[t.sessionId,t.taskId]);let v=async()=>{if(c){f(!0),p("");try{let e=await a.FH.applyContractFix(t.sessionId,t.taskId,o,c.map(e=>e.text)),n=r("cfix.applied",{list:(j?function(e,t,s){var n,l,a,i;let r=[];!!t.readOnly!=!!s.readOnly&&r.push(e(s.readOnly?"cfix.chReadOnlyOn":"cfix.chReadOnlyOff"));let c=(null!=(n=t.scope)?n:[]).join(", "),d=(null!=(l=s.scope)?l:[]).join(", ");c!==d&&r.push(d?e("cfix.chScope",{paths:d}):e("cfix.chScopeRemoved"));let o=new Set((null!=(a=s.checks)?a:[]).map(e=>e.name));for(let s of null!=(i=t.checks)?i:[])o.has(s.name)||r.push(e("cfix.chDropped",{check:s.name}));return r.join("; ")}(r,j,e.task):e.applied.join("; "))||r("cfix.chNothing")});p(n+(e.remaining.length>0?" ".concat(r("cfix.remaining",{n:e.remaining.length})):"")),d(e.remaining),u(e.remaining.map(e=>e.fixes.length>0?0:-1)),g("queued"),y({readOnly:e.task.readOnly,scope:e.task.scope,checks:e.task.checks}),s(e.remaining.length,n)}catch(e){p(e.message)}finally{f(!1)}}},b=r("cfix.title",{title:t.title});return(0,n.jsxs)("div",{className:"notice caution",role:"group","aria-label":b,style:{marginTop:8},children:[(0,n.jsx)("strong",{children:b}),(0,n.jsx)("p",{className:"why",children:r("cfix.why")}),null===c?(0,n.jsx)("p",{className:"small",children:m||r("cfix.loading")}):0===c.length?(0,n.jsx)("p",{className:"small",role:"status",children:m||r("cfix.none")}):(0,n.jsxs)(n.Fragment,{children:[c.map((e,t)=>(0,n.jsxs)("fieldset",{className:"small",style:{margin:"8px 0",border:0,padding:0},children:[(0,n.jsx)("legend",{style:{fontWeight:600},children:e.text}),e.fixes.map((e,s)=>(0,n.jsxs)("label",{className:"option-inline",style:{display:"block"},children:[(0,n.jsx)("input",{type:"radio",name:"cfix-".concat(k,"-").concat(t),checked:o[t]===s,onChange:()=>u(e=>e.map((e,n)=>n===t?s:e)),disabled:h}),"add-to-scope"===e.kind?r("cfix.addToScope",{path:e.path}):"not-read-only"===e.kind?e.scope.length>0?r("cfix.notReadOnly",{paths:e.scope.join(", ")}):r("cfix.notReadOnlyAll"):"drop-scope"===e.kind?r("cfix.dropScope"):r("cfix.dropCheck",{check:e.check}),0===s&&(0,n.jsxs)("span",{className:"muted",children:[" ",r("cfix.minimal")]})]},s)),(0,n.jsxs)("label",{className:"option-inline",style:{display:"block"},children:[(0,n.jsx)("input",{type:"radio",name:"cfix-".concat(k,"-").concat(t),checked:-1===o[t],onChange:()=>u(e=>e.map((e,s)=>s===t?-1:e)),disabled:h}),e.fixes.length>0?r("cfix.leave"):r("cfix.noFix")]})]},t)),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("button",{className:"primary",disabled:h||o.every(e=>-1===e),onClick:()=>void v(),children:"queued"===x?r("cfix.applyQueued"):r("cfix.apply")}),m&&(0,n.jsx)("span",{className:"small",role:"status",children:m})]})]})]})}},3374:(e,t,s)=>{s.d(t,{c:()=>l});var n=s(1521);function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,[s,l]=(0,n.useState)(()=>Date.now());return(0,n.useEffect)(()=>{if(!e)return;l(Date.now());let s=window.setInterval(()=>l(Date.now()),t);return()=>window.clearInterval(s)},[e,t]),s}},4811:(e,t,s)=>{s.d(t,{p:()=>a});var n=s(1521),l=s(5549);function a(){let[e,t]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e=!0;return l.FH.settings().then(s=>{var n;let l=null!=(n=s.raw.execution)?n:{};e&&t("unattended"===l.mode)}).catch(()=>void 0),()=>{e=!1}},[]),e}},5132:(e,t,s)=>{s.d(t,{s:()=>r});var n=s(3365),l=s(1521);function a(e,t){let s,l=[],a=/(`[^`\n]+`)|(\*\*[^*\n]+\*\*)|(\*[^*\n]+\*)/g,i=0,r=0;for(;null!==(s=a.exec(e));){s.index>i&&l.push(e.slice(i,s.index));let a=s[0],c="".concat(t,"-i").concat(r+=1);a.startsWith("`")?l.push((0,n.jsx)("code",{children:a.slice(1,-1)},c)):a.startsWith("**")?l.push((0,n.jsx)("strong",{children:a.slice(2,-2)},c)):l.push((0,n.jsx)("em",{children:a.slice(1,-1)},c)),i=s.index+a.length}return i<e.length&&l.push(e.slice(i)),l}function i(e){let t=/^\s*[-*•]\s+(.*)$/.exec(e);if(t)return t[1];let s=/^\s*\d+[.)]\s+(.*)$/.exec(e);return s?s[1]:null}function r(e){let{text:t,className:s}=e,r=[],c=t.replace(/\r\n/g,"\n").split("\n"),d=0,o=0;for(;d<c.length;){let e=c[d];if(e.trim().startsWith("```")){let e=[];for(d+=1;d<c.length&&!c[d].trim().startsWith("```");)e.push(c[d++]);d+=1,e.length>0&&r.push((0,n.jsx)("pre",{children:e.join("\n")},"b".concat(o+=1)));continue}if(null!==i(e)){let e=[];for(;d<c.length&&null!==i(c[d]);)e.push(i(c[d++]));r.push((0,n.jsx)("ul",{children:e.map((e,t)=>(0,n.jsx)("li",{children:a(e,"b".concat(o,"-").concat(t))},t))},"b".concat(o+=1)));continue}if(""===e.trim()){d+=1;continue}let t=[];for(;d<c.length&&""!==c[d].trim()&&null===i(c[d])&&!c[d].trim().startsWith("```");)t.push(c[d++]);let s=o+=1;r.push((0,n.jsx)("p",{children:t.map((e,t)=>(0,n.jsxs)(l.Fragment,{children:[t>0&&(0,n.jsx)("br",{}),a(e,"b".concat(s,"-").concat(t))]},t))},"b".concat(s)))}return(0,n.jsx)("div",{className:"rich ".concat(null!=s?s:""),children:r})}},7619:(e,t,s)=>{s.d(t,{P:()=>o});var n=s(3365),l=s(1521),a=s(5549),i=s(867),r=s(7908),c=s(5132);function d(e){let{text:t,follow:s}=e,{ref:l}=(0,r.U)(s,t);return(0,n.jsx)("pre",{ref:l,className:"story-out".concat(s?" terminal":""),children:t})}function o(e){let{sessionId:t,taskId:s,runId:o,live:h}=e,{t:f}=(0,i.kj)(),[m,p]=(0,l.useState)(null),[x,g]=(0,l.useState)(""),[j,y]=(0,l.useState)(!0),[k,v]=(0,l.useState)(!0),[b,N]=(0,l.useState)(new Set),[w,S]=(0,l.useState)(new Set),[C,q]=(0,l.useState)(new Set),I=!!(null==m?void 0:m.live),F=(0,l.useRef)(0);F.current+=1;let R=(0,r.U)(I,F.current),E=(0,l.useRef)(null),L=(0,l.useRef)(!1);if((0,l.useEffect)(()=>{if(!m)return;let e=[],t=(s,n)=>s.forEach((s,l)=>{let a="".concat(n).concat(l);"review"===s.kind?t(s.entries,"".concat(a,"-")):"step"!==s.kind||s.outcome||e.push(a)});t(m.entries,"e"),e.some(e=>!w.has(e))&&S(t=>new Set([...t,...e])),m.live&&!L.current&&E.current&&(L.current=!0,E.current.scrollIntoView({block:"nearest",behavior:"smooth"}))},[m,w]),(0,l.useEffect)(()=>{let e,n=!0,l=async()=>{try{let i=await a.FH.taskStory(t,s,o);if(!n)return;p(i),g(""),(i.live||h)&&(e=setTimeout(l,2e3))}catch(t){if(!n)return;g(t.message),h&&(e=setTimeout(l,2e3))}};return l(),()=>{n=!1,e&&clearTimeout(e)}},[t,s,o,h]),x&&!m)return(0,n.jsx)("div",{className:"err small",children:x});if(!m)return(0,n.jsx)("div",{className:"muted small",children:f("story.loading")});let T=e=>b.has(e)||w.has(e)&&!C.has(e),M=e=>{let t=T(e);N(s=>{let n=new Set(s);return t?n.delete(e):n.add(e),n}),q(s=>{let n=new Set(s);return t?n.add(e):n.delete(e),n})},H=(e,t)=>{if(!("review"===e.kind?j||k:"step"===e.kind?k:j))return null;if("review"===e.kind)return(0,n.jsxs)("li",{className:"story-review",children:[(0,n.jsxs)("div",{className:"story-head",children:[(0,n.jsx)(u,{at:e.at}),(0,n.jsx)("span",{className:"chip",children:f("story.review",{n:e.round})})]}),(0,n.jsx)("ol",{className:"story",children:e.entries.map((e,s)=>H(e,"".concat(t,"-").concat(s)))})]},t);if("step"===e.kind){let s=T(t),l=!e.outcome&&m.live;return(0,n.jsxs)("li",{className:"story-step".concat(e.failed?" failed":""),children:[(0,n.jsxs)("div",{className:"story-head",children:[(0,n.jsx)(u,{at:e.at}),(0,n.jsx)("span",{className:"chip",children:f("story.step",{it:e.iteration,id:e.id})}),e.outcome&&(0,n.jsxs)("span",{className:"badge ".concat(e.failed?"failed":"done"),children:[e.outcome,void 0!==e.exitCode?" \xb7 exit ".concat(e.exitCode):"",void 0!==e.durationMs?" \xb7 ".concat((0,a.c5)(e.durationMs)):""]}),!e.outcome&&(0,n.jsx)("span",{className:"badge running",children:f("story.running")}),e.failed&&(0,n.jsx)("span",{className:"badge failed",children:f("story.failedHere")})]}),(0,n.jsx)("pre",{className:"story-cmd",children:e.command}),e.output&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"linkish small",onClick:()=>M(t),children:s?f("story.hideOutput"):f("story.showOutput",{n:e.output.length})}),s&&(0,n.jsx)(d,{text:e.output,follow:l})]})]},t)}let s=b.has(t),l="sent"===e.kind?f("story.bot"):f("story.chat"),i="reply"===e.kind&&("blocked"===e.status||"failed"===e.status);return(0,n.jsxs)("li",{className:"story-msg ".concat(e.kind).concat(i?" failed":""),children:[(0,n.jsxs)("div",{className:"story-head",children:[(0,n.jsx)(u,{at:e.at}),(0,n.jsx)("strong",{children:l}),(0,n.jsx)("span",{className:"muted small",children:e.label}),"reply"===e.kind&&e.status&&(0,n.jsx)("span",{className:"badge ".concat(i?"failed":"done"===e.status?"done":""),children:e.status})]}),"reply"===e.kind&&e.notes&&(0,n.jsx)("p",{className:"story-notes",children:e.notes}),(0,n.jsx)("button",{type:"button",className:"linkish small",onClick:()=>M(t),children:s?f("story.hideText"):f("story.showText",{n:e.text.length})}),s&&(0,n.jsx)("pre",{className:"story-out",children:e.text})]},t)},O=m.close,W=O&&"done"!==O.status;return(0,n.jsxs)("div",{className:"story-box",ref:E,children:[(0,n.jsxs)("div",{className:"row small",style:{marginBottom:6},children:[(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:j,onChange:e=>y(e.target.checked)})," ",f("story.showChat")]}),(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:k,onChange:e=>v(e.target.checked)})," ",f("story.showCommands")]}),m.live&&(0,n.jsxs)("span",{className:"live",children:[(0,n.jsx)("span",{className:"dot","aria-hidden":"true"})," ",f("story.live")]}),m.live&&!R.following&&(0,n.jsx)("button",{type:"button",className:"quiet small",onClick:R.follow,title:f("story.followWhy"),children:f("story.follow")}),x&&(0,n.jsx)("span",{className:"err",children:x})]}),(0,n.jsxs)("div",{className:"story-fixed",children:[(0,n.jsx)("strong",{children:f("story.prompt")}),(0,n.jsx)("pre",{className:"story-out always",children:m.prompt})]}),(0,n.jsx)("div",{ref:R.ref,className:"story-scroll".concat(m.live?" live":""),children:(0,n.jsx)("ol",{className:"story",children:m.entries.map((e,t)=>H(e,"e".concat(t)))})}),O?(0,n.jsxs)("div",{className:"story-fixed close".concat(W?" failed":""),children:[(0,n.jsx)("strong",{children:W?f("story.endedBadly",{status:O.status}):f("story.ended")}),O.reason&&(0,n.jsx)("p",{className:"err small",children:O.reason}),O.summary&&(0,n.jsx)(c.s,{text:O.summary,className:"what"}),O.checks&&O.checks.length>0&&(0,n.jsx)("ul",{className:"small",style:{margin:"6px 0 0",paddingLeft:18},children:O.checks.map((e,t)=>(0,n.jsxs)("li",{className:e.passed?"":"err",children:[e.passed?"✓":"✗"," ",e.name,!e.passed&&e.detail?" — ".concat(e.detail):""]},t))})]}):(0,n.jsx)("div",{className:"story-fixed muted small",children:f("story.notEnded")})]})}function u(e){let{at:t}=e,s=(0,i.W3)(),{locale:l}=(0,i.kj)();if(!t)return null;let a=new Date(t),r="bg"===l?"bg-BG":void 0,c=a.toLocaleTimeString(r,{hour12:!1}),d=new Date().toDateString()===a.toDateString();return(0,n.jsx)("time",{className:"story-when",dateTime:t,title:s(t),children:d?c:"".concat(a.toLocaleDateString(r)," ").concat(c)})}},7908:(e,t,s)=>{s.d(t,{U:()=>l});var n=s(1521);function l(e,t){let[s,l]=(0,n.useState)(null),a=(0,n.useRef)(!0),[i,r]=(0,n.useState)(!0),c=(0,n.useCallback)(e=>l(e),[]);return(0,n.useLayoutEffect)(()=>{if(!s)return;let e=()=>{let e=s.scrollHeight-s.scrollTop-s.clientHeight<=24;a.current=e,r(e)};return s.addEventListener("scroll",e,{passive:!0}),()=>s.removeEventListener("scroll",e)},[s]),(0,n.useLayoutEffect)(()=>{s&&e&&a.current&&(s.scrollTop=s.scrollHeight)},[s,e,t]),{ref:c,following:i,follow:(0,n.useCallback)(()=>{a.current=!0,r(!0),s&&(s.scrollTop=s.scrollHeight)},[s])}}},8934:(e,t,s)=>{s.d(t,{C:()=>d});var n=s(3365),l=s(1521),a=s(5549),i=s(4969),r=s(867);function c(e){if(null===e||""===e)return[];let t=e.split(/\r?\n/);return""===t[t.length-1]&&t.pop(),t}function d(e){let{sessionId:t,taskId:s,runId:a,title:i,files:c}=e,{t:d}=(0,r.kj)(),[u,h]=(0,l.useState)(!1);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"linkish",onClick:()=>h(!0),title:d("diff.openWhy"),children:d("diff.open",{n:c})}),u&&(0,n.jsx)(o,{sessionId:t,taskId:s,runId:a,title:i,onClose:()=>h(!1)})]})}function o(e){var t,s,d,o,h,f,m;let{sessionId:p,taskId:x,runId:g,title:j,onClose:y}=e,{t:k}=(0,r.kj)(),[v,b]=(0,l.useState)(null),[N,w]=(0,l.useState)(""),[S,C]=(0,l.useState)(0),[q,I]=(0,l.useState)(new Map),[F,R]=(0,l.useState)(!1),[E,L]=(0,l.useState)(!0),[T,M]=(0,l.useState)(new Map),[H,O]=(0,l.useState)(-1),W=(0,l.useRef)(null),D=(0,l.useRef)(null),G=(0,l.useRef)(null);(0,i.V)(D,!0,G),(0,l.useEffect)(()=>{a.FH.taskChanges(p,x,g).then(b).catch(e=>w(e.message))},[p,x,g]);let Q=null!=(d=null==v?void 0:v.files)?d:[],P=Q[S];(0,l.useEffect)(()=>{!P||q.has(P.path)||a.FH.taskChangeFile(p,x,P.path,g).then(e=>I(t=>new Map(t).set(P.path,e))).catch(e=>I(t=>new Map(t).set(P.path,e.message)))},[P,q,p,x,g]);let A=P?q.get(P.path):void 0,B=(0,l.useMemo)(()=>!A||"string"==typeof A||A.binary||A.tooLarge?[]:function(e,t){let s=function(e,t){let s=0;for(;s<e.length&&s<t.length&&e[s]===t[s];)s+=1;let n=e.length,l=t.length;for(;n>s&&l>s&&e[n-1]===t[l-1];)n-=1,l-=1;let a=[];for(let e=0;e<s;e+=1)a.push({kind:"same",a:e,b:e});for(let i of function(e,t){let s=e.length,n=t.length;if(0===s)return t.map((e,t)=>({kind:"add",b:t}));if(0===n)return e.map((e,t)=>({kind:"del",a:t}));let l=s+n,a=l+1,i=new Int32Array(2*l+3),r=[];for(let c=0;c<=Math.min(l,2e3);c+=1){r.push(i.slice(a-c-1,a+c+2));for(let l=-c;l<=c;l+=2){let d=l===-c||l!==c&&i[a+l-1]<i[a+l+1]?i[a+l+1]:i[a+l-1]+1,o=d-l;for(;d<s&&o<n&&e[d]===t[o];)d+=1,o+=1;if(i[a+l]=d,d>=s&&o>=n)return function(e,t,s,n){let l=[],a=t.length,i=s.length;for(let t=n;t>0;t-=1){let s=e[t],n=e=>s[e+t+1],r=a-i,c=r===-t||r!==t&&n(r-1)<n(r+1)?r+1:r-1,d=n(c),o=d-c;for(;a>d&&i>o;)a-=1,i-=1,l.push({kind:"same",a:a,b:i});a===d?l.push({kind:"add",b:o}):l.push({kind:"del",a:d}),a=d,i=o}for(;a>0&&i>0;)a-=1,i-=1,l.push({kind:"same",a:a,b:i});return l.reverse()}(r,e,t,c)}}return[...e.map((e,t)=>({kind:"del",a:t})),...t.map((e,t)=>({kind:"add",b:t}))]}(e.slice(s,n),t.slice(s,l)))a.push({kind:i.kind,...void 0!==i.a?{a:i.a+s}:{},...void 0!==i.b?{b:i.b+s}:{}});for(let t=0;n+t<e.length;t+=1)a.push({kind:"same",a:n+t,b:l+t});return a}(e,t),n=[];for(let l=0;l<s.length;){let a=s[l];if("same"===a.kind){n.push({kind:"same",left:{no:a.a+1,text:e[a.a]},right:{no:a.b+1,text:t[a.b]}}),l+=1;continue}let i=[],r=[];for(;l<s.length&&"same"!==s[l].kind;){let e=s[l];"del"===e.kind?i.push(e.a):r.push(e.b),l+=1}let c=Math.max(i.length,r.length);for(let s=0;s<c;s+=1){let l=i[s],a=r[s];n.push({kind:void 0!==l&&void 0!==a?"change":void 0!==l?"del":"add",...void 0!==l?{left:{no:l+1,text:e[l]}}:{},...void 0!==a?{right:{no:a+1,text:t[a]}}:{}})}}return n}(c(A.before),c(A.after)),[A]),V=P&&T.get(P.path)||new Set,_=(0,l.useMemo)(()=>(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(n)return e.map((e,t)=>({type:"row",row:e,index:t}));let l=[];for(let n=0;n<e.length;){if("same"!==e[n].kind){l.push({type:"row",row:e[n],index:n}),n+=1;continue}let a=n;for(;a<e.length&&"same"===e[a].kind;)a+=1;let i=0===n?0:t,r=a===e.length?0:t,c=a-n-i-r;if(c>1&&!s.has(n+i)){for(let t=n;t<n+i;t+=1)l.push({type:"row",row:e[t],index:t});l.push({type:"gap",from:n+i,count:c});for(let t=a-r;t<a;t+=1)l.push({type:"row",row:e[t],index:t})}else for(let t=n;t<a;t+=1)l.push({type:"row",row:e[t],index:t});n=a}return l})(B,3,V,F),[B,V,F]),K=(0,l.useMemo)(()=>B.flatMap((e,t)=>"same"!==e.kind&&(0===t||"same"===B[t-1].kind)?[t]:[]),[B]);(0,l.useEffect)(()=>{O(-1),W.current&&(W.current.scrollTop=0)},[S]);let U=(0,l.useCallback)(e=>{var t;if(0===K.length)return;let s=H<0?1===e?0:K.length-1:Math.min(K.length-1,Math.max(0,H+e));O(s);let n=null==(t=W.current)?void 0:t.querySelector('[data-row="'.concat(K[s],'"]'));null==n||n.scrollIntoView({block:"center"})},[H,K]),$=(0,l.useCallback)(e=>C(t=>Math.min(Math.max(0,t+e),Math.max(0,Q.length-1))),[Q.length]);(0,l.useEffect)(()=>{let e=e=>{if(!e.ctrlKey&&!e.metaKey&&!e.altKey){if("Escape"===e.key)y();else if("n"===e.key)U(1);else if("p"===e.key)U(-1);else if("]"===e.key)$(1);else{if("["!==e.key)return;$(-1)}e.preventDefault()}};window.addEventListener("keydown",e);let t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",e),document.body.style.overflow=t}},[U,$,y]);let z=Q.reduce((e,t)=>({added:e.added+Math.max(0,t.added),removed:e.removed+Math.max(0,t.removed)}),{added:0,removed:0});return(0,n.jsxs)("div",{ref:D,className:"diff-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"diff-title",children:[(0,n.jsxs)("div",{className:"diff-head",children:[(0,n.jsx)("h2",{id:"diff-title",children:k("diff.title",{title:j})}),(null==v?void 0:v.ok)&&(0,n.jsxs)("span",{className:"muted small",children:[v.branch?"".concat(v.branch," \xb7 "):"",null==(t=v.base)?void 0:t.slice(0,8)," → ",null==(s=v.commit)?void 0:s.slice(0,8)," \xb7 ",k("diff.summary",{n:Q.length,a:z.added,r:z.removed})]}),(0,n.jsx)("span",{className:"grow"}),(0,n.jsx)("span",{className:"muted small",children:k("diff.keys")}),(0,n.jsx)("button",{ref:G,type:"button",onClick:y,children:k("diff.close")})]}),N&&(0,n.jsx)("div",{className:"err",style:{padding:12},children:N}),!v&&!N&&(0,n.jsx)("div",{className:"muted",style:{padding:12},children:k("diff.loading")}),v&&!v.ok&&(0,n.jsx)("div",{className:"notice caution",style:{margin:12},children:v.problem}),(null==v?void 0:v.ok)&&0===Q.length&&(0,n.jsx)("div",{className:"notice",style:{margin:12},children:k("diff.nothing")}),(null==v?void 0:v.ok)&&Q.length>0&&(0,n.jsxs)("div",{className:"diff-body",children:[(0,n.jsx)("nav",{className:"diff-files","aria-label":k("diff.files"),children:Q.map((e,t)=>{let s=e.path.lastIndexOf("/");return(0,n.jsxs)("button",{type:"button",className:"diff-file".concat(t===S?" on":""),onClick:()=>C(t),title:e.oldPath?"".concat(e.oldPath," → ").concat(e.path):e.path,children:[(0,n.jsx)("span",{className:"diff-status s-".concat(e.status),children:e.status}),(0,n.jsxs)("span",{className:"diff-path",children:[s>=0&&(0,n.jsx)("span",{className:"muted",children:e.path.slice(0,s+1)}),(0,n.jsx)("strong",{children:e.path.slice(s+1)})]}),(0,n.jsx)("span",{className:"diff-counts",children:e.added<0?k("diff.binaryShort"):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("span",{className:"plus",children:["+",e.added]})," ",(0,n.jsxs)("span",{className:"minus",children:["−",e.removed]})]})})]},e.path)})}),(0,n.jsxs)("div",{className:"diff-main",children:[P&&(0,n.jsxs)("div",{className:"diff-toolbar",children:[(0,n.jsx)("strong",{className:"diff-name",children:P.oldPath?"".concat(P.oldPath," → ").concat(P.path):P.path}),(0,n.jsx)("span",{className:"muted small",children:"A"===P.status?k("diff.added"):"D"===P.status?k("diff.deleted"):"R"===P.status?k("diff.renamed"):""}),(0,n.jsx)("span",{className:"grow"}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>U(-1),disabled:0===K.length,children:k("diff.prevChange")}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>U(1),disabled:0===K.length,children:k("diff.nextChange")}),(0,n.jsx)("span",{className:"muted small",children:K.length>0?k("diff.changeN",{i:H<0?"–":H+1,n:K.length}):""}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>$(-1),disabled:0===S,children:k("diff.prevFile")}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>$(1),disabled:S>=Q.length-1,children:k("diff.nextFile")}),(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:F,onChange:e=>R(e.target.checked)})," ",k("diff.whole")]}),(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:E,onChange:e=>L(e.target.checked)})," ",k("diff.wrap")]})]}),(0,n.jsxs)("div",{className:"diff-scroll",ref:W,children:[void 0===A&&(0,n.jsx)("div",{className:"muted",style:{padding:12},children:k("diff.loading")}),"string"==typeof A&&(0,n.jsx)("div",{className:"err",style:{padding:12},children:A}),A&&"string"!=typeof A&&A.binary&&(0,n.jsx)("div",{className:"notice",style:{margin:12},children:k("diff.binary")}),A&&"string"!=typeof A&&A.tooLarge&&(0,n.jsx)("div",{className:"notice",style:{margin:12},children:k("diff.tooLarge")}),A&&"string"!=typeof A&&!A.binary&&!A.tooLarge&&(0,n.jsxs)(n.Fragment,{children:[(null!=(o=A.before)?o:"").includes("\r\n")!==(null!=(h=A.after)?h:"").includes("\r\n")&&null!==A.before&&null!==A.after&&(0,n.jsx)("div",{className:"notice small",style:{margin:8},children:k("diff.eol",{from:(null!=(f=A.before)?f:"").includes("\r\n")?"CRLF":"LF",to:(null!=(m=A.after)?m:"").includes("\r\n")?"CRLF":"LF"})}),B.length>0&&0===K.length&&(0,n.jsx)("div",{className:"notice small",style:{margin:8},children:k("diff.sameText")}),(0,n.jsxs)("table",{className:"diff-table".concat(E?"":" nowrap"),children:[(0,n.jsxs)("colgroup",{children:[(0,n.jsx)("col",{className:"num"}),(0,n.jsx)("col",{}),(0,n.jsx)("col",{className:"num"}),(0,n.jsx)("col",{})]}),(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{colSpan:2,children:k("diff.before")}),(0,n.jsx)("th",{colSpan:2,children:k("diff.after")})]})}),(0,n.jsx)("tbody",{children:_.map(e=>"gap"===e.type?(0,n.jsx)("tr",{className:"diff-gap",children:(0,n.jsx)("td",{colSpan:4,children:(0,n.jsx)("button",{type:"button",className:"linkish small",onClick:()=>{var t;return t=e.from,void(P&&M(e=>{var s;return new Map(e).set(P.path,new Set([...null!=(s=e.get(P.path))?s:[],t]))}))},children:k("diff.gap",{n:e.count})})})},"g".concat(e.from)):(0,n.jsx)(u,{row:e.row,index:e.index,current:H>=0&&K[H]===e.index},e.index))})]})]})]})]})]})]})}function u(e){var t,s,a,i;let{row:r,index:c,current:d}=e,o="change"===r.kind?function(e,t){let s=0;for(;s<e.length&&s<t.length&&e[s]===t[s];)s+=1;let n=e.length,l=t.length;for(;n>s&&l>s&&e[n-1]===t[l-1];)n-=1,l-=1;return{start:s,leftEnd:n,rightEnd:l}}(r.left.text,r.right.text):null,u=e=>{let t=r[e];if(!t)return null;if(!o)return t.text;let s="left"===e?o.leftEnd:o.rightEnd;return(0,n.jsxs)(l.Fragment,{children:[t.text.slice(0,o.start),(0,n.jsx)("mark",{children:t.text.slice(o.start,s)}),t.text.slice(s)]})};return(0,n.jsxs)("tr",{className:"diff-row ".concat(r.kind).concat(d?" current":""),"data-row":c,children:[(0,n.jsx)("td",{className:"num",children:null!=(a=null==(t=r.left)?void 0:t.no)?a:""}),(0,n.jsx)("td",{className:"code l".concat(r.left?"":" empty"),children:u("left")}),(0,n.jsx)("td",{className:"num",children:null!=(i=null==(s=r.right)?void 0:s.no)?i:""}),(0,n.jsx)("td",{className:"code r".concat(r.right?"":" empty"),children:u("right")})]})}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[810],{3256:(e,s,t)=>{Promise.resolve().then(t.bind(t,4627))},4627:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>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(7619),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:"/sessions#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,897,699,347,131,358],()=>e(e.s=3256)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[177],{952:()=>{},966:(e,s,a)=>{"use strict";a.d(s,{Shell:()=>f});var r=a(3365),n=a(8197),t=a.n(n),l=a(1702),i=a(8214),o=a(1521),c=a(5549),d=a(867),h=a(1035),p=a(7527),m=a(9717);function u(){let{t:e}=(0,d.kj)(),s=(0,l.usePathname)(),[a,n]=(0,o.useState)([]),[t,i]=(0,o.useState)({}),h=(0,o.useRef)({}),m=(0,o.useRef)(new Set),u=(0,o.useRef)(""),x=(0,o.useCallback)(async()=>{try{let e=await c.FH.approvals();n(e);let s=[...new Set(e.map(e=>e.sessionId).filter(e=>!(e in h.current)))],a=s.sort().join(",");if(s.length>0&&a!==u.current){for(let e of(u.current=a,await c.FH.sessions().catch(()=>[])))h.current[e.id]=e.name,"chat"===e.kind&&m.current.add(e.id);i({...h.current})}}catch(e){}},[]);(0,p.z)(x,2e3),(0,o.useEffect)(()=>{let s="copilot-operator";document.title=a.length>0?"(".concat(a.length,") ").concat(e("approval.tabTitle")," — ").concat(s):s},[a.length,e]);let j="/"===s?a.filter(e=>e.sessionId in h.current&&(!m.current.has(e.sessionId)||!!e.model||!!e.plan)):a;return 0===j.length?null:(0,r.jsxs)("section",{className:"approval-banner",role:"alert","aria-live":"assertive",children:[(0,r.jsx)("h2",{children:e("approval.waitingHere")}),(0,r.jsx)("p",{className:"small",children:e("approval.waitingHereWhy")}),j.map(e=>{var s;return(0,r.jsx)(v,{approval:e,sessionName:null!=(s=t[e.sessionId])?s:e.sessionId,onDecided:()=>void x()},e.id)})]})}function v(e){let{approval:s,sessionName:a,onDecided:n}=e,{t:l}=(0,d.kj)(),i=(0,d.W3)(),[p,m]=(0,o.useState)(!1),[u,v]=(0,o.useState)(""),j=(0,o.useRef)(!1),f=async e=>{if(!j.current&&("run-all"!==e||await (0,h.Z)(l("approval.runAllConfirm")))){j.current=!0,m(!0),v("");try{await c.FH.decide(s.id,e)}catch(e){v(e.message)}finally{j.current=!1,m(!1),n()}}};if(s.plan)return(0,r.jsx)(x,{approval:s,sessionName:a,onDecided:n});if(s.model){var k;let e=s.model;return(0,r.jsxs)("div",{className:"approval",children:[(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("strong",{children:l(e.manual?"approval.manualTitle":"approval.modelTitle")}),(0,r.jsx)(t(),{href:(0,c.aT)(s.sessionId),children:a}),(0,r.jsx)("span",{className:"muted small",children:i(s.createdAt)})]}),(0,r.jsx)("p",{children:e.manual?e.asked?l("approval.manualAsk",{model:e.asked}):l("approval.manualAskAny"):l("approval.modelAsk",{model:e.asked})}),(0,r.jsx)("p",{className:"muted small",children:l("approval.modelShown",{shown:null!=(k=e.shown)?k:"—"})}),!e.manual&&(0,r.jsx)("p",{className:"reason small",children:l("approval.modelWhy",{why:e.why,tries:e.tries})}),u&&(0,r.jsx)("p",{className:"err",role:"alert",children:u}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("button",{className:"primary",disabled:p,onClick:()=>void f("run"),children:l(e.manual?"approval.manualReady":"approval.modelChosen")}),(0,r.jsx)("button",{disabled:p,onClick:()=>void f("skip"),children:l("approval.modelAsItIs")}),(0,r.jsx)("button",{className:"danger",disabled:p,onClick:()=>void f("abort"),children:l("approval.modelStop")})]})]})}return(0,r.jsxs)("div",{className:"approval",children:[(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("strong",{children:l("approval.title",{n:s.stepId})}),(0,r.jsx)(t(),{href:(0,c.aT)(s.sessionId),children:a}),(0,r.jsx)("span",{className:"muted small",children:i(s.createdAt)})]}),(0,r.jsx)("pre",{style:{margin:"8px 0"},children:s.description}),s.network&&(0,r.jsx)("p",{className:"reason small",children:l("approval.network")}),u&&(0,r.jsx)("p",{className:"err",role:"alert",children:u}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("button",{className:"primary",disabled:p,onClick:()=>void f("run"),children:l("approval.run")}),!s.network&&(0,r.jsx)("button",{disabled:p,onClick:()=>void f("run-all"),title:l("approval.runAllWhy"),children:l("approval.runAll")}),(0,r.jsx)("button",{disabled:p,onClick:()=>void f("skip"),children:l("approval.skip")}),(0,r.jsx)("button",{className:"danger",disabled:p,onClick:()=>void f("abort"),children:l("approval.abort")})]})]})}function x(e){let{approval:s,sessionName:a,onDecided:n}=e,{t:l}=(0,d.kj)(),i=(0,d.W3)(),[p,u]=(0,o.useState)(""),[v,x]=(0,o.useState)(!1),[j,f]=(0,o.useState)(""),k=(0,o.useRef)(!1),w=s.plan,b=async e=>{if(!k.current){if("revise"===e&&!p.trim())return void f(l("pm.reviseNeedsNote"));if("stop"!==e||await (0,h.Z)(l("pm.stopConfirm"))){k.current=!0,x(!0),f("");try{await c.FH.decidePlan(s.id,e,p)}catch(e){f(e.message)}finally{k.current=!1,x(!1),n()}}}};return(0,r.jsxs)("div",{className:"approval",children:[(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("strong",{children:l("pm.cardTitle",{title:w.title})}),(0,r.jsx)(t(),{href:(0,c.aT)(s.sessionId),children:a}),(0,r.jsx)("span",{className:"muted small",children:i(s.createdAt)})]}),(0,r.jsx)("p",{className:"small",children:l("pm.cardWhy")}),(0,r.jsx)(m.D,{plan:w.plan,showApproval:!1}),(0,r.jsx)("label",{htmlFor:"plan-note-".concat(s.id),children:l("pm.note")}),(0,r.jsx)("textarea",{id:"plan-note-".concat(s.id),className:"prose",value:p,onChange:e=>u(e.target.value),placeholder:l("pm.notePlaceholder"),style:{minHeight:70},disabled:v}),j&&(0,r.jsx)("p",{className:"err",role:"alert",children:j}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("button",{className:"primary",disabled:v,onClick:()=>void b("approve"),children:l("pm.approve")}),(0,r.jsx)("button",{disabled:v,onClick:()=>void b("revise"),title:l("pm.reviseWhy"),children:l("pm.revise")}),(0,r.jsx)("button",{className:"danger",disabled:v,onClick:()=>void b("stop"),children:l("pm.stop")})]})]})}var j=a(3069);function f(e){let{children:s}=e;return"/"===(0,l.usePathname)()?(0,r.jsxs)("div",{className:"wb-root",children:[(0,r.jsx)(u,{}),(0,r.jsx)(j.$,{}),(0,r.jsx)("main",{id:"main",className:"wb-main",children:s})]}):(0,r.jsxs)("div",{className:"wrap",children:[(0,r.jsxs)("header",{className:"top",children:[(0,r.jsx)("h1",{children:(0,r.jsx)(t(),{href:"/",children:"copilot-operator"})}),(0,r.jsx)(i.s,{})]}),(0,r.jsx)(u,{}),(0,r.jsx)(j.$,{}),(0,r.jsx)("main",{id:"main",children:s})]})}},1702:(e,s,a)=>{"use strict";var r=a(9962);a.o(r,"usePathname")&&a.d(s,{usePathname:function(){return r.usePathname}}),a.o(r,"useRouter")&&a.d(s,{useRouter:function(){return r.useRouter}}),a.o(r,"useSearchParams")&&a.d(s,{useSearchParams:function(){return r.useSearchParams}})},7712:(e,s,a)=>{"use strict";a.d(s,{ScrollJump:()=>l});var r=a(3365),n=a(1521),t=a(867);function l(){let{t:e}=(0,t.kj)(),[s,a]=(0,n.useState)({long:!1,atTop:!0,atBottom:!1});return((0,n.useEffect)(()=>{let e=()=>{let e=document.documentElement;a({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 s=new ResizeObserver(e);return s.observe(document.body),()=>{window.removeEventListener("scroll",e),window.removeEventListener("resize",e),s.disconnect()}},[]),s.long)?(0,r.jsxs)("div",{className:"scroll-jump",children:[!s.atTop&&(0,r.jsx)("button",{type:"button","aria-label":e("scroll.top"),title:e("scroll.top"),onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),children:"↑"}),!s.atBottom&&(0,r.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,s,a)=>{"use strict";a.d(s,{AppearanceProvider:()=>d,KP:()=>h});var r=a(3365),n=a(1521);let t="cop.appearance",l=["small","normal","large","huge","giant"];"\n(function () {\n try {\n var d = document.documentElement;\n var raw = localStorage.getItem('".concat(t,"');\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 i={theme:"light",textSize:"normal",highContrast:!1,reduceMotion:!1,underlineLinks:!1,strongFocus:!1};function o(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 c=(0,n.createContext)({appearance:i,set:()=>void 0,reset:()=>void 0,loaded:!1});function d(e){let{children:s}=e,[a,d]=(0,n.useState)(i),[h,p]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let e=i;try{let s=window.localStorage.getItem(t);s?e=function(e){let s=e&&"object"==typeof e?e:{},a=(e,s)=>"boolean"==typeof e?e:s;return{theme:"dark"===s.theme?"dark":"light"===s.theme?"light":i.theme,textSize:l.includes(s.textSize)?s.textSize:i.textSize,highContrast:a(s.highContrast,i.highContrast),reduceMotion:a(s.reduceMotion,i.reduceMotion),underlineLinks:a(s.underlineLinks,i.underlineLinks),strongFocus:a(s.strongFocus,i.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){}d(e),o(e),p(!0)},[]);let m=(0,n.useCallback)(e=>{d(s=>{let a={...s,...e};o(a);try{window.localStorage.setItem(t,JSON.stringify(a))}catch(e){}return a})},[]),u=(0,n.useCallback)(()=>{d(i),o(i);try{window.localStorage.removeItem(t)}catch(e){}},[]);return(0,r.jsx)(c.Provider,{value:{appearance:a,set:m,reset:u,loaded:h},children:s})}function h(){return(0,n.useContext)(c)}},8214:(e,s,a)=>{"use strict";a.d(s,{SkipLink:()=>m,s:()=>u});var r=a(3365),n=a(1521),t=a(8197),l=a.n(t),i=a(1702),o=a(5549),c=a(7527),d=a(867);let h={sessions:(0,r.jsx)("path",{d:"M4 5h16v4H4zM4 11h16v4H4zM4 17h10v2H4z"}),workbench:(0,r.jsx)("path",{d:"M3 4h18v16H3zM9 4v16M3 15h6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),defaults:(0,r.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,r.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,r.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,r.jsx)("path",{d:"M6 3h9l5 5v13H6zM14 3v6h6M9 13h7M9 17h7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),presets:(0,r.jsx)("path",{d:"M5 4h14v4H5zM5 10h14v4H5zM5 16h9v4H5z",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),appearance:(0,r.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,r.jsx)("path",{d:"M4 5h16v10H4zM2 19h20M9 15v4M15 15v4",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"})},p=[{href:"/",label:"nav.workbench",icon:"workbench"},{href:"/sessions",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,r.jsx)("a",{className:"skip-link",href:"#main",children:e("a11y.skip")})}function u(){let{t:e}=(0,d.kj)(),s=(0,i.usePathname)(),a=function(){let[e,s]=(0,n.useState)(0);return(0,c.z)(()=>o.FH.activity().then(e=>s(e.sessions)).catch(()=>void 0),4e3),e}();return(0,r.jsxs)("nav",{"aria-label":e("nav.label"),children:[p.map(n=>(0,r.jsxs)(l(),{href:n.href,"aria-current":s===n.href?"page":void 0,children:[(0,r.jsx)("svg",{className:"nav-icon",viewBox:"0 0 24 24",width:"16",height:"16",fill:"currentColor","aria-hidden":"true",children:h[n.icon]}),(0,r.jsx)("span",{children:e(n.label)}),"/history"===n.href&&a>0&&(0,r.jsxs)("span",{className:"live",title:e("nav.liveTitle",{n:a}),children:[(0,r.jsx)("span",{className:"dot","aria-hidden":"true"}),e("nav.live")]})]},n.href)),(0,r.jsx)(d.c5,{})]})}},8761:(e,s,a)=>{Promise.resolve().then(a.bind(a,1035)),Promise.resolve().then(a.t.bind(a,952,23)),Promise.resolve().then(a.bind(a,8214)),Promise.resolve().then(a.bind(a,7712)),Promise.resolve().then(a.bind(a,966)),Promise.resolve().then(a.bind(a,1701)),Promise.resolve().then(a.bind(a,8078)),Promise.resolve().then(a.bind(a,867))},9717:(e,s,a)=>{"use strict";a.d(s,{D:()=>t});var r=a(3365),n=a(867);function t(e){var s,a;let{plan:t,showApproval:l=!0}=e,{t:i}=(0,n.kj)(),o=(0,n.W3)(),c=t.approved;return(0,r.jsxs)("div",{className:"plan-view",children:[(0,r.jsx)("p",{className:"small muted",children:i("pm.version",{n:t.version,at:o(t.at)})}),l&&c&&(0,r.jsxs)("p",{className:"small",children:["operator"===c.by?i("pm.approvedByOperator",{at:o(c.at)}):i("pm.approvedAuto",{at:o(c.at)}),c.why&&" ".concat(c.why),c.note&&" ".concat(i("pm.approvedNote",{note:c.note}))]}),(0,r.jsx)("h4",{children:i("pm.existing")}),(0,r.jsx)("p",{className:"pre-wrap",children:t.existing}),(0,r.jsx)("h4",{children:i("pm.approach")}),(0,r.jsx)("p",{className:"pre-wrap",children:t.approach}),(0,r.jsx)("h4",{children:i("pm.steps")}),(0,r.jsx)("ol",{children:t.steps.map((e,s)=>(0,r.jsx)("li",{className:"pre-wrap",children:e},s))}),t.files.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("h4",{children:i("pm.files")}),(0,r.jsx)("ul",{children:t.files.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)("code",{children:e})},e))})]}),(0,r.jsx)("h4",{children:i("pm.verification")}),(0,r.jsx)("p",{className:"pre-wrap",children:t.verification}),t.risks&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("h4",{children:i("pm.risks")}),(0,r.jsx)("p",{className:"pre-wrap",children:t.risks})]}),(null!=(a=null==(s=t.revisions)?void 0:s.length)?a:0)>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("h4",{children:i("pm.revisions")}),(0,r.jsx)("ul",{children:t.revisions.map(e=>(0,r.jsxs)("li",{className:"small",children:[i("pm.revision",{n:e.version,at:o(e.at)})," ",(0,r.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=8761)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{1702:(e,s,t)=>{"use strict";var a=t(9962);t.o(a,"usePathname")&&t.d(s,{usePathname:function(){return a.usePathname}}),t.o(a,"useRouter")&&t.d(s,{useRouter:function(){return a.useRouter}}),t.o(a,"useSearchParams")&&t.d(s,{useSearchParams:function(){return a.useSearchParams}})},4784:(e,s,t)=>{"use strict";t.d(s,{Yb:()=>r,u:()=>c});var a=t(3365),n=t(1521),l=t(5549),i=t(867);let c="::by-hand::";function r(e){var s,t,r;let{id:d,chosen:o,onChange:u,none:h,byHand:m,catalogue:b,disabled:p=!1,style:w}=e,{t:x}=(0,i.kj)(),j=function(e){let[s,t]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(void 0!==e)return;let s=!0;return l.FH.models().then(e=>{s&&t(e)}).catch(()=>void 0),()=>{s=!1}},[e]),void 0!==e?e:s}(b),v=null!=(s=null==j?void 0:j.options)?s:[],k=e=>e.toLowerCase().replace(/[-‐‑‒–—_]+/g," ").replace(/\s+/g," ").trim(),f=o&&o!==c?v.find(e=>k(e.name)===k(o)):void 0,N=null!=(t=null==f?void 0:f.name)?t:o,g=!!f||o===c&&void 0!==m,y=v.filter(e=>!e.group),C=new Map;for(let e of v)e.group&&C.set(e.group,[...null!=(r=C.get(e.group))?r:[],e]);return(0,a.jsxs)("select",{id:d,value:N,onChange:e=>u(e.target.value),disabled:p,style:{width:"auto",minWidth:280,...w},children:[void 0!==m&&(0,a.jsx)("option",{value:c,children:m}),void 0!==h&&(0,a.jsx)("option",{value:"",children:h}),o&&!g&&(0,a.jsx)("option",{value:o,children:x("model.notInList",{name:o})}),y.map(e=>(0,a.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(x("model.unavailable")):""]},e.name)),[...C.entries()].map(e=>{let[s,t]=e;return(0,a.jsx)("optgroup",{label:s,children:t.map(e=>(0,a.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(x("model.unavailable")):""]},e.name))},s)})]})}},4846:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>el});var a=t(3365),n=t(1521),l=t(8197),i=t.n(l),c=t(5549),r=t(7527),d=t(867);function o(e){let{view:s,sessions:t,selected:n,onOpen:l,onChange:i,workspace:c,onOpenFolder:r}=e;return"files"===s?(0,a.jsx)(b,{workspace:c,onOpen:l,onOpenFolder:r}):"commits"===s?(0,a.jsx)(p,{sessions:t,selected:n,onOpen:l}):(0,a.jsx)(h,{sessions:t?t.filter(e=>"chat"!==e.kind):null,selected:n,onOpen:l,onChange:i})}function u(e){let{title:s,children:t}=e;return(0,a.jsxs)("div",{className:"wb-side-head",children:[(0,a.jsx)("h2",{children:s}),(0,a.jsx)("span",{className:"grow"}),t]})}function h(e){let{sessions:s,selected:t,onOpen:l,onChange:c}=e,{t:r}=(0,d.kj)(),[o,h]=(0,n.useState)(new Set),[m,b]=(0,n.useState)(""),p=m.trim().toLowerCase();return(0,a.jsxs)("div",{className:"wb-tree",children:[(0,a.jsxs)(u,{title:r("wb.sessions"),children:[(0,a.jsx)(i(),{className:"wb-icon-btn",href:"/sessions#new-session",title:r("wb.newSession"),"aria-label":r("wb.newSession"),children:"+"}),(0,a.jsx)(i(),{className:"wb-icon-btn",href:"/import",title:r("wb.startPlan"),"aria-label":r("wb.startPlan"),children:"⇩"}),(0,a.jsx)("button",{type:"button",className:"wb-icon-btn",onClick:c,title:r("wb.refresh"),"aria-label":r("wb.refresh"),children:"↻"})]}),(0,a.jsx)("div",{className:"wb-filter",children:(0,a.jsx)("input",{type:"search","aria-label":r("wb.filter"),placeholder:r("wb.filter"),value:m,onChange:e=>b(e.target.value)})}),s?0===s.length?(0,a.jsxs)("p",{className:"muted small wb-pad",children:[r("wb.noSessions")," ",(0,a.jsx)(i(),{href:"/import",children:r("wb.startPlan")})]}):(0,a.jsx)("ul",{className:"wb-tree-list",role:"tree","aria-label":r("wb.sessions"),children:s.map(e=>{let s=e.tasks.filter(s=>!p||s.title.toLowerCase().includes(p)||e.name.toLowerCase().includes(p));if(p&&0===s.length)return null;let n=!o.has(e.id)||!!p,i=e.tasks.filter(e=>"done"===e.status).length;return(0,a.jsxs)("li",{role:"treeitem","aria-expanded":n,"aria-selected":t.sessionId===e.id&&!t.taskId,children:[(0,a.jsxs)("div",{className:"wb-row session".concat(t.sessionId!==e.id||t.taskId?"":" sel"),children:[(0,a.jsx)("button",{type:"button",className:"wb-chev","aria-label":n?r("wb.collapse",{name:e.name}):r("wb.expand",{name:e.name}),onClick:()=>h(s=>{let t=new Set(s);return t.has(e.id)?t.delete(e.id):t.add(e.id),t}),children:n?"▾":"▸"}),(0,a.jsxs)("button",{type:"button",className:"wb-row-main",onClick:()=>l({kind:"session",sessionId:e.id}),children:[(0,a.jsx)("span",{className:"wb-row-name",children:e.name}),e.running&&(0,a.jsx)("span",{className:"wb-live",title:r("wb.running"),"aria-label":r("wb.running")}),(0,a.jsxs)("span",{className:"wb-count",children:[i,"/",e.tasks.length]})]})]}),n&&(0,a.jsx)("ul",{role:"group",children:s.map(s=>{var n;let i=e.tasks.indexOf(s)+1,c=t.taskId===s.id;return(0,a.jsx)("li",{role:"treeitem","aria-selected":c,children:(0,a.jsxs)("button",{type:"button",className:"wb-row task".concat(c?" sel":""),onClick:()=>l({kind:"task",sessionId:e.id,taskId:s.id}),title:s.title,children:[(0,a.jsx)(ea,{status:s.status}),(0,a.jsxs)("span",{className:"wb-num",children:[i,"."]}),(0,a.jsx)("span",{className:"wb-row-name",children:s.title}),(null!=(n=s.attempt)?n:1)>1&&(0,a.jsxs)("span",{className:"wb-count",children:["a",s.attempt]})]})},s.id)})})]},e.id)})}):(0,a.jsx)("p",{className:"muted small wb-pad",children:r("wb.loading")})]})}let m=(e,s)=>e.localeCompare(s,void 0,{sensitivity:"base"});function b(e){let{workspace:s,onOpen:t,onOpenFolder:l}=e,{t:i}=(0,d.kj)(),[o,h]=(0,n.useState)(null),[b,p]=(0,n.useState)(""),[w,x]=(0,n.useState)(new Set),j=()=>(null==s?void 0:s.ok)?c.FH.workspaceFiles().then(e=>{h(e.files),p("")}).catch(e=>p(e.message)):Promise.resolve();(0,n.useEffect)(()=>{h(null),j()},[null==s?void 0:s.dir,null==s?void 0:s.ok]),(0,r.z)(j,6e3,!!(null==s?void 0:s.ok));let v=(e,s)=>(0,a.jsxs)(a.Fragment,{children:[[...e.dirs.keys()].sort(m).map(t=>{let n=s?"".concat(s,"/").concat(t):t;return(0,a.jsxs)("li",{role:"treeitem","aria-expanded":w.has(n),children:[(0,a.jsxs)("button",{type:"button",className:"wb-row",onClick:()=>x(e=>{let s=new Set(e);return s.has(n)?s.delete(n):s.add(n),s}),children:[(0,a.jsx)("span",{className:"wb-chev","aria-hidden":"true",children:w.has(n)?"▾":"▸"}),(0,a.jsx)("span",{className:"wb-row-name",children:t})]}),w.has(n)&&(0,a.jsx)("ul",{role:"group",children:v(e.dirs.get(t),n)})]},"d:".concat(n))}),[...e.files].sort((e,s)=>m(e.split("/").pop(),s.split("/").pop())).map(e=>(0,a.jsx)("li",{role:"treeitem",children:(0,a.jsxs)("button",{type:"button",className:"wb-row file",onClick:()=>t({kind:"file",sessionId:"",path:e}),title:e,children:[(0,a.jsx)("span",{className:"wb-ico","aria-hidden":"true",children:"≡"}),(0,a.jsx)("span",{className:"wb-row-name",children:e.split("/").pop()})]})},"f:".concat(e)))]});return(0,a.jsxs)("div",{className:"wb-tree",children:[(0,a.jsxs)(u,{title:(null==s?void 0:s.ok)?s.name:i("wb.files"),children:[(0,a.jsx)("button",{type:"button",className:"wb-icon-btn",onClick:l,title:i("chat.openFolder"),"aria-label":i("chat.openFolder"),children:"⋯"}),(0,a.jsx)("button",{type:"button",className:"wb-icon-btn",onClick:()=>void j(),title:i("wb.refresh"),"aria-label":i("wb.refresh"),children:"↻"})]}),s?s.ok?b?(0,a.jsx)("p",{className:"err small wb-pad",children:b}):o?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"muted small wb-pad",title:s.dir,children:s.branch?"⎇ ".concat(s.branch):s.dir}),(0,a.jsx)("ul",{className:"wb-tree-list",role:"tree","aria-label":i("wb.files"),children:v(function(e){let s={dirs:new Map,files:[]};for(let t of e){let e=t.split("/"),a=s;for(let s of e.slice(0,-1)){let e=a.dirs.get(s);e||(e={dirs:new Map,files:[]},a.dirs.set(s,e)),a=e}a.files.push(t)}return s}(o),"")})]}):(0,a.jsx)("p",{className:"muted small wb-pad",children:i("wb.loading")}):(0,a.jsxs)("div",{className:"wb-pad",children:[(0,a.jsx)("p",{className:"small",children:s.problem}),(0,a.jsx)("button",{type:"button",className:"primary",onClick:l,children:i("chat.openFolder")})]}):(0,a.jsx)("p",{className:"muted small wb-pad",children:i("wb.loading")})]})}function p(e){var s;let{sessions:t,selected:l,onOpen:i}=e,{t:r}=(0,d.kj)(),o=(0,d.W3)(),h=null!=(s=null==t?void 0:t.find(e=>e.id===l.sessionId))?s:null==t?void 0:t.find(e=>{var s;return(null==(s=e.vcs)?void 0:s.enabled)&&e.vcs.repoDir}),[m,b]=(0,n.useState)(null),[p,w]=(0,n.useState)("");return(0,n.useEffect)(()=>{b(null),w(""),h&&c.FH.repoLog(h.id).then(b).catch(e=>w(e.message))},[null==h?void 0:h.id,null==h?void 0:h.tasks.map(e=>{var s,t;return null!=(t=null==(s=e.vcs)?void 0:s.commit)?t:""}).join()]),(0,a.jsxs)("div",{className:"wb-tree",children:[(0,a.jsx)(u,{title:r("wb.commits")}),h?p?(0,a.jsx)("p",{className:"err small wb-pad",children:p}):m?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"muted small wb-pad",children:r("wb.commitsOf",{name:h.name,ref:m.label})}),(0,a.jsx)("ul",{className:"wb-commits",children:m.commits.map(e=>(0,a.jsxs)("li",{children:[e.taskId?(0,a.jsxs)("button",{type:"button",className:"wb-row",onClick:()=>i({kind:"task",sessionId:h.id,taskId:e.taskId}),title:e.subject,children:[(0,a.jsx)("code",{children:e.sha.slice(0,7)}),(0,a.jsx)("span",{className:"wb-row-name",children:e.subject})]}):(0,a.jsxs)("div",{className:"wb-row plain",title:e.subject,children:[(0,a.jsx)("code",{children:e.sha.slice(0,7)}),(0,a.jsx)("span",{className:"wb-row-name",children:e.subject})]}),(0,a.jsxs)("div",{className:"muted wb-commit-meta",children:[e.author," \xb7 ",o(e.at),e.taskTitle?" \xb7 ".concat(r("wb.byTask",{title:e.taskTitle})):""]})]},e.sha))})]}):(0,a.jsx)("p",{className:"muted small wb-pad",children:r("wb.loading")}):(0,a.jsx)("p",{className:"muted small wb-pad",children:r("wb.noRepo")})]})}var w=t(1035),x=t(8934),j=t(287),v=t(5132),k=t(9717);function f(e){let{session:s,task:t,focusAsk:l,onChange:i}=e,{t:r}=(0,d.kj)(),[o,u]=(0,n.useState)(""),[h,m]=(0,n.useState)(""),[b,p]=(0,n.useState)(!1),[w,x]=(0,n.useState)(!1),v=(0,n.useRef)(null),k="idle"===s.status,f="queued"===t.status||"running"===t.status||"waiting-approval"===t.status?"note":k&&"contract-conflict"!==t.stopCode?(0,c.Zm)(t)||(0,c.Dh)(t)?"continue":"done"===t.status?"newPrompt":"none":"none",N="running"===t.status||"waiting-approval"===t.status;(0,n.useEffect)(()=>{m(""),x(!1),u("")},[t.id]),(0,n.useEffect)(()=>{if(l>0){var e,s;null==(e=v.current)||e.focus(),null==(s=v.current)||s.scrollIntoView({block:"nearest"})}},[l]);let g=async()=>{if(o.trim()&&!b&&"none"!==f){p(!0),m("");try{"note"===f?(await c.FH.addTaskNote(s.id,t.id,o),m(N?r("wb.noteSentSoon"):r("wb.noteKept"))):("continue"===f?(await c.FH.continueTask(s.id,t.id,o),m(r("wb.queuedToContinue"))):(await c.FH.rerunTask(s.id,t.id,{prompt:o},{buildOnFinished:!0}),m(r("wb.queuedNewPrompt"))),x(!0)),u("")}catch(e){m(e.message)}finally{p(!1),i()}}},y="note"===f?r("wb.sendNote"):"continue"===f?r("wb.sendContinue"):"newPrompt"===f?r("wb.sendNewPrompt"):r("wb.sendNone"),C="note"===f?N?r("wb.hintNoteLive"):r("wb.hintNoteQueued"):"continue"===f?r("wb.hintContinue"):"newPrompt"===f?r("wb.hintNewPrompt"):k?r("wb.hintNone"):r("wb.hintBusy");return(0,a.jsxs)("div",{className:"wb-compose wb-task-compose",children:[w&&"queued"===t.status&&(0,a.jsx)("div",{className:"wb-inline-panel",children:(0,a.jsx)(j.f,{target:{sessionId:s.id,taskId:t.id,title:t.title},onClose:e=>{x(!1),e&&m(r("wb.started")),i()}})}),h&&(0,a.jsx)("p",{className:"small",role:"status",children:h}),(0,a.jsx)("label",{htmlFor:"wb-compose",className:"sr-only",children:y}),(0,a.jsx)("textarea",{id:"wb-compose",ref:v,value:o,onChange:e=>u(e.target.value),placeholder:"Ctrl+Enter",disabled:"none"===f||b,onKeyDown:e=>{"Enter"===e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),g())}}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("span",{className:"muted small grow",children:C}),(0,a.jsx)("button",{type:"button",className:"primary",disabled:"none"===f||b||!o.trim(),onClick:()=>void g(),title:"Ctrl+Enter",children:y})]})]})}var N=t(7619);function g(e){var s,t,l,r,o,u,h,m,b,p,g,C,S,I,F,O,T,H,P,E,M,A,R,D,L,q,W,K,B;let{session:z,task:U,onChange:Z,onKerrigan:Y,onOpenFile:_}=e,{t:G}=(0,d.kj)(),J=(0,d.W3)(),[V,Q]=(0,n.useState)(""),[X,$]=(0,n.useState)(!1),[ee,es]=(0,n.useState)(!1),[et,en]=(0,n.useState)(!1),[el,ei]=(0,n.useState)(0),ec=()=>ei(e=>e+1),er=z.tasks.findIndex(e=>e.id===U.id)+1,ed="running"===U.status||"waiting-approval"===U.status,eo="idle"!==z.status,eu=(0,c.Zm)(U),eh=(0,c.Dh)(U)&&!eu,em="contract-conflict"===U.stopCode,eb=!!U.startedAt,ep=null==(t=U.attempts)||null==(s=t.at(-1))?void 0:s.undone,ew=null!=(H=U.plan)?H:U.continuing?null==(l=[...null!=(T=U.attempts)?T:[]].reverse().find(e=>{var s;return null==(s=e.plan)?void 0:s.approved}))?void 0:l.plan:void 0;(0,n.useEffect)(()=>{Q(""),es(!1),en(!1),ef(!1),eg("")},[U.id]);let ex=async function(e,s){let t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!X){$(!0),Q("");try{await e(),s&&Q(s),t&&es(!0)}catch(e){Q(e.message)}finally{$(!1),Z()}}},ej=async()=>{await (0,w.Z)(G("wb.removeConfirm",{title:U.title}))&&await ex(()=>c.FH.deleteTask(z.id,U.id),G("wb.removed"))},ev=async()=>{await (0,w.Z)(G("wb.runAgainConfirm",{title:U.title}))&&await ex(()=>c.FH.rerunTask(z.id,U.id),G("wb.queuedAgain"),!0)},[ek,ef]=(0,n.useState)(!1),[eN,eg]=(0,n.useState)("");return(0,a.jsxs)("article",{className:"wb-task","aria-labelledby":"wb-task-".concat(U.id),children:[(0,a.jsxs)("header",{className:"wb-task-head",children:[(0,a.jsx)(ea,{status:U.status}),(0,a.jsxs)("div",{className:"grow",children:[(0,a.jsx)("h2",{id:"wb-task-".concat(U.id),children:U.title}),(0,a.jsxs)("p",{className:"muted small",children:[G("wb.taskOf",{n:er,session:z.name,status:G("status.".concat(U.status))}),(null!=(P=U.attempt)?P:1)>1?" \xb7 ".concat(G("wb.attempt",{n:null!=(E=U.attempt)?E:1})):"",(null==(r=U.vcs)?void 0:r.branch)?" \xb7 ".concat(U.vcs.branch).concat(U.vcs.commit?" @ ".concat(U.vcs.commit.slice(0,8)):""):""]})]}),(0,a.jsx)(i(),{className:"button-link plain small",href:(0,c.aT)(z.id,U.id),children:G("wb.onSessionPage")})]}),(0,a.jsxs)("div",{className:"wb-actions",role:"toolbar","aria-label":G("wb.waysOn"),children:["queued"===U.status&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"primary",disabled:X||eo,onClick:()=>es(!0),children:G("wb.runThis")}),(0,a.jsx)("button",{type:"button",onClick:ec,children:G("wb.addNote")}),(0,a.jsx)(i(),{className:"button-link",href:(0,c.aT)(z.id,U.id),children:G("wb.editTask")}),(0,a.jsx)("button",{type:"button",className:"danger",disabled:X,onClick:()=>void ej(),children:G("wb.remove")})]}),ed&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"primary",onClick:ec,children:G("wb.writeToChat")}),(0,a.jsx)("button",{type:"button",className:"danger",disabled:X,onClick:()=>void ex(()=>c.FH.stop(z.id),G("wb.stopping")),children:G("wb.stopSession")})]}),em&&(0,a.jsx)(i(),{className:"button-link primary",href:(0,c.aT)(z.id,U.id),children:G("wb.fixContradiction")}),eu&&!ed&&(0,a.jsx)("button",{type:"button",className:"primary",disabled:X||eo,onClick:()=>void ex(()=>c.FH.continueTask(z.id,U.id),G("wb.queuedToContinue"),!0),children:G("wb.continue")}),(eh||eu)&&!em&&!ed&&(0,a.jsx)("button",{type:"button",className:eh?"primary":"",disabled:eo,onClick:ec,children:G("wb.continueWithPrompt")}),"done"===U.status&&(0,a.jsx)("button",{type:"button",className:"primary",disabled:eo,onClick:ec,children:G("wb.newPrompt")}),eb&&!ed&&"queued"!==U.status&&(0,a.jsx)("button",{type:"button",disabled:X||eo,onClick:()=>void ev(),children:G("wb.runAgain")}),["failed","blocked","limit-reached","aborted"].includes(U.status)&&(0,a.jsx)("button",{type:"button","aria-expanded":ek,disabled:X||eo,onClick:()=>ef(e=>!e),children:G("wb.accept")}),eb&&!ed&&"queued"!==U.status&&(0,a.jsx)("button",{type:"button","aria-expanded":et,disabled:eo,onClick:()=>en(e=>!e),children:G("wb.undo")}),(null!=(M=null==(u=U.vcs)||null==(o=u.files)?void 0:o.length)?M:0)>0&&(0,a.jsx)(x.C,{sessionId:z.id,taskId:U.id,runId:U.runId,title:U.title,files:null!=(A=null==(m=U.vcs)||null==(h=m.files)?void 0:h.length)?A:0}),(0,a.jsx)("button",{type:"button",onClick:Y,children:G("wb.askKerrigan")})]}),V&&(0,a.jsx)("p",{className:"notice small",role:"status",children:V}),eo&&!ed&&(0,a.jsx)("p",{className:"muted small",children:G("wb.sessionBusy")}),(0,a.jsx)(f,{session:z,task:U,focusAsk:el,onChange:Z}),ek&&(0,a.jsxs)("div",{className:"wb-inline-panel",role:"group","aria-label":G("wb.accept"),children:[(0,a.jsx)("label",{htmlFor:"wb-accept-".concat(U.id),children:G("wb.acceptNote")}),(0,a.jsx)("textarea",{id:"wb-accept-".concat(U.id),value:eN,onChange:e=>eg(e.target.value),style:{minHeight:60}}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("button",{type:"button",className:"primary",disabled:X,onClick:()=>void ex(()=>c.FH.acceptTask(z.id,U.id,eN),G("wb.accepted")).then(()=>ef(!1)),children:G("wb.acceptGo")}),(0,a.jsx)("button",{type:"button",className:"quiet",onClick:()=>ef(!1),children:G("dialog.cancel")})]})]}),et&&(0,a.jsx)(y,{session:z,task:U,onDone:e=>{en(!1),Q(e),es(!0),Z()}}),ee&&"queued"===U.status&&(0,a.jsx)("div",{className:"wb-inline-panel",children:(0,a.jsx)(j.f,{target:{sessionId:z.id,taskId:U.id,title:U.title},intro:V||void 0,onClose:e=>{es(!1),e&&Q(G("wb.started")),Z()}})}),(0,a.jsxs)("section",{className:"wb-sec",children:[(0,a.jsx)("h3",{children:G("wb.result")}),U.accepted&&(0,a.jsxs)("p",{className:"notice calm small",children:[G("wb.acceptedWas",{was:G("status.".concat(U.accepted.was)),at:J(U.accepted.at)}),U.accepted.note?" ".concat(U.accepted.note):""]}),"queued"===U.status&&ep&&(0,a.jsx)("p",{className:"notice calm small",children:"this"===ep.how?G("wb.undoneThis",{commit:null!=(R=null==(b=ep.commit)?void 0:b.slice(0,8))?R:"—"}):G("wb.undoneBack")}),(null==(p=U.continuing)?void 0:p.instruction)&&"done"!==U.status&&(0,a.jsxs)("p",{className:"small",children:[(0,a.jsx)("strong",{children:G("task.continuedWith",{n:U.continuing.fromAttempt})})," ",U.continuing.instruction]}),U.summary?(0,a.jsx)(v.s,{text:U.summary}):"queued"===U.status?(0,a.jsx)("p",{className:"muted small",children:G("wb.notRunYet")}):null,U.reason&&U.reason!==U.summary&&"done"!==U.status&&(0,a.jsx)("p",{className:"reason small",children:U.reason})]}),(0,a.jsxs)("details",{className:"wb-sec",open:"queued"===U.status,children:[(0,a.jsx)("summary",{children:G("wb.prompt")}),(0,a.jsx)(v.s,{text:U.prompt})]}),ew&&(0,a.jsxs)("details",{className:"wb-sec",children:[(0,a.jsx)("summary",{children:G("wb.plan",{n:ew.version})}),(0,a.jsx)(k.D,{plan:ew})]}),(null!=(D=null==(g=U.checkResults)?void 0:g.length)?D:0)>0&&(0,a.jsxs)("section",{className:"wb-sec",children:[(0,a.jsx)("h3",{children:G("wb.checks")}),(0,a.jsx)("ul",{className:"wb-list",children:U.checkResults.map(e=>(0,a.jsxs)("li",{className:e.passed?"ok":"bad",children:[(0,a.jsx)("span",{"aria-hidden":"true",children:e.passed?"✓":"✗"})," ",(0,a.jsx)("strong",{children:e.name})," ",(0,a.jsx)("span",{className:"muted small",children:e.detail})]},e.name))})]}),U.review&&(0,a.jsxs)("section",{className:"wb-sec",children:[(0,a.jsx)("h3",{children:G("wb.review",{verdict:U.review.verdict})}),U.review.summary&&(0,a.jsx)("p",{className:"small",children:U.review.summary}),(null!=(L=null==(C=U.review.findings)?void 0:C.length)?L:0)>0&&(0,a.jsx)("ul",{className:"wb-list",children:U.review.findings.map((e,s)=>{var t;return(0,a.jsxs)("li",{className:"bad small",children:[e.id&&(0,a.jsx)("code",{children:e.id})," ",e.what,e.where?(0,a.jsxs)("span",{className:"muted",children:[" — ",e.where]}):null]},null!=(t=e.id)?t:s)})})]}),(null!=(q=null==(I=U.vcs)||null==(S=I.files)?void 0:S.length)?q:0)>0&&(0,a.jsxs)("section",{className:"wb-sec",children:[(0,a.jsx)("h3",{children:G("wb.changedFiles",{n:U.vcs.files.length})}),(0,a.jsx)("ul",{className:"wb-list",children:U.vcs.files.map(e=>(0,a.jsxs)("li",{children:[(0,a.jsx)("button",{type:"button",className:"linkish",onClick:()=>_(e.path),children:e.path})," ",(0,a.jsx)("span",{className:"muted small",children:e.added>=0?"+".concat(e.added," −").concat(e.removed):G("wb.binary")})]},e.path))})]}),(null!=(W=null==(F=U.notes)?void 0:F.length)?W:0)>0&&(0,a.jsxs)("section",{className:"wb-sec",children:[(0,a.jsx)("h3",{children:G("wb.notes")}),(0,a.jsx)("ul",{className:"wb-list",children:U.notes.map(e=>(0,a.jsxs)("li",{className:"small",children:[e.text," ",(0,a.jsxs)("span",{className:"muted",children:["— ",e.sentAt?G("wb.noteSent",{at:J(e.sentAt)}):G("wb.noteWaiting")]})]},e.id))})]}),(U.startedAt||ed)&&(0,a.jsxs)("details",{className:"wb-sec",open:ed,children:[(0,a.jsx)("summary",{children:G("wb.conversation")}),(0,a.jsx)(N.P,{sessionId:z.id,taskId:U.id,runId:U.runId,live:ed},"".concat(U.id,":").concat(null!=(K=U.runId)?K:""))]}),(null!=(B=null==(O=U.attempts)?void 0:O.length)?B:0)>0&&(0,a.jsxs)("details",{className:"wb-sec",children:[(0,a.jsx)("summary",{children:G("wb.attempts",{n:U.attempts.length})}),(0,a.jsx)("ol",{className:"wb-list",children:U.attempts.map((e,s)=>(0,a.jsxs)("li",{className:"small",children:[(0,a.jsx)(ea,{status:e.status})," ",G("wb.attemptLine",{n:s+1,status:G("status.".concat(e.status))}),e.undone?" \xb7 ".concat("this"===e.undone.how?G("wb.undoneShortThis"):G("wb.undoneShortBack")):"",e.reason?(0,a.jsxs)("span",{className:"muted",children:[" — ",e.reason.slice(0,200)]}):null]},s))})]})]})}function y(e){var s,t,l;let{session:i,task:r,onDone:o}=e,{t:u}=(0,d.kj)(),[h,m]=(0,n.useState)(null),[b,p]=(0,n.useState)(""),[x,j]=(0,n.useState)(!1);(0,n.useEffect)(()=>{c.FH.undoPreview(i.id,r.id).then(m).catch(e=>p(e.message))},[i.id,r.id]);let v=async e=>{if(await (0,w.Z)("this"===e?u("wb.undoThisConfirm",{title:r.title}):u("wb.undoBackConfirm",{title:r.title}))){j(!0);try{let s=await c.FH.undoTask(i.id,r.id,e);o(s.message)}catch(e){p(e.message)}finally{j(!1)}}};if(b&&!h)return(0,a.jsx)("p",{className:"err small",children:b});if(!h)return(0,a.jsx)("p",{className:"muted small",children:u("wb.loading")});let k=h.this,f=h.back;return(0,a.jsxs)("div",{className:"wb-inline-panel",role:"group","aria-label":u("wb.undo"),children:[(0,a.jsxs)("div",{className:"option",children:[(0,a.jsx)("strong",{children:u("wb.undoThis")}),(0,a.jsx)("p",{className:"small",children:k.ok?k.nothing?k.nothing:k.perTask?u("wb.undoThisPerTask",{base:(null!=(s=k.baseCommit)?s:"").slice(0,8),branch:null!=(t=k.branch)?t:"—"}):u("wb.undoThisWhat",{n:k.commits.length,branch:null!=(l=k.branch)?l:"",later:k.later.length}):k.problem}),(0,a.jsx)("button",{type:"button",className:"primary",disabled:x||!k.ok,onClick:()=>void v("this"),children:u("wb.undoThisGo")})]}),(0,a.jsxs)("div",{className:"option",children:[(0,a.jsx)("strong",{children:u("wb.undoBack")}),(0,a.jsx)("p",{className:"small",children:f.ok?u("wb.undoBackWhat",{tasks:f.tasks.map(e=>"“".concat(e.title,"”")).join(", ")}):f.problem}),(0,a.jsx)("button",{type:"button",disabled:x||!f.ok,onClick:()=>void v("back"),children:u("wb.undoBackGo")})]}),b&&(0,a.jsx)("p",{className:"err small",children:b}),(0,a.jsx)("p",{className:"muted small",children:u("wb.undoKept")})]})}var C=t(1701),S=t(4811);function I(e){var s,t;let{session:l,onOpen:r,onChange:o}=e,{t:u}=(0,d.kj)(),h=(0,S.p)(),[m,b]=(0,n.useState)(""),[p,x]=(0,n.useState)(!1),j=l.tasks.filter(e=>"queued"===e.status).length,v=l.tasks.filter(e=>"done"===e.status).length,k="idle"===l.status,f=async e=>{if("unattended"!==e||h||await (0,w.Z)(u("session.unattendedConfirm"))){x(!0),b("");try{var s;let t=await (0,C.L)({sessionIds:[l.id],mode:e,start:s=>c.FH.start(l.id,e,l.planName,s)});t.started?b(u("unattended"===e?"session.startedAuto":"session.startedStep")):t.reply&&b(u("session.notStarted",{reason:null!=(s=t.reply.reason)?s:""}))}catch(e){b(e.message)}finally{x(!1),o()}}};return(0,a.jsxs)("article",{className:"wb-task","aria-labelledby":"wb-s-".concat(l.id),children:[(0,a.jsxs)("header",{className:"wb-task-head",children:[(0,a.jsx)("span",{className:"wb-ico","aria-hidden":"true",children:"▤"}),(0,a.jsxs)("div",{className:"grow",children:[(0,a.jsx)("h2",{id:"wb-s-".concat(l.id),children:l.name}),(0,a.jsxs)("p",{className:"muted small",children:[u("wb.sessionLine",{done:v,all:l.tasks.length,queued:j}),(null==(s=l.vcs)?void 0:s.enabled)?" \xb7 ".concat("per-task"===l.vcs.branchMode?u("wb.perTask"):u("wb.perSession")):" \xb7 ".concat(u("wb.noVcs")),l.modelInUse||l.model?" \xb7 ".concat(null!=(t=l.modelInUse)?t:l.model):""]})]}),(0,a.jsx)(i(),{className:"button-link plain small",href:(0,c.aT)(l.id),children:u("wb.sessionSettings")})]}),(0,a.jsxs)("div",{className:"wb-actions",role:"toolbar","aria-label":u("wb.waysOn"),children:[k?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"primary",disabled:p||0===j,onClick:()=>void f("unattended"),children:u("session.run",{n:j})}),(0,a.jsx)("button",{type:"button",disabled:p||0===j,onClick:()=>void f("confirm"),children:u("session.runStep")})]}):(0,a.jsx)("button",{type:"button",className:"danger",disabled:p,onClick:()=>void c.FH.stop(l.id).then(()=>b(u("wb.stopping"))).catch(e=>b(e.message)).finally(o),children:u("wb.stopSession")}),(0,a.jsx)(i(),{className:"button-link",href:(0,c.aT)(l.id,"new-task"),children:u("wb.addTask")})]}),0===j&&k&&(0,a.jsx)("p",{className:"muted small",children:u("wb.nothingQueued")}),m&&(0,a.jsx)("p",{className:"notice small",role:"status",children:m}),(0,a.jsx)("ol",{className:"wb-list wb-session-tasks",children:l.tasks.map(e=>(0,a.jsxs)("li",{children:[(0,a.jsxs)("button",{type:"button",className:"linkish",onClick:()=>r({kind:"task",sessionId:l.id,taskId:e.id}),children:[(0,a.jsx)(ea,{status:e.status})," ",e.title]}),e.reason&&"done"!==e.status&&"queued"!==e.status?(0,a.jsxs)("span",{className:"muted small",children:[" — ",e.reason.slice(0,160)]}):null]},e.id))})]})}function F(e){var s;let{sessionId:t,path:l,taskId:i}=e,{t:r}=(0,d.kj)(),[o,u]=(0,n.useState)(null),[h,m]=(0,n.useState)("");if((0,n.useEffect)(()=>{let e=!0;return m(""),(t?c.FH.repoFile(t,l,i):c.FH.workspaceFile(l).then(e=>({...e,label:""}))).then(s=>e&&u(s)).catch(s=>e&&m(s.message)),()=>{e=!1}},[t,l,i,r]),h)return(0,a.jsx)("p",{className:"err small",children:h});if(!o)return(0,a.jsx)("p",{className:"muted small",children:r("wb.loading")});let b=(null!=(s=o.text)?s:"").split("\n");return(0,a.jsxs)("div",{className:"wb-file",children:[(0,a.jsx)("p",{className:"muted small",children:t?r("wb.fileAt",{path:o.path,ref:o.label}):r("wb.fileOnDisk",{path:o.path})}),o.binary?(0,a.jsx)("p",{className:"muted",children:r("wb.binary")}):o.tooLarge?(0,a.jsx)("p",{className:"muted",children:r("wb.tooLarge")}):(0,a.jsx)("pre",{className:"wb-code","aria-label":o.path,children:b.map((e,s)=>(0,a.jsxs)("span",{className:"wb-line",children:[(0,a.jsx)("span",{className:"wb-ln","aria-hidden":"true",children:s+1}),e,"\n"]},s))})]})}var O=t(7908),T=t(4784);let H="cop.chat.thread",P="cop.chat.mode",E=(e,s)=>{try{s?window.localStorage.setItem(e,s):window.localStorage.removeItem(e)}catch(e){}},M=e=>{try{var s;return null!=(s=window.localStorage.getItem(e))?s:""}catch(e){return""}};function A(e){var s,t,l,i,o;let{workspace:u,composeAsk:h,onOpenFile:m,onChange:b,onOpenFolder:p,onTurn:x}=e,{t:j}=(0,d.kj)(),v=(0,S.p)(),[k,f]=(0,n.useState)([]),[N,g]=(0,n.useState)(""),[y,C]=(0,n.useState)(null),[I,F]=(0,n.useState)("confirm"),[A,L]=(0,n.useState)(""),[q,W]=(0,n.useState)(!1),[K,B]=(0,n.useState)(""),[z,U]=(0,n.useState)([]),[Z,Y]=(0,n.useState)(null),[_,G]=(0,n.useState)(""),[J,V]=(0,n.useState)(!1),Q=(0,n.useRef)(null),X=!!y&&"idle"!==y.status,$=null!=(s=null==Z?void 0:Z.defaultModel)?s:"",ee=y?!y.manualModel&&(y.model||$)?null!=(t=y.model)?t:"":T.u:"",es=_!==T.u&&(_||$)?_:T.u;(0,n.useEffect)(()=>{g(M(H));let e=M(P);"confirm"===e||"unattended"===e?F(e):c.FH.settings().then(e=>{var s;return F((null==(s=e.raw.execution)?void 0:s.mode)==="unattended"?"unattended":"confirm")}).catch(()=>void 0)},[]),(0,n.useEffect)(()=>{var e;h>0&&(null==(e=Q.current)||e.focus())},[h]),(0,n.useEffect)(()=>{c.FH.models().then(Y).catch(()=>void 0)},[]);let et=(0,n.useCallback)(()=>c.FH.chatThreads().then(f).catch(()=>void 0),[]);(0,r.z)(et,5e3);let ea=(0,n.useCallback)(()=>N?c.FH.session(N).then(e=>C("chat"===e.kind?e:null)).catch(()=>{C(null),g(""),E(H,"")}):Promise.resolve(C(null)),[N]);(0,n.useEffect)(()=>{ea()},[ea]),(0,r.z)(ea,X?1500:5e3,!!N),(0,r.z)(()=>N&&X?c.FH.approvals(N).then(U).catch(()=>void 0):Promise.resolve(U([])),1500,!!N);let en=e=>{g(e),E(H,e),B("")},el=async()=>{let e=A.trim();if(e&&!q){W(!0),B("");try{var s;let t=!N,a=t&&_===T.u,n=await c.FH.chatSend(e,N||void 0,t&&!a&&_||void 0,a);if(L(""),en(n.threadId),n.noted)return void B(j("chat.noted"));if("unattended"===I&&t&&!v&&!await (0,w.Z)(j("session.unattendedConfirm")))return void B(j("chat.notStartedYet"));let l=await c.FH.start(n.threadId,I);l.started||B(j("chat.notStarted",{reason:null!=(s=l.reason)?s:""}))}catch(e){B(e.message)}finally{W(!1),ea(),et(),b()}}},ei=async e=>{if(y&&!q&&await (0,w.Z)(j("chat.rewindConfirm",{n:y.tasks.length-y.tasks.indexOf(e)}))){W(!0),B("");try{var s;let t=await c.FH.chatRewind(y.id,e.id);L(t.text),B(j("chat.rewound")),null==(s=Q.current)||s.focus()}catch(e){B(e.message)}finally{W(!1),ea(),b()}}},ec=async e=>{if(!y)return void G(e);try{await c.FH.updateSession(y.id,e===T.u?{model:"",manualModel:!0}:{model:e,manualModel:!1}),ea()}catch(e){B(e.message)}},er=async()=>{V(!0),B(j("chat.modelsReading"));try{Y(await c.FH.refreshModels()),B(j("chat.modelsRead"))}catch(e){B(e.message)}finally{V(!1)}},ed=null==y?void 0:y.tasks.at(-1);(0,n.useEffect)(()=>{x(y&&ed?{sessionId:y.id,taskId:ed.id}:null)},[null==y?void 0:y.id,null==ed?void 0:ed.id]);let{ref:eo}=(0,O.U)(!0,"".concat(null!=(l=null==y?void 0:y.tasks.length)?l:0,":").concat(null!=(i=null==ed?void 0:ed.status)?i:"",":").concat(null!=(o=null==ed?void 0:ed.iterations)?o:0));return(0,a.jsxs)("div",{className:"cs",children:[(0,a.jsxs)("div",{className:"cs-head",children:[(0,a.jsx)("label",{htmlFor:"cs-thread",className:"sr-only",children:j("chat.thread")}),(0,a.jsxs)("select",{id:"cs-thread",value:N,onChange:e=>en(e.target.value),children:[(0,a.jsx)("option",{value:"",children:j("chat.newThread")}),k.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name.replace(/^chat: /,"")},e.id))]}),(0,a.jsx)("button",{type:"button",className:"wb-icon-btn",onClick:()=>{var e;en(""),C(null),null==(e=Q.current)||e.focus()},title:j("chat.newChat"),"aria-label":j("chat.newChat"),children:"+"})]}),(0,a.jsxs)("div",{className:"cs-body",ref:eo,"aria-live":"polite",children:[y?y.tasks.map(e=>(0,a.jsx)(D,{session:y,task:e,approvals:z.filter(s=>s.taskId===e.id),onOpenFile:m,onRewind:X||q?void 0:()=>void ei(e)},e.id)):(0,a.jsx)(R,{workspace:u,onPick:e=>{var s;L(e),null==(s=Q.current)||s.focus()},onOpenFolder:p}),K&&(0,a.jsx)("p",{className:"cs-system",role:"status",children:K})]}),(0,a.jsxs)("div",{className:"cs-compose",children:[(0,a.jsx)("label",{htmlFor:"cs-input",className:"sr-only",children:j("chat.input")}),(0,a.jsx)("textarea",{id:"cs-input",ref:Q,value:A,onChange:e=>L(e.target.value),placeholder:X?j("chat.placeholderRunning"):(null==u?void 0:u.ok)?j("chat.placeholder",{folder:u.name}):j("chat.placeholderNoFolder"),disabled:q||!(null==u?void 0:u.ok),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),el())}}),(0,a.jsxs)("div",{className:"cs-bar",children:[(0,a.jsx)("label",{htmlFor:"cs-model",className:"sr-only",children:j("chat.model")}),(0,a.jsx)(T.Yb,{id:"cs-model",chosen:y?ee:es,onChange:e=>void ec(e),byHand:j("chat.modelByHand"),none:(null==Z?void 0:Z.defaultModel)?j("chat.modelDefault",{model:Z.defaultModel}):void 0,catalogue:Z,disabled:X,style:{minWidth:0,maxWidth:"48%"}}),(0,a.jsx)("button",{type:"button",className:"wb-icon-btn",onClick:()=>void er(),disabled:J||X,title:j("chat.readModels"),"aria-label":j("chat.readModels"),children:"↻"})]}),(0,a.jsxs)("div",{className:"cs-bar",children:[(0,a.jsx)("label",{htmlFor:"cs-mode",className:"sr-only",children:j("chat.mode")}),(0,a.jsxs)("select",{id:"cs-mode",value:I,onChange:e=>{let s=e.target.value;F(s),E(P,s)},disabled:X,title:j("chat.modeWhy"),children:[(0,a.jsx)("option",{value:"confirm",children:j("chat.modeAsk")}),(0,a.jsx)("option",{value:"unattended",children:j("chat.modeAuto")})]}),(0,a.jsx)("span",{className:"grow"}),X&&(0,a.jsx)("button",{type:"button",className:"danger",onClick:()=>{y&&c.FH.stop(y.id).then(()=>B(j("chat.stopping"))).catch(e=>B(e.message))},children:j("chat.stop")}),(0,a.jsx)("button",{type:"button",className:"primary",disabled:q||!A.trim()||!(null==u?void 0:u.ok),onClick:()=>void el(),title:j("chat.sendWhy"),children:X?j("chat.sendNote"):j("chat.send")})]})]})]})}function R(e){var s;let{workspace:t,onPick:n,onOpenFolder:l}=e,{t:i}=(0,d.kj)();if(!t)return(0,a.jsx)("p",{className:"muted small",children:i("wb.loading")});if(!t.ok)return(0,a.jsxs)("div",{className:"cs-welcome",children:[(0,a.jsx)("p",{children:t.problem}),(0,a.jsx)("button",{type:"button",className:"primary",onClick:l,children:i("chat.openFolder")})]});let c=[i("chat.example1"),i("chat.example2"),i("chat.example3")];return(0,a.jsxs)("div",{className:"cs-welcome",children:[(0,a.jsx)("h3",{children:i("chat.welcome",{folder:t.name})}),(0,a.jsx)("p",{className:"muted small",children:i("chat.welcomeWhy",{dir:t.dir,branch:null!=(s=t.branch)?s:"—"})}),(0,a.jsx)("ul",{className:"cs-examples",children:c.map(e=>(0,a.jsx)("li",{children:(0,a.jsx)("button",{type:"button",className:"linkish",onClick:()=>n(e),children:e})},e))})]})}function D(e){var s,t,l,i;let{session:o,task:u,approvals:h,onOpenFile:m,onRewind:b}=e,{t:p}=(0,d.kj)(),[w,j]=(0,n.useState)(null),k="running"===u.status||"waiting-approval"===u.status,f=()=>u.startedAt||k?c.FH.taskStory(o.id,u.id,u.runId).then(j).catch(()=>void 0):Promise.resolve();(0,n.useEffect)(()=>{f()},[u.id,u.runId,u.status]),(0,r.z)(f,k?1500:6e4,k);let N=[],g=e=>e.forEach(e=>"review"===e.kind?g(e.entries):N.push(e));return g(null!=(l=null==w?void 0:w.entries)?l:[]),(0,a.jsxs)("section",{className:"cs-turn","aria-label":p("chat.turn",{text:u.title}),children:[(0,a.jsxs)("div",{className:"cs-user-row",children:[b&&(u.checkpoint||"queued"===u.status)&&(0,a.jsx)("button",{type:"button",className:"wb-icon-btn cs-rewind",onClick:b,title:p("chat.rewind"),"aria-label":p("chat.rewind"),children:"↶"}),(0,a.jsx)("div",{className:"cs-user",children:(0,a.jsx)(v.s,{text:u.prompt})})]}),"queued"===u.status&&(0,a.jsx)("p",{className:"muted small cs-system",children:p("idle"===o.status?"chat.queued":"chat.waitingTurn")}),N.map((e,s)=>{var t;return"reply"===e.kind?(null==(t=e.notes)?void 0:t.trim())?(0,a.jsx)("div",{className:"cs-bot",children:(0,a.jsx)(v.s,{text:e.notes})},s):null:"step"===e.kind?(0,a.jsx)(L,{step:e},s):null}),h.map(e=>(0,a.jsx)(q,{approval:e},e.id)),k&&(0,a.jsxs)("p",{className:"cs-working",role:"status",children:[(0,a.jsx)("span",{className:"wb-live","aria-hidden":"true"})," ",p("chat.working",{n:u.iterations})]}),!k&&"queued"!==u.status&&(0,a.jsxs)("div",{className:"cs-end s-".concat(u.status),children:[(0,a.jsx)(ea,{status:u.status}),(0,a.jsxs)("div",{className:"grow",children:[u.summary?(0,a.jsx)(v.s,{text:u.summary}):null,"done"!==u.status&&u.reason?(0,a.jsx)("p",{className:"small",children:u.reason}):null]})]}),(null!=(i=null==(t=u.vcs)||null==(s=t.files)?void 0:s.length)?i:0)>0&&!k&&(0,a.jsxs)("div",{className:"cs-files",children:[(0,a.jsx)("span",{className:"small",children:p("chat.changed",{n:u.vcs.files.length})}),u.vcs.files.slice(0,12).map(e=>(0,a.jsxs)("button",{type:"button",className:"cs-file",onClick:()=>m(e.path),title:e.path,children:[e.path.split("/").pop()," ",(0,a.jsx)("span",{className:"muted",children:e.added>=0?"+".concat(e.added," −").concat(e.removed):""})]},e.path)),(0,a.jsx)(x.C,{sessionId:o.id,taskId:u.id,runId:u.runId,title:u.title,files:u.vcs.files.length})]})]})}function L(e){let{step:s}=e,{t}=(0,d.kj)(),l=!s.outcome,[i,c]=(0,n.useState)(null),r=null!=i?i:l||s.failed;return(0,a.jsxs)("div",{className:"cs-cmd".concat(s.failed?" bad":""),children:[(0,a.jsxs)("button",{type:"button",className:"cs-cmd-head","aria-expanded":r,onClick:()=>c(!r),children:[(0,a.jsx)("span",{className:"cs-cmd-ico","aria-hidden":"true",children:l?"⟳":s.failed?"✗":"✓"}),(0,a.jsx)("code",{className:"wb-row-name",children:s.command}),(0,a.jsx)("span",{className:"muted small",children:l?t("chat.running"):void 0!==s.exitCode?t("chat.exit",{code:s.exitCode}):s.outcome})]}),r&&s.output&&(0,a.jsx)("pre",{className:"cs-out",children:s.output})]})}function q(e){let{approval:s}=e,{t}=(0,d.kj)(),[l,i]=(0,n.useState)(!1),r=async e=>{i(!0);try{await c.FH.decide(s.id,e)}finally{i(!1)}};return s.plan||s.model?(0,a.jsx)("p",{className:"cs-system small",children:t("chat.lookAbove")}):(0,a.jsxs)("div",{className:"cs-ask",role:"group","aria-label":t("chat.askTitle"),children:[(0,a.jsx)("p",{className:"small",children:(0,a.jsx)("strong",{children:t("chat.askTitle")})}),(0,a.jsx)("pre",{className:"cs-out",children:s.description}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("button",{type:"button",className:"primary",disabled:l,onClick:()=>void r("run"),children:t("chat.askRun")}),!s.network&&(0,a.jsx)("button",{type:"button",disabled:l,onClick:()=>void r("run-all"),children:t("chat.askRunAll")}),(0,a.jsx)("button",{type:"button",disabled:l,onClick:()=>void r("skip"),children:t("chat.askSkip")})]})]})}function W(e){let{session:s,task:t,sessions:l,onChange:r}=e,{t:o}=(0,d.kj)(),[u,h]=(0,n.useState)(""),[m,b]=(0,n.useState)(t?"task":s?"session":"all"),[p,w]=(0,n.useState)(""),[x,j]=(0,n.useState)(""),[v,k]=(0,n.useState)(null),[f,N]=(0,n.useState)(""),[g,y]=(0,n.useState)(!1),C="task"!==m||t?"session"!==m||s?m:"all":s?"session":"all",S=async()=>{try{let e="task"===C&&s&&t?{sessionIds:[s.id],taskIds:[t.id],note:u}:"session"===C&&s?{sessionIds:[s.id],note:u}:{sessionIds:l.map(e=>e.id),note:u};return(await c.FH.kerriganReport(e)).text}catch(e){return w(e.message),null}},I=async()=>{let e=await S();if(e)try{await navigator.clipboard.writeText(e),w(o("wb.kCopied",{n:e.length}))}catch(e){w(o("wb.kCopyFailed"))}},F=async()=>{let e=await S();if(!e)return;let s=URL.createObjectURL(new Blob([e],{type:"text/plain;charset=utf-8"})),t=document.createElement("a");t.href=s,t.download="what-happened-".concat(new Date().toISOString().slice(0,16).replace(/[:T]/g,"-"),".txt"),t.click(),URL.revokeObjectURL(s),w(o("wb.kSaved"))},O=async()=>{y(!0),N("");try{k(await c.FH.checkChanges(x))}catch(e){N(e.message)}finally{y(!1)}},T=async()=>{y(!0);try{var e;let s=await c.FH.applyChanges(x);s.ok?(N(o("wb.kApplied",{n:s.applied.length})),k(null),j("")):N(null!=(e=s.problem)?e:s.check&&!s.check.ok?s.check.issues.map(e=>e.message).join(" "):"")}catch(e){N(e.message)}finally{y(!1),r()}},H=!!v&&!v.ok&&/"sessions"\s*:/.test(x)&&!/"changes"\s*:/.test(x);return(0,a.jsxs)("div",{className:"wb-kerrigan",children:[(0,a.jsxs)("section",{children:[(0,a.jsx)("h3",{children:o("wb.kTell")}),(0,a.jsx)("p",{className:"muted small",children:o("wb.kTellWhy")}),(0,a.jsxs)("fieldset",{className:"wb-scope",children:[(0,a.jsx)("legend",{className:"sr-only",children:o("wb.kScope")}),t&&(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"radio",name:"wb-k-scope",checked:"task"===C,onChange:()=>b("task")})," ",o("wb.kScopeTask")]}),s&&(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"radio",name:"wb-k-scope",checked:"session"===C,onChange:()=>b("session")})," ",o("wb.kScopeSession")]}),(0,a.jsxs)("label",{children:[(0,a.jsx)("input",{type:"radio",name:"wb-k-scope",checked:"all"===C,onChange:()=>b("all")})," ",o("wb.kScopeAll")]})]}),(0,a.jsx)("label",{htmlFor:"wb-k-note",children:o("wb.kNote")}),(0,a.jsx)("textarea",{id:"wb-k-note",value:u,onChange:e=>h(e.target.value),placeholder:o("wb.kNotePlaceholder"),style:{minHeight:90}}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("button",{type:"button",className:"primary",onClick:()=>void I(),children:o("wb.kCopy")}),(0,a.jsx)("button",{type:"button",onClick:()=>void F(),children:o("wb.kSave")}),(0,a.jsx)(i(),{className:"button-link plain small",href:"/import",children:o("wb.kBrief")})]}),p&&(0,a.jsx)("p",{className:"small",role:"status",children:p})]}),(0,a.jsxs)("section",{children:[(0,a.jsx)("h3",{children:o("wb.kAnswer")}),(0,a.jsx)("label",{htmlFor:"wb-k-answer",children:o("wb.kPaste")}),(0,a.jsx)("textarea",{id:"wb-k-answer",value:x,onChange:e=>{j(e.target.value),k(null)},style:{minHeight:110}}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("button",{type:"button",disabled:g||!x.trim(),onClick:()=>void O(),children:o("wb.kCheck")}),(null==v?void 0:v.ok)&&(0,a.jsx)("button",{type:"button",className:"primary",disabled:g,onClick:()=>void T(),children:o("wb.kApply",{n:v.changes.length})})]}),(null==v?void 0:v.ok)&&(0,a.jsxs)(a.Fragment,{children:[v.notes&&(0,a.jsx)("p",{className:"small",children:v.notes}),(0,a.jsx)("ol",{className:"wb-list small",children:v.changes.map(e=>(0,a.jsx)("li",{children:e.says},e.index))}),v.warnings.map(e=>(0,a.jsx)("p",{className:"muted small",children:e},e))]}),v&&!v.ok&&(0,a.jsx)(a.Fragment,{children:H?(0,a.jsxs)("p",{className:"small",children:[o("wb.kIsPlan")," ",(0,a.jsx)(i(),{href:"/import",children:o("wb.kImportPage")})]}):(0,a.jsx)("ul",{className:"wb-list small",children:v.issues.map(e=>(0,a.jsxs)("li",{className:"bad",children:[e.path&&(0,a.jsx)("code",{children:e.path})," ",e.message]},"".concat(e.path).concat(e.message)))})}),f&&(0,a.jsx)("p",{className:"notice small",role:"status",children:f})]})]})}function K(e){let{tab:s,onTab:t,session:n,task:l,sessions:i,workspace:c,composeAsk:r,onOpenFile:o,onOpenFolder:u,onTurn:h,onChange:m,onClose:b}=e,{t:p}=(0,d.kj)();return(0,a.jsxs)("div",{className:"wb-chat-inner",children:[(0,a.jsxs)("div",{className:"wb-chat-tabs",role:"tablist","aria-label":p("wb.chatPanel"),children:[(0,a.jsx)("button",{type:"button",role:"tab","aria-selected":"chat"===s,className:"chat"===s?"on":"",onClick:()=>t("chat"),children:p("wb.chatTab")}),(0,a.jsx)("button",{type:"button",role:"tab","aria-selected":"kerrigan"===s,className:"kerrigan"===s?"on":"",onClick:()=>t("kerrigan"),children:p("wb.kerriganTab")}),(0,a.jsx)("span",{className:"grow"}),(0,a.jsx)("button",{type:"button",className:"wb-icon-btn","aria-label":p("wb.toggleChat"),title:p("wb.toggleChat"),onClick:b,children:"\xd7"})]}),"kerrigan"===s?(0,a.jsx)(W,{session:n,task:l,sessions:i,onChange:m}):(0,a.jsx)(A,{workspace:c,composeAsk:r,onOpenFile:o,onChange:m,onOpenFolder:u,onTurn:h})]})}function B(e){let{open:s,onToggle:t,tab:n,onTab:l,session:i,task:c,onOpenTask:r}=e,{t:o}=(0,d.kj)(),u=i?function(e){let s=[];return e.tasks.forEach((t,a)=>{var n,l,i,c;let r="".concat(a+1,". ").concat(t.title);for(let a of null!=(i=t.checkResults)?i:[])a.passed||s.push({sessionId:e.id,taskId:t.id,kind:"error",text:"".concat(a.name,": ").concat(a.detail.slice(0,160)),where:r});if((null==(n=t.review)?void 0:n.verdict)==="fail")for(let a of null!=(c=t.review.findings)?c:[])s.push({sessionId:e.id,taskId:t.id,kind:"error",text:a.what.slice(0,200),where:a.where?"".concat(r," \xb7 ").concat(a.where):r});["failed","blocked","limit-reached","aborted"].includes(t.status)&&t.reason&&s.push({sessionId:e.id,taskId:t.id,kind:"warn",text:t.reason.slice(0,200),where:r}),(null==(l=t.vcs)?void 0:l.problem)&&s.push({sessionId:e.id,taskId:t.id,kind:"warn",text:t.vcs.problem.slice(0,200),where:r})}),s}(i):[];return(0,a.jsxs)("section",{className:"wb-bottom","aria-label":o("wb.panel"),children:[(0,a.jsxs)("div",{className:"wb-bottom-tabs",role:"tablist","aria-label":o("wb.panel"),children:[["terminal","problems","output"].map(e=>(0,a.jsxs)("button",{type:"button",role:"tab","aria-selected":s&&n===e,className:s&&n===e?"on":"",onClick:()=>l(e),children:[o("terminal"===e?"wb.terminal":"problems"===e?"wb.problems":"wb.output"),"problems"===e&&u.length>0&&(0,a.jsx)("span",{className:"wb-badge",children:u.length})]},e)),(0,a.jsx)("span",{className:"grow"}),(0,a.jsx)("button",{type:"button",className:"wb-icon-btn","aria-label":o("wb.cmdPanel"),title:"".concat(o("wb.cmdPanel")," (Ctrl+J)"),onClick:t,children:s?"▾":"▴"})]}),s&&(0,a.jsx)("div",{className:"wb-bottom-body",role:"tabpanel",children:"terminal"===n?(0,a.jsx)(z,{session:i,task:c}):"problems"===n?0===u.length?(0,a.jsx)("p",{className:"muted small wb-pad",children:i?o("wb.noProblems"):o("wb.pickSession")}):(0,a.jsx)("ul",{className:"wb-problems",children:u.map((e,s)=>(0,a.jsx)("li",{children:(0,a.jsxs)("button",{type:"button",className:"wb-row",onClick:()=>r(e.sessionId,e.taskId),children:[(0,a.jsx)("span",{className:"wb-sev ".concat(e.kind),"aria-hidden":"true",children:"error"===e.kind?"✗":"⚠"}),(0,a.jsx)("span",{className:"wb-row-name",children:e.text}),(0,a.jsx)("span",{className:"muted",children:e.where})]})},s))}):(0,a.jsx)(U,{session:i})})]})}function z(e){var s,t;let{session:l,task:i}=e,{t:o}=(0,d.kj)(),[u,h]=(0,n.useState)(null),m=(null==i?void 0:i.status)==="running"||(null==i?void 0:i.status)==="waiting-approval",{ref:b}=(0,O.U)(!!m,null!=(s=null==u?void 0:u.entries.length)?s:0),p=()=>l&&i&&(i.startedAt||m)?c.FH.taskStory(l.id,i.id,i.runId).then(h).catch(()=>void 0):Promise.resolve();if((0,n.useEffect)(()=>{h(null),p()},[null==i?void 0:i.id,null==i?void 0:i.runId]),(0,r.z)(p,m?2e3:15e3,!!l&&!!i),!i)return(0,a.jsx)("p",{className:"muted small wb-pad",children:o("wb.pickTask")});let w=[],x=e=>e.forEach(e=>"step"===e.kind?w.push(e):"review"===e.kind?x(e.entries):void 0);return(x(null!=(t=null==u?void 0:u.entries)?t:[]),0===w.length)?(0,a.jsx)("p",{className:"muted small wb-pad",children:u?o("wb.noSteps"):o("wb.loading")}):(0,a.jsx)("div",{ref:b,className:"wb-terminal","aria-live":"off",children:w.map((e,s)=>(0,a.jsxs)("div",{className:e.failed?"bad":"",children:[(0,a.jsxs)("div",{className:"wb-cmd",children:[(0,a.jsx)("span",{"aria-hidden":"true",children:"$ "}),e.command,(0,a.jsxs)("span",{className:"muted",children:[" ",e.outcome?"".concat(e.outcome).concat(void 0!==e.exitCode?" (".concat(e.exitCode,")"):""):o("wb.runningNow")]})]}),e.output&&(0,a.jsx)("pre",{children:e.output})]},s))})}function U(e){let{session:s}=e,{t}=(0,d.kj)(),l=(0,d.W3)(),[i,o]=(0,n.useState)([]),{ref:u}=(0,O.U)(!0,i.length),h=()=>s?c.FH.sessionEvents(s.id).then(o).catch(()=>void 0):Promise.resolve();return((0,n.useEffect)(()=>{o([]),h()},[null==s?void 0:s.id]),(0,r.z)(h,3e3,!!s),s)?(0,a.jsx)("div",{ref:u,className:"wb-terminal",children:0===i.length?(0,a.jsx)("p",{className:"muted small",children:t("wb.noEvents")}):i.map((e,s)=>{var t;return(0,a.jsxs)("div",{className:"error"===e.level?"bad":"warn"===e.level?"warnline":"",children:[(0,a.jsxs)("span",{className:"muted",children:[l(e.at)," "]}),null!=(t=e.message)?t:e.type]},s)})}):(0,a.jsx)("p",{className:"muted small wb-pad",children:t("wb.pickSession")})}var Z=t(3374);function Y(e){var s,t,l,i;let{sessions:o,session:u,task:h,workspace:m,onOpenTask:b}=e,{t:p}=(0,d.kj)(),w=(0,Z.c)(!0,5e3),[x,j]=(0,n.useState)(""),[v,k]=(0,n.useState)(0),[f,N]=(0,n.useState)({iterations:60,minutes:240});(0,n.useEffect)(()=>{c.FH.settings().then(e=>{var s,t,a;let n=null!=(s=e.raw.limits)?s:{};N({iterations:null!=(t=n.maxIterations)?t:60,minutes:null!=(a=n.maxRunMinutes)?a:240})}).catch(()=>void 0)},[]),(0,n.useEffect)(()=>{var e;j(""),(null==u||null==(e=u.vcs)?void 0:e.enabled)&&c.FH.vcsStatus(u.id).then(e=>{var s;return j(null!=(s=e.branch)?s:"")}).catch(()=>void 0)},[null==u?void 0:u.id,null==u?void 0:u.status,null==h?void 0:h.status]),(0,r.z)(()=>c.FH.approvals().then(e=>k(e.length)).catch(()=>void 0),3e3);let g=o.find(e=>"idle"!==e.status),y=null==g?void 0:g.tasks.find(e=>"running"===e.status||"waiting-approval"===e.status),C=(null==y?void 0:y.startedAt)?Math.floor((w-Date.parse(y.startedAt))/6e4):0;return(0,a.jsxs)("footer",{className:"wb-statusbar","aria-label":p("wb.status"),children:[!(null==u||null==(s=u.vcs)?void 0:s.enabled)&&(null==m?void 0:m.ok)&&(0,a.jsxs)("span",{title:m.dir,children:[(0,a.jsx)("span",{"aria-hidden":"true",children:"⎇ "}),m.branch?"".concat(m.name," \xb7 ").concat(m.branch):m.name]}),(null==u||null==(t=u.vcs)?void 0:t.enabled)&&(0,a.jsxs)("span",{title:p("wb.branchNow"),children:[(0,a.jsx)("span",{"aria-hidden":"true",children:"⎇ "}),x||"…"]}),g&&y?(0,a.jsxs)("button",{type:"button",className:"wb-status-btn",onClick:()=>b(g.id,y.id),title:p("wb.openRunning"),children:[(0,a.jsx)("span",{className:"wb-live","aria-hidden":"true"})," ",p("wb.runningLine",{session:g.name,task:y.title,n:y.iterations,max:f.iterations,m:C,maxm:f.minutes})]}):(0,a.jsx)("span",{children:p("wb.idle")}),(0,a.jsx)("span",{className:"grow"}),v>0&&(0,a.jsx)("button",{type:"button",className:"wb-status-btn warn",onClick:()=>{var e;return null==(e=document.querySelector(".approval-banner"))?void 0:e.scrollIntoView({block:"start"})},children:p("wb.waiting",{n:v})}),u&&(0,a.jsx)("span",{title:p("wb.modelNow"),children:null!=(i=null!=(l=u.modelInUse)?l:u.model)?i:p("wb.modelDefault")})]})}var _=t(1702);function G(e){let{commands:s,onClose:t}=e,{t:l}=(0,d.kj)(),i=(0,_.useRouter)(),[c,r]=(0,n.useState)(""),[o,u]=(0,n.useState)(0),h=(0,n.useRef)(null);(0,n.useEffect)(()=>{var e;return null==(e=h.current)?void 0:e.focus()},[]);let m=(0,n.useMemo)(()=>{let e=c.toLowerCase().split(/\s+/).filter(Boolean);return s.filter(s=>e.every(e=>{var t;return"".concat(s.label," ").concat(null!=(t=s.hint)?t:"").toLowerCase().includes(e)})).slice(0,60)},[c,s]),b=0===m.length?-1:Math.min(o,m.length-1),p=e=>{var s;e&&(t(),e.href?i.push(e.href):null==(s=e.run)||s.call(e))};return(0,a.jsx)("div",{className:"modal-backdrop",role:"presentation",onClick:t,children:(0,a.jsxs)("div",{className:"wb-palette",role:"dialog","aria-modal":"true","aria-label":l("wb.palette"),onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("input",{ref:h,type:"text",role:"combobox","aria-expanded":"true","aria-controls":"wb-palette-list","aria-activedescendant":b>=0?"wb-cmd-".concat(b):void 0,"aria-label":l("wb.palette"),placeholder:l("wb.palettePlaceholder"),value:c,onChange:e=>{r(e.target.value),u(0)},onKeyDown:e=>{"Escape"===e.key?t():"ArrowDown"===e.key?(e.preventDefault(),u(Math.min(m.length-1,b+1))):"ArrowUp"===e.key?(e.preventDefault(),u(Math.max(0,b-1))):"Enter"===e.key&&(e.preventDefault(),p(m[b]))}}),(0,a.jsxs)("ul",{id:"wb-palette-list",role:"listbox","aria-label":l("wb.palette"),children:[0===m.length&&(0,a.jsx)("li",{className:"muted small",children:l("wb.paletteNone")}),m.map((e,s)=>(0,a.jsxs)("li",{id:"wb-cmd-".concat(s),role:"option","aria-selected":s===b,className:s===b?"on":"",onMouseEnter:()=>u(s),onClick:()=>p(e),children:[(0,a.jsx)("span",{className:"wb-row-name",children:e.label}),e.hint&&(0,a.jsx)("span",{className:"muted small",children:e.hint})]},e.id))]})]})})}let J=e=>"task"===e.kind?"t:".concat(e.taskId):"session"===e.kind?"s:".concat(e.sessionId):"f:".concat(e.sessionId,":").concat(e.path),V={side:290,chat:420,bottom:240,sideOpen:!0,chatOpen:!0,bottomOpen:!0},Q="cop.workbench.layout";function X(){return(0,a.jsx)(n.Suspense,{fallback:null,children:(0,a.jsx)($,{})})}function $(){let{t:e}=(0,d.kj)(),[s,t]=(0,n.useState)(null),[l,u]=(0,n.useState)(""),[h,m]=(0,n.useState)({}),[b,p]=(0,n.useState)([]),[w,x]=(0,n.useState)(""),[j,v]=(0,n.useState)("files"),[k,f]=(0,n.useState)(null),[N,y]=(0,n.useState)(null),[C,S]=(0,n.useState)("terminal"),[O,T]=(0,n.useState)("chat"),[H,P]=(0,n.useState)(V),[E,M]=(0,n.useState)(!1),[A,R]=(0,n.useState)(0),D=(0,n.useRef)(!1),L=(0,n.useCallback)(()=>c.FH.sessions().then(e=>{t(e),u("")}).catch(e=>u(e.message)),[]);(0,r.z)(L,3e3);let q=(0,n.useCallback)(()=>c.FH.workspace().then(f).catch(()=>void 0),[]);(0,r.z)(q,1e4);let W=(0,n.useCallback)(async()=>{try{var e;let s=await c.FH.browseFolder((null==k?void 0:k.dir)||void 0);if(!s.ok)return;let t=await c.FH.settings();await c.FH.saveSettings({...t.raw,project:{...null!=(e=t.raw.project)?e:{},rootDir:s.path}}),await q()}catch(e){u(e.message)}},[null==k?void 0:k.dir,q]);(0,n.useEffect)(()=>{var e,s;P(function(){try{let e=window.localStorage.getItem(Q);return e?{...V,...JSON.parse(e)}:V}catch(e){return V}}());let t=new URLSearchParams(window.location.search),a=null!=(e=t.get("s"))?e:void 0,n=null!=(s=t.get("t"))?s:void 0;a&&m({sessionId:a,taskId:n}),D.current=!0},[]),(0,n.useEffect)(()=>{try{window.localStorage.setItem(Q,JSON.stringify(H))}catch(e){}},[H]),(0,n.useEffect)(()=>{if(!D.current)return;let e=new URLSearchParams;h.sessionId&&e.set("s",h.sessionId),h.taskId&&e.set("t",h.taskId);let s=e.toString()?"/?".concat(e.toString()):"/";"".concat(window.location.pathname).concat(window.location.search)!==s&&window.history.replaceState(null,"",s)},[h]);let z=(0,n.useCallback)(e=>{p(s=>s.some(s=>J(s)===J(e))?s:[...s,e]),x(J(e)),"task"===e.kind?m({sessionId:e.sessionId,taskId:e.taskId}):m(s=>({sessionId:e.sessionId,taskId:s.sessionId===e.sessionId?s.taskId:void 0}))},[]),U=(0,n.useRef)(!1);(0,n.useEffect)(()=>{if(U.current||!s||!h.sessionId)return;let e=s.find(e=>e.id===h.sessionId);e&&(U.current=!0,h.taskId&&e.tasks.some(e=>e.id===h.taskId)?z({kind:"task",sessionId:e.id,taskId:h.taskId}):z({kind:"session",sessionId:e.id}))},[s,h,z]);let Z=null==s?void 0:s.find(e=>e.id===h.sessionId),_=null==Z?void 0:Z.tasks.find(e=>e.id===h.taskId),X=b.find(e=>J(e)===w),$=N?null==s?void 0:s.find(e=>e.id===N.sessionId):void 0,el=(null==X?void 0:X.kind)!=="task"&&$?$:Z,ei=(null==X?void 0:X.kind)!=="task"&&$?$.tasks.find(e=>e.id===(null==N?void 0:N.taskId)):_,ec=e=>P(s=>({...s,...e}));(0,n.useEffect)(()=>{let e=e=>{if(!(e.ctrlKey||e.metaKey))return;let s=e.key.toLowerCase();"k"===s||"p"===s&&e.shiftKey?(e.preventDefault(),M(!0)):"b"!==s||e.shiftKey?"j"===s?(e.preventDefault(),ec({bottomOpen:!H.bottomOpen})):"l"===s&&(e.preventDefault(),ec({chatOpen:!0}),T("chat"),R(e=>e+1)):(e.preventDefault(),ec({sideOpen:!H.sideOpen}))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[H]);let er=(0,n.useMemo)(()=>{let t=[{id:"kerrigan",label:e("wb.cmdKerrigan"),run:()=>{ec({chatOpen:!0}),T("kerrigan")}},{id:"chat",label:e("wb.cmdChat"),hint:"Ctrl+L",run:()=>{ec({chatOpen:!0}),T("chat"),R(e=>e+1)}},{id:"side",label:e("wb.cmdSide"),hint:"Ctrl+B",run:()=>ec({sideOpen:!H.sideOpen})},{id:"panel",label:e("wb.cmdPanel"),hint:"Ctrl+J",run:()=>ec({bottomOpen:!H.bottomOpen})},{id:"files",label:e("wb.cmdFiles"),run:()=>{ec({sideOpen:!0}),v("files")}},{id:"commits",label:e("wb.cmdCommits"),run:()=>{ec({sideOpen:!0}),v("commits")}},{id:"problems",label:e("wb.cmdProblems"),run:()=>{ec({bottomOpen:!0}),S("problems")}},...[["/sessions","nav.sessions"],["/history","nav.history"],["/import","nav.import"],["/defaults","nav.defaults"],["/level1","nav.level1"],["/presets","nav.presets"],["/appearance","nav.appearance"],["/system","nav.system"]].map(s=>{let[t,a]=s;return{id:"go:".concat(t),label:e("wb.cmdGo",{page:e(a)}),href:t}})];for(let a of null!=s?s:[])t.push({id:"s:".concat(a.id),label:e("wb.cmdSession",{name:a.name}),run:()=>z({kind:"session",sessionId:a.id})}),a.tasks.forEach((s,n)=>t.push({id:"t:".concat(s.id),label:"".concat(a.name," › ").concat(n+1,". ").concat(s.title),hint:e("status.".concat(s.status)),run:()=>z({kind:"task",sessionId:a.id,taskId:s.id})}));return t},[s,e,H,z]),ed={"--wb-side":H.sideOpen?"".concat(H.side,"px"):"0px","--wb-chat":H.chatOpen?"".concat(H.chat,"px"):"0px","--wb-bottom":H.bottomOpen?"".concat(H.bottom,"px"):"34px"};return(0,a.jsxs)("div",{className:"wb",style:ed,children:[(0,a.jsxs)("header",{className:"wb-top",children:[(0,a.jsx)("span",{className:"wb-brand",children:"copilot-operator"}),(0,a.jsxs)("button",{type:"button",className:"wb-search",onClick:()=>M(!0),title:e("wb.paletteWhy"),children:[(0,a.jsx)("span",{children:e("wb.palette")}),(0,a.jsx)("kbd",{children:"Ctrl+K"})]}),(0,a.jsxs)("nav",{className:"wb-menu","aria-label":e("nav.label"),children:[(0,a.jsx)(i(),{href:"/sessions",children:e("nav.sessions")}),(0,a.jsx)(i(),{href:"/history",children:e("nav.history")}),(0,a.jsx)(i(),{href:"/import",children:e("nav.import")}),(0,a.jsx)(i(),{href:"/defaults",children:e("nav.defaults")}),(0,a.jsx)(d.c5,{})]})]}),(0,a.jsxs)("div",{className:"wb-body".concat(H.sideOpen?"":" no-side").concat(H.chatOpen?"":" no-chat"),children:[(0,a.jsx)(es,{side:j,sideOpen:H.sideOpen,onSide:e=>{e===j&&H.sideOpen?ec({sideOpen:!1}):(v(e),ec({sideOpen:!0}))},chatOpen:H.chatOpen,onChat:()=>ec({chatOpen:!H.chatOpen})}),(0,a.jsxs)("aside",{className:"wb-side","aria-label":e("wb.explorer"),hidden:!H.sideOpen,children:[l&&!s?(0,a.jsx)("p",{className:"err small",style:{padding:10},children:l}):null,(0,a.jsx)(o,{view:j,sessions:s,selected:h,onOpen:z,onChange:()=>void L(),workspace:k,onOpenFolder:()=>void W()})]}),H.sideOpen&&(0,a.jsx)(et,{axis:"x",label:e("wb.resize"),onDrag:e=>ec({side:ee(H.side+e,180,560)})}),(0,a.jsxs)("section",{className:"wb-center","aria-label":e("wb.editor"),children:[(0,a.jsxs)("div",{className:"wb-tabs",role:"tablist","aria-label":e("wb.openTabs"),children:[0===b.length&&(0,a.jsx)("span",{className:"muted small wb-tabs-empty",children:e("wb.noTabs")}),b.map(t=>{var n,l;let i=J(t),c=null==s?void 0:s.find(e=>e.id===t.sessionId),r="task"===t.kind?null==c?void 0:c.tasks.find(e=>e.id===t.taskId):void 0,d="task"===t.kind?null!=(n=null==r?void 0:r.title)?n:e("wb.goneTask"):"session"===t.kind?null!=(l=null==c?void 0:c.name)?l:e("wb.goneSession"):t.path.split("/").pop();return(0,a.jsxs)("div",{className:"wb-tab".concat(i===w?" active":""),children:[(0,a.jsxs)("button",{type:"button",role:"tab","aria-selected":i===w,onClick:()=>"task"===t.kind?z(t):(x(i),m({sessionId:t.sessionId,taskId:"file"===t.kind?t.taskId:void 0})),title:"file"===t.kind?t.path:void 0,children:[r&&(0,a.jsx)(ea,{status:r.status}),"file"===t.kind&&(0,a.jsx)("span",{className:"wb-ico","aria-hidden":"true",children:"≡"}),"session"===t.kind&&(0,a.jsx)("span",{className:"wb-ico","aria-hidden":"true",children:"▤"}),(0,a.jsx)("span",{className:"wb-tab-label",children:d})]}),(0,a.jsx)("button",{type:"button",className:"wb-tab-close","aria-label":e("wb.closeTab",{name:null!=d?d:""}),onClick:()=>{p(e=>{let s=e.findIndex(e=>J(e)===i),t=e.filter(e=>J(e)!==i);return i===w&&x(t[Math.max(0,s-1)]?J(t[Math.max(0,s-1)]):""),t})},children:"\xd7"})]},i)})]}),(0,a.jsx)("div",{className:"wb-editor",role:"tabpanel",children:X?"task"===X.kind?Z&&_?(0,a.jsx)(g,{session:Z,task:_,onChange:()=>void L(),onKerrigan:()=>{ec({chatOpen:!0}),T("kerrigan")},onOpenFile:e=>z({kind:"file",sessionId:Z.id,path:e,taskId:_.id})}):(0,a.jsx)("p",{className:"muted",children:e("wb.goneTask")}):"session"===X.kind?(()=>{let t=null==s?void 0:s.find(e=>e.id===X.sessionId);return t?(0,a.jsx)(I,{session:t,onOpen:z,onChange:()=>void L()}):(0,a.jsx)("p",{className:"muted",children:e("wb.goneSession")})})():(0,a.jsx)(F,{sessionId:X.sessionId,path:X.path,taskId:X.taskId}):(0,a.jsx)(en,{sessions:s,workspace:k,onOpen:z,onChat:()=>{ec({chatOpen:!0}),T("chat"),R(e=>e+1)},onKerrigan:()=>{ec({chatOpen:!0}),T("kerrigan")}})}),H.bottomOpen&&(0,a.jsx)(et,{axis:"y",label:e("wb.resize"),onDrag:e=>ec({bottom:ee(H.bottom-e,90,700)})}),(0,a.jsx)(B,{open:H.bottomOpen,onToggle:()=>ec({bottomOpen:!H.bottomOpen}),tab:C,onTab:e=>{S(e),ec({bottomOpen:!0})},session:el,task:ei,onOpenTask:(e,s)=>z({kind:"task",sessionId:e,taskId:s})})]}),H.chatOpen&&(0,a.jsx)(et,{axis:"x",label:e("wb.resize"),onDrag:e=>ec({chat:ee(H.chat-e,300,820)})}),(0,a.jsx)("aside",{className:"wb-chat","aria-label":e("wb.chatPanel"),hidden:!H.chatOpen,children:(0,a.jsx)(K,{tab:O,onTab:T,session:Z,task:_,sessions:(null!=s?s:[]).filter(e=>"chat"!==e.kind),workspace:k,composeAsk:A,onOpenFile:e=>z({kind:"file",sessionId:"",path:e}),onOpenFolder:()=>void W(),onTurn:y,onChange:()=>void L(),onClose:()=>ec({chatOpen:!1})})})]}),(0,a.jsx)(Y,{sessions:null!=s?s:[],session:Z,task:_,workspace:k,onOpenTask:(e,s)=>z({kind:"task",sessionId:e,taskId:s})}),E&&(0,a.jsx)(G,{commands:er,onClose:()=>M(!1)})]})}let ee=(e,s,t)=>Math.max(s,Math.min(t,e));function es(e){let{side:s,sideOpen:t,onSide:n,chatOpen:l,onChat:c}=e,{t:r}=(0,d.kj)(),o=(e,l,i)=>(0,a.jsx)("button",{type:"button",className:"wb-act".concat(t&&s===e?" on":""),"aria-pressed":t&&s===e,"aria-label":l,title:l,onClick:()=>n(e),children:(0,a.jsx)("svg",{viewBox:"0 0 24 24",width:"22",height:"22",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i})});return(0,a.jsxs)("nav",{className:"wb-activity","aria-label":r("wb.views"),children:[o("tasks",r("wb.viewTasks"),(0,a.jsx)("path",{d:"M4 6h16M4 12h16M4 18h10"})),o("files",r("wb.viewFiles"),(0,a.jsx)("path",{d:"M4 4h6l2 2h8v14H4z"})),o("commits",r("wb.viewCommits"),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"3"}),(0,a.jsx)("path",{d:"M12 3v6M12 15v6"})]})),(0,a.jsx)("span",{className:"grow"}),(0,a.jsx)("button",{type:"button",className:"wb-act".concat(l?" on":""),"aria-pressed":l,"aria-label":r("wb.toggleChat"),title:"".concat(r("wb.toggleChat")," (Ctrl+L)"),onClick:c,children:(0,a.jsx)("svg",{viewBox:"0 0 24 24",width:"22",height:"22",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinejoin:"round","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M4 5h16v11H9l-5 4z"})})}),(0,a.jsx)(i(),{className:"wb-act",href:"/defaults","aria-label":r("nav.defaults"),title:r("nav.defaults"),children:(0,a.jsxs)("svg",{viewBox:"0 0 24 24",width:"22",height:"22",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"3"}),(0,a.jsx)("path",{d:"M12 2v3M12 19v3M2 12h3M19 12h3M5 5l2 2M17 17l2 2M5 19l2-2M17 7l2-2"})]})})]})}function et(e){let{axis:s,label:t,onDrag:l}=e,i=(0,n.useRef)(null);return(0,a.jsx)("div",{className:"wb-split ".concat(s),role:"separator","aria-orientation":"x"===s?"vertical":"horizontal","aria-label":t,tabIndex:0,onPointerDown:e=>{i.current="x"===s?e.clientX:e.clientY,e.target.setPointerCapture(e.pointerId)},onPointerMove:e=>{if(null===i.current)return;let t="x"===s?e.clientX:e.clientY;l(t-i.current),i.current=t},onPointerUp:()=>i.current=null,onKeyDown:e=>{let t=e.shiftKey?40:12;("x"===s&&"ArrowLeft"===e.key||"y"===s&&"ArrowUp"===e.key)&&l(-t),("x"===s&&"ArrowRight"===e.key||"y"===s&&"ArrowDown"===e.key)&&l(t)}})}function ea(e){var s;let{status:t}=e,{t:n}=(0,d.kj)();return(0,a.jsx)("span",{className:"wb-status s-".concat(t),title:n("status.".concat(t)),"aria-label":n("status.".concat(t)),role:"img",children:null!=(s=({done:"✓",failed:"✗",blocked:"⊘","limit-reached":"⏸",aborted:"■",queued:"○",running:"●","waiting-approval":"◐"})[t])?s:"\xb7"})}function en(e){let{sessions:s,workspace:t,onOpen:n,onChat:l,onKerrigan:c}=e,{t:r}=(0,d.kj)(),o=(null!=s?s:[]).filter(e=>"chat"!==e.kind),u=o.flatMap(e=>e.tasks.filter(e=>["failed","blocked","limit-reached","aborted","waiting-approval"].includes(e.status)).map(s=>({s:e,x:s}))),h=o.reduce((e,s)=>e+s.tasks.filter(e=>"queued"===e.status).length,0);return(0,a.jsxs)("div",{className:"wb-welcome",children:[(0,a.jsx)("h2",{children:(null==t?void 0:t.ok)?t.name:r("wb.welcome")}),(0,a.jsx)("p",{className:"muted",children:(null==t?void 0:t.ok)?r("wb.welcomeChat",{dir:t.dir}):r("wb.welcomeWhy")}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("button",{type:"button",className:"primary",onClick:l,children:r("wb.startChat")}),(0,a.jsx)(i(),{className:"button-link",href:"/import",children:r("wb.startPlan")}),(0,a.jsx)("button",{type:"button",onClick:c,children:r("wb.askKerrigan")})]}),u.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h3",{children:r("wb.needsYou",{n:u.length})}),(0,a.jsx)("ul",{className:"wb-list",children:u.slice(0,12).map(e=>{let{s,x:t}=e;return(0,a.jsx)("li",{children:(0,a.jsxs)("button",{type:"button",className:"linkish",onClick:()=>n({kind:"task",sessionId:s.id,taskId:t.id}),children:[(0,a.jsx)(ea,{status:t.status})," ",s.name," › ",t.title]})},t.id)})})]}),h>0&&(0,a.jsx)("p",{className:"small",children:r("wb.queuedCount",{n:h})}),(0,a.jsx)("p",{className:"muted small",children:r("wb.keys")})]})}function el(){return(0,a.jsx)(X,{})}},5704:(e,s,t)=>{Promise.resolve().then(t.bind(t,4846))},9717:(e,s,t)=>{"use strict";t.d(s,{D:()=>l});var a=t(3365),n=t(867);function l(e){var s,t;let{plan:l,showApproval:i=!0}=e,{t:c}=(0,n.kj)(),r=(0,n.W3)(),d=l.approved;return(0,a.jsxs)("div",{className:"plan-view",children:[(0,a.jsx)("p",{className:"small muted",children:c("pm.version",{n:l.version,at:r(l.at)})}),i&&d&&(0,a.jsxs)("p",{className:"small",children:["operator"===d.by?c("pm.approvedByOperator",{at:r(d.at)}):c("pm.approvedAuto",{at:r(d.at)}),d.why&&" ".concat(d.why),d.note&&" ".concat(c("pm.approvedNote",{note:d.note}))]}),(0,a.jsx)("h4",{children:c("pm.existing")}),(0,a.jsx)("p",{className:"pre-wrap",children:l.existing}),(0,a.jsx)("h4",{children:c("pm.approach")}),(0,a.jsx)("p",{className:"pre-wrap",children:l.approach}),(0,a.jsx)("h4",{children:c("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:c("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:c("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:c("pm.risks")}),(0,a.jsx)("p",{className:"pre-wrap",children:l.risks})]}),(null!=(t=null==(s=l.revisions)?void 0:s.length)?t:0)>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h4",{children:c("pm.revisions")}),(0,a.jsx)("ul",{children:l.revisions.map(e=>(0,a.jsxs)("li",{className:"small",children:[c("pm.revision",{n:e.version,at:r(e.at)})," ",(0,a.jsx)("span",{className:"pre-wrap",children:e.comment})]},e.version))})]})]})}}},e=>{e.O(0,[197,867,549,499,897,347,131,358],()=>e(e.s=5704)),_N_E=e.O()}]);
|
/package/dist/web/_next/static/{HT6yqFoDPOXChAZVDxshC → z74_FBfnnXW5IJCHTgTH2}/_buildManifest.js
RENAMED
|
File without changes
|
/package/dist/web/_next/static/{HT6yqFoDPOXChAZVDxshC → z74_FBfnnXW5IJCHTgTH2}/_ssgManifest.js
RENAMED
|
File without changes
|