copilot-operator 0.1.44 → 0.1.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/src/api/operator.controller.js +24 -1
  2. package/dist/src/api/operator.service.js +73 -14
  3. package/dist/src/config/schema.js +18 -0
  4. package/dist/src/orchestrator/taskRunner.js +50 -2
  5. package/dist/src/plan/systemGuide.js +26 -2
  6. package/dist/src/session/checkpoint.js +91 -0
  7. package/dist/src/session/store.js +2 -0
  8. package/dist/web/404.html +2 -2
  9. package/dist/web/_next/static/chunks/{549-1fe42544e4b72942.js → 549-13aab16a40600608.js} +1 -1
  10. package/dist/web/_next/static/chunks/867-88233b4570638286.js +1 -0
  11. package/dist/web/_next/static/chunks/app/page-b51630404f5eba03.js +1 -0
  12. package/dist/web/_next/static/css/{eaec9cc6fe8aceb7.css → 70ceb261074b139c.css} +1 -1
  13. package/dist/web/appearance.html +2 -2
  14. package/dist/web/appearance.txt +10 -10
  15. package/dist/web/defaults.html +2 -2
  16. package/dist/web/defaults.txt +10 -10
  17. package/dist/web/history.html +2 -2
  18. package/dist/web/history.txt +10 -10
  19. package/dist/web/import.html +2 -2
  20. package/dist/web/import.txt +10 -10
  21. package/dist/web/index.html +2 -2
  22. package/dist/web/index.txt +10 -10
  23. package/dist/web/level1.html +2 -2
  24. package/dist/web/level1.txt +10 -10
  25. package/dist/web/presets.html +2 -2
  26. package/dist/web/presets.txt +10 -10
  27. package/dist/web/sessions/view.html +2 -2
  28. package/dist/web/sessions/view.txt +10 -10
  29. package/dist/web/sessions.html +2 -2
  30. package/dist/web/sessions.txt +10 -10
  31. package/dist/web/system.html +2 -2
  32. package/dist/web/system.txt +10 -10
  33. package/package.json +1 -1
  34. package/dist/web/_next/static/chunks/867-0f0f8c3bd37be31e.js +0 -1
  35. package/dist/web/_next/static/chunks/app/page-09c6e2d42098f8d4.js +0 -1
  36. /package/dist/web/_next/static/{BX8Nw248DTY9xAfUu2pOH → L6g_c8hW3p_AUNzreQ3Sj}/_buildManifest.js +0 -0
  37. /package/dist/web/_next/static/{BX8Nw248DTY9xAfUu2pOH → L6g_c8hW3p_AUNzreQ3Sj}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[549],{5549:(t,o,e)=>{e.d(o,{AV:()=>a,Dh:()=>h,FH:()=>m,FZ:()=>r,Zm:()=>u,aT:()=>s,c5:()=>f,dK:()=>l,nC:()=>n,rt:()=>d,ub:()=>i,zi:()=>y});let n="/api";function s(t,o){return"/sessions/view?id=".concat(encodeURIComponent(t)).concat(o?"#".concat(o):"")}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 o=a();return o?"".concat(t).concat(t.includes("?")?"&":"?","token=").concat(encodeURIComponent(o)):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 h(t){return("failed"===t.status||"blocked"===t.status)&&"contract-conflict"!==t.stopCode}async function p(t,o){let e,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=void 0===s.timeoutMs?3e4:s.timeoutMs;try{var i;e=await fetch("".concat(n).concat(t),{...o,...null!==c&&!(null==o?void 0:o.signal)?{signal:AbortSignal.timeout(c)}:{},headers:{"content-type":"application/json",...a()?{"x-cop-token":a()}:{},...null!=(i=null==o?void 0:o.headers)?i:{}}})}catch(o){if("TimeoutError"===o.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 o}if(!e.ok){let t="".concat(e.status," ").concat(e.statusText);try{let o=await e.json();(null==o?void 0:o.message)&&(t=Array.isArray(o.message)?o.message.join("; "):o.message)}catch(t){}throw Error(t)}let r=await e.text();return r?JSON.parse(r):void 0}let m={health:()=>p("/health"),doctor:()=>p("/doctor"),settings:()=>p("/settings"),saveSettings:t=>p("/settings",{method:"PUT",body:JSON.stringify(t)}),level1:()=>p("/level1"),setLevel1:t=>p("/level1",{method:"PUT",body:JSON.stringify({content:t})}),resetLevel1:()=>p("/level1",{method:"DELETE"}),presets:()=>p("/presets"),savePreset:(t,o)=>p("/presets/".concat(encodeURIComponent(t)),{method:"PUT",body:JSON.stringify({content:o})}),deletePreset:t=>p("/presets/".concat(encodeURIComponent(t)),{method:"DELETE"}),personas:()=>p("/personas"),savePersona:(t,o)=>p("/personas/".concat(encodeURIComponent(t)),{method:"PUT",body:JSON.stringify({content:o})}),deletePersona:t=>p("/personas/".concat(encodeURIComponent(t)),{method:"DELETE"}),sessions:()=>p("/sessions"),reorderSessions:t=>p("/sessions-order",{method:"PUT",body:JSON.stringify({ids:t})}),metrics:()=>p("/metrics"),preparePreview:function(t){let o=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return p("/repo/prepare/preview",{method:"POST",body:JSON.stringify({dir:t,fetch:o})},{timeoutMs:33e4})},prepareProject:function(t,o){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return p("/repo/prepare",{method:"POST",body:JSON.stringify({dir:t,fingerprint:o,...e})})},session:t=>p("/sessions/".concat(t)),createSession:(t,o)=>p("/sessions",{method:"POST",body:JSON.stringify({name:t,projectDir:o})}),updateSession:(t,o)=>p("/sessions/".concat(t),{method:"PUT",body:JSON.stringify(o)}),deleteSession:t=>p("/sessions/".concat(t),{method:"DELETE"}),addTask:(t,o)=>p("/sessions/".concat(t,"/tasks"),{method:"POST",body:JSON.stringify(o)}),updateTask:(t,o,e)=>p("/sessions/".concat(t,"/tasks/").concat(o),{method:"PUT",body:JSON.stringify(e)}),deleteTask:(t,o)=>p("/sessions/".concat(t,"/tasks/").concat(o),{method:"DELETE"}),continueTask:(t,o,e)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/continue"),{method:"POST",body:JSON.stringify((null==e?void 0:e.trim())?{instruction:e}:{})}),rerunTask:function(t,o){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return p("/sessions/".concat(t,"/tasks/").concat(o,"/rerun"),{method:"POST",body:JSON.stringify({...e,...n.buildOnFinished?{buildOnFinished:!0}:{}})})},taskChanges:(t,o,e)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/changes").concat(e?"?run=".concat(encodeURIComponent(e)):"")),taskChangeFile:(t,o,e,n)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/changes/file?path=").concat(encodeURIComponent(e)).concat(n?"&run=".concat(encodeURIComponent(n)):"")),taskStory:(t,o,e)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/story").concat(e?"?run=".concat(encodeURIComponent(e)):"")),taskFiles:(t,o,e)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/files").concat(e?"?run=".concat(encodeURIComponent(e)):"")),taskLogUrl:(t,o,e)=>"".concat(n,"/sessions/").concat(t,"/tasks/").concat(o,"/log").concat(e?"?run=".concat(encodeURIComponent(e)):""),taskFileUrl:(t,o,e,s,c)=>"".concat(n,"/sessions/").concat(t,"/tasks/").concat(o,"/files/").concat(e,"/").concat(encodeURIComponent(s)).concat(c?"?run=".concat(encodeURIComponent(c)):""),saveTaskLog:(t,o,e)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/log").concat(e?"?run=".concat(encodeURIComponent(e)):""),{method:"POST",body:"{}"}),saveTaskFile:(t,o,e,n,s)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/files/").concat(e,"/").concat(encodeURIComponent(n)).concat(s?"?run=".concat(encodeURIComponent(s)):""),{method:"POST",body:"{}"}),start:(t,o,e,n)=>p("/sessions/".concat(t,"/start"),{method:"POST",body:JSON.stringify({mode:o,name:e,starts:n})},{timeoutMs:12e4}),startOptions:t=>p("/start/options?sessions=".concat(encodeURIComponent(t.join(",")))),startFetch:(t,o,e)=>p("/start/fetch",{method:"POST",body:JSON.stringify({dir:t,remote:o,...e?{branches:e}:{}})},{timeoutMs:33e4}),startFailures:function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return p("/start/failures".concat(t?"?unanswered=1":""))},startFailureUrl:t=>i("".concat(n,"/start/failures/").concat(encodeURIComponent(t),"/report")),terminalUrl:()=>i("".concat(n,"/terminal")),stop:t=>p("/sessions/".concat(t,"/stop"),{method:"POST",body:"{}"}),approvals:t=>p("/approvals".concat(t?"?session=".concat(encodeURIComponent(t)):"")),undoPreview:(t,o)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/undo")),undoTask:(t,o,e)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/undo"),{method:"POST",body:JSON.stringify({how:e})}),acceptTask:(t,o,e)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/accept"),{method:"POST",body:JSON.stringify((null==e?void 0:e.trim())?{note:e}:{})}),addTaskNote:(t,o,e)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/notes"),{method:"POST",body:JSON.stringify({text:e})}),kerriganReport:t=>p("/kerrigan/report",{method:"POST",body:JSON.stringify(t)}),checkChanges:t=>p("/changes/check",{method:"POST",body:JSON.stringify({text:t})}),applyChanges:t=>p("/changes/apply",{method:"POST",body:JSON.stringify({text:t})}),workspace:()=>p("/workspace"),workspaceFiles:()=>p("/workspace/files"),workspaceFile:t=>p("/workspace/file?path=".concat(encodeURIComponent(t))),chatThreads:()=>p("/chat/threads"),chatSend:(t,o)=>p("/chat",{method:"POST",body:JSON.stringify({text:t,...o?{threadId:o}:{}})}),repoTree:function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",e=arguments.length>2?arguments[2]:void 0;return p("/sessions/".concat(t,"/repo/tree?path=").concat(encodeURIComponent(o)).concat(e?"&task=".concat(encodeURIComponent(e)):""))},repoFile:(t,o,e)=>p("/sessions/".concat(t,"/repo/file?path=").concat(encodeURIComponent(o)).concat(e?"&task=".concat(encodeURIComponent(e)):"")),repoLog:t=>p("/sessions/".concat(t,"/repo/log")),sessionEvents:t=>p("/sessions/".concat(t,"/events")),decidePlan:(t,o,e)=>p("/approvals/".concat(t,"/plan"),{method:"POST",body:JSON.stringify({action:o,...(null==e?void 0:e.trim())?{note:e}:{}})}),decide:(t,o)=>p("/approvals/".concat(t),{method:"POST",body:JSON.stringify({action:o})}),setRunMode:(t,o)=>p("/sessions/".concat(t,"/mode"),{method:"POST",body:JSON.stringify({mode:o})}),streamUrl:t=>i("".concat(n,"/sessions/").concat(t,"/stream")),batch:()=>p("/batch").then(t=>null!=t?t:null),startBatch:(t,o,e,n,s,c,a,i)=>p("/batch/start",{method:"POST",body:JSON.stringify({sessionIds:t,mode:o,onFailure:e,model:n,reviewModel:s,name:c,taskIds:a,starts:i})},{timeoutMs:12e4}),suggestedRunName:t=>p("/batch/name?sessions=".concat(encodeURIComponent(t.join(",")))),stopBatch:()=>p("/batch/stop",{method:"POST",body:"{}"}),pauseBatch:()=>p("/batch/pause",{method:"POST",body:"{}"}),resumeBatch:()=>p("/batch/resume",{method:"POST",body:"{}"}),planBrief:t=>p("/plan/brief?lang=".concat(encodeURIComponent(t))),context:(t,o)=>p("/context/".concat(t,"?lang=").concat(encodeURIComponent(o))),setContext:(t,o)=>p("/context/".concat(t),{method:"PUT",body:JSON.stringify({content:o})}),resetContext:(t,o)=>p("/context/".concat(t,"?lang=").concat(encodeURIComponent(o)),{method:"DELETE"}),checkPlan:t=>p("/plan/check",{method:"POST",body:JSON.stringify({text:t})}),importPlan:t=>p("/plan/import",{method:"POST",body:JSON.stringify({text:t})}),browseFolder:t=>p("/browse-folder",{method:"POST",body:JSON.stringify({start:t})},{timeoutMs:null}),tasks:()=>p("/tasks"),activity:()=>p("/activity"),downloadBundle:async t=>{var o,e,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==(o=/filename\*=UTF-8''([^;]+)/i.exec(i))?void 0:o[1],d=null==(e=/filename="([^"]+)"/i.exec(i))?void 0:e[1],l=null!=d?d:"copilot-operator-bundle.json";if(r)try{l=decodeURIComponent(r)}catch(t){}let u=URL.createObjectURL(await c.blob()),h=document.createElement("a");return h.href=u,h.download=l,document.body.appendChild(h),h.click(),h.remove(),setTimeout(()=>URL.revokeObjectURL(u),1e4),l},exportUrl:(t,o)=>{let e=new URLSearchParams;return o.run&&e.set("run",o.run),o.session&&e.set("session",o.session),o.task&&e.set("task",o.task),i("".concat(n,"/export/").concat(t,"?").concat(e.toString()))},debugExportUrl:t=>i("".concat(n,"/debug/export").concat(t.length>0?"?sessions=".concat(encodeURIComponent(t.join(","))):"")),vcsStatus:t=>p("/sessions/".concat(t,"/vcs")),runVcs:t=>p("/batch/vcs?ids=".concat(encodeURIComponent(t.join(",")))),runVcsPrepare:function(t,o,e){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return p("/batch/vcs/prepare",{method:"POST",body:JSON.stringify({sessionIds:t,repoDir:o,action:e,choices:n})})},vcsSnapshot:(t,o)=>p("/sessions/".concat(t,"/vcs/snapshot"),{method:"POST",body:JSON.stringify({choices:o})}),restorePreview:(t,o)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/restore")),restore:(t,o)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/restore"),{method:"POST",body:"{}"}),contractCheck:(t,o)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/contract")),applyContractFix:(t,o,e,n)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/contract-fix"),{method:"POST",body:JSON.stringify({choices:e,expect:n})}),restartPlan:(t,o)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/restart")),restartFrom:function(t,o){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return p("/sessions/".concat(t,"/tasks/").concat(o,"/restart"),{method:"POST",body:JSON.stringify(e)})},repoCheck:t=>p("/repo?dir=".concat(encodeURIComponent(t))),project:()=>p("/project"),setProject:t=>p("/project",{method:"PUT",body:JSON.stringify(t)}),models:()=>p("/models"),setDefaultModel:t=>p("/models/default",{method:"PUT",body:JSON.stringify({model:t})}),setDefaultReviewModel:t=>p("/models/review-default",{method:"PUT",body:JSON.stringify({model:t})}),refreshModels:()=>p("/models/refresh",{method:"POST",body:"{}"},{timeoutMs:null}),login:t=>p("/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 o=Math.round(t/1e3);if(o<60)return"".concat(o,"s");let e=Math.floor(o/60);return e<60?"".concat(e,"m ").concat(o%60,"s"):"".concat(Math.floor(e/60),"h ").concat(e%60,"m")}}}]);
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[549],{5549:(t,o,e)=>{e.d(o,{AV:()=>a,Dh:()=>u,FH:()=>m,FZ:()=>r,Zm:()=>h,aT:()=>s,c5:()=>f,dK:()=>l,nC:()=>n,rt:()=>d,ub:()=>i,zi:()=>y});let n="/api";function s(t,o){return"/sessions/view?id=".concat(encodeURIComponent(t)).concat(o?"#".concat(o):"")}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 o=a();return o?"".concat(t).concat(t.includes("?")?"&":"?","token=").concat(encodeURIComponent(o)):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 h(t){return"limit-reached"===t.status||"aborted"===t.status||!!t.limit&&("failed"===t.status||"blocked"===t.status)}function u(t){return("failed"===t.status||"blocked"===t.status)&&"contract-conflict"!==t.stopCode}async function p(t,o){let e,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=void 0===s.timeoutMs?3e4:s.timeoutMs;try{var i;e=await fetch("".concat(n).concat(t),{...o,...null!==c&&!(null==o?void 0:o.signal)?{signal:AbortSignal.timeout(c)}:{},headers:{"content-type":"application/json",...a()?{"x-cop-token":a()}:{},...null!=(i=null==o?void 0:o.headers)?i:{}}})}catch(o){if("TimeoutError"===o.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 o}if(!e.ok){let t="".concat(e.status," ").concat(e.statusText);try{let o=await e.json();(null==o?void 0:o.message)&&(t=Array.isArray(o.message)?o.message.join("; "):o.message)}catch(t){}throw Error(t)}let r=await e.text();return r?JSON.parse(r):void 0}let m={health:()=>p("/health"),doctor:()=>p("/doctor"),settings:()=>p("/settings"),saveSettings:t=>p("/settings",{method:"PUT",body:JSON.stringify(t)}),level1:()=>p("/level1"),setLevel1:t=>p("/level1",{method:"PUT",body:JSON.stringify({content:t})}),resetLevel1:()=>p("/level1",{method:"DELETE"}),presets:()=>p("/presets"),savePreset:(t,o)=>p("/presets/".concat(encodeURIComponent(t)),{method:"PUT",body:JSON.stringify({content:o})}),deletePreset:t=>p("/presets/".concat(encodeURIComponent(t)),{method:"DELETE"}),personas:()=>p("/personas"),savePersona:(t,o)=>p("/personas/".concat(encodeURIComponent(t)),{method:"PUT",body:JSON.stringify({content:o})}),deletePersona:t=>p("/personas/".concat(encodeURIComponent(t)),{method:"DELETE"}),sessions:()=>p("/sessions"),reorderSessions:t=>p("/sessions-order",{method:"PUT",body:JSON.stringify({ids:t})}),metrics:()=>p("/metrics"),preparePreview:function(t){let o=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return p("/repo/prepare/preview",{method:"POST",body:JSON.stringify({dir:t,fetch:o})},{timeoutMs:33e4})},prepareProject:function(t,o){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return p("/repo/prepare",{method:"POST",body:JSON.stringify({dir:t,fingerprint:o,...e})})},session:t=>p("/sessions/".concat(t)),createSession:(t,o)=>p("/sessions",{method:"POST",body:JSON.stringify({name:t,projectDir:o})}),updateSession:(t,o)=>p("/sessions/".concat(t),{method:"PUT",body:JSON.stringify(o)}),deleteSession:t=>p("/sessions/".concat(t),{method:"DELETE"}),addTask:(t,o)=>p("/sessions/".concat(t,"/tasks"),{method:"POST",body:JSON.stringify(o)}),updateTask:(t,o,e)=>p("/sessions/".concat(t,"/tasks/").concat(o),{method:"PUT",body:JSON.stringify(e)}),deleteTask:(t,o)=>p("/sessions/".concat(t,"/tasks/").concat(o),{method:"DELETE"}),continueTask:(t,o,e)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/continue"),{method:"POST",body:JSON.stringify((null==e?void 0:e.trim())?{instruction:e}:{})}),rerunTask:function(t,o){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return p("/sessions/".concat(t,"/tasks/").concat(o,"/rerun"),{method:"POST",body:JSON.stringify({...e,...n.buildOnFinished?{buildOnFinished:!0}:{}})})},taskChanges:(t,o,e)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/changes").concat(e?"?run=".concat(encodeURIComponent(e)):"")),taskChangeFile:(t,o,e,n)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/changes/file?path=").concat(encodeURIComponent(e)).concat(n?"&run=".concat(encodeURIComponent(n)):"")),taskStory:(t,o,e)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/story").concat(e?"?run=".concat(encodeURIComponent(e)):"")),taskFiles:(t,o,e)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/files").concat(e?"?run=".concat(encodeURIComponent(e)):"")),taskLogUrl:(t,o,e)=>"".concat(n,"/sessions/").concat(t,"/tasks/").concat(o,"/log").concat(e?"?run=".concat(encodeURIComponent(e)):""),taskFileUrl:(t,o,e,s,c)=>"".concat(n,"/sessions/").concat(t,"/tasks/").concat(o,"/files/").concat(e,"/").concat(encodeURIComponent(s)).concat(c?"?run=".concat(encodeURIComponent(c)):""),saveTaskLog:(t,o,e)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/log").concat(e?"?run=".concat(encodeURIComponent(e)):""),{method:"POST",body:"{}"}),saveTaskFile:(t,o,e,n,s)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/files/").concat(e,"/").concat(encodeURIComponent(n)).concat(s?"?run=".concat(encodeURIComponent(s)):""),{method:"POST",body:"{}"}),start:(t,o,e,n)=>p("/sessions/".concat(t,"/start"),{method:"POST",body:JSON.stringify({mode:o,name:e,starts:n})},{timeoutMs:12e4}),startOptions:t=>p("/start/options?sessions=".concat(encodeURIComponent(t.join(",")))),startFetch:(t,o,e)=>p("/start/fetch",{method:"POST",body:JSON.stringify({dir:t,remote:o,...e?{branches:e}:{}})},{timeoutMs:33e4}),startFailures:function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return p("/start/failures".concat(t?"?unanswered=1":""))},startFailureUrl:t=>i("".concat(n,"/start/failures/").concat(encodeURIComponent(t),"/report")),terminalUrl:()=>i("".concat(n,"/terminal")),stop:t=>p("/sessions/".concat(t,"/stop"),{method:"POST",body:"{}"}),approvals:t=>p("/approvals".concat(t?"?session=".concat(encodeURIComponent(t)):"")),undoPreview:(t,o)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/undo")),undoTask:(t,o,e)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/undo"),{method:"POST",body:JSON.stringify({how:e})}),acceptTask:(t,o,e)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/accept"),{method:"POST",body:JSON.stringify((null==e?void 0:e.trim())?{note:e}:{})}),addTaskNote:(t,o,e)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/notes"),{method:"POST",body:JSON.stringify({text:e})}),kerriganReport:t=>p("/kerrigan/report",{method:"POST",body:JSON.stringify(t)}),checkChanges:t=>p("/changes/check",{method:"POST",body:JSON.stringify({text:t})}),applyChanges:t=>p("/changes/apply",{method:"POST",body:JSON.stringify({text:t})}),workspace:()=>p("/workspace"),workspaceFiles:()=>p("/workspace/files"),workspaceFile:t=>p("/workspace/file?path=".concat(encodeURIComponent(t))),chatThreads:()=>p("/chat/threads"),chatSend:(t,o,e)=>p("/chat",{method:"POST",body:JSON.stringify({text:t,...o?{threadId:o}:{},...e?{model:e}:{}})}),chatRewind:(t,o)=>p("/chat/".concat(t,"/rewind"),{method:"POST",body:JSON.stringify({taskId:o})}),repoTree:function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",e=arguments.length>2?arguments[2]:void 0;return p("/sessions/".concat(t,"/repo/tree?path=").concat(encodeURIComponent(o)).concat(e?"&task=".concat(encodeURIComponent(e)):""))},repoFile:(t,o,e)=>p("/sessions/".concat(t,"/repo/file?path=").concat(encodeURIComponent(o)).concat(e?"&task=".concat(encodeURIComponent(e)):"")),repoLog:t=>p("/sessions/".concat(t,"/repo/log")),sessionEvents:t=>p("/sessions/".concat(t,"/events")),decidePlan:(t,o,e)=>p("/approvals/".concat(t,"/plan"),{method:"POST",body:JSON.stringify({action:o,...(null==e?void 0:e.trim())?{note:e}:{}})}),decide:(t,o)=>p("/approvals/".concat(t),{method:"POST",body:JSON.stringify({action:o})}),setRunMode:(t,o)=>p("/sessions/".concat(t,"/mode"),{method:"POST",body:JSON.stringify({mode:o})}),streamUrl:t=>i("".concat(n,"/sessions/").concat(t,"/stream")),batch:()=>p("/batch").then(t=>null!=t?t:null),startBatch:(t,o,e,n,s,c,a,i)=>p("/batch/start",{method:"POST",body:JSON.stringify({sessionIds:t,mode:o,onFailure:e,model:n,reviewModel:s,name:c,taskIds:a,starts:i})},{timeoutMs:12e4}),suggestedRunName:t=>p("/batch/name?sessions=".concat(encodeURIComponent(t.join(",")))),stopBatch:()=>p("/batch/stop",{method:"POST",body:"{}"}),pauseBatch:()=>p("/batch/pause",{method:"POST",body:"{}"}),resumeBatch:()=>p("/batch/resume",{method:"POST",body:"{}"}),planBrief:t=>p("/plan/brief?lang=".concat(encodeURIComponent(t))),context:(t,o)=>p("/context/".concat(t,"?lang=").concat(encodeURIComponent(o))),setContext:(t,o)=>p("/context/".concat(t),{method:"PUT",body:JSON.stringify({content:o})}),resetContext:(t,o)=>p("/context/".concat(t,"?lang=").concat(encodeURIComponent(o)),{method:"DELETE"}),checkPlan:t=>p("/plan/check",{method:"POST",body:JSON.stringify({text:t})}),importPlan:t=>p("/plan/import",{method:"POST",body:JSON.stringify({text:t})}),browseFolder:t=>p("/browse-folder",{method:"POST",body:JSON.stringify({start:t})},{timeoutMs:null}),tasks:()=>p("/tasks"),activity:()=>p("/activity"),downloadBundle:async t=>{var o,e,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==(o=/filename\*=UTF-8''([^;]+)/i.exec(i))?void 0:o[1],d=null==(e=/filename="([^"]+)"/i.exec(i))?void 0:e[1],l=null!=d?d:"copilot-operator-bundle.json";if(r)try{l=decodeURIComponent(r)}catch(t){}let h=URL.createObjectURL(await c.blob()),u=document.createElement("a");return u.href=h,u.download=l,document.body.appendChild(u),u.click(),u.remove(),setTimeout(()=>URL.revokeObjectURL(h),1e4),l},exportUrl:(t,o)=>{let e=new URLSearchParams;return o.run&&e.set("run",o.run),o.session&&e.set("session",o.session),o.task&&e.set("task",o.task),i("".concat(n,"/export/").concat(t,"?").concat(e.toString()))},debugExportUrl:t=>i("".concat(n,"/debug/export").concat(t.length>0?"?sessions=".concat(encodeURIComponent(t.join(","))):"")),vcsStatus:t=>p("/sessions/".concat(t,"/vcs")),runVcs:t=>p("/batch/vcs?ids=".concat(encodeURIComponent(t.join(",")))),runVcsPrepare:function(t,o,e){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return p("/batch/vcs/prepare",{method:"POST",body:JSON.stringify({sessionIds:t,repoDir:o,action:e,choices:n})})},vcsSnapshot:(t,o)=>p("/sessions/".concat(t,"/vcs/snapshot"),{method:"POST",body:JSON.stringify({choices:o})}),restorePreview:(t,o)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/restore")),restore:(t,o)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/restore"),{method:"POST",body:"{}"}),contractCheck:(t,o)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/contract")),applyContractFix:(t,o,e,n)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/contract-fix"),{method:"POST",body:JSON.stringify({choices:e,expect:n})}),restartPlan:(t,o)=>p("/sessions/".concat(t,"/tasks/").concat(o,"/restart")),restartFrom:function(t,o){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return p("/sessions/".concat(t,"/tasks/").concat(o,"/restart"),{method:"POST",body:JSON.stringify(e)})},repoCheck:t=>p("/repo?dir=".concat(encodeURIComponent(t))),project:()=>p("/project"),setProject:t=>p("/project",{method:"PUT",body:JSON.stringify(t)}),models:()=>p("/models"),setDefaultModel:t=>p("/models/default",{method:"PUT",body:JSON.stringify({model:t})}),setDefaultReviewModel:t=>p("/models/review-default",{method:"PUT",body:JSON.stringify({model:t})}),refreshModels:()=>p("/models/refresh",{method:"POST",body:"{}"},{timeoutMs:null}),login:t=>p("/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 o=Math.round(t/1e3);if(o<60)return"".concat(o,"s");let e=Math.floor(o/60);return e<60?"".concat(e,"m ").concat(o%60,"s"):"".concat(Math.floor(e/60),"h ").concat(e%60,"m")}}}]);