copilot-operator 0.1.20 → 0.1.23

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 (44) hide show
  1. package/dist/src/api/operator.controller.js +49 -0
  2. package/dist/src/api/operator.service.js +181 -7
  3. package/dist/src/orchestrator/taskRunner.js +14 -2
  4. package/dist/src/plan/systemGuide.js +143 -15
  5. package/dist/src/session/exports.js +70 -1
  6. package/dist/src/session/runLog.js +60 -0
  7. package/dist/src/vcs/git.js +15 -3
  8. package/dist/src/vcs/inputs.js +26 -2
  9. package/dist/src/vcs/prepareFromRemote.js +293 -0
  10. package/dist/src/vcs/remoteAuth.js +61 -0
  11. package/dist/src/vcs/runPreflight.js +286 -0
  12. package/dist/src/vcs/taskVcs.js +42 -6
  13. package/dist/web/404.html +2 -2
  14. package/dist/web/_next/static/chunks/549-df7a4876917615da.js +1 -0
  15. package/dist/web/_next/static/chunks/867-a67ea8ba3f9b24aa.js +1 -0
  16. package/dist/web/_next/static/chunks/app/defaults/page-0e778dafc69afbd3.js +1 -0
  17. package/dist/web/_next/static/chunks/app/page-0a861b38da0a1c51.js +1 -0
  18. package/dist/web/_next/static/chunks/app/sessions/view/page-9b66b729748595bb.js +1 -0
  19. package/dist/web/appearance.html +2 -2
  20. package/dist/web/appearance.txt +10 -10
  21. package/dist/web/defaults.html +2 -2
  22. package/dist/web/defaults.txt +10 -10
  23. package/dist/web/history.html +2 -2
  24. package/dist/web/history.txt +10 -10
  25. package/dist/web/import.html +2 -2
  26. package/dist/web/import.txt +10 -10
  27. package/dist/web/index.html +2 -2
  28. package/dist/web/index.txt +10 -10
  29. package/dist/web/level1.html +2 -2
  30. package/dist/web/level1.txt +10 -10
  31. package/dist/web/presets.html +2 -2
  32. package/dist/web/presets.txt +10 -10
  33. package/dist/web/sessions/view.html +2 -2
  34. package/dist/web/sessions/view.txt +10 -10
  35. package/dist/web/system.html +2 -2
  36. package/dist/web/system.txt +10 -10
  37. package/package.json +150 -148
  38. package/dist/web/_next/static/chunks/549-5d7c845fb0a27dbe.js +0 -1
  39. package/dist/web/_next/static/chunks/867-d9c54f7a2b285b3f.js +0 -1
  40. package/dist/web/_next/static/chunks/app/defaults/page-fd819bbfa7f33982.js +0 -1
  41. package/dist/web/_next/static/chunks/app/page-409e37e208dc12e5.js +0 -1
  42. package/dist/web/_next/static/chunks/app/sessions/view/page-99f9153fd75078d0.js +0 -1
  43. /package/dist/web/_next/static/{P0lpNIJvdSO3yuWRpIPQf → -dZtu-yqxc-HXzYTmqYSc}/_buildManifest.js +0 -0
  44. /package/dist/web/_next/static/{P0lpNIJvdSO3yuWRpIPQf → -dZtu-yqxc-HXzYTmqYSc}/_ssgManifest.js +0 -0
