copilot-operator 0.1.4 → 0.1.6

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 (47) hide show
  1. package/dist/src/api/operator.controller.js +5 -2
  2. package/dist/src/api/operator.service.js +48 -12
  3. package/dist/src/orchestrator/taskRunner.js +12 -2
  4. package/dist/src/plan/brief.js +1290 -1221
  5. package/dist/src/plan/schema.js +12 -0
  6. package/dist/src/plan/script.js +13 -0
  7. package/dist/src/plan/systemGuide.js +1396 -172
  8. package/dist/src/session/compose.js +5 -1
  9. package/dist/src/session/exports.js +4 -0
  10. package/dist/src/session/store.js +4 -1
  11. package/dist/src/session/story.js +10 -1
  12. package/dist/src/vcs/taskVcs.js +122 -12
  13. package/dist/web/404.html +2 -2
  14. package/dist/web/_next/static/chunks/549-afafecd6bfbb138e.js +1 -0
  15. package/dist/web/_next/static/chunks/56-91cd1709158ebf99.js +1 -0
  16. package/dist/web/_next/static/chunks/867-fc983d08916b4e28.js +1 -0
  17. package/dist/web/_next/static/chunks/app/history/page-b3b4af994c868b5d.js +1 -0
  18. package/dist/web/_next/static/chunks/app/layout-e0174d863960f109.js +1 -0
  19. package/dist/web/_next/static/chunks/app/sessions/view/page-d4213354730a945c.js +1 -0
  20. package/dist/web/_next/static/css/{5a10c60adf9c5336.css → 63fea96806e6b2cb.css} +1 -1
  21. package/dist/web/appearance.html +2 -2
  22. package/dist/web/appearance.txt +25 -24
  23. package/dist/web/defaults.html +2 -2
  24. package/dist/web/defaults.txt +25 -24
  25. package/dist/web/history.html +2 -2
  26. package/dist/web/history.txt +25 -24
  27. package/dist/web/import.html +2 -2
  28. package/dist/web/import.txt +25 -24
  29. package/dist/web/index.html +2 -2
  30. package/dist/web/index.txt +25 -24
  31. package/dist/web/level1.html +2 -2
  32. package/dist/web/level1.txt +25 -24
  33. package/dist/web/presets.html +2 -2
  34. package/dist/web/presets.txt +25 -24
  35. package/dist/web/sessions/view.html +2 -2
  36. package/dist/web/sessions/view.txt +25 -24
  37. package/dist/web/system.html +2 -2
  38. package/dist/web/system.txt +25 -24
  39. package/package.json +4 -3
  40. package/dist/web/_next/static/chunks/549-2086c05135bc9753.js +0 -1
  41. package/dist/web/_next/static/chunks/867-f0e3e152f6f67e45.js +0 -1
  42. package/dist/web/_next/static/chunks/89-382e9b29486d2747.js +0 -1
  43. package/dist/web/_next/static/chunks/app/history/page-8d4f817e36986e3f.js +0 -1
  44. package/dist/web/_next/static/chunks/app/layout-92fa876afe619cf3.js +0 -1
  45. package/dist/web/_next/static/chunks/app/sessions/view/page-185f5fcc383e6619.js +0 -1
  46. /package/dist/web/_next/static/{p9lexLS0u8W5N6VzLavHO → WJ_8hRZsp4VWiDZx8NMUw}/_buildManifest.js +0 -0
  47. /package/dist/web/_next/static/{p9lexLS0u8W5N6VzLavHO → WJ_8hRZsp4VWiDZx8NMUw}/_ssgManifest.js +0 -0
@@ -1,27 +1,28 @@
1
1
  1:"$Sreact.fragment"
