copilot-operator 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/src/api/main.js +2 -104
  2. package/dist/src/api/operator.controller.js +18 -1
  3. package/dist/src/api/operator.service.js +30 -11
  4. package/dist/src/api/server.js +114 -0
  5. package/dist/src/config/schema.js +5 -0
  6. package/dist/src/exec/checks.js +17 -0
  7. package/dist/src/orchestrator/progress.js +106 -0
  8. package/dist/src/orchestrator/taskRunner.js +110 -10
  9. package/dist/src/plan/brief.js +6 -4
  10. package/dist/src/plan/importPlan.js +1 -0
  11. package/dist/src/plan/schema.js +7 -0
  12. package/dist/src/plan/systemGuide.js +67 -12
  13. package/dist/src/session/compose.js +25 -20
  14. package/dist/src/session/exports.js +5 -0
  15. package/dist/src/session/handoff.js +42 -0
  16. package/dist/src/session/interruption.js +104 -0
  17. package/dist/src/session/metrics.js +95 -0
  18. package/dist/src/session/store.js +35 -5
  19. package/dist/src/session/story.js +1 -1
  20. package/dist/src/transport/chatTransport.js +32 -0
  21. package/dist/src/vcs/contentIntegrity.js +174 -0
  22. package/dist/src/vcs/git.js +42 -0
  23. package/dist/src/vcs/scope.js +129 -0
  24. package/dist/src/vcs/taskVcs.js +43 -2
  25. package/dist/web/404.html +4 -3
  26. package/dist/web/_next/static/chunks/373-56833488fcb5aa29.js +1 -0
  27. package/dist/web/_next/static/chunks/549-43d1a5681752fbd4.js +1 -0
  28. package/dist/web/_next/static/chunks/867-76cc83e4e54812dc.js +1 -0
  29. package/dist/web/_next/static/chunks/app/appearance/page-9b13583bfee63b32.js +1 -0
  30. package/dist/web/_next/static/chunks/app/defaults/page-78be7820772f8882.js +1 -0
  31. package/dist/web/_next/static/chunks/app/history/page-90bc1c718d76b6b2.js +1 -0
  32. package/dist/web/_next/static/chunks/app/import/page-1060c7cb8e8d66eb.js +1 -0
  33. package/dist/web/_next/static/chunks/app/layout-560bd6d173302e5a.js +1 -0
  34. package/dist/web/_next/static/chunks/app/level1/page-be366b35f4cc97ce.js +1 -0
  35. package/dist/web/_next/static/chunks/app/page-9e2736286f16422d.js +1 -0
  36. package/dist/web/_next/static/chunks/app/presets/page-cabc3876a8111edd.js +1 -0
  37. package/dist/web/_next/static/chunks/app/sessions/view/page-0e2b6829643e9b04.js +1 -0
  38. package/dist/web/_next/static/css/20c6b36996df5e4c.css +1 -0
  39. package/dist/web/appearance.html +4 -3
  40. package/dist/web/appearance.txt +12 -12
  41. package/dist/web/defaults.html +4 -3
  42. package/dist/web/defaults.txt +12 -12
  43. package/dist/web/history.html +4 -3
  44. package/dist/web/history.txt +12 -12
  45. package/dist/web/import.html +4 -3
  46. package/dist/web/import.txt +12 -12
  47. package/dist/web/index.html +4 -3
  48. package/dist/web/index.txt +12 -12
  49. package/dist/web/level1.html +4 -3
  50. package/dist/web/level1.txt +12 -12
  51. package/dist/web/presets.html +4 -3
  52. package/dist/web/presets.txt +12 -12
  53. package/dist/web/sessions/view.html +4 -3
  54. package/dist/web/sessions/view.txt +12 -12
  55. package/dist/web/system.html +4 -3
  56. package/dist/web/system.txt +12 -12
  57. package/package.json +13 -4
  58. package/dist/web/_next/static/chunks/549-33f0d3d53338b2f2.js +0 -1
  59. package/dist/web/_next/static/chunks/723-edc7b5709e5407ec.js +0 -1
  60. package/dist/web/_next/static/chunks/867-4aa80f5a32311bce.js +0 -1
  61. package/dist/web/_next/static/chunks/app/appearance/page-501842e7aeac7f6b.js +0 -1
  62. package/dist/web/_next/static/chunks/app/defaults/page-1747c931adc746fd.js +0 -1
  63. package/dist/web/_next/static/chunks/app/history/page-2251664c0abe3f11.js +0 -1
  64. package/dist/web/_next/static/chunks/app/import/page-8a4bdee8e38341a9.js +0 -1
  65. package/dist/web/_next/static/chunks/app/layout-e0174d863960f109.js +0 -1
  66. package/dist/web/_next/static/chunks/app/level1/page-697d4d6ba5bba41a.js +0 -1
  67. package/dist/web/_next/static/chunks/app/page-f04d6e00182ccc76.js +0 -1
  68. package/dist/web/_next/static/chunks/app/presets/page-e2dcb924d9e2d758.js +0 -1
  69. package/dist/web/_next/static/chunks/app/sessions/view/page-9517dd74c6d00f85.js +0 -1
  70. package/dist/web/_next/static/css/b67acb571615432b.css +0 -1
  71. /package/dist/web/_next/static/{DCpEMjhrg9APkRwBBw5Do → auD7lTmj-JDMJIQ4TVivR}/_buildManifest.js +0 -0
  72. /package/dist/web/_next/static/{DCpEMjhrg9APkRwBBw5Do → auD7lTmj-JDMJIQ4TVivR}/_ssgManifest.js +0 -0
