copilot-operator 0.1.42 → 0.1.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/api/operator.controller.js +131 -0
- package/dist/src/api/operator.service.js +335 -3
- package/dist/src/api/server.js +16 -0
- package/dist/src/cli.js +12 -0
- package/dist/src/config/schema.js +10 -0
- package/dist/src/orchestrator/taskRunner.js +109 -38
- package/dist/src/plan/brief.js +57 -20
- package/dist/src/plan/changes.js +217 -0
- package/dist/src/plan/schema.js +1 -1
- package/dist/src/plan/systemGuide.js +597 -12
- package/dist/src/session/compose.js +15 -1
- package/dist/src/session/model.js +1 -1
- package/dist/src/session/store.js +60 -0
- package/dist/src/vcs/taskVcs.js +110 -1
- package/dist/web/404.html +2 -2
- package/dist/web/_next/static/WmzBz4QN36pcz4PL_cfEW/_buildManifest.js +1 -0
- package/dist/web/_next/static/chunks/499-751e0be9d4f86e2d.js +1 -0
- package/dist/web/_next/static/chunks/549-2415dd26f4e53d07.js +1 -0
- package/dist/web/_next/static/chunks/699-9d031f8c145a0465.js +1 -0
- package/dist/web/_next/static/chunks/867-aea30f560bc18eaf.js +1 -0
- package/dist/web/_next/static/chunks/897-5a34109533c3da50.js +1 -0
- package/dist/web/_next/static/chunks/app/defaults/page-56134fbb8cc7554f.js +1 -0
- package/dist/web/_next/static/chunks/app/history/{page-47973539ceff81d6.js → page-0bb537407fed5944.js} +1 -1
- package/dist/web/_next/static/chunks/app/import/{page-999d6cd958989723.js → page-8ef75fc08638e75f.js} +1 -1
- package/dist/web/_next/static/chunks/app/layout-dc602b727480a653.js +1 -0
- package/dist/web/_next/static/chunks/app/page-d73a8ff300862cd8.js +1 -0
- package/dist/web/_next/static/chunks/app/{page-e557d58476ae6383.js → sessions/page-28376d2e4a9b4738.js} +1 -1
- package/dist/web/_next/static/chunks/app/sessions/view/page-afc235a9171535d8.js +1 -0
- package/dist/web/_next/static/css/{0e55721108c300f2.css → 72c85e4322c21223.css} +1 -1
- package/dist/web/appearance.html +2 -2
- package/dist/web/appearance.txt +25 -28
- package/dist/web/defaults.html +2 -2
- package/dist/web/defaults.txt +25 -28
- package/dist/web/history.html +2 -2
- package/dist/web/history.txt +25 -28
- package/dist/web/import.html +2 -2
- package/dist/web/import.txt +25 -28
- package/dist/web/index.html +2 -2
- package/dist/web/index.txt +25 -28
- package/dist/web/level1.html +2 -2
- package/dist/web/level1.txt +25 -28
- package/dist/web/presets.html +3 -3
- package/dist/web/presets.txt +25 -28
- package/dist/web/sessions/view.html +2 -2
- package/dist/web/sessions/view.txt +25 -28
- package/dist/web/sessions.html +16 -0
- package/dist/web/sessions.txt +26 -0
- package/dist/web/system.html +2 -2
- package/dist/web/system.txt +25 -28
- package/package.json +4 -2
- package/dist/web/_next/static/chunks/204-db82ca47ff211e21.js +0 -1
- package/dist/web/_next/static/chunks/499-39b2c00bda3656f0.js +0 -1
- package/dist/web/_next/static/chunks/549-348b0a1404407e5a.js +0 -1
- package/dist/web/_next/static/chunks/867-7d86a692260006f1.js +0 -1
- package/dist/web/_next/static/chunks/app/defaults/page-a25c40436fc312db.js +0 -1
- package/dist/web/_next/static/chunks/app/layout-6ee612d25e78b246.js +0 -1
- package/dist/web/_next/static/chunks/app/sessions/view/page-872d8b9fe8eedbbf.js +0 -1
- package/dist/web/_next/static/lDmqS7pWU_B_Ac5idPvdS/_buildManifest.js +0 -1
- /package/dist/web/_next/static/{lDmqS7pWU_B_Ac5idPvdS → WmzBz4QN36pcz4PL_cfEW}/_ssgManifest.js +0 -0
package/dist/web/system.txt
CHANGED
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
1:"$Sreact.fragment"
|
|
2
|
-
2:I[8078,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-
|
|
3
|
-
3:I[867,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-
|
|
4
|
-
4:I[1035,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-
|
|
5
|
-
5:I[8214,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-
|
|
6
|
-
6:I[
|
|
7
|
-
7:I[
|
|
8
|
-
8:I[
|
|
9
|
-
9:I[
|
|
10
|
-
a:I[
|
|
11
|
-
b:I[
|
|
12
|
-
c:I[
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
:
|
|
23
|
-
|
|
24
|
-
10:
|
|
25
|
-
|
|
26
|
-
17:
|
|
27
|
-
13:null
|
|
28
|
-
15:{"metadata":[["$","title","0",{"children":"copilot-operator"}],["$","meta","1",{"name":"description","content":"Runs task loops with Microsoft 365 Copilot on this machine."}]],"error":null,"digest":"$undefined"}
|
|
29
|
-
1a:"$15:metadata"
|
|
2
|
+
2:I[8078,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-aea30f560bc18eaf.js","549","static/chunks/549-2415dd26f4e53d07.js","499","static/chunks/499-751e0be9d4f86e2d.js","177","static/chunks/app/layout-dc602b727480a653.js"],"AppearanceProvider"]
|
|
3
|
+
3:I[867,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-aea30f560bc18eaf.js","549","static/chunks/549-2415dd26f4e53d07.js","499","static/chunks/499-751e0be9d4f86e2d.js","177","static/chunks/app/layout-dc602b727480a653.js"],"LanguageProvider"]
|
|
4
|
+
4:I[1035,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-aea30f560bc18eaf.js","549","static/chunks/549-2415dd26f4e53d07.js","499","static/chunks/499-751e0be9d4f86e2d.js","177","static/chunks/app/layout-dc602b727480a653.js"],"DialogHost"]
|
|
5
|
+
5:I[8214,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-aea30f560bc18eaf.js","549","static/chunks/549-2415dd26f4e53d07.js","499","static/chunks/499-751e0be9d4f86e2d.js","177","static/chunks/app/layout-dc602b727480a653.js"],"SkipLink"]
|
|
6
|
+
6:I[966,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-aea30f560bc18eaf.js","549","static/chunks/549-2415dd26f4e53d07.js","499","static/chunks/499-751e0be9d4f86e2d.js","177","static/chunks/app/layout-dc602b727480a653.js"],"Shell"]
|
|
7
|
+
7:I[5204,[],""]
|
|
8
|
+
8:I[2642,[],""]
|
|
9
|
+
9:I[7712,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-aea30f560bc18eaf.js","549","static/chunks/549-2415dd26f4e53d07.js","499","static/chunks/499-751e0be9d4f86e2d.js","177","static/chunks/app/layout-dc602b727480a653.js"],"ScrollJump"]
|
|
10
|
+
a:I[1701,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-aea30f560bc18eaf.js","549","static/chunks/549-2415dd26f4e53d07.js","499","static/chunks/499-751e0be9d4f86e2d.js","177","static/chunks/app/layout-dc602b727480a653.js"],"StartDialogHost"]
|
|
11
|
+
b:I[7089,[],"ClientPageRoot"]
|
|
12
|
+
c:I[3134,["867","static/chunks/867-aea30f560bc18eaf.js","549","static/chunks/549-2415dd26f4e53d07.js","186","static/chunks/app/system/page-227a259e383ca2a0.js"],"default"]
|
|
13
|
+
f:I[433,[],"OutletBoundary"]
|
|
14
|
+
11:I[9884,[],"AsyncMetadataOutlet"]
|
|
15
|
+
13:I[433,[],"ViewportBoundary"]
|
|
16
|
+
15:I[433,[],"MetadataBoundary"]
|
|
17
|
+
16:"$Sreact.suspense"
|
|
18
|
+
18:I[3536,[],""]
|
|
19
|
+
:HL["/_next/static/css/72c85e4322c21223.css","style"]
|
|
20
|
+
0:{"P":null,"b":"WmzBz4QN36pcz4PL_cfEW","p":"","c":["","system"],"i":false,"f":[[["",{"children":["system",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/72c85e4322c21223.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"data-theme":"light","data-textsize":"normal","data-contrast":"normal","data-motion":"normal","data-links":"plain","data-focus":"normal","children":[["$","head",null,{"children":["$","script",null,{"dangerouslySetInnerHTML":{"__html":"\n(function () {\n try {\n var d = document.documentElement;\n var raw = localStorage.getItem('cop.appearance');\n var a = raw ? JSON.parse(raw) : {};\n if (!a || typeof a !== 'object') a = {};\n d.dataset.theme = a.theme === 'dark' ? 'dark' : 'light';\n d.dataset.textsize = [\"small\",\"normal\",\"large\",\"huge\",\"giant\"].indexOf(a.textSize) >= 0 ? a.textSize : 'normal';\n d.dataset.contrast = a.highContrast ? 'high' : 'normal';\n d.dataset.motion = a.reduceMotion ? 'reduced' : 'normal';\n d.dataset.links = a.underlineLinks ? 'underline' : 'plain';\n d.dataset.focus = a.strongFocus ? 'strong' : 'normal';\n } catch (e) {}\n})();\n"}}]}],["$","body",null,{"children":["$","$L2",null,{"children":["$","$L3",null,{"children":["$","$L4",null,{"children":[["$","$L5",null,{}],["$","$L6",null,{"children":["$","$L7",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L8",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}],["$","$L9",null,{}],["$","$La",null,{}]]}]}]}]}]]}]]}],{"children":["system",["$","$1","c",{"children":[null,["$","$L7",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L8",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":["__PAGE__",["$","$1","c",{"children":[["$","$Lb",null,{"Component":"$c","searchParams":{},"params":{},"promises":["$@d","$@e"]}],null,["$","$Lf",null,{"children":["$L10",["$","$L11",null,{"promise":"$@12"}]]}]]}],{},null,false]},null,false]},null,false],["$","$1","h",{"children":[null,[["$","$L13",null,{"children":"$L14"}],null],["$","$L15",null,{"children":["$","div",null,{"hidden":true,"children":["$","$16",null,{"fallback":null,"children":"$L17"}]}]}]]}],false]],"m":"$undefined","G":["$18",[]],"s":false,"S":true}
|
|
21
|
+
d:{}
|
|
22
|
+
e:"$0:f:0:1:2:children:2:children:1:props:children:0:props:params"
|
|
23
|
+
14:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]
|
|
24
|
+
10:null
|
|
25
|
+
12:{"metadata":[["$","title","0",{"children":"copilot-operator"}],["$","meta","1",{"name":"description","content":"Runs task loops with Microsoft 365 Copilot on this machine."}]],"error":null,"digest":"$undefined"}
|
|
26
|
+
17:"$12:metadata"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "copilot-operator",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.43",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Automates a Microsoft 365 Copilot chat: sends prompts, extracts commands, runs them, reports back.",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"cop": "tsx src/cli.ts",
|
|
19
19
|
"check:parser": "tsx test/parser.check.ts",
|
|
20
20
|
"check:report": "tsx test/report.check.ts",
|
|
21
|
-
"check": "npm run check:suite && npm run check:parser && npm run check:damage && npm run check:session && npm run check:report && npm run check:runner && npm run check:vcs && npm run check:plan && npm run check:checks && npm run check:workdir && npm run check:processes && npm run check:environment && npm run check:clock && npm run check:crash && npm run check:clipboard && npm run check:restart && npm run check:review && npm run check:chat && npm run check:pacing && npm run check:shells && npm run check:save && npm run check:guide && npm run check:bundle && npm run check:runname && npm run check:dangerous && npm run check:programs && npm run check:manifest && npm run check:lock && npm run check:isolation && npm run check:security && npm run check:update && npm run check:persona && npm run check:script && npm run check:batch && npm run check:confinement && npm run check:network && npm run check:hardening && npm run check:package && npm run check:models && npm run check:settings-precedence && npm run check:review-evidence && npm run check:model-help && npm run check:continue && npm run check:startfrom && npm run check:startbranch && npm run check:diff && npm run check:integrity && npm run check:scope && npm run check:progress && npm run check:metrics && npm run check:modelpicker && npm run check:formatrepair && npm run check:intent && npm run check:sync && npm run check:e2e-run && npm run check:e2e-continue && npm run check:e2e-planmode && npm run check:e2e-interrupt && npm run check:e2e-vcs && npm run check:noattach && npm run check:guard && npm run check:gate && npm run check:e2e-batch && npm run check:e2e-review && npm run check:e2e-branches && npm run check:e2e-loop && npm run check:transport && npm run check:e2e-plan && npm run check:exec && npm run check:pins && npm run check:login && npm run check:order && npm run check:snapshot && npm run check:inputs && npm run check:e2e-inputs && npm run check:attempts && npm run check:finding-ids && npm run check:e2e-commit && npm run check:e2e-retry-inputs && npm run check:e2e-run-vcs && npm run check:prepare && npm run check:live-fixes",
|
|
21
|
+
"check": "npm run check:suite && npm run check:parser && npm run check:damage && npm run check:session && npm run check:report && npm run check:runner && npm run check:vcs && npm run check:plan && npm run check:checks && npm run check:workdir && npm run check:processes && npm run check:environment && npm run check:clock && npm run check:crash && npm run check:clipboard && npm run check:restart && npm run check:review && npm run check:chat && npm run check:pacing && npm run check:shells && npm run check:save && npm run check:guide && npm run check:bundle && npm run check:runname && npm run check:dangerous && npm run check:programs && npm run check:manifest && npm run check:lock && npm run check:isolation && npm run check:security && npm run check:update && npm run check:persona && npm run check:script && npm run check:batch && npm run check:confinement && npm run check:network && npm run check:hardening && npm run check:package && npm run check:models && npm run check:settings-precedence && npm run check:review-evidence && npm run check:model-help && npm run check:continue && npm run check:startfrom && npm run check:startbranch && npm run check:diff && npm run check:integrity && npm run check:scope && npm run check:progress && npm run check:metrics && npm run check:modelpicker && npm run check:formatrepair && npm run check:intent && npm run check:sync && npm run check:e2e-run && npm run check:e2e-continue && npm run check:e2e-planmode && npm run check:e2e-undo && npm run check:e2e-kerrigan && npm run check:e2e-interrupt && npm run check:e2e-vcs && npm run check:noattach && npm run check:guard && npm run check:gate && npm run check:e2e-batch && npm run check:e2e-review && npm run check:e2e-branches && npm run check:e2e-loop && npm run check:transport && npm run check:e2e-plan && npm run check:exec && npm run check:pins && npm run check:login && npm run check:order && npm run check:snapshot && npm run check:inputs && npm run check:e2e-inputs && npm run check:attempts && npm run check:finding-ids && npm run check:e2e-commit && npm run check:e2e-retry-inputs && npm run check:e2e-run-vcs && npm run check:prepare && npm run check:live-fixes",
|
|
22
22
|
"probe": "tsx scripts/probe-locators.ts",
|
|
23
23
|
"check:damage": "tsx test/damage.check.ts",
|
|
24
24
|
"api": "npm run build && node dist/src/api/main.js",
|
|
@@ -83,6 +83,8 @@
|
|
|
83
83
|
"check:e2e-run": "tsx test/e2e-run.check.ts",
|
|
84
84
|
"check:e2e-continue": "tsx test/e2e-continue.check.ts",
|
|
85
85
|
"check:e2e-planmode": "tsx test/e2e-planmode.check.ts",
|
|
86
|
+
"check:e2e-undo": "tsx test/e2e-undo.check.ts",
|
|
87
|
+
"check:e2e-kerrigan": "tsx test/e2e-kerrigan.check.ts",
|
|
86
88
|
"check:e2e-interrupt": "tsx test/e2e-interrupt.check.ts",
|
|
87
89
|
"check:ui": "node scripts/build-package.mjs && tsx test/ui.check.ts && tsx test/ui-flows.check.ts",
|
|
88
90
|
"check:all": "npm run check && npm run check:ui && npm run check:release",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[204],{287:(e,t,s)=>{s.d(t,{y:()=>h,f:()=>u});var n=s(3365),l=s(1521),a=s(5549),i=s(867),r=s(7527),c=s(1035),o=s(1701),d=s(4811);function u(e){var t,s,u;let{target:m,intro:f,initial:p="one",focusFirst:x=!1,checkContract:g=!0,onClose:j}=e,{t:y}=(0,i.kj)(),k=(0,d.p)(),[v,b]=(0,l.useState)(null),[N,w]=(0,l.useState)(p),[S,C]=(0,l.useState)(!1),[I,F]=(0,l.useState)(""),[q,R]=(0,l.useState)(!1),E=(0,l.useRef)(null),L=(0,l.useRef)(null),H=(0,l.useRef)(null),T=(0,l.useId)(),M=()=>a.FH.session(m.sessionId).then(b).catch(e=>F(e.message));(0,l.useEffect)(()=>{M(),g&&a.FH.contractCheck(m.sessionId,m.taskId).then(e=>R(e.conflicts.length>0)).catch(()=>void 0)},[m.sessionId,m.taskId]),(0,r.z)(M,3e3,!!(null==v?void 0:v.running));let O=null!==v;if((0,l.useEffect)(()=>{var e,t,s;if(!O||(null==(t=E.current)||null==(e=t.scrollIntoView)||e.call(t,{block:"nearest"}),!x))return;let n=L.current;n&&!n.disabled?n.focus():null==(s=H.current)||s.focus()},[O,x]),!v)return(0,n.jsx)("div",{className:"notice calm",style:{marginTop:8},children:(0,n.jsx)("span",{className:"small",children:I||y("runq.loading")})});let D=function(e,t){let s=e.tasks.findIndex(e=>e.id===t),n=s>=0?e.tasks[s]:void 0,l=s>=0?e.tasks.slice(0,s):[],a=s>=0?e.tasks.slice(s+1):[],i="continue"!==e.onFailure,r=-1;return a.forEach((e,t)=>{"queued"===e.status&&(r=t)}),{task:n,followingQueued:a.filter(e=>"queued"===e.status),laterRan:a.filter(e=>"queued"!==e.status),earlierRan:l.filter(e=>"queued"!==e.status),chain:i,chainGap:i?l.find(e=>"done"!==e.status):void 0,chainGapLater:i&&r>0?a.slice(0,r).find(e=>"queued"!==e.status&&"done"!==e.status):void 0}}(v,m.taskId),B=(null==(t=D.task)?void 0:t.status)==="queued",W="following"===N?[D.task,...D.followingQueued]:D.task?[D.task]:[],G=v.running?y("runq.sessionRunning"):!1===v.active?y("runq.sessionInactive"):"",A=async e=>{if("unattended"!==e||k||await (0,c.Z)(y("batch.unattendedConfirm",{n:1}))){C(!0),F(""),R(!1);try{var t,s;let n=await a.FH.suggestedRunName([m.sessionId]).then(e=>e.name).catch(()=>void 0),l=await (0,o.L)({sessionIds:[m.sessionId],mode:e,start:t=>a.FH.startBatch([m.sessionId],e,"stop",void 0,void 0,n,W.map(e=>e.id),t)});if(!l.started&&!l.reply)return;let i=null!=(t=l.reply)?t:{started:!0};if(!l.started){F(y("batch.notStarted",{reason:null!=(s=i.reason)?s:""}));let e=await a.FH.contractCheck(m.sessionId,m.taskId).catch(()=>({conflicts:[]}));R(e.conflicts.length>0);return}F(y("runq.started",{n:W.length})),j(!0)}catch(e){F(e.message)}finally{C(!1)}}},P=y("runq.title",{title:m.title});return(0,n.jsxs)("div",{ref:E,className:"notice calm",role:"group","aria-label":P,style:{marginTop:8},children:[f&&(0,n.jsx)("p",{className:"small",style:{marginTop:0},children:f}),(0,n.jsx)("strong",{children:P}),B?(0,n.jsxs)(n.Fragment,{children:[D.followingQueued.length>0&&(0,n.jsxs)("div",{className:"small",role:"radiogroup","aria-label":P,style:{marginTop:6},children:[(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"radio",name:"runq-".concat(T),checked:"one"===N,onChange:()=>w("one"),disabled:S}),y("runq.onlyThis")]}),(0,n.jsxs)("label",{className:"option-inline",title:y("runq.followingWhy"),children:[(0,n.jsx)("input",{type:"radio",name:"runq-".concat(T),checked:"following"===N,onChange:()=>w("following"),disabled:S}),y("runq.following",{n:D.followingQueued.length,session:v.name})]})]}),(0,n.jsx)("div",{className:"small",style:{marginTop:6},children:y("runq.willRun")}),(0,n.jsx)("ol",{className:"small",style:{margin:"4px 0",paddingLeft:22},children:W.map(e=>(0,n.jsx)("li",{children:e.title},e.id))}),(0,n.jsxs)("ul",{className:"small",style:{margin:"4px 0",paddingLeft:18},children:[D.chain&&W.length>1&&(0,n.jsx)("li",{children:y("runq.chainStops")}),D.earlierRan.length>0&&(0,n.jsx)("li",{children:y("runq.untouched",{n:D.earlierRan.length})}),D.laterRan.length>0&&(0,n.jsx)("li",{children:y("runq.laterRan",{list:D.laterRan.map(e=>'"'.concat(e.title,'"')).join(", ")})}),"one"===N&&D.followingQueued.length>0&&(0,n.jsx)("li",{children:y("runq.restWait",{n:D.followingQueued.length})})]}),D.chainGap&&(0,n.jsx)("div",{className:"notice caution small",style:{marginTop:6},children:y("runq.chainGap",{before:D.chainGap.title,status:y("status.".concat(D.chainGap.status))})}),"following"===N&&D.chainGapLater&&(0,n.jsx)("div",{className:"notice caution small",style:{marginTop:6},children:y("runq.chainGapLater",{between:D.chainGapLater.title,status:y("status.".concat(D.chainGapLater.status))})}),G&&(0,n.jsx)("p",{className:"small",children:G})]}):(0,n.jsx)("p",{className:"small",children:y("runq.notQueued",{status:y("status.".concat(null!=(u=null==(s=D.task)?void 0:s.status)?u:"queued"))})}),(0,n.jsxs)("div",{className:"row",style:{marginTop:8},children:[B&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{ref:L,className:"primary",disabled:S||!!G,onClick:()=>void A("confirm"),title:y("runq.goWhy"),children:y("runq.go")}),(0,n.jsx)("button",{disabled:S||!!G,onClick:()=>void A("unattended"),title:y("runq.unattendedWhy"),children:y("runq.unattended")})]}),(0,n.jsx)("button",{ref:H,className:"quiet",disabled:S,onClick:()=>j(!1),children:f?y("runq.later"):y("dialog.cancel")}),I&&(0,n.jsx)("span",{className:"small",role:"status",children:I})]}),q&&(0,n.jsx)(h,{target:m,onApplied:(e,t)=>{M(),0===e&&(R(!1),F(t))}})]})}function h(e){let{target:t,onApplied:s}=e,{t:r}=(0,i.kj)(),[c,o]=(0,l.useState)(null),[d,u]=(0,l.useState)([]),[h,m]=(0,l.useState)(!1),[f,p]=(0,l.useState)(""),[x,g]=(0,l.useState)(null),[j,y]=(0,l.useState)(null),k=(0,l.useId)();(0,l.useEffect)(()=>{o(null),Promise.all([a.FH.contractCheck(t.sessionId,t.taskId),a.FH.session(t.sessionId)]).then(e=>{var s;let[n,l]=e,a=l.tasks.find(e=>e.id===t.taskId);o(n.conflicts),u(n.conflicts.map(e=>e.fixes.length>0?0:-1)),g(null!=(s=null==a?void 0:a.status)?s:null),y(a?{readOnly:a.readOnly,scope:a.scope,checks:a.checks}:null)}).catch(e=>p(e.message))},[t.sessionId,t.taskId]);let v=async()=>{if(c){m(!0),p("");try{let e=await a.FH.applyContractFix(t.sessionId,t.taskId,d,c.map(e=>e.text)),n=r("cfix.applied",{list:(j?function(e,t,s){var n,l,a,i;let r=[];!!t.readOnly!=!!s.readOnly&&r.push(e(s.readOnly?"cfix.chReadOnlyOn":"cfix.chReadOnlyOff"));let c=(null!=(n=t.scope)?n:[]).join(", "),o=(null!=(l=s.scope)?l:[]).join(", ");c!==o&&r.push(o?e("cfix.chScope",{paths:o}):e("cfix.chScopeRemoved"));let d=new Set((null!=(a=s.checks)?a:[]).map(e=>e.name));for(let s of null!=(i=t.checks)?i:[])d.has(s.name)||r.push(e("cfix.chDropped",{check:s.name}));return r.join("; ")}(r,j,e.task):e.applied.join("; "))||r("cfix.chNothing")});p(n+(e.remaining.length>0?" ".concat(r("cfix.remaining",{n:e.remaining.length})):"")),o(e.remaining),u(e.remaining.map(e=>e.fixes.length>0?0:-1)),g("queued"),y({readOnly:e.task.readOnly,scope:e.task.scope,checks:e.task.checks}),s(e.remaining.length,n)}catch(e){p(e.message)}finally{m(!1)}}},b=r("cfix.title",{title:t.title});return(0,n.jsxs)("div",{className:"notice caution",role:"group","aria-label":b,style:{marginTop:8},children:[(0,n.jsx)("strong",{children:b}),(0,n.jsx)("p",{className:"why",children:r("cfix.why")}),null===c?(0,n.jsx)("p",{className:"small",children:f||r("cfix.loading")}):0===c.length?(0,n.jsx)("p",{className:"small",role:"status",children:f||r("cfix.none")}):(0,n.jsxs)(n.Fragment,{children:[c.map((e,t)=>(0,n.jsxs)("fieldset",{className:"small",style:{margin:"8px 0",border:0,padding:0},children:[(0,n.jsx)("legend",{style:{fontWeight:600},children:e.text}),e.fixes.map((e,s)=>(0,n.jsxs)("label",{className:"option-inline",style:{display:"block"},children:[(0,n.jsx)("input",{type:"radio",name:"cfix-".concat(k,"-").concat(t),checked:d[t]===s,onChange:()=>u(e=>e.map((e,n)=>n===t?s:e)),disabled:h}),"add-to-scope"===e.kind?r("cfix.addToScope",{path:e.path}):"not-read-only"===e.kind?e.scope.length>0?r("cfix.notReadOnly",{paths:e.scope.join(", ")}):r("cfix.notReadOnlyAll"):"drop-scope"===e.kind?r("cfix.dropScope"):r("cfix.dropCheck",{check:e.check}),0===s&&(0,n.jsxs)("span",{className:"muted",children:[" ",r("cfix.minimal")]})]},s)),(0,n.jsxs)("label",{className:"option-inline",style:{display:"block"},children:[(0,n.jsx)("input",{type:"radio",name:"cfix-".concat(k,"-").concat(t),checked:-1===d[t],onChange:()=>u(e=>e.map((e,s)=>s===t?-1:e)),disabled:h}),e.fixes.length>0?r("cfix.leave"):r("cfix.noFix")]})]},t)),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("button",{className:"primary",disabled:h||d.every(e=>-1===e),onClick:()=>void v(),children:"queued"===x?r("cfix.applyQueued"):r("cfix.apply")}),f&&(0,n.jsx)("span",{className:"small",role:"status",children:f})]})]})]})}},1366:(e,t,s)=>{s.d(t,{w:()=>r,y:()=>i});var n=s(3365),l=s(1521),a=s(867);function i(e){let{readOnly:t,scope:s,onReadOnly:i,onScope:r}=e,{t:c}=(0,a.kj)(),o=(0,l.useId)();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"option",style:{marginTop:10},children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"checkbox",checked:t,onChange:e=>i(e.target.checked)}),(0,n.jsx)("span",{children:c("task.readOnlyEdit")})]}),(0,n.jsx)("p",{className:"why",children:c("task.readOnlyEditWhy")})]}),(0,n.jsx)("label",{htmlFor:"".concat(o,"-scope"),children:c("task.scopeEdit")}),(0,n.jsx)("textarea",{id:"".concat(o,"-scope"),value:s,onChange:e=>r(e.target.value),placeholder:"tests/e2e/\nsrc/**/*.ts",style:{minHeight:60},disabled:t}),(0,n.jsx)("p",{className:"why",children:c("task.scopeEditWhy")})]})}function r(e){return e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean)}},1910:(e,t,s)=>{s.d(t,{H:()=>c,u:()=>r});var n=s(3365),l=s(1521),a=s(867),i=s(5549);function r(e){let{label:t,save:s}=e,{t:i}=(0,a.kj)(),[r,c]=(0,l.useState)(!1),[o,d]=(0,l.useState)(""),[u,h]=(0,l.useState)(!1),m=async()=>{c(!0),d("");try{var e;let t=await s();h(!1),d(t.revealed?i("save.done",{path:t.path}):i("save.savedOnly",{path:t.path,note:null!=(e=t.note)?e:""}))}catch(e){h(!0),d(i("save.failed",{problem:e.message}))}finally{c(!1)}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"linkish",disabled:r,title:i("save.why"),onClick:()=>void m(),children:r?i("save.saving"):t}),o&&(0,n.jsx)("span",{className:u?"err small":"muted small",children:o})]})}function c(e){let{sessionId:t,taskId:s,attempt:r}=e,{t:c}=(0,a.kj)(),[o,d]=(0,l.useState)(!1),[u,h]=(0,l.useState)(""),[m,f]=(0,l.useState)(!1),p=async()=>{d(!0),h("");try{let e=await i.FH.downloadBundle([{sessionId:t,taskId:s,attempt:r}]);f(!1),h(c("reg.bundleSaved",{name:e}))}catch(e){f(!0),h(c("save.failed",{problem:e.message}))}finally{d(!1)}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"linkish",disabled:o,title:c("save.attemptRecordWhy"),onClick:()=>void p(),children:o?c("save.saving"):c("save.attemptRecord")}),u&&(0,n.jsx)("span",{className:m?"err small":"muted small",children:u})]})}},2876:(e,t,s)=>{s.d(t,{P:()=>d});var n=s(3365),l=s(1521),a=s(5549),i=s(867);function r(e,t){let[s,n]=(0,l.useState)(null),a=(0,l.useRef)(!0),[i,r]=(0,l.useState)(!0),c=(0,l.useCallback)(e=>n(e),[]);return(0,l.useLayoutEffect)(()=>{if(!s)return;let e=()=>{let e=s.scrollHeight-s.scrollTop-s.clientHeight<=24;a.current=e,r(e)};return s.addEventListener("scroll",e,{passive:!0}),()=>s.removeEventListener("scroll",e)},[s]),(0,l.useLayoutEffect)(()=>{s&&e&&a.current&&(s.scrollTop=s.scrollHeight)},[s,e,t]),{ref:c,following:i,follow:(0,l.useCallback)(()=>{a.current=!0,r(!0),s&&(s.scrollTop=s.scrollHeight)},[s])}}var c=s(5132);function o(e){let{text:t,follow:s}=e,{ref:l}=r(s,t);return(0,n.jsx)("pre",{ref:l,className:"story-out".concat(s?" terminal":""),children:t})}function d(e){let{sessionId:t,taskId:s,runId:d,live:h}=e,{t:m}=(0,i.kj)(),[f,p]=(0,l.useState)(null),[x,g]=(0,l.useState)(""),[j,y]=(0,l.useState)(!0),[k,v]=(0,l.useState)(!0),[b,N]=(0,l.useState)(new Set),[w,S]=(0,l.useState)(new Set),[C,I]=(0,l.useState)(new Set),F=!!(null==f?void 0:f.live),q=(0,l.useRef)(0);q.current+=1;let R=r(F,q.current),E=(0,l.useRef)(null),L=(0,l.useRef)(!1);if((0,l.useEffect)(()=>{if(!f)return;let e=[],t=(s,n)=>s.forEach((s,l)=>{let a="".concat(n).concat(l);"review"===s.kind?t(s.entries,"".concat(a,"-")):"step"!==s.kind||s.outcome||e.push(a)});t(f.entries,"e"),e.some(e=>!w.has(e))&&S(t=>new Set([...t,...e])),f.live&&!L.current&&E.current&&(L.current=!0,E.current.scrollIntoView({block:"nearest",behavior:"smooth"}))},[f,w]),(0,l.useEffect)(()=>{let e,n=!0,l=async()=>{try{let i=await a.FH.taskStory(t,s,d);if(!n)return;p(i),g(""),(i.live||h)&&(e=setTimeout(l,2e3))}catch(t){if(!n)return;g(t.message),h&&(e=setTimeout(l,2e3))}};return l(),()=>{n=!1,e&&clearTimeout(e)}},[t,s,d,h]),x&&!f)return(0,n.jsx)("div",{className:"err small",children:x});if(!f)return(0,n.jsx)("div",{className:"muted small",children:m("story.loading")});let H=e=>b.has(e)||w.has(e)&&!C.has(e),T=e=>{let t=H(e);N(s=>{let n=new Set(s);return t?n.delete(e):n.add(e),n}),I(s=>{let n=new Set(s);return t?n.add(e):n.delete(e),n})},M=(e,t)=>{if(!("review"===e.kind?j||k:"step"===e.kind?k:j))return null;if("review"===e.kind)return(0,n.jsxs)("li",{className:"story-review",children:[(0,n.jsxs)("div",{className:"story-head",children:[(0,n.jsx)(u,{at:e.at}),(0,n.jsx)("span",{className:"chip",children:m("story.review",{n:e.round})})]}),(0,n.jsx)("ol",{className:"story",children:e.entries.map((e,s)=>M(e,"".concat(t,"-").concat(s)))})]},t);if("step"===e.kind){let s=H(t),l=!e.outcome&&f.live;return(0,n.jsxs)("li",{className:"story-step".concat(e.failed?" failed":""),children:[(0,n.jsxs)("div",{className:"story-head",children:[(0,n.jsx)(u,{at:e.at}),(0,n.jsx)("span",{className:"chip",children:m("story.step",{it:e.iteration,id:e.id})}),e.outcome&&(0,n.jsxs)("span",{className:"badge ".concat(e.failed?"failed":"done"),children:[e.outcome,void 0!==e.exitCode?" \xb7 exit ".concat(e.exitCode):"",void 0!==e.durationMs?" \xb7 ".concat((0,a.c5)(e.durationMs)):""]}),!e.outcome&&(0,n.jsx)("span",{className:"badge running",children:m("story.running")}),e.failed&&(0,n.jsx)("span",{className:"badge failed",children:m("story.failedHere")})]}),(0,n.jsx)("pre",{className:"story-cmd",children:e.command}),e.output&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"linkish small",onClick:()=>T(t),children:s?m("story.hideOutput"):m("story.showOutput",{n:e.output.length})}),s&&(0,n.jsx)(o,{text:e.output,follow:l})]})]},t)}let s=b.has(t),l="sent"===e.kind?m("story.bot"):m("story.chat"),i="reply"===e.kind&&("blocked"===e.status||"failed"===e.status);return(0,n.jsxs)("li",{className:"story-msg ".concat(e.kind).concat(i?" failed":""),children:[(0,n.jsxs)("div",{className:"story-head",children:[(0,n.jsx)(u,{at:e.at}),(0,n.jsx)("strong",{children:l}),(0,n.jsx)("span",{className:"muted small",children:e.label}),"reply"===e.kind&&e.status&&(0,n.jsx)("span",{className:"badge ".concat(i?"failed":"done"===e.status?"done":""),children:e.status})]}),"reply"===e.kind&&e.notes&&(0,n.jsx)("p",{className:"story-notes",children:e.notes}),(0,n.jsx)("button",{type:"button",className:"linkish small",onClick:()=>T(t),children:s?m("story.hideText"):m("story.showText",{n:e.text.length})}),s&&(0,n.jsx)("pre",{className:"story-out",children:e.text})]},t)},O=f.close,D=O&&"done"!==O.status;return(0,n.jsxs)("div",{className:"story-box",ref:E,children:[(0,n.jsxs)("div",{className:"row small",style:{marginBottom:6},children:[(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:j,onChange:e=>y(e.target.checked)})," ",m("story.showChat")]}),(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:k,onChange:e=>v(e.target.checked)})," ",m("story.showCommands")]}),f.live&&(0,n.jsxs)("span",{className:"live",children:[(0,n.jsx)("span",{className:"dot","aria-hidden":"true"})," ",m("story.live")]}),f.live&&!R.following&&(0,n.jsx)("button",{type:"button",className:"quiet small",onClick:R.follow,title:m("story.followWhy"),children:m("story.follow")}),x&&(0,n.jsx)("span",{className:"err",children:x})]}),(0,n.jsxs)("div",{className:"story-fixed",children:[(0,n.jsx)("strong",{children:m("story.prompt")}),(0,n.jsx)("pre",{className:"story-out always",children:f.prompt})]}),(0,n.jsx)("div",{ref:R.ref,className:"story-scroll".concat(f.live?" live":""),children:(0,n.jsx)("ol",{className:"story",children:f.entries.map((e,t)=>M(e,"e".concat(t)))})}),O?(0,n.jsxs)("div",{className:"story-fixed close".concat(D?" failed":""),children:[(0,n.jsx)("strong",{children:D?m("story.endedBadly",{status:O.status}):m("story.ended")}),O.reason&&(0,n.jsx)("p",{className:"err small",children:O.reason}),O.summary&&(0,n.jsx)(c.s,{text:O.summary,className:"what"}),O.checks&&O.checks.length>0&&(0,n.jsx)("ul",{className:"small",style:{margin:"6px 0 0",paddingLeft:18},children:O.checks.map((e,t)=>(0,n.jsxs)("li",{className:e.passed?"":"err",children:[e.passed?"✓":"✗"," ",e.name,!e.passed&&e.detail?" — ".concat(e.detail):""]},t))})]}):(0,n.jsx)("div",{className:"story-fixed muted small",children:m("story.notEnded")})]})}function u(e){let{at:t}=e,s=(0,i.W3)(),{locale:l}=(0,i.kj)();if(!t)return null;let a=new Date(t),r="bg"===l?"bg-BG":void 0,c=a.toLocaleTimeString(r,{hour12:!1}),o=new Date().toDateString()===a.toDateString();return(0,n.jsx)("time",{className:"story-when",dateTime:t,title:s(t),children:o?c:"".concat(a.toLocaleDateString(r)," ").concat(c)})}},3041:(e,t,s)=>{s.d(t,{e:()=>r});var n=s(1521),l=s(5549),a=s(1035),i=s(867);function r(e){let{t}=(0,i.kj)(),[s,r]=(0,n.useState)(""),[c,o]=(0,n.useState)({taskId:"",text:""}),d=(e,t)=>o({taskId:e,text:t}),u=(0,n.useCallback)(async s=>{r("restore"),d(s.taskId,"");try{var n,i,c,o,u,h,m,f,p,x,g,j,y,k;let r=await l.FH.restorePreview(s.sessionId,s.taskId);if(!r.ok)return void d(s.taskId,t("restore.cannot",{problem:null!=(c=r.problem)?c:""}));let v={repo:r.repoDir,title:s.title,branch:null!=(o=r.branchName)?o:"",commit:(null!=(u=r.baseCommit)?u:"").slice(0,8)},b=r.leftBehind.length>0?t("restore.confirmLosing",{...v,n:r.leftBehind.length,kept:null!=(h=r.keptOn)?h:"",list:r.leftBehind.slice(0,10).join("\n")}):t("restore.confirm",v);if(!await (0,a.Z)(b))return;let N=await l.FH.restore(s.sessionId,s.taskId);if(!N.ok)return void d(s.taskId,t("restore.failed",{problem:null!=(m=N.problem)?m:""}));d(s.taskId,(null!=(f=null==(n=N.leftBehind)?void 0:n.length)?f:0)>0?t("restore.done",{branch:null!=(p=N.branch)?p:"",commit:(null!=(x=N.commit)?x:"").slice(0,8),n:null!=(g=null==(i=N.leftBehind)?void 0:i.length)?g:0,kept:null!=(j=N.keptOn)?j:""}):t("restore.doneNothing",{branch:null!=(y=N.branch)?y:"",commit:(null!=(k=N.commit)?k:"").slice(0,8)})),e()}catch(e){d(s.taskId,e.message)}finally{r("")}},[t,e]),h=(0,n.useCallback)(async s=>{r("restart"),d(s.taskId,"");try{var n,i,c;let r=await l.FH.restartPlan(s.sessionId,s.taskId);if(!r.ok)return void d(s.taskId,t("restart.cannot",{problem:null!=(n=r.problem)?n:""}));let o=r.restores.filter(e=>!e.ok);if(o.length>0)return void d(s.taskId,t("restart.cannot",{problem:o.map(e=>{var t;return"".concat(e.repoDir,": ").concat(null!=(t=e.problem)?t:"")}).join(" | ")}));let u=r.restores.map(e=>{var s,n,l,a,i;return[t("restart.repoLine",{repo:e.repoDir,commit:(null!=(s=e.baseCommit)?s:"").slice(0,8),branch:null!=(n=e.branchName)?n:"",n:e.leftBehind.length,kept:null!=(l=e.keptOn)?l:""}),...e.leftBehind.length>0?[t("restart.commitsHead",{kept:null!=(a=e.keptOn)?a:""})]:[],...e.leftBehind.slice(0,15).map(e=>" ".concat(e)),...e.leftBehind.length>15?[t("restart.commitsMore",{n:e.leftBehind.length-15})]:[],...(null!=(i=e.laterSessions)?i:[]).flatMap(e=>[t("restart.laterSession",{session:e.sessionName,n:e.commits.length,branch:e.branch}),...e.commits.slice(0,15).map(e=>" ".concat(e)),...e.commits.length>15?[t("restart.commitsMore",{n:e.commits.length-15})]:[]])].join("\n")}).join("\n"),h=r.tasks.map(e=>" ".concat(e.sessionName," / ").concat(e.title).concat(e.alreadyQueued?t("restart.alreadyQueued"):t("restart.taskRedo",{status:t("status.".concat(e.status))}))).join("\n"),m="unattended"===r.mode&&!!r.unattendedRefused,f=t("restart.confirm",{title:r.from.title,tasks:r.tasks.length,sessions:r.sessions.length,list:h,repos:u||t("restart.noRepo"),mode:t("unattended"!==r.mode||m?"run.confirm":"run.unattended")})+(m?t("restart.stepByStep",{reason:null!=(i=r.unattendedRefused)?i:""}):"");if(!await (0,a.Z)(f))return;let p=await l.FH.restartFrom(s.sessionId,s.taskId,m?{mode:"confirm"}:{});if(!p.started){d(s.taskId,t("restart.failed",{problem:null!=(c=p.reason)?c:""})),e();return}d(s.taskId,t("restart.started",{requeued:p.requeued,repos:p.restored.length})),e()}catch(e){d(s.taskId,e.message)}finally{r("")}},[t,e]);return{busy:s,message:c.text,messageTask:c.taskId,clearMessage:()=>d("",""),restore:u,restartFrom:h}}},3374:(e,t,s)=>{s.d(t,{c:()=>l});var n=s(1521);function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,[s,l]=(0,n.useState)(()=>Date.now());return(0,n.useEffect)(()=>{if(!e)return;l(Date.now());let s=window.setInterval(()=>l(Date.now()),t);return()=>window.clearInterval(s)},[e,t]),s}},3523:(e,t,s)=>{function n(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now();if(!e)return;let n=Date.parse(e);if(Number.isNaN(n))return;let l=t?Date.parse(t):s;return Number.isNaN(l)?void 0:Math.max(0,l-n)}function l(e){return!!e.startedAt&&!e.finishedAt&&"queued"!==e.status}function a(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now(),n=t.some(e=>l(e)),a=t.map(e=>e.finishedAt?Date.parse(e.finishedAt):NaN).filter(e=>!Number.isNaN(e)),i=Date.parse(e.startedAt),r=n||0===a.length?s:Math.max(...a);return{ms:Number.isNaN(i)?0:Math.max(0,r-i),live:n,tasks:t.length}}function i(e){var t,s;let n=new Map;for(let s of e){if(!s.runGroup)continue;let e=null!=(t=n.get(s.runGroup.id))?t:{run:s.runGroup,tasks:[]};e.tasks.push(s),n.set(s.runGroup.id,e)}return null!=(s=[...n.values()].sort((e,t)=>Date.parse(t.run.startedAt)-Date.parse(e.run.startedAt))[0])?s:null}s.d(t,{DG:()=>l,d5:()=>n,eZ:()=>a,hH:()=>i})},4811:(e,t,s)=>{s.d(t,{p:()=>a});var n=s(1521),l=s(5549);function a(){let[e,t]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e=!0;return l.FH.settings().then(s=>{var n;let l=null!=(n=s.raw.execution)?n:{};e&&t("unattended"===l.mode)}).catch(()=>void 0),()=>{e=!1}},[]),e}},5132:(e,t,s)=>{s.d(t,{s:()=>r});var n=s(3365),l=s(1521);function a(e,t){let s,l=[],a=/(`[^`\n]+`)|(\*\*[^*\n]+\*\*)|(\*[^*\n]+\*)/g,i=0,r=0;for(;null!==(s=a.exec(e));){s.index>i&&l.push(e.slice(i,s.index));let a=s[0],c="".concat(t,"-i").concat(r+=1);a.startsWith("`")?l.push((0,n.jsx)("code",{children:a.slice(1,-1)},c)):a.startsWith("**")?l.push((0,n.jsx)("strong",{children:a.slice(2,-2)},c)):l.push((0,n.jsx)("em",{children:a.slice(1,-1)},c)),i=s.index+a.length}return i<e.length&&l.push(e.slice(i)),l}function i(e){let t=/^\s*[-*•]\s+(.*)$/.exec(e);if(t)return t[1];let s=/^\s*\d+[.)]\s+(.*)$/.exec(e);return s?s[1]:null}function r(e){let{text:t,className:s}=e,r=[],c=t.replace(/\r\n/g,"\n").split("\n"),o=0,d=0;for(;o<c.length;){let e=c[o];if(e.trim().startsWith("```")){let e=[];for(o+=1;o<c.length&&!c[o].trim().startsWith("```");)e.push(c[o++]);o+=1,e.length>0&&r.push((0,n.jsx)("pre",{children:e.join("\n")},"b".concat(d+=1)));continue}if(null!==i(e)){let e=[];for(;o<c.length&&null!==i(c[o]);)e.push(i(c[o++]));r.push((0,n.jsx)("ul",{children:e.map((e,t)=>(0,n.jsx)("li",{children:a(e,"b".concat(d,"-").concat(t))},t))},"b".concat(d+=1)));continue}if(""===e.trim()){o+=1;continue}let t=[];for(;o<c.length&&""!==c[o].trim()&&null===i(c[o])&&!c[o].trim().startsWith("```");)t.push(c[o++]);let s=d+=1;r.push((0,n.jsx)("p",{children:t.map((e,t)=>(0,n.jsxs)(l.Fragment,{children:[t>0&&(0,n.jsx)("br",{}),a(e,"b".concat(s,"-").concat(t))]},t))},"b".concat(s)))}return(0,n.jsx)("div",{className:"rich ".concat(null!=s?s:""),children:r})}},6983:(e,t,s)=>{s.d(t,{J:()=>o});var n=s(3365),l=s(1521),a=s(5549),i=s(867),r=s(4969),c=s(287);function o(e){var t,s,o,d,u;let{sessionId:h,taskId:m,title:f,onClose:p}=e,{t:x}=(0,i.kj)(),g=(0,l.useId)(),[j,y]=(0,l.useState)(null),[k,v]=(0,l.useState)(""),[b,N]=(0,l.useState)(""),[w,S]=(0,l.useState)(!1),[C,I]=(0,l.useState)(!1),F=(0,l.useRef)(null),q=(0,l.useRef)(null);(0,r.V)(F,!0,q),(0,l.useEffect)(()=>{let e=!0;return a.FH.session(h).then(t=>{var s;e&&y(null!=(s=t.tasks.find(e=>e.id===m))?s:null)}).catch(t=>{e&&N(t.message)}),()=>{e=!1}},[h,m]),(0,l.useEffect)(()=>{let e=e=>{"Escape"!==e.key||e.defaultPrevented||w||document.querySelector('[role="alertdialog"]')||p(C)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[w,C,p]);let R=async()=>{if(k.trim()){S(!0),N("");try{await a.FH.continueTask(h,m,k),N(x("fup.saved",{title:f})),I(!0)}catch(e){N(e.message)}finally{S(!1)}}},E=(null!=(d=null==j?void 0:j.checkResults)?d:[]).filter(e=>!e.passed),L=(null==j||null==(t=j.review)?void 0:t.verdict)==="fail"&&null!=(u=j.review.findings)?u:[],H=null==j||null==(s=j.vcs)?void 0:s.branch,T=null==j||null==(o=j.vcs)?void 0:o.commit;return(0,n.jsx)("div",{className:"modal-backdrop",role:"presentation",onClick:()=>!w&&p(C),children:(0,n.jsxs)("div",{ref:F,className:"modal wide",role:"dialog","aria-modal":"true","aria-labelledby":"".concat(g,"-title"),onClick:e=>e.stopPropagation(),style:{overflowWrap:"anywhere"},children:[(0,n.jsx)("h2",{id:"".concat(g,"-title"),children:x("fup.title",{title:f})}),C?(0,n.jsx)(c.f,{target:{sessionId:h,taskId:m,title:f},intro:"".concat(b," ").concat(x("runq.ask")),focusFirst:!0,onClose:()=>p(!0)}):j?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"notice caution small",children:[(0,n.jsx)("strong",{children:x("fup.ended",{status:x("status.".concat(j.status))})}),j.reason&&(0,n.jsx)("p",{style:{margin:"4px 0"},children:j.reason}),E.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{style:{marginTop:6},children:x("fup.failedChecks")}),(0,n.jsx)("ul",{style:{margin:"2px 0",paddingLeft:18},children:E.slice(0,10).map(e=>(0,n.jsxs)("li",{children:[(0,n.jsx)("code",{children:e.name}),": ",e.detail]},e.name))})]}),L.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{style:{marginTop:6},children:x("fup.findings")}),(0,n.jsx)("ul",{style:{margin:"2px 0",paddingLeft:18},children:L.slice(0,10).map((e,t)=>(0,n.jsxs)("li",{children:[e.what,e.where?" (".concat(e.where,")"):""]},t))})]}),j.summary&&j.summary!==j.reason&&(0,n.jsxs)("p",{style:{margin:"6px 0 0"},children:[x("fup.summary")," ",j.summary]})]}),(0,n.jsxs)("ul",{className:"small",style:{margin:"8px 0",paddingLeft:18},children:[(0,n.jsx)("li",{children:x("fup.chat")}),(0,n.jsx)("li",{children:H?T?x("fup.branch",{branch:H,commit:T.slice(0,8)}):x("fup.branchNotCommitted",{branch:H}):x("fup.noVcs")}),(0,n.jsx)("li",{children:x("fup.kept")})]}),(0,n.jsxs)("details",{className:"small",children:[(0,n.jsx)("summary",{children:x("fup.original")}),(0,n.jsx)("pre",{className:"tall",children:j.prompt})]}),(0,n.jsx)("label",{htmlFor:"".concat(g,"-prompt"),style:{marginTop:10},children:x("fup.prompt")}),(0,n.jsx)("textarea",{id:"".concat(g,"-prompt"),ref:q,className:"prose",value:k,onChange:e=>v(e.target.value),placeholder:x("fup.placeholder"),style:{minHeight:180},disabled:w}),(0,n.jsx)("p",{className:"why",children:x("fup.startOver",{fix:x("reg.fixPrompt")})}),(0,n.jsxs)("div",{className:"row modal-actions",children:[b&&(0,n.jsx)("span",{className:"small grow err",children:b}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>p(!1),disabled:w,children:x("dialog.cancel")}),(0,n.jsx)("button",{type:"button",className:"primary",onClick:()=>void R(),disabled:w||!k.trim(),children:x("fup.save")})]})]}):(0,n.jsx)("p",{className:"muted small",children:b||x("fup.loading")})]})})}},8934:(e,t,s)=>{s.d(t,{C:()=>o});var n=s(3365),l=s(1521),a=s(5549),i=s(4969),r=s(867);function c(e){if(null===e||""===e)return[];let t=e.split(/\r?\n/);return""===t[t.length-1]&&t.pop(),t}function o(e){let{sessionId:t,taskId:s,runId:a,title:i,files:c}=e,{t:o}=(0,r.kj)(),[u,h]=(0,l.useState)(!1);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"linkish",onClick:()=>h(!0),title:o("diff.openWhy"),children:o("diff.open",{n:c})}),u&&(0,n.jsx)(d,{sessionId:t,taskId:s,runId:a,title:i,onClose:()=>h(!1)})]})}function d(e){var t,s,o,d,h,m,f;let{sessionId:p,taskId:x,runId:g,title:j,onClose:y}=e,{t:k}=(0,r.kj)(),[v,b]=(0,l.useState)(null),[N,w]=(0,l.useState)(""),[S,C]=(0,l.useState)(0),[I,F]=(0,l.useState)(new Map),[q,R]=(0,l.useState)(!1),[E,L]=(0,l.useState)(!0),[H,T]=(0,l.useState)(new Map),[M,O]=(0,l.useState)(-1),D=(0,l.useRef)(null),B=(0,l.useRef)(null),W=(0,l.useRef)(null);(0,i.V)(B,!0,W),(0,l.useEffect)(()=>{a.FH.taskChanges(p,x,g).then(b).catch(e=>w(e.message))},[p,x,g]);let G=null!=(o=null==v?void 0:v.files)?o:[],A=G[S];(0,l.useEffect)(()=>{!A||I.has(A.path)||a.FH.taskChangeFile(p,x,A.path,g).then(e=>F(t=>new Map(t).set(A.path,e))).catch(e=>F(t=>new Map(t).set(A.path,e.message)))},[A,I,p,x,g]);let P=A?I.get(A.path):void 0,Q=(0,l.useMemo)(()=>!P||"string"==typeof P||P.binary||P.tooLarge?[]:function(e,t){let s=function(e,t){let s=0;for(;s<e.length&&s<t.length&&e[s]===t[s];)s+=1;let n=e.length,l=t.length;for(;n>s&&l>s&&e[n-1]===t[l-1];)n-=1,l-=1;let a=[];for(let e=0;e<s;e+=1)a.push({kind:"same",a:e,b:e});for(let i of function(e,t){let s=e.length,n=t.length;if(0===s)return t.map((e,t)=>({kind:"add",b:t}));if(0===n)return e.map((e,t)=>({kind:"del",a:t}));let l=s+n,a=l+1,i=new Int32Array(2*l+3),r=[];for(let c=0;c<=Math.min(l,2e3);c+=1){r.push(i.slice(a-c-1,a+c+2));for(let l=-c;l<=c;l+=2){let o=l===-c||l!==c&&i[a+l-1]<i[a+l+1]?i[a+l+1]:i[a+l-1]+1,d=o-l;for(;o<s&&d<n&&e[o]===t[d];)o+=1,d+=1;if(i[a+l]=o,o>=s&&d>=n)return function(e,t,s,n){let l=[],a=t.length,i=s.length;for(let t=n;t>0;t-=1){let s=e[t],n=e=>s[e+t+1],r=a-i,c=r===-t||r!==t&&n(r-1)<n(r+1)?r+1:r-1,o=n(c),d=o-c;for(;a>o&&i>d;)a-=1,i-=1,l.push({kind:"same",a:a,b:i});a===o?l.push({kind:"add",b:d}):l.push({kind:"del",a:o}),a=o,i=d}for(;a>0&&i>0;)a-=1,i-=1,l.push({kind:"same",a:a,b:i});return l.reverse()}(r,e,t,c)}}return[...e.map((e,t)=>({kind:"del",a:t})),...t.map((e,t)=>({kind:"add",b:t}))]}(e.slice(s,n),t.slice(s,l)))a.push({kind:i.kind,...void 0!==i.a?{a:i.a+s}:{},...void 0!==i.b?{b:i.b+s}:{}});for(let t=0;n+t<e.length;t+=1)a.push({kind:"same",a:n+t,b:l+t});return a}(e,t),n=[];for(let l=0;l<s.length;){let a=s[l];if("same"===a.kind){n.push({kind:"same",left:{no:a.a+1,text:e[a.a]},right:{no:a.b+1,text:t[a.b]}}),l+=1;continue}let i=[],r=[];for(;l<s.length&&"same"!==s[l].kind;){let e=s[l];"del"===e.kind?i.push(e.a):r.push(e.b),l+=1}let c=Math.max(i.length,r.length);for(let s=0;s<c;s+=1){let l=i[s],a=r[s];n.push({kind:void 0!==l&&void 0!==a?"change":void 0!==l?"del":"add",...void 0!==l?{left:{no:l+1,text:e[l]}}:{},...void 0!==a?{right:{no:a+1,text:t[a]}}:{}})}}return n}(c(P.before),c(P.after)),[P]),V=A&&H.get(A.path)||new Set,Z=(0,l.useMemo)(()=>(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(n)return e.map((e,t)=>({type:"row",row:e,index:t}));let l=[];for(let n=0;n<e.length;){if("same"!==e[n].kind){l.push({type:"row",row:e[n],index:n}),n+=1;continue}let a=n;for(;a<e.length&&"same"===e[a].kind;)a+=1;let i=0===n?0:t,r=a===e.length?0:t,c=a-n-i-r;if(c>1&&!s.has(n+i)){for(let t=n;t<n+i;t+=1)l.push({type:"row",row:e[t],index:t});l.push({type:"gap",from:n+i,count:c});for(let t=a-r;t<a;t+=1)l.push({type:"row",row:e[t],index:t})}else for(let t=n;t<a;t+=1)l.push({type:"row",row:e[t],index:t});n=a}return l})(Q,3,V,q),[Q,V,q]),_=(0,l.useMemo)(()=>Q.flatMap((e,t)=>"same"!==e.kind&&(0===t||"same"===Q[t-1].kind)?[t]:[]),[Q]);(0,l.useEffect)(()=>{O(-1),D.current&&(D.current.scrollTop=0)},[S]);let K=(0,l.useCallback)(e=>{var t;if(0===_.length)return;let s=M<0?1===e?0:_.length-1:Math.min(_.length-1,Math.max(0,M+e));O(s);let n=null==(t=D.current)?void 0:t.querySelector('[data-row="'.concat(_[s],'"]'));null==n||n.scrollIntoView({block:"center"})},[M,_]),$=(0,l.useCallback)(e=>C(t=>Math.min(Math.max(0,t+e),Math.max(0,G.length-1))),[G.length]);(0,l.useEffect)(()=>{let e=e=>{if(!e.ctrlKey&&!e.metaKey&&!e.altKey){if("Escape"===e.key)y();else if("n"===e.key)K(1);else if("p"===e.key)K(-1);else if("]"===e.key)$(1);else{if("["!==e.key)return;$(-1)}e.preventDefault()}};window.addEventListener("keydown",e);let t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",e),document.body.style.overflow=t}},[K,$,y]);let z=G.reduce((e,t)=>({added:e.added+Math.max(0,t.added),removed:e.removed+Math.max(0,t.removed)}),{added:0,removed:0});return(0,n.jsxs)("div",{ref:B,className:"diff-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"diff-title",children:[(0,n.jsxs)("div",{className:"diff-head",children:[(0,n.jsx)("h2",{id:"diff-title",children:k("diff.title",{title:j})}),(null==v?void 0:v.ok)&&(0,n.jsxs)("span",{className:"muted small",children:[v.branch?"".concat(v.branch," \xb7 "):"",null==(t=v.base)?void 0:t.slice(0,8)," → ",null==(s=v.commit)?void 0:s.slice(0,8)," \xb7 ",k("diff.summary",{n:G.length,a:z.added,r:z.removed})]}),(0,n.jsx)("span",{className:"grow"}),(0,n.jsx)("span",{className:"muted small",children:k("diff.keys")}),(0,n.jsx)("button",{ref:W,type:"button",onClick:y,children:k("diff.close")})]}),N&&(0,n.jsx)("div",{className:"err",style:{padding:12},children:N}),!v&&!N&&(0,n.jsx)("div",{className:"muted",style:{padding:12},children:k("diff.loading")}),v&&!v.ok&&(0,n.jsx)("div",{className:"notice caution",style:{margin:12},children:v.problem}),(null==v?void 0:v.ok)&&0===G.length&&(0,n.jsx)("div",{className:"notice",style:{margin:12},children:k("diff.nothing")}),(null==v?void 0:v.ok)&&G.length>0&&(0,n.jsxs)("div",{className:"diff-body",children:[(0,n.jsx)("nav",{className:"diff-files","aria-label":k("diff.files"),children:G.map((e,t)=>{let s=e.path.lastIndexOf("/");return(0,n.jsxs)("button",{type:"button",className:"diff-file".concat(t===S?" on":""),onClick:()=>C(t),title:e.oldPath?"".concat(e.oldPath," → ").concat(e.path):e.path,children:[(0,n.jsx)("span",{className:"diff-status s-".concat(e.status),children:e.status}),(0,n.jsxs)("span",{className:"diff-path",children:[s>=0&&(0,n.jsx)("span",{className:"muted",children:e.path.slice(0,s+1)}),(0,n.jsx)("strong",{children:e.path.slice(s+1)})]}),(0,n.jsx)("span",{className:"diff-counts",children:e.added<0?k("diff.binaryShort"):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("span",{className:"plus",children:["+",e.added]})," ",(0,n.jsxs)("span",{className:"minus",children:["−",e.removed]})]})})]},e.path)})}),(0,n.jsxs)("div",{className:"diff-main",children:[A&&(0,n.jsxs)("div",{className:"diff-toolbar",children:[(0,n.jsx)("strong",{className:"diff-name",children:A.oldPath?"".concat(A.oldPath," → ").concat(A.path):A.path}),(0,n.jsx)("span",{className:"muted small",children:"A"===A.status?k("diff.added"):"D"===A.status?k("diff.deleted"):"R"===A.status?k("diff.renamed"):""}),(0,n.jsx)("span",{className:"grow"}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>K(-1),disabled:0===_.length,children:k("diff.prevChange")}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>K(1),disabled:0===_.length,children:k("diff.nextChange")}),(0,n.jsx)("span",{className:"muted small",children:_.length>0?k("diff.changeN",{i:M<0?"–":M+1,n:_.length}):""}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>$(-1),disabled:0===S,children:k("diff.prevFile")}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>$(1),disabled:S>=G.length-1,children:k("diff.nextFile")}),(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:q,onChange:e=>R(e.target.checked)})," ",k("diff.whole")]}),(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:E,onChange:e=>L(e.target.checked)})," ",k("diff.wrap")]})]}),(0,n.jsxs)("div",{className:"diff-scroll",ref:D,children:[void 0===P&&(0,n.jsx)("div",{className:"muted",style:{padding:12},children:k("diff.loading")}),"string"==typeof P&&(0,n.jsx)("div",{className:"err",style:{padding:12},children:P}),P&&"string"!=typeof P&&P.binary&&(0,n.jsx)("div",{className:"notice",style:{margin:12},children:k("diff.binary")}),P&&"string"!=typeof P&&P.tooLarge&&(0,n.jsx)("div",{className:"notice",style:{margin:12},children:k("diff.tooLarge")}),P&&"string"!=typeof P&&!P.binary&&!P.tooLarge&&(0,n.jsxs)(n.Fragment,{children:[(null!=(d=P.before)?d:"").includes("\r\n")!==(null!=(h=P.after)?h:"").includes("\r\n")&&null!==P.before&&null!==P.after&&(0,n.jsx)("div",{className:"notice small",style:{margin:8},children:k("diff.eol",{from:(null!=(m=P.before)?m:"").includes("\r\n")?"CRLF":"LF",to:(null!=(f=P.after)?f:"").includes("\r\n")?"CRLF":"LF"})}),Q.length>0&&0===_.length&&(0,n.jsx)("div",{className:"notice small",style:{margin:8},children:k("diff.sameText")}),(0,n.jsxs)("table",{className:"diff-table".concat(E?"":" nowrap"),children:[(0,n.jsxs)("colgroup",{children:[(0,n.jsx)("col",{className:"num"}),(0,n.jsx)("col",{}),(0,n.jsx)("col",{className:"num"}),(0,n.jsx)("col",{})]}),(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{colSpan:2,children:k("diff.before")}),(0,n.jsx)("th",{colSpan:2,children:k("diff.after")})]})}),(0,n.jsx)("tbody",{children:Z.map(e=>"gap"===e.type?(0,n.jsx)("tr",{className:"diff-gap",children:(0,n.jsx)("td",{colSpan:4,children:(0,n.jsx)("button",{type:"button",className:"linkish small",onClick:()=>{var t;return t=e.from,void(A&&T(e=>{var s;return new Map(e).set(A.path,new Set([...null!=(s=e.get(A.path))?s:[],t]))}))},children:k("diff.gap",{n:e.count})})})},"g".concat(e.from)):(0,n.jsx)(u,{row:e.row,index:e.index,current:M>=0&&_[M]===e.index},e.index))})]})]})]})]})]})]})}function u(e){var t,s,a,i;let{row:r,index:c,current:o}=e,d="change"===r.kind?function(e,t){let s=0;for(;s<e.length&&s<t.length&&e[s]===t[s];)s+=1;let n=e.length,l=t.length;for(;n>s&&l>s&&e[n-1]===t[l-1];)n-=1,l-=1;return{start:s,leftEnd:n,rightEnd:l}}(r.left.text,r.right.text):null,u=e=>{let t=r[e];if(!t)return null;if(!d)return t.text;let s="left"===e?d.leftEnd:d.rightEnd;return(0,n.jsxs)(l.Fragment,{children:[t.text.slice(0,d.start),(0,n.jsx)("mark",{children:t.text.slice(d.start,s)}),t.text.slice(s)]})};return(0,n.jsxs)("tr",{className:"diff-row ".concat(r.kind).concat(o?" current":""),"data-row":c,children:[(0,n.jsx)("td",{className:"num",children:null!=(a=null==(t=r.left)?void 0:t.no)?a:""}),(0,n.jsx)("td",{className:"code l".concat(r.left?"":" empty"),children:u("left")}),(0,n.jsx)("td",{className:"num",children:null!=(i=null==(s=r.right)?void 0:s.no)?i:""}),(0,n.jsx)("td",{className:"code r".concat(r.right?"":" empty"),children:u("right")})]})}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[499],{1035:(e,t,r)=>{r.d(t,{DialogHost:()=>d,Z:()=>o});var l=r(3365),n=r(1521),s=r(867),a=r(4969);let c=null,i=[];function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(r=>{var l;return l={kind:"confirm",message:e,...t,resolve:r},void(c?c(l):i.push(l))})}function d(e){var t,r;let{children:o}=e,{t:d}=(0,s.kj)(),[h,m]=(0,n.useState)([]),u=(0,n.useRef)(null),p=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(c=e=>m(t=>[...t,e]),i.length>0){let e=i.splice(0,i.length);m(t=>[...t,...e])}return()=>{c=null}},[]);let x=h[0],g=(0,n.useCallback)(e=>{x&&(x.resolve(e),m(e=>e.slice(1)))},[x]);return(0,a.V)(p,!!x,u),(0,n.useEffect)(()=>{if(!x)return;let e=e=>{"Escape"===e.key&&(e.preventDefault(),g(!1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[x,g]),(0,l.jsxs)(l.Fragment,{children:[o,x&&(0,l.jsx)("div",{className:"modal-backdrop",onClick:()=>g(!1),role:"presentation",children:(0,l.jsxs)("div",{ref:p,className:"modal".concat(x.danger?" danger":""),role:"confirm"===x.kind?"alertdialog":"dialog","aria-modal":"true","aria-labelledby":"modal-title","aria-describedby":"modal-body",onClick:e=>e.stopPropagation(),children:[(0,l.jsx)("h2",{id:"modal-title",children:null!=(t=x.title)?t:d("confirm"===x.kind?"dialog.confirmTitle":"dialog.noticeTitle")}),(0,l.jsx)("div",{id:"modal-body",className:"modal-body",children:x.message}),(0,l.jsxs)("div",{className:"row modal-actions",children:["confirm"===x.kind&&(0,l.jsx)("button",{type:"button",className:"quiet",onClick:()=>g(!1),children:d("dialog.cancel")}),(0,l.jsx)("button",{ref:u,type:"button",className:x.danger?"danger":"primary",onClick:()=>g(!0),children:null!=(r=x.okLabel)?r:d("dialog.ok")})]})]})})]})}},1701:(e,t,r)=>{r.d(t,{L:()=>u,StartDialogHost:()=>p});var l=r(3365),n=r(1521),s=r(5549),a=r(867),c=r(4969),i=r(3486),o=r(3069);let d=null,h=[],m=1;function u(e){return new Promise(t=>{let r={...e,id:m++,resolve:t};d?d(r):h.push(r)})}function p(){let[e,t]=(0,n.useState)([]);(0,n.useEffect)(()=>{if(d=e=>t(t=>[...t,e]),h.length>0){let e=h.splice(0,h.length);t(t=>[...t,...e])}return()=>{d=null}},[]);let r=e[0];return r?(0,l.jsx)(g,{req:r,onDone:e=>{r.resolve(e),t(e=>e.slice(1))}},r.id):null}let x=e=>e.trim().replace(/[\\/]+$/,"").replace(/\//g,"\\").toLowerCase();function g(e){var t,r,d,h,m,u;let{req:p,onDone:g}=e,{t:f}=(0,a.kj)(),j=(0,a.W3)(),v=(0,n.useId)(),b=(0,n.useRef)(null),y=(0,n.useRef)(null),[k,w]=(0,n.useState)(null),[N,F]=(0,n.useState)(""),[B,C]=(0,n.useState)({}),[S,D]=(0,n.useState)({}),[E,T]=(0,n.useState)({kind:"choose"}),[H,O]=(0,n.useState)(""),[W,I]=(0,n.useState)(""),[L,R]=(0,n.useState)({}),[A,q]=(0,n.useState)([]),[P,z]=(0,n.useState)(!1),U=(0,n.useRef)(new Set),V=(0,n.useRef)(void 0),K=e=>g({started:e,...V.current?{reply:V.current}:{}}),_="fetching"===E.kind||"starting"===E.kind||""!==W,X=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return s.FH.startOptions(p.sessionIds).then(t=>{w(t);let r={};for(let e of t.repos)r[x(e.repoDir)]=e;C(r);let l={};for(let e of t.sessions){if(!e.vcs||!e.repoDir||e.fixed&&!e.choice)continue;let t=function(e,t){var r,l,n,s,a,c,i;let o=null!=(a=null!=(s=null==t||null==(r=t.remotes.find(e=>"origin"===e.name))?void 0:r.name)?s:null==t||null==(l=t.remotes[0])?void 0:l.name)?a:"",d=null!=(i=null!=(c=null==t?void 0:t.current)?c:null==t||null==(n=t.local[0])?void 0:n.name)?i:"main";return e?"previous-session"===e.from?{from:"previous-session",local:d,remote:o,remoteBranch:d,onBranch:!1}:"local"===e.from?{from:"local",local:e.branch,remote:o,remoteBranch:e.branch,onBranch:!!e.onBranch}:{from:"remote",local:(null==t?void 0:t.local.some(t=>t.name===e.branch))?e.branch:d,remote:e.remote,remoteBranch:e.branch,onBranch:!!e.onBranch}:{from:"local",local:d,remote:o,remoteBranch:"main",onBranch:!1}}(e.choice,r[x(e.repoDir)]);l[e.id]=e.prepared||e.fixed?{...t,from:"keep"}:t}D(t=>e?{...l,...Object.fromEntries(Object.entries(t).filter(e=>{let[t]=e;return t in l}))}:l)}).catch(e=>F(e.message))};(0,n.useEffect)(()=>{X()},[p.sessionIds]),(0,c.V)(b,!0,y),(0,n.useEffect)(()=>{let e=e=>{"Escape"===e.key&&!e.defaultPrevented&&(e.preventDefault(),_||K(!1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[_,K]);let J=e=>e?B[x(e)]:void 0,M=(e,t)=>D(r=>({...r,[e]:{...r[e],...t}})),G=e=>{e&&C(t=>({...t,[x(e.repoDir)]:e}))},Z=()=>{s.FH.runVcs(p.sessionIds).then(q).catch(()=>q([]))},$=()=>{U.current.clear(),T({kind:"choose"})},Q=async function(){var e;let t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};O("");let l=(()=>{var e,t;let r={},l=new Map;for(let n of null!=(e=null==k?void 0:k.sessions)?e:[]){let e=S[n.id],s=J(n.repoDir);if(!e||!n.repoDir||!s||s.problem||"keep"===e.from)continue;let a=n.fixed?{rechoose:!0}:{};if("previous-session"===e.from)r[n.id]={from:"previous-session",...a};else if("current"===e.from){if(!s.current)return{problem:f("startdlg.needBranch",{name:n.name})};r[n.id]={from:"local",branch:s.current,...e.onBranch?{onBranch:!0}:{},...a}}else if("local"===e.from){if(!e.local||!s.local.some(t=>t.name===e.local))return{problem:f("startdlg.needBranch",{name:n.name})};r[n.id]={from:"local",branch:e.local,...e.onBranch?{onBranch:!0}:{},...a}}else{let c=e.remoteBranch.trim();if(!e.remote||!c)return{problem:f("startdlg.needBranch",{name:n.name})};r[n.id]={from:"remote",remote:e.remote,branch:c,...e.onBranch?{onBranch:!0}:{},...a};let i="".concat(x(n.repoDir),"|").concat(e.remote),o=null!=(t=l.get(i))?t:{key:i,dir:s.repoDir,remote:e.remote,branches:[]};o.branches.includes(c)||o.branches.push(c),l.set(i,o)}}return{starts:r,groups:[...l.values()].map(e=>({...e,key:"".concat(e.key,"|").concat([...e.branches].sort().join(","))}))}})();if("problem"in l)return void O(l.problem);if(!r.skipFetch)for(let e of l.groups){if(U.current.has(e.key))continue;T({kind:"fetching",what:e.branches.map(t=>"".concat(e.remote,"/").concat(t)).join(", ")});let t=await s.FH.startFetch(e.dir,e.remote,e.branches).catch(e=>({ok:!1,problem:e.message,missing:[]}));if(G(t.repo),!t.ok)return void T({kind:"fetchFailed",group:e,result:t})}T({kind:"starting"});try{t=await p.start(l.starts)}catch(e){t={started:!1,reason:e.message}}if(V.current=t,t.started)return void K(!0);T({kind:"failed",reply:t}),(null==(e=t.failure)?void 0:e.stage)==="preflight"&&Z()},Y=async(e,t)=>{I("".concat(x(e),"|").concat(t)),R(r=>({...r,[x(e)]:f("startdlg.fetching",{what:t})}));try{let r=await s.FH.startFetch(e,t);G(r.repo),R(l=>{var n,s,a,c;return{...l,[x(e)]:r.ok?"":"".concat(f("startdlg.fetchFailed",{what:t})," ").concat(null!=(c=null!=(a=r.problem)?a:null==(n=r.fetched)?void 0:n.detail)?c:"").concat((null==(s=r.fetched)?void 0:s.auth)?" ".concat(f("prep.fetchAuth")):"")}})}catch(t){R(r=>({...r,[x(e)]:t.message}))}finally{I("")}},ee=async e=>{try{await navigator.clipboard.writeText(e),z(!0),window.setTimeout(()=>z(!1),2500)}catch(e){O(f("plan.copyFailed"))}},et=Object.values(S).some(e=>"remote"===e.from),er=(null!=(h=null==k?void 0:k.sessions)?h:[]).filter(e=>e.vcs),el=1===er.length?(e=>{var t,r,l;let n=S[e.id],s=J(e.repoDir);if(!n||!s)return;let a=e=>e?" @ ".concat(e.slice(0,8)):"";return"keep"===n.from?e.fixed&&(null==(t=e.started)?void 0:t.branch)?"".concat(e.started.branch).concat(a(null!=(l=e.started.tipNow)?l:e.started.recorded)):void 0:"current"===n.from?s.current?"".concat(s.current).concat(a(s.head)):void 0:"local"===n.from?"".concat(n.local).concat(a(null==(r=s.local.find(e=>e.name===n.local))?void 0:r.commit)):"remote"===n.from&&n.remoteBranch.trim()?"".concat(n.remote,"/").concat(n.remoteBranch.trim()):void 0})(er[0]):void 0,en=el?f("unattended"===p.mode?"startdlg.goUnattendedOn":"startdlg.goStepOn",{where:el}):"unattended"===p.mode?f("startdlg.goUnattended"):f("startdlg.goStep");return(0,l.jsx)("div",{className:"modal-backdrop",role:"presentation",onClick:()=>!_&&K(!1),children:(0,l.jsxs)("div",{ref:b,className:"modal wide start-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"".concat(v,"-title"),onClick:e=>e.stopPropagation(),style:{overflowWrap:"anywhere"},children:[(0,l.jsx)("h2",{id:"".concat(v,"-title"),children:f("startdlg.title")}),(0,l.jsxs)("p",{className:"small muted",style:{marginTop:0},children:[f("startdlg.intro")," ",k&&"choose"===E.kind&&(0,l.jsx)("button",{type:"button",className:"quiet",onClick:()=>void X(!0),disabled:_,children:f("startdlg.refresh")})]}),N&&(0,l.jsx)(o.X,{reason:N}),!k&&!N&&(0,l.jsx)("p",{className:"small",role:"status",children:f("startdlg.loading")}),k&&("choose"===E.kind||"fetching"===E.kind||"starting"===E.kind)&&k.sessions.map(e=>{var t,r,n,s,a,c,i,o,d,h,m,u;let p=J(e.repoDir),g=S[e.id],b="start-".concat(v,"-").concat(e.id),y=null!=(c=null==p||null==(t=p.remotes.find(e=>e.name===(null==g?void 0:g.remote)))?void 0:t.branches)?c:[];return(0,l.jsxs)("fieldset",{className:"option",style:{border:"1px solid var(--line)",borderRadius:"var(--radius)",padding:"8px 12px",margin:"10px 0"},children:[(0,l.jsx)("legend",{style:{padding:"0 4px"},children:(0,l.jsx)("strong",{children:e.name})}),e.repoDir&&(0,l.jsx)("p",{className:"muted small",style:{margin:"2px 0 6px"},children:f("startdlg.repoOn",{repo:e.repoDir,branch:null!=(i=null==p?void 0:p.current)?i:"HEAD"})}),e.vcs?p&&!p.problem&&g?e.fixed&&e.rechooseBlocked?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{className:"small",children:f("startdlg.fixed",{start:e.fixed})}),(0,l.jsx)("p",{className:"muted small",children:f("startdlg.rechooseBlocked",{tasks:e.rechooseBlocked})})]}):(0,l.jsxs)(l.Fragment,{children:[e.fixed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{className:"small",style:{margin:"2px 0"},children:f("startdlg.fixed",{start:e.fixed})}),(null==(r=e.started)?void 0:r.branch)&&(0,l.jsxs)("p",{className:"small",style:{margin:"2px 0"},children:[e.started.tipNow?f("startdlg.branchNow",{branch:e.started.branch,now:e.started.tipNow.slice(0,8),recorded:(null!=(d=e.started.recorded)?d:"").slice(0,8)}):f("startdlg.branchGone",{branch:e.started.branch,recorded:(null!=(h=e.started.recorded)?h:"").slice(0,8)}),e.started.remote?" ".concat(f("startdlg.branchRemote",{name:e.started.remote.name,commit:e.started.remote.commit.slice(0,8)})):""]}),p.current&&(null==(n=e.started)?void 0:n.branch)&&p.current!==e.started.branch&&"per-task"!==e.started.mode&&(0,l.jsx)("p",{className:"notice caution small",style:{margin:"4px 0"},children:f("startdlg.differs",{current:p.current,head:(null!=(m=p.head)?m:"").slice(0,8),branch:e.started.branch})}),(0,l.jsx)("div",{className:"option",children:(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:b,checked:"keep"===g.from,onChange:()=>M(e.id,{from:"keep"}),disabled:_}),(0,l.jsx)("span",{children:(null==(s=e.started)?void 0:s.branch)?f("startdlg.keepStarted",{branch:e.started.branch}):f("startdlg.keepStartedNoBranch")})]})}),p.current&&p.current!==(null==(a=e.started)?void 0:a.branch)&&(0,l.jsx)("div",{className:"option",children:(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:b,checked:"current"===g.from,onChange:()=>M(e.id,{from:"current"}),disabled:_}),(0,l.jsx)("span",{children:f("startdlg.useCurrent",{branch:p.current,commit:(null!=(u=p.head)?u:"").slice(0,8)})})]})})]}),e.prepared&&(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:b,checked:"keep"===g.from,onChange:()=>M(e.id,{from:"keep"}),disabled:_}),(0,l.jsx)("span",{children:f("startdlg.keep")})]}),(0,l.jsx)("p",{className:"why",children:f("startdlg.prepared",{start:e.prepared})})]}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:b,checked:"local"===g.from,onChange:()=>M(e.id,{from:"local"}),disabled:_}),(0,l.jsx)("span",{children:f("startdlg.local")})]}),(0,l.jsx)("div",{className:"row",style:{marginTop:4},children:(0,l.jsxs)("select",{"aria-label":f("startdlg.localBranch"),value:g.local,onChange:t=>M(e.id,{from:"local",local:t.target.value}),disabled:_,style:{width:"auto",minWidth:240,maxWidth:"100%"},children:[!p.local.some(e=>e.name===g.local)&&(0,l.jsx)("option",{value:g.local,children:g.local}),p.local.map(e=>(0,l.jsxs)("option",{value:e.name,children:[e.name," \xb7 ",e.commit.slice(0,8)]},e.name))]})}),(0,l.jsx)("p",{className:"why",children:f("startdlg.localWhy")})]}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:b,checked:"remote"===g.from,onChange:()=>M(e.id,{from:"remote"}),disabled:_||0===p.remotes.length}),(0,l.jsx)("span",{children:f("startdlg.remote")})]}),0===p.remotes.length?(0,l.jsx)("p",{className:"muted small",children:f("startdlg.noRemote")}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"row",style:{marginTop:4},children:[p.remotes.length>1&&(0,l.jsx)("select",{"aria-label":f("startdlg.remoteName"),value:g.remote,onChange:t=>M(e.id,{from:"remote",remote:t.target.value}),disabled:_,style:{width:"auto"},children:p.remotes.map(e=>(0,l.jsx)("option",{value:e.name,children:e.name},e.name))}),1===p.remotes.length&&(0,l.jsxs)("code",{children:[g.remote,"/"]}),(0,l.jsx)("input",{type:"text","aria-label":f("startdlg.remoteBranch"),list:"".concat(b,"-remote"),value:g.remoteBranch,onChange:t=>M(e.id,{from:"remote",remoteBranch:t.target.value}),onFocus:()=>"remote"!==g.from&&M(e.id,{from:"remote"}),disabled:_,style:{width:"auto",minWidth:240,flex:"1 1 240px"},placeholder:"main"}),(0,l.jsx)("datalist",{id:"".concat(b,"-remote"),children:y.map(e=>(0,l.jsx)("option",{value:e.name},e.name))}),(0,l.jsx)("button",{type:"button",onClick:()=>void Y(p.repoDir,g.remote),disabled:_||!g.remote,children:f("startdlg.refreshRemote")})]}),(0,l.jsx)("p",{className:"why",children:f("startdlg.remoteWhy")}),(0,l.jsx)("p",{className:"muted small",style:{margin:"2px 0"},children:p.lastFetched?f("startdlg.lastFetched",{when:j(p.lastFetched)}):y.length>0?f("startdlg.lastFetchedUnknown"):f("startdlg.neverFetched")}),L[x(p.repoDir)]&&(0,l.jsx)("p",{className:"small",role:"status",children:L[x(p.repoDir)]})]})]}),e.previousOffered&&(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:b,checked:"previous-session"===g.from,onChange:()=>M(e.id,{from:"previous-session"}),disabled:_}),(0,l.jsx)("span",{children:f("startdlg.previous")})]}),(0,l.jsx)("p",{className:"why",children:f("startdlg.previousWhy")})]}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"checkbox",checked:g.onBranch&&("local"===g.from||"remote"===g.from||"current"===g.from),onChange:t=>M(e.id,{onBranch:t.target.checked}),disabled:_||"local"!==g.from&&"remote"!==g.from&&"current"!==g.from}),(0,l.jsx)("span",{children:f("startdlg.onBranch")})]}),(0,l.jsx)("p",{className:"why",children:f("startdlg.onBranchWhy")})]}),e.fixed&&"keep"!==g.from&&(0,l.jsx)("p",{className:"notice caution small",children:f("startdlg.rechooseNote")})]}):e.fixed?(0,l.jsx)("p",{className:"small",children:f("startdlg.fixed",{start:e.fixed})}):(0,l.jsx)("p",{className:"err small",children:f("startdlg.repoProblem",{problem:null!=(o=null==p?void 0:p.problem)?o:""})}):(0,l.jsx)("p",{className:"small",children:f("startdlg.vcsOff")})]},e.id)}),"fetching"===E.kind&&(0,l.jsx)("p",{className:"notice small",role:"status",children:f("startdlg.fetching",{what:E.what})}),"starting"===E.kind&&(0,l.jsx)("p",{className:"notice small",role:"status",children:f("startdlg.starting")}),"fetchFailed"===E.kind&&(0,l.jsxs)("div",{className:"notice caution",role:"alert",children:[(0,l.jsxs)("p",{style:{marginTop:0},children:[(0,l.jsx)("strong",{children:f("startdlg.fetchFailed",{what:E.group.branches.map(e=>"".concat(E.group.remote,"/").concat(e)).join(", ")})})," ",(0,l.jsx)("code",{children:null!=(u=null!=(m=E.result.problem)?m:null==(t=E.result.fetched)?void 0:t.detail)?u:""})]}),E.result.missing.length>0&&(0,l.jsx)("p",{className:"small",children:f("startdlg.missing",{names:E.result.missing.join(", ")})}),(null==(r=E.result.fetched)?void 0:r.auth)&&(0,l.jsx)("p",{className:"small",children:f("prep.fetchAuth")}),(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("button",{type:"button",className:"primary",onClick:()=>void Q(),children:f("startdlg.retryFetch")}),(()=>{var e,t;let r=J(E.group.dir),n=null!=(t=null==r||null==(e=r.remotes.find(e=>e.name===E.group.remote))?void 0:e.branches)?t:[];return E.group.branches.every(e=>n.some(t=>t.name===e))?(0,l.jsx)("button",{type:"button",onClick:()=>{U.current.add(E.group.key),Q()},children:f("startdlg.useFetched")}):null})(),(0,l.jsx)("button",{type:"button",className:"quiet",onClick:$,children:f("startdlg.back")})]}),(()=>{var e,t;let r=J(E.group.dir),n=null!=(t=null==r||null==(e=r.remotes.find(e=>e.name===E.group.remote))?void 0:e.branches)?t:[],s=E.group.branches.filter(e=>!n.some(t=>t.name===e));return s.length>0?(0,l.jsx)("p",{className:"muted small",children:f("startdlg.useFetchedNo",{what:s.map(e=>"".concat(E.group.remote,"/").concat(e)).join(", ")})}):E.result.lastFetched?(0,l.jsx)("p",{className:"muted small",children:f("prep.lastFetched",{when:j(E.result.lastFetched)})}):null})(),E.result.fetchCommand&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{className:"small",style:{marginTop:8},children:f("prep.ownTerminal")}),(0,l.jsx)("pre",{className:"sync-cmd",children:E.result.fetchCommand}),(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("button",{type:"button",onClick:()=>{var e;ee(null!=(e=E.result.fetchCommand)?e:"")},children:f("prep.copyFetch")}),P&&(0,l.jsx)("span",{className:"badge done",children:f("prep.copied")})]})]})]}),"failed"===E.kind&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(o.X,{failure:E.reply.failure,reason:E.reply.reason}),(null==(d=E.reply.failure)?void 0:d.stage)==="preflight"&&A.some(e=>!e.ready)&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{className:"small",children:f("startdlg.vcsFix")}),(0,l.jsx)(i.w,{groups:A,sessionIds:p.sessionIds,onChange:()=>{Z(),X()}})]})]}),H&&(0,l.jsx)("p",{className:"err small",role:"alert",children:H}),"choose"===E.kind&&et&&(0,l.jsx)("p",{className:"why",children:f("prep.password")}),(0,l.jsxs)("div",{className:"row modal-actions",children:[(0,l.jsx)("button",{type:"button",className:"quiet",onClick:()=>K(!1),disabled:_,children:f("dialog.cancel")}),"failed"===E.kind?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{type:"button",onClick:$,children:f("startdlg.back")}),(0,l.jsx)("button",{type:"button",className:"primary",onClick:()=>void Q({skipFetch:!0}),children:f("startdlg.tryAgain")})]}):"fetchFailed"!==E.kind&&(0,l.jsx)("button",{ref:y,type:"button",className:"primary",onClick:()=>void Q(),disabled:_||!k,children:en})]})]})})}},3069:(e,t,r)=>{r.d(t,{StartFailureBanner:()=>h,X:()=>i});var l=r(3365),n=r(1521),s=r(5549),a=r(867),c=r(7527);function i(e){var t,r;let{failure:n,reason:c,onDismiss:i,intro:o,children:d}=e,{t:h}=(0,a.kj)(),m=(0,a.W3)(),u=null!=(r=null!=(t=null==n?void 0:n.message)?t:c)?r:"";return(0,l.jsxs)("div",{className:"notice caution start-failure",role:"alert",style:{overflowWrap:"anywhere"},children:[o&&(0,l.jsx)("p",{className:"small",style:{marginTop:0},children:o}),(0,l.jsx)("strong",{children:h("startfail.title")}),n&&(0,l.jsx)("p",{className:"small",style:{margin:"4px 0"},children:h("startfail.where",{stage:h("startfail.stage.".concat(n.stage))})}),(0,l.jsx)("pre",{className:"sync-cmd small",style:{margin:"6px 0"},children:u}),d,n&&(0,l.jsxs)("p",{className:"muted small",style:{margin:"4px 0"},children:[n.runId?h("startfail.when",{when:m(n.at),run:n.runId}):h("startfail.whenNoRun",{when:m(n.at)}),n.sessions.length>0?" \xb7 ".concat(n.sessions.map(e=>'"'.concat(e,'"')).join(", ")):""]}),(0,l.jsxs)("div",{className:"row",style:{marginTop:6},children:[n&&(0,l.jsx)("a",{className:"button-link",href:s.FH.startFailureUrl(n.id),download:!0,children:h("startfail.download")}),(0,l.jsx)("a",{className:n?"button-link":"button-link plain",href:s.FH.terminalUrl(),download:!0,children:h("startfail.terminal")}),i&&(0,l.jsx)("button",{type:"button",className:"quiet",onClick:i,children:h("startfail.dismiss")})]}),(0,l.jsx)("p",{className:"why",children:h("startfail.downloadWhy")})]})}let o="cop.startFailure.dismissed";function d(){try{var e;let t=JSON.parse(null!=(e=window.localStorage.getItem(o))?e:"[]");return Array.isArray(t)?t.filter(e=>"string"==typeof e):[]}catch(e){return[]}}function h(){let{t:e}=(0,a.kj)(),[t,r]=(0,n.useState)([]),[h,m]=(0,n.useState)([]);(0,c.z)(()=>s.FH.startFailures(!0).then(e=>{r(e),m(d())}).catch(()=>void 0),5e3);let u=t.find(e=>!h.includes(e.id));return u?(0,l.jsx)("div",{style:{marginBottom:12},children:(0,l.jsx)(i,{failure:u,intro:e("at-turn"===u.stage?"startfail.laterSession":"startfail.later"),onDismiss:()=>{let e=[...new Set([...d(),u.id])].slice(-50);try{window.localStorage.setItem(o,JSON.stringify(e))}catch(e){}m(e)}})}):null}},3486:(e,t,r)=>{r.d(t,{w:()=>i});var l=r(3365),n=r(1521),s=r(5549),a=r(867);let c={"review-inputs":"runvcs.review","snapshot-on-base":"runvcs.snapshotOnBase","snapshot-here":"runvcs.snapshotHere","use-current-branch":"runvcs.useCurrent","allow-snapshot":"runvcs.allowSnapshot"};function i(e){let{groups:t,sessionIds:r,onChange:s}=e,{t:c}=(0,a.kj)(),[i,d]=(0,n.useState)(""),h=t.filter(e=>!e.ready);return 0===h.length?i?(0,l.jsxs)("p",{className:"notice small",role:"status",children:[(0,l.jsx)("strong",{children:c("runvcs.ready")})," ",i]}):null:(0,l.jsxs)("section",{className:"notice caution","aria-labelledby":"runvcs-title",children:[(0,l.jsx)("h3",{id:"runvcs-title",style:{marginTop:0},children:c("runvcs.title")}),(0,l.jsx)("p",{className:"small",children:c("runvcs.why")}),h.map(e=>(0,l.jsx)(o,{group:e,sessionIds:r,onChange:s,onDone:d},e.repoDir))]})}function o(e){var t;let{group:r,sessionIds:i,onChange:o,onDone:d}=e,{t:h}=(0,a.kj)(),[m,u]=(0,n.useState)(!1),[p,x]=(0,n.useState)(!1),[g,f]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[b,y]=(0,n.useState)({}),k=(e,t)=>{var r,l;return null!=(l=null!=(r=b[e])?r:t)?l:void 0},w=r.actions.find(e=>"snapshot-here"===e.id&&e.available),N=e=>(null!=e?e:"—").slice(0,8),F=async e=>{if("review-inputs"===e)return void u(e=>!e);f(!0),v("");try{var t,l,n;let a="snapshot-on-base"===e?Object.fromEntries(r.inputs.map(e=>[e.path,"include"])):Object.fromEntries(r.entries.filter(e=>k(e.path,e.choice)).map(e=>[e.path,k(e.path,e.choice)])),c=await s.FH.runVcsPrepare(i,r.repoDir,e,a);v(c.ok?null!=(t=c.result)?t:"":null!=(l=c.problem)?l:""),c.ok&&d("".concat(r.repoDir,": ").concat(null!=(n=c.result)?n:"")),o()}catch(e){v(e.message)}finally{f(!1)}};return(0,l.jsxs)("div",{className:"option",style:{overflowWrap:"anywhere"},children:[(0,l.jsx)("table",{className:"small",children:(0,l.jsxs)("tbody",{children:[(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:h("runvcs.repo")}),(0,l.jsx)("td",{children:(0,l.jsx)("code",{children:r.repoDir})})]}),(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:h("runvcs.current")}),(0,l.jsxs)("td",{children:[(0,l.jsx)("code",{children:null!=(t=r.branch)?t:"HEAD"})," @ ",(0,l.jsx)("code",{children:N(r.head)})]})]}),r.workBranch&&(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:h("runvcs.workBranch")}),(0,l.jsxs)("td",{children:[(0,l.jsx)("code",{children:r.workBranch.name})," @ ",(0,l.jsx)("code",{children:N(r.workBranch.head)})]})]}),r.baseBranch&&(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:h("runvcs.base")}),(0,l.jsxs)("td",{children:[(0,l.jsx)("code",{children:r.baseBranch})," @ ",(0,l.jsx)("code",{children:N(r.baseHead)})]})]}),(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:h("runvcs.sessions")}),(0,l.jsx)("td",{children:r.sessions.map(e=>"".concat(e.name," (").concat(h("runvcs.role.".concat(e.role)),")")).join(", ")})]}),r.inputPatterns.length>0&&(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:h("runvcs.patterns")}),(0,l.jsx)("td",{children:r.inputPatterns.map(e=>(0,l.jsx)("code",{style:{marginRight:6},children:e},e))})]})]})}),r.problem&&(0,l.jsxs)("p",{className:"small",children:[(0,l.jsx)("strong",{children:h("runvcs.problem")})," ",r.problem]}),r.inputs.length>0&&(0,l.jsx)("p",{className:"small",children:h("runvcs.inputsCount",{n:r.inputs.length})}),m&&r.inputs.length>0&&(0,l.jsx)("ul",{className:"small",style:{margin:"4px 0"},children:r.inputs.map(e=>(0,l.jsxs)("li",{children:[(0,l.jsx)("code",{children:e.path})," — ",h("vcs.snapshotKind.".concat(e.kind)),void 0!==e.size?", ".concat((0,s.zi)(e.size)):"",0===e.allowed.length&&e.reason?(0,l.jsxs)("span",{className:"err",children:[" — ",e.reason]}):null]},e.path))}),r.unrelated.length>0&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{className:"small",children:(0,l.jsx)("strong",{children:h("runvcs.unrelated",{n:r.unrelated.length})})}),(0,l.jsx)("ul",{className:"small",style:{margin:"4px 0"},children:r.unrelated.slice(0,30).map(e=>(0,l.jsxs)("li",{children:[(0,l.jsx)("code",{children:e.path}),e.reason?" — ".concat(e.reason):""]},e.path))})]}),w&&r.entries.length>0&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{className:"small",children:(0,l.jsx)("strong",{children:h("runvcs.choose",{n:r.entries.length})})}),(0,l.jsx)("ul",{className:"small",style:{margin:"4px 0",paddingLeft:0,listStyle:"none"},children:r.entries.map(e=>{var t;return(0,l.jsxs)("li",{style:{marginBottom:4},children:[(0,l.jsx)("code",{children:e.path})," ",(0,l.jsxs)("span",{className:"muted",children:["(",e.input?"".concat(h("vcs.snapshotInput"),", "):"",h("vcs.snapshotKind.".concat(e.kind)),void 0!==e.size?", ".concat((0,s.zi)(e.size)):"",")"]})," ",0===e.allowed.length?(0,l.jsx)("span",{className:"err",children:h("vcs.snapshotBlocked")}):(0,l.jsx)("select",{"aria-label":e.path,value:null!=(t=k(e.path,e.choice))?t:"",onChange:t=>y({...b,[e.path]:t.target.value}),disabled:g||e.allowed.length<2,children:e.allowed.map(e=>(0,l.jsx)("option",{value:e,children:h("include"===e?"vcs.snapshotInclude":"vcs.snapshotLeaveOut")},e))}),e.reason&&(0,l.jsx)("div",{className:"muted",children:e.reason})]},e.path)})})]}),p?(0,l.jsxs)("p",{className:"small muted",children:[h("runvcs.cancelled")," ",(0,l.jsx)("button",{className:"quiet",onClick:()=>x(!1),children:h("runvcs.showAgain")})]}):(0,l.jsxs)("div",{children:[r.actions.map(e=>{var t,n,s;return(0,l.jsxs)("div",{style:{marginTop:8},children:[(0,l.jsxs)("button",{className:e.recommended?"primary":void 0,onClick:()=>void F(e.id),disabled:g||!e.available,children:[h(c[e.id],{branch:null!=(t=r.baseBranch)?t:"",current:null!=(n=r.branch)?n:"HEAD"}),"review-inputs"===e.id&&m?" ✓":""]}),e.recommended&&(0,l.jsx)("span",{className:"badge done",style:{marginLeft:6},children:h("runvcs.recommended")}),(0,l.jsx)("p",{className:"why",children:e.available?e.result:"".concat(h("runvcs.notNow")," ").concat(null!=(s=e.why)?s:"")})]},e.id)}),(0,l.jsxs)("div",{style:{marginTop:8},children:[(0,l.jsx)("button",{className:"quiet",onClick:()=>x(!0),disabled:g,children:h("runvcs.cancel")}),(0,l.jsx)("p",{className:"why",children:h("runvcs.cancelWhy")})]})]}),j&&(0,l.jsx)("p",{className:"small",role:"status",children:j})]})}},4969:(e,t,r)=>{r.d(t,{V:()=>s});var l=r(1521);let n='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function s(e,t,r){(0,l.useEffect)(()=>{var l,s;if(!t)return;let a=document.activeElement instanceof HTMLElement?document.activeElement:null,c=e.current,i=null!=(s=null!=(l=null==r?void 0:r.current)?l:null==c?void 0:c.querySelector(n))?s:null;null==i||i.focus();let o=e=>{if("Tab"!==e.key||!c)return;let t=Array.from(c.querySelectorAll(n)).filter(e=>null!==e.offsetParent);if(0===t.length)return;let r=t[0],l=t[t.length-1],s=c.contains(document.activeElement);e.shiftKey&&(document.activeElement===r||!s)?(e.preventDefault(),l.focus()):e.shiftKey||document.activeElement!==l&&s||(e.preventDefault(),r.focus())};return document.addEventListener("keydown",o),()=>{document.removeEventListener("keydown",o),a&&document.contains(a)&&a.focus()}},[e,t,r])}},7527:(e,t,r)=>{r.d(t,{z:()=>n});var l=r(1521);function n(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=(0,l.useRef)(e);n.current=e,(0,l.useEffect)(()=>{let e;if(!r)return;let l=!1,s=async()=>{try{await n.current()}catch(e){}finally{l||(e=setTimeout(()=>void s(),t))}};return s(),()=>{l=!0,e&&clearTimeout(e)}},[t,r])}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[549],{5549:(t,e,o)=>{o.d(e,{AV:()=>a,Dh:()=>m,FH:()=>p,FZ:()=>r,Zm:()=>u,aT:()=>s,c5:()=>f,dK:()=>l,nC:()=>n,rt:()=>d,ub:()=>i,zi:()=>y});let n="/api";function s(t,e){return"/sessions/view?id=".concat(encodeURIComponent(t)).concat(e?"#".concat(e):"")}let c="cop-api-token";function a(){try{let t=/(?:^#|&)token=([0-9a-f]{16,})/i.exec(window.location.hash);if(t)return window.localStorage.setItem(c,t[1]),window.history.replaceState(null,"",window.location.pathname+window.location.search),t[1];return window.localStorage.getItem(c)||""}catch(t){return""}}function i(t){let e=a();return e?"".concat(t).concat(t.includes("?")?"&":"?","token=").concat(encodeURIComponent(e)):t}let r=["exit-zero","exit-nonzero","output-contains","output-omits","output-matches","file-exists","file-missing","file-contains"];function d(t){return t.startsWith("exit-")||t.startsWith("output-")}function l(t){return"output-contains"===t||"output-omits"===t||"output-matches"===t||"file-contains"===t}function u(t){return"limit-reached"===t.status||"aborted"===t.status||!!t.limit&&("failed"===t.status||"blocked"===t.status)}function m(t){return("failed"===t.status||"blocked"===t.status)&&"contract-conflict"!==t.stopCode}async function h(t,e){let o,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=void 0===s.timeoutMs?3e4:s.timeoutMs;try{var i;o=await fetch("".concat(n).concat(t),{...e,...null!==c&&!(null==e?void 0:e.signal)?{signal:AbortSignal.timeout(c)}:{},headers:{"content-type":"application/json",...a()?{"x-cop-token":a()}:{},...null!=(i=null==e?void 0:e.headers)?i:{}}})}catch(e){if("TimeoutError"===e.name)throw Error("The API did not answer within ".concat(Math.round((null!=c?c:0)/1e3)," s (").concat(t.split("?")[0],"). It may be busy; try again."));throw e}if(!o.ok){let t="".concat(o.status," ").concat(o.statusText);try{let e=await o.json();(null==e?void 0:e.message)&&(t=Array.isArray(e.message)?e.message.join("; "):e.message)}catch(t){}throw Error(t)}let r=await o.text();return r?JSON.parse(r):void 0}let p={health:()=>h("/health"),doctor:()=>h("/doctor"),settings:()=>h("/settings"),saveSettings:t=>h("/settings",{method:"PUT",body:JSON.stringify(t)}),level1:()=>h("/level1"),setLevel1:t=>h("/level1",{method:"PUT",body:JSON.stringify({content:t})}),resetLevel1:()=>h("/level1",{method:"DELETE"}),presets:()=>h("/presets"),savePreset:(t,e)=>h("/presets/".concat(encodeURIComponent(t)),{method:"PUT",body:JSON.stringify({content:e})}),deletePreset:t=>h("/presets/".concat(encodeURIComponent(t)),{method:"DELETE"}),personas:()=>h("/personas"),savePersona:(t,e)=>h("/personas/".concat(encodeURIComponent(t)),{method:"PUT",body:JSON.stringify({content:e})}),deletePersona:t=>h("/personas/".concat(encodeURIComponent(t)),{method:"DELETE"}),sessions:()=>h("/sessions"),reorderSessions:t=>h("/sessions-order",{method:"PUT",body:JSON.stringify({ids:t})}),metrics:()=>h("/metrics"),preparePreview:function(t){let e=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return h("/repo/prepare/preview",{method:"POST",body:JSON.stringify({dir:t,fetch:e})},{timeoutMs:33e4})},prepareProject:function(t,e){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return h("/repo/prepare",{method:"POST",body:JSON.stringify({dir:t,fingerprint:e,...o})})},session:t=>h("/sessions/".concat(t)),createSession:(t,e)=>h("/sessions",{method:"POST",body:JSON.stringify({name:t,projectDir:e})}),updateSession:(t,e)=>h("/sessions/".concat(t),{method:"PUT",body:JSON.stringify(e)}),deleteSession:t=>h("/sessions/".concat(t),{method:"DELETE"}),addTask:(t,e)=>h("/sessions/".concat(t,"/tasks"),{method:"POST",body:JSON.stringify(e)}),updateTask:(t,e,o)=>h("/sessions/".concat(t,"/tasks/").concat(e),{method:"PUT",body:JSON.stringify(o)}),deleteTask:(t,e)=>h("/sessions/".concat(t,"/tasks/").concat(e),{method:"DELETE"}),continueTask:(t,e,o)=>h("/sessions/".concat(t,"/tasks/").concat(e,"/continue"),{method:"POST",body:JSON.stringify((null==o?void 0:o.trim())?{instruction:o}:{})}),rerunTask:function(t,e){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return h("/sessions/".concat(t,"/tasks/").concat(e,"/rerun"),{method:"POST",body:JSON.stringify({...o,...n.buildOnFinished?{buildOnFinished:!0}:{}})})},taskChanges:(t,e,o)=>h("/sessions/".concat(t,"/tasks/").concat(e,"/changes").concat(o?"?run=".concat(encodeURIComponent(o)):"")),taskChangeFile:(t,e,o,n)=>h("/sessions/".concat(t,"/tasks/").concat(e,"/changes/file?path=").concat(encodeURIComponent(o)).concat(n?"&run=".concat(encodeURIComponent(n)):"")),taskStory:(t,e,o)=>h("/sessions/".concat(t,"/tasks/").concat(e,"/story").concat(o?"?run=".concat(encodeURIComponent(o)):"")),taskFiles:(t,e,o)=>h("/sessions/".concat(t,"/tasks/").concat(e,"/files").concat(o?"?run=".concat(encodeURIComponent(o)):"")),taskLogUrl:(t,e,o)=>"".concat(n,"/sessions/").concat(t,"/tasks/").concat(e,"/log").concat(o?"?run=".concat(encodeURIComponent(o)):""),taskFileUrl:(t,e,o,s,c)=>"".concat(n,"/sessions/").concat(t,"/tasks/").concat(e,"/files/").concat(o,"/").concat(encodeURIComponent(s)).concat(c?"?run=".concat(encodeURIComponent(c)):""),saveTaskLog:(t,e,o)=>h("/sessions/".concat(t,"/tasks/").concat(e,"/log").concat(o?"?run=".concat(encodeURIComponent(o)):""),{method:"POST",body:"{}"}),saveTaskFile:(t,e,o,n,s)=>h("/sessions/".concat(t,"/tasks/").concat(e,"/files/").concat(o,"/").concat(encodeURIComponent(n)).concat(s?"?run=".concat(encodeURIComponent(s)):""),{method:"POST",body:"{}"}),start:(t,e,o,n)=>h("/sessions/".concat(t,"/start"),{method:"POST",body:JSON.stringify({mode:e,name:o,starts:n})},{timeoutMs:12e4}),startOptions:t=>h("/start/options?sessions=".concat(encodeURIComponent(t.join(",")))),startFetch:(t,e,o)=>h("/start/fetch",{method:"POST",body:JSON.stringify({dir:t,remote:e,...o?{branches:o}:{}})},{timeoutMs:33e4}),startFailures:function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return h("/start/failures".concat(t?"?unanswered=1":""))},startFailureUrl:t=>i("".concat(n,"/start/failures/").concat(encodeURIComponent(t),"/report")),terminalUrl:()=>i("".concat(n,"/terminal")),stop:t=>h("/sessions/".concat(t,"/stop"),{method:"POST",body:"{}"}),approvals:t=>h("/approvals".concat(t?"?session=".concat(encodeURIComponent(t)):"")),decidePlan:(t,e,o)=>h("/approvals/".concat(t,"/plan"),{method:"POST",body:JSON.stringify({action:e,...(null==o?void 0:o.trim())?{note:o}:{}})}),decide:(t,e)=>h("/approvals/".concat(t),{method:"POST",body:JSON.stringify({action:e})}),setRunMode:(t,e)=>h("/sessions/".concat(t,"/mode"),{method:"POST",body:JSON.stringify({mode:e})}),streamUrl:t=>i("".concat(n,"/sessions/").concat(t,"/stream")),batch:()=>h("/batch").then(t=>null!=t?t:null),startBatch:(t,e,o,n,s,c,a,i)=>h("/batch/start",{method:"POST",body:JSON.stringify({sessionIds:t,mode:e,onFailure:o,model:n,reviewModel:s,name:c,taskIds:a,starts:i})},{timeoutMs:12e4}),suggestedRunName:t=>h("/batch/name?sessions=".concat(encodeURIComponent(t.join(",")))),stopBatch:()=>h("/batch/stop",{method:"POST",body:"{}"}),pauseBatch:()=>h("/batch/pause",{method:"POST",body:"{}"}),resumeBatch:()=>h("/batch/resume",{method:"POST",body:"{}"}),planBrief:t=>h("/plan/brief?lang=".concat(encodeURIComponent(t))),context:(t,e)=>h("/context/".concat(t,"?lang=").concat(encodeURIComponent(e))),setContext:(t,e)=>h("/context/".concat(t),{method:"PUT",body:JSON.stringify({content:e})}),resetContext:(t,e)=>h("/context/".concat(t,"?lang=").concat(encodeURIComponent(e)),{method:"DELETE"}),checkPlan:t=>h("/plan/check",{method:"POST",body:JSON.stringify({text:t})}),importPlan:t=>h("/plan/import",{method:"POST",body:JSON.stringify({text:t})}),browseFolder:t=>h("/browse-folder",{method:"POST",body:JSON.stringify({start:t})},{timeoutMs:null}),tasks:()=>h("/tasks"),activity:()=>h("/activity"),downloadBundle:async t=>{var e,o,s;let c=await fetch("".concat(n,"/export/bundle"),{method:"POST",headers:{"content-type":"application/json",...a()?{"x-cop-token":a()}:{}},body:JSON.stringify({tasks:t})});if(!c.ok)throw Error(await c.text()||"".concat(c.status," ").concat(c.statusText));let i=null!=(s=c.headers.get("content-disposition"))?s:"",r=null==(e=/filename\*=UTF-8''([^;]+)/i.exec(i))?void 0:e[1],d=null==(o=/filename="([^"]+)"/i.exec(i))?void 0:o[1],l=null!=d?d:"copilot-operator-bundle.json";if(r)try{l=decodeURIComponent(r)}catch(t){}let u=URL.createObjectURL(await c.blob()),m=document.createElement("a");return m.href=u,m.download=l,document.body.appendChild(m),m.click(),m.remove(),setTimeout(()=>URL.revokeObjectURL(u),1e4),l},exportUrl:(t,e)=>{let o=new URLSearchParams;return e.run&&o.set("run",e.run),e.session&&o.set("session",e.session),e.task&&o.set("task",e.task),i("".concat(n,"/export/").concat(t,"?").concat(o.toString()))},debugExportUrl:t=>i("".concat(n,"/debug/export").concat(t.length>0?"?sessions=".concat(encodeURIComponent(t.join(","))):"")),vcsStatus:t=>h("/sessions/".concat(t,"/vcs")),runVcs:t=>h("/batch/vcs?ids=".concat(encodeURIComponent(t.join(",")))),runVcsPrepare:function(t,e,o){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return h("/batch/vcs/prepare",{method:"POST",body:JSON.stringify({sessionIds:t,repoDir:e,action:o,choices:n})})},vcsSnapshot:(t,e)=>h("/sessions/".concat(t,"/vcs/snapshot"),{method:"POST",body:JSON.stringify({choices:e})}),restorePreview:(t,e)=>h("/sessions/".concat(t,"/tasks/").concat(e,"/restore")),restore:(t,e)=>h("/sessions/".concat(t,"/tasks/").concat(e,"/restore"),{method:"POST",body:"{}"}),contractCheck:(t,e)=>h("/sessions/".concat(t,"/tasks/").concat(e,"/contract")),applyContractFix:(t,e,o,n)=>h("/sessions/".concat(t,"/tasks/").concat(e,"/contract-fix"),{method:"POST",body:JSON.stringify({choices:o,expect:n})}),restartPlan:(t,e)=>h("/sessions/".concat(t,"/tasks/").concat(e,"/restart")),restartFrom:function(t,e){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return h("/sessions/".concat(t,"/tasks/").concat(e,"/restart"),{method:"POST",body:JSON.stringify(o)})},repoCheck:t=>h("/repo?dir=".concat(encodeURIComponent(t))),project:()=>h("/project"),setProject:t=>h("/project",{method:"PUT",body:JSON.stringify(t)}),models:()=>h("/models"),setDefaultModel:t=>h("/models/default",{method:"PUT",body:JSON.stringify({model:t})}),setDefaultReviewModel:t=>h("/models/review-default",{method:"PUT",body:JSON.stringify({model:t})}),refreshModels:()=>h("/models/refresh",{method:"POST",body:"{}"},{timeoutMs:null}),login:t=>h("/login",{method:"POST",body:JSON.stringify({account:(null==t?void 0:t.trim())||void 0})},{timeoutMs:null})};function y(t){return t<1024?"".concat(t," B"):t<1048576?"".concat((t/1024).toFixed(1)," KB"):"".concat((t/1048576).toFixed(1)," MB")}function f(t){if(void 0===t)return"";let e=Math.round(t/1e3);if(e<60)return"".concat(e,"s");let o=Math.floor(e/60);return o<60?"".concat(o,"m ").concat(e%60,"s"):"".concat(Math.floor(o/60),"h ").concat(o%60,"m")}}}]);
|