2
- 2:I[1205,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-f0e3e152f6f67e45.js","549","static/chunks/549-2086c05135bc9753.js","177","static/chunks/app/layout-92fa876afe619cf3.js"],"themeScript"]
3
- 3:I[1205,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-f0e3e152f6f67e45.js","549","static/chunks/549-2086c05135bc9753.js","177","static/chunks/app/layout-92fa876afe619cf3.js"],"AppearanceProvider"]
4
- 4:I[867,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-f0e3e152f6f67e45.js","549","static/chunks/549-2086c05135bc9753.js","177","static/chunks/app/layout-92fa876afe619cf3.js"],"LanguageProvider"]
5
- 5:I[1035,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-f0e3e152f6f67e45.js","549","static/chunks/549-2086c05135bc9753.js","177","static/chunks/app/layout-92fa876afe619cf3.js"],"DialogHost"]
6
- 6:I[8214,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-f0e3e152f6f67e45.js","549","static/chunks/549-2086c05135bc9753.js","177","static/chunks/app/layout-92fa876afe619cf3.js"],"SkipLink"]
7
- 7:I[8197,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-f0e3e152f6f67e45.js","549","static/chunks/549-2086c05135bc9753.js","177","static/chunks/app/layout-92fa876afe619cf3.js"],""]
8
- 8:I[8214,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-f0e3e152f6f67e45.js","549","static/chunks/549-2086c05135bc9753.js","177","static/chunks/app/layout-92fa876afe619cf3.js"],"Nav"]
9
- 9:I[6657,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-f0e3e152f6f67e45.js","549","static/chunks/549-2086c05135bc9753.js","177","static/chunks/app/layout-92fa876afe619cf3.js"],"GlobalApprovals"]
2
+ 2:I[1205,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-fc983d08916b4e28.js","549","static/chunks/549-afafecd6bfbb138e.js","177","static/chunks/app/layout-e0174d863960f109.js"],"themeScript"]
3
+ 3:I[1205,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-fc983d08916b4e28.js","549","static/chunks/549-afafecd6bfbb138e.js","177","static/chunks/app/layout-e0174d863960f109.js"],"AppearanceProvider"]
4
+ 4:I[867,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-fc983d08916b4e28.js","549","static/chunks/549-afafecd6bfbb138e.js","177","static/chunks/app/layout-e0174d863960f109.js"],"LanguageProvider"]
5
+ 5:I[1035,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-fc983d08916b4e28.js","549","static/chunks/549-afafecd6bfbb138e.js","177","static/chunks/app/layout-e0174d863960f109.js"],"DialogHost"]
6
+ 6:I[8214,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-fc983d08916b4e28.js","549","static/chunks/549-afafecd6bfbb138e.js","177","static/chunks/app/layout-e0174d863960f109.js"],"SkipLink"]
7
+ 7:I[8197,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-fc983d08916b4e28.js","549","static/chunks/549-afafecd6bfbb138e.js","177","static/chunks/app/layout-e0174d863960f109.js"],""]
8
+ 8:I[8214,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-fc983d08916b4e28.js","549","static/chunks/549-afafecd6bfbb138e.js","177","static/chunks/app/layout-e0174d863960f109.js"],"Nav"]
9
+ 9:I[6657,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-fc983d08916b4e28.js","549","static/chunks/549-afafecd6bfbb138e.js","177","static/chunks/app/layout-e0174d863960f109.js"],"GlobalApprovals"]
10
10
  a:I[5204,[],""]
11
11
  b:I[2642,[],""]
12
- c:I[7089,[],"ClientPageRoot"]
13
- d:I[3134,["867","static/chunks/867-f0e3e152f6f67e45.js","549","static/chunks/549-2086c05135bc9753.js","186","static/chunks/app/system/page-3aa2a0fef5454e69.js"],"default"]
14
- 10:I[433,[],"OutletBoundary"]
15
- 12:I[9884,[],"AsyncMetadataOutlet"]
16
- 14:I[433,[],"ViewportBoundary"]
17
- 16:I[433,[],"MetadataBoundary"]
18
- 17:"$Sreact.suspense"
19
- 19:I[3536,[],""]
20
- :HL["/_next/static/css/5a10c60adf9c5336.css","style"]
21
- 0:{"P":null,"b":"p9lexLS0u8W5N6VzLavHO","p":"","c":["","system"],"i":false,"f":[[["",{"children":["system",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/5a10c60adf9c5336.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":"$2"}}]}],["$","body",null,{"children":["$","$L3",null,{"children":["$","$L4",null,{"children":["$","$L5",null,{"children":[["$","$L6",null,{}],["$","div",null,{"className":"wrap","children":[["$","header",null,{"className":"top","children":[["$","h1",null,{"children":["$","$L7",null,{"href":"/","children":"copilot-operator"}]}],["$","$L8",null,{}]]}],["$","$L9",null,{}],["$","main",null,{"id":"main","children":["$","$La",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$Lb",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"}]}]]}]]}]}]}]}]]}]]}],{"children":["system",["$","$1","c",{"children":[null,["$","$La",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$Lb",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":["__PAGE__",["$","$1","c",{"children":[["$","$Lc",null,{"Component":"$d","searchParams":{},"params":{},"promises":["$@e","$@f"]}],null,["$","$L10",null,{"children":["$L11",["$","$L12",null,{"promise":"$@13"}]]}]]}],{},null,false]},null,false]},null,false],["$","$1","h",{"children":[null,[["$","$L14",null,{"children":"$L15"}],null],["$","$L16",null,{"children":["$","div",null,{"hidden":true,"children":["$","$17",null,{"fallback":null,"children":"$L18"}]}]}]]}],false]],"m":"$undefined","G":["$19",[]],"s":false,"S":true}
22
- e:{}
23
- f:"$0:f:0:1:2:children:2:children:1:props:children:0:props:params"
24
- 15:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]
25
- 11:null
26
- 13:{"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"}
27
- 18:"$13:metadata"
12
+ c:I[7712,["197","static/chunks/197-f7c33a0114fc3db3.js","867","static/chunks/867-fc983d08916b4e28.js","549","static/chunks/549-afafecd6bfbb138e.js","177","static/chunks/app/layout-e0174d863960f109.js"],"ScrollJump"]
13
+ d:I[7089,[],"ClientPageRoot"]
14
+ e:I[3134,["867","static/chunks/867-fc983d08916b4e28.js","549","static/chunks/549-afafecd6bfbb138e.js","186","static/chunks/app/system/page-3aa2a0fef5454e69.js"],"default"]
15
+ 11:I[433,[],"OutletBoundary"]
16
+ 13:I[9884,[],"AsyncMetadataOutlet"]
17
+ 15:I[433,[],"ViewportBoundary"]
18
+ 17:I[433,[],"MetadataBoundary"]
19
+ 18:"$Sreact.suspense"
20
+ 1a:I[3536,[],""]
21
+ :HL["/_next/static/css/63fea96806e6b2cb.css","style"]
22
+ 0:{"P":null,"b":"WJ_8hRZsp4VWiDZx8NMUw","p":"","c":["","system"],"i":false,"f":[[["",{"children":["system",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/63fea96806e6b2cb.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":"$2"}}]}],["$","body",null,{"children":["$","$L3",null,{"children":["$","$L4",null,{"children":["$","$L5",null,{"children":[["$","$L6",null,{}],["$","div",null,{"className":"wrap","children":[["$","header",null,{"className":"top","children":[["$","h1",null,{"children":["$","$L7",null,{"href":"/","children":"copilot-operator"}]}],["$","$L8",null,{}]]}],["$","$L9",null,{}],["$","main",null,{"id":"main","children":["$","$La",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$Lb",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"}]}]]}],["$","$Lc",null,{}]]}]}]}]}]]}]]}],{"children":["system",["$","$1","c",{"children":[null,["$","$La",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$Lb",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":["__PAGE__",["$","$1","c",{"children":[["$","$Ld",null,{"Component":"$e","searchParams":{},"params":{},"promises":["$@f","$@10"]}],null,["$","$L11",null,{"children":["$L12",["$","$L13",null,{"promise":"$@14"}]]}]]}],{},null,false]},null,false]},null,false],["$","$1","h",{"children":[null,[["$","$L15",null,{"children":"$L16"}],null],["$","$L17",null,{"children":["$","div",null,{"hidden":true,"children":["$","$18",null,{"fallback":null,"children":"$L19"}]}]}]]}],false]],"m":"$undefined","G":["$1a",[]],"s":false,"S":true}
23
+ f:{}
24
+ 10:"$0:f:0:1:2:children:2:children:1:props:children:0:props:params"
25
+ 16:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]
26
+ 12:null
27
+ 14:{"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"}
28
+ 19:"$14:metadata"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "copilot-operator",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
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.",
@@ -20,7 +20,7 @@
20
20
  "cop": "tsx src/cli.ts",
21
21
  "check:parser": "tsx test/parser.check.ts",
22
22
  "check:report": "tsx test/report.check.ts",
23
- "check": "npm run check:parser && npm run check:damage && npm run check:session && npm run check:report && npm run check:runner && npm run check:mirror && 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:context && 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:continue",
23
+ "check": "npm run check:parser && npm run check:damage && npm run check:session && npm run check:report && npm run check:runner && npm run check:mirror && 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:context && 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:continue && npm run check:startfrom",
24
24
  "probe": "tsx scripts/probe-locators.ts",
25
25
  "check:damage": "tsx test/damage.check.ts",
26
26
  "api": "npm run build && node dist/src/api/main.js",
@@ -63,7 +63,8 @@
63
63
  "check:hardening": "tsx test/hardening.check.ts",
64
64
  "check:package": "tsx test/package.check.ts",
65
65
  "check:models": "tsx test/models.check.ts",
66
- "check:continue": "tsx test/continue.check.ts"
66
+ "check:continue": "tsx test/continue.check.ts",
67
+ "check:startfrom": "tsx test/startfrom.check.ts"
67
68
  },
68
69
  "dependencies": {
69
70
  "@nestjs/common": "^12.0.3",
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[549],{5549:(t,e,o)=>{o.d(e,{AV:()=>r,FH:()=>h,FZ:()=>d,aT:()=>c,c5:()=>y,dK:()=>m,nC:()=>s,rt:()=>l,ub:()=>i,zi:()=>p});var n=o(986);let s="/api";function c(t,e){return"/sessions/view?id=".concat(encodeURIComponent(t)).concat(e?"#".concat(e):"")}let a="cop-api-token";function r(){try{var t;let e=/(?:^#|&)token=([0-9a-f]{16,})/i.exec(window.location.hash);if(e)return window.localStorage.setItem(a,e[1]),window.history.replaceState(null,"",window.location.pathname+window.location.search),e[1];return window.localStorage.getItem(a)||(null!=(t=n.env.NEXT_PUBLIC_COP_TOKEN)?t:"")}catch(t){return""}}function i(t){let e=r();return e?"".concat(t).concat(t.includes("?")?"&":"?","token=").concat(encodeURIComponent(e)):t}let d=["exit-zero","exit-nonzero","output-contains","output-omits","output-matches","file-exists","file-missing","file-contains"];function l(t){return t.startsWith("exit-")||t.startsWith("output-")}function m(t){return"output-contains"===t||"output-omits"===t||"output-matches"===t||"file-contains"===t}async function u(t,e){var o;let n=await fetch("".concat(s).concat(t),{...e,headers:{"content-type":"application/json",...r()?{"x-cop-token":r()}:{},...null!=(o=null==e?void 0:e.headers)?o:{}}});if(!n.ok){let t="".concat(n.status," ").concat(n.statusText);try{let e=await n.json();(null==e?void 0:e.message)&&(t=Array.isArray(e.message)?e.message.join("; "):e.message)}catch(t){}throw Error(t)}let c=await n.text();return c?JSON.parse(c):void 0}let h={health:()=>u("/health"),doctor:()=>u("/doctor"),settings:()=>u("/settings"),saveSettings:t=>u("/settings",{method:"PUT",body:JSON.stringify(t)}),level1:()=>u("/level1"),setLevel1:t=>u("/level1",{method:"PUT",body:JSON.stringify({content:t})}),resetLevel1:()=>u("/level1",{method:"DELETE"}),presets:()=>u("/presets"),savePreset:(t,e)=>u("/presets/".concat(encodeURIComponent(t)),{method:"PUT",body:JSON.stringify({content:e})}),deletePreset:t=>u("/presets/".concat(encodeURIComponent(t)),{method:"DELETE"}),personas:()=>u("/personas"),savePersona:(t,e)=>u("/personas/".concat(encodeURIComponent(t)),{method:"PUT",body:JSON.stringify({content:e})}),deletePersona:t=>u("/personas/".concat(encodeURIComponent(t)),{method:"DELETE"}),sessions:()=>u("/sessions"),session:t=>u("/sessions/".concat(t)),createSession:(t,e)=>u("/sessions",{method:"POST",body:JSON.stringify({name:t,mirror:e})}),updateSession:(t,e)=>u("/sessions/".concat(t),{method:"PUT",body:JSON.stringify(e)}),deleteSession:t=>u("/sessions/".concat(t),{method:"DELETE"}),addTask:(t,e)=>u("/sessions/".concat(t,"/tasks"),{method:"POST",body:JSON.stringify(e)}),updateTask:(t,e,o)=>u("/sessions/".concat(t,"/tasks/").concat(e),{method:"PUT",body:JSON.stringify(o)}),deleteTask:(t,e)=>u("/sessions/".concat(t,"/tasks/").concat(e),{method:"DELETE"}),continueTask:(t,e)=>u("/sessions/".concat(t,"/tasks/").concat(e,"/continue"),{method:"POST",body:"{}"}),rerunTask:function(t,e){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u("/sessions/".concat(t,"/tasks/").concat(e,"/rerun"),{method:"POST",body:JSON.stringify(o)})},taskStory:(t,e,o)=>u("/sessions/".concat(t,"/tasks/").concat(e,"/story").concat(o?"?run=".concat(encodeURIComponent(o)):"")),taskFiles:(t,e,o)=>u("/sessions/".concat(t,"/tasks/").concat(e,"/files").concat(o?"?run=".concat(encodeURIComponent(o)):"")),taskLogUrl:(t,e,o)=>"".concat(s,"/sessions/").concat(t,"/tasks/").concat(e,"/log").concat(o?"?run=".concat(encodeURIComponent(o)):""),taskFileUrl:(t,e,o,n,c)=>"".concat(s,"/sessions/").concat(t,"/tasks/").concat(e,"/files/").concat(o,"/").concat(encodeURIComponent(n)).concat(c?"?run=".concat(encodeURIComponent(c)):""),saveTaskLog:(t,e,o)=>u("/sessions/".concat(t,"/tasks/").concat(e,"/log").concat(o?"?run=".concat(encodeURIComponent(o)):""),{method:"POST",body:"{}"}),saveTaskFile:(t,e,o,n,s)=>u("/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)=>u("/sessions/".concat(t,"/start"),{method:"POST",body:JSON.stringify({mode:e,name:o})}),stop:t=>u("/sessions/".concat(t,"/stop"),{method:"POST",body:"{}"}),approvals:t=>u("/approvals".concat(t?"?session=".concat(encodeURIComponent(t)):"")),decide:(t,e)=>u("/approvals/".concat(t),{method:"POST",body:JSON.stringify({action:e})}),setRunMode:(t,e)=>u("/sessions/".concat(t,"/mode"),{method:"POST",body:JSON.stringify({mode:e})}),streamUrl:t=>i("".concat(s,"/sessions/").concat(t,"/stream")),batch:()=>u("/batch").then(t=>null!=t?t:null),startBatch:(t,e,o,n,s,c)=>u("/batch/start",{method:"POST",body:JSON.stringify({sessionIds:t,mode:e,onFailure:o,model:n,reviewModel:s,name:c})}),suggestedRunName:t=>u("/batch/name?sessions=".concat(encodeURIComponent(t.join(",")))),stopBatch:()=>u("/batch/stop",{method:"POST",body:"{}"}),pauseBatch:()=>u("/batch/pause",{method:"POST",body:"{}"}),resumeBatch:()=>u("/batch/resume",{method:"POST",body:"{}"}),planBrief:t=>u("/plan/brief?lang=".concat(encodeURIComponent(t))),context:(t,e)=>u("/context/".concat(t,"?lang=").concat(encodeURIComponent(e))),setContext:(t,e)=>u("/context/".concat(t),{method:"PUT",body:JSON.stringify({content:e})}),resetContext:(t,e)=>u("/context/".concat(t,"?lang=").concat(encodeURIComponent(e)),{method:"DELETE"}),checkPlan:t=>u("/plan/check",{method:"POST",body:JSON.stringify({text:t})}),importPlan:t=>u("/plan/import",{method:"POST",body:JSON.stringify({text:t})}),dirs:function(t){let e=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return u("/dirs?root=".concat(encodeURIComponent(t),"&gitignore=").concat(e?"1":"0"))},browseFolder:t=>u("/browse-folder",{method:"POST",body:JSON.stringify({start:t})}),previewMirror:t=>u("/mirror/preview",{method:"POST",body:JSON.stringify(t)}),tasks:()=>u("/tasks"),activity:()=>u("/activity"),downloadBundle:async t=>{var e,o,n;let c=await fetch("".concat(s,"/export/bundle"),{method:"POST",headers:{"content-type":"application/json",...r()?{"x-cop-token":r()}:{}},body:JSON.stringify({tasks:t})});if(!c.ok)throw Error(await c.text()||"".concat(c.status," ").concat(c.statusText));let a=null!=(n=c.headers.get("content-disposition"))?n:"",i=null==(e=/filename\*=UTF-8''([^;]+)/i.exec(a))?void 0:e[1],d=null==(o=/filename="([^"]+)"/i.exec(a))?void 0:o[1],l=null!=d?d:"copilot-operator-bundle.json";if(i)try{l=decodeURIComponent(i)}catch(t){}let m=URL.createObjectURL(await c.blob()),u=document.createElement("a");return u.href=m,u.download=l,document.body.appendChild(u),u.click(),u.remove(),setTimeout(()=>URL.revokeObjectURL(m),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(s,"/export/").concat(t,"?").concat(o.toString()))},debugExportUrl:t=>i("".concat(s,"/debug/export").concat(t.length>0?"?sessions=".concat(encodeURIComponent(t.join(","))):"")),vcsStatus:t=>u("/sessions/".concat(t,"/vcs")),restorePreview:(t,e)=>u("/sessions/".concat(t,"/tasks/").concat(e,"/restore")),restore:(t,e)=>u("/sessions/".concat(t,"/tasks/").concat(e,"/restore"),{method:"POST",body:"{}"}),restartPlan:(t,e)=>u("/sessions/".concat(t,"/tasks/").concat(e,"/restart")),restartFrom:function(t,e){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u("/sessions/".concat(t,"/tasks/").concat(e,"/restart"),{method:"POST",body:JSON.stringify(o)})},repoCheck:t=>u("/repo?dir=".concat(encodeURIComponent(t))),project:()=>u("/project"),setProject:t=>u("/project",{method:"PUT",body:JSON.stringify(t)}),models:()=>u("/models"),setDefaultModel:t=>u("/models/default",{method:"PUT",body:JSON.stringify({model:t})}),setDefaultReviewModel:t=>u("/models/review-default",{method:"PUT",body:JSON.stringify({model:t})}),refreshModels:()=>u("/models/refresh",{method:"POST",body:"{}"})};function p(t){return t<1024?"".concat(t," B"):t<1048576?"".concat((t/1024).toFixed(1)," KB"):"".concat((t/1048576).toFixed(1)," MB")}function y(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")}}}]);