@@ -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:()=>y});var n=t(3365),a=t(1521),l=t(8197),i=t.n(l),r=t(5549),d=t(3523),o=t(3374),c=t(867),u=t(1910),h=t(5132);function m(){let{t:e}=(0,c.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)(h.s,{text:e("row.infoWhich"),className:"small"})]})]})}function g(e){let{onChange:s}=e,{t}=(0,c.kj)(),[l,i]=(0,a.useState)(null),[d,o]=(0,a.useState)(!1),[u,h]=(0,a.useState)(""),m=(0,a.useCallback)(async()=>{try{i(await r.FH.batch())}catch(e){}},[]);(0,a.useEffect)(()=>{m();let e=setInterval(()=>void m(),3e3);return()=>clearInterval(e)},[m]);let g=async e=>{o(!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{o(!1)}};return(null==l?void 0:l.running)?(0,n.jsxs)("div",{className:"row",style:{marginBottom:8},children:[l.pausing?(0,n.jsx)("button",{className:"primary",disabled: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 p=t(3041),x=t(1035),j=t(8934),v=t(4811),N=t(2876);let k=["queued","running","waiting-approval"],f=["blocked","failed","aborted","limit-reached"];function b(e){let{run:s}=e,{t}=(0,c.kj)(),a=s.entries.some(d.DG),l=(0,o.c)(a),i=(0,d.eZ)(s,s.entries,l);return(0,n.jsx)(n.Fragment,{children:t(i.live?"reg.runRunning":"reg.runTook",{d:(0,r.c5)(i.ms)})})}function w(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 y(){let{t:e}=(0,c.kj)(),s=(0,c.W3)(),[t,l]=(0,a.useState)(null),[i,d]=(0,a.useState)(""),[o,u]=(0,a.useState)(""),[h,m]=(0,a.useState)("flow"),[p,x]=(0,a.useState)(""),[j,v]=(0,a.useState)(""),[N,b]=(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,a.useEffect)(()=>{y();let e=setInterval(()=>void y(),6e3);return()=>clearInterval(e)},[y]);let C=(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]),A=(0,a.useMemo)(()=>{let e=N.trim().toLowerCase();return(null!=t?t:[]).filter(s=>{var t,n;return(!p||s.sessionId===p)&&(!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,p,j,N]),W=(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=>f.includes(e.status)).length}},[t]),P=(0,a.useMemo)(()=>{let e=new Map;for(let n of null!=t?t:[]){var s;n.runGroup&&e.set(n.runGroup.id,(null!=(s=e.get(n.runGroup.id))?s:0)+1)}return e},[t]),H=(0,a.useMemo)(()=>w(A),[A]),G=A.filter(e=>"running"===e.status||"waiting-approval"===e.status),O=A.filter(e=>"queued"===e.status),D=[...A.filter(e=>f.includes(e.status)&&"stop"===e.sessionOnFailure&&!e.sessionRunning&&O.some(s=>s.sessionId===e.sessionId)),...O].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}),E=A.filter(e=>!k.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)}),M=""!==p||""!==j||""!==N.trim();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("h2",{className:"grow",style:{margin:0},children:e("reg.title")}),(0,n.jsx)("span",{className:"muted small",children:o&&e("reg.updated",{t:s(o)})}),(0,n.jsx)("button",{className:"quiet",onClick:()=>void y(),children:e("reg.refresh")})]}),(0,n.jsx)("p",{className:"muted small",children:e("reg.hint")}),(0,n.jsx)(T,{sessions:C}),(0,n.jsxs)("div",{className:"counts",children:[(0,n.jsxs)("div",{className:"count",children:[(0,n.jsx)("div",{className:"n",children:W.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:W.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:W.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:W.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:W.failed}),(0,n.jsx)("div",{className:"k",children:e("reg.failedCount")})]})]})]}),i&&(0,n.jsx)("div",{className:"panel err",children:i}),(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsxs)("div",{className:"toolbar",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"f-session",style:{margin:0},children:e("reg.filterSession")}),(0,n.jsxs)("select",{id:"f-session",value:p,onChange:e=>x(e.target.value),children:[(0,n.jsx)("option",{value:"",children:e("reg.allSessions")}),C.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=>b(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")})]})]}),M&&(0,n.jsx)("button",{className:"quiet",onClick:()=>{x(""),v(""),b("")},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===A.length&&(0,n.jsx)("div",{className:"empty",children:e("reg.noMatch")})]}),"list"===h&&A.length>0&&(0,n.jsx)(R,{entries:[...G,...O,...E]}),"runs"===h&&A.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")})]}),H.runs.map(e=>(0,n.jsxs)("section",{className:"panel",children:[(0,n.jsx)(S,{run:e}),(0,n.jsx)(I,{entries:e.entries,sizes:P,onChange:()=>void y()})]},e.id)),H.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)(I,{entries:H.loose,sizes:P,onChange:()=>void y()})]})]}),"flow"===h&&(0,n.jsxs)(n.Fragment,{children:[G.length>0&&(0,n.jsxs)("section",{className:"panel",children:[(0,n.jsx)("h2",{children:e("reg.activeNow")}),(0,n.jsx)(I,{entries:G,sizes:P,onChange:()=>void y()})]}),A.length>0&&(0,n.jsxs)("section",{className:"panel",children:[(0,n.jsx)("h2",{children:e("reg.upcoming")}),(0,n.jsx)("p",{className:"muted small",children:e("reg.upcomingHint")}),(0,n.jsx)(g,{onChange:()=>void y()}),(0,n.jsx)(q,{entries:A,onChange:()=>void y()}),0===D.length?(0,n.jsx)("div",{className:"empty",children:e("reg.noUpcoming")}):(0,n.jsx)(I,{entries:D,upcoming:!0,sizes:P,onChange:()=>void y()})]}),A.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===E.length?(0,n.jsx)("div",{className:"empty",children:e("reg.noPast")}):(0,n.jsx)(F,{entries:E,sizes:P,onChange:()=>void y()})]})]})]})}function I(e){let{entries:s,upcoming:t=!1,sizes:l,onChange:g,picking:x}=e,{t:v}=(0,c.kj)(),k=(0,c.W3)(),b=(0,p.e)(null!=g?g:()=>void 0),w=(0,o.c)(s.some(d.DG)),[y,I]=(0,a.useState)(null),[S,F]=(0,a.useState)(new Set);return(0,n.jsxs)(n.Fragment,{children:[y&&(0,n.jsx)(A,{entry:y,onClose:e=>{I(null),e&&(null==g||g())}}),(0,n.jsx)("ol",{className:"flow",children:s.map(e=>{var s,a,o,c,g,p,y,A,T,q,R,W,P,H,G,O,D,E,M,_,B,z;let L=t&&1===e.queuePosition,U=e.runGroup?null!=(y=null==l?void 0:l.get(e.runGroup.id))?y:1:0;return(0,n.jsxs)("li",{className:"".concat(e.status).concat(L?" next":""),children:[(0,n.jsxs)("div",{className:"head",children:[x&&(0,n.jsx)("input",{type:"checkbox",className:"pick","aria-label":e.title,checked:x.picked.has("".concat(e.sessionId,":").concat(e.taskId)),onChange:()=>x.toggle("".concat(e.sessionId,":").concat(e.taskId))}),(0,n.jsx)("strong",{children:e.title}),(0,n.jsx)("span",{className:"badge ".concat(e.status),children:v("status.".concat(e.status))}),L&&(0,n.jsx)("span",{className:"chip",children:v("reg.next")}),t&&f.includes(e.status)&&(0,n.jsx)("span",{className:"chip",title:v("reg.willRequeueFirstWhy"),children:v("reg.willRequeueFirst")}),e.sessionRunning&&(0,n.jsx)("span",{className:"chip",children:v("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?v("review.ran",{n:e.review.stepsRun}):void 0,children:[v("review.verdict.".concat(e.review.verdict)),e.review.findings>0?" (".concat(e.review.findings,")"):""]}),(null!=(A=e.deviations)?A:0)>0&&(0,n.jsx)("span",{className:"badge waiting-approval",title:v("reg.deviationsWhy"),children:v("reg.deviations",{n:null!=(T=e.deviations)?T:0})}),(null!=(q=e.disputes)?q:0)>0&&(0,n.jsx)("span",{className:"badge waiting-approval",title:v("reg.disputesWhy"),children:v("reg.disputes",{n:null!=(R=e.disputes)?R:0})}),e.readOnly&&(0,n.jsx)("span",{className:"chip",title:v("reg.readOnlyWhy"),children:v("task.readOnly")}),(null!=(W=e.autoRetries)?W:0)>0&&(0,n.jsx)("span",{className:"badge ".concat("done"===e.status?"done":"blocked"),title:v("reg.retriedFreshWhy"),children:"done"===e.status?v("reg.retriedFreshDone",{n:null!=(P=e.autoRetries)?P:0}):v("reg.retriedFreshStill",{n:null!=(H=e.autoRetries)?H:0})}),e.runGroup&&(0,n.jsx)("span",{className:"chip",title:v("reg.runTitle",{t:U,s:e.runGroup.sessions,when:k(e.runGroup.startedAt)}),children:U>1?v("reg.runWith",{n:U-1}):v("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?v("task.started",{t:k(e.startedAt)}):v("task.added",{t:k(e.createdAt)}),e.finishedAt?" \xb7 ".concat(v("task.finished",{t:k(e.finishedAt)})):"",void 0!==e.durationMs?" \xb7 ".concat(v("reg.took",{d:(0,r.c5)(e.durationMs)})):"",(0,d.DG)(e)?" \xb7 ".concat(v("task.runningFor",{d:(0,r.c5)((0,d.d5)(e.startedAt,void 0,w))})):"",e.iterations>0?" \xb7 ".concat(v("reg.iterations",{n:e.iterations})):""]}),"queued"===e.status&&(0,n.jsx)("div",{className:"when",children:e.queuePosition&&e.queuePosition>1?v("reg.willFollow",{n:e.queuePosition-1}):e.sessionRunning?v("reg.queuePos",{n:null!=(G=e.queuePosition)?G:1}):v("reg.waitingRun")}),"blocked"===e.status&&(0,n.jsx)("p",{className:"what muted small",children:v("reg.blockedWhat")}),(null!=(O=null==(s=e.attempts)?void 0:s.length)?O:0)>0&&(0,n.jsxs)("details",{className:"small",style:{marginTop:6},children:[(0,n.jsx)("summary",{children:(null!=(D=null==(a=e.attempts)?void 0:a.length)?D:0)===1?v("reg.attemptsOne",{n:null!=(M=e.attempt)?M:(null!=(E=null==(o=e.attempts)?void 0:o.length)?E:0)+1}):v("reg.attempts",{n:null!=(B=e.attempt)?B:(null!=(_=null==(c=e.attempts)?void 0:c.length)?_:0)+1,m:null!=(z=null==(g=e.attempts)?void 0:g.length)?z:0})}),(0,n.jsx)("ol",{className:"attempts",children:null==(p=e.attempts)?void 0:p.map(s=>{var t;return(0,n.jsxs)("li",{children:[(0,n.jsxs)("div",{className:"head",children:[(0,n.jsx)("strong",{children:v("reg.attemptN",{n:s.attempt})}),(0,n.jsx)("span",{className:"badge ".concat(s.status),children:v("status.".concat(s.status))}),s.iterations>0&&(0,n.jsx)("span",{className:"muted",children:v("reg.iterations",{n:s.iterations})}),void 0!==s.durationMs&&(0,n.jsx)("span",{className:"muted",children:v("reg.took",{d:(0,r.c5)(s.durationMs)})}),s.runId&&(0,n.jsx)(u.u,{label:v("save.attemptLog"),save:()=>r.FH.saveTaskLog(e.sessionId,e.taskId,s.runId)}),s.runId&&(0,n.jsx)(u.H,{sessionId:e.sessionId,taskId:e.taskId,attempt:s.attempt}),s.runId&&void 0!==s.changedFiles&&(0,n.jsx)(j.C,{sessionId:e.sessionId,taskId:e.taskId,runId:s.runId,title:"".concat(e.title," — ").concat(v("reg.attemptN",{n:s.attempt})),files:s.changedFiles})]}),(0,n.jsxs)("div",{className:"when",children:[s.startedAt?v("task.started",{t:k(s.startedAt)}):"",s.finishedAt?" \xb7 ".concat(v("task.finished",{t:k(s.finishedAt)})):"",s.branch?" \xb7 ".concat(s.branch):""]}),s.reason&&(0,n.jsx)("p",{className:"what err",children:v("reg.stopped",{reason:s.reason})}),s.summary&&(0,n.jsx)(h.s,{text:s.summary,className:"what"})]},"".concat(null!=(t=s.runId)?t:s.attempt))})})]}),e.summary&&(0,n.jsx)(h.s,{text:e.summary,className:"what"}),e.reason&&(0,n.jsx)("p",{className:"what err",children:v("reg.stopped",{reason:e.reason})}),b.message&&(0,n.jsx)("p",{className:"what small",children:b.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:v("reg.openTask")}),e.runId&&(0,n.jsx)(u.u,{label:v("save.log"),save:()=>r.FH.saveTaskLog(e.sessionId,e.taskId)}),e.chatUrl&&(0,n.jsx)("a",{href:e.chatUrl,target:"_blank",rel:"noreferrer",children:v("home.col.chat")}),e.startedAt&&(0,n.jsx)(C,{where:{session:e.sessionId,task:e.taskId}}),void 0!==e.changedFiles&&(0,n.jsx)(j.C,{sessionId:e.sessionId,taskId:e.taskId,title:e.title,files:e.changedFiles}),(0,n.jsx)(m,{}),e.runId&&(0,n.jsxs)("button",{className:S.has(e.taskId)?"":"quiet",onClick:()=>{let s;return s=e.taskId,F(e=>{let t=new Set(e);return t.has(s)?t.delete(s):t.add(s),t})},title:(0,d.DG)(e)?v("story.showLiveWhy"):v("story.why"),children:[(0,d.DG)(e)&&!S.has(e.taskId)&&(0,n.jsx)("span",{className:"dot","aria-hidden":"true"}),S.has(e.taskId)?v("story.hide"):(0,d.DG)(e)?v("story.showLive"):v("story.show")]}),f.includes(e.status)&&!e.sessionRunning&&(0,n.jsx)("button",{className:"quiet",onClick:()=>I(e),title:v("reg.fixPromptHint"),children:v("reg.fixPrompt")}),"done"===e.status&&!e.sessionRunning&&(0,n.jsx)("button",{className:"quiet",onClick:()=>I(e),title:v("reg.newPromptHint"),children:v("reg.newPrompt")}),e.startedAt&&!e.sessionRunning&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{className:"quiet",disabled:""!==b.busy,title:v("restore.why"),onClick:()=>void b.restore({sessionId:e.sessionId,taskId:e.taskId,title:e.title}),children:"restore"===b.busy?v("restore.checking"):v("restore.button")}),(0,n.jsx)("button",{className:"quiet",disabled:""!==b.busy,title:v("restart.why"),onClick:()=>void b.restartFrom({sessionId:e.sessionId,taskId:e.taskId,title:e.title}),children:"restart"===b.busy?v("restart.checking"):v("restart.button")})]})]}),S.has(e.taskId)&&e.runId&&(0,n.jsx)(N.P,{sessionId:e.sessionId,taskId:e.taskId,live:"running"===e.status||"waiting-approval"===e.status})]},"".concat(e.sessionId,"-").concat(e.taskId))})})]})}function C(e){let{where:s}=e,{t}=(0,c.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 S(e){var s;let{run:t}=e,{t:a}=(0,c.kj)(),l=(0,c.W3)(),i=null!=(s=t.entries.map(e=>{var s;return null==(s=e.runGroup)?void 0:s.name}).find(Boolean))?s:a("reg.runUnnamed"),r=t.entries.filter(e=>"done"===e.status).length,d=t.entries.filter(e=>f.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)(b,{run:t})]})]}),(0,n.jsxs)("div",{className:"row small",style:{marginTop:4},children:[(0,n.jsx)("span",{className:"badge ".concat(d>0?"failed":r===t.entries.length?"done":""),children:a("reg.runCounts",{done:r,failed:d})}),(0,n.jsx)(C,{where:{run:t.id}})]})]})}function F(e){let{entries:s,sizes:t,onChange:l}=e,{t:i}=(0,c.kj)(),d=(0,a.useMemo)(()=>w(s),[s]),[o,u]=(0,a.useState)(!1),[h,m]=(0,a.useState)(new Set),[g,p]=(0,a.useState)(!1),[x,j]=(0,a.useState)(""),[v,N]=(0,a.useState)(""),k=e=>"".concat(e.sessionId,":").concat(e.taskId),f=s.filter(e=>e.startedAt),b=[...h],y=async()=>{p(!0),N(""),j("");try{let e=await r.FH.downloadBundle(b.map(e=>{let[s,t]=e.split(":");return{sessionId:s,taskId:t}}));j(i("reg.bundleSaved",{name:e}))}catch(e){N(e.message)}finally{p(!1)}},C=o?{picked:h,toggle:e=>m(s=>{let t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})}:void 0;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"row small",style:{marginBottom:8},children:[o?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{className:"quiet",onClick:()=>{u(!1),m(new Set),j(""),N("")},children:i("reg.pickDone")}),(0,n.jsx)("button",{className:"quiet",onClick:()=>m(new Set(f.map(k))),children:i("reg.pickAll")}),(0,n.jsx)("button",{className:"quiet",onClick:()=>m(new Set),children:i("reg.pickNone")}),(0,n.jsx)("span",{className:"muted",children:h.size>0?i("reg.pickedN",{n:h.size}):i("reg.pickedNone")}),h.size>0&&(0,n.jsx)("button",{className:"primary",disabled:g,onClick:()=>void y(),title:i("reg.bundleWhy"),children:i("reg.bundle",{n:h.size})})]}):(0,n.jsx)("button",{className:"quiet",onClick:()=>u(!0),title:i("reg.pickWhy"),children:i("reg.pick")}),x&&(0,n.jsx)("span",{className:"muted",children:x}),v&&(0,n.jsx)("span",{className:"err",children:v})]}),d.runs.map((e,s)=>(0,n.jsxs)("details",{className:"run-fold",open:0===s||o,children:[(0,n.jsx)("summary",{children:(0,n.jsx)(S,{run:e})}),(0,n.jsx)(I,{entries:e.entries,sizes:t,onChange:l,picking:C})]},e.id)),d.loose.length>0&&(0,n.jsxs)("details",{className:"run-fold",open:0===d.runs.length||o,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)(I,{entries:d.loose,sizes:t,onChange:l,picking:C})]})]})}function A(e){let{entry:s,onClose:t}=e,{t:l}=(0,c.kj)(),[i,d]=(0,a.useState)(null),[o,u]=(0,a.useState)(""),[h,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=!0;return r.FH.session(s.sessionId).then(t=>{var n;let a=t.tasks.find(e=>e.id===s.taskId);e&&d(null!=(n=null==a?void 0:a.prompt)?n:"")}).catch(s=>{e&&u(s.message)}),()=>{e=!1}},[s.sessionId,s.taskId]);let g=async()=>{if(null!==i){m(!0),u("");try{await r.FH.rerunTask(s.sessionId,s.taskId,{prompt:i},{buildOnFinished:"done"===s.status}),u(l("reg.fixPromptSaved",{title:s.title})),setTimeout(()=>t(!0),900)}catch(e){u(e.message),m(!1)}}};return(0,n.jsx)("div",{className:"modal-backdrop",role:"presentation",onClick:()=>t(!1),children:(0,n.jsxs)("div",{className:"modal wide",role:"dialog","aria-modal":"true","aria-labelledby":"fix-title",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{id:"fix-title",children:l("reg.fixPromptTitle",{title:s.title})}),(0,n.jsx)("p",{className:"muted small",children:l("done"===s.status?"reg.newPromptHint":"reg.fixPromptHint")}),s.reason&&(0,n.jsx)("p",{className:"what err small",children:l("reg.stopped",{reason:s.reason})}),null===i?(0,n.jsx)("p",{className:"muted small",children:o||l("reg.fixPromptLoading")}):(0,n.jsx)("textarea",{className:"prose",value:i,onChange:e=>d(e.target.value),style:{minHeight:260},disabled:h}),(0,n.jsxs)("div",{className:"row modal-actions",children:[o&&null!==i&&(0,n.jsx)("span",{className:"small grow",children:o}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>t(!1),disabled:h,children:l("dialog.cancel")}),(0,n.jsx)("button",{type:"button",className:"primary",onClick:()=>void g(),disabled:h||null===i||!i.trim(),children:l("reg.fixPromptSave")})]})]})})}function T(e){let{sessions:s}=e,{t}=(0,c.kj)();return(0,n.jsxs)("div",{className:"row",style:{margin:"14px 0 18px"},children:[(0,n.jsx)(i(),{href:"/#new-session",children:(0,n.jsx)("button",{className:"primary",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 q(e){let{entries:s,onChange:t}=e,{t:l}=(0,c.kj)(),[i,d]=(0,a.useState)(!1),[o,u]=(0,a.useState)(""),[h,m]=(0,a.useState)(!1),[g,p]=(0,a.useState)(new Set),[j,N]=(0,a.useState)(null),k=s.filter(e=>"queued"===e.status),b=s.filter(e=>f.includes(e.status)&&!e.sessionRunning),w=s.some(e=>e.sessionRunning),y=b.filter(e=>"stop"===e.sessionOnFailure),I=b.filter(e=>"stop"!==e.sessionOnFailure),C=[...k,...b],S=C.filter(e=>g.has(e.taskId)),F=b.filter(e=>g.has(e.taskId)),T=k.filter(e=>g.has(e.taskId)),q=[...new Set([...S].sort((e,s)=>{var t,n;return(null!=(t=e.sessionRunOrder)?t:Number.MAX_SAFE_INTEGER)-(null!=(n=s.sessionRunOrder)?n:Number.MAX_SAFE_INTEGER)||e.position-s.position}).map(e=>e.sessionId))],R=S.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),[W,P]=(0,a.useState)(""),H=y.length>0?l("reg.continueWithFailed",{f:y.length,n:k.length,s:q.length}):l("reg.continue",{n:k.length,s:q.length}),G=(0,v.p)(),O=async e=>{if("unattended"!==e||G||await (0,x.Z)(l("batch.unattendedConfirm",{n:q.length}))){d(!0),u("");try{var s;for(let e of F)await r.FH.rerunTask(e.sessionId,e.taskId);let n=await r.FH.startBatch(q,e,"stop",void 0,void 0,W.trim()||void 0,S.map(e=>e.taskId));u(n.started?l("reg.continueStarted",{n:q.length}):l("batch.notStarted",{reason:null!=(s=n.reason)?s:""})),m(!1),t()}catch(e){u(e.message)}finally{d(!1)}}};return 0===k.length&&0===b.length?null:(0,n.jsxs)("div",{style:{marginBottom:8},children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("button",{className:"primary",disabled:i||w,onClick:()=>{p(new Set(C.map(e=>e.taskId))),m(!0),u(""),r.FH.suggestedRunName(q).then(e=>P(e.name)).catch(()=>void 0)},title:l("reg.continueWhy"),children:H}),w&&(0,n.jsx)("span",{className:"muted small",children:l("reg.continueRunning")}),o&&(0,n.jsx)("span",{className:"small",children:o})]}),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 small",style:{marginTop:6},children:[(0,n.jsx)("button",{className:"quiet small",onClick:()=>p(new Set(C.map(e=>e.taskId))),children:l("reg.pickAll")}),(0,n.jsx)("button",{className:"quiet small",onClick:()=>p(new Set),children:l("reg.pickNone")})]}),[{key:"chain",entries:y,intro:l("reg.continueChain"),fix:!0},{key:"loose",entries:I,intro:l("reg.continueIndependent"),fix:!0},{key:"queued",entries:k,intro:l("reg.continueQueued"),fix:!1}].filter(e=>e.entries.length>0).map(e=>(0,n.jsxs)("div",{style:{marginTop:6},children:[(0,n.jsx)("div",{className:"small",children:e.intro}),(0,n.jsx)("ul",{className:"small",style:{margin:"4px 0",paddingLeft:18,listStyle:"none"},children:e.entries.map(s=>(0,n.jsxs)("li",{children:[(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:g.has(s.taskId),onChange:e=>{let t,n;return t=s.taskId,n=e.target.checked,p(e=>{let s=new Set(e);return n?s.add(t):s.delete(t),s})}}),(0,n.jsx)("strong",{children:s.title})," \xb7 ",s.sessionName," \xb7 ",(0,n.jsx)("span",{className:"badge ".concat(s.status),children:l("status.".concat(s.status))})]})," ",(0,n.jsx)("button",{className:"quiet small",onClick:()=>p(new Set([s.taskId])),title:l("reg.pickOnlyWhy"),children:l("reg.pickOnly")}),e.fix&&(0,n.jsxs)(n.Fragment,{children:[" ",(0,n.jsx)("button",{className:"quiet small",onClick:()=>N(s),title:l("reg.fixPromptHint"),children:l("reg.fixPrompt")})]})]},s.taskId))})]},e.key)),R.length>0&&(0,n.jsx)("div",{className:"notice caution small",style:{marginTop:6},children:R.map(e=>(0,n.jsx)("div",{children:l("reg.continueGap",{task:e.e.title,before:e.before.title,session:e.e.sessionName})},e.e.taskId))}),(0,n.jsxs)("div",{style:{marginTop:8},children:[(0,n.jsx)("label",{htmlFor:"continue-run-name",children:l("batch.runName")}),(0,n.jsx)("input",{id:"continue-run-name",type:"text",value:W,onChange:e=>P(e.target.value),placeholder:l("batch.runNamePlaceholder"),disabled:i}),(0,n.jsx)("p",{className:"why",children:l("reg.continueNameWhy")})]}),(0,n.jsx)("div",{className:"small",style:{marginTop:6},children:l("reg.continueSummary",{q:T.length,r:F.length,s:q.length})}),(0,n.jsxs)("div",{className:"row",style:{marginTop:8},children:[(0,n.jsx)("button",{className:"primary",disabled:i||0===q.length,onClick:()=>void O("unattended"),title:l("reg.continueUnattendedWhy"),children:l("reg.continueUnattended")}),(0,n.jsx)("button",{disabled:i||0===q.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)(A,{entry:j,onClose:e=>{N(null),e&&t()}})]})}function R(e){let{entries:s}=e,{t}=(0,c.kj)(),a=(0,c.W3)();return(0,n.jsx)("div",{className:"panel",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:t("reg.col.task")}),(0,n.jsx)("th",{children:t("reg.col.session")}),(0,n.jsx)("th",{children:t("reg.col.status")}),(0,n.jsx)("th",{children:t("reg.col.started")}),(0,n.jsx)("th",{children:t("reg.col.took")}),(0,n.jsx)("th",{children:t("reg.col.result")})]})}),(0,n.jsx)("tbody",{children:s.map(e=>{var s;return(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{children:(0,n.jsx)(i(),{href:(0,r.aT)(e.sessionId,e.taskId),children:e.title})}),(0,n.jsx)("td",{children:(0,n.jsx)(i(),{href:(0,r.aT)(e.sessionId),children:e.sessionName})}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"badge ".concat(e.status),children:t("status.".concat(e.status))})}),(0,n.jsx)("td",{className:"muted small",children:e.startedAt?a(e.startedAt):"—"}),(0,n.jsx)("td",{className:"muted small",children:(0,r.c5)(e.durationMs)||"—"}),(0,n.jsx)("td",{className:"small",children:null!=(s=e.summary)?s:e.reason?(0,n.jsx)("span",{className:"err",children:e.reason}):"—"})]},"".concat(e.sessionId,"-").concat(e.taskId))})})]})})}}},e=>{e.O(0,[197,867,549,723,347,131,358],()=>e(e.s=3256)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[322],{1035:(e,a,s)=>{"use strict";s.d(a,{DialogHost:()=>o,Z:()=>c});var n=s(3365),l=s(1521),t=s(867);let i=null,r=[];function c(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(s=>{var n;return n={kind:"confirm",message:e,...a,resolve:s},void(i?i(n):r.push(n))})}function o(e){var a,s;let{children:c}=e,{t:o}=(0,t.kj)(),[d,p]=(0,l.useState)([]),m=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(i=e=>p(a=>[...a,e]),r.length>0){let e=r.splice(0,r.length);p(a=>[...a,...e])}return()=>{i=null}},[]);let u=d[0],h=(0,l.useCallback)(e=>{u&&(u.resolve(e),p(e=>e.slice(1)))},[u]);return(0,l.useEffect)(()=>{var e;if(!u)return;null==(e=m.current)||e.focus();let a=e=>{"Escape"===e.key&&(e.preventDefault(),h(!1))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[u,h]),(0,n.jsxs)(n.Fragment,{children:[c,u&&(0,n.jsx)("div",{className:"modal-backdrop",onClick:()=>h(!1),role:"presentation",children:(0,n.jsxs)("div",{className:"modal".concat(u.danger?" danger":""),role:"confirm"===u.kind?"alertdialog":"dialog","aria-modal":"true","aria-labelledby":"modal-title",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{id:"modal-title",children:null!=(a=u.title)?a:o("confirm"===u.kind?"dialog.confirmTitle":"dialog.noticeTitle")}),(0,n.jsx)("div",{className:"modal-body",children:u.message}),(0,n.jsxs)("div",{className:"row modal-actions",children:["confirm"===u.kind&&(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>h(!1),children:o("dialog.cancel")}),(0,n.jsx)("button",{ref:m,type:"button",className:u.danger?"danger":"primary",onClick:()=>h(!0),children:null!=(s=u.okLabel)?s:o("dialog.ok")})]})]})})]})}},5515:(e,a,s)=>{Promise.resolve().then(s.bind(s,9262))},9262:(e,a,s)=>{"use strict";s.r(a),s.d(a,{default:()=>d});var n=s(3365),l=s(1521),t=s(8197),i=s.n(t),r=s(5549),c=s(1035),o=s(867);function d(){var e,a;let{t:s,locale:t}=(0,o.kj)(),d=(0,o.W3)(),[p,u]=(0,l.useState)(""),[h,x]=(0,l.useState)(""),[j,v]=(0,l.useState)(!1),[g,y]=(0,l.useState)(""),[f,k]=(0,l.useState)(""),[N,w]=(0,l.useState)(0),[b,C]=(0,l.useState)(""),[S,H]=(0,l.useState)(!1),[T,F]=(0,l.useState)(null),[P,E]=(0,l.useState)(""),[D,A]=(0,l.useState)(""),L=(0,l.useRef)(null),[R,W]=(0,l.useState)(null);(0,l.useEffect)(()=>{let e=!1;return r.FH.planBrief(t).then(a=>{e||(u(a.text),x(a.software),k(""))}).catch(a=>{e||k(a.message)}),()=>{e=!0}},[t,N]);let B=(0,l.useCallback)(async(e,a)=>{try{await navigator.clipboard.writeText(a),y(e),window.setTimeout(()=>y(""),2500)}catch(e){A(s("plan.copyFailed"))}},[s]),Z=(0,l.useCallback)(async e=>{if(e.size>2097152)return void A(s("plan.fileTooBig",{size:"".concat(Math.round(e.size/1024)," KB")}));try{C(await e.text()),F(null),W(null),A("")}catch(e){A(s("plan.fileError",{reason:e.message}))}},[s]),_=async()=>{E("check"),A("");try{F(await r.FH.checkPlan(b))}catch(e){A(e.message)}finally{E("")}},O=async()=>{var e;let a=T&&!T.ok?[]:null!=(e=null==T?void 0:T.duplicates)?e:[];if(a.length>0){let e=a.map(e=>"• ".concat(e.name," (").concat(e.tasks,")")).join("\n");if(!await (0,c.Z)(s("plan.duplicateConfirm",{names:e})))return}E("import"),A("");try{let e=await r.FH.importPlan(b);e.ok?(W(e),F({ok:!0,warnings:e.result.warnings,summary:e.summary,duplicates:e.duplicates}),C("")):(W(null),F(e.check))}catch(e){A(e.message)}finally{E("")}},q=(T&&!T.ok?T.issues:[]).map(e=>e.path?"- ".concat(e.path,": ").concat(e.message):"- ".concat(e.message)).join("\n");return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("h2",{children:s("plan.title")}),(0,n.jsx)("p",{className:"muted small",children:s("plan.intro")})]}),(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("h2",{children:s("plan.step1")}),(0,n.jsx)("p",{className:"muted small",children:s("plan.step1Hint")}),(0,n.jsx)("h3",{children:s("plan.briefAsks")}),(0,n.jsx)("p",{className:"why",children:s("plan.briefAsksWhy")}),(0,n.jsxs)("div",{className:"row",style:{marginTop:12},children:[(0,n.jsx)("button",{className:"primary",onClick:()=>void B("brief",p),disabled:!p,children:s("plan.copyBrief")}),"brief"===g&&(0,n.jsx)("span",{className:"badge done",children:s("plan.copied")}),(0,n.jsx)("span",{className:"muted small",children:s("plan.briefLang")})]}),f&&(0,n.jsx)("div",{className:"err",children:f}),(0,n.jsx)("h3",{style:{marginTop:16},children:s("plan.persona")}),(0,n.jsx)("p",{className:"why",children:s("plan.personaWhy")}),(0,n.jsxs)("details",{style:{marginTop:8},open:j,onToggle:e=>v(e.target.open),children:[(0,n.jsx)("summary",{children:s("plan.softwarePart")}),(0,n.jsx)("textarea",{readOnly:!0,value:h,style:{minHeight:380,marginTop:10}})]}),(0,n.jsx)(m,{kind:"organisation",onSaved:()=>w(e=>e+1)}),(0,n.jsx)(m,{kind:"persona",onSaved:()=>w(e=>e+1)}),(0,n.jsx)(m,{kind:"work",onSaved:()=>w(e=>e+1)})]}),(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("h2",{children:s("plan.step2")}),(0,n.jsx)("p",{className:"muted small",children:s("plan.step2Hint")}),(0,n.jsxs)("div",{className:"dropzone".concat(S?" active":""),onDragOver:e=>{e.preventDefault(),H(!0)},onDragLeave:()=>H(!1),onDrop:e=>{var a;e.preventDefault(),H(!1);let s=null==(a=e.dataTransfer.files)?void 0:a[0];s&&Z(s)},children:[(0,n.jsx)("textarea",{className:"grow",placeholder:s("plan.placeholder"),value:b,onChange:e=>{C(e.target.value),F(null),W(null)},style:{minHeight:220,width:"100%"}}),(0,n.jsx)("p",{className:"muted small",children:S?s("plan.dropActive"):s("plan.drop")})]}),(0,n.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,n.jsx)("button",{onClick:()=>{var e;return null==(e=L.current)?void 0:e.click()},children:s("plan.browse")}),(0,n.jsx)("input",{ref:L,type:"file",accept:".json,application/json,text/plain",style:{display:"none"},onChange:e=>{var a;let s=null==(a=e.target.files)?void 0:a[0];s&&Z(s),e.target.value=""}}),(0,n.jsx)("button",{onClick:()=>void _(),disabled:!b.trim()||""!==P,children:"check"===P?s("plan.checking"):s("plan.check")}),(0,n.jsx)("button",{className:"primary",onClick:()=>void O(),disabled:!b.trim()||""!==P,children:"import"===P?s("plan.importing"):s("plan.import")}),(0,n.jsx)("button",{className:"quiet",onClick:()=>{C(""),F(null),W(null),A("")},disabled:!b&&!T,children:s("plan.clear")})]}),D&&(0,n.jsx)("div",{className:"err",children:D}),R&&""===b.trim()&&(0,n.jsx)("p",{className:"why",children:s("plan.cleared")})]}),T&&!T.ok&&(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("div",{className:"notice",children:(0,n.jsx)("strong",{children:s("plan.invalid")})}),(0,n.jsx)("h3",{children:s("plan.issues")}),(0,n.jsx)("p",{className:"muted small",children:s("plan.issuesHint")}),(0,n.jsx)("pre",{children:q}),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("button",{onClick:()=>void B("issues",q),children:s("plan.copyIssues")}),"issues"===g&&(0,n.jsx)("span",{className:"badge done",children:s("plan.copied")})]})]}),(null!=(e=null==T?void 0:T.duplicates.length)?e:0)>0&&(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsxs)("div",{className:"notice caution",children:[(0,n.jsx)("strong",{children:s("plan.duplicates")}),(0,n.jsx)("ul",{children:(null!=(a=null==T?void 0:T.duplicates)?a:[]).map(e=>(0,n.jsx)("li",{children:(0,n.jsx)(i(),{href:(0,r.aT)(e.sessionId),children:s("plan.duplicateRow",{name:e.name,tasks:e.tasks,when:d(e.createdAt)})})},e.sessionId))})]}),(0,n.jsx)("p",{className:"muted small",children:s("plan.duplicatesHint")})]}),(null==T?void 0:T.ok)&&(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("div",{className:"notice calm",children:(0,n.jsx)("strong",{children:R?s("plan.imported",{sessions:R.result.sessions.length,tasks:R.result.taskCount}):s("plan.valid",{sessions:T.summary.sessions.length,tasks:T.summary.taskCount})})}),T.summary.plan&&(0,n.jsx)("p",{children:T.summary.plan}),(0,n.jsxs)("p",{className:"muted small",children:[s("plan.col.planFail"),":"," ","continue"===T.summary.onFailure?s("batch.independent"):s("batch.chain")]}),(0,n.jsx)("h3",{children:s("plan.preview")}),(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:s("plan.col.session")}),(0,n.jsx)("th",{children:s("plan.col.tasks")}),(0,n.jsx)("th",{children:s("plan.col.chain")}),(0,n.jsx)("th",{children:s("plan.col.repo")})]})}),(0,n.jsx)("tbody",{children:T.summary.sessions.map((e,a)=>{let l=null==R?void 0:R.result.sessions[a];return(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{children:l?(0,n.jsx)(i(),{href:(0,r.aT)(l.id),children:e.name}):e.name}),(0,n.jsxs)("td",{className:"small",children:[e.tasks.length,(0,n.jsx)("div",{className:"muted small",children:e.tasks.join(", ")})]}),(0,n.jsx)("td",{className:"small",children:"continue"===e.onFailure?s("chain.continue"):s("chain.stop")}),(0,n.jsx)("td",{className:"small muted",children:e.repoDir||s("plan.noRepo")})]},"".concat(e.name,"-").concat(a))})})]}),T.summary.notes&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("h3",{children:s("plan.notes")}),(0,n.jsx)("p",{className:"muted small",style:{whiteSpace:"pre-wrap"},children:T.summary.notes})]}),T.warnings.length>0&&(0,n.jsxs)("div",{className:"notice caution",children:[(0,n.jsx)("strong",{children:s("plan.warnings")}),(0,n.jsx)("ul",{children:T.warnings.map(e=>(0,n.jsx)("li",{children:e},e))})]})]}),R&&(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("h2",{children:s("plan.step3")}),(0,n.jsx)("p",{className:"muted small",children:s("plan.step3Hint")}),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)(i(),{href:"/?run=".concat(encodeURIComponent(R.result.sessions.map(e=>e.id).join(",")),"&fail=").concat(R.summary.onFailure),children:(0,n.jsx)("button",{className:"primary",children:s("plan.runThese")})}),(0,n.jsx)(i(),{href:"/",children:(0,n.jsx)("button",{children:s("plan.toSessions")})})]})]})]})}function p(e){var a,s;let{current:t,onLoad:i}=e,{t:d}=(0,o.kj)(),[p,m]=(0,l.useState)([]),[u,h]=(0,l.useState)(""),[x,j]=(0,l.useState)(""),v=(0,l.useCallback)(async()=>{try{m(await r.FH.personas())}catch(e){j(e.message)}},[]);(0,l.useEffect)(()=>{v()},[v]);let g=null!=(s=null==(a=p.find(e=>e.content===t))?void 0:a.name)?s:"",y=async e=>{let a=p.find(a=>a.name===e);a&&(!t.trim()||g||await (0,c.Z)(d("plan.personaReplaceConfirm",{name:e})))&&(i(a.content),h(a.name),j(d("plan.personaLoaded",{name:a.name})))},f=async()=>{let e=u.trim();if(e&&t.trim()&&(!p.some(a=>a.name===e)||await (0,c.Z)(d("plan.personaOverwriteConfirm",{name:e}))))try{let a=await r.FH.savePersona(e,t);h(a.name),j(d("plan.personaSavedAs",{name:a.name})),await v()}catch(e){j(e.message)}},k=async()=>{if(g&&await (0,c.Z)(d("plan.personaDeleteConfirm",{name:g})))try{await r.FH.deletePersona(g),j(d("plan.personaDeleted",{name:g})),await v()}catch(e){j(e.message)}};return(0,n.jsxs)("div",{className:"option",style:{marginBottom:8},children:[(0,n.jsx)("label",{htmlFor:"persona-shelf",children:d("plan.personaSaved")}),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsxs)("select",{id:"persona-shelf",value:g,onChange:e=>void y(e.target.value),style:{width:"auto",minWidth:260},children:[(0,n.jsx)("option",{value:"",children:0===p.length?d("plan.personaNone"):d("plan.personaPick")}),p.map(e=>(0,n.jsx)("option",{value:e.name,children:e.name},e.name))]}),(0,n.jsx)("button",{className:"quiet",onClick:()=>void k(),disabled:!g,children:d("plan.personaDelete")})]}),(0,n.jsxs)("div",{className:"row",style:{marginTop:6},children:[(0,n.jsx)("input",{type:"text",value:u,onChange:e=>h(e.target.value),placeholder:d("plan.personaNamePlaceholder"),"aria-label":d("plan.personaNamePlaceholder"),style:{maxWidth:360}}),(0,n.jsx)("button",{onClick:()=>void f(),disabled:!u.trim()||!t.trim(),children:d("plan.personaSaveAs")}),(0,n.jsx)("span",{className:"muted small",role:"status",children:x})]}),(0,n.jsx)("p",{className:"why",children:d("plan.personaSavedWhy")})]})}function m(e){let{kind:a,onSaved:s}=e,{t,locale:i}=(0,o.kj)(),[d,m]=(0,l.useState)(""),[u,h]=(0,l.useState)(""),[x,j]=(0,l.useState)(""),[v,g]=(0,l.useState)(!1),[y,f]=(0,l.useState)(""),k=(0,l.useRef)(null);(0,l.useEffect)(()=>{let e=!1;return r.FH.context(a,i).then(a=>{e||(m(a.content),h(a.content),j(a.example),g(a.customised))}).catch(e=>f(e.message)),()=>{e=!0}},[a,i]);let N=async e=>{try{await r.FH.setContext(a,e),h(e),g(""!==e.trim()),f(t("plan.ctxSaved")),s()}catch(e){f(e.message)}},w=async()=>{if(await (0,c.Z)(t("plan.ctxClearConfirm")))try{let e=await r.FH.resetContext(a,i);m(e.content),h(e.content),g(e.customised),f(t("plan.ctxCleared")),s()}catch(e){f(e.message)}},b="organisation"===a?t("plan.orgPart"):"persona"===a?t("plan.personaPart"):t("plan.workPart"),C="organisation"===a?t("plan.orgHint"):"persona"===a?t("plan.personaHint"):t("plan.workHint");return(0,n.jsxs)("details",{style:{marginTop:8},open:!0,children:[(0,n.jsxs)("summary",{children:[b," ",(0,n.jsxs)("span",{className:"muted small",children:["— ",v?t("plan.ctxWritten"):t("plan.ctxEmpty")]})]}),(0,n.jsx)("p",{className:"muted small",style:{marginTop:8},children:C}),"persona"===a&&(0,n.jsx)(p,{current:d,onLoad:e=>{m(e),N(e)}}),(0,n.jsx)("textarea",{value:d,onChange:e=>{var a;m(e.target.value),a=e.target.value,k.current&&clearTimeout(k.current),k.current=setTimeout(()=>void N(a),900)},onBlur:()=>d!==u&&void N(d),placeholder:x,style:{minHeight:220}}),(0,n.jsxs)("div",{className:"row",style:{marginTop:6},children:[(0,n.jsx)("button",{className:"quiet",onClick:()=>void w(),disabled:!v,children:t("plan.ctxClear")}),(0,n.jsx)("span",{className:"muted small",role:"status",children:y||t("def.savedAutomatically")})]})]})}}},e=>{e.O(0,[197,867,549,347,131,358],()=>e(e.s=5515)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[177],{952:()=>{},1035:(e,t,n)=>{"use strict";n.d(t,{DialogHost:()=>c,Z:()=>i});var a=n(3365),r=n(1521),l=n(867);let s=null,o=[];function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(n=>{var a;return a={kind:"confirm",message:e,...t,resolve:n},void(s?s(a):o.push(a))})}function c(e){var t,n;let{children:i}=e,{t:c}=(0,l.kj)(),[d,u]=(0,r.useState)([]),h=(0,r.useRef)(null);(0,r.useEffect)(()=>{if(s=e=>u(t=>[...t,e]),o.length>0){let e=o.splice(0,o.length);u(t=>[...t,...e])}return()=>{s=null}},[]);let m=d[0],v=(0,r.useCallback)(e=>{m&&(m.resolve(e),u(e=>e.slice(1)))},[m]);return(0,r.useEffect)(()=>{var e;if(!m)return;null==(e=h.current)||e.focus();let t=e=>{"Escape"===e.key&&(e.preventDefault(),v(!1))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[m,v]),(0,a.jsxs)(a.Fragment,{children:[i,m&&(0,a.jsx)("div",{className:"modal-backdrop",onClick:()=>v(!1),role:"presentation",children:(0,a.jsxs)("div",{className:"modal".concat(m.danger?" danger":""),role:"confirm"===m.kind?"alertdialog":"dialog","aria-modal":"true","aria-labelledby":"modal-title",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("h2",{id:"modal-title",children:null!=(t=m.title)?t:c("confirm"===m.kind?"dialog.confirmTitle":"dialog.noticeTitle")}),(0,a.jsx)("div",{className:"modal-body",children:m.message}),(0,a.jsxs)("div",{className:"row modal-actions",children:["confirm"===m.kind&&(0,a.jsx)("button",{type:"button",className:"quiet",onClick:()=>v(!1),children:c("dialog.cancel")}),(0,a.jsx)("button",{ref:h,type:"button",className:m.danger?"danger":"primary",onClick:()=>v(!0),children:null!=(n=m.okLabel)?n:c("dialog.ok")})]})]})})]})}},1205:(e,t,n)=>{"use strict";n.d(t,{AppearanceProvider:()=>d,K:()=>u,themeScript:()=>o});var a=n(3365),r=n(1521);let l={theme:"light",textSize:"normal",highContrast:!1,reduceMotion:!1,underlineLinks:!1,strongFocus:!1},s="cop.appearance",o="\n(function () {\n try {\n var d = document.documentElement;\n var raw = localStorage.getItem('".concat(s,"');\n var a = raw ? JSON.parse(raw) : {};\n d.dataset.theme = a.theme === 'dark' ? 'dark' : 'light';\n d.dataset.textsize = a.textSize || 'normal';\n d.dataset.contrast = a.highContrast ? 'high' : 'normal';\n d.dataset.motion = a.reduceMotion ? 'reduced' : 'normal';\n d.dataset.links = a.underlineLinks ? 'underline' : 'plain';\n d.dataset.focus = a.strongFocus ? 'strong' : 'normal';\n } catch (e) {}\n})();\n");function i(e){let t=document.documentElement;t.dataset.theme=e.theme,t.dataset.textsize=e.textSize,t.dataset.contrast=e.highContrast?"high":"normal",t.dataset.motion=e.reduceMotion?"reduced":"normal",t.dataset.links=e.underlineLinks?"underline":"plain",t.dataset.focus=e.strongFocus?"strong":"normal"}let c=(0,r.createContext)({appearance:l,set:()=>void 0,reset:()=>void 0,loaded:!1});function d(e){let{children:t}=e,[n,o]=(0,r.useState)(l),[d,u]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=l;try{let t=window.localStorage.getItem(s);t?e={...l,...JSON.parse(t)}:window.matchMedia("(prefers-color-scheme: dark)").matches&&(e={...e,theme:"dark"}),window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!t&&(e={...e,reduceMotion:!0})}catch(e){}o(e),i(e),u(!0)},[]);let h=(0,r.useCallback)(e=>{o(t=>{let n={...t,...e};i(n);try{window.localStorage.setItem(s,JSON.stringify(n))}catch(e){}return n})},[]),m=(0,r.useCallback)(()=>{o(l),i(l);try{window.localStorage.removeItem(s)}catch(e){}},[]);return(0,a.jsx)(c.Provider,{value:{appearance:n,set:h,reset:m,loaded:d},children:t})}function u(){return(0,r.useContext)(c)}},1702:(e,t,n)=>{"use strict";var a=n(9962);n.o(a,"usePathname")&&n.d(t,{usePathname:function(){return a.usePathname}}),n.o(a,"useSearchParams")&&n.d(t,{useSearchParams:function(){return a.useSearchParams}})},6657:(e,t,n)=>{"use strict";n.d(t,{GlobalApprovals:()=>d});var a=n(3365),r=n(1521),l=n(8197),s=n.n(l),o=n(5549),i=n(867),c=n(1035);function d(){let{t:e}=(0,i.kj)(),[t,n]=(0,r.useState)([]),[l,s]=(0,r.useState)({}),c=(0,r.useCallback)(async()=>{try{let e=await o.FH.approvals();if(n(e),e.some(e=>!l[e.sessionId])){let e=await o.FH.sessions().catch(()=>[]);s(Object.fromEntries(e.map(e=>[e.id,e.name])))}}catch(e){}},[l]);return((0,r.useEffect)(()=>{c();let e=setInterval(()=>void c(),2e3);return()=>clearInterval(e)},[c]),(0,r.useEffect)(()=>{let n="copilot-operator";document.title=t.length>0?"(".concat(t.length,") ").concat(e("approval.tabTitle")," — ").concat(n):n},[t.length,e]),0===t.length)?null:(0,a.jsxs)("section",{className:"approval-banner",role:"alert","aria-live":"assertive",children:[(0,a.jsx)("h2",{children:e("approval.waitingHere")}),(0,a.jsx)("p",{className:"small",children:e("approval.waitingHereWhy")}),t.map(e=>{var t;return(0,a.jsx)(u,{approval:e,sessionName:null!=(t=l[e.sessionId])?t:e.sessionId,onDecided:()=>void c()},e.id)})]})}function u(e){let{approval:t,sessionName:n,onDecided:l}=e,{t:d}=(0,i.kj)(),u=(0,i.W3)(),[h,m]=(0,r.useState)(!1),v=async e=>{if("run-all"!==e||await (0,c.Z)(d("approval.runAllConfirm"))){m(!0);try{await o.FH.decide(t.id,e)}finally{m(!1),l()}}};return(0,a.jsxs)("div",{className:"approval",children:[(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("strong",{children:d("approval.title",{n:t.stepId})}),(0,a.jsx)(s(),{href:(0,o.aT)(t.sessionId),children:n}),(0,a.jsx)("span",{className:"muted small",children:u(t.createdAt)})]}),(0,a.jsx)("pre",{style:{margin:"8px 0"},children:t.description}),t.network&&(0,a.jsx)("p",{className:"reason small",children:d("approval.network")}),(0,a.jsxs)("div",{className:"row",children:[(0,a.jsx)("button",{className:"primary",disabled:h,onClick:()=>void v("run"),children:d("approval.run")}),!t.network&&(0,a.jsx)("button",{disabled:h,onClick:()=>void v("run-all"),title:d("approval.runAllWhy"),children:d("approval.runAll")}),(0,a.jsx)("button",{disabled:h,onClick:()=>void v("skip"),children:d("approval.skip")}),(0,a.jsx)("button",{className:"danger",disabled:h,onClick:()=>void v("abort"),children:d("approval.abort")})]})]})}},7712:(e,t,n)=>{"use strict";n.d(t,{ScrollJump:()=>s});var a=n(3365),r=n(1521),l=n(867);function s(){let{t:e}=(0,l.kj)(),[t,n]=(0,r.useState)({long:!1,atTop:!0,atBottom:!1});return((0,r.useEffect)(()=>{let e=()=>{let e=document.documentElement;n({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 t=new ResizeObserver(e);return t.observe(document.body),()=>{window.removeEventListener("scroll",e),window.removeEventListener("resize",e),t.disconnect()}},[]),t.long)?(0,a.jsxs)("div",{className:"scroll-jump",children:[!t.atTop&&(0,a.jsx)("button",{type:"button","aria-label":e("scroll.top"),title:e("scroll.top"),onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),children:"↑"}),!t.atBottom&&(0,a.jsx)("button",{type:"button","aria-label":e("scroll.bottom"),title:e("scroll.bottom"),onClick:()=>window.scrollTo({top:document.documentElement.scrollHeight,behavior:"smooth"}),children:"↓"})]}):null}},8214:(e,t,n)=>{"use strict";n.d(t,{Nav:()=>m,SkipLink:()=>h});var a=n(3365),r=n(1521),l=n(8197),s=n.n(l),o=n(1702),i=n(5549),c=n(867);let d={sessions:(0,a.jsx)("path",{d:"M4 5h16v4H4zM4 11h16v4H4zM4 17h10v2H4z"}),defaults:(0,a.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,a.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,a.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,a.jsx)("path",{d:"M6 3h9l5 5v13H6zM14 3v6h6M9 13h7M9 17h7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),presets:(0,a.jsx)("path",{d:"M5 4h14v4H5zM5 10h14v4H5zM5 16h9v4H5z",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),appearance:(0,a.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,a.jsx)("path",{d:"M4 5h16v10H4zM2 19h20M9 15v4M15 15v4",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"})},u=[{href:"/",label:"nav.sessions",icon:"sessions"},{href:"/defaults",label:"nav.defaults",icon:"defaults"},{href:"/import",label:"nav.import",icon:"import"},{href:"/history",label:"nav.history",icon:"history"},{href:"/level1",label:"nav.level1",icon:"level1"},{href:"/presets",label:"nav.presets",icon:"presets"},{href:"/appearance",label:"nav.appearance",icon:"appearance"},{href:"/system",label:"nav.system",icon:"system"}];function h(){let{t:e}=(0,c.kj)();return(0,a.jsx)("a",{className:"skip-link",href:"#main",children:e("a11y.skip")})}function m(){let{t:e}=(0,c.kj)(),t=(0,o.usePathname)(),n=function(){let[e,t]=(0,r.useState)(0);return(0,r.useEffect)(()=>{let e=!0,n=()=>i.FH.activity().then(n=>{e&&t(n.sessions)}).catch(()=>void 0);n();let a=setInterval(n,4e3);return()=>{e=!1,clearInterval(a)}},[]),e}();return(0,a.jsxs)("nav",{"aria-label":e("nav.label"),children:[u.map(r=>(0,a.jsxs)(s(),{href:r.href,"aria-current":t===r.href?"page":void 0,children:[(0,a.jsx)("svg",{className:"nav-icon",viewBox:"0 0 24 24",width:"16",height:"16",fill:"currentColor","aria-hidden":"true",children:d[r.icon]}),(0,a.jsx)("span",{children:e(r.label)}),"/history"===r.href&&n>0&&(0,a.jsxs)("span",{className:"live",title:e("nav.liveTitle",{n:n}),children:[(0,a.jsx)("span",{className:"dot","aria-hidden":"true"}),e("nav.live")]})]},r.href)),(0,a.jsx)(c.c5,{})]})}},9218:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,8197,23)),Promise.resolve().then(n.bind(n,6657)),Promise.resolve().then(n.bind(n,1035)),Promise.resolve().then(n.t.bind(n,952,23)),Promise.resolve().then(n.bind(n,8214)),Promise.resolve().then(n.bind(n,7712)),Promise.resolve().then(n.bind(n,1205)),Promise.resolve().then(n.bind(n,867))}},e=>{e.O(0,[353,197,867,549,347,131,358],()=>e(e.s=9218)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[562],{1035:(e,l,a)=>{"use strict";a.d(l,{DialogHost:()=>o,Z:()=>c});var s=a(3365),t=a(1521),n=a(867);let i=null,r=[];function c(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(a=>{var s;return s={kind:"confirm",message:e,...l,resolve:a},void(i?i(s):r.push(s))})}function o(e){var l,a;let{children:c}=e,{t:o}=(0,n.kj)(),[d,u]=(0,t.useState)([]),m=(0,t.useRef)(null);(0,t.useEffect)(()=>{if(i=e=>u(l=>[...l,e]),r.length>0){let e=r.splice(0,r.length);u(l=>[...l,...e])}return()=>{i=null}},[]);let p=d[0],g=(0,t.useCallback)(e=>{p&&(p.resolve(e),u(e=>e.slice(1)))},[p]);return(0,t.useEffect)(()=>{var e;if(!p)return;null==(e=m.current)||e.focus();let l=e=>{"Escape"===e.key&&(e.preventDefault(),g(!1))};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[p,g]),(0,s.jsxs)(s.Fragment,{children:[c,p&&(0,s.jsx)("div",{className:"modal-backdrop",onClick:()=>g(!1),role:"presentation",children:(0,s.jsxs)("div",{className:"modal".concat(p.danger?" danger":""),role:"confirm"===p.kind?"alertdialog":"dialog","aria-modal":"true","aria-labelledby":"modal-title",onClick:e=>e.stopPropagation(),children:[(0,s.jsx)("h2",{id:"modal-title",children:null!=(l=p.title)?l:o("confirm"===p.kind?"dialog.confirmTitle":"dialog.noticeTitle")}),(0,s.jsx)("div",{className:"modal-body",children:p.message}),(0,s.jsxs)("div",{className:"row modal-actions",children:["confirm"===p.kind&&(0,s.jsx)("button",{type:"button",className:"quiet",onClick:()=>g(!1),children:o("dialog.cancel")}),(0,s.jsx)("button",{ref:m,type:"button",className:p.danger?"danger":"primary",onClick:()=>g(!0),children:null!=(a=p.okLabel)?a:o("dialog.ok")})]})]})})]})}},2162:(e,l,a)=>{"use strict";a.r(l),a.d(l,{default:()=>c});var s=a(3365),t=a(1521),n=a(5549),i=a(1035),r=a(867);function c(){let{t:e}=(0,r.kj)(),[l,a]=(0,t.useState)(""),[c,o]=(0,t.useState)(""),[d,u]=(0,t.useState)(!1),[m,p]=(0,t.useState)(""),g=async()=>{let e=await n.FH.level1();a(e.content),o(e.content),u(e.customised)};(0,t.useEffect)(()=>{g().catch(e=>p(e.message))},[]);let h=async()=>{try{await n.FH.setLevel1(l),o(l),u(!0),p(e("l1page.saved"))}catch(e){p(e.message)}},v=async()=>{if(!await (0,i.Z)(e("l1page.resetConfirm")))return;let l=await n.FH.resetLevel1();a(l.content),o(l.content),u(!1),p(e("l1page.resetDone"))};return(0,s.jsxs)("div",{className:"panel",children:[(0,s.jsx)("h2",{children:e("l1page.title")}),(0,s.jsx)("p",{className:"muted small",children:e("l1page.hint")}),(0,s.jsxs)("div",{className:"row small muted",children:[(0,s.jsx)("span",{children:d?e("l1page.custom"):e("l1page.shipped")}),(0,s.jsx)("span",{className:"grow"}),l!==c&&(0,s.jsx)("span",{children:e("l1page.unsaved")})]}),(0,s.jsx)("textarea",{className:"prose",style:{minHeight:520},value:l,onChange:e=>a(e.target.value)}),(0,s.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,s.jsx)("button",{className:"primary",onClick:()=>void h(),disabled:l===c,children:e("l1page.save")}),(0,s.jsx)("button",{onClick:()=>void v(),disabled:!d,children:e("l1page.reset")}),(0,s.jsx)("span",{className:"muted small",children:m})]})]})}},6103:(e,l,a)=>{Promise.resolve().then(a.bind(a,2162))}},e=>{e.O(0,[867,549,347,131,358],()=>e(e.s=6103)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{1035:(e,t,l)=>{"use strict";l.d(t,{DialogHost:()=>c,Z:()=>d});var n=l(3365),s=l(1521),a=l(867);let i=null,r=[];function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(l=>{var n;return n={kind:"confirm",message:e,...t,resolve:l},void(i?i(n):r.push(n))})}function c(e){var t,l;let{children:d}=e,{t:c}=(0,a.kj)(),[o,h]=(0,s.useState)([]),m=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(i=e=>h(t=>[...t,e]),r.length>0){let e=r.splice(0,r.length);h(t=>[...t,...e])}return()=>{i=null}},[]);let u=o[0],p=(0,s.useCallback)(e=>{u&&(u.resolve(e),h(e=>e.slice(1)))},[u]);return(0,s.useEffect)(()=>{var e;if(!u)return;null==(e=m.current)||e.focus();let t=e=>{"Escape"===e.key&&(e.preventDefault(),p(!1))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[u,p]),(0,n.jsxs)(n.Fragment,{children:[d,u&&(0,n.jsx)("div",{className:"modal-backdrop",onClick:()=>p(!1),role:"presentation",children:(0,n.jsxs)("div",{className:"modal".concat(u.danger?" danger":""),role:"confirm"===u.kind?"alertdialog":"dialog","aria-modal":"true","aria-labelledby":"modal-title",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{id:"modal-title",children:null!=(t=u.title)?t:c("confirm"===u.kind?"dialog.confirmTitle":"dialog.noticeTitle")}),(0,n.jsx)("div",{className:"modal-body",children:u.message}),(0,n.jsxs)("div",{className:"row modal-actions",children:["confirm"===u.kind&&(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>p(!1),children:c("dialog.cancel")}),(0,n.jsx)("button",{ref:m,type:"button",className:u.danger?"danger":"primary",onClick:()=>p(!0),children:null!=(l=u.okLabel)?l:c("dialog.ok")})]})]})})]})}},2114:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>m});var n=l(3365),s=l(1521),a=l(8197),i=l.n(a),r=l(5549),d=l(867),c=l(1035),o=l(4811),h=l(8848);function m(){let{t:e}=(0,d.kj)(),t=(0,d.W3)(),[l,a]=(0,s.useState)(null),[o,h]=(0,s.useState)(null),[m,p]=(0,s.useState)([]),[j,x]=(0,s.useState)([]),[g,b]=(0,s.useState)("stop"),[v,f]=(0,s.useState)(!1),[N,w]=(0,s.useState)(""),[y,k]=(0,s.useState)(""),[S,C]=(0,s.useState)(""),[F,H]=(0,s.useState)(null),[I,W]=(0,s.useState)(!1),E=(0,s.useCallback)(async()=>{try{let[e,t,l]=await Promise.all([r.FH.sessions(),r.FH.batch().catch(()=>null),r.FH.approvals().catch(()=>[])]);a(e),h(t),p(l),x(t=>t.filter(t=>e.some(e=>e.id===t))),H(!0),W(!1),C("")}catch(e){W(!(0,r.AV)()),H(!1),C(e.message)}},[]);(0,s.useEffect)(()=>{E();let e=setInterval(()=>void E(),3e3);return()=>clearInterval(e)},[E]),(0,s.useEffect)(()=>{var e;let t=new URLSearchParams(window.location.search),l=(null!=(e=t.get("run"))?e:"").split(",").map(e=>e.trim()).filter(Boolean);0!==l.length&&(x(l),b("continue"===t.get("fail")?"continue":"stop"),f(!0),window.history.replaceState(null,"",window.location.pathname))},[]);let T=async()=>{try{let e=await r.FH.createSession(N||"session");w(""),window.location.href=(0,r.aT)(e.id)}catch(e){C(e.message)}},P=async t=>{if(t.running)return void k(e("home.deleteRunning"));if(await (0,c.Z)(e("home.deleteConfirm",{name:t.name,n:t.tasks.length})))try{await r.FH.deleteSession(t.id),k(e("home.deleted",{name:t.name})),x(e=>e.filter(e=>e!==t.id)),await E()}catch(e){k(e.message)}},R=async()=>{let t=(null!=l?l:[]).filter(e=>j.includes(e.id));if(0===t.length)return;let n=t.map(e=>"• ".concat(e.name," (").concat(e.tasks.length,")")).join("\n");if(!await (0,c.Z)(e("home.deleteSelectedConfirm",{n:t.length,names:n})))return;let s=0,a=[];for(let e of t)try{await r.FH.deleteSession(e.id),s+=1}catch(t){a.push("".concat(e.name,": ").concat(t.message))}k(0===a.length?e("home.deletedMany",{n:s}):e("home.deleteSomeFailed",{n:s,m:a.length,why:a.join("; ")})),x([]),await E()},U=t=>{if(t.running)return{label:e("state.running"),badge:"running"};let l=t.tasks.some(e=>"queued"===e.status||"running"===e.status);if("idle"!==t.status||l||0===t.tasks.length)return{label:e("state.".concat(t.status)),badge:""};let n=t.tasks.filter(e=>"done"!==e.status).length;return 0===n?{label:e("state.completed"),badge:"done",title:e("state.completedTitle")}:{label:e("state.ended"),badge:"failed",title:e("state.endedTitle",{n:n})}};return(0,n.jsxs)(n.Fragment,{children:[I&&(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("strong",{children:e("home.noToken")}),(0,n.jsx)("div",{className:"muted small",children:e("home.noTokenHint",{cmd:"npm start"})})]}),!1===F&&!I&&(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("strong",{children:e("home.apiDown")}),(0,n.jsx)("div",{className:"muted small",children:e("home.apiHint",{cmd:"npm start",url:"/api"})}),S&&(0,n.jsx)("div",{className:"err",children:S})]}),(0,n.jsxs)("div",{className:"panel",id:"new-session",children:[(0,n.jsx)("h2",{children:e("home.new")}),(0,n.jsx)("p",{className:"muted small",children:e("home.newHint")}),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("input",{type:"text",className:"grow",placeholder:e("home.namePlaceholder"),value:N,onChange:e=>w(e.target.value),onKeyDown:e=>{"Enter"===e.key&&T()}}),(0,n.jsx)("button",{className:"primary",onClick:()=>void T(),disabled:!1===F,children:e("home.create")})]})]}),l&&l.length>0&&(0,n.jsx)(u,{sessions:l,selected:j,setSelected:x,onFailure:g,setOnFailure:b,fromPlan:v,batch:o,approvals:m,onChange:E,move:(e,t)=>{x(l=>{let n=l.indexOf(e),s=n+t;if(n<0||s<0||s>=l.length)return l;let a=[...l];return[a[n],a[s]]=[a[s],a[n]],a})}}),(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("h2",{children:e("home.sessions")}),null===l&&(0,n.jsx)("div",{className:"muted",children:e("home.loading")}),l&&0===l.length&&(0,n.jsx)("div",{className:"muted",children:e("home.none")}),l&&l.length>0&&(0,n.jsxs)("div",{className:"row",style:{marginBottom:10},children:[(0,n.jsx)("strong",{className:"small",children:e("home.selected",{n:j.length})}),(0,n.jsx)("button",{className:"danger",onClick:()=>void R(),disabled:0===j.length||(null==o?void 0:o.running)===!0||l.some(e=>j.includes(e.id)&&e.running),children:e("home.deleteSelected",{n:j.length})}),(0,n.jsx)("span",{className:"muted small",children:e("home.tickForBoth")})]}),l&&l.length>0&&(0,n.jsx)("p",{className:"muted small",children:e("home.deleteWhy")}),y&&(0,n.jsx)("div",{className:"muted small",role:"status",children:y}),l&&l.length>0&&(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:(0,n.jsx)("input",{type:"checkbox","aria-label":e("home.selectAll"),checked:l.length>0&&j.length===l.length,onChange:e=>x(e.target.checked?l.map(e=>e.id).reverse():[]),disabled:(null==o?void 0:o.running)===!0})}),(0,n.jsx)("th",{children:e("home.col.name")}),(0,n.jsx)("th",{children:e("home.col.tasks")}),(0,n.jsx)("th",{children:e("home.col.state")}),(0,n.jsx)("th",{children:e("home.col.chat")}),(0,n.jsx)("th",{children:e("home.col.created")}),(0,n.jsx)("th",{children:(0,n.jsx)("span",{className:"visually-hidden",children:e("home.col.remove")})})]})}),(0,n.jsx)("tbody",{children:l.map(s=>{let a=s.tasks.filter(e=>"done"===e.status).length,d=s.tasks.filter(e=>"queued"===e.status).length;return(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{children:(0,n.jsx)("input",{type:"checkbox",checked:j.includes(s.id),onChange:()=>{var e;return e=s.id,void x(t=>{if(t.includes(e))return t.filter(t=>t!==e);let n=(null!=l?l:[]).map(e=>e.id).reverse();return[...t,e].sort((e,t)=>n.indexOf(e)-n.indexOf(t))})},disabled:(null==o?void 0:o.running)===!0,"aria-label":s.name})}),(0,n.jsx)("td",{children:(0,n.jsx)(i(),{href:(0,r.aT)(s.id),children:s.name})}),(0,n.jsxs)("td",{children:[s.tasks.length," ",(0,n.jsx)("span",{className:"muted small",children:e("home.tasksDetail",{done:a,queued:d})})]}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"badge ".concat(U(s).badge),title:U(s).title,children:U(s).label})}),(0,n.jsx)("td",{children:s.chat?(0,n.jsx)("a",{href:s.chat.url,target:"_blank",rel:"noreferrer",children:s.chat.name}):(0,n.jsx)("span",{className:"muted",children:e("home.notOpened")})}),(0,n.jsx)("td",{className:"muted small",children:t(s.createdAt)}),(0,n.jsx)("td",{children:(0,n.jsx)("button",{className:"quiet",onClick:()=>void P(s),disabled:s.running||(null==o?void 0:o.running)===!0,title:e("home.delete"),children:e("home.delete")})})]},s.id)})})]})]})]})}function u(e){var t,l,a,m,u,p,j;let{sessions:x,selected:g,setSelected:b,onFailure:v,setOnFailure:f,fromPlan:N,batch:w,approvals:y,onChange:k,move:S}=e,{t:C}=(0,d.kj)(),[F,H]=(0,s.useState)(""),[I,W]=(0,s.useState)(""),[E,T]=(0,s.useState)(""),[P,R]=(0,s.useState)(""),[U,D]=(0,s.useState)(""),[B,L]=(0,s.useState)(null),[M,O]=(0,s.useState)([]);(0,s.useEffect)(()=>{r.FH.models().then(e=>{L(e),T(t=>t||e.defaultModel),R(t=>t||e.defaultReviewModel)}).catch(()=>void 0)},[]);let q=g.join(",");(0,s.useEffect)(()=>{let e=!1,t=q.split(",").filter(Boolean);if(0===t.length)return void O([]);let l=async()=>{let l=await Promise.all(t.map(async e=>{let t=await r.FH.vcsStatus(e).catch(()=>null);return{id:e,status:t}}));e||O(l.filter(e=>e.status&&!e.status.ok&&"off"!==e.status.problem).map(e=>{var t,l,n,s;return{name:null!=(n=null==(t=x.find(t=>t.id===e.id))?void 0:t.name)?n:e.id,problem:null!=(s=null==(l=e.status)?void 0:l.problem)?s:""}}))};l();let n=setInterval(()=>void l(),1e4);return()=>{e=!0,clearInterval(n)}},[q]);let _=new Map(x.map(e=>[e.id,e])),Z=e=>e.tasks.filter(e=>"queued"===e.status).length,A=g.map(e=>_.get(e)).filter(e=>!!e),K=A.filter(e=>Z(e)>0),z=K.reduce((e,t)=>e+Z(t),0),Q=(null==w?void 0:w.running)===!0,V=x.some(e=>e.running),G=Q||0===K.length||V,J=V?{title:"batch.oneRunning",why:"batch.oneRunningWhy"}:0===A.length?{title:"batch.pickFirst",why:"batch.pickFirstWhy"}:0===K.length?{title:"batch.nothingRunnable",why:"batch.nothingRunnableWhy"}:null,X=(0,o.p)(),Y=async e=>{if("unattended"!==e||X||await (0,c.Z)(C("batch.unattendedConfirm",{n:K.length})))try{var t;let l=await r.FH.startBatch(K.map(e=>e.id),e,v,E||void 0,P||void 0,U.trim()||K.map(e=>e.planName).find(Boolean)||void 0);H(""),W(l.started?"":null!=(t=l.reason)?t:""),k()}catch(e){W(e.message)}},$=async()=>{await r.FH.stopBatch(),H(C("batch.stopping")),k()},ee=async()=>{await r.FH.pauseBatch(),H(C("batch.pausing")),k()},et=async()=>{await r.FH.resumeBatch(),H(""),k()},el=A.filter(e=>{var t;return(null!=(t=e.model)?t:"")!==E}).length,en=A.filter(e=>{var t;return(null==(t=e.review)?void 0:t.enabled)===!1}).length,es=null!=(a=null==B?void 0:B.options)?a:[],ea=es.filter(e=>!e.group),ei=new Map;for(let e of es)e.group&&ei.set(e.group,[...null!=(m=ei.get(e.group))?m:[],e]);let er=w?{done:w.sessions.filter(e=>"done"===e.state).length,failed:w.sessions.filter(e=>"failed"===e.state).length,skipped:w.sessions.filter(e=>"skipped"===e.state||"stopped"===e.state).length}:null,ed=null==w?void 0:w.sessions.find(e=>"running"===e.state);return(0,n.jsxs)("div",{className:"panel",children:[(0,n.jsx)("h2",{children:C("batch.title")}),(0,n.jsx)("p",{className:"muted small",children:C("batch.hint")}),!Q&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("strong",{className:"small",children:C("batch.selected",{n:K.length,tasks:z})}),(0,n.jsx)("button",{className:"quiet",onClick:()=>b(x.filter(e=>Z(e)>0).map(e=>e.id).reverse()),children:C("batch.selectQueued")}),(0,n.jsx)("button",{className:"quiet",onClick:()=>b([]),disabled:0===A.length,children:C("batch.selectNone")})]}),N&&(0,n.jsx)("p",{className:"muted small",children:C("batch.fromPlan")}),A.length>K.length&&(0,n.jsx)("p",{className:"muted small",children:C("batch.notRunnable",{n:A.length-K.length})}),K.length>0&&(0,n.jsx)("ol",{className:"run-order",children:K.map((e,t)=>(0,n.jsxs)("li",{children:[(0,n.jsxs)("span",{children:[e.name," ",(0,n.jsxs)("span",{className:"muted small",children:["(",Z(e),")"]})]}),(0,n.jsxs)("span",{children:[(0,n.jsx)("button",{className:"quiet",onClick:()=>S(e.id,-1),disabled:0===t,"aria-label":"up",children:"↑"}),(0,n.jsx)("button",{className:"quiet",onClick:()=>S(e.id,1),disabled:t===K.length-1,"aria-label":"down",children:"↓"})]})]},e.id))}),(0,n.jsx)("label",{htmlFor:"batch-run-name",children:C("batch.runName")}),(0,n.jsx)("input",{id:"batch-run-name",type:"text",value:U,onChange:e=>D(e.target.value),placeholder:null!=(u=K.map(e=>e.planName).find(Boolean))?u:C("batch.runNamePlaceholder")}),(0,n.jsx)("p",{className:"why",children:C("batch.runNameWhy")}),(0,n.jsx)("label",{htmlFor:"batch-model",children:C("batch.model")}),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsxs)("select",{id:"batch-model",value:E,onChange:e=>T(e.target.value),style:{width:"auto",minWidth:260},children:[(0,n.jsx)("option",{value:"",children:C("batch.modelKeep")}),ea.map(e=>(0,n.jsx)("option",{value:e.name,disabled:e.disabled,children:e.name},e.name)),[...ei.entries()].map(e=>{let[t,l]=e;return(0,n.jsx)("optgroup",{label:t,children:l.map(e=>(0,n.jsx)("option",{value:e.name,disabled:e.disabled,children:e.name},e.name))},t)})]}),(null!=(p=null==B?void 0:B.options.length)?p:0)===0&&(0,n.jsx)("span",{className:"muted small",children:C("batch.modelNone")})]}),(0,n.jsx)("p",{className:"why",children:C("batch.modelWhy")}),(0,n.jsx)(h.L,{current:E,onUse:e=>T(e)}),E&&el>0&&(0,n.jsx)("p",{className:"why",style:{color:"var(--warn)"},children:C("batch.modelOverrides",{n:el})}),(0,n.jsx)("label",{htmlFor:"batch-review-model",children:C("batch.reviewModel")}),(0,n.jsx)("div",{className:"row",children:(0,n.jsxs)("select",{id:"batch-review-model",value:P,onChange:e=>R(e.target.value),style:{width:"auto",minWidth:260},children:[(0,n.jsx)("option",{value:"",children:C("batch.reviewModelKeep")}),ea.map(e=>(0,n.jsx)("option",{value:e.name,disabled:e.disabled,children:e.name},e.name)),[...ei.entries()].map(e=>{let[t,l]=e;return(0,n.jsx)("optgroup",{label:t,children:l.map(e=>(0,n.jsx)("option",{value:e.name,disabled:e.disabled,children:e.name},e.name))},t)})]})}),(0,n.jsx)("p",{className:"why",children:C("batch.reviewModelWhy")}),""!==P&&P===E&&(0,n.jsx)("p",{className:"why",style:{color:"var(--warn)"},children:C("batch.reviewSame")}),en>0&&(0,n.jsx)("p",{className:"why",children:C("batch.reviewOffIn",{n:en})}),(0,n.jsxs)("fieldset",{style:{border:0,padding:0,margin:"10px 0 14px"},children:[(0,n.jsx)("legend",{className:"muted small",style:{padding:0},children:C("batch.onFailure")}),(0,n.jsxs)("div",{className:"option",children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"radio",name:"batch-fail",checked:"stop"===v,onChange:()=>f("stop")}),(0,n.jsx)("span",{children:C("batch.chain")})]}),(0,n.jsx)("p",{className:"why",children:C("batch.chainWhy")})]}),(0,n.jsxs)("div",{className:"option",children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"radio",name:"batch-fail",checked:"continue"===v,onChange:()=>f("continue")}),(0,n.jsx)("span",{children:C("batch.independent")})]}),(0,n.jsx)("p",{className:"why",children:C("batch.independentWhy")})]})]}),J&&(0,n.jsxs)("div",{className:"notice caution",children:[(0,n.jsx)("strong",{children:C(J.title)}),(0,n.jsx)("div",{className:"small",style:{marginTop:4},children:C(J.why)})]}),M.length>0&&(0,n.jsxs)("div",{className:"notice caution",children:[(0,n.jsx)("strong",{children:C("batch.vcsProblem")}),(0,n.jsx)("ul",{children:M.map(e=>(0,n.jsx)("li",{children:C("batch.vcsProblemRow",{name:e.name,problem:e.problem})},e.name))}),(0,n.jsx)("div",{className:"muted small",children:C("batch.vcsProblemWhy")})]}),I&&(0,n.jsxs)("div",{className:"notice caution",role:"alert",children:[(0,n.jsx)("strong",{children:C("batch.notStartedTitle")}),(0,n.jsx)("div",{className:"small",style:{marginTop:4},children:I}),/execution\.isolation/.test(I)&&(0,n.jsx)("div",{className:"small",style:{marginTop:4},children:(0,n.jsx)(i(),{href:"/defaults",children:C("batch.notStartedIsolation")})})]}),(0,n.jsxs)("div",{className:"run-choice",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("button",{className:"primary",onClick:()=>void Y("unattended"),disabled:G,children:C("batch.run",{n:K.length})}),(0,n.jsx)("p",{className:"why",children:C("batch.runWhy")})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("button",{onClick:()=>void Y("confirm"),disabled:G,children:C("batch.runStep")}),(0,n.jsx)("p",{className:"why",children:C("batch.runStepWhy")})]})]})]}),Q&&(0,n.jsxs)("div",{className:"row",children:[(null==w?void 0:w.pausing)?(0,n.jsx)("button",{className:"primary",onClick:()=>void et(),disabled:null==w?void 0:w.stopping,title:C("batch.resumeWhy"),children:C("batch.resume")}):(0,n.jsx)("button",{onClick:()=>void ee(),disabled:null==w?void 0:w.stopping,title:C("batch.pauseWhy"),children:C("batch.pause")}),(0,n.jsx)("button",{onClick:()=>void $(),disabled:null==w?void 0:w.stopping,title:C("batch.stopWhy"),children:C("batch.stop")}),(null==w?void 0:w.pausing)&&!(null==w?void 0:w.stopping)&&(0,n.jsx)("span",{className:"muted small",children:C("batch.pausing")}),(0,n.jsx)("span",{className:"badge",children:C("batch.modelRunning",{name:(ed?(null==(t=_.get(ed.sessionId))?void 0:t.modelInUse)||(null==(l=_.get(ed.sessionId))?void 0:l.model):"")||C("model.default")})}),y.length>0&&(0,n.jsx)("span",{className:"badge waiting-approval",children:C("batch.waiting",{n:y.length})}),ed&&(0,n.jsx)("span",{className:"small",children:C("batch.progress",{name:ed.name,done:w.sessions.filter(e=>"waiting"!==e.state&&"running"!==e.state).length,total:w.sessions.length})})]}),Q&&(0,n.jsx)("p",{className:"muted small",children:C("batch.hiddenWhileRunning")}),F&&(0,n.jsx)("div",{className:"muted small",role:"status",children:F}),(A.length>0||w)&&(0,n.jsxs)("div",{className:"row",style:{marginTop:12},children:[(0,n.jsx)("a",{className:"button-link",href:r.FH.debugExportUrl(A.length>0?A.map(e=>e.id):(null!=(j=null==w?void 0:w.sessions)?j:[]).map(e=>e.sessionId)),children:C("batch.debug")}),(0,n.jsx)("span",{className:"muted small",children:A.length>0?C("batch.debugSelected",{n:A.length}):C("batch.debugLast")})]}),(A.length>0||w)&&(0,n.jsx)("p",{className:"why",children:C("batch.debugWhy")}),w&&(0,n.jsxs)(n.Fragment,{children:[!Q&&er&&(0,n.jsx)("div",{className:"notice calm",style:{marginTop:12},children:(0,n.jsx)("strong",{children:C("batch.finished",er)})}),(0,n.jsxs)("table",{style:{marginTop:10},children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:C("batch.col.session")}),(0,n.jsx)("th",{children:C("batch.col.state")}),(0,n.jsx)("th",{children:C("batch.col.ran")}),(0,n.jsx)("th",{children:C("batch.col.why")})]})}),(0,n.jsx)("tbody",{children:w.sessions.map(e=>{var t,l;return(0,n.jsxs)("tr",{className:"batch-row ".concat(e.state),children:[(0,n.jsx)("td",{children:(0,n.jsx)(i(),{href:(0,r.aT)(e.sessionId),children:e.name})}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"badge ".concat("running"===(l=e.state)?"running":"done"===l?"done":"failed"===l?"failed":"stopped"===l?"aborted":""),children:C("batch.state.".concat(e.state))})}),(0,n.jsx)("td",{className:"small",children:C("batch.ranOf",{ran:e.ran,failed:e.failed})}),(0,n.jsx)("td",{className:"muted small",children:null!=(t=e.reason)?t:""})]},e.sessionId)})})]})]})]})}},4811:(e,t,l)=>{"use strict";l.d(t,{p:()=>a});var n=l(1521),s=l(5549);function a(){let[e,t]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e=!0;return s.FH.settings().then(l=>{var n;let s=null!=(n=l.raw.execution)?n:{};e&&t("unattended"===s.mode)}).catch(()=>void 0),()=>{e=!1}},[]),e}},5704:(e,t,l)=>{Promise.resolve().then(l.bind(l,2114))},8848:(e,t,l)=>{"use strict";l.d(t,{H4:()=>c,L:()=>o,z4:()=>h});var n=l(3365),s=l(8197),a=l.n(s),i=l(1521),r=l(5549),d=l(867);function c(e){let{current:t,onUse:l}=e,{t:s}=(0,d.kj)(),[a,c]=(0,i.useState)(null);if((0,i.useEffect)(()=>{let e=!1;return r.FH.project().then(t=>{e||c(t)}).catch(()=>void 0),()=>{e=!0}},[]),!a)return null;let o=a.rootDir.trim(),h=t.trim().toLowerCase(),m=l?a.others.filter(e=>e.rootDir.trim().toLowerCase()!==h):[];return(0,n.jsx)(u,{label:o?s("proj.defaultIs",{dir:o}):s("proj.noneShort"),offer:o&&l&&h!==o.toLowerCase()?{text:s("proj.useIt"),onUse:()=>l(o)}:void 0,more:m.map(e=>({text:s("proj.otherUse",{name:e.name}),title:e.rootDir,onUse:()=>null==l?void 0:l(e.rootDir)})),link:o?s("proj.change"):s("proj.setIt"),anchor:"project"})}function o(e){let{current:t,onUse:l}=e,s=m(),{t:a}=(0,d.kj)();if(!s)return null;let i=s.defaultModel.trim();return(0,n.jsx)(u,{label:i?a("def.modelDefaultIs",{name:i}):a("def.modelNoneShort"),offer:i&&l&&t.trim()!==i?{text:a("def.modelUseIt"),onUse:()=>l(i)}:void 0,link:a(i?"proj.change":"proj.setIt"),anchor:"model"})}function h(e){let{current:t,onUse:l}=e,s=m(),{t:a}=(0,d.kj)();if(!s)return null;let i=s.defaultReviewModel.trim();return(0,n.jsx)(u,{label:i?a("def.reviewDefaultIs",{name:i}):a("def.reviewNoneShort"),offer:i&&l&&t.trim()!==i?{text:a("def.modelUseIt"),onUse:()=>l(i)}:void 0,link:a(i?"proj.change":"proj.setIt"),anchor:"review"})}function m(){let[e,t]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!1;return r.FH.models().then(l=>{e||t(l)}).catch(()=>void 0),()=>{e=!0}},[]),e}function u(e){let{label:t,offer:l,more:s=[],link:i,anchor:r}=e;return(0,n.jsxs)("p",{className:"muted small",style:{marginTop:4},children:[t," ",l&&(0,n.jsxs)(n.Fragment,{children:["\xb7"," ",(0,n.jsx)("button",{type:"button",className:"linkish",onClick:l.onUse,children:l.text})," "]}),s.map(e=>(0,n.jsxs)("span",{children:["\xb7"," ",(0,n.jsx)("button",{type:"button",className:"linkish",onClick:e.onUse,title:e.title,children:e.text})," "]},e.text)),"\xb7 ",(0,n.jsx)(a(),{href:"/defaults#".concat(r),children:i})]})}}},e=>{e.O(0,[197,867,549,347,131,358],()=>e(e.s=5704)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[933],{1035:(e,s,a)=>{"use strict";a.d(s,{DialogHost:()=>d,Z:()=>c});var l=a(3365),t=a(1521),n=a(867);let r=null,i=[];function c(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(a=>{var l;return l={kind:"confirm",message:e,...s,resolve:a},void(r?r(l):i.push(l))})}function d(e){var s,a;let{children:c}=e,{t:d}=(0,n.kj)(),[o,m]=(0,t.useState)([]),u=(0,t.useRef)(null);(0,t.useEffect)(()=>{if(r=e=>m(s=>[...s,e]),i.length>0){let e=i.splice(0,i.length);m(s=>[...s,...e])}return()=>{r=null}},[]);let h=o[0],p=(0,t.useCallback)(e=>{h&&(h.resolve(e),m(e=>e.slice(1)))},[h]);return(0,t.useEffect)(()=>{var e;if(!h)return;null==(e=u.current)||e.focus();let s=e=>{"Escape"===e.key&&(e.preventDefault(),p(!1))};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[h,p]),(0,l.jsxs)(l.Fragment,{children:[c,h&&(0,l.jsx)("div",{className:"modal-backdrop",onClick:()=>p(!1),role:"presentation",children:(0,l.jsxs)("div",{className:"modal".concat(h.danger?" danger":""),role:"confirm"===h.kind?"alertdialog":"dialog","aria-modal":"true","aria-labelledby":"modal-title",onClick:e=>e.stopPropagation(),children:[(0,l.jsx)("h2",{id:"modal-title",children:null!=(s=h.title)?s:d("confirm"===h.kind?"dialog.confirmTitle":"dialog.noticeTitle")}),(0,l.jsx)("div",{className:"modal-body",children:h.message}),(0,l.jsxs)("div",{className:"row modal-actions",children:["confirm"===h.kind&&(0,l.jsx)("button",{type:"button",className:"quiet",onClick:()=>p(!1),children:d("dialog.cancel")}),(0,l.jsx)("button",{ref:u,type:"button",className:h.danger?"danger":"primary",onClick:()=>p(!0),children:null!=(a=h.okLabel)?a:d("dialog.ok")})]})]})})]})}},2333:(e,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>c});var l=a(3365),t=a(1521),n=a(5549),r=a(1035),i=a(867);function c(){let{t:e}=(0,i.kj)(),s=(0,i.W3)(),[a,c]=(0,t.useState)([]),[d,o]=(0,t.useState)(""),[m,u]=(0,t.useState)(""),[h,p]=(0,t.useState)(""),j=async()=>c(await n.FH.presets());(0,t.useEffect)(()=>{j().catch(e=>p(e.message))},[]);let x=async()=>{try{await n.FH.savePreset(d,m),p(e("presets.saved",{name:d})),await j()}catch(e){p(e.message)}},v=async s=>{await (0,r.Z)(e("presets.deleteConfirm",{name:s.name}))&&(await n.FH.deletePreset(s.name),await j())};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsx)("h2",{children:e("presets.title")}),(0,l.jsx)("p",{className:"muted small",children:e("presets.hint")}),(0,l.jsx)("label",{children:e("presets.name")}),(0,l.jsx)("input",{type:"text",value:d,onChange:e=>o(e.target.value),placeholder:e("presets.namePlaceholder")}),(0,l.jsx)("label",{children:e("presets.content")}),(0,l.jsx)("textarea",{className:"prose",style:{minHeight:220},value:m,onChange:e=>u(e.target.value),placeholder:e("presets.contentPlaceholder")}),(0,l.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,l.jsx)("button",{className:"primary",onClick:()=>void x(),disabled:!d.trim(),children:e("presets.save")}),(0,l.jsx)("span",{className:"muted small",children:h})]})]}),(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsx)("h2",{children:e("presets.list")}),0===a.length&&(0,l.jsx)("div",{className:"muted",children:e("presets.none")}),a.map(a=>(0,l.jsxs)("div",{className:"task",children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("h4",{className:"grow",children:a.name}),(0,l.jsx)("span",{className:"muted small",children:s(a.updatedAt)}),(0,l.jsx)("button",{onClick:()=>{o(a.name),u(a.content)},children:e("presets.edit")}),(0,l.jsx)("button",{className:"danger",onClick:()=>void v(a),children:e("presets.delete")})]}),(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:e("presets.show")}),(0,l.jsx)("pre",{children:a.content})]})]},a.name))]})]})}},6568:(e,s,a)=>{Promise.resolve().then(a.bind(a,2333))}},e=>{e.O(0,[867,549,347,131,358],()=>e(e.s=6568)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[66],{1205:(e,s,n)=>{"use strict";n.d(s,{AppearanceProvider:()=>o,K:()=>m,themeScript:()=>i});var l=n(3365),a=n(1521);let t={theme:"light",textSize:"normal",highContrast:!1,reduceMotion:!1,underlineLinks:!1,strongFocus:!1},r="cop.appearance",i="\n(function () {\n try {\n var d = document.documentElement;\n var raw = localStorage.getItem('".concat(r,"');\n var a = raw ? JSON.parse(raw) : {};\n d.dataset.theme = a.theme === 'dark' ? 'dark' : 'light';\n d.dataset.textsize = a.textSize || 'normal';\n d.dataset.contrast = a.highContrast ? 'high' : 'normal';\n d.dataset.motion = a.reduceMotion ? 'reduced' : 'normal';\n d.dataset.links = a.underlineLinks ? 'underline' : 'plain';\n d.dataset.focus = a.strongFocus ? 'strong' : 'normal';\n } catch (e) {}\n})();\n");function c(e){let s=document.documentElement;s.dataset.theme=e.theme,s.dataset.textsize=e.textSize,s.dataset.contrast=e.highContrast?"high":"normal",s.dataset.motion=e.reduceMotion?"reduced":"normal",s.dataset.links=e.underlineLinks?"underline":"plain",s.dataset.focus=e.strongFocus?"strong":"normal"}let d=(0,a.createContext)({appearance:t,set:()=>void 0,reset:()=>void 0,loaded:!1});function o(e){let{children:s}=e,[n,i]=(0,a.useState)(t),[o,m]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=t;try{let s=window.localStorage.getItem(r);s?e={...t,...JSON.parse(s)}:window.matchMedia("(prefers-color-scheme: dark)").matches&&(e={...e,theme:"dark"}),window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!s&&(e={...e,reduceMotion:!0})}catch(e){}i(e),c(e),m(!0)},[]);let h=(0,a.useCallback)(e=>{i(s=>{let n={...s,...e};c(n);try{window.localStorage.setItem(r,JSON.stringify(n))}catch(e){}return n})},[]),u=(0,a.useCallback)(()=>{i(t),c(t);try{window.localStorage.removeItem(r)}catch(e){}},[]);return(0,l.jsx)(d.Provider,{value:{appearance:n,set:h,reset:u,loaded:o},children:s})}function m(){return(0,a.useContext)(d)}},1702:(e,s,n)=>{"use strict";var l=n(9962);n.o(l,"usePathname")&&n.d(s,{usePathname:function(){return l.usePathname}}),n.o(l,"useSearchParams")&&n.d(s,{useSearchParams:function(){return l.useSearchParams}})},1772:(e,s,n)=>{Promise.resolve().then(n.bind(n,4269))},2244:(e,s,n)=>{"use strict";n.d(s,{k:()=>o});var l=n(3365),a=n(1521),t=n(5549),r=n(867);function i(e){return e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/+$/,"")}function c(e,s){return"."===s||""===s||e===s||e.startsWith("".concat(s,"/"))}function d(e,s,n){return n.includes(e)?"out":n.some(s=>s!==e&&c(e,s))?"out-inherited":s.includes(e)?"in":s.some(s=>s!==e&&c(e,s))?"inherited":"none"}function o(e){let{rootDir:s,respectGitignore:n,includeEnvFiles:o,include:m,exclude:h,onChange:u}=e,{t:p}=(0,r.kj)(),[x,v]=(0,a.useState)(null),[j,g]=(0,a.useState)(""),[f,k]=(0,a.useState)(new Set),[b,y]=(0,a.useState)(""),N=async()=>{if(s.trim()){g("");try{let e=await t.FH.dirs(s,n);v(e),y("".concat(s,"|").concat(n)),k(new Set(e.filter(e=>!e.includes("/"))))}catch(e){g(e.message)}}};(0,a.useEffect)(()=>{v(null),y("")},[s,n]);let w=(0,a.useMemo)(()=>(function(e){let s=[],n=new Map;for(let a of[...e].sort()){var l;let e={path:a,name:null!=(l=a.split("/").pop())?l:a,children:[]};n.set(a,e);let t=a.includes("/")?n.get(a.slice(0,a.lastIndexOf("/"))):void 0;(t?t.children:s).push(e)}return s})(null!=x?x:[]),[x]),C=m.map(i).filter(Boolean),S=h.map(i).filter(Boolean),F=e=>(0,l.jsx)("ul",{className:"dir-tree",children:e.map(e=>{let s=d(e.path,C,S),n=f.has(e.path),a=function(e,s,n){let l=s=>s.filter(s=>s!==e&&c(s,e)).length;return{included:l(s),excluded:l(n)}}(e.path,C,S),t=!n&&e.children.length>0&&(a.included>0||a.excluded>0);return(0,l.jsxs)("li",{className:"dir ".concat(s),children:[(0,l.jsxs)("div",{className:"dir-row",children:[e.children.length>0?(0,l.jsx)("button",{type:"button",className:"dir-flip",onClick:()=>{let s;return s=e.path,k(e=>{let n=new Set(e);return n.has(s)?n.delete(s):n.add(s),n})},"aria-label":n?p("tree.fold"):p("tree.unfold"),"aria-expanded":n,children:n?"▾":"▸"}):(0,l.jsx)("span",{className:"dir-flip","aria-hidden":"true"}),(0,l.jsxs)("button",{type:"button",className:"dir-name",onClick:()=>(e=>{if("in"===d(e,C,S))return void u(C.filter(s=>s!==e),S);u([...C.filter(s=>!c(s,e)),e],S.filter(s=>!c(s,e)))})(e.path),title:"in"===s?p("tree.stateIn"):"inherited"===s?p("tree.stateInherited"):"out"===s?p("tree.stateOut"):"out-inherited"===s?p("tree.stateOutInherited"):p("tree.stateNone"),"aria-pressed":"in"===s||"inherited"===s,children:[(0,l.jsx)("span",{className:"dir-mark","aria-hidden":"true",children:"in"===s?"✓":"inherited"===s?"\xb7":"out"===s||"out-inherited"===s?"\xd7":""}),e.name]}),(0,l.jsx)("button",{type:"button",className:"dir-out".concat("out"===s?" on":""),onClick:()=>(e=>{if(S.includes(e))return void u(C,S.filter(s=>s!==e));u(C.filter(s=>s!==e&&!c(s,e)),[...S.filter(s=>!c(s,e)),e])})(e.path),title:"out"===s?p("tree.unexclude"):p("tree.exclude"),children:"−"}),t&&(0,l.jsx)("span",{className:"chip inside".concat(a.excluded>0?" out":""),title:p("tree.insideWhy"),children:a.excluded>0&&a.included>0?p("tree.insideBoth",{i:a.included,e:a.excluded}):a.excluded>0?p("tree.insideOut",{n:a.excluded}):p("tree.insideIn",{n:a.included})})]}),n&&e.children.length>0&&F(e.children)]},e.path)})}),D=b!=="".concat(s,"|").concat(n);return(0,l.jsxs)("div",{className:"dir-tree-box",children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("button",{type:"button",onClick:()=>void N(),disabled:!s.trim(),children:null===x||D?p("tree.load"):p("tree.reload")}),(0,l.jsx)("span",{className:"muted small",children:p("tree.hint")})]}),j&&(0,l.jsx)("div",{className:"err small",children:j}),(0,l.jsxs)("p",{className:"muted small",style:{marginTop:6},children:[p("tree.alsoOut")," ",[n?p("tree.alsoGitignore"):null,!1===o?p("tree.alsoEnv"):null,p("tree.alsoAlways")].filter(Boolean).join(" \xb7 ")]}),null!==x&&!D&&(0===x.length?(0,l.jsx)("p",{className:"muted small",children:p("mirror.noDirs")}):F(w))]})}},4269:(e,s,n)=>{"use strict";n.r(s),n.d(s,{default:()=>C});var l=n(3365),a=n(1521),t=n(1702),r=n(8197),i=n.n(r),c=n(5549),d=n(867),o=n(1910),m=n(3523),h=n(3374);function u(e){let s=e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/+$/,"");return""===s?".":s}function p(e){return e.split("\n").map(e=>e.trim()).filter(Boolean)}var x=n(1205),v=n(8848),j=n(4784),g=n(2244),f=n(2876),k=n(5132),b=n(1035),y=n(8934),N=n(4811),w=n(3041);function C(){return(0,l.jsx)(a.Suspense,{fallback:null,children:(0,l.jsx)(S,{})})}function S(){var e;let{t:s}=(0,d.kj)(),n=null!=(e=(0,t.useSearchParams)().get("id"))?e:"",[r,o]=(0,a.useState)(null),[m,h]=(0,a.useState)([]),[u,p]=(0,a.useState)([]),[x,v]=(0,a.useState)(null),[j,g]=(0,a.useState)(""),f=(0,a.useRef)(null),k=(0,a.useCallback)(async()=>{try{o(await c.FH.session(n)),g("")}catch(e){g(e.message)}},[n]),b=(0,a.useCallback)(()=>{f.current||(f.current=window.setTimeout(()=>{f.current=null,k()},400))},[k]);if((0,a.useEffect)(()=>{k(),c.FH.presets().then(p).catch(()=>void 0),c.FH.level1().then(v).catch(()=>void 0);let e=new EventSource(c.FH.streamUrl(n));e.onmessage=e=>{let s=JSON.parse(e.data);"ping"!==s.type&&(h(e=>[...e.slice(-400),s]),b())},e.onerror=()=>{};let s=setInterval(()=>void k(),8e3);return()=>{e.close(),clearInterval(s)}},[n,k,b]),j&&!r)return(0,l.jsx)("div",{className:"panel err",children:j});if(!r)return(0,l.jsx)("div",{className:"panel muted",children:s("home.loading")});let y=r.tasks.filter(e=>"queued"===e.status).length;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"crumbs",children:[(0,l.jsx)(i(),{href:"/",children:s("session.crumb")})," / ",r.name]}),(0,l.jsx)(F,{session:r,queued:y,onChange:k}),(0,l.jsx)(U,{tasks:r.tasks}),(0,l.jsx)(H,{session:r,onChange:k}),(0,l.jsx)(D,{level1:x,sent:r.contractSent}),(0,l.jsx)(T,{session:r,onChange:k}),(0,l.jsx)(I,{session:r,onChange:k}),(0,l.jsx)(M,{session:r,onChange:k}),(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsx)("h2",{children:s("tasks.title")}),(0,l.jsx)("p",{className:"muted small",children:s("tasks.hint")}),(0,l.jsx)(W,{session:r,onChange:k}),0===r.tasks.length&&(0,l.jsx)("div",{className:"muted",children:s("tasks.none")}),r.tasks.map((e,s)=>(0,l.jsx)(B,{session:r,task:e,index:s+1,presets:u,onChange:k},e.id))]}),(0,l.jsx)(O,{session:r}),(0,l.jsx)(A,{session:r,presets:u,onAdded:k,onPresetsChanged:()=>c.FH.presets().then(p)}),(0,l.jsx)(E,{events:m})]})}function F(e){var s;let{session:n,queued:t,onChange:r}=e,{t:i}=(0,d.kj)(),[o,m]=(0,a.useState)(""),[h,u]=(0,a.useState)("");(0,a.useEffect)(()=>{c.FH.models().then(e=>{var s;return u(null!=(s=e.defaultModel)?s:"")}).catch(()=>void 0)},[]);let[p,x]=(0,a.useState)(n.name),[v,j]=(0,a.useState)(null!=(s=n.conversationGroup)?s:"");(0,a.useEffect)(()=>x(n.name),[n.name]),(0,a.useEffect)(()=>{var e;return j(null!=(e=n.conversationGroup)?e:"")},[n.conversationGroup]);let g=(0,N.p)(),f=async e=>{var s;if("unattended"===e&&!g&&!await (0,b.Z)(i("session.unattendedConfirm")))return;let l=await c.FH.start(n.id,e,n.planName);m(l.started?i("unattended"===e?"session.startedAuto":"session.startedStep"):i("session.notStarted",{reason:null!=(s=l.reason)?s:""})),r()},k=async()=>{await c.FH.stop(n.id),m(i("session.stopping")),r()},y=async()=>{await c.FH.setRunMode(n.id,"confirm"),m(i("session.askingAgain")),r()},w=async()=>{p.trim()&&p!==n.name&&await c.FH.updateSession(n.id,{name:p}),r()},C=async()=>{if(n.running)return void m(i("home.deleteRunning"));if(await (0,b.Z)(i("home.deleteConfirm",{name:n.name,n:n.tasks.length})))try{await c.FH.deleteSession(n.id),window.location.href="/"}catch(e){m(e.message)}},S=async()=>{var e;if(v.trim()!==(null!=(e=n.conversationGroup)?e:""))try{await c.FH.updateSession(n.id,{conversationGroup:v.trim()}),m(i("session.groupSaved")),r()}catch(e){m(e.message)}},F=n.running?i("state.running"):i("state.".concat(n.status));return(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("input",{type:"text",className:"grow",value:p,onChange:e=>x(e.target.value),onBlur:()=>void w()}),(0,l.jsx)("span",{className:"badge ".concat(n.running?"running":""),children:F})]}),!n.running&&(0,l.jsxs)("div",{className:"run-choice",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("button",{className:"primary",onClick:()=>void f("unattended"),disabled:0===t,children:i("session.run",{n:t})}),(0,l.jsx)("p",{className:"why",children:i("session.runWhy")})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("button",{onClick:()=>void f("confirm"),disabled:0===t,children:i("session.runStep")}),(0,l.jsx)("p",{className:"why",children:i("session.runStepWhy")})]})]}),(0,l.jsxs)("div",{className:"row",style:{marginTop:10},children:[n.running&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{className:"danger",onClick:()=>void k(),children:i("session.stop")}),"unattended"===n.runMode&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"badge waiting-approval",children:i("session.modeUnattended")}),(0,l.jsx)("button",{onClick:()=>void y(),children:i("session.askAgain")})]})]}),(0,l.jsx)("span",{className:"muted small",children:o}),(0,l.jsx)("span",{className:"grow"}),(0,l.jsx)("button",{className:"quiet",onClick:()=>void C(),disabled:n.running,children:i("home.delete")}),n.chat?(0,l.jsx)("a",{href:n.chat.url,target:"_blank",rel:"noreferrer",className:"small",children:i("session.openChat",{name:n.chat.name})}):(0,l.jsx)("span",{className:"muted small",children:i("session.noChat")})]}),(0,l.jsx)("label",{htmlFor:"session-group",children:i("session.group")}),(0,l.jsx)("div",{className:"row",children:(0,l.jsx)("input",{id:"session-group",type:"text",className:"grow",value:v,placeholder:i("session.groupPlaceholder"),onChange:e=>j(e.target.value),onBlur:()=>void S(),disabled:n.running})}),(0,l.jsxs)("p",{className:"why",children:[i("session.groupWhy"),n.chat&&" ".concat(i("session.groupHasChat"))]}),(0,l.jsxs)("div",{className:"muted small",style:{marginTop:10},children:[i("session.willUseModel",{name:n.model||(h?i("model.followsDefault",{name:h}):i("model.default"))})," \xb7 ",n.mirror.enabled&&n.mirror.rootDir?i("session.willUseFiles",{root:n.mirror.rootDir,dirs:n.mirror.includeDirs.length?n.mirror.includeDirs.join(", "):"."}):(0,l.jsx)("span",{className:"err",children:i("session.noFiles")})]})]})}function D(e){var s;let{level1:n,sent:a}=e,{t}=(0,d.kj)();return(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("h2",{className:"grow",style:{margin:0},children:t("l1.title")}),(0,l.jsx)("span",{className:"badge",children:t(a?"l1.sent":"l1.notSent")}),(0,l.jsx)(i(),{href:"/level1",className:"small",children:t("l1.edit")})]}),(0,l.jsxs)("p",{className:"muted small",style:{marginBottom:6},children:[t("l1.hint"),(null==n?void 0:n.customised)?" ".concat(t("l1.customised")):""]}),(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:t("l1.show")}),(0,l.jsx)("pre",{className:"tall",children:null!=(s=null==n?void 0:n.content)?s:"…"})]})]})}function H(e){var s,n,t,r;let{session:i,onChange:o}=e,{t:m}=(0,d.kj)(),h=(0,d.W3)(),[u,p]=(0,a.useState)(null),[x,j]=(0,a.useState)(!1),[g,f]=(0,a.useState)("");(0,a.useEffect)(()=>{c.FH.models().then(p).catch(()=>void 0)},[]);let k=async e=>{try{await c.FH.updateSession(i.id,{model:e}),f(e?m("model.saved",{name:e}):m("model.savedDefault")),o()}catch(e){f(e.message)}},y=async()=>{try{let e=await c.FH.setDefaultModel(w);p(s=>s?{...s,defaultModel:e.defaultModel}:s),f(e.defaultModel?m("model.defaultSaved",{name:e.defaultModel}):m("model.defaultCleared"))}catch(e){f(e.message)}},N=async()=>{if(await (0,b.Z)(m("model.refreshConfirm"))){j(!0),f(m("model.refreshing"));try{var e;let s=await c.FH.refreshModels();p(s),f(0===s.options.length?null!=(e=s.note)?e:m("model.none"):m("model.refreshed",{n:s.options.length}))}catch(e){f(e.message)}finally{j(!1)}}},w=null!=(s=i.model)?s:"",C=null!=(n=null==u?void 0:u.options)?n:[],S=C.some(e=>e.name===w),F=C.filter(e=>!e.group),D=new Map;for(let e of C)e.group&&D.set(e.group,[...null!=(t=D.get(e.group))?t:[],e]);return(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("h2",{className:"grow",style:{margin:0},children:m("model.title")}),i.modelInUse&&(0,l.jsx)("span",{className:"chip",children:m("model.lastUsed",{name:i.modelInUse})})]}),(0,l.jsx)("p",{className:"muted small",children:m("model.hint")}),(0,l.jsxs)("div",{className:"row",children:[(0,l.jsxs)("select",{"aria-label":m("model.title"),value:w,disabled:i.running,onChange:e=>void k(e.target.value),style:{width:"auto",minWidth:260},children:[(0,l.jsx)("option",{value:"",children:(null==u?void 0:u.defaultModel)?m("model.followsDefault",{name:u.defaultModel}):m("model.default")}),w&&!S&&(0,l.jsx)("option",{value:w,children:m("model.notInList",{name:w})}),F.map(e=>(0,l.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(m("model.unavailable")):""]},e.name)),[...D.entries()].map(e=>{let[s,n]=e;return(0,l.jsx)("optgroup",{label:s,children:n.map(e=>(0,l.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(m("model.unavailable")):""]},e.name))},s)})]}),(0,l.jsx)("button",{onClick:()=>void N(),disabled:x||i.running,children:m("model.refresh")}),(0,l.jsx)("span",{className:"muted small",role:"status",children:g})]}),(0,l.jsx)(v.L,{current:w,onUse:e=>void k(e)}),(0,l.jsxs)("div",{className:"row",style:{marginTop:8},children:[(0,l.jsx)("span",{className:"muted small",children:(null==u?void 0:u.defaultModel)?m("model.defaultIs",{name:u.defaultModel}):m("model.defaultIsNone")}),(0,l.jsx)("button",{onClick:()=>void y(),disabled:w===(null!=(r=null==u?void 0:u.defaultModel)?r:""),children:w?m("model.makeDefault",{name:w}):m("model.clearDefault")})]}),(null==u?void 0:u.readAt)?(0,l.jsxs)("p",{className:"muted small",style:{marginTop:8},children:[m("model.readAt",{t:h(u.readAt),n:u.options.length}),u.current?" ".concat(m("model.chatWasOn",{name:u.current})):"",u.note?" ".concat(u.note):""]}):(0,l.jsx)("p",{className:"muted small",style:{marginTop:8},children:m("model.neverRead")}),C.length>0&&(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:m("model.showDetails")}),(0,l.jsx)("pre",{className:"tall",children:C.map(e=>"".concat(e.selected?"*":" "," ").concat(e.group?"".concat(e.group," > "):"").concat(e.name)+"".concat(e.disabled?" [unavailable]":"","\n ").concat(e.raw.replace(/\n/g," | "))).join("\n")})]})]})}function I(e){var s,n;let{session:t,onChange:r}=e,{t:i}=(0,d.kj)(),o=null!=(s=t.review)?s:{enabled:!0,model:""},[m,h]=(0,a.useState)(o.enabled),[u,p]=(0,a.useState)(null!=(n=o.model)?n:""),[x,g]=(0,a.useState)(""),[f,k]=(0,a.useState)(!1),[b,y]=(0,a.useState)("");(0,a.useEffect)(()=>{c.FH.models().then(e=>{var s;return y(null!=(s=e.defaultReviewModel)?s:"")}).catch(()=>void 0)},[]);let N=async()=>{k(!0),g("");try{await c.FH.updateSession(t.id,{review:{enabled:m,model:u}}),g(i("review.saved")),r()}catch(e){g(e.message)}finally{k(!1)}};return(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("h2",{className:"grow",style:{margin:0},children:i("review.title")}),(0,l.jsx)("span",{className:"badge ".concat(m?"done":""),children:m?i("review.on"):i("review.off")})]}),(0,l.jsx)("p",{className:"muted small",children:i("review.hint")}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"checkbox",checked:m,onChange:e=>h(e.target.checked),disabled:t.running}),(0,l.jsx)("span",{children:i("review.enable")})]}),(0,l.jsx)("p",{className:"why",children:i("review.enableWhy")})]}),(0,l.jsx)("label",{htmlFor:"review-model",children:i("review.modelField")}),(0,l.jsx)("div",{className:"row",children:(0,l.jsx)(j.Y,{id:"review-model",chosen:u,onChange:p,none:b?i("model.followsDefault",{name:b}):i("review.modelSame"),disabled:t.running||!m})}),(0,l.jsx)("p",{className:"why",children:i("review.modelWhy")}),(0,l.jsx)(v.z4,{current:u,onUse:e=>p(e)}),(0,l.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,l.jsx)("button",{className:"primary",onClick:()=>void N(),disabled:f||t.running,children:i("review.save")}),x&&(0,l.jsx)("span",{className:"muted small",children:x})]})]})}function T(e){var s,n,t,r,i,o,m,h,u;let{session:p,onChange:x}=e,{t:j}=(0,d.kj)(),g=null!=(n=p.vcs)?n:{enabled:!0,repoDir:"",branchMode:"per-task",commitOnFinish:!0,branchPrefix:"cop/"},[f,k]=(0,a.useState)(g.repoDir),[b,y]=(0,a.useState)(null),[N,w]=(0,a.useState)(""),[C,S]=(0,a.useState)(!1),F=JSON.stringify(g),[D,H]=(0,a.useState)(null),[I,T]=(0,a.useState)(null!=(t=g.branchName)?t:"");(0,a.useEffect)(()=>{var e;return T(null!=(e=JSON.parse(F).branchName)?e:"")},[F]);let[M,P]=(0,a.useState)(null!=(r=g.baseBranch)?r:"");(0,a.useEffect)(()=>{var e;return P(null!=(e=JSON.parse(F).baseBranch)?e:"")},[F]);let W=null!=(i=g.startFrom)?i:"head";(0,a.useEffect)(()=>{k(JSON.parse(F).repoDir)},[F]);let L=JSON.parse(F).repoDir||p.mirror.rootDir||"";(0,a.useEffect)(()=>{let e=!1;return L.trim()?(c.FH.repoCheck(L).then(s=>{var n;e||H(s.ok?null:null!=(n=s.problem)?n:null)}).catch(()=>{e||H(null)}),()=>{e=!0}):void H(null)},[L]);let O=(0,a.useCallback)(()=>{c.FH.vcsStatus(p.id).then(y).catch(()=>y(null))},[p.id]);(0,a.useEffect)(O,[O,F]);let A=async e=>{try{await c.FH.updateSession(p.id,{vcs:e}),w(j("vcs.saved")),x(),O()}catch(e){w(e.message)}},B=async()=>{S(!0),w(j("mirror.browsing"));try{let s=await c.FH.browseFolder(f.trim()||p.mirror.rootDir||void 0);if(s.ok)k(s.path),await A({repoDir:s.path});else{var e;w(s.cancelled?j("mirror.browseCancelled"):null!=(e=s.reason)?e:"")}}finally{S(!1)}},E=g.repoDir||p.mirror.rootDir||"",R=""!==E.trim()&&null===D;return(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("h2",{className:"grow",style:{margin:0},children:j("vcs.title")}),(0,l.jsx)("span",{className:"badge ".concat(g.enabled?"done":""),children:g.enabled?j("vcs.on"):j("vcs.off")})]}),(0,l.jsx)("p",{className:"muted small",children:j("vcs.hint")}),(0,l.jsx)("label",{htmlFor:"vcs-root",children:j("vcs.repoField")}),(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("input",{id:"vcs-root",type:"text",className:"grow",value:f,onChange:e=>k(e.target.value),onBlur:()=>f.trim()!==g.repoDir&&void A({repoDir:f.trim()}),placeholder:p.mirror.rootDir||"C:\\Projects\\my-app",disabled:p.running}),(0,l.jsx)("button",{onClick:()=>void B(),disabled:C||p.running,children:j("mirror.browse")})]}),(0,l.jsx)(v.H4,{current:f,onUse:e=>{k(e),A({repoDir:e})}}),D&&(0,l.jsxs)("div",{className:"notice caution",style:{marginTop:8},children:[(0,l.jsx)("strong",{children:j("vcs.noRepo")}),(0,l.jsx)("div",{className:"small",style:{marginTop:4},children:D}),(0,l.jsx)("div",{className:"muted small",style:{marginTop:6},children:j("vcs.noRepoHow")})]}),!D&&""!==E.trim()&&(0,l.jsx)("p",{className:"muted small",style:{marginTop:4},children:j("vcs.repoOk")}),""===E.trim()&&(0,l.jsx)("p",{className:"muted small",style:{marginTop:4},children:j("vcs.pickFirst")}),(0,l.jsxs)("div",{className:"option".concat(R||g.enabled?"":" warned"),children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"checkbox",checked:g.enabled,onChange:e=>void A({enabled:e.target.checked}),disabled:p.running||!R&&!g.enabled}),(0,l.jsx)("span",{children:j("vcs.enable")})]}),(0,l.jsx)("p",{className:"why",children:j("vcs.enableWhy")})]}),g.enabled&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"muted small",style:{marginTop:4},children:E?j("vcs.repoIs",{dir:E}):j("vcs.repoNone")}),(0,l.jsx)("h3",{children:j("vcs.branches")}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:"branchMode",checked:"per-task"===g.branchMode,onChange:()=>void A({branchMode:"per-task"}),disabled:p.running}),(0,l.jsx)("span",{children:j("vcs.perTask")})]}),(0,l.jsx)("p",{className:"why",children:j("vcs.perTaskWhy")})]}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:"branchMode",checked:"per-session"===g.branchMode,onChange:()=>void A({branchMode:"per-session"}),disabled:p.running}),(0,l.jsx)("span",{children:j("vcs.perSession")})]}),(0,l.jsx)("p",{className:"why",children:j("vcs.perSessionWhy")})]}),"per-session"===g.branchMode&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("label",{htmlFor:"vcs-branch-name",children:j("vcs.branchName")}),(0,l.jsx)("input",{id:"vcs-branch-name",type:"text",value:I,onChange:e=>T(e.target.value),onBlur:()=>{var e;return I.trim()!==(null!=(e=g.branchName)?e:"")&&void A({branchName:I.trim()})},placeholder:p.name,disabled:p.running}),(0,l.jsx)("p",{className:"why",children:j("vcs.branchNameWhy")})]}),(0,l.jsx)("h3",{children:j("vcs.startFrom")}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:"startFrom",checked:"branch"===W,onChange:()=>void A({startFrom:"branch"}),disabled:p.running}),(0,l.jsx)("span",{children:j("vcs.startBranch")})]}),(0,l.jsx)("p",{className:"why",children:j("vcs.startBranchWhy")})]}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:"startFrom",checked:"previous-session"===W,onChange:()=>void A({startFrom:"previous-session"}),disabled:p.running}),(0,l.jsx)("span",{children:j("vcs.startPrevious")})]}),(0,l.jsx)("p",{className:"why",children:j("vcs.startPreviousWhy")})]}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:"startFrom",checked:"head"===W,onChange:()=>void A({startFrom:"head"}),disabled:p.running}),(0,l.jsx)("span",{children:j("vcs.startHead")})]}),(0,l.jsx)("p",{className:"why",children:j("vcs.startHeadWhy")})]}),"head"!==W&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("label",{htmlFor:"vcs-base-branch",children:j("vcs.baseBranch")}),(0,l.jsx)("input",{id:"vcs-base-branch",type:"text",value:M,onChange:e=>P(e.target.value),onBlur:()=>{var e;return M.trim()!==(null!=(e=g.baseBranch)?e:"")&&void A({baseBranch:M.trim()})},placeholder:"main",disabled:p.running}),(0,l.jsx)("p",{className:"why",children:j("vcs.baseBranchWhy")})]}),p.vcsStart&&(0,l.jsxs)("p",{className:"muted small",children:["previous-session"===p.vcsStart.kind?j("vcs.startedPrevious",{name:null!=(o=null==(s=p.vcsStart.fromSession)?void 0:s.name)?o:"",branch:null!=(m=p.vcsStart.branch)?m:"",commit:p.vcsStart.commit.slice(0,8)}):"branch"===p.vcsStart.kind?j("vcs.startedBranch",{branch:null!=(h=p.vcsStart.branch)?h:"",commit:p.vcsStart.commit.slice(0,8)}):j("vcs.startedHead",{commit:p.vcsStart.commit.slice(0,8)}),p.vcsStart.note?" — ".concat(p.vcsStart.note):""]}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"checkbox",checked:g.commitOnFinish,onChange:e=>void A({commitOnFinish:e.target.checked}),disabled:p.running}),(0,l.jsx)("span",{children:j("vcs.commit")})]}),(0,l.jsx)("p",{className:"why",children:j("vcs.commitWhy")})]}),b&&!b.ok&&(0,l.jsxs)("div",{className:"notice caution",role:"status",children:[(0,l.jsx)("strong",{children:j("vcs.notReady")})," ",b.problem]}),(null==b?void 0:b.ok)&&(0,l.jsx)("div",{className:"muted small",children:j("vcs.ready",{branch:null!=(u=b.branch)?u:"—",dir:b.repoDir})}),(null==b?void 0:b.ok)&&b.work&&b.work.branches.length>0&&(0,l.jsxs)("div",{className:"muted small",children:["per-session"===b.work.mode&&b.work.complete?j("vcs.completeOn",{branch:b.work.complete}):j("vcs.noSingleBranch",{n:b.work.branches.length}),"per-task"===b.work.mode&&(0,l.jsx)("ul",{style:{margin:"4px 0",paddingLeft:20},children:b.work.branches.map(e=>(0,l.jsxs)("li",{children:[(0,l.jsx)("code",{children:e.branch})," — ",e.title,e.commit?"":" (".concat(j("vcs.taskNoFiles"),")")]},e.branch))})]}),(0,l.jsx)("p",{className:"muted small",children:j("vcs.pushIsYours")})]}),(0,l.jsx)("div",{className:"muted small",role:"status",children:N})]})}function M(e){var s,n,t,r;let{session:i,onChange:o}=e,{t:m}=(0,d.kj)(),[h,x]=(0,a.useState)(i.mirror.enabled),[j,f]=(0,a.useState)(i.mirror.rootDir),[k,y]=(0,a.useState)(i.mirror.includeDirs.join("\n")),[N,w]=(0,a.useState)(i.mirror.excludeDirs.join("\n")),[C,S]=(0,a.useState)(null==(s=i.mirror.respectGitignore)||s),[F,D]=(0,a.useState)(null!=(n=i.mirror.includeEnvFiles)&&n),[H,I]=(0,a.useState)(null),[T,M]=(0,a.useState)(null),[W,L]=(0,a.useState)(""),[O,A]=(0,a.useState)(""),[B,E]=(0,a.useState)([]),R=JSON.stringify(i.mirror);(0,a.useEffect)(()=>{var e,s;let n=JSON.parse(R);x(n.enabled),f(n.rootDir),y(n.includeDirs.join("\n")),w(n.excludeDirs.join("\n")),S(null==(e=n.respectGitignore)||e),D(null!=(s=n.includeEnvFiles)&&s)},[R]),(0,a.useEffect)(()=>{c.FH.doctor().then(e=>{var s;return E(null!=(s=e.alwaysIgnoredDirs)?s:[])}).catch(()=>void 0)},[]);let U=p(k),G=p(N),q=function(e,s){let n=e.map(u).filter(Boolean),l=s.map(u).filter(Boolean),a=[];for(let e of n)for(let s of l)if(e.toLowerCase()===s.toLowerCase())a.push({include:e,exclude:s,kind:"same"});else("."===s?"."!==e:e.toLowerCase().startsWith("".concat(s.toLowerCase(),"/")))&&a.push({include:e,exclude:s,kind:"excluded-parent"});return a}(U,G),J={rootDir:j.trim(),includeDirs:U,excludeDirs:G,respectGitignore:C,includeEnvFiles:F},z=h&&!J.rootDir,Z=q.length>0||z,_=JSON.stringify({enabled:i.mirror.enabled,rootDir:i.mirror.rootDir,includeDirs:i.mirror.includeDirs,excludeDirs:i.mirror.excludeDirs,respectGitignore:null==(t=i.mirror.respectGitignore)||t,includeEnvFiles:null!=(r=i.mirror.includeEnvFiles)&&r}),K=JSON.stringify({enabled:h,...J}),Y=async()=>{if(!Z)try{await c.FH.updateSession(i.id,{mirror:{enabled:h,...J}}),A(m("mirror.saved")),o()}catch(e){A(e.message)}},$=async()=>{try{I(await c.FH.dirs(j,C)),A("")}catch(e){A(e.message)}},Q=async()=>{L("browse"),A(m("mirror.browsing"));try{let s=await c.FH.browseFolder(j.trim()||void 0);if(s.ok)f(s.path),I(null),M(null),A("");else{var e;A(s.cancelled?m("mirror.browseCancelled"):null!=(e=s.reason)?e:"")}}catch(e){A(e.message)}finally{L("")}},V=async()=>{if(!J.rootDir)return void A(m("mirror.needRoot"));L("check"),A(m("mirror.checking"));try{M(await c.FH.previewMirror(J)),A("")}catch(e){M(null),A(e.message)}finally{L("")}},X=async e=>{(!e||await (0,b.Z)(m("mirror.envWarn")))&&(D(e),M(null))};return(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("h2",{className:"grow",style:{margin:0},children:m("mirror.title")}),(0,l.jsx)("span",{className:"badge ".concat(i.mirror.enabled?"done":""),children:i.mirror.enabled?m("mirror.stateOn"):m("mirror.stateOff")})]}),(0,l.jsx)("p",{className:"muted small",children:m("mirror.hint",{example:"src--test--a.spec.ts.txt"})}),(0,l.jsx)("div",{className:"option",children:(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"checkbox",checked:h,onChange:e=>x(e.target.checked)}),(0,l.jsx)("span",{children:m("mirror.enable")})]})}),(0,l.jsx)("label",{htmlFor:"mirror-root",children:m("mirror.root")}),(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("input",{id:"mirror-root",type:"text",className:"grow",value:j,onChange:e=>{f(e.target.value),M(null)},placeholder:"C:\\Projects\\my-app"}),(0,l.jsx)("button",{onClick:()=>void Q(),disabled:"browse"===W,children:m("mirror.browse")}),(0,l.jsx)("button",{onClick:()=>void $(),disabled:!j.trim(),children:m("mirror.listDirs")})]}),(0,l.jsx)("div",{className:"muted small",style:{marginTop:4},children:m("mirror.rootHint")}),(0,l.jsx)(v.H4,{current:j,onUse:e=>{f(e),M(null)}}),H&&(0,l.jsx)("div",{className:"small muted",style:{margin:"6px 0"},children:0===H.length?m("mirror.noDirs"):H.join(" \xb7 ")}),(0,l.jsx)("h3",{children:m("mirror.rules")}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"checkbox",checked:C,onChange:e=>{S(e.target.checked),M(null)}}),(0,l.jsx)("span",{children:m("mirror.gitignore")})]}),(0,l.jsx)("p",{className:"why",children:m("mirror.gitignoreWhy")})]}),(0,l.jsxs)("div",{className:"option".concat(F?" warned":""),children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"checkbox",checked:F,onChange:e=>X(e.target.checked)}),(0,l.jsx)("span",{children:m("mirror.env")})]}),(0,l.jsx)("p",{className:"why",children:m("mirror.envWhy")}),F&&(0,l.jsx)("p",{className:"why",children:(0,l.jsx)("strong",{children:m("mirror.envOn")})})]}),B.length>0&&(0,l.jsx)("p",{className:"muted small",children:m("mirror.alwaysOut",{dirs:B.join(", ")})}),(0,l.jsxs)("div",{className:"row",style:{alignItems:"flex-start"},children:[(0,l.jsxs)("div",{className:"grow",children:[(0,l.jsx)("label",{htmlFor:"mirror-include",children:m("mirror.include")}),(0,l.jsx)("textarea",{id:"mirror-include",value:k,onChange:e=>{y(e.target.value),M(null)},placeholder:"src\ntests",style:{minHeight:80},"aria-invalid":q.length>0})]}),(0,l.jsxs)("div",{className:"grow",children:[(0,l.jsx)("label",{htmlFor:"mirror-exclude",children:m("mirror.exclude")}),(0,l.jsx)("textarea",{id:"mirror-exclude",value:N,onChange:e=>{w(e.target.value),M(null)},placeholder:"src/generated",style:{minHeight:80},"aria-invalid":q.length>0})]})]}),(0,l.jsx)(g.k,{rootDir:j,respectGitignore:C,includeEnvFiles:F,include:k.split("\n"),exclude:N.split("\n"),onChange:(e,s)=>{y(e.join("\n")),w(s.join("\n")),M(null)}}),q.length>0&&(0,l.jsxs)("div",{className:"notice",role:"alert",children:[(0,l.jsx)("strong",{children:m("mirror.conflict")}),(0,l.jsx)("ul",{children:q.map((e,s)=>(0,l.jsx)("li",{children:"same"===e.kind?m("mirror.conflictSame",{dir:e.include}):m("mirror.conflictParent",{include:e.include,exclude:e.exclude})},s))}),(0,l.jsx)("div",{style:{marginTop:6},children:m("mirror.conflictFix")})]}),z&&(0,l.jsx)("div",{className:"notice caution",role:"alert",children:(0,l.jsx)("strong",{children:m("mirror.needRoot")})}),K!==_&&(0,l.jsxs)("div",{className:"notice caution",role:"status",children:[(0,l.jsx)("strong",{children:m("mirror.unsaved")})," ",m("mirror.unsavedWhy")]}),(0,l.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,l.jsx)("button",{className:"primary",onClick:()=>void Y(),disabled:Z,children:m("mirror.save")}),(0,l.jsx)("button",{onClick:()=>void V(),disabled:q.length>0||"check"===W,children:m("mirror.check")}),(0,l.jsx)("span",{className:"muted small",role:"status",children:O})]}),T&&(0,l.jsx)(P,{preview:T})]})}function P(e){let{preview:s}=e,{t:n}=(0,d.kj)();return 0===s.files.length?(0,l.jsx)("div",{className:"notice caution",style:{marginTop:10},children:(0,l.jsx)("strong",{children:n("mirror.checkedNone")})}):(0,l.jsxs)("div",{className:"notice calm",style:{marginTop:10},children:[(0,l.jsx)("strong",{children:n("mirror.checked",{files:s.files.length,size:(0,c.zi)(s.totalBytes)})})," ",s.envFiles.length>0&&(0,l.jsx)("span",{className:"err",children:n("mirror.checkedEnv",{n:s.envFiles.length})})," ",s.skipped.length>0&&(0,l.jsx)("span",{className:"muted",children:n("mirror.checkedSkipped",{n:s.skipped.length})}),(0,l.jsxs)("details",{style:{marginTop:6},children:[(0,l.jsx)("summary",{children:n("mirror.showFiles")}),(0,l.jsx)("pre",{className:"tall",children:s.files.join("\n")})]}),s.skipped.length>0&&(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:n("mirror.showSkipped")}),(0,l.jsx)("pre",{className:"tall",children:s.skipped.map(e=>"".concat(e.relPath," — ").concat(e.reason)).join("\n")})]})]})}function W(e){var s;let{session:n,onChange:t}=e,{t:r}=(0,d.kj)(),[i,o]=(0,a.useState)(""),m=null!=(s=n.onFailure)?s:"stop",h=async e=>{if(e!==m)try{await c.FH.updateSession(n.id,{onFailure:e}),o(r("stop"===e?"chain.savedStop":"chain.savedContinue")),t()}catch(e){o(e.message)}};return(0,l.jsxs)("fieldset",{style:{border:0,padding:0,margin:"10px 0 14px"},children:[(0,l.jsx)("legend",{className:"muted small",style:{padding:0},children:r("chain.title")}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:"chain",checked:"stop"===m,onChange:()=>void h("stop"),disabled:n.running}),(0,l.jsx)("span",{children:r("chain.stop")})]}),(0,l.jsx)("p",{className:"why",children:r("chain.stopWhy")})]}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:"chain",checked:"continue"===m,onChange:()=>void h("continue"),disabled:n.running}),(0,l.jsx)("span",{children:r("chain.continue")})]}),(0,l.jsx)("p",{className:"why",children:r("chain.continueWhy")})]}),i&&(0,l.jsx)("div",{className:"muted small",role:"status",children:i}),n.running&&(0,l.jsx)("div",{className:"muted small",children:r("chain.locked")})]})}function L(e){let{value:s,onChange:n,presets:t,onPresetsChanged:r}=e,{t:i}=(0,d.kj)(),[o,m]=(0,a.useState)(""),h=async()=>{let e=prompt(i("l2.saveAsPrompt"));if(e)try{await c.FH.savePreset(e,s),m(i("l2.savedAs",{name:e})),null==r||r()}catch(e){m(e.message)}};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("label",{className:"grow",style:{margin:0},children:i("l2.label")}),(0,l.jsxs)("select",{value:"",onChange:e=>{let s=t.find(s=>s.name===e.target.value);s&&n(s.content)},children:[(0,l.jsx)("option",{value:"",children:i("l2.loadPreset")}),t.map(e=>(0,l.jsx)("option",{value:e.name,children:e.name},e.name))]}),(0,l.jsx)("button",{onClick:()=>void h(),disabled:!s.trim(),children:i("l2.saveAs")})]}),(0,l.jsx)("textarea",{className:"prose",value:s,onChange:e=>n(e.target.value),placeholder:i("l2.placeholder"),style:{minHeight:140,marginTop:10}}),o&&(0,l.jsx)("div",{className:"muted small",children:o})]})}function O(e){let{session:s}=e,{t:n}=(0,d.kj)(),t=(0,d.W3)(),r=s.tasks.filter(e=>"queued"!==e.status),[i,o]=(0,a.useState)([]),m=i.length>0?i:r.map(e=>e.id),h=e=>(0,c.ub)("".concat(c.nC,"/sessions/").concat(s.id,"/export?variant=").concat(e)+(i.length>0?"&tasks=".concat(encodeURIComponent(i.join(","))):""));return(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsx)("h2",{children:n("export.title")}),(0,l.jsx)("p",{className:"muted small",children:n("export.hint")}),0===r.length?(0,l.jsx)("div",{className:"empty",children:n("export.nothing")}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"row",style:{marginBottom:6},children:[(0,l.jsx)("button",{className:"quiet",onClick:()=>o(r.map(e=>e.id)),children:n("export.all")}),(0,l.jsx)("button",{className:"quiet",onClick:()=>o([]),children:n("export.none")}),(0,l.jsx)("span",{className:"muted small",children:i.length>0?n("export.selected",{n:i.length}):n("export.allOf",{n:r.length})})]}),r.map(e=>{var s,a;return(0,l.jsx)("div",{className:"option",style:{margin:"6px 0"},children:(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"checkbox",checked:i.includes(e.id),onChange:()=>{let s;return s=e.id,o(e=>e.includes(s)?e.filter(e=>e!==s):[...e,s])}}),(0,l.jsxs)("span",{children:[e.title," ",(0,l.jsx)("span",{className:"badge ".concat(e.status),children:n("status.".concat(e.status))})," ",e.readOnly&&(0,l.jsx)("span",{className:"chip",children:n("task.readOnly")})," ",(0,l.jsx)("span",{className:"muted small",children:t(null!=(a=null!=(s=e.finishedAt)?s:e.startedAt)?a:e.createdAt)})]})]})},e.id)}),(0,l.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,l.jsx)("a",{className:"button-link",href:h("outcome"),download:!0,children:n("export.outcome",{n:m.length})}),(0,l.jsx)("a",{className:"button-link",href:h("full"),download:!0,children:n("export.full",{n:m.length})})]}),(0,l.jsx)("p",{className:"muted small",style:{marginTop:8},children:n("export.outcomeWhy")})]})]})}function A(e){var s;let{session:n,presets:t,onAdded:r,onPresetsChanged:i}=e,{t:o}=(0,d.kj)(),m=[...n.tasks].reverse()[0],[h,u]=(0,a.useState)(""),[p,x]=(0,a.useState)(null!=(s=null==m?void 0:m.level2)?s:""),[v,j]=(0,a.useState)(""),[g,f]=(0,a.useState)(""),k=async()=>{try{await c.FH.addTask(n.id,{title:h,level2:p,prompt:v}),u(""),j(""),f(o("form.queued")),r()}catch(e){f(e.message)}};return(0,l.jsxs)("div",{className:"panel",id:"new-task",children:[(0,l.jsx)("h2",{children:o("form.title")}),(0,l.jsx)("p",{className:"muted small",children:o("form.hint")}),(0,l.jsx)("label",{children:o("form.titleLabel")}),(0,l.jsx)("input",{type:"text",value:h,onChange:e=>u(e.target.value),placeholder:o("form.titlePlaceholder")}),(0,l.jsx)("div",{style:{marginTop:10},children:(0,l.jsx)(L,{value:p,onChange:x,presets:t,onPresetsChanged:i})}),(0,l.jsx)("label",{children:o("form.taskLabel")}),(0,l.jsx)("textarea",{className:"prose",value:v,onChange:e=>j(e.target.value),placeholder:o("form.taskPlaceholder"),style:{minHeight:140}}),(0,l.jsxs)("div",{className:"row",style:{marginTop:10},children:[(0,l.jsx)("button",{className:"primary",onClick:()=>void k(),disabled:!v.trim(),children:o("form.add")}),(0,l.jsx)("span",{className:"muted small",children:g})]})]})}function B(e){var s,n,t,r,i,u,p,x,v,j,g,N,C,S,F,D,H,I,T,M,P,W,O,A,B,E,U,z,Z,_,K,Y,$,Q,V,X,ee,es,en,el,ea,et,er,ei,ec,ed,eo,em,eh,eu,ep,ex,ev,ej,eg,ef,ek,eb,ey,eN,ew,eC,eS;let{session:eF,task:eD,index:eH,presets:eI,onChange:eT}=e,{t:eM}=(0,d.kj)(),eP=(0,d.W3)(),[eW,eL]=(0,a.useState)(!1),[eO,eA]=(0,a.useState)(!1),[eB,eE]=(0,a.useState)(eD.title),[eR,eU]=(0,a.useState)(eD.level2),[eG,eq]=(0,a.useState)(eD.prompt),[eJ,ez]=(0,a.useState)(null!=(z=null==(s=eD.vcsPlan)?void 0:s.branch)?z:""),[eZ,e_]=(0,a.useState)(null!=(Z=null==(n=eD.vcsPlan)?void 0:n.commitMessage)?Z:""),[eK,eY]=(0,a.useState)(null!=(_=eD.checks)?_:[]),e$=(0,h.c)((0,m.DG)(eD)),[eQ,eV]=(0,a.useState)(null),[eX,e0]=(0,a.useState)(""),e1=async()=>{try{await c.FH.updateTask(eF.id,eD.id,{title:eB,level2:eR,prompt:eG,vcsPlan:{branch:eJ,commitMessage:eZ},checks:eK}),eL(!1),eT()}catch(e){e0(e.message)}},e2="running"===eD.status||"waiting-approval"===eD.status,e4=!e2&&"queued"!==eD.status,e6=!e2&&"queued"!==eD.status,e8=!e2&&null!=(K=null==(t=eF.vcs)?void 0:t.enabled)&&K&&(!!(null==(r=eD.vcs)?void 0:r.baseCommit)||(null!=(Y=eD.attempts)?Y:[]).some(e=>{var s;return null==(s=e.vcs)?void 0:s.baseCommit})),e5=!e2&&"limit-reached"===eD.status,e3=async()=>{if(await (0,b.Z)(eM("task.continueConfirm",{title:eD.title})))try{await c.FH.continueTask(eF.id,eD.id),eT()}catch(e){e0(e.message)}},e7=async()=>{if(await (0,b.Z)(eM("task.rerunConfirm",{title:eD.title})))try{await c.FH.rerunTask(eF.id,eD.id),eT()}catch(e){e0(e.message)}},e9=async()=>{if(await (0,b.Z)(eM("task.editRanConfirm",{title:eD.title})))try{await c.FH.rerunTask(eF.id,eD.id,{title:eB,level2:eR,prompt:eG,vcsPlan:{branch:eJ,commitMessage:eZ},checks:eK},{buildOnFinished:"done"===eD.status}),eL(!1),eT()}catch(e){e0(e.message)}},se=(0,w.e)(eT),ss=async()=>{let e="queued"===eD.status?"task.deleteConfirm":"task.deleteConfirmRan";if(await (0,b.Z)(eM(e,{title:eD.title})))try{await c.FH.deleteTask(eF.id,eD.id),eT()}catch(e){e0(e.message)}},sn=async()=>{eQ||eV(await c.FH.taskFiles(eF.id,eD.id))},sl=(e,s,n)=>n.length>0&&(0,l.jsxs)("div",{children:[(0,l.jsxs)("span",{className:"muted",children:[eM(e)," "]}),n.map(e=>(0,l.jsx)("span",{style:{marginRight:10},children:(0,l.jsx)(o.u,{label:e,save:()=>c.FH.saveTaskFile(eF.id,eD.id,s,e)})},e))]});return(0,l.jsxs)("div",{className:"task ".concat(eD.status),id:eD.id,children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsxs)("h4",{className:"grow",children:[eH,". ",eD.title]}),(0,l.jsx)("span",{className:"badge ".concat(eD.status),children:eM("status.".concat(eD.status))}),(null!=($=eD.attempt)?$:1)>1&&(0,l.jsx)("span",{className:"chip",children:eM("task.attemptN",{n:null!=(Q=eD.attempt)?Q:1})}),eD.iterations>0&&(0,l.jsx)("span",{className:"muted small",children:eM("task.iterations",{n:eD.iterations})}),eD.runId&&(0,l.jsxs)("button",{className:eO?"":"quiet",onClick:()=>eA(e=>!e),title:(0,m.DG)(eD)?eM("story.showLiveWhy"):eM("story.why"),children:[(0,m.DG)(eD)&&!eO&&(0,l.jsx)("span",{className:"dot","aria-hidden":"true"}),eO?eM("story.hide"):(0,m.DG)(eD)?eM("story.showLive"):eM("story.show")]}),!e2&&(0,l.jsx)("button",{onClick:()=>eL(e=>!e),title:eM("task.editAll"),children:eW?eM("task.cancel"):eM("task.edit")}),e5&&(0,l.jsx)("button",{className:"primary",onClick:()=>void e3(),title:eM("task.continueWhy"),children:eM("task.continue")}),e6&&(0,l.jsx)("button",{className:e5?"":"primary",onClick:()=>void e7(),title:eM("task.rerunWhy"),children:eM("task.rerun")}),e8&&(0,l.jsx)("button",{onClick:()=>void se.restore({sessionId:eF.id,taskId:eD.id,title:eD.title}),disabled:""!==se.busy||eF.running,title:eM("restore.why"),children:"restore"===se.busy?eM("restore.checking"):eM("restore.button")}),e4&&(0,l.jsx)("button",{onClick:()=>void se.restartFrom({sessionId:eF.id,taskId:eD.id,title:eD.title}),disabled:""!==se.busy||eF.running,title:eM("restart.why"),children:"restart"===se.busy?eM("restart.checking"):eM("restart.button")}),!e2&&(0,l.jsx)("button",{className:"danger",onClick:()=>void ss(),children:eM("task.delete")}),!eW&&(eX||se.message)&&(0,l.jsx)("span",{className:"err",role:"alert",children:eX||se.message})]}),(0,l.jsxs)("div",{className:"muted small",children:[eD.startedAt?eM("task.started",{t:eP(eD.startedAt)}):eM("task.added",{t:eP(eD.createdAt)}),eD.finishedAt?" \xb7 ".concat(eM("task.finished",{t:eP(eD.finishedAt)})):"",eD.startedAt&&eD.finishedAt?" \xb7 ".concat(eM("task.took",{d:(0,c.c5)((0,m.d5)(eD.startedAt,eD.finishedAt))})):"",(0,m.DG)(eD)?" \xb7 ".concat(eM("task.runningFor",{d:(0,c.c5)((0,m.d5)(eD.startedAt,void 0,e$))})):""]}),"queued"!==eD.status&&(null==(i=eF.vcs)?void 0:i.enabled)&&eD.vcs&&(0,l.jsx)("div",{className:"muted small",children:eD.vcs.problem&&!eD.vcs.branch?(0,l.jsx)("span",{className:"reason",children:eM("vcs.taskProblem",{problem:eD.vcs.problem})}):(0,l.jsxs)(l.Fragment,{children:[eD.vcs.branch&&eM("vcs.taskBranch",{branch:eD.vcs.branch}),eD.vcs.baseCommit&&" \xb7 ".concat(eM("vcs.taskBase",{commit:eD.vcs.baseCommit.slice(0,8)})),eD.vcs.commit?" \xb7 ".concat(eM("vcs.taskCommit",{commit:eD.vcs.commit.slice(0,8)})):" \xb7 ".concat(eM("vcs.taskNoFiles")),(null!=(V=null==(u=eD.vcs.files)?void 0:u.length)?V:0)>0&&(0,l.jsxs)("details",{style:{display:"inline"},children:[(0,l.jsxs)("summary",{style:{display:"inline",cursor:"pointer"},children:[" \xb7 ",eM("vcs.taskFiles",{n:null!=(X=null==(p=eD.vcs.files)?void 0:p.length)?X:0})]}),(0,l.jsx)("ul",{style:{margin:"4px 0 4px 0",paddingLeft:20},children:(null!=(ee=eD.vcs.files)?ee:[]).map(e=>(0,l.jsxs)("li",{children:[(0,l.jsx)("code",{children:e.path})," ",e.added<0||e.removed<0?eM("vcs.taskBinary"):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("span",{style:{color:"var(--ok)"},children:["+",e.added]})," ",(0,l.jsxs)("span",{style:{color:"var(--bad)"},children:["-",e.removed]})]})]},e.path))})]}),eD.vcs.commit&&eD.vcs.baseCommit&&(0,l.jsxs)(l.Fragment,{children:[" \xb7 ",(0,l.jsx)(y.C,{sessionId:eF.id,taskId:eD.id,title:eD.title,files:null!=(es=null==(x=eD.vcs.files)?void 0:x.length)?es:0})]}),(null!=(en=null==(v=eD.vcs.suspicious)?void 0:v.length)?en:0)>0&&(0,l.jsxs)("div",{className:"err small",style:{marginTop:4},children:[eM("vcs.suspicious",{n:null!=(el=null==(j=eD.vcs.suspicious)?void 0:j.length)?el:0}),(0,l.jsx)("ul",{style:{margin:"4px 0",paddingLeft:20},children:(null!=(ea=eD.vcs.suspicious)?ea:[]).map(e=>(0,l.jsxs)("li",{children:[(0,l.jsx)("code",{children:e.path})," — ",e.reason]},e.path))})]})]})}),"queued"===eD.status&&(null==(g=eF.vcs)?void 0:g.enabled)&&((null==(N=eD.vcsPlan)?void 0:N.branch)||(null==(C=eD.vcsPlan)?void 0:C.commitMessage))&&(0,l.jsx)("div",{className:"muted small",children:eD.vcsPlan.branch&&eD.vcsPlan.commitMessage?eM("task.gitNames",{branch:eD.vcsPlan.branch,subject:eD.vcsPlan.commitMessage.split("\n")[0]}):eD.vcsPlan.branch?eM("task.gitBranchOnly",{branch:eD.vcsPlan.branch}):eM("task.gitCommitOnly",{subject:(null!=(et=eD.vcsPlan.commitMessage)?et:"").split("\n")[0]})}),eO&&eD.runId&&(0,l.jsx)(f.P,{sessionId:eF.id,taskId:eD.id,live:"running"===eD.status||"waiting-approval"===eD.status}),eW?(0,l.jsxs)("div",{style:{marginTop:8},children:[(0,l.jsx)("label",{children:eM("form.titleLabel")}),(0,l.jsx)("input",{type:"text",value:eB,onChange:e=>eE(e.target.value)}),(0,l.jsx)("div",{style:{marginTop:8},children:(0,l.jsx)(L,{value:eR,onChange:eU,presets:eI})}),(0,l.jsx)("label",{children:eM("form.taskLabel")}),(0,l.jsx)("textarea",{className:"prose",value:eG,onChange:e=>eq(e.target.value)}),(null==(S=eF.vcs)?void 0:S.enabled)&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("label",{htmlFor:"branch-".concat(eD.id),children:eM("task.branch")}),(0,l.jsx)("input",{id:"branch-".concat(eD.id),type:"text",value:eJ,onChange:e=>ez(e.target.value),placeholder:eF.vcs.branchPrefix,disabled:"per-session"===eF.vcs.branchMode}),(0,l.jsx)("p",{className:"why",children:"per-session"===eF.vcs.branchMode?eM("task.branchIgnored"):eM("task.branchWhy")}),(0,l.jsx)("label",{htmlFor:"commit-".concat(eD.id),children:eM("task.commitMessage")}),(0,l.jsx)("textarea",{id:"commit-".concat(eD.id),value:eZ,onChange:e=>e_(e.target.value),style:{minHeight:70}}),(0,l.jsx)("p",{className:"why",children:eM("task.commitWhy")})]}),(0,l.jsx)(R,{checks:eK,onChange:eY}),(0,l.jsxs)("div",{className:"row",style:{marginTop:8},children:[(0,l.jsx)("button",{className:"primary",onClick:()=>void(e4?e9():e1()),children:e4?eM("task.saveAndRerun"):eM("task.save")}),(0,l.jsx)("span",{className:"err",children:eX})]}),e4&&(0,l.jsx)("p",{className:"muted small",children:eM("task.editRanWhy")})]}):(0,l.jsxs)(l.Fragment,{children:[(null!=(er=null==(F=eD.checks)?void 0:F.length)?er:0)>0&&(0,l.jsxs)("details",{className:"small",style:{margin:"6px 0"},children:[(0,l.jsxs)("summary",{children:[eM("checks.title")," — ",eM("checks.n",{n:null!=(ei=null==(D=eD.checks)?void 0:D.length)?ei:0}),(null!=(ec=null==(H=eD.checkResults)?void 0:H.length)?ec:0)>0&&" \xb7 ".concat((null!=(ed=eD.checkResults)?ed:[]).filter(e=>e.passed).length,"/").concat(null==(I=eD.checkResults)?void 0:I.length," ").concat(eM("checks.passed"))]}),(0,l.jsx)("ul",{style:{margin:"6px 0",paddingLeft:20},children:(null!=(eo=eD.checks)?eo:[]).map((e,s)=>{var n;let a=(null!=(n=eD.checkResults)?n:[]).find(s=>s.name===e.name);return(0,l.jsxs)("li",{children:[(0,l.jsx)("strong",{children:e.name}),(0,l.jsxs)("span",{className:"muted",children:[" — ",eM("checks.kind.".concat(e.expect)),e.value?' "'.concat(e.value,'"'):"",e.run?": ".concat(e.run):e.file?": ".concat(e.file):""]}),a&&(0,l.jsxs)("div",{className:a.passed?"muted":"reason",children:[a.passed?eM("checks.passed"):eM("checks.failed")," — ",a.detail]})]},"".concat(e.name,"-").concat(s))})})]}),(null!=(em=null==(T=eD.reviewChecks)?void 0:T.length)?em:0)>0&&(0,l.jsxs)("details",{className:"small",style:{margin:"6px 0"},children:[(0,l.jsx)("summary",{children:eM("checks.fromReview",{n:null!=(eh=null==(M=eD.reviewChecks)?void 0:M.length)?eh:0})}),(0,l.jsx)("p",{className:"why",children:eM("checks.fromReviewWhy")}),(0,l.jsx)("ul",{style:{margin:"6px 0",paddingLeft:20},children:(null!=(eu=eD.reviewChecks)?eu:[]).map(e=>{var s;let n=(null!=(s=eD.checkResults)?s:[]).find(s=>s.name===e.check.name);return(0,l.jsxs)("li",{children:[(0,l.jsx)("code",{children:e.findingId})," ",(0,l.jsx)("strong",{children:e.check.name}),"active"!==e.state&&(0,l.jsx)("span",{className:"chip",style:{marginLeft:6},children:eM("checks.state.".concat(e.state))}),(0,l.jsx)("div",{className:"muted",children:e.what}),n&&(0,l.jsxs)("div",{className:n.passed?"muted":"reason",children:[n.passed?eM("checks.passed"):eM("checks.failed")," — ",n.detail]})]},e.check.name)})})]}),(0,l.jsx)(J,{review:eD.review}),eD.summary&&(0,l.jsxs)("div",{className:"summary",children:[(0,l.jsx)("strong",{children:eM("task.whatWasDone")}),(0,l.jsx)(k.s,{text:eD.summary})]}),(null!=(ep=null==(P=eD.deviations)?void 0:P.length)?ep:0)>0&&(0,l.jsx)(G,{items:null!=(ex=eD.deviations)?ex:[]}),(null!=(ev=null==(W=eD.disputes)?void 0:W.length)?ev:0)>0&&(0,l.jsx)(q,{items:null!=(ej=eD.disputes)?ej:[]}),eD.environment&&(0,l.jsx)("div",{className:"muted small",style:{margin:"4px 0"},children:eM("task.ranWith",{node:eD.environment.node,npm:null!=(eg=eD.environment.npm)?eg:"—",git:null!=(ef=eD.environment.git)?ef:"—",pwsh:null!=(eb=null!=(ek=eD.environment.pwsh)?ek:eD.environment.powershell)?eb:"—"})}),(null!=(ey=null==(O=eD.leftovers)?void 0:O.length)?ey:0)>0&&(0,l.jsxs)("div",{className:"err small",style:{margin:"6px 0"},children:[eM("task.leftovers",{n:null!=(eN=null==(A=eD.leftovers)?void 0:A.length)?eN:0}),(0,l.jsx)("ul",{style:{margin:"4px 0",paddingLeft:20},children:(null!=(ew=eD.leftovers)?ew:[]).map(e=>(0,l.jsxs)("li",{children:[(0,l.jsx)("code",{children:e.name})," pid ",e.pid,e.ports.length>0?" \xb7 ".concat(eM("task.leftoverPorts",{ports:e.ports.join(", ")})):""," \xb7 ",e.by]},"".concat(e.by,"-").concat(e.pid)))})]}),eD.reason&&(0,l.jsx)("div",{className:"reason small",style:{margin:"6px 0"},children:eD.reason}),(null!=(eC=null==(B=eD.attempts)?void 0:B.length)?eC:0)>0&&(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:eM("task.attempts",{n:null!=(eS=null==(E=eD.attempts)?void 0:E.length)?eS:0})}),null==(U=eD.attempts)?void 0:U.map((e,s)=>{var n,a,t,r;return(0,l.jsxs)("div",{className:"small",style:{margin:"8px 0 12px"},children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("strong",{children:eM("task.attemptN",{n:s+1})}),(0,l.jsx)("span",{className:"badge ".concat(e.status),children:eM("status.".concat(e.status))}),e.iterations>0&&(0,l.jsx)("span",{className:"muted",children:eM("task.iterations",{n:e.iterations})}),e.runId&&(0,l.jsx)(o.u,{label:eM("save.attemptLog"),save:()=>c.FH.saveTaskLog(eF.id,eD.id,e.runId)}),e.runId&&(0,l.jsx)(o.H,{sessionId:eF.id,taskId:eD.id,attempt:s+1}),e.runId&&(null==(n=e.vcs)?void 0:n.commit)&&e.vcs.baseCommit&&(0,l.jsx)(y.C,{sessionId:eF.id,taskId:eD.id,runId:e.runId,title:"".concat(eD.title," — ").concat(eM("task.attemptN",{n:s+1})),files:null!=(t=null==(a=e.vcs.files)?void 0:a.length)?t:0})]}),(0,l.jsxs)("div",{className:"muted",children:[e.startedAt?eM("task.started",{t:eP(e.startedAt)}):"",e.finishedAt?" \xb7 ".concat(eM("task.finished",{t:eP(e.finishedAt)})):""]}),e.summary&&(0,l.jsx)("div",{children:e.summary}),e.reason&&(0,l.jsx)("div",{className:"err",children:e.reason}),e.prompt&&e.prompt!==eD.prompt&&(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:eM("task.attemptText")}),(0,l.jsx)("pre",{children:e.prompt})]})]},"".concat(null!=(r=e.runId)?r:s))})]}),"queued"===eD.status?(0,l.jsxs)("div",{style:{marginTop:8},children:[(0,l.jsx)("div",{className:"muted small",children:eM("task.prompt")}),(0,l.jsx)("pre",{children:eD.prompt}),eD.level2.trim()?(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:eM("task.l2Show",{n:eD.level2.trim().split("\n").length})}),(0,l.jsx)("pre",{children:eD.level2})]}):(0,l.jsx)("div",{className:"muted small",children:eM("task.noL2")})]}):(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:eM("task.promptAndL2")}),eD.level2.trim()&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"muted small",children:eM("task.l2")}),(0,l.jsx)("pre",{children:eD.level2})]}),(0,l.jsx)("div",{className:"muted small",children:eM("task.prompt")}),(0,l.jsx)("pre",{children:eD.prompt})]}),eD.firstMessage&&(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:eM("task.firstMessage")}),(0,l.jsx)("pre",{className:"tall",children:eD.firstMessage})]}),eD.runId&&(0,l.jsxs)("details",{onToggle:e=>e.currentTarget.open&&void sn(),children:[(0,l.jsx)("summary",{children:eM("task.files")}),(0,l.jsx)("div",{className:"row small",style:{margin:"6px 0"},children:(0,l.jsx)(o.u,{label:eM("save.log"),save:()=>c.FH.saveTaskLog(eF.id,eD.id)})}),eQ&&(0,l.jsxs)("div",{className:"small",children:[sl("task.reports","reports",eQ.reports),sl("task.artifacts","artifacts",eQ.artifacts),sl("task.replies","replies",eQ.replies)]})]}),eD.finalReply&&(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:eM("task.finalReply")}),(0,l.jsx)("pre",{className:"tall",children:eD.finalReply})]})]})]})}function E(e){let{events:s}=e,{t:n}=(0,d.kj)(),{appearance:t}=(0,x.K)(),r=(0,a.useRef)(null);return(0,a.useEffect)(()=>{!t.reduceMotion&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[s.length,t.reduceMotion]),(0,l.jsxs)("div",{className:"panel",children:[(0,l.jsx)("h2",{children:n("live.title")}),(0,l.jsxs)("div",{className:"log",ref:r,children:[0===s.length&&(0,l.jsx)("div",{className:"muted",children:n("live.none")}),s.map((e,s)=>{var n;return(0,l.jsxs)("div",{className:e.level,children:[(0,l.jsx)("span",{className:"time",children:new Date(e.at).toLocaleTimeString(void 0,{hour12:!1})}),null!=(n=e.message)?n:e.type]},s)})]})]})}function R(e){let{checks:s,onChange:n}=e,{t:a}=(0,d.kj)(),t=(e,l)=>n(s.map((s,n)=>e===n?{...s,...l}:s));return(0,l.jsxs)("div",{style:{marginTop:12},children:[(0,l.jsx)("label",{children:a("checks.title")}),(0,l.jsx)("p",{className:"why",style:{marginTop:0},children:a("checks.why")}),0===s.length&&(0,l.jsx)("p",{className:"muted small",children:a("checks.noneWhy")}),s.map((e,r)=>{var i,d,o,m;return(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("input",{type:"text",className:"grow",value:e.name,placeholder:a("checks.namePlaceholder"),onChange:e=>t(r,{name:e.target.value}),"aria-label":a("checks.name")}),(0,l.jsx)("select",{value:e.expect,onChange:e=>t(r,{expect:e.target.value}),"aria-label":a("checks.kind"),style:{width:"auto"},children:c.FZ.map(e=>(0,l.jsx)("option",{value:e,children:a("checks.kind.".concat(e))},e))}),(0,l.jsx)("button",{className:"quiet",onClick:()=>n(s.filter((e,s)=>s!==r)),children:a("checks.remove")})]}),(0,l.jsxs)("div",{className:"row",style:{marginTop:6},children:[(0,c.rt)(e.expect)?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("input",{type:"text",className:"grow",value:null!=(i=e.run)?i:"",placeholder:a("checks.run"),onChange:e=>t(r,{run:e.target.value}),"aria-label":a("checks.run")}),(0,l.jsx)("input",{type:"text",value:null!=(d=e.cwd)?d:"",placeholder:a("checks.cwd"),onChange:e=>t(r,{cwd:e.target.value}),"aria-label":a("checks.cwd"),style:{width:220}})]}):(0,l.jsx)("input",{type:"text",className:"grow",value:null!=(o=e.file)?o:"",placeholder:a("checks.file"),onChange:e=>t(r,{file:e.target.value}),"aria-label":a("checks.file")}),(0,c.dK)(e.expect)&&(0,l.jsx)("input",{type:"text",value:null!=(m=e.value)?m:"",placeholder:"output-matches"===e.expect?a("checks.valueRegex"):a("checks.value"),onChange:e=>t(r,{value:e.target.value}),"aria-label":a("checks.value"),style:{width:240}})]})]},r)}),(0,l.jsx)("button",{onClick:()=>n([...s,{name:"",expect:"exit-zero",run:""}]),children:a("checks.add")})]})}function U(e){let{tasks:s}=e,{t:n}=(0,d.kj)(),a=(0,m.hH)(s),t=(0,h.c)(!!a&&a.tasks.some(m.DG));if(!a)return null;let r=(0,m.eZ)(a.run,a.tasks,t);return(0,l.jsx)("p",{className:"muted small",style:{margin:"4px 0 10px"},children:n(r.live?"session.runClockLive":"session.runClock",{n:r.tasks,d:(0,c.c5)(r.ms)})})}function G(e){let{items:s}=e,{t:n}=(0,d.kj)();return(0,l.jsxs)("div",{className:"summary",children:[(0,l.jsx)("strong",{children:n("task.deviations",{n:s.length})}),(0,l.jsx)("ol",{style:{margin:"6px 0",paddingLeft:20},children:s.map((e,s)=>(0,l.jsxs)("li",{style:{marginBottom:6},children:[(0,l.jsx)("div",{children:e.instruction}),(0,l.jsxs)("div",{className:"muted",children:[n("task.deviationDid"),": ",e.did]}),(0,l.jsxs)("div",{className:"muted",children:[n("task.deviationWhy"),": ",e.why]})]},s))})]})}function q(e){let{items:s}=e,{t:n}=(0,d.kj)();return(0,l.jsxs)("div",{className:"summary",children:[(0,l.jsx)("strong",{children:n("task.disputes",{n:s.length})}),(0,l.jsx)("ol",{style:{margin:"6px 0",paddingLeft:20},children:s.map((e,s)=>(0,l.jsxs)("li",{style:{marginBottom:6},children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("code",{children:e.finding})," — ",e.why]}),(0,l.jsxs)("div",{className:"muted",children:[n("review.evidence"),": ",e.evidence]})]},s))})]})}function J(e){var s,n,a,t,r;let{review:i}=e,{t:c}=(0,d.kj)();if(!i||"skipped"===i.verdict)return null;let o="pass"===i.verdict?"done":"fail"===i.verdict?"blocked":"waiting-approval";return(0,l.jsxs)("div",{className:"small",style:{margin:"8px 0"},children:[(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("span",{className:"badge ".concat(o),children:c("review.verdict.".concat(i.verdict))}),i.stepsRun>0&&(0,l.jsx)("span",{className:"muted",children:c("review.ran",{n:i.stepsRun})}),i.rounds>1&&(0,l.jsx)("span",{className:"muted",children:c("review.rounds",{n:i.rounds})}),i.model&&(0,l.jsx)("span",{className:"chip",children:c("review.onModel",{model:i.model})})]}),i.problem&&(0,l.jsx)("p",{className:"reason",children:c("review.problem",{problem:i.problem})}),i.summary&&(0,l.jsx)(k.s,{text:i.summary}),(null!=(a=null==(s=i.findings)?void 0:s.length)?a:0)>0&&(0,l.jsxs)("details",{style:{marginTop:4},children:[(0,l.jsx)("summary",{children:c("review.findings",{n:null!=(t=null==(n=i.findings)?void 0:n.length)?t:0})}),(0,l.jsx)("ol",{style:{margin:"6px 0",paddingLeft:20},children:(null!=(r=i.findings)?r:[]).map((e,s)=>(0,l.jsxs)("li",{style:{marginBottom:8},children:[(0,l.jsxs)("div",{children:[e.id&&(0,l.jsx)("code",{style:{marginRight:6},children:e.id}),e.what,"task"===e.about&&(0,l.jsx)("span",{className:"chip",style:{marginLeft:6},children:c("review.aboutTask")}),e.repeated&&(0,l.jsx)("span",{className:"chip",style:{marginLeft:6},children:c("review.repeated")})]}),e.where&&(0,l.jsx)("div",{className:"muted",children:e.where}),(0,l.jsxs)("div",{className:"muted",children:[c("review.evidence"),": ",e.evidence]})]},s))})]})]})}},4784:(e,s,n)=>{"use strict";n.d(s,{Y:()=>i});var l=n(3365),a=n(1521),t=n(5549),r=n(867);function i(e){var s,n;let{id:i,chosen:c,onChange:d,none:o,catalogue:m,disabled:h=!1,style:u}=e,{t:p}=(0,r.kj)(),x=function(e){let[s,n]=(0,a.useState)(null);return(0,a.useEffect)(()=>{if(void 0!==e)return;let s=!0;return t.FH.models().then(e=>{s&&n(e)}).catch(()=>void 0),()=>{s=!1}},[e]),void 0!==e?e:s}(m),v=null!=(s=null==x?void 0:x.options)?s:[],j=v.some(e=>e.name===c),g=v.filter(e=>!e.group),f=new Map;for(let e of v)e.group&&f.set(e.group,[...null!=(n=f.get(e.group))?n:[],e]);return(0,l.jsxs)("select",{id:i,value:c,onChange:e=>d(e.target.value),disabled:h,style:{width:"auto",minWidth:280,...u},children:[(0,l.jsx)("option",{value:"",children:o}),c&&!j&&(0,l.jsx)("option",{value:c,children:p("model.notInList",{name:c})}),g.map(e=>(0,l.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(p("model.unavailable")):""]},e.name)),[...f.entries()].map(e=>{let[s,n]=e;return(0,l.jsx)("optgroup",{label:s,children:n.map(e=>(0,l.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(p("model.unavailable")):""]},e.name))},s)})]})}},8848:(e,s,n)=>{"use strict";n.d(s,{H4:()=>d,L:()=>o,z4:()=>m});var l=n(3365),a=n(8197),t=n.n(a),r=n(1521),i=n(5549),c=n(867);function d(e){let{current:s,onUse:n}=e,{t:a}=(0,c.kj)(),[t,d]=(0,r.useState)(null);if((0,r.useEffect)(()=>{let e=!1;return i.FH.project().then(s=>{e||d(s)}).catch(()=>void 0),()=>{e=!0}},[]),!t)return null;let o=t.rootDir.trim(),m=s.trim().toLowerCase(),h=n?t.others.filter(e=>e.rootDir.trim().toLowerCase()!==m):[];return(0,l.jsx)(u,{label:o?a("proj.defaultIs",{dir:o}):a("proj.noneShort"),offer:o&&n&&m!==o.toLowerCase()?{text:a("proj.useIt"),onUse:()=>n(o)}:void 0,more:h.map(e=>({text:a("proj.otherUse",{name:e.name}),title:e.rootDir,onUse:()=>null==n?void 0:n(e.rootDir)})),link:o?a("proj.change"):a("proj.setIt"),anchor:"project"})}function o(e){let{current:s,onUse:n}=e,a=h(),{t}=(0,c.kj)();if(!a)return null;let r=a.defaultModel.trim();return(0,l.jsx)(u,{label:r?t("def.modelDefaultIs",{name:r}):t("def.modelNoneShort"),offer:r&&n&&s.trim()!==r?{text:t("def.modelUseIt"),onUse:()=>n(r)}:void 0,link:t(r?"proj.change":"proj.setIt"),anchor:"model"})}function m(e){let{current:s,onUse:n}=e,a=h(),{t}=(0,c.kj)();if(!a)return null;let r=a.defaultReviewModel.trim();return(0,l.jsx)(u,{label:r?t("def.reviewDefaultIs",{name:r}):t("def.reviewNoneShort"),offer:r&&n&&s.trim()!==r?{text:t("def.modelUseIt"),onUse:()=>n(r)}:void 0,link:t(r?"proj.change":"proj.setIt"),anchor:"review"})}function h(){let[e,s]=(0,r.useState)(null);return(0,r.useEffect)(()=>{let e=!1;return i.FH.models().then(n=>{e||s(n)}).catch(()=>void 0),()=>{e=!0}},[]),e}function u(e){let{label:s,offer:n,more:a=[],link:r,anchor:i}=e;return(0,l.jsxs)("p",{className:"muted small",style:{marginTop:4},children:[s," ",n&&(0,l.jsxs)(l.Fragment,{children:["\xb7"," ",(0,l.jsx)("button",{type:"button",className:"linkish",onClick:n.onUse,children:n.text})," "]}),a.map(e=>(0,l.jsxs)("span",{children:["\xb7"," ",(0,l.jsx)("button",{type:"button",className:"linkish",onClick:e.onUse,title:e.title,children:e.text})," "]},e.text)),"\xb7 ",(0,l.jsx)(t(),{href:"/defaults#".concat(i),children:r})]})}}},e=>{e.O(0,[197,867,549,723,347,131,358],()=>e(e.s=1772)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- :root{--bg:#fdf7f0;--bg-tint:#f7ead9;--panel:#fffdfb;--ink:#241a13;--muted:#7a6656;--line:#ecdcc9;--line-strong:#d8c3a9;--accent:#b4500b;--accent-ink:#fffaf5;--accent-soft:#fbe9d8;--ok:#2a6b45;--ok-soft:#e4f1e7;--warn:#8f5500;--warn-soft:#fbedd6;--bad:#a8271c;--bad-soft:#fbe6e2;--code:#f9efe3;--shadow:0 1px 2px rgba(74,45,20,0.06),0 6px 18px rgba(74,45,20,0.05);--radius:12px;--scale:1;--mono:ui-monospace,Consolas,"Cascadia Mono",monospace;--focus-width:2px}:root[data-theme=dark]{--bg:#17120f;--bg-tint:#221a15;--panel:#221b16;--ink:#f2e8df;--muted:#b6a493;--line:#3a2e26;--line-strong:#52412f;--accent:#ff9f45;--accent-ink:#2b1705;--accent-soft:#35251a;--ok:#7ed39f;--ok-soft:#1e2b22;--warn:#f0b96e;--warn-soft:#2f2417;--bad:#ff9081;--bad-soft:#33201d;--code:#1d1713;--shadow:0 1px 2px rgba(0,0,0,0.3),0 8px 24px rgba(0,0,0,0.25)}:root[data-contrast=high]{--ink:#000000;--muted:#4a3a2c;--line:#a88d6c;--line-strong:#6b5236;--accent:#8f3c00;--panel:#ffffff;--bg:#fff9f2;--ok:#17512f;--warn:#6b3f00;--bad:#8a1a11;--shadow:none}:root[data-theme=dark][data-contrast=high]{--ink:#ffffff;--muted:#e0cfbd;--line:#7d6650;--line-strong:#a88a6a;--accent:#ffc27a;--panel:#100c09;--bg:#000000;--code:#0a0705;--ok:#9ff0bd;--warn:#ffd08f;--bad:#ffb0a2;--shadow:none}:root[data-textsize=large]{--scale:1.12}:root[data-textsize=huge]{--scale:1.28}:root[data-focus=strong]{--focus-width:4px}*{box-sizing:border-box}body,html{margin:0;background:var(--bg);color:var(--ink);font:calc(15px * var(--scale)) /1.55 system-ui,-apple-system,Segoe UI,sans-serif}a{color:var(--accent);text-decoration:none}:root[data-links=underline] a,a:hover{text-decoration:underline}:focus-visible{outline:var(--focus-width) solid var(--accent);outline-offset:2px;border-radius:4px}:root[data-motion=reduced] *,:root[data-motion=reduced] :after,:root[data-motion=reduced] :before{transition:none!important;animation:none!important;scroll-behavior:auto!important}@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}.skip-link{position:absolute;left:-9999px;top:0;background:var(--accent);color:var(--accent-ink);padding:10px 16px;border-radius:0 0 var(--radius) 0;z-index:10}.skip-link:focus{left:0}.wrap{max-width:1100px;margin:0 auto;padding:24px 16px 80px}.top{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:20px;padding-bottom:14px;border-bottom:1px solid var(--line)}.top h1{font-size:calc(21px * var(--scale));margin:0;letter-spacing:-.01em}.top h1 a{color:var(--accent)}.top nav{display:flex;align-items:center;gap:4px;flex-wrap:wrap}.top nav a{color:var(--muted);padding:6px 10px;border-radius:999px;font-size:calc(14px * var(--scale))}.top nav a:hover{text-decoration:none}.top nav a:hover,.top nav a[aria-current=page]{background:var(--accent-soft);color:var(--accent)}.top nav a[aria-current=page]{font-weight:600}.top nav a .live{display:inline-flex;align-items:center;gap:4px;margin-left:6px;padding:0 6px 0 4px;border-radius:999px;background:var(--ok-soft,var(--accent-soft));color:var(--ok,var(--accent));font-size:calc(10.5px * var(--scale));font-weight:700;letter-spacing:.04em;text-transform:uppercase;vertical-align:middle}.top nav a .live .dot{width:6px;height:6px;border-radius:50%;background:currentColor;animation:live-pulse 1.6s ease-in-out infinite}@keyframes live-pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.35;transform:scale(.75)}}.crumbs{color:var(--muted);font-size:calc(13px * var(--scale));margin-bottom:8px}.panel{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);padding:18px;margin-bottom:16px;box-shadow:var(--shadow)}.panel h2{font-size:calc(16px * var(--scale));margin:0 0 10px}.panel h3{font-size:calc(13px * var(--scale));margin:16px 0 6px;color:var(--muted);font-weight:700;text-transform:uppercase;letter-spacing:.05em}.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.grow{flex:1 1 auto}.muted{color:var(--muted)}.small{font-size:calc(13px * var(--scale))}input[type=text],select,textarea{width:100%;background:var(--code);color:var(--ink);border:1px solid var(--line-strong);border-radius:9px;padding:9px 11px;font:inherit}input[type=text]:focus,select:focus,textarea:focus{border-color:var(--accent)}textarea{min-height:110px;resize:vertical;font-family:var(--mono);font-size:calc(13px * var(--scale));line-height:1.5}textarea.prose{font-family:inherit;font-size:calc(14px * var(--scale))}label{display:block;font-size:calc(13px * var(--scale));color:var(--muted);margin:12px 0 4px}input[type=checkbox],input[type=radio]{accent-color:var(--accent);width:16px;height:16px}.option{border:1px solid var(--line);border-radius:10px;padding:10px 12px;margin:8px 0;background:var(--bg)}.option>label{display:flex;align-items:flex-start;gap:10px;margin:0;color:var(--ink);font-size:calc(14px * var(--scale));cursor:pointer}.option>label input{margin-top:3px;flex:none}.option .why{margin:6px 0 0 26px;color:var(--muted);font-size:calc(12.5px * var(--scale))}.option.warned{border-color:var(--warn);background:var(--warn-soft)}button{background:var(--panel);color:var(--ink);border:1px solid var(--line-strong);border-radius:9px;padding:8px 13px;font:inherit;cursor:pointer;transition:background .12s ease,border-color .12s ease}button:hover:not(:disabled){border-color:var(--accent);background:var(--accent-soft)}button.primary{background:var(--accent);color:var(--accent-ink);border-color:var(--accent);font-weight:600}button.primary:hover:not(:disabled){background:var(--accent);filter:brightness(1.08)}button.danger{color:var(--bad);border-color:var(--bad)}button.danger:hover:not(:disabled){background:var(--bad-soft);border-color:var(--bad)}button.quiet{border-color:transparent;background:transparent;color:var(--muted)}button.quiet:hover:not(:disabled){color:var(--accent)}button:disabled{opacity:.45;cursor:not-allowed}.badge{display:inline-block;font-size:calc(12px * var(--scale));padding:2px 9px;border-radius:999px;border:1px solid var(--line-strong);color:var(--muted);white-space:nowrap}.badge.running{color:var(--accent);border-color:var(--accent);background:var(--accent-soft)}.badge.waiting-approval{color:var(--warn);border-color:var(--warn);background:var(--warn-soft)}.badge.done{color:var(--ok);border-color:var(--ok);background:var(--ok-soft)}.badge.blocked{color:var(--warn);border-color:var(--warn);background:var(--warn-soft)}.badge.aborted,.badge.failed,.badge.limit-reached{color:var(--bad);border-color:var(--bad);background:var(--bad-soft)}pre{background:var(--code);border:1px solid var(--line);border-radius:9px;padding:10px 12px;overflow:auto;font-family:var(--mono);font-size:calc(12.5px * var(--scale));line-height:1.5;margin:6px 0;white-space:pre-wrap;word-break:break-word}pre.tall{max-height:420px}details>summary{cursor:pointer;color:var(--muted);font-size:calc(13px * var(--scale));-webkit-user-select:none;-moz-user-select:none;user-select:none}details>summary:hover{color:var(--accent)}details[open]>summary{margin-bottom:6px}.task{border-left:4px solid var(--line-strong);padding-left:14px;margin-bottom:18px}.task.done{border-left-color:var(--ok)}.task.running,.task.waiting-approval{border-left-color:var(--accent)}.task.blocked{border-left-color:var(--warn)}.task.aborted,.task.failed,.task.limit-reached{border-left-color:var(--bad)}.task h4{margin:0 0 4px;font-size:calc(15px * var(--scale))}.task:target{background:var(--accent-soft);border-radius:0 10px 10px 0;padding:8px 8px 8px 14px}.summary{background:var(--ok-soft);border:1px solid var(--ok);border-radius:9px;padding:10px 12px;margin:8px 0;white-space:pre-wrap}.reason{color:var(--bad)}.approval{background:var(--warn-soft);border:2px solid var(--warn);border-radius:var(--radius);padding:12px 14px;margin-bottom:14px;position:-webkit-sticky;position:sticky;top:8px;z-index:2}.approval code{font-size:calc(13px * var(--scale))}.approval code,.log{font-family:var(--mono)}.log{font-size:calc(12.5px * var(--scale));max-height:320px;overflow:auto;background:var(--code);border:1px solid var(--line);border-radius:9px;padding:8px 10px}.log div{white-space:pre-wrap;word-break:break-word}.log .warn{color:var(--warn)}.log .error{color:var(--bad)}.log .time{color:var(--muted);margin-right:8px}table{width:100%;border-collapse:collapse}td,th{text-align:left;padding:9px 6px;border-bottom:1px solid var(--line);font-size:calc(14px * var(--scale));vertical-align:top}th{color:var(--muted);font-weight:700;font-size:calc(12px * var(--scale));text-transform:uppercase;letter-spacing:.04em}.err{color:var(--bad);font-size:calc(13px * var(--scale))}.notice{border:1px solid var(--bad);background:var(--bad-soft);color:var(--ink);border-radius:10px;padding:10px 12px;margin:10px 0;font-size:calc(13.5px * var(--scale))}.notice strong{color:var(--bad)}.notice ul{margin:6px 0 0;padding-left:20px}.notice.caution{border-color:var(--warn);background:var(--warn-soft)}.notice.caution strong{color:var(--warn)}.notice.calm{border-color:var(--line-strong);background:var(--bg-tint)}.notice.calm strong{color:var(--ink)}.counts{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:4px}.count{border:1px solid var(--line);border-radius:10px;padding:10px 14px;min-width:96px;background:var(--bg)}.count .n{font-size:calc(22px * var(--scale));font-weight:700;line-height:1.2}.count .k{color:var(--muted);font-size:calc(12px * var(--scale));text-transform:uppercase;letter-spacing:.04em}.count.done .n{color:var(--ok)}.count.failed .n{color:var(--bad)}.count.running .n{color:var(--accent)}.attempts{list-style:none;margin:6px 0 0;padding:0 0 0 12px;border-left:2px solid var(--line)}.attempts>li{margin:0 0 10px}.attempts .head{display:flex;gap:8px;align-items:baseline;flex-wrap:wrap}.attempts .when{color:var(--muted);font-size:calc(12.5px * var(--scale))}.attempts .what{margin:4px 0 0}.count.queued .n{color:var(--accent)}.flow{list-style:none;margin:8px 0 0;padding:0}.flow>li{position:relative;padding:10px 0 14px 28px;border-left:2px solid var(--line);margin-left:7px}.flow>li:last-child{border-left-color:transparent}.flow>li:before{content:"";position:absolute;left:-9px;top:16px;width:16px;height:16px;border-radius:50%;background:var(--panel);border:3px solid var(--line-strong)}.flow>li.done:before{border-color:var(--ok);background:var(--ok)}.flow>li.running:before,.flow>li.waiting-approval:before{border-color:var(--accent);background:var(--accent)}.flow>li.aborted:before,.flow>li.failed:before,.flow>li.limit-reached:before{border-color:var(--bad);background:var(--bad)}.flow>li.queued:before{border-color:var(--line-strong);background:var(--panel)}.flow>li.next:before{border-color:var(--accent);background:var(--panel);box-shadow:0 0 0 4px var(--accent-soft)}.flow .when{color:var(--muted);font-size:calc(12.5px * var(--scale))}.flow .what{margin:4px 0 0}.flow .head{display:flex;gap:10px;align-items:baseline;flex-wrap:wrap}.flow .head strong{font-size:calc(14.5px * var(--scale))}.chip{display:inline-block;border:1px solid var(--line);border-radius:999px;padding:1px 9px;font-size:calc(12px * var(--scale));color:var(--muted);background:var(--bg-tint)}.toolbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:10px}.toolbar input[type=text],.toolbar select{width:auto;min-width:150px}.segmented{display:inline-flex;border:1px solid var(--line-strong);border-radius:9px;overflow:hidden}.segmented button{border:none;border-radius:0;border-right:1px solid var(--line)}.segmented button:last-child{border-right:none}.segmented button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);font-weight:600}.button-link{display:inline-block;background:var(--accent);color:var(--accent-ink);border:1px solid var(--accent);border-radius:9px;padding:8px 13px;font:inherit;font-weight:600;cursor:pointer;text-decoration:none}.button-link:hover{filter:brightness(1.08);text-decoration:none}.button-link+.button-link{background:var(--panel);color:var(--ink);border-color:var(--line-strong);font-weight:400}.button-link+.button-link:hover{background:var(--accent-soft);border-color:var(--accent);filter:none}.empty{color:var(--muted);padding:14px 0}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.dropzone{border:2px dashed var(--line-strong);border-radius:12px;padding:10px;background:var(--bg-tint)}.dropzone.active{border-color:var(--accent);background:var(--accent-soft)}.dropzone textarea{margin:0}.dropzone p{margin:8px 2px 2px}.batch-row td{vertical-align:middle}.batch-row.running{background:var(--accent-soft)}.run-order{list-style:decimal;margin:10px 0 4px;padding-left:28px}.run-order li{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:3px 0}.run-order button{padding:2px 8px;margin-left:4px}.linkish{background:none;border:0;padding:0;margin:0;color:var(--accent);font:inherit;cursor:pointer;text-decoration:underline}.linkish:hover{filter:brightness(1.15)}.run-choice{display:flex;gap:20px;flex-wrap:wrap;margin:12px 0 4px}.run-choice>div{flex:1 1 280px}.run-choice .why{margin:6px 2px 0}.rich>:first-child{margin-top:0}.rich>:last-child{margin-bottom:0}.rich p{margin:0 0 8px;max-width:76ch}.rich ul{margin:0 0 8px;padding-left:20px}.rich li{margin:2px 0;max-width:74ch}.rich code{font-family:var(--mono);font-size:.92em;background:var(--bg-tint);border:1px solid var(--line);border-radius:5px;padding:0 4px;word-break:break-word}.rich pre{margin:6px 0 8px}.summary .rich{white-space:normal}select{-moz-appearance:none;appearance:none;-webkit-appearance:none;padding-right:34px;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");background-repeat:no-repeat;background-position:right 12px center;cursor:pointer}select:disabled{cursor:not-allowed;opacity:.6}select optgroup,select option{background:var(--panel);color:var(--ink)}.top nav a{display:inline-flex;align-items:center;gap:6px}.top nav a .nav-icon{flex:none;opacity:.85}.modal-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.55);display:flex;align-items:center;justify-content:center;padding:16px;z-index:50}.modal{background:var(--panel);color:var(--ink);border:1px solid var(--line-strong);border-radius:var(--radius);box-shadow:0 20px 60px rgba(0,0,0,.35);width:min(560px,100%);max-height:calc(100vh - 32px);overflow:auto;padding:18px 20px}.modal h2{margin:0 0 10px;font-size:calc(16px * var(--scale))}.modal.danger h2{color:var(--bad)}.modal-body{white-space:pre-wrap;line-height:1.5;font-size:calc(14px * var(--scale))}.modal-actions{justify-content:flex-end;margin-top:16px}@media (max-width:600px){.wrap{padding:12px 10px 60px}.top{gap:8px;margin-bottom:12px;padding-bottom:10px}.top h1{font-size:calc(18px * var(--scale))}.top nav{width:100%;flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;padding-bottom:4px;scrollbar-width:none}.top nav::-webkit-scrollbar{display:none}.top nav a{flex:none;padding:6px 9px;font-size:calc(13px * var(--scale))}.panel{padding:12px}.row{gap:8px}.row>input[type=text],.row>select,.row>textarea,.toolbar input[type=text],.toolbar select,.toolbar>div{width:100%;min-width:0;flex:1 1 100%}.row>button{flex:1 1 auto}select{min-width:0!important;width:100%}table{display:block;overflow-x:auto;white-space:nowrap}.counts{gap:6px}.count{flex-grow:1;flex-shrink:1;flex-basis:calc(50% - 6px)}.segmented{display:flex;width:100%}.segmented button{flex:1 1 auto}.flow>li{padding-left:18px}.modal{padding:14px}.log,pre{font-size:12px}}.run-fold{border-top:1px solid var(--line);padding:8px 0 4px}.run-fold:first-of-type{border-top:none}.run-fold>summary{cursor:pointer;list-style:none}.run-fold>summary::-webkit-details-marker{display:none}.run-fold>summary:before{content:"▸";display:inline-block;width:16px;color:var(--muted);transition:transform .15s}.run-fold[open]>summary:before{transform:rotate(90deg)}.run-fold>summary .run-heading{display:inline-block;width:calc(100% - 16px);vertical-align:top}.run-heading h2{font-size:calc(15px * var(--scale))}.exports{white-space:nowrap}.modal.wide{width:min(820px,100%)}.dir-tree-box{margin-top:8px}.dir-tree{list-style:none;margin:6px 0 0;padding-left:0}.dir-tree .dir-tree{padding-left:18px;border-left:1px dashed var(--line);margin-left:8px}.dir-row{display:flex;align-items:center;gap:4px;padding:1px 0}.dir-flip{width:20px;padding:0;border:none;color:var(--muted);font-size:12px}.dir-flip,.dir-name{background:transparent}.dir-name{border:1px solid transparent;padding:2px 8px 2px 6px;border-radius:6px;font-family:var(--mono);font-size:calc(12.5px * var(--scale));display:inline-flex;align-items:center;gap:6px}.dir-name:hover{border-color:var(--line-strong)}.dir-mark{display:inline-block;width:12px;text-align:center;color:var(--muted)}.dir.in>.dir-row .dir-name{background:var(--ok-soft);color:var(--ok);border-color:var(--ok)}.dir.inherited>.dir-row .dir-name{color:var(--ok)}.dir.out>.dir-row .dir-name{background:var(--bad-soft);color:var(--bad);border-color:var(--bad);text-decoration:line-through}.dir.out-inherited>.dir-row .dir-name{color:var(--muted);text-decoration:line-through}.dir-out{width:22px;height:22px;padding:0;border-radius:6px;font-size:13px;line-height:1;color:var(--muted)}.dir-out.on{color:var(--bad);border-color:var(--bad);background:var(--bad-soft)}.story-box{margin-top:8px;border:1px solid var(--line);border-radius:var(--radius);padding:10px 12px;background:var(--code)}.story{list-style:none;margin:6px 0;padding:0}.story>li{border-left:3px solid var(--line-strong);padding:6px 10px;margin:6px 0}.story>li.sent{border-left-color:var(--accent)}.story>li.reply{border-left-color:var(--ok)}.story>li.story-step{border-left-color:var(--muted)}.story>li.failed{border-left-color:var(--bad);background:var(--bad-soft)}.story>li.story-review{border-left-color:var(--warn)}.story-head{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:calc(13px * var(--scale))}.story-cmd{margin:4px 0;color:var(--ink)}.story-cmd,.story-out{white-space:pre-wrap;word-break:break-word;font-size:calc(12px * var(--scale))}.story-out{margin:4px 0 0;max-height:420px;overflow:auto;background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:8px}.story-out.always{max-height:260px}.story-scroll.live{max-height:65vh;overflow:auto;overscroll-behavior:contain}.story-out.terminal{max-height:45vh;overscroll-behavior:contain}.diff-overlay{position:fixed;inset:0;z-index:100;background:var(--bg);display:flex;flex-direction:column}.diff-head{display:flex;gap:12px;align-items:center;flex-wrap:wrap;padding:10px 16px;border-bottom:1px solid var(--line);background:var(--panel)}.diff-head h2{margin:0;font-size:calc(16px * var(--scale))}.diff-body{flex:1 1;min-height:0;display:grid;grid-template-columns:minmax(220px,300px) 1fr}.diff-files{overflow:auto;border-right:1px solid var(--line);padding:6px;background:var(--panel)}.diff-file{display:flex;gap:6px;align-items:baseline;width:100%;text-align:left;border:0;border-radius:6px;background:none;padding:5px 6px;font-size:calc(12px * var(--scale));cursor:pointer}.diff-file:hover{background:var(--bg-tint)}.diff-file.on{background:var(--accent-soft)}.diff-path{flex:1 1;min-width:0;overflow-wrap:anywhere}.diff-counts{white-space:nowrap;font-family:var(--mono);font-size:11px}.diff-counts .plus{color:var(--ok)}.diff-counts .minus{color:var(--bad)}.diff-status{font-family:var(--mono);font-weight:700;width:1.2em;text-align:center;border-radius:4px}.diff-status.s-A{color:var(--ok)}.diff-status.s-D{color:var(--bad)}.diff-status.s-M{color:var(--warn)}.diff-status.s-C,.diff-status.s-R{color:var(--accent)}.diff-main{display:flex;flex-direction:column;min-width:0;min-height:0}.diff-toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;padding:6px 12px;border-bottom:1px solid var(--line)}.diff-name{font-family:var(--mono);font-size:calc(12px * var(--scale));overflow-wrap:anywhere}.diff-scroll{flex:1 1;overflow:auto;overscroll-behavior:contain}.diff-table{width:100%;border-collapse:collapse;table-layout:fixed;font-family:var(--mono);font-size:calc(12px * var(--scale))}.diff-table col.num{width:52px}.diff-table thead th{position:-webkit-sticky;position:sticky;top:0;z-index:1;background:var(--panel);border-bottom:1px solid var(--line);text-align:left;padding:4px 8px;font-family:inherit}.diff-table td{padding:0 8px;vertical-align:top;line-height:1.5}.diff-table td.num{text-align:right;color:var(--muted);-webkit-user-select:none;-moz-user-select:none;user-select:none;border-right:1px solid var(--line)}.diff-table td.code{white-space:pre-wrap;overflow-wrap:anywhere}.diff-table.nowrap td.code{white-space:pre;overflow-wrap:normal}.diff-table.nowrap{width:max-content;min-width:100%}.diff-row.change td.l,.diff-row.del td.l{background:var(--bad-soft)}.diff-row.add td.r,.diff-row.change td.r{background:var(--ok-soft)}.diff-row mark{background:color-mix(in srgb,currentColor 22%,transparent);color:inherit;border-radius:2px}.diff-row td.empty{background:repeating-linear-gradient(135deg,transparent 0 6px,var(--bg-tint) 6px 12px)}.diff-row.current td.num{box-shadow:inset 3px 0 0 var(--accent)}.diff-gap td{background:var(--bg-tint);text-align:center;padding:2px}@media (max-width:760px){.diff-body{grid-template-columns:1fr;grid-template-rows:auto 1fr}.diff-files{max-height:30vh;border-right:0;border-bottom:1px solid var(--line)}}.scroll-jump{position:fixed;right:16px;bottom:24px;display:flex;flex-direction:column;gap:8px;z-index:40}.scroll-jump button{width:42px;height:42px;border-radius:50%;padding:0;font-size:20px;line-height:1;box-shadow:0 2px 8px rgba(0,0,0,.18)}.story-notes{margin:4px 0;font-size:calc(13px * var(--scale))}.story-fixed{padding:8px 10px;border-radius:8px;background:var(--panel);border:1px solid var(--line);margin:6px 0}.story-fixed.close{border-color:var(--ok)}.story-fixed.close.failed{border-color:var(--bad);background:var(--bad-soft)}.option-inline{gap:6px}.option-inline,.story-box .live{display:inline-flex;align-items:center}.story-box .live{gap:4px;color:var(--ok);font-size:11px;font-weight:700;text-transform:uppercase}.story-box .live .dot,button .dot{width:6px;height:6px;border-radius:50%;background:currentColor;animation:live-pulse 1.6s ease-in-out infinite}button .dot{display:inline-block;margin-right:6px;vertical-align:middle}.info-dot{width:18px;height:18px;min-width:18px;padding:0;border-radius:50%;font-size:calc(11px * var(--scale));font-style:italic;font-weight:700;line-height:1}.info-panel{flex-basis:100%;margin-top:6px}.info-panel dl{margin:6px 0 0}.info-panel dt{font-weight:600;margin-top:6px}.info-panel dd{margin:0 0 0 14px;opacity:.85}.flow .head .pick{margin:0 2px 0 0;flex:0 0 auto}.chip.inside{font-size:calc(10.5px * var(--scale));opacity:.85}.chip.inside.out{color:var(--bad);border-color:var(--bad)}.approval-banner{position:-webkit-sticky;position:sticky;top:0;z-index:30;background:var(--warn-soft);border:3px solid var(--warn);border-radius:var(--radius);padding:12px 14px 2px;margin:0 0 16px;box-shadow:0 6px 18px rgba(0,0,0,.18);max-height:70vh;overflow:auto}.approval-banner h2{margin:0 0 4px;color:var(--warn)}.approval-banner .approval{position:static;background:var(--bg);margin-bottom:10px}.approval-banner .approval button{font-size:calc(15px * var(--scale));padding:8px 14px}