package/package.json CHANGED
@@ -1,148 +1,150 @@
1
- {
2
- "name": "copilot-operator",
3
- "version": "0.1.20",
4
- "private": false,
5
- "type": "module",
6
- "description": "Automates a Microsoft 365 Copilot chat: sends prompts, extracts commands, runs them, reports back.",
7
- "license": "MIT",
8
- "engines": {
9
- "node": ">=20"
10
- },
11
- "scripts": {
12
- "build": "tsc -p tsconfig.json",
13
- "build:package": "node scripts/build-package.mjs",
14
- "prepack": "node scripts/build-package.mjs",
15
- "check:pacing": "tsx test/pacing.check.ts",
16
- "check:runner": "tsx test/runner.check.ts",
17
- "check:chat": "tsx test/chat.check.ts",
18
- "cop": "tsx src/cli.ts",
19
- "check:parser": "tsx test/parser.check.ts",
20
- "check:report": "tsx test/report.check.ts",
21
- "check": "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:continue && npm run check:startfrom && 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-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",
22
- "probe": "tsx scripts/probe-locators.ts",
23
- "check:damage": "tsx test/damage.check.ts",
24
- "api": "npm run build && node dist/src/api/main.js",
25
- "api:start": "node dist/src/api/main.js",
26
- "web": "npm run dev --workspace web",
27
- "web:build": "npm run build --workspace web",
28
- "check:session": "tsx test/session.check.ts",
29
- "start": "node scripts/dev.mjs",
30
- "dev": "node scripts/dev.mjs --open",
31
- "check:vcs": "tsx test/vcs.check.ts",
32
- "check:plan": "tsx test/plan.check.ts",
33
- "check:checks": "tsx test/checks.check.ts",
34
- "check:workdir": "tsx test/workdir.check.ts",
35
- "check:processes": "tsx test/processes.check.ts",
36
- "check:environment": "tsx test/environment.check.ts",
37
- "check:clock": "tsx test/clock.check.ts",
38
- "check:crash": "tsx test/crash.check.ts",
39
- "check:clipboard": "tsx test/clipboard.check.ts",
40
- "check:restart": "tsx test/restart.check.ts",
41
- "check:review": "tsx test/review.check.ts",
42
- "check:shells": "tsx test/shells.check.ts",
43
- "check:save": "tsx test/save.check.ts",
44
- "check:guide": "tsx test/guide.check.ts",
45
- "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json && npm run typecheck --workspace web",
46
- "check:bundle": "tsx test/bundle.check.ts",
47
- "check:runname": "tsx test/runname.check.ts",
48
- "update": "node scripts/update.mjs",
49
- "check:dangerous": "tsx test/dangerous.check.ts",
50
- "check:programs": "tsx test/programs.check.ts",
51
- "check:manifest": "tsx test/manifest.check.ts",
52
- "check:lock": "tsx test/lock.check.ts",
53
- "check:isolation": "tsx test/isolation.check.ts",
54
- "check:security": "tsx test/security.check.ts",
55
- "check:update": "tsx test/update.check.ts",
56
- "check:persona": "tsx test/persona.check.ts",
57
- "check:script": "tsx test/script.check.ts",
58
- "check:batch": "tsx test/batch.check.ts",
59
- "check:confinement": "tsx test/confinement.check.ts",
60
- "check:network": "tsx test/network.check.ts",
61
- "check:hardening": "tsx test/hardening.check.ts",
62
- "check:package": "tsx test/package.check.ts",
63
- "check:models": "tsx test/models.check.ts",
64
- "check:continue": "tsx test/continue.check.ts",
65
- "check:startfrom": "tsx test/startfrom.check.ts",
66
- "check:diff": "tsx test/diff.check.ts",
67
- "check:integrity": "tsx test/integrity.check.ts",
68
- "check:scope": "tsx test/scope.check.ts",
69
- "check:progress": "tsx test/progress.check.ts",
70
- "check:metrics": "tsx test/metrics.check.ts",
71
- "check:modelpicker": "tsx test/modelpicker.check.ts",
72
- "check:formatrepair": "tsx test/formatrepair.check.ts",
73
- "check:intent": "tsx test/intent.check.ts",
74
- "check:sync": "tsx test/sync.check.ts",
75
- "check:e2e-run": "tsx test/e2e-run.check.ts",
76
- "check:e2e-continue": "tsx test/e2e-continue.check.ts",
77
- "check:e2e-interrupt": "tsx test/e2e-interrupt.check.ts",
78
- "check:ui": "node scripts/build-package.mjs && tsx test/ui.check.ts && tsx test/ui-flows.check.ts",
79
- "check:all": "npm run check && npm run check:ui && npm run check:release",
80
- "check:e2e-vcs": "tsx test/e2e-vcs.check.ts",
81
- "check:noattach": "tsx test/noattach.check.ts",
82
- "check:guard": "tsx test/guard.check.ts",
83
- "check:gate": "tsx test/gate.check.ts",
84
- "check:e2e-batch": "tsx test/e2e-batch.check.ts",
85
- "check:e2e-review": "tsx test/e2e-review.check.ts",
86
- "check:e2e-branches": "tsx test/e2e-branches.check.ts",
87
- "check:e2e-loop": "tsx test/e2e-loop.check.ts",
88
- "check:transport": "tsx test/transport.check.ts",
89
- "check:e2e-plan": "tsx test/e2e-plan.check.ts",
90
- "check:exec": "tsx test/exec.check.ts",
91
- "check:pins": "tsx test/pins.check.ts",
92
- "check:release": "tsx test/release.check.ts",
93
- "check:ui-flows": "tsx test/ui-flows.check.ts",
94
- "check:login": "tsx test/login.check.ts",
95
- "check:order": "tsx test/order.check.ts",
96
- "check:snapshot": "tsx test/snapshot.check.ts",
97
- "check:inputs": "tsx test/inputs.check.ts",
98
- "check:e2e-inputs": "tsx test/e2e-inputs.check.ts",
99
- "check:attempts": "tsx test/attempts.check.ts",
100
- "check:finding-ids": "tsx test/finding-ids.check.ts",
101
- "check:e2e-commit": "tsx test/e2e-commit.check.ts",
102
- "check:e2e-retry-inputs": "tsx test/e2e-retry-inputs.check.ts"
103
- },
104
- "dependencies": {
105
- "@nestjs/common": "^12.0.3",
106
- "@nestjs/core": "^12.0.3",
107
- "@nestjs/platform-express": "^12.0.3",
108
- "commander": "^15.0.0",
109
- "playwright": "^1.63.0",
110
- "reflect-metadata": "^0.2.2",
111
- "rxjs": "^7.8.2",
112
- "yaml": "^2.9.1",
113
- "zod": "^4.6.5"
114
- },
115
- "devDependencies": {
116
- "@types/express": "^5.0.6",
117
- "@types/node": "^22.10.2",
118
- "tsx": "^4.19.2",
119
- "typescript": "5.9"
120
- },
121
- "repository": {
122
- "type": "git",
123
- "url": "git+https://github.com/ivan-markov-666/copilot-operator.git"
124
- },
125
- "bin": {
126
- "cop": "dist/src/cli.js"
127
- },
128
- "files": [
129
- "dist/src",
130
- "dist/web",
131
- "prompts",
132
- "README.md",
133
- "LICENSE"
134
- ],
135
- "os": [
136
- "win32"
137
- ],
138
- "keywords": [
139
- "copilot",
140
- "microsoft-365",
141
- "automation",
142
- "playwright",
143
- "agent"
144
- ],
145
- "workspaces": [
146
- "web"
147
- ]
148
- }
1
+ {
2
+ "name": "copilot-operator",
3
+ "version": "0.1.23",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "Automates a Microsoft 365 Copilot chat: sends prompts, extracts commands, runs them, reports back.",
7
+ "license": "MIT",
8
+ "engines": {
9
+ "node": ">=20"
10
+ },
11
+ "scripts": {
12
+ "build": "tsc -p tsconfig.json",
13
+ "build:package": "node scripts/build-package.mjs",
14
+ "prepack": "node scripts/build-package.mjs",
15
+ "check:pacing": "tsx test/pacing.check.ts",
16
+ "check:runner": "tsx test/runner.check.ts",
17
+ "check:chat": "tsx test/chat.check.ts",
18
+ "cop": "tsx src/cli.ts",
19
+ "check:parser": "tsx test/parser.check.ts",
20
+ "check:report": "tsx test/report.check.ts",
21
+ "check": "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:continue && npm run check:startfrom && 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-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",
22
+ "probe": "tsx scripts/probe-locators.ts",
23
+ "check:damage": "tsx test/damage.check.ts",
24
+ "api": "npm run build && node dist/src/api/main.js",
25
+ "api:start": "node dist/src/api/main.js",
26
+ "web": "npm run dev --workspace web",
27
+ "web:build": "npm run build --workspace web",
28
+ "check:session": "tsx test/session.check.ts",
29
+ "start": "node scripts/dev.mjs",
30
+ "dev": "node scripts/dev.mjs --open",
31
+ "check:vcs": "tsx test/vcs.check.ts",
32
+ "check:plan": "tsx test/plan.check.ts",
33
+ "check:checks": "tsx test/checks.check.ts",
34
+ "check:workdir": "tsx test/workdir.check.ts",
35
+ "check:processes": "tsx test/processes.check.ts",
36
+ "check:environment": "tsx test/environment.check.ts",
37
+ "check:clock": "tsx test/clock.check.ts",
38
+ "check:crash": "tsx test/crash.check.ts",
39
+ "check:clipboard": "tsx test/clipboard.check.ts",
40
+ "check:restart": "tsx test/restart.check.ts",
41
+ "check:review": "tsx test/review.check.ts",
42
+ "check:shells": "tsx test/shells.check.ts",
43
+ "check:save": "tsx test/save.check.ts",
44
+ "check:guide": "tsx test/guide.check.ts",
45
+ "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json && npm run typecheck --workspace web",
46
+ "check:bundle": "tsx test/bundle.check.ts",
47
+ "check:runname": "tsx test/runname.check.ts",
48
+ "update": "node scripts/update.mjs",
49
+ "check:dangerous": "tsx test/dangerous.check.ts",
50
+ "check:programs": "tsx test/programs.check.ts",
51
+ "check:manifest": "tsx test/manifest.check.ts",
52
+ "check:lock": "tsx test/lock.check.ts",
53
+ "check:isolation": "tsx test/isolation.check.ts",
54
+ "check:security": "tsx test/security.check.ts",
55
+ "check:update": "tsx test/update.check.ts",
56
+ "check:persona": "tsx test/persona.check.ts",
57
+ "check:script": "tsx test/script.check.ts",
58
+ "check:batch": "tsx test/batch.check.ts",
59
+ "check:confinement": "tsx test/confinement.check.ts",
60
+ "check:network": "tsx test/network.check.ts",
61
+ "check:hardening": "tsx test/hardening.check.ts",
62
+ "check:package": "tsx test/package.check.ts",
63
+ "check:models": "tsx test/models.check.ts",
64
+ "check:continue": "tsx test/continue.check.ts",
65
+ "check:startfrom": "tsx test/startfrom.check.ts",
66
+ "check:diff": "tsx test/diff.check.ts",
67
+ "check:integrity": "tsx test/integrity.check.ts",
68
+ "check:scope": "tsx test/scope.check.ts",
69
+ "check:progress": "tsx test/progress.check.ts",
70
+ "check:metrics": "tsx test/metrics.check.ts",
71
+ "check:modelpicker": "tsx test/modelpicker.check.ts",
72
+ "check:formatrepair": "tsx test/formatrepair.check.ts",
73
+ "check:intent": "tsx test/intent.check.ts",
74
+ "check:sync": "tsx test/sync.check.ts",
75
+ "check:prepare": "tsx test/prepare.check.ts",
76
+ "check:e2e-run": "tsx test/e2e-run.check.ts",
77
+ "check:e2e-continue": "tsx test/e2e-continue.check.ts",
78
+ "check:e2e-interrupt": "tsx test/e2e-interrupt.check.ts",
79
+ "check:ui": "node scripts/build-package.mjs && tsx test/ui.check.ts && tsx test/ui-flows.check.ts",
80
+ "check:all": "npm run check && npm run check:ui && npm run check:release",
81
+ "check:e2e-vcs": "tsx test/e2e-vcs.check.ts",
82
+ "check:noattach": "tsx test/noattach.check.ts",
83
+ "check:guard": "tsx test/guard.check.ts",
84
+ "check:gate": "tsx test/gate.check.ts",
85
+ "check:e2e-batch": "tsx test/e2e-batch.check.ts",
86
+ "check:e2e-review": "tsx test/e2e-review.check.ts",
87
+ "check:e2e-branches": "tsx test/e2e-branches.check.ts",
88
+ "check:e2e-loop": "tsx test/e2e-loop.check.ts",
89
+ "check:transport": "tsx test/transport.check.ts",
90
+ "check:e2e-plan": "tsx test/e2e-plan.check.ts",
91
+ "check:exec": "tsx test/exec.check.ts",
92
+ "check:pins": "tsx test/pins.check.ts",
93
+ "check:release": "tsx test/release.check.ts",
94
+ "check:ui-flows": "tsx test/ui-flows.check.ts",
95
+ "check:login": "tsx test/login.check.ts",
96
+ "check:order": "tsx test/order.check.ts",
97
+ "check:snapshot": "tsx test/snapshot.check.ts",
98
+ "check:inputs": "tsx test/inputs.check.ts",
99
+ "check:e2e-inputs": "tsx test/e2e-inputs.check.ts",
100
+ "check:attempts": "tsx test/attempts.check.ts",
101
+ "check:finding-ids": "tsx test/finding-ids.check.ts",
102
+ "check:e2e-commit": "tsx test/e2e-commit.check.ts",
103
+ "check:e2e-retry-inputs": "tsx test/e2e-retry-inputs.check.ts",
104
+ "check:e2e-run-vcs": "tsx test/e2e-run-vcs.check.ts"
105
+ },
106
+ "dependencies": {
107
+ "@nestjs/common": "^12.0.3",
108
+ "@nestjs/core": "^12.0.3",
109
+ "@nestjs/platform-express": "^12.0.3",
110
+ "commander": "^15.0.0",
111
+ "playwright": "^1.63.0",
112
+ "reflect-metadata": "^0.2.2",
113
+ "rxjs": "^7.8.2",
114
+ "yaml": "^2.9.1",
115
+ "zod": "^4.6.5"
116
+ },
117
+ "devDependencies": {
118
+ "@types/express": "^5.0.6",
119
+ "@types/node": "^22.10.2",
120
+ "tsx": "^4.19.2",
121
+ "typescript": "5.9"
122
+ },
123
+ "repository": {
124
+ "type": "git",
125
+ "url": "git+https://github.com/ivan-markov-666/copilot-operator.git"
126
+ },
127
+ "bin": {
128
+ "cop": "dist/src/cli.js"
129
+ },
130
+ "files": [
131
+ "dist/src",
132
+ "dist/web",
133
+ "prompts",
134
+ "README.md",
135
+ "LICENSE"
136
+ ],
137
+ "os": [
138
+ "win32"
139
+ ],
140
+ "keywords": [
141
+ "copilot",
142
+ "microsoft-365",
143
+ "automation",
144
+ "playwright",
145
+ "agent"
146
+ ],
147
+ "workspaces": [
148
+ "web"
149
+ ]
150
+ }
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[549],{5549:(t,o,e)=>{e.d(o,{AV:()=>a,FH:()=>h,FZ:()=>r,Zm:()=>u,aT:()=>s,c5:()=>y,dK:()=>l,nC:()=>n,rt:()=>d,ub:()=>i,zi:()=>p});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)}async function m(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 h={health:()=>m("/health"),doctor:()=>m("/doctor"),settings:()=>m("/settings"),saveSettings:t=>m("/settings",{method:"PUT",body:JSON.stringify(t)}),level1:()=>m("/level1"),setLevel1:t=>m("/level1",{method:"PUT",body:JSON.stringify({content:t})}),resetLevel1:()=>m("/level1",{method:"DELETE"}),presets:()=>m("/presets"),savePreset:(t,o)=>m("/presets/".concat(encodeURIComponent(t)),{method:"PUT",body:JSON.stringify({content:o})}),deletePreset:t=>m("/presets/".concat(encodeURIComponent(t)),{method:"DELETE"}),personas:()=>m("/personas"),savePersona:(t,o)=>m("/personas/".concat(encodeURIComponent(t)),{method:"PUT",body:JSON.stringify({content:o})}),deletePersona:t=>m("/personas/".concat(encodeURIComponent(t)),{method:"DELETE"}),sessions:()=>m("/sessions"),reorderSessions:t=>m("/sessions-order",{method:"PUT",body:JSON.stringify({ids:t})}),metrics:()=>m("/metrics"),syncPlan:t=>m("/repo/sync?dir=".concat(encodeURIComponent(t))),session:t=>m("/sessions/".concat(t)),createSession:(t,o)=>m("/sessions",{method:"POST",body:JSON.stringify({name:t,projectDir:o})}),updateSession:(t,o)=>m("/sessions/".concat(t),{method:"PUT",body:JSON.stringify(o)}),deleteSession:t=>m("/sessions/".concat(t),{method:"DELETE"}),addTask:(t,o)=>m("/sessions/".concat(t,"/tasks"),{method:"POST",body:JSON.stringify(o)}),updateTask:(t,o,e)=>m("/sessions/".concat(t,"/tasks/").concat(o),{method:"PUT",body:JSON.stringify(e)}),deleteTask:(t,o)=>m("/sessions/".concat(t,"/tasks/").concat(o),{method:"DELETE"}),continueTask:(t,o)=>m("/sessions/".concat(t,"/tasks/").concat(o,"/continue"),{method:"POST",body:"{}"}),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 m("/sessions/".concat(t,"/tasks/").concat(o,"/rerun"),{method:"POST",body:JSON.stringify({...e,...n.buildOnFinished?{buildOnFinished:!0}:{}})})},taskChanges:(t,o,e)=>m("/sessions/".concat(t,"/tasks/").concat(o,"/changes").concat(e?"?run=".concat(encodeURIComponent(e)):"")),taskChangeFile:(t,o,e,n)=>m("/sessions/".concat(t,"/tasks/").concat(o,"/changes/file?path=").concat(encodeURIComponent(e)).concat(n?"&run=".concat(encodeURIComponent(n)):"")),taskStory:(t,o,e)=>m("/sessions/".concat(t,"/tasks/").concat(o,"/story").concat(e?"?run=".concat(encodeURIComponent(e)):"")),taskFiles:(t,o,e)=>m("/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)=>m("/sessions/".concat(t,"/tasks/").concat(o,"/log").concat(e?"?run=".concat(encodeURIComponent(e)):""),{method:"POST",body:"{}"}),saveTaskFile:(t,o,e,n,s)=>m("/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)=>m("/sessions/".concat(t,"/start"),{method:"POST",body:JSON.stringify({mode:o,name:e})}),stop:t=>m("/sessions/".concat(t,"/stop"),{method:"POST",body:"{}"}),approvals:t=>m("/approvals".concat(t?"?session=".concat(encodeURIComponent(t)):"")),decide:(t,o)=>m("/approvals/".concat(t),{method:"POST",body:JSON.stringify({action:o})}),setRunMode:(t,o)=>m("/sessions/".concat(t,"/mode"),{method:"POST",body:JSON.stringify({mode:o})}),streamUrl:t=>i("".concat(n,"/sessions/").concat(t,"/stream")),batch:()=>m("/batch").then(t=>null!=t?t:null),startBatch:(t,o,e,n,s,c,a)=>m("/batch/start",{method:"POST",body:JSON.stringify({sessionIds:t,mode:o,onFailure:e,model:n,reviewModel:s,name:c,taskIds:a})}),suggestedRunName:t=>m("/batch/name?sessions=".concat(encodeURIComponent(t.join(",")))),stopBatch:()=>m("/batch/stop",{method:"POST",body:"{}"}),pauseBatch:()=>m("/batch/pause",{method:"POST",body:"{}"}),resumeBatch:()=>m("/batch/resume",{method:"POST",body:"{}"}),planBrief:t=>m("/plan/brief?lang=".concat(encodeURIComponent(t))),context:(t,o)=>m("/context/".concat(t,"?lang=").concat(encodeURIComponent(o))),setContext:(t,o)=>m("/context/".concat(t),{method:"PUT",body:JSON.stringify({content:o})}),resetContext:(t,o)=>m("/context/".concat(t,"?lang=").concat(encodeURIComponent(o)),{method:"DELETE"}),checkPlan:t=>m("/plan/check",{method:"POST",body:JSON.stringify({text:t})}),importPlan:t=>m("/plan/import",{method:"POST",body:JSON.stringify({text:t})}),browseFolder:t=>m("/browse-folder",{method:"POST",body:JSON.stringify({start:t})},{timeoutMs:null}),tasks:()=>m("/tasks"),activity:()=>m("/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()),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,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=>m("/sessions/".concat(t,"/vcs")),vcsSnapshot:(t,o)=>m("/sessions/".concat(t,"/vcs/snapshot"),{method:"POST",body:JSON.stringify({choices:o})}),restorePreview:(t,o)=>m("/sessions/".concat(t,"/tasks/").concat(o,"/restore")),restore:(t,o)=>m("/sessions/".concat(t,"/tasks/").concat(o,"/restore"),{method:"POST",body:"{}"}),restartPlan:(t,o)=>m("/sessions/".concat(t,"/tasks/").concat(o,"/restart")),restartFrom:function(t,o){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return m("/sessions/".concat(t,"/tasks/").concat(o,"/restart"),{method:"POST",body:JSON.stringify(e)})},repoCheck:t=>m("/repo?dir=".concat(encodeURIComponent(t))),project:()=>m("/project"),setProject:t=>m("/project",{method:"PUT",body:JSON.stringify(t)}),models:()=>m("/models"),setDefaultModel:t=>m("/models/default",{method:"PUT",body:JSON.stringify({model:t})}),setDefaultReviewModel:t=>m("/models/review-default",{method:"PUT",body:JSON.stringify({model:t})}),refreshModels:()=>m("/models/refresh",{method:"POST",body:"{}"},{timeoutMs:null}),login:t=>m("/login",{method:"POST",body:JSON.stringify({account:(null==t?void 0:t.trim())||void 0})},{timeoutMs:null})};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 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")}}}]);